diff --git a/internal/compiler/program.go b/internal/compiler/program.go index 096b87f048..db57fcbac3 100644 --- a/internal/compiler/program.go +++ b/internal/compiler/program.go @@ -19,6 +19,7 @@ import ( "github.com/microsoft/typescript-go/internal/module" "github.com/microsoft/typescript-go/internal/modulespecifiers" "github.com/microsoft/typescript-go/internal/outputpaths" + "github.com/microsoft/typescript-go/internal/packagejson" "github.com/microsoft/typescript-go/internal/parser" "github.com/microsoft/typescript-go/internal/printer" "github.com/microsoft/typescript-go/internal/scanner" @@ -101,6 +102,11 @@ func (p *Program) GetPackageJsonInfo(pkgJsonPath string) modulespecifiers.Packag return nil } +// Iterates on all package json cache entries +func (p *Program) PackageJsonCacheEntries(f func(key tspath.Path, value *packagejson.InfoCacheEntry) bool) { + p.resolver.PackageJsonCacheEntries(f) +} + // GetRedirectTargets implements checker.Program. func (p *Program) GetRedirectTargets(path tspath.Path) []string { return nil // !!! TODO: project references support diff --git a/internal/execute/build/buildtask.go b/internal/execute/build/buildtask.go index 846dc97120..4583d293cc 100644 --- a/internal/execute/build/buildtask.go +++ b/internal/execute/build/buildtask.go @@ -71,6 +71,7 @@ type buildTask struct { configTime time.Time extendedConfigTimes []time.Time inputFiles []time.Time + packageJsonTimes []time.Time buildInfoEntry *buildInfoEntry buildInfoEntryMu sync.Mutex @@ -346,6 +347,9 @@ func (t *buildTask) getUpToDateStatus(orchestrator *Orchestrator, configPath tsp // Check the build info buildInfoPath := t.resolved.GetBuildInfoFileName() + getBuildInfoDirectory := core.Memoize(func() string { + return tspath.GetDirectoryPath(tspath.GetNormalizedAbsolutePath(buildInfoPath, orchestrator.comparePathsOptions.CurrentDirectory)) + }) buildInfo, buildInfoTime := t.loadOrStoreBuildInfo(orchestrator, configPath, buildInfoPath) if buildInfo == nil { return &upToDateStatus{kind: upToDateStatusTypeOutputMissing, data: buildInfoPath} @@ -382,7 +386,7 @@ func (t *buildTask) getUpToDateStatus(orchestrator *Orchestrator, configPath tsp } // Some of the emit files like source map or dts etc are not yet done - if buildInfo.IsEmitPending(t.resolved, tspath.GetDirectoryPath(tspath.GetNormalizedAbsolutePath(buildInfoPath, orchestrator.comparePathsOptions.CurrentDirectory))) { + if buildInfo.IsEmitPending(t.resolved, getBuildInfoDirectory()) { return &upToDateStatus{kind: upToDateStatusTypeOutOfDateOptions, data: buildInfoPath} } } @@ -390,7 +394,9 @@ func (t *buildTask) getUpToDateStatus(orchestrator *Orchestrator, configPath tsp oldestOutputFileAndTime := fileAndTime{buildInfoPath, buildInfoTime} var newestInputFileAndTime fileAndTime var seenRoots collections.Set[tspath.Path] - var buildInfoRootInfoReader *incremental.BuildInfoRootInfoReader + getBuildInfoRootInfoReader := core.Memoize(func() *incremental.BuildInfoRootInfoReader { + return buildInfo.GetBuildInfoRootInfoReader(getBuildInfoDirectory(), orchestrator.comparePathsOptions) + }) for _, inputFile := range t.resolved.FileNames() { inputTime := orchestrator.host.GetMTime(inputFile) if inputTime.IsZero() { @@ -401,10 +407,7 @@ func (t *buildTask) getUpToDateStatus(orchestrator *Orchestrator, configPath tsp var version string var currentVersion string if buildInfo.IsIncremental() { - if buildInfoRootInfoReader == nil { - buildInfoRootInfoReader = buildInfo.GetBuildInfoRootInfoReader(tspath.GetDirectoryPath(tspath.GetNormalizedAbsolutePath(buildInfoPath, orchestrator.comparePathsOptions.CurrentDirectory)), orchestrator.comparePathsOptions) - } - buildInfoFileInfo, resolvedInputPath := buildInfoRootInfoReader.GetBuildInfoFileInfo(inputPath) + buildInfoFileInfo, resolvedInputPath := getBuildInfoRootInfoReader().GetBuildInfoFileInfo(inputPath) if fileInfo := buildInfoFileInfo.GetFileInfo(); fileInfo != nil && fileInfo.Version() != "" { version = fileInfo.Version() if text, ok := orchestrator.host.FS().ReadFile(string(resolvedInputPath)); ok { @@ -426,10 +429,7 @@ func (t *buildTask) getUpToDateStatus(orchestrator *Orchestrator, configPath tsp seenRoots.Add(inputPath) } - if buildInfoRootInfoReader == nil { - buildInfoRootInfoReader = buildInfo.GetBuildInfoRootInfoReader(tspath.GetDirectoryPath(tspath.GetNormalizedAbsolutePath(buildInfoPath, orchestrator.comparePathsOptions.CurrentDirectory)), orchestrator.comparePathsOptions) - } - for root := range buildInfoRootInfoReader.Roots() { + for root := range getBuildInfoRootInfoReader().Roots() { if !seenRoots.Has(root) { // File was root file when project was built but its not any more return &upToDateStatus{kind: upToDateStatusTypeOutOfDateRoots, data: &inputOutputName{string(root), buildInfoPath}} @@ -512,14 +512,12 @@ func (t *buildTask) getUpToDateStatus(orchestrator *Orchestrator, configPath tsp } } - // !!! sheetal TODO : watch?? - // // Check package file time - // const packageJsonLookups = state.lastCachedPackageJsonLookups.get(resolvedPath); - // const dependentPackageFileStatus = packageJsonLookups && forEachKey( - // packageJsonLookups, - // path => checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName), - // ); - // if (dependentPackageFileStatus) return dependentPackageFileStatus; + for packageJson := range buildInfo.GetPackageJsons(getBuildInfoDirectory()) { + packageJsonStatus := checkInputFileTime(packageJson) + if packageJsonStatus != nil { + return packageJsonStatus + } + } return &upToDateStatus{ kind: core.IfElse( @@ -729,6 +727,11 @@ func (t *buildTask) updateWatch(orchestrator *Orchestrator, oldCache *collection } } } + if t.buildInfoEntry != nil && t.buildInfoEntry.buildInfo != nil { + for file := range t.buildInfoEntry.buildInfo.GetPackageJsons(tspath.GetDirectoryPath(string(t.buildInfoEntry.path))) { + t.packageJsonTimes = append(t.packageJsonTimes, orchestrator.host.loadOrStoreMTime(file, oldCache, false)) + } + } } func (t *buildTask) resetStatus() { @@ -778,6 +781,16 @@ func (t *buildTask) hasUpdate(orchestrator *Orchestrator, path tspath.Path) upda } } } + if t.buildInfoEntry != nil && t.buildInfoEntry.buildInfo != nil { + index := 0 + for file := range t.buildInfoEntry.buildInfo.GetPackageJsons(tspath.GetDirectoryPath(string(t.buildInfoEntry.path))) { + if orchestrator.host.GetMTime(file) != t.packageJsonTimes[index] { + t.resetStatus() + needsUpdate = true + } + index++ + } + } return core.IfElse(needsConfigUpdate, updateKindConfig, core.IfElse(needsUpdate, updateKindUpdate, updateKindNone)) } diff --git a/internal/execute/incremental/buildInfo.go b/internal/execute/incremental/buildInfo.go index ab5b622363..8329c9a04e 100644 --- a/internal/execute/incremental/buildInfo.go +++ b/internal/execute/incremental/buildInfo.go @@ -457,6 +457,7 @@ type BuildInfo struct { Errors bool `json:"errors,omitzero"` CheckPending bool `json:"checkPending,omitzero"` Root []*BuildInfoRoot `json:"root,omitzero"` + PackageJsons []string `json:"packageJsons,omitzero"` // IncrementalProgram info FileNames []string `json:"fileNames,omitzero"` @@ -520,6 +521,16 @@ func (b *BuildInfo) IsEmitPending(resolved *tsoptions.ParsedCommandLine, buildIn return false } +func (b *BuildInfo) GetPackageJsons(buildInfoDirectory string) iter.Seq[string] { + return func(yield func(string) bool) { + for _, packageJson := range b.PackageJsons { + if !yield(tspath.GetNormalizedAbsolutePath(packageJson, buildInfoDirectory)) { + return + } + } + } +} + func (b *BuildInfo) GetBuildInfoRootInfoReader(buildInfoDirectory string, comparePathOptions tspath.ComparePathsOptions) *BuildInfoRootInfoReader { resolvedRootFileInfos := make(map[tspath.Path]*BuildInfoFileInfo, len(b.FileNames)) // Roots of the File diff --git a/internal/execute/incremental/buildinfotosnapshot.go b/internal/execute/incremental/buildinfotosnapshot.go index 10ebb40f64..69be016d99 100644 --- a/internal/execute/incremental/buildinfotosnapshot.go +++ b/internal/execute/incremental/buildinfotosnapshot.go @@ -43,6 +43,7 @@ func buildInfoToSnapshot(buildInfo *BuildInfo, config *tsoptions.ParsedCommandLi to.snapshot.hasErrors = core.IfElse(buildInfo.Errors, core.TSTrue, core.TSFalse) to.snapshot.hasSemanticErrors = buildInfo.SemanticErrors to.snapshot.checkPending = buildInfo.CheckPending + to.setPackageJsons() return &to.snapshot } @@ -169,3 +170,11 @@ func (t *toSnapshot) setAffectedFilesPendingEmit() { t.snapshot.affectedFilesPendingEmit.Store(t.toFilePath(pendingEmit.FileId), core.IfElse(pendingEmit.EmitKind == 0, ownOptionsEmitKind, pendingEmit.EmitKind)) } } + +func (t *toSnapshot) setPackageJsons() { + if t.buildInfo.PackageJsons != nil { + t.snapshot.packageJsons = core.Map(t.buildInfo.PackageJsons, t.toAbsolutePath) + } else { + t.snapshot.packageJsons = make([]string, 0) + } +} diff --git a/internal/execute/incremental/host.go b/internal/execute/incremental/host.go index 55d6bbc088..6b1a049ef3 100644 --- a/internal/execute/incremental/host.go +++ b/internal/execute/incremental/host.go @@ -4,9 +4,11 @@ import ( "time" "github.com/microsoft/typescript-go/internal/compiler" + "github.com/microsoft/typescript-go/internal/vfs" ) type Host interface { + FS() vfs.FS GetMTime(fileName string) time.Time SetMTime(fileName string, mTime time.Time) error } @@ -17,12 +19,16 @@ type host struct { var _ Host = (*host)(nil) -func (b *host) GetMTime(fileName string) time.Time { - return GetMTime(b.host, fileName) +func (h *host) FS() vfs.FS { + return h.host.FS() } -func (b *host) SetMTime(fileName string, mTime time.Time) error { - return b.host.FS().Chtimes(fileName, time.Time{}, mTime) +func (h *host) GetMTime(fileName string) time.Time { + return GetMTime(h.host, fileName) +} + +func (h *host) SetMTime(fileName string, mTime time.Time) error { + return h.host.FS().Chtimes(fileName, time.Time{}, mTime) } func CreateHost(compilerHost compiler.CompilerHost) Host { diff --git a/internal/execute/incremental/program.go b/internal/execute/incremental/program.go index 1512126297..d1e9771477 100644 --- a/internal/execute/incremental/program.go +++ b/internal/execute/incremental/program.go @@ -12,6 +12,7 @@ import ( "github.com/microsoft/typescript-go/internal/core" "github.com/microsoft/typescript-go/internal/diagnostics" "github.com/microsoft/typescript-go/internal/outputpaths" + "github.com/microsoft/typescript-go/internal/packagejson" "github.com/microsoft/typescript-go/internal/tspath" ) @@ -260,11 +261,17 @@ func (p *Program) emitBuildInfo(ctx context.Context, options compiler.EmitOption return nil } if p.snapshot.hasErrors == core.TSUnknown { - p.ensureHasErrorsForState(ctx, p.program) + p.ensureHasErrorsForState(ctx) if p.snapshot.hasErrors != p.snapshot.hasErrorsFromOldState || p.snapshot.hasSemanticErrors != p.snapshot.hasSemanticErrorsFromOldState { p.snapshot.buildInfoEmitPending.Store(true) } } + if p.snapshot.packageJsons == nil { + p.ensurePackageJsonsForState() + if !slices.Equal(p.snapshot.packageJsons, p.snapshot.packageJsonsFromOldState) { + p.snapshot.buildInfoEmitPending.Store(true) + } + } if !p.snapshot.buildInfoEmitPending.Load() { return nil } @@ -298,9 +305,9 @@ func (p *Program) emitBuildInfo(ctx context.Context, options compiler.EmitOption } } -func (p *Program) ensureHasErrorsForState(ctx context.Context, program *compiler.Program) { +func (p *Program) ensureHasErrorsForState(ctx context.Context) { var hasIncludeProcessingDiagnostics bool - if slices.ContainsFunc(program.GetSourceFiles(), func(file *ast.SourceFile) bool { + if slices.ContainsFunc(p.program.GetSourceFiles(), func(file *ast.SourceFile) bool { if _, ok := p.snapshot.emitDiagnosticsPerFile.Load(file.Path()); ok { // emit diagnostics will be encoded in buildInfo; return true @@ -317,12 +324,12 @@ func (p *Program) ensureHasErrorsForState(ctx context.Context, program *compiler return } if hasIncludeProcessingDiagnostics || - len(program.GetConfigFileParsingDiagnostics()) > 0 || - len(program.GetSyntacticDiagnostics(ctx, nil)) > 0 || - len(program.GetProgramDiagnostics()) > 0 || - len(program.GetBindDiagnostics(ctx, nil)) > 0 || - len(program.GetOptionsDiagnostics(ctx)) > 0 || - len(program.GetGlobalDiagnostics(ctx)) > 0 { + len(p.program.GetConfigFileParsingDiagnostics()) > 0 || + len(p.program.GetSyntacticDiagnostics(ctx, nil)) > 0 || + len(p.program.GetProgramDiagnostics()) > 0 || + len(p.program.GetBindDiagnostics(ctx, nil)) > 0 || + len(p.program.GetOptionsDiagnostics(ctx)) > 0 || + len(p.program.GetGlobalDiagnostics(ctx)) > 0 { p.snapshot.hasErrors = core.TSTrue // Dont need to encode semantic errors state since the syntax and program diagnostics are encoded as present p.snapshot.hasSemanticErrors = false @@ -331,7 +338,7 @@ func (p *Program) ensureHasErrorsForState(ctx context.Context, program *compiler p.snapshot.hasErrors = core.TSFalse // Check semantic and emit diagnostics first as we dont need to ask program about it - if slices.ContainsFunc(program.GetSourceFiles(), func(file *ast.SourceFile) bool { + if slices.ContainsFunc(p.program.GetSourceFiles(), func(file *ast.SourceFile) bool { semanticDiagnostics, ok := p.snapshot.semanticDiagnosticsPerFile.Load(file.Path()) if !ok { // Missing semantic diagnostics in cache will be encoded in incremental buildInfo @@ -348,3 +355,21 @@ func (p *Program) ensureHasErrorsForState(ctx context.Context, program *compiler p.snapshot.hasSemanticErrors = !p.snapshot.options.IsIncremental() } } + +func (p *Program) ensurePackageJsonsForState() { + config := tspath.GetDirectoryPath(p.program.CommandLine().ConfigName()) + if config != "" { + p.program.PackageJsonCacheEntries(func(key tspath.Path, value *packagejson.InfoCacheEntry) bool { + if value.Exists() { + p.snapshot.packageJsons = append(p.snapshot.packageJsons, p.host.FS().Realpath(tspath.CombinePaths(value.PackageDirectory, "package.json"))) + } + return true + }) + } + if p.snapshot.packageJsons == nil { + p.snapshot.packageJsons = make([]string, 0) + } else { + slices.Sort(p.snapshot.packageJsons) + p.snapshot.packageJsons = core.Deduplicate(p.snapshot.packageJsons) + } +} diff --git a/internal/execute/incremental/programtosnapshot.go b/internal/execute/incremental/programtosnapshot.go index 69f8cd5a7e..d964d8ce98 100644 --- a/internal/execute/incremental/programtosnapshot.go +++ b/internal/execute/incremental/programtosnapshot.go @@ -62,6 +62,7 @@ func (t *toProgramSnapshot) reuseFromOldProgram() { t.snapshot.buildInfoEmitPending.Store(t.oldProgram.snapshot.buildInfoEmitPending.Load()) t.snapshot.hasErrorsFromOldState = t.oldProgram.snapshot.hasErrors t.snapshot.hasSemanticErrorsFromOldState = t.oldProgram.snapshot.hasSemanticErrors + t.snapshot.packageJsonsFromOldState = t.oldProgram.snapshot.packageJsons } else { t.snapshot.buildInfoEmitPending.Store(t.snapshot.options.IsIncremental()) } diff --git a/internal/execute/incremental/snapshot.go b/internal/execute/incremental/snapshot.go index 88d53c47cd..b1c4b9a388 100644 --- a/internal/execute/incremental/snapshot.go +++ b/internal/execute/incremental/snapshot.go @@ -216,6 +216,8 @@ type snapshot struct { hasSemanticErrors bool // If semantic diagnostic check is pending checkPending bool + // Looked up package.json files from + packageJsons []string // Additional fields that are not serialized but needed to track state @@ -224,6 +226,7 @@ type snapshot struct { hasErrorsFromOldState core.Tristate hasSemanticErrorsFromOldState bool allFilesExcludingDefaultLibraryFileOnce sync.Once + packageJsonsFromOldState []string // Cache of all files excluding default library file for the current program allFilesExcludingDefaultLibraryFile []*ast.SourceFile hasChangedDtsFile bool diff --git a/internal/execute/incremental/snapshottobuildinfo.go b/internal/execute/incremental/snapshottobuildinfo.go index 4de35e138b..ee8dd1fd82 100644 --- a/internal/execute/incremental/snapshottobuildinfo.go +++ b/internal/execute/incremental/snapshottobuildinfo.go @@ -49,6 +49,7 @@ func snapshotToBuildInfo(snapshot *snapshot, program *compiler.Program, buildInf to.buildInfo.Errors = snapshot.hasErrors.IsTrue() to.buildInfo.SemanticErrors = snapshot.hasSemanticErrors to.buildInfo.CheckPending = snapshot.checkPending + to.setPackageJsons() return &to.buildInfo } @@ -350,3 +351,9 @@ func (t *toBuildInfo) setRootOfNonIncrementalProgram() { } }) } + +func (t *toBuildInfo) setPackageJsons() { + if len(t.snapshot.packageJsons) > 0 { + t.buildInfo.PackageJsons = core.Map(t.snapshot.packageJsons, t.relativeToBuildInfo) + } +} diff --git a/internal/execute/tsctests/readablebuildinfo.go b/internal/execute/tsctests/readablebuildinfo.go index 3969ac5f75..43b9575999 100644 --- a/internal/execute/tsctests/readablebuildinfo.go +++ b/internal/execute/tsctests/readablebuildinfo.go @@ -20,6 +20,7 @@ type readableBuildInfo struct { Errors bool `json:"errors,omitzero"` CheckPending bool `json:"checkPending,omitzero"` Root []*readableBuildInfoRoot `json:"root,omitzero"` + PackageJsons []string `json:"packageJsons,omitzero"` // IncrementalProgram info FileNames []string `json:"fileNames,omitzero"` @@ -214,6 +215,7 @@ func toReadableBuildInfo(buildInfo *incremental.BuildInfo, buildInfoText string) Options: buildInfo.Options, LatestChangedDtsFile: buildInfo.LatestChangedDtsFile, SemanticErrors: buildInfo.SemanticErrors, + PackageJsons: buildInfo.PackageJsons, Size: len(buildInfoText), } readable.setFileInfos() diff --git a/internal/execute/tsctests/tsc_test.go b/internal/execute/tsctests/tsc_test.go index b9a88f6196..f8af7e0e87 100644 --- a/internal/execute/tsctests/tsc_test.go +++ b/internal/execute/tsctests/tsc_test.go @@ -2395,7 +2395,6 @@ func TestTscModuleResolution(t *testing.T) { }, }, { - // !!! sheetal package.json watches not yet implemented subScenario: `resolves specifier in output declaration file from referenced project correctly with cts and mts extensions`, files: FileMap{ `/user/username/projects/myproject/packages/pkg1/package.json`: stringtestutil.Dedent(` @@ -2443,7 +2442,6 @@ func TestTscModuleResolution(t *testing.T) { edit: func(sys *testSys) { sys.replaceFileText(`/user/username/projects/myproject/packages/pkg1/package.json`, `"module"`, `"commonjs"`) }, - expectedDiff: "Package.json watch pending, so no change detected yet", }, { caption: "removes those errors when a package file is changed back", @@ -2456,7 +2454,6 @@ func TestTscModuleResolution(t *testing.T) { edit: func(sys *testSys) { sys.replaceFileText(`/user/username/projects/myproject/packages/pkg1/package.json`, `"module"`, `"commonjs"`) }, - expectedDiff: "Package.json watch pending, so no change detected yet", }, { caption: "removes those errors when a package file is changed to cjs extensions", @@ -2512,7 +2509,6 @@ func TestTscModuleResolution(t *testing.T) { edit: func(sys *testSys) { sys.replaceFileText(`/user/username/projects/myproject/packages/pkg2/package.json`, `index.js`, `other.js`) }, - expectedDiff: "Package.json watch pending, so no change detected yet", }, { caption: "removes those errors when a package file is changed back", diff --git a/internal/module/resolver.go b/internal/module/resolver.go index 780f0deb67..35c75bdef2 100644 --- a/internal/module/resolver.go +++ b/internal/module/resolver.go @@ -190,6 +190,10 @@ func (r *Resolver) GetPackageJsonScopeIfApplicable(path string) *packagejson.Inf return nil } +func (r *Resolver) PackageJsonCacheEntries(f func(key tspath.Path, value *packagejson.InfoCacheEntry) bool) { + r.caches.packageJsonInfoCache.Range(f) +} + func (r *tracer) traceResolutionUsingProjectReference(redirectedReference ResolvedProjectReference) { if redirectedReference != nil && redirectedReference.CompilerOptions() != nil { r.write(diagnostics.Using_compiler_options_of_project_reference_redirect_0.Format(redirectedReference.ConfigName())) diff --git a/internal/packagejson/cache.go b/internal/packagejson/cache.go index 7b72a4e3e9..bf97efff01 100644 --- a/internal/packagejson/cache.go +++ b/internal/packagejson/cache.go @@ -146,3 +146,7 @@ func (p *InfoCache) Set(packageJsonPath string, info *InfoCacheEntry) *InfoCache actual, _ := p.cache.LoadOrStore(key, info) return actual } + +func (p *InfoCache) Range(f func(key tspath.Path, value *InfoCacheEntry) bool) { + p.cache.Range(f) +} diff --git a/internal/tsoptions/parsedcommandline.go b/internal/tsoptions/parsedcommandline.go index f40fbc2639..90a357e38f 100644 --- a/internal/tsoptions/parsedcommandline.go +++ b/internal/tsoptions/parsedcommandline.go @@ -68,7 +68,7 @@ var ( ) func (p *ParsedCommandLine) ConfigName() string { - if p == nil { + if p == nil || p.ConfigFile == nil { return "" } return p.ConfigFile.SourceFile.FileName() diff --git a/testdata/baselines/reference/tsbuild/declarationEmit/reports-dts-generation-errors-with-incremental.js b/testdata/baselines/reference/tsbuild/declarationEmit/reports-dts-generation-errors-with-incremental.js index a82f347c23..14a02438df 100644 --- a/testdata/baselines/reference/tsbuild/declarationEmit/reports-dts-generation-errors-with-incremental.js +++ b/testdata/baselines/reference/tsbuild/declarationEmit/reports-dts-generation-errors-with-incremental.js @@ -95,7 +95,7 @@ import ky from 'ky'; export const api = ky.extend({}); //// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *new* -{"version":"FakeTSVersion","root":[3],"fileNames":["lib.esnext.full.d.ts","./node_modules/ky/distribution/index.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b9b50c37c18e43d94b0dd4fb43967f10-type KyInstance = {\n extend(options: Record): KyInstance;\n}\ndeclare const ky: KyInstance;\nexport default ky;","impliedNodeFormat":99},{"version":"0f5091e963c17913313e4969c59e6eb4-import ky from 'ky';\nexport const api = ky.extend({});","signature":"5816fe34b5cf354b0d0d19bc77874616-export declare const api: {\n extend(options: Record): KyInstance;\n};\n\n(34,3): error4023: Exported variable 'api' has or is using name 'KyInstance' from external module \"/home/src/workspaces/project/node_modules/ky/distribution/index\" but cannot be named.","impliedNodeFormat":99}],"fileIdsList":[[2]],"options":{"composite":false,"declaration":true,"module":199,"skipLibCheck":true,"skipDefaultLibCheck":true},"referencedMap":[[3,1]],"emitDiagnosticsPerFile":[[3,[{"pos":34,"end":37,"code":4023,"category":1,"message":"Exported variable 'api' has or is using name 'KyInstance' from external module \"/home/src/workspaces/project/node_modules/ky/distribution/index\" but cannot be named."}]]]} +{"version":"FakeTSVersion","root":[3],"packageJsons":["./node_modules/ky/package.json","./package.json"],"fileNames":["lib.esnext.full.d.ts","./node_modules/ky/distribution/index.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b9b50c37c18e43d94b0dd4fb43967f10-type KyInstance = {\n extend(options: Record): KyInstance;\n}\ndeclare const ky: KyInstance;\nexport default ky;","impliedNodeFormat":99},{"version":"0f5091e963c17913313e4969c59e6eb4-import ky from 'ky';\nexport const api = ky.extend({});","signature":"5816fe34b5cf354b0d0d19bc77874616-export declare const api: {\n extend(options: Record): KyInstance;\n};\n\n(34,3): error4023: Exported variable 'api' has or is using name 'KyInstance' from external module \"/home/src/workspaces/project/node_modules/ky/distribution/index\" but cannot be named.","impliedNodeFormat":99}],"fileIdsList":[[2]],"options":{"composite":false,"declaration":true,"module":199,"skipLibCheck":true,"skipDefaultLibCheck":true},"referencedMap":[[3,1]],"emitDiagnosticsPerFile":[[3,[{"pos":34,"end":37,"code":4023,"category":1,"message":"Exported variable 'api' has or is using name 'KyInstance' from external module \"/home/src/workspaces/project/node_modules/ky/distribution/index\" but cannot be named."}]]]} //// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", @@ -107,6 +107,10 @@ export const api = ky.extend({}); "original": 3 } ], + "packageJsons": [ + "./node_modules/ky/package.json", + "./package.json" + ], "fileNames": [ "lib.esnext.full.d.ts", "./node_modules/ky/distribution/index.d.ts", @@ -178,7 +182,7 @@ export const api = ky.extend({}); ] ] ], - "size": 1983 + "size": 2050 } tsconfig.json:: diff --git a/testdata/baselines/reference/tsbuild/declarationEmit/reports-dts-generation-errors.js b/testdata/baselines/reference/tsbuild/declarationEmit/reports-dts-generation-errors.js index f166f7e552..1bdc5bf23f 100644 --- a/testdata/baselines/reference/tsbuild/declarationEmit/reports-dts-generation-errors.js +++ b/testdata/baselines/reference/tsbuild/declarationEmit/reports-dts-generation-errors.js @@ -95,7 +95,7 @@ import ky from 'ky'; export const api = ky.extend({}); //// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *new* -{"version":"FakeTSVersion","errors":true,"root":["./index.ts"]} +{"version":"FakeTSVersion","errors":true,"root":["./index.ts"],"packageJsons":["./node_modules/ky/package.json","./package.json"]} //// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", @@ -108,7 +108,11 @@ export const api = ky.extend({}); "original": "./index.ts" } ], - "size": 63 + "packageJsons": [ + "./node_modules/ky/package.json", + "./package.json" + ], + "size": 130 } tsconfig.json:: diff --git a/testdata/baselines/reference/tsbuild/moduleResolution/impliedNodeFormat-differs-between-projects-for-shared-file.js b/testdata/baselines/reference/tsbuild/moduleResolution/impliedNodeFormat-differs-between-projects-for-shared-file.js index 4c0233d595..35856ce0a6 100644 --- a/testdata/baselines/reference/tsbuild/moduleResolution/impliedNodeFormat-differs-between-projects-for-shared-file.js +++ b/testdata/baselines/reference/tsbuild/moduleResolution/impliedNodeFormat-differs-between-projects-for-shared-file.js @@ -149,7 +149,7 @@ declare const console: { log(msg: any): void; }; //// [/home/src/workspaces/project/a/src/index.js] *new* //// [/home/src/workspaces/project/a/tsconfig.tsbuildinfo] *new* -{"version":"FakeTSVersion","root":["./src/index.ts"]} +{"version":"FakeTSVersion","root":["./src/index.ts"],"packageJsons":["../node_modules/@types/pg/package.json"]} //// [/home/src/workspaces/project/a/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", @@ -161,14 +161,17 @@ declare const console: { log(msg: any): void; }; "original": "./src/index.ts" } ], - "size": 53 + "packageJsons": [ + "../node_modules/@types/pg/package.json" + ], + "size": 111 } //// [/home/src/workspaces/project/b/src/index.js] *new* import pg from "pg"; pg.foo(); //// [/home/src/workspaces/project/b/tsconfig.tsbuildinfo] *new* -{"version":"FakeTSVersion","root":["./src/index.ts"]} +{"version":"FakeTSVersion","root":["./src/index.ts"],"packageJsons":["./package.json","../node_modules/@types/pg/package.json"]} //// [/home/src/workspaces/project/b/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", @@ -180,7 +183,11 @@ pg.foo(); "original": "./src/index.ts" } ], - "size": 53 + "packageJsons": [ + "./package.json", + "../node_modules/@types/pg/package.json" + ], + "size": 128 } a/tsconfig.json:: diff --git a/testdata/baselines/reference/tsbuild/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly-with-preserveSymlinks.js b/testdata/baselines/reference/tsbuild/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly-with-preserveSymlinks.js index 45b4bc5898..58d3f14e35 100644 --- a/testdata/baselines/reference/tsbuild/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly-with-preserveSymlinks.js +++ b/testdata/baselines/reference/tsbuild/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly-with-preserveSymlinks.js @@ -129,7 +129,7 @@ exports.theNum = void 0; exports.theNum = 42; //// [/user/username/projects/myproject/packages/pkg1/build/tsconfig.tsbuildinfo] *new* -{"version":"FakeTSVersion","root":["../index.ts"]} +{"version":"FakeTSVersion","root":["../index.ts"],"packageJsons":["../../pkg2/package.json"]} //// [/user/username/projects/myproject/packages/pkg1/build/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", @@ -141,7 +141,10 @@ exports.theNum = 42; "original": "../index.ts" } ], - "size": 50 + "packageJsons": [ + "../../pkg2/package.json" + ], + "size": 93 } //// [/user/username/projects/myproject/packages/pkg2/build/const.d.ts] *new* export type TheNum = 42; diff --git a/testdata/baselines/reference/tsbuild/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly.js b/testdata/baselines/reference/tsbuild/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly.js index 3744082d9d..3d2d1365bb 100644 --- a/testdata/baselines/reference/tsbuild/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly.js +++ b/testdata/baselines/reference/tsbuild/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly.js @@ -130,7 +130,7 @@ exports.theNum = void 0; exports.theNum = 42; //// [/user/username/projects/myproject/packages/pkg1/build/tsconfig.tsbuildinfo] *new* -{"version":"FakeTSVersion","root":["../index.ts"]} +{"version":"FakeTSVersion","root":["../index.ts"],"packageJsons":["../../pkg2/package.json"]} //// [/user/username/projects/myproject/packages/pkg1/build/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", @@ -142,7 +142,10 @@ exports.theNum = 42; "original": "../index.ts" } ], - "size": 50 + "packageJsons": [ + "../../pkg2/package.json" + ], + "size": 93 } //// [/user/username/projects/myproject/packages/pkg2/build/const.d.ts] *new* export type TheNum = 42; diff --git a/testdata/baselines/reference/tsbuild/moduleResolution/shared-resolution-should-not-report-error.js b/testdata/baselines/reference/tsbuild/moduleResolution/shared-resolution-should-not-report-error.js index d66533dcd3..f9dd524a8f 100644 --- a/testdata/baselines/reference/tsbuild/moduleResolution/shared-resolution-should-not-report-error.js +++ b/testdata/baselines/reference/tsbuild/moduleResolution/shared-resolution-should-not-report-error.js @@ -151,7 +151,7 @@ export declare const a = "a"; import 'a'; //// [/home/src/workspaces/project/packages/a/types/tsconfig.tsbuildinfo] *new* -{"version":"FakeTSVersion","root":[[2,3]],"fileNames":["lib.esnext.full.d.ts","../index.js","../test/index.js"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"fb6f7bce1e97f6455fc2f6a3fc00ca67-export const a = 'a';","signature":"410f445844ca5e1f83239796f66520a1-export declare const a = \"a\";\n","impliedNodeFormat":99},{"version":"25c2781885c8232d7ba0f67afa33aa44-import 'a';","signature":"518d564eba22abfaf340ce3ae18a4763-import 'a';\n","impliedNodeFormat":99}],"fileIdsList":[[2]],"options":{"checkJs":true,"composite":true,"emitDeclarationOnly":true,"declaration":true,"module":199,"outDir":"./"},"referencedMap":[[3,1]],"latestChangedDtsFile":"./test/index.d.ts"} +{"version":"FakeTSVersion","root":[[2,3]],"packageJsons":["../package.json"],"fileNames":["lib.esnext.full.d.ts","../index.js","../test/index.js"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"fb6f7bce1e97f6455fc2f6a3fc00ca67-export const a = 'a';","signature":"410f445844ca5e1f83239796f66520a1-export declare const a = \"a\";\n","impliedNodeFormat":99},{"version":"25c2781885c8232d7ba0f67afa33aa44-import 'a';","signature":"518d564eba22abfaf340ce3ae18a4763-import 'a';\n","impliedNodeFormat":99}],"fileIdsList":[[2]],"options":{"checkJs":true,"composite":true,"emitDeclarationOnly":true,"declaration":true,"module":199,"outDir":"./"},"referencedMap":[[3,1]],"latestChangedDtsFile":"./test/index.d.ts"} //// [/home/src/workspaces/project/packages/a/types/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", @@ -167,6 +167,9 @@ import 'a'; ] } ], + "packageJsons": [ + "../package.json" + ], "fileNames": [ "lib.esnext.full.d.ts", "../index.js", @@ -227,10 +230,10 @@ import 'a'; ] }, "latestChangedDtsFile": "./test/index.d.ts", - "size": 1416 + "size": 1451 } //// [/home/src/workspaces/project/packages/b/tsconfig.tsbuildinfo] *new* -{"version":"FakeTSVersion","root":["./index.js"]} +{"version":"FakeTSVersion","root":["./index.js"],"packageJsons":["../a/package.json","./package.json"]} //// [/home/src/workspaces/project/packages/b/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", @@ -242,7 +245,11 @@ import 'a'; "original": "./index.js" } ], - "size": 49 + "packageJsons": [ + "../a/package.json", + "./package.json" + ], + "size": 103 } packages/a/tsconfig.json:: diff --git a/testdata/baselines/reference/tsbuild/moduleResolution/when-resolution-is-not-shared.js b/testdata/baselines/reference/tsbuild/moduleResolution/when-resolution-is-not-shared.js index 6772e2211f..8f68f5c621 100644 --- a/testdata/baselines/reference/tsbuild/moduleResolution/when-resolution-is-not-shared.js +++ b/testdata/baselines/reference/tsbuild/moduleResolution/when-resolution-is-not-shared.js @@ -118,7 +118,7 @@ export declare const a = "a"; import 'a'; //// [/home/src/workspaces/project/packages/a/types/tsconfig.tsbuildinfo] *new* -{"version":"FakeTSVersion","root":[[2,3]],"fileNames":["lib.esnext.full.d.ts","../index.js","../test/index.js"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"fb6f7bce1e97f6455fc2f6a3fc00ca67-export const a = 'a';","signature":"410f445844ca5e1f83239796f66520a1-export declare const a = \"a\";\n","impliedNodeFormat":99},{"version":"25c2781885c8232d7ba0f67afa33aa44-import 'a';","signature":"518d564eba22abfaf340ce3ae18a4763-import 'a';\n","impliedNodeFormat":99}],"fileIdsList":[[2]],"options":{"checkJs":true,"composite":true,"emitDeclarationOnly":true,"declaration":true,"module":199,"outDir":"./"},"referencedMap":[[3,1]],"latestChangedDtsFile":"./test/index.d.ts"} +{"version":"FakeTSVersion","root":[[2,3]],"packageJsons":["../package.json"],"fileNames":["lib.esnext.full.d.ts","../index.js","../test/index.js"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"fb6f7bce1e97f6455fc2f6a3fc00ca67-export const a = 'a';","signature":"410f445844ca5e1f83239796f66520a1-export declare const a = \"a\";\n","impliedNodeFormat":99},{"version":"25c2781885c8232d7ba0f67afa33aa44-import 'a';","signature":"518d564eba22abfaf340ce3ae18a4763-import 'a';\n","impliedNodeFormat":99}],"fileIdsList":[[2]],"options":{"checkJs":true,"composite":true,"emitDeclarationOnly":true,"declaration":true,"module":199,"outDir":"./"},"referencedMap":[[3,1]],"latestChangedDtsFile":"./test/index.d.ts"} //// [/home/src/workspaces/project/packages/a/types/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", @@ -134,6 +134,9 @@ import 'a'; ] } ], + "packageJsons": [ + "../package.json" + ], "fileNames": [ "lib.esnext.full.d.ts", "../index.js", @@ -194,7 +197,7 @@ import 'a'; ] }, "latestChangedDtsFile": "./test/index.d.ts", - "size": 1416 + "size": 1451 } packages/a/tsconfig.json:: @@ -251,7 +254,7 @@ packages/b/index.js Matched by default include pattern '**/*' File is ECMAScript module because 'packages/b/package.json' has field "type" with value "module" //// [/home/src/workspaces/project/packages/b/tsconfig.tsbuildinfo] *new* -{"version":"FakeTSVersion","root":["./index.js"]} +{"version":"FakeTSVersion","root":["./index.js"],"packageJsons":["../a/package.json","./package.json"]} //// [/home/src/workspaces/project/packages/b/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", @@ -263,7 +266,11 @@ packages/b/index.js "original": "./index.js" } ], - "size": 49 + "packageJsons": [ + "../a/package.json", + "./package.json" + ], + "size": 103 } packages/b/tsconfig.json:: diff --git a/testdata/baselines/reference/tsbuild/moduleSpecifiers/synthesized-module-specifiers-across-projects-resolve-correctly.js b/testdata/baselines/reference/tsbuild/moduleSpecifiers/synthesized-module-specifiers-across-projects-resolve-correctly.js index 26f491e365..0da98af120 100644 --- a/testdata/baselines/reference/tsbuild/moduleSpecifiers/synthesized-module-specifiers-across-projects-resolve-correctly.js +++ b/testdata/baselines/reference/tsbuild/moduleSpecifiers/synthesized-module-specifiers-across-projects-resolve-correctly.js @@ -170,7 +170,7 @@ export class LassieDog extends Dog { } //// [/home/src/workspaces/packages/src-dogs/tsconfig.tsbuildinfo] *new* -{"version":"FakeTSVersion","root":[[4,8]],"fileNames":["lib.es2022.full.d.ts","../src-types/dogconfig.d.ts","../src-types/index.d.ts","./dogconfig.ts","./dog.ts","./lassie/lassieconfig.ts","./lassie/lassiedog.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a71e22ebb89c8c5bea7cef8d090ace25-export interface DogConfig {\n name: string;\n}\n","impliedNodeFormat":99},{"version":"3c21c50da3a1aea8b6fafa5aa595f160-export * from './dogconfig.js';\n","impliedNodeFormat":99},{"version":"a8c9e5169f1e05ea3fd4da563dc779b7-import { DogConfig } from 'src-types';\n\nexport const DOG_CONFIG: DogConfig = {\n name: 'Default dog',\n};","signature":"55c35bfb192d26f7ab56e9447864b637-import { DogConfig } from 'src-types';\nexport declare const DOG_CONFIG: DogConfig;\n","impliedNodeFormat":99},{"version":"4ef4eb6072aff36903b09b7e1fa75eea-import { DogConfig } from 'src-types';\nimport { DOG_CONFIG } from './dogconfig.js';\n\nexport abstract class Dog {\n\n public static getCapabilities(): DogConfig {\n return DOG_CONFIG;\n }\n}","signature":"1130c09f22ac69e13b25f0c42f3a9379-import { DogConfig } from 'src-types';\nexport declare abstract class Dog {\n static getCapabilities(): DogConfig;\n}\n","impliedNodeFormat":99},{"version":"37fa5afea0e398a9cc485818c902b71c-import { DogConfig } from 'src-types';\n\nexport const LASSIE_CONFIG: DogConfig = { name: 'Lassie' };","signature":"2ef44fffbc07bb77765462af9f6df2a2-import { DogConfig } from 'src-types';\nexport declare const LASSIE_CONFIG: DogConfig;\n","impliedNodeFormat":99},{"version":"16f2a31a47590452f19f34bb56d0345f-import { Dog } from '../dog.js';\nimport { LASSIE_CONFIG } from './lassieconfig.js';\n\nexport class LassieDog extends Dog {\n protected static getDogConfig = () => LASSIE_CONFIG;\n}","signature":"4e9a2f5bdce32a44b15cca0af7254c50-import { Dog } from '../dog.js';\nexport declare class LassieDog extends Dog {\n protected static getDogConfig: () => import(\"../index.js\").DogConfig;\n}\n","impliedNodeFormat":99},{"version":"099983d5c3c8b20233df02ca964ad12f-export * from 'src-types';\nexport * from './lassie/lassiedog.js';","signature":"0fb03f7b5b8061b0e2cd78a4131e3df7-export * from 'src-types';\nexport * from './lassie/lassiedog.js';\n","impliedNodeFormat":99}],"fileIdsList":[[3,4],[3],[3,7],[5,6],[2]],"options":{"composite":true,"declaration":true,"module":100},"referencedMap":[[5,1],[4,2],[8,3],[6,2],[7,4],[3,5]],"latestChangedDtsFile":"./index.d.ts"} +{"version":"FakeTSVersion","root":[[4,8]],"packageJsons":["./package.json","../src-types/package.json"],"fileNames":["lib.es2022.full.d.ts","../src-types/dogconfig.d.ts","../src-types/index.d.ts","./dogconfig.ts","./dog.ts","./lassie/lassieconfig.ts","./lassie/lassiedog.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a71e22ebb89c8c5bea7cef8d090ace25-export interface DogConfig {\n name: string;\n}\n","impliedNodeFormat":99},{"version":"3c21c50da3a1aea8b6fafa5aa595f160-export * from './dogconfig.js';\n","impliedNodeFormat":99},{"version":"a8c9e5169f1e05ea3fd4da563dc779b7-import { DogConfig } from 'src-types';\n\nexport const DOG_CONFIG: DogConfig = {\n name: 'Default dog',\n};","signature":"55c35bfb192d26f7ab56e9447864b637-import { DogConfig } from 'src-types';\nexport declare const DOG_CONFIG: DogConfig;\n","impliedNodeFormat":99},{"version":"4ef4eb6072aff36903b09b7e1fa75eea-import { DogConfig } from 'src-types';\nimport { DOG_CONFIG } from './dogconfig.js';\n\nexport abstract class Dog {\n\n public static getCapabilities(): DogConfig {\n return DOG_CONFIG;\n }\n}","signature":"1130c09f22ac69e13b25f0c42f3a9379-import { DogConfig } from 'src-types';\nexport declare abstract class Dog {\n static getCapabilities(): DogConfig;\n}\n","impliedNodeFormat":99},{"version":"37fa5afea0e398a9cc485818c902b71c-import { DogConfig } from 'src-types';\n\nexport const LASSIE_CONFIG: DogConfig = { name: 'Lassie' };","signature":"2ef44fffbc07bb77765462af9f6df2a2-import { DogConfig } from 'src-types';\nexport declare const LASSIE_CONFIG: DogConfig;\n","impliedNodeFormat":99},{"version":"16f2a31a47590452f19f34bb56d0345f-import { Dog } from '../dog.js';\nimport { LASSIE_CONFIG } from './lassieconfig.js';\n\nexport class LassieDog extends Dog {\n protected static getDogConfig = () => LASSIE_CONFIG;\n}","signature":"4e9a2f5bdce32a44b15cca0af7254c50-import { Dog } from '../dog.js';\nexport declare class LassieDog extends Dog {\n protected static getDogConfig: () => import(\"../index.js\").DogConfig;\n}\n","impliedNodeFormat":99},{"version":"099983d5c3c8b20233df02ca964ad12f-export * from 'src-types';\nexport * from './lassie/lassiedog.js';","signature":"0fb03f7b5b8061b0e2cd78a4131e3df7-export * from 'src-types';\nexport * from './lassie/lassiedog.js';\n","impliedNodeFormat":99}],"fileIdsList":[[3,4],[3],[3,7],[5,6],[2]],"options":{"composite":true,"declaration":true,"module":100},"referencedMap":[[5,1],[4,2],[8,3],[6,2],[7,4],[3,5]],"latestChangedDtsFile":"./index.d.ts"} //// [/home/src/workspaces/packages/src-dogs/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", @@ -189,6 +189,10 @@ export class LassieDog extends Dog { ] } ], + "packageJsons": [ + "./package.json", + "../src-types/package.json" + ], "fileNames": [ "lib.es2022.full.d.ts", "../src-types/dogconfig.d.ts", @@ -337,7 +341,7 @@ export class LassieDog extends Dog { ] }, "latestChangedDtsFile": "./index.d.ts", - "size": 3218 + "size": 3280 } //// [/home/src/workspaces/packages/src-types/dogconfig.d.ts] *new* export interface DogConfig { @@ -354,7 +358,7 @@ export * from './dogconfig.js'; export * from './dogconfig.js'; //// [/home/src/workspaces/packages/src-types/tsconfig.tsbuildinfo] *new* -{"version":"FakeTSVersion","root":[[2,3]],"fileNames":["lib.es2022.full.d.ts","./dogconfig.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d8b224befa78d5f27814a6eb4da56079-export interface DogConfig {\n name: string;\n}","signature":"a71e22ebb89c8c5bea7cef8d090ace25-export interface DogConfig {\n name: string;\n}\n","impliedNodeFormat":99},{"version":"ac3890d1bb11659994f68e147333e98e-export * from './dogconfig.js';","signature":"3c21c50da3a1aea8b6fafa5aa595f160-export * from './dogconfig.js';\n","impliedNodeFormat":99}],"fileIdsList":[[2]],"options":{"composite":true,"declaration":true,"module":100},"referencedMap":[[3,1]],"latestChangedDtsFile":"./index.d.ts"} +{"version":"FakeTSVersion","root":[[2,3]],"packageJsons":["./package.json"],"fileNames":["lib.es2022.full.d.ts","./dogconfig.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d8b224befa78d5f27814a6eb4da56079-export interface DogConfig {\n name: string;\n}","signature":"a71e22ebb89c8c5bea7cef8d090ace25-export interface DogConfig {\n name: string;\n}\n","impliedNodeFormat":99},{"version":"ac3890d1bb11659994f68e147333e98e-export * from './dogconfig.js';","signature":"3c21c50da3a1aea8b6fafa5aa595f160-export * from './dogconfig.js';\n","impliedNodeFormat":99}],"fileIdsList":[[2]],"options":{"composite":true,"declaration":true,"module":100},"referencedMap":[[3,1]],"latestChangedDtsFile":"./index.d.ts"} //// [/home/src/workspaces/packages/src-types/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", @@ -370,6 +374,9 @@ export * from './dogconfig.js'; ] } ], + "packageJsons": [ + "./package.json" + ], "fileNames": [ "lib.es2022.full.d.ts", "./dogconfig.ts", @@ -427,7 +434,7 @@ export * from './dogconfig.js'; ] }, "latestChangedDtsFile": "./index.d.ts", - "size": 1440 + "size": 1474 } src-types/tsconfig.json:: diff --git a/testdata/baselines/reference/tsbuildWatch/moduleResolution/build-mode-watches-for-changes-to-package-json-main-fields.js b/testdata/baselines/reference/tsbuildWatch/moduleResolution/build-mode-watches-for-changes-to-package-json-main-fields.js index e9cdbb7c50..511729281d 100644 --- a/testdata/baselines/reference/tsbuildWatch/moduleResolution/build-mode-watches-for-changes-to-package-json-main-fields.js +++ b/testdata/baselines/reference/tsbuildWatch/moduleResolution/build-mode-watches-for-changes-to-package-json-main-fields.js @@ -127,7 +127,7 @@ exports.theNum = void 0; exports.theNum = 42; //// [/user/username/projects/myproject/packages/pkg1/build/tsconfig.tsbuildinfo] *new* -{"version":"FakeTSVersion","root":["../index.ts"]} +{"version":"FakeTSVersion","root":["../index.ts"],"packageJsons":["../package.json","../../pkg2/package.json"]} //// [/user/username/projects/myproject/packages/pkg1/build/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", @@ -139,7 +139,11 @@ exports.theNum = 42; "original": "../index.ts" } ], - "size": 50 + "packageJsons": [ + "../package.json", + "../../pkg2/package.json" + ], + "size": 111 } //// [/user/username/projects/myproject/packages/pkg2/build/const.d.ts] *new* export type TheNum = 42; @@ -281,18 +285,78 @@ Edit [0]:: reports import errors after change to package file Output:: +[HH:MM:SS AM] File change detected. Starting incremental compilation... +[HH:MM:SS AM] Projects in this build: + * packages/pkg2/tsconfig.json + * packages/pkg1/tsconfig.json +[HH:MM:SS AM] Project 'packages/pkg1/tsconfig.json' is out of date because output 'packages/pkg1/build/tsconfig.tsbuildinfo' is older than input 'packages/pkg2/package.json' + +[HH:MM:SS AM] Building project 'packages/pkg1/tsconfig.json'... + +======== Resolving module 'pkg2' from '/user/username/projects/myproject/packages/pkg1/index.ts'. ======== +Module resolution kind is not specified, using 'Bundler'. +Resolving in CJS mode with conditions 'require', 'types'. +Found 'package.json' at '/user/username/projects/myproject/packages/pkg1/package.json'. +Loading module 'pkg2' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. +Directory '/user/username/projects/myproject/packages/pkg1/node_modules' does not exist, skipping all lookups in it. +Directory '/user/username/projects/myproject/packages/pkg1/node_modules/@types' does not exist, skipping all lookups in it. +Directory '/user/username/projects/myproject/packages/node_modules' does not exist, skipping all lookups in it. +Directory '/user/username/projects/myproject/packages/node_modules/@types' does not exist, skipping all lookups in it. +Found 'package.json' at '/user/username/projects/myproject/node_modules/pkg2/package.json'. +File '/user/username/projects/myproject/node_modules/pkg2.ts' does not exist. +File '/user/username/projects/myproject/node_modules/pkg2.tsx' does not exist. +File '/user/username/projects/myproject/node_modules/pkg2.d.ts' does not exist. +'package.json' does not have a 'typesVersions' field. +'package.json' does not have a 'typings' field. +'package.json' does not have a 'types' field. +'package.json' has 'main' field 'build/other.js' that references '/user/username/projects/myproject/node_modules/pkg2/build/other.js'. +File name '/user/username/projects/myproject/node_modules/pkg2/build/other.js' has a '.js' extension - stripping it. +File '/user/username/projects/myproject/node_modules/pkg2/build/other.ts' does not exist. +File '/user/username/projects/myproject/node_modules/pkg2/build/other.tsx' does not exist. +File '/user/username/projects/myproject/node_modules/pkg2/build/other.d.ts' exists - use it as a name resolution result. +'package.json' does not have a 'peerDependencies' field. +Resolving real path for '/user/username/projects/myproject/node_modules/pkg2/build/other.d.ts', result '/user/username/projects/myproject/packages/pkg2/build/other.d.ts'. +======== Module name 'pkg2' was successfully resolved to '/user/username/projects/myproject/packages/pkg2/build/other.d.ts' with Package ID 'pkg2@1.0.0'. ======== +packages/pkg1/index.ts:1:15 - error TS2305: Module '"pkg2"' has no exported member 'TheNum'. + +1 import type { TheNum } from 'pkg2' +   ~~~~~~ + +[HH:MM:SS AM] Found 1 error. Watching for file changes. + +//// [/user/username/projects/myproject/packages/pkg1/build/index.js] *rewrite with same content* +//// [/user/username/projects/myproject/packages/pkg1/build/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","root":["../index.ts"],"packageJsons":["../package.json","../../pkg2/package.json"],"semanticErrors":true} +//// [/user/username/projects/myproject/packages/pkg1/build/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "root": [ + { + "files": [ + "../index.ts" + ], + "original": "../index.ts" + } + ], + "packageJsons": [ + "../package.json", + "../../pkg2/package.json" + ], + "size": 133, + "semanticErrors": true +} + +packages/pkg1/tsconfig.json:: +SemanticDiagnostics:: +*refresh* /user/username/projects/myproject/packages/pkg2/build/other.d.ts +*refresh* /user/username/projects/myproject/packages/pkg1/index.ts +Signatures:: +(used version) /user/username/projects/myproject/packages/pkg2/build/other.d.ts +(computed .d.ts) /user/username/projects/myproject/packages/pkg1/index.ts -Diff:: Package.json watch pending, so no change detected yet ---- nonIncremental.output.txt -+++ incremental.output.txt -@@ -1,5 +0,0 @@ --packages/pkg1/index.ts:1:15 - error TS2305: Module '"pkg2"' has no exported member 'TheNum'. -- --1 import type { TheNum } from 'pkg2' --   ~~~~~~ -- Edit [1]:: removes those errors when a package file is changed back //// [/user/username/projects/myproject/packages/pkg2/package.json] *modified* @@ -304,4 +368,78 @@ Edit [1]:: removes those errors when a package file is changed back Output:: +[HH:MM:SS AM] File change detected. Starting incremental compilation... + +[HH:MM:SS AM] Projects in this build: + * packages/pkg2/tsconfig.json + * packages/pkg1/tsconfig.json + +[HH:MM:SS AM] Project 'packages/pkg1/tsconfig.json' is out of date because buildinfo file 'packages/pkg1/build/tsconfig.tsbuildinfo' indicates that program needs to report errors. + +[HH:MM:SS AM] Building project 'packages/pkg1/tsconfig.json'... + +======== Resolving module 'pkg2' from '/user/username/projects/myproject/packages/pkg1/index.ts'. ======== +Module resolution kind is not specified, using 'Bundler'. +Resolving in CJS mode with conditions 'require', 'types'. +Found 'package.json' at '/user/username/projects/myproject/packages/pkg1/package.json'. +Loading module 'pkg2' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. +Directory '/user/username/projects/myproject/packages/pkg1/node_modules' does not exist, skipping all lookups in it. +Directory '/user/username/projects/myproject/packages/pkg1/node_modules/@types' does not exist, skipping all lookups in it. +Directory '/user/username/projects/myproject/packages/node_modules' does not exist, skipping all lookups in it. +Directory '/user/username/projects/myproject/packages/node_modules/@types' does not exist, skipping all lookups in it. +Found 'package.json' at '/user/username/projects/myproject/node_modules/pkg2/package.json'. +File '/user/username/projects/myproject/node_modules/pkg2.ts' does not exist. +File '/user/username/projects/myproject/node_modules/pkg2.tsx' does not exist. +File '/user/username/projects/myproject/node_modules/pkg2.d.ts' does not exist. +'package.json' does not have a 'typesVersions' field. +'package.json' does not have a 'typings' field. +'package.json' does not have a 'types' field. +'package.json' has 'main' field 'build/index.js' that references '/user/username/projects/myproject/node_modules/pkg2/build/index.js'. +File name '/user/username/projects/myproject/node_modules/pkg2/build/index.js' has a '.js' extension - stripping it. +File '/user/username/projects/myproject/node_modules/pkg2/build/index.ts' does not exist. +File '/user/username/projects/myproject/node_modules/pkg2/build/index.tsx' does not exist. +File '/user/username/projects/myproject/node_modules/pkg2/build/index.d.ts' exists - use it as a name resolution result. +'package.json' does not have a 'peerDependencies' field. +Resolving real path for '/user/username/projects/myproject/node_modules/pkg2/build/index.d.ts', result '/user/username/projects/myproject/packages/pkg2/build/index.d.ts'. +======== Module name 'pkg2' was successfully resolved to '/user/username/projects/myproject/packages/pkg2/build/index.d.ts' with Package ID 'pkg2@1.0.0'. ======== +======== Resolving module './const.js' from '/user/username/projects/myproject/packages/pkg2/index.ts'. ======== +Using compiler options of project reference redirect '/user/username/projects/myproject/packages/pkg2/tsconfig.json'. +Module resolution kind is not specified, using 'Bundler'. +Resolving in CJS mode with conditions 'require', 'types'. +Loading module as file / folder, candidate module location '/user/username/projects/myproject/packages/pkg2/const.js', target file types: TypeScript, JavaScript, Declaration, JSON. +File name '/user/username/projects/myproject/packages/pkg2/const.js' has a '.js' extension - stripping it. +File '/user/username/projects/myproject/packages/pkg2/const.ts' exists - use it as a name resolution result. +======== Module name './const.js' was successfully resolved to '/user/username/projects/myproject/packages/pkg2/const.ts'. ======== +[HH:MM:SS AM] Found 0 errors. Watching for file changes. + +//// [/user/username/projects/myproject/packages/pkg1/build/index.js] *rewrite with same content* +//// [/user/username/projects/myproject/packages/pkg1/build/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","root":["../index.ts"],"packageJsons":["../package.json","../../pkg2/package.json"]} +//// [/user/username/projects/myproject/packages/pkg1/build/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "root": [ + { + "files": [ + "../index.ts" + ], + "original": "../index.ts" + } + ], + "packageJsons": [ + "../package.json", + "../../pkg2/package.json" + ], + "size": 111 +} +packages/pkg1/tsconfig.json:: +SemanticDiagnostics:: +*refresh* /user/username/projects/myproject/packages/pkg2/build/const.d.ts +*refresh* /user/username/projects/myproject/packages/pkg2/build/index.d.ts +*refresh* /user/username/projects/myproject/packages/pkg1/index.ts +Signatures:: +(used version) /user/username/projects/myproject/packages/pkg2/build/const.d.ts +(used version) /user/username/projects/myproject/packages/pkg2/build/index.d.ts +(computed .d.ts) /user/username/projects/myproject/packages/pkg1/index.ts diff --git a/testdata/baselines/reference/tsbuildWatch/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly-with-cts-and-mts-extensions.js b/testdata/baselines/reference/tsbuildWatch/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly-with-cts-and-mts-extensions.js index f91d8d9568..ec7f4abb44 100644 --- a/testdata/baselines/reference/tsbuildWatch/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly-with-cts-and-mts-extensions.js +++ b/testdata/baselines/reference/tsbuildWatch/moduleResolution/resolves-specifier-in-output-declaration-file-from-referenced-project-correctly-with-cts-and-mts-extensions.js @@ -123,7 +123,7 @@ declare const console: { log(msg: any): void; }; export const theNum = 42; //// [/user/username/projects/myproject/packages/pkg1/build/tsconfig.tsbuildinfo] *new* -{"version":"FakeTSVersion","root":["../index.ts"]} +{"version":"FakeTSVersion","root":["../index.ts"],"packageJsons":["../package.json","../../pkg2/package.json"]} //// [/user/username/projects/myproject/packages/pkg1/build/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", @@ -135,7 +135,11 @@ export const theNum = 42; "original": "../index.ts" } ], - "size": 50 + "packageJsons": [ + "../package.json", + "../../pkg2/package.json" + ], + "size": 111 } //// [/user/username/projects/myproject/packages/pkg2/build/const.cjs] *new* "use strict"; @@ -151,7 +155,7 @@ export type { TheNum } from './const.cjs'; export {}; //// [/user/username/projects/myproject/packages/pkg2/build/tsconfig.tsbuildinfo] *new* -{"version":"FakeTSVersion","root":[[2,3]],"fileNames":["lib.es2022.full.d.ts","../const.cts","../index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"be0f939ab1143e4064a3742586332724-export type TheNum = 42;","signature":"56e2d69d2edd1f0edd1a64ecfdf6de0d-export type TheNum = 42;\n","impliedNodeFormat":1},{"version":"7bb214373f4d1876e9a0040d287d1b6e-export type { TheNum } from './const.cjs';","signature":"2c7786a1f125eb57a4db00a4d58e384a-export type { TheNum } from './const.cjs';\n","impliedNodeFormat":99}],"fileIdsList":[[2]],"options":{"composite":true,"module":100,"outDir":"./"},"referencedMap":[[3,1]],"latestChangedDtsFile":"./index.d.ts"} +{"version":"FakeTSVersion","root":[[2,3]],"packageJsons":["../package.json"],"fileNames":["lib.es2022.full.d.ts","../const.cts","../index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"be0f939ab1143e4064a3742586332724-export type TheNum = 42;","signature":"56e2d69d2edd1f0edd1a64ecfdf6de0d-export type TheNum = 42;\n","impliedNodeFormat":1},{"version":"7bb214373f4d1876e9a0040d287d1b6e-export type { TheNum } from './const.cjs';","signature":"2c7786a1f125eb57a4db00a4d58e384a-export type { TheNum } from './const.cjs';\n","impliedNodeFormat":99}],"fileIdsList":[[2]],"options":{"composite":true,"module":100,"outDir":"./"},"referencedMap":[[3,1]],"latestChangedDtsFile":"./index.d.ts"} //// [/user/username/projects/myproject/packages/pkg2/build/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", @@ -167,6 +171,9 @@ export {}; ] } ], + "packageJsons": [ + "../package.json" + ], "fileNames": [ "lib.es2022.full.d.ts", "../const.cts", @@ -224,7 +231,7 @@ export {}; ] }, "latestChangedDtsFile": "./index.d.ts", - "size": 1403 + "size": 1438 } packages/pkg2/tsconfig.json:: @@ -256,27 +263,90 @@ Edit [0]:: reports import errors after change to package file Output:: +[HH:MM:SS AM] File change detected. Starting incremental compilation... + +[HH:MM:SS AM] Projects in this build: + * packages/pkg2/tsconfig.json + * packages/pkg1/tsconfig.json + +[HH:MM:SS AM] Project 'packages/pkg1/tsconfig.json' is out of date because output 'packages/pkg1/build/tsconfig.tsbuildinfo' is older than input 'packages/pkg1/package.json' + +[HH:MM:SS AM] Building project 'packages/pkg1/tsconfig.json'... + +======== Resolving module 'pkg2' from '/user/username/projects/myproject/packages/pkg1/index.ts'. ======== +Module resolution kind is not specified, using 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +Found 'package.json' at '/user/username/projects/myproject/packages/pkg1/package.json'. +Loading module 'pkg2' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. +Directory '/user/username/projects/myproject/packages/pkg1/node_modules' does not exist, skipping all lookups in it. +Directory '/user/username/projects/myproject/packages/pkg1/node_modules/@types' does not exist, skipping all lookups in it. +Directory '/user/username/projects/myproject/packages/node_modules' does not exist, skipping all lookups in it. +Directory '/user/username/projects/myproject/packages/node_modules/@types' does not exist, skipping all lookups in it. +Found 'package.json' at '/user/username/projects/myproject/node_modules/pkg2/package.json'. +File '/user/username/projects/myproject/node_modules/pkg2.ts' does not exist. +File '/user/username/projects/myproject/node_modules/pkg2.tsx' does not exist. +File '/user/username/projects/myproject/node_modules/pkg2.d.ts' does not exist. +'package.json' does not have a 'typesVersions' field. +'package.json' does not have a 'typings' field. +'package.json' does not have a 'types' field. +'package.json' has 'main' field 'build/index.js' that references '/user/username/projects/myproject/node_modules/pkg2/build/index.js'. +File name '/user/username/projects/myproject/node_modules/pkg2/build/index.js' has a '.js' extension - stripping it. +File '/user/username/projects/myproject/node_modules/pkg2/build/index.ts' does not exist. +File '/user/username/projects/myproject/node_modules/pkg2/build/index.tsx' does not exist. +File '/user/username/projects/myproject/node_modules/pkg2/build/index.d.ts' exists - use it as a name resolution result. +'package.json' does not have a 'peerDependencies' field. +Resolving real path for '/user/username/projects/myproject/node_modules/pkg2/build/index.d.ts', result '/user/username/projects/myproject/packages/pkg2/build/index.d.ts'. +======== Module name 'pkg2' was successfully resolved to '/user/username/projects/myproject/packages/pkg2/build/index.d.ts' with Package ID 'pkg2@1.0.0'. ======== +======== Resolving module './const.cjs' from '/user/username/projects/myproject/packages/pkg2/index.ts'. ======== +Using compiler options of project reference redirect '/user/username/projects/myproject/packages/pkg2/tsconfig.json'. +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. +Loading module as file / folder, candidate module location '/user/username/projects/myproject/packages/pkg2/const.cjs', target file types: TypeScript, JavaScript, Declaration. +File name '/user/username/projects/myproject/packages/pkg2/const.cjs' has a '.cjs' extension - stripping it. +File '/user/username/projects/myproject/packages/pkg2/const.cts' exists - use it as a name resolution result. +======== Module name './const.cjs' was successfully resolved to '/user/username/projects/myproject/packages/pkg2/const.cts'. ======== +packages/pkg1/index.ts:1:29 - error TS1541: Type-only import of an ECMAScript module from a CommonJS module must have a 'resolution-mode' attribute. + To convert this file to an ECMAScript module, change its file extension to '.mts' or create a local package.json file with `{ "type": "module" }`. + +1 import type { TheNum } from 'pkg2' +   ~~~~~~ +[HH:MM:SS AM] Found 1 error. Watching for file changes. + +//// [/user/username/projects/myproject/packages/pkg1/build/index.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.theNum = void 0; +exports.theNum = 42; + +//// [/user/username/projects/myproject/packages/pkg1/build/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","root":["../index.ts"],"packageJsons":["../package.json","../../pkg2/package.json"],"semanticErrors":true} +//// [/user/username/projects/myproject/packages/pkg1/build/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "root": [ + { + "files": [ + "../index.ts" + ], + "original": "../index.ts" + } + ], + "packageJsons": [ + "../package.json", + "../../pkg2/package.json" + ], + "size": 133, + "semanticErrors": true +} +packages/pkg1/tsconfig.json:: +SemanticDiagnostics:: +*refresh* /user/username/projects/myproject/packages/pkg1/index.ts +Signatures:: +(computed .d.ts) /user/username/projects/myproject/packages/pkg1/index.ts -Diff:: Package.json watch pending, so no change detected yet ---- nonIncremental /user/username/projects/myproject/packages/pkg1/build/index.js -+++ incremental /user/username/projects/myproject/packages/pkg1/build/index.js -@@ -1,4 +1,1 @@ --"use strict"; --Object.defineProperty(exports, "__esModule", { value: true }); --exports.theNum = void 0; --exports.theNum = 42; -+export const theNum = 42; ---- nonIncremental.output.txt -+++ incremental.output.txt -@@ -1,6 +0,0 @@ --packages/pkg1/index.ts:1:29 - error TS1541: Type-only import of an ECMAScript module from a CommonJS module must have a 'resolution-mode' attribute. -- To convert this file to an ECMAScript module, change its file extension to '.mts' or create a local package.json file with `{ "type": "module" }`. -- --1 import type { TheNum } from 'pkg2' --   ~~~~~~ -- Edit [1]:: removes those errors when a package file is changed back //// [/user/username/projects/myproject/packages/pkg1/package.json] *modified* @@ -289,7 +359,76 @@ Edit [1]:: removes those errors when a package file is changed back Output:: +[HH:MM:SS AM] File change detected. Starting incremental compilation... +[HH:MM:SS AM] Projects in this build: + * packages/pkg2/tsconfig.json + * packages/pkg1/tsconfig.json + +[HH:MM:SS AM] Project 'packages/pkg1/tsconfig.json' is out of date because buildinfo file 'packages/pkg1/build/tsconfig.tsbuildinfo' indicates that program needs to report errors. + +[HH:MM:SS AM] Building project 'packages/pkg1/tsconfig.json'... + +======== Resolving module 'pkg2' from '/user/username/projects/myproject/packages/pkg1/index.ts'. ======== +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. +Found 'package.json' at '/user/username/projects/myproject/packages/pkg1/package.json'. +Loading module 'pkg2' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. +Directory '/user/username/projects/myproject/packages/pkg1/node_modules' does not exist, skipping all lookups in it. +Directory '/user/username/projects/myproject/packages/pkg1/node_modules/@types' does not exist, skipping all lookups in it. +Directory '/user/username/projects/myproject/packages/node_modules' does not exist, skipping all lookups in it. +Directory '/user/username/projects/myproject/packages/node_modules/@types' does not exist, skipping all lookups in it. +Found 'package.json' at '/user/username/projects/myproject/node_modules/pkg2/package.json'. +'package.json' does not have a 'typesVersions' field. +'package.json' does not have a 'typings' field. +'package.json' does not have a 'types' field. +'package.json' has 'main' field 'build/index.js' that references '/user/username/projects/myproject/node_modules/pkg2/build/index.js'. +File name '/user/username/projects/myproject/node_modules/pkg2/build/index.js' has a '.js' extension - stripping it. +File '/user/username/projects/myproject/node_modules/pkg2/build/index.ts' does not exist. +File '/user/username/projects/myproject/node_modules/pkg2/build/index.tsx' does not exist. +File '/user/username/projects/myproject/node_modules/pkg2/build/index.d.ts' exists - use it as a name resolution result. +'package.json' does not have a 'peerDependencies' field. +Resolving real path for '/user/username/projects/myproject/node_modules/pkg2/build/index.d.ts', result '/user/username/projects/myproject/packages/pkg2/build/index.d.ts'. +======== Module name 'pkg2' was successfully resolved to '/user/username/projects/myproject/packages/pkg2/build/index.d.ts' with Package ID 'pkg2@1.0.0'. ======== +======== Resolving module './const.cjs' from '/user/username/projects/myproject/packages/pkg2/index.ts'. ======== +Using compiler options of project reference redirect '/user/username/projects/myproject/packages/pkg2/tsconfig.json'. +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. +Loading module as file / folder, candidate module location '/user/username/projects/myproject/packages/pkg2/const.cjs', target file types: TypeScript, JavaScript, Declaration. +File name '/user/username/projects/myproject/packages/pkg2/const.cjs' has a '.cjs' extension - stripping it. +File '/user/username/projects/myproject/packages/pkg2/const.cts' exists - use it as a name resolution result. +======== Module name './const.cjs' was successfully resolved to '/user/username/projects/myproject/packages/pkg2/const.cts'. ======== +[HH:MM:SS AM] Found 0 errors. Watching for file changes. + +//// [/user/username/projects/myproject/packages/pkg1/build/index.js] *modified* +export const theNum = 42; + +//// [/user/username/projects/myproject/packages/pkg1/build/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","root":["../index.ts"],"packageJsons":["../package.json","../../pkg2/package.json"]} +//// [/user/username/projects/myproject/packages/pkg1/build/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "root": [ + { + "files": [ + "../index.ts" + ], + "original": "../index.ts" + } + ], + "packageJsons": [ + "../package.json", + "../../pkg2/package.json" + ], + "size": 111 +} + +packages/pkg1/tsconfig.json:: +SemanticDiagnostics:: +*refresh* /user/username/projects/myproject/packages/pkg1/index.ts +Signatures:: +(computed .d.ts) /user/username/projects/myproject/packages/pkg1/index.ts Edit [2]:: reports import errors after change to package file @@ -303,27 +442,90 @@ Edit [2]:: reports import errors after change to package file Output:: +[HH:MM:SS AM] File change detected. Starting incremental compilation... +[HH:MM:SS AM] Projects in this build: + * packages/pkg2/tsconfig.json + * packages/pkg1/tsconfig.json +[HH:MM:SS AM] Project 'packages/pkg1/tsconfig.json' is out of date because output 'packages/pkg1/build/tsconfig.tsbuildinfo' is older than input 'packages/pkg1/package.json' + +[HH:MM:SS AM] Building project 'packages/pkg1/tsconfig.json'... + +======== Resolving module 'pkg2' from '/user/username/projects/myproject/packages/pkg1/index.ts'. ======== +Module resolution kind is not specified, using 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +Found 'package.json' at '/user/username/projects/myproject/packages/pkg1/package.json'. +Loading module 'pkg2' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. +Directory '/user/username/projects/myproject/packages/pkg1/node_modules' does not exist, skipping all lookups in it. +Directory '/user/username/projects/myproject/packages/pkg1/node_modules/@types' does not exist, skipping all lookups in it. +Directory '/user/username/projects/myproject/packages/node_modules' does not exist, skipping all lookups in it. +Directory '/user/username/projects/myproject/packages/node_modules/@types' does not exist, skipping all lookups in it. +Found 'package.json' at '/user/username/projects/myproject/node_modules/pkg2/package.json'. +File '/user/username/projects/myproject/node_modules/pkg2.ts' does not exist. +File '/user/username/projects/myproject/node_modules/pkg2.tsx' does not exist. +File '/user/username/projects/myproject/node_modules/pkg2.d.ts' does not exist. +'package.json' does not have a 'typesVersions' field. +'package.json' does not have a 'typings' field. +'package.json' does not have a 'types' field. +'package.json' has 'main' field 'build/index.js' that references '/user/username/projects/myproject/node_modules/pkg2/build/index.js'. +File name '/user/username/projects/myproject/node_modules/pkg2/build/index.js' has a '.js' extension - stripping it. +File '/user/username/projects/myproject/node_modules/pkg2/build/index.ts' does not exist. +File '/user/username/projects/myproject/node_modules/pkg2/build/index.tsx' does not exist. +File '/user/username/projects/myproject/node_modules/pkg2/build/index.d.ts' exists - use it as a name resolution result. +'package.json' does not have a 'peerDependencies' field. +Resolving real path for '/user/username/projects/myproject/node_modules/pkg2/build/index.d.ts', result '/user/username/projects/myproject/packages/pkg2/build/index.d.ts'. +======== Module name 'pkg2' was successfully resolved to '/user/username/projects/myproject/packages/pkg2/build/index.d.ts' with Package ID 'pkg2@1.0.0'. ======== +======== Resolving module './const.cjs' from '/user/username/projects/myproject/packages/pkg2/index.ts'. ======== +Using compiler options of project reference redirect '/user/username/projects/myproject/packages/pkg2/tsconfig.json'. +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. +Loading module as file / folder, candidate module location '/user/username/projects/myproject/packages/pkg2/const.cjs', target file types: TypeScript, JavaScript, Declaration. +File name '/user/username/projects/myproject/packages/pkg2/const.cjs' has a '.cjs' extension - stripping it. +File '/user/username/projects/myproject/packages/pkg2/const.cts' exists - use it as a name resolution result. +======== Module name './const.cjs' was successfully resolved to '/user/username/projects/myproject/packages/pkg2/const.cts'. ======== +packages/pkg1/index.ts:1:29 - error TS1541: Type-only import of an ECMAScript module from a CommonJS module must have a 'resolution-mode' attribute. + To convert this file to an ECMAScript module, change its file extension to '.mts' or create a local package.json file with `{ "type": "module" }`. + +1 import type { TheNum } from 'pkg2' +   ~~~~~~ + +[HH:MM:SS AM] Found 1 error. Watching for file changes. + +//// [/user/username/projects/myproject/packages/pkg1/build/index.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.theNum = void 0; +exports.theNum = 42; + +//// [/user/username/projects/myproject/packages/pkg1/build/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","root":["../index.ts"],"packageJsons":["../package.json","../../pkg2/package.json"],"semanticErrors":true} +//// [/user/username/projects/myproject/packages/pkg1/build/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "root": [ + { + "files": [ + "../index.ts" + ], + "original": "../index.ts" + } + ], + "packageJsons": [ + "../package.json", + "../../pkg2/package.json" + ], + "size": 133, + "semanticErrors": true +} + +packages/pkg1/tsconfig.json:: +SemanticDiagnostics:: +*refresh* /user/username/projects/myproject/packages/pkg1/index.ts +Signatures:: +(computed .d.ts) /user/username/projects/myproject/packages/pkg1/index.ts -Diff:: Package.json watch pending, so no change detected yet ---- nonIncremental /user/username/projects/myproject/packages/pkg1/build/index.js -+++ incremental /user/username/projects/myproject/packages/pkg1/build/index.js -@@ -1,4 +1,1 @@ --"use strict"; --Object.defineProperty(exports, "__esModule", { value: true }); --exports.theNum = void 0; --exports.theNum = 42; -+export const theNum = 42; ---- nonIncremental.output.txt -+++ incremental.output.txt -@@ -1,6 +0,0 @@ --packages/pkg1/index.ts:1:29 - error TS1541: Type-only import of an ECMAScript module from a CommonJS module must have a 'resolution-mode' attribute. -- To convert this file to an ECMAScript module, change its file extension to '.mts' or create a local package.json file with `{ "type": "module" }`. -- --1 import type { TheNum } from 'pkg2' --   ~~~~~~ -- Edit [3]:: removes those errors when a package file is changed to cjs extensions //// [/user/username/projects/myproject/packages/pkg2/index.cts] *new* @@ -356,7 +558,7 @@ Loading module as file / folder, candidate module location '/user/username/proje File name '/user/username/projects/myproject/packages/pkg2/const.cjs' has a '.cjs' extension - stripping it. File '/user/username/projects/myproject/packages/pkg2/const.cts' exists - use it as a name resolution result. ======== Module name './const.cjs' was successfully resolved to '/user/username/projects/myproject/packages/pkg2/const.cts'. ======== -[HH:MM:SS AM] Project 'packages/pkg1/tsconfig.json' is out of date because output 'packages/pkg1/build/index.js' is older than input 'packages/pkg2/tsconfig.json' +[HH:MM:SS AM] Project 'packages/pkg1/tsconfig.json' is out of date because buildinfo file 'packages/pkg1/build/tsconfig.tsbuildinfo' indicates that program needs to report errors. [HH:MM:SS AM] Building project 'packages/pkg1/tsconfig.json'... @@ -394,14 +596,26 @@ File '/user/username/projects/myproject/packages/pkg2/const.cts' exists - use it ======== Module name './const.cjs' was successfully resolved to '/user/username/projects/myproject/packages/pkg2/const.cts'. ======== [HH:MM:SS AM] Found 0 errors. Watching for file changes. -//// [/user/username/projects/myproject/packages/pkg1/build/index.js] *modified* -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.theNum = void 0; -exports.theNum = 42; - -//// [/user/username/projects/myproject/packages/pkg1/build/tsconfig.tsbuildinfo] *rewrite with same content* -//// [/user/username/projects/myproject/packages/pkg1/build/tsconfig.tsbuildinfo.readable.baseline.txt] *rewrite with same content* +//// [/user/username/projects/myproject/packages/pkg1/build/index.js] *rewrite with same content* +//// [/user/username/projects/myproject/packages/pkg1/build/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","root":["../index.ts"],"packageJsons":["../package.json","../../pkg2/package.json"]} +//// [/user/username/projects/myproject/packages/pkg1/build/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "root": [ + { + "files": [ + "../index.ts" + ], + "original": "../index.ts" + } + ], + "packageJsons": [ + "../package.json", + "../../pkg2/package.json" + ], + "size": 111 +} //// [/user/username/projects/myproject/packages/pkg2/build/index.cjs] *new* "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/testdata/baselines/reference/tsc/composite/synthetic-jsx-import-of-ESM-module-from-CJS-module-error-on-jsx-element.js b/testdata/baselines/reference/tsc/composite/synthetic-jsx-import-of-ESM-module-from-CJS-module-error-on-jsx-element.js index 3dfafa66b8..4deba12eb5 100644 --- a/testdata/baselines/reference/tsc/composite/synthetic-jsx-import-of-ESM-module-from-CJS-module-error-on-jsx-element.js +++ b/testdata/baselines/reference/tsc/composite/synthetic-jsx-import-of-ESM-module-from-CJS-module-error-on-jsx-element.js @@ -45,7 +45,7 @@ const jsx_runtime_1 = require("solid-js/jsx-runtime"); exports.default = jsx_runtime_1.jsx("div", {}); //// [/home/src/projects/project/tsconfig.tsbuildinfo] *new* -{"version":"FakeTSVersion","root":[3],"fileNames":["lib.es2022.full.d.ts","./node_modules/solid-js/jsx-runtime.d.ts","./src/main.tsx"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"00e459cbb1596f8c4bdf988b0589433f-export namespace JSX {\n type IntrinsicElements = { div: {}; };\n}","impliedNodeFormat":99},{"version":"5af15af7f9b4d97300f8dcfb2bf5b7c4-export default
;","signature":"ca37c00363f904fe93e299b145186400-declare const _default: any;\nexport default _default;\n","impliedNodeFormat":1}],"options":{"composite":true,"jsx":4,"jsxImportSource":"solid-js","module":100},"semanticDiagnosticsPerFile":[[3,[{"pos":15,"end":21,"code":1479,"category":1,"message":"The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import(\"solid-js/jsx-runtime\")' call instead.","messageChain":[{"pos":15,"end":21,"code":1483,"category":3,"message":"To convert this file to an ECMAScript module, create a local package.json file with `{ \"type\": \"module\" }`."}]}]]],"latestChangedDtsFile":"./src/main.d.ts"} +{"version":"FakeTSVersion","root":[3],"packageJsons":["./node_modules/solid-js/package.json"],"fileNames":["lib.es2022.full.d.ts","./node_modules/solid-js/jsx-runtime.d.ts","./src/main.tsx"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"00e459cbb1596f8c4bdf988b0589433f-export namespace JSX {\n type IntrinsicElements = { div: {}; };\n}","impliedNodeFormat":99},{"version":"5af15af7f9b4d97300f8dcfb2bf5b7c4-export default
;","signature":"ca37c00363f904fe93e299b145186400-declare const _default: any;\nexport default _default;\n","impliedNodeFormat":1}],"options":{"composite":true,"jsx":4,"jsxImportSource":"solid-js","module":100},"semanticDiagnosticsPerFile":[[3,[{"pos":15,"end":21,"code":1479,"category":1,"message":"The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import(\"solid-js/jsx-runtime\")' call instead.","messageChain":[{"pos":15,"end":21,"code":1483,"category":3,"message":"To convert this file to an ECMAScript module, create a local package.json file with `{ \"type\": \"module\" }`."}]}]]],"latestChangedDtsFile":"./src/main.d.ts"} //// [/home/src/projects/project/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", @@ -57,6 +57,9 @@ exports.default = jsx_runtime_1.jsx("div", {}); "original": 3 } ], + "packageJsons": [ + "./node_modules/solid-js/package.json" + ], "fileNames": [ "lib.es2022.full.d.ts", "./node_modules/solid-js/jsx-runtime.d.ts", @@ -127,7 +130,7 @@ exports.default = jsx_runtime_1.jsx("div", {}); ] ], "latestChangedDtsFile": "./src/main.d.ts", - "size": 1905 + "size": 1961 } //// [/home/src/tslibs/TS/Lib/lib.es2022.full.d.ts] *Lib* /// diff --git a/testdata/baselines/reference/tsc/composite/synthetic-jsx-import-of-ESM-module-from-CJS-module-no-crash-no-jsx-element.js b/testdata/baselines/reference/tsc/composite/synthetic-jsx-import-of-ESM-module-from-CJS-module-no-crash-no-jsx-element.js index 1b88deb5da..554f9ccdaf 100644 --- a/testdata/baselines/reference/tsc/composite/synthetic-jsx-import-of-ESM-module-from-CJS-module-no-crash-no-jsx-element.js +++ b/testdata/baselines/reference/tsc/composite/synthetic-jsx-import-of-ESM-module-from-CJS-module-no-crash-no-jsx-element.js @@ -35,7 +35,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.default = 42; //// [/home/src/projects/project/tsconfig.tsbuildinfo] *new* -{"version":"FakeTSVersion","root":[3],"fileNames":["lib.es2022.full.d.ts","./node_modules/solid-js/jsx-runtime.d.ts","./src/main.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"00e459cbb1596f8c4bdf988b0589433f-export namespace JSX {\n type IntrinsicElements = { div: {}; };\n}","impliedNodeFormat":99},{"version":"666fdc0c7a7f134c8c14dc85be1ebc28-export default 42;","signature":"18ae69a2c0b372747b9973ad9c14a1e0-declare const _default: number;\nexport default _default;\n","impliedNodeFormat":1}],"options":{"composite":true,"jsx":4,"jsxImportSource":"solid-js","module":100},"latestChangedDtsFile":"./src/main.d.ts"} +{"version":"FakeTSVersion","root":[3],"packageJsons":["./node_modules/solid-js/package.json"],"fileNames":["lib.es2022.full.d.ts","./node_modules/solid-js/jsx-runtime.d.ts","./src/main.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"00e459cbb1596f8c4bdf988b0589433f-export namespace JSX {\n type IntrinsicElements = { div: {}; };\n}","impliedNodeFormat":99},{"version":"666fdc0c7a7f134c8c14dc85be1ebc28-export default 42;","signature":"18ae69a2c0b372747b9973ad9c14a1e0-declare const _default: number;\nexport default _default;\n","impliedNodeFormat":1}],"options":{"composite":true,"jsx":4,"jsxImportSource":"solid-js","module":100},"latestChangedDtsFile":"./src/main.d.ts"} //// [/home/src/projects/project/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", @@ -47,6 +47,9 @@ exports.default = 42; "original": 3 } ], + "packageJsons": [ + "./node_modules/solid-js/package.json" + ], "fileNames": [ "lib.es2022.full.d.ts", "./node_modules/solid-js/jsx-runtime.d.ts", @@ -94,7 +97,7 @@ exports.default = 42; "module": 100 }, "latestChangedDtsFile": "./src/main.d.ts", - "size": 1373 + "size": 1429 } //// [/home/src/tslibs/TS/Lib/lib.es2022.full.d.ts] *Lib* /// diff --git a/testdata/baselines/reference/tsc/declarationEmit/reports-dts-generation-errors-with-incremental.js b/testdata/baselines/reference/tsc/declarationEmit/reports-dts-generation-errors-with-incremental.js index 4cd9f7b922..77142e7288 100644 --- a/testdata/baselines/reference/tsc/declarationEmit/reports-dts-generation-errors-with-incremental.js +++ b/testdata/baselines/reference/tsc/declarationEmit/reports-dts-generation-errors-with-incremental.js @@ -88,7 +88,7 @@ import ky from 'ky'; export const api = ky.extend({}); //// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *new* -{"version":"FakeTSVersion","root":[3],"fileNames":["lib.esnext.full.d.ts","./node_modules/ky/distribution/index.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b9b50c37c18e43d94b0dd4fb43967f10-type KyInstance = {\n extend(options: Record): KyInstance;\n}\ndeclare const ky: KyInstance;\nexport default ky;","impliedNodeFormat":99},{"version":"0f5091e963c17913313e4969c59e6eb4-import ky from 'ky';\nexport const api = ky.extend({});","signature":"5816fe34b5cf354b0d0d19bc77874616-export declare const api: {\n extend(options: Record): KyInstance;\n};\n\n(34,3): error4023: Exported variable 'api' has or is using name 'KyInstance' from external module \"/home/src/workspaces/project/node_modules/ky/distribution/index\" but cannot be named.","impliedNodeFormat":99}],"fileIdsList":[[2]],"options":{"composite":true,"declaration":true,"module":199,"skipLibCheck":true,"skipDefaultLibCheck":true},"referencedMap":[[3,1]],"emitDiagnosticsPerFile":[[3,[{"pos":34,"end":37,"code":4023,"category":1,"message":"Exported variable 'api' has or is using name 'KyInstance' from external module \"/home/src/workspaces/project/node_modules/ky/distribution/index\" but cannot be named."}]]],"latestChangedDtsFile":"./index.d.ts","emitSignatures":[[3,"5229c9e2248679a39697053812e5f6bb-export declare const api: {\n extend(options: Record): KyInstance;\n};\n"]]} +{"version":"FakeTSVersion","root":[3],"packageJsons":["./node_modules/ky/package.json","./package.json"],"fileNames":["lib.esnext.full.d.ts","./node_modules/ky/distribution/index.d.ts","./index.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b9b50c37c18e43d94b0dd4fb43967f10-type KyInstance = {\n extend(options: Record): KyInstance;\n}\ndeclare const ky: KyInstance;\nexport default ky;","impliedNodeFormat":99},{"version":"0f5091e963c17913313e4969c59e6eb4-import ky from 'ky';\nexport const api = ky.extend({});","signature":"5816fe34b5cf354b0d0d19bc77874616-export declare const api: {\n extend(options: Record): KyInstance;\n};\n\n(34,3): error4023: Exported variable 'api' has or is using name 'KyInstance' from external module \"/home/src/workspaces/project/node_modules/ky/distribution/index\" but cannot be named.","impliedNodeFormat":99}],"fileIdsList":[[2]],"options":{"composite":true,"declaration":true,"module":199,"skipLibCheck":true,"skipDefaultLibCheck":true},"referencedMap":[[3,1]],"emitDiagnosticsPerFile":[[3,[{"pos":34,"end":37,"code":4023,"category":1,"message":"Exported variable 'api' has or is using name 'KyInstance' from external module \"/home/src/workspaces/project/node_modules/ky/distribution/index\" but cannot be named."}]]],"latestChangedDtsFile":"./index.d.ts","emitSignatures":[[3,"5229c9e2248679a39697053812e5f6bb-export declare const api: {\n extend(options: Record): KyInstance;\n};\n"]]} //// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", @@ -100,6 +100,10 @@ export const api = ky.extend({}); "original": 3 } ], + "packageJsons": [ + "./node_modules/ky/package.json", + "./package.json" + ], "fileNames": [ "lib.esnext.full.d.ts", "./node_modules/ky/distribution/index.d.ts", @@ -182,7 +186,7 @@ export const api = ky.extend({}); ] } ], - "size": 2171 + "size": 2238 } tsconfig.json:: diff --git a/testdata/baselines/reference/tsc/declarationEmit/reports-dts-generation-errors.js b/testdata/baselines/reference/tsc/declarationEmit/reports-dts-generation-errors.js index 5af9d580ed..3169423bf5 100644 --- a/testdata/baselines/reference/tsc/declarationEmit/reports-dts-generation-errors.js +++ b/testdata/baselines/reference/tsc/declarationEmit/reports-dts-generation-errors.js @@ -151,7 +151,7 @@ Found 1 error in index.ts:2 //// [/home/src/workspaces/project/index.d.ts] *rewrite with same content* //// [/home/src/workspaces/project/index.js] *rewrite with same content* //// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *new* -{"version":"FakeTSVersion","errors":true,"root":["./index.ts"]} +{"version":"FakeTSVersion","errors":true,"root":["./index.ts"],"packageJsons":["./node_modules/ky/package.json","./package.json"]} //// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", @@ -164,7 +164,11 @@ Found 1 error in index.ts:2 "original": "./index.ts" } ], - "size": 63 + "packageJsons": [ + "./node_modules/ky/package.json", + "./package.json" + ], + "size": 130 } tsconfig.json:: diff --git a/testdata/baselines/reference/tsc/moduleResolution/alternateResult.js b/testdata/baselines/reference/tsc/moduleResolution/alternateResult.js index 7ac02e2f44..206e67d616 100644 --- a/testdata/baselines/reference/tsc/moduleResolution/alternateResult.js +++ b/testdata/baselines/reference/tsc/moduleResolution/alternateResult.js @@ -327,7 +327,7 @@ Found 2 errors in the same file, starting at: index.mts:1 export {}; //// [/home/src/projects/project/tsconfig.tsbuildinfo] *new* -{"version":"FakeTSVersion","root":[4],"fileNames":["lib.es2022.full.d.ts","./node_modules/foo2/index.d.ts","./node_modules/@types/bar2/index.d.ts","./index.mts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"165b91a7791663df5931f0b63ebf9ce2-export declare const foo2: number;","da9728b78f5d24b38c00844e001b4953-export declare const bar2: number;",{"version":"eee0814e4a127747fb836acc50eaeb5a-import { foo } from \"foo\";\nimport { bar } from \"bar\";\nimport { foo2 } from \"foo2\";\nimport { bar2 } from \"bar2\";","impliedNodeFormat":99}],"fileIdsList":[[2,3]],"options":{"module":100,"strict":true},"referencedMap":[[4,1]],"semanticDiagnosticsPerFile":[[4,[{"pos":20,"end":25,"code":7016,"category":1,"message":"Could not find a declaration file for module 'foo'. '/home/src/projects/project/node_modules/foo/index.mjs' implicitly has an 'any' type.","messageChain":[{"pos":20,"end":25,"code":6278,"category":3,"message":"There are types at '/home/src/projects/project/node_modules/foo/index.d.ts', but this result could not be resolved when respecting package.json \"exports\". The 'foo' library may need to update its package.json or typings."}]},{"pos":47,"end":52,"code":7016,"category":1,"message":"Could not find a declaration file for module 'bar'. '/home/src/projects/project/node_modules/bar/index.mjs' implicitly has an 'any' type.","messageChain":[{"pos":47,"end":52,"code":6278,"category":3,"message":"There are types at '/home/src/projects/project/node_modules/@types/bar/index.d.ts', but this result could not be resolved when respecting package.json \"exports\". The '@types/bar' library may need to update its package.json or typings."}]}]]]} +{"version":"FakeTSVersion","root":[4],"packageJsons":["./node_modules/@types/bar/package.json","./node_modules/@types/bar2/package.json","./node_modules/bar/package.json","./node_modules/bar2/package.json","./node_modules/foo/package.json","./node_modules/foo2/package.json"],"fileNames":["lib.es2022.full.d.ts","./node_modules/foo2/index.d.ts","./node_modules/@types/bar2/index.d.ts","./index.mts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"165b91a7791663df5931f0b63ebf9ce2-export declare const foo2: number;","da9728b78f5d24b38c00844e001b4953-export declare const bar2: number;",{"version":"eee0814e4a127747fb836acc50eaeb5a-import { foo } from \"foo\";\nimport { bar } from \"bar\";\nimport { foo2 } from \"foo2\";\nimport { bar2 } from \"bar2\";","impliedNodeFormat":99}],"fileIdsList":[[2,3]],"options":{"module":100,"strict":true},"referencedMap":[[4,1]],"semanticDiagnosticsPerFile":[[4,[{"pos":20,"end":25,"code":7016,"category":1,"message":"Could not find a declaration file for module 'foo'. '/home/src/projects/project/node_modules/foo/index.mjs' implicitly has an 'any' type.","messageChain":[{"pos":20,"end":25,"code":6278,"category":3,"message":"There are types at '/home/src/projects/project/node_modules/foo/index.d.ts', but this result could not be resolved when respecting package.json \"exports\". The 'foo' library may need to update its package.json or typings."}]},{"pos":47,"end":52,"code":7016,"category":1,"message":"Could not find a declaration file for module 'bar'. '/home/src/projects/project/node_modules/bar/index.mjs' implicitly has an 'any' type.","messageChain":[{"pos":47,"end":52,"code":6278,"category":3,"message":"There are types at '/home/src/projects/project/node_modules/@types/bar/index.d.ts', but this result could not be resolved when respecting package.json \"exports\". The '@types/bar' library may need to update its package.json or typings."}]}]]]} //// [/home/src/projects/project/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", @@ -339,6 +339,14 @@ export {}; "original": 4 } ], + "packageJsons": [ + "./node_modules/@types/bar/package.json", + "./node_modules/@types/bar2/package.json", + "./node_modules/bar/package.json", + "./node_modules/bar2/package.json", + "./node_modules/foo/package.json", + "./node_modules/foo2/package.json" + ], "fileNames": [ "lib.es2022.full.d.ts", "./node_modules/foo2/index.d.ts", @@ -436,7 +444,7 @@ export {}; ] ] ], - "size": 2399 + "size": 2637 } //// [/home/src/tslibs/TS/Lib/lib.es2022.full.d.ts] *Lib* /// @@ -1574,7 +1582,7 @@ Found 1 error in index.mts:1 //// [/home/src/projects/project/index.mjs] *rewrite with same content* //// [/home/src/projects/project/tsconfig.tsbuildinfo] *modified* -{"version":"FakeTSVersion","root":[5],"fileNames":["lib.es2022.full.d.ts","./node_modules/@types/bar/index.d.ts","./node_modules/foo2/index.d.ts","./node_modules/@types/bar2/index.d.ts","./index.mts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"78bc7ca8c840e090086811119f6d6ba9-export declare const bar: number;","165b91a7791663df5931f0b63ebf9ce2-export declare const foo2: number;","da9728b78f5d24b38c00844e001b4953-export declare const bar2: number;",{"version":"eee0814e4a127747fb836acc50eaeb5a-import { foo } from \"foo\";\nimport { bar } from \"bar\";\nimport { foo2 } from \"foo2\";\nimport { bar2 } from \"bar2\";","signature":"abe7d9981d6018efb6b2b794f40a1607-export {};\n","impliedNodeFormat":99}],"fileIdsList":[[2,3,4]],"options":{"module":100,"strict":true},"referencedMap":[[5,1]],"semanticDiagnosticsPerFile":[[5,[{"pos":20,"end":25,"code":7016,"category":1,"message":"Could not find a declaration file for module 'foo'. '/home/src/projects/project/node_modules/foo/index.mjs' implicitly has an 'any' type.","messageChain":[{"pos":20,"end":25,"code":6278,"category":3,"message":"There are types at '/home/src/projects/project/node_modules/foo/index.d.ts', but this result could not be resolved when respecting package.json \"exports\". The 'foo' library may need to update its package.json or typings."}]}]]]} +{"version":"FakeTSVersion","root":[5],"packageJsons":["./node_modules/@types/bar/package.json","./node_modules/@types/bar2/package.json","./node_modules/bar/package.json","./node_modules/bar2/package.json","./node_modules/foo/package.json","./node_modules/foo2/package.json"],"fileNames":["lib.es2022.full.d.ts","./node_modules/@types/bar/index.d.ts","./node_modules/foo2/index.d.ts","./node_modules/@types/bar2/index.d.ts","./index.mts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"78bc7ca8c840e090086811119f6d6ba9-export declare const bar: number;","165b91a7791663df5931f0b63ebf9ce2-export declare const foo2: number;","da9728b78f5d24b38c00844e001b4953-export declare const bar2: number;",{"version":"eee0814e4a127747fb836acc50eaeb5a-import { foo } from \"foo\";\nimport { bar } from \"bar\";\nimport { foo2 } from \"foo2\";\nimport { bar2 } from \"bar2\";","signature":"abe7d9981d6018efb6b2b794f40a1607-export {};\n","impliedNodeFormat":99}],"fileIdsList":[[2,3,4]],"options":{"module":100,"strict":true},"referencedMap":[[5,1]],"semanticDiagnosticsPerFile":[[5,[{"pos":20,"end":25,"code":7016,"category":1,"message":"Could not find a declaration file for module 'foo'. '/home/src/projects/project/node_modules/foo/index.mjs' implicitly has an 'any' type.","messageChain":[{"pos":20,"end":25,"code":6278,"category":3,"message":"There are types at '/home/src/projects/project/node_modules/foo/index.d.ts', but this result could not be resolved when respecting package.json \"exports\". The 'foo' library may need to update its package.json or typings."}]}]]]} //// [/home/src/projects/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* { "version": "FakeTSVersion", @@ -1586,6 +1594,14 @@ Found 1 error in index.mts:1 "original": 5 } ], + "packageJsons": [ + "./node_modules/@types/bar/package.json", + "./node_modules/@types/bar2/package.json", + "./node_modules/bar/package.json", + "./node_modules/bar2/package.json", + "./node_modules/foo/package.json", + "./node_modules/foo2/package.json" + ], "fileNames": [ "lib.es2022.full.d.ts", "./node_modules/@types/bar/index.d.ts", @@ -1677,7 +1693,7 @@ Found 1 error in index.mts:1 ] ] ], - "size": 2063 + "size": 2301 } tsconfig.json:: @@ -1810,7 +1826,7 @@ Resolving real path for '/home/src/projects/project/node_modules/@types/bar2/ind ======== Module name 'bar2' was successfully resolved to '/home/src/projects/project/node_modules/@types/bar2/index.d.ts' with Package ID '@types/bar2/index.d.ts@1.0.0'. ======== //// [/home/src/projects/project/index.mjs] *rewrite with same content* //// [/home/src/projects/project/tsconfig.tsbuildinfo] *modified* -{"version":"FakeTSVersion","root":[6],"fileNames":["lib.es2022.full.d.ts","./node_modules/foo/index.d.ts","./node_modules/@types/bar/index.d.ts","./node_modules/foo2/index.d.ts","./node_modules/@types/bar2/index.d.ts","./index.mts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"2a914bfad3bba77712486af8a4cdc415-export declare const foo: number;","78bc7ca8c840e090086811119f6d6ba9-export declare const bar: number;","165b91a7791663df5931f0b63ebf9ce2-export declare const foo2: number;","da9728b78f5d24b38c00844e001b4953-export declare const bar2: number;",{"version":"eee0814e4a127747fb836acc50eaeb5a-import { foo } from \"foo\";\nimport { bar } from \"bar\";\nimport { foo2 } from \"foo2\";\nimport { bar2 } from \"bar2\";","signature":"abe7d9981d6018efb6b2b794f40a1607-export {};\n","impliedNodeFormat":99}],"fileIdsList":[[2,3,4,5]],"options":{"module":100,"strict":true},"referencedMap":[[6,1]]} +{"version":"FakeTSVersion","root":[6],"packageJsons":["./node_modules/@types/bar/package.json","./node_modules/@types/bar2/package.json","./node_modules/bar/package.json","./node_modules/bar2/package.json","./node_modules/foo/package.json","./node_modules/foo2/package.json"],"fileNames":["lib.es2022.full.d.ts","./node_modules/foo/index.d.ts","./node_modules/@types/bar/index.d.ts","./node_modules/foo2/index.d.ts","./node_modules/@types/bar2/index.d.ts","./index.mts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"2a914bfad3bba77712486af8a4cdc415-export declare const foo: number;","78bc7ca8c840e090086811119f6d6ba9-export declare const bar: number;","165b91a7791663df5931f0b63ebf9ce2-export declare const foo2: number;","da9728b78f5d24b38c00844e001b4953-export declare const bar2: number;",{"version":"eee0814e4a127747fb836acc50eaeb5a-import { foo } from \"foo\";\nimport { bar } from \"bar\";\nimport { foo2 } from \"foo2\";\nimport { bar2 } from \"bar2\";","signature":"abe7d9981d6018efb6b2b794f40a1607-export {};\n","impliedNodeFormat":99}],"fileIdsList":[[2,3,4,5]],"options":{"module":100,"strict":true},"referencedMap":[[6,1]]} //// [/home/src/projects/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* { "version": "FakeTSVersion", @@ -1822,6 +1838,14 @@ Resolving real path for '/home/src/projects/project/node_modules/@types/bar2/ind "original": 6 } ], + "packageJsons": [ + "./node_modules/@types/bar/package.json", + "./node_modules/@types/bar2/package.json", + "./node_modules/bar/package.json", + "./node_modules/bar2/package.json", + "./node_modules/foo/package.json", + "./node_modules/foo2/package.json" + ], "fileNames": [ "lib.es2022.full.d.ts", "./node_modules/foo/index.d.ts", @@ -1899,7 +1923,7 @@ Resolving real path for '/home/src/projects/project/node_modules/@types/bar2/ind "./node_modules/@types/bar2/index.d.ts" ] }, - "size": 1637 + "size": 1875 } tsconfig.json:: @@ -2086,7 +2110,7 @@ Found 1 error in index.mts:4 //// [/home/src/projects/project/index.mjs] *rewrite with same content* //// [/home/src/projects/project/tsconfig.tsbuildinfo] *modified* -{"version":"FakeTSVersion","root":[5],"fileNames":["lib.es2022.full.d.ts","./node_modules/foo/index.d.ts","./node_modules/@types/bar/index.d.ts","./node_modules/foo2/index.d.ts","./index.mts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"2a914bfad3bba77712486af8a4cdc415-export declare const foo: number;","78bc7ca8c840e090086811119f6d6ba9-export declare const bar: number;","165b91a7791663df5931f0b63ebf9ce2-export declare const foo2: number;",{"version":"eee0814e4a127747fb836acc50eaeb5a-import { foo } from \"foo\";\nimport { bar } from \"bar\";\nimport { foo2 } from \"foo2\";\nimport { bar2 } from \"bar2\";","signature":"abe7d9981d6018efb6b2b794f40a1607-export {};\n","impliedNodeFormat":99}],"fileIdsList":[[2,3,4]],"options":{"module":100,"strict":true},"referencedMap":[[5,1]],"semanticDiagnosticsPerFile":[[5,[{"pos":104,"end":110,"code":7016,"category":1,"message":"Could not find a declaration file for module 'bar2'. '/home/src/projects/project/node_modules/bar2/index.mjs' implicitly has an 'any' type.","messageChain":[{"pos":104,"end":110,"code":6278,"category":3,"message":"There are types at '/home/src/projects/project/node_modules/@types/bar2/index.d.ts', but this result could not be resolved when respecting package.json \"exports\". The '@types/bar2' library may need to update its package.json or typings."}]}]]]} +{"version":"FakeTSVersion","root":[5],"packageJsons":["./node_modules/@types/bar/package.json","./node_modules/@types/bar2/package.json","./node_modules/bar/package.json","./node_modules/bar2/package.json","./node_modules/foo/package.json","./node_modules/foo2/package.json"],"fileNames":["lib.es2022.full.d.ts","./node_modules/foo/index.d.ts","./node_modules/@types/bar/index.d.ts","./node_modules/foo2/index.d.ts","./index.mts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"2a914bfad3bba77712486af8a4cdc415-export declare const foo: number;","78bc7ca8c840e090086811119f6d6ba9-export declare const bar: number;","165b91a7791663df5931f0b63ebf9ce2-export declare const foo2: number;",{"version":"eee0814e4a127747fb836acc50eaeb5a-import { foo } from \"foo\";\nimport { bar } from \"bar\";\nimport { foo2 } from \"foo2\";\nimport { bar2 } from \"bar2\";","signature":"abe7d9981d6018efb6b2b794f40a1607-export {};\n","impliedNodeFormat":99}],"fileIdsList":[[2,3,4]],"options":{"module":100,"strict":true},"referencedMap":[[5,1]],"semanticDiagnosticsPerFile":[[5,[{"pos":104,"end":110,"code":7016,"category":1,"message":"Could not find a declaration file for module 'bar2'. '/home/src/projects/project/node_modules/bar2/index.mjs' implicitly has an 'any' type.","messageChain":[{"pos":104,"end":110,"code":6278,"category":3,"message":"There are types at '/home/src/projects/project/node_modules/@types/bar2/index.d.ts', but this result could not be resolved when respecting package.json \"exports\". The '@types/bar2' library may need to update its package.json or typings."}]}]]]} //// [/home/src/projects/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* { "version": "FakeTSVersion", @@ -2098,6 +2122,14 @@ Found 1 error in index.mts:4 "original": 5 } ], + "packageJsons": [ + "./node_modules/@types/bar/package.json", + "./node_modules/@types/bar2/package.json", + "./node_modules/bar/package.json", + "./node_modules/bar2/package.json", + "./node_modules/foo/package.json", + "./node_modules/foo2/package.json" + ], "fileNames": [ "lib.es2022.full.d.ts", "./node_modules/foo/index.d.ts", @@ -2189,7 +2221,7 @@ Found 1 error in index.mts:4 ] ] ], - "size": 2076 + "size": 2314 } tsconfig.json:: @@ -2417,7 +2449,7 @@ Found 2 errors in the same file, starting at: index.mts:3 //// [/home/src/projects/project/index.mjs] *rewrite with same content* //// [/home/src/projects/project/tsconfig.tsbuildinfo] *modified* -{"version":"FakeTSVersion","root":[4],"fileNames":["lib.es2022.full.d.ts","./node_modules/foo/index.d.ts","./node_modules/@types/bar/index.d.ts","./index.mts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"2a914bfad3bba77712486af8a4cdc415-export declare const foo: number;","78bc7ca8c840e090086811119f6d6ba9-export declare const bar: number;",{"version":"eee0814e4a127747fb836acc50eaeb5a-import { foo } from \"foo\";\nimport { bar } from \"bar\";\nimport { foo2 } from \"foo2\";\nimport { bar2 } from \"bar2\";","signature":"abe7d9981d6018efb6b2b794f40a1607-export {};\n","impliedNodeFormat":99}],"fileIdsList":[[2,3]],"options":{"module":100,"strict":true},"referencedMap":[[4,1]],"semanticDiagnosticsPerFile":[[4,[{"pos":75,"end":81,"code":7016,"category":1,"message":"Could not find a declaration file for module 'foo2'. '/home/src/projects/project/node_modules/foo2/index.mjs' implicitly has an 'any' type.","messageChain":[{"pos":75,"end":81,"code":6278,"category":3,"message":"There are types at '/home/src/projects/project/node_modules/foo2/index.d.ts', but this result could not be resolved when respecting package.json \"exports\". The 'foo2' library may need to update its package.json or typings."}]},{"pos":104,"end":110,"code":7016,"category":1,"message":"Could not find a declaration file for module 'bar2'. '/home/src/projects/project/node_modules/bar2/index.mjs' implicitly has an 'any' type.","messageChain":[{"pos":104,"end":110,"code":6278,"category":3,"message":"There are types at '/home/src/projects/project/node_modules/@types/bar2/index.d.ts', but this result could not be resolved when respecting package.json \"exports\". The '@types/bar2' library may need to update its package.json or typings."}]}]]]} +{"version":"FakeTSVersion","root":[4],"packageJsons":["./node_modules/@types/bar/package.json","./node_modules/@types/bar2/package.json","./node_modules/bar/package.json","./node_modules/bar2/package.json","./node_modules/foo/package.json","./node_modules/foo2/package.json"],"fileNames":["lib.es2022.full.d.ts","./node_modules/foo/index.d.ts","./node_modules/@types/bar/index.d.ts","./index.mts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},"2a914bfad3bba77712486af8a4cdc415-export declare const foo: number;","78bc7ca8c840e090086811119f6d6ba9-export declare const bar: number;",{"version":"eee0814e4a127747fb836acc50eaeb5a-import { foo } from \"foo\";\nimport { bar } from \"bar\";\nimport { foo2 } from \"foo2\";\nimport { bar2 } from \"bar2\";","signature":"abe7d9981d6018efb6b2b794f40a1607-export {};\n","impliedNodeFormat":99}],"fileIdsList":[[2,3]],"options":{"module":100,"strict":true},"referencedMap":[[4,1]],"semanticDiagnosticsPerFile":[[4,[{"pos":75,"end":81,"code":7016,"category":1,"message":"Could not find a declaration file for module 'foo2'. '/home/src/projects/project/node_modules/foo2/index.mjs' implicitly has an 'any' type.","messageChain":[{"pos":75,"end":81,"code":6278,"category":3,"message":"There are types at '/home/src/projects/project/node_modules/foo2/index.d.ts', but this result could not be resolved when respecting package.json \"exports\". The 'foo2' library may need to update its package.json or typings."}]},{"pos":104,"end":110,"code":7016,"category":1,"message":"Could not find a declaration file for module 'bar2'. '/home/src/projects/project/node_modules/bar2/index.mjs' implicitly has an 'any' type.","messageChain":[{"pos":104,"end":110,"code":6278,"category":3,"message":"There are types at '/home/src/projects/project/node_modules/@types/bar2/index.d.ts', but this result could not be resolved when respecting package.json \"exports\". The '@types/bar2' library may need to update its package.json or typings."}]}]]]} //// [/home/src/projects/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* { "version": "FakeTSVersion", @@ -2429,6 +2461,14 @@ Found 2 errors in the same file, starting at: index.mts:3 "original": 4 } ], + "packageJsons": [ + "./node_modules/@types/bar/package.json", + "./node_modules/@types/bar2/package.json", + "./node_modules/bar/package.json", + "./node_modules/bar2/package.json", + "./node_modules/foo/package.json", + "./node_modules/foo2/package.json" + ], "fileNames": [ "lib.es2022.full.d.ts", "./node_modules/foo/index.d.ts", @@ -2527,7 +2567,7 @@ Found 2 errors in the same file, starting at: index.mts:3 ] ] ], - "size": 2467 + "size": 2705 } tsconfig.json:: diff --git a/testdata/baselines/reference/tsc/moduleResolution/package-json-scope.js b/testdata/baselines/reference/tsc/moduleResolution/package-json-scope.js index d50d7c12a5..8ef79b2cf9 100644 --- a/testdata/baselines/reference/tsc/moduleResolution/package-json-scope.js +++ b/testdata/baselines/reference/tsc/moduleResolution/package-json-scope.js @@ -106,7 +106,7 @@ exports.x = void 0; exports.x = 10; //// [/home/src/workspaces/project/src/tsconfig.tsbuildinfo] *new* -{"version":"FakeTSVersion","root":[[2,4]],"fileNames":["lib.es2016.full.d.ts","./main.ts","./fileB.mts","./fileA.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"28e8748a7acd58f4f59388926e914f86-export const x = 10;","signature":"f9b4154a9a5944099ecf197d4519d083-export declare const x = 10;\n","impliedNodeFormat":1},{"version":"d03690d860e74c03bcacf63f0dd68b93-export function foo() {}","signature":"7ffb4ea6089b1a385965a214ba412941-export declare function foo(): void;\n","impliedNodeFormat":99},{"version":"cc520ca096f0b81d18073ba8a9776fe3-import { foo } from \"./fileB.mjs\";\nfoo();","signature":"abe7d9981d6018efb6b2b794f40a1607-export {};\n","impliedNodeFormat":1}],"fileIdsList":[[3]],"options":{"composite":true,"module":100,"target":3},"referencedMap":[[4,1]],"semanticDiagnosticsPerFile":[[4,[{"pos":20,"end":33,"code":1479,"category":1,"message":"The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import(\"./fileB.mjs\")' call instead.","messageChain":[{"pos":20,"end":33,"code":1481,"category":3,"message":"To convert this file to an ECMAScript module, change its file extension to '.mts', or add the field `\"type\": \"module\"` to '/home/src/workspaces/project/package.json'."}]}]]],"latestChangedDtsFile":"./fileA.d.ts"} +{"version":"FakeTSVersion","root":[[2,4]],"packageJsons":["../package.json"],"fileNames":["lib.es2016.full.d.ts","./main.ts","./fileB.mts","./fileA.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"28e8748a7acd58f4f59388926e914f86-export const x = 10;","signature":"f9b4154a9a5944099ecf197d4519d083-export declare const x = 10;\n","impliedNodeFormat":1},{"version":"d03690d860e74c03bcacf63f0dd68b93-export function foo() {}","signature":"7ffb4ea6089b1a385965a214ba412941-export declare function foo(): void;\n","impliedNodeFormat":99},{"version":"cc520ca096f0b81d18073ba8a9776fe3-import { foo } from \"./fileB.mjs\";\nfoo();","signature":"abe7d9981d6018efb6b2b794f40a1607-export {};\n","impliedNodeFormat":1}],"fileIdsList":[[3]],"options":{"composite":true,"module":100,"target":3},"referencedMap":[[4,1]],"semanticDiagnosticsPerFile":[[4,[{"pos":20,"end":33,"code":1479,"category":1,"message":"The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import(\"./fileB.mjs\")' call instead.","messageChain":[{"pos":20,"end":33,"code":1481,"category":3,"message":"To convert this file to an ECMAScript module, change its file extension to '.mts', or add the field `\"type\": \"module\"` to '/home/src/workspaces/project/package.json'."}]}]]],"latestChangedDtsFile":"./fileA.d.ts"} //// [/home/src/workspaces/project/src/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", @@ -123,6 +123,9 @@ exports.x = 10; ] } ], + "packageJsons": [ + "../package.json" + ], "fileNames": [ "lib.es2016.full.d.ts", "./main.ts", @@ -215,7 +218,7 @@ exports.x = 10; ] ], "latestChangedDtsFile": "./fileA.d.ts", - "size": 2140 + "size": 2175 } src/tsconfig.json:: @@ -263,6 +266,118 @@ src/fileA.ts Found 1 error in src/fileA.ts:1 +//// [/home/src/workspaces/project/src/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","root":[[2,4]],"fileNames":["lib.es2016.full.d.ts","./main.ts","./fileB.mts","./fileA.ts"],"fileInfos":[{"version":"8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"28e8748a7acd58f4f59388926e914f86-export const x = 10;","signature":"f9b4154a9a5944099ecf197d4519d083-export declare const x = 10;\n","impliedNodeFormat":1},{"version":"d03690d860e74c03bcacf63f0dd68b93-export function foo() {}","signature":"7ffb4ea6089b1a385965a214ba412941-export declare function foo(): void;\n","impliedNodeFormat":99},{"version":"cc520ca096f0b81d18073ba8a9776fe3-import { foo } from \"./fileB.mjs\";\nfoo();","signature":"abe7d9981d6018efb6b2b794f40a1607-export {};\n","impliedNodeFormat":1}],"fileIdsList":[[3]],"options":{"composite":true,"module":100,"target":3},"referencedMap":[[4,1]],"semanticDiagnosticsPerFile":[[4,[{"pos":20,"end":33,"code":1479,"category":1,"message":"The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import(\"./fileB.mjs\")' call instead.","messageChain":[{"pos":20,"end":33,"code":1481,"category":3,"message":"To convert this file to an ECMAScript module, change its file extension to '.mts', or add the field `\"type\": \"module\"` to '/home/src/workspaces/project/package.json'."}]}]]],"latestChangedDtsFile":"./fileA.d.ts"} +//// [/home/src/workspaces/project/src/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "root": [ + { + "files": [ + "./main.ts", + "./fileB.mts", + "./fileA.ts" + ], + "original": [ + 2, + 4 + ] + } + ], + "fileNames": [ + "lib.es2016.full.d.ts", + "./main.ts", + "./fileB.mts", + "./fileA.ts" + ], + "fileInfos": [ + { + "fileName": "lib.es2016.full.d.ts", + "version": "8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };", + "signature": "8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "8859c12c614ce56ba9a18e58384a198f-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ninterface SymbolConstructor {\n (desc?: string | number): symbol;\n for(name: string): symbol;\n readonly toStringTag: symbol;\n}\ndeclare var Symbol: SymbolConstructor;\ninterface Symbol {\n readonly [Symbol.toStringTag]: string;\n}\ndeclare const console: { log(msg: any): void; };", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./main.ts", + "version": "28e8748a7acd58f4f59388926e914f86-export const x = 10;", + "signature": "f9b4154a9a5944099ecf197d4519d083-export declare const x = 10;\n", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "28e8748a7acd58f4f59388926e914f86-export const x = 10;", + "signature": "f9b4154a9a5944099ecf197d4519d083-export declare const x = 10;\n", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./fileB.mts", + "version": "d03690d860e74c03bcacf63f0dd68b93-export function foo() {}", + "signature": "7ffb4ea6089b1a385965a214ba412941-export declare function foo(): void;\n", + "impliedNodeFormat": "ESNext", + "original": { + "version": "d03690d860e74c03bcacf63f0dd68b93-export function foo() {}", + "signature": "7ffb4ea6089b1a385965a214ba412941-export declare function foo(): void;\n", + "impliedNodeFormat": 99 + } + }, + { + "fileName": "./fileA.ts", + "version": "cc520ca096f0b81d18073ba8a9776fe3-import { foo } from \"./fileB.mjs\";\nfoo();", + "signature": "abe7d9981d6018efb6b2b794f40a1607-export {};\n", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "cc520ca096f0b81d18073ba8a9776fe3-import { foo } from \"./fileB.mjs\";\nfoo();", + "signature": "abe7d9981d6018efb6b2b794f40a1607-export {};\n", + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./fileB.mts" + ] + ], + "options": { + "composite": true, + "module": 100, + "target": 3 + }, + "referencedMap": { + "./fileA.ts": [ + "./fileB.mts" + ] + }, + "semanticDiagnosticsPerFile": [ + [ + "./fileA.ts", + [ + { + "pos": 20, + "end": 33, + "code": 1479, + "category": 1, + "message": "The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import(\"./fileB.mjs\")' call instead.", + "messageChain": [ + { + "pos": 20, + "end": 33, + "code": 1481, + "category": 3, + "message": "To convert this file to an ECMAScript module, change its file extension to '.mts', or add the field `\"type\": \"module\"` to '/home/src/workspaces/project/package.json'." + } + ] + } + ] + ] + ], + "latestChangedDtsFile": "./fileA.d.ts", + "size": 2140 +} src/tsconfig.json:: SemanticDiagnostics::