diff --git a/internal/api/encoder/encoder_test.go b/internal/api/encoder/encoder_test.go index ce616dfc26..d72fafe5ae 100644 --- a/internal/api/encoder/encoder_test.go +++ b/internal/api/encoder/encoder_test.go @@ -18,9 +18,13 @@ import ( "gotest.tools/v3/assert" ) +var parseCompilerOptions = &core.SourceFileAffectingCompilerOptions{ + EmitScriptTarget: core.ScriptTargetLatest, +} + func TestEncodeSourceFile(t *testing.T) { t.Parallel() - sourceFile := parser.ParseSourceFile("/test.ts", "/test.ts", "import { bar } from \"bar\";\nexport function foo(a: string, b: string): any {}\nfoo();", core.ScriptTargetESNext, scanner.JSDocParsingModeParseAll) + sourceFile := parser.ParseSourceFile("/test.ts", "/test.ts", "import { bar } from \"bar\";\nexport function foo(a: string, b: string): any {}\nfoo();", parseCompilerOptions, nil, scanner.JSDocParsingModeParseAll) t.Run("baseline", func(t *testing.T) { t.Parallel() buf, err := encoder.EncodeSourceFile(sourceFile, "") @@ -42,7 +46,8 @@ func BenchmarkEncodeSourceFile(b *testing.B) { "/checker.ts", "/checker.ts", string(fileContent), - core.ScriptTargetESNext, + parseCompilerOptions, + nil, scanner.JSDocParsingModeParseAll, ) diff --git a/internal/ast/ast.go b/internal/ast/ast.go index e5b403bd7e..bd2fa09786 100644 --- a/internal/ast/ast.go +++ b/internal/ast/ast.go @@ -10007,6 +10007,8 @@ type SourceFile struct { CheckJsDirective *CheckJsDirective NodeCount int TextCount int + CommonJSModuleIndicator *Node + ExternalModuleIndicator *Node // Fields set by binder @@ -10029,11 +10031,7 @@ type SourceFile struct { tokenCacheMu sync.Mutex tokenCache map[core.TextRange]*Node - // !!! - - CommonJSModuleIndicator *Node - ExternalModuleIndicator *Node - JSGlobalAugmentations SymbolTable + JSGlobalAugmentations SymbolTable // !!! remove me } func (f *NodeFactory) NewSourceFile(text string, fileName string, path tspath.Path, statements *NodeList) *Node { diff --git a/internal/ast/utilities.go b/internal/ast/utilities.go index 4e51ff2a06..5915491a43 100644 --- a/internal/ast/utilities.go +++ b/internal/ast/utilities.go @@ -2514,16 +2514,15 @@ func GetImpliedNodeFormatForFile(path string, packageJsonType string) core.Modul } func GetEmitModuleFormatOfFileWorker(fileName string, options *core.CompilerOptions, sourceFileMetaData *SourceFileMetaData) core.ModuleKind { - result := GetImpliedNodeFormatForEmitWorker(fileName, options, sourceFileMetaData) + result := GetImpliedNodeFormatForEmitWorker(fileName, options.GetEmitModuleKind(), sourceFileMetaData) if result != core.ModuleKindNone { return result } return options.GetEmitModuleKind() } -func GetImpliedNodeFormatForEmitWorker(fileName string, options *core.CompilerOptions, sourceFileMetaData *SourceFileMetaData) core.ResolutionMode { - moduleKind := options.GetEmitModuleKind() - if core.ModuleKindNode16 <= moduleKind && moduleKind <= core.ModuleKindNodeNext { +func GetImpliedNodeFormatForEmitWorker(fileName string, emitModuleKind core.ModuleKind, sourceFileMetaData *SourceFileMetaData) core.ResolutionMode { + if core.ModuleKindNode16 <= emitModuleKind && emitModuleKind <= core.ModuleKindNodeNext { if sourceFileMetaData == nil { return core.ModuleKindNone } diff --git a/internal/astnav/tokens_test.go b/internal/astnav/tokens_test.go index 7ccd674924..208b137d60 100644 --- a/internal/astnav/tokens_test.go +++ b/internal/astnav/tokens_test.go @@ -26,6 +26,10 @@ var testFiles = []string{ filepath.Join(repo.TypeScriptSubmodulePath, "src/services/mapCode.ts"), } +var parseCompilerOptions = &core.SourceFileAffectingCompilerOptions{ + EmitScriptTarget: core.ScriptTargetLatest, +} + func TestGetTokenAtPosition(t *testing.T) { t.Parallel() repo.SkipIfNoTypeScriptSubmodule(t) @@ -53,7 +57,7 @@ func TestGetTokenAtPosition(t *testing.T) { return 0; } ` - file := parser.ParseSourceFile("/file.ts", "/file.ts", fileText, core.ScriptTargetLatest, scanner.JSDocParsingModeParseAll) + file := parser.ParseSourceFile("/file.ts", "/file.ts", fileText, parseCompilerOptions, nil, scanner.JSDocParsingModeParseAll) assert.Equal(t, astnav.GetTokenAtPosition(file, 0), astnav.GetTokenAtPosition(file, 0)) }) } @@ -88,7 +92,7 @@ func baselineTokens(t *testing.T, testName string, includeEOF bool, getTSTokens positions[i] = i } tsTokens := getTSTokens(string(fileText), positions) - file := parser.ParseSourceFile("/file.ts", "/file.ts", string(fileText), core.ScriptTargetLatest, scanner.JSDocParsingModeParseAll) + file := parser.ParseSourceFile("/file.ts", "/file.ts", string(fileText), parseCompilerOptions, nil, scanner.JSDocParsingModeParseAll) var output strings.Builder currentRange := core.NewTextRange(0, 0) @@ -421,7 +425,7 @@ export function isAnyDirectorySeparator(charCode: number): boolean { for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { t.Parallel() - file := parser.ParseSourceFile("/file.ts", "/file.ts", testCase.fileContent, core.ScriptTargetLatest, scanner.JSDocParsingModeParseAll) + file := parser.ParseSourceFile("/file.ts", "/file.ts", testCase.fileContent, parseCompilerOptions, nil, scanner.JSDocParsingModeParseAll) token := astnav.FindPrecedingToken(file, testCase.position) assert.Equal(t, token.Kind, testCase.expectedKind) }) diff --git a/internal/binder/binder_test.go b/internal/binder/binder_test.go index 2058632879..776fc717f0 100644 --- a/internal/binder/binder_test.go +++ b/internal/binder/binder_test.go @@ -22,14 +22,14 @@ func BenchmarkBind(b *testing.B) { path := tspath.ToPath(fileName, "/", osvfs.FS().UseCaseSensitiveFileNames()) sourceText := f.ReadFile(b) + compilerOptions := &core.CompilerOptions{Target: core.ScriptTargetESNext, Module: core.ModuleKindNodeNext} + sourceAffecting := compilerOptions.SourceFileAffecting() + sourceFiles := make([]*ast.SourceFile, b.N) for i := range b.N { - sourceFiles[i] = parser.ParseSourceFile(fileName, path, sourceText, core.ScriptTargetESNext, scanner.JSDocParsingModeParseAll) + sourceFiles[i] = parser.ParseSourceFile(fileName, path, sourceText, sourceAffecting, nil, scanner.JSDocParsingModeParseAll) } - compilerOptions := &core.CompilerOptions{Target: core.ScriptTargetESNext, Module: core.ModuleKindNodeNext} - sourceAffecting := compilerOptions.SourceFileAffecting() - // The above parses do a lot of work; ensure GC is finished before we start collecting performance data. // GC must be called twice to allow things to settle. runtime.GC() diff --git a/internal/compiler/fileloader.go b/internal/compiler/fileloader.go index ae7c29810f..b20dd0b884 100644 --- a/internal/compiler/fileloader.go +++ b/internal/compiler/fileloader.go @@ -244,13 +244,13 @@ func (t *parseTask) start(loader *fileLoader) { } loader.wg.Queue(func() { - file := loader.parseSourceFile(t.normalizedFilePath) + t.metadata = loader.loadSourceFileMetaData(t.normalizedFilePath) + file := loader.parseSourceFile(t.normalizedFilePath, t.metadata) if file == nil { return } t.file = file - t.metadata = loader.loadSourceFileMetaData(file.FileName()) // !!! if noResolve, skip all of this t.subTasks = make([]*parseTask, 0, len(file.ReferencedFiles)+len(file.Imports())+len(file.ModuleAugmentations)) @@ -309,9 +309,9 @@ func (p *fileLoader) loadSourceFileMetaData(fileName string) *ast.SourceFileMeta } } -func (p *fileLoader) parseSourceFile(fileName string) *ast.SourceFile { +func (p *fileLoader) parseSourceFile(fileName string, metadata *ast.SourceFileMetaData) *ast.SourceFile { path := tspath.ToPath(fileName, p.opts.Host.GetCurrentDirectory(), p.opts.Host.FS().UseCaseSensitiveFileNames()) - sourceFile := p.opts.Host.GetSourceFile(fileName, path, p.opts.Config.CompilerOptions().GetEmitScriptTarget()) + sourceFile := p.opts.Host.GetSourceFile(fileName, path, p.opts.Config.CompilerOptions().SourceFileAffecting(), metadata) // TODO(jakebailey): cache :( return sourceFile } @@ -467,7 +467,7 @@ func getModeForTypeReferenceDirectiveInFile(ref *ast.FileReference, file *ast.So func getDefaultResolutionModeForFile(fileName string, meta *ast.SourceFileMetaData, options *core.CompilerOptions) core.ResolutionMode { if importSyntaxAffectsModuleResolution(options) { - return ast.GetImpliedNodeFormatForEmitWorker(fileName, options, meta) + return ast.GetImpliedNodeFormatForEmitWorker(fileName, options.GetEmitModuleKind(), meta) } else { return core.ResolutionModeNone } diff --git a/internal/compiler/host.go b/internal/compiler/host.go index 3db76b350a..efe187f0ad 100644 --- a/internal/compiler/host.go +++ b/internal/compiler/host.go @@ -16,7 +16,7 @@ type CompilerHost interface { GetCurrentDirectory() string NewLine() string Trace(msg string) - GetSourceFile(fileName string, path tspath.Path, languageVersion core.ScriptTarget) *ast.SourceFile + GetSourceFile(fileName string, path tspath.Path, options *core.SourceFileAffectingCompilerOptions, metadata *ast.SourceFileMetaData) *ast.SourceFile } type FileInfo struct { @@ -73,10 +73,10 @@ func (h *compilerHost) Trace(msg string) { //!!! TODO: implement } -func (h *compilerHost) GetSourceFile(fileName string, path tspath.Path, languageVersion core.ScriptTarget) *ast.SourceFile { +func (h *compilerHost) GetSourceFile(fileName string, path tspath.Path, options *core.SourceFileAffectingCompilerOptions, metadata *ast.SourceFileMetaData) *ast.SourceFile { text, _ := h.FS().ReadFile(fileName) if tspath.FileExtensionIs(fileName, tspath.ExtensionJson) { return parser.ParseJSONText(fileName, path, text) } - return parser.ParseSourceFile(fileName, path, text, languageVersion, scanner.JSDocParsingModeParseForTypeErrors) + return parser.ParseSourceFile(fileName, path, text, options, metadata, scanner.JSDocParsingModeParseForTypeErrors) } diff --git a/internal/compiler/program.go b/internal/compiler/program.go index a5a8b96800..c1088556a0 100644 --- a/internal/compiler/program.go +++ b/internal/compiler/program.go @@ -228,7 +228,9 @@ func NewProgram(opts ProgramOptions) *Program { // In addition to a new program, return a boolean indicating whether the data of the old program was reused. func (p *Program) UpdateProgram(changedFilePath tspath.Path) (*Program, bool) { oldFile := p.filesByPath[changedFilePath] - newFile := p.Host().GetSourceFile(oldFile.FileName(), changedFilePath, oldFile.LanguageVersion) + // TODO(jakebailey): is wrong because the new file may have new metadata? + metadata := p.sourceFileMetaDatas[changedFilePath] + newFile := p.Host().GetSourceFile(oldFile.FileName(), changedFilePath, p.Options().SourceFileAffecting(), metadata) if !canReplaceFileInProgram(oldFile, newFile) { return NewProgram(p.opts), false } @@ -262,6 +264,7 @@ func (p *Program) initCheckerPool() { } func canReplaceFileInProgram(file1 *ast.SourceFile, file2 *ast.SourceFile) bool { + // TODO(jakebailey): metadata?? return file1.FileName() == file2.FileName() && file1.Path() == file2.Path() && file1.LanguageVersion == file2.LanguageVersion && @@ -696,7 +699,7 @@ func (p *Program) GetEmitSyntaxForUsageLocation(sourceFile ast.HasFileName, loca } func (p *Program) GetImpliedNodeFormatForEmit(sourceFile ast.HasFileName) core.ResolutionMode { - return ast.GetImpliedNodeFormatForEmitWorker(sourceFile.FileName(), p.Options(), p.GetSourceFileMetaData(sourceFile.Path())) + return ast.GetImpliedNodeFormatForEmitWorker(sourceFile.FileName(), p.Options().GetEmitModuleKind(), p.GetSourceFileMetaData(sourceFile.Path())) } func (p *Program) GetModeForUsageLocation(sourceFile ast.HasFileName, location *ast.StringLiteralLike) core.ResolutionMode { diff --git a/internal/core/compileroptions.go b/internal/core/compileroptions.go index 36c3d665d6..3001df1ea8 100644 --- a/internal/core/compileroptions.go +++ b/internal/core/compileroptions.go @@ -216,6 +216,18 @@ func (options *CompilerOptions) GetModuleResolutionKind() ModuleResolutionKind { } } +func (options *CompilerOptions) GetEmitModuleDetectionKind() ModuleDetectionKind { + if options.ModuleDetection != ModuleDetectionKindNone { + return options.ModuleDetection + } + switch options.GetEmitModuleKind() { + case ModuleKindNode16, ModuleKindNodeNext: + return ModuleDetectionKindForce + default: + return ModuleDetectionKindAuto + } +} + func (options *CompilerOptions) GetResolvePackageJsonExports() bool { return options.ResolvePackageJsonExports.IsTrueOrUnknown() } @@ -339,7 +351,10 @@ type SourceFileAffectingCompilerOptions struct { AllowUnreachableCode Tristate AllowUnusedLabels Tristate BindInStrictMode bool + EmitModuleDetectionKind ModuleDetectionKind + EmitModuleKind ModuleKind EmitScriptTarget ScriptTarget + JsxEmit JsxEmit NoFallthroughCasesInSwitch Tristate ShouldPreserveConstEnums bool } @@ -349,7 +364,10 @@ func (options *CompilerOptions) SourceFileAffecting() *SourceFileAffectingCompil AllowUnreachableCode: options.AllowUnreachableCode, AllowUnusedLabels: options.AllowUnusedLabels, BindInStrictMode: options.AlwaysStrict.IsTrue() || options.Strict.IsTrue(), + EmitModuleDetectionKind: options.GetEmitModuleDetectionKind(), + EmitModuleKind: options.GetEmitModuleKind(), EmitScriptTarget: options.GetEmitScriptTarget(), + JsxEmit: options.Jsx, NoFallthroughCasesInSwitch: options.NoFallthroughCasesInSwitch, ShouldPreserveConstEnums: options.ShouldPreserveConstEnums(), } diff --git a/internal/format/api_test.go b/internal/format/api_test.go index f1ab160098..d60227f7dd 100644 --- a/internal/format/api_test.go +++ b/internal/format/api_test.go @@ -34,6 +34,10 @@ func applyBulkEdits(text string, edits []core.TextChange) string { return b.String() } +var parseCompilerOptions = &core.SourceFileAffectingCompilerOptions{ + EmitScriptTarget: core.ScriptTargetLatest, +} + func TestFormat(t *testing.T) { t.Parallel() @@ -60,7 +64,8 @@ func TestFormat(t *testing.T) { "/checker.ts", "/checker.ts", text, - core.ScriptTargetESNext, + parseCompilerOptions, + nil, scanner.JSDocParsingModeParseAll, ) ast.SetParentInChildren(sourceFile.AsNode()) @@ -93,7 +98,8 @@ func BenchmarkFormat(b *testing.B) { "/checker.ts", "/checker.ts", text, - core.ScriptTargetESNext, + parseCompilerOptions, + nil, scanner.JSDocParsingModeParseAll, ) ast.SetParentInChildren(sourceFile.AsNode()) diff --git a/internal/fourslash/fourslash.go b/internal/fourslash/fourslash.go index 79061b65d0..d037864532 100644 --- a/internal/fourslash/fourslash.go +++ b/internal/fourslash/fourslash.go @@ -80,15 +80,15 @@ func (c *parsedFileCache) GetFile( fileName string, path tspath.Path, text string, - scriptTarget core.ScriptTarget, - options core.SourceFileAffectingCompilerOptions, + options *core.SourceFileAffectingCompilerOptions, + metadata *ast.SourceFileMetaData, ) *ast.SourceFile { key := harnessutil.GetSourceFileCacheKey( - options, fileName, path, - scriptTarget, text, + options, + metadata, ) cachedFile, ok := sourceFileCache.Load(key) @@ -102,16 +102,16 @@ func (c *parsedFileCache) CacheFile( fileName string, path tspath.Path, text string, - scriptTarget core.ScriptTarget, - options core.SourceFileAffectingCompilerOptions, + options *core.SourceFileAffectingCompilerOptions, + metadata *ast.SourceFileMetaData, sourceFile *ast.SourceFile, ) { key := harnessutil.GetSourceFileCacheKey( - options, fileName, path, - scriptTarget, text, + options, + metadata, ) sourceFileCache.Store(key, sourceFile) } diff --git a/internal/parser/parser.go b/internal/parser/parser.go index 5dd05157f9..217eaa6bde 100644 --- a/internal/parser/parser.go +++ b/internal/parser/parser.go @@ -52,6 +52,8 @@ type Parser struct { fileName string path tspath.Path sourceText string + options *core.SourceFileAffectingCompilerOptions + metadata *ast.SourceFileMetaData languageVersion core.ScriptTarget scriptKind core.ScriptKind languageVariant core.LanguageVariant @@ -96,10 +98,10 @@ func putParser(p *Parser) { parserPool.Put(p) } -func ParseSourceFile(fileName string, path tspath.Path, sourceText string, languageVersion core.ScriptTarget, jsdocParsingMode scanner.JSDocParsingMode) *ast.SourceFile { +func ParseSourceFile(fileName string, path tspath.Path, sourceText string, options *core.SourceFileAffectingCompilerOptions, metadata *ast.SourceFileMetaData, jsdocParsingMode scanner.JSDocParsingMode) *ast.SourceFile { p := getParser() defer putParser(p) - p.initializeState(fileName, path, sourceText, languageVersion, core.ScriptKindUnknown, jsdocParsingMode) + p.initializeState(fileName, path, sourceText, options, metadata, core.ScriptKindUnknown, jsdocParsingMode) p.nextToken() return p.parseSourceFileWorker() } @@ -107,7 +109,7 @@ func ParseSourceFile(fileName string, path tspath.Path, sourceText string, langu func ParseJSONText(fileName string, path tspath.Path, sourceText string) *ast.SourceFile { p := getParser() defer putParser(p) - p.initializeState(fileName, path, sourceText, core.ScriptTargetES2015, core.ScriptKindJSON, scanner.JSDocParsingModeParseAll) + p.initializeState(fileName, path, sourceText, &core.SourceFileAffectingCompilerOptions{EmitScriptTarget: core.ScriptTargetES2015}, nil, core.ScriptKindJSON, scanner.JSDocParsingModeParseAll) p.nextToken() pos := p.nodePos() var statements *ast.NodeList @@ -183,13 +185,13 @@ func ParseJSONText(fileName string, path tspath.Path, sourceText string) *ast.So func ParseIsolatedEntityName(text string, languageVersion core.ScriptTarget) *ast.EntityName { p := getParser() defer putParser(p) - p.initializeState("", "", text, languageVersion, core.ScriptKindJS, scanner.JSDocParsingModeParseAll) + p.initializeState("", "", text, &core.SourceFileAffectingCompilerOptions{EmitScriptTarget: languageVersion}, nil, core.ScriptKindJS, scanner.JSDocParsingModeParseAll) p.nextToken() entityName := p.parseEntityName(true, nil) return core.IfElse(p.token == ast.KindEndOfFile && len(p.diagnostics) == 0, entityName, nil) } -func (p *Parser) initializeState(fileName string, path tspath.Path, sourceText string, languageVersion core.ScriptTarget, scriptKind core.ScriptKind, jsdocParsingMode scanner.JSDocParsingMode) { +func (p *Parser) initializeState(fileName string, path tspath.Path, sourceText string, options *core.SourceFileAffectingCompilerOptions, metadata *ast.SourceFileMetaData, scriptKind core.ScriptKind, jsdocParsingMode scanner.JSDocParsingMode) { if p.scanner == nil { p.scanner = scanner.NewScanner() } else { @@ -198,7 +200,9 @@ func (p *Parser) initializeState(fileName string, path tspath.Path, sourceText s p.fileName = fileName p.path = path p.sourceText = sourceText - p.languageVersion = languageVersion + p.options = options + p.metadata = metadata + p.languageVersion = options.EmitScriptTarget p.scriptKind = ensureScriptKind(fileName, scriptKind) p.languageVariant = ast.GetLanguageVariant(p.scriptKind) switch p.scriptKind { @@ -343,7 +347,6 @@ func (p *Parser) finishSourceFile(result *ast.SourceFile, isDeclarationFile bool result.Pragmas = getCommentPragmas(&p.factory, p.sourceText) p.processPragmasIntoFields(result) result.SetDiagnostics(attachFileToDiagnostics(p.diagnostics, result)) - result.ExternalModuleIndicator = isFileProbablyExternalModule(result) // !!! result.CommonJSModuleIndicator = p.commonJSModuleIndicator result.IsDeclarationFile = isDeclarationFile result.LanguageVersion = p.languageVersion @@ -355,6 +358,82 @@ func (p *Parser) finishSourceFile(result *ast.SourceFile, isDeclarationFile bool result.TextCount = p.factory.TextCount() result.IdentifierCount = p.identifierCount result.SetJSDocCache(p.jsdocCache) + result.ExternalModuleIndicator = getExternalModuleIndicator(result, p.options, p.metadata) +} + +func getExternalModuleIndicator(file *ast.SourceFile, options *core.SourceFileAffectingCompilerOptions, metadata *ast.SourceFileMetaData) *ast.Node { + // All detection kinds start by checking this. + if node := isFileProbablyExternalModule(file); node != nil { + return node + } + + switch options.EmitModuleDetectionKind { + case core.ModuleDetectionKindForce: + // All non-declaration files are modules, declaration files still do the usual isFileProbablyExternalModule + if !file.IsDeclarationFile { + return file.AsNode() + } + return nil + case core.ModuleDetectionKindLegacy: + // Files are modules if they have imports, exports, or import.meta + return nil + case core.ModuleDetectionKindAuto: + // If module is nodenext or node16, all esm format files are modules + // If jsx is react-jsx or react-jsxdev then jsx tags force module-ness + // otherwise, the presence of import or export statments (or import.meta) implies module-ness + if options.JsxEmit == core.JsxEmitReactJSX || options.JsxEmit == core.JsxEmitReactJSXDev { + if node := isFileModuleFromUsingJSXTag(file); node != nil { + return node + } + } + return isFileForcedToBeModuleByFormat(file, options, metadata) + default: + return nil + } +} + +func isFileModuleFromUsingJSXTag(file *ast.SourceFile) *ast.Node { + if file.IsDeclarationFile { + return nil + } + return walkTreeForJSXTags(file.AsNode()) +} + +// This is a somewhat unavoidable full tree walk to locate a JSX tag - `import.meta` requires the same, +// but we avoid that walk (or parts of it) if at all possible using the `PossiblyContainsImportMeta` node flag. +// Unfortunately, there's no `NodeFlag` space to do the same for JSX. +func walkTreeForJSXTags(node *ast.Node) *ast.Node { + var found *ast.Node + + var visitor func(node *ast.Node) bool + visitor = func(node *ast.Node) bool { + if found != nil { + return true + } + if node.SubtreeFacts()&ast.SubtreeContainsJsx == 0 { + return true + } + if ast.IsJsxOpeningElement(node) || ast.IsJsxFragment(node) { + found = node + return true + } + return node.ForEachChild(visitor) + } + visitor(node) + + return found +} + +var isFileForcedToBeModuleByFormatExtensions = []string{tspath.ExtensionCjs, tspath.ExtensionCts, tspath.ExtensionMjs, tspath.ExtensionMts} + +func isFileForcedToBeModuleByFormat(file *ast.SourceFile, options *core.SourceFileAffectingCompilerOptions, metadata *ast.SourceFileMetaData) *ast.Node { + // Excludes declaration files - they still require an explicit `export {}` or the like + // for back compat purposes. The only non-declaration files _not_ forced to be a module are `.js` files + // that aren't esm-mode (meaning not in a `type: module` scope). + if !file.IsDeclarationFile && (ast.GetImpliedNodeFormatForEmitWorker(file.FileName(), options.EmitModuleKind, metadata) == core.ModuleKindESNext || tspath.FileExtensionIsOneOf(file.FileName(), isFileForcedToBeModuleByFormatExtensions)) { + return file.AsNode() + } + return nil } func (p *Parser) parseToplevelStatement(i int) *ast.Node { diff --git a/internal/parser/parser_test.go b/internal/parser/parser_test.go index 88d5d5f878..e99772f7b1 100644 --- a/internal/parser/parser_test.go +++ b/internal/parser/parser_test.go @@ -32,12 +32,15 @@ func BenchmarkParse(b *testing.B) { fileName := tspath.GetNormalizedAbsolutePath(f.Path(), "/") path := tspath.ToPath(fileName, "/", osvfs.FS().UseCaseSensitiveFileNames()) sourceText := f.ReadFile(b) + options := &core.SourceFileAffectingCompilerOptions{ + EmitScriptTarget: core.ScriptTargetESNext, + } for _, jsdoc := range jsdocModes { b.Run(jsdoc.name, func(b *testing.B) { jsdocMode := jsdoc.mode for b.Loop() { - ParseSourceFile(fileName, path, sourceText, core.ScriptTargetESNext, jsdocMode) + ParseSourceFile(fileName, path, sourceText, options, nil, jsdocMode) } }) } @@ -130,6 +133,10 @@ func FuzzParser(f *testing.F) { return } - ParseSourceFile(fileName, path, sourceText, scriptTarget, jsdocParsingMode) + options := &core.SourceFileAffectingCompilerOptions{ + EmitScriptTarget: scriptTarget, + } + + ParseSourceFile(fileName, path, sourceText, options, nil, jsdocParsingMode) }) } diff --git a/internal/project/documentregistry.go b/internal/project/documentregistry.go index 7aab2f8b48..dc497f320d 100644 --- a/internal/project/documentregistry.go +++ b/internal/project/documentregistry.go @@ -13,13 +13,15 @@ import ( type registryKey struct { core.SourceFileAffectingCompilerOptions + ast.SourceFileMetaData path tspath.Path scriptKind core.ScriptKind } -func newRegistryKey(options *core.CompilerOptions, path tspath.Path, scriptKind core.ScriptKind) registryKey { +func newRegistryKey(options *core.CompilerOptions, path tspath.Path, scriptKind core.ScriptKind, metadata *ast.SourceFileMetaData) registryKey { return registryKey{ SourceFileAffectingCompilerOptions: *options.SourceFileAffecting(), + SourceFileMetaData: *metadata, path: path, scriptKind: scriptKind, } @@ -56,18 +58,18 @@ type DocumentRegistry struct { // LanguageService instance over time, as well as across multiple instances. Here, we still // reuse files across multiple LanguageServices, but we only reuse them across Program updates // when the files haven't changed. -func (r *DocumentRegistry) AcquireDocument(scriptInfo *ScriptInfo, compilerOptions *core.CompilerOptions, oldSourceFile *ast.SourceFile, oldCompilerOptions *core.CompilerOptions) *ast.SourceFile { - key := newRegistryKey(compilerOptions, scriptInfo.path, scriptInfo.scriptKind) - document := r.getDocumentWorker(scriptInfo, compilerOptions, key) +func (r *DocumentRegistry) AcquireDocument(scriptInfo *ScriptInfo, compilerOptions *core.CompilerOptions, metadata *ast.SourceFileMetaData, oldSourceFile *ast.SourceFile, oldCompilerOptions *core.CompilerOptions, oldMetadata *ast.SourceFileMetaData) *ast.SourceFile { + key := newRegistryKey(compilerOptions, scriptInfo.path, scriptInfo.scriptKind, metadata) + document := r.getDocumentWorker(scriptInfo, compilerOptions, metadata, key) if oldSourceFile != nil && oldCompilerOptions != nil { - oldKey := newRegistryKey(oldCompilerOptions, scriptInfo.path, oldSourceFile.ScriptKind) + oldKey := newRegistryKey(oldCompilerOptions, scriptInfo.path, oldSourceFile.ScriptKind, oldMetadata) r.releaseDocumentWithKey(oldKey) } return document } -func (r *DocumentRegistry) ReleaseDocument(file *ast.SourceFile, compilerOptions *core.CompilerOptions) { - key := newRegistryKey(compilerOptions, file.Path(), file.ScriptKind) +func (r *DocumentRegistry) ReleaseDocument(file *ast.SourceFile, compilerOptions *core.CompilerOptions, metadata *ast.SourceFileMetaData) { + key := newRegistryKey(compilerOptions, file.Path(), file.ScriptKind, metadata) r.releaseDocumentWithKey(key) } @@ -88,6 +90,7 @@ func (r *DocumentRegistry) releaseDocumentWithKey(key registryKey) { func (r *DocumentRegistry) getDocumentWorker( scriptInfo *ScriptInfo, compilerOptions *core.CompilerOptions, + metadata *ast.SourceFileMetaData, key registryKey, ) *ast.SourceFile { scriptTarget := core.IfElse(scriptInfo.scriptKind == core.ScriptKindJSON, core.ScriptTargetJSON, compilerOptions.GetEmitScriptTarget()) @@ -97,7 +100,7 @@ func (r *DocumentRegistry) getDocumentWorker( // We have an entry for this file. However, it may be for a different version of // the script snapshot. If so, update it appropriately. if entry.version != scriptInfoVersion { - sourceFile := r.getParsedFile(scriptInfo.fileName, scriptInfo.path, scriptInfoText, scriptTarget, compilerOptions) + sourceFile := r.getParsedFile(scriptInfo.fileName, scriptInfo.path, scriptInfoText, scriptTarget, compilerOptions, metadata) entry.mu.Lock() defer entry.mu.Unlock() entry.sourceFile = sourceFile @@ -107,7 +110,7 @@ func (r *DocumentRegistry) getDocumentWorker( return entry.sourceFile } else { // Have never seen this file with these settings. Create a new source file for it. - sourceFile := r.getParsedFile(scriptInfo.fileName, scriptInfo.path, scriptInfoText, scriptTarget, compilerOptions) + sourceFile := r.getParsedFile(scriptInfo.fileName, scriptInfo.path, scriptInfoText, scriptTarget, compilerOptions, metadata) entry, _ := r.documents.LoadOrStore(key, ®istryEntry{ sourceFile: sourceFile, refCount: 0, @@ -120,8 +123,8 @@ func (r *DocumentRegistry) getDocumentWorker( } } -func (r *DocumentRegistry) getFileVersion(file *ast.SourceFile, options *core.CompilerOptions) int { - key := newRegistryKey(options, file.Path(), file.ScriptKind) +func (r *DocumentRegistry) getFileVersion(file *ast.SourceFile, options *core.CompilerOptions, metadata *ast.SourceFileMetaData) int { + key := newRegistryKey(options, file.Path(), file.ScriptKind, metadata) if entry, ok := r.documents.Load(key); ok && entry.sourceFile == file { return entry.version } @@ -134,15 +137,16 @@ func (r *DocumentRegistry) getParsedFile( sourceText string, scriptTarget core.ScriptTarget, options *core.CompilerOptions, + metadata *ast.SourceFileMetaData, ) *ast.SourceFile { if r.parsedFileCache != nil { - if file := r.parsedFileCache.GetFile(fileName, path, sourceText, scriptTarget, *options.SourceFileAffecting()); file != nil { + if file := r.parsedFileCache.GetFile(fileName, path, sourceText, options.SourceFileAffecting(), metadata); file != nil { return file } } - file := parser.ParseSourceFile(fileName, path, sourceText, scriptTarget, scanner.JSDocParsingModeParseAll) + file := parser.ParseSourceFile(fileName, path, sourceText, options.SourceFileAffecting(), metadata, scanner.JSDocParsingModeParseAll) if r.parsedFileCache != nil { - r.parsedFileCache.CacheFile(fileName, path, sourceText, scriptTarget, *options.SourceFileAffecting(), file) + r.parsedFileCache.CacheFile(fileName, path, sourceText, options.SourceFileAffecting(), metadata, file) } return file } @@ -153,17 +157,19 @@ func (r *DocumentRegistry) size() int { } type ParsedFileCache interface { - GetFile(fileName string, + GetFile( + fileName string, path tspath.Path, text string, - scriptTarget core.ScriptTarget, - options core.SourceFileAffectingCompilerOptions, + options *core.SourceFileAffectingCompilerOptions, + metadata *ast.SourceFileMetaData, ) *ast.SourceFile - CacheFile(fileName string, + CacheFile( + fileName string, path tspath.Path, text string, - scriptTarget core.ScriptTarget, - options core.SourceFileAffectingCompilerOptions, + options *core.SourceFileAffectingCompilerOptions, + metadata *ast.SourceFileMetaData, sourceFile *ast.SourceFile, ) } diff --git a/internal/project/project.go b/internal/project/project.go index a3b660f6d1..42759b71c9 100644 --- a/internal/project/project.go +++ b/internal/project/project.go @@ -48,7 +48,7 @@ type snapshot struct { func (s *snapshot) GetLineMap(fileName string) *ls.LineMap { file := s.program.GetSourceFile(fileName) scriptInfo := s.project.host.GetScriptInfoByPath(file.Path()) - if s.project.getFileVersion(file, s.program.Options()) == scriptInfo.Version() { + if s.project.getFileVersion(file, s.program.Options(), s.program.GetSourceFileMetaData(file.Path())) == scriptInfo.Version() { return scriptInfo.LineMap() } return ls.ComputeLineStarts(file.Text()) @@ -270,18 +270,20 @@ func (p *Project) GetCompilerOptions() *core.CompilerOptions { } // GetSourceFile implements compiler.CompilerHost. -func (p *Project) GetSourceFile(fileName string, path tspath.Path, languageVersion core.ScriptTarget) *ast.SourceFile { +func (p *Project) GetSourceFile(fileName string, path tspath.Path, options *core.SourceFileAffectingCompilerOptions, metadata *ast.SourceFileMetaData) *ast.SourceFile { scriptKind := p.getScriptKind(fileName) if scriptInfo := p.getOrCreateScriptInfoAndAttachToProject(fileName, scriptKind); scriptInfo != nil { var ( oldSourceFile *ast.SourceFile oldCompilerOptions *core.CompilerOptions + oldMetadata *ast.SourceFileMetaData ) if p.program != nil { oldSourceFile = p.program.GetSourceFileByPath(scriptInfo.path) oldCompilerOptions = p.program.Options() + oldMetadata = p.program.GetSourceFileMetaData(scriptInfo.path) } - return p.host.DocumentRegistry().AcquireDocument(scriptInfo, p.compilerOptions, oldSourceFile, oldCompilerOptions) + return p.host.DocumentRegistry().AcquireDocument(scriptInfo, p.compilerOptions, metadata, oldSourceFile, oldCompilerOptions, oldMetadata) } return nil } @@ -551,7 +553,7 @@ func (p *Project) updateGraph() (*compiler.Program, bool) { if oldProgram != nil { for _, oldSourceFile := range oldProgram.GetSourceFiles() { if p.program.GetSourceFileByPath(oldSourceFile.Path()) == nil { - p.host.DocumentRegistry().ReleaseDocument(oldSourceFile, oldProgram.Options()) + p.host.DocumentRegistry().ReleaseDocument(oldSourceFile, oldProgram.Options(), oldProgram.GetSourceFileMetaData(oldSourceFile.Path())) p.detachScriptInfoIfNotInferredRoot(oldSourceFile.Path()) } } @@ -1030,7 +1032,7 @@ func (p *Project) print(writeFileNames bool, writeFileExplanation bool, writeFil for _, sourceFile := range sourceFiles { builder.WriteString("\n\t\t" + sourceFile.FileName()) if writeFileVersionAndText { - builder.WriteString(fmt.Sprintf(" %d %s", p.getFileVersion(sourceFile, options), sourceFile.Text())) + builder.WriteString(fmt.Sprintf(" %d %s", p.getFileVersion(sourceFile, options, p.program.GetSourceFileMetaData(sourceFile.Path())), sourceFile.Text())) } } // !!! @@ -1041,8 +1043,8 @@ func (p *Project) print(writeFileNames bool, writeFileExplanation bool, writeFil return builder.String() } -func (p *Project) getFileVersion(file *ast.SourceFile, options *core.CompilerOptions) int { - return p.host.DocumentRegistry().getFileVersion(file, options) +func (p *Project) getFileVersion(file *ast.SourceFile, options *core.CompilerOptions, metadata *ast.SourceFileMetaData) int { + return p.host.DocumentRegistry().getFileVersion(file, options, metadata) } func (p *Project) Log(s string) { @@ -1068,7 +1070,7 @@ func (p *Project) Close() { if p.program != nil { for _, sourceFile := range p.program.GetSourceFiles() { - p.host.DocumentRegistry().ReleaseDocument(sourceFile, p.program.Options()) + p.host.DocumentRegistry().ReleaseDocument(sourceFile, p.program.Options(), p.program.GetSourceFileMetaData(sourceFile.Path())) // Detach script info if its not root or is root of non inferred project p.detachScriptInfoIfNotInferredRoot(sourceFile.Path()) } diff --git a/internal/testutil/harnessutil/harnessutil.go b/internal/testutil/harnessutil/harnessutil.go index 3d66dfb0de..b896f83f80 100644 --- a/internal/testutil/harnessutil/harnessutil.go +++ b/internal/testutil/harnessutil/harnessutil.go @@ -474,37 +474,37 @@ var sourceFileCache collections.SyncMap[SourceFileCacheKey, *ast.SourceFile] type SourceFileCacheKey struct { core.SourceFileAffectingCompilerOptions - fileName string - path tspath.Path - languageVersion core.ScriptTarget - text string + ast.SourceFileMetaData + fileName string + path tspath.Path + text string } func GetSourceFileCacheKey( - options core.SourceFileAffectingCompilerOptions, fileName string, path tspath.Path, - languageVersion core.ScriptTarget, text string, + options *core.SourceFileAffectingCompilerOptions, + metadata *ast.SourceFileMetaData, ) SourceFileCacheKey { return SourceFileCacheKey{ - SourceFileAffectingCompilerOptions: options, + SourceFileAffectingCompilerOptions: *options, + SourceFileMetaData: *metadata, fileName: fileName, path: path, - languageVersion: languageVersion, text: text, } } -func (h *cachedCompilerHost) GetSourceFile(fileName string, path tspath.Path, languageVersion core.ScriptTarget) *ast.SourceFile { +func (h *cachedCompilerHost) GetSourceFile(fileName string, path tspath.Path, options *core.SourceFileAffectingCompilerOptions, metadata *ast.SourceFileMetaData) *ast.SourceFile { text, _ := h.FS().ReadFile(fileName) key := GetSourceFileCacheKey( - *h.options.SourceFileAffecting(), fileName, path, - languageVersion, text, + h.options.SourceFileAffecting(), + metadata, ) if cached, ok := sourceFileCache.Load(key); ok { @@ -517,7 +517,7 @@ func (h *cachedCompilerHost) GetSourceFile(fileName string, path tspath.Path, la sourceFile = parser.ParseJSONText(fileName, path, text) } else { // !!! JSDocParsingMode - sourceFile = parser.ParseSourceFile(fileName, path, text, languageVersion, scanner.JSDocParsingModeParseAll) + sourceFile = parser.ParseSourceFile(fileName, path, text, options, metadata, scanner.JSDocParsingModeParseAll) } result, _ := sourceFileCache.LoadOrStore(key, sourceFile) diff --git a/internal/testutil/parsetestutil/parsetestutil.go b/internal/testutil/parsetestutil/parsetestutil.go index 880459327a..76833960d0 100644 --- a/internal/testutil/parsetestutil/parsetestutil.go +++ b/internal/testutil/parsetestutil/parsetestutil.go @@ -12,10 +12,14 @@ import ( "github.com/microsoft/typescript-go/internal/tspath" ) +var parseCompilerOptions = &core.SourceFileAffectingCompilerOptions{ + EmitScriptTarget: core.ScriptTargetLatest, +} + // Simplifies parsing an input string into a SourceFile for testing purposes. func ParseTypeScript(text string, jsx bool) *ast.SourceFile { fileName := core.IfElse(jsx, "/main.tsx", "/main.ts") - file := parser.ParseSourceFile(fileName, tspath.Path(fileName), text, core.ScriptTargetESNext, scanner.JSDocParsingModeParseNone) + file := parser.ParseSourceFile(fileName, tspath.Path(fileName), text, parseCompilerOptions, nil, scanner.JSDocParsingModeParseNone) ast.SetParentInChildren(file.AsNode()) return file } diff --git a/internal/testutil/tsbaseline/js_emit_baseline.go b/internal/testutil/tsbaseline/js_emit_baseline.go index 02e41c011d..ea9d78be7a 100644 --- a/internal/testutil/tsbaseline/js_emit_baseline.go +++ b/internal/testutil/tsbaseline/js_emit_baseline.go @@ -65,8 +65,10 @@ func DoJSEmitBaseline( file.UnitName, tspath.Path(file.UnitName), file.Content, - options.GetEmitScriptTarget(), - scanner.JSDocParsingModeParseAll) + options.SourceFileAffecting(), + nil, // TODO(jakebailey): need to grab this somehow? + scanner.JSDocParsingModeParseAll, + ) if len(fileParseResult.Diagnostics()) > 0 { jsCode.WriteString(getErrorBaseline(t, []*harnessutil.TestFile{file}, fileParseResult.Diagnostics(), false /*pretty*/)) continue diff --git a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=preserve,module=commonjs,moduledetection=force).js b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=preserve,module=commonjs,moduledetection=force).js index ee94f217c1..1b6f086d88 100644 --- a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=preserve,module=commonjs,moduledetection=force).js +++ b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=preserve,module=commonjs,moduledetection=force).js @@ -23,6 +23,8 @@ class Component { } //// [commentsOnJSXExpressionsArePreserved.jsx] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); class Component { render() { return
diff --git a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=preserve,module=commonjs,moduledetection=force).js.diff b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=preserve,module=commonjs,moduledetection=force).js.diff index 3faf93c15b..393e0b6c34 100644 --- a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=preserve,module=commonjs,moduledetection=force).js.diff +++ b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=preserve,module=commonjs,moduledetection=force).js.diff @@ -1,11 +1,9 @@ --- old.commentsOnJSXExpressionsArePreserved(jsx=preserve,module=commonjs,moduledetection=force).js +++ new.commentsOnJSXExpressionsArePreserved(jsx=preserve,module=commonjs,moduledetection=force).js -@@= skipped -22, +22 lines =@@ - } - +@@= skipped -24, +24 lines =@@ //// [commentsOnJSXExpressionsArePreserved.jsx] --"use strict"; --Object.defineProperty(exports, "__esModule", { value: true }); + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); -var Component = /** @class */ (function () { - function Component() { - } diff --git a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=preserve,module=system,moduledetection=force).js b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=preserve,module=system,moduledetection=force).js index ee94f217c1..1b6f086d88 100644 --- a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=preserve,module=system,moduledetection=force).js +++ b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=preserve,module=system,moduledetection=force).js @@ -23,6 +23,8 @@ class Component { } //// [commentsOnJSXExpressionsArePreserved.jsx] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); class Component { render() { return
diff --git a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=preserve,module=system,moduledetection=force).js.diff b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=preserve,module=system,moduledetection=force).js.diff index 701ac71957..3f065e095b 100644 --- a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=preserve,module=system,moduledetection=force).js.diff +++ b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=preserve,module=system,moduledetection=force).js.diff @@ -17,6 +17,8 @@ - Component.prototype.render = function () { - return
- {/* missing */} ++"use strict"; ++Object.defineProperty(exports, "__esModule", { value: true }); +class Component { + render() { + return
diff --git a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react,module=commonjs,moduledetection=force).js b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react,module=commonjs,moduledetection=force).js index 98c57bcd03..14f18f1f54 100644 --- a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react,module=commonjs,moduledetection=force).js +++ b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react,module=commonjs,moduledetection=force).js @@ -23,6 +23,8 @@ class Component { } //// [commentsOnJSXExpressionsArePreserved.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); class Component { render() { return
diff --git a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react,module=commonjs,moduledetection=force).js.diff b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react,module=commonjs,moduledetection=force).js.diff index 8796b18838..7d1293717a 100644 --- a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react,module=commonjs,moduledetection=force).js.diff +++ b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react,module=commonjs,moduledetection=force).js.diff @@ -1,11 +1,9 @@ --- old.commentsOnJSXExpressionsArePreserved(jsx=react,module=commonjs,moduledetection=force).js +++ new.commentsOnJSXExpressionsArePreserved(jsx=react,module=commonjs,moduledetection=force).js -@@= skipped -22, +22 lines =@@ - } - +@@= skipped -24, +24 lines =@@ //// [commentsOnJSXExpressionsArePreserved.js] --"use strict"; --Object.defineProperty(exports, "__esModule", { value: true }); + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); -var Component = /** @class */ (function () { - function Component() { +class Component { diff --git a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react,module=system,moduledetection=force).js b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react,module=system,moduledetection=force).js index 98c57bcd03..14f18f1f54 100644 --- a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react,module=system,moduledetection=force).js +++ b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react,module=system,moduledetection=force).js @@ -23,6 +23,8 @@ class Component { } //// [commentsOnJSXExpressionsArePreserved.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); class Component { render() { return
diff --git a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react,module=system,moduledetection=force).js.diff b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react,module=system,moduledetection=force).js.diff index 5d2bb3de12..46c4d0a87f 100644 --- a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react,module=system,moduledetection=force).js.diff +++ b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react,module=system,moduledetection=force).js.diff @@ -22,6 +22,8 @@ - } - }; -}); ++"use strict"; ++Object.defineProperty(exports, "__esModule", { value: true }); +class Component { + render() { + return
diff --git a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=commonjs,moduledetection=force).errors.txt b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=commonjs,moduledetection=force).errors.txt new file mode 100644 index 0000000000..f62e9505b4 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=commonjs,moduledetection=force).errors.txt @@ -0,0 +1,39 @@ +commentsOnJSXExpressionsArePreserved.tsx(5,16): error TS2875: This JSX tag requires the module path 'react/jsx-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. + + +==== commentsOnJSXExpressionsArePreserved.tsx (1 errors) ==== + // file is intentionally not a module - this tests for a crash in the module/system transforms alongside the `react-jsx` and `react-jsxdev` outputs + namespace JSX {} + class Component { + render() { + return
+ ~~~~~ + {/* missing */} + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + {null/* preserved */} + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + { + ~~~~~~~~~~~~~ + // ??? 1 + ~~~~~~~~~~~~~~~~~~~~~~~~ + } + ~~~~~~~~~~~~~ + { // ??? 2 + ~~~~~~~~~~~~~~~~~~~~~~ + } + ~~~~~~~~~~~~~ + {// ??? 3 + ~~~~~~~~~~~~~~~~~~~~~ + } + ~~~~~~~~~~~~~ + { + ~~~~~~~~~~~~~ + // ??? 4 + ~~~~~~~~~~~~~~~~~~~~~~~~ + /* ??? 5 */} + ~~~~~~~~~~~~~~~~~~~~~~~~ +
; + ~~~~~~~~~~~~~~ +!!! error TS2875: This JSX tag requires the module path 'react/jsx-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. + } + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=commonjs,moduledetection=force).errors.txt.diff b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=commonjs,moduledetection=force).errors.txt.diff deleted file mode 100644 index a6b7fa8356..0000000000 --- a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=commonjs,moduledetection=force).errors.txt.diff +++ /dev/null @@ -1,43 +0,0 @@ ---- old.commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=commonjs,moduledetection=force).errors.txt -+++ new.commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=commonjs,moduledetection=force).errors.txt -@@= skipped -0, +0 lines =@@ --commentsOnJSXExpressionsArePreserved.tsx(5,16): error TS2875: This JSX tag requires the module path 'react/jsx-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. -- -- --==== commentsOnJSXExpressionsArePreserved.tsx (1 errors) ==== -- // file is intentionally not a module - this tests for a crash in the module/system transforms alongside the `react-jsx` and `react-jsxdev` outputs -- namespace JSX {} -- class Component { -- render() { -- return
-- ~~~~~ -- {/* missing */} -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- {null/* preserved */} -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- { -- ~~~~~~~~~~~~~ -- // ??? 1 -- ~~~~~~~~~~~~~~~~~~~~~~~~ -- } -- ~~~~~~~~~~~~~ -- { // ??? 2 -- ~~~~~~~~~~~~~~~~~~~~~~ -- } -- ~~~~~~~~~~~~~ -- {// ??? 3 -- ~~~~~~~~~~~~~~~~~~~~~ -- } -- ~~~~~~~~~~~~~ -- { -- ~~~~~~~~~~~~~ -- // ??? 4 -- ~~~~~~~~~~~~~~~~~~~~~~~~ -- /* ??? 5 */} -- ~~~~~~~~~~~~~~~~~~~~~~~~ --
; -- ~~~~~~~~~~~~~~ --!!! error TS2875: This JSX tag requires the module path 'react/jsx-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. -- } -- } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=commonjs,moduledetection=force).js b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=commonjs,moduledetection=force).js index 98c57bcd03..14f18f1f54 100644 --- a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=commonjs,moduledetection=force).js +++ b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=commonjs,moduledetection=force).js @@ -23,6 +23,8 @@ class Component { } //// [commentsOnJSXExpressionsArePreserved.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); class Component { render() { return
diff --git a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=commonjs,moduledetection=force).js.diff b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=commonjs,moduledetection=force).js.diff index d5effcb3ea..7564bc1505 100644 --- a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=commonjs,moduledetection=force).js.diff +++ b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=commonjs,moduledetection=force).js.diff @@ -1,11 +1,9 @@ --- old.commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=commonjs,moduledetection=force).js +++ new.commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=commonjs,moduledetection=force).js -@@= skipped -22, +22 lines =@@ - } - +@@= skipped -24, +24 lines =@@ //// [commentsOnJSXExpressionsArePreserved.js] --"use strict"; --Object.defineProperty(exports, "__esModule", { value: true }); + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); -var jsx_runtime_1 = require("react/jsx-runtime"); -var Component = /** @class */ (function () { - function Component() { diff --git a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=system,moduledetection=force).errors.txt b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=system,moduledetection=force).errors.txt new file mode 100644 index 0000000000..f62e9505b4 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=system,moduledetection=force).errors.txt @@ -0,0 +1,39 @@ +commentsOnJSXExpressionsArePreserved.tsx(5,16): error TS2875: This JSX tag requires the module path 'react/jsx-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. + + +==== commentsOnJSXExpressionsArePreserved.tsx (1 errors) ==== + // file is intentionally not a module - this tests for a crash in the module/system transforms alongside the `react-jsx` and `react-jsxdev` outputs + namespace JSX {} + class Component { + render() { + return
+ ~~~~~ + {/* missing */} + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + {null/* preserved */} + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + { + ~~~~~~~~~~~~~ + // ??? 1 + ~~~~~~~~~~~~~~~~~~~~~~~~ + } + ~~~~~~~~~~~~~ + { // ??? 2 + ~~~~~~~~~~~~~~~~~~~~~~ + } + ~~~~~~~~~~~~~ + {// ??? 3 + ~~~~~~~~~~~~~~~~~~~~~ + } + ~~~~~~~~~~~~~ + { + ~~~~~~~~~~~~~ + // ??? 4 + ~~~~~~~~~~~~~~~~~~~~~~~~ + /* ??? 5 */} + ~~~~~~~~~~~~~~~~~~~~~~~~ +
; + ~~~~~~~~~~~~~~ +!!! error TS2875: This JSX tag requires the module path 'react/jsx-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. + } + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=system,moduledetection=force).js b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=system,moduledetection=force).js index 98c57bcd03..14f18f1f54 100644 --- a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=system,moduledetection=force).js +++ b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=system,moduledetection=force).js @@ -23,6 +23,8 @@ class Component { } //// [commentsOnJSXExpressionsArePreserved.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); class Component { render() { return
diff --git a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=system,moduledetection=force).js.diff b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=system,moduledetection=force).js.diff index 9dcb913a85..628aebcd57 100644 --- a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=system,moduledetection=force).js.diff +++ b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=system,moduledetection=force).js.diff @@ -26,6 +26,8 @@ - } - }; -}); ++"use strict"; ++Object.defineProperty(exports, "__esModule", { value: true }); +class Component { + render() { + return
diff --git a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=commonjs,moduledetection=force).errors.txt b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=commonjs,moduledetection=force).errors.txt new file mode 100644 index 0000000000..d417296efa --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=commonjs,moduledetection=force).errors.txt @@ -0,0 +1,39 @@ +commentsOnJSXExpressionsArePreserved.tsx(5,16): error TS2875: This JSX tag requires the module path 'react/jsx-dev-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. + + +==== commentsOnJSXExpressionsArePreserved.tsx (1 errors) ==== + // file is intentionally not a module - this tests for a crash in the module/system transforms alongside the `react-jsx` and `react-jsxdev` outputs + namespace JSX {} + class Component { + render() { + return
+ ~~~~~ + {/* missing */} + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + {null/* preserved */} + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + { + ~~~~~~~~~~~~~ + // ??? 1 + ~~~~~~~~~~~~~~~~~~~~~~~~ + } + ~~~~~~~~~~~~~ + { // ??? 2 + ~~~~~~~~~~~~~~~~~~~~~~ + } + ~~~~~~~~~~~~~ + {// ??? 3 + ~~~~~~~~~~~~~~~~~~~~~ + } + ~~~~~~~~~~~~~ + { + ~~~~~~~~~~~~~ + // ??? 4 + ~~~~~~~~~~~~~~~~~~~~~~~~ + /* ??? 5 */} + ~~~~~~~~~~~~~~~~~~~~~~~~ +
; + ~~~~~~~~~~~~~~ +!!! error TS2875: This JSX tag requires the module path 'react/jsx-dev-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. + } + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=commonjs,moduledetection=force).errors.txt.diff b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=commonjs,moduledetection=force).errors.txt.diff deleted file mode 100644 index 703410ed8d..0000000000 --- a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=commonjs,moduledetection=force).errors.txt.diff +++ /dev/null @@ -1,43 +0,0 @@ ---- old.commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=commonjs,moduledetection=force).errors.txt -+++ new.commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=commonjs,moduledetection=force).errors.txt -@@= skipped -0, +0 lines =@@ --commentsOnJSXExpressionsArePreserved.tsx(5,16): error TS2875: This JSX tag requires the module path 'react/jsx-dev-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. -- -- --==== commentsOnJSXExpressionsArePreserved.tsx (1 errors) ==== -- // file is intentionally not a module - this tests for a crash in the module/system transforms alongside the `react-jsx` and `react-jsxdev` outputs -- namespace JSX {} -- class Component { -- render() { -- return
-- ~~~~~ -- {/* missing */} -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- {null/* preserved */} -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- { -- ~~~~~~~~~~~~~ -- // ??? 1 -- ~~~~~~~~~~~~~~~~~~~~~~~~ -- } -- ~~~~~~~~~~~~~ -- { // ??? 2 -- ~~~~~~~~~~~~~~~~~~~~~~ -- } -- ~~~~~~~~~~~~~ -- {// ??? 3 -- ~~~~~~~~~~~~~~~~~~~~~ -- } -- ~~~~~~~~~~~~~ -- { -- ~~~~~~~~~~~~~ -- // ??? 4 -- ~~~~~~~~~~~~~~~~~~~~~~~~ -- /* ??? 5 */} -- ~~~~~~~~~~~~~~~~~~~~~~~~ --
; -- ~~~~~~~~~~~~~~ --!!! error TS2875: This JSX tag requires the module path 'react/jsx-dev-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. -- } -- } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=commonjs,moduledetection=force).js b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=commonjs,moduledetection=force).js index 98c57bcd03..14f18f1f54 100644 --- a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=commonjs,moduledetection=force).js +++ b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=commonjs,moduledetection=force).js @@ -23,6 +23,8 @@ class Component { } //// [commentsOnJSXExpressionsArePreserved.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); class Component { render() { return
diff --git a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=commonjs,moduledetection=force).js.diff b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=commonjs,moduledetection=force).js.diff index 53e2789a1f..6f171edbee 100644 --- a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=commonjs,moduledetection=force).js.diff +++ b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=commonjs,moduledetection=force).js.diff @@ -1,11 +1,9 @@ --- old.commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=commonjs,moduledetection=force).js +++ new.commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=commonjs,moduledetection=force).js -@@= skipped -22, +22 lines =@@ - } - +@@= skipped -24, +24 lines =@@ //// [commentsOnJSXExpressionsArePreserved.js] --"use strict"; --Object.defineProperty(exports, "__esModule", { value: true }); + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); -var jsx_dev_runtime_1 = require("react/jsx-dev-runtime"); -var _jsxFileName = "commentsOnJSXExpressionsArePreserved.tsx"; -var Component = /** @class */ (function () { diff --git a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=system,moduledetection=force).errors.txt b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=system,moduledetection=force).errors.txt new file mode 100644 index 0000000000..d417296efa --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=system,moduledetection=force).errors.txt @@ -0,0 +1,39 @@ +commentsOnJSXExpressionsArePreserved.tsx(5,16): error TS2875: This JSX tag requires the module path 'react/jsx-dev-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. + + +==== commentsOnJSXExpressionsArePreserved.tsx (1 errors) ==== + // file is intentionally not a module - this tests for a crash in the module/system transforms alongside the `react-jsx` and `react-jsxdev` outputs + namespace JSX {} + class Component { + render() { + return
+ ~~~~~ + {/* missing */} + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + {null/* preserved */} + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + { + ~~~~~~~~~~~~~ + // ??? 1 + ~~~~~~~~~~~~~~~~~~~~~~~~ + } + ~~~~~~~~~~~~~ + { // ??? 2 + ~~~~~~~~~~~~~~~~~~~~~~ + } + ~~~~~~~~~~~~~ + {// ??? 3 + ~~~~~~~~~~~~~~~~~~~~~ + } + ~~~~~~~~~~~~~ + { + ~~~~~~~~~~~~~ + // ??? 4 + ~~~~~~~~~~~~~~~~~~~~~~~~ + /* ??? 5 */} + ~~~~~~~~~~~~~~~~~~~~~~~~ +
; + ~~~~~~~~~~~~~~ +!!! error TS2875: This JSX tag requires the module path 'react/jsx-dev-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. + } + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=system,moduledetection=force).js b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=system,moduledetection=force).js index 98c57bcd03..14f18f1f54 100644 --- a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=system,moduledetection=force).js +++ b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=system,moduledetection=force).js @@ -23,6 +23,8 @@ class Component { } //// [commentsOnJSXExpressionsArePreserved.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); class Component { render() { return
diff --git a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=system,moduledetection=force).js.diff b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=system,moduledetection=force).js.diff index 18abed9424..f6e1129e81 100644 --- a/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=system,moduledetection=force).js.diff +++ b/testdata/baselines/reference/submodule/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=system,moduledetection=force).js.diff @@ -27,6 +27,8 @@ - } - }; -}); ++"use strict"; ++Object.defineProperty(exports, "__esModule", { value: true }); +class Component { + render() { + return
diff --git a/testdata/baselines/reference/submodule/compiler/isolatedModulesExternalModuleForced.js b/testdata/baselines/reference/submodule/compiler/isolatedModulesExternalModuleForced.js index b0ef254bb5..c0959e7c9a 100644 --- a/testdata/baselines/reference/submodule/compiler/isolatedModulesExternalModuleForced.js +++ b/testdata/baselines/reference/submodule/compiler/isolatedModulesExternalModuleForced.js @@ -5,3 +5,4 @@ var x; //// [file1.js] var x; +export {}; diff --git a/testdata/baselines/reference/submodule/compiler/isolatedModulesExternalModuleForced.js.diff b/testdata/baselines/reference/submodule/compiler/isolatedModulesExternalModuleForced.js.diff deleted file mode 100644 index 6410e57204..0000000000 --- a/testdata/baselines/reference/submodule/compiler/isolatedModulesExternalModuleForced.js.diff +++ /dev/null @@ -1,7 +0,0 @@ ---- old.isolatedModulesExternalModuleForced.js -+++ new.isolatedModulesExternalModuleForced.js -@@= skipped -4, +4 lines =@@ - - //// [file1.js] - var x; --export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleDetectionIsolatedModulesCjsFileScope.errors.txt b/testdata/baselines/reference/submodule/compiler/moduleDetectionIsolatedModulesCjsFileScope.errors.txt deleted file mode 100644 index 589612b0e9..0000000000 --- a/testdata/baselines/reference/submodule/compiler/moduleDetectionIsolatedModulesCjsFileScope.errors.txt +++ /dev/null @@ -1,14 +0,0 @@ -filename.cts(1,7): error TS2451: Cannot redeclare block-scoped variable 'a'. -filename.mts(1,7): error TS2451: Cannot redeclare block-scoped variable 'a'. - - -==== filename.cts (1 errors) ==== - const a = 2; - ~ -!!! error TS2451: Cannot redeclare block-scoped variable 'a'. -!!! related TS6203 filename.mts:1:7: 'a' was also declared here. -==== filename.mts (1 errors) ==== - const a = 2; - ~ -!!! error TS2451: Cannot redeclare block-scoped variable 'a'. -!!! related TS6203 filename.cts:1:7: 'a' was also declared here. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleDetectionIsolatedModulesCjsFileScope.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/moduleDetectionIsolatedModulesCjsFileScope.errors.txt.diff deleted file mode 100644 index 185bedbe7a..0000000000 --- a/testdata/baselines/reference/submodule/compiler/moduleDetectionIsolatedModulesCjsFileScope.errors.txt.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- old.moduleDetectionIsolatedModulesCjsFileScope.errors.txt -+++ new.moduleDetectionIsolatedModulesCjsFileScope.errors.txt -@@= skipped -0, +0 lines =@@ -- -+filename.cts(1,7): error TS2451: Cannot redeclare block-scoped variable 'a'. -+filename.mts(1,7): error TS2451: Cannot redeclare block-scoped variable 'a'. -+ -+ -+==== filename.cts (1 errors) ==== -+ const a = 2; -+ ~ -+!!! error TS2451: Cannot redeclare block-scoped variable 'a'. -+!!! related TS6203 filename.mts:1:7: 'a' was also declared here. -+==== filename.mts (1 errors) ==== -+ const a = 2; -+ ~ -+!!! error TS2451: Cannot redeclare block-scoped variable 'a'. -+!!! related TS6203 filename.cts:1:7: 'a' was also declared here. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleDetectionIsolatedModulesCjsFileScope.js b/testdata/baselines/reference/submodule/compiler/moduleDetectionIsolatedModulesCjsFileScope.js index 666e68ee05..8d948790c9 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleDetectionIsolatedModulesCjsFileScope.js +++ b/testdata/baselines/reference/submodule/compiler/moduleDetectionIsolatedModulesCjsFileScope.js @@ -6,12 +6,15 @@ const a = 2; const a = 2; //// [filename.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); const a = 2; //// [filename.mjs] const a = 2; +export {}; //// [filename.d.cts] -declare const a = 2; +export {}; //// [filename.d.mts] -declare const a = 2; +export {}; diff --git a/testdata/baselines/reference/submodule/compiler/moduleDetectionIsolatedModulesCjsFileScope.js.diff b/testdata/baselines/reference/submodule/compiler/moduleDetectionIsolatedModulesCjsFileScope.js.diff deleted file mode 100644 index 9404771ec2..0000000000 --- a/testdata/baselines/reference/submodule/compiler/moduleDetectionIsolatedModulesCjsFileScope.js.diff +++ /dev/null @@ -1,20 +0,0 @@ ---- old.moduleDetectionIsolatedModulesCjsFileScope.js -+++ new.moduleDetectionIsolatedModulesCjsFileScope.js -@@= skipped -5, +5 lines =@@ - const a = 2; - - //// [filename.cjs] --"use strict"; --Object.defineProperty(exports, "__esModule", { value: true }); - const a = 2; - //// [filename.mjs] - const a = 2; --export {}; - - - //// [filename.d.cts] --export {}; -+declare const a = 2; - //// [filename.d.mts] --export {}; -+declare const a = 2; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/sideEffectImports3(moduledetection=force,nouncheckedsideeffectimports=false).js b/testdata/baselines/reference/submodule/compiler/sideEffectImports3(moduledetection=force,nouncheckedsideeffectimports=false).js index f0426f699a..47f2c89560 100644 --- a/testdata/baselines/reference/submodule/compiler/sideEffectImports3(moduledetection=force,nouncheckedsideeffectimports=false).js +++ b/testdata/baselines/reference/submodule/compiler/sideEffectImports3(moduledetection=force,nouncheckedsideeffectimports=false).js @@ -8,6 +8,8 @@ console.log("Hello, world!"); //// [not-a-module.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); console.log("Hello, world!"); //// [index.js] "use strict"; diff --git a/testdata/baselines/reference/submodule/compiler/sideEffectImports3(moduledetection=force,nouncheckedsideeffectimports=false).js.diff b/testdata/baselines/reference/submodule/compiler/sideEffectImports3(moduledetection=force,nouncheckedsideeffectimports=false).js.diff deleted file mode 100644 index 819bf18364..0000000000 --- a/testdata/baselines/reference/submodule/compiler/sideEffectImports3(moduledetection=force,nouncheckedsideeffectimports=false).js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.sideEffectImports3(moduledetection=force,nouncheckedsideeffectimports=false).js -+++ new.sideEffectImports3(moduledetection=force,nouncheckedsideeffectimports=false).js -@@= skipped -7, +7 lines =@@ - - - //// [not-a-module.js] --"use strict"; --Object.defineProperty(exports, "__esModule", { value: true }); - console.log("Hello, world!"); - //// [index.js] - "use strict"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/sideEffectImports3(moduledetection=force,nouncheckedsideeffectimports=true).js b/testdata/baselines/reference/submodule/compiler/sideEffectImports3(moduledetection=force,nouncheckedsideeffectimports=true).js index f0426f699a..47f2c89560 100644 --- a/testdata/baselines/reference/submodule/compiler/sideEffectImports3(moduledetection=force,nouncheckedsideeffectimports=true).js +++ b/testdata/baselines/reference/submodule/compiler/sideEffectImports3(moduledetection=force,nouncheckedsideeffectimports=true).js @@ -8,6 +8,8 @@ console.log("Hello, world!"); //// [not-a-module.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); console.log("Hello, world!"); //// [index.js] "use strict"; diff --git a/testdata/baselines/reference/submodule/compiler/sideEffectImports3(moduledetection=force,nouncheckedsideeffectimports=true).js.diff b/testdata/baselines/reference/submodule/compiler/sideEffectImports3(moduledetection=force,nouncheckedsideeffectimports=true).js.diff deleted file mode 100644 index 9586300937..0000000000 --- a/testdata/baselines/reference/submodule/compiler/sideEffectImports3(moduledetection=force,nouncheckedsideeffectimports=true).js.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.sideEffectImports3(moduledetection=force,nouncheckedsideeffectimports=true).js -+++ new.sideEffectImports3(moduledetection=force,nouncheckedsideeffectimports=true).js -@@= skipped -7, +7 lines =@@ - - - //// [not-a-module.js] --"use strict"; --Object.defineProperty(exports, "__esModule", { value: true }); - console.log("Hello, world!"); - //// [index.js] - "use strict"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node16).js b/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node16).js index 89dd2c7541..6d734ae2ed 100644 --- a/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node16).js +++ b/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node16).js @@ -14,5 +14,7 @@ interface GlobalThing { a: number } const a: GlobalThing = { a: 0 }; //// [usage.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); /// const a = { a: 0 }; diff --git a/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node16).js.diff b/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node16).js.diff index a61bab9ab4..050a3b1053 100644 --- a/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node16).js.diff +++ b/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node16).js.diff @@ -1,10 +1,10 @@ --- old.tripleSlashTypesReferenceWithMissingExports(module=node16).js +++ new.tripleSlashTypesReferenceWithMissingExports(module=node16).js -@@= skipped -13, +13 lines =@@ - const a: GlobalThing = { a: 0 }; +@@= skipped -14, +14 lines =@@ //// [usage.js] --"use strict"; - /// --Object.defineProperty(exports, "__esModule", { value: true }); + "use strict"; +-/// + Object.defineProperty(exports, "__esModule", { value: true }); ++/// const a = { a: 0 }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=nodenext).js b/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=nodenext).js index 89dd2c7541..6d734ae2ed 100644 --- a/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=nodenext).js +++ b/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=nodenext).js @@ -14,5 +14,7 @@ interface GlobalThing { a: number } const a: GlobalThing = { a: 0 }; //// [usage.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); /// const a = { a: 0 }; diff --git a/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=nodenext).js.diff b/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=nodenext).js.diff index e5c1be43de..02147f9a60 100644 --- a/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=nodenext).js.diff +++ b/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=nodenext).js.diff @@ -1,10 +1,10 @@ --- old.tripleSlashTypesReferenceWithMissingExports(module=nodenext).js +++ new.tripleSlashTypesReferenceWithMissingExports(module=nodenext).js -@@= skipped -13, +13 lines =@@ - const a: GlobalThing = { a: 0 }; +@@= skipped -14, +14 lines =@@ //// [usage.js] --"use strict"; - /// --Object.defineProperty(exports, "__esModule", { value: true }); + "use strict"; +-/// + Object.defineProperty(exports, "__esModule", { value: true }); ++/// const a = { a: 0 }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importMeta(module=commonjs,target=es5).js b/testdata/baselines/reference/submodule/conformance/importMeta(module=commonjs,target=es5).js index de475ae6f3..507aff838e 100644 --- a/testdata/baselines/reference/submodule/conformance/importMeta(module=commonjs,target=es5).js +++ b/testdata/baselines/reference/submodule/conformance/importMeta(module=commonjs,target=es5).js @@ -39,6 +39,8 @@ declare global { const { a, b, c } = import.meta.wellKnownProperty; //// [example.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); // Adapted from https://github.com/tc39/proposal-import-meta/tree/c3902a9ffe2e69a7ac42c19d7ea74cbdcea9b7fb#example (async () => { const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString()); @@ -57,6 +59,8 @@ exports.x = import.meta; exports.y = import.metal; exports.z = import.import.import.malkovich; //// [scriptLookingFile01.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); let globalA = import.meta; let globalB = import.metal; let globalC = import.import.import.malkovich; diff --git a/testdata/baselines/reference/submodule/conformance/importMeta(module=commonjs,target=es5).js.diff b/testdata/baselines/reference/submodule/conformance/importMeta(module=commonjs,target=es5).js.diff index ae392c8abe..7b6e1f0306 100644 --- a/testdata/baselines/reference/submodule/conformance/importMeta(module=commonjs,target=es5).js.diff +++ b/testdata/baselines/reference/submodule/conformance/importMeta(module=commonjs,target=es5).js.diff @@ -1,10 +1,9 @@ --- old.importMeta(module=commonjs,target=es5).js +++ new.importMeta(module=commonjs,target=es5).js -@@= skipped -38, +38 lines =@@ - const { a, b, c } = import.meta.wellKnownProperty; +@@= skipped -39, +39 lines =@@ //// [example.js] --"use strict"; + "use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { @@ -41,7 +40,7 @@ - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; --Object.defineProperty(exports, "__esModule", { value: true }); + Object.defineProperty(exports, "__esModule", { value: true }); // Adapted from https://github.com/tc39/proposal-import-meta/tree/c3902a9ffe2e69a7ac42c19d7ea74cbdcea9b7fb#example -(function () { return __awaiter(void 0, void 0, void 0, function () { - var response, blob, size, image; @@ -74,12 +73,10 @@ //// [moduleLookingFile01.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -@@= skipped -66, +18 lines =@@ - exports.y = import.metal; - exports.z = import.import.import.malkovich; +@@= skipped -67, +21 lines =@@ //// [scriptLookingFile01.js] --"use strict"; --Object.defineProperty(exports, "__esModule", { value: true }); + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); -var globalA = import.meta; -var globalB = import.metal; -var globalC = import.import.import.malkovich; diff --git a/testdata/baselines/reference/submodule/conformance/importMeta(module=commonjs,target=esnext).js b/testdata/baselines/reference/submodule/conformance/importMeta(module=commonjs,target=esnext).js index de475ae6f3..507aff838e 100644 --- a/testdata/baselines/reference/submodule/conformance/importMeta(module=commonjs,target=esnext).js +++ b/testdata/baselines/reference/submodule/conformance/importMeta(module=commonjs,target=esnext).js @@ -39,6 +39,8 @@ declare global { const { a, b, c } = import.meta.wellKnownProperty; //// [example.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); // Adapted from https://github.com/tc39/proposal-import-meta/tree/c3902a9ffe2e69a7ac42c19d7ea74cbdcea9b7fb#example (async () => { const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString()); @@ -57,6 +59,8 @@ exports.x = import.meta; exports.y = import.metal; exports.z = import.import.import.malkovich; //// [scriptLookingFile01.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); let globalA = import.meta; let globalB = import.metal; let globalC = import.import.import.malkovich; diff --git a/testdata/baselines/reference/submodule/conformance/importMeta(module=commonjs,target=esnext).js.diff b/testdata/baselines/reference/submodule/conformance/importMeta(module=commonjs,target=esnext).js.diff deleted file mode 100644 index 4ab82a6610..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importMeta(module=commonjs,target=esnext).js.diff +++ /dev/null @@ -1,20 +0,0 @@ ---- old.importMeta(module=commonjs,target=esnext).js -+++ new.importMeta(module=commonjs,target=esnext).js -@@= skipped -38, +38 lines =@@ - const { a, b, c } = import.meta.wellKnownProperty; - - //// [example.js] --"use strict"; --Object.defineProperty(exports, "__esModule", { value: true }); - // Adapted from https://github.com/tc39/proposal-import-meta/tree/c3902a9ffe2e69a7ac42c19d7ea74cbdcea9b7fb#example - (async () => { - const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString()); -@@= skipped -20, +18 lines =@@ - exports.y = import.metal; - exports.z = import.import.import.malkovich; - //// [scriptLookingFile01.js] --"use strict"; --Object.defineProperty(exports, "__esModule", { value: true }); - let globalA = import.meta; - let globalB = import.metal; - let globalC = import.import.import.malkovich; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importMeta(module=es2020,target=es5).js b/testdata/baselines/reference/submodule/conformance/importMeta(module=es2020,target=es5).js index 4b6fa5436f..26c4c3e5cc 100644 --- a/testdata/baselines/reference/submodule/conformance/importMeta(module=es2020,target=es5).js +++ b/testdata/baselines/reference/submodule/conformance/importMeta(module=es2020,target=es5).js @@ -49,6 +49,7 @@ const { a, b, c } = import.meta.wellKnownProperty; image.width = image.height = size; document.body.appendChild(image); })(); +export {}; //// [moduleLookingFile01.js] export let x = import.meta; export let y = import.metal; @@ -57,6 +58,7 @@ export let z = import.import.import.malkovich; let globalA = import.meta; let globalB = import.metal; let globalC = import.import.import.malkovich; +export {}; //// [assignmentTargets.js] export const foo = import.meta.blah = import.meta.blue = import.meta; import.meta = foo; diff --git a/testdata/baselines/reference/submodule/conformance/importMeta(module=es2020,target=es5).js.diff b/testdata/baselines/reference/submodule/conformance/importMeta(module=es2020,target=es5).js.diff index 8943973485..d899191cab 100644 --- a/testdata/baselines/reference/submodule/conformance/importMeta(module=es2020,target=es5).js.diff +++ b/testdata/baselines/reference/submodule/conformance/importMeta(module=es2020,target=es5).js.diff @@ -60,7 +60,6 @@ - } - }); -}); })(); --export {}; +(async () => { + const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString()); + const blob = await response.blob(); @@ -70,6 +69,7 @@ + image.width = image.height = size; + document.body.appendChild(image); +})(); + export {}; //// [moduleLookingFile01.js] -export var x = import.meta; -export var y = import.metal; @@ -81,10 +81,10 @@ -var globalA = import.meta; -var globalB = import.metal; -var globalC = import.import.import.malkovich; --export {}; +let globalA = import.meta; +let globalB = import.metal; +let globalC = import.import.import.malkovich; + export {}; //// [assignmentTargets.js] -export var foo = import.meta.blah = import.meta.blue = import.meta; +export const foo = import.meta.blah = import.meta.blue = import.meta; diff --git a/testdata/baselines/reference/submodule/conformance/importMeta(module=es2020,target=esnext).js b/testdata/baselines/reference/submodule/conformance/importMeta(module=es2020,target=esnext).js index 4b6fa5436f..26c4c3e5cc 100644 --- a/testdata/baselines/reference/submodule/conformance/importMeta(module=es2020,target=esnext).js +++ b/testdata/baselines/reference/submodule/conformance/importMeta(module=es2020,target=esnext).js @@ -49,6 +49,7 @@ const { a, b, c } = import.meta.wellKnownProperty; image.width = image.height = size; document.body.appendChild(image); })(); +export {}; //// [moduleLookingFile01.js] export let x = import.meta; export let y = import.metal; @@ -57,6 +58,7 @@ export let z = import.import.import.malkovich; let globalA = import.meta; let globalB = import.metal; let globalC = import.import.import.malkovich; +export {}; //// [assignmentTargets.js] export const foo = import.meta.blah = import.meta.blue = import.meta; import.meta = foo; diff --git a/testdata/baselines/reference/submodule/conformance/importMeta(module=es2020,target=esnext).js.diff b/testdata/baselines/reference/submodule/conformance/importMeta(module=es2020,target=esnext).js.diff deleted file mode 100644 index 70c9de4bc6..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importMeta(module=es2020,target=esnext).js.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- old.importMeta(module=es2020,target=esnext).js -+++ new.importMeta(module=es2020,target=esnext).js -@@= skipped -48, +48 lines =@@ - image.width = image.height = size; - document.body.appendChild(image); - })(); --export {}; - //// [moduleLookingFile01.js] - export let x = import.meta; - export let y = import.metal; -@@= skipped -9, +8 lines =@@ - let globalA = import.meta; - let globalB = import.metal; - let globalC = import.import.import.malkovich; --export {}; - //// [assignmentTargets.js] - export const foo = import.meta.blah = import.meta.blue = import.meta; - import.meta = foo; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importMeta(module=esnext,target=es5).js b/testdata/baselines/reference/submodule/conformance/importMeta(module=esnext,target=es5).js index 4b6fa5436f..26c4c3e5cc 100644 --- a/testdata/baselines/reference/submodule/conformance/importMeta(module=esnext,target=es5).js +++ b/testdata/baselines/reference/submodule/conformance/importMeta(module=esnext,target=es5).js @@ -49,6 +49,7 @@ const { a, b, c } = import.meta.wellKnownProperty; image.width = image.height = size; document.body.appendChild(image); })(); +export {}; //// [moduleLookingFile01.js] export let x = import.meta; export let y = import.metal; @@ -57,6 +58,7 @@ export let z = import.import.import.malkovich; let globalA = import.meta; let globalB = import.metal; let globalC = import.import.import.malkovich; +export {}; //// [assignmentTargets.js] export const foo = import.meta.blah = import.meta.blue = import.meta; import.meta = foo; diff --git a/testdata/baselines/reference/submodule/conformance/importMeta(module=esnext,target=es5).js.diff b/testdata/baselines/reference/submodule/conformance/importMeta(module=esnext,target=es5).js.diff index 996c9612e2..256ffec641 100644 --- a/testdata/baselines/reference/submodule/conformance/importMeta(module=esnext,target=es5).js.diff +++ b/testdata/baselines/reference/submodule/conformance/importMeta(module=esnext,target=es5).js.diff @@ -60,7 +60,6 @@ - } - }); -}); })(); --export {}; +(async () => { + const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString()); + const blob = await response.blob(); @@ -70,6 +69,7 @@ + image.width = image.height = size; + document.body.appendChild(image); +})(); + export {}; //// [moduleLookingFile01.js] -export var x = import.meta; -export var y = import.metal; @@ -81,10 +81,10 @@ -var globalA = import.meta; -var globalB = import.metal; -var globalC = import.import.import.malkovich; --export {}; +let globalA = import.meta; +let globalB = import.metal; +let globalC = import.import.import.malkovich; + export {}; //// [assignmentTargets.js] -export var foo = import.meta.blah = import.meta.blue = import.meta; +export const foo = import.meta.blah = import.meta.blue = import.meta; diff --git a/testdata/baselines/reference/submodule/conformance/importMeta(module=esnext,target=esnext).js b/testdata/baselines/reference/submodule/conformance/importMeta(module=esnext,target=esnext).js index 4b6fa5436f..26c4c3e5cc 100644 --- a/testdata/baselines/reference/submodule/conformance/importMeta(module=esnext,target=esnext).js +++ b/testdata/baselines/reference/submodule/conformance/importMeta(module=esnext,target=esnext).js @@ -49,6 +49,7 @@ const { a, b, c } = import.meta.wellKnownProperty; image.width = image.height = size; document.body.appendChild(image); })(); +export {}; //// [moduleLookingFile01.js] export let x = import.meta; export let y = import.metal; @@ -57,6 +58,7 @@ export let z = import.import.import.malkovich; let globalA = import.meta; let globalB = import.metal; let globalC = import.import.import.malkovich; +export {}; //// [assignmentTargets.js] export const foo = import.meta.blah = import.meta.blue = import.meta; import.meta = foo; diff --git a/testdata/baselines/reference/submodule/conformance/importMeta(module=esnext,target=esnext).js.diff b/testdata/baselines/reference/submodule/conformance/importMeta(module=esnext,target=esnext).js.diff deleted file mode 100644 index 40da3e21bd..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importMeta(module=esnext,target=esnext).js.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- old.importMeta(module=esnext,target=esnext).js -+++ new.importMeta(module=esnext,target=esnext).js -@@= skipped -48, +48 lines =@@ - image.width = image.height = size; - document.body.appendChild(image); - })(); --export {}; - //// [moduleLookingFile01.js] - export let x = import.meta; - export let y = import.metal; -@@= skipped -9, +8 lines =@@ - let globalA = import.meta; - let globalB = import.metal; - let globalC = import.import.import.malkovich; --export {}; - //// [assignmentTargets.js] - export const foo = import.meta.blah = import.meta.blue = import.meta; - import.meta = foo; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importMeta(module=system,target=es5).js b/testdata/baselines/reference/submodule/conformance/importMeta(module=system,target=es5).js index de475ae6f3..507aff838e 100644 --- a/testdata/baselines/reference/submodule/conformance/importMeta(module=system,target=es5).js +++ b/testdata/baselines/reference/submodule/conformance/importMeta(module=system,target=es5).js @@ -39,6 +39,8 @@ declare global { const { a, b, c } = import.meta.wellKnownProperty; //// [example.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); // Adapted from https://github.com/tc39/proposal-import-meta/tree/c3902a9ffe2e69a7ac42c19d7ea74cbdcea9b7fb#example (async () => { const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString()); @@ -57,6 +59,8 @@ exports.x = import.meta; exports.y = import.metal; exports.z = import.import.import.malkovich; //// [scriptLookingFile01.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); let globalA = import.meta; let globalB = import.metal; let globalC = import.import.import.malkovich; diff --git a/testdata/baselines/reference/submodule/conformance/importMeta(module=system,target=es5).js.diff b/testdata/baselines/reference/submodule/conformance/importMeta(module=system,target=es5).js.diff index 419feffd69..cbe973734b 100644 --- a/testdata/baselines/reference/submodule/conformance/importMeta(module=system,target=es5).js.diff +++ b/testdata/baselines/reference/submodule/conformance/importMeta(module=system,target=es5).js.diff @@ -69,6 +69,8 @@ - } - }; -}); ++"use strict"; ++Object.defineProperty(exports, "__esModule", { value: true }); +// Adapted from https://github.com/tc39/proposal-import-meta/tree/c3902a9ffe2e69a7ac42c19d7ea74cbdcea9b7fb#example +(async () => { + const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString()); @@ -113,6 +115,8 @@ - } - }; -}); ++"use strict"; ++Object.defineProperty(exports, "__esModule", { value: true }); +let globalA = import.meta; +let globalB = import.metal; +let globalC = import.import.import.malkovich; diff --git a/testdata/baselines/reference/submodule/conformance/importMeta(module=system,target=esnext).js b/testdata/baselines/reference/submodule/conformance/importMeta(module=system,target=esnext).js index de475ae6f3..507aff838e 100644 --- a/testdata/baselines/reference/submodule/conformance/importMeta(module=system,target=esnext).js +++ b/testdata/baselines/reference/submodule/conformance/importMeta(module=system,target=esnext).js @@ -39,6 +39,8 @@ declare global { const { a, b, c } = import.meta.wellKnownProperty; //// [example.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); // Adapted from https://github.com/tc39/proposal-import-meta/tree/c3902a9ffe2e69a7ac42c19d7ea74cbdcea9b7fb#example (async () => { const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString()); @@ -57,6 +59,8 @@ exports.x = import.meta; exports.y = import.metal; exports.z = import.import.import.malkovich; //// [scriptLookingFile01.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); let globalA = import.meta; let globalB = import.metal; let globalC = import.import.import.malkovich; diff --git a/testdata/baselines/reference/submodule/conformance/importMeta(module=system,target=esnext).js.diff b/testdata/baselines/reference/submodule/conformance/importMeta(module=system,target=esnext).js.diff index 1beff551b6..7da51dcd84 100644 --- a/testdata/baselines/reference/submodule/conformance/importMeta(module=system,target=esnext).js.diff +++ b/testdata/baselines/reference/submodule/conformance/importMeta(module=system,target=esnext).js.diff @@ -23,6 +23,8 @@ - } - }; -}); ++"use strict"; ++Object.defineProperty(exports, "__esModule", { value: true }); +// Adapted from https://github.com/tc39/proposal-import-meta/tree/c3902a9ffe2e69a7ac42c19d7ea74cbdcea9b7fb#example +(async () => { + const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString()); @@ -67,6 +69,8 @@ - } - }; -}); ++"use strict"; ++Object.defineProperty(exports, "__esModule", { value: true }); +let globalA = import.meta; +let globalB = import.metal; +let globalC = import.import.import.malkovich; diff --git a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=es2020).errors.txt b/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=es2020).errors.txt deleted file mode 100644 index 81925bade8..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=es2020).errors.txt +++ /dev/null @@ -1,18 +0,0 @@ -importMetaNarrowing.ts(1,9): error TS2669: Augmentations for the global scope can only be directly nested in external modules or ambient module declarations. -importMetaNarrowing.ts(3,17): error TS2339: Property 'foo' does not exist on type 'ImportMeta'. -importMetaNarrowing.ts(4,15): error TS2339: Property 'foo' does not exist on type 'ImportMeta'. - - -==== importMetaNarrowing.ts (3 errors) ==== - declare global { interface ImportMeta {foo?: () => void} }; - ~~~~~~ -!!! error TS2669: Augmentations for the global scope can only be directly nested in external modules or ambient module declarations. - - if (import.meta.foo) { - ~~~ -!!! error TS2339: Property 'foo' does not exist on type 'ImportMeta'. - import.meta.foo(); - ~~~ -!!! error TS2339: Property 'foo' does not exist on type 'ImportMeta'. - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=es2020).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=es2020).errors.txt.diff deleted file mode 100644 index a9f935a454..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=es2020).errors.txt.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.importMetaNarrowing(module=es2020).errors.txt -+++ new.importMetaNarrowing(module=es2020).errors.txt -@@= skipped -0, +0 lines =@@ -- -+importMetaNarrowing.ts(1,9): error TS2669: Augmentations for the global scope can only be directly nested in external modules or ambient module declarations. -+importMetaNarrowing.ts(3,17): error TS2339: Property 'foo' does not exist on type 'ImportMeta'. -+importMetaNarrowing.ts(4,15): error TS2339: Property 'foo' does not exist on type 'ImportMeta'. -+ -+ -+==== importMetaNarrowing.ts (3 errors) ==== -+ declare global { interface ImportMeta {foo?: () => void} }; -+ ~~~~~~ -+!!! error TS2669: Augmentations for the global scope can only be directly nested in external modules or ambient module declarations. -+ -+ if (import.meta.foo) { -+ ~~~ -+!!! error TS2339: Property 'foo' does not exist on type 'ImportMeta'. -+ import.meta.foo(); -+ ~~~ -+!!! error TS2339: Property 'foo' does not exist on type 'ImportMeta'. -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=es2020).js b/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=es2020).js index 5bff3065b1..d535084eef 100644 --- a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=es2020).js +++ b/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=es2020).js @@ -13,3 +13,4 @@ if (import.meta.foo) { if (import.meta.foo) { import.meta.foo(); } +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=es2020).js.diff b/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=es2020).js.diff deleted file mode 100644 index 173d003006..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=es2020).js.diff +++ /dev/null @@ -1,7 +0,0 @@ ---- old.importMetaNarrowing(module=es2020).js -+++ new.importMetaNarrowing(module=es2020).js -@@= skipped -12, +12 lines =@@ - if (import.meta.foo) { - import.meta.foo(); - } --export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=es2020).symbols b/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=es2020).symbols index 69b1cea41b..e537310eed 100644 --- a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=es2020).symbols +++ b/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=es2020).symbols @@ -3,15 +3,19 @@ === importMetaNarrowing.ts === declare global { interface ImportMeta {foo?: () => void} }; >global : Symbol(global, Decl(importMetaNarrowing.ts, 0, 0)) ->ImportMeta : Symbol(ImportMeta, Decl(importMetaNarrowing.ts, 0, 16)) +>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(importMetaNarrowing.ts, 0, 16)) >foo : Symbol(foo, Decl(importMetaNarrowing.ts, 0, 39)) if (import.meta.foo) { ->import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) +>import.meta.foo : Symbol(foo, Decl(importMetaNarrowing.ts, 0, 39)) +>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(importMetaNarrowing.ts, 0, 16)) >meta : Symbol(meta) +>foo : Symbol(foo, Decl(importMetaNarrowing.ts, 0, 39)) import.meta.foo(); ->import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) +>import.meta.foo : Symbol(foo, Decl(importMetaNarrowing.ts, 0, 39)) +>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(importMetaNarrowing.ts, 0, 16)) >meta : Symbol(meta) +>foo : Symbol(foo, Decl(importMetaNarrowing.ts, 0, 39)) } diff --git a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=es2020).symbols.diff b/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=es2020).symbols.diff index ddb1ad02d4..08ef74117f 100644 --- a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=es2020).symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=es2020).symbols.diff @@ -1,27 +1,27 @@ --- old.importMetaNarrowing(module=es2020).symbols +++ new.importMetaNarrowing(module=es2020).symbols -@@= skipped -2, +2 lines =@@ - === importMetaNarrowing.ts === +@@= skipped -3, +3 lines =@@ declare global { interface ImportMeta {foo?: () => void} }; >global : Symbol(global, Decl(importMetaNarrowing.ts, 0, 0)) -->ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(importMetaNarrowing.ts, 0, 16)) + >ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(importMetaNarrowing.ts, 0, 16)) ->foo : Symbol(ImportMeta.foo, Decl(importMetaNarrowing.ts, 0, 39)) -+>ImportMeta : Symbol(ImportMeta, Decl(importMetaNarrowing.ts, 0, 16)) +>foo : Symbol(foo, Decl(importMetaNarrowing.ts, 0, 39)) if (import.meta.foo) { ->import.meta.foo : Symbol(ImportMeta.foo, Decl(importMetaNarrowing.ts, 0, 39)) -->import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(importMetaNarrowing.ts, 0, 16)) ++>import.meta.foo : Symbol(foo, Decl(importMetaNarrowing.ts, 0, 39)) + >import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(importMetaNarrowing.ts, 0, 16)) ->meta : Symbol(ImportMetaExpression.meta) ->foo : Symbol(ImportMeta.foo, Decl(importMetaNarrowing.ts, 0, 39)) -+>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) +>meta : Symbol(meta) ++>foo : Symbol(foo, Decl(importMetaNarrowing.ts, 0, 39)) import.meta.foo(); ->import.meta.foo : Symbol(ImportMeta.foo, Decl(importMetaNarrowing.ts, 0, 39)) -->import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(importMetaNarrowing.ts, 0, 16)) ++>import.meta.foo : Symbol(foo, Decl(importMetaNarrowing.ts, 0, 39)) + >import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(importMetaNarrowing.ts, 0, 16)) ->meta : Symbol(ImportMetaExpression.meta) ->foo : Symbol(ImportMeta.foo, Decl(importMetaNarrowing.ts, 0, 39)) -+>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) +>meta : Symbol(meta) ++>foo : Symbol(foo, Decl(importMetaNarrowing.ts, 0, 39)) } diff --git a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=es2020).types b/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=es2020).types index 503065b69e..0ef5112f5f 100644 --- a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=es2020).types +++ b/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=es2020).types @@ -2,20 +2,20 @@ === importMetaNarrowing.ts === declare global { interface ImportMeta {foo?: () => void} }; ->global : typeof global +>global : any >foo : (() => void) | undefined if (import.meta.foo) { ->import.meta.foo : any +>import.meta.foo : (() => void) | undefined >import.meta : ImportMeta >meta : ImportMeta ->foo : any +>foo : (() => void) | undefined import.meta.foo(); ->import.meta.foo() : any ->import.meta.foo : any +>import.meta.foo() : void +>import.meta.foo : () => void >import.meta : ImportMeta >meta : ImportMeta ->foo : any +>foo : () => void } diff --git a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=es2020).types.diff b/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=es2020).types.diff deleted file mode 100644 index f45cbb9af9..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=es2020).types.diff +++ /dev/null @@ -1,28 +0,0 @@ ---- old.importMetaNarrowing(module=es2020).types -+++ new.importMetaNarrowing(module=es2020).types -@@= skipped -1, +1 lines =@@ - - === importMetaNarrowing.ts === - declare global { interface ImportMeta {foo?: () => void} }; -->global : any -+>global : typeof global - >foo : (() => void) | undefined - - if (import.meta.foo) { -->import.meta.foo : (() => void) | undefined -+>import.meta.foo : any - >import.meta : ImportMeta - >meta : ImportMeta -->foo : (() => void) | undefined -+>foo : any - - import.meta.foo(); -->import.meta.foo() : void -->import.meta.foo : () => void -+>import.meta.foo() : any -+>import.meta.foo : any - >import.meta : ImportMeta - >meta : ImportMeta -->foo : () => void -+>foo : any - } diff --git a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=esnext).errors.txt b/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=esnext).errors.txt deleted file mode 100644 index 81925bade8..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=esnext).errors.txt +++ /dev/null @@ -1,18 +0,0 @@ -importMetaNarrowing.ts(1,9): error TS2669: Augmentations for the global scope can only be directly nested in external modules or ambient module declarations. -importMetaNarrowing.ts(3,17): error TS2339: Property 'foo' does not exist on type 'ImportMeta'. -importMetaNarrowing.ts(4,15): error TS2339: Property 'foo' does not exist on type 'ImportMeta'. - - -==== importMetaNarrowing.ts (3 errors) ==== - declare global { interface ImportMeta {foo?: () => void} }; - ~~~~~~ -!!! error TS2669: Augmentations for the global scope can only be directly nested in external modules or ambient module declarations. - - if (import.meta.foo) { - ~~~ -!!! error TS2339: Property 'foo' does not exist on type 'ImportMeta'. - import.meta.foo(); - ~~~ -!!! error TS2339: Property 'foo' does not exist on type 'ImportMeta'. - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=esnext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=esnext).errors.txt.diff deleted file mode 100644 index af9ce716b4..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=esnext).errors.txt.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.importMetaNarrowing(module=esnext).errors.txt -+++ new.importMetaNarrowing(module=esnext).errors.txt -@@= skipped -0, +0 lines =@@ -- -+importMetaNarrowing.ts(1,9): error TS2669: Augmentations for the global scope can only be directly nested in external modules or ambient module declarations. -+importMetaNarrowing.ts(3,17): error TS2339: Property 'foo' does not exist on type 'ImportMeta'. -+importMetaNarrowing.ts(4,15): error TS2339: Property 'foo' does not exist on type 'ImportMeta'. -+ -+ -+==== importMetaNarrowing.ts (3 errors) ==== -+ declare global { interface ImportMeta {foo?: () => void} }; -+ ~~~~~~ -+!!! error TS2669: Augmentations for the global scope can only be directly nested in external modules or ambient module declarations. -+ -+ if (import.meta.foo) { -+ ~~~ -+!!! error TS2339: Property 'foo' does not exist on type 'ImportMeta'. -+ import.meta.foo(); -+ ~~~ -+!!! error TS2339: Property 'foo' does not exist on type 'ImportMeta'. -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=esnext).js b/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=esnext).js index 5bff3065b1..d535084eef 100644 --- a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=esnext).js +++ b/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=esnext).js @@ -13,3 +13,4 @@ if (import.meta.foo) { if (import.meta.foo) { import.meta.foo(); } +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=esnext).js.diff b/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=esnext).js.diff deleted file mode 100644 index 99357a5197..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=esnext).js.diff +++ /dev/null @@ -1,7 +0,0 @@ ---- old.importMetaNarrowing(module=esnext).js -+++ new.importMetaNarrowing(module=esnext).js -@@= skipped -12, +12 lines =@@ - if (import.meta.foo) { - import.meta.foo(); - } --export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=esnext).symbols b/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=esnext).symbols index 69b1cea41b..e537310eed 100644 --- a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=esnext).symbols +++ b/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=esnext).symbols @@ -3,15 +3,19 @@ === importMetaNarrowing.ts === declare global { interface ImportMeta {foo?: () => void} }; >global : Symbol(global, Decl(importMetaNarrowing.ts, 0, 0)) ->ImportMeta : Symbol(ImportMeta, Decl(importMetaNarrowing.ts, 0, 16)) +>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(importMetaNarrowing.ts, 0, 16)) >foo : Symbol(foo, Decl(importMetaNarrowing.ts, 0, 39)) if (import.meta.foo) { ->import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) +>import.meta.foo : Symbol(foo, Decl(importMetaNarrowing.ts, 0, 39)) +>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(importMetaNarrowing.ts, 0, 16)) >meta : Symbol(meta) +>foo : Symbol(foo, Decl(importMetaNarrowing.ts, 0, 39)) import.meta.foo(); ->import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) +>import.meta.foo : Symbol(foo, Decl(importMetaNarrowing.ts, 0, 39)) +>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(importMetaNarrowing.ts, 0, 16)) >meta : Symbol(meta) +>foo : Symbol(foo, Decl(importMetaNarrowing.ts, 0, 39)) } diff --git a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=esnext).symbols.diff b/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=esnext).symbols.diff index b54558be1b..a6e2a438cf 100644 --- a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=esnext).symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=esnext).symbols.diff @@ -1,27 +1,27 @@ --- old.importMetaNarrowing(module=esnext).symbols +++ new.importMetaNarrowing(module=esnext).symbols -@@= skipped -2, +2 lines =@@ - === importMetaNarrowing.ts === +@@= skipped -3, +3 lines =@@ declare global { interface ImportMeta {foo?: () => void} }; >global : Symbol(global, Decl(importMetaNarrowing.ts, 0, 0)) -->ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(importMetaNarrowing.ts, 0, 16)) + >ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(importMetaNarrowing.ts, 0, 16)) ->foo : Symbol(ImportMeta.foo, Decl(importMetaNarrowing.ts, 0, 39)) -+>ImportMeta : Symbol(ImportMeta, Decl(importMetaNarrowing.ts, 0, 16)) +>foo : Symbol(foo, Decl(importMetaNarrowing.ts, 0, 39)) if (import.meta.foo) { ->import.meta.foo : Symbol(ImportMeta.foo, Decl(importMetaNarrowing.ts, 0, 39)) -->import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(importMetaNarrowing.ts, 0, 16)) ++>import.meta.foo : Symbol(foo, Decl(importMetaNarrowing.ts, 0, 39)) + >import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(importMetaNarrowing.ts, 0, 16)) ->meta : Symbol(ImportMetaExpression.meta) ->foo : Symbol(ImportMeta.foo, Decl(importMetaNarrowing.ts, 0, 39)) -+>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) +>meta : Symbol(meta) ++>foo : Symbol(foo, Decl(importMetaNarrowing.ts, 0, 39)) import.meta.foo(); ->import.meta.foo : Symbol(ImportMeta.foo, Decl(importMetaNarrowing.ts, 0, 39)) -->import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(importMetaNarrowing.ts, 0, 16)) ++>import.meta.foo : Symbol(foo, Decl(importMetaNarrowing.ts, 0, 39)) + >import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(importMetaNarrowing.ts, 0, 16)) ->meta : Symbol(ImportMetaExpression.meta) ->foo : Symbol(ImportMeta.foo, Decl(importMetaNarrowing.ts, 0, 39)) -+>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) +>meta : Symbol(meta) ++>foo : Symbol(foo, Decl(importMetaNarrowing.ts, 0, 39)) } diff --git a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=esnext).types b/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=esnext).types index 503065b69e..0ef5112f5f 100644 --- a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=esnext).types +++ b/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=esnext).types @@ -2,20 +2,20 @@ === importMetaNarrowing.ts === declare global { interface ImportMeta {foo?: () => void} }; ->global : typeof global +>global : any >foo : (() => void) | undefined if (import.meta.foo) { ->import.meta.foo : any +>import.meta.foo : (() => void) | undefined >import.meta : ImportMeta >meta : ImportMeta ->foo : any +>foo : (() => void) | undefined import.meta.foo(); ->import.meta.foo() : any ->import.meta.foo : any +>import.meta.foo() : void +>import.meta.foo : () => void >import.meta : ImportMeta >meta : ImportMeta ->foo : any +>foo : () => void } diff --git a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=esnext).types.diff b/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=esnext).types.diff deleted file mode 100644 index e9bee9a64b..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=esnext).types.diff +++ /dev/null @@ -1,28 +0,0 @@ ---- old.importMetaNarrowing(module=esnext).types -+++ new.importMetaNarrowing(module=esnext).types -@@= skipped -1, +1 lines =@@ - - === importMetaNarrowing.ts === - declare global { interface ImportMeta {foo?: () => void} }; -->global : any -+>global : typeof global - >foo : (() => void) | undefined - - if (import.meta.foo) { -->import.meta.foo : (() => void) | undefined -+>import.meta.foo : any - >import.meta : ImportMeta - >meta : ImportMeta -->foo : (() => void) | undefined -+>foo : any - - import.meta.foo(); -->import.meta.foo() : void -->import.meta.foo : () => void -+>import.meta.foo() : any -+>import.meta.foo : any - >import.meta : ImportMeta - >meta : ImportMeta -->foo : () => void -+>foo : any - } diff --git a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=system).errors.txt b/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=system).errors.txt deleted file mode 100644 index 81925bade8..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=system).errors.txt +++ /dev/null @@ -1,18 +0,0 @@ -importMetaNarrowing.ts(1,9): error TS2669: Augmentations for the global scope can only be directly nested in external modules or ambient module declarations. -importMetaNarrowing.ts(3,17): error TS2339: Property 'foo' does not exist on type 'ImportMeta'. -importMetaNarrowing.ts(4,15): error TS2339: Property 'foo' does not exist on type 'ImportMeta'. - - -==== importMetaNarrowing.ts (3 errors) ==== - declare global { interface ImportMeta {foo?: () => void} }; - ~~~~~~ -!!! error TS2669: Augmentations for the global scope can only be directly nested in external modules or ambient module declarations. - - if (import.meta.foo) { - ~~~ -!!! error TS2339: Property 'foo' does not exist on type 'ImportMeta'. - import.meta.foo(); - ~~~ -!!! error TS2339: Property 'foo' does not exist on type 'ImportMeta'. - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=system).js b/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=system).js index 5bff3065b1..7e2a81bf25 100644 --- a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=system).js +++ b/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=system).js @@ -9,6 +9,8 @@ if (import.meta.foo) { //// [importMetaNarrowing.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); ; if (import.meta.foo) { import.meta.foo(); diff --git a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=system).js.diff b/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=system).js.diff index 67cf00443a..92beb24072 100644 --- a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=system).js.diff +++ b/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=system).js.diff @@ -17,6 +17,8 @@ - } - }; -}); ++"use strict"; ++Object.defineProperty(exports, "__esModule", { value: true }); +; +if (import.meta.foo) { + import.meta.foo(); diff --git a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=system).symbols b/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=system).symbols index 69b1cea41b..e537310eed 100644 --- a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=system).symbols +++ b/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=system).symbols @@ -3,15 +3,19 @@ === importMetaNarrowing.ts === declare global { interface ImportMeta {foo?: () => void} }; >global : Symbol(global, Decl(importMetaNarrowing.ts, 0, 0)) ->ImportMeta : Symbol(ImportMeta, Decl(importMetaNarrowing.ts, 0, 16)) +>ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(importMetaNarrowing.ts, 0, 16)) >foo : Symbol(foo, Decl(importMetaNarrowing.ts, 0, 39)) if (import.meta.foo) { ->import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) +>import.meta.foo : Symbol(foo, Decl(importMetaNarrowing.ts, 0, 39)) +>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(importMetaNarrowing.ts, 0, 16)) >meta : Symbol(meta) +>foo : Symbol(foo, Decl(importMetaNarrowing.ts, 0, 39)) import.meta.foo(); ->import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) +>import.meta.foo : Symbol(foo, Decl(importMetaNarrowing.ts, 0, 39)) +>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(importMetaNarrowing.ts, 0, 16)) >meta : Symbol(meta) +>foo : Symbol(foo, Decl(importMetaNarrowing.ts, 0, 39)) } diff --git a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=system).symbols.diff b/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=system).symbols.diff index 5649d24f07..c3d5e4c8a5 100644 --- a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=system).symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=system).symbols.diff @@ -1,27 +1,27 @@ --- old.importMetaNarrowing(module=system).symbols +++ new.importMetaNarrowing(module=system).symbols -@@= skipped -2, +2 lines =@@ - === importMetaNarrowing.ts === +@@= skipped -3, +3 lines =@@ declare global { interface ImportMeta {foo?: () => void} }; >global : Symbol(global, Decl(importMetaNarrowing.ts, 0, 0)) -->ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(importMetaNarrowing.ts, 0, 16)) + >ImportMeta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(importMetaNarrowing.ts, 0, 16)) ->foo : Symbol(ImportMeta.foo, Decl(importMetaNarrowing.ts, 0, 39)) -+>ImportMeta : Symbol(ImportMeta, Decl(importMetaNarrowing.ts, 0, 16)) +>foo : Symbol(foo, Decl(importMetaNarrowing.ts, 0, 39)) if (import.meta.foo) { ->import.meta.foo : Symbol(ImportMeta.foo, Decl(importMetaNarrowing.ts, 0, 39)) -->import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(importMetaNarrowing.ts, 0, 16)) ++>import.meta.foo : Symbol(foo, Decl(importMetaNarrowing.ts, 0, 39)) + >import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(importMetaNarrowing.ts, 0, 16)) ->meta : Symbol(ImportMetaExpression.meta) ->foo : Symbol(ImportMeta.foo, Decl(importMetaNarrowing.ts, 0, 39)) -+>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) +>meta : Symbol(meta) ++>foo : Symbol(foo, Decl(importMetaNarrowing.ts, 0, 39)) import.meta.foo(); ->import.meta.foo : Symbol(ImportMeta.foo, Decl(importMetaNarrowing.ts, 0, 39)) -->import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(importMetaNarrowing.ts, 0, 16)) ++>import.meta.foo : Symbol(foo, Decl(importMetaNarrowing.ts, 0, 39)) + >import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --), Decl(importMetaNarrowing.ts, 0, 16)) ->meta : Symbol(ImportMetaExpression.meta) ->foo : Symbol(ImportMeta.foo, Decl(importMetaNarrowing.ts, 0, 39)) -+>import.meta : Symbol(ImportMeta, Decl(lib.es5.d.ts, --, --), Decl(lib.dom.d.ts, --, --)) +>meta : Symbol(meta) ++>foo : Symbol(foo, Decl(importMetaNarrowing.ts, 0, 39)) } diff --git a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=system).types b/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=system).types index 503065b69e..0ef5112f5f 100644 --- a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=system).types +++ b/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=system).types @@ -2,20 +2,20 @@ === importMetaNarrowing.ts === declare global { interface ImportMeta {foo?: () => void} }; ->global : typeof global +>global : any >foo : (() => void) | undefined if (import.meta.foo) { ->import.meta.foo : any +>import.meta.foo : (() => void) | undefined >import.meta : ImportMeta >meta : ImportMeta ->foo : any +>foo : (() => void) | undefined import.meta.foo(); ->import.meta.foo() : any ->import.meta.foo : any +>import.meta.foo() : void +>import.meta.foo : () => void >import.meta : ImportMeta >meta : ImportMeta ->foo : any +>foo : () => void } diff --git a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=system).types.diff b/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=system).types.diff deleted file mode 100644 index 104c366442..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importMetaNarrowing(module=system).types.diff +++ /dev/null @@ -1,28 +0,0 @@ ---- old.importMetaNarrowing(module=system).types -+++ new.importMetaNarrowing(module=system).types -@@= skipped -1, +1 lines =@@ - - === importMetaNarrowing.ts === - declare global { interface ImportMeta {foo?: () => void} }; -->global : any -+>global : typeof global - >foo : (() => void) | undefined - - if (import.meta.foo) { -->import.meta.foo : (() => void) | undefined -+>import.meta.foo : any - >import.meta : ImportMeta - >meta : ImportMeta -->foo : (() => void) | undefined -+>foo : any - - import.meta.foo(); -->import.meta.foo() : void -->import.meta.foo : () => void -+>import.meta.foo() : any -+>import.meta.foo : any - >import.meta : ImportMeta - >meta : ImportMeta -->foo : () => void -+>foo : any - } diff --git a/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension5.js b/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension5.js index 04388769a9..e6ae64f9b5 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension5.js +++ b/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension5.js @@ -7,3 +7,4 @@ import("./foo").then(x => x); // should error, ask for extension //// [buzz.mjs] // Extensionless relative path dynamic import in an ES module import("./foo").then(x => x); // should error, ask for extension +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension5.js.diff b/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension5.js.diff deleted file mode 100644 index 3d8dd9cccc..0000000000 --- a/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension5.js.diff +++ /dev/null @@ -1,7 +0,0 @@ ---- old.moduleResolutionWithoutExtension5.js -+++ new.moduleResolutionWithoutExtension5.js -@@= skipped -6, +6 lines =@@ - //// [buzz.mjs] - // Extensionless relative path dynamic import in an ES module - import("./foo").then(x => x); // should error, ask for extension --export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension8.js b/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension8.js index 7ac8e5da9a..ff4b9057a1 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension8.js +++ b/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension8.js @@ -5,5 +5,7 @@ import("./foo").then(x => x); // should error, ask for extension //// [bar.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); // Extensionless relative path dynamic import in a cjs module import("./foo").then(x => x); // should error, ask for extension diff --git a/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension8.js.diff b/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension8.js.diff deleted file mode 100644 index a405181495..0000000000 --- a/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension8.js.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- old.moduleResolutionWithoutExtension8.js -+++ new.moduleResolutionWithoutExtension8.js -@@= skipped -4, +4 lines =@@ - import("./foo").then(x => x); // should error, ask for extension - - //// [bar.cjs] --"use strict"; --Object.defineProperty(exports, "__esModule", { value: true }); - // Extensionless relative path dynamic import in a cjs module - import("./foo").then(x => x); // should error, ask for extension \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/tsxReactEmit8(jsx=react-jsx).js b/testdata/baselines/reference/submodule/conformance/tsxReactEmit8(jsx=react-jsx).js index f87603cb4d..1beb1199c6 100644 --- a/testdata/baselines/reference/submodule/conformance/tsxReactEmit8(jsx=react-jsx).js +++ b/testdata/baselines/reference/submodule/conformance/tsxReactEmit8(jsx=react-jsx).js @@ -11,3 +11,4 @@ ///
1
;
2
; +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/tsxReactEmit8(jsx=react-jsx).js.diff b/testdata/baselines/reference/submodule/conformance/tsxReactEmit8(jsx=react-jsx).js.diff index 13c3f4861f..e0e3820002 100644 --- a/testdata/baselines/reference/submodule/conformance/tsxReactEmit8(jsx=react-jsx).js.diff +++ b/testdata/baselines/reference/submodule/conformance/tsxReactEmit8(jsx=react-jsx).js.diff @@ -9,4 +9,5 @@ -_jsx("div", { children: "1" }); -_jsx("div", { children: "2" }, "key-attr"); +
1
; -+
2
; \ No newline at end of file ++
2
; ++export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/tsxReactEmit8(jsx=react-jsxdev).js b/testdata/baselines/reference/submodule/conformance/tsxReactEmit8(jsx=react-jsxdev).js index f87603cb4d..1beb1199c6 100644 --- a/testdata/baselines/reference/submodule/conformance/tsxReactEmit8(jsx=react-jsxdev).js +++ b/testdata/baselines/reference/submodule/conformance/tsxReactEmit8(jsx=react-jsxdev).js @@ -11,3 +11,4 @@ ///
1
;
2
; +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/tsxReactEmit8(jsx=react-jsxdev).js.diff b/testdata/baselines/reference/submodule/conformance/tsxReactEmit8(jsx=react-jsxdev).js.diff index a75e62c137..7ffadc499a 100644 --- a/testdata/baselines/reference/submodule/conformance/tsxReactEmit8(jsx=react-jsxdev).js.diff +++ b/testdata/baselines/reference/submodule/conformance/tsxReactEmit8(jsx=react-jsxdev).js.diff @@ -10,4 +10,5 @@ -_jsxDEV("div", { children: "1" }, void 0, false, { fileName: _jsxFileName, lineNumber: 1, columnNumber: 1 }, this); -_jsxDEV("div", { children: "2" }, "key-attr", false, { fileName: _jsxFileName, lineNumber: 3, columnNumber: 14 }, this); +
1
; -+
2
; \ No newline at end of file ++
2
; ++export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=system,moduledetection=force).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=system,moduledetection=force).errors.txt.diff index 809aef6d61..3f04165da7 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=system,moduledetection=force).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=system,moduledetection=force).errors.txt.diff @@ -2,42 +2,15 @@ +++ new.commentsOnJSXExpressionsArePreserved(jsx=react-jsx,module=system,moduledetection=force).errors.txt @@= skipped -0, +0 lines =@@ -commentsOnJSXExpressionsArePreserved.tsx(5,16): error TS2792: Cannot find module 'react/jsx-runtime'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -- -- --==== commentsOnJSXExpressionsArePreserved.tsx (1 errors) ==== -- // file is intentionally not a module - this tests for a crash in the module/system transforms alongside the `react-jsx` and `react-jsxdev` outputs -- namespace JSX {} -- class Component { -- render() { -- return
-- ~~~~~ -- {/* missing */} -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- {null/* preserved */} -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- { -- ~~~~~~~~~~~~~ -- // ??? 1 -- ~~~~~~~~~~~~~~~~~~~~~~~~ -- } -- ~~~~~~~~~~~~~ -- { // ??? 2 -- ~~~~~~~~~~~~~~~~~~~~~~ -- } -- ~~~~~~~~~~~~~ -- {// ??? 3 -- ~~~~~~~~~~~~~~~~~~~~~ -- } -- ~~~~~~~~~~~~~ -- { -- ~~~~~~~~~~~~~ -- // ??? 4 -- ~~~~~~~~~~~~~~~~~~~~~~~~ -- /* ??? 5 */} -- ~~~~~~~~~~~~~~~~~~~~~~~~ --
; -- ~~~~~~~~~~~~~~ ++commentsOnJSXExpressionsArePreserved.tsx(5,16): error TS2875: This JSX tag requires the module path 'react/jsx-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. + + + ==== commentsOnJSXExpressionsArePreserved.tsx (1 errors) ==== +@@= skipped -33, +33 lines =@@ + ~~~~~~~~~~~~~~~~~~~~~~~~ +
; + ~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'react/jsx-runtime'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -- } -- } -+ \ No newline at end of file ++!!! error TS2875: This JSX tag requires the module path 'react/jsx-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. + } + } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=system,moduledetection=force).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=system,moduledetection=force).errors.txt.diff index 5484764591..45623af100 100644 --- a/testdata/baselines/reference/submoduleAccepted/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=system,moduledetection=force).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/compiler/commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=system,moduledetection=force).errors.txt.diff @@ -2,42 +2,15 @@ +++ new.commentsOnJSXExpressionsArePreserved(jsx=react-jsxdev,module=system,moduledetection=force).errors.txt @@= skipped -0, +0 lines =@@ -commentsOnJSXExpressionsArePreserved.tsx(5,16): error TS2792: Cannot find module 'react/jsx-dev-runtime'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -- -- --==== commentsOnJSXExpressionsArePreserved.tsx (1 errors) ==== -- // file is intentionally not a module - this tests for a crash in the module/system transforms alongside the `react-jsx` and `react-jsxdev` outputs -- namespace JSX {} -- class Component { -- render() { -- return
-- ~~~~~ -- {/* missing */} -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- {null/* preserved */} -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- { -- ~~~~~~~~~~~~~ -- // ??? 1 -- ~~~~~~~~~~~~~~~~~~~~~~~~ -- } -- ~~~~~~~~~~~~~ -- { // ??? 2 -- ~~~~~~~~~~~~~~~~~~~~~~ -- } -- ~~~~~~~~~~~~~ -- {// ??? 3 -- ~~~~~~~~~~~~~~~~~~~~~ -- } -- ~~~~~~~~~~~~~ -- { -- ~~~~~~~~~~~~~ -- // ??? 4 -- ~~~~~~~~~~~~~~~~~~~~~~~~ -- /* ??? 5 */} -- ~~~~~~~~~~~~~~~~~~~~~~~~ --
; -- ~~~~~~~~~~~~~~ ++commentsOnJSXExpressionsArePreserved.tsx(5,16): error TS2875: This JSX tag requires the module path 'react/jsx-dev-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. + + + ==== commentsOnJSXExpressionsArePreserved.tsx (1 errors) ==== +@@= skipped -33, +33 lines =@@ + ~~~~~~~~~~~~~~~~~~~~~~~~ +
; + ~~~~~~~~~~~~~~ -!!! error TS2792: Cannot find module 'react/jsx-dev-runtime'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? -- } -- } -+ \ No newline at end of file ++!!! error TS2875: This JSX tag requires the module path 'react/jsx-dev-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed. + } + } \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/importMetaNarrowing(module=system).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/importMetaNarrowing(module=system).errors.txt.diff deleted file mode 100644 index 4900231eeb..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/importMetaNarrowing(module=system).errors.txt.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.importMetaNarrowing(module=system).errors.txt -+++ new.importMetaNarrowing(module=system).errors.txt -@@= skipped -0, +0 lines =@@ -- -+importMetaNarrowing.ts(1,9): error TS2669: Augmentations for the global scope can only be directly nested in external modules or ambient module declarations. -+importMetaNarrowing.ts(3,17): error TS2339: Property 'foo' does not exist on type 'ImportMeta'. -+importMetaNarrowing.ts(4,15): error TS2339: Property 'foo' does not exist on type 'ImportMeta'. -+ -+ -+==== importMetaNarrowing.ts (3 errors) ==== -+ declare global { interface ImportMeta {foo?: () => void} }; -+ ~~~~~~ -+!!! error TS2669: Augmentations for the global scope can only be directly nested in external modules or ambient module declarations. -+ -+ if (import.meta.foo) { -+ ~~~ -+!!! error TS2339: Property 'foo' does not exist on type 'ImportMeta'. -+ import.meta.foo(); -+ ~~~ -+!!! error TS2339: Property 'foo' does not exist on type 'ImportMeta'. -+ } -+ \ No newline at end of file