From 29ee285db1744161c0191e0eaf21f34d8a527129 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Fri, 20 Jun 2025 14:00:02 -0700 Subject: [PATCH 01/36] Refactor --- cmd/tsgo/main.go | 2 +- internal/execute/export_test.go | 12 ++--------- internal/execute/tsc.go | 28 ++++++++++++------------- internal/execute/verifytsc_test.go | 4 ++-- internal/execute/verifytscwatch_test.go | 2 +- 5 files changed, 19 insertions(+), 29 deletions(-) diff --git a/cmd/tsgo/main.go b/cmd/tsgo/main.go index 1f8ad09601..0672f1b0b5 100644 --- a/cmd/tsgo/main.go +++ b/cmd/tsgo/main.go @@ -20,5 +20,5 @@ func runMain() int { return runAPI(args[1:]) } } - return int(execute.CommandLine(newSystem(), nil, args)) + return int(execute.CommandLine(newSystem(), args)) } diff --git a/internal/execute/export_test.go b/internal/execute/export_test.go index 665e0fbc18..e73465cbe1 100644 --- a/internal/execute/export_test.go +++ b/internal/execute/export_test.go @@ -5,16 +5,8 @@ import ( "github.com/microsoft/typescript-go/internal/tsoptions" ) -func CommandLineTest(sys System, cb cbType, commandLineArgs []string) (*tsoptions.ParsedCommandLine, ExitStatus) { - parsedCommandLine := tsoptions.ParseCommandLine(commandLineArgs, sys) - e, _ := executeCommandLineWorker(sys, cb, parsedCommandLine) - return parsedCommandLine, e -} - -func CommandLineTestWatch(sys System, cb cbType, commandLineArgs []string) (*tsoptions.ParsedCommandLine, *watcher) { - parsedCommandLine := tsoptions.ParseCommandLine(commandLineArgs, sys) - _, w := executeCommandLineWorker(sys, cb, parsedCommandLine) - return parsedCommandLine, w +func CommandLineTest(sys System, commandLineArgs []string) (ExitStatus, *tsoptions.ParsedCommandLine, *watcher) { + return commandLineWorker(sys, commandLineArgs) } func StartForTest(w *watcher) { diff --git a/internal/execute/tsc.go b/internal/execute/tsc.go index c2fefa12bd..a9c038f435 100644 --- a/internal/execute/tsc.go +++ b/internal/execute/tsc.go @@ -41,25 +41,30 @@ func applyBulkEdits(text string, edits []core.TextChange) string { return b.String() } -func CommandLine(sys System, cb cbType, commandLineArgs []string) ExitStatus { +func CommandLine(sys System, commandLineArgs []string) ExitStatus { + status, _, watcher := commandLineWorker(sys, commandLineArgs) + if watcher == nil { + return status + } + return start(watcher) +} + +func commandLineWorker(sys System, commandLineArgs []string) (ExitStatus, *tsoptions.ParsedCommandLine, *watcher) { if len(commandLineArgs) > 0 { // !!! build mode switch strings.ToLower(commandLineArgs[0]) { case "-b", "--b", "-build", "--build": fmt.Fprint(sys.Writer(), "Build mode is currently unsupported."+sys.NewLine()) sys.EndWrite() - return ExitStatusNotImplemented + return ExitStatusNotImplemented, nil, nil // case "-f": // return fmtMain(sys, commandLineArgs[1], commandLineArgs[1]) } } parsedCommandLine := tsoptions.ParseCommandLine(commandLineArgs, sys) - e, watcher := executeCommandLineWorker(sys, cb, parsedCommandLine) - if watcher == nil { - return e - } - return start(watcher) + status, watcher := tscCompilation(sys, parsedCommandLine) + return status, parsedCommandLine, watcher } func fmtMain(sys System, input, output string) ExitStatus { @@ -88,7 +93,7 @@ func fmtMain(sys System, input, output string) ExitStatus { return ExitStatusSuccess } -func executeCommandLineWorker(sys System, cb cbType, commandLine *tsoptions.ParsedCommandLine) (ExitStatus, *watcher) { +func tscCompilation(sys System, commandLine *tsoptions.ParsedCommandLine) (ExitStatus, *watcher) { configFileName := "" reportDiagnostic := createDiagnosticReporter(sys, commandLine.CompilerOptions()) // if commandLine.Options().Locale != nil @@ -185,7 +190,6 @@ func executeCommandLineWorker(sys System, cb cbType, commandLine *tsoptions.Pars // !!! incremental return performCompilation( sys, - cb, configParseResult, reportDiagnostic, &extendedConfigCache, @@ -205,7 +209,6 @@ func executeCommandLineWorker(sys System, cb cbType, commandLine *tsoptions.Pars } return performCompilation( sys, - cb, commandLine, reportDiagnostic, nil, @@ -229,7 +232,6 @@ func findConfigFile(searchPath string, fileExists func(string) bool, configName func performCompilation( sys System, - cb cbType, config *tsoptions.ParsedCommandLine, reportDiagnostic diagnosticReporter, extendedConfigCache *collections.SyncMap[tspath.Path, *tsoptions.ExtendedConfigCacheEntry], @@ -265,10 +267,6 @@ func performCompilation( reportStatistics(sys, program, result, &memStats) } - if cb != nil { - cb(program) - } - if result.emitResult.EmitSkipped && len(result.diagnostics) > 0 { return ExitStatusDiagnosticsPresent_OutputsSkipped } else if len(result.diagnostics) > 0 { diff --git a/internal/execute/verifytsc_test.go b/internal/execute/verifytsc_test.go index bee7353071..0a2dc6153a 100644 --- a/internal/execute/verifytsc_test.go +++ b/internal/execute/verifytsc_test.go @@ -35,7 +35,7 @@ func (test *tscInput) verify(t *testing.T, scenario string) { // initial test tsc compile baselineBuilder := test.startBaseline() - parsedCommandLine, exit := execute.CommandLineTest(test.sys, nil, test.commandLineArgs) + exit, parsedCommandLine, _ := execute.CommandLineTest(test.sys, test.commandLineArgs) baselineBuilder.WriteString("ExitStatus:: " + fmt.Sprint(exit)) compilerOptionsString, _ := json.MarshalIndent(parsedCommandLine.CompilerOptions(), "", " ") @@ -92,7 +92,7 @@ func (test *tscInput) verifyCommandLineParsing(t *testing.T, scenario string) { // initial test tsc compile baselineBuilder := test.startBaseline() - parsedCommandLine, exit := execute.CommandLineTest(test.sys, nil, test.commandLineArgs) + exit, parsedCommandLine, _ := execute.CommandLineTest(test.sys, test.commandLineArgs) baselineBuilder.WriteString("ExitStatus:: " + fmt.Sprint(exit)) //nolint:musttag parsedCommandLineString, _ := json.MarshalIndent(parsedCommandLine, "", " ") diff --git a/internal/execute/verifytscwatch_test.go b/internal/execute/verifytscwatch_test.go index 6a8fc6ad37..50eb7e1812 100644 --- a/internal/execute/verifytscwatch_test.go +++ b/internal/execute/verifytscwatch_test.go @@ -18,7 +18,7 @@ func verifyWatch(t *testing.T, test *tscInput, scenario string, edits []*testTsc t.Parallel() baselineBuilder := test.startBaseline() - parsedCommandLine, watcher := execute.CommandLineTestWatch(test.sys, nil, test.commandLineArgs) + _, parsedCommandLine, watcher := execute.CommandLineTest(test.sys, test.commandLineArgs) compilerOptionsString, _ := json.MarshalIndent(parsedCommandLine.CompilerOptions(), "", " ") baselineBuilder.WriteString("\n\nCompilerOptions::") From 62f6eb3f2e29c583719c6f5bd4a1efb7e477c1f0 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Fri, 20 Jun 2025 14:02:32 -0700 Subject: [PATCH 02/36] Add stub for incremental --- internal/core/compileroptions.go | 4 ++ internal/execute/outputs.go | 2 +- internal/execute/system.go | 1 - internal/execute/tsc.go | 71 +++++++++++++++----------------- 4 files changed, 39 insertions(+), 39 deletions(-) diff --git a/internal/core/compileroptions.go b/internal/core/compileroptions.go index bdfd520a60..5d19084daa 100644 --- a/internal/core/compileroptions.go +++ b/internal/core/compileroptions.go @@ -320,6 +320,10 @@ func (options *CompilerOptions) GetIsolatedModules() bool { return options.IsolatedModules == TSTrue || options.VerbatimModuleSyntax == TSTrue } +func (options *CompilerOptions) IsIncremental() bool { + return options.Incremental.IsTrue() || options.Composite.IsTrue() +} + func (options *CompilerOptions) GetEmitStandardClassFields() bool { return options.UseDefineForClassFields != TSFalse && options.GetEmitScriptTarget() >= ScriptTargetES2022 } diff --git a/internal/execute/outputs.go b/internal/execute/outputs.go index 9a1f73d4ca..a8b4348840 100644 --- a/internal/execute/outputs.go +++ b/internal/execute/outputs.go @@ -54,7 +54,7 @@ func shouldBePretty(sys System, options *core.CompilerOptions) bool { // todo: return defaultIsPretty(sys); return true } - return options.Pretty.IsTrue() + return false } func createReportErrorSummary(sys System, options *core.CompilerOptions) func(diagnostics []*ast.Diagnostic) { diff --git a/internal/execute/system.go b/internal/execute/system.go index 3861a04392..0f31a916b4 100644 --- a/internal/execute/system.go +++ b/internal/execute/system.go @@ -28,5 +28,4 @@ const ( ExitStatusInvalidProject_OutputsSkipped ExitStatus = 3 ExitStatusProjectReferenceCycle_OutputsSkipped ExitStatus = 4 ExitStatusNotImplemented ExitStatus = 5 - ExitStatusNotImplementedWatch ExitStatus = 6 ) diff --git a/internal/execute/tsc.go b/internal/execute/tsc.go index a9c038f435..50878530e2 100644 --- a/internal/execute/tsc.go +++ b/internal/execute/tsc.go @@ -126,7 +126,8 @@ func tscCompilation(sys System, commandLine *tsoptions.ParsedCommandLine) (ExitS } if commandLine.CompilerOptions().Watch.IsTrue() && commandLine.CompilerOptions().ListFilesOnly.IsTrue() { - return ExitStatusNotImplemented, nil + reportDiagnostic(ast.NewCompilerDiagnostic(diagnostics.Options_0_and_1_cannot_be_combined, "watch", "listFilesOnly")) + return ExitStatusDiagnosticsPresent_OutputsSkipped, nil } if commandLine.CompilerOptions().Project != "" { @@ -166,12 +167,13 @@ func tscCompilation(sys System, commandLine *tsoptions.ParsedCommandLine) (ExitS // !!! convert to options with absolute paths is usually done here, but for ease of implementation, it's done in `tsoptions.ParseCommandLine()` compilerOptionsFromCommandLine := commandLine.CompilerOptions() - + configForCompilation := commandLine + var extendedConfigCache collections.SyncMap[tspath.Path, *tsoptions.ExtendedConfigCacheEntry] + var configTime time.Duration if configFileName != "" { configStart := sys.Now() - extendedConfigCache := collections.SyncMap[tspath.Path, *tsoptions.ExtendedConfigCacheEntry]{} configParseResult, errors := tsoptions.GetParsedCommandLineOfConfigFile(configFileName, compilerOptionsFromCommandLine, sys, &extendedConfigCache) - configTime := sys.Now().Sub(configStart) + configTime = sys.Now().Sub(configStart) if len(errors) != 0 { // these are unrecoverable errors--exit to report them as diagnostics for _, e := range errors { @@ -179,40 +181,32 @@ func tscCompilation(sys System, commandLine *tsoptions.ParsedCommandLine) (ExitS } return ExitStatusDiagnosticsPresent_OutputsGenerated, nil } - if compilerOptionsFromCommandLine.ShowConfig.IsTrue() { - showConfig(sys, configParseResult.CompilerOptions()) - return ExitStatusSuccess, nil - } - // updateReportDiagnostic - if isWatchSet(configParseResult.CompilerOptions()) { - return ExitStatusSuccess, createWatcher(sys, configParseResult, reportDiagnostic) - } - // !!! incremental - return performCompilation( + configForCompilation = configParseResult + // Updater to reflect pretty + reportDiagnostic = createDiagnosticReporter(sys, commandLine.CompilerOptions()) + } + + if compilerOptionsFromCommandLine.ShowConfig.IsTrue() { + showConfig(sys, configForCompilation.CompilerOptions()) + return ExitStatusSuccess, nil + } + if configForCompilation.CompilerOptions().Watch.IsTrue() { + return ExitStatusSuccess, createWatcher(sys, configForCompilation, reportDiagnostic) + } else if configForCompilation.CompilerOptions().IsIncremental() { + return performIncrementalCompilation( sys, - configParseResult, + configForCompilation, reportDiagnostic, &extendedConfigCache, configTime, ), nil - } else { - if compilerOptionsFromCommandLine.ShowConfig.IsTrue() { - showConfig(sys, compilerOptionsFromCommandLine) - return ExitStatusSuccess, nil - } - // todo update reportDiagnostic - if isWatchSet(compilerOptionsFromCommandLine) { - // !!! reportWatchModeWithoutSysSupport - return ExitStatusSuccess, createWatcher(sys, commandLine, reportDiagnostic) - } - // !!! incremental } return performCompilation( sys, - commandLine, + configForCompilation, reportDiagnostic, - nil, - 0, /*configTime*/ + &extendedConfigCache, + configTime, ), nil } @@ -230,6 +224,17 @@ func findConfigFile(searchPath string, fileExists func(string) bool, configName return result } +func performIncrementalCompilation( + sys System, + config *tsoptions.ParsedCommandLine, + reportDiagnostic diagnosticReporter, + extendedConfigCache *collections.SyncMap[tspath.Path, *tsoptions.ExtendedConfigCacheEntry], + configTime time.Duration, +) ExitStatus { + // !! + return performCompilation(sys, config, reportDiagnostic, extendedConfigCache, configTime) +} + func performCompilation( sys System, config *tsoptions.ParsedCommandLine, @@ -352,14 +357,6 @@ func emitFilesAndReportErrors(sys System, program *compiler.Program, reportDiagn // return len(args) > 0 && args[0] == "build" // } -func isWatchSet(options *core.CompilerOptions) bool { - return options.Watch.IsTrue() -} - -func isIncrementalCompilation(options *core.CompilerOptions) bool { - return options.Incremental.IsTrue() -} - func showConfig(sys System, config *core.CompilerOptions) { // !!! enc := json.NewEncoder(sys.Writer()) From d0a95715f7eb8b79c11cdb5db324d7148b7021aa Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 3 Jul 2025 13:39:40 -0700 Subject: [PATCH 03/36] Incremental --- internal/ast/diagnostic.go | 29 + internal/ast/utilities.go | 4 + internal/checker/checker.go | 10 +- internal/checker/grammarchecks.go | 13 +- internal/checker/symbolaccessibility.go | 6 +- internal/checker/utilities.go | 4 +- internal/collections/manytomanymap.go | 62 + internal/collections/set.go | 28 + internal/compiler/emitHost.go | 10 +- internal/compiler/emitter.go | 171 ++- internal/compiler/program.go | 84 +- internal/execute/tsc.go | 104 +- internal/incremental/buildInfo.go | 619 ++++++++ internal/incremental/incremental.go | 62 + internal/incremental/program.go | 104 ++ internal/incremental/programstate.go | 1430 ++++++++++++++++++ internal/incremental/tobuildinfo.go | 319 ++++ internal/incremental/toprogramstate.go | 186 +++ internal/outputpaths/outputpaths.go | 29 +- internal/printer/emithost.go | 10 +- internal/testutil/harnessutil/harnessutil.go | 2 +- internal/tsoptions/commandlineoption.go | 10 +- internal/tsoptions/commandlineparser.go | 2 +- internal/tsoptions/declscompiler.go | 78 +- internal/tsoptions/parsinghelpers.go | 32 +- internal/tsoptions/tsconfigparsing.go | 8 +- 26 files changed, 3246 insertions(+), 170 deletions(-) create mode 100644 internal/collections/manytomanymap.go create mode 100644 internal/incremental/buildInfo.go create mode 100644 internal/incremental/incremental.go create mode 100644 internal/incremental/program.go create mode 100644 internal/incremental/programstate.go create mode 100644 internal/incremental/tobuildinfo.go create mode 100644 internal/incremental/toprogramstate.go diff --git a/internal/ast/diagnostic.go b/internal/ast/diagnostic.go index 79d09afff7..7757501881 100644 --- a/internal/ast/diagnostic.go +++ b/internal/ast/diagnostic.go @@ -21,6 +21,7 @@ type Diagnostic struct { relatedInformation []*Diagnostic reportsUnnecessary bool reportsDeprecated bool + skippedOnNoEmit bool } func (d *Diagnostic) File() *SourceFile { return d.file } @@ -35,10 +36,12 @@ func (d *Diagnostic) MessageChain() []*Diagnostic { return d.messageChain func (d *Diagnostic) RelatedInformation() []*Diagnostic { return d.relatedInformation } func (d *Diagnostic) ReportsUnnecessary() bool { return d.reportsUnnecessary } func (d *Diagnostic) ReportsDeprecated() bool { return d.reportsDeprecated } +func (d *Diagnostic) SkippedOnNoEmit() bool { return d.skippedOnNoEmit } func (d *Diagnostic) SetFile(file *SourceFile) { d.file = file } func (d *Diagnostic) SetLocation(loc core.TextRange) { d.loc = loc } func (d *Diagnostic) SetCategory(category diagnostics.Category) { d.category = category } +func (d *Diagnostic) SetSkippedOnNoEmit() { d.skippedOnNoEmit = true } func (d *Diagnostic) SetMessageChain(messageChain []*Diagnostic) *Diagnostic { d.messageChain = messageChain @@ -69,6 +72,32 @@ func (d *Diagnostic) Clone() *Diagnostic { return &result } +func NewDiagnosticWith( + file *SourceFile, + loc core.TextRange, + code int32, + category diagnostics.Category, + message string, + messageChain []*Diagnostic, + relatedInformation []*Diagnostic, + reportsUnnecessary bool, + reportsDeprecated bool, + skippedOnNoEmit bool, +) *Diagnostic { + return &Diagnostic{ + file: file, + loc: loc, + code: code, + category: category, + message: message, + messageChain: messageChain, + relatedInformation: relatedInformation, + reportsUnnecessary: reportsUnnecessary, + reportsDeprecated: reportsDeprecated, + skippedOnNoEmit: skippedOnNoEmit, + } +} + func NewDiagnostic(file *SourceFile, loc core.TextRange, message *diagnostics.Message, args ...any) *Diagnostic { return &Diagnostic{ file: file, diff --git a/internal/ast/utilities.go b/internal/ast/utilities.go index 5c5fd2314d..da148d98bc 100644 --- a/internal/ast/utilities.go +++ b/internal/ast/utilities.go @@ -1644,6 +1644,10 @@ func IsModuleAugmentationExternal(node *Node) bool { return false } +func IsModuleWithStringLiteralName(node *Node) bool { + return IsModuleDeclaration(node) && node.Name().Kind == KindStringLiteral +} + func GetContainingClass(node *Node) *Node { return FindAncestor(node.Parent, IsClassLike) } diff --git a/internal/checker/checker.go b/internal/checker/checker.go index ca4dd45f4a..e0043030e1 100644 --- a/internal/checker/checker.go +++ b/internal/checker/checker.go @@ -2104,7 +2104,7 @@ func (c *Checker) getSymbol(symbols ast.SymbolTable, name string, meaning ast.Sy } func (c *Checker) CheckSourceFile(ctx context.Context, sourceFile *ast.SourceFile) { - if SkipTypeChecking(sourceFile, c.compilerOptions, c.program) { + if SkipTypeChecking(sourceFile, c.compilerOptions, c.program, false) { return } c.checkSourceFile(ctx, sourceFile) @@ -10088,7 +10088,7 @@ func (c *Checker) checkCollisionWithRequireExportsInGeneratedCode(node *ast.Node parent := ast.GetDeclarationContainer(node) if ast.IsSourceFile(parent) && ast.IsExternalOrCommonJSModule(parent.AsSourceFile()) { // If the declaration happens to be in external module, report error that require and exports are reserved keywords - c.error(name, diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, scanner.DeclarationNameToString(name), scanner.DeclarationNameToString(name)) + c.errorSkippedOnNoEmit(name, diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, scanner.DeclarationNameToString(name), scanner.DeclarationNameToString(name)) } } @@ -13340,6 +13340,12 @@ func (c *Checker) error(location *ast.Node, message *diagnostics.Message, args . return diagnostic } +func (c *Checker) errorSkippedOnNoEmit(location *ast.Node, message *diagnostics.Message, args ...any) *ast.Diagnostic { + diagnostic := c.error(location, message, args...) + diagnostic.SetSkippedOnNoEmit() + return diagnostic +} + func (c *Checker) errorOrSuggestion(isError bool, location *ast.Node, message *diagnostics.Message, args ...any) { c.addErrorOrSuggestion(isError, NewDiagnosticForNode(location, message, args...)) } diff --git a/internal/checker/grammarchecks.go b/internal/checker/grammarchecks.go index cd3cca23f3..eada329c5c 100644 --- a/internal/checker/grammarchecks.go +++ b/internal/checker/grammarchecks.go @@ -42,6 +42,17 @@ func (c *Checker) grammarErrorOnNode(node *ast.Node, message *diagnostics.Messag return false } +func (c *Checker) grammarErrorOnNodeSkippedOnNoEmit(node *ast.Node, message *diagnostics.Message, args ...any) bool { + sourceFile := ast.GetSourceFileOfNode(node) + if !c.hasParseDiagnostics(sourceFile) { + d := NewDiagnosticForNode(node, message, args...) + d.SetSkippedOnNoEmit() + c.diagnostics.Add(d) + return true + } + return false +} + func (c *Checker) checkGrammarRegularExpressionLiteral(_ *ast.RegularExpressionLiteral) bool { // !!! // Unclear if this is needed until regular expression parsing is more thoroughly implemented. @@ -1648,7 +1659,7 @@ func (c *Checker) checkGrammarVariableDeclaration(node *ast.VariableDeclaration) func (c *Checker) checkGrammarForEsModuleMarkerInBindingName(name *ast.Node) bool { if ast.IsIdentifier(name) { if name.Text() == "__esModule" { - return c.grammarErrorOnNode(name, diagnostics.Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules) + return c.grammarErrorOnNodeSkippedOnNoEmit(name, diagnostics.Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules) } } else { for _, element := range name.AsBindingPattern().Elements.Nodes { diff --git a/internal/checker/symbolaccessibility.go b/internal/checker/symbolaccessibility.go index cd47e3c337..d9741f18a5 100644 --- a/internal/checker/symbolaccessibility.go +++ b/internal/checker/symbolaccessibility.go @@ -105,11 +105,7 @@ func (ch *Checker) IsAnySymbolAccessible(symbols []*ast.Symbol, enclosingDeclara } func hasNonGlobalAugmentationExternalModuleSymbol(declaration *ast.Node) bool { - return isModuleWithStringLiteralName(declaration) || (declaration.Kind == ast.KindSourceFile && ast.IsExternalOrCommonJSModule(declaration.AsSourceFile())) -} - -func isModuleWithStringLiteralName(node *ast.Node) bool { - return ast.IsModuleDeclaration(node) && node.Name().Kind == ast.KindStringLiteral + return ast.IsModuleWithStringLiteralName(declaration) || (declaration.Kind == ast.KindSourceFile && ast.IsExternalOrCommonJSModule(declaration.AsSourceFile())) } func getQualifiedLeftMeaning(rightMeaning ast.SymbolFlags) ast.SymbolFlags { diff --git a/internal/checker/utilities.go b/internal/checker/utilities.go index 30fd1e7e5b..41364ce14f 100644 --- a/internal/checker/utilities.go +++ b/internal/checker/utilities.go @@ -1467,8 +1467,8 @@ func forEachYieldExpression(body *ast.Node, visitor func(expr *ast.Node)) { traverse(body) } -func SkipTypeChecking(sourceFile *ast.SourceFile, options *core.CompilerOptions, host Program) bool { - return options.NoCheck.IsTrue() || +func SkipTypeChecking(sourceFile *ast.SourceFile, options *core.CompilerOptions, host Program, ignoreNoCheck bool) bool { + return (!ignoreNoCheck && options.NoCheck.IsTrue()) || options.SkipLibCheck.IsTrue() && sourceFile.IsDeclarationFile || options.SkipDefaultLibCheck.IsTrue() && host.IsSourceFileDefaultLibrary(sourceFile.Path()) || host.IsSourceFromProjectReference(sourceFile.Path()) || diff --git a/internal/collections/manytomanymap.go b/internal/collections/manytomanymap.go new file mode 100644 index 0000000000..edfbd6cdec --- /dev/null +++ b/internal/collections/manytomanymap.go @@ -0,0 +1,62 @@ +package collections + +type ManyToManyMap[K comparable, V comparable] struct { + keyToValueSet map[K]*Set[V] + valueToKeySet map[V]*Set[K] +} + +func (m *ManyToManyMap[K, V]) GetKeys(value V) (*Set[K], bool) { + keys, present := m.valueToKeySet[value] + return keys, present +} + +func (m *ManyToManyMap[K, V]) GetValues(key K) (*Set[V], bool) { + values, present := m.keyToValueSet[key] + return values, present +} + +func (m *ManyToManyMap[K, V]) Len() int { + return len(m.keyToValueSet) +} + +func (m *ManyToManyMap[K, V]) Keys() map[K]*Set[V] { + return m.keyToValueSet +} + +func (m *ManyToManyMap[K, V]) Add(key K, valueSet *Set[V]) { + existingValueSet, hasExisting := m.keyToValueSet[key] + m.keyToValueSet[key] = valueSet + for value := range valueSet.Keys() { + if !hasExisting || !existingValueSet.Has(value) { + // Add to valueToKeySet + addToMapOfSet(m.valueToKeySet, value, key) + } + } + + if hasExisting { + for value := range existingValueSet.Keys() { + if !valueSet.Has(value) { + // Remove from valueToKeySet + defer deleteFromMapOfSet(m.valueToKeySet, value, key) + } + } + } +} + +func addToMapOfSet[K comparable, V comparable](mapKSetV map[K]*Set[V], key K, value V) { + set, exists := mapKSetV[key] + if !exists { + set := &Set[V]{} + mapKSetV[key] = set + } + set.Add(value) +} + +func deleteFromMapOfSet[K comparable, V comparable](mapKSetV map[K]*Set[V], key K, value V) { + if set, exists := mapKSetV[key]; exists { + set.Delete(value) + if set.Len() == 0 { + delete(mapKSetV, key) + } + } +} diff --git a/internal/collections/set.go b/internal/collections/set.go index 02df38acb9..8864b3d0b0 100644 --- a/internal/collections/set.go +++ b/internal/collections/set.go @@ -1,5 +1,7 @@ package collections +import "maps" + type Set[T comparable] struct { M map[T]struct{} } @@ -48,6 +50,32 @@ func (s *Set[T]) AddIfAbsent(key T) bool { return true } +func (s *Set[T]) Clone() *Set[T] { + if s == nil { + return nil + } + clone := &Set[T]{M: maps.Clone(s.M)} + return clone +} + +func (s *Set[T]) Equals(other *Set[T]) bool { + if s == other { + return true + } + if s == nil || other == nil { + return false + } + if s.Len() != other.Len() { + return false + } + for key := range s.M { + if !other.Has(key) { + return false + } + } + return true +} + func NewSetFromItems[T comparable](items ...T) *Set[T] { s := &Set[T]{} for _, item := range items { diff --git a/internal/compiler/emitHost.go b/internal/compiler/emitHost.go index d1db60a4d9..a88fbd8446 100644 --- a/internal/compiler/emitHost.go +++ b/internal/compiler/emitHost.go @@ -14,14 +14,6 @@ import ( "github.com/microsoft/typescript-go/internal/tspath" ) -type WriteFileData struct { - SourceMapUrlPos int - // BuildInfo BuildInfo - Diagnostics []*ast.Diagnostic - DiffersOnlyInMap bool - SkippedDtsWrite bool -} - // NOTE: EmitHost operations must be thread-safe type EmitHost interface { printer.EmitHost @@ -120,7 +112,7 @@ func (host *emitHost) IsEmitBlocked(file string) bool { return false } -func (host *emitHost) WriteFile(fileName string, text string, writeByteOrderMark bool, _ []*ast.SourceFile, _ *printer.WriteFileData) error { +func (host *emitHost) WriteFile(fileName string, text string, writeByteOrderMark bool) error { return host.program.Host().FS().WriteFile(fileName, text, writeByteOrderMark) } diff --git a/internal/compiler/emitter.go b/internal/compiler/emitter.go index b031647c26..285f4a65ba 100644 --- a/internal/compiler/emitter.go +++ b/internal/compiler/emitter.go @@ -1,7 +1,10 @@ package compiler import ( + "context" "encoding/base64" + "slices" + "time" "github.com/microsoft/typescript-go/internal/ast" "github.com/microsoft/typescript-go/internal/binder" @@ -21,32 +24,34 @@ import ( "github.com/microsoft/typescript-go/internal/tspath" ) -type emitOnly byte +type EmitOnly byte const ( - emitAll emitOnly = iota - emitOnlyJs - emitOnlyDts - emitOnlyBuildInfo + EmitAll EmitOnly = iota + EmitOnlyJs + EmitOnlyDts + EmitOnlyForcedDts ) type emitter struct { host EmitHost - emitOnly emitOnly - emittedFilesList []string + emitOnly EmitOnly emitterDiagnostics ast.DiagnosticsCollection - emitSkipped bool - sourceMapDataList []*SourceMapEmitResult writer printer.EmitTextWriter paths *outputpaths.OutputPaths sourceFile *ast.SourceFile + emitResult EmitResult + writeFile func(fileName string, text string, writeByteOrderMark bool, data *WriteFileData) error } func (e *emitter) emit() { + if e.host.Options().ListEmittedFiles.IsTrue() { + e.emitResult.EmittedFiles = []string{} + } // !!! tracing e.emitJSFile(e.sourceFile, e.paths.JsFilePath(), e.paths.SourceMapFilePath()) e.emitDeclarationFile(e.sourceFile, e.paths.DeclarationFilePath(), e.paths.DeclarationMapPath()) - e.emitBuildInfo(e.paths.BuildInfoPath()) + e.emitResult.Diagnostics = e.emitterDiagnostics.GetDiagnostics() } func (e *emitter) getDeclarationTransformers(emitContext *printer.EmitContext, declarationFilePath string, declarationMapPath string) []*declarations.DeclarationTransformer { @@ -124,11 +129,12 @@ func getScriptTransformers(emitContext *printer.EmitContext, host printer.EmitHo func (e *emitter) emitJSFile(sourceFile *ast.SourceFile, jsFilePath string, sourceMapFilePath string) { options := e.host.Options() - if sourceFile == nil || e.emitOnly != emitAll && e.emitOnly != emitOnlyJs || len(jsFilePath) == 0 { + if sourceFile == nil || e.emitOnly != EmitAll && e.emitOnly != EmitOnlyJs || len(jsFilePath) == 0 { return } if options.NoEmit == core.TSTrue || e.host.IsEmitBlocked(jsFilePath) { + e.emitResult.EmitSkipped = true return } @@ -155,23 +161,17 @@ func (e *emitter) emitJSFile(sourceFile *ast.SourceFile, jsFilePath string, sour }, emitContext) e.printSourceFile(jsFilePath, sourceMapFilePath, sourceFile, printer, shouldEmitSourceMaps(options, sourceFile)) - - if e.emittedFilesList != nil { - e.emittedFilesList = append(e.emittedFilesList, jsFilePath) - if sourceMapFilePath != "" { - e.emittedFilesList = append(e.emittedFilesList, sourceMapFilePath) - } - } } func (e *emitter) emitDeclarationFile(sourceFile *ast.SourceFile, declarationFilePath string, declarationMapPath string) { options := e.host.Options() - if sourceFile == nil || e.emitOnly != emitAll && e.emitOnly != emitOnlyDts || len(declarationFilePath) == 0 { + if sourceFile == nil || e.emitOnly == EmitOnlyJs || len(declarationFilePath) == 0 { return } - if options.NoEmit == core.TSTrue || e.host.IsEmitBlocked(declarationFilePath) { + if e.emitOnly != EmitOnlyForcedDts && (options.NoEmit == core.TSTrue || e.host.IsEmitBlocked(declarationFilePath)) { + e.emitResult.EmitSkipped = true return } @@ -183,6 +183,8 @@ func (e *emitter) emitDeclarationFile(sourceFile *ast.SourceFile, declarationFil diags = append(diags, transformer.GetDiagnostics()...) } + // !!! strada skipped emit if there were diagnostics + printerOptions := printer.PrinterOptions{ RemoveComments: options.RemoveComments.IsTrue(), NewLine: options.NewLine, @@ -198,19 +200,14 @@ func (e *emitter) emitDeclarationFile(sourceFile *ast.SourceFile, declarationFil // !!! }, emitContext) - e.printSourceFile(declarationFilePath, declarationMapPath, sourceFile, printer, shouldEmitDeclarationSourceMaps(options, sourceFile)) - for _, elem := range diags { // Add declaration transform diagnostics to emit diagnostics e.emitterDiagnostics.Add(elem) } + e.printSourceFile(declarationFilePath, declarationMapPath, sourceFile, printer, e.emitOnly != EmitOnlyForcedDts && shouldEmitDeclarationSourceMaps(options, sourceFile)) } -func (e *emitter) emitBuildInfo(buildInfoPath string) { - // !!! -} - -func (e *emitter) printSourceFile(jsFilePath string, sourceMapFilePath string, sourceFile *ast.SourceFile, printer_ *printer.Printer, shouldEmitSourceMaps bool) bool { +func (e *emitter) printSourceFile(jsFilePath string, sourceMapFilePath string, sourceFile *ast.SourceFile, printer_ *printer.Printer, shouldEmitSourceMaps bool) { // !!! sourceMapGenerator options := e.host.Options() var sourceMapGenerator *sourcemap.Generator @@ -226,15 +223,12 @@ func (e *emitter) printSourceFile(jsFilePath string, sourceMapFilePath string, s ) } - // !!! bundles not implemented, may be deprecated - sourceFiles := []*ast.SourceFile{sourceFile} - printer_.Write(sourceFile.AsNode(), sourceFile, e.writer, sourceMapGenerator) sourceMapUrlPos := -1 if sourceMapGenerator != nil { if options.SourceMap.IsTrue() || options.InlineSourceMap.IsTrue() || options.GetAreDeclarationMapsEnabled() { - e.sourceMapDataList = append(e.sourceMapDataList, &SourceMapEmitResult{ + e.emitResult.SourceMaps = append(e.emitResult.SourceMaps, &SourceMapEmitResult{ InputSourceFileNames: sourceMapGenerator.Sources(), SourceMap: sourceMapGenerator.RawSourceMap(), GeneratedFile: jsFilePath, @@ -260,9 +254,11 @@ func (e *emitter) printSourceFile(jsFilePath string, sourceMapFilePath string, s // Write the source map if len(sourceMapFilePath) > 0 { sourceMap := sourceMapGenerator.String() - err := e.host.WriteFile(sourceMapFilePath, sourceMap, false /*writeByteOrderMark*/, sourceFiles, nil /*data*/) + err := e.host.WriteFile(sourceMapFilePath, sourceMap, false /*writeByteOrderMark*/) if err != nil { e.emitterDiagnostics.Add(ast.NewCompilerDiagnostic(diagnostics.Could_not_write_file_0_Colon_1, jsFilePath, err.Error())) + } else if e.emitResult.EmittedFiles != nil { + e.emitResult.EmittedFiles = append(e.emitResult.EmittedFiles, sourceMapFilePath) } } } else { @@ -271,15 +267,26 @@ func (e *emitter) printSourceFile(jsFilePath string, sourceMapFilePath string, s // Write the output file text := e.writer.String() - data := &printer.WriteFileData{SourceMapUrlPos: sourceMapUrlPos} // !!! transform diagnostics - err := e.host.WriteFile(jsFilePath, text, e.host.Options().EmitBOM.IsTrue(), sourceFiles, data) + var err error + var skippedDtsWrite bool + if e.writeFile == nil { + err = e.host.WriteFile(jsFilePath, text, e.host.Options().EmitBOM.IsTrue()) + } else { + data := &WriteFileData{ + SourceMapUrlPos: sourceMapUrlPos, + Diagnostics: e.emitterDiagnostics.GetDiagnostics(), + } + err = e.writeFile(jsFilePath, text, e.host.Options().EmitBOM.IsTrue(), data) + skippedDtsWrite = data.SkippedDtsWrite + } if err != nil { e.emitterDiagnostics.Add(ast.NewCompilerDiagnostic(diagnostics.Could_not_write_file_0_Colon_1, jsFilePath, err.Error())) + } else if e.emitResult.EmittedFiles != nil && !skippedDtsWrite { + e.emitResult.EmittedFiles = append(e.emitResult.EmittedFiles, jsFilePath) } // Reset state e.writer.Clear() - return !data.SkippedDtsWrite } func shouldEmitSourceMaps(mapOptions *core.CompilerOptions, sourceFile *ast.SourceFile) bool { @@ -462,3 +469,97 @@ func getDeclarationDiagnostics(host EmitHost, file *ast.SourceFile) []*ast.Diagn transform.TransformSourceFile(file) return transform.GetDiagnostics() } + +type AnyProgram interface { + Options() *core.CompilerOptions + GetSourceFiles() []*ast.SourceFile + GetConfigFileParsingDiagnostics() []*ast.Diagnostic + GetSyntacticDiagnostics(ctx context.Context, file *ast.SourceFile) []*ast.Diagnostic + GetBindDiagnostics(ctx context.Context, file *ast.SourceFile) []*ast.Diagnostic + GetOptionsDiagnostics(ctx context.Context) []*ast.Diagnostic + GetProgramDiagnostics() []*ast.Diagnostic + GetGlobalDiagnostics(ctx context.Context) []*ast.Diagnostic + GetSemanticDiagnostics(ctx context.Context, file *ast.SourceFile) []*ast.Diagnostic + GetDeclarationDiagnostics(ctx context.Context, file *ast.SourceFile) []*ast.Diagnostic + Emit(ctx context.Context, options EmitOptions) *EmitResult +} + +func HandleNoEmitOptions(ctx context.Context, program AnyProgram, file *ast.SourceFile) *EmitResult { + options := program.Options() + if options.NoEmit.IsTrue() { + return &EmitResult{ + EmitSkipped: true, + } + } + + if !options.NoEmitOnError.IsTrue() { + return nil // No emit on error is not set, so we can proceed with emitting + } + + diagnostics := GetDiagnosticsOfAnyProgram(ctx, program, file, true, func(name string, start bool, nameStart time.Time) time.Time { return time.Time{} }) + if len(diagnostics) == 0 { + return nil // No diagnostics, so we can proceed with emitting + } + return &EmitResult{ + Diagnostics: diagnostics, + EmitSkipped: true, + } +} + +func GetDiagnosticsOfAnyProgram( + ctx context.Context, + program AnyProgram, + file *ast.SourceFile, + skipNoEmitCheckForDtsDiagnostics bool, + recordTime func(name string, start bool, nameStart time.Time) time.Time, +) []*ast.Diagnostic { + allDiagnostics := slices.Clip(program.GetConfigFileParsingDiagnostics()) + configFileParsingDiagnosticsLength := len(allDiagnostics) + + allDiagnostics = append(allDiagnostics, program.GetSyntacticDiagnostics(ctx, file)...) + allDiagnostics = append(allDiagnostics, program.GetProgramDiagnostics()...) + + if len(allDiagnostics) == configFileParsingDiagnosticsLength { + // Options diagnostics include global diagnostics (even though we collect them separately), + // and global diagnostics create checkers, which then bind all of the files. Do this binding + // early so we can track the time. + bindStart := recordTime("bind", true, time.Time{}) + _ = program.GetBindDiagnostics(ctx, file) + recordTime("bind", false, bindStart) + + allDiagnostics = append(allDiagnostics, program.GetOptionsDiagnostics(ctx)...) + + if program.Options().ListFilesOnly.IsFalseOrUnknown() { + allDiagnostics = append(allDiagnostics, program.GetGlobalDiagnostics(ctx)...) + + if len(allDiagnostics) == configFileParsingDiagnosticsLength { + // !!! add program diagnostics here instead of merging with the semantic diagnostics for better api usage with with incremental and + checkStart := recordTime("check", true, time.Time{}) + allDiagnostics = append(allDiagnostics, program.GetSemanticDiagnostics(ctx, file)...) + recordTime("check", false, checkStart) + } + + if (skipNoEmitCheckForDtsDiagnostics || program.Options().NoEmit.IsTrue()) && program.Options().GetEmitDeclarations() && len(allDiagnostics) == configFileParsingDiagnosticsLength { + allDiagnostics = append(allDiagnostics, program.GetDeclarationDiagnostics(ctx, file)...) + } + } + } + return allDiagnostics +} + +func CombineEmitResults(results []*EmitResult) *EmitResult { + result := &EmitResult{} + for _, emitter := range results { + if emitter.EmitSkipped { + result.EmitSkipped = true + } + result.Diagnostics = append(result.Diagnostics, emitter.Diagnostics...) + if emitter.EmittedFiles != nil { + result.EmittedFiles = append(result.EmittedFiles, emitter.EmittedFiles...) + } + if emitter.SourceMaps != nil { + result.SourceMaps = append(result.SourceMaps, emitter.SourceMaps...) + } + } + return result +} diff --git a/internal/compiler/program.go b/internal/compiler/program.go index 25607fdb62..0f673dfc5e 100644 --- a/internal/compiler/program.go +++ b/internal/compiler/program.go @@ -114,6 +114,10 @@ func (p *Program) GetRedirectForResolution(file ast.HasFileName) *tsoptions.Pars return p.projectReferenceFileMapper.getRedirectForResolution(file) } +func (p *Program) GetParseFileRedirect(fileName string) string { + return p.projectReferenceFileMapper.getParseFileRedirect(ast.NewHasFileName(fileName, tspath.ToPath(fileName, p.GetCurrentDirectory(), p.UseCaseSensitiveFileNames()))) +} + func (p *Program) ForEachResolvedProjectReference( fn func(path tspath.Path, config *tsoptions.ParsedCommandLine), ) { @@ -375,9 +379,18 @@ func (p *Program) getBindDiagnosticsForFile(ctx context.Context, sourceFile *ast return sourceFile.BindDiagnostics() } +func FilterNoEmitSemanticDiagnostics(diagnostics []*ast.Diagnostic, options *core.CompilerOptions) []*ast.Diagnostic { + if !options.NoEmit.IsTrue() { + return diagnostics + } + return core.Filter(diagnostics, func(d *ast.Diagnostic) bool { + return !d.SkippedOnNoEmit() + }) +} + func (p *Program) getSemanticDiagnosticsForFile(ctx context.Context, sourceFile *ast.SourceFile) []*ast.Diagnostic { compilerOptions := p.Options() - if checker.SkipTypeChecking(sourceFile, compilerOptions, p) { + if checker.SkipTypeChecking(sourceFile, compilerOptions, p, false) { return nil } @@ -408,13 +421,13 @@ func (p *Program) getSemanticDiagnosticsForFile(ctx context.Context, sourceFile isPlainJS := ast.IsPlainJSFile(sourceFile, compilerOptions.CheckJs) if isPlainJS { - return core.Filter(diags, func(d *ast.Diagnostic) bool { + return FilterNoEmitSemanticDiagnostics(core.Filter(diags, func(d *ast.Diagnostic) bool { return plainJSErrors.Has(d.Code()) - }) + }), p.Options()) } if len(sourceFile.CommentDirectives) == 0 { - return diags + return FilterNoEmitSemanticDiagnostics(diags, p.Options()) } // Build map of directives by line number directivesByLine := make(map[int]ast.CommentDirective) @@ -451,7 +464,7 @@ func (p *Program) getSemanticDiagnosticsForFile(ctx context.Context, sourceFile filtered = append(filtered, ast.NewDiagnostic(sourceFile, directive.Loc, diagnostics.Unused_ts_expect_error_directive)) } } - return filtered + return FilterNoEmitSemanticDiagnostics(filtered, p.Options()) } func (p *Program) getDeclarationDiagnosticsForFile(ctx context.Context, sourceFile *ast.SourceFile) []*ast.Diagnostic { @@ -471,7 +484,7 @@ func (p *Program) getDeclarationDiagnosticsForFile(ctx context.Context, sourceFi } func (p *Program) getSuggestionDiagnosticsForFile(ctx context.Context, sourceFile *ast.SourceFile) []*ast.Diagnostic { - if checker.SkipTypeChecking(sourceFile, p.Options(), p) { + if checker.SkipTypeChecking(sourceFile, p.Options(), p, false) { return nil } @@ -671,9 +684,18 @@ func (p *Program) CommonSourceDirectory() string { return p.commonSourceDirectory } +type WriteFileData struct { + SourceMapUrlPos int + BuildInfo any + Diagnostics []*ast.Diagnostic + DiffersOnlyInMap bool + SkippedDtsWrite bool +} + type EmitOptions struct { TargetSourceFile *ast.SourceFile // Single file to emit. If `nil`, emits all files - forceDtsEmit bool + EmitOnly EmitOnly + WriteFile func(fileName string, text string, writeByteOrderMark bool, data *WriteFileData) error } type EmitResult struct { @@ -689,9 +711,20 @@ type SourceMapEmitResult struct { GeneratedFile string } -func (p *Program) Emit(options EmitOptions) *EmitResult { +func (p *Program) Emit(ctx context.Context, options EmitOptions) *EmitResult { // !!! performance measurement p.BindSourceFiles() + if options.EmitOnly != EmitOnlyForcedDts { + result := HandleNoEmitOptions( + ctx, + p, + options.TargetSourceFile, + ) + if result != nil { + return result + } + context.TODO() + } writerPool := &sync.Pool{ New: func() any { @@ -700,18 +733,18 @@ func (p *Program) Emit(options EmitOptions) *EmitResult { } wg := core.NewWorkGroup(p.singleThreaded()) var emitters []*emitter - sourceFiles := getSourceFilesToEmit(p, options.TargetSourceFile, options.forceDtsEmit) + sourceFiles := getSourceFilesToEmit(p, options.TargetSourceFile, options.EmitOnly == EmitOnlyForcedDts) for _, sourceFile := range sourceFiles { emitter := &emitter{ - emittedFilesList: nil, - sourceMapDataList: nil, - writer: nil, - sourceFile: sourceFile, + writer: nil, + sourceFile: sourceFile, + emitOnly: options.EmitOnly, + writeFile: options.WriteFile, } emitters = append(emitters, emitter) wg.Queue(func() { - host, done := newEmitHost(context.TODO(), p, sourceFile) + host, done := newEmitHost(ctx, p, sourceFile) defer done() emitter.host = host @@ -721,7 +754,7 @@ func (p *Program) Emit(options EmitOptions) *EmitResult { // attach writer and perform emit emitter.writer = writer - emitter.paths = outputpaths.GetOutputPathsFor(sourceFile, host.Options(), host, options.forceDtsEmit) + emitter.paths = outputpaths.GetOutputPathsFor(sourceFile, host.Options(), host, options.EmitOnly == EmitOnlyForcedDts) emitter.emit() emitter.writer = nil @@ -734,20 +767,9 @@ func (p *Program) Emit(options EmitOptions) *EmitResult { wg.RunAndWait() // collect results from emit, preserving input order - result := &EmitResult{} - for _, emitter := range emitters { - if emitter.emitSkipped { - result.EmitSkipped = true - } - result.Diagnostics = append(result.Diagnostics, emitter.emitterDiagnostics.GetDiagnostics()...) - if emitter.emittedFilesList != nil { - result.EmittedFiles = append(result.EmittedFiles, emitter.emittedFilesList...) - } - if emitter.sourceMapDataList != nil { - result.SourceMaps = append(result.SourceMaps, emitter.sourceMapDataList...) - } - } - return result + return CombineEmitResults(core.Map(emitters, func(e *emitter) *EmitResult { + return &e.emitResult + })) } func (p *Program) GetSourceFile(filename string) *ast.SourceFile { @@ -758,7 +780,7 @@ func (p *Program) GetSourceFile(filename string) *ast.SourceFile { func (p *Program) GetSourceFileForResolvedModule(fileName string) *ast.SourceFile { file := p.GetSourceFile(fileName) if file == nil { - filename := p.projectReferenceFileMapper.getParseFileRedirect(ast.NewHasFileName(fileName, tspath.ToPath(fileName, p.GetCurrentDirectory(), p.UseCaseSensitiveFileNames()))) + filename := p.GetParseFileRedirect(fileName) if filename != "" { return p.GetSourceFile(filename) } @@ -846,7 +868,7 @@ func (p *Program) GetImportHelpersImportSpecifier(path tspath.Path) *ast.Node { } func (p *Program) SourceFileMayBeEmitted(sourceFile *ast.SourceFile, forceDtsEmit bool) bool { - return sourceFileMayBeEmitted(sourceFile, &emitHost{program: p}, forceDtsEmit) + return sourceFileMayBeEmitted(sourceFile, p, forceDtsEmit) } var plainJSErrors = collections.NewSetFromItems( diff --git a/internal/execute/tsc.go b/internal/execute/tsc.go index 50878530e2..ab3c797161 100644 --- a/internal/execute/tsc.go +++ b/internal/execute/tsc.go @@ -5,7 +5,6 @@ import ( "encoding/json" "fmt" "runtime" - "slices" "strings" "time" @@ -15,6 +14,7 @@ import ( "github.com/microsoft/typescript-go/internal/core" "github.com/microsoft/typescript-go/internal/diagnostics" "github.com/microsoft/typescript-go/internal/format" + "github.com/microsoft/typescript-go/internal/incremental" "github.com/microsoft/typescript-go/internal/parser" "github.com/microsoft/typescript-go/internal/pprof" "github.com/microsoft/typescript-go/internal/tsoptions" @@ -231,8 +231,26 @@ func performIncrementalCompilation( extendedConfigCache *collections.SyncMap[tspath.Path, *tsoptions.ExtendedConfigCacheEntry], configTime time.Duration, ) ExitStatus { - // !! - return performCompilation(sys, config, reportDiagnostic, extendedConfigCache, configTime) + host := compiler.NewCachedFSCompilerHost(config.CompilerOptions(), sys.GetCurrentDirectory(), sys.FS(), sys.DefaultLibraryPath(), extendedConfigCache) + oldProgram := incremental.ReadBuildInfoProgram(config, incremental.NewBuildInfoReader(host)) + // todo: cache, statistics, tracing + parseStart := sys.Now() + program := compiler.NewProgram(compiler.ProgramOptions{ + Config: config, + Host: host, + JSDocParsingMode: ast.JSDocParsingModeParseForTypeErrors, + }) + parseTime := sys.Now().Sub(parseStart) + incrementalProgram := incremental.NewProgram(program, oldProgram) + return emitAndReportStatistics( + sys, + incrementalProgram, + incrementalProgram.GetProgram, + config, + reportDiagnostic, + configTime, + parseTime, + ) } func performCompilation( @@ -251,7 +269,28 @@ func performCompilation( JSDocParsingMode: ast.JSDocParsingModeParseForTypeErrors, }) parseTime := sys.Now().Sub(parseStart) + return emitAndReportStatistics( + sys, + program, + func() *compiler.Program { + return program + }, + config, + reportDiagnostic, + configTime, + parseTime, + ) +} +func emitAndReportStatistics( + sys System, + program compiler.AnyProgram, + getCoreProgram func() *compiler.Program, + config *tsoptions.ParsedCommandLine, + reportDiagnostic diagnosticReporter, + configTime time.Duration, + parseTime time.Duration, +) ExitStatus { result := emitFilesAndReportErrors(sys, program, reportDiagnostic) if result.status != ExitStatusSuccess { // compile exited early @@ -269,7 +308,7 @@ func performCompilation( runtime.GC() runtime.ReadMemStats(&memStats) - reportStatistics(sys, program, result, &memStats) + reportStatistics(sys, getCoreProgram(), result, &memStats) } if result.emitResult.EmitSkipped && len(result.diagnostics) > 0 { @@ -292,44 +331,35 @@ type compileAndEmitResult struct { emitTime time.Duration } -func emitFilesAndReportErrors(sys System, program *compiler.Program, reportDiagnostic diagnosticReporter) (result compileAndEmitResult) { +func emitFilesAndReportErrors( + sys System, + program compiler.AnyProgram, + reportDiagnostic diagnosticReporter, +) (result compileAndEmitResult) { ctx := context.Background() - options := program.Options() - allDiagnostics := slices.Clip(program.GetConfigFileParsingDiagnostics()) - configFileParsingDiagnosticsLength := len(allDiagnostics) - allDiagnostics = append(allDiagnostics, program.GetSyntacticDiagnostics(ctx, nil)...) - allDiagnostics = append(allDiagnostics, program.GetProgramDiagnostics()...) - - if len(allDiagnostics) == configFileParsingDiagnosticsLength { - // Options diagnostics include global diagnostics (even though we collect them separately), - // and global diagnostics create checkers, which then bind all of the files. Do this binding - // early so we can track the time. - bindStart := sys.Now() - _ = program.GetBindDiagnostics(ctx, nil) - result.bindTime = sys.Now().Sub(bindStart) - - allDiagnostics = append(allDiagnostics, program.GetOptionsDiagnostics(ctx)...) - - if options.ListFilesOnly.IsFalseOrUnknown() { - allDiagnostics = append(allDiagnostics, program.GetGlobalDiagnostics(ctx)...) - - if len(allDiagnostics) == configFileParsingDiagnosticsLength { - checkStart := sys.Now() - allDiagnostics = append(allDiagnostics, program.GetSemanticDiagnostics(ctx, nil)...) - result.checkTime = sys.Now().Sub(checkStart) + allDiagnostics := compiler.GetDiagnosticsOfAnyProgram( + ctx, + program, + nil, + false, + func(name string, start bool, startTime time.Time) time.Time { + if !start { + switch name { + case "bind": + result.bindTime = sys.Now().Sub(startTime) + case "check": + result.checkTime = sys.Now().Sub(startTime) + } } - - if options.NoEmit.IsTrue() && options.GetEmitDeclarations() && len(allDiagnostics) == configFileParsingDiagnosticsLength { - allDiagnostics = append(allDiagnostics, program.GetDeclarationDiagnostics(ctx, nil)...) - } - } - } + return sys.Now() + }, + ) emitResult := &compiler.EmitResult{EmitSkipped: true, Diagnostics: []*ast.Diagnostic{}} - if !options.ListFilesOnly.IsTrue() { + if !program.Options().ListFilesOnly.IsTrue() { emitStart := sys.Now() - emitResult = program.Emit(compiler.EmitOptions{}) + emitResult = program.Emit(ctx, compiler.EmitOptions{}) result.emitTime = sys.Now().Sub(emitStart) } allDiagnostics = append(allDiagnostics, emitResult.Diagnostics...) @@ -364,7 +394,7 @@ func showConfig(sys System, config *core.CompilerOptions) { enc.Encode(config) //nolint:errcheck,errchkjson } -func listFiles(sys System, program *compiler.Program) { +func listFiles(sys System, program compiler.AnyProgram) { options := program.Options() // !!! explainFiles if options.ListFiles.IsTrue() || options.ListFilesOnly.IsTrue() { diff --git a/internal/incremental/buildInfo.go b/internal/incremental/buildInfo.go new file mode 100644 index 0000000000..72f7a0ad02 --- /dev/null +++ b/internal/incremental/buildInfo.go @@ -0,0 +1,619 @@ +package incremental + +import ( + "encoding/json" + "fmt" + + "github.com/microsoft/typescript-go/internal/ast" + "github.com/microsoft/typescript-go/internal/compiler" + "github.com/microsoft/typescript-go/internal/core" + "github.com/microsoft/typescript-go/internal/diagnostics" + "github.com/microsoft/typescript-go/internal/tspath" +) + +type ( + incrementalBuildInfoFileId int + incrementalBuildInfoFileIdListId int +) + +// /** +// * buildInfoRoot is +// * for incremental program buildinfo +// * - start and end of FileId for consecutive fileIds to be included as root +// * - single fileId that is root +// * for non incremental program buildinfo +// * - string that is the root file name +// */ +// type buildInfoRoot struct { +// incrementalStartEnd *[2]incrementalBuildInfoFileId +// incrementalSingle incrementalBuildInfoFileId +// nonIncremental string +// } + +// func (o buildInfoRoot) MarshalJSON() ([]byte, error) { +// if o.incrementalStartEnd != nil { +// return json.Marshal(o.incrementalStartEnd) +// } +// if o.incrementalSingle != 0 { +// return json.Marshal(o.incrementalSingle) +// } +// if o.nonIncremental != "" { +// return json.Marshal(o.nonIncremental) +// } +// panic("unknown BuildInfoRoot type") +// } + +// func (o *buildInfoRoot) UnmarshalJSON(data []byte) error { +// *o = buildInfoRoot{} +// var vIncrementalStartEnd [2]incrementalBuildInfoFileId +// if err := json.Unmarshal(data, &vIncrementalStartEnd); err == nil { +// o.incrementalStartEnd = &vIncrementalStartEnd +// return nil +// } +// var vIncrementalSingle incrementalBuildInfoFileId +// if err := json.Unmarshal(data, &vIncrementalSingle); err == nil { +// o.incrementalSingle = vIncrementalSingle +// return nil +// } +// var vNonIncremental string +// if err := json.Unmarshal(data, &vNonIncremental); err == nil { +// o.nonIncremental = vNonIncremental +// return nil +// } +// return fmt.Errorf("invalid BuildInfoRoot: %s", data) +// } + +/** +* - string if FileInfo.version === FileInfo.signature && !FileInfo.affectsGlobalScope +* - otherwise encoded FileInfo +* Signature is +* - undefined if FileInfo.version === FileInfo.signature +* - false if FileInfo has signature as undefined (not calculated) +* - string actual signature + */ +func (f *fileInfo) MarshalJSON() ([]byte, error) { + if f.version == f.signature && !f.affectsGlobalScope && f.impliedNodeFormat == core.ResolutionModeNone { + return json.Marshal(f.version) + } + info := map[string]any{} + if f.version != "" { + info["version"] = f.version + } + if f.signature != f.version { + if f.signature == "" { + info["signature"] = false + } else { + info["signature"] = f.signature + } + } + if f.affectsGlobalScope { + info["affectsGlobalScope"] = f.affectsGlobalScope + } + if f.impliedNodeFormat != core.ResolutionModeNone { + info["impliedNodeFormat"] = f.impliedNodeFormat + } + return json.Marshal(info) +} + +func (f *fileInfo) UnmarshalJSON(data []byte) error { + var version string + if err := json.Unmarshal(data, &version); err == nil { + *f = fileInfo{ + version: version, + signature: version, + } + return nil + } + + var vFileInfo map[string]any + if err := json.Unmarshal(data, &vFileInfo); err != nil { + return fmt.Errorf("invalid fileInfo: %s", data) + } + + *f = fileInfo{} + if version, ok := vFileInfo["version"]; ok { + f.version = version.(string) + } + if signature, ok := vFileInfo["signature"]; ok { + if signature == false { + f.signature = "" + } else if f.signature, ok = signature.(string); !ok { + return fmt.Errorf("invalid signature in fileInfo: expected string or false, got %T", signature) + } + } else { + f.signature = f.version // default to version if no signature provided + } + if affectsGlobalScope, ok := vFileInfo["affectsGlobalScope"]; ok { + if f.affectsGlobalScope, ok = affectsGlobalScope.(bool); !ok { + return fmt.Errorf("invalid affectsGlobalScope in fileInfo: expected bool, got %T", affectsGlobalScope) + } + } + if impliedNodeFormatV, ok := vFileInfo["impliedNodeFormat"]; ok { + if impliedNodeFormat, ok := impliedNodeFormatV.(int); ok { + if impliedNodeFormat != int(core.ResolutionModeCommonJS) && impliedNodeFormat != int(core.ResolutionModeESM) { + return fmt.Errorf("invalid impliedNodeFormat in fileInfo: %d is out of range", impliedNodeFormat) + } + f.impliedNodeFormat = core.ResolutionMode(impliedNodeFormat) + } else { + return fmt.Errorf("invalid impliedNodeFormat in fileInfo: expected int, got %T", impliedNodeFormatV) + } + } + return nil +} + +type incrementalBuildInfoCompilerOption struct { + name string + value any +} + +func (i *incrementalBuildInfoCompilerOption) MarshalJSON() ([]byte, error) { + nameAndValue := make([]any, 2) + nameAndValue[0] = i.name + nameAndValue[1] = i.value + return json.Marshal(nameAndValue) +} + +func (i *incrementalBuildInfoCompilerOption) UnmarshalJSON(data []byte) error { + var nameAndValue []any + if err := json.Unmarshal(data, &nameAndValue); err != nil { + return err + } + if len(nameAndValue) != 2 { + return fmt.Errorf("invalid incrementalBuildInfoCompilerOption: expected array of length 2, got %d", len(nameAndValue)) + } + if name, ok := nameAndValue[0].(string); ok { + *i = incrementalBuildInfoCompilerOption{} + i.name = name + i.value = nameAndValue[1] + return nil + } + return fmt.Errorf("invalid name in incrementalBuildInfoCompilerOption: expected string, got %T", nameAndValue[0]) +} + +type incrementalBuildInfoReferenceMapEntry struct { + fileId incrementalBuildInfoFileId + fileIdListId incrementalBuildInfoFileIdListId +} + +func (i *incrementalBuildInfoReferenceMapEntry) MarshalJSON() ([]byte, error) { + return json.Marshal([2]int{int(i.fileId), int(i.fileIdListId)}) +} + +func (i *incrementalBuildInfoReferenceMapEntry) UnmarshalJSON(data []byte) error { + var v *[2]int + if err := json.Unmarshal(data, &v); err != nil { + return err + } + *i = incrementalBuildInfoReferenceMapEntry{ + fileId: incrementalBuildInfoFileId(v[0]), + fileIdListId: incrementalBuildInfoFileIdListId(v[1]), + } + return nil +} + +type incrementalBuildInfoDiagnostic struct { + // false if diagnostic is not for a file, + // incrementalBuildInfoFileId if it is for a file thats other than its stored for + file any + loc core.TextRange + code int32 + category diagnostics.Category + message string + messageChain []*incrementalBuildInfoDiagnostic + relatedInformation []*incrementalBuildInfoDiagnostic + reportsUnnecessary bool + reportsDeprecated bool + skippedOnNoEmit bool +} + +func (i *incrementalBuildInfoDiagnostic) toDiagnostic(p *compiler.Program, file *ast.SourceFile) *ast.Diagnostic { + var fileForDiagnostic *ast.SourceFile + if i.file != false { + if i.file == nil { + fileForDiagnostic = file + } else { + fileForDiagnostic = p.GetSourceFileByPath(tspath.Path(i.file.(string))) + } + } + var messageChain []*ast.Diagnostic + for _, msg := range i.messageChain { + messageChain = append(messageChain, msg.toDiagnostic(p, fileForDiagnostic)) + } + var relatedInformation []*ast.Diagnostic + for _, info := range i.relatedInformation { + relatedInformation = append(relatedInformation, info.toDiagnostic(p, fileForDiagnostic)) + } + return ast.NewDiagnosticWith( + fileForDiagnostic, + i.loc, + i.code, + i.category, + i.message, + messageChain, + relatedInformation, + i.reportsUnnecessary, + i.reportsDeprecated, + i.skippedOnNoEmit, + ) +} + +func (i *incrementalBuildInfoDiagnostic) MarshalJSON() ([]byte, error) { + info := map[string]any{} + if i.file != "" { + info["file"] = i.file + info["pos"] = i.loc.Pos() + info["end"] = i.loc.End() + } + info["code"] = i.code + info["category"] = i.category + info["message"] = i.message + if len(i.messageChain) > 0 { + info["messageChain"] = i.messageChain + } + if len(i.relatedInformation) > 0 { + info["relatedInformation"] = i.relatedInformation + } + if i.reportsUnnecessary { + info["reportsUnnecessary"] = i.reportsUnnecessary + } + if i.reportsDeprecated { + info["reportsDeprecated"] = i.reportsDeprecated + } + if i.skippedOnNoEmit { + info["skippedOnNoEmit"] = i.skippedOnNoEmit + } + return json.Marshal(info) +} + +func (i *incrementalBuildInfoDiagnostic) UnmarshalJSON(data []byte) error { + var vIncrementalBuildInfoDiagnostic map[string]any + if err := json.Unmarshal(data, &vIncrementalBuildInfoDiagnostic); err != nil { + return fmt.Errorf("invalid incrementalBuildInfoDiagnostic: %s", data) + } + + *i = incrementalBuildInfoDiagnostic{} + if file, ok := vIncrementalBuildInfoDiagnostic["file"]; ok { + if _, ok := file.(float64); !ok { + if value, ok := file.(bool); !ok || value { + return fmt.Errorf("invalid file in incrementalBuildInfoDiagnostic: expected false or float64, got %T", file) + } + } + i.file = file + var pos float64 + posV, ok := vIncrementalBuildInfoDiagnostic["pos"] + if ok { + pos, ok = posV.(float64) + if !ok { + return fmt.Errorf("invalid pos in incrementalBuildInfoDiagnostic: expected float64, got %T", posV) + } + } else { + return fmt.Errorf("missing pos in incrementalBuildInfoDiagnostic") + } + var end float64 + endv, ok := vIncrementalBuildInfoDiagnostic["end"] + if ok { + end, ok = endv.(float64) + if !ok { + return fmt.Errorf("invalid end in incrementalBuildInfoDiagnostic: expected float64, got %T", endv) + } + } else { + return fmt.Errorf("missing end in incrementalBuildInfoDiagnostic") + } + i.loc = core.NewTextRange(int(pos), int(end)) + } + if codeV, ok := vIncrementalBuildInfoDiagnostic["code"]; ok { + code, ok := codeV.(float64) + if !ok { + return fmt.Errorf("invalid code in incrementalBuildInfoDiagnostic: expected float64, got %T", codeV) + } + i.code = int32(code) + } else { + return fmt.Errorf("missing code in incrementalBuildInfoDiagnostic") + } + if categoryV, ok := vIncrementalBuildInfoDiagnostic["category"]; ok { + category, ok := categoryV.(float64) + if !ok { + return fmt.Errorf("invalid category in incrementalBuildInfoDiagnostic: expected float64, got %T", categoryV) + } + if category < 0 || category > float64(diagnostics.CategoryMessage) { + return fmt.Errorf("invalid category in incrementalBuildInfoDiagnostic: %f is out of range", category) + } + i.category = diagnostics.Category(category) + } else { + return fmt.Errorf("missing category in incrementalBuildInfoDiagnostic") + } + if messageV, ok := vIncrementalBuildInfoDiagnostic["message"]; ok { + if i.message, ok = messageV.(string); !ok { + return fmt.Errorf("invalid message in incrementalBuildInfoDiagnostic: expected string, got %T", messageV) + } + } else { + return fmt.Errorf("missing message in incrementalBuildInfoDiagnostic") + } + if messageChain, ok := vIncrementalBuildInfoDiagnostic["messageChain"]; ok { + if messages, ok := messageChain.([]any); ok { + i.messageChain = make([]*incrementalBuildInfoDiagnostic, len(messages)) + for _, msg := range messages { + var diagnostic incrementalBuildInfoDiagnostic + if err := json.Unmarshal([]byte(msg.(string)), &diagnostic); err != nil { + return fmt.Errorf("invalid messageChain in incrementalBuildInfoDiagnostic: %s", msg) + } + i.messageChain = append(i.messageChain, &diagnostic) + } + } + } + if relatedInformation, ok := vIncrementalBuildInfoDiagnostic["relatedInformation"]; ok { + if infos, ok := relatedInformation.([]any); ok { + i.relatedInformation = make([]*incrementalBuildInfoDiagnostic, len(infos)) + for _, info := range infos { + var diagnostic incrementalBuildInfoDiagnostic + if err := json.Unmarshal([]byte(info.(string)), &diagnostic); err != nil { + return fmt.Errorf("invalid relatedInformation in incrementalBuildInfoDiagnostic: %s", info) + } + i.relatedInformation = append(i.relatedInformation, &diagnostic) + } + } + } + if reportsUnnecessary, ok := vIncrementalBuildInfoDiagnostic["reportsUnnecessary"]; ok { + if i.reportsUnnecessary, ok = reportsUnnecessary.(bool); !ok { + return fmt.Errorf("invalid reportsUnnecessary in incrementalBuildInfoDiagnostic: expected boolean, got %T", reportsUnnecessary) + } + } + if reportsDeprecated, ok := vIncrementalBuildInfoDiagnostic["reportsDeprecated"]; ok { + if i.reportsDeprecated, ok = reportsDeprecated.(bool); !ok { + return fmt.Errorf("invalid reportsDeprecated in incrementalBuildInfoDiagnostic: expected boolean, got %T", reportsDeprecated) + } + } + if skippedOnNoEmit, ok := vIncrementalBuildInfoDiagnostic["skippedOnNoEmit"]; ok { + if i.skippedOnNoEmit, ok = skippedOnNoEmit.(bool); !ok { + return fmt.Errorf("invalid skippedOnNoEmit in incrementalBuildInfoDiagnostic: expected boolean, got %T", skippedOnNoEmit) + } + } + return nil +} + +type incrementalBuildInfoDiagnosticOfFile struct { + fileId incrementalBuildInfoFileId + diagnostics []*incrementalBuildInfoDiagnostic +} + +func (i *incrementalBuildInfoDiagnosticOfFile) MarshalJSON() ([]byte, error) { + fileIdAndDiagnostics := make([]any, 0, 2) + fileIdAndDiagnostics = append(fileIdAndDiagnostics, i.fileId) + fileIdAndDiagnostics = append(fileIdAndDiagnostics, i.diagnostics) + return json.Marshal(fileIdAndDiagnostics) +} + +func (i *incrementalBuildInfoDiagnosticOfFile) UnmarshalJSON(data []byte) error { + var fileIdAndDiagnostics []any + if err := json.Unmarshal(data, &fileIdAndDiagnostics); err != nil { + return fmt.Errorf("invalid IncrementalBuildInfoDiagnostic: %s", data) + } + if len(fileIdAndDiagnostics) != 2 { + return fmt.Errorf("invalid IncrementalBuildInfoDiagnostic: expected 2 elements, got %d", len(fileIdAndDiagnostics)) + } + var fileId incrementalBuildInfoFileId + if fileIdV, ok := fileIdAndDiagnostics[0].(float64); !ok { + return fmt.Errorf("invalid fileId in IncrementalBuildInfoDiagnostic: expected float64, got %T", fileIdAndDiagnostics[0]) + } else { + fileId = incrementalBuildInfoFileId(fileIdV) + } + if diagnostics, ok := fileIdAndDiagnostics[1].([]*incrementalBuildInfoDiagnostic); ok { + *i = incrementalBuildInfoDiagnosticOfFile{ + fileId: fileId, + diagnostics: diagnostics, + } + return nil + } + return fmt.Errorf("invalid diagnostics in IncrementalBuildInfoDiagnostic: expected []*incrementalBuildInfoDiagnostic, got %T", fileIdAndDiagnostics[1]) +} + +type incrementalBuildInfoSemanticDiagnostic struct { + fileId incrementalBuildInfoFileId // File is not in changedSet and still doesnt have cached diagnostics + diagnostic incrementalBuildInfoDiagnosticOfFile // Diagnostics for file +} + +func (i *incrementalBuildInfoSemanticDiagnostic) MarshalJSON() ([]byte, error) { + if i.fileId != 0 { + return json.Marshal(i.fileId) + } + return json.Marshal(i.diagnostic) +} + +func (i *incrementalBuildInfoSemanticDiagnostic) UnmarshalJSON(data []byte) error { + var fileId incrementalBuildInfoFileId + if err := json.Unmarshal(data, &fileId); err == nil { + *i = incrementalBuildInfoSemanticDiagnostic{ + fileId: fileId, + } + return nil + } + var diagnostic incrementalBuildInfoDiagnosticOfFile + if err := json.Unmarshal(data, &diagnostic); err == nil { + *i = incrementalBuildInfoSemanticDiagnostic{ + diagnostic: diagnostic, + } + return nil + } + return fmt.Errorf("invalid IncrementalBuildInfoDiagnostic: %s", data) +} + +/** + * fileId if pending emit is same as what compilerOptions suggest + * [fileId] if pending emit is only dts file emit + * [fileId, emitKind] if any other type emit is pending + */ +type incrementalBuildInfoFilePendingEmit struct { + fileId incrementalBuildInfoFileId + emitKind fileEmitKind +} + +func (i *incrementalBuildInfoFilePendingEmit) MarshalJSON() ([]byte, error) { + if i.emitKind == 0 { + return json.Marshal(i.fileId) + } + if i.emitKind == fileEmitKindDts { + fileListIds := []incrementalBuildInfoFileId{i.fileId} + return json.Marshal(fileListIds) + } + fileAndEmitKind := []int{int(i.fileId), int(i.emitKind)} + return json.Marshal(fileAndEmitKind) +} + +func (i *incrementalBuildInfoFilePendingEmit) UnmarshalJSON(data []byte) error { + var fileId incrementalBuildInfoFileId + if err := json.Unmarshal(data, &fileId); err == nil { + *i = incrementalBuildInfoFilePendingEmit{ + fileId: fileId, + } + return nil + } + var intTuple []int + if err := json.Unmarshal(data, &intTuple); err == nil { + if len(intTuple) == 1 { + *i = incrementalBuildInfoFilePendingEmit{ + fileId: incrementalBuildInfoFileId(intTuple[0]), + emitKind: fileEmitKindDts, + } + return nil + } else if len(intTuple) == 2 { + *i = incrementalBuildInfoFilePendingEmit{ + fileId: incrementalBuildInfoFileId(intTuple[0]), + emitKind: fileEmitKind(intTuple[1]), + } + return nil + } + return fmt.Errorf("invalid incrementalBuildInfoFilePendingEmit: expected 1 or 2 integers, got %d", len(intTuple)) + } + return fmt.Errorf("invalid IncrementalBuildInfoDiagnostic: %s", data) +} + +/** + * [fileId, signature] if different from file's signature + * fileId if file wasnt emitted + */ +type incrementalBuildInfoEmitSignature struct { + fileId incrementalBuildInfoFileId + // Signature if it is different from file's signature + signature string + differsOnlyInDtsMap bool // true if signature is different only in dtsMap value + differsInOptions bool // true if signature is different in options used to emit file +} + +func (i *incrementalBuildInfoEmitSignature) noEmitSignature() bool { + return i.signature == "" && !i.differsOnlyInDtsMap && !i.differsInOptions +} + +func (i *incrementalBuildInfoEmitSignature) toEmitSignature(path tspath.Path, emitSignatures map[tspath.Path]*emitSignature) *emitSignature { + var signature string + var signatureWithDifferentOptions []string + if i.differsOnlyInDtsMap { + signatureWithDifferentOptions = make([]string, 0, 1) + signatureWithDifferentOptions = append(signatureWithDifferentOptions, emitSignatures[path].signature) + } else if i.differsInOptions { + signatureWithDifferentOptions = make([]string, 0, 1) + signatureWithDifferentOptions = append(signatureWithDifferentOptions, i.signature) + } else { + signature = i.signature + } + return &emitSignature{ + signature: signature, + signatureWithDifferentOptions: signatureWithDifferentOptions, + } +} + +func (i *incrementalBuildInfoEmitSignature) MarshalJSON() ([]byte, error) { + if i.noEmitSignature() { + return json.Marshal(i.fileId) + } + fileIdAndSignature := make([]any, 2) + fileIdAndSignature[0] = i.fileId + var signature any + if i.differsOnlyInDtsMap { + signature = []string{} + } else if i.differsInOptions { + signature = []string{i.signature} + } else { + signature = i.signature + } + fileIdAndSignature[1] = signature + return json.Marshal(fileIdAndSignature) +} + +func (i *incrementalBuildInfoEmitSignature) UnmarshalJSON(data []byte) error { + var fileId incrementalBuildInfoFileId + if err := json.Unmarshal(data, &fileId); err == nil { + *i = incrementalBuildInfoEmitSignature{ + fileId: fileId, + } + return nil + } + var fileIdAndSignature []any + if err := json.Unmarshal(data, &fileIdAndSignature); err == nil { + if len(fileIdAndSignature) == 2 { + var fileId incrementalBuildInfoFileId + if id, ok := fileIdAndSignature[0].(float64); ok { + fileId = incrementalBuildInfoFileId(id) + } else { + return fmt.Errorf("invalid fileId in incrementalBuildInfoEmitSignature: expected float64, got %T", fileIdAndSignature[0]) + } + var signature string + var differsOnlyInDtsMap, differsInOptions bool + if signatureV, ok := fileIdAndSignature[1].(string); !ok { + if signatureList, ok := fileIdAndSignature[1].([]string); ok { + if len(signatureList) == 0 { + differsOnlyInDtsMap = true + } else if len(signatureList) == 1 { + signature = signatureList[0] + differsInOptions = true + } else { + return fmt.Errorf("invalid signature in incrementalBuildInfoEmitSignature: expected string or []string with 0 or 1 element, got %d elements", len(signatureList)) + } + } else { + return fmt.Errorf("invalid signature in incrementalBuildInfoEmitSignature: expected string or []string, got %T", fileIdAndSignature[1]) + } + } else { + signature = signatureV + } + *i = incrementalBuildInfoEmitSignature{ + fileId: fileId, + signature: signature, + differsOnlyInDtsMap: differsOnlyInDtsMap, + differsInOptions: differsInOptions, + } + return nil + } + return fmt.Errorf("invalid incrementalBuildInfoEmitSignature: expected 2 elements, got %d", len(fileIdAndSignature)) + } + return fmt.Errorf("invalid IncrementalBuildInfoDiagnostic: %s", data) +} + +type BuildInfo struct { + Version string + + // Common between incremental and tsc -b buildinfo for non incremental programs + Errors bool `json:"errors,omitzero"` + CheckPending bool `json:"checkPending,omitzero"` + // Root []BuildInfoRoot `json:"root,omitempty,omitzero"` + + // IncrementalProgram info + FileNames []string `json:"fileNames,omitzero"` + FileInfos []*fileInfo `json:"fileInfos,omitzero"` + FileIdsList [][]incrementalBuildInfoFileId `json:"fileIdsList,omitzero"` + Options []incrementalBuildInfoCompilerOption `json:"options,omitzero"` + ReferencedMap []incrementalBuildInfoReferenceMapEntry `json:"referencedMap,omitzero"` + SemanticDiagnosticsPerFile []incrementalBuildInfoSemanticDiagnostic `json:"semanticDiagnosticsPerFile,omitzero"` + EmitDiagnosticsPerFile []incrementalBuildInfoDiagnosticOfFile `json:"emitDiagnosticsPerFile,omitzero"` + ChangeFileSet []incrementalBuildInfoFileId `json:"changeFileSet,omitzero"` + AffectedFilesPendingEmit []incrementalBuildInfoFilePendingEmit `json:"affectedFilesPendingEmit,omitzero"` + LatestChangedDtsFile string `json:"latestChangedDtsFile,omitzero"` // Because this is only output file in the program, we dont need fileId to deduplicate name + EmitSignatures []incrementalBuildInfoEmitSignature `json:"emitSignatures,omitzero"` + // resolvedRoot: readonly IncrementalBuildInfoResolvedRoot[] | undefined; +} + +func (b *BuildInfo) IsValidVersion() bool { + return b.Version == core.Version() +} + +func (b *BuildInfo) IsIncremental() bool { + return b != nil && len(b.FileNames) != 0 +} diff --git a/internal/incremental/incremental.go b/internal/incremental/incremental.go new file mode 100644 index 0000000000..7bb90b81eb --- /dev/null +++ b/internal/incremental/incremental.go @@ -0,0 +1,62 @@ +package incremental + +import ( + "encoding/json" + + "github.com/microsoft/typescript-go/internal/compiler" + "github.com/microsoft/typescript-go/internal/outputpaths" + "github.com/microsoft/typescript-go/internal/tsoptions" + "github.com/microsoft/typescript-go/internal/tspath" +) + +type BuildInfoReader interface { + ReadBuildInfo(buildInfoFileName string) *BuildInfo +} + +var _ BuildInfoReader = (*buildInfoReader)(nil) + +type buildInfoReader struct { + host compiler.CompilerHost +} + +func (r *buildInfoReader) ReadBuildInfo(buildInfoFileName string) *BuildInfo { + // Read build info file + data, ok := r.host.FS().ReadFile(buildInfoFileName) + if !ok { + return nil + } + var buildInfo BuildInfo + err := json.Unmarshal([]byte(data), &buildInfo) + if err != nil { + return nil + } + return &buildInfo +} + +func NewBuildInfoReader( + host compiler.CompilerHost, +) BuildInfoReader { + return &buildInfoReader{host: host} +} + +func ReadBuildInfoProgram(config *tsoptions.ParsedCommandLine, reader BuildInfoReader) *Program { + buildInfoFileName := outputpaths.GetBuildInfoFileName(config.CompilerOptions(), tspath.ComparePathsOptions{ + CurrentDirectory: config.GetCurrentDirectory(), + UseCaseSensitiveFileNames: config.UseCaseSensitiveFileNames(), + }) + if buildInfoFileName == "" { + return nil + } + + // Read buildinFo file + buildInfo := reader.ReadBuildInfo(buildInfoFileName) + if buildInfo == nil || !buildInfo.IsValidVersion() || !buildInfo.IsIncremental() { + return nil + } + + // Convert to information that can be used to create incremental program + incrementalProgram := &Program{ + state: buildInfoToProgramState(buildInfo, buildInfoFileName, config), + } + return incrementalProgram +} diff --git a/internal/incremental/program.go b/internal/incremental/program.go new file mode 100644 index 0000000000..0b160e2ba7 --- /dev/null +++ b/internal/incremental/program.go @@ -0,0 +1,104 @@ +package incremental + +import ( + "context" + + "github.com/microsoft/typescript-go/internal/ast" + "github.com/microsoft/typescript-go/internal/compiler" + "github.com/microsoft/typescript-go/internal/core" +) + +type Program struct { + state *programState + program *compiler.Program +} + +var _ compiler.AnyProgram = (*Program)(nil) + +func NewProgram(program *compiler.Program, oldProgram *Program) *Program { + return &Program{ + state: newProgramState(program, oldProgram), + program: program, + } +} + +func (p *Program) GetProgram() *compiler.Program { + if p.program == nil { + panic("GetProgram should not be called without program") + } + return p.program +} + +func (p *Program) Options() *core.CompilerOptions { + return p.state.options +} + +func (p *Program) GetSourceFiles() []*ast.SourceFile { + if p.program == nil { + panic("GetSourceFiles should not be called without program") + } + return p.program.GetSourceFiles() +} + +func (p *Program) GetConfigFileParsingDiagnostics() []*ast.Diagnostic { + if p.program == nil { + panic("GetConfigFileParsingDiagnostics should not be called without program") + } + return p.program.GetConfigFileParsingDiagnostics() +} + +func (p *Program) GetSyntacticDiagnostics(ctx context.Context, file *ast.SourceFile) []*ast.Diagnostic { + if p.program == nil { + panic("GetSyntacticDiagnostics should not be called without program") + } + return p.program.GetSyntacticDiagnostics(ctx, file) +} + +func (p *Program) GetBindDiagnostics(ctx context.Context, file *ast.SourceFile) []*ast.Diagnostic { + if p.program == nil { + panic("GetBindDiagnostics should not be called without program") + } + return p.program.GetBindDiagnostics(ctx, file) +} + +func (p *Program) GetOptionsDiagnostics(ctx context.Context) []*ast.Diagnostic { + if p.program == nil { + panic("GetOptionsDiagnostics should not be called without program") + } + return p.program.GetOptionsDiagnostics(ctx) +} + +func (p *Program) GetProgramDiagnostics() []*ast.Diagnostic { + if p.program == nil { + panic("GetProgramDiagnostics should not be called without program") + } + return p.program.GetProgramDiagnostics() +} + +func (p *Program) GetGlobalDiagnostics(ctx context.Context) []*ast.Diagnostic { + if p.program == nil { + panic("GetGlobalDiagnostics should not be called without program") + } + return p.program.GetGlobalDiagnostics(ctx) +} + +func (p *Program) GetSemanticDiagnostics(ctx context.Context, file *ast.SourceFile) []*ast.Diagnostic { + if p.program == nil { + panic("GetSemanticDiagnostics should not be called without program") + } + return p.state.getSemanticDiagnostics(ctx, p.program, file) +} + +func (p *Program) GetDeclarationDiagnostics(ctx context.Context, file *ast.SourceFile) []*ast.Diagnostic { + if p.program == nil { + panic("GetDeclarationDiagnostics should not be called without program") + } + return p.state.getDeclarationDiagnostics(ctx, p.program, file) +} + +func (p *Program) Emit(ctx context.Context, options compiler.EmitOptions) *compiler.EmitResult { + if p.program == nil { + panic("Emit should not be called without program") + } + return p.state.emit(ctx, p.program, options) +} diff --git a/internal/incremental/programstate.go b/internal/incremental/programstate.go new file mode 100644 index 0000000000..9153ef3b85 --- /dev/null +++ b/internal/incremental/programstate.go @@ -0,0 +1,1430 @@ +package incremental + +import ( + "context" + "crypto/sha256" + "encoding/json" + "fmt" + "maps" + "slices" + "strings" + + "github.com/microsoft/typescript-go/internal/ast" + "github.com/microsoft/typescript-go/internal/checker" + "github.com/microsoft/typescript-go/internal/collections" + "github.com/microsoft/typescript-go/internal/compiler" + "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/tsoptions" + "github.com/microsoft/typescript-go/internal/tspath" +) + +type fileInfo struct { + version string + signature string + affectsGlobalScope bool + impliedNodeFormat core.ResolutionMode +} + +type fileEmitKind uint32 + +const ( + fileEmitKindNone fileEmitKind = 0 + fileEmitKindJs fileEmitKind = 1 << 0 // emit js file + fileEmitKindJsMap fileEmitKind = 1 << 1 // emit js.map file + fileEmitKindJsInlineMap fileEmitKind = 1 << 2 // emit inline source map in js file + fileEmitKindDtsErrors fileEmitKind = 1 << 3 // emit dts errors + fileEmitKindDtsEmit fileEmitKind = 1 << 4 // emit d.ts file + fileEmitKindDtsMap fileEmitKind = 1 << 5 // emit d.ts.map file + + fileEmitKindDts = fileEmitKindDtsErrors | fileEmitKindDtsEmit + fileEmitKindAllJs = fileEmitKindJs | fileEmitKindJsMap | fileEmitKindJsInlineMap + fileEmitKindAllDtsEmit = fileEmitKindDtsEmit | fileEmitKindDtsMap + fileEmitKindAllDts = fileEmitKindDts | fileEmitKindDtsMap + fileEmitKindAll = fileEmitKindAllJs | fileEmitKindAllDts +) + +func getFileEmitKind(options *core.CompilerOptions) fileEmitKind { + result := fileEmitKindJs + if options.SourceMap.IsTrue() { + result |= fileEmitKindJsMap + } + if options.InlineSourceMap.IsTrue() { + result |= fileEmitKindJsInlineMap + } + if options.GetEmitDeclarations() { + result |= fileEmitKindDts + } + if options.DeclarationMap.IsTrue() { + result |= fileEmitKindDtsMap + } + if options.EmitDeclarationOnly.IsTrue() { + result &= fileEmitKindAllDts + } + return result +} + +func getPendingEmitKindWithOptions(options *core.CompilerOptions, oldOptions *core.CompilerOptions) fileEmitKind { + oldEmitKind := getFileEmitKind(oldOptions) + newEmitKind := getFileEmitKind(options) + return getPendingEmitKind(newEmitKind, oldEmitKind) +} + +func getPendingEmitKind(emitKind fileEmitKind, oldEmitKind fileEmitKind) fileEmitKind { + if oldEmitKind == emitKind { + return fileEmitKindNone + } + if oldEmitKind == 0 || emitKind == 0 { + return emitKind + } + diff := oldEmitKind ^ emitKind + result := fileEmitKindNone + // If there is diff in Js emit, pending emit is js emit flags + if (diff & fileEmitKindAllJs) != 0 { + result |= emitKind & fileEmitKindAllJs + } + // If dts errors pending, add dts errors flag + if (diff & fileEmitKindDtsErrors) != 0 { + result |= emitKind & fileEmitKindDtsErrors + } + // If there is diff in Dts emit, pending emit is dts emit flags + if (diff & fileEmitKindAllDtsEmit) != 0 { + result |= emitKind & fileEmitKindAllDtsEmit + } + return result +} + +/** + * Determining what all is pending to be emitted based on previous options or previous file emit flags + * @internal + */ +func getPendingEmitKindWithSeen(emitKind fileEmitKind, seenEmitKind fileEmitKind, options compiler.EmitOptions, isForDtsErrors bool) fileEmitKind { + pendingKind := getPendingEmitKind(emitKind, seenEmitKind) + if options.EmitOnly == compiler.EmitOnlyDts { + pendingKind &= fileEmitKindAllDts + } + if isForDtsErrors { + pendingKind &= fileEmitKindDtsErrors + } + return pendingKind +} + +func getFileEmitKindAllDts(isForDtsErrors bool) fileEmitKind { + return core.IfElse(isForDtsErrors, fileEmitKindDtsErrors, fileEmitKindAllDts) +} + +/** + * Signature (Hash of d.ts emitted), is string if it was emitted using same d.ts.map option as what compilerOptions indicate, + * otherwise tuple of string + */ +type emitSignature struct { + signature string + signatureWithDifferentOptions []string +} + +/** + * Covert to Emit signature based on oldOptions and EmitSignature format + * If d.ts map options differ then swap the format, otherwise use as is + */ +func (e *emitSignature) getNewEmitSignature(oldOptions *core.CompilerOptions, newOptions *core.CompilerOptions) *emitSignature { + if oldOptions.DeclarationMap.IsTrue() == newOptions.DeclarationMap.IsTrue() { + return e + } + if e.signatureWithDifferentOptions == nil { + return &emitSignature{ + signatureWithDifferentOptions: []string{e.signature}, + } + } else { + return &emitSignature{ + signature: e.signatureWithDifferentOptions[0], + } + } +} + +type diagnosticsOrBuildInfoDiagnostics struct { + diagnostics []*ast.Diagnostic + buildInfoDiagnostics []*incrementalBuildInfoDiagnostic +} + +func (d *diagnosticsOrBuildInfoDiagnostics) getDiagnostics(p *compiler.Program, file *ast.SourceFile) []*ast.Diagnostic { + if d.diagnostics != nil { + return d.diagnostics + } + // Convert and cache the diagnostics + d.diagnostics = core.Map(d.buildInfoDiagnostics, func(diag *incrementalBuildInfoDiagnostic) *ast.Diagnostic { + return diag.toDiagnostic(p, file) + }) + return d.diagnostics +} + +type programState struct { + // State that is serialized as buildinfo + /** + * Information of the file eg. its version, signature etc + */ + fileInfos map[tspath.Path]*fileInfo + options *core.CompilerOptions + /** + * Contains the map of ReferencedSet=Referenced files of the file if module emit is enabled + */ + referencedMap *collections.ManyToManyMap[tspath.Path, tspath.Path] + /** + * Cache of bind and check diagnostics for files with their Path being the key + */ + semanticDiagnosticsPerFile map[tspath.Path]*diagnosticsOrBuildInfoDiagnostics + /** Cache of dts emit diagnostics for files with their Path being the key */ + emitDiagnosticsPerFile map[tspath.Path]*diagnosticsOrBuildInfoDiagnostics + /** + * The map has key by source file's path that has been changed + */ + changedFilesSet *collections.Set[tspath.Path] + /** + * Files pending to be emitted + */ + affectedFilesPendingEmit map[tspath.Path]fileEmitKind + /** + * Name of the file whose dts was the latest to change + */ + latestChangedDtsFile string + /** + * Hash of d.ts emitted for the file, use to track when emit of d.ts changes + */ + emitSignatures map[tspath.Path]*emitSignature + /** Recorded if program had errors */ + hasErrors core.Tristate + /** If semantic diagnsotic check is pending */ + checkPending bool + + // Used during incremental updates + /** + * true if file version is used as signature + * This helps in delaying the calculation of the d.ts hash as version for the file till reasonable time + */ + useFileVersionAsSignature bool + /** + * true if build info is emitted + */ + buildInfoEmitPending bool + hasErrorsFromOldState core.Tristate + /** + * True if the semantic diagnostics were copied from the old state + */ + semanticDiagnosticsFromOldState collections.Set[tspath.Path] + /** + * Cache of all files excluding default library file for the current program + */ + allFilesExcludingDefaultLibraryFile []*ast.SourceFile + + // !!! sheetal handle parallel updates and state sanity + /** + * Map of files that have already called update signature. + * That means hence forth these files are assumed to have + * no change in their signature for this version of the program + */ + hasCalledUpdateShapeSignature collections.Set[tspath.Path] + /** + * whether this program has cleaned semantic diagnostics cache for lib files + */ + cleanedDiagnosticsOfLibFiles bool + /** + * Stores signatures before before the update till affected file is committed + */ + oldSignatures map[tspath.Path]string + /** + * Current changed file for iterating over affected files + */ + currentChangedFilePath tspath.Path + /** + * Set of affected files being iterated + */ + affectedFiles []*ast.SourceFile + /** + * Current index to retrieve affected file from + */ + affectedFilesIndex int + /** + * Already seen affected files + */ + seenAffectedFiles collections.Set[tspath.Path] + /** + * Already seen emitted files + */ + seenEmittedFiles map[tspath.Path]fileEmitKind + /** + * Records if change in dts emit was detected + */ + hasChangedEmitSignature bool +} + +func (p *programState) tracksReferences() bool { + return p.options.Module != core.ModuleKindNone +} + +func (p *programState) createReferenceMap() { + if p.tracksReferences() { + p.referencedMap = &collections.ManyToManyMap[tspath.Path, tspath.Path]{} + } +} + +func (p *programState) createEmitSignaturesMap() { + if p.emitSignatures == nil && p.options.Composite.IsTrue() { + p.emitSignatures = make(map[tspath.Path]*emitSignature) + } +} + +func (p *programState) addFileToChangeSet(filePath tspath.Path) { + p.changedFilesSet.Add(filePath) + p.buildInfoEmitPending = true +} + +func (p *programState) addFileToAffectedFilesPendingEmit(filePath tspath.Path, emitKind fileEmitKind) { + existingKind := p.affectedFilesPendingEmit[filePath] + + if p.affectedFilesPendingEmit == nil { + p.affectedFilesPendingEmit = make(map[tspath.Path]fileEmitKind) + } + p.affectedFilesPendingEmit[filePath] = existingKind | emitKind + delete(p.emitDiagnosticsPerFile, filePath) +} + +func (p *programState) getAllFilesExcludingDefaultLibraryFile(program *compiler.Program, firstSourceFile *ast.SourceFile) []*ast.SourceFile { + // Use cached result + if p.allFilesExcludingDefaultLibraryFile != nil { + return p.allFilesExcludingDefaultLibraryFile + } + + files := program.GetSourceFiles() + p.allFilesExcludingDefaultLibraryFile = make([]*ast.SourceFile, 0, len(files)) + addSourceFile := func(file *ast.SourceFile) { + if !program.IsSourceFileDefaultLibrary(file.Path()) { + p.allFilesExcludingDefaultLibraryFile = append(p.allFilesExcludingDefaultLibraryFile, file) + } + } + if firstSourceFile != nil { + addSourceFile(firstSourceFile) + } + for _, file := range files { + if file != firstSourceFile { + addSourceFile(file) + } + } + return p.allFilesExcludingDefaultLibraryFile +} + +func (p *programState) emit(ctx context.Context, program *compiler.Program, options compiler.EmitOptions) *compiler.EmitResult { + if result := compiler.HandleNoEmitOptions(ctx, program, options.TargetSourceFile); result != nil { + if options.TargetSourceFile != nil { + return result + } + + // Emit buildInfo and combine result + buildInfoResult := p.emitBuildInfo(ctx, program, options) + if buildInfoResult != nil && buildInfoResult.EmittedFiles != nil { + result.Diagnostics = append(result.Diagnostics, buildInfoResult.Diagnostics...) + result.EmittedFiles = append(result.EmittedFiles, buildInfoResult.EmittedFiles...) + } + return result + } + + // Emit only affected files if using builder for emit + if options.TargetSourceFile != nil { + return program.Emit(ctx, p.getEmitOptions(program, options)) + } + + var results []*compiler.EmitResult + for { + affectedEmitResult, done := p.emitNextAffectedFile(ctx, program, options, false) + if done { + break + } + results = append(results, affectedEmitResult) + } + return compiler.CombineEmitResults(results) +} + +func (p *programState) getDeclarationDiagnostics(ctx context.Context, program *compiler.Program, file *ast.SourceFile) []*ast.Diagnostic { + var diagnostics []*ast.Diagnostic + for { + affectedEmitResult, done := p.emitNextAffectedFile(ctx, program, compiler.EmitOptions{}, true) + if done { + break + } + if file == nil { + diagnostics = append(diagnostics, affectedEmitResult.Diagnostics...) + } + } + if file == nil { + return diagnostics + } + if emitDiagnostics, ok := p.emitDiagnosticsPerFile[file.Path()]; ok { + // If diagnostics are present for the file, return them + return emitDiagnostics.getDiagnostics(program, file) + } + return nil +} + +/** + * Emits the next affected file's emit result (EmitResult and sourceFiles emitted) or returns undefined if iteration is complete + * The first of writeFile if provided, writeFile of BuilderProgramHost if provided, writeFile of compiler host + * in that order would be used to write the files + */ +func (p *programState) emitNextAffectedFile(ctx context.Context, program *compiler.Program, options compiler.EmitOptions, isForDtsErrors bool) (*compiler.EmitResult, bool) { + affected := p.getNextAffectedFile(ctx, program) + programEmitKind := getFileEmitKind(p.options) + var emitKind fileEmitKind + if affected == nil { + // file pending emit + pendingAffectedFile, pendingEmitKind := p.getNextAffectedFilePendingEmit(program, options, isForDtsErrors) + if pendingAffectedFile != nil { + affected = pendingAffectedFile + emitKind = pendingEmitKind + } else { + // File whose diagnostics need to be reported + affectedFile, pendingDiagnostics, seenKind := p.getNextPendingEmitDiagnosticsFile(program, isForDtsErrors) + if affectedFile != nil { + p.seenEmittedFiles[affectedFile.Path()] = seenKind | getFileEmitKindAllDts(isForDtsErrors) + return &compiler.EmitResult{ + EmitSkipped: true, + Diagnostics: pendingDiagnostics.getDiagnostics(program, affectedFile), + }, false + } + } + if affected == nil { + // Emit buildinfo if pending + if isForDtsErrors { + return nil, true + } + result := p.emitBuildInfo(ctx, program, options) + if result != nil { + return result, false + } + return nil, true + } + } else { + if isForDtsErrors { + emitKind = fileEmitKindDtsErrors + } else if options.EmitOnly == compiler.EmitOnlyDts { + emitKind = programEmitKind & fileEmitKindAllDts + } else { + emitKind = programEmitKind + } + } + // Determine if we can do partial emit + var emitOnly compiler.EmitOnly + if (emitKind & fileEmitKindAllJs) != 0 { + emitOnly = compiler.EmitOnlyJs + } + if (emitKind & fileEmitKindAllDts) != 0 { + if emitOnly == compiler.EmitOnlyJs { + emitOnly = compiler.EmitAll + } else { + emitOnly = compiler.EmitOnlyDts + } + } + // // Actual emit without buildInfo as we want to emit it later so the state is updated + var result *compiler.EmitResult + if !isForDtsErrors { + result = program.Emit(ctx, p.getEmitOptions(program, compiler.EmitOptions{ + TargetSourceFile: affected, + EmitOnly: emitOnly, + WriteFile: options.WriteFile, + })) + } else { + result = &compiler.EmitResult{ + EmitSkipped: true, + Diagnostics: program.GetDeclarationDiagnostics(ctx, affected), + } + } + + // update affected files + p.seenAffectedFiles.Add(affected.Path()) + p.affectedFilesIndex++ + // Change in changeSet/affectedFilesPendingEmit, buildInfo needs to be emitted + p.buildInfoEmitPending = true + // Update the pendingEmit for the file + existing := p.seenEmittedFiles[affected.Path()] + p.seenEmittedFiles[affected.Path()] = emitKind | existing + existingPending, ok := p.affectedFilesPendingEmit[affected.Path()] + if !ok { + existingPending = programEmitKind + } + pendingKind := getPendingEmitKind(existingPending, emitKind|existing) + if pendingKind != 0 { + p.affectedFilesPendingEmit[affected.Path()] = pendingKind + } else { + delete(p.affectedFilesPendingEmit, affected.Path()) + } + if len(result.Diagnostics) != 0 { + if p.emitDiagnosticsPerFile == nil { + p.emitDiagnosticsPerFile = make(map[tspath.Path]*diagnosticsOrBuildInfoDiagnostics) + } + p.emitDiagnosticsPerFile[affected.Path()] = &diagnosticsOrBuildInfoDiagnostics{ + diagnostics: result.Diagnostics, + } + } + return result, false +} + +/** + * Returns next file to be emitted from files that retrieved semantic diagnostics but did not emit yet + */ +func (p *programState) getNextAffectedFilePendingEmit(program *compiler.Program, options compiler.EmitOptions, isForDtsErrors bool) (*ast.SourceFile, fileEmitKind) { + if len(p.affectedFilesPendingEmit) == 0 { + return nil, 0 + } + for path, emitKind := range p.affectedFilesPendingEmit { + affectedFile := program.GetSourceFileByPath(path) + if affectedFile == nil || !program.SourceFileMayBeEmitted(affectedFile, false) { + delete(p.affectedFilesPendingEmit, path) + continue + } + seenKind := p.seenEmittedFiles[affectedFile.Path()] + pendingKind := getPendingEmitKindWithSeen(emitKind, seenKind, options, isForDtsErrors) + if pendingKind != 0 { + return affectedFile, pendingKind + } + } + return nil, 0 +} + +func (p *programState) getNextPendingEmitDiagnosticsFile(program *compiler.Program, isForDtsErrors bool) (*ast.SourceFile, *diagnosticsOrBuildInfoDiagnostics, fileEmitKind) { + if len(p.emitDiagnosticsPerFile) == 0 { + return nil, nil, 0 + } + for path, diagnostics := range p.emitDiagnosticsPerFile { + affectedFile := program.GetSourceFileByPath(path) + if affectedFile == nil || !program.SourceFileMayBeEmitted(affectedFile, false) { + delete(p.emitDiagnosticsPerFile, path) + continue + } + seenKind := p.seenEmittedFiles[affectedFile.Path()] + if (seenKind & getFileEmitKindAllDts(isForDtsErrors)) != 0 { + return affectedFile, diagnostics, seenKind + } + } + return nil, nil, 0 +} + +func (p *programState) getEmitOptions(program *compiler.Program, options compiler.EmitOptions) compiler.EmitOptions { + if !p.options.GetEmitDeclarations() { + return options + } + return compiler.EmitOptions{ + TargetSourceFile: options.TargetSourceFile, + EmitOnly: options.EmitOnly, + WriteFile: func(fileName string, text string, writeByteOrderMark bool, data *compiler.WriteFileData) error { + if tspath.IsDeclarationFileName(fileName) { + var emitSignature string + info := p.fileInfos[options.TargetSourceFile.Path()] + if info.signature == info.version { + signature := computeSignatureWithDiagnostics(options.TargetSourceFile, text, data) + // With d.ts diagnostics they are also part of the signature so emitSignature will be different from it since its just hash of d.ts + if len(data.Diagnostics) == 0 { + emitSignature = signature + } + if signature != info.version { // Update it + if p.affectedFiles != nil { + // Keep old signature so we know what to undo if cancellation happens + if _, ok := p.oldSignatures[options.TargetSourceFile.Path()]; !ok { + if p.oldSignatures == nil { + p.oldSignatures = make(map[tspath.Path]string) + } + p.oldSignatures[options.TargetSourceFile.Path()] = info.signature + } + } + info.signature = signature + } + } + + // Store d.ts emit hash so later can be compared to check if d.ts has changed. + // Currently we do this only for composite projects since these are the only projects that can be referenced by other projects + // and would need their d.ts change time in --build mode + if p.skipDtsOutputOfComposite(program, options.TargetSourceFile, fileName, text, data, emitSignature) { + return nil + } + } + + if options.WriteFile != nil { + return options.WriteFile(fileName, text, writeByteOrderMark, data) + } + return program.Host().FS().WriteFile(fileName, text, writeByteOrderMark) + }, + } +} + +/** + * Compare to existing computed signature and store it or handle the changes in d.ts map option from before + * returning undefined means that, we dont need to emit this d.ts file since its contents didnt change + */ +func (p *programState) skipDtsOutputOfComposite(program *compiler.Program, file *ast.SourceFile, outputFileName string, text string, data *compiler.WriteFileData, newSignature string) bool { + if !p.options.Composite.IsTrue() { + return false + } + var oldSignature string + oldSignatureFormat, ok := p.emitSignatures[file.Path()] + if ok { + if oldSignatureFormat.signature != "" { + oldSignature = oldSignatureFormat.signature + } else { + oldSignature = oldSignatureFormat.signatureWithDifferentOptions[0] + } + } + if newSignature == "" { + newSignature = computeHash(getTextHandlingSourceMapForSignature(text, data)) + } + // Dont write dts files if they didn't change + if newSignature == oldSignature { + // If the signature was encoded as string the dts map options match so nothing to do + if oldSignatureFormat != nil && oldSignatureFormat.signature == oldSignature { + data.SkippedDtsWrite = true + return true + } else { + // Mark as differsOnlyInMap so that --build can reverse the timestamp so that + // the downstream projects dont detect this as change in d.ts file + data.DiffersOnlyInMap = true + } + } else { + p.hasChangedEmitSignature = true + p.latestChangedDtsFile = outputFileName + } + if p.emitSignatures == nil { + p.emitSignatures = make(map[tspath.Path]*emitSignature) + } + p.emitSignatures[file.Path()] = &emitSignature{ + signature: newSignature, + } + return false +} + +func (p *programState) emitBuildInfo(ctx context.Context, program *compiler.Program, options compiler.EmitOptions) *compiler.EmitResult { + buildInfoFileName := outputpaths.GetBuildInfoFileName(p.options, tspath.ComparePathsOptions{ + CurrentDirectory: program.GetCurrentDirectory(), + UseCaseSensitiveFileNames: program.UseCaseSensitiveFileNames(), + }) + if buildInfoFileName == "" { + return nil + } + + p.ensureHasErrorsForState(ctx, program) + if !p.buildInfoEmitPending && p.hasErrorsFromOldState == p.hasErrors { + return nil + } + p.buildInfoEmitPending = false + p.hasErrorsFromOldState = p.hasErrors + buildInfo := programStateToBuildInfo(p, program, buildInfoFileName) + text, err := json.Marshal(buildInfo) + if err != nil { + panic(fmt.Sprintf("Failed to marshal build info: %v", err)) + } + if options.WriteFile != nil { + err = options.WriteFile(buildInfoFileName, string(text), false, &compiler.WriteFileData{ + BuildInfo: &buildInfo, + }) + } else { + err = program.Host().FS().WriteFile(buildInfoFileName, string(text), false) + } + if err != nil { + return &compiler.EmitResult{ + EmitSkipped: true, + Diagnostics: []*ast.Diagnostic{ + ast.NewCompilerDiagnostic(diagnostics.Could_not_write_file_0_Colon_1, buildInfoFileName, err.Error()), + }, + } + } + var emittedFiles []string + if p.options.ListEmittedFiles.IsTrue() { + emittedFiles = []string{buildInfoFileName} + } + return &compiler.EmitResult{ + EmitSkipped: false, + EmittedFiles: emittedFiles, + } +} + +func (p *programState) ensureHasErrorsForState(ctx context.Context, program *compiler.Program) { + if p.hasErrors != core.TSUnknown { + return + } + + // 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 { + semanticDiagnostics := p.semanticDiagnosticsPerFile[file.Path()] + if semanticDiagnostics == nil { + // Missing semantic diagnostics in cache will be encoded in incremental buildInfo + return p.options.IsIncremental() + } + if len(semanticDiagnostics.diagnostics) > 0 || len(semanticDiagnostics.buildInfoDiagnostics) > 0 { + // cached semantic diagnostics will be encoded in buildInfo + return true + } + if _, ok := p.emitDiagnosticsPerFile[file.Path()]; ok { + // emit diagnostics will be encoded in buildInfo; + return true + } + return false + }) { + // Because semantic diagnostics are recorded in buildInfo, we dont need to encode hasErrors in incremental buildInfo + // But encode as errors in non incremental buildInfo + p.hasErrors = core.IfElse(p.options.IsIncremental(), core.TSFalse, core.TSTrue) + return + } + if len(program.GetConfigFileParsingDiagnostics()) > 0 || + len(program.GetSyntacticDiagnostics(ctx, nil)) > 0 || + len(program.GetBindDiagnostics(ctx, nil)) > 0 || + len(program.GetOptionsDiagnostics(ctx)) > 0 { + p.hasErrors = core.TSTrue + } else { + p.hasErrors = core.TSFalse + } +} + +func (p *programState) getSemanticDiagnostics(ctx context.Context, program *compiler.Program, file *ast.SourceFile) []*ast.Diagnostic { + if file != nil { + return p.getSemanticDiagnosticsOfFile(ctx, program, file) + } + + for { + _, done := p.getSemanticDiagnosticsOfNextAffectedFile(ctx, program) + if done { + break + } + } + + var diagnostics []*ast.Diagnostic + for _, file := range program.GetSourceFiles() { + diagnostics = append(diagnostics, p.getSemanticDiagnosticsOfFile(ctx, program, file)...) + } + if p.checkPending && !p.options.NoCheck.IsTrue() { + p.checkPending = false + p.buildInfoEmitPending = true + } + return diagnostics +} + +/* +* Gets the semantic diagnostics either from cache if present, or otherwise from program and caches it +* Note that it is assumed that when asked about checker diagnostics, the file has been taken out of affected files/changed file set + */ +func (p *programState) getSemanticDiagnosticsOfFile(ctx context.Context, program *compiler.Program, file *ast.SourceFile) []*ast.Diagnostic { + if p.options.NoCheck.IsTrue() { + return nil + } + + // !!! this is different from strada where we were adding program diagnostics but + // but with blank slate it would be good to call that directly instead of unnecessarily concatenating + + // Report the check diagnostics from the cache if we already have those diagnostics present + if cachedDiagnostics, ok := p.semanticDiagnosticsPerFile[file.Path()]; ok { + return compiler.FilterNoEmitSemanticDiagnostics(cachedDiagnostics.getDiagnostics(program, file), p.options) + } + + // Diagnostics werent cached, get them from program, and cache the result + diagnostics := program.GetSemanticDiagnostics(ctx, file) + p.semanticDiagnosticsPerFile[file.Path()] = &diagnosticsOrBuildInfoDiagnostics{diagnostics: diagnostics} + p.buildInfoEmitPending = true + return compiler.FilterNoEmitSemanticDiagnostics(diagnostics, p.options) +} + +/** + * Return the semantic diagnostics for the next affected file, done if iteration is complete + */ +func (p *programState) getSemanticDiagnosticsOfNextAffectedFile(ctx context.Context, program *compiler.Program) ([]*ast.Diagnostic, bool) { + for { + affected := p.getNextAffectedFile(ctx, program) + if affected == nil { + if p.checkPending && !p.options.NoCheck.IsTrue() { + p.checkPending = false + p.buildInfoEmitPending = true + } + return nil, true + } + // Get diagnostics for the affected file if its not ignored + result := p.getSemanticDiagnosticsOfFile(ctx, program, affected) + p.seenAffectedFiles.Add(affected.Path()) + p.affectedFilesIndex++ + p.buildInfoEmitPending = true + if result == nil { + continue + } + return result, false + } +} + +/** + * This function returns the next affected file to be processed. + * Note that until doneAffected is called it would keep reporting same result + * This is to allow the callers to be able to actually remove affected file only when the operation is complete + * eg. if during diagnostics check cancellation token ends up cancelling the request, the affected file should be retained + */ +func (p *programState) getNextAffectedFile(ctx context.Context, program *compiler.Program) *ast.SourceFile { + for { + if p.affectedFiles != nil { + for p.affectedFilesIndex < len(p.affectedFiles) { + affectedFile := p.affectedFiles[p.affectedFilesIndex] + if !p.seenAffectedFiles.Has(affectedFile.Path()) { + // Set the next affected file as seen and remove the cached semantic diagnostics + p.addFileToAffectedFilesPendingEmit(affectedFile.Path(), getFileEmitKind(p.options)) + p.handleDtsMayChangeOfAffectedFile(ctx, program, affectedFile) + return affectedFile + } + p.affectedFilesIndex++ + } + + // Remove the changed file from the change set + p.changedFilesSet.Delete(p.currentChangedFilePath) + p.currentChangedFilePath = "" + // Commit the changes in file signature + p.oldSignatures = nil + p.affectedFiles = nil + } + + // Get next changed file + var file tspath.Path + for file = range p.changedFilesSet.Keys() { + // Get next batch of affected files + p.affectedFiles = p.getFilesAffectedBy(ctx, program, file) + p.currentChangedFilePath = file + p.affectedFilesIndex = 0 + break + } + + // Done if there are no more changed files + if file == "" { + return nil + } + } +} + +func (p *programState) getFilesAffectedBy(ctx context.Context, program *compiler.Program, path tspath.Path) []*ast.SourceFile { + file := program.GetSourceFileByPath(path) + if file == nil { + return nil + } + + if !p.updateShapeSignature(ctx, program, file, p.useFileVersionAsSignature) { + return []*ast.SourceFile{file} + } + + if !p.tracksReferences() { + return p.getAllFilesExcludingDefaultLibraryFile(program, file) + } + + if info := p.fileInfos[file.Path()]; info.affectsGlobalScope { + p.getAllFilesExcludingDefaultLibraryFile(program, file) + } + + if p.options.IsolatedModules.IsTrue() { + return []*ast.SourceFile{file} + } + + // Now we need to if each file in the referencedBy list has a shape change as well. + // Because if so, its own referencedBy files need to be saved as well to make the + // emitting result consistent with files on disk. + seenFileNamesMap := p.forEachFileReferencedBy( + program, + file, + func(currentFile *ast.SourceFile, currentPath tspath.Path) (queueForFile bool, fastReturn bool) { + // If the current file is not nil and has a shape change, we need to queue it for processing + if currentFile != nil && p.updateShapeSignature(ctx, program, currentFile, p.useFileVersionAsSignature) { + return true, false + } + return false, false + }, + ) + // Return array of values that needs emit + return core.Filter(slices.Collect(maps.Values(seenFileNamesMap)), func(file *ast.SourceFile) bool { + return file != nil + }) +} + +func (p *programState) forEachFileReferencedBy( + program *compiler.Program, + file *ast.SourceFile, + fn func(currentFile *ast.SourceFile, currentPath tspath.Path) (queueForFile bool, fastReturn bool), +) map[tspath.Path]*ast.SourceFile { + // Now we need to if each file in the referencedBy list has a shape change as well. + // Because if so, its own referencedBy files need to be saved as well to make the + // emitting result consistent with files on disk. + seenFileNamesMap := map[tspath.Path]*ast.SourceFile{} + // Start with the paths this file was referenced by + seenFileNamesMap[file.Path()] = file + references := p.getReferencedByPaths(file.Path()) + queue := slices.Collect(maps.Keys(references)) + for len(queue) > 0 { + currentPath := queue[len(queue)-1] + queue = queue[:len(queue)-1] + if _, ok := seenFileNamesMap[currentPath]; !ok { + currentFile := program.GetSourceFileByPath(currentPath) + seenFileNamesMap[currentPath] = currentFile + queueForFile, fastReturn := fn(currentFile, currentPath) + if fastReturn { + return seenFileNamesMap + } + if queueForFile { + for ref := range p.getReferencedByPaths(currentFile.Path()) { + queue = append(queue, ref) + } + } + } + } + return seenFileNamesMap +} + +/** + * Gets the files referenced by the the file path + */ +func (p *programState) getReferencedByPaths(file tspath.Path) map[tspath.Path]struct{} { + keys, ok := p.referencedMap.GetKeys(file) + if !ok { + return nil + } + return keys.Keys() +} + +func (p *programState) updateShapeSignature(ctx context.Context, program *compiler.Program, file *ast.SourceFile, useFileVersionAsSignature bool) bool { + // If we have cached the result for this file, that means hence forth we should assume file shape is uptodate + if p.hasCalledUpdateShapeSignature.Has(file.Path()) { + return false + } + + info := p.fileInfos[file.Path()] + prevSignature := info.signature + var latestSignature string + if !file.IsDeclarationFile && !useFileVersionAsSignature { + latestSignature = p.computeDtsSignature(ctx, program, file) + } + // Default is to use file version as signature + if latestSignature == "" { + latestSignature = info.version + } + if p.oldSignatures == nil { + p.oldSignatures = make(map[tspath.Path]string) + } + p.oldSignatures[file.Path()] = prevSignature + p.hasCalledUpdateShapeSignature.Add(file.Path()) + info.signature = latestSignature + return latestSignature != prevSignature +} + +func (p *programState) computeDtsSignature(ctx context.Context, program *compiler.Program, file *ast.SourceFile) string { + var signature string + program.Emit(ctx, compiler.EmitOptions{ + TargetSourceFile: file, + EmitOnly: compiler.EmitOnlyForcedDts, + WriteFile: func(fileName string, text string, writeByteOrderMark bool, data *compiler.WriteFileData) error { + if !tspath.IsDeclarationFileName(fileName) { + panic("File extension for signature expected to be dts, got : " + fileName) + } + signature = computeSignatureWithDiagnostics(file, text, data) + return nil + }, + }) + return signature +} + +func (p *programState) isChangedSignature(path tspath.Path) bool { + oldSignature := p.oldSignatures[path] + newSignature := p.fileInfos[path].signature + return newSignature != oldSignature +} + +/** + * Removes semantic diagnostics for path and + * returns true if there are no more semantic diagnostics from the old state + */ +func (p *programState) removeSemanticDiagnosticsOf(path tspath.Path) { + if p.semanticDiagnosticsFromOldState.Has(path) { + p.semanticDiagnosticsFromOldState.Delete(path) + delete(p.semanticDiagnosticsPerFile, path) + } +} + +func (p *programState) removeDiagnosticsOfLibraryFiles(program *compiler.Program) { + if !p.cleanedDiagnosticsOfLibFiles { + p.cleanedDiagnosticsOfLibFiles = true + for _, file := range program.GetSourceFiles() { + if program.IsSourceFileDefaultLibrary(file.Path()) && !checker.SkipTypeChecking(file, p.options, program, true) { + p.removeSemanticDiagnosticsOf(file.Path()) + } + } + } +} + +/** + * Handles semantic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file + * This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change + */ +func (p *programState) handleDtsMayChangeOfAffectedFile(ctx context.Context, program *compiler.Program, affectedFile *ast.SourceFile) { + p.removeSemanticDiagnosticsOf(affectedFile.Path()) + + // If affected files is everything except default library, then nothing more to do + if slices.Equal(p.allFilesExcludingDefaultLibraryFile, p.affectedFiles) { + p.removeDiagnosticsOfLibraryFiles(program) + // When a change affects the global scope, all files are considered to be affected without updating their signature + // That means when affected file is handled, its signature can be out of date + // To avoid this, ensure that we update the signature for any affected file in this scenario. + p.updateShapeSignature(ctx, program, affectedFile, p.useFileVersionAsSignature) + return + } + + if p.options.AssumeChangesOnlyAffectDirectDependencies.IsTrue() { + return + } + + // Iterate on referencing modules that export entities from affected file and delete diagnostics and add pending emit + // If there was change in signature (dts output) for the changed file, + // then only we need to handle pending file emit + if !p.tracksReferences() || + !p.changedFilesSet.Has(affectedFile.Path()) || + !p.isChangedSignature(affectedFile.Path()) { + return + } + + // Since isolated modules dont change js files, files affected by change in signature is itself + // But we need to cleanup semantic diagnostics and queue dts emit for affected files + if p.options.IsolatedModules.IsTrue() { + p.forEachFileReferencedBy( + program, + affectedFile, + func(currentFile *ast.SourceFile, currentPath tspath.Path) (queueForFile bool, fastReturn bool) { + if p.handleDtsMayChangeOfGlobalScope(ctx, program, currentPath /*invalidateJsFiles*/, false) { + return false, true + } + p.handleDtsMayChangeOf(ctx, program, currentPath /*invalidateJsFiles*/, false) + if p.isChangedSignature(currentPath) { + return true, false + } + return false, false + }, + ) + } + + seenFileAndExportsOfFile := collections.Set[tspath.Path]{} + invalidateJsFiles := false + var typeChecker *checker.Checker + var done func() + // If exported const enum, we need to ensure that js files are emitted as well since the const enum value changed + if affectedFile.Symbol != nil { + for _, exported := range affectedFile.Symbol.Exports { + if exported.Flags&ast.SymbolFlagsConstEnum != 0 { + invalidateJsFiles = true + break + } + if typeChecker == nil { + typeChecker, done = program.GetTypeCheckerForFile(ctx, affectedFile) + } + aliased := checker.SkipAlias(exported, typeChecker) + if aliased == exported { + continue + } + if (aliased.Flags & ast.SymbolFlagsConstEnum) != 0 { + if slices.ContainsFunc(aliased.Declarations, func(d *ast.Node) bool { + return ast.GetSourceFileOfNode(d) == affectedFile + }) { + invalidateJsFiles = true + break + } + } + } + } + if done != nil { + done() + } + + // Go through files that reference affected file and handle dts emit and semantic diagnostics for them and their references + if keys, ok := p.referencedMap.GetKeys(affectedFile.Path()); ok { + for exportedFromPath := range keys.Keys() { + if p.handleDtsMayChangeOfGlobalScope(ctx, program, exportedFromPath, invalidateJsFiles) { + return + } + if references, ok := p.referencedMap.GetKeys(exportedFromPath); ok { + for filePath := range references.Keys() { + if p.handleDtsMayChangeOfFileAndExportsOfFile(ctx, program, filePath, invalidateJsFiles, &seenFileAndExportsOfFile) { + return + } + } + } + } + } +} + +/** + * handle dts and semantic diagnostics on file and iterate on anything that exports this file + * return true when all work is done and we can exit handling dts emit and semantic diagnostics + */ +func (p *programState) handleDtsMayChangeOfFileAndExportsOfFile(ctx context.Context, program *compiler.Program, filePath tspath.Path, invalidateJsFiles bool, seenFileAndExportsOfFile *collections.Set[tspath.Path]) bool { + if seenFileAndExportsOfFile.AddIfAbsent(filePath) == false { + return false + } + if p.handleDtsMayChangeOfGlobalScope(ctx, program, filePath, invalidateJsFiles) { + return true + } + p.handleDtsMayChangeOf(ctx, program, filePath, invalidateJsFiles) + + // Remove the diagnostics of files that import this file and handle all its exports too + if keys, ok := p.referencedMap.GetKeys(filePath); ok { + for referencingFilePath := range keys.Keys() { + if p.handleDtsMayChangeOfFileAndExportsOfFile(ctx, program, referencingFilePath, invalidateJsFiles, seenFileAndExportsOfFile) { + return true + } + } + } + return false +} + +func (p *programState) handleDtsMayChangeOfGlobalScope(ctx context.Context, program *compiler.Program, filePath tspath.Path, invalidateJsFiles bool) bool { + if info, ok := p.fileInfos[filePath]; !ok || !info.affectsGlobalScope { + return false + } + // Every file needs to be handled + for _, file := range p.getAllFilesExcludingDefaultLibraryFile(program, nil) { + p.handleDtsMayChangeOf(ctx, program, file.Path(), invalidateJsFiles) + } + p.removeDiagnosticsOfLibraryFiles(program) + return true +} + +/** + * Handle the dts may change, so they need to be added to pending emit if dts emit is enabled, + * Also we need to make sure signature is updated for these files + */ +func (p *programState) handleDtsMayChangeOf(ctx context.Context, program *compiler.Program, path tspath.Path, invalidateJsFiles bool) { + p.removeSemanticDiagnosticsOf(path) + if p.changedFilesSet.Has(path) { + return + } + file := program.GetSourceFileByPath(path) + if file == nil { + return + } + // Even though the js emit doesnt change and we are already handling dts emit and semantic diagnostics + // we need to update the signature to reflect correctness of the signature(which is output d.ts emit) of this file + // This ensures that we dont later during incremental builds considering wrong signature. + // Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build + // But we avoid expensive full shape computation, as using file version as shape is enough for correctness. + p.updateShapeSignature(ctx, program, file, true) + // If not dts emit, nothing more to do + if invalidateJsFiles { + p.addFileToAffectedFilesPendingEmit(path, getFileEmitKind(p.options)) + } else if p.options.GetEmitDeclarations() { + p.addFileToAffectedFilesPendingEmit(path, core.IfElse(p.options.DeclarationMap.IsTrue(), fileEmitKindAllDts, fileEmitKindDts)) + } +} + +func newProgramState(program *compiler.Program, oldProgram *Program) *programState { + if oldProgram != nil && oldProgram.program == program { + return oldProgram.state + } + files := program.GetSourceFiles() + state := &programState{ + options: program.Options(), + semanticDiagnosticsPerFile: make(map[tspath.Path]*diagnosticsOrBuildInfoDiagnostics, len(files)), + seenEmittedFiles: make(map[tspath.Path]fileEmitKind, len(files)), + } + state.createReferenceMap() + if oldProgram != nil && state.options.Composite.IsTrue() { + state.latestChangedDtsFile = oldProgram.state.latestChangedDtsFile + } + if state.options.NoCheck.IsTrue() { + state.checkPending = true + } + + canUseStateFromOldProgram := oldProgram != nil && state.tracksReferences() == oldProgram.state.tracksReferences() + if canUseStateFromOldProgram { + // Copy old state's changed files set + state.changedFilesSet = oldProgram.state.changedFilesSet.Clone() + if len(oldProgram.state.affectedFilesPendingEmit) != 0 { + state.affectedFilesPendingEmit = maps.Clone(oldProgram.state.affectedFilesPendingEmit) + } + state.hasErrorsFromOldState = oldProgram.state.hasErrors + } else { + state.changedFilesSet = &collections.Set[tspath.Path]{} + state.useFileVersionAsSignature = true + state.buildInfoEmitPending = state.options.IsIncremental() + } + + canCopySemanticDiagnostics := canUseStateFromOldProgram && + !tsoptions.CompilerOptionsAffectSemanticDiagnostics(oldProgram.state.options, program.Options()) + // // We can only reuse emit signatures (i.e. .d.ts signatures) if the .d.ts file is unchanged, + // // which will eg be depedent on change in options like declarationDir and outDir options are unchanged. + // // We need to look in oldState.compilerOptions, rather than oldCompilerOptions (i.e.we need to disregard useOldState) because + // // oldCompilerOptions can be undefined if there was change in say module from None to some other option + // // which would make useOldState as false since we can now use reference maps that are needed to track what to emit, what to check etc + // // but that option change does not affect d.ts file name so emitSignatures should still be reused. + canCopyEmitSignatures := state.options.Composite.IsTrue() && + oldProgram != nil && + oldProgram.state.emitSignatures != nil && + !tsoptions.CompilerOptionsAffectDeclarationPath(oldProgram.state.options, program.Options()) + copyDeclarationFileDiagnostics := canCopySemanticDiagnostics && + state.options.SkipLibCheck.IsTrue() == oldProgram.state.options.SkipLibCheck.IsTrue() + copyLibFileDiagnostics := copyDeclarationFileDiagnostics && + state.options.SkipDefaultLibCheck.IsTrue() == oldProgram.state.options.SkipDefaultLibCheck.IsTrue() + state.fileInfos = make(map[tspath.Path]*fileInfo, len(files)) + for _, file := range files { + version := computeHash(file.Text()) + impliedNodeFormat := program.GetSourceFileMetaData(file.Path()).ImpliedNodeFormat + affectsGlobalScope := fileAffectsGlobalScope(file) + var signature string + if canUseStateFromOldProgram { + var hasOldUncommitedSignature bool + signature, hasOldUncommitedSignature = oldProgram.state.oldSignatures[file.Path()] + if oldFileInfo, ok := oldProgram.state.fileInfos[file.Path()]; ok { + if !hasOldUncommitedSignature { + signature = oldFileInfo.signature + } + if oldFileInfo.version == version || oldFileInfo.affectsGlobalScope != affectsGlobalScope || oldFileInfo.impliedNodeFormat != impliedNodeFormat { + state.addFileToChangeSet(file.Path()) + } + } else { + state.addFileToChangeSet(file.Path()) + } + if state.referencedMap != nil { + newReferences := getReferencedFiles(program, file) + if newReferences != nil { + state.referencedMap.Add(file.Path(), newReferences) + } + oldReferences, _ := oldProgram.state.referencedMap.GetValues(file.Path()) + // Referenced files changed + if !newReferences.Equals(oldReferences) { + state.addFileToChangeSet(file.Path()) + } else { + for refPath := range newReferences.Keys() { + if program.GetSourceFileByPath(refPath) == nil { + // Referenced file was deleted in the new program + state.addFileToChangeSet(file.Path()) + break + } + } + } + } + if !state.changedFilesSet.Has(file.Path()) { + if emitDiagnostics, ok := oldProgram.state.emitDiagnosticsPerFile[file.Path()]; ok { + if state.emitDiagnosticsPerFile == nil { + state.emitDiagnosticsPerFile = make(map[tspath.Path]*diagnosticsOrBuildInfoDiagnostics, len(files)) + } + state.emitDiagnosticsPerFile[file.Path()] = emitDiagnostics + } + if canCopySemanticDiagnostics { + if (!file.IsDeclarationFile || copyDeclarationFileDiagnostics) && + (!program.IsSourceFileDefaultLibrary(file.Path()) || copyLibFileDiagnostics) { + // Unchanged file copy diagnostics + if diagnostics, ok := oldProgram.state.semanticDiagnosticsPerFile[file.Path()]; ok { + state.semanticDiagnosticsPerFile[file.Path()] = diagnostics + state.semanticDiagnosticsFromOldState.Add(file.Path()) + } + } + } + } + if canCopyEmitSignatures { + if oldEmitSignature, ok := oldProgram.state.emitSignatures[file.Path()]; ok { + state.createEmitSignaturesMap() + state.emitSignatures[file.Path()] = oldEmitSignature.getNewEmitSignature(oldProgram.state.options, state.options) + } + } + } else { + state.addFileToChangeSet(file.Path()) + } + state.fileInfos[file.Path()] = &fileInfo{ + version: version, + signature: signature, + affectsGlobalScope: affectsGlobalScope, + impliedNodeFormat: impliedNodeFormat, + } + } + if canUseStateFromOldProgram { + // If the global file is removed, add all files as changed + allFilesExcludingDefaultLibraryFileAddedToChangeSet := false + for filePath, oldInfo := range oldProgram.state.fileInfos { + if _, ok := state.fileInfos[filePath]; !ok { + if oldInfo.affectsGlobalScope { + for _, file := range state.getAllFilesExcludingDefaultLibraryFile(program, nil) { + state.addFileToChangeSet(file.Path()) + } + allFilesExcludingDefaultLibraryFileAddedToChangeSet = true + } else { + state.buildInfoEmitPending = true + } + break + } + } + if !allFilesExcludingDefaultLibraryFileAddedToChangeSet { + // If options affect emit, then we need to do complete emit per compiler options + // otherwise only the js or dts that needs to emitted because its different from previously emitted options + var pendingEmitKind fileEmitKind + if tsoptions.CompilerOptionsAffectEmit(oldProgram.state.options, state.options) { + pendingEmitKind = getFileEmitKind(state.options) + } else { + pendingEmitKind = getPendingEmitKindWithOptions(state.options, oldProgram.state.options) + } + if pendingEmitKind != fileEmitKindNone { + // Add all files to affectedFilesPendingEmit since emit changed + for _, file := range files { + // Add to affectedFilesPending emit only if not changed since any changed file will do full emit + if !state.changedFilesSet.Has(file.Path()) { + state.addFileToAffectedFilesPendingEmit(file.Path(), pendingEmitKind) + } + } + state.buildInfoEmitPending = true + } + } + } + if canUseStateFromOldProgram && + len(state.semanticDiagnosticsPerFile) != len(state.fileInfos) && + oldProgram.state.checkPending != state.checkPending { + state.buildInfoEmitPending = true + } + return state +} + +func fileAffectsGlobalScope(file *ast.SourceFile) bool { + // if file contains anything that augments to global scope we need to build them as if + // they are global files as well as module + if core.Some(file.ModuleAugmentations, func(augmentation *ast.ModuleName) bool { + return ast.IsGlobalScopeAugmentation(augmentation.Parent) + }) { + return true + } + + if ast.IsExternalOrCommonJSModule(file) || ast.IsJsonSourceFile(file) { + return false + } + + /** + * For script files that contains only ambient external modules, although they are not actually external module files, + * they can only be consumed via importing elements from them. Regular script files cannot consume them. Therefore, + * there are no point to rebuild all script files if these special files have changed. However, if any statement + * in the file is not ambient external module, we treat it as a regular script file. + */ + return file.Statements != nil && + file.Statements.Nodes != nil && + core.Some(file.Statements.Nodes, func(stmt *ast.Node) bool { + return !ast.IsModuleWithStringLiteralName(stmt) + }) +} + +func getTextHandlingSourceMapForSignature(text string, data *compiler.WriteFileData) string { + if data.SourceMapUrlPos != -1 { + return text[:data.SourceMapUrlPos] + } + return text +} + +func computeSignatureWithDiagnostics(file *ast.SourceFile, text string, data *compiler.WriteFileData) string { + var builder strings.Builder + builder.WriteString(getTextHandlingSourceMapForSignature(text, data)) + for _, diag := range data.Diagnostics { + diagnosticToStringBuilder(diag, file, &builder) + } + return computeHash(builder.String()) +} + +func diagnosticToStringBuilder(diagnostic *ast.Diagnostic, file *ast.SourceFile, builder *strings.Builder) string { + if diagnostic == nil { + return "" + } + builder.WriteString("\n") + if diagnostic.File() != file { + builder.WriteString(tspath.EnsurePathIsNonModuleName(tspath.GetRelativePathFromDirectory( + tspath.GetDirectoryPath(string(file.Path())), + string(diagnostic.File().Path()), + tspath.ComparePathsOptions{}, + ))) + } + if diagnostic.File() != nil { + builder.WriteString(fmt.Sprintf("(%d,%d): ", diagnostic.Pos(), diagnostic.Len())) + } + builder.WriteString(diagnostic.Category().Name()) + builder.WriteString(fmt.Sprintf("%d: ", diagnostic.Code())) + builder.WriteString(diagnostic.Message()) + for _, chain := range diagnostic.MessageChain() { + diagnosticToStringBuilder(chain, file, builder) + } + for _, info := range diagnostic.RelatedInformation() { + diagnosticToStringBuilder(info, file, builder) + } + return builder.String() +} + +func computeHash(text string) string { + return fmt.Sprintf("%x", sha256.Sum256([]byte(text))) +} + +/** +* Get the module source file and all augmenting files from the import name node from file + */ +func addReferencedFilesFromImportLiteral(file *ast.SourceFile, referencedFiles *collections.Set[tspath.Path], checker *checker.Checker, importName *ast.LiteralLikeNode) { + symbol := checker.GetSymbolAtLocation(importName) + if symbol == nil { + return + } + for _, declaration := range symbol.Declarations { + fileOfDecl := ast.GetSourceFileOfNode(declaration) + if fileOfDecl == nil { + continue + } + if file != fileOfDecl { + referencedFiles.Add(fileOfDecl.Path()) + } + } +} + +/** +* Gets the path to reference file from file name, it could be resolvedPath if present otherwise path + */ +func addReferencedFileFromFileName(program *compiler.Program, fileName string, referencedFiles *collections.Set[tspath.Path], sourceFileDirectory string) { + if redirect := program.GetParseFileRedirect(fileName); redirect != "" { + referencedFiles.Add(tspath.ToPath(redirect, program.GetCurrentDirectory(), program.UseCaseSensitiveFileNames())) + } else { + referencedFiles.Add(tspath.ToPath(fileName, sourceFileDirectory, program.UseCaseSensitiveFileNames())) + } +} + +/** + * Gets the referenced files for a file from the program with values for the keys as referenced file's path to be true + */ +func getReferencedFiles(program *compiler.Program, file *ast.SourceFile) *collections.Set[tspath.Path] { + referencedFiles := collections.Set[tspath.Path]{} + + // We need to use a set here since the code can contain the same import twice, + // but that will only be one dependency. + // To avoid invernal conversion, the key of the referencedFiles map must be of type Path + if len(file.Imports()) > 0 || len(file.ModuleAugmentations) > 0 { + checker, done := program.GetTypeCheckerForFile(context.TODO(), file) + for _, importName := range file.Imports() { + addReferencedFilesFromImportLiteral(file, &referencedFiles, checker, importName) + } + // Add module augmentation as references + for _, moduleName := range file.ModuleAugmentations { + if !ast.IsStringLiteral(moduleName) { + continue + } + addReferencedFilesFromImportLiteral(file, &referencedFiles, checker, moduleName) + } + done() + } + + sourceFileDirectory := tspath.GetDirectoryPath(file.FileName()) + // Handle triple slash references + for _, referencedFile := range file.ReferencedFiles { + addReferencedFileFromFileName(program, referencedFile.FileName, &referencedFiles, sourceFileDirectory) + } + + // Handle type reference directives + if typeRefsInFile, ok := program.GetResolvedTypeReferenceDirectives()[file.Path()]; ok { + for _, typeRef := range typeRefsInFile { + if typeRef.ResolvedFileName != "" { + addReferencedFileFromFileName(program, typeRef.ResolvedFileName, &referencedFiles, sourceFileDirectory) + } + } + } + + // !!! sheetal + // // From ambient modules + // for (const ambientModule of program.getTypeChecker().getAmbientModules()) { + // if (ambientModule.declarations && ambientModule.declarations.length > 1) { + // addReferenceFromAmbientModule(ambientModule); + // } + // } + return core.IfElse(referencedFiles.Len() > 0, &referencedFiles, nil) +} diff --git a/internal/incremental/tobuildinfo.go b/internal/incremental/tobuildinfo.go new file mode 100644 index 0000000000..d79e1113ea --- /dev/null +++ b/internal/incremental/tobuildinfo.go @@ -0,0 +1,319 @@ +package incremental + +import ( + "fmt" + "maps" + "slices" + "strings" + + "github.com/microsoft/typescript-go/internal/ast" + "github.com/microsoft/typescript-go/internal/collections" + "github.com/microsoft/typescript-go/internal/compiler" + "github.com/microsoft/typescript-go/internal/core" + "github.com/microsoft/typescript-go/internal/tsoptions" + "github.com/microsoft/typescript-go/internal/tspath" +) + +func programStateToBuildInfo(state *programState, program *compiler.Program, buildInfoFileName string) *BuildInfo { + to := &toBuildInfo{ + state: state, + program: program, + buildInfoDirectory: tspath.GetDirectoryPath(buildInfoFileName), + comparePathsOptions: tspath.ComparePathsOptions{ + CurrentDirectory: program.GetCurrentDirectory(), + UseCaseSensitiveFileNames: program.UseCaseSensitiveFileNames(), + }, + fileNameToFileId: make(map[string]incrementalBuildInfoFileId), + fileNamesToFileIdListId: make(map[string]incrementalBuildInfoFileIdListId), + } + to.buildInfo.Version = core.Version() + if state.options.IsIncremental() { + to.setFileInfoAndEmitSignatures() + to.setCompilerOptions() + to.setReferenceMap() + to.setChangeFileSet() + to.setSemanticDiagnostics() + to.setEmitDiagnostics() + to.setAffectedFilesPendingEmit() + if state.latestChangedDtsFile != "" { + to.buildInfo.LatestChangedDtsFile = to.relativeToBuildInfo(state.latestChangedDtsFile) + } + } + // else { + // const buildInfo: NonIncrementalBuildInfo = { + // root: arrayFrom(rootFileNames, r => relativeToBuildInfo(r)), + // }; + // } + to.buildInfo.Errors = state.hasErrors.IsTrue() + to.buildInfo.CheckPending = state.checkPending + return &to.buildInfo +} + +type toBuildInfo struct { + state *programState + program *compiler.Program + buildInfo BuildInfo + buildInfoDirectory string + comparePathsOptions tspath.ComparePathsOptions + fileNameToFileId map[string]incrementalBuildInfoFileId + fileNamesToFileIdListId map[string]incrementalBuildInfoFileIdListId +} + +func (t *toBuildInfo) relativeToBuildInfo(path string) string { + return tspath.EnsurePathIsNonModuleName(tspath.GetRelativePathFromDirectory(t.buildInfoDirectory, path, t.comparePathsOptions)) +} + +func (t *toBuildInfo) toFileId(path tspath.Path) incrementalBuildInfoFileId { + fileId := t.fileNameToFileId[string(path)] + if fileId == 0 { + t.buildInfo.FileNames = append(t.buildInfo.FileNames, t.relativeToBuildInfo(string(path))) + fileId = incrementalBuildInfoFileId(len(t.buildInfo.FileNames)) + t.fileNameToFileId[string(path)] = fileId + } + return fileId +} + +func (t *toBuildInfo) toFileIdListId(set *collections.Set[tspath.Path]) incrementalBuildInfoFileIdListId { + fileIds := core.Map(slices.Collect(maps.Keys(set.Keys())), t.toFileId) + slices.Sort(fileIds) + key := strings.Join(core.Map(fileIds, func(id incrementalBuildInfoFileId) string { + return fmt.Sprintf("%d", id) + }), ",") + + fileIdListId := t.fileNamesToFileIdListId[key] + if fileIdListId == 0 { + t.buildInfo.FileIdsList = append(t.buildInfo.FileIdsList, fileIds) + fileIdListId = incrementalBuildInfoFileIdListId(len(t.buildInfo.FileIdsList)) + t.fileNamesToFileIdListId[key] = fileIdListId + } + return fileIdListId +} + +func (t *toBuildInfo) toRelativeToBuildInfoCompilerOptionValue(option *tsoptions.CommandLineOption, v any) any { + if !option.IsFilePath { + return v + } + if option.Kind == "list" { + if arr, ok := v.([]string); ok { + return core.Map(arr, func(item string) string { + return t.relativeToBuildInfo(item) + }) + } + } else { + return t.relativeToBuildInfo(v.(string)) + } + return v +} + +func (t *toBuildInfo) toDiagnosticCompatibleWithBuildInfo(diagnostics []*incrementalBuildInfoDiagnostic) ([]*incrementalBuildInfoDiagnostic, bool) { + var fixedDiagnostics []*incrementalBuildInfoDiagnostic + var changed bool + for _, d := range diagnostics { + file := d.file + if d.file != false && d.file != "" { + file = t.toFileId(d.file.(tspath.Path)) + } + messageChain, changedMessageChain := t.toDiagnosticCompatibleWithBuildInfo(d.messageChain) + relatedInformation, changedRelatedInformation := t.toDiagnosticCompatibleWithBuildInfo(d.relatedInformation) + if file != d.file || changedMessageChain || changedRelatedInformation { + fixedDiagnostics = append(fixedDiagnostics, &incrementalBuildInfoDiagnostic{ + file: file, + loc: d.loc, + code: d.code, + category: d.category, + message: d.message, + messageChain: messageChain, + relatedInformation: relatedInformation, + reportsUnnecessary: d.reportsUnnecessary, + reportsDeprecated: d.reportsDeprecated, + skippedOnNoEmit: d.skippedOnNoEmit, + }) + changed = true + } else { + fixedDiagnostics = append(fixedDiagnostics, d) + } + } + return core.IfElse(changed, fixedDiagnostics, diagnostics), changed +} + +func (t *toBuildInfo) toIncrementalBuildInfoDiagnostic(diagnostics []*ast.Diagnostic, file *ast.SourceFile) []*incrementalBuildInfoDiagnostic { + var incrementalDiagnostics []*incrementalBuildInfoDiagnostic + for _, d := range diagnostics { + var fileValue any + if d.File() == nil { + fileValue = false + } else if d.File() != file { + fileValue = t.toFileId(d.File().Path()) + } + incrementalDiagnostics = append(incrementalDiagnostics, &incrementalBuildInfoDiagnostic{ + file: fileValue, + loc: d.Loc(), + code: d.Code(), + category: d.Category(), + message: d.Message(), + messageChain: t.toIncrementalBuildInfoDiagnostic(d.MessageChain(), file), + relatedInformation: t.toIncrementalBuildInfoDiagnostic(d.RelatedInformation(), file), + reportsUnnecessary: d.ReportsUnnecessary(), + reportsDeprecated: d.ReportsDeprecated(), + skippedOnNoEmit: d.SkippedOnNoEmit(), + }) + } + return incrementalDiagnostics +} + +func (t *toBuildInfo) setFileInfoAndEmitSignatures() { + for _, file := range t.program.GetSourceFiles() { + info := t.state.fileInfos[file.Path()] + fileId := t.toFileId(file.Path()) + // tryAddRoot(key, fileId); + if t.buildInfo.FileNames[fileId-1] != t.relativeToBuildInfo(string(file.Path())) { + panic(fmt.Sprintf("File name at index %d does not match expected relative path: %s != %s", fileId-1, t.buildInfo.FileNames[fileId-1], t.relativeToBuildInfo(string(file.Path())))) + } + var actualSignature string + if oldSignature, gotOldSignature := t.state.oldSignatures[file.Path()]; gotOldSignature { + actualSignature = oldSignature + } else { + actualSignature = info.signature + } + if t.state.options.Composite.IsTrue() { + if !ast.IsJsonSourceFile(file) && t.program.SourceFileMayBeEmitted(file, false) { + emitSignature := t.state.emitSignatures[file.Path()] + if emitSignature == nil { + t.buildInfo.EmitSignatures = append(t.buildInfo.EmitSignatures, incrementalBuildInfoEmitSignature{ + fileId: fileId, + }) + } else if emitSignature.signature != actualSignature { + incrementalEmitSignature := incrementalBuildInfoEmitSignature{ + fileId: fileId, + } + if emitSignature.signature != "" { + incrementalEmitSignature.signature = emitSignature.signature + } else if emitSignature.signatureWithDifferentOptions[0] == actualSignature { + incrementalEmitSignature.differsOnlyInDtsMap = true + } else { + incrementalEmitSignature.signature = emitSignature.signatureWithDifferentOptions[0] + incrementalEmitSignature.differsInOptions = true + } + t.buildInfo.EmitSignatures = append(t.buildInfo.EmitSignatures, incrementalEmitSignature) + } + } + } + if actualSignature == info.signature { + t.buildInfo.FileInfos = append(t.buildInfo.FileInfos, info) + } else { + t.buildInfo.FileInfos = append(t.buildInfo.FileInfos, &fileInfo{ + version: info.version, + signature: actualSignature, + affectsGlobalScope: info.affectsGlobalScope, + impliedNodeFormat: info.impliedNodeFormat, + }) + } + } +} + +func (t *toBuildInfo) setCompilerOptions() { + tsoptions.ForEachCompilerOptionValue( + t.state.options, func(option *tsoptions.CommandLineOption) bool { + return option.AffectsBuildInfo + }, + func(option *tsoptions.CommandLineOption, value any, i int) bool { + // Make it relative to buildInfo directory if file path + t.buildInfo.Options = append(t.buildInfo.Options, incrementalBuildInfoCompilerOption{ + name: option.Name, + value: t.toRelativeToBuildInfoCompilerOptionValue(option, value), + }) + return false + }, + ) +} + +func (t *toBuildInfo) setReferenceMap() { + if !t.state.tracksReferences() { + return + } + keys := slices.Collect(maps.Keys(t.state.referencedMap.Keys())) + slices.Sort(keys) + for _, filePath := range keys { + references, _ := t.state.referencedMap.GetValues(filePath) + t.buildInfo.ReferencedMap = append(t.buildInfo.ReferencedMap, incrementalBuildInfoReferenceMapEntry{ + fileId: t.toFileId(filePath), + fileIdListId: t.toFileIdListId(references), + }) + } +} + +func (t *toBuildInfo) setChangeFileSet() { + files := slices.Collect(maps.Keys(t.state.changedFilesSet.Keys())) + slices.Sort(files) + for _, filePath := range files { + t.buildInfo.ChangeFileSet = append(t.buildInfo.ChangeFileSet, t.toFileId(filePath)) + } +} + +func (t *toBuildInfo) setSemanticDiagnostics() { + for _, file := range t.program.GetSourceFiles() { + value, ok := t.state.semanticDiagnosticsPerFile[file.Path()] + if !ok { + if !t.state.changedFilesSet.Has(file.Path()) { + t.buildInfo.SemanticDiagnosticsPerFile = append(t.buildInfo.SemanticDiagnosticsPerFile, incrementalBuildInfoSemanticDiagnostic{ + fileId: t.toFileId(file.Path()), + }) + } + } else if len(value.buildInfoDiagnostics) > 0 { + diagnostics, _ := t.toDiagnosticCompatibleWithBuildInfo(value.buildInfoDiagnostics) + t.buildInfo.SemanticDiagnosticsPerFile = append(t.buildInfo.SemanticDiagnosticsPerFile, incrementalBuildInfoSemanticDiagnostic{ + diagnostic: incrementalBuildInfoDiagnosticOfFile{ + fileId: t.toFileId(file.Path()), + diagnostics: diagnostics, + }, + }) + } else if len(value.diagnostics) > 0 { + t.buildInfo.SemanticDiagnosticsPerFile = append(t.buildInfo.SemanticDiagnosticsPerFile, incrementalBuildInfoSemanticDiagnostic{ + diagnostic: incrementalBuildInfoDiagnosticOfFile{ + fileId: t.toFileId(file.Path()), + diagnostics: t.toIncrementalBuildInfoDiagnostic(value.diagnostics, file), + }, + }) + } + } +} + +func (t *toBuildInfo) setEmitDiagnostics() { + files := slices.Collect(maps.Keys(t.state.emitDiagnosticsPerFile)) + slices.Sort(files) + for _, filePath := range files { + value := t.state.emitDiagnosticsPerFile[filePath] + if len(value.buildInfoDiagnostics) > 0 { + diagnostics, _ := t.toDiagnosticCompatibleWithBuildInfo(value.buildInfoDiagnostics) + t.buildInfo.EmitDiagnosticsPerFile = append(t.buildInfo.EmitDiagnosticsPerFile, incrementalBuildInfoDiagnosticOfFile{ + fileId: t.toFileId(filePath), + diagnostics: diagnostics, + }) + } else { + t.buildInfo.EmitDiagnosticsPerFile = append(t.buildInfo.EmitDiagnosticsPerFile, incrementalBuildInfoDiagnosticOfFile{ + fileId: t.toFileId(filePath), + diagnostics: t.toIncrementalBuildInfoDiagnostic(value.diagnostics, t.program.GetSourceFileByPath(filePath)), + }) + } + } +} + +func (t *toBuildInfo) setAffectedFilesPendingEmit() { + if len(t.state.affectedFilesPendingEmit) == 0 { + return + } + files := slices.Collect(maps.Keys(t.state.affectedFilesPendingEmit)) + slices.Sort(files) + fullEmitKind := getFileEmitKind(t.state.options) + for _, filePath := range files { + file := t.program.GetSourceFileByPath(filePath) + if file == nil || !t.program.SourceFileMayBeEmitted(file, false) { + continue + } + pendingEmit := t.state.affectedFilesPendingEmit[filePath] + t.buildInfo.AffectedFilesPendingEmit = append(t.buildInfo.AffectedFilesPendingEmit, incrementalBuildInfoFilePendingEmit{ + fileId: t.toFileId(filePath), + emitKind: core.IfElse(pendingEmit == fullEmitKind, 0, pendingEmit), + }) + } +} diff --git a/internal/incremental/toprogramstate.go b/internal/incremental/toprogramstate.go new file mode 100644 index 0000000000..86874a15aa --- /dev/null +++ b/internal/incremental/toprogramstate.go @@ -0,0 +1,186 @@ +package incremental + +import ( + "github.com/microsoft/typescript-go/internal/collections" + "github.com/microsoft/typescript-go/internal/core" + "github.com/microsoft/typescript-go/internal/tsoptions" + "github.com/microsoft/typescript-go/internal/tspath" +) + +func buildInfoToProgramState(buildInfo *BuildInfo, buildInfoFileName string, config *tsoptions.ParsedCommandLine) *programState { + to := &toProgramState{ + buildInfo: buildInfo, + buildInfoDirectory: tspath.GetDirectoryPath(tspath.GetNormalizedAbsolutePath(buildInfoFileName, config.GetCurrentDirectory())), + filePaths: make([]tspath.Path, 0, len(buildInfo.FileNames)), + filePathSet: make([]*collections.Set[tspath.Path], 0, len(buildInfo.FileIdsList)), + } + for _, fileName := range buildInfo.FileNames { + path := tspath.ToPath(fileName, to.buildInfoDirectory, config.UseCaseSensitiveFileNames()) + to.filePaths = append(to.filePaths, path) + } + for _, fileIdList := range buildInfo.FileIdsList { + fileSet := collections.NewSetWithSizeHint[tspath.Path](len(fileIdList)) + for _, fileId := range fileIdList { + fileSet.Add(to.toFilePath(fileId)) + } + to.filePathSet = append(to.filePathSet, fileSet) + } + to.setCompilerOptions() + to.setFileInfoAndEmitSignatures() + to.setReferenceMap() + to.setChangeFileSet() + to.setSemanticDiagnostics() + to.setEmitDiagnostics() + to.setAffectedFilesPendingEmit() + if buildInfo.LatestChangedDtsFile != "" { + to.state.latestChangedDtsFile = to.toAbsolutePath(buildInfo.LatestChangedDtsFile) + } + to.state.hasErrors = core.IfElse(buildInfo.Errors, core.TSTrue, core.TSFalse) + to.state.checkPending = buildInfo.CheckPending + return &to.state +} + +type toProgramState struct { + buildInfo *BuildInfo + buildInfoDirectory string + state programState + filePaths []tspath.Path + filePathSet []*collections.Set[tspath.Path] +} + +func (t *toProgramState) toAbsolutePath(path string) string { + return tspath.GetNormalizedAbsolutePath(path, t.buildInfoDirectory) +} + +func (t *toProgramState) toFilePath(fileId incrementalBuildInfoFileId) tspath.Path { + return t.filePaths[fileId-1] +} + +func (t *toProgramState) toFilePathSet(fileIdListId incrementalBuildInfoFileIdListId) *collections.Set[tspath.Path] { + return t.filePathSet[fileIdListId-1] +} + +func (t *toProgramState) toDiagnosticCompatibleWithProgramState(diagnostics []*incrementalBuildInfoDiagnostic) ([]*incrementalBuildInfoDiagnostic, bool) { + var fixedDiagnostics []*incrementalBuildInfoDiagnostic + var changed bool + for _, d := range diagnostics { + file := d.file + if d.file != false && d.file != 0 { + file = t.toFilePath(incrementalBuildInfoFileId(d.file.(float64))) + } + messageChain, changedMessageChain := t.toDiagnosticCompatibleWithProgramState(d.messageChain) + relatedInformation, changedRelatedInformation := t.toDiagnosticCompatibleWithProgramState(d.relatedInformation) + if file != d.file || changedMessageChain || changedRelatedInformation { + fixedDiagnostics = append(fixedDiagnostics, &incrementalBuildInfoDiagnostic{ + file: file, + loc: d.loc, + code: d.code, + category: d.category, + message: d.message, + messageChain: messageChain, + relatedInformation: relatedInformation, + reportsUnnecessary: d.reportsUnnecessary, + reportsDeprecated: d.reportsDeprecated, + skippedOnNoEmit: d.skippedOnNoEmit, + }) + changed = true + } else { + fixedDiagnostics = append(fixedDiagnostics, d) + } + } + return core.IfElse(changed, fixedDiagnostics, diagnostics), changed +} + +func (t *toProgramState) setCompilerOptions() { + t.state.options = &core.CompilerOptions{} + for _, option := range t.buildInfo.Options { + value := option.value + result, ok := tsoptions.ConvertOptionToAbsolutePath(option.name, value, tsoptions.CommandLineCompilerOptionsMap, t.buildInfoDirectory) + if ok { + tsoptions.ParseCompilerOptions(option.name, result, t.state.options) + } else { + tsoptions.ParseCompilerOptions(option.name, value, t.state.options) + } + } +} + +func (t *toProgramState) setFileInfoAndEmitSignatures() { + t.state.fileInfos = make(map[tspath.Path]*fileInfo, len(t.buildInfo.FileInfos)) + t.state.createEmitSignaturesMap() + for index, fileInfo := range t.buildInfo.FileInfos { + path := t.toFilePath(incrementalBuildInfoFileId(index + 1)) + t.state.fileInfos[path] = fileInfo + // Add default emit signature as file's signature + if fileInfo.signature != "" && len(t.state.emitSignatures) != 0 { + t.state.emitSignatures[path] = &emitSignature{signature: fileInfo.signature} + } + } + // Fix up emit signatures + for _, value := range t.buildInfo.EmitSignatures { + if value.noEmitSignature() { + delete(t.state.emitSignatures, t.toFilePath(value.fileId)) + } else { + path := t.toFilePath(value.fileId) + t.state.emitSignatures[path] = value.toEmitSignature(path, t.state.emitSignatures) + } + } +} + +func (t *toProgramState) setReferenceMap() { + t.state.createReferenceMap() + for _, entry := range t.buildInfo.ReferencedMap { + t.state.referencedMap.Add(t.toFilePath(entry.fileId), t.toFilePathSet(entry.fileIdListId)) + } +} + +func (t *toProgramState) setChangeFileSet() { + t.state.changedFilesSet = collections.NewSetWithSizeHint[tspath.Path](len(t.buildInfo.ChangeFileSet)) + for _, fileId := range t.buildInfo.ChangeFileSet { + filePath := t.toFilePath(fileId) + t.state.changedFilesSet.Add(filePath) + } +} + +func (t *toProgramState) setSemanticDiagnostics() { + t.state.semanticDiagnosticsPerFile = make(map[tspath.Path]*diagnosticsOrBuildInfoDiagnostics, len(t.state.fileInfos)) + for path := range t.state.fileInfos { + // Initialize to have no diagnostics if its not changed file + if !t.state.changedFilesSet.Has(path) { + t.state.semanticDiagnosticsPerFile[path] = &diagnosticsOrBuildInfoDiagnostics{} + } + } + for _, diagnostic := range t.buildInfo.SemanticDiagnosticsPerFile { + if diagnostic.fileId != 0 { + filePath := t.toFilePath(diagnostic.fileId) + delete(t.state.semanticDiagnosticsPerFile, filePath) // does not have cached diagnostics + } else { + filePath := t.toFilePath(diagnostic.diagnostic.fileId) + diagnostics, _ := t.toDiagnosticCompatibleWithProgramState(diagnostic.diagnostic.diagnostics) + t.state.semanticDiagnosticsPerFile[filePath] = &diagnosticsOrBuildInfoDiagnostics{ + buildInfoDiagnostics: diagnostics, + } + } + } +} + +func (t *toProgramState) setEmitDiagnostics() { + t.state.emitDiagnosticsPerFile = make(map[tspath.Path]*diagnosticsOrBuildInfoDiagnostics, len(t.state.fileInfos)) + for _, diagnostic := range t.buildInfo.EmitDiagnosticsPerFile { + filePath := t.toFilePath(diagnostic.fileId) + diagnostics, _ := t.toDiagnosticCompatibleWithProgramState(diagnostic.diagnostics) + t.state.emitDiagnosticsPerFile[filePath] = &diagnosticsOrBuildInfoDiagnostics{ + buildInfoDiagnostics: diagnostics, + } + } +} + +func (t *toProgramState) setAffectedFilesPendingEmit() { + if len(t.buildInfo.AffectedFilesPendingEmit) == 0 { + return + } + ownOptionsEmitKind := getFileEmitKind(t.state.options) + t.state.affectedFilesPendingEmit = make(map[tspath.Path]fileEmitKind, len(t.buildInfo.AffectedFilesPendingEmit)) + for _, pendingEmit := range t.buildInfo.AffectedFilesPendingEmit { + t.state.affectedFilesPendingEmit[t.toFilePath(pendingEmit.fileId)] = core.IfElse(pendingEmit.emitKind == 0, ownOptionsEmitKind, pendingEmit.emitKind) + } +} diff --git a/internal/outputpaths/outputpaths.go b/internal/outputpaths/outputpaths.go index 60cac7d6e2..2adbdd3805 100644 --- a/internal/outputpaths/outputpaths.go +++ b/internal/outputpaths/outputpaths.go @@ -19,7 +19,6 @@ type OutputPaths struct { sourceMapFilePath string declarationFilePath string declarationMapPath string - buildInfoPath string } // DeclarationFilePath implements declarations.OutputPaths. @@ -40,10 +39,6 @@ func (o *OutputPaths) DeclarationMapPath() string { return o.declarationMapPath } -func (o *OutputPaths) BuildInfoPath() string { - return o.buildInfoPath -} - func GetOutputPathsFor(sourceFile *ast.SourceFile, options *core.CompilerOptions, host OutputPathsHost, forceDtsEmit bool) *OutputPaths { // !!! bundle not implemented, may be deprecated ownOutputFilePath := getOwnEmitOutputFilePath(sourceFile.FileName(), options, host, GetOutputExtension(sourceFile.FileName(), options.Jsx)) @@ -199,3 +194,27 @@ func getDeclarationEmitExtensionForPath(fileName string) string { } return tspath.ExtensionDts } + +func GetBuildInfoFileName(options *core.CompilerOptions, opts tspath.ComparePathsOptions) string { + if !options.IsIncremental() && !options.TscBuild.IsTrue() { + return "" + } + if options.TsBuildInfoFile != "" { + return options.TsBuildInfoFile + } + if options.ConfigFilePath == "" { + return "" + } + configFileExtensionLess := tspath.RemoveFileExtension(options.ConfigFilePath) + var buildInfoExtensionLess string + if options.OutDir != "" { + if options.RootDir != "" { + buildInfoExtensionLess = tspath.ResolvePath(options.OutDir, tspath.GetRelativePathFromDirectory(options.RootDir, configFileExtensionLess, opts)) + } else { + buildInfoExtensionLess = tspath.CombinePaths(options.OutDir, tspath.GetBaseFileName(configFileExtensionLess)) + } + } else { + buildInfoExtensionLess = configFileExtensionLess + } + return buildInfoExtensionLess + tspath.ExtensionTsBuildInfo +} diff --git a/internal/printer/emithost.go b/internal/printer/emithost.go index 121ac712fc..901598392f 100644 --- a/internal/printer/emithost.go +++ b/internal/printer/emithost.go @@ -7,14 +7,6 @@ import ( "github.com/microsoft/typescript-go/internal/tspath" ) -type WriteFileData struct { - SourceMapUrlPos int - // BuildInfo BuildInfo - Diagnostics []*ast.Diagnostic - DiffersOnlyInMap bool - SkippedDtsWrite bool -} - // NOTE: EmitHost operations must be thread-safe type EmitHost interface { Options() *core.CompilerOptions @@ -23,7 +15,7 @@ type EmitHost interface { GetCurrentDirectory() string CommonSourceDirectory() string IsEmitBlocked(file string) bool - WriteFile(fileName string, text string, writeByteOrderMark bool, relatedSourceFiles []*ast.SourceFile, data *WriteFileData) error + WriteFile(fileName string, text string, writeByteOrderMark bool) error GetEmitModuleFormatOfFile(file ast.HasFileName) core.ModuleKind GetEmitResolver() EmitResolver GetOutputAndProjectReference(path tspath.Path) *tsoptions.OutputDtsAndProjectReference diff --git a/internal/testutil/harnessutil/harnessutil.go b/internal/testutil/harnessutil/harnessutil.go index 043bfa27cb..fe64f8fe1a 100644 --- a/internal/testutil/harnessutil/harnessutil.go +++ b/internal/testutil/harnessutil/harnessutil.go @@ -585,7 +585,7 @@ func compileFilesWithHost( if harnessOptions.CaptureSuggestions { diagnostics = append(diagnostics, program.GetSuggestionDiagnostics(ctx, nil)...) } - emitResult := program.Emit(compiler.EmitOptions{}) + emitResult := program.Emit(ctx, compiler.EmitOptions{}) return newCompilationResult(config.CompilerOptions(), program, emitResult, diagnostics, harnessOptions) } diff --git a/internal/tsoptions/commandlineoption.go b/internal/tsoptions/commandlineoption.go index 3997c0aebe..f0eb8e8d23 100644 --- a/internal/tsoptions/commandlineoption.go +++ b/internal/tsoptions/commandlineoption.go @@ -23,7 +23,7 @@ type CommandLineOption struct { Kind CommandLineOptionKind // used in parsing - isFilePath bool + IsFilePath bool IsTSConfigOnly bool IsCommandLineOnly bool @@ -100,12 +100,12 @@ var commandLineOptionElements = map[string]*CommandLineOption{ "rootDirs": { Name: "rootDirs", Kind: CommandLineOptionTypeString, - isFilePath: true, + IsFilePath: true, }, "typeRoots": { Name: "typeRoots", Kind: CommandLineOptionTypeString, - isFilePath: true, + IsFilePath: true, }, "types": { Name: "types", @@ -148,13 +148,13 @@ var commandLineOptionElements = map[string]*CommandLineOption{ "excludeDirectories": { Name: "excludeDirectory", Kind: CommandLineOptionTypeString, - isFilePath: true, + IsFilePath: true, extraValidation: true, }, "excludeFiles": { Name: "excludeFile", Kind: CommandLineOptionTypeString, - isFilePath: true, + IsFilePath: true, extraValidation: true, }, // Test infra options diff --git a/internal/tsoptions/commandlineparser.go b/internal/tsoptions/commandlineparser.go index e7dc88696b..4064cad038 100644 --- a/internal/tsoptions/commandlineparser.go +++ b/internal/tsoptions/commandlineparser.go @@ -46,7 +46,7 @@ func ParseCommandLine( commandLine = []string{} } parser := parseCommandLineWorker(CompilerOptionsDidYouMeanDiagnostics, commandLine, host.FS()) - optionsWithAbsolutePaths := convertToOptionsWithAbsolutePaths(parser.options, commandLineCompilerOptionsMap, host.GetCurrentDirectory()) + optionsWithAbsolutePaths := convertToOptionsWithAbsolutePaths(parser.options, CommandLineCompilerOptionsMap, host.GetCurrentDirectory()) compilerOptions := convertMapToOptions(optionsWithAbsolutePaths, &compilerOptionsParser{&core.CompilerOptions{}}).CompilerOptions watchOptions := convertMapToOptions(optionsWithAbsolutePaths, &watchOptionsParser{&core.WatchOptions{}}).WatchOptions return &ParsedCommandLine{ diff --git a/internal/tsoptions/declscompiler.go b/internal/tsoptions/declscompiler.go index c378ad896a..1fade2d816 100644 --- a/internal/tsoptions/declscompiler.go +++ b/internal/tsoptions/declscompiler.go @@ -1,6 +1,7 @@ package tsoptions import ( + "reflect" "slices" "github.com/microsoft/typescript-go/internal/core" @@ -100,7 +101,7 @@ var optionsForCompiler = []*CommandLineOption{ { Name: "generateCpuProfile", Kind: CommandLineOptionTypeString, - isFilePath: true, + IsFilePath: true, Category: diagnostics.Compiler_Diagnostics, Description: diagnostics.Emit_a_v8_CPU_profile_of_the_compiler_run_for_debugging, DefaultValueDescription: "profile.cpuprofile", @@ -109,7 +110,7 @@ var optionsForCompiler = []*CommandLineOption{ { Name: "generateTrace", Kind: CommandLineOptionTypeString, - isFilePath: true, + IsFilePath: true, Category: diagnostics.Compiler_Diagnostics, Description: diagnostics.Generates_an_event_trace_and_a_list_of_types, }, @@ -228,7 +229,7 @@ var optionsForCompiler = []*CommandLineOption{ { Name: "pprofDir", Kind: CommandLineOptionTypeString, - isFilePath: true, + IsFilePath: true, Category: diagnostics.Command_line_Options, Description: diagnostics.Generate_pprof_CPU_Slashmemory_profiles_to_the_given_directory, }, @@ -267,7 +268,7 @@ var commonOptionsWithBuild = []*CommandLineOption{ Name: "project", ShortName: "p", Kind: CommandLineOptionTypeString, - isFilePath: true, + IsFilePath: true, ShowInSimplifiedHelpView: true, Category: diagnostics.Command_line_Options, Description: diagnostics.Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json, @@ -376,7 +377,7 @@ var commonOptionsWithBuild = []*CommandLineOption{ AffectsEmit: true, AffectsBuildInfo: true, AffectsDeclarationPath: true, - isFilePath: true, + IsFilePath: true, ShowInSimplifiedHelpView: true, Category: diagnostics.Emit, Description: diagnostics.Specify_a_file_that_bundles_all_outputs_into_one_JavaScript_file_If_declaration_is_true_also_designates_a_file_that_bundles_all_d_ts_output, @@ -388,7 +389,7 @@ var commonOptionsWithBuild = []*CommandLineOption{ AffectsEmit: true, AffectsBuildInfo: true, AffectsDeclarationPath: true, - isFilePath: true, + IsFilePath: true, ShowInSimplifiedHelpView: true, Category: diagnostics.Emit, Description: diagnostics.Specify_an_output_folder_for_all_emitted_files, @@ -399,7 +400,7 @@ var commonOptionsWithBuild = []*CommandLineOption{ AffectsEmit: true, AffectsBuildInfo: true, AffectsDeclarationPath: true, - isFilePath: true, + IsFilePath: true, Category: diagnostics.Modules, Description: diagnostics.Specify_the_root_folder_within_your_source_files, DefaultValueDescription: diagnostics.Computed_from_the_list_of_input_files, @@ -420,7 +421,7 @@ var commonOptionsWithBuild = []*CommandLineOption{ Kind: CommandLineOptionTypeString, AffectsEmit: true, AffectsBuildInfo: true, - isFilePath: true, + IsFilePath: true, Category: diagnostics.Projects, transpileOptionValue: core.TSUnknown, DefaultValueDescription: ".tsbuildinfo", @@ -704,7 +705,7 @@ var commonOptionsWithBuild = []*CommandLineOption{ Name: "baseUrl", Kind: CommandLineOptionTypeString, AffectsModuleResolution: true, - isFilePath: true, + IsFilePath: true, Category: diagnostics.Modules, Description: diagnostics.Specify_the_base_directory_to_resolve_non_relative_module_names, }, @@ -945,7 +946,7 @@ var commonOptionsWithBuild = []*CommandLineOption{ AffectsEmit: true, AffectsBuildInfo: true, AffectsDeclarationPath: true, - isFilePath: false, // This is intentionally broken to support compatibility with existing tsconfig files + IsFilePath: false, // This is intentionally broken to support compatibility with existing tsconfig files // for correct behaviour, please use outFile Category: diagnostics.Backwards_Compatibility, transpileOptionValue: core.TSUnknown, @@ -1109,7 +1110,7 @@ var commonOptionsWithBuild = []*CommandLineOption{ AffectsEmit: true, AffectsBuildInfo: true, AffectsDeclarationPath: true, - isFilePath: true, + IsFilePath: true, Category: diagnostics.Emit, transpileOptionValue: core.TSUnknown, Description: diagnostics.Specify_the_output_directory_for_generated_declaration_files, @@ -1236,3 +1237,58 @@ var commonOptionsWithBuild = []*CommandLineOption{ DefaultValueDescription: core.TSUnknown, }, } + +var optionsType = reflect.TypeFor[core.CompilerOptions]() + +func optionsHaveChanges(oldOptions *core.CompilerOptions, newOptions *core.CompilerOptions, declFilter func(*CommandLineOption) bool) bool { + if oldOptions == newOptions { + return false + } + if oldOptions == nil || newOptions == nil { + return true + } + oldOptionsValue := reflect.ValueOf(oldOptions).Elem() + return ForEachCompilerOptionValue(newOptions, declFilter, func(option *CommandLineOption, value any, i int) bool { + return !reflect.DeepEqual(value, oldOptionsValue.Field(i)) + }) +} + +func ForEachCompilerOptionValue(options *core.CompilerOptions, declFilter func(*CommandLineOption) bool, fn func(option *CommandLineOption, value any, i int) bool) bool { + optionsValue := reflect.ValueOf(options).Elem() + for i := range optionsValue.NumField() { + field := optionsType.Field(i) + if !field.IsExported() { + continue + } + if optionDeclaration, ok := CommandLineCompilerOptionsMap[field.Name]; ok && declFilter(optionDeclaration) { + if fn(optionDeclaration, optionsValue.Field(i), i) { + return true + } + } + } + return false +} + +func CompilerOptionsAffectSemanticDiagnostics( + oldOptions *core.CompilerOptions, + newOptions *core.CompilerOptions, +) bool { + return optionsHaveChanges(oldOptions, newOptions, func(option *CommandLineOption) bool { + return option.AffectsSemanticDiagnostics + }) +} + +func CompilerOptionsAffectDeclarationPath( + oldOptions *core.CompilerOptions, + newOptions *core.CompilerOptions, +) bool { + return optionsHaveChanges(oldOptions, newOptions, func(option *CommandLineOption) bool { + return option.AffectsDeclarationPath + }) +} + +func CompilerOptionsAffectEmit(oldOptions *core.CompilerOptions, newOptions *core.CompilerOptions) bool { + return optionsHaveChanges(oldOptions, newOptions, func(option *CommandLineOption) bool { + return option.AffectsEmit + }) +} diff --git a/internal/tsoptions/parsinghelpers.go b/internal/tsoptions/parsinghelpers.go index 6f4dd7466e..73454e288f 100644 --- a/internal/tsoptions/parsinghelpers.go +++ b/internal/tsoptions/parsinghelpers.go @@ -547,19 +547,27 @@ func convertToOptionsWithAbsolutePaths(optionsBase *collections.OrderedMap[strin return nil } for o, v := range optionsBase.Entries() { - option := optionMap[o] - if option == nil || !option.isFilePath { - continue - } - if option.Kind == "list" { - if arr, ok := v.([]string); ok { - optionsBase.Set(o, core.Map(arr, func(item string) string { - return tspath.GetNormalizedAbsolutePath(item, cwd) - })) - } - } else { - optionsBase.Set(o, tspath.GetNormalizedAbsolutePath(v.(string), cwd)) + result, ok := ConvertOptionToAbsolutePath(o, v, optionMap, cwd) + if ok { + optionsBase.Set(o, result) } } return optionsBase } + +func ConvertOptionToAbsolutePath(o string, v any, optionMap map[string]*CommandLineOption, cwd string) (any, bool) { + option := optionMap[o] + if option == nil || !option.IsFilePath { + return nil, false + } + if option.Kind == "list" { + if arr, ok := v.([]string); ok { + return core.Map(arr, func(item string) string { + return tspath.GetNormalizedAbsolutePath(item, cwd) + }), true + } + } else { + return tspath.GetNormalizedAbsolutePath(v.(string), cwd), true + } + return nil, false +} diff --git a/internal/tsoptions/tsconfigparsing.go b/internal/tsoptions/tsconfigparsing.go index 5204f58e80..88152c4941 100644 --- a/internal/tsoptions/tsconfigparsing.go +++ b/internal/tsoptions/tsconfigparsing.go @@ -34,7 +34,7 @@ type extendsResult struct { var compilerOptionsDeclaration = &CommandLineOption{ Name: "compilerOptions", Kind: CommandLineOptionTypeObject, - ElementOptions: commandLineCompilerOptionsMap, + ElementOptions: CommandLineCompilerOptionsMap, } var compileOnSaveCommandLineOption = &CommandLineOption{ @@ -391,7 +391,7 @@ func startsWithConfigDirTemplate(value any) bool { } func normalizeNonListOptionValue(option *CommandLineOption, basePath string, value any) any { - if option.isFilePath { + if option.IsFilePath { value = tspath.NormalizeSlashes(value.(string)) if !startsWithConfigDirTemplate(value) { value = tspath.GetNormalizedAbsolutePath(value.(string), basePath) @@ -543,7 +543,7 @@ func commandLineOptionsToMap(compilerOptions []*CommandLineOption) map[string]*C return result } -var commandLineCompilerOptionsMap map[string]*CommandLineOption = commandLineOptionsToMap(OptionsDeclarations) +var CommandLineCompilerOptionsMap map[string]*CommandLineOption = commandLineOptionsToMap(OptionsDeclarations) func convertMapToOptions[O optionParser](compilerOptions *collections.OrderedMap[string, any], result O) O { // this assumes any `key`, `value` pair in `options` will have `value` already be the correct type. this function should no error handling @@ -836,7 +836,7 @@ func getDefaultTypeAcquisition(configFileName string) *core.TypeAcquisition { func convertCompilerOptionsFromJsonWorker(jsonOptions any, basePath string, configFileName string) (*core.CompilerOptions, []*ast.Diagnostic) { options := getDefaultCompilerOptions(configFileName) - _, errors := convertOptionsFromJson(commandLineCompilerOptionsMap, jsonOptions, basePath, &compilerOptionsParser{options}) + _, errors := convertOptionsFromJson(CommandLineCompilerOptionsMap, jsonOptions, basePath, &compilerOptionsParser{options}) if configFileName != "" { options.ConfigFilePath = tspath.NormalizeSlashes(configFileName) } From 8301ea5bf8ef7c7771780103f7b9e54c303b0e73 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 26 Jun 2025 11:13:57 -0700 Subject: [PATCH 04/36] Make buildinfo tests portable and readable --- internal/execute/testsys_test.go | 11 +- internal/incremental/buildInfo.go | 411 +++++++++--------- internal/incremental/programstate.go | 9 +- internal/incremental/tobuildinfo.go | 87 ++-- internal/incremental/toprogramstate.go | 33 +- internal/testutil/incrementaltestutil/fs.go | 111 +++++ .../incrementaltestutil/readablebuildinfo.go | 163 +++++++ 7 files changed, 566 insertions(+), 259 deletions(-) create mode 100644 internal/testutil/incrementaltestutil/fs.go create mode 100644 internal/testutil/incrementaltestutil/readablebuildinfo.go diff --git a/internal/execute/testsys_test.go b/internal/execute/testsys_test.go index 92eda1f4ad..1e371ea891 100644 --- a/internal/execute/testsys_test.go +++ b/internal/execute/testsys_test.go @@ -11,6 +11,7 @@ import ( "time" "github.com/microsoft/typescript-go/internal/bundled" + "github.com/microsoft/typescript-go/internal/testutil/incrementaltestutil" "github.com/microsoft/typescript-go/internal/vfs" "github.com/microsoft/typescript-go/internal/vfs/vfstest" ) @@ -22,7 +23,7 @@ func newTestSys(fileOrFolderList FileMap, cwd string, args ...string) *testSys { cwd = "/home/src/workspaces/project" } return &testSys{ - fs: bundled.WrapFS(vfstest.FromMap(fileOrFolderList, true /*useCaseSensitiveFileNames*/)), + fs: incrementaltestutil.NewFsHandlingBuildInfo(bundled.WrapFS(vfstest.FromMap(fileOrFolderList, true /*useCaseSensitiveFileNames*/))), defaultLibraryPath: bundled.LibPath(), cwd: cwd, files: slices.Collect(maps.Keys(fileOrFolderList)), @@ -38,7 +39,7 @@ type testSys struct { currentWrite *strings.Builder serializedDiff map[string]string - fs vfs.FS + fs *incrementaltestutil.FsHandlingBuildInfo defaultLibraryPath string cwd string files []string @@ -64,6 +65,10 @@ func (s *testSys) FS() vfs.FS { return s.fs } +func (s *testSys) TestFS() *incrementaltestutil.FsHandlingBuildInfo { + return s.fs +} + func (s *testSys) DefaultLibraryPath() string { return s.defaultLibraryPath } @@ -121,7 +126,7 @@ func (s *testSys) baselineFSwithDiff(baseline io.Writer) { return nil } - newContents, ok := s.FS().ReadFile(path) + newContents, ok := s.TestFS().FS().ReadFile(path) if !ok { return nil } diff --git a/internal/incremental/buildInfo.go b/internal/incremental/buildInfo.go index 72f7a0ad02..e7b9d52ffc 100644 --- a/internal/incremental/buildInfo.go +++ b/internal/incremental/buildInfo.go @@ -12,8 +12,8 @@ import ( ) type ( - incrementalBuildInfoFileId int - incrementalBuildInfoFileIdListId int + BuildInfoFileId int + BuildInfoFileIdListId int ) // /** @@ -63,97 +63,96 @@ type ( // return fmt.Errorf("invalid BuildInfoRoot: %s", data) // } +type buildInfoFileInfoNoSignature struct { + Version string `json:"version,omitzero"` + NoSignature bool `json:"noSignature,omitzero"` + AffectsGlobalScope bool `json:"affectsGlobalScope,omitzero"` + ImpliedNodeFormat core.ResolutionMode `json:"impliedNodeFormat,omitzero"` +} + /** -* - string if FileInfo.version === FileInfo.signature && !FileInfo.affectsGlobalScope -* - otherwise encoded FileInfo -* Signature is -* - undefined if FileInfo.version === FileInfo.signature -* - false if FileInfo has signature as undefined (not calculated) -* - string actual signature + * Signature is + * - undefined if FileInfo.version === FileInfo.signature + * - string actual signature */ -func (f *fileInfo) MarshalJSON() ([]byte, error) { - if f.version == f.signature && !f.affectsGlobalScope && f.impliedNodeFormat == core.ResolutionModeNone { - return json.Marshal(f.version) - } - info := map[string]any{} - if f.version != "" { - info["version"] = f.version - } - if f.signature != f.version { - if f.signature == "" { - info["signature"] = false - } else { - info["signature"] = f.signature +type buildInfoFileInfoWithSignature struct { + Version string `json:"version,omitzero"` + Signature string `json:"signature,omitzero"` + AffectsGlobalScope bool `json:"affectsGlobalScope,omitzero"` + ImpliedNodeFormat core.ResolutionMode `json:"impliedNodeFormat,omitzero"` +} + +type BuildInfoFileInfo struct { + signature string + noSignature *buildInfoFileInfoNoSignature + fileInfo *buildInfoFileInfoWithSignature +} + +func (b *BuildInfoFileInfo) HasSignature() bool { + return b.signature != "" +} + +func (b *BuildInfoFileInfo) GetFileInfo() *fileInfo { + if b.signature != "" { + return &fileInfo{ + version: b.signature, + signature: b.signature, } } - if f.affectsGlobalScope { - info["affectsGlobalScope"] = f.affectsGlobalScope + if b.noSignature != nil { + return &fileInfo{ + version: b.noSignature.Version, + affectsGlobalScope: b.noSignature.AffectsGlobalScope, + impliedNodeFormat: b.noSignature.ImpliedNodeFormat, + } } - if f.impliedNodeFormat != core.ResolutionModeNone { - info["impliedNodeFormat"] = f.impliedNodeFormat + return &fileInfo{ + version: b.fileInfo.Version, + signature: core.IfElse(b.fileInfo.Signature == "", b.fileInfo.Version, b.fileInfo.Signature), + affectsGlobalScope: b.fileInfo.AffectsGlobalScope, + impliedNodeFormat: b.fileInfo.ImpliedNodeFormat, } - return json.Marshal(info) } -func (f *fileInfo) UnmarshalJSON(data []byte) error { - var version string - if err := json.Unmarshal(data, &version); err == nil { - *f = fileInfo{ - version: version, - signature: version, - } - return nil +func (b *BuildInfoFileInfo) MarshalJSON() ([]byte, error) { + if b.signature != "" { + return json.Marshal(b.signature) } - - var vFileInfo map[string]any - if err := json.Unmarshal(data, &vFileInfo); err != nil { - return fmt.Errorf("invalid fileInfo: %s", data) + if b.noSignature != nil { + return json.Marshal(b.noSignature) } + return json.Marshal(b.fileInfo) +} - *f = fileInfo{} - if version, ok := vFileInfo["version"]; ok { - f.version = version.(string) - } - if signature, ok := vFileInfo["signature"]; ok { - if signature == false { - f.signature = "" - } else if f.signature, ok = signature.(string); !ok { - return fmt.Errorf("invalid signature in fileInfo: expected string or false, got %T", signature) - } - } else { - f.signature = f.version // default to version if no signature provided +func (b *BuildInfoFileInfo) UnmarshalJSON(data []byte) error { + var vSignature string + if err := json.Unmarshal(data, &vSignature); err == nil { + *b = BuildInfoFileInfo{signature: vSignature} + return nil } - if affectsGlobalScope, ok := vFileInfo["affectsGlobalScope"]; ok { - if f.affectsGlobalScope, ok = affectsGlobalScope.(bool); !ok { - return fmt.Errorf("invalid affectsGlobalScope in fileInfo: expected bool, got %T", affectsGlobalScope) - } + var noSignature buildInfoFileInfoNoSignature + if err := json.Unmarshal(data, &noSignature); err == nil && noSignature.NoSignature { + *b = BuildInfoFileInfo{noSignature: &noSignature} + return nil } - if impliedNodeFormatV, ok := vFileInfo["impliedNodeFormat"]; ok { - if impliedNodeFormat, ok := impliedNodeFormatV.(int); ok { - if impliedNodeFormat != int(core.ResolutionModeCommonJS) && impliedNodeFormat != int(core.ResolutionModeESM) { - return fmt.Errorf("invalid impliedNodeFormat in fileInfo: %d is out of range", impliedNodeFormat) - } - f.impliedNodeFormat = core.ResolutionMode(impliedNodeFormat) - } else { - return fmt.Errorf("invalid impliedNodeFormat in fileInfo: expected int, got %T", impliedNodeFormatV) - } + var fileInfo buildInfoFileInfoWithSignature + if err := json.Unmarshal(data, &fileInfo); err != nil { + return fmt.Errorf("invalid incrementalBuildInfoFileInfo: %s", data) } + *b = BuildInfoFileInfo{fileInfo: &fileInfo} return nil } -type incrementalBuildInfoCompilerOption struct { +type BuildInfoCompilerOption struct { name string value any } -func (i *incrementalBuildInfoCompilerOption) MarshalJSON() ([]byte, error) { - nameAndValue := make([]any, 2) - nameAndValue[0] = i.name - nameAndValue[1] = i.value - return json.Marshal(nameAndValue) +func (b *BuildInfoCompilerOption) MarshalJSON() ([]byte, error) { + return json.Marshal([]any{b.name, b.value}) } -func (i *incrementalBuildInfoCompilerOption) UnmarshalJSON(data []byte) error { +func (b *BuildInfoCompilerOption) UnmarshalJSON(data []byte) error { var nameAndValue []any if err := json.Unmarshal(data, &nameAndValue); err != nil { return err @@ -162,36 +161,36 @@ func (i *incrementalBuildInfoCompilerOption) UnmarshalJSON(data []byte) error { return fmt.Errorf("invalid incrementalBuildInfoCompilerOption: expected array of length 2, got %d", len(nameAndValue)) } if name, ok := nameAndValue[0].(string); ok { - *i = incrementalBuildInfoCompilerOption{} - i.name = name - i.value = nameAndValue[1] + *b = BuildInfoCompilerOption{} + b.name = name + b.value = nameAndValue[1] return nil } return fmt.Errorf("invalid name in incrementalBuildInfoCompilerOption: expected string, got %T", nameAndValue[0]) } -type incrementalBuildInfoReferenceMapEntry struct { - fileId incrementalBuildInfoFileId - fileIdListId incrementalBuildInfoFileIdListId +type BuildInfoReferenceMapEntry struct { + FileId BuildInfoFileId + FileIdListId BuildInfoFileIdListId } -func (i *incrementalBuildInfoReferenceMapEntry) MarshalJSON() ([]byte, error) { - return json.Marshal([2]int{int(i.fileId), int(i.fileIdListId)}) +func (b *BuildInfoReferenceMapEntry) MarshalJSON() ([]byte, error) { + return json.Marshal([2]int{int(b.FileId), int(b.FileIdListId)}) } -func (i *incrementalBuildInfoReferenceMapEntry) UnmarshalJSON(data []byte) error { +func (b *BuildInfoReferenceMapEntry) UnmarshalJSON(data []byte) error { var v *[2]int if err := json.Unmarshal(data, &v); err != nil { return err } - *i = incrementalBuildInfoReferenceMapEntry{ - fileId: incrementalBuildInfoFileId(v[0]), - fileIdListId: incrementalBuildInfoFileIdListId(v[1]), + *b = BuildInfoReferenceMapEntry{ + FileId: BuildInfoFileId(v[0]), + FileIdListId: BuildInfoFileIdListId(v[1]), } return nil } -type incrementalBuildInfoDiagnostic struct { +type BuildInfoDiagnostic struct { // false if diagnostic is not for a file, // incrementalBuildInfoFileId if it is for a file thats other than its stored for file any @@ -199,86 +198,86 @@ type incrementalBuildInfoDiagnostic struct { code int32 category diagnostics.Category message string - messageChain []*incrementalBuildInfoDiagnostic - relatedInformation []*incrementalBuildInfoDiagnostic + messageChain []*BuildInfoDiagnostic + relatedInformation []*BuildInfoDiagnostic reportsUnnecessary bool reportsDeprecated bool skippedOnNoEmit bool } -func (i *incrementalBuildInfoDiagnostic) toDiagnostic(p *compiler.Program, file *ast.SourceFile) *ast.Diagnostic { +func (b *BuildInfoDiagnostic) toDiagnostic(p *compiler.Program, file *ast.SourceFile) *ast.Diagnostic { var fileForDiagnostic *ast.SourceFile - if i.file != false { - if i.file == nil { + if b.file != false { + if b.file == nil { fileForDiagnostic = file } else { - fileForDiagnostic = p.GetSourceFileByPath(tspath.Path(i.file.(string))) + fileForDiagnostic = p.GetSourceFileByPath(tspath.Path(b.file.(string))) } } var messageChain []*ast.Diagnostic - for _, msg := range i.messageChain { + for _, msg := range b.messageChain { messageChain = append(messageChain, msg.toDiagnostic(p, fileForDiagnostic)) } var relatedInformation []*ast.Diagnostic - for _, info := range i.relatedInformation { + for _, info := range b.relatedInformation { relatedInformation = append(relatedInformation, info.toDiagnostic(p, fileForDiagnostic)) } return ast.NewDiagnosticWith( fileForDiagnostic, - i.loc, - i.code, - i.category, - i.message, + b.loc, + b.code, + b.category, + b.message, messageChain, relatedInformation, - i.reportsUnnecessary, - i.reportsDeprecated, - i.skippedOnNoEmit, + b.reportsUnnecessary, + b.reportsDeprecated, + b.skippedOnNoEmit, ) } -func (i *incrementalBuildInfoDiagnostic) MarshalJSON() ([]byte, error) { +func (b *BuildInfoDiagnostic) MarshalJSON() ([]byte, error) { info := map[string]any{} - if i.file != "" { - info["file"] = i.file - info["pos"] = i.loc.Pos() - info["end"] = i.loc.End() + if b.file != "" { + info["file"] = b.file + info["pos"] = b.loc.Pos() + info["end"] = b.loc.End() } - info["code"] = i.code - info["category"] = i.category - info["message"] = i.message - if len(i.messageChain) > 0 { - info["messageChain"] = i.messageChain + info["code"] = b.code + info["category"] = b.category + info["message"] = b.message + if len(b.messageChain) > 0 { + info["messageChain"] = b.messageChain } - if len(i.relatedInformation) > 0 { - info["relatedInformation"] = i.relatedInformation + if len(b.relatedInformation) > 0 { + info["relatedInformation"] = b.relatedInformation } - if i.reportsUnnecessary { - info["reportsUnnecessary"] = i.reportsUnnecessary + if b.reportsUnnecessary { + info["reportsUnnecessary"] = b.reportsUnnecessary } - if i.reportsDeprecated { - info["reportsDeprecated"] = i.reportsDeprecated + if b.reportsDeprecated { + info["reportsDeprecated"] = b.reportsDeprecated } - if i.skippedOnNoEmit { - info["skippedOnNoEmit"] = i.skippedOnNoEmit + if b.skippedOnNoEmit { + info["skippedOnNoEmit"] = b.skippedOnNoEmit } return json.Marshal(info) } -func (i *incrementalBuildInfoDiagnostic) UnmarshalJSON(data []byte) error { +func (b *BuildInfoDiagnostic) UnmarshalJSON(data []byte) error { var vIncrementalBuildInfoDiagnostic map[string]any if err := json.Unmarshal(data, &vIncrementalBuildInfoDiagnostic); err != nil { return fmt.Errorf("invalid incrementalBuildInfoDiagnostic: %s", data) } - *i = incrementalBuildInfoDiagnostic{} + *b = BuildInfoDiagnostic{} if file, ok := vIncrementalBuildInfoDiagnostic["file"]; ok { if _, ok := file.(float64); !ok { if value, ok := file.(bool); !ok || value { return fmt.Errorf("invalid file in incrementalBuildInfoDiagnostic: expected false or float64, got %T", file) } } - i.file = file + b.file = file var pos float64 posV, ok := vIncrementalBuildInfoDiagnostic["pos"] if ok { @@ -299,14 +298,14 @@ func (i *incrementalBuildInfoDiagnostic) UnmarshalJSON(data []byte) error { } else { return fmt.Errorf("missing end in incrementalBuildInfoDiagnostic") } - i.loc = core.NewTextRange(int(pos), int(end)) + b.loc = core.NewTextRange(int(pos), int(end)) } if codeV, ok := vIncrementalBuildInfoDiagnostic["code"]; ok { code, ok := codeV.(float64) if !ok { return fmt.Errorf("invalid code in incrementalBuildInfoDiagnostic: expected float64, got %T", codeV) } - i.code = int32(code) + b.code = int32(code) } else { return fmt.Errorf("missing code in incrementalBuildInfoDiagnostic") } @@ -318,12 +317,12 @@ func (i *incrementalBuildInfoDiagnostic) UnmarshalJSON(data []byte) error { if category < 0 || category > float64(diagnostics.CategoryMessage) { return fmt.Errorf("invalid category in incrementalBuildInfoDiagnostic: %f is out of range", category) } - i.category = diagnostics.Category(category) + b.category = diagnostics.Category(category) } else { return fmt.Errorf("missing category in incrementalBuildInfoDiagnostic") } if messageV, ok := vIncrementalBuildInfoDiagnostic["message"]; ok { - if i.message, ok = messageV.(string); !ok { + if b.message, ok = messageV.(string); !ok { return fmt.Errorf("invalid message in incrementalBuildInfoDiagnostic: expected string, got %T", messageV) } } else { @@ -331,59 +330,59 @@ func (i *incrementalBuildInfoDiagnostic) UnmarshalJSON(data []byte) error { } if messageChain, ok := vIncrementalBuildInfoDiagnostic["messageChain"]; ok { if messages, ok := messageChain.([]any); ok { - i.messageChain = make([]*incrementalBuildInfoDiagnostic, len(messages)) + b.messageChain = make([]*BuildInfoDiagnostic, len(messages)) for _, msg := range messages { - var diagnostic incrementalBuildInfoDiagnostic + var diagnostic BuildInfoDiagnostic if err := json.Unmarshal([]byte(msg.(string)), &diagnostic); err != nil { return fmt.Errorf("invalid messageChain in incrementalBuildInfoDiagnostic: %s", msg) } - i.messageChain = append(i.messageChain, &diagnostic) + b.messageChain = append(b.messageChain, &diagnostic) } } } if relatedInformation, ok := vIncrementalBuildInfoDiagnostic["relatedInformation"]; ok { if infos, ok := relatedInformation.([]any); ok { - i.relatedInformation = make([]*incrementalBuildInfoDiagnostic, len(infos)) + b.relatedInformation = make([]*BuildInfoDiagnostic, len(infos)) for _, info := range infos { - var diagnostic incrementalBuildInfoDiagnostic + var diagnostic BuildInfoDiagnostic if err := json.Unmarshal([]byte(info.(string)), &diagnostic); err != nil { return fmt.Errorf("invalid relatedInformation in incrementalBuildInfoDiagnostic: %s", info) } - i.relatedInformation = append(i.relatedInformation, &diagnostic) + b.relatedInformation = append(b.relatedInformation, &diagnostic) } } } if reportsUnnecessary, ok := vIncrementalBuildInfoDiagnostic["reportsUnnecessary"]; ok { - if i.reportsUnnecessary, ok = reportsUnnecessary.(bool); !ok { + if b.reportsUnnecessary, ok = reportsUnnecessary.(bool); !ok { return fmt.Errorf("invalid reportsUnnecessary in incrementalBuildInfoDiagnostic: expected boolean, got %T", reportsUnnecessary) } } if reportsDeprecated, ok := vIncrementalBuildInfoDiagnostic["reportsDeprecated"]; ok { - if i.reportsDeprecated, ok = reportsDeprecated.(bool); !ok { + if b.reportsDeprecated, ok = reportsDeprecated.(bool); !ok { return fmt.Errorf("invalid reportsDeprecated in incrementalBuildInfoDiagnostic: expected boolean, got %T", reportsDeprecated) } } if skippedOnNoEmit, ok := vIncrementalBuildInfoDiagnostic["skippedOnNoEmit"]; ok { - if i.skippedOnNoEmit, ok = skippedOnNoEmit.(bool); !ok { + if b.skippedOnNoEmit, ok = skippedOnNoEmit.(bool); !ok { return fmt.Errorf("invalid skippedOnNoEmit in incrementalBuildInfoDiagnostic: expected boolean, got %T", skippedOnNoEmit) } } return nil } -type incrementalBuildInfoDiagnosticOfFile struct { - fileId incrementalBuildInfoFileId - diagnostics []*incrementalBuildInfoDiagnostic +type BuildInfoDiagnosticOfFile struct { + fileId BuildInfoFileId + diagnostics []*BuildInfoDiagnostic } -func (i *incrementalBuildInfoDiagnosticOfFile) MarshalJSON() ([]byte, error) { +func (b *BuildInfoDiagnosticOfFile) MarshalJSON() ([]byte, error) { fileIdAndDiagnostics := make([]any, 0, 2) - fileIdAndDiagnostics = append(fileIdAndDiagnostics, i.fileId) - fileIdAndDiagnostics = append(fileIdAndDiagnostics, i.diagnostics) + fileIdAndDiagnostics = append(fileIdAndDiagnostics, b.fileId) + fileIdAndDiagnostics = append(fileIdAndDiagnostics, b.diagnostics) return json.Marshal(fileIdAndDiagnostics) } -func (i *incrementalBuildInfoDiagnosticOfFile) UnmarshalJSON(data []byte) error { +func (b *BuildInfoDiagnosticOfFile) UnmarshalJSON(data []byte) error { var fileIdAndDiagnostics []any if err := json.Unmarshal(data, &fileIdAndDiagnostics); err != nil { return fmt.Errorf("invalid IncrementalBuildInfoDiagnostic: %s", data) @@ -391,14 +390,14 @@ func (i *incrementalBuildInfoDiagnosticOfFile) UnmarshalJSON(data []byte) error if len(fileIdAndDiagnostics) != 2 { return fmt.Errorf("invalid IncrementalBuildInfoDiagnostic: expected 2 elements, got %d", len(fileIdAndDiagnostics)) } - var fileId incrementalBuildInfoFileId + var fileId BuildInfoFileId if fileIdV, ok := fileIdAndDiagnostics[0].(float64); !ok { return fmt.Errorf("invalid fileId in IncrementalBuildInfoDiagnostic: expected float64, got %T", fileIdAndDiagnostics[0]) } else { - fileId = incrementalBuildInfoFileId(fileIdV) + fileId = BuildInfoFileId(fileIdV) } - if diagnostics, ok := fileIdAndDiagnostics[1].([]*incrementalBuildInfoDiagnostic); ok { - *i = incrementalBuildInfoDiagnosticOfFile{ + if diagnostics, ok := fileIdAndDiagnostics[1].([]*BuildInfoDiagnostic); ok { + *b = BuildInfoDiagnosticOfFile{ fileId: fileId, diagnostics: diagnostics, } @@ -407,30 +406,30 @@ func (i *incrementalBuildInfoDiagnosticOfFile) UnmarshalJSON(data []byte) error return fmt.Errorf("invalid diagnostics in IncrementalBuildInfoDiagnostic: expected []*incrementalBuildInfoDiagnostic, got %T", fileIdAndDiagnostics[1]) } -type incrementalBuildInfoSemanticDiagnostic struct { - fileId incrementalBuildInfoFileId // File is not in changedSet and still doesnt have cached diagnostics - diagnostic incrementalBuildInfoDiagnosticOfFile // Diagnostics for file +type BuildInfoSemanticDiagnostic struct { + FileId BuildInfoFileId // File is not in changedSet and still doesnt have cached diagnostics + Diagnostic BuildInfoDiagnosticOfFile // Diagnostics for file } -func (i *incrementalBuildInfoSemanticDiagnostic) MarshalJSON() ([]byte, error) { - if i.fileId != 0 { - return json.Marshal(i.fileId) +func (b *BuildInfoSemanticDiagnostic) MarshalJSON() ([]byte, error) { + if b.FileId != 0 { + return json.Marshal(b.FileId) } - return json.Marshal(i.diagnostic) + return json.Marshal(b.Diagnostic) } -func (i *incrementalBuildInfoSemanticDiagnostic) UnmarshalJSON(data []byte) error { - var fileId incrementalBuildInfoFileId +func (b *BuildInfoSemanticDiagnostic) UnmarshalJSON(data []byte) error { + var fileId BuildInfoFileId if err := json.Unmarshal(data, &fileId); err == nil { - *i = incrementalBuildInfoSemanticDiagnostic{ - fileId: fileId, + *b = BuildInfoSemanticDiagnostic{ + FileId: fileId, } return nil } - var diagnostic incrementalBuildInfoDiagnosticOfFile + var diagnostic BuildInfoDiagnosticOfFile if err := json.Unmarshal(data, &diagnostic); err == nil { - *i = incrementalBuildInfoSemanticDiagnostic{ - diagnostic: diagnostic, + *b = BuildInfoSemanticDiagnostic{ + Diagnostic: diagnostic, } return nil } @@ -442,27 +441,27 @@ func (i *incrementalBuildInfoSemanticDiagnostic) UnmarshalJSON(data []byte) erro * [fileId] if pending emit is only dts file emit * [fileId, emitKind] if any other type emit is pending */ -type incrementalBuildInfoFilePendingEmit struct { - fileId incrementalBuildInfoFileId +type BuildInfoFilePendingEmit struct { + fileId BuildInfoFileId emitKind fileEmitKind } -func (i *incrementalBuildInfoFilePendingEmit) MarshalJSON() ([]byte, error) { - if i.emitKind == 0 { - return json.Marshal(i.fileId) +func (b *BuildInfoFilePendingEmit) MarshalJSON() ([]byte, error) { + if b.emitKind == 0 { + return json.Marshal(b.fileId) } - if i.emitKind == fileEmitKindDts { - fileListIds := []incrementalBuildInfoFileId{i.fileId} + if b.emitKind == fileEmitKindDts { + fileListIds := []BuildInfoFileId{b.fileId} return json.Marshal(fileListIds) } - fileAndEmitKind := []int{int(i.fileId), int(i.emitKind)} + fileAndEmitKind := []int{int(b.fileId), int(b.emitKind)} return json.Marshal(fileAndEmitKind) } -func (i *incrementalBuildInfoFilePendingEmit) UnmarshalJSON(data []byte) error { - var fileId incrementalBuildInfoFileId +func (b *BuildInfoFilePendingEmit) UnmarshalJSON(data []byte) error { + var fileId BuildInfoFileId if err := json.Unmarshal(data, &fileId); err == nil { - *i = incrementalBuildInfoFilePendingEmit{ + *b = BuildInfoFilePendingEmit{ fileId: fileId, } return nil @@ -470,14 +469,14 @@ func (i *incrementalBuildInfoFilePendingEmit) UnmarshalJSON(data []byte) error { var intTuple []int if err := json.Unmarshal(data, &intTuple); err == nil { if len(intTuple) == 1 { - *i = incrementalBuildInfoFilePendingEmit{ - fileId: incrementalBuildInfoFileId(intTuple[0]), + *b = BuildInfoFilePendingEmit{ + fileId: BuildInfoFileId(intTuple[0]), emitKind: fileEmitKindDts, } return nil } else if len(intTuple) == 2 { - *i = incrementalBuildInfoFilePendingEmit{ - fileId: incrementalBuildInfoFileId(intTuple[0]), + *b = BuildInfoFilePendingEmit{ + fileId: BuildInfoFileId(intTuple[0]), emitKind: fileEmitKind(intTuple[1]), } return nil @@ -491,29 +490,29 @@ func (i *incrementalBuildInfoFilePendingEmit) UnmarshalJSON(data []byte) error { * [fileId, signature] if different from file's signature * fileId if file wasnt emitted */ -type incrementalBuildInfoEmitSignature struct { - fileId incrementalBuildInfoFileId +type BuildInfoEmitSignature struct { + fileId BuildInfoFileId // Signature if it is different from file's signature signature string differsOnlyInDtsMap bool // true if signature is different only in dtsMap value differsInOptions bool // true if signature is different in options used to emit file } -func (i *incrementalBuildInfoEmitSignature) noEmitSignature() bool { - return i.signature == "" && !i.differsOnlyInDtsMap && !i.differsInOptions +func (b *BuildInfoEmitSignature) noEmitSignature() bool { + return b.signature == "" && !b.differsOnlyInDtsMap && !b.differsInOptions } -func (i *incrementalBuildInfoEmitSignature) toEmitSignature(path tspath.Path, emitSignatures map[tspath.Path]*emitSignature) *emitSignature { +func (b *BuildInfoEmitSignature) toEmitSignature(path tspath.Path, emitSignatures map[tspath.Path]*emitSignature) *emitSignature { var signature string var signatureWithDifferentOptions []string - if i.differsOnlyInDtsMap { + if b.differsOnlyInDtsMap { signatureWithDifferentOptions = make([]string, 0, 1) signatureWithDifferentOptions = append(signatureWithDifferentOptions, emitSignatures[path].signature) - } else if i.differsInOptions { + } else if b.differsInOptions { signatureWithDifferentOptions = make([]string, 0, 1) - signatureWithDifferentOptions = append(signatureWithDifferentOptions, i.signature) + signatureWithDifferentOptions = append(signatureWithDifferentOptions, b.signature) } else { - signature = i.signature + signature = b.signature } return &emitSignature{ signature: signature, @@ -521,28 +520,28 @@ func (i *incrementalBuildInfoEmitSignature) toEmitSignature(path tspath.Path, em } } -func (i *incrementalBuildInfoEmitSignature) MarshalJSON() ([]byte, error) { - if i.noEmitSignature() { - return json.Marshal(i.fileId) +func (b *BuildInfoEmitSignature) MarshalJSON() ([]byte, error) { + if b.noEmitSignature() { + return json.Marshal(b.fileId) } fileIdAndSignature := make([]any, 2) - fileIdAndSignature[0] = i.fileId + fileIdAndSignature[0] = b.fileId var signature any - if i.differsOnlyInDtsMap { + if b.differsOnlyInDtsMap { signature = []string{} - } else if i.differsInOptions { - signature = []string{i.signature} + } else if b.differsInOptions { + signature = []string{b.signature} } else { - signature = i.signature + signature = b.signature } fileIdAndSignature[1] = signature return json.Marshal(fileIdAndSignature) } -func (i *incrementalBuildInfoEmitSignature) UnmarshalJSON(data []byte) error { - var fileId incrementalBuildInfoFileId +func (b *BuildInfoEmitSignature) UnmarshalJSON(data []byte) error { + var fileId BuildInfoFileId if err := json.Unmarshal(data, &fileId); err == nil { - *i = incrementalBuildInfoEmitSignature{ + *b = BuildInfoEmitSignature{ fileId: fileId, } return nil @@ -550,9 +549,9 @@ func (i *incrementalBuildInfoEmitSignature) UnmarshalJSON(data []byte) error { var fileIdAndSignature []any if err := json.Unmarshal(data, &fileIdAndSignature); err == nil { if len(fileIdAndSignature) == 2 { - var fileId incrementalBuildInfoFileId + var fileId BuildInfoFileId if id, ok := fileIdAndSignature[0].(float64); ok { - fileId = incrementalBuildInfoFileId(id) + fileId = BuildInfoFileId(id) } else { return fmt.Errorf("invalid fileId in incrementalBuildInfoEmitSignature: expected float64, got %T", fileIdAndSignature[0]) } @@ -574,7 +573,7 @@ func (i *incrementalBuildInfoEmitSignature) UnmarshalJSON(data []byte) error { } else { signature = signatureV } - *i = incrementalBuildInfoEmitSignature{ + *b = BuildInfoEmitSignature{ fileId: fileId, signature: signature, differsOnlyInDtsMap: differsOnlyInDtsMap, @@ -596,17 +595,17 @@ type BuildInfo struct { // Root []BuildInfoRoot `json:"root,omitempty,omitzero"` // IncrementalProgram info - FileNames []string `json:"fileNames,omitzero"` - FileInfos []*fileInfo `json:"fileInfos,omitzero"` - FileIdsList [][]incrementalBuildInfoFileId `json:"fileIdsList,omitzero"` - Options []incrementalBuildInfoCompilerOption `json:"options,omitzero"` - ReferencedMap []incrementalBuildInfoReferenceMapEntry `json:"referencedMap,omitzero"` - SemanticDiagnosticsPerFile []incrementalBuildInfoSemanticDiagnostic `json:"semanticDiagnosticsPerFile,omitzero"` - EmitDiagnosticsPerFile []incrementalBuildInfoDiagnosticOfFile `json:"emitDiagnosticsPerFile,omitzero"` - ChangeFileSet []incrementalBuildInfoFileId `json:"changeFileSet,omitzero"` - AffectedFilesPendingEmit []incrementalBuildInfoFilePendingEmit `json:"affectedFilesPendingEmit,omitzero"` - LatestChangedDtsFile string `json:"latestChangedDtsFile,omitzero"` // Because this is only output file in the program, we dont need fileId to deduplicate name - EmitSignatures []incrementalBuildInfoEmitSignature `json:"emitSignatures,omitzero"` + FileNames []string `json:"fileNames,omitzero"` + FileInfos []*BuildInfoFileInfo `json:"fileInfos,omitzero"` + FileIdsList [][]BuildInfoFileId `json:"fileIdsList,omitzero"` + Options []BuildInfoCompilerOption `json:"options,omitzero"` + ReferencedMap []BuildInfoReferenceMapEntry `json:"referencedMap,omitzero"` + SemanticDiagnosticsPerFile []BuildInfoSemanticDiagnostic `json:"semanticDiagnosticsPerFile,omitzero"` + EmitDiagnosticsPerFile []BuildInfoDiagnosticOfFile `json:"emitDiagnosticsPerFile,omitzero"` + ChangeFileSet []BuildInfoFileId `json:"changeFileSet,omitzero"` + AffectedFilesPendingEmit []BuildInfoFilePendingEmit `json:"affectedFilesPendingEmit,omitzero"` + LatestChangedDtsFile string `json:"latestChangedDtsFile,omitzero"` // Because this is only output file in the program, we dont need fileId to deduplicate name + EmitSignatures []BuildInfoEmitSignature `json:"emitSignatures,omitzero"` // resolvedRoot: readonly IncrementalBuildInfoResolvedRoot[] | undefined; } diff --git a/internal/incremental/programstate.go b/internal/incremental/programstate.go index 9153ef3b85..61c215fcf9 100644 --- a/internal/incremental/programstate.go +++ b/internal/incremental/programstate.go @@ -27,6 +27,11 @@ type fileInfo struct { impliedNodeFormat core.ResolutionMode } +func (f *fileInfo) Version() string { return f.version } +func (f *fileInfo) Signature() string { return f.signature } +func (f *fileInfo) AffectsGlobalScope() bool { return f.affectsGlobalScope } +func (f *fileInfo) ImpliedNodeFormat() core.ResolutionMode { return f.impliedNodeFormat } + type fileEmitKind uint32 const ( @@ -144,7 +149,7 @@ func (e *emitSignature) getNewEmitSignature(oldOptions *core.CompilerOptions, ne type diagnosticsOrBuildInfoDiagnostics struct { diagnostics []*ast.Diagnostic - buildInfoDiagnostics []*incrementalBuildInfoDiagnostic + buildInfoDiagnostics []*BuildInfoDiagnostic } func (d *diagnosticsOrBuildInfoDiagnostics) getDiagnostics(p *compiler.Program, file *ast.SourceFile) []*ast.Diagnostic { @@ -152,7 +157,7 @@ func (d *diagnosticsOrBuildInfoDiagnostics) getDiagnostics(p *compiler.Program, return d.diagnostics } // Convert and cache the diagnostics - d.diagnostics = core.Map(d.buildInfoDiagnostics, func(diag *incrementalBuildInfoDiagnostic) *ast.Diagnostic { + d.diagnostics = core.Map(d.buildInfoDiagnostics, func(diag *BuildInfoDiagnostic) *ast.Diagnostic { return diag.toDiagnostic(p, file) }) return d.diagnostics diff --git a/internal/incremental/tobuildinfo.go b/internal/incremental/tobuildinfo.go index d79e1113ea..0aa3b6e087 100644 --- a/internal/incremental/tobuildinfo.go +++ b/internal/incremental/tobuildinfo.go @@ -23,8 +23,8 @@ func programStateToBuildInfo(state *programState, program *compiler.Program, bui CurrentDirectory: program.GetCurrentDirectory(), UseCaseSensitiveFileNames: program.UseCaseSensitiveFileNames(), }, - fileNameToFileId: make(map[string]incrementalBuildInfoFileId), - fileNamesToFileIdListId: make(map[string]incrementalBuildInfoFileIdListId), + fileNameToFileId: make(map[string]BuildInfoFileId), + fileNamesToFileIdListId: make(map[string]BuildInfoFileIdListId), } to.buildInfo.Version = core.Version() if state.options.IsIncremental() { @@ -55,35 +55,35 @@ type toBuildInfo struct { buildInfo BuildInfo buildInfoDirectory string comparePathsOptions tspath.ComparePathsOptions - fileNameToFileId map[string]incrementalBuildInfoFileId - fileNamesToFileIdListId map[string]incrementalBuildInfoFileIdListId + fileNameToFileId map[string]BuildInfoFileId + fileNamesToFileIdListId map[string]BuildInfoFileIdListId } func (t *toBuildInfo) relativeToBuildInfo(path string) string { return tspath.EnsurePathIsNonModuleName(tspath.GetRelativePathFromDirectory(t.buildInfoDirectory, path, t.comparePathsOptions)) } -func (t *toBuildInfo) toFileId(path tspath.Path) incrementalBuildInfoFileId { +func (t *toBuildInfo) toFileId(path tspath.Path) BuildInfoFileId { fileId := t.fileNameToFileId[string(path)] if fileId == 0 { t.buildInfo.FileNames = append(t.buildInfo.FileNames, t.relativeToBuildInfo(string(path))) - fileId = incrementalBuildInfoFileId(len(t.buildInfo.FileNames)) + fileId = BuildInfoFileId(len(t.buildInfo.FileNames)) t.fileNameToFileId[string(path)] = fileId } return fileId } -func (t *toBuildInfo) toFileIdListId(set *collections.Set[tspath.Path]) incrementalBuildInfoFileIdListId { +func (t *toBuildInfo) toFileIdListId(set *collections.Set[tspath.Path]) BuildInfoFileIdListId { fileIds := core.Map(slices.Collect(maps.Keys(set.Keys())), t.toFileId) slices.Sort(fileIds) - key := strings.Join(core.Map(fileIds, func(id incrementalBuildInfoFileId) string { + key := strings.Join(core.Map(fileIds, func(id BuildInfoFileId) string { return fmt.Sprintf("%d", id) }), ",") fileIdListId := t.fileNamesToFileIdListId[key] if fileIdListId == 0 { t.buildInfo.FileIdsList = append(t.buildInfo.FileIdsList, fileIds) - fileIdListId = incrementalBuildInfoFileIdListId(len(t.buildInfo.FileIdsList)) + fileIdListId = BuildInfoFileIdListId(len(t.buildInfo.FileIdsList)) t.fileNamesToFileIdListId[key] = fileIdListId } return fileIdListId @@ -105,8 +105,8 @@ func (t *toBuildInfo) toRelativeToBuildInfoCompilerOptionValue(option *tsoptions return v } -func (t *toBuildInfo) toDiagnosticCompatibleWithBuildInfo(diagnostics []*incrementalBuildInfoDiagnostic) ([]*incrementalBuildInfoDiagnostic, bool) { - var fixedDiagnostics []*incrementalBuildInfoDiagnostic +func (t *toBuildInfo) toDiagnosticCompatibleWithBuildInfo(diagnostics []*BuildInfoDiagnostic) ([]*BuildInfoDiagnostic, bool) { + var fixedDiagnostics []*BuildInfoDiagnostic var changed bool for _, d := range diagnostics { file := d.file @@ -116,7 +116,7 @@ func (t *toBuildInfo) toDiagnosticCompatibleWithBuildInfo(diagnostics []*increme messageChain, changedMessageChain := t.toDiagnosticCompatibleWithBuildInfo(d.messageChain) relatedInformation, changedRelatedInformation := t.toDiagnosticCompatibleWithBuildInfo(d.relatedInformation) if file != d.file || changedMessageChain || changedRelatedInformation { - fixedDiagnostics = append(fixedDiagnostics, &incrementalBuildInfoDiagnostic{ + fixedDiagnostics = append(fixedDiagnostics, &BuildInfoDiagnostic{ file: file, loc: d.loc, code: d.code, @@ -136,8 +136,8 @@ func (t *toBuildInfo) toDiagnosticCompatibleWithBuildInfo(diagnostics []*increme return core.IfElse(changed, fixedDiagnostics, diagnostics), changed } -func (t *toBuildInfo) toIncrementalBuildInfoDiagnostic(diagnostics []*ast.Diagnostic, file *ast.SourceFile) []*incrementalBuildInfoDiagnostic { - var incrementalDiagnostics []*incrementalBuildInfoDiagnostic +func (t *toBuildInfo) toIncrementalBuildInfoDiagnostic(diagnostics []*ast.Diagnostic, file *ast.SourceFile) []*BuildInfoDiagnostic { + var incrementalDiagnostics []*BuildInfoDiagnostic for _, d := range diagnostics { var fileValue any if d.File() == nil { @@ -145,7 +145,7 @@ func (t *toBuildInfo) toIncrementalBuildInfoDiagnostic(diagnostics []*ast.Diagno } else if d.File() != file { fileValue = t.toFileId(d.File().Path()) } - incrementalDiagnostics = append(incrementalDiagnostics, &incrementalBuildInfoDiagnostic{ + incrementalDiagnostics = append(incrementalDiagnostics, &BuildInfoDiagnostic{ file: fileValue, loc: d.Loc(), code: d.Code(), @@ -179,11 +179,11 @@ func (t *toBuildInfo) setFileInfoAndEmitSignatures() { if !ast.IsJsonSourceFile(file) && t.program.SourceFileMayBeEmitted(file, false) { emitSignature := t.state.emitSignatures[file.Path()] if emitSignature == nil { - t.buildInfo.EmitSignatures = append(t.buildInfo.EmitSignatures, incrementalBuildInfoEmitSignature{ + t.buildInfo.EmitSignatures = append(t.buildInfo.EmitSignatures, BuildInfoEmitSignature{ fileId: fileId, }) } else if emitSignature.signature != actualSignature { - incrementalEmitSignature := incrementalBuildInfoEmitSignature{ + incrementalEmitSignature := BuildInfoEmitSignature{ fileId: fileId, } if emitSignature.signature != "" { @@ -199,9 +199,9 @@ func (t *toBuildInfo) setFileInfoAndEmitSignatures() { } } if actualSignature == info.signature { - t.buildInfo.FileInfos = append(t.buildInfo.FileInfos, info) + t.setFileInfo(info) } else { - t.buildInfo.FileInfos = append(t.buildInfo.FileInfos, &fileInfo{ + t.setFileInfo(&fileInfo{ version: info.version, signature: actualSignature, affectsGlobalScope: info.affectsGlobalScope, @@ -211,6 +211,29 @@ func (t *toBuildInfo) setFileInfoAndEmitSignatures() { } } +func (t *toBuildInfo) setFileInfo(fileInfo *fileInfo) { + if fileInfo.version == fileInfo.signature { + if !fileInfo.affectsGlobalScope && fileInfo.impliedNodeFormat == core.ResolutionModeNone { + t.buildInfo.FileInfos = append(t.buildInfo.FileInfos, &BuildInfoFileInfo{signature: fileInfo.signature}) + return + } + } else if fileInfo.signature == "" { + t.buildInfo.FileInfos = append(t.buildInfo.FileInfos, &BuildInfoFileInfo{noSignature: &buildInfoFileInfoNoSignature{ + Version: fileInfo.version, + NoSignature: true, + AffectsGlobalScope: fileInfo.affectsGlobalScope, + ImpliedNodeFormat: fileInfo.impliedNodeFormat, + }}) + return + } + t.buildInfo.FileInfos = append(t.buildInfo.FileInfos, &BuildInfoFileInfo{fileInfo: &buildInfoFileInfoWithSignature{ + Version: fileInfo.version, + Signature: core.IfElse(fileInfo.signature == fileInfo.version, "", fileInfo.signature), + AffectsGlobalScope: fileInfo.affectsGlobalScope, + ImpliedNodeFormat: fileInfo.impliedNodeFormat, + }}) +} + func (t *toBuildInfo) setCompilerOptions() { tsoptions.ForEachCompilerOptionValue( t.state.options, func(option *tsoptions.CommandLineOption) bool { @@ -218,7 +241,7 @@ func (t *toBuildInfo) setCompilerOptions() { }, func(option *tsoptions.CommandLineOption, value any, i int) bool { // Make it relative to buildInfo directory if file path - t.buildInfo.Options = append(t.buildInfo.Options, incrementalBuildInfoCompilerOption{ + t.buildInfo.Options = append(t.buildInfo.Options, BuildInfoCompilerOption{ name: option.Name, value: t.toRelativeToBuildInfoCompilerOptionValue(option, value), }) @@ -235,9 +258,9 @@ func (t *toBuildInfo) setReferenceMap() { slices.Sort(keys) for _, filePath := range keys { references, _ := t.state.referencedMap.GetValues(filePath) - t.buildInfo.ReferencedMap = append(t.buildInfo.ReferencedMap, incrementalBuildInfoReferenceMapEntry{ - fileId: t.toFileId(filePath), - fileIdListId: t.toFileIdListId(references), + t.buildInfo.ReferencedMap = append(t.buildInfo.ReferencedMap, BuildInfoReferenceMapEntry{ + FileId: t.toFileId(filePath), + FileIdListId: t.toFileIdListId(references), }) } } @@ -255,21 +278,21 @@ func (t *toBuildInfo) setSemanticDiagnostics() { value, ok := t.state.semanticDiagnosticsPerFile[file.Path()] if !ok { if !t.state.changedFilesSet.Has(file.Path()) { - t.buildInfo.SemanticDiagnosticsPerFile = append(t.buildInfo.SemanticDiagnosticsPerFile, incrementalBuildInfoSemanticDiagnostic{ - fileId: t.toFileId(file.Path()), + t.buildInfo.SemanticDiagnosticsPerFile = append(t.buildInfo.SemanticDiagnosticsPerFile, BuildInfoSemanticDiagnostic{ + FileId: t.toFileId(file.Path()), }) } } else if len(value.buildInfoDiagnostics) > 0 { diagnostics, _ := t.toDiagnosticCompatibleWithBuildInfo(value.buildInfoDiagnostics) - t.buildInfo.SemanticDiagnosticsPerFile = append(t.buildInfo.SemanticDiagnosticsPerFile, incrementalBuildInfoSemanticDiagnostic{ - diagnostic: incrementalBuildInfoDiagnosticOfFile{ + t.buildInfo.SemanticDiagnosticsPerFile = append(t.buildInfo.SemanticDiagnosticsPerFile, BuildInfoSemanticDiagnostic{ + Diagnostic: BuildInfoDiagnosticOfFile{ fileId: t.toFileId(file.Path()), diagnostics: diagnostics, }, }) } else if len(value.diagnostics) > 0 { - t.buildInfo.SemanticDiagnosticsPerFile = append(t.buildInfo.SemanticDiagnosticsPerFile, incrementalBuildInfoSemanticDiagnostic{ - diagnostic: incrementalBuildInfoDiagnosticOfFile{ + t.buildInfo.SemanticDiagnosticsPerFile = append(t.buildInfo.SemanticDiagnosticsPerFile, BuildInfoSemanticDiagnostic{ + Diagnostic: BuildInfoDiagnosticOfFile{ fileId: t.toFileId(file.Path()), diagnostics: t.toIncrementalBuildInfoDiagnostic(value.diagnostics, file), }, @@ -285,12 +308,12 @@ func (t *toBuildInfo) setEmitDiagnostics() { value := t.state.emitDiagnosticsPerFile[filePath] if len(value.buildInfoDiagnostics) > 0 { diagnostics, _ := t.toDiagnosticCompatibleWithBuildInfo(value.buildInfoDiagnostics) - t.buildInfo.EmitDiagnosticsPerFile = append(t.buildInfo.EmitDiagnosticsPerFile, incrementalBuildInfoDiagnosticOfFile{ + t.buildInfo.EmitDiagnosticsPerFile = append(t.buildInfo.EmitDiagnosticsPerFile, BuildInfoDiagnosticOfFile{ fileId: t.toFileId(filePath), diagnostics: diagnostics, }) } else { - t.buildInfo.EmitDiagnosticsPerFile = append(t.buildInfo.EmitDiagnosticsPerFile, incrementalBuildInfoDiagnosticOfFile{ + t.buildInfo.EmitDiagnosticsPerFile = append(t.buildInfo.EmitDiagnosticsPerFile, BuildInfoDiagnosticOfFile{ fileId: t.toFileId(filePath), diagnostics: t.toIncrementalBuildInfoDiagnostic(value.diagnostics, t.program.GetSourceFileByPath(filePath)), }) @@ -311,7 +334,7 @@ func (t *toBuildInfo) setAffectedFilesPendingEmit() { continue } pendingEmit := t.state.affectedFilesPendingEmit[filePath] - t.buildInfo.AffectedFilesPendingEmit = append(t.buildInfo.AffectedFilesPendingEmit, incrementalBuildInfoFilePendingEmit{ + t.buildInfo.AffectedFilesPendingEmit = append(t.buildInfo.AffectedFilesPendingEmit, BuildInfoFilePendingEmit{ fileId: t.toFileId(filePath), emitKind: core.IfElse(pendingEmit == fullEmitKind, 0, pendingEmit), }) diff --git a/internal/incremental/toprogramstate.go b/internal/incremental/toprogramstate.go index 86874a15aa..cd088582b0 100644 --- a/internal/incremental/toprogramstate.go +++ b/internal/incremental/toprogramstate.go @@ -52,26 +52,26 @@ func (t *toProgramState) toAbsolutePath(path string) string { return tspath.GetNormalizedAbsolutePath(path, t.buildInfoDirectory) } -func (t *toProgramState) toFilePath(fileId incrementalBuildInfoFileId) tspath.Path { +func (t *toProgramState) toFilePath(fileId BuildInfoFileId) tspath.Path { return t.filePaths[fileId-1] } -func (t *toProgramState) toFilePathSet(fileIdListId incrementalBuildInfoFileIdListId) *collections.Set[tspath.Path] { +func (t *toProgramState) toFilePathSet(fileIdListId BuildInfoFileIdListId) *collections.Set[tspath.Path] { return t.filePathSet[fileIdListId-1] } -func (t *toProgramState) toDiagnosticCompatibleWithProgramState(diagnostics []*incrementalBuildInfoDiagnostic) ([]*incrementalBuildInfoDiagnostic, bool) { - var fixedDiagnostics []*incrementalBuildInfoDiagnostic +func (t *toProgramState) toDiagnosticCompatibleWithProgramState(diagnostics []*BuildInfoDiagnostic) ([]*BuildInfoDiagnostic, bool) { + var fixedDiagnostics []*BuildInfoDiagnostic var changed bool for _, d := range diagnostics { file := d.file if d.file != false && d.file != 0 { - file = t.toFilePath(incrementalBuildInfoFileId(d.file.(float64))) + file = t.toFilePath(BuildInfoFileId(d.file.(float64))) } messageChain, changedMessageChain := t.toDiagnosticCompatibleWithProgramState(d.messageChain) relatedInformation, changedRelatedInformation := t.toDiagnosticCompatibleWithProgramState(d.relatedInformation) if file != d.file || changedMessageChain || changedRelatedInformation { - fixedDiagnostics = append(fixedDiagnostics, &incrementalBuildInfoDiagnostic{ + fixedDiagnostics = append(fixedDiagnostics, &BuildInfoDiagnostic{ file: file, loc: d.loc, code: d.code, @@ -107,12 +107,13 @@ func (t *toProgramState) setCompilerOptions() { func (t *toProgramState) setFileInfoAndEmitSignatures() { t.state.fileInfos = make(map[tspath.Path]*fileInfo, len(t.buildInfo.FileInfos)) t.state.createEmitSignaturesMap() - for index, fileInfo := range t.buildInfo.FileInfos { - path := t.toFilePath(incrementalBuildInfoFileId(index + 1)) - t.state.fileInfos[path] = fileInfo + for index, buildInfoFileInfo := range t.buildInfo.FileInfos { + path := t.toFilePath(BuildInfoFileId(index + 1)) + info := buildInfoFileInfo.GetFileInfo() + t.state.fileInfos[path] = info // Add default emit signature as file's signature - if fileInfo.signature != "" && len(t.state.emitSignatures) != 0 { - t.state.emitSignatures[path] = &emitSignature{signature: fileInfo.signature} + if info.signature != "" && len(t.state.emitSignatures) != 0 { + t.state.emitSignatures[path] = &emitSignature{signature: info.signature} } } // Fix up emit signatures @@ -129,7 +130,7 @@ func (t *toProgramState) setFileInfoAndEmitSignatures() { func (t *toProgramState) setReferenceMap() { t.state.createReferenceMap() for _, entry := range t.buildInfo.ReferencedMap { - t.state.referencedMap.Add(t.toFilePath(entry.fileId), t.toFilePathSet(entry.fileIdListId)) + t.state.referencedMap.Add(t.toFilePath(entry.FileId), t.toFilePathSet(entry.FileIdListId)) } } @@ -150,12 +151,12 @@ func (t *toProgramState) setSemanticDiagnostics() { } } for _, diagnostic := range t.buildInfo.SemanticDiagnosticsPerFile { - if diagnostic.fileId != 0 { - filePath := t.toFilePath(diagnostic.fileId) + if diagnostic.FileId != 0 { + filePath := t.toFilePath(diagnostic.FileId) delete(t.state.semanticDiagnosticsPerFile, filePath) // does not have cached diagnostics } else { - filePath := t.toFilePath(diagnostic.diagnostic.fileId) - diagnostics, _ := t.toDiagnosticCompatibleWithProgramState(diagnostic.diagnostic.diagnostics) + filePath := t.toFilePath(diagnostic.Diagnostic.fileId) + diagnostics, _ := t.toDiagnosticCompatibleWithProgramState(diagnostic.Diagnostic.diagnostics) t.state.semanticDiagnosticsPerFile[filePath] = &diagnosticsOrBuildInfoDiagnostics{ buildInfoDiagnostics: diagnostics, } diff --git a/internal/testutil/incrementaltestutil/fs.go b/internal/testutil/incrementaltestutil/fs.go new file mode 100644 index 0000000000..ba97799223 --- /dev/null +++ b/internal/testutil/incrementaltestutil/fs.go @@ -0,0 +1,111 @@ +package incrementaltestutil + +import ( + "encoding/json" + "fmt" + + "github.com/microsoft/typescript-go/internal/core" + "github.com/microsoft/typescript-go/internal/incremental" + "github.com/microsoft/typescript-go/internal/tspath" + "github.com/microsoft/typescript-go/internal/vfs" +) + +var fakeTsVersion = "FakeTSVersion" + +type FsHandlingBuildInfo struct { + fs vfs.FS +} + +var _ vfs.FS = (*FsHandlingBuildInfo)(nil) + +func NewFsHandlingBuildInfo(fs vfs.FS) *FsHandlingBuildInfo { + return &FsHandlingBuildInfo{ + fs: fs, + } +} + +func (f *FsHandlingBuildInfo) FS() vfs.FS { + return f.fs +} + +func (f *FsHandlingBuildInfo) UseCaseSensitiveFileNames() bool { + return f.fs.UseCaseSensitiveFileNames() +} + +// FileExists returns true if the file exists. +func (f *FsHandlingBuildInfo) FileExists(path string) bool { + return f.fs.FileExists(path) +} + +// ReadFile reads the file specified by path and returns the content. +// If the file fails to be read, ok will be false. +func (f *FsHandlingBuildInfo) ReadFile(path string) (contents string, ok bool) { + contents, ok = f.fs.ReadFile(path) + if ok && tspath.FileExtensionIs(path, tspath.ExtensionTsBuildInfo) { + // read buildinfo and modify version + var buildInfo incremental.BuildInfo + err := json.Unmarshal([]byte(contents), &buildInfo) + if err == nil && buildInfo.Version == fakeTsVersion { + buildInfo.Version = core.Version() + newContents, err := json.Marshal(&buildInfo) + if err != nil { + panic("testFs.ReadFile: failed to marshal build info after fixing version: " + err.Error()) + } + contents = string(newContents) + } + } + return contents, ok +} + +func (f *FsHandlingBuildInfo) WriteFile(path string, data string, writeByteOrderMark bool) error { + if tspath.FileExtensionIs(path, tspath.ExtensionTsBuildInfo) { + var buildInfo incremental.BuildInfo + err := json.Unmarshal([]byte(data), &buildInfo) + if err == nil && buildInfo.Version == core.Version() { + // Change it to fakeTsVersion + buildInfo.Version = fakeTsVersion + newData, err := json.Marshal(&buildInfo) + if err != nil { + return fmt.Errorf("testFs.WriteFile: failed to marshal build info after fixing version: %w", err) + } + data = string(newData) + } + if err == nil { + // Write readable build info version + f.fs.WriteFile(path+".readable.baseline.txt", toReadableBuildInfo(&buildInfo, data), false) + } + } + return f.fs.WriteFile(path, data, writeByteOrderMark) +} + +// Removes `path` and all its contents. Will return the first error it encounters. +func (f *FsHandlingBuildInfo) Remove(path string) error { + return f.fs.Remove(path) +} + +// DirectoryExists returns true if the path is a directory. +func (f *FsHandlingBuildInfo) DirectoryExists(path string) bool { + return f.fs.DirectoryExists(path) +} + +// GetAccessibleEntries returns the files/directories in the specified directory. +// If any entry is a symlink, it will be followed. +func (f *FsHandlingBuildInfo) GetAccessibleEntries(path string) vfs.Entries { + return f.fs.GetAccessibleEntries(path) +} + +func (f *FsHandlingBuildInfo) Stat(path string) vfs.FileInfo { + return f.fs.Stat(path) +} + +// WalkDir walks the file tree rooted at root, calling walkFn for each file or directory in the tree. +// It is has the same behavior as [fs.WalkDir], but with paths as [string]. +func (f *FsHandlingBuildInfo) WalkDir(root string, walkFn vfs.WalkDirFunc) error { + return f.fs.WalkDir(root, walkFn) +} + +// Realpath returns the "real path" of the specified path, +// following symlinks and correcting filename casing. +func (f *FsHandlingBuildInfo) Realpath(path string) string { + return f.fs.Realpath(path) +} diff --git a/internal/testutil/incrementaltestutil/readablebuildinfo.go b/internal/testutil/incrementaltestutil/readablebuildinfo.go new file mode 100644 index 0000000000..b65d39e5f4 --- /dev/null +++ b/internal/testutil/incrementaltestutil/readablebuildinfo.go @@ -0,0 +1,163 @@ +package incrementaltestutil + +import ( + "encoding/json" + + "github.com/microsoft/typescript-go/internal/core" + "github.com/microsoft/typescript-go/internal/incremental" +) + +type readableBuildInfo struct { + buildInfo *incremental.BuildInfo + Version string + + // Common between incremental and tsc -b buildinfo for non incremental programs + Errors bool `json:"errors,omitzero"` + CheckPending bool `json:"checkPending,omitzero"` + // Root []BuildInfoRoot `json:"root,omitempty,omitzero"` + + // IncrementalProgram info + FileNames []string `json:"fileNames,omitzero"` + FileInfos []*readableBuildInfoFileInfo `json:"fileInfos,omitzero"` + FileIdsList [][]string `json:"fileIdsList,omitzero"` + Options []incremental.BuildInfoCompilerOption `json:"options,omitzero"` + ReferencedMap []readableBuildInfoReferenceMapEntry `json:"referencedMap,omitzero"` + SemanticDiagnosticsPerFile []incremental.BuildInfoSemanticDiagnostic `json:"semanticDiagnosticsPerFile,omitzero"` + EmitDiagnosticsPerFile []incremental.BuildInfoDiagnosticOfFile `json:"emitDiagnosticsPerFile,omitzero"` + ChangeFileSet []incremental.BuildInfoFileId `json:"changeFileSet,omitzero"` + AffectedFilesPendingEmit []incremental.BuildInfoFilePendingEmit `json:"affectedFilesPendingEmit,omitzero"` + LatestChangedDtsFile string `json:"latestChangedDtsFile,omitzero"` // Because this is only output file in the program, we dont need fileId to deduplicate name + EmitSignatures []incremental.BuildInfoEmitSignature `json:"emitSignatures,omitzero"` + // resolvedRoot: readonly IncrementalBuildInfoResolvedRoot[] | undefined; + Size int `json:"size,omitzero"` // Size of the build info file +} + +type readableBuildInfoFileInfo struct { + Version string `json:"version,omitzero"` + Signature string `json:"signature,omitzero"` + AffectsGlobalScope bool `json:"affectsGlobalScope,omitzero"` + ImpliedNodeFormat string `json:"impliedNodeFormat,omitzero"` + Original *incremental.BuildInfoFileInfo `json:"original,omitempty"` // Original file path, if available +} + +type readableBuildInfoReferenceMapEntry struct { + file string + fileList []string +} + +func (r *readableBuildInfoReferenceMapEntry) MarshalJSON() ([]byte, error) { + return json.Marshal([2]any{r.file, r.fileList}) +} + +func (r *readableBuildInfoReferenceMapEntry) UnmarshalJSON(data []byte) error { + var v [2]any + if err := json.Unmarshal(data, &v); err != nil { + return err + } + *r = readableBuildInfoReferenceMapEntry{ + file: v[0].(string), + fileList: v[1].([]string), + } + return nil +} + +// type readableBuildInfoSemanticDiagnostic struct { +// file string // File is not in changedSet and still doesnt have cached diagnostics +// diagnostic incremental.BuildInfoDiagnosticOfFile // Diagnostics for file +// } + +// func (b *readableBuildInfoSemanticDiagnostic) MarshalJSON() ([]byte, error) { +// if b.file != 0 { +// return json.Marshal(b.file) +// } +// return json.Marshal(b.diagnostic) +// } + +// func (b *readableBuildInfoSemanticDiagnostic) UnmarshalJSON(data []byte) error { +// var fileId BuildInfoFileId +// if err := json.Unmarshal(data, &fileId); err == nil { +// *b = BuildInfoSemanticDiagnostic{ +// FileId: fileId, +// } +// return nil +// } +// var diagnostic BuildInfoDiagnosticOfFile +// if err := json.Unmarshal(data, &diagnostic); err == nil { +// *b = BuildInfoSemanticDiagnostic{ +// Diagnostic: diagnostic, +// } +// return nil +// } +// return fmt.Errorf("invalid IncrementalBuildInfoDiagnostic: %s", data) +// } + +func toReadableBuildInfo(buildInfo *incremental.BuildInfo, buildInfoText string) string { + readable := readableBuildInfo{ + buildInfo: buildInfo, + Version: buildInfo.Version, + + Errors: buildInfo.Errors, + CheckPending: buildInfo.CheckPending, + // Root: buildInfo.Root, + + FileNames: buildInfo.FileNames, + Options: buildInfo.Options, + // SemanticDiagnosticsPerFile []incremental.BuildInfoSemanticDiagnostic `json:"semanticDiagnosticsPerFile,omitzero"` + // EmitDiagnosticsPerFile []incremental.BuildInfoDiagnosticOfFile `json:"emitDiagnosticsPerFile,omitzero"` + // ChangeFileSet []incremental.BuildInfoFileId `json:"changeFileSet,omitzero"` + // AffectedFilesPendingEmit []incremental.BuildInfoFilePendingEmit `json:"affectedFilesPendingEmit,omitzero"` + LatestChangedDtsFile: buildInfo.LatestChangedDtsFile, + // EmitSignatures []incremental.BuildInfoEmitSignature `json:"emitSignatures,omitzero"` + // resolvedRoot: readonly IncrementalBuildInfoResolvedRoot[] | undefined; + + Size: len(buildInfoText), + } + readable.setFileInfos() + readable.setFileIdsList() + readable.setReferencedMap() + contents, err := json.MarshalIndent(&readable, "", " ") + if err != nil { + panic("readableBuildInfo: failed to marshal readable build info: " + err.Error()) + } + return string(contents) +} + +func (r *readableBuildInfo) toFilePath(fileId incremental.BuildInfoFileId) string { + return r.buildInfo.FileNames[fileId-1] +} + +func (r *readableBuildInfo) toFilePathSet(fileIdListId incremental.BuildInfoFileIdListId) []string { + return r.FileIdsList[fileIdListId-1] +} + +func (r *readableBuildInfo) setFileInfos() { + for _, original := range r.buildInfo.FileInfos { + fileInfo := original.GetFileInfo() + // Dont set original for string encoding + if original.HasSignature() { + original = nil + } + r.FileInfos = append(r.FileInfos, &readableBuildInfoFileInfo{ + Version: fileInfo.Version(), + Signature: fileInfo.Signature(), + AffectsGlobalScope: fileInfo.AffectsGlobalScope(), + ImpliedNodeFormat: fileInfo.ImpliedNodeFormat().String(), + Original: original, + }) + } +} + +func (r *readableBuildInfo) setFileIdsList() { + for _, ids := range r.buildInfo.FileIdsList { + r.FileIdsList = append(r.FileIdsList, core.Map(ids, r.toFilePath)) + } +} + +func (r *readableBuildInfo) setReferencedMap() { + for _, entry := range r.buildInfo.ReferencedMap { + r.ReferencedMap = append(r.ReferencedMap, readableBuildInfoReferenceMapEntry{ + file: r.toFilePath(entry.FileId), + fileList: r.toFilePathSet(entry.FileIdListId), + }) + } +} From c737dd23ff4c83d721594612bb84873f55c58fdb Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 26 Jun 2025 15:42:13 -0700 Subject: [PATCH 05/36] Handle casing with compiler options serialization --- internal/incremental/buildInfo.go | 49 +++++-------------- internal/incremental/tobuildinfo.go | 16 +++--- internal/incremental/toprogramstate.go | 9 ++-- .../incrementaltestutil/readablebuildinfo.go | 3 +- internal/tsoptions/commandlineoption.go | 2 +- internal/tsoptions/declscompiler.go | 6 +-- internal/tsoptions/parsinghelpers.go | 12 +++-- internal/tsoptions/tsconfigparsing.go | 33 ++++++++----- 8 files changed, 62 insertions(+), 68 deletions(-) diff --git a/internal/incremental/buildInfo.go b/internal/incremental/buildInfo.go index e7b9d52ffc..de57555386 100644 --- a/internal/incremental/buildInfo.go +++ b/internal/incremental/buildInfo.go @@ -5,6 +5,7 @@ import ( "fmt" "github.com/microsoft/typescript-go/internal/ast" + "github.com/microsoft/typescript-go/internal/collections" "github.com/microsoft/typescript-go/internal/compiler" "github.com/microsoft/typescript-go/internal/core" "github.com/microsoft/typescript-go/internal/diagnostics" @@ -143,32 +144,6 @@ func (b *BuildInfoFileInfo) UnmarshalJSON(data []byte) error { return nil } -type BuildInfoCompilerOption struct { - name string - value any -} - -func (b *BuildInfoCompilerOption) MarshalJSON() ([]byte, error) { - return json.Marshal([]any{b.name, b.value}) -} - -func (b *BuildInfoCompilerOption) UnmarshalJSON(data []byte) error { - var nameAndValue []any - if err := json.Unmarshal(data, &nameAndValue); err != nil { - return err - } - if len(nameAndValue) != 2 { - return fmt.Errorf("invalid incrementalBuildInfoCompilerOption: expected array of length 2, got %d", len(nameAndValue)) - } - if name, ok := nameAndValue[0].(string); ok { - *b = BuildInfoCompilerOption{} - b.name = name - b.value = nameAndValue[1] - return nil - } - return fmt.Errorf("invalid name in incrementalBuildInfoCompilerOption: expected string, got %T", nameAndValue[0]) -} - type BuildInfoReferenceMapEntry struct { FileId BuildInfoFileId FileIdListId BuildInfoFileIdListId @@ -595,17 +570,17 @@ type BuildInfo struct { // Root []BuildInfoRoot `json:"root,omitempty,omitzero"` // IncrementalProgram info - FileNames []string `json:"fileNames,omitzero"` - FileInfos []*BuildInfoFileInfo `json:"fileInfos,omitzero"` - FileIdsList [][]BuildInfoFileId `json:"fileIdsList,omitzero"` - Options []BuildInfoCompilerOption `json:"options,omitzero"` - ReferencedMap []BuildInfoReferenceMapEntry `json:"referencedMap,omitzero"` - SemanticDiagnosticsPerFile []BuildInfoSemanticDiagnostic `json:"semanticDiagnosticsPerFile,omitzero"` - EmitDiagnosticsPerFile []BuildInfoDiagnosticOfFile `json:"emitDiagnosticsPerFile,omitzero"` - ChangeFileSet []BuildInfoFileId `json:"changeFileSet,omitzero"` - AffectedFilesPendingEmit []BuildInfoFilePendingEmit `json:"affectedFilesPendingEmit,omitzero"` - LatestChangedDtsFile string `json:"latestChangedDtsFile,omitzero"` // Because this is only output file in the program, we dont need fileId to deduplicate name - EmitSignatures []BuildInfoEmitSignature `json:"emitSignatures,omitzero"` + FileNames []string `json:"fileNames,omitzero"` + FileInfos []*BuildInfoFileInfo `json:"fileInfos,omitzero"` + FileIdsList [][]BuildInfoFileId `json:"fileIdsList,omitzero"` + Options *collections.OrderedMap[string, any] `json:"options,omitempty"` + ReferencedMap []BuildInfoReferenceMapEntry `json:"referencedMap,omitzero"` + SemanticDiagnosticsPerFile []BuildInfoSemanticDiagnostic `json:"semanticDiagnosticsPerFile,omitzero"` + EmitDiagnosticsPerFile []BuildInfoDiagnosticOfFile `json:"emitDiagnosticsPerFile,omitzero"` + ChangeFileSet []BuildInfoFileId `json:"changeFileSet,omitzero"` + AffectedFilesPendingEmit []BuildInfoFilePendingEmit `json:"affectedFilesPendingEmit,omitzero"` + LatestChangedDtsFile string `json:"latestChangedDtsFile,omitzero"` // Because this is only output file in the program, we dont need fileId to deduplicate name + EmitSignatures []BuildInfoEmitSignature `json:"emitSignatures,omitzero"` // resolvedRoot: readonly IncrementalBuildInfoResolvedRoot[] | undefined; } diff --git a/internal/incremental/tobuildinfo.go b/internal/incremental/tobuildinfo.go index 0aa3b6e087..89d893ad15 100644 --- a/internal/incremental/tobuildinfo.go +++ b/internal/incremental/tobuildinfo.go @@ -3,6 +3,7 @@ package incremental import ( "fmt" "maps" + "reflect" "slices" "strings" @@ -99,7 +100,7 @@ func (t *toBuildInfo) toRelativeToBuildInfoCompilerOptionValue(option *tsoptions return t.relativeToBuildInfo(item) }) } - } else { + } else if str, ok := v.(string); ok && str != "" { return t.relativeToBuildInfo(v.(string)) } return v @@ -239,12 +240,15 @@ func (t *toBuildInfo) setCompilerOptions() { t.state.options, func(option *tsoptions.CommandLineOption) bool { return option.AffectsBuildInfo }, - func(option *tsoptions.CommandLineOption, value any, i int) bool { + func(option *tsoptions.CommandLineOption, value reflect.Value, i int) bool { + if value.IsZero() { + return false + } // Make it relative to buildInfo directory if file path - t.buildInfo.Options = append(t.buildInfo.Options, BuildInfoCompilerOption{ - name: option.Name, - value: t.toRelativeToBuildInfoCompilerOptionValue(option, value), - }) + if t.buildInfo.Options == nil { + t.buildInfo.Options = &collections.OrderedMap[string, any]{} + } + t.buildInfo.Options.Set(option.Name, t.toRelativeToBuildInfoCompilerOptionValue(option, value.Interface())) return false }, ) diff --git a/internal/incremental/toprogramstate.go b/internal/incremental/toprogramstate.go index cd088582b0..bd9c312108 100644 --- a/internal/incremental/toprogramstate.go +++ b/internal/incremental/toprogramstate.go @@ -93,13 +93,12 @@ func (t *toProgramState) toDiagnosticCompatibleWithProgramState(diagnostics []*B func (t *toProgramState) setCompilerOptions() { t.state.options = &core.CompilerOptions{} - for _, option := range t.buildInfo.Options { - value := option.value - result, ok := tsoptions.ConvertOptionToAbsolutePath(option.name, value, tsoptions.CommandLineCompilerOptionsMap, t.buildInfoDirectory) + for option, value := range t.buildInfo.Options.Entries() { + result, ok := tsoptions.ConvertOptionToAbsolutePath(option, value, tsoptions.CommandLineCompilerOptionsMap, t.buildInfoDirectory) if ok { - tsoptions.ParseCompilerOptions(option.name, result, t.state.options) + tsoptions.ParseCompilerOptions(option, result, t.state.options) } else { - tsoptions.ParseCompilerOptions(option.name, value, t.state.options) + tsoptions.ParseCompilerOptions(option, value, t.state.options) } } } diff --git a/internal/testutil/incrementaltestutil/readablebuildinfo.go b/internal/testutil/incrementaltestutil/readablebuildinfo.go index b65d39e5f4..6a38b854bd 100644 --- a/internal/testutil/incrementaltestutil/readablebuildinfo.go +++ b/internal/testutil/incrementaltestutil/readablebuildinfo.go @@ -3,6 +3,7 @@ package incrementaltestutil import ( "encoding/json" + "github.com/microsoft/typescript-go/internal/collections" "github.com/microsoft/typescript-go/internal/core" "github.com/microsoft/typescript-go/internal/incremental" ) @@ -20,7 +21,7 @@ type readableBuildInfo struct { FileNames []string `json:"fileNames,omitzero"` FileInfos []*readableBuildInfoFileInfo `json:"fileInfos,omitzero"` FileIdsList [][]string `json:"fileIdsList,omitzero"` - Options []incremental.BuildInfoCompilerOption `json:"options,omitzero"` + Options *collections.OrderedMap[string, any] `json:"options,omitempty"` ReferencedMap []readableBuildInfoReferenceMapEntry `json:"referencedMap,omitzero"` SemanticDiagnosticsPerFile []incremental.BuildInfoSemanticDiagnostic `json:"semanticDiagnosticsPerFile,omitzero"` EmitDiagnosticsPerFile []incremental.BuildInfoDiagnosticOfFile `json:"emitDiagnosticsPerFile,omitzero"` diff --git a/internal/tsoptions/commandlineoption.go b/internal/tsoptions/commandlineoption.go index f0eb8e8d23..35b7541031 100644 --- a/internal/tsoptions/commandlineoption.go +++ b/internal/tsoptions/commandlineoption.go @@ -62,7 +62,7 @@ type CommandLineOption struct { // used for CommandLineOptionTypeList listPreserveFalsyValues bool // used for compilerOptionsDeclaration - ElementOptions map[string]*CommandLineOption + ElementOptions CommandLineOptionNameMap } func (o *CommandLineOption) DeprecatedKeys() *collections.Set[string] { diff --git a/internal/tsoptions/declscompiler.go b/internal/tsoptions/declscompiler.go index 1fade2d816..3e156db4f6 100644 --- a/internal/tsoptions/declscompiler.go +++ b/internal/tsoptions/declscompiler.go @@ -1248,19 +1248,19 @@ func optionsHaveChanges(oldOptions *core.CompilerOptions, newOptions *core.Compi return true } oldOptionsValue := reflect.ValueOf(oldOptions).Elem() - return ForEachCompilerOptionValue(newOptions, declFilter, func(option *CommandLineOption, value any, i int) bool { + return ForEachCompilerOptionValue(newOptions, declFilter, func(option *CommandLineOption, value reflect.Value, i int) bool { return !reflect.DeepEqual(value, oldOptionsValue.Field(i)) }) } -func ForEachCompilerOptionValue(options *core.CompilerOptions, declFilter func(*CommandLineOption) bool, fn func(option *CommandLineOption, value any, i int) bool) bool { +func ForEachCompilerOptionValue(options *core.CompilerOptions, declFilter func(*CommandLineOption) bool, fn func(option *CommandLineOption, value reflect.Value, i int) bool) bool { optionsValue := reflect.ValueOf(options).Elem() for i := range optionsValue.NumField() { field := optionsType.Field(i) if !field.IsExported() { continue } - if optionDeclaration, ok := CommandLineCompilerOptionsMap[field.Name]; ok && declFilter(optionDeclaration) { + if optionDeclaration := CommandLineCompilerOptionsMap.Get(field.Name); optionDeclaration != nil && declFilter(optionDeclaration) { if fn(optionDeclaration, optionsValue.Field(i), i) { return true } diff --git a/internal/tsoptions/parsinghelpers.go b/internal/tsoptions/parsinghelpers.go index 73454e288f..bb745a755d 100644 --- a/internal/tsoptions/parsinghelpers.go +++ b/internal/tsoptions/parsinghelpers.go @@ -168,7 +168,11 @@ func ParseCompilerOptions(key string, value any, allOptions *core.CompilerOption } func parseCompilerOptions(key string, value any, allOptions *core.CompilerOptions) (foundKey bool) { - switch key { + option := CommandLineCompilerOptionsMap.Get(key) + if option == nil { + return false + } + switch option.Name { case "allowJs": allOptions.AllowJs = parseTristate(value) case "allowImportingTsExtensions": @@ -540,7 +544,7 @@ func mergeCompilerOptions(targetOptions, sourceOptions *core.CompilerOptions, ra return targetOptions } -func convertToOptionsWithAbsolutePaths(optionsBase *collections.OrderedMap[string, any], optionMap map[string]*CommandLineOption, cwd string) *collections.OrderedMap[string, any] { +func convertToOptionsWithAbsolutePaths(optionsBase *collections.OrderedMap[string, any], optionMap CommandLineOptionNameMap, cwd string) *collections.OrderedMap[string, any] { // !!! convert to options with absolute paths was previously done with `CompilerOptions` object, but for ease of implementation, we do it pre-conversion. // !!! Revisit this choice if/when refactoring when conversion is done in tsconfig parsing if optionsBase == nil { @@ -555,8 +559,8 @@ func convertToOptionsWithAbsolutePaths(optionsBase *collections.OrderedMap[strin return optionsBase } -func ConvertOptionToAbsolutePath(o string, v any, optionMap map[string]*CommandLineOption, cwd string) (any, bool) { - option := optionMap[o] +func ConvertOptionToAbsolutePath(o string, v any, optionMap CommandLineOptionNameMap, cwd string) (any, bool) { + option := optionMap.Get(o) if option == nil || !option.IsFilePath { return nil, false } diff --git a/internal/tsoptions/tsconfigparsing.go b/internal/tsoptions/tsconfigparsing.go index 88152c4941..e18be90762 100644 --- a/internal/tsoptions/tsconfigparsing.go +++ b/internal/tsoptions/tsconfigparsing.go @@ -47,9 +47,9 @@ var extendsOptionDeclaration = &CommandLineOption{ Name: "extends", Kind: CommandLineOptionTypeListOrElement, Category: diagnostics.File_Management, - ElementOptions: map[string]*CommandLineOption{ - "extends": {Name: "extends", Kind: CommandLineOptionTypeString}, - }, + ElementOptions: commandLineOptionsToMap([]*CommandLineOption{ + {Name: "extends", Kind: CommandLineOptionTypeString}, + }), } var tsconfigRootOptionsMap = &CommandLineOption{ @@ -535,15 +535,26 @@ type tsConfigOptions struct { notDefined string } -func commandLineOptionsToMap(compilerOptions []*CommandLineOption) map[string]*CommandLineOption { - result := make(map[string]*CommandLineOption) +type CommandLineOptionNameMap map[string]*CommandLineOption + +func (m CommandLineOptionNameMap) Get(name string) *CommandLineOption { + opt, ok := m[name] + if !ok { + opt, ok = m[strings.ToLower(name)] + } + return opt +} + +func commandLineOptionsToMap(compilerOptions []*CommandLineOption) CommandLineOptionNameMap { + result := make(map[string]*CommandLineOption, len(compilerOptions)*2) for i := range compilerOptions { - result[(compilerOptions[i]).Name] = compilerOptions[i] + result[compilerOptions[i].Name] = compilerOptions[i] + result[strings.ToLower(compilerOptions[i].Name)] = compilerOptions[i] } return result } -var CommandLineCompilerOptionsMap map[string]*CommandLineOption = commandLineOptionsToMap(OptionsDeclarations) +var CommandLineCompilerOptionsMap CommandLineOptionNameMap = commandLineOptionsToMap(OptionsDeclarations) func convertMapToOptions[O optionParser](compilerOptions *collections.OrderedMap[string, any], result O) O { // this assumes any `key`, `value` pair in `options` will have `value` already be the correct type. this function should no error handling @@ -553,7 +564,7 @@ func convertMapToOptions[O optionParser](compilerOptions *collections.OrderedMap return result } -func convertOptionsFromJson[O optionParser](optionsNameMap map[string]*CommandLineOption, jsonOptions any, basePath string, result O) (O, []*ast.Diagnostic) { +func convertOptionsFromJson[O optionParser](optionsNameMap CommandLineOptionNameMap, jsonOptions any, basePath string, result O) (O, []*ast.Diagnostic) { if jsonOptions == nil { return result, nil } @@ -564,8 +575,8 @@ func convertOptionsFromJson[O optionParser](optionsNameMap map[string]*CommandLi } var errors []*ast.Diagnostic for key, value := range jsonMap.Entries() { - opt, ok := optionsNameMap[key] - if !ok { + opt := optionsNameMap.Get(key) + if opt == nil { // !!! TODO?: support suggestion errors = append(errors, createUnknownOptionError(key, result.UnknownOptionDiagnostic(), "", nil, nil, nil)) continue @@ -698,7 +709,7 @@ func convertObjectLiteralExpressionToJson( keyText := textOfKey var option *CommandLineOption = nil if keyText != "" && objectOption != nil && objectOption.ElementOptions != nil { - option = objectOption.ElementOptions[keyText] + option = objectOption.ElementOptions.Get(keyText) } value, err := convertPropertyValueToJson(sourceFile, element.AsPropertyAssignment().Initializer, option, returnValue, jsonConversionNotifier) errors = append(errors, err...) From 778dc6cfd9ee1d2a781a73acc17f3575191bf646 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 26 Jun 2025 16:47:47 -0700 Subject: [PATCH 06/36] make common js default impolied file format --- internal/incremental/buildInfo.go | 30 ++++++++++++++++--- internal/incremental/tobuildinfo.go | 29 ++---------------- .../incrementaltestutil/readablebuildinfo.go | 4 ++- 3 files changed, 32 insertions(+), 31 deletions(-) diff --git a/internal/incremental/buildInfo.go b/internal/incremental/buildInfo.go index de57555386..79e335cc50 100644 --- a/internal/incremental/buildInfo.go +++ b/internal/incremental/buildInfo.go @@ -89,15 +89,33 @@ type BuildInfoFileInfo struct { fileInfo *buildInfoFileInfoWithSignature } -func (b *BuildInfoFileInfo) HasSignature() bool { - return b.signature != "" +func newBuildInfoFileInfo(fileInfo *fileInfo) *BuildInfoFileInfo { + if fileInfo.version == fileInfo.signature { + if !fileInfo.affectsGlobalScope && fileInfo.impliedNodeFormat == core.ResolutionModeCommonJS { + return &BuildInfoFileInfo{signature: fileInfo.signature} + } + } else if fileInfo.signature == "" { + return &BuildInfoFileInfo{noSignature: &buildInfoFileInfoNoSignature{ + Version: fileInfo.version, + NoSignature: true, + AffectsGlobalScope: fileInfo.affectsGlobalScope, + ImpliedNodeFormat: fileInfo.impliedNodeFormat, + }} + } + return &BuildInfoFileInfo{fileInfo: &buildInfoFileInfoWithSignature{ + Version: fileInfo.version, + Signature: core.IfElse(fileInfo.signature == fileInfo.version, "", fileInfo.signature), + AffectsGlobalScope: fileInfo.affectsGlobalScope, + ImpliedNodeFormat: fileInfo.impliedNodeFormat, + }} } func (b *BuildInfoFileInfo) GetFileInfo() *fileInfo { if b.signature != "" { return &fileInfo{ - version: b.signature, - signature: b.signature, + version: b.signature, + signature: b.signature, + impliedNodeFormat: core.ResolutionModeCommonJS, } } if b.noSignature != nil { @@ -115,6 +133,10 @@ func (b *BuildInfoFileInfo) GetFileInfo() *fileInfo { } } +func (b *BuildInfoFileInfo) HasSignature() bool { + return b.signature != "" +} + func (b *BuildInfoFileInfo) MarshalJSON() ([]byte, error) { if b.signature != "" { return json.Marshal(b.signature) diff --git a/internal/incremental/tobuildinfo.go b/internal/incremental/tobuildinfo.go index 89d893ad15..484e1f4712 100644 --- a/internal/incremental/tobuildinfo.go +++ b/internal/incremental/tobuildinfo.go @@ -200,39 +200,16 @@ func (t *toBuildInfo) setFileInfoAndEmitSignatures() { } } if actualSignature == info.signature { - t.setFileInfo(info) + t.buildInfo.FileInfos = append(t.buildInfo.FileInfos, newBuildInfoFileInfo(info)) } else { - t.setFileInfo(&fileInfo{ + t.buildInfo.FileInfos = append(t.buildInfo.FileInfos, newBuildInfoFileInfo(&fileInfo{ version: info.version, signature: actualSignature, affectsGlobalScope: info.affectsGlobalScope, impliedNodeFormat: info.impliedNodeFormat, - }) - } - } -} - -func (t *toBuildInfo) setFileInfo(fileInfo *fileInfo) { - if fileInfo.version == fileInfo.signature { - if !fileInfo.affectsGlobalScope && fileInfo.impliedNodeFormat == core.ResolutionModeNone { - t.buildInfo.FileInfos = append(t.buildInfo.FileInfos, &BuildInfoFileInfo{signature: fileInfo.signature}) - return + })) } - } else if fileInfo.signature == "" { - t.buildInfo.FileInfos = append(t.buildInfo.FileInfos, &BuildInfoFileInfo{noSignature: &buildInfoFileInfoNoSignature{ - Version: fileInfo.version, - NoSignature: true, - AffectsGlobalScope: fileInfo.affectsGlobalScope, - ImpliedNodeFormat: fileInfo.impliedNodeFormat, - }}) - return } - t.buildInfo.FileInfos = append(t.buildInfo.FileInfos, &BuildInfoFileInfo{fileInfo: &buildInfoFileInfoWithSignature{ - Version: fileInfo.version, - Signature: core.IfElse(fileInfo.signature == fileInfo.version, "", fileInfo.signature), - AffectsGlobalScope: fileInfo.affectsGlobalScope, - ImpliedNodeFormat: fileInfo.impliedNodeFormat, - }}) } func (t *toBuildInfo) setCompilerOptions() { diff --git a/internal/testutil/incrementaltestutil/readablebuildinfo.go b/internal/testutil/incrementaltestutil/readablebuildinfo.go index 6a38b854bd..d3ce47fb37 100644 --- a/internal/testutil/incrementaltestutil/readablebuildinfo.go +++ b/internal/testutil/incrementaltestutil/readablebuildinfo.go @@ -34,6 +34,7 @@ type readableBuildInfo struct { } type readableBuildInfoFileInfo struct { + FileName string `json:"fileName,omitzero"` Version string `json:"version,omitzero"` Signature string `json:"signature,omitzero"` AffectsGlobalScope bool `json:"affectsGlobalScope,omitzero"` @@ -132,13 +133,14 @@ func (r *readableBuildInfo) toFilePathSet(fileIdListId incremental.BuildInfoFile } func (r *readableBuildInfo) setFileInfos() { - for _, original := range r.buildInfo.FileInfos { + for index, original := range r.buildInfo.FileInfos { fileInfo := original.GetFileInfo() // Dont set original for string encoding if original.HasSignature() { original = nil } r.FileInfos = append(r.FileInfos, &readableBuildInfoFileInfo{ + FileName: r.toFilePath(incremental.BuildInfoFileId(index + 1)), Version: fileInfo.Version(), Signature: fileInfo.Signature(), AffectsGlobalScope: fileInfo.AffectsGlobalScope(), From ea85af3a7f68267bb26a2634a9413c62c0b52cf1 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 26 Jun 2025 22:07:49 -0700 Subject: [PATCH 07/36] More changes --- internal/incremental/buildInfo.go | 256 +++-------------- internal/incremental/programstate.go | 69 ++++- internal/incremental/tobuildinfo.go | 184 ++++++------ internal/incremental/toprogramstate.go | 87 +++--- .../incrementaltestutil/readablebuildinfo.go | 264 ++++++++++++------ 5 files changed, 408 insertions(+), 452 deletions(-) diff --git a/internal/incremental/buildInfo.go b/internal/incremental/buildInfo.go index 79e335cc50..e79807a289 100644 --- a/internal/incremental/buildInfo.go +++ b/internal/incremental/buildInfo.go @@ -4,9 +4,7 @@ import ( "encoding/json" "fmt" - "github.com/microsoft/typescript-go/internal/ast" "github.com/microsoft/typescript-go/internal/collections" - "github.com/microsoft/typescript-go/internal/compiler" "github.com/microsoft/typescript-go/internal/core" "github.com/microsoft/typescript-go/internal/diagnostics" "github.com/microsoft/typescript-go/internal/tspath" @@ -188,231 +186,67 @@ func (b *BuildInfoReferenceMapEntry) UnmarshalJSON(data []byte) error { } type BuildInfoDiagnostic struct { - // false if diagnostic is not for a file, - // incrementalBuildInfoFileId if it is for a file thats other than its stored for - file any - loc core.TextRange - code int32 - category diagnostics.Category - message string - messageChain []*BuildInfoDiagnostic - relatedInformation []*BuildInfoDiagnostic - reportsUnnecessary bool - reportsDeprecated bool - skippedOnNoEmit bool -} - -func (b *BuildInfoDiagnostic) toDiagnostic(p *compiler.Program, file *ast.SourceFile) *ast.Diagnostic { - var fileForDiagnostic *ast.SourceFile - if b.file != false { - if b.file == nil { - fileForDiagnostic = file - } else { - fileForDiagnostic = p.GetSourceFileByPath(tspath.Path(b.file.(string))) - } - } - var messageChain []*ast.Diagnostic - for _, msg := range b.messageChain { - messageChain = append(messageChain, msg.toDiagnostic(p, fileForDiagnostic)) - } - var relatedInformation []*ast.Diagnostic - for _, info := range b.relatedInformation { - relatedInformation = append(relatedInformation, info.toDiagnostic(p, fileForDiagnostic)) - } - return ast.NewDiagnosticWith( - fileForDiagnostic, - b.loc, - b.code, - b.category, - b.message, - messageChain, - relatedInformation, - b.reportsUnnecessary, - b.reportsDeprecated, - b.skippedOnNoEmit, - ) -} - -func (b *BuildInfoDiagnostic) MarshalJSON() ([]byte, error) { - info := map[string]any{} - if b.file != "" { - info["file"] = b.file - info["pos"] = b.loc.Pos() - info["end"] = b.loc.End() - } - info["code"] = b.code - info["category"] = b.category - info["message"] = b.message - if len(b.messageChain) > 0 { - info["messageChain"] = b.messageChain - } - if len(b.relatedInformation) > 0 { - info["relatedInformation"] = b.relatedInformation - } - if b.reportsUnnecessary { - info["reportsUnnecessary"] = b.reportsUnnecessary - } - if b.reportsDeprecated { - info["reportsDeprecated"] = b.reportsDeprecated - } - if b.skippedOnNoEmit { - info["skippedOnNoEmit"] = b.skippedOnNoEmit - } - return json.Marshal(info) -} - -func (b *BuildInfoDiagnostic) UnmarshalJSON(data []byte) error { - var vIncrementalBuildInfoDiagnostic map[string]any - if err := json.Unmarshal(data, &vIncrementalBuildInfoDiagnostic); err != nil { - return fmt.Errorf("invalid incrementalBuildInfoDiagnostic: %s", data) - } - - *b = BuildInfoDiagnostic{} - if file, ok := vIncrementalBuildInfoDiagnostic["file"]; ok { - if _, ok := file.(float64); !ok { - if value, ok := file.(bool); !ok || value { - return fmt.Errorf("invalid file in incrementalBuildInfoDiagnostic: expected false or float64, got %T", file) - } - } - b.file = file - var pos float64 - posV, ok := vIncrementalBuildInfoDiagnostic["pos"] - if ok { - pos, ok = posV.(float64) - if !ok { - return fmt.Errorf("invalid pos in incrementalBuildInfoDiagnostic: expected float64, got %T", posV) - } - } else { - return fmt.Errorf("missing pos in incrementalBuildInfoDiagnostic") - } - var end float64 - endv, ok := vIncrementalBuildInfoDiagnostic["end"] - if ok { - end, ok = endv.(float64) - if !ok { - return fmt.Errorf("invalid end in incrementalBuildInfoDiagnostic: expected float64, got %T", endv) - } - } else { - return fmt.Errorf("missing end in incrementalBuildInfoDiagnostic") - } - b.loc = core.NewTextRange(int(pos), int(end)) - } - if codeV, ok := vIncrementalBuildInfoDiagnostic["code"]; ok { - code, ok := codeV.(float64) - if !ok { - return fmt.Errorf("invalid code in incrementalBuildInfoDiagnostic: expected float64, got %T", codeV) - } - b.code = int32(code) - } else { - return fmt.Errorf("missing code in incrementalBuildInfoDiagnostic") - } - if categoryV, ok := vIncrementalBuildInfoDiagnostic["category"]; ok { - category, ok := categoryV.(float64) - if !ok { - return fmt.Errorf("invalid category in incrementalBuildInfoDiagnostic: expected float64, got %T", categoryV) - } - if category < 0 || category > float64(diagnostics.CategoryMessage) { - return fmt.Errorf("invalid category in incrementalBuildInfoDiagnostic: %f is out of range", category) - } - b.category = diagnostics.Category(category) - } else { - return fmt.Errorf("missing category in incrementalBuildInfoDiagnostic") - } - if messageV, ok := vIncrementalBuildInfoDiagnostic["message"]; ok { - if b.message, ok = messageV.(string); !ok { - return fmt.Errorf("invalid message in incrementalBuildInfoDiagnostic: expected string, got %T", messageV) - } - } else { - return fmt.Errorf("missing message in incrementalBuildInfoDiagnostic") - } - if messageChain, ok := vIncrementalBuildInfoDiagnostic["messageChain"]; ok { - if messages, ok := messageChain.([]any); ok { - b.messageChain = make([]*BuildInfoDiagnostic, len(messages)) - for _, msg := range messages { - var diagnostic BuildInfoDiagnostic - if err := json.Unmarshal([]byte(msg.(string)), &diagnostic); err != nil { - return fmt.Errorf("invalid messageChain in incrementalBuildInfoDiagnostic: %s", msg) - } - b.messageChain = append(b.messageChain, &diagnostic) - } - } - } - if relatedInformation, ok := vIncrementalBuildInfoDiagnostic["relatedInformation"]; ok { - if infos, ok := relatedInformation.([]any); ok { - b.relatedInformation = make([]*BuildInfoDiagnostic, len(infos)) - for _, info := range infos { - var diagnostic BuildInfoDiagnostic - if err := json.Unmarshal([]byte(info.(string)), &diagnostic); err != nil { - return fmt.Errorf("invalid relatedInformation in incrementalBuildInfoDiagnostic: %s", info) - } - b.relatedInformation = append(b.relatedInformation, &diagnostic) - } - } - } - if reportsUnnecessary, ok := vIncrementalBuildInfoDiagnostic["reportsUnnecessary"]; ok { - if b.reportsUnnecessary, ok = reportsUnnecessary.(bool); !ok { - return fmt.Errorf("invalid reportsUnnecessary in incrementalBuildInfoDiagnostic: expected boolean, got %T", reportsUnnecessary) - } - } - if reportsDeprecated, ok := vIncrementalBuildInfoDiagnostic["reportsDeprecated"]; ok { - if b.reportsDeprecated, ok = reportsDeprecated.(bool); !ok { - return fmt.Errorf("invalid reportsDeprecated in incrementalBuildInfoDiagnostic: expected boolean, got %T", reportsDeprecated) - } - } - if skippedOnNoEmit, ok := vIncrementalBuildInfoDiagnostic["skippedOnNoEmit"]; ok { - if b.skippedOnNoEmit, ok = skippedOnNoEmit.(bool); !ok { - return fmt.Errorf("invalid skippedOnNoEmit in incrementalBuildInfoDiagnostic: expected boolean, got %T", skippedOnNoEmit) - } - } - return nil -} - -type BuildInfoDiagnosticOfFile struct { - fileId BuildInfoFileId - diagnostics []*BuildInfoDiagnostic -} - -func (b *BuildInfoDiagnosticOfFile) MarshalJSON() ([]byte, error) { + // incrementalBuildInfoFileId if it is for a File thats other than its stored for + File BuildInfoFileId `json:"file,omitzero"` + NoFile bool `json:"noFile,omitzero"` + Pos int `json:"pos,omitzero"` + End int `json:"end,omitzero"` + Code int32 `json:"code,omitzero"` + Category diagnostics.Category `json:"category,omitzero"` + Message string `json:"message,omitzero"` + MessageChain []*BuildInfoDiagnostic `json:"messageChain,omitzero"` + RelatedInformation []*BuildInfoDiagnostic `json:"relatedInformation,omitzero"` + ReportsUnnecessary bool `json:"reportsUnnecessary,omitzero"` + ReportsDeprecated bool `json:"reportsDeprecated,omitzero"` + SkippedOnNoEmit bool `json:"skippedOnNoEmit,omitzero"` +} + +type BuildInfoDiagnosticsOfFile struct { + FileId BuildInfoFileId + Diagnostics []*BuildInfoDiagnostic +} + +func (b *BuildInfoDiagnosticsOfFile) MarshalJSON() ([]byte, error) { fileIdAndDiagnostics := make([]any, 0, 2) - fileIdAndDiagnostics = append(fileIdAndDiagnostics, b.fileId) - fileIdAndDiagnostics = append(fileIdAndDiagnostics, b.diagnostics) + fileIdAndDiagnostics = append(fileIdAndDiagnostics, b.FileId) + fileIdAndDiagnostics = append(fileIdAndDiagnostics, b.Diagnostics) return json.Marshal(fileIdAndDiagnostics) } -func (b *BuildInfoDiagnosticOfFile) UnmarshalJSON(data []byte) error { +func (b *BuildInfoDiagnosticsOfFile) UnmarshalJSON(data []byte) error { var fileIdAndDiagnostics []any if err := json.Unmarshal(data, &fileIdAndDiagnostics); err != nil { - return fmt.Errorf("invalid IncrementalBuildInfoDiagnostic: %s", data) + return fmt.Errorf("invalid BuildInfoDiagnosticsOfFile: %s", data) } if len(fileIdAndDiagnostics) != 2 { - return fmt.Errorf("invalid IncrementalBuildInfoDiagnostic: expected 2 elements, got %d", len(fileIdAndDiagnostics)) + return fmt.Errorf("invalid BuildInfoDiagnosticsOfFile: expected 2 elements, got %d", len(fileIdAndDiagnostics)) } var fileId BuildInfoFileId if fileIdV, ok := fileIdAndDiagnostics[0].(float64); !ok { - return fmt.Errorf("invalid fileId in IncrementalBuildInfoDiagnostic: expected float64, got %T", fileIdAndDiagnostics[0]) + return fmt.Errorf("invalid fileId in BuildInfoDiagnosticsOfFile: expected float64, got %T", fileIdAndDiagnostics[0]) } else { fileId = BuildInfoFileId(fileIdV) } if diagnostics, ok := fileIdAndDiagnostics[1].([]*BuildInfoDiagnostic); ok { - *b = BuildInfoDiagnosticOfFile{ - fileId: fileId, - diagnostics: diagnostics, + *b = BuildInfoDiagnosticsOfFile{ + FileId: fileId, + Diagnostics: diagnostics, } return nil } - return fmt.Errorf("invalid diagnostics in IncrementalBuildInfoDiagnostic: expected []*incrementalBuildInfoDiagnostic, got %T", fileIdAndDiagnostics[1]) + return fmt.Errorf("invalid diagnostics in BuildInfoDiagnosticsOfFile: expected []*BuildInfoDiagnostic, got %T", fileIdAndDiagnostics[1]) } type BuildInfoSemanticDiagnostic struct { - FileId BuildInfoFileId // File is not in changedSet and still doesnt have cached diagnostics - Diagnostic BuildInfoDiagnosticOfFile // Diagnostics for file + FileId BuildInfoFileId // File is not in changedSet and still doesnt have cached diagnostics + Diagnostics *BuildInfoDiagnosticsOfFile // Diagnostics for file } func (b *BuildInfoSemanticDiagnostic) MarshalJSON() ([]byte, error) { if b.FileId != 0 { return json.Marshal(b.FileId) } - return json.Marshal(b.Diagnostic) + return json.Marshal(b.Diagnostics) } func (b *BuildInfoSemanticDiagnostic) UnmarshalJSON(data []byte) error { @@ -423,14 +257,14 @@ func (b *BuildInfoSemanticDiagnostic) UnmarshalJSON(data []byte) error { } return nil } - var diagnostic BuildInfoDiagnosticOfFile - if err := json.Unmarshal(data, &diagnostic); err == nil { + var diagnostics BuildInfoDiagnosticsOfFile + if err := json.Unmarshal(data, &diagnostics); err == nil { *b = BuildInfoSemanticDiagnostic{ - Diagnostic: diagnostic, + Diagnostics: &diagnostics, } return nil } - return fmt.Errorf("invalid IncrementalBuildInfoDiagnostic: %s", data) + return fmt.Errorf("invalid BuildInfoSemanticDiagnostic: %s", data) } /** @@ -589,20 +423,20 @@ type BuildInfo struct { // Common between incremental and tsc -b buildinfo for non incremental programs Errors bool `json:"errors,omitzero"` CheckPending bool `json:"checkPending,omitzero"` - // Root []BuildInfoRoot `json:"root,omitempty,omitzero"` + // Root []BuildInfoRoot `json:"root,omitzero"` // IncrementalProgram info FileNames []string `json:"fileNames,omitzero"` FileInfos []*BuildInfoFileInfo `json:"fileInfos,omitzero"` FileIdsList [][]BuildInfoFileId `json:"fileIdsList,omitzero"` - Options *collections.OrderedMap[string, any] `json:"options,omitempty"` - ReferencedMap []BuildInfoReferenceMapEntry `json:"referencedMap,omitzero"` - SemanticDiagnosticsPerFile []BuildInfoSemanticDiagnostic `json:"semanticDiagnosticsPerFile,omitzero"` - EmitDiagnosticsPerFile []BuildInfoDiagnosticOfFile `json:"emitDiagnosticsPerFile,omitzero"` + Options *collections.OrderedMap[string, any] `json:"options,omitzero"` + ReferencedMap []*BuildInfoReferenceMapEntry `json:"referencedMap,omitzero"` + SemanticDiagnosticsPerFile []*BuildInfoSemanticDiagnostic `json:"semanticDiagnosticsPerFile,omitzero"` + EmitDiagnosticsPerFile []*BuildInfoDiagnosticsOfFile `json:"emitDiagnosticsPerFile,omitzero"` ChangeFileSet []BuildInfoFileId `json:"changeFileSet,omitzero"` - AffectedFilesPendingEmit []BuildInfoFilePendingEmit `json:"affectedFilesPendingEmit,omitzero"` + AffectedFilesPendingEmit []*BuildInfoFilePendingEmit `json:"affectedFilesPendingEmit,omitzero"` LatestChangedDtsFile string `json:"latestChangedDtsFile,omitzero"` // Because this is only output file in the program, we dont need fileId to deduplicate name - EmitSignatures []BuildInfoEmitSignature `json:"emitSignatures,omitzero"` + EmitSignatures []*BuildInfoEmitSignature `json:"emitSignatures,omitzero"` // resolvedRoot: readonly IncrementalBuildInfoResolvedRoot[] | undefined; } diff --git a/internal/incremental/programstate.go b/internal/incremental/programstate.go index 61c215fcf9..4ab3341507 100644 --- a/internal/incremental/programstate.go +++ b/internal/incremental/programstate.go @@ -147,17 +147,62 @@ func (e *emitSignature) getNewEmitSignature(oldOptions *core.CompilerOptions, ne } } -type diagnosticsOrBuildInfoDiagnostics struct { +type buildInfoDiagnosticWithFileName struct { + // filename if it is for a File thats other than its stored for + file tspath.Path + noFile bool + pos int + end int + code int32 + category diagnostics.Category + message string + messageChain []*buildInfoDiagnosticWithFileName + relatedInformation []*buildInfoDiagnosticWithFileName + reportsUnnecessary bool + reportsDeprecated bool + skippedOnNoEmit bool +} + +type diagnosticsOrBuildInfoDiagnosticsWithFileName struct { diagnostics []*ast.Diagnostic - buildInfoDiagnostics []*BuildInfoDiagnostic + buildInfoDiagnostics []*buildInfoDiagnosticWithFileName +} + +func (b *buildInfoDiagnosticWithFileName) toDiagnostic(p *compiler.Program, file *ast.SourceFile) *ast.Diagnostic { + var fileForDiagnostic *ast.SourceFile + if b.file != "" { + fileForDiagnostic = p.GetSourceFileByPath(b.file) + } else if !b.noFile { + fileForDiagnostic = file + } + var messageChain []*ast.Diagnostic + for _, msg := range b.messageChain { + messageChain = append(messageChain, msg.toDiagnostic(p, fileForDiagnostic)) + } + var relatedInformation []*ast.Diagnostic + for _, info := range b.relatedInformation { + relatedInformation = append(relatedInformation, info.toDiagnostic(p, fileForDiagnostic)) + } + return ast.NewDiagnosticWith( + fileForDiagnostic, + core.NewTextRange(b.pos, b.end), + b.code, + b.category, + b.message, + messageChain, + relatedInformation, + b.reportsUnnecessary, + b.reportsDeprecated, + b.skippedOnNoEmit, + ) } -func (d *diagnosticsOrBuildInfoDiagnostics) getDiagnostics(p *compiler.Program, file *ast.SourceFile) []*ast.Diagnostic { +func (d *diagnosticsOrBuildInfoDiagnosticsWithFileName) getDiagnostics(p *compiler.Program, file *ast.SourceFile) []*ast.Diagnostic { if d.diagnostics != nil { return d.diagnostics } // Convert and cache the diagnostics - d.diagnostics = core.Map(d.buildInfoDiagnostics, func(diag *BuildInfoDiagnostic) *ast.Diagnostic { + d.diagnostics = core.Map(d.buildInfoDiagnostics, func(diag *buildInfoDiagnosticWithFileName) *ast.Diagnostic { return diag.toDiagnostic(p, file) }) return d.diagnostics @@ -177,9 +222,9 @@ type programState struct { /** * Cache of bind and check diagnostics for files with their Path being the key */ - semanticDiagnosticsPerFile map[tspath.Path]*diagnosticsOrBuildInfoDiagnostics + semanticDiagnosticsPerFile map[tspath.Path]*diagnosticsOrBuildInfoDiagnosticsWithFileName /** Cache of dts emit diagnostics for files with their Path being the key */ - emitDiagnosticsPerFile map[tspath.Path]*diagnosticsOrBuildInfoDiagnostics + emitDiagnosticsPerFile map[tspath.Path]*diagnosticsOrBuildInfoDiagnosticsWithFileName /** * The map has key by source file's path that has been changed */ @@ -462,9 +507,9 @@ func (p *programState) emitNextAffectedFile(ctx context.Context, program *compil } if len(result.Diagnostics) != 0 { if p.emitDiagnosticsPerFile == nil { - p.emitDiagnosticsPerFile = make(map[tspath.Path]*diagnosticsOrBuildInfoDiagnostics) + p.emitDiagnosticsPerFile = make(map[tspath.Path]*diagnosticsOrBuildInfoDiagnosticsWithFileName) } - p.emitDiagnosticsPerFile[affected.Path()] = &diagnosticsOrBuildInfoDiagnostics{ + p.emitDiagnosticsPerFile[affected.Path()] = &diagnosticsOrBuildInfoDiagnosticsWithFileName{ diagnostics: result.Diagnostics, } } @@ -493,7 +538,7 @@ func (p *programState) getNextAffectedFilePendingEmit(program *compiler.Program, return nil, 0 } -func (p *programState) getNextPendingEmitDiagnosticsFile(program *compiler.Program, isForDtsErrors bool) (*ast.SourceFile, *diagnosticsOrBuildInfoDiagnostics, fileEmitKind) { +func (p *programState) getNextPendingEmitDiagnosticsFile(program *compiler.Program, isForDtsErrors bool) (*ast.SourceFile, *diagnosticsOrBuildInfoDiagnosticsWithFileName, fileEmitKind) { if len(p.emitDiagnosticsPerFile) == 0 { return nil, nil, 0 } @@ -726,7 +771,7 @@ func (p *programState) getSemanticDiagnosticsOfFile(ctx context.Context, program // Diagnostics werent cached, get them from program, and cache the result diagnostics := program.GetSemanticDiagnostics(ctx, file) - p.semanticDiagnosticsPerFile[file.Path()] = &diagnosticsOrBuildInfoDiagnostics{diagnostics: diagnostics} + p.semanticDiagnosticsPerFile[file.Path()] = &diagnosticsOrBuildInfoDiagnosticsWithFileName{diagnostics: diagnostics} p.buildInfoEmitPending = true return compiler.FilterNoEmitSemanticDiagnostics(diagnostics, p.options) } @@ -1124,7 +1169,7 @@ func newProgramState(program *compiler.Program, oldProgram *Program) *programSta files := program.GetSourceFiles() state := &programState{ options: program.Options(), - semanticDiagnosticsPerFile: make(map[tspath.Path]*diagnosticsOrBuildInfoDiagnostics, len(files)), + semanticDiagnosticsPerFile: make(map[tspath.Path]*diagnosticsOrBuildInfoDiagnosticsWithFileName, len(files)), seenEmittedFiles: make(map[tspath.Path]fileEmitKind, len(files)), } state.createReferenceMap() @@ -1206,7 +1251,7 @@ func newProgramState(program *compiler.Program, oldProgram *Program) *programSta if !state.changedFilesSet.Has(file.Path()) { if emitDiagnostics, ok := oldProgram.state.emitDiagnosticsPerFile[file.Path()]; ok { if state.emitDiagnosticsPerFile == nil { - state.emitDiagnosticsPerFile = make(map[tspath.Path]*diagnosticsOrBuildInfoDiagnostics, len(files)) + state.emitDiagnosticsPerFile = make(map[tspath.Path]*diagnosticsOrBuildInfoDiagnosticsWithFileName, len(files)) } state.emitDiagnosticsPerFile[file.Path()] = emitDiagnostics } diff --git a/internal/incremental/tobuildinfo.go b/internal/incremental/tobuildinfo.go index 484e1f4712..8644c46c3d 100644 --- a/internal/incremental/tobuildinfo.go +++ b/internal/incremental/tobuildinfo.go @@ -31,7 +31,7 @@ func programStateToBuildInfo(state *programState, program *compiler.Program, bui if state.options.IsIncremental() { to.setFileInfoAndEmitSignatures() to.setCompilerOptions() - to.setReferenceMap() + to.setReferencedMap() to.setChangeFileSet() to.setSemanticDiagnostics() to.setEmitDiagnostics() @@ -96,9 +96,7 @@ func (t *toBuildInfo) toRelativeToBuildInfoCompilerOptionValue(option *tsoptions } if option.Kind == "list" { if arr, ok := v.([]string); ok { - return core.Map(arr, func(item string) string { - return t.relativeToBuildInfo(item) - }) + return core.Map(arr, t.relativeToBuildInfo) } } else if str, ok := v.(string); ok && str != "" { return t.relativeToBuildInfo(v.(string)) @@ -106,64 +104,73 @@ func (t *toBuildInfo) toRelativeToBuildInfoCompilerOptionValue(option *tsoptions return v } -func (t *toBuildInfo) toDiagnosticCompatibleWithBuildInfo(diagnostics []*BuildInfoDiagnostic) ([]*BuildInfoDiagnostic, bool) { - var fixedDiagnostics []*BuildInfoDiagnostic - var changed bool - for _, d := range diagnostics { - file := d.file - if d.file != false && d.file != "" { - file = t.toFileId(d.file.(tspath.Path)) +func (t *toBuildInfo) toBuildInfoDiagnosticsFromFileNameDiagnostics(diagnostics []*buildInfoDiagnosticWithFileName) []*BuildInfoDiagnostic { + return core.Map(diagnostics, func(d *buildInfoDiagnosticWithFileName) *BuildInfoDiagnostic { + var file BuildInfoFileId + if d.file != "" { + file = t.toFileId(d.file) } - messageChain, changedMessageChain := t.toDiagnosticCompatibleWithBuildInfo(d.messageChain) - relatedInformation, changedRelatedInformation := t.toDiagnosticCompatibleWithBuildInfo(d.relatedInformation) - if file != d.file || changedMessageChain || changedRelatedInformation { - fixedDiagnostics = append(fixedDiagnostics, &BuildInfoDiagnostic{ - file: file, - loc: d.loc, - code: d.code, - category: d.category, - message: d.message, - messageChain: messageChain, - relatedInformation: relatedInformation, - reportsUnnecessary: d.reportsUnnecessary, - reportsDeprecated: d.reportsDeprecated, - skippedOnNoEmit: d.skippedOnNoEmit, - }) - changed = true - } else { - fixedDiagnostics = append(fixedDiagnostics, d) + return &BuildInfoDiagnostic{ + File: file, + NoFile: d.noFile, + Pos: d.pos, + End: d.end, + Code: d.code, + Category: d.category, + Message: d.message, + MessageChain: t.toBuildInfoDiagnosticsFromFileNameDiagnostics(d.messageChain), + RelatedInformation: t.toBuildInfoDiagnosticsFromFileNameDiagnostics(d.relatedInformation), + ReportsUnnecessary: d.reportsUnnecessary, + ReportsDeprecated: d.reportsDeprecated, + SkippedOnNoEmit: d.skippedOnNoEmit, } - } - return core.IfElse(changed, fixedDiagnostics, diagnostics), changed + }) } -func (t *toBuildInfo) toIncrementalBuildInfoDiagnostic(diagnostics []*ast.Diagnostic, file *ast.SourceFile) []*BuildInfoDiagnostic { - var incrementalDiagnostics []*BuildInfoDiagnostic - for _, d := range diagnostics { - var fileValue any +func (t *toBuildInfo) toBuildInfoDiagnosticsFromDiagnostics(filePath tspath.Path, diagnostics []*ast.Diagnostic) []*BuildInfoDiagnostic { + return core.Map(diagnostics, func(d *ast.Diagnostic) *BuildInfoDiagnostic { + var file BuildInfoFileId + noFile := false if d.File() == nil { - fileValue = false - } else if d.File() != file { - fileValue = t.toFileId(d.File().Path()) + noFile = true + } else if d.File().Path() != filePath { + file = t.toFileId(d.File().Path()) + } + return &BuildInfoDiagnostic{ + File: file, + NoFile: noFile, + Pos: d.Loc().Pos(), + End: d.Loc().End(), + Code: d.Code(), + Category: d.Category(), + Message: d.Message(), + MessageChain: t.toBuildInfoDiagnosticsFromDiagnostics(filePath, d.MessageChain()), + RelatedInformation: t.toBuildInfoDiagnosticsFromDiagnostics(filePath, d.RelatedInformation()), + ReportsUnnecessary: d.ReportsUnnecessary(), + ReportsDeprecated: d.ReportsDeprecated(), + SkippedOnNoEmit: d.SkippedOnNoEmit(), + } + }) +} + +func (t *toBuildInfo) toBuildInfoDiagnosticsOfFile(filePath tspath.Path, diags *diagnosticsOrBuildInfoDiagnosticsWithFileName) *BuildInfoDiagnosticsOfFile { + if len(diags.diagnostics) > 0 { + return &BuildInfoDiagnosticsOfFile{ + FileId: t.toFileId(filePath), + Diagnostics: t.toBuildInfoDiagnosticsFromDiagnostics(filePath, diags.diagnostics), + } + } + if len(diags.buildInfoDiagnostics) > 0 { + return &BuildInfoDiagnosticsOfFile{ + FileId: t.toFileId(filePath), + Diagnostics: t.toBuildInfoDiagnosticsFromFileNameDiagnostics(diags.buildInfoDiagnostics), } - incrementalDiagnostics = append(incrementalDiagnostics, &BuildInfoDiagnostic{ - file: fileValue, - loc: d.Loc(), - code: d.Code(), - category: d.Category(), - message: d.Message(), - messageChain: t.toIncrementalBuildInfoDiagnostic(d.MessageChain(), file), - relatedInformation: t.toIncrementalBuildInfoDiagnostic(d.RelatedInformation(), file), - reportsUnnecessary: d.ReportsUnnecessary(), - reportsDeprecated: d.ReportsDeprecated(), - skippedOnNoEmit: d.SkippedOnNoEmit(), - }) } - return incrementalDiagnostics + return nil } func (t *toBuildInfo) setFileInfoAndEmitSignatures() { - for _, file := range t.program.GetSourceFiles() { + t.buildInfo.FileInfos = core.Map(t.program.GetSourceFiles(), func(file *ast.SourceFile) *BuildInfoFileInfo { info := t.state.fileInfos[file.Path()] fileId := t.toFileId(file.Path()) // tryAddRoot(key, fileId); @@ -180,11 +187,11 @@ func (t *toBuildInfo) setFileInfoAndEmitSignatures() { if !ast.IsJsonSourceFile(file) && t.program.SourceFileMayBeEmitted(file, false) { emitSignature := t.state.emitSignatures[file.Path()] if emitSignature == nil { - t.buildInfo.EmitSignatures = append(t.buildInfo.EmitSignatures, BuildInfoEmitSignature{ + t.buildInfo.EmitSignatures = append(t.buildInfo.EmitSignatures, &BuildInfoEmitSignature{ fileId: fileId, }) } else if emitSignature.signature != actualSignature { - incrementalEmitSignature := BuildInfoEmitSignature{ + incrementalEmitSignature := &BuildInfoEmitSignature{ fileId: fileId, } if emitSignature.signature != "" { @@ -200,21 +207,22 @@ func (t *toBuildInfo) setFileInfoAndEmitSignatures() { } } if actualSignature == info.signature { - t.buildInfo.FileInfos = append(t.buildInfo.FileInfos, newBuildInfoFileInfo(info)) + return newBuildInfoFileInfo(info) } else { - t.buildInfo.FileInfos = append(t.buildInfo.FileInfos, newBuildInfoFileInfo(&fileInfo{ + return newBuildInfoFileInfo(&fileInfo{ version: info.version, signature: actualSignature, affectsGlobalScope: info.affectsGlobalScope, impliedNodeFormat: info.impliedNodeFormat, - })) + }) } - } + }) } func (t *toBuildInfo) setCompilerOptions() { tsoptions.ForEachCompilerOptionValue( - t.state.options, func(option *tsoptions.CommandLineOption) bool { + t.state.options, + func(option *tsoptions.CommandLineOption) bool { return option.AffectsBuildInfo }, func(option *tsoptions.CommandLineOption, value reflect.Value, i int) bool { @@ -231,27 +239,25 @@ func (t *toBuildInfo) setCompilerOptions() { ) } -func (t *toBuildInfo) setReferenceMap() { +func (t *toBuildInfo) setReferencedMap() { if !t.state.tracksReferences() { return } keys := slices.Collect(maps.Keys(t.state.referencedMap.Keys())) slices.Sort(keys) - for _, filePath := range keys { + t.buildInfo.ReferencedMap = core.Map(keys, func(filePath tspath.Path) *BuildInfoReferenceMapEntry { references, _ := t.state.referencedMap.GetValues(filePath) - t.buildInfo.ReferencedMap = append(t.buildInfo.ReferencedMap, BuildInfoReferenceMapEntry{ + return &BuildInfoReferenceMapEntry{ FileId: t.toFileId(filePath), FileIdListId: t.toFileIdListId(references), - }) - } + } + }) } func (t *toBuildInfo) setChangeFileSet() { files := slices.Collect(maps.Keys(t.state.changedFilesSet.Keys())) slices.Sort(files) - for _, filePath := range files { - t.buildInfo.ChangeFileSet = append(t.buildInfo.ChangeFileSet, t.toFileId(filePath)) - } + t.buildInfo.ChangeFileSet = core.Map(files, t.toFileId) } func (t *toBuildInfo) setSemanticDiagnostics() { @@ -259,25 +265,17 @@ func (t *toBuildInfo) setSemanticDiagnostics() { value, ok := t.state.semanticDiagnosticsPerFile[file.Path()] if !ok { if !t.state.changedFilesSet.Has(file.Path()) { - t.buildInfo.SemanticDiagnosticsPerFile = append(t.buildInfo.SemanticDiagnosticsPerFile, BuildInfoSemanticDiagnostic{ + t.buildInfo.SemanticDiagnosticsPerFile = append(t.buildInfo.SemanticDiagnosticsPerFile, &BuildInfoSemanticDiagnostic{ FileId: t.toFileId(file.Path()), }) } - } else if len(value.buildInfoDiagnostics) > 0 { - diagnostics, _ := t.toDiagnosticCompatibleWithBuildInfo(value.buildInfoDiagnostics) - t.buildInfo.SemanticDiagnosticsPerFile = append(t.buildInfo.SemanticDiagnosticsPerFile, BuildInfoSemanticDiagnostic{ - Diagnostic: BuildInfoDiagnosticOfFile{ - fileId: t.toFileId(file.Path()), - diagnostics: diagnostics, - }, - }) - } else if len(value.diagnostics) > 0 { - t.buildInfo.SemanticDiagnosticsPerFile = append(t.buildInfo.SemanticDiagnosticsPerFile, BuildInfoSemanticDiagnostic{ - Diagnostic: BuildInfoDiagnosticOfFile{ - fileId: t.toFileId(file.Path()), - diagnostics: t.toIncrementalBuildInfoDiagnostic(value.diagnostics, file), - }, - }) + } else { + diagnostics := t.toBuildInfoDiagnosticsOfFile(file.Path(), value) + if diagnostics != nil { + t.buildInfo.SemanticDiagnosticsPerFile = append(t.buildInfo.SemanticDiagnosticsPerFile, &BuildInfoSemanticDiagnostic{ + Diagnostics: diagnostics, + }) + } } } } @@ -285,21 +283,9 @@ func (t *toBuildInfo) setSemanticDiagnostics() { func (t *toBuildInfo) setEmitDiagnostics() { files := slices.Collect(maps.Keys(t.state.emitDiagnosticsPerFile)) slices.Sort(files) - for _, filePath := range files { - value := t.state.emitDiagnosticsPerFile[filePath] - if len(value.buildInfoDiagnostics) > 0 { - diagnostics, _ := t.toDiagnosticCompatibleWithBuildInfo(value.buildInfoDiagnostics) - t.buildInfo.EmitDiagnosticsPerFile = append(t.buildInfo.EmitDiagnosticsPerFile, BuildInfoDiagnosticOfFile{ - fileId: t.toFileId(filePath), - diagnostics: diagnostics, - }) - } else { - t.buildInfo.EmitDiagnosticsPerFile = append(t.buildInfo.EmitDiagnosticsPerFile, BuildInfoDiagnosticOfFile{ - fileId: t.toFileId(filePath), - diagnostics: t.toIncrementalBuildInfoDiagnostic(value.diagnostics, t.program.GetSourceFileByPath(filePath)), - }) - } - } + t.buildInfo.EmitDiagnosticsPerFile = core.Map(files, func(filePath tspath.Path) *BuildInfoDiagnosticsOfFile { + return t.toBuildInfoDiagnosticsOfFile(filePath, t.state.emitDiagnosticsPerFile[filePath]) + }) } func (t *toBuildInfo) setAffectedFilesPendingEmit() { @@ -315,7 +301,7 @@ func (t *toBuildInfo) setAffectedFilesPendingEmit() { continue } pendingEmit := t.state.affectedFilesPendingEmit[filePath] - t.buildInfo.AffectedFilesPendingEmit = append(t.buildInfo.AffectedFilesPendingEmit, BuildInfoFilePendingEmit{ + t.buildInfo.AffectedFilesPendingEmit = append(t.buildInfo.AffectedFilesPendingEmit, &BuildInfoFilePendingEmit{ fileId: t.toFileId(filePath), emitKind: core.IfElse(pendingEmit == fullEmitKind, 0, pendingEmit), }) diff --git a/internal/incremental/toprogramstate.go b/internal/incremental/toprogramstate.go index bd9c312108..a019cada32 100644 --- a/internal/incremental/toprogramstate.go +++ b/internal/incremental/toprogramstate.go @@ -14,20 +14,19 @@ func buildInfoToProgramState(buildInfo *BuildInfo, buildInfoFileName string, con filePaths: make([]tspath.Path, 0, len(buildInfo.FileNames)), filePathSet: make([]*collections.Set[tspath.Path], 0, len(buildInfo.FileIdsList)), } - for _, fileName := range buildInfo.FileNames { - path := tspath.ToPath(fileName, to.buildInfoDirectory, config.UseCaseSensitiveFileNames()) - to.filePaths = append(to.filePaths, path) - } - for _, fileIdList := range buildInfo.FileIdsList { + to.filePaths = core.Map(buildInfo.FileNames, func(fileName string) tspath.Path { + return tspath.ToPath(fileName, to.buildInfoDirectory, config.UseCaseSensitiveFileNames()) + }) + to.filePathSet = core.Map(buildInfo.FileIdsList, func(fileIdList []BuildInfoFileId) *collections.Set[tspath.Path] { fileSet := collections.NewSetWithSizeHint[tspath.Path](len(fileIdList)) for _, fileId := range fileIdList { fileSet.Add(to.toFilePath(fileId)) } - to.filePathSet = append(to.filePathSet, fileSet) - } + return fileSet + }) to.setCompilerOptions() to.setFileInfoAndEmitSignatures() - to.setReferenceMap() + to.setReferencedMap() to.setChangeFileSet() to.setSemanticDiagnostics() to.setEmitDiagnostics() @@ -60,35 +59,33 @@ func (t *toProgramState) toFilePathSet(fileIdListId BuildInfoFileIdListId) *coll return t.filePathSet[fileIdListId-1] } -func (t *toProgramState) toDiagnosticCompatibleWithProgramState(diagnostics []*BuildInfoDiagnostic) ([]*BuildInfoDiagnostic, bool) { - var fixedDiagnostics []*BuildInfoDiagnostic - var changed bool - for _, d := range diagnostics { - file := d.file - if d.file != false && d.file != 0 { - file = t.toFilePath(BuildInfoFileId(d.file.(float64))) +func (t *toProgramState) toBuildInfoDiagnosticsWithFileName(diagnostics []*BuildInfoDiagnostic) []*buildInfoDiagnosticWithFileName { + return core.Map(diagnostics, func(d *BuildInfoDiagnostic) *buildInfoDiagnosticWithFileName { + var file tspath.Path + if d.File != 0 { + file = t.toFilePath(d.File) } - messageChain, changedMessageChain := t.toDiagnosticCompatibleWithProgramState(d.messageChain) - relatedInformation, changedRelatedInformation := t.toDiagnosticCompatibleWithProgramState(d.relatedInformation) - if file != d.file || changedMessageChain || changedRelatedInformation { - fixedDiagnostics = append(fixedDiagnostics, &BuildInfoDiagnostic{ - file: file, - loc: d.loc, - code: d.code, - category: d.category, - message: d.message, - messageChain: messageChain, - relatedInformation: relatedInformation, - reportsUnnecessary: d.reportsUnnecessary, - reportsDeprecated: d.reportsDeprecated, - skippedOnNoEmit: d.skippedOnNoEmit, - }) - changed = true - } else { - fixedDiagnostics = append(fixedDiagnostics, d) + return &buildInfoDiagnosticWithFileName{ + file: file, + noFile: d.NoFile, + pos: d.Pos, + end: d.End, + code: d.Code, + category: d.Category, + message: d.Message, + messageChain: t.toBuildInfoDiagnosticsWithFileName(d.MessageChain), + relatedInformation: t.toBuildInfoDiagnosticsWithFileName(d.RelatedInformation), + reportsUnnecessary: d.ReportsUnnecessary, + reportsDeprecated: d.ReportsDeprecated, + skippedOnNoEmit: d.SkippedOnNoEmit, } + }) +} + +func (t *toProgramState) toDiagnosticsOrBuildInfoDiagnosticsWithFileName(dig *BuildInfoDiagnosticsOfFile) *diagnosticsOrBuildInfoDiagnosticsWithFileName { + return &diagnosticsOrBuildInfoDiagnosticsWithFileName{ + buildInfoDiagnostics: t.toBuildInfoDiagnosticsWithFileName(dig.Diagnostics), } - return core.IfElse(changed, fixedDiagnostics, diagnostics), changed } func (t *toProgramState) setCompilerOptions() { @@ -126,7 +123,7 @@ func (t *toProgramState) setFileInfoAndEmitSignatures() { } } -func (t *toProgramState) setReferenceMap() { +func (t *toProgramState) setReferencedMap() { t.state.createReferenceMap() for _, entry := range t.buildInfo.ReferencedMap { t.state.referencedMap.Add(t.toFilePath(entry.FileId), t.toFilePathSet(entry.FileIdListId)) @@ -142,11 +139,11 @@ func (t *toProgramState) setChangeFileSet() { } func (t *toProgramState) setSemanticDiagnostics() { - t.state.semanticDiagnosticsPerFile = make(map[tspath.Path]*diagnosticsOrBuildInfoDiagnostics, len(t.state.fileInfos)) + t.state.semanticDiagnosticsPerFile = make(map[tspath.Path]*diagnosticsOrBuildInfoDiagnosticsWithFileName, len(t.state.fileInfos)) for path := range t.state.fileInfos { // Initialize to have no diagnostics if its not changed file if !t.state.changedFilesSet.Has(path) { - t.state.semanticDiagnosticsPerFile[path] = &diagnosticsOrBuildInfoDiagnostics{} + t.state.semanticDiagnosticsPerFile[path] = &diagnosticsOrBuildInfoDiagnosticsWithFileName{} } } for _, diagnostic := range t.buildInfo.SemanticDiagnosticsPerFile { @@ -154,23 +151,17 @@ func (t *toProgramState) setSemanticDiagnostics() { filePath := t.toFilePath(diagnostic.FileId) delete(t.state.semanticDiagnosticsPerFile, filePath) // does not have cached diagnostics } else { - filePath := t.toFilePath(diagnostic.Diagnostic.fileId) - diagnostics, _ := t.toDiagnosticCompatibleWithProgramState(diagnostic.Diagnostic.diagnostics) - t.state.semanticDiagnosticsPerFile[filePath] = &diagnosticsOrBuildInfoDiagnostics{ - buildInfoDiagnostics: diagnostics, - } + filePath := t.toFilePath(diagnostic.Diagnostics.FileId) + t.state.semanticDiagnosticsPerFile[filePath] = t.toDiagnosticsOrBuildInfoDiagnosticsWithFileName(diagnostic.Diagnostics) } } } func (t *toProgramState) setEmitDiagnostics() { - t.state.emitDiagnosticsPerFile = make(map[tspath.Path]*diagnosticsOrBuildInfoDiagnostics, len(t.state.fileInfos)) + t.state.emitDiagnosticsPerFile = make(map[tspath.Path]*diagnosticsOrBuildInfoDiagnosticsWithFileName, len(t.state.fileInfos)) for _, diagnostic := range t.buildInfo.EmitDiagnosticsPerFile { - filePath := t.toFilePath(diagnostic.fileId) - diagnostics, _ := t.toDiagnosticCompatibleWithProgramState(diagnostic.diagnostics) - t.state.emitDiagnosticsPerFile[filePath] = &diagnosticsOrBuildInfoDiagnostics{ - buildInfoDiagnostics: diagnostics, - } + filePath := t.toFilePath(diagnostic.FileId) + t.state.emitDiagnosticsPerFile[filePath] = t.toDiagnosticsOrBuildInfoDiagnosticsWithFileName(diagnostic) } } diff --git a/internal/testutil/incrementaltestutil/readablebuildinfo.go b/internal/testutil/incrementaltestutil/readablebuildinfo.go index d3ce47fb37..d8b07c8fdf 100644 --- a/internal/testutil/incrementaltestutil/readablebuildinfo.go +++ b/internal/testutil/incrementaltestutil/readablebuildinfo.go @@ -2,9 +2,11 @@ package incrementaltestutil import ( "encoding/json" + "fmt" "github.com/microsoft/typescript-go/internal/collections" "github.com/microsoft/typescript-go/internal/core" + "github.com/microsoft/typescript-go/internal/diagnostics" "github.com/microsoft/typescript-go/internal/incremental" ) @@ -15,20 +17,20 @@ type readableBuildInfo struct { // Common between incremental and tsc -b buildinfo for non incremental programs Errors bool `json:"errors,omitzero"` CheckPending bool `json:"checkPending,omitzero"` - // Root []BuildInfoRoot `json:"root,omitempty,omitzero"` + // Root []BuildInfoRoot `json:"root,omitzero"` // IncrementalProgram info FileNames []string `json:"fileNames,omitzero"` FileInfos []*readableBuildInfoFileInfo `json:"fileInfos,omitzero"` FileIdsList [][]string `json:"fileIdsList,omitzero"` - Options *collections.OrderedMap[string, any] `json:"options,omitempty"` - ReferencedMap []readableBuildInfoReferenceMapEntry `json:"referencedMap,omitzero"` - SemanticDiagnosticsPerFile []incremental.BuildInfoSemanticDiagnostic `json:"semanticDiagnosticsPerFile,omitzero"` - EmitDiagnosticsPerFile []incremental.BuildInfoDiagnosticOfFile `json:"emitDiagnosticsPerFile,omitzero"` - ChangeFileSet []incremental.BuildInfoFileId `json:"changeFileSet,omitzero"` - AffectedFilesPendingEmit []incremental.BuildInfoFilePendingEmit `json:"affectedFilesPendingEmit,omitzero"` + Options *collections.OrderedMap[string, any] `json:"options,omitzero"` + ReferencedMap *collections.OrderedMap[string, []string] `json:"referencedMap,omitzero"` + SemanticDiagnosticsPerFile []*readableBuildInfoSemanticDiagnostic `json:"semanticDiagnosticsPerFile,omitzero"` + EmitDiagnosticsPerFile []*readableBuildInfoDiagnosticsOfFile `json:"emitDiagnosticsPerFile,omitzero"` + ChangeFileSet []string `json:"changeFileSet,omitzero"` // List of changed files in the program, not the whole set of files + AffectedFilesPendingEmit []*incremental.BuildInfoFilePendingEmit `json:"affectedFilesPendingEmit,omitzero"` LatestChangedDtsFile string `json:"latestChangedDtsFile,omitzero"` // Because this is only output file in the program, we dont need fileId to deduplicate name - EmitSignatures []incremental.BuildInfoEmitSignature `json:"emitSignatures,omitzero"` + EmitSignatures []*incremental.BuildInfoEmitSignature `json:"emitSignatures,omitzero"` // resolvedRoot: readonly IncrementalBuildInfoResolvedRoot[] | undefined; Size int `json:"size,omitzero"` // Size of the build info file } @@ -39,84 +41,108 @@ type readableBuildInfoFileInfo struct { Signature string `json:"signature,omitzero"` AffectsGlobalScope bool `json:"affectsGlobalScope,omitzero"` ImpliedNodeFormat string `json:"impliedNodeFormat,omitzero"` - Original *incremental.BuildInfoFileInfo `json:"original,omitempty"` // Original file path, if available + Original *incremental.BuildInfoFileInfo `json:"original,omitzero"` // Original file path, if available } -type readableBuildInfoReferenceMapEntry struct { - file string - fileList []string +type readableBuildInfoDiagnostic struct { + // incrementalBuildInfoFileId if it is for a File thats other than its stored for + File string `json:"file,omitzero"` + NoFile bool `json:"noFile,omitzero"` + Pos int `json:"pos,omitzero"` + End int `json:"end,omitzero"` + Code int32 `json:"code,omitzero"` + Category diagnostics.Category `json:"category,omitzero"` + Message string `json:"message,omitzero"` + MessageChain []*readableBuildInfoDiagnostic `json:"messageChain,omitzero"` + RelatedInformation []*readableBuildInfoDiagnostic `json:"relatedInformation,omitzero"` + ReportsUnnecessary bool `json:"reportsUnnecessary,omitzero"` + ReportsDeprecated bool `json:"reportsDeprecated,omitzero"` + SkippedOnNoEmit bool `json:"skippedOnNoEmit,omitzero"` } -func (r *readableBuildInfoReferenceMapEntry) MarshalJSON() ([]byte, error) { - return json.Marshal([2]any{r.file, r.fileList}) +type readableBuildInfoDiagnosticsOfFile struct { + file string + diagnostics []*readableBuildInfoDiagnostic } -func (r *readableBuildInfoReferenceMapEntry) UnmarshalJSON(data []byte) error { - var v [2]any - if err := json.Unmarshal(data, &v); err != nil { - return err +func (r *readableBuildInfoDiagnosticsOfFile) MarshalJSON() ([]byte, error) { + fileIdAndDiagnostics := make([]any, 0, 2) + fileIdAndDiagnostics = append(fileIdAndDiagnostics, r.file) + fileIdAndDiagnostics = append(fileIdAndDiagnostics, r.diagnostics) + return json.Marshal(fileIdAndDiagnostics) +} + +func (r *readableBuildInfoDiagnosticsOfFile) UnmarshalJSON(data []byte) error { + var fileIdAndDiagnostics []any + if err := json.Unmarshal(data, &fileIdAndDiagnostics); err != nil { + return fmt.Errorf("invalid readableBuildInfoDiagnosticsOfFile: %s", data) + } + if len(fileIdAndDiagnostics) != 2 { + return fmt.Errorf("invalid readableBuildInfoDiagnosticsOfFile: expected 2 elements, got %d", len(fileIdAndDiagnostics)) + } + file, ok := fileIdAndDiagnostics[0].(string) + if !ok { + return fmt.Errorf("invalid fileId in readableBuildInfoDiagnosticsOfFile: expected string, got %T", fileIdAndDiagnostics[0]) + } + if diagnostics, ok := fileIdAndDiagnostics[1].([]*readableBuildInfoDiagnostic); ok { + *r = readableBuildInfoDiagnosticsOfFile{ + file: file, + diagnostics: diagnostics, + } + return nil + } + return fmt.Errorf("invalid diagnostics in readableBuildInfoDiagnosticsOfFile: expected []*readableBuildInfoDiagnostic, got %T", fileIdAndDiagnostics[1]) +} + +type readableBuildInfoSemanticDiagnostic struct { + file string // File is not in changedSet and still doesnt have cached diagnostics + diagnostics *readableBuildInfoDiagnosticsOfFile // Diagnostics for file +} + +func (r *readableBuildInfoSemanticDiagnostic) MarshalJSON() ([]byte, error) { + if r.file != "" { + return json.Marshal(r.file) } - *r = readableBuildInfoReferenceMapEntry{ - file: v[0].(string), - fileList: v[1].([]string), + return json.Marshal(r.diagnostics) +} + +func (r *readableBuildInfoSemanticDiagnostic) UnmarshalJSON(data []byte) error { + var file string + if err := json.Unmarshal(data, &file); err == nil { + *r = readableBuildInfoSemanticDiagnostic{ + file: file, + } + return nil } - return nil -} - -// type readableBuildInfoSemanticDiagnostic struct { -// file string // File is not in changedSet and still doesnt have cached diagnostics -// diagnostic incremental.BuildInfoDiagnosticOfFile // Diagnostics for file -// } - -// func (b *readableBuildInfoSemanticDiagnostic) MarshalJSON() ([]byte, error) { -// if b.file != 0 { -// return json.Marshal(b.file) -// } -// return json.Marshal(b.diagnostic) -// } - -// func (b *readableBuildInfoSemanticDiagnostic) UnmarshalJSON(data []byte) error { -// var fileId BuildInfoFileId -// if err := json.Unmarshal(data, &fileId); err == nil { -// *b = BuildInfoSemanticDiagnostic{ -// FileId: fileId, -// } -// return nil -// } -// var diagnostic BuildInfoDiagnosticOfFile -// if err := json.Unmarshal(data, &diagnostic); err == nil { -// *b = BuildInfoSemanticDiagnostic{ -// Diagnostic: diagnostic, -// } -// return nil -// } -// return fmt.Errorf("invalid IncrementalBuildInfoDiagnostic: %s", data) -// } + var diagnostics readableBuildInfoDiagnosticsOfFile + if err := json.Unmarshal(data, &diagnostics); err == nil { + *r = readableBuildInfoSemanticDiagnostic{ + diagnostics: &diagnostics, + } + return nil + } + return fmt.Errorf("invalid readableBuildInfoSemanticDiagnostic: %s", data) +} func toReadableBuildInfo(buildInfo *incremental.BuildInfo, buildInfoText string) string { readable := readableBuildInfo{ - buildInfo: buildInfo, - Version: buildInfo.Version, - - Errors: buildInfo.Errors, - CheckPending: buildInfo.CheckPending, - // Root: buildInfo.Root, - - FileNames: buildInfo.FileNames, - Options: buildInfo.Options, - // SemanticDiagnosticsPerFile []incremental.BuildInfoSemanticDiagnostic `json:"semanticDiagnosticsPerFile,omitzero"` - // EmitDiagnosticsPerFile []incremental.BuildInfoDiagnosticOfFile `json:"emitDiagnosticsPerFile,omitzero"` - // ChangeFileSet []incremental.BuildInfoFileId `json:"changeFileSet,omitzero"` - // AffectedFilesPendingEmit []incremental.BuildInfoFilePendingEmit `json:"affectedFilesPendingEmit,omitzero"` + buildInfo: buildInfo, + Version: buildInfo.Version, + Errors: buildInfo.Errors, + CheckPending: buildInfo.CheckPending, + FileNames: buildInfo.FileNames, + Options: buildInfo.Options, LatestChangedDtsFile: buildInfo.LatestChangedDtsFile, - // EmitSignatures []incremental.BuildInfoEmitSignature `json:"emitSignatures,omitzero"` - // resolvedRoot: readonly IncrementalBuildInfoResolvedRoot[] | undefined; - - Size: len(buildInfoText), + Size: len(buildInfoText), } readable.setFileInfos() readable.setFileIdsList() readable.setReferencedMap() + readable.setChangeFileSet() + readable.setSemanticDiagnostics() + readable.setEmitDiagnostics() + readable.setAffectedFilesPendingEmit() + readable.setEmitSignatures() contents, err := json.MarshalIndent(&readable, "", " ") if err != nil { panic("readableBuildInfo: failed to marshal readable build info: " + err.Error()) @@ -132,35 +158,109 @@ func (r *readableBuildInfo) toFilePathSet(fileIdListId incremental.BuildInfoFile return r.FileIdsList[fileIdListId-1] } +func (r *readableBuildInfo) toReadableBuildInfoDiagnostic(diagnostics []*incremental.BuildInfoDiagnostic) []*readableBuildInfoDiagnostic { + return core.Map(diagnostics, func(d *incremental.BuildInfoDiagnostic) *readableBuildInfoDiagnostic { + var file string + if d.File != 0 { + file = r.toFilePath(d.File) + } + return &readableBuildInfoDiagnostic{ + File: file, + NoFile: d.NoFile, + Pos: d.Pos, + End: d.End, + Code: d.Code, + Category: d.Category, + Message: d.Message, + MessageChain: r.toReadableBuildInfoDiagnostic(d.MessageChain), + RelatedInformation: r.toReadableBuildInfoDiagnostic(d.RelatedInformation), + ReportsUnnecessary: d.ReportsUnnecessary, + ReportsDeprecated: d.ReportsDeprecated, + SkippedOnNoEmit: d.SkippedOnNoEmit, + } + }) +} + +func (r *readableBuildInfo) toReadableBuildInfoDiagnosticsOfFile(diagnostics *incremental.BuildInfoDiagnosticsOfFile) *readableBuildInfoDiagnosticsOfFile { + return &readableBuildInfoDiagnosticsOfFile{ + file: r.toFilePath(diagnostics.FileId), + diagnostics: r.toReadableBuildInfoDiagnostic(diagnostics.Diagnostics), + } +} + +func (r *readableBuildInfo) toReadableBuildInfoSemanticDiagnostic(diagnostics *incremental.BuildInfoSemanticDiagnostic) *readableBuildInfoSemanticDiagnostic { + if diagnostics.FileId != 0 { + return &readableBuildInfoSemanticDiagnostic{ + file: r.toFilePath(diagnostics.FileId), + } + } + return &readableBuildInfoSemanticDiagnostic{ + diagnostics: r.toReadableBuildInfoDiagnosticsOfFile(diagnostics.Diagnostics), + } +} + func (r *readableBuildInfo) setFileInfos() { - for index, original := range r.buildInfo.FileInfos { + r.FileInfos = core.MapIndex(r.buildInfo.FileInfos, func(original *incremental.BuildInfoFileInfo, index int) *readableBuildInfoFileInfo { fileInfo := original.GetFileInfo() // Dont set original for string encoding if original.HasSignature() { original = nil } - r.FileInfos = append(r.FileInfos, &readableBuildInfoFileInfo{ + return &readableBuildInfoFileInfo{ FileName: r.toFilePath(incremental.BuildInfoFileId(index + 1)), Version: fileInfo.Version(), Signature: fileInfo.Signature(), AffectsGlobalScope: fileInfo.AffectsGlobalScope(), ImpliedNodeFormat: fileInfo.ImpliedNodeFormat().String(), Original: original, - }) - } + } + }) } func (r *readableBuildInfo) setFileIdsList() { - for _, ids := range r.buildInfo.FileIdsList { - r.FileIdsList = append(r.FileIdsList, core.Map(ids, r.toFilePath)) - } + r.FileIdsList = core.Map(r.buildInfo.FileIdsList, func(ids []incremental.BuildInfoFileId) []string { + return core.Map(ids, r.toFilePath) + }) } func (r *readableBuildInfo) setReferencedMap() { - for _, entry := range r.buildInfo.ReferencedMap { - r.ReferencedMap = append(r.ReferencedMap, readableBuildInfoReferenceMapEntry{ - file: r.toFilePath(entry.FileId), - fileList: r.toFilePathSet(entry.FileIdListId), - }) + if r.buildInfo.ReferencedMap != nil { + r.ReferencedMap = &collections.OrderedMap[string, []string]{} + for _, entry := range r.buildInfo.ReferencedMap { + r.ReferencedMap.Set(r.toFilePath(entry.FileId), r.toFilePathSet(entry.FileIdListId)) + } } } + +func (r *readableBuildInfo) setChangeFileSet() { + r.ChangeFileSet = core.Map(r.buildInfo.ChangeFileSet, r.toFilePath) +} + +func (r *readableBuildInfo) setSemanticDiagnostics() { + r.SemanticDiagnosticsPerFile = core.Map(r.buildInfo.SemanticDiagnosticsPerFile, r.toReadableBuildInfoSemanticDiagnostic) +} + +func (r *readableBuildInfo) setEmitDiagnostics() { + r.EmitDiagnosticsPerFile = core.Map(r.buildInfo.EmitDiagnosticsPerFile, r.toReadableBuildInfoDiagnosticsOfFile) +} + +func (r *readableBuildInfo) setAffectedFilesPendingEmit() { + // if len(r.buildInfo.AffectedFilesPendingEmit) == 0 { + // return + // } + // ownOptionsEmitKind := getFileEmitKind(r.state.options) + // r.state.affectedFilesPendingEmit = make(map[tspath.Path]fileEmitKind, len(r.buildInfo.AffectedFilesPendingEmit)) + // for _, pendingEmit := range r.buildInfo.AffectedFilesPendingEmit { + // r.state.affectedFilesPendingEmit[r.toFilePath(pendingEmit.fileId)] = core.IfElse(pendingEmit.emitKind == 0, ownOptionsEmitKind, pendingEmit.emitKind) + // } +} + +func (r *readableBuildInfo) setEmitSignatures() { + // r.EmitSignatures = make([]*incremental.BuildInfoEmitSignature, 0, len(r.buildInfo.EmitSignatures)) + // for _, value := range r.buildInfo.EmitSignatures { + // if value == nil { + // continue + // } + // r.EmitSignatures = append(r.EmitSignatures, value) + // } +} From 84d07c8e095404ed5acf83a3a30124eaae6635d0 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 26 Jun 2025 23:41:07 -0700 Subject: [PATCH 08/36] More changes --- internal/incremental/buildInfo.go | 134 ++++++++++-------- internal/incremental/programstate.go | 96 +++++++++---- internal/incremental/tobuildinfo.go | 18 +-- internal/incremental/toprogramstate.go | 20 +-- .../incrementaltestutil/readablebuildinfo.go | 110 ++++++++++---- 5 files changed, 239 insertions(+), 139 deletions(-) diff --git a/internal/incremental/buildInfo.go b/internal/incremental/buildInfo.go index e79807a289..8b3dfa86b3 100644 --- a/internal/incremental/buildInfo.go +++ b/internal/incremental/buildInfo.go @@ -7,6 +7,7 @@ import ( "github.com/microsoft/typescript-go/internal/collections" "github.com/microsoft/typescript-go/internal/core" "github.com/microsoft/typescript-go/internal/diagnostics" + "github.com/microsoft/typescript-go/internal/tsoptions" "github.com/microsoft/typescript-go/internal/tspath" ) @@ -23,18 +24,18 @@ type ( // * for non incremental program buildinfo // * - string that is the root file name // */ -// type buildInfoRoot struct { -// incrementalStartEnd *[2]incrementalBuildInfoFileId -// incrementalSingle incrementalBuildInfoFileId +// type BuildInfoRoot struct { +// StartEnd *[2]BuildInfoFileId +// Single BuildInfoFileId // nonIncremental string // } -// func (o buildInfoRoot) MarshalJSON() ([]byte, error) { -// if o.incrementalStartEnd != nil { -// return json.Marshal(o.incrementalStartEnd) +// func (o BuildInfoRoot) MarshalJSON() ([]byte, error) { +// if o.StartEnd != nil { +// return json.Marshal(o.StartEnd) // } -// if o.incrementalSingle != 0 { -// return json.Marshal(o.incrementalSingle) +// if o.Single != 0 { +// return json.Marshal(o.Single) // } // if o.nonIncremental != "" { // return json.Marshal(o.nonIncremental) @@ -42,16 +43,16 @@ type ( // panic("unknown BuildInfoRoot type") // } -// func (o *buildInfoRoot) UnmarshalJSON(data []byte) error { -// *o = buildInfoRoot{} -// var vIncrementalStartEnd [2]incrementalBuildInfoFileId -// if err := json.Unmarshal(data, &vIncrementalStartEnd); err == nil { -// o.incrementalStartEnd = &vIncrementalStartEnd +// func (o *BuildInfoRoot) UnmarshalJSON(data []byte) error { +// *o = BuildInfoRoot{} +// var vStartEnd [2]BuildInfoFileId +// if err := json.Unmarshal(data, &vStartEnd); err == nil { +// o.StartEnd = &vStartEnd // return nil // } -// var vIncrementalSingle incrementalBuildInfoFileId -// if err := json.Unmarshal(data, &vIncrementalSingle); err == nil { -// o.incrementalSingle = vIncrementalSingle +// var vSingle BuildInfoFileId +// if err := json.Unmarshal(data, &vSingle); err == nil { +// o.Single = vSingle // return nil // } // var vNonIncremental string @@ -158,7 +159,7 @@ func (b *BuildInfoFileInfo) UnmarshalJSON(data []byte) error { } var fileInfo buildInfoFileInfoWithSignature if err := json.Unmarshal(data, &fileInfo); err != nil { - return fmt.Errorf("invalid incrementalBuildInfoFileInfo: %s", data) + return fmt.Errorf("invalid BuildInfoFileInfo: %s", data) } *b = BuildInfoFileInfo{fileInfo: &fileInfo} return nil @@ -186,7 +187,7 @@ func (b *BuildInfoReferenceMapEntry) UnmarshalJSON(data []byte) error { } type BuildInfoDiagnostic struct { - // incrementalBuildInfoFileId if it is for a File thats other than its stored for + // BuildInfoFileId if it is for a File thats other than its stored for File BuildInfoFileId `json:"file,omitzero"` NoFile bool `json:"noFile,omitzero"` Pos int `json:"pos,omitzero"` @@ -273,19 +274,19 @@ func (b *BuildInfoSemanticDiagnostic) UnmarshalJSON(data []byte) error { * [fileId, emitKind] if any other type emit is pending */ type BuildInfoFilePendingEmit struct { - fileId BuildInfoFileId - emitKind fileEmitKind + FileId BuildInfoFileId + EmitKind FileEmitKind } func (b *BuildInfoFilePendingEmit) MarshalJSON() ([]byte, error) { - if b.emitKind == 0 { - return json.Marshal(b.fileId) + if b.EmitKind == 0 { + return json.Marshal(b.FileId) } - if b.emitKind == fileEmitKindDts { - fileListIds := []BuildInfoFileId{b.fileId} + if b.EmitKind == fileEmitKindDts { + fileListIds := []BuildInfoFileId{b.FileId} return json.Marshal(fileListIds) } - fileAndEmitKind := []int{int(b.fileId), int(b.emitKind)} + fileAndEmitKind := []int{int(b.FileId), int(b.EmitKind)} return json.Marshal(fileAndEmitKind) } @@ -293,7 +294,7 @@ func (b *BuildInfoFilePendingEmit) UnmarshalJSON(data []byte) error { var fileId BuildInfoFileId if err := json.Unmarshal(data, &fileId); err == nil { *b = BuildInfoFilePendingEmit{ - fileId: fileId, + FileId: fileId, } return nil } @@ -301,20 +302,20 @@ func (b *BuildInfoFilePendingEmit) UnmarshalJSON(data []byte) error { if err := json.Unmarshal(data, &intTuple); err == nil { if len(intTuple) == 1 { *b = BuildInfoFilePendingEmit{ - fileId: BuildInfoFileId(intTuple[0]), - emitKind: fileEmitKindDts, + FileId: BuildInfoFileId(intTuple[0]), + EmitKind: fileEmitKindDts, } return nil } else if len(intTuple) == 2 { *b = BuildInfoFilePendingEmit{ - fileId: BuildInfoFileId(intTuple[0]), - emitKind: fileEmitKind(intTuple[1]), + FileId: BuildInfoFileId(intTuple[0]), + EmitKind: FileEmitKind(intTuple[1]), } return nil } - return fmt.Errorf("invalid incrementalBuildInfoFilePendingEmit: expected 1 or 2 integers, got %d", len(intTuple)) + return fmt.Errorf("invalid BuildInfoFilePendingEmit: expected 1 or 2 integers, got %d", len(intTuple)) } - return fmt.Errorf("invalid IncrementalBuildInfoDiagnostic: %s", data) + return fmt.Errorf("invalid BuildInfoFilePendingEmit: %s", data) } /** @@ -322,28 +323,27 @@ func (b *BuildInfoFilePendingEmit) UnmarshalJSON(data []byte) error { * fileId if file wasnt emitted */ type BuildInfoEmitSignature struct { - fileId BuildInfoFileId - // Signature if it is different from file's signature - signature string - differsOnlyInDtsMap bool // true if signature is different only in dtsMap value - differsInOptions bool // true if signature is different in options used to emit file + FileId BuildInfoFileId + Signature string // Signature if it is different from file's Signature + DiffersOnlyInDtsMap bool // true if signature is different only in dtsMap value + DiffersInOptions bool // true if signature is different in options used to emit file } func (b *BuildInfoEmitSignature) noEmitSignature() bool { - return b.signature == "" && !b.differsOnlyInDtsMap && !b.differsInOptions + return b.Signature == "" && !b.DiffersOnlyInDtsMap && !b.DiffersInOptions } func (b *BuildInfoEmitSignature) toEmitSignature(path tspath.Path, emitSignatures map[tspath.Path]*emitSignature) *emitSignature { var signature string var signatureWithDifferentOptions []string - if b.differsOnlyInDtsMap { + if b.DiffersOnlyInDtsMap { signatureWithDifferentOptions = make([]string, 0, 1) signatureWithDifferentOptions = append(signatureWithDifferentOptions, emitSignatures[path].signature) - } else if b.differsInOptions { + } else if b.DiffersInOptions { signatureWithDifferentOptions = make([]string, 0, 1) - signatureWithDifferentOptions = append(signatureWithDifferentOptions, b.signature) + signatureWithDifferentOptions = append(signatureWithDifferentOptions, b.Signature) } else { - signature = b.signature + signature = b.Signature } return &emitSignature{ signature: signature, @@ -353,17 +353,17 @@ func (b *BuildInfoEmitSignature) toEmitSignature(path tspath.Path, emitSignature func (b *BuildInfoEmitSignature) MarshalJSON() ([]byte, error) { if b.noEmitSignature() { - return json.Marshal(b.fileId) + return json.Marshal(b.FileId) } fileIdAndSignature := make([]any, 2) - fileIdAndSignature[0] = b.fileId + fileIdAndSignature[0] = b.FileId var signature any - if b.differsOnlyInDtsMap { + if b.DiffersOnlyInDtsMap { signature = []string{} - } else if b.differsInOptions { - signature = []string{b.signature} + } else if b.DiffersInOptions { + signature = []string{b.Signature} } else { - signature = b.signature + signature = b.Signature } fileIdAndSignature[1] = signature return json.Marshal(fileIdAndSignature) @@ -373,7 +373,7 @@ func (b *BuildInfoEmitSignature) UnmarshalJSON(data []byte) error { var fileId BuildInfoFileId if err := json.Unmarshal(data, &fileId); err == nil { *b = BuildInfoEmitSignature{ - fileId: fileId, + FileId: fileId, } return nil } @@ -384,7 +384,7 @@ func (b *BuildInfoEmitSignature) UnmarshalJSON(data []byte) error { if id, ok := fileIdAndSignature[0].(float64); ok { fileId = BuildInfoFileId(id) } else { - return fmt.Errorf("invalid fileId in incrementalBuildInfoEmitSignature: expected float64, got %T", fileIdAndSignature[0]) + return fmt.Errorf("invalid fileId in BuildInfoEmitSignature: expected float64, got %T", fileIdAndSignature[0]) } var signature string var differsOnlyInDtsMap, differsInOptions bool @@ -396,25 +396,25 @@ func (b *BuildInfoEmitSignature) UnmarshalJSON(data []byte) error { signature = signatureList[0] differsInOptions = true } else { - return fmt.Errorf("invalid signature in incrementalBuildInfoEmitSignature: expected string or []string with 0 or 1 element, got %d elements", len(signatureList)) + return fmt.Errorf("invalid signature in BuildInfoEmitSignature: expected string or []string with 0 or 1 element, got %d elements", len(signatureList)) } } else { - return fmt.Errorf("invalid signature in incrementalBuildInfoEmitSignature: expected string or []string, got %T", fileIdAndSignature[1]) + return fmt.Errorf("invalid signature in BuildInfoEmitSignature: expected string or []string, got %T", fileIdAndSignature[1]) } } else { signature = signatureV } *b = BuildInfoEmitSignature{ - fileId: fileId, - signature: signature, - differsOnlyInDtsMap: differsOnlyInDtsMap, - differsInOptions: differsInOptions, + FileId: fileId, + Signature: signature, + DiffersOnlyInDtsMap: differsOnlyInDtsMap, + DiffersInOptions: differsInOptions, } return nil } - return fmt.Errorf("invalid incrementalBuildInfoEmitSignature: expected 2 elements, got %d", len(fileIdAndSignature)) + return fmt.Errorf("invalid BuildInfoEmitSignature: expected 2 elements, got %d", len(fileIdAndSignature)) } - return fmt.Errorf("invalid IncrementalBuildInfoDiagnostic: %s", data) + return fmt.Errorf("invalid BuildInfoEmitSignature: %s", data) } type BuildInfo struct { @@ -437,7 +437,7 @@ type BuildInfo struct { AffectedFilesPendingEmit []*BuildInfoFilePendingEmit `json:"affectedFilesPendingEmit,omitzero"` LatestChangedDtsFile string `json:"latestChangedDtsFile,omitzero"` // Because this is only output file in the program, we dont need fileId to deduplicate name EmitSignatures []*BuildInfoEmitSignature `json:"emitSignatures,omitzero"` - // resolvedRoot: readonly IncrementalBuildInfoResolvedRoot[] | undefined; + // resolvedRoot: readonly BuildInfoResolvedRoot[] | undefined; } func (b *BuildInfo) IsValidVersion() bool { @@ -447,3 +447,19 @@ func (b *BuildInfo) IsValidVersion() bool { func (b *BuildInfo) IsIncremental() bool { return b != nil && len(b.FileNames) != 0 } + +func (b *BuildInfo) GetCompilerOptions(buildInfoDirectory string) *core.CompilerOptions { + options := &core.CompilerOptions{} + for option, value := range b.Options.Entries() { + if buildInfoDirectory != "" { + result, ok := tsoptions.ConvertOptionToAbsolutePath(option, value, tsoptions.CommandLineCompilerOptionsMap, buildInfoDirectory) + if ok { + tsoptions.ParseCompilerOptions(option, result, options) + continue + } + } + tsoptions.ParseCompilerOptions(option, value, options) + + } + return options +} diff --git a/internal/incremental/programstate.go b/internal/incremental/programstate.go index 4ab3341507..7e357c3633 100644 --- a/internal/incremental/programstate.go +++ b/internal/incremental/programstate.go @@ -32,16 +32,16 @@ func (f *fileInfo) Signature() string { return f.signature func (f *fileInfo) AffectsGlobalScope() bool { return f.affectsGlobalScope } func (f *fileInfo) ImpliedNodeFormat() core.ResolutionMode { return f.impliedNodeFormat } -type fileEmitKind uint32 +type FileEmitKind uint32 const ( - fileEmitKindNone fileEmitKind = 0 - fileEmitKindJs fileEmitKind = 1 << 0 // emit js file - fileEmitKindJsMap fileEmitKind = 1 << 1 // emit js.map file - fileEmitKindJsInlineMap fileEmitKind = 1 << 2 // emit inline source map in js file - fileEmitKindDtsErrors fileEmitKind = 1 << 3 // emit dts errors - fileEmitKindDtsEmit fileEmitKind = 1 << 4 // emit d.ts file - fileEmitKindDtsMap fileEmitKind = 1 << 5 // emit d.ts.map file + fileEmitKindNone FileEmitKind = 0 + fileEmitKindJs FileEmitKind = 1 << 0 // emit js file + fileEmitKindJsMap FileEmitKind = 1 << 1 // emit js.map file + fileEmitKindJsInlineMap FileEmitKind = 1 << 2 // emit inline source map in js file + fileEmitKindDtsErrors FileEmitKind = 1 << 3 // emit dts errors + fileEmitKindDtsEmit FileEmitKind = 1 << 4 // emit d.ts file + fileEmitKindDtsMap FileEmitKind = 1 << 5 // emit d.ts.map file fileEmitKindDts = fileEmitKindDtsErrors | fileEmitKindDtsEmit fileEmitKindAllJs = fileEmitKindJs | fileEmitKindJsMap | fileEmitKindJsInlineMap @@ -50,7 +50,47 @@ const ( fileEmitKindAll = fileEmitKindAllJs | fileEmitKindAllDts ) -func getFileEmitKind(options *core.CompilerOptions) fileEmitKind { +func (fileEmitKind FileEmitKind) String() string { + var builder strings.Builder + addFlags := func(flags string) { + if builder.Len() == 0 { + builder.WriteString(flags) + } else { + builder.WriteString("|") + builder.WriteString(flags) + } + } + if fileEmitKind != 0 { + if (fileEmitKind & fileEmitKindJs) != 0 { + addFlags("Js") + } + if (fileEmitKind & fileEmitKindJsMap) != 0 { + addFlags("JsMap") + } + if (fileEmitKind & fileEmitKindJsInlineMap) != 0 { + addFlags("JsInlineMap") + } + if (fileEmitKind & fileEmitKindDts) == fileEmitKindDts { + addFlags("Dts") + } else { + if (fileEmitKind & fileEmitKindDtsEmit) != 0 { + addFlags("DtsEmit") + } + if (fileEmitKind & fileEmitKindDtsErrors) != 0 { + addFlags("DtsErrors") + } + } + if (fileEmitKind & fileEmitKindDtsMap) != 0 { + addFlags("DtsMap") + } + } + if builder.Len() != 0 { + return builder.String() + } + return "None" +} + +func GetFileEmitKind(options *core.CompilerOptions) FileEmitKind { result := fileEmitKindJs if options.SourceMap.IsTrue() { result |= fileEmitKindJsMap @@ -70,13 +110,13 @@ func getFileEmitKind(options *core.CompilerOptions) fileEmitKind { return result } -func getPendingEmitKindWithOptions(options *core.CompilerOptions, oldOptions *core.CompilerOptions) fileEmitKind { - oldEmitKind := getFileEmitKind(oldOptions) - newEmitKind := getFileEmitKind(options) +func getPendingEmitKindWithOptions(options *core.CompilerOptions, oldOptions *core.CompilerOptions) FileEmitKind { + oldEmitKind := GetFileEmitKind(oldOptions) + newEmitKind := GetFileEmitKind(options) return getPendingEmitKind(newEmitKind, oldEmitKind) } -func getPendingEmitKind(emitKind fileEmitKind, oldEmitKind fileEmitKind) fileEmitKind { +func getPendingEmitKind(emitKind FileEmitKind, oldEmitKind FileEmitKind) FileEmitKind { if oldEmitKind == emitKind { return fileEmitKindNone } @@ -104,7 +144,7 @@ func getPendingEmitKind(emitKind fileEmitKind, oldEmitKind fileEmitKind) fileEmi * Determining what all is pending to be emitted based on previous options or previous file emit flags * @internal */ -func getPendingEmitKindWithSeen(emitKind fileEmitKind, seenEmitKind fileEmitKind, options compiler.EmitOptions, isForDtsErrors bool) fileEmitKind { +func getPendingEmitKindWithSeen(emitKind FileEmitKind, seenEmitKind FileEmitKind, options compiler.EmitOptions, isForDtsErrors bool) FileEmitKind { pendingKind := getPendingEmitKind(emitKind, seenEmitKind) if options.EmitOnly == compiler.EmitOnlyDts { pendingKind &= fileEmitKindAllDts @@ -115,7 +155,7 @@ func getPendingEmitKindWithSeen(emitKind fileEmitKind, seenEmitKind fileEmitKind return pendingKind } -func getFileEmitKindAllDts(isForDtsErrors bool) fileEmitKind { +func getFileEmitKindAllDts(isForDtsErrors bool) FileEmitKind { return core.IfElse(isForDtsErrors, fileEmitKindDtsErrors, fileEmitKindAllDts) } @@ -232,7 +272,7 @@ type programState struct { /** * Files pending to be emitted */ - affectedFilesPendingEmit map[tspath.Path]fileEmitKind + affectedFilesPendingEmit map[tspath.Path]FileEmitKind /** * Name of the file whose dts was the latest to change */ @@ -300,7 +340,7 @@ type programState struct { /** * Already seen emitted files */ - seenEmittedFiles map[tspath.Path]fileEmitKind + seenEmittedFiles map[tspath.Path]FileEmitKind /** * Records if change in dts emit was detected */ @@ -328,11 +368,11 @@ func (p *programState) addFileToChangeSet(filePath tspath.Path) { p.buildInfoEmitPending = true } -func (p *programState) addFileToAffectedFilesPendingEmit(filePath tspath.Path, emitKind fileEmitKind) { +func (p *programState) addFileToAffectedFilesPendingEmit(filePath tspath.Path, emitKind FileEmitKind) { existingKind := p.affectedFilesPendingEmit[filePath] if p.affectedFilesPendingEmit == nil { - p.affectedFilesPendingEmit = make(map[tspath.Path]fileEmitKind) + p.affectedFilesPendingEmit = make(map[tspath.Path]FileEmitKind) } p.affectedFilesPendingEmit[filePath] = existingKind | emitKind delete(p.emitDiagnosticsPerFile, filePath) @@ -421,8 +461,8 @@ func (p *programState) getDeclarationDiagnostics(ctx context.Context, program *c */ func (p *programState) emitNextAffectedFile(ctx context.Context, program *compiler.Program, options compiler.EmitOptions, isForDtsErrors bool) (*compiler.EmitResult, bool) { affected := p.getNextAffectedFile(ctx, program) - programEmitKind := getFileEmitKind(p.options) - var emitKind fileEmitKind + programEmitKind := GetFileEmitKind(p.options) + var emitKind FileEmitKind if affected == nil { // file pending emit pendingAffectedFile, pendingEmitKind := p.getNextAffectedFilePendingEmit(program, options, isForDtsErrors) @@ -519,7 +559,7 @@ func (p *programState) emitNextAffectedFile(ctx context.Context, program *compil /** * Returns next file to be emitted from files that retrieved semantic diagnostics but did not emit yet */ -func (p *programState) getNextAffectedFilePendingEmit(program *compiler.Program, options compiler.EmitOptions, isForDtsErrors bool) (*ast.SourceFile, fileEmitKind) { +func (p *programState) getNextAffectedFilePendingEmit(program *compiler.Program, options compiler.EmitOptions, isForDtsErrors bool) (*ast.SourceFile, FileEmitKind) { if len(p.affectedFilesPendingEmit) == 0 { return nil, 0 } @@ -538,7 +578,7 @@ func (p *programState) getNextAffectedFilePendingEmit(program *compiler.Program, return nil, 0 } -func (p *programState) getNextPendingEmitDiagnosticsFile(program *compiler.Program, isForDtsErrors bool) (*ast.SourceFile, *diagnosticsOrBuildInfoDiagnosticsWithFileName, fileEmitKind) { +func (p *programState) getNextPendingEmitDiagnosticsFile(program *compiler.Program, isForDtsErrors bool) (*ast.SourceFile, *diagnosticsOrBuildInfoDiagnosticsWithFileName, FileEmitKind) { if len(p.emitDiagnosticsPerFile) == 0 { return nil, nil, 0 } @@ -814,7 +854,7 @@ func (p *programState) getNextAffectedFile(ctx context.Context, program *compile affectedFile := p.affectedFiles[p.affectedFilesIndex] if !p.seenAffectedFiles.Has(affectedFile.Path()) { // Set the next affected file as seen and remove the cached semantic diagnostics - p.addFileToAffectedFilesPendingEmit(affectedFile.Path(), getFileEmitKind(p.options)) + p.addFileToAffectedFilesPendingEmit(affectedFile.Path(), GetFileEmitKind(p.options)) p.handleDtsMayChangeOfAffectedFile(ctx, program, affectedFile) return affectedFile } @@ -1156,7 +1196,7 @@ func (p *programState) handleDtsMayChangeOf(ctx context.Context, program *compil p.updateShapeSignature(ctx, program, file, true) // If not dts emit, nothing more to do if invalidateJsFiles { - p.addFileToAffectedFilesPendingEmit(path, getFileEmitKind(p.options)) + p.addFileToAffectedFilesPendingEmit(path, GetFileEmitKind(p.options)) } else if p.options.GetEmitDeclarations() { p.addFileToAffectedFilesPendingEmit(path, core.IfElse(p.options.DeclarationMap.IsTrue(), fileEmitKindAllDts, fileEmitKindDts)) } @@ -1170,7 +1210,7 @@ func newProgramState(program *compiler.Program, oldProgram *Program) *programSta state := &programState{ options: program.Options(), semanticDiagnosticsPerFile: make(map[tspath.Path]*diagnosticsOrBuildInfoDiagnosticsWithFileName, len(files)), - seenEmittedFiles: make(map[tspath.Path]fileEmitKind, len(files)), + seenEmittedFiles: make(map[tspath.Path]FileEmitKind, len(files)), } state.createReferenceMap() if oldProgram != nil && state.options.Composite.IsTrue() { @@ -1301,9 +1341,9 @@ func newProgramState(program *compiler.Program, oldProgram *Program) *programSta if !allFilesExcludingDefaultLibraryFileAddedToChangeSet { // If options affect emit, then we need to do complete emit per compiler options // otherwise only the js or dts that needs to emitted because its different from previously emitted options - var pendingEmitKind fileEmitKind + var pendingEmitKind FileEmitKind if tsoptions.CompilerOptionsAffectEmit(oldProgram.state.options, state.options) { - pendingEmitKind = getFileEmitKind(state.options) + pendingEmitKind = GetFileEmitKind(state.options) } else { pendingEmitKind = getPendingEmitKindWithOptions(state.options, oldProgram.state.options) } diff --git a/internal/incremental/tobuildinfo.go b/internal/incremental/tobuildinfo.go index 8644c46c3d..f01b6a16c3 100644 --- a/internal/incremental/tobuildinfo.go +++ b/internal/incremental/tobuildinfo.go @@ -188,19 +188,19 @@ func (t *toBuildInfo) setFileInfoAndEmitSignatures() { emitSignature := t.state.emitSignatures[file.Path()] if emitSignature == nil { t.buildInfo.EmitSignatures = append(t.buildInfo.EmitSignatures, &BuildInfoEmitSignature{ - fileId: fileId, + FileId: fileId, }) } else if emitSignature.signature != actualSignature { incrementalEmitSignature := &BuildInfoEmitSignature{ - fileId: fileId, + FileId: fileId, } if emitSignature.signature != "" { - incrementalEmitSignature.signature = emitSignature.signature + incrementalEmitSignature.Signature = emitSignature.signature } else if emitSignature.signatureWithDifferentOptions[0] == actualSignature { - incrementalEmitSignature.differsOnlyInDtsMap = true + incrementalEmitSignature.DiffersOnlyInDtsMap = true } else { - incrementalEmitSignature.signature = emitSignature.signatureWithDifferentOptions[0] - incrementalEmitSignature.differsInOptions = true + incrementalEmitSignature.Signature = emitSignature.signatureWithDifferentOptions[0] + incrementalEmitSignature.DiffersInOptions = true } t.buildInfo.EmitSignatures = append(t.buildInfo.EmitSignatures, incrementalEmitSignature) } @@ -294,7 +294,7 @@ func (t *toBuildInfo) setAffectedFilesPendingEmit() { } files := slices.Collect(maps.Keys(t.state.affectedFilesPendingEmit)) slices.Sort(files) - fullEmitKind := getFileEmitKind(t.state.options) + fullEmitKind := GetFileEmitKind(t.state.options) for _, filePath := range files { file := t.program.GetSourceFileByPath(filePath) if file == nil || !t.program.SourceFileMayBeEmitted(file, false) { @@ -302,8 +302,8 @@ func (t *toBuildInfo) setAffectedFilesPendingEmit() { } pendingEmit := t.state.affectedFilesPendingEmit[filePath] t.buildInfo.AffectedFilesPendingEmit = append(t.buildInfo.AffectedFilesPendingEmit, &BuildInfoFilePendingEmit{ - fileId: t.toFileId(filePath), - emitKind: core.IfElse(pendingEmit == fullEmitKind, 0, pendingEmit), + FileId: t.toFileId(filePath), + EmitKind: core.IfElse(pendingEmit == fullEmitKind, 0, pendingEmit), }) } } diff --git a/internal/incremental/toprogramstate.go b/internal/incremental/toprogramstate.go index a019cada32..791b07f09f 100644 --- a/internal/incremental/toprogramstate.go +++ b/internal/incremental/toprogramstate.go @@ -89,15 +89,7 @@ func (t *toProgramState) toDiagnosticsOrBuildInfoDiagnosticsWithFileName(dig *Bu } func (t *toProgramState) setCompilerOptions() { - t.state.options = &core.CompilerOptions{} - for option, value := range t.buildInfo.Options.Entries() { - result, ok := tsoptions.ConvertOptionToAbsolutePath(option, value, tsoptions.CommandLineCompilerOptionsMap, t.buildInfoDirectory) - if ok { - tsoptions.ParseCompilerOptions(option, result, t.state.options) - } else { - tsoptions.ParseCompilerOptions(option, value, t.state.options) - } - } + t.state.options = t.buildInfo.GetCompilerOptions(t.buildInfoDirectory) } func (t *toProgramState) setFileInfoAndEmitSignatures() { @@ -115,9 +107,9 @@ func (t *toProgramState) setFileInfoAndEmitSignatures() { // Fix up emit signatures for _, value := range t.buildInfo.EmitSignatures { if value.noEmitSignature() { - delete(t.state.emitSignatures, t.toFilePath(value.fileId)) + delete(t.state.emitSignatures, t.toFilePath(value.FileId)) } else { - path := t.toFilePath(value.fileId) + path := t.toFilePath(value.FileId) t.state.emitSignatures[path] = value.toEmitSignature(path, t.state.emitSignatures) } } @@ -169,9 +161,9 @@ func (t *toProgramState) setAffectedFilesPendingEmit() { if len(t.buildInfo.AffectedFilesPendingEmit) == 0 { return } - ownOptionsEmitKind := getFileEmitKind(t.state.options) - t.state.affectedFilesPendingEmit = make(map[tspath.Path]fileEmitKind, len(t.buildInfo.AffectedFilesPendingEmit)) + ownOptionsEmitKind := GetFileEmitKind(t.state.options) + t.state.affectedFilesPendingEmit = make(map[tspath.Path]FileEmitKind, len(t.buildInfo.AffectedFilesPendingEmit)) for _, pendingEmit := range t.buildInfo.AffectedFilesPendingEmit { - t.state.affectedFilesPendingEmit[t.toFilePath(pendingEmit.fileId)] = core.IfElse(pendingEmit.emitKind == 0, ownOptionsEmitKind, pendingEmit.emitKind) + t.state.affectedFilesPendingEmit[t.toFilePath(pendingEmit.FileId)] = core.IfElse(pendingEmit.EmitKind == 0, ownOptionsEmitKind, pendingEmit.EmitKind) } } diff --git a/internal/testutil/incrementaltestutil/readablebuildinfo.go b/internal/testutil/incrementaltestutil/readablebuildinfo.go index d8b07c8fdf..34a678d63e 100644 --- a/internal/testutil/incrementaltestutil/readablebuildinfo.go +++ b/internal/testutil/incrementaltestutil/readablebuildinfo.go @@ -28,9 +28,9 @@ type readableBuildInfo struct { SemanticDiagnosticsPerFile []*readableBuildInfoSemanticDiagnostic `json:"semanticDiagnosticsPerFile,omitzero"` EmitDiagnosticsPerFile []*readableBuildInfoDiagnosticsOfFile `json:"emitDiagnosticsPerFile,omitzero"` ChangeFileSet []string `json:"changeFileSet,omitzero"` // List of changed files in the program, not the whole set of files - AffectedFilesPendingEmit []*incremental.BuildInfoFilePendingEmit `json:"affectedFilesPendingEmit,omitzero"` + AffectedFilesPendingEmit []*readableBuildInfoFilePendingEmit `json:"affectedFilesPendingEmit,omitzero"` LatestChangedDtsFile string `json:"latestChangedDtsFile,omitzero"` // Because this is only output file in the program, we dont need fileId to deduplicate name - EmitSignatures []*incremental.BuildInfoEmitSignature `json:"emitSignatures,omitzero"` + EmitSignatures []*readableBuildInfoEmitSignature `json:"emitSignatures,omitzero"` // resolvedRoot: readonly IncrementalBuildInfoResolvedRoot[] | undefined; Size int `json:"size,omitzero"` // Size of the build info file } @@ -124,6 +124,54 @@ func (r *readableBuildInfoSemanticDiagnostic) UnmarshalJSON(data []byte) error { return fmt.Errorf("invalid readableBuildInfoSemanticDiagnostic: %s", data) } +type readableBuildInfoFilePendingEmit struct { + file string + emitKind string + original *incremental.BuildInfoFilePendingEmit +} + +func (b *readableBuildInfoFilePendingEmit) MarshalJSON() ([]byte, error) { + return json.Marshal([]any{b.file, b.emitKind, b.original}) +} + +func (b *readableBuildInfoFilePendingEmit) UnmarshalJSON(data []byte) error { + var fileIdAndEmitKind []any + if err := json.Unmarshal(data, &fileIdAndEmitKind); err != nil { + return fmt.Errorf("invalid readableBuildInfoFilePendingEmit: %s", data) + } + if len(fileIdAndEmitKind) != 3 { + return fmt.Errorf("invalid readableBuildInfoFilePendingEmit: expected 3 elements, got %d", len(fileIdAndEmitKind)) + } + file, ok := fileIdAndEmitKind[0].(string) + if !ok { + return fmt.Errorf("invalid fileId in readableBuildInfoFilePendingEmit: expected string, got %T", fileIdAndEmitKind[0]) + } + var emitKind string + emitKind, ok = fileIdAndEmitKind[1].(string) + if !ok { + return fmt.Errorf("invalid emitKind in readableBuildInfoFilePendingEmit: expected string, got %T", fileIdAndEmitKind[1]) + } + var original *incremental.BuildInfoFilePendingEmit + original, ok = fileIdAndEmitKind[2].(*incremental.BuildInfoFilePendingEmit) + if !ok { + return fmt.Errorf("invalid original in readableBuildInfoFilePendingEmit: expected *incremental.BuildInfoFilePendingEmit, got %T", fileIdAndEmitKind[2]) + } + *b = readableBuildInfoFilePendingEmit{ + file: file, + emitKind: emitKind, + original: original, + } + return nil +} + +type readableBuildInfoEmitSignature struct { + File string `json:"file,omitzero"` + Signature string `json:"signature,omitzero"` + DiffersOnlyInDtsMap bool `json:"differsOnlyInDtsMap,omitzero"` + DiffersInOptions bool `json:"differsInOptions,omitzero"` + Original *incremental.BuildInfoEmitSignature `json:"original,omitzero"` +} + func toReadableBuildInfo(buildInfo *incremental.BuildInfo, buildInfoText string) string { readable := readableBuildInfo{ buildInfo: buildInfo, @@ -188,17 +236,6 @@ func (r *readableBuildInfo) toReadableBuildInfoDiagnosticsOfFile(diagnostics *in } } -func (r *readableBuildInfo) toReadableBuildInfoSemanticDiagnostic(diagnostics *incremental.BuildInfoSemanticDiagnostic) *readableBuildInfoSemanticDiagnostic { - if diagnostics.FileId != 0 { - return &readableBuildInfoSemanticDiagnostic{ - file: r.toFilePath(diagnostics.FileId), - } - } - return &readableBuildInfoSemanticDiagnostic{ - diagnostics: r.toReadableBuildInfoDiagnosticsOfFile(diagnostics.Diagnostics), - } -} - func (r *readableBuildInfo) setFileInfos() { r.FileInfos = core.MapIndex(r.buildInfo.FileInfos, func(original *incremental.BuildInfoFileInfo, index int) *readableBuildInfoFileInfo { fileInfo := original.GetFileInfo() @@ -237,7 +274,16 @@ func (r *readableBuildInfo) setChangeFileSet() { } func (r *readableBuildInfo) setSemanticDiagnostics() { - r.SemanticDiagnosticsPerFile = core.Map(r.buildInfo.SemanticDiagnosticsPerFile, r.toReadableBuildInfoSemanticDiagnostic) + r.SemanticDiagnosticsPerFile = core.Map(r.buildInfo.SemanticDiagnosticsPerFile, func(diagnostics *incremental.BuildInfoSemanticDiagnostic) *readableBuildInfoSemanticDiagnostic { + if diagnostics.FileId != 0 { + return &readableBuildInfoSemanticDiagnostic{ + file: r.toFilePath(diagnostics.FileId), + } + } + return &readableBuildInfoSemanticDiagnostic{ + diagnostics: r.toReadableBuildInfoDiagnosticsOfFile(diagnostics.Diagnostics), + } + }) } func (r *readableBuildInfo) setEmitDiagnostics() { @@ -245,22 +291,28 @@ func (r *readableBuildInfo) setEmitDiagnostics() { } func (r *readableBuildInfo) setAffectedFilesPendingEmit() { - // if len(r.buildInfo.AffectedFilesPendingEmit) == 0 { - // return - // } - // ownOptionsEmitKind := getFileEmitKind(r.state.options) - // r.state.affectedFilesPendingEmit = make(map[tspath.Path]fileEmitKind, len(r.buildInfo.AffectedFilesPendingEmit)) - // for _, pendingEmit := range r.buildInfo.AffectedFilesPendingEmit { - // r.state.affectedFilesPendingEmit[r.toFilePath(pendingEmit.fileId)] = core.IfElse(pendingEmit.emitKind == 0, ownOptionsEmitKind, pendingEmit.emitKind) - // } + if r.buildInfo.AffectedFilesPendingEmit == nil { + return + } + fullEmitKind := incremental.GetFileEmitKind(r.buildInfo.GetCompilerOptions("")) + r.AffectedFilesPendingEmit = core.Map(r.buildInfo.AffectedFilesPendingEmit, func(pendingEmit *incremental.BuildInfoFilePendingEmit) *readableBuildInfoFilePendingEmit { + emitKind := core.IfElse(pendingEmit.EmitKind == 0, fullEmitKind, pendingEmit.EmitKind) + return &readableBuildInfoFilePendingEmit{ + file: r.toFilePath(pendingEmit.FileId), + emitKind: emitKind.String(), + original: pendingEmit, + } + }) } func (r *readableBuildInfo) setEmitSignatures() { - // r.EmitSignatures = make([]*incremental.BuildInfoEmitSignature, 0, len(r.buildInfo.EmitSignatures)) - // for _, value := range r.buildInfo.EmitSignatures { - // if value == nil { - // continue - // } - // r.EmitSignatures = append(r.EmitSignatures, value) - // } + r.EmitSignatures = core.Map(r.buildInfo.EmitSignatures, func(signature *incremental.BuildInfoEmitSignature) *readableBuildInfoEmitSignature { + return &readableBuildInfoEmitSignature{ + File: r.toFilePath(signature.FileId), + Signature: signature.Signature, + DiffersOnlyInDtsMap: signature.DiffersOnlyInDtsMap, + DiffersInOptions: signature.DiffersInOptions, + Original: signature, + } + }) } From fae0baf8e995d90172389f778aed37cac0779105 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Fri, 27 Jun 2025 00:07:12 -0700 Subject: [PATCH 09/36] fix test --- internal/tsoptions/parsinghelpers.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/tsoptions/parsinghelpers.go b/internal/tsoptions/parsinghelpers.go index bb745a755d..ff6095736c 100644 --- a/internal/tsoptions/parsinghelpers.go +++ b/internal/tsoptions/parsinghelpers.go @@ -169,10 +169,10 @@ func ParseCompilerOptions(key string, value any, allOptions *core.CompilerOption func parseCompilerOptions(key string, value any, allOptions *core.CompilerOptions) (foundKey bool) { option := CommandLineCompilerOptionsMap.Get(key) - if option == nil { - return false + if option != nil { + key = option.Name } - switch option.Name { + switch key { case "allowJs": allOptions.AllowJs = parseTristate(value) case "allowImportingTsExtensions": From b52d0940f034ab0474601de1ffe6c2303e2709e3 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Fri, 27 Jun 2025 10:05:35 -0700 Subject: [PATCH 10/36] more change --- internal/incremental/program.go | 45 +++++++------------ .../incrementaltestutil/readablebuildinfo.go | 2 +- 2 files changed, 17 insertions(+), 30 deletions(-) diff --git a/internal/incremental/program.go b/internal/incremental/program.go index 0b160e2ba7..7e40fc5b43 100644 --- a/internal/incremental/program.go +++ b/internal/incremental/program.go @@ -2,6 +2,7 @@ package incremental import ( "context" + "fmt" "github.com/microsoft/typescript-go/internal/ast" "github.com/microsoft/typescript-go/internal/compiler" @@ -22,10 +23,14 @@ func NewProgram(program *compiler.Program, oldProgram *Program) *Program { } } -func (p *Program) GetProgram() *compiler.Program { +func (p *Program) panicIfNoProgram(method string) { if p.program == nil { - panic("GetProgram should not be called without program") + panic(fmt.Sprintf("%s should not be called without program", method)) } +} + +func (p *Program) GetProgram() *compiler.Program { + p.panicIfNoProgram("GetProgram") return p.program } @@ -34,37 +39,27 @@ func (p *Program) Options() *core.CompilerOptions { } func (p *Program) GetSourceFiles() []*ast.SourceFile { - if p.program == nil { - panic("GetSourceFiles should not be called without program") - } + p.panicIfNoProgram("GetSourceFiles") return p.program.GetSourceFiles() } func (p *Program) GetConfigFileParsingDiagnostics() []*ast.Diagnostic { - if p.program == nil { - panic("GetConfigFileParsingDiagnostics should not be called without program") - } + p.panicIfNoProgram("GetConfigFileParsingDiagnostics") return p.program.GetConfigFileParsingDiagnostics() } func (p *Program) GetSyntacticDiagnostics(ctx context.Context, file *ast.SourceFile) []*ast.Diagnostic { - if p.program == nil { - panic("GetSyntacticDiagnostics should not be called without program") - } + p.panicIfNoProgram("GetSyntacticDiagnostics") return p.program.GetSyntacticDiagnostics(ctx, file) } func (p *Program) GetBindDiagnostics(ctx context.Context, file *ast.SourceFile) []*ast.Diagnostic { - if p.program == nil { - panic("GetBindDiagnostics should not be called without program") - } + p.panicIfNoProgram("GetBindDiagnostics") return p.program.GetBindDiagnostics(ctx, file) } func (p *Program) GetOptionsDiagnostics(ctx context.Context) []*ast.Diagnostic { - if p.program == nil { - panic("GetOptionsDiagnostics should not be called without program") - } + p.panicIfNoProgram("GetOptionsDiagnostics") return p.program.GetOptionsDiagnostics(ctx) } @@ -76,29 +71,21 @@ func (p *Program) GetProgramDiagnostics() []*ast.Diagnostic { } func (p *Program) GetGlobalDiagnostics(ctx context.Context) []*ast.Diagnostic { - if p.program == nil { - panic("GetGlobalDiagnostics should not be called without program") - } + p.panicIfNoProgram("GetGlobalDiagnostics") return p.program.GetGlobalDiagnostics(ctx) } func (p *Program) GetSemanticDiagnostics(ctx context.Context, file *ast.SourceFile) []*ast.Diagnostic { - if p.program == nil { - panic("GetSemanticDiagnostics should not be called without program") - } + p.panicIfNoProgram("GetSemanticDiagnostics") return p.state.getSemanticDiagnostics(ctx, p.program, file) } func (p *Program) GetDeclarationDiagnostics(ctx context.Context, file *ast.SourceFile) []*ast.Diagnostic { - if p.program == nil { - panic("GetDeclarationDiagnostics should not be called without program") - } + p.panicIfNoProgram("GetDeclarationDiagnostics") return p.state.getDeclarationDiagnostics(ctx, p.program, file) } func (p *Program) Emit(ctx context.Context, options compiler.EmitOptions) *compiler.EmitResult { - if p.program == nil { - panic("Emit should not be called without program") - } + p.panicIfNoProgram("Emit") return p.state.emit(ctx, p.program, options) } diff --git a/internal/testutil/incrementaltestutil/readablebuildinfo.go b/internal/testutil/incrementaltestutil/readablebuildinfo.go index 34a678d63e..cd6b062abd 100644 --- a/internal/testutil/incrementaltestutil/readablebuildinfo.go +++ b/internal/testutil/incrementaltestutil/readablebuildinfo.go @@ -191,7 +191,7 @@ func toReadableBuildInfo(buildInfo *incremental.BuildInfo, buildInfoText string) readable.setEmitDiagnostics() readable.setAffectedFilesPendingEmit() readable.setEmitSignatures() - contents, err := json.MarshalIndent(&readable, "", " ") + contents, err := json.MarshalIndent(&readable, "", " ") if err != nil { panic("readableBuildInfo: failed to marshal readable build info: " + err.Error()) } From f3b2563e5d8a46c60bb8fb05ab04fdc4f15165ab Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 3 Jul 2025 14:49:13 -0700 Subject: [PATCH 11/36] Parallel!!! --- internal/checker/checker.go | 13 + internal/checker/checker_test.go | 2 +- internal/collections/syncset.go | 6 + internal/compiler/checkerpool.go | 2 +- internal/compiler/emitter.go | 28 +- internal/compiler/program.go | 56 +- internal/execute/tsc.go | 4 +- internal/incremental/affectedfileshandler.go | 440 +++++ internal/incremental/buildInfo.go | 22 +- internal/incremental/emitfileshandler.go | 274 +++ internal/incremental/incremental.go | 2 +- internal/incremental/program.go | 288 +++- internal/incremental/programstate.go | 1520 ----------------- internal/incremental/snapshot.go | 566 ++++++ internal/incremental/tobuildinfo.go | 69 +- .../{toprogramstate.go => tosnapshot.go} | 86 +- 16 files changed, 1679 insertions(+), 1699 deletions(-) create mode 100644 internal/incremental/affectedfileshandler.go create mode 100644 internal/incremental/emitfileshandler.go delete mode 100644 internal/incremental/programstate.go create mode 100644 internal/incremental/snapshot.go rename internal/incremental/{toprogramstate.go => tosnapshot.go} (52%) diff --git a/internal/checker/checker.go b/internal/checker/checker.go index e0043030e1..879d92b048 100644 --- a/internal/checker/checker.go +++ b/internal/checker/checker.go @@ -856,6 +856,8 @@ type Checker struct { skipDirectInferenceNodes collections.Set[*ast.Node] ctx context.Context packagesMap map[string]bool + ambientModulesOnce sync.Once + ambientModules []*ast.Symbol } func NewChecker(program Program) *Checker { @@ -14842,6 +14844,17 @@ func (c *Checker) tryFindAmbientModule(moduleName string, withAugmentations bool return symbol } +func (c *Checker) GetAmbientModules() []*ast.Symbol { + c.ambientModulesOnce.Do(func() { + for sym, global := range c.globals { + if strings.HasPrefix(sym, "\"") && strings.HasSuffix(sym, "\"") { + c.ambientModules = append(c.ambientModules, global) + } + } + }) + return c.ambientModules +} + func (c *Checker) resolveExternalModuleSymbol(moduleSymbol *ast.Symbol, dontResolveAlias bool) *ast.Symbol { if moduleSymbol != nil { exportEquals := c.resolveSymbolEx(moduleSymbol.Exports[ast.InternalSymbolNameExportEquals], dontResolveAlias) diff --git a/internal/checker/checker_test.go b/internal/checker/checker_test.go index 161be261eb..4b7457bd46 100644 --- a/internal/checker/checker_test.go +++ b/internal/checker/checker_test.go @@ -77,7 +77,7 @@ func TestCheckSrcCompiler(t *testing.T) { Config: parsed, Host: host, }) - p.CheckSourceFiles(t.Context()) + p.CheckSourceFiles(t.Context(), nil) } func BenchmarkNewChecker(b *testing.B) { diff --git a/internal/collections/syncset.go b/internal/collections/syncset.go index 14124add03..8f4f59dcb6 100644 --- a/internal/collections/syncset.go +++ b/internal/collections/syncset.go @@ -16,3 +16,9 @@ func (s *SyncSet[T]) Add(key T) { func (s *SyncSet[T]) Delete(key T) { s.m.Delete(key) } + +func (s *SyncSet[T]) Range(fn func(key T) bool) { + s.m.Range(func(key T, value struct{}) bool { + return fn(key) + }) +} diff --git a/internal/compiler/checkerpool.go b/internal/compiler/checkerpool.go index 17949cd568..9b32992f20 100644 --- a/internal/compiler/checkerpool.go +++ b/internal/compiler/checkerpool.go @@ -53,7 +53,7 @@ func (p *checkerPool) GetChecker(ctx context.Context) (*checker.Checker, func()) func (p *checkerPool) createCheckers() { p.createCheckersOnce.Do(func() { - wg := core.NewWorkGroup(p.program.singleThreaded()) + wg := core.NewWorkGroup(p.program.SingleThreaded()) for i := range p.checkerCount { wg.Queue(func() { p.checkers[i] = checker.NewChecker(p.program) diff --git a/internal/compiler/emitter.go b/internal/compiler/emitter.go index 285f4a65ba..0746075049 100644 --- a/internal/compiler/emitter.go +++ b/internal/compiler/emitter.go @@ -484,15 +484,8 @@ type AnyProgram interface { Emit(ctx context.Context, options EmitOptions) *EmitResult } -func HandleNoEmitOptions(ctx context.Context, program AnyProgram, file *ast.SourceFile) *EmitResult { - options := program.Options() - if options.NoEmit.IsTrue() { - return &EmitResult{ - EmitSkipped: true, - } - } - - if !options.NoEmitOnError.IsTrue() { +func HandleNoEmitOnError(ctx context.Context, program AnyProgram, file *ast.SourceFile) *EmitResult { + if !program.Options().NoEmitOnError.IsTrue() { return nil // No emit on error is not set, so we can proceed with emitting } @@ -549,16 +542,19 @@ func GetDiagnosticsOfAnyProgram( func CombineEmitResults(results []*EmitResult) *EmitResult { result := &EmitResult{} - for _, emitter := range results { - if emitter.EmitSkipped { + for _, emitResult := range results { + if emitResult == nil { + continue // Skip nil results + } + if emitResult.EmitSkipped { result.EmitSkipped = true } - result.Diagnostics = append(result.Diagnostics, emitter.Diagnostics...) - if emitter.EmittedFiles != nil { - result.EmittedFiles = append(result.EmittedFiles, emitter.EmittedFiles...) + result.Diagnostics = append(result.Diagnostics, emitResult.Diagnostics...) + if emitResult.EmittedFiles != nil { + result.EmittedFiles = append(result.EmittedFiles, emitResult.EmittedFiles...) } - if emitter.SourceMaps != nil { - result.SourceMaps = append(result.SourceMaps, emitter.SourceMaps...) + if emitResult.SourceMaps != nil { + result.SourceMaps = append(result.SourceMaps, emitResult.SourceMaps...) } } return result diff --git a/internal/compiler/program.go b/internal/compiler/program.go index 0f673dfc5e..dcf2fcf7d6 100644 --- a/internal/compiler/program.go +++ b/internal/compiler/program.go @@ -39,7 +39,6 @@ func (p *ProgramOptions) canUseProjectReferenceSource() bool { type Program struct { opts ProgramOptions - nodeModules map[string]*ast.SourceFile checkerPool CheckerPool comparePathsOptions tspath.ComparePathsOptions @@ -178,7 +177,7 @@ func (p *Program) GetSourceFileFromReference(origin *ast.SourceFile, ref *ast.Fi func NewProgram(opts ProgramOptions) *Program { p := &Program{opts: opts} p.initCheckerPool() - p.processedFiles = processAllProgramFiles(p.opts, p.singleThreaded()) + p.processedFiles = processAllProgramFiles(p.opts, p.SingleThreaded()) return p } @@ -192,7 +191,6 @@ func (p *Program) UpdateProgram(changedFilePath tspath.Path) (*Program, bool) { } result := &Program{ opts: p.opts, - nodeModules: p.nodeModules, comparePathsOptions: p.comparePathsOptions, processedFiles: p.processedFiles, usesUriStyleNodeCoreModules: p.usesUriStyleNodeCoreModules, @@ -210,7 +208,7 @@ func (p *Program) initCheckerPool() { if p.opts.CreateCheckerPool != nil { p.checkerPool = p.opts.CreateCheckerPool(p) } else { - p.checkerPool = newCheckerPool(core.IfElse(p.singleThreaded(), 1, 4), p) + p.checkerPool = newCheckerPool(core.IfElse(p.SingleThreaded(), 1, 4), p) } } @@ -250,12 +248,12 @@ func (p *Program) GetConfigFileParsingDiagnostics() []*ast.Diagnostic { return slices.Clip(p.opts.Config.GetConfigFileParsingDiagnostics()) } -func (p *Program) singleThreaded() bool { +func (p *Program) SingleThreaded() bool { return p.opts.SingleThreaded.DefaultIfUnknown(p.Options().SingleThreaded).IsTrue() } func (p *Program) BindSourceFiles() { - wg := core.NewWorkGroup(p.singleThreaded()) + wg := core.NewWorkGroup(p.SingleThreaded()) for _, file := range p.files { if !file.IsBound() { wg.Queue(func() { @@ -266,14 +264,16 @@ func (p *Program) BindSourceFiles() { wg.RunAndWait() } -func (p *Program) CheckSourceFiles(ctx context.Context) { - wg := core.NewWorkGroup(p.singleThreaded()) +func (p *Program) CheckSourceFiles(ctx context.Context, files []*ast.SourceFile) { + wg := core.NewWorkGroup(p.SingleThreaded()) checkers, done := p.checkerPool.GetAllCheckers(ctx) defer done() for _, checker := range checkers { wg.Queue(func() { for file := range p.checkerPool.Files(checker) { - checker.CheckSourceFile(ctx, file) + if files == nil || slices.Contains(files, file) { + checker.CheckSourceFile(ctx, file) + } } }) } @@ -330,6 +330,19 @@ func (p *Program) GetSemanticDiagnostics(ctx context.Context, sourceFile *ast.So return p.getDiagnosticsHelper(ctx, sourceFile, true /*ensureBound*/, true /*ensureChecked*/, p.getSemanticDiagnosticsForFile) } +func (p *Program) GetSemanticDiagnosticsNoFilter(ctx context.Context, sourceFiles []*ast.SourceFile) map[*ast.SourceFile][]*ast.Diagnostic { + p.BindSourceFiles() + p.CheckSourceFiles(ctx, sourceFiles) + if ctx.Err() != nil { + return nil + } + result := make(map[*ast.SourceFile][]*ast.Diagnostic, len(sourceFiles)) + for _, file := range sourceFiles { + result[file] = SortAndDeduplicateDiagnostics(p.getSemanticDiagnosticsForFileNotFilter(ctx, file)) + } + return result +} + func (p *Program) GetSuggestionDiagnostics(ctx context.Context, sourceFile *ast.SourceFile) []*ast.Diagnostic { return p.getDiagnosticsHelper(ctx, sourceFile, true /*ensureBound*/, true /*ensureChecked*/, p.getSuggestionDiagnosticsForFile) } @@ -389,6 +402,14 @@ func FilterNoEmitSemanticDiagnostics(diagnostics []*ast.Diagnostic, options *cor } func (p *Program) getSemanticDiagnosticsForFile(ctx context.Context, sourceFile *ast.SourceFile) []*ast.Diagnostic { + diagnostics := p.getSemanticDiagnosticsForFileNotFilter(ctx, sourceFile) + if diagnostics == nil { + return nil + } + return FilterNoEmitSemanticDiagnostics(diagnostics, p.Options()) +} + +func (p *Program) getSemanticDiagnosticsForFileNotFilter(ctx context.Context, sourceFile *ast.SourceFile) []*ast.Diagnostic { compilerOptions := p.Options() if checker.SkipTypeChecking(sourceFile, compilerOptions, p, false) { return nil @@ -421,13 +442,13 @@ func (p *Program) getSemanticDiagnosticsForFile(ctx context.Context, sourceFile isPlainJS := ast.IsPlainJSFile(sourceFile, compilerOptions.CheckJs) if isPlainJS { - return FilterNoEmitSemanticDiagnostics(core.Filter(diags, func(d *ast.Diagnostic) bool { + return core.Filter(diags, func(d *ast.Diagnostic) bool { return plainJSErrors.Has(d.Code()) - }), p.Options()) + }) } if len(sourceFile.CommentDirectives) == 0 { - return FilterNoEmitSemanticDiagnostics(diags, p.Options()) + return diags } // Build map of directives by line number directivesByLine := make(map[int]ast.CommentDirective) @@ -464,7 +485,7 @@ func (p *Program) getSemanticDiagnosticsForFile(ctx context.Context, sourceFile filtered = append(filtered, ast.NewDiagnostic(sourceFile, directive.Loc, diagnostics.Unused_ts_expect_error_directive)) } } - return FilterNoEmitSemanticDiagnostics(filtered, p.Options()) + return filtered } func (p *Program) getDeclarationDiagnosticsForFile(ctx context.Context, sourceFile *ast.SourceFile) []*ast.Diagnostic { @@ -575,7 +596,7 @@ func (p *Program) getDiagnosticsHelper(ctx context.Context, sourceFile *ast.Sour p.BindSourceFiles() } if ensureChecked { - p.CheckSourceFiles(ctx) + p.CheckSourceFiles(ctx, nil) if ctx.Err() != nil { return nil } @@ -715,15 +736,14 @@ func (p *Program) Emit(ctx context.Context, options EmitOptions) *EmitResult { // !!! performance measurement p.BindSourceFiles() if options.EmitOnly != EmitOnlyForcedDts { - result := HandleNoEmitOptions( + result := HandleNoEmitOnError( ctx, p, options.TargetSourceFile, ) - if result != nil { + if result != nil || ctx.Err() != nil { return result } - context.TODO() } writerPool := &sync.Pool{ @@ -731,7 +751,7 @@ func (p *Program) Emit(ctx context.Context, options EmitOptions) *EmitResult { return printer.NewTextWriter(p.Options().NewLine.GetNewLineCharacter()) }, } - wg := core.NewWorkGroup(p.singleThreaded()) + wg := core.NewWorkGroup(p.SingleThreaded()) var emitters []*emitter sourceFiles := getSourceFilesToEmit(p, options.TargetSourceFile, options.EmitOnly == EmitOnlyForcedDts) diff --git a/internal/execute/tsc.go b/internal/execute/tsc.go index ab3c797161..2a6f657a3b 100644 --- a/internal/execute/tsc.go +++ b/internal/execute/tsc.go @@ -362,7 +362,9 @@ func emitFilesAndReportErrors( emitResult = program.Emit(ctx, compiler.EmitOptions{}) result.emitTime = sys.Now().Sub(emitStart) } - allDiagnostics = append(allDiagnostics, emitResult.Diagnostics...) + if emitResult != nil { + allDiagnostics = append(allDiagnostics, emitResult.Diagnostics...) + } allDiagnostics = compiler.SortAndDeduplicateDiagnostics(allDiagnostics) for _, diagnostic := range allDiagnostics { diff --git a/internal/incremental/affectedfileshandler.go b/internal/incremental/affectedfileshandler.go new file mode 100644 index 0000000000..cf580975f6 --- /dev/null +++ b/internal/incremental/affectedfileshandler.go @@ -0,0 +1,440 @@ +package incremental + +import ( + "context" + "crypto/sha256" + "fmt" + "maps" + "slices" + "strings" + "sync" + "sync/atomic" + + "github.com/microsoft/typescript-go/internal/ast" + "github.com/microsoft/typescript-go/internal/checker" + "github.com/microsoft/typescript-go/internal/collections" + "github.com/microsoft/typescript-go/internal/compiler" + "github.com/microsoft/typescript-go/internal/core" + "github.com/microsoft/typescript-go/internal/tspath" +) + +type dtsMayChange map[tspath.Path]FileEmitKind + +func (c dtsMayChange) addFileToAffectedFilesPendingEmit(filePath tspath.Path, emitKind FileEmitKind) { + c[filePath] = emitKind +} + +type affectedFilesHandler struct { + ctx context.Context + program *Program + hasAllFilesExcludingDefaultLibraryFile atomic.Bool + updatedSignatures collections.SyncMap[tspath.Path, string] + dtsMayChange []dtsMayChange + filesToRemoveDiagnostics collections.SyncSet[tspath.Path] + cleanedDiagnosticsOfLibFiles sync.Once + seenFileAndExportsOfFile collections.SyncMap[tspath.Path, bool] +} + +func (h *affectedFilesHandler) getDtsMayChange(affectedFilePath tspath.Path, affectedFileEmitKind FileEmitKind) dtsMayChange { + result := dtsMayChange(map[tspath.Path]FileEmitKind{affectedFilePath: affectedFileEmitKind}) + h.dtsMayChange = append(h.dtsMayChange, result) + return result +} + +func (h *affectedFilesHandler) isChangedSignature(path tspath.Path) bool { + newSignature, _ := h.updatedSignatures.Load(path) + oldSignature := h.program.snapshot.fileInfos[path].signature + return newSignature != oldSignature +} + +func (h *affectedFilesHandler) removeSemanticDiagnosticsOf(path tspath.Path) { + if h.program.snapshot.semanticDiagnosticsFromOldState.Has(path) { + h.filesToRemoveDiagnostics.Add(path) + } +} + +func (h *affectedFilesHandler) removeDiagnosticsOfLibraryFiles() { + h.cleanedDiagnosticsOfLibFiles.Do(func() { + for _, file := range h.program.GetSourceFiles() { + if h.program.program.IsSourceFileDefaultLibrary(file.Path()) && !checker.SkipTypeChecking(file, h.program.snapshot.options, h.program.program, true) { + h.removeSemanticDiagnosticsOf(file.Path()) + } + } + }) +} + +func (h *affectedFilesHandler) computeDtsSignature(file *ast.SourceFile) string { + var signature string + h.program.program.Emit(h.ctx, compiler.EmitOptions{ + TargetSourceFile: file, + EmitOnly: compiler.EmitOnlyForcedDts, + WriteFile: func(fileName string, text string, writeByteOrderMark bool, data *compiler.WriteFileData) error { + if !tspath.IsDeclarationFileName(fileName) { + panic("File extension for signature expected to be dts, got : " + fileName) + } + signature = computeSignatureWithDiagnostics(file, text, data) + return nil + }, + }) + return signature +} + +func (h *affectedFilesHandler) updateShapeSignature(file *ast.SourceFile, useFileVersionAsSignature bool) bool { + // If we have cached the result for this file, that means hence forth we should assume file shape is uptodate + if _, ok := h.updatedSignatures.Load(file.Path()); ok { + return false + } + + info := h.program.snapshot.fileInfos[file.Path()] + prevSignature := info.signature + var latestSignature string + if !file.IsDeclarationFile && !useFileVersionAsSignature { + latestSignature = h.computeDtsSignature(file) + } + // Default is to use file version as signature + if latestSignature == "" { + latestSignature = info.version + } + h.updatedSignatures.Store(file.Path(), latestSignature) + return latestSignature != prevSignature +} + +func (h *affectedFilesHandler) getFilesAffectedBy(path tspath.Path) []*ast.SourceFile { + file := h.program.program.GetSourceFileByPath(path) + if file == nil { + return nil + } + + if !h.updateShapeSignature(file, false) { + return []*ast.SourceFile{file} + } + + if !h.program.snapshot.tracksReferences() { + h.hasAllFilesExcludingDefaultLibraryFile.Store(true) + return h.program.snapshot.getAllFilesExcludingDefaultLibraryFile(h.program.program, file) + } + + if info := h.program.snapshot.fileInfos[file.Path()]; info.affectsGlobalScope { + h.hasAllFilesExcludingDefaultLibraryFile.Store(true) + h.program.snapshot.getAllFilesExcludingDefaultLibraryFile(h.program.program, file) + } + + if h.program.snapshot.options.IsolatedModules.IsTrue() { + return []*ast.SourceFile{file} + } + + // Now we need to if each file in the referencedBy list has a shape change as well. + // Because if so, its own referencedBy files need to be saved as well to make the + // emitting result consistent with files on disk. + seenFileNamesMap := h.forEachFileReferencedBy( + file, + func(currentFile *ast.SourceFile, currentPath tspath.Path) (queueForFile bool, fastReturn bool) { + // If the current file is not nil and has a shape change, we need to queue it for processing + if currentFile != nil && h.updateShapeSignature(currentFile, false) { + return true, false + } + return false, false + }, + ) + // Return array of values that needs emit + return core.Filter(slices.Collect(maps.Values(seenFileNamesMap)), func(file *ast.SourceFile) bool { + return file != nil + }) +} + +// Gets the files referenced by the the file path +func (h *affectedFilesHandler) getReferencedByPaths(file tspath.Path) map[tspath.Path]struct{} { + keys, ok := h.program.snapshot.referencedMap.GetKeys(file) + if !ok { + return nil + } + return keys.Keys() +} + +func (h *affectedFilesHandler) forEachFileReferencedBy(file *ast.SourceFile, fn func(currentFile *ast.SourceFile, currentPath tspath.Path) (queueForFile bool, fastReturn bool)) map[tspath.Path]*ast.SourceFile { + // Now we need to if each file in the referencedBy list has a shape change as well. + // Because if so, its own referencedBy files need to be saved as well to make the + // emitting result consistent with files on disk. + seenFileNamesMap := map[tspath.Path]*ast.SourceFile{} + // Start with the paths this file was referenced by + seenFileNamesMap[file.Path()] = file + references := h.getReferencedByPaths(file.Path()) + queue := slices.Collect(maps.Keys(references)) + for len(queue) > 0 { + currentPath := queue[len(queue)-1] + queue = queue[:len(queue)-1] + if _, ok := seenFileNamesMap[currentPath]; !ok { + currentFile := h.program.program.GetSourceFileByPath(currentPath) + seenFileNamesMap[currentPath] = currentFile + queueForFile, fastReturn := fn(currentFile, currentPath) + if fastReturn { + return seenFileNamesMap + } + if queueForFile { + for ref := range h.getReferencedByPaths(currentFile.Path()) { + queue = append(queue, ref) + } + } + } + } + return seenFileNamesMap +} + +// Handles semantic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file +// This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change +func (h *affectedFilesHandler) handleDtsMayChangeOfAffectedFile(dtsMayChange dtsMayChange, affectedFile *ast.SourceFile) { + h.removeSemanticDiagnosticsOf(affectedFile.Path()) + + // If affected files is everything except default library, then nothing more to do + if h.hasAllFilesExcludingDefaultLibraryFile.Load() { + h.removeDiagnosticsOfLibraryFiles() + // When a change affects the global scope, all files are considered to be affected without updating their signature + // That means when affected file is handled, its signature can be out of date + // To avoid this, ensure that we update the signature for any affected file in this scenario. + h.updateShapeSignature(affectedFile, false) + return + } + + if h.program.snapshot.options.AssumeChangesOnlyAffectDirectDependencies.IsTrue() { + return + } + + // Iterate on referencing modules that export entities from affected file and delete diagnostics and add pending emit + // If there was change in signature (dts output) for the changed file, + // then only we need to handle pending file emit + if !h.program.snapshot.tracksReferences() || + !h.program.snapshot.changedFilesSet.Has(affectedFile.Path()) || + !h.isChangedSignature(affectedFile.Path()) { + return + } + + // Since isolated modules dont change js files, files affected by change in signature is itself + // But we need to cleanup semantic diagnostics and queue dts emit for affected files + if h.program.snapshot.options.IsolatedModules.IsTrue() { + h.forEachFileReferencedBy( + affectedFile, + func(currentFile *ast.SourceFile, currentPath tspath.Path) (queueForFile bool, fastReturn bool) { + if h.handleDtsMayChangeOfGlobalScope(dtsMayChange, currentPath /*invalidateJsFiles*/, false) { + return false, true + } + h.handleDtsMayChangeOf(dtsMayChange, currentPath /*invalidateJsFiles*/, false) + if h.isChangedSignature(currentPath) { + return true, false + } + return false, false + }, + ) + } + + invalidateJsFiles := false + var typeChecker *checker.Checker + var done func() + // If exported const enum, we need to ensure that js files are emitted as well since the const enum value changed + if affectedFile.Symbol != nil { + for _, exported := range affectedFile.Symbol.Exports { + if exported.Flags&ast.SymbolFlagsConstEnum != 0 { + invalidateJsFiles = true + break + } + if typeChecker == nil { + typeChecker, done = h.program.program.GetTypeCheckerForFile(h.ctx, affectedFile) + } + aliased := checker.SkipAlias(exported, typeChecker) + if aliased == exported { + continue + } + if (aliased.Flags & ast.SymbolFlagsConstEnum) != 0 { + if slices.ContainsFunc(aliased.Declarations, func(d *ast.Node) bool { + return ast.GetSourceFileOfNode(d) == affectedFile + }) { + invalidateJsFiles = true + break + } + } + } + } + if done != nil { + done() + } + + // Go through files that reference affected file and handle dts emit and semantic diagnostics for them and their references + if keys, ok := h.program.snapshot.referencedMap.GetKeys(affectedFile.Path()); ok { + for exportedFromPath := range keys.Keys() { + if h.handleDtsMayChangeOfGlobalScope(dtsMayChange, exportedFromPath, invalidateJsFiles) { + return + } + if references, ok := h.program.snapshot.referencedMap.GetKeys(exportedFromPath); ok { + for filePath := range references.Keys() { + if h.handleDtsMayChangeOfFileAndExportsOfFile(dtsMayChange, filePath, invalidateJsFiles) { + return + } + } + } + } + } +} + +func (h *affectedFilesHandler) handleDtsMayChangeOfFileAndExportsOfFile(dtsMayChange dtsMayChange, filePath tspath.Path, invalidateJsFiles bool) bool { + if existing, loaded := h.seenFileAndExportsOfFile.LoadOrStore(filePath, invalidateJsFiles); loaded && (existing || !invalidateJsFiles) { + return false + } + if h.handleDtsMayChangeOfGlobalScope(dtsMayChange, filePath, invalidateJsFiles) { + return true + } + h.handleDtsMayChangeOf(dtsMayChange, filePath, invalidateJsFiles) + + // Remove the diagnostics of files that import this file and handle all its exports too + if keys, ok := h.program.snapshot.referencedMap.GetKeys(filePath); ok { + for referencingFilePath := range keys.Keys() { + if h.handleDtsMayChangeOfFileAndExportsOfFile(dtsMayChange, referencingFilePath, invalidateJsFiles) { + return true + } + } + } + return false +} + +func (h *affectedFilesHandler) handleDtsMayChangeOfGlobalScope(dtsMayChange dtsMayChange, filePath tspath.Path, invalidateJsFiles bool) bool { + if info, ok := h.program.snapshot.fileInfos[filePath]; !ok || !info.affectsGlobalScope { + return false + } + // Every file needs to be handled + for _, file := range h.program.snapshot.getAllFilesExcludingDefaultLibraryFile(h.program.program, nil) { + h.handleDtsMayChangeOf(dtsMayChange, file.Path(), invalidateJsFiles) + } + h.removeDiagnosticsOfLibraryFiles() + return true +} + +// Handle the dts may change, so they need to be added to pending emit if dts emit is enabled, +// Also we need to make sure signature is updated for these files +func (h *affectedFilesHandler) handleDtsMayChangeOf(dtsMayChange dtsMayChange, path tspath.Path, invalidateJsFiles bool) { + h.removeSemanticDiagnosticsOf(path) + if h.program.snapshot.changedFilesSet.Has(path) { + return + } + file := h.program.program.GetSourceFileByPath(path) + if file == nil { + return + } + // Even though the js emit doesnt change and we are already handling dts emit and semantic diagnostics + // we need to update the signature to reflect correctness of the signature(which is output d.ts emit) of this file + // This ensures that we dont later during incremental builds considering wrong signature. + // Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build + // But we avoid expensive full shape computation, as using file version as shape is enough for correctness. + h.updateShapeSignature(file, true) + // If not dts emit, nothing more to do + if invalidateJsFiles { + dtsMayChange.addFileToAffectedFilesPendingEmit(path, GetFileEmitKind(h.program.snapshot.options)) + } else if h.program.snapshot.options.GetEmitDeclarations() { + dtsMayChange.addFileToAffectedFilesPendingEmit(path, core.IfElse(h.program.snapshot.options.DeclarationMap.IsTrue(), fileEmitKindAllDts, fileEmitKindDts)) + } +} + +func (h *affectedFilesHandler) updateSnapshot() { + if h.ctx.Err() != nil { + return + } + h.updatedSignatures.Range(func(filePath tspath.Path, signature string) bool { + h.program.snapshot.fileInfos[filePath].signature = signature + return true + }) + h.filesToRemoveDiagnostics.Range(func(file tspath.Path) bool { + h.program.snapshot.semanticDiagnosticsFromOldState.Delete(file) + delete(h.program.snapshot.semanticDiagnosticsPerFile, file) + return true + }) + for _, change := range h.dtsMayChange { + for filePath, emitKind := range change { + h.program.snapshot.addFileToAffectedFilesPendingEmit(filePath, emitKind) + } + } + h.program.snapshot.changedFilesSet = &collections.Set[tspath.Path]{} + h.program.snapshot.buildInfoEmitPending = true +} + +func collectAllAffectedFiles(ctx context.Context, program *Program) { + if program.snapshot.changedFilesSet.Len() == 0 { + return + } + + handler := affectedFilesHandler{ctx: ctx, program: program} + wg := core.NewWorkGroup(handler.program.program.SingleThreaded()) + var result collections.SyncSet[*ast.SourceFile] + for file := range program.snapshot.changedFilesSet.Keys() { + wg.Queue(func() { + for _, affectedFile := range handler.getFilesAffectedBy(file) { + result.Add(affectedFile) + } + }) + } + wg.RunAndWait() + + if ctx.Err() != nil { + return + } + + // For all the affected files, get all the files that would need to change their dts or js files, + // update their diagnostics + wg = core.NewWorkGroup(program.program.SingleThreaded()) + emitKind := GetFileEmitKind(program.snapshot.options) + result.Range(func(file *ast.SourceFile) bool { + // remove the cached semantic diagnostics and handle dts emit and js emit if needed + dtsMayChange := handler.getDtsMayChange(file.Path(), emitKind) + wg.Queue(func() { + handler.handleDtsMayChangeOfAffectedFile(dtsMayChange, file) + }) + return true + }) + wg.RunAndWait() + + // Update the snapshot with the new state + handler.updateSnapshot() +} + +func getTextHandlingSourceMapForSignature(text string, data *compiler.WriteFileData) string { + if data.SourceMapUrlPos != -1 { + return text[:data.SourceMapUrlPos] + } + return text +} + +func computeSignatureWithDiagnostics(file *ast.SourceFile, text string, data *compiler.WriteFileData) string { + var builder strings.Builder + builder.WriteString(getTextHandlingSourceMapForSignature(text, data)) + for _, diag := range data.Diagnostics { + diagnosticToStringBuilder(diag, file, &builder) + } + return computeHash(builder.String()) +} + +func diagnosticToStringBuilder(diagnostic *ast.Diagnostic, file *ast.SourceFile, builder *strings.Builder) string { + if diagnostic == nil { + return "" + } + builder.WriteString("\n") + if diagnostic.File() != file { + builder.WriteString(tspath.EnsurePathIsNonModuleName(tspath.GetRelativePathFromDirectory( + tspath.GetDirectoryPath(string(file.Path())), + string(diagnostic.File().Path()), + tspath.ComparePathsOptions{}, + ))) + } + if diagnostic.File() != nil { + builder.WriteString(fmt.Sprintf("(%d,%d): ", diagnostic.Pos(), diagnostic.Len())) + } + builder.WriteString(diagnostic.Category().Name()) + builder.WriteString(fmt.Sprintf("%d: ", diagnostic.Code())) + builder.WriteString(diagnostic.Message()) + for _, chain := range diagnostic.MessageChain() { + diagnosticToStringBuilder(chain, file, builder) + } + for _, info := range diagnostic.RelatedInformation() { + diagnosticToStringBuilder(info, file, builder) + } + return builder.String() +} + +func computeHash(text string) string { + return fmt.Sprintf("%x", sha256.Sum256([]byte(text))) +} diff --git a/internal/incremental/buildInfo.go b/internal/incremental/buildInfo.go index 8b3dfa86b3..8391be56f3 100644 --- a/internal/incremental/buildInfo.go +++ b/internal/incremental/buildInfo.go @@ -70,11 +70,9 @@ type buildInfoFileInfoNoSignature struct { ImpliedNodeFormat core.ResolutionMode `json:"impliedNodeFormat,omitzero"` } -/** - * Signature is - * - undefined if FileInfo.version === FileInfo.signature - * - string actual signature - */ +// Signature is +// - undefined if FileInfo.version === FileInfo.signature +// - string actual signature type buildInfoFileInfoWithSignature struct { Version string `json:"version,omitzero"` Signature string `json:"signature,omitzero"` @@ -268,11 +266,9 @@ func (b *BuildInfoSemanticDiagnostic) UnmarshalJSON(data []byte) error { return fmt.Errorf("invalid BuildInfoSemanticDiagnostic: %s", data) } -/** - * fileId if pending emit is same as what compilerOptions suggest - * [fileId] if pending emit is only dts file emit - * [fileId, emitKind] if any other type emit is pending - */ +// fileId if pending emit is same as what compilerOptions suggest +// [fileId] if pending emit is only dts file emit +// [fileId, emitKind] if any other type emit is pending type BuildInfoFilePendingEmit struct { FileId BuildInfoFileId EmitKind FileEmitKind @@ -318,10 +314,8 @@ func (b *BuildInfoFilePendingEmit) UnmarshalJSON(data []byte) error { return fmt.Errorf("invalid BuildInfoFilePendingEmit: %s", data) } -/** - * [fileId, signature] if different from file's signature - * fileId if file wasnt emitted - */ +// [fileId, signature] if different from file's signature +// fileId if file wasnt emitted type BuildInfoEmitSignature struct { FileId BuildInfoFileId Signature string // Signature if it is different from file's Signature diff --git a/internal/incremental/emitfileshandler.go b/internal/incremental/emitfileshandler.go new file mode 100644 index 0000000000..4d886f359d --- /dev/null +++ b/internal/incremental/emitfileshandler.go @@ -0,0 +1,274 @@ +package incremental + +import ( + "context" + + "github.com/microsoft/typescript-go/internal/ast" + "github.com/microsoft/typescript-go/internal/collections" + "github.com/microsoft/typescript-go/internal/compiler" + "github.com/microsoft/typescript-go/internal/core" + "github.com/microsoft/typescript-go/internal/tspath" +) + +type emitUpdate struct { + pendingKind FileEmitKind + result *compiler.EmitResult +} + +type emitFilesHandler struct { + ctx context.Context + program *Program + isForDtsErrors bool + signatures collections.SyncMap[tspath.Path, string] + emitSignatures collections.SyncMap[tspath.Path, *emitSignature] + latestChangedDtsFile string + deletedPendingKinds collections.Set[tspath.Path] + emitUpdates collections.SyncMap[tspath.Path, *emitUpdate] +} + +// Determining what all is pending to be emitted based on previous options or previous file emit flags +func (h *emitFilesHandler) getPendingEmitKindForEmitOptions(emitKind FileEmitKind, options compiler.EmitOptions) FileEmitKind { + pendingKind := getPendingEmitKind(emitKind, 0) + if options.EmitOnly == compiler.EmitOnlyDts { + pendingKind &= fileEmitKindAllDts + } + if h.isForDtsErrors { + pendingKind &= fileEmitKindDtsErrors + } + return pendingKind +} + +// Emits the next affected file's emit result (EmitResult and sourceFiles emitted) or returns undefined if iteration is complete +// The first of writeFile if provided, writeFile of BuilderProgramHost if provided, writeFile of compiler host +// in that order would be used to write the files +func (h *emitFilesHandler) emitAllAffectedFiles(options compiler.EmitOptions) *compiler.EmitResult { + // Get all affected files + collectAllAffectedFiles(h.ctx, h.program) + if h.ctx.Err() != nil { + return nil + } + + // Emit all affected files + var results []*compiler.EmitResult + if len(h.program.snapshot.affectedFilesPendingEmit) != 0 { + wg := core.NewWorkGroup(h.program.program.SingleThreaded()) + for path, emitKind := range h.program.snapshot.affectedFilesPendingEmit { + affectedFile := h.program.program.GetSourceFileByPath(path) + if affectedFile == nil || !h.program.program.SourceFileMayBeEmitted(affectedFile, false) { + h.deletedPendingKinds.Add(path) + continue + } + pendingKind := h.getPendingEmitKindForEmitOptions(emitKind, options) + if pendingKind != 0 { + wg.Queue(func() { + // Determine if we can do partial emit + var emitOnly compiler.EmitOnly + if (pendingKind & fileEmitKindAllJs) != 0 { + emitOnly = compiler.EmitOnlyJs + } + if (pendingKind & fileEmitKindAllDts) != 0 { + if emitOnly == compiler.EmitOnlyJs { + emitOnly = compiler.EmitAll + } else { + emitOnly = compiler.EmitOnlyDts + } + } + var result *compiler.EmitResult + if !h.isForDtsErrors { + result = h.program.program.Emit(h.ctx, h.getEmitOptions(compiler.EmitOptions{ + TargetSourceFile: affectedFile, + EmitOnly: emitOnly, + WriteFile: options.WriteFile, + })) + } else { + result = &compiler.EmitResult{ + EmitSkipped: true, + Diagnostics: h.program.program.GetDeclarationDiagnostics(h.ctx, affectedFile), + } + } + + // Update the pendingEmit for the file + h.emitUpdates.Store(path, &emitUpdate{pendingKind: getPendingEmitKind(emitKind, pendingKind), result: result}) + }) + } + } + wg.RunAndWait() + if h.ctx.Err() != nil { + return nil + } + + // Get updated errors that were not included in affected files emit + for path, diagnostics := range h.program.snapshot.emitDiagnosticsPerFile { + if _, ok := h.emitUpdates.Load(path); !ok { + affectedFile := h.program.program.GetSourceFileByPath(path) + if affectedFile == nil || !h.program.program.SourceFileMayBeEmitted(affectedFile, false) { + h.deletedPendingKinds.Add(path) + continue + } + pendingKind := h.program.snapshot.affectedFilesPendingEmit[path] + h.emitUpdates.Store(path, &emitUpdate{pendingKind: pendingKind, result: &compiler.EmitResult{ + EmitSkipped: true, + Diagnostics: diagnostics.getDiagnostics(h.program.program, affectedFile), + }}) + } + } + + results = h.updateSnapshot() + } + + // Combine results and update buildInfo + if h.isForDtsErrors && options.TargetSourceFile != nil { + // Result from cache + diagnostics := h.program.snapshot.emitDiagnosticsPerFile[options.TargetSourceFile.Path()] + return &compiler.EmitResult{ + EmitSkipped: true, + Diagnostics: diagnostics.getDiagnostics(h.program.program, options.TargetSourceFile), + } + } + + result := compiler.CombineEmitResults(results) + if !h.isForDtsErrors { + buildInfoResult := h.program.emitBuildInfo(h.ctx, options) + if buildInfoResult != nil { + result.Diagnostics = append(result.Diagnostics, buildInfoResult.Diagnostics...) + result.EmittedFiles = append(result.EmittedFiles, buildInfoResult.EmittedFiles...) + } + } + + return result +} + +func (h *emitFilesHandler) getEmitOptions(options compiler.EmitOptions) compiler.EmitOptions { + if !h.program.snapshot.options.GetEmitDeclarations() { + return options + } + return compiler.EmitOptions{ + TargetSourceFile: options.TargetSourceFile, + EmitOnly: options.EmitOnly, + WriteFile: func(fileName string, text string, writeByteOrderMark bool, data *compiler.WriteFileData) error { + if tspath.IsDeclarationFileName(fileName) { + var emitSignature string + info := h.program.snapshot.fileInfos[options.TargetSourceFile.Path()] + if info.signature == info.version { + signature := computeSignatureWithDiagnostics(options.TargetSourceFile, text, data) + // With d.ts diagnostics they are also part of the signature so emitSignature will be different from it since its just hash of d.ts + if len(data.Diagnostics) == 0 { + emitSignature = signature + } + if signature != info.version { // Update it + h.signatures.Store(options.TargetSourceFile.Path(), signature) + } + } + + // Store d.ts emit hash so later can be compared to check if d.ts has changed. + // Currently we do this only for composite projects since these are the only projects that can be referenced by other projects + // and would need their d.ts change time in --build mode + if h.skipDtsOutputOfComposite(options.TargetSourceFile, fileName, text, data, emitSignature) { + return nil + } + } + + if options.WriteFile != nil { + return options.WriteFile(fileName, text, writeByteOrderMark, data) + } + return h.program.program.Host().FS().WriteFile(fileName, text, writeByteOrderMark) + }, + } +} + +// Compare to existing computed signature and store it or handle the changes in d.ts map option from before +// returning undefined means that, we dont need to emit this d.ts file since its contents didnt change +func (h *emitFilesHandler) skipDtsOutputOfComposite(file *ast.SourceFile, outputFileName string, text string, data *compiler.WriteFileData, newSignature string) bool { + if !h.program.snapshot.options.Composite.IsTrue() { + return false + } + var oldSignature string + oldSignatureFormat, ok := h.program.snapshot.emitSignatures[file.Path()] + if ok { + if oldSignatureFormat.signature != "" { + oldSignature = oldSignatureFormat.signature + } else { + oldSignature = oldSignatureFormat.signatureWithDifferentOptions[0] + } + } + if newSignature == "" { + newSignature = computeHash(getTextHandlingSourceMapForSignature(text, data)) + } + // Dont write dts files if they didn't change + if newSignature == oldSignature { + // If the signature was encoded as string the dts map options match so nothing to do + if oldSignatureFormat != nil && oldSignatureFormat.signature == oldSignature { + data.SkippedDtsWrite = true + return true + } else { + // Mark as differsOnlyInMap so that --build can reverse the timestamp so that + // the downstream projects dont detect this as change in d.ts file + data.DiffersOnlyInMap = true + } + } else { + h.latestChangedDtsFile = outputFileName + } + h.emitSignatures.Store(file.Path(), &emitSignature{signature: newSignature}) + return false +} + +func (h *emitFilesHandler) updateSnapshot() []*compiler.EmitResult { + h.signatures.Range(func(file tspath.Path, signature string) bool { + info := h.program.snapshot.fileInfos[file] + info.signature = signature + h.program.snapshot.buildInfoEmitPending = true + return true + }) + h.emitSignatures.Range(func(file tspath.Path, signature *emitSignature) bool { + if h.program.snapshot.emitSignatures == nil { + h.program.snapshot.emitSignatures = make(map[tspath.Path]*emitSignature) + } + h.program.snapshot.emitSignatures[file] = signature + h.program.snapshot.buildInfoEmitPending = true + return true + }) + if h.latestChangedDtsFile != "" { + h.program.snapshot.latestChangedDtsFile = h.latestChangedDtsFile + h.program.snapshot.buildInfoEmitPending = true + } + for file := range h.deletedPendingKinds.Keys() { + delete(h.program.snapshot.affectedFilesPendingEmit, file) + h.program.snapshot.buildInfoEmitPending = true + } + var results []*compiler.EmitResult + h.emitUpdates.Range(func(file tspath.Path, update *emitUpdate) bool { + if update.pendingKind == 0 { + delete(h.program.snapshot.affectedFilesPendingEmit, file) + } else { + h.program.snapshot.affectedFilesPendingEmit[file] = update.pendingKind + } + if update.result == nil { + results = append(results, update.result) + if len(update.result.Diagnostics) != 0 { + if h.program.snapshot.emitDiagnosticsPerFile == nil { + h.program.snapshot.emitDiagnosticsPerFile = make(map[tspath.Path]*diagnosticsOrBuildInfoDiagnosticsWithFileName) + } + h.program.snapshot.emitDiagnosticsPerFile[file] = &diagnosticsOrBuildInfoDiagnosticsWithFileName{diagnostics: update.result.Diagnostics} + } + } + h.program.snapshot.buildInfoEmitPending = true + return true + }) + return results +} + +func emitFiles(ctx context.Context, program *Program, options compiler.EmitOptions, isForDtsErrors bool) *compiler.EmitResult { + emitHandler := &emitFilesHandler{ctx: ctx, program: program, isForDtsErrors: isForDtsErrors} + + if options.TargetSourceFile != nil { + result := program.program.Emit(ctx, emitHandler.getEmitOptions(options)) + if ctx.Err() != nil { + return nil + } + emitHandler.updateSnapshot() + return result + } + + // Emit only affected files if using builder for emit + return emitHandler.emitAllAffectedFiles(options) +} diff --git a/internal/incremental/incremental.go b/internal/incremental/incremental.go index 7bb90b81eb..6b3f9f87e9 100644 --- a/internal/incremental/incremental.go +++ b/internal/incremental/incremental.go @@ -56,7 +56,7 @@ func ReadBuildInfoProgram(config *tsoptions.ParsedCommandLine, reader BuildInfoR // Convert to information that can be used to create incremental program incrementalProgram := &Program{ - state: buildInfoToProgramState(buildInfo, buildInfoFileName, config), + snapshot: buildInfoToSnapshot(buildInfo, buildInfoFileName, config), } return incrementalProgram } diff --git a/internal/incremental/program.go b/internal/incremental/program.go index 7e40fc5b43..137bef19fb 100644 --- a/internal/incremental/program.go +++ b/internal/incremental/program.go @@ -2,90 +2,294 @@ package incremental import ( "context" + "encoding/json" "fmt" + "slices" "github.com/microsoft/typescript-go/internal/ast" "github.com/microsoft/typescript-go/internal/compiler" "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/tspath" ) type Program struct { - state *programState - program *compiler.Program + snapshot *snapshot + program *compiler.Program } var _ compiler.AnyProgram = (*Program)(nil) func NewProgram(program *compiler.Program, oldProgram *Program) *Program { return &Program{ - state: newProgramState(program, oldProgram), - program: program, + snapshot: newSnapshotForProgram(program, oldProgram), + program: program, } } -func (p *Program) panicIfNoProgram(method string) { - if p.program == nil { +func (h *Program) panicIfNoProgram(method string) { + if h.program == nil { panic(fmt.Sprintf("%s should not be called without program", method)) } } -func (p *Program) GetProgram() *compiler.Program { - p.panicIfNoProgram("GetProgram") - return p.program +func (h *Program) GetProgram() *compiler.Program { + h.panicIfNoProgram("GetProgram") + return h.program } -func (p *Program) Options() *core.CompilerOptions { - return p.state.options +// Options implements compiler.AnyProgram interface. +func (h *Program) Options() *core.CompilerOptions { + return h.snapshot.options } -func (p *Program) GetSourceFiles() []*ast.SourceFile { - p.panicIfNoProgram("GetSourceFiles") - return p.program.GetSourceFiles() +// GetSourceFiles implements compiler.AnyProgram interface. +func (h *Program) GetSourceFiles() []*ast.SourceFile { + h.panicIfNoProgram("GetSourceFiles") + return h.program.GetSourceFiles() } -func (p *Program) GetConfigFileParsingDiagnostics() []*ast.Diagnostic { - p.panicIfNoProgram("GetConfigFileParsingDiagnostics") - return p.program.GetConfigFileParsingDiagnostics() +// GetConfigFileParsingDiagnostics implements compiler.AnyProgram interface. +func (h *Program) GetConfigFileParsingDiagnostics() []*ast.Diagnostic { + h.panicIfNoProgram("GetConfigFileParsingDiagnostics") + return h.program.GetConfigFileParsingDiagnostics() } -func (p *Program) GetSyntacticDiagnostics(ctx context.Context, file *ast.SourceFile) []*ast.Diagnostic { - p.panicIfNoProgram("GetSyntacticDiagnostics") - return p.program.GetSyntacticDiagnostics(ctx, file) +// GetSyntacticDiagnostics implements compiler.AnyProgram interface. +func (h *Program) GetSyntacticDiagnostics(ctx context.Context, file *ast.SourceFile) []*ast.Diagnostic { + h.panicIfNoProgram("GetSyntacticDiagnostics") + return h.program.GetSyntacticDiagnostics(ctx, file) } -func (p *Program) GetBindDiagnostics(ctx context.Context, file *ast.SourceFile) []*ast.Diagnostic { - p.panicIfNoProgram("GetBindDiagnostics") - return p.program.GetBindDiagnostics(ctx, file) +// GetBindDiagnostics implements compiler.AnyProgram interface. +func (h *Program) GetBindDiagnostics(ctx context.Context, file *ast.SourceFile) []*ast.Diagnostic { + h.panicIfNoProgram("GetBindDiagnostics") + return h.program.GetBindDiagnostics(ctx, file) } -func (p *Program) GetOptionsDiagnostics(ctx context.Context) []*ast.Diagnostic { - p.panicIfNoProgram("GetOptionsDiagnostics") - return p.program.GetOptionsDiagnostics(ctx) +// GetOptionsDiagnostics implements compiler.AnyProgram interface. +func (h *Program) GetOptionsDiagnostics(ctx context.Context) []*ast.Diagnostic { + h.panicIfNoProgram("GetOptionsDiagnostics") + return h.program.GetOptionsDiagnostics(ctx) } -func (p *Program) GetProgramDiagnostics() []*ast.Diagnostic { - if p.program == nil { - panic("GetProgramDiagnostics should not be called without program") +func (h *Program) GetProgramDiagnostics() []*ast.Diagnostic { + h.panicIfNoProgram("GetProgramDiagnostics") + return h.program.GetProgramDiagnostics() +} + +func (h *Program) GetGlobalDiagnostics(ctx context.Context) []*ast.Diagnostic { + h.panicIfNoProgram("GetGlobalDiagnostics") + return h.program.GetGlobalDiagnostics(ctx) +} + +// GetSemanticDiagnostics implements compiler.AnyProgram interface. +func (h *Program) GetSemanticDiagnostics(ctx context.Context, file *ast.SourceFile) []*ast.Diagnostic { + h.panicIfNoProgram("GetSemanticDiagnostics") + if h.snapshot.options.NoCheck.IsTrue() { + return nil + } + + // Ensure all the diagnsotics are cached + h.collectSemanticDiagnosticsOfAffectedFiles(ctx, file) + if ctx.Err() != nil { + return nil + } + + // Return result from cache + if file != nil { + cachedDiagnostics, ok := h.snapshot.semanticDiagnosticsPerFile[file.Path()] + if !ok { + panic("After handling all the affected files, there shouldnt be more changes") + } + return compiler.FilterNoEmitSemanticDiagnostics(cachedDiagnostics.getDiagnostics(h.program, file), h.snapshot.options) + } + + var diagnostics []*ast.Diagnostic + for _, file := range h.program.GetSourceFiles() { + cachedDiagnostics, ok := h.snapshot.semanticDiagnosticsPerFile[file.Path()] + if !ok { + panic("After handling all the affected files, there shouldnt be more changes") + } + diagnostics = append(diagnostics, compiler.FilterNoEmitSemanticDiagnostics(cachedDiagnostics.getDiagnostics(h.program, file), h.snapshot.options)...) + } + return diagnostics +} + +// GetDeclarationDiagnostics implements compiler.AnyProgram interface. +func (h *Program) GetDeclarationDiagnostics(ctx context.Context, file *ast.SourceFile) []*ast.Diagnostic { + h.panicIfNoProgram("GetDeclarationDiagnostics") + result := emitFiles(ctx, h, compiler.EmitOptions{ + TargetSourceFile: file, + }, true) + if result != nil { + return result.Diagnostics } - return p.program.GetProgramDiagnostics() + return nil } -func (p *Program) GetGlobalDiagnostics(ctx context.Context) []*ast.Diagnostic { - p.panicIfNoProgram("GetGlobalDiagnostics") - return p.program.GetGlobalDiagnostics(ctx) +// GetModeForUsageLocation implements compiler.AnyProgram interface. +func (h *Program) Emit(ctx context.Context, options compiler.EmitOptions) *compiler.EmitResult { + h.panicIfNoProgram("Emit") + + if h.snapshot.options.NoEmit.IsTrue() { + if options.TargetSourceFile != nil { + return &compiler.EmitResult{EmitSkipped: true} + } + buildInfoResult := h.emitBuildInfo(ctx, options) + buildInfoResult.EmitSkipped = true + return buildInfoResult + } + + if result := compiler.HandleNoEmitOnError(ctx, h, options.TargetSourceFile); result != nil { + if options.TargetSourceFile != nil { + return result + } + + // Emit buildInfo and combine result + buildInfoResult := h.emitBuildInfo(ctx, options) + if buildInfoResult != nil && buildInfoResult.EmittedFiles != nil { + result.Diagnostics = append(result.Diagnostics, buildInfoResult.Diagnostics...) + result.EmittedFiles = append(result.EmittedFiles, buildInfoResult.EmittedFiles...) + } + return result + } + if ctx.Err() != nil { + return nil + } + + return emitFiles(ctx, h, options, false) } -func (p *Program) GetSemanticDiagnostics(ctx context.Context, file *ast.SourceFile) []*ast.Diagnostic { - p.panicIfNoProgram("GetSemanticDiagnostics") - return p.state.getSemanticDiagnostics(ctx, p.program, file) +// Handle affected files and cache the semantic diagnostics for all of them or the file asked for +func (h *Program) collectSemanticDiagnosticsOfAffectedFiles(ctx context.Context, file *ast.SourceFile) { + // Get all affected files + collectAllAffectedFiles(ctx, h) + if ctx.Err() != nil { + return + } + + if len(h.snapshot.semanticDiagnosticsPerFile) == len(h.program.GetSourceFiles()) { + // If we have all the files, + return + } + + var affectedFiles []*ast.SourceFile + if file != nil { + _, ok := h.snapshot.semanticDiagnosticsPerFile[file.Path()] + if ok { + return + } + affectedFiles = []*ast.SourceFile{file} + } else { + for _, file := range h.program.GetSourceFiles() { + if _, ok := h.snapshot.semanticDiagnosticsPerFile[file.Path()]; !ok { + affectedFiles = append(affectedFiles, file) + } + } + } + + // Get their diagnostics and cache them + diagnosticsPerFile := h.program.GetSemanticDiagnosticsNoFilter(ctx, affectedFiles) + // commit changes if no err + if ctx.Err() != nil { + return + } + + // Commit changes to snapshot + for file, diagnostics := range diagnosticsPerFile { + h.snapshot.semanticDiagnosticsFromOldState.Delete(file.Path()) + h.snapshot.semanticDiagnosticsPerFile[file.Path()] = &diagnosticsOrBuildInfoDiagnosticsWithFileName{diagnostics: diagnostics} + } + if len(h.snapshot.semanticDiagnosticsPerFile) == len(h.program.GetSourceFiles()) && h.snapshot.checkPending && !h.snapshot.options.NoCheck.IsTrue() { + h.snapshot.checkPending = false + } + h.snapshot.buildInfoEmitPending = true } -func (p *Program) GetDeclarationDiagnostics(ctx context.Context, file *ast.SourceFile) []*ast.Diagnostic { - p.panicIfNoProgram("GetDeclarationDiagnostics") - return p.state.getDeclarationDiagnostics(ctx, p.program, file) +func (h *Program) emitBuildInfo(ctx context.Context, options compiler.EmitOptions) *compiler.EmitResult { + buildInfoFileName := outputpaths.GetBuildInfoFileName(h.snapshot.options, tspath.ComparePathsOptions{ + CurrentDirectory: h.program.GetCurrentDirectory(), + UseCaseSensitiveFileNames: h.program.UseCaseSensitiveFileNames(), + }) + if buildInfoFileName == "" { + return nil + } + + hasErrors := h.ensureHasErrorsForState(ctx, h.program) + if !h.snapshot.buildInfoEmitPending && h.snapshot.hasErrors == hasErrors { + return nil + } + h.snapshot.hasErrors = hasErrors + h.snapshot.buildInfoEmitPending = true + if ctx.Err() != nil { + return nil + } + buildInfo := snapshotToBuildInfo(h.snapshot, h.program, buildInfoFileName) + text, err := json.Marshal(buildInfo) + if err != nil { + panic(fmt.Sprintf("Failed to marshal build info: %v", err)) + } + if options.WriteFile != nil { + err = options.WriteFile(buildInfoFileName, string(text), false, &compiler.WriteFileData{ + BuildInfo: &buildInfo, + }) + } else { + err = h.program.Host().FS().WriteFile(buildInfoFileName, string(text), false) + } + if err != nil { + return &compiler.EmitResult{ + EmitSkipped: true, + Diagnostics: []*ast.Diagnostic{ + ast.NewCompilerDiagnostic(diagnostics.Could_not_write_file_0_Colon_1, buildInfoFileName, err.Error()), + }, + } + } + h.snapshot.buildInfoEmitPending = false + + var emittedFiles []string + if h.snapshot.options.ListEmittedFiles.IsTrue() { + emittedFiles = []string{buildInfoFileName} + } + return &compiler.EmitResult{ + EmitSkipped: false, + EmittedFiles: emittedFiles, + } } -func (p *Program) Emit(ctx context.Context, options compiler.EmitOptions) *compiler.EmitResult { - p.panicIfNoProgram("Emit") - return p.state.emit(ctx, p.program, options) +func (h *Program) ensureHasErrorsForState(ctx context.Context, program *compiler.Program) core.Tristate { + if h.snapshot.hasErrors != core.TSUnknown { + return h.snapshot.hasErrors + } + + // 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 { + semanticDiagnostics := h.snapshot.semanticDiagnosticsPerFile[file.Path()] + if semanticDiagnostics == nil { + // Missing semantic diagnostics in cache will be encoded in incremental buildInfo + return h.snapshot.options.IsIncremental() + } + if len(semanticDiagnostics.diagnostics) > 0 || len(semanticDiagnostics.buildInfoDiagnostics) > 0 { + // cached semantic diagnostics will be encoded in buildInfo + return true + } + if _, ok := h.snapshot.emitDiagnosticsPerFile[file.Path()]; ok { + // emit diagnostics will be encoded in buildInfo; + return true + } + return false + }) { + // Because semantic diagnostics are recorded in buildInfo, we dont need to encode hasErrors in incremental buildInfo + // But encode as errors in non incremental buildInfo + return core.IfElse(h.snapshot.options.IsIncremental(), core.TSFalse, core.TSTrue) + } + if len(program.GetConfigFileParsingDiagnostics()) > 0 || + len(program.GetSyntacticDiagnostics(ctx, nil)) > 0 || + len(program.GetBindDiagnostics(ctx, nil)) > 0 || + len(program.GetOptionsDiagnostics(ctx)) > 0 { + return core.TSTrue + } else { + return core.TSFalse + } } diff --git a/internal/incremental/programstate.go b/internal/incremental/programstate.go deleted file mode 100644 index 7e357c3633..0000000000 --- a/internal/incremental/programstate.go +++ /dev/null @@ -1,1520 +0,0 @@ -package incremental - -import ( - "context" - "crypto/sha256" - "encoding/json" - "fmt" - "maps" - "slices" - "strings" - - "github.com/microsoft/typescript-go/internal/ast" - "github.com/microsoft/typescript-go/internal/checker" - "github.com/microsoft/typescript-go/internal/collections" - "github.com/microsoft/typescript-go/internal/compiler" - "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/tsoptions" - "github.com/microsoft/typescript-go/internal/tspath" -) - -type fileInfo struct { - version string - signature string - affectsGlobalScope bool - impliedNodeFormat core.ResolutionMode -} - -func (f *fileInfo) Version() string { return f.version } -func (f *fileInfo) Signature() string { return f.signature } -func (f *fileInfo) AffectsGlobalScope() bool { return f.affectsGlobalScope } -func (f *fileInfo) ImpliedNodeFormat() core.ResolutionMode { return f.impliedNodeFormat } - -type FileEmitKind uint32 - -const ( - fileEmitKindNone FileEmitKind = 0 - fileEmitKindJs FileEmitKind = 1 << 0 // emit js file - fileEmitKindJsMap FileEmitKind = 1 << 1 // emit js.map file - fileEmitKindJsInlineMap FileEmitKind = 1 << 2 // emit inline source map in js file - fileEmitKindDtsErrors FileEmitKind = 1 << 3 // emit dts errors - fileEmitKindDtsEmit FileEmitKind = 1 << 4 // emit d.ts file - fileEmitKindDtsMap FileEmitKind = 1 << 5 // emit d.ts.map file - - fileEmitKindDts = fileEmitKindDtsErrors | fileEmitKindDtsEmit - fileEmitKindAllJs = fileEmitKindJs | fileEmitKindJsMap | fileEmitKindJsInlineMap - fileEmitKindAllDtsEmit = fileEmitKindDtsEmit | fileEmitKindDtsMap - fileEmitKindAllDts = fileEmitKindDts | fileEmitKindDtsMap - fileEmitKindAll = fileEmitKindAllJs | fileEmitKindAllDts -) - -func (fileEmitKind FileEmitKind) String() string { - var builder strings.Builder - addFlags := func(flags string) { - if builder.Len() == 0 { - builder.WriteString(flags) - } else { - builder.WriteString("|") - builder.WriteString(flags) - } - } - if fileEmitKind != 0 { - if (fileEmitKind & fileEmitKindJs) != 0 { - addFlags("Js") - } - if (fileEmitKind & fileEmitKindJsMap) != 0 { - addFlags("JsMap") - } - if (fileEmitKind & fileEmitKindJsInlineMap) != 0 { - addFlags("JsInlineMap") - } - if (fileEmitKind & fileEmitKindDts) == fileEmitKindDts { - addFlags("Dts") - } else { - if (fileEmitKind & fileEmitKindDtsEmit) != 0 { - addFlags("DtsEmit") - } - if (fileEmitKind & fileEmitKindDtsErrors) != 0 { - addFlags("DtsErrors") - } - } - if (fileEmitKind & fileEmitKindDtsMap) != 0 { - addFlags("DtsMap") - } - } - if builder.Len() != 0 { - return builder.String() - } - return "None" -} - -func GetFileEmitKind(options *core.CompilerOptions) FileEmitKind { - result := fileEmitKindJs - if options.SourceMap.IsTrue() { - result |= fileEmitKindJsMap - } - if options.InlineSourceMap.IsTrue() { - result |= fileEmitKindJsInlineMap - } - if options.GetEmitDeclarations() { - result |= fileEmitKindDts - } - if options.DeclarationMap.IsTrue() { - result |= fileEmitKindDtsMap - } - if options.EmitDeclarationOnly.IsTrue() { - result &= fileEmitKindAllDts - } - return result -} - -func getPendingEmitKindWithOptions(options *core.CompilerOptions, oldOptions *core.CompilerOptions) FileEmitKind { - oldEmitKind := GetFileEmitKind(oldOptions) - newEmitKind := GetFileEmitKind(options) - return getPendingEmitKind(newEmitKind, oldEmitKind) -} - -func getPendingEmitKind(emitKind FileEmitKind, oldEmitKind FileEmitKind) FileEmitKind { - if oldEmitKind == emitKind { - return fileEmitKindNone - } - if oldEmitKind == 0 || emitKind == 0 { - return emitKind - } - diff := oldEmitKind ^ emitKind - result := fileEmitKindNone - // If there is diff in Js emit, pending emit is js emit flags - if (diff & fileEmitKindAllJs) != 0 { - result |= emitKind & fileEmitKindAllJs - } - // If dts errors pending, add dts errors flag - if (diff & fileEmitKindDtsErrors) != 0 { - result |= emitKind & fileEmitKindDtsErrors - } - // If there is diff in Dts emit, pending emit is dts emit flags - if (diff & fileEmitKindAllDtsEmit) != 0 { - result |= emitKind & fileEmitKindAllDtsEmit - } - return result -} - -/** - * Determining what all is pending to be emitted based on previous options or previous file emit flags - * @internal - */ -func getPendingEmitKindWithSeen(emitKind FileEmitKind, seenEmitKind FileEmitKind, options compiler.EmitOptions, isForDtsErrors bool) FileEmitKind { - pendingKind := getPendingEmitKind(emitKind, seenEmitKind) - if options.EmitOnly == compiler.EmitOnlyDts { - pendingKind &= fileEmitKindAllDts - } - if isForDtsErrors { - pendingKind &= fileEmitKindDtsErrors - } - return pendingKind -} - -func getFileEmitKindAllDts(isForDtsErrors bool) FileEmitKind { - return core.IfElse(isForDtsErrors, fileEmitKindDtsErrors, fileEmitKindAllDts) -} - -/** - * Signature (Hash of d.ts emitted), is string if it was emitted using same d.ts.map option as what compilerOptions indicate, - * otherwise tuple of string - */ -type emitSignature struct { - signature string - signatureWithDifferentOptions []string -} - -/** - * Covert to Emit signature based on oldOptions and EmitSignature format - * If d.ts map options differ then swap the format, otherwise use as is - */ -func (e *emitSignature) getNewEmitSignature(oldOptions *core.CompilerOptions, newOptions *core.CompilerOptions) *emitSignature { - if oldOptions.DeclarationMap.IsTrue() == newOptions.DeclarationMap.IsTrue() { - return e - } - if e.signatureWithDifferentOptions == nil { - return &emitSignature{ - signatureWithDifferentOptions: []string{e.signature}, - } - } else { - return &emitSignature{ - signature: e.signatureWithDifferentOptions[0], - } - } -} - -type buildInfoDiagnosticWithFileName struct { - // filename if it is for a File thats other than its stored for - file tspath.Path - noFile bool - pos int - end int - code int32 - category diagnostics.Category - message string - messageChain []*buildInfoDiagnosticWithFileName - relatedInformation []*buildInfoDiagnosticWithFileName - reportsUnnecessary bool - reportsDeprecated bool - skippedOnNoEmit bool -} - -type diagnosticsOrBuildInfoDiagnosticsWithFileName struct { - diagnostics []*ast.Diagnostic - buildInfoDiagnostics []*buildInfoDiagnosticWithFileName -} - -func (b *buildInfoDiagnosticWithFileName) toDiagnostic(p *compiler.Program, file *ast.SourceFile) *ast.Diagnostic { - var fileForDiagnostic *ast.SourceFile - if b.file != "" { - fileForDiagnostic = p.GetSourceFileByPath(b.file) - } else if !b.noFile { - fileForDiagnostic = file - } - var messageChain []*ast.Diagnostic - for _, msg := range b.messageChain { - messageChain = append(messageChain, msg.toDiagnostic(p, fileForDiagnostic)) - } - var relatedInformation []*ast.Diagnostic - for _, info := range b.relatedInformation { - relatedInformation = append(relatedInformation, info.toDiagnostic(p, fileForDiagnostic)) - } - return ast.NewDiagnosticWith( - fileForDiagnostic, - core.NewTextRange(b.pos, b.end), - b.code, - b.category, - b.message, - messageChain, - relatedInformation, - b.reportsUnnecessary, - b.reportsDeprecated, - b.skippedOnNoEmit, - ) -} - -func (d *diagnosticsOrBuildInfoDiagnosticsWithFileName) getDiagnostics(p *compiler.Program, file *ast.SourceFile) []*ast.Diagnostic { - if d.diagnostics != nil { - return d.diagnostics - } - // Convert and cache the diagnostics - d.diagnostics = core.Map(d.buildInfoDiagnostics, func(diag *buildInfoDiagnosticWithFileName) *ast.Diagnostic { - return diag.toDiagnostic(p, file) - }) - return d.diagnostics -} - -type programState struct { - // State that is serialized as buildinfo - /** - * Information of the file eg. its version, signature etc - */ - fileInfos map[tspath.Path]*fileInfo - options *core.CompilerOptions - /** - * Contains the map of ReferencedSet=Referenced files of the file if module emit is enabled - */ - referencedMap *collections.ManyToManyMap[tspath.Path, tspath.Path] - /** - * Cache of bind and check diagnostics for files with their Path being the key - */ - semanticDiagnosticsPerFile map[tspath.Path]*diagnosticsOrBuildInfoDiagnosticsWithFileName - /** Cache of dts emit diagnostics for files with their Path being the key */ - emitDiagnosticsPerFile map[tspath.Path]*diagnosticsOrBuildInfoDiagnosticsWithFileName - /** - * The map has key by source file's path that has been changed - */ - changedFilesSet *collections.Set[tspath.Path] - /** - * Files pending to be emitted - */ - affectedFilesPendingEmit map[tspath.Path]FileEmitKind - /** - * Name of the file whose dts was the latest to change - */ - latestChangedDtsFile string - /** - * Hash of d.ts emitted for the file, use to track when emit of d.ts changes - */ - emitSignatures map[tspath.Path]*emitSignature - /** Recorded if program had errors */ - hasErrors core.Tristate - /** If semantic diagnsotic check is pending */ - checkPending bool - - // Used during incremental updates - /** - * true if file version is used as signature - * This helps in delaying the calculation of the d.ts hash as version for the file till reasonable time - */ - useFileVersionAsSignature bool - /** - * true if build info is emitted - */ - buildInfoEmitPending bool - hasErrorsFromOldState core.Tristate - /** - * True if the semantic diagnostics were copied from the old state - */ - semanticDiagnosticsFromOldState collections.Set[tspath.Path] - /** - * Cache of all files excluding default library file for the current program - */ - allFilesExcludingDefaultLibraryFile []*ast.SourceFile - - // !!! sheetal handle parallel updates and state sanity - /** - * Map of files that have already called update signature. - * That means hence forth these files are assumed to have - * no change in their signature for this version of the program - */ - hasCalledUpdateShapeSignature collections.Set[tspath.Path] - /** - * whether this program has cleaned semantic diagnostics cache for lib files - */ - cleanedDiagnosticsOfLibFiles bool - /** - * Stores signatures before before the update till affected file is committed - */ - oldSignatures map[tspath.Path]string - /** - * Current changed file for iterating over affected files - */ - currentChangedFilePath tspath.Path - /** - * Set of affected files being iterated - */ - affectedFiles []*ast.SourceFile - /** - * Current index to retrieve affected file from - */ - affectedFilesIndex int - /** - * Already seen affected files - */ - seenAffectedFiles collections.Set[tspath.Path] - /** - * Already seen emitted files - */ - seenEmittedFiles map[tspath.Path]FileEmitKind - /** - * Records if change in dts emit was detected - */ - hasChangedEmitSignature bool -} - -func (p *programState) tracksReferences() bool { - return p.options.Module != core.ModuleKindNone -} - -func (p *programState) createReferenceMap() { - if p.tracksReferences() { - p.referencedMap = &collections.ManyToManyMap[tspath.Path, tspath.Path]{} - } -} - -func (p *programState) createEmitSignaturesMap() { - if p.emitSignatures == nil && p.options.Composite.IsTrue() { - p.emitSignatures = make(map[tspath.Path]*emitSignature) - } -} - -func (p *programState) addFileToChangeSet(filePath tspath.Path) { - p.changedFilesSet.Add(filePath) - p.buildInfoEmitPending = true -} - -func (p *programState) addFileToAffectedFilesPendingEmit(filePath tspath.Path, emitKind FileEmitKind) { - existingKind := p.affectedFilesPendingEmit[filePath] - - if p.affectedFilesPendingEmit == nil { - p.affectedFilesPendingEmit = make(map[tspath.Path]FileEmitKind) - } - p.affectedFilesPendingEmit[filePath] = existingKind | emitKind - delete(p.emitDiagnosticsPerFile, filePath) -} - -func (p *programState) getAllFilesExcludingDefaultLibraryFile(program *compiler.Program, firstSourceFile *ast.SourceFile) []*ast.SourceFile { - // Use cached result - if p.allFilesExcludingDefaultLibraryFile != nil { - return p.allFilesExcludingDefaultLibraryFile - } - - files := program.GetSourceFiles() - p.allFilesExcludingDefaultLibraryFile = make([]*ast.SourceFile, 0, len(files)) - addSourceFile := func(file *ast.SourceFile) { - if !program.IsSourceFileDefaultLibrary(file.Path()) { - p.allFilesExcludingDefaultLibraryFile = append(p.allFilesExcludingDefaultLibraryFile, file) - } - } - if firstSourceFile != nil { - addSourceFile(firstSourceFile) - } - for _, file := range files { - if file != firstSourceFile { - addSourceFile(file) - } - } - return p.allFilesExcludingDefaultLibraryFile -} - -func (p *programState) emit(ctx context.Context, program *compiler.Program, options compiler.EmitOptions) *compiler.EmitResult { - if result := compiler.HandleNoEmitOptions(ctx, program, options.TargetSourceFile); result != nil { - if options.TargetSourceFile != nil { - return result - } - - // Emit buildInfo and combine result - buildInfoResult := p.emitBuildInfo(ctx, program, options) - if buildInfoResult != nil && buildInfoResult.EmittedFiles != nil { - result.Diagnostics = append(result.Diagnostics, buildInfoResult.Diagnostics...) - result.EmittedFiles = append(result.EmittedFiles, buildInfoResult.EmittedFiles...) - } - return result - } - - // Emit only affected files if using builder for emit - if options.TargetSourceFile != nil { - return program.Emit(ctx, p.getEmitOptions(program, options)) - } - - var results []*compiler.EmitResult - for { - affectedEmitResult, done := p.emitNextAffectedFile(ctx, program, options, false) - if done { - break - } - results = append(results, affectedEmitResult) - } - return compiler.CombineEmitResults(results) -} - -func (p *programState) getDeclarationDiagnostics(ctx context.Context, program *compiler.Program, file *ast.SourceFile) []*ast.Diagnostic { - var diagnostics []*ast.Diagnostic - for { - affectedEmitResult, done := p.emitNextAffectedFile(ctx, program, compiler.EmitOptions{}, true) - if done { - break - } - if file == nil { - diagnostics = append(diagnostics, affectedEmitResult.Diagnostics...) - } - } - if file == nil { - return diagnostics - } - if emitDiagnostics, ok := p.emitDiagnosticsPerFile[file.Path()]; ok { - // If diagnostics are present for the file, return them - return emitDiagnostics.getDiagnostics(program, file) - } - return nil -} - -/** - * Emits the next affected file's emit result (EmitResult and sourceFiles emitted) or returns undefined if iteration is complete - * The first of writeFile if provided, writeFile of BuilderProgramHost if provided, writeFile of compiler host - * in that order would be used to write the files - */ -func (p *programState) emitNextAffectedFile(ctx context.Context, program *compiler.Program, options compiler.EmitOptions, isForDtsErrors bool) (*compiler.EmitResult, bool) { - affected := p.getNextAffectedFile(ctx, program) - programEmitKind := GetFileEmitKind(p.options) - var emitKind FileEmitKind - if affected == nil { - // file pending emit - pendingAffectedFile, pendingEmitKind := p.getNextAffectedFilePendingEmit(program, options, isForDtsErrors) - if pendingAffectedFile != nil { - affected = pendingAffectedFile - emitKind = pendingEmitKind - } else { - // File whose diagnostics need to be reported - affectedFile, pendingDiagnostics, seenKind := p.getNextPendingEmitDiagnosticsFile(program, isForDtsErrors) - if affectedFile != nil { - p.seenEmittedFiles[affectedFile.Path()] = seenKind | getFileEmitKindAllDts(isForDtsErrors) - return &compiler.EmitResult{ - EmitSkipped: true, - Diagnostics: pendingDiagnostics.getDiagnostics(program, affectedFile), - }, false - } - } - if affected == nil { - // Emit buildinfo if pending - if isForDtsErrors { - return nil, true - } - result := p.emitBuildInfo(ctx, program, options) - if result != nil { - return result, false - } - return nil, true - } - } else { - if isForDtsErrors { - emitKind = fileEmitKindDtsErrors - } else if options.EmitOnly == compiler.EmitOnlyDts { - emitKind = programEmitKind & fileEmitKindAllDts - } else { - emitKind = programEmitKind - } - } - // Determine if we can do partial emit - var emitOnly compiler.EmitOnly - if (emitKind & fileEmitKindAllJs) != 0 { - emitOnly = compiler.EmitOnlyJs - } - if (emitKind & fileEmitKindAllDts) != 0 { - if emitOnly == compiler.EmitOnlyJs { - emitOnly = compiler.EmitAll - } else { - emitOnly = compiler.EmitOnlyDts - } - } - // // Actual emit without buildInfo as we want to emit it later so the state is updated - var result *compiler.EmitResult - if !isForDtsErrors { - result = program.Emit(ctx, p.getEmitOptions(program, compiler.EmitOptions{ - TargetSourceFile: affected, - EmitOnly: emitOnly, - WriteFile: options.WriteFile, - })) - } else { - result = &compiler.EmitResult{ - EmitSkipped: true, - Diagnostics: program.GetDeclarationDiagnostics(ctx, affected), - } - } - - // update affected files - p.seenAffectedFiles.Add(affected.Path()) - p.affectedFilesIndex++ - // Change in changeSet/affectedFilesPendingEmit, buildInfo needs to be emitted - p.buildInfoEmitPending = true - // Update the pendingEmit for the file - existing := p.seenEmittedFiles[affected.Path()] - p.seenEmittedFiles[affected.Path()] = emitKind | existing - existingPending, ok := p.affectedFilesPendingEmit[affected.Path()] - if !ok { - existingPending = programEmitKind - } - pendingKind := getPendingEmitKind(existingPending, emitKind|existing) - if pendingKind != 0 { - p.affectedFilesPendingEmit[affected.Path()] = pendingKind - } else { - delete(p.affectedFilesPendingEmit, affected.Path()) - } - if len(result.Diagnostics) != 0 { - if p.emitDiagnosticsPerFile == nil { - p.emitDiagnosticsPerFile = make(map[tspath.Path]*diagnosticsOrBuildInfoDiagnosticsWithFileName) - } - p.emitDiagnosticsPerFile[affected.Path()] = &diagnosticsOrBuildInfoDiagnosticsWithFileName{ - diagnostics: result.Diagnostics, - } - } - return result, false -} - -/** - * Returns next file to be emitted from files that retrieved semantic diagnostics but did not emit yet - */ -func (p *programState) getNextAffectedFilePendingEmit(program *compiler.Program, options compiler.EmitOptions, isForDtsErrors bool) (*ast.SourceFile, FileEmitKind) { - if len(p.affectedFilesPendingEmit) == 0 { - return nil, 0 - } - for path, emitKind := range p.affectedFilesPendingEmit { - affectedFile := program.GetSourceFileByPath(path) - if affectedFile == nil || !program.SourceFileMayBeEmitted(affectedFile, false) { - delete(p.affectedFilesPendingEmit, path) - continue - } - seenKind := p.seenEmittedFiles[affectedFile.Path()] - pendingKind := getPendingEmitKindWithSeen(emitKind, seenKind, options, isForDtsErrors) - if pendingKind != 0 { - return affectedFile, pendingKind - } - } - return nil, 0 -} - -func (p *programState) getNextPendingEmitDiagnosticsFile(program *compiler.Program, isForDtsErrors bool) (*ast.SourceFile, *diagnosticsOrBuildInfoDiagnosticsWithFileName, FileEmitKind) { - if len(p.emitDiagnosticsPerFile) == 0 { - return nil, nil, 0 - } - for path, diagnostics := range p.emitDiagnosticsPerFile { - affectedFile := program.GetSourceFileByPath(path) - if affectedFile == nil || !program.SourceFileMayBeEmitted(affectedFile, false) { - delete(p.emitDiagnosticsPerFile, path) - continue - } - seenKind := p.seenEmittedFiles[affectedFile.Path()] - if (seenKind & getFileEmitKindAllDts(isForDtsErrors)) != 0 { - return affectedFile, diagnostics, seenKind - } - } - return nil, nil, 0 -} - -func (p *programState) getEmitOptions(program *compiler.Program, options compiler.EmitOptions) compiler.EmitOptions { - if !p.options.GetEmitDeclarations() { - return options - } - return compiler.EmitOptions{ - TargetSourceFile: options.TargetSourceFile, - EmitOnly: options.EmitOnly, - WriteFile: func(fileName string, text string, writeByteOrderMark bool, data *compiler.WriteFileData) error { - if tspath.IsDeclarationFileName(fileName) { - var emitSignature string - info := p.fileInfos[options.TargetSourceFile.Path()] - if info.signature == info.version { - signature := computeSignatureWithDiagnostics(options.TargetSourceFile, text, data) - // With d.ts diagnostics they are also part of the signature so emitSignature will be different from it since its just hash of d.ts - if len(data.Diagnostics) == 0 { - emitSignature = signature - } - if signature != info.version { // Update it - if p.affectedFiles != nil { - // Keep old signature so we know what to undo if cancellation happens - if _, ok := p.oldSignatures[options.TargetSourceFile.Path()]; !ok { - if p.oldSignatures == nil { - p.oldSignatures = make(map[tspath.Path]string) - } - p.oldSignatures[options.TargetSourceFile.Path()] = info.signature - } - } - info.signature = signature - } - } - - // Store d.ts emit hash so later can be compared to check if d.ts has changed. - // Currently we do this only for composite projects since these are the only projects that can be referenced by other projects - // and would need their d.ts change time in --build mode - if p.skipDtsOutputOfComposite(program, options.TargetSourceFile, fileName, text, data, emitSignature) { - return nil - } - } - - if options.WriteFile != nil { - return options.WriteFile(fileName, text, writeByteOrderMark, data) - } - return program.Host().FS().WriteFile(fileName, text, writeByteOrderMark) - }, - } -} - -/** - * Compare to existing computed signature and store it or handle the changes in d.ts map option from before - * returning undefined means that, we dont need to emit this d.ts file since its contents didnt change - */ -func (p *programState) skipDtsOutputOfComposite(program *compiler.Program, file *ast.SourceFile, outputFileName string, text string, data *compiler.WriteFileData, newSignature string) bool { - if !p.options.Composite.IsTrue() { - return false - } - var oldSignature string - oldSignatureFormat, ok := p.emitSignatures[file.Path()] - if ok { - if oldSignatureFormat.signature != "" { - oldSignature = oldSignatureFormat.signature - } else { - oldSignature = oldSignatureFormat.signatureWithDifferentOptions[0] - } - } - if newSignature == "" { - newSignature = computeHash(getTextHandlingSourceMapForSignature(text, data)) - } - // Dont write dts files if they didn't change - if newSignature == oldSignature { - // If the signature was encoded as string the dts map options match so nothing to do - if oldSignatureFormat != nil && oldSignatureFormat.signature == oldSignature { - data.SkippedDtsWrite = true - return true - } else { - // Mark as differsOnlyInMap so that --build can reverse the timestamp so that - // the downstream projects dont detect this as change in d.ts file - data.DiffersOnlyInMap = true - } - } else { - p.hasChangedEmitSignature = true - p.latestChangedDtsFile = outputFileName - } - if p.emitSignatures == nil { - p.emitSignatures = make(map[tspath.Path]*emitSignature) - } - p.emitSignatures[file.Path()] = &emitSignature{ - signature: newSignature, - } - return false -} - -func (p *programState) emitBuildInfo(ctx context.Context, program *compiler.Program, options compiler.EmitOptions) *compiler.EmitResult { - buildInfoFileName := outputpaths.GetBuildInfoFileName(p.options, tspath.ComparePathsOptions{ - CurrentDirectory: program.GetCurrentDirectory(), - UseCaseSensitiveFileNames: program.UseCaseSensitiveFileNames(), - }) - if buildInfoFileName == "" { - return nil - } - - p.ensureHasErrorsForState(ctx, program) - if !p.buildInfoEmitPending && p.hasErrorsFromOldState == p.hasErrors { - return nil - } - p.buildInfoEmitPending = false - p.hasErrorsFromOldState = p.hasErrors - buildInfo := programStateToBuildInfo(p, program, buildInfoFileName) - text, err := json.Marshal(buildInfo) - if err != nil { - panic(fmt.Sprintf("Failed to marshal build info: %v", err)) - } - if options.WriteFile != nil { - err = options.WriteFile(buildInfoFileName, string(text), false, &compiler.WriteFileData{ - BuildInfo: &buildInfo, - }) - } else { - err = program.Host().FS().WriteFile(buildInfoFileName, string(text), false) - } - if err != nil { - return &compiler.EmitResult{ - EmitSkipped: true, - Diagnostics: []*ast.Diagnostic{ - ast.NewCompilerDiagnostic(diagnostics.Could_not_write_file_0_Colon_1, buildInfoFileName, err.Error()), - }, - } - } - var emittedFiles []string - if p.options.ListEmittedFiles.IsTrue() { - emittedFiles = []string{buildInfoFileName} - } - return &compiler.EmitResult{ - EmitSkipped: false, - EmittedFiles: emittedFiles, - } -} - -func (p *programState) ensureHasErrorsForState(ctx context.Context, program *compiler.Program) { - if p.hasErrors != core.TSUnknown { - return - } - - // 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 { - semanticDiagnostics := p.semanticDiagnosticsPerFile[file.Path()] - if semanticDiagnostics == nil { - // Missing semantic diagnostics in cache will be encoded in incremental buildInfo - return p.options.IsIncremental() - } - if len(semanticDiagnostics.diagnostics) > 0 || len(semanticDiagnostics.buildInfoDiagnostics) > 0 { - // cached semantic diagnostics will be encoded in buildInfo - return true - } - if _, ok := p.emitDiagnosticsPerFile[file.Path()]; ok { - // emit diagnostics will be encoded in buildInfo; - return true - } - return false - }) { - // Because semantic diagnostics are recorded in buildInfo, we dont need to encode hasErrors in incremental buildInfo - // But encode as errors in non incremental buildInfo - p.hasErrors = core.IfElse(p.options.IsIncremental(), core.TSFalse, core.TSTrue) - return - } - if len(program.GetConfigFileParsingDiagnostics()) > 0 || - len(program.GetSyntacticDiagnostics(ctx, nil)) > 0 || - len(program.GetBindDiagnostics(ctx, nil)) > 0 || - len(program.GetOptionsDiagnostics(ctx)) > 0 { - p.hasErrors = core.TSTrue - } else { - p.hasErrors = core.TSFalse - } -} - -func (p *programState) getSemanticDiagnostics(ctx context.Context, program *compiler.Program, file *ast.SourceFile) []*ast.Diagnostic { - if file != nil { - return p.getSemanticDiagnosticsOfFile(ctx, program, file) - } - - for { - _, done := p.getSemanticDiagnosticsOfNextAffectedFile(ctx, program) - if done { - break - } - } - - var diagnostics []*ast.Diagnostic - for _, file := range program.GetSourceFiles() { - diagnostics = append(diagnostics, p.getSemanticDiagnosticsOfFile(ctx, program, file)...) - } - if p.checkPending && !p.options.NoCheck.IsTrue() { - p.checkPending = false - p.buildInfoEmitPending = true - } - return diagnostics -} - -/* -* Gets the semantic diagnostics either from cache if present, or otherwise from program and caches it -* Note that it is assumed that when asked about checker diagnostics, the file has been taken out of affected files/changed file set - */ -func (p *programState) getSemanticDiagnosticsOfFile(ctx context.Context, program *compiler.Program, file *ast.SourceFile) []*ast.Diagnostic { - if p.options.NoCheck.IsTrue() { - return nil - } - - // !!! this is different from strada where we were adding program diagnostics but - // but with blank slate it would be good to call that directly instead of unnecessarily concatenating - - // Report the check diagnostics from the cache if we already have those diagnostics present - if cachedDiagnostics, ok := p.semanticDiagnosticsPerFile[file.Path()]; ok { - return compiler.FilterNoEmitSemanticDiagnostics(cachedDiagnostics.getDiagnostics(program, file), p.options) - } - - // Diagnostics werent cached, get them from program, and cache the result - diagnostics := program.GetSemanticDiagnostics(ctx, file) - p.semanticDiagnosticsPerFile[file.Path()] = &diagnosticsOrBuildInfoDiagnosticsWithFileName{diagnostics: diagnostics} - p.buildInfoEmitPending = true - return compiler.FilterNoEmitSemanticDiagnostics(diagnostics, p.options) -} - -/** - * Return the semantic diagnostics for the next affected file, done if iteration is complete - */ -func (p *programState) getSemanticDiagnosticsOfNextAffectedFile(ctx context.Context, program *compiler.Program) ([]*ast.Diagnostic, bool) { - for { - affected := p.getNextAffectedFile(ctx, program) - if affected == nil { - if p.checkPending && !p.options.NoCheck.IsTrue() { - p.checkPending = false - p.buildInfoEmitPending = true - } - return nil, true - } - // Get diagnostics for the affected file if its not ignored - result := p.getSemanticDiagnosticsOfFile(ctx, program, affected) - p.seenAffectedFiles.Add(affected.Path()) - p.affectedFilesIndex++ - p.buildInfoEmitPending = true - if result == nil { - continue - } - return result, false - } -} - -/** - * This function returns the next affected file to be processed. - * Note that until doneAffected is called it would keep reporting same result - * This is to allow the callers to be able to actually remove affected file only when the operation is complete - * eg. if during diagnostics check cancellation token ends up cancelling the request, the affected file should be retained - */ -func (p *programState) getNextAffectedFile(ctx context.Context, program *compiler.Program) *ast.SourceFile { - for { - if p.affectedFiles != nil { - for p.affectedFilesIndex < len(p.affectedFiles) { - affectedFile := p.affectedFiles[p.affectedFilesIndex] - if !p.seenAffectedFiles.Has(affectedFile.Path()) { - // Set the next affected file as seen and remove the cached semantic diagnostics - p.addFileToAffectedFilesPendingEmit(affectedFile.Path(), GetFileEmitKind(p.options)) - p.handleDtsMayChangeOfAffectedFile(ctx, program, affectedFile) - return affectedFile - } - p.affectedFilesIndex++ - } - - // Remove the changed file from the change set - p.changedFilesSet.Delete(p.currentChangedFilePath) - p.currentChangedFilePath = "" - // Commit the changes in file signature - p.oldSignatures = nil - p.affectedFiles = nil - } - - // Get next changed file - var file tspath.Path - for file = range p.changedFilesSet.Keys() { - // Get next batch of affected files - p.affectedFiles = p.getFilesAffectedBy(ctx, program, file) - p.currentChangedFilePath = file - p.affectedFilesIndex = 0 - break - } - - // Done if there are no more changed files - if file == "" { - return nil - } - } -} - -func (p *programState) getFilesAffectedBy(ctx context.Context, program *compiler.Program, path tspath.Path) []*ast.SourceFile { - file := program.GetSourceFileByPath(path) - if file == nil { - return nil - } - - if !p.updateShapeSignature(ctx, program, file, p.useFileVersionAsSignature) { - return []*ast.SourceFile{file} - } - - if !p.tracksReferences() { - return p.getAllFilesExcludingDefaultLibraryFile(program, file) - } - - if info := p.fileInfos[file.Path()]; info.affectsGlobalScope { - p.getAllFilesExcludingDefaultLibraryFile(program, file) - } - - if p.options.IsolatedModules.IsTrue() { - return []*ast.SourceFile{file} - } - - // Now we need to if each file in the referencedBy list has a shape change as well. - // Because if so, its own referencedBy files need to be saved as well to make the - // emitting result consistent with files on disk. - seenFileNamesMap := p.forEachFileReferencedBy( - program, - file, - func(currentFile *ast.SourceFile, currentPath tspath.Path) (queueForFile bool, fastReturn bool) { - // If the current file is not nil and has a shape change, we need to queue it for processing - if currentFile != nil && p.updateShapeSignature(ctx, program, currentFile, p.useFileVersionAsSignature) { - return true, false - } - return false, false - }, - ) - // Return array of values that needs emit - return core.Filter(slices.Collect(maps.Values(seenFileNamesMap)), func(file *ast.SourceFile) bool { - return file != nil - }) -} - -func (p *programState) forEachFileReferencedBy( - program *compiler.Program, - file *ast.SourceFile, - fn func(currentFile *ast.SourceFile, currentPath tspath.Path) (queueForFile bool, fastReturn bool), -) map[tspath.Path]*ast.SourceFile { - // Now we need to if each file in the referencedBy list has a shape change as well. - // Because if so, its own referencedBy files need to be saved as well to make the - // emitting result consistent with files on disk. - seenFileNamesMap := map[tspath.Path]*ast.SourceFile{} - // Start with the paths this file was referenced by - seenFileNamesMap[file.Path()] = file - references := p.getReferencedByPaths(file.Path()) - queue := slices.Collect(maps.Keys(references)) - for len(queue) > 0 { - currentPath := queue[len(queue)-1] - queue = queue[:len(queue)-1] - if _, ok := seenFileNamesMap[currentPath]; !ok { - currentFile := program.GetSourceFileByPath(currentPath) - seenFileNamesMap[currentPath] = currentFile - queueForFile, fastReturn := fn(currentFile, currentPath) - if fastReturn { - return seenFileNamesMap - } - if queueForFile { - for ref := range p.getReferencedByPaths(currentFile.Path()) { - queue = append(queue, ref) - } - } - } - } - return seenFileNamesMap -} - -/** - * Gets the files referenced by the the file path - */ -func (p *programState) getReferencedByPaths(file tspath.Path) map[tspath.Path]struct{} { - keys, ok := p.referencedMap.GetKeys(file) - if !ok { - return nil - } - return keys.Keys() -} - -func (p *programState) updateShapeSignature(ctx context.Context, program *compiler.Program, file *ast.SourceFile, useFileVersionAsSignature bool) bool { - // If we have cached the result for this file, that means hence forth we should assume file shape is uptodate - if p.hasCalledUpdateShapeSignature.Has(file.Path()) { - return false - } - - info := p.fileInfos[file.Path()] - prevSignature := info.signature - var latestSignature string - if !file.IsDeclarationFile && !useFileVersionAsSignature { - latestSignature = p.computeDtsSignature(ctx, program, file) - } - // Default is to use file version as signature - if latestSignature == "" { - latestSignature = info.version - } - if p.oldSignatures == nil { - p.oldSignatures = make(map[tspath.Path]string) - } - p.oldSignatures[file.Path()] = prevSignature - p.hasCalledUpdateShapeSignature.Add(file.Path()) - info.signature = latestSignature - return latestSignature != prevSignature -} - -func (p *programState) computeDtsSignature(ctx context.Context, program *compiler.Program, file *ast.SourceFile) string { - var signature string - program.Emit(ctx, compiler.EmitOptions{ - TargetSourceFile: file, - EmitOnly: compiler.EmitOnlyForcedDts, - WriteFile: func(fileName string, text string, writeByteOrderMark bool, data *compiler.WriteFileData) error { - if !tspath.IsDeclarationFileName(fileName) { - panic("File extension for signature expected to be dts, got : " + fileName) - } - signature = computeSignatureWithDiagnostics(file, text, data) - return nil - }, - }) - return signature -} - -func (p *programState) isChangedSignature(path tspath.Path) bool { - oldSignature := p.oldSignatures[path] - newSignature := p.fileInfos[path].signature - return newSignature != oldSignature -} - -/** - * Removes semantic diagnostics for path and - * returns true if there are no more semantic diagnostics from the old state - */ -func (p *programState) removeSemanticDiagnosticsOf(path tspath.Path) { - if p.semanticDiagnosticsFromOldState.Has(path) { - p.semanticDiagnosticsFromOldState.Delete(path) - delete(p.semanticDiagnosticsPerFile, path) - } -} - -func (p *programState) removeDiagnosticsOfLibraryFiles(program *compiler.Program) { - if !p.cleanedDiagnosticsOfLibFiles { - p.cleanedDiagnosticsOfLibFiles = true - for _, file := range program.GetSourceFiles() { - if program.IsSourceFileDefaultLibrary(file.Path()) && !checker.SkipTypeChecking(file, p.options, program, true) { - p.removeSemanticDiagnosticsOf(file.Path()) - } - } - } -} - -/** - * Handles semantic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file - * This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change - */ -func (p *programState) handleDtsMayChangeOfAffectedFile(ctx context.Context, program *compiler.Program, affectedFile *ast.SourceFile) { - p.removeSemanticDiagnosticsOf(affectedFile.Path()) - - // If affected files is everything except default library, then nothing more to do - if slices.Equal(p.allFilesExcludingDefaultLibraryFile, p.affectedFiles) { - p.removeDiagnosticsOfLibraryFiles(program) - // When a change affects the global scope, all files are considered to be affected without updating their signature - // That means when affected file is handled, its signature can be out of date - // To avoid this, ensure that we update the signature for any affected file in this scenario. - p.updateShapeSignature(ctx, program, affectedFile, p.useFileVersionAsSignature) - return - } - - if p.options.AssumeChangesOnlyAffectDirectDependencies.IsTrue() { - return - } - - // Iterate on referencing modules that export entities from affected file and delete diagnostics and add pending emit - // If there was change in signature (dts output) for the changed file, - // then only we need to handle pending file emit - if !p.tracksReferences() || - !p.changedFilesSet.Has(affectedFile.Path()) || - !p.isChangedSignature(affectedFile.Path()) { - return - } - - // Since isolated modules dont change js files, files affected by change in signature is itself - // But we need to cleanup semantic diagnostics and queue dts emit for affected files - if p.options.IsolatedModules.IsTrue() { - p.forEachFileReferencedBy( - program, - affectedFile, - func(currentFile *ast.SourceFile, currentPath tspath.Path) (queueForFile bool, fastReturn bool) { - if p.handleDtsMayChangeOfGlobalScope(ctx, program, currentPath /*invalidateJsFiles*/, false) { - return false, true - } - p.handleDtsMayChangeOf(ctx, program, currentPath /*invalidateJsFiles*/, false) - if p.isChangedSignature(currentPath) { - return true, false - } - return false, false - }, - ) - } - - seenFileAndExportsOfFile := collections.Set[tspath.Path]{} - invalidateJsFiles := false - var typeChecker *checker.Checker - var done func() - // If exported const enum, we need to ensure that js files are emitted as well since the const enum value changed - if affectedFile.Symbol != nil { - for _, exported := range affectedFile.Symbol.Exports { - if exported.Flags&ast.SymbolFlagsConstEnum != 0 { - invalidateJsFiles = true - break - } - if typeChecker == nil { - typeChecker, done = program.GetTypeCheckerForFile(ctx, affectedFile) - } - aliased := checker.SkipAlias(exported, typeChecker) - if aliased == exported { - continue - } - if (aliased.Flags & ast.SymbolFlagsConstEnum) != 0 { - if slices.ContainsFunc(aliased.Declarations, func(d *ast.Node) bool { - return ast.GetSourceFileOfNode(d) == affectedFile - }) { - invalidateJsFiles = true - break - } - } - } - } - if done != nil { - done() - } - - // Go through files that reference affected file and handle dts emit and semantic diagnostics for them and their references - if keys, ok := p.referencedMap.GetKeys(affectedFile.Path()); ok { - for exportedFromPath := range keys.Keys() { - if p.handleDtsMayChangeOfGlobalScope(ctx, program, exportedFromPath, invalidateJsFiles) { - return - } - if references, ok := p.referencedMap.GetKeys(exportedFromPath); ok { - for filePath := range references.Keys() { - if p.handleDtsMayChangeOfFileAndExportsOfFile(ctx, program, filePath, invalidateJsFiles, &seenFileAndExportsOfFile) { - return - } - } - } - } - } -} - -/** - * handle dts and semantic diagnostics on file and iterate on anything that exports this file - * return true when all work is done and we can exit handling dts emit and semantic diagnostics - */ -func (p *programState) handleDtsMayChangeOfFileAndExportsOfFile(ctx context.Context, program *compiler.Program, filePath tspath.Path, invalidateJsFiles bool, seenFileAndExportsOfFile *collections.Set[tspath.Path]) bool { - if seenFileAndExportsOfFile.AddIfAbsent(filePath) == false { - return false - } - if p.handleDtsMayChangeOfGlobalScope(ctx, program, filePath, invalidateJsFiles) { - return true - } - p.handleDtsMayChangeOf(ctx, program, filePath, invalidateJsFiles) - - // Remove the diagnostics of files that import this file and handle all its exports too - if keys, ok := p.referencedMap.GetKeys(filePath); ok { - for referencingFilePath := range keys.Keys() { - if p.handleDtsMayChangeOfFileAndExportsOfFile(ctx, program, referencingFilePath, invalidateJsFiles, seenFileAndExportsOfFile) { - return true - } - } - } - return false -} - -func (p *programState) handleDtsMayChangeOfGlobalScope(ctx context.Context, program *compiler.Program, filePath tspath.Path, invalidateJsFiles bool) bool { - if info, ok := p.fileInfos[filePath]; !ok || !info.affectsGlobalScope { - return false - } - // Every file needs to be handled - for _, file := range p.getAllFilesExcludingDefaultLibraryFile(program, nil) { - p.handleDtsMayChangeOf(ctx, program, file.Path(), invalidateJsFiles) - } - p.removeDiagnosticsOfLibraryFiles(program) - return true -} - -/** - * Handle the dts may change, so they need to be added to pending emit if dts emit is enabled, - * Also we need to make sure signature is updated for these files - */ -func (p *programState) handleDtsMayChangeOf(ctx context.Context, program *compiler.Program, path tspath.Path, invalidateJsFiles bool) { - p.removeSemanticDiagnosticsOf(path) - if p.changedFilesSet.Has(path) { - return - } - file := program.GetSourceFileByPath(path) - if file == nil { - return - } - // Even though the js emit doesnt change and we are already handling dts emit and semantic diagnostics - // we need to update the signature to reflect correctness of the signature(which is output d.ts emit) of this file - // This ensures that we dont later during incremental builds considering wrong signature. - // Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build - // But we avoid expensive full shape computation, as using file version as shape is enough for correctness. - p.updateShapeSignature(ctx, program, file, true) - // If not dts emit, nothing more to do - if invalidateJsFiles { - p.addFileToAffectedFilesPendingEmit(path, GetFileEmitKind(p.options)) - } else if p.options.GetEmitDeclarations() { - p.addFileToAffectedFilesPendingEmit(path, core.IfElse(p.options.DeclarationMap.IsTrue(), fileEmitKindAllDts, fileEmitKindDts)) - } -} - -func newProgramState(program *compiler.Program, oldProgram *Program) *programState { - if oldProgram != nil && oldProgram.program == program { - return oldProgram.state - } - files := program.GetSourceFiles() - state := &programState{ - options: program.Options(), - semanticDiagnosticsPerFile: make(map[tspath.Path]*diagnosticsOrBuildInfoDiagnosticsWithFileName, len(files)), - seenEmittedFiles: make(map[tspath.Path]FileEmitKind, len(files)), - } - state.createReferenceMap() - if oldProgram != nil && state.options.Composite.IsTrue() { - state.latestChangedDtsFile = oldProgram.state.latestChangedDtsFile - } - if state.options.NoCheck.IsTrue() { - state.checkPending = true - } - - canUseStateFromOldProgram := oldProgram != nil && state.tracksReferences() == oldProgram.state.tracksReferences() - if canUseStateFromOldProgram { - // Copy old state's changed files set - state.changedFilesSet = oldProgram.state.changedFilesSet.Clone() - if len(oldProgram.state.affectedFilesPendingEmit) != 0 { - state.affectedFilesPendingEmit = maps.Clone(oldProgram.state.affectedFilesPendingEmit) - } - state.hasErrorsFromOldState = oldProgram.state.hasErrors - } else { - state.changedFilesSet = &collections.Set[tspath.Path]{} - state.useFileVersionAsSignature = true - state.buildInfoEmitPending = state.options.IsIncremental() - } - - canCopySemanticDiagnostics := canUseStateFromOldProgram && - !tsoptions.CompilerOptionsAffectSemanticDiagnostics(oldProgram.state.options, program.Options()) - // // We can only reuse emit signatures (i.e. .d.ts signatures) if the .d.ts file is unchanged, - // // which will eg be depedent on change in options like declarationDir and outDir options are unchanged. - // // We need to look in oldState.compilerOptions, rather than oldCompilerOptions (i.e.we need to disregard useOldState) because - // // oldCompilerOptions can be undefined if there was change in say module from None to some other option - // // which would make useOldState as false since we can now use reference maps that are needed to track what to emit, what to check etc - // // but that option change does not affect d.ts file name so emitSignatures should still be reused. - canCopyEmitSignatures := state.options.Composite.IsTrue() && - oldProgram != nil && - oldProgram.state.emitSignatures != nil && - !tsoptions.CompilerOptionsAffectDeclarationPath(oldProgram.state.options, program.Options()) - copyDeclarationFileDiagnostics := canCopySemanticDiagnostics && - state.options.SkipLibCheck.IsTrue() == oldProgram.state.options.SkipLibCheck.IsTrue() - copyLibFileDiagnostics := copyDeclarationFileDiagnostics && - state.options.SkipDefaultLibCheck.IsTrue() == oldProgram.state.options.SkipDefaultLibCheck.IsTrue() - state.fileInfos = make(map[tspath.Path]*fileInfo, len(files)) - for _, file := range files { - version := computeHash(file.Text()) - impliedNodeFormat := program.GetSourceFileMetaData(file.Path()).ImpliedNodeFormat - affectsGlobalScope := fileAffectsGlobalScope(file) - var signature string - if canUseStateFromOldProgram { - var hasOldUncommitedSignature bool - signature, hasOldUncommitedSignature = oldProgram.state.oldSignatures[file.Path()] - if oldFileInfo, ok := oldProgram.state.fileInfos[file.Path()]; ok { - if !hasOldUncommitedSignature { - signature = oldFileInfo.signature - } - if oldFileInfo.version == version || oldFileInfo.affectsGlobalScope != affectsGlobalScope || oldFileInfo.impliedNodeFormat != impliedNodeFormat { - state.addFileToChangeSet(file.Path()) - } - } else { - state.addFileToChangeSet(file.Path()) - } - if state.referencedMap != nil { - newReferences := getReferencedFiles(program, file) - if newReferences != nil { - state.referencedMap.Add(file.Path(), newReferences) - } - oldReferences, _ := oldProgram.state.referencedMap.GetValues(file.Path()) - // Referenced files changed - if !newReferences.Equals(oldReferences) { - state.addFileToChangeSet(file.Path()) - } else { - for refPath := range newReferences.Keys() { - if program.GetSourceFileByPath(refPath) == nil { - // Referenced file was deleted in the new program - state.addFileToChangeSet(file.Path()) - break - } - } - } - } - if !state.changedFilesSet.Has(file.Path()) { - if emitDiagnostics, ok := oldProgram.state.emitDiagnosticsPerFile[file.Path()]; ok { - if state.emitDiagnosticsPerFile == nil { - state.emitDiagnosticsPerFile = make(map[tspath.Path]*diagnosticsOrBuildInfoDiagnosticsWithFileName, len(files)) - } - state.emitDiagnosticsPerFile[file.Path()] = emitDiagnostics - } - if canCopySemanticDiagnostics { - if (!file.IsDeclarationFile || copyDeclarationFileDiagnostics) && - (!program.IsSourceFileDefaultLibrary(file.Path()) || copyLibFileDiagnostics) { - // Unchanged file copy diagnostics - if diagnostics, ok := oldProgram.state.semanticDiagnosticsPerFile[file.Path()]; ok { - state.semanticDiagnosticsPerFile[file.Path()] = diagnostics - state.semanticDiagnosticsFromOldState.Add(file.Path()) - } - } - } - } - if canCopyEmitSignatures { - if oldEmitSignature, ok := oldProgram.state.emitSignatures[file.Path()]; ok { - state.createEmitSignaturesMap() - state.emitSignatures[file.Path()] = oldEmitSignature.getNewEmitSignature(oldProgram.state.options, state.options) - } - } - } else { - state.addFileToChangeSet(file.Path()) - } - state.fileInfos[file.Path()] = &fileInfo{ - version: version, - signature: signature, - affectsGlobalScope: affectsGlobalScope, - impliedNodeFormat: impliedNodeFormat, - } - } - if canUseStateFromOldProgram { - // If the global file is removed, add all files as changed - allFilesExcludingDefaultLibraryFileAddedToChangeSet := false - for filePath, oldInfo := range oldProgram.state.fileInfos { - if _, ok := state.fileInfos[filePath]; !ok { - if oldInfo.affectsGlobalScope { - for _, file := range state.getAllFilesExcludingDefaultLibraryFile(program, nil) { - state.addFileToChangeSet(file.Path()) - } - allFilesExcludingDefaultLibraryFileAddedToChangeSet = true - } else { - state.buildInfoEmitPending = true - } - break - } - } - if !allFilesExcludingDefaultLibraryFileAddedToChangeSet { - // If options affect emit, then we need to do complete emit per compiler options - // otherwise only the js or dts that needs to emitted because its different from previously emitted options - var pendingEmitKind FileEmitKind - if tsoptions.CompilerOptionsAffectEmit(oldProgram.state.options, state.options) { - pendingEmitKind = GetFileEmitKind(state.options) - } else { - pendingEmitKind = getPendingEmitKindWithOptions(state.options, oldProgram.state.options) - } - if pendingEmitKind != fileEmitKindNone { - // Add all files to affectedFilesPendingEmit since emit changed - for _, file := range files { - // Add to affectedFilesPending emit only if not changed since any changed file will do full emit - if !state.changedFilesSet.Has(file.Path()) { - state.addFileToAffectedFilesPendingEmit(file.Path(), pendingEmitKind) - } - } - state.buildInfoEmitPending = true - } - } - } - if canUseStateFromOldProgram && - len(state.semanticDiagnosticsPerFile) != len(state.fileInfos) && - oldProgram.state.checkPending != state.checkPending { - state.buildInfoEmitPending = true - } - return state -} - -func fileAffectsGlobalScope(file *ast.SourceFile) bool { - // if file contains anything that augments to global scope we need to build them as if - // they are global files as well as module - if core.Some(file.ModuleAugmentations, func(augmentation *ast.ModuleName) bool { - return ast.IsGlobalScopeAugmentation(augmentation.Parent) - }) { - return true - } - - if ast.IsExternalOrCommonJSModule(file) || ast.IsJsonSourceFile(file) { - return false - } - - /** - * For script files that contains only ambient external modules, although they are not actually external module files, - * they can only be consumed via importing elements from them. Regular script files cannot consume them. Therefore, - * there are no point to rebuild all script files if these special files have changed. However, if any statement - * in the file is not ambient external module, we treat it as a regular script file. - */ - return file.Statements != nil && - file.Statements.Nodes != nil && - core.Some(file.Statements.Nodes, func(stmt *ast.Node) bool { - return !ast.IsModuleWithStringLiteralName(stmt) - }) -} - -func getTextHandlingSourceMapForSignature(text string, data *compiler.WriteFileData) string { - if data.SourceMapUrlPos != -1 { - return text[:data.SourceMapUrlPos] - } - return text -} - -func computeSignatureWithDiagnostics(file *ast.SourceFile, text string, data *compiler.WriteFileData) string { - var builder strings.Builder - builder.WriteString(getTextHandlingSourceMapForSignature(text, data)) - for _, diag := range data.Diagnostics { - diagnosticToStringBuilder(diag, file, &builder) - } - return computeHash(builder.String()) -} - -func diagnosticToStringBuilder(diagnostic *ast.Diagnostic, file *ast.SourceFile, builder *strings.Builder) string { - if diagnostic == nil { - return "" - } - builder.WriteString("\n") - if diagnostic.File() != file { - builder.WriteString(tspath.EnsurePathIsNonModuleName(tspath.GetRelativePathFromDirectory( - tspath.GetDirectoryPath(string(file.Path())), - string(diagnostic.File().Path()), - tspath.ComparePathsOptions{}, - ))) - } - if diagnostic.File() != nil { - builder.WriteString(fmt.Sprintf("(%d,%d): ", diagnostic.Pos(), diagnostic.Len())) - } - builder.WriteString(diagnostic.Category().Name()) - builder.WriteString(fmt.Sprintf("%d: ", diagnostic.Code())) - builder.WriteString(diagnostic.Message()) - for _, chain := range diagnostic.MessageChain() { - diagnosticToStringBuilder(chain, file, builder) - } - for _, info := range diagnostic.RelatedInformation() { - diagnosticToStringBuilder(info, file, builder) - } - return builder.String() -} - -func computeHash(text string) string { - return fmt.Sprintf("%x", sha256.Sum256([]byte(text))) -} - -/** -* Get the module source file and all augmenting files from the import name node from file - */ -func addReferencedFilesFromImportLiteral(file *ast.SourceFile, referencedFiles *collections.Set[tspath.Path], checker *checker.Checker, importName *ast.LiteralLikeNode) { - symbol := checker.GetSymbolAtLocation(importName) - if symbol == nil { - return - } - for _, declaration := range symbol.Declarations { - fileOfDecl := ast.GetSourceFileOfNode(declaration) - if fileOfDecl == nil { - continue - } - if file != fileOfDecl { - referencedFiles.Add(fileOfDecl.Path()) - } - } -} - -/** -* Gets the path to reference file from file name, it could be resolvedPath if present otherwise path - */ -func addReferencedFileFromFileName(program *compiler.Program, fileName string, referencedFiles *collections.Set[tspath.Path], sourceFileDirectory string) { - if redirect := program.GetParseFileRedirect(fileName); redirect != "" { - referencedFiles.Add(tspath.ToPath(redirect, program.GetCurrentDirectory(), program.UseCaseSensitiveFileNames())) - } else { - referencedFiles.Add(tspath.ToPath(fileName, sourceFileDirectory, program.UseCaseSensitiveFileNames())) - } -} - -/** - * Gets the referenced files for a file from the program with values for the keys as referenced file's path to be true - */ -func getReferencedFiles(program *compiler.Program, file *ast.SourceFile) *collections.Set[tspath.Path] { - referencedFiles := collections.Set[tspath.Path]{} - - // We need to use a set here since the code can contain the same import twice, - // but that will only be one dependency. - // To avoid invernal conversion, the key of the referencedFiles map must be of type Path - if len(file.Imports()) > 0 || len(file.ModuleAugmentations) > 0 { - checker, done := program.GetTypeCheckerForFile(context.TODO(), file) - for _, importName := range file.Imports() { - addReferencedFilesFromImportLiteral(file, &referencedFiles, checker, importName) - } - // Add module augmentation as references - for _, moduleName := range file.ModuleAugmentations { - if !ast.IsStringLiteral(moduleName) { - continue - } - addReferencedFilesFromImportLiteral(file, &referencedFiles, checker, moduleName) - } - done() - } - - sourceFileDirectory := tspath.GetDirectoryPath(file.FileName()) - // Handle triple slash references - for _, referencedFile := range file.ReferencedFiles { - addReferencedFileFromFileName(program, referencedFile.FileName, &referencedFiles, sourceFileDirectory) - } - - // Handle type reference directives - if typeRefsInFile, ok := program.GetResolvedTypeReferenceDirectives()[file.Path()]; ok { - for _, typeRef := range typeRefsInFile { - if typeRef.ResolvedFileName != "" { - addReferencedFileFromFileName(program, typeRef.ResolvedFileName, &referencedFiles, sourceFileDirectory) - } - } - } - - // !!! sheetal - // // From ambient modules - // for (const ambientModule of program.getTypeChecker().getAmbientModules()) { - // if (ambientModule.declarations && ambientModule.declarations.length > 1) { - // addReferenceFromAmbientModule(ambientModule); - // } - // } - return core.IfElse(referencedFiles.Len() > 0, &referencedFiles, nil) -} diff --git a/internal/incremental/snapshot.go b/internal/incremental/snapshot.go new file mode 100644 index 0000000000..c6333777f0 --- /dev/null +++ b/internal/incremental/snapshot.go @@ -0,0 +1,566 @@ +package incremental + +import ( + "context" + "maps" + "strings" + "sync" + + "github.com/microsoft/typescript-go/internal/ast" + "github.com/microsoft/typescript-go/internal/checker" + "github.com/microsoft/typescript-go/internal/collections" + "github.com/microsoft/typescript-go/internal/compiler" + "github.com/microsoft/typescript-go/internal/core" + "github.com/microsoft/typescript-go/internal/diagnostics" + "github.com/microsoft/typescript-go/internal/tsoptions" + "github.com/microsoft/typescript-go/internal/tspath" +) + +type fileInfo struct { + version string + signature string + affectsGlobalScope bool + impliedNodeFormat core.ResolutionMode +} + +func (f *fileInfo) Version() string { return f.version } +func (f *fileInfo) Signature() string { return f.signature } +func (f *fileInfo) AffectsGlobalScope() bool { return f.affectsGlobalScope } +func (f *fileInfo) ImpliedNodeFormat() core.ResolutionMode { return f.impliedNodeFormat } + +type FileEmitKind uint32 + +const ( + fileEmitKindNone FileEmitKind = 0 + fileEmitKindJs FileEmitKind = 1 << 0 // emit js file + fileEmitKindJsMap FileEmitKind = 1 << 1 // emit js.map file + fileEmitKindJsInlineMap FileEmitKind = 1 << 2 // emit inline source map in js file + fileEmitKindDtsErrors FileEmitKind = 1 << 3 // emit dts errors + fileEmitKindDtsEmit FileEmitKind = 1 << 4 // emit d.ts file + fileEmitKindDtsMap FileEmitKind = 1 << 5 // emit d.ts.map file + + fileEmitKindDts = fileEmitKindDtsErrors | fileEmitKindDtsEmit + fileEmitKindAllJs = fileEmitKindJs | fileEmitKindJsMap | fileEmitKindJsInlineMap + fileEmitKindAllDtsEmit = fileEmitKindDtsEmit | fileEmitKindDtsMap + fileEmitKindAllDts = fileEmitKindDts | fileEmitKindDtsMap + fileEmitKindAll = fileEmitKindAllJs | fileEmitKindAllDts +) + +func (fileEmitKind FileEmitKind) String() string { + var builder strings.Builder + addFlags := func(flags string) { + if builder.Len() == 0 { + builder.WriteString(flags) + } else { + builder.WriteString("|") + builder.WriteString(flags) + } + } + if fileEmitKind != 0 { + if (fileEmitKind & fileEmitKindJs) != 0 { + addFlags("Js") + } + if (fileEmitKind & fileEmitKindJsMap) != 0 { + addFlags("JsMap") + } + if (fileEmitKind & fileEmitKindJsInlineMap) != 0 { + addFlags("JsInlineMap") + } + if (fileEmitKind & fileEmitKindDts) == fileEmitKindDts { + addFlags("Dts") + } else { + if (fileEmitKind & fileEmitKindDtsEmit) != 0 { + addFlags("DtsEmit") + } + if (fileEmitKind & fileEmitKindDtsErrors) != 0 { + addFlags("DtsErrors") + } + } + if (fileEmitKind & fileEmitKindDtsMap) != 0 { + addFlags("DtsMap") + } + } + if builder.Len() != 0 { + return builder.String() + } + return "None" +} + +func GetFileEmitKind(options *core.CompilerOptions) FileEmitKind { + result := fileEmitKindJs + if options.SourceMap.IsTrue() { + result |= fileEmitKindJsMap + } + if options.InlineSourceMap.IsTrue() { + result |= fileEmitKindJsInlineMap + } + if options.GetEmitDeclarations() { + result |= fileEmitKindDts + } + if options.DeclarationMap.IsTrue() { + result |= fileEmitKindDtsMap + } + if options.EmitDeclarationOnly.IsTrue() { + result &= fileEmitKindAllDts + } + return result +} + +func getPendingEmitKindWithOptions(options *core.CompilerOptions, oldOptions *core.CompilerOptions) FileEmitKind { + oldEmitKind := GetFileEmitKind(oldOptions) + newEmitKind := GetFileEmitKind(options) + return getPendingEmitKind(newEmitKind, oldEmitKind) +} + +func getPendingEmitKind(emitKind FileEmitKind, oldEmitKind FileEmitKind) FileEmitKind { + if oldEmitKind == emitKind { + return fileEmitKindNone + } + if oldEmitKind == 0 || emitKind == 0 { + return emitKind + } + diff := oldEmitKind ^ emitKind + result := fileEmitKindNone + // If there is diff in Js emit, pending emit is js emit flags + if (diff & fileEmitKindAllJs) != 0 { + result |= emitKind & fileEmitKindAllJs + } + // If dts errors pending, add dts errors flag + if (diff & fileEmitKindDtsErrors) != 0 { + result |= emitKind & fileEmitKindDtsErrors + } + // If there is diff in Dts emit, pending emit is dts emit flags + if (diff & fileEmitKindAllDtsEmit) != 0 { + result |= emitKind & fileEmitKindAllDtsEmit + } + return result +} + +// Signature (Hash of d.ts emitted), is string if it was emitted using same d.ts.map option as what compilerOptions indicate, +// otherwise tuple of string +type emitSignature struct { + signature string + signatureWithDifferentOptions []string +} + +// Covert to Emit signature based on oldOptions and EmitSignature format +// If d.ts map options differ then swap the format, otherwise use as is +func (e *emitSignature) getNewEmitSignature(oldOptions *core.CompilerOptions, newOptions *core.CompilerOptions) *emitSignature { + if oldOptions.DeclarationMap.IsTrue() == newOptions.DeclarationMap.IsTrue() { + return e + } + if e.signatureWithDifferentOptions == nil { + return &emitSignature{ + signatureWithDifferentOptions: []string{e.signature}, + } + } else { + return &emitSignature{ + signature: e.signatureWithDifferentOptions[0], + } + } +} + +type buildInfoDiagnosticWithFileName struct { + // filename if it is for a File thats other than its stored for + file tspath.Path + noFile bool + pos int + end int + code int32 + category diagnostics.Category + message string + messageChain []*buildInfoDiagnosticWithFileName + relatedInformation []*buildInfoDiagnosticWithFileName + reportsUnnecessary bool + reportsDeprecated bool + skippedOnNoEmit bool +} + +type diagnosticsOrBuildInfoDiagnosticsWithFileName struct { + diagnostics []*ast.Diagnostic + buildInfoDiagnostics []*buildInfoDiagnosticWithFileName +} + +func (b *buildInfoDiagnosticWithFileName) toDiagnostic(p *compiler.Program, file *ast.SourceFile) *ast.Diagnostic { + var fileForDiagnostic *ast.SourceFile + if b.file != "" { + fileForDiagnostic = p.GetSourceFileByPath(b.file) + } else if !b.noFile { + fileForDiagnostic = file + } + var messageChain []*ast.Diagnostic + for _, msg := range b.messageChain { + messageChain = append(messageChain, msg.toDiagnostic(p, fileForDiagnostic)) + } + var relatedInformation []*ast.Diagnostic + for _, info := range b.relatedInformation { + relatedInformation = append(relatedInformation, info.toDiagnostic(p, fileForDiagnostic)) + } + return ast.NewDiagnosticWith( + fileForDiagnostic, + core.NewTextRange(b.pos, b.end), + b.code, + b.category, + b.message, + messageChain, + relatedInformation, + b.reportsUnnecessary, + b.reportsDeprecated, + b.skippedOnNoEmit, + ) +} + +func (d *diagnosticsOrBuildInfoDiagnosticsWithFileName) getDiagnostics(p *compiler.Program, file *ast.SourceFile) []*ast.Diagnostic { + if d.diagnostics != nil { + return d.diagnostics + } + // Convert and cache the diagnostics + d.diagnostics = core.Map(d.buildInfoDiagnostics, func(diag *buildInfoDiagnosticWithFileName) *ast.Diagnostic { + return diag.toDiagnostic(p, file) + }) + return d.diagnostics +} + +type snapshot struct { + // These are the fields that get serialized + + // Information of the file eg. its version, signature etc + fileInfos map[tspath.Path]*fileInfo + options *core.CompilerOptions + // Contains the map of ReferencedSet=Referenced files of the file if module emit is enabled + referencedMap *collections.ManyToManyMap[tspath.Path, tspath.Path] + // Cache of semantic diagnostics for files with their Path being the key + semanticDiagnosticsPerFile map[tspath.Path]*diagnosticsOrBuildInfoDiagnosticsWithFileName + // Cache of dts emit diagnostics for files with their Path being the key + emitDiagnosticsPerFile map[tspath.Path]*diagnosticsOrBuildInfoDiagnosticsWithFileName + // The map has key by source file's path that has been changed + changedFilesSet *collections.Set[tspath.Path] + // Files pending to be emitted + affectedFilesPendingEmit map[tspath.Path]FileEmitKind + // Name of the file whose dts was the latest to change + latestChangedDtsFile string + // Hash of d.ts emitted for the file, use to track when emit of d.ts changes + emitSignatures map[tspath.Path]*emitSignature + // Recorded if program had errors + hasErrors core.Tristate + // If semantic diagnsotic check is pending + checkPending bool + + // Additional fields that are not serialized but needed to track state + + // true if build info emit is pending + buildInfoEmitPending bool + // True if the semantic diagnostics were copied from the old state + semanticDiagnosticsFromOldState collections.Set[tspath.Path] + allFilesExcludingDefaultLibraryFileOnce sync.Once + // Cache of all files excluding default library file for the current program + allFilesExcludingDefaultLibraryFile []*ast.SourceFile +} + +func (s *snapshot) tracksReferences() bool { + return s.options.Module != core.ModuleKindNone +} + +func (s *snapshot) createReferenceMap() { + if s.tracksReferences() { + s.referencedMap = &collections.ManyToManyMap[tspath.Path, tspath.Path]{} + } +} + +func (s *snapshot) createEmitSignaturesMap() { + if s.emitSignatures == nil && s.options.Composite.IsTrue() { + s.emitSignatures = make(map[tspath.Path]*emitSignature) + } +} + +func (s *snapshot) addFileToChangeSet(filePath tspath.Path) { + s.changedFilesSet.Add(filePath) + s.buildInfoEmitPending = true +} + +func (s *snapshot) addFileToAffectedFilesPendingEmit(filePath tspath.Path, emitKind FileEmitKind) { + existingKind := s.affectedFilesPendingEmit[filePath] + if s.affectedFilesPendingEmit == nil { + s.affectedFilesPendingEmit = make(map[tspath.Path]FileEmitKind) + } + s.affectedFilesPendingEmit[filePath] = existingKind | emitKind + delete(s.emitDiagnosticsPerFile, filePath) +} + +func (s *snapshot) getAllFilesExcludingDefaultLibraryFile(program *compiler.Program, firstSourceFile *ast.SourceFile) []*ast.SourceFile { + s.allFilesExcludingDefaultLibraryFileOnce.Do(func() { + files := program.GetSourceFiles() + s.allFilesExcludingDefaultLibraryFile = make([]*ast.SourceFile, 0, len(files)) + addSourceFile := func(file *ast.SourceFile) { + if !program.IsSourceFileDefaultLibrary(file.Path()) { + s.allFilesExcludingDefaultLibraryFile = append(s.allFilesExcludingDefaultLibraryFile, file) + } + } + if firstSourceFile != nil { + addSourceFile(firstSourceFile) + } + for _, file := range files { + if file != firstSourceFile { + addSourceFile(file) + } + } + }) + return s.allFilesExcludingDefaultLibraryFile +} + +func newSnapshotForProgram(program *compiler.Program, oldProgram *Program) *snapshot { + if oldProgram != nil && oldProgram.program == program { + return oldProgram.snapshot + } + files := program.GetSourceFiles() + snapshot := &snapshot{ + options: program.Options(), + semanticDiagnosticsPerFile: make(map[tspath.Path]*diagnosticsOrBuildInfoDiagnosticsWithFileName, len(files)), + } + snapshot.createReferenceMap() + if oldProgram != nil && snapshot.options.Composite.IsTrue() { + snapshot.latestChangedDtsFile = oldProgram.snapshot.latestChangedDtsFile + } + if snapshot.options.NoCheck.IsTrue() { + snapshot.checkPending = true + } + + canUseStateFromOldProgram := oldProgram != nil && snapshot.tracksReferences() == oldProgram.snapshot.tracksReferences() + if canUseStateFromOldProgram { + // Copy old snapshot's changed files set + snapshot.changedFilesSet = oldProgram.snapshot.changedFilesSet.Clone() + if len(oldProgram.snapshot.affectedFilesPendingEmit) != 0 { + snapshot.affectedFilesPendingEmit = maps.Clone(oldProgram.snapshot.affectedFilesPendingEmit) + } + snapshot.buildInfoEmitPending = oldProgram.snapshot.buildInfoEmitPending + } else { + snapshot.changedFilesSet = &collections.Set[tspath.Path]{} + snapshot.buildInfoEmitPending = snapshot.options.IsIncremental() + } + + canCopySemanticDiagnostics := canUseStateFromOldProgram && + !tsoptions.CompilerOptionsAffectSemanticDiagnostics(oldProgram.snapshot.options, program.Options()) + // We can only reuse emit signatures (i.e. .d.ts signatures) if the .d.ts file is unchanged, + // which will eg be depedent on change in options like declarationDir and outDir options are unchanged. + // We need to look in oldState.compilerOptions, rather than oldCompilerOptions (i.e.we need to disregard useOldState) because + // oldCompilerOptions can be undefined if there was change in say module from None to some other option + // which would make useOldState as false since we can now use reference maps that are needed to track what to emit, what to check etc + // but that option change does not affect d.ts file name so emitSignatures should still be reused. + canCopyEmitSignatures := snapshot.options.Composite.IsTrue() && + oldProgram != nil && + oldProgram.snapshot.emitSignatures != nil && + !tsoptions.CompilerOptionsAffectDeclarationPath(oldProgram.snapshot.options, program.Options()) + copyDeclarationFileDiagnostics := canCopySemanticDiagnostics && + snapshot.options.SkipLibCheck.IsTrue() == oldProgram.snapshot.options.SkipLibCheck.IsTrue() + copyLibFileDiagnostics := copyDeclarationFileDiagnostics && + snapshot.options.SkipDefaultLibCheck.IsTrue() == oldProgram.snapshot.options.SkipDefaultLibCheck.IsTrue() + snapshot.fileInfos = make(map[tspath.Path]*fileInfo, len(files)) + for _, file := range files { + version := computeHash(file.Text()) + impliedNodeFormat := program.GetSourceFileMetaData(file.Path()).ImpliedNodeFormat + affectsGlobalScope := fileAffectsGlobalScope(file) + var signature string + if canUseStateFromOldProgram { + if oldFileInfo, ok := oldProgram.snapshot.fileInfos[file.Path()]; ok { + signature = oldFileInfo.signature + if oldFileInfo.version == version || oldFileInfo.affectsGlobalScope != affectsGlobalScope || oldFileInfo.impliedNodeFormat != impliedNodeFormat { + snapshot.addFileToChangeSet(file.Path()) + } + } else { + snapshot.addFileToChangeSet(file.Path()) + } + if snapshot.referencedMap != nil { + newReferences := getReferencedFiles(program, file) + if newReferences != nil { + snapshot.referencedMap.Add(file.Path(), newReferences) + } + oldReferences, _ := oldProgram.snapshot.referencedMap.GetValues(file.Path()) + // Referenced files changed + if !newReferences.Equals(oldReferences) { + snapshot.addFileToChangeSet(file.Path()) + } else { + for refPath := range newReferences.Keys() { + if program.GetSourceFileByPath(refPath) == nil { + // Referenced file was deleted in the new program + snapshot.addFileToChangeSet(file.Path()) + break + } + } + } + } + if !snapshot.changedFilesSet.Has(file.Path()) { + if emitDiagnostics, ok := oldProgram.snapshot.emitDiagnosticsPerFile[file.Path()]; ok { + if snapshot.emitDiagnosticsPerFile == nil { + snapshot.emitDiagnosticsPerFile = make(map[tspath.Path]*diagnosticsOrBuildInfoDiagnosticsWithFileName, len(files)) + } + snapshot.emitDiagnosticsPerFile[file.Path()] = emitDiagnostics + } + if canCopySemanticDiagnostics { + if (!file.IsDeclarationFile || copyDeclarationFileDiagnostics) && + (!program.IsSourceFileDefaultLibrary(file.Path()) || copyLibFileDiagnostics) { + // Unchanged file copy diagnostics + if diagnostics, ok := oldProgram.snapshot.semanticDiagnosticsPerFile[file.Path()]; ok { + snapshot.semanticDiagnosticsPerFile[file.Path()] = diagnostics + snapshot.semanticDiagnosticsFromOldState.Add(file.Path()) + } + } + } + } + if canCopyEmitSignatures { + if oldEmitSignature, ok := oldProgram.snapshot.emitSignatures[file.Path()]; ok { + snapshot.createEmitSignaturesMap() + snapshot.emitSignatures[file.Path()] = oldEmitSignature.getNewEmitSignature(oldProgram.snapshot.options, snapshot.options) + } + } + } else { + snapshot.addFileToAffectedFilesPendingEmit(file.Path(), GetFileEmitKind(snapshot.options)) + signature = version + } + snapshot.fileInfos[file.Path()] = &fileInfo{ + version: version, + signature: signature, + affectsGlobalScope: affectsGlobalScope, + impliedNodeFormat: impliedNodeFormat, + } + } + if canUseStateFromOldProgram { + // If the global file is removed, add all files as changed + allFilesExcludingDefaultLibraryFileAddedToChangeSet := false + for filePath, oldInfo := range oldProgram.snapshot.fileInfos { + if _, ok := snapshot.fileInfos[filePath]; !ok { + if oldInfo.affectsGlobalScope { + for _, file := range snapshot.getAllFilesExcludingDefaultLibraryFile(program, nil) { + snapshot.addFileToChangeSet(file.Path()) + } + allFilesExcludingDefaultLibraryFileAddedToChangeSet = true + } else { + snapshot.buildInfoEmitPending = true + } + break + } + } + if !allFilesExcludingDefaultLibraryFileAddedToChangeSet { + // If options affect emit, then we need to do complete emit per compiler options + // otherwise only the js or dts that needs to emitted because its different from previously emitted options + var pendingEmitKind FileEmitKind + if tsoptions.CompilerOptionsAffectEmit(oldProgram.snapshot.options, snapshot.options) { + pendingEmitKind = GetFileEmitKind(snapshot.options) + } else { + pendingEmitKind = getPendingEmitKindWithOptions(snapshot.options, oldProgram.snapshot.options) + } + if pendingEmitKind != fileEmitKindNone { + // Add all files to affectedFilesPendingEmit since emit changed + for _, file := range files { + // Add to affectedFilesPending emit only if not changed since any changed file will do full emit + if !snapshot.changedFilesSet.Has(file.Path()) { + snapshot.addFileToAffectedFilesPendingEmit(file.Path(), pendingEmitKind) + } + } + snapshot.buildInfoEmitPending = true + } + } + } + if canUseStateFromOldProgram && + len(snapshot.semanticDiagnosticsPerFile) != len(snapshot.fileInfos) && + oldProgram.snapshot.checkPending != snapshot.checkPending { + snapshot.buildInfoEmitPending = true + } + return snapshot +} + +func fileAffectsGlobalScope(file *ast.SourceFile) bool { + // if file contains anything that augments to global scope we need to build them as if + // they are global files as well as module + if core.Some(file.ModuleAugmentations, func(augmentation *ast.ModuleName) bool { + return ast.IsGlobalScopeAugmentation(augmentation.Parent) + }) { + return true + } + + if ast.IsExternalOrCommonJSModule(file) || ast.IsJsonSourceFile(file) { + return false + } + + // For script files that contains only ambient external modules, although they are not actually external module files, + // they can only be consumed via importing elements from them. Regular script files cannot consume them. Therefore, + // there are no point to rebuild all script files if these special files have changed. However, if any statement + // in the file is not ambient external module, we treat it as a regular script file. + return file.Statements != nil && + file.Statements.Nodes != nil && + core.Some(file.Statements.Nodes, func(stmt *ast.Node) bool { + return !ast.IsModuleWithStringLiteralName(stmt) + }) +} + +func addReferencedFilesFromSymbol(file *ast.SourceFile, referencedFiles *collections.Set[tspath.Path], symbol *ast.Symbol) { + if symbol == nil { + return + } + for _, declaration := range symbol.Declarations { + fileOfDecl := ast.GetSourceFileOfNode(declaration) + if fileOfDecl == nil { + continue + } + if file != fileOfDecl { + referencedFiles.Add(fileOfDecl.Path()) + } + } +} + +// Get the module source file and all augmenting files from the import name node from file +func addReferencedFilesFromImportLiteral(file *ast.SourceFile, referencedFiles *collections.Set[tspath.Path], checker *checker.Checker, importName *ast.LiteralLikeNode) { + symbol := checker.GetSymbolAtLocation(importName) + addReferencedFilesFromSymbol(file, referencedFiles, symbol) +} + +// Gets the path to reference file from file name, it could be resolvedPath if present otherwise path +func addReferencedFileFromFileName(program *compiler.Program, fileName string, referencedFiles *collections.Set[tspath.Path], sourceFileDirectory string) { + if redirect := program.GetParseFileRedirect(fileName); redirect != "" { + referencedFiles.Add(tspath.ToPath(redirect, program.GetCurrentDirectory(), program.UseCaseSensitiveFileNames())) + } else { + referencedFiles.Add(tspath.ToPath(fileName, sourceFileDirectory, program.UseCaseSensitiveFileNames())) + } +} + +// Gets the referenced files for a file from the program with values for the keys as referenced file's path to be true +func getReferencedFiles(program *compiler.Program, file *ast.SourceFile) *collections.Set[tspath.Path] { + referencedFiles := collections.Set[tspath.Path]{} + + // We need to use a set here since the code can contain the same import twice, + // but that will only be one dependency. + // To avoid invernal conversion, the key of the referencedFiles map must be of type Path + checker, done := program.GetTypeCheckerForFile(context.TODO(), file) + defer done() + for _, importName := range file.Imports() { + addReferencedFilesFromImportLiteral(file, &referencedFiles, checker, importName) + } + + sourceFileDirectory := tspath.GetDirectoryPath(file.FileName()) + // Handle triple slash references + for _, referencedFile := range file.ReferencedFiles { + addReferencedFileFromFileName(program, referencedFile.FileName, &referencedFiles, sourceFileDirectory) + } + + // Handle type reference directives + if typeRefsInFile, ok := program.GetResolvedTypeReferenceDirectives()[file.Path()]; ok { + for _, typeRef := range typeRefsInFile { + if typeRef.ResolvedFileName != "" { + addReferencedFileFromFileName(program, typeRef.ResolvedFileName, &referencedFiles, sourceFileDirectory) + } + } + } + + // Add module augmentation as references + for _, moduleName := range file.ModuleAugmentations { + if !ast.IsStringLiteral(moduleName) { + continue + } + addReferencedFilesFromImportLiteral(file, &referencedFiles, checker, moduleName) + } + + // From ambient modules + for _, ambientModule := range checker.GetAmbientModules() { + addReferencedFilesFromSymbol(file, &referencedFiles, ambientModule) + } + return core.IfElse(referencedFiles.Len() > 0, &referencedFiles, nil) +} diff --git a/internal/incremental/tobuildinfo.go b/internal/incremental/tobuildinfo.go index f01b6a16c3..ebff385ec4 100644 --- a/internal/incremental/tobuildinfo.go +++ b/internal/incremental/tobuildinfo.go @@ -15,9 +15,9 @@ import ( "github.com/microsoft/typescript-go/internal/tspath" ) -func programStateToBuildInfo(state *programState, program *compiler.Program, buildInfoFileName string) *BuildInfo { +func snapshotToBuildInfo(snapshot *snapshot, program *compiler.Program, buildInfoFileName string) *BuildInfo { to := &toBuildInfo{ - state: state, + snapshot: snapshot, program: program, buildInfoDirectory: tspath.GetDirectoryPath(buildInfoFileName), comparePathsOptions: tspath.ComparePathsOptions{ @@ -28,7 +28,7 @@ func programStateToBuildInfo(state *programState, program *compiler.Program, bui fileNamesToFileIdListId: make(map[string]BuildInfoFileIdListId), } to.buildInfo.Version = core.Version() - if state.options.IsIncremental() { + if snapshot.options.IsIncremental() { to.setFileInfoAndEmitSignatures() to.setCompilerOptions() to.setReferencedMap() @@ -36,8 +36,8 @@ func programStateToBuildInfo(state *programState, program *compiler.Program, bui to.setSemanticDiagnostics() to.setEmitDiagnostics() to.setAffectedFilesPendingEmit() - if state.latestChangedDtsFile != "" { - to.buildInfo.LatestChangedDtsFile = to.relativeToBuildInfo(state.latestChangedDtsFile) + if snapshot.latestChangedDtsFile != "" { + to.buildInfo.LatestChangedDtsFile = to.relativeToBuildInfo(snapshot.latestChangedDtsFile) } } // else { @@ -45,13 +45,13 @@ func programStateToBuildInfo(state *programState, program *compiler.Program, bui // root: arrayFrom(rootFileNames, r => relativeToBuildInfo(r)), // }; // } - to.buildInfo.Errors = state.hasErrors.IsTrue() - to.buildInfo.CheckPending = state.checkPending + to.buildInfo.Errors = snapshot.hasErrors.IsTrue() + to.buildInfo.CheckPending = snapshot.checkPending return &to.buildInfo } type toBuildInfo struct { - state *programState + snapshot *snapshot program *compiler.Program buildInfo BuildInfo buildInfoDirectory string @@ -171,32 +171,26 @@ func (t *toBuildInfo) toBuildInfoDiagnosticsOfFile(filePath tspath.Path, diags * func (t *toBuildInfo) setFileInfoAndEmitSignatures() { t.buildInfo.FileInfos = core.Map(t.program.GetSourceFiles(), func(file *ast.SourceFile) *BuildInfoFileInfo { - info := t.state.fileInfos[file.Path()] + info := t.snapshot.fileInfos[file.Path()] fileId := t.toFileId(file.Path()) // tryAddRoot(key, fileId); if t.buildInfo.FileNames[fileId-1] != t.relativeToBuildInfo(string(file.Path())) { panic(fmt.Sprintf("File name at index %d does not match expected relative path: %s != %s", fileId-1, t.buildInfo.FileNames[fileId-1], t.relativeToBuildInfo(string(file.Path())))) } - var actualSignature string - if oldSignature, gotOldSignature := t.state.oldSignatures[file.Path()]; gotOldSignature { - actualSignature = oldSignature - } else { - actualSignature = info.signature - } - if t.state.options.Composite.IsTrue() { + if t.snapshot.options.Composite.IsTrue() { if !ast.IsJsonSourceFile(file) && t.program.SourceFileMayBeEmitted(file, false) { - emitSignature := t.state.emitSignatures[file.Path()] + emitSignature := t.snapshot.emitSignatures[file.Path()] if emitSignature == nil { t.buildInfo.EmitSignatures = append(t.buildInfo.EmitSignatures, &BuildInfoEmitSignature{ FileId: fileId, }) - } else if emitSignature.signature != actualSignature { + } else if emitSignature.signature != info.signature { incrementalEmitSignature := &BuildInfoEmitSignature{ FileId: fileId, } if emitSignature.signature != "" { incrementalEmitSignature.Signature = emitSignature.signature - } else if emitSignature.signatureWithDifferentOptions[0] == actualSignature { + } else if emitSignature.signatureWithDifferentOptions[0] == info.signature { incrementalEmitSignature.DiffersOnlyInDtsMap = true } else { incrementalEmitSignature.Signature = emitSignature.signatureWithDifferentOptions[0] @@ -206,22 +200,13 @@ func (t *toBuildInfo) setFileInfoAndEmitSignatures() { } } } - if actualSignature == info.signature { - return newBuildInfoFileInfo(info) - } else { - return newBuildInfoFileInfo(&fileInfo{ - version: info.version, - signature: actualSignature, - affectsGlobalScope: info.affectsGlobalScope, - impliedNodeFormat: info.impliedNodeFormat, - }) - } + return newBuildInfoFileInfo(info) }) } func (t *toBuildInfo) setCompilerOptions() { tsoptions.ForEachCompilerOptionValue( - t.state.options, + t.snapshot.options, func(option *tsoptions.CommandLineOption) bool { return option.AffectsBuildInfo }, @@ -240,13 +225,13 @@ func (t *toBuildInfo) setCompilerOptions() { } func (t *toBuildInfo) setReferencedMap() { - if !t.state.tracksReferences() { + if !t.snapshot.tracksReferences() { return } - keys := slices.Collect(maps.Keys(t.state.referencedMap.Keys())) + keys := slices.Collect(maps.Keys(t.snapshot.referencedMap.Keys())) slices.Sort(keys) t.buildInfo.ReferencedMap = core.Map(keys, func(filePath tspath.Path) *BuildInfoReferenceMapEntry { - references, _ := t.state.referencedMap.GetValues(filePath) + references, _ := t.snapshot.referencedMap.GetValues(filePath) return &BuildInfoReferenceMapEntry{ FileId: t.toFileId(filePath), FileIdListId: t.toFileIdListId(references), @@ -255,16 +240,16 @@ func (t *toBuildInfo) setReferencedMap() { } func (t *toBuildInfo) setChangeFileSet() { - files := slices.Collect(maps.Keys(t.state.changedFilesSet.Keys())) + files := slices.Collect(maps.Keys(t.snapshot.changedFilesSet.Keys())) slices.Sort(files) t.buildInfo.ChangeFileSet = core.Map(files, t.toFileId) } func (t *toBuildInfo) setSemanticDiagnostics() { for _, file := range t.program.GetSourceFiles() { - value, ok := t.state.semanticDiagnosticsPerFile[file.Path()] + value, ok := t.snapshot.semanticDiagnosticsPerFile[file.Path()] if !ok { - if !t.state.changedFilesSet.Has(file.Path()) { + if !t.snapshot.changedFilesSet.Has(file.Path()) { t.buildInfo.SemanticDiagnosticsPerFile = append(t.buildInfo.SemanticDiagnosticsPerFile, &BuildInfoSemanticDiagnostic{ FileId: t.toFileId(file.Path()), }) @@ -281,26 +266,26 @@ func (t *toBuildInfo) setSemanticDiagnostics() { } func (t *toBuildInfo) setEmitDiagnostics() { - files := slices.Collect(maps.Keys(t.state.emitDiagnosticsPerFile)) + files := slices.Collect(maps.Keys(t.snapshot.emitDiagnosticsPerFile)) slices.Sort(files) t.buildInfo.EmitDiagnosticsPerFile = core.Map(files, func(filePath tspath.Path) *BuildInfoDiagnosticsOfFile { - return t.toBuildInfoDiagnosticsOfFile(filePath, t.state.emitDiagnosticsPerFile[filePath]) + return t.toBuildInfoDiagnosticsOfFile(filePath, t.snapshot.emitDiagnosticsPerFile[filePath]) }) } func (t *toBuildInfo) setAffectedFilesPendingEmit() { - if len(t.state.affectedFilesPendingEmit) == 0 { + if len(t.snapshot.affectedFilesPendingEmit) == 0 { return } - files := slices.Collect(maps.Keys(t.state.affectedFilesPendingEmit)) + files := slices.Collect(maps.Keys(t.snapshot.affectedFilesPendingEmit)) slices.Sort(files) - fullEmitKind := GetFileEmitKind(t.state.options) + fullEmitKind := GetFileEmitKind(t.snapshot.options) for _, filePath := range files { file := t.program.GetSourceFileByPath(filePath) if file == nil || !t.program.SourceFileMayBeEmitted(file, false) { continue } - pendingEmit := t.state.affectedFilesPendingEmit[filePath] + pendingEmit := t.snapshot.affectedFilesPendingEmit[filePath] t.buildInfo.AffectedFilesPendingEmit = append(t.buildInfo.AffectedFilesPendingEmit, &BuildInfoFilePendingEmit{ FileId: t.toFileId(filePath), EmitKind: core.IfElse(pendingEmit == fullEmitKind, 0, pendingEmit), diff --git a/internal/incremental/toprogramstate.go b/internal/incremental/tosnapshot.go similarity index 52% rename from internal/incremental/toprogramstate.go rename to internal/incremental/tosnapshot.go index 791b07f09f..51b9517048 100644 --- a/internal/incremental/toprogramstate.go +++ b/internal/incremental/tosnapshot.go @@ -7,8 +7,8 @@ import ( "github.com/microsoft/typescript-go/internal/tspath" ) -func buildInfoToProgramState(buildInfo *BuildInfo, buildInfoFileName string, config *tsoptions.ParsedCommandLine) *programState { - to := &toProgramState{ +func buildInfoToSnapshot(buildInfo *BuildInfo, buildInfoFileName string, config *tsoptions.ParsedCommandLine) *snapshot { + to := &toSnapshot{ buildInfo: buildInfo, buildInfoDirectory: tspath.GetDirectoryPath(tspath.GetNormalizedAbsolutePath(buildInfoFileName, config.GetCurrentDirectory())), filePaths: make([]tspath.Path, 0, len(buildInfo.FileNames)), @@ -32,34 +32,34 @@ func buildInfoToProgramState(buildInfo *BuildInfo, buildInfoFileName string, con to.setEmitDiagnostics() to.setAffectedFilesPendingEmit() if buildInfo.LatestChangedDtsFile != "" { - to.state.latestChangedDtsFile = to.toAbsolutePath(buildInfo.LatestChangedDtsFile) + to.snapshot.latestChangedDtsFile = to.toAbsolutePath(buildInfo.LatestChangedDtsFile) } - to.state.hasErrors = core.IfElse(buildInfo.Errors, core.TSTrue, core.TSFalse) - to.state.checkPending = buildInfo.CheckPending - return &to.state + to.snapshot.hasErrors = core.IfElse(buildInfo.Errors, core.TSTrue, core.TSFalse) + to.snapshot.checkPending = buildInfo.CheckPending + return &to.snapshot } -type toProgramState struct { +type toSnapshot struct { buildInfo *BuildInfo buildInfoDirectory string - state programState + snapshot snapshot filePaths []tspath.Path filePathSet []*collections.Set[tspath.Path] } -func (t *toProgramState) toAbsolutePath(path string) string { +func (t *toSnapshot) toAbsolutePath(path string) string { return tspath.GetNormalizedAbsolutePath(path, t.buildInfoDirectory) } -func (t *toProgramState) toFilePath(fileId BuildInfoFileId) tspath.Path { +func (t *toSnapshot) toFilePath(fileId BuildInfoFileId) tspath.Path { return t.filePaths[fileId-1] } -func (t *toProgramState) toFilePathSet(fileIdListId BuildInfoFileIdListId) *collections.Set[tspath.Path] { +func (t *toSnapshot) toFilePathSet(fileIdListId BuildInfoFileIdListId) *collections.Set[tspath.Path] { return t.filePathSet[fileIdListId-1] } -func (t *toProgramState) toBuildInfoDiagnosticsWithFileName(diagnostics []*BuildInfoDiagnostic) []*buildInfoDiagnosticWithFileName { +func (t *toSnapshot) toBuildInfoDiagnosticsWithFileName(diagnostics []*BuildInfoDiagnostic) []*buildInfoDiagnosticWithFileName { return core.Map(diagnostics, func(d *BuildInfoDiagnostic) *buildInfoDiagnosticWithFileName { var file tspath.Path if d.File != 0 { @@ -82,88 +82,88 @@ func (t *toProgramState) toBuildInfoDiagnosticsWithFileName(diagnostics []*Build }) } -func (t *toProgramState) toDiagnosticsOrBuildInfoDiagnosticsWithFileName(dig *BuildInfoDiagnosticsOfFile) *diagnosticsOrBuildInfoDiagnosticsWithFileName { +func (t *toSnapshot) toDiagnosticsOrBuildInfoDiagnosticsWithFileName(dig *BuildInfoDiagnosticsOfFile) *diagnosticsOrBuildInfoDiagnosticsWithFileName { return &diagnosticsOrBuildInfoDiagnosticsWithFileName{ buildInfoDiagnostics: t.toBuildInfoDiagnosticsWithFileName(dig.Diagnostics), } } -func (t *toProgramState) setCompilerOptions() { - t.state.options = t.buildInfo.GetCompilerOptions(t.buildInfoDirectory) +func (t *toSnapshot) setCompilerOptions() { + t.snapshot.options = t.buildInfo.GetCompilerOptions(t.buildInfoDirectory) } -func (t *toProgramState) setFileInfoAndEmitSignatures() { - t.state.fileInfos = make(map[tspath.Path]*fileInfo, len(t.buildInfo.FileInfos)) - t.state.createEmitSignaturesMap() +func (t *toSnapshot) setFileInfoAndEmitSignatures() { + t.snapshot.fileInfos = make(map[tspath.Path]*fileInfo, len(t.buildInfo.FileInfos)) + t.snapshot.createEmitSignaturesMap() for index, buildInfoFileInfo := range t.buildInfo.FileInfos { path := t.toFilePath(BuildInfoFileId(index + 1)) info := buildInfoFileInfo.GetFileInfo() - t.state.fileInfos[path] = info + t.snapshot.fileInfos[path] = info // Add default emit signature as file's signature - if info.signature != "" && len(t.state.emitSignatures) != 0 { - t.state.emitSignatures[path] = &emitSignature{signature: info.signature} + if info.signature != "" && len(t.snapshot.emitSignatures) != 0 { + t.snapshot.emitSignatures[path] = &emitSignature{signature: info.signature} } } // Fix up emit signatures for _, value := range t.buildInfo.EmitSignatures { if value.noEmitSignature() { - delete(t.state.emitSignatures, t.toFilePath(value.FileId)) + delete(t.snapshot.emitSignatures, t.toFilePath(value.FileId)) } else { path := t.toFilePath(value.FileId) - t.state.emitSignatures[path] = value.toEmitSignature(path, t.state.emitSignatures) + t.snapshot.emitSignatures[path] = value.toEmitSignature(path, t.snapshot.emitSignatures) } } } -func (t *toProgramState) setReferencedMap() { - t.state.createReferenceMap() +func (t *toSnapshot) setReferencedMap() { + t.snapshot.createReferenceMap() for _, entry := range t.buildInfo.ReferencedMap { - t.state.referencedMap.Add(t.toFilePath(entry.FileId), t.toFilePathSet(entry.FileIdListId)) + t.snapshot.referencedMap.Add(t.toFilePath(entry.FileId), t.toFilePathSet(entry.FileIdListId)) } } -func (t *toProgramState) setChangeFileSet() { - t.state.changedFilesSet = collections.NewSetWithSizeHint[tspath.Path](len(t.buildInfo.ChangeFileSet)) +func (t *toSnapshot) setChangeFileSet() { + t.snapshot.changedFilesSet = collections.NewSetWithSizeHint[tspath.Path](len(t.buildInfo.ChangeFileSet)) for _, fileId := range t.buildInfo.ChangeFileSet { filePath := t.toFilePath(fileId) - t.state.changedFilesSet.Add(filePath) + t.snapshot.changedFilesSet.Add(filePath) } } -func (t *toProgramState) setSemanticDiagnostics() { - t.state.semanticDiagnosticsPerFile = make(map[tspath.Path]*diagnosticsOrBuildInfoDiagnosticsWithFileName, len(t.state.fileInfos)) - for path := range t.state.fileInfos { +func (t *toSnapshot) setSemanticDiagnostics() { + t.snapshot.semanticDiagnosticsPerFile = make(map[tspath.Path]*diagnosticsOrBuildInfoDiagnosticsWithFileName, len(t.snapshot.fileInfos)) + for path := range t.snapshot.fileInfos { // Initialize to have no diagnostics if its not changed file - if !t.state.changedFilesSet.Has(path) { - t.state.semanticDiagnosticsPerFile[path] = &diagnosticsOrBuildInfoDiagnosticsWithFileName{} + if !t.snapshot.changedFilesSet.Has(path) { + t.snapshot.semanticDiagnosticsPerFile[path] = &diagnosticsOrBuildInfoDiagnosticsWithFileName{} } } for _, diagnostic := range t.buildInfo.SemanticDiagnosticsPerFile { if diagnostic.FileId != 0 { filePath := t.toFilePath(diagnostic.FileId) - delete(t.state.semanticDiagnosticsPerFile, filePath) // does not have cached diagnostics + delete(t.snapshot.semanticDiagnosticsPerFile, filePath) // does not have cached diagnostics } else { filePath := t.toFilePath(diagnostic.Diagnostics.FileId) - t.state.semanticDiagnosticsPerFile[filePath] = t.toDiagnosticsOrBuildInfoDiagnosticsWithFileName(diagnostic.Diagnostics) + t.snapshot.semanticDiagnosticsPerFile[filePath] = t.toDiagnosticsOrBuildInfoDiagnosticsWithFileName(diagnostic.Diagnostics) } } } -func (t *toProgramState) setEmitDiagnostics() { - t.state.emitDiagnosticsPerFile = make(map[tspath.Path]*diagnosticsOrBuildInfoDiagnosticsWithFileName, len(t.state.fileInfos)) +func (t *toSnapshot) setEmitDiagnostics() { + t.snapshot.emitDiagnosticsPerFile = make(map[tspath.Path]*diagnosticsOrBuildInfoDiagnosticsWithFileName, len(t.snapshot.fileInfos)) for _, diagnostic := range t.buildInfo.EmitDiagnosticsPerFile { filePath := t.toFilePath(diagnostic.FileId) - t.state.emitDiagnosticsPerFile[filePath] = t.toDiagnosticsOrBuildInfoDiagnosticsWithFileName(diagnostic) + t.snapshot.emitDiagnosticsPerFile[filePath] = t.toDiagnosticsOrBuildInfoDiagnosticsWithFileName(diagnostic) } } -func (t *toProgramState) setAffectedFilesPendingEmit() { +func (t *toSnapshot) setAffectedFilesPendingEmit() { if len(t.buildInfo.AffectedFilesPendingEmit) == 0 { return } - ownOptionsEmitKind := GetFileEmitKind(t.state.options) - t.state.affectedFilesPendingEmit = make(map[tspath.Path]FileEmitKind, len(t.buildInfo.AffectedFilesPendingEmit)) + ownOptionsEmitKind := GetFileEmitKind(t.snapshot.options) + t.snapshot.affectedFilesPendingEmit = make(map[tspath.Path]FileEmitKind, len(t.buildInfo.AffectedFilesPendingEmit)) for _, pendingEmit := range t.buildInfo.AffectedFilesPendingEmit { - t.state.affectedFilesPendingEmit[t.toFilePath(pendingEmit.FileId)] = core.IfElse(pendingEmit.EmitKind == 0, ownOptionsEmitKind, pendingEmit.EmitKind) + t.snapshot.affectedFilesPendingEmit[t.toFilePath(pendingEmit.FileId)] = core.IfElse(pendingEmit.EmitKind == 0, ownOptionsEmitKind, pendingEmit.EmitKind) } } From 70476c637377969f282898d842706565ff9f28a4 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Mon, 30 Jun 2025 11:14:53 -0700 Subject: [PATCH 12/36] Tests --- .../compiler/es5-commonjs8.errors.txt | 9 - .../compiler/es5-commonjs8.errors.txt.diff | 13 - .../compiler/isolatedModulesNoEmitOnError.js | 3 + .../isolatedModulesNoEmitOnError.js.diff | 11 - .../submodule/compiler/noEmitOnError.js | 11 +- .../submodule/compiler/noEmitOnError.js.diff | 20 - ...dCompilerDeclarationsWithNoEmit.errors.txt | 8 +- ...ilerDeclarationsWithNoEmit.errors.txt.diff | 29 - .../conformance/autoAccessor1(target=es5).js | 3 + .../autoAccessor1(target=es5).js.diff | 8 +- .../conformance/autoAccessor3(target=es5).js | 3 + .../autoAccessor3(target=es5).js.diff | 8 +- .../conformance/autoAccessor4(target=es5).js | 3 + .../autoAccessor4(target=es5).js.diff | 8 +- .../noEmit/when-project-has-strict-true.js | 113 ++ ...ativeImportExtensionsProjectReferences2.js | 1058 +++++++++++++++++ ...ativeImportExtensionsProjectReferences3.js | 1058 +++++++++++++++++ .../parse-tsconfig-with-typeAcquisition.js | 110 +- 18 files changed, 2365 insertions(+), 111 deletions(-) delete mode 100644 testdata/baselines/reference/submodule/compiler/es5-commonjs8.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/es5-commonjs8.errors.txt.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/isolatedModulesNoEmitOnError.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/noEmitOnError.js.diff delete mode 100644 testdata/baselines/reference/submodule/compiler/shadowedReservedCompilerDeclarationsWithNoEmit.errors.txt.diff diff --git a/testdata/baselines/reference/submodule/compiler/es5-commonjs8.errors.txt b/testdata/baselines/reference/submodule/compiler/es5-commonjs8.errors.txt deleted file mode 100644 index 1d0e812db4..0000000000 --- a/testdata/baselines/reference/submodule/compiler/es5-commonjs8.errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -es5-commonjs8.ts(2,12): error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. - - -==== es5-commonjs8.ts (1 errors) ==== - export default "test"; - export var __esModule = 1; - ~~~~~~~~~~ -!!! error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/es5-commonjs8.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/es5-commonjs8.errors.txt.diff deleted file mode 100644 index 6df1127517..0000000000 --- a/testdata/baselines/reference/submodule/compiler/es5-commonjs8.errors.txt.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- old.es5-commonjs8.errors.txt -+++ new.es5-commonjs8.errors.txt -@@= skipped -0, +0 lines =@@ -- -+es5-commonjs8.ts(2,12): error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. -+ -+ -+==== es5-commonjs8.ts (1 errors) ==== -+ export default "test"; -+ export var __esModule = 1; -+ ~~~~~~~~~~ -+!!! error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/isolatedModulesNoEmitOnError.js b/testdata/baselines/reference/submodule/compiler/isolatedModulesNoEmitOnError.js index 525567b2a5..80851e5cff 100644 --- a/testdata/baselines/reference/submodule/compiler/isolatedModulesNoEmitOnError.js +++ b/testdata/baselines/reference/submodule/compiler/isolatedModulesNoEmitOnError.js @@ -3,5 +3,8 @@ //// [file1.ts] export const x: string = 3; + + +!!!! File file1.js missing from original emit, but present in noCheck emit //// [file1.js] export const x = 3; diff --git a/testdata/baselines/reference/submodule/compiler/isolatedModulesNoEmitOnError.js.diff b/testdata/baselines/reference/submodule/compiler/isolatedModulesNoEmitOnError.js.diff deleted file mode 100644 index f033a66fa5..0000000000 --- a/testdata/baselines/reference/submodule/compiler/isolatedModulesNoEmitOnError.js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.isolatedModulesNoEmitOnError.js -+++ new.isolatedModulesNoEmitOnError.js -@@= skipped -2, +2 lines =@@ - //// [file1.ts] - export const x: string = 3; - -- -- --!!!! File file1.js missing from original emit, but present in noCheck emit - //// [file1.js] - export const x = 3; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/noEmitOnError.js b/testdata/baselines/reference/submodule/compiler/noEmitOnError.js index dbd430da6d..844d502f03 100644 --- a/testdata/baselines/reference/submodule/compiler/noEmitOnError.js +++ b/testdata/baselines/reference/submodule/compiler/noEmitOnError.js @@ -4,9 +4,14 @@ var x: number = ""; -//// [noEmitOnError.js] -var x = ""; -//# sourceMappingURL=noEmitOnError.js.map + +!!!! File noEmitOnError.d.ts missing from original emit, but present in noCheck emit //// [noEmitOnError.d.ts] declare var x: number; + + +!!!! File noEmitOnError.js missing from original emit, but present in noCheck emit +//// [noEmitOnError.js] +var x = ""; +//# sourceMappingURL=noEmitOnError.js.map \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/noEmitOnError.js.diff b/testdata/baselines/reference/submodule/compiler/noEmitOnError.js.diff deleted file mode 100644 index 5643c0234e..0000000000 --- a/testdata/baselines/reference/submodule/compiler/noEmitOnError.js.diff +++ /dev/null @@ -1,20 +0,0 @@ ---- old.noEmitOnError.js -+++ new.noEmitOnError.js -@@= skipped -3, +3 lines =@@ - var x: number = ""; - - -- -- --!!!! File noEmitOnError.d.ts missing from original emit, but present in noCheck emit --//// [noEmitOnError.d.ts] --declare var x: number; -- -- --!!!! File noEmitOnError.js missing from original emit, but present in noCheck emit - //// [noEmitOnError.js] - var x = ""; - //# sourceMappingURL=noEmitOnError.js.map -+ -+//// [noEmitOnError.d.ts] -+declare var x: number; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/shadowedReservedCompilerDeclarationsWithNoEmit.errors.txt b/testdata/baselines/reference/submodule/compiler/shadowedReservedCompilerDeclarationsWithNoEmit.errors.txt index e766c8e475..c3b0e5b0e9 100644 --- a/testdata/baselines/reference/submodule/compiler/shadowedReservedCompilerDeclarationsWithNoEmit.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/shadowedReservedCompilerDeclarationsWithNoEmit.errors.txt @@ -1,9 +1,7 @@ shadowedReservedCompilerDeclarationsWithNoEmit.ts(23,13): error TS1215: Invalid use of 'arguments'. Modules are automatically in strict mode. -shadowedReservedCompilerDeclarationsWithNoEmit.ts(44,5): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. -shadowedReservedCompilerDeclarationsWithNoEmit.ts(47,5): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. -==== shadowedReservedCompilerDeclarationsWithNoEmit.ts (3 errors) ==== +==== shadowedReservedCompilerDeclarationsWithNoEmit.ts (1 errors) ==== // Shadowed captured this and super class Base { } class C extends Base { @@ -50,13 +48,9 @@ shadowedReservedCompilerDeclarationsWithNoEmit.ts(47,5): error TS2441: Duplicate // shadowed require var require = 0; - ~~~~~~~ -!!! error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. // shadowed exports var exports = 0; - ~~~~~~~ -!!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. export { }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/shadowedReservedCompilerDeclarationsWithNoEmit.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/shadowedReservedCompilerDeclarationsWithNoEmit.errors.txt.diff deleted file mode 100644 index 214129fc4c..0000000000 --- a/testdata/baselines/reference/submodule/compiler/shadowedReservedCompilerDeclarationsWithNoEmit.errors.txt.diff +++ /dev/null @@ -1,29 +0,0 @@ ---- old.shadowedReservedCompilerDeclarationsWithNoEmit.errors.txt -+++ new.shadowedReservedCompilerDeclarationsWithNoEmit.errors.txt -@@= skipped -0, +0 lines =@@ - shadowedReservedCompilerDeclarationsWithNoEmit.ts(23,13): error TS1215: Invalid use of 'arguments'. Modules are automatically in strict mode. -- -- --==== shadowedReservedCompilerDeclarationsWithNoEmit.ts (1 errors) ==== -+shadowedReservedCompilerDeclarationsWithNoEmit.ts(44,5): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. -+shadowedReservedCompilerDeclarationsWithNoEmit.ts(47,5): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. -+ -+ -+==== shadowedReservedCompilerDeclarationsWithNoEmit.ts (3 errors) ==== - // Shadowed captured this and super - class Base { } - class C extends Base { -@@= skipped -47, +49 lines =@@ - - // shadowed require - var require = 0; -+ ~~~~~~~ -+!!! error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. - - // shadowed exports - var exports = 0; -+ ~~~~~~~ -+!!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. - - - export { }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/autoAccessor1(target=es5).js b/testdata/baselines/reference/submodule/conformance/autoAccessor1(target=es5).js index 7be10ab1fe..477576343d 100644 --- a/testdata/baselines/reference/submodule/conformance/autoAccessor1(target=es5).js +++ b/testdata/baselines/reference/submodule/conformance/autoAccessor1(target=es5).js @@ -9,6 +9,9 @@ class C1 { } + + +!!!! File autoAccessor1.js missing from original emit, but present in noCheck emit //// [autoAccessor1.js] class C1 { accessor a; diff --git a/testdata/baselines/reference/submodule/conformance/autoAccessor1(target=es5).js.diff b/testdata/baselines/reference/submodule/conformance/autoAccessor1(target=es5).js.diff index 85bece0ce9..854cb8158c 100644 --- a/testdata/baselines/reference/submodule/conformance/autoAccessor1(target=es5).js.diff +++ b/testdata/baselines/reference/submodule/conformance/autoAccessor1(target=es5).js.diff @@ -1,12 +1,8 @@ --- old.autoAccessor1(target=es5).js +++ new.autoAccessor1(target=es5).js -@@= skipped -8, +8 lines =@@ - } +@@= skipped -12, +12 lines =@@ - -- -- --!!!! File autoAccessor1.js missing from original emit, but present in noCheck emit + !!!! File autoAccessor1.js missing from original emit, but present in noCheck emit //// [autoAccessor1.js] -var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); diff --git a/testdata/baselines/reference/submodule/conformance/autoAccessor3(target=es5).js b/testdata/baselines/reference/submodule/conformance/autoAccessor3(target=es5).js index cb2e729e0d..c702a35eba 100644 --- a/testdata/baselines/reference/submodule/conformance/autoAccessor3(target=es5).js +++ b/testdata/baselines/reference/submodule/conformance/autoAccessor3(target=es5).js @@ -9,6 +9,9 @@ class C1 { } + + +!!!! File autoAccessor3.js missing from original emit, but present in noCheck emit //// [autoAccessor3.js] class C1 { accessor "w"; diff --git a/testdata/baselines/reference/submodule/conformance/autoAccessor3(target=es5).js.diff b/testdata/baselines/reference/submodule/conformance/autoAccessor3(target=es5).js.diff index cb69c9a637..c470bc2b27 100644 --- a/testdata/baselines/reference/submodule/conformance/autoAccessor3(target=es5).js.diff +++ b/testdata/baselines/reference/submodule/conformance/autoAccessor3(target=es5).js.diff @@ -1,12 +1,8 @@ --- old.autoAccessor3(target=es5).js +++ new.autoAccessor3(target=es5).js -@@= skipped -8, +8 lines =@@ - } +@@= skipped -12, +12 lines =@@ - -- -- --!!!! File autoAccessor3.js missing from original emit, but present in noCheck emit + !!!! File autoAccessor3.js missing from original emit, but present in noCheck emit //// [autoAccessor3.js] -var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); diff --git a/testdata/baselines/reference/submodule/conformance/autoAccessor4(target=es5).js b/testdata/baselines/reference/submodule/conformance/autoAccessor4(target=es5).js index 1e0ae8b496..7678436f1f 100644 --- a/testdata/baselines/reference/submodule/conformance/autoAccessor4(target=es5).js +++ b/testdata/baselines/reference/submodule/conformance/autoAccessor4(target=es5).js @@ -9,6 +9,9 @@ class C1 { } + + +!!!! File autoAccessor4.js missing from original emit, but present in noCheck emit //// [autoAccessor4.js] class C1 { accessor 0; diff --git a/testdata/baselines/reference/submodule/conformance/autoAccessor4(target=es5).js.diff b/testdata/baselines/reference/submodule/conformance/autoAccessor4(target=es5).js.diff index d5df0bdb3e..e68e9559aa 100644 --- a/testdata/baselines/reference/submodule/conformance/autoAccessor4(target=es5).js.diff +++ b/testdata/baselines/reference/submodule/conformance/autoAccessor4(target=es5).js.diff @@ -1,12 +1,8 @@ --- old.autoAccessor4(target=es5).js +++ new.autoAccessor4(target=es5).js -@@= skipped -8, +8 lines =@@ - } +@@= skipped -12, +12 lines =@@ - -- -- --!!!! File autoAccessor4.js missing from original emit, but present in noCheck emit + !!!! File autoAccessor4.js missing from original emit, but present in noCheck emit //// [autoAccessor4.js] -var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); diff --git a/testdata/baselines/reference/tsc/noEmit/when-project-has-strict-true.js b/testdata/baselines/reference/tsc/noEmit/when-project-has-strict-true.js index 1a7e68f680..6ea8717c03 100644 --- a/testdata/baselines/reference/tsc/noEmit/when-project-has-strict-true.js +++ b/testdata/baselines/reference/tsc/noEmit/when-project-has-strict-true.js @@ -20,4 +20,117 @@ CompilerOptions::{ Output:: //// [/home/src/workspaces/project/class1.ts] no change //// [/home/src/workspaces/project/tsconfig.json] no change +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] new file +{"Version":"FakeTSVersion","fileNames":["bundled:///libs/lib.d.ts","bundled:///libs/lib.es5.d.ts","bundled:///libs/lib.dom.d.ts","bundled:///libs/lib.webworker.importscripts.d.ts","bundled:///libs/lib.scripthost.d.ts","bundled:///libs/lib.decorators.d.ts","bundled:///libs/lib.decorators.legacy.d.ts","./class1.ts"],"fileInfos":["a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa",{"version":"69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedNodeFormat":1},"a7765a20d4489ae259632d5fe609919af401c278b7a90516894ef2774ce3bc97"],"options":{"strict":true},"affectedFilesPendingEmit":[8]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] new file +{ + "Version": "FakeTSVersion", + "fileNames": [ + "bundled:///libs/lib.d.ts", + "bundled:///libs/lib.es5.d.ts", + "bundled:///libs/lib.dom.d.ts", + "bundled:///libs/lib.webworker.importscripts.d.ts", + "bundled:///libs/lib.scripthost.d.ts", + "bundled:///libs/lib.decorators.d.ts", + "bundled:///libs/lib.decorators.legacy.d.ts", + "./class1.ts" + ], + "fileInfos": [ + { + "fileName": "bundled:///libs/lib.d.ts", + "version": "a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa", + "signature": "a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "bundled:///libs/lib.es5.d.ts", + "version": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", + "signature": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.dom.d.ts", + "version": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", + "signature": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.webworker.importscripts.d.ts", + "version": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", + "signature": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.scripthost.d.ts", + "version": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", + "signature": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.decorators.d.ts", + "version": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", + "signature": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.decorators.legacy.d.ts", + "version": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", + "signature": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./class1.ts", + "version": "a7765a20d4489ae259632d5fe609919af401c278b7a90516894ef2774ce3bc97", + "signature": "a7765a20d4489ae259632d5fe609919af401c278b7a90516894ef2774ce3bc97", + "impliedNodeFormat": "CommonJS" + } + ], + "options": { + "strict": true + }, + "affectedFilesPendingEmit": [ + [ + "./class1.ts", + "Js", + 8 + ] + ], + "size": 1283 +} diff --git a/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences2.js b/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences2.js index a61dbcf2e3..f91487e50f 100644 --- a/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences2.js +++ b/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences2.js @@ -48,6 +48,1064 @@ export {}; "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +//// [/home/src/workspaces/solution/dist/services/tsconfig.tsbuildinfo] new file +{"Version":"FakeTSVersion","fileNames":["bundled:///libs/lib.es5.d.ts","bundled:///libs/lib.es2015.d.ts","bundled:///libs/lib.es2016.d.ts","bundled:///libs/lib.es2017.d.ts","bundled:///libs/lib.es2018.d.ts","bundled:///libs/lib.es2019.d.ts","bundled:///libs/lib.es2020.d.ts","bundled:///libs/lib.es2021.d.ts","bundled:///libs/lib.es2022.d.ts","bundled:///libs/lib.es2023.d.ts","bundled:///libs/lib.es2024.d.ts","bundled:///libs/lib.esnext.d.ts","bundled:///libs/lib.dom.d.ts","bundled:///libs/lib.dom.iterable.d.ts","bundled:///libs/lib.dom.asynciterable.d.ts","bundled:///libs/lib.webworker.importscripts.d.ts","bundled:///libs/lib.scripthost.d.ts","bundled:///libs/lib.es2015.core.d.ts","bundled:///libs/lib.es2015.collection.d.ts","bundled:///libs/lib.es2015.generator.d.ts","bundled:///libs/lib.es2015.iterable.d.ts","bundled:///libs/lib.es2015.promise.d.ts","bundled:///libs/lib.es2015.proxy.d.ts","bundled:///libs/lib.es2015.reflect.d.ts","bundled:///libs/lib.es2015.symbol.d.ts","bundled:///libs/lib.es2015.symbol.wellknown.d.ts","bundled:///libs/lib.es2016.array.include.d.ts","bundled:///libs/lib.es2016.intl.d.ts","bundled:///libs/lib.es2017.arraybuffer.d.ts","bundled:///libs/lib.es2017.date.d.ts","bundled:///libs/lib.es2017.object.d.ts","bundled:///libs/lib.es2017.sharedmemory.d.ts","bundled:///libs/lib.es2017.string.d.ts","bundled:///libs/lib.es2017.intl.d.ts","bundled:///libs/lib.es2017.typedarrays.d.ts","bundled:///libs/lib.es2018.asyncgenerator.d.ts","bundled:///libs/lib.es2018.asynciterable.d.ts","bundled:///libs/lib.es2018.intl.d.ts","bundled:///libs/lib.es2018.promise.d.ts","bundled:///libs/lib.es2018.regexp.d.ts","bundled:///libs/lib.es2019.array.d.ts","bundled:///libs/lib.es2019.object.d.ts","bundled:///libs/lib.es2019.string.d.ts","bundled:///libs/lib.es2019.symbol.d.ts","bundled:///libs/lib.es2019.intl.d.ts","bundled:///libs/lib.es2020.bigint.d.ts","bundled:///libs/lib.es2020.date.d.ts","bundled:///libs/lib.es2020.promise.d.ts","bundled:///libs/lib.es2020.sharedmemory.d.ts","bundled:///libs/lib.es2020.string.d.ts","bundled:///libs/lib.es2020.symbol.wellknown.d.ts","bundled:///libs/lib.es2020.intl.d.ts","bundled:///libs/lib.es2020.number.d.ts","bundled:///libs/lib.es2021.promise.d.ts","bundled:///libs/lib.es2021.string.d.ts","bundled:///libs/lib.es2021.weakref.d.ts","bundled:///libs/lib.es2021.intl.d.ts","bundled:///libs/lib.es2022.array.d.ts","bundled:///libs/lib.es2022.error.d.ts","bundled:///libs/lib.es2022.intl.d.ts","bundled:///libs/lib.es2022.object.d.ts","bundled:///libs/lib.es2022.string.d.ts","bundled:///libs/lib.es2022.regexp.d.ts","bundled:///libs/lib.es2023.array.d.ts","bundled:///libs/lib.es2023.collection.d.ts","bundled:///libs/lib.es2023.intl.d.ts","bundled:///libs/lib.es2024.arraybuffer.d.ts","bundled:///libs/lib.es2024.collection.d.ts","bundled:///libs/lib.es2024.object.d.ts","bundled:///libs/lib.es2024.promise.d.ts","bundled:///libs/lib.es2024.regexp.d.ts","bundled:///libs/lib.es2024.sharedmemory.d.ts","bundled:///libs/lib.es2024.string.d.ts","bundled:///libs/lib.esnext.array.d.ts","bundled:///libs/lib.esnext.collection.d.ts","bundled:///libs/lib.esnext.intl.d.ts","bundled:///libs/lib.esnext.disposable.d.ts","bundled:///libs/lib.esnext.promise.d.ts","bundled:///libs/lib.esnext.decorators.d.ts","bundled:///libs/lib.esnext.iterator.d.ts","bundled:///libs/lib.esnext.float16.d.ts","bundled:///libs/lib.decorators.d.ts","bundled:///libs/lib.decorators.legacy.d.ts","bundled:///libs/lib.esnext.full.d.ts","../compiler/parser.d.ts","../../src/services/services.ts"],"fileInfos":[{"version":"69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546","affectsGlobalScope":true,"impliedNodeFormat":1},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","27bdc30a0e32783366a5abeda841bc22757c1797de8681bbe81fbc735eeb1c10","8fd575e12870e9944c7e1d62e1f5a73fcf23dd8d3a321f2a2c74c20d022283fe","8bf8b5e44e3c9c36f98e1007e8b7018c0f38d8adc07aecef42f5200114547c70",{"version":"092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"07f073f19d67f74d732b1adea08e1dc66b1b58d77cb5b43931dee3d798a2fd53","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d7a3c8b952931daebdfc7a2897c53c0a1c73624593fa070e46bd537e64dcd20a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b5ce7a470bc3628408429040c4e3a53a27755022a32fd05e2cb694e7015386c7","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"df83c2a6c73228b625b0beb6669c7ee2a09c914637e2d35170723ad49c0f5cd4","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8e3c06ea092138bf9fa5e874a1fdbc9d54805d074bee1de31b99a11e2fec239d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"87dc0f382502f5bbce5129bdc0aea21e19a3abbc19259e0b43ae038a9fc4e326","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b1cb28af0c891c8c96b2d6b7be76bd394fddcfdb4709a20ba05a7c1605eea0f9","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2fef54945a13095fdb9b84f705f2b5994597640c46afeb2ce78352fab4cb3279","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ac77cb3e8c6d3565793eb90a8373ee8033146315a3dbead3bde8db5eaf5e5ec6","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"56e4ed5aab5f5920980066a9409bfaf53e6d21d3f8d020c17e4de584d29600ad","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4ece9f17b3866cc077099c73f4983bddbcb1dc7ddb943227f1ec070f529dedd1","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0a6282c8827e4b9a95f4bf4f5c205673ada31b982f50572d27103df8ceb8013c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1c9319a09485199c1f7b0498f2988d6d2249793ef67edda49d1e584746be9032","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"e3a2a0cee0f03ffdde24d89660eba2685bfbdeae955a6c67e8c4c9fd28928eeb","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"51ad4c928303041605b4d7ae32e0c1ee387d43a24cd6f1ebf4a2699e1076d4fa","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"60037901da1a425516449b9a20073aa03386cce92f7a1fd902d7602be3a7c2e9","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"22adec94ef7047a6c9d1af3cb96be87a335908bf9ef386ae9fd50eeb37f44c47","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4245fee526a7d1754529d19227ecbf3be066ff79ebb6a380d78e41648f2f224d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedNodeFormat":1},"bde31fd423cd93b0eff97197a3f66df7c93e8c0c335cbeb113b7ff1ac35c23f4","2e29cd9a98755c46896f7a2d56524db2d6d96b248e36db46de14c30bf47c8d05",{"version":"407537635fda1a543a422ecdd456c1402aaa2083cde5acfb4eb424ab02fc0612","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"options":{"composite":true,"module":199,"outDir":"..","rewriteRelativeImportExtensions":true,"rootDir":"../../src"},"latestChangedDtsFile":"./services.d.ts"} +//// [/home/src/workspaces/solution/dist/services/tsconfig.tsbuildinfo.readable.baseline.txt] new file +{ + "Version": "FakeTSVersion", + "fileNames": [ + "bundled:///libs/lib.es5.d.ts", + "bundled:///libs/lib.es2015.d.ts", + "bundled:///libs/lib.es2016.d.ts", + "bundled:///libs/lib.es2017.d.ts", + "bundled:///libs/lib.es2018.d.ts", + "bundled:///libs/lib.es2019.d.ts", + "bundled:///libs/lib.es2020.d.ts", + "bundled:///libs/lib.es2021.d.ts", + "bundled:///libs/lib.es2022.d.ts", + "bundled:///libs/lib.es2023.d.ts", + "bundled:///libs/lib.es2024.d.ts", + "bundled:///libs/lib.esnext.d.ts", + "bundled:///libs/lib.dom.d.ts", + "bundled:///libs/lib.dom.iterable.d.ts", + "bundled:///libs/lib.dom.asynciterable.d.ts", + "bundled:///libs/lib.webworker.importscripts.d.ts", + "bundled:///libs/lib.scripthost.d.ts", + "bundled:///libs/lib.es2015.core.d.ts", + "bundled:///libs/lib.es2015.collection.d.ts", + "bundled:///libs/lib.es2015.generator.d.ts", + "bundled:///libs/lib.es2015.iterable.d.ts", + "bundled:///libs/lib.es2015.promise.d.ts", + "bundled:///libs/lib.es2015.proxy.d.ts", + "bundled:///libs/lib.es2015.reflect.d.ts", + "bundled:///libs/lib.es2015.symbol.d.ts", + "bundled:///libs/lib.es2015.symbol.wellknown.d.ts", + "bundled:///libs/lib.es2016.array.include.d.ts", + "bundled:///libs/lib.es2016.intl.d.ts", + "bundled:///libs/lib.es2017.arraybuffer.d.ts", + "bundled:///libs/lib.es2017.date.d.ts", + "bundled:///libs/lib.es2017.object.d.ts", + "bundled:///libs/lib.es2017.sharedmemory.d.ts", + "bundled:///libs/lib.es2017.string.d.ts", + "bundled:///libs/lib.es2017.intl.d.ts", + "bundled:///libs/lib.es2017.typedarrays.d.ts", + "bundled:///libs/lib.es2018.asyncgenerator.d.ts", + "bundled:///libs/lib.es2018.asynciterable.d.ts", + "bundled:///libs/lib.es2018.intl.d.ts", + "bundled:///libs/lib.es2018.promise.d.ts", + "bundled:///libs/lib.es2018.regexp.d.ts", + "bundled:///libs/lib.es2019.array.d.ts", + "bundled:///libs/lib.es2019.object.d.ts", + "bundled:///libs/lib.es2019.string.d.ts", + "bundled:///libs/lib.es2019.symbol.d.ts", + "bundled:///libs/lib.es2019.intl.d.ts", + "bundled:///libs/lib.es2020.bigint.d.ts", + "bundled:///libs/lib.es2020.date.d.ts", + "bundled:///libs/lib.es2020.promise.d.ts", + "bundled:///libs/lib.es2020.sharedmemory.d.ts", + "bundled:///libs/lib.es2020.string.d.ts", + "bundled:///libs/lib.es2020.symbol.wellknown.d.ts", + "bundled:///libs/lib.es2020.intl.d.ts", + "bundled:///libs/lib.es2020.number.d.ts", + "bundled:///libs/lib.es2021.promise.d.ts", + "bundled:///libs/lib.es2021.string.d.ts", + "bundled:///libs/lib.es2021.weakref.d.ts", + "bundled:///libs/lib.es2021.intl.d.ts", + "bundled:///libs/lib.es2022.array.d.ts", + "bundled:///libs/lib.es2022.error.d.ts", + "bundled:///libs/lib.es2022.intl.d.ts", + "bundled:///libs/lib.es2022.object.d.ts", + "bundled:///libs/lib.es2022.string.d.ts", + "bundled:///libs/lib.es2022.regexp.d.ts", + "bundled:///libs/lib.es2023.array.d.ts", + "bundled:///libs/lib.es2023.collection.d.ts", + "bundled:///libs/lib.es2023.intl.d.ts", + "bundled:///libs/lib.es2024.arraybuffer.d.ts", + "bundled:///libs/lib.es2024.collection.d.ts", + "bundled:///libs/lib.es2024.object.d.ts", + "bundled:///libs/lib.es2024.promise.d.ts", + "bundled:///libs/lib.es2024.regexp.d.ts", + "bundled:///libs/lib.es2024.sharedmemory.d.ts", + "bundled:///libs/lib.es2024.string.d.ts", + "bundled:///libs/lib.esnext.array.d.ts", + "bundled:///libs/lib.esnext.collection.d.ts", + "bundled:///libs/lib.esnext.intl.d.ts", + "bundled:///libs/lib.esnext.disposable.d.ts", + "bundled:///libs/lib.esnext.promise.d.ts", + "bundled:///libs/lib.esnext.decorators.d.ts", + "bundled:///libs/lib.esnext.iterator.d.ts", + "bundled:///libs/lib.esnext.float16.d.ts", + "bundled:///libs/lib.decorators.d.ts", + "bundled:///libs/lib.decorators.legacy.d.ts", + "bundled:///libs/lib.esnext.full.d.ts", + "../compiler/parser.d.ts", + "../../src/services/services.ts" + ], + "fileInfos": [ + { + "fileName": "bundled:///libs/lib.es5.d.ts", + "version": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", + "signature": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2015.d.ts", + "version": "45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4", + "signature": "45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "bundled:///libs/lib.es2016.d.ts", + "version": "3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75", + "signature": "3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "bundled:///libs/lib.es2017.d.ts", + "version": "e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962", + "signature": "e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "bundled:///libs/lib.es2018.d.ts", + "version": "5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8", + "signature": "5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "bundled:///libs/lib.es2019.d.ts", + "version": "68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7", + "signature": "68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "bundled:///libs/lib.es2020.d.ts", + "version": "5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4", + "signature": "5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "bundled:///libs/lib.es2021.d.ts", + "version": "feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569", + "signature": "feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "bundled:///libs/lib.es2022.d.ts", + "version": "ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2", + "signature": "ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "bundled:///libs/lib.es2023.d.ts", + "version": "27bdc30a0e32783366a5abeda841bc22757c1797de8681bbe81fbc735eeb1c10", + "signature": "27bdc30a0e32783366a5abeda841bc22757c1797de8681bbe81fbc735eeb1c10", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "bundled:///libs/lib.es2024.d.ts", + "version": "8fd575e12870e9944c7e1d62e1f5a73fcf23dd8d3a321f2a2c74c20d022283fe", + "signature": "8fd575e12870e9944c7e1d62e1f5a73fcf23dd8d3a321f2a2c74c20d022283fe", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "bundled:///libs/lib.esnext.d.ts", + "version": "8bf8b5e44e3c9c36f98e1007e8b7018c0f38d8adc07aecef42f5200114547c70", + "signature": "8bf8b5e44e3c9c36f98e1007e8b7018c0f38d8adc07aecef42f5200114547c70", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "bundled:///libs/lib.dom.d.ts", + "version": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", + "signature": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.dom.iterable.d.ts", + "version": "07f073f19d67f74d732b1adea08e1dc66b1b58d77cb5b43931dee3d798a2fd53", + "signature": "07f073f19d67f74d732b1adea08e1dc66b1b58d77cb5b43931dee3d798a2fd53", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "07f073f19d67f74d732b1adea08e1dc66b1b58d77cb5b43931dee3d798a2fd53", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.dom.asynciterable.d.ts", + "version": "d7a3c8b952931daebdfc7a2897c53c0a1c73624593fa070e46bd537e64dcd20a", + "signature": "d7a3c8b952931daebdfc7a2897c53c0a1c73624593fa070e46bd537e64dcd20a", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "d7a3c8b952931daebdfc7a2897c53c0a1c73624593fa070e46bd537e64dcd20a", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.webworker.importscripts.d.ts", + "version": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", + "signature": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.scripthost.d.ts", + "version": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", + "signature": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2015.core.d.ts", + "version": "c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671", + "signature": "c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2015.collection.d.ts", + "version": "dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44", + "signature": "dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2015.generator.d.ts", + "version": "515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71", + "signature": "515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2015.iterable.d.ts", + "version": "0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3", + "signature": "0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2015.promise.d.ts", + "version": "0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537", + "signature": "0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2015.proxy.d.ts", + "version": "ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671", + "signature": "ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2015.reflect.d.ts", + "version": "8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0", + "signature": "8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2015.symbol.d.ts", + "version": "4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d", + "signature": "4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2015.symbol.wellknown.d.ts", + "version": "936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df", + "signature": "936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2016.array.include.d.ts", + "version": "d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a", + "signature": "d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2016.intl.d.ts", + "version": "68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618", + "signature": "68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2017.arraybuffer.d.ts", + "version": "eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a", + "signature": "eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2017.date.d.ts", + "version": "38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119", + "signature": "38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2017.object.d.ts", + "version": "69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e", + "signature": "69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2017.sharedmemory.d.ts", + "version": "fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab", + "signature": "fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2017.string.d.ts", + "version": "2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893", + "signature": "2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2017.intl.d.ts", + "version": "4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc", + "signature": "4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2017.typedarrays.d.ts", + "version": "954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667", + "signature": "954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2018.asyncgenerator.d.ts", + "version": "ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c", + "signature": "ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2018.asynciterable.d.ts", + "version": "0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376", + "signature": "0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2018.intl.d.ts", + "version": "9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb", + "signature": "9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2018.promise.d.ts", + "version": "811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c", + "signature": "811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2018.regexp.d.ts", + "version": "717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca", + "signature": "717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2019.array.d.ts", + "version": "d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2", + "signature": "d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2019.object.d.ts", + "version": "71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557", + "signature": "71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2019.string.d.ts", + "version": "576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850", + "signature": "576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2019.symbol.d.ts", + "version": "89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6", + "signature": "89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2019.intl.d.ts", + "version": "74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b", + "signature": "74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2020.bigint.d.ts", + "version": "d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca", + "signature": "d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2020.date.d.ts", + "version": "063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df", + "signature": "063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2020.promise.d.ts", + "version": "934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab", + "signature": "934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2020.sharedmemory.d.ts", + "version": "52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47", + "signature": "52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2020.string.d.ts", + "version": "3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6", + "signature": "3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2020.symbol.wellknown.d.ts", + "version": "59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867", + "signature": "59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2020.intl.d.ts", + "version": "639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a", + "signature": "639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2020.number.d.ts", + "version": "368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1", + "signature": "368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2021.promise.d.ts", + "version": "af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74", + "signature": "af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2021.string.d.ts", + "version": "995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399", + "signature": "995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2021.weakref.d.ts", + "version": "959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a", + "signature": "959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2021.intl.d.ts", + "version": "965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d", + "signature": "965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2022.array.d.ts", + "version": "3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b", + "signature": "3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2022.error.d.ts", + "version": "0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005", + "signature": "0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2022.intl.d.ts", + "version": "b5ce7a470bc3628408429040c4e3a53a27755022a32fd05e2cb694e7015386c7", + "signature": "b5ce7a470bc3628408429040c4e3a53a27755022a32fd05e2cb694e7015386c7", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "b5ce7a470bc3628408429040c4e3a53a27755022a32fd05e2cb694e7015386c7", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2022.object.d.ts", + "version": "8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a", + "signature": "8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2022.string.d.ts", + "version": "3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004", + "signature": "3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2022.regexp.d.ts", + "version": "b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad", + "signature": "b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2023.array.d.ts", + "version": "df83c2a6c73228b625b0beb6669c7ee2a09c914637e2d35170723ad49c0f5cd4", + "signature": "df83c2a6c73228b625b0beb6669c7ee2a09c914637e2d35170723ad49c0f5cd4", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "df83c2a6c73228b625b0beb6669c7ee2a09c914637e2d35170723ad49c0f5cd4", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2023.collection.d.ts", + "version": "436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a", + "signature": "436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2023.intl.d.ts", + "version": "8e3c06ea092138bf9fa5e874a1fdbc9d54805d074bee1de31b99a11e2fec239d", + "signature": "8e3c06ea092138bf9fa5e874a1fdbc9d54805d074bee1de31b99a11e2fec239d", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "8e3c06ea092138bf9fa5e874a1fdbc9d54805d074bee1de31b99a11e2fec239d", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2024.arraybuffer.d.ts", + "version": "87dc0f382502f5bbce5129bdc0aea21e19a3abbc19259e0b43ae038a9fc4e326", + "signature": "87dc0f382502f5bbce5129bdc0aea21e19a3abbc19259e0b43ae038a9fc4e326", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "87dc0f382502f5bbce5129bdc0aea21e19a3abbc19259e0b43ae038a9fc4e326", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2024.collection.d.ts", + "version": "b1cb28af0c891c8c96b2d6b7be76bd394fddcfdb4709a20ba05a7c1605eea0f9", + "signature": "b1cb28af0c891c8c96b2d6b7be76bd394fddcfdb4709a20ba05a7c1605eea0f9", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "b1cb28af0c891c8c96b2d6b7be76bd394fddcfdb4709a20ba05a7c1605eea0f9", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2024.object.d.ts", + "version": "2fef54945a13095fdb9b84f705f2b5994597640c46afeb2ce78352fab4cb3279", + "signature": "2fef54945a13095fdb9b84f705f2b5994597640c46afeb2ce78352fab4cb3279", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "2fef54945a13095fdb9b84f705f2b5994597640c46afeb2ce78352fab4cb3279", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2024.promise.d.ts", + "version": "ac77cb3e8c6d3565793eb90a8373ee8033146315a3dbead3bde8db5eaf5e5ec6", + "signature": "ac77cb3e8c6d3565793eb90a8373ee8033146315a3dbead3bde8db5eaf5e5ec6", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "ac77cb3e8c6d3565793eb90a8373ee8033146315a3dbead3bde8db5eaf5e5ec6", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2024.regexp.d.ts", + "version": "56e4ed5aab5f5920980066a9409bfaf53e6d21d3f8d020c17e4de584d29600ad", + "signature": "56e4ed5aab5f5920980066a9409bfaf53e6d21d3f8d020c17e4de584d29600ad", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "56e4ed5aab5f5920980066a9409bfaf53e6d21d3f8d020c17e4de584d29600ad", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2024.sharedmemory.d.ts", + "version": "4ece9f17b3866cc077099c73f4983bddbcb1dc7ddb943227f1ec070f529dedd1", + "signature": "4ece9f17b3866cc077099c73f4983bddbcb1dc7ddb943227f1ec070f529dedd1", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "4ece9f17b3866cc077099c73f4983bddbcb1dc7ddb943227f1ec070f529dedd1", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2024.string.d.ts", + "version": "0a6282c8827e4b9a95f4bf4f5c205673ada31b982f50572d27103df8ceb8013c", + "signature": "0a6282c8827e4b9a95f4bf4f5c205673ada31b982f50572d27103df8ceb8013c", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "0a6282c8827e4b9a95f4bf4f5c205673ada31b982f50572d27103df8ceb8013c", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.esnext.array.d.ts", + "version": "1c9319a09485199c1f7b0498f2988d6d2249793ef67edda49d1e584746be9032", + "signature": "1c9319a09485199c1f7b0498f2988d6d2249793ef67edda49d1e584746be9032", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "1c9319a09485199c1f7b0498f2988d6d2249793ef67edda49d1e584746be9032", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.esnext.collection.d.ts", + "version": "e3a2a0cee0f03ffdde24d89660eba2685bfbdeae955a6c67e8c4c9fd28928eeb", + "signature": "e3a2a0cee0f03ffdde24d89660eba2685bfbdeae955a6c67e8c4c9fd28928eeb", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "e3a2a0cee0f03ffdde24d89660eba2685bfbdeae955a6c67e8c4c9fd28928eeb", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.esnext.intl.d.ts", + "version": "811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4", + "signature": "811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.esnext.disposable.d.ts", + "version": "51ad4c928303041605b4d7ae32e0c1ee387d43a24cd6f1ebf4a2699e1076d4fa", + "signature": "51ad4c928303041605b4d7ae32e0c1ee387d43a24cd6f1ebf4a2699e1076d4fa", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "51ad4c928303041605b4d7ae32e0c1ee387d43a24cd6f1ebf4a2699e1076d4fa", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.esnext.promise.d.ts", + "version": "60037901da1a425516449b9a20073aa03386cce92f7a1fd902d7602be3a7c2e9", + "signature": "60037901da1a425516449b9a20073aa03386cce92f7a1fd902d7602be3a7c2e9", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "60037901da1a425516449b9a20073aa03386cce92f7a1fd902d7602be3a7c2e9", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.esnext.decorators.d.ts", + "version": "d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f", + "signature": "d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.esnext.iterator.d.ts", + "version": "22adec94ef7047a6c9d1af3cb96be87a335908bf9ef386ae9fd50eeb37f44c47", + "signature": "22adec94ef7047a6c9d1af3cb96be87a335908bf9ef386ae9fd50eeb37f44c47", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "22adec94ef7047a6c9d1af3cb96be87a335908bf9ef386ae9fd50eeb37f44c47", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.esnext.float16.d.ts", + "version": "4245fee526a7d1754529d19227ecbf3be066ff79ebb6a380d78e41648f2f224d", + "signature": "4245fee526a7d1754529d19227ecbf3be066ff79ebb6a380d78e41648f2f224d", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "4245fee526a7d1754529d19227ecbf3be066ff79ebb6a380d78e41648f2f224d", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.decorators.d.ts", + "version": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", + "signature": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.decorators.legacy.d.ts", + "version": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", + "signature": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.esnext.full.d.ts", + "version": "bde31fd423cd93b0eff97197a3f66df7c93e8c0c335cbeb113b7ff1ac35c23f4", + "signature": "bde31fd423cd93b0eff97197a3f66df7c93e8c0c335cbeb113b7ff1ac35c23f4", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "../compiler/parser.d.ts", + "version": "2e29cd9a98755c46896f7a2d56524db2d6d96b248e36db46de14c30bf47c8d05", + "signature": "2e29cd9a98755c46896f7a2d56524db2d6d96b248e36db46de14c30bf47c8d05", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "../../src/services/services.ts", + "version": "407537635fda1a543a422ecdd456c1402aaa2083cde5acfb4eb424ab02fc0612", + "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "407537635fda1a543a422ecdd456c1402aaa2083cde5acfb4eb424ab02fc0612", + "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", + "impliedNodeFormat": 1 + } + } + ], + "options": { + "composite": true, + "module": 199, + "outDir": "..", + "rewriteRelativeImportExtensions": true, + "rootDir": "../../src" + }, + "latestChangedDtsFile": "./services.d.ts", + "size": 13908 +} //// [/home/src/workspaces/solution/src/compiler/parser.ts] no change //// [/home/src/workspaces/solution/src/compiler/tsconfig.json] no change //// [/home/src/workspaces/solution/src/services/services.ts] no change diff --git a/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences3.js b/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences3.js index 06f119bd43..525e3fece6 100644 --- a/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences3.js +++ b/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences3.js @@ -52,6 +52,1064 @@ export {}; "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +//// [/home/src/workspaces/solution/dist/services/tsconfig.tsbuildinfo] new file +{"Version":"FakeTSVersion","fileNames":["bundled:///libs/lib.es5.d.ts","bundled:///libs/lib.es2015.d.ts","bundled:///libs/lib.es2016.d.ts","bundled:///libs/lib.es2017.d.ts","bundled:///libs/lib.es2018.d.ts","bundled:///libs/lib.es2019.d.ts","bundled:///libs/lib.es2020.d.ts","bundled:///libs/lib.es2021.d.ts","bundled:///libs/lib.es2022.d.ts","bundled:///libs/lib.es2023.d.ts","bundled:///libs/lib.es2024.d.ts","bundled:///libs/lib.esnext.d.ts","bundled:///libs/lib.dom.d.ts","bundled:///libs/lib.dom.iterable.d.ts","bundled:///libs/lib.dom.asynciterable.d.ts","bundled:///libs/lib.webworker.importscripts.d.ts","bundled:///libs/lib.scripthost.d.ts","bundled:///libs/lib.es2015.core.d.ts","bundled:///libs/lib.es2015.collection.d.ts","bundled:///libs/lib.es2015.generator.d.ts","bundled:///libs/lib.es2015.iterable.d.ts","bundled:///libs/lib.es2015.promise.d.ts","bundled:///libs/lib.es2015.proxy.d.ts","bundled:///libs/lib.es2015.reflect.d.ts","bundled:///libs/lib.es2015.symbol.d.ts","bundled:///libs/lib.es2015.symbol.wellknown.d.ts","bundled:///libs/lib.es2016.array.include.d.ts","bundled:///libs/lib.es2016.intl.d.ts","bundled:///libs/lib.es2017.arraybuffer.d.ts","bundled:///libs/lib.es2017.date.d.ts","bundled:///libs/lib.es2017.object.d.ts","bundled:///libs/lib.es2017.sharedmemory.d.ts","bundled:///libs/lib.es2017.string.d.ts","bundled:///libs/lib.es2017.intl.d.ts","bundled:///libs/lib.es2017.typedarrays.d.ts","bundled:///libs/lib.es2018.asyncgenerator.d.ts","bundled:///libs/lib.es2018.asynciterable.d.ts","bundled:///libs/lib.es2018.intl.d.ts","bundled:///libs/lib.es2018.promise.d.ts","bundled:///libs/lib.es2018.regexp.d.ts","bundled:///libs/lib.es2019.array.d.ts","bundled:///libs/lib.es2019.object.d.ts","bundled:///libs/lib.es2019.string.d.ts","bundled:///libs/lib.es2019.symbol.d.ts","bundled:///libs/lib.es2019.intl.d.ts","bundled:///libs/lib.es2020.bigint.d.ts","bundled:///libs/lib.es2020.date.d.ts","bundled:///libs/lib.es2020.promise.d.ts","bundled:///libs/lib.es2020.sharedmemory.d.ts","bundled:///libs/lib.es2020.string.d.ts","bundled:///libs/lib.es2020.symbol.wellknown.d.ts","bundled:///libs/lib.es2020.intl.d.ts","bundled:///libs/lib.es2020.number.d.ts","bundled:///libs/lib.es2021.promise.d.ts","bundled:///libs/lib.es2021.string.d.ts","bundled:///libs/lib.es2021.weakref.d.ts","bundled:///libs/lib.es2021.intl.d.ts","bundled:///libs/lib.es2022.array.d.ts","bundled:///libs/lib.es2022.error.d.ts","bundled:///libs/lib.es2022.intl.d.ts","bundled:///libs/lib.es2022.object.d.ts","bundled:///libs/lib.es2022.string.d.ts","bundled:///libs/lib.es2022.regexp.d.ts","bundled:///libs/lib.es2023.array.d.ts","bundled:///libs/lib.es2023.collection.d.ts","bundled:///libs/lib.es2023.intl.d.ts","bundled:///libs/lib.es2024.arraybuffer.d.ts","bundled:///libs/lib.es2024.collection.d.ts","bundled:///libs/lib.es2024.object.d.ts","bundled:///libs/lib.es2024.promise.d.ts","bundled:///libs/lib.es2024.regexp.d.ts","bundled:///libs/lib.es2024.sharedmemory.d.ts","bundled:///libs/lib.es2024.string.d.ts","bundled:///libs/lib.esnext.array.d.ts","bundled:///libs/lib.esnext.collection.d.ts","bundled:///libs/lib.esnext.intl.d.ts","bundled:///libs/lib.esnext.disposable.d.ts","bundled:///libs/lib.esnext.promise.d.ts","bundled:///libs/lib.esnext.decorators.d.ts","bundled:///libs/lib.esnext.iterator.d.ts","bundled:///libs/lib.esnext.float16.d.ts","bundled:///libs/lib.decorators.d.ts","bundled:///libs/lib.decorators.legacy.d.ts","bundled:///libs/lib.esnext.full.d.ts","../compiler/parser.d.ts","../../src/services/services.ts"],"fileInfos":[{"version":"69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546","affectsGlobalScope":true,"impliedNodeFormat":1},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","27bdc30a0e32783366a5abeda841bc22757c1797de8681bbe81fbc735eeb1c10","8fd575e12870e9944c7e1d62e1f5a73fcf23dd8d3a321f2a2c74c20d022283fe","8bf8b5e44e3c9c36f98e1007e8b7018c0f38d8adc07aecef42f5200114547c70",{"version":"092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"07f073f19d67f74d732b1adea08e1dc66b1b58d77cb5b43931dee3d798a2fd53","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d7a3c8b952931daebdfc7a2897c53c0a1c73624593fa070e46bd537e64dcd20a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b5ce7a470bc3628408429040c4e3a53a27755022a32fd05e2cb694e7015386c7","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"df83c2a6c73228b625b0beb6669c7ee2a09c914637e2d35170723ad49c0f5cd4","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8e3c06ea092138bf9fa5e874a1fdbc9d54805d074bee1de31b99a11e2fec239d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"87dc0f382502f5bbce5129bdc0aea21e19a3abbc19259e0b43ae038a9fc4e326","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b1cb28af0c891c8c96b2d6b7be76bd394fddcfdb4709a20ba05a7c1605eea0f9","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2fef54945a13095fdb9b84f705f2b5994597640c46afeb2ce78352fab4cb3279","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ac77cb3e8c6d3565793eb90a8373ee8033146315a3dbead3bde8db5eaf5e5ec6","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"56e4ed5aab5f5920980066a9409bfaf53e6d21d3f8d020c17e4de584d29600ad","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4ece9f17b3866cc077099c73f4983bddbcb1dc7ddb943227f1ec070f529dedd1","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0a6282c8827e4b9a95f4bf4f5c205673ada31b982f50572d27103df8ceb8013c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1c9319a09485199c1f7b0498f2988d6d2249793ef67edda49d1e584746be9032","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"e3a2a0cee0f03ffdde24d89660eba2685bfbdeae955a6c67e8c4c9fd28928eeb","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"51ad4c928303041605b4d7ae32e0c1ee387d43a24cd6f1ebf4a2699e1076d4fa","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"60037901da1a425516449b9a20073aa03386cce92f7a1fd902d7602be3a7c2e9","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"22adec94ef7047a6c9d1af3cb96be87a335908bf9ef386ae9fd50eeb37f44c47","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4245fee526a7d1754529d19227ecbf3be066ff79ebb6a380d78e41648f2f224d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedNodeFormat":1},"bde31fd423cd93b0eff97197a3f66df7c93e8c0c335cbeb113b7ff1ac35c23f4","2e29cd9a98755c46896f7a2d56524db2d6d96b248e36db46de14c30bf47c8d05",{"version":"407537635fda1a543a422ecdd456c1402aaa2083cde5acfb4eb424ab02fc0612","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"options":{"composite":true,"module":199,"outDir":"./","rewriteRelativeImportExtensions":true,"rootDir":"../../src/services"},"latestChangedDtsFile":"./services.d.ts"} +//// [/home/src/workspaces/solution/dist/services/tsconfig.tsbuildinfo.readable.baseline.txt] new file +{ + "Version": "FakeTSVersion", + "fileNames": [ + "bundled:///libs/lib.es5.d.ts", + "bundled:///libs/lib.es2015.d.ts", + "bundled:///libs/lib.es2016.d.ts", + "bundled:///libs/lib.es2017.d.ts", + "bundled:///libs/lib.es2018.d.ts", + "bundled:///libs/lib.es2019.d.ts", + "bundled:///libs/lib.es2020.d.ts", + "bundled:///libs/lib.es2021.d.ts", + "bundled:///libs/lib.es2022.d.ts", + "bundled:///libs/lib.es2023.d.ts", + "bundled:///libs/lib.es2024.d.ts", + "bundled:///libs/lib.esnext.d.ts", + "bundled:///libs/lib.dom.d.ts", + "bundled:///libs/lib.dom.iterable.d.ts", + "bundled:///libs/lib.dom.asynciterable.d.ts", + "bundled:///libs/lib.webworker.importscripts.d.ts", + "bundled:///libs/lib.scripthost.d.ts", + "bundled:///libs/lib.es2015.core.d.ts", + "bundled:///libs/lib.es2015.collection.d.ts", + "bundled:///libs/lib.es2015.generator.d.ts", + "bundled:///libs/lib.es2015.iterable.d.ts", + "bundled:///libs/lib.es2015.promise.d.ts", + "bundled:///libs/lib.es2015.proxy.d.ts", + "bundled:///libs/lib.es2015.reflect.d.ts", + "bundled:///libs/lib.es2015.symbol.d.ts", + "bundled:///libs/lib.es2015.symbol.wellknown.d.ts", + "bundled:///libs/lib.es2016.array.include.d.ts", + "bundled:///libs/lib.es2016.intl.d.ts", + "bundled:///libs/lib.es2017.arraybuffer.d.ts", + "bundled:///libs/lib.es2017.date.d.ts", + "bundled:///libs/lib.es2017.object.d.ts", + "bundled:///libs/lib.es2017.sharedmemory.d.ts", + "bundled:///libs/lib.es2017.string.d.ts", + "bundled:///libs/lib.es2017.intl.d.ts", + "bundled:///libs/lib.es2017.typedarrays.d.ts", + "bundled:///libs/lib.es2018.asyncgenerator.d.ts", + "bundled:///libs/lib.es2018.asynciterable.d.ts", + "bundled:///libs/lib.es2018.intl.d.ts", + "bundled:///libs/lib.es2018.promise.d.ts", + "bundled:///libs/lib.es2018.regexp.d.ts", + "bundled:///libs/lib.es2019.array.d.ts", + "bundled:///libs/lib.es2019.object.d.ts", + "bundled:///libs/lib.es2019.string.d.ts", + "bundled:///libs/lib.es2019.symbol.d.ts", + "bundled:///libs/lib.es2019.intl.d.ts", + "bundled:///libs/lib.es2020.bigint.d.ts", + "bundled:///libs/lib.es2020.date.d.ts", + "bundled:///libs/lib.es2020.promise.d.ts", + "bundled:///libs/lib.es2020.sharedmemory.d.ts", + "bundled:///libs/lib.es2020.string.d.ts", + "bundled:///libs/lib.es2020.symbol.wellknown.d.ts", + "bundled:///libs/lib.es2020.intl.d.ts", + "bundled:///libs/lib.es2020.number.d.ts", + "bundled:///libs/lib.es2021.promise.d.ts", + "bundled:///libs/lib.es2021.string.d.ts", + "bundled:///libs/lib.es2021.weakref.d.ts", + "bundled:///libs/lib.es2021.intl.d.ts", + "bundled:///libs/lib.es2022.array.d.ts", + "bundled:///libs/lib.es2022.error.d.ts", + "bundled:///libs/lib.es2022.intl.d.ts", + "bundled:///libs/lib.es2022.object.d.ts", + "bundled:///libs/lib.es2022.string.d.ts", + "bundled:///libs/lib.es2022.regexp.d.ts", + "bundled:///libs/lib.es2023.array.d.ts", + "bundled:///libs/lib.es2023.collection.d.ts", + "bundled:///libs/lib.es2023.intl.d.ts", + "bundled:///libs/lib.es2024.arraybuffer.d.ts", + "bundled:///libs/lib.es2024.collection.d.ts", + "bundled:///libs/lib.es2024.object.d.ts", + "bundled:///libs/lib.es2024.promise.d.ts", + "bundled:///libs/lib.es2024.regexp.d.ts", + "bundled:///libs/lib.es2024.sharedmemory.d.ts", + "bundled:///libs/lib.es2024.string.d.ts", + "bundled:///libs/lib.esnext.array.d.ts", + "bundled:///libs/lib.esnext.collection.d.ts", + "bundled:///libs/lib.esnext.intl.d.ts", + "bundled:///libs/lib.esnext.disposable.d.ts", + "bundled:///libs/lib.esnext.promise.d.ts", + "bundled:///libs/lib.esnext.decorators.d.ts", + "bundled:///libs/lib.esnext.iterator.d.ts", + "bundled:///libs/lib.esnext.float16.d.ts", + "bundled:///libs/lib.decorators.d.ts", + "bundled:///libs/lib.decorators.legacy.d.ts", + "bundled:///libs/lib.esnext.full.d.ts", + "../compiler/parser.d.ts", + "../../src/services/services.ts" + ], + "fileInfos": [ + { + "fileName": "bundled:///libs/lib.es5.d.ts", + "version": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", + "signature": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2015.d.ts", + "version": "45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4", + "signature": "45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "bundled:///libs/lib.es2016.d.ts", + "version": "3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75", + "signature": "3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "bundled:///libs/lib.es2017.d.ts", + "version": "e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962", + "signature": "e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "bundled:///libs/lib.es2018.d.ts", + "version": "5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8", + "signature": "5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "bundled:///libs/lib.es2019.d.ts", + "version": "68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7", + "signature": "68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "bundled:///libs/lib.es2020.d.ts", + "version": "5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4", + "signature": "5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "bundled:///libs/lib.es2021.d.ts", + "version": "feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569", + "signature": "feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "bundled:///libs/lib.es2022.d.ts", + "version": "ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2", + "signature": "ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "bundled:///libs/lib.es2023.d.ts", + "version": "27bdc30a0e32783366a5abeda841bc22757c1797de8681bbe81fbc735eeb1c10", + "signature": "27bdc30a0e32783366a5abeda841bc22757c1797de8681bbe81fbc735eeb1c10", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "bundled:///libs/lib.es2024.d.ts", + "version": "8fd575e12870e9944c7e1d62e1f5a73fcf23dd8d3a321f2a2c74c20d022283fe", + "signature": "8fd575e12870e9944c7e1d62e1f5a73fcf23dd8d3a321f2a2c74c20d022283fe", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "bundled:///libs/lib.esnext.d.ts", + "version": "8bf8b5e44e3c9c36f98e1007e8b7018c0f38d8adc07aecef42f5200114547c70", + "signature": "8bf8b5e44e3c9c36f98e1007e8b7018c0f38d8adc07aecef42f5200114547c70", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "bundled:///libs/lib.dom.d.ts", + "version": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", + "signature": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.dom.iterable.d.ts", + "version": "07f073f19d67f74d732b1adea08e1dc66b1b58d77cb5b43931dee3d798a2fd53", + "signature": "07f073f19d67f74d732b1adea08e1dc66b1b58d77cb5b43931dee3d798a2fd53", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "07f073f19d67f74d732b1adea08e1dc66b1b58d77cb5b43931dee3d798a2fd53", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.dom.asynciterable.d.ts", + "version": "d7a3c8b952931daebdfc7a2897c53c0a1c73624593fa070e46bd537e64dcd20a", + "signature": "d7a3c8b952931daebdfc7a2897c53c0a1c73624593fa070e46bd537e64dcd20a", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "d7a3c8b952931daebdfc7a2897c53c0a1c73624593fa070e46bd537e64dcd20a", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.webworker.importscripts.d.ts", + "version": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", + "signature": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.scripthost.d.ts", + "version": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", + "signature": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2015.core.d.ts", + "version": "c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671", + "signature": "c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2015.collection.d.ts", + "version": "dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44", + "signature": "dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2015.generator.d.ts", + "version": "515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71", + "signature": "515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2015.iterable.d.ts", + "version": "0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3", + "signature": "0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2015.promise.d.ts", + "version": "0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537", + "signature": "0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2015.proxy.d.ts", + "version": "ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671", + "signature": "ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2015.reflect.d.ts", + "version": "8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0", + "signature": "8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2015.symbol.d.ts", + "version": "4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d", + "signature": "4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2015.symbol.wellknown.d.ts", + "version": "936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df", + "signature": "936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2016.array.include.d.ts", + "version": "d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a", + "signature": "d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2016.intl.d.ts", + "version": "68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618", + "signature": "68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2017.arraybuffer.d.ts", + "version": "eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a", + "signature": "eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2017.date.d.ts", + "version": "38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119", + "signature": "38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2017.object.d.ts", + "version": "69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e", + "signature": "69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2017.sharedmemory.d.ts", + "version": "fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab", + "signature": "fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2017.string.d.ts", + "version": "2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893", + "signature": "2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2017.intl.d.ts", + "version": "4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc", + "signature": "4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2017.typedarrays.d.ts", + "version": "954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667", + "signature": "954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2018.asyncgenerator.d.ts", + "version": "ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c", + "signature": "ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2018.asynciterable.d.ts", + "version": "0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376", + "signature": "0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2018.intl.d.ts", + "version": "9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb", + "signature": "9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2018.promise.d.ts", + "version": "811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c", + "signature": "811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2018.regexp.d.ts", + "version": "717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca", + "signature": "717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2019.array.d.ts", + "version": "d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2", + "signature": "d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2019.object.d.ts", + "version": "71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557", + "signature": "71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2019.string.d.ts", + "version": "576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850", + "signature": "576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2019.symbol.d.ts", + "version": "89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6", + "signature": "89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2019.intl.d.ts", + "version": "74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b", + "signature": "74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2020.bigint.d.ts", + "version": "d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca", + "signature": "d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2020.date.d.ts", + "version": "063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df", + "signature": "063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2020.promise.d.ts", + "version": "934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab", + "signature": "934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2020.sharedmemory.d.ts", + "version": "52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47", + "signature": "52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2020.string.d.ts", + "version": "3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6", + "signature": "3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2020.symbol.wellknown.d.ts", + "version": "59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867", + "signature": "59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2020.intl.d.ts", + "version": "639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a", + "signature": "639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2020.number.d.ts", + "version": "368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1", + "signature": "368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2021.promise.d.ts", + "version": "af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74", + "signature": "af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2021.string.d.ts", + "version": "995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399", + "signature": "995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2021.weakref.d.ts", + "version": "959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a", + "signature": "959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2021.intl.d.ts", + "version": "965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d", + "signature": "965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2022.array.d.ts", + "version": "3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b", + "signature": "3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2022.error.d.ts", + "version": "0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005", + "signature": "0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2022.intl.d.ts", + "version": "b5ce7a470bc3628408429040c4e3a53a27755022a32fd05e2cb694e7015386c7", + "signature": "b5ce7a470bc3628408429040c4e3a53a27755022a32fd05e2cb694e7015386c7", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "b5ce7a470bc3628408429040c4e3a53a27755022a32fd05e2cb694e7015386c7", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2022.object.d.ts", + "version": "8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a", + "signature": "8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2022.string.d.ts", + "version": "3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004", + "signature": "3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2022.regexp.d.ts", + "version": "b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad", + "signature": "b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2023.array.d.ts", + "version": "df83c2a6c73228b625b0beb6669c7ee2a09c914637e2d35170723ad49c0f5cd4", + "signature": "df83c2a6c73228b625b0beb6669c7ee2a09c914637e2d35170723ad49c0f5cd4", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "df83c2a6c73228b625b0beb6669c7ee2a09c914637e2d35170723ad49c0f5cd4", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2023.collection.d.ts", + "version": "436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a", + "signature": "436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2023.intl.d.ts", + "version": "8e3c06ea092138bf9fa5e874a1fdbc9d54805d074bee1de31b99a11e2fec239d", + "signature": "8e3c06ea092138bf9fa5e874a1fdbc9d54805d074bee1de31b99a11e2fec239d", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "8e3c06ea092138bf9fa5e874a1fdbc9d54805d074bee1de31b99a11e2fec239d", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2024.arraybuffer.d.ts", + "version": "87dc0f382502f5bbce5129bdc0aea21e19a3abbc19259e0b43ae038a9fc4e326", + "signature": "87dc0f382502f5bbce5129bdc0aea21e19a3abbc19259e0b43ae038a9fc4e326", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "87dc0f382502f5bbce5129bdc0aea21e19a3abbc19259e0b43ae038a9fc4e326", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2024.collection.d.ts", + "version": "b1cb28af0c891c8c96b2d6b7be76bd394fddcfdb4709a20ba05a7c1605eea0f9", + "signature": "b1cb28af0c891c8c96b2d6b7be76bd394fddcfdb4709a20ba05a7c1605eea0f9", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "b1cb28af0c891c8c96b2d6b7be76bd394fddcfdb4709a20ba05a7c1605eea0f9", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2024.object.d.ts", + "version": "2fef54945a13095fdb9b84f705f2b5994597640c46afeb2ce78352fab4cb3279", + "signature": "2fef54945a13095fdb9b84f705f2b5994597640c46afeb2ce78352fab4cb3279", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "2fef54945a13095fdb9b84f705f2b5994597640c46afeb2ce78352fab4cb3279", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2024.promise.d.ts", + "version": "ac77cb3e8c6d3565793eb90a8373ee8033146315a3dbead3bde8db5eaf5e5ec6", + "signature": "ac77cb3e8c6d3565793eb90a8373ee8033146315a3dbead3bde8db5eaf5e5ec6", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "ac77cb3e8c6d3565793eb90a8373ee8033146315a3dbead3bde8db5eaf5e5ec6", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2024.regexp.d.ts", + "version": "56e4ed5aab5f5920980066a9409bfaf53e6d21d3f8d020c17e4de584d29600ad", + "signature": "56e4ed5aab5f5920980066a9409bfaf53e6d21d3f8d020c17e4de584d29600ad", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "56e4ed5aab5f5920980066a9409bfaf53e6d21d3f8d020c17e4de584d29600ad", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2024.sharedmemory.d.ts", + "version": "4ece9f17b3866cc077099c73f4983bddbcb1dc7ddb943227f1ec070f529dedd1", + "signature": "4ece9f17b3866cc077099c73f4983bddbcb1dc7ddb943227f1ec070f529dedd1", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "4ece9f17b3866cc077099c73f4983bddbcb1dc7ddb943227f1ec070f529dedd1", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.es2024.string.d.ts", + "version": "0a6282c8827e4b9a95f4bf4f5c205673ada31b982f50572d27103df8ceb8013c", + "signature": "0a6282c8827e4b9a95f4bf4f5c205673ada31b982f50572d27103df8ceb8013c", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "0a6282c8827e4b9a95f4bf4f5c205673ada31b982f50572d27103df8ceb8013c", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.esnext.array.d.ts", + "version": "1c9319a09485199c1f7b0498f2988d6d2249793ef67edda49d1e584746be9032", + "signature": "1c9319a09485199c1f7b0498f2988d6d2249793ef67edda49d1e584746be9032", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "1c9319a09485199c1f7b0498f2988d6d2249793ef67edda49d1e584746be9032", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.esnext.collection.d.ts", + "version": "e3a2a0cee0f03ffdde24d89660eba2685bfbdeae955a6c67e8c4c9fd28928eeb", + "signature": "e3a2a0cee0f03ffdde24d89660eba2685bfbdeae955a6c67e8c4c9fd28928eeb", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "e3a2a0cee0f03ffdde24d89660eba2685bfbdeae955a6c67e8c4c9fd28928eeb", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.esnext.intl.d.ts", + "version": "811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4", + "signature": "811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.esnext.disposable.d.ts", + "version": "51ad4c928303041605b4d7ae32e0c1ee387d43a24cd6f1ebf4a2699e1076d4fa", + "signature": "51ad4c928303041605b4d7ae32e0c1ee387d43a24cd6f1ebf4a2699e1076d4fa", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "51ad4c928303041605b4d7ae32e0c1ee387d43a24cd6f1ebf4a2699e1076d4fa", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.esnext.promise.d.ts", + "version": "60037901da1a425516449b9a20073aa03386cce92f7a1fd902d7602be3a7c2e9", + "signature": "60037901da1a425516449b9a20073aa03386cce92f7a1fd902d7602be3a7c2e9", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "60037901da1a425516449b9a20073aa03386cce92f7a1fd902d7602be3a7c2e9", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.esnext.decorators.d.ts", + "version": "d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f", + "signature": "d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.esnext.iterator.d.ts", + "version": "22adec94ef7047a6c9d1af3cb96be87a335908bf9ef386ae9fd50eeb37f44c47", + "signature": "22adec94ef7047a6c9d1af3cb96be87a335908bf9ef386ae9fd50eeb37f44c47", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "22adec94ef7047a6c9d1af3cb96be87a335908bf9ef386ae9fd50eeb37f44c47", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.esnext.float16.d.ts", + "version": "4245fee526a7d1754529d19227ecbf3be066ff79ebb6a380d78e41648f2f224d", + "signature": "4245fee526a7d1754529d19227ecbf3be066ff79ebb6a380d78e41648f2f224d", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "4245fee526a7d1754529d19227ecbf3be066ff79ebb6a380d78e41648f2f224d", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.decorators.d.ts", + "version": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", + "signature": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.decorators.legacy.d.ts", + "version": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", + "signature": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.esnext.full.d.ts", + "version": "bde31fd423cd93b0eff97197a3f66df7c93e8c0c335cbeb113b7ff1ac35c23f4", + "signature": "bde31fd423cd93b0eff97197a3f66df7c93e8c0c335cbeb113b7ff1ac35c23f4", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "../compiler/parser.d.ts", + "version": "2e29cd9a98755c46896f7a2d56524db2d6d96b248e36db46de14c30bf47c8d05", + "signature": "2e29cd9a98755c46896f7a2d56524db2d6d96b248e36db46de14c30bf47c8d05", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "../../src/services/services.ts", + "version": "407537635fda1a543a422ecdd456c1402aaa2083cde5acfb4eb424ab02fc0612", + "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "407537635fda1a543a422ecdd456c1402aaa2083cde5acfb4eb424ab02fc0612", + "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", + "impliedNodeFormat": 1 + } + } + ], + "options": { + "composite": true, + "module": 199, + "outDir": "./", + "rewriteRelativeImportExtensions": true, + "rootDir": "../../src/services" + }, + "latestChangedDtsFile": "./services.d.ts", + "size": 13917 +} //// [/home/src/workspaces/solution/src/compiler/parser.ts] no change //// [/home/src/workspaces/solution/src/compiler/tsconfig.json] no change //// [/home/src/workspaces/solution/src/services/services.ts] no change diff --git a/testdata/baselines/reference/tsc/typeAcquisition/parse-tsconfig-with-typeAcquisition.js b/testdata/baselines/reference/tsc/typeAcquisition/parse-tsconfig-with-typeAcquisition.js index a7992e5aa1..efa9951068 100644 --- a/testdata/baselines/reference/tsc/typeAcquisition/parse-tsconfig-with-typeAcquisition.js +++ b/testdata/baselines/reference/tsc/typeAcquisition/parse-tsconfig-with-typeAcquisition.js @@ -16,7 +16,7 @@ Input:: }, } -ExitStatus:: 2 +ExitStatus:: 1 CompilerOptions::{} Output:: @@ -25,4 +25,112 @@ Output:: Found 1 error. //// [/home/src/workspaces/project/tsconfig.json] no change +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] new file +{"Version":"FakeTSVersion","fileNames":["bundled:///libs/lib.d.ts","bundled:///libs/lib.es5.d.ts","bundled:///libs/lib.dom.d.ts","bundled:///libs/lib.webworker.importscripts.d.ts","bundled:///libs/lib.scripthost.d.ts","bundled:///libs/lib.decorators.d.ts","bundled:///libs/lib.decorators.legacy.d.ts"],"fileInfos":["a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa",{"version":"69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedNodeFormat":1}],"options":{"composite":true},"semanticDiagnosticsPerFile":[1,2,3,4,5,6,7]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] new file +{ + "Version": "FakeTSVersion", + "fileNames": [ + "bundled:///libs/lib.d.ts", + "bundled:///libs/lib.es5.d.ts", + "bundled:///libs/lib.dom.d.ts", + "bundled:///libs/lib.webworker.importscripts.d.ts", + "bundled:///libs/lib.scripthost.d.ts", + "bundled:///libs/lib.decorators.d.ts", + "bundled:///libs/lib.decorators.legacy.d.ts" + ], + "fileInfos": [ + { + "fileName": "bundled:///libs/lib.d.ts", + "version": "a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa", + "signature": "a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "bundled:///libs/lib.es5.d.ts", + "version": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", + "signature": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.dom.d.ts", + "version": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", + "signature": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.webworker.importscripts.d.ts", + "version": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", + "signature": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.scripthost.d.ts", + "version": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", + "signature": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.decorators.d.ts", + "version": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", + "signature": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.decorators.legacy.d.ts", + "version": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", + "signature": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + } + ], + "options": { + "composite": true + }, + "semanticDiagnosticsPerFile": [ + "bundled:///libs/lib.d.ts", + "bundled:///libs/lib.es5.d.ts", + "bundled:///libs/lib.dom.d.ts", + "bundled:///libs/lib.webworker.importscripts.d.ts", + "bundled:///libs/lib.scripthost.d.ts", + "bundled:///libs/lib.decorators.d.ts", + "bundled:///libs/lib.decorators.legacy.d.ts" + ], + "size": 1219 +} From 19f5ecbd78a448ea6f3ccbac3a013cfef956721e Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Mon, 30 Jun 2025 12:48:52 -0700 Subject: [PATCH 13/36] Watch changes --- internal/execute/export_test.go | 13 ++++++++----- internal/execute/verifytscwatch_test.go | 8 ++++---- internal/execute/watch.go | 9 ++++++--- internal/execute/watcher.go | 3 ++- internal/incremental/affectedfileshandler.go | 7 ++----- internal/incremental/emitfileshandler.go | 2 +- internal/incremental/program.go | 19 +++++++------------ internal/incremental/snapshot.go | 5 +---- .../noEmit/dts-errors-without-dts-enabled.js | 11 +++++------ .../reference/tscWatch/noEmit/dts-errors.js | 5 ----- .../tscWatch/noEmit/semantic-errors.js | 11 +++++------ .../tscWatch/noEmit/syntax-errors.js | 11 +++++------ 12 files changed, 46 insertions(+), 58 deletions(-) diff --git a/internal/execute/export_test.go b/internal/execute/export_test.go index e73465cbe1..65dfdd2d4c 100644 --- a/internal/execute/export_test.go +++ b/internal/execute/export_test.go @@ -1,7 +1,9 @@ package execute import ( + "github.com/microsoft/typescript-go/internal/ast" "github.com/microsoft/typescript-go/internal/compiler" + "github.com/microsoft/typescript-go/internal/incremental" "github.com/microsoft/typescript-go/internal/tsoptions" ) @@ -21,11 +23,12 @@ func RunWatchCycle(w *watcher) { return } // todo: updateProgram() - w.program = compiler.NewProgram(compiler.ProgramOptions{ - Config: w.options, - Host: w.host, - }) - if w.hasBeenModified(w.program) { + w.program = incremental.NewProgram(compiler.NewProgram(compiler.ProgramOptions{ + Config: w.options, + Host: w.host, + JSDocParsingMode: ast.JSDocParsingModeParseForTypeErrors, + }), w.program) + if w.hasBeenModified(w.program.GetProgram()) { w.compileAndEmit() } } diff --git a/internal/execute/verifytscwatch_test.go b/internal/execute/verifytscwatch_test.go index 50eb7e1812..43485f7328 100644 --- a/internal/execute/verifytscwatch_test.go +++ b/internal/execute/verifytscwatch_test.go @@ -133,25 +133,25 @@ func TestTscNoEmitWatch(t *testing.T) { noEmitWatchTestInput("syntax errors", []string{"-w"}, `const a = "hello`, - []string{`"outFile": "../outFile.js"`}, + nil, ), noEmitWatchTestInput( "semantic errors", []string{"-w"}, `const a: number = "hello"`, - []string{`"outFile": "../outFile.js"`}, + nil, ), noEmitWatchTestInput( "dts errors without dts enabled", []string{"-w"}, `const a = class { private p = 10; };`, - []string{`"outFile": "../outFile.js"`}, + nil, ), noEmitWatchTestInput( "dts errors", []string{"-w"}, `const a = class { private p = 10; };`, - []string{`"outFile": "../outFile.js"`, `"declaration": true`}, + []string{`"declaration": true`}, ), } diff --git a/internal/execute/watch.go b/internal/execute/watch.go index 6d587951d1..191d3a69db 100644 --- a/internal/execute/watch.go +++ b/internal/execute/watch.go @@ -6,6 +6,7 @@ import ( "github.com/microsoft/typescript-go/internal/ast" "github.com/microsoft/typescript-go/internal/compiler" + "github.com/microsoft/typescript-go/internal/incremental" ) func start(w *watcher) ExitStatus { @@ -26,6 +27,7 @@ func (w *watcher) initialize() { if w.configFileName == "" { w.host = compiler.NewCompilerHost(w.options.CompilerOptions(), w.sys.GetCurrentDirectory(), w.sys.FS(), w.sys.DefaultLibraryPath(), nil) } + w.program = incremental.ReadBuildInfoProgram(w.options, incremental.NewBuildInfoReader(w.host)) } func (w *watcher) doCycle() { @@ -36,12 +38,13 @@ func (w *watcher) doCycle() { return } // updateProgram() - w.program = compiler.NewProgram(compiler.ProgramOptions{ + w.program = incremental.NewProgram(compiler.NewProgram(compiler.ProgramOptions{ Config: w.options, Host: w.host, JSDocParsingMode: ast.JSDocParsingModeParseForTypeErrors, - }) - if w.hasBeenModified(w.program) { + }), w.program) + + if w.hasBeenModified(w.program.GetProgram()) { fmt.Fprint(w.sys.Writer(), "build starting at ", w.sys.Now(), w.sys.NewLine()) timeStart := w.sys.Now() w.compileAndEmit() diff --git a/internal/execute/watcher.go b/internal/execute/watcher.go index 5697c7525d..445e3cab0c 100644 --- a/internal/execute/watcher.go +++ b/internal/execute/watcher.go @@ -7,6 +7,7 @@ import ( "github.com/microsoft/typescript-go/internal/collections" "github.com/microsoft/typescript-go/internal/compiler" "github.com/microsoft/typescript-go/internal/core" + "github.com/microsoft/typescript-go/internal/incremental" "github.com/microsoft/typescript-go/internal/tsoptions" "github.com/microsoft/typescript-go/internal/tspath" ) @@ -18,7 +19,7 @@ type watcher struct { reportDiagnostic diagnosticReporter host compiler.CompilerHost - program *compiler.Program + program *incremental.Program prevModified map[string]time.Time configModified bool } diff --git a/internal/incremental/affectedfileshandler.go b/internal/incremental/affectedfileshandler.go index cf580975f6..4612d3c4d1 100644 --- a/internal/incremental/affectedfileshandler.go +++ b/internal/incremental/affectedfileshandler.go @@ -48,9 +48,7 @@ func (h *affectedFilesHandler) isChangedSignature(path tspath.Path) bool { } func (h *affectedFilesHandler) removeSemanticDiagnosticsOf(path tspath.Path) { - if h.program.snapshot.semanticDiagnosticsFromOldState.Has(path) { - h.filesToRemoveDiagnostics.Add(path) - } + h.filesToRemoveDiagnostics.Add(path) } func (h *affectedFilesHandler) removeDiagnosticsOfLibraryFiles() { @@ -309,7 +307,6 @@ func (h *affectedFilesHandler) handleDtsMayChangeOfGlobalScope(dtsMayChange dtsM // Handle the dts may change, so they need to be added to pending emit if dts emit is enabled, // Also we need to make sure signature is updated for these files func (h *affectedFilesHandler) handleDtsMayChangeOf(dtsMayChange dtsMayChange, path tspath.Path, invalidateJsFiles bool) { - h.removeSemanticDiagnosticsOf(path) if h.program.snapshot.changedFilesSet.Has(path) { return } @@ -317,6 +314,7 @@ func (h *affectedFilesHandler) handleDtsMayChangeOf(dtsMayChange dtsMayChange, p if file == nil { return } + h.removeSemanticDiagnosticsOf(path) // Even though the js emit doesnt change and we are already handling dts emit and semantic diagnostics // we need to update the signature to reflect correctness of the signature(which is output d.ts emit) of this file // This ensures that we dont later during incremental builds considering wrong signature. @@ -340,7 +338,6 @@ func (h *affectedFilesHandler) updateSnapshot() { return true }) h.filesToRemoveDiagnostics.Range(func(file tspath.Path) bool { - h.program.snapshot.semanticDiagnosticsFromOldState.Delete(file) delete(h.program.snapshot.semanticDiagnosticsPerFile, file) return true }) diff --git a/internal/incremental/emitfileshandler.go b/internal/incremental/emitfileshandler.go index 4d886f359d..4e56c214ab 100644 --- a/internal/incremental/emitfileshandler.go +++ b/internal/incremental/emitfileshandler.go @@ -242,7 +242,7 @@ func (h *emitFilesHandler) updateSnapshot() []*compiler.EmitResult { } else { h.program.snapshot.affectedFilesPendingEmit[file] = update.pendingKind } - if update.result == nil { + if update.result != nil { results = append(results, update.result) if len(update.result.Diagnostics) != 0 { if h.program.snapshot.emitDiagnosticsPerFile == nil { diff --git a/internal/incremental/program.go b/internal/incremental/program.go index 137bef19fb..af49553dce 100644 --- a/internal/incremental/program.go +++ b/internal/incremental/program.go @@ -133,16 +133,16 @@ func (h *Program) GetDeclarationDiagnostics(ctx context.Context, file *ast.Sourc func (h *Program) Emit(ctx context.Context, options compiler.EmitOptions) *compiler.EmitResult { h.panicIfNoProgram("Emit") + var result *compiler.EmitResult if h.snapshot.options.NoEmit.IsTrue() { - if options.TargetSourceFile != nil { - return &compiler.EmitResult{EmitSkipped: true} + result = &compiler.EmitResult{EmitSkipped: true} + } else { + result = compiler.HandleNoEmitOnError(ctx, h, options.TargetSourceFile) + if ctx.Err() != nil { + return nil } - buildInfoResult := h.emitBuildInfo(ctx, options) - buildInfoResult.EmitSkipped = true - return buildInfoResult } - - if result := compiler.HandleNoEmitOnError(ctx, h, options.TargetSourceFile); result != nil { + if result != nil { if options.TargetSourceFile != nil { return result } @@ -155,10 +155,6 @@ func (h *Program) Emit(ctx context.Context, options compiler.EmitOptions) *compi } return result } - if ctx.Err() != nil { - return nil - } - return emitFiles(ctx, h, options, false) } @@ -199,7 +195,6 @@ func (h *Program) collectSemanticDiagnosticsOfAffectedFiles(ctx context.Context, // Commit changes to snapshot for file, diagnostics := range diagnosticsPerFile { - h.snapshot.semanticDiagnosticsFromOldState.Delete(file.Path()) h.snapshot.semanticDiagnosticsPerFile[file.Path()] = &diagnosticsOrBuildInfoDiagnosticsWithFileName{diagnostics: diagnostics} } if len(h.snapshot.semanticDiagnosticsPerFile) == len(h.program.GetSourceFiles()) && h.snapshot.checkPending && !h.snapshot.options.NoCheck.IsTrue() { diff --git a/internal/incremental/snapshot.go b/internal/incremental/snapshot.go index c6333777f0..48da60ac1b 100644 --- a/internal/incremental/snapshot.go +++ b/internal/incremental/snapshot.go @@ -249,9 +249,7 @@ type snapshot struct { // Additional fields that are not serialized but needed to track state // true if build info emit is pending - buildInfoEmitPending bool - // True if the semantic diagnostics were copied from the old state - semanticDiagnosticsFromOldState collections.Set[tspath.Path] + buildInfoEmitPending bool allFilesExcludingDefaultLibraryFileOnce sync.Once // Cache of all files excluding default library file for the current program allFilesExcludingDefaultLibraryFile []*ast.SourceFile @@ -401,7 +399,6 @@ func newSnapshotForProgram(program *compiler.Program, oldProgram *Program) *snap // Unchanged file copy diagnostics if diagnostics, ok := oldProgram.snapshot.semanticDiagnosticsPerFile[file.Path()]; ok { snapshot.semanticDiagnosticsPerFile[file.Path()] = diagnostics - snapshot.semanticDiagnosticsFromOldState.Add(file.Path()) } } } diff --git a/testdata/baselines/reference/tscWatch/noEmit/dts-errors-without-dts-enabled.js b/testdata/baselines/reference/tscWatch/noEmit/dts-errors-without-dts-enabled.js index 847e9edd27..dcc0038209 100644 --- a/testdata/baselines/reference/tscWatch/noEmit/dts-errors-without-dts-enabled.js +++ b/testdata/baselines/reference/tscWatch/noEmit/dts-errors-without-dts-enabled.js @@ -7,8 +7,7 @@ const a = class { private p = 10; }; //// [/home/src/workspaces/project/tsconfig.json] new file { "compilerOptions": { - "noEmit": true, - "outFile": "../outFile.js" + "noEmit": true } } @@ -44,7 +43,7 @@ const a = "hello"; //// [/home/src/workspaces/project/tsconfig.json] modified. new content: { "compilerOptions": { - "outFile": "../outFile.js" + } } @@ -59,7 +58,7 @@ Output:: { "compilerOptions": { "noEmit": true, - "outFile": "../outFile.js" + } } @@ -87,7 +86,7 @@ const a = class { //// [/home/src/workspaces/project/tsconfig.json] modified. new content: { "compilerOptions": { - "outFile": "../outFile.js" + } } @@ -102,7 +101,7 @@ Output:: { "compilerOptions": { "noEmit": true, - "outFile": "../outFile.js" + } } diff --git a/testdata/baselines/reference/tscWatch/noEmit/dts-errors.js b/testdata/baselines/reference/tscWatch/noEmit/dts-errors.js index 66365eafbd..004a0035e6 100644 --- a/testdata/baselines/reference/tscWatch/noEmit/dts-errors.js +++ b/testdata/baselines/reference/tscWatch/noEmit/dts-errors.js @@ -8,7 +8,6 @@ const a = class { private p = 10; }; { "compilerOptions": { "noEmit": true, - "outFile": "../outFile.js", "declaration": true } } @@ -60,7 +59,6 @@ const a = "hello"; //// [/home/src/workspaces/project/tsconfig.json] modified. new content: { "compilerOptions": { - "outFile": "../outFile.js", "declaration": true } } @@ -77,7 +75,6 @@ Output:: { "compilerOptions": { "noEmit": true, - "outFile": "../outFile.js", "declaration": true } } @@ -138,7 +135,6 @@ const a = class { //// [/home/src/workspaces/project/tsconfig.json] modified. new content: { "compilerOptions": { - "outFile": "../outFile.js", "declaration": true } } @@ -167,7 +163,6 @@ Found 1 error in a.ts:1 { "compilerOptions": { "noEmit": true, - "outFile": "../outFile.js", "declaration": true } } diff --git a/testdata/baselines/reference/tscWatch/noEmit/semantic-errors.js b/testdata/baselines/reference/tscWatch/noEmit/semantic-errors.js index a0eacfa2e0..639eec7776 100644 --- a/testdata/baselines/reference/tscWatch/noEmit/semantic-errors.js +++ b/testdata/baselines/reference/tscWatch/noEmit/semantic-errors.js @@ -7,8 +7,7 @@ const a: number = "hello" //// [/home/src/workspaces/project/tsconfig.json] new file { "compilerOptions": { - "noEmit": true, - "outFile": "../outFile.js" + "noEmit": true } } @@ -52,7 +51,7 @@ const a = "hello"; //// [/home/src/workspaces/project/tsconfig.json] modified. new content: { "compilerOptions": { - "outFile": "../outFile.js" + } } @@ -67,7 +66,7 @@ Output:: { "compilerOptions": { "noEmit": true, - "outFile": "../outFile.js" + } } @@ -107,7 +106,7 @@ Found 1 error in a.ts:1 //// [/home/src/workspaces/project/tsconfig.json] modified. new content: { "compilerOptions": { - "outFile": "../outFile.js" + } } @@ -130,7 +129,7 @@ Found 1 error in a.ts:1 { "compilerOptions": { "noEmit": true, - "outFile": "../outFile.js" + } } diff --git a/testdata/baselines/reference/tscWatch/noEmit/syntax-errors.js b/testdata/baselines/reference/tscWatch/noEmit/syntax-errors.js index c2616d28af..060eb4571c 100644 --- a/testdata/baselines/reference/tscWatch/noEmit/syntax-errors.js +++ b/testdata/baselines/reference/tscWatch/noEmit/syntax-errors.js @@ -7,8 +7,7 @@ const a = "hello //// [/home/src/workspaces/project/tsconfig.json] new file { "compilerOptions": { - "noEmit": true, - "outFile": "../outFile.js" + "noEmit": true } } @@ -52,7 +51,7 @@ const a = "hello"; //// [/home/src/workspaces/project/tsconfig.json] modified. new content: { "compilerOptions": { - "outFile": "../outFile.js" + } } @@ -67,7 +66,7 @@ Output:: { "compilerOptions": { "noEmit": true, - "outFile": "../outFile.js" + } } @@ -109,7 +108,7 @@ const a = "hello; //// [/home/src/workspaces/project/tsconfig.json] modified. new content: { "compilerOptions": { - "outFile": "../outFile.js" + } } @@ -132,7 +131,7 @@ Found 1 error in a.ts:1 { "compilerOptions": { "noEmit": true, - "outFile": "../outFile.js" + } } From 08b7e8c85e3175c6c5bab28710d78c9491346eca Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Mon, 30 Jun 2025 15:56:26 -0700 Subject: [PATCH 14/36] Verify diagnostic and options serializing --- internal/execute/testsys_test.go | 2 +- internal/execute/tscincremental_test.go | 50 ++++ internal/incremental/buildInfo.go | 24 +- internal/tsoptions/parsinghelpers.go | 19 +- .../incremental/serializing-error-chain.js | 220 ++++++++++++++++++ 5 files changed, 296 insertions(+), 19 deletions(-) create mode 100644 internal/execute/tscincremental_test.go create mode 100644 testdata/baselines/reference/tsc/incremental/serializing-error-chain.js diff --git a/internal/execute/testsys_test.go b/internal/execute/testsys_test.go index 1e371ea891..539acfea99 100644 --- a/internal/execute/testsys_test.go +++ b/internal/execute/testsys_test.go @@ -18,7 +18,7 @@ import ( type FileMap map[string]string -func newTestSys(fileOrFolderList FileMap, cwd string, args ...string) *testSys { +func newTestSys(fileOrFolderList FileMap, cwd string) *testSys { if cwd == "" { cwd = "/home/src/workspaces/project" } diff --git a/internal/execute/tscincremental_test.go b/internal/execute/tscincremental_test.go new file mode 100644 index 0000000000..c2e6c69531 --- /dev/null +++ b/internal/execute/tscincremental_test.go @@ -0,0 +1,50 @@ +package execute_test + +import ( + "testing" + + "github.com/microsoft/typescript-go/internal/bundled" +) + +func TestIncremental(t *testing.T) { + t.Parallel() + if !bundled.Embedded { + // Without embedding, we'd need to read all of the lib files out from disk into the MapFS. + // Just skip this for now. + t.Skip("bundled files are not embedded") + } + + testCases := []*tscInput{ + { + subScenario: "serializing error chain", + sys: newTestSys(FileMap{ + "/home/src/workspaces/project/tsconfig.json": `{ + "compilerOptions": { + "incremental": true, + "strict": true, + "jsx": "react", + "module": "esnext", + }, + }`, + "/home/src/workspaces/project/index.tsx": ` + declare namespace JSX { + interface ElementChildrenAttribute { children: {}; } + interface IntrinsicElements { div: {} } + } + + declare var React: any; + + declare function Component(props: never): any; + declare function Component(props: { children?: number }): any; + ( +
+
+ )`, + }, "/home/src/workspaces/project"), + }, + } + + for _, test := range testCases { + test.verify(t, "incremental") + } +} diff --git a/internal/incremental/buildInfo.go b/internal/incremental/buildInfo.go index 8391be56f3..cb35ea0a5c 100644 --- a/internal/incremental/buildInfo.go +++ b/internal/incremental/buildInfo.go @@ -213,7 +213,7 @@ func (b *BuildInfoDiagnosticsOfFile) MarshalJSON() ([]byte, error) { } func (b *BuildInfoDiagnosticsOfFile) UnmarshalJSON(data []byte) error { - var fileIdAndDiagnostics []any + var fileIdAndDiagnostics []json.RawMessage if err := json.Unmarshal(data, &fileIdAndDiagnostics); err != nil { return fmt.Errorf("invalid BuildInfoDiagnosticsOfFile: %s", data) } @@ -221,19 +221,19 @@ func (b *BuildInfoDiagnosticsOfFile) UnmarshalJSON(data []byte) error { return fmt.Errorf("invalid BuildInfoDiagnosticsOfFile: expected 2 elements, got %d", len(fileIdAndDiagnostics)) } var fileId BuildInfoFileId - if fileIdV, ok := fileIdAndDiagnostics[0].(float64); !ok { - return fmt.Errorf("invalid fileId in BuildInfoDiagnosticsOfFile: expected float64, got %T", fileIdAndDiagnostics[0]) - } else { - fileId = BuildInfoFileId(fileIdV) + if err := json.Unmarshal(fileIdAndDiagnostics[0], &fileId); err != nil { + return fmt.Errorf("invalid fileId in BuildInfoDiagnosticsOfFile: %s", err) } - if diagnostics, ok := fileIdAndDiagnostics[1].([]*BuildInfoDiagnostic); ok { - *b = BuildInfoDiagnosticsOfFile{ - FileId: fileId, - Diagnostics: diagnostics, - } - return nil + + var diagnostics []*BuildInfoDiagnostic + if err := json.Unmarshal(fileIdAndDiagnostics[1], &diagnostics); err != nil { + return fmt.Errorf("invalid diagnostics in BuildInfoDiagnosticsOfFile: %s", err) + } + *b = BuildInfoDiagnosticsOfFile{ + FileId: fileId, + Diagnostics: diagnostics, } - return fmt.Errorf("invalid diagnostics in BuildInfoDiagnosticsOfFile: expected []*BuildInfoDiagnostic, got %T", fileIdAndDiagnostics[1]) + return nil } type BuildInfoSemanticDiagnostic struct { diff --git a/internal/tsoptions/parsinghelpers.go b/internal/tsoptions/parsinghelpers.go index ff6095736c..7c66406981 100644 --- a/internal/tsoptions/parsinghelpers.go +++ b/internal/tsoptions/parsinghelpers.go @@ -290,15 +290,15 @@ func parseCompilerOptions(key string, value any, allOptions *core.CompilerOption case "mapRoot": allOptions.MapRoot = parseString(value) case "module": - allOptions.Module = value.(core.ModuleKind) + allOptions.Module = floatOrInt32ToFlag[core.ModuleKind](value) case "moduleDetectionKind": - allOptions.ModuleDetection = value.(core.ModuleDetectionKind) + allOptions.ModuleDetection = floatOrInt32ToFlag[core.ModuleDetectionKind](value) case "moduleResolution": - allOptions.ModuleResolution = value.(core.ModuleResolutionKind) + allOptions.ModuleResolution = floatOrInt32ToFlag[core.ModuleResolutionKind](value) case "moduleSuffixes": allOptions.ModuleSuffixes = parseStringArray(value) case "moduleDetection": - allOptions.ModuleDetection = value.(core.ModuleDetectionKind) + allOptions.ModuleDetection = floatOrInt32ToFlag[core.ModuleDetectionKind](value) case "noCheck": allOptions.NoCheck = parseTristate(value) case "noFallthroughCasesInSwitch": @@ -388,7 +388,7 @@ func parseCompilerOptions(key string, value any, allOptions *core.CompilerOption case "suppressOutputPathCheck": allOptions.SuppressOutputPathCheck = parseTristate(value) case "target": - allOptions.Target = value.(core.ScriptTarget) + allOptions.Target = floatOrInt32ToFlag[core.ScriptTarget](value) case "traceResolution": allOptions.TraceResolution = parseTristate(value) case "tsBuildInfoFile": @@ -428,7 +428,7 @@ func parseCompilerOptions(key string, value any, allOptions *core.CompilerOption case "outDir": allOptions.OutDir = parseString(value) case "newLine": - allOptions.NewLine = value.(core.NewLineKind) + allOptions.NewLine = floatOrInt32ToFlag[core.NewLineKind](value) case "watch": allOptions.Watch = parseTristate(value) case "pprofDir": @@ -444,6 +444,13 @@ func parseCompilerOptions(key string, value any, allOptions *core.CompilerOption return true } +func floatOrInt32ToFlag[T ~int32](value any) T { + if v, ok := value.(T); ok { + return v + } + return T(value.(float64)) +} + func ParseWatchOptions(key string, value any, allOptions *core.WatchOptions) []*ast.Diagnostic { if allOptions == nil { return nil diff --git a/testdata/baselines/reference/tsc/incremental/serializing-error-chain.js b/testdata/baselines/reference/tsc/incremental/serializing-error-chain.js new file mode 100644 index 0000000000..59ec219c0d --- /dev/null +++ b/testdata/baselines/reference/tsc/incremental/serializing-error-chain.js @@ -0,0 +1,220 @@ + +currentDirectory::/home/src/workspaces/project +useCaseSensitiveFileNames::true +Input:: +//// [/home/src/workspaces/project/index.tsx] new file + + declare namespace JSX { + interface ElementChildrenAttribute { children: {}; } + interface IntrinsicElements { div: {} } + } + + declare var React: any; + + declare function Component(props: never): any; + declare function Component(props: { children?: number }): any; + ( +
+
+ ) +//// [/home/src/workspaces/project/tsconfig.json] new file +{ + "compilerOptions": { + "incremental": true, + "strict": true, + "jsx": "react", + "module": "esnext", + }, + } + +ExitStatus:: 2 + +CompilerOptions::{} +Output:: +index.tsx:11:23 - error TS2746: This JSX tag's 'children' prop expects a single child of type 'number | undefined', but multiple children were provided. + +11 ( +   ~~~~~~~~~ + +index.tsx:11:23 - error TS2769: No overload matches this call. + The last overload gave the following error. + This JSX tag's 'children' prop expects a single child of type 'number | undefined', but multiple children were provided. + +11 ( +   ~~~~~~~~~ + + index.tsx:10:38 - The last overload is declared here. + 10 declare function Component(props: { children?: number }): any; +    ~~~~~~~~~ + + +Found 2 errors in the same file, starting at: index.tsx:11 + +//// [/home/src/workspaces/project/index.js] new file +(React.createElement(Component, null, React.createElement("div", null), React.createElement("div", null))); + +//// [/home/src/workspaces/project/index.tsx] no change +//// [/home/src/workspaces/project/tsconfig.json] no change +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] new file +{"Version":"FakeTSVersion","fileNames":["bundled:///libs/lib.d.ts","bundled:///libs/lib.es5.d.ts","bundled:///libs/lib.dom.d.ts","bundled:///libs/lib.webworker.importscripts.d.ts","bundled:///libs/lib.scripthost.d.ts","bundled:///libs/lib.decorators.d.ts","bundled:///libs/lib.decorators.legacy.d.ts","./index.tsx"],"fileInfos":["a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa",{"version":"69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"c7980af975245f04431574a9c187c9abd1c0ba29d83a127ad2af4b952296f935","affectsGlobalScope":true,"impliedNodeFormat":1}],"options":{"jsx":3,"module":99,"strict":true},"semanticDiagnosticsPerFile":[[8,[{"pos":426,"end":435,"code":2746,"category":1,"message":"This JSX tag's 'children' prop expects a single child of type 'number | undefined', but multiple children were provided."},{"pos":426,"end":435,"code":2769,"category":1,"message":"No overload matches this call.","messageChain":[{"pos":426,"end":435,"code":2770,"category":1,"message":"The last overload gave the following error.","messageChain":[{"pos":426,"end":435,"code":2746,"category":1,"message":"This JSX tag's 'children' prop expects a single child of type 'number | undefined', but multiple children were provided."}]}],"relatedInformation":[{"pos":358,"end":367,"code":2771,"category":1,"message":"The last overload is declared here."}]}]]]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] new file +{ + "Version": "FakeTSVersion", + "fileNames": [ + "bundled:///libs/lib.d.ts", + "bundled:///libs/lib.es5.d.ts", + "bundled:///libs/lib.dom.d.ts", + "bundled:///libs/lib.webworker.importscripts.d.ts", + "bundled:///libs/lib.scripthost.d.ts", + "bundled:///libs/lib.decorators.d.ts", + "bundled:///libs/lib.decorators.legacy.d.ts", + "./index.tsx" + ], + "fileInfos": [ + { + "fileName": "bundled:///libs/lib.d.ts", + "version": "a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa", + "signature": "a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "bundled:///libs/lib.es5.d.ts", + "version": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", + "signature": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.dom.d.ts", + "version": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", + "signature": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.webworker.importscripts.d.ts", + "version": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", + "signature": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.scripthost.d.ts", + "version": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", + "signature": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.decorators.d.ts", + "version": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", + "signature": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.decorators.legacy.d.ts", + "version": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", + "signature": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./index.tsx", + "version": "c7980af975245f04431574a9c187c9abd1c0ba29d83a127ad2af4b952296f935", + "signature": "c7980af975245f04431574a9c187c9abd1c0ba29d83a127ad2af4b952296f935", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "c7980af975245f04431574a9c187c9abd1c0ba29d83a127ad2af4b952296f935", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + } + ], + "options": { + "jsx": 3, + "module": 99, + "strict": true + }, + "semanticDiagnosticsPerFile": [ + [ + "./index.tsx", + [ + { + "pos": 426, + "end": 435, + "code": 2746, + "category": 1, + "message": "This JSX tag's 'children' prop expects a single child of type 'number | undefined', but multiple children were provided." + }, + { + "pos": 426, + "end": 435, + "code": 2769, + "category": 1, + "message": "No overload matches this call.", + "messageChain": [ + { + "pos": 426, + "end": 435, + "code": 2770, + "category": 1, + "message": "The last overload gave the following error.", + "messageChain": [ + { + "pos": 426, + "end": 435, + "code": 2746, + "category": 1, + "message": "This JSX tag's 'children' prop expects a single child of type 'number | undefined', but multiple children were provided." + } + ] + } + ], + "relatedInformation": [ + { + "pos": 358, + "end": 367, + "code": 2771, + "category": 1, + "message": "The last overload is declared here." + } + ] + } + ] + ] + ], + "size": 2074 +} + From d2834c2027cf457678516d355f64fe729d6853f9 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Mon, 30 Jun 2025 16:53:51 -0700 Subject: [PATCH 15/36] Tests for reference map --- internal/collections/manytomanymap.go | 8 +- internal/execute/tscincremental_test.go | 68 ++++++ internal/incremental/snapshot.go | 40 ++-- ...ion-field-with-declaration-emit-enabled.js | 194 ++++++++++++++++++ ...e-to-modifier-of-class-expression-field.js | 171 +++++++++++++++ 5 files changed, 461 insertions(+), 20 deletions(-) create mode 100644 testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js create mode 100644 testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js diff --git a/internal/collections/manytomanymap.go b/internal/collections/manytomanymap.go index edfbd6cdec..87bfc2edb4 100644 --- a/internal/collections/manytomanymap.go +++ b/internal/collections/manytomanymap.go @@ -25,10 +25,16 @@ func (m *ManyToManyMap[K, V]) Keys() map[K]*Set[V] { func (m *ManyToManyMap[K, V]) Add(key K, valueSet *Set[V]) { existingValueSet, hasExisting := m.keyToValueSet[key] + if m.keyToValueSet == nil { + m.keyToValueSet = make(map[K]*Set[V]) + } m.keyToValueSet[key] = valueSet for value := range valueSet.Keys() { if !hasExisting || !existingValueSet.Has(value) { // Add to valueToKeySet + if m.valueToKeySet == nil { + m.valueToKeySet = make(map[V]*Set[K]) + } addToMapOfSet(m.valueToKeySet, value, key) } } @@ -46,7 +52,7 @@ func (m *ManyToManyMap[K, V]) Add(key K, valueSet *Set[V]) { func addToMapOfSet[K comparable, V comparable](mapKSetV map[K]*Set[V], key K, value V) { set, exists := mapKSetV[key] if !exists { - set := &Set[V]{} + set = &Set[V]{} mapKSetV[key] = set } set.Add(value) diff --git a/internal/execute/tscincremental_test.go b/internal/execute/tscincremental_test.go index c2e6c69531..cb7896a752 100644 --- a/internal/execute/tscincremental_test.go +++ b/internal/execute/tscincremental_test.go @@ -42,6 +42,74 @@ func TestIncremental(t *testing.T) { )`, }, "/home/src/workspaces/project"), }, + { + subScenario: "change to modifier of class expression field with declaration emit enabled", + sys: newTestSys(FileMap{ + "/home/src/workspaces/project/tsconfig.json": `{ "compilerOptions": { "module": "esnext", "declaration": true } }`, + "/home/src/workspaces/project/main.ts": ` + import MessageablePerson from './MessageablePerson.js'; + function logMessage( person: MessageablePerson ) { + console.log( person.message ); + }`, + "/home/src/workspaces/project/MessageablePerson.ts": ` + const Messageable = () => { + return class MessageableClass { + public message = 'hello'; + } + }; + const wrapper = () => Messageable(); + type MessageablePerson = InstanceType>; + export default MessageablePerson;`, + }, "/home/src/workspaces/project"), + commandLineArgs: []string{"--incremental"}, + // edits: [ + // noChangeRun, + // { + // caption: "modify public to protected", + // edit: sys => sys.replaceFileText("/home/src/workspaces/project/MessageablePerson.ts", "public", "protected"), + // }, + // noChangeRun, + // { + // caption: "modify protected to public", + // edit: sys => sys.replaceFileText("/home/src/workspaces/project/MessageablePerson.ts", "protected", "public"), + // }, + // noChangeRun, + // ], + }, + { + subScenario: "change to modifier of class expression field", + sys: newTestSys(FileMap{ + "/home/src/workspaces/project/tsconfig.json": `{ "compilerOptions": { "module": "esnext" } }`, + "/home/src/workspaces/project/main.ts": ` + import MessageablePerson from './MessageablePerson.js'; + function logMessage( person: MessageablePerson ) { + console.log( person.message ); + }`, + "/home/src/workspaces/project/MessageablePerson.ts": ` + const Messageable = () => { + return class MessageableClass { + public message = 'hello'; + } + }; + const wrapper = () => Messageable(); + type MessageablePerson = InstanceType>; + export default MessageablePerson;`, + }, "/home/src/workspaces/project"), + commandLineArgs: []string{"--incremental"}, + // edits: [ + // noChangeRun, + // { + // caption: "modify public to protected", + // edit: sys => sys.replaceFileText("/home/src/workspaces/project/MessageablePerson.ts", "public", "protected"), + // }, + // noChangeRun, + // { + // caption: "modify protected to public", + // edit: sys => sys.replaceFileText("/home/src/workspaces/project/MessageablePerson.ts", "protected", "public"), + // }, + // noChangeRun, + // ], + }, } for _, test := range testCases { diff --git a/internal/incremental/snapshot.go b/internal/incremental/snapshot.go index 48da60ac1b..3aa93f652c 100644 --- a/internal/incremental/snapshot.go +++ b/internal/incremental/snapshot.go @@ -358,33 +358,35 @@ func newSnapshotForProgram(program *compiler.Program, oldProgram *Program) *snap impliedNodeFormat := program.GetSourceFileMetaData(file.Path()).ImpliedNodeFormat affectsGlobalScope := fileAffectsGlobalScope(file) var signature string + var newReferences *collections.Set[tspath.Path] + if snapshot.referencedMap != nil { + newReferences := getReferencedFiles(program, file) + if newReferences != nil { + snapshot.referencedMap.Add(file.Path(), newReferences) + } + } if canUseStateFromOldProgram { if oldFileInfo, ok := oldProgram.snapshot.fileInfos[file.Path()]; ok { signature = oldFileInfo.signature if oldFileInfo.version == version || oldFileInfo.affectsGlobalScope != affectsGlobalScope || oldFileInfo.impliedNodeFormat != impliedNodeFormat { snapshot.addFileToChangeSet(file.Path()) - } - } else { - snapshot.addFileToChangeSet(file.Path()) - } - if snapshot.referencedMap != nil { - newReferences := getReferencedFiles(program, file) - if newReferences != nil { - snapshot.referencedMap.Add(file.Path(), newReferences) - } - oldReferences, _ := oldProgram.snapshot.referencedMap.GetValues(file.Path()) - // Referenced files changed - if !newReferences.Equals(oldReferences) { - snapshot.addFileToChangeSet(file.Path()) - } else { - for refPath := range newReferences.Keys() { - if program.GetSourceFileByPath(refPath) == nil { - // Referenced file was deleted in the new program - snapshot.addFileToChangeSet(file.Path()) - break + } else if snapshot.referencedMap != nil { + oldReferences, _ := oldProgram.snapshot.referencedMap.GetValues(file.Path()) + // Referenced files changed + if !newReferences.Equals(oldReferences) { + snapshot.addFileToChangeSet(file.Path()) + } else { + for refPath := range newReferences.Keys() { + if program.GetSourceFileByPath(refPath) == nil { + // Referenced file was deleted in the new program + snapshot.addFileToChangeSet(file.Path()) + break + } } } } + } else { + snapshot.addFileToChangeSet(file.Path()) } if !snapshot.changedFilesSet.Has(file.Path()) { if emitDiagnostics, ok := oldProgram.snapshot.emitDiagnosticsPerFile[file.Path()]; ok { diff --git a/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js new file mode 100644 index 0000000000..b39ac62e18 --- /dev/null +++ b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js @@ -0,0 +1,194 @@ + +currentDirectory::/home/src/workspaces/project +useCaseSensitiveFileNames::true +Input::--incremental +//// [/home/src/workspaces/project/MessageablePerson.ts] new file + + const Messageable = () => { + return class MessageableClass { + public message = 'hello'; + } + }; + const wrapper = () => Messageable(); + type MessageablePerson = InstanceType>; + export default MessageablePerson; +//// [/home/src/workspaces/project/main.ts] new file + + import MessageablePerson from './MessageablePerson.js'; + function logMessage( person: MessageablePerson ) { + console.log( person.message ); + } +//// [/home/src/workspaces/project/tsconfig.json] new file +{ "compilerOptions": { "module": "esnext", "declaration": true } } + +ExitStatus:: 0 + +CompilerOptions::{ + "incremental": true +} +Output:: +//// [/home/src/workspaces/project/MessageablePerson.d.ts] new file +declare const wrapper: () => { + new (): { + message: string; + }; +}; +type MessageablePerson = InstanceType>; +export default MessageablePerson; + +//// [/home/src/workspaces/project/MessageablePerson.js] new file +const Messageable = () => { + return class MessageableClass { + message = 'hello'; + }; +}; +const wrapper = () => Messageable(); +export {}; + +//// [/home/src/workspaces/project/MessageablePerson.ts] no change +//// [/home/src/workspaces/project/main.d.ts] new file +export {}; + +//// [/home/src/workspaces/project/main.js] new file +function logMessage(person) { + console.log(person.message); +} +export {}; + +//// [/home/src/workspaces/project/main.ts] no change +//// [/home/src/workspaces/project/tsconfig.json] no change +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] new file +{"Version":"FakeTSVersion","fileNames":["bundled:///libs/lib.d.ts","bundled:///libs/lib.es5.d.ts","bundled:///libs/lib.dom.d.ts","bundled:///libs/lib.webworker.importscripts.d.ts","bundled:///libs/lib.scripthost.d.ts","bundled:///libs/lib.decorators.d.ts","bundled:///libs/lib.decorators.legacy.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":["a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa",{"version":"69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a","signature":"6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe","impliedNodeFormat":1},{"version":"36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[8]],"options":{"declaration":true,"module":99},"referencedMap":[[9,1]]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] new file +{ + "Version": "FakeTSVersion", + "fileNames": [ + "bundled:///libs/lib.d.ts", + "bundled:///libs/lib.es5.d.ts", + "bundled:///libs/lib.dom.d.ts", + "bundled:///libs/lib.webworker.importscripts.d.ts", + "bundled:///libs/lib.scripthost.d.ts", + "bundled:///libs/lib.decorators.d.ts", + "bundled:///libs/lib.decorators.legacy.d.ts", + "./MessageablePerson.ts", + "./main.ts" + ], + "fileInfos": [ + { + "fileName": "bundled:///libs/lib.d.ts", + "version": "a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa", + "signature": "a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "bundled:///libs/lib.es5.d.ts", + "version": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", + "signature": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.dom.d.ts", + "version": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", + "signature": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.webworker.importscripts.d.ts", + "version": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", + "signature": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.scripthost.d.ts", + "version": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", + "signature": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.decorators.d.ts", + "version": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", + "signature": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.decorators.legacy.d.ts", + "version": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", + "signature": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./MessageablePerson.ts", + "version": "ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a", + "signature": "6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a", + "signature": "6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./main.ts", + "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", + "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", + "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./MessageablePerson.ts" + ] + ], + "options": { + "declaration": true, + "module": 99 + }, + "referencedMap": { + "./main.ts": [ + "./MessageablePerson.ts" + ] + }, + "size": 1629 +} + diff --git a/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js new file mode 100644 index 0000000000..7c89305c0d --- /dev/null +++ b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js @@ -0,0 +1,171 @@ + +currentDirectory::/home/src/workspaces/project +useCaseSensitiveFileNames::true +Input::--incremental +//// [/home/src/workspaces/project/MessageablePerson.ts] new file + + const Messageable = () => { + return class MessageableClass { + public message = 'hello'; + } + }; + const wrapper = () => Messageable(); + type MessageablePerson = InstanceType>; + export default MessageablePerson; +//// [/home/src/workspaces/project/main.ts] new file + + import MessageablePerson from './MessageablePerson.js'; + function logMessage( person: MessageablePerson ) { + console.log( person.message ); + } +//// [/home/src/workspaces/project/tsconfig.json] new file +{ "compilerOptions": { "module": "esnext" } } + +ExitStatus:: 0 + +CompilerOptions::{ + "incremental": true +} +Output:: +//// [/home/src/workspaces/project/MessageablePerson.js] new file +const Messageable = () => { + return class MessageableClass { + message = 'hello'; + }; +}; +const wrapper = () => Messageable(); +export {}; + +//// [/home/src/workspaces/project/MessageablePerson.ts] no change +//// [/home/src/workspaces/project/main.js] new file +function logMessage(person) { + console.log(person.message); +} +export {}; + +//// [/home/src/workspaces/project/main.ts] no change +//// [/home/src/workspaces/project/tsconfig.json] no change +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] new file +{"Version":"FakeTSVersion","fileNames":["bundled:///libs/lib.d.ts","bundled:///libs/lib.es5.d.ts","bundled:///libs/lib.dom.d.ts","bundled:///libs/lib.webworker.importscripts.d.ts","bundled:///libs/lib.scripthost.d.ts","bundled:///libs/lib.decorators.d.ts","bundled:///libs/lib.decorators.legacy.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":["a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa",{"version":"69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedNodeFormat":1},"ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a","36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c"],"fileIdsList":[[8]],"options":{"module":99},"referencedMap":[[9,1]]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] new file +{ + "Version": "FakeTSVersion", + "fileNames": [ + "bundled:///libs/lib.d.ts", + "bundled:///libs/lib.es5.d.ts", + "bundled:///libs/lib.dom.d.ts", + "bundled:///libs/lib.webworker.importscripts.d.ts", + "bundled:///libs/lib.scripthost.d.ts", + "bundled:///libs/lib.decorators.d.ts", + "bundled:///libs/lib.decorators.legacy.d.ts", + "./MessageablePerson.ts", + "./main.ts" + ], + "fileInfos": [ + { + "fileName": "bundled:///libs/lib.d.ts", + "version": "a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa", + "signature": "a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "bundled:///libs/lib.es5.d.ts", + "version": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", + "signature": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.dom.d.ts", + "version": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", + "signature": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.webworker.importscripts.d.ts", + "version": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", + "signature": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.scripthost.d.ts", + "version": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", + "signature": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.decorators.d.ts", + "version": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", + "signature": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "bundled:///libs/lib.decorators.legacy.d.ts", + "version": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", + "signature": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./MessageablePerson.ts", + "version": "ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a", + "signature": "ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./main.ts", + "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", + "signature": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", + "impliedNodeFormat": "CommonJS" + } + ], + "fileIdsList": [ + [ + "./MessageablePerson.ts" + ] + ], + "options": { + "module": 99 + }, + "referencedMap": { + "./main.ts": [ + "./MessageablePerson.ts" + ] + }, + "size": 1384 +} + From fd9aa38e72fe44b8d2b5d62828945b7853eb7547 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Mon, 30 Jun 2025 21:42:55 -0700 Subject: [PATCH 16/36] Lint --- internal/incremental/buildInfo.go | 6 ++--- internal/incremental/program.go | 2 +- internal/incremental/snapshot.go | 2 +- internal/testutil/incrementaltestutil/fs.go | 23 ++++++++++--------- .../incrementaltestutil/readablebuildinfo.go | 2 +- internal/tsoptions/tsconfigparsing.go | 2 +- ...ion-field-with-declaration-emit-enabled.js | 4 ++-- ...e-to-modifier-of-class-expression-field.js | 4 ++-- .../incremental/serializing-error-chain.js | 4 ++-- .../noEmit/when-project-has-strict-true.js | 4 ++-- ...ativeImportExtensionsProjectReferences2.js | 16 ++++++++++--- ...ativeImportExtensionsProjectReferences3.js | 16 ++++++++++--- .../parse-tsconfig-with-typeAcquisition.js | 4 ++-- 13 files changed, 55 insertions(+), 34 deletions(-) diff --git a/internal/incremental/buildInfo.go b/internal/incremental/buildInfo.go index cb35ea0a5c..67793e8a89 100644 --- a/internal/incremental/buildInfo.go +++ b/internal/incremental/buildInfo.go @@ -222,12 +222,12 @@ func (b *BuildInfoDiagnosticsOfFile) UnmarshalJSON(data []byte) error { } var fileId BuildInfoFileId if err := json.Unmarshal(fileIdAndDiagnostics[0], &fileId); err != nil { - return fmt.Errorf("invalid fileId in BuildInfoDiagnosticsOfFile: %s", err) + return fmt.Errorf("invalid fileId in BuildInfoDiagnosticsOfFile: %w", err) } var diagnostics []*BuildInfoDiagnostic if err := json.Unmarshal(fileIdAndDiagnostics[1], &diagnostics); err != nil { - return fmt.Errorf("invalid diagnostics in BuildInfoDiagnosticsOfFile: %s", err) + return fmt.Errorf("invalid diagnostics in BuildInfoDiagnosticsOfFile: %w", err) } *b = BuildInfoDiagnosticsOfFile{ FileId: fileId, @@ -412,7 +412,7 @@ func (b *BuildInfoEmitSignature) UnmarshalJSON(data []byte) error { } type BuildInfo struct { - Version string + Version string `json:"version,omitzero"` // Common between incremental and tsc -b buildinfo for non incremental programs Errors bool `json:"errors,omitzero"` diff --git a/internal/incremental/program.go b/internal/incremental/program.go index af49553dce..0beb5d571e 100644 --- a/internal/incremental/program.go +++ b/internal/incremental/program.go @@ -30,7 +30,7 @@ func NewProgram(program *compiler.Program, oldProgram *Program) *Program { func (h *Program) panicIfNoProgram(method string) { if h.program == nil { - panic(fmt.Sprintf("%s should not be called without program", method)) + panic(method + ": should not be called without program") } } diff --git a/internal/incremental/snapshot.go b/internal/incremental/snapshot.go index 3aa93f652c..613c2d8874 100644 --- a/internal/incremental/snapshot.go +++ b/internal/incremental/snapshot.go @@ -360,7 +360,7 @@ func newSnapshotForProgram(program *compiler.Program, oldProgram *Program) *snap var signature string var newReferences *collections.Set[tspath.Path] if snapshot.referencedMap != nil { - newReferences := getReferencedFiles(program, file) + newReferences = getReferencedFiles(program, file) if newReferences != nil { snapshot.referencedMap.Add(file.Path(), newReferences) } diff --git a/internal/testutil/incrementaltestutil/fs.go b/internal/testutil/incrementaltestutil/fs.go index ba97799223..f75bde9a50 100644 --- a/internal/testutil/incrementaltestutil/fs.go +++ b/internal/testutil/incrementaltestutil/fs.go @@ -60,19 +60,20 @@ func (f *FsHandlingBuildInfo) ReadFile(path string) (contents string, ok bool) { func (f *FsHandlingBuildInfo) WriteFile(path string, data string, writeByteOrderMark bool) error { if tspath.FileExtensionIs(path, tspath.ExtensionTsBuildInfo) { var buildInfo incremental.BuildInfo - err := json.Unmarshal([]byte(data), &buildInfo) - if err == nil && buildInfo.Version == core.Version() { - // Change it to fakeTsVersion - buildInfo.Version = fakeTsVersion - newData, err := json.Marshal(&buildInfo) - if err != nil { - return fmt.Errorf("testFs.WriteFile: failed to marshal build info after fixing version: %w", err) + if err := json.Unmarshal([]byte(data), &buildInfo); err == nil { + if buildInfo.Version == core.Version() { + // Change it to fakeTsVersion + buildInfo.Version = fakeTsVersion + newData, err := json.Marshal(&buildInfo) + if err != nil { + return fmt.Errorf("testFs.WriteFile: failed to marshal build info after fixing version: %w", err) + } + data = string(newData) } - data = string(newData) - } - if err == nil { // Write readable build info version - f.fs.WriteFile(path+".readable.baseline.txt", toReadableBuildInfo(&buildInfo, data), false) + if err := f.fs.WriteFile(path+".readable.baseline.txt", toReadableBuildInfo(&buildInfo, data), false); err != nil { + return fmt.Errorf("testFs.WriteFile: failed to write readable build info: %w", err) + } } } return f.fs.WriteFile(path, data, writeByteOrderMark) diff --git a/internal/testutil/incrementaltestutil/readablebuildinfo.go b/internal/testutil/incrementaltestutil/readablebuildinfo.go index cd6b062abd..c708353a5a 100644 --- a/internal/testutil/incrementaltestutil/readablebuildinfo.go +++ b/internal/testutil/incrementaltestutil/readablebuildinfo.go @@ -12,7 +12,7 @@ import ( type readableBuildInfo struct { buildInfo *incremental.BuildInfo - Version string + Version string `json:"version,omitzero"` // Common between incremental and tsc -b buildinfo for non incremental programs Errors bool `json:"errors,omitzero"` diff --git a/internal/tsoptions/tsconfigparsing.go b/internal/tsoptions/tsconfigparsing.go index e18be90762..ca1f87b18d 100644 --- a/internal/tsoptions/tsconfigparsing.go +++ b/internal/tsoptions/tsconfigparsing.go @@ -540,7 +540,7 @@ type CommandLineOptionNameMap map[string]*CommandLineOption func (m CommandLineOptionNameMap) Get(name string) *CommandLineOption { opt, ok := m[name] if !ok { - opt, ok = m[strings.ToLower(name)] + opt, _ = m[strings.ToLower(name)] } return opt } diff --git a/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js index b39ac62e18..a461e3b083 100644 --- a/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js +++ b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js @@ -58,10 +58,10 @@ export {}; //// [/home/src/workspaces/project/main.ts] no change //// [/home/src/workspaces/project/tsconfig.json] no change //// [/home/src/workspaces/project/tsconfig.tsbuildinfo] new file -{"Version":"FakeTSVersion","fileNames":["bundled:///libs/lib.d.ts","bundled:///libs/lib.es5.d.ts","bundled:///libs/lib.dom.d.ts","bundled:///libs/lib.webworker.importscripts.d.ts","bundled:///libs/lib.scripthost.d.ts","bundled:///libs/lib.decorators.d.ts","bundled:///libs/lib.decorators.legacy.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":["a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa",{"version":"69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a","signature":"6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe","impliedNodeFormat":1},{"version":"36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[8]],"options":{"declaration":true,"module":99},"referencedMap":[[9,1]]} +{"version":"FakeTSVersion","fileNames":["bundled:///libs/lib.d.ts","bundled:///libs/lib.es5.d.ts","bundled:///libs/lib.dom.d.ts","bundled:///libs/lib.webworker.importscripts.d.ts","bundled:///libs/lib.scripthost.d.ts","bundled:///libs/lib.decorators.d.ts","bundled:///libs/lib.decorators.legacy.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":["a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa",{"version":"69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a","signature":"6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe","impliedNodeFormat":1},{"version":"36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[8]],"options":{"declaration":true,"module":99},"referencedMap":[[9,1]]} //// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] new file { - "Version": "FakeTSVersion", + "version": "FakeTSVersion", "fileNames": [ "bundled:///libs/lib.d.ts", "bundled:///libs/lib.es5.d.ts", diff --git a/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js index 7c89305c0d..7270384bdf 100644 --- a/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js +++ b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js @@ -46,10 +46,10 @@ export {}; //// [/home/src/workspaces/project/main.ts] no change //// [/home/src/workspaces/project/tsconfig.json] no change //// [/home/src/workspaces/project/tsconfig.tsbuildinfo] new file -{"Version":"FakeTSVersion","fileNames":["bundled:///libs/lib.d.ts","bundled:///libs/lib.es5.d.ts","bundled:///libs/lib.dom.d.ts","bundled:///libs/lib.webworker.importscripts.d.ts","bundled:///libs/lib.scripthost.d.ts","bundled:///libs/lib.decorators.d.ts","bundled:///libs/lib.decorators.legacy.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":["a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa",{"version":"69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedNodeFormat":1},"ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a","36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c"],"fileIdsList":[[8]],"options":{"module":99},"referencedMap":[[9,1]]} +{"version":"FakeTSVersion","fileNames":["bundled:///libs/lib.d.ts","bundled:///libs/lib.es5.d.ts","bundled:///libs/lib.dom.d.ts","bundled:///libs/lib.webworker.importscripts.d.ts","bundled:///libs/lib.scripthost.d.ts","bundled:///libs/lib.decorators.d.ts","bundled:///libs/lib.decorators.legacy.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":["a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa",{"version":"69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedNodeFormat":1},"ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a","36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c"],"fileIdsList":[[8]],"options":{"module":99},"referencedMap":[[9,1]]} //// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] new file { - "Version": "FakeTSVersion", + "version": "FakeTSVersion", "fileNames": [ "bundled:///libs/lib.d.ts", "bundled:///libs/lib.es5.d.ts", diff --git a/testdata/baselines/reference/tsc/incremental/serializing-error-chain.js b/testdata/baselines/reference/tsc/incremental/serializing-error-chain.js index 59ec219c0d..bdb3f3945e 100644 --- a/testdata/baselines/reference/tsc/incremental/serializing-error-chain.js +++ b/testdata/baselines/reference/tsc/incremental/serializing-error-chain.js @@ -56,10 +56,10 @@ Found 2 errors in the same file, starting at: index.tsx:11 //// [/home/src/workspaces/project/index.tsx] no change //// [/home/src/workspaces/project/tsconfig.json] no change //// [/home/src/workspaces/project/tsconfig.tsbuildinfo] new file -{"Version":"FakeTSVersion","fileNames":["bundled:///libs/lib.d.ts","bundled:///libs/lib.es5.d.ts","bundled:///libs/lib.dom.d.ts","bundled:///libs/lib.webworker.importscripts.d.ts","bundled:///libs/lib.scripthost.d.ts","bundled:///libs/lib.decorators.d.ts","bundled:///libs/lib.decorators.legacy.d.ts","./index.tsx"],"fileInfos":["a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa",{"version":"69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"c7980af975245f04431574a9c187c9abd1c0ba29d83a127ad2af4b952296f935","affectsGlobalScope":true,"impliedNodeFormat":1}],"options":{"jsx":3,"module":99,"strict":true},"semanticDiagnosticsPerFile":[[8,[{"pos":426,"end":435,"code":2746,"category":1,"message":"This JSX tag's 'children' prop expects a single child of type 'number | undefined', but multiple children were provided."},{"pos":426,"end":435,"code":2769,"category":1,"message":"No overload matches this call.","messageChain":[{"pos":426,"end":435,"code":2770,"category":1,"message":"The last overload gave the following error.","messageChain":[{"pos":426,"end":435,"code":2746,"category":1,"message":"This JSX tag's 'children' prop expects a single child of type 'number | undefined', but multiple children were provided."}]}],"relatedInformation":[{"pos":358,"end":367,"code":2771,"category":1,"message":"The last overload is declared here."}]}]]]} +{"version":"FakeTSVersion","fileNames":["bundled:///libs/lib.d.ts","bundled:///libs/lib.es5.d.ts","bundled:///libs/lib.dom.d.ts","bundled:///libs/lib.webworker.importscripts.d.ts","bundled:///libs/lib.scripthost.d.ts","bundled:///libs/lib.decorators.d.ts","bundled:///libs/lib.decorators.legacy.d.ts","./index.tsx"],"fileInfos":["a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa",{"version":"69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"c7980af975245f04431574a9c187c9abd1c0ba29d83a127ad2af4b952296f935","affectsGlobalScope":true,"impliedNodeFormat":1}],"options":{"jsx":3,"module":99,"strict":true},"semanticDiagnosticsPerFile":[[8,[{"pos":426,"end":435,"code":2746,"category":1,"message":"This JSX tag's 'children' prop expects a single child of type 'number | undefined', but multiple children were provided."},{"pos":426,"end":435,"code":2769,"category":1,"message":"No overload matches this call.","messageChain":[{"pos":426,"end":435,"code":2770,"category":1,"message":"The last overload gave the following error.","messageChain":[{"pos":426,"end":435,"code":2746,"category":1,"message":"This JSX tag's 'children' prop expects a single child of type 'number | undefined', but multiple children were provided."}]}],"relatedInformation":[{"pos":358,"end":367,"code":2771,"category":1,"message":"The last overload is declared here."}]}]]]} //// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] new file { - "Version": "FakeTSVersion", + "version": "FakeTSVersion", "fileNames": [ "bundled:///libs/lib.d.ts", "bundled:///libs/lib.es5.d.ts", diff --git a/testdata/baselines/reference/tsc/noEmit/when-project-has-strict-true.js b/testdata/baselines/reference/tsc/noEmit/when-project-has-strict-true.js index 6ea8717c03..b2e387b83d 100644 --- a/testdata/baselines/reference/tsc/noEmit/when-project-has-strict-true.js +++ b/testdata/baselines/reference/tsc/noEmit/when-project-has-strict-true.js @@ -21,10 +21,10 @@ Output:: //// [/home/src/workspaces/project/class1.ts] no change //// [/home/src/workspaces/project/tsconfig.json] no change //// [/home/src/workspaces/project/tsconfig.tsbuildinfo] new file -{"Version":"FakeTSVersion","fileNames":["bundled:///libs/lib.d.ts","bundled:///libs/lib.es5.d.ts","bundled:///libs/lib.dom.d.ts","bundled:///libs/lib.webworker.importscripts.d.ts","bundled:///libs/lib.scripthost.d.ts","bundled:///libs/lib.decorators.d.ts","bundled:///libs/lib.decorators.legacy.d.ts","./class1.ts"],"fileInfos":["a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa",{"version":"69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedNodeFormat":1},"a7765a20d4489ae259632d5fe609919af401c278b7a90516894ef2774ce3bc97"],"options":{"strict":true},"affectedFilesPendingEmit":[8]} +{"version":"FakeTSVersion","fileNames":["bundled:///libs/lib.d.ts","bundled:///libs/lib.es5.d.ts","bundled:///libs/lib.dom.d.ts","bundled:///libs/lib.webworker.importscripts.d.ts","bundled:///libs/lib.scripthost.d.ts","bundled:///libs/lib.decorators.d.ts","bundled:///libs/lib.decorators.legacy.d.ts","./class1.ts"],"fileInfos":["a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa",{"version":"69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedNodeFormat":1},"a7765a20d4489ae259632d5fe609919af401c278b7a90516894ef2774ce3bc97"],"options":{"strict":true},"affectedFilesPendingEmit":[8]} //// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] new file { - "Version": "FakeTSVersion", + "version": "FakeTSVersion", "fileNames": [ "bundled:///libs/lib.d.ts", "bundled:///libs/lib.es5.d.ts", diff --git a/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences2.js b/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences2.js index f91487e50f..c4ab641c14 100644 --- a/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences2.js +++ b/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences2.js @@ -49,10 +49,10 @@ export {}; Object.defineProperty(exports, "__esModule", { value: true }); //// [/home/src/workspaces/solution/dist/services/tsconfig.tsbuildinfo] new file -{"Version":"FakeTSVersion","fileNames":["bundled:///libs/lib.es5.d.ts","bundled:///libs/lib.es2015.d.ts","bundled:///libs/lib.es2016.d.ts","bundled:///libs/lib.es2017.d.ts","bundled:///libs/lib.es2018.d.ts","bundled:///libs/lib.es2019.d.ts","bundled:///libs/lib.es2020.d.ts","bundled:///libs/lib.es2021.d.ts","bundled:///libs/lib.es2022.d.ts","bundled:///libs/lib.es2023.d.ts","bundled:///libs/lib.es2024.d.ts","bundled:///libs/lib.esnext.d.ts","bundled:///libs/lib.dom.d.ts","bundled:///libs/lib.dom.iterable.d.ts","bundled:///libs/lib.dom.asynciterable.d.ts","bundled:///libs/lib.webworker.importscripts.d.ts","bundled:///libs/lib.scripthost.d.ts","bundled:///libs/lib.es2015.core.d.ts","bundled:///libs/lib.es2015.collection.d.ts","bundled:///libs/lib.es2015.generator.d.ts","bundled:///libs/lib.es2015.iterable.d.ts","bundled:///libs/lib.es2015.promise.d.ts","bundled:///libs/lib.es2015.proxy.d.ts","bundled:///libs/lib.es2015.reflect.d.ts","bundled:///libs/lib.es2015.symbol.d.ts","bundled:///libs/lib.es2015.symbol.wellknown.d.ts","bundled:///libs/lib.es2016.array.include.d.ts","bundled:///libs/lib.es2016.intl.d.ts","bundled:///libs/lib.es2017.arraybuffer.d.ts","bundled:///libs/lib.es2017.date.d.ts","bundled:///libs/lib.es2017.object.d.ts","bundled:///libs/lib.es2017.sharedmemory.d.ts","bundled:///libs/lib.es2017.string.d.ts","bundled:///libs/lib.es2017.intl.d.ts","bundled:///libs/lib.es2017.typedarrays.d.ts","bundled:///libs/lib.es2018.asyncgenerator.d.ts","bundled:///libs/lib.es2018.asynciterable.d.ts","bundled:///libs/lib.es2018.intl.d.ts","bundled:///libs/lib.es2018.promise.d.ts","bundled:///libs/lib.es2018.regexp.d.ts","bundled:///libs/lib.es2019.array.d.ts","bundled:///libs/lib.es2019.object.d.ts","bundled:///libs/lib.es2019.string.d.ts","bundled:///libs/lib.es2019.symbol.d.ts","bundled:///libs/lib.es2019.intl.d.ts","bundled:///libs/lib.es2020.bigint.d.ts","bundled:///libs/lib.es2020.date.d.ts","bundled:///libs/lib.es2020.promise.d.ts","bundled:///libs/lib.es2020.sharedmemory.d.ts","bundled:///libs/lib.es2020.string.d.ts","bundled:///libs/lib.es2020.symbol.wellknown.d.ts","bundled:///libs/lib.es2020.intl.d.ts","bundled:///libs/lib.es2020.number.d.ts","bundled:///libs/lib.es2021.promise.d.ts","bundled:///libs/lib.es2021.string.d.ts","bundled:///libs/lib.es2021.weakref.d.ts","bundled:///libs/lib.es2021.intl.d.ts","bundled:///libs/lib.es2022.array.d.ts","bundled:///libs/lib.es2022.error.d.ts","bundled:///libs/lib.es2022.intl.d.ts","bundled:///libs/lib.es2022.object.d.ts","bundled:///libs/lib.es2022.string.d.ts","bundled:///libs/lib.es2022.regexp.d.ts","bundled:///libs/lib.es2023.array.d.ts","bundled:///libs/lib.es2023.collection.d.ts","bundled:///libs/lib.es2023.intl.d.ts","bundled:///libs/lib.es2024.arraybuffer.d.ts","bundled:///libs/lib.es2024.collection.d.ts","bundled:///libs/lib.es2024.object.d.ts","bundled:///libs/lib.es2024.promise.d.ts","bundled:///libs/lib.es2024.regexp.d.ts","bundled:///libs/lib.es2024.sharedmemory.d.ts","bundled:///libs/lib.es2024.string.d.ts","bundled:///libs/lib.esnext.array.d.ts","bundled:///libs/lib.esnext.collection.d.ts","bundled:///libs/lib.esnext.intl.d.ts","bundled:///libs/lib.esnext.disposable.d.ts","bundled:///libs/lib.esnext.promise.d.ts","bundled:///libs/lib.esnext.decorators.d.ts","bundled:///libs/lib.esnext.iterator.d.ts","bundled:///libs/lib.esnext.float16.d.ts","bundled:///libs/lib.decorators.d.ts","bundled:///libs/lib.decorators.legacy.d.ts","bundled:///libs/lib.esnext.full.d.ts","../compiler/parser.d.ts","../../src/services/services.ts"],"fileInfos":[{"version":"69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546","affectsGlobalScope":true,"impliedNodeFormat":1},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","27bdc30a0e32783366a5abeda841bc22757c1797de8681bbe81fbc735eeb1c10","8fd575e12870e9944c7e1d62e1f5a73fcf23dd8d3a321f2a2c74c20d022283fe","8bf8b5e44e3c9c36f98e1007e8b7018c0f38d8adc07aecef42f5200114547c70",{"version":"092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"07f073f19d67f74d732b1adea08e1dc66b1b58d77cb5b43931dee3d798a2fd53","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d7a3c8b952931daebdfc7a2897c53c0a1c73624593fa070e46bd537e64dcd20a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b5ce7a470bc3628408429040c4e3a53a27755022a32fd05e2cb694e7015386c7","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"df83c2a6c73228b625b0beb6669c7ee2a09c914637e2d35170723ad49c0f5cd4","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8e3c06ea092138bf9fa5e874a1fdbc9d54805d074bee1de31b99a11e2fec239d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"87dc0f382502f5bbce5129bdc0aea21e19a3abbc19259e0b43ae038a9fc4e326","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b1cb28af0c891c8c96b2d6b7be76bd394fddcfdb4709a20ba05a7c1605eea0f9","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2fef54945a13095fdb9b84f705f2b5994597640c46afeb2ce78352fab4cb3279","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ac77cb3e8c6d3565793eb90a8373ee8033146315a3dbead3bde8db5eaf5e5ec6","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"56e4ed5aab5f5920980066a9409bfaf53e6d21d3f8d020c17e4de584d29600ad","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4ece9f17b3866cc077099c73f4983bddbcb1dc7ddb943227f1ec070f529dedd1","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0a6282c8827e4b9a95f4bf4f5c205673ada31b982f50572d27103df8ceb8013c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1c9319a09485199c1f7b0498f2988d6d2249793ef67edda49d1e584746be9032","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"e3a2a0cee0f03ffdde24d89660eba2685bfbdeae955a6c67e8c4c9fd28928eeb","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"51ad4c928303041605b4d7ae32e0c1ee387d43a24cd6f1ebf4a2699e1076d4fa","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"60037901da1a425516449b9a20073aa03386cce92f7a1fd902d7602be3a7c2e9","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"22adec94ef7047a6c9d1af3cb96be87a335908bf9ef386ae9fd50eeb37f44c47","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4245fee526a7d1754529d19227ecbf3be066ff79ebb6a380d78e41648f2f224d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedNodeFormat":1},"bde31fd423cd93b0eff97197a3f66df7c93e8c0c335cbeb113b7ff1ac35c23f4","2e29cd9a98755c46896f7a2d56524db2d6d96b248e36db46de14c30bf47c8d05",{"version":"407537635fda1a543a422ecdd456c1402aaa2083cde5acfb4eb424ab02fc0612","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"options":{"composite":true,"module":199,"outDir":"..","rewriteRelativeImportExtensions":true,"rootDir":"../../src"},"latestChangedDtsFile":"./services.d.ts"} +{"version":"FakeTSVersion","fileNames":["bundled:///libs/lib.es5.d.ts","bundled:///libs/lib.es2015.d.ts","bundled:///libs/lib.es2016.d.ts","bundled:///libs/lib.es2017.d.ts","bundled:///libs/lib.es2018.d.ts","bundled:///libs/lib.es2019.d.ts","bundled:///libs/lib.es2020.d.ts","bundled:///libs/lib.es2021.d.ts","bundled:///libs/lib.es2022.d.ts","bundled:///libs/lib.es2023.d.ts","bundled:///libs/lib.es2024.d.ts","bundled:///libs/lib.esnext.d.ts","bundled:///libs/lib.dom.d.ts","bundled:///libs/lib.dom.iterable.d.ts","bundled:///libs/lib.dom.asynciterable.d.ts","bundled:///libs/lib.webworker.importscripts.d.ts","bundled:///libs/lib.scripthost.d.ts","bundled:///libs/lib.es2015.core.d.ts","bundled:///libs/lib.es2015.collection.d.ts","bundled:///libs/lib.es2015.generator.d.ts","bundled:///libs/lib.es2015.iterable.d.ts","bundled:///libs/lib.es2015.promise.d.ts","bundled:///libs/lib.es2015.proxy.d.ts","bundled:///libs/lib.es2015.reflect.d.ts","bundled:///libs/lib.es2015.symbol.d.ts","bundled:///libs/lib.es2015.symbol.wellknown.d.ts","bundled:///libs/lib.es2016.array.include.d.ts","bundled:///libs/lib.es2016.intl.d.ts","bundled:///libs/lib.es2017.arraybuffer.d.ts","bundled:///libs/lib.es2017.date.d.ts","bundled:///libs/lib.es2017.object.d.ts","bundled:///libs/lib.es2017.sharedmemory.d.ts","bundled:///libs/lib.es2017.string.d.ts","bundled:///libs/lib.es2017.intl.d.ts","bundled:///libs/lib.es2017.typedarrays.d.ts","bundled:///libs/lib.es2018.asyncgenerator.d.ts","bundled:///libs/lib.es2018.asynciterable.d.ts","bundled:///libs/lib.es2018.intl.d.ts","bundled:///libs/lib.es2018.promise.d.ts","bundled:///libs/lib.es2018.regexp.d.ts","bundled:///libs/lib.es2019.array.d.ts","bundled:///libs/lib.es2019.object.d.ts","bundled:///libs/lib.es2019.string.d.ts","bundled:///libs/lib.es2019.symbol.d.ts","bundled:///libs/lib.es2019.intl.d.ts","bundled:///libs/lib.es2020.bigint.d.ts","bundled:///libs/lib.es2020.date.d.ts","bundled:///libs/lib.es2020.promise.d.ts","bundled:///libs/lib.es2020.sharedmemory.d.ts","bundled:///libs/lib.es2020.string.d.ts","bundled:///libs/lib.es2020.symbol.wellknown.d.ts","bundled:///libs/lib.es2020.intl.d.ts","bundled:///libs/lib.es2020.number.d.ts","bundled:///libs/lib.es2021.promise.d.ts","bundled:///libs/lib.es2021.string.d.ts","bundled:///libs/lib.es2021.weakref.d.ts","bundled:///libs/lib.es2021.intl.d.ts","bundled:///libs/lib.es2022.array.d.ts","bundled:///libs/lib.es2022.error.d.ts","bundled:///libs/lib.es2022.intl.d.ts","bundled:///libs/lib.es2022.object.d.ts","bundled:///libs/lib.es2022.string.d.ts","bundled:///libs/lib.es2022.regexp.d.ts","bundled:///libs/lib.es2023.array.d.ts","bundled:///libs/lib.es2023.collection.d.ts","bundled:///libs/lib.es2023.intl.d.ts","bundled:///libs/lib.es2024.arraybuffer.d.ts","bundled:///libs/lib.es2024.collection.d.ts","bundled:///libs/lib.es2024.object.d.ts","bundled:///libs/lib.es2024.promise.d.ts","bundled:///libs/lib.es2024.regexp.d.ts","bundled:///libs/lib.es2024.sharedmemory.d.ts","bundled:///libs/lib.es2024.string.d.ts","bundled:///libs/lib.esnext.array.d.ts","bundled:///libs/lib.esnext.collection.d.ts","bundled:///libs/lib.esnext.intl.d.ts","bundled:///libs/lib.esnext.disposable.d.ts","bundled:///libs/lib.esnext.promise.d.ts","bundled:///libs/lib.esnext.decorators.d.ts","bundled:///libs/lib.esnext.iterator.d.ts","bundled:///libs/lib.esnext.float16.d.ts","bundled:///libs/lib.decorators.d.ts","bundled:///libs/lib.decorators.legacy.d.ts","bundled:///libs/lib.esnext.full.d.ts","../compiler/parser.d.ts","../../src/services/services.ts"],"fileInfos":[{"version":"69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546","affectsGlobalScope":true,"impliedNodeFormat":1},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","27bdc30a0e32783366a5abeda841bc22757c1797de8681bbe81fbc735eeb1c10","8fd575e12870e9944c7e1d62e1f5a73fcf23dd8d3a321f2a2c74c20d022283fe","8bf8b5e44e3c9c36f98e1007e8b7018c0f38d8adc07aecef42f5200114547c70",{"version":"092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"07f073f19d67f74d732b1adea08e1dc66b1b58d77cb5b43931dee3d798a2fd53","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d7a3c8b952931daebdfc7a2897c53c0a1c73624593fa070e46bd537e64dcd20a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b5ce7a470bc3628408429040c4e3a53a27755022a32fd05e2cb694e7015386c7","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"df83c2a6c73228b625b0beb6669c7ee2a09c914637e2d35170723ad49c0f5cd4","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8e3c06ea092138bf9fa5e874a1fdbc9d54805d074bee1de31b99a11e2fec239d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"87dc0f382502f5bbce5129bdc0aea21e19a3abbc19259e0b43ae038a9fc4e326","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b1cb28af0c891c8c96b2d6b7be76bd394fddcfdb4709a20ba05a7c1605eea0f9","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2fef54945a13095fdb9b84f705f2b5994597640c46afeb2ce78352fab4cb3279","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ac77cb3e8c6d3565793eb90a8373ee8033146315a3dbead3bde8db5eaf5e5ec6","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"56e4ed5aab5f5920980066a9409bfaf53e6d21d3f8d020c17e4de584d29600ad","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4ece9f17b3866cc077099c73f4983bddbcb1dc7ddb943227f1ec070f529dedd1","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0a6282c8827e4b9a95f4bf4f5c205673ada31b982f50572d27103df8ceb8013c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1c9319a09485199c1f7b0498f2988d6d2249793ef67edda49d1e584746be9032","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"e3a2a0cee0f03ffdde24d89660eba2685bfbdeae955a6c67e8c4c9fd28928eeb","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"51ad4c928303041605b4d7ae32e0c1ee387d43a24cd6f1ebf4a2699e1076d4fa","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"60037901da1a425516449b9a20073aa03386cce92f7a1fd902d7602be3a7c2e9","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"22adec94ef7047a6c9d1af3cb96be87a335908bf9ef386ae9fd50eeb37f44c47","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4245fee526a7d1754529d19227ecbf3be066ff79ebb6a380d78e41648f2f224d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedNodeFormat":1},"bde31fd423cd93b0eff97197a3f66df7c93e8c0c335cbeb113b7ff1ac35c23f4","2e29cd9a98755c46896f7a2d56524db2d6d96b248e36db46de14c30bf47c8d05",{"version":"407537635fda1a543a422ecdd456c1402aaa2083cde5acfb4eb424ab02fc0612","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[85]],"options":{"composite":true,"module":199,"outDir":"..","rewriteRelativeImportExtensions":true,"rootDir":"../../src"},"referencedMap":[[86,1]],"latestChangedDtsFile":"./services.d.ts"} //// [/home/src/workspaces/solution/dist/services/tsconfig.tsbuildinfo.readable.baseline.txt] new file { - "Version": "FakeTSVersion", + "version": "FakeTSVersion", "fileNames": [ "bundled:///libs/lib.es5.d.ts", "bundled:///libs/lib.es2015.d.ts", @@ -1096,6 +1096,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); } } ], + "fileIdsList": [ + [ + "../compiler/parser.d.ts" + ] + ], "options": { "composite": true, "module": 199, @@ -1103,8 +1108,13 @@ Object.defineProperty(exports, "__esModule", { value: true }); "rewriteRelativeImportExtensions": true, "rootDir": "../../src" }, + "referencedMap": { + "../../src/services/services.ts": [ + "../compiler/parser.d.ts" + ] + }, "latestChangedDtsFile": "./services.d.ts", - "size": 13908 + "size": 13954 } //// [/home/src/workspaces/solution/src/compiler/parser.ts] no change //// [/home/src/workspaces/solution/src/compiler/tsconfig.json] no change diff --git a/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences3.js b/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences3.js index 525e3fece6..f99c2788d1 100644 --- a/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences3.js +++ b/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences3.js @@ -53,10 +53,10 @@ export {}; Object.defineProperty(exports, "__esModule", { value: true }); //// [/home/src/workspaces/solution/dist/services/tsconfig.tsbuildinfo] new file -{"Version":"FakeTSVersion","fileNames":["bundled:///libs/lib.es5.d.ts","bundled:///libs/lib.es2015.d.ts","bundled:///libs/lib.es2016.d.ts","bundled:///libs/lib.es2017.d.ts","bundled:///libs/lib.es2018.d.ts","bundled:///libs/lib.es2019.d.ts","bundled:///libs/lib.es2020.d.ts","bundled:///libs/lib.es2021.d.ts","bundled:///libs/lib.es2022.d.ts","bundled:///libs/lib.es2023.d.ts","bundled:///libs/lib.es2024.d.ts","bundled:///libs/lib.esnext.d.ts","bundled:///libs/lib.dom.d.ts","bundled:///libs/lib.dom.iterable.d.ts","bundled:///libs/lib.dom.asynciterable.d.ts","bundled:///libs/lib.webworker.importscripts.d.ts","bundled:///libs/lib.scripthost.d.ts","bundled:///libs/lib.es2015.core.d.ts","bundled:///libs/lib.es2015.collection.d.ts","bundled:///libs/lib.es2015.generator.d.ts","bundled:///libs/lib.es2015.iterable.d.ts","bundled:///libs/lib.es2015.promise.d.ts","bundled:///libs/lib.es2015.proxy.d.ts","bundled:///libs/lib.es2015.reflect.d.ts","bundled:///libs/lib.es2015.symbol.d.ts","bundled:///libs/lib.es2015.symbol.wellknown.d.ts","bundled:///libs/lib.es2016.array.include.d.ts","bundled:///libs/lib.es2016.intl.d.ts","bundled:///libs/lib.es2017.arraybuffer.d.ts","bundled:///libs/lib.es2017.date.d.ts","bundled:///libs/lib.es2017.object.d.ts","bundled:///libs/lib.es2017.sharedmemory.d.ts","bundled:///libs/lib.es2017.string.d.ts","bundled:///libs/lib.es2017.intl.d.ts","bundled:///libs/lib.es2017.typedarrays.d.ts","bundled:///libs/lib.es2018.asyncgenerator.d.ts","bundled:///libs/lib.es2018.asynciterable.d.ts","bundled:///libs/lib.es2018.intl.d.ts","bundled:///libs/lib.es2018.promise.d.ts","bundled:///libs/lib.es2018.regexp.d.ts","bundled:///libs/lib.es2019.array.d.ts","bundled:///libs/lib.es2019.object.d.ts","bundled:///libs/lib.es2019.string.d.ts","bundled:///libs/lib.es2019.symbol.d.ts","bundled:///libs/lib.es2019.intl.d.ts","bundled:///libs/lib.es2020.bigint.d.ts","bundled:///libs/lib.es2020.date.d.ts","bundled:///libs/lib.es2020.promise.d.ts","bundled:///libs/lib.es2020.sharedmemory.d.ts","bundled:///libs/lib.es2020.string.d.ts","bundled:///libs/lib.es2020.symbol.wellknown.d.ts","bundled:///libs/lib.es2020.intl.d.ts","bundled:///libs/lib.es2020.number.d.ts","bundled:///libs/lib.es2021.promise.d.ts","bundled:///libs/lib.es2021.string.d.ts","bundled:///libs/lib.es2021.weakref.d.ts","bundled:///libs/lib.es2021.intl.d.ts","bundled:///libs/lib.es2022.array.d.ts","bundled:///libs/lib.es2022.error.d.ts","bundled:///libs/lib.es2022.intl.d.ts","bundled:///libs/lib.es2022.object.d.ts","bundled:///libs/lib.es2022.string.d.ts","bundled:///libs/lib.es2022.regexp.d.ts","bundled:///libs/lib.es2023.array.d.ts","bundled:///libs/lib.es2023.collection.d.ts","bundled:///libs/lib.es2023.intl.d.ts","bundled:///libs/lib.es2024.arraybuffer.d.ts","bundled:///libs/lib.es2024.collection.d.ts","bundled:///libs/lib.es2024.object.d.ts","bundled:///libs/lib.es2024.promise.d.ts","bundled:///libs/lib.es2024.regexp.d.ts","bundled:///libs/lib.es2024.sharedmemory.d.ts","bundled:///libs/lib.es2024.string.d.ts","bundled:///libs/lib.esnext.array.d.ts","bundled:///libs/lib.esnext.collection.d.ts","bundled:///libs/lib.esnext.intl.d.ts","bundled:///libs/lib.esnext.disposable.d.ts","bundled:///libs/lib.esnext.promise.d.ts","bundled:///libs/lib.esnext.decorators.d.ts","bundled:///libs/lib.esnext.iterator.d.ts","bundled:///libs/lib.esnext.float16.d.ts","bundled:///libs/lib.decorators.d.ts","bundled:///libs/lib.decorators.legacy.d.ts","bundled:///libs/lib.esnext.full.d.ts","../compiler/parser.d.ts","../../src/services/services.ts"],"fileInfos":[{"version":"69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546","affectsGlobalScope":true,"impliedNodeFormat":1},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","27bdc30a0e32783366a5abeda841bc22757c1797de8681bbe81fbc735eeb1c10","8fd575e12870e9944c7e1d62e1f5a73fcf23dd8d3a321f2a2c74c20d022283fe","8bf8b5e44e3c9c36f98e1007e8b7018c0f38d8adc07aecef42f5200114547c70",{"version":"092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"07f073f19d67f74d732b1adea08e1dc66b1b58d77cb5b43931dee3d798a2fd53","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d7a3c8b952931daebdfc7a2897c53c0a1c73624593fa070e46bd537e64dcd20a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b5ce7a470bc3628408429040c4e3a53a27755022a32fd05e2cb694e7015386c7","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"df83c2a6c73228b625b0beb6669c7ee2a09c914637e2d35170723ad49c0f5cd4","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8e3c06ea092138bf9fa5e874a1fdbc9d54805d074bee1de31b99a11e2fec239d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"87dc0f382502f5bbce5129bdc0aea21e19a3abbc19259e0b43ae038a9fc4e326","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b1cb28af0c891c8c96b2d6b7be76bd394fddcfdb4709a20ba05a7c1605eea0f9","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2fef54945a13095fdb9b84f705f2b5994597640c46afeb2ce78352fab4cb3279","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ac77cb3e8c6d3565793eb90a8373ee8033146315a3dbead3bde8db5eaf5e5ec6","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"56e4ed5aab5f5920980066a9409bfaf53e6d21d3f8d020c17e4de584d29600ad","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4ece9f17b3866cc077099c73f4983bddbcb1dc7ddb943227f1ec070f529dedd1","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0a6282c8827e4b9a95f4bf4f5c205673ada31b982f50572d27103df8ceb8013c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1c9319a09485199c1f7b0498f2988d6d2249793ef67edda49d1e584746be9032","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"e3a2a0cee0f03ffdde24d89660eba2685bfbdeae955a6c67e8c4c9fd28928eeb","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"51ad4c928303041605b4d7ae32e0c1ee387d43a24cd6f1ebf4a2699e1076d4fa","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"60037901da1a425516449b9a20073aa03386cce92f7a1fd902d7602be3a7c2e9","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"22adec94ef7047a6c9d1af3cb96be87a335908bf9ef386ae9fd50eeb37f44c47","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4245fee526a7d1754529d19227ecbf3be066ff79ebb6a380d78e41648f2f224d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedNodeFormat":1},"bde31fd423cd93b0eff97197a3f66df7c93e8c0c335cbeb113b7ff1ac35c23f4","2e29cd9a98755c46896f7a2d56524db2d6d96b248e36db46de14c30bf47c8d05",{"version":"407537635fda1a543a422ecdd456c1402aaa2083cde5acfb4eb424ab02fc0612","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"options":{"composite":true,"module":199,"outDir":"./","rewriteRelativeImportExtensions":true,"rootDir":"../../src/services"},"latestChangedDtsFile":"./services.d.ts"} +{"version":"FakeTSVersion","fileNames":["bundled:///libs/lib.es5.d.ts","bundled:///libs/lib.es2015.d.ts","bundled:///libs/lib.es2016.d.ts","bundled:///libs/lib.es2017.d.ts","bundled:///libs/lib.es2018.d.ts","bundled:///libs/lib.es2019.d.ts","bundled:///libs/lib.es2020.d.ts","bundled:///libs/lib.es2021.d.ts","bundled:///libs/lib.es2022.d.ts","bundled:///libs/lib.es2023.d.ts","bundled:///libs/lib.es2024.d.ts","bundled:///libs/lib.esnext.d.ts","bundled:///libs/lib.dom.d.ts","bundled:///libs/lib.dom.iterable.d.ts","bundled:///libs/lib.dom.asynciterable.d.ts","bundled:///libs/lib.webworker.importscripts.d.ts","bundled:///libs/lib.scripthost.d.ts","bundled:///libs/lib.es2015.core.d.ts","bundled:///libs/lib.es2015.collection.d.ts","bundled:///libs/lib.es2015.generator.d.ts","bundled:///libs/lib.es2015.iterable.d.ts","bundled:///libs/lib.es2015.promise.d.ts","bundled:///libs/lib.es2015.proxy.d.ts","bundled:///libs/lib.es2015.reflect.d.ts","bundled:///libs/lib.es2015.symbol.d.ts","bundled:///libs/lib.es2015.symbol.wellknown.d.ts","bundled:///libs/lib.es2016.array.include.d.ts","bundled:///libs/lib.es2016.intl.d.ts","bundled:///libs/lib.es2017.arraybuffer.d.ts","bundled:///libs/lib.es2017.date.d.ts","bundled:///libs/lib.es2017.object.d.ts","bundled:///libs/lib.es2017.sharedmemory.d.ts","bundled:///libs/lib.es2017.string.d.ts","bundled:///libs/lib.es2017.intl.d.ts","bundled:///libs/lib.es2017.typedarrays.d.ts","bundled:///libs/lib.es2018.asyncgenerator.d.ts","bundled:///libs/lib.es2018.asynciterable.d.ts","bundled:///libs/lib.es2018.intl.d.ts","bundled:///libs/lib.es2018.promise.d.ts","bundled:///libs/lib.es2018.regexp.d.ts","bundled:///libs/lib.es2019.array.d.ts","bundled:///libs/lib.es2019.object.d.ts","bundled:///libs/lib.es2019.string.d.ts","bundled:///libs/lib.es2019.symbol.d.ts","bundled:///libs/lib.es2019.intl.d.ts","bundled:///libs/lib.es2020.bigint.d.ts","bundled:///libs/lib.es2020.date.d.ts","bundled:///libs/lib.es2020.promise.d.ts","bundled:///libs/lib.es2020.sharedmemory.d.ts","bundled:///libs/lib.es2020.string.d.ts","bundled:///libs/lib.es2020.symbol.wellknown.d.ts","bundled:///libs/lib.es2020.intl.d.ts","bundled:///libs/lib.es2020.number.d.ts","bundled:///libs/lib.es2021.promise.d.ts","bundled:///libs/lib.es2021.string.d.ts","bundled:///libs/lib.es2021.weakref.d.ts","bundled:///libs/lib.es2021.intl.d.ts","bundled:///libs/lib.es2022.array.d.ts","bundled:///libs/lib.es2022.error.d.ts","bundled:///libs/lib.es2022.intl.d.ts","bundled:///libs/lib.es2022.object.d.ts","bundled:///libs/lib.es2022.string.d.ts","bundled:///libs/lib.es2022.regexp.d.ts","bundled:///libs/lib.es2023.array.d.ts","bundled:///libs/lib.es2023.collection.d.ts","bundled:///libs/lib.es2023.intl.d.ts","bundled:///libs/lib.es2024.arraybuffer.d.ts","bundled:///libs/lib.es2024.collection.d.ts","bundled:///libs/lib.es2024.object.d.ts","bundled:///libs/lib.es2024.promise.d.ts","bundled:///libs/lib.es2024.regexp.d.ts","bundled:///libs/lib.es2024.sharedmemory.d.ts","bundled:///libs/lib.es2024.string.d.ts","bundled:///libs/lib.esnext.array.d.ts","bundled:///libs/lib.esnext.collection.d.ts","bundled:///libs/lib.esnext.intl.d.ts","bundled:///libs/lib.esnext.disposable.d.ts","bundled:///libs/lib.esnext.promise.d.ts","bundled:///libs/lib.esnext.decorators.d.ts","bundled:///libs/lib.esnext.iterator.d.ts","bundled:///libs/lib.esnext.float16.d.ts","bundled:///libs/lib.decorators.d.ts","bundled:///libs/lib.decorators.legacy.d.ts","bundled:///libs/lib.esnext.full.d.ts","../compiler/parser.d.ts","../../src/services/services.ts"],"fileInfos":[{"version":"69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546","affectsGlobalScope":true,"impliedNodeFormat":1},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","27bdc30a0e32783366a5abeda841bc22757c1797de8681bbe81fbc735eeb1c10","8fd575e12870e9944c7e1d62e1f5a73fcf23dd8d3a321f2a2c74c20d022283fe","8bf8b5e44e3c9c36f98e1007e8b7018c0f38d8adc07aecef42f5200114547c70",{"version":"092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"07f073f19d67f74d732b1adea08e1dc66b1b58d77cb5b43931dee3d798a2fd53","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d7a3c8b952931daebdfc7a2897c53c0a1c73624593fa070e46bd537e64dcd20a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b5ce7a470bc3628408429040c4e3a53a27755022a32fd05e2cb694e7015386c7","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"df83c2a6c73228b625b0beb6669c7ee2a09c914637e2d35170723ad49c0f5cd4","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8e3c06ea092138bf9fa5e874a1fdbc9d54805d074bee1de31b99a11e2fec239d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"87dc0f382502f5bbce5129bdc0aea21e19a3abbc19259e0b43ae038a9fc4e326","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b1cb28af0c891c8c96b2d6b7be76bd394fddcfdb4709a20ba05a7c1605eea0f9","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2fef54945a13095fdb9b84f705f2b5994597640c46afeb2ce78352fab4cb3279","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ac77cb3e8c6d3565793eb90a8373ee8033146315a3dbead3bde8db5eaf5e5ec6","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"56e4ed5aab5f5920980066a9409bfaf53e6d21d3f8d020c17e4de584d29600ad","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4ece9f17b3866cc077099c73f4983bddbcb1dc7ddb943227f1ec070f529dedd1","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0a6282c8827e4b9a95f4bf4f5c205673ada31b982f50572d27103df8ceb8013c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1c9319a09485199c1f7b0498f2988d6d2249793ef67edda49d1e584746be9032","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"e3a2a0cee0f03ffdde24d89660eba2685bfbdeae955a6c67e8c4c9fd28928eeb","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"51ad4c928303041605b4d7ae32e0c1ee387d43a24cd6f1ebf4a2699e1076d4fa","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"60037901da1a425516449b9a20073aa03386cce92f7a1fd902d7602be3a7c2e9","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"22adec94ef7047a6c9d1af3cb96be87a335908bf9ef386ae9fd50eeb37f44c47","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4245fee526a7d1754529d19227ecbf3be066ff79ebb6a380d78e41648f2f224d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedNodeFormat":1},"bde31fd423cd93b0eff97197a3f66df7c93e8c0c335cbeb113b7ff1ac35c23f4","2e29cd9a98755c46896f7a2d56524db2d6d96b248e36db46de14c30bf47c8d05",{"version":"407537635fda1a543a422ecdd456c1402aaa2083cde5acfb4eb424ab02fc0612","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[85]],"options":{"composite":true,"module":199,"outDir":"./","rewriteRelativeImportExtensions":true,"rootDir":"../../src/services"},"referencedMap":[[86,1]],"latestChangedDtsFile":"./services.d.ts"} //// [/home/src/workspaces/solution/dist/services/tsconfig.tsbuildinfo.readable.baseline.txt] new file { - "Version": "FakeTSVersion", + "version": "FakeTSVersion", "fileNames": [ "bundled:///libs/lib.es5.d.ts", "bundled:///libs/lib.es2015.d.ts", @@ -1100,6 +1100,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); } } ], + "fileIdsList": [ + [ + "../compiler/parser.d.ts" + ] + ], "options": { "composite": true, "module": 199, @@ -1107,8 +1112,13 @@ Object.defineProperty(exports, "__esModule", { value: true }); "rewriteRelativeImportExtensions": true, "rootDir": "../../src/services" }, + "referencedMap": { + "../../src/services/services.ts": [ + "../compiler/parser.d.ts" + ] + }, "latestChangedDtsFile": "./services.d.ts", - "size": 13917 + "size": 13963 } //// [/home/src/workspaces/solution/src/compiler/parser.ts] no change //// [/home/src/workspaces/solution/src/compiler/tsconfig.json] no change diff --git a/testdata/baselines/reference/tsc/typeAcquisition/parse-tsconfig-with-typeAcquisition.js b/testdata/baselines/reference/tsc/typeAcquisition/parse-tsconfig-with-typeAcquisition.js index efa9951068..96afc5dd09 100644 --- a/testdata/baselines/reference/tsc/typeAcquisition/parse-tsconfig-with-typeAcquisition.js +++ b/testdata/baselines/reference/tsc/typeAcquisition/parse-tsconfig-with-typeAcquisition.js @@ -26,10 +26,10 @@ Found 1 error. //// [/home/src/workspaces/project/tsconfig.json] no change //// [/home/src/workspaces/project/tsconfig.tsbuildinfo] new file -{"Version":"FakeTSVersion","fileNames":["bundled:///libs/lib.d.ts","bundled:///libs/lib.es5.d.ts","bundled:///libs/lib.dom.d.ts","bundled:///libs/lib.webworker.importscripts.d.ts","bundled:///libs/lib.scripthost.d.ts","bundled:///libs/lib.decorators.d.ts","bundled:///libs/lib.decorators.legacy.d.ts"],"fileInfos":["a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa",{"version":"69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedNodeFormat":1}],"options":{"composite":true},"semanticDiagnosticsPerFile":[1,2,3,4,5,6,7]} +{"version":"FakeTSVersion","fileNames":["bundled:///libs/lib.d.ts","bundled:///libs/lib.es5.d.ts","bundled:///libs/lib.dom.d.ts","bundled:///libs/lib.webworker.importscripts.d.ts","bundled:///libs/lib.scripthost.d.ts","bundled:///libs/lib.decorators.d.ts","bundled:///libs/lib.decorators.legacy.d.ts"],"fileInfos":["a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa",{"version":"69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedNodeFormat":1}],"options":{"composite":true},"semanticDiagnosticsPerFile":[1,2,3,4,5,6,7]} //// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] new file { - "Version": "FakeTSVersion", + "version": "FakeTSVersion", "fileNames": [ "bundled:///libs/lib.d.ts", "bundled:///libs/lib.es5.d.ts", From 53a9bac2ac8df3fbe8051ca3f6beccd6aa4f9a44 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Mon, 30 Jun 2025 23:51:50 -0700 Subject: [PATCH 17/36] Use fake lib contents to make it deterministic for baselining as well as for better readability of baselines --- internal/execute/testfs_test.go | 83 ++ internal/execute/testsys_test.go | 142 ++- internal/execute/tsc_test.go | 18 - internal/execute/tscincremental_test.go | 14 +- internal/execute/tscprojectreferences_test.go | 8 - internal/execute/verifytsc_nocheck_test.go | 3 +- internal/execute/verifytscwatch_test.go | 6 - internal/tsoptions/enummaps.go | 5 + .../Parse---lib-option-with-file-name.js | 28 +- .../Parse--p-with-path-to-tsconfig-file.js | 29 +- .../Parse--p-with-path-to-tsconfig-folder.js | 29 +- .../reference/tsc/commandLine/Parse--p.js | 29 +- .../commandLine/Parse-enum-type-options.js | 23 + .../Parse-watch-interval-option.js | 6 +- .../commandLine/Project-is-empty-string.js | 29 +- .../extends/configDir-template-showConfig.js | 21 +- .../configDir-template-with-commandline.js | 56 +- .../tsc/extends/configDir-template.js | 56 +- ...ion-field-with-declaration-emit-enabled.js | 132 +- ...e-to-modifier-of-class-expression-field.js | 128 +- .../incremental/serializing-error-chain.js | 161 +-- .../tsc/noCheck/{outFile => }/dts-errors.js | 40 +- .../tsc/noCheck/outFile/semantic-errors.js | 44 - .../tsc/noCheck/outFile/syntax-errors.js | 52 - .../reference/tsc/noCheck/semantic-errors.js | 64 + .../reference/tsc/noCheck/syntax-errors.js | 72 ++ .../noEmit/when-project-has-strict-true.js | 121 +- ...nterop-uses-referenced-project-settings.js | 57 +- ...erveConstEnums-and-verbatimModuleSyntax.js | 49 +- ...erenced-project-with-preserveConstEnums.js | 40 +- ...ativeImportExtensionsProjectReferences1.js | 46 +- ...ativeImportExtensionsProjectReferences2.js | 1070 +---------------- ...ativeImportExtensionsProjectReferences3.js | 1070 +---------------- ...ject-contains-invalid-project-reference.js | 31 +- .../when-project-reference-is-not-built.js | 37 +- ...eferences-composite-project-with-noEmit.js | 37 +- .../when-project-references-composite.js | 40 +- .../parse-tsconfig-with-typeAcquisition.js | 124 +- .../watch-with-no-tsconfig.js | 28 +- .../noEmit/dts-errors-without-dts-enabled.js | 78 +- .../reference/tscWatch/noEmit/dts-errors.js | 89 +- .../tscWatch/noEmit/semantic-errors.js | 74 +- .../tscWatch/noEmit/syntax-errors.js | 78 +- 43 files changed, 1333 insertions(+), 3014 deletions(-) create mode 100644 internal/execute/testfs_test.go rename testdata/baselines/reference/tsc/noCheck/{outFile => }/dts-errors.js (52%) delete mode 100644 testdata/baselines/reference/tsc/noCheck/outFile/semantic-errors.js delete mode 100644 testdata/baselines/reference/tsc/noCheck/outFile/syntax-errors.js create mode 100644 testdata/baselines/reference/tsc/noCheck/semantic-errors.js create mode 100644 testdata/baselines/reference/tsc/noCheck/syntax-errors.js diff --git a/internal/execute/testfs_test.go b/internal/execute/testfs_test.go new file mode 100644 index 0000000000..a212b32600 --- /dev/null +++ b/internal/execute/testfs_test.go @@ -0,0 +1,83 @@ +package execute_test + +import ( + "github.com/microsoft/typescript-go/internal/collections" + "github.com/microsoft/typescript-go/internal/vfs" +) + +type testFsTrackingLibs struct { + fs vfs.FS + defaultLibs *collections.Set[string] +} + +var _ vfs.FS = (*testFsTrackingLibs)(nil) + +func NewFSTrackingLibs(fs vfs.FS) *testFsTrackingLibs { + return &testFsTrackingLibs{ + fs: fs, + } +} + +func (f *testFsTrackingLibs) FS() vfs.FS { + return f.fs +} + +func (f *testFsTrackingLibs) removeIgnoreLibPath(path string) { + if f.defaultLibs != nil && f.defaultLibs.Has(path) { + f.defaultLibs.Delete(path) + } +} + +func (f *testFsTrackingLibs) UseCaseSensitiveFileNames() bool { + return f.fs.UseCaseSensitiveFileNames() +} + +// FileExists returns true if the file exists. +func (f *testFsTrackingLibs) FileExists(path string) bool { + return f.fs.FileExists(path) +} + +// ReadFile reads the file specified by path and returns the content. +// If the file fails to be read, ok will be false. +func (f *testFsTrackingLibs) ReadFile(path string) (contents string, ok bool) { + f.removeIgnoreLibPath(path) + return f.fs.ReadFile(path) +} + +func (f *testFsTrackingLibs) WriteFile(path string, data string, writeByteOrderMark bool) error { + f.removeIgnoreLibPath(path) + return f.fs.WriteFile(path, data, writeByteOrderMark) +} + +// Removes `path` and all its contents. Will return the first error it encounters. +func (f *testFsTrackingLibs) Remove(path string) error { + f.removeIgnoreLibPath(path) + return f.fs.Remove(path) +} + +// DirectoryExists returns true if the path is a directory. +func (f *testFsTrackingLibs) DirectoryExists(path string) bool { + return f.fs.DirectoryExists(path) +} + +// GetAccessibleEntries returns the files/directories in the specified directory. +// If any entry is a symlink, it will be followed. +func (f *testFsTrackingLibs) GetAccessibleEntries(path string) vfs.Entries { + return f.fs.GetAccessibleEntries(path) +} + +func (f *testFsTrackingLibs) Stat(path string) vfs.FileInfo { + return f.fs.Stat(path) +} + +// WalkDir walks the file tree rooted at root, calling walkFn for each file or directory in the tree. +// It is has the same behavior as [fs.WalkDir], but with paths as [string]. +func (f *testFsTrackingLibs) WalkDir(root string, walkFn vfs.WalkDirFunc) error { + return f.fs.WalkDir(root, walkFn) +} + +// Realpath returns the "real path" of the specified path, +// following symlinks and correcting filename casing. +func (f *testFsTrackingLibs) Realpath(path string) string { + return f.fs.Realpath(path) +} diff --git a/internal/execute/testsys_test.go b/internal/execute/testsys_test.go index 539acfea99..2c7c89d512 100644 --- a/internal/execute/testsys_test.go +++ b/internal/execute/testsys_test.go @@ -10,36 +10,83 @@ import ( "strings" "time" - "github.com/microsoft/typescript-go/internal/bundled" + "github.com/microsoft/typescript-go/internal/collections" "github.com/microsoft/typescript-go/internal/testutil/incrementaltestutil" + "github.com/microsoft/typescript-go/internal/tsoptions" "github.com/microsoft/typescript-go/internal/vfs" "github.com/microsoft/typescript-go/internal/vfs/vfstest" ) -type FileMap map[string]string +type FileMap map[string]any + +var ( + tscLibPath = "/home/src/tslibs/TS/Lib" + tscDefaultLibContent = `/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; };` +) func newTestSys(fileOrFolderList FileMap, cwd string) *testSys { if cwd == "" { cwd = "/home/src/workspaces/project" } - return &testSys{ - fs: incrementaltestutil.NewFsHandlingBuildInfo(bundled.WrapFS(vfstest.FromMap(fileOrFolderList, true /*useCaseSensitiveFileNames*/))), - defaultLibraryPath: bundled.LibPath(), + sys := &testSys{ + fs: NewFSTrackingLibs(incrementaltestutil.NewFsHandlingBuildInfo(vfstest.FromMap(fileOrFolderList, true /*useCaseSensitiveFileNames*/))), + defaultLibraryPath: tscLibPath, cwd: cwd, files: slices.Collect(maps.Keys(fileOrFolderList)), output: []string{}, currentWrite: &strings.Builder{}, start: time.Now(), } + + // Ensure the default library file is present + sys.ensureLibPathExists("lib.d.ts") + for _, libFile := range tsoptions.TargetToLibMap() { + sys.ensureLibPathExists(libFile) + } + for libFile := range tsoptions.LibFilesSet.Keys() { + sys.ensureLibPathExists(libFile) + } + return sys +} + +type diffEntry struct { + content string + fileInfo fs.FileInfo +} + +type snapshot struct { + snap map[string]*diffEntry + defaultLibs *collections.Set[string] } type testSys struct { // todo: original has write to output as a string[] because the separations are needed for baselining output []string currentWrite *strings.Builder - serializedDiff map[string]string + serializedDiff *snapshot - fs *incrementaltestutil.FsHandlingBuildInfo + fs *testFsTrackingLibs defaultLibraryPath string cwd string files []string @@ -47,11 +94,6 @@ type testSys struct { start time.Time } -func (s *testSys) IsTestDone() bool { - // todo: test is done if there are no edits left. Edits are not yet implemented - return true -} - func (s *testSys) Now() time.Time { // todo: make a "test time" structure return time.Now() @@ -66,7 +108,18 @@ func (s *testSys) FS() vfs.FS { } func (s *testSys) TestFS() *incrementaltestutil.FsHandlingBuildInfo { - return s.fs + return s.fs.fs.(*incrementaltestutil.FsHandlingBuildInfo) +} + +func (s *testSys) ensureLibPathExists(path string) { + path = tscLibPath + "/" + path + if _, ok := s.TestFS().ReadFile(path); !ok { + if s.fs.defaultLibs == nil { + s.fs.defaultLibs = collections.NewSetWithSizeHint[string](tsoptions.LibFilesSet.Len() + len(tsoptions.TargetToLibMap()) + 1) + } + s.fs.defaultLibs.Add(path) + s.TestFS().WriteFile(path, tscDefaultLibContent, false) + } } func (s *testSys) DefaultLibraryPath() string { @@ -115,7 +168,7 @@ func (s *testSys) baselineOutput(baseline io.Writer) { func (s *testSys) baselineFSwithDiff(baseline io.Writer) { // todo: baselines the entire fs, possibly doesn't correctly diff all cases of emitted files, since emit isn't fully implemented and doesn't always emit the same way as strada - snap := map[string]string{} + snap := map[string]*diffEntry{} err := s.FS().WalkDir("/", func(path string, d vfs.DirEntry, e error) error { if e != nil { @@ -130,37 +183,62 @@ func (s *testSys) baselineFSwithDiff(baseline io.Writer) { if !ok { return nil } - snap[path] = newContents - reportFSEntryDiff(baseline, s.serializedDiff[path], newContents, path) + fileInfo, err := d.Info() + if err != nil { + return nil + } + newEntry := &diffEntry{content: newContents, fileInfo: fileInfo} + snap[path] = newEntry + s.reportFSEntryDiff(baseline, newEntry, path) return nil }) if err != nil && !errors.Is(err, fs.ErrNotExist) { panic("walkdir error during diff: " + err.Error()) } - for path, oldDirContents := range s.serializedDiff { - if s.FS().FileExists(path) { - _, ok := s.FS().ReadFile(path) - if !ok { - // report deleted - reportFSEntryDiff(baseline, oldDirContents, "", path) + if s.serializedDiff != nil { + for path := range s.serializedDiff.snap { + if s.FS().FileExists(path) { + _, ok := s.TestFS().FS().ReadFile(path) + if !ok { + // report deleted + s.reportFSEntryDiff(baseline, nil, path) + } } } } - s.serializedDiff = snap + var defaultLibs *collections.Set[string] + if s.fs.defaultLibs != nil { + defaultLibs = s.fs.defaultLibs.Clone() + } + s.serializedDiff = &snapshot{ + snap: snap, + defaultLibs: defaultLibs, + } fmt.Fprintln(baseline) } -func reportFSEntryDiff(baseline io.Writer, oldDirContent string, newDirContent string, path string) { +func (s *testSys) reportFSEntryDiff(baseline io.Writer, newDirContent *diffEntry, path string) { + var oldDirContent *diffEntry + var defaultLibs *collections.Set[string] + if s.serializedDiff != nil { + oldDirContent = s.serializedDiff.snap[path] + defaultLibs = s.serializedDiff.defaultLibs + } // todo handle more cases of fs changes - if oldDirContent == "" { - fmt.Fprint(baseline, "//// [", path, "] new file\n", newDirContent, "\n") - } else if newDirContent == "" { - fmt.Fprint(baseline, "//// [", path, "] deleted\n") - } else if newDirContent == oldDirContent { - fmt.Fprint(baseline, "//// [", path, "] no change\n") - } else { - fmt.Fprint(baseline, "//// [", path, "] modified. new content:\n", newDirContent, "\n") + if oldDirContent == nil { + if s.fs.defaultLibs == nil || !s.fs.defaultLibs.Has(path) { + fmt.Fprint(baseline, "//// [", path, "] *new* \n", newDirContent.content, "\n") + } + } else if newDirContent == nil { + fmt.Fprint(baseline, "//// [", path, "] *deleted*\n") + } else if newDirContent.content != oldDirContent.content { + fmt.Fprint(baseline, "//// [", path, "] *modified* \n", newDirContent, "\n") + } else if newDirContent.fileInfo.ModTime() != oldDirContent.fileInfo.ModTime() { + fmt.Fprint(baseline, "//// [", path, "] *modified time*\n") + } else if defaultLibs != nil && defaultLibs.Has(path) && s.fs.defaultLibs != nil && !s.fs.defaultLibs.Has(path) { + // Lib file that was read + fmt.Fprint(baseline, "//// [", path, "] *Lib*\n", newDirContent.content, "\n") } } diff --git a/internal/execute/tsc_test.go b/internal/execute/tsc_test.go index 4a4126b418..1c8f0acbc4 100644 --- a/internal/execute/tsc_test.go +++ b/internal/execute/tsc_test.go @@ -8,12 +8,6 @@ import ( func TestTsc(t *testing.T) { t.Parallel() - if !bundled.Embedded { - // Without embedding, we'd need to read all of the lib files out from disk into the MapFS. - // Just skip this for now. - t.Skip("bundled files are not embedded") - } - testCases := []*tscInput{ { subScenario: "show help with ExitStatus.DiagnosticsPresent_OutputsSkipped", @@ -124,12 +118,6 @@ func TestTsc(t *testing.T) { func TestNoEmit(t *testing.T) { t.Parallel() - if !bundled.Embedded { - // Without embedding, we'd need to read all of the lib files out from disk into the MapFS. - // Just skip this for now. - t.Skip("bundled files are not embedded") - } - (&tscInput{ subScenario: "when project has strict true", sys: newTestSys(FileMap{ @@ -147,12 +135,6 @@ func TestNoEmit(t *testing.T) { func TestExtends(t *testing.T) { t.Parallel() - if !bundled.Embedded { - // Without embedding, we'd need to read all of the lib files out from disk into the MapFS. - // Just skip this for now. - t.Skip("bundled files are not embedded") - } - extendsSysFiles := FileMap{ "/home/src/projects/configs/first/tsconfig.json": `{ "extends": "../second/tsconfig.json", diff --git a/internal/execute/tscincremental_test.go b/internal/execute/tscincremental_test.go index cb7896a752..abcff9907a 100644 --- a/internal/execute/tscincremental_test.go +++ b/internal/execute/tscincremental_test.go @@ -2,18 +2,10 @@ package execute_test import ( "testing" - - "github.com/microsoft/typescript-go/internal/bundled" ) func TestIncremental(t *testing.T) { t.Parallel() - if !bundled.Embedded { - // Without embedding, we'd need to read all of the lib files out from disk into the MapFS. - // Just skip this for now. - t.Skip("bundled files are not embedded") - } - testCases := []*tscInput{ { subScenario: "serializing error chain", @@ -60,6 +52,9 @@ func TestIncremental(t *testing.T) { const wrapper = () => Messageable(); type MessageablePerson = InstanceType>; export default MessageablePerson;`, + tscLibPath + "/lib.d.ts": tscDefaultLibContent + ` + type ReturnType any> = T extends (...args: any) => infer R ? R : any; + type InstanceType any> = T extends abstract new (...args: any) => infer R ? R : any;`, }, "/home/src/workspaces/project"), commandLineArgs: []string{"--incremental"}, // edits: [ @@ -94,6 +89,9 @@ func TestIncremental(t *testing.T) { const wrapper = () => Messageable(); type MessageablePerson = InstanceType>; export default MessageablePerson;`, + tscLibPath + "/lib.d.ts": tscDefaultLibContent + ` + type ReturnType any> = T extends (...args: any) => infer R ? R : any; + type InstanceType any> = T extends abstract new (...args: any) => infer R ? R : any;`, }, "/home/src/workspaces/project"), commandLineArgs: []string{"--incremental"}, // edits: [ diff --git a/internal/execute/tscprojectreferences_test.go b/internal/execute/tscprojectreferences_test.go index ff2c54f70f..47ccc47cc7 100644 --- a/internal/execute/tscprojectreferences_test.go +++ b/internal/execute/tscprojectreferences_test.go @@ -2,18 +2,10 @@ package execute_test import ( "testing" - - "github.com/microsoft/typescript-go/internal/bundled" ) func TestProjectReferences(t *testing.T) { t.Parallel() - if !bundled.Embedded { - // Without embedding, we'd need to read all of the lib files out from disk into the MapFS. - // Just skip this for now. - t.Skip("bundled files are not embedded") - } - cases := []tscInput{ // !!! sheetal todo verifyCompilerOptions - check for noEmit { diff --git a/internal/execute/verifytsc_nocheck_test.go b/internal/execute/verifytsc_nocheck_test.go index fab7d15277..d944eca140 100644 --- a/internal/execute/verifytsc_nocheck_test.go +++ b/internal/execute/verifytsc_nocheck_test.go @@ -25,7 +25,7 @@ func TestNoCheck(t *testing.T) { } for _, c := range cases { (&tscInput{ - subScenario: "outFile/" + c.subscenario, + subScenario: c.subscenario, sys: newTestSys(FileMap{ "/home/src/workspaces/project/a.ts": c.aText, "/home/src/workspaces/project/b.ts": `export const b = 10;`, @@ -35,7 +35,6 @@ func TestNoCheck(t *testing.T) { } }`, // incremental: undefined, true - // ...options: {}, {module: amd, outfile: "outfile.js"} }, "/home/src/workspaces/project"), commandLineArgs: []string{"--noCheck", "--outFile", "built"}, }).verify(t, "noCheck") diff --git a/internal/execute/verifytscwatch_test.go b/internal/execute/verifytscwatch_test.go index 43485f7328..b14de36c89 100644 --- a/internal/execute/verifytscwatch_test.go +++ b/internal/execute/verifytscwatch_test.go @@ -47,12 +47,6 @@ func verifyWatch(t *testing.T, test *tscInput, scenario string, edits []*testTsc func TestWatch(t *testing.T) { t.Parallel() - if !bundled.Embedded { - // Without embedding, we'd need to read all of the lib files out from disk into the MapFS. - // Just skip this for now. - t.Skip("bundled files are not embedded") - } - testCases := []*tscInput{ { subScenario: "watch with no tsconfig", diff --git a/internal/tsoptions/enummaps.go b/internal/tsoptions/enummaps.go index 3c16cfad03..977ee9ef33 100644 --- a/internal/tsoptions/enummaps.go +++ b/internal/tsoptions/enummaps.go @@ -206,6 +206,11 @@ var targetToLibMap = map[core.ScriptTarget]string{ core.ScriptTargetES2015: "lib.es6.d.ts", // We don't use lib.es2015.full.d.ts due to breaking change. } +// Used for test to add the files +func TargetToLibMap() map[core.ScriptTarget]string { + return targetToLibMap +} + func GetDefaultLibFileName(options *core.CompilerOptions) string { name, ok := targetToLibMap[options.GetEmitScriptTarget()] if !ok { diff --git a/testdata/baselines/reference/tsc/commandLine/Parse---lib-option-with-file-name.js b/testdata/baselines/reference/tsc/commandLine/Parse---lib-option-with-file-name.js index 7bac418a03..23bf177ca2 100644 --- a/testdata/baselines/reference/tsc/commandLine/Parse---lib-option-with-file-name.js +++ b/testdata/baselines/reference/tsc/commandLine/Parse---lib-option-with-file-name.js @@ -2,7 +2,7 @@ currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true Input::--lib es6 first.ts -//// [/home/src/workspaces/project/first.ts] new file +//// [/home/src/workspaces/project/first.ts] *new* export const Key = Symbol() ExitStatus:: 0 @@ -39,11 +39,33 @@ ParsedCommandLine::{ "compileOnSave": null } Output:: -//// [/home/src/workspaces/project/first.js] new file +//// [/home/src/tslibs/TS/Lib/lib.es2015.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; +//// [/home/src/workspaces/project/first.js] *new* "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Key = void 0; exports.Key = Symbol(); -//// [/home/src/workspaces/project/first.ts] no change diff --git a/testdata/baselines/reference/tsc/commandLine/Parse--p-with-path-to-tsconfig-file.js b/testdata/baselines/reference/tsc/commandLine/Parse--p-with-path-to-tsconfig-file.js index 6b0b1cfb56..1420b1d582 100644 --- a/testdata/baselines/reference/tsc/commandLine/Parse--p-with-path-to-tsconfig-file.js +++ b/testdata/baselines/reference/tsc/commandLine/Parse--p-with-path-to-tsconfig-file.js @@ -2,9 +2,9 @@ currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true Input::-p /home/src/workspaces/project/tsconfig.json -//// [/home/src/workspaces/project/first.ts] new file +//// [/home/src/workspaces/project/first.ts] *new* export const a = 1 -//// [/home/src/workspaces/project/tsconfig.json] new file +//// [/home/src/workspaces/project/tsconfig.json] *new* { "compilerOptions": { "strict": true, "noEmit": true } } ExitStatus:: 0 @@ -35,6 +35,27 @@ ParsedCommandLine::{ "compileOnSave": null } Output:: -//// [/home/src/workspaces/project/first.ts] no change -//// [/home/src/workspaces/project/tsconfig.json] no change +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; diff --git a/testdata/baselines/reference/tsc/commandLine/Parse--p-with-path-to-tsconfig-folder.js b/testdata/baselines/reference/tsc/commandLine/Parse--p-with-path-to-tsconfig-folder.js index 989c52f54b..63f276759b 100644 --- a/testdata/baselines/reference/tsc/commandLine/Parse--p-with-path-to-tsconfig-folder.js +++ b/testdata/baselines/reference/tsc/commandLine/Parse--p-with-path-to-tsconfig-folder.js @@ -2,9 +2,9 @@ currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true Input::-p /home/src/workspaces/project -//// [/home/src/workspaces/project/first.ts] new file +//// [/home/src/workspaces/project/first.ts] *new* export const a = 1 -//// [/home/src/workspaces/project/tsconfig.json] new file +//// [/home/src/workspaces/project/tsconfig.json] *new* { "compilerOptions": { "strict": true, "noEmit": true } } ExitStatus:: 0 @@ -35,6 +35,27 @@ ParsedCommandLine::{ "compileOnSave": null } Output:: -//// [/home/src/workspaces/project/first.ts] no change -//// [/home/src/workspaces/project/tsconfig.json] no change +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; diff --git a/testdata/baselines/reference/tsc/commandLine/Parse--p.js b/testdata/baselines/reference/tsc/commandLine/Parse--p.js index fbb2710c6e..f2aedd5f8b 100644 --- a/testdata/baselines/reference/tsc/commandLine/Parse--p.js +++ b/testdata/baselines/reference/tsc/commandLine/Parse--p.js @@ -2,9 +2,9 @@ currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true Input::-p . -//// [/home/src/workspaces/project/first.ts] new file +//// [/home/src/workspaces/project/first.ts] *new* export const a = 1 -//// [/home/src/workspaces/project/tsconfig.json] new file +//// [/home/src/workspaces/project/tsconfig.json] *new* { "compilerOptions": { "strict": true, "noEmit": true } } ExitStatus:: 0 @@ -35,6 +35,27 @@ ParsedCommandLine::{ "compileOnSave": null } Output:: -//// [/home/src/workspaces/project/first.ts] no change -//// [/home/src/workspaces/project/tsconfig.json] no change +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; diff --git a/testdata/baselines/reference/tsc/commandLine/Parse-enum-type-options.js b/testdata/baselines/reference/tsc/commandLine/Parse-enum-type-options.js index 40579d601f..c0617dbe66 100644 --- a/testdata/baselines/reference/tsc/commandLine/Parse-enum-type-options.js +++ b/testdata/baselines/reference/tsc/commandLine/Parse-enum-type-options.js @@ -43,4 +43,27 @@ ParsedCommandLine::{ "compileOnSave": null } Output:: +//// [/home/src/tslibs/TS/Lib/lib.esnext.full.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; diff --git a/testdata/baselines/reference/tsc/commandLine/Parse-watch-interval-option.js b/testdata/baselines/reference/tsc/commandLine/Parse-watch-interval-option.js index edac2bb8e7..bdc7fcbf78 100644 --- a/testdata/baselines/reference/tsc/commandLine/Parse-watch-interval-option.js +++ b/testdata/baselines/reference/tsc/commandLine/Parse-watch-interval-option.js @@ -2,9 +2,9 @@ currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true Input::-w --watchInterval 1000 -//// [/home/src/workspaces/project/first.ts] new file +//// [/home/src/workspaces/project/first.ts] *new* export const a = 1 -//// [/home/src/workspaces/project/tsconfig.json] new file +//// [/home/src/workspaces/project/tsconfig.json] *new* { "compilerOptions": { "strict": true, "noEmit": true } } ExitStatus:: 0 @@ -37,6 +37,4 @@ ParsedCommandLine::{ } Output:: No output -//// [/home/src/workspaces/project/first.ts] no change -//// [/home/src/workspaces/project/tsconfig.json] no change diff --git a/testdata/baselines/reference/tsc/commandLine/Project-is-empty-string.js b/testdata/baselines/reference/tsc/commandLine/Project-is-empty-string.js index 4124c4aa4c..eb49f60d12 100644 --- a/testdata/baselines/reference/tsc/commandLine/Project-is-empty-string.js +++ b/testdata/baselines/reference/tsc/commandLine/Project-is-empty-string.js @@ -2,9 +2,9 @@ currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true Input:: -//// [/home/src/workspaces/project/first.ts] new file +//// [/home/src/workspaces/project/first.ts] *new* export const a = 1 -//// [/home/src/workspaces/project/tsconfig.json] new file +//// [/home/src/workspaces/project/tsconfig.json] *new* { "compilerOptions": { "strict": true, "noEmit": true } } ExitStatus:: 0 @@ -31,6 +31,27 @@ ParsedCommandLine::{ "compileOnSave": null } Output:: -//// [/home/src/workspaces/project/first.ts] no change -//// [/home/src/workspaces/project/tsconfig.json] no change +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; diff --git a/testdata/baselines/reference/tsc/extends/configDir-template-showConfig.js b/testdata/baselines/reference/tsc/extends/configDir-template-showConfig.js index eb990ee303..b503cb2514 100644 --- a/testdata/baselines/reference/tsc/extends/configDir-template-showConfig.js +++ b/testdata/baselines/reference/tsc/extends/configDir-template-showConfig.js @@ -2,7 +2,7 @@ currentDirectory::/home/src/projects/myproject useCaseSensitiveFileNames::true Input::--showConfig -//// [/home/src/projects/configs/first/tsconfig.json] new file +//// [/home/src/projects/configs/first/tsconfig.json] *new* { "extends": "../second/tsconfig.json", "include": ["${configDir}/src"], @@ -11,7 +11,7 @@ Input::--showConfig "types": [], }, } -//// [/home/src/projects/configs/second/tsconfig.json] new file +//// [/home/src/projects/configs/second/tsconfig.json] *new* { "files": ["${configDir}/main.ts"], "compilerOptions": { @@ -26,23 +26,23 @@ Input::--showConfig "excludeFiles": ["${configDir}/main.ts"], }, } -//// [/home/src/projects/myproject/main.ts] new file +//// [/home/src/projects/myproject/main.ts] *new* // some comment export const y = 10; import { x } from "@myscope/sometype"; -//// [/home/src/projects/myproject/root2/other/sometype2/index.d.ts] new file +//// [/home/src/projects/myproject/root2/other/sometype2/index.d.ts] *new* export const k = 10; -//// [/home/src/projects/myproject/src/secondary.ts] new file +//// [/home/src/projects/myproject/src/secondary.ts] *new* // some comment export const z = 10; import { k } from "other/sometype2"; -//// [/home/src/projects/myproject/tsconfig.json] new file +//// [/home/src/projects/myproject/tsconfig.json] *new* { "extends": "../configs/first/tsconfig.json", "compilerOptions": { @@ -51,7 +51,7 @@ Input::--showConfig "traceResolution": true, }, } -//// [/home/src/projects/myproject/types/sometype.ts] new file +//// [/home/src/projects/myproject/types/sometype.ts] *new* export const x = 10; @@ -63,11 +63,4 @@ CompilerOptions::{ } Output:: No output -//// [/home/src/projects/configs/first/tsconfig.json] no change -//// [/home/src/projects/configs/second/tsconfig.json] no change -//// [/home/src/projects/myproject/main.ts] no change -//// [/home/src/projects/myproject/root2/other/sometype2/index.d.ts] no change -//// [/home/src/projects/myproject/src/secondary.ts] no change -//// [/home/src/projects/myproject/tsconfig.json] no change -//// [/home/src/projects/myproject/types/sometype.ts] no change diff --git a/testdata/baselines/reference/tsc/extends/configDir-template-with-commandline.js b/testdata/baselines/reference/tsc/extends/configDir-template-with-commandline.js index 9b9bc68483..aabd3b9d6c 100644 --- a/testdata/baselines/reference/tsc/extends/configDir-template-with-commandline.js +++ b/testdata/baselines/reference/tsc/extends/configDir-template-with-commandline.js @@ -2,7 +2,7 @@ currentDirectory::/home/src/projects/myproject useCaseSensitiveFileNames::true Input::--explainFiles --outDir ${configDir}/outDir -//// [/home/src/projects/configs/first/tsconfig.json] new file +//// [/home/src/projects/configs/first/tsconfig.json] *new* { "extends": "../second/tsconfig.json", "include": ["${configDir}/src"], @@ -11,7 +11,7 @@ Input::--explainFiles --outDir ${configDir}/outDir "types": [], }, } -//// [/home/src/projects/configs/second/tsconfig.json] new file +//// [/home/src/projects/configs/second/tsconfig.json] *new* { "files": ["${configDir}/main.ts"], "compilerOptions": { @@ -26,23 +26,23 @@ Input::--explainFiles --outDir ${configDir}/outDir "excludeFiles": ["${configDir}/main.ts"], }, } -//// [/home/src/projects/myproject/main.ts] new file +//// [/home/src/projects/myproject/main.ts] *new* // some comment export const y = 10; import { x } from "@myscope/sometype"; -//// [/home/src/projects/myproject/root2/other/sometype2/index.d.ts] new file +//// [/home/src/projects/myproject/root2/other/sometype2/index.d.ts] *new* export const k = 10; -//// [/home/src/projects/myproject/src/secondary.ts] new file +//// [/home/src/projects/myproject/src/secondary.ts] *new* // some comment export const z = 10; import { k } from "other/sometype2"; -//// [/home/src/projects/myproject/tsconfig.json] new file +//// [/home/src/projects/myproject/tsconfig.json] *new* { "extends": "../configs/first/tsconfig.json", "compilerOptions": { @@ -51,7 +51,7 @@ Input::--explainFiles --outDir ${configDir}/outDir "traceResolution": true, }, } -//// [/home/src/projects/myproject/types/sometype.ts] new file +//// [/home/src/projects/myproject/types/sometype.ts] *new* export const x = 10; @@ -71,42 +71,58 @@ Output:: Found 1 error in src/secondary.ts:4 -//// [/home/src/projects/configs/first/tsconfig.json] no change -//// [/home/src/projects/configs/second/tsconfig.json] no change -//// [/home/src/projects/myproject/${configDir}/outDir/main.js] new file +//// [/home/src/projects/myproject/${configDir}/outDir/main.js] *new* "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.y = void 0; // some comment exports.y = 10; -//// [/home/src/projects/myproject/${configDir}/outDir/src/secondary.js] new file +//// [/home/src/projects/myproject/${configDir}/outDir/src/secondary.js] *new* "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.z = void 0; // some comment exports.z = 10; -//// [/home/src/projects/myproject/${configDir}/outDir/types/sometype.js] new file +//// [/home/src/projects/myproject/${configDir}/outDir/types/sometype.js] *new* "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.x = void 0; exports.x = 10; -//// [/home/src/projects/myproject/decls/main.d.ts] new file +//// [/home/src/projects/myproject/decls/main.d.ts] *new* // some comment export declare const y = 10; -//// [/home/src/projects/myproject/decls/src/secondary.d.ts] new file +//// [/home/src/projects/myproject/decls/src/secondary.d.ts] *new* // some comment export declare const z = 10; -//// [/home/src/projects/myproject/decls/types/sometype.d.ts] new file +//// [/home/src/projects/myproject/decls/types/sometype.d.ts] *new* export declare const x = 10; -//// [/home/src/projects/myproject/main.ts] no change -//// [/home/src/projects/myproject/root2/other/sometype2/index.d.ts] no change -//// [/home/src/projects/myproject/src/secondary.ts] no change -//// [/home/src/projects/myproject/tsconfig.json] no change -//// [/home/src/projects/myproject/types/sometype.ts] no change +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; diff --git a/testdata/baselines/reference/tsc/extends/configDir-template.js b/testdata/baselines/reference/tsc/extends/configDir-template.js index b9bf5ed030..006c9c61b2 100644 --- a/testdata/baselines/reference/tsc/extends/configDir-template.js +++ b/testdata/baselines/reference/tsc/extends/configDir-template.js @@ -2,7 +2,7 @@ currentDirectory::/home/src/projects/myproject useCaseSensitiveFileNames::true Input::--explainFiles -//// [/home/src/projects/configs/first/tsconfig.json] new file +//// [/home/src/projects/configs/first/tsconfig.json] *new* { "extends": "../second/tsconfig.json", "include": ["${configDir}/src"], @@ -11,7 +11,7 @@ Input::--explainFiles "types": [], }, } -//// [/home/src/projects/configs/second/tsconfig.json] new file +//// [/home/src/projects/configs/second/tsconfig.json] *new* { "files": ["${configDir}/main.ts"], "compilerOptions": { @@ -26,23 +26,23 @@ Input::--explainFiles "excludeFiles": ["${configDir}/main.ts"], }, } -//// [/home/src/projects/myproject/main.ts] new file +//// [/home/src/projects/myproject/main.ts] *new* // some comment export const y = 10; import { x } from "@myscope/sometype"; -//// [/home/src/projects/myproject/root2/other/sometype2/index.d.ts] new file +//// [/home/src/projects/myproject/root2/other/sometype2/index.d.ts] *new* export const k = 10; -//// [/home/src/projects/myproject/src/secondary.ts] new file +//// [/home/src/projects/myproject/src/secondary.ts] *new* // some comment export const z = 10; import { k } from "other/sometype2"; -//// [/home/src/projects/myproject/tsconfig.json] new file +//// [/home/src/projects/myproject/tsconfig.json] *new* { "extends": "../configs/first/tsconfig.json", "compilerOptions": { @@ -51,7 +51,7 @@ Input::--explainFiles "traceResolution": true, }, } -//// [/home/src/projects/myproject/types/sometype.ts] new file +//// [/home/src/projects/myproject/types/sometype.ts] *new* export const x = 10; @@ -70,42 +70,58 @@ Output:: Found 1 error in src/secondary.ts:4 -//// [/home/src/projects/configs/first/tsconfig.json] no change -//// [/home/src/projects/configs/second/tsconfig.json] no change -//// [/home/src/projects/myproject/decls/main.d.ts] new file +//// [/home/src/projects/myproject/decls/main.d.ts] *new* // some comment export declare const y = 10; -//// [/home/src/projects/myproject/decls/src/secondary.d.ts] new file +//// [/home/src/projects/myproject/decls/src/secondary.d.ts] *new* // some comment export declare const z = 10; -//// [/home/src/projects/myproject/decls/types/sometype.d.ts] new file +//// [/home/src/projects/myproject/decls/types/sometype.d.ts] *new* export declare const x = 10; -//// [/home/src/projects/myproject/main.ts] no change -//// [/home/src/projects/myproject/outDir/main.js] new file +//// [/home/src/projects/myproject/outDir/main.js] *new* "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.y = void 0; // some comment exports.y = 10; -//// [/home/src/projects/myproject/outDir/src/secondary.js] new file +//// [/home/src/projects/myproject/outDir/src/secondary.js] *new* "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.z = void 0; // some comment exports.z = 10; -//// [/home/src/projects/myproject/outDir/types/sometype.js] new file +//// [/home/src/projects/myproject/outDir/types/sometype.js] *new* "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.x = void 0; exports.x = 10; -//// [/home/src/projects/myproject/root2/other/sometype2/index.d.ts] no change -//// [/home/src/projects/myproject/src/secondary.ts] no change -//// [/home/src/projects/myproject/tsconfig.json] no change -//// [/home/src/projects/myproject/types/sometype.ts] no change +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; diff --git a/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js index a461e3b083..2fb4e35c61 100644 --- a/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js +++ b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js @@ -2,7 +2,32 @@ currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true Input::--incremental -//// [/home/src/workspaces/project/MessageablePerson.ts] new file +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *new* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; + type ReturnType any> = T extends (...args: any) => infer R ? R : any; + type InstanceType any> = T extends abstract new (...args: any) => infer R ? R : any; +//// [/home/src/workspaces/project/MessageablePerson.ts] *new* const Messageable = () => { return class MessageableClass { @@ -12,13 +37,13 @@ Input::--incremental const wrapper = () => Messageable(); type MessageablePerson = InstanceType>; export default MessageablePerson; -//// [/home/src/workspaces/project/main.ts] new file +//// [/home/src/workspaces/project/main.ts] *new* import MessageablePerson from './MessageablePerson.js'; function logMessage( person: MessageablePerson ) { console.log( person.message ); } -//// [/home/src/workspaces/project/tsconfig.json] new file +//// [/home/src/workspaces/project/tsconfig.json] *new* { "compilerOptions": { "module": "esnext", "declaration": true } } ExitStatus:: 0 @@ -27,7 +52,7 @@ CompilerOptions::{ "incremental": true } Output:: -//// [/home/src/workspaces/project/MessageablePerson.d.ts] new file +//// [/home/src/workspaces/project/MessageablePerson.d.ts] *new* declare const wrapper: () => { new (): { message: string; @@ -36,7 +61,7 @@ declare const wrapper: () => { type MessageablePerson = InstanceType>; export default MessageablePerson; -//// [/home/src/workspaces/project/MessageablePerson.js] new file +//// [/home/src/workspaces/project/MessageablePerson.js] *new* const Messageable = () => { return class MessageableClass { message = 'hello'; @@ -45,109 +70,34 @@ const Messageable = () => { const wrapper = () => Messageable(); export {}; -//// [/home/src/workspaces/project/MessageablePerson.ts] no change -//// [/home/src/workspaces/project/main.d.ts] new file +//// [/home/src/workspaces/project/main.d.ts] *new* export {}; -//// [/home/src/workspaces/project/main.js] new file +//// [/home/src/workspaces/project/main.js] *new* function logMessage(person) { console.log(person.message); } export {}; -//// [/home/src/workspaces/project/main.ts] no change -//// [/home/src/workspaces/project/tsconfig.json] no change -//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] new file -{"version":"FakeTSVersion","fileNames":["bundled:///libs/lib.d.ts","bundled:///libs/lib.es5.d.ts","bundled:///libs/lib.dom.d.ts","bundled:///libs/lib.webworker.importscripts.d.ts","bundled:///libs/lib.scripthost.d.ts","bundled:///libs/lib.decorators.d.ts","bundled:///libs/lib.decorators.legacy.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":["a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa",{"version":"69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a","signature":"6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe","impliedNodeFormat":1},{"version":"36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[8]],"options":{"declaration":true,"module":99},"referencedMap":[[9,1]]} -//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] new file +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *new* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":[{"version":"575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a","signature":"6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe","impliedNodeFormat":1},{"version":"36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"declaration":true,"module":99},"referencedMap":[[3,1]]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", "fileNames": [ - "bundled:///libs/lib.d.ts", - "bundled:///libs/lib.es5.d.ts", - "bundled:///libs/lib.dom.d.ts", - "bundled:///libs/lib.webworker.importscripts.d.ts", - "bundled:///libs/lib.scripthost.d.ts", - "bundled:///libs/lib.decorators.d.ts", - "bundled:///libs/lib.decorators.legacy.d.ts", + "../../tslibs/TS/Lib/lib.d.ts", "./MessageablePerson.ts", "./main.ts" ], "fileInfos": [ { - "fileName": "bundled:///libs/lib.d.ts", - "version": "a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa", - "signature": "a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa", - "impliedNodeFormat": "CommonJS" - }, - { - "fileName": "bundled:///libs/lib.es5.d.ts", - "version": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", - "signature": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.dom.d.ts", - "version": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", - "signature": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.webworker.importscripts.d.ts", - "version": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", - "signature": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.scripthost.d.ts", - "version": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", - "signature": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.decorators.d.ts", - "version": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", - "signature": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.decorators.legacy.d.ts", - "version": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", - "signature": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "signature": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", "affectsGlobalScope": true, "impliedNodeFormat": "CommonJS", "original": { - "version": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", + "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", "affectsGlobalScope": true, "impliedNodeFormat": 1 } @@ -189,6 +139,6 @@ export {}; "./MessageablePerson.ts" ] }, - "size": 1629 + "size": 697 } diff --git a/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js index 7270384bdf..a968da6745 100644 --- a/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js +++ b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js @@ -2,7 +2,32 @@ currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true Input::--incremental -//// [/home/src/workspaces/project/MessageablePerson.ts] new file +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *new* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; + type ReturnType any> = T extends (...args: any) => infer R ? R : any; + type InstanceType any> = T extends abstract new (...args: any) => infer R ? R : any; +//// [/home/src/workspaces/project/MessageablePerson.ts] *new* const Messageable = () => { return class MessageableClass { @@ -12,13 +37,13 @@ Input::--incremental const wrapper = () => Messageable(); type MessageablePerson = InstanceType>; export default MessageablePerson; -//// [/home/src/workspaces/project/main.ts] new file +//// [/home/src/workspaces/project/main.ts] *new* import MessageablePerson from './MessageablePerson.js'; function logMessage( person: MessageablePerson ) { console.log( person.message ); } -//// [/home/src/workspaces/project/tsconfig.json] new file +//// [/home/src/workspaces/project/tsconfig.json] *new* { "compilerOptions": { "module": "esnext" } } ExitStatus:: 0 @@ -27,7 +52,7 @@ CompilerOptions::{ "incremental": true } Output:: -//// [/home/src/workspaces/project/MessageablePerson.js] new file +//// [/home/src/workspaces/project/MessageablePerson.js] *new* const Messageable = () => { return class MessageableClass { message = 'hello'; @@ -36,106 +61,31 @@ const Messageable = () => { const wrapper = () => Messageable(); export {}; -//// [/home/src/workspaces/project/MessageablePerson.ts] no change -//// [/home/src/workspaces/project/main.js] new file +//// [/home/src/workspaces/project/main.js] *new* function logMessage(person) { console.log(person.message); } export {}; -//// [/home/src/workspaces/project/main.ts] no change -//// [/home/src/workspaces/project/tsconfig.json] no change -//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] new file -{"version":"FakeTSVersion","fileNames":["bundled:///libs/lib.d.ts","bundled:///libs/lib.es5.d.ts","bundled:///libs/lib.dom.d.ts","bundled:///libs/lib.webworker.importscripts.d.ts","bundled:///libs/lib.scripthost.d.ts","bundled:///libs/lib.decorators.d.ts","bundled:///libs/lib.decorators.legacy.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":["a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa",{"version":"69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedNodeFormat":1},"ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a","36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c"],"fileIdsList":[[8]],"options":{"module":99},"referencedMap":[[9,1]]} -//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] new file +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *new* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":[{"version":"575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2","affectsGlobalScope":true,"impliedNodeFormat":1},"ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a","36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c"],"fileIdsList":[[2]],"options":{"module":99},"referencedMap":[[3,1]]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", "fileNames": [ - "bundled:///libs/lib.d.ts", - "bundled:///libs/lib.es5.d.ts", - "bundled:///libs/lib.dom.d.ts", - "bundled:///libs/lib.webworker.importscripts.d.ts", - "bundled:///libs/lib.scripthost.d.ts", - "bundled:///libs/lib.decorators.d.ts", - "bundled:///libs/lib.decorators.legacy.d.ts", + "../../tslibs/TS/Lib/lib.d.ts", "./MessageablePerson.ts", "./main.ts" ], "fileInfos": [ { - "fileName": "bundled:///libs/lib.d.ts", - "version": "a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa", - "signature": "a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa", - "impliedNodeFormat": "CommonJS" - }, - { - "fileName": "bundled:///libs/lib.es5.d.ts", - "version": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", - "signature": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.dom.d.ts", - "version": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", - "signature": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.webworker.importscripts.d.ts", - "version": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", - "signature": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.scripthost.d.ts", - "version": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", - "signature": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.decorators.d.ts", - "version": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", - "signature": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.decorators.legacy.d.ts", - "version": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", - "signature": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "signature": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", "affectsGlobalScope": true, "impliedNodeFormat": "CommonJS", "original": { - "version": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", + "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", "affectsGlobalScope": true, "impliedNodeFormat": 1 } @@ -166,6 +116,6 @@ export {}; "./MessageablePerson.ts" ] }, - "size": 1384 + "size": 452 } diff --git a/testdata/baselines/reference/tsc/incremental/serializing-error-chain.js b/testdata/baselines/reference/tsc/incremental/serializing-error-chain.js index bdb3f3945e..accdb27bb2 100644 --- a/testdata/baselines/reference/tsc/incremental/serializing-error-chain.js +++ b/testdata/baselines/reference/tsc/incremental/serializing-error-chain.js @@ -2,7 +2,7 @@ currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true Input:: -//// [/home/src/workspaces/project/index.tsx] new file +//// [/home/src/workspaces/project/index.tsx] *new* declare namespace JSX { interface ElementChildrenAttribute { children: {}; } @@ -17,7 +17,7 @@ Input::
) -//// [/home/src/workspaces/project/tsconfig.json] new file +//// [/home/src/workspaces/project/tsconfig.json] *new* { "compilerOptions": { "incremental": true, @@ -31,14 +31,11 @@ ExitStatus:: 2 CompilerOptions::{} Output:: -index.tsx:11:23 - error TS2746: This JSX tag's 'children' prop expects a single child of type 'number | undefined', but multiple children were provided. - -11 ( -   ~~~~~~~~~ - index.tsx:11:23 - error TS2769: No overload matches this call. The last overload gave the following error. - This JSX tag's 'children' prop expects a single child of type 'number | undefined', but multiple children were provided. + Type '{ children: any[]; }' is not assignable to type '{ children?: number | undefined; }'. + Types of property 'children' are incompatible. + Type 'any[]' is not assignable to type 'number'. 11 (    ~~~~~~~~~ @@ -48,103 +45,52 @@ Output::    ~~~~~~~~~ -Found 2 errors in the same file, starting at: index.tsx:11 +Found 1 error in index.tsx:11 -//// [/home/src/workspaces/project/index.js] new file +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; +//// [/home/src/workspaces/project/index.js] *new* (React.createElement(Component, null, React.createElement("div", null), React.createElement("div", null))); -//// [/home/src/workspaces/project/index.tsx] no change -//// [/home/src/workspaces/project/tsconfig.json] no change -//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] new file -{"version":"FakeTSVersion","fileNames":["bundled:///libs/lib.d.ts","bundled:///libs/lib.es5.d.ts","bundled:///libs/lib.dom.d.ts","bundled:///libs/lib.webworker.importscripts.d.ts","bundled:///libs/lib.scripthost.d.ts","bundled:///libs/lib.decorators.d.ts","bundled:///libs/lib.decorators.legacy.d.ts","./index.tsx"],"fileInfos":["a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa",{"version":"69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"c7980af975245f04431574a9c187c9abd1c0ba29d83a127ad2af4b952296f935","affectsGlobalScope":true,"impliedNodeFormat":1}],"options":{"jsx":3,"module":99,"strict":true},"semanticDiagnosticsPerFile":[[8,[{"pos":426,"end":435,"code":2746,"category":1,"message":"This JSX tag's 'children' prop expects a single child of type 'number | undefined', but multiple children were provided."},{"pos":426,"end":435,"code":2769,"category":1,"message":"No overload matches this call.","messageChain":[{"pos":426,"end":435,"code":2770,"category":1,"message":"The last overload gave the following error.","messageChain":[{"pos":426,"end":435,"code":2746,"category":1,"message":"This JSX tag's 'children' prop expects a single child of type 'number | undefined', but multiple children were provided."}]}],"relatedInformation":[{"pos":358,"end":367,"code":2771,"category":1,"message":"The last overload is declared here."}]}]]]} -//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] new file +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *new* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./index.tsx"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"c7980af975245f04431574a9c187c9abd1c0ba29d83a127ad2af4b952296f935","affectsGlobalScope":true,"impliedNodeFormat":1}],"options":{"jsx":3,"module":99,"strict":true},"semanticDiagnosticsPerFile":[[2,[{"pos":426,"end":435,"code":2769,"category":1,"message":"No overload matches this call.","messageChain":[{"pos":426,"end":435,"code":2770,"category":1,"message":"The last overload gave the following error.","messageChain":[{"pos":426,"end":435,"code":2322,"category":1,"message":"Type '{ children: any[]; }' is not assignable to type '{ children?: number | undefined; }'.","messageChain":[{"pos":426,"end":435,"code":2326,"category":1,"message":"Types of property 'children' are incompatible.","messageChain":[{"pos":426,"end":435,"code":2322,"category":1,"message":"Type 'any[]' is not assignable to type 'number'."}]}]}]}],"relatedInformation":[{"pos":358,"end":367,"code":2771,"category":1,"message":"The last overload is declared here."}]}]]]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", "fileNames": [ - "bundled:///libs/lib.d.ts", - "bundled:///libs/lib.es5.d.ts", - "bundled:///libs/lib.dom.d.ts", - "bundled:///libs/lib.webworker.importscripts.d.ts", - "bundled:///libs/lib.scripthost.d.ts", - "bundled:///libs/lib.decorators.d.ts", - "bundled:///libs/lib.decorators.legacy.d.ts", + "../../tslibs/TS/Lib/lib.d.ts", "./index.tsx" ], "fileInfos": [ { - "fileName": "bundled:///libs/lib.d.ts", - "version": "a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa", - "signature": "a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa", - "impliedNodeFormat": "CommonJS" - }, - { - "fileName": "bundled:///libs/lib.es5.d.ts", - "version": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", - "signature": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", "affectsGlobalScope": true, "impliedNodeFormat": "CommonJS", "original": { - "version": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.dom.d.ts", - "version": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", - "signature": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.webworker.importscripts.d.ts", - "version": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", - "signature": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.scripthost.d.ts", - "version": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", - "signature": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.decorators.d.ts", - "version": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", - "signature": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.decorators.legacy.d.ts", - "version": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", - "signature": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", "affectsGlobalScope": true, "impliedNodeFormat": 1 } @@ -171,13 +117,6 @@ Found 2 errors in the same file, starting at: index.tsx:11 [ "./index.tsx", [ - { - "pos": 426, - "end": 435, - "code": 2746, - "category": 1, - "message": "This JSX tag's 'children' prop expects a single child of type 'number | undefined', but multiple children were provided." - }, { "pos": 426, "end": 435, @@ -195,9 +134,27 @@ Found 2 errors in the same file, starting at: index.tsx:11 { "pos": 426, "end": 435, - "code": 2746, + "code": 2322, "category": 1, - "message": "This JSX tag's 'children' prop expects a single child of type 'number | undefined', but multiple children were provided." + "message": "Type '{ children: any[]; }' is not assignable to type '{ children?: number | undefined; }'.", + "messageChain": [ + { + "pos": 426, + "end": 435, + "code": 2326, + "category": 1, + "message": "Types of property 'children' are incompatible.", + "messageChain": [ + { + "pos": 426, + "end": 435, + "code": 2322, + "category": 1, + "message": "Type 'any[]' is not assignable to type 'number'." + } + ] + } + ] } ] } @@ -215,6 +172,6 @@ Found 2 errors in the same file, starting at: index.tsx:11 ] ] ], - "size": 2074 + "size": 1181 } diff --git a/testdata/baselines/reference/tsc/noCheck/outFile/dts-errors.js b/testdata/baselines/reference/tsc/noCheck/dts-errors.js similarity index 52% rename from testdata/baselines/reference/tsc/noCheck/outFile/dts-errors.js rename to testdata/baselines/reference/tsc/noCheck/dts-errors.js index 145824660a..885a33e842 100644 --- a/testdata/baselines/reference/tsc/noCheck/outFile/dts-errors.js +++ b/testdata/baselines/reference/tsc/noCheck/dts-errors.js @@ -2,11 +2,11 @@ currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true Input::--noCheck --outFile built -//// [/home/src/workspaces/project/a.ts] new file +//// [/home/src/workspaces/project/a.ts] *new* export const a = class { private p = 10; }; -//// [/home/src/workspaces/project/b.ts] new file +//// [/home/src/workspaces/project/b.ts] *new* export const b = 10; -//// [/home/src/workspaces/project/tsconfig.json] new file +//// [/home/src/workspaces/project/tsconfig.json] *new* { "compilerOptions": { "declaration": true, @@ -32,14 +32,37 @@ Output:: Found 1 error in a.ts:1 -//// [/home/src/workspaces/project/a.d.ts] new file +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; +//// [/home/src/workspaces/project/a.d.ts] *new* export declare const a: { new (): { p: number; }; }; -//// [/home/src/workspaces/project/a.js] new file +//// [/home/src/workspaces/project/a.js] *new* "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.a = void 0; @@ -48,16 +71,13 @@ const a = class { }; exports.a = a; -//// [/home/src/workspaces/project/a.ts] no change -//// [/home/src/workspaces/project/b.d.ts] new file +//// [/home/src/workspaces/project/b.d.ts] *new* export declare const b = 10; -//// [/home/src/workspaces/project/b.js] new file +//// [/home/src/workspaces/project/b.js] *new* "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.b = void 0; exports.b = 10; -//// [/home/src/workspaces/project/b.ts] no change -//// [/home/src/workspaces/project/tsconfig.json] no change diff --git a/testdata/baselines/reference/tsc/noCheck/outFile/semantic-errors.js b/testdata/baselines/reference/tsc/noCheck/outFile/semantic-errors.js deleted file mode 100644 index 02a350977c..0000000000 --- a/testdata/baselines/reference/tsc/noCheck/outFile/semantic-errors.js +++ /dev/null @@ -1,44 +0,0 @@ - -currentDirectory::/home/src/workspaces/project -useCaseSensitiveFileNames::true -Input::--noCheck --outFile built -//// [/home/src/workspaces/project/a.ts] new file -export const a: number = "hello"; -//// [/home/src/workspaces/project/b.ts] new file -export const b = 10; -//// [/home/src/workspaces/project/tsconfig.json] new file -{ - "compilerOptions": { - "declaration": true, - } -} - -ExitStatus:: 0 - -CompilerOptions::{ - "noCheck": true, - "outFile": "/home/src/workspaces/project/built" -} -Output:: -//// [/home/src/workspaces/project/a.d.ts] new file -export declare const a: number; - -//// [/home/src/workspaces/project/a.js] new file -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.a = void 0; -exports.a = "hello"; - -//// [/home/src/workspaces/project/a.ts] no change -//// [/home/src/workspaces/project/b.d.ts] new file -export declare const b = 10; - -//// [/home/src/workspaces/project/b.js] new file -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.b = void 0; -exports.b = 10; - -//// [/home/src/workspaces/project/b.ts] no change -//// [/home/src/workspaces/project/tsconfig.json] no change - diff --git a/testdata/baselines/reference/tsc/noCheck/outFile/syntax-errors.js b/testdata/baselines/reference/tsc/noCheck/outFile/syntax-errors.js deleted file mode 100644 index 55c3efc93d..0000000000 --- a/testdata/baselines/reference/tsc/noCheck/outFile/syntax-errors.js +++ /dev/null @@ -1,52 +0,0 @@ - -currentDirectory::/home/src/workspaces/project -useCaseSensitiveFileNames::true -Input::--noCheck --outFile built -//// [/home/src/workspaces/project/a.ts] new file -export const a = "hello -//// [/home/src/workspaces/project/b.ts] new file -export const b = 10; -//// [/home/src/workspaces/project/tsconfig.json] new file -{ - "compilerOptions": { - "declaration": true, - } -} - -ExitStatus:: 2 - -CompilerOptions::{ - "noCheck": true, - "outFile": "/home/src/workspaces/project/built" -} -Output:: -a.ts:1:24 - error TS1002: Unterminated string literal. - -1 export const a = "hello -   ~ - - -Found 1 error in a.ts:1 - -//// [/home/src/workspaces/project/a.d.ts] new file -export declare const a = "hello"; - -//// [/home/src/workspaces/project/a.js] new file -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.a = void 0; -exports.a = "hello; - -//// [/home/src/workspaces/project/a.ts] no change -//// [/home/src/workspaces/project/b.d.ts] new file -export declare const b = 10; - -//// [/home/src/workspaces/project/b.js] new file -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.b = void 0; -exports.b = 10; - -//// [/home/src/workspaces/project/b.ts] no change -//// [/home/src/workspaces/project/tsconfig.json] no change - diff --git a/testdata/baselines/reference/tsc/noCheck/semantic-errors.js b/testdata/baselines/reference/tsc/noCheck/semantic-errors.js new file mode 100644 index 0000000000..7e288fff7f --- /dev/null +++ b/testdata/baselines/reference/tsc/noCheck/semantic-errors.js @@ -0,0 +1,64 @@ + +currentDirectory::/home/src/workspaces/project +useCaseSensitiveFileNames::true +Input::--noCheck --outFile built +//// [/home/src/workspaces/project/a.ts] *new* +export const a: number = "hello"; +//// [/home/src/workspaces/project/b.ts] *new* +export const b = 10; +//// [/home/src/workspaces/project/tsconfig.json] *new* +{ + "compilerOptions": { + "declaration": true, + } +} + +ExitStatus:: 0 + +CompilerOptions::{ + "noCheck": true, + "outFile": "/home/src/workspaces/project/built" +} +Output:: +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; +//// [/home/src/workspaces/project/a.d.ts] *new* +export declare const a: number; + +//// [/home/src/workspaces/project/a.js] *new* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +exports.a = "hello"; + +//// [/home/src/workspaces/project/b.d.ts] *new* +export declare const b = 10; + +//// [/home/src/workspaces/project/b.js] *new* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +exports.b = 10; + + diff --git a/testdata/baselines/reference/tsc/noCheck/syntax-errors.js b/testdata/baselines/reference/tsc/noCheck/syntax-errors.js new file mode 100644 index 0000000000..4247650dd3 --- /dev/null +++ b/testdata/baselines/reference/tsc/noCheck/syntax-errors.js @@ -0,0 +1,72 @@ + +currentDirectory::/home/src/workspaces/project +useCaseSensitiveFileNames::true +Input::--noCheck --outFile built +//// [/home/src/workspaces/project/a.ts] *new* +export const a = "hello +//// [/home/src/workspaces/project/b.ts] *new* +export const b = 10; +//// [/home/src/workspaces/project/tsconfig.json] *new* +{ + "compilerOptions": { + "declaration": true, + } +} + +ExitStatus:: 2 + +CompilerOptions::{ + "noCheck": true, + "outFile": "/home/src/workspaces/project/built" +} +Output:: +a.ts:1:24 - error TS1002: Unterminated string literal. + +1 export const a = "hello +   ~ + + +Found 1 error in a.ts:1 + +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; +//// [/home/src/workspaces/project/a.d.ts] *new* +export declare const a = "hello"; + +//// [/home/src/workspaces/project/a.js] *new* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +exports.a = "hello; + +//// [/home/src/workspaces/project/b.d.ts] *new* +export declare const b = 10; + +//// [/home/src/workspaces/project/b.js] *new* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +exports.b = 10; + + diff --git a/testdata/baselines/reference/tsc/noEmit/when-project-has-strict-true.js b/testdata/baselines/reference/tsc/noEmit/when-project-has-strict-true.js index b2e387b83d..6b5f2965c2 100644 --- a/testdata/baselines/reference/tsc/noEmit/when-project-has-strict-true.js +++ b/testdata/baselines/reference/tsc/noEmit/when-project-has-strict-true.js @@ -2,9 +2,9 @@ currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true Input::--noEmit -//// [/home/src/workspaces/project/class1.ts] new file +//// [/home/src/workspaces/project/class1.ts] *new* export class class1 {} -//// [/home/src/workspaces/project/tsconfig.json] new file +//// [/home/src/workspaces/project/tsconfig.json] *new* { "compilerOptions": { "incremental": true, @@ -18,98 +18,47 @@ CompilerOptions::{ "noEmit": true } Output:: -//// [/home/src/workspaces/project/class1.ts] no change -//// [/home/src/workspaces/project/tsconfig.json] no change -//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] new file -{"version":"FakeTSVersion","fileNames":["bundled:///libs/lib.d.ts","bundled:///libs/lib.es5.d.ts","bundled:///libs/lib.dom.d.ts","bundled:///libs/lib.webworker.importscripts.d.ts","bundled:///libs/lib.scripthost.d.ts","bundled:///libs/lib.decorators.d.ts","bundled:///libs/lib.decorators.legacy.d.ts","./class1.ts"],"fileInfos":["a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa",{"version":"69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedNodeFormat":1},"a7765a20d4489ae259632d5fe609919af401c278b7a90516894ef2774ce3bc97"],"options":{"strict":true},"affectedFilesPendingEmit":[8]} -//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] new file +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *new* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./class1.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},"a7765a20d4489ae259632d5fe609919af401c278b7a90516894ef2774ce3bc97"],"options":{"strict":true},"affectedFilesPendingEmit":[2]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", "fileNames": [ - "bundled:///libs/lib.d.ts", - "bundled:///libs/lib.es5.d.ts", - "bundled:///libs/lib.dom.d.ts", - "bundled:///libs/lib.webworker.importscripts.d.ts", - "bundled:///libs/lib.scripthost.d.ts", - "bundled:///libs/lib.decorators.d.ts", - "bundled:///libs/lib.decorators.legacy.d.ts", + "../../tslibs/TS/Lib/lib.d.ts", "./class1.ts" ], "fileInfos": [ { - "fileName": "bundled:///libs/lib.d.ts", - "version": "a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa", - "signature": "a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa", - "impliedNodeFormat": "CommonJS" - }, - { - "fileName": "bundled:///libs/lib.es5.d.ts", - "version": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", - "signature": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.dom.d.ts", - "version": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", - "signature": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.webworker.importscripts.d.ts", - "version": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", - "signature": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.scripthost.d.ts", - "version": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", - "signature": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.decorators.d.ts", - "version": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", - "signature": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.decorators.legacy.d.ts", - "version": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", - "signature": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", "affectsGlobalScope": true, "impliedNodeFormat": "CommonJS", "original": { - "version": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", "affectsGlobalScope": true, "impliedNodeFormat": 1 } @@ -128,9 +77,9 @@ Output:: [ "./class1.ts", "Js", - 8 + 2 ] ], - "size": 1283 + "size": 351 } diff --git a/testdata/baselines/reference/tsc/projectReferences/default-import-interop-uses-referenced-project-settings.js b/testdata/baselines/reference/tsc/projectReferences/default-import-interop-uses-referenced-project-settings.js index 48869ca558..5bbf8ebf7d 100644 --- a/testdata/baselines/reference/tsc/projectReferences/default-import-interop-uses-referenced-project-settings.js +++ b/testdata/baselines/reference/tsc/projectReferences/default-import-interop-uses-referenced-project-settings.js @@ -2,16 +2,16 @@ currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true Input::--p app --pretty false -//// [/home/src/workspaces/project/app/src/index.ts] new file +//// [/home/src/workspaces/project/app/src/index.ts] *new* import local from "./local"; // Error import esm from "esm-package"; // Error import referencedSource from "../../lib/src/a"; // Error import referencedDeclaration from "../../lib/dist/a"; // Error import ambiguous from "ambiguous-package"; // Ok -//// [/home/src/workspaces/project/app/src/local.ts] new file +//// [/home/src/workspaces/project/app/src/local.ts] *new* export const local = 0; -//// [/home/src/workspaces/project/app/tsconfig.json] new file +//// [/home/src/workspaces/project/app/tsconfig.json] *new* { "compilerOptions": { "module": "esnext", @@ -24,11 +24,11 @@ export const local = 0; { "path": "../lib" }, ], } -//// [/home/src/workspaces/project/lib/dist/a.d.ts] new file +//// [/home/src/workspaces/project/lib/dist/a.d.ts] *new* export declare const a = 0; -//// [/home/src/workspaces/project/lib/src/a.ts] new file +//// [/home/src/workspaces/project/lib/src/a.ts] *new* export const a = 0; -//// [/home/src/workspaces/project/lib/tsconfig.json] new file +//// [/home/src/workspaces/project/lib/tsconfig.json] *new* { "compilerOptions": { "composite": true, @@ -40,13 +40,13 @@ export const a = 0; }, "include": ["src"], } -//// [/home/src/workspaces/project/node_modules/ambiguous-package/index.d.ts] new file +//// [/home/src/workspaces/project/node_modules/ambiguous-package/index.d.ts] *new* export declare const ambiguous: number; -//// [/home/src/workspaces/project/node_modules/ambiguous-package/package.json] new file +//// [/home/src/workspaces/project/node_modules/ambiguous-package/package.json] *new* { "name": "ambiguous-package" } -//// [/home/src/workspaces/project/node_modules/esm-package/index.d.ts] new file +//// [/home/src/workspaces/project/node_modules/esm-package/index.d.ts] *new* export declare const esm: number; -//// [/home/src/workspaces/project/node_modules/esm-package/package.json] new file +//// [/home/src/workspaces/project/node_modules/esm-package/package.json] *new* { "name": "esm-package", "type": "module" } ExitStatus:: 2 @@ -59,20 +59,33 @@ Output:: app/src/index.ts(2,13): error TS2613: Module '"/home/src/workspaces/project/app/src/local"' has no default export. Did you mean to use 'import { local } from "/home/src/workspaces/project/app/src/local"' instead? app/src/index.ts(3,13): error TS2613: Module '"/home/src/workspaces/project/node_modules/esm-package/index"' has no default export. Did you mean to use 'import { esm } from "/home/src/workspaces/project/node_modules/esm-package/index"' instead? -//// [/home/src/workspaces/project/app/dist/index.js] new file +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; +//// [/home/src/workspaces/project/app/dist/index.js] *new* export {}; -//// [/home/src/workspaces/project/app/dist/local.js] new file +//// [/home/src/workspaces/project/app/dist/local.js] *new* export const local = 0; -//// [/home/src/workspaces/project/app/src/index.ts] no change -//// [/home/src/workspaces/project/app/src/local.ts] no change -//// [/home/src/workspaces/project/app/tsconfig.json] no change -//// [/home/src/workspaces/project/lib/dist/a.d.ts] no change -//// [/home/src/workspaces/project/lib/src/a.ts] no change -//// [/home/src/workspaces/project/lib/tsconfig.json] no change -//// [/home/src/workspaces/project/node_modules/ambiguous-package/index.d.ts] no change -//// [/home/src/workspaces/project/node_modules/ambiguous-package/package.json] no change -//// [/home/src/workspaces/project/node_modules/esm-package/index.d.ts] no change -//// [/home/src/workspaces/project/node_modules/esm-package/package.json] no change diff --git a/testdata/baselines/reference/tsc/projectReferences/importing-const-enum-from-referenced-project-with-preserveConstEnums-and-verbatimModuleSyntax.js b/testdata/baselines/reference/tsc/projectReferences/importing-const-enum-from-referenced-project-with-preserveConstEnums-and-verbatimModuleSyntax.js index 7086c37045..1cffa42a81 100644 --- a/testdata/baselines/reference/tsc/projectReferences/importing-const-enum-from-referenced-project-with-preserveConstEnums-and-verbatimModuleSyntax.js +++ b/testdata/baselines/reference/tsc/projectReferences/importing-const-enum-from-referenced-project-with-preserveConstEnums-and-verbatimModuleSyntax.js @@ -2,11 +2,11 @@ currentDirectory::/home/src/workspaces/solution useCaseSensitiveFileNames::true Input::--p project --pretty false -//// [/home/src/workspaces/solution/no-preserve/index.d.ts] new file +//// [/home/src/workspaces/solution/no-preserve/index.d.ts] *new* export declare const enum F { A = 1 } -//// [/home/src/workspaces/solution/no-preserve/index.ts] new file +//// [/home/src/workspaces/solution/no-preserve/index.ts] *new* export const enum E { A = 1 } -//// [/home/src/workspaces/solution/no-preserve/tsconfig.json] new file +//// [/home/src/workspaces/solution/no-preserve/tsconfig.json] *new* { "compilerOptions": { "composite": true, @@ -14,11 +14,11 @@ export const enum E { A = 1 } "preserveConstEnums": false, }, } -//// [/home/src/workspaces/solution/preserve/index.d.ts] new file +//// [/home/src/workspaces/solution/preserve/index.d.ts] *new* export declare const enum E { A = 1 } -//// [/home/src/workspaces/solution/preserve/index.ts] new file +//// [/home/src/workspaces/solution/preserve/index.ts] *new* export const enum E { A = 1 } -//// [/home/src/workspaces/solution/preserve/tsconfig.json] new file +//// [/home/src/workspaces/solution/preserve/tsconfig.json] *new* { "compilerOptions": { "composite": true, @@ -26,13 +26,13 @@ export const enum E { A = 1 } "preserveConstEnums": true, }, } -//// [/home/src/workspaces/solution/project/index.ts] new file +//// [/home/src/workspaces/solution/project/index.ts] *new* import { E } from "../preserve"; import { F } from "../no-preserve"; E.A; F.A; -//// [/home/src/workspaces/solution/project/tsconfig.json] new file +//// [/home/src/workspaces/solution/project/tsconfig.json] *new* { "compilerOptions": { "module": "preserve", @@ -52,18 +52,33 @@ CompilerOptions::{ } Output:: project/index.ts(3,14): error TS2748: Cannot access ambient const enums when 'verbatimModuleSyntax' is enabled. -//// [/home/src/workspaces/solution/no-preserve/index.d.ts] no change -//// [/home/src/workspaces/solution/no-preserve/index.ts] no change -//// [/home/src/workspaces/solution/no-preserve/tsconfig.json] no change -//// [/home/src/workspaces/solution/preserve/index.d.ts] no change -//// [/home/src/workspaces/solution/preserve/index.ts] no change -//// [/home/src/workspaces/solution/preserve/tsconfig.json] no change -//// [/home/src/workspaces/solution/project/index.js] new file +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; +//// [/home/src/workspaces/solution/project/index.js] *new* import { E } from "../preserve"; import { F } from "../no-preserve"; E.A; F.A; -//// [/home/src/workspaces/solution/project/index.ts] no change -//// [/home/src/workspaces/solution/project/tsconfig.json] no change diff --git a/testdata/baselines/reference/tsc/projectReferences/referencing-ambient-const-enum-from-referenced-project-with-preserveConstEnums.js b/testdata/baselines/reference/tsc/projectReferences/referencing-ambient-const-enum-from-referenced-project-with-preserveConstEnums.js index bd7c02a633..78e616aeb6 100644 --- a/testdata/baselines/reference/tsc/projectReferences/referencing-ambient-const-enum-from-referenced-project-with-preserveConstEnums.js +++ b/testdata/baselines/reference/tsc/projectReferences/referencing-ambient-const-enum-from-referenced-project-with-preserveConstEnums.js @@ -2,9 +2,9 @@ currentDirectory::/home/src/workspaces/solution useCaseSensitiveFileNames::true Input::--p project -//// [/home/src/workspaces/solution/project/index.ts] new file +//// [/home/src/workspaces/solution/project/index.ts] *new* import { E } from "../utils"; E.A; -//// [/home/src/workspaces/solution/project/tsconfig.json] new file +//// [/home/src/workspaces/solution/project/tsconfig.json] *new* { "compilerOptions": { "isolatedModules": true, @@ -13,11 +13,11 @@ import { E } from "../utils"; E.A; { "path": "../utils" }, ], } -//// [/home/src/workspaces/solution/utils/index.d.ts] new file +//// [/home/src/workspaces/solution/utils/index.d.ts] *new* export declare const enum E { A = 1 } -//// [/home/src/workspaces/solution/utils/index.ts] new file +//// [/home/src/workspaces/solution/utils/index.ts] *new* export const enum E { A = 1 } -//// [/home/src/workspaces/solution/utils/tsconfig.json] new file +//// [/home/src/workspaces/solution/utils/tsconfig.json] *new* { "compilerOptions": { "composite": true, @@ -32,15 +32,33 @@ CompilerOptions::{ "project": "/home/src/workspaces/solution/project" } Output:: -//// [/home/src/workspaces/solution/project/index.js] new file +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; +//// [/home/src/workspaces/solution/project/index.js] *new* "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const utils_1 = require("../utils"); utils_1.E.A; -//// [/home/src/workspaces/solution/project/index.ts] no change -//// [/home/src/workspaces/solution/project/tsconfig.json] no change -//// [/home/src/workspaces/solution/utils/index.d.ts] no change -//// [/home/src/workspaces/solution/utils/index.ts] no change -//// [/home/src/workspaces/solution/utils/tsconfig.json] no change diff --git a/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences1.js b/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences1.js index 473498303d..4605b40779 100644 --- a/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences1.js +++ b/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences1.js @@ -2,9 +2,9 @@ currentDirectory::/home/src/workspaces useCaseSensitiveFileNames::true Input::-p packages/main --pretty false -//// [/home/src/workspaces/packages/common/dist/index.d.ts] new file +//// [/home/src/workspaces/packages/common/dist/index.d.ts] *new* export {}; -//// [/home/src/workspaces/packages/common/package.json] new file +//// [/home/src/workspaces/packages/common/package.json] *new* { "name": "common", "version": "1.0.0", @@ -16,9 +16,9 @@ export {}; } } } -//// [/home/src/workspaces/packages/common/src/index.ts] new file +//// [/home/src/workspaces/packages/common/src/index.ts] *new* export {}; -//// [/home/src/workspaces/packages/common/tsconfig.json] new file +//// [/home/src/workspaces/packages/common/tsconfig.json] *new* { "compilerOptions": { "composite": true, @@ -27,11 +27,11 @@ export {}; "module": "nodenext" } } -//// [/home/src/workspaces/packages/main/package.json] new file +//// [/home/src/workspaces/packages/main/package.json] *new* { "type": "module" } -//// [/home/src/workspaces/packages/main/src/index.ts] new file +//// [/home/src/workspaces/packages/main/src/index.ts] *new* import {} from "../../common/src/index.ts"; -//// [/home/src/workspaces/packages/main/tsconfig.json] new file +//// [/home/src/workspaces/packages/main/tsconfig.json] *new* { "compilerOptions": { "module": "nodenext", @@ -52,14 +52,30 @@ CompilerOptions::{ } Output:: packages/main/src/index.ts(1,16): error TS2878: This import path is unsafe to rewrite because it resolves to another project, and the relative path between the projects' output files is not the same as the relative path between its input files. -//// [/home/src/workspaces/packages/common/dist/index.d.ts] no change -//// [/home/src/workspaces/packages/common/package.json] no change -//// [/home/src/workspaces/packages/common/src/index.ts] no change -//// [/home/src/workspaces/packages/common/tsconfig.json] no change -//// [/home/src/workspaces/packages/main/dist/index.js] new file +//// [/home/src/tslibs/TS/Lib/lib.esnext.full.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; +//// [/home/src/workspaces/packages/main/dist/index.js] *new* export {}; -//// [/home/src/workspaces/packages/main/package.json] no change -//// [/home/src/workspaces/packages/main/src/index.ts] no change -//// [/home/src/workspaces/packages/main/tsconfig.json] no change diff --git a/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences2.js b/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences2.js index c4ab641c14..a31cd04006 100644 --- a/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences2.js +++ b/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences2.js @@ -2,18 +2,18 @@ currentDirectory::/home/src/workspaces/solution useCaseSensitiveFileNames::true Input::--p src/services --pretty false -//// [/home/src/workspaces/solution/dist/compiler/parser.d.ts] new file +//// [/home/src/workspaces/solution/dist/compiler/parser.d.ts] *new* export {}; -//// [/home/src/workspaces/solution/src/compiler/parser.ts] new file +//// [/home/src/workspaces/solution/src/compiler/parser.ts] *new* export {}; -//// [/home/src/workspaces/solution/src/compiler/tsconfig.json] new file +//// [/home/src/workspaces/solution/src/compiler/tsconfig.json] *new* { "extends": "../tsconfig-base.json", "compilerOptions": {} } -//// [/home/src/workspaces/solution/src/services/services.ts] new file +//// [/home/src/workspaces/solution/src/services/services.ts] *new* import {} from "../compiler/parser.ts"; -//// [/home/src/workspaces/solution/src/services/tsconfig.json] new file +//// [/home/src/workspaces/solution/src/services/tsconfig.json] *new* { "extends": "../tsconfig-base.json", "compilerOptions": {}, @@ -21,7 +21,7 @@ import {} from "../compiler/parser.ts"; { "path": "../compiler" } ] } -//// [/home/src/workspaces/solution/src/tsconfig-base.json] new file +//// [/home/src/workspaces/solution/src/tsconfig-base.json] *new* { "compilerOptions": { "module": "nodenext", @@ -40,1044 +40,59 @@ CompilerOptions::{ } Output:: No output -//// [/home/src/workspaces/solution/dist/compiler/parser.d.ts] no change -//// [/home/src/workspaces/solution/dist/services/services.d.ts] new file +//// [/home/src/tslibs/TS/Lib/lib.esnext.full.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; +//// [/home/src/workspaces/solution/dist/services/services.d.ts] *new* export {}; -//// [/home/src/workspaces/solution/dist/services/services.js] new file +//// [/home/src/workspaces/solution/dist/services/services.js] *new* "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -//// [/home/src/workspaces/solution/dist/services/tsconfig.tsbuildinfo] new file -{"version":"FakeTSVersion","fileNames":["bundled:///libs/lib.es5.d.ts","bundled:///libs/lib.es2015.d.ts","bundled:///libs/lib.es2016.d.ts","bundled:///libs/lib.es2017.d.ts","bundled:///libs/lib.es2018.d.ts","bundled:///libs/lib.es2019.d.ts","bundled:///libs/lib.es2020.d.ts","bundled:///libs/lib.es2021.d.ts","bundled:///libs/lib.es2022.d.ts","bundled:///libs/lib.es2023.d.ts","bundled:///libs/lib.es2024.d.ts","bundled:///libs/lib.esnext.d.ts","bundled:///libs/lib.dom.d.ts","bundled:///libs/lib.dom.iterable.d.ts","bundled:///libs/lib.dom.asynciterable.d.ts","bundled:///libs/lib.webworker.importscripts.d.ts","bundled:///libs/lib.scripthost.d.ts","bundled:///libs/lib.es2015.core.d.ts","bundled:///libs/lib.es2015.collection.d.ts","bundled:///libs/lib.es2015.generator.d.ts","bundled:///libs/lib.es2015.iterable.d.ts","bundled:///libs/lib.es2015.promise.d.ts","bundled:///libs/lib.es2015.proxy.d.ts","bundled:///libs/lib.es2015.reflect.d.ts","bundled:///libs/lib.es2015.symbol.d.ts","bundled:///libs/lib.es2015.symbol.wellknown.d.ts","bundled:///libs/lib.es2016.array.include.d.ts","bundled:///libs/lib.es2016.intl.d.ts","bundled:///libs/lib.es2017.arraybuffer.d.ts","bundled:///libs/lib.es2017.date.d.ts","bundled:///libs/lib.es2017.object.d.ts","bundled:///libs/lib.es2017.sharedmemory.d.ts","bundled:///libs/lib.es2017.string.d.ts","bundled:///libs/lib.es2017.intl.d.ts","bundled:///libs/lib.es2017.typedarrays.d.ts","bundled:///libs/lib.es2018.asyncgenerator.d.ts","bundled:///libs/lib.es2018.asynciterable.d.ts","bundled:///libs/lib.es2018.intl.d.ts","bundled:///libs/lib.es2018.promise.d.ts","bundled:///libs/lib.es2018.regexp.d.ts","bundled:///libs/lib.es2019.array.d.ts","bundled:///libs/lib.es2019.object.d.ts","bundled:///libs/lib.es2019.string.d.ts","bundled:///libs/lib.es2019.symbol.d.ts","bundled:///libs/lib.es2019.intl.d.ts","bundled:///libs/lib.es2020.bigint.d.ts","bundled:///libs/lib.es2020.date.d.ts","bundled:///libs/lib.es2020.promise.d.ts","bundled:///libs/lib.es2020.sharedmemory.d.ts","bundled:///libs/lib.es2020.string.d.ts","bundled:///libs/lib.es2020.symbol.wellknown.d.ts","bundled:///libs/lib.es2020.intl.d.ts","bundled:///libs/lib.es2020.number.d.ts","bundled:///libs/lib.es2021.promise.d.ts","bundled:///libs/lib.es2021.string.d.ts","bundled:///libs/lib.es2021.weakref.d.ts","bundled:///libs/lib.es2021.intl.d.ts","bundled:///libs/lib.es2022.array.d.ts","bundled:///libs/lib.es2022.error.d.ts","bundled:///libs/lib.es2022.intl.d.ts","bundled:///libs/lib.es2022.object.d.ts","bundled:///libs/lib.es2022.string.d.ts","bundled:///libs/lib.es2022.regexp.d.ts","bundled:///libs/lib.es2023.array.d.ts","bundled:///libs/lib.es2023.collection.d.ts","bundled:///libs/lib.es2023.intl.d.ts","bundled:///libs/lib.es2024.arraybuffer.d.ts","bundled:///libs/lib.es2024.collection.d.ts","bundled:///libs/lib.es2024.object.d.ts","bundled:///libs/lib.es2024.promise.d.ts","bundled:///libs/lib.es2024.regexp.d.ts","bundled:///libs/lib.es2024.sharedmemory.d.ts","bundled:///libs/lib.es2024.string.d.ts","bundled:///libs/lib.esnext.array.d.ts","bundled:///libs/lib.esnext.collection.d.ts","bundled:///libs/lib.esnext.intl.d.ts","bundled:///libs/lib.esnext.disposable.d.ts","bundled:///libs/lib.esnext.promise.d.ts","bundled:///libs/lib.esnext.decorators.d.ts","bundled:///libs/lib.esnext.iterator.d.ts","bundled:///libs/lib.esnext.float16.d.ts","bundled:///libs/lib.decorators.d.ts","bundled:///libs/lib.decorators.legacy.d.ts","bundled:///libs/lib.esnext.full.d.ts","../compiler/parser.d.ts","../../src/services/services.ts"],"fileInfos":[{"version":"69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546","affectsGlobalScope":true,"impliedNodeFormat":1},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","27bdc30a0e32783366a5abeda841bc22757c1797de8681bbe81fbc735eeb1c10","8fd575e12870e9944c7e1d62e1f5a73fcf23dd8d3a321f2a2c74c20d022283fe","8bf8b5e44e3c9c36f98e1007e8b7018c0f38d8adc07aecef42f5200114547c70",{"version":"092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"07f073f19d67f74d732b1adea08e1dc66b1b58d77cb5b43931dee3d798a2fd53","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d7a3c8b952931daebdfc7a2897c53c0a1c73624593fa070e46bd537e64dcd20a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b5ce7a470bc3628408429040c4e3a53a27755022a32fd05e2cb694e7015386c7","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"df83c2a6c73228b625b0beb6669c7ee2a09c914637e2d35170723ad49c0f5cd4","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8e3c06ea092138bf9fa5e874a1fdbc9d54805d074bee1de31b99a11e2fec239d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"87dc0f382502f5bbce5129bdc0aea21e19a3abbc19259e0b43ae038a9fc4e326","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b1cb28af0c891c8c96b2d6b7be76bd394fddcfdb4709a20ba05a7c1605eea0f9","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2fef54945a13095fdb9b84f705f2b5994597640c46afeb2ce78352fab4cb3279","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ac77cb3e8c6d3565793eb90a8373ee8033146315a3dbead3bde8db5eaf5e5ec6","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"56e4ed5aab5f5920980066a9409bfaf53e6d21d3f8d020c17e4de584d29600ad","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4ece9f17b3866cc077099c73f4983bddbcb1dc7ddb943227f1ec070f529dedd1","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0a6282c8827e4b9a95f4bf4f5c205673ada31b982f50572d27103df8ceb8013c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1c9319a09485199c1f7b0498f2988d6d2249793ef67edda49d1e584746be9032","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"e3a2a0cee0f03ffdde24d89660eba2685bfbdeae955a6c67e8c4c9fd28928eeb","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"51ad4c928303041605b4d7ae32e0c1ee387d43a24cd6f1ebf4a2699e1076d4fa","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"60037901da1a425516449b9a20073aa03386cce92f7a1fd902d7602be3a7c2e9","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"22adec94ef7047a6c9d1af3cb96be87a335908bf9ef386ae9fd50eeb37f44c47","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4245fee526a7d1754529d19227ecbf3be066ff79ebb6a380d78e41648f2f224d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedNodeFormat":1},"bde31fd423cd93b0eff97197a3f66df7c93e8c0c335cbeb113b7ff1ac35c23f4","2e29cd9a98755c46896f7a2d56524db2d6d96b248e36db46de14c30bf47c8d05",{"version":"407537635fda1a543a422ecdd456c1402aaa2083cde5acfb4eb424ab02fc0612","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[85]],"options":{"composite":true,"module":199,"outDir":"..","rewriteRelativeImportExtensions":true,"rootDir":"../../src"},"referencedMap":[[86,1]],"latestChangedDtsFile":"./services.d.ts"} -//// [/home/src/workspaces/solution/dist/services/tsconfig.tsbuildinfo.readable.baseline.txt] new file +//// [/home/src/workspaces/solution/dist/services/tsconfig.tsbuildinfo] *new* +{"version":"FakeTSVersion","fileNames":["../../../../tslibs/TS/Lib/lib.esnext.full.d.ts","../compiler/parser.d.ts","../../src/services/services.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},"2e29cd9a98755c46896f7a2d56524db2d6d96b248e36db46de14c30bf47c8d05",{"version":"407537635fda1a543a422ecdd456c1402aaa2083cde5acfb4eb424ab02fc0612","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"composite":true,"module":199,"outDir":"..","rewriteRelativeImportExtensions":true,"rootDir":"../../src"},"referencedMap":[[3,1]],"latestChangedDtsFile":"./services.d.ts"} +//// [/home/src/workspaces/solution/dist/services/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", "fileNames": [ - "bundled:///libs/lib.es5.d.ts", - "bundled:///libs/lib.es2015.d.ts", - "bundled:///libs/lib.es2016.d.ts", - "bundled:///libs/lib.es2017.d.ts", - "bundled:///libs/lib.es2018.d.ts", - "bundled:///libs/lib.es2019.d.ts", - "bundled:///libs/lib.es2020.d.ts", - "bundled:///libs/lib.es2021.d.ts", - "bundled:///libs/lib.es2022.d.ts", - "bundled:///libs/lib.es2023.d.ts", - "bundled:///libs/lib.es2024.d.ts", - "bundled:///libs/lib.esnext.d.ts", - "bundled:///libs/lib.dom.d.ts", - "bundled:///libs/lib.dom.iterable.d.ts", - "bundled:///libs/lib.dom.asynciterable.d.ts", - "bundled:///libs/lib.webworker.importscripts.d.ts", - "bundled:///libs/lib.scripthost.d.ts", - "bundled:///libs/lib.es2015.core.d.ts", - "bundled:///libs/lib.es2015.collection.d.ts", - "bundled:///libs/lib.es2015.generator.d.ts", - "bundled:///libs/lib.es2015.iterable.d.ts", - "bundled:///libs/lib.es2015.promise.d.ts", - "bundled:///libs/lib.es2015.proxy.d.ts", - "bundled:///libs/lib.es2015.reflect.d.ts", - "bundled:///libs/lib.es2015.symbol.d.ts", - "bundled:///libs/lib.es2015.symbol.wellknown.d.ts", - "bundled:///libs/lib.es2016.array.include.d.ts", - "bundled:///libs/lib.es2016.intl.d.ts", - "bundled:///libs/lib.es2017.arraybuffer.d.ts", - "bundled:///libs/lib.es2017.date.d.ts", - "bundled:///libs/lib.es2017.object.d.ts", - "bundled:///libs/lib.es2017.sharedmemory.d.ts", - "bundled:///libs/lib.es2017.string.d.ts", - "bundled:///libs/lib.es2017.intl.d.ts", - "bundled:///libs/lib.es2017.typedarrays.d.ts", - "bundled:///libs/lib.es2018.asyncgenerator.d.ts", - "bundled:///libs/lib.es2018.asynciterable.d.ts", - "bundled:///libs/lib.es2018.intl.d.ts", - "bundled:///libs/lib.es2018.promise.d.ts", - "bundled:///libs/lib.es2018.regexp.d.ts", - "bundled:///libs/lib.es2019.array.d.ts", - "bundled:///libs/lib.es2019.object.d.ts", - "bundled:///libs/lib.es2019.string.d.ts", - "bundled:///libs/lib.es2019.symbol.d.ts", - "bundled:///libs/lib.es2019.intl.d.ts", - "bundled:///libs/lib.es2020.bigint.d.ts", - "bundled:///libs/lib.es2020.date.d.ts", - "bundled:///libs/lib.es2020.promise.d.ts", - "bundled:///libs/lib.es2020.sharedmemory.d.ts", - "bundled:///libs/lib.es2020.string.d.ts", - "bundled:///libs/lib.es2020.symbol.wellknown.d.ts", - "bundled:///libs/lib.es2020.intl.d.ts", - "bundled:///libs/lib.es2020.number.d.ts", - "bundled:///libs/lib.es2021.promise.d.ts", - "bundled:///libs/lib.es2021.string.d.ts", - "bundled:///libs/lib.es2021.weakref.d.ts", - "bundled:///libs/lib.es2021.intl.d.ts", - "bundled:///libs/lib.es2022.array.d.ts", - "bundled:///libs/lib.es2022.error.d.ts", - "bundled:///libs/lib.es2022.intl.d.ts", - "bundled:///libs/lib.es2022.object.d.ts", - "bundled:///libs/lib.es2022.string.d.ts", - "bundled:///libs/lib.es2022.regexp.d.ts", - "bundled:///libs/lib.es2023.array.d.ts", - "bundled:///libs/lib.es2023.collection.d.ts", - "bundled:///libs/lib.es2023.intl.d.ts", - "bundled:///libs/lib.es2024.arraybuffer.d.ts", - "bundled:///libs/lib.es2024.collection.d.ts", - "bundled:///libs/lib.es2024.object.d.ts", - "bundled:///libs/lib.es2024.promise.d.ts", - "bundled:///libs/lib.es2024.regexp.d.ts", - "bundled:///libs/lib.es2024.sharedmemory.d.ts", - "bundled:///libs/lib.es2024.string.d.ts", - "bundled:///libs/lib.esnext.array.d.ts", - "bundled:///libs/lib.esnext.collection.d.ts", - "bundled:///libs/lib.esnext.intl.d.ts", - "bundled:///libs/lib.esnext.disposable.d.ts", - "bundled:///libs/lib.esnext.promise.d.ts", - "bundled:///libs/lib.esnext.decorators.d.ts", - "bundled:///libs/lib.esnext.iterator.d.ts", - "bundled:///libs/lib.esnext.float16.d.ts", - "bundled:///libs/lib.decorators.d.ts", - "bundled:///libs/lib.decorators.legacy.d.ts", - "bundled:///libs/lib.esnext.full.d.ts", + "../../../../tslibs/TS/Lib/lib.esnext.full.d.ts", "../compiler/parser.d.ts", "../../src/services/services.ts" ], "fileInfos": [ { - "fileName": "bundled:///libs/lib.es5.d.ts", - "version": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", - "signature": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2015.d.ts", - "version": "45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4", - "signature": "45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4", - "impliedNodeFormat": "CommonJS" - }, - { - "fileName": "bundled:///libs/lib.es2016.d.ts", - "version": "3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75", - "signature": "3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75", - "impliedNodeFormat": "CommonJS" - }, - { - "fileName": "bundled:///libs/lib.es2017.d.ts", - "version": "e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962", - "signature": "e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962", - "impliedNodeFormat": "CommonJS" - }, - { - "fileName": "bundled:///libs/lib.es2018.d.ts", - "version": "5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8", - "signature": "5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8", - "impliedNodeFormat": "CommonJS" - }, - { - "fileName": "bundled:///libs/lib.es2019.d.ts", - "version": "68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7", - "signature": "68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7", - "impliedNodeFormat": "CommonJS" - }, - { - "fileName": "bundled:///libs/lib.es2020.d.ts", - "version": "5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4", - "signature": "5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4", - "impliedNodeFormat": "CommonJS" - }, - { - "fileName": "bundled:///libs/lib.es2021.d.ts", - "version": "feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569", - "signature": "feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569", - "impliedNodeFormat": "CommonJS" - }, - { - "fileName": "bundled:///libs/lib.es2022.d.ts", - "version": "ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2", - "signature": "ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2", - "impliedNodeFormat": "CommonJS" - }, - { - "fileName": "bundled:///libs/lib.es2023.d.ts", - "version": "27bdc30a0e32783366a5abeda841bc22757c1797de8681bbe81fbc735eeb1c10", - "signature": "27bdc30a0e32783366a5abeda841bc22757c1797de8681bbe81fbc735eeb1c10", - "impliedNodeFormat": "CommonJS" - }, - { - "fileName": "bundled:///libs/lib.es2024.d.ts", - "version": "8fd575e12870e9944c7e1d62e1f5a73fcf23dd8d3a321f2a2c74c20d022283fe", - "signature": "8fd575e12870e9944c7e1d62e1f5a73fcf23dd8d3a321f2a2c74c20d022283fe", - "impliedNodeFormat": "CommonJS" - }, - { - "fileName": "bundled:///libs/lib.esnext.d.ts", - "version": "8bf8b5e44e3c9c36f98e1007e8b7018c0f38d8adc07aecef42f5200114547c70", - "signature": "8bf8b5e44e3c9c36f98e1007e8b7018c0f38d8adc07aecef42f5200114547c70", - "impliedNodeFormat": "CommonJS" - }, - { - "fileName": "bundled:///libs/lib.dom.d.ts", - "version": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", - "signature": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.dom.iterable.d.ts", - "version": "07f073f19d67f74d732b1adea08e1dc66b1b58d77cb5b43931dee3d798a2fd53", - "signature": "07f073f19d67f74d732b1adea08e1dc66b1b58d77cb5b43931dee3d798a2fd53", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "07f073f19d67f74d732b1adea08e1dc66b1b58d77cb5b43931dee3d798a2fd53", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.dom.asynciterable.d.ts", - "version": "d7a3c8b952931daebdfc7a2897c53c0a1c73624593fa070e46bd537e64dcd20a", - "signature": "d7a3c8b952931daebdfc7a2897c53c0a1c73624593fa070e46bd537e64dcd20a", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "d7a3c8b952931daebdfc7a2897c53c0a1c73624593fa070e46bd537e64dcd20a", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.webworker.importscripts.d.ts", - "version": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", - "signature": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.scripthost.d.ts", - "version": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", - "signature": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2015.core.d.ts", - "version": "c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671", - "signature": "c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2015.collection.d.ts", - "version": "dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44", - "signature": "dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2015.generator.d.ts", - "version": "515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71", - "signature": "515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2015.iterable.d.ts", - "version": "0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3", - "signature": "0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2015.promise.d.ts", - "version": "0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537", - "signature": "0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2015.proxy.d.ts", - "version": "ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671", - "signature": "ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2015.reflect.d.ts", - "version": "8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0", - "signature": "8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2015.symbol.d.ts", - "version": "4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d", - "signature": "4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2015.symbol.wellknown.d.ts", - "version": "936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df", - "signature": "936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2016.array.include.d.ts", - "version": "d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a", - "signature": "d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2016.intl.d.ts", - "version": "68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618", - "signature": "68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2017.arraybuffer.d.ts", - "version": "eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a", - "signature": "eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2017.date.d.ts", - "version": "38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119", - "signature": "38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2017.object.d.ts", - "version": "69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e", - "signature": "69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2017.sharedmemory.d.ts", - "version": "fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab", - "signature": "fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2017.string.d.ts", - "version": "2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893", - "signature": "2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2017.intl.d.ts", - "version": "4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc", - "signature": "4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2017.typedarrays.d.ts", - "version": "954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667", - "signature": "954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2018.asyncgenerator.d.ts", - "version": "ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c", - "signature": "ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2018.asynciterable.d.ts", - "version": "0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376", - "signature": "0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2018.intl.d.ts", - "version": "9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb", - "signature": "9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2018.promise.d.ts", - "version": "811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c", - "signature": "811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c", + "fileName": "../../../../tslibs/TS/Lib/lib.esnext.full.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", "affectsGlobalScope": true, "impliedNodeFormat": "CommonJS", "original": { - "version": "811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", "affectsGlobalScope": true, "impliedNodeFormat": 1 } }, - { - "fileName": "bundled:///libs/lib.es2018.regexp.d.ts", - "version": "717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca", - "signature": "717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2019.array.d.ts", - "version": "d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2", - "signature": "d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2019.object.d.ts", - "version": "71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557", - "signature": "71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2019.string.d.ts", - "version": "576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850", - "signature": "576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2019.symbol.d.ts", - "version": "89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6", - "signature": "89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2019.intl.d.ts", - "version": "74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b", - "signature": "74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2020.bigint.d.ts", - "version": "d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca", - "signature": "d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2020.date.d.ts", - "version": "063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df", - "signature": "063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2020.promise.d.ts", - "version": "934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab", - "signature": "934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2020.sharedmemory.d.ts", - "version": "52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47", - "signature": "52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2020.string.d.ts", - "version": "3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6", - "signature": "3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2020.symbol.wellknown.d.ts", - "version": "59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867", - "signature": "59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2020.intl.d.ts", - "version": "639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a", - "signature": "639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2020.number.d.ts", - "version": "368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1", - "signature": "368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2021.promise.d.ts", - "version": "af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74", - "signature": "af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2021.string.d.ts", - "version": "995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399", - "signature": "995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2021.weakref.d.ts", - "version": "959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a", - "signature": "959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2021.intl.d.ts", - "version": "965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d", - "signature": "965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2022.array.d.ts", - "version": "3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b", - "signature": "3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2022.error.d.ts", - "version": "0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005", - "signature": "0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2022.intl.d.ts", - "version": "b5ce7a470bc3628408429040c4e3a53a27755022a32fd05e2cb694e7015386c7", - "signature": "b5ce7a470bc3628408429040c4e3a53a27755022a32fd05e2cb694e7015386c7", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "b5ce7a470bc3628408429040c4e3a53a27755022a32fd05e2cb694e7015386c7", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2022.object.d.ts", - "version": "8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a", - "signature": "8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2022.string.d.ts", - "version": "3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004", - "signature": "3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2022.regexp.d.ts", - "version": "b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad", - "signature": "b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2023.array.d.ts", - "version": "df83c2a6c73228b625b0beb6669c7ee2a09c914637e2d35170723ad49c0f5cd4", - "signature": "df83c2a6c73228b625b0beb6669c7ee2a09c914637e2d35170723ad49c0f5cd4", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "df83c2a6c73228b625b0beb6669c7ee2a09c914637e2d35170723ad49c0f5cd4", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2023.collection.d.ts", - "version": "436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a", - "signature": "436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2023.intl.d.ts", - "version": "8e3c06ea092138bf9fa5e874a1fdbc9d54805d074bee1de31b99a11e2fec239d", - "signature": "8e3c06ea092138bf9fa5e874a1fdbc9d54805d074bee1de31b99a11e2fec239d", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "8e3c06ea092138bf9fa5e874a1fdbc9d54805d074bee1de31b99a11e2fec239d", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2024.arraybuffer.d.ts", - "version": "87dc0f382502f5bbce5129bdc0aea21e19a3abbc19259e0b43ae038a9fc4e326", - "signature": "87dc0f382502f5bbce5129bdc0aea21e19a3abbc19259e0b43ae038a9fc4e326", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "87dc0f382502f5bbce5129bdc0aea21e19a3abbc19259e0b43ae038a9fc4e326", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2024.collection.d.ts", - "version": "b1cb28af0c891c8c96b2d6b7be76bd394fddcfdb4709a20ba05a7c1605eea0f9", - "signature": "b1cb28af0c891c8c96b2d6b7be76bd394fddcfdb4709a20ba05a7c1605eea0f9", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "b1cb28af0c891c8c96b2d6b7be76bd394fddcfdb4709a20ba05a7c1605eea0f9", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2024.object.d.ts", - "version": "2fef54945a13095fdb9b84f705f2b5994597640c46afeb2ce78352fab4cb3279", - "signature": "2fef54945a13095fdb9b84f705f2b5994597640c46afeb2ce78352fab4cb3279", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "2fef54945a13095fdb9b84f705f2b5994597640c46afeb2ce78352fab4cb3279", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2024.promise.d.ts", - "version": "ac77cb3e8c6d3565793eb90a8373ee8033146315a3dbead3bde8db5eaf5e5ec6", - "signature": "ac77cb3e8c6d3565793eb90a8373ee8033146315a3dbead3bde8db5eaf5e5ec6", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "ac77cb3e8c6d3565793eb90a8373ee8033146315a3dbead3bde8db5eaf5e5ec6", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2024.regexp.d.ts", - "version": "56e4ed5aab5f5920980066a9409bfaf53e6d21d3f8d020c17e4de584d29600ad", - "signature": "56e4ed5aab5f5920980066a9409bfaf53e6d21d3f8d020c17e4de584d29600ad", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "56e4ed5aab5f5920980066a9409bfaf53e6d21d3f8d020c17e4de584d29600ad", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2024.sharedmemory.d.ts", - "version": "4ece9f17b3866cc077099c73f4983bddbcb1dc7ddb943227f1ec070f529dedd1", - "signature": "4ece9f17b3866cc077099c73f4983bddbcb1dc7ddb943227f1ec070f529dedd1", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "4ece9f17b3866cc077099c73f4983bddbcb1dc7ddb943227f1ec070f529dedd1", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2024.string.d.ts", - "version": "0a6282c8827e4b9a95f4bf4f5c205673ada31b982f50572d27103df8ceb8013c", - "signature": "0a6282c8827e4b9a95f4bf4f5c205673ada31b982f50572d27103df8ceb8013c", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "0a6282c8827e4b9a95f4bf4f5c205673ada31b982f50572d27103df8ceb8013c", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.esnext.array.d.ts", - "version": "1c9319a09485199c1f7b0498f2988d6d2249793ef67edda49d1e584746be9032", - "signature": "1c9319a09485199c1f7b0498f2988d6d2249793ef67edda49d1e584746be9032", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "1c9319a09485199c1f7b0498f2988d6d2249793ef67edda49d1e584746be9032", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.esnext.collection.d.ts", - "version": "e3a2a0cee0f03ffdde24d89660eba2685bfbdeae955a6c67e8c4c9fd28928eeb", - "signature": "e3a2a0cee0f03ffdde24d89660eba2685bfbdeae955a6c67e8c4c9fd28928eeb", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "e3a2a0cee0f03ffdde24d89660eba2685bfbdeae955a6c67e8c4c9fd28928eeb", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.esnext.intl.d.ts", - "version": "811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4", - "signature": "811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.esnext.disposable.d.ts", - "version": "51ad4c928303041605b4d7ae32e0c1ee387d43a24cd6f1ebf4a2699e1076d4fa", - "signature": "51ad4c928303041605b4d7ae32e0c1ee387d43a24cd6f1ebf4a2699e1076d4fa", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "51ad4c928303041605b4d7ae32e0c1ee387d43a24cd6f1ebf4a2699e1076d4fa", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.esnext.promise.d.ts", - "version": "60037901da1a425516449b9a20073aa03386cce92f7a1fd902d7602be3a7c2e9", - "signature": "60037901da1a425516449b9a20073aa03386cce92f7a1fd902d7602be3a7c2e9", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "60037901da1a425516449b9a20073aa03386cce92f7a1fd902d7602be3a7c2e9", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.esnext.decorators.d.ts", - "version": "d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f", - "signature": "d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.esnext.iterator.d.ts", - "version": "22adec94ef7047a6c9d1af3cb96be87a335908bf9ef386ae9fd50eeb37f44c47", - "signature": "22adec94ef7047a6c9d1af3cb96be87a335908bf9ef386ae9fd50eeb37f44c47", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "22adec94ef7047a6c9d1af3cb96be87a335908bf9ef386ae9fd50eeb37f44c47", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.esnext.float16.d.ts", - "version": "4245fee526a7d1754529d19227ecbf3be066ff79ebb6a380d78e41648f2f224d", - "signature": "4245fee526a7d1754529d19227ecbf3be066ff79ebb6a380d78e41648f2f224d", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "4245fee526a7d1754529d19227ecbf3be066ff79ebb6a380d78e41648f2f224d", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.decorators.d.ts", - "version": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", - "signature": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.decorators.legacy.d.ts", - "version": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", - "signature": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.esnext.full.d.ts", - "version": "bde31fd423cd93b0eff97197a3f66df7c93e8c0c335cbeb113b7ff1ac35c23f4", - "signature": "bde31fd423cd93b0eff97197a3f66df7c93e8c0c335cbeb113b7ff1ac35c23f4", - "impliedNodeFormat": "CommonJS" - }, { "fileName": "../compiler/parser.d.ts", "version": "2e29cd9a98755c46896f7a2d56524db2d6d96b248e36db46de14c30bf47c8d05", @@ -1114,11 +129,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); ] }, "latestChangedDtsFile": "./services.d.ts", - "size": 13954 + "size": 739 } -//// [/home/src/workspaces/solution/src/compiler/parser.ts] no change -//// [/home/src/workspaces/solution/src/compiler/tsconfig.json] no change -//// [/home/src/workspaces/solution/src/services/services.ts] no change -//// [/home/src/workspaces/solution/src/services/tsconfig.json] no change -//// [/home/src/workspaces/solution/src/tsconfig-base.json] no change diff --git a/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences3.js b/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences3.js index f99c2788d1..d2cec80dee 100644 --- a/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences3.js +++ b/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences3.js @@ -2,11 +2,11 @@ currentDirectory::/home/src/workspaces/solution useCaseSensitiveFileNames::true Input::--p src/services --pretty false -//// [/home/src/workspaces/solution/dist/compiler/parser.d.ts] new file +//// [/home/src/workspaces/solution/dist/compiler/parser.d.ts] *new* export {}; -//// [/home/src/workspaces/solution/src/compiler/parser.ts] new file +//// [/home/src/workspaces/solution/src/compiler/parser.ts] *new* export {}; -//// [/home/src/workspaces/solution/src/compiler/tsconfig.json] new file +//// [/home/src/workspaces/solution/src/compiler/tsconfig.json] *new* { "extends": "../tsconfig-base.json", "compilerOptions": { @@ -14,9 +14,9 @@ export {}; "outDir": "../../dist/compiler" } } -//// [/home/src/workspaces/solution/src/services/services.ts] new file +//// [/home/src/workspaces/solution/src/services/services.ts] *new* import {} from "../compiler/parser.ts"; -//// [/home/src/workspaces/solution/src/services/tsconfig.json] new file +//// [/home/src/workspaces/solution/src/services/tsconfig.json] *new* { "extends": "../tsconfig-base.json", "compilerOptions": { @@ -27,7 +27,7 @@ import {} from "../compiler/parser.ts"; { "path": "../compiler" } ] } -//// [/home/src/workspaces/solution/src/tsconfig-base.json] new file +//// [/home/src/workspaces/solution/src/tsconfig-base.json] *new* { "compilerOptions": { "module": "nodenext", @@ -44,1044 +44,59 @@ CompilerOptions::{ } Output:: No output -//// [/home/src/workspaces/solution/dist/compiler/parser.d.ts] no change -//// [/home/src/workspaces/solution/dist/services/services.d.ts] new file +//// [/home/src/tslibs/TS/Lib/lib.esnext.full.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; +//// [/home/src/workspaces/solution/dist/services/services.d.ts] *new* export {}; -//// [/home/src/workspaces/solution/dist/services/services.js] new file +//// [/home/src/workspaces/solution/dist/services/services.js] *new* "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -//// [/home/src/workspaces/solution/dist/services/tsconfig.tsbuildinfo] new file -{"version":"FakeTSVersion","fileNames":["bundled:///libs/lib.es5.d.ts","bundled:///libs/lib.es2015.d.ts","bundled:///libs/lib.es2016.d.ts","bundled:///libs/lib.es2017.d.ts","bundled:///libs/lib.es2018.d.ts","bundled:///libs/lib.es2019.d.ts","bundled:///libs/lib.es2020.d.ts","bundled:///libs/lib.es2021.d.ts","bundled:///libs/lib.es2022.d.ts","bundled:///libs/lib.es2023.d.ts","bundled:///libs/lib.es2024.d.ts","bundled:///libs/lib.esnext.d.ts","bundled:///libs/lib.dom.d.ts","bundled:///libs/lib.dom.iterable.d.ts","bundled:///libs/lib.dom.asynciterable.d.ts","bundled:///libs/lib.webworker.importscripts.d.ts","bundled:///libs/lib.scripthost.d.ts","bundled:///libs/lib.es2015.core.d.ts","bundled:///libs/lib.es2015.collection.d.ts","bundled:///libs/lib.es2015.generator.d.ts","bundled:///libs/lib.es2015.iterable.d.ts","bundled:///libs/lib.es2015.promise.d.ts","bundled:///libs/lib.es2015.proxy.d.ts","bundled:///libs/lib.es2015.reflect.d.ts","bundled:///libs/lib.es2015.symbol.d.ts","bundled:///libs/lib.es2015.symbol.wellknown.d.ts","bundled:///libs/lib.es2016.array.include.d.ts","bundled:///libs/lib.es2016.intl.d.ts","bundled:///libs/lib.es2017.arraybuffer.d.ts","bundled:///libs/lib.es2017.date.d.ts","bundled:///libs/lib.es2017.object.d.ts","bundled:///libs/lib.es2017.sharedmemory.d.ts","bundled:///libs/lib.es2017.string.d.ts","bundled:///libs/lib.es2017.intl.d.ts","bundled:///libs/lib.es2017.typedarrays.d.ts","bundled:///libs/lib.es2018.asyncgenerator.d.ts","bundled:///libs/lib.es2018.asynciterable.d.ts","bundled:///libs/lib.es2018.intl.d.ts","bundled:///libs/lib.es2018.promise.d.ts","bundled:///libs/lib.es2018.regexp.d.ts","bundled:///libs/lib.es2019.array.d.ts","bundled:///libs/lib.es2019.object.d.ts","bundled:///libs/lib.es2019.string.d.ts","bundled:///libs/lib.es2019.symbol.d.ts","bundled:///libs/lib.es2019.intl.d.ts","bundled:///libs/lib.es2020.bigint.d.ts","bundled:///libs/lib.es2020.date.d.ts","bundled:///libs/lib.es2020.promise.d.ts","bundled:///libs/lib.es2020.sharedmemory.d.ts","bundled:///libs/lib.es2020.string.d.ts","bundled:///libs/lib.es2020.symbol.wellknown.d.ts","bundled:///libs/lib.es2020.intl.d.ts","bundled:///libs/lib.es2020.number.d.ts","bundled:///libs/lib.es2021.promise.d.ts","bundled:///libs/lib.es2021.string.d.ts","bundled:///libs/lib.es2021.weakref.d.ts","bundled:///libs/lib.es2021.intl.d.ts","bundled:///libs/lib.es2022.array.d.ts","bundled:///libs/lib.es2022.error.d.ts","bundled:///libs/lib.es2022.intl.d.ts","bundled:///libs/lib.es2022.object.d.ts","bundled:///libs/lib.es2022.string.d.ts","bundled:///libs/lib.es2022.regexp.d.ts","bundled:///libs/lib.es2023.array.d.ts","bundled:///libs/lib.es2023.collection.d.ts","bundled:///libs/lib.es2023.intl.d.ts","bundled:///libs/lib.es2024.arraybuffer.d.ts","bundled:///libs/lib.es2024.collection.d.ts","bundled:///libs/lib.es2024.object.d.ts","bundled:///libs/lib.es2024.promise.d.ts","bundled:///libs/lib.es2024.regexp.d.ts","bundled:///libs/lib.es2024.sharedmemory.d.ts","bundled:///libs/lib.es2024.string.d.ts","bundled:///libs/lib.esnext.array.d.ts","bundled:///libs/lib.esnext.collection.d.ts","bundled:///libs/lib.esnext.intl.d.ts","bundled:///libs/lib.esnext.disposable.d.ts","bundled:///libs/lib.esnext.promise.d.ts","bundled:///libs/lib.esnext.decorators.d.ts","bundled:///libs/lib.esnext.iterator.d.ts","bundled:///libs/lib.esnext.float16.d.ts","bundled:///libs/lib.decorators.d.ts","bundled:///libs/lib.decorators.legacy.d.ts","bundled:///libs/lib.esnext.full.d.ts","../compiler/parser.d.ts","../../src/services/services.ts"],"fileInfos":[{"version":"69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546","affectsGlobalScope":true,"impliedNodeFormat":1},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","27bdc30a0e32783366a5abeda841bc22757c1797de8681bbe81fbc735eeb1c10","8fd575e12870e9944c7e1d62e1f5a73fcf23dd8d3a321f2a2c74c20d022283fe","8bf8b5e44e3c9c36f98e1007e8b7018c0f38d8adc07aecef42f5200114547c70",{"version":"092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"07f073f19d67f74d732b1adea08e1dc66b1b58d77cb5b43931dee3d798a2fd53","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d7a3c8b952931daebdfc7a2897c53c0a1c73624593fa070e46bd537e64dcd20a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b5ce7a470bc3628408429040c4e3a53a27755022a32fd05e2cb694e7015386c7","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"df83c2a6c73228b625b0beb6669c7ee2a09c914637e2d35170723ad49c0f5cd4","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8e3c06ea092138bf9fa5e874a1fdbc9d54805d074bee1de31b99a11e2fec239d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"87dc0f382502f5bbce5129bdc0aea21e19a3abbc19259e0b43ae038a9fc4e326","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b1cb28af0c891c8c96b2d6b7be76bd394fddcfdb4709a20ba05a7c1605eea0f9","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2fef54945a13095fdb9b84f705f2b5994597640c46afeb2ce78352fab4cb3279","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ac77cb3e8c6d3565793eb90a8373ee8033146315a3dbead3bde8db5eaf5e5ec6","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"56e4ed5aab5f5920980066a9409bfaf53e6d21d3f8d020c17e4de584d29600ad","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4ece9f17b3866cc077099c73f4983bddbcb1dc7ddb943227f1ec070f529dedd1","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0a6282c8827e4b9a95f4bf4f5c205673ada31b982f50572d27103df8ceb8013c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1c9319a09485199c1f7b0498f2988d6d2249793ef67edda49d1e584746be9032","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"e3a2a0cee0f03ffdde24d89660eba2685bfbdeae955a6c67e8c4c9fd28928eeb","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"51ad4c928303041605b4d7ae32e0c1ee387d43a24cd6f1ebf4a2699e1076d4fa","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"60037901da1a425516449b9a20073aa03386cce92f7a1fd902d7602be3a7c2e9","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"22adec94ef7047a6c9d1af3cb96be87a335908bf9ef386ae9fd50eeb37f44c47","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4245fee526a7d1754529d19227ecbf3be066ff79ebb6a380d78e41648f2f224d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedNodeFormat":1},"bde31fd423cd93b0eff97197a3f66df7c93e8c0c335cbeb113b7ff1ac35c23f4","2e29cd9a98755c46896f7a2d56524db2d6d96b248e36db46de14c30bf47c8d05",{"version":"407537635fda1a543a422ecdd456c1402aaa2083cde5acfb4eb424ab02fc0612","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[85]],"options":{"composite":true,"module":199,"outDir":"./","rewriteRelativeImportExtensions":true,"rootDir":"../../src/services"},"referencedMap":[[86,1]],"latestChangedDtsFile":"./services.d.ts"} -//// [/home/src/workspaces/solution/dist/services/tsconfig.tsbuildinfo.readable.baseline.txt] new file +//// [/home/src/workspaces/solution/dist/services/tsconfig.tsbuildinfo] *new* +{"version":"FakeTSVersion","fileNames":["../../../../tslibs/TS/Lib/lib.esnext.full.d.ts","../compiler/parser.d.ts","../../src/services/services.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},"2e29cd9a98755c46896f7a2d56524db2d6d96b248e36db46de14c30bf47c8d05",{"version":"407537635fda1a543a422ecdd456c1402aaa2083cde5acfb4eb424ab02fc0612","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"composite":true,"module":199,"outDir":"./","rewriteRelativeImportExtensions":true,"rootDir":"../../src/services"},"referencedMap":[[3,1]],"latestChangedDtsFile":"./services.d.ts"} +//// [/home/src/workspaces/solution/dist/services/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", "fileNames": [ - "bundled:///libs/lib.es5.d.ts", - "bundled:///libs/lib.es2015.d.ts", - "bundled:///libs/lib.es2016.d.ts", - "bundled:///libs/lib.es2017.d.ts", - "bundled:///libs/lib.es2018.d.ts", - "bundled:///libs/lib.es2019.d.ts", - "bundled:///libs/lib.es2020.d.ts", - "bundled:///libs/lib.es2021.d.ts", - "bundled:///libs/lib.es2022.d.ts", - "bundled:///libs/lib.es2023.d.ts", - "bundled:///libs/lib.es2024.d.ts", - "bundled:///libs/lib.esnext.d.ts", - "bundled:///libs/lib.dom.d.ts", - "bundled:///libs/lib.dom.iterable.d.ts", - "bundled:///libs/lib.dom.asynciterable.d.ts", - "bundled:///libs/lib.webworker.importscripts.d.ts", - "bundled:///libs/lib.scripthost.d.ts", - "bundled:///libs/lib.es2015.core.d.ts", - "bundled:///libs/lib.es2015.collection.d.ts", - "bundled:///libs/lib.es2015.generator.d.ts", - "bundled:///libs/lib.es2015.iterable.d.ts", - "bundled:///libs/lib.es2015.promise.d.ts", - "bundled:///libs/lib.es2015.proxy.d.ts", - "bundled:///libs/lib.es2015.reflect.d.ts", - "bundled:///libs/lib.es2015.symbol.d.ts", - "bundled:///libs/lib.es2015.symbol.wellknown.d.ts", - "bundled:///libs/lib.es2016.array.include.d.ts", - "bundled:///libs/lib.es2016.intl.d.ts", - "bundled:///libs/lib.es2017.arraybuffer.d.ts", - "bundled:///libs/lib.es2017.date.d.ts", - "bundled:///libs/lib.es2017.object.d.ts", - "bundled:///libs/lib.es2017.sharedmemory.d.ts", - "bundled:///libs/lib.es2017.string.d.ts", - "bundled:///libs/lib.es2017.intl.d.ts", - "bundled:///libs/lib.es2017.typedarrays.d.ts", - "bundled:///libs/lib.es2018.asyncgenerator.d.ts", - "bundled:///libs/lib.es2018.asynciterable.d.ts", - "bundled:///libs/lib.es2018.intl.d.ts", - "bundled:///libs/lib.es2018.promise.d.ts", - "bundled:///libs/lib.es2018.regexp.d.ts", - "bundled:///libs/lib.es2019.array.d.ts", - "bundled:///libs/lib.es2019.object.d.ts", - "bundled:///libs/lib.es2019.string.d.ts", - "bundled:///libs/lib.es2019.symbol.d.ts", - "bundled:///libs/lib.es2019.intl.d.ts", - "bundled:///libs/lib.es2020.bigint.d.ts", - "bundled:///libs/lib.es2020.date.d.ts", - "bundled:///libs/lib.es2020.promise.d.ts", - "bundled:///libs/lib.es2020.sharedmemory.d.ts", - "bundled:///libs/lib.es2020.string.d.ts", - "bundled:///libs/lib.es2020.symbol.wellknown.d.ts", - "bundled:///libs/lib.es2020.intl.d.ts", - "bundled:///libs/lib.es2020.number.d.ts", - "bundled:///libs/lib.es2021.promise.d.ts", - "bundled:///libs/lib.es2021.string.d.ts", - "bundled:///libs/lib.es2021.weakref.d.ts", - "bundled:///libs/lib.es2021.intl.d.ts", - "bundled:///libs/lib.es2022.array.d.ts", - "bundled:///libs/lib.es2022.error.d.ts", - "bundled:///libs/lib.es2022.intl.d.ts", - "bundled:///libs/lib.es2022.object.d.ts", - "bundled:///libs/lib.es2022.string.d.ts", - "bundled:///libs/lib.es2022.regexp.d.ts", - "bundled:///libs/lib.es2023.array.d.ts", - "bundled:///libs/lib.es2023.collection.d.ts", - "bundled:///libs/lib.es2023.intl.d.ts", - "bundled:///libs/lib.es2024.arraybuffer.d.ts", - "bundled:///libs/lib.es2024.collection.d.ts", - "bundled:///libs/lib.es2024.object.d.ts", - "bundled:///libs/lib.es2024.promise.d.ts", - "bundled:///libs/lib.es2024.regexp.d.ts", - "bundled:///libs/lib.es2024.sharedmemory.d.ts", - "bundled:///libs/lib.es2024.string.d.ts", - "bundled:///libs/lib.esnext.array.d.ts", - "bundled:///libs/lib.esnext.collection.d.ts", - "bundled:///libs/lib.esnext.intl.d.ts", - "bundled:///libs/lib.esnext.disposable.d.ts", - "bundled:///libs/lib.esnext.promise.d.ts", - "bundled:///libs/lib.esnext.decorators.d.ts", - "bundled:///libs/lib.esnext.iterator.d.ts", - "bundled:///libs/lib.esnext.float16.d.ts", - "bundled:///libs/lib.decorators.d.ts", - "bundled:///libs/lib.decorators.legacy.d.ts", - "bundled:///libs/lib.esnext.full.d.ts", + "../../../../tslibs/TS/Lib/lib.esnext.full.d.ts", "../compiler/parser.d.ts", "../../src/services/services.ts" ], "fileInfos": [ { - "fileName": "bundled:///libs/lib.es5.d.ts", - "version": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", - "signature": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2015.d.ts", - "version": "45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4", - "signature": "45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4", - "impliedNodeFormat": "CommonJS" - }, - { - "fileName": "bundled:///libs/lib.es2016.d.ts", - "version": "3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75", - "signature": "3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75", - "impliedNodeFormat": "CommonJS" - }, - { - "fileName": "bundled:///libs/lib.es2017.d.ts", - "version": "e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962", - "signature": "e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962", - "impliedNodeFormat": "CommonJS" - }, - { - "fileName": "bundled:///libs/lib.es2018.d.ts", - "version": "5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8", - "signature": "5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8", - "impliedNodeFormat": "CommonJS" - }, - { - "fileName": "bundled:///libs/lib.es2019.d.ts", - "version": "68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7", - "signature": "68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7", - "impliedNodeFormat": "CommonJS" - }, - { - "fileName": "bundled:///libs/lib.es2020.d.ts", - "version": "5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4", - "signature": "5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4", - "impliedNodeFormat": "CommonJS" - }, - { - "fileName": "bundled:///libs/lib.es2021.d.ts", - "version": "feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569", - "signature": "feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569", - "impliedNodeFormat": "CommonJS" - }, - { - "fileName": "bundled:///libs/lib.es2022.d.ts", - "version": "ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2", - "signature": "ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2", - "impliedNodeFormat": "CommonJS" - }, - { - "fileName": "bundled:///libs/lib.es2023.d.ts", - "version": "27bdc30a0e32783366a5abeda841bc22757c1797de8681bbe81fbc735eeb1c10", - "signature": "27bdc30a0e32783366a5abeda841bc22757c1797de8681bbe81fbc735eeb1c10", - "impliedNodeFormat": "CommonJS" - }, - { - "fileName": "bundled:///libs/lib.es2024.d.ts", - "version": "8fd575e12870e9944c7e1d62e1f5a73fcf23dd8d3a321f2a2c74c20d022283fe", - "signature": "8fd575e12870e9944c7e1d62e1f5a73fcf23dd8d3a321f2a2c74c20d022283fe", - "impliedNodeFormat": "CommonJS" - }, - { - "fileName": "bundled:///libs/lib.esnext.d.ts", - "version": "8bf8b5e44e3c9c36f98e1007e8b7018c0f38d8adc07aecef42f5200114547c70", - "signature": "8bf8b5e44e3c9c36f98e1007e8b7018c0f38d8adc07aecef42f5200114547c70", - "impliedNodeFormat": "CommonJS" - }, - { - "fileName": "bundled:///libs/lib.dom.d.ts", - "version": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", - "signature": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.dom.iterable.d.ts", - "version": "07f073f19d67f74d732b1adea08e1dc66b1b58d77cb5b43931dee3d798a2fd53", - "signature": "07f073f19d67f74d732b1adea08e1dc66b1b58d77cb5b43931dee3d798a2fd53", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "07f073f19d67f74d732b1adea08e1dc66b1b58d77cb5b43931dee3d798a2fd53", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.dom.asynciterable.d.ts", - "version": "d7a3c8b952931daebdfc7a2897c53c0a1c73624593fa070e46bd537e64dcd20a", - "signature": "d7a3c8b952931daebdfc7a2897c53c0a1c73624593fa070e46bd537e64dcd20a", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "d7a3c8b952931daebdfc7a2897c53c0a1c73624593fa070e46bd537e64dcd20a", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.webworker.importscripts.d.ts", - "version": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", - "signature": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.scripthost.d.ts", - "version": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", - "signature": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2015.core.d.ts", - "version": "c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671", - "signature": "c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2015.collection.d.ts", - "version": "dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44", - "signature": "dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2015.generator.d.ts", - "version": "515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71", - "signature": "515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2015.iterable.d.ts", - "version": "0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3", - "signature": "0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2015.promise.d.ts", - "version": "0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537", - "signature": "0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2015.proxy.d.ts", - "version": "ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671", - "signature": "ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2015.reflect.d.ts", - "version": "8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0", - "signature": "8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2015.symbol.d.ts", - "version": "4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d", - "signature": "4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2015.symbol.wellknown.d.ts", - "version": "936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df", - "signature": "936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2016.array.include.d.ts", - "version": "d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a", - "signature": "d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2016.intl.d.ts", - "version": "68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618", - "signature": "68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2017.arraybuffer.d.ts", - "version": "eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a", - "signature": "eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2017.date.d.ts", - "version": "38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119", - "signature": "38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2017.object.d.ts", - "version": "69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e", - "signature": "69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2017.sharedmemory.d.ts", - "version": "fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab", - "signature": "fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2017.string.d.ts", - "version": "2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893", - "signature": "2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2017.intl.d.ts", - "version": "4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc", - "signature": "4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2017.typedarrays.d.ts", - "version": "954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667", - "signature": "954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2018.asyncgenerator.d.ts", - "version": "ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c", - "signature": "ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2018.asynciterable.d.ts", - "version": "0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376", - "signature": "0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2018.intl.d.ts", - "version": "9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb", - "signature": "9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2018.promise.d.ts", - "version": "811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c", - "signature": "811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c", + "fileName": "../../../../tslibs/TS/Lib/lib.esnext.full.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", "affectsGlobalScope": true, "impliedNodeFormat": "CommonJS", "original": { - "version": "811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", "affectsGlobalScope": true, "impliedNodeFormat": 1 } }, - { - "fileName": "bundled:///libs/lib.es2018.regexp.d.ts", - "version": "717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca", - "signature": "717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2019.array.d.ts", - "version": "d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2", - "signature": "d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2019.object.d.ts", - "version": "71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557", - "signature": "71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2019.string.d.ts", - "version": "576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850", - "signature": "576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2019.symbol.d.ts", - "version": "89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6", - "signature": "89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2019.intl.d.ts", - "version": "74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b", - "signature": "74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2020.bigint.d.ts", - "version": "d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca", - "signature": "d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2020.date.d.ts", - "version": "063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df", - "signature": "063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2020.promise.d.ts", - "version": "934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab", - "signature": "934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2020.sharedmemory.d.ts", - "version": "52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47", - "signature": "52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2020.string.d.ts", - "version": "3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6", - "signature": "3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2020.symbol.wellknown.d.ts", - "version": "59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867", - "signature": "59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2020.intl.d.ts", - "version": "639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a", - "signature": "639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2020.number.d.ts", - "version": "368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1", - "signature": "368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2021.promise.d.ts", - "version": "af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74", - "signature": "af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2021.string.d.ts", - "version": "995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399", - "signature": "995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2021.weakref.d.ts", - "version": "959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a", - "signature": "959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2021.intl.d.ts", - "version": "965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d", - "signature": "965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2022.array.d.ts", - "version": "3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b", - "signature": "3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2022.error.d.ts", - "version": "0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005", - "signature": "0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2022.intl.d.ts", - "version": "b5ce7a470bc3628408429040c4e3a53a27755022a32fd05e2cb694e7015386c7", - "signature": "b5ce7a470bc3628408429040c4e3a53a27755022a32fd05e2cb694e7015386c7", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "b5ce7a470bc3628408429040c4e3a53a27755022a32fd05e2cb694e7015386c7", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2022.object.d.ts", - "version": "8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a", - "signature": "8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2022.string.d.ts", - "version": "3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004", - "signature": "3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2022.regexp.d.ts", - "version": "b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad", - "signature": "b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2023.array.d.ts", - "version": "df83c2a6c73228b625b0beb6669c7ee2a09c914637e2d35170723ad49c0f5cd4", - "signature": "df83c2a6c73228b625b0beb6669c7ee2a09c914637e2d35170723ad49c0f5cd4", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "df83c2a6c73228b625b0beb6669c7ee2a09c914637e2d35170723ad49c0f5cd4", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2023.collection.d.ts", - "version": "436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a", - "signature": "436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2023.intl.d.ts", - "version": "8e3c06ea092138bf9fa5e874a1fdbc9d54805d074bee1de31b99a11e2fec239d", - "signature": "8e3c06ea092138bf9fa5e874a1fdbc9d54805d074bee1de31b99a11e2fec239d", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "8e3c06ea092138bf9fa5e874a1fdbc9d54805d074bee1de31b99a11e2fec239d", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2024.arraybuffer.d.ts", - "version": "87dc0f382502f5bbce5129bdc0aea21e19a3abbc19259e0b43ae038a9fc4e326", - "signature": "87dc0f382502f5bbce5129bdc0aea21e19a3abbc19259e0b43ae038a9fc4e326", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "87dc0f382502f5bbce5129bdc0aea21e19a3abbc19259e0b43ae038a9fc4e326", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2024.collection.d.ts", - "version": "b1cb28af0c891c8c96b2d6b7be76bd394fddcfdb4709a20ba05a7c1605eea0f9", - "signature": "b1cb28af0c891c8c96b2d6b7be76bd394fddcfdb4709a20ba05a7c1605eea0f9", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "b1cb28af0c891c8c96b2d6b7be76bd394fddcfdb4709a20ba05a7c1605eea0f9", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2024.object.d.ts", - "version": "2fef54945a13095fdb9b84f705f2b5994597640c46afeb2ce78352fab4cb3279", - "signature": "2fef54945a13095fdb9b84f705f2b5994597640c46afeb2ce78352fab4cb3279", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "2fef54945a13095fdb9b84f705f2b5994597640c46afeb2ce78352fab4cb3279", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2024.promise.d.ts", - "version": "ac77cb3e8c6d3565793eb90a8373ee8033146315a3dbead3bde8db5eaf5e5ec6", - "signature": "ac77cb3e8c6d3565793eb90a8373ee8033146315a3dbead3bde8db5eaf5e5ec6", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "ac77cb3e8c6d3565793eb90a8373ee8033146315a3dbead3bde8db5eaf5e5ec6", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2024.regexp.d.ts", - "version": "56e4ed5aab5f5920980066a9409bfaf53e6d21d3f8d020c17e4de584d29600ad", - "signature": "56e4ed5aab5f5920980066a9409bfaf53e6d21d3f8d020c17e4de584d29600ad", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "56e4ed5aab5f5920980066a9409bfaf53e6d21d3f8d020c17e4de584d29600ad", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2024.sharedmemory.d.ts", - "version": "4ece9f17b3866cc077099c73f4983bddbcb1dc7ddb943227f1ec070f529dedd1", - "signature": "4ece9f17b3866cc077099c73f4983bddbcb1dc7ddb943227f1ec070f529dedd1", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "4ece9f17b3866cc077099c73f4983bddbcb1dc7ddb943227f1ec070f529dedd1", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.es2024.string.d.ts", - "version": "0a6282c8827e4b9a95f4bf4f5c205673ada31b982f50572d27103df8ceb8013c", - "signature": "0a6282c8827e4b9a95f4bf4f5c205673ada31b982f50572d27103df8ceb8013c", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "0a6282c8827e4b9a95f4bf4f5c205673ada31b982f50572d27103df8ceb8013c", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.esnext.array.d.ts", - "version": "1c9319a09485199c1f7b0498f2988d6d2249793ef67edda49d1e584746be9032", - "signature": "1c9319a09485199c1f7b0498f2988d6d2249793ef67edda49d1e584746be9032", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "1c9319a09485199c1f7b0498f2988d6d2249793ef67edda49d1e584746be9032", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.esnext.collection.d.ts", - "version": "e3a2a0cee0f03ffdde24d89660eba2685bfbdeae955a6c67e8c4c9fd28928eeb", - "signature": "e3a2a0cee0f03ffdde24d89660eba2685bfbdeae955a6c67e8c4c9fd28928eeb", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "e3a2a0cee0f03ffdde24d89660eba2685bfbdeae955a6c67e8c4c9fd28928eeb", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.esnext.intl.d.ts", - "version": "811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4", - "signature": "811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.esnext.disposable.d.ts", - "version": "51ad4c928303041605b4d7ae32e0c1ee387d43a24cd6f1ebf4a2699e1076d4fa", - "signature": "51ad4c928303041605b4d7ae32e0c1ee387d43a24cd6f1ebf4a2699e1076d4fa", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "51ad4c928303041605b4d7ae32e0c1ee387d43a24cd6f1ebf4a2699e1076d4fa", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.esnext.promise.d.ts", - "version": "60037901da1a425516449b9a20073aa03386cce92f7a1fd902d7602be3a7c2e9", - "signature": "60037901da1a425516449b9a20073aa03386cce92f7a1fd902d7602be3a7c2e9", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "60037901da1a425516449b9a20073aa03386cce92f7a1fd902d7602be3a7c2e9", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.esnext.decorators.d.ts", - "version": "d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f", - "signature": "d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.esnext.iterator.d.ts", - "version": "22adec94ef7047a6c9d1af3cb96be87a335908bf9ef386ae9fd50eeb37f44c47", - "signature": "22adec94ef7047a6c9d1af3cb96be87a335908bf9ef386ae9fd50eeb37f44c47", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "22adec94ef7047a6c9d1af3cb96be87a335908bf9ef386ae9fd50eeb37f44c47", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.esnext.float16.d.ts", - "version": "4245fee526a7d1754529d19227ecbf3be066ff79ebb6a380d78e41648f2f224d", - "signature": "4245fee526a7d1754529d19227ecbf3be066ff79ebb6a380d78e41648f2f224d", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "4245fee526a7d1754529d19227ecbf3be066ff79ebb6a380d78e41648f2f224d", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.decorators.d.ts", - "version": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", - "signature": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.decorators.legacy.d.ts", - "version": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", - "signature": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.esnext.full.d.ts", - "version": "bde31fd423cd93b0eff97197a3f66df7c93e8c0c335cbeb113b7ff1ac35c23f4", - "signature": "bde31fd423cd93b0eff97197a3f66df7c93e8c0c335cbeb113b7ff1ac35c23f4", - "impliedNodeFormat": "CommonJS" - }, { "fileName": "../compiler/parser.d.ts", "version": "2e29cd9a98755c46896f7a2d56524db2d6d96b248e36db46de14c30bf47c8d05", @@ -1118,11 +133,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); ] }, "latestChangedDtsFile": "./services.d.ts", - "size": 13963 + "size": 748 } -//// [/home/src/workspaces/solution/src/compiler/parser.ts] no change -//// [/home/src/workspaces/solution/src/compiler/tsconfig.json] no change -//// [/home/src/workspaces/solution/src/services/services.ts] no change -//// [/home/src/workspaces/solution/src/services/tsconfig.json] no change -//// [/home/src/workspaces/solution/src/tsconfig-base.json] no change diff --git a/testdata/baselines/reference/tsc/projectReferences/when-project-contains-invalid-project-reference.js b/testdata/baselines/reference/tsc/projectReferences/when-project-contains-invalid-project-reference.js index 6e080dcb55..d3eda70ecd 100644 --- a/testdata/baselines/reference/tsc/projectReferences/when-project-contains-invalid-project-reference.js +++ b/testdata/baselines/reference/tsc/projectReferences/when-project-contains-invalid-project-reference.js @@ -2,9 +2,9 @@ currentDirectory::/home/src/workspaces/solution useCaseSensitiveFileNames::true Input::--p project -//// [/home/src/workspaces/solution/project/index.ts] new file +//// [/home/src/workspaces/solution/project/index.ts] *new* export const x = 10; -//// [/home/src/workspaces/solution/project/tsconfig.json] new file +//// [/home/src/workspaces/solution/project/tsconfig.json] *new* { "references": [ { "path": "../utils" }, @@ -17,12 +17,33 @@ CompilerOptions::{ "project": "/home/src/workspaces/solution/project" } Output:: -//// [/home/src/workspaces/solution/project/index.js] new file +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; +//// [/home/src/workspaces/solution/project/index.js] *new* "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.x = void 0; exports.x = 10; -//// [/home/src/workspaces/solution/project/index.ts] no change -//// [/home/src/workspaces/solution/project/tsconfig.json] no change diff --git a/testdata/baselines/reference/tsc/projectReferences/when-project-reference-is-not-built.js b/testdata/baselines/reference/tsc/projectReferences/when-project-reference-is-not-built.js index 193090cc44..76409223ff 100644 --- a/testdata/baselines/reference/tsc/projectReferences/when-project-reference-is-not-built.js +++ b/testdata/baselines/reference/tsc/projectReferences/when-project-reference-is-not-built.js @@ -2,17 +2,17 @@ currentDirectory::/home/src/workspaces/solution useCaseSensitiveFileNames::true Input::--p project -//// [/home/src/workspaces/solution/project/index.ts] new file +//// [/home/src/workspaces/solution/project/index.ts] *new* import { x } from "../utils"; -//// [/home/src/workspaces/solution/project/tsconfig.json] new file +//// [/home/src/workspaces/solution/project/tsconfig.json] *new* { "references": [ { "path": "../utils" }, ], } -//// [/home/src/workspaces/solution/utils/index.ts] new file +//// [/home/src/workspaces/solution/utils/index.ts] *new* export const x = 10; -//// [/home/src/workspaces/solution/utils/tsconfig.json] new file +//// [/home/src/workspaces/solution/utils/tsconfig.json] *new* { "compilerOptions": { "composite": true, @@ -33,12 +33,31 @@ Output:: Found 1 error in project/index.ts:1 -//// [/home/src/workspaces/solution/project/index.js] new file +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; +//// [/home/src/workspaces/solution/project/index.js] *new* "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -//// [/home/src/workspaces/solution/project/index.ts] no change -//// [/home/src/workspaces/solution/project/tsconfig.json] no change -//// [/home/src/workspaces/solution/utils/index.ts] no change -//// [/home/src/workspaces/solution/utils/tsconfig.json] no change diff --git a/testdata/baselines/reference/tsc/projectReferences/when-project-references-composite-project-with-noEmit.js b/testdata/baselines/reference/tsc/projectReferences/when-project-references-composite-project-with-noEmit.js index efb89c0c40..6aa9f67689 100644 --- a/testdata/baselines/reference/tsc/projectReferences/when-project-references-composite-project-with-noEmit.js +++ b/testdata/baselines/reference/tsc/projectReferences/when-project-references-composite-project-with-noEmit.js @@ -2,17 +2,17 @@ currentDirectory::/home/src/workspaces/solution useCaseSensitiveFileNames::true Input::--p project -//// [/home/src/workspaces/solution/project/index.ts] new file +//// [/home/src/workspaces/solution/project/index.ts] *new* import { x } from "../utils"; -//// [/home/src/workspaces/solution/project/tsconfig.json] new file +//// [/home/src/workspaces/solution/project/tsconfig.json] *new* { "references": [ { "path": "../utils" }, ], } -//// [/home/src/workspaces/solution/utils/index.ts] new file +//// [/home/src/workspaces/solution/utils/index.ts] *new* export const x = 10; -//// [/home/src/workspaces/solution/utils/tsconfig.json] new file +//// [/home/src/workspaces/solution/utils/tsconfig.json] *new* { "compilerOptions": { "composite": true, @@ -34,12 +34,31 @@ Output:: Found 1 error in project/index.ts:1 -//// [/home/src/workspaces/solution/project/index.js] new file +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; +//// [/home/src/workspaces/solution/project/index.js] *new* "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -//// [/home/src/workspaces/solution/project/index.ts] no change -//// [/home/src/workspaces/solution/project/tsconfig.json] no change -//// [/home/src/workspaces/solution/utils/index.ts] no change -//// [/home/src/workspaces/solution/utils/tsconfig.json] no change diff --git a/testdata/baselines/reference/tsc/projectReferences/when-project-references-composite.js b/testdata/baselines/reference/tsc/projectReferences/when-project-references-composite.js index d0d15de884..33ca14b272 100644 --- a/testdata/baselines/reference/tsc/projectReferences/when-project-references-composite.js +++ b/testdata/baselines/reference/tsc/projectReferences/when-project-references-composite.js @@ -2,19 +2,19 @@ currentDirectory::/home/src/workspaces/solution useCaseSensitiveFileNames::true Input::--p project -//// [/home/src/workspaces/solution/project/index.ts] new file +//// [/home/src/workspaces/solution/project/index.ts] *new* import { x } from "../utils"; -//// [/home/src/workspaces/solution/project/tsconfig.json] new file +//// [/home/src/workspaces/solution/project/tsconfig.json] *new* { "references": [ { "path": "../utils" }, ], } -//// [/home/src/workspaces/solution/utils/index.d.ts] new file +//// [/home/src/workspaces/solution/utils/index.d.ts] *new* export declare const x = 10; -//// [/home/src/workspaces/solution/utils/index.ts] new file +//// [/home/src/workspaces/solution/utils/index.ts] *new* export const x = 10; -//// [/home/src/workspaces/solution/utils/tsconfig.json] new file +//// [/home/src/workspaces/solution/utils/tsconfig.json] *new* { "compilerOptions": { "composite": true, @@ -27,13 +27,31 @@ CompilerOptions::{ "project": "/home/src/workspaces/solution/project" } Output:: -//// [/home/src/workspaces/solution/project/index.js] new file +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; +//// [/home/src/workspaces/solution/project/index.js] *new* "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -//// [/home/src/workspaces/solution/project/index.ts] no change -//// [/home/src/workspaces/solution/project/tsconfig.json] no change -//// [/home/src/workspaces/solution/utils/index.d.ts] no change -//// [/home/src/workspaces/solution/utils/index.ts] no change -//// [/home/src/workspaces/solution/utils/tsconfig.json] no change diff --git a/testdata/baselines/reference/tsc/typeAcquisition/parse-tsconfig-with-typeAcquisition.js b/testdata/baselines/reference/tsc/typeAcquisition/parse-tsconfig-with-typeAcquisition.js index 96afc5dd09..afa79a4670 100644 --- a/testdata/baselines/reference/tsc/typeAcquisition/parse-tsconfig-with-typeAcquisition.js +++ b/testdata/baselines/reference/tsc/typeAcquisition/parse-tsconfig-with-typeAcquisition.js @@ -2,7 +2,7 @@ currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true Input:: -//// [/home/src/workspaces/project/tsconfig.json] new file +//// [/home/src/workspaces/project/tsconfig.json] *new* { "compilerOptions": { "composite": true, @@ -24,96 +24,46 @@ Output:: Found 1 error. -//// [/home/src/workspaces/project/tsconfig.json] no change -//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] new file -{"version":"FakeTSVersion","fileNames":["bundled:///libs/lib.d.ts","bundled:///libs/lib.es5.d.ts","bundled:///libs/lib.dom.d.ts","bundled:///libs/lib.webworker.importscripts.d.ts","bundled:///libs/lib.scripthost.d.ts","bundled:///libs/lib.decorators.d.ts","bundled:///libs/lib.decorators.legacy.d.ts"],"fileInfos":["a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa",{"version":"69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedNodeFormat":1}],"options":{"composite":true},"semanticDiagnosticsPerFile":[1,2,3,4,5,6,7]} -//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] new file +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *new* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1}],"options":{"composite":true},"semanticDiagnosticsPerFile":[1]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", "fileNames": [ - "bundled:///libs/lib.d.ts", - "bundled:///libs/lib.es5.d.ts", - "bundled:///libs/lib.dom.d.ts", - "bundled:///libs/lib.webworker.importscripts.d.ts", - "bundled:///libs/lib.scripthost.d.ts", - "bundled:///libs/lib.decorators.d.ts", - "bundled:///libs/lib.decorators.legacy.d.ts" + "../../tslibs/TS/Lib/lib.d.ts" ], "fileInfos": [ { - "fileName": "bundled:///libs/lib.d.ts", - "version": "a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa", - "signature": "a7297ff837fcdf174a9524925966429eb8e5feecc2cc55cc06574e6b092c1eaa", - "impliedNodeFormat": "CommonJS" - }, - { - "fileName": "bundled:///libs/lib.es5.d.ts", - "version": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", - "signature": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "69684132aeb9b5642cbcd9e22dff7818ff0ee1aa831728af0ecf97d3364d5546", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.dom.d.ts", - "version": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", - "signature": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "092c2bfe125ce69dbb1223c85d68d4d2397d7d8411867b5cc03cec902c233763", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.webworker.importscripts.d.ts", - "version": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", - "signature": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.scripthost.d.ts", - "version": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", - "signature": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.decorators.d.ts", - "version": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", - "signature": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "bundled:///libs/lib.decorators.legacy.d.ts", - "version": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", - "signature": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", "affectsGlobalScope": true, "impliedNodeFormat": "CommonJS", "original": { - "version": "782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", "affectsGlobalScope": true, "impliedNodeFormat": 1 } @@ -123,14 +73,8 @@ Found 1 error. "composite": true }, "semanticDiagnosticsPerFile": [ - "bundled:///libs/lib.d.ts", - "bundled:///libs/lib.es5.d.ts", - "bundled:///libs/lib.dom.d.ts", - "bundled:///libs/lib.webworker.importscripts.d.ts", - "bundled:///libs/lib.scripthost.d.ts", - "bundled:///libs/lib.decorators.d.ts", - "bundled:///libs/lib.decorators.legacy.d.ts" + "../../tslibs/TS/Lib/lib.d.ts" ], - "size": 1219 + "size": 275 } diff --git a/testdata/baselines/reference/tscWatch/commandLineWatch/watch-with-no-tsconfig.js b/testdata/baselines/reference/tscWatch/commandLineWatch/watch-with-no-tsconfig.js index 4e81e06b4e..4983b19b24 100644 --- a/testdata/baselines/reference/tscWatch/commandLineWatch/watch-with-no-tsconfig.js +++ b/testdata/baselines/reference/tscWatch/commandLineWatch/watch-with-no-tsconfig.js @@ -2,7 +2,7 @@ currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true Input::index.ts --watch -//// [/home/src/workspaces/project/index.ts] new file +//// [/home/src/workspaces/project/index.ts] *new* @@ -13,7 +13,29 @@ CompilerOptions::{ Output:: -No output -//// [/home/src/workspaces/project/index.ts] new file +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; +//// [/home/src/workspaces/project/index.js] *new* diff --git a/testdata/baselines/reference/tscWatch/noEmit/dts-errors-without-dts-enabled.js b/testdata/baselines/reference/tscWatch/noEmit/dts-errors-without-dts-enabled.js index dcc0038209..3fd490264c 100644 --- a/testdata/baselines/reference/tscWatch/noEmit/dts-errors-without-dts-enabled.js +++ b/testdata/baselines/reference/tscWatch/noEmit/dts-errors-without-dts-enabled.js @@ -2,9 +2,9 @@ currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true Input::-w -//// [/home/src/workspaces/project/a.ts] new file +//// [/home/src/workspaces/project/a.ts] *new* const a = class { private p = 10; }; -//// [/home/src/workspaces/project/tsconfig.json] new file +//// [/home/src/workspaces/project/tsconfig.json] *new* { "compilerOptions": { "noEmit": true @@ -19,89 +19,101 @@ CompilerOptions::{ Output:: -//// [/home/src/workspaces/project/a.ts] no change -//// [/home/src/workspaces/project/tsconfig.json] no change +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; Edit:: fix syntax error Output:: -//// [/home/src/workspaces/project/a.ts] modified. new content: -const a = "hello"; -//// [/home/src/workspaces/project/tsconfig.json] no change +//// [/home/src/workspaces/project/a.ts] *modified* +&{const a = "hello"; 0xc001650540} Edit:: emit after fixing error Output:: -//// [/home/src/workspaces/project/a.js] new file +//// [/home/src/workspaces/project/a.js] *new* const a = "hello"; -//// [/home/src/workspaces/project/a.ts] no change -//// [/home/src/workspaces/project/tsconfig.json] modified. new content: -{ +//// [/home/src/workspaces/project/tsconfig.json] *modified* +&{{ "compilerOptions": { } -} +} 0xc00132e7b0} Edit:: no emit run after fixing error Output:: -//// [/home/src/workspaces/project/a.js] no change -//// [/home/src/workspaces/project/a.ts] no change -//// [/home/src/workspaces/project/tsconfig.json] modified. new content: -{ +//// [/home/src/workspaces/project/tsconfig.json] *modified* +&{{ "compilerOptions": { "noEmit": true, } -} +} 0xc0005670b0} Edit:: introduce error Output:: -//// [/home/src/workspaces/project/a.js] no change -//// [/home/src/workspaces/project/a.ts] modified. new content: -const a = class { private p = 10; }; -//// [/home/src/workspaces/project/tsconfig.json] no change +//// [/home/src/workspaces/project/a.ts] *modified* +&{const a = class { private p = 10; }; 0xc0010f0f00} Edit:: emit when error Output:: -//// [/home/src/workspaces/project/a.js] modified. new content: -const a = class { +//// [/home/src/workspaces/project/a.js] *modified* +&{const a = class { p = 10; }; - -//// [/home/src/workspaces/project/a.ts] no change -//// [/home/src/workspaces/project/tsconfig.json] modified. new content: -{ + 0xc000a67bc0} +//// [/home/src/workspaces/project/tsconfig.json] *modified* +&{{ "compilerOptions": { } -} +} 0xc000a67c20} Edit:: no emit run when error Output:: -//// [/home/src/workspaces/project/a.js] no change -//// [/home/src/workspaces/project/a.ts] no change -//// [/home/src/workspaces/project/tsconfig.json] modified. new content: -{ +//// [/home/src/workspaces/project/tsconfig.json] *modified* +&{{ "compilerOptions": { "noEmit": true, } -} +} 0xc000df9a70} diff --git a/testdata/baselines/reference/tscWatch/noEmit/dts-errors.js b/testdata/baselines/reference/tscWatch/noEmit/dts-errors.js index 004a0035e6..3d97e8cf20 100644 --- a/testdata/baselines/reference/tscWatch/noEmit/dts-errors.js +++ b/testdata/baselines/reference/tscWatch/noEmit/dts-errors.js @@ -2,9 +2,9 @@ currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true Input::-w -//// [/home/src/workspaces/project/a.ts] new file +//// [/home/src/workspaces/project/a.ts] *new* const a = class { private p = 10; }; -//// [/home/src/workspaces/project/tsconfig.json] new file +//// [/home/src/workspaces/project/tsconfig.json] *new* { "compilerOptions": { "noEmit": true, @@ -32,52 +32,68 @@ Output:: Found 1 error in a.ts:1 -//// [/home/src/workspaces/project/a.ts] no change -//// [/home/src/workspaces/project/tsconfig.json] no change +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; Edit:: fix syntax error Output:: -//// [/home/src/workspaces/project/a.ts] modified. new content: -const a = "hello"; -//// [/home/src/workspaces/project/tsconfig.json] no change +//// [/home/src/workspaces/project/a.ts] *modified* +&{const a = "hello"; 0xc000e6cba0} Edit:: emit after fixing error Output:: -//// [/home/src/workspaces/project/a.d.ts] new file +//// [/home/src/workspaces/project/a.d.ts] *new* declare const a = "hello"; -//// [/home/src/workspaces/project/a.js] new file +//// [/home/src/workspaces/project/a.js] *new* const a = "hello"; -//// [/home/src/workspaces/project/a.ts] no change -//// [/home/src/workspaces/project/tsconfig.json] modified. new content: -{ +//// [/home/src/workspaces/project/tsconfig.json] *modified* +&{{ "compilerOptions": { "declaration": true } -} +} 0xc000f2c600} Edit:: no emit run after fixing error Output:: -//// [/home/src/workspaces/project/a.d.ts] no change -//// [/home/src/workspaces/project/a.js] no change -//// [/home/src/workspaces/project/a.ts] no change -//// [/home/src/workspaces/project/tsconfig.json] modified. new content: -{ +//// [/home/src/workspaces/project/tsconfig.json] *modified* +&{{ "compilerOptions": { "noEmit": true, "declaration": true } -} +} 0xc00070ed50} @@ -96,11 +112,8 @@ Output:: Found 1 error in a.ts:1 -//// [/home/src/workspaces/project/a.d.ts] no change -//// [/home/src/workspaces/project/a.js] no change -//// [/home/src/workspaces/project/a.ts] modified. new content: -const a = class { private p = 10; }; -//// [/home/src/workspaces/project/tsconfig.json] no change +//// [/home/src/workspaces/project/a.ts] *modified* +&{const a = class { private p = 10; }; 0xc0009e7d10} @@ -119,25 +132,24 @@ Output:: Found 1 error in a.ts:1 -//// [/home/src/workspaces/project/a.d.ts] modified. new content: -declare const a: { +//// [/home/src/workspaces/project/a.d.ts] *modified* +&{declare const a: { new (): { p: number; }; }; - -//// [/home/src/workspaces/project/a.js] modified. new content: -const a = class { + 0xc000811200} +//// [/home/src/workspaces/project/a.js] *modified* +&{const a = class { p = 10; }; - -//// [/home/src/workspaces/project/a.ts] no change -//// [/home/src/workspaces/project/tsconfig.json] modified. new content: -{ + 0xc000811230} +//// [/home/src/workspaces/project/tsconfig.json] *modified* +&{{ "compilerOptions": { "declaration": true } -} +} 0xc0008112f0} @@ -156,14 +168,11 @@ Output:: Found 1 error in a.ts:1 -//// [/home/src/workspaces/project/a.d.ts] no change -//// [/home/src/workspaces/project/a.js] no change -//// [/home/src/workspaces/project/a.ts] no change -//// [/home/src/workspaces/project/tsconfig.json] modified. new content: -{ +//// [/home/src/workspaces/project/tsconfig.json] *modified* +&{{ "compilerOptions": { "noEmit": true, "declaration": true } -} +} 0xc000ac69f0} diff --git a/testdata/baselines/reference/tscWatch/noEmit/semantic-errors.js b/testdata/baselines/reference/tscWatch/noEmit/semantic-errors.js index 639eec7776..a7439cf515 100644 --- a/testdata/baselines/reference/tscWatch/noEmit/semantic-errors.js +++ b/testdata/baselines/reference/tscWatch/noEmit/semantic-errors.js @@ -2,9 +2,9 @@ currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true Input::-w -//// [/home/src/workspaces/project/a.ts] new file +//// [/home/src/workspaces/project/a.ts] *new* const a: number = "hello" -//// [/home/src/workspaces/project/tsconfig.json] new file +//// [/home/src/workspaces/project/tsconfig.json] *new* { "compilerOptions": { "noEmit": true @@ -27,48 +27,65 @@ Output:: Found 1 error in a.ts:1 -//// [/home/src/workspaces/project/a.ts] no change -//// [/home/src/workspaces/project/tsconfig.json] no change +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; Edit:: fix syntax error Output:: -//// [/home/src/workspaces/project/a.ts] modified. new content: -const a = "hello"; -//// [/home/src/workspaces/project/tsconfig.json] no change +//// [/home/src/workspaces/project/a.ts] *modified* +&{const a = "hello"; 0xc001001350} Edit:: emit after fixing error Output:: -//// [/home/src/workspaces/project/a.js] new file +//// [/home/src/workspaces/project/a.js] *new* const a = "hello"; -//// [/home/src/workspaces/project/a.ts] no change -//// [/home/src/workspaces/project/tsconfig.json] modified. new content: -{ +//// [/home/src/workspaces/project/tsconfig.json] *modified* +&{{ "compilerOptions": { } -} +} 0xc0002f0990} Edit:: no emit run after fixing error Output:: -//// [/home/src/workspaces/project/a.js] no change -//// [/home/src/workspaces/project/a.ts] no change -//// [/home/src/workspaces/project/tsconfig.json] modified. new content: -{ +//// [/home/src/workspaces/project/tsconfig.json] *modified* +&{{ "compilerOptions": { "noEmit": true, } -} +} 0xc000f2ce40} @@ -83,10 +100,8 @@ Output:: Found 1 error in a.ts:1 -//// [/home/src/workspaces/project/a.js] no change -//// [/home/src/workspaces/project/a.ts] modified. new content: -const a: number = "hello" -//// [/home/src/workspaces/project/tsconfig.json] no change +//// [/home/src/workspaces/project/a.ts] *modified* +&{const a: number = "hello" 0xc00100bc80} @@ -101,14 +116,13 @@ Output:: Found 1 error in a.ts:1 -//// [/home/src/workspaces/project/a.js] no change -//// [/home/src/workspaces/project/a.ts] no change -//// [/home/src/workspaces/project/tsconfig.json] modified. new content: -{ +//// [/home/src/workspaces/project/a.js] *modified time* +//// [/home/src/workspaces/project/tsconfig.json] *modified* +&{{ "compilerOptions": { } -} +} 0xc000b51d40} @@ -123,13 +137,11 @@ Output:: Found 1 error in a.ts:1 -//// [/home/src/workspaces/project/a.js] no change -//// [/home/src/workspaces/project/a.ts] no change -//// [/home/src/workspaces/project/tsconfig.json] modified. new content: -{ +//// [/home/src/workspaces/project/tsconfig.json] *modified* +&{{ "compilerOptions": { "noEmit": true, } -} +} 0xc000ee2e70} diff --git a/testdata/baselines/reference/tscWatch/noEmit/syntax-errors.js b/testdata/baselines/reference/tscWatch/noEmit/syntax-errors.js index 060eb4571c..bddd33727b 100644 --- a/testdata/baselines/reference/tscWatch/noEmit/syntax-errors.js +++ b/testdata/baselines/reference/tscWatch/noEmit/syntax-errors.js @@ -2,9 +2,9 @@ currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true Input::-w -//// [/home/src/workspaces/project/a.ts] new file +//// [/home/src/workspaces/project/a.ts] *new* const a = "hello -//// [/home/src/workspaces/project/tsconfig.json] new file +//// [/home/src/workspaces/project/tsconfig.json] *new* { "compilerOptions": { "noEmit": true @@ -27,48 +27,65 @@ Output:: Found 1 error in a.ts:1 -//// [/home/src/workspaces/project/a.ts] no change -//// [/home/src/workspaces/project/tsconfig.json] no change +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; Edit:: fix syntax error Output:: -//// [/home/src/workspaces/project/a.ts] modified. new content: -const a = "hello"; -//// [/home/src/workspaces/project/tsconfig.json] no change +//// [/home/src/workspaces/project/a.ts] *modified* +&{const a = "hello"; 0xc000e43ef0} Edit:: emit after fixing error Output:: -//// [/home/src/workspaces/project/a.js] new file +//// [/home/src/workspaces/project/a.js] *new* const a = "hello"; -//// [/home/src/workspaces/project/a.ts] no change -//// [/home/src/workspaces/project/tsconfig.json] modified. new content: -{ +//// [/home/src/workspaces/project/tsconfig.json] *modified* +&{{ "compilerOptions": { } -} +} 0xc0001e8330} Edit:: no emit run after fixing error Output:: -//// [/home/src/workspaces/project/a.js] no change -//// [/home/src/workspaces/project/a.ts] no change -//// [/home/src/workspaces/project/tsconfig.json] modified. new content: -{ +//// [/home/src/workspaces/project/tsconfig.json] *modified* +&{{ "compilerOptions": { "noEmit": true, } -} +} 0xc0007ae300} @@ -83,10 +100,8 @@ Output:: Found 1 error in a.ts:1 -//// [/home/src/workspaces/project/a.js] no change -//// [/home/src/workspaces/project/a.ts] modified. new content: -const a = "hello -//// [/home/src/workspaces/project/tsconfig.json] no change +//// [/home/src/workspaces/project/a.ts] *modified* +&{const a = "hello 0xc000cd0db0} @@ -101,16 +116,15 @@ Output:: Found 1 error in a.ts:1 -//// [/home/src/workspaces/project/a.js] modified. new content: -const a = "hello; - -//// [/home/src/workspaces/project/a.ts] no change -//// [/home/src/workspaces/project/tsconfig.json] modified. new content: -{ +//// [/home/src/workspaces/project/a.js] *modified* +&{const a = "hello; + 0xc001665620} +//// [/home/src/workspaces/project/tsconfig.json] *modified* +&{{ "compilerOptions": { } -} +} 0xc001665680} @@ -125,13 +139,11 @@ Output:: Found 1 error in a.ts:1 -//// [/home/src/workspaces/project/a.js] no change -//// [/home/src/workspaces/project/a.ts] no change -//// [/home/src/workspaces/project/tsconfig.json] modified. new content: -{ +//// [/home/src/workspaces/project/tsconfig.json] *modified* +&{{ "compilerOptions": { "noEmit": true, } -} +} 0xc00133c870} From dca1bdbd5b42877294dbe3f4710a30fe263fd66e Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 1 Jul 2025 00:04:18 -0700 Subject: [PATCH 18/36] Fix race with latest dts file --- internal/collections/syncset.go | 10 ++ internal/execute/tscincremental_test.go | 14 +++ internal/incremental/emitfileshandler.go | 25 ++-- .../serializing-composite-project.js | 111 ++++++++++++++++++ 4 files changed, 149 insertions(+), 11 deletions(-) create mode 100644 testdata/baselines/reference/tsc/incremental/serializing-composite-project.js diff --git a/internal/collections/syncset.go b/internal/collections/syncset.go index 8f4f59dcb6..2bd37a2da0 100644 --- a/internal/collections/syncset.go +++ b/internal/collections/syncset.go @@ -22,3 +22,13 @@ func (s *SyncSet[T]) Range(fn func(key T) bool) { return fn(key) }) } + +func (s *SyncSet[T]) ToArray() []T { + var arr []T + arr = make([]T, 0, s.m.Size()) + s.m.Range(func(key T, value struct{}) bool { + arr = append(arr, key) + return true + }) + return arr +} diff --git a/internal/execute/tscincremental_test.go b/internal/execute/tscincremental_test.go index abcff9907a..facc10f319 100644 --- a/internal/execute/tscincremental_test.go +++ b/internal/execute/tscincremental_test.go @@ -34,6 +34,20 @@ func TestIncremental(t *testing.T) { )`, }, "/home/src/workspaces/project"), }, + { + subScenario: "serializing composite project", + sys: newTestSys(FileMap{ + "/home/src/workspaces/project/tsconfig.json": `{ + "compilerOptions": { + "composite": true, + "strict": true, + "module": "esnext", + }, + }`, + "/home/src/workspaces/project/index.tsx": `export const a = 1;`, + "/home/src/workspaces/project/other.ts": `export const b = 2;`, + }, "/home/src/workspaces/project"), + }, { subScenario: "change to modifier of class expression field with declaration emit enabled", sys: newTestSys(FileMap{ diff --git a/internal/incremental/emitfileshandler.go b/internal/incremental/emitfileshandler.go index 4e56c214ab..ecde475eef 100644 --- a/internal/incremental/emitfileshandler.go +++ b/internal/incremental/emitfileshandler.go @@ -2,6 +2,7 @@ package incremental import ( "context" + "slices" "github.com/microsoft/typescript-go/internal/ast" "github.com/microsoft/typescript-go/internal/collections" @@ -16,14 +17,14 @@ type emitUpdate struct { } type emitFilesHandler struct { - ctx context.Context - program *Program - isForDtsErrors bool - signatures collections.SyncMap[tspath.Path, string] - emitSignatures collections.SyncMap[tspath.Path, *emitSignature] - latestChangedDtsFile string - deletedPendingKinds collections.Set[tspath.Path] - emitUpdates collections.SyncMap[tspath.Path, *emitUpdate] + ctx context.Context + program *Program + isForDtsErrors bool + signatures collections.SyncMap[tspath.Path, string] + emitSignatures collections.SyncMap[tspath.Path, *emitSignature] + latestChangedDtsFiles collections.SyncSet[string] + deletedPendingKinds collections.Set[tspath.Path] + emitUpdates collections.SyncMap[tspath.Path, *emitUpdate] } // Determining what all is pending to be emitted based on previous options or previous file emit flags @@ -206,7 +207,7 @@ func (h *emitFilesHandler) skipDtsOutputOfComposite(file *ast.SourceFile, output data.DiffersOnlyInMap = true } } else { - h.latestChangedDtsFile = outputFileName + h.latestChangedDtsFiles.Add(outputFileName) } h.emitSignatures.Store(file.Path(), &emitSignature{signature: newSignature}) return false @@ -227,8 +228,10 @@ func (h *emitFilesHandler) updateSnapshot() []*compiler.EmitResult { h.program.snapshot.buildInfoEmitPending = true return true }) - if h.latestChangedDtsFile != "" { - h.program.snapshot.latestChangedDtsFile = h.latestChangedDtsFile + latestChangedDtsFiles := h.latestChangedDtsFiles.ToArray() + slices.Sort(latestChangedDtsFiles) + if latestChangedDtsFile := core.LastOrNil(latestChangedDtsFiles); latestChangedDtsFile != "" { + h.program.snapshot.latestChangedDtsFile = latestChangedDtsFile h.program.snapshot.buildInfoEmitPending = true } for file := range h.deletedPendingKinds.Keys() { diff --git a/testdata/baselines/reference/tsc/incremental/serializing-composite-project.js b/testdata/baselines/reference/tsc/incremental/serializing-composite-project.js new file mode 100644 index 0000000000..27b2eef10c --- /dev/null +++ b/testdata/baselines/reference/tsc/incremental/serializing-composite-project.js @@ -0,0 +1,111 @@ + +currentDirectory::/home/src/workspaces/project +useCaseSensitiveFileNames::true +Input:: +//// [/home/src/workspaces/project/index.tsx] *new* +export const a = 1; +//// [/home/src/workspaces/project/other.ts] *new* +export const b = 2; +//// [/home/src/workspaces/project/tsconfig.json] *new* +{ + "compilerOptions": { + "composite": true, + "strict": true, + "module": "esnext", + }, + } + +ExitStatus:: 0 + +CompilerOptions::{} +Output:: +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; +//// [/home/src/workspaces/project/index.d.ts] *new* +export declare const a = 1; + +//// [/home/src/workspaces/project/index.js] *new* +export const a = 1; + +//// [/home/src/workspaces/project/other.d.ts] *new* +export declare const b = 2; + +//// [/home/src/workspaces/project/other.js] *new* +export const b = 2; + +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *new* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./index.tsx","./other.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"683314ed22112e8dea8095c8c6173afa2c61279f5fe07968ebe0e21fff16871d","signature":"f0f1286d442f3c09fa07d37db7d31755cb3761daed3c8008fbfce412770425c6","impliedNodeFormat":1},{"version":"34f0f66ce649a0df0d3d5bad537c3b867b11b2fbeb5eee37e1c75a795544a4ed","signature":"0fb7bb75ad82d403bd7ba1f151c0297ef6a9167d0039e90a9067289387a719a7","impliedNodeFormat":1}],"options":{"composite":true,"module":99,"strict":true},"latestChangedDtsFile":"./other.d.ts"} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *new* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./index.tsx", + "./other.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./index.tsx", + "version": "683314ed22112e8dea8095c8c6173afa2c61279f5fe07968ebe0e21fff16871d", + "signature": "f0f1286d442f3c09fa07d37db7d31755cb3761daed3c8008fbfce412770425c6", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "683314ed22112e8dea8095c8c6173afa2c61279f5fe07968ebe0e21fff16871d", + "signature": "f0f1286d442f3c09fa07d37db7d31755cb3761daed3c8008fbfce412770425c6", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./other.ts", + "version": "34f0f66ce649a0df0d3d5bad537c3b867b11b2fbeb5eee37e1c75a795544a4ed", + "signature": "0fb7bb75ad82d403bd7ba1f151c0297ef6a9167d0039e90a9067289387a719a7", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "34f0f66ce649a0df0d3d5bad537c3b867b11b2fbeb5eee37e1c75a795544a4ed", + "signature": "0fb7bb75ad82d403bd7ba1f151c0297ef6a9167d0039e90a9067289387a719a7", + "impliedNodeFormat": 1 + } + } + ], + "options": { + "composite": true, + "module": 99, + "strict": true + }, + "latestChangedDtsFile": "./other.d.ts", + "size": 693 +} + From b68178576c05f375b6843b0a723c95eee017d387 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 1 Jul 2025 00:20:29 -0700 Subject: [PATCH 19/36] Fix more tests --- internal/execute/testsys_test.go | 2 +- internal/execute/tsc_test.go | 7 ----- internal/execute/verifytsc_nocheck_test.go | 7 ----- internal/execute/verifytscwatch_test.go | 6 ---- .../noEmit/dts-errors-without-dts-enabled.js | 24 ++++++++-------- .../reference/tscWatch/noEmit/dts-errors.js | 28 +++++++++---------- .../tscWatch/noEmit/semantic-errors.js | 20 ++++++------- .../tscWatch/noEmit/syntax-errors.js | 24 ++++++++-------- 8 files changed, 49 insertions(+), 69 deletions(-) diff --git a/internal/execute/testsys_test.go b/internal/execute/testsys_test.go index 2c7c89d512..17bf78b6f9 100644 --- a/internal/execute/testsys_test.go +++ b/internal/execute/testsys_test.go @@ -233,7 +233,7 @@ func (s *testSys) reportFSEntryDiff(baseline io.Writer, newDirContent *diffEntry } else if newDirContent == nil { fmt.Fprint(baseline, "//// [", path, "] *deleted*\n") } else if newDirContent.content != oldDirContent.content { - fmt.Fprint(baseline, "//// [", path, "] *modified* \n", newDirContent, "\n") + fmt.Fprint(baseline, "//// [", path, "] *modified* \n", newDirContent.content, "\n") } else if newDirContent.fileInfo.ModTime() != oldDirContent.fileInfo.ModTime() { fmt.Fprint(baseline, "//// [", path, "] *modified time*\n") } else if defaultLibs != nil && defaultLibs.Has(path) && s.fs.defaultLibs != nil && !s.fs.defaultLibs.Has(path) { diff --git a/internal/execute/tsc_test.go b/internal/execute/tsc_test.go index 1c8f0acbc4..4b94485807 100644 --- a/internal/execute/tsc_test.go +++ b/internal/execute/tsc_test.go @@ -2,8 +2,6 @@ package execute_test import ( "testing" - - "github.com/microsoft/typescript-go/internal/bundled" ) func TestTsc(t *testing.T) { @@ -206,11 +204,6 @@ func TestExtends(t *testing.T) { func TestTypeAcquisition(t *testing.T) { t.Parallel() - if !bundled.Embedded { - // Without embedding, we'd need to read all of the lib files out from disk into the MapFS. - // Just skip this for now. - t.Skip("bundled files are not embedded") - } (&tscInput{ subScenario: "parse tsconfig with typeAcquisition", sys: newTestSys(FileMap{"/home/src/workspaces/project/tsconfig.json": `{ diff --git a/internal/execute/verifytsc_nocheck_test.go b/internal/execute/verifytsc_nocheck_test.go index d944eca140..c8b5051d0a 100644 --- a/internal/execute/verifytsc_nocheck_test.go +++ b/internal/execute/verifytsc_nocheck_test.go @@ -2,8 +2,6 @@ package execute_test import ( "testing" - - "github.com/microsoft/typescript-go/internal/bundled" ) type noCheckScenario struct { @@ -13,11 +11,6 @@ type noCheckScenario struct { func TestNoCheck(t *testing.T) { t.Parallel() - if !bundled.Embedded { - // Without embedding, we'd need to read all of the lib files out from disk into the MapFS. - // Just skip this for now. - t.Skip("bundled files are not embedded") - } cases := []noCheckScenario{ {"syntax errors", `export const a = "hello`}, {"semantic errors", `export const a: number = "hello";`}, diff --git a/internal/execute/verifytscwatch_test.go b/internal/execute/verifytscwatch_test.go index b14de36c89..c34a626028 100644 --- a/internal/execute/verifytscwatch_test.go +++ b/internal/execute/verifytscwatch_test.go @@ -5,7 +5,6 @@ import ( "strings" "testing" - "github.com/microsoft/typescript-go/internal/bundled" "github.com/microsoft/typescript-go/internal/execute" "github.com/microsoft/typescript-go/internal/testutil/baseline" ) @@ -117,11 +116,6 @@ func newTscEdit(name string, edit func(sys execute.System)) *testTscEdit { func TestTscNoEmitWatch(t *testing.T) { t.Parallel() - if !bundled.Embedded { - // Without embedding, we'd need to read all of the lib files out from disk into the MapFS. - // Just skip this for now. - t.Skip("bundled files are not embedded") - } testCases := []*tscInput{ noEmitWatchTestInput("syntax errors", diff --git a/testdata/baselines/reference/tscWatch/noEmit/dts-errors-without-dts-enabled.js b/testdata/baselines/reference/tscWatch/noEmit/dts-errors-without-dts-enabled.js index 3fd490264c..f85a1b6fd1 100644 --- a/testdata/baselines/reference/tscWatch/noEmit/dts-errors-without-dts-enabled.js +++ b/testdata/baselines/reference/tscWatch/noEmit/dts-errors-without-dts-enabled.js @@ -49,7 +49,7 @@ Edit:: fix syntax error Output:: //// [/home/src/workspaces/project/a.ts] *modified* -&{const a = "hello"; 0xc001650540} +const a = "hello"; @@ -60,11 +60,11 @@ Output:: const a = "hello"; //// [/home/src/workspaces/project/tsconfig.json] *modified* -&{{ +{ "compilerOptions": { } -} 0xc00132e7b0} +} @@ -72,12 +72,12 @@ Edit:: no emit run after fixing error Output:: //// [/home/src/workspaces/project/tsconfig.json] *modified* -&{{ +{ "compilerOptions": { "noEmit": true, } -} 0xc0005670b0} +} @@ -85,7 +85,7 @@ Edit:: introduce error Output:: //// [/home/src/workspaces/project/a.ts] *modified* -&{const a = class { private p = 10; }; 0xc0010f0f00} +const a = class { private p = 10; }; @@ -93,16 +93,16 @@ Edit:: emit when error Output:: //// [/home/src/workspaces/project/a.js] *modified* -&{const a = class { +const a = class { p = 10; }; - 0xc000a67bc0} + //// [/home/src/workspaces/project/tsconfig.json] *modified* -&{{ +{ "compilerOptions": { } -} 0xc000a67c20} +} @@ -110,10 +110,10 @@ Edit:: no emit run when error Output:: //// [/home/src/workspaces/project/tsconfig.json] *modified* -&{{ +{ "compilerOptions": { "noEmit": true, } -} 0xc000df9a70} +} diff --git a/testdata/baselines/reference/tscWatch/noEmit/dts-errors.js b/testdata/baselines/reference/tscWatch/noEmit/dts-errors.js index 3d97e8cf20..c52082c98c 100644 --- a/testdata/baselines/reference/tscWatch/noEmit/dts-errors.js +++ b/testdata/baselines/reference/tscWatch/noEmit/dts-errors.js @@ -62,7 +62,7 @@ Edit:: fix syntax error Output:: //// [/home/src/workspaces/project/a.ts] *modified* -&{const a = "hello"; 0xc000e6cba0} +const a = "hello"; @@ -76,11 +76,11 @@ declare const a = "hello"; const a = "hello"; //// [/home/src/workspaces/project/tsconfig.json] *modified* -&{{ +{ "compilerOptions": { "declaration": true } -} 0xc000f2c600} +} @@ -88,12 +88,12 @@ Edit:: no emit run after fixing error Output:: //// [/home/src/workspaces/project/tsconfig.json] *modified* -&{{ +{ "compilerOptions": { "noEmit": true, "declaration": true } -} 0xc00070ed50} +} @@ -113,7 +113,7 @@ Output:: Found 1 error in a.ts:1 //// [/home/src/workspaces/project/a.ts] *modified* -&{const a = class { private p = 10; }; 0xc0009e7d10} +const a = class { private p = 10; }; @@ -133,23 +133,23 @@ Output:: Found 1 error in a.ts:1 //// [/home/src/workspaces/project/a.d.ts] *modified* -&{declare const a: { +declare const a: { new (): { p: number; }; }; - 0xc000811200} + //// [/home/src/workspaces/project/a.js] *modified* -&{const a = class { +const a = class { p = 10; }; - 0xc000811230} + //// [/home/src/workspaces/project/tsconfig.json] *modified* -&{{ +{ "compilerOptions": { "declaration": true } -} 0xc0008112f0} +} @@ -169,10 +169,10 @@ Output:: Found 1 error in a.ts:1 //// [/home/src/workspaces/project/tsconfig.json] *modified* -&{{ +{ "compilerOptions": { "noEmit": true, "declaration": true } -} 0xc000ac69f0} +} diff --git a/testdata/baselines/reference/tscWatch/noEmit/semantic-errors.js b/testdata/baselines/reference/tscWatch/noEmit/semantic-errors.js index a7439cf515..5a0d14c488 100644 --- a/testdata/baselines/reference/tscWatch/noEmit/semantic-errors.js +++ b/testdata/baselines/reference/tscWatch/noEmit/semantic-errors.js @@ -57,7 +57,7 @@ Edit:: fix syntax error Output:: //// [/home/src/workspaces/project/a.ts] *modified* -&{const a = "hello"; 0xc001001350} +const a = "hello"; @@ -68,11 +68,11 @@ Output:: const a = "hello"; //// [/home/src/workspaces/project/tsconfig.json] *modified* -&{{ +{ "compilerOptions": { } -} 0xc0002f0990} +} @@ -80,12 +80,12 @@ Edit:: no emit run after fixing error Output:: //// [/home/src/workspaces/project/tsconfig.json] *modified* -&{{ +{ "compilerOptions": { "noEmit": true, } -} 0xc000f2ce40} +} @@ -101,7 +101,7 @@ Output:: Found 1 error in a.ts:1 //// [/home/src/workspaces/project/a.ts] *modified* -&{const a: number = "hello" 0xc00100bc80} +const a: number = "hello" @@ -118,11 +118,11 @@ Found 1 error in a.ts:1 //// [/home/src/workspaces/project/a.js] *modified time* //// [/home/src/workspaces/project/tsconfig.json] *modified* -&{{ +{ "compilerOptions": { } -} 0xc000b51d40} +} @@ -138,10 +138,10 @@ Output:: Found 1 error in a.ts:1 //// [/home/src/workspaces/project/tsconfig.json] *modified* -&{{ +{ "compilerOptions": { "noEmit": true, } -} 0xc000ee2e70} +} diff --git a/testdata/baselines/reference/tscWatch/noEmit/syntax-errors.js b/testdata/baselines/reference/tscWatch/noEmit/syntax-errors.js index bddd33727b..8b386db9fa 100644 --- a/testdata/baselines/reference/tscWatch/noEmit/syntax-errors.js +++ b/testdata/baselines/reference/tscWatch/noEmit/syntax-errors.js @@ -57,7 +57,7 @@ Edit:: fix syntax error Output:: //// [/home/src/workspaces/project/a.ts] *modified* -&{const a = "hello"; 0xc000e43ef0} +const a = "hello"; @@ -68,11 +68,11 @@ Output:: const a = "hello"; //// [/home/src/workspaces/project/tsconfig.json] *modified* -&{{ +{ "compilerOptions": { } -} 0xc0001e8330} +} @@ -80,12 +80,12 @@ Edit:: no emit run after fixing error Output:: //// [/home/src/workspaces/project/tsconfig.json] *modified* -&{{ +{ "compilerOptions": { "noEmit": true, } -} 0xc0007ae300} +} @@ -101,7 +101,7 @@ Output:: Found 1 error in a.ts:1 //// [/home/src/workspaces/project/a.ts] *modified* -&{const a = "hello 0xc000cd0db0} +const a = "hello @@ -117,14 +117,14 @@ Output:: Found 1 error in a.ts:1 //// [/home/src/workspaces/project/a.js] *modified* -&{const a = "hello; - 0xc001665620} +const a = "hello; + //// [/home/src/workspaces/project/tsconfig.json] *modified* -&{{ +{ "compilerOptions": { } -} 0xc001665680} +} @@ -140,10 +140,10 @@ Output:: Found 1 error in a.ts:1 //// [/home/src/workspaces/project/tsconfig.json] *modified* -&{{ +{ "compilerOptions": { "noEmit": true, } -} 0xc00133c870} +} From 6757fe3e51feef498445c2e022e832c916f1f03d Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 1 Jul 2025 00:29:46 -0700 Subject: [PATCH 20/36] change to test --- internal/incremental/affectedfileshandler.go | 2 +- internal/incremental/buildInfo.go | 4 +- internal/incremental/emitfileshandler.go | 8 +- internal/incremental/snapshot.go | 97 ++++++------------- .../incrementaltestutil/readablebuildinfo.go | 43 +++++++- 5 files changed, 77 insertions(+), 77 deletions(-) diff --git a/internal/incremental/affectedfileshandler.go b/internal/incremental/affectedfileshandler.go index 4612d3c4d1..05279cb6b1 100644 --- a/internal/incremental/affectedfileshandler.go +++ b/internal/incremental/affectedfileshandler.go @@ -325,7 +325,7 @@ func (h *affectedFilesHandler) handleDtsMayChangeOf(dtsMayChange dtsMayChange, p if invalidateJsFiles { dtsMayChange.addFileToAffectedFilesPendingEmit(path, GetFileEmitKind(h.program.snapshot.options)) } else if h.program.snapshot.options.GetEmitDeclarations() { - dtsMayChange.addFileToAffectedFilesPendingEmit(path, core.IfElse(h.program.snapshot.options.DeclarationMap.IsTrue(), fileEmitKindAllDts, fileEmitKindDts)) + dtsMayChange.addFileToAffectedFilesPendingEmit(path, core.IfElse(h.program.snapshot.options.DeclarationMap.IsTrue(), FileEmitKindAllDts, FileEmitKindDts)) } } diff --git a/internal/incremental/buildInfo.go b/internal/incremental/buildInfo.go index 67793e8a89..ad41b131b8 100644 --- a/internal/incremental/buildInfo.go +++ b/internal/incremental/buildInfo.go @@ -278,7 +278,7 @@ func (b *BuildInfoFilePendingEmit) MarshalJSON() ([]byte, error) { if b.EmitKind == 0 { return json.Marshal(b.FileId) } - if b.EmitKind == fileEmitKindDts { + if b.EmitKind == FileEmitKindDts { fileListIds := []BuildInfoFileId{b.FileId} return json.Marshal(fileListIds) } @@ -299,7 +299,7 @@ func (b *BuildInfoFilePendingEmit) UnmarshalJSON(data []byte) error { if len(intTuple) == 1 { *b = BuildInfoFilePendingEmit{ FileId: BuildInfoFileId(intTuple[0]), - EmitKind: fileEmitKindDts, + EmitKind: FileEmitKindDts, } return nil } else if len(intTuple) == 2 { diff --git a/internal/incremental/emitfileshandler.go b/internal/incremental/emitfileshandler.go index ecde475eef..cc4d0d658c 100644 --- a/internal/incremental/emitfileshandler.go +++ b/internal/incremental/emitfileshandler.go @@ -31,10 +31,10 @@ type emitFilesHandler struct { func (h *emitFilesHandler) getPendingEmitKindForEmitOptions(emitKind FileEmitKind, options compiler.EmitOptions) FileEmitKind { pendingKind := getPendingEmitKind(emitKind, 0) if options.EmitOnly == compiler.EmitOnlyDts { - pendingKind &= fileEmitKindAllDts + pendingKind &= FileEmitKindAllDts } if h.isForDtsErrors { - pendingKind &= fileEmitKindDtsErrors + pendingKind &= FileEmitKindDtsErrors } return pendingKind } @@ -64,10 +64,10 @@ func (h *emitFilesHandler) emitAllAffectedFiles(options compiler.EmitOptions) *c wg.Queue(func() { // Determine if we can do partial emit var emitOnly compiler.EmitOnly - if (pendingKind & fileEmitKindAllJs) != 0 { + if (pendingKind & FileEmitKindAllJs) != 0 { emitOnly = compiler.EmitOnlyJs } - if (pendingKind & fileEmitKindAllDts) != 0 { + if (pendingKind & FileEmitKindAllDts) != 0 { if emitOnly == compiler.EmitOnlyJs { emitOnly = compiler.EmitAll } else { diff --git a/internal/incremental/snapshot.go b/internal/incremental/snapshot.go index 613c2d8874..8e5fb11dd5 100644 --- a/internal/incremental/snapshot.go +++ b/internal/incremental/snapshot.go @@ -3,7 +3,6 @@ package incremental import ( "context" "maps" - "strings" "sync" "github.com/microsoft/typescript-go/internal/ast" @@ -31,77 +30,37 @@ func (f *fileInfo) ImpliedNodeFormat() core.ResolutionMode { return f.impliedNod type FileEmitKind uint32 const ( - fileEmitKindNone FileEmitKind = 0 - fileEmitKindJs FileEmitKind = 1 << 0 // emit js file - fileEmitKindJsMap FileEmitKind = 1 << 1 // emit js.map file - fileEmitKindJsInlineMap FileEmitKind = 1 << 2 // emit inline source map in js file - fileEmitKindDtsErrors FileEmitKind = 1 << 3 // emit dts errors - fileEmitKindDtsEmit FileEmitKind = 1 << 4 // emit d.ts file - fileEmitKindDtsMap FileEmitKind = 1 << 5 // emit d.ts.map file - - fileEmitKindDts = fileEmitKindDtsErrors | fileEmitKindDtsEmit - fileEmitKindAllJs = fileEmitKindJs | fileEmitKindJsMap | fileEmitKindJsInlineMap - fileEmitKindAllDtsEmit = fileEmitKindDtsEmit | fileEmitKindDtsMap - fileEmitKindAllDts = fileEmitKindDts | fileEmitKindDtsMap - fileEmitKindAll = fileEmitKindAllJs | fileEmitKindAllDts + FileEmitKindNone FileEmitKind = 0 + FileEmitKindJs FileEmitKind = 1 << 0 // emit js file + FileEmitKindJsMap FileEmitKind = 1 << 1 // emit js.map file + FileEmitKindJsInlineMap FileEmitKind = 1 << 2 // emit inline source map in js file + FileEmitKindDtsErrors FileEmitKind = 1 << 3 // emit dts errors + FileEmitKindDtsEmit FileEmitKind = 1 << 4 // emit d.ts file + FileEmitKindDtsMap FileEmitKind = 1 << 5 // emit d.ts.map file + + FileEmitKindDts = FileEmitKindDtsErrors | FileEmitKindDtsEmit + FileEmitKindAllJs = FileEmitKindJs | FileEmitKindJsMap | FileEmitKindJsInlineMap + FileEmitKindAllDtsEmit = FileEmitKindDtsEmit | FileEmitKindDtsMap + FileEmitKindAllDts = FileEmitKindDts | FileEmitKindDtsMap + FileEmitKindAll = FileEmitKindAllJs | FileEmitKindAllDts ) -func (fileEmitKind FileEmitKind) String() string { - var builder strings.Builder - addFlags := func(flags string) { - if builder.Len() == 0 { - builder.WriteString(flags) - } else { - builder.WriteString("|") - builder.WriteString(flags) - } - } - if fileEmitKind != 0 { - if (fileEmitKind & fileEmitKindJs) != 0 { - addFlags("Js") - } - if (fileEmitKind & fileEmitKindJsMap) != 0 { - addFlags("JsMap") - } - if (fileEmitKind & fileEmitKindJsInlineMap) != 0 { - addFlags("JsInlineMap") - } - if (fileEmitKind & fileEmitKindDts) == fileEmitKindDts { - addFlags("Dts") - } else { - if (fileEmitKind & fileEmitKindDtsEmit) != 0 { - addFlags("DtsEmit") - } - if (fileEmitKind & fileEmitKindDtsErrors) != 0 { - addFlags("DtsErrors") - } - } - if (fileEmitKind & fileEmitKindDtsMap) != 0 { - addFlags("DtsMap") - } - } - if builder.Len() != 0 { - return builder.String() - } - return "None" -} - func GetFileEmitKind(options *core.CompilerOptions) FileEmitKind { - result := fileEmitKindJs + result := FileEmitKindJs if options.SourceMap.IsTrue() { - result |= fileEmitKindJsMap + result |= FileEmitKindJsMap } if options.InlineSourceMap.IsTrue() { - result |= fileEmitKindJsInlineMap + result |= FileEmitKindJsInlineMap } if options.GetEmitDeclarations() { - result |= fileEmitKindDts + result |= FileEmitKindDts } if options.DeclarationMap.IsTrue() { - result |= fileEmitKindDtsMap + result |= FileEmitKindDtsMap } if options.EmitDeclarationOnly.IsTrue() { - result &= fileEmitKindAllDts + result &= FileEmitKindAllDts } return result } @@ -114,24 +73,24 @@ func getPendingEmitKindWithOptions(options *core.CompilerOptions, oldOptions *co func getPendingEmitKind(emitKind FileEmitKind, oldEmitKind FileEmitKind) FileEmitKind { if oldEmitKind == emitKind { - return fileEmitKindNone + return FileEmitKindNone } if oldEmitKind == 0 || emitKind == 0 { return emitKind } diff := oldEmitKind ^ emitKind - result := fileEmitKindNone + result := FileEmitKindNone // If there is diff in Js emit, pending emit is js emit flags - if (diff & fileEmitKindAllJs) != 0 { - result |= emitKind & fileEmitKindAllJs + if (diff & FileEmitKindAllJs) != 0 { + result |= emitKind & FileEmitKindAllJs } // If dts errors pending, add dts errors flag - if (diff & fileEmitKindDtsErrors) != 0 { - result |= emitKind & fileEmitKindDtsErrors + if (diff & FileEmitKindDtsErrors) != 0 { + result |= emitKind & FileEmitKindDtsErrors } // If there is diff in Dts emit, pending emit is dts emit flags - if (diff & fileEmitKindAllDtsEmit) != 0 { - result |= emitKind & fileEmitKindAllDtsEmit + if (diff & FileEmitKindAllDtsEmit) != 0 { + result |= emitKind & FileEmitKindAllDtsEmit } return result } @@ -447,7 +406,7 @@ func newSnapshotForProgram(program *compiler.Program, oldProgram *Program) *snap } else { pendingEmitKind = getPendingEmitKindWithOptions(snapshot.options, oldProgram.snapshot.options) } - if pendingEmitKind != fileEmitKindNone { + if pendingEmitKind != FileEmitKindNone { // Add all files to affectedFilesPendingEmit since emit changed for _, file := range files { // Add to affectedFilesPending emit only if not changed since any changed file will do full emit diff --git a/internal/testutil/incrementaltestutil/readablebuildinfo.go b/internal/testutil/incrementaltestutil/readablebuildinfo.go index c708353a5a..b6d4b6dcd9 100644 --- a/internal/testutil/incrementaltestutil/readablebuildinfo.go +++ b/internal/testutil/incrementaltestutil/readablebuildinfo.go @@ -3,6 +3,7 @@ package incrementaltestutil import ( "encoding/json" "fmt" + "strings" "github.com/microsoft/typescript-go/internal/collections" "github.com/microsoft/typescript-go/internal/core" @@ -299,12 +300,52 @@ func (r *readableBuildInfo) setAffectedFilesPendingEmit() { emitKind := core.IfElse(pendingEmit.EmitKind == 0, fullEmitKind, pendingEmit.EmitKind) return &readableBuildInfoFilePendingEmit{ file: r.toFilePath(pendingEmit.FileId), - emitKind: emitKind.String(), + emitKind: toReadableFileEmitKind(emitKind), original: pendingEmit, } }) } +func toReadableFileEmitKind(fileEmitKind incremental.FileEmitKind) string { + var builder strings.Builder + addFlags := func(flags string) { + if builder.Len() == 0 { + builder.WriteString(flags) + } else { + builder.WriteString("|") + builder.WriteString(flags) + } + } + if fileEmitKind != 0 { + if (fileEmitKind & incremental.FileEmitKindJs) != 0 { + addFlags("Js") + } + if (fileEmitKind & incremental.FileEmitKindJsMap) != 0 { + addFlags("JsMap") + } + if (fileEmitKind & incremental.FileEmitKindJsInlineMap) != 0 { + addFlags("JsInlineMap") + } + if (fileEmitKind & incremental.FileEmitKindDts) == incremental.FileEmitKindDts { + addFlags("Dts") + } else { + if (fileEmitKind & incremental.FileEmitKindDtsEmit) != 0 { + addFlags("DtsEmit") + } + if (fileEmitKind & incremental.FileEmitKindDtsErrors) != 0 { + addFlags("DtsErrors") + } + } + if (fileEmitKind & incremental.FileEmitKindDtsMap) != 0 { + addFlags("DtsMap") + } + } + if builder.Len() != 0 { + return builder.String() + } + return "None" +} + func (r *readableBuildInfo) setEmitSignatures() { r.EmitSignatures = core.Map(r.buildInfo.EmitSignatures, func(signature *incremental.BuildInfoEmitSignature) *readableBuildInfoEmitSignature { return &readableBuildInfoEmitSignature{ From 8fccf4be905359ae59b29185e6699c602560a173 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 1 Jul 2025 09:14:14 -0700 Subject: [PATCH 21/36] Lint --- internal/execute/testsys_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/execute/testsys_test.go b/internal/execute/testsys_test.go index 17bf78b6f9..088197cde1 100644 --- a/internal/execute/testsys_test.go +++ b/internal/execute/testsys_test.go @@ -118,7 +118,10 @@ func (s *testSys) ensureLibPathExists(path string) { s.fs.defaultLibs = collections.NewSetWithSizeHint[string](tsoptions.LibFilesSet.Len() + len(tsoptions.TargetToLibMap()) + 1) } s.fs.defaultLibs.Add(path) - s.TestFS().WriteFile(path, tscDefaultLibContent, false) + err := s.TestFS().WriteFile(path, tscDefaultLibContent, false) + if err != nil { + panic("Failed to write default library file: " + err.Error()) + } } } From 67f991115650c941b92d6dfa879b6bad947ee358 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 1 Jul 2025 09:44:46 -0700 Subject: [PATCH 22/36] Support for edits in tsc tests --- internal/execute/export_test.go | 19 +- internal/execute/testsys_test.go | 23 ++- internal/execute/tsc_test.go | 8 +- internal/execute/tscincremental_test.go | 2 +- ...tsc_nocheck_test.go => tscnocheck_test.go} | 2 +- internal/execute/tscprojectreferences_test.go | 2 +- ...erifytsc_test.go => tsctestrunner_test.go} | 65 ++++--- internal/execute/tscwatch_test.go | 124 +++++++++++++ internal/execute/verifytscwatch_test.go | 169 ------------------ .../when-build-not-first-argument.js | 0 ...does-not-add-color-when-NO_COLOR-is-set.js | 4 +- .../reference/tsc/commandLine/help.js | 2 +- ...when-host-cannot-provide-terminal-width.js | 4 +- ...tatus.DiagnosticsPresent_OutputsSkipped.js | 4 +- ...h-interval-option-without-tsconfig.json.js | 4 +- .../Parse-watch-interval-option.js | 0 .../watch-with-no-tsconfig.js | 4 +- .../noEmit/dts-errors-without-dts-enabled.js | 4 +- .../reference/tscWatch/noEmit/dts-errors.js | 4 +- .../tscWatch/noEmit/semantic-errors.js | 4 +- .../tscWatch/noEmit/syntax-errors.js | 4 +- 21 files changed, 214 insertions(+), 238 deletions(-) rename internal/execute/{verifytsc_nocheck_test.go => tscnocheck_test.go} (96%) rename internal/execute/{verifytsc_test.go => tsctestrunner_test.go} (59%) create mode 100644 internal/execute/tscwatch_test.go delete mode 100644 internal/execute/verifytscwatch_test.go rename testdata/baselines/reference/{tsc => tsbuild}/commandLine/when-build-not-first-argument.js (100%) rename testdata/baselines/reference/{tsc => tscWatch}/commandLine/Parse-watch-interval-option-without-tsconfig.json.js (98%) rename testdata/baselines/reference/{tsc => tscWatch}/commandLine/Parse-watch-interval-option.js (100%) diff --git a/internal/execute/export_test.go b/internal/execute/export_test.go index 65dfdd2d4c..71010bd9d9 100644 --- a/internal/execute/export_test.go +++ b/internal/execute/export_test.go @@ -1,9 +1,6 @@ package execute import ( - "github.com/microsoft/typescript-go/internal/ast" - "github.com/microsoft/typescript-go/internal/compiler" - "github.com/microsoft/typescript-go/internal/incremental" "github.com/microsoft/typescript-go/internal/tsoptions" ) @@ -14,21 +11,9 @@ func CommandLineTest(sys System, commandLineArgs []string) (ExitStatus, *tsoptio func StartForTest(w *watcher) { // this function should perform any initializations before w.doCycle() in `start(watcher)` w.initialize() + w.doCycle() } func RunWatchCycle(w *watcher) { - // this function should perform the same stuff as w.doCycle() without printing time-related output - if w.hasErrorsInTsConfig() { - // these are unrecoverable errors--report them and do not build - return - } - // todo: updateProgram() - w.program = incremental.NewProgram(compiler.NewProgram(compiler.ProgramOptions{ - Config: w.options, - Host: w.host, - JSDocParsingMode: ast.JSDocParsingModeParseForTypeErrors, - }), w.program) - if w.hasBeenModified(w.program.GetProgram()) { - w.compileAndEmit() - } + w.doCycle() } diff --git a/internal/execute/testsys_test.go b/internal/execute/testsys_test.go index 088197cde1..05105d74b1 100644 --- a/internal/execute/testsys_test.go +++ b/internal/execute/testsys_test.go @@ -11,6 +11,7 @@ import ( "time" "github.com/microsoft/typescript-go/internal/collections" + "github.com/microsoft/typescript-go/internal/core" "github.com/microsoft/typescript-go/internal/testutil/incrementaltestutil" "github.com/microsoft/typescript-go/internal/tsoptions" "github.com/microsoft/typescript-go/internal/vfs" @@ -141,10 +142,24 @@ func (s *testSys) Writer() io.Writer { return s.currentWrite } +func sanitizeSysOutput(output string, prefixLine string, replaceString string) string { + if index := strings.Index(output, prefixLine); index != -1 { + indexOfNewLine := strings.Index(output[index:], "\n") + if indexOfNewLine != -1 { + output = output[:index] + replaceString + output[index+indexOfNewLine+1:] + } + } + return output +} + func (s *testSys) EndWrite() { // todo: revisit if improving tsc/build/watch unittest baselines - s.output = append(s.output, s.currentWrite.String()) + output := s.currentWrite.String() s.currentWrite.Reset() + output = sanitizeSysOutput(output, "Version "+core.Version(), "Version FakeTSVersion\n") + output = sanitizeSysOutput(output, "build starting at ", "") + output = sanitizeSysOutput(output, "build finished in ", "") + s.output = append(s.output, output) } func (s *testSys) serializeState(baseline *strings.Builder) { @@ -249,3 +264,9 @@ func (s *testSys) printOutputs(baseline io.Writer) { // todo sanitize sys output fmt.Fprint(baseline, strings.Join(s.output, "\n")) } + +func (s *testSys) WriteFileNoError(path string, content string, writeByteOrderMark bool) { + if err := s.FS().WriteFile(path, content, writeByteOrderMark); err != nil { + panic(err) + } +} diff --git a/internal/execute/tsc_test.go b/internal/execute/tsc_test.go index 4b94485807..abb2570e35 100644 --- a/internal/execute/tsc_test.go +++ b/internal/execute/tsc_test.go @@ -4,7 +4,7 @@ import ( "testing" ) -func TestTsc(t *testing.T) { +func TestTscCommandline(t *testing.T) { t.Parallel() testCases := []*tscInput{ { @@ -128,7 +128,7 @@ func TestNoEmit(t *testing.T) { "/home/src/workspaces/project/class1.ts": `export class class1 {}`, }, ""), commandLineArgs: []string{"--noEmit"}, - }).verify(t, "noEmit") + }).run(t, "noEmit") } func TestExtends(t *testing.T) { @@ -198,7 +198,7 @@ func TestExtends(t *testing.T) { }} for _, c := range cases { - c.verify(t, "extends") + c.run(t, "extends") } } @@ -221,5 +221,5 @@ func TestTypeAcquisition(t *testing.T) { "/home/src/workspaces/project", ), commandLineArgs: []string{}, - }).verify(t, "typeAcquisition") + }).run(t, "typeAcquisition") } diff --git a/internal/execute/tscincremental_test.go b/internal/execute/tscincremental_test.go index facc10f319..db96f8285b 100644 --- a/internal/execute/tscincremental_test.go +++ b/internal/execute/tscincremental_test.go @@ -125,6 +125,6 @@ func TestIncremental(t *testing.T) { } for _, test := range testCases { - test.verify(t, "incremental") + test.run(t, "incremental") } } diff --git a/internal/execute/verifytsc_nocheck_test.go b/internal/execute/tscnocheck_test.go similarity index 96% rename from internal/execute/verifytsc_nocheck_test.go rename to internal/execute/tscnocheck_test.go index c8b5051d0a..7817571351 100644 --- a/internal/execute/verifytsc_nocheck_test.go +++ b/internal/execute/tscnocheck_test.go @@ -30,6 +30,6 @@ func TestNoCheck(t *testing.T) { // incremental: undefined, true }, "/home/src/workspaces/project"), commandLineArgs: []string{"--noCheck", "--outFile", "built"}, - }).verify(t, "noCheck") + }).run(t, "noCheck") } } diff --git a/internal/execute/tscprojectreferences_test.go b/internal/execute/tscprojectreferences_test.go index 47ccc47cc7..67c57b535e 100644 --- a/internal/execute/tscprojectreferences_test.go +++ b/internal/execute/tscprojectreferences_test.go @@ -289,6 +289,6 @@ func TestProjectReferences(t *testing.T) { } for _, c := range cases { - c.verify(t, "projectReferences") + c.run(t, "projectReferences") } } diff --git a/internal/execute/verifytsc_test.go b/internal/execute/tsctestrunner_test.go similarity index 59% rename from internal/execute/verifytsc_test.go rename to internal/execute/tsctestrunner_test.go index 0a2dc6153a..aff81187f4 100644 --- a/internal/execute/verifytsc_test.go +++ b/internal/execute/tsctestrunner_test.go @@ -4,6 +4,7 @@ import ( "encoding/json" "fmt" "path/filepath" + "slices" "strings" "testing" @@ -14,57 +15,81 @@ import ( type testTscEdit struct { caption string commandLineArgs []string - edit func(execute.System) + edit func(*testSys) } type tscInput struct { subScenario string commandLineArgs []string sys *testSys - - // for watch tests - data map[string]string + edits []*testTscEdit } -func (test *tscInput) verify(t *testing.T, scenario string) { +func (test *tscInput) run(t *testing.T, scenario string) { t.Helper() t.Run(test.getTestName(scenario), func(t *testing.T) { t.Parallel() - t.Run("baseline for the tsc compiles", func(t *testing.T) { + t.Run("tsc baseline", func(t *testing.T) { t.Parallel() // initial test tsc compile baselineBuilder := test.startBaseline() - exit, parsedCommandLine, _ := execute.CommandLineTest(test.sys, test.commandLineArgs) + exit, parsedCommandLine, watcher := execute.CommandLineTest(test.sys, test.commandLineArgs) baselineBuilder.WriteString("ExitStatus:: " + fmt.Sprint(exit)) compilerOptionsString, _ := json.MarshalIndent(parsedCommandLine.CompilerOptions(), "", " ") baselineBuilder.WriteString("\n\nCompilerOptions::") baselineBuilder.Write(compilerOptionsString) + if watcher != nil { + execute.StartForTest(watcher) + } + test.sys.serializeState(baselineBuilder) - options, name := test.getBaselineName(scenario, false, "") + + for _, do := range test.edits { + do.edit(test.sys) + baselineBuilder.WriteString("\n\nEdit:: " + do.caption + "\n") + + if watcher == nil { + exit, parsedCommandLine, watcher = execute.CommandLineTest(test.sys, test.commandLineArgs) + baselineBuilder.WriteString("ExitStatus:: " + fmt.Sprint(exit)) + } else { + execute.RunWatchCycle(watcher) + } + test.sys.serializeState(baselineBuilder) + } + + options, name := test.getBaselineName(scenario, "") baseline.Run(t, name, baselineBuilder.String(), options) }) - }) -} -func (test *tscInput) getTestName(scenario string) string { - return "tsc " + strings.Join(test.commandLineArgs, " ") + " " + scenario + ":: " + test.subScenario + // !!! sheetal TODO :: add incremental correctness + }) } -func (test *tscInput) getBaselineName(scenario string, watch bool, suffix string) (baseline.Options, string) { +func (test *tscInput) getTestNamePrefix() string { commandName := "tsc" - // todo build - // if isBuildCommand(v.data.commandLineArgs) { - // commandName = "tsbuild" - // } + if slices.ContainsFunc(test.commandLineArgs, func(arg string) bool { + return arg == "--build" || arg == "-b" + }) { + commandName = "tsbuild" + } w := "" - if watch { + if slices.ContainsFunc(test.commandLineArgs, func(arg string) bool { + return arg == "--watch" || arg == "-w" + }) { w = "Watch" } + return commandName + w +} + +func (test *tscInput) getTestName(scenario string) string { + return test.getTestNamePrefix() + " " + scenario + ":: " + test.subScenario + " " + strings.Join(test.commandLineArgs, " ") +} - return baseline.Options{Subfolder: filepath.Join(commandName+w, scenario)}, +func (test *tscInput) getBaselineName(scenario string, suffix string) (baseline.Options, string) { + return baseline.Options{Subfolder: filepath.Join(test.getTestNamePrefix(), scenario)}, strings.ReplaceAll(test.subScenario, " ", "-") + suffix + ".js" } @@ -100,7 +125,7 @@ func (test *tscInput) verifyCommandLineParsing(t *testing.T, scenario string) { baselineBuilder.Write(parsedCommandLineString) test.sys.serializeState(baselineBuilder) - options, name := test.getBaselineName(scenario, false, "") + options, name := test.getBaselineName(scenario, "") baseline.Run(t, name, baselineBuilder.String(), options) }) }) diff --git a/internal/execute/tscwatch_test.go b/internal/execute/tscwatch_test.go new file mode 100644 index 0000000000..e4d021c63a --- /dev/null +++ b/internal/execute/tscwatch_test.go @@ -0,0 +1,124 @@ +package execute_test + +import ( + "strings" + "testing" +) + +func TestWatch(t *testing.T) { + t.Parallel() + testCases := []*tscInput{ + { + subScenario: "watch with no tsconfig", + sys: newTestSys(FileMap{ + "/home/src/workspaces/project/index.ts": "", + }, "/home/src/workspaces/project"), + commandLineArgs: []string{"index.ts", "--watch"}, + }, + } + + for _, test := range testCases { + test.run(t, "commandLineWatch") + } +} + +func listToTsconfig(base string, tsconfigOpts ...string) (string, string) { + optionString := strings.Join(tsconfigOpts, ",\n ") + tsconfigText := `{ + "compilerOptions": { +` + after := " " + if base != "" { + tsconfigText += " " + base + after = ",\n " + } + if len(tsconfigOpts) != 0 { + tsconfigText += after + optionString + } + tsconfigText += ` + } +}` + return tsconfigText, optionString +} + +func toTsconfig(base string, compilerOpts string) string { + tsconfigText, _ := listToTsconfig(base, compilerOpts) + return tsconfigText +} + +func noEmitWatchTestInput( + subScenario string, + commandLineArgs []string, + aText string, + tsconfigOptions []string, +) *tscInput { + noEmitOpt := `"noEmit": true` + tsconfigText, optionString := listToTsconfig(noEmitOpt, tsconfigOptions...) + sys := newTestSys(FileMap{ + "/home/src/workspaces/project/a.ts": aText, + "/home/src/workspaces/project/tsconfig.json": tsconfigText, + }, "/home/src/workspaces/project") + return &tscInput{ + subScenario: subScenario, + commandLineArgs: commandLineArgs, + sys: sys, + edits: []*testTscEdit{ + newTscEdit("fix syntax error", func(sys *testSys) { + sys.WriteFileNoError("/home/src/workspaces/project/a.ts", `const a = "hello";`, false) + }), + newTscEdit("emit after fixing error", func(sys *testSys) { + sys.WriteFileNoError("/home/src/workspaces/project/tsconfig.json", toTsconfig("", optionString), false) + }), + newTscEdit("no emit run after fixing error", func(sys *testSys) { + sys.WriteFileNoError("/home/src/workspaces/project/tsconfig.json", toTsconfig(noEmitOpt, optionString), false) + }), + newTscEdit("introduce error", func(sys *testSys) { + sys.WriteFileNoError("/home/src/workspaces/project/a.ts", aText, false) + }), + newTscEdit("emit when error", func(sys *testSys) { + sys.WriteFileNoError("/home/src/workspaces/project/tsconfig.json", toTsconfig("", optionString), false) + }), + newTscEdit("no emit run when error", func(sys *testSys) { + sys.WriteFileNoError("/home/src/workspaces/project/tsconfig.json", toTsconfig(noEmitOpt, optionString), false) + }), + }, + } +} + +func newTscEdit(name string, edit func(sys *testSys)) *testTscEdit { + return &testTscEdit{name, []string{}, edit} +} + +func TestTscNoEmitWatch(t *testing.T) { + t.Parallel() + + testCases := []*tscInput{ + noEmitWatchTestInput("syntax errors", + []string{"-w"}, + `const a = "hello`, + nil, + ), + noEmitWatchTestInput( + "semantic errors", + []string{"-w"}, + `const a: number = "hello"`, + nil, + ), + noEmitWatchTestInput( + "dts errors without dts enabled", + []string{"-w"}, + `const a = class { private p = 10; };`, + nil, + ), + noEmitWatchTestInput( + "dts errors", + []string{"-w"}, + `const a = class { private p = 10; };`, + []string{`"declaration": true`}, + ), + } + + for _, test := range testCases { + test.run(t, "noEmit") + } +} diff --git a/internal/execute/verifytscwatch_test.go b/internal/execute/verifytscwatch_test.go deleted file mode 100644 index c34a626028..0000000000 --- a/internal/execute/verifytscwatch_test.go +++ /dev/null @@ -1,169 +0,0 @@ -package execute_test - -import ( - "encoding/json" - "strings" - "testing" - - "github.com/microsoft/typescript-go/internal/execute" - "github.com/microsoft/typescript-go/internal/testutil/baseline" -) - -func verifyWatch(t *testing.T, test *tscInput, scenario string, edits []*testTscEdit) { - t.Helper() - t.Run(test.getTestName(scenario), func(t *testing.T) { - t.Parallel() - t.Run("baseline for the tsc compiles", func(t *testing.T) { - t.Parallel() - baselineBuilder := test.startBaseline() - - _, parsedCommandLine, watcher := execute.CommandLineTest(test.sys, test.commandLineArgs) - - compilerOptionsString, _ := json.MarshalIndent(parsedCommandLine.CompilerOptions(), "", " ") - baselineBuilder.WriteString("\n\nCompilerOptions::") - baselineBuilder.Write(compilerOptionsString) - - baselineBuilder.WriteString("\n\n") - - // build initial state - execute.StartForTest(watcher) - execute.RunWatchCycle(watcher) - test.sys.serializeState(baselineBuilder) - - for _, do := range edits { - do.edit(test.sys) - baselineBuilder.WriteString("\n\nEdit:: " + do.caption + "\n") - - execute.RunWatchCycle(watcher) - test.sys.serializeState(baselineBuilder) - } - - options, name := test.getBaselineName(scenario, true, "") - baseline.Run(t, name, baselineBuilder.String(), options) - }) - }) -} - -func TestWatch(t *testing.T) { - t.Parallel() - testCases := []*tscInput{ - { - subScenario: "watch with no tsconfig", - sys: newTestSys(FileMap{ - "/home/src/workspaces/project/index.ts": "", - }, "/home/src/workspaces/project"), - commandLineArgs: []string{"index.ts", "--watch"}, - }, - } - - for _, test := range testCases { - verifyWatch(t, test, "commandLineWatch", nil) - } -} - -func listToTsconfig(base string, tsconfigOpts ...string) (string, string) { - optionString := strings.Join(tsconfigOpts, ",\n ") - tsconfigText := `{ - "compilerOptions": { -` - after := " " - if base != "" { - tsconfigText += " " + base - after = ",\n " - } - if len(tsconfigOpts) != 0 { - tsconfigText += after + optionString - } - tsconfigText += ` - } -}` - return tsconfigText, optionString -} - -func toTsconfig(base string, compilerOpts string) string { - tsconfigText, _ := listToTsconfig(base, compilerOpts) - return tsconfigText -} - -func noEmitWatchTestInput( - subScenario string, - commandLineArgs []string, - aText string, - tsconfigOptions []string, -) *tscInput { - noEmitOpt := `"noEmit": true` - tsconfigText, optionString := listToTsconfig(noEmitOpt, tsconfigOptions...) - sys := newTestSys(FileMap{ - "/home/src/workspaces/project/a.ts": aText, - "/home/src/workspaces/project/tsconfig.json": tsconfigText, - }, "/home/src/workspaces/project") - data := map[string]string{ - "baseOpt": noEmitOpt, - "originalOpts": optionString, - "aText": aText, - } - return &tscInput{ - subScenario, - commandLineArgs, - sys, - data, - } -} - -func newTscEdit(name string, edit func(sys execute.System)) *testTscEdit { - return &testTscEdit{name, []string{}, edit} -} - -func TestTscNoEmitWatch(t *testing.T) { - t.Parallel() - - testCases := []*tscInput{ - noEmitWatchTestInput("syntax errors", - []string{"-w"}, - `const a = "hello`, - nil, - ), - noEmitWatchTestInput( - "semantic errors", - []string{"-w"}, - `const a: number = "hello"`, - nil, - ), - noEmitWatchTestInput( - "dts errors without dts enabled", - []string{"-w"}, - `const a = class { private p = 10; };`, - nil, - ), - noEmitWatchTestInput( - "dts errors", - []string{"-w"}, - `const a = class { private p = 10; };`, - []string{`"declaration": true`}, - ), - } - - for _, test := range testCases { - //nolint:errcheck - verifyWatch(t, test, "noEmit", []*testTscEdit{ - newTscEdit("fix syntax error", func(sys execute.System) { - sys.FS().WriteFile("/home/src/workspaces/project/a.ts", `const a = "hello";`, false) - }), - newTscEdit("emit after fixing error", func(sys execute.System) { - sys.FS().WriteFile("/home/src/workspaces/project/tsconfig.json", toTsconfig("", test.data["originalOpts"]), false) - }), - newTscEdit("no emit run after fixing error", func(sys execute.System) { - sys.FS().WriteFile("/home/src/workspaces/project/tsconfig.json", toTsconfig(test.data["baseOpt"], test.data["originalOpts"]), false) - }), - newTscEdit("introduce error", func(sys execute.System) { - sys.FS().WriteFile("/home/src/workspaces/project/a.ts", test.data["aText"], false) - }), - newTscEdit("emit when error", func(sys execute.System) { - sys.FS().WriteFile("/home/src/workspaces/project/tsconfig.json", toTsconfig("", test.data["originalOpts"]), false) - }), - newTscEdit("no emit run when error", func(sys execute.System) { - sys.FS().WriteFile("/home/src/workspaces/project/tsconfig.json", toTsconfig(test.data["baseOpt"], test.data["originalOpts"]), false) - }), - }) - } -} diff --git a/testdata/baselines/reference/tsc/commandLine/when-build-not-first-argument.js b/testdata/baselines/reference/tsbuild/commandLine/when-build-not-first-argument.js similarity index 100% rename from testdata/baselines/reference/tsc/commandLine/when-build-not-first-argument.js rename to testdata/baselines/reference/tsbuild/commandLine/when-build-not-first-argument.js diff --git a/testdata/baselines/reference/tsc/commandLine/does-not-add-color-when-NO_COLOR-is-set.js b/testdata/baselines/reference/tsc/commandLine/does-not-add-color-when-NO_COLOR-is-set.js index a71f17d969..4d466c66fe 100644 --- a/testdata/baselines/reference/tsc/commandLine/does-not-add-color-when-NO_COLOR-is-set.js +++ b/testdata/baselines/reference/tsc/commandLine/does-not-add-color-when-NO_COLOR-is-set.js @@ -27,9 +27,9 @@ ParsedCommandLine::{ "compileOnSave": null } Output:: -Version 7.0.0-dev +Version FakeTSVersion -tsc: The TypeScript Compiler - Version 7.0.0-dev +tsc: The TypeScript Compiler - Version FakeTSVersion COMMON COMMANDS diff --git a/testdata/baselines/reference/tsc/commandLine/help.js b/testdata/baselines/reference/tsc/commandLine/help.js index 8e0c5470d3..d67796b96a 100644 --- a/testdata/baselines/reference/tsc/commandLine/help.js +++ b/testdata/baselines/reference/tsc/commandLine/help.js @@ -31,7 +31,7 @@ ParsedCommandLine::{ "compileOnSave": null } Output:: -tsc: The TypeScript Compiler - Version 7.0.0-dev +tsc: The TypeScript Compiler - Version FakeTSVersion COMMON COMMANDS diff --git a/testdata/baselines/reference/tsc/commandLine/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-cannot-provide-terminal-width.js b/testdata/baselines/reference/tsc/commandLine/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-cannot-provide-terminal-width.js index a71f17d969..4d466c66fe 100644 --- a/testdata/baselines/reference/tsc/commandLine/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-cannot-provide-terminal-width.js +++ b/testdata/baselines/reference/tsc/commandLine/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-cannot-provide-terminal-width.js @@ -27,9 +27,9 @@ ParsedCommandLine::{ "compileOnSave": null } Output:: -Version 7.0.0-dev +Version FakeTSVersion -tsc: The TypeScript Compiler - Version 7.0.0-dev +tsc: The TypeScript Compiler - Version FakeTSVersion COMMON COMMANDS diff --git a/testdata/baselines/reference/tsc/commandLine/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js b/testdata/baselines/reference/tsc/commandLine/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js index a71f17d969..4d466c66fe 100644 --- a/testdata/baselines/reference/tsc/commandLine/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js +++ b/testdata/baselines/reference/tsc/commandLine/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js @@ -27,9 +27,9 @@ ParsedCommandLine::{ "compileOnSave": null } Output:: -Version 7.0.0-dev +Version FakeTSVersion -tsc: The TypeScript Compiler - Version 7.0.0-dev +tsc: The TypeScript Compiler - Version FakeTSVersion COMMON COMMANDS diff --git a/testdata/baselines/reference/tsc/commandLine/Parse-watch-interval-option-without-tsconfig.json.js b/testdata/baselines/reference/tscWatch/commandLine/Parse-watch-interval-option-without-tsconfig.json.js similarity index 98% rename from testdata/baselines/reference/tsc/commandLine/Parse-watch-interval-option-without-tsconfig.json.js rename to testdata/baselines/reference/tscWatch/commandLine/Parse-watch-interval-option-without-tsconfig.json.js index 8d561acc81..0cde9201d9 100644 --- a/testdata/baselines/reference/tsc/commandLine/Parse-watch-interval-option-without-tsconfig.json.js +++ b/testdata/baselines/reference/tscWatch/commandLine/Parse-watch-interval-option-without-tsconfig.json.js @@ -32,9 +32,9 @@ ParsedCommandLine::{ "compileOnSave": null } Output:: -Version 7.0.0-dev +Version FakeTSVersion -tsc: The TypeScript Compiler - Version 7.0.0-dev +tsc: The TypeScript Compiler - Version FakeTSVersion COMMON COMMANDS diff --git a/testdata/baselines/reference/tsc/commandLine/Parse-watch-interval-option.js b/testdata/baselines/reference/tscWatch/commandLine/Parse-watch-interval-option.js similarity index 100% rename from testdata/baselines/reference/tsc/commandLine/Parse-watch-interval-option.js rename to testdata/baselines/reference/tscWatch/commandLine/Parse-watch-interval-option.js diff --git a/testdata/baselines/reference/tscWatch/commandLineWatch/watch-with-no-tsconfig.js b/testdata/baselines/reference/tscWatch/commandLineWatch/watch-with-no-tsconfig.js index 4983b19b24..cdcd875587 100644 --- a/testdata/baselines/reference/tscWatch/commandLineWatch/watch-with-no-tsconfig.js +++ b/testdata/baselines/reference/tscWatch/commandLineWatch/watch-with-no-tsconfig.js @@ -5,13 +5,11 @@ Input::index.ts --watch //// [/home/src/workspaces/project/index.ts] *new* - +ExitStatus:: 0 CompilerOptions::{ "watch": true } - - Output:: //// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* /// diff --git a/testdata/baselines/reference/tscWatch/noEmit/dts-errors-without-dts-enabled.js b/testdata/baselines/reference/tscWatch/noEmit/dts-errors-without-dts-enabled.js index f85a1b6fd1..4950a35e09 100644 --- a/testdata/baselines/reference/tscWatch/noEmit/dts-errors-without-dts-enabled.js +++ b/testdata/baselines/reference/tscWatch/noEmit/dts-errors-without-dts-enabled.js @@ -11,13 +11,11 @@ const a = class { private p = 10; }; } } - +ExitStatus:: 0 CompilerOptions::{ "watch": true } - - Output:: //// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* /// diff --git a/testdata/baselines/reference/tscWatch/noEmit/dts-errors.js b/testdata/baselines/reference/tscWatch/noEmit/dts-errors.js index c52082c98c..ec0b1bc5c1 100644 --- a/testdata/baselines/reference/tscWatch/noEmit/dts-errors.js +++ b/testdata/baselines/reference/tscWatch/noEmit/dts-errors.js @@ -12,13 +12,11 @@ const a = class { private p = 10; }; } } - +ExitStatus:: 0 CompilerOptions::{ "watch": true } - - Output:: a.ts:1:7 - error TS4094: Property 'p' of exported anonymous class type may not be private or protected. diff --git a/testdata/baselines/reference/tscWatch/noEmit/semantic-errors.js b/testdata/baselines/reference/tscWatch/noEmit/semantic-errors.js index 5a0d14c488..bcbdb93290 100644 --- a/testdata/baselines/reference/tscWatch/noEmit/semantic-errors.js +++ b/testdata/baselines/reference/tscWatch/noEmit/semantic-errors.js @@ -11,13 +11,11 @@ const a: number = "hello" } } - +ExitStatus:: 0 CompilerOptions::{ "watch": true } - - Output:: a.ts:1:7 - error TS2322: Type 'string' is not assignable to type 'number'. diff --git a/testdata/baselines/reference/tscWatch/noEmit/syntax-errors.js b/testdata/baselines/reference/tscWatch/noEmit/syntax-errors.js index 8b386db9fa..8ff8dd6a64 100644 --- a/testdata/baselines/reference/tscWatch/noEmit/syntax-errors.js +++ b/testdata/baselines/reference/tscWatch/noEmit/syntax-errors.js @@ -11,13 +11,11 @@ const a = "hello } } - +ExitStatus:: 0 CompilerOptions::{ "watch": true } - - Output:: a.ts:1:17 - error TS1002: Unterminated string literal. From 80a75d5b2abc1517fe119bc7ec70f7a8c735979a Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 1 Jul 2025 10:33:53 -0700 Subject: [PATCH 23/36] Fix race with default libs --- internal/execute/testfs_test.go | 2 +- internal/execute/testsys_test.go | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/internal/execute/testfs_test.go b/internal/execute/testfs_test.go index a212b32600..e016369360 100644 --- a/internal/execute/testfs_test.go +++ b/internal/execute/testfs_test.go @@ -7,7 +7,7 @@ import ( type testFsTrackingLibs struct { fs vfs.FS - defaultLibs *collections.Set[string] + defaultLibs *collections.SyncSet[string] } var _ vfs.FS = (*testFsTrackingLibs)(nil) diff --git a/internal/execute/testsys_test.go b/internal/execute/testsys_test.go index 05105d74b1..859fa3fe84 100644 --- a/internal/execute/testsys_test.go +++ b/internal/execute/testsys_test.go @@ -78,7 +78,7 @@ type diffEntry struct { type snapshot struct { snap map[string]*diffEntry - defaultLibs *collections.Set[string] + defaultLibs *collections.SyncSet[string] } type testSys struct { @@ -116,7 +116,7 @@ func (s *testSys) ensureLibPathExists(path string) { path = tscLibPath + "/" + path if _, ok := s.TestFS().ReadFile(path); !ok { if s.fs.defaultLibs == nil { - s.fs.defaultLibs = collections.NewSetWithSizeHint[string](tsoptions.LibFilesSet.Len() + len(tsoptions.TargetToLibMap()) + 1) + s.fs.defaultLibs = &collections.SyncSet[string]{} } s.fs.defaultLibs.Add(path) err := s.TestFS().WriteFile(path, tscDefaultLibContent, false) @@ -225,20 +225,23 @@ func (s *testSys) baselineFSwithDiff(baseline io.Writer) { } } } - var defaultLibs *collections.Set[string] + var defaultLibs collections.SyncSet[string] if s.fs.defaultLibs != nil { - defaultLibs = s.fs.defaultLibs.Clone() + s.fs.defaultLibs.Range(func(libPath string) bool { + defaultLibs.Add(libPath) + return true + }) } s.serializedDiff = &snapshot{ snap: snap, - defaultLibs: defaultLibs, + defaultLibs: &defaultLibs, } fmt.Fprintln(baseline) } func (s *testSys) reportFSEntryDiff(baseline io.Writer, newDirContent *diffEntry, path string) { var oldDirContent *diffEntry - var defaultLibs *collections.Set[string] + var defaultLibs *collections.SyncSet[string] if s.serializedDiff != nil { oldDirContent = s.serializedDiff.snap[path] defaultLibs = s.serializedDiff.defaultLibs From 8430b07c0bd1b90e5b23517daa83e74ad805bf8b Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 1 Jul 2025 10:57:36 -0700 Subject: [PATCH 24/36] Always collect references for proper program update --- internal/incremental/affectedfileshandler.go | 8 +-- internal/incremental/snapshot.go | 59 +++++++------------- internal/incremental/tobuildinfo.go | 3 - internal/incremental/tosnapshot.go | 1 - 4 files changed, 21 insertions(+), 50 deletions(-) diff --git a/internal/incremental/affectedfileshandler.go b/internal/incremental/affectedfileshandler.go index 05279cb6b1..c4ffb74766 100644 --- a/internal/incremental/affectedfileshandler.go +++ b/internal/incremental/affectedfileshandler.go @@ -107,11 +107,6 @@ func (h *affectedFilesHandler) getFilesAffectedBy(path tspath.Path) []*ast.Sourc return []*ast.SourceFile{file} } - if !h.program.snapshot.tracksReferences() { - h.hasAllFilesExcludingDefaultLibraryFile.Store(true) - return h.program.snapshot.getAllFilesExcludingDefaultLibraryFile(h.program.program, file) - } - if info := h.program.snapshot.fileInfos[file.Path()]; info.affectsGlobalScope { h.hasAllFilesExcludingDefaultLibraryFile.Store(true) h.program.snapshot.getAllFilesExcludingDefaultLibraryFile(h.program.program, file) @@ -200,8 +195,7 @@ func (h *affectedFilesHandler) handleDtsMayChangeOfAffectedFile(dtsMayChange dts // Iterate on referencing modules that export entities from affected file and delete diagnostics and add pending emit // If there was change in signature (dts output) for the changed file, // then only we need to handle pending file emit - if !h.program.snapshot.tracksReferences() || - !h.program.snapshot.changedFilesSet.Has(affectedFile.Path()) || + if !h.program.snapshot.changedFilesSet.Has(affectedFile.Path()) || !h.isChangedSignature(affectedFile.Path()) { return } diff --git a/internal/incremental/snapshot.go b/internal/incremental/snapshot.go index 8e5fb11dd5..16d99391ee 100644 --- a/internal/incremental/snapshot.go +++ b/internal/incremental/snapshot.go @@ -187,7 +187,7 @@ type snapshot struct { fileInfos map[tspath.Path]*fileInfo options *core.CompilerOptions // Contains the map of ReferencedSet=Referenced files of the file if module emit is enabled - referencedMap *collections.ManyToManyMap[tspath.Path, tspath.Path] + referencedMap collections.ManyToManyMap[tspath.Path, tspath.Path] // Cache of semantic diagnostics for files with their Path being the key semanticDiagnosticsPerFile map[tspath.Path]*diagnosticsOrBuildInfoDiagnosticsWithFileName // Cache of dts emit diagnostics for files with their Path being the key @@ -214,16 +214,6 @@ type snapshot struct { allFilesExcludingDefaultLibraryFile []*ast.SourceFile } -func (s *snapshot) tracksReferences() bool { - return s.options.Module != core.ModuleKindNone -} - -func (s *snapshot) createReferenceMap() { - if s.tracksReferences() { - s.referencedMap = &collections.ManyToManyMap[tspath.Path, tspath.Path]{} - } -} - func (s *snapshot) createEmitSignaturesMap() { if s.emitSignatures == nil && s.options.Composite.IsTrue() { s.emitSignatures = make(map[tspath.Path]*emitSignature) @@ -274,7 +264,6 @@ func newSnapshotForProgram(program *compiler.Program, oldProgram *Program) *snap options: program.Options(), semanticDiagnosticsPerFile: make(map[tspath.Path]*diagnosticsOrBuildInfoDiagnosticsWithFileName, len(files)), } - snapshot.createReferenceMap() if oldProgram != nil && snapshot.options.Composite.IsTrue() { snapshot.latestChangedDtsFile = oldProgram.snapshot.latestChangedDtsFile } @@ -282,8 +271,7 @@ func newSnapshotForProgram(program *compiler.Program, oldProgram *Program) *snap snapshot.checkPending = true } - canUseStateFromOldProgram := oldProgram != nil && snapshot.tracksReferences() == oldProgram.snapshot.tracksReferences() - if canUseStateFromOldProgram { + if oldProgram != nil { // Copy old snapshot's changed files set snapshot.changedFilesSet = oldProgram.snapshot.changedFilesSet.Clone() if len(oldProgram.snapshot.affectedFilesPendingEmit) != 0 { @@ -295,7 +283,7 @@ func newSnapshotForProgram(program *compiler.Program, oldProgram *Program) *snap snapshot.buildInfoEmitPending = snapshot.options.IsIncremental() } - canCopySemanticDiagnostics := canUseStateFromOldProgram && + canCopySemanticDiagnostics := oldProgram != nil && !tsoptions.CompilerOptionsAffectSemanticDiagnostics(oldProgram.snapshot.options, program.Options()) // We can only reuse emit signatures (i.e. .d.ts signatures) if the .d.ts file is unchanged, // which will eg be depedent on change in options like declarationDir and outDir options are unchanged. @@ -317,30 +305,24 @@ func newSnapshotForProgram(program *compiler.Program, oldProgram *Program) *snap impliedNodeFormat := program.GetSourceFileMetaData(file.Path()).ImpliedNodeFormat affectsGlobalScope := fileAffectsGlobalScope(file) var signature string - var newReferences *collections.Set[tspath.Path] - if snapshot.referencedMap != nil { - newReferences = getReferencedFiles(program, file) - if newReferences != nil { - snapshot.referencedMap.Add(file.Path(), newReferences) - } + newReferences := getReferencedFiles(program, file) + if newReferences != nil { + snapshot.referencedMap.Add(file.Path(), newReferences) } - if canUseStateFromOldProgram { + if oldProgram != nil { if oldFileInfo, ok := oldProgram.snapshot.fileInfos[file.Path()]; ok { signature = oldFileInfo.signature if oldFileInfo.version == version || oldFileInfo.affectsGlobalScope != affectsGlobalScope || oldFileInfo.impliedNodeFormat != impliedNodeFormat { snapshot.addFileToChangeSet(file.Path()) - } else if snapshot.referencedMap != nil { - oldReferences, _ := oldProgram.snapshot.referencedMap.GetValues(file.Path()) + } else if oldReferences, _ := oldProgram.snapshot.referencedMap.GetValues(file.Path()); !newReferences.Equals(oldReferences) { // Referenced files changed - if !newReferences.Equals(oldReferences) { - snapshot.addFileToChangeSet(file.Path()) - } else { - for refPath := range newReferences.Keys() { - if program.GetSourceFileByPath(refPath) == nil { - // Referenced file was deleted in the new program - snapshot.addFileToChangeSet(file.Path()) - break - } + snapshot.addFileToChangeSet(file.Path()) + } else if newReferences != nil { + for refPath := range newReferences.Keys() { + if program.GetSourceFileByPath(refPath) == nil { + // Referenced file was deleted in the new program + snapshot.addFileToChangeSet(file.Path()) + break } } } @@ -381,7 +363,7 @@ func newSnapshotForProgram(program *compiler.Program, oldProgram *Program) *snap impliedNodeFormat: impliedNodeFormat, } } - if canUseStateFromOldProgram { + if oldProgram != nil { // If the global file is removed, add all files as changed allFilesExcludingDefaultLibraryFileAddedToChangeSet := false for filePath, oldInfo := range oldProgram.snapshot.fileInfos { @@ -417,11 +399,10 @@ func newSnapshotForProgram(program *compiler.Program, oldProgram *Program) *snap snapshot.buildInfoEmitPending = true } } - } - if canUseStateFromOldProgram && - len(snapshot.semanticDiagnosticsPerFile) != len(snapshot.fileInfos) && - oldProgram.snapshot.checkPending != snapshot.checkPending { - snapshot.buildInfoEmitPending = true + if len(snapshot.semanticDiagnosticsPerFile) != len(snapshot.fileInfos) && + oldProgram.snapshot.checkPending != snapshot.checkPending { + snapshot.buildInfoEmitPending = true + } } return snapshot } diff --git a/internal/incremental/tobuildinfo.go b/internal/incremental/tobuildinfo.go index ebff385ec4..22345723a4 100644 --- a/internal/incremental/tobuildinfo.go +++ b/internal/incremental/tobuildinfo.go @@ -225,9 +225,6 @@ func (t *toBuildInfo) setCompilerOptions() { } func (t *toBuildInfo) setReferencedMap() { - if !t.snapshot.tracksReferences() { - return - } keys := slices.Collect(maps.Keys(t.snapshot.referencedMap.Keys())) slices.Sort(keys) t.buildInfo.ReferencedMap = core.Map(keys, func(filePath tspath.Path) *BuildInfoReferenceMapEntry { diff --git a/internal/incremental/tosnapshot.go b/internal/incremental/tosnapshot.go index 51b9517048..524279ef79 100644 --- a/internal/incremental/tosnapshot.go +++ b/internal/incremental/tosnapshot.go @@ -116,7 +116,6 @@ func (t *toSnapshot) setFileInfoAndEmitSignatures() { } func (t *toSnapshot) setReferencedMap() { - t.snapshot.createReferenceMap() for _, entry := range t.buildInfo.ReferencedMap { t.snapshot.referencedMap.Add(t.toFilePath(entry.FileId), t.toFilePathSet(entry.FileIdListId)) } From b79ef456dc9c78a0c939dd0cf4b79f3586169079 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 1 Jul 2025 12:31:44 -0700 Subject: [PATCH 25/36] Add baseline for semantic diagnostics refresh to check for correctness --- cmd/tsgo/main.go | 3 +- internal/execute/export_test.go | 19 ------ internal/execute/testsys_test.go | 27 ++++++++ internal/execute/tsc.go | 60 ++++++++--------- internal/execute/tsctestrunner_test.go | 17 +++-- internal/execute/watch.go | 56 ---------------- internal/execute/watcher.go | 67 +++++++++++++++++-- internal/incremental/affectedfileshandler.go | 7 ++ internal/incremental/program.go | 20 ++++-- ...ion-field-with-declaration-emit-enabled.js | 5 ++ ...e-to-modifier-of-class-expression-field.js | 5 ++ .../serializing-composite-project.js | 5 ++ .../incremental/serializing-error-chain.js | 4 ++ .../noEmit/when-project-has-strict-true.js | 4 ++ ...ativeImportExtensionsProjectReferences2.js | 5 ++ ...ativeImportExtensionsProjectReferences3.js | 5 ++ .../parse-tsconfig-with-typeAcquisition.js | 3 + .../Parse-watch-interval-option.js | 24 ++++++- .../watch-with-no-tsconfig.js | 4 ++ .../noEmit/dts-errors-without-dts-enabled.js | 28 ++++++++ .../reference/tscWatch/noEmit/dts-errors.js | 28 ++++++++ .../tscWatch/noEmit/semantic-errors.js | 28 ++++++++ .../tscWatch/noEmit/syntax-errors.js | 28 ++++++++ 23 files changed, 325 insertions(+), 127 deletions(-) delete mode 100644 internal/execute/export_test.go delete mode 100644 internal/execute/watch.go diff --git a/cmd/tsgo/main.go b/cmd/tsgo/main.go index 0672f1b0b5..93461aa5cd 100644 --- a/cmd/tsgo/main.go +++ b/cmd/tsgo/main.go @@ -20,5 +20,6 @@ func runMain() int { return runAPI(args[1:]) } } - return int(execute.CommandLine(newSystem(), args)) + status, _, _, _ := execute.CommandLine(newSystem(), args, false) + return int(status) } diff --git a/internal/execute/export_test.go b/internal/execute/export_test.go deleted file mode 100644 index 71010bd9d9..0000000000 --- a/internal/execute/export_test.go +++ /dev/null @@ -1,19 +0,0 @@ -package execute - -import ( - "github.com/microsoft/typescript-go/internal/tsoptions" -) - -func CommandLineTest(sys System, commandLineArgs []string) (ExitStatus, *tsoptions.ParsedCommandLine, *watcher) { - return commandLineWorker(sys, commandLineArgs) -} - -func StartForTest(w *watcher) { - // this function should perform any initializations before w.doCycle() in `start(watcher)` - w.initialize() - w.doCycle() -} - -func RunWatchCycle(w *watcher) { - w.doCycle() -} diff --git a/internal/execute/testsys_test.go b/internal/execute/testsys_test.go index 859fa3fe84..324d717b0f 100644 --- a/internal/execute/testsys_test.go +++ b/internal/execute/testsys_test.go @@ -12,6 +12,8 @@ import ( "github.com/microsoft/typescript-go/internal/collections" "github.com/microsoft/typescript-go/internal/core" + "github.com/microsoft/typescript-go/internal/execute" + "github.com/microsoft/typescript-go/internal/incremental" "github.com/microsoft/typescript-go/internal/testutil/incrementaltestutil" "github.com/microsoft/typescript-go/internal/tsoptions" "github.com/microsoft/typescript-go/internal/vfs" @@ -95,6 +97,8 @@ type testSys struct { start time.Time } +var _ execute.System = (*testSys)(nil) + func (s *testSys) Now() time.Time { // todo: make a "test time" structure return time.Now() @@ -162,6 +166,29 @@ func (s *testSys) EndWrite() { s.output = append(s.output, output) } +func (s *testSys) baselineProgram(baseline *strings.Builder, program *incremental.Program, watcher *execute.Watcher) { + if watcher != nil { + program = watcher.GetProgram() + } + if program == nil { + return + } + + baseline.WriteString("\nSemanticDiagnostics::\n") + semanticDiagnostics, diagnosticsFromOldProgram := program.GetTestingData(program.GetProgram()) + for _, file := range program.GetProgram().GetSourceFiles() { + if diagnostics, ok := semanticDiagnostics[file.Path()]; ok { + if oldDiagnostics, ok := diagnosticsFromOldProgram[file.Path()]; !ok || oldDiagnostics != diagnostics { + baseline.WriteString("*refresh* " + file.FileName() + "\n") + } + } else { + baseline.WriteString("*not cached* " + file.FileName() + "\n") + } + } + + // Write signature updates +} + func (s *testSys) serializeState(baseline *strings.Builder) { s.baselineOutput(baseline) s.baselineFSwithDiff(baseline) diff --git a/internal/execute/tsc.go b/internal/execute/tsc.go index 2a6f657a3b..71bf78b044 100644 --- a/internal/execute/tsc.go +++ b/internal/execute/tsc.go @@ -41,30 +41,25 @@ func applyBulkEdits(text string, edits []core.TextChange) string { return b.String() } -func CommandLine(sys System, commandLineArgs []string) ExitStatus { - status, _, watcher := commandLineWorker(sys, commandLineArgs) - if watcher == nil { - return status - } - return start(watcher) -} - -func commandLineWorker(sys System, commandLineArgs []string) (ExitStatus, *tsoptions.ParsedCommandLine, *watcher) { +func CommandLine(sys System, commandLineArgs []string, testing bool) (ExitStatus, *tsoptions.ParsedCommandLine, *incremental.Program, *Watcher) { if len(commandLineArgs) > 0 { // !!! build mode switch strings.ToLower(commandLineArgs[0]) { case "-b", "--b", "-build", "--build": fmt.Fprint(sys.Writer(), "Build mode is currently unsupported."+sys.NewLine()) sys.EndWrite() - return ExitStatusNotImplemented, nil, nil + return ExitStatusNotImplemented, nil, nil, nil // case "-f": // return fmtMain(sys, commandLineArgs[1], commandLineArgs[1]) } } parsedCommandLine := tsoptions.ParseCommandLine(commandLineArgs, sys) - status, watcher := tscCompilation(sys, parsedCommandLine) - return status, parsedCommandLine, watcher + status, incrementalProgram, watcher := tscCompilation(sys, parsedCommandLine, testing) + if watcher == nil { + watcher.start() + } + return status, parsedCommandLine, incrementalProgram, watcher } func fmtMain(sys System, input, output string) ExitStatus { @@ -93,7 +88,7 @@ func fmtMain(sys System, input, output string) ExitStatus { return ExitStatusSuccess } -func tscCompilation(sys System, commandLine *tsoptions.ParsedCommandLine) (ExitStatus, *watcher) { +func tscCompilation(sys System, commandLine *tsoptions.ParsedCommandLine, testing bool) (ExitStatus, *incremental.Program, *Watcher) { configFileName := "" reportDiagnostic := createDiagnosticReporter(sys, commandLine.CompilerOptions()) // if commandLine.Options().Locale != nil @@ -102,7 +97,7 @@ func tscCompilation(sys System, commandLine *tsoptions.ParsedCommandLine) (ExitS for _, e := range commandLine.Errors { reportDiagnostic(e) } - return ExitStatusDiagnosticsPresent_OutputsSkipped, nil + return ExitStatusDiagnosticsPresent_OutputsSkipped, nil, nil } if pprofDir := commandLine.CompilerOptions().PprofDir; pprofDir != "" { @@ -112,28 +107,28 @@ func tscCompilation(sys System, commandLine *tsoptions.ParsedCommandLine) (ExitS } if commandLine.CompilerOptions().Init.IsTrue() { - return ExitStatusNotImplemented, nil + return ExitStatusNotImplemented, nil, nil } if commandLine.CompilerOptions().Version.IsTrue() { printVersion(sys) - return ExitStatusSuccess, nil + return ExitStatusSuccess, nil, nil } if commandLine.CompilerOptions().Help.IsTrue() || commandLine.CompilerOptions().All.IsTrue() { printHelp(sys, commandLine) - return ExitStatusSuccess, nil + return ExitStatusSuccess, nil, nil } if commandLine.CompilerOptions().Watch.IsTrue() && commandLine.CompilerOptions().ListFilesOnly.IsTrue() { reportDiagnostic(ast.NewCompilerDiagnostic(diagnostics.Options_0_and_1_cannot_be_combined, "watch", "listFilesOnly")) - return ExitStatusDiagnosticsPresent_OutputsSkipped, nil + return ExitStatusDiagnosticsPresent_OutputsSkipped, nil, nil } if commandLine.CompilerOptions().Project != "" { if len(commandLine.FileNames()) != 0 { reportDiagnostic(ast.NewCompilerDiagnostic(diagnostics.Option_project_cannot_be_mixed_with_source_files_on_a_command_line)) - return ExitStatusDiagnosticsPresent_OutputsSkipped, nil + return ExitStatusDiagnosticsPresent_OutputsSkipped, nil, nil } fileOrDirectory := tspath.NormalizePath(commandLine.CompilerOptions().Project) @@ -141,13 +136,13 @@ func tscCompilation(sys System, commandLine *tsoptions.ParsedCommandLine) (ExitS configFileName = tspath.CombinePaths(fileOrDirectory, "tsconfig.json") if !sys.FS().FileExists(configFileName) { reportDiagnostic(ast.NewCompilerDiagnostic(diagnostics.Cannot_find_a_tsconfig_json_file_at_the_current_directory_Colon_0, configFileName)) - return ExitStatusDiagnosticsPresent_OutputsSkipped, nil + return ExitStatusDiagnosticsPresent_OutputsSkipped, nil, nil } } else { configFileName = fileOrDirectory if !sys.FS().FileExists(configFileName) { reportDiagnostic(ast.NewCompilerDiagnostic(diagnostics.The_specified_path_does_not_exist_Colon_0, fileOrDirectory)) - return ExitStatusDiagnosticsPresent_OutputsSkipped, nil + return ExitStatusDiagnosticsPresent_OutputsSkipped, nil, nil } } } else if len(commandLine.FileNames()) == 0 { @@ -162,7 +157,7 @@ func tscCompilation(sys System, commandLine *tsoptions.ParsedCommandLine) (ExitS printVersion(sys) printHelp(sys, commandLine) } - return ExitStatusDiagnosticsPresent_OutputsSkipped, nil + return ExitStatusDiagnosticsPresent_OutputsSkipped, nil, nil } // !!! convert to options with absolute paths is usually done here, but for ease of implementation, it's done in `tsoptions.ParseCommandLine()` @@ -179,7 +174,7 @@ func tscCompilation(sys System, commandLine *tsoptions.ParsedCommandLine) (ExitS for _, e := range errors { reportDiagnostic(e) } - return ExitStatusDiagnosticsPresent_OutputsGenerated, nil + return ExitStatusDiagnosticsPresent_OutputsGenerated, nil, nil } configForCompilation = configParseResult // Updater to reflect pretty @@ -188,18 +183,20 @@ func tscCompilation(sys System, commandLine *tsoptions.ParsedCommandLine) (ExitS if compilerOptionsFromCommandLine.ShowConfig.IsTrue() { showConfig(sys, configForCompilation.CompilerOptions()) - return ExitStatusSuccess, nil + return ExitStatusSuccess, nil, nil } if configForCompilation.CompilerOptions().Watch.IsTrue() { - return ExitStatusSuccess, createWatcher(sys, configForCompilation, reportDiagnostic) + return ExitStatusSuccess, nil, createWatcher(sys, configForCompilation, reportDiagnostic, testing) } else if configForCompilation.CompilerOptions().IsIncremental() { - return performIncrementalCompilation( + exitStatus, program := performIncrementalCompilation( sys, configForCompilation, reportDiagnostic, &extendedConfigCache, configTime, - ), nil + testing, + ) + return exitStatus, program, nil } return performCompilation( sys, @@ -207,7 +204,7 @@ func tscCompilation(sys System, commandLine *tsoptions.ParsedCommandLine) (ExitS reportDiagnostic, &extendedConfigCache, configTime, - ), nil + ), nil, nil } func findConfigFile(searchPath string, fileExists func(string) bool, configName string) string { @@ -230,7 +227,8 @@ func performIncrementalCompilation( reportDiagnostic diagnosticReporter, extendedConfigCache *collections.SyncMap[tspath.Path, *tsoptions.ExtendedConfigCacheEntry], configTime time.Duration, -) ExitStatus { + testing bool, +) (ExitStatus, *incremental.Program) { host := compiler.NewCachedFSCompilerHost(config.CompilerOptions(), sys.GetCurrentDirectory(), sys.FS(), sys.DefaultLibraryPath(), extendedConfigCache) oldProgram := incremental.ReadBuildInfoProgram(config, incremental.NewBuildInfoReader(host)) // todo: cache, statistics, tracing @@ -241,7 +239,7 @@ func performIncrementalCompilation( JSDocParsingMode: ast.JSDocParsingModeParseForTypeErrors, }) parseTime := sys.Now().Sub(parseStart) - incrementalProgram := incremental.NewProgram(program, oldProgram) + incrementalProgram := incremental.NewProgram(program, oldProgram, testing) return emitAndReportStatistics( sys, incrementalProgram, @@ -250,7 +248,7 @@ func performIncrementalCompilation( reportDiagnostic, configTime, parseTime, - ) + ), incrementalProgram } func performCompilation( diff --git a/internal/execute/tsctestrunner_test.go b/internal/execute/tsctestrunner_test.go index aff81187f4..abdc09bb98 100644 --- a/internal/execute/tsctestrunner_test.go +++ b/internal/execute/tsctestrunner_test.go @@ -9,6 +9,7 @@ import ( "testing" "github.com/microsoft/typescript-go/internal/execute" + "github.com/microsoft/typescript-go/internal/incremental" "github.com/microsoft/typescript-go/internal/testutil/baseline" ) @@ -34,30 +35,28 @@ func (test *tscInput) run(t *testing.T, scenario string) { // initial test tsc compile baselineBuilder := test.startBaseline() - exit, parsedCommandLine, watcher := execute.CommandLineTest(test.sys, test.commandLineArgs) + exit, parsedCommandLine, incrementalProgram, watcher := execute.CommandLine(test.sys, test.commandLineArgs, true) baselineBuilder.WriteString("ExitStatus:: " + fmt.Sprint(exit)) compilerOptionsString, _ := json.MarshalIndent(parsedCommandLine.CompilerOptions(), "", " ") baselineBuilder.WriteString("\n\nCompilerOptions::") baselineBuilder.Write(compilerOptionsString) - if watcher != nil { - execute.StartForTest(watcher) - } - test.sys.serializeState(baselineBuilder) - + test.sys.baselineProgram(baselineBuilder, incrementalProgram, watcher) for _, do := range test.edits { do.edit(test.sys) baselineBuilder.WriteString("\n\nEdit:: " + do.caption + "\n") + var incrementalProgram *incremental.Program if watcher == nil { - exit, parsedCommandLine, watcher = execute.CommandLineTest(test.sys, test.commandLineArgs) + exit, parsedCommandLine, incrementalProgram, watcher = execute.CommandLine(test.sys, test.commandLineArgs, true) baselineBuilder.WriteString("ExitStatus:: " + fmt.Sprint(exit)) } else { - execute.RunWatchCycle(watcher) + watcher.DoCycle() } test.sys.serializeState(baselineBuilder) + test.sys.baselineProgram(baselineBuilder, incrementalProgram, watcher) } options, name := test.getBaselineName(scenario, "") @@ -117,7 +116,7 @@ func (test *tscInput) verifyCommandLineParsing(t *testing.T, scenario string) { // initial test tsc compile baselineBuilder := test.startBaseline() - exit, parsedCommandLine, _ := execute.CommandLineTest(test.sys, test.commandLineArgs) + exit, parsedCommandLine, _, _ := execute.CommandLine(test.sys, test.commandLineArgs, true) baselineBuilder.WriteString("ExitStatus:: " + fmt.Sprint(exit)) //nolint:musttag parsedCommandLineString, _ := json.MarshalIndent(parsedCommandLine, "", " ") diff --git a/internal/execute/watch.go b/internal/execute/watch.go deleted file mode 100644 index 191d3a69db..0000000000 --- a/internal/execute/watch.go +++ /dev/null @@ -1,56 +0,0 @@ -package execute - -import ( - "fmt" - "time" - - "github.com/microsoft/typescript-go/internal/ast" - "github.com/microsoft/typescript-go/internal/compiler" - "github.com/microsoft/typescript-go/internal/incremental" -) - -func start(w *watcher) ExitStatus { - w.initialize() - - watchInterval := 1000 * time.Millisecond - if w.options.ParsedConfig.WatchOptions != nil { - watchInterval = time.Duration(*w.options.ParsedConfig.WatchOptions.Interval) * time.Millisecond - } - for { - w.doCycle() - time.Sleep(watchInterval) - } -} - -func (w *watcher) initialize() { - // if this function is updated, make sure to update `StartForTest` in export_test.go as needed - if w.configFileName == "" { - w.host = compiler.NewCompilerHost(w.options.CompilerOptions(), w.sys.GetCurrentDirectory(), w.sys.FS(), w.sys.DefaultLibraryPath(), nil) - } - w.program = incremental.ReadBuildInfoProgram(w.options, incremental.NewBuildInfoReader(w.host)) -} - -func (w *watcher) doCycle() { - // if this function is updated, make sure to update `RunWatchCycle` in export_test.go as needed - - if w.hasErrorsInTsConfig() { - // these are unrecoverable errors--report them and do not build - return - } - // updateProgram() - w.program = incremental.NewProgram(compiler.NewProgram(compiler.ProgramOptions{ - Config: w.options, - Host: w.host, - JSDocParsingMode: ast.JSDocParsingModeParseForTypeErrors, - }), w.program) - - if w.hasBeenModified(w.program.GetProgram()) { - fmt.Fprint(w.sys.Writer(), "build starting at ", w.sys.Now(), w.sys.NewLine()) - timeStart := w.sys.Now() - w.compileAndEmit() - fmt.Fprint(w.sys.Writer(), "build finished in ", w.sys.Now().Sub(timeStart), w.sys.NewLine()) - } else { - // print something??? - // fmt.Fprint(w.sys.Writer(), "no changes detected at ", w.sys.Now(), w.sys.NewLine()) - } -} diff --git a/internal/execute/watcher.go b/internal/execute/watcher.go index 445e3cab0c..18b92a157a 100644 --- a/internal/execute/watcher.go +++ b/internal/execute/watcher.go @@ -1,9 +1,11 @@ package execute import ( + "fmt" "reflect" "time" + "github.com/microsoft/typescript-go/internal/ast" "github.com/microsoft/typescript-go/internal/collections" "github.com/microsoft/typescript-go/internal/compiler" "github.com/microsoft/typescript-go/internal/core" @@ -12,11 +14,12 @@ import ( "github.com/microsoft/typescript-go/internal/tspath" ) -type watcher struct { +type Watcher struct { sys System configFileName string options *tsoptions.ParsedCommandLine reportDiagnostic diagnosticReporter + testing bool host compiler.CompilerHost program *incremental.Program @@ -24,11 +27,12 @@ type watcher struct { configModified bool } -func createWatcher(sys System, configParseResult *tsoptions.ParsedCommandLine, reportDiagnostic diagnosticReporter) *watcher { - w := &watcher{ +func createWatcher(sys System, configParseResult *tsoptions.ParsedCommandLine, reportDiagnostic diagnosticReporter, testing bool) *Watcher { + w := &Watcher{ sys: sys, options: configParseResult, reportDiagnostic: reportDiagnostic, + testing: testing, // reportWatchStatus: createWatchStatusReporter(sys, configParseResult.CompilerOptions().Pretty), } if configParseResult.ConfigFile != nil { @@ -37,13 +41,60 @@ func createWatcher(sys System, configParseResult *tsoptions.ParsedCommandLine, r return w } -func (w *watcher) compileAndEmit() { +func (w *Watcher) start() { + // if this function is updated, make sure to update `StartForTest` in export_test.go as needed + if w.configFileName == "" { + w.host = compiler.NewCompilerHost(w.options.CompilerOptions(), w.sys.GetCurrentDirectory(), w.sys.FS(), w.sys.DefaultLibraryPath(), nil) + } + w.program = incremental.ReadBuildInfoProgram(w.options, incremental.NewBuildInfoReader(w.host)) + + if !w.testing { + watchInterval := 1000 * time.Millisecond + if w.options.ParsedConfig.WatchOptions != nil { + watchInterval = time.Duration(*w.options.ParsedConfig.WatchOptions.Interval) * time.Millisecond + } + for { + w.DoCycle() + time.Sleep(watchInterval) + } + } else { + // Initial compilation in test mode + w.DoCycle() + } +} + +func (w *Watcher) DoCycle() { + // if this function is updated, make sure to update `RunWatchCycle` in export_test.go as needed + + if w.hasErrorsInTsConfig() { + // these are unrecoverable errors--report them and do not build + return + } + // updateProgram() + w.program = incremental.NewProgram(compiler.NewProgram(compiler.ProgramOptions{ + Config: w.options, + Host: w.host, + JSDocParsingMode: ast.JSDocParsingModeParseForTypeErrors, + }), w.program, w.testing) + + if w.hasBeenModified(w.program.GetProgram()) { + fmt.Fprint(w.sys.Writer(), "build starting at ", w.sys.Now(), w.sys.NewLine()) + timeStart := w.sys.Now() + w.compileAndEmit() + fmt.Fprint(w.sys.Writer(), "build finished in ", w.sys.Now().Sub(timeStart), w.sys.NewLine()) + } else { + // print something??? + // fmt.Fprint(w.sys.Writer(), "no changes detected at ", w.sys.Now(), w.sys.NewLine()) + } +} + +func (w *Watcher) compileAndEmit() { // !!! output/error reporting is currently the same as non-watch mode // diagnostics, emitResult, exitStatus := emitFilesAndReportErrors(w.sys, w.program, w.reportDiagnostic) } -func (w *watcher) hasErrorsInTsConfig() bool { +func (w *Watcher) hasErrorsInTsConfig() bool { // only need to check and reparse tsconfig options/update host if we are watching a config file if w.configFileName != "" { extendedConfigCache := collections.SyncMap[tspath.Path, *tsoptions.ExtendedConfigCacheEntry]{} @@ -66,7 +117,7 @@ func (w *watcher) hasErrorsInTsConfig() bool { return false } -func (w *watcher) hasBeenModified(program *compiler.Program) bool { +func (w *Watcher) hasBeenModified(program *compiler.Program) bool { // checks watcher's snapshot against program file modified times currState := map[string]time.Time{} filesModified := w.configModified @@ -98,3 +149,7 @@ func (w *watcher) hasBeenModified(program *compiler.Program) bool { w.configModified = false return filesModified } + +func (w *Watcher) GetProgram() *incremental.Program { + return w.program +} diff --git a/internal/incremental/affectedfileshandler.go b/internal/incremental/affectedfileshandler.go index c4ffb74766..e64c4f4059 100644 --- a/internal/incremental/affectedfileshandler.go +++ b/internal/incremental/affectedfileshandler.go @@ -5,6 +5,7 @@ import ( "crypto/sha256" "fmt" "maps" + "os" "slices" "strings" "sync" @@ -327,6 +328,8 @@ func (h *affectedFilesHandler) updateSnapshot() { if h.ctx.Err() != nil { return } + h.program.program.Host().Trace(fmt.Sprintf("testMode : %v\n", isTestMode())) + h.updatedSignatures.Range(func(filePath tspath.Path, signature string) bool { h.program.snapshot.fileInfos[filePath].signature = signature return true @@ -344,6 +347,10 @@ func (h *affectedFilesHandler) updateSnapshot() { h.program.snapshot.buildInfoEmitPending = true } +func isTestMode() bool { + return os.Getenv("APP_ENV") == "test" +} + func collectAllAffectedFiles(ctx context.Context, program *Program) { if program.snapshot.changedFilesSet.Len() == 0 { return diff --git a/internal/incremental/program.go b/internal/incremental/program.go index 0beb5d571e..b0f1aa43f6 100644 --- a/internal/incremental/program.go +++ b/internal/incremental/program.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + "maps" "slices" "github.com/microsoft/typescript-go/internal/ast" @@ -15,17 +16,28 @@ import ( ) type Program struct { - snapshot *snapshot - program *compiler.Program + snapshot *snapshot + program *compiler.Program + semanticDiagnosticsPerFile map[tspath.Path]*diagnosticsOrBuildInfoDiagnosticsWithFileName } var _ compiler.AnyProgram = (*Program)(nil) -func NewProgram(program *compiler.Program, oldProgram *Program) *Program { - return &Program{ +func NewProgram(program *compiler.Program, oldProgram *Program, testing bool) *Program { + incrementalProgram := &Program{ snapshot: newSnapshotForProgram(program, oldProgram), program: program, } + + if testing { + incrementalProgram.semanticDiagnosticsPerFile = maps.Clone(incrementalProgram.snapshot.semanticDiagnosticsPerFile) + // !! signatures + } + return incrementalProgram +} + +func (h *Program) GetTestingData(program *compiler.Program) (map[tspath.Path]*diagnosticsOrBuildInfoDiagnosticsWithFileName, map[tspath.Path]*diagnosticsOrBuildInfoDiagnosticsWithFileName) { + return h.snapshot.semanticDiagnosticsPerFile, h.semanticDiagnosticsPerFile } func (h *Program) panicIfNoProgram(method string) { diff --git a/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js index 2fb4e35c61..99a1c0bd1d 100644 --- a/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js +++ b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js @@ -142,3 +142,8 @@ export {}; "size": 697 } + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/MessageablePerson.ts +*refresh* /home/src/workspaces/project/main.ts diff --git a/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js index a968da6745..09b4e47d3d 100644 --- a/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js +++ b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js @@ -119,3 +119,8 @@ export {}; "size": 452 } + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/MessageablePerson.ts +*refresh* /home/src/workspaces/project/main.ts diff --git a/testdata/baselines/reference/tsc/incremental/serializing-composite-project.js b/testdata/baselines/reference/tsc/incremental/serializing-composite-project.js index 27b2eef10c..e2850c4b40 100644 --- a/testdata/baselines/reference/tsc/incremental/serializing-composite-project.js +++ b/testdata/baselines/reference/tsc/incremental/serializing-composite-project.js @@ -109,3 +109,8 @@ export const b = 2; "size": 693 } + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/index.tsx +*refresh* /home/src/workspaces/project/other.ts diff --git a/testdata/baselines/reference/tsc/incremental/serializing-error-chain.js b/testdata/baselines/reference/tsc/incremental/serializing-error-chain.js index accdb27bb2..f1656c7942 100644 --- a/testdata/baselines/reference/tsc/incremental/serializing-error-chain.js +++ b/testdata/baselines/reference/tsc/incremental/serializing-error-chain.js @@ -175,3 +175,7 @@ declare const console: { log(msg: any): void; }; "size": 1181 } + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/index.tsx diff --git a/testdata/baselines/reference/tsc/noEmit/when-project-has-strict-true.js b/testdata/baselines/reference/tsc/noEmit/when-project-has-strict-true.js index 6b5f2965c2..9ace285972 100644 --- a/testdata/baselines/reference/tsc/noEmit/when-project-has-strict-true.js +++ b/testdata/baselines/reference/tsc/noEmit/when-project-has-strict-true.js @@ -83,3 +83,7 @@ declare const console: { log(msg: any): void; }; "size": 351 } + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/class1.ts diff --git a/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences2.js b/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences2.js index a31cd04006..83ffa665fb 100644 --- a/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences2.js +++ b/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences2.js @@ -132,3 +132,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); "size": 739 } + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.esnext.full.d.ts +*refresh* /home/src/workspaces/solution/dist/compiler/parser.d.ts +*refresh* /home/src/workspaces/solution/src/services/services.ts diff --git a/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences3.js b/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences3.js index d2cec80dee..b202783bc5 100644 --- a/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences3.js +++ b/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences3.js @@ -136,3 +136,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); "size": 748 } + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.esnext.full.d.ts +*refresh* /home/src/workspaces/solution/dist/compiler/parser.d.ts +*refresh* /home/src/workspaces/solution/src/services/services.ts diff --git a/testdata/baselines/reference/tsc/typeAcquisition/parse-tsconfig-with-typeAcquisition.js b/testdata/baselines/reference/tsc/typeAcquisition/parse-tsconfig-with-typeAcquisition.js index afa79a4670..41542cf07d 100644 --- a/testdata/baselines/reference/tsc/typeAcquisition/parse-tsconfig-with-typeAcquisition.js +++ b/testdata/baselines/reference/tsc/typeAcquisition/parse-tsconfig-with-typeAcquisition.js @@ -78,3 +78,6 @@ declare const console: { log(msg: any): void; }; "size": 275 } + +SemanticDiagnostics:: +*not cached* /home/src/tslibs/TS/Lib/lib.d.ts diff --git a/testdata/baselines/reference/tscWatch/commandLine/Parse-watch-interval-option.js b/testdata/baselines/reference/tscWatch/commandLine/Parse-watch-interval-option.js index bdc7fcbf78..456be36e94 100644 --- a/testdata/baselines/reference/tscWatch/commandLine/Parse-watch-interval-option.js +++ b/testdata/baselines/reference/tscWatch/commandLine/Parse-watch-interval-option.js @@ -36,5 +36,27 @@ ParsedCommandLine::{ "compileOnSave": null } Output:: -No output +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; diff --git a/testdata/baselines/reference/tscWatch/commandLineWatch/watch-with-no-tsconfig.js b/testdata/baselines/reference/tscWatch/commandLineWatch/watch-with-no-tsconfig.js index cdcd875587..8d85748e31 100644 --- a/testdata/baselines/reference/tscWatch/commandLineWatch/watch-with-no-tsconfig.js +++ b/testdata/baselines/reference/tscWatch/commandLineWatch/watch-with-no-tsconfig.js @@ -37,3 +37,7 @@ declare const console: { log(msg: any): void; }; //// [/home/src/workspaces/project/index.js] *new* + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/index.ts diff --git a/testdata/baselines/reference/tscWatch/noEmit/dts-errors-without-dts-enabled.js b/testdata/baselines/reference/tscWatch/noEmit/dts-errors-without-dts-enabled.js index 4950a35e09..72240c81ae 100644 --- a/testdata/baselines/reference/tscWatch/noEmit/dts-errors-without-dts-enabled.js +++ b/testdata/baselines/reference/tscWatch/noEmit/dts-errors-without-dts-enabled.js @@ -42,6 +42,10 @@ interface Symbol { declare const console: { log(msg: any): void; }; +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/a.ts + Edit:: fix syntax error @@ -50,6 +54,10 @@ Output:: const a = "hello"; +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/a.ts + Edit:: emit after fixing error @@ -65,6 +73,10 @@ const a = "hello"; } +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/a.ts + Edit:: no emit run after fixing error @@ -78,6 +90,10 @@ Output:: } +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/a.ts + Edit:: introduce error @@ -86,6 +102,10 @@ Output:: const a = class { private p = 10; }; +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/a.ts + Edit:: emit when error @@ -103,6 +123,10 @@ const a = class { } +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/a.ts + Edit:: no emit run when error @@ -115,3 +139,7 @@ Output:: } } + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/a.ts diff --git a/testdata/baselines/reference/tscWatch/noEmit/dts-errors.js b/testdata/baselines/reference/tscWatch/noEmit/dts-errors.js index ec0b1bc5c1..d8d67492f0 100644 --- a/testdata/baselines/reference/tscWatch/noEmit/dts-errors.js +++ b/testdata/baselines/reference/tscWatch/noEmit/dts-errors.js @@ -55,6 +55,10 @@ interface Symbol { declare const console: { log(msg: any): void; }; +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/a.ts + Edit:: fix syntax error @@ -63,6 +67,10 @@ Output:: const a = "hello"; +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/a.ts + Edit:: emit after fixing error @@ -81,6 +89,10 @@ const a = "hello"; } +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/a.ts + Edit:: no emit run after fixing error @@ -94,6 +106,10 @@ Output:: } +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/a.ts + Edit:: introduce error @@ -114,6 +130,10 @@ Found 1 error in a.ts:1 const a = class { private p = 10; }; +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/a.ts + Edit:: emit when error @@ -150,6 +170,10 @@ const a = class { } +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/a.ts + Edit:: no emit run when error @@ -174,3 +198,7 @@ Found 1 error in a.ts:1 } } + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/a.ts diff --git a/testdata/baselines/reference/tscWatch/noEmit/semantic-errors.js b/testdata/baselines/reference/tscWatch/noEmit/semantic-errors.js index bcbdb93290..dc98a8043c 100644 --- a/testdata/baselines/reference/tscWatch/noEmit/semantic-errors.js +++ b/testdata/baselines/reference/tscWatch/noEmit/semantic-errors.js @@ -50,6 +50,10 @@ interface Symbol { declare const console: { log(msg: any): void; }; +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/a.ts + Edit:: fix syntax error @@ -58,6 +62,10 @@ Output:: const a = "hello"; +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/a.ts + Edit:: emit after fixing error @@ -73,6 +81,10 @@ const a = "hello"; } +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/a.ts + Edit:: no emit run after fixing error @@ -86,6 +98,10 @@ Output:: } +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/a.ts + Edit:: introduce error @@ -102,6 +118,10 @@ Found 1 error in a.ts:1 const a: number = "hello" +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/a.ts + Edit:: emit when error @@ -123,6 +143,10 @@ Found 1 error in a.ts:1 } +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/a.ts + Edit:: no emit run when error @@ -143,3 +167,7 @@ Found 1 error in a.ts:1 } } + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/a.ts diff --git a/testdata/baselines/reference/tscWatch/noEmit/syntax-errors.js b/testdata/baselines/reference/tscWatch/noEmit/syntax-errors.js index 8ff8dd6a64..badd3b020f 100644 --- a/testdata/baselines/reference/tscWatch/noEmit/syntax-errors.js +++ b/testdata/baselines/reference/tscWatch/noEmit/syntax-errors.js @@ -50,6 +50,10 @@ interface Symbol { declare const console: { log(msg: any): void; }; +SemanticDiagnostics:: +*not cached* /home/src/tslibs/TS/Lib/lib.d.ts +*not cached* /home/src/workspaces/project/a.ts + Edit:: fix syntax error @@ -58,6 +62,10 @@ Output:: const a = "hello"; +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/a.ts + Edit:: emit after fixing error @@ -73,6 +81,10 @@ const a = "hello"; } +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/a.ts + Edit:: no emit run after fixing error @@ -86,6 +98,10 @@ Output:: } +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/a.ts + Edit:: introduce error @@ -102,6 +118,10 @@ Found 1 error in a.ts:1 const a = "hello +SemanticDiagnostics:: +*not cached* /home/src/tslibs/TS/Lib/lib.d.ts +*not cached* /home/src/workspaces/project/a.ts + Edit:: emit when error @@ -125,6 +145,10 @@ const a = "hello; } +SemanticDiagnostics:: +*not cached* /home/src/tslibs/TS/Lib/lib.d.ts +*not cached* /home/src/workspaces/project/a.ts + Edit:: no emit run when error @@ -145,3 +169,7 @@ Found 1 error in a.ts:1 } } + +SemanticDiagnostics:: +*not cached* /home/src/tslibs/TS/Lib/lib.d.ts +*not cached* /home/src/workspaces/project/a.ts From a715d9bf50b47206274d9e8171fd7f59c40ddbcb Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 1 Jul 2025 12:37:00 -0700 Subject: [PATCH 26/36] No need for scenario name in test name --- internal/execute/tsctestrunner_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/execute/tsctestrunner_test.go b/internal/execute/tsctestrunner_test.go index abdc09bb98..36035ff43d 100644 --- a/internal/execute/tsctestrunner_test.go +++ b/internal/execute/tsctestrunner_test.go @@ -28,7 +28,7 @@ type tscInput struct { func (test *tscInput) run(t *testing.T, scenario string) { t.Helper() - t.Run(test.getTestName(scenario), func(t *testing.T) { + t.Run(test.getTestName(), func(t *testing.T) { t.Parallel() t.Run("tsc baseline", func(t *testing.T) { t.Parallel() @@ -83,8 +83,8 @@ func (test *tscInput) getTestNamePrefix() string { return commandName + w } -func (test *tscInput) getTestName(scenario string) string { - return test.getTestNamePrefix() + " " + scenario + ":: " + test.subScenario + " " + strings.Join(test.commandLineArgs, " ") +func (test *tscInput) getTestName() string { + return test.subScenario + " " + strings.Join(test.commandLineArgs, " ") } func (test *tscInput) getBaselineName(scenario string, suffix string) (baseline.Options, string) { @@ -109,7 +109,7 @@ func (test *tscInput) startBaseline() *strings.Builder { func (test *tscInput) verifyCommandLineParsing(t *testing.T, scenario string) { t.Helper() - t.Run(test.getTestName(scenario), func(t *testing.T) { + t.Run(test.getTestName(), func(t *testing.T) { t.Parallel() t.Run("baseline for the tsc compiles", func(t *testing.T) { t.Parallel() From 5e0186710778e24d479112d33e198199cfbd6503 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 1 Jul 2025 12:57:51 -0700 Subject: [PATCH 27/36] Baseline signature compute --- internal/execute/testsys_test.go | 15 +++++++++++- internal/incremental/affectedfileshandler.go | 21 +++++++++------- internal/incremental/emitfileshandler.go | 3 +++ internal/incremental/program.go | 16 ++++++++++--- ...ion-field-with-declaration-emit-enabled.js | 4 ++++ ...e-to-modifier-of-class-expression-field.js | 2 ++ .../serializing-composite-project.js | 4 ++++ .../incremental/serializing-error-chain.js | 2 ++ .../noEmit/when-project-has-strict-true.js | 2 ++ ...ativeImportExtensionsProjectReferences2.js | 3 +++ ...ativeImportExtensionsProjectReferences3.js | 3 +++ .../parse-tsconfig-with-typeAcquisition.js | 2 ++ .../watch-with-no-tsconfig.js | 2 ++ .../noEmit/dts-errors-without-dts-enabled.js | 24 +++++++++++++++++++ .../reference/tscWatch/noEmit/dts-errors.js | 24 +++++++++++++++++++ .../tscWatch/noEmit/semantic-errors.js | 24 +++++++++++++++++++ .../tscWatch/noEmit/syntax-errors.js | 21 ++++++++++++++++ 17 files changed, 160 insertions(+), 12 deletions(-) diff --git a/internal/execute/testsys_test.go b/internal/execute/testsys_test.go index 324d717b0f..068ee4fdd9 100644 --- a/internal/execute/testsys_test.go +++ b/internal/execute/testsys_test.go @@ -175,7 +175,7 @@ func (s *testSys) baselineProgram(baseline *strings.Builder, program *incrementa } baseline.WriteString("\nSemanticDiagnostics::\n") - semanticDiagnostics, diagnosticsFromOldProgram := program.GetTestingData(program.GetProgram()) + semanticDiagnostics, diagnosticsFromOldProgram, updatedSignatureKinds := program.GetTestingData(program.GetProgram()) for _, file := range program.GetProgram().GetSourceFiles() { if diagnostics, ok := semanticDiagnostics[file.Path()]; ok { if oldDiagnostics, ok := diagnosticsFromOldProgram[file.Path()]; !ok || oldDiagnostics != diagnostics { @@ -187,6 +187,19 @@ func (s *testSys) baselineProgram(baseline *strings.Builder, program *incrementa } // Write signature updates + baseline.WriteString("\nSignatures::\n") + for _, file := range program.GetProgram().GetSourceFiles() { + if kind, loaded := updatedSignatureKinds.Load(file.Path()); loaded { + switch kind { + case incremental.SignatureUpdateKindComputedDts: + baseline.WriteString("(computed .d.ts) " + file.FileName() + "\n") + case incremental.SignatureUpdateKindStoredAtEmit: + baseline.WriteString("(stored at emit) " + file.FileName() + "\n") + case incremental.SignatureUpdateKindUsedVersion: + baseline.WriteString("(used version) " + file.FileName() + "\n") + } + } + } } func (s *testSys) serializeState(baseline *strings.Builder) { diff --git a/internal/incremental/affectedfileshandler.go b/internal/incremental/affectedfileshandler.go index e64c4f4059..9b512a4482 100644 --- a/internal/incremental/affectedfileshandler.go +++ b/internal/incremental/affectedfileshandler.go @@ -5,7 +5,6 @@ import ( "crypto/sha256" "fmt" "maps" - "os" "slices" "strings" "sync" @@ -30,6 +29,7 @@ type affectedFilesHandler struct { program *Program hasAllFilesExcludingDefaultLibraryFile atomic.Bool updatedSignatures collections.SyncMap[tspath.Path, string] + updatedSignatureKinds *collections.SyncMap[tspath.Path, SignatureUpdateKind] dtsMayChange []dtsMayChange filesToRemoveDiagnostics collections.SyncSet[tspath.Path] cleanedDiagnosticsOfLibFiles sync.Once @@ -87,14 +87,19 @@ func (h *affectedFilesHandler) updateShapeSignature(file *ast.SourceFile, useFil info := h.program.snapshot.fileInfos[file.Path()] prevSignature := info.signature var latestSignature string + var updateKind SignatureUpdateKind if !file.IsDeclarationFile && !useFileVersionAsSignature { latestSignature = h.computeDtsSignature(file) } // Default is to use file version as signature if latestSignature == "" { latestSignature = info.version + updateKind = SignatureUpdateKindUsedVersion } h.updatedSignatures.Store(file.Path(), latestSignature) + if h.updatedSignatureKinds != nil { + h.updatedSignatureKinds.Store(file.Path(), updateKind) + } return latestSignature != prevSignature } @@ -328,12 +333,16 @@ func (h *affectedFilesHandler) updateSnapshot() { if h.ctx.Err() != nil { return } - h.program.program.Host().Trace(fmt.Sprintf("testMode : %v\n", isTestMode())) - h.updatedSignatures.Range(func(filePath tspath.Path, signature string) bool { h.program.snapshot.fileInfos[filePath].signature = signature return true }) + if h.updatedSignatureKinds != nil { + h.updatedSignatureKinds.Range(func(filePath tspath.Path, kind SignatureUpdateKind) bool { + h.program.updatedSignatureKinds.Store(filePath, kind) + return true + }) + } h.filesToRemoveDiagnostics.Range(func(file tspath.Path) bool { delete(h.program.snapshot.semanticDiagnosticsPerFile, file) return true @@ -347,16 +356,12 @@ func (h *affectedFilesHandler) updateSnapshot() { h.program.snapshot.buildInfoEmitPending = true } -func isTestMode() bool { - return os.Getenv("APP_ENV") == "test" -} - func collectAllAffectedFiles(ctx context.Context, program *Program) { if program.snapshot.changedFilesSet.Len() == 0 { return } - handler := affectedFilesHandler{ctx: ctx, program: program} + handler := affectedFilesHandler{ctx: ctx, program: program, updatedSignatureKinds: core.IfElse(program.updatedSignatureKinds == nil, nil, &collections.SyncMap[tspath.Path, SignatureUpdateKind]{})} wg := core.NewWorkGroup(handler.program.program.SingleThreaded()) var result collections.SyncSet[*ast.SourceFile] for file := range program.snapshot.changedFilesSet.Keys() { diff --git a/internal/incremental/emitfileshandler.go b/internal/incremental/emitfileshandler.go index cc4d0d658c..bd88e9fdf9 100644 --- a/internal/incremental/emitfileshandler.go +++ b/internal/incremental/emitfileshandler.go @@ -217,6 +217,9 @@ func (h *emitFilesHandler) updateSnapshot() []*compiler.EmitResult { h.signatures.Range(func(file tspath.Path, signature string) bool { info := h.program.snapshot.fileInfos[file] info.signature = signature + if h.program.updatedSignatureKinds != nil { + h.program.updatedSignatureKinds.Store(file, SignatureUpdateKindStoredAtEmit) + } h.program.snapshot.buildInfoEmitPending = true return true }) diff --git a/internal/incremental/program.go b/internal/incremental/program.go index b0f1aa43f6..a463df27d3 100644 --- a/internal/incremental/program.go +++ b/internal/incremental/program.go @@ -8,6 +8,7 @@ import ( "slices" "github.com/microsoft/typescript-go/internal/ast" + "github.com/microsoft/typescript-go/internal/collections" "github.com/microsoft/typescript-go/internal/compiler" "github.com/microsoft/typescript-go/internal/core" "github.com/microsoft/typescript-go/internal/diagnostics" @@ -15,10 +16,19 @@ import ( "github.com/microsoft/typescript-go/internal/tspath" ) +type SignatureUpdateKind byte + +const ( + SignatureUpdateKindComputedDts SignatureUpdateKind = iota + SignatureUpdateKindStoredAtEmit + SignatureUpdateKindUsedVersion +) + type Program struct { snapshot *snapshot program *compiler.Program semanticDiagnosticsPerFile map[tspath.Path]*diagnosticsOrBuildInfoDiagnosticsWithFileName + updatedSignatureKinds *collections.SyncMap[tspath.Path, SignatureUpdateKind] } var _ compiler.AnyProgram = (*Program)(nil) @@ -31,13 +41,13 @@ func NewProgram(program *compiler.Program, oldProgram *Program, testing bool) *P if testing { incrementalProgram.semanticDiagnosticsPerFile = maps.Clone(incrementalProgram.snapshot.semanticDiagnosticsPerFile) - // !! signatures + incrementalProgram.updatedSignatureKinds = &collections.SyncMap[tspath.Path, SignatureUpdateKind]{} } return incrementalProgram } -func (h *Program) GetTestingData(program *compiler.Program) (map[tspath.Path]*diagnosticsOrBuildInfoDiagnosticsWithFileName, map[tspath.Path]*diagnosticsOrBuildInfoDiagnosticsWithFileName) { - return h.snapshot.semanticDiagnosticsPerFile, h.semanticDiagnosticsPerFile +func (h *Program) GetTestingData(program *compiler.Program) (map[tspath.Path]*diagnosticsOrBuildInfoDiagnosticsWithFileName, map[tspath.Path]*diagnosticsOrBuildInfoDiagnosticsWithFileName, *collections.SyncMap[tspath.Path, SignatureUpdateKind]) { + return h.snapshot.semanticDiagnosticsPerFile, h.semanticDiagnosticsPerFile, h.updatedSignatureKinds } func (h *Program) panicIfNoProgram(method string) { diff --git a/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js index 99a1c0bd1d..8f553d9af9 100644 --- a/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js +++ b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js @@ -147,3 +147,7 @@ SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/MessageablePerson.ts *refresh* /home/src/workspaces/project/main.ts + +Signatures:: +(stored at emit) /home/src/workspaces/project/MessageablePerson.ts +(stored at emit) /home/src/workspaces/project/main.ts diff --git a/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js index 09b4e47d3d..6d76f70af3 100644 --- a/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js +++ b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js @@ -124,3 +124,5 @@ SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/MessageablePerson.ts *refresh* /home/src/workspaces/project/main.ts + +Signatures:: diff --git a/testdata/baselines/reference/tsc/incremental/serializing-composite-project.js b/testdata/baselines/reference/tsc/incremental/serializing-composite-project.js index e2850c4b40..a3ea785352 100644 --- a/testdata/baselines/reference/tsc/incremental/serializing-composite-project.js +++ b/testdata/baselines/reference/tsc/incremental/serializing-composite-project.js @@ -114,3 +114,7 @@ SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/index.tsx *refresh* /home/src/workspaces/project/other.ts + +Signatures:: +(stored at emit) /home/src/workspaces/project/index.tsx +(stored at emit) /home/src/workspaces/project/other.ts diff --git a/testdata/baselines/reference/tsc/incremental/serializing-error-chain.js b/testdata/baselines/reference/tsc/incremental/serializing-error-chain.js index f1656c7942..bf4f06eda1 100644 --- a/testdata/baselines/reference/tsc/incremental/serializing-error-chain.js +++ b/testdata/baselines/reference/tsc/incremental/serializing-error-chain.js @@ -179,3 +179,5 @@ declare const console: { log(msg: any): void; }; SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/index.tsx + +Signatures:: diff --git a/testdata/baselines/reference/tsc/noEmit/when-project-has-strict-true.js b/testdata/baselines/reference/tsc/noEmit/when-project-has-strict-true.js index 9ace285972..8ad51c7cb0 100644 --- a/testdata/baselines/reference/tsc/noEmit/when-project-has-strict-true.js +++ b/testdata/baselines/reference/tsc/noEmit/when-project-has-strict-true.js @@ -87,3 +87,5 @@ declare const console: { log(msg: any): void; }; SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/class1.ts + +Signatures:: diff --git a/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences2.js b/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences2.js index 83ffa665fb..0dca5416d7 100644 --- a/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences2.js +++ b/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences2.js @@ -137,3 +137,6 @@ SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.esnext.full.d.ts *refresh* /home/src/workspaces/solution/dist/compiler/parser.d.ts *refresh* /home/src/workspaces/solution/src/services/services.ts + +Signatures:: +(stored at emit) /home/src/workspaces/solution/src/services/services.ts diff --git a/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences3.js b/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences3.js index b202783bc5..6ecdc069df 100644 --- a/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences3.js +++ b/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences3.js @@ -141,3 +141,6 @@ SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.esnext.full.d.ts *refresh* /home/src/workspaces/solution/dist/compiler/parser.d.ts *refresh* /home/src/workspaces/solution/src/services/services.ts + +Signatures:: +(stored at emit) /home/src/workspaces/solution/src/services/services.ts diff --git a/testdata/baselines/reference/tsc/typeAcquisition/parse-tsconfig-with-typeAcquisition.js b/testdata/baselines/reference/tsc/typeAcquisition/parse-tsconfig-with-typeAcquisition.js index 41542cf07d..c373f35ee9 100644 --- a/testdata/baselines/reference/tsc/typeAcquisition/parse-tsconfig-with-typeAcquisition.js +++ b/testdata/baselines/reference/tsc/typeAcquisition/parse-tsconfig-with-typeAcquisition.js @@ -81,3 +81,5 @@ declare const console: { log(msg: any): void; }; SemanticDiagnostics:: *not cached* /home/src/tslibs/TS/Lib/lib.d.ts + +Signatures:: diff --git a/testdata/baselines/reference/tscWatch/commandLineWatch/watch-with-no-tsconfig.js b/testdata/baselines/reference/tscWatch/commandLineWatch/watch-with-no-tsconfig.js index 8d85748e31..824fd53354 100644 --- a/testdata/baselines/reference/tscWatch/commandLineWatch/watch-with-no-tsconfig.js +++ b/testdata/baselines/reference/tscWatch/commandLineWatch/watch-with-no-tsconfig.js @@ -41,3 +41,5 @@ declare const console: { log(msg: any): void; }; SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/index.ts + +Signatures:: diff --git a/testdata/baselines/reference/tscWatch/noEmit/dts-errors-without-dts-enabled.js b/testdata/baselines/reference/tscWatch/noEmit/dts-errors-without-dts-enabled.js index 72240c81ae..8520ddc8fe 100644 --- a/testdata/baselines/reference/tscWatch/noEmit/dts-errors-without-dts-enabled.js +++ b/testdata/baselines/reference/tscWatch/noEmit/dts-errors-without-dts-enabled.js @@ -46,6 +46,8 @@ SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts +Signatures:: + Edit:: fix syntax error @@ -58,6 +60,9 @@ SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts +Signatures:: +(used version) /home/src/tslibs/TS/Lib/lib.d.ts + Edit:: emit after fixing error @@ -77,6 +82,10 @@ SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts +Signatures:: +(used version) /home/src/tslibs/TS/Lib/lib.d.ts +(computed .d.ts) /home/src/workspaces/project/a.ts + Edit:: no emit run after fixing error @@ -94,6 +103,10 @@ SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts +Signatures:: +(used version) /home/src/tslibs/TS/Lib/lib.d.ts +(computed .d.ts) /home/src/workspaces/project/a.ts + Edit:: introduce error @@ -106,6 +119,9 @@ SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts +Signatures:: +(used version) /home/src/tslibs/TS/Lib/lib.d.ts + Edit:: emit when error @@ -127,6 +143,10 @@ SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts +Signatures:: +(used version) /home/src/tslibs/TS/Lib/lib.d.ts +(computed .d.ts) /home/src/workspaces/project/a.ts + Edit:: no emit run when error @@ -143,3 +163,7 @@ Output:: SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts + +Signatures:: +(used version) /home/src/tslibs/TS/Lib/lib.d.ts +(computed .d.ts) /home/src/workspaces/project/a.ts diff --git a/testdata/baselines/reference/tscWatch/noEmit/dts-errors.js b/testdata/baselines/reference/tscWatch/noEmit/dts-errors.js index d8d67492f0..7951fa35cf 100644 --- a/testdata/baselines/reference/tscWatch/noEmit/dts-errors.js +++ b/testdata/baselines/reference/tscWatch/noEmit/dts-errors.js @@ -59,6 +59,8 @@ SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts +Signatures:: + Edit:: fix syntax error @@ -71,6 +73,9 @@ SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts +Signatures:: +(used version) /home/src/tslibs/TS/Lib/lib.d.ts + Edit:: emit after fixing error @@ -93,6 +98,10 @@ SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts +Signatures:: +(used version) /home/src/tslibs/TS/Lib/lib.d.ts +(computed .d.ts) /home/src/workspaces/project/a.ts + Edit:: no emit run after fixing error @@ -110,6 +119,10 @@ SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts +Signatures:: +(used version) /home/src/tslibs/TS/Lib/lib.d.ts +(computed .d.ts) /home/src/workspaces/project/a.ts + Edit:: introduce error @@ -134,6 +147,9 @@ SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts +Signatures:: +(used version) /home/src/tslibs/TS/Lib/lib.d.ts + Edit:: emit when error @@ -174,6 +190,10 @@ SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts +Signatures:: +(used version) /home/src/tslibs/TS/Lib/lib.d.ts +(computed .d.ts) /home/src/workspaces/project/a.ts + Edit:: no emit run when error @@ -202,3 +222,7 @@ Found 1 error in a.ts:1 SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts + +Signatures:: +(used version) /home/src/tslibs/TS/Lib/lib.d.ts +(computed .d.ts) /home/src/workspaces/project/a.ts diff --git a/testdata/baselines/reference/tscWatch/noEmit/semantic-errors.js b/testdata/baselines/reference/tscWatch/noEmit/semantic-errors.js index dc98a8043c..96d9a9897c 100644 --- a/testdata/baselines/reference/tscWatch/noEmit/semantic-errors.js +++ b/testdata/baselines/reference/tscWatch/noEmit/semantic-errors.js @@ -54,6 +54,8 @@ SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts +Signatures:: + Edit:: fix syntax error @@ -66,6 +68,9 @@ SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts +Signatures:: +(used version) /home/src/tslibs/TS/Lib/lib.d.ts + Edit:: emit after fixing error @@ -85,6 +90,10 @@ SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts +Signatures:: +(used version) /home/src/tslibs/TS/Lib/lib.d.ts +(computed .d.ts) /home/src/workspaces/project/a.ts + Edit:: no emit run after fixing error @@ -102,6 +111,10 @@ SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts +Signatures:: +(used version) /home/src/tslibs/TS/Lib/lib.d.ts +(computed .d.ts) /home/src/workspaces/project/a.ts + Edit:: introduce error @@ -122,6 +135,9 @@ SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts +Signatures:: +(used version) /home/src/tslibs/TS/Lib/lib.d.ts + Edit:: emit when error @@ -147,6 +163,10 @@ SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts +Signatures:: +(used version) /home/src/tslibs/TS/Lib/lib.d.ts +(computed .d.ts) /home/src/workspaces/project/a.ts + Edit:: no emit run when error @@ -171,3 +191,7 @@ Found 1 error in a.ts:1 SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts + +Signatures:: +(used version) /home/src/tslibs/TS/Lib/lib.d.ts +(computed .d.ts) /home/src/workspaces/project/a.ts diff --git a/testdata/baselines/reference/tscWatch/noEmit/syntax-errors.js b/testdata/baselines/reference/tscWatch/noEmit/syntax-errors.js index badd3b020f..b689462016 100644 --- a/testdata/baselines/reference/tscWatch/noEmit/syntax-errors.js +++ b/testdata/baselines/reference/tscWatch/noEmit/syntax-errors.js @@ -54,6 +54,8 @@ SemanticDiagnostics:: *not cached* /home/src/tslibs/TS/Lib/lib.d.ts *not cached* /home/src/workspaces/project/a.ts +Signatures:: + Edit:: fix syntax error @@ -66,6 +68,9 @@ SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts +Signatures:: +(used version) /home/src/tslibs/TS/Lib/lib.d.ts + Edit:: emit after fixing error @@ -85,6 +90,10 @@ SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts +Signatures:: +(used version) /home/src/tslibs/TS/Lib/lib.d.ts +(computed .d.ts) /home/src/workspaces/project/a.ts + Edit:: no emit run after fixing error @@ -102,6 +111,10 @@ SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts +Signatures:: +(used version) /home/src/tslibs/TS/Lib/lib.d.ts +(computed .d.ts) /home/src/workspaces/project/a.ts + Edit:: introduce error @@ -122,6 +135,8 @@ SemanticDiagnostics:: *not cached* /home/src/tslibs/TS/Lib/lib.d.ts *not cached* /home/src/workspaces/project/a.ts +Signatures:: + Edit:: emit when error @@ -149,6 +164,10 @@ SemanticDiagnostics:: *not cached* /home/src/tslibs/TS/Lib/lib.d.ts *not cached* /home/src/workspaces/project/a.ts +Signatures:: +(used version) /home/src/tslibs/TS/Lib/lib.d.ts +(computed .d.ts) /home/src/workspaces/project/a.ts + Edit:: no emit run when error @@ -173,3 +192,5 @@ Found 1 error in a.ts:1 SemanticDiagnostics:: *not cached* /home/src/tslibs/TS/Lib/lib.d.ts *not cached* /home/src/workspaces/project/a.ts + +Signatures:: From 41f58d94d501cc44f3d81e35e775e24536c23272 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 1 Jul 2025 13:12:54 -0700 Subject: [PATCH 28/36] Test incremental edit // Options are always detected as changed so everything is refreshed on incremental build --- internal/execute/testsys_test.go | 9 + internal/execute/tscincremental_test.go | 60 ++- internal/execute/tsctestrunner_test.go | 8 +- ...ion-field-with-declaration-emit-enabled.js | 484 ++++++++++++++++++ ...e-to-modifier-of-class-expression-field.js | 457 +++++++++++++++++ 5 files changed, 991 insertions(+), 27 deletions(-) diff --git a/internal/execute/testsys_test.go b/internal/execute/testsys_test.go index 068ee4fdd9..399ba2d9d9 100644 --- a/internal/execute/testsys_test.go +++ b/internal/execute/testsys_test.go @@ -313,3 +313,12 @@ func (s *testSys) WriteFileNoError(path string, content string, writeByteOrderMa panic(err) } } + +func (s *testSys) ReplaceFileText(path string, oldText string, newText string) { + content, ok := s.FS().ReadFile(path) + if !ok { + panic("File not found: " + path) + } + content = strings.Replace(content, oldText, newText, 1) + s.WriteFileNoError(path, content, false) +} diff --git a/internal/execute/tscincremental_test.go b/internal/execute/tscincremental_test.go index db96f8285b..a118a6aa4d 100644 --- a/internal/execute/tscincremental_test.go +++ b/internal/execute/tscincremental_test.go @@ -71,19 +71,23 @@ func TestIncremental(t *testing.T) { type InstanceType any> = T extends abstract new (...args: any) => infer R ? R : any;`, }, "/home/src/workspaces/project"), commandLineArgs: []string{"--incremental"}, - // edits: [ - // noChangeRun, - // { - // caption: "modify public to protected", - // edit: sys => sys.replaceFileText("/home/src/workspaces/project/MessageablePerson.ts", "public", "protected"), - // }, - // noChangeRun, - // { - // caption: "modify protected to public", - // edit: sys => sys.replaceFileText("/home/src/workspaces/project/MessageablePerson.ts", "protected", "public"), - // }, - // noChangeRun, - // ], + edits: []*testTscEdit{ + noChange, + { + caption: "modify public to protected", + edit: func(sys *testSys) { + sys.ReplaceFileText("/home/src/workspaces/project/MessageablePerson.ts", "public", "protected") + }, + }, + noChange, + { + caption: "modify protected to public", + edit: func(sys *testSys) { + sys.ReplaceFileText("/home/src/workspaces/project/MessageablePerson.ts", "protected", "public") + }, + }, + noChange, + }, }, { subScenario: "change to modifier of class expression field", @@ -108,19 +112,23 @@ func TestIncremental(t *testing.T) { type InstanceType any> = T extends abstract new (...args: any) => infer R ? R : any;`, }, "/home/src/workspaces/project"), commandLineArgs: []string{"--incremental"}, - // edits: [ - // noChangeRun, - // { - // caption: "modify public to protected", - // edit: sys => sys.replaceFileText("/home/src/workspaces/project/MessageablePerson.ts", "public", "protected"), - // }, - // noChangeRun, - // { - // caption: "modify protected to public", - // edit: sys => sys.replaceFileText("/home/src/workspaces/project/MessageablePerson.ts", "protected", "public"), - // }, - // noChangeRun, - // ], + edits: []*testTscEdit{ + noChange, + { + caption: "modify public to protected", + edit: func(sys *testSys) { + sys.ReplaceFileText("/home/src/workspaces/project/MessageablePerson.ts", "public", "protected") + }, + }, + noChange, + { + caption: "modify protected to public", + edit: func(sys *testSys) { + sys.ReplaceFileText("/home/src/workspaces/project/MessageablePerson.ts", "protected", "public") + }, + }, + noChange, + }, }, } diff --git a/internal/execute/tsctestrunner_test.go b/internal/execute/tsctestrunner_test.go index 36035ff43d..8d92c41dba 100644 --- a/internal/execute/tsctestrunner_test.go +++ b/internal/execute/tsctestrunner_test.go @@ -8,6 +8,7 @@ import ( "strings" "testing" + "github.com/microsoft/typescript-go/internal/core" "github.com/microsoft/typescript-go/internal/execute" "github.com/microsoft/typescript-go/internal/incremental" "github.com/microsoft/typescript-go/internal/testutil/baseline" @@ -19,6 +20,11 @@ type testTscEdit struct { edit func(*testSys) } +var noChange = &testTscEdit{ + caption: "no change", + edit: func(sys *testSys) {}, +} + type tscInput struct { subScenario string commandLineArgs []string @@ -50,7 +56,7 @@ func (test *tscInput) run(t *testing.T, scenario string) { var incrementalProgram *incremental.Program if watcher == nil { - exit, parsedCommandLine, incrementalProgram, watcher = execute.CommandLine(test.sys, test.commandLineArgs, true) + exit, parsedCommandLine, incrementalProgram, watcher = execute.CommandLine(test.sys, core.IfElse(do.commandLineArgs == nil, test.commandLineArgs, do.commandLineArgs), true) baselineBuilder.WriteString("ExitStatus:: " + fmt.Sprint(exit)) } else { watcher.DoCycle() diff --git a/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js index 8f553d9af9..7f49560332 100644 --- a/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js +++ b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js @@ -151,3 +151,487 @@ SemanticDiagnostics:: Signatures:: (stored at emit) /home/src/workspaces/project/MessageablePerson.ts (stored at emit) /home/src/workspaces/project/main.ts + + +Edit:: no change +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/MessageablePerson.d.ts] *modified time* +//// [/home/src/workspaces/project/MessageablePerson.js] *modified time* +//// [/home/src/workspaces/project/main.d.ts] *modified time* +//// [/home/src/workspaces/project/main.js] *modified time* +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified time* +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified time* + + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/MessageablePerson.ts +*refresh* /home/src/workspaces/project/main.ts + +Signatures:: +(used version) /home/src/tslibs/TS/Lib/lib.d.ts +(computed .d.ts) /home/src/workspaces/project/MessageablePerson.ts +(computed .d.ts) /home/src/workspaces/project/main.ts + + +Edit:: modify public to protected +ExitStatus:: 2 +Output:: +MessageablePerson.ts:7:31 - error TS4094: Property 'message' of exported anonymous class type may not be private or protected. + +7 const wrapper = () => Messageable(); +   ~~~~~~~ + + MessageablePerson.ts:7:31 - Add a type annotation to the variable wrapper. + 7 const wrapper = () => Messageable(); +    ~~~~~~~ + +main.ts:4:49 - error TS2445: Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses. + +4 console.log( person.message ); +   ~~~~~~~ + + +Found 2 errors in 2 files. + +Errors Files + 1 MessageablePerson.ts:7 + 1 main.ts:4 + +//// [/home/src/workspaces/project/MessageablePerson.d.ts] *modified time* +//// [/home/src/workspaces/project/MessageablePerson.js] *modified time* +//// [/home/src/workspaces/project/MessageablePerson.ts] *modified* + + const Messageable = () => { + return class MessageableClass { + protected message = 'hello'; + } + }; + const wrapper = () => Messageable(); + type MessageablePerson = InstanceType>; + export default MessageablePerson; +//// [/home/src/workspaces/project/main.d.ts] *modified time* +//// [/home/src/workspaces/project/main.js] *modified time* +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":[{"version":"575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ab8b2498ae671bdc5aefe51a9de13bf17d8e0438f2f573353d18e104344dd81f","signature":"6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe","impliedNodeFormat":1},{"version":"36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"declaration":true,"module":99},"referencedMap":[[3,1]],"semanticDiagnosticsPerFile":[[3,[{"pos":204,"end":211,"code":2445,"category":1,"message":"Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses."}]]],"emitDiagnosticsPerFile":[[2,[{"pos":261,"end":268,"code":4094,"category":1,"message":"Property 'message' of exported anonymous class type may not be private or protected.","relatedInformation":[{"pos":261,"end":268,"code":9027,"category":1,"message":"Add a type annotation to the variable wrapper."}]}]]]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./MessageablePerson.ts", + "./main.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "signature": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./MessageablePerson.ts", + "version": "ab8b2498ae671bdc5aefe51a9de13bf17d8e0438f2f573353d18e104344dd81f", + "signature": "6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "ab8b2498ae671bdc5aefe51a9de13bf17d8e0438f2f573353d18e104344dd81f", + "signature": "6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./main.ts", + "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", + "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", + "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./MessageablePerson.ts" + ] + ], + "options": { + "declaration": true, + "module": 99 + }, + "referencedMap": { + "./main.ts": [ + "./MessageablePerson.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + [ + "./main.ts", + [ + { + "pos": 204, + "end": 211, + "code": 2445, + "category": 1, + "message": "Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses." + } + ] + ] + ], + "emitDiagnosticsPerFile": [ + [ + "./MessageablePerson.ts", + [ + { + "pos": 261, + "end": 268, + "code": 4094, + "category": 1, + "message": "Property 'message' of exported anonymous class type may not be private or protected.", + "relatedInformation": [ + { + "pos": 261, + "end": 268, + "code": 9027, + "category": 1, + "message": "Add a type annotation to the variable wrapper." + } + ] + } + ] + ] + ], + "size": 1203 +} + + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/MessageablePerson.ts +*refresh* /home/src/workspaces/project/main.ts + +Signatures:: +(used version) /home/src/tslibs/TS/Lib/lib.d.ts +(computed .d.ts) /home/src/workspaces/project/main.ts + + +Edit:: no change +ExitStatus:: 2 +Output:: +MessageablePerson.ts:7:31 - error TS4094: Property 'message' of exported anonymous class type may not be private or protected. + +7 const wrapper = () => Messageable(); +   ~~~~~~~ + + MessageablePerson.ts:7:31 - Add a type annotation to the variable wrapper. + 7 const wrapper = () => Messageable(); +    ~~~~~~~ + +main.ts:4:49 - error TS2445: Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses. + +4 console.log( person.message ); +   ~~~~~~~ + + +Found 2 errors in 2 files. + +Errors Files + 1 MessageablePerson.ts:7 + 1 main.ts:4 + +//// [/home/src/workspaces/project/MessageablePerson.d.ts] *modified time* +//// [/home/src/workspaces/project/MessageablePerson.js] *modified time* +//// [/home/src/workspaces/project/main.d.ts] *modified time* +//// [/home/src/workspaces/project/main.js] *modified time* +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":[{"version":"575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ab8b2498ae671bdc5aefe51a9de13bf17d8e0438f2f573353d18e104344dd81f","signature":"0858d1a081aa47feef2a37c5648868c3ecc110cde2469aea716091b9869a58ed","impliedNodeFormat":1},{"version":"36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"declaration":true,"module":99},"referencedMap":[[3,1]],"semanticDiagnosticsPerFile":[[3,[{"pos":204,"end":211,"code":2445,"category":1,"message":"Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses."}]]],"emitDiagnosticsPerFile":[[2,[{"pos":261,"end":268,"code":4094,"category":1,"message":"Property 'message' of exported anonymous class type may not be private or protected.","relatedInformation":[{"pos":261,"end":268,"code":9027,"category":1,"message":"Add a type annotation to the variable wrapper."}]}]]]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./MessageablePerson.ts", + "./main.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "signature": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./MessageablePerson.ts", + "version": "ab8b2498ae671bdc5aefe51a9de13bf17d8e0438f2f573353d18e104344dd81f", + "signature": "0858d1a081aa47feef2a37c5648868c3ecc110cde2469aea716091b9869a58ed", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "ab8b2498ae671bdc5aefe51a9de13bf17d8e0438f2f573353d18e104344dd81f", + "signature": "0858d1a081aa47feef2a37c5648868c3ecc110cde2469aea716091b9869a58ed", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./main.ts", + "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", + "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", + "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./MessageablePerson.ts" + ] + ], + "options": { + "declaration": true, + "module": 99 + }, + "referencedMap": { + "./main.ts": [ + "./MessageablePerson.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + [ + "./main.ts", + [ + { + "pos": 204, + "end": 211, + "code": 2445, + "category": 1, + "message": "Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses." + } + ] + ] + ], + "emitDiagnosticsPerFile": [ + [ + "./MessageablePerson.ts", + [ + { + "pos": 261, + "end": 268, + "code": 4094, + "category": 1, + "message": "Property 'message' of exported anonymous class type may not be private or protected.", + "relatedInformation": [ + { + "pos": 261, + "end": 268, + "code": 9027, + "category": 1, + "message": "Add a type annotation to the variable wrapper." + } + ] + } + ] + ] + ], + "size": 1203 +} + + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/MessageablePerson.ts +*refresh* /home/src/workspaces/project/main.ts + +Signatures:: +(used version) /home/src/tslibs/TS/Lib/lib.d.ts +(computed .d.ts) /home/src/workspaces/project/MessageablePerson.ts +(computed .d.ts) /home/src/workspaces/project/main.ts + + +Edit:: modify protected to public +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/MessageablePerson.d.ts] *modified time* +//// [/home/src/workspaces/project/MessageablePerson.js] *modified time* +//// [/home/src/workspaces/project/MessageablePerson.ts] *modified* + + const Messageable = () => { + return class MessageableClass { + public message = 'hello'; + } + }; + const wrapper = () => Messageable(); + type MessageablePerson = InstanceType>; + export default MessageablePerson; +//// [/home/src/workspaces/project/main.d.ts] *modified time* +//// [/home/src/workspaces/project/main.js] *modified time* +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":[{"version":"575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a","signature":"0858d1a081aa47feef2a37c5648868c3ecc110cde2469aea716091b9869a58ed","impliedNodeFormat":1},{"version":"36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"declaration":true,"module":99},"referencedMap":[[3,1]]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./MessageablePerson.ts", + "./main.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "signature": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./MessageablePerson.ts", + "version": "ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a", + "signature": "0858d1a081aa47feef2a37c5648868c3ecc110cde2469aea716091b9869a58ed", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a", + "signature": "0858d1a081aa47feef2a37c5648868c3ecc110cde2469aea716091b9869a58ed", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./main.ts", + "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", + "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", + "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./MessageablePerson.ts" + ] + ], + "options": { + "declaration": true, + "module": 99 + }, + "referencedMap": { + "./main.ts": [ + "./MessageablePerson.ts" + ] + }, + "size": 697 +} + + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/MessageablePerson.ts +*refresh* /home/src/workspaces/project/main.ts + +Signatures:: +(used version) /home/src/tslibs/TS/Lib/lib.d.ts +(computed .d.ts) /home/src/workspaces/project/main.ts + + +Edit:: no change +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/MessageablePerson.d.ts] *modified time* +//// [/home/src/workspaces/project/MessageablePerson.js] *modified time* +//// [/home/src/workspaces/project/main.d.ts] *modified time* +//// [/home/src/workspaces/project/main.js] *modified time* +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":[{"version":"575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a","signature":"6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe","impliedNodeFormat":1},{"version":"36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"declaration":true,"module":99},"referencedMap":[[3,1]]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./MessageablePerson.ts", + "./main.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "signature": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./MessageablePerson.ts", + "version": "ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a", + "signature": "6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a", + "signature": "6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./main.ts", + "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", + "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", + "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./MessageablePerson.ts" + ] + ], + "options": { + "declaration": true, + "module": 99 + }, + "referencedMap": { + "./main.ts": [ + "./MessageablePerson.ts" + ] + }, + "size": 697 +} + + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/MessageablePerson.ts +*refresh* /home/src/workspaces/project/main.ts + +Signatures:: +(used version) /home/src/tslibs/TS/Lib/lib.d.ts +(computed .d.ts) /home/src/workspaces/project/MessageablePerson.ts +(computed .d.ts) /home/src/workspaces/project/main.ts diff --git a/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js index 6d76f70af3..dfe580096d 100644 --- a/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js +++ b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js @@ -126,3 +126,460 @@ SemanticDiagnostics:: *refresh* /home/src/workspaces/project/main.ts Signatures:: + + +Edit:: no change +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/MessageablePerson.js] *modified time* +//// [/home/src/workspaces/project/main.js] *modified time* +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":[{"version":"575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a","signature":"6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe","impliedNodeFormat":1},{"version":"36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"module":99},"referencedMap":[[3,1]]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./MessageablePerson.ts", + "./main.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "signature": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./MessageablePerson.ts", + "version": "ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a", + "signature": "6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a", + "signature": "6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./main.ts", + "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", + "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", + "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./MessageablePerson.ts" + ] + ], + "options": { + "module": 99 + }, + "referencedMap": { + "./main.ts": [ + "./MessageablePerson.ts" + ] + }, + "size": 678 +} + + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/MessageablePerson.ts +*refresh* /home/src/workspaces/project/main.ts + +Signatures:: +(used version) /home/src/tslibs/TS/Lib/lib.d.ts +(computed .d.ts) /home/src/workspaces/project/MessageablePerson.ts +(computed .d.ts) /home/src/workspaces/project/main.ts + + +Edit:: modify public to protected +ExitStatus:: 2 +Output:: +main.ts:4:49 - error TS2445: Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses. + +4 console.log( person.message ); +   ~~~~~~~ + + +Found 1 error in main.ts:4 + +//// [/home/src/workspaces/project/MessageablePerson.js] *modified time* +//// [/home/src/workspaces/project/MessageablePerson.ts] *modified* + + const Messageable = () => { + return class MessageableClass { + protected message = 'hello'; + } + }; + const wrapper = () => Messageable(); + type MessageablePerson = InstanceType>; + export default MessageablePerson; +//// [/home/src/workspaces/project/main.js] *modified time* +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":[{"version":"575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ab8b2498ae671bdc5aefe51a9de13bf17d8e0438f2f573353d18e104344dd81f","signature":"6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe","impliedNodeFormat":1},{"version":"36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"module":99},"referencedMap":[[3,1]],"semanticDiagnosticsPerFile":[[3,[{"pos":204,"end":211,"code":2445,"category":1,"message":"Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses."}]]]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./MessageablePerson.ts", + "./main.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "signature": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./MessageablePerson.ts", + "version": "ab8b2498ae671bdc5aefe51a9de13bf17d8e0438f2f573353d18e104344dd81f", + "signature": "6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "ab8b2498ae671bdc5aefe51a9de13bf17d8e0438f2f573353d18e104344dd81f", + "signature": "6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./main.ts", + "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", + "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", + "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./MessageablePerson.ts" + ] + ], + "options": { + "module": 99 + }, + "referencedMap": { + "./main.ts": [ + "./MessageablePerson.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + [ + "./main.ts", + [ + { + "pos": 204, + "end": 211, + "code": 2445, + "category": 1, + "message": "Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses." + } + ] + ] + ], + "size": 878 +} + + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/MessageablePerson.ts +*refresh* /home/src/workspaces/project/main.ts + +Signatures:: +(used version) /home/src/tslibs/TS/Lib/lib.d.ts +(computed .d.ts) /home/src/workspaces/project/main.ts + + +Edit:: no change +ExitStatus:: 2 +Output:: +main.ts:4:49 - error TS2445: Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses. + +4 console.log( person.message ); +   ~~~~~~~ + + +Found 1 error in main.ts:4 + +//// [/home/src/workspaces/project/MessageablePerson.js] *modified time* +//// [/home/src/workspaces/project/main.js] *modified time* +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":[{"version":"575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ab8b2498ae671bdc5aefe51a9de13bf17d8e0438f2f573353d18e104344dd81f","signature":"0858d1a081aa47feef2a37c5648868c3ecc110cde2469aea716091b9869a58ed","impliedNodeFormat":1},{"version":"36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"module":99},"referencedMap":[[3,1]],"semanticDiagnosticsPerFile":[[3,[{"pos":204,"end":211,"code":2445,"category":1,"message":"Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses."}]]]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./MessageablePerson.ts", + "./main.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "signature": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./MessageablePerson.ts", + "version": "ab8b2498ae671bdc5aefe51a9de13bf17d8e0438f2f573353d18e104344dd81f", + "signature": "0858d1a081aa47feef2a37c5648868c3ecc110cde2469aea716091b9869a58ed", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "ab8b2498ae671bdc5aefe51a9de13bf17d8e0438f2f573353d18e104344dd81f", + "signature": "0858d1a081aa47feef2a37c5648868c3ecc110cde2469aea716091b9869a58ed", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./main.ts", + "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", + "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", + "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./MessageablePerson.ts" + ] + ], + "options": { + "module": 99 + }, + "referencedMap": { + "./main.ts": [ + "./MessageablePerson.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + [ + "./main.ts", + [ + { + "pos": 204, + "end": 211, + "code": 2445, + "category": 1, + "message": "Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses." + } + ] + ] + ], + "size": 878 +} + + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/MessageablePerson.ts +*refresh* /home/src/workspaces/project/main.ts + +Signatures:: +(used version) /home/src/tslibs/TS/Lib/lib.d.ts +(computed .d.ts) /home/src/workspaces/project/MessageablePerson.ts +(computed .d.ts) /home/src/workspaces/project/main.ts + + +Edit:: modify protected to public +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/MessageablePerson.js] *modified time* +//// [/home/src/workspaces/project/MessageablePerson.ts] *modified* + + const Messageable = () => { + return class MessageableClass { + public message = 'hello'; + } + }; + const wrapper = () => Messageable(); + type MessageablePerson = InstanceType>; + export default MessageablePerson; +//// [/home/src/workspaces/project/main.js] *modified time* +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":[{"version":"575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a","signature":"0858d1a081aa47feef2a37c5648868c3ecc110cde2469aea716091b9869a58ed","impliedNodeFormat":1},{"version":"36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"module":99},"referencedMap":[[3,1]]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./MessageablePerson.ts", + "./main.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "signature": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./MessageablePerson.ts", + "version": "ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a", + "signature": "0858d1a081aa47feef2a37c5648868c3ecc110cde2469aea716091b9869a58ed", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a", + "signature": "0858d1a081aa47feef2a37c5648868c3ecc110cde2469aea716091b9869a58ed", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./main.ts", + "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", + "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", + "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./MessageablePerson.ts" + ] + ], + "options": { + "module": 99 + }, + "referencedMap": { + "./main.ts": [ + "./MessageablePerson.ts" + ] + }, + "size": 678 +} + + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/MessageablePerson.ts +*refresh* /home/src/workspaces/project/main.ts + +Signatures:: +(used version) /home/src/tslibs/TS/Lib/lib.d.ts +(computed .d.ts) /home/src/workspaces/project/main.ts + + +Edit:: no change +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/MessageablePerson.js] *modified time* +//// [/home/src/workspaces/project/main.js] *modified time* +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":[{"version":"575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a","signature":"6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe","impliedNodeFormat":1},{"version":"36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"module":99},"referencedMap":[[3,1]]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./MessageablePerson.ts", + "./main.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "signature": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./MessageablePerson.ts", + "version": "ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a", + "signature": "6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a", + "signature": "6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./main.ts", + "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", + "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", + "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./MessageablePerson.ts" + ] + ], + "options": { + "module": 99 + }, + "referencedMap": { + "./main.ts": [ + "./MessageablePerson.ts" + ] + }, + "size": 678 +} + + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/MessageablePerson.ts +*refresh* /home/src/workspaces/project/main.ts + +Signatures:: +(used version) /home/src/tslibs/TS/Lib/lib.d.ts +(computed .d.ts) /home/src/workspaces/project/MessageablePerson.ts +(computed .d.ts) /home/src/workspaces/project/main.ts From 2f8abf65ce689305880203b80ae35339ad4773ff Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 1 Jul 2025 13:50:34 -0700 Subject: [PATCH 29/36] Fix modified edit baseline --- internal/execute/tsctestrunner_test.go | 1 + ...ion-field-with-declaration-emit-enabled.js | 33 ++++++----- ...e-to-modifier-of-class-expression-field.js | 31 +++++----- .../noEmit/dts-errors-without-dts-enabled.js | 44 ++++++++------- .../reference/tscWatch/noEmit/dts-errors.js | 56 ++++++++++--------- .../tscWatch/noEmit/semantic-errors.js | 54 ++++++++++-------- .../tscWatch/noEmit/syntax-errors.js | 54 ++++++++++-------- 7 files changed, 154 insertions(+), 119 deletions(-) diff --git a/internal/execute/tsctestrunner_test.go b/internal/execute/tsctestrunner_test.go index 8d92c41dba..9053370d0f 100644 --- a/internal/execute/tsctestrunner_test.go +++ b/internal/execute/tsctestrunner_test.go @@ -53,6 +53,7 @@ func (test *tscInput) run(t *testing.T, scenario string) { for _, do := range test.edits { do.edit(test.sys) baselineBuilder.WriteString("\n\nEdit:: " + do.caption + "\n") + test.sys.baselineFSwithDiff(baselineBuilder) var incrementalProgram *incremental.Program if watcher == nil { diff --git a/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js index 7f49560332..0b763a14a3 100644 --- a/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js +++ b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js @@ -154,6 +154,7 @@ Signatures:: Edit:: no change + ExitStatus:: 0 Output:: //// [/home/src/workspaces/project/MessageablePerson.d.ts] *modified time* @@ -176,6 +177,17 @@ Signatures:: Edit:: modify public to protected +//// [/home/src/workspaces/project/MessageablePerson.ts] *modified* + + const Messageable = () => { + return class MessageableClass { + protected message = 'hello'; + } + }; + const wrapper = () => Messageable(); + type MessageablePerson = InstanceType>; + export default MessageablePerson; + ExitStatus:: 2 Output:: MessageablePerson.ts:7:31 - error TS4094: Property 'message' of exported anonymous class type may not be private or protected. @@ -201,16 +213,6 @@ Errors Files //// [/home/src/workspaces/project/MessageablePerson.d.ts] *modified time* //// [/home/src/workspaces/project/MessageablePerson.js] *modified time* -//// [/home/src/workspaces/project/MessageablePerson.ts] *modified* - - const Messageable = () => { - return class MessageableClass { - protected message = 'hello'; - } - }; - const wrapper = () => Messageable(); - type MessageablePerson = InstanceType>; - export default MessageablePerson; //// [/home/src/workspaces/project/main.d.ts] *modified time* //// [/home/src/workspaces/project/main.js] *modified time* //// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* @@ -325,6 +327,7 @@ Signatures:: Edit:: no change + ExitStatus:: 2 Output:: MessageablePerson.ts:7:31 - error TS4094: Property 'message' of exported anonymous class type may not be private or protected. @@ -465,10 +468,6 @@ Signatures:: Edit:: modify protected to public -ExitStatus:: 0 -Output:: -//// [/home/src/workspaces/project/MessageablePerson.d.ts] *modified time* -//// [/home/src/workspaces/project/MessageablePerson.js] *modified time* //// [/home/src/workspaces/project/MessageablePerson.ts] *modified* const Messageable = () => { @@ -479,6 +478,11 @@ Output:: const wrapper = () => Messageable(); type MessageablePerson = InstanceType>; export default MessageablePerson; + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/MessageablePerson.d.ts] *modified time* +//// [/home/src/workspaces/project/MessageablePerson.js] *modified time* //// [/home/src/workspaces/project/main.d.ts] *modified time* //// [/home/src/workspaces/project/main.js] *modified time* //// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* @@ -556,6 +560,7 @@ Signatures:: Edit:: no change + ExitStatus:: 0 Output:: //// [/home/src/workspaces/project/MessageablePerson.d.ts] *modified time* diff --git a/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js index dfe580096d..22003f7d8e 100644 --- a/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js +++ b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js @@ -129,6 +129,7 @@ Signatures:: Edit:: no change + ExitStatus:: 0 Output:: //// [/home/src/workspaces/project/MessageablePerson.js] *modified time* @@ -208,6 +209,17 @@ Signatures:: Edit:: modify public to protected +//// [/home/src/workspaces/project/MessageablePerson.ts] *modified* + + const Messageable = () => { + return class MessageableClass { + protected message = 'hello'; + } + }; + const wrapper = () => Messageable(); + type MessageablePerson = InstanceType>; + export default MessageablePerson; + ExitStatus:: 2 Output:: main.ts:4:49 - error TS2445: Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses. @@ -219,16 +231,6 @@ Output:: Found 1 error in main.ts:4 //// [/home/src/workspaces/project/MessageablePerson.js] *modified time* -//// [/home/src/workspaces/project/MessageablePerson.ts] *modified* - - const Messageable = () => { - return class MessageableClass { - protected message = 'hello'; - } - }; - const wrapper = () => Messageable(); - type MessageablePerson = InstanceType>; - export default MessageablePerson; //// [/home/src/workspaces/project/main.js] *modified time* //// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* {"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":[{"version":"575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ab8b2498ae671bdc5aefe51a9de13bf17d8e0438f2f573353d18e104344dd81f","signature":"6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe","impliedNodeFormat":1},{"version":"36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"module":99},"referencedMap":[[3,1]],"semanticDiagnosticsPerFile":[[3,[{"pos":204,"end":211,"code":2445,"category":1,"message":"Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses."}]]]} @@ -318,6 +320,7 @@ Signatures:: Edit:: no change + ExitStatus:: 2 Output:: main.ts:4:49 - error TS2445: Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses. @@ -419,9 +422,6 @@ Signatures:: Edit:: modify protected to public -ExitStatus:: 0 -Output:: -//// [/home/src/workspaces/project/MessageablePerson.js] *modified time* //// [/home/src/workspaces/project/MessageablePerson.ts] *modified* const Messageable = () => { @@ -432,6 +432,10 @@ Output:: const wrapper = () => Messageable(); type MessageablePerson = InstanceType>; export default MessageablePerson; + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/MessageablePerson.js] *modified time* //// [/home/src/workspaces/project/main.js] *modified time* //// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* {"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":[{"version":"575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a","signature":"0858d1a081aa47feef2a37c5648868c3ecc110cde2469aea716091b9869a58ed","impliedNodeFormat":1},{"version":"36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"module":99},"referencedMap":[[3,1]]} @@ -507,6 +511,7 @@ Signatures:: Edit:: no change + ExitStatus:: 0 Output:: //// [/home/src/workspaces/project/MessageablePerson.js] *modified time* diff --git a/testdata/baselines/reference/tscWatch/noEmit/dts-errors-without-dts-enabled.js b/testdata/baselines/reference/tscWatch/noEmit/dts-errors-without-dts-enabled.js index 8520ddc8fe..537e00f6e2 100644 --- a/testdata/baselines/reference/tscWatch/noEmit/dts-errors-without-dts-enabled.js +++ b/testdata/baselines/reference/tscWatch/noEmit/dts-errors-without-dts-enabled.js @@ -50,12 +50,13 @@ Signatures:: Edit:: fix syntax error - -Output:: //// [/home/src/workspaces/project/a.ts] *modified* const a = "hello"; +Output:: + + SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts @@ -65,11 +66,6 @@ Signatures:: Edit:: emit after fixing error - -Output:: -//// [/home/src/workspaces/project/a.js] *new* -const a = "hello"; - //// [/home/src/workspaces/project/tsconfig.json] *modified* { "compilerOptions": { @@ -78,6 +74,12 @@ const a = "hello"; } +Output:: +//// [/home/src/workspaces/project/a.js] *new* +const a = "hello"; + + + SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts @@ -88,8 +90,6 @@ Signatures:: Edit:: no emit run after fixing error - -Output:: //// [/home/src/workspaces/project/tsconfig.json] *modified* { "compilerOptions": { @@ -99,6 +99,9 @@ Output:: } +Output:: + + SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts @@ -109,12 +112,13 @@ Signatures:: Edit:: introduce error - -Output:: //// [/home/src/workspaces/project/a.ts] *modified* const a = class { private p = 10; }; +Output:: + + SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts @@ -124,6 +128,13 @@ Signatures:: Edit:: emit when error +//// [/home/src/workspaces/project/tsconfig.json] *modified* +{ + "compilerOptions": { + + } +} + Output:: //// [/home/src/workspaces/project/a.js] *modified* @@ -131,12 +142,6 @@ const a = class { p = 10; }; -//// [/home/src/workspaces/project/tsconfig.json] *modified* -{ - "compilerOptions": { - - } -} SemanticDiagnostics:: @@ -149,8 +154,6 @@ Signatures:: Edit:: no emit run when error - -Output:: //// [/home/src/workspaces/project/tsconfig.json] *modified* { "compilerOptions": { @@ -160,6 +163,9 @@ Output:: } +Output:: + + SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts diff --git a/testdata/baselines/reference/tscWatch/noEmit/dts-errors.js b/testdata/baselines/reference/tscWatch/noEmit/dts-errors.js index 7951fa35cf..2561fbc93e 100644 --- a/testdata/baselines/reference/tscWatch/noEmit/dts-errors.js +++ b/testdata/baselines/reference/tscWatch/noEmit/dts-errors.js @@ -63,12 +63,13 @@ Signatures:: Edit:: fix syntax error - -Output:: //// [/home/src/workspaces/project/a.ts] *modified* const a = "hello"; +Output:: + + SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts @@ -78,6 +79,13 @@ Signatures:: Edit:: emit after fixing error +//// [/home/src/workspaces/project/tsconfig.json] *modified* +{ + "compilerOptions": { + "declaration": true + } +} + Output:: //// [/home/src/workspaces/project/a.d.ts] *new* @@ -86,12 +94,6 @@ declare const a = "hello"; //// [/home/src/workspaces/project/a.js] *new* const a = "hello"; -//// [/home/src/workspaces/project/tsconfig.json] *modified* -{ - "compilerOptions": { - "declaration": true - } -} SemanticDiagnostics:: @@ -104,8 +106,6 @@ Signatures:: Edit:: no emit run after fixing error - -Output:: //// [/home/src/workspaces/project/tsconfig.json] *modified* { "compilerOptions": { @@ -115,6 +115,9 @@ Output:: } +Output:: + + SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts @@ -125,6 +128,9 @@ Signatures:: Edit:: introduce error +//// [/home/src/workspaces/project/a.ts] *modified* +const a = class { private p = 10; }; + Output:: a.ts:1:7 - error TS4094: Property 'p' of exported anonymous class type may not be private or protected. @@ -139,8 +145,6 @@ Output:: Found 1 error in a.ts:1 -//// [/home/src/workspaces/project/a.ts] *modified* -const a = class { private p = 10; }; SemanticDiagnostics:: @@ -152,6 +156,13 @@ Signatures:: Edit:: emit when error +//// [/home/src/workspaces/project/tsconfig.json] *modified* +{ + "compilerOptions": { + "declaration": true + } +} + Output:: a.ts:1:7 - error TS4094: Property 'p' of exported anonymous class type may not be private or protected. @@ -178,12 +189,6 @@ const a = class { p = 10; }; -//// [/home/src/workspaces/project/tsconfig.json] *modified* -{ - "compilerOptions": { - "declaration": true - } -} SemanticDiagnostics:: @@ -196,6 +201,14 @@ Signatures:: Edit:: no emit run when error +//// [/home/src/workspaces/project/tsconfig.json] *modified* +{ + "compilerOptions": { + "noEmit": true, + "declaration": true + } +} + Output:: a.ts:1:7 - error TS4094: Property 'p' of exported anonymous class type may not be private or protected. @@ -210,13 +223,6 @@ Output:: Found 1 error in a.ts:1 -//// [/home/src/workspaces/project/tsconfig.json] *modified* -{ - "compilerOptions": { - "noEmit": true, - "declaration": true - } -} SemanticDiagnostics:: diff --git a/testdata/baselines/reference/tscWatch/noEmit/semantic-errors.js b/testdata/baselines/reference/tscWatch/noEmit/semantic-errors.js index 96d9a9897c..167621e54a 100644 --- a/testdata/baselines/reference/tscWatch/noEmit/semantic-errors.js +++ b/testdata/baselines/reference/tscWatch/noEmit/semantic-errors.js @@ -58,12 +58,13 @@ Signatures:: Edit:: fix syntax error - -Output:: //// [/home/src/workspaces/project/a.ts] *modified* const a = "hello"; +Output:: + + SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts @@ -73,11 +74,6 @@ Signatures:: Edit:: emit after fixing error - -Output:: -//// [/home/src/workspaces/project/a.js] *new* -const a = "hello"; - //// [/home/src/workspaces/project/tsconfig.json] *modified* { "compilerOptions": { @@ -86,6 +82,12 @@ const a = "hello"; } +Output:: +//// [/home/src/workspaces/project/a.js] *new* +const a = "hello"; + + + SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts @@ -96,8 +98,6 @@ Signatures:: Edit:: no emit run after fixing error - -Output:: //// [/home/src/workspaces/project/tsconfig.json] *modified* { "compilerOptions": { @@ -107,6 +107,9 @@ Output:: } +Output:: + + SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts @@ -117,6 +120,9 @@ Signatures:: Edit:: introduce error +//// [/home/src/workspaces/project/a.ts] *modified* +const a: number = "hello" + Output:: a.ts:1:7 - error TS2322: Type 'string' is not assignable to type 'number'. @@ -127,8 +133,6 @@ Output:: Found 1 error in a.ts:1 -//// [/home/src/workspaces/project/a.ts] *modified* -const a: number = "hello" SemanticDiagnostics:: @@ -140,6 +144,13 @@ Signatures:: Edit:: emit when error +//// [/home/src/workspaces/project/tsconfig.json] *modified* +{ + "compilerOptions": { + + } +} + Output:: a.ts:1:7 - error TS2322: Type 'string' is not assignable to type 'number'. @@ -151,12 +162,6 @@ Output:: Found 1 error in a.ts:1 //// [/home/src/workspaces/project/a.js] *modified time* -//// [/home/src/workspaces/project/tsconfig.json] *modified* -{ - "compilerOptions": { - - } -} SemanticDiagnostics:: @@ -169,6 +174,14 @@ Signatures:: Edit:: no emit run when error +//// [/home/src/workspaces/project/tsconfig.json] *modified* +{ + "compilerOptions": { + "noEmit": true, + + } +} + Output:: a.ts:1:7 - error TS2322: Type 'string' is not assignable to type 'number'. @@ -179,13 +192,6 @@ Output:: Found 1 error in a.ts:1 -//// [/home/src/workspaces/project/tsconfig.json] *modified* -{ - "compilerOptions": { - "noEmit": true, - - } -} SemanticDiagnostics:: diff --git a/testdata/baselines/reference/tscWatch/noEmit/syntax-errors.js b/testdata/baselines/reference/tscWatch/noEmit/syntax-errors.js index b689462016..ba751fca69 100644 --- a/testdata/baselines/reference/tscWatch/noEmit/syntax-errors.js +++ b/testdata/baselines/reference/tscWatch/noEmit/syntax-errors.js @@ -58,12 +58,13 @@ Signatures:: Edit:: fix syntax error - -Output:: //// [/home/src/workspaces/project/a.ts] *modified* const a = "hello"; +Output:: + + SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts @@ -73,11 +74,6 @@ Signatures:: Edit:: emit after fixing error - -Output:: -//// [/home/src/workspaces/project/a.js] *new* -const a = "hello"; - //// [/home/src/workspaces/project/tsconfig.json] *modified* { "compilerOptions": { @@ -86,6 +82,12 @@ const a = "hello"; } +Output:: +//// [/home/src/workspaces/project/a.js] *new* +const a = "hello"; + + + SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts @@ -96,8 +98,6 @@ Signatures:: Edit:: no emit run after fixing error - -Output:: //// [/home/src/workspaces/project/tsconfig.json] *modified* { "compilerOptions": { @@ -107,6 +107,9 @@ Output:: } +Output:: + + SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts @@ -117,6 +120,9 @@ Signatures:: Edit:: introduce error +//// [/home/src/workspaces/project/a.ts] *modified* +const a = "hello + Output:: a.ts:1:17 - error TS1002: Unterminated string literal. @@ -127,8 +133,6 @@ Output:: Found 1 error in a.ts:1 -//// [/home/src/workspaces/project/a.ts] *modified* -const a = "hello SemanticDiagnostics:: @@ -139,6 +143,13 @@ Signatures:: Edit:: emit when error +//// [/home/src/workspaces/project/tsconfig.json] *modified* +{ + "compilerOptions": { + + } +} + Output:: a.ts:1:17 - error TS1002: Unterminated string literal. @@ -152,12 +163,6 @@ Found 1 error in a.ts:1 //// [/home/src/workspaces/project/a.js] *modified* const a = "hello; -//// [/home/src/workspaces/project/tsconfig.json] *modified* -{ - "compilerOptions": { - - } -} SemanticDiagnostics:: @@ -170,6 +175,14 @@ Signatures:: Edit:: no emit run when error +//// [/home/src/workspaces/project/tsconfig.json] *modified* +{ + "compilerOptions": { + "noEmit": true, + + } +} + Output:: a.ts:1:17 - error TS1002: Unterminated string literal. @@ -180,13 +193,6 @@ Output:: Found 1 error in a.ts:1 -//// [/home/src/workspaces/project/tsconfig.json] *modified* -{ - "compilerOptions": { - "noEmit": true, - - } -} SemanticDiagnostics:: From 32b3907955730aaa083bd808430fcbec96f5cd26 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 1 Jul 2025 15:30:13 -0700 Subject: [PATCH 30/36] Use semantic diagnosics from old snapshot to compare --- internal/incremental/program.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/incremental/program.go b/internal/incremental/program.go index a463df27d3..e2cea7ddc3 100644 --- a/internal/incremental/program.go +++ b/internal/incremental/program.go @@ -4,7 +4,6 @@ import ( "context" "encoding/json" "fmt" - "maps" "slices" "github.com/microsoft/typescript-go/internal/ast" @@ -40,7 +39,9 @@ func NewProgram(program *compiler.Program, oldProgram *Program, testing bool) *P } if testing { - incrementalProgram.semanticDiagnosticsPerFile = maps.Clone(incrementalProgram.snapshot.semanticDiagnosticsPerFile) + if oldProgram != nil { + incrementalProgram.semanticDiagnosticsPerFile = oldProgram.snapshot.semanticDiagnosticsPerFile + } incrementalProgram.updatedSignatureKinds = &collections.SyncMap[tspath.Path, SignatureUpdateKind]{} } return incrementalProgram From 728c2f717edb87659c1d663a71fb2d93c97c592d Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 1 Jul 2025 13:50:22 -0700 Subject: [PATCH 31/36] Fix incremental updates --- internal/execute/tsc.go | 4 +- internal/execute/tscincremental_test.go | 1 + internal/execute/tsctestrunner_test.go | 4 + internal/execute/tscwatch_test.go | 2 +- internal/incremental/emitfileshandler.go | 30 +-- internal/incremental/program.go | 16 +- internal/incremental/snapshot.go | 5 +- internal/tsoptions/declscompiler.go | 2 +- internal/tsoptions/parsinghelpers.go | 2 +- ...ion-field-with-declaration-emit-enabled.js | 215 +--------------- ...e-to-modifier-of-class-expression-field.js | 239 +----------------- .../incremental/serializing-error-chain.js | 27 ++ .../noEmit/dts-errors-without-dts-enabled.js | 22 +- .../reference/tscWatch/noEmit/dts-errors.js | 22 +- .../tscWatch/noEmit/semantic-errors.js | 22 +- .../tscWatch/noEmit/syntax-errors.js | 16 +- 16 files changed, 93 insertions(+), 536 deletions(-) diff --git a/internal/execute/tsc.go b/internal/execute/tsc.go index 71bf78b044..c873484ff7 100644 --- a/internal/execute/tsc.go +++ b/internal/execute/tsc.go @@ -56,7 +56,7 @@ func CommandLine(sys System, commandLineArgs []string, testing bool) (ExitStatus parsedCommandLine := tsoptions.ParseCommandLine(commandLineArgs, sys) status, incrementalProgram, watcher := tscCompilation(sys, parsedCommandLine, testing) - if watcher == nil { + if watcher != nil { watcher.start() } return status, parsedCommandLine, incrementalProgram, watcher @@ -371,7 +371,7 @@ func emitFilesAndReportErrors( if sys.Writer() != nil { for _, file := range emitResult.EmittedFiles { - fmt.Fprint(sys.Writer(), "TSFILE: ", tspath.GetNormalizedAbsolutePath(file, sys.GetCurrentDirectory())) + fmt.Fprint(sys.Writer(), "TSFILE: ", tspath.GetNormalizedAbsolutePath(file, sys.GetCurrentDirectory()), sys.NewLine()) } listFiles(sys, program) } diff --git a/internal/execute/tscincremental_test.go b/internal/execute/tscincremental_test.go index a118a6aa4d..52928a6372 100644 --- a/internal/execute/tscincremental_test.go +++ b/internal/execute/tscincremental_test.go @@ -33,6 +33,7 @@ func TestIncremental(t *testing.T) {
)`, }, "/home/src/workspaces/project"), + edits: noChangeOnlyEdit, }, { subScenario: "serializing composite project", diff --git a/internal/execute/tsctestrunner_test.go b/internal/execute/tsctestrunner_test.go index 9053370d0f..ccb3cdf83a 100644 --- a/internal/execute/tsctestrunner_test.go +++ b/internal/execute/tsctestrunner_test.go @@ -25,6 +25,10 @@ var noChange = &testTscEdit{ edit: func(sys *testSys) {}, } +var noChangeOnlyEdit = []*testTscEdit{ + noChange, +} + type tscInput struct { subScenario string commandLineArgs []string diff --git a/internal/execute/tscwatch_test.go b/internal/execute/tscwatch_test.go index e4d021c63a..e16da6b5c0 100644 --- a/internal/execute/tscwatch_test.go +++ b/internal/execute/tscwatch_test.go @@ -63,7 +63,7 @@ func noEmitWatchTestInput( commandLineArgs: commandLineArgs, sys: sys, edits: []*testTscEdit{ - newTscEdit("fix syntax error", func(sys *testSys) { + newTscEdit("fix error", func(sys *testSys) { sys.WriteFileNoError("/home/src/workspaces/project/a.ts", `const a = "hello";`, false) }), newTscEdit("emit after fixing error", func(sys *testSys) { diff --git a/internal/incremental/emitfileshandler.go b/internal/incremental/emitfileshandler.go index bd88e9fdf9..04d223d964 100644 --- a/internal/incremental/emitfileshandler.go +++ b/internal/incremental/emitfileshandler.go @@ -97,26 +97,26 @@ func (h *emitFilesHandler) emitAllAffectedFiles(options compiler.EmitOptions) *c if h.ctx.Err() != nil { return nil } + } - // Get updated errors that were not included in affected files emit - for path, diagnostics := range h.program.snapshot.emitDiagnosticsPerFile { - if _, ok := h.emitUpdates.Load(path); !ok { - affectedFile := h.program.program.GetSourceFileByPath(path) - if affectedFile == nil || !h.program.program.SourceFileMayBeEmitted(affectedFile, false) { - h.deletedPendingKinds.Add(path) - continue - } - pendingKind := h.program.snapshot.affectedFilesPendingEmit[path] - h.emitUpdates.Store(path, &emitUpdate{pendingKind: pendingKind, result: &compiler.EmitResult{ - EmitSkipped: true, - Diagnostics: diagnostics.getDiagnostics(h.program.program, affectedFile), - }}) + // Get updated errors that were not included in affected files emit + for path, diagnostics := range h.program.snapshot.emitDiagnosticsPerFile { + if _, ok := h.emitUpdates.Load(path); !ok { + affectedFile := h.program.program.GetSourceFileByPath(path) + if affectedFile == nil || !h.program.program.SourceFileMayBeEmitted(affectedFile, false) { + h.deletedPendingKinds.Add(path) + continue } + pendingKind := h.program.snapshot.affectedFilesPendingEmit[path] + h.emitUpdates.Store(path, &emitUpdate{pendingKind: pendingKind, result: &compiler.EmitResult{ + EmitSkipped: true, + Diagnostics: diagnostics.getDiagnostics(h.program.program, affectedFile), + }}) } - - results = h.updateSnapshot() } + results = h.updateSnapshot() + // Combine results and update buildInfo if h.isForDtsErrors && options.TargetSourceFile != nil { // Result from cache diff --git a/internal/incremental/program.go b/internal/incremental/program.go index e2cea7ddc3..cbf58468cb 100644 --- a/internal/incremental/program.go +++ b/internal/incremental/program.go @@ -234,13 +234,15 @@ func (h *Program) emitBuildInfo(ctx context.Context, options compiler.EmitOption if buildInfoFileName == "" { return nil } - - hasErrors := h.ensureHasErrorsForState(ctx, h.program) - if !h.snapshot.buildInfoEmitPending && h.snapshot.hasErrors == hasErrors { + if h.snapshot.hasErrors == core.TSUnknown { + h.snapshot.hasErrors = h.ensureHasErrorsForState(ctx, h.program) + if h.snapshot.hasErrors != h.snapshot.hasErrorsFromOldState { + h.snapshot.buildInfoEmitPending = true + } + } + if !h.snapshot.buildInfoEmitPending { return nil } - h.snapshot.hasErrors = hasErrors - h.snapshot.buildInfoEmitPending = true if ctx.Err() != nil { return nil } @@ -277,10 +279,6 @@ func (h *Program) emitBuildInfo(ctx context.Context, options compiler.EmitOption } func (h *Program) ensureHasErrorsForState(ctx context.Context, program *compiler.Program) core.Tristate { - if h.snapshot.hasErrors != core.TSUnknown { - return h.snapshot.hasErrors - } - // 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 { semanticDiagnostics := h.snapshot.semanticDiagnosticsPerFile[file.Path()] diff --git a/internal/incremental/snapshot.go b/internal/incremental/snapshot.go index 16d99391ee..351e852a0f 100644 --- a/internal/incremental/snapshot.go +++ b/internal/incremental/snapshot.go @@ -209,6 +209,7 @@ type snapshot struct { // true if build info emit is pending buildInfoEmitPending bool + hasErrorsFromOldState core.Tristate allFilesExcludingDefaultLibraryFileOnce sync.Once // Cache of all files excluding default library file for the current program allFilesExcludingDefaultLibraryFile []*ast.SourceFile @@ -232,6 +233,7 @@ func (s *snapshot) addFileToAffectedFilesPendingEmit(filePath tspath.Path, emitK } s.affectedFilesPendingEmit[filePath] = existingKind | emitKind delete(s.emitDiagnosticsPerFile, filePath) + s.buildInfoEmitPending = true } func (s *snapshot) getAllFilesExcludingDefaultLibraryFile(program *compiler.Program, firstSourceFile *ast.SourceFile) []*ast.SourceFile { @@ -278,6 +280,7 @@ func newSnapshotForProgram(program *compiler.Program, oldProgram *Program) *snap snapshot.affectedFilesPendingEmit = maps.Clone(oldProgram.snapshot.affectedFilesPendingEmit) } snapshot.buildInfoEmitPending = oldProgram.snapshot.buildInfoEmitPending + snapshot.hasErrorsFromOldState = oldProgram.snapshot.hasErrors } else { snapshot.changedFilesSet = &collections.Set[tspath.Path]{} snapshot.buildInfoEmitPending = snapshot.options.IsIncremental() @@ -312,7 +315,7 @@ func newSnapshotForProgram(program *compiler.Program, oldProgram *Program) *snap if oldProgram != nil { if oldFileInfo, ok := oldProgram.snapshot.fileInfos[file.Path()]; ok { signature = oldFileInfo.signature - if oldFileInfo.version == version || oldFileInfo.affectsGlobalScope != affectsGlobalScope || oldFileInfo.impliedNodeFormat != impliedNodeFormat { + if oldFileInfo.version != version || oldFileInfo.affectsGlobalScope != affectsGlobalScope || oldFileInfo.impliedNodeFormat != impliedNodeFormat { snapshot.addFileToChangeSet(file.Path()) } else if oldReferences, _ := oldProgram.snapshot.referencedMap.GetValues(file.Path()); !newReferences.Equals(oldReferences) { // Referenced files changed diff --git a/internal/tsoptions/declscompiler.go b/internal/tsoptions/declscompiler.go index 3e156db4f6..818abd75e4 100644 --- a/internal/tsoptions/declscompiler.go +++ b/internal/tsoptions/declscompiler.go @@ -1249,7 +1249,7 @@ func optionsHaveChanges(oldOptions *core.CompilerOptions, newOptions *core.Compi } oldOptionsValue := reflect.ValueOf(oldOptions).Elem() return ForEachCompilerOptionValue(newOptions, declFilter, func(option *CommandLineOption, value reflect.Value, i int) bool { - return !reflect.DeepEqual(value, oldOptionsValue.Field(i)) + return !reflect.DeepEqual(value.Interface(), oldOptionsValue.Field(i).Interface()) }) } diff --git a/internal/tsoptions/parsinghelpers.go b/internal/tsoptions/parsinghelpers.go index 7c66406981..c827978a95 100644 --- a/internal/tsoptions/parsinghelpers.go +++ b/internal/tsoptions/parsinghelpers.go @@ -262,7 +262,7 @@ func parseCompilerOptions(key string, value any, allOptions *core.CompilerOption case "isolatedDeclarations": allOptions.IsolatedDeclarations = parseTristate(value) case "jsx": - allOptions.Jsx = value.(core.JsxEmit) + allOptions.Jsx = floatOrInt32ToFlag[core.JsxEmit](value) case "jsxFactory": allOptions.JsxFactory = parseString(value) case "jsxFragmentFactory": diff --git a/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js index 0b763a14a3..84c5b78abe 100644 --- a/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js +++ b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js @@ -157,23 +157,11 @@ Edit:: no change ExitStatus:: 0 Output:: -//// [/home/src/workspaces/project/MessageablePerson.d.ts] *modified time* -//// [/home/src/workspaces/project/MessageablePerson.js] *modified time* -//// [/home/src/workspaces/project/main.d.ts] *modified time* -//// [/home/src/workspaces/project/main.js] *modified time* -//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified time* -//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified time* SemanticDiagnostics:: -*refresh* /home/src/tslibs/TS/Lib/lib.d.ts -*refresh* /home/src/workspaces/project/MessageablePerson.ts -*refresh* /home/src/workspaces/project/main.ts Signatures:: -(used version) /home/src/tslibs/TS/Lib/lib.d.ts -(computed .d.ts) /home/src/workspaces/project/MessageablePerson.ts -(computed .d.ts) /home/src/workspaces/project/main.ts Edit:: modify public to protected @@ -216,7 +204,7 @@ Errors Files //// [/home/src/workspaces/project/main.d.ts] *modified time* //// [/home/src/workspaces/project/main.js] *modified time* //// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* -{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":[{"version":"575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ab8b2498ae671bdc5aefe51a9de13bf17d8e0438f2f573353d18e104344dd81f","signature":"6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe","impliedNodeFormat":1},{"version":"36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"declaration":true,"module":99},"referencedMap":[[3,1]],"semanticDiagnosticsPerFile":[[3,[{"pos":204,"end":211,"code":2445,"category":1,"message":"Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses."}]]],"emitDiagnosticsPerFile":[[2,[{"pos":261,"end":268,"code":4094,"category":1,"message":"Property 'message' of exported anonymous class type may not be private or protected.","relatedInformation":[{"pos":261,"end":268,"code":9027,"category":1,"message":"Add a type annotation to the variable wrapper."}]}]]]} +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":[{"version":"575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ab8b2498ae671bdc5aefe51a9de13bf17d8e0438f2f573353d18e104344dd81f","signature":"0858d1a081aa47feef2a37c5648868c3ecc110cde2469aea716091b9869a58ed","impliedNodeFormat":1},{"version":"36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"declaration":true,"module":99},"referencedMap":[[3,1]],"semanticDiagnosticsPerFile":[[3,[{"pos":204,"end":211,"code":2445,"category":1,"message":"Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses."}]]],"emitDiagnosticsPerFile":[[2,[{"pos":261,"end":268,"code":4094,"category":1,"message":"Property 'message' of exported anonymous class type may not be private or protected.","relatedInformation":[{"pos":261,"end":268,"code":9027,"category":1,"message":"Add a type annotation to the variable wrapper."}]}]]]} //// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* { "version": "FakeTSVersion", @@ -241,11 +229,11 @@ Errors Files { "fileName": "./MessageablePerson.ts", "version": "ab8b2498ae671bdc5aefe51a9de13bf17d8e0438f2f573353d18e104344dd81f", - "signature": "6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe", + "signature": "0858d1a081aa47feef2a37c5648868c3ecc110cde2469aea716091b9869a58ed", "impliedNodeFormat": "CommonJS", "original": { "version": "ab8b2498ae671bdc5aefe51a9de13bf17d8e0438f2f573353d18e104344dd81f", - "signature": "6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe", + "signature": "0858d1a081aa47feef2a37c5648868c3ecc110cde2469aea716091b9869a58ed", "impliedNodeFormat": 1 } }, @@ -317,18 +305,17 @@ Errors Files SemanticDiagnostics:: -*refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/MessageablePerson.ts *refresh* /home/src/workspaces/project/main.ts Signatures:: -(used version) /home/src/tslibs/TS/Lib/lib.d.ts +(computed .d.ts) /home/src/workspaces/project/MessageablePerson.ts (computed .d.ts) /home/src/workspaces/project/main.ts Edit:: no change -ExitStatus:: 2 +ExitStatus:: 1 Output:: MessageablePerson.ts:7:31 - error TS4094: Property 'message' of exported anonymous class type may not be private or protected. @@ -351,120 +338,13 @@ Errors Files 1 MessageablePerson.ts:7 1 main.ts:4 -//// [/home/src/workspaces/project/MessageablePerson.d.ts] *modified time* -//// [/home/src/workspaces/project/MessageablePerson.js] *modified time* -//// [/home/src/workspaces/project/main.d.ts] *modified time* -//// [/home/src/workspaces/project/main.js] *modified time* -//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* -{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":[{"version":"575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ab8b2498ae671bdc5aefe51a9de13bf17d8e0438f2f573353d18e104344dd81f","signature":"0858d1a081aa47feef2a37c5648868c3ecc110cde2469aea716091b9869a58ed","impliedNodeFormat":1},{"version":"36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"declaration":true,"module":99},"referencedMap":[[3,1]],"semanticDiagnosticsPerFile":[[3,[{"pos":204,"end":211,"code":2445,"category":1,"message":"Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses."}]]],"emitDiagnosticsPerFile":[[2,[{"pos":261,"end":268,"code":4094,"category":1,"message":"Property 'message' of exported anonymous class type may not be private or protected.","relatedInformation":[{"pos":261,"end":268,"code":9027,"category":1,"message":"Add a type annotation to the variable wrapper."}]}]]]} -//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* -{ - "version": "FakeTSVersion", - "fileNames": [ - "../../tslibs/TS/Lib/lib.d.ts", - "./MessageablePerson.ts", - "./main.ts" - ], - "fileInfos": [ - { - "fileName": "../../tslibs/TS/Lib/lib.d.ts", - "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", - "signature": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "./MessageablePerson.ts", - "version": "ab8b2498ae671bdc5aefe51a9de13bf17d8e0438f2f573353d18e104344dd81f", - "signature": "0858d1a081aa47feef2a37c5648868c3ecc110cde2469aea716091b9869a58ed", - "impliedNodeFormat": "CommonJS", - "original": { - "version": "ab8b2498ae671bdc5aefe51a9de13bf17d8e0438f2f573353d18e104344dd81f", - "signature": "0858d1a081aa47feef2a37c5648868c3ecc110cde2469aea716091b9869a58ed", - "impliedNodeFormat": 1 - } - }, - { - "fileName": "./main.ts", - "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", - "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", - "impliedNodeFormat": "CommonJS", - "original": { - "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", - "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", - "impliedNodeFormat": 1 - } - } - ], - "fileIdsList": [ - [ - "./MessageablePerson.ts" - ] - ], - "options": { - "declaration": true, - "module": 99 - }, - "referencedMap": { - "./main.ts": [ - "./MessageablePerson.ts" - ] - }, - "semanticDiagnosticsPerFile": [ - [ - "./main.ts", - [ - { - "pos": 204, - "end": 211, - "code": 2445, - "category": 1, - "message": "Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses." - } - ] - ] - ], - "emitDiagnosticsPerFile": [ - [ - "./MessageablePerson.ts", - [ - { - "pos": 261, - "end": 268, - "code": 4094, - "category": 1, - "message": "Property 'message' of exported anonymous class type may not be private or protected.", - "relatedInformation": [ - { - "pos": 261, - "end": 268, - "code": 9027, - "category": 1, - "message": "Add a type annotation to the variable wrapper." - } - ] - } - ] - ] - ], - "size": 1203 -} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified time* +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified time* SemanticDiagnostics:: -*refresh* /home/src/tslibs/TS/Lib/lib.d.ts -*refresh* /home/src/workspaces/project/MessageablePerson.ts -*refresh* /home/src/workspaces/project/main.ts Signatures:: -(used version) /home/src/tslibs/TS/Lib/lib.d.ts -(computed .d.ts) /home/src/workspaces/project/MessageablePerson.ts -(computed .d.ts) /home/src/workspaces/project/main.ts Edit:: modify protected to public @@ -486,7 +366,7 @@ Output:: //// [/home/src/workspaces/project/main.d.ts] *modified time* //// [/home/src/workspaces/project/main.js] *modified time* //// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* -{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":[{"version":"575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a","signature":"0858d1a081aa47feef2a37c5648868c3ecc110cde2469aea716091b9869a58ed","impliedNodeFormat":1},{"version":"36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"declaration":true,"module":99},"referencedMap":[[3,1]]} +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":[{"version":"575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a","signature":"6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe","impliedNodeFormat":1},{"version":"36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"declaration":true,"module":99},"referencedMap":[[3,1]]} //// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* { "version": "FakeTSVersion", @@ -511,11 +391,11 @@ Output:: { "fileName": "./MessageablePerson.ts", "version": "ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a", - "signature": "0858d1a081aa47feef2a37c5648868c3ecc110cde2469aea716091b9869a58ed", + "signature": "6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe", "impliedNodeFormat": "CommonJS", "original": { "version": "ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a", - "signature": "0858d1a081aa47feef2a37c5648868c3ecc110cde2469aea716091b9869a58ed", + "signature": "6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe", "impliedNodeFormat": 1 } }, @@ -550,12 +430,11 @@ Output:: SemanticDiagnostics:: -*refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/MessageablePerson.ts *refresh* /home/src/workspaces/project/main.ts Signatures:: -(used version) /home/src/tslibs/TS/Lib/lib.d.ts +(computed .d.ts) /home/src/workspaces/project/MessageablePerson.ts (computed .d.ts) /home/src/workspaces/project/main.ts @@ -563,80 +442,8 @@ Edit:: no change ExitStatus:: 0 Output:: -//// [/home/src/workspaces/project/MessageablePerson.d.ts] *modified time* -//// [/home/src/workspaces/project/MessageablePerson.js] *modified time* -//// [/home/src/workspaces/project/main.d.ts] *modified time* -//// [/home/src/workspaces/project/main.js] *modified time* -//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* -{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":[{"version":"575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a","signature":"6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe","impliedNodeFormat":1},{"version":"36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"declaration":true,"module":99},"referencedMap":[[3,1]]} -//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* -{ - "version": "FakeTSVersion", - "fileNames": [ - "../../tslibs/TS/Lib/lib.d.ts", - "./MessageablePerson.ts", - "./main.ts" - ], - "fileInfos": [ - { - "fileName": "../../tslibs/TS/Lib/lib.d.ts", - "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", - "signature": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "./MessageablePerson.ts", - "version": "ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a", - "signature": "6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe", - "impliedNodeFormat": "CommonJS", - "original": { - "version": "ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a", - "signature": "6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe", - "impliedNodeFormat": 1 - } - }, - { - "fileName": "./main.ts", - "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", - "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", - "impliedNodeFormat": "CommonJS", - "original": { - "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", - "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", - "impliedNodeFormat": 1 - } - } - ], - "fileIdsList": [ - [ - "./MessageablePerson.ts" - ] - ], - "options": { - "declaration": true, - "module": 99 - }, - "referencedMap": { - "./main.ts": [ - "./MessageablePerson.ts" - ] - }, - "size": 697 -} SemanticDiagnostics:: -*refresh* /home/src/tslibs/TS/Lib/lib.d.ts -*refresh* /home/src/workspaces/project/MessageablePerson.ts -*refresh* /home/src/workspaces/project/main.ts Signatures:: -(used version) /home/src/tslibs/TS/Lib/lib.d.ts -(computed .d.ts) /home/src/workspaces/project/MessageablePerson.ts -(computed .d.ts) /home/src/workspaces/project/main.ts diff --git a/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js index 22003f7d8e..e8f9a01aaa 100644 --- a/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js +++ b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js @@ -132,80 +132,11 @@ Edit:: no change ExitStatus:: 0 Output:: -//// [/home/src/workspaces/project/MessageablePerson.js] *modified time* -//// [/home/src/workspaces/project/main.js] *modified time* -//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* -{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":[{"version":"575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a","signature":"6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe","impliedNodeFormat":1},{"version":"36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"module":99},"referencedMap":[[3,1]]} -//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* -{ - "version": "FakeTSVersion", - "fileNames": [ - "../../tslibs/TS/Lib/lib.d.ts", - "./MessageablePerson.ts", - "./main.ts" - ], - "fileInfos": [ - { - "fileName": "../../tslibs/TS/Lib/lib.d.ts", - "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", - "signature": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "./MessageablePerson.ts", - "version": "ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a", - "signature": "6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe", - "impliedNodeFormat": "CommonJS", - "original": { - "version": "ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a", - "signature": "6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe", - "impliedNodeFormat": 1 - } - }, - { - "fileName": "./main.ts", - "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", - "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", - "impliedNodeFormat": "CommonJS", - "original": { - "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", - "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", - "impliedNodeFormat": 1 - } - } - ], - "fileIdsList": [ - [ - "./MessageablePerson.ts" - ] - ], - "options": { - "module": 99 - }, - "referencedMap": { - "./main.ts": [ - "./MessageablePerson.ts" - ] - }, - "size": 678 -} SemanticDiagnostics:: -*refresh* /home/src/tslibs/TS/Lib/lib.d.ts -*refresh* /home/src/workspaces/project/MessageablePerson.ts -*refresh* /home/src/workspaces/project/main.ts Signatures:: -(used version) /home/src/tslibs/TS/Lib/lib.d.ts -(computed .d.ts) /home/src/workspaces/project/MessageablePerson.ts -(computed .d.ts) /home/src/workspaces/project/main.ts Edit:: modify public to protected @@ -233,7 +164,7 @@ Found 1 error in main.ts:4 //// [/home/src/workspaces/project/MessageablePerson.js] *modified time* //// [/home/src/workspaces/project/main.js] *modified time* //// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* -{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":[{"version":"575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ab8b2498ae671bdc5aefe51a9de13bf17d8e0438f2f573353d18e104344dd81f","signature":"6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe","impliedNodeFormat":1},{"version":"36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"module":99},"referencedMap":[[3,1]],"semanticDiagnosticsPerFile":[[3,[{"pos":204,"end":211,"code":2445,"category":1,"message":"Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses."}]]]} +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":[{"version":"575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ab8b2498ae671bdc5aefe51a9de13bf17d8e0438f2f573353d18e104344dd81f","signature":"0858d1a081aa47feef2a37c5648868c3ecc110cde2469aea716091b9869a58ed","impliedNodeFormat":1},{"version":"36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"module":99},"referencedMap":[[3,1]],"semanticDiagnosticsPerFile":[[3,[{"pos":204,"end":211,"code":2445,"category":1,"message":"Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses."}]]]} //// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* { "version": "FakeTSVersion", @@ -258,11 +189,11 @@ Found 1 error in main.ts:4 { "fileName": "./MessageablePerson.ts", "version": "ab8b2498ae671bdc5aefe51a9de13bf17d8e0438f2f573353d18e104344dd81f", - "signature": "6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe", + "signature": "0858d1a081aa47feef2a37c5648868c3ecc110cde2469aea716091b9869a58ed", "impliedNodeFormat": "CommonJS", "original": { "version": "ab8b2498ae671bdc5aefe51a9de13bf17d8e0438f2f573353d18e104344dd81f", - "signature": "6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe", + "signature": "0858d1a081aa47feef2a37c5648868c3ecc110cde2469aea716091b9869a58ed", "impliedNodeFormat": 1 } }, @@ -310,12 +241,11 @@ Found 1 error in main.ts:4 SemanticDiagnostics:: -*refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/MessageablePerson.ts *refresh* /home/src/workspaces/project/main.ts Signatures:: -(used version) /home/src/tslibs/TS/Lib/lib.d.ts +(computed .d.ts) /home/src/workspaces/project/MessageablePerson.ts (computed .d.ts) /home/src/workspaces/project/main.ts @@ -331,94 +261,11 @@ Output:: Found 1 error in main.ts:4 -//// [/home/src/workspaces/project/MessageablePerson.js] *modified time* -//// [/home/src/workspaces/project/main.js] *modified time* -//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* -{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":[{"version":"575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ab8b2498ae671bdc5aefe51a9de13bf17d8e0438f2f573353d18e104344dd81f","signature":"0858d1a081aa47feef2a37c5648868c3ecc110cde2469aea716091b9869a58ed","impliedNodeFormat":1},{"version":"36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"module":99},"referencedMap":[[3,1]],"semanticDiagnosticsPerFile":[[3,[{"pos":204,"end":211,"code":2445,"category":1,"message":"Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses."}]]]} -//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* -{ - "version": "FakeTSVersion", - "fileNames": [ - "../../tslibs/TS/Lib/lib.d.ts", - "./MessageablePerson.ts", - "./main.ts" - ], - "fileInfos": [ - { - "fileName": "../../tslibs/TS/Lib/lib.d.ts", - "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", - "signature": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "./MessageablePerson.ts", - "version": "ab8b2498ae671bdc5aefe51a9de13bf17d8e0438f2f573353d18e104344dd81f", - "signature": "0858d1a081aa47feef2a37c5648868c3ecc110cde2469aea716091b9869a58ed", - "impliedNodeFormat": "CommonJS", - "original": { - "version": "ab8b2498ae671bdc5aefe51a9de13bf17d8e0438f2f573353d18e104344dd81f", - "signature": "0858d1a081aa47feef2a37c5648868c3ecc110cde2469aea716091b9869a58ed", - "impliedNodeFormat": 1 - } - }, - { - "fileName": "./main.ts", - "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", - "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", - "impliedNodeFormat": "CommonJS", - "original": { - "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", - "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", - "impliedNodeFormat": 1 - } - } - ], - "fileIdsList": [ - [ - "./MessageablePerson.ts" - ] - ], - "options": { - "module": 99 - }, - "referencedMap": { - "./main.ts": [ - "./MessageablePerson.ts" - ] - }, - "semanticDiagnosticsPerFile": [ - [ - "./main.ts", - [ - { - "pos": 204, - "end": 211, - "code": 2445, - "category": 1, - "message": "Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses." - } - ] - ] - ], - "size": 878 -} SemanticDiagnostics:: -*refresh* /home/src/tslibs/TS/Lib/lib.d.ts -*refresh* /home/src/workspaces/project/MessageablePerson.ts -*refresh* /home/src/workspaces/project/main.ts Signatures:: -(used version) /home/src/tslibs/TS/Lib/lib.d.ts -(computed .d.ts) /home/src/workspaces/project/MessageablePerson.ts -(computed .d.ts) /home/src/workspaces/project/main.ts Edit:: modify protected to public @@ -438,7 +285,7 @@ Output:: //// [/home/src/workspaces/project/MessageablePerson.js] *modified time* //// [/home/src/workspaces/project/main.js] *modified time* //// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* -{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":[{"version":"575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a","signature":"0858d1a081aa47feef2a37c5648868c3ecc110cde2469aea716091b9869a58ed","impliedNodeFormat":1},{"version":"36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"module":99},"referencedMap":[[3,1]]} +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":[{"version":"575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a","signature":"6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe","impliedNodeFormat":1},{"version":"36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"module":99},"referencedMap":[[3,1]]} //// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* { "version": "FakeTSVersion", @@ -463,11 +310,11 @@ Output:: { "fileName": "./MessageablePerson.ts", "version": "ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a", - "signature": "0858d1a081aa47feef2a37c5648868c3ecc110cde2469aea716091b9869a58ed", + "signature": "6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe", "impliedNodeFormat": "CommonJS", "original": { "version": "ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a", - "signature": "0858d1a081aa47feef2a37c5648868c3ecc110cde2469aea716091b9869a58ed", + "signature": "6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe", "impliedNodeFormat": 1 } }, @@ -501,12 +348,11 @@ Output:: SemanticDiagnostics:: -*refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/MessageablePerson.ts *refresh* /home/src/workspaces/project/main.ts Signatures:: -(used version) /home/src/tslibs/TS/Lib/lib.d.ts +(computed .d.ts) /home/src/workspaces/project/MessageablePerson.ts (computed .d.ts) /home/src/workspaces/project/main.ts @@ -514,77 +360,8 @@ Edit:: no change ExitStatus:: 0 Output:: -//// [/home/src/workspaces/project/MessageablePerson.js] *modified time* -//// [/home/src/workspaces/project/main.js] *modified time* -//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* -{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":[{"version":"575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a","signature":"6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe","impliedNodeFormat":1},{"version":"36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"module":99},"referencedMap":[[3,1]]} -//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* -{ - "version": "FakeTSVersion", - "fileNames": [ - "../../tslibs/TS/Lib/lib.d.ts", - "./MessageablePerson.ts", - "./main.ts" - ], - "fileInfos": [ - { - "fileName": "../../tslibs/TS/Lib/lib.d.ts", - "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", - "signature": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", - "affectsGlobalScope": true, - "impliedNodeFormat": "CommonJS", - "original": { - "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", - "affectsGlobalScope": true, - "impliedNodeFormat": 1 - } - }, - { - "fileName": "./MessageablePerson.ts", - "version": "ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a", - "signature": "6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe", - "impliedNodeFormat": "CommonJS", - "original": { - "version": "ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a", - "signature": "6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe", - "impliedNodeFormat": 1 - } - }, - { - "fileName": "./main.ts", - "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", - "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", - "impliedNodeFormat": "CommonJS", - "original": { - "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", - "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", - "impliedNodeFormat": 1 - } - } - ], - "fileIdsList": [ - [ - "./MessageablePerson.ts" - ] - ], - "options": { - "module": 99 - }, - "referencedMap": { - "./main.ts": [ - "./MessageablePerson.ts" - ] - }, - "size": 678 -} SemanticDiagnostics:: -*refresh* /home/src/tslibs/TS/Lib/lib.d.ts -*refresh* /home/src/workspaces/project/MessageablePerson.ts -*refresh* /home/src/workspaces/project/main.ts Signatures:: -(used version) /home/src/tslibs/TS/Lib/lib.d.ts -(computed .d.ts) /home/src/workspaces/project/MessageablePerson.ts -(computed .d.ts) /home/src/workspaces/project/main.ts diff --git a/testdata/baselines/reference/tsc/incremental/serializing-error-chain.js b/testdata/baselines/reference/tsc/incremental/serializing-error-chain.js index bf4f06eda1..13d6fe891b 100644 --- a/testdata/baselines/reference/tsc/incremental/serializing-error-chain.js +++ b/testdata/baselines/reference/tsc/incremental/serializing-error-chain.js @@ -181,3 +181,30 @@ SemanticDiagnostics:: *refresh* /home/src/workspaces/project/index.tsx Signatures:: + + +Edit:: no change + +ExitStatus:: 2 +Output:: +index.tsx:11:23 - error TS2769: No overload matches this call. + The last overload gave the following error. + Type '{ children: any[]; }' is not assignable to type '{ children?: number | undefined; }'. + Types of property 'children' are incompatible. + Type 'any[]' is not assignable to type 'number'. + +11 ( +   ~~~~~~~~~ + + index.tsx:10:38 - The last overload is declared here. + 10 declare function Component(props: { children?: number }): any; +    ~~~~~~~~~ + + +Found 1 error in index.tsx:11 + + + +SemanticDiagnostics:: + +Signatures:: diff --git a/testdata/baselines/reference/tscWatch/noEmit/dts-errors-without-dts-enabled.js b/testdata/baselines/reference/tscWatch/noEmit/dts-errors-without-dts-enabled.js index 537e00f6e2..c1655abe70 100644 --- a/testdata/baselines/reference/tscWatch/noEmit/dts-errors-without-dts-enabled.js +++ b/testdata/baselines/reference/tscWatch/noEmit/dts-errors-without-dts-enabled.js @@ -49,7 +49,7 @@ SemanticDiagnostics:: Signatures:: -Edit:: fix syntax error +Edit:: fix error //// [/home/src/workspaces/project/a.ts] *modified* const a = "hello"; @@ -62,7 +62,7 @@ SemanticDiagnostics:: *refresh* /home/src/workspaces/project/a.ts Signatures:: -(used version) /home/src/tslibs/TS/Lib/lib.d.ts +(computed .d.ts) /home/src/workspaces/project/a.ts Edit:: emit after fixing error @@ -81,12 +81,8 @@ const a = "hello"; SemanticDiagnostics:: -*refresh* /home/src/tslibs/TS/Lib/lib.d.ts -*refresh* /home/src/workspaces/project/a.ts Signatures:: -(used version) /home/src/tslibs/TS/Lib/lib.d.ts -(computed .d.ts) /home/src/workspaces/project/a.ts Edit:: no emit run after fixing error @@ -103,12 +99,8 @@ Output:: SemanticDiagnostics:: -*refresh* /home/src/tslibs/TS/Lib/lib.d.ts -*refresh* /home/src/workspaces/project/a.ts Signatures:: -(used version) /home/src/tslibs/TS/Lib/lib.d.ts -(computed .d.ts) /home/src/workspaces/project/a.ts Edit:: introduce error @@ -124,7 +116,7 @@ SemanticDiagnostics:: *refresh* /home/src/workspaces/project/a.ts Signatures:: -(used version) /home/src/tslibs/TS/Lib/lib.d.ts +(computed .d.ts) /home/src/workspaces/project/a.ts Edit:: emit when error @@ -145,12 +137,8 @@ const a = class { SemanticDiagnostics:: -*refresh* /home/src/tslibs/TS/Lib/lib.d.ts -*refresh* /home/src/workspaces/project/a.ts Signatures:: -(used version) /home/src/tslibs/TS/Lib/lib.d.ts -(computed .d.ts) /home/src/workspaces/project/a.ts Edit:: no emit run when error @@ -167,9 +155,5 @@ Output:: SemanticDiagnostics:: -*refresh* /home/src/tslibs/TS/Lib/lib.d.ts -*refresh* /home/src/workspaces/project/a.ts Signatures:: -(used version) /home/src/tslibs/TS/Lib/lib.d.ts -(computed .d.ts) /home/src/workspaces/project/a.ts diff --git a/testdata/baselines/reference/tscWatch/noEmit/dts-errors.js b/testdata/baselines/reference/tscWatch/noEmit/dts-errors.js index 2561fbc93e..32ceb0e02e 100644 --- a/testdata/baselines/reference/tscWatch/noEmit/dts-errors.js +++ b/testdata/baselines/reference/tscWatch/noEmit/dts-errors.js @@ -62,7 +62,7 @@ SemanticDiagnostics:: Signatures:: -Edit:: fix syntax error +Edit:: fix error //// [/home/src/workspaces/project/a.ts] *modified* const a = "hello"; @@ -75,7 +75,7 @@ SemanticDiagnostics:: *refresh* /home/src/workspaces/project/a.ts Signatures:: -(used version) /home/src/tslibs/TS/Lib/lib.d.ts +(computed .d.ts) /home/src/workspaces/project/a.ts Edit:: emit after fixing error @@ -97,12 +97,8 @@ const a = "hello"; SemanticDiagnostics:: -*refresh* /home/src/tslibs/TS/Lib/lib.d.ts -*refresh* /home/src/workspaces/project/a.ts Signatures:: -(used version) /home/src/tslibs/TS/Lib/lib.d.ts -(computed .d.ts) /home/src/workspaces/project/a.ts Edit:: no emit run after fixing error @@ -119,12 +115,8 @@ Output:: SemanticDiagnostics:: -*refresh* /home/src/tslibs/TS/Lib/lib.d.ts -*refresh* /home/src/workspaces/project/a.ts Signatures:: -(used version) /home/src/tslibs/TS/Lib/lib.d.ts -(computed .d.ts) /home/src/workspaces/project/a.ts Edit:: introduce error @@ -152,7 +144,7 @@ SemanticDiagnostics:: *refresh* /home/src/workspaces/project/a.ts Signatures:: -(used version) /home/src/tslibs/TS/Lib/lib.d.ts +(computed .d.ts) /home/src/workspaces/project/a.ts Edit:: emit when error @@ -192,12 +184,8 @@ const a = class { SemanticDiagnostics:: -*refresh* /home/src/tslibs/TS/Lib/lib.d.ts -*refresh* /home/src/workspaces/project/a.ts Signatures:: -(used version) /home/src/tslibs/TS/Lib/lib.d.ts -(computed .d.ts) /home/src/workspaces/project/a.ts Edit:: no emit run when error @@ -226,9 +214,5 @@ Found 1 error in a.ts:1 SemanticDiagnostics:: -*refresh* /home/src/tslibs/TS/Lib/lib.d.ts -*refresh* /home/src/workspaces/project/a.ts Signatures:: -(used version) /home/src/tslibs/TS/Lib/lib.d.ts -(computed .d.ts) /home/src/workspaces/project/a.ts diff --git a/testdata/baselines/reference/tscWatch/noEmit/semantic-errors.js b/testdata/baselines/reference/tscWatch/noEmit/semantic-errors.js index 167621e54a..3df1ad44dd 100644 --- a/testdata/baselines/reference/tscWatch/noEmit/semantic-errors.js +++ b/testdata/baselines/reference/tscWatch/noEmit/semantic-errors.js @@ -57,7 +57,7 @@ SemanticDiagnostics:: Signatures:: -Edit:: fix syntax error +Edit:: fix error //// [/home/src/workspaces/project/a.ts] *modified* const a = "hello"; @@ -70,7 +70,7 @@ SemanticDiagnostics:: *refresh* /home/src/workspaces/project/a.ts Signatures:: -(used version) /home/src/tslibs/TS/Lib/lib.d.ts +(computed .d.ts) /home/src/workspaces/project/a.ts Edit:: emit after fixing error @@ -89,12 +89,8 @@ const a = "hello"; SemanticDiagnostics:: -*refresh* /home/src/tslibs/TS/Lib/lib.d.ts -*refresh* /home/src/workspaces/project/a.ts Signatures:: -(used version) /home/src/tslibs/TS/Lib/lib.d.ts -(computed .d.ts) /home/src/workspaces/project/a.ts Edit:: no emit run after fixing error @@ -111,12 +107,8 @@ Output:: SemanticDiagnostics:: -*refresh* /home/src/tslibs/TS/Lib/lib.d.ts -*refresh* /home/src/workspaces/project/a.ts Signatures:: -(used version) /home/src/tslibs/TS/Lib/lib.d.ts -(computed .d.ts) /home/src/workspaces/project/a.ts Edit:: introduce error @@ -140,7 +132,7 @@ SemanticDiagnostics:: *refresh* /home/src/workspaces/project/a.ts Signatures:: -(used version) /home/src/tslibs/TS/Lib/lib.d.ts +(computed .d.ts) /home/src/workspaces/project/a.ts Edit:: emit when error @@ -165,12 +157,8 @@ Found 1 error in a.ts:1 SemanticDiagnostics:: -*refresh* /home/src/tslibs/TS/Lib/lib.d.ts -*refresh* /home/src/workspaces/project/a.ts Signatures:: -(used version) /home/src/tslibs/TS/Lib/lib.d.ts -(computed .d.ts) /home/src/workspaces/project/a.ts Edit:: no emit run when error @@ -195,9 +183,5 @@ Found 1 error in a.ts:1 SemanticDiagnostics:: -*refresh* /home/src/tslibs/TS/Lib/lib.d.ts -*refresh* /home/src/workspaces/project/a.ts Signatures:: -(used version) /home/src/tslibs/TS/Lib/lib.d.ts -(computed .d.ts) /home/src/workspaces/project/a.ts diff --git a/testdata/baselines/reference/tscWatch/noEmit/syntax-errors.js b/testdata/baselines/reference/tscWatch/noEmit/syntax-errors.js index ba751fca69..43061e48b7 100644 --- a/testdata/baselines/reference/tscWatch/noEmit/syntax-errors.js +++ b/testdata/baselines/reference/tscWatch/noEmit/syntax-errors.js @@ -57,7 +57,7 @@ SemanticDiagnostics:: Signatures:: -Edit:: fix syntax error +Edit:: fix error //// [/home/src/workspaces/project/a.ts] *modified* const a = "hello"; @@ -70,7 +70,7 @@ SemanticDiagnostics:: *refresh* /home/src/workspaces/project/a.ts Signatures:: -(used version) /home/src/tslibs/TS/Lib/lib.d.ts +(computed .d.ts) /home/src/workspaces/project/a.ts Edit:: emit after fixing error @@ -89,12 +89,8 @@ const a = "hello"; SemanticDiagnostics:: -*refresh* /home/src/tslibs/TS/Lib/lib.d.ts -*refresh* /home/src/workspaces/project/a.ts Signatures:: -(used version) /home/src/tslibs/TS/Lib/lib.d.ts -(computed .d.ts) /home/src/workspaces/project/a.ts Edit:: no emit run after fixing error @@ -111,12 +107,8 @@ Output:: SemanticDiagnostics:: -*refresh* /home/src/tslibs/TS/Lib/lib.d.ts -*refresh* /home/src/workspaces/project/a.ts Signatures:: -(used version) /home/src/tslibs/TS/Lib/lib.d.ts -(computed .d.ts) /home/src/workspaces/project/a.ts Edit:: introduce error @@ -136,7 +128,6 @@ Found 1 error in a.ts:1 SemanticDiagnostics:: -*not cached* /home/src/tslibs/TS/Lib/lib.d.ts *not cached* /home/src/workspaces/project/a.ts Signatures:: @@ -166,11 +157,9 @@ const a = "hello; SemanticDiagnostics:: -*not cached* /home/src/tslibs/TS/Lib/lib.d.ts *not cached* /home/src/workspaces/project/a.ts Signatures:: -(used version) /home/src/tslibs/TS/Lib/lib.d.ts (computed .d.ts) /home/src/workspaces/project/a.ts @@ -196,7 +185,6 @@ Found 1 error in a.ts:1 SemanticDiagnostics:: -*not cached* /home/src/tslibs/TS/Lib/lib.d.ts *not cached* /home/src/workspaces/project/a.ts Signatures:: From 7e374a221ebb22e26ccb415bf37f435261885882 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 1 Jul 2025 18:09:33 -0700 Subject: [PATCH 32/36] More tests and updates --- internal/execute/testsys_test.go | 38 +- internal/execute/tsc_test.go | 199 ++- internal/execute/tscincremental_test.go | 622 ++++++- internal/execute/tscnocheck_test.go | 13 +- internal/execute/tscprojectreferences_test.go | 201 ++- internal/execute/tsctestrunner_test.go | 66 +- internal/incremental/snapshot.go | 2 +- internal/incremental/tosnapshot.go | 2 +- .../testutil/stringtestutil/stringtestutil.go | 43 + .../Parse--p-with-path-to-tsconfig-file.js | 7 +- .../Parse--p-with-path-to-tsconfig-folder.js | 7 +- .../reference/tsc/commandLine/Parse--p.js | 7 +- .../commandLine/Project-is-empty-string.js | 7 +- .../extends/configDir-template-showConfig.js | 73 +- .../configDir-template-with-commandline.js | 83 +- .../tsc/extends/configDir-template.js | 83 +- ...ion-field-with-declaration-emit-enabled.js | 179 ++- ...e-to-modifier-of-class-expression-field.js | 142 +- ...in-another-file-through-indirect-import.js | 296 ++++ ...s-global-through-export-in-another-file.js | 246 +++ .../const-enums-aliased-in-different-file.js | 559 +++++++ .../tsc/incremental/const-enums-aliased.js | 511 ++++++ .../reference/tsc/incremental/const-enums.js | 506 ++++++ .../generates-typerefs-correctly.js | 344 ++++ .../option-changes-with-composite.js | 1432 +++++++++++++++++ .../option-changes-with-incremental.js | 1375 ++++++++++++++++ ...ypes-found-doesn't-crash-under---strict.js | 147 ++ ...th-no-backing-types-found-doesn't-crash.js | 122 ++ .../serializing-composite-project.js | 12 +- .../incremental/serializing-error-chain.js | 97 +- .../tsc/incremental/tsbuildinfo-has-error.js | 103 ++ .../tsc/incremental/when-file-is-deleted.js | 183 +++ ...le-is-added,-the-signatures-are-updated.js | 841 ++++++++++ ...g-filename-for-buildinfo-on-commandline.js | 108 ++ .../when-passing-rootDir-from-commandline.js | 102 ++ ...when-passing-rootDir-is-in-the-tsconfig.js | 101 ++ .../tsc/incremental/with-only-dts-files.js | 150 ++ .../reference/tsc/noCheck/dts-errors.js | 6 +- .../reference/tsc/noCheck/semantic-errors.js | 6 +- .../reference/tsc/noCheck/syntax-errors.js | 6 +- .../noEmit/when-project-has-strict-true.js | 8 +- ...nterop-uses-referenced-project-settings.js | 66 +- ...erveConstEnums-and-verbatimModuleSyntax.js | 53 +- ...erenced-project-with-preserveConstEnums.js | 26 +- ...ativeImportExtensionsProjectReferences1.js | 58 +- ...ativeImportExtensionsProjectReferences2.js | 34 +- ...ativeImportExtensionsProjectReferences3.js | 42 +- ...ject-contains-invalid-project-reference.js | 6 +- .../when-project-reference-is-not-built.js | 12 +- ...eferences-composite-project-with-noEmit.js | 18 +- .../when-project-references-composite.js | 12 +- .../parse-tsconfig-with-typeAcquisition.js | 20 +- .../Parse-watch-interval-option.js | 7 +- 53 files changed, 8608 insertions(+), 781 deletions(-) create mode 100644 internal/testutil/stringtestutil/stringtestutil.go create mode 100644 testdata/baselines/reference/tsc/incremental/change-to-type-that-gets-used-as-global-through-export-in-another-file-through-indirect-import.js create mode 100644 testdata/baselines/reference/tsc/incremental/change-to-type-that-gets-used-as-global-through-export-in-another-file.js create mode 100644 testdata/baselines/reference/tsc/incremental/const-enums-aliased-in-different-file.js create mode 100644 testdata/baselines/reference/tsc/incremental/const-enums-aliased.js create mode 100644 testdata/baselines/reference/tsc/incremental/const-enums.js create mode 100644 testdata/baselines/reference/tsc/incremental/generates-typerefs-correctly.js create mode 100644 testdata/baselines/reference/tsc/incremental/option-changes-with-composite.js create mode 100644 testdata/baselines/reference/tsc/incremental/option-changes-with-incremental.js create mode 100644 testdata/baselines/reference/tsc/incremental/react-jsx-emit-mode-with-no-backing-types-found-doesn't-crash-under---strict.js create mode 100644 testdata/baselines/reference/tsc/incremental/react-jsx-emit-mode-with-no-backing-types-found-doesn't-crash.js create mode 100644 testdata/baselines/reference/tsc/incremental/tsbuildinfo-has-error.js create mode 100644 testdata/baselines/reference/tsc/incremental/when-file-is-deleted.js create mode 100644 testdata/baselines/reference/tsc/incremental/when-global-file-is-added,-the-signatures-are-updated.js create mode 100644 testdata/baselines/reference/tsc/incremental/when-passing-filename-for-buildinfo-on-commandline.js create mode 100644 testdata/baselines/reference/tsc/incremental/when-passing-rootDir-from-commandline.js create mode 100644 testdata/baselines/reference/tsc/incremental/when-passing-rootDir-is-in-the-tsconfig.js create mode 100644 testdata/baselines/reference/tsc/incremental/with-only-dts-files.js diff --git a/internal/execute/testsys_test.go b/internal/execute/testsys_test.go index 399ba2d9d9..b63bdbb875 100644 --- a/internal/execute/testsys_test.go +++ b/internal/execute/testsys_test.go @@ -15,6 +15,7 @@ import ( "github.com/microsoft/typescript-go/internal/execute" "github.com/microsoft/typescript-go/internal/incremental" "github.com/microsoft/typescript-go/internal/testutil/incrementaltestutil" + "github.com/microsoft/typescript-go/internal/testutil/stringtestutil" "github.com/microsoft/typescript-go/internal/tsoptions" "github.com/microsoft/typescript-go/internal/vfs" "github.com/microsoft/typescript-go/internal/vfs/vfstest" @@ -22,9 +23,10 @@ import ( type FileMap map[string]any -var ( - tscLibPath = "/home/src/tslibs/TS/Lib" - tscDefaultLibContent = `/// +var tscLibPath = "/home/src/tslibs/TS/Lib" + +var tscDefaultLibContent = stringtestutil.Dedent(` +/// interface Boolean {} interface Function {} interface CallableFunction {} @@ -45,8 +47,8 @@ declare var Symbol: SymbolConstructor; interface Symbol { readonly [Symbol.toStringTag]: string; } -declare const console: { log(msg: any): void; };` -) +declare const console: { log(msg: any): void; }; +`) func newTestSys(fileOrFolderList FileMap, cwd string) *testSys { if cwd == "" { @@ -256,12 +258,10 @@ func (s *testSys) baselineFSwithDiff(baseline io.Writer) { } if s.serializedDiff != nil { for path := range s.serializedDiff.snap { - if s.FS().FileExists(path) { - _, ok := s.TestFS().FS().ReadFile(path) - if !ok { - // report deleted - s.reportFSEntryDiff(baseline, nil, path) - } + _, ok := s.TestFS().FS().ReadFile(path) + if !ok { + // report deleted + s.reportFSEntryDiff(baseline, nil, path) } } } @@ -322,3 +322,19 @@ func (s *testSys) ReplaceFileText(path string, oldText string, newText string) { content = strings.Replace(content, oldText, newText, 1) s.WriteFileNoError(path, content, false) } + +func (s *testSys) AppendFile(path string, text string) { + content, ok := s.FS().ReadFile(path) + if !ok { + panic("File not found: " + path) + } + s.WriteFileNoError(path, content+text, false) +} + +func (s *testSys) PrependFile(path string, text string) { + content, ok := s.FS().ReadFile(path) + if !ok { + panic("File not found: " + path) + } + s.WriteFileNoError(path, text+content, false) +} diff --git a/internal/execute/tsc_test.go b/internal/execute/tsc_test.go index abb2570e35..40abee7c14 100644 --- a/internal/execute/tsc_test.go +++ b/internal/execute/tsc_test.go @@ -2,6 +2,8 @@ package execute_test import ( "testing" + + "github.com/microsoft/typescript-go/internal/testutil/stringtestutil" ) func TestTscCommandline(t *testing.T) { @@ -60,32 +62,56 @@ func TestTscCommandline(t *testing.T) { { subScenario: "Project is empty string", sys: newTestSys(FileMap{ - "/home/src/workspaces/project/first.ts": `export const a = 1`, - "/home/src/workspaces/project/tsconfig.json": `{ "compilerOptions": { "strict": true, "noEmit": true } }`, + "/home/src/workspaces/project/first.ts": `export const a = 1`, + "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` + { + "compilerOptions": { + "strict": true, + "noEmit": true + } + }`), }, ""), commandLineArgs: []string{}, }, { subScenario: "Parse -p", sys: newTestSys(FileMap{ - "/home/src/workspaces/project/first.ts": `export const a = 1`, - "/home/src/workspaces/project/tsconfig.json": `{ "compilerOptions": { "strict": true, "noEmit": true } }`, + "/home/src/workspaces/project/first.ts": `export const a = 1`, + "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` + { + "compilerOptions": { + "strict": true, + "noEmit": true + } + }`), }, ""), commandLineArgs: []string{"-p", "."}, }, { subScenario: "Parse -p with path to tsconfig file", sys: newTestSys(FileMap{ - "/home/src/workspaces/project/first.ts": `export const a = 1`, - "/home/src/workspaces/project/tsconfig.json": `{ "compilerOptions": { "strict": true, "noEmit": true } }`, + "/home/src/workspaces/project/first.ts": `export const a = 1`, + "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` + { + "compilerOptions": { + "strict": true, + "noEmit": true + } + }`), }, ""), commandLineArgs: []string{"-p", "/home/src/workspaces/project/tsconfig.json"}, }, { subScenario: "Parse -p with path to tsconfig folder", sys: newTestSys(FileMap{ - "/home/src/workspaces/project/first.ts": `export const a = 1`, - "/home/src/workspaces/project/tsconfig.json": `{ "compilerOptions": { "strict": true, "noEmit": true } }`, + "/home/src/workspaces/project/first.ts": `export const a = 1`, + "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` + { + "compilerOptions": { + "strict": true, + "noEmit": true + } + }`), }, ""), commandLineArgs: []string{"-p", "/home/src/workspaces/project"}, }, @@ -97,8 +123,14 @@ func TestTscCommandline(t *testing.T) { { subScenario: "Parse watch interval option", sys: newTestSys(FileMap{ - "/home/src/workspaces/project/first.ts": `export const a = 1`, - "/home/src/workspaces/project/tsconfig.json": `{ "compilerOptions": { "strict": true, "noEmit": true } }`, + "/home/src/workspaces/project/first.ts": `export const a = 1`, + "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` + { + "compilerOptions": { + "strict": true, + "noEmit": true + } + }`), }, ""), commandLineArgs: []string{"-w", "--watchInterval", "1000"}, }, @@ -119,12 +151,13 @@ func TestNoEmit(t *testing.T) { (&tscInput{ subScenario: "when project has strict true", sys: newTestSys(FileMap{ - "/home/src/workspaces/project/tsconfig.json": `{ - "compilerOptions": { - "incremental": true, - "strict": true, - }, -}`, + "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` + { + "compilerOptions": { + "incremental": true, + "strict": true + } + }`), "/home/src/workspaces/project/class1.ts": `export class class1 {}`, }, ""), commandLineArgs: []string{"--noEmit"}, @@ -133,67 +166,72 @@ func TestNoEmit(t *testing.T) { func TestExtends(t *testing.T) { t.Parallel() - extendsSysFiles := FileMap{ - "/home/src/projects/configs/first/tsconfig.json": `{ - "extends": "../second/tsconfig.json", - "include": ["${configDir}/src"], - "compilerOptions": { - "typeRoots": ["root1", "${configDir}/root2", "root3"], - "types": [], - }, -}`, - "/home/src/projects/configs/second/tsconfig.json": `{ - "files": ["${configDir}/main.ts"], - "compilerOptions": { - "declarationDir": "${configDir}/decls", - "paths": { - "@myscope/*": ["${configDir}/types/*"], - "other/*": ["other/*"], - }, - "baseUrl": "${configDir}", - }, - "watchOptions": { - "excludeFiles": ["${configDir}/main.ts"], - }, -}`, - "/home/src/projects/myproject/tsconfig.json": `{ - "extends": "../configs/first/tsconfig.json", - "compilerOptions": { - "declaration": true, - "outDir": "outDir", - "traceResolution": true, - }, -}`, - - "/home/src/projects/myproject/main.ts": ` - // some comment - export const y = 10; - import { x } from "@myscope/sometype"; -`, - "/home/src/projects/myproject/src/secondary.ts": ` - // some comment - export const z = 10; - import { k } from "other/sometype2"; -`, - "/home/src/projects/myproject/types/sometype.ts": ` - export const x = 10; -`, - "/home/src/projects/myproject/root2/other/sometype2/index.d.ts": ` - export const k = 10; -`, + extendsSys := func() *testSys { + return newTestSys(FileMap{ + "/home/src/projects/configs/first/tsconfig.json": stringtestutil.Dedent(` + { + "extends": "../second/tsconfig.json", + "include": ["${configDir}/src"], + "compilerOptions": { + "typeRoots": ["root1", "${configDir}/root2", "root3"], + "types": [], + } + }`), + "/home/src/projects/configs/second/tsconfig.json": stringtestutil.Dedent(` + { + "files": ["${configDir}/main.ts"], + "compilerOptions": { + "declarationDir": "${configDir}/decls", + "paths": { + "@myscope/*": ["${configDir}/types/*"], + "other/*": ["other/*"], + }, + "baseUrl": "${configDir}", + }, + "watchOptions": { + "excludeFiles": ["${configDir}/main.ts"], + }, + }`), + "/home/src/projects/myproject/tsconfig.json": stringtestutil.Dedent(` + { + "extends": "../configs/first/tsconfig.json", + "compilerOptions": { + "declaration": true, + "outDir": "outDir", + "traceResolution": true, + }, + }`), + "/home/src/projects/myproject/main.ts": stringtestutil.Dedent(` + // some comment + export const y = 10; + import { x } from "@myscope/sometype"; + `), + "/home/src/projects/myproject/src/secondary.ts": stringtestutil.Dedent(` + // some comment + export const z = 10; + import { k } from "other/sometype2"; + `), + "/home/src/projects/myproject/types/sometype.ts": stringtestutil.Dedent(` + // some comment + export const x = 10; + `), + "/home/src/projects/myproject/root2/other/sometype2/index.d.ts": stringtestutil.Dedent(` + export const k = 10; + `), + }, "/home/src/projects/myproject") } cases := []tscInput{{ subScenario: "configDir template", - sys: newTestSys(extendsSysFiles, "/home/src/projects/myproject"), + sys: extendsSys(), commandLineArgs: []string{"--explainFiles"}, }, { subScenario: "configDir template showConfig", - sys: newTestSys(extendsSysFiles, "/home/src/projects/myproject"), + sys: extendsSys(), commandLineArgs: []string{"--showConfig"}, }, { subScenario: "configDir template with commandline", - sys: newTestSys(extendsSysFiles, "/home/src/projects/myproject"), + sys: extendsSys(), commandLineArgs: []string{"--explainFiles", "--outDir", "${configDir}/outDir"}, }} @@ -206,20 +244,19 @@ func TestTypeAcquisition(t *testing.T) { t.Parallel() (&tscInput{ subScenario: "parse tsconfig with typeAcquisition", - sys: newTestSys(FileMap{"/home/src/workspaces/project/tsconfig.json": `{ - "compilerOptions": { - "composite": true, - "noEmit": true, - }, - "typeAcquisition": { - "enable": true, - "include": ["0.d.ts", "1.d.ts"], - "exclude": ["0.js", "1.js"], - "disableFilenameBasedTypeAcquisition": true, - }, -}`}, - "/home/src/workspaces/project", - ), + sys: newTestSys(FileMap{"/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` + { + "compilerOptions": { + "composite": true, + "noEmit": true, + }, + "typeAcquisition": { + "enable": true, + "include": ["0.d.ts", "1.d.ts"], + "exclude": ["0.js", "1.js"], + "disableFilenameBasedTypeAcquisition": true, + }, + }`)}, "/home/src/workspaces/project"), commandLineArgs: []string{}, }).run(t, "typeAcquisition") } diff --git a/internal/execute/tscincremental_test.go b/internal/execute/tscincremental_test.go index 52928a6372..ad42024c80 100644 --- a/internal/execute/tscincremental_test.go +++ b/internal/execute/tscincremental_test.go @@ -2,6 +2,9 @@ package execute_test import ( "testing" + + "github.com/microsoft/typescript-go/internal/core" + "github.com/microsoft/typescript-go/internal/testutil/stringtestutil" ) func TestIncremental(t *testing.T) { @@ -10,15 +13,16 @@ func TestIncremental(t *testing.T) { { subScenario: "serializing error chain", sys: newTestSys(FileMap{ - "/home/src/workspaces/project/tsconfig.json": `{ + "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` + { "compilerOptions": { "incremental": true, "strict": true, "jsx": "react", "module": "esnext", }, - }`, - "/home/src/workspaces/project/index.tsx": ` + }`), + "/home/src/workspaces/project/index.tsx": stringtestutil.Dedent(` declare namespace JSX { interface ElementChildrenAttribute { children: {}; } interface IntrinsicElements { div: {} } @@ -31,20 +35,21 @@ func TestIncremental(t *testing.T) { (
- )`, + )`), }, "/home/src/workspaces/project"), edits: noChangeOnlyEdit, }, { subScenario: "serializing composite project", sys: newTestSys(FileMap{ - "/home/src/workspaces/project/tsconfig.json": `{ + "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` + { "compilerOptions": { "composite": true, "strict": true, "module": "esnext", }, - }`, + }`), "/home/src/workspaces/project/index.tsx": `export const a = 1;`, "/home/src/workspaces/project/other.ts": `export const b = 2;`, }, "/home/src/workspaces/project"), @@ -52,13 +57,19 @@ func TestIncremental(t *testing.T) { { subScenario: "change to modifier of class expression field with declaration emit enabled", sys: newTestSys(FileMap{ - "/home/src/workspaces/project/tsconfig.json": `{ "compilerOptions": { "module": "esnext", "declaration": true } }`, - "/home/src/workspaces/project/main.ts": ` + "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` + { + "compilerOptions": { + "module": "esnext", + "declaration": true + } + }`), + "/home/src/workspaces/project/main.ts": stringtestutil.Dedent(` import MessageablePerson from './MessageablePerson.js'; function logMessage( person: MessageablePerson ) { console.log( person.message ); - }`, - "/home/src/workspaces/project/MessageablePerson.ts": ` + }`), + "/home/src/workspaces/project/MessageablePerson.ts": stringtestutil.Dedent(` const Messageable = () => { return class MessageableClass { public message = 'hello'; @@ -66,10 +77,10 @@ func TestIncremental(t *testing.T) { }; const wrapper = () => Messageable(); type MessageablePerson = InstanceType>; - export default MessageablePerson;`, - tscLibPath + "/lib.d.ts": tscDefaultLibContent + ` + export default MessageablePerson;`), + tscLibPath + "/lib.d.ts": tscDefaultLibContent + "\n" + stringtestutil.Dedent(` type ReturnType any> = T extends (...args: any) => infer R ? R : any; - type InstanceType any> = T extends abstract new (...args: any) => infer R ? R : any;`, + type InstanceType any> = T extends abstract new (...args: any) => infer R ? R : any;`), }, "/home/src/workspaces/project"), commandLineArgs: []string{"--incremental"}, edits: []*testTscEdit{ @@ -93,24 +104,29 @@ func TestIncremental(t *testing.T) { { subScenario: "change to modifier of class expression field", sys: newTestSys(FileMap{ - "/home/src/workspaces/project/tsconfig.json": `{ "compilerOptions": { "module": "esnext" } }`, - "/home/src/workspaces/project/main.ts": ` - import MessageablePerson from './MessageablePerson.js'; - function logMessage( person: MessageablePerson ) { - console.log( person.message ); - }`, - "/home/src/workspaces/project/MessageablePerson.ts": ` - const Messageable = () => { - return class MessageableClass { - public message = 'hello'; - } - }; - const wrapper = () => Messageable(); - type MessageablePerson = InstanceType>; - export default MessageablePerson;`, - tscLibPath + "/lib.d.ts": tscDefaultLibContent + ` + "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` + { + "compilerOptions": { + "module": "esnext" + } + }`), + "/home/src/workspaces/project/main.ts": stringtestutil.Dedent(` + import MessageablePerson from './MessageablePerson.js'; + function logMessage( person: MessageablePerson ) { + console.log( person.message ); + }`), + "/home/src/workspaces/project/MessageablePerson.ts": stringtestutil.Dedent(` + const Messageable = () => { + return class MessageableClass { + public message = 'hello'; + } + }; + const wrapper = () => Messageable(); + type MessageablePerson = InstanceType>; + export default MessageablePerson;`), + tscLibPath + "/lib.d.ts": tscDefaultLibContent + "\n" + stringtestutil.Dedent(` type ReturnType any> = T extends (...args: any) => infer R ? R : any; - type InstanceType any> = T extends abstract new (...args: any) => infer R ? R : any;`, + type InstanceType any> = T extends abstract new (...args: any) => infer R ? R : any;`), }, "/home/src/workspaces/project"), commandLineArgs: []string{"--incremental"}, edits: []*testTscEdit{ @@ -131,9 +147,555 @@ func TestIncremental(t *testing.T) { noChange, }, }, + { + subScenario: "when passing filename for buildinfo on commandline", + sys: newTestSys(FileMap{ + "/home/src/workspaces/project/src/main.ts": "export const x = 10;", + "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` + { + "compilerOptions": { + "target": "es5", + "module": "commonjs" + }, + "include": [ + "src/**/*.ts" + ], + }`), + }, "/home/src/workspaces/project"), + commandLineArgs: []string{"--incremental", "--tsBuildInfoFile", ".tsbuildinfo", "--explainFiles"}, + edits: noChangeOnlyEdit, + }, + { + subScenario: "when passing rootDir from commandline", + sys: newTestSys(FileMap{ + "/home/src/workspaces/project/src/main.ts": "export const x = 10;", + "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` + { + "compilerOptions": { + "incremental": true, + "outDir": "dist" + } + }`), + }, "/home/src/workspaces/project"), + commandLineArgs: []string{"--rootDir", "src"}, + edits: noChangeOnlyEdit, + }, + { + subScenario: "with only dts files", + sys: newTestSys(FileMap{ + "/home/src/workspaces/project/src/main.d.ts": "export const x = 10;", + "/home/src/workspaces/project/src/another.d.ts": "export const y = 10;", + "/home/src/workspaces/project/tsconfig.json": "{}", + }, "/home/src/workspaces/project"), + commandLineArgs: []string{"--incremental"}, + edits: []*testTscEdit{ + noChange, + { + caption: "modify d.ts file", + edit: func(sys *testSys) { + sys.AppendFile("/home/src/workspaces/project/src/main.d.ts", "export const xy = 100;") + }, + }, + }, + }, + { + subScenario: "when passing rootDir is in the tsconfig", + sys: newTestSys(FileMap{ + "/home/src/workspaces/project/src/main.ts": "export const x = 10;", + "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` + { + "compilerOptions": { + "incremental": true, + "outDir": "dist", + "rootDir": "./" + } + }`), + }, "/home/src/workspaces/project"), + edits: noChangeOnlyEdit, + }, + { + subScenario: "tsbuildinfo has error", + sys: newTestSys(FileMap{ + "/home/src/workspaces/project/main.ts": "export const x = 10;", + "/home/src/workspaces/project/tsconfig.json": "{}", + "/home/src/workspaces/project/tsconfig.tsbuildinfo": "Some random string", + }, "/home/src/workspaces/project"), + commandLineArgs: []string{"-i"}, + edits: []*testTscEdit{ + { + caption: "tsbuildinfo written has error", + edit: func(sys *testSys) { + sys.PrependFile("/home/src/workspaces/project/tsconfig.tsbuildinfo", "Some random string") + sys.ReplaceFileText("/home/src/workspaces/project/tsconfig.tsbuildinfo", `"version":"`+core.Version()+`"`, `"version":"FakeTSVersion"`) // build info won't parse, need to manually sterilize for baseline + }, + }, + }, + }, + { + subScenario: "when global file is added, the signatures are updated", + sys: newTestSys(FileMap{ + "/home/src/workspaces/project/src/main.ts": stringtestutil.Dedent(` + /// + /// + function main() { } + `), + "/home/src/workspaces/project/src/anotherFileWithSameReferenes.ts": stringtestutil.Dedent(` + /// + /// + function anotherFileWithSameReferenes() { } + `), + "/home/src/workspaces/project/src/filePresent.ts": `function something() { return 10; }`, + "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` + { + "compilerOptions": { "composite": true }, + "include": ["src/**/*.ts"], + }`), + }, "/home/src/workspaces/project"), + commandLineArgs: []string{}, + edits: []*testTscEdit{ + noChange, + { + caption: "Modify main file", + edit: func(sys *testSys) { + sys.AppendFile(`/home/src/workspaces/project/src/main.ts`, `something();`) + }, + }, + { + caption: "Modify main file again", + edit: func(sys *testSys) { + sys.AppendFile(`/home/src/workspaces/project/src/main.ts`, `something();`) + }, + }, + { + caption: "Add new file and update main file", + edit: func(sys *testSys) { + sys.WriteFileNoError(`/home/src/workspaces/project/src/newFile.ts`, "function foo() { return 20; }", false) + sys.PrependFile( + `/home/src/workspaces/project/src/main.ts`, + `/// +`, + ) + sys.AppendFile(`/home/src/workspaces/project/src/main.ts`, `foo();`) + }, + }, + { + caption: "Write file that could not be resolved", + edit: func(sys *testSys) { + sys.WriteFileNoError(`/home/src/workspaces/project/src/fileNotFound.ts`, "function something2() { return 20; }", false) + }, + }, + { + caption: "Modify main file", + edit: func(sys *testSys) { + sys.AppendFile(`/home/src/workspaces/project/src/main.ts`, `something();`) + }, + }, + }, + }, + { + subScenario: "react-jsx-emit-mode with no backing types found doesn't crash", + sys: newTestSys(FileMap{ + "/home/src/workspaces/project/node_modules/react/jsx-runtime.js": "export {}", // js needs to be present so there's a resolution result + "/home/src/workspaces/project/node_modules/@types/react/index.d.ts": stringtestutil.Dedent(` + export {}; + declare global { + namespace JSX { + interface Element {} + interface IntrinsicElements { + div: { + propA?: boolean; + }; + } + } + }`), // doesn't contain a jsx-runtime definition + "/home/src/workspaces/project/src/index.tsx": `export const App = () =>
;`, + "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` + { + "compilerOptions": { + "module": "commonjs", + "jsx": "react-jsx", + "incremental": true, + "jsxImportSource": "react" + } + }`), + }, "/home/src/workspaces/project"), + }, + { + subScenario: "react-jsx-emit-mode with no backing types found doesn't crash under --strict", + sys: newTestSys(FileMap{ + "/home/src/workspaces/project/node_modules/react/jsx-runtime.js": "export {}", // js needs to be present so there's a resolution result + "/home/src/workspaces/project/node_modules/@types/react/index.d.ts": stringtestutil.Dedent(` + export {}; + declare global { + namespace JSX { + interface Element {} + interface IntrinsicElements { + div: { + propA?: boolean; + }; + } + } + }`), // doesn't contain a jsx-runtime definition + "/home/src/workspaces/project/src/index.tsx": `export const App = () =>
;`, + "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` + { + "compilerOptions": { + "module": "commonjs", + "jsx": "react-jsx", + "incremental": true, + "jsxImportSource": "react" + } + }`), + }, "/home/src/workspaces/project"), + commandLineArgs: []string{"--strict"}, + }, + { + subScenario: "change to type that gets used as global through export in another file", + sys: newTestSys(FileMap{ + "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` + { + "compilerOptions": { + "composite": true + } + }`), + "/home/src/workspaces/project/class1.ts": stringtestutil.Dedent(` + const a: MagicNumber = 1; + console.log(a);`), + "/home/src/workspaces/project/constants.ts": "export default 1;", + "/home/src/workspaces/project/types.d.ts": `type MagicNumber = typeof import('./constants').default`, + }, "/home/src/workspaces/project"), + edits: []*testTscEdit{ + { + caption: "Modify imports used in global file", + edit: func(sys *testSys) { + sys.WriteFileNoError("/home/src/workspaces/project/constants.ts", "export default 2;", false) + }, + }, + }, + }, + { + subScenario: "change to type that gets used as global through export in another file through indirect import", + sys: newTestSys(FileMap{ + "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` + { + "compilerOptions": { + "composite": true + } + }`), + "/home/src/workspaces/project/class1.ts": stringtestutil.Dedent(` + const a: MagicNumber = 1; + console.log(a);`), + "/home/src/workspaces/project/constants.ts": "export default 1;", + "/home/src/workspaces/project/reexport.ts": `export { default as ConstantNumber } from "./constants"`, + "/home/src/workspaces/project/types.d.ts": `type MagicNumber = typeof import('./reexport').ConstantNumber`, + }, "/home/src/workspaces/project"), + edits: []*testTscEdit{ + { + caption: "Modify imports used in global file", + edit: func(sys *testSys) { + sys.WriteFileNoError("/home/src/workspaces/project/constants.ts", "export default 2;", false) + }, + }, + }, + }, + { + subScenario: "when file is deleted", + sys: newTestSys(FileMap{ + "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` + { + "compilerOptions": { + "composite": true, + "outDir": "outDir" + } + }`), + "/home/src/workspaces/project/file1.ts": `export class C { }`, + "/home/src/workspaces/project/file2.ts": `export class D { }`, + }, "/home/src/workspaces/project"), + edits: []*testTscEdit{ + { + caption: "delete file with imports", + edit: func(sys *testSys) { + err := sys.FS().Remove("/home/src/workspaces/project/file2.ts") + if err != nil { + panic(err) + } + }, + }, + }, + }, + { + subScenario: "generates typerefs correctly", + sys: newTestSys(FileMap{ + "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` + { + "compilerOptions": { + "composite": true, + "outDir": "outDir", + "checkJs": true + }, + "include": ["src"], + }`), + "/home/src/workspaces/project/src/box.ts": stringtestutil.Dedent(` + export interface Box { + unbox(): T + } + `), + "/home/src/workspaces/project/src/bug.js": stringtestutil.Dedent(` + import * as B from "./box.js" + import * as W from "./wrap.js" + + /** + * @template {object} C + * @param {C} source + * @returns {W.Wrap} + */ + const wrap = source => { + throw source + } + + /** + * @returns {B.Box} + */ + const box = (n = 0) => ({ unbox: () => n }) + + export const bug = wrap({ n: box(1) }); + `), + "/home/src/workspaces/project/src/wrap.ts": stringtestutil.Dedent(` + export type Wrap = { + [K in keyof C]: { wrapped: C[K] } + } + `), + }, "/home/src/workspaces/project"), + edits: []*testTscEdit{ + { + caption: "modify js file", + edit: func(sys *testSys) { + sys.AppendFile("/home/src/workspaces/project/src/bug.js", `export const something = 1;`) + }, + }, + }, + }, + getConstEnumTest(` + export const enum A { + ONE = 1 + } + `, "/home/src/workspaces/project/b.d.ts", ""), + getConstEnumTest(` + export const enum AWorker { + ONE = 1 + } + export { AWorker as A }; + `, "/home/src/workspaces/project/b.d.ts", " aliased"), + getConstEnumTest(`export { AWorker as A } from "./worker";`, "/home/src/workspaces/project/worker.d.ts", " aliased in different file"), + { + subScenario: "option changes with composite", + sys: newTestSys(FileMap{ + "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` + { + "compilerOptions": { + "composite": true, + } + }`), + "/home/src/workspaces/project/a.ts": `export const a = 10;const aLocal = 10;`, + "/home/src/workspaces/project/b.ts": `export const b = 10;const bLocal = 10;`, + "/home/src/workspaces/project/c.ts": `import { a } from "./a";export const c = a;`, + "/home/src/workspaces/project/d.ts": `import { b } from "./b";export const d = b;`, + }, "/home/src/workspaces/project"), + edits: []*testTscEdit{ + { + caption: "with sourceMap", + commandLineArgs: []string{"--sourceMap"}, + }, + { + caption: "should re-emit only js so they dont contain sourcemap", + }, + { + caption: "with declaration should not emit anything", + commandLineArgs: []string{"--declaration"}, + // discrepancyExplanation: () => [ + // `Clean build tsbuildinfo will have compilerOptions with composite and ${option.replace(/-/g, "")}`, + // `Incremental build will detect that it doesnt need to rebuild so tsbuild info is from before which has option composite only`, + // ], + }, + noChange, + { + caption: "with declaration and declarationMap", + commandLineArgs: []string{"--declaration", "--declarationMap"}, + }, + { + caption: "should re-emit only dts so they dont contain sourcemap", + }, + { + caption: "with emitDeclarationOnly should not emit anything", + commandLineArgs: []string{"--emitDeclarationOnly"}, + // discrepancyExplanation: () => [ + // `Clean build tsbuildinfo will have compilerOptions with composite and ${option.replace(/-/g, "")}`, + // `Incremental build will detect that it doesnt need to rebuild so tsbuild info is from before which has option composite only`, + // ], + }, + noChange, + { + caption: "local change", + edit: func(sys *testSys) { + sys.ReplaceFileText("/home/src/workspaces/project/a.ts", "Local = 1", "Local = 10") + }, + }, + { + caption: "with declaration should not emit anything", + commandLineArgs: []string{"--declaration"}, + // discrepancyExplanation: () => [ + // `Clean build tsbuildinfo will have compilerOptions with composite and ${option.replace(/-/g, "")}`, + // `Incremental build will detect that it doesnt need to rebuild so tsbuild info is from before which has option composite only`, + // ], + }, + { + caption: "with inlineSourceMap", + commandLineArgs: []string{"--inlineSourceMap"}, + }, + { + caption: "with sourceMap", + commandLineArgs: []string{"--sourceMap"}, + }, + { + caption: "declarationMap enabling", + edit: func(sys *testSys) { + sys.ReplaceFileText("/home/src/workspaces/project/tsconfig.json", `"composite": true,`, `"composite": true, "declarationMap": true`) + }, + }, + { + caption: "with sourceMap should not emit d.ts", + commandLineArgs: []string{"--sourceMap"}, + }, + }, + }, + { + subScenario: "option changes with incremental", + sys: newTestSys(FileMap{ + "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` + { + "compilerOptions": { + "incremental": true, + } + }`), + "/home/src/workspaces/project/a.ts": `export const a = 10;const aLocal = 10;`, + "/home/src/workspaces/project/b.ts": `export const b = 10;const bLocal = 10;`, + "/home/src/workspaces/project/c.ts": `import { a } from "./a";export const c = a;`, + "/home/src/workspaces/project/d.ts": `import { b } from "./b";export const d = b;`, + }, "/home/src/workspaces/project"), + edits: []*testTscEdit{ + { + caption: "with sourceMap", + commandLineArgs: []string{"--sourceMap"}, + }, + { + caption: "should re-emit only js so they dont contain sourcemap", + }, + { + caption: "with declaration, emit Dts and should not emit js", + commandLineArgs: []string{"--declaration"}, + }, + { + caption: "with declaration and declarationMap", + commandLineArgs: []string{"--declaration", "--declarationMap"}, + }, + { + caption: "no change", + // discrepancyExplanation: () => [ + // `Clean build tsbuildinfo will have compilerOptions {}`, + // `Incremental build will detect that it doesnt need to rebuild so tsbuild info is from before which has option declaration and declarationMap`, + // ], + }, + { + caption: "local change", + edit: func(sys *testSys) { + sys.ReplaceFileText("/home/src/workspaces/project/a.ts", "Local = 1", "Local = 10") + }, + }, + { + caption: "with declaration and declarationMap", + commandLineArgs: []string{"--declaration", "--declarationMap"}, + }, + { + caption: "no change", + // discrepancyExplanation: () => [ + // `Clean build tsbuildinfo will have compilerOptions {}`, + // `Incremental build will detect that it doesnt need to rebuild so tsbuild info is from before which has option declaration and declarationMap`, + // ], + }, + { + caption: "with inlineSourceMap", + commandLineArgs: []string{"--inlineSourceMap"}, + }, + { + caption: "with sourceMap", + commandLineArgs: []string{"--sourceMap"}, + }, + { + caption: "emit js files", + }, + { + caption: "with declaration and declarationMap", + commandLineArgs: []string{"--declaration", "--declarationMap"}, + }, + { + caption: "with declaration and declarationMap, should not re-emit", + commandLineArgs: []string{"--declaration", "--declarationMap"}, + }, + }, + }, } for _, test := range testCases { test.run(t, "incremental") } } + +func getConstEnumTest(bdsContents string, changeEnumFile string, testSuffix string) *tscInput { + return &tscInput{ + subScenario: "const enums" + testSuffix, + sys: newTestSys(FileMap{ + "/home/src/workspaces/project/a.ts": stringtestutil.Dedent(` + import {A} from "./c" + let a = A.ONE + `), + "/home/src/workspaces/project/b.d.ts": stringtestutil.Dedent(bdsContents), + "/home/src/workspaces/project/c.ts": stringtestutil.Dedent(` + import {A} from "./b" + let b = A.ONE + export {A} + `), + "/home/src/workspaces/project/worker.d.ts": stringtestutil.Dedent(` + export const enum AWorker { + ONE = 1 + } + `), + }, "/home/src/workspaces/project"), + commandLineArgs: []string{"-i", `a.ts`, "--tsbuildinfofile", "a.tsbuildinfo"}, + edits: []*testTscEdit{ + { + caption: "change enum value", + edit: func(sys *testSys) { + sys.ReplaceFileText(changeEnumFile, "1", "2") + }, + }, + { + caption: "change enum value again", + edit: func(sys *testSys) { + sys.ReplaceFileText(changeEnumFile, "2", "3") + }, + }, + { + caption: "something else changes in b.d.ts", + edit: func(sys *testSys) { + sys.AppendFile("/home/src/workspaces/project/b.d.ts", "export const randomThing = 10;") + }, + }, + { + caption: "something else changes in b.d.ts again", + edit: func(sys *testSys) { + sys.AppendFile("/home/src/workspaces/project/b.d.ts", "export const randomThing2 = 10;") + }, + }, + }, + } +} diff --git a/internal/execute/tscnocheck_test.go b/internal/execute/tscnocheck_test.go index 7817571351..1b987c9225 100644 --- a/internal/execute/tscnocheck_test.go +++ b/internal/execute/tscnocheck_test.go @@ -2,6 +2,8 @@ package execute_test import ( "testing" + + "github.com/microsoft/typescript-go/internal/testutil/stringtestutil" ) type noCheckScenario struct { @@ -22,11 +24,12 @@ func TestNoCheck(t *testing.T) { sys: newTestSys(FileMap{ "/home/src/workspaces/project/a.ts": c.aText, "/home/src/workspaces/project/b.ts": `export const b = 10;`, - "/home/src/workspaces/project/tsconfig.json": `{ - "compilerOptions": { - "declaration": true, - } -}`, + "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` + { + "compilerOptions": { + "declaration": true, + } + }`), // incremental: undefined, true }, "/home/src/workspaces/project"), commandLineArgs: []string{"--noCheck", "--outFile", "built"}, diff --git a/internal/execute/tscprojectreferences_test.go b/internal/execute/tscprojectreferences_test.go index 67c57b535e..303b05dfdf 100644 --- a/internal/execute/tscprojectreferences_test.go +++ b/internal/execute/tscprojectreferences_test.go @@ -2,6 +2,8 @@ package execute_test import ( "testing" + + "github.com/microsoft/typescript-go/internal/testutil/stringtestutil" ) func TestProjectReferences(t *testing.T) { @@ -12,21 +14,21 @@ func TestProjectReferences(t *testing.T) { subScenario: "when project references composite project with noEmit", sys: newTestSys(FileMap{ "/home/src/workspaces/solution/utils/index.ts": "export const x = 10;", - "/home/src/workspaces/solution/utils/tsconfig.json": `{ - "compilerOptions": { - "composite": true, - "noEmit": true, - }, - }`, + "/home/src/workspaces/solution/utils/tsconfig.json": stringtestutil.Dedent(` + { + "compilerOptions": { + "composite": true, + "noEmit": true + } + }`), "/home/src/workspaces/solution/project/index.ts": `import { x } from "../utils";`, - "/home/src/workspaces/solution/project/tsconfig.json": `{ - "references": [ - { "path": "../utils" }, - ], - }`, - }, - "/home/src/workspaces/solution", - ), + "/home/src/workspaces/solution/project/tsconfig.json": stringtestutil.Dedent(` + { + "references": [ + { "path": "../utils" }, + ], + }`), + }, "/home/src/workspaces/solution"), commandLineArgs: []string{"--p", "project"}, }, { @@ -34,17 +36,19 @@ func TestProjectReferences(t *testing.T) { sys: newTestSys(FileMap{ "/home/src/workspaces/solution/utils/index.ts": "export const x = 10;", "/home/src/workspaces/solution/utils/index.d.ts": "export declare const x = 10;", - "/home/src/workspaces/solution/utils/tsconfig.json": `{ - "compilerOptions": { - "composite": true, - }, -}`, + "/home/src/workspaces/solution/utils/tsconfig.json": stringtestutil.Dedent(` + { + "compilerOptions": { + "composite": true + } + }`), "/home/src/workspaces/solution/project/index.ts": `import { x } from "../utils";`, - "/home/src/workspaces/solution/project/tsconfig.json": `{ - "references": [ - { "path": "../utils" }, - ], -}`, + "/home/src/workspaces/solution/project/tsconfig.json": stringtestutil.Dedent(` + { + "references": [ + { "path": "../utils" }, + ], + }`), }, "/home/src/workspaces/solution"), commandLineArgs: []string{"--p", "project"}, }, @@ -52,17 +56,19 @@ func TestProjectReferences(t *testing.T) { subScenario: "when project reference is not built", sys: newTestSys(FileMap{ "/home/src/workspaces/solution/utils/index.ts": "export const x = 10;", - "/home/src/workspaces/solution/utils/tsconfig.json": `{ - "compilerOptions": { - "composite": true, - }, -}`, + "/home/src/workspaces/solution/utils/tsconfig.json": stringtestutil.Dedent(` + { + "compilerOptions": { + "composite": true + } + }`), "/home/src/workspaces/solution/project/index.ts": `import { x } from "../utils";`, - "/home/src/workspaces/solution/project/tsconfig.json": `{ - "references": [ - { "path": "../utils" }, - ], -}`, + "/home/src/workspaces/solution/project/tsconfig.json": stringtestutil.Dedent(` + { + "references": [ + { "path": "../utils" }, + ], + }`), }, "/home/src/workspaces/solution"), commandLineArgs: []string{"--p", "project"}, }, @@ -71,22 +77,31 @@ func TestProjectReferences(t *testing.T) { subScenario: "when project contains invalid project reference", sys: newTestSys(FileMap{ "/home/src/workspaces/solution/project/index.ts": `export const x = 10;`, - "/home/src/workspaces/solution/project/tsconfig.json": `{ - "references": [ - { "path": "../utils" }, - ], -}`, + "/home/src/workspaces/solution/project/tsconfig.json": stringtestutil.Dedent(` + { + "references": [ + { "path": "../utils" }, + ], + }`), }, "/home/src/workspaces/solution"), commandLineArgs: []string{"--p", "project"}, }, { subScenario: "default import interop uses referenced project settings", sys: newTestSys(FileMap{ - "/home/src/workspaces/project/node_modules/ambiguous-package/package.json": `{ "name": "ambiguous-package" }`, - "/home/src/workspaces/project/node_modules/ambiguous-package/index.d.ts": "export declare const ambiguous: number;", - "/home/src/workspaces/project/node_modules/esm-package/package.json": `{ "name": "esm-package", "type": "module" }`, - "/home/src/workspaces/project/node_modules/esm-package/index.d.ts": "export declare const esm: number;", - "/home/src/workspaces/project/lib/tsconfig.json": `{ + "/home/src/workspaces/project/node_modules/ambiguous-package/package.json": stringtestutil.Dedent(` + { + "name": "ambiguous-package" + }`), + "/home/src/workspaces/project/node_modules/ambiguous-package/index.d.ts": "export declare const ambiguous: number;", + "/home/src/workspaces/project/node_modules/esm-package/package.json": stringtestutil.Dedent(` + { + "name": "esm-package", + "type": "module" + }`), + "/home/src/workspaces/project/node_modules/esm-package/index.d.ts": "export declare const esm: number;", + "/home/src/workspaces/project/lib/tsconfig.json": stringtestutil.Dedent(` + { "compilerOptions": { "composite": true, "declaration": true, @@ -96,10 +111,11 @@ func TestProjectReferences(t *testing.T) { "moduleResolution": "bundler", }, "include": ["src"], - }`, + }`), "/home/src/workspaces/project/lib/src/a.ts": "export const a = 0;", "/home/src/workspaces/project/lib/dist/a.d.ts": "export declare const a = 0;", - "/home/src/workspaces/project/app/tsconfig.json": `{ + "/home/src/workspaces/project/app/tsconfig.json": stringtestutil.Dedent(` + { "compilerOptions": { "module": "esnext", "moduleResolution": "bundler", @@ -110,14 +126,14 @@ func TestProjectReferences(t *testing.T) { "references": [ { "path": "../lib" }, ], - }`, + }`), "/home/src/workspaces/project/app/src/local.ts": "export const local = 0;", - "/home/src/workspaces/project/app/src/index.ts": ` + "/home/src/workspaces/project/app/src/index.ts": stringtestutil.Dedent(` import local from "./local"; // Error import esm from "esm-package"; // Error import referencedSource from "../../lib/src/a"; // Error import referencedDeclaration from "../../lib/dist/a"; // Error - import ambiguous from "ambiguous-package"; // Ok`, + import ambiguous from "ambiguous-package"; // Ok`), }, "/home/src/workspaces/project"), commandLineArgs: []string{"--p", "app", "--pretty", "false"}, }, @@ -126,22 +142,24 @@ func TestProjectReferences(t *testing.T) { sys: newTestSys(FileMap{ "/home/src/workspaces/solution/utils/index.ts": "export const enum E { A = 1 }", "/home/src/workspaces/solution/utils/index.d.ts": "export declare const enum E { A = 1 }", - "/home/src/workspaces/solution/utils/tsconfig.json": `{ + "/home/src/workspaces/solution/utils/tsconfig.json": stringtestutil.Dedent(` + { "compilerOptions": { "composite": true, "declaration": true, "preserveConstEnums": true, }, - }`, + }`), "/home/src/workspaces/solution/project/index.ts": `import { E } from "../utils"; E.A;`, - "/home/src/workspaces/solution/project/tsconfig.json": `{ + "/home/src/workspaces/solution/project/tsconfig.json": stringtestutil.Dedent(` + { "compilerOptions": { "isolatedModules": true, }, "references": [ { "path": "../utils" }, ], - }`, + }`), }, "/home/src/workspaces/solution"), commandLineArgs: []string{"--p", "project"}, }, @@ -150,28 +168,31 @@ func TestProjectReferences(t *testing.T) { sys: newTestSys(FileMap{ "/home/src/workspaces/solution/preserve/index.ts": "export const enum E { A = 1 }", "/home/src/workspaces/solution/preserve/index.d.ts": "export declare const enum E { A = 1 }", - "/home/src/workspaces/solution/preserve/tsconfig.json": `{ + "/home/src/workspaces/solution/preserve/tsconfig.json": stringtestutil.Dedent(` + { "compilerOptions": { "composite": true, "declaration": true, "preserveConstEnums": true, }, - }`, + }`), "/home/src/workspaces/solution/no-preserve/index.ts": "export const enum E { A = 1 }", "/home/src/workspaces/solution/no-preserve/index.d.ts": "export declare const enum F { A = 1 }", - "/home/src/workspaces/solution/no-preserve/tsconfig.json": `{ + "/home/src/workspaces/solution/no-preserve/tsconfig.json": stringtestutil.Dedent(` + { "compilerOptions": { "composite": true, "declaration": true, "preserveConstEnums": false, }, - }`, - "/home/src/workspaces/solution/project/index.ts": ` - import { E } from "../preserve"; - import { F } from "../no-preserve"; - E.A; - F.A;`, - "/home/src/workspaces/solution/project/tsconfig.json": `{ + }`), + "/home/src/workspaces/solution/project/index.ts": stringtestutil.Dedent(` + import { E } from "../preserve"; + import { F } from "../no-preserve"; + E.A; + F.A;`), + "/home/src/workspaces/solution/project/tsconfig.json": stringtestutil.Dedent(` + { "compilerOptions": { "module": "preserve", "verbatimModuleSyntax": true, @@ -180,22 +201,24 @@ func TestProjectReferences(t *testing.T) { { "path": "../preserve" }, { "path": "../no-preserve" }, ], - }`, + }`), }, "/home/src/workspaces/solution"), commandLineArgs: []string{"--p", "project", "--pretty", "false"}, }, { subScenario: "rewriteRelativeImportExtensionsProjectReferences1", sys: newTestSys(FileMap{ - "/home/src/workspaces/packages/common/tsconfig.json": `{ + "/home/src/workspaces/packages/common/tsconfig.json": stringtestutil.Dedent(` + { "compilerOptions": { "composite": true, "rootDir": "src", "outDir": "dist", "module": "nodenext" } - }`, - "/home/src/workspaces/packages/common/package.json": `{ + }`), + "/home/src/workspaces/packages/common/package.json": stringtestutil.Dedent(` + { "name": "common", "version": "1.0.0", "type": "module", @@ -205,10 +228,11 @@ func TestProjectReferences(t *testing.T) { "default": "./dist/index.js" } } - }`, + }`), "/home/src/workspaces/packages/common/src/index.ts": "export {};", "/home/src/workspaces/packages/common/dist/index.d.ts": "export {};", - "/home/src/workspaces/packages/main/tsconfig.json": `{ + "/home/src/workspaces/packages/main/tsconfig.json": stringtestutil.Dedent(` + { "compilerOptions": { "module": "nodenext", "rewriteRelativeImportExtensions": true, @@ -218,8 +242,11 @@ func TestProjectReferences(t *testing.T) { "references": [ { "path": "../common" } ] - }`, - "/home/src/workspaces/packages/main/package.json": `{ "type": "module" }`, + }`), + "/home/src/workspaces/packages/main/package.json": stringtestutil.Dedent(` + { + "type": "module" + }`), "/home/src/workspaces/packages/main/src/index.ts": `import {} from "../../common/src/index.ts";`, }, "/home/src/workspaces"), commandLineArgs: []string{"-p", "packages/main", "--pretty", "false"}, @@ -227,7 +254,8 @@ func TestProjectReferences(t *testing.T) { { subScenario: "rewriteRelativeImportExtensionsProjectReferences2", sys: newTestSys(FileMap{ - "/home/src/workspaces/solution/src/tsconfig-base.json": `{ + "/home/src/workspaces/solution/src/tsconfig-base.json": stringtestutil.Dedent(` + { "compilerOptions": { "module": "nodenext", "composite": true, @@ -235,20 +263,22 @@ func TestProjectReferences(t *testing.T) { "outDir": "../dist", "rewriteRelativeImportExtensions": true } - }`, - "/home/src/workspaces/solution/src/compiler/tsconfig.json": `{ + }`), + "/home/src/workspaces/solution/src/compiler/tsconfig.json": stringtestutil.Dedent(` + { "extends": "../tsconfig-base.json", "compilerOptions": {} - }`, + }`), "/home/src/workspaces/solution/src/compiler/parser.ts": "export {};", "/home/src/workspaces/solution/dist/compiler/parser.d.ts": "export {};", - "/home/src/workspaces/solution/src/services/tsconfig.json": `{ - "extends": "../tsconfig-base.json", + "/home/src/workspaces/solution/src/services/tsconfig.json": stringtestutil.Dedent(` + { + "extends": "../tsconfig-base.json", "compilerOptions": {}, "references": [ { "path": "../compiler" } ] - }`, + }`), "/home/src/workspaces/solution/src/services/services.ts": `import {} from "../compiler/parser.ts";`, }, "/home/src/workspaces/solution"), commandLineArgs: []string{"--p", "src/services", "--pretty", "false"}, @@ -256,23 +286,26 @@ func TestProjectReferences(t *testing.T) { { subScenario: "rewriteRelativeImportExtensionsProjectReferences3", sys: newTestSys(FileMap{ - "/home/src/workspaces/solution/src/tsconfig-base.json": `{ + "/home/src/workspaces/solution/src/tsconfig-base.json": stringtestutil.Dedent(` + { "compilerOptions": { "module": "nodenext", "composite": true, "rewriteRelativeImportExtensions": true } - }`, - "/home/src/workspaces/solution/src/compiler/tsconfig.json": `{ + }`), + "/home/src/workspaces/solution/src/compiler/tsconfig.json": stringtestutil.Dedent(` + { "extends": "../tsconfig-base.json", "compilerOptions": { "rootDir": ".", "outDir": "../../dist/compiler" } - }`, + }`), "/home/src/workspaces/solution/src/compiler/parser.ts": "export {};", "/home/src/workspaces/solution/dist/compiler/parser.d.ts": "export {};", - "/home/src/workspaces/solution/src/services/tsconfig.json": `{ + "/home/src/workspaces/solution/src/services/tsconfig.json": stringtestutil.Dedent(` + { "extends": "../tsconfig-base.json", "compilerOptions": { "rootDir": ".", @@ -281,7 +314,7 @@ func TestProjectReferences(t *testing.T) { "references": [ { "path": "../compiler" } ] - }`, + }`), "/home/src/workspaces/solution/src/services/services.ts": `import {} from "../compiler/parser.ts";`, }, "/home/src/workspaces/solution"), commandLineArgs: []string{"--p", "src/services", "--pretty", "false"}, diff --git a/internal/execute/tsctestrunner_test.go b/internal/execute/tsctestrunner_test.go index ccb3cdf83a..dfe5838793 100644 --- a/internal/execute/tsctestrunner_test.go +++ b/internal/execute/tsctestrunner_test.go @@ -22,7 +22,6 @@ type testTscEdit struct { var noChange = &testTscEdit{ caption: "no change", - edit: func(sys *testSys) {}, } var noChangeOnlyEdit = []*testTscEdit{ @@ -38,44 +37,43 @@ type tscInput struct { func (test *tscInput) run(t *testing.T, scenario string) { t.Helper() - t.Run(test.getTestName(), func(t *testing.T) { + t.Run(test.subScenario+" tsc baseline", func(t *testing.T) { t.Parallel() - t.Run("tsc baseline", func(t *testing.T) { - t.Parallel() - // initial test tsc compile - baselineBuilder := test.startBaseline() + // initial test tsc compile + baselineBuilder := test.startBaseline() - exit, parsedCommandLine, incrementalProgram, watcher := execute.CommandLine(test.sys, test.commandLineArgs, true) - baselineBuilder.WriteString("ExitStatus:: " + fmt.Sprint(exit)) + exit, parsedCommandLine, incrementalProgram, watcher := execute.CommandLine(test.sys, test.commandLineArgs, true) + baselineBuilder.WriteString("ExitStatus:: " + fmt.Sprint(exit)) - compilerOptionsString, _ := json.MarshalIndent(parsedCommandLine.CompilerOptions(), "", " ") - baselineBuilder.WriteString("\n\nCompilerOptions::") - baselineBuilder.Write(compilerOptionsString) + compilerOptionsString, _ := json.MarshalIndent(parsedCommandLine.CompilerOptions(), "", " ") + baselineBuilder.WriteString("\n\nCompilerOptions::") + baselineBuilder.Write(compilerOptionsString) - test.sys.serializeState(baselineBuilder) - test.sys.baselineProgram(baselineBuilder, incrementalProgram, watcher) - for _, do := range test.edits { + test.sys.serializeState(baselineBuilder) + test.sys.baselineProgram(baselineBuilder, incrementalProgram, watcher) + for _, do := range test.edits { + baselineBuilder.WriteString("\n\nEdit:: " + do.caption + "\n") + if do.edit != nil { do.edit(test.sys) - baselineBuilder.WriteString("\n\nEdit:: " + do.caption + "\n") - test.sys.baselineFSwithDiff(baselineBuilder) - - var incrementalProgram *incremental.Program - if watcher == nil { - exit, parsedCommandLine, incrementalProgram, watcher = execute.CommandLine(test.sys, core.IfElse(do.commandLineArgs == nil, test.commandLineArgs, do.commandLineArgs), true) - baselineBuilder.WriteString("ExitStatus:: " + fmt.Sprint(exit)) - } else { - watcher.DoCycle() - } - test.sys.serializeState(baselineBuilder) - test.sys.baselineProgram(baselineBuilder, incrementalProgram, watcher) } + test.sys.baselineFSwithDiff(baselineBuilder) + + var incrementalProgram *incremental.Program + if watcher == nil { + exit, parsedCommandLine, incrementalProgram, watcher = execute.CommandLine(test.sys, core.IfElse(do.commandLineArgs == nil, test.commandLineArgs, do.commandLineArgs), true) + baselineBuilder.WriteString("ExitStatus:: " + fmt.Sprint(exit)) + } else { + watcher.DoCycle() + } + test.sys.serializeState(baselineBuilder) + test.sys.baselineProgram(baselineBuilder, incrementalProgram, watcher) + } - options, name := test.getBaselineName(scenario, "") - baseline.Run(t, name, baselineBuilder.String(), options) - }) - - // !!! sheetal TODO :: add incremental correctness + options, name := test.getBaselineName(scenario, "") + baseline.Run(t, name, baselineBuilder.String(), options) }) + + // !!! sheetal TODO :: add incremental correctness } func (test *tscInput) getTestNamePrefix() string { @@ -94,10 +92,6 @@ func (test *tscInput) getTestNamePrefix() string { return commandName + w } -func (test *tscInput) getTestName() string { - return test.subScenario + " " + strings.Join(test.commandLineArgs, " ") -} - func (test *tscInput) getBaselineName(scenario string, suffix string) (baseline.Options, string) { return baseline.Options{Subfolder: filepath.Join(test.getTestNamePrefix(), scenario)}, strings.ReplaceAll(test.subScenario, " ", "-") + suffix + ".js" @@ -120,7 +114,7 @@ func (test *tscInput) startBaseline() *strings.Builder { func (test *tscInput) verifyCommandLineParsing(t *testing.T, scenario string) { t.Helper() - t.Run(test.getTestName(), func(t *testing.T) { + t.Run(test.subScenario, func(t *testing.T) { t.Parallel() t.Run("baseline for the tsc compiles", func(t *testing.T) { t.Parallel() diff --git a/internal/incremental/snapshot.go b/internal/incremental/snapshot.go index 351e852a0f..6e8c35f8f7 100644 --- a/internal/incremental/snapshot.go +++ b/internal/incremental/snapshot.go @@ -322,7 +322,7 @@ func newSnapshotForProgram(program *compiler.Program, oldProgram *Program) *snap snapshot.addFileToChangeSet(file.Path()) } else if newReferences != nil { for refPath := range newReferences.Keys() { - if program.GetSourceFileByPath(refPath) == nil { + if program.GetSourceFileByPath(refPath) == nil && oldProgram.snapshot.fileInfos[refPath] != nil { // Referenced file was deleted in the new program snapshot.addFileToChangeSet(file.Path()) break diff --git a/internal/incremental/tosnapshot.go b/internal/incremental/tosnapshot.go index 524279ef79..1992801302 100644 --- a/internal/incremental/tosnapshot.go +++ b/internal/incremental/tosnapshot.go @@ -100,7 +100,7 @@ func (t *toSnapshot) setFileInfoAndEmitSignatures() { info := buildInfoFileInfo.GetFileInfo() t.snapshot.fileInfos[path] = info // Add default emit signature as file's signature - if info.signature != "" && len(t.snapshot.emitSignatures) != 0 { + if info.signature != "" && t.snapshot.emitSignatures != nil { t.snapshot.emitSignatures[path] = &emitSignature{signature: info.signature} } } diff --git a/internal/testutil/stringtestutil/stringtestutil.go b/internal/testutil/stringtestutil/stringtestutil.go new file mode 100644 index 0000000000..80db676be1 --- /dev/null +++ b/internal/testutil/stringtestutil/stringtestutil.go @@ -0,0 +1,43 @@ +package stringtestutil + +import ( + "strings" + + "github.com/microsoft/typescript-go/internal/stringutil" +) + +func Dedent(text string) string { + lines := strings.Split(text, "\n") + // Remove blank lines in the beginning and end + // and convert all tabs in the beginning of line to spaces + startLine := -1 + lastLine := 0 + for i, line := range lines { + firstNonTab := strings.IndexFunc(line, func(r rune) bool { + return r != '\t' + }) + if firstNonTab > 0 { + line = strings.Repeat(" ", firstNonTab) + line[firstNonTab:] + lines[i] = line + } + line = strings.TrimSpace(line) + if line != "" { + if startLine == -1 { + startLine = i + } + lastLine = i + } + } + lines = lines[startLine : lastLine+1] + indentation := stringutil.GuessIndentation(lines) + if indentation > 0 { + for i := range lines { + if len(lines[i]) > indentation { + lines[i] = lines[i][indentation:] + } else { + lines[i] = "" + } + } + } + return strings.Join(lines, "\n") +} diff --git a/testdata/baselines/reference/tsc/commandLine/Parse--p-with-path-to-tsconfig-file.js b/testdata/baselines/reference/tsc/commandLine/Parse--p-with-path-to-tsconfig-file.js index 1420b1d582..d8565e075e 100644 --- a/testdata/baselines/reference/tsc/commandLine/Parse--p-with-path-to-tsconfig-file.js +++ b/testdata/baselines/reference/tsc/commandLine/Parse--p-with-path-to-tsconfig-file.js @@ -5,7 +5,12 @@ Input::-p /home/src/workspaces/project/tsconfig.json //// [/home/src/workspaces/project/first.ts] *new* export const a = 1 //// [/home/src/workspaces/project/tsconfig.json] *new* -{ "compilerOptions": { "strict": true, "noEmit": true } } +{ + "compilerOptions": { + "strict": true, + "noEmit": true + } +} ExitStatus:: 0 diff --git a/testdata/baselines/reference/tsc/commandLine/Parse--p-with-path-to-tsconfig-folder.js b/testdata/baselines/reference/tsc/commandLine/Parse--p-with-path-to-tsconfig-folder.js index 63f276759b..eaea15925c 100644 --- a/testdata/baselines/reference/tsc/commandLine/Parse--p-with-path-to-tsconfig-folder.js +++ b/testdata/baselines/reference/tsc/commandLine/Parse--p-with-path-to-tsconfig-folder.js @@ -5,7 +5,12 @@ Input::-p /home/src/workspaces/project //// [/home/src/workspaces/project/first.ts] *new* export const a = 1 //// [/home/src/workspaces/project/tsconfig.json] *new* -{ "compilerOptions": { "strict": true, "noEmit": true } } +{ + "compilerOptions": { + "strict": true, + "noEmit": true + } +} ExitStatus:: 0 diff --git a/testdata/baselines/reference/tsc/commandLine/Parse--p.js b/testdata/baselines/reference/tsc/commandLine/Parse--p.js index f2aedd5f8b..0088240bbb 100644 --- a/testdata/baselines/reference/tsc/commandLine/Parse--p.js +++ b/testdata/baselines/reference/tsc/commandLine/Parse--p.js @@ -5,7 +5,12 @@ Input::-p . //// [/home/src/workspaces/project/first.ts] *new* export const a = 1 //// [/home/src/workspaces/project/tsconfig.json] *new* -{ "compilerOptions": { "strict": true, "noEmit": true } } +{ + "compilerOptions": { + "strict": true, + "noEmit": true + } +} ExitStatus:: 0 diff --git a/testdata/baselines/reference/tsc/commandLine/Project-is-empty-string.js b/testdata/baselines/reference/tsc/commandLine/Project-is-empty-string.js index eb49f60d12..3be55865f2 100644 --- a/testdata/baselines/reference/tsc/commandLine/Project-is-empty-string.js +++ b/testdata/baselines/reference/tsc/commandLine/Project-is-empty-string.js @@ -5,7 +5,12 @@ Input:: //// [/home/src/workspaces/project/first.ts] *new* export const a = 1 //// [/home/src/workspaces/project/tsconfig.json] *new* -{ "compilerOptions": { "strict": true, "noEmit": true } } +{ + "compilerOptions": { + "strict": true, + "noEmit": true + } +} ExitStatus:: 0 diff --git a/testdata/baselines/reference/tsc/extends/configDir-template-showConfig.js b/testdata/baselines/reference/tsc/extends/configDir-template-showConfig.js index b503cb2514..0474bfe09e 100644 --- a/testdata/baselines/reference/tsc/extends/configDir-template-showConfig.js +++ b/testdata/baselines/reference/tsc/extends/configDir-template-showConfig.js @@ -4,57 +4,50 @@ useCaseSensitiveFileNames::true Input::--showConfig //// [/home/src/projects/configs/first/tsconfig.json] *new* { - "extends": "../second/tsconfig.json", - "include": ["${configDir}/src"], - "compilerOptions": { - "typeRoots": ["root1", "${configDir}/root2", "root3"], - "types": [], - }, + "extends": "../second/tsconfig.json", + "include": ["${configDir}/src"], + "compilerOptions": { + "typeRoots": ["root1", "${configDir}/root2", "root3"], + "types": [], + } } //// [/home/src/projects/configs/second/tsconfig.json] *new* { - "files": ["${configDir}/main.ts"], - "compilerOptions": { - "declarationDir": "${configDir}/decls", - "paths": { - "@myscope/*": ["${configDir}/types/*"], - "other/*": ["other/*"], - }, - "baseUrl": "${configDir}", - }, - "watchOptions": { - "excludeFiles": ["${configDir}/main.ts"], - }, + "files": ["${configDir}/main.ts"], + "compilerOptions": { + "declarationDir": "${configDir}/decls", + "paths": { + "@myscope/*": ["${configDir}/types/*"], + "other/*": ["other/*"], + }, + "baseUrl": "${configDir}", + }, + "watchOptions": { + "excludeFiles": ["${configDir}/main.ts"], + }, } //// [/home/src/projects/myproject/main.ts] *new* - - // some comment - export const y = 10; - import { x } from "@myscope/sometype"; - +// some comment +export const y = 10; +import { x } from "@myscope/sometype"; //// [/home/src/projects/myproject/root2/other/sometype2/index.d.ts] *new* - - export const k = 10; - +export const k = 10; //// [/home/src/projects/myproject/src/secondary.ts] *new* - - // some comment - export const z = 10; - import { k } from "other/sometype2"; - +// some comment +export const z = 10; +import { k } from "other/sometype2"; //// [/home/src/projects/myproject/tsconfig.json] *new* { - "extends": "../configs/first/tsconfig.json", - "compilerOptions": { - "declaration": true, - "outDir": "outDir", - "traceResolution": true, - }, + "extends": "../configs/first/tsconfig.json", + "compilerOptions": { + "declaration": true, + "outDir": "outDir", + "traceResolution": true, + }, } //// [/home/src/projects/myproject/types/sometype.ts] *new* - - export const x = 10; - +// some comment +export const x = 10; ExitStatus:: 0 diff --git a/testdata/baselines/reference/tsc/extends/configDir-template-with-commandline.js b/testdata/baselines/reference/tsc/extends/configDir-template-with-commandline.js index aabd3b9d6c..03a41f3ea2 100644 --- a/testdata/baselines/reference/tsc/extends/configDir-template-with-commandline.js +++ b/testdata/baselines/reference/tsc/extends/configDir-template-with-commandline.js @@ -4,57 +4,50 @@ useCaseSensitiveFileNames::true Input::--explainFiles --outDir ${configDir}/outDir //// [/home/src/projects/configs/first/tsconfig.json] *new* { - "extends": "../second/tsconfig.json", - "include": ["${configDir}/src"], - "compilerOptions": { - "typeRoots": ["root1", "${configDir}/root2", "root3"], - "types": [], - }, + "extends": "../second/tsconfig.json", + "include": ["${configDir}/src"], + "compilerOptions": { + "typeRoots": ["root1", "${configDir}/root2", "root3"], + "types": [], + } } //// [/home/src/projects/configs/second/tsconfig.json] *new* { - "files": ["${configDir}/main.ts"], - "compilerOptions": { - "declarationDir": "${configDir}/decls", - "paths": { - "@myscope/*": ["${configDir}/types/*"], - "other/*": ["other/*"], - }, - "baseUrl": "${configDir}", - }, - "watchOptions": { - "excludeFiles": ["${configDir}/main.ts"], - }, + "files": ["${configDir}/main.ts"], + "compilerOptions": { + "declarationDir": "${configDir}/decls", + "paths": { + "@myscope/*": ["${configDir}/types/*"], + "other/*": ["other/*"], + }, + "baseUrl": "${configDir}", + }, + "watchOptions": { + "excludeFiles": ["${configDir}/main.ts"], + }, } //// [/home/src/projects/myproject/main.ts] *new* - - // some comment - export const y = 10; - import { x } from "@myscope/sometype"; - +// some comment +export const y = 10; +import { x } from "@myscope/sometype"; //// [/home/src/projects/myproject/root2/other/sometype2/index.d.ts] *new* - - export const k = 10; - +export const k = 10; //// [/home/src/projects/myproject/src/secondary.ts] *new* - - // some comment - export const z = 10; - import { k } from "other/sometype2"; - +// some comment +export const z = 10; +import { k } from "other/sometype2"; //// [/home/src/projects/myproject/tsconfig.json] *new* { - "extends": "../configs/first/tsconfig.json", - "compilerOptions": { - "declaration": true, - "outDir": "outDir", - "traceResolution": true, - }, + "extends": "../configs/first/tsconfig.json", + "compilerOptions": { + "declaration": true, + "outDir": "outDir", + "traceResolution": true, + }, } //// [/home/src/projects/myproject/types/sometype.ts] *new* - - export const x = 10; - +// some comment +export const x = 10; ExitStatus:: 2 @@ -63,13 +56,13 @@ CompilerOptions::{ "explainFiles": true } Output:: -src/secondary.ts:4:20 - error TS2307: Cannot find module 'other/sometype2' or its corresponding type declarations. +src/secondary.ts:3:19 - error TS2307: Cannot find module 'other/sometype2' or its corresponding type declarations. -4 import { k } from "other/sometype2"; -   ~~~~~~~~~~~~~~~~~ +3 import { k } from "other/sometype2"; +   ~~~~~~~~~~~~~~~~~ -Found 1 error in src/secondary.ts:4 +Found 1 error in src/secondary.ts:3 //// [/home/src/projects/myproject/${configDir}/outDir/main.js] *new* "use strict"; @@ -89,6 +82,7 @@ exports.z = 10; "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.x = void 0; +// some comment exports.x = 10; //// [/home/src/projects/myproject/decls/main.d.ts] *new* @@ -100,6 +94,7 @@ export declare const y = 10; export declare const z = 10; //// [/home/src/projects/myproject/decls/types/sometype.d.ts] *new* +// some comment export declare const x = 10; //// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* diff --git a/testdata/baselines/reference/tsc/extends/configDir-template.js b/testdata/baselines/reference/tsc/extends/configDir-template.js index 006c9c61b2..23e6d2b1de 100644 --- a/testdata/baselines/reference/tsc/extends/configDir-template.js +++ b/testdata/baselines/reference/tsc/extends/configDir-template.js @@ -4,57 +4,50 @@ useCaseSensitiveFileNames::true Input::--explainFiles //// [/home/src/projects/configs/first/tsconfig.json] *new* { - "extends": "../second/tsconfig.json", - "include": ["${configDir}/src"], - "compilerOptions": { - "typeRoots": ["root1", "${configDir}/root2", "root3"], - "types": [], - }, + "extends": "../second/tsconfig.json", + "include": ["${configDir}/src"], + "compilerOptions": { + "typeRoots": ["root1", "${configDir}/root2", "root3"], + "types": [], + } } //// [/home/src/projects/configs/second/tsconfig.json] *new* { - "files": ["${configDir}/main.ts"], - "compilerOptions": { - "declarationDir": "${configDir}/decls", - "paths": { - "@myscope/*": ["${configDir}/types/*"], - "other/*": ["other/*"], - }, - "baseUrl": "${configDir}", - }, - "watchOptions": { - "excludeFiles": ["${configDir}/main.ts"], - }, + "files": ["${configDir}/main.ts"], + "compilerOptions": { + "declarationDir": "${configDir}/decls", + "paths": { + "@myscope/*": ["${configDir}/types/*"], + "other/*": ["other/*"], + }, + "baseUrl": "${configDir}", + }, + "watchOptions": { + "excludeFiles": ["${configDir}/main.ts"], + }, } //// [/home/src/projects/myproject/main.ts] *new* - - // some comment - export const y = 10; - import { x } from "@myscope/sometype"; - +// some comment +export const y = 10; +import { x } from "@myscope/sometype"; //// [/home/src/projects/myproject/root2/other/sometype2/index.d.ts] *new* - - export const k = 10; - +export const k = 10; //// [/home/src/projects/myproject/src/secondary.ts] *new* - - // some comment - export const z = 10; - import { k } from "other/sometype2"; - +// some comment +export const z = 10; +import { k } from "other/sometype2"; //// [/home/src/projects/myproject/tsconfig.json] *new* { - "extends": "../configs/first/tsconfig.json", - "compilerOptions": { - "declaration": true, - "outDir": "outDir", - "traceResolution": true, - }, + "extends": "../configs/first/tsconfig.json", + "compilerOptions": { + "declaration": true, + "outDir": "outDir", + "traceResolution": true, + }, } //// [/home/src/projects/myproject/types/sometype.ts] *new* - - export const x = 10; - +// some comment +export const x = 10; ExitStatus:: 2 @@ -62,13 +55,13 @@ CompilerOptions::{ "explainFiles": true } Output:: -src/secondary.ts:4:20 - error TS2307: Cannot find module 'other/sometype2' or its corresponding type declarations. +src/secondary.ts:3:19 - error TS2307: Cannot find module 'other/sometype2' or its corresponding type declarations. -4 import { k } from "other/sometype2"; -   ~~~~~~~~~~~~~~~~~ +3 import { k } from "other/sometype2"; +   ~~~~~~~~~~~~~~~~~ -Found 1 error in src/secondary.ts:4 +Found 1 error in src/secondary.ts:3 //// [/home/src/projects/myproject/decls/main.d.ts] *new* // some comment @@ -79,6 +72,7 @@ export declare const y = 10; export declare const z = 10; //// [/home/src/projects/myproject/decls/types/sometype.d.ts] *new* +// some comment export declare const x = 10; //// [/home/src/projects/myproject/outDir/main.js] *new* @@ -99,6 +93,7 @@ exports.z = 10; "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.x = void 0; +// some comment exports.x = 10; //// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* diff --git a/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js index 84c5b78abe..a6d62101a9 100644 --- a/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js +++ b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js @@ -25,26 +25,29 @@ interface Symbol { readonly [Symbol.toStringTag]: string; } declare const console: { log(msg: any): void; }; - type ReturnType any> = T extends (...args: any) => infer R ? R : any; - type InstanceType any> = T extends abstract new (...args: any) => infer R ? R : any; +type ReturnType any> = T extends (...args: any) => infer R ? R : any; +type InstanceType any> = T extends abstract new (...args: any) => infer R ? R : any; //// [/home/src/workspaces/project/MessageablePerson.ts] *new* - - const Messageable = () => { - return class MessageableClass { - public message = 'hello'; - } - }; - const wrapper = () => Messageable(); - type MessageablePerson = InstanceType>; - export default MessageablePerson; +const Messageable = () => { + return class MessageableClass { + public message = 'hello'; + } +}; +const wrapper = () => Messageable(); +type MessageablePerson = InstanceType>; +export default MessageablePerson; //// [/home/src/workspaces/project/main.ts] *new* - - import MessageablePerson from './MessageablePerson.js'; - function logMessage( person: MessageablePerson ) { - console.log( person.message ); - } +import MessageablePerson from './MessageablePerson.js'; +function logMessage( person: MessageablePerson ) { + console.log( person.message ); +} //// [/home/src/workspaces/project/tsconfig.json] *new* -{ "compilerOptions": { "module": "esnext", "declaration": true } } +{ + "compilerOptions": { + "module": "esnext", + "declaration": true + } +} ExitStatus:: 0 @@ -80,7 +83,7 @@ function logMessage(person) { export {}; //// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *new* -{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":[{"version":"575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a","signature":"6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe","impliedNodeFormat":1},{"version":"36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"declaration":true,"module":99},"referencedMap":[[3,1]]} +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":[{"version":"4454fdb8db546b8967485a3a7254c948e6876fb850a20e51972933eaf60b5b21","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3be6695caa91776ec738c01ffbc1250eb86f9bca0c22b02335b5e5c7c63bcbaa","signature":"6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe","impliedNodeFormat":1},{"version":"1fe1ef024191a0efa3b3b0ec73ee8e703a58d44f6d62caf49268591964dce1de","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"declaration":true,"module":99},"referencedMap":[[3,1]]} //// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", @@ -92,34 +95,34 @@ export {}; "fileInfos": [ { "fileName": "../../tslibs/TS/Lib/lib.d.ts", - "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", - "signature": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "version": "4454fdb8db546b8967485a3a7254c948e6876fb850a20e51972933eaf60b5b21", + "signature": "4454fdb8db546b8967485a3a7254c948e6876fb850a20e51972933eaf60b5b21", "affectsGlobalScope": true, "impliedNodeFormat": "CommonJS", "original": { - "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "version": "4454fdb8db546b8967485a3a7254c948e6876fb850a20e51972933eaf60b5b21", "affectsGlobalScope": true, "impliedNodeFormat": 1 } }, { "fileName": "./MessageablePerson.ts", - "version": "ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a", + "version": "3be6695caa91776ec738c01ffbc1250eb86f9bca0c22b02335b5e5c7c63bcbaa", "signature": "6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe", "impliedNodeFormat": "CommonJS", "original": { - "version": "ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a", + "version": "3be6695caa91776ec738c01ffbc1250eb86f9bca0c22b02335b5e5c7c63bcbaa", "signature": "6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe", "impliedNodeFormat": 1 } }, { "fileName": "./main.ts", - "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", + "version": "1fe1ef024191a0efa3b3b0ec73ee8e703a58d44f6d62caf49268591964dce1de", "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", "impliedNodeFormat": "CommonJS", "original": { - "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", + "version": "1fe1ef024191a0efa3b3b0ec73ee8e703a58d44f6d62caf49268591964dce1de", "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", "impliedNodeFormat": 1 } @@ -166,45 +169,44 @@ Signatures:: Edit:: modify public to protected //// [/home/src/workspaces/project/MessageablePerson.ts] *modified* - - const Messageable = () => { - return class MessageableClass { - protected message = 'hello'; - } - }; - const wrapper = () => Messageable(); - type MessageablePerson = InstanceType>; - export default MessageablePerson; +const Messageable = () => { + return class MessageableClass { + protected message = 'hello'; + } +}; +const wrapper = () => Messageable(); +type MessageablePerson = InstanceType>; +export default MessageablePerson; ExitStatus:: 2 Output:: -MessageablePerson.ts:7:31 - error TS4094: Property 'message' of exported anonymous class type may not be private or protected. +MessageablePerson.ts:6:7 - error TS4094: Property 'message' of exported anonymous class type may not be private or protected. -7 const wrapper = () => Messageable(); -   ~~~~~~~ +6 const wrapper = () => Messageable(); +   ~~~~~~~ - MessageablePerson.ts:7:31 - Add a type annotation to the variable wrapper. - 7 const wrapper = () => Messageable(); -    ~~~~~~~ + MessageablePerson.ts:6:7 - Add a type annotation to the variable wrapper. + 6 const wrapper = () => Messageable(); +    ~~~~~~~ -main.ts:4:49 - error TS2445: Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses. +main.ts:3:25 - error TS2445: Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses. -4 console.log( person.message ); -   ~~~~~~~ +3 console.log( person.message ); +   ~~~~~~~ Found 2 errors in 2 files. Errors Files - 1 MessageablePerson.ts:7 - 1 main.ts:4 + 1 MessageablePerson.ts:6 + 1 main.ts:3 //// [/home/src/workspaces/project/MessageablePerson.d.ts] *modified time* //// [/home/src/workspaces/project/MessageablePerson.js] *modified time* //// [/home/src/workspaces/project/main.d.ts] *modified time* //// [/home/src/workspaces/project/main.js] *modified time* //// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* -{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":[{"version":"575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ab8b2498ae671bdc5aefe51a9de13bf17d8e0438f2f573353d18e104344dd81f","signature":"0858d1a081aa47feef2a37c5648868c3ecc110cde2469aea716091b9869a58ed","impliedNodeFormat":1},{"version":"36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"declaration":true,"module":99},"referencedMap":[[3,1]],"semanticDiagnosticsPerFile":[[3,[{"pos":204,"end":211,"code":2445,"category":1,"message":"Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses."}]]],"emitDiagnosticsPerFile":[[2,[{"pos":261,"end":268,"code":4094,"category":1,"message":"Property 'message' of exported anonymous class type may not be private or protected.","relatedInformation":[{"pos":261,"end":268,"code":9027,"category":1,"message":"Add a type annotation to the variable wrapper."}]}]]]} +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":[{"version":"4454fdb8db546b8967485a3a7254c948e6876fb850a20e51972933eaf60b5b21","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"7605d26cb18fccfe18cf0d5b1771a538d665f6b2bb331c9617ebdf38d7c93b29","signature":"34f86a1082929a2d2c6b784bde116fadfb61a9ee55f5141d4906ef4ce16a89c9","impliedNodeFormat":1},{"version":"1fe1ef024191a0efa3b3b0ec73ee8e703a58d44f6d62caf49268591964dce1de","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"declaration":true,"module":99},"referencedMap":[[3,1]],"semanticDiagnosticsPerFile":[[3,[{"pos":131,"end":138,"code":2445,"category":1,"message":"Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses."}]]],"emitDiagnosticsPerFile":[[2,[{"pos":116,"end":123,"code":4094,"category":1,"message":"Property 'message' of exported anonymous class type may not be private or protected.","relatedInformation":[{"pos":116,"end":123,"code":9027,"category":1,"message":"Add a type annotation to the variable wrapper."}]}]]]} //// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* { "version": "FakeTSVersion", @@ -216,34 +218,34 @@ Errors Files "fileInfos": [ { "fileName": "../../tslibs/TS/Lib/lib.d.ts", - "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", - "signature": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "version": "4454fdb8db546b8967485a3a7254c948e6876fb850a20e51972933eaf60b5b21", + "signature": "4454fdb8db546b8967485a3a7254c948e6876fb850a20e51972933eaf60b5b21", "affectsGlobalScope": true, "impliedNodeFormat": "CommonJS", "original": { - "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "version": "4454fdb8db546b8967485a3a7254c948e6876fb850a20e51972933eaf60b5b21", "affectsGlobalScope": true, "impliedNodeFormat": 1 } }, { "fileName": "./MessageablePerson.ts", - "version": "ab8b2498ae671bdc5aefe51a9de13bf17d8e0438f2f573353d18e104344dd81f", - "signature": "0858d1a081aa47feef2a37c5648868c3ecc110cde2469aea716091b9869a58ed", + "version": "7605d26cb18fccfe18cf0d5b1771a538d665f6b2bb331c9617ebdf38d7c93b29", + "signature": "34f86a1082929a2d2c6b784bde116fadfb61a9ee55f5141d4906ef4ce16a89c9", "impliedNodeFormat": "CommonJS", "original": { - "version": "ab8b2498ae671bdc5aefe51a9de13bf17d8e0438f2f573353d18e104344dd81f", - "signature": "0858d1a081aa47feef2a37c5648868c3ecc110cde2469aea716091b9869a58ed", + "version": "7605d26cb18fccfe18cf0d5b1771a538d665f6b2bb331c9617ebdf38d7c93b29", + "signature": "34f86a1082929a2d2c6b784bde116fadfb61a9ee55f5141d4906ef4ce16a89c9", "impliedNodeFormat": 1 } }, { "fileName": "./main.ts", - "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", + "version": "1fe1ef024191a0efa3b3b0ec73ee8e703a58d44f6d62caf49268591964dce1de", "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", "impliedNodeFormat": "CommonJS", "original": { - "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", + "version": "1fe1ef024191a0efa3b3b0ec73ee8e703a58d44f6d62caf49268591964dce1de", "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", "impliedNodeFormat": 1 } @@ -268,8 +270,8 @@ Errors Files "./main.ts", [ { - "pos": 204, - "end": 211, + "pos": 131, + "end": 138, "code": 2445, "category": 1, "message": "Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses." @@ -282,15 +284,15 @@ Errors Files "./MessageablePerson.ts", [ { - "pos": 261, - "end": 268, + "pos": 116, + "end": 123, "code": 4094, "category": 1, "message": "Property 'message' of exported anonymous class type may not be private or protected.", "relatedInformation": [ { - "pos": 261, - "end": 268, + "pos": 116, + "end": 123, "code": 9027, "category": 1, "message": "Add a type annotation to the variable wrapper." @@ -317,26 +319,26 @@ Edit:: no change ExitStatus:: 1 Output:: -MessageablePerson.ts:7:31 - error TS4094: Property 'message' of exported anonymous class type may not be private or protected. +MessageablePerson.ts:6:7 - error TS4094: Property 'message' of exported anonymous class type may not be private or protected. -7 const wrapper = () => Messageable(); -   ~~~~~~~ +6 const wrapper = () => Messageable(); +   ~~~~~~~ - MessageablePerson.ts:7:31 - Add a type annotation to the variable wrapper. - 7 const wrapper = () => Messageable(); -    ~~~~~~~ + MessageablePerson.ts:6:7 - Add a type annotation to the variable wrapper. + 6 const wrapper = () => Messageable(); +    ~~~~~~~ -main.ts:4:49 - error TS2445: Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses. +main.ts:3:25 - error TS2445: Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses. -4 console.log( person.message ); -   ~~~~~~~ +3 console.log( person.message ); +   ~~~~~~~ Found 2 errors in 2 files. Errors Files - 1 MessageablePerson.ts:7 - 1 main.ts:4 + 1 MessageablePerson.ts:6 + 1 main.ts:3 //// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified time* //// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified time* @@ -349,15 +351,14 @@ Signatures:: Edit:: modify protected to public //// [/home/src/workspaces/project/MessageablePerson.ts] *modified* - - const Messageable = () => { - return class MessageableClass { - public message = 'hello'; - } - }; - const wrapper = () => Messageable(); - type MessageablePerson = InstanceType>; - export default MessageablePerson; +const Messageable = () => { + return class MessageableClass { + public message = 'hello'; + } +}; +const wrapper = () => Messageable(); +type MessageablePerson = InstanceType>; +export default MessageablePerson; ExitStatus:: 0 Output:: @@ -366,7 +367,7 @@ Output:: //// [/home/src/workspaces/project/main.d.ts] *modified time* //// [/home/src/workspaces/project/main.js] *modified time* //// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* -{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":[{"version":"575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a","signature":"6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe","impliedNodeFormat":1},{"version":"36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"declaration":true,"module":99},"referencedMap":[[3,1]]} +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":[{"version":"4454fdb8db546b8967485a3a7254c948e6876fb850a20e51972933eaf60b5b21","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3be6695caa91776ec738c01ffbc1250eb86f9bca0c22b02335b5e5c7c63bcbaa","signature":"6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe","impliedNodeFormat":1},{"version":"1fe1ef024191a0efa3b3b0ec73ee8e703a58d44f6d62caf49268591964dce1de","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"declaration":true,"module":99},"referencedMap":[[3,1]]} //// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* { "version": "FakeTSVersion", @@ -378,34 +379,34 @@ Output:: "fileInfos": [ { "fileName": "../../tslibs/TS/Lib/lib.d.ts", - "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", - "signature": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "version": "4454fdb8db546b8967485a3a7254c948e6876fb850a20e51972933eaf60b5b21", + "signature": "4454fdb8db546b8967485a3a7254c948e6876fb850a20e51972933eaf60b5b21", "affectsGlobalScope": true, "impliedNodeFormat": "CommonJS", "original": { - "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "version": "4454fdb8db546b8967485a3a7254c948e6876fb850a20e51972933eaf60b5b21", "affectsGlobalScope": true, "impliedNodeFormat": 1 } }, { "fileName": "./MessageablePerson.ts", - "version": "ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a", + "version": "3be6695caa91776ec738c01ffbc1250eb86f9bca0c22b02335b5e5c7c63bcbaa", "signature": "6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe", "impliedNodeFormat": "CommonJS", "original": { - "version": "ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a", + "version": "3be6695caa91776ec738c01ffbc1250eb86f9bca0c22b02335b5e5c7c63bcbaa", "signature": "6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe", "impliedNodeFormat": 1 } }, { "fileName": "./main.ts", - "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", + "version": "1fe1ef024191a0efa3b3b0ec73ee8e703a58d44f6d62caf49268591964dce1de", "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", "impliedNodeFormat": "CommonJS", "original": { - "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", + "version": "1fe1ef024191a0efa3b3b0ec73ee8e703a58d44f6d62caf49268591964dce1de", "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", "impliedNodeFormat": 1 } diff --git a/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js index e8f9a01aaa..037ef10f65 100644 --- a/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js +++ b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js @@ -25,26 +25,28 @@ interface Symbol { readonly [Symbol.toStringTag]: string; } declare const console: { log(msg: any): void; }; - type ReturnType any> = T extends (...args: any) => infer R ? R : any; - type InstanceType any> = T extends abstract new (...args: any) => infer R ? R : any; +type ReturnType any> = T extends (...args: any) => infer R ? R : any; +type InstanceType any> = T extends abstract new (...args: any) => infer R ? R : any; //// [/home/src/workspaces/project/MessageablePerson.ts] *new* - - const Messageable = () => { - return class MessageableClass { - public message = 'hello'; - } - }; - const wrapper = () => Messageable(); - type MessageablePerson = InstanceType>; - export default MessageablePerson; +const Messageable = () => { + return class MessageableClass { + public message = 'hello'; + } +}; +const wrapper = () => Messageable(); +type MessageablePerson = InstanceType>; +export default MessageablePerson; //// [/home/src/workspaces/project/main.ts] *new* - - import MessageablePerson from './MessageablePerson.js'; - function logMessage( person: MessageablePerson ) { - console.log( person.message ); - } +import MessageablePerson from './MessageablePerson.js'; +function logMessage( person: MessageablePerson ) { + console.log( person.message ); +} //// [/home/src/workspaces/project/tsconfig.json] *new* -{ "compilerOptions": { "module": "esnext" } } +{ + "compilerOptions": { + "module": "esnext" + } +} ExitStatus:: 0 @@ -68,7 +70,7 @@ function logMessage(person) { export {}; //// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *new* -{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":[{"version":"575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2","affectsGlobalScope":true,"impliedNodeFormat":1},"ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a","36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c"],"fileIdsList":[[2]],"options":{"module":99},"referencedMap":[[3,1]]} +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":[{"version":"4454fdb8db546b8967485a3a7254c948e6876fb850a20e51972933eaf60b5b21","affectsGlobalScope":true,"impliedNodeFormat":1},"3be6695caa91776ec738c01ffbc1250eb86f9bca0c22b02335b5e5c7c63bcbaa","1fe1ef024191a0efa3b3b0ec73ee8e703a58d44f6d62caf49268591964dce1de"],"fileIdsList":[[2]],"options":{"module":99},"referencedMap":[[3,1]]} //// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", @@ -80,26 +82,26 @@ export {}; "fileInfos": [ { "fileName": "../../tslibs/TS/Lib/lib.d.ts", - "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", - "signature": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "version": "4454fdb8db546b8967485a3a7254c948e6876fb850a20e51972933eaf60b5b21", + "signature": "4454fdb8db546b8967485a3a7254c948e6876fb850a20e51972933eaf60b5b21", "affectsGlobalScope": true, "impliedNodeFormat": "CommonJS", "original": { - "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "version": "4454fdb8db546b8967485a3a7254c948e6876fb850a20e51972933eaf60b5b21", "affectsGlobalScope": true, "impliedNodeFormat": 1 } }, { "fileName": "./MessageablePerson.ts", - "version": "ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a", - "signature": "ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a", + "version": "3be6695caa91776ec738c01ffbc1250eb86f9bca0c22b02335b5e5c7c63bcbaa", + "signature": "3be6695caa91776ec738c01ffbc1250eb86f9bca0c22b02335b5e5c7c63bcbaa", "impliedNodeFormat": "CommonJS" }, { "fileName": "./main.ts", - "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", - "signature": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", + "version": "1fe1ef024191a0efa3b3b0ec73ee8e703a58d44f6d62caf49268591964dce1de", + "signature": "1fe1ef024191a0efa3b3b0ec73ee8e703a58d44f6d62caf49268591964dce1de", "impliedNodeFormat": "CommonJS" } ], @@ -141,30 +143,29 @@ Signatures:: Edit:: modify public to protected //// [/home/src/workspaces/project/MessageablePerson.ts] *modified* - - const Messageable = () => { - return class MessageableClass { - protected message = 'hello'; - } - }; - const wrapper = () => Messageable(); - type MessageablePerson = InstanceType>; - export default MessageablePerson; +const Messageable = () => { + return class MessageableClass { + protected message = 'hello'; + } +}; +const wrapper = () => Messageable(); +type MessageablePerson = InstanceType>; +export default MessageablePerson; ExitStatus:: 2 Output:: -main.ts:4:49 - error TS2445: Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses. +main.ts:3:25 - error TS2445: Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses. -4 console.log( person.message ); -   ~~~~~~~ +3 console.log( person.message ); +   ~~~~~~~ -Found 1 error in main.ts:4 +Found 1 error in main.ts:3 //// [/home/src/workspaces/project/MessageablePerson.js] *modified time* //// [/home/src/workspaces/project/main.js] *modified time* //// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* -{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":[{"version":"575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ab8b2498ae671bdc5aefe51a9de13bf17d8e0438f2f573353d18e104344dd81f","signature":"0858d1a081aa47feef2a37c5648868c3ecc110cde2469aea716091b9869a58ed","impliedNodeFormat":1},{"version":"36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"module":99},"referencedMap":[[3,1]],"semanticDiagnosticsPerFile":[[3,[{"pos":204,"end":211,"code":2445,"category":1,"message":"Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses."}]]]} +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":[{"version":"4454fdb8db546b8967485a3a7254c948e6876fb850a20e51972933eaf60b5b21","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"7605d26cb18fccfe18cf0d5b1771a538d665f6b2bb331c9617ebdf38d7c93b29","signature":"34f86a1082929a2d2c6b784bde116fadfb61a9ee55f5141d4906ef4ce16a89c9","impliedNodeFormat":1},{"version":"1fe1ef024191a0efa3b3b0ec73ee8e703a58d44f6d62caf49268591964dce1de","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"module":99},"referencedMap":[[3,1]],"semanticDiagnosticsPerFile":[[3,[{"pos":131,"end":138,"code":2445,"category":1,"message":"Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses."}]]]} //// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* { "version": "FakeTSVersion", @@ -176,34 +177,34 @@ Found 1 error in main.ts:4 "fileInfos": [ { "fileName": "../../tslibs/TS/Lib/lib.d.ts", - "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", - "signature": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "version": "4454fdb8db546b8967485a3a7254c948e6876fb850a20e51972933eaf60b5b21", + "signature": "4454fdb8db546b8967485a3a7254c948e6876fb850a20e51972933eaf60b5b21", "affectsGlobalScope": true, "impliedNodeFormat": "CommonJS", "original": { - "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "version": "4454fdb8db546b8967485a3a7254c948e6876fb850a20e51972933eaf60b5b21", "affectsGlobalScope": true, "impliedNodeFormat": 1 } }, { "fileName": "./MessageablePerson.ts", - "version": "ab8b2498ae671bdc5aefe51a9de13bf17d8e0438f2f573353d18e104344dd81f", - "signature": "0858d1a081aa47feef2a37c5648868c3ecc110cde2469aea716091b9869a58ed", + "version": "7605d26cb18fccfe18cf0d5b1771a538d665f6b2bb331c9617ebdf38d7c93b29", + "signature": "34f86a1082929a2d2c6b784bde116fadfb61a9ee55f5141d4906ef4ce16a89c9", "impliedNodeFormat": "CommonJS", "original": { - "version": "ab8b2498ae671bdc5aefe51a9de13bf17d8e0438f2f573353d18e104344dd81f", - "signature": "0858d1a081aa47feef2a37c5648868c3ecc110cde2469aea716091b9869a58ed", + "version": "7605d26cb18fccfe18cf0d5b1771a538d665f6b2bb331c9617ebdf38d7c93b29", + "signature": "34f86a1082929a2d2c6b784bde116fadfb61a9ee55f5141d4906ef4ce16a89c9", "impliedNodeFormat": 1 } }, { "fileName": "./main.ts", - "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", + "version": "1fe1ef024191a0efa3b3b0ec73ee8e703a58d44f6d62caf49268591964dce1de", "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", "impliedNodeFormat": "CommonJS", "original": { - "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", + "version": "1fe1ef024191a0efa3b3b0ec73ee8e703a58d44f6d62caf49268591964dce1de", "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", "impliedNodeFormat": 1 } @@ -227,8 +228,8 @@ Found 1 error in main.ts:4 "./main.ts", [ { - "pos": 204, - "end": 211, + "pos": 131, + "end": 138, "code": 2445, "category": 1, "message": "Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses." @@ -253,13 +254,13 @@ Edit:: no change ExitStatus:: 2 Output:: -main.ts:4:49 - error TS2445: Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses. +main.ts:3:25 - error TS2445: Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses. -4 console.log( person.message ); -   ~~~~~~~ +3 console.log( person.message ); +   ~~~~~~~ -Found 1 error in main.ts:4 +Found 1 error in main.ts:3 @@ -270,22 +271,21 @@ Signatures:: Edit:: modify protected to public //// [/home/src/workspaces/project/MessageablePerson.ts] *modified* - - const Messageable = () => { - return class MessageableClass { - public message = 'hello'; - } - }; - const wrapper = () => Messageable(); - type MessageablePerson = InstanceType>; - export default MessageablePerson; +const Messageable = () => { + return class MessageableClass { + public message = 'hello'; + } +}; +const wrapper = () => Messageable(); +type MessageablePerson = InstanceType>; +export default MessageablePerson; ExitStatus:: 0 Output:: //// [/home/src/workspaces/project/MessageablePerson.js] *modified time* //// [/home/src/workspaces/project/main.js] *modified time* //// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* -{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":[{"version":"575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a","signature":"6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe","impliedNodeFormat":1},{"version":"36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"module":99},"referencedMap":[[3,1]]} +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./MessageablePerson.ts","./main.ts"],"fileInfos":[{"version":"4454fdb8db546b8967485a3a7254c948e6876fb850a20e51972933eaf60b5b21","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3be6695caa91776ec738c01ffbc1250eb86f9bca0c22b02335b5e5c7c63bcbaa","signature":"6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe","impliedNodeFormat":1},{"version":"1fe1ef024191a0efa3b3b0ec73ee8e703a58d44f6d62caf49268591964dce1de","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[2]],"options":{"module":99},"referencedMap":[[3,1]]} //// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* { "version": "FakeTSVersion", @@ -297,34 +297,34 @@ Output:: "fileInfos": [ { "fileName": "../../tslibs/TS/Lib/lib.d.ts", - "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", - "signature": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "version": "4454fdb8db546b8967485a3a7254c948e6876fb850a20e51972933eaf60b5b21", + "signature": "4454fdb8db546b8967485a3a7254c948e6876fb850a20e51972933eaf60b5b21", "affectsGlobalScope": true, "impliedNodeFormat": "CommonJS", "original": { - "version": "575a4e15624573144926595079b1ec30f9c7853bab32f43c0b7db2acfdf038e2", + "version": "4454fdb8db546b8967485a3a7254c948e6876fb850a20e51972933eaf60b5b21", "affectsGlobalScope": true, "impliedNodeFormat": 1 } }, { "fileName": "./MessageablePerson.ts", - "version": "ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a", + "version": "3be6695caa91776ec738c01ffbc1250eb86f9bca0c22b02335b5e5c7c63bcbaa", "signature": "6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe", "impliedNodeFormat": "CommonJS", "original": { - "version": "ff666de4fdc53b5500de60a9b8c073c9327a9e9326417ef4861b8d2473c7457a", + "version": "3be6695caa91776ec738c01ffbc1250eb86f9bca0c22b02335b5e5c7c63bcbaa", "signature": "6ec1f7bdc192ba06258caff3fa202fd577f8f354d676f548500eeb232155cbbe", "impliedNodeFormat": 1 } }, { "fileName": "./main.ts", - "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", + "version": "1fe1ef024191a0efa3b3b0ec73ee8e703a58d44f6d62caf49268591964dce1de", "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", "impliedNodeFormat": "CommonJS", "original": { - "version": "36f0b00de3c707929bf1919e32e5b6053c8730bb00aa779bcdd1925414d68b8c", + "version": "1fe1ef024191a0efa3b3b0ec73ee8e703a58d44f6d62caf49268591964dce1de", "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", "impliedNodeFormat": 1 } diff --git a/testdata/baselines/reference/tsc/incremental/change-to-type-that-gets-used-as-global-through-export-in-another-file-through-indirect-import.js b/testdata/baselines/reference/tsc/incremental/change-to-type-that-gets-used-as-global-through-export-in-another-file-through-indirect-import.js new file mode 100644 index 0000000000..6dc702dbbe --- /dev/null +++ b/testdata/baselines/reference/tsc/incremental/change-to-type-that-gets-used-as-global-through-export-in-another-file-through-indirect-import.js @@ -0,0 +1,296 @@ + +currentDirectory::/home/src/workspaces/project +useCaseSensitiveFileNames::true +Input:: +//// [/home/src/workspaces/project/class1.ts] *new* +const a: MagicNumber = 1; +console.log(a); +//// [/home/src/workspaces/project/constants.ts] *new* +export default 1; +//// [/home/src/workspaces/project/reexport.ts] *new* +export { default as ConstantNumber } from "./constants" +//// [/home/src/workspaces/project/tsconfig.json] *new* +{ + "compilerOptions": { + "composite": true + } +} +//// [/home/src/workspaces/project/types.d.ts] *new* +type MagicNumber = typeof import('./reexport').ConstantNumber + +ExitStatus:: 0 + +CompilerOptions::{} +Output:: +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; +//// [/home/src/workspaces/project/class1.d.ts] *new* +declare const a = 1; + +//// [/home/src/workspaces/project/class1.js] *new* +const a = 1; +console.log(a); + +//// [/home/src/workspaces/project/constants.d.ts] *new* +declare const _default: number; +export default _default; + +//// [/home/src/workspaces/project/constants.js] *new* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = 1; + +//// [/home/src/workspaces/project/reexport.d.ts] *new* +export { default as ConstantNumber } from "./constants"; + +//// [/home/src/workspaces/project/reexport.js] *new* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ConstantNumber = void 0; +const constants_1 = require("./constants"); +Object.defineProperty(exports, "ConstantNumber", { enumerable: true, get: function () { return constants_1.default; } }); + +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *new* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./class1.ts","./constants.ts","./reexport.ts","./types.d.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"e23285158ce57995e96701e24b3979513455090a1acd8091dfcc03759c20f3a7","signature":"48becb2a5e6a58c58a56481b0edb338fd157be16188619433b47b766a8a71b60","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"56332e0a55734bc2b73df56a2df8635ed5c5b24b6d7a456b41de7cab9a2f3814","signature":"36b18171f705a4860606c23c78134f2e86f6e695d994dc8c849df608075d2e5a","impliedNodeFormat":1},{"version":"d358f9090c6427d5f6dd68671cba18871b08d2fcb193da8e979e324d68000cb3","signature":"84ff27208288e3f7379462f8745935fe8205e24ac2e2ef7c9ddef2dc2fbfeb39","impliedNodeFormat":1},{"version":"4364705e72bd2d53c70faabaa6d59be927f81efc6cb62cdfb1b7b18c72ec95f2","affectsGlobalScope":true,"impliedNodeFormat":1}],"fileIdsList":[[3],[4]],"options":{"composite":true},"referencedMap":[[4,1],[5,2]],"latestChangedDtsFile":"./reexport.d.ts"} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *new* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./class1.ts", + "./constants.ts", + "./reexport.ts", + "./types.d.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./class1.ts", + "version": "e23285158ce57995e96701e24b3979513455090a1acd8091dfcc03759c20f3a7", + "signature": "48becb2a5e6a58c58a56481b0edb338fd157be16188619433b47b766a8a71b60", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "e23285158ce57995e96701e24b3979513455090a1acd8091dfcc03759c20f3a7", + "signature": "48becb2a5e6a58c58a56481b0edb338fd157be16188619433b47b766a8a71b60", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./constants.ts", + "version": "56332e0a55734bc2b73df56a2df8635ed5c5b24b6d7a456b41de7cab9a2f3814", + "signature": "36b18171f705a4860606c23c78134f2e86f6e695d994dc8c849df608075d2e5a", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "56332e0a55734bc2b73df56a2df8635ed5c5b24b6d7a456b41de7cab9a2f3814", + "signature": "36b18171f705a4860606c23c78134f2e86f6e695d994dc8c849df608075d2e5a", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./reexport.ts", + "version": "d358f9090c6427d5f6dd68671cba18871b08d2fcb193da8e979e324d68000cb3", + "signature": "84ff27208288e3f7379462f8745935fe8205e24ac2e2ef7c9ddef2dc2fbfeb39", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "d358f9090c6427d5f6dd68671cba18871b08d2fcb193da8e979e324d68000cb3", + "signature": "84ff27208288e3f7379462f8745935fe8205e24ac2e2ef7c9ddef2dc2fbfeb39", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./types.d.ts", + "version": "4364705e72bd2d53c70faabaa6d59be927f81efc6cb62cdfb1b7b18c72ec95f2", + "signature": "4364705e72bd2d53c70faabaa6d59be927f81efc6cb62cdfb1b7b18c72ec95f2", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "4364705e72bd2d53c70faabaa6d59be927f81efc6cb62cdfb1b7b18c72ec95f2", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./constants.ts" + ], + [ + "./reexport.ts" + ] + ], + "options": { + "composite": true + }, + "referencedMap": { + "./reexport.ts": [ + "./constants.ts" + ], + "./types.d.ts": [ + "./reexport.ts" + ] + }, + "latestChangedDtsFile": "./reexport.d.ts", + "size": 1092 +} + + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/class1.ts +*refresh* /home/src/workspaces/project/constants.ts +*refresh* /home/src/workspaces/project/reexport.ts +*refresh* /home/src/workspaces/project/types.d.ts + +Signatures:: +(stored at emit) /home/src/workspaces/project/class1.ts +(stored at emit) /home/src/workspaces/project/constants.ts +(stored at emit) /home/src/workspaces/project/reexport.ts + + +Edit:: Modify imports used in global file +//// [/home/src/workspaces/project/constants.ts] *modified* +export default 2; + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/constants.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = 2; + +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./class1.ts","./constants.ts","./reexport.ts","./types.d.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"e23285158ce57995e96701e24b3979513455090a1acd8091dfcc03759c20f3a7","signature":"48becb2a5e6a58c58a56481b0edb338fd157be16188619433b47b766a8a71b60","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a903ba200e1d43efd9a49f4a8f57c622efb2ca72b9a00222dacd16d6ba6f3ba0","signature":"36b18171f705a4860606c23c78134f2e86f6e695d994dc8c849df608075d2e5a","impliedNodeFormat":1},{"version":"d358f9090c6427d5f6dd68671cba18871b08d2fcb193da8e979e324d68000cb3","signature":"84ff27208288e3f7379462f8745935fe8205e24ac2e2ef7c9ddef2dc2fbfeb39","impliedNodeFormat":1},{"version":"4364705e72bd2d53c70faabaa6d59be927f81efc6cb62cdfb1b7b18c72ec95f2","affectsGlobalScope":true,"impliedNodeFormat":1}],"fileIdsList":[[3],[4]],"options":{"composite":true},"referencedMap":[[4,1],[5,2]],"latestChangedDtsFile":"./reexport.d.ts"} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./class1.ts", + "./constants.ts", + "./reexport.ts", + "./types.d.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./class1.ts", + "version": "e23285158ce57995e96701e24b3979513455090a1acd8091dfcc03759c20f3a7", + "signature": "48becb2a5e6a58c58a56481b0edb338fd157be16188619433b47b766a8a71b60", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "e23285158ce57995e96701e24b3979513455090a1acd8091dfcc03759c20f3a7", + "signature": "48becb2a5e6a58c58a56481b0edb338fd157be16188619433b47b766a8a71b60", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./constants.ts", + "version": "a903ba200e1d43efd9a49f4a8f57c622efb2ca72b9a00222dacd16d6ba6f3ba0", + "signature": "36b18171f705a4860606c23c78134f2e86f6e695d994dc8c849df608075d2e5a", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "a903ba200e1d43efd9a49f4a8f57c622efb2ca72b9a00222dacd16d6ba6f3ba0", + "signature": "36b18171f705a4860606c23c78134f2e86f6e695d994dc8c849df608075d2e5a", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./reexport.ts", + "version": "d358f9090c6427d5f6dd68671cba18871b08d2fcb193da8e979e324d68000cb3", + "signature": "84ff27208288e3f7379462f8745935fe8205e24ac2e2ef7c9ddef2dc2fbfeb39", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "d358f9090c6427d5f6dd68671cba18871b08d2fcb193da8e979e324d68000cb3", + "signature": "84ff27208288e3f7379462f8745935fe8205e24ac2e2ef7c9ddef2dc2fbfeb39", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./types.d.ts", + "version": "4364705e72bd2d53c70faabaa6d59be927f81efc6cb62cdfb1b7b18c72ec95f2", + "signature": "4364705e72bd2d53c70faabaa6d59be927f81efc6cb62cdfb1b7b18c72ec95f2", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "4364705e72bd2d53c70faabaa6d59be927f81efc6cb62cdfb1b7b18c72ec95f2", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./constants.ts" + ], + [ + "./reexport.ts" + ] + ], + "options": { + "composite": true + }, + "referencedMap": { + "./reexport.ts": [ + "./constants.ts" + ], + "./types.d.ts": [ + "./reexport.ts" + ] + }, + "latestChangedDtsFile": "./reexport.d.ts", + "size": 1092 +} + + +SemanticDiagnostics:: +*refresh* /home/src/workspaces/project/constants.ts + +Signatures:: +(computed .d.ts) /home/src/workspaces/project/constants.ts diff --git a/testdata/baselines/reference/tsc/incremental/change-to-type-that-gets-used-as-global-through-export-in-another-file.js b/testdata/baselines/reference/tsc/incremental/change-to-type-that-gets-used-as-global-through-export-in-another-file.js new file mode 100644 index 0000000000..cb5a0c2474 --- /dev/null +++ b/testdata/baselines/reference/tsc/incremental/change-to-type-that-gets-used-as-global-through-export-in-another-file.js @@ -0,0 +1,246 @@ + +currentDirectory::/home/src/workspaces/project +useCaseSensitiveFileNames::true +Input:: +//// [/home/src/workspaces/project/class1.ts] *new* +const a: MagicNumber = 1; +console.log(a); +//// [/home/src/workspaces/project/constants.ts] *new* +export default 1; +//// [/home/src/workspaces/project/tsconfig.json] *new* +{ + "compilerOptions": { + "composite": true + } +} +//// [/home/src/workspaces/project/types.d.ts] *new* +type MagicNumber = typeof import('./constants').default + +ExitStatus:: 0 + +CompilerOptions::{} +Output:: +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; +//// [/home/src/workspaces/project/class1.d.ts] *new* +declare const a = 1; + +//// [/home/src/workspaces/project/class1.js] *new* +const a = 1; +console.log(a); + +//// [/home/src/workspaces/project/constants.d.ts] *new* +declare const _default: number; +export default _default; + +//// [/home/src/workspaces/project/constants.js] *new* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = 1; + +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *new* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./class1.ts","./constants.ts","./types.d.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"e23285158ce57995e96701e24b3979513455090a1acd8091dfcc03759c20f3a7","signature":"48becb2a5e6a58c58a56481b0edb338fd157be16188619433b47b766a8a71b60","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"56332e0a55734bc2b73df56a2df8635ed5c5b24b6d7a456b41de7cab9a2f3814","signature":"36b18171f705a4860606c23c78134f2e86f6e695d994dc8c849df608075d2e5a","impliedNodeFormat":1},{"version":"7446c53e84d9f941bf984ee4e804958d5e85677eb176c7bb33301814c98fba28","affectsGlobalScope":true,"impliedNodeFormat":1}],"fileIdsList":[[3]],"options":{"composite":true},"referencedMap":[[4,1]],"latestChangedDtsFile":"./constants.d.ts"} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *new* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./class1.ts", + "./constants.ts", + "./types.d.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./class1.ts", + "version": "e23285158ce57995e96701e24b3979513455090a1acd8091dfcc03759c20f3a7", + "signature": "48becb2a5e6a58c58a56481b0edb338fd157be16188619433b47b766a8a71b60", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "e23285158ce57995e96701e24b3979513455090a1acd8091dfcc03759c20f3a7", + "signature": "48becb2a5e6a58c58a56481b0edb338fd157be16188619433b47b766a8a71b60", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./constants.ts", + "version": "56332e0a55734bc2b73df56a2df8635ed5c5b24b6d7a456b41de7cab9a2f3814", + "signature": "36b18171f705a4860606c23c78134f2e86f6e695d994dc8c849df608075d2e5a", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "56332e0a55734bc2b73df56a2df8635ed5c5b24b6d7a456b41de7cab9a2f3814", + "signature": "36b18171f705a4860606c23c78134f2e86f6e695d994dc8c849df608075d2e5a", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./types.d.ts", + "version": "7446c53e84d9f941bf984ee4e804958d5e85677eb176c7bb33301814c98fba28", + "signature": "7446c53e84d9f941bf984ee4e804958d5e85677eb176c7bb33301814c98fba28", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7446c53e84d9f941bf984ee4e804958d5e85677eb176c7bb33301814c98fba28", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./constants.ts" + ] + ], + "options": { + "composite": true + }, + "referencedMap": { + "./types.d.ts": [ + "./constants.ts" + ] + }, + "latestChangedDtsFile": "./constants.d.ts", + "size": 887 +} + + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/class1.ts +*refresh* /home/src/workspaces/project/constants.ts +*refresh* /home/src/workspaces/project/types.d.ts + +Signatures:: +(stored at emit) /home/src/workspaces/project/class1.ts +(stored at emit) /home/src/workspaces/project/constants.ts + + +Edit:: Modify imports used in global file +//// [/home/src/workspaces/project/constants.ts] *modified* +export default 2; + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/constants.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = 2; + +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./class1.ts","./constants.ts","./types.d.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"e23285158ce57995e96701e24b3979513455090a1acd8091dfcc03759c20f3a7","signature":"48becb2a5e6a58c58a56481b0edb338fd157be16188619433b47b766a8a71b60","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a903ba200e1d43efd9a49f4a8f57c622efb2ca72b9a00222dacd16d6ba6f3ba0","signature":"36b18171f705a4860606c23c78134f2e86f6e695d994dc8c849df608075d2e5a","impliedNodeFormat":1},{"version":"7446c53e84d9f941bf984ee4e804958d5e85677eb176c7bb33301814c98fba28","affectsGlobalScope":true,"impliedNodeFormat":1}],"fileIdsList":[[3]],"options":{"composite":true},"referencedMap":[[4,1]],"latestChangedDtsFile":"./constants.d.ts"} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./class1.ts", + "./constants.ts", + "./types.d.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./class1.ts", + "version": "e23285158ce57995e96701e24b3979513455090a1acd8091dfcc03759c20f3a7", + "signature": "48becb2a5e6a58c58a56481b0edb338fd157be16188619433b47b766a8a71b60", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "e23285158ce57995e96701e24b3979513455090a1acd8091dfcc03759c20f3a7", + "signature": "48becb2a5e6a58c58a56481b0edb338fd157be16188619433b47b766a8a71b60", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./constants.ts", + "version": "a903ba200e1d43efd9a49f4a8f57c622efb2ca72b9a00222dacd16d6ba6f3ba0", + "signature": "36b18171f705a4860606c23c78134f2e86f6e695d994dc8c849df608075d2e5a", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "a903ba200e1d43efd9a49f4a8f57c622efb2ca72b9a00222dacd16d6ba6f3ba0", + "signature": "36b18171f705a4860606c23c78134f2e86f6e695d994dc8c849df608075d2e5a", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./types.d.ts", + "version": "7446c53e84d9f941bf984ee4e804958d5e85677eb176c7bb33301814c98fba28", + "signature": "7446c53e84d9f941bf984ee4e804958d5e85677eb176c7bb33301814c98fba28", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7446c53e84d9f941bf984ee4e804958d5e85677eb176c7bb33301814c98fba28", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./constants.ts" + ] + ], + "options": { + "composite": true + }, + "referencedMap": { + "./types.d.ts": [ + "./constants.ts" + ] + }, + "latestChangedDtsFile": "./constants.d.ts", + "size": 887 +} + + +SemanticDiagnostics:: +*refresh* /home/src/workspaces/project/constants.ts + +Signatures:: +(computed .d.ts) /home/src/workspaces/project/constants.ts diff --git a/testdata/baselines/reference/tsc/incremental/const-enums-aliased-in-different-file.js b/testdata/baselines/reference/tsc/incremental/const-enums-aliased-in-different-file.js new file mode 100644 index 0000000000..3cb3922fc6 --- /dev/null +++ b/testdata/baselines/reference/tsc/incremental/const-enums-aliased-in-different-file.js @@ -0,0 +1,559 @@ + +currentDirectory::/home/src/workspaces/project +useCaseSensitiveFileNames::true +Input::-i a.ts --tsbuildinfofile a.tsbuildinfo +//// [/home/src/workspaces/project/a.ts] *new* +import {A} from "./c" +let a = A.ONE +//// [/home/src/workspaces/project/b.d.ts] *new* +export { AWorker as A } from "./worker"; +//// [/home/src/workspaces/project/c.ts] *new* +import {A} from "./b" +let b = A.ONE +export {A} +//// [/home/src/workspaces/project/worker.d.ts] *new* +export const enum AWorker { + ONE = 1 +} + +ExitStatus:: 0 + +CompilerOptions::{ + "incremental": true, + "tsBuildInfoFile": "/home/src/workspaces/project/a.tsbuildinfo" +} +Output:: +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; +//// [/home/src/workspaces/project/a.js] *new* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +let a = c_1.A.ONE; + +//// [/home/src/workspaces/project/a.tsbuildinfo] *new* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./worker.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},"6bbf56b58e48a1823a06aa76603127859d31869809dab154ab8c5903d6465602","d1cae7e0884009696a49cf892aeb5da4fc8bc6050db4bce9ee30b657ccba9636","f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a","f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09"],"fileIdsList":[[4],[2],[3]],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"referencedMap":[[5,1],[3,2],[4,3]]} +//// [/home/src/workspaces/project/a.tsbuildinfo.readable.baseline.txt] *new* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./worker.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./worker.d.ts", + "version": "6bbf56b58e48a1823a06aa76603127859d31869809dab154ab8c5903d6465602", + "signature": "6bbf56b58e48a1823a06aa76603127859d31869809dab154ab8c5903d6465602", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./b.d.ts", + "version": "d1cae7e0884009696a49cf892aeb5da4fc8bc6050db4bce9ee30b657ccba9636", + "signature": "d1cae7e0884009696a49cf892aeb5da4fc8bc6050db4bce9ee30b657ccba9636", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./c.ts", + "version": "f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a", + "signature": "f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./a.ts", + "version": "f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09", + "signature": "f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09", + "impliedNodeFormat": "CommonJS" + } + ], + "fileIdsList": [ + [ + "./c.ts" + ], + [ + "./worker.d.ts" + ], + [ + "./b.d.ts" + ] + ], + "options": { + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./b.d.ts": [ + "./worker.d.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "size": 638 +} +//// [/home/src/workspaces/project/c.js] *new* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +let b = b_1.A.ONE; + + + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/worker.d.ts +*refresh* /home/src/workspaces/project/b.d.ts +*refresh* /home/src/workspaces/project/c.ts +*refresh* /home/src/workspaces/project/a.ts + +Signatures:: + + +Edit:: change enum value +//// [/home/src/workspaces/project/worker.d.ts] *modified* +export const enum AWorker { + ONE = 2 +} + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/a.js] *modified time* +//// [/home/src/workspaces/project/a.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./worker.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},"4749e1d328fb4b3d350a6fd1629b976d85cb877d3fb71070eef63605206f3a60","d1cae7e0884009696a49cf892aeb5da4fc8bc6050db4bce9ee30b657ccba9636","f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a","f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09"],"fileIdsList":[[4],[2],[3]],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"referencedMap":[[5,1],[3,2],[4,3]]} +//// [/home/src/workspaces/project/a.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./worker.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./worker.d.ts", + "version": "4749e1d328fb4b3d350a6fd1629b976d85cb877d3fb71070eef63605206f3a60", + "signature": "4749e1d328fb4b3d350a6fd1629b976d85cb877d3fb71070eef63605206f3a60", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./b.d.ts", + "version": "d1cae7e0884009696a49cf892aeb5da4fc8bc6050db4bce9ee30b657ccba9636", + "signature": "d1cae7e0884009696a49cf892aeb5da4fc8bc6050db4bce9ee30b657ccba9636", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./c.ts", + "version": "f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a", + "signature": "f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./a.ts", + "version": "f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09", + "signature": "f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09", + "impliedNodeFormat": "CommonJS" + } + ], + "fileIdsList": [ + [ + "./c.ts" + ], + [ + "./worker.d.ts" + ], + [ + "./b.d.ts" + ] + ], + "options": { + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./b.d.ts": [ + "./worker.d.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "size": 638 +} +//// [/home/src/workspaces/project/c.js] *modified time* + + +SemanticDiagnostics:: +*refresh* /home/src/workspaces/project/worker.d.ts +*refresh* /home/src/workspaces/project/b.d.ts +*refresh* /home/src/workspaces/project/c.ts +*refresh* /home/src/workspaces/project/a.ts + +Signatures:: +(used version) /home/src/workspaces/project/worker.d.ts +(used version) /home/src/workspaces/project/b.d.ts +(used version) /home/src/workspaces/project/c.ts +(used version) /home/src/workspaces/project/a.ts + + +Edit:: change enum value again +//// [/home/src/workspaces/project/worker.d.ts] *modified* +export const enum AWorker { + ONE = 3 +} + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/a.js] *modified time* +//// [/home/src/workspaces/project/a.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./worker.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},"9429bb2451db350f9bceba9041b64c9b80446ebfd5c423802bdee3ac2cd0fccc","d1cae7e0884009696a49cf892aeb5da4fc8bc6050db4bce9ee30b657ccba9636","f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a","f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09"],"fileIdsList":[[4],[2],[3]],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"referencedMap":[[5,1],[3,2],[4,3]]} +//// [/home/src/workspaces/project/a.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./worker.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./worker.d.ts", + "version": "9429bb2451db350f9bceba9041b64c9b80446ebfd5c423802bdee3ac2cd0fccc", + "signature": "9429bb2451db350f9bceba9041b64c9b80446ebfd5c423802bdee3ac2cd0fccc", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./b.d.ts", + "version": "d1cae7e0884009696a49cf892aeb5da4fc8bc6050db4bce9ee30b657ccba9636", + "signature": "d1cae7e0884009696a49cf892aeb5da4fc8bc6050db4bce9ee30b657ccba9636", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./c.ts", + "version": "f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a", + "signature": "f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./a.ts", + "version": "f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09", + "signature": "f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09", + "impliedNodeFormat": "CommonJS" + } + ], + "fileIdsList": [ + [ + "./c.ts" + ], + [ + "./worker.d.ts" + ], + [ + "./b.d.ts" + ] + ], + "options": { + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./b.d.ts": [ + "./worker.d.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "size": 638 +} +//// [/home/src/workspaces/project/c.js] *modified time* + + +SemanticDiagnostics:: +*refresh* /home/src/workspaces/project/worker.d.ts +*refresh* /home/src/workspaces/project/b.d.ts +*refresh* /home/src/workspaces/project/c.ts +*refresh* /home/src/workspaces/project/a.ts + +Signatures:: +(used version) /home/src/workspaces/project/worker.d.ts +(used version) /home/src/workspaces/project/b.d.ts +(used version) /home/src/workspaces/project/c.ts +(used version) /home/src/workspaces/project/a.ts + + +Edit:: something else changes in b.d.ts +//// [/home/src/workspaces/project/b.d.ts] *modified* +export { AWorker as A } from "./worker";export const randomThing = 10; + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/a.js] *modified time* +//// [/home/src/workspaces/project/a.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./worker.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},"9429bb2451db350f9bceba9041b64c9b80446ebfd5c423802bdee3ac2cd0fccc","eececfa518b405636ca59764618daf54087efc29f152e951a20f543569bc9da6",{"version":"f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a","signature":"1affdd1113604735d4499c03d6271d13972094ddab6991610e72d53c00d14732","impliedNodeFormat":1},{"version":"f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[4],[2],[3]],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"referencedMap":[[5,1],[3,2],[4,3]]} +//// [/home/src/workspaces/project/a.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./worker.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./worker.d.ts", + "version": "9429bb2451db350f9bceba9041b64c9b80446ebfd5c423802bdee3ac2cd0fccc", + "signature": "9429bb2451db350f9bceba9041b64c9b80446ebfd5c423802bdee3ac2cd0fccc", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./b.d.ts", + "version": "eececfa518b405636ca59764618daf54087efc29f152e951a20f543569bc9da6", + "signature": "eececfa518b405636ca59764618daf54087efc29f152e951a20f543569bc9da6", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./c.ts", + "version": "f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a", + "signature": "1affdd1113604735d4499c03d6271d13972094ddab6991610e72d53c00d14732", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a", + "signature": "1affdd1113604735d4499c03d6271d13972094ddab6991610e72d53c00d14732", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./a.ts", + "version": "f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09", + "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09", + "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./c.ts" + ], + [ + "./worker.d.ts" + ], + [ + "./b.d.ts" + ] + ], + "options": { + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./b.d.ts": [ + "./worker.d.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "size": 864 +} +//// [/home/src/workspaces/project/c.js] *modified time* + + +SemanticDiagnostics:: +*refresh* /home/src/workspaces/project/b.d.ts +*refresh* /home/src/workspaces/project/c.ts +*refresh* /home/src/workspaces/project/a.ts + +Signatures:: +(used version) /home/src/workspaces/project/b.d.ts +(computed .d.ts) /home/src/workspaces/project/c.ts +(computed .d.ts) /home/src/workspaces/project/a.ts + + +Edit:: something else changes in b.d.ts again +//// [/home/src/workspaces/project/b.d.ts] *modified* +export { AWorker as A } from "./worker";export const randomThing = 10;export const randomThing2 = 10; + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/a.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./worker.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},"9429bb2451db350f9bceba9041b64c9b80446ebfd5c423802bdee3ac2cd0fccc","fc3df7c9dd67a05ea3329c1a9ef9c5f81ddb2109cc13c2089aef6c5dbef34340",{"version":"f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a","signature":"1affdd1113604735d4499c03d6271d13972094ddab6991610e72d53c00d14732","impliedNodeFormat":1},"f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09"],"fileIdsList":[[4],[2],[3]],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"referencedMap":[[5,1],[3,2],[4,3]]} +//// [/home/src/workspaces/project/a.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./worker.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./worker.d.ts", + "version": "9429bb2451db350f9bceba9041b64c9b80446ebfd5c423802bdee3ac2cd0fccc", + "signature": "9429bb2451db350f9bceba9041b64c9b80446ebfd5c423802bdee3ac2cd0fccc", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./b.d.ts", + "version": "fc3df7c9dd67a05ea3329c1a9ef9c5f81ddb2109cc13c2089aef6c5dbef34340", + "signature": "fc3df7c9dd67a05ea3329c1a9ef9c5f81ddb2109cc13c2089aef6c5dbef34340", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./c.ts", + "version": "f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a", + "signature": "1affdd1113604735d4499c03d6271d13972094ddab6991610e72d53c00d14732", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a", + "signature": "1affdd1113604735d4499c03d6271d13972094ddab6991610e72d53c00d14732", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./a.ts", + "version": "f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09", + "signature": "f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09", + "impliedNodeFormat": "CommonJS" + } + ], + "fileIdsList": [ + [ + "./c.ts" + ], + [ + "./worker.d.ts" + ], + [ + "./b.d.ts" + ] + ], + "options": { + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./b.d.ts": [ + "./worker.d.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "size": 751 +} +//// [/home/src/workspaces/project/c.js] *modified time* + + +SemanticDiagnostics:: +*refresh* /home/src/workspaces/project/b.d.ts +*refresh* /home/src/workspaces/project/c.ts +*refresh* /home/src/workspaces/project/a.ts + +Signatures:: +(used version) /home/src/workspaces/project/b.d.ts +(computed .d.ts) /home/src/workspaces/project/c.ts +(used version) /home/src/workspaces/project/a.ts diff --git a/testdata/baselines/reference/tsc/incremental/const-enums-aliased.js b/testdata/baselines/reference/tsc/incremental/const-enums-aliased.js new file mode 100644 index 0000000000..41e57cd505 --- /dev/null +++ b/testdata/baselines/reference/tsc/incremental/const-enums-aliased.js @@ -0,0 +1,511 @@ + +currentDirectory::/home/src/workspaces/project +useCaseSensitiveFileNames::true +Input::-i a.ts --tsbuildinfofile a.tsbuildinfo +//// [/home/src/workspaces/project/a.ts] *new* +import {A} from "./c" +let a = A.ONE +//// [/home/src/workspaces/project/b.d.ts] *new* +export const enum AWorker { + ONE = 1 +} +export { AWorker as A }; +//// [/home/src/workspaces/project/c.ts] *new* +import {A} from "./b" +let b = A.ONE +export {A} +//// [/home/src/workspaces/project/worker.d.ts] *new* +export const enum AWorker { + ONE = 1 +} + +ExitStatus:: 0 + +CompilerOptions::{ + "incremental": true, + "tsBuildInfoFile": "/home/src/workspaces/project/a.tsbuildinfo" +} +Output:: +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; +//// [/home/src/workspaces/project/a.js] *new* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +let a = c_1.A.ONE; + +//// [/home/src/workspaces/project/a.tsbuildinfo] *new* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},"aefe0c976f3560d1dc94c0cd48015c353590ad36544e20b63343660251f2dda0","f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a","f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09"],"fileIdsList":[[3],[2]],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"referencedMap":[[4,1],[3,2]]} +//// [/home/src/workspaces/project/a.tsbuildinfo.readable.baseline.txt] *new* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./b.d.ts", + "version": "aefe0c976f3560d1dc94c0cd48015c353590ad36544e20b63343660251f2dda0", + "signature": "aefe0c976f3560d1dc94c0cd48015c353590ad36544e20b63343660251f2dda0", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./c.ts", + "version": "f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a", + "signature": "f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./a.ts", + "version": "f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09", + "signature": "f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09", + "impliedNodeFormat": "CommonJS" + } + ], + "fileIdsList": [ + [ + "./c.ts" + ], + [ + "./b.d.ts" + ] + ], + "options": { + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "size": 545 +} +//// [/home/src/workspaces/project/c.js] *new* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +let b = b_1.A.ONE; + + + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/b.d.ts +*refresh* /home/src/workspaces/project/c.ts +*refresh* /home/src/workspaces/project/a.ts + +Signatures:: + + +Edit:: change enum value +//// [/home/src/workspaces/project/b.d.ts] *modified* +export const enum AWorker { + ONE = 2 +} +export { AWorker as A }; + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/a.js] *modified time* +//// [/home/src/workspaces/project/a.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},"14d71e969881a8c0811d42cfe653ed85464878ffea9da23fc600354f69c7ce0a",{"version":"f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a","signature":"1affdd1113604735d4499c03d6271d13972094ddab6991610e72d53c00d14732","impliedNodeFormat":1},{"version":"f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[3],[2]],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"referencedMap":[[4,1],[3,2]]} +//// [/home/src/workspaces/project/a.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./b.d.ts", + "version": "14d71e969881a8c0811d42cfe653ed85464878ffea9da23fc600354f69c7ce0a", + "signature": "14d71e969881a8c0811d42cfe653ed85464878ffea9da23fc600354f69c7ce0a", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./c.ts", + "version": "f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a", + "signature": "1affdd1113604735d4499c03d6271d13972094ddab6991610e72d53c00d14732", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a", + "signature": "1affdd1113604735d4499c03d6271d13972094ddab6991610e72d53c00d14732", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./a.ts", + "version": "f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09", + "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09", + "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./c.ts" + ], + [ + "./b.d.ts" + ] + ], + "options": { + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "size": 771 +} +//// [/home/src/workspaces/project/c.js] *modified time* + + +SemanticDiagnostics:: +*refresh* /home/src/workspaces/project/b.d.ts +*refresh* /home/src/workspaces/project/c.ts +*refresh* /home/src/workspaces/project/a.ts + +Signatures:: +(used version) /home/src/workspaces/project/b.d.ts +(computed .d.ts) /home/src/workspaces/project/c.ts +(computed .d.ts) /home/src/workspaces/project/a.ts + + +Edit:: change enum value again +//// [/home/src/workspaces/project/b.d.ts] *modified* +export const enum AWorker { + ONE = 3 +} +export { AWorker as A }; + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/a.js] *modified time* +//// [/home/src/workspaces/project/a.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},"fd596fa8534f245082284882486d12dcbbac11bddd318142255e4263cfc8caee",{"version":"f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a","signature":"1affdd1113604735d4499c03d6271d13972094ddab6991610e72d53c00d14732","impliedNodeFormat":1},"f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09"],"fileIdsList":[[3],[2]],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"referencedMap":[[4,1],[3,2]]} +//// [/home/src/workspaces/project/a.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./b.d.ts", + "version": "fd596fa8534f245082284882486d12dcbbac11bddd318142255e4263cfc8caee", + "signature": "fd596fa8534f245082284882486d12dcbbac11bddd318142255e4263cfc8caee", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./c.ts", + "version": "f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a", + "signature": "1affdd1113604735d4499c03d6271d13972094ddab6991610e72d53c00d14732", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a", + "signature": "1affdd1113604735d4499c03d6271d13972094ddab6991610e72d53c00d14732", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./a.ts", + "version": "f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09", + "signature": "f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09", + "impliedNodeFormat": "CommonJS" + } + ], + "fileIdsList": [ + [ + "./c.ts" + ], + [ + "./b.d.ts" + ] + ], + "options": { + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "size": 658 +} +//// [/home/src/workspaces/project/c.js] *modified time* + + +SemanticDiagnostics:: +*refresh* /home/src/workspaces/project/b.d.ts +*refresh* /home/src/workspaces/project/c.ts +*refresh* /home/src/workspaces/project/a.ts + +Signatures:: +(used version) /home/src/workspaces/project/b.d.ts +(computed .d.ts) /home/src/workspaces/project/c.ts +(used version) /home/src/workspaces/project/a.ts + + +Edit:: something else changes in b.d.ts +//// [/home/src/workspaces/project/b.d.ts] *modified* +export const enum AWorker { + ONE = 3 +} +export { AWorker as A };export const randomThing = 10; + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/a.js] *modified time* +//// [/home/src/workspaces/project/a.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},"da86c0aef231d210deabded52a8d06f690f831df02245fda8366c42fe1a8256b",{"version":"f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a","signature":"1affdd1113604735d4499c03d6271d13972094ddab6991610e72d53c00d14732","impliedNodeFormat":1},"f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09"],"fileIdsList":[[3],[2]],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"referencedMap":[[4,1],[3,2]]} +//// [/home/src/workspaces/project/a.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./b.d.ts", + "version": "da86c0aef231d210deabded52a8d06f690f831df02245fda8366c42fe1a8256b", + "signature": "da86c0aef231d210deabded52a8d06f690f831df02245fda8366c42fe1a8256b", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./c.ts", + "version": "f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a", + "signature": "1affdd1113604735d4499c03d6271d13972094ddab6991610e72d53c00d14732", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a", + "signature": "1affdd1113604735d4499c03d6271d13972094ddab6991610e72d53c00d14732", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./a.ts", + "version": "f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09", + "signature": "f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09", + "impliedNodeFormat": "CommonJS" + } + ], + "fileIdsList": [ + [ + "./c.ts" + ], + [ + "./b.d.ts" + ] + ], + "options": { + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "size": 658 +} +//// [/home/src/workspaces/project/c.js] *modified time* + + +SemanticDiagnostics:: +*refresh* /home/src/workspaces/project/b.d.ts +*refresh* /home/src/workspaces/project/c.ts +*refresh* /home/src/workspaces/project/a.ts + +Signatures:: +(used version) /home/src/workspaces/project/b.d.ts +(computed .d.ts) /home/src/workspaces/project/c.ts +(used version) /home/src/workspaces/project/a.ts + + +Edit:: something else changes in b.d.ts again +//// [/home/src/workspaces/project/b.d.ts] *modified* +export const enum AWorker { + ONE = 3 +} +export { AWorker as A };export const randomThing = 10;export const randomThing2 = 10; + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/a.js] *modified time* +//// [/home/src/workspaces/project/a.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},"553c61a4c56cd4ff8a6e8d257be96bb2bf38cee5d52a5b44b9084f92da5b8c27",{"version":"f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a","signature":"1affdd1113604735d4499c03d6271d13972094ddab6991610e72d53c00d14732","impliedNodeFormat":1},"f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09"],"fileIdsList":[[3],[2]],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"referencedMap":[[4,1],[3,2]]} +//// [/home/src/workspaces/project/a.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./b.d.ts", + "version": "553c61a4c56cd4ff8a6e8d257be96bb2bf38cee5d52a5b44b9084f92da5b8c27", + "signature": "553c61a4c56cd4ff8a6e8d257be96bb2bf38cee5d52a5b44b9084f92da5b8c27", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./c.ts", + "version": "f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a", + "signature": "1affdd1113604735d4499c03d6271d13972094ddab6991610e72d53c00d14732", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a", + "signature": "1affdd1113604735d4499c03d6271d13972094ddab6991610e72d53c00d14732", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./a.ts", + "version": "f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09", + "signature": "f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09", + "impliedNodeFormat": "CommonJS" + } + ], + "fileIdsList": [ + [ + "./c.ts" + ], + [ + "./b.d.ts" + ] + ], + "options": { + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "size": 658 +} +//// [/home/src/workspaces/project/c.js] *modified time* + + +SemanticDiagnostics:: +*refresh* /home/src/workspaces/project/b.d.ts +*refresh* /home/src/workspaces/project/c.ts +*refresh* /home/src/workspaces/project/a.ts + +Signatures:: +(used version) /home/src/workspaces/project/b.d.ts +(computed .d.ts) /home/src/workspaces/project/c.ts +(used version) /home/src/workspaces/project/a.ts diff --git a/testdata/baselines/reference/tsc/incremental/const-enums.js b/testdata/baselines/reference/tsc/incremental/const-enums.js new file mode 100644 index 0000000000..50258c40b9 --- /dev/null +++ b/testdata/baselines/reference/tsc/incremental/const-enums.js @@ -0,0 +1,506 @@ + +currentDirectory::/home/src/workspaces/project +useCaseSensitiveFileNames::true +Input::-i a.ts --tsbuildinfofile a.tsbuildinfo +//// [/home/src/workspaces/project/a.ts] *new* +import {A} from "./c" +let a = A.ONE +//// [/home/src/workspaces/project/b.d.ts] *new* +export const enum A { + ONE = 1 +} +//// [/home/src/workspaces/project/c.ts] *new* +import {A} from "./b" +let b = A.ONE +export {A} +//// [/home/src/workspaces/project/worker.d.ts] *new* +export const enum AWorker { + ONE = 1 +} + +ExitStatus:: 0 + +CompilerOptions::{ + "incremental": true, + "tsBuildInfoFile": "/home/src/workspaces/project/a.tsbuildinfo" +} +Output:: +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; +//// [/home/src/workspaces/project/a.js] *new* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +let a = c_1.A.ONE; + +//// [/home/src/workspaces/project/a.tsbuildinfo] *new* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},"c00e44762baea954363536f3ccceae15fd84bf2b246f8cb077164d106cd5c9ae","f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a","f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09"],"fileIdsList":[[3],[2]],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"referencedMap":[[4,1],[3,2]]} +//// [/home/src/workspaces/project/a.tsbuildinfo.readable.baseline.txt] *new* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./b.d.ts", + "version": "c00e44762baea954363536f3ccceae15fd84bf2b246f8cb077164d106cd5c9ae", + "signature": "c00e44762baea954363536f3ccceae15fd84bf2b246f8cb077164d106cd5c9ae", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./c.ts", + "version": "f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a", + "signature": "f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./a.ts", + "version": "f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09", + "signature": "f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09", + "impliedNodeFormat": "CommonJS" + } + ], + "fileIdsList": [ + [ + "./c.ts" + ], + [ + "./b.d.ts" + ] + ], + "options": { + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "size": 545 +} +//// [/home/src/workspaces/project/c.js] *new* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +let b = b_1.A.ONE; + + + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/b.d.ts +*refresh* /home/src/workspaces/project/c.ts +*refresh* /home/src/workspaces/project/a.ts + +Signatures:: + + +Edit:: change enum value +//// [/home/src/workspaces/project/b.d.ts] *modified* +export const enum A { + ONE = 2 +} + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/a.js] *modified time* +//// [/home/src/workspaces/project/a.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},"6ab9b377a00d6157a880e7be8f490a45f91a751d3aab7a46a21fd0169189e21c",{"version":"f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a","signature":"1affdd1113604735d4499c03d6271d13972094ddab6991610e72d53c00d14732","impliedNodeFormat":1},{"version":"f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","impliedNodeFormat":1}],"fileIdsList":[[3],[2]],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"referencedMap":[[4,1],[3,2]]} +//// [/home/src/workspaces/project/a.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./b.d.ts", + "version": "6ab9b377a00d6157a880e7be8f490a45f91a751d3aab7a46a21fd0169189e21c", + "signature": "6ab9b377a00d6157a880e7be8f490a45f91a751d3aab7a46a21fd0169189e21c", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./c.ts", + "version": "f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a", + "signature": "1affdd1113604735d4499c03d6271d13972094ddab6991610e72d53c00d14732", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a", + "signature": "1affdd1113604735d4499c03d6271d13972094ddab6991610e72d53c00d14732", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./a.ts", + "version": "f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09", + "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09", + "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881", + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./c.ts" + ], + [ + "./b.d.ts" + ] + ], + "options": { + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "size": 771 +} +//// [/home/src/workspaces/project/c.js] *modified time* + + +SemanticDiagnostics:: +*refresh* /home/src/workspaces/project/b.d.ts +*refresh* /home/src/workspaces/project/c.ts +*refresh* /home/src/workspaces/project/a.ts + +Signatures:: +(used version) /home/src/workspaces/project/b.d.ts +(computed .d.ts) /home/src/workspaces/project/c.ts +(computed .d.ts) /home/src/workspaces/project/a.ts + + +Edit:: change enum value again +//// [/home/src/workspaces/project/b.d.ts] *modified* +export const enum A { + ONE = 3 +} + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/a.js] *modified time* +//// [/home/src/workspaces/project/a.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},"9b7fcb1de7abaa3bee27ad197ab712966678462da9b016fd18a98202a022e062",{"version":"f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a","signature":"1affdd1113604735d4499c03d6271d13972094ddab6991610e72d53c00d14732","impliedNodeFormat":1},"f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09"],"fileIdsList":[[3],[2]],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"referencedMap":[[4,1],[3,2]]} +//// [/home/src/workspaces/project/a.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./b.d.ts", + "version": "9b7fcb1de7abaa3bee27ad197ab712966678462da9b016fd18a98202a022e062", + "signature": "9b7fcb1de7abaa3bee27ad197ab712966678462da9b016fd18a98202a022e062", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./c.ts", + "version": "f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a", + "signature": "1affdd1113604735d4499c03d6271d13972094ddab6991610e72d53c00d14732", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a", + "signature": "1affdd1113604735d4499c03d6271d13972094ddab6991610e72d53c00d14732", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./a.ts", + "version": "f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09", + "signature": "f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09", + "impliedNodeFormat": "CommonJS" + } + ], + "fileIdsList": [ + [ + "./c.ts" + ], + [ + "./b.d.ts" + ] + ], + "options": { + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "size": 658 +} +//// [/home/src/workspaces/project/c.js] *modified time* + + +SemanticDiagnostics:: +*refresh* /home/src/workspaces/project/b.d.ts +*refresh* /home/src/workspaces/project/c.ts +*refresh* /home/src/workspaces/project/a.ts + +Signatures:: +(used version) /home/src/workspaces/project/b.d.ts +(computed .d.ts) /home/src/workspaces/project/c.ts +(used version) /home/src/workspaces/project/a.ts + + +Edit:: something else changes in b.d.ts +//// [/home/src/workspaces/project/b.d.ts] *modified* +export const enum A { + ONE = 3 +}export const randomThing = 10; + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/a.js] *modified time* +//// [/home/src/workspaces/project/a.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},"8eb5f9388406068b4f938250bc5ba6c8f62cb17db7bd81dad8d2b8e411d344ed",{"version":"f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a","signature":"1affdd1113604735d4499c03d6271d13972094ddab6991610e72d53c00d14732","impliedNodeFormat":1},"f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09"],"fileIdsList":[[3],[2]],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"referencedMap":[[4,1],[3,2]]} +//// [/home/src/workspaces/project/a.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./b.d.ts", + "version": "8eb5f9388406068b4f938250bc5ba6c8f62cb17db7bd81dad8d2b8e411d344ed", + "signature": "8eb5f9388406068b4f938250bc5ba6c8f62cb17db7bd81dad8d2b8e411d344ed", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./c.ts", + "version": "f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a", + "signature": "1affdd1113604735d4499c03d6271d13972094ddab6991610e72d53c00d14732", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a", + "signature": "1affdd1113604735d4499c03d6271d13972094ddab6991610e72d53c00d14732", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./a.ts", + "version": "f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09", + "signature": "f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09", + "impliedNodeFormat": "CommonJS" + } + ], + "fileIdsList": [ + [ + "./c.ts" + ], + [ + "./b.d.ts" + ] + ], + "options": { + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "size": 658 +} +//// [/home/src/workspaces/project/c.js] *modified time* + + +SemanticDiagnostics:: +*refresh* /home/src/workspaces/project/b.d.ts +*refresh* /home/src/workspaces/project/c.ts +*refresh* /home/src/workspaces/project/a.ts + +Signatures:: +(used version) /home/src/workspaces/project/b.d.ts +(computed .d.ts) /home/src/workspaces/project/c.ts +(used version) /home/src/workspaces/project/a.ts + + +Edit:: something else changes in b.d.ts again +//// [/home/src/workspaces/project/b.d.ts] *modified* +export const enum A { + ONE = 3 +}export const randomThing = 10;export const randomThing2 = 10; + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/a.js] *modified time* +//// [/home/src/workspaces/project/a.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},"0e2a47b6ac5d1eb00a443643049e47e98f3bcacb8852a925f600902222323516",{"version":"f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a","signature":"1affdd1113604735d4499c03d6271d13972094ddab6991610e72d53c00d14732","impliedNodeFormat":1},"f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09"],"fileIdsList":[[3],[2]],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"referencedMap":[[4,1],[3,2]]} +//// [/home/src/workspaces/project/a.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./b.d.ts", + "./c.ts", + "./a.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./b.d.ts", + "version": "0e2a47b6ac5d1eb00a443643049e47e98f3bcacb8852a925f600902222323516", + "signature": "0e2a47b6ac5d1eb00a443643049e47e98f3bcacb8852a925f600902222323516", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./c.ts", + "version": "f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a", + "signature": "1affdd1113604735d4499c03d6271d13972094ddab6991610e72d53c00d14732", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a", + "signature": "1affdd1113604735d4499c03d6271d13972094ddab6991610e72d53c00d14732", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./a.ts", + "version": "f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09", + "signature": "f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09", + "impliedNodeFormat": "CommonJS" + } + ], + "fileIdsList": [ + [ + "./c.ts" + ], + [ + "./b.d.ts" + ] + ], + "options": { + "tsBuildInfoFile": "./a.tsbuildinfo" + }, + "referencedMap": { + "./a.ts": [ + "./c.ts" + ], + "./c.ts": [ + "./b.d.ts" + ] + }, + "size": 658 +} +//// [/home/src/workspaces/project/c.js] *modified time* + + +SemanticDiagnostics:: +*refresh* /home/src/workspaces/project/b.d.ts +*refresh* /home/src/workspaces/project/c.ts +*refresh* /home/src/workspaces/project/a.ts + +Signatures:: +(used version) /home/src/workspaces/project/b.d.ts +(computed .d.ts) /home/src/workspaces/project/c.ts +(used version) /home/src/workspaces/project/a.ts diff --git a/testdata/baselines/reference/tsc/incremental/generates-typerefs-correctly.js b/testdata/baselines/reference/tsc/incremental/generates-typerefs-correctly.js new file mode 100644 index 0000000000..eb64462f48 --- /dev/null +++ b/testdata/baselines/reference/tsc/incremental/generates-typerefs-correctly.js @@ -0,0 +1,344 @@ + +currentDirectory::/home/src/workspaces/project +useCaseSensitiveFileNames::true +Input:: +//// [/home/src/workspaces/project/src/box.ts] *new* +export interface Box { + unbox(): T +} +//// [/home/src/workspaces/project/src/bug.js] *new* +import * as B from "./box.js" +import * as W from "./wrap.js" + +/** + * @template {object} C + * @param {C} source + * @returns {W.Wrap} + */ +const wrap = source => { +throw source +} + +/** + * @returns {B.Box} + */ +const box = (n = 0) => ({ unbox: () => n }) + +export const bug = wrap({ n: box(1) }); +//// [/home/src/workspaces/project/src/wrap.ts] *new* +export type Wrap = { + [K in keyof C]: { wrapped: C[K] } +} +//// [/home/src/workspaces/project/tsconfig.json] *new* +{ + "compilerOptions": { + "composite": true, + "outDir": "outDir", + "checkJs": true + }, + "include": ["src"], +} + +ExitStatus:: 0 + +CompilerOptions::{} +Output:: +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; +//// [/home/src/workspaces/project/outDir/src/box.d.ts] *new* +export interface Box { + unbox(): T; +} + +//// [/home/src/workspaces/project/outDir/src/box.js] *new* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); + +//// [/home/src/workspaces/project/outDir/src/bug.d.ts] *new* +import * as B from "./box.js"; +import * as W from "./wrap.js"; +export declare const bug: W.Wrap<{ + n: B.Box; +}>; + +//// [/home/src/workspaces/project/outDir/src/bug.js] *new* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.bug = void 0; +const B = require("./box.js"); +const W = require("./wrap.js"); +/** + * @template {object} C + * @param {C} source + * @returns {W.Wrap} + */ +const wrap = source => { + throw source; +}; +/** + * @returns {B.Box} + */ +const box = (n = 0) => ({ unbox: () => n }); +exports.bug = wrap({ n: box(1) }); + +//// [/home/src/workspaces/project/outDir/src/wrap.d.ts] *new* +export type Wrap = { + [K in keyof C]: { + wrapped: C[K]; + }; +}; + +//// [/home/src/workspaces/project/outDir/src/wrap.js] *new* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); + +//// [/home/src/workspaces/project/outDir/tsconfig.tsbuildinfo] *new* +{"version":"FakeTSVersion","fileNames":["../../../tslibs/TS/Lib/lib.d.ts","../src/box.ts","../src/wrap.ts","../src/bug.js"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0368ea83346f71eb3a3ca19fa727980a0456898b66b88a4c998681504e53158e","signature":"5869e012eabb24957b3b2a27561b2b2717204cde82b935ea3195bf53b2217448","impliedNodeFormat":1},{"version":"a3491cb9265a4ed19398a6a100ae6e6789c7272cfe887c80b4c439101afd7dc7","signature":"4c8e88aa97caafb769b257fcde8ff8a50ef3e962fc7f3c51fba1c7c7e905dc3b","impliedNodeFormat":1},{"version":"f4375ea4700b8e5e8d2c1cc7552de717928f9b5333a1be759bc15f196daea88e","signature":"d50883e16164d399f0e9534640b44ee6c05a7c690534d0201a645262e7caab22","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"checkJs":true,"composite":true,"outDir":"./"},"referencedMap":[[4,1]],"latestChangedDtsFile":"./src/wrap.d.ts"} +//// [/home/src/workspaces/project/outDir/tsconfig.tsbuildinfo.readable.baseline.txt] *new* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../../tslibs/TS/Lib/lib.d.ts", + "../src/box.ts", + "../src/wrap.ts", + "../src/bug.js" + ], + "fileInfos": [ + { + "fileName": "../../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "../src/box.ts", + "version": "0368ea83346f71eb3a3ca19fa727980a0456898b66b88a4c998681504e53158e", + "signature": "5869e012eabb24957b3b2a27561b2b2717204cde82b935ea3195bf53b2217448", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "0368ea83346f71eb3a3ca19fa727980a0456898b66b88a4c998681504e53158e", + "signature": "5869e012eabb24957b3b2a27561b2b2717204cde82b935ea3195bf53b2217448", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "../src/wrap.ts", + "version": "a3491cb9265a4ed19398a6a100ae6e6789c7272cfe887c80b4c439101afd7dc7", + "signature": "4c8e88aa97caafb769b257fcde8ff8a50ef3e962fc7f3c51fba1c7c7e905dc3b", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "a3491cb9265a4ed19398a6a100ae6e6789c7272cfe887c80b4c439101afd7dc7", + "signature": "4c8e88aa97caafb769b257fcde8ff8a50ef3e962fc7f3c51fba1c7c7e905dc3b", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "../src/bug.js", + "version": "f4375ea4700b8e5e8d2c1cc7552de717928f9b5333a1be759bc15f196daea88e", + "signature": "d50883e16164d399f0e9534640b44ee6c05a7c690534d0201a645262e7caab22", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "f4375ea4700b8e5e8d2c1cc7552de717928f9b5333a1be759bc15f196daea88e", + "signature": "d50883e16164d399f0e9534640b44ee6c05a7c690534d0201a645262e7caab22", + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "../src/box.ts", + "../src/wrap.ts" + ] + ], + "options": { + "checkJs": true, + "composite": true, + "outDir": "./" + }, + "referencedMap": { + "../src/bug.js": [ + "../src/box.ts", + "../src/wrap.ts" + ] + }, + "latestChangedDtsFile": "./src/wrap.d.ts", + "size": 950 +} + + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/src/box.ts +*refresh* /home/src/workspaces/project/src/wrap.ts +*refresh* /home/src/workspaces/project/src/bug.js + +Signatures:: +(stored at emit) /home/src/workspaces/project/src/box.ts +(stored at emit) /home/src/workspaces/project/src/wrap.ts +(stored at emit) /home/src/workspaces/project/src/bug.js + + +Edit:: modify js file +//// [/home/src/workspaces/project/src/bug.js] *modified* +import * as B from "./box.js" +import * as W from "./wrap.js" + +/** + * @template {object} C + * @param {C} source + * @returns {W.Wrap} + */ +const wrap = source => { +throw source +} + +/** + * @returns {B.Box} + */ +const box = (n = 0) => ({ unbox: () => n }) + +export const bug = wrap({ n: box(1) });export const something = 1; + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/outDir/src/bug.d.ts] *modified* +import * as B from "./box.js"; +import * as W from "./wrap.js"; +export declare const bug: W.Wrap<{ + n: B.Box; +}>; +export declare const something = 1; + +//// [/home/src/workspaces/project/outDir/src/bug.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.something = exports.bug = void 0; +const B = require("./box.js"); +const W = require("./wrap.js"); +/** + * @template {object} C + * @param {C} source + * @returns {W.Wrap} + */ +const wrap = source => { + throw source; +}; +/** + * @returns {B.Box} + */ +const box = (n = 0) => ({ unbox: () => n }); +exports.bug = wrap({ n: box(1) }); +exports.something = 1; + +//// [/home/src/workspaces/project/outDir/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../../tslibs/TS/Lib/lib.d.ts","../src/box.ts","../src/wrap.ts","../src/bug.js"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0368ea83346f71eb3a3ca19fa727980a0456898b66b88a4c998681504e53158e","signature":"5869e012eabb24957b3b2a27561b2b2717204cde82b935ea3195bf53b2217448","impliedNodeFormat":1},{"version":"a3491cb9265a4ed19398a6a100ae6e6789c7272cfe887c80b4c439101afd7dc7","signature":"4c8e88aa97caafb769b257fcde8ff8a50ef3e962fc7f3c51fba1c7c7e905dc3b","impliedNodeFormat":1},{"version":"676e1613c74cee0aa880dc1108ce9e0a07e184e35a7d78282bf4a480bf6124db","signature":"6a80e6a4e41ee496beaac682ed90a523d5f8b87987da12ca01326156d552d025","impliedNodeFormat":1}],"fileIdsList":[[2,3]],"options":{"checkJs":true,"composite":true,"outDir":"./"},"referencedMap":[[4,1]],"latestChangedDtsFile":"./src/bug.d.ts"} +//// [/home/src/workspaces/project/outDir/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../../tslibs/TS/Lib/lib.d.ts", + "../src/box.ts", + "../src/wrap.ts", + "../src/bug.js" + ], + "fileInfos": [ + { + "fileName": "../../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "../src/box.ts", + "version": "0368ea83346f71eb3a3ca19fa727980a0456898b66b88a4c998681504e53158e", + "signature": "5869e012eabb24957b3b2a27561b2b2717204cde82b935ea3195bf53b2217448", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "0368ea83346f71eb3a3ca19fa727980a0456898b66b88a4c998681504e53158e", + "signature": "5869e012eabb24957b3b2a27561b2b2717204cde82b935ea3195bf53b2217448", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "../src/wrap.ts", + "version": "a3491cb9265a4ed19398a6a100ae6e6789c7272cfe887c80b4c439101afd7dc7", + "signature": "4c8e88aa97caafb769b257fcde8ff8a50ef3e962fc7f3c51fba1c7c7e905dc3b", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "a3491cb9265a4ed19398a6a100ae6e6789c7272cfe887c80b4c439101afd7dc7", + "signature": "4c8e88aa97caafb769b257fcde8ff8a50ef3e962fc7f3c51fba1c7c7e905dc3b", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "../src/bug.js", + "version": "676e1613c74cee0aa880dc1108ce9e0a07e184e35a7d78282bf4a480bf6124db", + "signature": "6a80e6a4e41ee496beaac682ed90a523d5f8b87987da12ca01326156d552d025", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "676e1613c74cee0aa880dc1108ce9e0a07e184e35a7d78282bf4a480bf6124db", + "signature": "6a80e6a4e41ee496beaac682ed90a523d5f8b87987da12ca01326156d552d025", + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "../src/box.ts", + "../src/wrap.ts" + ] + ], + "options": { + "checkJs": true, + "composite": true, + "outDir": "./" + }, + "referencedMap": { + "../src/bug.js": [ + "../src/box.ts", + "../src/wrap.ts" + ] + }, + "latestChangedDtsFile": "./src/bug.d.ts", + "size": 949 +} + + +SemanticDiagnostics:: +*refresh* /home/src/workspaces/project/src/bug.js + +Signatures:: +(computed .d.ts) /home/src/workspaces/project/src/bug.js diff --git a/testdata/baselines/reference/tsc/incremental/option-changes-with-composite.js b/testdata/baselines/reference/tsc/incremental/option-changes-with-composite.js new file mode 100644 index 0000000000..58dc802472 --- /dev/null +++ b/testdata/baselines/reference/tsc/incremental/option-changes-with-composite.js @@ -0,0 +1,1432 @@ + +currentDirectory::/home/src/workspaces/project +useCaseSensitiveFileNames::true +Input:: +//// [/home/src/workspaces/project/a.ts] *new* +export const a = 10;const aLocal = 10; +//// [/home/src/workspaces/project/b.ts] *new* +export const b = 10;const bLocal = 10; +//// [/home/src/workspaces/project/c.ts] *new* +import { a } from "./a";export const c = a; +//// [/home/src/workspaces/project/d.ts] *new* +import { b } from "./b";export const d = b; +//// [/home/src/workspaces/project/tsconfig.json] *new* +{ + "compilerOptions": { + "composite": true, + } +} + +ExitStatus:: 0 + +CompilerOptions::{} +Output:: +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; +//// [/home/src/workspaces/project/a.d.ts] *new* +export declare const a = 10; + +//// [/home/src/workspaces/project/a.js] *new* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +exports.a = 10; +const aLocal = 10; + +//// [/home/src/workspaces/project/b.d.ts] *new* +export declare const b = 10; + +//// [/home/src/workspaces/project/b.js] *new* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +exports.b = 10; +const bLocal = 10; + +//// [/home/src/workspaces/project/c.d.ts] *new* +export declare const c = 10; + +//// [/home/src/workspaces/project/c.js] *new* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.c = void 0; +const a_1 = require("./a"); +exports.c = a_1.a; + +//// [/home/src/workspaces/project/d.d.ts] *new* +export declare const d = 10; + +//// [/home/src/workspaces/project/d.js] *new* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.d = void 0; +const b_1 = require("./b"); +exports.d = b_1.b; + +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *new* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./a.ts","./b.ts","./c.ts","./d.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"96a22151ab87189568fe787d7ca9a7901c65d3d9789f77588629bfb0c01886c0","signature":"0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff","impliedNodeFormat":1},{"version":"32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c","signature":"ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94","impliedNodeFormat":1},{"version":"35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28","signature":"24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058","impliedNodeFormat":1},{"version":"d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe","signature":"a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5","impliedNodeFormat":1}],"fileIdsList":[[2],[3]],"options":{"composite":true},"referencedMap":[[4,1],[5,2]],"latestChangedDtsFile":"./d.d.ts"} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *new* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./a.ts", + "./b.ts", + "./c.ts", + "./d.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./a.ts", + "version": "96a22151ab87189568fe787d7ca9a7901c65d3d9789f77588629bfb0c01886c0", + "signature": "0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "96a22151ab87189568fe787d7ca9a7901c65d3d9789f77588629bfb0c01886c0", + "signature": "0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./b.ts", + "version": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "signature": "ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "signature": "ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./c.ts", + "version": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "signature": "24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "signature": "24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./d.ts", + "version": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "signature": "a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "signature": "a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5", + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./a.ts" + ], + [ + "./b.ts" + ] + ], + "options": { + "composite": true + }, + "referencedMap": { + "./c.ts": [ + "./a.ts" + ], + "./d.ts": [ + "./b.ts" + ] + }, + "latestChangedDtsFile": "./d.d.ts", + "size": 1086 +} + + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/a.ts +*refresh* /home/src/workspaces/project/b.ts +*refresh* /home/src/workspaces/project/c.ts +*refresh* /home/src/workspaces/project/d.ts + +Signatures:: +(stored at emit) /home/src/workspaces/project/a.ts +(stored at emit) /home/src/workspaces/project/b.ts +(stored at emit) /home/src/workspaces/project/c.ts +(stored at emit) /home/src/workspaces/project/d.ts + + +Edit:: with sourceMap + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/a.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +exports.a = 10; +const aLocal = 10; +//# sourceMappingURL=a.js.map +//// [/home/src/workspaces/project/a.js.map] *new* +{"version":3,"file":"a.js","sourceRoot":"","sources":["a.ts"],"names":[],"mappings":";;;AAAa,QAAA,CAAC,GAAG,EAAE,CAAC;AAAA,MAAM,MAAM,GAAG,EAAE,CAAC"} +//// [/home/src/workspaces/project/b.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +exports.b = 10; +const bLocal = 10; +//# sourceMappingURL=b.js.map +//// [/home/src/workspaces/project/b.js.map] *new* +{"version":3,"file":"b.js","sourceRoot":"","sources":["b.ts"],"names":[],"mappings":";;;AAAa,QAAA,CAAC,GAAG,EAAE,CAAC;AAAA,MAAM,MAAM,GAAG,EAAE,CAAC"} +//// [/home/src/workspaces/project/c.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.c = void 0; +const a_1 = require("./a"); +exports.c = a_1.a; +//# sourceMappingURL=c.js.map +//// [/home/src/workspaces/project/c.js.map] *new* +{"version":3,"file":"c.js","sourceRoot":"","sources":["c.ts"],"names":[],"mappings":";;;AAAA,2BAAwB;AAAa,QAAA,CAAC,GAAG,KAAC,CAAC"} +//// [/home/src/workspaces/project/d.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.d = void 0; +const b_1 = require("./b"); +exports.d = b_1.b; +//# sourceMappingURL=d.js.map +//// [/home/src/workspaces/project/d.js.map] *new* +{"version":3,"file":"d.js","sourceRoot":"","sources":["d.ts"],"names":[],"mappings":";;;AAAA,2BAAwB;AAAa,QAAA,CAAC,GAAG,KAAC,CAAC"} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./a.ts","./b.ts","./c.ts","./d.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"96a22151ab87189568fe787d7ca9a7901c65d3d9789f77588629bfb0c01886c0","signature":"0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff","impliedNodeFormat":1},{"version":"32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c","signature":"ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94","impliedNodeFormat":1},{"version":"35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28","signature":"24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058","impliedNodeFormat":1},{"version":"d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe","signature":"a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5","impliedNodeFormat":1}],"fileIdsList":[[2],[3]],"options":{"composite":true,"sourceMap":true},"referencedMap":[[4,1],[5,2]],"latestChangedDtsFile":"./d.d.ts"} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./a.ts", + "./b.ts", + "./c.ts", + "./d.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./a.ts", + "version": "96a22151ab87189568fe787d7ca9a7901c65d3d9789f77588629bfb0c01886c0", + "signature": "0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "96a22151ab87189568fe787d7ca9a7901c65d3d9789f77588629bfb0c01886c0", + "signature": "0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./b.ts", + "version": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "signature": "ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "signature": "ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./c.ts", + "version": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "signature": "24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "signature": "24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./d.ts", + "version": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "signature": "a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "signature": "a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5", + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./a.ts" + ], + [ + "./b.ts" + ] + ], + "options": { + "composite": true, + "sourceMap": true + }, + "referencedMap": { + "./c.ts": [ + "./a.ts" + ], + "./d.ts": [ + "./b.ts" + ] + }, + "latestChangedDtsFile": "./d.d.ts", + "size": 1103 +} + + +SemanticDiagnostics:: + +Signatures:: + + +Edit:: should re-emit only js so they dont contain sourcemap + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/a.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +exports.a = 10; +const aLocal = 10; + +//// [/home/src/workspaces/project/b.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +exports.b = 10; +const bLocal = 10; + +//// [/home/src/workspaces/project/c.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.c = void 0; +const a_1 = require("./a"); +exports.c = a_1.a; + +//// [/home/src/workspaces/project/d.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.d = void 0; +const b_1 = require("./b"); +exports.d = b_1.b; + +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./a.ts","./b.ts","./c.ts","./d.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"96a22151ab87189568fe787d7ca9a7901c65d3d9789f77588629bfb0c01886c0","signature":"0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff","impliedNodeFormat":1},{"version":"32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c","signature":"ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94","impliedNodeFormat":1},{"version":"35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28","signature":"24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058","impliedNodeFormat":1},{"version":"d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe","signature":"a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5","impliedNodeFormat":1}],"fileIdsList":[[2],[3]],"options":{"composite":true},"referencedMap":[[4,1],[5,2]],"latestChangedDtsFile":"./d.d.ts"} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./a.ts", + "./b.ts", + "./c.ts", + "./d.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./a.ts", + "version": "96a22151ab87189568fe787d7ca9a7901c65d3d9789f77588629bfb0c01886c0", + "signature": "0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "96a22151ab87189568fe787d7ca9a7901c65d3d9789f77588629bfb0c01886c0", + "signature": "0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./b.ts", + "version": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "signature": "ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "signature": "ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./c.ts", + "version": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "signature": "24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "signature": "24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./d.ts", + "version": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "signature": "a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "signature": "a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5", + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./a.ts" + ], + [ + "./b.ts" + ] + ], + "options": { + "composite": true + }, + "referencedMap": { + "./c.ts": [ + "./a.ts" + ], + "./d.ts": [ + "./b.ts" + ] + }, + "latestChangedDtsFile": "./d.d.ts", + "size": 1086 +} + + +SemanticDiagnostics:: + +Signatures:: + + +Edit:: with declaration should not emit anything + +ExitStatus:: 0 +Output:: + + +SemanticDiagnostics:: + +Signatures:: + + +Edit:: no change + +ExitStatus:: 0 +Output:: + + +SemanticDiagnostics:: + +Signatures:: + + +Edit:: with declaration and declarationMap + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/a.d.ts] *modified* +export declare const a = 10; +//# sourceMappingURL=a.d.ts.map +//// [/home/src/workspaces/project/a.d.ts.map] *new* +{"version":3,"file":"a.d.ts","sourceRoot":"","sources":["a.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,CAAC,KAAK,CAAC"} +//// [/home/src/workspaces/project/b.d.ts] *modified* +export declare const b = 10; +//# sourceMappingURL=b.d.ts.map +//// [/home/src/workspaces/project/b.d.ts.map] *new* +{"version":3,"file":"b.d.ts","sourceRoot":"","sources":["b.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,CAAC,KAAK,CAAC"} +//// [/home/src/workspaces/project/c.d.ts] *modified* +export declare const c = 10; +//# sourceMappingURL=c.d.ts.map +//// [/home/src/workspaces/project/c.d.ts.map] *new* +{"version":3,"file":"c.d.ts","sourceRoot":"","sources":["c.ts"],"names":[],"mappings":"AAAwB,eAAO,MAAM,CAAC,KAAI,CAAC"} +//// [/home/src/workspaces/project/d.d.ts] *modified* +export declare const d = 10; +//# sourceMappingURL=d.d.ts.map +//// [/home/src/workspaces/project/d.d.ts.map] *new* +{"version":3,"file":"d.d.ts","sourceRoot":"","sources":["d.ts"],"names":[],"mappings":"AAAwB,eAAO,MAAM,CAAC,KAAI,CAAC"} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./a.ts","./b.ts","./c.ts","./d.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"96a22151ab87189568fe787d7ca9a7901c65d3d9789f77588629bfb0c01886c0","signature":"0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff","impliedNodeFormat":1},{"version":"32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c","signature":"ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94","impliedNodeFormat":1},{"version":"35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28","signature":"24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058","impliedNodeFormat":1},{"version":"d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe","signature":"a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5","impliedNodeFormat":1}],"fileIdsList":[[2],[3]],"options":{"composite":true,"declaration":true,"declarationMap":true},"referencedMap":[[4,1],[5,2]],"latestChangedDtsFile":"./d.d.ts"} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./a.ts", + "./b.ts", + "./c.ts", + "./d.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./a.ts", + "version": "96a22151ab87189568fe787d7ca9a7901c65d3d9789f77588629bfb0c01886c0", + "signature": "0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "96a22151ab87189568fe787d7ca9a7901c65d3d9789f77588629bfb0c01886c0", + "signature": "0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./b.ts", + "version": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "signature": "ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "signature": "ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./c.ts", + "version": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "signature": "24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "signature": "24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./d.ts", + "version": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "signature": "a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "signature": "a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5", + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./a.ts" + ], + [ + "./b.ts" + ] + ], + "options": { + "composite": true, + "declaration": true, + "declarationMap": true + }, + "referencedMap": { + "./c.ts": [ + "./a.ts" + ], + "./d.ts": [ + "./b.ts" + ] + }, + "latestChangedDtsFile": "./d.d.ts", + "size": 1127 +} + + +SemanticDiagnostics:: + +Signatures:: + + +Edit:: should re-emit only dts so they dont contain sourcemap + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/a.d.ts] *modified* +export declare const a = 10; + +//// [/home/src/workspaces/project/b.d.ts] *modified* +export declare const b = 10; + +//// [/home/src/workspaces/project/c.d.ts] *modified* +export declare const c = 10; + +//// [/home/src/workspaces/project/d.d.ts] *modified* +export declare const d = 10; + +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./a.ts","./b.ts","./c.ts","./d.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"96a22151ab87189568fe787d7ca9a7901c65d3d9789f77588629bfb0c01886c0","signature":"0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff","impliedNodeFormat":1},{"version":"32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c","signature":"ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94","impliedNodeFormat":1},{"version":"35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28","signature":"24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058","impliedNodeFormat":1},{"version":"d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe","signature":"a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5","impliedNodeFormat":1}],"fileIdsList":[[2],[3]],"options":{"composite":true},"referencedMap":[[4,1],[5,2]],"latestChangedDtsFile":"./d.d.ts"} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./a.ts", + "./b.ts", + "./c.ts", + "./d.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./a.ts", + "version": "96a22151ab87189568fe787d7ca9a7901c65d3d9789f77588629bfb0c01886c0", + "signature": "0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "96a22151ab87189568fe787d7ca9a7901c65d3d9789f77588629bfb0c01886c0", + "signature": "0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./b.ts", + "version": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "signature": "ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "signature": "ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./c.ts", + "version": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "signature": "24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "signature": "24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./d.ts", + "version": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "signature": "a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "signature": "a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5", + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./a.ts" + ], + [ + "./b.ts" + ] + ], + "options": { + "composite": true + }, + "referencedMap": { + "./c.ts": [ + "./a.ts" + ], + "./d.ts": [ + "./b.ts" + ] + }, + "latestChangedDtsFile": "./d.d.ts", + "size": 1086 +} + + +SemanticDiagnostics:: + +Signatures:: + + +Edit:: with emitDeclarationOnly should not emit anything + +ExitStatus:: 0 +Output:: + + +SemanticDiagnostics:: + +Signatures:: + + +Edit:: no change + +ExitStatus:: 0 +Output:: + + +SemanticDiagnostics:: + +Signatures:: + + +Edit:: local change +//// [/home/src/workspaces/project/a.ts] *modified* +export const a = 10;const aLocal = 100; + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/a.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +exports.a = 10; +const aLocal = 100; + +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./a.ts","./b.ts","./c.ts","./d.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cbaad6c0b570d95cb0de11d496cbcd960ddb6152b5de5556b85c9ea4b534aef8","signature":"0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff","impliedNodeFormat":1},{"version":"32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c","signature":"ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94","impliedNodeFormat":1},{"version":"35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28","signature":"24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058","impliedNodeFormat":1},{"version":"d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe","signature":"a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5","impliedNodeFormat":1}],"fileIdsList":[[2],[3]],"options":{"composite":true},"referencedMap":[[4,1],[5,2]],"latestChangedDtsFile":"./d.d.ts"} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./a.ts", + "./b.ts", + "./c.ts", + "./d.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./a.ts", + "version": "cbaad6c0b570d95cb0de11d496cbcd960ddb6152b5de5556b85c9ea4b534aef8", + "signature": "0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "cbaad6c0b570d95cb0de11d496cbcd960ddb6152b5de5556b85c9ea4b534aef8", + "signature": "0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./b.ts", + "version": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "signature": "ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "signature": "ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./c.ts", + "version": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "signature": "24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "signature": "24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./d.ts", + "version": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "signature": "a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "signature": "a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5", + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./a.ts" + ], + [ + "./b.ts" + ] + ], + "options": { + "composite": true + }, + "referencedMap": { + "./c.ts": [ + "./a.ts" + ], + "./d.ts": [ + "./b.ts" + ] + }, + "latestChangedDtsFile": "./d.d.ts", + "size": 1086 +} + + +SemanticDiagnostics:: +*refresh* /home/src/workspaces/project/a.ts + +Signatures:: +(computed .d.ts) /home/src/workspaces/project/a.ts + + +Edit:: with declaration should not emit anything + +ExitStatus:: 0 +Output:: + + +SemanticDiagnostics:: + +Signatures:: + + +Edit:: with inlineSourceMap + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/a.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +exports.a = 10; +const aLocal = 100; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImEudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQWEsUUFBQSxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQUEsTUFBTSxNQUFNLEdBQUcsR0FBRyxDQUFDIn0= +//// [/home/src/workspaces/project/b.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +exports.b = 10; +const bLocal = 10; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQWEsUUFBQSxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQUEsTUFBTSxNQUFNLEdBQUcsRUFBRSxDQUFDIn0= +//// [/home/src/workspaces/project/c.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.c = void 0; +const a_1 = require("./a"); +exports.c = a_1.a; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsMkJBQXdCO0FBQWEsUUFBQSxDQUFDLEdBQUcsS0FBQyxDQUFDIn0= +//// [/home/src/workspaces/project/d.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.d = void 0; +const b_1 = require("./b"); +exports.d = b_1.b; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsMkJBQXdCO0FBQWEsUUFBQSxDQUFDLEdBQUcsS0FBQyxDQUFDIn0= +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./a.ts","./b.ts","./c.ts","./d.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cbaad6c0b570d95cb0de11d496cbcd960ddb6152b5de5556b85c9ea4b534aef8","signature":"0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff","impliedNodeFormat":1},{"version":"32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c","signature":"ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94","impliedNodeFormat":1},{"version":"35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28","signature":"24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058","impliedNodeFormat":1},{"version":"d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe","signature":"a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5","impliedNodeFormat":1}],"fileIdsList":[[2],[3]],"options":{"composite":true,"inlineSourceMap":true},"referencedMap":[[4,1],[5,2]],"latestChangedDtsFile":"./d.d.ts"} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./a.ts", + "./b.ts", + "./c.ts", + "./d.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./a.ts", + "version": "cbaad6c0b570d95cb0de11d496cbcd960ddb6152b5de5556b85c9ea4b534aef8", + "signature": "0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "cbaad6c0b570d95cb0de11d496cbcd960ddb6152b5de5556b85c9ea4b534aef8", + "signature": "0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./b.ts", + "version": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "signature": "ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "signature": "ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./c.ts", + "version": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "signature": "24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "signature": "24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./d.ts", + "version": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "signature": "a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "signature": "a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5", + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./a.ts" + ], + [ + "./b.ts" + ] + ], + "options": { + "composite": true, + "inlineSourceMap": true + }, + "referencedMap": { + "./c.ts": [ + "./a.ts" + ], + "./d.ts": [ + "./b.ts" + ] + }, + "latestChangedDtsFile": "./d.d.ts", + "size": 1109 +} + + +SemanticDiagnostics:: + +Signatures:: + + +Edit:: with sourceMap + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/a.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +exports.a = 10; +const aLocal = 100; +//# sourceMappingURL=a.js.map +//// [/home/src/workspaces/project/a.js.map] *modified* +{"version":3,"file":"a.js","sourceRoot":"","sources":["a.ts"],"names":[],"mappings":";;;AAAa,QAAA,CAAC,GAAG,EAAE,CAAC;AAAA,MAAM,MAAM,GAAG,GAAG,CAAC"} +//// [/home/src/workspaces/project/b.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +exports.b = 10; +const bLocal = 10; +//# sourceMappingURL=b.js.map +//// [/home/src/workspaces/project/b.js.map] *modified time* +//// [/home/src/workspaces/project/c.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.c = void 0; +const a_1 = require("./a"); +exports.c = a_1.a; +//# sourceMappingURL=c.js.map +//// [/home/src/workspaces/project/c.js.map] *modified time* +//// [/home/src/workspaces/project/d.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.d = void 0; +const b_1 = require("./b"); +exports.d = b_1.b; +//# sourceMappingURL=d.js.map +//// [/home/src/workspaces/project/d.js.map] *modified time* +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./a.ts","./b.ts","./c.ts","./d.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cbaad6c0b570d95cb0de11d496cbcd960ddb6152b5de5556b85c9ea4b534aef8","signature":"0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff","impliedNodeFormat":1},{"version":"32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c","signature":"ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94","impliedNodeFormat":1},{"version":"35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28","signature":"24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058","impliedNodeFormat":1},{"version":"d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe","signature":"a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5","impliedNodeFormat":1}],"fileIdsList":[[2],[3]],"options":{"composite":true,"sourceMap":true},"referencedMap":[[4,1],[5,2]],"latestChangedDtsFile":"./d.d.ts"} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./a.ts", + "./b.ts", + "./c.ts", + "./d.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./a.ts", + "version": "cbaad6c0b570d95cb0de11d496cbcd960ddb6152b5de5556b85c9ea4b534aef8", + "signature": "0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "cbaad6c0b570d95cb0de11d496cbcd960ddb6152b5de5556b85c9ea4b534aef8", + "signature": "0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./b.ts", + "version": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "signature": "ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "signature": "ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./c.ts", + "version": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "signature": "24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "signature": "24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./d.ts", + "version": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "signature": "a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "signature": "a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5", + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./a.ts" + ], + [ + "./b.ts" + ] + ], + "options": { + "composite": true, + "sourceMap": true + }, + "referencedMap": { + "./c.ts": [ + "./a.ts" + ], + "./d.ts": [ + "./b.ts" + ] + }, + "latestChangedDtsFile": "./d.d.ts", + "size": 1103 +} + + +SemanticDiagnostics:: + +Signatures:: + + +Edit:: declarationMap enabling +//// [/home/src/workspaces/project/tsconfig.json] *modified* +{ + "compilerOptions": { + "composite": true, "declarationMap": true + } +} + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/a.d.ts] *modified* +export declare const a = 10; +//# sourceMappingURL=a.d.ts.map +//// [/home/src/workspaces/project/a.d.ts.map] *modified time* +//// [/home/src/workspaces/project/a.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +exports.a = 10; +const aLocal = 100; + +//// [/home/src/workspaces/project/b.d.ts] *modified* +export declare const b = 10; +//# sourceMappingURL=b.d.ts.map +//// [/home/src/workspaces/project/b.d.ts.map] *modified time* +//// [/home/src/workspaces/project/b.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +exports.b = 10; +const bLocal = 10; + +//// [/home/src/workspaces/project/c.d.ts] *modified* +export declare const c = 10; +//# sourceMappingURL=c.d.ts.map +//// [/home/src/workspaces/project/c.d.ts.map] *modified time* +//// [/home/src/workspaces/project/c.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.c = void 0; +const a_1 = require("./a"); +exports.c = a_1.a; + +//// [/home/src/workspaces/project/d.d.ts] *modified* +export declare const d = 10; +//# sourceMappingURL=d.d.ts.map +//// [/home/src/workspaces/project/d.d.ts.map] *modified time* +//// [/home/src/workspaces/project/d.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.d = void 0; +const b_1 = require("./b"); +exports.d = b_1.b; + +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./a.ts","./b.ts","./c.ts","./d.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cbaad6c0b570d95cb0de11d496cbcd960ddb6152b5de5556b85c9ea4b534aef8","signature":"0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff","impliedNodeFormat":1},{"version":"32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c","signature":"ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94","impliedNodeFormat":1},{"version":"35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28","signature":"24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058","impliedNodeFormat":1},{"version":"d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe","signature":"a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5","impliedNodeFormat":1}],"fileIdsList":[[2],[3]],"options":{"composite":true,"declarationMap":true},"referencedMap":[[4,1],[5,2]],"latestChangedDtsFile":"./d.d.ts"} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./a.ts", + "./b.ts", + "./c.ts", + "./d.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./a.ts", + "version": "cbaad6c0b570d95cb0de11d496cbcd960ddb6152b5de5556b85c9ea4b534aef8", + "signature": "0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "cbaad6c0b570d95cb0de11d496cbcd960ddb6152b5de5556b85c9ea4b534aef8", + "signature": "0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./b.ts", + "version": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "signature": "ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "signature": "ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./c.ts", + "version": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "signature": "24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "signature": "24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./d.ts", + "version": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "signature": "a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "signature": "a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5", + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./a.ts" + ], + [ + "./b.ts" + ] + ], + "options": { + "composite": true, + "declarationMap": true + }, + "referencedMap": { + "./c.ts": [ + "./a.ts" + ], + "./d.ts": [ + "./b.ts" + ] + }, + "latestChangedDtsFile": "./d.d.ts", + "size": 1108 +} + + +SemanticDiagnostics:: + +Signatures:: + + +Edit:: with sourceMap should not emit d.ts + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/a.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +exports.a = 10; +const aLocal = 100; +//# sourceMappingURL=a.js.map +//// [/home/src/workspaces/project/a.js.map] *modified time* +//// [/home/src/workspaces/project/b.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +exports.b = 10; +const bLocal = 10; +//# sourceMappingURL=b.js.map +//// [/home/src/workspaces/project/b.js.map] *modified time* +//// [/home/src/workspaces/project/c.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.c = void 0; +const a_1 = require("./a"); +exports.c = a_1.a; +//# sourceMappingURL=c.js.map +//// [/home/src/workspaces/project/c.js.map] *modified time* +//// [/home/src/workspaces/project/d.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.d = void 0; +const b_1 = require("./b"); +exports.d = b_1.b; +//# sourceMappingURL=d.js.map +//// [/home/src/workspaces/project/d.js.map] *modified time* +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./a.ts","./b.ts","./c.ts","./d.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cbaad6c0b570d95cb0de11d496cbcd960ddb6152b5de5556b85c9ea4b534aef8","signature":"0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff","impliedNodeFormat":1},{"version":"32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c","signature":"ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94","impliedNodeFormat":1},{"version":"35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28","signature":"24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058","impliedNodeFormat":1},{"version":"d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe","signature":"a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5","impliedNodeFormat":1}],"fileIdsList":[[2],[3]],"options":{"composite":true,"declarationMap":true,"sourceMap":true},"referencedMap":[[4,1],[5,2]],"latestChangedDtsFile":"./d.d.ts"} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./a.ts", + "./b.ts", + "./c.ts", + "./d.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./a.ts", + "version": "cbaad6c0b570d95cb0de11d496cbcd960ddb6152b5de5556b85c9ea4b534aef8", + "signature": "0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "cbaad6c0b570d95cb0de11d496cbcd960ddb6152b5de5556b85c9ea4b534aef8", + "signature": "0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./b.ts", + "version": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "signature": "ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "signature": "ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./c.ts", + "version": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "signature": "24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "signature": "24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./d.ts", + "version": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "signature": "a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "signature": "a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5", + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./a.ts" + ], + [ + "./b.ts" + ] + ], + "options": { + "composite": true, + "declarationMap": true, + "sourceMap": true + }, + "referencedMap": { + "./c.ts": [ + "./a.ts" + ], + "./d.ts": [ + "./b.ts" + ] + }, + "latestChangedDtsFile": "./d.d.ts", + "size": 1125 +} + + +SemanticDiagnostics:: + +Signatures:: diff --git a/testdata/baselines/reference/tsc/incremental/option-changes-with-incremental.js b/testdata/baselines/reference/tsc/incremental/option-changes-with-incremental.js new file mode 100644 index 0000000000..643e3d3c21 --- /dev/null +++ b/testdata/baselines/reference/tsc/incremental/option-changes-with-incremental.js @@ -0,0 +1,1375 @@ + +currentDirectory::/home/src/workspaces/project +useCaseSensitiveFileNames::true +Input:: +//// [/home/src/workspaces/project/a.ts] *new* +export const a = 10;const aLocal = 10; +//// [/home/src/workspaces/project/b.ts] *new* +export const b = 10;const bLocal = 10; +//// [/home/src/workspaces/project/c.ts] *new* +import { a } from "./a";export const c = a; +//// [/home/src/workspaces/project/d.ts] *new* +import { b } from "./b";export const d = b; +//// [/home/src/workspaces/project/tsconfig.json] *new* +{ + "compilerOptions": { + "incremental": true, + } +} + +ExitStatus:: 0 + +CompilerOptions::{} +Output:: +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; +//// [/home/src/workspaces/project/a.js] *new* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +exports.a = 10; +const aLocal = 10; + +//// [/home/src/workspaces/project/b.js] *new* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +exports.b = 10; +const bLocal = 10; + +//// [/home/src/workspaces/project/c.js] *new* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.c = void 0; +const a_1 = require("./a"); +exports.c = a_1.a; + +//// [/home/src/workspaces/project/d.js] *new* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.d = void 0; +const b_1 = require("./b"); +exports.d = b_1.b; + +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *new* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./a.ts","./b.ts","./c.ts","./d.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},"96a22151ab87189568fe787d7ca9a7901c65d3d9789f77588629bfb0c01886c0","32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c","35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28","d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe"],"fileIdsList":[[2],[3]],"referencedMap":[[4,1],[5,2]]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *new* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./a.ts", + "./b.ts", + "./c.ts", + "./d.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./a.ts", + "version": "96a22151ab87189568fe787d7ca9a7901c65d3d9789f77588629bfb0c01886c0", + "signature": "96a22151ab87189568fe787d7ca9a7901c65d3d9789f77588629bfb0c01886c0", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./b.ts", + "version": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "signature": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./c.ts", + "version": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "signature": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./d.ts", + "version": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "signature": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "impliedNodeFormat": "CommonJS" + } + ], + "fileIdsList": [ + [ + "./a.ts" + ], + [ + "./b.ts" + ] + ], + "referencedMap": { + "./c.ts": [ + "./a.ts" + ], + "./d.ts": [ + "./b.ts" + ] + }, + "size": 571 +} + + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/a.ts +*refresh* /home/src/workspaces/project/b.ts +*refresh* /home/src/workspaces/project/c.ts +*refresh* /home/src/workspaces/project/d.ts + +Signatures:: + + +Edit:: with sourceMap + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/a.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +exports.a = 10; +const aLocal = 10; +//# sourceMappingURL=a.js.map +//// [/home/src/workspaces/project/a.js.map] *new* +{"version":3,"file":"a.js","sourceRoot":"","sources":["a.ts"],"names":[],"mappings":";;;AAAa,QAAA,CAAC,GAAG,EAAE,CAAC;AAAA,MAAM,MAAM,GAAG,EAAE,CAAC"} +//// [/home/src/workspaces/project/b.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +exports.b = 10; +const bLocal = 10; +//# sourceMappingURL=b.js.map +//// [/home/src/workspaces/project/b.js.map] *new* +{"version":3,"file":"b.js","sourceRoot":"","sources":["b.ts"],"names":[],"mappings":";;;AAAa,QAAA,CAAC,GAAG,EAAE,CAAC;AAAA,MAAM,MAAM,GAAG,EAAE,CAAC"} +//// [/home/src/workspaces/project/c.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.c = void 0; +const a_1 = require("./a"); +exports.c = a_1.a; +//# sourceMappingURL=c.js.map +//// [/home/src/workspaces/project/c.js.map] *new* +{"version":3,"file":"c.js","sourceRoot":"","sources":["c.ts"],"names":[],"mappings":";;;AAAA,2BAAwB;AAAa,QAAA,CAAC,GAAG,KAAC,CAAC"} +//// [/home/src/workspaces/project/d.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.d = void 0; +const b_1 = require("./b"); +exports.d = b_1.b; +//# sourceMappingURL=d.js.map +//// [/home/src/workspaces/project/d.js.map] *new* +{"version":3,"file":"d.js","sourceRoot":"","sources":["d.ts"],"names":[],"mappings":";;;AAAA,2BAAwB;AAAa,QAAA,CAAC,GAAG,KAAC,CAAC"} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./a.ts","./b.ts","./c.ts","./d.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},"96a22151ab87189568fe787d7ca9a7901c65d3d9789f77588629bfb0c01886c0","32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c","35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28","d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe"],"fileIdsList":[[2],[3]],"options":{"sourceMap":true},"referencedMap":[[4,1],[5,2]]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./a.ts", + "./b.ts", + "./c.ts", + "./d.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./a.ts", + "version": "96a22151ab87189568fe787d7ca9a7901c65d3d9789f77588629bfb0c01886c0", + "signature": "96a22151ab87189568fe787d7ca9a7901c65d3d9789f77588629bfb0c01886c0", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./b.ts", + "version": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "signature": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./c.ts", + "version": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "signature": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./d.ts", + "version": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "signature": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "impliedNodeFormat": "CommonJS" + } + ], + "fileIdsList": [ + [ + "./a.ts" + ], + [ + "./b.ts" + ] + ], + "options": { + "sourceMap": true + }, + "referencedMap": { + "./c.ts": [ + "./a.ts" + ], + "./d.ts": [ + "./b.ts" + ] + }, + "size": 600 +} + + +SemanticDiagnostics:: + +Signatures:: + + +Edit:: should re-emit only js so they dont contain sourcemap + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/a.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +exports.a = 10; +const aLocal = 10; + +//// [/home/src/workspaces/project/b.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +exports.b = 10; +const bLocal = 10; + +//// [/home/src/workspaces/project/c.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.c = void 0; +const a_1 = require("./a"); +exports.c = a_1.a; + +//// [/home/src/workspaces/project/d.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.d = void 0; +const b_1 = require("./b"); +exports.d = b_1.b; + +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./a.ts","./b.ts","./c.ts","./d.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},"96a22151ab87189568fe787d7ca9a7901c65d3d9789f77588629bfb0c01886c0","32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c","35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28","d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe"],"fileIdsList":[[2],[3]],"referencedMap":[[4,1],[5,2]]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./a.ts", + "./b.ts", + "./c.ts", + "./d.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./a.ts", + "version": "96a22151ab87189568fe787d7ca9a7901c65d3d9789f77588629bfb0c01886c0", + "signature": "96a22151ab87189568fe787d7ca9a7901c65d3d9789f77588629bfb0c01886c0", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./b.ts", + "version": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "signature": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./c.ts", + "version": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "signature": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./d.ts", + "version": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "signature": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "impliedNodeFormat": "CommonJS" + } + ], + "fileIdsList": [ + [ + "./a.ts" + ], + [ + "./b.ts" + ] + ], + "referencedMap": { + "./c.ts": [ + "./a.ts" + ], + "./d.ts": [ + "./b.ts" + ] + }, + "size": 571 +} + + +SemanticDiagnostics:: + +Signatures:: + + +Edit:: with declaration, emit Dts and should not emit js + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/a.d.ts] *new* +export declare const a = 10; + +//// [/home/src/workspaces/project/b.d.ts] *new* +export declare const b = 10; + +//// [/home/src/workspaces/project/c.d.ts] *new* +export declare const c = 10; + +//// [/home/src/workspaces/project/d.d.ts] *new* +export declare const d = 10; + +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./a.ts","./b.ts","./c.ts","./d.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"96a22151ab87189568fe787d7ca9a7901c65d3d9789f77588629bfb0c01886c0","signature":"0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff","impliedNodeFormat":1},{"version":"32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c","signature":"ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94","impliedNodeFormat":1},{"version":"35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28","signature":"24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058","impliedNodeFormat":1},{"version":"d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe","signature":"a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5","impliedNodeFormat":1}],"fileIdsList":[[2],[3]],"options":{"declaration":true},"referencedMap":[[4,1],[5,2]]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./a.ts", + "./b.ts", + "./c.ts", + "./d.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./a.ts", + "version": "96a22151ab87189568fe787d7ca9a7901c65d3d9789f77588629bfb0c01886c0", + "signature": "0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "96a22151ab87189568fe787d7ca9a7901c65d3d9789f77588629bfb0c01886c0", + "signature": "0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./b.ts", + "version": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "signature": "ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "signature": "ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./c.ts", + "version": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "signature": "24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "signature": "24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./d.ts", + "version": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "signature": "a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "signature": "a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5", + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./a.ts" + ], + [ + "./b.ts" + ] + ], + "options": { + "declaration": true + }, + "referencedMap": { + "./c.ts": [ + "./a.ts" + ], + "./d.ts": [ + "./b.ts" + ] + }, + "size": 1054 +} + + +SemanticDiagnostics:: + +Signatures:: +(stored at emit) /home/src/workspaces/project/a.ts +(stored at emit) /home/src/workspaces/project/b.ts +(stored at emit) /home/src/workspaces/project/c.ts +(stored at emit) /home/src/workspaces/project/d.ts + + +Edit:: with declaration and declarationMap + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/a.d.ts] *modified* +export declare const a = 10; +//# sourceMappingURL=a.d.ts.map +//// [/home/src/workspaces/project/a.d.ts.map] *new* +{"version":3,"file":"a.d.ts","sourceRoot":"","sources":["a.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,CAAC,KAAK,CAAC"} +//// [/home/src/workspaces/project/b.d.ts] *modified* +export declare const b = 10; +//# sourceMappingURL=b.d.ts.map +//// [/home/src/workspaces/project/b.d.ts.map] *new* +{"version":3,"file":"b.d.ts","sourceRoot":"","sources":["b.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,CAAC,KAAK,CAAC"} +//// [/home/src/workspaces/project/c.d.ts] *modified* +export declare const c = 10; +//# sourceMappingURL=c.d.ts.map +//// [/home/src/workspaces/project/c.d.ts.map] *new* +{"version":3,"file":"c.d.ts","sourceRoot":"","sources":["c.ts"],"names":[],"mappings":"AAAwB,eAAO,MAAM,CAAC,KAAI,CAAC"} +//// [/home/src/workspaces/project/d.d.ts] *modified* +export declare const d = 10; +//# sourceMappingURL=d.d.ts.map +//// [/home/src/workspaces/project/d.d.ts.map] *new* +{"version":3,"file":"d.d.ts","sourceRoot":"","sources":["d.ts"],"names":[],"mappings":"AAAwB,eAAO,MAAM,CAAC,KAAI,CAAC"} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./a.ts","./b.ts","./c.ts","./d.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"96a22151ab87189568fe787d7ca9a7901c65d3d9789f77588629bfb0c01886c0","signature":"0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff","impliedNodeFormat":1},{"version":"32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c","signature":"ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94","impliedNodeFormat":1},{"version":"35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28","signature":"24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058","impliedNodeFormat":1},{"version":"d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe","signature":"a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5","impliedNodeFormat":1}],"fileIdsList":[[2],[3]],"options":{"declaration":true,"declarationMap":true},"referencedMap":[[4,1],[5,2]]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./a.ts", + "./b.ts", + "./c.ts", + "./d.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./a.ts", + "version": "96a22151ab87189568fe787d7ca9a7901c65d3d9789f77588629bfb0c01886c0", + "signature": "0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "96a22151ab87189568fe787d7ca9a7901c65d3d9789f77588629bfb0c01886c0", + "signature": "0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./b.ts", + "version": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "signature": "ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "signature": "ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./c.ts", + "version": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "signature": "24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "signature": "24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./d.ts", + "version": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "signature": "a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "signature": "a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5", + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./a.ts" + ], + [ + "./b.ts" + ] + ], + "options": { + "declaration": true, + "declarationMap": true + }, + "referencedMap": { + "./c.ts": [ + "./a.ts" + ], + "./d.ts": [ + "./b.ts" + ] + }, + "size": 1076 +} + + +SemanticDiagnostics:: + +Signatures:: + + +Edit:: no change + +ExitStatus:: 0 +Output:: + + +SemanticDiagnostics:: + +Signatures:: + + +Edit:: local change +//// [/home/src/workspaces/project/a.ts] *modified* +export const a = 10;const aLocal = 100; + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/a.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +exports.a = 10; +const aLocal = 100; + +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./a.ts","./b.ts","./c.ts","./d.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cbaad6c0b570d95cb0de11d496cbcd960ddb6152b5de5556b85c9ea4b534aef8","signature":"0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff","impliedNodeFormat":1},{"version":"32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c","signature":"ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94","impliedNodeFormat":1},{"version":"35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28","signature":"24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058","impliedNodeFormat":1},{"version":"d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe","signature":"a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5","impliedNodeFormat":1}],"fileIdsList":[[2],[3]],"referencedMap":[[4,1],[5,2]]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./a.ts", + "./b.ts", + "./c.ts", + "./d.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./a.ts", + "version": "cbaad6c0b570d95cb0de11d496cbcd960ddb6152b5de5556b85c9ea4b534aef8", + "signature": "0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "cbaad6c0b570d95cb0de11d496cbcd960ddb6152b5de5556b85c9ea4b534aef8", + "signature": "0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./b.ts", + "version": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "signature": "ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "signature": "ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./c.ts", + "version": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "signature": "24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "signature": "24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./d.ts", + "version": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "signature": "a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "signature": "a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5", + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./a.ts" + ], + [ + "./b.ts" + ] + ], + "referencedMap": { + "./c.ts": [ + "./a.ts" + ], + "./d.ts": [ + "./b.ts" + ] + }, + "size": 1023 +} + + +SemanticDiagnostics:: +*refresh* /home/src/workspaces/project/a.ts + +Signatures:: +(computed .d.ts) /home/src/workspaces/project/a.ts + + +Edit:: with declaration and declarationMap + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/a.d.ts] *modified time* +//// [/home/src/workspaces/project/a.d.ts.map] *modified time* +//// [/home/src/workspaces/project/b.d.ts] *modified time* +//// [/home/src/workspaces/project/b.d.ts.map] *modified time* +//// [/home/src/workspaces/project/c.d.ts] *modified time* +//// [/home/src/workspaces/project/c.d.ts.map] *modified time* +//// [/home/src/workspaces/project/d.d.ts] *modified time* +//// [/home/src/workspaces/project/d.d.ts.map] *modified time* +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./a.ts","./b.ts","./c.ts","./d.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cbaad6c0b570d95cb0de11d496cbcd960ddb6152b5de5556b85c9ea4b534aef8","signature":"0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff","impliedNodeFormat":1},{"version":"32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c","signature":"ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94","impliedNodeFormat":1},{"version":"35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28","signature":"24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058","impliedNodeFormat":1},{"version":"d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe","signature":"a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5","impliedNodeFormat":1}],"fileIdsList":[[2],[3]],"options":{"declaration":true,"declarationMap":true},"referencedMap":[[4,1],[5,2]]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./a.ts", + "./b.ts", + "./c.ts", + "./d.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./a.ts", + "version": "cbaad6c0b570d95cb0de11d496cbcd960ddb6152b5de5556b85c9ea4b534aef8", + "signature": "0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "cbaad6c0b570d95cb0de11d496cbcd960ddb6152b5de5556b85c9ea4b534aef8", + "signature": "0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./b.ts", + "version": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "signature": "ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "signature": "ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./c.ts", + "version": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "signature": "24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "signature": "24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./d.ts", + "version": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "signature": "a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "signature": "a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5", + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./a.ts" + ], + [ + "./b.ts" + ] + ], + "options": { + "declaration": true, + "declarationMap": true + }, + "referencedMap": { + "./c.ts": [ + "./a.ts" + ], + "./d.ts": [ + "./b.ts" + ] + }, + "size": 1076 +} + + +SemanticDiagnostics:: + +Signatures:: + + +Edit:: no change + +ExitStatus:: 0 +Output:: + + +SemanticDiagnostics:: + +Signatures:: + + +Edit:: with inlineSourceMap + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/a.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +exports.a = 10; +const aLocal = 100; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImEudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQWEsUUFBQSxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQUEsTUFBTSxNQUFNLEdBQUcsR0FBRyxDQUFDIn0= +//// [/home/src/workspaces/project/b.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +exports.b = 10; +const bLocal = 10; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQWEsUUFBQSxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQUEsTUFBTSxNQUFNLEdBQUcsRUFBRSxDQUFDIn0= +//// [/home/src/workspaces/project/c.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.c = void 0; +const a_1 = require("./a"); +exports.c = a_1.a; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsMkJBQXdCO0FBQWEsUUFBQSxDQUFDLEdBQUcsS0FBQyxDQUFDIn0= +//// [/home/src/workspaces/project/d.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.d = void 0; +const b_1 = require("./b"); +exports.d = b_1.b; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsMkJBQXdCO0FBQWEsUUFBQSxDQUFDLEdBQUcsS0FBQyxDQUFDIn0= +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./a.ts","./b.ts","./c.ts","./d.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cbaad6c0b570d95cb0de11d496cbcd960ddb6152b5de5556b85c9ea4b534aef8","signature":"0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff","impliedNodeFormat":1},{"version":"32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c","signature":"ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94","impliedNodeFormat":1},{"version":"35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28","signature":"24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058","impliedNodeFormat":1},{"version":"d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe","signature":"a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5","impliedNodeFormat":1}],"fileIdsList":[[2],[3]],"options":{"inlineSourceMap":true},"referencedMap":[[4,1],[5,2]]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./a.ts", + "./b.ts", + "./c.ts", + "./d.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./a.ts", + "version": "cbaad6c0b570d95cb0de11d496cbcd960ddb6152b5de5556b85c9ea4b534aef8", + "signature": "0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "cbaad6c0b570d95cb0de11d496cbcd960ddb6152b5de5556b85c9ea4b534aef8", + "signature": "0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./b.ts", + "version": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "signature": "ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "signature": "ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./c.ts", + "version": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "signature": "24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "signature": "24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./d.ts", + "version": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "signature": "a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "signature": "a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5", + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./a.ts" + ], + [ + "./b.ts" + ] + ], + "options": { + "inlineSourceMap": true + }, + "referencedMap": { + "./c.ts": [ + "./a.ts" + ], + "./d.ts": [ + "./b.ts" + ] + }, + "size": 1058 +} + + +SemanticDiagnostics:: + +Signatures:: + + +Edit:: with sourceMap + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/a.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +exports.a = 10; +const aLocal = 100; +//# sourceMappingURL=a.js.map +//// [/home/src/workspaces/project/a.js.map] *modified* +{"version":3,"file":"a.js","sourceRoot":"","sources":["a.ts"],"names":[],"mappings":";;;AAAa,QAAA,CAAC,GAAG,EAAE,CAAC;AAAA,MAAM,MAAM,GAAG,GAAG,CAAC"} +//// [/home/src/workspaces/project/b.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +exports.b = 10; +const bLocal = 10; +//# sourceMappingURL=b.js.map +//// [/home/src/workspaces/project/b.js.map] *modified time* +//// [/home/src/workspaces/project/c.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.c = void 0; +const a_1 = require("./a"); +exports.c = a_1.a; +//# sourceMappingURL=c.js.map +//// [/home/src/workspaces/project/c.js.map] *modified time* +//// [/home/src/workspaces/project/d.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.d = void 0; +const b_1 = require("./b"); +exports.d = b_1.b; +//# sourceMappingURL=d.js.map +//// [/home/src/workspaces/project/d.js.map] *modified time* +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./a.ts","./b.ts","./c.ts","./d.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cbaad6c0b570d95cb0de11d496cbcd960ddb6152b5de5556b85c9ea4b534aef8","signature":"0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff","impliedNodeFormat":1},{"version":"32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c","signature":"ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94","impliedNodeFormat":1},{"version":"35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28","signature":"24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058","impliedNodeFormat":1},{"version":"d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe","signature":"a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5","impliedNodeFormat":1}],"fileIdsList":[[2],[3]],"options":{"sourceMap":true},"referencedMap":[[4,1],[5,2]]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./a.ts", + "./b.ts", + "./c.ts", + "./d.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./a.ts", + "version": "cbaad6c0b570d95cb0de11d496cbcd960ddb6152b5de5556b85c9ea4b534aef8", + "signature": "0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "cbaad6c0b570d95cb0de11d496cbcd960ddb6152b5de5556b85c9ea4b534aef8", + "signature": "0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./b.ts", + "version": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "signature": "ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "signature": "ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./c.ts", + "version": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "signature": "24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "signature": "24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./d.ts", + "version": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "signature": "a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "signature": "a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5", + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./a.ts" + ], + [ + "./b.ts" + ] + ], + "options": { + "sourceMap": true + }, + "referencedMap": { + "./c.ts": [ + "./a.ts" + ], + "./d.ts": [ + "./b.ts" + ] + }, + "size": 1052 +} + + +SemanticDiagnostics:: + +Signatures:: + + +Edit:: emit js files + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/a.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.a = void 0; +exports.a = 10; +const aLocal = 100; + +//// [/home/src/workspaces/project/b.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.b = void 0; +exports.b = 10; +const bLocal = 10; + +//// [/home/src/workspaces/project/c.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.c = void 0; +const a_1 = require("./a"); +exports.c = a_1.a; + +//// [/home/src/workspaces/project/d.js] *modified* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.d = void 0; +const b_1 = require("./b"); +exports.d = b_1.b; + +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./a.ts","./b.ts","./c.ts","./d.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cbaad6c0b570d95cb0de11d496cbcd960ddb6152b5de5556b85c9ea4b534aef8","signature":"0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff","impliedNodeFormat":1},{"version":"32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c","signature":"ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94","impliedNodeFormat":1},{"version":"35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28","signature":"24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058","impliedNodeFormat":1},{"version":"d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe","signature":"a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5","impliedNodeFormat":1}],"fileIdsList":[[2],[3]],"referencedMap":[[4,1],[5,2]]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./a.ts", + "./b.ts", + "./c.ts", + "./d.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./a.ts", + "version": "cbaad6c0b570d95cb0de11d496cbcd960ddb6152b5de5556b85c9ea4b534aef8", + "signature": "0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "cbaad6c0b570d95cb0de11d496cbcd960ddb6152b5de5556b85c9ea4b534aef8", + "signature": "0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./b.ts", + "version": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "signature": "ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "signature": "ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./c.ts", + "version": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "signature": "24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "signature": "24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./d.ts", + "version": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "signature": "a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "signature": "a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5", + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./a.ts" + ], + [ + "./b.ts" + ] + ], + "referencedMap": { + "./c.ts": [ + "./a.ts" + ], + "./d.ts": [ + "./b.ts" + ] + }, + "size": 1023 +} + + +SemanticDiagnostics:: + +Signatures:: + + +Edit:: with declaration and declarationMap + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/a.d.ts] *modified time* +//// [/home/src/workspaces/project/a.d.ts.map] *modified time* +//// [/home/src/workspaces/project/b.d.ts] *modified time* +//// [/home/src/workspaces/project/b.d.ts.map] *modified time* +//// [/home/src/workspaces/project/c.d.ts] *modified time* +//// [/home/src/workspaces/project/c.d.ts.map] *modified time* +//// [/home/src/workspaces/project/d.d.ts] *modified time* +//// [/home/src/workspaces/project/d.d.ts.map] *modified time* +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./a.ts","./b.ts","./c.ts","./d.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cbaad6c0b570d95cb0de11d496cbcd960ddb6152b5de5556b85c9ea4b534aef8","signature":"0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff","impliedNodeFormat":1},{"version":"32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c","signature":"ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94","impliedNodeFormat":1},{"version":"35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28","signature":"24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058","impliedNodeFormat":1},{"version":"d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe","signature":"a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5","impliedNodeFormat":1}],"fileIdsList":[[2],[3]],"options":{"declaration":true,"declarationMap":true},"referencedMap":[[4,1],[5,2]]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./a.ts", + "./b.ts", + "./c.ts", + "./d.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./a.ts", + "version": "cbaad6c0b570d95cb0de11d496cbcd960ddb6152b5de5556b85c9ea4b534aef8", + "signature": "0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "cbaad6c0b570d95cb0de11d496cbcd960ddb6152b5de5556b85c9ea4b534aef8", + "signature": "0294d0461fc808c98674b1a1a77c26cc9b2958e26ddda58d3e9ee7b806b1d8ff", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./b.ts", + "version": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "signature": "ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "32fe266f005e277f5202e590b14e89cb739c383bde7023723c733cd6ea51078c", + "signature": "ba43aba9e71b3a4d220f005a5c1ec7f11ca438d3f3638626d9f13d0fa36cef94", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./c.ts", + "version": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "signature": "24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "35c02fa2cf84a9292fe046276ac7aaee79b6335851c67de7218b84d604624c28", + "signature": "24f027dec9d58d543081d86b05f3c4eb7b97eaf877bbb857a5091eb542bbd058", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./d.ts", + "version": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "signature": "a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "d7d9eaee18bfcd1d2fe8ea902607b6dc29457bfe9ef7c2f0a86ac101074b64fe", + "signature": "a7d8244d51b9b6a74f3b3e19a8ebe49786ee8736039a7c03ddb43448a17e7bf5", + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./a.ts" + ], + [ + "./b.ts" + ] + ], + "options": { + "declaration": true, + "declarationMap": true + }, + "referencedMap": { + "./c.ts": [ + "./a.ts" + ], + "./d.ts": [ + "./b.ts" + ] + }, + "size": 1076 +} + + +SemanticDiagnostics:: + +Signatures:: + + +Edit:: with declaration and declarationMap, should not re-emit + +ExitStatus:: 0 +Output:: + + +SemanticDiagnostics:: + +Signatures:: diff --git a/testdata/baselines/reference/tsc/incremental/react-jsx-emit-mode-with-no-backing-types-found-doesn't-crash-under---strict.js b/testdata/baselines/reference/tsc/incremental/react-jsx-emit-mode-with-no-backing-types-found-doesn't-crash-under---strict.js new file mode 100644 index 0000000000..25e07e541a --- /dev/null +++ b/testdata/baselines/reference/tsc/incremental/react-jsx-emit-mode-with-no-backing-types-found-doesn't-crash-under---strict.js @@ -0,0 +1,147 @@ + +currentDirectory::/home/src/workspaces/project +useCaseSensitiveFileNames::true +Input::--strict +//// [/home/src/workspaces/project/node_modules/@types/react/index.d.ts] *new* +export {}; +declare global { + namespace JSX { + interface Element {} + interface IntrinsicElements { + div: { + propA?: boolean; + }; + } + } +} +//// [/home/src/workspaces/project/node_modules/react/jsx-runtime.js] *new* +export {} +//// [/home/src/workspaces/project/src/index.tsx] *new* +export const App = () =>
; +//// [/home/src/workspaces/project/tsconfig.json] *new* +{ + "compilerOptions": { + "module": "commonjs", + "jsx": "react-jsx", + "incremental": true, + "jsxImportSource": "react" + } +} + +ExitStatus:: 2 + +CompilerOptions::{ + "strict": true +} +Output:: +src/index.tsx:1:26 - error TS7016: Could not find a declaration file for module 'react/jsx-runtime'. '/home/src/workspaces/project/node_modules/react/jsx-runtime.js' implicitly has an 'any' type. + +1 export const App = () =>
; +   ~~~~~~~~~~~~~~~~~~~~~~~~ + + +Found 1 error in src/index.tsx:1 + +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; +//// [/home/src/workspaces/project/src/index.js] *new* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.App = void 0; +const jsx_runtime_1 = require("react/jsx-runtime"); +const App = () => jsx_runtime_1.jsx("div", { propA: true }); +exports.App = App; + +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *new* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./src/index.tsx","./node_modules/@types/react/index.d.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},"0f825b9ea7708adb1fe25efed7859af428d3ceb0d5df7f67f0a8c9eed854825a",{"version":"3301e1e26bf8906b220ec647394a80968ea8de76669750be485eeb41cf9e8679","affectsGlobalScope":true,"impliedNodeFormat":1}],"options":{"jsx":4,"jsxImportSource":"react","module":1,"strict":true},"semanticDiagnosticsPerFile":[[2,[{"pos":25,"end":49,"code":7016,"category":1,"message":"Could not find a declaration file for module 'react/jsx-runtime'. '/home/src/workspaces/project/node_modules/react/jsx-runtime.js' implicitly has an 'any' type."}]]]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *new* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./src/index.tsx", + "./node_modules/@types/react/index.d.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./src/index.tsx", + "version": "0f825b9ea7708adb1fe25efed7859af428d3ceb0d5df7f67f0a8c9eed854825a", + "signature": "0f825b9ea7708adb1fe25efed7859af428d3ceb0d5df7f67f0a8c9eed854825a", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./node_modules/@types/react/index.d.ts", + "version": "3301e1e26bf8906b220ec647394a80968ea8de76669750be485eeb41cf9e8679", + "signature": "3301e1e26bf8906b220ec647394a80968ea8de76669750be485eeb41cf9e8679", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "3301e1e26bf8906b220ec647394a80968ea8de76669750be485eeb41cf9e8679", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + } + ], + "options": { + "jsx": 4, + "jsxImportSource": "react", + "module": 1, + "strict": true + }, + "semanticDiagnosticsPerFile": [ + [ + "./src/index.tsx", + [ + { + "pos": 25, + "end": 49, + "code": 7016, + "category": 1, + "message": "Could not find a declaration file for module 'react/jsx-runtime'. '/home/src/workspaces/project/node_modules/react/jsx-runtime.js' implicitly has an 'any' type." + } + ] + ] + ], + "size": 792 +} + + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/src/index.tsx +*refresh* /home/src/workspaces/project/node_modules/@types/react/index.d.ts + +Signatures:: diff --git a/testdata/baselines/reference/tsc/incremental/react-jsx-emit-mode-with-no-backing-types-found-doesn't-crash.js b/testdata/baselines/reference/tsc/incremental/react-jsx-emit-mode-with-no-backing-types-found-doesn't-crash.js new file mode 100644 index 0000000000..9d22ecd749 --- /dev/null +++ b/testdata/baselines/reference/tsc/incremental/react-jsx-emit-mode-with-no-backing-types-found-doesn't-crash.js @@ -0,0 +1,122 @@ + +currentDirectory::/home/src/workspaces/project +useCaseSensitiveFileNames::true +Input:: +//// [/home/src/workspaces/project/node_modules/@types/react/index.d.ts] *new* +export {}; +declare global { + namespace JSX { + interface Element {} + interface IntrinsicElements { + div: { + propA?: boolean; + }; + } + } +} +//// [/home/src/workspaces/project/node_modules/react/jsx-runtime.js] *new* +export {} +//// [/home/src/workspaces/project/src/index.tsx] *new* +export const App = () =>
; +//// [/home/src/workspaces/project/tsconfig.json] *new* +{ + "compilerOptions": { + "module": "commonjs", + "jsx": "react-jsx", + "incremental": true, + "jsxImportSource": "react" + } +} + +ExitStatus:: 0 + +CompilerOptions::{} +Output:: +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; +//// [/home/src/workspaces/project/src/index.js] *new* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.App = void 0; +const jsx_runtime_1 = require("react/jsx-runtime"); +const App = () => jsx_runtime_1.jsx("div", { propA: true }); +exports.App = App; + +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *new* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./src/index.tsx","./node_modules/@types/react/index.d.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},"0f825b9ea7708adb1fe25efed7859af428d3ceb0d5df7f67f0a8c9eed854825a",{"version":"3301e1e26bf8906b220ec647394a80968ea8de76669750be485eeb41cf9e8679","affectsGlobalScope":true,"impliedNodeFormat":1}],"options":{"jsx":4,"jsxImportSource":"react","module":1}} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *new* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./src/index.tsx", + "./node_modules/@types/react/index.d.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./src/index.tsx", + "version": "0f825b9ea7708adb1fe25efed7859af428d3ceb0d5df7f67f0a8c9eed854825a", + "signature": "0f825b9ea7708adb1fe25efed7859af428d3ceb0d5df7f67f0a8c9eed854825a", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./node_modules/@types/react/index.d.ts", + "version": "3301e1e26bf8906b220ec647394a80968ea8de76669750be485eeb41cf9e8679", + "signature": "3301e1e26bf8906b220ec647394a80968ea8de76669750be485eeb41cf9e8679", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "3301e1e26bf8906b220ec647394a80968ea8de76669750be485eeb41cf9e8679", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + } + ], + "options": { + "jsx": 4, + "jsxImportSource": "react", + "module": 1 + }, + "size": 523 +} + + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/src/index.tsx +*refresh* /home/src/workspaces/project/node_modules/@types/react/index.d.ts + +Signatures:: diff --git a/testdata/baselines/reference/tsc/incremental/serializing-composite-project.js b/testdata/baselines/reference/tsc/incremental/serializing-composite-project.js index a3ea785352..911fe49f89 100644 --- a/testdata/baselines/reference/tsc/incremental/serializing-composite-project.js +++ b/testdata/baselines/reference/tsc/incremental/serializing-composite-project.js @@ -8,12 +8,12 @@ export const a = 1; export const b = 2; //// [/home/src/workspaces/project/tsconfig.json] *new* { - "compilerOptions": { - "composite": true, - "strict": true, - "module": "esnext", - }, - } + "compilerOptions": { + "composite": true, + "strict": true, + "module": "esnext", + }, +} ExitStatus:: 0 diff --git a/testdata/baselines/reference/tsc/incremental/serializing-error-chain.js b/testdata/baselines/reference/tsc/incremental/serializing-error-chain.js index 13d6fe891b..5edc004713 100644 --- a/testdata/baselines/reference/tsc/incremental/serializing-error-chain.js +++ b/testdata/baselines/reference/tsc/incremental/serializing-error-chain.js @@ -3,49 +3,48 @@ currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true Input:: //// [/home/src/workspaces/project/index.tsx] *new* +declare namespace JSX { + interface ElementChildrenAttribute { children: {}; } + interface IntrinsicElements { div: {} } +} - declare namespace JSX { - interface ElementChildrenAttribute { children: {}; } - interface IntrinsicElements { div: {} } - } - - declare var React: any; +declare var React: any; - declare function Component(props: never): any; - declare function Component(props: { children?: number }): any; - ( -
-
- ) +declare function Component(props: never): any; +declare function Component(props: { children?: number }): any; +( +
+
+) //// [/home/src/workspaces/project/tsconfig.json] *new* { - "compilerOptions": { - "incremental": true, - "strict": true, - "jsx": "react", - "module": "esnext", - }, - } + "compilerOptions": { + "incremental": true, + "strict": true, + "jsx": "react", + "module": "esnext", + }, +} ExitStatus:: 2 CompilerOptions::{} Output:: -index.tsx:11:23 - error TS2769: No overload matches this call. +index.tsx:10:3 - error TS2769: No overload matches this call. The last overload gave the following error. Type '{ children: any[]; }' is not assignable to type '{ children?: number | undefined; }'. Types of property 'children' are incompatible. Type 'any[]' is not assignable to type 'number'. -11 ( -   ~~~~~~~~~ +10 ( +   ~~~~~~~~~ - index.tsx:10:38 - The last overload is declared here. - 10 declare function Component(props: { children?: number }): any; -    ~~~~~~~~~ + index.tsx:9:18 - The last overload is declared here. + 9 declare function Component(props: { children?: number }): any; +    ~~~~~~~~~ -Found 1 error in index.tsx:11 +Found 1 error in index.tsx:10 //// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* /// @@ -74,7 +73,7 @@ declare const console: { log(msg: any): void; }; (React.createElement(Component, null, React.createElement("div", null), React.createElement("div", null))); //// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *new* -{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./index.tsx"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"c7980af975245f04431574a9c187c9abd1c0ba29d83a127ad2af4b952296f935","affectsGlobalScope":true,"impliedNodeFormat":1}],"options":{"jsx":3,"module":99,"strict":true},"semanticDiagnosticsPerFile":[[2,[{"pos":426,"end":435,"code":2769,"category":1,"message":"No overload matches this call.","messageChain":[{"pos":426,"end":435,"code":2770,"category":1,"message":"The last overload gave the following error.","messageChain":[{"pos":426,"end":435,"code":2322,"category":1,"message":"Type '{ children: any[]; }' is not assignable to type '{ children?: number | undefined; }'.","messageChain":[{"pos":426,"end":435,"code":2326,"category":1,"message":"Types of property 'children' are incompatible.","messageChain":[{"pos":426,"end":435,"code":2322,"category":1,"message":"Type 'any[]' is not assignable to type 'number'."}]}]}]}],"relatedInformation":[{"pos":358,"end":367,"code":2771,"category":1,"message":"The last overload is declared here."}]}]]]} +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./index.tsx"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"cbfe2ae7fcc8b0f6fb65b0cfded75399938c02edb19173808c499187b76be6cb","affectsGlobalScope":true,"impliedNodeFormat":1}],"options":{"jsx":3,"module":99,"strict":true},"semanticDiagnosticsPerFile":[[2,[{"pos":265,"end":274,"code":2769,"category":1,"message":"No overload matches this call.","messageChain":[{"pos":265,"end":274,"code":2770,"category":1,"message":"The last overload gave the following error.","messageChain":[{"pos":265,"end":274,"code":2322,"category":1,"message":"Type '{ children: any[]; }' is not assignable to type '{ children?: number | undefined; }'.","messageChain":[{"pos":265,"end":274,"code":2326,"category":1,"message":"Types of property 'children' are incompatible.","messageChain":[{"pos":265,"end":274,"code":2322,"category":1,"message":"Type 'any[]' is not assignable to type 'number'."}]}]}]}],"relatedInformation":[{"pos":217,"end":226,"code":2771,"category":1,"message":"The last overload is declared here."}]}]]]} //// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *new* { "version": "FakeTSVersion", @@ -97,12 +96,12 @@ declare const console: { log(msg: any): void; }; }, { "fileName": "./index.tsx", - "version": "c7980af975245f04431574a9c187c9abd1c0ba29d83a127ad2af4b952296f935", - "signature": "c7980af975245f04431574a9c187c9abd1c0ba29d83a127ad2af4b952296f935", + "version": "cbfe2ae7fcc8b0f6fb65b0cfded75399938c02edb19173808c499187b76be6cb", + "signature": "cbfe2ae7fcc8b0f6fb65b0cfded75399938c02edb19173808c499187b76be6cb", "affectsGlobalScope": true, "impliedNodeFormat": "CommonJS", "original": { - "version": "c7980af975245f04431574a9c187c9abd1c0ba29d83a127ad2af4b952296f935", + "version": "cbfe2ae7fcc8b0f6fb65b0cfded75399938c02edb19173808c499187b76be6cb", "affectsGlobalScope": true, "impliedNodeFormat": 1 } @@ -118,36 +117,36 @@ declare const console: { log(msg: any): void; }; "./index.tsx", [ { - "pos": 426, - "end": 435, + "pos": 265, + "end": 274, "code": 2769, "category": 1, "message": "No overload matches this call.", "messageChain": [ { - "pos": 426, - "end": 435, + "pos": 265, + "end": 274, "code": 2770, "category": 1, "message": "The last overload gave the following error.", "messageChain": [ { - "pos": 426, - "end": 435, + "pos": 265, + "end": 274, "code": 2322, "category": 1, "message": "Type '{ children: any[]; }' is not assignable to type '{ children?: number | undefined; }'.", "messageChain": [ { - "pos": 426, - "end": 435, + "pos": 265, + "end": 274, "code": 2326, "category": 1, "message": "Types of property 'children' are incompatible.", "messageChain": [ { - "pos": 426, - "end": 435, + "pos": 265, + "end": 274, "code": 2322, "category": 1, "message": "Type 'any[]' is not assignable to type 'number'." @@ -161,8 +160,8 @@ declare const console: { log(msg: any): void; }; ], "relatedInformation": [ { - "pos": 358, - "end": 367, + "pos": 217, + "end": 226, "code": 2771, "category": 1, "message": "The last overload is declared here." @@ -187,21 +186,21 @@ Edit:: no change ExitStatus:: 2 Output:: -index.tsx:11:23 - error TS2769: No overload matches this call. +index.tsx:10:3 - error TS2769: No overload matches this call. The last overload gave the following error. Type '{ children: any[]; }' is not assignable to type '{ children?: number | undefined; }'. Types of property 'children' are incompatible. Type 'any[]' is not assignable to type 'number'. -11 ( -   ~~~~~~~~~ +10 ( +   ~~~~~~~~~ - index.tsx:10:38 - The last overload is declared here. - 10 declare function Component(props: { children?: number }): any; -    ~~~~~~~~~ + index.tsx:9:18 - The last overload is declared here. + 9 declare function Component(props: { children?: number }): any; +    ~~~~~~~~~ -Found 1 error in index.tsx:11 +Found 1 error in index.tsx:10 diff --git a/testdata/baselines/reference/tsc/incremental/tsbuildinfo-has-error.js b/testdata/baselines/reference/tsc/incremental/tsbuildinfo-has-error.js new file mode 100644 index 0000000000..7d10786ece --- /dev/null +++ b/testdata/baselines/reference/tsc/incremental/tsbuildinfo-has-error.js @@ -0,0 +1,103 @@ + +currentDirectory::/home/src/workspaces/project +useCaseSensitiveFileNames::true +Input::-i +//// [/home/src/workspaces/project/main.ts] *new* +export const x = 10; +//// [/home/src/workspaces/project/tsconfig.json] *new* +{} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *new* +Some random string + +ExitStatus:: 0 + +CompilerOptions::{ + "incremental": true +} +Output:: +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; +//// [/home/src/workspaces/project/main.js] *new* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +exports.x = 10; + +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./main.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},"03da4d6a46cc7950ba861120c64b47c14bc80b3c64f47ef17b61cb454358afd6"]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *new* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./main.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./main.ts", + "version": "03da4d6a46cc7950ba861120c64b47c14bc80b3c64f47ef17b61cb454358afd6", + "signature": "03da4d6a46cc7950ba861120c64b47c14bc80b3c64f47ef17b61cb454358afd6", + "impliedNodeFormat": "CommonJS" + } + ], + "size": 292 +} + + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/main.ts + +Signatures:: + + +Edit:: tsbuildinfo written has error +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +Some random string{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./main.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},"03da4d6a46cc7950ba861120c64b47c14bc80b3c64f47ef17b61cb454358afd6"]} + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/main.js] *modified time* +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./main.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},"03da4d6a46cc7950ba861120c64b47c14bc80b3c64f47ef17b61cb454358afd6"]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified time* + + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/main.ts + +Signatures:: diff --git a/testdata/baselines/reference/tsc/incremental/when-file-is-deleted.js b/testdata/baselines/reference/tsc/incremental/when-file-is-deleted.js new file mode 100644 index 0000000000..8e2b068e81 --- /dev/null +++ b/testdata/baselines/reference/tsc/incremental/when-file-is-deleted.js @@ -0,0 +1,183 @@ + +currentDirectory::/home/src/workspaces/project +useCaseSensitiveFileNames::true +Input:: +//// [/home/src/workspaces/project/file1.ts] *new* +export class C { } +//// [/home/src/workspaces/project/file2.ts] *new* +export class D { } +//// [/home/src/workspaces/project/tsconfig.json] *new* +{ + "compilerOptions": { + "composite": true, + "outDir": "outDir" + } +} + +ExitStatus:: 0 + +CompilerOptions::{} +Output:: +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; +//// [/home/src/workspaces/project/outDir/file1.d.ts] *new* +export declare class C { +} + +//// [/home/src/workspaces/project/outDir/file1.js] *new* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.C = void 0; +class C { +} +exports.C = C; + +//// [/home/src/workspaces/project/outDir/file2.d.ts] *new* +export declare class D { +} + +//// [/home/src/workspaces/project/outDir/file2.js] *new* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.D = void 0; +class D { +} +exports.D = D; + +//// [/home/src/workspaces/project/outDir/tsconfig.tsbuildinfo] *new* +{"version":"FakeTSVersion","fileNames":["../../../tslibs/TS/Lib/lib.d.ts","../file1.ts","../file2.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"e8197812b523db314f9f43881cab045172bec1a6893c27b62a52b128afbb19da","signature":"33031a47f740dde897da491c7c6ac0ef2224f9c807448ba058aadba8abd00433","impliedNodeFormat":1},{"version":"2d42470676839be6ca4923b34e799e3a318398eb2ff7c6273c676358d80093e6","signature":"f7f62800d2d53e363dcd48e24d95af396e4f0bbafc1713aca098f7644aeb0331","impliedNodeFormat":1}],"options":{"composite":true,"outDir":"./"},"latestChangedDtsFile":"./file2.d.ts"} +//// [/home/src/workspaces/project/outDir/tsconfig.tsbuildinfo.readable.baseline.txt] *new* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../../tslibs/TS/Lib/lib.d.ts", + "../file1.ts", + "../file2.ts" + ], + "fileInfos": [ + { + "fileName": "../../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "../file1.ts", + "version": "e8197812b523db314f9f43881cab045172bec1a6893c27b62a52b128afbb19da", + "signature": "33031a47f740dde897da491c7c6ac0ef2224f9c807448ba058aadba8abd00433", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "e8197812b523db314f9f43881cab045172bec1a6893c27b62a52b128afbb19da", + "signature": "33031a47f740dde897da491c7c6ac0ef2224f9c807448ba058aadba8abd00433", + "impliedNodeFormat": 1 + } + }, + { + "fileName": "../file2.ts", + "version": "2d42470676839be6ca4923b34e799e3a318398eb2ff7c6273c676358d80093e6", + "signature": "f7f62800d2d53e363dcd48e24d95af396e4f0bbafc1713aca098f7644aeb0331", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "2d42470676839be6ca4923b34e799e3a318398eb2ff7c6273c676358d80093e6", + "signature": "f7f62800d2d53e363dcd48e24d95af396e4f0bbafc1713aca098f7644aeb0331", + "impliedNodeFormat": 1 + } + } + ], + "options": { + "composite": true, + "outDir": "./" + }, + "latestChangedDtsFile": "./file2.d.ts", + "size": 685 +} + + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/file1.ts +*refresh* /home/src/workspaces/project/file2.ts + +Signatures:: +(stored at emit) /home/src/workspaces/project/file1.ts +(stored at emit) /home/src/workspaces/project/file2.ts + + +Edit:: delete file with imports +//// [/home/src/workspaces/project/file2.ts] *deleted* + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/outDir/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../../tslibs/TS/Lib/lib.d.ts","../file1.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"e8197812b523db314f9f43881cab045172bec1a6893c27b62a52b128afbb19da","signature":"33031a47f740dde897da491c7c6ac0ef2224f9c807448ba058aadba8abd00433","impliedNodeFormat":1}],"options":{"composite":true,"outDir":"./"},"latestChangedDtsFile":"./file2.d.ts"} +//// [/home/src/workspaces/project/outDir/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../../tslibs/TS/Lib/lib.d.ts", + "../file1.ts" + ], + "fileInfos": [ + { + "fileName": "../../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "../file1.ts", + "version": "e8197812b523db314f9f43881cab045172bec1a6893c27b62a52b128afbb19da", + "signature": "33031a47f740dde897da491c7c6ac0ef2224f9c807448ba058aadba8abd00433", + "impliedNodeFormat": "CommonJS", + "original": { + "version": "e8197812b523db314f9f43881cab045172bec1a6893c27b62a52b128afbb19da", + "signature": "33031a47f740dde897da491c7c6ac0ef2224f9c807448ba058aadba8abd00433", + "impliedNodeFormat": 1 + } + } + ], + "options": { + "composite": true, + "outDir": "./" + }, + "latestChangedDtsFile": "./file2.d.ts", + "size": 491 +} + + +SemanticDiagnostics:: + +Signatures:: diff --git a/testdata/baselines/reference/tsc/incremental/when-global-file-is-added,-the-signatures-are-updated.js b/testdata/baselines/reference/tsc/incremental/when-global-file-is-added,-the-signatures-are-updated.js new file mode 100644 index 0000000000..1831a5edaa --- /dev/null +++ b/testdata/baselines/reference/tsc/incremental/when-global-file-is-added,-the-signatures-are-updated.js @@ -0,0 +1,841 @@ + +currentDirectory::/home/src/workspaces/project +useCaseSensitiveFileNames::true +Input:: +//// [/home/src/workspaces/project/src/anotherFileWithSameReferenes.ts] *new* +/// +/// +function anotherFileWithSameReferenes() { } +//// [/home/src/workspaces/project/src/filePresent.ts] *new* +function something() { return 10; } +//// [/home/src/workspaces/project/src/main.ts] *new* +/// +/// +function main() { } +//// [/home/src/workspaces/project/tsconfig.json] *new* +{ + "compilerOptions": { "composite": true }, + "include": ["src/**/*.ts"], +} + +ExitStatus:: 0 + +CompilerOptions::{} +Output:: +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; +//// [/home/src/workspaces/project/src/anotherFileWithSameReferenes.d.ts] *new* +declare function anotherFileWithSameReferenes(): void; + +//// [/home/src/workspaces/project/src/anotherFileWithSameReferenes.js] *new* +/// +/// +function anotherFileWithSameReferenes() { } + +//// [/home/src/workspaces/project/src/filePresent.d.ts] *new* +declare function something(): number; + +//// [/home/src/workspaces/project/src/filePresent.js] *new* +function something() { return 10; } + +//// [/home/src/workspaces/project/src/main.d.ts] *new* +declare function main(): void; + +//// [/home/src/workspaces/project/src/main.js] *new* +/// +/// +function main() { } + +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *new* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./src/filePresent.ts","./src/anotherFileWithSameReferenes.ts","./src/main.ts","./src/fileNotFound.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8f597c315d3bba69a79551601042fdcfe05d35f763762db4908b255c7f17c7d5","signature":"4f3eeb0c183707d474ecb20d55e49f78d8a3fa3ac388d3b7a318d603ad8478c2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"552b902790cfbb88a7ed6a7b04b24bb18c58a7f52bcfe7808912e126359e258d","signature":"d4dbe375786b0b36d5425a70f140bbb3d377883027d2fa29aa022a2bd446fbda","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"9f4be7f0076e4a80708374aafbed16d8c40107ca5556a6155e1c3b9d2a4bfd1c","signature":"ed4b087ea2a2e4a58647864cf512c7534210bfc2f9d236a2f9ed5245cf7a0896","affectsGlobalScope":true,"impliedNodeFormat":1}],"fileIdsList":[[2,5]],"options":{"composite":true},"referencedMap":[[3,1],[4,1]],"latestChangedDtsFile":"./src/main.d.ts"} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *new* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./src/filePresent.ts", + "./src/anotherFileWithSameReferenes.ts", + "./src/main.ts", + "./src/fileNotFound.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./src/filePresent.ts", + "version": "8f597c315d3bba69a79551601042fdcfe05d35f763762db4908b255c7f17c7d5", + "signature": "4f3eeb0c183707d474ecb20d55e49f78d8a3fa3ac388d3b7a318d603ad8478c2", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "8f597c315d3bba69a79551601042fdcfe05d35f763762db4908b255c7f17c7d5", + "signature": "4f3eeb0c183707d474ecb20d55e49f78d8a3fa3ac388d3b7a318d603ad8478c2", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./src/anotherFileWithSameReferenes.ts", + "version": "552b902790cfbb88a7ed6a7b04b24bb18c58a7f52bcfe7808912e126359e258d", + "signature": "d4dbe375786b0b36d5425a70f140bbb3d377883027d2fa29aa022a2bd446fbda", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "552b902790cfbb88a7ed6a7b04b24bb18c58a7f52bcfe7808912e126359e258d", + "signature": "d4dbe375786b0b36d5425a70f140bbb3d377883027d2fa29aa022a2bd446fbda", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./src/main.ts", + "version": "9f4be7f0076e4a80708374aafbed16d8c40107ca5556a6155e1c3b9d2a4bfd1c", + "signature": "ed4b087ea2a2e4a58647864cf512c7534210bfc2f9d236a2f9ed5245cf7a0896", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "9f4be7f0076e4a80708374aafbed16d8c40107ca5556a6155e1c3b9d2a4bfd1c", + "signature": "ed4b087ea2a2e4a58647864cf512c7534210bfc2f9d236a2f9ed5245cf7a0896", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./src/filePresent.ts", + "./src/fileNotFound.ts" + ] + ], + "options": { + "composite": true + }, + "referencedMap": { + "./src/anotherFileWithSameReferenes.ts": [ + "./src/filePresent.ts", + "./src/fileNotFound.ts" + ], + "./src/main.ts": [ + "./src/filePresent.ts", + "./src/fileNotFound.ts" + ] + }, + "latestChangedDtsFile": "./src/main.d.ts", + "size": 1056 +} + + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/src/filePresent.ts +*refresh* /home/src/workspaces/project/src/anotherFileWithSameReferenes.ts +*refresh* /home/src/workspaces/project/src/main.ts + +Signatures:: +(stored at emit) /home/src/workspaces/project/src/filePresent.ts +(stored at emit) /home/src/workspaces/project/src/anotherFileWithSameReferenes.ts +(stored at emit) /home/src/workspaces/project/src/main.ts + + +Edit:: no change + +ExitStatus:: 0 +Output:: + + +SemanticDiagnostics:: + +Signatures:: + + +Edit:: Modify main file +//// [/home/src/workspaces/project/src/main.ts] *modified* +/// +/// +function main() { }something(); + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/src/main.js] *modified* +/// +/// +function main() { } +something(); + +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./src/filePresent.ts","./src/anotherFileWithSameReferenes.ts","./src/main.ts","./src/fileNotFound.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8f597c315d3bba69a79551601042fdcfe05d35f763762db4908b255c7f17c7d5","signature":"4f3eeb0c183707d474ecb20d55e49f78d8a3fa3ac388d3b7a318d603ad8478c2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"552b902790cfbb88a7ed6a7b04b24bb18c58a7f52bcfe7808912e126359e258d","signature":"d4dbe375786b0b36d5425a70f140bbb3d377883027d2fa29aa022a2bd446fbda","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"958bd60a28f4c68b48b6efabb4498a30aae1c5f7207bbc2ef3e6b639a76075e3","signature":"ed4b087ea2a2e4a58647864cf512c7534210bfc2f9d236a2f9ed5245cf7a0896","affectsGlobalScope":true,"impliedNodeFormat":1}],"fileIdsList":[[2,5]],"options":{"composite":true},"referencedMap":[[3,1],[4,1]],"latestChangedDtsFile":"./src/main.d.ts"} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./src/filePresent.ts", + "./src/anotherFileWithSameReferenes.ts", + "./src/main.ts", + "./src/fileNotFound.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./src/filePresent.ts", + "version": "8f597c315d3bba69a79551601042fdcfe05d35f763762db4908b255c7f17c7d5", + "signature": "4f3eeb0c183707d474ecb20d55e49f78d8a3fa3ac388d3b7a318d603ad8478c2", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "8f597c315d3bba69a79551601042fdcfe05d35f763762db4908b255c7f17c7d5", + "signature": "4f3eeb0c183707d474ecb20d55e49f78d8a3fa3ac388d3b7a318d603ad8478c2", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./src/anotherFileWithSameReferenes.ts", + "version": "552b902790cfbb88a7ed6a7b04b24bb18c58a7f52bcfe7808912e126359e258d", + "signature": "d4dbe375786b0b36d5425a70f140bbb3d377883027d2fa29aa022a2bd446fbda", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "552b902790cfbb88a7ed6a7b04b24bb18c58a7f52bcfe7808912e126359e258d", + "signature": "d4dbe375786b0b36d5425a70f140bbb3d377883027d2fa29aa022a2bd446fbda", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./src/main.ts", + "version": "958bd60a28f4c68b48b6efabb4498a30aae1c5f7207bbc2ef3e6b639a76075e3", + "signature": "ed4b087ea2a2e4a58647864cf512c7534210bfc2f9d236a2f9ed5245cf7a0896", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "958bd60a28f4c68b48b6efabb4498a30aae1c5f7207bbc2ef3e6b639a76075e3", + "signature": "ed4b087ea2a2e4a58647864cf512c7534210bfc2f9d236a2f9ed5245cf7a0896", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./src/filePresent.ts", + "./src/fileNotFound.ts" + ] + ], + "options": { + "composite": true + }, + "referencedMap": { + "./src/anotherFileWithSameReferenes.ts": [ + "./src/filePresent.ts", + "./src/fileNotFound.ts" + ], + "./src/main.ts": [ + "./src/filePresent.ts", + "./src/fileNotFound.ts" + ] + }, + "latestChangedDtsFile": "./src/main.d.ts", + "size": 1056 +} + + +SemanticDiagnostics:: +*refresh* /home/src/workspaces/project/src/main.ts + +Signatures:: +(computed .d.ts) /home/src/workspaces/project/src/main.ts + + +Edit:: Modify main file again +//// [/home/src/workspaces/project/src/main.ts] *modified* +/// +/// +function main() { }something();something(); + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/src/main.js] *modified* +/// +/// +function main() { } +something(); +something(); + +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./src/filePresent.ts","./src/anotherFileWithSameReferenes.ts","./src/main.ts","./src/fileNotFound.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8f597c315d3bba69a79551601042fdcfe05d35f763762db4908b255c7f17c7d5","signature":"4f3eeb0c183707d474ecb20d55e49f78d8a3fa3ac388d3b7a318d603ad8478c2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"552b902790cfbb88a7ed6a7b04b24bb18c58a7f52bcfe7808912e126359e258d","signature":"d4dbe375786b0b36d5425a70f140bbb3d377883027d2fa29aa022a2bd446fbda","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b6d6648dd2368dd226aaed824ed05d767f851bc8c7346baf6478588fc8c53f6d","signature":"ed4b087ea2a2e4a58647864cf512c7534210bfc2f9d236a2f9ed5245cf7a0896","affectsGlobalScope":true,"impliedNodeFormat":1}],"fileIdsList":[[2,5]],"options":{"composite":true},"referencedMap":[[3,1],[4,1]],"latestChangedDtsFile":"./src/main.d.ts"} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./src/filePresent.ts", + "./src/anotherFileWithSameReferenes.ts", + "./src/main.ts", + "./src/fileNotFound.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./src/filePresent.ts", + "version": "8f597c315d3bba69a79551601042fdcfe05d35f763762db4908b255c7f17c7d5", + "signature": "4f3eeb0c183707d474ecb20d55e49f78d8a3fa3ac388d3b7a318d603ad8478c2", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "8f597c315d3bba69a79551601042fdcfe05d35f763762db4908b255c7f17c7d5", + "signature": "4f3eeb0c183707d474ecb20d55e49f78d8a3fa3ac388d3b7a318d603ad8478c2", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./src/anotherFileWithSameReferenes.ts", + "version": "552b902790cfbb88a7ed6a7b04b24bb18c58a7f52bcfe7808912e126359e258d", + "signature": "d4dbe375786b0b36d5425a70f140bbb3d377883027d2fa29aa022a2bd446fbda", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "552b902790cfbb88a7ed6a7b04b24bb18c58a7f52bcfe7808912e126359e258d", + "signature": "d4dbe375786b0b36d5425a70f140bbb3d377883027d2fa29aa022a2bd446fbda", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./src/main.ts", + "version": "b6d6648dd2368dd226aaed824ed05d767f851bc8c7346baf6478588fc8c53f6d", + "signature": "ed4b087ea2a2e4a58647864cf512c7534210bfc2f9d236a2f9ed5245cf7a0896", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "b6d6648dd2368dd226aaed824ed05d767f851bc8c7346baf6478588fc8c53f6d", + "signature": "ed4b087ea2a2e4a58647864cf512c7534210bfc2f9d236a2f9ed5245cf7a0896", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./src/filePresent.ts", + "./src/fileNotFound.ts" + ] + ], + "options": { + "composite": true + }, + "referencedMap": { + "./src/anotherFileWithSameReferenes.ts": [ + "./src/filePresent.ts", + "./src/fileNotFound.ts" + ], + "./src/main.ts": [ + "./src/filePresent.ts", + "./src/fileNotFound.ts" + ] + }, + "latestChangedDtsFile": "./src/main.d.ts", + "size": 1056 +} + + +SemanticDiagnostics:: +*refresh* /home/src/workspaces/project/src/main.ts + +Signatures:: +(computed .d.ts) /home/src/workspaces/project/src/main.ts + + +Edit:: Add new file and update main file +//// [/home/src/workspaces/project/src/main.ts] *modified* +/// +/// +/// +function main() { }something();something();foo(); +//// [/home/src/workspaces/project/src/newFile.ts] *new* +function foo() { return 20; } + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/src/main.js] *modified* +/// +/// +/// +function main() { } +something(); +something(); +foo(); + +//// [/home/src/workspaces/project/src/newFile.d.ts] *new* +declare function foo(): number; + +//// [/home/src/workspaces/project/src/newFile.js] *new* +function foo() { return 20; } + +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./src/filePresent.ts","./src/anotherFileWithSameReferenes.ts","./src/newFile.ts","./src/main.ts","./src/fileNotFound.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8f597c315d3bba69a79551601042fdcfe05d35f763762db4908b255c7f17c7d5","signature":"4f3eeb0c183707d474ecb20d55e49f78d8a3fa3ac388d3b7a318d603ad8478c2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"552b902790cfbb88a7ed6a7b04b24bb18c58a7f52bcfe7808912e126359e258d","signature":"d4dbe375786b0b36d5425a70f140bbb3d377883027d2fa29aa022a2bd446fbda","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a4c88e3619994da0f5e4da2dc210f6038e710b9bb831003767da68c882137fb1","signature":"f0d67d5e01f8fff5f52028627fc0fb5a78b24df03e482ddac513fa1f873934ee","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"930f3c7023d87506648db3c352e86f7a2baf38e91f743773fddf4a520aff393a","signature":"ed4b087ea2a2e4a58647864cf512c7534210bfc2f9d236a2f9ed5245cf7a0896","affectsGlobalScope":true,"impliedNodeFormat":1}],"fileIdsList":[[2,6],[2,4,6]],"options":{"composite":true},"referencedMap":[[3,1],[5,2]],"latestChangedDtsFile":"./src/newFile.d.ts"} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./src/filePresent.ts", + "./src/anotherFileWithSameReferenes.ts", + "./src/newFile.ts", + "./src/main.ts", + "./src/fileNotFound.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./src/filePresent.ts", + "version": "8f597c315d3bba69a79551601042fdcfe05d35f763762db4908b255c7f17c7d5", + "signature": "4f3eeb0c183707d474ecb20d55e49f78d8a3fa3ac388d3b7a318d603ad8478c2", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "8f597c315d3bba69a79551601042fdcfe05d35f763762db4908b255c7f17c7d5", + "signature": "4f3eeb0c183707d474ecb20d55e49f78d8a3fa3ac388d3b7a318d603ad8478c2", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./src/anotherFileWithSameReferenes.ts", + "version": "552b902790cfbb88a7ed6a7b04b24bb18c58a7f52bcfe7808912e126359e258d", + "signature": "d4dbe375786b0b36d5425a70f140bbb3d377883027d2fa29aa022a2bd446fbda", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "552b902790cfbb88a7ed6a7b04b24bb18c58a7f52bcfe7808912e126359e258d", + "signature": "d4dbe375786b0b36d5425a70f140bbb3d377883027d2fa29aa022a2bd446fbda", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./src/newFile.ts", + "version": "a4c88e3619994da0f5e4da2dc210f6038e710b9bb831003767da68c882137fb1", + "signature": "f0d67d5e01f8fff5f52028627fc0fb5a78b24df03e482ddac513fa1f873934ee", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "a4c88e3619994da0f5e4da2dc210f6038e710b9bb831003767da68c882137fb1", + "signature": "f0d67d5e01f8fff5f52028627fc0fb5a78b24df03e482ddac513fa1f873934ee", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./src/main.ts", + "version": "930f3c7023d87506648db3c352e86f7a2baf38e91f743773fddf4a520aff393a", + "signature": "ed4b087ea2a2e4a58647864cf512c7534210bfc2f9d236a2f9ed5245cf7a0896", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "930f3c7023d87506648db3c352e86f7a2baf38e91f743773fddf4a520aff393a", + "signature": "ed4b087ea2a2e4a58647864cf512c7534210bfc2f9d236a2f9ed5245cf7a0896", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./src/filePresent.ts", + "./src/fileNotFound.ts" + ], + [ + "./src/filePresent.ts", + "./src/newFile.ts", + "./src/fileNotFound.ts" + ] + ], + "options": { + "composite": true + }, + "referencedMap": { + "./src/anotherFileWithSameReferenes.ts": [ + "./src/filePresent.ts", + "./src/fileNotFound.ts" + ], + "./src/main.ts": [ + "./src/filePresent.ts", + "./src/newFile.ts", + "./src/fileNotFound.ts" + ] + }, + "latestChangedDtsFile": "./src/newFile.d.ts", + "size": 1292 +} + + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/src/newFile.ts +*refresh* /home/src/workspaces/project/src/main.ts + +Signatures:: +(computed .d.ts) /home/src/workspaces/project/src/newFile.ts +(computed .d.ts) /home/src/workspaces/project/src/main.ts + + +Edit:: Write file that could not be resolved +//// [/home/src/workspaces/project/src/fileNotFound.ts] *new* +function something2() { return 20; } + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/src/anotherFileWithSameReferenes.js] *modified time* +//// [/home/src/workspaces/project/src/fileNotFound.d.ts] *new* +declare function something2(): number; + +//// [/home/src/workspaces/project/src/fileNotFound.js] *new* +function something2() { return 20; } + +//// [/home/src/workspaces/project/src/main.js] *modified time* +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./src/filePresent.ts","./src/fileNotFound.ts","./src/anotherFileWithSameReferenes.ts","./src/newFile.ts","./src/main.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8f597c315d3bba69a79551601042fdcfe05d35f763762db4908b255c7f17c7d5","signature":"4f3eeb0c183707d474ecb20d55e49f78d8a3fa3ac388d3b7a318d603ad8478c2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6c5b229cbf53b2c6867ab14b139eeac37ed3ec0c1564ba561f7faa869aaba32c","signature":"14ba6a62cd6d3e47b343358b2c3e1b7e34b488b489f0d9b915c796cd2e61bbad","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"552b902790cfbb88a7ed6a7b04b24bb18c58a7f52bcfe7808912e126359e258d","signature":"d4dbe375786b0b36d5425a70f140bbb3d377883027d2fa29aa022a2bd446fbda","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a4c88e3619994da0f5e4da2dc210f6038e710b9bb831003767da68c882137fb1","signature":"f0d67d5e01f8fff5f52028627fc0fb5a78b24df03e482ddac513fa1f873934ee","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"930f3c7023d87506648db3c352e86f7a2baf38e91f743773fddf4a520aff393a","signature":"ed4b087ea2a2e4a58647864cf512c7534210bfc2f9d236a2f9ed5245cf7a0896","affectsGlobalScope":true,"impliedNodeFormat":1}],"fileIdsList":[[2,3],[2,3,5]],"options":{"composite":true},"referencedMap":[[4,1],[6,2]],"latestChangedDtsFile":"./src/fileNotFound.d.ts"} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./src/filePresent.ts", + "./src/fileNotFound.ts", + "./src/anotherFileWithSameReferenes.ts", + "./src/newFile.ts", + "./src/main.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./src/filePresent.ts", + "version": "8f597c315d3bba69a79551601042fdcfe05d35f763762db4908b255c7f17c7d5", + "signature": "4f3eeb0c183707d474ecb20d55e49f78d8a3fa3ac388d3b7a318d603ad8478c2", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "8f597c315d3bba69a79551601042fdcfe05d35f763762db4908b255c7f17c7d5", + "signature": "4f3eeb0c183707d474ecb20d55e49f78d8a3fa3ac388d3b7a318d603ad8478c2", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./src/fileNotFound.ts", + "version": "6c5b229cbf53b2c6867ab14b139eeac37ed3ec0c1564ba561f7faa869aaba32c", + "signature": "14ba6a62cd6d3e47b343358b2c3e1b7e34b488b489f0d9b915c796cd2e61bbad", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "6c5b229cbf53b2c6867ab14b139eeac37ed3ec0c1564ba561f7faa869aaba32c", + "signature": "14ba6a62cd6d3e47b343358b2c3e1b7e34b488b489f0d9b915c796cd2e61bbad", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./src/anotherFileWithSameReferenes.ts", + "version": "552b902790cfbb88a7ed6a7b04b24bb18c58a7f52bcfe7808912e126359e258d", + "signature": "d4dbe375786b0b36d5425a70f140bbb3d377883027d2fa29aa022a2bd446fbda", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "552b902790cfbb88a7ed6a7b04b24bb18c58a7f52bcfe7808912e126359e258d", + "signature": "d4dbe375786b0b36d5425a70f140bbb3d377883027d2fa29aa022a2bd446fbda", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./src/newFile.ts", + "version": "a4c88e3619994da0f5e4da2dc210f6038e710b9bb831003767da68c882137fb1", + "signature": "f0d67d5e01f8fff5f52028627fc0fb5a78b24df03e482ddac513fa1f873934ee", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "a4c88e3619994da0f5e4da2dc210f6038e710b9bb831003767da68c882137fb1", + "signature": "f0d67d5e01f8fff5f52028627fc0fb5a78b24df03e482ddac513fa1f873934ee", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./src/main.ts", + "version": "930f3c7023d87506648db3c352e86f7a2baf38e91f743773fddf4a520aff393a", + "signature": "ed4b087ea2a2e4a58647864cf512c7534210bfc2f9d236a2f9ed5245cf7a0896", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "930f3c7023d87506648db3c352e86f7a2baf38e91f743773fddf4a520aff393a", + "signature": "ed4b087ea2a2e4a58647864cf512c7534210bfc2f9d236a2f9ed5245cf7a0896", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./src/filePresent.ts", + "./src/fileNotFound.ts" + ], + [ + "./src/filePresent.ts", + "./src/fileNotFound.ts", + "./src/newFile.ts" + ] + ], + "options": { + "composite": true + }, + "referencedMap": { + "./src/anotherFileWithSameReferenes.ts": [ + "./src/filePresent.ts", + "./src/fileNotFound.ts" + ], + "./src/main.ts": [ + "./src/filePresent.ts", + "./src/fileNotFound.ts", + "./src/newFile.ts" + ] + }, + "latestChangedDtsFile": "./src/fileNotFound.d.ts", + "size": 1503 +} + + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/src/fileNotFound.ts +*refresh* /home/src/workspaces/project/src/anotherFileWithSameReferenes.ts +*refresh* /home/src/workspaces/project/src/main.ts + +Signatures:: +(computed .d.ts) /home/src/workspaces/project/src/fileNotFound.ts +(computed .d.ts) /home/src/workspaces/project/src/anotherFileWithSameReferenes.ts +(computed .d.ts) /home/src/workspaces/project/src/main.ts + + +Edit:: Modify main file +//// [/home/src/workspaces/project/src/main.ts] *modified* +/// +/// +/// +function main() { }something();something();foo();something(); + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/src/main.js] *modified* +/// +/// +/// +function main() { } +something(); +something(); +foo(); +something(); + +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./src/filePresent.ts","./src/fileNotFound.ts","./src/anotherFileWithSameReferenes.ts","./src/newFile.ts","./src/main.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8f597c315d3bba69a79551601042fdcfe05d35f763762db4908b255c7f17c7d5","signature":"4f3eeb0c183707d474ecb20d55e49f78d8a3fa3ac388d3b7a318d603ad8478c2","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6c5b229cbf53b2c6867ab14b139eeac37ed3ec0c1564ba561f7faa869aaba32c","signature":"14ba6a62cd6d3e47b343358b2c3e1b7e34b488b489f0d9b915c796cd2e61bbad","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"552b902790cfbb88a7ed6a7b04b24bb18c58a7f52bcfe7808912e126359e258d","signature":"d4dbe375786b0b36d5425a70f140bbb3d377883027d2fa29aa022a2bd446fbda","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a4c88e3619994da0f5e4da2dc210f6038e710b9bb831003767da68c882137fb1","signature":"f0d67d5e01f8fff5f52028627fc0fb5a78b24df03e482ddac513fa1f873934ee","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a8ae65557452d18998812e950c84bacd81f817ef323ccfe777c3b5450519c167","signature":"ed4b087ea2a2e4a58647864cf512c7534210bfc2f9d236a2f9ed5245cf7a0896","affectsGlobalScope":true,"impliedNodeFormat":1}],"fileIdsList":[[2,3],[2,3,5]],"options":{"composite":true},"referencedMap":[[4,1],[6,2]],"latestChangedDtsFile":"./src/fileNotFound.d.ts"} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./src/filePresent.ts", + "./src/fileNotFound.ts", + "./src/anotherFileWithSameReferenes.ts", + "./src/newFile.ts", + "./src/main.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./src/filePresent.ts", + "version": "8f597c315d3bba69a79551601042fdcfe05d35f763762db4908b255c7f17c7d5", + "signature": "4f3eeb0c183707d474ecb20d55e49f78d8a3fa3ac388d3b7a318d603ad8478c2", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "8f597c315d3bba69a79551601042fdcfe05d35f763762db4908b255c7f17c7d5", + "signature": "4f3eeb0c183707d474ecb20d55e49f78d8a3fa3ac388d3b7a318d603ad8478c2", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./src/fileNotFound.ts", + "version": "6c5b229cbf53b2c6867ab14b139eeac37ed3ec0c1564ba561f7faa869aaba32c", + "signature": "14ba6a62cd6d3e47b343358b2c3e1b7e34b488b489f0d9b915c796cd2e61bbad", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "6c5b229cbf53b2c6867ab14b139eeac37ed3ec0c1564ba561f7faa869aaba32c", + "signature": "14ba6a62cd6d3e47b343358b2c3e1b7e34b488b489f0d9b915c796cd2e61bbad", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./src/anotherFileWithSameReferenes.ts", + "version": "552b902790cfbb88a7ed6a7b04b24bb18c58a7f52bcfe7808912e126359e258d", + "signature": "d4dbe375786b0b36d5425a70f140bbb3d377883027d2fa29aa022a2bd446fbda", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "552b902790cfbb88a7ed6a7b04b24bb18c58a7f52bcfe7808912e126359e258d", + "signature": "d4dbe375786b0b36d5425a70f140bbb3d377883027d2fa29aa022a2bd446fbda", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./src/newFile.ts", + "version": "a4c88e3619994da0f5e4da2dc210f6038e710b9bb831003767da68c882137fb1", + "signature": "f0d67d5e01f8fff5f52028627fc0fb5a78b24df03e482ddac513fa1f873934ee", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "a4c88e3619994da0f5e4da2dc210f6038e710b9bb831003767da68c882137fb1", + "signature": "f0d67d5e01f8fff5f52028627fc0fb5a78b24df03e482ddac513fa1f873934ee", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./src/main.ts", + "version": "a8ae65557452d18998812e950c84bacd81f817ef323ccfe777c3b5450519c167", + "signature": "ed4b087ea2a2e4a58647864cf512c7534210bfc2f9d236a2f9ed5245cf7a0896", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "a8ae65557452d18998812e950c84bacd81f817ef323ccfe777c3b5450519c167", + "signature": "ed4b087ea2a2e4a58647864cf512c7534210bfc2f9d236a2f9ed5245cf7a0896", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + } + ], + "fileIdsList": [ + [ + "./src/filePresent.ts", + "./src/fileNotFound.ts" + ], + [ + "./src/filePresent.ts", + "./src/fileNotFound.ts", + "./src/newFile.ts" + ] + ], + "options": { + "composite": true + }, + "referencedMap": { + "./src/anotherFileWithSameReferenes.ts": [ + "./src/filePresent.ts", + "./src/fileNotFound.ts" + ], + "./src/main.ts": [ + "./src/filePresent.ts", + "./src/fileNotFound.ts", + "./src/newFile.ts" + ] + }, + "latestChangedDtsFile": "./src/fileNotFound.d.ts", + "size": 1503 +} + + +SemanticDiagnostics:: +*refresh* /home/src/workspaces/project/src/main.ts + +Signatures:: +(computed .d.ts) /home/src/workspaces/project/src/main.ts diff --git a/testdata/baselines/reference/tsc/incremental/when-passing-filename-for-buildinfo-on-commandline.js b/testdata/baselines/reference/tsc/incremental/when-passing-filename-for-buildinfo-on-commandline.js new file mode 100644 index 0000000000..f3c6d2af93 --- /dev/null +++ b/testdata/baselines/reference/tsc/incremental/when-passing-filename-for-buildinfo-on-commandline.js @@ -0,0 +1,108 @@ + +currentDirectory::/home/src/workspaces/project +useCaseSensitiveFileNames::true +Input::--incremental --tsBuildInfoFile .tsbuildinfo --explainFiles +//// [/home/src/workspaces/project/src/main.ts] *new* +export const x = 10; +//// [/home/src/workspaces/project/tsconfig.json] *new* +{ + "compilerOptions": { + "target": "es5", + "module": "commonjs" + }, + "include": [ + "src/**/*.ts" + ], +} + +ExitStatus:: 0 + +CompilerOptions::{ + "incremental": true, + "tsBuildInfoFile": "/home/src/workspaces/project/.tsbuildinfo", + "explainFiles": true +} +Output:: +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; +//// [/home/src/workspaces/project/.tsbuildinfo] *new* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./src/main.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},"03da4d6a46cc7950ba861120c64b47c14bc80b3c64f47ef17b61cb454358afd6"],"options":{"module":1,"target":1,"tsBuildInfoFile":"./.tsbuildinfo"}} +//// [/home/src/workspaces/project/.tsbuildinfo.readable.baseline.txt] *new* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./src/main.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./src/main.ts", + "version": "03da4d6a46cc7950ba861120c64b47c14bc80b3c64f47ef17b61cb454358afd6", + "signature": "03da4d6a46cc7950ba861120c64b47c14bc80b3c64f47ef17b61cb454358afd6", + "impliedNodeFormat": "CommonJS" + } + ], + "options": { + "module": 1, + "target": 1, + "tsBuildInfoFile": "./.tsbuildinfo" + }, + "size": 365 +} +//// [/home/src/workspaces/project/src/main.js] *new* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +exports.x = 10; + + + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/src/main.ts + +Signatures:: + + +Edit:: no change + +ExitStatus:: 0 +Output:: + + +SemanticDiagnostics:: + +Signatures:: diff --git a/testdata/baselines/reference/tsc/incremental/when-passing-rootDir-from-commandline.js b/testdata/baselines/reference/tsc/incremental/when-passing-rootDir-from-commandline.js new file mode 100644 index 0000000000..3a6c5629cc --- /dev/null +++ b/testdata/baselines/reference/tsc/incremental/when-passing-rootDir-from-commandline.js @@ -0,0 +1,102 @@ + +currentDirectory::/home/src/workspaces/project +useCaseSensitiveFileNames::true +Input::--rootDir src +//// [/home/src/workspaces/project/src/main.ts] *new* +export const x = 10; +//// [/home/src/workspaces/project/tsconfig.json] *new* +{ + "compilerOptions": { + "incremental": true, + "outDir": "dist" + } +} + +ExitStatus:: 0 + +CompilerOptions::{ + "rootDir": "/home/src/workspaces/project/src" +} +Output:: +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; +//// [/home/src/workspaces/project/dist/main.js] *new* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +exports.x = 10; + +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *new* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./src/main.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},"03da4d6a46cc7950ba861120c64b47c14bc80b3c64f47ef17b61cb454358afd6"],"options":{"outDir":"./dist","rootDir":"./src"}} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *new* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./src/main.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./src/main.ts", + "version": "03da4d6a46cc7950ba861120c64b47c14bc80b3c64f47ef17b61cb454358afd6", + "signature": "03da4d6a46cc7950ba861120c64b47c14bc80b3c64f47ef17b61cb454358afd6", + "impliedNodeFormat": "CommonJS" + } + ], + "options": { + "outDir": "./dist", + "rootDir": "./src" + }, + "size": 344 +} + + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/src/main.ts + +Signatures:: + + +Edit:: no change + +ExitStatus:: 0 +Output:: + + +SemanticDiagnostics:: + +Signatures:: diff --git a/testdata/baselines/reference/tsc/incremental/when-passing-rootDir-is-in-the-tsconfig.js b/testdata/baselines/reference/tsc/incremental/when-passing-rootDir-is-in-the-tsconfig.js new file mode 100644 index 0000000000..7fbbfcbfc6 --- /dev/null +++ b/testdata/baselines/reference/tsc/incremental/when-passing-rootDir-is-in-the-tsconfig.js @@ -0,0 +1,101 @@ + +currentDirectory::/home/src/workspaces/project +useCaseSensitiveFileNames::true +Input:: +//// [/home/src/workspaces/project/src/main.ts] *new* +export const x = 10; +//// [/home/src/workspaces/project/tsconfig.json] *new* +{ + "compilerOptions": { + "incremental": true, + "outDir": "dist", + "rootDir": "./" + } +} + +ExitStatus:: 0 + +CompilerOptions::{} +Output:: +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; +//// [/home/src/workspaces/project/dist/src/main.js] *new* +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +exports.x = 10; + +//// [/home/src/workspaces/project/dist/tsconfig.tsbuildinfo] *new* +{"version":"FakeTSVersion","fileNames":["../../../tslibs/TS/Lib/lib.d.ts","../src/main.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},"03da4d6a46cc7950ba861120c64b47c14bc80b3c64f47ef17b61cb454358afd6"],"options":{"outDir":"./","rootDir":".."}} +//// [/home/src/workspaces/project/dist/tsconfig.tsbuildinfo.readable.baseline.txt] *new* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../../tslibs/TS/Lib/lib.d.ts", + "../src/main.ts" + ], + "fileInfos": [ + { + "fileName": "../../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "../src/main.ts", + "version": "03da4d6a46cc7950ba861120c64b47c14bc80b3c64f47ef17b61cb454358afd6", + "signature": "03da4d6a46cc7950ba861120c64b47c14bc80b3c64f47ef17b61cb454358afd6", + "impliedNodeFormat": "CommonJS" + } + ], + "options": { + "outDir": "./", + "rootDir": ".." + }, + "size": 341 +} + + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/src/main.ts + +Signatures:: + + +Edit:: no change + +ExitStatus:: 0 +Output:: + + +SemanticDiagnostics:: + +Signatures:: diff --git a/testdata/baselines/reference/tsc/incremental/with-only-dts-files.js b/testdata/baselines/reference/tsc/incremental/with-only-dts-files.js new file mode 100644 index 0000000000..37fffb174e --- /dev/null +++ b/testdata/baselines/reference/tsc/incremental/with-only-dts-files.js @@ -0,0 +1,150 @@ + +currentDirectory::/home/src/workspaces/project +useCaseSensitiveFileNames::true +Input::--incremental +//// [/home/src/workspaces/project/src/another.d.ts] *new* +export const y = 10; +//// [/home/src/workspaces/project/src/main.d.ts] *new* +export const x = 10; +//// [/home/src/workspaces/project/tsconfig.json] *new* +{} + +ExitStatus:: 0 + +CompilerOptions::{ + "incremental": true +} +Output:: +//// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } +interface ReadonlyArray {} +interface SymbolConstructor { + (desc?: string | number): symbol; + for(name: string): symbol; + readonly toStringTag: symbol; +} +declare var Symbol: SymbolConstructor; +interface Symbol { + readonly [Symbol.toStringTag]: string; +} +declare const console: { log(msg: any): void; }; +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *new* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./src/another.d.ts","./src/main.d.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},"4aa16e9a67a4820d1dc51507221b4c73b5626b3a759d79d7147ad4eabe37ef49","03da4d6a46cc7950ba861120c64b47c14bc80b3c64f47ef17b61cb454358afd6"]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *new* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./src/another.d.ts", + "./src/main.d.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./src/another.d.ts", + "version": "4aa16e9a67a4820d1dc51507221b4c73b5626b3a759d79d7147ad4eabe37ef49", + "signature": "4aa16e9a67a4820d1dc51507221b4c73b5626b3a759d79d7147ad4eabe37ef49", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./src/main.d.ts", + "version": "03da4d6a46cc7950ba861120c64b47c14bc80b3c64f47ef17b61cb454358afd6", + "signature": "03da4d6a46cc7950ba861120c64b47c14bc80b3c64f47ef17b61cb454358afd6", + "impliedNodeFormat": "CommonJS" + } + ], + "size": 386 +} + + +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/src/another.d.ts +*refresh* /home/src/workspaces/project/src/main.d.ts + +Signatures:: + + +Edit:: no change + +ExitStatus:: 0 +Output:: + + +SemanticDiagnostics:: + +Signatures:: + + +Edit:: modify d.ts file +//// [/home/src/workspaces/project/src/main.d.ts] *modified* +export const x = 10;export const xy = 100; + +ExitStatus:: 0 +Output:: +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* +{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./src/another.d.ts","./src/main.d.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},"4aa16e9a67a4820d1dc51507221b4c73b5626b3a759d79d7147ad4eabe37ef49","a701af2196ad5afd5fe2fb1f6c1c9ad538b85b9e4c37d747738ecc7f5d609540"]} +//// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified* +{ + "version": "FakeTSVersion", + "fileNames": [ + "../../tslibs/TS/Lib/lib.d.ts", + "./src/another.d.ts", + "./src/main.d.ts" + ], + "fileInfos": [ + { + "fileName": "../../tslibs/TS/Lib/lib.d.ts", + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "signature": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": "CommonJS", + "original": { + "version": "7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e", + "affectsGlobalScope": true, + "impliedNodeFormat": 1 + } + }, + { + "fileName": "./src/another.d.ts", + "version": "4aa16e9a67a4820d1dc51507221b4c73b5626b3a759d79d7147ad4eabe37ef49", + "signature": "4aa16e9a67a4820d1dc51507221b4c73b5626b3a759d79d7147ad4eabe37ef49", + "impliedNodeFormat": "CommonJS" + }, + { + "fileName": "./src/main.d.ts", + "version": "a701af2196ad5afd5fe2fb1f6c1c9ad538b85b9e4c37d747738ecc7f5d609540", + "signature": "a701af2196ad5afd5fe2fb1f6c1c9ad538b85b9e4c37d747738ecc7f5d609540", + "impliedNodeFormat": "CommonJS" + } + ], + "size": 386 +} + + +SemanticDiagnostics:: +*refresh* /home/src/workspaces/project/src/main.d.ts + +Signatures:: +(used version) /home/src/workspaces/project/src/main.d.ts diff --git a/testdata/baselines/reference/tsc/noCheck/dts-errors.js b/testdata/baselines/reference/tsc/noCheck/dts-errors.js index 885a33e842..45e165d641 100644 --- a/testdata/baselines/reference/tsc/noCheck/dts-errors.js +++ b/testdata/baselines/reference/tsc/noCheck/dts-errors.js @@ -8,9 +8,9 @@ export const a = class { private p = 10; }; export const b = 10; //// [/home/src/workspaces/project/tsconfig.json] *new* { - "compilerOptions": { - "declaration": true, - } + "compilerOptions": { + "declaration": true, + } } ExitStatus:: 2 diff --git a/testdata/baselines/reference/tsc/noCheck/semantic-errors.js b/testdata/baselines/reference/tsc/noCheck/semantic-errors.js index 7e288fff7f..ac27f6563e 100644 --- a/testdata/baselines/reference/tsc/noCheck/semantic-errors.js +++ b/testdata/baselines/reference/tsc/noCheck/semantic-errors.js @@ -8,9 +8,9 @@ export const a: number = "hello"; export const b = 10; //// [/home/src/workspaces/project/tsconfig.json] *new* { - "compilerOptions": { - "declaration": true, - } + "compilerOptions": { + "declaration": true, + } } ExitStatus:: 0 diff --git a/testdata/baselines/reference/tsc/noCheck/syntax-errors.js b/testdata/baselines/reference/tsc/noCheck/syntax-errors.js index 4247650dd3..65bd9f3638 100644 --- a/testdata/baselines/reference/tsc/noCheck/syntax-errors.js +++ b/testdata/baselines/reference/tsc/noCheck/syntax-errors.js @@ -8,9 +8,9 @@ export const a = "hello export const b = 10; //// [/home/src/workspaces/project/tsconfig.json] *new* { - "compilerOptions": { - "declaration": true, - } + "compilerOptions": { + "declaration": true, + } } ExitStatus:: 2 diff --git a/testdata/baselines/reference/tsc/noEmit/when-project-has-strict-true.js b/testdata/baselines/reference/tsc/noEmit/when-project-has-strict-true.js index 8ad51c7cb0..8678e174a9 100644 --- a/testdata/baselines/reference/tsc/noEmit/when-project-has-strict-true.js +++ b/testdata/baselines/reference/tsc/noEmit/when-project-has-strict-true.js @@ -6,10 +6,10 @@ Input::--noEmit export class class1 {} //// [/home/src/workspaces/project/tsconfig.json] *new* { - "compilerOptions": { - "incremental": true, - "strict": true, - }, + "compilerOptions": { + "incremental": true, + "strict": true + } } ExitStatus:: 0 diff --git a/testdata/baselines/reference/tsc/projectReferences/default-import-interop-uses-referenced-project-settings.js b/testdata/baselines/reference/tsc/projectReferences/default-import-interop-uses-referenced-project-settings.js index 5bbf8ebf7d..f62b45303d 100644 --- a/testdata/baselines/reference/tsc/projectReferences/default-import-interop-uses-referenced-project-settings.js +++ b/testdata/baselines/reference/tsc/projectReferences/default-import-interop-uses-referenced-project-settings.js @@ -3,51 +3,55 @@ currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true Input::--p app --pretty false //// [/home/src/workspaces/project/app/src/index.ts] *new* - - import local from "./local"; // Error - import esm from "esm-package"; // Error - import referencedSource from "../../lib/src/a"; // Error - import referencedDeclaration from "../../lib/dist/a"; // Error - import ambiguous from "ambiguous-package"; // Ok +import local from "./local"; // Error +import esm from "esm-package"; // Error +import referencedSource from "../../lib/src/a"; // Error +import referencedDeclaration from "../../lib/dist/a"; // Error +import ambiguous from "ambiguous-package"; // Ok //// [/home/src/workspaces/project/app/src/local.ts] *new* export const local = 0; //// [/home/src/workspaces/project/app/tsconfig.json] *new* { - "compilerOptions": { - "module": "esnext", - "moduleResolution": "bundler", - "rootDir": "src", - "outDir": "dist", - }, - "include": ["src"], - "references": [ - { "path": "../lib" }, - ], - } + "compilerOptions": { + "module": "esnext", + "moduleResolution": "bundler", + "rootDir": "src", + "outDir": "dist", + }, + "include": ["src"], + "references": [ + { "path": "../lib" }, + ], +} //// [/home/src/workspaces/project/lib/dist/a.d.ts] *new* export declare const a = 0; //// [/home/src/workspaces/project/lib/src/a.ts] *new* export const a = 0; //// [/home/src/workspaces/project/lib/tsconfig.json] *new* { - "compilerOptions": { - "composite": true, - "declaration": true, - "rootDir": "src", - "outDir": "dist", - "module": "esnext", - "moduleResolution": "bundler", - }, - "include": ["src"], - } + "compilerOptions": { + "composite": true, + "declaration": true, + "rootDir": "src", + "outDir": "dist", + "module": "esnext", + "moduleResolution": "bundler", + }, + "include": ["src"], +} //// [/home/src/workspaces/project/node_modules/ambiguous-package/index.d.ts] *new* export declare const ambiguous: number; //// [/home/src/workspaces/project/node_modules/ambiguous-package/package.json] *new* -{ "name": "ambiguous-package" } +{ + "name": "ambiguous-package" +} //// [/home/src/workspaces/project/node_modules/esm-package/index.d.ts] *new* export declare const esm: number; //// [/home/src/workspaces/project/node_modules/esm-package/package.json] *new* -{ "name": "esm-package", "type": "module" } +{ + "name": "esm-package", + "type": "module" +} ExitStatus:: 2 @@ -56,9 +60,9 @@ CompilerOptions::{ "pretty": false } Output:: -app/src/index.ts(2,13): error TS2613: Module '"/home/src/workspaces/project/app/src/local"' has no default export. Did you mean to use 'import { local } from "/home/src/workspaces/project/app/src/local"' instead? +app/src/index.ts(1,8): error TS2613: Module '"/home/src/workspaces/project/app/src/local"' has no default export. Did you mean to use 'import { local } from "/home/src/workspaces/project/app/src/local"' instead? -app/src/index.ts(3,13): error TS2613: Module '"/home/src/workspaces/project/node_modules/esm-package/index"' has no default export. Did you mean to use 'import { esm } from "/home/src/workspaces/project/node_modules/esm-package/index"' instead? +app/src/index.ts(2,8): error TS2613: Module '"/home/src/workspaces/project/node_modules/esm-package/index"' has no default export. Did you mean to use 'import { esm } from "/home/src/workspaces/project/node_modules/esm-package/index"' instead? //// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* /// interface Boolean {} diff --git a/testdata/baselines/reference/tsc/projectReferences/importing-const-enum-from-referenced-project-with-preserveConstEnums-and-verbatimModuleSyntax.js b/testdata/baselines/reference/tsc/projectReferences/importing-const-enum-from-referenced-project-with-preserveConstEnums-and-verbatimModuleSyntax.js index 1cffa42a81..732486c5d6 100644 --- a/testdata/baselines/reference/tsc/projectReferences/importing-const-enum-from-referenced-project-with-preserveConstEnums-and-verbatimModuleSyntax.js +++ b/testdata/baselines/reference/tsc/projectReferences/importing-const-enum-from-referenced-project-with-preserveConstEnums-and-verbatimModuleSyntax.js @@ -8,41 +8,40 @@ export declare const enum F { A = 1 } export const enum E { A = 1 } //// [/home/src/workspaces/solution/no-preserve/tsconfig.json] *new* { - "compilerOptions": { - "composite": true, - "declaration": true, - "preserveConstEnums": false, - }, - } + "compilerOptions": { + "composite": true, + "declaration": true, + "preserveConstEnums": false, + }, +} //// [/home/src/workspaces/solution/preserve/index.d.ts] *new* export declare const enum E { A = 1 } //// [/home/src/workspaces/solution/preserve/index.ts] *new* export const enum E { A = 1 } //// [/home/src/workspaces/solution/preserve/tsconfig.json] *new* { - "compilerOptions": { - "composite": true, - "declaration": true, - "preserveConstEnums": true, - }, - } + "compilerOptions": { + "composite": true, + "declaration": true, + "preserveConstEnums": true, + }, +} //// [/home/src/workspaces/solution/project/index.ts] *new* - - import { E } from "../preserve"; - import { F } from "../no-preserve"; - E.A; - F.A; +import { E } from "../preserve"; +import { F } from "../no-preserve"; +E.A; +F.A; //// [/home/src/workspaces/solution/project/tsconfig.json] *new* { - "compilerOptions": { - "module": "preserve", - "verbatimModuleSyntax": true, - }, - "references": [ - { "path": "../preserve" }, - { "path": "../no-preserve" }, - ], - } + "compilerOptions": { + "module": "preserve", + "verbatimModuleSyntax": true, + }, + "references": [ + { "path": "../preserve" }, + { "path": "../no-preserve" }, + ], +} ExitStatus:: 2 @@ -51,7 +50,7 @@ CompilerOptions::{ "pretty": false } Output:: -project/index.ts(3,14): error TS2748: Cannot access ambient const enums when 'verbatimModuleSyntax' is enabled. +project/index.ts(2,10): error TS2748: Cannot access ambient const enums when 'verbatimModuleSyntax' is enabled. //// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* /// interface Boolean {} diff --git a/testdata/baselines/reference/tsc/projectReferences/referencing-ambient-const-enum-from-referenced-project-with-preserveConstEnums.js b/testdata/baselines/reference/tsc/projectReferences/referencing-ambient-const-enum-from-referenced-project-with-preserveConstEnums.js index 78e616aeb6..76dded2871 100644 --- a/testdata/baselines/reference/tsc/projectReferences/referencing-ambient-const-enum-from-referenced-project-with-preserveConstEnums.js +++ b/testdata/baselines/reference/tsc/projectReferences/referencing-ambient-const-enum-from-referenced-project-with-preserveConstEnums.js @@ -6,25 +6,25 @@ Input::--p project import { E } from "../utils"; E.A; //// [/home/src/workspaces/solution/project/tsconfig.json] *new* { - "compilerOptions": { - "isolatedModules": true, - }, - "references": [ - { "path": "../utils" }, - ], - } + "compilerOptions": { + "isolatedModules": true, + }, + "references": [ + { "path": "../utils" }, + ], +} //// [/home/src/workspaces/solution/utils/index.d.ts] *new* export declare const enum E { A = 1 } //// [/home/src/workspaces/solution/utils/index.ts] *new* export const enum E { A = 1 } //// [/home/src/workspaces/solution/utils/tsconfig.json] *new* { - "compilerOptions": { - "composite": true, - "declaration": true, - "preserveConstEnums": true, - }, - } + "compilerOptions": { + "composite": true, + "declaration": true, + "preserveConstEnums": true, + }, +} ExitStatus:: 0 diff --git a/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences1.js b/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences1.js index 4605b40779..4702776b66 100644 --- a/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences1.js +++ b/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences1.js @@ -6,43 +6,45 @@ Input::-p packages/main --pretty false export {}; //// [/home/src/workspaces/packages/common/package.json] *new* { - "name": "common", - "version": "1.0.0", - "type": "module", - "exports": { - ".": { - "source": "./src/index.ts", - "default": "./dist/index.js" - } - } - } + "name": "common", + "version": "1.0.0", + "type": "module", + "exports": { + ".": { + "source": "./src/index.ts", + "default": "./dist/index.js" + } + } +} //// [/home/src/workspaces/packages/common/src/index.ts] *new* export {}; //// [/home/src/workspaces/packages/common/tsconfig.json] *new* { - "compilerOptions": { - "composite": true, - "rootDir": "src", - "outDir": "dist", - "module": "nodenext" - } - } + "compilerOptions": { + "composite": true, + "rootDir": "src", + "outDir": "dist", + "module": "nodenext" + } +} //// [/home/src/workspaces/packages/main/package.json] *new* -{ "type": "module" } +{ + "type": "module" +} //// [/home/src/workspaces/packages/main/src/index.ts] *new* import {} from "../../common/src/index.ts"; //// [/home/src/workspaces/packages/main/tsconfig.json] *new* { - "compilerOptions": { - "module": "nodenext", - "rewriteRelativeImportExtensions": true, - "rootDir": "src", - "outDir": "dist" - }, - "references": [ - { "path": "../common" } - ] - } + "compilerOptions": { + "module": "nodenext", + "rewriteRelativeImportExtensions": true, + "rootDir": "src", + "outDir": "dist" + }, + "references": [ + { "path": "../common" } + ] +} ExitStatus:: 2 diff --git a/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences2.js b/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences2.js index 0dca5416d7..140b8e8dbd 100644 --- a/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences2.js +++ b/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences2.js @@ -8,29 +8,29 @@ export {}; export {}; //// [/home/src/workspaces/solution/src/compiler/tsconfig.json] *new* { - "extends": "../tsconfig-base.json", - "compilerOptions": {} - } + "extends": "../tsconfig-base.json", + "compilerOptions": {} +} //// [/home/src/workspaces/solution/src/services/services.ts] *new* import {} from "../compiler/parser.ts"; //// [/home/src/workspaces/solution/src/services/tsconfig.json] *new* { - "extends": "../tsconfig-base.json", - "compilerOptions": {}, - "references": [ - { "path": "../compiler" } - ] - } + "extends": "../tsconfig-base.json", + "compilerOptions": {}, + "references": [ + { "path": "../compiler" } + ] +} //// [/home/src/workspaces/solution/src/tsconfig-base.json] *new* { - "compilerOptions": { - "module": "nodenext", - "composite": true, - "rootDir": ".", - "outDir": "../dist", - "rewriteRelativeImportExtensions": true - } - } + "compilerOptions": { + "module": "nodenext", + "composite": true, + "rootDir": ".", + "outDir": "../dist", + "rewriteRelativeImportExtensions": true + } +} ExitStatus:: 0 diff --git a/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences3.js b/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences3.js index 6ecdc069df..783489570b 100644 --- a/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences3.js +++ b/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences3.js @@ -8,33 +8,33 @@ export {}; export {}; //// [/home/src/workspaces/solution/src/compiler/tsconfig.json] *new* { - "extends": "../tsconfig-base.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "../../dist/compiler" - } - } + "extends": "../tsconfig-base.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "../../dist/compiler" + } +} //// [/home/src/workspaces/solution/src/services/services.ts] *new* import {} from "../compiler/parser.ts"; //// [/home/src/workspaces/solution/src/services/tsconfig.json] *new* { - "extends": "../tsconfig-base.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "../../dist/services" - }, - "references": [ - { "path": "../compiler" } - ] - } + "extends": "../tsconfig-base.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "../../dist/services" + }, + "references": [ + { "path": "../compiler" } + ] +} //// [/home/src/workspaces/solution/src/tsconfig-base.json] *new* { - "compilerOptions": { - "module": "nodenext", - "composite": true, - "rewriteRelativeImportExtensions": true - } - } + "compilerOptions": { + "module": "nodenext", + "composite": true, + "rewriteRelativeImportExtensions": true + } +} ExitStatus:: 0 diff --git a/testdata/baselines/reference/tsc/projectReferences/when-project-contains-invalid-project-reference.js b/testdata/baselines/reference/tsc/projectReferences/when-project-contains-invalid-project-reference.js index d3eda70ecd..a9acf0b00f 100644 --- a/testdata/baselines/reference/tsc/projectReferences/when-project-contains-invalid-project-reference.js +++ b/testdata/baselines/reference/tsc/projectReferences/when-project-contains-invalid-project-reference.js @@ -6,9 +6,9 @@ Input::--p project export const x = 10; //// [/home/src/workspaces/solution/project/tsconfig.json] *new* { - "references": [ - { "path": "../utils" }, - ], + "references": [ + { "path": "../utils" }, + ], } ExitStatus:: 0 diff --git a/testdata/baselines/reference/tsc/projectReferences/when-project-reference-is-not-built.js b/testdata/baselines/reference/tsc/projectReferences/when-project-reference-is-not-built.js index 76409223ff..71f3370c6a 100644 --- a/testdata/baselines/reference/tsc/projectReferences/when-project-reference-is-not-built.js +++ b/testdata/baselines/reference/tsc/projectReferences/when-project-reference-is-not-built.js @@ -6,17 +6,17 @@ Input::--p project import { x } from "../utils"; //// [/home/src/workspaces/solution/project/tsconfig.json] *new* { - "references": [ - { "path": "../utils" }, - ], + "references": [ + { "path": "../utils" }, + ], } //// [/home/src/workspaces/solution/utils/index.ts] *new* export const x = 10; //// [/home/src/workspaces/solution/utils/tsconfig.json] *new* { - "compilerOptions": { - "composite": true, - }, + "compilerOptions": { + "composite": true + } } ExitStatus:: 2 diff --git a/testdata/baselines/reference/tsc/projectReferences/when-project-references-composite-project-with-noEmit.js b/testdata/baselines/reference/tsc/projectReferences/when-project-references-composite-project-with-noEmit.js index 6aa9f67689..1abc0e6f8c 100644 --- a/testdata/baselines/reference/tsc/projectReferences/when-project-references-composite-project-with-noEmit.js +++ b/testdata/baselines/reference/tsc/projectReferences/when-project-references-composite-project-with-noEmit.js @@ -6,19 +6,19 @@ Input::--p project import { x } from "../utils"; //// [/home/src/workspaces/solution/project/tsconfig.json] *new* { - "references": [ - { "path": "../utils" }, - ], - } + "references": [ + { "path": "../utils" }, + ], +} //// [/home/src/workspaces/solution/utils/index.ts] *new* export const x = 10; //// [/home/src/workspaces/solution/utils/tsconfig.json] *new* { - "compilerOptions": { - "composite": true, - "noEmit": true, - }, - } + "compilerOptions": { + "composite": true, + "noEmit": true + } +} ExitStatus:: 2 diff --git a/testdata/baselines/reference/tsc/projectReferences/when-project-references-composite.js b/testdata/baselines/reference/tsc/projectReferences/when-project-references-composite.js index 33ca14b272..703add34d1 100644 --- a/testdata/baselines/reference/tsc/projectReferences/when-project-references-composite.js +++ b/testdata/baselines/reference/tsc/projectReferences/when-project-references-composite.js @@ -6,9 +6,9 @@ Input::--p project import { x } from "../utils"; //// [/home/src/workspaces/solution/project/tsconfig.json] *new* { - "references": [ - { "path": "../utils" }, - ], + "references": [ + { "path": "../utils" }, + ], } //// [/home/src/workspaces/solution/utils/index.d.ts] *new* export declare const x = 10; @@ -16,9 +16,9 @@ export declare const x = 10; export const x = 10; //// [/home/src/workspaces/solution/utils/tsconfig.json] *new* { - "compilerOptions": { - "composite": true, - }, + "compilerOptions": { + "composite": true + } } ExitStatus:: 0 diff --git a/testdata/baselines/reference/tsc/typeAcquisition/parse-tsconfig-with-typeAcquisition.js b/testdata/baselines/reference/tsc/typeAcquisition/parse-tsconfig-with-typeAcquisition.js index c373f35ee9..a2b3785438 100644 --- a/testdata/baselines/reference/tsc/typeAcquisition/parse-tsconfig-with-typeAcquisition.js +++ b/testdata/baselines/reference/tsc/typeAcquisition/parse-tsconfig-with-typeAcquisition.js @@ -4,16 +4,16 @@ useCaseSensitiveFileNames::true Input:: //// [/home/src/workspaces/project/tsconfig.json] *new* { - "compilerOptions": { - "composite": true, - "noEmit": true, - }, - "typeAcquisition": { - "enable": true, - "include": ["0.d.ts", "1.d.ts"], - "exclude": ["0.js", "1.js"], - "disableFilenameBasedTypeAcquisition": true, - }, + "compilerOptions": { + "composite": true, + "noEmit": true, + }, + "typeAcquisition": { + "enable": true, + "include": ["0.d.ts", "1.d.ts"], + "exclude": ["0.js", "1.js"], + "disableFilenameBasedTypeAcquisition": true, + }, } ExitStatus:: 1 diff --git a/testdata/baselines/reference/tscWatch/commandLine/Parse-watch-interval-option.js b/testdata/baselines/reference/tscWatch/commandLine/Parse-watch-interval-option.js index 456be36e94..4128d40177 100644 --- a/testdata/baselines/reference/tscWatch/commandLine/Parse-watch-interval-option.js +++ b/testdata/baselines/reference/tscWatch/commandLine/Parse-watch-interval-option.js @@ -5,7 +5,12 @@ Input::-w --watchInterval 1000 //// [/home/src/workspaces/project/first.ts] *new* export const a = 1 //// [/home/src/workspaces/project/tsconfig.json] *new* -{ "compilerOptions": { "strict": true, "noEmit": true } } +{ + "compilerOptions": { + "strict": true, + "noEmit": true + } +} ExitStatus:: 0 From 767b8532b73e0a685743dd3964f1909812593209 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 2 Jul 2025 15:38:15 -0700 Subject: [PATCH 33/36] Unify tsc runner even more --- cmd/tsgo/main.go | 2 +- internal/execute/testsys_test.go | 4 +- internal/execute/tsc.go | 15 +-- internal/execute/tsc_test.go | 2 +- internal/execute/tsctestrunner_test.go | 103 +++++++---------- .../when-build-not-first-argument.js | 31 +---- .../Parse---lib-option-with-file-name.js | 38 +------ .../Parse--p-with-path-to-tsconfig-file.js | 32 +----- .../Parse--p-with-path-to-tsconfig-folder.js | 32 +----- .../reference/tsc/commandLine/Parse--p.js | 32 +----- .../commandLine/Parse-enum-type-options.js | 44 +------- .../commandLine/Project-is-empty-string.js | 26 +---- ...does-not-add-color-when-NO_COLOR-is-set.js | 26 +---- .../reference/tsc/commandLine/help-all.js | 34 +----- .../reference/tsc/commandLine/help.js | 34 +----- ...when-host-cannot-provide-terminal-width.js | 26 +---- ...tatus.DiagnosticsPresent_OutputsSkipped.js | 26 +---- .../extends/configDir-template-showConfig.js | 10 +- .../configDir-template-with-commandline.js | 11 +- .../tsc/extends/configDir-template.js | 10 +- ...ion-field-with-declaration-emit-enabled.js | 47 +++----- ...e-to-modifier-of-class-expression-field.js | 47 +++----- ...in-another-file-through-indirect-import.js | 15 +-- ...s-global-through-export-in-another-file.js | 15 +-- .../const-enums-aliased-in-different-file.js | 41 +++---- .../tsc/incremental/const-enums-aliased.js | 41 +++---- .../reference/tsc/incremental/const-enums.js | 41 +++---- .../generates-typerefs-correctly.js | 15 +-- .../option-changes-with-composite.js | 106 ++++++++---------- .../option-changes-with-incremental.js | 99 +++++++--------- ...ypes-found-doesn't-crash-under---strict.js | 12 +- ...th-no-backing-types-found-doesn't-crash.js | 8 +- .../serializing-composite-project.js | 8 +- .../incremental/serializing-error-chain.js | 15 +-- .../tsc/incremental/tsbuildinfo-has-error.js | 19 +--- .../tsc/incremental/when-file-is-deleted.js | 15 +-- ...le-is-added,-the-signatures-are-updated.js | 50 ++++----- ...g-filename-for-buildinfo-on-commandline.js | 21 +--- .../when-passing-rootDir-from-commandline.js | 19 +--- ...when-passing-rootDir-is-in-the-tsconfig.js | 15 +-- .../tsc/incremental/with-only-dts-files.js | 26 ++--- .../reference/tsc/noCheck/dts-errors.js | 11 +- .../reference/tsc/noCheck/semantic-errors.js | 11 +- .../reference/tsc/noCheck/syntax-errors.js | 11 +- .../noEmit/when-project-has-strict-true.js | 12 +- ...nterop-uses-referenced-project-settings.js | 11 +- ...erveConstEnums-and-verbatimModuleSyntax.js | 11 +- ...erenced-project-with-preserveConstEnums.js | 10 +- ...ativeImportExtensionsProjectReferences1.js | 11 +- ...ativeImportExtensionsProjectReferences2.js | 13 +-- ...ativeImportExtensionsProjectReferences3.js | 13 +-- ...ject-contains-invalid-project-reference.js | 10 +- .../when-project-reference-is-not-built.js | 10 +- ...eferences-composite-project-with-noEmit.js | 10 +- .../when-project-references-composite.js | 10 +- .../parse-tsconfig-with-typeAcquisition.js | 8 +- ...h-interval-option-without-tsconfig.json.js | 35 +----- .../Parse-watch-interval-option.js | 37 ++---- .../watch-with-no-tsconfig.js | 12 +- .../noEmit/dts-errors-without-dts-enabled.js | 36 ++---- .../reference/tscWatch/noEmit/dts-errors.js | 36 ++---- .../tscWatch/noEmit/semantic-errors.js | 36 ++---- .../tscWatch/noEmit/syntax-errors.js | 36 ++---- 63 files changed, 437 insertions(+), 1166 deletions(-) diff --git a/cmd/tsgo/main.go b/cmd/tsgo/main.go index 93461aa5cd..4e796eda6c 100644 --- a/cmd/tsgo/main.go +++ b/cmd/tsgo/main.go @@ -20,6 +20,6 @@ func runMain() int { return runAPI(args[1:]) } } - status, _, _, _ := execute.CommandLine(newSystem(), args, false) + status, _, _ := execute.CommandLine(newSystem(), args, false) return int(status) } diff --git a/internal/execute/testsys_test.go b/internal/execute/testsys_test.go index b63bdbb875..c9d5bcd069 100644 --- a/internal/execute/testsys_test.go +++ b/internal/execute/testsys_test.go @@ -176,7 +176,7 @@ func (s *testSys) baselineProgram(baseline *strings.Builder, program *incrementa return } - baseline.WriteString("\nSemanticDiagnostics::\n") + baseline.WriteString("SemanticDiagnostics::\n") semanticDiagnostics, diagnosticsFromOldProgram, updatedSignatureKinds := program.GetTestingData(program.GetProgram()) for _, file := range program.GetProgram().GetSourceFiles() { if diagnostics, ok := semanticDiagnostics[file.Path()]; ok { @@ -189,7 +189,7 @@ func (s *testSys) baselineProgram(baseline *strings.Builder, program *incrementa } // Write signature updates - baseline.WriteString("\nSignatures::\n") + baseline.WriteString("Signatures::\n") for _, file := range program.GetProgram().GetSourceFiles() { if kind, loaded := updatedSignatureKinds.Load(file.Path()); loaded { switch kind { diff --git a/internal/execute/tsc.go b/internal/execute/tsc.go index c873484ff7..5b414acd06 100644 --- a/internal/execute/tsc.go +++ b/internal/execute/tsc.go @@ -41,25 +41,20 @@ func applyBulkEdits(text string, edits []core.TextChange) string { return b.String() } -func CommandLine(sys System, commandLineArgs []string, testing bool) (ExitStatus, *tsoptions.ParsedCommandLine, *incremental.Program, *Watcher) { +func CommandLine(sys System, commandLineArgs []string, testing bool) (ExitStatus, *incremental.Program, *Watcher) { if len(commandLineArgs) > 0 { // !!! build mode switch strings.ToLower(commandLineArgs[0]) { case "-b", "--b", "-build", "--build": fmt.Fprint(sys.Writer(), "Build mode is currently unsupported."+sys.NewLine()) sys.EndWrite() - return ExitStatusNotImplemented, nil, nil, nil + return ExitStatusNotImplemented, nil, nil // case "-f": // return fmtMain(sys, commandLineArgs[1], commandLineArgs[1]) } } - parsedCommandLine := tsoptions.ParseCommandLine(commandLineArgs, sys) - status, incrementalProgram, watcher := tscCompilation(sys, parsedCommandLine, testing) - if watcher != nil { - watcher.start() - } - return status, parsedCommandLine, incrementalProgram, watcher + return tscCompilation(sys, tsoptions.ParseCommandLine(commandLineArgs, sys), testing) } func fmtMain(sys System, input, output string) ExitStatus { @@ -186,7 +181,9 @@ func tscCompilation(sys System, commandLine *tsoptions.ParsedCommandLine, testin return ExitStatusSuccess, nil, nil } if configForCompilation.CompilerOptions().Watch.IsTrue() { - return ExitStatusSuccess, nil, createWatcher(sys, configForCompilation, reportDiagnostic, testing) + watcher := createWatcher(sys, configForCompilation, reportDiagnostic, testing) + watcher.start() + return ExitStatusSuccess, nil, watcher } else if configForCompilation.CompilerOptions().IsIncremental() { exitStatus, program := performIncrementalCompilation( sys, diff --git a/internal/execute/tsc_test.go b/internal/execute/tsc_test.go index 40abee7c14..65403e436e 100644 --- a/internal/execute/tsc_test.go +++ b/internal/execute/tsc_test.go @@ -142,7 +142,7 @@ func TestTscCommandline(t *testing.T) { } for _, testCase := range testCases { - testCase.verifyCommandLineParsing(t, "commandLine") + testCase.run(t, "commandLine") } } diff --git a/internal/execute/tsctestrunner_test.go b/internal/execute/tsctestrunner_test.go index dfe5838793..8a8db89bf1 100644 --- a/internal/execute/tsctestrunner_test.go +++ b/internal/execute/tsctestrunner_test.go @@ -1,7 +1,6 @@ package execute_test import ( - "encoding/json" "fmt" "path/filepath" "slices" @@ -35,24 +34,50 @@ type tscInput struct { edits []*testTscEdit } +func (test *tscInput) executeCommand(baselineBuilder *strings.Builder, commandLineArgs []string) (*incremental.Program, *execute.Watcher) { + fmt.Fprint(baselineBuilder, "tsgo ", strings.Join(commandLineArgs, " "), "\n") + exit, incrementalProgram, watcher := execute.CommandLine(test.sys, commandLineArgs, true) + switch exit { + case execute.ExitStatusSuccess: + baselineBuilder.WriteString("ExitStatus:: Success") + case execute.ExitStatusDiagnosticsPresent_OutputsSkipped: + baselineBuilder.WriteString("ExitStatus:: DiagnosticsPresent_OutputsSkipped") + case execute.ExitStatusDiagnosticsPresent_OutputsGenerated: + baselineBuilder.WriteString("ExitStatus:: DiagnosticsPresent_OutputsGenerated") + case execute.ExitStatusInvalidProject_OutputsSkipped: + baselineBuilder.WriteString("ExitStatus:: InvalidProject_OutputsSkipped") + case execute.ExitStatusProjectReferenceCycle_OutputsSkipped: + baselineBuilder.WriteString("ExitStatus:: ProjectReferenceCycle_OutputsSkipped") + case execute.ExitStatusNotImplemented: + baselineBuilder.WriteString("ExitStatus:: NotImplemented") + default: + panic(fmt.Sprintf("UnknownExitStatus %d", exit)) + } + return incrementalProgram, watcher +} + func (test *tscInput) run(t *testing.T, scenario string) { t.Helper() + // !!! sheetal TODO :: add incremental correctness t.Run(test.subScenario+" tsc baseline", func(t *testing.T) { t.Parallel() // initial test tsc compile - baselineBuilder := test.startBaseline() - - exit, parsedCommandLine, incrementalProgram, watcher := execute.CommandLine(test.sys, test.commandLineArgs, true) - baselineBuilder.WriteString("ExitStatus:: " + fmt.Sprint(exit)) - - compilerOptionsString, _ := json.MarshalIndent(parsedCommandLine.CompilerOptions(), "", " ") - baselineBuilder.WriteString("\n\nCompilerOptions::") - baselineBuilder.Write(compilerOptionsString) - + baselineBuilder := &strings.Builder{} + fmt.Fprint( + baselineBuilder, + "currentDirectory::", + test.sys.GetCurrentDirectory(), + "\nuseCaseSensitiveFileNames::", + test.sys.FS().UseCaseSensitiveFileNames(), + "\nInput::\n", + ) + test.sys.baselineFSwithDiff(baselineBuilder) + incrementalProgram, watcher := test.executeCommand(baselineBuilder, test.commandLineArgs) test.sys.serializeState(baselineBuilder) test.sys.baselineProgram(baselineBuilder, incrementalProgram, watcher) - for _, do := range test.edits { - baselineBuilder.WriteString("\n\nEdit:: " + do.caption + "\n") + + for index, do := range test.edits { + baselineBuilder.WriteString(fmt.Sprintf("\n\nEdit [%d]:: %s\n", index, do.caption)) if do.edit != nil { do.edit(test.sys) } @@ -60,8 +85,8 @@ func (test *tscInput) run(t *testing.T, scenario string) { var incrementalProgram *incremental.Program if watcher == nil { - exit, parsedCommandLine, incrementalProgram, watcher = execute.CommandLine(test.sys, core.IfElse(do.commandLineArgs == nil, test.commandLineArgs, do.commandLineArgs), true) - baselineBuilder.WriteString("ExitStatus:: " + fmt.Sprint(exit)) + commandLineArgs := core.IfElse(do.commandLineArgs == nil, test.commandLineArgs, do.commandLineArgs) + incrementalProgram, watcher = test.executeCommand(baselineBuilder, commandLineArgs) } else { watcher.DoCycle() } @@ -69,14 +94,11 @@ func (test *tscInput) run(t *testing.T, scenario string) { test.sys.baselineProgram(baselineBuilder, incrementalProgram, watcher) } - options, name := test.getBaselineName(scenario, "") - baseline.Run(t, name, baselineBuilder.String(), options) + baseline.Run(t, strings.ReplaceAll(test.subScenario, " ", "-")+".js", baselineBuilder.String(), baseline.Options{Subfolder: filepath.Join(test.getBaselineSubFolder(), scenario)}) }) - - // !!! sheetal TODO :: add incremental correctness } -func (test *tscInput) getTestNamePrefix() string { +func (test *tscInput) getBaselineSubFolder() string { commandName := "tsc" if slices.ContainsFunc(test.commandLineArgs, func(arg string) bool { return arg == "--build" || arg == "-b" @@ -91,46 +113,3 @@ func (test *tscInput) getTestNamePrefix() string { } return commandName + w } - -func (test *tscInput) getBaselineName(scenario string, suffix string) (baseline.Options, string) { - return baseline.Options{Subfolder: filepath.Join(test.getTestNamePrefix(), scenario)}, - strings.ReplaceAll(test.subScenario, " ", "-") + suffix + ".js" -} - -func (test *tscInput) startBaseline() *strings.Builder { - s := &strings.Builder{} - fmt.Fprint( - s, - "\ncurrentDirectory::", - test.sys.GetCurrentDirectory(), - "\nuseCaseSensitiveFileNames::", - test.sys.FS().UseCaseSensitiveFileNames(), - "\nInput::", - ) - fmt.Fprint(s, strings.Join(test.commandLineArgs, " "), "\n") - test.sys.baselineFSwithDiff(s) - return s -} - -func (test *tscInput) verifyCommandLineParsing(t *testing.T, scenario string) { - t.Helper() - t.Run(test.subScenario, func(t *testing.T) { - t.Parallel() - t.Run("baseline for the tsc compiles", func(t *testing.T) { - t.Parallel() - // initial test tsc compile - baselineBuilder := test.startBaseline() - - exit, parsedCommandLine, _, _ := execute.CommandLine(test.sys, test.commandLineArgs, true) - baselineBuilder.WriteString("ExitStatus:: " + fmt.Sprint(exit)) - //nolint:musttag - parsedCommandLineString, _ := json.MarshalIndent(parsedCommandLine, "", " ") - baselineBuilder.WriteString("\n\nParsedCommandLine::") - baselineBuilder.Write(parsedCommandLineString) - - test.sys.serializeState(baselineBuilder) - options, name := test.getBaselineName(scenario, "") - baseline.Run(t, name, baselineBuilder.String(), options) - }) - }) -} diff --git a/testdata/baselines/reference/tsbuild/commandLine/when-build-not-first-argument.js b/testdata/baselines/reference/tsbuild/commandLine/when-build-not-first-argument.js index 59ece03c20..608553534e 100644 --- a/testdata/baselines/reference/tsbuild/commandLine/when-build-not-first-argument.js +++ b/testdata/baselines/reference/tsbuild/commandLine/when-build-not-first-argument.js @@ -1,34 +1,9 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true -Input::--verbose --build - -ExitStatus:: 1 +Input:: -ParsedCommandLine::{ - "parsedConfig": { - "compilerOptions": {}, - "watchOptions": { - "watchInterval": null, - "watchFile": 0, - "watchDirectory": 0, - "fallbackPolling": 0, - "synchronousWatchDirectory": null, - "excludeDirectories": null, - "excludeFiles": null - }, - "typeAcquisition": null, - "fileNames": [], - "projectReferences": null - }, - "configFile": null, - "errors": [ - {}, - {} - ], - "raw": {}, - "compileOnSave": null -} +tsgo --verbose --build +ExitStatus:: DiagnosticsPresent_OutputsSkipped Output:: error TS5093: Compiler option '--verbose' may only be used with '--build'. error TS6369: Option '--build' must be the first command line argument. diff --git a/testdata/baselines/reference/tsc/commandLine/Parse---lib-option-with-file-name.js b/testdata/baselines/reference/tsc/commandLine/Parse---lib-option-with-file-name.js index 23bf177ca2..b1eb1890c2 100644 --- a/testdata/baselines/reference/tsc/commandLine/Parse---lib-option-with-file-name.js +++ b/testdata/baselines/reference/tsc/commandLine/Parse---lib-option-with-file-name.js @@ -1,43 +1,11 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true -Input::--lib es6 first.ts +Input:: //// [/home/src/workspaces/project/first.ts] *new* export const Key = Symbol() -ExitStatus:: 0 - -ParsedCommandLine::{ - "parsedConfig": { - "compilerOptions": { - "lib": [ - "lib.es2015.d.ts" - ] - }, - "watchOptions": { - "watchInterval": null, - "watchFile": 0, - "watchDirectory": 0, - "fallbackPolling": 0, - "synchronousWatchDirectory": null, - "excludeDirectories": null, - "excludeFiles": null - }, - "typeAcquisition": null, - "fileNames": [ - "first.ts" - ], - "projectReferences": null - }, - "configFile": null, - "errors": [], - "raw": { - "lib": [ - "lib.es2015.d.ts" - ] - }, - "compileOnSave": null -} +tsgo --lib es6 first.ts +ExitStatus:: Success Output:: //// [/home/src/tslibs/TS/Lib/lib.es2015.d.ts] *Lib* /// diff --git a/testdata/baselines/reference/tsc/commandLine/Parse--p-with-path-to-tsconfig-file.js b/testdata/baselines/reference/tsc/commandLine/Parse--p-with-path-to-tsconfig-file.js index d8565e075e..52684620e4 100644 --- a/testdata/baselines/reference/tsc/commandLine/Parse--p-with-path-to-tsconfig-file.js +++ b/testdata/baselines/reference/tsc/commandLine/Parse--p-with-path-to-tsconfig-file.js @@ -1,7 +1,6 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true -Input::-p /home/src/workspaces/project/tsconfig.json +Input:: //// [/home/src/workspaces/project/first.ts] *new* export const a = 1 //// [/home/src/workspaces/project/tsconfig.json] *new* @@ -12,33 +11,8 @@ export const a = 1 } } -ExitStatus:: 0 - -ParsedCommandLine::{ - "parsedConfig": { - "compilerOptions": { - "project": "/home/src/workspaces/project/tsconfig.json" - }, - "watchOptions": { - "watchInterval": null, - "watchFile": 0, - "watchDirectory": 0, - "fallbackPolling": 0, - "synchronousWatchDirectory": null, - "excludeDirectories": null, - "excludeFiles": null - }, - "typeAcquisition": null, - "fileNames": [], - "projectReferences": null - }, - "configFile": null, - "errors": [], - "raw": { - "project": "/home/src/workspaces/project/tsconfig.json" - }, - "compileOnSave": null -} +tsgo -p /home/src/workspaces/project/tsconfig.json +ExitStatus:: Success Output:: //// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* /// diff --git a/testdata/baselines/reference/tsc/commandLine/Parse--p-with-path-to-tsconfig-folder.js b/testdata/baselines/reference/tsc/commandLine/Parse--p-with-path-to-tsconfig-folder.js index eaea15925c..2a5fd6fe78 100644 --- a/testdata/baselines/reference/tsc/commandLine/Parse--p-with-path-to-tsconfig-folder.js +++ b/testdata/baselines/reference/tsc/commandLine/Parse--p-with-path-to-tsconfig-folder.js @@ -1,7 +1,6 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true -Input::-p /home/src/workspaces/project +Input:: //// [/home/src/workspaces/project/first.ts] *new* export const a = 1 //// [/home/src/workspaces/project/tsconfig.json] *new* @@ -12,33 +11,8 @@ export const a = 1 } } -ExitStatus:: 0 - -ParsedCommandLine::{ - "parsedConfig": { - "compilerOptions": { - "project": "/home/src/workspaces/project" - }, - "watchOptions": { - "watchInterval": null, - "watchFile": 0, - "watchDirectory": 0, - "fallbackPolling": 0, - "synchronousWatchDirectory": null, - "excludeDirectories": null, - "excludeFiles": null - }, - "typeAcquisition": null, - "fileNames": [], - "projectReferences": null - }, - "configFile": null, - "errors": [], - "raw": { - "project": "/home/src/workspaces/project" - }, - "compileOnSave": null -} +tsgo -p /home/src/workspaces/project +ExitStatus:: Success Output:: //// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* /// diff --git a/testdata/baselines/reference/tsc/commandLine/Parse--p.js b/testdata/baselines/reference/tsc/commandLine/Parse--p.js index 0088240bbb..9e5937f459 100644 --- a/testdata/baselines/reference/tsc/commandLine/Parse--p.js +++ b/testdata/baselines/reference/tsc/commandLine/Parse--p.js @@ -1,7 +1,6 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true -Input::-p . +Input:: //// [/home/src/workspaces/project/first.ts] *new* export const a = 1 //// [/home/src/workspaces/project/tsconfig.json] *new* @@ -12,33 +11,8 @@ export const a = 1 } } -ExitStatus:: 0 - -ParsedCommandLine::{ - "parsedConfig": { - "compilerOptions": { - "project": "/home/src/workspaces/project" - }, - "watchOptions": { - "watchInterval": null, - "watchFile": 0, - "watchDirectory": 0, - "fallbackPolling": 0, - "synchronousWatchDirectory": null, - "excludeDirectories": null, - "excludeFiles": null - }, - "typeAcquisition": null, - "fileNames": [], - "projectReferences": null - }, - "configFile": null, - "errors": [], - "raw": { - "project": "/home/src/workspaces/project" - }, - "compileOnSave": null -} +tsgo -p . +ExitStatus:: Success Output:: //// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* /// diff --git a/testdata/baselines/reference/tsc/commandLine/Parse-enum-type-options.js b/testdata/baselines/reference/tsc/commandLine/Parse-enum-type-options.js index c0617dbe66..b7c372258f 100644 --- a/testdata/baselines/reference/tsc/commandLine/Parse-enum-type-options.js +++ b/testdata/baselines/reference/tsc/commandLine/Parse-enum-type-options.js @@ -1,47 +1,9 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true -Input::--moduleResolution nodenext first.ts --module nodenext --target esnext --moduleDetection auto --jsx react --newLine crlf - -ExitStatus:: 0 +Input:: -ParsedCommandLine::{ - "parsedConfig": { - "compilerOptions": { - "jsx": 3, - "module": 199, - "moduleResolution": 99, - "moduleDetection": 1, - "newLine": 1, - "target": 99 - }, - "watchOptions": { - "watchInterval": null, - "watchFile": 0, - "watchDirectory": 0, - "fallbackPolling": 0, - "synchronousWatchDirectory": null, - "excludeDirectories": null, - "excludeFiles": null - }, - "typeAcquisition": null, - "fileNames": [ - "first.ts" - ], - "projectReferences": null - }, - "configFile": null, - "errors": [], - "raw": { - "moduleResolution": 99, - "module": 199, - "target": 99, - "moduleDetection": 1, - "jsx": 3, - "newLine": 1 - }, - "compileOnSave": null -} +tsgo --moduleResolution nodenext first.ts --module nodenext --target esnext --moduleDetection auto --jsx react --newLine crlf +ExitStatus:: Success Output:: //// [/home/src/tslibs/TS/Lib/lib.esnext.full.d.ts] *Lib* /// diff --git a/testdata/baselines/reference/tsc/commandLine/Project-is-empty-string.js b/testdata/baselines/reference/tsc/commandLine/Project-is-empty-string.js index 3be55865f2..a7a5a65dce 100644 --- a/testdata/baselines/reference/tsc/commandLine/Project-is-empty-string.js +++ b/testdata/baselines/reference/tsc/commandLine/Project-is-empty-string.js @@ -1,4 +1,3 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true Input:: @@ -12,29 +11,8 @@ export const a = 1 } } -ExitStatus:: 0 - -ParsedCommandLine::{ - "parsedConfig": { - "compilerOptions": {}, - "watchOptions": { - "watchInterval": null, - "watchFile": 0, - "watchDirectory": 0, - "fallbackPolling": 0, - "synchronousWatchDirectory": null, - "excludeDirectories": null, - "excludeFiles": null - }, - "typeAcquisition": null, - "fileNames": [], - "projectReferences": null - }, - "configFile": null, - "errors": [], - "raw": {}, - "compileOnSave": null -} +tsgo +ExitStatus:: Success Output:: //// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* /// diff --git a/testdata/baselines/reference/tsc/commandLine/does-not-add-color-when-NO_COLOR-is-set.js b/testdata/baselines/reference/tsc/commandLine/does-not-add-color-when-NO_COLOR-is-set.js index 4d466c66fe..d5682e767f 100644 --- a/testdata/baselines/reference/tsc/commandLine/does-not-add-color-when-NO_COLOR-is-set.js +++ b/testdata/baselines/reference/tsc/commandLine/does-not-add-color-when-NO_COLOR-is-set.js @@ -1,31 +1,9 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true Input:: -ExitStatus:: 1 - -ParsedCommandLine::{ - "parsedConfig": { - "compilerOptions": {}, - "watchOptions": { - "watchInterval": null, - "watchFile": 0, - "watchDirectory": 0, - "fallbackPolling": 0, - "synchronousWatchDirectory": null, - "excludeDirectories": null, - "excludeFiles": null - }, - "typeAcquisition": null, - "fileNames": [], - "projectReferences": null - }, - "configFile": null, - "errors": [], - "raw": {}, - "compileOnSave": null -} +tsgo +ExitStatus:: DiagnosticsPresent_OutputsSkipped Output:: Version FakeTSVersion diff --git a/testdata/baselines/reference/tsc/commandLine/help-all.js b/testdata/baselines/reference/tsc/commandLine/help-all.js index fb8a975db6..ece14ddbf0 100644 --- a/testdata/baselines/reference/tsc/commandLine/help-all.js +++ b/testdata/baselines/reference/tsc/commandLine/help-all.js @@ -1,37 +1,9 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true -Input::--help --all - -ExitStatus:: 0 +Input:: -ParsedCommandLine::{ - "parsedConfig": { - "compilerOptions": { - "help": true, - "all": true - }, - "watchOptions": { - "watchInterval": null, - "watchFile": 0, - "watchDirectory": 0, - "fallbackPolling": 0, - "synchronousWatchDirectory": null, - "excludeDirectories": null, - "excludeFiles": null - }, - "typeAcquisition": null, - "fileNames": [], - "projectReferences": null - }, - "configFile": null, - "errors": [], - "raw": { - "help": true, - "all": true - }, - "compileOnSave": null -} +tsgo --help --all +ExitStatus:: Success Output:: No output diff --git a/testdata/baselines/reference/tsc/commandLine/help.js b/testdata/baselines/reference/tsc/commandLine/help.js index d67796b96a..3aa7b708d2 100644 --- a/testdata/baselines/reference/tsc/commandLine/help.js +++ b/testdata/baselines/reference/tsc/commandLine/help.js @@ -1,35 +1,9 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true -Input::--help - -ExitStatus:: 0 - -ParsedCommandLine::{ - "parsedConfig": { - "compilerOptions": { - "help": true - }, - "watchOptions": { - "watchInterval": null, - "watchFile": 0, - "watchDirectory": 0, - "fallbackPolling": 0, - "synchronousWatchDirectory": null, - "excludeDirectories": null, - "excludeFiles": null - }, - "typeAcquisition": null, - "fileNames": [], - "projectReferences": null - }, - "configFile": null, - "errors": [], - "raw": { - "help": true - }, - "compileOnSave": null -} +Input:: + +tsgo --help +ExitStatus:: Success Output:: tsc: The TypeScript Compiler - Version FakeTSVersion diff --git a/testdata/baselines/reference/tsc/commandLine/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-cannot-provide-terminal-width.js b/testdata/baselines/reference/tsc/commandLine/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-cannot-provide-terminal-width.js index 4d466c66fe..d5682e767f 100644 --- a/testdata/baselines/reference/tsc/commandLine/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-cannot-provide-terminal-width.js +++ b/testdata/baselines/reference/tsc/commandLine/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped-when-host-cannot-provide-terminal-width.js @@ -1,31 +1,9 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true Input:: -ExitStatus:: 1 - -ParsedCommandLine::{ - "parsedConfig": { - "compilerOptions": {}, - "watchOptions": { - "watchInterval": null, - "watchFile": 0, - "watchDirectory": 0, - "fallbackPolling": 0, - "synchronousWatchDirectory": null, - "excludeDirectories": null, - "excludeFiles": null - }, - "typeAcquisition": null, - "fileNames": [], - "projectReferences": null - }, - "configFile": null, - "errors": [], - "raw": {}, - "compileOnSave": null -} +tsgo +ExitStatus:: DiagnosticsPresent_OutputsSkipped Output:: Version FakeTSVersion diff --git a/testdata/baselines/reference/tsc/commandLine/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js b/testdata/baselines/reference/tsc/commandLine/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js index 4d466c66fe..d5682e767f 100644 --- a/testdata/baselines/reference/tsc/commandLine/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js +++ b/testdata/baselines/reference/tsc/commandLine/show-help-with-ExitStatus.DiagnosticsPresent_OutputsSkipped.js @@ -1,31 +1,9 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true Input:: -ExitStatus:: 1 - -ParsedCommandLine::{ - "parsedConfig": { - "compilerOptions": {}, - "watchOptions": { - "watchInterval": null, - "watchFile": 0, - "watchDirectory": 0, - "fallbackPolling": 0, - "synchronousWatchDirectory": null, - "excludeDirectories": null, - "excludeFiles": null - }, - "typeAcquisition": null, - "fileNames": [], - "projectReferences": null - }, - "configFile": null, - "errors": [], - "raw": {}, - "compileOnSave": null -} +tsgo +ExitStatus:: DiagnosticsPresent_OutputsSkipped Output:: Version FakeTSVersion diff --git a/testdata/baselines/reference/tsc/extends/configDir-template-showConfig.js b/testdata/baselines/reference/tsc/extends/configDir-template-showConfig.js index 0474bfe09e..b32d38fcc4 100644 --- a/testdata/baselines/reference/tsc/extends/configDir-template-showConfig.js +++ b/testdata/baselines/reference/tsc/extends/configDir-template-showConfig.js @@ -1,7 +1,6 @@ - currentDirectory::/home/src/projects/myproject useCaseSensitiveFileNames::true -Input::--showConfig +Input:: //// [/home/src/projects/configs/first/tsconfig.json] *new* { "extends": "../second/tsconfig.json", @@ -49,11 +48,8 @@ import { k } from "other/sometype2"; // some comment export const x = 10; -ExitStatus:: 0 - -CompilerOptions::{ - "showConfig": true -} +tsgo --showConfig +ExitStatus:: Success Output:: No output diff --git a/testdata/baselines/reference/tsc/extends/configDir-template-with-commandline.js b/testdata/baselines/reference/tsc/extends/configDir-template-with-commandline.js index 03a41f3ea2..ba5b22a61c 100644 --- a/testdata/baselines/reference/tsc/extends/configDir-template-with-commandline.js +++ b/testdata/baselines/reference/tsc/extends/configDir-template-with-commandline.js @@ -1,7 +1,6 @@ - currentDirectory::/home/src/projects/myproject useCaseSensitiveFileNames::true -Input::--explainFiles --outDir ${configDir}/outDir +Input:: //// [/home/src/projects/configs/first/tsconfig.json] *new* { "extends": "../second/tsconfig.json", @@ -49,12 +48,8 @@ import { k } from "other/sometype2"; // some comment export const x = 10; -ExitStatus:: 2 - -CompilerOptions::{ - "outDir": "/home/src/projects/myproject/${configDir}/outDir", - "explainFiles": true -} +tsgo --explainFiles --outDir ${configDir}/outDir +ExitStatus:: DiagnosticsPresent_OutputsGenerated Output:: src/secondary.ts:3:19 - error TS2307: Cannot find module 'other/sometype2' or its corresponding type declarations. diff --git a/testdata/baselines/reference/tsc/extends/configDir-template.js b/testdata/baselines/reference/tsc/extends/configDir-template.js index 23e6d2b1de..1e9821fe2b 100644 --- a/testdata/baselines/reference/tsc/extends/configDir-template.js +++ b/testdata/baselines/reference/tsc/extends/configDir-template.js @@ -1,7 +1,6 @@ - currentDirectory::/home/src/projects/myproject useCaseSensitiveFileNames::true -Input::--explainFiles +Input:: //// [/home/src/projects/configs/first/tsconfig.json] *new* { "extends": "../second/tsconfig.json", @@ -49,11 +48,8 @@ import { k } from "other/sometype2"; // some comment export const x = 10; -ExitStatus:: 2 - -CompilerOptions::{ - "explainFiles": true -} +tsgo --explainFiles +ExitStatus:: DiagnosticsPresent_OutputsGenerated Output:: src/secondary.ts:3:19 - error TS2307: Cannot find module 'other/sometype2' or its corresponding type declarations. diff --git a/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js index a6d62101a9..d443641a9e 100644 --- a/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js +++ b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field-with-declaration-emit-enabled.js @@ -1,7 +1,6 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true -Input::--incremental +Input:: //// [/home/src/tslibs/TS/Lib/lib.d.ts] *new* /// interface Boolean {} @@ -49,11 +48,8 @@ function logMessage( person: MessageablePerson ) { } } -ExitStatus:: 0 - -CompilerOptions::{ - "incremental": true -} +tsgo --incremental +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/MessageablePerson.d.ts] *new* declare const wrapper: () => { @@ -145,29 +141,26 @@ export {}; "size": 697 } - SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/MessageablePerson.ts *refresh* /home/src/workspaces/project/main.ts - Signatures:: (stored at emit) /home/src/workspaces/project/MessageablePerson.ts (stored at emit) /home/src/workspaces/project/main.ts -Edit:: no change +Edit [0]:: no change -ExitStatus:: 0 +tsgo --incremental +ExitStatus:: Success Output:: - SemanticDiagnostics:: - Signatures:: -Edit:: modify public to protected +Edit [1]:: modify public to protected //// [/home/src/workspaces/project/MessageablePerson.ts] *modified* const Messageable = () => { return class MessageableClass { @@ -178,7 +171,8 @@ const wrapper = () => Messageable(); type MessageablePerson = InstanceType>; export default MessageablePerson; -ExitStatus:: 2 +tsgo --incremental +ExitStatus:: DiagnosticsPresent_OutputsGenerated Output:: MessageablePerson.ts:6:7 - error TS4094: Property 'message' of exported anonymous class type may not be private or protected. @@ -305,19 +299,18 @@ Errors Files "size": 1203 } - SemanticDiagnostics:: *refresh* /home/src/workspaces/project/MessageablePerson.ts *refresh* /home/src/workspaces/project/main.ts - Signatures:: (computed .d.ts) /home/src/workspaces/project/MessageablePerson.ts (computed .d.ts) /home/src/workspaces/project/main.ts -Edit:: no change +Edit [2]:: no change -ExitStatus:: 1 +tsgo --incremental +ExitStatus:: DiagnosticsPresent_OutputsSkipped Output:: MessageablePerson.ts:6:7 - error TS4094: Property 'message' of exported anonymous class type may not be private or protected. @@ -343,13 +336,11 @@ Errors Files //// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified time* //// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified time* - SemanticDiagnostics:: - Signatures:: -Edit:: modify protected to public +Edit [3]:: modify protected to public //// [/home/src/workspaces/project/MessageablePerson.ts] *modified* const Messageable = () => { return class MessageableClass { @@ -360,7 +351,8 @@ const wrapper = () => Messageable(); type MessageablePerson = InstanceType>; export default MessageablePerson; -ExitStatus:: 0 +tsgo --incremental +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/MessageablePerson.d.ts] *modified time* //// [/home/src/workspaces/project/MessageablePerson.js] *modified time* @@ -429,22 +421,19 @@ Output:: "size": 697 } - SemanticDiagnostics:: *refresh* /home/src/workspaces/project/MessageablePerson.ts *refresh* /home/src/workspaces/project/main.ts - Signatures:: (computed .d.ts) /home/src/workspaces/project/MessageablePerson.ts (computed .d.ts) /home/src/workspaces/project/main.ts -Edit:: no change +Edit [4]:: no change -ExitStatus:: 0 +tsgo --incremental +ExitStatus:: Success Output:: - SemanticDiagnostics:: - Signatures:: diff --git a/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js index 037ef10f65..4c23251b15 100644 --- a/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js +++ b/testdata/baselines/reference/tsc/incremental/change-to-modifier-of-class-expression-field.js @@ -1,7 +1,6 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true -Input::--incremental +Input:: //// [/home/src/tslibs/TS/Lib/lib.d.ts] *new* /// interface Boolean {} @@ -48,11 +47,8 @@ function logMessage( person: MessageablePerson ) { } } -ExitStatus:: 0 - -CompilerOptions::{ - "incremental": true -} +tsgo --incremental +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/MessageablePerson.js] *new* const Messageable = () => { @@ -121,27 +117,24 @@ export {}; "size": 452 } - SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/MessageablePerson.ts *refresh* /home/src/workspaces/project/main.ts - Signatures:: -Edit:: no change +Edit [0]:: no change -ExitStatus:: 0 +tsgo --incremental +ExitStatus:: Success Output:: - SemanticDiagnostics:: - Signatures:: -Edit:: modify public to protected +Edit [1]:: modify public to protected //// [/home/src/workspaces/project/MessageablePerson.ts] *modified* const Messageable = () => { return class MessageableClass { @@ -152,7 +145,8 @@ const wrapper = () => Messageable(); type MessageablePerson = InstanceType>; export default MessageablePerson; -ExitStatus:: 2 +tsgo --incremental +ExitStatus:: DiagnosticsPresent_OutputsGenerated Output:: main.ts:3:25 - error TS2445: Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses. @@ -240,19 +234,18 @@ Found 1 error in main.ts:3 "size": 878 } - SemanticDiagnostics:: *refresh* /home/src/workspaces/project/MessageablePerson.ts *refresh* /home/src/workspaces/project/main.ts - Signatures:: (computed .d.ts) /home/src/workspaces/project/MessageablePerson.ts (computed .d.ts) /home/src/workspaces/project/main.ts -Edit:: no change +Edit [2]:: no change -ExitStatus:: 2 +tsgo --incremental +ExitStatus:: DiagnosticsPresent_OutputsGenerated Output:: main.ts:3:25 - error TS2445: Property 'message' is protected and only accessible within class 'MessageableClass' and its subclasses. @@ -263,13 +256,11 @@ Output:: Found 1 error in main.ts:3 - SemanticDiagnostics:: - Signatures:: -Edit:: modify protected to public +Edit [3]:: modify protected to public //// [/home/src/workspaces/project/MessageablePerson.ts] *modified* const Messageable = () => { return class MessageableClass { @@ -280,7 +271,8 @@ const wrapper = () => Messageable(); type MessageablePerson = InstanceType>; export default MessageablePerson; -ExitStatus:: 0 +tsgo --incremental +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/MessageablePerson.js] *modified time* //// [/home/src/workspaces/project/main.js] *modified time* @@ -346,22 +338,19 @@ Output:: "size": 678 } - SemanticDiagnostics:: *refresh* /home/src/workspaces/project/MessageablePerson.ts *refresh* /home/src/workspaces/project/main.ts - Signatures:: (computed .d.ts) /home/src/workspaces/project/MessageablePerson.ts (computed .d.ts) /home/src/workspaces/project/main.ts -Edit:: no change +Edit [4]:: no change -ExitStatus:: 0 +tsgo --incremental +ExitStatus:: Success Output:: - SemanticDiagnostics:: - Signatures:: diff --git a/testdata/baselines/reference/tsc/incremental/change-to-type-that-gets-used-as-global-through-export-in-another-file-through-indirect-import.js b/testdata/baselines/reference/tsc/incremental/change-to-type-that-gets-used-as-global-through-export-in-another-file-through-indirect-import.js index 6dc702dbbe..9bf1968b23 100644 --- a/testdata/baselines/reference/tsc/incremental/change-to-type-that-gets-used-as-global-through-export-in-another-file-through-indirect-import.js +++ b/testdata/baselines/reference/tsc/incremental/change-to-type-that-gets-used-as-global-through-export-in-another-file-through-indirect-import.js @@ -1,4 +1,3 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true Input:: @@ -18,9 +17,8 @@ export { default as ConstantNumber } from "./constants" //// [/home/src/workspaces/project/types.d.ts] *new* type MagicNumber = typeof import('./reexport').ConstantNumber -ExitStatus:: 0 - -CompilerOptions::{} +tsgo +ExitStatus:: Success Output:: //// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* /// @@ -167,25 +165,24 @@ Object.defineProperty(exports, "ConstantNumber", { enumerable: true, get: functi "size": 1092 } - SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/class1.ts *refresh* /home/src/workspaces/project/constants.ts *refresh* /home/src/workspaces/project/reexport.ts *refresh* /home/src/workspaces/project/types.d.ts - Signatures:: (stored at emit) /home/src/workspaces/project/class1.ts (stored at emit) /home/src/workspaces/project/constants.ts (stored at emit) /home/src/workspaces/project/reexport.ts -Edit:: Modify imports used in global file +Edit [0]:: Modify imports used in global file //// [/home/src/workspaces/project/constants.ts] *modified* export default 2; -ExitStatus:: 0 +tsgo +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/constants.js] *modified* "use strict"; @@ -288,9 +285,7 @@ exports.default = 2; "size": 1092 } - SemanticDiagnostics:: *refresh* /home/src/workspaces/project/constants.ts - Signatures:: (computed .d.ts) /home/src/workspaces/project/constants.ts diff --git a/testdata/baselines/reference/tsc/incremental/change-to-type-that-gets-used-as-global-through-export-in-another-file.js b/testdata/baselines/reference/tsc/incremental/change-to-type-that-gets-used-as-global-through-export-in-another-file.js index cb5a0c2474..0b096011e9 100644 --- a/testdata/baselines/reference/tsc/incremental/change-to-type-that-gets-used-as-global-through-export-in-another-file.js +++ b/testdata/baselines/reference/tsc/incremental/change-to-type-that-gets-used-as-global-through-export-in-another-file.js @@ -1,4 +1,3 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true Input:: @@ -16,9 +15,8 @@ export default 1; //// [/home/src/workspaces/project/types.d.ts] *new* type MagicNumber = typeof import('./constants').default -ExitStatus:: 0 - -CompilerOptions::{} +tsgo +ExitStatus:: Success Output:: //// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* /// @@ -137,23 +135,22 @@ exports.default = 1; "size": 887 } - SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/class1.ts *refresh* /home/src/workspaces/project/constants.ts *refresh* /home/src/workspaces/project/types.d.ts - Signatures:: (stored at emit) /home/src/workspaces/project/class1.ts (stored at emit) /home/src/workspaces/project/constants.ts -Edit:: Modify imports used in global file +Edit [0]:: Modify imports used in global file //// [/home/src/workspaces/project/constants.ts] *modified* export default 2; -ExitStatus:: 0 +tsgo +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/constants.js] *modified* "use strict"; @@ -238,9 +235,7 @@ exports.default = 2; "size": 887 } - SemanticDiagnostics:: *refresh* /home/src/workspaces/project/constants.ts - Signatures:: (computed .d.ts) /home/src/workspaces/project/constants.ts diff --git a/testdata/baselines/reference/tsc/incremental/const-enums-aliased-in-different-file.js b/testdata/baselines/reference/tsc/incremental/const-enums-aliased-in-different-file.js index 3cb3922fc6..84089129ff 100644 --- a/testdata/baselines/reference/tsc/incremental/const-enums-aliased-in-different-file.js +++ b/testdata/baselines/reference/tsc/incremental/const-enums-aliased-in-different-file.js @@ -1,7 +1,6 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true -Input::-i a.ts --tsbuildinfofile a.tsbuildinfo +Input:: //// [/home/src/workspaces/project/a.ts] *new* import {A} from "./c" let a = A.ONE @@ -16,12 +15,8 @@ export const enum AWorker { ONE = 1 } -ExitStatus:: 0 - -CompilerOptions::{ - "incremental": true, - "tsBuildInfoFile": "/home/src/workspaces/project/a.tsbuildinfo" -} +tsgo -i a.ts --tsbuildinfofile a.tsbuildinfo +ExitStatus:: Success Output:: //// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* /// @@ -134,24 +129,23 @@ Object.defineProperty(exports, "__esModule", { value: true }); let b = b_1.A.ONE; - SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/worker.d.ts *refresh* /home/src/workspaces/project/b.d.ts *refresh* /home/src/workspaces/project/c.ts *refresh* /home/src/workspaces/project/a.ts - Signatures:: -Edit:: change enum value +Edit [0]:: change enum value //// [/home/src/workspaces/project/worker.d.ts] *modified* export const enum AWorker { ONE = 2 } -ExitStatus:: 0 +tsgo -i a.ts --tsbuildinfofile a.tsbuildinfo +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/a.js] *modified time* //// [/home/src/workspaces/project/a.tsbuildinfo] *modified* @@ -233,13 +227,11 @@ Output:: } //// [/home/src/workspaces/project/c.js] *modified time* - SemanticDiagnostics:: *refresh* /home/src/workspaces/project/worker.d.ts *refresh* /home/src/workspaces/project/b.d.ts *refresh* /home/src/workspaces/project/c.ts *refresh* /home/src/workspaces/project/a.ts - Signatures:: (used version) /home/src/workspaces/project/worker.d.ts (used version) /home/src/workspaces/project/b.d.ts @@ -247,13 +239,14 @@ Signatures:: (used version) /home/src/workspaces/project/a.ts -Edit:: change enum value again +Edit [1]:: change enum value again //// [/home/src/workspaces/project/worker.d.ts] *modified* export const enum AWorker { ONE = 3 } -ExitStatus:: 0 +tsgo -i a.ts --tsbuildinfofile a.tsbuildinfo +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/a.js] *modified time* //// [/home/src/workspaces/project/a.tsbuildinfo] *modified* @@ -335,13 +328,11 @@ Output:: } //// [/home/src/workspaces/project/c.js] *modified time* - SemanticDiagnostics:: *refresh* /home/src/workspaces/project/worker.d.ts *refresh* /home/src/workspaces/project/b.d.ts *refresh* /home/src/workspaces/project/c.ts *refresh* /home/src/workspaces/project/a.ts - Signatures:: (used version) /home/src/workspaces/project/worker.d.ts (used version) /home/src/workspaces/project/b.d.ts @@ -349,11 +340,12 @@ Signatures:: (used version) /home/src/workspaces/project/a.ts -Edit:: something else changes in b.d.ts +Edit [2]:: something else changes in b.d.ts //// [/home/src/workspaces/project/b.d.ts] *modified* export { AWorker as A } from "./worker";export const randomThing = 10; -ExitStatus:: 0 +tsgo -i a.ts --tsbuildinfofile a.tsbuildinfo +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/a.js] *modified time* //// [/home/src/workspaces/project/a.tsbuildinfo] *modified* @@ -445,23 +437,22 @@ Output:: } //// [/home/src/workspaces/project/c.js] *modified time* - SemanticDiagnostics:: *refresh* /home/src/workspaces/project/b.d.ts *refresh* /home/src/workspaces/project/c.ts *refresh* /home/src/workspaces/project/a.ts - Signatures:: (used version) /home/src/workspaces/project/b.d.ts (computed .d.ts) /home/src/workspaces/project/c.ts (computed .d.ts) /home/src/workspaces/project/a.ts -Edit:: something else changes in b.d.ts again +Edit [3]:: something else changes in b.d.ts again //// [/home/src/workspaces/project/b.d.ts] *modified* export { AWorker as A } from "./worker";export const randomThing = 10;export const randomThing2 = 10; -ExitStatus:: 0 +tsgo -i a.ts --tsbuildinfofile a.tsbuildinfo +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/a.tsbuildinfo] *modified* {"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./worker.d.ts","./b.d.ts","./c.ts","./a.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},"9429bb2451db350f9bceba9041b64c9b80446ebfd5c423802bdee3ac2cd0fccc","fc3df7c9dd67a05ea3329c1a9ef9c5f81ddb2109cc13c2089aef6c5dbef34340",{"version":"f96307fd3b2531524ba186a0b7862e9605da65828664c51363d0b608f8141c8a","signature":"1affdd1113604735d4499c03d6271d13972094ddab6991610e72d53c00d14732","impliedNodeFormat":1},"f5a433d8f46180a7988f1820c3e70520cbbc864a870e4f6cdd4857edf3688e09"],"fileIdsList":[[4],[2],[3]],"options":{"tsBuildInfoFile":"./a.tsbuildinfo"},"referencedMap":[[5,1],[3,2],[4,3]]} @@ -547,12 +538,10 @@ Output:: } //// [/home/src/workspaces/project/c.js] *modified time* - SemanticDiagnostics:: *refresh* /home/src/workspaces/project/b.d.ts *refresh* /home/src/workspaces/project/c.ts *refresh* /home/src/workspaces/project/a.ts - Signatures:: (used version) /home/src/workspaces/project/b.d.ts (computed .d.ts) /home/src/workspaces/project/c.ts diff --git a/testdata/baselines/reference/tsc/incremental/const-enums-aliased.js b/testdata/baselines/reference/tsc/incremental/const-enums-aliased.js index 41e57cd505..0854a823a3 100644 --- a/testdata/baselines/reference/tsc/incremental/const-enums-aliased.js +++ b/testdata/baselines/reference/tsc/incremental/const-enums-aliased.js @@ -1,7 +1,6 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true -Input::-i a.ts --tsbuildinfofile a.tsbuildinfo +Input:: //// [/home/src/workspaces/project/a.ts] *new* import {A} from "./c" let a = A.ONE @@ -19,12 +18,8 @@ export const enum AWorker { ONE = 1 } -ExitStatus:: 0 - -CompilerOptions::{ - "incremental": true, - "tsBuildInfoFile": "/home/src/workspaces/project/a.tsbuildinfo" -} +tsgo -i a.ts --tsbuildinfofile a.tsbuildinfo +ExitStatus:: Success Output:: //// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* /// @@ -124,24 +119,23 @@ Object.defineProperty(exports, "__esModule", { value: true }); let b = b_1.A.ONE; - SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/b.d.ts *refresh* /home/src/workspaces/project/c.ts *refresh* /home/src/workspaces/project/a.ts - Signatures:: -Edit:: change enum value +Edit [0]:: change enum value //// [/home/src/workspaces/project/b.d.ts] *modified* export const enum AWorker { ONE = 2 } export { AWorker as A }; -ExitStatus:: 0 +tsgo -i a.ts --tsbuildinfofile a.tsbuildinfo +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/a.js] *modified time* //// [/home/src/workspaces/project/a.tsbuildinfo] *modified* @@ -220,26 +214,25 @@ Output:: } //// [/home/src/workspaces/project/c.js] *modified time* - SemanticDiagnostics:: *refresh* /home/src/workspaces/project/b.d.ts *refresh* /home/src/workspaces/project/c.ts *refresh* /home/src/workspaces/project/a.ts - Signatures:: (used version) /home/src/workspaces/project/b.d.ts (computed .d.ts) /home/src/workspaces/project/c.ts (computed .d.ts) /home/src/workspaces/project/a.ts -Edit:: change enum value again +Edit [1]:: change enum value again //// [/home/src/workspaces/project/b.d.ts] *modified* export const enum AWorker { ONE = 3 } export { AWorker as A }; -ExitStatus:: 0 +tsgo -i a.ts --tsbuildinfofile a.tsbuildinfo +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/a.js] *modified time* //// [/home/src/workspaces/project/a.tsbuildinfo] *modified* @@ -313,26 +306,25 @@ Output:: } //// [/home/src/workspaces/project/c.js] *modified time* - SemanticDiagnostics:: *refresh* /home/src/workspaces/project/b.d.ts *refresh* /home/src/workspaces/project/c.ts *refresh* /home/src/workspaces/project/a.ts - Signatures:: (used version) /home/src/workspaces/project/b.d.ts (computed .d.ts) /home/src/workspaces/project/c.ts (used version) /home/src/workspaces/project/a.ts -Edit:: something else changes in b.d.ts +Edit [2]:: something else changes in b.d.ts //// [/home/src/workspaces/project/b.d.ts] *modified* export const enum AWorker { ONE = 3 } export { AWorker as A };export const randomThing = 10; -ExitStatus:: 0 +tsgo -i a.ts --tsbuildinfofile a.tsbuildinfo +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/a.js] *modified time* //// [/home/src/workspaces/project/a.tsbuildinfo] *modified* @@ -406,26 +398,25 @@ Output:: } //// [/home/src/workspaces/project/c.js] *modified time* - SemanticDiagnostics:: *refresh* /home/src/workspaces/project/b.d.ts *refresh* /home/src/workspaces/project/c.ts *refresh* /home/src/workspaces/project/a.ts - Signatures:: (used version) /home/src/workspaces/project/b.d.ts (computed .d.ts) /home/src/workspaces/project/c.ts (used version) /home/src/workspaces/project/a.ts -Edit:: something else changes in b.d.ts again +Edit [3]:: something else changes in b.d.ts again //// [/home/src/workspaces/project/b.d.ts] *modified* export const enum AWorker { ONE = 3 } export { AWorker as A };export const randomThing = 10;export const randomThing2 = 10; -ExitStatus:: 0 +tsgo -i a.ts --tsbuildinfofile a.tsbuildinfo +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/a.js] *modified time* //// [/home/src/workspaces/project/a.tsbuildinfo] *modified* @@ -499,12 +490,10 @@ Output:: } //// [/home/src/workspaces/project/c.js] *modified time* - SemanticDiagnostics:: *refresh* /home/src/workspaces/project/b.d.ts *refresh* /home/src/workspaces/project/c.ts *refresh* /home/src/workspaces/project/a.ts - Signatures:: (used version) /home/src/workspaces/project/b.d.ts (computed .d.ts) /home/src/workspaces/project/c.ts diff --git a/testdata/baselines/reference/tsc/incremental/const-enums.js b/testdata/baselines/reference/tsc/incremental/const-enums.js index 50258c40b9..b8cedf72a4 100644 --- a/testdata/baselines/reference/tsc/incremental/const-enums.js +++ b/testdata/baselines/reference/tsc/incremental/const-enums.js @@ -1,7 +1,6 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true -Input::-i a.ts --tsbuildinfofile a.tsbuildinfo +Input:: //// [/home/src/workspaces/project/a.ts] *new* import {A} from "./c" let a = A.ONE @@ -18,12 +17,8 @@ export const enum AWorker { ONE = 1 } -ExitStatus:: 0 - -CompilerOptions::{ - "incremental": true, - "tsBuildInfoFile": "/home/src/workspaces/project/a.tsbuildinfo" -} +tsgo -i a.ts --tsbuildinfofile a.tsbuildinfo +ExitStatus:: Success Output:: //// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* /// @@ -123,23 +118,22 @@ Object.defineProperty(exports, "__esModule", { value: true }); let b = b_1.A.ONE; - SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/b.d.ts *refresh* /home/src/workspaces/project/c.ts *refresh* /home/src/workspaces/project/a.ts - Signatures:: -Edit:: change enum value +Edit [0]:: change enum value //// [/home/src/workspaces/project/b.d.ts] *modified* export const enum A { ONE = 2 } -ExitStatus:: 0 +tsgo -i a.ts --tsbuildinfofile a.tsbuildinfo +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/a.js] *modified time* //// [/home/src/workspaces/project/a.tsbuildinfo] *modified* @@ -218,25 +212,24 @@ Output:: } //// [/home/src/workspaces/project/c.js] *modified time* - SemanticDiagnostics:: *refresh* /home/src/workspaces/project/b.d.ts *refresh* /home/src/workspaces/project/c.ts *refresh* /home/src/workspaces/project/a.ts - Signatures:: (used version) /home/src/workspaces/project/b.d.ts (computed .d.ts) /home/src/workspaces/project/c.ts (computed .d.ts) /home/src/workspaces/project/a.ts -Edit:: change enum value again +Edit [1]:: change enum value again //// [/home/src/workspaces/project/b.d.ts] *modified* export const enum A { ONE = 3 } -ExitStatus:: 0 +tsgo -i a.ts --tsbuildinfofile a.tsbuildinfo +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/a.js] *modified time* //// [/home/src/workspaces/project/a.tsbuildinfo] *modified* @@ -310,25 +303,24 @@ Output:: } //// [/home/src/workspaces/project/c.js] *modified time* - SemanticDiagnostics:: *refresh* /home/src/workspaces/project/b.d.ts *refresh* /home/src/workspaces/project/c.ts *refresh* /home/src/workspaces/project/a.ts - Signatures:: (used version) /home/src/workspaces/project/b.d.ts (computed .d.ts) /home/src/workspaces/project/c.ts (used version) /home/src/workspaces/project/a.ts -Edit:: something else changes in b.d.ts +Edit [2]:: something else changes in b.d.ts //// [/home/src/workspaces/project/b.d.ts] *modified* export const enum A { ONE = 3 }export const randomThing = 10; -ExitStatus:: 0 +tsgo -i a.ts --tsbuildinfofile a.tsbuildinfo +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/a.js] *modified time* //// [/home/src/workspaces/project/a.tsbuildinfo] *modified* @@ -402,25 +394,24 @@ Output:: } //// [/home/src/workspaces/project/c.js] *modified time* - SemanticDiagnostics:: *refresh* /home/src/workspaces/project/b.d.ts *refresh* /home/src/workspaces/project/c.ts *refresh* /home/src/workspaces/project/a.ts - Signatures:: (used version) /home/src/workspaces/project/b.d.ts (computed .d.ts) /home/src/workspaces/project/c.ts (used version) /home/src/workspaces/project/a.ts -Edit:: something else changes in b.d.ts again +Edit [3]:: something else changes in b.d.ts again //// [/home/src/workspaces/project/b.d.ts] *modified* export const enum A { ONE = 3 }export const randomThing = 10;export const randomThing2 = 10; -ExitStatus:: 0 +tsgo -i a.ts --tsbuildinfofile a.tsbuildinfo +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/a.js] *modified time* //// [/home/src/workspaces/project/a.tsbuildinfo] *modified* @@ -494,12 +485,10 @@ Output:: } //// [/home/src/workspaces/project/c.js] *modified time* - SemanticDiagnostics:: *refresh* /home/src/workspaces/project/b.d.ts *refresh* /home/src/workspaces/project/c.ts *refresh* /home/src/workspaces/project/a.ts - Signatures:: (used version) /home/src/workspaces/project/b.d.ts (computed .d.ts) /home/src/workspaces/project/c.ts diff --git a/testdata/baselines/reference/tsc/incremental/generates-typerefs-correctly.js b/testdata/baselines/reference/tsc/incremental/generates-typerefs-correctly.js index eb64462f48..446b0f8ce4 100644 --- a/testdata/baselines/reference/tsc/incremental/generates-typerefs-correctly.js +++ b/testdata/baselines/reference/tsc/incremental/generates-typerefs-correctly.js @@ -1,4 +1,3 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true Input:: @@ -39,9 +38,8 @@ export type Wrap = { "include": ["src"], } -ExitStatus:: 0 - -CompilerOptions::{} +tsgo +ExitStatus:: Success Output:: //// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* /// @@ -192,20 +190,18 @@ Object.defineProperty(exports, "__esModule", { value: true }); "size": 950 } - SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/src/box.ts *refresh* /home/src/workspaces/project/src/wrap.ts *refresh* /home/src/workspaces/project/src/bug.js - Signatures:: (stored at emit) /home/src/workspaces/project/src/box.ts (stored at emit) /home/src/workspaces/project/src/wrap.ts (stored at emit) /home/src/workspaces/project/src/bug.js -Edit:: modify js file +Edit [0]:: modify js file //// [/home/src/workspaces/project/src/bug.js] *modified* import * as B from "./box.js" import * as W from "./wrap.js" @@ -226,7 +222,8 @@ const box = (n = 0) => ({ unbox: () => n }) export const bug = wrap({ n: box(1) });export const something = 1; -ExitStatus:: 0 +tsgo +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/outDir/src/bug.d.ts] *modified* import * as B from "./box.js"; @@ -336,9 +333,7 @@ exports.something = 1; "size": 949 } - SemanticDiagnostics:: *refresh* /home/src/workspaces/project/src/bug.js - Signatures:: (computed .d.ts) /home/src/workspaces/project/src/bug.js diff --git a/testdata/baselines/reference/tsc/incremental/option-changes-with-composite.js b/testdata/baselines/reference/tsc/incremental/option-changes-with-composite.js index 58dc802472..22b04fff53 100644 --- a/testdata/baselines/reference/tsc/incremental/option-changes-with-composite.js +++ b/testdata/baselines/reference/tsc/incremental/option-changes-with-composite.js @@ -1,4 +1,3 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true Input:: @@ -17,9 +16,8 @@ import { b } from "./b";export const d = b; } } -ExitStatus:: 0 - -CompilerOptions::{} +tsgo +ExitStatus:: Success Output:: //// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* /// @@ -177,14 +175,12 @@ exports.d = b_1.b; "size": 1086 } - SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts *refresh* /home/src/workspaces/project/b.ts *refresh* /home/src/workspaces/project/c.ts *refresh* /home/src/workspaces/project/d.ts - Signatures:: (stored at emit) /home/src/workspaces/project/a.ts (stored at emit) /home/src/workspaces/project/b.ts @@ -192,9 +188,10 @@ Signatures:: (stored at emit) /home/src/workspaces/project/d.ts -Edit:: with sourceMap +Edit [0]:: with sourceMap -ExitStatus:: 0 +tsgo --sourceMap +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/a.js] *modified* "use strict"; @@ -326,15 +323,14 @@ exports.d = b_1.b; "size": 1103 } - SemanticDiagnostics:: - Signatures:: -Edit:: should re-emit only js so they dont contain sourcemap +Edit [1]:: should re-emit only js so they dont contain sourcemap -ExitStatus:: 0 +tsgo +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/a.js] *modified* "use strict"; @@ -457,37 +453,34 @@ exports.d = b_1.b; "size": 1086 } - SemanticDiagnostics:: - Signatures:: -Edit:: with declaration should not emit anything +Edit [2]:: with declaration should not emit anything -ExitStatus:: 0 +tsgo --declaration +ExitStatus:: Success Output:: - SemanticDiagnostics:: - Signatures:: -Edit:: no change +Edit [3]:: no change -ExitStatus:: 0 +tsgo +ExitStatus:: Success Output:: - SemanticDiagnostics:: - Signatures:: -Edit:: with declaration and declarationMap +Edit [4]:: with declaration and declarationMap -ExitStatus:: 0 +tsgo --declaration --declarationMap +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/a.d.ts] *modified* export declare const a = 10; @@ -604,15 +597,14 @@ export declare const d = 10; "size": 1127 } - SemanticDiagnostics:: - Signatures:: -Edit:: should re-emit only dts so they dont contain sourcemap +Edit [5]:: should re-emit only dts so they dont contain sourcemap -ExitStatus:: 0 +tsgo +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/a.d.ts] *modified* export declare const a = 10; @@ -719,39 +711,36 @@ export declare const d = 10; "size": 1086 } - SemanticDiagnostics:: - Signatures:: -Edit:: with emitDeclarationOnly should not emit anything +Edit [6]:: with emitDeclarationOnly should not emit anything -ExitStatus:: 0 +tsgo --emitDeclarationOnly +ExitStatus:: Success Output:: - SemanticDiagnostics:: - Signatures:: -Edit:: no change +Edit [7]:: no change -ExitStatus:: 0 +tsgo +ExitStatus:: Success Output:: - SemanticDiagnostics:: - Signatures:: -Edit:: local change +Edit [8]:: local change //// [/home/src/workspaces/project/a.ts] *modified* export const a = 10;const aLocal = 100; -ExitStatus:: 0 +tsgo +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/a.js] *modified* "use strict"; @@ -853,28 +842,26 @@ const aLocal = 100; "size": 1086 } - SemanticDiagnostics:: *refresh* /home/src/workspaces/project/a.ts - Signatures:: (computed .d.ts) /home/src/workspaces/project/a.ts -Edit:: with declaration should not emit anything +Edit [9]:: with declaration should not emit anything -ExitStatus:: 0 +tsgo --declaration +ExitStatus:: Success Output:: - SemanticDiagnostics:: - Signatures:: -Edit:: with inlineSourceMap +Edit [10]:: with inlineSourceMap -ExitStatus:: 0 +tsgo --inlineSourceMap +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/a.js] *modified* "use strict"; @@ -998,15 +985,14 @@ exports.d = b_1.b; "size": 1109 } - SemanticDiagnostics:: - Signatures:: -Edit:: with sourceMap +Edit [11]:: with sourceMap -ExitStatus:: 0 +tsgo --sourceMap +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/a.js] *modified* "use strict"; @@ -1135,13 +1121,11 @@ exports.d = b_1.b; "size": 1103 } - SemanticDiagnostics:: - Signatures:: -Edit:: declarationMap enabling +Edit [12]:: declarationMap enabling //// [/home/src/workspaces/project/tsconfig.json] *modified* { "compilerOptions": { @@ -1149,7 +1133,8 @@ Edit:: declarationMap enabling } } -ExitStatus:: 0 +tsgo +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/a.d.ts] *modified* export declare const a = 10; @@ -1289,15 +1274,14 @@ exports.d = b_1.b; "size": 1108 } - SemanticDiagnostics:: - Signatures:: -Edit:: with sourceMap should not emit d.ts +Edit [13]:: with sourceMap should not emit d.ts -ExitStatus:: 0 +tsgo --sourceMap +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/a.js] *modified* "use strict"; @@ -1426,7 +1410,5 @@ exports.d = b_1.b; "size": 1125 } - SemanticDiagnostics:: - Signatures:: diff --git a/testdata/baselines/reference/tsc/incremental/option-changes-with-incremental.js b/testdata/baselines/reference/tsc/incremental/option-changes-with-incremental.js index 643e3d3c21..14cb4655a7 100644 --- a/testdata/baselines/reference/tsc/incremental/option-changes-with-incremental.js +++ b/testdata/baselines/reference/tsc/incremental/option-changes-with-incremental.js @@ -1,4 +1,3 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true Input:: @@ -17,9 +16,8 @@ import { b } from "./b";export const d = b; } } -ExitStatus:: 0 - -CompilerOptions::{} +tsgo +ExitStatus:: Success Output:: //// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* /// @@ -141,20 +139,19 @@ exports.d = b_1.b; "size": 571 } - SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts *refresh* /home/src/workspaces/project/b.ts *refresh* /home/src/workspaces/project/c.ts *refresh* /home/src/workspaces/project/d.ts - Signatures:: -Edit:: with sourceMap +Edit [0]:: with sourceMap -ExitStatus:: 0 +tsgo --sourceMap +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/a.js] *modified* "use strict"; @@ -264,15 +261,14 @@ exports.d = b_1.b; "size": 600 } - SemanticDiagnostics:: - Signatures:: -Edit:: should re-emit only js so they dont contain sourcemap +Edit [1]:: should re-emit only js so they dont contain sourcemap -ExitStatus:: 0 +tsgo +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/a.js] *modified* "use strict"; @@ -371,15 +367,14 @@ exports.d = b_1.b; "size": 571 } - SemanticDiagnostics:: - Signatures:: -Edit:: with declaration, emit Dts and should not emit js +Edit [2]:: with declaration, emit Dts and should not emit js -ExitStatus:: 0 +tsgo --declaration +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/a.d.ts] *new* export declare const a = 10; @@ -485,9 +480,7 @@ export declare const d = 10; "size": 1054 } - SemanticDiagnostics:: - Signatures:: (stored at emit) /home/src/workspaces/project/a.ts (stored at emit) /home/src/workspaces/project/b.ts @@ -495,9 +488,10 @@ Signatures:: (stored at emit) /home/src/workspaces/project/d.ts -Edit:: with declaration and declarationMap +Edit [3]:: with declaration and declarationMap -ExitStatus:: 0 +tsgo --declaration --declarationMap +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/a.d.ts] *modified* export declare const a = 10; @@ -612,28 +606,26 @@ export declare const d = 10; "size": 1076 } - SemanticDiagnostics:: - Signatures:: -Edit:: no change +Edit [4]:: no change -ExitStatus:: 0 +tsgo +ExitStatus:: Success Output:: - SemanticDiagnostics:: - Signatures:: -Edit:: local change +Edit [5]:: local change //// [/home/src/workspaces/project/a.ts] *modified* export const a = 10;const aLocal = 100; -ExitStatus:: 0 +tsgo +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/a.js] *modified* "use strict"; @@ -731,17 +723,16 @@ const aLocal = 100; "size": 1023 } - SemanticDiagnostics:: *refresh* /home/src/workspaces/project/a.ts - Signatures:: (computed .d.ts) /home/src/workspaces/project/a.ts -Edit:: with declaration and declarationMap +Edit [6]:: with declaration and declarationMap -ExitStatus:: 0 +tsgo --declaration --declarationMap +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/a.d.ts] *modified time* //// [/home/src/workspaces/project/a.d.ts.map] *modified time* @@ -844,26 +835,24 @@ Output:: "size": 1076 } - SemanticDiagnostics:: - Signatures:: -Edit:: no change +Edit [7]:: no change -ExitStatus:: 0 +tsgo +ExitStatus:: Success Output:: - SemanticDiagnostics:: - Signatures:: -Edit:: with inlineSourceMap +Edit [8]:: with inlineSourceMap -ExitStatus:: 0 +tsgo --inlineSourceMap +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/a.js] *modified* "use strict"; @@ -985,15 +974,14 @@ exports.d = b_1.b; "size": 1058 } - SemanticDiagnostics:: - Signatures:: -Edit:: with sourceMap +Edit [9]:: with sourceMap -ExitStatus:: 0 +tsgo --sourceMap +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/a.js] *modified* "use strict"; @@ -1120,15 +1108,14 @@ exports.d = b_1.b; "size": 1052 } - SemanticDiagnostics:: - Signatures:: -Edit:: emit js files +Edit [10]:: emit js files -ExitStatus:: 0 +tsgo +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/a.js] *modified* "use strict"; @@ -1247,15 +1234,14 @@ exports.d = b_1.b; "size": 1023 } - SemanticDiagnostics:: - Signatures:: -Edit:: with declaration and declarationMap +Edit [11]:: with declaration and declarationMap -ExitStatus:: 0 +tsgo --declaration --declarationMap +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/a.d.ts] *modified time* //// [/home/src/workspaces/project/a.d.ts.map] *modified time* @@ -1358,18 +1344,15 @@ Output:: "size": 1076 } - SemanticDiagnostics:: - Signatures:: -Edit:: with declaration and declarationMap, should not re-emit +Edit [12]:: with declaration and declarationMap, should not re-emit -ExitStatus:: 0 +tsgo --declaration --declarationMap +ExitStatus:: Success Output:: - SemanticDiagnostics:: - Signatures:: diff --git a/testdata/baselines/reference/tsc/incremental/react-jsx-emit-mode-with-no-backing-types-found-doesn't-crash-under---strict.js b/testdata/baselines/reference/tsc/incremental/react-jsx-emit-mode-with-no-backing-types-found-doesn't-crash-under---strict.js index 25e07e541a..230eac62a4 100644 --- a/testdata/baselines/reference/tsc/incremental/react-jsx-emit-mode-with-no-backing-types-found-doesn't-crash-under---strict.js +++ b/testdata/baselines/reference/tsc/incremental/react-jsx-emit-mode-with-no-backing-types-found-doesn't-crash-under---strict.js @@ -1,7 +1,6 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true -Input::--strict +Input:: //// [/home/src/workspaces/project/node_modules/@types/react/index.d.ts] *new* export {}; declare global { @@ -28,11 +27,8 @@ export const App = () =>
; } } -ExitStatus:: 2 - -CompilerOptions::{ - "strict": true -} +tsgo --strict +ExitStatus:: DiagnosticsPresent_OutputsGenerated Output:: src/index.tsx:1:26 - error TS7016: Could not find a declaration file for module 'react/jsx-runtime'. '/home/src/workspaces/project/node_modules/react/jsx-runtime.js' implicitly has an 'any' type. @@ -138,10 +134,8 @@ exports.App = App; "size": 792 } - SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/src/index.tsx *refresh* /home/src/workspaces/project/node_modules/@types/react/index.d.ts - Signatures:: diff --git a/testdata/baselines/reference/tsc/incremental/react-jsx-emit-mode-with-no-backing-types-found-doesn't-crash.js b/testdata/baselines/reference/tsc/incremental/react-jsx-emit-mode-with-no-backing-types-found-doesn't-crash.js index 9d22ecd749..091c815849 100644 --- a/testdata/baselines/reference/tsc/incremental/react-jsx-emit-mode-with-no-backing-types-found-doesn't-crash.js +++ b/testdata/baselines/reference/tsc/incremental/react-jsx-emit-mode-with-no-backing-types-found-doesn't-crash.js @@ -1,4 +1,3 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true Input:: @@ -28,9 +27,8 @@ export const App = () =>
; } } -ExitStatus:: 0 - -CompilerOptions::{} +tsgo +ExitStatus:: Success Output:: //// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* /// @@ -113,10 +111,8 @@ exports.App = App; "size": 523 } - SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/src/index.tsx *refresh* /home/src/workspaces/project/node_modules/@types/react/index.d.ts - Signatures:: diff --git a/testdata/baselines/reference/tsc/incremental/serializing-composite-project.js b/testdata/baselines/reference/tsc/incremental/serializing-composite-project.js index 911fe49f89..a148974652 100644 --- a/testdata/baselines/reference/tsc/incremental/serializing-composite-project.js +++ b/testdata/baselines/reference/tsc/incremental/serializing-composite-project.js @@ -1,4 +1,3 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true Input:: @@ -15,9 +14,8 @@ export const b = 2; }, } -ExitStatus:: 0 - -CompilerOptions::{} +tsgo +ExitStatus:: Success Output:: //// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* /// @@ -109,12 +107,10 @@ export const b = 2; "size": 693 } - SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/index.tsx *refresh* /home/src/workspaces/project/other.ts - Signatures:: (stored at emit) /home/src/workspaces/project/index.tsx (stored at emit) /home/src/workspaces/project/other.ts diff --git a/testdata/baselines/reference/tsc/incremental/serializing-error-chain.js b/testdata/baselines/reference/tsc/incremental/serializing-error-chain.js index 5edc004713..3b08685838 100644 --- a/testdata/baselines/reference/tsc/incremental/serializing-error-chain.js +++ b/testdata/baselines/reference/tsc/incremental/serializing-error-chain.js @@ -1,4 +1,3 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true Input:: @@ -26,9 +25,8 @@ declare function Component(props: { children?: number }): any; }, } -ExitStatus:: 2 - -CompilerOptions::{} +tsgo +ExitStatus:: DiagnosticsPresent_OutputsGenerated Output:: index.tsx:10:3 - error TS2769: No overload matches this call. The last overload gave the following error. @@ -174,17 +172,16 @@ declare const console: { log(msg: any): void; }; "size": 1181 } - SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/index.tsx - Signatures:: -Edit:: no change +Edit [0]:: no change -ExitStatus:: 2 +tsgo +ExitStatus:: DiagnosticsPresent_OutputsGenerated Output:: index.tsx:10:3 - error TS2769: No overload matches this call. The last overload gave the following error. @@ -203,7 +200,5 @@ Output:: Found 1 error in index.tsx:10 - SemanticDiagnostics:: - Signatures:: diff --git a/testdata/baselines/reference/tsc/incremental/tsbuildinfo-has-error.js b/testdata/baselines/reference/tsc/incremental/tsbuildinfo-has-error.js index 7d10786ece..5cc8b88155 100644 --- a/testdata/baselines/reference/tsc/incremental/tsbuildinfo-has-error.js +++ b/testdata/baselines/reference/tsc/incremental/tsbuildinfo-has-error.js @@ -1,7 +1,6 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true -Input::-i +Input:: //// [/home/src/workspaces/project/main.ts] *new* export const x = 10; //// [/home/src/workspaces/project/tsconfig.json] *new* @@ -9,11 +8,8 @@ export const x = 10; //// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *new* Some random string -ExitStatus:: 0 - -CompilerOptions::{ - "incremental": true -} +tsgo -i +ExitStatus:: Success Output:: //// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* /// @@ -76,28 +72,25 @@ exports.x = 10; "size": 292 } - SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/main.ts - Signatures:: -Edit:: tsbuildinfo written has error +Edit [0]:: tsbuildinfo written has error //// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* Some random string{"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./main.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},"03da4d6a46cc7950ba861120c64b47c14bc80b3c64f47ef17b61cb454358afd6"]} -ExitStatus:: 0 +tsgo -i +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/main.js] *modified time* //// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* {"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./main.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},"03da4d6a46cc7950ba861120c64b47c14bc80b3c64f47ef17b61cb454358afd6"]} //// [/home/src/workspaces/project/tsconfig.tsbuildinfo.readable.baseline.txt] *modified time* - SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/main.ts - Signatures:: diff --git a/testdata/baselines/reference/tsc/incremental/when-file-is-deleted.js b/testdata/baselines/reference/tsc/incremental/when-file-is-deleted.js index 8e2b068e81..c61ce7ee47 100644 --- a/testdata/baselines/reference/tsc/incremental/when-file-is-deleted.js +++ b/testdata/baselines/reference/tsc/incremental/when-file-is-deleted.js @@ -1,4 +1,3 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true Input:: @@ -14,9 +13,8 @@ export class D { } } } -ExitStatus:: 0 - -CompilerOptions::{} +tsgo +ExitStatus:: Success Output:: //// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* /// @@ -119,21 +117,20 @@ exports.D = D; "size": 685 } - SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/file1.ts *refresh* /home/src/workspaces/project/file2.ts - Signatures:: (stored at emit) /home/src/workspaces/project/file1.ts (stored at emit) /home/src/workspaces/project/file2.ts -Edit:: delete file with imports +Edit [0]:: delete file with imports //// [/home/src/workspaces/project/file2.ts] *deleted* -ExitStatus:: 0 +tsgo +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/outDir/tsconfig.tsbuildinfo] *modified* {"version":"FakeTSVersion","fileNames":["../../../tslibs/TS/Lib/lib.d.ts","../file1.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"e8197812b523db314f9f43881cab045172bec1a6893c27b62a52b128afbb19da","signature":"33031a47f740dde897da491c7c6ac0ef2224f9c807448ba058aadba8abd00433","impliedNodeFormat":1}],"options":{"composite":true,"outDir":"./"},"latestChangedDtsFile":"./file2.d.ts"} @@ -177,7 +174,5 @@ Output:: "size": 491 } - SemanticDiagnostics:: - Signatures:: diff --git a/testdata/baselines/reference/tsc/incremental/when-global-file-is-added,-the-signatures-are-updated.js b/testdata/baselines/reference/tsc/incremental/when-global-file-is-added,-the-signatures-are-updated.js index 1831a5edaa..0f911b20fe 100644 --- a/testdata/baselines/reference/tsc/incremental/when-global-file-is-added,-the-signatures-are-updated.js +++ b/testdata/baselines/reference/tsc/incremental/when-global-file-is-added,-the-signatures-are-updated.js @@ -1,4 +1,3 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true Input:: @@ -18,9 +17,8 @@ function main() { } "include": ["src/**/*.ts"], } -ExitStatus:: 0 - -CompilerOptions::{} +tsgo +ExitStatus:: Success Output:: //// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* /// @@ -155,37 +153,35 @@ function main() { } "size": 1056 } - SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/src/filePresent.ts *refresh* /home/src/workspaces/project/src/anotherFileWithSameReferenes.ts *refresh* /home/src/workspaces/project/src/main.ts - Signatures:: (stored at emit) /home/src/workspaces/project/src/filePresent.ts (stored at emit) /home/src/workspaces/project/src/anotherFileWithSameReferenes.ts (stored at emit) /home/src/workspaces/project/src/main.ts -Edit:: no change +Edit [0]:: no change -ExitStatus:: 0 +tsgo +ExitStatus:: Success Output:: - SemanticDiagnostics:: - Signatures:: -Edit:: Modify main file +Edit [1]:: Modify main file //// [/home/src/workspaces/project/src/main.ts] *modified* /// /// function main() { }something(); -ExitStatus:: 0 +tsgo +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/src/main.js] *modified* /// @@ -281,21 +277,20 @@ something(); "size": 1056 } - SemanticDiagnostics:: *refresh* /home/src/workspaces/project/src/main.ts - Signatures:: (computed .d.ts) /home/src/workspaces/project/src/main.ts -Edit:: Modify main file again +Edit [2]:: Modify main file again //// [/home/src/workspaces/project/src/main.ts] *modified* /// /// function main() { }something();something(); -ExitStatus:: 0 +tsgo +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/src/main.js] *modified* /// @@ -392,15 +387,13 @@ something(); "size": 1056 } - SemanticDiagnostics:: *refresh* /home/src/workspaces/project/src/main.ts - Signatures:: (computed .d.ts) /home/src/workspaces/project/src/main.ts -Edit:: Add new file and update main file +Edit [3]:: Add new file and update main file //// [/home/src/workspaces/project/src/main.ts] *modified* /// /// @@ -409,7 +402,8 @@ function main() { }something();something();foo(); //// [/home/src/workspaces/project/src/newFile.ts] *new* function foo() { return 20; } -ExitStatus:: 0 +tsgo +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/src/main.js] *modified* /// @@ -534,22 +528,21 @@ function foo() { return 20; } "size": 1292 } - SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/src/newFile.ts *refresh* /home/src/workspaces/project/src/main.ts - Signatures:: (computed .d.ts) /home/src/workspaces/project/src/newFile.ts (computed .d.ts) /home/src/workspaces/project/src/main.ts -Edit:: Write file that could not be resolved +Edit [4]:: Write file that could not be resolved //// [/home/src/workspaces/project/src/fileNotFound.ts] *new* function something2() { return 20; } -ExitStatus:: 0 +tsgo +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/src/anotherFileWithSameReferenes.js] *modified time* //// [/home/src/workspaces/project/src/fileNotFound.d.ts] *new* @@ -680,27 +673,26 @@ function something2() { return 20; } "size": 1503 } - SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/src/fileNotFound.ts *refresh* /home/src/workspaces/project/src/anotherFileWithSameReferenes.ts *refresh* /home/src/workspaces/project/src/main.ts - Signatures:: (computed .d.ts) /home/src/workspaces/project/src/fileNotFound.ts (computed .d.ts) /home/src/workspaces/project/src/anotherFileWithSameReferenes.ts (computed .d.ts) /home/src/workspaces/project/src/main.ts -Edit:: Modify main file +Edit [5]:: Modify main file //// [/home/src/workspaces/project/src/main.ts] *modified* /// /// /// function main() { }something();something();foo();something(); -ExitStatus:: 0 +tsgo +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/src/main.js] *modified* /// @@ -833,9 +825,7 @@ something(); "size": 1503 } - SemanticDiagnostics:: *refresh* /home/src/workspaces/project/src/main.ts - Signatures:: (computed .d.ts) /home/src/workspaces/project/src/main.ts diff --git a/testdata/baselines/reference/tsc/incremental/when-passing-filename-for-buildinfo-on-commandline.js b/testdata/baselines/reference/tsc/incremental/when-passing-filename-for-buildinfo-on-commandline.js index f3c6d2af93..bfb383dd4d 100644 --- a/testdata/baselines/reference/tsc/incremental/when-passing-filename-for-buildinfo-on-commandline.js +++ b/testdata/baselines/reference/tsc/incremental/when-passing-filename-for-buildinfo-on-commandline.js @@ -1,7 +1,6 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true -Input::--incremental --tsBuildInfoFile .tsbuildinfo --explainFiles +Input:: //// [/home/src/workspaces/project/src/main.ts] *new* export const x = 10; //// [/home/src/workspaces/project/tsconfig.json] *new* @@ -15,13 +14,8 @@ export const x = 10; ], } -ExitStatus:: 0 - -CompilerOptions::{ - "incremental": true, - "tsBuildInfoFile": "/home/src/workspaces/project/.tsbuildinfo", - "explainFiles": true -} +tsgo --incremental --tsBuildInfoFile .tsbuildinfo --explainFiles +ExitStatus:: Success Output:: //// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* /// @@ -89,20 +83,17 @@ exports.x = void 0; exports.x = 10; - SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/src/main.ts - Signatures:: -Edit:: no change +Edit [0]:: no change -ExitStatus:: 0 +tsgo --incremental --tsBuildInfoFile .tsbuildinfo --explainFiles +ExitStatus:: Success Output:: - SemanticDiagnostics:: - Signatures:: diff --git a/testdata/baselines/reference/tsc/incremental/when-passing-rootDir-from-commandline.js b/testdata/baselines/reference/tsc/incremental/when-passing-rootDir-from-commandline.js index 3a6c5629cc..1fef30924b 100644 --- a/testdata/baselines/reference/tsc/incremental/when-passing-rootDir-from-commandline.js +++ b/testdata/baselines/reference/tsc/incremental/when-passing-rootDir-from-commandline.js @@ -1,7 +1,6 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true -Input::--rootDir src +Input:: //// [/home/src/workspaces/project/src/main.ts] *new* export const x = 10; //// [/home/src/workspaces/project/tsconfig.json] *new* @@ -12,11 +11,8 @@ export const x = 10; } } -ExitStatus:: 0 - -CompilerOptions::{ - "rootDir": "/home/src/workspaces/project/src" -} +tsgo --rootDir src +ExitStatus:: Success Output:: //// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* /// @@ -83,20 +79,17 @@ exports.x = 10; "size": 344 } - SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/src/main.ts - Signatures:: -Edit:: no change +Edit [0]:: no change -ExitStatus:: 0 +tsgo --rootDir src +ExitStatus:: Success Output:: - SemanticDiagnostics:: - Signatures:: diff --git a/testdata/baselines/reference/tsc/incremental/when-passing-rootDir-is-in-the-tsconfig.js b/testdata/baselines/reference/tsc/incremental/when-passing-rootDir-is-in-the-tsconfig.js index 7fbbfcbfc6..c8d109fbdc 100644 --- a/testdata/baselines/reference/tsc/incremental/when-passing-rootDir-is-in-the-tsconfig.js +++ b/testdata/baselines/reference/tsc/incremental/when-passing-rootDir-is-in-the-tsconfig.js @@ -1,4 +1,3 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true Input:: @@ -13,9 +12,8 @@ export const x = 10; } } -ExitStatus:: 0 - -CompilerOptions::{} +tsgo +ExitStatus:: Success Output:: //// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* /// @@ -82,20 +80,17 @@ exports.x = 10; "size": 341 } - SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/src/main.ts - Signatures:: -Edit:: no change +Edit [0]:: no change -ExitStatus:: 0 +tsgo +ExitStatus:: Success Output:: - SemanticDiagnostics:: - Signatures:: diff --git a/testdata/baselines/reference/tsc/incremental/with-only-dts-files.js b/testdata/baselines/reference/tsc/incremental/with-only-dts-files.js index 37fffb174e..9799c50afd 100644 --- a/testdata/baselines/reference/tsc/incremental/with-only-dts-files.js +++ b/testdata/baselines/reference/tsc/incremental/with-only-dts-files.js @@ -1,7 +1,6 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true -Input::--incremental +Input:: //// [/home/src/workspaces/project/src/another.d.ts] *new* export const y = 10; //// [/home/src/workspaces/project/src/main.d.ts] *new* @@ -9,11 +8,8 @@ export const x = 10; //// [/home/src/workspaces/project/tsconfig.json] *new* {} -ExitStatus:: 0 - -CompilerOptions::{ - "incremental": true -} +tsgo --incremental +ExitStatus:: Success Output:: //// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* /// @@ -77,31 +73,29 @@ declare const console: { log(msg: any): void; }; "size": 386 } - SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/src/another.d.ts *refresh* /home/src/workspaces/project/src/main.d.ts - Signatures:: -Edit:: no change +Edit [0]:: no change -ExitStatus:: 0 +tsgo --incremental +ExitStatus:: Success Output:: - SemanticDiagnostics:: - Signatures:: -Edit:: modify d.ts file +Edit [1]:: modify d.ts file //// [/home/src/workspaces/project/src/main.d.ts] *modified* export const x = 10;export const xy = 100; -ExitStatus:: 0 +tsgo --incremental +ExitStatus:: Success Output:: //// [/home/src/workspaces/project/tsconfig.tsbuildinfo] *modified* {"version":"FakeTSVersion","fileNames":["../../tslibs/TS/Lib/lib.d.ts","./src/another.d.ts","./src/main.d.ts"],"fileInfos":[{"version":"7dee939514de4bde7a51760a39e2b3bfa068bfc4a2939e1dbad2bfdf2dc4662e","affectsGlobalScope":true,"impliedNodeFormat":1},"4aa16e9a67a4820d1dc51507221b4c73b5626b3a759d79d7147ad4eabe37ef49","a701af2196ad5afd5fe2fb1f6c1c9ad538b85b9e4c37d747738ecc7f5d609540"]} @@ -142,9 +136,7 @@ Output:: "size": 386 } - SemanticDiagnostics:: *refresh* /home/src/workspaces/project/src/main.d.ts - Signatures:: (used version) /home/src/workspaces/project/src/main.d.ts diff --git a/testdata/baselines/reference/tsc/noCheck/dts-errors.js b/testdata/baselines/reference/tsc/noCheck/dts-errors.js index 45e165d641..bb4c9ed306 100644 --- a/testdata/baselines/reference/tsc/noCheck/dts-errors.js +++ b/testdata/baselines/reference/tsc/noCheck/dts-errors.js @@ -1,7 +1,6 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true -Input::--noCheck --outFile built +Input:: //// [/home/src/workspaces/project/a.ts] *new* export const a = class { private p = 10; }; //// [/home/src/workspaces/project/b.ts] *new* @@ -13,12 +12,8 @@ export const b = 10; } } -ExitStatus:: 2 - -CompilerOptions::{ - "noCheck": true, - "outFile": "/home/src/workspaces/project/built" -} +tsgo --noCheck --outFile built +ExitStatus:: DiagnosticsPresent_OutputsGenerated Output:: a.ts:1:14 - error TS4094: Property 'p' of exported anonymous class type may not be private or protected. diff --git a/testdata/baselines/reference/tsc/noCheck/semantic-errors.js b/testdata/baselines/reference/tsc/noCheck/semantic-errors.js index ac27f6563e..4d4ac5b7ce 100644 --- a/testdata/baselines/reference/tsc/noCheck/semantic-errors.js +++ b/testdata/baselines/reference/tsc/noCheck/semantic-errors.js @@ -1,7 +1,6 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true -Input::--noCheck --outFile built +Input:: //// [/home/src/workspaces/project/a.ts] *new* export const a: number = "hello"; //// [/home/src/workspaces/project/b.ts] *new* @@ -13,12 +12,8 @@ export const b = 10; } } -ExitStatus:: 0 - -CompilerOptions::{ - "noCheck": true, - "outFile": "/home/src/workspaces/project/built" -} +tsgo --noCheck --outFile built +ExitStatus:: Success Output:: //// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* /// diff --git a/testdata/baselines/reference/tsc/noCheck/syntax-errors.js b/testdata/baselines/reference/tsc/noCheck/syntax-errors.js index 65bd9f3638..157206b286 100644 --- a/testdata/baselines/reference/tsc/noCheck/syntax-errors.js +++ b/testdata/baselines/reference/tsc/noCheck/syntax-errors.js @@ -1,7 +1,6 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true -Input::--noCheck --outFile built +Input:: //// [/home/src/workspaces/project/a.ts] *new* export const a = "hello //// [/home/src/workspaces/project/b.ts] *new* @@ -13,12 +12,8 @@ export const b = 10; } } -ExitStatus:: 2 - -CompilerOptions::{ - "noCheck": true, - "outFile": "/home/src/workspaces/project/built" -} +tsgo --noCheck --outFile built +ExitStatus:: DiagnosticsPresent_OutputsGenerated Output:: a.ts:1:24 - error TS1002: Unterminated string literal. diff --git a/testdata/baselines/reference/tsc/noEmit/when-project-has-strict-true.js b/testdata/baselines/reference/tsc/noEmit/when-project-has-strict-true.js index 8678e174a9..861a304540 100644 --- a/testdata/baselines/reference/tsc/noEmit/when-project-has-strict-true.js +++ b/testdata/baselines/reference/tsc/noEmit/when-project-has-strict-true.js @@ -1,7 +1,6 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true -Input::--noEmit +Input:: //// [/home/src/workspaces/project/class1.ts] *new* export class class1 {} //// [/home/src/workspaces/project/tsconfig.json] *new* @@ -12,11 +11,8 @@ export class class1 {} } } -ExitStatus:: 0 - -CompilerOptions::{ - "noEmit": true -} +tsgo --noEmit +ExitStatus:: Success Output:: //// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* /// @@ -83,9 +79,7 @@ declare const console: { log(msg: any): void; }; "size": 351 } - SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/class1.ts - Signatures:: diff --git a/testdata/baselines/reference/tsc/projectReferences/default-import-interop-uses-referenced-project-settings.js b/testdata/baselines/reference/tsc/projectReferences/default-import-interop-uses-referenced-project-settings.js index f62b45303d..abc2590be1 100644 --- a/testdata/baselines/reference/tsc/projectReferences/default-import-interop-uses-referenced-project-settings.js +++ b/testdata/baselines/reference/tsc/projectReferences/default-import-interop-uses-referenced-project-settings.js @@ -1,7 +1,6 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true -Input::--p app --pretty false +Input:: //// [/home/src/workspaces/project/app/src/index.ts] *new* import local from "./local"; // Error import esm from "esm-package"; // Error @@ -53,12 +52,8 @@ export declare const esm: number; "type": "module" } -ExitStatus:: 2 - -CompilerOptions::{ - "project": "/home/src/workspaces/project/app", - "pretty": false -} +tsgo --p app --pretty false +ExitStatus:: DiagnosticsPresent_OutputsGenerated Output:: app/src/index.ts(1,8): error TS2613: Module '"/home/src/workspaces/project/app/src/local"' has no default export. Did you mean to use 'import { local } from "/home/src/workspaces/project/app/src/local"' instead? diff --git a/testdata/baselines/reference/tsc/projectReferences/importing-const-enum-from-referenced-project-with-preserveConstEnums-and-verbatimModuleSyntax.js b/testdata/baselines/reference/tsc/projectReferences/importing-const-enum-from-referenced-project-with-preserveConstEnums-and-verbatimModuleSyntax.js index 732486c5d6..1bb030b983 100644 --- a/testdata/baselines/reference/tsc/projectReferences/importing-const-enum-from-referenced-project-with-preserveConstEnums-and-verbatimModuleSyntax.js +++ b/testdata/baselines/reference/tsc/projectReferences/importing-const-enum-from-referenced-project-with-preserveConstEnums-and-verbatimModuleSyntax.js @@ -1,7 +1,6 @@ - currentDirectory::/home/src/workspaces/solution useCaseSensitiveFileNames::true -Input::--p project --pretty false +Input:: //// [/home/src/workspaces/solution/no-preserve/index.d.ts] *new* export declare const enum F { A = 1 } //// [/home/src/workspaces/solution/no-preserve/index.ts] *new* @@ -43,12 +42,8 @@ F.A; ], } -ExitStatus:: 2 - -CompilerOptions::{ - "project": "/home/src/workspaces/solution/project", - "pretty": false -} +tsgo --p project --pretty false +ExitStatus:: DiagnosticsPresent_OutputsGenerated Output:: project/index.ts(2,10): error TS2748: Cannot access ambient const enums when 'verbatimModuleSyntax' is enabled. //// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* diff --git a/testdata/baselines/reference/tsc/projectReferences/referencing-ambient-const-enum-from-referenced-project-with-preserveConstEnums.js b/testdata/baselines/reference/tsc/projectReferences/referencing-ambient-const-enum-from-referenced-project-with-preserveConstEnums.js index 76dded2871..378f04e0d4 100644 --- a/testdata/baselines/reference/tsc/projectReferences/referencing-ambient-const-enum-from-referenced-project-with-preserveConstEnums.js +++ b/testdata/baselines/reference/tsc/projectReferences/referencing-ambient-const-enum-from-referenced-project-with-preserveConstEnums.js @@ -1,7 +1,6 @@ - currentDirectory::/home/src/workspaces/solution useCaseSensitiveFileNames::true -Input::--p project +Input:: //// [/home/src/workspaces/solution/project/index.ts] *new* import { E } from "../utils"; E.A; //// [/home/src/workspaces/solution/project/tsconfig.json] *new* @@ -26,11 +25,8 @@ export const enum E { A = 1 } }, } -ExitStatus:: 0 - -CompilerOptions::{ - "project": "/home/src/workspaces/solution/project" -} +tsgo --p project +ExitStatus:: Success Output:: //// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* /// diff --git a/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences1.js b/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences1.js index 4702776b66..b0b402f89e 100644 --- a/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences1.js +++ b/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences1.js @@ -1,7 +1,6 @@ - currentDirectory::/home/src/workspaces useCaseSensitiveFileNames::true -Input::-p packages/main --pretty false +Input:: //// [/home/src/workspaces/packages/common/dist/index.d.ts] *new* export {}; //// [/home/src/workspaces/packages/common/package.json] *new* @@ -46,12 +45,8 @@ import {} from "../../common/src/index.ts"; ] } -ExitStatus:: 2 - -CompilerOptions::{ - "project": "/home/src/workspaces/packages/main", - "pretty": false -} +tsgo -p packages/main --pretty false +ExitStatus:: DiagnosticsPresent_OutputsGenerated Output:: packages/main/src/index.ts(1,16): error TS2878: This import path is unsafe to rewrite because it resolves to another project, and the relative path between the projects' output files is not the same as the relative path between its input files. //// [/home/src/tslibs/TS/Lib/lib.esnext.full.d.ts] *Lib* diff --git a/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences2.js b/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences2.js index 140b8e8dbd..5b453dfe1b 100644 --- a/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences2.js +++ b/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences2.js @@ -1,7 +1,6 @@ - currentDirectory::/home/src/workspaces/solution useCaseSensitiveFileNames::true -Input::--p src/services --pretty false +Input:: //// [/home/src/workspaces/solution/dist/compiler/parser.d.ts] *new* export {}; //// [/home/src/workspaces/solution/src/compiler/parser.ts] *new* @@ -32,12 +31,8 @@ import {} from "../compiler/parser.ts"; } } -ExitStatus:: 0 - -CompilerOptions::{ - "project": "/home/src/workspaces/solution/src/services", - "pretty": false -} +tsgo --p src/services --pretty false +ExitStatus:: Success Output:: No output //// [/home/src/tslibs/TS/Lib/lib.esnext.full.d.ts] *Lib* @@ -132,11 +127,9 @@ Object.defineProperty(exports, "__esModule", { value: true }); "size": 739 } - SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.esnext.full.d.ts *refresh* /home/src/workspaces/solution/dist/compiler/parser.d.ts *refresh* /home/src/workspaces/solution/src/services/services.ts - Signatures:: (stored at emit) /home/src/workspaces/solution/src/services/services.ts diff --git a/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences3.js b/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences3.js index 783489570b..0befe5286d 100644 --- a/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences3.js +++ b/testdata/baselines/reference/tsc/projectReferences/rewriteRelativeImportExtensionsProjectReferences3.js @@ -1,7 +1,6 @@ - currentDirectory::/home/src/workspaces/solution useCaseSensitiveFileNames::true -Input::--p src/services --pretty false +Input:: //// [/home/src/workspaces/solution/dist/compiler/parser.d.ts] *new* export {}; //// [/home/src/workspaces/solution/src/compiler/parser.ts] *new* @@ -36,12 +35,8 @@ import {} from "../compiler/parser.ts"; } } -ExitStatus:: 0 - -CompilerOptions::{ - "project": "/home/src/workspaces/solution/src/services", - "pretty": false -} +tsgo --p src/services --pretty false +ExitStatus:: Success Output:: No output //// [/home/src/tslibs/TS/Lib/lib.esnext.full.d.ts] *Lib* @@ -136,11 +131,9 @@ Object.defineProperty(exports, "__esModule", { value: true }); "size": 748 } - SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.esnext.full.d.ts *refresh* /home/src/workspaces/solution/dist/compiler/parser.d.ts *refresh* /home/src/workspaces/solution/src/services/services.ts - Signatures:: (stored at emit) /home/src/workspaces/solution/src/services/services.ts diff --git a/testdata/baselines/reference/tsc/projectReferences/when-project-contains-invalid-project-reference.js b/testdata/baselines/reference/tsc/projectReferences/when-project-contains-invalid-project-reference.js index a9acf0b00f..de6b4ec1f6 100644 --- a/testdata/baselines/reference/tsc/projectReferences/when-project-contains-invalid-project-reference.js +++ b/testdata/baselines/reference/tsc/projectReferences/when-project-contains-invalid-project-reference.js @@ -1,7 +1,6 @@ - currentDirectory::/home/src/workspaces/solution useCaseSensitiveFileNames::true -Input::--p project +Input:: //// [/home/src/workspaces/solution/project/index.ts] *new* export const x = 10; //// [/home/src/workspaces/solution/project/tsconfig.json] *new* @@ -11,11 +10,8 @@ export const x = 10; ], } -ExitStatus:: 0 - -CompilerOptions::{ - "project": "/home/src/workspaces/solution/project" -} +tsgo --p project +ExitStatus:: Success Output:: //// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* /// diff --git a/testdata/baselines/reference/tsc/projectReferences/when-project-reference-is-not-built.js b/testdata/baselines/reference/tsc/projectReferences/when-project-reference-is-not-built.js index 71f3370c6a..b7ebae5101 100644 --- a/testdata/baselines/reference/tsc/projectReferences/when-project-reference-is-not-built.js +++ b/testdata/baselines/reference/tsc/projectReferences/when-project-reference-is-not-built.js @@ -1,7 +1,6 @@ - currentDirectory::/home/src/workspaces/solution useCaseSensitiveFileNames::true -Input::--p project +Input:: //// [/home/src/workspaces/solution/project/index.ts] *new* import { x } from "../utils"; //// [/home/src/workspaces/solution/project/tsconfig.json] *new* @@ -19,11 +18,8 @@ export const x = 10; } } -ExitStatus:: 2 - -CompilerOptions::{ - "project": "/home/src/workspaces/solution/project" -} +tsgo --p project +ExitStatus:: DiagnosticsPresent_OutputsGenerated Output:: project/index.ts:1:19 - error TS6305: Output file '/home/src/workspaces/solution/utils/index.d.ts' has not been built from source file '/home/src/workspaces/solution/utils/index.ts'. diff --git a/testdata/baselines/reference/tsc/projectReferences/when-project-references-composite-project-with-noEmit.js b/testdata/baselines/reference/tsc/projectReferences/when-project-references-composite-project-with-noEmit.js index 1abc0e6f8c..d7310b8cb3 100644 --- a/testdata/baselines/reference/tsc/projectReferences/when-project-references-composite-project-with-noEmit.js +++ b/testdata/baselines/reference/tsc/projectReferences/when-project-references-composite-project-with-noEmit.js @@ -1,7 +1,6 @@ - currentDirectory::/home/src/workspaces/solution useCaseSensitiveFileNames::true -Input::--p project +Input:: //// [/home/src/workspaces/solution/project/index.ts] *new* import { x } from "../utils"; //// [/home/src/workspaces/solution/project/tsconfig.json] *new* @@ -20,11 +19,8 @@ export const x = 10; } } -ExitStatus:: 2 - -CompilerOptions::{ - "project": "/home/src/workspaces/solution/project" -} +tsgo --p project +ExitStatus:: DiagnosticsPresent_OutputsGenerated Output:: project/index.ts:1:19 - error TS6305: Output file '/home/src/workspaces/solution/utils/index.d.ts' has not been built from source file '/home/src/workspaces/solution/utils/index.ts'. diff --git a/testdata/baselines/reference/tsc/projectReferences/when-project-references-composite.js b/testdata/baselines/reference/tsc/projectReferences/when-project-references-composite.js index 703add34d1..8d701b99f7 100644 --- a/testdata/baselines/reference/tsc/projectReferences/when-project-references-composite.js +++ b/testdata/baselines/reference/tsc/projectReferences/when-project-references-composite.js @@ -1,7 +1,6 @@ - currentDirectory::/home/src/workspaces/solution useCaseSensitiveFileNames::true -Input::--p project +Input:: //// [/home/src/workspaces/solution/project/index.ts] *new* import { x } from "../utils"; //// [/home/src/workspaces/solution/project/tsconfig.json] *new* @@ -21,11 +20,8 @@ export const x = 10; } } -ExitStatus:: 0 - -CompilerOptions::{ - "project": "/home/src/workspaces/solution/project" -} +tsgo --p project +ExitStatus:: Success Output:: //// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* /// diff --git a/testdata/baselines/reference/tsc/typeAcquisition/parse-tsconfig-with-typeAcquisition.js b/testdata/baselines/reference/tsc/typeAcquisition/parse-tsconfig-with-typeAcquisition.js index a2b3785438..afadeecb5e 100644 --- a/testdata/baselines/reference/tsc/typeAcquisition/parse-tsconfig-with-typeAcquisition.js +++ b/testdata/baselines/reference/tsc/typeAcquisition/parse-tsconfig-with-typeAcquisition.js @@ -1,4 +1,3 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true Input:: @@ -16,9 +15,8 @@ Input:: }, } -ExitStatus:: 1 - -CompilerOptions::{} +tsgo +ExitStatus:: DiagnosticsPresent_OutputsSkipped Output:: error TS18003: No inputs were found in config file '/home/src/workspaces/project/tsconfig.json'. Specified 'include' paths were '["**/*"]' and 'exclude' paths were '[]'. @@ -78,8 +76,6 @@ declare const console: { log(msg: any): void; }; "size": 275 } - SemanticDiagnostics:: *not cached* /home/src/tslibs/TS/Lib/lib.d.ts - Signatures:: diff --git a/testdata/baselines/reference/tscWatch/commandLine/Parse-watch-interval-option-without-tsconfig.json.js b/testdata/baselines/reference/tscWatch/commandLine/Parse-watch-interval-option-without-tsconfig.json.js index 0cde9201d9..d7bf239951 100644 --- a/testdata/baselines/reference/tscWatch/commandLine/Parse-watch-interval-option-without-tsconfig.json.js +++ b/testdata/baselines/reference/tscWatch/commandLine/Parse-watch-interval-option-without-tsconfig.json.js @@ -1,36 +1,9 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true -Input::-w --watchInterval 1000 - -ExitStatus:: 1 - -ParsedCommandLine::{ - "parsedConfig": { - "compilerOptions": { - "watch": true - }, - "watchOptions": { - "watchInterval": 1000, - "watchFile": 0, - "watchDirectory": 0, - "fallbackPolling": 0, - "synchronousWatchDirectory": null, - "excludeDirectories": null, - "excludeFiles": null - }, - "typeAcquisition": null, - "fileNames": [], - "projectReferences": null - }, - "configFile": null, - "errors": [], - "raw": { - "watch": true, - "watchInterval": 1000 - }, - "compileOnSave": null -} +Input:: + +tsgo -w --watchInterval 1000 +ExitStatus:: DiagnosticsPresent_OutputsSkipped Output:: Version FakeTSVersion diff --git a/testdata/baselines/reference/tscWatch/commandLine/Parse-watch-interval-option.js b/testdata/baselines/reference/tscWatch/commandLine/Parse-watch-interval-option.js index 4128d40177..fbff1dd2bb 100644 --- a/testdata/baselines/reference/tscWatch/commandLine/Parse-watch-interval-option.js +++ b/testdata/baselines/reference/tscWatch/commandLine/Parse-watch-interval-option.js @@ -1,7 +1,6 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true -Input::-w --watchInterval 1000 +Input:: //// [/home/src/workspaces/project/first.ts] *new* export const a = 1 //// [/home/src/workspaces/project/tsconfig.json] *new* @@ -12,34 +11,8 @@ export const a = 1 } } -ExitStatus:: 0 - -ParsedCommandLine::{ - "parsedConfig": { - "compilerOptions": { - "watch": true - }, - "watchOptions": { - "watchInterval": 1000, - "watchFile": 0, - "watchDirectory": 0, - "fallbackPolling": 0, - "synchronousWatchDirectory": null, - "excludeDirectories": null, - "excludeFiles": null - }, - "typeAcquisition": null, - "fileNames": [], - "projectReferences": null - }, - "configFile": null, - "errors": [], - "raw": { - "watch": true, - "watchInterval": 1000 - }, - "compileOnSave": null -} +tsgo -w --watchInterval 1000 +ExitStatus:: Success Output:: //// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* /// @@ -65,3 +38,7 @@ interface Symbol { } declare const console: { log(msg: any): void; }; +SemanticDiagnostics:: +*refresh* /home/src/tslibs/TS/Lib/lib.d.ts +*refresh* /home/src/workspaces/project/first.ts +Signatures:: diff --git a/testdata/baselines/reference/tscWatch/commandLineWatch/watch-with-no-tsconfig.js b/testdata/baselines/reference/tscWatch/commandLineWatch/watch-with-no-tsconfig.js index 824fd53354..fcf71f7645 100644 --- a/testdata/baselines/reference/tscWatch/commandLineWatch/watch-with-no-tsconfig.js +++ b/testdata/baselines/reference/tscWatch/commandLineWatch/watch-with-no-tsconfig.js @@ -1,15 +1,11 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true -Input::index.ts --watch +Input:: //// [/home/src/workspaces/project/index.ts] *new* -ExitStatus:: 0 - -CompilerOptions::{ - "watch": true -} +tsgo index.ts --watch +ExitStatus:: Success Output:: //// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* /// @@ -37,9 +33,7 @@ declare const console: { log(msg: any): void; }; //// [/home/src/workspaces/project/index.js] *new* - SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/index.ts - Signatures:: diff --git a/testdata/baselines/reference/tscWatch/noEmit/dts-errors-without-dts-enabled.js b/testdata/baselines/reference/tscWatch/noEmit/dts-errors-without-dts-enabled.js index c1655abe70..a426806d75 100644 --- a/testdata/baselines/reference/tscWatch/noEmit/dts-errors-without-dts-enabled.js +++ b/testdata/baselines/reference/tscWatch/noEmit/dts-errors-without-dts-enabled.js @@ -1,7 +1,6 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true -Input::-w +Input:: //// [/home/src/workspaces/project/a.ts] *new* const a = class { private p = 10; }; //// [/home/src/workspaces/project/tsconfig.json] *new* @@ -11,11 +10,8 @@ const a = class { private p = 10; }; } } -ExitStatus:: 0 - -CompilerOptions::{ - "watch": true -} +tsgo -w +ExitStatus:: Success Output:: //// [/home/src/tslibs/TS/Lib/lib.d.ts] *Lib* /// @@ -41,31 +37,27 @@ interface Symbol { } declare const console: { log(msg: any): void; }; - SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts - Signatures:: -Edit:: fix error +Edit [0]:: fix error //// [/home/src/workspaces/project/a.ts] *modified* const a = "hello"; Output:: - SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts - Signatures:: (computed .d.ts) /home/src/workspaces/project/a.ts -Edit:: emit after fixing error +Edit [1]:: emit after fixing error //// [/home/src/workspaces/project/tsconfig.json] *modified* { "compilerOptions": { @@ -79,13 +71,11 @@ Output:: const a = "hello"; - SemanticDiagnostics:: - Signatures:: -Edit:: no emit run after fixing error +Edit [2]:: no emit run after fixing error //// [/home/src/workspaces/project/tsconfig.json] *modified* { "compilerOptions": { @@ -97,29 +87,25 @@ Edit:: no emit run after fixing error Output:: - SemanticDiagnostics:: - Signatures:: -Edit:: introduce error +Edit [3]:: introduce error //// [/home/src/workspaces/project/a.ts] *modified* const a = class { private p = 10; }; Output:: - SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts - Signatures:: (computed .d.ts) /home/src/workspaces/project/a.ts -Edit:: emit when error +Edit [4]:: emit when error //// [/home/src/workspaces/project/tsconfig.json] *modified* { "compilerOptions": { @@ -135,13 +121,11 @@ const a = class { }; - SemanticDiagnostics:: - Signatures:: -Edit:: no emit run when error +Edit [5]:: no emit run when error //// [/home/src/workspaces/project/tsconfig.json] *modified* { "compilerOptions": { @@ -153,7 +137,5 @@ Edit:: no emit run when error Output:: - SemanticDiagnostics:: - Signatures:: diff --git a/testdata/baselines/reference/tscWatch/noEmit/dts-errors.js b/testdata/baselines/reference/tscWatch/noEmit/dts-errors.js index 32ceb0e02e..633939b3e4 100644 --- a/testdata/baselines/reference/tscWatch/noEmit/dts-errors.js +++ b/testdata/baselines/reference/tscWatch/noEmit/dts-errors.js @@ -1,7 +1,6 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true -Input::-w +Input:: //// [/home/src/workspaces/project/a.ts] *new* const a = class { private p = 10; }; //// [/home/src/workspaces/project/tsconfig.json] *new* @@ -12,11 +11,8 @@ const a = class { private p = 10; }; } } -ExitStatus:: 0 - -CompilerOptions::{ - "watch": true -} +tsgo -w +ExitStatus:: Success Output:: a.ts:1:7 - error TS4094: Property 'p' of exported anonymous class type may not be private or protected. @@ -54,31 +50,27 @@ interface Symbol { } declare const console: { log(msg: any): void; }; - SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts - Signatures:: -Edit:: fix error +Edit [0]:: fix error //// [/home/src/workspaces/project/a.ts] *modified* const a = "hello"; Output:: - SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts - Signatures:: (computed .d.ts) /home/src/workspaces/project/a.ts -Edit:: emit after fixing error +Edit [1]:: emit after fixing error //// [/home/src/workspaces/project/tsconfig.json] *modified* { "compilerOptions": { @@ -95,13 +87,11 @@ declare const a = "hello"; const a = "hello"; - SemanticDiagnostics:: - Signatures:: -Edit:: no emit run after fixing error +Edit [2]:: no emit run after fixing error //// [/home/src/workspaces/project/tsconfig.json] *modified* { "compilerOptions": { @@ -113,13 +103,11 @@ Edit:: no emit run after fixing error Output:: - SemanticDiagnostics:: - Signatures:: -Edit:: introduce error +Edit [3]:: introduce error //// [/home/src/workspaces/project/a.ts] *modified* const a = class { private p = 10; }; @@ -138,16 +126,14 @@ Output:: Found 1 error in a.ts:1 - SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts - Signatures:: (computed .d.ts) /home/src/workspaces/project/a.ts -Edit:: emit when error +Edit [4]:: emit when error //// [/home/src/workspaces/project/tsconfig.json] *modified* { "compilerOptions": { @@ -182,13 +168,11 @@ const a = class { }; - SemanticDiagnostics:: - Signatures:: -Edit:: no emit run when error +Edit [5]:: no emit run when error //// [/home/src/workspaces/project/tsconfig.json] *modified* { "compilerOptions": { @@ -212,7 +196,5 @@ Output:: Found 1 error in a.ts:1 - SemanticDiagnostics:: - Signatures:: diff --git a/testdata/baselines/reference/tscWatch/noEmit/semantic-errors.js b/testdata/baselines/reference/tscWatch/noEmit/semantic-errors.js index 3df1ad44dd..7c8b9c8e80 100644 --- a/testdata/baselines/reference/tscWatch/noEmit/semantic-errors.js +++ b/testdata/baselines/reference/tscWatch/noEmit/semantic-errors.js @@ -1,7 +1,6 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true -Input::-w +Input:: //// [/home/src/workspaces/project/a.ts] *new* const a: number = "hello" //// [/home/src/workspaces/project/tsconfig.json] *new* @@ -11,11 +10,8 @@ const a: number = "hello" } } -ExitStatus:: 0 - -CompilerOptions::{ - "watch": true -} +tsgo -w +ExitStatus:: Success Output:: a.ts:1:7 - error TS2322: Type 'string' is not assignable to type 'number'. @@ -49,31 +45,27 @@ interface Symbol { } declare const console: { log(msg: any): void; }; - SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts - Signatures:: -Edit:: fix error +Edit [0]:: fix error //// [/home/src/workspaces/project/a.ts] *modified* const a = "hello"; Output:: - SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts - Signatures:: (computed .d.ts) /home/src/workspaces/project/a.ts -Edit:: emit after fixing error +Edit [1]:: emit after fixing error //// [/home/src/workspaces/project/tsconfig.json] *modified* { "compilerOptions": { @@ -87,13 +79,11 @@ Output:: const a = "hello"; - SemanticDiagnostics:: - Signatures:: -Edit:: no emit run after fixing error +Edit [2]:: no emit run after fixing error //// [/home/src/workspaces/project/tsconfig.json] *modified* { "compilerOptions": { @@ -105,13 +95,11 @@ Edit:: no emit run after fixing error Output:: - SemanticDiagnostics:: - Signatures:: -Edit:: introduce error +Edit [3]:: introduce error //// [/home/src/workspaces/project/a.ts] *modified* const a: number = "hello" @@ -126,16 +114,14 @@ Output:: Found 1 error in a.ts:1 - SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts - Signatures:: (computed .d.ts) /home/src/workspaces/project/a.ts -Edit:: emit when error +Edit [4]:: emit when error //// [/home/src/workspaces/project/tsconfig.json] *modified* { "compilerOptions": { @@ -155,13 +141,11 @@ Found 1 error in a.ts:1 //// [/home/src/workspaces/project/a.js] *modified time* - SemanticDiagnostics:: - Signatures:: -Edit:: no emit run when error +Edit [5]:: no emit run when error //// [/home/src/workspaces/project/tsconfig.json] *modified* { "compilerOptions": { @@ -181,7 +165,5 @@ Output:: Found 1 error in a.ts:1 - SemanticDiagnostics:: - Signatures:: diff --git a/testdata/baselines/reference/tscWatch/noEmit/syntax-errors.js b/testdata/baselines/reference/tscWatch/noEmit/syntax-errors.js index 43061e48b7..ce5b5071b0 100644 --- a/testdata/baselines/reference/tscWatch/noEmit/syntax-errors.js +++ b/testdata/baselines/reference/tscWatch/noEmit/syntax-errors.js @@ -1,7 +1,6 @@ - currentDirectory::/home/src/workspaces/project useCaseSensitiveFileNames::true -Input::-w +Input:: //// [/home/src/workspaces/project/a.ts] *new* const a = "hello //// [/home/src/workspaces/project/tsconfig.json] *new* @@ -11,11 +10,8 @@ const a = "hello } } -ExitStatus:: 0 - -CompilerOptions::{ - "watch": true -} +tsgo -w +ExitStatus:: Success Output:: a.ts:1:17 - error TS1002: Unterminated string literal. @@ -49,31 +45,27 @@ interface Symbol { } declare const console: { log(msg: any): void; }; - SemanticDiagnostics:: *not cached* /home/src/tslibs/TS/Lib/lib.d.ts *not cached* /home/src/workspaces/project/a.ts - Signatures:: -Edit:: fix error +Edit [0]:: fix error //// [/home/src/workspaces/project/a.ts] *modified* const a = "hello"; Output:: - SemanticDiagnostics:: *refresh* /home/src/tslibs/TS/Lib/lib.d.ts *refresh* /home/src/workspaces/project/a.ts - Signatures:: (computed .d.ts) /home/src/workspaces/project/a.ts -Edit:: emit after fixing error +Edit [1]:: emit after fixing error //// [/home/src/workspaces/project/tsconfig.json] *modified* { "compilerOptions": { @@ -87,13 +79,11 @@ Output:: const a = "hello"; - SemanticDiagnostics:: - Signatures:: -Edit:: no emit run after fixing error +Edit [2]:: no emit run after fixing error //// [/home/src/workspaces/project/tsconfig.json] *modified* { "compilerOptions": { @@ -105,13 +95,11 @@ Edit:: no emit run after fixing error Output:: - SemanticDiagnostics:: - Signatures:: -Edit:: introduce error +Edit [3]:: introduce error //// [/home/src/workspaces/project/a.ts] *modified* const a = "hello @@ -126,14 +114,12 @@ Output:: Found 1 error in a.ts:1 - SemanticDiagnostics:: *not cached* /home/src/workspaces/project/a.ts - Signatures:: -Edit:: emit when error +Edit [4]:: emit when error //// [/home/src/workspaces/project/tsconfig.json] *modified* { "compilerOptions": { @@ -155,15 +141,13 @@ Found 1 error in a.ts:1 const a = "hello; - SemanticDiagnostics:: *not cached* /home/src/workspaces/project/a.ts - Signatures:: (computed .d.ts) /home/src/workspaces/project/a.ts -Edit:: no emit run when error +Edit [5]:: no emit run when error //// [/home/src/workspaces/project/tsconfig.json] *modified* { "compilerOptions": { @@ -183,8 +167,6 @@ Output:: Found 1 error in a.ts:1 - SemanticDiagnostics:: *not cached* /home/src/workspaces/project/a.ts - Signatures:: From 62f4c15efdc6a5e9e34d3093a6c6b60020ba9a0f Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 2 Jul 2025 16:24:59 -0700 Subject: [PATCH 34/36] Test fs refactor --- internal/execute/testfs_test.go | 54 ++----------------- internal/execute/testsys_test.go | 6 +-- internal/testutil/incrementaltestutil/fs.go | 59 +++------------------ 3 files changed, 15 insertions(+), 104 deletions(-) diff --git a/internal/execute/testfs_test.go b/internal/execute/testfs_test.go index e016369360..f0553465ec 100644 --- a/internal/execute/testfs_test.go +++ b/internal/execute/testfs_test.go @@ -6,20 +6,12 @@ import ( ) type testFsTrackingLibs struct { - fs vfs.FS + vfs.FS defaultLibs *collections.SyncSet[string] } -var _ vfs.FS = (*testFsTrackingLibs)(nil) - func NewFSTrackingLibs(fs vfs.FS) *testFsTrackingLibs { - return &testFsTrackingLibs{ - fs: fs, - } -} - -func (f *testFsTrackingLibs) FS() vfs.FS { - return f.fs + return &testFsTrackingLibs{FS: fs} } func (f *testFsTrackingLibs) removeIgnoreLibPath(path string) { @@ -28,56 +20,20 @@ func (f *testFsTrackingLibs) removeIgnoreLibPath(path string) { } } -func (f *testFsTrackingLibs) UseCaseSensitiveFileNames() bool { - return f.fs.UseCaseSensitiveFileNames() -} - -// FileExists returns true if the file exists. -func (f *testFsTrackingLibs) FileExists(path string) bool { - return f.fs.FileExists(path) -} - // ReadFile reads the file specified by path and returns the content. // If the file fails to be read, ok will be false. func (f *testFsTrackingLibs) ReadFile(path string) (contents string, ok bool) { f.removeIgnoreLibPath(path) - return f.fs.ReadFile(path) + return f.FS.ReadFile(path) } func (f *testFsTrackingLibs) WriteFile(path string, data string, writeByteOrderMark bool) error { f.removeIgnoreLibPath(path) - return f.fs.WriteFile(path, data, writeByteOrderMark) + return f.FS.WriteFile(path, data, writeByteOrderMark) } // Removes `path` and all its contents. Will return the first error it encounters. func (f *testFsTrackingLibs) Remove(path string) error { f.removeIgnoreLibPath(path) - return f.fs.Remove(path) -} - -// DirectoryExists returns true if the path is a directory. -func (f *testFsTrackingLibs) DirectoryExists(path string) bool { - return f.fs.DirectoryExists(path) -} - -// GetAccessibleEntries returns the files/directories in the specified directory. -// If any entry is a symlink, it will be followed. -func (f *testFsTrackingLibs) GetAccessibleEntries(path string) vfs.Entries { - return f.fs.GetAccessibleEntries(path) -} - -func (f *testFsTrackingLibs) Stat(path string) vfs.FileInfo { - return f.fs.Stat(path) -} - -// WalkDir walks the file tree rooted at root, calling walkFn for each file or directory in the tree. -// It is has the same behavior as [fs.WalkDir], but with paths as [string]. -func (f *testFsTrackingLibs) WalkDir(root string, walkFn vfs.WalkDirFunc) error { - return f.fs.WalkDir(root, walkFn) -} - -// Realpath returns the "real path" of the specified path, -// following symlinks and correcting filename casing. -func (f *testFsTrackingLibs) Realpath(path string) string { - return f.fs.Realpath(path) + return f.FS.Remove(path) } diff --git a/internal/execute/testsys_test.go b/internal/execute/testsys_test.go index c9d5bcd069..424a675357 100644 --- a/internal/execute/testsys_test.go +++ b/internal/execute/testsys_test.go @@ -115,7 +115,7 @@ func (s *testSys) FS() vfs.FS { } func (s *testSys) TestFS() *incrementaltestutil.FsHandlingBuildInfo { - return s.fs.fs.(*incrementaltestutil.FsHandlingBuildInfo) + return s.fs.FS.(*incrementaltestutil.FsHandlingBuildInfo) } func (s *testSys) ensureLibPathExists(path string) { @@ -239,7 +239,7 @@ func (s *testSys) baselineFSwithDiff(baseline io.Writer) { return nil } - newContents, ok := s.TestFS().FS().ReadFile(path) + newContents, ok := s.TestFS().InnerReadFile(path) if !ok { return nil } @@ -258,7 +258,7 @@ func (s *testSys) baselineFSwithDiff(baseline io.Writer) { } if s.serializedDiff != nil { for path := range s.serializedDiff.snap { - _, ok := s.TestFS().FS().ReadFile(path) + _, ok := s.TestFS().InnerReadFile(path) if !ok { // report deleted s.reportFSEntryDiff(baseline, nil, path) diff --git a/internal/testutil/incrementaltestutil/fs.go b/internal/testutil/incrementaltestutil/fs.go index f75bde9a50..42e04b0052 100644 --- a/internal/testutil/incrementaltestutil/fs.go +++ b/internal/testutil/incrementaltestutil/fs.go @@ -13,34 +13,21 @@ import ( var fakeTsVersion = "FakeTSVersion" type FsHandlingBuildInfo struct { - fs vfs.FS + vfs.FS } -var _ vfs.FS = (*FsHandlingBuildInfo)(nil) - func NewFsHandlingBuildInfo(fs vfs.FS) *FsHandlingBuildInfo { - return &FsHandlingBuildInfo{ - fs: fs, - } + return &FsHandlingBuildInfo{FS: fs} } -func (f *FsHandlingBuildInfo) FS() vfs.FS { - return f.fs -} - -func (f *FsHandlingBuildInfo) UseCaseSensitiveFileNames() bool { - return f.fs.UseCaseSensitiveFileNames() -} - -// FileExists returns true if the file exists. -func (f *FsHandlingBuildInfo) FileExists(path string) bool { - return f.fs.FileExists(path) +func (f *FsHandlingBuildInfo) InnerReadFile(path string) (contents string, ok bool) { + return f.FS.ReadFile(path) } // ReadFile reads the file specified by path and returns the content. // If the file fails to be read, ok will be false. func (f *FsHandlingBuildInfo) ReadFile(path string) (contents string, ok bool) { - contents, ok = f.fs.ReadFile(path) + contents, ok = f.InnerReadFile(path) if ok && tspath.FileExtensionIs(path, tspath.ExtensionTsBuildInfo) { // read buildinfo and modify version var buildInfo incremental.BuildInfo @@ -71,42 +58,10 @@ func (f *FsHandlingBuildInfo) WriteFile(path string, data string, writeByteOrder data = string(newData) } // Write readable build info version - if err := f.fs.WriteFile(path+".readable.baseline.txt", toReadableBuildInfo(&buildInfo, data), false); err != nil { + if err := f.FS.WriteFile(path+".readable.baseline.txt", toReadableBuildInfo(&buildInfo, data), false); err != nil { return fmt.Errorf("testFs.WriteFile: failed to write readable build info: %w", err) } } } - return f.fs.WriteFile(path, data, writeByteOrderMark) -} - -// Removes `path` and all its contents. Will return the first error it encounters. -func (f *FsHandlingBuildInfo) Remove(path string) error { - return f.fs.Remove(path) -} - -// DirectoryExists returns true if the path is a directory. -func (f *FsHandlingBuildInfo) DirectoryExists(path string) bool { - return f.fs.DirectoryExists(path) -} - -// GetAccessibleEntries returns the files/directories in the specified directory. -// If any entry is a symlink, it will be followed. -func (f *FsHandlingBuildInfo) GetAccessibleEntries(path string) vfs.Entries { - return f.fs.GetAccessibleEntries(path) -} - -func (f *FsHandlingBuildInfo) Stat(path string) vfs.FileInfo { - return f.fs.Stat(path) -} - -// WalkDir walks the file tree rooted at root, calling walkFn for each file or directory in the tree. -// It is has the same behavior as [fs.WalkDir], but with paths as [string]. -func (f *FsHandlingBuildInfo) WalkDir(root string, walkFn vfs.WalkDirFunc) error { - return f.fs.WalkDir(root, walkFn) -} - -// Realpath returns the "real path" of the specified path, -// following symlinks and correcting filename casing. -func (f *FsHandlingBuildInfo) Realpath(path string) string { - return f.fs.Realpath(path) + return f.FS.WriteFile(path, data, writeByteOrderMark) } From ac20ac472e878347f3bdf0444ba20ad5f6ea720e Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 2 Jul 2025 16:37:50 -0700 Subject: [PATCH 35/36] rename test baselines --- internal/execute/tscincremental_test.go | 4 ++-- ...ith-no-backing-types-found-doesnt-crash-under---strict.js} | 0 ...jsx-emit-mode-with-no-backing-types-found-doesnt-crash.js} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename testdata/baselines/reference/tsc/incremental/{react-jsx-emit-mode-with-no-backing-types-found-doesn't-crash-under---strict.js => react-jsx-emit-mode-with-no-backing-types-found-doesnt-crash-under---strict.js} (100%) rename testdata/baselines/reference/tsc/incremental/{react-jsx-emit-mode-with-no-backing-types-found-doesn't-crash.js => react-jsx-emit-mode-with-no-backing-types-found-doesnt-crash.js} (100%) diff --git a/internal/execute/tscincremental_test.go b/internal/execute/tscincremental_test.go index ad42024c80..880aabcd1c 100644 --- a/internal/execute/tscincremental_test.go +++ b/internal/execute/tscincremental_test.go @@ -293,7 +293,7 @@ func TestIncremental(t *testing.T) { }, }, { - subScenario: "react-jsx-emit-mode with no backing types found doesn't crash", + subScenario: "react-jsx-emit-mode with no backing types found doesnt crash", sys: newTestSys(FileMap{ "/home/src/workspaces/project/node_modules/react/jsx-runtime.js": "export {}", // js needs to be present so there's a resolution result "/home/src/workspaces/project/node_modules/@types/react/index.d.ts": stringtestutil.Dedent(` @@ -321,7 +321,7 @@ func TestIncremental(t *testing.T) { }, "/home/src/workspaces/project"), }, { - subScenario: "react-jsx-emit-mode with no backing types found doesn't crash under --strict", + subScenario: "react-jsx-emit-mode with no backing types found doesnt crash under --strict", sys: newTestSys(FileMap{ "/home/src/workspaces/project/node_modules/react/jsx-runtime.js": "export {}", // js needs to be present so there's a resolution result "/home/src/workspaces/project/node_modules/@types/react/index.d.ts": stringtestutil.Dedent(` diff --git a/testdata/baselines/reference/tsc/incremental/react-jsx-emit-mode-with-no-backing-types-found-doesn't-crash-under---strict.js b/testdata/baselines/reference/tsc/incremental/react-jsx-emit-mode-with-no-backing-types-found-doesnt-crash-under---strict.js similarity index 100% rename from testdata/baselines/reference/tsc/incremental/react-jsx-emit-mode-with-no-backing-types-found-doesn't-crash-under---strict.js rename to testdata/baselines/reference/tsc/incremental/react-jsx-emit-mode-with-no-backing-types-found-doesnt-crash-under---strict.js diff --git a/testdata/baselines/reference/tsc/incremental/react-jsx-emit-mode-with-no-backing-types-found-doesn't-crash.js b/testdata/baselines/reference/tsc/incremental/react-jsx-emit-mode-with-no-backing-types-found-doesnt-crash.js similarity index 100% rename from testdata/baselines/reference/tsc/incremental/react-jsx-emit-mode-with-no-backing-types-found-doesn't-crash.js rename to testdata/baselines/reference/tsc/incremental/react-jsx-emit-mode-with-no-backing-types-found-doesnt-crash.js From 04b68cb6a4bd8ad7a9db4a9cd6337c1883a6863a Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 2 Jul 2025 16:59:08 -0700 Subject: [PATCH 36/36] Incremental correctness --- internal/execute/testfs_test.go | 18 +- internal/execute/testsys_test.go | 65 +++--- internal/execute/tsc_test.go | 190 +++++++++--------- internal/execute/tscincremental_test.go | 126 ++++++------ internal/execute/tscnocheck_test.go | 4 +- internal/execute/tscprojectreferences_test.go | 49 +++-- internal/execute/tsctestrunner_test.go | 107 +++++++--- internal/execute/tscwatch_test.go | 25 ++- internal/testutil/incrementaltestutil/fs.go | 10 +- 9 files changed, 326 insertions(+), 268 deletions(-) diff --git a/internal/execute/testfs_test.go b/internal/execute/testfs_test.go index f0553465ec..9b49e548dc 100644 --- a/internal/execute/testfs_test.go +++ b/internal/execute/testfs_test.go @@ -5,16 +5,13 @@ import ( "github.com/microsoft/typescript-go/internal/vfs" ) -type testFsTrackingLibs struct { +type testFs struct { vfs.FS - defaultLibs *collections.SyncSet[string] + defaultLibs *collections.SyncSet[string] + writtenFiles collections.SyncSet[string] } -func NewFSTrackingLibs(fs vfs.FS) *testFsTrackingLibs { - return &testFsTrackingLibs{FS: fs} -} - -func (f *testFsTrackingLibs) removeIgnoreLibPath(path string) { +func (f *testFs) removeIgnoreLibPath(path string) { if f.defaultLibs != nil && f.defaultLibs.Has(path) { f.defaultLibs.Delete(path) } @@ -22,18 +19,19 @@ func (f *testFsTrackingLibs) removeIgnoreLibPath(path string) { // ReadFile reads the file specified by path and returns the content. // If the file fails to be read, ok will be false. -func (f *testFsTrackingLibs) ReadFile(path string) (contents string, ok bool) { +func (f *testFs) ReadFile(path string) (contents string, ok bool) { f.removeIgnoreLibPath(path) return f.FS.ReadFile(path) } -func (f *testFsTrackingLibs) WriteFile(path string, data string, writeByteOrderMark bool) error { +func (f *testFs) WriteFile(path string, data string, writeByteOrderMark bool) error { f.removeIgnoreLibPath(path) + f.writtenFiles.Add(path) return f.FS.WriteFile(path, data, writeByteOrderMark) } // Removes `path` and all its contents. Will return the first error it encounters. -func (f *testFsTrackingLibs) Remove(path string) error { +func (f *testFs) Remove(path string) error { f.removeIgnoreLibPath(path) return f.FS.Remove(path) } diff --git a/internal/execute/testsys_test.go b/internal/execute/testsys_test.go index 424a675357..17b1dc5d5a 100644 --- a/internal/execute/testsys_test.go +++ b/internal/execute/testsys_test.go @@ -55,7 +55,11 @@ func newTestSys(fileOrFolderList FileMap, cwd string) *testSys { cwd = "/home/src/workspaces/project" } sys := &testSys{ - fs: NewFSTrackingLibs(incrementaltestutil.NewFsHandlingBuildInfo(vfstest.FromMap(fileOrFolderList, true /*useCaseSensitiveFileNames*/))), + fs: &incrementaltestutil.FsHandlingBuildInfo{ + FS: &testFs{ + FS: vfstest.FromMap(fileOrFolderList, true /*useCaseSensitiveFileNames*/), + }, + }, defaultLibraryPath: tscLibPath, cwd: cwd, files: slices.Collect(maps.Keys(fileOrFolderList)), @@ -91,7 +95,7 @@ type testSys struct { currentWrite *strings.Builder serializedDiff *snapshot - fs *testFsTrackingLibs + fs *incrementaltestutil.FsHandlingBuildInfo defaultLibraryPath string cwd string files []string @@ -114,18 +118,22 @@ func (s *testSys) FS() vfs.FS { return s.fs } -func (s *testSys) TestFS() *incrementaltestutil.FsHandlingBuildInfo { - return s.fs.FS.(*incrementaltestutil.FsHandlingBuildInfo) +func (s *testSys) testFs() *testFs { + return s.fs.FS.(*testFs) +} + +func (s *testSys) fsFromFileMap() vfs.FS { + return s.testFs().FS } func (s *testSys) ensureLibPathExists(path string) { path = tscLibPath + "/" + path - if _, ok := s.TestFS().ReadFile(path); !ok { - if s.fs.defaultLibs == nil { - s.fs.defaultLibs = &collections.SyncSet[string]{} + if _, ok := s.fsFromFileMap().ReadFile(path); !ok { + if s.testFs().defaultLibs == nil { + s.testFs().defaultLibs = &collections.SyncSet[string]{} } - s.fs.defaultLibs.Add(path) - err := s.TestFS().WriteFile(path, tscDefaultLibContent, false) + s.testFs().defaultLibs.Add(path) + err := s.fsFromFileMap().WriteFile(path, tscDefaultLibContent, false) if err != nil { panic("Failed to write default library file: " + err.Error()) } @@ -223,6 +231,9 @@ func (s *testSys) baselineOutput(baseline io.Writer) { } // todo screen clears s.printOutputs(baseline) +} + +func (s *testSys) clearOutput() { s.output = []string{} } @@ -230,7 +241,7 @@ func (s *testSys) baselineFSwithDiff(baseline io.Writer) { // todo: baselines the entire fs, possibly doesn't correctly diff all cases of emitted files, since emit isn't fully implemented and doesn't always emit the same way as strada snap := map[string]*diffEntry{} - err := s.FS().WalkDir("/", func(path string, d vfs.DirEntry, e error) error { + err := s.fsFromFileMap().WalkDir("/", func(path string, d vfs.DirEntry, e error) error { if e != nil { return e } @@ -239,7 +250,7 @@ func (s *testSys) baselineFSwithDiff(baseline io.Writer) { return nil } - newContents, ok := s.TestFS().InnerReadFile(path) + newContents, ok := s.fsFromFileMap().ReadFile(path) if !ok { return nil } @@ -258,7 +269,7 @@ func (s *testSys) baselineFSwithDiff(baseline io.Writer) { } if s.serializedDiff != nil { for path := range s.serializedDiff.snap { - _, ok := s.TestFS().InnerReadFile(path) + _, ok := s.fsFromFileMap().ReadFile(path) if !ok { // report deleted s.reportFSEntryDiff(baseline, nil, path) @@ -266,8 +277,8 @@ func (s *testSys) baselineFSwithDiff(baseline io.Writer) { } } var defaultLibs collections.SyncSet[string] - if s.fs.defaultLibs != nil { - s.fs.defaultLibs.Range(func(libPath string) bool { + if s.testFs().defaultLibs != nil { + s.testFs().defaultLibs.Range(func(libPath string) bool { defaultLibs.Add(libPath) return true }) @@ -288,7 +299,7 @@ func (s *testSys) reportFSEntryDiff(baseline io.Writer, newDirContent *diffEntry } // todo handle more cases of fs changes if oldDirContent == nil { - if s.fs.defaultLibs == nil || !s.fs.defaultLibs.Has(path) { + if s.testFs().defaultLibs == nil || !s.testFs().defaultLibs.Has(path) { fmt.Fprint(baseline, "//// [", path, "] *new* \n", newDirContent.content, "\n") } } else if newDirContent == nil { @@ -297,7 +308,7 @@ func (s *testSys) reportFSEntryDiff(baseline io.Writer, newDirContent *diffEntry fmt.Fprint(baseline, "//// [", path, "] *modified* \n", newDirContent.content, "\n") } else if newDirContent.fileInfo.ModTime() != oldDirContent.fileInfo.ModTime() { fmt.Fprint(baseline, "//// [", path, "] *modified time*\n") - } else if defaultLibs != nil && defaultLibs.Has(path) && s.fs.defaultLibs != nil && !s.fs.defaultLibs.Has(path) { + } else if defaultLibs != nil && defaultLibs.Has(path) && s.testFs().defaultLibs != nil && !s.testFs().defaultLibs.Has(path) { // Lib file that was read fmt.Fprint(baseline, "//// [", path, "] *Lib*\n", newDirContent.content, "\n") } @@ -308,33 +319,33 @@ func (s *testSys) printOutputs(baseline io.Writer) { fmt.Fprint(baseline, strings.Join(s.output, "\n")) } -func (s *testSys) WriteFileNoError(path string, content string, writeByteOrderMark bool) { - if err := s.FS().WriteFile(path, content, writeByteOrderMark); err != nil { +func (s *testSys) writeFileNoError(path string, content string, writeByteOrderMark bool) { + if err := s.fsFromFileMap().WriteFile(path, content, writeByteOrderMark); err != nil { panic(err) } } -func (s *testSys) ReplaceFileText(path string, oldText string, newText string) { - content, ok := s.FS().ReadFile(path) +func (s *testSys) replaceFileText(path string, oldText string, newText string) { + content, ok := s.fsFromFileMap().ReadFile(path) if !ok { panic("File not found: " + path) } content = strings.Replace(content, oldText, newText, 1) - s.WriteFileNoError(path, content, false) + s.writeFileNoError(path, content, false) } -func (s *testSys) AppendFile(path string, text string) { - content, ok := s.FS().ReadFile(path) +func (s *testSys) appendFile(path string, text string) { + content, ok := s.fsFromFileMap().ReadFile(path) if !ok { panic("File not found: " + path) } - s.WriteFileNoError(path, content+text, false) + s.writeFileNoError(path, content+text, false) } -func (s *testSys) PrependFile(path string, text string) { - content, ok := s.FS().ReadFile(path) +func (s *testSys) prependFile(path string, text string) { + content, ok := s.fsFromFileMap().ReadFile(path) if !ok { panic("File not found: " + path) } - s.WriteFileNoError(path, text+content, false) + s.writeFileNoError(path, text+content, false) } diff --git a/internal/execute/tsc_test.go b/internal/execute/tsc_test.go index 65403e436e..cc72906eba 100644 --- a/internal/execute/tsc_test.go +++ b/internal/execute/tsc_test.go @@ -11,7 +11,6 @@ func TestTscCommandline(t *testing.T) { testCases := []*tscInput{ { subScenario: "show help with ExitStatus.DiagnosticsPresent_OutputsSkipped", - sys: newTestSys(nil, ""), // , { // environmentVariables: new Map([["TS_TEST_TERMINAL_WIDTH", "120"]]), // }), @@ -19,12 +18,10 @@ func TestTscCommandline(t *testing.T) { }, { subScenario: "show help with ExitStatus.DiagnosticsPresent_OutputsSkipped when host cannot provide terminal width", - sys: newTestSys(nil, ""), commandLineArgs: nil, }, { subScenario: "does not add color when NO_COLOR is set", - sys: newTestSys(nil, ""), // , { // environmentVariables: new Map([["NO_COLOR", "true"]]), // }), @@ -32,7 +29,6 @@ func TestTscCommandline(t *testing.T) { }, { subScenario: "does not add color when NO_COLOR is set", - sys: newTestSys(nil, ""), // , { // environmentVariables: new Map([["NO_COLOR", "true"]]), // } @@ -41,27 +37,24 @@ func TestTscCommandline(t *testing.T) { }, { subScenario: "when build not first argument", - sys: newTestSys(nil, ""), commandLineArgs: []string{"--verbose", "--build"}, }, { subScenario: "help", - sys: newTestSys(nil, ""), commandLineArgs: []string{"--help"}, }, { subScenario: "help all", - sys: newTestSys(nil, ""), commandLineArgs: []string{"--help", "--all"}, }, { subScenario: "Parse --lib option with file name", - sys: newTestSys(FileMap{"/home/src/workspaces/project/first.ts": `export const Key = Symbol()`}, ""), + files: FileMap{"/home/src/workspaces/project/first.ts": `export const Key = Symbol()`}, commandLineArgs: []string{"--lib", "es6 ", "first.ts"}, }, { subScenario: "Project is empty string", - sys: newTestSys(FileMap{ + files: FileMap{ "/home/src/workspaces/project/first.ts": `export const a = 1`, "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` { @@ -70,12 +63,12 @@ func TestTscCommandline(t *testing.T) { "noEmit": true } }`), - }, ""), + }, commandLineArgs: []string{}, }, { subScenario: "Parse -p", - sys: newTestSys(FileMap{ + files: FileMap{ "/home/src/workspaces/project/first.ts": `export const a = 1`, "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` { @@ -84,12 +77,12 @@ func TestTscCommandline(t *testing.T) { "noEmit": true } }`), - }, ""), + }, commandLineArgs: []string{"-p", "."}, }, { subScenario: "Parse -p with path to tsconfig file", - sys: newTestSys(FileMap{ + files: FileMap{ "/home/src/workspaces/project/first.ts": `export const a = 1`, "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` { @@ -98,12 +91,12 @@ func TestTscCommandline(t *testing.T) { "noEmit": true } }`), - }, ""), + }, commandLineArgs: []string{"-p", "/home/src/workspaces/project/tsconfig.json"}, }, { subScenario: "Parse -p with path to tsconfig folder", - sys: newTestSys(FileMap{ + files: FileMap{ "/home/src/workspaces/project/first.ts": `export const a = 1`, "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` { @@ -112,17 +105,16 @@ func TestTscCommandline(t *testing.T) { "noEmit": true } }`), - }, ""), + }, commandLineArgs: []string{"-p", "/home/src/workspaces/project"}, }, { subScenario: "Parse enum type options", - sys: newTestSys(nil, ""), commandLineArgs: []string{"--moduleResolution", "nodenext ", "first.ts", "--module", "nodenext", "--target", "esnext", "--moduleDetection", "auto", "--jsx", "react", "--newLine", "crlf"}, }, { subScenario: "Parse watch interval option", - sys: newTestSys(FileMap{ + files: FileMap{ "/home/src/workspaces/project/first.ts": `export const a = 1`, "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` { @@ -131,12 +123,11 @@ func TestTscCommandline(t *testing.T) { "noEmit": true } }`), - }, ""), + }, commandLineArgs: []string{"-w", "--watchInterval", "1000"}, }, { subScenario: "Parse watch interval option without tsconfig.json", - sys: newTestSys(nil, ""), commandLineArgs: []string{"-w", "--watchInterval", "1000"}, }, } @@ -150,7 +141,7 @@ func TestNoEmit(t *testing.T) { t.Parallel() (&tscInput{ subScenario: "when project has strict true", - sys: newTestSys(FileMap{ + files: FileMap{ "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` { "compilerOptions": { @@ -159,81 +150,78 @@ func TestNoEmit(t *testing.T) { } }`), "/home/src/workspaces/project/class1.ts": `export class class1 {}`, - }, ""), + }, commandLineArgs: []string{"--noEmit"}, }).run(t, "noEmit") } func TestExtends(t *testing.T) { t.Parallel() - extendsSys := func() *testSys { - return newTestSys(FileMap{ - "/home/src/projects/configs/first/tsconfig.json": stringtestutil.Dedent(` - { - "extends": "../second/tsconfig.json", - "include": ["${configDir}/src"], - "compilerOptions": { - "typeRoots": ["root1", "${configDir}/root2", "root3"], - "types": [], - } - }`), - "/home/src/projects/configs/second/tsconfig.json": stringtestutil.Dedent(` - { - "files": ["${configDir}/main.ts"], - "compilerOptions": { - "declarationDir": "${configDir}/decls", - "paths": { - "@myscope/*": ["${configDir}/types/*"], - "other/*": ["other/*"], - }, - "baseUrl": "${configDir}", - }, - "watchOptions": { - "excludeFiles": ["${configDir}/main.ts"], - }, - }`), - "/home/src/projects/myproject/tsconfig.json": stringtestutil.Dedent(` - { - "extends": "../configs/first/tsconfig.json", - "compilerOptions": { - "declaration": true, - "outDir": "outDir", - "traceResolution": true, + extendsSysScenario := func(subScenario string, commandlineArgs []string) *tscInput { + return &tscInput{ + subScenario: subScenario, + commandLineArgs: commandlineArgs, + files: FileMap{ + "/home/src/projects/configs/first/tsconfig.json": stringtestutil.Dedent(` + { + "extends": "../second/tsconfig.json", + "include": ["${configDir}/src"], + "compilerOptions": { + "typeRoots": ["root1", "${configDir}/root2", "root3"], + "types": [], + } + }`), + "/home/src/projects/configs/second/tsconfig.json": stringtestutil.Dedent(` + { + "files": ["${configDir}/main.ts"], + "compilerOptions": { + "declarationDir": "${configDir}/decls", + "paths": { + "@myscope/*": ["${configDir}/types/*"], + "other/*": ["other/*"], + }, + "baseUrl": "${configDir}", + }, + "watchOptions": { + "excludeFiles": ["${configDir}/main.ts"], + }, + }`), + "/home/src/projects/myproject/tsconfig.json": stringtestutil.Dedent(` + { + "extends": "../configs/first/tsconfig.json", + "compilerOptions": { + "declaration": true, + "outDir": "outDir", + "traceResolution": true, + }, + }`), + "/home/src/projects/myproject/main.ts": stringtestutil.Dedent(` + // some comment + export const y = 10; + import { x } from "@myscope/sometype"; + `), + "/home/src/projects/myproject/src/secondary.ts": stringtestutil.Dedent(` + // some comment + export const z = 10; + import { k } from "other/sometype2"; + `), + "/home/src/projects/myproject/types/sometype.ts": stringtestutil.Dedent(` + // some comment + export const x = 10; + `), + "/home/src/projects/myproject/root2/other/sometype2/index.d.ts": stringtestutil.Dedent(` + export const k = 10; + `), }, - }`), - "/home/src/projects/myproject/main.ts": stringtestutil.Dedent(` - // some comment - export const y = 10; - import { x } from "@myscope/sometype"; - `), - "/home/src/projects/myproject/src/secondary.ts": stringtestutil.Dedent(` - // some comment - export const z = 10; - import { k } from "other/sometype2"; - `), - "/home/src/projects/myproject/types/sometype.ts": stringtestutil.Dedent(` - // some comment - export const x = 10; - `), - "/home/src/projects/myproject/root2/other/sometype2/index.d.ts": stringtestutil.Dedent(` - export const k = 10; - `), - }, "/home/src/projects/myproject") + cwd: "/home/src/projects/myproject", + } } - cases := []tscInput{{ - subScenario: "configDir template", - sys: extendsSys(), - commandLineArgs: []string{"--explainFiles"}, - }, { - subScenario: "configDir template showConfig", - sys: extendsSys(), - commandLineArgs: []string{"--showConfig"}, - }, { - subScenario: "configDir template with commandline", - sys: extendsSys(), - commandLineArgs: []string{"--explainFiles", "--outDir", "${configDir}/outDir"}, - }} + cases := []*tscInput{ + extendsSysScenario("configDir template", []string{"--explainFiles"}), + extendsSysScenario("configDir template showConfig", []string{"--showConfig"}), + extendsSysScenario("configDir template with commandline", []string{"--explainFiles", "--outDir", "${configDir}/outDir"}), + } for _, c := range cases { c.run(t, "extends") @@ -244,19 +232,21 @@ func TestTypeAcquisition(t *testing.T) { t.Parallel() (&tscInput{ subScenario: "parse tsconfig with typeAcquisition", - sys: newTestSys(FileMap{"/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` - { - "compilerOptions": { - "composite": true, - "noEmit": true, - }, - "typeAcquisition": { - "enable": true, - "include": ["0.d.ts", "1.d.ts"], - "exclude": ["0.js", "1.js"], - "disableFilenameBasedTypeAcquisition": true, - }, - }`)}, "/home/src/workspaces/project"), + files: FileMap{ + "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` + { + "compilerOptions": { + "composite": true, + "noEmit": true, + }, + "typeAcquisition": { + "enable": true, + "include": ["0.d.ts", "1.d.ts"], + "exclude": ["0.js", "1.js"], + "disableFilenameBasedTypeAcquisition": true, + }, + }`), + }, commandLineArgs: []string{}, }).run(t, "typeAcquisition") } diff --git a/internal/execute/tscincremental_test.go b/internal/execute/tscincremental_test.go index 880aabcd1c..2604ee5d72 100644 --- a/internal/execute/tscincremental_test.go +++ b/internal/execute/tscincremental_test.go @@ -3,7 +3,6 @@ package execute_test import ( "testing" - "github.com/microsoft/typescript-go/internal/core" "github.com/microsoft/typescript-go/internal/testutil/stringtestutil" ) @@ -12,7 +11,7 @@ func TestIncremental(t *testing.T) { testCases := []*tscInput{ { subScenario: "serializing error chain", - sys: newTestSys(FileMap{ + files: FileMap{ "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` { "compilerOptions": { @@ -36,12 +35,12 @@ func TestIncremental(t *testing.T) {
)`), - }, "/home/src/workspaces/project"), + }, edits: noChangeOnlyEdit, }, { subScenario: "serializing composite project", - sys: newTestSys(FileMap{ + files: FileMap{ "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` { "compilerOptions": { @@ -52,11 +51,11 @@ func TestIncremental(t *testing.T) { }`), "/home/src/workspaces/project/index.tsx": `export const a = 1;`, "/home/src/workspaces/project/other.ts": `export const b = 2;`, - }, "/home/src/workspaces/project"), + }, }, { subScenario: "change to modifier of class expression field with declaration emit enabled", - sys: newTestSys(FileMap{ + files: FileMap{ "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` { "compilerOptions": { @@ -81,21 +80,21 @@ func TestIncremental(t *testing.T) { tscLibPath + "/lib.d.ts": tscDefaultLibContent + "\n" + stringtestutil.Dedent(` type ReturnType any> = T extends (...args: any) => infer R ? R : any; type InstanceType any> = T extends abstract new (...args: any) => infer R ? R : any;`), - }, "/home/src/workspaces/project"), + }, commandLineArgs: []string{"--incremental"}, edits: []*testTscEdit{ noChange, { caption: "modify public to protected", edit: func(sys *testSys) { - sys.ReplaceFileText("/home/src/workspaces/project/MessageablePerson.ts", "public", "protected") + sys.replaceFileText("/home/src/workspaces/project/MessageablePerson.ts", "public", "protected") }, }, noChange, { caption: "modify protected to public", edit: func(sys *testSys) { - sys.ReplaceFileText("/home/src/workspaces/project/MessageablePerson.ts", "protected", "public") + sys.replaceFileText("/home/src/workspaces/project/MessageablePerson.ts", "protected", "public") }, }, noChange, @@ -103,7 +102,7 @@ func TestIncremental(t *testing.T) { }, { subScenario: "change to modifier of class expression field", - sys: newTestSys(FileMap{ + files: FileMap{ "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` { "compilerOptions": { @@ -127,21 +126,21 @@ func TestIncremental(t *testing.T) { tscLibPath + "/lib.d.ts": tscDefaultLibContent + "\n" + stringtestutil.Dedent(` type ReturnType any> = T extends (...args: any) => infer R ? R : any; type InstanceType any> = T extends abstract new (...args: any) => infer R ? R : any;`), - }, "/home/src/workspaces/project"), + }, commandLineArgs: []string{"--incremental"}, edits: []*testTscEdit{ noChange, { caption: "modify public to protected", edit: func(sys *testSys) { - sys.ReplaceFileText("/home/src/workspaces/project/MessageablePerson.ts", "public", "protected") + sys.replaceFileText("/home/src/workspaces/project/MessageablePerson.ts", "public", "protected") }, }, noChange, { caption: "modify protected to public", edit: func(sys *testSys) { - sys.ReplaceFileText("/home/src/workspaces/project/MessageablePerson.ts", "protected", "public") + sys.replaceFileText("/home/src/workspaces/project/MessageablePerson.ts", "protected", "public") }, }, noChange, @@ -149,7 +148,7 @@ func TestIncremental(t *testing.T) { }, { subScenario: "when passing filename for buildinfo on commandline", - sys: newTestSys(FileMap{ + files: FileMap{ "/home/src/workspaces/project/src/main.ts": "export const x = 10;", "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` { @@ -161,13 +160,13 @@ func TestIncremental(t *testing.T) { "src/**/*.ts" ], }`), - }, "/home/src/workspaces/project"), + }, commandLineArgs: []string{"--incremental", "--tsBuildInfoFile", ".tsbuildinfo", "--explainFiles"}, edits: noChangeOnlyEdit, }, { subScenario: "when passing rootDir from commandline", - sys: newTestSys(FileMap{ + files: FileMap{ "/home/src/workspaces/project/src/main.ts": "export const x = 10;", "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` { @@ -176,31 +175,31 @@ func TestIncremental(t *testing.T) { "outDir": "dist" } }`), - }, "/home/src/workspaces/project"), + }, commandLineArgs: []string{"--rootDir", "src"}, edits: noChangeOnlyEdit, }, { subScenario: "with only dts files", - sys: newTestSys(FileMap{ + files: FileMap{ "/home/src/workspaces/project/src/main.d.ts": "export const x = 10;", "/home/src/workspaces/project/src/another.d.ts": "export const y = 10;", "/home/src/workspaces/project/tsconfig.json": "{}", - }, "/home/src/workspaces/project"), + }, commandLineArgs: []string{"--incremental"}, edits: []*testTscEdit{ noChange, { caption: "modify d.ts file", edit: func(sys *testSys) { - sys.AppendFile("/home/src/workspaces/project/src/main.d.ts", "export const xy = 100;") + sys.appendFile("/home/src/workspaces/project/src/main.d.ts", "export const xy = 100;") }, }, }, }, { subScenario: "when passing rootDir is in the tsconfig", - sys: newTestSys(FileMap{ + files: FileMap{ "/home/src/workspaces/project/src/main.ts": "export const x = 10;", "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` { @@ -210,30 +209,29 @@ func TestIncremental(t *testing.T) { "rootDir": "./" } }`), - }, "/home/src/workspaces/project"), + }, edits: noChangeOnlyEdit, }, { subScenario: "tsbuildinfo has error", - sys: newTestSys(FileMap{ + files: FileMap{ "/home/src/workspaces/project/main.ts": "export const x = 10;", "/home/src/workspaces/project/tsconfig.json": "{}", "/home/src/workspaces/project/tsconfig.tsbuildinfo": "Some random string", - }, "/home/src/workspaces/project"), + }, commandLineArgs: []string{"-i"}, edits: []*testTscEdit{ { caption: "tsbuildinfo written has error", edit: func(sys *testSys) { - sys.PrependFile("/home/src/workspaces/project/tsconfig.tsbuildinfo", "Some random string") - sys.ReplaceFileText("/home/src/workspaces/project/tsconfig.tsbuildinfo", `"version":"`+core.Version()+`"`, `"version":"FakeTSVersion"`) // build info won't parse, need to manually sterilize for baseline + sys.prependFile("/home/src/workspaces/project/tsconfig.tsbuildinfo", "Some random string") }, }, }, }, { subScenario: "when global file is added, the signatures are updated", - sys: newTestSys(FileMap{ + files: FileMap{ "/home/src/workspaces/project/src/main.ts": stringtestutil.Dedent(` /// /// @@ -250,51 +248,51 @@ func TestIncremental(t *testing.T) { "compilerOptions": { "composite": true }, "include": ["src/**/*.ts"], }`), - }, "/home/src/workspaces/project"), + }, commandLineArgs: []string{}, edits: []*testTscEdit{ noChange, { caption: "Modify main file", edit: func(sys *testSys) { - sys.AppendFile(`/home/src/workspaces/project/src/main.ts`, `something();`) + sys.appendFile(`/home/src/workspaces/project/src/main.ts`, `something();`) }, }, { caption: "Modify main file again", edit: func(sys *testSys) { - sys.AppendFile(`/home/src/workspaces/project/src/main.ts`, `something();`) + sys.appendFile(`/home/src/workspaces/project/src/main.ts`, `something();`) }, }, { caption: "Add new file and update main file", edit: func(sys *testSys) { - sys.WriteFileNoError(`/home/src/workspaces/project/src/newFile.ts`, "function foo() { return 20; }", false) - sys.PrependFile( + sys.writeFileNoError(`/home/src/workspaces/project/src/newFile.ts`, "function foo() { return 20; }", false) + sys.prependFile( `/home/src/workspaces/project/src/main.ts`, `/// `, ) - sys.AppendFile(`/home/src/workspaces/project/src/main.ts`, `foo();`) + sys.appendFile(`/home/src/workspaces/project/src/main.ts`, `foo();`) }, }, { caption: "Write file that could not be resolved", edit: func(sys *testSys) { - sys.WriteFileNoError(`/home/src/workspaces/project/src/fileNotFound.ts`, "function something2() { return 20; }", false) + sys.writeFileNoError(`/home/src/workspaces/project/src/fileNotFound.ts`, "function something2() { return 20; }", false) }, }, { caption: "Modify main file", edit: func(sys *testSys) { - sys.AppendFile(`/home/src/workspaces/project/src/main.ts`, `something();`) + sys.appendFile(`/home/src/workspaces/project/src/main.ts`, `something();`) }, }, }, }, { subScenario: "react-jsx-emit-mode with no backing types found doesnt crash", - sys: newTestSys(FileMap{ + files: FileMap{ "/home/src/workspaces/project/node_modules/react/jsx-runtime.js": "export {}", // js needs to be present so there's a resolution result "/home/src/workspaces/project/node_modules/@types/react/index.d.ts": stringtestutil.Dedent(` export {}; @@ -318,11 +316,11 @@ func TestIncremental(t *testing.T) { "jsxImportSource": "react" } }`), - }, "/home/src/workspaces/project"), + }, }, { subScenario: "react-jsx-emit-mode with no backing types found doesnt crash under --strict", - sys: newTestSys(FileMap{ + files: FileMap{ "/home/src/workspaces/project/node_modules/react/jsx-runtime.js": "export {}", // js needs to be present so there's a resolution result "/home/src/workspaces/project/node_modules/@types/react/index.d.ts": stringtestutil.Dedent(` export {}; @@ -346,12 +344,12 @@ func TestIncremental(t *testing.T) { "jsxImportSource": "react" } }`), - }, "/home/src/workspaces/project"), + }, commandLineArgs: []string{"--strict"}, }, { subScenario: "change to type that gets used as global through export in another file", - sys: newTestSys(FileMap{ + files: FileMap{ "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` { "compilerOptions": { @@ -363,19 +361,19 @@ func TestIncremental(t *testing.T) { console.log(a);`), "/home/src/workspaces/project/constants.ts": "export default 1;", "/home/src/workspaces/project/types.d.ts": `type MagicNumber = typeof import('./constants').default`, - }, "/home/src/workspaces/project"), + }, edits: []*testTscEdit{ { caption: "Modify imports used in global file", edit: func(sys *testSys) { - sys.WriteFileNoError("/home/src/workspaces/project/constants.ts", "export default 2;", false) + sys.writeFileNoError("/home/src/workspaces/project/constants.ts", "export default 2;", false) }, }, }, }, { subScenario: "change to type that gets used as global through export in another file through indirect import", - sys: newTestSys(FileMap{ + files: FileMap{ "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` { "compilerOptions": { @@ -388,19 +386,19 @@ func TestIncremental(t *testing.T) { "/home/src/workspaces/project/constants.ts": "export default 1;", "/home/src/workspaces/project/reexport.ts": `export { default as ConstantNumber } from "./constants"`, "/home/src/workspaces/project/types.d.ts": `type MagicNumber = typeof import('./reexport').ConstantNumber`, - }, "/home/src/workspaces/project"), + }, edits: []*testTscEdit{ { caption: "Modify imports used in global file", edit: func(sys *testSys) { - sys.WriteFileNoError("/home/src/workspaces/project/constants.ts", "export default 2;", false) + sys.writeFileNoError("/home/src/workspaces/project/constants.ts", "export default 2;", false) }, }, }, }, { subScenario: "when file is deleted", - sys: newTestSys(FileMap{ + files: FileMap{ "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` { "compilerOptions": { @@ -410,12 +408,12 @@ func TestIncremental(t *testing.T) { }`), "/home/src/workspaces/project/file1.ts": `export class C { }`, "/home/src/workspaces/project/file2.ts": `export class D { }`, - }, "/home/src/workspaces/project"), + }, edits: []*testTscEdit{ { caption: "delete file with imports", edit: func(sys *testSys) { - err := sys.FS().Remove("/home/src/workspaces/project/file2.ts") + err := sys.fsFromFileMap().Remove("/home/src/workspaces/project/file2.ts") if err != nil { panic(err) } @@ -425,7 +423,7 @@ func TestIncremental(t *testing.T) { }, { subScenario: "generates typerefs correctly", - sys: newTestSys(FileMap{ + files: FileMap{ "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` { "compilerOptions": { @@ -465,12 +463,12 @@ func TestIncremental(t *testing.T) { [K in keyof C]: { wrapped: C[K] } } `), - }, "/home/src/workspaces/project"), + }, edits: []*testTscEdit{ { caption: "modify js file", edit: func(sys *testSys) { - sys.AppendFile("/home/src/workspaces/project/src/bug.js", `export const something = 1;`) + sys.appendFile("/home/src/workspaces/project/src/bug.js", `export const something = 1;`) }, }, }, @@ -489,7 +487,7 @@ func TestIncremental(t *testing.T) { getConstEnumTest(`export { AWorker as A } from "./worker";`, "/home/src/workspaces/project/worker.d.ts", " aliased in different file"), { subScenario: "option changes with composite", - sys: newTestSys(FileMap{ + files: FileMap{ "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` { "compilerOptions": { @@ -500,7 +498,7 @@ func TestIncremental(t *testing.T) { "/home/src/workspaces/project/b.ts": `export const b = 10;const bLocal = 10;`, "/home/src/workspaces/project/c.ts": `import { a } from "./a";export const c = a;`, "/home/src/workspaces/project/d.ts": `import { b } from "./b";export const d = b;`, - }, "/home/src/workspaces/project"), + }, edits: []*testTscEdit{ { caption: "with sourceMap", @@ -537,7 +535,7 @@ func TestIncremental(t *testing.T) { { caption: "local change", edit: func(sys *testSys) { - sys.ReplaceFileText("/home/src/workspaces/project/a.ts", "Local = 1", "Local = 10") + sys.replaceFileText("/home/src/workspaces/project/a.ts", "Local = 1", "Local = 10") }, }, { @@ -559,7 +557,7 @@ func TestIncremental(t *testing.T) { { caption: "declarationMap enabling", edit: func(sys *testSys) { - sys.ReplaceFileText("/home/src/workspaces/project/tsconfig.json", `"composite": true,`, `"composite": true, "declarationMap": true`) + sys.replaceFileText("/home/src/workspaces/project/tsconfig.json", `"composite": true,`, `"composite": true, "declarationMap": true`) }, }, { @@ -570,7 +568,7 @@ func TestIncremental(t *testing.T) { }, { subScenario: "option changes with incremental", - sys: newTestSys(FileMap{ + files: FileMap{ "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` { "compilerOptions": { @@ -581,7 +579,7 @@ func TestIncremental(t *testing.T) { "/home/src/workspaces/project/b.ts": `export const b = 10;const bLocal = 10;`, "/home/src/workspaces/project/c.ts": `import { a } from "./a";export const c = a;`, "/home/src/workspaces/project/d.ts": `import { b } from "./b";export const d = b;`, - }, "/home/src/workspaces/project"), + }, edits: []*testTscEdit{ { caption: "with sourceMap", @@ -608,7 +606,7 @@ func TestIncremental(t *testing.T) { { caption: "local change", edit: func(sys *testSys) { - sys.ReplaceFileText("/home/src/workspaces/project/a.ts", "Local = 1", "Local = 10") + sys.replaceFileText("/home/src/workspaces/project/a.ts", "Local = 1", "Local = 10") }, }, { @@ -653,7 +651,7 @@ func TestIncremental(t *testing.T) { func getConstEnumTest(bdsContents string, changeEnumFile string, testSuffix string) *tscInput { return &tscInput{ subScenario: "const enums" + testSuffix, - sys: newTestSys(FileMap{ + files: FileMap{ "/home/src/workspaces/project/a.ts": stringtestutil.Dedent(` import {A} from "./c" let a = A.ONE @@ -669,31 +667,31 @@ func getConstEnumTest(bdsContents string, changeEnumFile string, testSuffix stri ONE = 1 } `), - }, "/home/src/workspaces/project"), + }, commandLineArgs: []string{"-i", `a.ts`, "--tsbuildinfofile", "a.tsbuildinfo"}, edits: []*testTscEdit{ { caption: "change enum value", edit: func(sys *testSys) { - sys.ReplaceFileText(changeEnumFile, "1", "2") + sys.replaceFileText(changeEnumFile, "1", "2") }, }, { caption: "change enum value again", edit: func(sys *testSys) { - sys.ReplaceFileText(changeEnumFile, "2", "3") + sys.replaceFileText(changeEnumFile, "2", "3") }, }, { caption: "something else changes in b.d.ts", edit: func(sys *testSys) { - sys.AppendFile("/home/src/workspaces/project/b.d.ts", "export const randomThing = 10;") + sys.appendFile("/home/src/workspaces/project/b.d.ts", "export const randomThing = 10;") }, }, { caption: "something else changes in b.d.ts again", edit: func(sys *testSys) { - sys.AppendFile("/home/src/workspaces/project/b.d.ts", "export const randomThing2 = 10;") + sys.appendFile("/home/src/workspaces/project/b.d.ts", "export const randomThing2 = 10;") }, }, }, diff --git a/internal/execute/tscnocheck_test.go b/internal/execute/tscnocheck_test.go index 1b987c9225..339356f036 100644 --- a/internal/execute/tscnocheck_test.go +++ b/internal/execute/tscnocheck_test.go @@ -21,7 +21,7 @@ func TestNoCheck(t *testing.T) { for _, c := range cases { (&tscInput{ subScenario: c.subscenario, - sys: newTestSys(FileMap{ + files: FileMap{ "/home/src/workspaces/project/a.ts": c.aText, "/home/src/workspaces/project/b.ts": `export const b = 10;`, "/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(` @@ -31,7 +31,7 @@ func TestNoCheck(t *testing.T) { } }`), // incremental: undefined, true - }, "/home/src/workspaces/project"), + }, commandLineArgs: []string{"--noCheck", "--outFile", "built"}, }).run(t, "noCheck") } diff --git a/internal/execute/tscprojectreferences_test.go b/internal/execute/tscprojectreferences_test.go index 303b05dfdf..11bf1de91a 100644 --- a/internal/execute/tscprojectreferences_test.go +++ b/internal/execute/tscprojectreferences_test.go @@ -12,7 +12,7 @@ func TestProjectReferences(t *testing.T) { // !!! sheetal todo verifyCompilerOptions - check for noEmit { subScenario: "when project references composite project with noEmit", - sys: newTestSys(FileMap{ + files: FileMap{ "/home/src/workspaces/solution/utils/index.ts": "export const x = 10;", "/home/src/workspaces/solution/utils/tsconfig.json": stringtestutil.Dedent(` { @@ -28,12 +28,13 @@ func TestProjectReferences(t *testing.T) { { "path": "../utils" }, ], }`), - }, "/home/src/workspaces/solution"), + }, + cwd: "/home/src/workspaces/solution", commandLineArgs: []string{"--p", "project"}, }, { subScenario: "when project references composite", - sys: newTestSys(FileMap{ + files: FileMap{ "/home/src/workspaces/solution/utils/index.ts": "export const x = 10;", "/home/src/workspaces/solution/utils/index.d.ts": "export declare const x = 10;", "/home/src/workspaces/solution/utils/tsconfig.json": stringtestutil.Dedent(` @@ -49,12 +50,13 @@ func TestProjectReferences(t *testing.T) { { "path": "../utils" }, ], }`), - }, "/home/src/workspaces/solution"), + }, + cwd: "/home/src/workspaces/solution", commandLineArgs: []string{"--p", "project"}, }, { subScenario: "when project reference is not built", - sys: newTestSys(FileMap{ + files: FileMap{ "/home/src/workspaces/solution/utils/index.ts": "export const x = 10;", "/home/src/workspaces/solution/utils/tsconfig.json": stringtestutil.Dedent(` { @@ -69,13 +71,14 @@ func TestProjectReferences(t *testing.T) { { "path": "../utils" }, ], }`), - }, "/home/src/workspaces/solution"), + }, + cwd: "/home/src/workspaces/solution", commandLineArgs: []string{"--p", "project"}, }, { // !!! sheetal verifyProjectReferences - checks this subScenario: "when project contains invalid project reference", - sys: newTestSys(FileMap{ + files: FileMap{ "/home/src/workspaces/solution/project/index.ts": `export const x = 10;`, "/home/src/workspaces/solution/project/tsconfig.json": stringtestutil.Dedent(` { @@ -83,12 +86,13 @@ func TestProjectReferences(t *testing.T) { { "path": "../utils" }, ], }`), - }, "/home/src/workspaces/solution"), + }, + cwd: "/home/src/workspaces/solution", commandLineArgs: []string{"--p", "project"}, }, { subScenario: "default import interop uses referenced project settings", - sys: newTestSys(FileMap{ + files: FileMap{ "/home/src/workspaces/project/node_modules/ambiguous-package/package.json": stringtestutil.Dedent(` { "name": "ambiguous-package" @@ -134,12 +138,12 @@ func TestProjectReferences(t *testing.T) { import referencedSource from "../../lib/src/a"; // Error import referencedDeclaration from "../../lib/dist/a"; // Error import ambiguous from "ambiguous-package"; // Ok`), - }, "/home/src/workspaces/project"), + }, commandLineArgs: []string{"--p", "app", "--pretty", "false"}, }, { subScenario: "referencing ambient const enum from referenced project with preserveConstEnums", - sys: newTestSys(FileMap{ + files: FileMap{ "/home/src/workspaces/solution/utils/index.ts": "export const enum E { A = 1 }", "/home/src/workspaces/solution/utils/index.d.ts": "export declare const enum E { A = 1 }", "/home/src/workspaces/solution/utils/tsconfig.json": stringtestutil.Dedent(` @@ -160,12 +164,13 @@ func TestProjectReferences(t *testing.T) { { "path": "../utils" }, ], }`), - }, "/home/src/workspaces/solution"), + }, + cwd: "/home/src/workspaces/solution", commandLineArgs: []string{"--p", "project"}, }, { subScenario: "importing const enum from referenced project with preserveConstEnums and verbatimModuleSyntax", - sys: newTestSys(FileMap{ + files: FileMap{ "/home/src/workspaces/solution/preserve/index.ts": "export const enum E { A = 1 }", "/home/src/workspaces/solution/preserve/index.d.ts": "export declare const enum E { A = 1 }", "/home/src/workspaces/solution/preserve/tsconfig.json": stringtestutil.Dedent(` @@ -202,12 +207,13 @@ func TestProjectReferences(t *testing.T) { { "path": "../no-preserve" }, ], }`), - }, "/home/src/workspaces/solution"), + }, + cwd: "/home/src/workspaces/solution", commandLineArgs: []string{"--p", "project", "--pretty", "false"}, }, { subScenario: "rewriteRelativeImportExtensionsProjectReferences1", - sys: newTestSys(FileMap{ + files: FileMap{ "/home/src/workspaces/packages/common/tsconfig.json": stringtestutil.Dedent(` { "compilerOptions": { @@ -248,12 +254,13 @@ func TestProjectReferences(t *testing.T) { "type": "module" }`), "/home/src/workspaces/packages/main/src/index.ts": `import {} from "../../common/src/index.ts";`, - }, "/home/src/workspaces"), + }, + cwd: "/home/src/workspaces", commandLineArgs: []string{"-p", "packages/main", "--pretty", "false"}, }, { subScenario: "rewriteRelativeImportExtensionsProjectReferences2", - sys: newTestSys(FileMap{ + files: FileMap{ "/home/src/workspaces/solution/src/tsconfig-base.json": stringtestutil.Dedent(` { "compilerOptions": { @@ -280,12 +287,13 @@ func TestProjectReferences(t *testing.T) { ] }`), "/home/src/workspaces/solution/src/services/services.ts": `import {} from "../compiler/parser.ts";`, - }, "/home/src/workspaces/solution"), + }, + cwd: "/home/src/workspaces/solution", commandLineArgs: []string{"--p", "src/services", "--pretty", "false"}, }, { subScenario: "rewriteRelativeImportExtensionsProjectReferences3", - sys: newTestSys(FileMap{ + files: FileMap{ "/home/src/workspaces/solution/src/tsconfig-base.json": stringtestutil.Dedent(` { "compilerOptions": { @@ -316,7 +324,8 @@ func TestProjectReferences(t *testing.T) { ] }`), "/home/src/workspaces/solution/src/services/services.ts": `import {} from "../compiler/parser.ts";`, - }, "/home/src/workspaces/solution"), + }, + cwd: "/home/src/workspaces/solution", commandLineArgs: []string{"--p", "src/services", "--pretty", "false"}, }, } diff --git a/internal/execute/tsctestrunner_test.go b/internal/execute/tsctestrunner_test.go index 8a8db89bf1..3934afaa50 100644 --- a/internal/execute/tsctestrunner_test.go +++ b/internal/execute/tsctestrunner_test.go @@ -11,12 +11,14 @@ import ( "github.com/microsoft/typescript-go/internal/execute" "github.com/microsoft/typescript-go/internal/incremental" "github.com/microsoft/typescript-go/internal/testutil/baseline" + "github.com/microsoft/typescript-go/internal/tspath" ) type testTscEdit struct { caption string commandLineArgs []string edit func(*testSys) + expectedDiff string } var noChange = &testTscEdit{ @@ -30,13 +32,14 @@ var noChangeOnlyEdit = []*testTscEdit{ type tscInput struct { subScenario string commandLineArgs []string - sys *testSys + files FileMap + cwd string edits []*testTscEdit } -func (test *tscInput) executeCommand(baselineBuilder *strings.Builder, commandLineArgs []string) (*incremental.Program, *execute.Watcher) { +func (test *tscInput) executeCommand(sys *testSys, baselineBuilder *strings.Builder, commandLineArgs []string) (*incremental.Program, *execute.Watcher) { fmt.Fprint(baselineBuilder, "tsgo ", strings.Join(commandLineArgs, " "), "\n") - exit, incrementalProgram, watcher := execute.CommandLine(test.sys, commandLineArgs, true) + exit, incrementalProgram, watcher := execute.CommandLine(sys, commandLineArgs, true) switch exit { case execute.ExitStatusSuccess: baselineBuilder.WriteString("ExitStatus:: Success") @@ -63,41 +66,99 @@ func (test *tscInput) run(t *testing.T, scenario string) { t.Parallel() // initial test tsc compile baselineBuilder := &strings.Builder{} + sys := newTestSys(test.files, test.cwd) fmt.Fprint( baselineBuilder, "currentDirectory::", - test.sys.GetCurrentDirectory(), + sys.GetCurrentDirectory(), "\nuseCaseSensitiveFileNames::", - test.sys.FS().UseCaseSensitiveFileNames(), + sys.FS().UseCaseSensitiveFileNames(), "\nInput::\n", ) - test.sys.baselineFSwithDiff(baselineBuilder) - incrementalProgram, watcher := test.executeCommand(baselineBuilder, test.commandLineArgs) - test.sys.serializeState(baselineBuilder) - test.sys.baselineProgram(baselineBuilder, incrementalProgram, watcher) + sys.baselineFSwithDiff(baselineBuilder) + incrementalProgram, watcher := test.executeCommand(sys, baselineBuilder, test.commandLineArgs) + sys.serializeState(baselineBuilder) + sys.baselineProgram(baselineBuilder, incrementalProgram, watcher) for index, do := range test.edits { - baselineBuilder.WriteString(fmt.Sprintf("\n\nEdit [%d]:: %s\n", index, do.caption)) - if do.edit != nil { - do.edit(test.sys) - } - test.sys.baselineFSwithDiff(baselineBuilder) + sys.clearOutput() + wg := core.NewWorkGroup(false) + var nonIncrementalSys *testSys + commandLineArgs := core.IfElse(do.commandLineArgs == nil, test.commandLineArgs, do.commandLineArgs) + wg.Queue(func() { + baselineBuilder.WriteString(fmt.Sprintf("\n\nEdit [%d]:: %s\n", index, do.caption)) + if do.edit != nil { + do.edit(sys) + } + sys.baselineFSwithDiff(baselineBuilder) + + var incrementalProgram *incremental.Program + if watcher == nil { + incrementalProgram, watcher = test.executeCommand(sys, baselineBuilder, commandLineArgs) + } else { + watcher.DoCycle() + } + sys.serializeState(baselineBuilder) + sys.baselineProgram(baselineBuilder, incrementalProgram, watcher) + }) + wg.Queue(func() { + // !!! Compute build with all the edits + nonIncrementalSys = newTestSys(test.files, test.cwd) + for i := range index + 1 { + if test.edits[i].edit != nil { + test.edits[i].edit(nonIncrementalSys) + } + execute.CommandLine(nonIncrementalSys, commandLineArgs, true) + } + }) + wg.RunAndWait() - var incrementalProgram *incremental.Program - if watcher == nil { - commandLineArgs := core.IfElse(do.commandLineArgs == nil, test.commandLineArgs, do.commandLineArgs) - incrementalProgram, watcher = test.executeCommand(baselineBuilder, commandLineArgs) - } else { - watcher.DoCycle() + diff := getDiffForIncremental(sys, nonIncrementalSys) + if diff != "" { + baselineBuilder.WriteString(fmt.Sprintf("\n\nDiff:: %s\n", core.IfElse(do.expectedDiff == "", "!!! Unexpected !!!", do.expectedDiff))) + baselineBuilder.WriteString(diff) + } else if do.expectedDiff != "" { + baselineBuilder.WriteString(fmt.Sprintf("\n\nDiff:: %s !!! Unexpected !!!\n", do.expectedDiff)) } - test.sys.serializeState(baselineBuilder) - test.sys.baselineProgram(baselineBuilder, incrementalProgram, watcher) } - baseline.Run(t, strings.ReplaceAll(test.subScenario, " ", "-")+".js", baselineBuilder.String(), baseline.Options{Subfolder: filepath.Join(test.getBaselineSubFolder(), scenario)}) }) } +func getDiffForIncremental(incrementalSys *testSys, nonIncrementalSys *testSys) string { + var diffBuilder strings.Builder + + nonIncrementalOutputs := nonIncrementalSys.testFs().writtenFiles.ToArray() + slices.Sort(nonIncrementalOutputs) + for _, nonIncrementalOutput := range nonIncrementalOutputs { + if tspath.FileExtensionIs(nonIncrementalOutput, tspath.ExtensionTsBuildInfo) { + // Just check existence + if !incrementalSys.fsFromFileMap().FileExists(nonIncrementalOutput) { + diffBuilder.WriteString(baseline.DiffText("nonIncremental "+nonIncrementalOutput, "incremental "+nonIncrementalOutput, "Exists", "")) + diffBuilder.WriteString("\n") + } + } else { + nonIncrementalText, ok := nonIncrementalSys.fsFromFileMap().ReadFile(nonIncrementalOutput) + if !ok { + panic("Written file not found " + nonIncrementalOutput) + } + incrementalText, ok := incrementalSys.fsFromFileMap().ReadFile(nonIncrementalOutput) + if !ok || incrementalText != nonIncrementalText { + diffBuilder.WriteString(baseline.DiffText("nonIncremental "+nonIncrementalOutput, "incremental "+nonIncrementalOutput, nonIncrementalText, incrementalText)) + diffBuilder.WriteString("\n") + } + } + } + + incrementalErrors := strings.Join(incrementalSys.output, "\n") + nonIncrementalErrors := strings.Join(nonIncrementalSys.output, "\n") + if incrementalErrors != nonIncrementalErrors { + diffBuilder.WriteString(baseline.DiffText("nonIncremental errors.txt", "incremental errors.txt", nonIncrementalErrors, incrementalErrors)) + } + // !!! sheetal errors + return diffBuilder.String() +} + func (test *tscInput) getBaselineSubFolder() string { commandName := "tsc" if slices.ContainsFunc(test.commandLineArgs, func(arg string) bool { diff --git a/internal/execute/tscwatch_test.go b/internal/execute/tscwatch_test.go index e16da6b5c0..693a7630af 100644 --- a/internal/execute/tscwatch_test.go +++ b/internal/execute/tscwatch_test.go @@ -10,9 +10,9 @@ func TestWatch(t *testing.T) { testCases := []*tscInput{ { subScenario: "watch with no tsconfig", - sys: newTestSys(FileMap{ + files: FileMap{ "/home/src/workspaces/project/index.ts": "", - }, "/home/src/workspaces/project"), + }, commandLineArgs: []string{"index.ts", "--watch"}, }, } @@ -54,32 +54,31 @@ func noEmitWatchTestInput( ) *tscInput { noEmitOpt := `"noEmit": true` tsconfigText, optionString := listToTsconfig(noEmitOpt, tsconfigOptions...) - sys := newTestSys(FileMap{ - "/home/src/workspaces/project/a.ts": aText, - "/home/src/workspaces/project/tsconfig.json": tsconfigText, - }, "/home/src/workspaces/project") return &tscInput{ subScenario: subScenario, commandLineArgs: commandLineArgs, - sys: sys, + files: FileMap{ + "/home/src/workspaces/project/a.ts": aText, + "/home/src/workspaces/project/tsconfig.json": tsconfigText, + }, edits: []*testTscEdit{ newTscEdit("fix error", func(sys *testSys) { - sys.WriteFileNoError("/home/src/workspaces/project/a.ts", `const a = "hello";`, false) + sys.writeFileNoError("/home/src/workspaces/project/a.ts", `const a = "hello";`, false) }), newTscEdit("emit after fixing error", func(sys *testSys) { - sys.WriteFileNoError("/home/src/workspaces/project/tsconfig.json", toTsconfig("", optionString), false) + sys.writeFileNoError("/home/src/workspaces/project/tsconfig.json", toTsconfig("", optionString), false) }), newTscEdit("no emit run after fixing error", func(sys *testSys) { - sys.WriteFileNoError("/home/src/workspaces/project/tsconfig.json", toTsconfig(noEmitOpt, optionString), false) + sys.writeFileNoError("/home/src/workspaces/project/tsconfig.json", toTsconfig(noEmitOpt, optionString), false) }), newTscEdit("introduce error", func(sys *testSys) { - sys.WriteFileNoError("/home/src/workspaces/project/a.ts", aText, false) + sys.writeFileNoError("/home/src/workspaces/project/a.ts", aText, false) }), newTscEdit("emit when error", func(sys *testSys) { - sys.WriteFileNoError("/home/src/workspaces/project/tsconfig.json", toTsconfig("", optionString), false) + sys.writeFileNoError("/home/src/workspaces/project/tsconfig.json", toTsconfig("", optionString), false) }), newTscEdit("no emit run when error", func(sys *testSys) { - sys.WriteFileNoError("/home/src/workspaces/project/tsconfig.json", toTsconfig(noEmitOpt, optionString), false) + sys.writeFileNoError("/home/src/workspaces/project/tsconfig.json", toTsconfig(noEmitOpt, optionString), false) }), }, } diff --git a/internal/testutil/incrementaltestutil/fs.go b/internal/testutil/incrementaltestutil/fs.go index 42e04b0052..51ce6caf2e 100644 --- a/internal/testutil/incrementaltestutil/fs.go +++ b/internal/testutil/incrementaltestutil/fs.go @@ -16,18 +16,10 @@ type FsHandlingBuildInfo struct { vfs.FS } -func NewFsHandlingBuildInfo(fs vfs.FS) *FsHandlingBuildInfo { - return &FsHandlingBuildInfo{FS: fs} -} - -func (f *FsHandlingBuildInfo) InnerReadFile(path string) (contents string, ok bool) { - return f.FS.ReadFile(path) -} - // ReadFile reads the file specified by path and returns the content. // If the file fails to be read, ok will be false. func (f *FsHandlingBuildInfo) ReadFile(path string) (contents string, ok bool) { - contents, ok = f.InnerReadFile(path) + contents, ok = f.FS.ReadFile(path) if ok && tspath.FileExtensionIs(path, tspath.ExtensionTsBuildInfo) { // read buildinfo and modify version var buildInfo incremental.BuildInfo