diff --git a/_submodules/TypeScript b/_submodules/TypeScript index bc7d42611e..1ee9e0d9a2 160000 --- a/_submodules/TypeScript +++ b/_submodules/TypeScript @@ -1 +1 @@ -Subproject commit bc7d42611e35678c7cbddb104aa4b117a95ccdfa +Subproject commit 1ee9e0d9a24b629da3a8cae2748616af1dc8fc0c diff --git a/internal/checker/checker.go b/internal/checker/checker.go index 7cbeeb5d34..81b48f07ec 100644 --- a/internal/checker/checker.go +++ b/internal/checker/checker.go @@ -5162,7 +5162,7 @@ func (c *Checker) checkImportAttributes(declaration *ast.Node) { return } - if c.moduleKind == core.ModuleKindNodeNext && !isImportAttributes { + if core.ModuleKindNode20 <= c.moduleKind && c.moduleKind <= core.ModuleKindNodeNext && !isImportAttributes { c.grammarErrorOnNode(node, diagnostics.Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_assert) return } @@ -13890,6 +13890,12 @@ func (c *Checker) getTargetOfImportEqualsDeclaration(node *ast.Node, dontResolve } immediate := c.resolveExternalModuleName(node, moduleReference, false /*ignoreErrors*/) resolved := c.resolveExternalModuleSymbol(immediate, false /*dontResolveAlias*/) + if resolved != nil && core.ModuleKindNode20 <= c.moduleKind && c.moduleKind <= core.ModuleKindNodeNext { + moduleExports := c.getExportOfModule(resolved, ast.InternalSymbolNameModuleExports, node, dontResolveAlias) + if moduleExports != nil { + return moduleExports + } + } c.markSymbolOfAliasDeclarationIfTypeOnly(node, immediate, resolved, false /*overwriteEmpty*/, nil, "") return resolved } @@ -13959,14 +13965,42 @@ func (c *Checker) getTargetOfImportClause(node *ast.Node, dontResolveAlias bool) } func (c *Checker) getTargetOfModuleDefault(moduleSymbol *ast.Symbol, node *ast.Node, dontResolveAlias bool) *ast.Symbol { + file := core.Find(moduleSymbol.Declarations, ast.IsSourceFile) + specifier := c.getModuleSpecifierForImportOrExport(node) var exportDefaultSymbol *ast.Symbol + var exportModuleDotExportsSymbol *ast.Symbol if isShorthandAmbientModuleSymbol(moduleSymbol) { - exportDefaultSymbol = moduleSymbol + // !!! exportDefaultSymbol = moduleSymbol + // Does nothing? + } else if file != nil && specifier != nil && + core.ModuleKindNode20 <= c.moduleKind && c.moduleKind <= core.ModuleKindNodeNext && + c.getEmitSyntaxForModuleSpecifierExpression(specifier) == core.ModuleKindCommonJS && + c.program.GetImpliedNodeFormatForEmit(file.AsSourceFile()) == core.ModuleKindESNext { + exportModuleDotExportsSymbol = c.resolveExportByName(moduleSymbol, ast.InternalSymbolNameModuleExports, node, dontResolveAlias) + } + if exportModuleDotExportsSymbol != nil { + // We have a transpiled default import where the `require` resolves to an ES module with a `module.exports` named + // export. If `esModuleInterop` is enabled, this will work: + // + // const dep_1 = __importDefault(require("./dep.mjs")); // wraps like { default: require("./dep.mjs") } + // dep_1.default; // require("./dep.mjs") -> the `module.exports` export value + // + // But without `esModuleInterop`, it will be broken: + // + // const dep_1 = require("./dep.mjs"); // the `module.exports` export value (could be primitive) + // dep_1.default; // `default` property access on the `module.exports` export value + // + // We could try to resolve the 'default' property in the latter case, but it's a mistake to run in this + // environment without `esModuleInterop`, so just error. + if !c.compilerOptions.GetESModuleInterop() { + c.error(node.Name(), diagnostics.Module_0_can_only_be_default_imported_using_the_1_flag, c.symbolToString(moduleSymbol), "esModuleInterop") + return nil + } + c.markSymbolOfAliasDeclarationIfTypeOnly(node, exportModuleDotExportsSymbol /*finalTarget*/, nil /*overwriteEmpty*/, false, nil, "") + return exportModuleDotExportsSymbol } else { exportDefaultSymbol = c.resolveExportByName(moduleSymbol, ast.InternalSymbolNameDefault, node, dontResolveAlias) } - file := core.Find(moduleSymbol.Declarations, ast.IsSourceFile) - specifier := c.getModuleSpecifierForImportOrExport(node) if specifier == nil { return exportDefaultSymbol } @@ -14948,7 +14982,11 @@ func (c *Checker) resolveESModuleSymbol(moduleSymbol *ast.Symbol, referencingLoc return symbol } referenceParent := referencingLocation.Parent - if ast.IsImportDeclaration(referenceParent) && ast.GetNamespaceDeclarationNode(referenceParent) != nil || ast.IsImportCall(referenceParent) { + var namespaceImport *ast.Node + if ast.IsImportDeclaration(referenceParent) { + namespaceImport = ast.GetNamespaceDeclarationNode(referenceParent) + } + if namespaceImport != nil || ast.IsImportCall(referenceParent) { var reference *ast.Node if ast.IsImportCall(referenceParent) { reference = referenceParent.AsCallExpression().Arguments.Nodes[0] @@ -14960,29 +14998,51 @@ func (c *Checker) resolveESModuleSymbol(moduleSymbol *ast.Symbol, referencingLoc if defaultOnlyType != nil { return c.cloneTypeAsModuleType(symbol, defaultOnlyType, referenceParent) } - // !!! - // targetFile := moduleSymbol. /* ? */ declarations. /* ? */ find(isSourceFile) - // isEsmCjsRef := targetFile && c.isESMFormatImportImportingCommonjsFormatFile(c.getEmitSyntaxForModuleSpecifierExpression(reference), host.getImpliedNodeFormatForEmit(targetFile)) - // if c.compilerOptions.GetESModuleInterop() || isEsmCjsRef { - // sigs := c.getSignaturesOfStructuredType(type_, SignatureKindCall) - // if !sigs || !sigs.length { - // sigs = c.getSignaturesOfStructuredType(type_, SignatureKindConstruct) - // } - // if (sigs && sigs.length) || c.getPropertyOfType(type_, ast.InternalSymbolNameDefault /*skipObjectFunctionPropertyAugment*/, true) || isEsmCjsRef { - // var moduleType *Type - // if type_.flags & TypeFlagsStructuredType { - // moduleType = c.getTypeWithSyntheticDefaultImportType(type_, symbol, moduleSymbol, reference) - // } else { - // moduleType = c.createDefaultPropertyWrapperForModule(symbol, symbol.parent) - // } - // return c.cloneTypeAsModuleType(symbol, moduleType, referenceParent) - // } - // } + + targetFile := core.Find(moduleSymbol.Declarations, ast.IsSourceFile) + usageMode := c.getEmitSyntaxForModuleSpecifierExpression(reference) + var exportModuleDotExportsSymbol *ast.Symbol + if namespaceImport != nil && targetFile != nil && + core.ModuleKindNode20 <= c.moduleKind && c.moduleKind <= core.ModuleKindNodeNext && + usageMode == core.ModuleKindCommonJS && + c.program.GetImpliedNodeFormatForEmit(targetFile.AsSourceFile()) == core.ModuleKindESNext { + exportModuleDotExportsSymbol = c.getExportOfModule(symbol, ast.InternalSymbolNameModuleExports, namespaceImport, dontResolveAlias) + } + if exportModuleDotExportsSymbol != nil { + if !suppressInteropError && symbol.Flags&(ast.SymbolFlagsModule|ast.SymbolFlagsVariable) == 0 { + c.error(referencingLocation, diagnostics.This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_referencing_its_default_export, "esModuleInterop") + } + if c.compilerOptions.GetESModuleInterop() && c.hasSignatures(typ) { + return c.cloneTypeAsModuleType(exportModuleDotExportsSymbol, typ, referenceParent) + } + return exportModuleDotExportsSymbol + } + + isEsmCjsRef := targetFile != nil && isESMFormatImportImportingCommonjsFormatFile(usageMode, c.program.GetImpliedNodeFormatForEmit(targetFile.AsSourceFile())) + if c.compilerOptions.GetESModuleInterop() || isEsmCjsRef { + if c.hasSignatures(typ) || c.getPropertyOfTypeEx(typ, ast.InternalSymbolNameDefault, true /*skipObjectFunctionPropertyAugment*/, false /*includeTypeOnlyMembers*/) != nil || isEsmCjsRef { + var moduleType *Type + if typ.Flags()&TypeFlagsStructuredType != 0 { + moduleType = c.getTypeWithSyntheticDefaultImportType(typ, symbol, moduleSymbol, reference) + } else { + moduleType = c.createDefaultPropertyWrapperForModule(symbol, symbol.Parent, nil) + } + return c.cloneTypeAsModuleType(symbol, moduleType, referenceParent) + } + } } } return symbol } +func (c *Checker) hasSignatures(t *Type) bool { + return len(c.getSignaturesOfStructuredType(t, SignatureKindCall)) > 0 || len(c.getSignaturesOfStructuredType(t, SignatureKindConstruct)) > 0 +} + +func isESMFormatImportImportingCommonjsFormatFile(usageMode core.ResolutionMode, targetMode core.ResolutionMode) bool { + return usageMode == core.ModuleKindESNext && targetMode == core.ModuleKindCommonJS +} + func (c *Checker) getTypeWithSyntheticDefaultOnly(t *Type, symbol *ast.Symbol, originalSymbol *ast.Symbol, moduleSpecifier *ast.Node) *Type { hasDefaultOnly := c.isOnlyImportableAsDefault(moduleSpecifier, nil) if hasDefaultOnly && t != nil && !c.isErrorType(t) { diff --git a/internal/checker/grammarchecks.go b/internal/checker/grammarchecks.go index 1b798ff413..28a18ed053 100644 --- a/internal/checker/grammarchecks.go +++ b/internal/checker/grammarchecks.go @@ -1240,7 +1240,7 @@ func (c *Checker) checkGrammarForInOrForOfStatement(forInOrOfStatement *ast.ForI c.diagnostics.Add(createDiagnosticForNode(forInOrOfStatement.AwaitModifier, diagnostics.X_for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module)) } switch c.moduleKind { - case core.ModuleKindNode16, core.ModuleKindNode18, core.ModuleKindNodeNext: + case core.ModuleKindNode16, core.ModuleKindNode18, core.ModuleKindNode20, core.ModuleKindNodeNext: sourceFileMetaData := c.program.GetSourceFileMetaData(sourceFile.Path()) if sourceFileMetaData.ImpliedNodeFormat == core.ModuleKindCommonJS { c.diagnostics.Add(createDiagnosticForNode(forInOrOfStatement.AwaitModifier, diagnostics.The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level)) @@ -1752,6 +1752,7 @@ func (c *Checker) checkGrammarAwaitOrAwaitUsing(node *ast.Node) bool { switch c.moduleKind { case core.ModuleKindNode16, core.ModuleKindNode18, + core.ModuleKindNode20, core.ModuleKindNodeNext: sourceFileMetaData := c.program.GetSourceFileMetaData(sourceFile.Path()) if sourceFileMetaData.ImpliedNodeFormat == core.ModuleKindCommonJS { diff --git a/internal/compiler/emitter.go b/internal/compiler/emitter.go index c6f6b9b60e..62f3e16285 100644 --- a/internal/compiler/emitter.go +++ b/internal/compiler/emitter.go @@ -64,6 +64,7 @@ func getModuleTransformer(opts *transformers.TransformOptions) *transformers.Tra core.ModuleKindES2022, core.ModuleKindES2020, core.ModuleKindES2015, + core.ModuleKindNode20, core.ModuleKindNode18, core.ModuleKindNode16, core.ModuleKindNodeNext, diff --git a/internal/core/compileroptions.go b/internal/core/compileroptions.go index f08866f896..aae6fed160 100644 --- a/internal/core/compileroptions.go +++ b/internal/core/compileroptions.go @@ -190,6 +190,8 @@ func (options *CompilerOptions) GetEmitScriptTarget() ScriptTarget { switch options.GetEmitModuleKind() { case ModuleKindNode16, ModuleKindNode18: return ScriptTargetES2022 + case ModuleKindNode20: + return ScriptTargetES2023 case ModuleKindNodeNext: return ScriptTargetESNext default: @@ -212,7 +214,7 @@ func (options *CompilerOptions) GetModuleResolutionKind() ModuleResolutionKind { return options.ModuleResolution } switch options.GetEmitModuleKind() { - case ModuleKindNode16, ModuleKindNode18: + case ModuleKindNode16, ModuleKindNode18, ModuleKindNode20: return ModuleResolutionKindNode16 case ModuleKindNodeNext: return ModuleResolutionKindNodeNext @@ -226,7 +228,7 @@ func (options *CompilerOptions) GetEmitModuleDetectionKind() ModuleDetectionKind return options.ModuleDetection } switch options.GetEmitModuleKind() { - case ModuleKindNode16, ModuleKindNodeNext: + case ModuleKindNode16, ModuleKindNode20, ModuleKindNodeNext: return ModuleDetectionKindForce default: return ModuleDetectionKindAuto @@ -254,7 +256,7 @@ func (options *CompilerOptions) GetESModuleInterop() bool { return options.ESModuleInterop == TSTrue } switch options.GetEmitModuleKind() { - case ModuleKindNode16, ModuleKindNode18, ModuleKindNodeNext, ModuleKindPreserve: + case ModuleKindNode16, ModuleKindNode18, ModuleKindNode20, ModuleKindNodeNext, ModuleKindPreserve: return true } return false @@ -273,6 +275,11 @@ func (options *CompilerOptions) GetResolveJsonModule() bool { if options.ResolveJsonModule != TSUnknown { return options.ResolveJsonModule == TSTrue } + switch options.GetEmitModuleKind() { + // TODO in 6.0: add Node16/Node18 + case ModuleKindNode20, ModuleKindESNext: + return true + } return options.GetModuleResolutionKind() == ModuleResolutionKindBundler } diff --git a/internal/ls/autoimports.go b/internal/ls/autoimports.go index b61abc8dc0..cf89e08fab 100644 --- a/internal/ls/autoimports.go +++ b/internal/ls/autoimports.go @@ -1237,7 +1237,7 @@ func getUmdImportKind(importingFile *ast.SourceFile /* | FutureSourceFile */, pr case core.ModuleKindES2015, core.ModuleKindES2020, core.ModuleKindES2022, core.ModuleKindESNext, core.ModuleKindNone, core.ModuleKindPreserve: // Fall back to the `import * as ns` style import. return ImportKindNamespace - case core.ModuleKindNode16, core.ModuleKindNode18, core.ModuleKindNodeNext: + case core.ModuleKindNode16, core.ModuleKindNode18, core.ModuleKindNode20, core.ModuleKindNodeNext: if program.GetImpliedNodeFormatForEmit(importingFile) == core.ModuleKindESNext { return ImportKindNamespace } diff --git a/testdata/baselines/reference/submodule/compiler/crashDeclareGlobalTypeofExport.types b/testdata/baselines/reference/submodule/compiler/crashDeclareGlobalTypeofExport.types index a96a8da61b..efede2b107 100644 --- a/testdata/baselines/reference/submodule/compiler/crashDeclareGlobalTypeofExport.types +++ b/testdata/baselines/reference/submodule/compiler/crashDeclareGlobalTypeofExport.types @@ -2,13 +2,13 @@ === bar.d.ts === import * as foo from './foo' ->foo : Root +>foo : { default: Root; } export as namespace foo ->foo : Root +>foo : { default: Root; } export = foo; ->foo : Root +>foo : { default: Root; } declare global { >global : typeof global diff --git a/testdata/baselines/reference/submodule/compiler/crashDeclareGlobalTypeofExport.types.diff b/testdata/baselines/reference/submodule/compiler/crashDeclareGlobalTypeofExport.types.diff deleted file mode 100644 index 130feaff3d..0000000000 --- a/testdata/baselines/reference/submodule/compiler/crashDeclareGlobalTypeofExport.types.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.crashDeclareGlobalTypeofExport.types -+++ new.crashDeclareGlobalTypeofExport.types -@@= skipped -1, +1 lines =@@ - - === bar.d.ts === - import * as foo from './foo' -->foo : { default: Root; } -+>foo : Root - - export as namespace foo -->foo : { default: Root; } -+>foo : Root - - export = foo; -->foo : { default: Root; } -+>foo : Root - - declare global { - >global : typeof global \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/esModuleInteropDefaultImports.symbols b/testdata/baselines/reference/submodule/compiler/esModuleInteropDefaultImports.symbols index ec3445c3ef..3469ef6440 100644 --- a/testdata/baselines/reference/submodule/compiler/esModuleInteropDefaultImports.symbols +++ b/testdata/baselines/reference/submodule/compiler/esModuleInteropDefaultImports.symbols @@ -19,12 +19,12 @@ import a from "./a"; >a : Symbol(a, Decl(b.ts, 0, 6)) import { default as b } from "./a"; ->default : Symbol(self.default, Decl(a.ts, 0, 30)) +>default : Symbol(mod, Decl(a.ts, 0, 30)) >b : Symbol(b, Decl(b.ts, 1, 8)) import c, { default as d } from "./a"; >c : Symbol(c, Decl(b.ts, 2, 6)) ->default : Symbol(self.default, Decl(a.ts, 0, 30)) +>default : Symbol(mod, Decl(a.ts, 0, 30)) >d : Symbol(d, Decl(b.ts, 2, 11)) import * as self from "./b"; @@ -34,7 +34,7 @@ export { default } from "./a"; >default : Symbol(self.default, Decl(b.ts, 4, 8)) export { default as def } from "./a"; ->default : Symbol(self.default, Decl(a.ts, 0, 30)) +>default : Symbol(mod, Decl(a.ts, 0, 30)) >def : Symbol(self.def, Decl(b.ts, 5, 8)) a === b; diff --git a/testdata/baselines/reference/submodule/compiler/esModuleInteropDefaultImports.symbols.diff b/testdata/baselines/reference/submodule/compiler/esModuleInteropDefaultImports.symbols.diff deleted file mode 100644 index a021aeed2c..0000000000 --- a/testdata/baselines/reference/submodule/compiler/esModuleInteropDefaultImports.symbols.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.esModuleInteropDefaultImports.symbols -+++ new.esModuleInteropDefaultImports.symbols -@@= skipped -18, +18 lines =@@ - >a : Symbol(a, Decl(b.ts, 0, 6)) - - import { default as b } from "./a"; -->default : Symbol(mod, Decl(a.ts, 0, 30)) -+>default : Symbol(self.default, Decl(a.ts, 0, 30)) - >b : Symbol(b, Decl(b.ts, 1, 8)) - - import c, { default as d } from "./a"; - >c : Symbol(c, Decl(b.ts, 2, 6)) -->default : Symbol(mod, Decl(a.ts, 0, 30)) -+>default : Symbol(self.default, Decl(a.ts, 0, 30)) - >d : Symbol(d, Decl(b.ts, 2, 11)) - - import * as self from "./b"; -@@= skipped -15, +15 lines =@@ - >default : Symbol(self.default, Decl(b.ts, 4, 8)) - - export { default as def } from "./a"; -->default : Symbol(mod, Decl(a.ts, 0, 30)) -+>default : Symbol(self.default, Decl(a.ts, 0, 30)) - >def : Symbol(self.def, Decl(b.ts, 5, 8)) - - a === b; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.errors.txt b/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.errors.txt deleted file mode 100644 index 5bcfcacb5b..0000000000 --- a/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.errors.txt +++ /dev/null @@ -1,14 +0,0 @@ -index.ts(2,5): error TS2339: Property 'default' does not exist on type '() => void'. - - -==== foo.d.ts (0 errors) ==== - declare function foo(): void; - declare namespace foo {} - export = foo; - -==== index.ts (1 errors) ==== - import * as foo from "./foo"; - foo.default; - ~~~~~~~ -!!! error TS2339: Property 'default' does not exist on type '() => void'. - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.errors.txt.diff deleted file mode 100644 index 287ec5a608..0000000000 --- a/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.errors.txt.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- old.esModuleInteropImportNamespace.errors.txt -+++ new.esModuleInteropImportNamespace.errors.txt -@@= skipped -0, +0 lines =@@ -- -+index.ts(2,5): error TS2339: Property 'default' does not exist on type '() => void'. -+ -+ -+==== foo.d.ts (0 errors) ==== -+ declare function foo(): void; -+ declare namespace foo {} -+ export = foo; -+ -+==== index.ts (1 errors) ==== -+ import * as foo from "./foo"; -+ foo.default; -+ ~~~~~~~ -+!!! error TS2339: Property 'default' does not exist on type '() => void'. -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.symbols b/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.symbols index e9ce7e39f1..1f8d1afb2d 100644 --- a/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.symbols +++ b/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.symbols @@ -15,5 +15,7 @@ import * as foo from "./foo"; >foo : Symbol(foo, Decl(index.ts, 0, 6)) foo.default; +>foo.default : Symbol(default) >foo : Symbol(foo, Decl(index.ts, 0, 6)) +>default : Symbol(default) diff --git a/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.symbols.diff b/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.symbols.diff deleted file mode 100644 index b2c12e0047..0000000000 --- a/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.symbols.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.esModuleInteropImportNamespace.symbols -+++ new.esModuleInteropImportNamespace.symbols -@@= skipped -14, +14 lines =@@ - >foo : Symbol(foo, Decl(index.ts, 0, 6)) - - foo.default; -->foo.default : Symbol(default) - >foo : Symbol(foo, Decl(index.ts, 0, 6)) -->default : Symbol(default) diff --git a/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.types b/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.types index d2c7c1140b..db0f209bc6 100644 --- a/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.types +++ b/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.types @@ -10,10 +10,10 @@ export = foo; === index.ts === import * as foo from "./foo"; ->foo : () => void +>foo : { default: () => void; } foo.default; ->foo.default : any ->foo : () => void ->default : any +>foo.default : () => void +>foo : { default: () => void; } +>default : () => void diff --git a/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.types.diff b/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.types.diff deleted file mode 100644 index 104c7f2bc2..0000000000 --- a/testdata/baselines/reference/submodule/compiler/esModuleInteropImportNamespace.types.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.esModuleInteropImportNamespace.types -+++ new.esModuleInteropImportNamespace.types -@@= skipped -9, +9 lines =@@ - - === index.ts === - import * as foo from "./foo"; -->foo : { default: () => void; } -+>foo : () => void - - foo.default; -->foo.default : () => void -->foo : { default: () => void; } -->default : () => void -+>foo.default : any -+>foo : () => void -+>default : any diff --git a/testdata/baselines/reference/submodule/compiler/esModuleInteropPrettyErrorRelatedInformation.errors.txt b/testdata/baselines/reference/submodule/compiler/esModuleInteropPrettyErrorRelatedInformation.errors.txt new file mode 100644 index 0000000000..0fb5881599 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/esModuleInteropPrettyErrorRelatedInformation.errors.txt @@ -0,0 +1,26 @@ +index.ts:3:8 - error TS2345: Argument of type '{ default: () => void; }' is not assignable to parameter of type '() => void'. + Type '{ default: () => void; }' provides no match for the signature '(): void'. + +3 invoke(foo); +   ~~~ + + index.ts:1:1 - Type originates at this import. A namespace-style import cannot be called or constructed, and will cause a failure at runtime. Consider using a default import or import require here instead. + 1 import * as foo from "./foo"; +   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +==== foo.d.ts (0 errors) ==== + declare function foo(): void; + declare namespace foo {} + export = foo; +==== index.ts (1 errors) ==== + import * as foo from "./foo"; + function invoke(f: () => void) { f(); } + invoke(foo); + ~~~ +!!! error TS2345: Argument of type '{ default: () => void; }' is not assignable to parameter of type '() => void'. +!!! error TS2345: Type '{ default: () => void; }' provides no match for the signature '(): void'. +!!! related TS7038 index.ts:1:1: Type originates at this import. A namespace-style import cannot be called or constructed, and will cause a failure at runtime. Consider using a default import or import require here instead. + +Found 1 error in index.ts:3 + diff --git a/testdata/baselines/reference/submodule/compiler/esModuleInteropPrettyErrorRelatedInformation.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/esModuleInteropPrettyErrorRelatedInformation.errors.txt.diff index 5b962e5fbe..77b601d067 100644 --- a/testdata/baselines/reference/submodule/compiler/esModuleInteropPrettyErrorRelatedInformation.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/esModuleInteropPrettyErrorRelatedInformation.errors.txt.diff @@ -1,31 +1,14 @@ --- old.esModuleInteropPrettyErrorRelatedInformation.errors.txt +++ new.esModuleInteropPrettyErrorRelatedInformation.errors.txt -@@= skipped -0, +0 lines =@@ --index.ts:3:8 - error TS2345: Argument of type '{ default: () => void; }' is not assignable to parameter of type '() => void'. -- Type '{ default: () => void; }' provides no match for the signature '(): void'. -- --3 invoke(foo); --   ~~~ -- +@@= skipped -3, +3 lines =@@ + 3 invoke(foo); +    ~~~ + - index.ts:1:1 -- 1 import * as foo from "./foo"; --   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ++ index.ts:1:1 - Type originates at this import. A namespace-style import cannot be called or constructed, and will cause a failure at runtime. Consider using a default import or import require here instead. + 1 import * as foo from "./foo"; +   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Type originates at this import. A namespace-style import cannot be called or constructed, and will cause a failure at runtime. Consider using a default import or import require here instead. -- -- --==== foo.d.ts (0 errors) ==== -- declare function foo(): void; -- declare namespace foo {} -- export = foo; --==== index.ts (1 errors) ==== -- import * as foo from "./foo"; -- function invoke(f: () => void) { f(); } -- invoke(foo); -- ~~~ --!!! error TS2345: Argument of type '{ default: () => void; }' is not assignable to parameter of type '() => void'. --!!! error TS2345: Type '{ default: () => void; }' provides no match for the signature '(): void'. --!!! related TS7038 index.ts:1:1: Type originates at this import. A namespace-style import cannot be called or constructed, and will cause a failure at runtime. Consider using a default import or import require here instead. -- --Found 1 error in index.ts:3 -- -+ \ No newline at end of file + + + ==== foo.d.ts (0 errors) ==== \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/esModuleInteropPrettyErrorRelatedInformation.types b/testdata/baselines/reference/submodule/compiler/esModuleInteropPrettyErrorRelatedInformation.types index a26e74be28..4ea79b5cfa 100644 --- a/testdata/baselines/reference/submodule/compiler/esModuleInteropPrettyErrorRelatedInformation.types +++ b/testdata/baselines/reference/submodule/compiler/esModuleInteropPrettyErrorRelatedInformation.types @@ -10,7 +10,7 @@ export = foo; === index.ts === import * as foo from "./foo"; ->foo : () => void +>foo : { default: () => void; } function invoke(f: () => void) { f(); } >invoke : (f: () => void) => void @@ -21,5 +21,5 @@ function invoke(f: () => void) { f(); } invoke(foo); >invoke(foo) : void >invoke : (f: () => void) => void ->foo : () => void +>foo : { default: () => void; } diff --git a/testdata/baselines/reference/submodule/compiler/esModuleInteropPrettyErrorRelatedInformation.types.diff b/testdata/baselines/reference/submodule/compiler/esModuleInteropPrettyErrorRelatedInformation.types.diff deleted file mode 100644 index 81a06b9aed..0000000000 --- a/testdata/baselines/reference/submodule/compiler/esModuleInteropPrettyErrorRelatedInformation.types.diff +++ /dev/null @@ -1,17 +0,0 @@ ---- old.esModuleInteropPrettyErrorRelatedInformation.types -+++ new.esModuleInteropPrettyErrorRelatedInformation.types -@@= skipped -9, +9 lines =@@ - - === index.ts === - import * as foo from "./foo"; -->foo : { default: () => void; } -+>foo : () => void - - function invoke(f: () => void) { f(); } - >invoke : (f: () => void) => void -@@= skipped -11, +11 lines =@@ - invoke(foo); - >invoke(foo) : void - >invoke : (f: () => void) => void -->foo : { default: () => void; } -+>foo : () => void diff --git a/testdata/baselines/reference/submodule/compiler/esModuleIntersectionCrash.types b/testdata/baselines/reference/submodule/compiler/esModuleIntersectionCrash.types index c7a44d4cb4..c908965ecb 100644 --- a/testdata/baselines/reference/submodule/compiler/esModuleIntersectionCrash.types +++ b/testdata/baselines/reference/submodule/compiler/esModuleIntersectionCrash.types @@ -19,15 +19,15 @@ declare namespace modObj { } === idx.ts === import * as mod from "./mod"; ->mod : mod.A & mod.B +>mod : { a: string; b: string; default: mod.A & mod.B; } mod.a; >mod.a : string ->mod : mod.A & mod.B +>mod : { a: string; b: string; default: mod.A & mod.B; } >a : string mod.b; >mod.b : string ->mod : mod.A & mod.B +>mod : { a: string; b: string; default: mod.A & mod.B; } >b : string diff --git a/testdata/baselines/reference/submodule/compiler/esModuleIntersectionCrash.types.diff b/testdata/baselines/reference/submodule/compiler/esModuleIntersectionCrash.types.diff index 5baf024ae0..7b6f1d59de 100644 --- a/testdata/baselines/reference/submodule/compiler/esModuleIntersectionCrash.types.diff +++ b/testdata/baselines/reference/submodule/compiler/esModuleIntersectionCrash.types.diff @@ -12,22 +12,3 @@ +>modObj : import("mod").A & import("mod").B >modObj : any >modObj : any - -@@= skipped -17, +17 lines =@@ - } - === idx.ts === - import * as mod from "./mod"; -->mod : { a: string; b: string; default: mod.A & mod.B; } -+>mod : mod.A & mod.B - - mod.a; - >mod.a : string -->mod : { a: string; b: string; default: mod.A & mod.B; } -+>mod : mod.A & mod.B - >a : string - - mod.b; - >mod.b : string -->mod : { a: string; b: string; default: mod.A & mod.B; } -+>mod : mod.A & mod.B - >b : string diff --git a/testdata/baselines/reference/submodule/compiler/exportAssignmentExpressionIsExpressionNode.errors.txt b/testdata/baselines/reference/submodule/compiler/exportAssignmentExpressionIsExpressionNode.errors.txt index 27620864d5..4d54d16ef5 100644 --- a/testdata/baselines/reference/submodule/compiler/exportAssignmentExpressionIsExpressionNode.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/exportAssignmentExpressionIsExpressionNode.errors.txt @@ -1,4 +1,4 @@ -/index.ts(7,7): error TS2322: Type 'typeof import("/node_modules/eslint-plugin-import-x/lib/index")' is not assignable to type 'Plugin'. +/index.ts(7,7): error TS2322: Type '{ default: { configs: { "stage-0": PluginConfig; }; }; configs: { "stage-0": PluginConfig; }; }' is not assignable to type 'Plugin'. Types of property 'configs' are incompatible. Type '{ "stage-0": PluginConfig; }' is not assignable to type 'Record'. Property ''stage-0'' is incompatible with index signature. @@ -43,7 +43,7 @@ const p: Plugin = pluginImportX; ~ -!!! error TS2322: Type 'typeof import("/node_modules/eslint-plugin-import-x/lib/index")' is not assignable to type 'Plugin'. +!!! error TS2322: Type '{ default: { configs: { "stage-0": PluginConfig; }; }; configs: { "stage-0": PluginConfig; }; }' is not assignable to type 'Plugin'. !!! error TS2322: Types of property 'configs' are incompatible. !!! error TS2322: Type '{ "stage-0": PluginConfig; }' is not assignable to type 'Record'. !!! error TS2322: Property ''stage-0'' is incompatible with index signature. diff --git a/testdata/baselines/reference/submodule/compiler/exportAssignmentExpressionIsExpressionNode.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/exportAssignmentExpressionIsExpressionNode.errors.txt.diff index 75c6c45835..aa4d5bb0b8 100644 --- a/testdata/baselines/reference/submodule/compiler/exportAssignmentExpressionIsExpressionNode.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/exportAssignmentExpressionIsExpressionNode.errors.txt.diff @@ -2,7 +2,7 @@ +++ new.exportAssignmentExpressionIsExpressionNode.errors.txt @@= skipped -0, +0 lines =@@ -/index.ts(7,7): error TS2322: Type '{ default: { configs: { 'stage-0': PluginConfig; }; }; configs: { 'stage-0': PluginConfig; }; }' is not assignable to type 'Plugin'. -+/index.ts(7,7): error TS2322: Type 'typeof import("/node_modules/eslint-plugin-import-x/lib/index")' is not assignable to type 'Plugin'. ++/index.ts(7,7): error TS2322: Type '{ default: { configs: { "stage-0": PluginConfig; }; }; configs: { "stage-0": PluginConfig; }; }' is not assignable to type 'Plugin'. Types of property 'configs' are incompatible. - Type '{ 'stage-0': PluginConfig; }' is not assignable to type 'Record'. + Type '{ "stage-0": PluginConfig; }' is not assignable to type 'Record'. @@ -14,7 +14,7 @@ const p: Plugin = pluginImportX; ~ -!!! error TS2322: Type '{ default: { configs: { 'stage-0': PluginConfig; }; }; configs: { 'stage-0': PluginConfig; }; }' is not assignable to type 'Plugin'. -+!!! error TS2322: Type 'typeof import("/node_modules/eslint-plugin-import-x/lib/index")' is not assignable to type 'Plugin'. ++!!! error TS2322: Type '{ default: { configs: { "stage-0": PluginConfig; }; }; configs: { "stage-0": PluginConfig; }; }' is not assignable to type 'Plugin'. !!! error TS2322: Types of property 'configs' are incompatible. -!!! error TS2322: Type '{ 'stage-0': PluginConfig; }' is not assignable to type 'Record'. +!!! error TS2322: Type '{ "stage-0": PluginConfig; }' is not assignable to type 'Record'. diff --git a/testdata/baselines/reference/submodule/compiler/moduleAugmentationDuringSyntheticDefaultCheck.types b/testdata/baselines/reference/submodule/compiler/moduleAugmentationDuringSyntheticDefaultCheck.types index 2a05f428bb..9832a96f5a 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleAugmentationDuringSyntheticDefaultCheck.types +++ b/testdata/baselines/reference/submodule/compiler/moduleAugmentationDuringSyntheticDefaultCheck.types @@ -4,7 +4,7 @@ /// import moment = require("moment-timezone"); ->moment : () => moment.Moment +>moment : { default: () => moment.Moment; } === node_modules/moment/index.d.ts === declare function moment(): moment.Moment; @@ -22,10 +22,10 @@ export = moment; === node_modules/moment-timezone/index.d.ts === import * as moment from 'moment'; ->moment : () => moment.Moment +>moment : { default: () => moment.Moment; } export = moment; ->moment : () => moment.Moment +>moment : { default: () => moment.Moment; } declare module "moment" { >"moment" : () => Moment diff --git a/testdata/baselines/reference/submodule/compiler/moduleAugmentationDuringSyntheticDefaultCheck.types.diff b/testdata/baselines/reference/submodule/compiler/moduleAugmentationDuringSyntheticDefaultCheck.types.diff index ce8a9e3a79..20fc62626d 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleAugmentationDuringSyntheticDefaultCheck.types.diff +++ b/testdata/baselines/reference/submodule/compiler/moduleAugmentationDuringSyntheticDefaultCheck.types.diff @@ -1,11 +1,6 @@ --- old.moduleAugmentationDuringSyntheticDefaultCheck.types +++ new.moduleAugmentationDuringSyntheticDefaultCheck.types -@@= skipped -3, +3 lines =@@ - /// - - import moment = require("moment-timezone"); -->moment : { default: () => moment.Moment; } -+>moment : () => moment.Moment +@@= skipped -7, +7 lines =@@ === node_modules/moment/index.d.ts === declare function moment(): moment.Moment; @@ -14,7 +9,7 @@ >moment : any declare namespace moment { -@@= skipped -14, +14 lines =@@ +@@= skipped -10, +10 lines =@@ } } export = moment; @@ -23,15 +18,6 @@ === node_modules/moment-timezone/index.d.ts === import * as moment from 'moment'; -->moment : { default: () => moment.Moment; } -+>moment : () => moment.Moment - - export = moment; -->moment : { default: () => moment.Moment; } -+>moment : () => moment.Moment - - declare module "moment" { - >"moment" : () => Moment @@= skipped -15, +15 lines =@@ interface Moment { tz(): string; diff --git a/testdata/baselines/reference/submodule/compiler/moduleExportNonStructured.types b/testdata/baselines/reference/submodule/compiler/moduleExportNonStructured.types index 3e5fab7c23..5d97979609 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleExportNonStructured.types +++ b/testdata/baselines/reference/submodule/compiler/moduleExportNonStructured.types @@ -2,22 +2,22 @@ === index.mts === import * as exportAny from "./exportAny.cjs"; ->exportAny : any +>exportAny : { default: any; } import * as exportUnknown from "./exportUnknown.cjs"; ->exportUnknown : unknown +>exportUnknown : { default: unknown; } import * as exportSymbol from "./exportSymbol.cjs"; ->exportSymbol : symbol +>exportSymbol : { default: symbol; } import type * as exportAnyType from "./exportAny.cjs"; ->exportAnyType : any +>exportAnyType : { default: any; } import type * as exportUnknownType from "./exportUnknown.cjs"; ->exportUnknownType : unknown +>exportUnknownType : { default: unknown; } import type * as exportSymbolType from "./exportSymbol.cjs"; ->exportSymbolType : symbol +>exportSymbolType : { default: symbol; } === exportAny.d.cts === declare const __: any; diff --git a/testdata/baselines/reference/submodule/compiler/moduleExportNonStructured.types.diff b/testdata/baselines/reference/submodule/compiler/moduleExportNonStructured.types.diff deleted file mode 100644 index 08137ed345..0000000000 --- a/testdata/baselines/reference/submodule/compiler/moduleExportNonStructured.types.diff +++ /dev/null @@ -1,31 +0,0 @@ ---- old.moduleExportNonStructured.types -+++ new.moduleExportNonStructured.types -@@= skipped -1, +1 lines =@@ - - === index.mts === - import * as exportAny from "./exportAny.cjs"; -->exportAny : { default: any; } -+>exportAny : any - - import * as exportUnknown from "./exportUnknown.cjs"; -->exportUnknown : { default: unknown; } -+>exportUnknown : unknown - - import * as exportSymbol from "./exportSymbol.cjs"; -->exportSymbol : { default: symbol; } -+>exportSymbol : symbol - - import type * as exportAnyType from "./exportAny.cjs"; -->exportAnyType : { default: any; } -+>exportAnyType : any - - import type * as exportUnknownType from "./exportUnknown.cjs"; -->exportUnknownType : { default: unknown; } -+>exportUnknownType : unknown - - import type * as exportSymbolType from "./exportSymbol.cjs"; -->exportSymbolType : { default: symbol; } -+>exportSymbolType : symbol - - === exportAny.d.cts === - declare const __: any; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node20).errors.txt b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node20).errors.txt index a594203382..2fd1d68ba8 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node20).errors.txt @@ -1,4 +1,3 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. b.mts(15,1): error TS2349: This expression is not callable. Type 'typeof import("mod")' has no call signatures. b.mts(16,1): error TS2349: This expression is not callable. @@ -13,7 +12,6 @@ b.mts(20,6): error TS2349: This expression is not callable. Type 'typeof import("mod")' has no call signatures. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== mod.cts (0 errors) ==== declare function fun(): void; export default fun; diff --git a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node20).errors.txt.diff deleted file mode 100644 index a5d08c5658..0000000000 --- a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node20).errors.txt.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.moduleNodeDefaultImports(module=node20).errors.txt -+++ new.moduleNodeDefaultImports(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - b.mts(15,1): error TS2349: This expression is not callable. - Type 'typeof import("mod")' has no call signatures. - b.mts(16,1): error TS2349: This expression is not callable. -@@= skipped -11, +12 lines =@@ - Type 'typeof import("mod")' has no call signatures. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== mod.cts (0 errors) ==== - declare function fun(): void; - export default fun; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node20).js b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node20).js index 678b845724..1d6e31ec0a 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node20).js +++ b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node20).js @@ -38,33 +38,28 @@ self.def.default(); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = fun; //// [b.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.def = exports.default = void 0; -const mod_cjs_1 = require("./mod.cjs"); -const mod_cjs_2 = require("./mod.cjs"); -const mod_cjs_3 = require("./mod.cjs"); -const self = require("./b.mjs"); -const mod_cjs_4 = require("./mod.cjs"); -Object.defineProperty(exports, "default", { enumerable: true, get: function () { return mod_cjs_4.default; } }); -const mod_cjs_5 = require("./mod.cjs"); -Object.defineProperty(exports, "def", { enumerable: true, get: function () { return mod_cjs_5.default; } }); -mod_cjs_1.default === mod_cjs_2.default; -mod_cjs_2.default === mod_cjs_3.default; -mod_cjs_3.default === mod_cjs_3.default; -mod_cjs_3.default === self.default; +import a from "./mod.cjs"; +import { default as b } from "./mod.cjs"; +import c, { default as d } from "./mod.cjs"; +import * as self from "./b.mjs"; +export { default } from "./mod.cjs"; +export { default as def } from "./mod.cjs"; +a === b; +b === c; +c === d; +d === self.default; self.default === self.def; // should all fail -(0, mod_cjs_1.default)(); -(0, mod_cjs_2.default)(); -(0, mod_cjs_3.default)(); -(0, mod_cjs_3.default)(); +a(); +b(); +c(); +d(); self.default(); self.def(); // should all work -mod_cjs_1.default.default(); -mod_cjs_2.default.default(); -mod_cjs_3.default.default(); -mod_cjs_3.default.default(); +a.default(); +b.default(); +c.default(); +d.default(); self.default.default(); self.def.default(); diff --git a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node20).js.diff b/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node20).js.diff deleted file mode 100644 index f9cea00cdc..0000000000 --- a/testdata/baselines/reference/submodule/compiler/moduleNodeDefaultImports(module=node20).js.diff +++ /dev/null @@ -1,54 +0,0 @@ ---- old.moduleNodeDefaultImports(module=node20).js -+++ new.moduleNodeDefaultImports(module=node20).js -@@= skipped -37, +37 lines =@@ - Object.defineProperty(exports, "__esModule", { value: true }); - exports.default = fun; - //// [b.mjs] --import a from "./mod.cjs"; --import { default as b } from "./mod.cjs"; --import c, { default as d } from "./mod.cjs"; --import * as self from "./b.mjs"; --export { default } from "./mod.cjs"; --export { default as def } from "./mod.cjs"; --a === b; --b === c; --c === d; --d === self.default; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.def = exports.default = void 0; -+const mod_cjs_1 = require("./mod.cjs"); -+const mod_cjs_2 = require("./mod.cjs"); -+const mod_cjs_3 = require("./mod.cjs"); -+const self = require("./b.mjs"); -+const mod_cjs_4 = require("./mod.cjs"); -+Object.defineProperty(exports, "default", { enumerable: true, get: function () { return mod_cjs_4.default; } }); -+const mod_cjs_5 = require("./mod.cjs"); -+Object.defineProperty(exports, "def", { enumerable: true, get: function () { return mod_cjs_5.default; } }); -+mod_cjs_1.default === mod_cjs_2.default; -+mod_cjs_2.default === mod_cjs_3.default; -+mod_cjs_3.default === mod_cjs_3.default; -+mod_cjs_3.default === self.default; - self.default === self.def; - // should all fail --a(); --b(); --c(); --d(); -+(0, mod_cjs_1.default)(); -+(0, mod_cjs_2.default)(); -+(0, mod_cjs_3.default)(); -+(0, mod_cjs_3.default)(); - self.default(); - self.def(); - // should all work --a.default(); --b.default(); --c.default(); --d.default(); -+mod_cjs_1.default.default(); -+mod_cjs_2.default.default(); -+mod_cjs_3.default.default(); -+mod_cjs_3.default.default(); - self.default.default(); - self.def.default(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithModule(module=node20,moduleresolution=node16).js b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithModule(module=node20,moduleresolution=node16).js index 92b7e88696..2d0c7b4607 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithModule(module=node20,moduleresolution=node16).js +++ b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithModule(module=node20,moduleresolution=node16).js @@ -14,6 +14,39 @@ p.thing(); //// [index.js] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); -const p = require("pkg"); +const p = __importStar(require("pkg")); p.thing(); diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithModule(module=node20,moduleresolution=node16).js.diff b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithModule(module=node20,moduleresolution=node16).js.diff deleted file mode 100644 index 36ffdc1a84..0000000000 --- a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithModule(module=node20,moduleresolution=node16).js.diff +++ /dev/null @@ -1,43 +0,0 @@ ---- old.moduleResolutionWithModule(module=node20,moduleresolution=node16).js -+++ new.moduleResolutionWithModule(module=node20,moduleresolution=node16).js -@@= skipped -13, +13 lines =@@ - - //// [index.js] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); --const p = __importStar(require("pkg")); -+const p = require("pkg"); - p.thing(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithModule(module=node20,moduleresolution=nodenext).js b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithModule(module=node20,moduleresolution=nodenext).js index 92b7e88696..2d0c7b4607 100644 --- a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithModule(module=node20,moduleresolution=nodenext).js +++ b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithModule(module=node20,moduleresolution=nodenext).js @@ -14,6 +14,39 @@ p.thing(); //// [index.js] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); -const p = require("pkg"); +const p = __importStar(require("pkg")); p.thing(); diff --git a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithModule(module=node20,moduleresolution=nodenext).js.diff b/testdata/baselines/reference/submodule/compiler/moduleResolutionWithModule(module=node20,moduleresolution=nodenext).js.diff deleted file mode 100644 index edef2d838d..0000000000 --- a/testdata/baselines/reference/submodule/compiler/moduleResolutionWithModule(module=node20,moduleresolution=nodenext).js.diff +++ /dev/null @@ -1,43 +0,0 @@ ---- old.moduleResolutionWithModule(module=node20,moduleresolution=nodenext).js -+++ new.moduleResolutionWithModule(module=node20,moduleresolution=nodenext).js -@@= skipped -13, +13 lines =@@ - - //// [index.js] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); --const p = __importStar(require("pkg")); -+const p = require("pkg"); - p.thing(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.errors.txt b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.errors.txt deleted file mode 100644 index 923dd9d79c..0000000000 --- a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.errors.txt +++ /dev/null @@ -1,14 +0,0 @@ -src/foo.mts(6,4): error TS2339: Property 'default' does not exist on type 'typeof import("src/a")'. - - -==== src/a.cts (0 errors) ==== - export const a: number = 1; -==== src/foo.mts (1 errors) ==== - import d, {a} from './a.cjs'; - import * as ns from './a.cjs'; - export {d, a, ns}; - - d.a; - ns.default.a; - ~~~~~~~ -!!! error TS2339: Property 'default' does not exist on type 'typeof import("src/a")'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.errors.txt.diff deleted file mode 100644 index b8d91ba15c..0000000000 --- a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.errors.txt.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- old.nodeNextCjsNamespaceImportDefault1.errors.txt -+++ new.nodeNextCjsNamespaceImportDefault1.errors.txt -@@= skipped -0, +0 lines =@@ -- -+src/foo.mts(6,4): error TS2339: Property 'default' does not exist on type 'typeof import("src/a")'. -+ -+ -+==== src/a.cts (0 errors) ==== -+ export const a: number = 1; -+==== src/foo.mts (1 errors) ==== -+ import d, {a} from './a.cjs'; -+ import * as ns from './a.cjs'; -+ export {d, a, ns}; -+ -+ d.a; -+ ns.default.a; -+ ~~~~~~~ -+!!! error TS2339: Property 'default' does not exist on type 'typeof import("src/a")'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.symbols b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.symbols index ce6486e985..7c1ed8eba9 100644 --- a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.symbols +++ b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.symbols @@ -23,5 +23,9 @@ d.a; >a : Symbol(a, Decl(a.cts, 0, 12)) ns.default.a; +>ns.default.a : Symbol(a, Decl(a.cts, 0, 12)) +>ns.default : Symbol(d.default) >ns : Symbol(ns, Decl(foo.mts, 1, 6)) +>default : Symbol(d.default) +>a : Symbol(a, Decl(a.cts, 0, 12)) diff --git a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.symbols.diff b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.symbols.diff index 5624fa9aee..1af235877e 100644 --- a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.symbols.diff @@ -12,7 +12,9 @@ ns.default.a; ->ns.default.a : Symbol(d.a, Decl(a.cts, 0, 12)) -->ns.default : Symbol(d.default) ++>ns.default.a : Symbol(a, Decl(a.cts, 0, 12)) + >ns.default : Symbol(d.default) >ns : Symbol(ns, Decl(foo.mts, 1, 6)) -->default : Symbol(d.default) + >default : Symbol(d.default) ->a : Symbol(d.a, Decl(a.cts, 0, 12)) ++>a : Symbol(a, Decl(a.cts, 0, 12)) diff --git a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.types b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.types index 187bdd6ce3..b10938a742 100644 --- a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.types +++ b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.types @@ -11,12 +11,12 @@ import d, {a} from './a.cjs'; >a : number import * as ns from './a.cjs'; ->ns : typeof d +>ns : typeof ns export {d, a, ns}; >d : typeof d >a : number ->ns : typeof d +>ns : typeof ns d.a; >d.a : number @@ -24,9 +24,9 @@ d.a; >a : number ns.default.a; ->ns.default.a : any ->ns.default : any ->ns : typeof d ->default : any ->a : any +>ns.default.a : number +>ns.default : typeof d +>ns : typeof ns +>default : typeof d +>a : number diff --git a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.types.diff b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.types.diff deleted file mode 100644 index 0de716579a..0000000000 --- a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault1.types.diff +++ /dev/null @@ -1,31 +0,0 @@ ---- old.nodeNextCjsNamespaceImportDefault1.types -+++ new.nodeNextCjsNamespaceImportDefault1.types -@@= skipped -10, +10 lines =@@ - >a : number - - import * as ns from './a.cjs'; -->ns : typeof ns -+>ns : typeof d - - export {d, a, ns}; - >d : typeof d - >a : number -->ns : typeof ns -+>ns : typeof d - - d.a; - >d.a : number -@@= skipped -13, +13 lines =@@ - >a : number - - ns.default.a; -->ns.default.a : number -->ns.default : typeof d -->ns : typeof ns -->default : typeof d -->a : number -+>ns.default.a : any -+>ns.default : any -+>ns : typeof d -+>default : any -+>a : any diff --git a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.errors.txt b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.errors.txt deleted file mode 100644 index dbb54d4c12..0000000000 --- a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.errors.txt +++ /dev/null @@ -1,15 +0,0 @@ -src/foo.mts(6,12): error TS2339: Property 'a' does not exist on type '"string"'. - - -==== src/a.cts (0 errors) ==== - export const a: number = 1; - export default 'string'; -==== src/foo.mts (1 errors) ==== - import d, {a} from './a.cjs'; - import * as ns from './a.cjs'; - export {d, a, ns}; - - d.a; - ns.default.a; - ~ -!!! error TS2339: Property 'a' does not exist on type '"string"'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.errors.txt.diff deleted file mode 100644 index d4b66f4f29..0000000000 --- a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.errors.txt.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.nodeNextCjsNamespaceImportDefault2.errors.txt -+++ new.nodeNextCjsNamespaceImportDefault2.errors.txt -@@= skipped -0, +0 lines =@@ -- -+src/foo.mts(6,12): error TS2339: Property 'a' does not exist on type '"string"'. -+ -+ -+==== src/a.cts (0 errors) ==== -+ export const a: number = 1; -+ export default 'string'; -+==== src/foo.mts (1 errors) ==== -+ import d, {a} from './a.cjs'; -+ import * as ns from './a.cjs'; -+ export {d, a, ns}; -+ -+ d.a; -+ ns.default.a; -+ ~ -+!!! error TS2339: Property 'a' does not exist on type '"string"'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.symbols b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.symbols index 247684eef2..d29ca9ced8 100644 --- a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.symbols +++ b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.symbols @@ -24,7 +24,9 @@ d.a; >a : Symbol(a, Decl(a.cts, 0, 12)) ns.default.a; ->ns.default : Symbol(d.default, Decl(a.cts, 0, 27)) +>ns.default.a : Symbol(a, Decl(a.cts, 0, 12)) +>ns.default : Symbol(d.default) >ns : Symbol(ns, Decl(foo.mts, 1, 6)) ->default : Symbol(d.default, Decl(a.cts, 0, 27)) +>default : Symbol(d.default) +>a : Symbol(a, Decl(a.cts, 0, 12)) diff --git a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.symbols.diff b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.symbols.diff index 0e016d4219..36c1c8d607 100644 --- a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.symbols.diff +++ b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.symbols.diff @@ -12,9 +12,9 @@ ns.default.a; ->ns.default.a : Symbol(d.a, Decl(a.cts, 0, 12)) -->ns.default : Symbol(d.default) -+>ns.default : Symbol(d.default, Decl(a.cts, 0, 27)) ++>ns.default.a : Symbol(a, Decl(a.cts, 0, 12)) + >ns.default : Symbol(d.default) >ns : Symbol(ns, Decl(foo.mts, 1, 6)) -->default : Symbol(d.default) + >default : Symbol(d.default) ->a : Symbol(d.a, Decl(a.cts, 0, 12)) -+>default : Symbol(d.default, Decl(a.cts, 0, 27)) ++>a : Symbol(a, Decl(a.cts, 0, 12)) diff --git a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.types b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.types index eb3b767623..7b70232fc8 100644 --- a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.types +++ b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.types @@ -12,12 +12,12 @@ import d, {a} from './a.cjs'; >a : number import * as ns from './a.cjs'; ->ns : typeof d +>ns : typeof ns export {d, a, ns}; >d : typeof d >a : number ->ns : typeof d +>ns : typeof ns d.a; >d.a : number @@ -25,9 +25,9 @@ d.a; >a : number ns.default.a; ->ns.default.a : any ->ns.default : "string" ->ns : typeof d ->default : "string" ->a : any +>ns.default.a : number +>ns.default : typeof d +>ns : typeof ns +>default : typeof d +>a : number diff --git a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.types.diff b/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.types.diff deleted file mode 100644 index 80a692a2c9..0000000000 --- a/testdata/baselines/reference/submodule/compiler/nodeNextCjsNamespaceImportDefault2.types.diff +++ /dev/null @@ -1,31 +0,0 @@ ---- old.nodeNextCjsNamespaceImportDefault2.types -+++ new.nodeNextCjsNamespaceImportDefault2.types -@@= skipped -11, +11 lines =@@ - >a : number - - import * as ns from './a.cjs'; -->ns : typeof ns -+>ns : typeof d - - export {d, a, ns}; - >d : typeof d - >a : number -->ns : typeof ns -+>ns : typeof d - - d.a; - >d.a : number -@@= skipped -13, +13 lines =@@ - >a : number - - ns.default.a; -->ns.default.a : number -->ns.default : typeof d -->ns : typeof ns -->default : typeof d -->a : number -+>ns.default.a : any -+>ns.default : "string" -+>ns : typeof d -+>default : "string" -+>a : any diff --git a/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node20).errors.txt b/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node20).errors.txt index fe344a0488..9062d29947 100644 --- a/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node20).errors.txt @@ -1,8 +1,6 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. usage.ts(1,23): error TS2688: Cannot find type definition file for 'pkg'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== node_modules/pkg/index.d.ts (0 errors) ==== interface GlobalThing { a: number } ==== node_modules/pkg/package.json (0 errors) ==== diff --git a/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node20).errors.txt.diff deleted file mode 100644 index 7ec98999db..0000000000 --- a/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node20).errors.txt.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.tripleSlashTypesReferenceWithMissingExports(module=node20).errors.txt -+++ new.tripleSlashTypesReferenceWithMissingExports(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - usage.ts(1,23): error TS2688: Cannot find type definition file for 'pkg'. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== node_modules/pkg/index.d.ts (0 errors) ==== - interface GlobalThing { a: number } - ==== node_modules/pkg/package.json (0 errors) ==== \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node20).js b/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node20).js index 89dd2c7541..6d734ae2ed 100644 --- a/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node20).js +++ b/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node20).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=node20).js.diff b/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node20).js.diff index ebd2efbfde..18ceeaf53b 100644 --- a/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/compiler/tripleSlashTypesReferenceWithMissingExports(module=node20).js.diff @@ -1,10 +1,10 @@ --- old.tripleSlashTypesReferenceWithMissingExports(module=node20).js +++ new.tripleSlashTypesReferenceWithMissingExports(module=node20).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/arbitraryModuleNamespaceIdentifiers_module(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_module(module=node20).errors.txt index eb313ab5ef..cc359bceb4 100644 --- a/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_module(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_module(module=node20).errors.txt @@ -1,10 +1,8 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. arbitraryModuleNamespaceIdentifiers_module.ts(20,7): error TS2322: Type '"expect error about someType"' is not assignable to type '"someType"'. arbitraryModuleNamespaceIdentifiers_module.ts(24,7): error TS2322: Type '"expect error about someType"' is not assignable to type '"someType"'. arbitraryModuleNamespaceIdentifiers_module.ts(29,7): error TS2322: Type '"expect error about otherType"' is not assignable to type '"otherType"'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== arbitraryModuleNamespaceIdentifiers_module.ts (3 errors) ==== const someValue = "someValue"; type someType = "someType"; diff --git a/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_module(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_module(module=node20).errors.txt.diff deleted file mode 100644 index 2025d36588..0000000000 --- a/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_module(module=node20).errors.txt.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- old.arbitraryModuleNamespaceIdentifiers_module(module=node20).errors.txt -+++ new.arbitraryModuleNamespaceIdentifiers_module(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - arbitraryModuleNamespaceIdentifiers_module.ts(20,7): error TS2322: Type '"expect error about someType"' is not assignable to type '"someType"'. - arbitraryModuleNamespaceIdentifiers_module.ts(24,7): error TS2322: Type '"expect error about someType"' is not assignable to type '"someType"'. - arbitraryModuleNamespaceIdentifiers_module.ts(29,7): error TS2322: Type '"expect error about otherType"' is not assignable to type '"otherType"'. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== arbitraryModuleNamespaceIdentifiers_module.ts (3 errors) ==== - const someValue = "someValue"; - type someType = "someType"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_module(module=node20).js b/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_module(module=node20).js index d01954f66b..3c4b1a08c3 100644 --- a/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_module(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_module(module=node20).js @@ -34,6 +34,39 @@ const importStarTestA: typeC.otherType = "expect error about otherType"; //// [arbitraryModuleNamespaceIdentifiers_module.js] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports[""] = exports[""] = exports[""] = void 0; const someValue = "someValue"; @@ -46,7 +79,7 @@ Object.defineProperty(exports, "", { enumerable: true, get: function () { ret const arbitraryModuleNamespaceIdentifiers_module_3 = require("./arbitraryModuleNamespaceIdentifiers_module"); if (arbitraryModuleNamespaceIdentifiers_module_3[""] !== "someValue") throw "should be someValue"; -exports[""] = require("./arbitraryModuleNamespaceIdentifiers_module"); +exports[""] = __importStar(require("./arbitraryModuleNamespaceIdentifiers_module")); const arbitraryModuleNamespaceIdentifiers_module_4 = require("./arbitraryModuleNamespaceIdentifiers_module"); if (arbitraryModuleNamespaceIdentifiers_module_4[""][""] !== "someValue") throw "should be someValue"; diff --git a/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_module(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_module(module=node20).js.diff index 731dc2b1b9..6810491b06 100644 --- a/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_module(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/arbitraryModuleNamespaceIdentifiers_module(module=node20).js.diff @@ -1,46 +1,6 @@ --- old.arbitraryModuleNamespaceIdentifiers_module(module=node20).js +++ new.arbitraryModuleNamespaceIdentifiers_module(module=node20).js -@@= skipped -33, +33 lines =@@ - - //// [arbitraryModuleNamespaceIdentifiers_module.js] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports[""] = exports[""] = exports[""] = void 0; - const someValue = "someValue"; -@@= skipped -40, +7 lines =@@ +@@= skipped -73, +73 lines =@@ const arbitraryModuleNamespaceIdentifiers_module_1 = require("./arbitraryModuleNamespaceIdentifiers_module"); if (arbitraryModuleNamespaceIdentifiers_module_1[""] !== "someValue") throw "should be someValue"; @@ -48,10 +8,4 @@ +const arbitraryModuleNamespaceIdentifiers_module_2 = require("./arbitraryModuleNamespaceIdentifiers_module"); Object.defineProperty(exports, "", { enumerable: true, get: function () { return arbitraryModuleNamespaceIdentifiers_module_2[""]; } }); const arbitraryModuleNamespaceIdentifiers_module_3 = require("./arbitraryModuleNamespaceIdentifiers_module"); - if (arbitraryModuleNamespaceIdentifiers_module_3[""] !== "someValue") - throw "should be someValue"; --exports[""] = __importStar(require("./arbitraryModuleNamespaceIdentifiers_module")); -+exports[""] = require("./arbitraryModuleNamespaceIdentifiers_module"); - const arbitraryModuleNamespaceIdentifiers_module_4 = require("./arbitraryModuleNamespaceIdentifiers_module"); - if (arbitraryModuleNamespaceIdentifiers_module_4[""][""] !== "someValue") - throw "should be someValue"; \ No newline at end of file + if (arbitraryModuleNamespaceIdentifiers_module_3[""] !== "someValue") \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/bundlerDirectoryModule(module=node20,moduleresolution=nodenext).trace.json b/testdata/baselines/reference/submodule/conformance/bundlerDirectoryModule(module=node20,moduleresolution=nodenext).trace.json index 6fb3a0bc62..6ffdb55a57 100644 --- a/testdata/baselines/reference/submodule/conformance/bundlerDirectoryModule(module=node20,moduleresolution=nodenext).trace.json +++ b/testdata/baselines/reference/submodule/conformance/bundlerDirectoryModule(module=node20,moduleresolution=nodenext).trace.json @@ -1,7 +1,7 @@ ======== Resolving module '../lib' from '/app/test.ts'. ======== Explicitly specified module resolution kind: 'NodeNext'. Resolving in CJS mode with conditions 'require', 'types', 'node'. -Loading module as file / folder, candidate module location '/lib', target file types: TypeScript, JavaScript, Declaration. +Loading module as file / folder, candidate module location '/lib', target file types: TypeScript, JavaScript, Declaration, JSON. File '/lib.ts' does not exist. File '/lib.tsx' does not exist. File '/lib.d.ts' does not exist. diff --git a/testdata/baselines/reference/submodule/conformance/cjsErrors(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/cjsErrors(module=node20).errors.txt index 1834ff8689..010cc8f06a 100644 --- a/testdata/baselines/reference/submodule/conformance/cjsErrors(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/cjsErrors(module=node20).errors.txt @@ -1,8 +1,6 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. index.ts(1,22): error TS2876: This relative import path is unsafe to rewrite because it looks like a file name, but actually resolves to "./foo.ts/index.ts". -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== index.ts (1 errors) ==== import foo = require("./foo.ts"); // Error ~~~~~~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/cjsErrors(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/cjsErrors(module=node20).errors.txt.diff deleted file mode 100644 index 78623d6186..0000000000 --- a/testdata/baselines/reference/submodule/conformance/cjsErrors(module=node20).errors.txt.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.cjsErrors(module=node20).errors.txt -+++ new.cjsErrors(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - index.ts(1,22): error TS2876: This relative import path is unsafe to rewrite because it looks like a file name, but actually resolves to "./foo.ts/index.ts". - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== index.ts (1 errors) ==== - import foo = require("./foo.ts"); // Error - ~~~~~~~~~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/conditionalExportsResolutionFallback(moduleresolution=node16).trace.json b/testdata/baselines/reference/submodule/conformance/conditionalExportsResolutionFallback(moduleresolution=node16).trace.json index b4010f23a5..1f4cee8b04 100644 --- a/testdata/baselines/reference/submodule/conformance/conditionalExportsResolutionFallback(moduleresolution=node16).trace.json +++ b/testdata/baselines/reference/submodule/conformance/conditionalExportsResolutionFallback(moduleresolution=node16).trace.json @@ -2,7 +2,7 @@ Explicitly specified module resolution kind: 'Node16'. Resolving in ESM mode with conditions 'import', 'types', 'node'. File '/package.json' does not exist. -Loading module 'dep' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Loading module 'dep' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. Found 'package.json' at '/node_modules/dep/package.json'. Entering conditional exports. diff --git a/testdata/baselines/reference/submodule/conformance/conditionalExportsResolutionFallback(moduleresolution=nodenext).trace.json b/testdata/baselines/reference/submodule/conformance/conditionalExportsResolutionFallback(moduleresolution=nodenext).trace.json index 52eb32d86e..e1611836c9 100644 --- a/testdata/baselines/reference/submodule/conformance/conditionalExportsResolutionFallback(moduleresolution=nodenext).trace.json +++ b/testdata/baselines/reference/submodule/conformance/conditionalExportsResolutionFallback(moduleresolution=nodenext).trace.json @@ -2,7 +2,7 @@ Explicitly specified module resolution kind: 'NodeNext'. Resolving in ESM mode with conditions 'import', 'types', 'node'. File '/package.json' does not exist. -Loading module 'dep' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Loading module 'dep' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. Found 'package.json' at '/node_modules/dep/package.json'. Entering conditional exports. diff --git a/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).errors.txt index c2d28e3029..754dde9109 100644 --- a/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).errors.txt @@ -1,4 +1,3 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. main.ts(1,18): error TS2307: Cannot find module './file.js' or its corresponding type declarations. main.ts(2,18): error TS2307: Cannot find module './file.jsx' or its corresponding type declarations. main.ts(3,18): error TS2307: Cannot find module './file.ts' or its corresponding type declarations. @@ -7,13 +6,15 @@ main.ts(5,18): error TS2307: Cannot find module './file.mjs' or its correspondin main.ts(6,18): error TS2307: Cannot find module './file.cjs' or its corresponding type declarations. main.ts(7,18): error TS2307: Cannot find module './file.mts' or its corresponding type declarations. main.ts(8,18): error TS2307: Cannot find module './file.cts' or its corresponding type declarations. +main.ts(9,18): error TS2307: Cannot find module './file.d.ts' or its corresponding type declarations. +main.ts(10,19): error TS2307: Cannot find module './file.d.cts' or its corresponding type declarations. +main.ts(11,19): error TS2307: Cannot find module './file.d.mts' or its corresponding type declarations. main.ts(12,19): error TS2307: Cannot find module './file.d.json.ts' or its corresponding type declarations. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== package.json (0 errors) ==== {"type": "module"} -==== main.ts (9 errors) ==== +==== main.ts (12 errors) ==== import def1 from "./file.js"; ~~~~~~~~~~~ !!! error TS2307: Cannot find module './file.js' or its corresponding type declarations. @@ -39,8 +40,14 @@ main.ts(12,19): error TS2307: Cannot find module './file.d.json.ts' or its corre ~~~~~~~~~~~~ !!! error TS2307: Cannot find module './file.cts' or its corresponding type declarations. import def9 from "./file.d.ts"; + ~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module './file.d.ts' or its corresponding type declarations. import def10 from "./file.d.cts"; + ~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module './file.d.cts' or its corresponding type declarations. import def11 from "./file.d.mts"; + ~~~~~~~~~~~~~~ +!!! error TS2307: Cannot find module './file.d.mts' or its corresponding type declarations. import def12 from "./file.d.json.ts"; ~~~~~~~~~~~~~~~~~~ !!! error TS2307: Cannot find module './file.d.json.ts' or its corresponding type declarations. diff --git a/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).errors.txt.diff deleted file mode 100644 index cf4ea45d49..0000000000 --- a/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).errors.txt.diff +++ /dev/null @@ -1,40 +0,0 @@ ---- old.declarationFileForTsJsImport(module=node20).errors.txt -+++ new.declarationFileForTsJsImport(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - main.ts(1,18): error TS2307: Cannot find module './file.js' or its corresponding type declarations. - main.ts(2,18): error TS2307: Cannot find module './file.jsx' or its corresponding type declarations. - main.ts(3,18): error TS2307: Cannot find module './file.ts' or its corresponding type declarations. -@@= skipped -5, +6 lines =@@ - main.ts(6,18): error TS2307: Cannot find module './file.cjs' or its corresponding type declarations. - main.ts(7,18): error TS2307: Cannot find module './file.mts' or its corresponding type declarations. - main.ts(8,18): error TS2307: Cannot find module './file.cts' or its corresponding type declarations. --main.ts(9,18): error TS2307: Cannot find module './file.d.ts' or its corresponding type declarations. --main.ts(10,19): error TS2307: Cannot find module './file.d.cts' or its corresponding type declarations. --main.ts(11,19): error TS2307: Cannot find module './file.d.mts' or its corresponding type declarations. - main.ts(12,19): error TS2307: Cannot find module './file.d.json.ts' or its corresponding type declarations. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== package.json (0 errors) ==== - {"type": "module"} --==== main.ts (12 errors) ==== -+==== main.ts (9 errors) ==== - import def1 from "./file.js"; - ~~~~~~~~~~~ - !!! error TS2307: Cannot find module './file.js' or its corresponding type declarations. -@@= skipped -34, +32 lines =@@ - ~~~~~~~~~~~~ - !!! error TS2307: Cannot find module './file.cts' or its corresponding type declarations. - import def9 from "./file.d.ts"; -- ~~~~~~~~~~~~~ --!!! error TS2307: Cannot find module './file.d.ts' or its corresponding type declarations. - import def10 from "./file.d.cts"; -- ~~~~~~~~~~~~~~ --!!! error TS2307: Cannot find module './file.d.cts' or its corresponding type declarations. - import def11 from "./file.d.mts"; -- ~~~~~~~~~~~~~~ --!!! error TS2307: Cannot find module './file.d.mts' or its corresponding type declarations. - import def12 from "./file.d.json.ts"; - ~~~~~~~~~~~~~~~~~~ - !!! error TS2307: Cannot find module './file.d.json.ts' or its corresponding type declarations. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).js b/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).js index 5779a33d13..aec21f826c 100644 --- a/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).js @@ -53,5 +53,4 @@ declare var bad: "bad12"; export default bad; //// [main.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).js.diff deleted file mode 100644 index 4b55a9c97a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.declarationFileForTsJsImport(module=node20).js -+++ new.declarationFileForTsJsImport(module=node20).js -@@= skipped -52, +52 lines =@@ - export default bad; - - //// [main.js] --export {}; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).types b/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).types index 807edbddf6..f1d5204ee9 100644 --- a/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).types @@ -26,13 +26,13 @@ import def8 from "./file.cts"; >def8 : any import def9 from "./file.d.ts"; ->def9 : "bad3" +>def9 : any import def10 from "./file.d.cts"; ->def10 : "bad8" +>def10 : any import def11 from "./file.d.mts"; ->def11 : "bad7" +>def11 : any import def12 from "./file.d.json.ts"; >def12 : any diff --git a/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).types.diff b/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).types.diff deleted file mode 100644 index 3557d407d6..0000000000 --- a/testdata/baselines/reference/submodule/conformance/declarationFileForTsJsImport(module=node20).types.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.declarationFileForTsJsImport(module=node20).types -+++ new.declarationFileForTsJsImport(module=node20).types -@@= skipped -25, +25 lines =@@ - >def8 : any - - import def9 from "./file.d.ts"; -->def9 : any -+>def9 : "bad3" - - import def10 from "./file.d.cts"; -->def10 : any -+>def10 : "bad8" - - import def11 from "./file.d.mts"; -->def11 : any -+>def11 : "bad7" - - import def12 from "./file.d.json.ts"; - >def12 : any \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node20).errors.txt index 1a209608da..04c3dfd21d 100644 --- a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node20).errors.txt @@ -1,8 +1,6 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. main.ts(1,22): error TS6263: Module './dir/native.node' was resolved to 'dir/native.d.node.ts', but '--allowArbitraryExtensions' is not set. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== main.ts (1 errors) ==== import mod = require("./dir/native.node"); ~~~~~~~~~~~~~~~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node20).errors.txt.diff deleted file mode 100644 index 393c0f3dc9..0000000000 --- a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node20).errors.txt.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node20).errors.txt -+++ new.declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - main.ts(1,22): error TS6263: Module './dir/native.node' was resolved to 'dir/native.d.node.ts', but '--allowArbitraryExtensions' is not set. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== main.ts (1 errors) ==== - import mod = require("./dir/native.node"); - ~~~~~~~~~~~~~~~~~~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node20).js b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node20).js index 78bf96bca9..0db936c68b 100644 --- a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node20).js @@ -12,7 +12,7 @@ mod.doNativeThing("good"); //// [main.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const mod = require("./dir/native.node"); +import { createRequire as _createRequire } from "module"; +const __require = _createRequire(import.meta.url); +const mod = __require("./dir/native.node"); mod.doNativeThing("good"); diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node20).js.diff deleted file mode 100644 index 7ce93acc7e..0000000000 --- a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node20).js.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- old.declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node20).js -+++ new.declarationFilesForNodeNativeModules(allowarbitraryextensions=false,module=node20).js -@@= skipped -11, +11 lines =@@ - - - //// [main.js] --import { createRequire as _createRequire } from "module"; --const __require = _createRequire(import.meta.url); --const mod = __require("./dir/native.node"); -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+const mod = require("./dir/native.node"); - mod.doNativeThing("good"); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=true,module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=true,module=node20).errors.txt deleted file mode 100644 index 3a719b8b37..0000000000 --- a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=true,module=node20).errors.txt +++ /dev/null @@ -1,14 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== main.ts (0 errors) ==== - import mod = require("./dir/native.node"); - mod.doNativeThing("good"); - -==== package.json (0 errors) ==== - {"type": "module"} -==== dir/package.json (0 errors) ==== - {"type": "commonjs"} -==== dir/native.d.node.ts (0 errors) ==== - export function doNativeThing(flag: string): unknown; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=true,module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=true,module=node20).errors.txt.diff deleted file mode 100644 index 7bfa0ba3ae..0000000000 --- a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=true,module=node20).errors.txt.diff +++ /dev/null @@ -1,18 +0,0 @@ ---- old.declarationFilesForNodeNativeModules(allowarbitraryextensions=true,module=node20).errors.txt -+++ new.declarationFilesForNodeNativeModules(allowarbitraryextensions=true,module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== main.ts (0 errors) ==== -+ import mod = require("./dir/native.node"); -+ mod.doNativeThing("good"); -+ -+==== package.json (0 errors) ==== -+ {"type": "module"} -+==== dir/package.json (0 errors) ==== -+ {"type": "commonjs"} -+==== dir/native.d.node.ts (0 errors) ==== -+ export function doNativeThing(flag: string): unknown; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=true,module=node20).js b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=true,module=node20).js index 78bf96bca9..0db936c68b 100644 --- a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=true,module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=true,module=node20).js @@ -12,7 +12,7 @@ mod.doNativeThing("good"); //// [main.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const mod = require("./dir/native.node"); +import { createRequire as _createRequire } from "module"; +const __require = _createRequire(import.meta.url); +const mod = __require("./dir/native.node"); mod.doNativeThing("good"); diff --git a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=true,module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=true,module=node20).js.diff deleted file mode 100644 index ef6b0c6174..0000000000 --- a/testdata/baselines/reference/submodule/conformance/declarationFilesForNodeNativeModules(allowarbitraryextensions=true,module=node20).js.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- old.declarationFilesForNodeNativeModules(allowarbitraryextensions=true,module=node20).js -+++ new.declarationFilesForNodeNativeModules(allowarbitraryextensions=true,module=node20).js -@@= skipped -11, +11 lines =@@ - - - //// [main.js] --import { createRequire as _createRequire } from "module"; --const __require = _createRequire(import.meta.url); --const mod = __require("./dir/native.node"); -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+const mod = require("./dir/native.node"); - mod.doNativeThing("good"); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/esmModuleExports1.errors.txt b/testdata/baselines/reference/submodule/conformance/esmModuleExports1.errors.txt index f61aed64bc..b16dc4624a 100644 --- a/testdata/baselines/reference/submodule/conformance/esmModuleExports1.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/esmModuleExports1.errors.txt @@ -1,36 +1,19 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -/importer-cjs.cjs(2,5): error TS2351: This expression is not constructable. - Type 'typeof import("/exporter")' has no construct signatures. -/importer-cts.cts(2,5): error TS2351: This expression is not constructable. - Type 'typeof import("/exporter")' has no construct signatures. -/importer-cts.cts(8,5): error TS2351: This expression is not constructable. - Type 'typeof import("/exporter")' has no construct signatures. /importer-cts.cts(10,10): error TS2614: Module '"./exporter.mjs"' has no exported member 'Oops'. Did you mean to use 'import Oops from "./exporter.mjs"' instead? -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== /importer-cjs.cjs (1 errors) ==== +==== /importer-cjs.cjs (0 errors) ==== const Foo = require("./exporter.mjs"); new Foo(); - ~~~ -!!! error TS2351: This expression is not constructable. -!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. -==== /importer-cts.cts (3 errors) ==== +==== /importer-cts.cts (1 errors) ==== import Foo = require("./exporter.mjs"); new Foo(); - ~~~ -!!! error TS2351: This expression is not constructable. -!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. import Foo2 from "./exporter.mjs"; new Foo2(); import * as Foo3 from "./exporter.mjs"; new Foo3(); - ~~~~ -!!! error TS2351: This expression is not constructable. -!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. import { Oops } from "./exporter.mjs"; ~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/esmModuleExports1.symbols b/testdata/baselines/reference/submodule/conformance/esmModuleExports1.symbols index 2b49c03843..402ceeeb08 100644 --- a/testdata/baselines/reference/submodule/conformance/esmModuleExports1.symbols +++ b/testdata/baselines/reference/submodule/conformance/esmModuleExports1.symbols @@ -4,7 +4,7 @@ const Foo = require("./exporter.mjs"); >Foo : Symbol(Foo, Decl(importer-cjs.cjs, 0, 5)) >require : Symbol(require) ->"./exporter.mjs" : Symbol(Foo, Decl(exporter.mts, 0, 0)) +>"./exporter.mjs" : Symbol("/exporter", Decl(exporter.mts, 0, 0)) new Foo(); >Foo : Symbol(Foo, Decl(importer-cjs.cjs, 0, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/esmModuleExports1.symbols.diff b/testdata/baselines/reference/submodule/conformance/esmModuleExports1.symbols.diff deleted file mode 100644 index ce0bb9924b..0000000000 --- a/testdata/baselines/reference/submodule/conformance/esmModuleExports1.symbols.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.esmModuleExports1.symbols -+++ new.esmModuleExports1.symbols -@@= skipped -3, +3 lines =@@ - const Foo = require("./exporter.mjs"); - >Foo : Symbol(Foo, Decl(importer-cjs.cjs, 0, 5)) - >require : Symbol(require) -->"./exporter.mjs" : Symbol("/exporter", Decl(exporter.mts, 0, 0)) -+>"./exporter.mjs" : Symbol(Foo, Decl(exporter.mts, 0, 0)) - - new Foo(); - >Foo : Symbol(Foo, Decl(importer-cjs.cjs, 0, 5)) \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/esmModuleExports1.types b/testdata/baselines/reference/submodule/conformance/esmModuleExports1.types index 8818f3609f..007d52ac90 100644 --- a/testdata/baselines/reference/submodule/conformance/esmModuleExports1.types +++ b/testdata/baselines/reference/submodule/conformance/esmModuleExports1.types @@ -3,12 +3,12 @@ === /importer-cjs.cjs === const Foo = require("./exporter.mjs"); >Foo : typeof Foo ->require("./exporter.mjs") : typeof Foo +>require("./exporter.mjs") : typeof import("/exporter", { with: { "resolution-mode": "import" } }) >require : any >"./exporter.mjs" : "./exporter.mjs" new Foo(); ->new Foo() : any +>new Foo() : Foo >Foo : typeof Foo === /importer-cts.cts === @@ -16,21 +16,21 @@ import Foo = require("./exporter.mjs"); >Foo : typeof Foo new Foo(); ->new Foo() : any +>new Foo() : Foo >Foo : typeof Foo import Foo2 from "./exporter.mjs"; ->Foo2 : typeof Foo2 +>Foo2 : typeof Foo new Foo2(); ->new Foo2() : Foo2 ->Foo2 : typeof Foo2 +>new Foo2() : Foo +>Foo2 : typeof Foo import * as Foo3 from "./exporter.mjs"; >Foo3 : typeof Foo new Foo3(); ->new Foo3() : any +>new Foo3() : Foo >Foo3 : typeof Foo import { Oops } from "./exporter.mjs"; diff --git a/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=false).errors.txt b/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=false).errors.txt index b1c323c94e..ad250e2728 100644 --- a/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=false).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=false).errors.txt @@ -1,36 +1,37 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. /importer-cjs.cjs(2,5): error TS2351: This expression is not constructable. - Type 'typeof import("/exporter")' has no construct signatures. + Type 'String' has no construct signatures. /importer-cts.cts(2,5): error TS2351: This expression is not constructable. - Type 'typeof import("/exporter")' has no construct signatures. + Type 'String' has no construct signatures. +/importer-cts.cts(4,8): error TS1259: Module '"/exporter"' can only be default-imported using the 'esModuleInterop' flag /importer-cts.cts(8,5): error TS2351: This expression is not constructable. - Type 'typeof import("/exporter")' has no construct signatures. + Type 'String' has no construct signatures. /importer-cts.cts(10,10): error TS2614: Module '"./exporter.mjs"' has no exported member 'Oops'. Did you mean to use 'import Oops from "./exporter.mjs"' instead? -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /importer-cjs.cjs (1 errors) ==== const Foo = require("./exporter.mjs"); new Foo(); ~~~ !!! error TS2351: This expression is not constructable. -!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. +!!! error TS2351: Type 'String' has no construct signatures. -==== /importer-cts.cts (3 errors) ==== +==== /importer-cts.cts (4 errors) ==== import Foo = require("./exporter.mjs"); new Foo(); ~~~ !!! error TS2351: This expression is not constructable. -!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. +!!! error TS2351: Type 'String' has no construct signatures. import Foo2 from "./exporter.mjs"; + ~~~~ +!!! error TS1259: Module '"/exporter"' can only be default-imported using the 'esModuleInterop' flag new Foo2(); import * as Foo3 from "./exporter.mjs"; new Foo3(); ~~~~ !!! error TS2351: This expression is not constructable. -!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. +!!! error TS2351: Type 'String' has no construct signatures. import { Oops } from "./exporter.mjs"; ~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=false).symbols b/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=false).symbols index 2652cf9cbb..4bb8d4d0df 100644 --- a/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=false).symbols +++ b/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=false).symbols @@ -4,7 +4,7 @@ const Foo = require("./exporter.mjs"); >Foo : Symbol(Foo, Decl(importer-cjs.cjs, 0, 5)) >require : Symbol(require) ->"./exporter.mjs" : Symbol(Foo, Decl(exporter.mts, 0, 0)) +>"./exporter.mjs" : Symbol("/exporter", Decl(exporter.mts, 0, 0)) new Foo(); >Foo : Symbol(Foo, Decl(importer-cjs.cjs, 0, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=false).symbols.diff b/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=false).symbols.diff deleted file mode 100644 index 226ecc2f1f..0000000000 --- a/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=false).symbols.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.esmModuleExports2(esmoduleinterop=false).symbols -+++ new.esmModuleExports2(esmoduleinterop=false).symbols -@@= skipped -3, +3 lines =@@ - const Foo = require("./exporter.mjs"); - >Foo : Symbol(Foo, Decl(importer-cjs.cjs, 0, 5)) - >require : Symbol(require) -->"./exporter.mjs" : Symbol("/exporter", Decl(exporter.mts, 0, 0)) -+>"./exporter.mjs" : Symbol(Foo, Decl(exporter.mts, 0, 0)) - - new Foo(); - >Foo : Symbol(Foo, Decl(importer-cjs.cjs, 0, 5)) \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=false).types b/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=false).types index 56872a9d26..6db56832f2 100644 --- a/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=false).types +++ b/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=false).types @@ -2,36 +2,36 @@ === /importer-cjs.cjs === const Foo = require("./exporter.mjs"); ->Foo : typeof Foo ->require("./exporter.mjs") : typeof Foo +>Foo : "oops" +>require("./exporter.mjs") : typeof import("/exporter", { with: { "resolution-mode": "import" } }) >require : any >"./exporter.mjs" : "./exporter.mjs" new Foo(); >new Foo() : any ->Foo : typeof Foo +>Foo : "oops" === /importer-cts.cts === import Foo = require("./exporter.mjs"); ->Foo : typeof Foo +>Foo : "oops" new Foo(); >new Foo() : any ->Foo : typeof Foo +>Foo : "oops" import Foo2 from "./exporter.mjs"; ->Foo2 : typeof Foo2 +>Foo2 : any new Foo2(); ->new Foo2() : Foo2 ->Foo2 : typeof Foo2 +>new Foo2() : any +>Foo2 : any import * as Foo3 from "./exporter.mjs"; ->Foo3 : typeof Foo +>Foo3 : "oops" new Foo3(); >new Foo3() : any ->Foo3 : typeof Foo +>Foo3 : "oops" import { Oops } from "./exporter.mjs"; >Oops : any diff --git a/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=true).errors.txt b/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=true).errors.txt index b1c323c94e..a31f9bf4c2 100644 --- a/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=true).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=true).errors.txt @@ -1,36 +1,39 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. /importer-cjs.cjs(2,5): error TS2351: This expression is not constructable. - Type 'typeof import("/exporter")' has no construct signatures. + Type 'String' has no construct signatures. /importer-cts.cts(2,5): error TS2351: This expression is not constructable. - Type 'typeof import("/exporter")' has no construct signatures. + Type 'String' has no construct signatures. +/importer-cts.cts(5,5): error TS2351: This expression is not constructable. + Type 'String' has no construct signatures. /importer-cts.cts(8,5): error TS2351: This expression is not constructable. - Type 'typeof import("/exporter")' has no construct signatures. + Type 'String' has no construct signatures. /importer-cts.cts(10,10): error TS2614: Module '"./exporter.mjs"' has no exported member 'Oops'. Did you mean to use 'import Oops from "./exporter.mjs"' instead? -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /importer-cjs.cjs (1 errors) ==== const Foo = require("./exporter.mjs"); new Foo(); ~~~ !!! error TS2351: This expression is not constructable. -!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. +!!! error TS2351: Type 'String' has no construct signatures. -==== /importer-cts.cts (3 errors) ==== +==== /importer-cts.cts (4 errors) ==== import Foo = require("./exporter.mjs"); new Foo(); ~~~ !!! error TS2351: This expression is not constructable. -!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. +!!! error TS2351: Type 'String' has no construct signatures. import Foo2 from "./exporter.mjs"; new Foo2(); + ~~~~ +!!! error TS2351: This expression is not constructable. +!!! error TS2351: Type 'String' has no construct signatures. import * as Foo3 from "./exporter.mjs"; new Foo3(); ~~~~ !!! error TS2351: This expression is not constructable. -!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. +!!! error TS2351: Type 'String' has no construct signatures. import { Oops } from "./exporter.mjs"; ~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=true).symbols b/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=true).symbols index 2652cf9cbb..4bb8d4d0df 100644 --- a/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=true).symbols +++ b/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=true).symbols @@ -4,7 +4,7 @@ const Foo = require("./exporter.mjs"); >Foo : Symbol(Foo, Decl(importer-cjs.cjs, 0, 5)) >require : Symbol(require) ->"./exporter.mjs" : Symbol(Foo, Decl(exporter.mts, 0, 0)) +>"./exporter.mjs" : Symbol("/exporter", Decl(exporter.mts, 0, 0)) new Foo(); >Foo : Symbol(Foo, Decl(importer-cjs.cjs, 0, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=true).symbols.diff b/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=true).symbols.diff deleted file mode 100644 index 04e49de5bf..0000000000 --- a/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=true).symbols.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.esmModuleExports2(esmoduleinterop=true).symbols -+++ new.esmModuleExports2(esmoduleinterop=true).symbols -@@= skipped -3, +3 lines =@@ - const Foo = require("./exporter.mjs"); - >Foo : Symbol(Foo, Decl(importer-cjs.cjs, 0, 5)) - >require : Symbol(require) -->"./exporter.mjs" : Symbol("/exporter", Decl(exporter.mts, 0, 0)) -+>"./exporter.mjs" : Symbol(Foo, Decl(exporter.mts, 0, 0)) - - new Foo(); - >Foo : Symbol(Foo, Decl(importer-cjs.cjs, 0, 5)) \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=true).types b/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=true).types index 56872a9d26..3fcbf77e4c 100644 --- a/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=true).types +++ b/testdata/baselines/reference/submodule/conformance/esmModuleExports2(esmoduleinterop=true).types @@ -2,36 +2,36 @@ === /importer-cjs.cjs === const Foo = require("./exporter.mjs"); ->Foo : typeof Foo ->require("./exporter.mjs") : typeof Foo +>Foo : "oops" +>require("./exporter.mjs") : typeof import("/exporter", { with: { "resolution-mode": "import" } }) >require : any >"./exporter.mjs" : "./exporter.mjs" new Foo(); >new Foo() : any ->Foo : typeof Foo +>Foo : "oops" === /importer-cts.cts === import Foo = require("./exporter.mjs"); ->Foo : typeof Foo +>Foo : "oops" new Foo(); >new Foo() : any ->Foo : typeof Foo +>Foo : "oops" import Foo2 from "./exporter.mjs"; ->Foo2 : typeof Foo2 +>Foo2 : "oops" new Foo2(); ->new Foo2() : Foo2 ->Foo2 : typeof Foo2 +>new Foo2() : any +>Foo2 : "oops" import * as Foo3 from "./exporter.mjs"; ->Foo3 : typeof Foo +>Foo3 : "oops" new Foo3(); >new Foo3() : any ->Foo3 : typeof Foo +>Foo3 : "oops" import { Oops } from "./exporter.mjs"; >Oops : any diff --git a/testdata/baselines/reference/submodule/conformance/esmModuleExports3.errors.txt b/testdata/baselines/reference/submodule/conformance/esmModuleExports3.errors.txt index 0d0eed7c81..c55cdee708 100644 --- a/testdata/baselines/reference/submodule/conformance/esmModuleExports3.errors.txt +++ b/testdata/baselines/reference/submodule/conformance/esmModuleExports3.errors.txt @@ -1,36 +1,35 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -/importer-cjs.cjs(2,5): error TS2351: This expression is not constructable. - Type 'typeof import("/exporter")' has no construct signatures. -/importer-cts.cts(2,5): error TS2351: This expression is not constructable. - Type 'typeof import("/exporter")' has no construct signatures. -/importer-cts.cts(8,5): error TS2351: This expression is not constructable. - Type 'typeof import("/exporter")' has no construct signatures. +/importer-cjs.cjs(2,5): error TS1362: 'Foo' cannot be used as a value because it was exported using 'export type'. +/importer-cts.cts(2,5): error TS1362: 'Foo' cannot be used as a value because it was exported using 'export type'. +/importer-cts.cts(5,5): error TS1362: 'Foo2' cannot be used as a value because it was exported using 'export type'. +/importer-cts.cts(8,5): error TS1362: 'Foo3' cannot be used as a value because it was exported using 'export type'. /importer-cts.cts(10,10): error TS2614: Module '"./exporter.mjs"' has no exported member 'Oops'. Did you mean to use 'import Oops from "./exporter.mjs"' instead? -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /importer-cjs.cjs (1 errors) ==== const Foo = require("./exporter.mjs"); new Foo(); ~~~ -!!! error TS2351: This expression is not constructable. -!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. +!!! error TS1362: 'Foo' cannot be used as a value because it was exported using 'export type'. +!!! related TS1377 /exporter.mts:2:15: 'Foo' was exported here. -==== /importer-cts.cts (3 errors) ==== +==== /importer-cts.cts (4 errors) ==== import Foo = require("./exporter.mjs"); new Foo(); ~~~ -!!! error TS2351: This expression is not constructable. -!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. +!!! error TS1362: 'Foo' cannot be used as a value because it was exported using 'export type'. +!!! related TS1377 /exporter.mts:2:15: 'Foo' was exported here. import Foo2 from "./exporter.mjs"; new Foo2(); + ~~~~ +!!! error TS1362: 'Foo2' cannot be used as a value because it was exported using 'export type'. +!!! related TS1377 /exporter.mts:2:15: 'Foo2' was exported here. import * as Foo3 from "./exporter.mjs"; new Foo3(); ~~~~ -!!! error TS2351: This expression is not constructable. -!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. +!!! error TS1362: 'Foo3' cannot be used as a value because it was exported using 'export type'. +!!! related TS1377 /exporter.mts:2:15: 'Foo3' was exported here. import { Oops } from "./exporter.mjs"; ~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/esmModuleExports3.symbols b/testdata/baselines/reference/submodule/conformance/esmModuleExports3.symbols index e2ee170563..e23df06c87 100644 --- a/testdata/baselines/reference/submodule/conformance/esmModuleExports3.symbols +++ b/testdata/baselines/reference/submodule/conformance/esmModuleExports3.symbols @@ -4,7 +4,7 @@ const Foo = require("./exporter.mjs"); >Foo : Symbol(Foo, Decl(importer-cjs.cjs, 0, 5)) >require : Symbol(require) ->"./exporter.mjs" : Symbol(Foo, Decl(exporter.mts, 0, 0)) +>"./exporter.mjs" : Symbol("/exporter", Decl(exporter.mts, 0, 0)) new Foo(); >Foo : Symbol(Foo, Decl(importer-cjs.cjs, 0, 5)) diff --git a/testdata/baselines/reference/submodule/conformance/esmModuleExports3.symbols.diff b/testdata/baselines/reference/submodule/conformance/esmModuleExports3.symbols.diff deleted file mode 100644 index bc4988cf0c..0000000000 --- a/testdata/baselines/reference/submodule/conformance/esmModuleExports3.symbols.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.esmModuleExports3.symbols -+++ new.esmModuleExports3.symbols -@@= skipped -3, +3 lines =@@ - const Foo = require("./exporter.mjs"); - >Foo : Symbol(Foo, Decl(importer-cjs.cjs, 0, 5)) - >require : Symbol(require) -->"./exporter.mjs" : Symbol("/exporter", Decl(exporter.mts, 0, 0)) -+>"./exporter.mjs" : Symbol(Foo, Decl(exporter.mts, 0, 0)) - - new Foo(); - >Foo : Symbol(Foo, Decl(importer-cjs.cjs, 0, 5)) \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/esmModuleExports3.types b/testdata/baselines/reference/submodule/conformance/esmModuleExports3.types index 5951c3d09b..4f8612315e 100644 --- a/testdata/baselines/reference/submodule/conformance/esmModuleExports3.types +++ b/testdata/baselines/reference/submodule/conformance/esmModuleExports3.types @@ -3,12 +3,12 @@ === /importer-cjs.cjs === const Foo = require("./exporter.mjs"); >Foo : typeof Foo ->require("./exporter.mjs") : typeof Foo +>require("./exporter.mjs") : typeof import("/exporter", { with: { "resolution-mode": "import" } }) >require : any >"./exporter.mjs" : "./exporter.mjs" new Foo(); ->new Foo() : any +>new Foo() : Foo >Foo : typeof Foo === /importer-cts.cts === @@ -16,21 +16,21 @@ import Foo = require("./exporter.mjs"); >Foo : typeof Foo new Foo(); ->new Foo() : any +>new Foo() : Foo >Foo : typeof Foo import Foo2 from "./exporter.mjs"; ->Foo2 : typeof Foo2 +>Foo2 : typeof Foo new Foo2(); ->new Foo2() : Foo2 ->Foo2 : typeof Foo2 +>new Foo2() : Foo +>Foo2 : typeof Foo import * as Foo3 from "./exporter.mjs"; >Foo3 : typeof Foo new Foo3(); ->new Foo3() : any +>new Foo3() : Foo >Foo3 : typeof Foo import { Oops } from "./exporter.mjs"; diff --git a/testdata/baselines/reference/submodule/conformance/importAttributes6(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/importAttributes6(module=node20).errors.txt index c917d3f6c1..f2f160a4bd 100644 --- a/testdata/baselines/reference/submodule/conformance/importAttributes6(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/importAttributes6(module=node20).errors.txt @@ -1,4 +1,3 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. mod.mts(1,37): error TS2322: Type '{ field: 0; }' is not assignable to type 'ImportAttributes'. Property 'field' is incompatible with index signature. Type 'number' is not assignable to type 'string'. @@ -19,7 +18,6 @@ mod.mts(5,51): error TS2858: Import attribute values must be string literal expr mod.mts(6,65): error TS2858: Import attribute values must be string literal expressions. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== mod.mts (10 errors) ==== import * as thing1 from "./mod.mjs" with { field: 0 }; ~~~~~~~~~~~~~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/importAttributes6(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/importAttributes6(module=node20).errors.txt.diff deleted file mode 100644 index 84bd4c50e8..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importAttributes6(module=node20).errors.txt.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.importAttributes6(module=node20).errors.txt -+++ new.importAttributes6(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - mod.mts(1,37): error TS2322: Type '{ field: 0; }' is not assignable to type 'ImportAttributes'. - Property 'field' is incompatible with index signature. - Type 'number' is not assignable to type 'string'. -@@= skipped -17, +18 lines =@@ - mod.mts(6,65): error TS2858: Import attribute values must be string literal expressions. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== mod.mts (10 errors) ==== - import * as thing1 from "./mod.mjs" with { field: 0 }; - ~~~~~~~~~~~~~~~~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/importAttributes6(module=node20).js b/testdata/baselines/reference/submodule/conformance/importAttributes6(module=node20).js index e12f467618..6d346c55c8 100644 --- a/testdata/baselines/reference/submodule/conformance/importAttributes6(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/importAttributes6(module=node20).js @@ -10,5 +10,4 @@ import * as thing6 from "./mod.mjs" with { type: "json", field: 0..toString() }; //// [mod.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/importAttributes6(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/importAttributes6(module=node20).js.diff deleted file mode 100644 index a8b3923a29..0000000000 --- a/testdata/baselines/reference/submodule/conformance/importAttributes6(module=node20).js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.importAttributes6(module=node20).js -+++ new.importAttributes6(module=node20).js -@@= skipped -9, +9 lines =@@ - - - //// [mod.mjs] --export {}; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension3(module=node20).js b/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension3(module=node20).js index 06f320fa23..3b4e816e48 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension3(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension3(module=node20).js @@ -18,5 +18,4 @@ function foo() { return ""; } //// [bar.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension3(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension3(module=node20).js.diff deleted file mode 100644 index e729492b37..0000000000 --- a/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension3(module=node20).js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.moduleResolutionWithoutExtension3(module=node20).js -+++ new.moduleResolutionWithoutExtension3(module=node20).js -@@= skipped -17, +17 lines =@@ - return ""; - } - //// [bar.mjs] --export {}; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension4(module=node20).js b/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension4(module=node20).js index 698f97a9cf..9fe42ebd8f 100644 --- a/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension4(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension4(module=node20).js @@ -18,5 +18,4 @@ function foo() { return ""; } //// [bar.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension4(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension4(module=node20).js.diff deleted file mode 100644 index 5314e4fd27..0000000000 --- a/testdata/baselines/reference/submodule/conformance/moduleResolutionWithoutExtension4(module=node20).js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.moduleResolutionWithoutExtension4(module=node20).js -+++ new.moduleResolutionWithoutExtension4(module=node20).js -@@= skipped -17, +17 lines =@@ - return ""; - } - //// [bar.mjs] --export {}; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeAllowJsPackageSelfName(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeAllowJsPackageSelfName(module=node20).errors.txt index dfb944408b..4454c8d1b0 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeAllowJsPackageSelfName(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeAllowJsPackageSelfName(module=node20).errors.txt @@ -1,11 +1,9 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. index.cjs(2,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. index.js(2,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. index.mjs(2,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. ==== index.js (1 errors) ==== // esm format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeAllowJsPackageSelfName(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeAllowJsPackageSelfName(module=node20).js index b7f552a39e..1498e98d79 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeAllowJsPackageSelfName(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeAllowJsPackageSelfName(module=node20).js @@ -21,22 +21,51 @@ self; } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const self = require("package"); +import * as self from "package"; self; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const self = require("package"); +import * as self from "package"; self; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const self = require("package"); +const self = __importStar(require("package")); self; diff --git a/testdata/baselines/reference/submodule/conformance/nodeAllowJsPackageSelfName(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeAllowJsPackageSelfName(module=node20).js.diff deleted file mode 100644 index 3c3d728697..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeAllowJsPackageSelfName(module=node20).js.diff +++ /dev/null @@ -1,60 +0,0 @@ ---- old.nodeAllowJsPackageSelfName(module=node20).js -+++ new.nodeAllowJsPackageSelfName(module=node20).js -@@= skipped -20, +20 lines =@@ - } - - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as self from "package"; -+const self = require("package"); - self; - //// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as self from "package"; -+const self = require("package"); - self; - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --const self = __importStar(require("package")); -+const self = require("package"); - self; - diff --git a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node16).types index bcf4d98022..c711491553 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node16).types @@ -252,22 +252,22 @@ import m25 = require("./index"); >m25 : typeof m1 import m26 = require("./subfolder"); ->m26 : typeof m4 +>m26 : typeof m26 import m27 = require("./subfolder/"); ->m27 : typeof m4 +>m27 : typeof m26 import m28 = require("./subfolder/index"); ->m28 : typeof m4 +>m28 : typeof m26 import m29 = require("./subfolder2"); ->m29 : typeof m7 +>m29 : typeof m29 import m30 = require("./subfolder2/"); ->m30 : typeof m7 +>m30 : typeof m29 import m31 = require("./subfolder2/index"); ->m31 : typeof m7 +>m31 : typeof m29 import m32 = require("./subfolder2/another"); >m32 : typeof m10 @@ -288,27 +288,27 @@ void m25; void m26; >void m26 : undefined ->m26 : typeof m4 +>m26 : typeof m26 void m27; >void m27 : undefined ->m27 : typeof m4 +>m27 : typeof m26 void m28; >void m28 : undefined ->m28 : typeof m4 +>m28 : typeof m26 void m29; >void m29 : undefined ->m29 : typeof m7 +>m29 : typeof m29 void m30; >void m30 : undefined ->m30 : typeof m7 +>m30 : typeof m29 void m31; >void m31 : undefined ->m31 : typeof m7 +>m31 : typeof m29 void m32; >void m32 : undefined @@ -863,22 +863,22 @@ import m25 = require("./index"); >m25 : typeof m1 import m26 = require("./subfolder"); ->m26 : typeof m4 +>m26 : typeof m26 import m27 = require("./subfolder/"); ->m27 : typeof m4 +>m27 : typeof m26 import m28 = require("./subfolder/index"); ->m28 : typeof m4 +>m28 : typeof m26 import m29 = require("./subfolder2"); ->m29 : typeof m7 +>m29 : typeof m29 import m30 = require("./subfolder2/"); ->m30 : typeof m7 +>m30 : typeof m29 import m31 = require("./subfolder2/index"); ->m31 : typeof m7 +>m31 : typeof m29 import m32 = require("./subfolder2/another"); >m32 : typeof m10 @@ -899,27 +899,27 @@ void m25; void m26; >void m26 : undefined ->m26 : typeof m4 +>m26 : typeof m26 void m27; >void m27 : undefined ->m27 : typeof m4 +>m27 : typeof m26 void m28; >void m28 : undefined ->m28 : typeof m4 +>m28 : typeof m26 void m29; >void m29 : undefined ->m29 : typeof m7 +>m29 : typeof m29 void m30; >void m30 : undefined ->m30 : typeof m7 +>m30 : typeof m29 void m31; >void m31 : undefined ->m31 : typeof m7 +>m31 : typeof m29 void m32; >void m32 : undefined diff --git a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node16).types.diff deleted file mode 100644 index ee176e3953..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node16).types.diff +++ /dev/null @@ -1,128 +0,0 @@ ---- old.nodeModules1(module=node16).types -+++ new.nodeModules1(module=node16).types -@@= skipped -251, +251 lines =@@ - >m25 : typeof m1 - - import m26 = require("./subfolder"); -->m26 : typeof m26 -+>m26 : typeof m4 - - import m27 = require("./subfolder/"); -->m27 : typeof m26 -+>m27 : typeof m4 - - import m28 = require("./subfolder/index"); -->m28 : typeof m26 -+>m28 : typeof m4 - - import m29 = require("./subfolder2"); -->m29 : typeof m29 -+>m29 : typeof m7 - - import m30 = require("./subfolder2/"); -->m30 : typeof m29 -+>m30 : typeof m7 - - import m31 = require("./subfolder2/index"); -->m31 : typeof m29 -+>m31 : typeof m7 - - import m32 = require("./subfolder2/another"); - >m32 : typeof m10 -@@= skipped -36, +36 lines =@@ - - void m26; - >void m26 : undefined -->m26 : typeof m26 -+>m26 : typeof m4 - - void m27; - >void m27 : undefined -->m27 : typeof m26 -+>m27 : typeof m4 - - void m28; - >void m28 : undefined -->m28 : typeof m26 -+>m28 : typeof m4 - - void m29; - >void m29 : undefined -->m29 : typeof m29 -+>m29 : typeof m7 - - void m30; - >void m30 : undefined -->m30 : typeof m29 -+>m30 : typeof m7 - - void m31; - >void m31 : undefined -->m31 : typeof m29 -+>m31 : typeof m7 - - void m32; - >void m32 : undefined -@@= skipped -575, +575 lines =@@ - >m25 : typeof m1 - - import m26 = require("./subfolder"); -->m26 : typeof m26 -+>m26 : typeof m4 - - import m27 = require("./subfolder/"); -->m27 : typeof m26 -+>m27 : typeof m4 - - import m28 = require("./subfolder/index"); -->m28 : typeof m26 -+>m28 : typeof m4 - - import m29 = require("./subfolder2"); -->m29 : typeof m29 -+>m29 : typeof m7 - - import m30 = require("./subfolder2/"); -->m30 : typeof m29 -+>m30 : typeof m7 - - import m31 = require("./subfolder2/index"); -->m31 : typeof m29 -+>m31 : typeof m7 - - import m32 = require("./subfolder2/another"); - >m32 : typeof m10 -@@= skipped -36, +36 lines =@@ - - void m26; - >void m26 : undefined -->m26 : typeof m26 -+>m26 : typeof m4 - - void m27; - >void m27 : undefined -->m27 : typeof m26 -+>m27 : typeof m4 - - void m28; - >void m28 : undefined -->m28 : typeof m26 -+>m28 : typeof m4 - - void m29; - >void m29 : undefined -->m29 : typeof m29 -+>m29 : typeof m7 - - void m30; - >void m30 : undefined -->m30 : typeof m29 -+>m30 : typeof m7 - - void m31; - >void m31 : undefined -->m31 : typeof m29 -+>m31 : typeof m7 - - void m32; - >void m32 : undefined \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node18).types index bcf4d98022..c711491553 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node18).types @@ -252,22 +252,22 @@ import m25 = require("./index"); >m25 : typeof m1 import m26 = require("./subfolder"); ->m26 : typeof m4 +>m26 : typeof m26 import m27 = require("./subfolder/"); ->m27 : typeof m4 +>m27 : typeof m26 import m28 = require("./subfolder/index"); ->m28 : typeof m4 +>m28 : typeof m26 import m29 = require("./subfolder2"); ->m29 : typeof m7 +>m29 : typeof m29 import m30 = require("./subfolder2/"); ->m30 : typeof m7 +>m30 : typeof m29 import m31 = require("./subfolder2/index"); ->m31 : typeof m7 +>m31 : typeof m29 import m32 = require("./subfolder2/another"); >m32 : typeof m10 @@ -288,27 +288,27 @@ void m25; void m26; >void m26 : undefined ->m26 : typeof m4 +>m26 : typeof m26 void m27; >void m27 : undefined ->m27 : typeof m4 +>m27 : typeof m26 void m28; >void m28 : undefined ->m28 : typeof m4 +>m28 : typeof m26 void m29; >void m29 : undefined ->m29 : typeof m7 +>m29 : typeof m29 void m30; >void m30 : undefined ->m30 : typeof m7 +>m30 : typeof m29 void m31; >void m31 : undefined ->m31 : typeof m7 +>m31 : typeof m29 void m32; >void m32 : undefined @@ -863,22 +863,22 @@ import m25 = require("./index"); >m25 : typeof m1 import m26 = require("./subfolder"); ->m26 : typeof m4 +>m26 : typeof m26 import m27 = require("./subfolder/"); ->m27 : typeof m4 +>m27 : typeof m26 import m28 = require("./subfolder/index"); ->m28 : typeof m4 +>m28 : typeof m26 import m29 = require("./subfolder2"); ->m29 : typeof m7 +>m29 : typeof m29 import m30 = require("./subfolder2/"); ->m30 : typeof m7 +>m30 : typeof m29 import m31 = require("./subfolder2/index"); ->m31 : typeof m7 +>m31 : typeof m29 import m32 = require("./subfolder2/another"); >m32 : typeof m10 @@ -899,27 +899,27 @@ void m25; void m26; >void m26 : undefined ->m26 : typeof m4 +>m26 : typeof m26 void m27; >void m27 : undefined ->m27 : typeof m4 +>m27 : typeof m26 void m28; >void m28 : undefined ->m28 : typeof m4 +>m28 : typeof m26 void m29; >void m29 : undefined ->m29 : typeof m7 +>m29 : typeof m29 void m30; >void m30 : undefined ->m30 : typeof m7 +>m30 : typeof m29 void m31; >void m31 : undefined ->m31 : typeof m7 +>m31 : typeof m29 void m32; >void m32 : undefined diff --git a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node18).types.diff deleted file mode 100644 index 2d868cb3bd..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node18).types.diff +++ /dev/null @@ -1,128 +0,0 @@ ---- old.nodeModules1(module=node18).types -+++ new.nodeModules1(module=node18).types -@@= skipped -251, +251 lines =@@ - >m25 : typeof m1 - - import m26 = require("./subfolder"); -->m26 : typeof m26 -+>m26 : typeof m4 - - import m27 = require("./subfolder/"); -->m27 : typeof m26 -+>m27 : typeof m4 - - import m28 = require("./subfolder/index"); -->m28 : typeof m26 -+>m28 : typeof m4 - - import m29 = require("./subfolder2"); -->m29 : typeof m29 -+>m29 : typeof m7 - - import m30 = require("./subfolder2/"); -->m30 : typeof m29 -+>m30 : typeof m7 - - import m31 = require("./subfolder2/index"); -->m31 : typeof m29 -+>m31 : typeof m7 - - import m32 = require("./subfolder2/another"); - >m32 : typeof m10 -@@= skipped -36, +36 lines =@@ - - void m26; - >void m26 : undefined -->m26 : typeof m26 -+>m26 : typeof m4 - - void m27; - >void m27 : undefined -->m27 : typeof m26 -+>m27 : typeof m4 - - void m28; - >void m28 : undefined -->m28 : typeof m26 -+>m28 : typeof m4 - - void m29; - >void m29 : undefined -->m29 : typeof m29 -+>m29 : typeof m7 - - void m30; - >void m30 : undefined -->m30 : typeof m29 -+>m30 : typeof m7 - - void m31; - >void m31 : undefined -->m31 : typeof m29 -+>m31 : typeof m7 - - void m32; - >void m32 : undefined -@@= skipped -575, +575 lines =@@ - >m25 : typeof m1 - - import m26 = require("./subfolder"); -->m26 : typeof m26 -+>m26 : typeof m4 - - import m27 = require("./subfolder/"); -->m27 : typeof m26 -+>m27 : typeof m4 - - import m28 = require("./subfolder/index"); -->m28 : typeof m26 -+>m28 : typeof m4 - - import m29 = require("./subfolder2"); -->m29 : typeof m29 -+>m29 : typeof m7 - - import m30 = require("./subfolder2/"); -->m30 : typeof m29 -+>m30 : typeof m7 - - import m31 = require("./subfolder2/index"); -->m31 : typeof m29 -+>m31 : typeof m7 - - import m32 = require("./subfolder2/another"); - >m32 : typeof m10 -@@= skipped -36, +36 lines =@@ - - void m26; - >void m26 : undefined -->m26 : typeof m26 -+>m26 : typeof m4 - - void m27; - >void m27 : undefined -->m27 : typeof m26 -+>m27 : typeof m4 - - void m28; - >void m28 : undefined -->m28 : typeof m26 -+>m28 : typeof m4 - - void m29; - >void m29 : undefined -->m29 : typeof m29 -+>m29 : typeof m7 - - void m30; - >void m30 : undefined -->m30 : typeof m29 -+>m30 : typeof m7 - - void m31; - >void m31 : undefined -->m31 : typeof m29 -+>m31 : typeof m7 - - void m32; - >void m32 : undefined \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).errors.txt index 48acd287e6..52d56aff66 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).errors.txt @@ -1,42 +1,60 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2468: Cannot find global value 'Promise'. -index.cts(75,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cts(76,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cts(77,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cts(78,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cts(79,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cts(80,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cts(81,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cts(82,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cts(83,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cts(85,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mts(74,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mts(75,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mts(76,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mts(77,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mts(78,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mts(79,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mts(80,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mts(81,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mts(82,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mts(83,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.ts(74,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.ts(75,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.ts(76,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.ts(77,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.ts(78,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.ts(79,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.ts(80,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.ts(81,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.ts(82,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.ts(83,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.ts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +index.cts(75,21): error TS2307: Cannot find module './' or its corresponding type declarations. +index.cts(76,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? +index.cts(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cts(78,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cts(79,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? +index.cts(80,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cts(81,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cts(82,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +index.cts(83,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cts(84,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cts(85,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? +index.mts(14,22): error TS2307: Cannot find module './' or its corresponding type declarations. +index.mts(15,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? +index.mts(16,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mts(17,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mts(18,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? +index.mts(19,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mts(20,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mts(21,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +index.mts(22,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mts(23,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mts(24,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? +index.mts(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. +index.mts(75,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? +index.mts(76,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mts(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mts(78,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? +index.mts(79,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mts(80,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mts(81,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +index.mts(82,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mts(83,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mts(84,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? +index.ts(14,22): error TS2307: Cannot find module './' or its corresponding type declarations. +index.ts(15,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? +index.ts(16,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.ts(17,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.ts(18,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? +index.ts(19,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.ts(20,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.ts(21,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +index.ts(22,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.ts(23,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.ts(24,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? +index.ts(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. +index.ts(75,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? +index.ts(76,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.ts(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.ts(78,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? +index.ts(79,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.ts(80,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.ts(81,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +index.ts(82,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.ts(83,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.ts(84,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2468: Cannot find global value 'Promise'. ==== subfolder/index.ts (0 errors) ==== // cjs format file const x = 1; @@ -73,7 +91,7 @@ index.ts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promis // cjs format file const x = 1; export {x}; -==== index.mts (11 errors) ==== +==== index.mts (22 errors) ==== import * as m1 from "./index.js"; import * as m2 from "./index.mjs"; import * as m3 from "./index.cjs"; @@ -88,16 +106,38 @@ index.ts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promis import * as m12 from "./subfolder2/another/index.cjs"; // The next ones should all fail - esm format files have no index resolution or extension resolution import * as m13 from "./"; + ~~~~ +!!! error TS2307: Cannot find module './' or its corresponding type declarations. import * as m14 from "./index"; + ~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? import * as m15 from "./subfolder"; + ~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m16 from "./subfolder/"; + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m17 from "./subfolder/index"; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? import * as m18 from "./subfolder2"; + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m19 from "./subfolder2/"; + ~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m20 from "./subfolder2/index"; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? import * as m21 from "./subfolder2/another"; + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m22 from "./subfolder2/another/"; + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m23 from "./subfolder2/another/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? void m1; void m2; void m3; @@ -148,38 +188,38 @@ index.ts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promis // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); - ~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~ +!!! error TS2307: Cannot find module './' or its corresponding type declarations. const _m36 = import("./index"); - ~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? const _m37 = import("./subfolder"); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m38 = import("./subfolder/"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m39 = import("./subfolder/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? const _m40 = import("./subfolder2"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m41 = import("./subfolder2/"); - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m42 = import("./subfolder2/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? const _m43 = import("./subfolder2/another"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m44 = import("./subfolder2/another/"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m45 = import("./subfolder2/another/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? // esm format file const x = 1; @@ -260,42 +300,42 @@ index.ts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promis // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); - ~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~ +!!! error TS2307: Cannot find module './' or its corresponding type declarations. const _m36 = import("./index"); - ~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? const _m37 = import("./subfolder"); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m38 = import("./subfolder/"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m39 = import("./subfolder/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? const _m40 = import("./subfolder2"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m41 = import("./subfolder2/"); - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m42 = import("./subfolder2/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? const _m43 = import("./subfolder2/another"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m44 = import("./subfolder2/another/"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m45 = import("./subfolder2/another/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? // cjs format file const x = 1; export {x}; -==== index.ts (11 errors) ==== +==== index.ts (22 errors) ==== import * as m1 from "./index.js"; import * as m2 from "./index.mjs"; import * as m3 from "./index.cjs"; @@ -310,16 +350,38 @@ index.ts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promis import * as m12 from "./subfolder2/another/index.cjs"; // The next ones shouldn't all work - esm format files have no index resolution or extension resolution import * as m13 from "./"; + ~~~~ +!!! error TS2307: Cannot find module './' or its corresponding type declarations. import * as m14 from "./index"; + ~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? import * as m15 from "./subfolder"; + ~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m16 from "./subfolder/"; + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m17 from "./subfolder/index"; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? import * as m18 from "./subfolder2"; + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m19 from "./subfolder2/"; + ~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m20 from "./subfolder2/index"; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? import * as m21 from "./subfolder2/another"; + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m22 from "./subfolder2/another/"; + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m23 from "./subfolder2/another/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? void m1; void m2; void m3; @@ -370,38 +432,38 @@ index.ts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promis // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); - ~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~ +!!! error TS2307: Cannot find module './' or its corresponding type declarations. const _m36 = import("./index"); - ~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? const _m37 = import("./subfolder"); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m38 = import("./subfolder/"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m39 = import("./subfolder/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? const _m40 = import("./subfolder2"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m41 = import("./subfolder2/"); - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m42 = import("./subfolder2/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? const _m43 = import("./subfolder2/another"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m44 = import("./subfolder2/another/"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m45 = import("./subfolder2/another/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? // esm format file const x = 1; export {x}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).errors.txt.diff deleted file mode 100644 index 8ccc1ca488..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).errors.txt.diff +++ /dev/null @@ -1,377 +0,0 @@ ---- old.nodeModules1(module=node20).errors.txt -+++ new.nodeModules1(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ --index.cts(75,21): error TS2307: Cannot find module './' or its corresponding type declarations. --index.cts(76,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? --index.cts(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.cts(78,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.cts(79,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? --index.cts(80,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.cts(81,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.cts(82,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? --index.cts(83,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.cts(84,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.cts(85,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? --index.mts(14,22): error TS2307: Cannot find module './' or its corresponding type declarations. --index.mts(15,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? --index.mts(16,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mts(17,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mts(18,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? --index.mts(19,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mts(20,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mts(21,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? --index.mts(22,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mts(23,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mts(24,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? --index.mts(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. --index.mts(75,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? --index.mts(76,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mts(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mts(78,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? --index.mts(79,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mts(80,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mts(81,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? --index.mts(82,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mts(83,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mts(84,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? --index.ts(14,22): error TS2307: Cannot find module './' or its corresponding type declarations. --index.ts(15,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? --index.ts(16,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.ts(17,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.ts(18,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? --index.ts(19,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.ts(20,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.ts(21,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? --index.ts(22,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.ts(23,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.ts(24,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? --index.ts(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. --index.ts(75,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? --index.ts(76,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.ts(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.ts(78,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? --index.ts(79,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.ts(80,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.ts(81,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? --index.ts(82,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.ts(83,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.ts(84,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -- -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+error TS2468: Cannot find global value 'Promise'. -+index.cts(75,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cts(76,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cts(77,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cts(78,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cts(79,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cts(80,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cts(81,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cts(82,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cts(83,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cts(85,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mts(74,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mts(75,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mts(76,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mts(77,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mts(78,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mts(79,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mts(80,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mts(81,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mts(82,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mts(83,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.ts(74,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.ts(75,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.ts(76,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.ts(77,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.ts(78,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.ts(79,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.ts(80,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.ts(81,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.ts(82,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.ts(83,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.ts(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+!!! error TS2468: Cannot find global value 'Promise'. - ==== subfolder/index.ts (0 errors) ==== - // cjs format file - const x = 1; -@@= skipped -90, +72 lines =@@ - // cjs format file - const x = 1; - export {x}; --==== index.mts (22 errors) ==== -+==== index.mts (11 errors) ==== - import * as m1 from "./index.js"; - import * as m2 from "./index.mjs"; - import * as m3 from "./index.cjs"; -@@= skipped -15, +15 lines =@@ - import * as m12 from "./subfolder2/another/index.cjs"; - // The next ones should all fail - esm format files have no index resolution or extension resolution - import * as m13 from "./"; -- ~~~~ --!!! error TS2307: Cannot find module './' or its corresponding type declarations. - import * as m14 from "./index"; -- ~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? - import * as m15 from "./subfolder"; -- ~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m16 from "./subfolder/"; -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m17 from "./subfolder/index"; -- ~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? - import * as m18 from "./subfolder2"; -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m19 from "./subfolder2/"; -- ~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m20 from "./subfolder2/index"; -- ~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? - import * as m21 from "./subfolder2/another"; -- ~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m22 from "./subfolder2/another/"; -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m23 from "./subfolder2/another/index"; -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? - void m1; - void m2; - void m3; -@@= skipped -82, +60 lines =@@ - - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); -- ~~~~ --!!! error TS2307: Cannot find module './' or its corresponding type declarations. -+ ~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m36 = import("./index"); -- ~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m37 = import("./subfolder"); -- ~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m38 = import("./subfolder/"); -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m39 = import("./subfolder/index"); -- ~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m40 = import("./subfolder2"); -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m41 = import("./subfolder2/"); -- ~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m42 = import("./subfolder2/index"); -- ~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m43 = import("./subfolder2/another"); -- ~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m44 = import("./subfolder2/another/"); -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m45 = import("./subfolder2/another/index"); -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - - // esm format file - const x = 1; -@@= skipped -112, +112 lines =@@ - - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); -- ~~~~ --!!! error TS2307: Cannot find module './' or its corresponding type declarations. -+ ~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m36 = import("./index"); -- ~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m37 = import("./subfolder"); -- ~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m38 = import("./subfolder/"); -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m39 = import("./subfolder/index"); -- ~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m40 = import("./subfolder2"); -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m41 = import("./subfolder2/"); -- ~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m42 = import("./subfolder2/index"); -- ~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m43 = import("./subfolder2/another"); -- ~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m44 = import("./subfolder2/another/"); -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m45 = import("./subfolder2/another/index"); -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - // cjs format file - const x = 1; - export {x}; --==== index.ts (22 errors) ==== -+==== index.ts (11 errors) ==== - import * as m1 from "./index.js"; - import * as m2 from "./index.mjs"; - import * as m3 from "./index.cjs"; -@@= skipped -50, +50 lines =@@ - import * as m12 from "./subfolder2/another/index.cjs"; - // The next ones shouldn't all work - esm format files have no index resolution or extension resolution - import * as m13 from "./"; -- ~~~~ --!!! error TS2307: Cannot find module './' or its corresponding type declarations. - import * as m14 from "./index"; -- ~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? - import * as m15 from "./subfolder"; -- ~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m16 from "./subfolder/"; -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m17 from "./subfolder/index"; -- ~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? - import * as m18 from "./subfolder2"; -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m19 from "./subfolder2/"; -- ~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m20 from "./subfolder2/index"; -- ~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? - import * as m21 from "./subfolder2/another"; -- ~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m22 from "./subfolder2/another/"; -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m23 from "./subfolder2/another/index"; -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? - void m1; - void m2; - void m3; -@@= skipped -82, +60 lines =@@ - - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); -- ~~~~ --!!! error TS2307: Cannot find module './' or its corresponding type declarations. -+ ~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m36 = import("./index"); -- ~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m37 = import("./subfolder"); -- ~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m38 = import("./subfolder/"); -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m39 = import("./subfolder/index"); -- ~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m40 = import("./subfolder2"); -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m41 = import("./subfolder2/"); -- ~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m42 = import("./subfolder2/index"); -- ~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m43 = import("./subfolder2/another"); -- ~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m44 = import("./subfolder2/another/"); -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m45 = import("./subfolder2/another/index"); -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - // esm format file - const x = 1; - export {x}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).js index c4d68e41d7..bfebc4d12e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).js @@ -335,12 +335,9 @@ exports.x = void 0; const x = 1; exports.x = x; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = 1; -exports.x = x; +export { x }; //// [index.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -356,26 +353,17 @@ exports.x = void 0; const x = 1; exports.x = x; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = 1; -exports.x = x; +export { x }; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = 1; -exports.x = x; +export { x }; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = 1; -exports.x = x; +export { x }; //// [index.cjs] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -385,33 +373,66 @@ const x = 1; exports.x = x; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.x = void 0; // ESM-format imports below should issue errors -const m1 = require("./index.js"); -const m2 = require("./index.mjs"); -const m3 = require("./index.cjs"); -const m4 = require("./subfolder/index.js"); -const m5 = require("./subfolder/index.mjs"); -const m6 = require("./subfolder/index.cjs"); -const m7 = require("./subfolder2/index.js"); -const m8 = require("./subfolder2/index.mjs"); -const m9 = require("./subfolder2/index.cjs"); -const m10 = require("./subfolder2/another/index.js"); -const m11 = require("./subfolder2/another/index.mjs"); -const m12 = require("./subfolder2/another/index.cjs"); +const m1 = __importStar(require("./index.js")); +const m2 = __importStar(require("./index.mjs")); +const m3 = __importStar(require("./index.cjs")); +const m4 = __importStar(require("./subfolder/index.js")); +const m5 = __importStar(require("./subfolder/index.mjs")); +const m6 = __importStar(require("./subfolder/index.cjs")); +const m7 = __importStar(require("./subfolder2/index.js")); +const m8 = __importStar(require("./subfolder2/index.mjs")); +const m9 = __importStar(require("./subfolder2/index.cjs")); +const m10 = __importStar(require("./subfolder2/another/index.js")); +const m11 = __importStar(require("./subfolder2/another/index.mjs")); +const m12 = __importStar(require("./subfolder2/another/index.cjs")); // The next ones should _mostly_ work - cjs format files have index resolution and extension resolution (except for those which resolve to an esm format file) -const m13 = require("./"); -const m14 = require("./index"); -const m15 = require("./subfolder"); -const m16 = require("./subfolder/"); -const m17 = require("./subfolder/index"); -const m18 = require("./subfolder2"); -const m19 = require("./subfolder2/"); -const m20 = require("./subfolder2/index"); -const m21 = require("./subfolder2/another"); -const m22 = require("./subfolder2/another/"); -const m23 = require("./subfolder2/another/index"); +const m13 = __importStar(require("./")); +const m14 = __importStar(require("./index")); +const m15 = __importStar(require("./subfolder")); +const m16 = __importStar(require("./subfolder/")); +const m17 = __importStar(require("./subfolder/index")); +const m18 = __importStar(require("./subfolder2")); +const m19 = __importStar(require("./subfolder2/")); +const m20 = __importStar(require("./subfolder2/index")); +const m21 = __importStar(require("./subfolder2/another")); +const m22 = __importStar(require("./subfolder2/another/")); +const m23 = __importStar(require("./subfolder2/another/index")); void m1; void m2; void m3; @@ -474,33 +495,32 @@ const _m45 = import("./subfolder2/another/index"); const x = 1; exports.x = x; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; -const m1 = require("./index.js"); -const m2 = require("./index.mjs"); -const m3 = require("./index.cjs"); -const m4 = require("./subfolder/index.js"); -const m5 = require("./subfolder/index.mjs"); -const m6 = require("./subfolder/index.cjs"); -const m7 = require("./subfolder2/index.js"); -const m8 = require("./subfolder2/index.mjs"); -const m9 = require("./subfolder2/index.cjs"); -const m10 = require("./subfolder2/another/index.js"); -const m11 = require("./subfolder2/another/index.mjs"); -const m12 = require("./subfolder2/another/index.cjs"); +import { createRequire as _createRequire } from "module"; +const __require = _createRequire(import.meta.url); +import * as m1 from "./index.js"; +import * as m2 from "./index.mjs"; +import * as m3 from "./index.cjs"; +import * as m4 from "./subfolder/index.js"; +import * as m5 from "./subfolder/index.mjs"; +import * as m6 from "./subfolder/index.cjs"; +import * as m7 from "./subfolder2/index.js"; +import * as m8 from "./subfolder2/index.mjs"; +import * as m9 from "./subfolder2/index.cjs"; +import * as m10 from "./subfolder2/another/index.js"; +import * as m11 from "./subfolder2/another/index.mjs"; +import * as m12 from "./subfolder2/another/index.cjs"; // The next ones shouldn't all work - esm format files have no index resolution or extension resolution -const m13 = require("./"); -const m14 = require("./index"); -const m15 = require("./subfolder"); -const m16 = require("./subfolder/"); -const m17 = require("./subfolder/index"); -const m18 = require("./subfolder2"); -const m19 = require("./subfolder2/"); -const m20 = require("./subfolder2/index"); -const m21 = require("./subfolder2/another"); -const m22 = require("./subfolder2/another/"); -const m23 = require("./subfolder2/another/index"); +import * as m13 from "./"; +import * as m14 from "./index"; +import * as m15 from "./subfolder"; +import * as m16 from "./subfolder/"; +import * as m17 from "./subfolder/index"; +import * as m18 from "./subfolder2"; +import * as m19 from "./subfolder2/"; +import * as m20 from "./subfolder2/index"; +import * as m21 from "./subfolder2/another"; +import * as m22 from "./subfolder2/another/"; +import * as m23 from "./subfolder2/another/index"; void m1; void m2; void m3; @@ -525,17 +545,17 @@ void m21; void m22; void m23; // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) -const m24 = require("./"); -const m25 = require("./index"); -const m26 = require("./subfolder"); -const m27 = require("./subfolder/"); -const m28 = require("./subfolder/index"); -const m29 = require("./subfolder2"); -const m30 = require("./subfolder2/"); -const m31 = require("./subfolder2/index"); -const m32 = require("./subfolder2/another"); -const m33 = require("./subfolder2/another/"); -const m34 = require("./subfolder2/another/index"); +const m24 = __require("./"); +const m25 = __require("./index"); +const m26 = __require("./subfolder"); +const m27 = __require("./subfolder/"); +const m28 = __require("./subfolder/index"); +const m29 = __require("./subfolder2"); +const m30 = __require("./subfolder2/"); +const m31 = __require("./subfolder2/index"); +const m32 = __require("./subfolder2/another"); +const m33 = __require("./subfolder2/another/"); +const m34 = __require("./subfolder2/another/index"); void m24; void m25; void m26; @@ -561,35 +581,34 @@ const _m44 = import("./subfolder2/another/"); const _m45 = import("./subfolder2/another/index"); // esm format file const x = 1; -exports.x = x; +export { x }; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; -const m1 = require("./index.js"); -const m2 = require("./index.mjs"); -const m3 = require("./index.cjs"); -const m4 = require("./subfolder/index.js"); -const m5 = require("./subfolder/index.mjs"); -const m6 = require("./subfolder/index.cjs"); -const m7 = require("./subfolder2/index.js"); -const m8 = require("./subfolder2/index.mjs"); -const m9 = require("./subfolder2/index.cjs"); -const m10 = require("./subfolder2/another/index.js"); -const m11 = require("./subfolder2/another/index.mjs"); -const m12 = require("./subfolder2/another/index.cjs"); +import { createRequire as _createRequire } from "module"; +const __require = _createRequire(import.meta.url); +import * as m1 from "./index.js"; +import * as m2 from "./index.mjs"; +import * as m3 from "./index.cjs"; +import * as m4 from "./subfolder/index.js"; +import * as m5 from "./subfolder/index.mjs"; +import * as m6 from "./subfolder/index.cjs"; +import * as m7 from "./subfolder2/index.js"; +import * as m8 from "./subfolder2/index.mjs"; +import * as m9 from "./subfolder2/index.cjs"; +import * as m10 from "./subfolder2/another/index.js"; +import * as m11 from "./subfolder2/another/index.mjs"; +import * as m12 from "./subfolder2/another/index.cjs"; // The next ones should all fail - esm format files have no index resolution or extension resolution -const m13 = require("./"); -const m14 = require("./index"); -const m15 = require("./subfolder"); -const m16 = require("./subfolder/"); -const m17 = require("./subfolder/index"); -const m18 = require("./subfolder2"); -const m19 = require("./subfolder2/"); -const m20 = require("./subfolder2/index"); -const m21 = require("./subfolder2/another"); -const m22 = require("./subfolder2/another/"); -const m23 = require("./subfolder2/another/index"); +import * as m13 from "./"; +import * as m14 from "./index"; +import * as m15 from "./subfolder"; +import * as m16 from "./subfolder/"; +import * as m17 from "./subfolder/index"; +import * as m18 from "./subfolder2"; +import * as m19 from "./subfolder2/"; +import * as m20 from "./subfolder2/index"; +import * as m21 from "./subfolder2/another"; +import * as m22 from "./subfolder2/another/"; +import * as m23 from "./subfolder2/another/index"; void m1; void m2; void m3; @@ -614,17 +633,17 @@ void m21; void m22; void m23; // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) -const m24 = require("./"); -const m25 = require("./index"); -const m26 = require("./subfolder"); -const m27 = require("./subfolder/"); -const m28 = require("./subfolder/index"); -const m29 = require("./subfolder2"); -const m30 = require("./subfolder2/"); -const m31 = require("./subfolder2/index"); -const m32 = require("./subfolder2/another"); -const m33 = require("./subfolder2/another/"); -const m34 = require("./subfolder2/another/index"); +const m24 = __require("./"); +const m25 = __require("./index"); +const m26 = __require("./subfolder"); +const m27 = __require("./subfolder/"); +const m28 = __require("./subfolder/index"); +const m29 = __require("./subfolder2"); +const m30 = __require("./subfolder2/"); +const m31 = __require("./subfolder2/index"); +const m32 = __require("./subfolder2/another"); +const m33 = __require("./subfolder2/another/"); +const m34 = __require("./subfolder2/another/index"); void m24; void m25; void m26; @@ -650,7 +669,7 @@ const _m44 = import("./subfolder2/another/"); const _m45 = import("./subfolder2/another/index"); // esm format file const x = 1; -exports.x = x; +export { x }; //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).js.diff deleted file mode 100644 index 4a5b449127..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).js.diff +++ /dev/null @@ -1,368 +0,0 @@ ---- old.nodeModules1(module=node20).js -+++ new.nodeModules1(module=node20).js -@@= skipped -334, +334 lines =@@ - const x = 1; - exports.x = x; - //// [index.mjs] --// esm format file --const x = 1; --export { x }; --//// [index.js] --"use strict"; --Object.defineProperty(exports, "__esModule", { value: true }); --exports.x = void 0; --// cjs format file --const x = 1; --exports.x = x; --//// [index.cjs] --"use strict"; --Object.defineProperty(exports, "__esModule", { value: true }); --exports.x = void 0; --// cjs format file --const x = 1; --exports.x = x; --//// [index.mjs] --// esm format file --const x = 1; --export { x }; --//// [index.js] --// esm format file --const x = 1; --export { x }; --//// [index.mjs] --// esm format file --const x = 1; --export { x }; --//// [index.cjs] --"use strict"; --Object.defineProperty(exports, "__esModule", { value: true }); --exports.x = void 0; --// cjs format file --const x = 1; --exports.x = x; --//// [index.cjs] --"use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// esm format file -+const x = 1; -+exports.x = x; -+//// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// cjs format file -+const x = 1; -+exports.x = x; -+//// [index.cjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// cjs format file -+const x = 1; -+exports.x = x; -+//// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// esm format file -+const x = 1; -+exports.x = x; -+//// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// esm format file -+const x = 1; -+exports.x = x; -+//// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// esm format file -+const x = 1; -+exports.x = x; -+//// [index.cjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// cjs format file -+const x = 1; -+exports.x = x; -+//// [index.cjs] -+"use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.x = void 0; - // ESM-format imports below should issue errors --const m1 = __importStar(require("./index.js")); --const m2 = __importStar(require("./index.mjs")); --const m3 = __importStar(require("./index.cjs")); --const m4 = __importStar(require("./subfolder/index.js")); --const m5 = __importStar(require("./subfolder/index.mjs")); --const m6 = __importStar(require("./subfolder/index.cjs")); --const m7 = __importStar(require("./subfolder2/index.js")); --const m8 = __importStar(require("./subfolder2/index.mjs")); --const m9 = __importStar(require("./subfolder2/index.cjs")); --const m10 = __importStar(require("./subfolder2/another/index.js")); --const m11 = __importStar(require("./subfolder2/another/index.mjs")); --const m12 = __importStar(require("./subfolder2/another/index.cjs")); -+const m1 = require("./index.js"); -+const m2 = require("./index.mjs"); -+const m3 = require("./index.cjs"); -+const m4 = require("./subfolder/index.js"); -+const m5 = require("./subfolder/index.mjs"); -+const m6 = require("./subfolder/index.cjs"); -+const m7 = require("./subfolder2/index.js"); -+const m8 = require("./subfolder2/index.mjs"); -+const m9 = require("./subfolder2/index.cjs"); -+const m10 = require("./subfolder2/another/index.js"); -+const m11 = require("./subfolder2/another/index.mjs"); -+const m12 = require("./subfolder2/another/index.cjs"); - // The next ones should _mostly_ work - cjs format files have index resolution and extension resolution (except for those which resolve to an esm format file) --const m13 = __importStar(require("./")); --const m14 = __importStar(require("./index")); --const m15 = __importStar(require("./subfolder")); --const m16 = __importStar(require("./subfolder/")); --const m17 = __importStar(require("./subfolder/index")); --const m18 = __importStar(require("./subfolder2")); --const m19 = __importStar(require("./subfolder2/")); --const m20 = __importStar(require("./subfolder2/index")); --const m21 = __importStar(require("./subfolder2/another")); --const m22 = __importStar(require("./subfolder2/another/")); --const m23 = __importStar(require("./subfolder2/another/index")); -+const m13 = require("./"); -+const m14 = require("./index"); -+const m15 = require("./subfolder"); -+const m16 = require("./subfolder/"); -+const m17 = require("./subfolder/index"); -+const m18 = require("./subfolder2"); -+const m19 = require("./subfolder2/"); -+const m20 = require("./subfolder2/index"); -+const m21 = require("./subfolder2/another"); -+const m22 = require("./subfolder2/another/"); -+const m23 = require("./subfolder2/another/index"); - void m1; - void m2; - void m3; -@@= skipped -160, +139 lines =@@ - const x = 1; - exports.x = x; - //// [index.js] --import { createRequire as _createRequire } from "module"; --const __require = _createRequire(import.meta.url); --import * as m1 from "./index.js"; --import * as m2 from "./index.mjs"; --import * as m3 from "./index.cjs"; --import * as m4 from "./subfolder/index.js"; --import * as m5 from "./subfolder/index.mjs"; --import * as m6 from "./subfolder/index.cjs"; --import * as m7 from "./subfolder2/index.js"; --import * as m8 from "./subfolder2/index.mjs"; --import * as m9 from "./subfolder2/index.cjs"; --import * as m10 from "./subfolder2/another/index.js"; --import * as m11 from "./subfolder2/another/index.mjs"; --import * as m12 from "./subfolder2/another/index.cjs"; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+const m1 = require("./index.js"); -+const m2 = require("./index.mjs"); -+const m3 = require("./index.cjs"); -+const m4 = require("./subfolder/index.js"); -+const m5 = require("./subfolder/index.mjs"); -+const m6 = require("./subfolder/index.cjs"); -+const m7 = require("./subfolder2/index.js"); -+const m8 = require("./subfolder2/index.mjs"); -+const m9 = require("./subfolder2/index.cjs"); -+const m10 = require("./subfolder2/another/index.js"); -+const m11 = require("./subfolder2/another/index.mjs"); -+const m12 = require("./subfolder2/another/index.cjs"); - // The next ones shouldn't all work - esm format files have no index resolution or extension resolution --import * as m13 from "./"; --import * as m14 from "./index"; --import * as m15 from "./subfolder"; --import * as m16 from "./subfolder/"; --import * as m17 from "./subfolder/index"; --import * as m18 from "./subfolder2"; --import * as m19 from "./subfolder2/"; --import * as m20 from "./subfolder2/index"; --import * as m21 from "./subfolder2/another"; --import * as m22 from "./subfolder2/another/"; --import * as m23 from "./subfolder2/another/index"; -+const m13 = require("./"); -+const m14 = require("./index"); -+const m15 = require("./subfolder"); -+const m16 = require("./subfolder/"); -+const m17 = require("./subfolder/index"); -+const m18 = require("./subfolder2"); -+const m19 = require("./subfolder2/"); -+const m20 = require("./subfolder2/index"); -+const m21 = require("./subfolder2/another"); -+const m22 = require("./subfolder2/another/"); -+const m23 = require("./subfolder2/another/index"); - void m1; - void m2; - void m3; -@@= skipped -50, +51 lines =@@ - void m22; - void m23; - // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) --const m24 = __require("./"); --const m25 = __require("./index"); --const m26 = __require("./subfolder"); --const m27 = __require("./subfolder/"); --const m28 = __require("./subfolder/index"); --const m29 = __require("./subfolder2"); --const m30 = __require("./subfolder2/"); --const m31 = __require("./subfolder2/index"); --const m32 = __require("./subfolder2/another"); --const m33 = __require("./subfolder2/another/"); --const m34 = __require("./subfolder2/another/index"); -+const m24 = require("./"); -+const m25 = require("./index"); -+const m26 = require("./subfolder"); -+const m27 = require("./subfolder/"); -+const m28 = require("./subfolder/index"); -+const m29 = require("./subfolder2"); -+const m30 = require("./subfolder2/"); -+const m31 = require("./subfolder2/index"); -+const m32 = require("./subfolder2/another"); -+const m33 = require("./subfolder2/another/"); -+const m34 = require("./subfolder2/another/index"); - void m24; - void m25; - void m26; -@@= skipped -36, +36 lines =@@ - const _m45 = import("./subfolder2/another/index"); - // esm format file - const x = 1; --export { x }; -+exports.x = x; - //// [index.mjs] --import { createRequire as _createRequire } from "module"; --const __require = _createRequire(import.meta.url); --import * as m1 from "./index.js"; --import * as m2 from "./index.mjs"; --import * as m3 from "./index.cjs"; --import * as m4 from "./subfolder/index.js"; --import * as m5 from "./subfolder/index.mjs"; --import * as m6 from "./subfolder/index.cjs"; --import * as m7 from "./subfolder2/index.js"; --import * as m8 from "./subfolder2/index.mjs"; --import * as m9 from "./subfolder2/index.cjs"; --import * as m10 from "./subfolder2/another/index.js"; --import * as m11 from "./subfolder2/another/index.mjs"; --import * as m12 from "./subfolder2/another/index.cjs"; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+const m1 = require("./index.js"); -+const m2 = require("./index.mjs"); -+const m3 = require("./index.cjs"); -+const m4 = require("./subfolder/index.js"); -+const m5 = require("./subfolder/index.mjs"); -+const m6 = require("./subfolder/index.cjs"); -+const m7 = require("./subfolder2/index.js"); -+const m8 = require("./subfolder2/index.mjs"); -+const m9 = require("./subfolder2/index.cjs"); -+const m10 = require("./subfolder2/another/index.js"); -+const m11 = require("./subfolder2/another/index.mjs"); -+const m12 = require("./subfolder2/another/index.cjs"); - // The next ones should all fail - esm format files have no index resolution or extension resolution --import * as m13 from "./"; --import * as m14 from "./index"; --import * as m15 from "./subfolder"; --import * as m16 from "./subfolder/"; --import * as m17 from "./subfolder/index"; --import * as m18 from "./subfolder2"; --import * as m19 from "./subfolder2/"; --import * as m20 from "./subfolder2/index"; --import * as m21 from "./subfolder2/another"; --import * as m22 from "./subfolder2/another/"; --import * as m23 from "./subfolder2/another/index"; -+const m13 = require("./"); -+const m14 = require("./index"); -+const m15 = require("./subfolder"); -+const m16 = require("./subfolder/"); -+const m17 = require("./subfolder/index"); -+const m18 = require("./subfolder2"); -+const m19 = require("./subfolder2/"); -+const m20 = require("./subfolder2/index"); -+const m21 = require("./subfolder2/another"); -+const m22 = require("./subfolder2/another/"); -+const m23 = require("./subfolder2/another/index"); - void m1; - void m2; - void m3; -@@= skipped -52, +53 lines =@@ - void m22; - void m23; - // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) --const m24 = __require("./"); --const m25 = __require("./index"); --const m26 = __require("./subfolder"); --const m27 = __require("./subfolder/"); --const m28 = __require("./subfolder/index"); --const m29 = __require("./subfolder2"); --const m30 = __require("./subfolder2/"); --const m31 = __require("./subfolder2/index"); --const m32 = __require("./subfolder2/another"); --const m33 = __require("./subfolder2/another/"); --const m34 = __require("./subfolder2/another/index"); -+const m24 = require("./"); -+const m25 = require("./index"); -+const m26 = require("./subfolder"); -+const m27 = require("./subfolder/"); -+const m28 = require("./subfolder/index"); -+const m29 = require("./subfolder2"); -+const m30 = require("./subfolder2/"); -+const m31 = require("./subfolder2/index"); -+const m32 = require("./subfolder2/another"); -+const m33 = require("./subfolder2/another/"); -+const m34 = require("./subfolder2/another/index"); - void m24; - void m25; - void m26; -@@= skipped -36, +36 lines =@@ - const _m45 = import("./subfolder2/another/index"); - // esm format file - const x = 1; --export { x }; -+exports.x = x; - - - //// [index.d.ts] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).symbols index bee155c52d..cf80f6db97 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).symbols @@ -282,47 +282,36 @@ void m34; // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); >_m35 : Symbol(_m35, Decl(index.mts, 73, 5)) ->"./" : Symbol(m1, Decl(index.ts, 0, 0)) const _m36 = import("./index"); >_m36 : Symbol(_m36, Decl(index.mts, 74, 5)) ->"./index" : Symbol(m1, Decl(index.ts, 0, 0)) const _m37 = import("./subfolder"); >_m37 : Symbol(_m37, Decl(index.mts, 75, 5)) ->"./subfolder" : Symbol(m4, Decl(index.ts, 0, 0)) const _m38 = import("./subfolder/"); >_m38 : Symbol(_m38, Decl(index.mts, 76, 5)) ->"./subfolder/" : Symbol(m4, Decl(index.ts, 0, 0)) const _m39 = import("./subfolder/index"); >_m39 : Symbol(_m39, Decl(index.mts, 77, 5)) ->"./subfolder/index" : Symbol(m4, Decl(index.ts, 0, 0)) const _m40 = import("./subfolder2"); >_m40 : Symbol(_m40, Decl(index.mts, 78, 5)) ->"./subfolder2" : Symbol(m7, Decl(index.ts, 0, 0)) const _m41 = import("./subfolder2/"); >_m41 : Symbol(_m41, Decl(index.mts, 79, 5)) ->"./subfolder2/" : Symbol(m7, Decl(index.ts, 0, 0)) const _m42 = import("./subfolder2/index"); >_m42 : Symbol(_m42, Decl(index.mts, 80, 5)) ->"./subfolder2/index" : Symbol(m7, Decl(index.ts, 0, 0)) const _m43 = import("./subfolder2/another"); >_m43 : Symbol(_m43, Decl(index.mts, 81, 5)) ->"./subfolder2/another" : Symbol(m10, Decl(index.ts, 0, 0)) const _m44 = import("./subfolder2/another/"); >_m44 : Symbol(_m44, Decl(index.mts, 82, 5)) ->"./subfolder2/another/" : Symbol(m10, Decl(index.ts, 0, 0)) const _m45 = import("./subfolder2/another/index"); >_m45 : Symbol(_m45, Decl(index.mts, 83, 5)) ->"./subfolder2/another/index" : Symbol(m10, Decl(index.ts, 0, 0)) // esm format file const x = 1; @@ -542,47 +531,36 @@ void m34; // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); >_m35 : Symbol(_m35, Decl(index.cts, 74, 5)) ->"./" : Symbol(m1, Decl(index.ts, 0, 0)) const _m36 = import("./index"); >_m36 : Symbol(_m36, Decl(index.cts, 75, 5)) ->"./index" : Symbol(m1, Decl(index.ts, 0, 0)) const _m37 = import("./subfolder"); >_m37 : Symbol(_m37, Decl(index.cts, 76, 5)) ->"./subfolder" : Symbol(m4, Decl(index.ts, 0, 0)) const _m38 = import("./subfolder/"); >_m38 : Symbol(_m38, Decl(index.cts, 77, 5)) ->"./subfolder/" : Symbol(m4, Decl(index.ts, 0, 0)) const _m39 = import("./subfolder/index"); >_m39 : Symbol(_m39, Decl(index.cts, 78, 5)) ->"./subfolder/index" : Symbol(m4, Decl(index.ts, 0, 0)) const _m40 = import("./subfolder2"); >_m40 : Symbol(_m40, Decl(index.cts, 79, 5)) ->"./subfolder2" : Symbol(m7, Decl(index.ts, 0, 0)) const _m41 = import("./subfolder2/"); >_m41 : Symbol(_m41, Decl(index.cts, 80, 5)) ->"./subfolder2/" : Symbol(m7, Decl(index.ts, 0, 0)) const _m42 = import("./subfolder2/index"); >_m42 : Symbol(_m42, Decl(index.cts, 81, 5)) ->"./subfolder2/index" : Symbol(m7, Decl(index.ts, 0, 0)) const _m43 = import("./subfolder2/another"); >_m43 : Symbol(_m43, Decl(index.cts, 82, 5)) ->"./subfolder2/another" : Symbol(m10, Decl(index.ts, 0, 0)) const _m44 = import("./subfolder2/another/"); >_m44 : Symbol(_m44, Decl(index.cts, 83, 5)) ->"./subfolder2/another/" : Symbol(m10, Decl(index.ts, 0, 0)) const _m45 = import("./subfolder2/another/index"); >_m45 : Symbol(_m45, Decl(index.cts, 84, 5)) ->"./subfolder2/another/index" : Symbol(m10, Decl(index.ts, 0, 0)) // cjs format file const x = 1; @@ -801,47 +779,36 @@ void m34; // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); >_m35 : Symbol(_m35, Decl(index.ts, 73, 5)) ->"./" : Symbol(m1, Decl(index.ts, 0, 0)) const _m36 = import("./index"); >_m36 : Symbol(_m36, Decl(index.ts, 74, 5)) ->"./index" : Symbol(m1, Decl(index.ts, 0, 0)) const _m37 = import("./subfolder"); >_m37 : Symbol(_m37, Decl(index.ts, 75, 5)) ->"./subfolder" : Symbol(m4, Decl(index.ts, 0, 0)) const _m38 = import("./subfolder/"); >_m38 : Symbol(_m38, Decl(index.ts, 76, 5)) ->"./subfolder/" : Symbol(m4, Decl(index.ts, 0, 0)) const _m39 = import("./subfolder/index"); >_m39 : Symbol(_m39, Decl(index.ts, 77, 5)) ->"./subfolder/index" : Symbol(m4, Decl(index.ts, 0, 0)) const _m40 = import("./subfolder2"); >_m40 : Symbol(_m40, Decl(index.ts, 78, 5)) ->"./subfolder2" : Symbol(m7, Decl(index.ts, 0, 0)) const _m41 = import("./subfolder2/"); >_m41 : Symbol(_m41, Decl(index.ts, 79, 5)) ->"./subfolder2/" : Symbol(m7, Decl(index.ts, 0, 0)) const _m42 = import("./subfolder2/index"); >_m42 : Symbol(_m42, Decl(index.ts, 80, 5)) ->"./subfolder2/index" : Symbol(m7, Decl(index.ts, 0, 0)) const _m43 = import("./subfolder2/another"); >_m43 : Symbol(_m43, Decl(index.ts, 81, 5)) ->"./subfolder2/another" : Symbol(m10, Decl(index.ts, 0, 0)) const _m44 = import("./subfolder2/another/"); >_m44 : Symbol(_m44, Decl(index.ts, 82, 5)) ->"./subfolder2/another/" : Symbol(m10, Decl(index.ts, 0, 0)) const _m45 = import("./subfolder2/another/index"); >_m45 : Symbol(_m45, Decl(index.ts, 83, 5)) ->"./subfolder2/another/index" : Symbol(m10, Decl(index.ts, 0, 0)) // esm format file const x = 1; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).symbols.diff deleted file mode 100644 index 42ffcaf5c8..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).symbols.diff +++ /dev/null @@ -1,146 +0,0 @@ ---- old.nodeModules1(module=node20).symbols -+++ new.nodeModules1(module=node20).symbols -@@= skipped -281, +281 lines =@@ - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); - >_m35 : Symbol(_m35, Decl(index.mts, 73, 5)) -+>"./" : Symbol(m1, Decl(index.ts, 0, 0)) - - const _m36 = import("./index"); - >_m36 : Symbol(_m36, Decl(index.mts, 74, 5)) -+>"./index" : Symbol(m1, Decl(index.ts, 0, 0)) - - const _m37 = import("./subfolder"); - >_m37 : Symbol(_m37, Decl(index.mts, 75, 5)) -+>"./subfolder" : Symbol(m4, Decl(index.ts, 0, 0)) - - const _m38 = import("./subfolder/"); - >_m38 : Symbol(_m38, Decl(index.mts, 76, 5)) -+>"./subfolder/" : Symbol(m4, Decl(index.ts, 0, 0)) - - const _m39 = import("./subfolder/index"); - >_m39 : Symbol(_m39, Decl(index.mts, 77, 5)) -+>"./subfolder/index" : Symbol(m4, Decl(index.ts, 0, 0)) - - const _m40 = import("./subfolder2"); - >_m40 : Symbol(_m40, Decl(index.mts, 78, 5)) -+>"./subfolder2" : Symbol(m7, Decl(index.ts, 0, 0)) - - const _m41 = import("./subfolder2/"); - >_m41 : Symbol(_m41, Decl(index.mts, 79, 5)) -+>"./subfolder2/" : Symbol(m7, Decl(index.ts, 0, 0)) - - const _m42 = import("./subfolder2/index"); - >_m42 : Symbol(_m42, Decl(index.mts, 80, 5)) -+>"./subfolder2/index" : Symbol(m7, Decl(index.ts, 0, 0)) - - const _m43 = import("./subfolder2/another"); - >_m43 : Symbol(_m43, Decl(index.mts, 81, 5)) -+>"./subfolder2/another" : Symbol(m10, Decl(index.ts, 0, 0)) - - const _m44 = import("./subfolder2/another/"); - >_m44 : Symbol(_m44, Decl(index.mts, 82, 5)) -+>"./subfolder2/another/" : Symbol(m10, Decl(index.ts, 0, 0)) - - const _m45 = import("./subfolder2/another/index"); - >_m45 : Symbol(_m45, Decl(index.mts, 83, 5)) -+>"./subfolder2/another/index" : Symbol(m10, Decl(index.ts, 0, 0)) - - // esm format file - const x = 1; -@@= skipped -249, +260 lines =@@ - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); - >_m35 : Symbol(_m35, Decl(index.cts, 74, 5)) -+>"./" : Symbol(m1, Decl(index.ts, 0, 0)) - - const _m36 = import("./index"); - >_m36 : Symbol(_m36, Decl(index.cts, 75, 5)) -+>"./index" : Symbol(m1, Decl(index.ts, 0, 0)) - - const _m37 = import("./subfolder"); - >_m37 : Symbol(_m37, Decl(index.cts, 76, 5)) -+>"./subfolder" : Symbol(m4, Decl(index.ts, 0, 0)) - - const _m38 = import("./subfolder/"); - >_m38 : Symbol(_m38, Decl(index.cts, 77, 5)) -+>"./subfolder/" : Symbol(m4, Decl(index.ts, 0, 0)) - - const _m39 = import("./subfolder/index"); - >_m39 : Symbol(_m39, Decl(index.cts, 78, 5)) -+>"./subfolder/index" : Symbol(m4, Decl(index.ts, 0, 0)) - - const _m40 = import("./subfolder2"); - >_m40 : Symbol(_m40, Decl(index.cts, 79, 5)) -+>"./subfolder2" : Symbol(m7, Decl(index.ts, 0, 0)) - - const _m41 = import("./subfolder2/"); - >_m41 : Symbol(_m41, Decl(index.cts, 80, 5)) -+>"./subfolder2/" : Symbol(m7, Decl(index.ts, 0, 0)) - - const _m42 = import("./subfolder2/index"); - >_m42 : Symbol(_m42, Decl(index.cts, 81, 5)) -+>"./subfolder2/index" : Symbol(m7, Decl(index.ts, 0, 0)) - - const _m43 = import("./subfolder2/another"); - >_m43 : Symbol(_m43, Decl(index.cts, 82, 5)) -+>"./subfolder2/another" : Symbol(m10, Decl(index.ts, 0, 0)) - - const _m44 = import("./subfolder2/another/"); - >_m44 : Symbol(_m44, Decl(index.cts, 83, 5)) -+>"./subfolder2/another/" : Symbol(m10, Decl(index.ts, 0, 0)) - - const _m45 = import("./subfolder2/another/index"); - >_m45 : Symbol(_m45, Decl(index.cts, 84, 5)) -+>"./subfolder2/another/index" : Symbol(m10, Decl(index.ts, 0, 0)) - - // cjs format file - const x = 1; -@@= skipped -248, +259 lines =@@ - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); - >_m35 : Symbol(_m35, Decl(index.ts, 73, 5)) -+>"./" : Symbol(m1, Decl(index.ts, 0, 0)) - - const _m36 = import("./index"); - >_m36 : Symbol(_m36, Decl(index.ts, 74, 5)) -+>"./index" : Symbol(m1, Decl(index.ts, 0, 0)) - - const _m37 = import("./subfolder"); - >_m37 : Symbol(_m37, Decl(index.ts, 75, 5)) -+>"./subfolder" : Symbol(m4, Decl(index.ts, 0, 0)) - - const _m38 = import("./subfolder/"); - >_m38 : Symbol(_m38, Decl(index.ts, 76, 5)) -+>"./subfolder/" : Symbol(m4, Decl(index.ts, 0, 0)) - - const _m39 = import("./subfolder/index"); - >_m39 : Symbol(_m39, Decl(index.ts, 77, 5)) -+>"./subfolder/index" : Symbol(m4, Decl(index.ts, 0, 0)) - - const _m40 = import("./subfolder2"); - >_m40 : Symbol(_m40, Decl(index.ts, 78, 5)) -+>"./subfolder2" : Symbol(m7, Decl(index.ts, 0, 0)) - - const _m41 = import("./subfolder2/"); - >_m41 : Symbol(_m41, Decl(index.ts, 79, 5)) -+>"./subfolder2/" : Symbol(m7, Decl(index.ts, 0, 0)) - - const _m42 = import("./subfolder2/index"); - >_m42 : Symbol(_m42, Decl(index.ts, 80, 5)) -+>"./subfolder2/index" : Symbol(m7, Decl(index.ts, 0, 0)) - - const _m43 = import("./subfolder2/another"); - >_m43 : Symbol(_m43, Decl(index.ts, 81, 5)) -+>"./subfolder2/another" : Symbol(m10, Decl(index.ts, 0, 0)) - - const _m44 = import("./subfolder2/another/"); - >_m44 : Symbol(_m44, Decl(index.ts, 82, 5)) -+>"./subfolder2/another/" : Symbol(m10, Decl(index.ts, 0, 0)) - - const _m45 = import("./subfolder2/another/index"); - >_m45 : Symbol(_m45, Decl(index.ts, 83, 5)) -+>"./subfolder2/another/index" : Symbol(m10, Decl(index.ts, 0, 0)) - - // esm format file - const x = 1; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).types index d8606912f3..c711491553 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).types @@ -120,37 +120,37 @@ import * as m12 from "./subfolder2/another/index.cjs"; // The next ones should all fail - esm format files have no index resolution or extension resolution import * as m13 from "./"; ->m13 : typeof m1 +>m13 : any import * as m14 from "./index"; ->m14 : typeof m1 +>m14 : any import * as m15 from "./subfolder"; ->m15 : typeof m4 +>m15 : any import * as m16 from "./subfolder/"; ->m16 : typeof m4 +>m16 : any import * as m17 from "./subfolder/index"; ->m17 : typeof m4 +>m17 : any import * as m18 from "./subfolder2"; ->m18 : typeof m7 +>m18 : any import * as m19 from "./subfolder2/"; ->m19 : typeof m7 +>m19 : any import * as m20 from "./subfolder2/index"; ->m20 : typeof m7 +>m20 : any import * as m21 from "./subfolder2/another"; ->m21 : typeof m10 +>m21 : any import * as m22 from "./subfolder2/another/"; ->m22 : typeof m10 +>m22 : any import * as m23 from "./subfolder2/another/index"; ->m23 : typeof m10 +>m23 : any void m1; >void m1 : undefined @@ -202,47 +202,47 @@ void m12; void m13; >void m13 : undefined ->m13 : typeof m1 +>m13 : any void m14; >void m14 : undefined ->m14 : typeof m1 +>m14 : any void m15; >void m15 : undefined ->m15 : typeof m4 +>m15 : any void m16; >void m16 : undefined ->m16 : typeof m4 +>m16 : any void m17; >void m17 : undefined ->m17 : typeof m4 +>m17 : any void m18; >void m18 : undefined ->m18 : typeof m7 +>m18 : any void m19; >void m19 : undefined ->m19 : typeof m7 +>m19 : any void m20; >void m20 : undefined ->m20 : typeof m7 +>m20 : any void m21; >void m21 : undefined ->m21 : typeof m10 +>m21 : any void m22; >void m22 : undefined ->m22 : typeof m10 +>m22 : any void m23; >void m23 : undefined ->m23 : typeof m10 +>m23 : any // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) import m24 = require("./"); @@ -252,22 +252,22 @@ import m25 = require("./index"); >m25 : typeof m1 import m26 = require("./subfolder"); ->m26 : typeof m4 +>m26 : typeof m26 import m27 = require("./subfolder/"); ->m27 : typeof m4 +>m27 : typeof m26 import m28 = require("./subfolder/index"); ->m28 : typeof m4 +>m28 : typeof m26 import m29 = require("./subfolder2"); ->m29 : typeof m7 +>m29 : typeof m29 import m30 = require("./subfolder2/"); ->m30 : typeof m7 +>m30 : typeof m29 import m31 = require("./subfolder2/index"); ->m31 : typeof m7 +>m31 : typeof m29 import m32 = require("./subfolder2/another"); >m32 : typeof m10 @@ -288,27 +288,27 @@ void m25; void m26; >void m26 : undefined ->m26 : typeof m4 +>m26 : typeof m26 void m27; >void m27 : undefined ->m27 : typeof m4 +>m27 : typeof m26 void m28; >void m28 : undefined ->m28 : typeof m4 +>m28 : typeof m26 void m29; >void m29 : undefined ->m29 : typeof m7 +>m29 : typeof m29 void m30; >void m30 : undefined ->m30 : typeof m7 +>m30 : typeof m29 void m31; >void m31 : undefined ->m31 : typeof m7 +>m31 : typeof m29 void m32; >void m32 : undefined @@ -324,58 +324,58 @@ void m34; // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); ->_m35 : Promise<{ x: 1; default: typeof m1; }> ->import("./") : Promise<{ x: 1; default: typeof m1; }> +>_m35 : Promise +>import("./") : Promise >"./" : "./" const _m36 = import("./index"); ->_m36 : Promise<{ x: 1; default: typeof m1; }> ->import("./index") : Promise<{ x: 1; default: typeof m1; }> +>_m36 : Promise +>import("./index") : Promise >"./index" : "./index" const _m37 = import("./subfolder"); ->_m37 : Promise<{ x: 1; default: typeof m4; }> ->import("./subfolder") : Promise<{ x: 1; default: typeof m4; }> +>_m37 : Promise +>import("./subfolder") : Promise >"./subfolder" : "./subfolder" const _m38 = import("./subfolder/"); ->_m38 : Promise<{ x: 1; default: typeof m4; }> ->import("./subfolder/") : Promise<{ x: 1; default: typeof m4; }> +>_m38 : Promise +>import("./subfolder/") : Promise >"./subfolder/" : "./subfolder/" const _m39 = import("./subfolder/index"); ->_m39 : Promise<{ x: 1; default: typeof m4; }> ->import("./subfolder/index") : Promise<{ x: 1; default: typeof m4; }> +>_m39 : Promise +>import("./subfolder/index") : Promise >"./subfolder/index" : "./subfolder/index" const _m40 = import("./subfolder2"); ->_m40 : Promise<{ x: 1; default: typeof m7; }> ->import("./subfolder2") : Promise<{ x: 1; default: typeof m7; }> +>_m40 : Promise +>import("./subfolder2") : Promise >"./subfolder2" : "./subfolder2" const _m41 = import("./subfolder2/"); ->_m41 : Promise<{ x: 1; default: typeof m7; }> ->import("./subfolder2/") : Promise<{ x: 1; default: typeof m7; }> +>_m41 : Promise +>import("./subfolder2/") : Promise >"./subfolder2/" : "./subfolder2/" const _m42 = import("./subfolder2/index"); ->_m42 : Promise<{ x: 1; default: typeof m7; }> ->import("./subfolder2/index") : Promise<{ x: 1; default: typeof m7; }> +>_m42 : Promise +>import("./subfolder2/index") : Promise >"./subfolder2/index" : "./subfolder2/index" const _m43 = import("./subfolder2/another"); ->_m43 : Promise<{ x: 1; default: typeof m10; }> ->import("./subfolder2/another") : Promise<{ x: 1; default: typeof m10; }> +>_m43 : Promise +>import("./subfolder2/another") : Promise >"./subfolder2/another" : "./subfolder2/another" const _m44 = import("./subfolder2/another/"); ->_m44 : Promise<{ x: 1; default: typeof m10; }> ->import("./subfolder2/another/") : Promise<{ x: 1; default: typeof m10; }> +>_m44 : Promise +>import("./subfolder2/another/") : Promise >"./subfolder2/another/" : "./subfolder2/another/" const _m45 = import("./subfolder2/another/index"); ->_m45 : Promise<{ x: 1; default: typeof m10; }> ->import("./subfolder2/another/index") : Promise<{ x: 1; default: typeof m10; }> +>_m45 : Promise +>import("./subfolder2/another/index") : Promise >"./subfolder2/another/index" : "./subfolder2/another/index" // esm format file @@ -630,58 +630,58 @@ void m34; // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); ->_m35 : Promise<{ x: 1; default: typeof m1; }> ->import("./") : Promise<{ x: 1; default: typeof m1; }> +>_m35 : Promise +>import("./") : Promise >"./" : "./" const _m36 = import("./index"); ->_m36 : Promise<{ x: 1; default: typeof m1; }> ->import("./index") : Promise<{ x: 1; default: typeof m1; }> +>_m36 : Promise +>import("./index") : Promise >"./index" : "./index" const _m37 = import("./subfolder"); ->_m37 : Promise<{ x: 1; default: typeof m4; }> ->import("./subfolder") : Promise<{ x: 1; default: typeof m4; }> +>_m37 : Promise +>import("./subfolder") : Promise >"./subfolder" : "./subfolder" const _m38 = import("./subfolder/"); ->_m38 : Promise<{ x: 1; default: typeof m4; }> ->import("./subfolder/") : Promise<{ x: 1; default: typeof m4; }> +>_m38 : Promise +>import("./subfolder/") : Promise >"./subfolder/" : "./subfolder/" const _m39 = import("./subfolder/index"); ->_m39 : Promise<{ x: 1; default: typeof m4; }> ->import("./subfolder/index") : Promise<{ x: 1; default: typeof m4; }> +>_m39 : Promise +>import("./subfolder/index") : Promise >"./subfolder/index" : "./subfolder/index" const _m40 = import("./subfolder2"); ->_m40 : Promise<{ x: 1; default: typeof m7; }> ->import("./subfolder2") : Promise<{ x: 1; default: typeof m7; }> +>_m40 : Promise +>import("./subfolder2") : Promise >"./subfolder2" : "./subfolder2" const _m41 = import("./subfolder2/"); ->_m41 : Promise<{ x: 1; default: typeof m7; }> ->import("./subfolder2/") : Promise<{ x: 1; default: typeof m7; }> +>_m41 : Promise +>import("./subfolder2/") : Promise >"./subfolder2/" : "./subfolder2/" const _m42 = import("./subfolder2/index"); ->_m42 : Promise<{ x: 1; default: typeof m7; }> ->import("./subfolder2/index") : Promise<{ x: 1; default: typeof m7; }> +>_m42 : Promise +>import("./subfolder2/index") : Promise >"./subfolder2/index" : "./subfolder2/index" const _m43 = import("./subfolder2/another"); ->_m43 : Promise<{ x: 1; default: typeof m10; }> ->import("./subfolder2/another") : Promise<{ x: 1; default: typeof m10; }> +>_m43 : Promise +>import("./subfolder2/another") : Promise >"./subfolder2/another" : "./subfolder2/another" const _m44 = import("./subfolder2/another/"); ->_m44 : Promise<{ x: 1; default: typeof m10; }> ->import("./subfolder2/another/") : Promise<{ x: 1; default: typeof m10; }> +>_m44 : Promise +>import("./subfolder2/another/") : Promise >"./subfolder2/another/" : "./subfolder2/another/" const _m45 = import("./subfolder2/another/index"); ->_m45 : Promise<{ x: 1; default: typeof m10; }> ->import("./subfolder2/another/index") : Promise<{ x: 1; default: typeof m10; }> +>_m45 : Promise +>import("./subfolder2/another/index") : Promise >"./subfolder2/another/index" : "./subfolder2/another/index" // cjs format file @@ -731,37 +731,37 @@ import * as m12 from "./subfolder2/another/index.cjs"; // The next ones shouldn't all work - esm format files have no index resolution or extension resolution import * as m13 from "./"; ->m13 : typeof m1 +>m13 : any import * as m14 from "./index"; ->m14 : typeof m1 +>m14 : any import * as m15 from "./subfolder"; ->m15 : typeof m4 +>m15 : any import * as m16 from "./subfolder/"; ->m16 : typeof m4 +>m16 : any import * as m17 from "./subfolder/index"; ->m17 : typeof m4 +>m17 : any import * as m18 from "./subfolder2"; ->m18 : typeof m7 +>m18 : any import * as m19 from "./subfolder2/"; ->m19 : typeof m7 +>m19 : any import * as m20 from "./subfolder2/index"; ->m20 : typeof m7 +>m20 : any import * as m21 from "./subfolder2/another"; ->m21 : typeof m10 +>m21 : any import * as m22 from "./subfolder2/another/"; ->m22 : typeof m10 +>m22 : any import * as m23 from "./subfolder2/another/index"; ->m23 : typeof m10 +>m23 : any void m1; >void m1 : undefined @@ -813,47 +813,47 @@ void m12; void m13; >void m13 : undefined ->m13 : typeof m1 +>m13 : any void m14; >void m14 : undefined ->m14 : typeof m1 +>m14 : any void m15; >void m15 : undefined ->m15 : typeof m4 +>m15 : any void m16; >void m16 : undefined ->m16 : typeof m4 +>m16 : any void m17; >void m17 : undefined ->m17 : typeof m4 +>m17 : any void m18; >void m18 : undefined ->m18 : typeof m7 +>m18 : any void m19; >void m19 : undefined ->m19 : typeof m7 +>m19 : any void m20; >void m20 : undefined ->m20 : typeof m7 +>m20 : any void m21; >void m21 : undefined ->m21 : typeof m10 +>m21 : any void m22; >void m22 : undefined ->m22 : typeof m10 +>m22 : any void m23; >void m23 : undefined ->m23 : typeof m10 +>m23 : any // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) import m24 = require("./"); @@ -863,22 +863,22 @@ import m25 = require("./index"); >m25 : typeof m1 import m26 = require("./subfolder"); ->m26 : typeof m4 +>m26 : typeof m26 import m27 = require("./subfolder/"); ->m27 : typeof m4 +>m27 : typeof m26 import m28 = require("./subfolder/index"); ->m28 : typeof m4 +>m28 : typeof m26 import m29 = require("./subfolder2"); ->m29 : typeof m7 +>m29 : typeof m29 import m30 = require("./subfolder2/"); ->m30 : typeof m7 +>m30 : typeof m29 import m31 = require("./subfolder2/index"); ->m31 : typeof m7 +>m31 : typeof m29 import m32 = require("./subfolder2/another"); >m32 : typeof m10 @@ -899,27 +899,27 @@ void m25; void m26; >void m26 : undefined ->m26 : typeof m4 +>m26 : typeof m26 void m27; >void m27 : undefined ->m27 : typeof m4 +>m27 : typeof m26 void m28; >void m28 : undefined ->m28 : typeof m4 +>m28 : typeof m26 void m29; >void m29 : undefined ->m29 : typeof m7 +>m29 : typeof m29 void m30; >void m30 : undefined ->m30 : typeof m7 +>m30 : typeof m29 void m31; >void m31 : undefined ->m31 : typeof m7 +>m31 : typeof m29 void m32; >void m32 : undefined @@ -935,58 +935,58 @@ void m34; // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); ->_m35 : Promise<{ x: 1; default: typeof m1; }> ->import("./") : Promise<{ x: 1; default: typeof m1; }> +>_m35 : Promise +>import("./") : Promise >"./" : "./" const _m36 = import("./index"); ->_m36 : Promise<{ x: 1; default: typeof m1; }> ->import("./index") : Promise<{ x: 1; default: typeof m1; }> +>_m36 : Promise +>import("./index") : Promise >"./index" : "./index" const _m37 = import("./subfolder"); ->_m37 : Promise<{ x: 1; default: typeof m4; }> ->import("./subfolder") : Promise<{ x: 1; default: typeof m4; }> +>_m37 : Promise +>import("./subfolder") : Promise >"./subfolder" : "./subfolder" const _m38 = import("./subfolder/"); ->_m38 : Promise<{ x: 1; default: typeof m4; }> ->import("./subfolder/") : Promise<{ x: 1; default: typeof m4; }> +>_m38 : Promise +>import("./subfolder/") : Promise >"./subfolder/" : "./subfolder/" const _m39 = import("./subfolder/index"); ->_m39 : Promise<{ x: 1; default: typeof m4; }> ->import("./subfolder/index") : Promise<{ x: 1; default: typeof m4; }> +>_m39 : Promise +>import("./subfolder/index") : Promise >"./subfolder/index" : "./subfolder/index" const _m40 = import("./subfolder2"); ->_m40 : Promise<{ x: 1; default: typeof m7; }> ->import("./subfolder2") : Promise<{ x: 1; default: typeof m7; }> +>_m40 : Promise +>import("./subfolder2") : Promise >"./subfolder2" : "./subfolder2" const _m41 = import("./subfolder2/"); ->_m41 : Promise<{ x: 1; default: typeof m7; }> ->import("./subfolder2/") : Promise<{ x: 1; default: typeof m7; }> +>_m41 : Promise +>import("./subfolder2/") : Promise >"./subfolder2/" : "./subfolder2/" const _m42 = import("./subfolder2/index"); ->_m42 : Promise<{ x: 1; default: typeof m7; }> ->import("./subfolder2/index") : Promise<{ x: 1; default: typeof m7; }> +>_m42 : Promise +>import("./subfolder2/index") : Promise >"./subfolder2/index" : "./subfolder2/index" const _m43 = import("./subfolder2/another"); ->_m43 : Promise<{ x: 1; default: typeof m10; }> ->import("./subfolder2/another") : Promise<{ x: 1; default: typeof m10; }> +>_m43 : Promise +>import("./subfolder2/another") : Promise >"./subfolder2/another" : "./subfolder2/another" const _m44 = import("./subfolder2/another/"); ->_m44 : Promise<{ x: 1; default: typeof m10; }> ->import("./subfolder2/another/") : Promise<{ x: 1; default: typeof m10; }> +>_m44 : Promise +>import("./subfolder2/another/") : Promise >"./subfolder2/another/" : "./subfolder2/another/" const _m45 = import("./subfolder2/another/index"); ->_m45 : Promise<{ x: 1; default: typeof m10; }> ->import("./subfolder2/another/index") : Promise<{ x: 1; default: typeof m10; }> +>_m45 : Promise +>import("./subfolder2/another/index") : Promise >"./subfolder2/another/index" : "./subfolder2/another/index" // esm format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).types.diff deleted file mode 100644 index d92021de77..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=node20).types.diff +++ /dev/null @@ -1,587 +0,0 @@ ---- old.nodeModules1(module=node20).types -+++ new.nodeModules1(module=node20).types -@@= skipped -119, +119 lines =@@ - - // The next ones should all fail - esm format files have no index resolution or extension resolution - import * as m13 from "./"; -->m13 : any -+>m13 : typeof m1 - - import * as m14 from "./index"; -->m14 : any -+>m14 : typeof m1 - - import * as m15 from "./subfolder"; -->m15 : any -+>m15 : typeof m4 - - import * as m16 from "./subfolder/"; -->m16 : any -+>m16 : typeof m4 - - import * as m17 from "./subfolder/index"; -->m17 : any -+>m17 : typeof m4 - - import * as m18 from "./subfolder2"; -->m18 : any -+>m18 : typeof m7 - - import * as m19 from "./subfolder2/"; -->m19 : any -+>m19 : typeof m7 - - import * as m20 from "./subfolder2/index"; -->m20 : any -+>m20 : typeof m7 - - import * as m21 from "./subfolder2/another"; -->m21 : any -+>m21 : typeof m10 - - import * as m22 from "./subfolder2/another/"; -->m22 : any -+>m22 : typeof m10 - - import * as m23 from "./subfolder2/another/index"; -->m23 : any -+>m23 : typeof m10 - - void m1; - >void m1 : undefined -@@= skipped -82, +82 lines =@@ - - void m13; - >void m13 : undefined -->m13 : any -+>m13 : typeof m1 - - void m14; - >void m14 : undefined -->m14 : any -+>m14 : typeof m1 - - void m15; - >void m15 : undefined -->m15 : any -+>m15 : typeof m4 - - void m16; - >void m16 : undefined -->m16 : any -+>m16 : typeof m4 - - void m17; - >void m17 : undefined -->m17 : any -+>m17 : typeof m4 - - void m18; - >void m18 : undefined -->m18 : any -+>m18 : typeof m7 - - void m19; - >void m19 : undefined -->m19 : any -+>m19 : typeof m7 - - void m20; - >void m20 : undefined -->m20 : any -+>m20 : typeof m7 - - void m21; - >void m21 : undefined -->m21 : any -+>m21 : typeof m10 - - void m22; - >void m22 : undefined -->m22 : any -+>m22 : typeof m10 - - void m23; - >void m23 : undefined -->m23 : any -+>m23 : typeof m10 - - // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) - import m24 = require("./"); -@@= skipped -50, +50 lines =@@ - >m25 : typeof m1 - - import m26 = require("./subfolder"); -->m26 : typeof m26 -+>m26 : typeof m4 - - import m27 = require("./subfolder/"); -->m27 : typeof m26 -+>m27 : typeof m4 - - import m28 = require("./subfolder/index"); -->m28 : typeof m26 -+>m28 : typeof m4 - - import m29 = require("./subfolder2"); -->m29 : typeof m29 -+>m29 : typeof m7 - - import m30 = require("./subfolder2/"); -->m30 : typeof m29 -+>m30 : typeof m7 - - import m31 = require("./subfolder2/index"); -->m31 : typeof m29 -+>m31 : typeof m7 - - import m32 = require("./subfolder2/another"); - >m32 : typeof m10 -@@= skipped -36, +36 lines =@@ - - void m26; - >void m26 : undefined -->m26 : typeof m26 -+>m26 : typeof m4 - - void m27; - >void m27 : undefined -->m27 : typeof m26 -+>m27 : typeof m4 - - void m28; - >void m28 : undefined -->m28 : typeof m26 -+>m28 : typeof m4 - - void m29; - >void m29 : undefined -->m29 : typeof m29 -+>m29 : typeof m7 - - void m30; - >void m30 : undefined -->m30 : typeof m29 -+>m30 : typeof m7 - - void m31; - >void m31 : undefined -->m31 : typeof m29 -+>m31 : typeof m7 - - void m32; - >void m32 : undefined -@@= skipped -36, +36 lines =@@ - - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); -->_m35 : Promise -->import("./") : Promise -+>_m35 : Promise<{ x: 1; default: typeof m1; }> -+>import("./") : Promise<{ x: 1; default: typeof m1; }> - >"./" : "./" - - const _m36 = import("./index"); -->_m36 : Promise -->import("./index") : Promise -+>_m36 : Promise<{ x: 1; default: typeof m1; }> -+>import("./index") : Promise<{ x: 1; default: typeof m1; }> - >"./index" : "./index" - - const _m37 = import("./subfolder"); -->_m37 : Promise -->import("./subfolder") : Promise -+>_m37 : Promise<{ x: 1; default: typeof m4; }> -+>import("./subfolder") : Promise<{ x: 1; default: typeof m4; }> - >"./subfolder" : "./subfolder" - - const _m38 = import("./subfolder/"); -->_m38 : Promise -->import("./subfolder/") : Promise -+>_m38 : Promise<{ x: 1; default: typeof m4; }> -+>import("./subfolder/") : Promise<{ x: 1; default: typeof m4; }> - >"./subfolder/" : "./subfolder/" - - const _m39 = import("./subfolder/index"); -->_m39 : Promise -->import("./subfolder/index") : Promise -+>_m39 : Promise<{ x: 1; default: typeof m4; }> -+>import("./subfolder/index") : Promise<{ x: 1; default: typeof m4; }> - >"./subfolder/index" : "./subfolder/index" - - const _m40 = import("./subfolder2"); -->_m40 : Promise -->import("./subfolder2") : Promise -+>_m40 : Promise<{ x: 1; default: typeof m7; }> -+>import("./subfolder2") : Promise<{ x: 1; default: typeof m7; }> - >"./subfolder2" : "./subfolder2" - - const _m41 = import("./subfolder2/"); -->_m41 : Promise -->import("./subfolder2/") : Promise -+>_m41 : Promise<{ x: 1; default: typeof m7; }> -+>import("./subfolder2/") : Promise<{ x: 1; default: typeof m7; }> - >"./subfolder2/" : "./subfolder2/" - - const _m42 = import("./subfolder2/index"); -->_m42 : Promise -->import("./subfolder2/index") : Promise -+>_m42 : Promise<{ x: 1; default: typeof m7; }> -+>import("./subfolder2/index") : Promise<{ x: 1; default: typeof m7; }> - >"./subfolder2/index" : "./subfolder2/index" - - const _m43 = import("./subfolder2/another"); -->_m43 : Promise -->import("./subfolder2/another") : Promise -+>_m43 : Promise<{ x: 1; default: typeof m10; }> -+>import("./subfolder2/another") : Promise<{ x: 1; default: typeof m10; }> - >"./subfolder2/another" : "./subfolder2/another" - - const _m44 = import("./subfolder2/another/"); -->_m44 : Promise -->import("./subfolder2/another/") : Promise -+>_m44 : Promise<{ x: 1; default: typeof m10; }> -+>import("./subfolder2/another/") : Promise<{ x: 1; default: typeof m10; }> - >"./subfolder2/another/" : "./subfolder2/another/" - - const _m45 = import("./subfolder2/another/index"); -->_m45 : Promise -->import("./subfolder2/another/index") : Promise -+>_m45 : Promise<{ x: 1; default: typeof m10; }> -+>import("./subfolder2/another/index") : Promise<{ x: 1; default: typeof m10; }> - >"./subfolder2/another/index" : "./subfolder2/another/index" - - // esm format file -@@= skipped -306, +306 lines =@@ - - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); -->_m35 : Promise -->import("./") : Promise -+>_m35 : Promise<{ x: 1; default: typeof m1; }> -+>import("./") : Promise<{ x: 1; default: typeof m1; }> - >"./" : "./" - - const _m36 = import("./index"); -->_m36 : Promise -->import("./index") : Promise -+>_m36 : Promise<{ x: 1; default: typeof m1; }> -+>import("./index") : Promise<{ x: 1; default: typeof m1; }> - >"./index" : "./index" - - const _m37 = import("./subfolder"); -->_m37 : Promise -->import("./subfolder") : Promise -+>_m37 : Promise<{ x: 1; default: typeof m4; }> -+>import("./subfolder") : Promise<{ x: 1; default: typeof m4; }> - >"./subfolder" : "./subfolder" - - const _m38 = import("./subfolder/"); -->_m38 : Promise -->import("./subfolder/") : Promise -+>_m38 : Promise<{ x: 1; default: typeof m4; }> -+>import("./subfolder/") : Promise<{ x: 1; default: typeof m4; }> - >"./subfolder/" : "./subfolder/" - - const _m39 = import("./subfolder/index"); -->_m39 : Promise -->import("./subfolder/index") : Promise -+>_m39 : Promise<{ x: 1; default: typeof m4; }> -+>import("./subfolder/index") : Promise<{ x: 1; default: typeof m4; }> - >"./subfolder/index" : "./subfolder/index" - - const _m40 = import("./subfolder2"); -->_m40 : Promise -->import("./subfolder2") : Promise -+>_m40 : Promise<{ x: 1; default: typeof m7; }> -+>import("./subfolder2") : Promise<{ x: 1; default: typeof m7; }> - >"./subfolder2" : "./subfolder2" - - const _m41 = import("./subfolder2/"); -->_m41 : Promise -->import("./subfolder2/") : Promise -+>_m41 : Promise<{ x: 1; default: typeof m7; }> -+>import("./subfolder2/") : Promise<{ x: 1; default: typeof m7; }> - >"./subfolder2/" : "./subfolder2/" - - const _m42 = import("./subfolder2/index"); -->_m42 : Promise -->import("./subfolder2/index") : Promise -+>_m42 : Promise<{ x: 1; default: typeof m7; }> -+>import("./subfolder2/index") : Promise<{ x: 1; default: typeof m7; }> - >"./subfolder2/index" : "./subfolder2/index" - - const _m43 = import("./subfolder2/another"); -->_m43 : Promise -->import("./subfolder2/another") : Promise -+>_m43 : Promise<{ x: 1; default: typeof m10; }> -+>import("./subfolder2/another") : Promise<{ x: 1; default: typeof m10; }> - >"./subfolder2/another" : "./subfolder2/another" - - const _m44 = import("./subfolder2/another/"); -->_m44 : Promise -->import("./subfolder2/another/") : Promise -+>_m44 : Promise<{ x: 1; default: typeof m10; }> -+>import("./subfolder2/another/") : Promise<{ x: 1; default: typeof m10; }> - >"./subfolder2/another/" : "./subfolder2/another/" - - const _m45 = import("./subfolder2/another/index"); -->_m45 : Promise -->import("./subfolder2/another/index") : Promise -+>_m45 : Promise<{ x: 1; default: typeof m10; }> -+>import("./subfolder2/another/index") : Promise<{ x: 1; default: typeof m10; }> - >"./subfolder2/another/index" : "./subfolder2/another/index" - - // cjs format file -@@= skipped -101, +101 lines =@@ - - // The next ones shouldn't all work - esm format files have no index resolution or extension resolution - import * as m13 from "./"; -->m13 : any -+>m13 : typeof m1 - - import * as m14 from "./index"; -->m14 : any -+>m14 : typeof m1 - - import * as m15 from "./subfolder"; -->m15 : any -+>m15 : typeof m4 - - import * as m16 from "./subfolder/"; -->m16 : any -+>m16 : typeof m4 - - import * as m17 from "./subfolder/index"; -->m17 : any -+>m17 : typeof m4 - - import * as m18 from "./subfolder2"; -->m18 : any -+>m18 : typeof m7 - - import * as m19 from "./subfolder2/"; -->m19 : any -+>m19 : typeof m7 - - import * as m20 from "./subfolder2/index"; -->m20 : any -+>m20 : typeof m7 - - import * as m21 from "./subfolder2/another"; -->m21 : any -+>m21 : typeof m10 - - import * as m22 from "./subfolder2/another/"; -->m22 : any -+>m22 : typeof m10 - - import * as m23 from "./subfolder2/another/index"; -->m23 : any -+>m23 : typeof m10 - - void m1; - >void m1 : undefined -@@= skipped -82, +82 lines =@@ - - void m13; - >void m13 : undefined -->m13 : any -+>m13 : typeof m1 - - void m14; - >void m14 : undefined -->m14 : any -+>m14 : typeof m1 - - void m15; - >void m15 : undefined -->m15 : any -+>m15 : typeof m4 - - void m16; - >void m16 : undefined -->m16 : any -+>m16 : typeof m4 - - void m17; - >void m17 : undefined -->m17 : any -+>m17 : typeof m4 - - void m18; - >void m18 : undefined -->m18 : any -+>m18 : typeof m7 - - void m19; - >void m19 : undefined -->m19 : any -+>m19 : typeof m7 - - void m20; - >void m20 : undefined -->m20 : any -+>m20 : typeof m7 - - void m21; - >void m21 : undefined -->m21 : any -+>m21 : typeof m10 - - void m22; - >void m22 : undefined -->m22 : any -+>m22 : typeof m10 - - void m23; - >void m23 : undefined -->m23 : any -+>m23 : typeof m10 - - // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) - import m24 = require("./"); -@@= skipped -50, +50 lines =@@ - >m25 : typeof m1 - - import m26 = require("./subfolder"); -->m26 : typeof m26 -+>m26 : typeof m4 - - import m27 = require("./subfolder/"); -->m27 : typeof m26 -+>m27 : typeof m4 - - import m28 = require("./subfolder/index"); -->m28 : typeof m26 -+>m28 : typeof m4 - - import m29 = require("./subfolder2"); -->m29 : typeof m29 -+>m29 : typeof m7 - - import m30 = require("./subfolder2/"); -->m30 : typeof m29 -+>m30 : typeof m7 - - import m31 = require("./subfolder2/index"); -->m31 : typeof m29 -+>m31 : typeof m7 - - import m32 = require("./subfolder2/another"); - >m32 : typeof m10 -@@= skipped -36, +36 lines =@@ - - void m26; - >void m26 : undefined -->m26 : typeof m26 -+>m26 : typeof m4 - - void m27; - >void m27 : undefined -->m27 : typeof m26 -+>m27 : typeof m4 - - void m28; - >void m28 : undefined -->m28 : typeof m26 -+>m28 : typeof m4 - - void m29; - >void m29 : undefined -->m29 : typeof m29 -+>m29 : typeof m7 - - void m30; - >void m30 : undefined -->m30 : typeof m29 -+>m30 : typeof m7 - - void m31; - >void m31 : undefined -->m31 : typeof m29 -+>m31 : typeof m7 - - void m32; - >void m32 : undefined -@@= skipped -36, +36 lines =@@ - - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); -->_m35 : Promise -->import("./") : Promise -+>_m35 : Promise<{ x: 1; default: typeof m1; }> -+>import("./") : Promise<{ x: 1; default: typeof m1; }> - >"./" : "./" - - const _m36 = import("./index"); -->_m36 : Promise -->import("./index") : Promise -+>_m36 : Promise<{ x: 1; default: typeof m1; }> -+>import("./index") : Promise<{ x: 1; default: typeof m1; }> - >"./index" : "./index" - - const _m37 = import("./subfolder"); -->_m37 : Promise -->import("./subfolder") : Promise -+>_m37 : Promise<{ x: 1; default: typeof m4; }> -+>import("./subfolder") : Promise<{ x: 1; default: typeof m4; }> - >"./subfolder" : "./subfolder" - - const _m38 = import("./subfolder/"); -->_m38 : Promise -->import("./subfolder/") : Promise -+>_m38 : Promise<{ x: 1; default: typeof m4; }> -+>import("./subfolder/") : Promise<{ x: 1; default: typeof m4; }> - >"./subfolder/" : "./subfolder/" - - const _m39 = import("./subfolder/index"); -->_m39 : Promise -->import("./subfolder/index") : Promise -+>_m39 : Promise<{ x: 1; default: typeof m4; }> -+>import("./subfolder/index") : Promise<{ x: 1; default: typeof m4; }> - >"./subfolder/index" : "./subfolder/index" - - const _m40 = import("./subfolder2"); -->_m40 : Promise -->import("./subfolder2") : Promise -+>_m40 : Promise<{ x: 1; default: typeof m7; }> -+>import("./subfolder2") : Promise<{ x: 1; default: typeof m7; }> - >"./subfolder2" : "./subfolder2" - - const _m41 = import("./subfolder2/"); -->_m41 : Promise -->import("./subfolder2/") : Promise -+>_m41 : Promise<{ x: 1; default: typeof m7; }> -+>import("./subfolder2/") : Promise<{ x: 1; default: typeof m7; }> - >"./subfolder2/" : "./subfolder2/" - - const _m42 = import("./subfolder2/index"); -->_m42 : Promise -->import("./subfolder2/index") : Promise -+>_m42 : Promise<{ x: 1; default: typeof m7; }> -+>import("./subfolder2/index") : Promise<{ x: 1; default: typeof m7; }> - >"./subfolder2/index" : "./subfolder2/index" - - const _m43 = import("./subfolder2/another"); -->_m43 : Promise -->import("./subfolder2/another") : Promise -+>_m43 : Promise<{ x: 1; default: typeof m10; }> -+>import("./subfolder2/another") : Promise<{ x: 1; default: typeof m10; }> - >"./subfolder2/another" : "./subfolder2/another" - - const _m44 = import("./subfolder2/another/"); -->_m44 : Promise -->import("./subfolder2/another/") : Promise -+>_m44 : Promise<{ x: 1; default: typeof m10; }> -+>import("./subfolder2/another/") : Promise<{ x: 1; default: typeof m10; }> - >"./subfolder2/another/" : "./subfolder2/another/" - - const _m45 = import("./subfolder2/another/index"); -->_m45 : Promise -->import("./subfolder2/another/index") : Promise -+>_m45 : Promise<{ x: 1; default: typeof m10; }> -+>import("./subfolder2/another/index") : Promise<{ x: 1; default: typeof m10; }> - >"./subfolder2/another/index" : "./subfolder2/another/index" - - // esm format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=nodenext).types index bcf4d98022..c711491553 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=nodenext).types @@ -252,22 +252,22 @@ import m25 = require("./index"); >m25 : typeof m1 import m26 = require("./subfolder"); ->m26 : typeof m4 +>m26 : typeof m26 import m27 = require("./subfolder/"); ->m27 : typeof m4 +>m27 : typeof m26 import m28 = require("./subfolder/index"); ->m28 : typeof m4 +>m28 : typeof m26 import m29 = require("./subfolder2"); ->m29 : typeof m7 +>m29 : typeof m29 import m30 = require("./subfolder2/"); ->m30 : typeof m7 +>m30 : typeof m29 import m31 = require("./subfolder2/index"); ->m31 : typeof m7 +>m31 : typeof m29 import m32 = require("./subfolder2/another"); >m32 : typeof m10 @@ -288,27 +288,27 @@ void m25; void m26; >void m26 : undefined ->m26 : typeof m4 +>m26 : typeof m26 void m27; >void m27 : undefined ->m27 : typeof m4 +>m27 : typeof m26 void m28; >void m28 : undefined ->m28 : typeof m4 +>m28 : typeof m26 void m29; >void m29 : undefined ->m29 : typeof m7 +>m29 : typeof m29 void m30; >void m30 : undefined ->m30 : typeof m7 +>m30 : typeof m29 void m31; >void m31 : undefined ->m31 : typeof m7 +>m31 : typeof m29 void m32; >void m32 : undefined @@ -863,22 +863,22 @@ import m25 = require("./index"); >m25 : typeof m1 import m26 = require("./subfolder"); ->m26 : typeof m4 +>m26 : typeof m26 import m27 = require("./subfolder/"); ->m27 : typeof m4 +>m27 : typeof m26 import m28 = require("./subfolder/index"); ->m28 : typeof m4 +>m28 : typeof m26 import m29 = require("./subfolder2"); ->m29 : typeof m7 +>m29 : typeof m29 import m30 = require("./subfolder2/"); ->m30 : typeof m7 +>m30 : typeof m29 import m31 = require("./subfolder2/index"); ->m31 : typeof m7 +>m31 : typeof m29 import m32 = require("./subfolder2/another"); >m32 : typeof m10 @@ -899,27 +899,27 @@ void m25; void m26; >void m26 : undefined ->m26 : typeof m4 +>m26 : typeof m26 void m27; >void m27 : undefined ->m27 : typeof m4 +>m27 : typeof m26 void m28; >void m28 : undefined ->m28 : typeof m4 +>m28 : typeof m26 void m29; >void m29 : undefined ->m29 : typeof m7 +>m29 : typeof m29 void m30; >void m30 : undefined ->m30 : typeof m7 +>m30 : typeof m29 void m31; >void m31 : undefined ->m31 : typeof m7 +>m31 : typeof m29 void m32; >void m32 : undefined diff --git a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModules1(module=nodenext).types.diff deleted file mode 100644 index 517e3fdbd6..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModules1(module=nodenext).types.diff +++ /dev/null @@ -1,128 +0,0 @@ ---- old.nodeModules1(module=nodenext).types -+++ new.nodeModules1(module=nodenext).types -@@= skipped -251, +251 lines =@@ - >m25 : typeof m1 - - import m26 = require("./subfolder"); -->m26 : typeof m26 -+>m26 : typeof m4 - - import m27 = require("./subfolder/"); -->m27 : typeof m26 -+>m27 : typeof m4 - - import m28 = require("./subfolder/index"); -->m28 : typeof m26 -+>m28 : typeof m4 - - import m29 = require("./subfolder2"); -->m29 : typeof m29 -+>m29 : typeof m7 - - import m30 = require("./subfolder2/"); -->m30 : typeof m29 -+>m30 : typeof m7 - - import m31 = require("./subfolder2/index"); -->m31 : typeof m29 -+>m31 : typeof m7 - - import m32 = require("./subfolder2/another"); - >m32 : typeof m10 -@@= skipped -36, +36 lines =@@ - - void m26; - >void m26 : undefined -->m26 : typeof m26 -+>m26 : typeof m4 - - void m27; - >void m27 : undefined -->m27 : typeof m26 -+>m27 : typeof m4 - - void m28; - >void m28 : undefined -->m28 : typeof m26 -+>m28 : typeof m4 - - void m29; - >void m29 : undefined -->m29 : typeof m29 -+>m29 : typeof m7 - - void m30; - >void m30 : undefined -->m30 : typeof m29 -+>m30 : typeof m7 - - void m31; - >void m31 : undefined -->m31 : typeof m29 -+>m31 : typeof m7 - - void m32; - >void m32 : undefined -@@= skipped -575, +575 lines =@@ - >m25 : typeof m1 - - import m26 = require("./subfolder"); -->m26 : typeof m26 -+>m26 : typeof m4 - - import m27 = require("./subfolder/"); -->m27 : typeof m26 -+>m27 : typeof m4 - - import m28 = require("./subfolder/index"); -->m28 : typeof m26 -+>m28 : typeof m4 - - import m29 = require("./subfolder2"); -->m29 : typeof m29 -+>m29 : typeof m7 - - import m30 = require("./subfolder2/"); -->m30 : typeof m29 -+>m30 : typeof m7 - - import m31 = require("./subfolder2/index"); -->m31 : typeof m29 -+>m31 : typeof m7 - - import m32 = require("./subfolder2/another"); - >m32 : typeof m10 -@@= skipped -36, +36 lines =@@ - - void m26; - >void m26 : undefined -->m26 : typeof m26 -+>m26 : typeof m4 - - void m27; - >void m27 : undefined -->m27 : typeof m26 -+>m27 : typeof m4 - - void m28; - >void m28 : undefined -->m28 : typeof m26 -+>m28 : typeof m4 - - void m29; - >void m29 : undefined -->m29 : typeof m29 -+>m29 : typeof m7 - - void m30; - >void m30 : undefined -->m30 : typeof m29 -+>m30 : typeof m7 - - void m31; - >void m31 : undefined -->m31 : typeof m29 -+>m31 : typeof m7 - - void m32; - >void m32 : undefined \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node16).types index dcb59ef72a..c05889cd7f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node16).types @@ -252,22 +252,22 @@ import m25 = require("./index"); >m25 : typeof m1 import m26 = require("./subfolder"); ->m26 : typeof m4 +>m26 : typeof m26 import m27 = require("./subfolder/"); ->m27 : typeof m4 +>m27 : typeof m26 import m28 = require("./subfolder/index"); ->m28 : typeof m4 +>m28 : typeof m26 import m29 = require("./subfolder2"); ->m29 : typeof m7 +>m29 : typeof m29 import m30 = require("./subfolder2/"); ->m30 : typeof m7 +>m30 : typeof m29 import m31 = require("./subfolder2/index"); ->m31 : typeof m7 +>m31 : typeof m29 import m32 = require("./subfolder2/another"); >m32 : typeof m10 @@ -288,27 +288,27 @@ void m25; void m26; >void m26 : undefined ->m26 : typeof m4 +>m26 : typeof m26 void m27; >void m27 : undefined ->m27 : typeof m4 +>m27 : typeof m26 void m28; >void m28 : undefined ->m28 : typeof m4 +>m28 : typeof m26 void m29; >void m29 : undefined ->m29 : typeof m7 +>m29 : typeof m29 void m30; >void m30 : undefined ->m30 : typeof m7 +>m30 : typeof m29 void m31; >void m31 : undefined ->m31 : typeof m7 +>m31 : typeof m29 void m32; >void m32 : undefined @@ -863,22 +863,22 @@ import m25 = require("./index"); >m25 : typeof m1 import m26 = require("./subfolder"); ->m26 : typeof m4 +>m26 : typeof m26 import m27 = require("./subfolder/"); ->m27 : typeof m4 +>m27 : typeof m26 import m28 = require("./subfolder/index"); ->m28 : typeof m4 +>m28 : typeof m26 import m29 = require("./subfolder2"); ->m29 : typeof m7 +>m29 : typeof m29 import m30 = require("./subfolder2/"); ->m30 : typeof m7 +>m30 : typeof m29 import m31 = require("./subfolder2/index"); ->m31 : typeof m7 +>m31 : typeof m29 import m32 = require("./subfolder2/another"); >m32 : typeof m10 @@ -899,27 +899,27 @@ void m25; void m26; >void m26 : undefined ->m26 : typeof m4 +>m26 : typeof m26 void m27; >void m27 : undefined ->m27 : typeof m4 +>m27 : typeof m26 void m28; >void m28 : undefined ->m28 : typeof m4 +>m28 : typeof m26 void m29; >void m29 : undefined ->m29 : typeof m7 +>m29 : typeof m29 void m30; >void m30 : undefined ->m30 : typeof m7 +>m30 : typeof m29 void m31; >void m31 : undefined ->m31 : typeof m7 +>m31 : typeof m29 void m32; >void m32 : undefined diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node18).types index dcb59ef72a..c05889cd7f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node18).types @@ -252,22 +252,22 @@ import m25 = require("./index"); >m25 : typeof m1 import m26 = require("./subfolder"); ->m26 : typeof m4 +>m26 : typeof m26 import m27 = require("./subfolder/"); ->m27 : typeof m4 +>m27 : typeof m26 import m28 = require("./subfolder/index"); ->m28 : typeof m4 +>m28 : typeof m26 import m29 = require("./subfolder2"); ->m29 : typeof m7 +>m29 : typeof m29 import m30 = require("./subfolder2/"); ->m30 : typeof m7 +>m30 : typeof m29 import m31 = require("./subfolder2/index"); ->m31 : typeof m7 +>m31 : typeof m29 import m32 = require("./subfolder2/another"); >m32 : typeof m10 @@ -288,27 +288,27 @@ void m25; void m26; >void m26 : undefined ->m26 : typeof m4 +>m26 : typeof m26 void m27; >void m27 : undefined ->m27 : typeof m4 +>m27 : typeof m26 void m28; >void m28 : undefined ->m28 : typeof m4 +>m28 : typeof m26 void m29; >void m29 : undefined ->m29 : typeof m7 +>m29 : typeof m29 void m30; >void m30 : undefined ->m30 : typeof m7 +>m30 : typeof m29 void m31; >void m31 : undefined ->m31 : typeof m7 +>m31 : typeof m29 void m32; >void m32 : undefined @@ -863,22 +863,22 @@ import m25 = require("./index"); >m25 : typeof m1 import m26 = require("./subfolder"); ->m26 : typeof m4 +>m26 : typeof m26 import m27 = require("./subfolder/"); ->m27 : typeof m4 +>m27 : typeof m26 import m28 = require("./subfolder/index"); ->m28 : typeof m4 +>m28 : typeof m26 import m29 = require("./subfolder2"); ->m29 : typeof m7 +>m29 : typeof m29 import m30 = require("./subfolder2/"); ->m30 : typeof m7 +>m30 : typeof m29 import m31 = require("./subfolder2/index"); ->m31 : typeof m7 +>m31 : typeof m29 import m32 = require("./subfolder2/another"); >m32 : typeof m10 @@ -899,27 +899,27 @@ void m25; void m26; >void m26 : undefined ->m26 : typeof m4 +>m26 : typeof m26 void m27; >void m27 : undefined ->m27 : typeof m4 +>m27 : typeof m26 void m28; >void m28 : undefined ->m28 : typeof m4 +>m28 : typeof m26 void m29; >void m29 : undefined ->m29 : typeof m7 +>m29 : typeof m29 void m30; >void m30 : undefined ->m30 : typeof m7 +>m30 : typeof m29 void m31; >void m31 : undefined ->m31 : typeof m7 +>m31 : typeof m29 void m32; >void m32 : undefined diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).errors.txt index 68c5252af9..ddbe7ecee4 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).errors.txt @@ -1,5 +1,3 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2468: Cannot find global value 'Promise'. index.cjs(51,1): error TS8002: 'import ... =' can only be used in TypeScript files. index.cjs(52,1): error TS8002: 'import ... =' can only be used in TypeScript files. index.cjs(53,1): error TS8002: 'import ... =' can only be used in TypeScript files. @@ -11,17 +9,28 @@ index.cjs(58,1): error TS8002: 'import ... =' can only be used in TypeScript fil index.cjs(59,1): error TS8002: 'import ... =' can only be used in TypeScript files. index.cjs(60,1): error TS8002: 'import ... =' can only be used in TypeScript files. index.cjs(61,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.cjs(75,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cjs(76,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cjs(77,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cjs(78,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cjs(79,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cjs(80,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cjs(81,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cjs(82,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cjs(83,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cjs(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.cjs(85,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +index.cjs(75,21): error TS2307: Cannot find module './' or its corresponding type declarations. +index.cjs(76,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? +index.cjs(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cjs(78,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cjs(79,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? +index.cjs(80,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cjs(81,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cjs(82,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +index.cjs(83,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cjs(84,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.cjs(85,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? +index.js(14,22): error TS2307: Cannot find module './' or its corresponding type declarations. +index.js(15,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? +index.js(16,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(17,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(18,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? +index.js(19,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(20,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(21,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +index.js(22,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(23,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(24,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? index.js(50,1): error TS8002: 'import ... =' can only be used in TypeScript files. index.js(51,1): error TS8002: 'import ... =' can only be used in TypeScript files. index.js(52,1): error TS8002: 'import ... =' can only be used in TypeScript files. @@ -33,17 +42,28 @@ index.js(57,1): error TS8002: 'import ... =' can only be used in TypeScript file index.js(58,1): error TS8002: 'import ... =' can only be used in TypeScript files. index.js(59,1): error TS8002: 'import ... =' can only be used in TypeScript files. index.js(60,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.js(74,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.js(75,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.js(76,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.js(77,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.js(78,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.js(79,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.js(80,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.js(81,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.js(82,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.js(83,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.js(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +index.js(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. +index.js(75,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? +index.js(76,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(78,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? +index.js(79,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(80,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(81,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +index.js(82,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(83,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.js(84,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? +index.mjs(14,22): error TS2307: Cannot find module './' or its corresponding type declarations. +index.mjs(15,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? +index.mjs(16,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(17,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(18,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? +index.mjs(19,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(20,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(21,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +index.mjs(22,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(23,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(24,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? index.mjs(50,1): error TS8002: 'import ... =' can only be used in TypeScript files. index.mjs(51,1): error TS8002: 'import ... =' can only be used in TypeScript files. index.mjs(52,1): error TS8002: 'import ... =' can only be used in TypeScript files. @@ -55,21 +75,19 @@ index.mjs(57,1): error TS8002: 'import ... =' can only be used in TypeScript fil index.mjs(58,1): error TS8002: 'import ... =' can only be used in TypeScript files. index.mjs(59,1): error TS8002: 'import ... =' can only be used in TypeScript files. index.mjs(60,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.mjs(74,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mjs(75,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mjs(76,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mjs(77,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mjs(78,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mjs(79,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mjs(80,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mjs(81,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mjs(82,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mjs(83,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.mjs(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +index.mjs(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. +index.mjs(75,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? +index.mjs(76,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(78,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? +index.mjs(79,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(80,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(81,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? +index.mjs(82,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(83,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. +index.mjs(84,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2468: Cannot find global value 'Promise'. ==== subfolder/index.js (0 errors) ==== // cjs format file const x = 1; @@ -106,7 +124,7 @@ index.mjs(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promi // esm format file const x = 1; export {x}; -==== index.js (22 errors) ==== +==== index.js (33 errors) ==== import * as m1 from "./index.js"; import * as m2 from "./index.mjs"; import * as m3 from "./index.cjs"; @@ -121,16 +139,38 @@ index.mjs(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promi import * as m12 from "./subfolder2/another/index.cjs"; // The next ones shouldn't all work - esm format files have no index resolution or extension resolution import * as m13 from "./"; + ~~~~ +!!! error TS2307: Cannot find module './' or its corresponding type declarations. import * as m14 from "./index"; + ~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? import * as m15 from "./subfolder"; + ~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m16 from "./subfolder/"; + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m17 from "./subfolder/index"; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? import * as m18 from "./subfolder2"; + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m19 from "./subfolder2/"; + ~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m20 from "./subfolder2/index"; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? import * as m21 from "./subfolder2/another"; + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m22 from "./subfolder2/another/"; + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m23 from "./subfolder2/another/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? void m1; void m2; void m3; @@ -203,38 +243,38 @@ index.mjs(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promi // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); - ~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~ +!!! error TS2307: Cannot find module './' or its corresponding type declarations. const _m36 = import("./index"); - ~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? const _m37 = import("./subfolder"); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m38 = import("./subfolder/"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m39 = import("./subfolder/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? const _m40 = import("./subfolder2"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m41 = import("./subfolder2/"); - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m42 = import("./subfolder2/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? const _m43 = import("./subfolder2/another"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m44 = import("./subfolder2/another/"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m45 = import("./subfolder2/another/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? // esm format file const x = 1; export {x}; @@ -336,42 +376,42 @@ index.mjs(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promi // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); - ~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~ +!!! error TS2307: Cannot find module './' or its corresponding type declarations. const _m36 = import("./index"); - ~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? const _m37 = import("./subfolder"); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m38 = import("./subfolder/"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m39 = import("./subfolder/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? const _m40 = import("./subfolder2"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m41 = import("./subfolder2/"); - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m42 = import("./subfolder2/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? const _m43 = import("./subfolder2/another"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m44 = import("./subfolder2/another/"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m45 = import("./subfolder2/another/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? // cjs format file const x = 1; export {x}; -==== index.mjs (22 errors) ==== +==== index.mjs (33 errors) ==== import * as m1 from "./index.js"; import * as m2 from "./index.mjs"; import * as m3 from "./index.cjs"; @@ -386,16 +426,38 @@ index.mjs(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promi import * as m12 from "./subfolder2/another/index.cjs"; // The next ones should all fail - esm format files have no index resolution or extension resolution import * as m13 from "./"; + ~~~~ +!!! error TS2307: Cannot find module './' or its corresponding type declarations. import * as m14 from "./index"; + ~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? import * as m15 from "./subfolder"; + ~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m16 from "./subfolder/"; + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m17 from "./subfolder/index"; + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? import * as m18 from "./subfolder2"; + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m19 from "./subfolder2/"; + ~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m20 from "./subfolder2/index"; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? import * as m21 from "./subfolder2/another"; + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m22 from "./subfolder2/another/"; + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. import * as m23 from "./subfolder2/another/index"; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? void m1; void m2; void m3; @@ -468,38 +530,38 @@ index.mjs(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promi // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); - ~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~ +!!! error TS2307: Cannot find module './' or its corresponding type declarations. const _m36 = import("./index"); - ~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? const _m37 = import("./subfolder"); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m38 = import("./subfolder/"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m39 = import("./subfolder/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? const _m40 = import("./subfolder2"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m41 = import("./subfolder2/"); - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m42 = import("./subfolder2/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? const _m43 = import("./subfolder2/another"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m44 = import("./subfolder2/another/"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. const _m45 = import("./subfolder2/another/index"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? // esm format file const x = 1; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).js index 351cfe80f4..c06a907294 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).js @@ -335,12 +335,9 @@ exports.x = void 0; const x = 1; exports.x = x; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = 1; -exports.x = x; +export { x }; //// [index.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -356,19 +353,13 @@ exports.x = void 0; const x = 1; exports.x = x; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = 1; -exports.x = x; +export { x }; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = 1; -exports.x = x; +export { x }; //// [index.cjs] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -377,41 +368,71 @@ exports.x = void 0; const x = 1; exports.x = x; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = 1; -exports.x = x; +export { x }; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.x = void 0; // ESM-format imports below should issue errors -const m1 = require("./index.js"); -const m2 = require("./index.mjs"); -const m3 = require("./index.cjs"); -const m4 = require("./subfolder/index.js"); -const m5 = require("./subfolder/index.mjs"); -const m6 = require("./subfolder/index.cjs"); -const m7 = require("./subfolder2/index.js"); -const m8 = require("./subfolder2/index.mjs"); -const m9 = require("./subfolder2/index.cjs"); -const m10 = require("./subfolder2/another/index.js"); -const m11 = require("./subfolder2/another/index.mjs"); -const m12 = require("./subfolder2/another/index.cjs"); +const m1 = __importStar(require("./index.js")); +const m2 = __importStar(require("./index.mjs")); +const m3 = __importStar(require("./index.cjs")); +const m4 = __importStar(require("./subfolder/index.js")); +const m5 = __importStar(require("./subfolder/index.mjs")); +const m6 = __importStar(require("./subfolder/index.cjs")); +const m7 = __importStar(require("./subfolder2/index.js")); +const m8 = __importStar(require("./subfolder2/index.mjs")); +const m9 = __importStar(require("./subfolder2/index.cjs")); +const m10 = __importStar(require("./subfolder2/another/index.js")); +const m11 = __importStar(require("./subfolder2/another/index.mjs")); +const m12 = __importStar(require("./subfolder2/another/index.cjs")); // The next ones should _mostly_ work - cjs format files have index resolution and extension resolution (except for those which resolve to an esm format file) -const m13 = require("./"); -const m14 = require("./index"); -const m15 = require("./subfolder"); -const m16 = require("./subfolder/"); -const m17 = require("./subfolder/index"); -const m18 = require("./subfolder2"); -const m19 = require("./subfolder2/"); -const m20 = require("./subfolder2/index"); -const m21 = require("./subfolder2/another"); -const m22 = require("./subfolder2/another/"); -const m23 = require("./subfolder2/another/index"); +const m13 = __importStar(require("./")); +const m14 = __importStar(require("./index")); +const m15 = __importStar(require("./subfolder")); +const m16 = __importStar(require("./subfolder/")); +const m17 = __importStar(require("./subfolder/index")); +const m18 = __importStar(require("./subfolder2")); +const m19 = __importStar(require("./subfolder2/")); +const m20 = __importStar(require("./subfolder2/index")); +const m21 = __importStar(require("./subfolder2/another")); +const m22 = __importStar(require("./subfolder2/another/")); +const m23 = __importStar(require("./subfolder2/another/index")); void m1; void m2; void m3; @@ -474,33 +495,32 @@ const _m45 = import("./subfolder2/another/index"); const x = 1; exports.x = x; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; -const m1 = require("./index.js"); -const m2 = require("./index.mjs"); -const m3 = require("./index.cjs"); -const m4 = require("./subfolder/index.js"); -const m5 = require("./subfolder/index.mjs"); -const m6 = require("./subfolder/index.cjs"); -const m7 = require("./subfolder2/index.js"); -const m8 = require("./subfolder2/index.mjs"); -const m9 = require("./subfolder2/index.cjs"); -const m10 = require("./subfolder2/another/index.js"); -const m11 = require("./subfolder2/another/index.mjs"); -const m12 = require("./subfolder2/another/index.cjs"); +import { createRequire as _createRequire } from "module"; +const __require = _createRequire(import.meta.url); +import * as m1 from "./index.js"; +import * as m2 from "./index.mjs"; +import * as m3 from "./index.cjs"; +import * as m4 from "./subfolder/index.js"; +import * as m5 from "./subfolder/index.mjs"; +import * as m6 from "./subfolder/index.cjs"; +import * as m7 from "./subfolder2/index.js"; +import * as m8 from "./subfolder2/index.mjs"; +import * as m9 from "./subfolder2/index.cjs"; +import * as m10 from "./subfolder2/another/index.js"; +import * as m11 from "./subfolder2/another/index.mjs"; +import * as m12 from "./subfolder2/another/index.cjs"; // The next ones should all fail - esm format files have no index resolution or extension resolution -const m13 = require("./"); -const m14 = require("./index"); -const m15 = require("./subfolder"); -const m16 = require("./subfolder/"); -const m17 = require("./subfolder/index"); -const m18 = require("./subfolder2"); -const m19 = require("./subfolder2/"); -const m20 = require("./subfolder2/index"); -const m21 = require("./subfolder2/another"); -const m22 = require("./subfolder2/another/"); -const m23 = require("./subfolder2/another/index"); +import * as m13 from "./"; +import * as m14 from "./index"; +import * as m15 from "./subfolder"; +import * as m16 from "./subfolder/"; +import * as m17 from "./subfolder/index"; +import * as m18 from "./subfolder2"; +import * as m19 from "./subfolder2/"; +import * as m20 from "./subfolder2/index"; +import * as m21 from "./subfolder2/another"; +import * as m22 from "./subfolder2/another/"; +import * as m23 from "./subfolder2/another/index"; void m1; void m2; void m3; @@ -525,17 +545,17 @@ void m21; void m22; void m23; // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) -const m24 = require("./"); -const m25 = require("./index"); -const m26 = require("./subfolder"); -const m27 = require("./subfolder/"); -const m28 = require("./subfolder/index"); -const m29 = require("./subfolder2"); -const m30 = require("./subfolder2/"); -const m31 = require("./subfolder2/index"); -const m32 = require("./subfolder2/another"); -const m33 = require("./subfolder2/another/"); -const m34 = require("./subfolder2/another/index"); +const m24 = __require("./"); +const m25 = __require("./index"); +const m26 = __require("./subfolder"); +const m27 = __require("./subfolder/"); +const m28 = __require("./subfolder/index"); +const m29 = __require("./subfolder2"); +const m30 = __require("./subfolder2/"); +const m31 = __require("./subfolder2/index"); +const m32 = __require("./subfolder2/another"); +const m33 = __require("./subfolder2/another/"); +const m34 = __require("./subfolder2/another/index"); void m24; void m25; void m26; @@ -561,35 +581,34 @@ const _m44 = import("./subfolder2/another/"); const _m45 = import("./subfolder2/another/index"); // esm format file const x = 1; -exports.x = x; +export { x }; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; -const m1 = require("./index.js"); -const m2 = require("./index.mjs"); -const m3 = require("./index.cjs"); -const m4 = require("./subfolder/index.js"); -const m5 = require("./subfolder/index.mjs"); -const m6 = require("./subfolder/index.cjs"); -const m7 = require("./subfolder2/index.js"); -const m8 = require("./subfolder2/index.mjs"); -const m9 = require("./subfolder2/index.cjs"); -const m10 = require("./subfolder2/another/index.js"); -const m11 = require("./subfolder2/another/index.mjs"); -const m12 = require("./subfolder2/another/index.cjs"); +import { createRequire as _createRequire } from "module"; +const __require = _createRequire(import.meta.url); +import * as m1 from "./index.js"; +import * as m2 from "./index.mjs"; +import * as m3 from "./index.cjs"; +import * as m4 from "./subfolder/index.js"; +import * as m5 from "./subfolder/index.mjs"; +import * as m6 from "./subfolder/index.cjs"; +import * as m7 from "./subfolder2/index.js"; +import * as m8 from "./subfolder2/index.mjs"; +import * as m9 from "./subfolder2/index.cjs"; +import * as m10 from "./subfolder2/another/index.js"; +import * as m11 from "./subfolder2/another/index.mjs"; +import * as m12 from "./subfolder2/another/index.cjs"; // The next ones shouldn't all work - esm format files have no index resolution or extension resolution -const m13 = require("./"); -const m14 = require("./index"); -const m15 = require("./subfolder"); -const m16 = require("./subfolder/"); -const m17 = require("./subfolder/index"); -const m18 = require("./subfolder2"); -const m19 = require("./subfolder2/"); -const m20 = require("./subfolder2/index"); -const m21 = require("./subfolder2/another"); -const m22 = require("./subfolder2/another/"); -const m23 = require("./subfolder2/another/index"); +import * as m13 from "./"; +import * as m14 from "./index"; +import * as m15 from "./subfolder"; +import * as m16 from "./subfolder/"; +import * as m17 from "./subfolder/index"; +import * as m18 from "./subfolder2"; +import * as m19 from "./subfolder2/"; +import * as m20 from "./subfolder2/index"; +import * as m21 from "./subfolder2/another"; +import * as m22 from "./subfolder2/another/"; +import * as m23 from "./subfolder2/another/index"; void m1; void m2; void m3; @@ -614,17 +633,17 @@ void m21; void m22; void m23; // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) -const m24 = require("./"); -const m25 = require("./index"); -const m26 = require("./subfolder"); -const m27 = require("./subfolder/"); -const m28 = require("./subfolder/index"); -const m29 = require("./subfolder2"); -const m30 = require("./subfolder2/"); -const m31 = require("./subfolder2/index"); -const m32 = require("./subfolder2/another"); -const m33 = require("./subfolder2/another/"); -const m34 = require("./subfolder2/another/index"); +const m24 = __require("./"); +const m25 = __require("./index"); +const m26 = __require("./subfolder"); +const m27 = __require("./subfolder/"); +const m28 = __require("./subfolder/index"); +const m29 = __require("./subfolder2"); +const m30 = __require("./subfolder2/"); +const m31 = __require("./subfolder2/index"); +const m32 = __require("./subfolder2/another"); +const m33 = __require("./subfolder2/another/"); +const m34 = __require("./subfolder2/another/index"); void m24; void m25; void m26; @@ -650,7 +669,7 @@ const _m44 = import("./subfolder2/another/"); const _m45 = import("./subfolder2/another/index"); // esm format file const x = 1; -exports.x = x; +export { x }; //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).js.diff index fd6d67be58..920136ea0d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).js.diff @@ -1,370 +1,9 @@ --- old.nodeModulesAllowJs1(module=node20).js +++ new.nodeModulesAllowJs1(module=node20).js -@@= skipped -334, +334 lines =@@ - const x = 1; - exports.x = x; - //// [index.mjs] --// esm format file --const x = 1; --export { x }; --//// [index.js] --"use strict"; --Object.defineProperty(exports, "__esModule", { value: true }); --exports.x = void 0; --// cjs format file --const x = 1; --exports.x = x; --//// [index.cjs] --"use strict"; --Object.defineProperty(exports, "__esModule", { value: true }); --exports.x = void 0; --// cjs format file --const x = 1; --exports.x = x; --//// [index.mjs] --// esm format file --const x = 1; --export { x }; --//// [index.js] --// esm format file --const x = 1; --export { x }; --//// [index.cjs] --"use strict"; --Object.defineProperty(exports, "__esModule", { value: true }); --exports.x = void 0; --// cjs format file --const x = 1; --exports.x = x; --//// [index.mjs] --// esm format file --const x = 1; --export { x }; --//// [index.cjs] --"use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// esm format file -+const x = 1; -+exports.x = x; -+//// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// cjs format file -+const x = 1; -+exports.x = x; -+//// [index.cjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// cjs format file -+const x = 1; -+exports.x = x; -+//// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// esm format file -+const x = 1; -+exports.x = x; -+//// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// esm format file -+const x = 1; -+exports.x = x; -+//// [index.cjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// cjs format file -+const x = 1; -+exports.x = x; -+//// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// esm format file -+const x = 1; -+exports.x = x; -+//// [index.cjs] -+"use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.x = void 0; - // ESM-format imports below should issue errors --const m1 = __importStar(require("./index.js")); --const m2 = __importStar(require("./index.mjs")); --const m3 = __importStar(require("./index.cjs")); --const m4 = __importStar(require("./subfolder/index.js")); --const m5 = __importStar(require("./subfolder/index.mjs")); --const m6 = __importStar(require("./subfolder/index.cjs")); --const m7 = __importStar(require("./subfolder2/index.js")); --const m8 = __importStar(require("./subfolder2/index.mjs")); --const m9 = __importStar(require("./subfolder2/index.cjs")); --const m10 = __importStar(require("./subfolder2/another/index.js")); --const m11 = __importStar(require("./subfolder2/another/index.mjs")); --const m12 = __importStar(require("./subfolder2/another/index.cjs")); -+const m1 = require("./index.js"); -+const m2 = require("./index.mjs"); -+const m3 = require("./index.cjs"); -+const m4 = require("./subfolder/index.js"); -+const m5 = require("./subfolder/index.mjs"); -+const m6 = require("./subfolder/index.cjs"); -+const m7 = require("./subfolder2/index.js"); -+const m8 = require("./subfolder2/index.mjs"); -+const m9 = require("./subfolder2/index.cjs"); -+const m10 = require("./subfolder2/another/index.js"); -+const m11 = require("./subfolder2/another/index.mjs"); -+const m12 = require("./subfolder2/another/index.cjs"); - // The next ones should _mostly_ work - cjs format files have index resolution and extension resolution (except for those which resolve to an esm format file) --const m13 = __importStar(require("./")); --const m14 = __importStar(require("./index")); --const m15 = __importStar(require("./subfolder")); --const m16 = __importStar(require("./subfolder/")); --const m17 = __importStar(require("./subfolder/index")); --const m18 = __importStar(require("./subfolder2")); --const m19 = __importStar(require("./subfolder2/")); --const m20 = __importStar(require("./subfolder2/index")); --const m21 = __importStar(require("./subfolder2/another")); --const m22 = __importStar(require("./subfolder2/another/")); --const m23 = __importStar(require("./subfolder2/another/index")); -+const m13 = require("./"); -+const m14 = require("./index"); -+const m15 = require("./subfolder"); -+const m16 = require("./subfolder/"); -+const m17 = require("./subfolder/index"); -+const m18 = require("./subfolder2"); -+const m19 = require("./subfolder2/"); -+const m20 = require("./subfolder2/index"); -+const m21 = require("./subfolder2/another"); -+const m22 = require("./subfolder2/another/"); -+const m23 = require("./subfolder2/another/index"); - void m1; - void m2; - void m3; -@@= skipped -160, +139 lines =@@ - const x = 1; - exports.x = x; - //// [index.mjs] --import { createRequire as _createRequire } from "module"; --const __require = _createRequire(import.meta.url); --import * as m1 from "./index.js"; --import * as m2 from "./index.mjs"; --import * as m3 from "./index.cjs"; --import * as m4 from "./subfolder/index.js"; --import * as m5 from "./subfolder/index.mjs"; --import * as m6 from "./subfolder/index.cjs"; --import * as m7 from "./subfolder2/index.js"; --import * as m8 from "./subfolder2/index.mjs"; --import * as m9 from "./subfolder2/index.cjs"; --import * as m10 from "./subfolder2/another/index.js"; --import * as m11 from "./subfolder2/another/index.mjs"; --import * as m12 from "./subfolder2/another/index.cjs"; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+const m1 = require("./index.js"); -+const m2 = require("./index.mjs"); -+const m3 = require("./index.cjs"); -+const m4 = require("./subfolder/index.js"); -+const m5 = require("./subfolder/index.mjs"); -+const m6 = require("./subfolder/index.cjs"); -+const m7 = require("./subfolder2/index.js"); -+const m8 = require("./subfolder2/index.mjs"); -+const m9 = require("./subfolder2/index.cjs"); -+const m10 = require("./subfolder2/another/index.js"); -+const m11 = require("./subfolder2/another/index.mjs"); -+const m12 = require("./subfolder2/another/index.cjs"); - // The next ones should all fail - esm format files have no index resolution or extension resolution --import * as m13 from "./"; --import * as m14 from "./index"; --import * as m15 from "./subfolder"; --import * as m16 from "./subfolder/"; --import * as m17 from "./subfolder/index"; --import * as m18 from "./subfolder2"; --import * as m19 from "./subfolder2/"; --import * as m20 from "./subfolder2/index"; --import * as m21 from "./subfolder2/another"; --import * as m22 from "./subfolder2/another/"; --import * as m23 from "./subfolder2/another/index"; -+const m13 = require("./"); -+const m14 = require("./index"); -+const m15 = require("./subfolder"); -+const m16 = require("./subfolder/"); -+const m17 = require("./subfolder/index"); -+const m18 = require("./subfolder2"); -+const m19 = require("./subfolder2/"); -+const m20 = require("./subfolder2/index"); -+const m21 = require("./subfolder2/another"); -+const m22 = require("./subfolder2/another/"); -+const m23 = require("./subfolder2/another/index"); - void m1; - void m2; - void m3; -@@= skipped -50, +51 lines =@@ - void m22; - void m23; - // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) --const m24 = __require("./"); --const m25 = __require("./index"); --const m26 = __require("./subfolder"); --const m27 = __require("./subfolder/"); --const m28 = __require("./subfolder/index"); --const m29 = __require("./subfolder2"); --const m30 = __require("./subfolder2/"); --const m31 = __require("./subfolder2/index"); --const m32 = __require("./subfolder2/another"); --const m33 = __require("./subfolder2/another/"); --const m34 = __require("./subfolder2/another/index"); -+const m24 = require("./"); -+const m25 = require("./index"); -+const m26 = require("./subfolder"); -+const m27 = require("./subfolder/"); -+const m28 = require("./subfolder/index"); -+const m29 = require("./subfolder2"); -+const m30 = require("./subfolder2/"); -+const m31 = require("./subfolder2/index"); -+const m32 = require("./subfolder2/another"); -+const m33 = require("./subfolder2/another/"); -+const m34 = require("./subfolder2/another/index"); - void m24; - void m25; - void m26; -@@= skipped -36, +36 lines =@@ - const _m45 = import("./subfolder2/another/index"); - // esm format file - const x = 1; --export { x }; -+exports.x = x; - //// [index.js] --import { createRequire as _createRequire } from "module"; --const __require = _createRequire(import.meta.url); --import * as m1 from "./index.js"; --import * as m2 from "./index.mjs"; --import * as m3 from "./index.cjs"; --import * as m4 from "./subfolder/index.js"; --import * as m5 from "./subfolder/index.mjs"; --import * as m6 from "./subfolder/index.cjs"; --import * as m7 from "./subfolder2/index.js"; --import * as m8 from "./subfolder2/index.mjs"; --import * as m9 from "./subfolder2/index.cjs"; --import * as m10 from "./subfolder2/another/index.js"; --import * as m11 from "./subfolder2/another/index.mjs"; --import * as m12 from "./subfolder2/another/index.cjs"; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+const m1 = require("./index.js"); -+const m2 = require("./index.mjs"); -+const m3 = require("./index.cjs"); -+const m4 = require("./subfolder/index.js"); -+const m5 = require("./subfolder/index.mjs"); -+const m6 = require("./subfolder/index.cjs"); -+const m7 = require("./subfolder2/index.js"); -+const m8 = require("./subfolder2/index.mjs"); -+const m9 = require("./subfolder2/index.cjs"); -+const m10 = require("./subfolder2/another/index.js"); -+const m11 = require("./subfolder2/another/index.mjs"); -+const m12 = require("./subfolder2/another/index.cjs"); - // The next ones shouldn't all work - esm format files have no index resolution or extension resolution --import * as m13 from "./"; --import * as m14 from "./index"; --import * as m15 from "./subfolder"; --import * as m16 from "./subfolder/"; --import * as m17 from "./subfolder/index"; --import * as m18 from "./subfolder2"; --import * as m19 from "./subfolder2/"; --import * as m20 from "./subfolder2/index"; --import * as m21 from "./subfolder2/another"; --import * as m22 from "./subfolder2/another/"; --import * as m23 from "./subfolder2/another/index"; -+const m13 = require("./"); -+const m14 = require("./index"); -+const m15 = require("./subfolder"); -+const m16 = require("./subfolder/"); -+const m17 = require("./subfolder/index"); -+const m18 = require("./subfolder2"); -+const m19 = require("./subfolder2/"); -+const m20 = require("./subfolder2/index"); -+const m21 = require("./subfolder2/another"); -+const m22 = require("./subfolder2/another/"); -+const m23 = require("./subfolder2/another/index"); - void m1; - void m2; - void m3; -@@= skipped -52, +53 lines =@@ - void m22; - void m23; - // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) --const m24 = __require("./"); --const m25 = __require("./index"); --const m26 = __require("./subfolder"); --const m27 = __require("./subfolder/"); --const m28 = __require("./subfolder/index"); --const m29 = __require("./subfolder2"); --const m30 = __require("./subfolder2/"); --const m31 = __require("./subfolder2/index"); --const m32 = __require("./subfolder2/another"); --const m33 = __require("./subfolder2/another/"); --const m34 = __require("./subfolder2/another/index"); -+const m24 = require("./"); -+const m25 = require("./index"); -+const m26 = require("./subfolder"); -+const m27 = require("./subfolder/"); -+const m28 = require("./subfolder/index"); -+const m29 = require("./subfolder2"); -+const m30 = require("./subfolder2/"); -+const m31 = require("./subfolder2/index"); -+const m32 = require("./subfolder2/another"); -+const m33 = require("./subfolder2/another/"); -+const m34 = require("./subfolder2/another/index"); - void m24; - void m25; - void m26; -@@= skipped -36, +36 lines =@@ - const _m45 = import("./subfolder2/another/index"); - // esm format file - const x = 1; --export { x }; -- -- --//// [index.d.ts] +@@= skipped -672, +672 lines =@@ + + + //// [index.d.ts] -export const x: 1; -//// [index.d.cts] -export const x: 1; @@ -388,10 +27,6 @@ -export const x: 1; -//// [index.d.ts] -export const x: 1; -+exports.x = x; -+ -+ -+//// [index.d.ts] +declare const x = 1; +export { x }; +//// [index.d.cts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).symbols index ec8ec42c86..1d24c14a43 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).symbols @@ -282,47 +282,36 @@ void m34; // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); >_m35 : Symbol(_m35, Decl(index.js, 73, 5)) ->"./" : Symbol(m1, Decl(index.js, 0, 0)) const _m36 = import("./index"); >_m36 : Symbol(_m36, Decl(index.js, 74, 5)) ->"./index" : Symbol(m1, Decl(index.js, 0, 0)) const _m37 = import("./subfolder"); >_m37 : Symbol(_m37, Decl(index.js, 75, 5)) ->"./subfolder" : Symbol(m4, Decl(index.js, 0, 0)) const _m38 = import("./subfolder/"); >_m38 : Symbol(_m38, Decl(index.js, 76, 5)) ->"./subfolder/" : Symbol(m4, Decl(index.js, 0, 0)) const _m39 = import("./subfolder/index"); >_m39 : Symbol(_m39, Decl(index.js, 77, 5)) ->"./subfolder/index" : Symbol(m4, Decl(index.js, 0, 0)) const _m40 = import("./subfolder2"); >_m40 : Symbol(_m40, Decl(index.js, 78, 5)) ->"./subfolder2" : Symbol(m7, Decl(index.js, 0, 0)) const _m41 = import("./subfolder2/"); >_m41 : Symbol(_m41, Decl(index.js, 79, 5)) ->"./subfolder2/" : Symbol(m7, Decl(index.js, 0, 0)) const _m42 = import("./subfolder2/index"); >_m42 : Symbol(_m42, Decl(index.js, 80, 5)) ->"./subfolder2/index" : Symbol(m7, Decl(index.js, 0, 0)) const _m43 = import("./subfolder2/another"); >_m43 : Symbol(_m43, Decl(index.js, 81, 5)) ->"./subfolder2/another" : Symbol(m10, Decl(index.js, 0, 0)) const _m44 = import("./subfolder2/another/"); >_m44 : Symbol(_m44, Decl(index.js, 82, 5)) ->"./subfolder2/another/" : Symbol(m10, Decl(index.js, 0, 0)) const _m45 = import("./subfolder2/another/index"); >_m45 : Symbol(_m45, Decl(index.js, 83, 5)) ->"./subfolder2/another/index" : Symbol(m10, Decl(index.js, 0, 0)) // esm format file const x = 1; @@ -542,47 +531,36 @@ void m34; // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); >_m35 : Symbol(_m35, Decl(index.cjs, 74, 5)) ->"./" : Symbol(m1, Decl(index.js, 0, 0)) const _m36 = import("./index"); >_m36 : Symbol(_m36, Decl(index.cjs, 75, 5)) ->"./index" : Symbol(m1, Decl(index.js, 0, 0)) const _m37 = import("./subfolder"); >_m37 : Symbol(_m37, Decl(index.cjs, 76, 5)) ->"./subfolder" : Symbol(m4, Decl(index.js, 0, 0)) const _m38 = import("./subfolder/"); >_m38 : Symbol(_m38, Decl(index.cjs, 77, 5)) ->"./subfolder/" : Symbol(m4, Decl(index.js, 0, 0)) const _m39 = import("./subfolder/index"); >_m39 : Symbol(_m39, Decl(index.cjs, 78, 5)) ->"./subfolder/index" : Symbol(m4, Decl(index.js, 0, 0)) const _m40 = import("./subfolder2"); >_m40 : Symbol(_m40, Decl(index.cjs, 79, 5)) ->"./subfolder2" : Symbol(m7, Decl(index.js, 0, 0)) const _m41 = import("./subfolder2/"); >_m41 : Symbol(_m41, Decl(index.cjs, 80, 5)) ->"./subfolder2/" : Symbol(m7, Decl(index.js, 0, 0)) const _m42 = import("./subfolder2/index"); >_m42 : Symbol(_m42, Decl(index.cjs, 81, 5)) ->"./subfolder2/index" : Symbol(m7, Decl(index.js, 0, 0)) const _m43 = import("./subfolder2/another"); >_m43 : Symbol(_m43, Decl(index.cjs, 82, 5)) ->"./subfolder2/another" : Symbol(m10, Decl(index.js, 0, 0)) const _m44 = import("./subfolder2/another/"); >_m44 : Symbol(_m44, Decl(index.cjs, 83, 5)) ->"./subfolder2/another/" : Symbol(m10, Decl(index.js, 0, 0)) const _m45 = import("./subfolder2/another/index"); >_m45 : Symbol(_m45, Decl(index.cjs, 84, 5)) ->"./subfolder2/another/index" : Symbol(m10, Decl(index.js, 0, 0)) // cjs format file const x = 1; @@ -801,47 +779,36 @@ void m34; // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); >_m35 : Symbol(_m35, Decl(index.mjs, 73, 5)) ->"./" : Symbol(m1, Decl(index.js, 0, 0)) const _m36 = import("./index"); >_m36 : Symbol(_m36, Decl(index.mjs, 74, 5)) ->"./index" : Symbol(m1, Decl(index.js, 0, 0)) const _m37 = import("./subfolder"); >_m37 : Symbol(_m37, Decl(index.mjs, 75, 5)) ->"./subfolder" : Symbol(m4, Decl(index.js, 0, 0)) const _m38 = import("./subfolder/"); >_m38 : Symbol(_m38, Decl(index.mjs, 76, 5)) ->"./subfolder/" : Symbol(m4, Decl(index.js, 0, 0)) const _m39 = import("./subfolder/index"); >_m39 : Symbol(_m39, Decl(index.mjs, 77, 5)) ->"./subfolder/index" : Symbol(m4, Decl(index.js, 0, 0)) const _m40 = import("./subfolder2"); >_m40 : Symbol(_m40, Decl(index.mjs, 78, 5)) ->"./subfolder2" : Symbol(m7, Decl(index.js, 0, 0)) const _m41 = import("./subfolder2/"); >_m41 : Symbol(_m41, Decl(index.mjs, 79, 5)) ->"./subfolder2/" : Symbol(m7, Decl(index.js, 0, 0)) const _m42 = import("./subfolder2/index"); >_m42 : Symbol(_m42, Decl(index.mjs, 80, 5)) ->"./subfolder2/index" : Symbol(m7, Decl(index.js, 0, 0)) const _m43 = import("./subfolder2/another"); >_m43 : Symbol(_m43, Decl(index.mjs, 81, 5)) ->"./subfolder2/another" : Symbol(m10, Decl(index.js, 0, 0)) const _m44 = import("./subfolder2/another/"); >_m44 : Symbol(_m44, Decl(index.mjs, 82, 5)) ->"./subfolder2/another/" : Symbol(m10, Decl(index.js, 0, 0)) const _m45 = import("./subfolder2/another/index"); >_m45 : Symbol(_m45, Decl(index.mjs, 83, 5)) ->"./subfolder2/another/index" : Symbol(m10, Decl(index.js, 0, 0)) // esm format file const x = 1; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).symbols.diff deleted file mode 100644 index 4be9a18056..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).symbols.diff +++ /dev/null @@ -1,146 +0,0 @@ ---- old.nodeModulesAllowJs1(module=node20).symbols -+++ new.nodeModulesAllowJs1(module=node20).symbols -@@= skipped -281, +281 lines =@@ - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); - >_m35 : Symbol(_m35, Decl(index.js, 73, 5)) -+>"./" : Symbol(m1, Decl(index.js, 0, 0)) - - const _m36 = import("./index"); - >_m36 : Symbol(_m36, Decl(index.js, 74, 5)) -+>"./index" : Symbol(m1, Decl(index.js, 0, 0)) - - const _m37 = import("./subfolder"); - >_m37 : Symbol(_m37, Decl(index.js, 75, 5)) -+>"./subfolder" : Symbol(m4, Decl(index.js, 0, 0)) - - const _m38 = import("./subfolder/"); - >_m38 : Symbol(_m38, Decl(index.js, 76, 5)) -+>"./subfolder/" : Symbol(m4, Decl(index.js, 0, 0)) - - const _m39 = import("./subfolder/index"); - >_m39 : Symbol(_m39, Decl(index.js, 77, 5)) -+>"./subfolder/index" : Symbol(m4, Decl(index.js, 0, 0)) - - const _m40 = import("./subfolder2"); - >_m40 : Symbol(_m40, Decl(index.js, 78, 5)) -+>"./subfolder2" : Symbol(m7, Decl(index.js, 0, 0)) - - const _m41 = import("./subfolder2/"); - >_m41 : Symbol(_m41, Decl(index.js, 79, 5)) -+>"./subfolder2/" : Symbol(m7, Decl(index.js, 0, 0)) - - const _m42 = import("./subfolder2/index"); - >_m42 : Symbol(_m42, Decl(index.js, 80, 5)) -+>"./subfolder2/index" : Symbol(m7, Decl(index.js, 0, 0)) - - const _m43 = import("./subfolder2/another"); - >_m43 : Symbol(_m43, Decl(index.js, 81, 5)) -+>"./subfolder2/another" : Symbol(m10, Decl(index.js, 0, 0)) - - const _m44 = import("./subfolder2/another/"); - >_m44 : Symbol(_m44, Decl(index.js, 82, 5)) -+>"./subfolder2/another/" : Symbol(m10, Decl(index.js, 0, 0)) - - const _m45 = import("./subfolder2/another/index"); - >_m45 : Symbol(_m45, Decl(index.js, 83, 5)) -+>"./subfolder2/another/index" : Symbol(m10, Decl(index.js, 0, 0)) - - // esm format file - const x = 1; -@@= skipped -249, +260 lines =@@ - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); - >_m35 : Symbol(_m35, Decl(index.cjs, 74, 5)) -+>"./" : Symbol(m1, Decl(index.js, 0, 0)) - - const _m36 = import("./index"); - >_m36 : Symbol(_m36, Decl(index.cjs, 75, 5)) -+>"./index" : Symbol(m1, Decl(index.js, 0, 0)) - - const _m37 = import("./subfolder"); - >_m37 : Symbol(_m37, Decl(index.cjs, 76, 5)) -+>"./subfolder" : Symbol(m4, Decl(index.js, 0, 0)) - - const _m38 = import("./subfolder/"); - >_m38 : Symbol(_m38, Decl(index.cjs, 77, 5)) -+>"./subfolder/" : Symbol(m4, Decl(index.js, 0, 0)) - - const _m39 = import("./subfolder/index"); - >_m39 : Symbol(_m39, Decl(index.cjs, 78, 5)) -+>"./subfolder/index" : Symbol(m4, Decl(index.js, 0, 0)) - - const _m40 = import("./subfolder2"); - >_m40 : Symbol(_m40, Decl(index.cjs, 79, 5)) -+>"./subfolder2" : Symbol(m7, Decl(index.js, 0, 0)) - - const _m41 = import("./subfolder2/"); - >_m41 : Symbol(_m41, Decl(index.cjs, 80, 5)) -+>"./subfolder2/" : Symbol(m7, Decl(index.js, 0, 0)) - - const _m42 = import("./subfolder2/index"); - >_m42 : Symbol(_m42, Decl(index.cjs, 81, 5)) -+>"./subfolder2/index" : Symbol(m7, Decl(index.js, 0, 0)) - - const _m43 = import("./subfolder2/another"); - >_m43 : Symbol(_m43, Decl(index.cjs, 82, 5)) -+>"./subfolder2/another" : Symbol(m10, Decl(index.js, 0, 0)) - - const _m44 = import("./subfolder2/another/"); - >_m44 : Symbol(_m44, Decl(index.cjs, 83, 5)) -+>"./subfolder2/another/" : Symbol(m10, Decl(index.js, 0, 0)) - - const _m45 = import("./subfolder2/another/index"); - >_m45 : Symbol(_m45, Decl(index.cjs, 84, 5)) -+>"./subfolder2/another/index" : Symbol(m10, Decl(index.js, 0, 0)) - - // cjs format file - const x = 1; -@@= skipped -248, +259 lines =@@ - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); - >_m35 : Symbol(_m35, Decl(index.mjs, 73, 5)) -+>"./" : Symbol(m1, Decl(index.js, 0, 0)) - - const _m36 = import("./index"); - >_m36 : Symbol(_m36, Decl(index.mjs, 74, 5)) -+>"./index" : Symbol(m1, Decl(index.js, 0, 0)) - - const _m37 = import("./subfolder"); - >_m37 : Symbol(_m37, Decl(index.mjs, 75, 5)) -+>"./subfolder" : Symbol(m4, Decl(index.js, 0, 0)) - - const _m38 = import("./subfolder/"); - >_m38 : Symbol(_m38, Decl(index.mjs, 76, 5)) -+>"./subfolder/" : Symbol(m4, Decl(index.js, 0, 0)) - - const _m39 = import("./subfolder/index"); - >_m39 : Symbol(_m39, Decl(index.mjs, 77, 5)) -+>"./subfolder/index" : Symbol(m4, Decl(index.js, 0, 0)) - - const _m40 = import("./subfolder2"); - >_m40 : Symbol(_m40, Decl(index.mjs, 78, 5)) -+>"./subfolder2" : Symbol(m7, Decl(index.js, 0, 0)) - - const _m41 = import("./subfolder2/"); - >_m41 : Symbol(_m41, Decl(index.mjs, 79, 5)) -+>"./subfolder2/" : Symbol(m7, Decl(index.js, 0, 0)) - - const _m42 = import("./subfolder2/index"); - >_m42 : Symbol(_m42, Decl(index.mjs, 80, 5)) -+>"./subfolder2/index" : Symbol(m7, Decl(index.js, 0, 0)) - - const _m43 = import("./subfolder2/another"); - >_m43 : Symbol(_m43, Decl(index.mjs, 81, 5)) -+>"./subfolder2/another" : Symbol(m10, Decl(index.js, 0, 0)) - - const _m44 = import("./subfolder2/another/"); - >_m44 : Symbol(_m44, Decl(index.mjs, 82, 5)) -+>"./subfolder2/another/" : Symbol(m10, Decl(index.js, 0, 0)) - - const _m45 = import("./subfolder2/another/index"); - >_m45 : Symbol(_m45, Decl(index.mjs, 83, 5)) -+>"./subfolder2/another/index" : Symbol(m10, Decl(index.js, 0, 0)) - - // esm format file - const x = 1; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).types index 3ffd6777e8..c05889cd7f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=node20).types @@ -120,37 +120,37 @@ import * as m12 from "./subfolder2/another/index.cjs"; // The next ones shouldn't all work - esm format files have no index resolution or extension resolution import * as m13 from "./"; ->m13 : typeof m1 +>m13 : any import * as m14 from "./index"; ->m14 : typeof m1 +>m14 : any import * as m15 from "./subfolder"; ->m15 : typeof m4 +>m15 : any import * as m16 from "./subfolder/"; ->m16 : typeof m4 +>m16 : any import * as m17 from "./subfolder/index"; ->m17 : typeof m4 +>m17 : any import * as m18 from "./subfolder2"; ->m18 : typeof m7 +>m18 : any import * as m19 from "./subfolder2/"; ->m19 : typeof m7 +>m19 : any import * as m20 from "./subfolder2/index"; ->m20 : typeof m7 +>m20 : any import * as m21 from "./subfolder2/another"; ->m21 : typeof m10 +>m21 : any import * as m22 from "./subfolder2/another/"; ->m22 : typeof m10 +>m22 : any import * as m23 from "./subfolder2/another/index"; ->m23 : typeof m10 +>m23 : any void m1; >void m1 : undefined @@ -202,47 +202,47 @@ void m12; void m13; >void m13 : undefined ->m13 : typeof m1 +>m13 : any void m14; >void m14 : undefined ->m14 : typeof m1 +>m14 : any void m15; >void m15 : undefined ->m15 : typeof m4 +>m15 : any void m16; >void m16 : undefined ->m16 : typeof m4 +>m16 : any void m17; >void m17 : undefined ->m17 : typeof m4 +>m17 : any void m18; >void m18 : undefined ->m18 : typeof m7 +>m18 : any void m19; >void m19 : undefined ->m19 : typeof m7 +>m19 : any void m20; >void m20 : undefined ->m20 : typeof m7 +>m20 : any void m21; >void m21 : undefined ->m21 : typeof m10 +>m21 : any void m22; >void m22 : undefined ->m22 : typeof m10 +>m22 : any void m23; >void m23 : undefined ->m23 : typeof m10 +>m23 : any // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) import m24 = require("./"); @@ -252,22 +252,22 @@ import m25 = require("./index"); >m25 : typeof m1 import m26 = require("./subfolder"); ->m26 : typeof m4 +>m26 : typeof m26 import m27 = require("./subfolder/"); ->m27 : typeof m4 +>m27 : typeof m26 import m28 = require("./subfolder/index"); ->m28 : typeof m4 +>m28 : typeof m26 import m29 = require("./subfolder2"); ->m29 : typeof m7 +>m29 : typeof m29 import m30 = require("./subfolder2/"); ->m30 : typeof m7 +>m30 : typeof m29 import m31 = require("./subfolder2/index"); ->m31 : typeof m7 +>m31 : typeof m29 import m32 = require("./subfolder2/another"); >m32 : typeof m10 @@ -288,27 +288,27 @@ void m25; void m26; >void m26 : undefined ->m26 : typeof m4 +>m26 : typeof m26 void m27; >void m27 : undefined ->m27 : typeof m4 +>m27 : typeof m26 void m28; >void m28 : undefined ->m28 : typeof m4 +>m28 : typeof m26 void m29; >void m29 : undefined ->m29 : typeof m7 +>m29 : typeof m29 void m30; >void m30 : undefined ->m30 : typeof m7 +>m30 : typeof m29 void m31; >void m31 : undefined ->m31 : typeof m7 +>m31 : typeof m29 void m32; >void m32 : undefined @@ -324,58 +324,58 @@ void m34; // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); ->_m35 : Promise<{ x: 1; default: typeof m1; }> ->import("./") : Promise<{ x: 1; default: typeof m1; }> +>_m35 : Promise +>import("./") : Promise >"./" : "./" const _m36 = import("./index"); ->_m36 : Promise<{ x: 1; default: typeof m1; }> ->import("./index") : Promise<{ x: 1; default: typeof m1; }> +>_m36 : Promise +>import("./index") : Promise >"./index" : "./index" const _m37 = import("./subfolder"); ->_m37 : Promise<{ x: 1; default: typeof m4; }> ->import("./subfolder") : Promise<{ x: 1; default: typeof m4; }> +>_m37 : Promise +>import("./subfolder") : Promise >"./subfolder" : "./subfolder" const _m38 = import("./subfolder/"); ->_m38 : Promise<{ x: 1; default: typeof m4; }> ->import("./subfolder/") : Promise<{ x: 1; default: typeof m4; }> +>_m38 : Promise +>import("./subfolder/") : Promise >"./subfolder/" : "./subfolder/" const _m39 = import("./subfolder/index"); ->_m39 : Promise<{ x: 1; default: typeof m4; }> ->import("./subfolder/index") : Promise<{ x: 1; default: typeof m4; }> +>_m39 : Promise +>import("./subfolder/index") : Promise >"./subfolder/index" : "./subfolder/index" const _m40 = import("./subfolder2"); ->_m40 : Promise<{ x: 1; default: typeof m7; }> ->import("./subfolder2") : Promise<{ x: 1; default: typeof m7; }> +>_m40 : Promise +>import("./subfolder2") : Promise >"./subfolder2" : "./subfolder2" const _m41 = import("./subfolder2/"); ->_m41 : Promise<{ x: 1; default: typeof m7; }> ->import("./subfolder2/") : Promise<{ x: 1; default: typeof m7; }> +>_m41 : Promise +>import("./subfolder2/") : Promise >"./subfolder2/" : "./subfolder2/" const _m42 = import("./subfolder2/index"); ->_m42 : Promise<{ x: 1; default: typeof m7; }> ->import("./subfolder2/index") : Promise<{ x: 1; default: typeof m7; }> +>_m42 : Promise +>import("./subfolder2/index") : Promise >"./subfolder2/index" : "./subfolder2/index" const _m43 = import("./subfolder2/another"); ->_m43 : Promise<{ x: 1; default: typeof m10; }> ->import("./subfolder2/another") : Promise<{ x: 1; default: typeof m10; }> +>_m43 : Promise +>import("./subfolder2/another") : Promise >"./subfolder2/another" : "./subfolder2/another" const _m44 = import("./subfolder2/another/"); ->_m44 : Promise<{ x: 1; default: typeof m10; }> ->import("./subfolder2/another/") : Promise<{ x: 1; default: typeof m10; }> +>_m44 : Promise +>import("./subfolder2/another/") : Promise >"./subfolder2/another/" : "./subfolder2/another/" const _m45 = import("./subfolder2/another/index"); ->_m45 : Promise<{ x: 1; default: typeof m10; }> ->import("./subfolder2/another/index") : Promise<{ x: 1; default: typeof m10; }> +>_m45 : Promise +>import("./subfolder2/another/index") : Promise >"./subfolder2/another/index" : "./subfolder2/another/index" // esm format file @@ -630,58 +630,58 @@ void m34; // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); ->_m35 : Promise<{ x: 1; default: typeof m1; }> ->import("./") : Promise<{ x: 1; default: typeof m1; }> +>_m35 : Promise +>import("./") : Promise >"./" : "./" const _m36 = import("./index"); ->_m36 : Promise<{ x: 1; default: typeof m1; }> ->import("./index") : Promise<{ x: 1; default: typeof m1; }> +>_m36 : Promise +>import("./index") : Promise >"./index" : "./index" const _m37 = import("./subfolder"); ->_m37 : Promise<{ x: 1; default: typeof m4; }> ->import("./subfolder") : Promise<{ x: 1; default: typeof m4; }> +>_m37 : Promise +>import("./subfolder") : Promise >"./subfolder" : "./subfolder" const _m38 = import("./subfolder/"); ->_m38 : Promise<{ x: 1; default: typeof m4; }> ->import("./subfolder/") : Promise<{ x: 1; default: typeof m4; }> +>_m38 : Promise +>import("./subfolder/") : Promise >"./subfolder/" : "./subfolder/" const _m39 = import("./subfolder/index"); ->_m39 : Promise<{ x: 1; default: typeof m4; }> ->import("./subfolder/index") : Promise<{ x: 1; default: typeof m4; }> +>_m39 : Promise +>import("./subfolder/index") : Promise >"./subfolder/index" : "./subfolder/index" const _m40 = import("./subfolder2"); ->_m40 : Promise<{ x: 1; default: typeof m7; }> ->import("./subfolder2") : Promise<{ x: 1; default: typeof m7; }> +>_m40 : Promise +>import("./subfolder2") : Promise >"./subfolder2" : "./subfolder2" const _m41 = import("./subfolder2/"); ->_m41 : Promise<{ x: 1; default: typeof m7; }> ->import("./subfolder2/") : Promise<{ x: 1; default: typeof m7; }> +>_m41 : Promise +>import("./subfolder2/") : Promise >"./subfolder2/" : "./subfolder2/" const _m42 = import("./subfolder2/index"); ->_m42 : Promise<{ x: 1; default: typeof m7; }> ->import("./subfolder2/index") : Promise<{ x: 1; default: typeof m7; }> +>_m42 : Promise +>import("./subfolder2/index") : Promise >"./subfolder2/index" : "./subfolder2/index" const _m43 = import("./subfolder2/another"); ->_m43 : Promise<{ x: 1; default: typeof m10; }> ->import("./subfolder2/another") : Promise<{ x: 1; default: typeof m10; }> +>_m43 : Promise +>import("./subfolder2/another") : Promise >"./subfolder2/another" : "./subfolder2/another" const _m44 = import("./subfolder2/another/"); ->_m44 : Promise<{ x: 1; default: typeof m10; }> ->import("./subfolder2/another/") : Promise<{ x: 1; default: typeof m10; }> +>_m44 : Promise +>import("./subfolder2/another/") : Promise >"./subfolder2/another/" : "./subfolder2/another/" const _m45 = import("./subfolder2/another/index"); ->_m45 : Promise<{ x: 1; default: typeof m10; }> ->import("./subfolder2/another/index") : Promise<{ x: 1; default: typeof m10; }> +>_m45 : Promise +>import("./subfolder2/another/index") : Promise >"./subfolder2/another/index" : "./subfolder2/another/index" // cjs format file @@ -731,37 +731,37 @@ import * as m12 from "./subfolder2/another/index.cjs"; // The next ones should all fail - esm format files have no index resolution or extension resolution import * as m13 from "./"; ->m13 : typeof m1 +>m13 : any import * as m14 from "./index"; ->m14 : typeof m1 +>m14 : any import * as m15 from "./subfolder"; ->m15 : typeof m4 +>m15 : any import * as m16 from "./subfolder/"; ->m16 : typeof m4 +>m16 : any import * as m17 from "./subfolder/index"; ->m17 : typeof m4 +>m17 : any import * as m18 from "./subfolder2"; ->m18 : typeof m7 +>m18 : any import * as m19 from "./subfolder2/"; ->m19 : typeof m7 +>m19 : any import * as m20 from "./subfolder2/index"; ->m20 : typeof m7 +>m20 : any import * as m21 from "./subfolder2/another"; ->m21 : typeof m10 +>m21 : any import * as m22 from "./subfolder2/another/"; ->m22 : typeof m10 +>m22 : any import * as m23 from "./subfolder2/another/index"; ->m23 : typeof m10 +>m23 : any void m1; >void m1 : undefined @@ -813,47 +813,47 @@ void m12; void m13; >void m13 : undefined ->m13 : typeof m1 +>m13 : any void m14; >void m14 : undefined ->m14 : typeof m1 +>m14 : any void m15; >void m15 : undefined ->m15 : typeof m4 +>m15 : any void m16; >void m16 : undefined ->m16 : typeof m4 +>m16 : any void m17; >void m17 : undefined ->m17 : typeof m4 +>m17 : any void m18; >void m18 : undefined ->m18 : typeof m7 +>m18 : any void m19; >void m19 : undefined ->m19 : typeof m7 +>m19 : any void m20; >void m20 : undefined ->m20 : typeof m7 +>m20 : any void m21; >void m21 : undefined ->m21 : typeof m10 +>m21 : any void m22; >void m22 : undefined ->m22 : typeof m10 +>m22 : any void m23; >void m23 : undefined ->m23 : typeof m10 +>m23 : any // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) import m24 = require("./"); @@ -863,22 +863,22 @@ import m25 = require("./index"); >m25 : typeof m1 import m26 = require("./subfolder"); ->m26 : typeof m4 +>m26 : typeof m26 import m27 = require("./subfolder/"); ->m27 : typeof m4 +>m27 : typeof m26 import m28 = require("./subfolder/index"); ->m28 : typeof m4 +>m28 : typeof m26 import m29 = require("./subfolder2"); ->m29 : typeof m7 +>m29 : typeof m29 import m30 = require("./subfolder2/"); ->m30 : typeof m7 +>m30 : typeof m29 import m31 = require("./subfolder2/index"); ->m31 : typeof m7 +>m31 : typeof m29 import m32 = require("./subfolder2/another"); >m32 : typeof m10 @@ -899,27 +899,27 @@ void m25; void m26; >void m26 : undefined ->m26 : typeof m4 +>m26 : typeof m26 void m27; >void m27 : undefined ->m27 : typeof m4 +>m27 : typeof m26 void m28; >void m28 : undefined ->m28 : typeof m4 +>m28 : typeof m26 void m29; >void m29 : undefined ->m29 : typeof m7 +>m29 : typeof m29 void m30; >void m30 : undefined ->m30 : typeof m7 +>m30 : typeof m29 void m31; >void m31 : undefined ->m31 : typeof m7 +>m31 : typeof m29 void m32; >void m32 : undefined @@ -935,58 +935,58 @@ void m34; // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution const _m35 = import("./"); ->_m35 : Promise<{ x: 1; default: typeof m1; }> ->import("./") : Promise<{ x: 1; default: typeof m1; }> +>_m35 : Promise +>import("./") : Promise >"./" : "./" const _m36 = import("./index"); ->_m36 : Promise<{ x: 1; default: typeof m1; }> ->import("./index") : Promise<{ x: 1; default: typeof m1; }> +>_m36 : Promise +>import("./index") : Promise >"./index" : "./index" const _m37 = import("./subfolder"); ->_m37 : Promise<{ x: 1; default: typeof m4; }> ->import("./subfolder") : Promise<{ x: 1; default: typeof m4; }> +>_m37 : Promise +>import("./subfolder") : Promise >"./subfolder" : "./subfolder" const _m38 = import("./subfolder/"); ->_m38 : Promise<{ x: 1; default: typeof m4; }> ->import("./subfolder/") : Promise<{ x: 1; default: typeof m4; }> +>_m38 : Promise +>import("./subfolder/") : Promise >"./subfolder/" : "./subfolder/" const _m39 = import("./subfolder/index"); ->_m39 : Promise<{ x: 1; default: typeof m4; }> ->import("./subfolder/index") : Promise<{ x: 1; default: typeof m4; }> +>_m39 : Promise +>import("./subfolder/index") : Promise >"./subfolder/index" : "./subfolder/index" const _m40 = import("./subfolder2"); ->_m40 : Promise<{ x: 1; default: typeof m7; }> ->import("./subfolder2") : Promise<{ x: 1; default: typeof m7; }> +>_m40 : Promise +>import("./subfolder2") : Promise >"./subfolder2" : "./subfolder2" const _m41 = import("./subfolder2/"); ->_m41 : Promise<{ x: 1; default: typeof m7; }> ->import("./subfolder2/") : Promise<{ x: 1; default: typeof m7; }> +>_m41 : Promise +>import("./subfolder2/") : Promise >"./subfolder2/" : "./subfolder2/" const _m42 = import("./subfolder2/index"); ->_m42 : Promise<{ x: 1; default: typeof m7; }> ->import("./subfolder2/index") : Promise<{ x: 1; default: typeof m7; }> +>_m42 : Promise +>import("./subfolder2/index") : Promise >"./subfolder2/index" : "./subfolder2/index" const _m43 = import("./subfolder2/another"); ->_m43 : Promise<{ x: 1; default: typeof m10; }> ->import("./subfolder2/another") : Promise<{ x: 1; default: typeof m10; }> +>_m43 : Promise +>import("./subfolder2/another") : Promise >"./subfolder2/another" : "./subfolder2/another" const _m44 = import("./subfolder2/another/"); ->_m44 : Promise<{ x: 1; default: typeof m10; }> ->import("./subfolder2/another/") : Promise<{ x: 1; default: typeof m10; }> +>_m44 : Promise +>import("./subfolder2/another/") : Promise >"./subfolder2/another/" : "./subfolder2/another/" const _m45 = import("./subfolder2/another/index"); ->_m45 : Promise<{ x: 1; default: typeof m10; }> ->import("./subfolder2/another/index") : Promise<{ x: 1; default: typeof m10; }> +>_m45 : Promise +>import("./subfolder2/another/index") : Promise >"./subfolder2/another/index" : "./subfolder2/another/index" // esm format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=nodenext).types index dcb59ef72a..c05889cd7f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJs1(module=nodenext).types @@ -252,22 +252,22 @@ import m25 = require("./index"); >m25 : typeof m1 import m26 = require("./subfolder"); ->m26 : typeof m4 +>m26 : typeof m26 import m27 = require("./subfolder/"); ->m27 : typeof m4 +>m27 : typeof m26 import m28 = require("./subfolder/index"); ->m28 : typeof m4 +>m28 : typeof m26 import m29 = require("./subfolder2"); ->m29 : typeof m7 +>m29 : typeof m29 import m30 = require("./subfolder2/"); ->m30 : typeof m7 +>m30 : typeof m29 import m31 = require("./subfolder2/index"); ->m31 : typeof m7 +>m31 : typeof m29 import m32 = require("./subfolder2/another"); >m32 : typeof m10 @@ -288,27 +288,27 @@ void m25; void m26; >void m26 : undefined ->m26 : typeof m4 +>m26 : typeof m26 void m27; >void m27 : undefined ->m27 : typeof m4 +>m27 : typeof m26 void m28; >void m28 : undefined ->m28 : typeof m4 +>m28 : typeof m26 void m29; >void m29 : undefined ->m29 : typeof m7 +>m29 : typeof m29 void m30; >void m30 : undefined ->m30 : typeof m7 +>m30 : typeof m29 void m31; >void m31 : undefined ->m31 : typeof m7 +>m31 : typeof m29 void m32; >void m32 : undefined @@ -863,22 +863,22 @@ import m25 = require("./index"); >m25 : typeof m1 import m26 = require("./subfolder"); ->m26 : typeof m4 +>m26 : typeof m26 import m27 = require("./subfolder/"); ->m27 : typeof m4 +>m27 : typeof m26 import m28 = require("./subfolder/index"); ->m28 : typeof m4 +>m28 : typeof m26 import m29 = require("./subfolder2"); ->m29 : typeof m7 +>m29 : typeof m29 import m30 = require("./subfolder2/"); ->m30 : typeof m7 +>m30 : typeof m29 import m31 = require("./subfolder2/index"); ->m31 : typeof m7 +>m31 : typeof m29 import m32 = require("./subfolder2/another"); >m32 : typeof m10 @@ -899,27 +899,27 @@ void m25; void m26; >void m26 : undefined ->m26 : typeof m4 +>m26 : typeof m26 void m27; >void m27 : undefined ->m27 : typeof m4 +>m27 : typeof m26 void m28; >void m28 : undefined ->m28 : typeof m4 +>m28 : typeof m26 void m29; >void m29 : undefined ->m29 : typeof m7 +>m29 : typeof m29 void m30; >void m30 : undefined ->m30 : typeof m7 +>m30 : typeof m29 void m31; >void m31 : undefined ->m31 : typeof m7 +>m31 : typeof m29 void m32; >void m32 : undefined diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node20).errors.txt index 07180fab53..2341cc6d8a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsCjsFromJs(module=node20).errors.txt @@ -1,8 +1,6 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. bar.ts(1,8): error TS2613: Module '"foo"' has no default export. Did you mean to use 'import { foo } from "foo"' instead? -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== foo.cjs (0 errors) ==== exports.foo = "foo" ==== bar.ts (1 errors) ==== diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).errors.txt index 0e7496180a..3aa26eb8bd 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).errors.txt @@ -1,27 +1,12 @@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. +index.cjs(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. +index.cjs(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.js (3 errors) ==== +==== index.js (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -33,17 +18,11 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding mjsi.mjsSource; typei.mjsSource; ts.mjsSource; -==== index.mjs (3 errors) ==== +==== index.mjs (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -55,17 +34,15 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding mjsi.mjsSource; typei.mjsSource; ts.mjsSource; -==== index.cjs (3 errors) ==== +==== index.cjs (2 errors) ==== // cjs format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. import * as type from "package"; ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. cjs; mjs; type; @@ -78,6 +55,9 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding typei.implicitCjsSource; ts.cjsSource; ==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (0 errors) ==== // cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -87,8 +67,10 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; export { ts }; - export const implicitCjsSource = true; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -98,8 +80,10 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; export { ts }; - export const mjsSource = true; ==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (0 errors) ==== // cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -109,7 +93,6 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; export { ts }; - export const cjsSource = true; ==== package.json (0 errors) ==== { "name": "package", diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).js index 2f99e51c4c..e8c327cbb8 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).js @@ -50,6 +50,9 @@ typei.implicitCjsSource; ts.cjsSource; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -57,10 +60,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const implicitCjsSource = true; +export { ts }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -68,10 +73,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const mjsSource = true; +export { ts }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -79,8 +86,7 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const cjsSource = true; +export { ts }; //// [package.json] { "name": "package", @@ -123,22 +129,6 @@ export const cjsSource = true; } -//// [index.js] -// esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; -cjs; -mjs; -type; -import * as cjsi from "inner/a"; -import * as mjsi from "inner/b"; -import * as typei from "inner"; -import * as ts from "inner/types"; -cjsi.mjsSource; -mjsi.mjsSource; -typei.mjsSource; -ts.mjsSource; //// [index.mjs] // esm format file import * as cjs from "package/cjs"; @@ -206,11 +196,27 @@ cjsi.cjsSource; mjsi.cjsSource; typei.implicitCjsSource; ts.cjsSource; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/a"; +import * as mjsi from "inner/b"; +import * as typei from "inner"; +import * as ts from "inner/types"; +cjsi.mjsSource; +mjsi.mjsSource; +typei.mjsSource; +ts.mjsSource; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).js.diff deleted file mode 100644 index 6fd54f278d..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).js.diff +++ /dev/null @@ -1,57 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=node16).js -+++ new.nodeModulesAllowJsConditionalPackageExports(module=node16).js -@@= skipped -122, +122 lines =@@ - } - - -+//// [index.js] -+// esm format file -+import * as cjs from "package/cjs"; -+import * as mjs from "package/mjs"; -+import * as type from "package"; -+cjs; -+mjs; -+type; -+import * as cjsi from "inner/a"; -+import * as mjsi from "inner/b"; -+import * as typei from "inner"; -+import * as ts from "inner/types"; -+cjsi.mjsSource; -+mjsi.mjsSource; -+typei.mjsSource; -+ts.mjsSource; - //// [index.mjs] - // esm format file - import * as cjs from "package/cjs"; -@@= skipped -67, +83 lines =@@ - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/a"; --import * as mjsi from "inner/b"; --import * as typei from "inner"; --import * as ts from "inner/types"; --cjsi.mjsSource; --mjsi.mjsSource; --typei.mjsSource; --ts.mjsSource; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).symbols index 48ff9d9033..aa9ad6d6bd 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).symbols @@ -33,24 +33,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.js, 10, 6)) cjsi.mjsSource; ->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.js, 7, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.js, 8, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.js, 9, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.js, 10, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.mjs === // esm format file @@ -85,24 +85,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.mjs, 10, 6)) cjsi.mjsSource; ->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.mjs, 7, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.mjs, 8, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.mjs, 9, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.mjs, 10, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.cjs === // cjs format file @@ -137,109 +137,115 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.cjs, 10, 6)) cjsi.cjsSource; ->cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.cjs, 7, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) mjsi.cjsSource; ->mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.cjs, 8, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) typei.implicitCjsSource; ->typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) +>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) >typei : Symbol(typei, Decl(index.cjs, 9, 6)) ->implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) +>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) ts.cjsSource; ->ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >ts : Symbol(ts, Decl(index.cjs, 10, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.ts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.ts, 4, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 5, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 6, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 7, 8)) +>type : Symbol(type, Decl(test.d.ts, 7, 8)) export { ts }; ->ts : Symbol(type.ts, Decl(index.d.ts, 8, 8)) - -export const implicitCjsSource = true; ->implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.ts, 8, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.mts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.mts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.mts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.mts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.mts, 7, 8)) +>type : Symbol(type, Decl(test.d.mts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.mts, 8, 8)) - -export const mjsSource = true; ->mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.mts, 8, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.cts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.cts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 7, 8)) +>type : Symbol(type, Decl(test.d.cts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - -export const cjsSource = true; ->cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.cts, 8, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).symbols.diff deleted file mode 100644 index b8ce6b6cc3..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).symbols.diff +++ /dev/null @@ -1,70 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=node16).symbols -+++ new.nodeModulesAllowJsConditionalPackageExports(module=node16).symbols -@@= skipped -146, +146 lines =@@ - >cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) - - typei.implicitCjsSource; -->typei.implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) - >typei : Symbol(typei, Decl(index.cjs, 9, 6)) -->implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) - - ts.cjsSource; - >ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) -@@= skipped -24, +24 lines =@@ - >ts : Symbol(ts, Decl(index.d.ts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.type.cjs, Decl(index.d.ts, 5, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.type.mjs, Decl(index.d.ts, 6, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type.type, Decl(index.d.ts, 7, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.type.ts, Decl(index.d.ts, 8, 8)) -+>ts : Symbol(type.ts, Decl(index.d.ts, 8, 8)) - - export const implicitCjsSource = true; -->implicitCjsSource : Symbol(mjs.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -29, +29 lines =@@ - >ts : Symbol(ts, Decl(index.d.mts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 5, 8)) -+>cjs : Symbol(cjs.cjs, Decl(index.d.mts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 6, 8)) -+>mjs : Symbol(cjs.mjs, Decl(index.d.mts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type, Decl(index.d.mts, 7, 8)) -+>type : Symbol(cjs.type, Decl(index.d.mts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.ts, Decl(index.d.mts, 8, 8)) -+>ts : Symbol(cjs.ts, Decl(index.d.mts, 8, 8)) - - export const mjsSource = true; -->mjsSource : Symbol(mjs.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -41, +41 lines =@@ - >ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - - export const cjsSource = true; -->cjsSource : Symbol(cjs.cjsSource, Decl(index.d.cts, 9, 12)) -+>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).types index 296335f7dc..2b6e971e79 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).types @@ -3,22 +3,22 @@ === index.js === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -55,22 +55,22 @@ ts.mjsSource; === index.mjs === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -107,22 +107,22 @@ ts.mjsSource; === index.cjs === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -158,6 +158,12 @@ ts.cjsSource; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -182,11 +188,13 @@ export { type }; export { ts }; >ts : typeof cjs -export const implicitCjsSource = true; ->implicitCjsSource : true +=== node_modules/inner/index.d.mts === +// esm format file +export const mjsSource = true; +>mjsSource : true >true : true -=== node_modules/inner/index.d.mts === +=== node_modules/inner/test.d.mts === // esm format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -212,11 +220,13 @@ export { type }; export { ts }; >ts : typeof cjs -export const mjsSource = true; ->mjsSource : true +=== node_modules/inner/index.d.cts === +// cjs format file +export const cjsSource = true; +>cjsSource : true >true : true -=== node_modules/inner/index.d.cts === +=== node_modules/inner/test.d.cts === // cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -242,7 +252,3 @@ export { type }; export { ts }; >ts : typeof cjs -export const cjsSource = true; ->cjsSource : true ->true : true - diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt index 0e7496180a..3aa26eb8bd 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt @@ -1,27 +1,12 @@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. +index.cjs(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. +index.cjs(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.js (3 errors) ==== +==== index.js (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -33,17 +18,11 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding mjsi.mjsSource; typei.mjsSource; ts.mjsSource; -==== index.mjs (3 errors) ==== +==== index.mjs (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -55,17 +34,15 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding mjsi.mjsSource; typei.mjsSource; ts.mjsSource; -==== index.cjs (3 errors) ==== +==== index.cjs (2 errors) ==== // cjs format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. import * as type from "package"; ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. cjs; mjs; type; @@ -78,6 +55,9 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding typei.implicitCjsSource; ts.cjsSource; ==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (0 errors) ==== // cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -87,8 +67,10 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; export { ts }; - export const implicitCjsSource = true; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -98,8 +80,10 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; export { ts }; - export const mjsSource = true; ==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (0 errors) ==== // cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -109,7 +93,6 @@ index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; export { ts }; - export const cjsSource = true; ==== package.json (0 errors) ==== { "name": "package", diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).js index 2f99e51c4c..e8c327cbb8 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).js @@ -50,6 +50,9 @@ typei.implicitCjsSource; ts.cjsSource; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -57,10 +60,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const implicitCjsSource = true; +export { ts }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -68,10 +73,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const mjsSource = true; +export { ts }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -79,8 +86,7 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const cjsSource = true; +export { ts }; //// [package.json] { "name": "package", @@ -123,22 +129,6 @@ export const cjsSource = true; } -//// [index.js] -// esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; -cjs; -mjs; -type; -import * as cjsi from "inner/a"; -import * as mjsi from "inner/b"; -import * as typei from "inner"; -import * as ts from "inner/types"; -cjsi.mjsSource; -mjsi.mjsSource; -typei.mjsSource; -ts.mjsSource; //// [index.mjs] // esm format file import * as cjs from "package/cjs"; @@ -206,11 +196,27 @@ cjsi.cjsSource; mjsi.cjsSource; typei.implicitCjsSource; ts.cjsSource; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/a"; +import * as mjsi from "inner/b"; +import * as typei from "inner"; +import * as ts from "inner/types"; +cjsi.mjsSource; +mjsi.mjsSource; +typei.mjsSource; +ts.mjsSource; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).js.diff deleted file mode 100644 index 67f41a0a18..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).js.diff +++ /dev/null @@ -1,57 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=node18).js -+++ new.nodeModulesAllowJsConditionalPackageExports(module=node18).js -@@= skipped -122, +122 lines =@@ - } - - -+//// [index.js] -+// esm format file -+import * as cjs from "package/cjs"; -+import * as mjs from "package/mjs"; -+import * as type from "package"; -+cjs; -+mjs; -+type; -+import * as cjsi from "inner/a"; -+import * as mjsi from "inner/b"; -+import * as typei from "inner"; -+import * as ts from "inner/types"; -+cjsi.mjsSource; -+mjsi.mjsSource; -+typei.mjsSource; -+ts.mjsSource; - //// [index.mjs] - // esm format file - import * as cjs from "package/cjs"; -@@= skipped -67, +83 lines =@@ - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/a"; --import * as mjsi from "inner/b"; --import * as typei from "inner"; --import * as ts from "inner/types"; --cjsi.mjsSource; --mjsi.mjsSource; --typei.mjsSource; --ts.mjsSource; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).symbols index 48ff9d9033..aa9ad6d6bd 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).symbols @@ -33,24 +33,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.js, 10, 6)) cjsi.mjsSource; ->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.js, 7, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.js, 8, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.js, 9, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.js, 10, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.mjs === // esm format file @@ -85,24 +85,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.mjs, 10, 6)) cjsi.mjsSource; ->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.mjs, 7, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.mjs, 8, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.mjs, 9, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.mjs, 10, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.cjs === // cjs format file @@ -137,109 +137,115 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.cjs, 10, 6)) cjsi.cjsSource; ->cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.cjs, 7, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) mjsi.cjsSource; ->mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.cjs, 8, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) typei.implicitCjsSource; ->typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) +>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) >typei : Symbol(typei, Decl(index.cjs, 9, 6)) ->implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) +>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) ts.cjsSource; ->ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >ts : Symbol(ts, Decl(index.cjs, 10, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.ts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.ts, 4, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 5, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 6, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 7, 8)) +>type : Symbol(type, Decl(test.d.ts, 7, 8)) export { ts }; ->ts : Symbol(type.ts, Decl(index.d.ts, 8, 8)) - -export const implicitCjsSource = true; ->implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.ts, 8, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.mts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.mts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.mts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.mts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.mts, 7, 8)) +>type : Symbol(type, Decl(test.d.mts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.mts, 8, 8)) - -export const mjsSource = true; ->mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.mts, 8, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.cts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.cts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 7, 8)) +>type : Symbol(type, Decl(test.d.cts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - -export const cjsSource = true; ->cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.cts, 8, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).symbols.diff deleted file mode 100644 index ef0e58c515..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).symbols.diff +++ /dev/null @@ -1,70 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=node18).symbols -+++ new.nodeModulesAllowJsConditionalPackageExports(module=node18).symbols -@@= skipped -146, +146 lines =@@ - >cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) - - typei.implicitCjsSource; -->typei.implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) - >typei : Symbol(typei, Decl(index.cjs, 9, 6)) -->implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) - - ts.cjsSource; - >ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) -@@= skipped -24, +24 lines =@@ - >ts : Symbol(ts, Decl(index.d.ts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.type.cjs, Decl(index.d.ts, 5, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.type.mjs, Decl(index.d.ts, 6, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type.type, Decl(index.d.ts, 7, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.type.ts, Decl(index.d.ts, 8, 8)) -+>ts : Symbol(type.ts, Decl(index.d.ts, 8, 8)) - - export const implicitCjsSource = true; -->implicitCjsSource : Symbol(mjs.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -29, +29 lines =@@ - >ts : Symbol(ts, Decl(index.d.mts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 5, 8)) -+>cjs : Symbol(cjs.cjs, Decl(index.d.mts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 6, 8)) -+>mjs : Symbol(cjs.mjs, Decl(index.d.mts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type, Decl(index.d.mts, 7, 8)) -+>type : Symbol(cjs.type, Decl(index.d.mts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.ts, Decl(index.d.mts, 8, 8)) -+>ts : Symbol(cjs.ts, Decl(index.d.mts, 8, 8)) - - export const mjsSource = true; -->mjsSource : Symbol(mjs.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -41, +41 lines =@@ - >ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - - export const cjsSource = true; -->cjsSource : Symbol(cjs.cjsSource, Decl(index.d.cts, 9, 12)) -+>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).types index 296335f7dc..2b6e971e79 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).types @@ -3,22 +3,22 @@ === index.js === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -55,22 +55,22 @@ ts.mjsSource; === index.mjs === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -107,22 +107,22 @@ ts.mjsSource; === index.cjs === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -158,6 +158,12 @@ ts.cjsSource; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -182,11 +188,13 @@ export { type }; export { ts }; >ts : typeof cjs -export const implicitCjsSource = true; ->implicitCjsSource : true +=== node_modules/inner/index.d.mts === +// esm format file +export const mjsSource = true; +>mjsSource : true >true : true -=== node_modules/inner/index.d.mts === +=== node_modules/inner/test.d.mts === // esm format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -212,11 +220,13 @@ export { type }; export { ts }; >ts : typeof cjs -export const mjsSource = true; ->mjsSource : true +=== node_modules/inner/index.d.cts === +// cjs format file +export const cjsSource = true; +>cjsSource : true >true : true -=== node_modules/inner/index.d.cts === +=== node_modules/inner/test.d.cts === // cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -242,7 +252,3 @@ export { type }; export { ts }; >ts : typeof cjs -export const cjsSource = true; ->cjsSource : true ->true : true - diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).errors.txt deleted file mode 100644 index c34e5bec84..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).errors.txt +++ /dev/null @@ -1,193 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.cjs(9,23): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -index.cjs(10,24): error TS2307: Cannot find module 'inner' or its corresponding type declarations. -index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.js(9,23): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -index.js(10,24): error TS2307: Cannot find module 'inner' or its corresponding type declarations. -index.js(12,6): error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -index.js(15,4): error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mjs(8,23): error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. -node_modules/inner/index.d.cts(3,22): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -node_modules/inner/index.d.cts(4,23): error TS2307: Cannot find module 'inner' or its corresponding type declarations. -node_modules/inner/index.d.mts(2,22): error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. -node_modules/inner/index.d.ts(3,22): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -node_modules/inner/index.d.ts(4,23): error TS2307: Cannot find module 'inner' or its corresponding type declarations. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.js (7 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/a"; - import * as mjsi from "inner/b"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. - import * as typei from "inner"; - ~~~~~~~ -!!! error TS2307: Cannot find module 'inner' or its corresponding type declarations. - import * as ts from "inner/types"; - cjsi.mjsSource; - ~~~~~~~~~ -!!! error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -!!! related TS2728 node_modules/inner/index.d.cts:10:14: 'cjsSource' is declared here. - mjsi.mjsSource; - typei.mjsSource; - ts.mjsSource; - ~~~~~~~~~ -!!! error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -!!! related TS2728 node_modules/inner/index.d.cts:10:14: 'cjsSource' is declared here. -==== index.mjs (4 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/a"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. - import * as mjsi from "inner/b"; - import * as typei from "inner"; - import * as ts from "inner/types"; - cjsi.mjsSource; - mjsi.mjsSource; - typei.mjsSource; - ts.mjsSource; -==== index.cjs (5 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/a"; - import * as mjsi from "inner/b"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. - import * as typei from "inner"; - ~~~~~~~ -!!! error TS2307: Cannot find module 'inner' or its corresponding type declarations. - import * as ts from "inner/types"; - cjsi.cjsSource; - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; -==== node_modules/inner/index.d.ts (2 errors) ==== - // cjs format file - import * as cjs from "inner/a"; - import * as mjs from "inner/b"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. - import * as type from "inner"; - ~~~~~~~ -!!! error TS2307: Cannot find module 'inner' or its corresponding type declarations. - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; - export { type }; - export { ts }; - export const implicitCjsSource = true; -==== node_modules/inner/index.d.mts (1 errors) ==== - // esm format file - import * as cjs from "inner/a"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; - export { type }; - export { ts }; - export const mjsSource = true; -==== node_modules/inner/index.d.cts (2 errors) ==== - // cjs format file - import * as cjs from "inner/a"; - import * as mjs from "inner/b"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. - import * as type from "inner"; - ~~~~~~~ -!!! error TS2307: Cannot find module 'inner' or its corresponding type declarations. - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; - export { type }; - export { ts }; - export const cjsSource = true; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module", - "exports": { - "./cjs": "./index.cjs", - "./mjs": "./index.mjs", - ".": "./index.js" - } - } -==== node_modules/inner/package.json (0 errors) ==== - { - "name": "inner", - "private": true, - "exports": { - "./a": { - "require": "./index.cjs", - "node": "./index.mjs" - }, - "./b": { - "import": "./index.mjs", - "node": "./index.cjs" - }, - ".": { - "import": "./index.mjs", - "node": "./index.js" - }, - "./types": { - "types": { - "import": "./index.d.mts", - "require": "./index.d.cts" - }, - "node": { - "import": "./index.mjs", - "require": "./index.cjs" - } - } - } - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).js index 4fb8ca4f24..e8c327cbb8 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).js @@ -50,6 +50,9 @@ typei.implicitCjsSource; ts.cjsSource; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -57,10 +60,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const implicitCjsSource = true; +export { ts }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -68,10 +73,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const mjsSource = true; +export { ts }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -79,8 +86,7 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const cjsSource = true; +export { ts }; //// [package.json] { "name": "package", @@ -123,65 +129,94 @@ export const cjsSource = true; } -//// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -// esm format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); -cjs; -mjs; -type; -const cjsi = require("inner/a"); -const mjsi = require("inner/b"); -const typei = require("inner"); -const ts = require("inner/types"); -cjsi.mjsSource; -mjsi.mjsSource; -typei.mjsSource; -ts.mjsSource; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; cjs; mjs; type; -const cjsi = require("inner/a"); -const mjsi = require("inner/b"); -const typei = require("inner"); -const ts = require("inner/types"); +import * as cjsi from "inner/a"; +import * as mjsi from "inner/b"; +import * as typei from "inner"; +import * as ts from "inner/types"; cjsi.mjsSource; mjsi.mjsSource; typei.mjsSource; ts.mjsSource; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // cjs format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); +const cjs = __importStar(require("package/cjs")); +const mjs = __importStar(require("package/mjs")); +const type = __importStar(require("package")); cjs; mjs; type; -const cjsi = require("inner/a"); -const mjsi = require("inner/b"); -const typei = require("inner"); -const ts = require("inner/types"); +const cjsi = __importStar(require("inner/a")); +const mjsi = __importStar(require("inner/b")); +const typei = __importStar(require("inner")); +const ts = __importStar(require("inner/types")); cjsi.cjsSource; mjsi.cjsSource; typei.implicitCjsSource; ts.cjsSource; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/a"; +import * as mjsi from "inner/b"; +import * as typei from "inner"; +import * as ts from "inner/types"; +cjsi.mjsSource; +mjsi.mjsSource; +typei.mjsSource; +ts.mjsSource; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).js.diff deleted file mode 100644 index 36075a475c..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).js.diff +++ /dev/null @@ -1,135 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=node20).js -+++ new.nodeModulesAllowJsConditionalPackageExports(module=node20).js -@@= skipped -122, +122 lines =@@ - } - - -+//// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+// esm format file -+const cjs = require("package/cjs"); -+const mjs = require("package/mjs"); -+const type = require("package"); -+cjs; -+mjs; -+type; -+const cjsi = require("inner/a"); -+const mjsi = require("inner/b"); -+const typei = require("inner"); -+const ts = require("inner/types"); -+cjsi.mjsSource; -+mjsi.mjsSource; -+typei.mjsSource; -+ts.mjsSource; - //// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; -+const cjs = require("package/cjs"); -+const mjs = require("package/mjs"); -+const type = require("package"); - cjs; - mjs; - type; --import * as cjsi from "inner/a"; --import * as mjsi from "inner/b"; --import * as typei from "inner"; --import * as ts from "inner/types"; -+const cjsi = require("inner/a"); -+const mjsi = require("inner/b"); -+const typei = require("inner"); -+const ts = require("inner/types"); - cjsi.mjsSource; - mjsi.mjsSource; - typei.mjsSource; - ts.mjsSource; - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - // cjs format file --const cjs = __importStar(require("package/cjs")); --const mjs = __importStar(require("package/mjs")); --const type = __importStar(require("package")); -+const cjs = require("package/cjs"); -+const mjs = require("package/mjs"); -+const type = require("package"); - cjs; - mjs; - type; --const cjsi = __importStar(require("inner/a")); --const mjsi = __importStar(require("inner/b")); --const typei = __importStar(require("inner")); --const ts = __importStar(require("inner/types")); -+const cjsi = require("inner/a"); -+const mjsi = require("inner/b"); -+const typei = require("inner"); -+const ts = require("inner/types"); - cjsi.cjsSource; - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/a"; --import * as mjsi from "inner/b"; --import * as typei from "inner"; --import * as ts from "inner/types"; --cjsi.mjsSource; --mjsi.mjsSource; --typei.mjsSource; --ts.mjsSource; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).symbols index 4a556ae9e3..aa9ad6d6bd 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).symbols @@ -33,16 +33,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.js, 10, 6)) cjsi.mjsSource; +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.js, 7, 6)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.js, 8, 6)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.js, 9, 6)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.js, 10, 6)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.mjs === // esm format file @@ -77,22 +85,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.mjs, 10, 6)) cjsi.mjsSource; +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.mjs, 7, 6)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.mjs, 8, 6)) ->mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.mjs, 9, 6)) ->mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.mjs, 10, 6)) ->mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.cjs === // cjs format file @@ -127,105 +137,115 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.cjs, 10, 6)) cjsi.cjsSource; ->cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.cjs, 7, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) mjsi.cjsSource; +>mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.cjs, 8, 6)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) typei.implicitCjsSource; +>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) >typei : Symbol(typei, Decl(index.cjs, 9, 6)) +>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) ts.cjsSource; ->ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >ts : Symbol(ts, Decl(index.cjs, 10, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.ts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.ts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.ts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 5, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.ts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 6, 8)) export { type }; ->type : Symbol(type, Decl(index.d.ts, 7, 8)) +>type : Symbol(type, Decl(test.d.ts, 7, 8)) export { ts }; ->ts : Symbol(ts, Decl(index.d.ts, 8, 8)) - -export const implicitCjsSource = true; ->implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.ts, 8, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.mts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.mts, 4, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 5, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 6, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 7, 8)) +>type : Symbol(type, Decl(test.d.mts, 7, 8)) export { ts }; ->ts : Symbol(mjs.ts, Decl(index.d.mts, 8, 8)) - -export const mjsSource = true; ->mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.mts, 8, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.cts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.cts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 7, 8)) +>type : Symbol(type, Decl(test.d.cts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - -export const cjsSource = true; ->cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.cts, 8, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).symbols.diff deleted file mode 100644 index 2c11338782..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).symbols.diff +++ /dev/null @@ -1,113 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=node20).symbols -+++ new.nodeModulesAllowJsConditionalPackageExports(module=node20).symbols -@@= skipped -32, +32 lines =@@ - >ts : Symbol(ts, Decl(index.js, 10, 6)) - - cjsi.mjsSource; -->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - >cjsi : Symbol(cjsi, Decl(index.js, 7, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - - mjsi.mjsSource; -->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - >mjsi : Symbol(mjsi, Decl(index.js, 8, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - - typei.mjsSource; -->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - >typei : Symbol(typei, Decl(index.js, 9, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - - ts.mjsSource; -->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - >ts : Symbol(ts, Decl(index.js, 10, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - - === index.mjs === - // esm format file -@@= skipped -52, +44 lines =@@ - >ts : Symbol(ts, Decl(index.mjs, 10, 6)) - - cjsi.mjsSource; -->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - >cjsi : Symbol(cjsi, Decl(index.mjs, 7, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - - mjsi.mjsSource; -->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsi.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) - >mjsi : Symbol(mjsi, Decl(index.mjs, 8, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) - - typei.mjsSource; -->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) -+>typei.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) - >typei : Symbol(typei, Decl(index.mjs, 9, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) - - ts.mjsSource; -->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) -+>ts.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) - >ts : Symbol(ts, Decl(index.mjs, 10, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) - - === index.cjs === - // cjs format file -@@= skipped -57, +55 lines =@@ - >cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) - - mjsi.cjsSource; -->mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) - >mjsi : Symbol(mjsi, Decl(index.cjs, 8, 6)) -->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) - - typei.implicitCjsSource; -->typei.implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) - >typei : Symbol(typei, Decl(index.cjs, 9, 6)) -->implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) - - ts.cjsSource; - >ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) -@@= skipped -29, +25 lines =@@ - >ts : Symbol(ts, Decl(index.d.ts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.type.cjs, Decl(index.d.ts, 5, 8)) -+>cjs : Symbol(cjs, Decl(index.d.ts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.type.mjs, Decl(index.d.ts, 6, 8)) -+>mjs : Symbol(mjs, Decl(index.d.ts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type.type, Decl(index.d.ts, 7, 8)) -+>type : Symbol(type, Decl(index.d.ts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.type.ts, Decl(index.d.ts, 8, 8)) -+>ts : Symbol(ts, Decl(index.d.ts, 8, 8)) - - export const implicitCjsSource = true; -->implicitCjsSource : Symbol(mjs.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -41, +41 lines =@@ - >ts : Symbol(mjs.ts, Decl(index.d.mts, 8, 8)) - - export const mjsSource = true; -->mjsSource : Symbol(mjs.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -29, +29 lines =@@ - >ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - - export const cjsSource = true; -->cjsSource : Symbol(cjs.cjsSource, Decl(index.d.cts, 9, 12)) -+>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).types index 36b23e0799..2b6e971e79 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).types @@ -3,135 +3,135 @@ === index.js === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi import * as mjsi from "inner/b"; ->mjsi : any +>mjsi : typeof cjsi import * as typei from "inner"; ->typei : any +>typei : typeof cjsi import * as ts from "inner/types"; >ts : typeof cjsi cjsi.mjsSource; ->cjsi.mjsSource : any +>cjsi.mjsSource : true >cjsi : typeof cjsi ->mjsSource : any +>mjsSource : true mjsi.mjsSource; ->mjsi.mjsSource : any ->mjsi : any ->mjsSource : any +>mjsi.mjsSource : true +>mjsi : typeof cjsi +>mjsSource : true typei.mjsSource; ->typei.mjsSource : any ->typei : any ->mjsSource : any +>typei.mjsSource : true +>typei : typeof cjsi +>mjsSource : true ts.mjsSource; ->ts.mjsSource : any +>ts.mjsSource : true >ts : typeof cjsi ->mjsSource : any +>mjsSource : true === index.mjs === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; ->cjsi : any +>cjsi : typeof cjsi import * as mjsi from "inner/b"; ->mjsi : typeof mjsi +>mjsi : typeof cjsi import * as typei from "inner"; ->typei : typeof mjsi +>typei : typeof cjsi import * as ts from "inner/types"; ->ts : typeof mjsi +>ts : typeof cjsi cjsi.mjsSource; ->cjsi.mjsSource : any ->cjsi : any ->mjsSource : any +>cjsi.mjsSource : true +>cjsi : typeof cjsi +>mjsSource : true mjsi.mjsSource; >mjsi.mjsSource : true ->mjsi : typeof mjsi +>mjsi : typeof cjsi >mjsSource : true typei.mjsSource; >typei.mjsSource : true ->typei : typeof mjsi +>typei : typeof cjsi >mjsSource : true ts.mjsSource; >ts.mjsSource : true ->ts : typeof mjsi +>ts : typeof cjsi >mjsSource : true === index.cjs === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi import * as mjsi from "inner/b"; ->mjsi : any +>mjsi : typeof cjsi import * as typei from "inner"; ->typei : any +>typei : typeof typei import * as ts from "inner/types"; >ts : typeof cjsi @@ -142,14 +142,14 @@ cjsi.cjsSource; >cjsSource : true mjsi.cjsSource; ->mjsi.cjsSource : any ->mjsi : any ->cjsSource : any +>mjsi.cjsSource : true +>mjsi : typeof cjsi +>cjsSource : true typei.implicitCjsSource; ->typei.implicitCjsSource : any ->typei : any ->implicitCjsSource : any +>typei.implicitCjsSource : true +>typei : typeof typei +>implicitCjsSource : true ts.cjsSource; >ts.cjsSource : true @@ -158,14 +158,20 @@ ts.cjsSource; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs import * as mjs from "inner/b"; ->mjs : any +>mjs : typeof cjs import * as type from "inner"; ->type : any +>type : typeof type import * as ts from "inner/types"; >ts : typeof cjs @@ -174,58 +180,62 @@ export { cjs }; >cjs : typeof cjs export { mjs }; ->mjs : any +>mjs : typeof cjs export { type }; ->type : any +>type : typeof type export { ts }; >ts : typeof cjs -export const implicitCjsSource = true; ->implicitCjsSource : true +=== node_modules/inner/index.d.mts === +// esm format file +export const mjsSource = true; +>mjsSource : true >true : true -=== node_modules/inner/index.d.mts === +=== node_modules/inner/test.d.mts === // esm format file import * as cjs from "inner/a"; ->cjs : any +>cjs : typeof cjs import * as mjs from "inner/b"; ->mjs : typeof mjs +>mjs : typeof cjs import * as type from "inner"; ->type : typeof mjs +>type : typeof cjs import * as ts from "inner/types"; ->ts : typeof mjs +>ts : typeof cjs export { cjs }; ->cjs : any +>cjs : typeof cjs export { mjs }; ->mjs : typeof mjs +>mjs : typeof cjs export { type }; ->type : typeof mjs +>type : typeof cjs export { ts }; ->ts : typeof mjs +>ts : typeof cjs -export const mjsSource = true; ->mjsSource : true +=== node_modules/inner/index.d.cts === +// cjs format file +export const cjsSource = true; +>cjsSource : true >true : true -=== node_modules/inner/index.d.cts === +=== node_modules/inner/test.d.cts === // cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs import * as mjs from "inner/b"; ->mjs : any +>mjs : typeof cjs import * as type from "inner"; ->type : any +>type : typeof type import * as ts from "inner/types"; >ts : typeof cjs @@ -234,15 +244,11 @@ export { cjs }; >cjs : typeof cjs export { mjs }; ->mjs : any +>mjs : typeof cjs export { type }; ->type : any +>type : typeof type export { ts }; >ts : typeof cjs -export const cjsSource = true; ->cjsSource : true ->true : true - diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt deleted file mode 100644 index 0e7496180a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt +++ /dev/null @@ -1,153 +0,0 @@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.js (3 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/a"; - import * as mjsi from "inner/b"; - import * as typei from "inner"; - import * as ts from "inner/types"; - cjsi.mjsSource; - mjsi.mjsSource; - typei.mjsSource; - ts.mjsSource; -==== index.mjs (3 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/a"; - import * as mjsi from "inner/b"; - import * as typei from "inner"; - import * as ts from "inner/types"; - cjsi.mjsSource; - mjsi.mjsSource; - typei.mjsSource; - ts.mjsSource; -==== index.cjs (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/a"; - import * as mjsi from "inner/b"; - import * as typei from "inner"; - import * as ts from "inner/types"; - cjsi.cjsSource; - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; -==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/a"; - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; - export { type }; - export { ts }; - export const implicitCjsSource = true; -==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/a"; - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; - export { type }; - export { ts }; - export const mjsSource = true; -==== node_modules/inner/index.d.cts (0 errors) ==== - // cjs format file - import * as cjs from "inner/a"; - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; - export { type }; - export { ts }; - export const cjsSource = true; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module", - "exports": { - "./cjs": "./index.cjs", - "./mjs": "./index.mjs", - ".": "./index.js" - } - } -==== node_modules/inner/package.json (0 errors) ==== - { - "name": "inner", - "private": true, - "exports": { - "./a": { - "require": "./index.cjs", - "node": "./index.mjs" - }, - "./b": { - "import": "./index.mjs", - "node": "./index.cjs" - }, - ".": { - "import": "./index.mjs", - "node": "./index.js" - }, - "./types": { - "types": { - "import": "./index.d.mts", - "require": "./index.d.cts" - }, - "node": { - "import": "./index.mjs", - "require": "./index.cjs" - } - } - } - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).js index 2f99e51c4c..e8c327cbb8 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).js @@ -50,6 +50,9 @@ typei.implicitCjsSource; ts.cjsSource; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -57,10 +60,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const implicitCjsSource = true; +export { ts }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -68,10 +73,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const mjsSource = true; +export { ts }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -79,8 +86,7 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const cjsSource = true; +export { ts }; //// [package.json] { "name": "package", @@ -123,22 +129,6 @@ export const cjsSource = true; } -//// [index.js] -// esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; -cjs; -mjs; -type; -import * as cjsi from "inner/a"; -import * as mjsi from "inner/b"; -import * as typei from "inner"; -import * as ts from "inner/types"; -cjsi.mjsSource; -mjsi.mjsSource; -typei.mjsSource; -ts.mjsSource; //// [index.mjs] // esm format file import * as cjs from "package/cjs"; @@ -206,11 +196,27 @@ cjsi.cjsSource; mjsi.cjsSource; typei.implicitCjsSource; ts.cjsSource; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/a"; +import * as mjsi from "inner/b"; +import * as typei from "inner"; +import * as ts from "inner/types"; +cjsi.mjsSource; +mjsi.mjsSource; +typei.mjsSource; +ts.mjsSource; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).js.diff deleted file mode 100644 index 321270cbcb..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).js.diff +++ /dev/null @@ -1,57 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=nodenext).js -+++ new.nodeModulesAllowJsConditionalPackageExports(module=nodenext).js -@@= skipped -122, +122 lines =@@ - } - - -+//// [index.js] -+// esm format file -+import * as cjs from "package/cjs"; -+import * as mjs from "package/mjs"; -+import * as type from "package"; -+cjs; -+mjs; -+type; -+import * as cjsi from "inner/a"; -+import * as mjsi from "inner/b"; -+import * as typei from "inner"; -+import * as ts from "inner/types"; -+cjsi.mjsSource; -+mjsi.mjsSource; -+typei.mjsSource; -+ts.mjsSource; - //// [index.mjs] - // esm format file - import * as cjs from "package/cjs"; -@@= skipped -67, +83 lines =@@ - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/a"; --import * as mjsi from "inner/b"; --import * as typei from "inner"; --import * as ts from "inner/types"; --cjsi.mjsSource; --mjsi.mjsSource; --typei.mjsSource; --ts.mjsSource; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).symbols index 48ff9d9033..aa9ad6d6bd 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).symbols @@ -33,24 +33,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.js, 10, 6)) cjsi.mjsSource; ->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.js, 7, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.js, 8, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.js, 9, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.js, 10, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.mjs === // esm format file @@ -85,24 +85,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.mjs, 10, 6)) cjsi.mjsSource; ->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.mjs, 7, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.mjs, 8, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.mjs, 9, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.mjs, 10, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.cjs === // cjs format file @@ -137,109 +137,115 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.cjs, 10, 6)) cjsi.cjsSource; ->cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.cjs, 7, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) mjsi.cjsSource; ->mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.cjs, 8, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) typei.implicitCjsSource; ->typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) +>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) >typei : Symbol(typei, Decl(index.cjs, 9, 6)) ->implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) +>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) ts.cjsSource; ->ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >ts : Symbol(ts, Decl(index.cjs, 10, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.ts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.ts, 4, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 5, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 6, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 7, 8)) +>type : Symbol(type, Decl(test.d.ts, 7, 8)) export { ts }; ->ts : Symbol(type.ts, Decl(index.d.ts, 8, 8)) - -export const implicitCjsSource = true; ->implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.ts, 8, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.mts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.mts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.mts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.mts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.mts, 7, 8)) +>type : Symbol(type, Decl(test.d.mts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.mts, 8, 8)) - -export const mjsSource = true; ->mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.mts, 8, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.cts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.cts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 7, 8)) +>type : Symbol(type, Decl(test.d.cts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - -export const cjsSource = true; ->cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.cts, 8, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).symbols.diff deleted file mode 100644 index 8dc875ae80..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).symbols.diff +++ /dev/null @@ -1,70 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=nodenext).symbols -+++ new.nodeModulesAllowJsConditionalPackageExports(module=nodenext).symbols -@@= skipped -146, +146 lines =@@ - >cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) - - typei.implicitCjsSource; -->typei.implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) - >typei : Symbol(typei, Decl(index.cjs, 9, 6)) -->implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) - - ts.cjsSource; - >ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) -@@= skipped -24, +24 lines =@@ - >ts : Symbol(ts, Decl(index.d.ts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.type.cjs, Decl(index.d.ts, 5, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.type.mjs, Decl(index.d.ts, 6, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type.type, Decl(index.d.ts, 7, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.type.ts, Decl(index.d.ts, 8, 8)) -+>ts : Symbol(type.ts, Decl(index.d.ts, 8, 8)) - - export const implicitCjsSource = true; -->implicitCjsSource : Symbol(mjs.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -29, +29 lines =@@ - >ts : Symbol(ts, Decl(index.d.mts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 5, 8)) -+>cjs : Symbol(cjs.cjs, Decl(index.d.mts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 6, 8)) -+>mjs : Symbol(cjs.mjs, Decl(index.d.mts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type, Decl(index.d.mts, 7, 8)) -+>type : Symbol(cjs.type, Decl(index.d.mts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.ts, Decl(index.d.mts, 8, 8)) -+>ts : Symbol(cjs.ts, Decl(index.d.mts, 8, 8)) - - export const mjsSource = true; -->mjsSource : Symbol(mjs.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -41, +41 lines =@@ - >ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - - export const cjsSource = true; -->cjsSource : Symbol(cjs.cjsSource, Decl(index.d.cts, 9, 12)) -+>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).types index 296335f7dc..2b6e971e79 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).types @@ -3,22 +3,22 @@ === index.js === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -55,22 +55,22 @@ ts.mjsSource; === index.mjs === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -107,22 +107,22 @@ ts.mjsSource; === index.cjs === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -158,6 +158,12 @@ ts.cjsSource; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -182,11 +188,13 @@ export { type }; export { ts }; >ts : typeof cjs -export const implicitCjsSource = true; ->implicitCjsSource : true +=== node_modules/inner/index.d.mts === +// esm format file +export const mjsSource = true; +>mjsSource : true >true : true -=== node_modules/inner/index.d.mts === +=== node_modules/inner/test.d.mts === // esm format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -212,11 +220,13 @@ export { type }; export { ts }; >ts : typeof cjs -export const mjsSource = true; ->mjsSource : true +=== node_modules/inner/index.d.cts === +// cjs format file +export const cjsSource = true; +>cjsSource : true >true : true -=== node_modules/inner/index.d.cts === +=== node_modules/inner/test.d.cts === // cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -242,7 +252,3 @@ export { type }; export { ts }; >ts : typeof cjs -export const cjsSource = true; ->cjsSource : true ->true : true - diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsDynamicImport(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsDynamicImport(module=node20).errors.txt deleted file mode 100644 index eda4bffb81..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsDynamicImport(module=node20).errors.txt +++ /dev/null @@ -1,34 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2468: Cannot find global value 'Promise'. -index.js(3,32): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -subfolder/index.js(3,32): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2468: Cannot find global value 'Promise'. -==== subfolder/index.js (1 errors) ==== - // cjs format file - export async function main() { - const { readFile } = await import("fs"); - ~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - } -==== index.js (1 errors) ==== - // esm format file - export async function main() { - const { readFile } = await import("fs"); - ~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - } -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module" - } -==== subfolder/package.json (0 errors) ==== - { - "type": "commonjs" - } -==== types.d.ts (0 errors) ==== - declare module "fs"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsDynamicImport(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsDynamicImport(module=node20).js index 14d22d1b08..b5d9166a68 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsDynamicImport(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsDynamicImport(module=node20).js @@ -32,11 +32,8 @@ async function main() { const { readFile } = await import("fs"); } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.main = main; // esm format file -async function main() { +export async function main() { const { readFile } = await import("fs"); } diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsDynamicImport(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsDynamicImport(module=node20).js.diff index 50ad6b28d0..f9b96a66fd 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsDynamicImport(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsDynamicImport(module=node20).js.diff @@ -1,17 +1,6 @@ --- old.nodeModulesAllowJsDynamicImport(module=node20).js +++ new.nodeModulesAllowJsDynamicImport(module=node20).js -@@= skipped -31, +31 lines =@@ - const { readFile } = await import("fs"); - } - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.main = main; - // esm format file --export async function main() { -+async function main() { - const { readFile } = await import("fs"); - } +@@= skipped -38, +38 lines =@@ //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node20).errors.txt index a4ebc19ca3..f3b7906029 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node20).errors.txt @@ -1,9 +1,9 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. +file.js(4,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. +index.js(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. index.js(3,1): error TS8003: 'export =' can only be used in TypeScript files. subfolder/index.js(3,1): error TS8003: 'export =' can only be used in TypeScript files. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== subfolder/index.js (1 errors) ==== // cjs format file const a = {}; @@ -14,17 +14,21 @@ subfolder/index.js(3,1): error TS8003: 'export =' can only be used in TypeScript // cjs format file const a = {}; module.exports = a; -==== index.js (1 errors) ==== +==== index.js (2 errors) ==== // esm format file const a = {}; export = a; ~~~~~~~~~~~ +!!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. + ~~~~~~~~~~~ !!! error TS8003: 'export =' can only be used in TypeScript files. -==== file.js (0 errors) ==== +==== file.js (1 errors) ==== // esm format file import "fs"; const a = {}; module.exports = a; + ~~~~~~~~~~~~~~~~~~ +!!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. ==== package.json (0 errors) ==== { "name": "package", diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node20).js index 71318b47c9..dd51eb1722 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node20).js @@ -34,20 +34,19 @@ module.exports = a; const a = {}; module.exports = a; //// [file.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); // cjs format file const a = {}; export = a; module.exports = a; //// [index.js] -"use strict"; // esm format file const a = {}; -module.exports = a; +export {}; //// [file.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -require("fs"); +import "fs"; const a = {}; export = a; module.exports = a; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node20).js.diff index a26cea7c55..aa2779e63b 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportAssignment(module=node20).js.diff @@ -1,53 +1,36 @@ --- old.nodeModulesAllowJsExportAssignment(module=node20).js +++ new.nodeModulesAllowJsExportAssignment(module=node20).js -@@= skipped -33, +33 lines =@@ - const a = {}; +@@= skipped -34, +34 lines =@@ module.exports = a; //// [file.js] --"use strict"; + "use strict"; ++Object.defineProperty(exports, "__esModule", { value: true }); // cjs format file const a = {}; +export = a; module.exports = a; //// [index.js] -+"use strict"; // esm format file - const a = {}; --export {}; -+module.exports = a; - //// [file.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); +@@= skipped -11, +13 lines =@@ // esm format file -+require("fs"); -+const a = {}; -+export = a; -+module.exports = a; -+ -+ -+//// [index.d.ts] -+declare const a: {}; -+export = a; -+//// [file.d.ts] -+export = a; -+//// [index.d.ts] -+declare const a: {}; -+export = a; -+//// [file.d.ts] import "fs"; --const a = {}; --module.exports = a; -- -- --//// [index.d.ts] --export = a; --declare const a: {}; --//// [file.d.ts] + const a = {}; ++export = a; + module.exports = a; + + + //// [index.d.ts] -export = a; + declare const a: {}; ++export = a; + //// [file.d.ts] + export = a; -declare const a: {}; --//// [index.d.ts] + //// [index.d.ts] -export = a; --declare const a: {}; --//// [file.d.ts] + declare const a: {}; ++export = a; + //// [file.d.ts] -export {}; ++import "fs"; +export = a; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node20).errors.txt deleted file mode 100644 index 338d873651..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node20).errors.txt +++ /dev/null @@ -1,8 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== foo.cjs (0 errors) ==== - // this file is a module despite having no imports -==== bar.js (0 errors) ==== - // however this file is _not_ a module \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node20).errors.txt index 110deab4eb..6bdf1d41c6 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node20).errors.txt @@ -1,13 +1,8 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -index.js(2,10): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. -index.js(3,7): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. -index.js(5,14): error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. subfolder/index.js(2,10): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. subfolder/index.js(3,7): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. subfolder/index.js(5,14): error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== subfolder/index.js (3 errors) ==== // cjs format file function require() {} @@ -21,18 +16,12 @@ subfolder/index.js(5,14): error TS1216: Identifier expected. '__esModule' is res ~~~~~~~~~~ !!! error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. export {require, exports, Object}; -==== index.js (3 errors) ==== +==== index.js (0 errors) ==== // esm format file function require() {} - ~~~~~~~ -!!! error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. const exports = {}; - ~~~~~~~ -!!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. class Object {} export const __esModule = false; - ~~~~~~~~~~ -!!! error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. export {require, exports, Object}; ==== package.json (0 errors) ==== { diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node20).js index 48393d9b01..4048da5b4f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node20).js @@ -39,18 +39,13 @@ class Object { exports.Object = Object; exports.__esModule = false; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Object = exports.exports = exports.__esModule = void 0; -exports.require = require; // esm format file function require() { } const exports = {}; -exports.exports = exports; class Object { } -exports.Object = Object; -exports.__esModule = false; +export const __esModule = false; +export { require, exports, Object }; //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node20).js.diff index c3b8617dd4..d87de02819 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node20).js.diff @@ -1,50 +1,27 @@ --- old.nodeModulesAllowJsGeneratedNameCollisions(module=node20).js +++ new.nodeModulesAllowJsGeneratedNameCollisions(module=node20).js -@@= skipped -38, +38 lines =@@ - exports.Object = Object; - exports.__esModule = false; - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.Object = exports.exports = exports.__esModule = void 0; -+exports.require = require; - // esm format file - function require() { } - const exports = {}; -+exports.exports = exports; - class Object { - } --export const __esModule = false; --export { require, exports, Object }; -- -- --//// [index.d.ts] --export const __esModule: false; --export function require(): void; --export const exports: {}; --export class Object { --} --//// [index.d.ts] +@@= skipped -48, +48 lines =@@ + + + //// [index.d.ts] -export const __esModule: false; -export function require(): void; -export const exports: {}; -export class Object { --} -+exports.Object = Object; -+exports.__esModule = false; -+ -+ -+//// [index.d.ts] +declare function require(): void; +declare const exports: {}; +declare class Object { -+} + } +export declare const __esModule = false; +export { require, exports, Object }; -+//// [index.d.ts] + //// [index.d.ts] +-export const __esModule: false; +-export function require(): void; +-export const exports: {}; +-export class Object { +declare function require(): void; +declare const exports: {}; +declare class Object { -+} + } +export declare const __esModule = false; +export { require, exports, Object }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportAssignment(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportAssignment(module=node20).errors.txt index 70f57dd9dd..476c47f703 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportAssignment(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportAssignment(module=node20).errors.txt @@ -1,4 +1,3 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. file.js(4,1): error TS8002: 'import ... =' can only be used in TypeScript files. file.js(6,1): error TS8002: 'import ... =' can only be used in TypeScript files. index.js(2,1): error TS8002: 'import ... =' can only be used in TypeScript files. @@ -7,7 +6,6 @@ subfolder/index.js(2,1): error TS8002: 'import ... =' can only be used in TypeSc subfolder/index.js(4,1): error TS8002: 'import ... =' can only be used in TypeScript files. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== subfolder/index.js (2 errors) ==== // cjs format file import fs = require("fs"); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportAssignment(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportAssignment(module=node20).js index 2cef9a1e63..80990ff3ca 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportAssignment(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportAssignment(module=node20).js @@ -38,21 +38,23 @@ const fs = require("fs"); fs.readFile; exports.fs2 = require("fs"); //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +import { createRequire as _createRequire } from "module"; +const __require = _createRequire(import.meta.url); // esm format file -const fs = require("fs"); +const fs = __require("fs"); fs.readFile; -exports.fs2 = require("fs"); +const fs2 = __require("fs"); +export { fs2 }; //// [file.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +import { createRequire as _createRequire_1 } from "module"; +const __require_1 = _createRequire_1(import.meta.url); // esm format file const __require = null; const _createRequire = null; -const fs = require("fs"); +const fs = __require_1("fs"); fs.readFile; -exports.fs2 = require("fs"); +const fs2 = __require_1("fs"); +export { fs2 }; //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportAssignment(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportAssignment(module=node20).js.diff index d11a8a68e5..3d7bc7aa7a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportAssignment(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportAssignment(module=node20).js.diff @@ -1,45 +1,13 @@ --- old.nodeModulesAllowJsImportAssignment(module=node20).js +++ new.nodeModulesAllowJsImportAssignment(module=node20).js -@@= skipped -37, +37 lines =@@ - fs.readFile; - exports.fs2 = require("fs"); - //// [index.js] --import { createRequire as _createRequire } from "module"; --const __require = _createRequire(import.meta.url); -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --const fs = __require("fs"); -+const fs = require("fs"); - fs.readFile; --const fs2 = __require("fs"); --export { fs2 }; -+exports.fs2 = require("fs"); - //// [file.js] --import { createRequire as _createRequire_1 } from "module"; --const __require_1 = _createRequire_1(import.meta.url); -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file - const __require = null; - const _createRequire = null; --const fs = __require_1("fs"); -+const fs = require("fs"); - fs.readFile; --const fs2 = __require_1("fs"); --export { fs2 }; -- -- --//// [index.d.ts] +@@= skipped -57, +57 lines =@@ + + + //// [index.d.ts] -import fs2 = require("fs"); --//// [index.d.ts] --import fs2 = require("fs"); -+exports.fs2 = require("fs"); -+ -+ -+//// [index.d.ts] +export import fs2 = require("fs"); -+//// [index.d.ts] + //// [index.d.ts] +-import fs2 = require("fs"); +export import fs2 = require("fs"); //// [file.d.ts] -import fs2 = require("fs"); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions1(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions1(module=node20).errors.txt deleted file mode 100644 index d36e8ad8d9..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions1(module=node20).errors.txt +++ /dev/null @@ -1,32 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== subfolder/index.js (0 errors) ==== - // cjs format file - import {default as _fs} from "fs"; - _fs.readFile; - import * as fs from "fs"; - fs.readFile; -==== index.js (0 errors) ==== - // esm format file - import {default as _fs} from "fs"; - _fs.readFile; - import * as fs from "fs"; - fs.readFile; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module" - } -==== subfolder/package.json (0 errors) ==== - { - "type": "commonjs" - } -==== types.d.ts (0 errors) ==== - declare module "fs"; - declare module "tslib" { - export {}; - // intentionally missing all helpers - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions1(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions1(module=node20).js index 1210148c3a..a30d220227 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions1(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions1(module=node20).js @@ -32,18 +32,17 @@ declare module "tslib" { //// [index.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); // cjs format file -const fs_1 = require("fs"); +const fs_1 = tslib_1.__importDefault(require("fs")); fs_1.default.readFile; -const fs = require("fs"); +const fs = tslib_1.__importStar(require("fs")); fs.readFile; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const fs_1 = require("fs"); -fs_1.default.readFile; -const fs = require("fs"); +import { default as _fs } from "fs"; +_fs.readFile; +import * as fs from "fs"; fs.readFile; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions1(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions1(module=node20).js.diff deleted file mode 100644 index 34e2f3dcfa..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions1(module=node20).js.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.nodeModulesAllowJsImportHelpersCollisions1(module=node20).js -+++ new.nodeModulesAllowJsImportHelpersCollisions1(module=node20).js -@@= skipped -31, +31 lines =@@ - //// [index.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --const tslib_1 = require("tslib"); - // cjs format file --const fs_1 = tslib_1.__importDefault(require("fs")); -+const fs_1 = require("fs"); - fs_1.default.readFile; --const fs = tslib_1.__importStar(require("fs")); -+const fs = require("fs"); - fs.readFile; - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import { default as _fs } from "fs"; --_fs.readFile; --import * as fs from "fs"; -+const fs_1 = require("fs"); -+fs_1.default.readFile; -+const fs = require("fs"); - fs.readFile; - diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions2(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions2(module=node20).errors.txt deleted file mode 100644 index 7566f53494..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions2(module=node20).errors.txt +++ /dev/null @@ -1,28 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== subfolder/index.ts (0 errors) ==== - // cjs format file - export * from "fs"; - export * as fs from "fs"; -==== index.js (0 errors) ==== - // esm format file - export * from "fs"; - export * as fs from "fs"; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module" - } -==== subfolder/package.json (0 errors) ==== - { - "type": "commonjs" - } -==== types.d.ts (0 errors) ==== - declare module "fs"; - declare module "tslib" { - export {}; - // intentionally missing all helpers - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions2(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions2(module=node20).js index 3a13cffb4b..1960ba0103 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions2(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions2(module=node20).js @@ -32,15 +32,11 @@ exports.fs = void 0; const tslib_1 = require("tslib"); // cjs format file tslib_1.__exportStar(require("fs"), exports); -exports.fs = require("fs"); +exports.fs = tslib_1.__importStar(require("fs")); //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.fs = void 0; -const tslib_1 = require("tslib"); // esm format file -tslib_1.__exportStar(require("fs"), exports); -exports.fs = require("fs"); +export * from "fs"; +export * as fs from "fs"; //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions2(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions2(module=node20).js.diff deleted file mode 100644 index 3ab585aecb..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions2(module=node20).js.diff +++ /dev/null @@ -1,21 +0,0 @@ ---- old.nodeModulesAllowJsImportHelpersCollisions2(module=node20).js -+++ new.nodeModulesAllowJsImportHelpersCollisions2(module=node20).js -@@= skipped -31, +31 lines =@@ - const tslib_1 = require("tslib"); - // cjs format file - tslib_1.__exportStar(require("fs"), exports); --exports.fs = tslib_1.__importStar(require("fs")); -+exports.fs = require("fs"); - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.fs = void 0; -+const tslib_1 = require("tslib"); - // esm format file --export * from "fs"; --export * as fs from "fs"; -+tslib_1.__exportStar(require("fs"), exports); -+exports.fs = require("fs"); - - - //// [index.d.ts] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions3(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions3(module=node20).errors.txt deleted file mode 100644 index 2f2cf78291..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions3(module=node20).errors.txt +++ /dev/null @@ -1,30 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== subfolder/index.js (0 errors) ==== - // cjs format file - export {default} from "fs"; - export {default as foo} from "fs"; - export {bar as baz} from "fs"; -==== index.js (0 errors) ==== - // esm format file - export {default} from "fs"; - export {default as foo} from "fs"; - export {bar as baz} from "fs"; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module" - } -==== subfolder/package.json (0 errors) ==== - { - "type": "commonjs" - } -==== types.d.ts (0 errors) ==== - declare module "fs"; - declare module "tslib" { - export {}; - // intentionally missing all helpers - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions3(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions3(module=node20).js index 5d80e9cb9e..9401cb9084 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions3(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions3(module=node20).js @@ -31,24 +31,19 @@ declare module "tslib" { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.baz = exports.foo = exports.default = void 0; +const tslib_1 = require("tslib"); // cjs format file const fs_1 = require("fs"); -Object.defineProperty(exports, "default", { enumerable: true, get: function () { return fs_1.default; } }); +Object.defineProperty(exports, "default", { enumerable: true, get: function () { return tslib_1.__importDefault(fs_1).default; } }); const fs_2 = require("fs"); -Object.defineProperty(exports, "foo", { enumerable: true, get: function () { return fs_2.default; } }); +Object.defineProperty(exports, "foo", { enumerable: true, get: function () { return tslib_1.__importDefault(fs_2).default; } }); const fs_3 = require("fs"); Object.defineProperty(exports, "baz", { enumerable: true, get: function () { return fs_3.bar; } }); //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.baz = exports.foo = exports.default = void 0; // esm format file -const fs_1 = require("fs"); -Object.defineProperty(exports, "default", { enumerable: true, get: function () { return fs_1.default; } }); -const fs_2 = require("fs"); -Object.defineProperty(exports, "foo", { enumerable: true, get: function () { return fs_2.default; } }); -const fs_3 = require("fs"); -Object.defineProperty(exports, "baz", { enumerable: true, get: function () { return fs_3.bar; } }); +export { default } from "fs"; +export { default as foo } from "fs"; +export { bar as baz } from "fs"; //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions3(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions3(module=node20).js.diff index 93012a949a..7bbeef01b8 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions3(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportHelpersCollisions3(module=node20).js.diff @@ -5,45 +5,29 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.baz = exports.foo = exports.default = void 0; -var tslib_1 = require("tslib"); ++const tslib_1 = require("tslib"); // cjs format file -var fs_1 = require("fs"); --Object.defineProperty(exports, "default", { enumerable: true, get: function () { return tslib_1.__importDefault(fs_1).default; } }); --var fs_2 = require("fs"); --Object.defineProperty(exports, "foo", { enumerable: true, get: function () { return tslib_1.__importDefault(fs_2).default; } }); --var fs_3 = require("fs"); +const fs_1 = require("fs"); -+Object.defineProperty(exports, "default", { enumerable: true, get: function () { return fs_1.default; } }); + Object.defineProperty(exports, "default", { enumerable: true, get: function () { return tslib_1.__importDefault(fs_1).default; } }); +-var fs_2 = require("fs"); +const fs_2 = require("fs"); -+Object.defineProperty(exports, "foo", { enumerable: true, get: function () { return fs_2.default; } }); + Object.defineProperty(exports, "foo", { enumerable: true, get: function () { return tslib_1.__importDefault(fs_2).default; } }); +-var fs_3 = require("fs"); +const fs_3 = require("fs"); Object.defineProperty(exports, "baz", { enumerable: true, get: function () { return fs_3.bar; } }); //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.baz = exports.foo = exports.default = void 0; // esm format file --export { default } from "fs"; --export { default as foo } from "fs"; --export { bar as baz } from "fs"; -- -- --//// [index.d.ts] --export { default, default as foo, bar as baz } from "fs"; --//// [index.d.ts] +@@= skipped -16, +16 lines =@@ + + + //// [index.d.ts] -export { default, default as foo, bar as baz } from "fs"; -+const fs_1 = require("fs"); -+Object.defineProperty(exports, "default", { enumerable: true, get: function () { return fs_1.default; } }); -+const fs_2 = require("fs"); -+Object.defineProperty(exports, "foo", { enumerable: true, get: function () { return fs_2.default; } }); -+const fs_3 = require("fs"); -+Object.defineProperty(exports, "baz", { enumerable: true, get: function () { return fs_3.bar; } }); -+ -+ -+//// [index.d.ts] +export { default } from "fs"; +export { default as foo } from "fs"; +export { bar as baz } from "fs"; -+//// [index.d.ts] + //// [index.d.ts] +-export { default, default as foo, bar as baz } from "fs"; +export { default } from "fs"; +export { default as foo } from "fs"; +export { bar as baz } from "fs"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportMeta(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportMeta(module=node20).errors.txt index aa9d4d5c49..28110ed339 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportMeta(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportMeta(module=node20).errors.txt @@ -1,20 +1,15 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -index.js(2,11): error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. subfolder/index.js(2,11): error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== subfolder/index.js (1 errors) ==== // cjs format file const x = import.meta.url; ~~~~~~~~~~~ !!! error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. export {x}; -==== index.js (1 errors) ==== +==== index.js (0 errors) ==== // esm format file const x = import.meta.url; - ~~~~~~~~~~~ -!!! error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. export {x}; ==== package.json (0 errors) ==== { diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportMeta(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportMeta(module=node20).js index 71c3014751..6ac9f8052f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportMeta(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportMeta(module=node20).js @@ -27,12 +27,9 @@ exports.x = void 0; const x = import.meta.url; exports.x = x; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = import.meta.url; -exports.x = x; +export { x }; //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportMeta(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportMeta(module=node20).js.diff index 6efd1a32e5..ddf2a8d750 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportMeta(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsImportMeta(module=node20).js.diff @@ -1,27 +1,13 @@ --- old.nodeModulesAllowJsImportMeta(module=node20).js +++ new.nodeModulesAllowJsImportMeta(module=node20).js -@@= skipped -26, +26 lines =@@ - const x = import.meta.url; - exports.x = x; - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; - // esm format file - const x = import.meta.url; --export { x }; -- -- --//// [index.d.ts] +@@= skipped -32, +32 lines =@@ + + + //// [index.d.ts] -export const x: string; --//// [index.d.ts] --export const x: string; -+exports.x = x; -+ -+ -+//// [index.d.ts] +declare const x: string; +export { x }; -+//// [index.d.ts] + //// [index.d.ts] +-export const x: string; +declare const x: string; +export { x }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).errors.txt index 0543bf37ed..da41d18ca9 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).errors.txt @@ -1,30 +1,15 @@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. +index.cjs(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. +index.cjs(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. index.cjs(9,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.js (3 errors) ==== +==== index.js (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -34,17 +19,11 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== index.mjs (3 errors) ==== +==== index.mjs (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -54,17 +33,15 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== index.cjs (4 errors) ==== +==== index.cjs (3 errors) ==== // cjs format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. import * as type from "package"; ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. cjs; mjs; type; @@ -76,7 +53,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -87,6 +67,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -94,7 +77,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -124,4 +110,5 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ "./mjs": "./index.mjs", ".": "./index.js" } - } \ No newline at end of file + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).js index 817ed97973..6f61b6de6a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).js @@ -44,6 +44,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -52,6 +55,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -60,6 +66,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -86,22 +95,9 @@ export { type }; "./mjs": "./index.mjs", ".": "./index.js" } -} +} + -//// [index.js] -// esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; -cjs; -mjs; -type; -import * as cjsi from "inner/cjs"; -import * as mjsi from "inner/mjs"; -import * as typei from "inner"; -cjsi; -mjsi; -typei; //// [index.mjs] // esm format file import * as cjs from "package/cjs"; @@ -165,11 +161,25 @@ const typei = __importStar(require("inner")); cjsi; mjsi; typei; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; +cjsi; +mjsi; +typei; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).js.diff deleted file mode 100644 index 4b82b99738..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).js.diff +++ /dev/null @@ -1,53 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=node16).js -+++ new.nodeModulesAllowJsPackageExports(module=node16).js -@@= skipped -87, +87 lines =@@ - } - } - -+//// [index.js] -+// esm format file -+import * as cjs from "package/cjs"; -+import * as mjs from "package/mjs"; -+import * as type from "package"; -+cjs; -+mjs; -+type; -+import * as cjsi from "inner/cjs"; -+import * as mjsi from "inner/mjs"; -+import * as typei from "inner"; -+cjsi; -+mjsi; -+typei; - //// [index.mjs] - // esm format file - import * as cjs from "package/cjs"; -@@= skipped -63, +77 lines =@@ - cjsi; - mjsi; - typei; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/cjs"; --import * as mjsi from "inner/mjs"; --import * as typei from "inner"; --cjsi; --mjsi; --typei; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).symbols index 241c74412b..ac3958d2ed 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).symbols @@ -116,61 +116,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).symbols.diff deleted file mode 100644 index 953631b6c5..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=node16).symbols -+++ new.nodeModulesAllowJsPackageExports(module=node16).symbols -@@= skipped -125, +125 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).types index 794aab4871..815ad11048 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node16).types @@ -3,22 +3,22 @@ === index.js === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -41,22 +41,22 @@ typei; === index.mjs === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -79,22 +79,22 @@ typei; === index.cjs === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -116,6 +116,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -136,6 +142,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -156,6 +168,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).errors.txt index 0543bf37ed..da41d18ca9 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).errors.txt @@ -1,30 +1,15 @@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. +index.cjs(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. +index.cjs(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. index.cjs(9,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.js (3 errors) ==== +==== index.js (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -34,17 +19,11 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== index.mjs (3 errors) ==== +==== index.mjs (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -54,17 +33,15 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== index.cjs (4 errors) ==== +==== index.cjs (3 errors) ==== // cjs format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. import * as type from "package"; ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. cjs; mjs; type; @@ -76,7 +53,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -87,6 +67,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -94,7 +77,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -124,4 +110,5 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ "./mjs": "./index.mjs", ".": "./index.js" } - } \ No newline at end of file + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).js index 817ed97973..6f61b6de6a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).js @@ -44,6 +44,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -52,6 +55,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -60,6 +66,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -86,22 +95,9 @@ export { type }; "./mjs": "./index.mjs", ".": "./index.js" } -} +} + -//// [index.js] -// esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; -cjs; -mjs; -type; -import * as cjsi from "inner/cjs"; -import * as mjsi from "inner/mjs"; -import * as typei from "inner"; -cjsi; -mjsi; -typei; //// [index.mjs] // esm format file import * as cjs from "package/cjs"; @@ -165,11 +161,25 @@ const typei = __importStar(require("inner")); cjsi; mjsi; typei; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; +cjsi; +mjsi; +typei; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).js.diff deleted file mode 100644 index 8db327a4a4..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).js.diff +++ /dev/null @@ -1,53 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=node18).js -+++ new.nodeModulesAllowJsPackageExports(module=node18).js -@@= skipped -87, +87 lines =@@ - } - } - -+//// [index.js] -+// esm format file -+import * as cjs from "package/cjs"; -+import * as mjs from "package/mjs"; -+import * as type from "package"; -+cjs; -+mjs; -+type; -+import * as cjsi from "inner/cjs"; -+import * as mjsi from "inner/mjs"; -+import * as typei from "inner"; -+cjsi; -+mjsi; -+typei; - //// [index.mjs] - // esm format file - import * as cjs from "package/cjs"; -@@= skipped -63, +77 lines =@@ - cjsi; - mjsi; - typei; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/cjs"; --import * as mjsi from "inner/mjs"; --import * as typei from "inner"; --cjsi; --mjsi; --typei; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).symbols index 241c74412b..ac3958d2ed 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).symbols @@ -116,61 +116,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).symbols.diff deleted file mode 100644 index 8a8dc5b706..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=node18).symbols -+++ new.nodeModulesAllowJsPackageExports(module=node18).symbols -@@= skipped -125, +125 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).types index 794aab4871..815ad11048 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node18).types @@ -3,22 +3,22 @@ === index.js === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -41,22 +41,22 @@ typei; === index.mjs === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -79,22 +79,22 @@ typei; === index.cjs === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -116,6 +116,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -136,6 +142,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -156,6 +168,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).errors.txt deleted file mode 100644 index fc1ec8d133..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).errors.txt +++ /dev/null @@ -1,120 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.js (3 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/cjs"; - import * as mjsi from "inner/mjs"; - import * as typei from "inner"; - cjsi; - mjsi; - typei; -==== index.mjs (3 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/cjs"; - import * as mjsi from "inner/mjs"; - import * as typei from "inner"; - cjsi; - mjsi; - typei; -==== index.cjs (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/cjs"; - import * as mjsi from "inner/mjs"; - import * as typei from "inner"; - cjsi; - mjsi; - typei; -==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; - export { mjs }; - export { type }; -==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/cjs"; - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; - export { mjs }; - export { type }; -==== node_modules/inner/index.d.cts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; - export { mjs }; - export { type }; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module", - "exports": { - "./cjs": "./index.cjs", - "./mjs": "./index.mjs", - ".": "./index.js" - } - } -==== node_modules/inner/package.json (0 errors) ==== - { - "name": "inner", - "private": true, - "exports": { - "./cjs": "./index.cjs", - "./mjs": "./index.mjs", - ".": "./index.js" - } - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).js index 05f5e0949e..6f61b6de6a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).js @@ -44,6 +44,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -52,6 +55,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -60,6 +66,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -86,61 +95,91 @@ export { type }; "./mjs": "./index.mjs", ".": "./index.js" } -} +} -//// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); + +//// [index.mjs] // esm format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; cjs; mjs; type; -const cjsi = require("inner/cjs"); -const mjsi = require("inner/mjs"); -const typei = require("inner"); +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; cjsi; mjsi; typei; -//// [index.mjs] +//// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); -// esm format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); +// cjs format file +const cjs = __importStar(require("package/cjs")); +const mjs = __importStar(require("package/mjs")); +const type = __importStar(require("package")); cjs; mjs; type; -const cjsi = require("inner/cjs"); -const mjsi = require("inner/mjs"); -const typei = require("inner"); +const cjsi = __importStar(require("inner/cjs")); +const mjsi = __importStar(require("inner/mjs")); +const typei = __importStar(require("inner")); cjsi; mjsi; typei; -//// [index.cjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -// cjs format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; cjs; mjs; type; -const cjsi = require("inner/cjs"); -const mjsi = require("inner/mjs"); -const typei = require("inner"); +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; cjsi; mjsi; typei; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).js.diff deleted file mode 100644 index 7a800e6da3..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).js.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=node20).js -+++ new.nodeModulesAllowJsPackageExports(module=node20).js -@@= skipped -87, +87 lines =@@ - } - } - -+//// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+// esm format file -+const cjs = require("package/cjs"); -+const mjs = require("package/mjs"); -+const type = require("package"); -+cjs; -+mjs; -+type; -+const cjsi = require("inner/cjs"); -+const mjsi = require("inner/mjs"); -+const typei = require("inner"); -+cjsi; -+mjsi; -+typei; - //// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; -+const cjs = require("package/cjs"); -+const mjs = require("package/mjs"); -+const type = require("package"); - cjs; - mjs; - type; --import * as cjsi from "inner/cjs"; --import * as mjsi from "inner/mjs"; --import * as typei from "inner"; -+const cjsi = require("inner/cjs"); -+const mjsi = require("inner/mjs"); -+const typei = require("inner"); - cjsi; - mjsi; - typei; - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - // cjs format file --const cjs = __importStar(require("package/cjs")); --const mjs = __importStar(require("package/mjs")); --const type = __importStar(require("package")); --cjs; --mjs; --type; --const cjsi = __importStar(require("inner/cjs")); --const mjsi = __importStar(require("inner/mjs")); --const typei = __importStar(require("inner")); --cjsi; --mjsi; --typei; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/cjs"; --import * as mjsi from "inner/mjs"; --import * as typei from "inner"; --cjsi; --mjsi; --typei; -- -- -+const cjs = require("package/cjs"); -+const mjs = require("package/mjs"); -+const type = require("package"); -+cjs; -+mjs; -+type; -+const cjsi = require("inner/cjs"); -+const mjsi = require("inner/mjs"); -+const typei = require("inner"); -+cjsi; -+mjsi; -+typei; -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).symbols index 241c74412b..ac3958d2ed 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).symbols @@ -116,61 +116,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).symbols.diff deleted file mode 100644 index 8ccc6b87fb..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=node20).symbols -+++ new.nodeModulesAllowJsPackageExports(module=node20).symbols -@@= skipped -125, +125 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).types index 794aab4871..815ad11048 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=node20).types @@ -3,22 +3,22 @@ === index.js === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -41,22 +41,22 @@ typei; === index.mjs === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -79,22 +79,22 @@ typei; === index.cjs === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -116,6 +116,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -136,6 +142,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -156,6 +168,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).errors.txt deleted file mode 100644 index 4297bbb071..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).errors.txt +++ /dev/null @@ -1,118 +0,0 @@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.js (3 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/cjs"; - import * as mjsi from "inner/mjs"; - import * as typei from "inner"; - cjsi; - mjsi; - typei; -==== index.mjs (3 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/cjs"; - import * as mjsi from "inner/mjs"; - import * as typei from "inner"; - cjsi; - mjsi; - typei; -==== index.cjs (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/cjs"; - import * as mjsi from "inner/mjs"; - import * as typei from "inner"; - cjsi; - mjsi; - typei; -==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; - export { mjs }; - export { type }; -==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/cjs"; - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; - export { mjs }; - export { type }; -==== node_modules/inner/index.d.cts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; - export { mjs }; - export { type }; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module", - "exports": { - "./cjs": "./index.cjs", - "./mjs": "./index.mjs", - ".": "./index.js" - } - } -==== node_modules/inner/package.json (0 errors) ==== - { - "name": "inner", - "private": true, - "exports": { - "./cjs": "./index.cjs", - "./mjs": "./index.mjs", - ".": "./index.js" - } - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).js index 817ed97973..6f61b6de6a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).js @@ -44,6 +44,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -52,6 +55,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -60,6 +66,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -86,22 +95,9 @@ export { type }; "./mjs": "./index.mjs", ".": "./index.js" } -} +} + -//// [index.js] -// esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; -cjs; -mjs; -type; -import * as cjsi from "inner/cjs"; -import * as mjsi from "inner/mjs"; -import * as typei from "inner"; -cjsi; -mjsi; -typei; //// [index.mjs] // esm format file import * as cjs from "package/cjs"; @@ -165,11 +161,25 @@ const typei = __importStar(require("inner")); cjsi; mjsi; typei; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; +cjsi; +mjsi; +typei; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).js.diff deleted file mode 100644 index 66c28515a1..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).js.diff +++ /dev/null @@ -1,53 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=nodenext).js -+++ new.nodeModulesAllowJsPackageExports(module=nodenext).js -@@= skipped -87, +87 lines =@@ - } - } - -+//// [index.js] -+// esm format file -+import * as cjs from "package/cjs"; -+import * as mjs from "package/mjs"; -+import * as type from "package"; -+cjs; -+mjs; -+type; -+import * as cjsi from "inner/cjs"; -+import * as mjsi from "inner/mjs"; -+import * as typei from "inner"; -+cjsi; -+mjsi; -+typei; - //// [index.mjs] - // esm format file - import * as cjs from "package/cjs"; -@@= skipped -63, +77 lines =@@ - cjsi; - mjsi; - typei; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/cjs"; --import * as mjsi from "inner/mjs"; --import * as typei from "inner"; --cjsi; --mjsi; --typei; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).symbols index 241c74412b..ac3958d2ed 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).symbols @@ -116,61 +116,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).symbols.diff deleted file mode 100644 index f24b75dfb1..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=nodenext).symbols -+++ new.nodeModulesAllowJsPackageExports(module=nodenext).symbols -@@= skipped -125, +125 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).types index 794aab4871..815ad11048 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageExports(module=nodenext).types @@ -3,22 +3,22 @@ === index.js === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -41,22 +41,22 @@ typei; === index.mjs === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -79,22 +79,22 @@ typei; === index.cjs === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -116,6 +116,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -136,6 +142,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -156,6 +168,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageImports(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageImports(module=node20).errors.txt index 0de5e50bb0..6aecf9a590 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageImports(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageImports(module=node20).errors.txt @@ -1,4 +1,3 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. error TS2210: The project root is ambiguous, but is required to resolve import map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. index.cjs(2,22): error TS2307: Cannot find module '#cjs' or its corresponding type declarations. index.cjs(3,22): error TS2307: Cannot find module '#mjs' or its corresponding type declarations. @@ -11,7 +10,6 @@ index.mjs(3,22): error TS2307: Cannot find module '#mjs' or its corresponding ty index.mjs(4,23): error TS2307: Cannot find module '#type' or its corresponding type declarations. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. !!! error TS2210: The project root is ambiguous, but is required to resolve import map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. ==== index.js (3 errors) ==== // esm format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageImports(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageImports(module=node20).js index 4e8df6368c..ca3aa0ac43 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageImports(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageImports(module=node20).js @@ -38,32 +38,61 @@ type; } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjs = require("#cjs"); -const mjs = require("#mjs"); -const type = require("#type"); +import * as cjs from "#cjs"; +import * as mjs from "#mjs"; +import * as type from "#type"; cjs; mjs; type; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjs = require("#cjs"); -const mjs = require("#mjs"); -const type = require("#type"); +import * as cjs from "#cjs"; +import * as mjs from "#mjs"; +import * as type from "#type"; cjs; mjs; type; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjs = require("#cjs"); -const mjs = require("#mjs"); -const type = require("#type"); +const cjs = __importStar(require("#cjs")); +const mjs = __importStar(require("#mjs")); +const type = __importStar(require("#type")); cjs; mjs; type; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageImports(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageImports(module=node20).js.diff index 160d14c23b..c70bc301f9 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageImports(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackageImports(module=node20).js.diff @@ -5,71 +5,20 @@ } +//// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); +// esm format file -+const cjs = require("#cjs"); -+const mjs = require("#mjs"); -+const type = require("#type"); ++import * as cjs from "#cjs"; ++import * as mjs from "#mjs"; ++import * as type from "#type"; +cjs; +mjs; +type; //// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); // esm format file --import * as cjs from "#cjs"; --import * as mjs from "#mjs"; --import * as type from "#type"; -+const cjs = require("#cjs"); -+const mjs = require("#mjs"); -+const type = require("#type"); + import * as cjs from "#cjs"; +@@= skipped -51, +59 lines =@@ cjs; mjs; type; - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --const cjs = __importStar(require("#cjs")); --const mjs = __importStar(require("#mjs")); --const type = __importStar(require("#type")); --cjs; --mjs; --type; -//// [index.js] -// esm format file -import * as cjs from "#cjs"; @@ -80,12 +29,6 @@ -type; - - -+const cjs = require("#cjs"); -+const mjs = require("#mjs"); -+const type = require("#type"); -+cjs; -+mjs; -+type; + + +//// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).errors.txt index 6804fa2040..95ba0345cb 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).errors.txt @@ -1,6 +1,6 @@ index.cjs(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. ==== index.js (0 errors) ==== @@ -29,7 +29,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -40,6 +43,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -47,7 +53,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).js index 0c82c6e77b..5bab0a82ca 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).symbols index 8aaf670265..802e24e797 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).symbols.diff deleted file mode 100644 index ecb7c5f0f8..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExports(module=node16).symbols -+++ new.nodeModulesAllowJsPackagePatternExports(module=node16).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).types index 632a6d9901..b5c99b67eb 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt index 6804fa2040..95ba0345cb 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt @@ -1,6 +1,6 @@ index.cjs(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. ==== index.js (0 errors) ==== @@ -29,7 +29,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -40,6 +43,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -47,7 +53,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).js index 0c82c6e77b..5bab0a82ca 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).symbols index 8aaf670265..802e24e797 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).symbols.diff deleted file mode 100644 index 43114922cc..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExports(module=node18).symbols -+++ new.nodeModulesAllowJsPackagePatternExports(module=node18).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).types index 632a6d9901..b5c99b67eb 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).errors.txt deleted file mode 100644 index c6178671ea..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).errors.txt +++ /dev/null @@ -1,69 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== index.js (0 errors) ==== - // esm format file - import * as cjsi from "inner/cjs/index"; - import * as mjsi from "inner/mjs/index"; - import * as typei from "inner/js/index"; - cjsi; - mjsi; - typei; -==== index.mjs (0 errors) ==== - // esm format file - import * as cjsi from "inner/cjs/index"; - import * as mjsi from "inner/mjs/index"; - import * as typei from "inner/js/index"; - cjsi; - mjsi; - typei; -==== index.cjs (0 errors) ==== - // cjs format file - import * as cjsi from "inner/cjs/index"; - import * as mjsi from "inner/mjs/index"; - import * as typei from "inner/js/index"; - cjsi; - mjsi; - typei; -==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; - import * as mjs from "inner/mjs/index"; - import * as type from "inner/js/index"; - export { cjs }; - export { mjs }; - export { type }; -==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/cjs/index"; - import * as mjs from "inner/mjs/index"; - import * as type from "inner/js/index"; - export { cjs }; - export { mjs }; - export { type }; -==== node_modules/inner/index.d.cts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; - import * as mjs from "inner/mjs/index"; - import * as type from "inner/js/index"; - export { cjs }; - export { mjs }; - export { type }; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module" - } -==== node_modules/inner/package.json (0 errors) ==== - { - "name": "inner", - "private": true, - "exports": { - "./cjs/*": "./*.cjs", - "./mjs/*": "./*.mjs", - "./js/*": "./*.js" - } - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).js index 473118b4ba..5bab0a82ca 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -67,32 +76,61 @@ export { type }; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjsi = require("inner/cjs/index"); -const mjsi = require("inner/mjs/index"); -const typei = require("inner/js/index"); +import * as cjsi from "inner/cjs/index"; +import * as mjsi from "inner/mjs/index"; +import * as typei from "inner/js/index"; cjsi; mjsi; typei; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjsi = require("inner/cjs/index"); -const mjsi = require("inner/mjs/index"); -const typei = require("inner/js/index"); +import * as cjsi from "inner/cjs/index"; +import * as mjsi from "inner/mjs/index"; +import * as typei from "inner/js/index"; cjsi; mjsi; typei; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // cjs format file -const cjsi = require("inner/cjs/index"); -const mjsi = require("inner/mjs/index"); -const typei = require("inner/js/index"); +const cjsi = __importStar(require("inner/cjs/index")); +const mjsi = __importStar(require("inner/mjs/index")); +const typei = __importStar(require("inner/js/index")); cjsi; mjsi; typei; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).js.diff deleted file mode 100644 index 4b39a11291..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).js.diff +++ /dev/null @@ -1,77 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExports(module=node20).js -+++ new.nodeModulesAllowJsPackagePatternExports(module=node20).js -@@= skipped -66, +66 lines =@@ - - - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as cjsi from "inner/cjs/index"; --import * as mjsi from "inner/mjs/index"; --import * as typei from "inner/js/index"; -+const cjsi = require("inner/cjs/index"); -+const mjsi = require("inner/mjs/index"); -+const typei = require("inner/js/index"); - cjsi; - mjsi; - typei; - //// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as cjsi from "inner/cjs/index"; --import * as mjsi from "inner/mjs/index"; --import * as typei from "inner/js/index"; -+const cjsi = require("inner/cjs/index"); -+const mjsi = require("inner/mjs/index"); -+const typei = require("inner/js/index"); - cjsi; - mjsi; - typei; - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - // cjs format file --const cjsi = __importStar(require("inner/cjs/index")); --const mjsi = __importStar(require("inner/mjs/index")); --const typei = __importStar(require("inner/js/index")); -+const cjsi = require("inner/cjs/index"); -+const mjsi = require("inner/mjs/index"); -+const typei = require("inner/js/index"); - cjsi; - mjsi; - typei; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).symbols index 8aaf670265..802e24e797 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).symbols.diff deleted file mode 100644 index 6ab2d9d14c..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExports(module=node20).symbols -+++ new.nodeModulesAllowJsPackagePatternExports(module=node20).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).types index 632a6d9901..b5c99b67eb 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).js index 0c82c6e77b..5bab0a82ca 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).symbols index 8aaf670265..802e24e797 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).symbols.diff deleted file mode 100644 index 70d7f7ba93..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExports(module=nodenext).symbols -+++ new.nodeModulesAllowJsPackagePatternExports(module=nodenext).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).types index 632a6d9901..b5c99b67eb 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsExclude(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsExclude(module=node20).errors.txt index a2b6a322bb..44e51033d1 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsExclude(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsExclude(module=node20).errors.txt @@ -1,4 +1,3 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. index.cjs(2,23): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. index.cjs(3,23): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. index.cjs(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. @@ -19,7 +18,6 @@ node_modules/inner/exclude/index.d.ts(3,22): error TS2307: Cannot find module 'i node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== index.js (3 errors) ==== // esm format file import * as cjsi from "inner/cjs/exclude/index"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsExclude(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsExclude(module=node20).js index 6e380318eb..3ba5fbbce0 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsExclude(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsExclude(module=node20).js @@ -69,32 +69,61 @@ export { type }; } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjsi = require("inner/cjs/exclude/index"); -const mjsi = require("inner/mjs/exclude/index"); -const typei = require("inner/js/exclude/index"); +import * as cjsi from "inner/cjs/exclude/index"; +import * as mjsi from "inner/mjs/exclude/index"; +import * as typei from "inner/js/exclude/index"; cjsi; mjsi; typei; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjsi = require("inner/cjs/exclude/index"); -const mjsi = require("inner/mjs/exclude/index"); -const typei = require("inner/js/exclude/index"); +import * as cjsi from "inner/cjs/exclude/index"; +import * as mjsi from "inner/mjs/exclude/index"; +import * as typei from "inner/js/exclude/index"; cjsi; mjsi; typei; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // cjs format file -const cjsi = require("inner/cjs/exclude/index"); -const mjsi = require("inner/mjs/exclude/index"); -const typei = require("inner/js/exclude/index"); +const cjsi = __importStar(require("inner/cjs/exclude/index")); +const mjsi = __importStar(require("inner/mjs/exclude/index")); +const typei = __importStar(require("inner/js/exclude/index")); cjsi; mjsi; typei; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsExclude(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsExclude(module=node20).js.diff deleted file mode 100644 index 852ea3328d..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsExclude(module=node20).js.diff +++ /dev/null @@ -1,77 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsExclude(module=node20).js -+++ new.nodeModulesAllowJsPackagePatternExportsExclude(module=node20).js -@@= skipped -68, +68 lines =@@ - } - - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as cjsi from "inner/cjs/exclude/index"; --import * as mjsi from "inner/mjs/exclude/index"; --import * as typei from "inner/js/exclude/index"; -+const cjsi = require("inner/cjs/exclude/index"); -+const mjsi = require("inner/mjs/exclude/index"); -+const typei = require("inner/js/exclude/index"); - cjsi; - mjsi; - typei; - //// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as cjsi from "inner/cjs/exclude/index"; --import * as mjsi from "inner/mjs/exclude/index"; --import * as typei from "inner/js/exclude/index"; -+const cjsi = require("inner/cjs/exclude/index"); -+const mjsi = require("inner/mjs/exclude/index"); -+const typei = require("inner/js/exclude/index"); - cjsi; - mjsi; - typei; - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - // cjs format file --const cjsi = __importStar(require("inner/cjs/exclude/index")); --const mjsi = __importStar(require("inner/mjs/exclude/index")); --const typei = __importStar(require("inner/js/exclude/index")); -+const cjsi = require("inner/cjs/exclude/index"); -+const mjsi = require("inner/mjs/exclude/index"); -+const typei = require("inner/js/exclude/index"); - cjsi; - mjsi; - typei; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).errors.txt index 64814c9a08..43b333f902 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).errors.txt @@ -1,6 +1,6 @@ index.cjs(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. ==== index.js (0 errors) ==== @@ -29,7 +29,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; @@ -40,6 +43,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; @@ -47,7 +53,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).js index 5c434e9847..19140a3fe5 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).symbols index b6cc027370..182fd209da 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).symbols.diff deleted file mode 100644 index d132592983..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).symbols -+++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).types index 2530671b34..4c7b763f3a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt index 64814c9a08..43b333f902 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt @@ -1,6 +1,6 @@ index.cjs(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. ==== index.js (0 errors) ==== @@ -29,7 +29,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; @@ -40,6 +43,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; @@ -47,7 +53,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).js index 5c434e9847..19140a3fe5 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).symbols index b6cc027370..182fd209da 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).symbols.diff deleted file mode 100644 index 11bbac7a71..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).symbols -+++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).types index 2530671b34..4c7b763f3a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).errors.txt deleted file mode 100644 index 523c9c90a7..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).errors.txt +++ /dev/null @@ -1,69 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== index.js (0 errors) ==== - // esm format file - import * as cjsi from "inner/cjs/index.cjs"; - import * as mjsi from "inner/mjs/index.mjs"; - import * as typei from "inner/js/index.js"; - cjsi; - mjsi; - typei; -==== index.mjs (0 errors) ==== - // esm format file - import * as cjsi from "inner/cjs/index.cjs"; - import * as mjsi from "inner/mjs/index.mjs"; - import * as typei from "inner/js/index.js"; - cjsi; - mjsi; - typei; -==== index.cjs (0 errors) ==== - // cjs format file - import * as cjsi from "inner/cjs/index.cjs"; - import * as mjsi from "inner/mjs/index.mjs"; - import * as typei from "inner/js/index.js"; - cjsi; - mjsi; - typei; -==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; - import * as mjs from "inner/mjs/index.mjs"; - import * as type from "inner/js/index.js"; - export { cjs }; - export { mjs }; - export { type }; -==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/cjs/index.cjs"; - import * as mjs from "inner/mjs/index.mjs"; - import * as type from "inner/js/index.js"; - export { cjs }; - export { mjs }; - export { type }; -==== node_modules/inner/index.d.cts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; - import * as mjs from "inner/mjs/index.mjs"; - import * as type from "inner/js/index.js"; - export { cjs }; - export { mjs }; - export { type }; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module" - } -==== node_modules/inner/package.json (0 errors) ==== - { - "name": "inner", - "private": true, - "exports": { - "./cjs/*.cjs": "./*.cjs", - "./mjs/*.mjs": "./*.mjs", - "./js/*.js": "./*.js" - } - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).js index b2f2aabab4..19140a3fe5 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -67,32 +76,61 @@ export { type }; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjsi = require("inner/cjs/index.cjs"); -const mjsi = require("inner/mjs/index.mjs"); -const typei = require("inner/js/index.js"); +import * as cjsi from "inner/cjs/index.cjs"; +import * as mjsi from "inner/mjs/index.mjs"; +import * as typei from "inner/js/index.js"; cjsi; mjsi; typei; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjsi = require("inner/cjs/index.cjs"); -const mjsi = require("inner/mjs/index.mjs"); -const typei = require("inner/js/index.js"); +import * as cjsi from "inner/cjs/index.cjs"; +import * as mjsi from "inner/mjs/index.mjs"; +import * as typei from "inner/js/index.js"; cjsi; mjsi; typei; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // cjs format file -const cjsi = require("inner/cjs/index.cjs"); -const mjsi = require("inner/mjs/index.mjs"); -const typei = require("inner/js/index.js"); +const cjsi = __importStar(require("inner/cjs/index.cjs")); +const mjsi = __importStar(require("inner/mjs/index.mjs")); +const typei = __importStar(require("inner/js/index.js")); cjsi; mjsi; typei; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).js.diff deleted file mode 100644 index b42fac0647..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).js.diff +++ /dev/null @@ -1,77 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).js -+++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).js -@@= skipped -66, +66 lines =@@ - - - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as cjsi from "inner/cjs/index.cjs"; --import * as mjsi from "inner/mjs/index.mjs"; --import * as typei from "inner/js/index.js"; -+const cjsi = require("inner/cjs/index.cjs"); -+const mjsi = require("inner/mjs/index.mjs"); -+const typei = require("inner/js/index.js"); - cjsi; - mjsi; - typei; - //// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as cjsi from "inner/cjs/index.cjs"; --import * as mjsi from "inner/mjs/index.mjs"; --import * as typei from "inner/js/index.js"; -+const cjsi = require("inner/cjs/index.cjs"); -+const mjsi = require("inner/mjs/index.mjs"); -+const typei = require("inner/js/index.js"); - cjsi; - mjsi; - typei; - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - // cjs format file --const cjsi = __importStar(require("inner/cjs/index.cjs")); --const mjsi = __importStar(require("inner/mjs/index.mjs")); --const typei = __importStar(require("inner/js/index.js")); -+const cjsi = require("inner/cjs/index.cjs"); -+const mjsi = require("inner/mjs/index.mjs"); -+const typei = require("inner/js/index.js"); - cjsi; - mjsi; - typei; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).symbols index b6cc027370..182fd209da 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).symbols.diff deleted file mode 100644 index e9f329450a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).symbols -+++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).types index 2530671b34..4c7b763f3a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).js index 5c434e9847..19140a3fe5 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).symbols index b6cc027370..182fd209da 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).symbols.diff deleted file mode 100644 index 00aaf409ca..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).symbols -+++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).types index 2530671b34..4c7b763f3a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).errors.txt index 0d45e82ff4..2a46b9875d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).errors.txt @@ -1,20 +1,10 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2468: Cannot find global value 'Promise'. index.js(3,1): error TS8002: 'import ... =' can only be used in TypeScript files. index.js(5,1): error TS8002: 'import ... =' can only be used in TypeScript files. -index.js(6,23): error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.js(7,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.js(8,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. subfolder/index.js(3,1): error TS8002: 'import ... =' can only be used in TypeScript files. subfolder/index.js(5,1): error TS8002: 'import ... =' can only be used in TypeScript files. -subfolder/index.js(6,23): error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -subfolder/index.js(7,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -subfolder/index.js(8,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2468: Cannot find global value 'Promise'. -==== subfolder/index.js (5 errors) ==== +==== subfolder/index.js (2 errors) ==== // cjs format file import {h} from "../index.js"; import mod = require("../index.js"); @@ -25,17 +15,11 @@ subfolder/index.js(8,24): error TS2712: A dynamic import call in ES5 requires th ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. export async function f() { - ~ -!!! error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. const mod3 = await import ("../index.js"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. const mod4 = await import ("./index.js"); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. h(); } -==== index.js (5 errors) ==== +==== index.js (2 errors) ==== // esm format file import {h as _h} from "./index.js"; import mod = require("./index.js"); @@ -46,14 +30,8 @@ subfolder/index.js(8,24): error TS2712: A dynamic import call in ES5 requires th ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS8002: 'import ... =' can only be used in TypeScript files. export async function h() { - ~ -!!! error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. const mod3 = await import ("./index.js"); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. const mod4 = await import ("./subfolder/index.js"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. f(); } ==== package.json (0 errors) ==== diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).js index df11fc187e..3ea5819786 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).js @@ -34,18 +34,17 @@ export async function h() { } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.h = h; +import { createRequire as _createRequire } from "module"; +const __require = _createRequire(import.meta.url); // esm format file -const index_js_1 = require("./index.js"); -const mod = require("./index.js"); -const index_js_2 = require("./subfolder/index.js"); -const mod2 = require("./subfolder/index.js"); -async function h() { +import { h as _h } from "./index.js"; +const mod = __require("./index.js"); +import { f } from "./subfolder/index.js"; +const mod2 = __require("./subfolder/index.js"); +export async function h() { const mod3 = await import("./index.js"); const mod4 = await import("./subfolder/index.js"); - (0, index_js_2.f)(); + f(); } //// [index.js] "use strict"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).js.diff index 63ea0f0f3c..3f6a4571dd 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).js.diff @@ -1,33 +1,6 @@ --- old.nodeModulesAllowJsSynchronousCallErrors(module=node20).js +++ new.nodeModulesAllowJsSynchronousCallErrors(module=node20).js -@@= skipped -33, +33 lines =@@ - } - - //// [index.js] --import { createRequire as _createRequire } from "module"; --const __require = _createRequire(import.meta.url); -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.h = h; - // esm format file --import { h as _h } from "./index.js"; --const mod = __require("./index.js"); --import { f } from "./subfolder/index.js"; --const mod2 = __require("./subfolder/index.js"); --export async function h() { -+const index_js_1 = require("./index.js"); -+const mod = require("./index.js"); -+const index_js_2 = require("./subfolder/index.js"); -+const mod2 = require("./subfolder/index.js"); -+async function h() { - const mod3 = await import("./index.js"); - const mod4 = await import("./subfolder/index.js"); -- f(); -+ (0, index_js_2.f)(); - } - //// [index.js] - "use strict"; -@@= skipped -29, +30 lines =@@ +@@= skipped -62, +62 lines =@@ //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).types index 1e19c8b8f2..a28566d8d4 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).types @@ -19,9 +19,9 @@ export async function f() { >f : () => Promise const mod3 = await import ("../index.js"); ->mod3 : { h(): Promise; default: typeof mod; } ->await import ("../index.js") : { h(): Promise; default: typeof mod; } ->import ("../index.js") : Promise<{ h(): Promise; default: typeof mod; }> +>mod3 : typeof mod +>await import ("../index.js") : typeof mod +>import ("../index.js") : Promise >"../index.js" : "../index.js" const mod4 = await import ("./index.js"); @@ -53,9 +53,9 @@ export async function h() { >h : () => Promise const mod3 = await import ("./index.js"); ->mod3 : { h(): Promise; default: typeof mod; } ->await import ("./index.js") : { h(): Promise; default: typeof mod; } ->import ("./index.js") : Promise<{ h(): Promise; default: typeof mod; }> +>mod3 : typeof mod +>await import ("./index.js") : typeof mod +>import ("./index.js") : Promise >"./index.js" : "./index.js" const mod4 = await import ("./subfolder/index.js"); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsTopLevelAwait(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsTopLevelAwait(module=node20).errors.txt index 08f9461c8f..78c93edaa0 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsTopLevelAwait(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsTopLevelAwait(module=node20).errors.txt @@ -1,29 +1,21 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -index.js(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -index.js(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -subfolder/index.js(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -subfolder/index.js(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +subfolder/index.js(2,11): error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. +subfolder/index.js(4,5): error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== subfolder/index.js (2 errors) ==== // cjs format file const x = await 1; ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. export {x}; for await (const y of []) {} ~~~~~ -!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -==== index.js (2 errors) ==== +!!! error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. +==== index.js (0 errors) ==== // esm format file const x = await 1; - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. export {x}; for await (const y of []) {} - ~~~~~ -!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. ==== package.json (0 errors) ==== { "name": "package", diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsTopLevelAwait(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsTopLevelAwait(module=node20).js index 318f9cb82c..69fdcac5a2 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsTopLevelAwait(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsTopLevelAwait(module=node20).js @@ -30,12 +30,9 @@ const x = await 1; exports.x = x; for await (const y of []) { } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = await 1; -exports.x = x; +export { x }; for await (const y of []) { } diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsTopLevelAwait(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsTopLevelAwait(module=node20).js.diff index c3fe3a2d4f..1be5ac7bb4 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsTopLevelAwait(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesAllowJsTopLevelAwait(module=node20).js.diff @@ -1,17 +1,6 @@ --- old.nodeModulesAllowJsTopLevelAwait(module=node20).js +++ new.nodeModulesAllowJsTopLevelAwait(module=node20).js -@@= skipped -29, +29 lines =@@ - exports.x = x; - for await (const y of []) { } - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; - // esm format file - const x = await 1; --export { x }; -+exports.x = x; - for await (const y of []) { } +@@= skipped -36, +36 lines =@@ //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node20).errors.txt index 96d4384732..68c11a8bbb 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node20).errors.txt @@ -1,9 +1,7 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. /5.cjs(1,8): error TS1192: Module '"/2"' has no default export. /5.cjs(2,8): error TS1192: Module '"/3"' has no default export. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /1.cjs (0 errors) ==== module.exports = {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node20).js index 0432572e6c..41870a452e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node20).js @@ -42,8 +42,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); ; //// [5.cjs] "use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", { value: true }); -const _2_cjs_1 = require("./2.cjs"); // ok -const _3_cjs_1 = require("./3.cjs"); // error +const _2_cjs_1 = __importDefault(require("./2.cjs")); // ok +const _3_cjs_1 = __importDefault(require("./3.cjs")); // error _2_cjs_1.default.foo; _3_cjs_1.default.foo; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node20).js.diff index f0c05cd3b8..115c779170 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesCJSEmit1(module=node20).js.diff @@ -19,18 +19,4 @@ +export var foo = {}; exports.foo = {}; //// [4.cjs] - "use strict"; -@@= skipped -15, +20 lines =@@ - ; - //// [5.cjs] - "use strict"; --var __importDefault = (this && this.__importDefault) || function (mod) { -- return (mod && mod.__esModule) ? mod : { "default": mod }; --}; - Object.defineProperty(exports, "__esModule", { value: true }); --const _2_cjs_1 = __importDefault(require("./2.cjs")); // ok --const _3_cjs_1 = __importDefault(require("./3.cjs")); // error -+const _2_cjs_1 = require("./2.cjs"); // ok -+const _3_cjs_1 = require("./3.cjs"); // error - _2_cjs_1.default.foo; - _3_cjs_1.default.foo; \ No newline at end of file + "use strict"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).errors.txt deleted file mode 100644 index 34d9cf4c02..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).errors.txt +++ /dev/null @@ -1,24 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -index.ts(2,8): error TS1192: Module '"subfolder/index"' has no default export. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== subfolder/index.ts (0 errors) ==== - // cjs format file - export const a = 1; -==== index.ts (1 errors) ==== - // esm format file - import mod from "./subfolder/index.js"; - ~~~ -!!! error TS1192: Module '"subfolder/index"' has no default export. - mod; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module" - } -==== subfolder/package.json (0 errors) ==== - { - "type": "commonjs" - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).errors.txt.diff deleted file mode 100644 index 169fe70c0a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).errors.txt.diff +++ /dev/null @@ -1,28 +0,0 @@ ---- old.nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).errors.txt -+++ new.nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+index.ts(2,8): error TS1192: Module '"subfolder/index"' has no default export. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== subfolder/index.ts (0 errors) ==== -+ // cjs format file -+ export const a = 1; -+==== index.ts (1 errors) ==== -+ // esm format file -+ import mod from "./subfolder/index.js"; -+ ~~~ -+!!! error TS1192: Module '"subfolder/index"' has no default export. -+ mod; -+==== package.json (0 errors) ==== -+ { -+ "name": "package", -+ "private": true, -+ "type": "module" -+ } -+==== subfolder/package.json (0 errors) ==== -+ { -+ "type": "commonjs" -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).js index b766039383..f0c9198a51 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).js @@ -25,11 +25,9 @@ exports.a = void 0; // cjs format file exports.a = 1; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const index_js_1 = require("./subfolder/index.js"); -index_js_1.default; +import mod from "./subfolder/index.js"; +mod; //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).js.diff deleted file mode 100644 index b3137ea4f3..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).js.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).js -+++ new.nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).js -@@= skipped -24, +24 lines =@@ - // cjs format file - exports.a = 1; - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import mod from "./subfolder/index.js"; --mod; -+const index_js_1 = require("./subfolder/index.js"); -+index_js_1.default; - - - //// [index.d.ts] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).types index ff082de1b8..906754ee99 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).types @@ -9,8 +9,8 @@ export const a = 1; === index.ts === // esm format file import mod from "./subfolder/index.js"; ->mod : any +>mod : typeof mod mod; ->mod : any +>mod : typeof mod diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).types.diff deleted file mode 100644 index f4d5164ed0..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).types.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).types -+++ new.nodeModulesCjsFormatFileAlwaysHasDefault(module=node20).types -@@= skipped -8, +8 lines =@@ - === index.ts === - // esm format file - import mod from "./subfolder/index.js"; -->mod : typeof mod -+>mod : any - - mod; -->mod : typeof mod -+>mod : any diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).errors.txt index 35c27166e7..7400a788e2 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).errors.txt @@ -1,27 +1,12 @@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. +index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. +index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.ts (3 errors) ==== +==== index.ts (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -33,17 +18,11 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding mjsi.mjsSource; typei.mjsSource; ts.mjsSource; -==== index.mts (3 errors) ==== +==== index.mts (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -55,17 +34,15 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding mjsi.mjsSource; typei.mjsSource; ts.mjsSource; -==== index.cts (3 errors) ==== +==== index.cts (2 errors) ==== // cjs format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. import * as type from "package"; ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. cjs; mjs; type; @@ -78,6 +55,9 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding typei.implicitCjsSource; ts.cjsSource; ==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (0 errors) ==== // cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -87,8 +67,10 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; export { ts }; - export const implicitCjsSource = true; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -98,8 +80,10 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; export { ts }; - export const mjsSource = true; ==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (0 errors) ==== // cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -109,7 +93,6 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; export { ts }; - export const cjsSource = true; ==== package.json (0 errors) ==== { "name": "package", diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).errors.txt.diff deleted file mode 100644 index db9b2c18e8..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).errors.txt.diff +++ /dev/null @@ -1,139 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=node16).errors.txt -+++ new.nodeModulesConditionalPackageExports(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. --index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. --node_modules/inner/index.d.mts(2,13): error TS2303: Circular definition of import alias 'cjs'. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -+index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.ts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.mts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.cts (2 errors) ==== -+==== index.ts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.mts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.cts (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -57, +76 lines =@@ - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; -@@= skipped -13, +11 lines =@@ - export { type }; - export { ts }; - export const implicitCjsSource = true; --==== node_modules/inner/index.d.mts (1 errors) ==== -+==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).js b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).js index 87d5cda21c..7653fb782c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).js @@ -50,6 +50,9 @@ typei.implicitCjsSource; ts.cjsSource; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -57,10 +60,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const implicitCjsSource = true; +export { ts }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -68,10 +73,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const mjsSource = true; +export { ts }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -79,8 +86,7 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const cjsSource = true; +export { ts }; //// [package.json] { "name": "package", @@ -123,22 +129,6 @@ export const cjsSource = true; } -//// [index.js] -// esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; -cjs; -mjs; -type; -import * as cjsi from "inner/a"; -import * as mjsi from "inner/b"; -import * as typei from "inner"; -import * as ts from "inner/types"; -cjsi.mjsSource; -mjsi.mjsSource; -typei.mjsSource; -ts.mjsSource; //// [index.mjs] // esm format file import * as cjs from "package/cjs"; @@ -206,11 +196,27 @@ cjsi.cjsSource; mjsi.cjsSource; typei.implicitCjsSource; ts.cjsSource; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/a"; +import * as mjsi from "inner/b"; +import * as typei from "inner"; +import * as ts from "inner/types"; +cjsi.mjsSource; +mjsi.mjsSource; +typei.mjsSource; +ts.mjsSource; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).js.diff deleted file mode 100644 index 5a8f5c9077..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).js.diff +++ /dev/null @@ -1,57 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=node16).js -+++ new.nodeModulesConditionalPackageExports(module=node16).js -@@= skipped -122, +122 lines =@@ - } - - -+//// [index.js] -+// esm format file -+import * as cjs from "package/cjs"; -+import * as mjs from "package/mjs"; -+import * as type from "package"; -+cjs; -+mjs; -+type; -+import * as cjsi from "inner/a"; -+import * as mjsi from "inner/b"; -+import * as typei from "inner"; -+import * as ts from "inner/types"; -+cjsi.mjsSource; -+mjsi.mjsSource; -+typei.mjsSource; -+ts.mjsSource; - //// [index.mjs] - // esm format file - import * as cjs from "package/cjs"; -@@= skipped -67, +83 lines =@@ - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/a"; --import * as mjsi from "inner/b"; --import * as typei from "inner"; --import * as ts from "inner/types"; --cjsi.mjsSource; --mjsi.mjsSource; --typei.mjsSource; --ts.mjsSource; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).symbols index e574ed5f77..fed90e232d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).symbols @@ -33,24 +33,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.ts, 10, 6)) cjsi.mjsSource; ->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.ts, 7, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.ts, 8, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.ts, 9, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.ts, 10, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.mts === // esm format file @@ -85,24 +85,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.mts, 10, 6)) cjsi.mjsSource; ->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.mts, 7, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.mts, 8, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.mts, 9, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.mts, 10, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.cts === // cjs format file @@ -137,109 +137,115 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.cts, 10, 6)) cjsi.cjsSource; ->cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.cts, 7, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) mjsi.cjsSource; ->mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.cts, 8, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) typei.implicitCjsSource; ->typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) +>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) >typei : Symbol(typei, Decl(index.cts, 9, 6)) ->implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) +>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) ts.cjsSource; ->ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >ts : Symbol(ts, Decl(index.cts, 10, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.ts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.ts, 4, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 5, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 6, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 7, 8)) +>type : Symbol(type, Decl(test.d.ts, 7, 8)) export { ts }; ->ts : Symbol(type.ts, Decl(index.d.ts, 8, 8)) - -export const implicitCjsSource = true; ->implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.ts, 8, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.mts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.mts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.mts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.mts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.mts, 7, 8)) +>type : Symbol(type, Decl(test.d.mts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.mts, 8, 8)) - -export const mjsSource = true; ->mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.mts, 8, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.cts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.cts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 7, 8)) +>type : Symbol(type, Decl(test.d.cts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - -export const cjsSource = true; ->cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.cts, 8, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).symbols.diff deleted file mode 100644 index db7e92d3d8..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).symbols.diff +++ /dev/null @@ -1,70 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=node16).symbols -+++ new.nodeModulesConditionalPackageExports(module=node16).symbols -@@= skipped -146, +146 lines =@@ - >cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) - - typei.implicitCjsSource; -->typei.implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) - >typei : Symbol(typei, Decl(index.cts, 9, 6)) -->implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) - - ts.cjsSource; - >ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) -@@= skipped -24, +24 lines =@@ - >ts : Symbol(ts, Decl(index.d.ts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.type.cjs, Decl(index.d.ts, 5, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.type.mjs, Decl(index.d.ts, 6, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type.type, Decl(index.d.ts, 7, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.type.ts, Decl(index.d.ts, 8, 8)) -+>ts : Symbol(type.ts, Decl(index.d.ts, 8, 8)) - - export const implicitCjsSource = true; -->implicitCjsSource : Symbol(mjs.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -29, +29 lines =@@ - >ts : Symbol(ts, Decl(index.d.mts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 5, 8)) -+>cjs : Symbol(cjs.cjs, Decl(index.d.mts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 6, 8)) -+>mjs : Symbol(cjs.mjs, Decl(index.d.mts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type, Decl(index.d.mts, 7, 8)) -+>type : Symbol(cjs.type, Decl(index.d.mts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.ts, Decl(index.d.mts, 8, 8)) -+>ts : Symbol(cjs.ts, Decl(index.d.mts, 8, 8)) - - export const mjsSource = true; -->mjsSource : Symbol(mjs.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -41, +41 lines =@@ - >ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - - export const cjsSource = true; -->cjsSource : Symbol(cjs.cjsSource, Decl(index.d.cts, 9, 12)) -+>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).types index 548c7f4fc2..2cc0823cd4 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).types @@ -3,22 +3,22 @@ === index.ts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -55,22 +55,22 @@ ts.mjsSource; === index.mts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -107,22 +107,22 @@ ts.mjsSource; === index.cts === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -158,6 +158,12 @@ ts.cjsSource; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -182,11 +188,13 @@ export { type }; export { ts }; >ts : typeof cjs -export const implicitCjsSource = true; ->implicitCjsSource : true +=== node_modules/inner/index.d.mts === +// esm format file +export const mjsSource = true; +>mjsSource : true >true : true -=== node_modules/inner/index.d.mts === +=== node_modules/inner/test.d.mts === // esm format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -212,11 +220,13 @@ export { type }; export { ts }; >ts : typeof cjs -export const mjsSource = true; ->mjsSource : true +=== node_modules/inner/index.d.cts === +// cjs format file +export const cjsSource = true; +>cjsSource : true >true : true -=== node_modules/inner/index.d.cts === +=== node_modules/inner/test.d.cts === // cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -242,7 +252,3 @@ export { type }; export { ts }; >ts : typeof cjs -export const cjsSource = true; ->cjsSource : true ->true : true - diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).types.diff deleted file mode 100644 index b5d4494171..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node16).types.diff +++ /dev/null @@ -1,199 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=node16).types -+++ new.nodeModulesConditionalPackageExports(module=node16).types -@@= skipped -2, +2 lines =@@ - === index.ts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -52, +52 lines =@@ - === index.mts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -52, +52 lines =@@ - === index.cts === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -24, +24 lines =@@ - >mjsi : typeof cjsi - - import * as typei from "inner"; -->typei : typeof cjsi.type -+>typei : typeof typei - - import * as ts from "inner/types"; - >ts : typeof cjsi -@@= skipped -17, +17 lines =@@ - - typei.implicitCjsSource; - >typei.implicitCjsSource : true -->typei : typeof cjsi.type -+>typei : typeof typei - >implicitCjsSource : true - - ts.cjsSource; -@@= skipped -11, +11 lines =@@ - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : typeof cjs - - import * as type from "inner"; -->type : typeof mjs.type -+>type : typeof type - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : typeof cjs - - export { type }; -->type : typeof mjs.type -+>type : typeof type - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const implicitCjsSource = true; - >implicitCjsSource : true -@@= skipped -30, +30 lines =@@ - === node_modules/inner/index.d.mts === - // esm format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : typeof cjs - - import * as type from "inner"; -->type : typeof mjs -+>type : typeof cjs - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : typeof cjs - - export { type }; -->type : typeof mjs -+>type : typeof cjs - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const mjsSource = true; - >mjsSource : true -@@= skipped -36, +36 lines =@@ - >mjs : typeof cjs - - import * as type from "inner"; -->type : typeof cjs.type -+>type : typeof type - - import * as ts from "inner/types"; - >ts : typeof cjs -@@= skipped -12, +12 lines =@@ - >mjs : typeof cjs - - export { type }; -->type : typeof cjs.type -+>type : typeof type - - export { ts }; - >ts : typeof cjs \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).errors.txt index 35c27166e7..7400a788e2 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).errors.txt @@ -1,27 +1,12 @@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. +index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. +index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.ts (3 errors) ==== +==== index.ts (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -33,17 +18,11 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding mjsi.mjsSource; typei.mjsSource; ts.mjsSource; -==== index.mts (3 errors) ==== +==== index.mts (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -55,17 +34,15 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding mjsi.mjsSource; typei.mjsSource; ts.mjsSource; -==== index.cts (3 errors) ==== +==== index.cts (2 errors) ==== // cjs format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. import * as type from "package"; ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. cjs; mjs; type; @@ -78,6 +55,9 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding typei.implicitCjsSource; ts.cjsSource; ==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (0 errors) ==== // cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -87,8 +67,10 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; export { ts }; - export const implicitCjsSource = true; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -98,8 +80,10 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; export { ts }; - export const mjsSource = true; ==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (0 errors) ==== // cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; @@ -109,7 +93,6 @@ index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding export { mjs }; export { type }; export { ts }; - export const cjsSource = true; ==== package.json (0 errors) ==== { "name": "package", diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).errors.txt.diff deleted file mode 100644 index 9f08cb4b48..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).errors.txt.diff +++ /dev/null @@ -1,139 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=node18).errors.txt -+++ new.nodeModulesConditionalPackageExports(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. --index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. --node_modules/inner/index.d.mts(2,13): error TS2303: Circular definition of import alias 'cjs'. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -+index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.ts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.mts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.cts (2 errors) ==== -+==== index.ts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.mts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.cts (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -57, +76 lines =@@ - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; -@@= skipped -13, +11 lines =@@ - export { type }; - export { ts }; - export const implicitCjsSource = true; --==== node_modules/inner/index.d.mts (1 errors) ==== -+==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).js index 87d5cda21c..7653fb782c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).js @@ -50,6 +50,9 @@ typei.implicitCjsSource; ts.cjsSource; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -57,10 +60,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const implicitCjsSource = true; +export { ts }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -68,10 +73,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const mjsSource = true; +export { ts }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -79,8 +86,7 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const cjsSource = true; +export { ts }; //// [package.json] { "name": "package", @@ -123,22 +129,6 @@ export const cjsSource = true; } -//// [index.js] -// esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; -cjs; -mjs; -type; -import * as cjsi from "inner/a"; -import * as mjsi from "inner/b"; -import * as typei from "inner"; -import * as ts from "inner/types"; -cjsi.mjsSource; -mjsi.mjsSource; -typei.mjsSource; -ts.mjsSource; //// [index.mjs] // esm format file import * as cjs from "package/cjs"; @@ -206,11 +196,27 @@ cjsi.cjsSource; mjsi.cjsSource; typei.implicitCjsSource; ts.cjsSource; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/a"; +import * as mjsi from "inner/b"; +import * as typei from "inner"; +import * as ts from "inner/types"; +cjsi.mjsSource; +mjsi.mjsSource; +typei.mjsSource; +ts.mjsSource; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).js.diff deleted file mode 100644 index 88c09cb208..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).js.diff +++ /dev/null @@ -1,57 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=node18).js -+++ new.nodeModulesConditionalPackageExports(module=node18).js -@@= skipped -122, +122 lines =@@ - } - - -+//// [index.js] -+// esm format file -+import * as cjs from "package/cjs"; -+import * as mjs from "package/mjs"; -+import * as type from "package"; -+cjs; -+mjs; -+type; -+import * as cjsi from "inner/a"; -+import * as mjsi from "inner/b"; -+import * as typei from "inner"; -+import * as ts from "inner/types"; -+cjsi.mjsSource; -+mjsi.mjsSource; -+typei.mjsSource; -+ts.mjsSource; - //// [index.mjs] - // esm format file - import * as cjs from "package/cjs"; -@@= skipped -67, +83 lines =@@ - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/a"; --import * as mjsi from "inner/b"; --import * as typei from "inner"; --import * as ts from "inner/types"; --cjsi.mjsSource; --mjsi.mjsSource; --typei.mjsSource; --ts.mjsSource; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).symbols index e574ed5f77..fed90e232d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).symbols @@ -33,24 +33,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.ts, 10, 6)) cjsi.mjsSource; ->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.ts, 7, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.ts, 8, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.ts, 9, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.ts, 10, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.mts === // esm format file @@ -85,24 +85,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.mts, 10, 6)) cjsi.mjsSource; ->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.mts, 7, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.mts, 8, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.mts, 9, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.mts, 10, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.cts === // cjs format file @@ -137,109 +137,115 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.cts, 10, 6)) cjsi.cjsSource; ->cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.cts, 7, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) mjsi.cjsSource; ->mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.cts, 8, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) typei.implicitCjsSource; ->typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) +>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) >typei : Symbol(typei, Decl(index.cts, 9, 6)) ->implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) +>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) ts.cjsSource; ->ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >ts : Symbol(ts, Decl(index.cts, 10, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.ts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.ts, 4, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 5, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 6, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 7, 8)) +>type : Symbol(type, Decl(test.d.ts, 7, 8)) export { ts }; ->ts : Symbol(type.ts, Decl(index.d.ts, 8, 8)) - -export const implicitCjsSource = true; ->implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.ts, 8, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.mts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.mts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.mts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.mts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.mts, 7, 8)) +>type : Symbol(type, Decl(test.d.mts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.mts, 8, 8)) - -export const mjsSource = true; ->mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.mts, 8, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.cts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.cts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 7, 8)) +>type : Symbol(type, Decl(test.d.cts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - -export const cjsSource = true; ->cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.cts, 8, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).symbols.diff deleted file mode 100644 index 069b3123ae..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).symbols.diff +++ /dev/null @@ -1,70 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=node18).symbols -+++ new.nodeModulesConditionalPackageExports(module=node18).symbols -@@= skipped -146, +146 lines =@@ - >cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) - - typei.implicitCjsSource; -->typei.implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) - >typei : Symbol(typei, Decl(index.cts, 9, 6)) -->implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) - - ts.cjsSource; - >ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) -@@= skipped -24, +24 lines =@@ - >ts : Symbol(ts, Decl(index.d.ts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.type.cjs, Decl(index.d.ts, 5, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.type.mjs, Decl(index.d.ts, 6, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type.type, Decl(index.d.ts, 7, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.type.ts, Decl(index.d.ts, 8, 8)) -+>ts : Symbol(type.ts, Decl(index.d.ts, 8, 8)) - - export const implicitCjsSource = true; -->implicitCjsSource : Symbol(mjs.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -29, +29 lines =@@ - >ts : Symbol(ts, Decl(index.d.mts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 5, 8)) -+>cjs : Symbol(cjs.cjs, Decl(index.d.mts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 6, 8)) -+>mjs : Symbol(cjs.mjs, Decl(index.d.mts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type, Decl(index.d.mts, 7, 8)) -+>type : Symbol(cjs.type, Decl(index.d.mts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.ts, Decl(index.d.mts, 8, 8)) -+>ts : Symbol(cjs.ts, Decl(index.d.mts, 8, 8)) - - export const mjsSource = true; -->mjsSource : Symbol(mjs.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -41, +41 lines =@@ - >ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - - export const cjsSource = true; -->cjsSource : Symbol(cjs.cjsSource, Decl(index.d.cts, 9, 12)) -+>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).types index 548c7f4fc2..2cc0823cd4 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).types @@ -3,22 +3,22 @@ === index.ts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -55,22 +55,22 @@ ts.mjsSource; === index.mts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -107,22 +107,22 @@ ts.mjsSource; === index.cts === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -158,6 +158,12 @@ ts.cjsSource; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -182,11 +188,13 @@ export { type }; export { ts }; >ts : typeof cjs -export const implicitCjsSource = true; ->implicitCjsSource : true +=== node_modules/inner/index.d.mts === +// esm format file +export const mjsSource = true; +>mjsSource : true >true : true -=== node_modules/inner/index.d.mts === +=== node_modules/inner/test.d.mts === // esm format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -212,11 +220,13 @@ export { type }; export { ts }; >ts : typeof cjs -export const mjsSource = true; ->mjsSource : true +=== node_modules/inner/index.d.cts === +// cjs format file +export const cjsSource = true; +>cjsSource : true >true : true -=== node_modules/inner/index.d.cts === +=== node_modules/inner/test.d.cts === // cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -242,7 +252,3 @@ export { type }; export { ts }; >ts : typeof cjs -export const cjsSource = true; ->cjsSource : true ->true : true - diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).types.diff deleted file mode 100644 index 5d552d69c5..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node18).types.diff +++ /dev/null @@ -1,199 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=node18).types -+++ new.nodeModulesConditionalPackageExports(module=node18).types -@@= skipped -2, +2 lines =@@ - === index.ts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -52, +52 lines =@@ - === index.mts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -52, +52 lines =@@ - === index.cts === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -24, +24 lines =@@ - >mjsi : typeof cjsi - - import * as typei from "inner"; -->typei : typeof cjsi.type -+>typei : typeof typei - - import * as ts from "inner/types"; - >ts : typeof cjsi -@@= skipped -17, +17 lines =@@ - - typei.implicitCjsSource; - >typei.implicitCjsSource : true -->typei : typeof cjsi.type -+>typei : typeof typei - >implicitCjsSource : true - - ts.cjsSource; -@@= skipped -11, +11 lines =@@ - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : typeof cjs - - import * as type from "inner"; -->type : typeof mjs.type -+>type : typeof type - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : typeof cjs - - export { type }; -->type : typeof mjs.type -+>type : typeof type - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const implicitCjsSource = true; - >implicitCjsSource : true -@@= skipped -30, +30 lines =@@ - === node_modules/inner/index.d.mts === - // esm format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : typeof cjs - - import * as type from "inner"; -->type : typeof mjs -+>type : typeof cjs - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : typeof cjs - - export { type }; -->type : typeof mjs -+>type : typeof cjs - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const mjsSource = true; - >mjsSource : true -@@= skipped -36, +36 lines =@@ - >mjs : typeof cjs - - import * as type from "inner"; -->type : typeof cjs.type -+>type : typeof type - - import * as ts from "inner/types"; - >ts : typeof cjs -@@= skipped -12, +12 lines =@@ - >mjs : typeof cjs - - export { type }; -->type : typeof cjs.type -+>type : typeof type - - export { ts }; - >ts : typeof cjs \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).errors.txt deleted file mode 100644 index 25d206bde9..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).errors.txt +++ /dev/null @@ -1,193 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.cts(9,23): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -index.cts(10,24): error TS2307: Cannot find module 'inner' or its corresponding type declarations. -index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mts(8,23): error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. -index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.ts(9,23): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -index.ts(10,24): error TS2307: Cannot find module 'inner' or its corresponding type declarations. -index.ts(12,6): error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -index.ts(15,4): error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -node_modules/inner/index.d.cts(3,22): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -node_modules/inner/index.d.cts(4,23): error TS2307: Cannot find module 'inner' or its corresponding type declarations. -node_modules/inner/index.d.mts(2,22): error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. -node_modules/inner/index.d.ts(3,22): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -node_modules/inner/index.d.ts(4,23): error TS2307: Cannot find module 'inner' or its corresponding type declarations. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.ts (7 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/a"; - import * as mjsi from "inner/b"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. - import * as typei from "inner"; - ~~~~~~~ -!!! error TS2307: Cannot find module 'inner' or its corresponding type declarations. - import * as ts from "inner/types"; - cjsi.mjsSource; - ~~~~~~~~~ -!!! error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -!!! related TS2728 node_modules/inner/index.d.cts:10:14: 'cjsSource' is declared here. - mjsi.mjsSource; - typei.mjsSource; - ts.mjsSource; - ~~~~~~~~~ -!!! error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -!!! related TS2728 node_modules/inner/index.d.cts:10:14: 'cjsSource' is declared here. -==== index.mts (4 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/a"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. - import * as mjsi from "inner/b"; - import * as typei from "inner"; - import * as ts from "inner/types"; - cjsi.mjsSource; - mjsi.mjsSource; - typei.mjsSource; - ts.mjsSource; -==== index.cts (5 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/a"; - import * as mjsi from "inner/b"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. - import * as typei from "inner"; - ~~~~~~~ -!!! error TS2307: Cannot find module 'inner' or its corresponding type declarations. - import * as ts from "inner/types"; - cjsi.cjsSource; - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; -==== node_modules/inner/index.d.ts (2 errors) ==== - // cjs format file - import * as cjs from "inner/a"; - import * as mjs from "inner/b"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. - import * as type from "inner"; - ~~~~~~~ -!!! error TS2307: Cannot find module 'inner' or its corresponding type declarations. - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; - export { type }; - export { ts }; - export const implicitCjsSource = true; -==== node_modules/inner/index.d.mts (1 errors) ==== - // esm format file - import * as cjs from "inner/a"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; - export { type }; - export { ts }; - export const mjsSource = true; -==== node_modules/inner/index.d.cts (2 errors) ==== - // cjs format file - import * as cjs from "inner/a"; - import * as mjs from "inner/b"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. - import * as type from "inner"; - ~~~~~~~ -!!! error TS2307: Cannot find module 'inner' or its corresponding type declarations. - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; - export { type }; - export { ts }; - export const cjsSource = true; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module", - "exports": { - "./cjs": "./index.cjs", - "./mjs": "./index.mjs", - ".": "./index.js" - } - } -==== node_modules/inner/package.json (0 errors) ==== - { - "name": "inner", - "private": true, - "exports": { - "./a": { - "require": "./index.cjs", - "node": "./index.mjs" - }, - "./b": { - "import": "./index.mjs", - "node": "./index.cjs" - }, - ".": { - "import": "./index.mjs", - "node": "./index.js" - }, - "./types": { - "types": { - "import": "./index.d.mts", - "require": "./index.d.cts" - }, - "node": { - "import": "./index.mjs", - "require": "./index.cjs" - } - } - } - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).errors.txt.diff deleted file mode 100644 index f694e2de34..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).errors.txt.diff +++ /dev/null @@ -1,192 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=node20).errors.txt -+++ new.nodeModulesConditionalPackageExports(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --node_modules/inner/index.d.mts(2,13): error TS2303: Circular definition of import alias 'cjs'. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -- -- -+index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.cts(9,23): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -+index.cts(10,24): error TS2307: Cannot find module 'inner' or its corresponding type declarations. -+index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mts(8,23): error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. -+index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.ts(9,23): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -+index.ts(10,24): error TS2307: Cannot find module 'inner' or its corresponding type declarations. -+index.ts(12,6): error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -+index.ts(15,4): error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -+node_modules/inner/index.d.cts(3,22): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -+node_modules/inner/index.d.cts(4,23): error TS2307: Cannot find module 'inner' or its corresponding type declarations. -+node_modules/inner/index.d.mts(2,22): error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. -+node_modules/inner/index.d.ts(3,22): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -+node_modules/inner/index.d.ts(4,23): error TS2307: Cannot find module 'inner' or its corresponding type declarations. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.ts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.mts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.cts (0 errors) ==== -+==== index.ts (7 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -+ import * as typei from "inner"; -+ ~~~~~~~ -+!!! error TS2307: Cannot find module 'inner' or its corresponding type declarations. -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ ~~~~~~~~~ -+!!! error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -+!!! related TS2728 node_modules/inner/index.d.cts:10:14: 'cjsSource' is declared here. -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+ ~~~~~~~~~ -+!!! error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -+!!! related TS2728 node_modules/inner/index.d.cts:10:14: 'cjsSource' is declared here. -+==== index.mts (4 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.cts (5 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/a"; - import * as mjsi from "inner/b"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. - import * as typei from "inner"; -+ ~~~~~~~ -+!!! error TS2307: Cannot find module 'inner' or its corresponding type declarations. - import * as ts from "inner/types"; - cjsi.cjsSource; - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (2 errors) ==== - // cjs format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. - import * as type from "inner"; -+ ~~~~~~~ -+!!! error TS2307: Cannot find module 'inner' or its corresponding type declarations. - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; -@@= skipped -67, +124 lines =@@ - ==== node_modules/inner/index.d.mts (1 errors) ==== - // esm format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; -@@= skipped -10, +10 lines =@@ - export { type }; - export { ts }; - export const mjsSource = true; --==== node_modules/inner/index.d.cts (0 errors) ==== -+==== node_modules/inner/index.d.cts (2 errors) ==== - // cjs format file - import * as cjs from "inner/a"; - import * as mjs from "inner/b"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. - import * as type from "inner"; -+ ~~~~~~~ -+!!! error TS2307: Cannot find module 'inner' or its corresponding type declarations. - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).js index 791b1d07d9..7653fb782c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).js @@ -50,6 +50,9 @@ typei.implicitCjsSource; ts.cjsSource; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -57,10 +60,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const implicitCjsSource = true; +export { ts }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -68,10 +73,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const mjsSource = true; +export { ts }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -79,8 +86,7 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const cjsSource = true; +export { ts }; //// [package.json] { "name": "package", @@ -123,65 +129,94 @@ export const cjsSource = true; } -//// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -// esm format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); -cjs; -mjs; -type; -const cjsi = require("inner/a"); -const mjsi = require("inner/b"); -const typei = require("inner"); -const ts = require("inner/types"); -cjsi.mjsSource; -mjsi.mjsSource; -typei.mjsSource; -ts.mjsSource; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; cjs; mjs; type; -const cjsi = require("inner/a"); -const mjsi = require("inner/b"); -const typei = require("inner"); -const ts = require("inner/types"); +import * as cjsi from "inner/a"; +import * as mjsi from "inner/b"; +import * as typei from "inner"; +import * as ts from "inner/types"; cjsi.mjsSource; mjsi.mjsSource; typei.mjsSource; ts.mjsSource; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // cjs format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); +const cjs = __importStar(require("package/cjs")); +const mjs = __importStar(require("package/mjs")); +const type = __importStar(require("package")); cjs; mjs; type; -const cjsi = require("inner/a"); -const mjsi = require("inner/b"); -const typei = require("inner"); -const ts = require("inner/types"); +const cjsi = __importStar(require("inner/a")); +const mjsi = __importStar(require("inner/b")); +const typei = __importStar(require("inner")); +const ts = __importStar(require("inner/types")); cjsi.cjsSource; mjsi.cjsSource; typei.implicitCjsSource; ts.cjsSource; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/a"; +import * as mjsi from "inner/b"; +import * as typei from "inner"; +import * as ts from "inner/types"; +cjsi.mjsSource; +mjsi.mjsSource; +typei.mjsSource; +ts.mjsSource; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).js.diff deleted file mode 100644 index 86fc03121d..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).js.diff +++ /dev/null @@ -1,135 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=node20).js -+++ new.nodeModulesConditionalPackageExports(module=node20).js -@@= skipped -122, +122 lines =@@ - } - - -+//// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+// esm format file -+const cjs = require("package/cjs"); -+const mjs = require("package/mjs"); -+const type = require("package"); -+cjs; -+mjs; -+type; -+const cjsi = require("inner/a"); -+const mjsi = require("inner/b"); -+const typei = require("inner"); -+const ts = require("inner/types"); -+cjsi.mjsSource; -+mjsi.mjsSource; -+typei.mjsSource; -+ts.mjsSource; - //// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; -+const cjs = require("package/cjs"); -+const mjs = require("package/mjs"); -+const type = require("package"); - cjs; - mjs; - type; --import * as cjsi from "inner/a"; --import * as mjsi from "inner/b"; --import * as typei from "inner"; --import * as ts from "inner/types"; -+const cjsi = require("inner/a"); -+const mjsi = require("inner/b"); -+const typei = require("inner"); -+const ts = require("inner/types"); - cjsi.mjsSource; - mjsi.mjsSource; - typei.mjsSource; - ts.mjsSource; - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - // cjs format file --const cjs = __importStar(require("package/cjs")); --const mjs = __importStar(require("package/mjs")); --const type = __importStar(require("package")); -+const cjs = require("package/cjs"); -+const mjs = require("package/mjs"); -+const type = require("package"); - cjs; - mjs; - type; --const cjsi = __importStar(require("inner/a")); --const mjsi = __importStar(require("inner/b")); --const typei = __importStar(require("inner")); --const ts = __importStar(require("inner/types")); -+const cjsi = require("inner/a"); -+const mjsi = require("inner/b"); -+const typei = require("inner"); -+const ts = require("inner/types"); - cjsi.cjsSource; - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/a"; --import * as mjsi from "inner/b"; --import * as typei from "inner"; --import * as ts from "inner/types"; --cjsi.mjsSource; --mjsi.mjsSource; --typei.mjsSource; --ts.mjsSource; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).symbols index 193a06aa9c..fed90e232d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).symbols @@ -33,16 +33,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.ts, 10, 6)) cjsi.mjsSource; +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.ts, 7, 6)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.ts, 8, 6)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.ts, 9, 6)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.ts, 10, 6)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.mts === // esm format file @@ -77,22 +85,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.mts, 10, 6)) cjsi.mjsSource; +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.mts, 7, 6)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.mts, 8, 6)) ->mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.mts, 9, 6)) ->mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.mts, 10, 6)) ->mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.cts === // cjs format file @@ -127,105 +137,115 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.cts, 10, 6)) cjsi.cjsSource; ->cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.cts, 7, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) mjsi.cjsSource; +>mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.cts, 8, 6)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) typei.implicitCjsSource; +>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) >typei : Symbol(typei, Decl(index.cts, 9, 6)) +>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) ts.cjsSource; ->ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >ts : Symbol(ts, Decl(index.cts, 10, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.ts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.ts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.ts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 5, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.ts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 6, 8)) export { type }; ->type : Symbol(type, Decl(index.d.ts, 7, 8)) +>type : Symbol(type, Decl(test.d.ts, 7, 8)) export { ts }; ->ts : Symbol(ts, Decl(index.d.ts, 8, 8)) - -export const implicitCjsSource = true; ->implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.ts, 8, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.mts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.mts, 4, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 5, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 6, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 7, 8)) +>type : Symbol(type, Decl(test.d.mts, 7, 8)) export { ts }; ->ts : Symbol(mjs.ts, Decl(index.d.mts, 8, 8)) - -export const mjsSource = true; ->mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.mts, 8, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.cts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.cts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 7, 8)) +>type : Symbol(type, Decl(test.d.cts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - -export const cjsSource = true; ->cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.cts, 8, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).symbols.diff deleted file mode 100644 index 3cd5f6d53d..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).symbols.diff +++ /dev/null @@ -1,113 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=node20).symbols -+++ new.nodeModulesConditionalPackageExports(module=node20).symbols -@@= skipped -32, +32 lines =@@ - >ts : Symbol(ts, Decl(index.ts, 10, 6)) - - cjsi.mjsSource; -->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - >cjsi : Symbol(cjsi, Decl(index.ts, 7, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - - mjsi.mjsSource; -->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - >mjsi : Symbol(mjsi, Decl(index.ts, 8, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - - typei.mjsSource; -->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - >typei : Symbol(typei, Decl(index.ts, 9, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - - ts.mjsSource; -->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - >ts : Symbol(ts, Decl(index.ts, 10, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - - === index.mts === - // esm format file -@@= skipped -52, +44 lines =@@ - >ts : Symbol(ts, Decl(index.mts, 10, 6)) - - cjsi.mjsSource; -->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - >cjsi : Symbol(cjsi, Decl(index.mts, 7, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) - - mjsi.mjsSource; -->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsi.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) - >mjsi : Symbol(mjsi, Decl(index.mts, 8, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) - - typei.mjsSource; -->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) -+>typei.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) - >typei : Symbol(typei, Decl(index.mts, 9, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) - - ts.mjsSource; -->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) -+>ts.mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) - >ts : Symbol(ts, Decl(index.mts, 10, 6)) -->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsi.mjsSource, Decl(index.d.mts, 9, 12)) - - === index.cts === - // cjs format file -@@= skipped -57, +55 lines =@@ - >cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) - - mjsi.cjsSource; -->mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) - >mjsi : Symbol(mjsi, Decl(index.cts, 8, 6)) -->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) - - typei.implicitCjsSource; -->typei.implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) - >typei : Symbol(typei, Decl(index.cts, 9, 6)) -->implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) - - ts.cjsSource; - >ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) -@@= skipped -29, +25 lines =@@ - >ts : Symbol(ts, Decl(index.d.ts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.type.cjs, Decl(index.d.ts, 5, 8)) -+>cjs : Symbol(cjs, Decl(index.d.ts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.type.mjs, Decl(index.d.ts, 6, 8)) -+>mjs : Symbol(mjs, Decl(index.d.ts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type.type, Decl(index.d.ts, 7, 8)) -+>type : Symbol(type, Decl(index.d.ts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.type.ts, Decl(index.d.ts, 8, 8)) -+>ts : Symbol(ts, Decl(index.d.ts, 8, 8)) - - export const implicitCjsSource = true; -->implicitCjsSource : Symbol(mjs.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -41, +41 lines =@@ - >ts : Symbol(mjs.ts, Decl(index.d.mts, 8, 8)) - - export const mjsSource = true; -->mjsSource : Symbol(mjs.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -29, +29 lines =@@ - >ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - - export const cjsSource = true; -->cjsSource : Symbol(cjs.cjsSource, Decl(index.d.cts, 9, 12)) -+>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).types index 174f42a653..2cc0823cd4 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).types @@ -3,135 +3,135 @@ === index.ts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi import * as mjsi from "inner/b"; ->mjsi : any +>mjsi : typeof cjsi import * as typei from "inner"; ->typei : any +>typei : typeof cjsi import * as ts from "inner/types"; >ts : typeof cjsi cjsi.mjsSource; ->cjsi.mjsSource : any +>cjsi.mjsSource : true >cjsi : typeof cjsi ->mjsSource : any +>mjsSource : true mjsi.mjsSource; ->mjsi.mjsSource : any ->mjsi : any ->mjsSource : any +>mjsi.mjsSource : true +>mjsi : typeof cjsi +>mjsSource : true typei.mjsSource; ->typei.mjsSource : any ->typei : any ->mjsSource : any +>typei.mjsSource : true +>typei : typeof cjsi +>mjsSource : true ts.mjsSource; ->ts.mjsSource : any +>ts.mjsSource : true >ts : typeof cjsi ->mjsSource : any +>mjsSource : true === index.mts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; ->cjsi : any +>cjsi : typeof cjsi import * as mjsi from "inner/b"; ->mjsi : typeof mjsi +>mjsi : typeof cjsi import * as typei from "inner"; ->typei : typeof mjsi +>typei : typeof cjsi import * as ts from "inner/types"; ->ts : typeof mjsi +>ts : typeof cjsi cjsi.mjsSource; ->cjsi.mjsSource : any ->cjsi : any ->mjsSource : any +>cjsi.mjsSource : true +>cjsi : typeof cjsi +>mjsSource : true mjsi.mjsSource; >mjsi.mjsSource : true ->mjsi : typeof mjsi +>mjsi : typeof cjsi >mjsSource : true typei.mjsSource; >typei.mjsSource : true ->typei : typeof mjsi +>typei : typeof cjsi >mjsSource : true ts.mjsSource; >ts.mjsSource : true ->ts : typeof mjsi +>ts : typeof cjsi >mjsSource : true === index.cts === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi import * as mjsi from "inner/b"; ->mjsi : any +>mjsi : typeof cjsi import * as typei from "inner"; ->typei : any +>typei : typeof typei import * as ts from "inner/types"; >ts : typeof cjsi @@ -142,14 +142,14 @@ cjsi.cjsSource; >cjsSource : true mjsi.cjsSource; ->mjsi.cjsSource : any ->mjsi : any ->cjsSource : any +>mjsi.cjsSource : true +>mjsi : typeof cjsi +>cjsSource : true typei.implicitCjsSource; ->typei.implicitCjsSource : any ->typei : any ->implicitCjsSource : any +>typei.implicitCjsSource : true +>typei : typeof typei +>implicitCjsSource : true ts.cjsSource; >ts.cjsSource : true @@ -158,14 +158,20 @@ ts.cjsSource; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs import * as mjs from "inner/b"; ->mjs : any +>mjs : typeof cjs import * as type from "inner"; ->type : any +>type : typeof type import * as ts from "inner/types"; >ts : typeof cjs @@ -174,58 +180,62 @@ export { cjs }; >cjs : typeof cjs export { mjs }; ->mjs : any +>mjs : typeof cjs export { type }; ->type : any +>type : typeof type export { ts }; >ts : typeof cjs -export const implicitCjsSource = true; ->implicitCjsSource : true +=== node_modules/inner/index.d.mts === +// esm format file +export const mjsSource = true; +>mjsSource : true >true : true -=== node_modules/inner/index.d.mts === +=== node_modules/inner/test.d.mts === // esm format file import * as cjs from "inner/a"; ->cjs : any +>cjs : typeof cjs import * as mjs from "inner/b"; ->mjs : typeof mjs +>mjs : typeof cjs import * as type from "inner"; ->type : typeof mjs +>type : typeof cjs import * as ts from "inner/types"; ->ts : typeof mjs +>ts : typeof cjs export { cjs }; ->cjs : any +>cjs : typeof cjs export { mjs }; ->mjs : typeof mjs +>mjs : typeof cjs export { type }; ->type : typeof mjs +>type : typeof cjs export { ts }; ->ts : typeof mjs +>ts : typeof cjs -export const mjsSource = true; ->mjsSource : true +=== node_modules/inner/index.d.cts === +// cjs format file +export const cjsSource = true; +>cjsSource : true >true : true -=== node_modules/inner/index.d.cts === +=== node_modules/inner/test.d.cts === // cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs import * as mjs from "inner/b"; ->mjs : any +>mjs : typeof cjs import * as type from "inner"; ->type : any +>type : typeof type import * as ts from "inner/types"; >ts : typeof cjs @@ -234,15 +244,11 @@ export { cjs }; >cjs : typeof cjs export { mjs }; ->mjs : any +>mjs : typeof cjs export { type }; ->type : any +>type : typeof type export { ts }; >ts : typeof cjs -export const cjsSource = true; ->cjsSource : true ->true : true - diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).types.diff deleted file mode 100644 index 87fe4ad1ae..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=node20).types.diff +++ /dev/null @@ -1,264 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=node20).types -+++ new.nodeModulesConditionalPackageExports(module=node20).types -@@= skipped -2, +2 lines =@@ - === index.ts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/b"; -->mjsi : typeof cjsi -+>mjsi : any - - import * as typei from "inner"; -->typei : typeof cjsi -+>typei : any - - import * as ts from "inner/types"; - >ts : typeof cjsi - - cjsi.mjsSource; -->cjsi.mjsSource : true -+>cjsi.mjsSource : any - >cjsi : typeof cjsi -->mjsSource : true -+>mjsSource : any - - mjsi.mjsSource; -->mjsi.mjsSource : true -->mjsi : typeof cjsi -->mjsSource : true -+>mjsi.mjsSource : any -+>mjsi : any -+>mjsSource : any - - typei.mjsSource; -->typei.mjsSource : true -->typei : typeof cjsi -->mjsSource : true -+>typei.mjsSource : any -+>typei : any -+>mjsSource : any - - ts.mjsSource; -->ts.mjsSource : true -+>ts.mjsSource : any - >ts : typeof cjsi -->mjsSource : true -+>mjsSource : any - - === index.mts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; -->cjsi : typeof cjsi -+>cjsi : any - - import * as mjsi from "inner/b"; -->mjsi : typeof cjsi -+>mjsi : typeof mjsi - - import * as typei from "inner"; -->typei : typeof cjsi -+>typei : typeof mjsi - - import * as ts from "inner/types"; -->ts : typeof cjsi -+>ts : typeof mjsi - - cjsi.mjsSource; -->cjsi.mjsSource : true -->cjsi : typeof cjsi -->mjsSource : true -+>cjsi.mjsSource : any -+>cjsi : any -+>mjsSource : any - - mjsi.mjsSource; - >mjsi.mjsSource : true -->mjsi : typeof cjsi -+>mjsi : typeof mjsi - >mjsSource : true - - typei.mjsSource; - >typei.mjsSource : true -->typei : typeof cjsi -+>typei : typeof mjsi - >mjsSource : true - - ts.mjsSource; - >ts.mjsSource : true -->ts : typeof cjsi -+>ts : typeof mjsi - >mjsSource : true - - === index.cts === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/b"; -->mjsi : typeof cjsi -+>mjsi : any - - import * as typei from "inner"; -->typei : typeof cjsi.type -+>typei : any - - import * as ts from "inner/types"; - >ts : typeof cjsi -@@= skipped -139, +139 lines =@@ - >cjsSource : true - - mjsi.cjsSource; -->mjsi.cjsSource : true -->mjsi : typeof cjsi -->cjsSource : true -+>mjsi.cjsSource : any -+>mjsi : any -+>cjsSource : any - - typei.implicitCjsSource; -->typei.implicitCjsSource : true -->typei : typeof cjsi.type -->implicitCjsSource : true -+>typei.implicitCjsSource : any -+>typei : any -+>implicitCjsSource : any - - ts.cjsSource; - >ts.cjsSource : true -@@= skipped -17, +17 lines =@@ - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "inner"; -->type : typeof mjs.type -+>type : any - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : any - - export { type }; -->type : typeof mjs.type -+>type : any - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const implicitCjsSource = true; - >implicitCjsSource : true -@@= skipped -63, +63 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof cjs -+>mjs : any - - import * as type from "inner"; -->type : typeof cjs.type -+>type : any - - import * as ts from "inner/types"; - >ts : typeof cjs -@@= skipped -12, +12 lines =@@ - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs -+>mjs : any - - export { type }; -->type : typeof cjs.type -+>type : any - - export { ts }; - >ts : typeof cjs \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).errors.txt deleted file mode 100644 index 35c27166e7..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).errors.txt +++ /dev/null @@ -1,153 +0,0 @@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.ts (3 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/a"; - import * as mjsi from "inner/b"; - import * as typei from "inner"; - import * as ts from "inner/types"; - cjsi.mjsSource; - mjsi.mjsSource; - typei.mjsSource; - ts.mjsSource; -==== index.mts (3 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/a"; - import * as mjsi from "inner/b"; - import * as typei from "inner"; - import * as ts from "inner/types"; - cjsi.mjsSource; - mjsi.mjsSource; - typei.mjsSource; - ts.mjsSource; -==== index.cts (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/a"; - import * as mjsi from "inner/b"; - import * as typei from "inner"; - import * as ts from "inner/types"; - cjsi.cjsSource; - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; -==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/a"; - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; - export { type }; - export { ts }; - export const implicitCjsSource = true; -==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/a"; - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; - export { type }; - export { ts }; - export const mjsSource = true; -==== node_modules/inner/index.d.cts (0 errors) ==== - // cjs format file - import * as cjs from "inner/a"; - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; - export { type }; - export { ts }; - export const cjsSource = true; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module", - "exports": { - "./cjs": "./index.cjs", - "./mjs": "./index.mjs", - ".": "./index.js" - } - } -==== node_modules/inner/package.json (0 errors) ==== - { - "name": "inner", - "private": true, - "exports": { - "./a": { - "require": "./index.cjs", - "node": "./index.mjs" - }, - "./b": { - "import": "./index.mjs", - "node": "./index.cjs" - }, - ".": { - "import": "./index.mjs", - "node": "./index.js" - }, - "./types": { - "types": { - "import": "./index.d.mts", - "require": "./index.d.cts" - }, - "node": { - "import": "./index.mjs", - "require": "./index.cjs" - } - } - } - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).errors.txt.diff deleted file mode 100644 index e5d6ca3d03..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,135 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=nodenext).errors.txt -+++ new.nodeModulesConditionalPackageExports(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --node_modules/inner/index.d.mts(2,13): error TS2303: Circular definition of import alias 'cjs'. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -+index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.ts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.mts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.cts (0 errors) ==== -+==== index.ts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.mts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.cts (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -51, +76 lines =@@ - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; -@@= skipped -13, +11 lines =@@ - export { type }; - export { ts }; - export const implicitCjsSource = true; --==== node_modules/inner/index.d.mts (1 errors) ==== -+==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).js b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).js index 87d5cda21c..7653fb782c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).js @@ -50,6 +50,9 @@ typei.implicitCjsSource; ts.cjsSource; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -57,10 +60,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const implicitCjsSource = true; +export { ts }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -68,10 +73,12 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const mjsSource = true; +export { ts }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/a"; import * as mjs from "inner/b"; import * as type from "inner"; @@ -79,8 +86,7 @@ import * as ts from "inner/types"; export { cjs }; export { mjs }; export { type }; -export { ts }; -export const cjsSource = true; +export { ts }; //// [package.json] { "name": "package", @@ -123,22 +129,6 @@ export const cjsSource = true; } -//// [index.js] -// esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; -cjs; -mjs; -type; -import * as cjsi from "inner/a"; -import * as mjsi from "inner/b"; -import * as typei from "inner"; -import * as ts from "inner/types"; -cjsi.mjsSource; -mjsi.mjsSource; -typei.mjsSource; -ts.mjsSource; //// [index.mjs] // esm format file import * as cjs from "package/cjs"; @@ -206,11 +196,27 @@ cjsi.cjsSource; mjsi.cjsSource; typei.implicitCjsSource; ts.cjsSource; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/a"; +import * as mjsi from "inner/b"; +import * as typei from "inner"; +import * as ts from "inner/types"; +cjsi.mjsSource; +mjsi.mjsSource; +typei.mjsSource; +ts.mjsSource; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).js.diff deleted file mode 100644 index f1050b1157..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).js.diff +++ /dev/null @@ -1,57 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=nodenext).js -+++ new.nodeModulesConditionalPackageExports(module=nodenext).js -@@= skipped -122, +122 lines =@@ - } - - -+//// [index.js] -+// esm format file -+import * as cjs from "package/cjs"; -+import * as mjs from "package/mjs"; -+import * as type from "package"; -+cjs; -+mjs; -+type; -+import * as cjsi from "inner/a"; -+import * as mjsi from "inner/b"; -+import * as typei from "inner"; -+import * as ts from "inner/types"; -+cjsi.mjsSource; -+mjsi.mjsSource; -+typei.mjsSource; -+ts.mjsSource; - //// [index.mjs] - // esm format file - import * as cjs from "package/cjs"; -@@= skipped -67, +83 lines =@@ - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/a"; --import * as mjsi from "inner/b"; --import * as typei from "inner"; --import * as ts from "inner/types"; --cjsi.mjsSource; --mjsi.mjsSource; --typei.mjsSource; --ts.mjsSource; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).symbols index e574ed5f77..fed90e232d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).symbols @@ -33,24 +33,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.ts, 10, 6)) cjsi.mjsSource; ->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.ts, 7, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.ts, 8, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.ts, 9, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.ts, 10, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.mts === // esm format file @@ -85,24 +85,24 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.mts, 10, 6)) cjsi.mjsSource; ->cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>cjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.mts, 7, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) mjsi.mjsSource; ->mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsi.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.mts, 8, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) typei.mjsSource; ->typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>typei.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >typei : Symbol(typei, Decl(index.mts, 9, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) ts.mjsSource; ->ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>ts.mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) >ts : Symbol(ts, Decl(index.mts, 10, 6)) ->mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 9, 12)) +>mjsSource : Symbol(cjsi.mjsSource, Decl(index.d.mts, 1, 12)) === index.cts === // cjs format file @@ -137,109 +137,115 @@ import * as ts from "inner/types"; >ts : Symbol(ts, Decl(index.cts, 10, 6)) cjsi.cjsSource; ->cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >cjsi : Symbol(cjsi, Decl(index.cts, 7, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) mjsi.cjsSource; ->mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>mjsi.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >mjsi : Symbol(mjsi, Decl(index.cts, 8, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) typei.implicitCjsSource; ->typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) +>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) >typei : Symbol(typei, Decl(index.cts, 9, 6)) ->implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) +>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 1, 12)) ts.cjsSource; ->ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) >ts : Symbol(ts, Decl(index.cts, 10, 6)) ->cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) +>cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 1, 12)) === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.ts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.ts, 4, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 5, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 6, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 7, 8)) +>type : Symbol(type, Decl(test.d.ts, 7, 8)) export { ts }; ->ts : Symbol(type.ts, Decl(index.d.ts, 8, 8)) - -export const implicitCjsSource = true; ->implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.ts, 8, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.mts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.mts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.mts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.mts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.mts, 7, 8)) +>type : Symbol(type, Decl(test.d.mts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.mts, 8, 8)) - -export const mjsSource = true; ->mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.mts, 8, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/a"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/b"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) import * as ts from "inner/types"; ->ts : Symbol(ts, Decl(index.d.cts, 4, 6)) +>ts : Symbol(ts, Decl(test.d.cts, 4, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 5, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 5, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 6, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 6, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 7, 8)) +>type : Symbol(type, Decl(test.d.cts, 7, 8)) export { ts }; ->ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - -export const cjsSource = true; ->cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) +>ts : Symbol(ts, Decl(test.d.cts, 8, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).symbols.diff deleted file mode 100644 index cd9c20a184..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).symbols.diff +++ /dev/null @@ -1,70 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=nodenext).symbols -+++ new.nodeModulesConditionalPackageExports(module=nodenext).symbols -@@= skipped -146, +146 lines =@@ - >cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) - - typei.implicitCjsSource; -->typei.implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>typei.implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) - >typei : Symbol(typei, Decl(index.cts, 9, 6)) -->implicitCjsSource : Symbol(cjsi.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(typei.implicitCjsSource, Decl(index.d.ts, 9, 12)) - - ts.cjsSource; - >ts.cjsSource : Symbol(cjsi.cjsSource, Decl(index.d.cts, 9, 12)) -@@= skipped -24, +24 lines =@@ - >ts : Symbol(ts, Decl(index.d.ts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.type.cjs, Decl(index.d.ts, 5, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.type.mjs, Decl(index.d.ts, 6, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type.type, Decl(index.d.ts, 7, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.type.ts, Decl(index.d.ts, 8, 8)) -+>ts : Symbol(type.ts, Decl(index.d.ts, 8, 8)) - - export const implicitCjsSource = true; -->implicitCjsSource : Symbol(mjs.type.implicitCjsSource, Decl(index.d.ts, 9, 12)) -+>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 9, 12)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -29, +29 lines =@@ - >ts : Symbol(ts, Decl(index.d.mts, 4, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 5, 8)) -+>cjs : Symbol(cjs.cjs, Decl(index.d.mts, 5, 8)) - - export { mjs }; -->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 6, 8)) -+>mjs : Symbol(cjs.mjs, Decl(index.d.mts, 6, 8)) - - export { type }; -->type : Symbol(mjs.type, Decl(index.d.mts, 7, 8)) -+>type : Symbol(cjs.type, Decl(index.d.mts, 7, 8)) - - export { ts }; -->ts : Symbol(mjs.ts, Decl(index.d.mts, 8, 8)) -+>ts : Symbol(cjs.ts, Decl(index.d.mts, 8, 8)) - - export const mjsSource = true; -->mjsSource : Symbol(mjs.mjsSource, Decl(index.d.mts, 9, 12)) -+>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 9, 12)) - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -41, +41 lines =@@ - >ts : Symbol(cjs.ts, Decl(index.d.cts, 8, 8)) - - export const cjsSource = true; -->cjsSource : Symbol(cjs.cjsSource, Decl(index.d.cts, 9, 12)) -+>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 9, 12)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).types index 548c7f4fc2..2cc0823cd4 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).types @@ -3,22 +3,22 @@ === index.ts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -55,22 +55,22 @@ ts.mjsSource; === index.mts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -107,22 +107,22 @@ ts.mjsSource; === index.cts === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/a"; >cjsi : typeof cjsi @@ -158,6 +158,12 @@ ts.cjsSource; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -182,11 +188,13 @@ export { type }; export { ts }; >ts : typeof cjs -export const implicitCjsSource = true; ->implicitCjsSource : true +=== node_modules/inner/index.d.mts === +// esm format file +export const mjsSource = true; +>mjsSource : true >true : true -=== node_modules/inner/index.d.mts === +=== node_modules/inner/test.d.mts === // esm format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -212,11 +220,13 @@ export { type }; export { ts }; >ts : typeof cjs -export const mjsSource = true; ->mjsSource : true +=== node_modules/inner/index.d.cts === +// cjs format file +export const cjsSource = true; +>cjsSource : true >true : true -=== node_modules/inner/index.d.cts === +=== node_modules/inner/test.d.cts === // cjs format file import * as cjs from "inner/a"; >cjs : typeof cjs @@ -242,7 +252,3 @@ export { type }; export { ts }; >ts : typeof cjs -export const cjsSource = true; ->cjsSource : true ->true : true - diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).types.diff deleted file mode 100644 index 0fc79c354b..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesConditionalPackageExports(module=nodenext).types.diff +++ /dev/null @@ -1,199 +0,0 @@ ---- old.nodeModulesConditionalPackageExports(module=nodenext).types -+++ new.nodeModulesConditionalPackageExports(module=nodenext).types -@@= skipped -2, +2 lines =@@ - === index.ts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -52, +52 lines =@@ - === index.mts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -52, +52 lines =@@ - === index.cts === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -24, +24 lines =@@ - >mjsi : typeof cjsi - - import * as typei from "inner"; -->typei : typeof cjsi.type -+>typei : typeof typei - - import * as ts from "inner/types"; - >ts : typeof cjsi -@@= skipped -17, +17 lines =@@ - - typei.implicitCjsSource; - >typei.implicitCjsSource : true -->typei : typeof cjsi.type -+>typei : typeof typei - >implicitCjsSource : true - - ts.cjsSource; -@@= skipped -11, +11 lines =@@ - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : typeof cjs - - import * as type from "inner"; -->type : typeof mjs.type -+>type : typeof type - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : typeof cjs - - export { type }; -->type : typeof mjs.type -+>type : typeof type - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const implicitCjsSource = true; - >implicitCjsSource : true -@@= skipped -30, +30 lines =@@ - === node_modules/inner/index.d.mts === - // esm format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : typeof cjs - - import * as type from "inner"; -->type : typeof mjs -+>type : typeof cjs - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : typeof cjs - - export { type }; -->type : typeof mjs -+>type : typeof cjs - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const mjsSource = true; - >mjsSource : true -@@= skipped -36, +36 lines =@@ - >mjs : typeof cjs - - import * as type from "inner"; -->type : typeof cjs.type -+>type : typeof type - - import * as ts from "inner/types"; - >ts : typeof cjs -@@= skipped -12, +12 lines =@@ - >mjs : typeof cjs - - export { type }; -->type : typeof cjs.type -+>type : typeof type - - export { ts }; - >ts : typeof cjs \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).errors.txt deleted file mode 100644 index a76044882d..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).errors.txt +++ /dev/null @@ -1,165 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2468: Cannot find global value 'Promise'. -other.cts(2,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.cts(3,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.cts(4,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.cts(5,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.mts(2,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -other.mts(2,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.mts(3,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -other.mts(3,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.mts(4,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -other.mts(4,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.mts(5,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -other.mts(5,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.ts(2,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -other.ts(2,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.ts(3,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -other.ts(3,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.ts(4,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -other.ts(4,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other.ts(5,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -other.ts(5,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other2.cts(2,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other2.cts(3,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other2.mts(2,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -other2.mts(2,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other2.mts(3,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -other2.mts(3,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other2.ts(2,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -other2.ts(2,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -other2.ts(3,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -other2.ts(3,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2468: Cannot find global value 'Promise'. -==== index.ts (0 errors) ==== - // esm format file - export {}; -==== index.mts (0 errors) ==== - // esm format file - export {}; -==== index.cts (0 errors) ==== - // cjs format file - export {}; -==== other.ts (8 errors) ==== - // esm format file - export const a = await import("package/cjs"); - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - export const b = await import("package/mjs"); - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - export const c = await import("package"); - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - export const f = await import("inner"); - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -==== other2.ts (4 errors) ==== - // esm format file - export const d = await import("inner/cjs"); - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - export const e = await import("inner/mjs"); - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -==== other.mts (8 errors) ==== - // esm format file - export const a = await import("package/cjs"); - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - export const b = await import("package/mjs"); - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - export const c = await import("package"); - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - export const f = await import("inner"); - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -==== other2.mts (4 errors) ==== - // esm format file - export const d = await import("inner/cjs"); - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - export const e = await import("inner/mjs"); - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -==== other.cts (4 errors) ==== - // cjs format file, no TLA - export const a = import("package/cjs"); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - export const b = import("package/mjs"); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - export const c = import("package"); - ~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - export const f = import("inner"); - ~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -==== other2.cts (2 errors) ==== - // cjs format file, no TLA - export const d = import("inner/cjs"); - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - export const e = import("inner/mjs"); - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - export const cjsMain = true; -==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - export const esm = true; -==== node_modules/inner/index.d.cts (0 errors) ==== - // cjs format file - export const cjsNonmain = true; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module", - "exports": { - "./cjs": "./index.cjs", - "./mjs": "./index.mjs", - ".": "./index.js" - } - } -==== node_modules/inner/package.json (0 errors) ==== - { - "name": "inner", - "private": true, - "exports": { - "./cjs": "./index.cjs", - "./mjs": "./index.mjs", - ".": "./index.js" - } - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).errors.txt.diff deleted file mode 100644 index 1162237fc7..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).errors.txt.diff +++ /dev/null @@ -1,169 +0,0 @@ ---- old.nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).errors.txt -+++ new.nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+error TS2468: Cannot find global value 'Promise'. -+other.cts(2,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other.cts(3,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other.cts(4,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other.cts(5,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other.mts(2,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+other.mts(2,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other.mts(3,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+other.mts(3,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other.mts(4,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+other.mts(4,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other.mts(5,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+other.mts(5,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other.ts(2,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+other.ts(2,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other.ts(3,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+other.ts(3,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other.ts(4,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+other.ts(4,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other.ts(5,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+other.ts(5,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other2.cts(2,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other2.cts(3,18): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other2.mts(2,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+other2.mts(2,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other2.mts(3,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+other2.mts(3,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other2.ts(2,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+other2.ts(2,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+other2.ts(3,18): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+other2.ts(3,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+!!! error TS2468: Cannot find global value 'Promise'. -+==== index.ts (0 errors) ==== -+ // esm format file -+ export {}; -+==== index.mts (0 errors) ==== -+ // esm format file -+ export {}; -+==== index.cts (0 errors) ==== -+ // cjs format file -+ export {}; -+==== other.ts (8 errors) ==== -+ // esm format file -+ export const a = await import("package/cjs"); -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ export const b = await import("package/mjs"); -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ export const c = await import("package"); -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ export const f = await import("inner"); -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+==== other2.ts (4 errors) ==== -+ // esm format file -+ export const d = await import("inner/cjs"); -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ export const e = await import("inner/mjs"); -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+==== other.mts (8 errors) ==== -+ // esm format file -+ export const a = await import("package/cjs"); -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ export const b = await import("package/mjs"); -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ export const c = await import("package"); -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ export const f = await import("inner"); -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+==== other2.mts (4 errors) ==== -+ // esm format file -+ export const d = await import("inner/cjs"); -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ export const e = await import("inner/mjs"); -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+==== other.cts (4 errors) ==== -+ // cjs format file, no TLA -+ export const a = import("package/cjs"); -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ export const b = import("package/mjs"); -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ export const c = import("package"); -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ export const f = import("inner"); -+ ~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+==== other2.cts (2 errors) ==== -+ // cjs format file, no TLA -+ export const d = import("inner/cjs"); -+ ~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ export const e = import("inner/mjs"); -+ ~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+==== node_modules/inner/index.d.ts (0 errors) ==== -+ // cjs format file -+ export const cjsMain = true; -+==== node_modules/inner/index.d.mts (0 errors) ==== -+ // esm format file -+ export const esm = true; -+==== node_modules/inner/index.d.cts (0 errors) ==== -+ // cjs format file -+ export const cjsNonmain = true; -+==== package.json (0 errors) ==== -+ { -+ "name": "package", -+ "private": true, -+ "type": "module", -+ "exports": { -+ "./cjs": "./index.cjs", -+ "./mjs": "./index.mjs", -+ ".": "./index.js" -+ } -+ } -+==== node_modules/inner/package.json (0 errors) ==== -+ { -+ "name": "inner", -+ "private": true, -+ "exports": { -+ "./cjs": "./index.cjs", -+ "./mjs": "./index.mjs", -+ ".": "./index.js" -+ } -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).js index 247ae90c0c..2f6a5a512f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).js @@ -71,46 +71,32 @@ export const cjsNonmain = true; } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //// [index.cjs] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); //// [other.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.f = exports.c = exports.b = exports.a = void 0; // esm format file -exports.a = await import("package/cjs"); -exports.b = await import("package/mjs"); -exports.c = await import("package"); -exports.f = await import("inner"); +export const a = await import("package/cjs"); +export const b = await import("package/mjs"); +export const c = await import("package"); +export const f = await import("inner"); //// [other2.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.e = exports.d = void 0; // esm format file -exports.d = await import("inner/cjs"); -exports.e = await import("inner/mjs"); +export const d = await import("inner/cjs"); +export const e = await import("inner/mjs"); //// [other.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.f = exports.c = exports.b = exports.a = void 0; // esm format file -exports.a = await import("package/cjs"); -exports.b = await import("package/mjs"); -exports.c = await import("package"); -exports.f = await import("inner"); +export const a = await import("package/cjs"); +export const b = await import("package/mjs"); +export const c = await import("package"); +export const f = await import("inner"); //// [other2.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.e = exports.d = void 0; // esm format file -exports.d = await import("inner/cjs"); -exports.e = await import("inner/mjs"); +export const d = await import("inner/cjs"); +export const e = await import("inner/mjs"); //// [other.cjs] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -137,12 +123,10 @@ export {}; export {}; //// [other.d.ts] export declare const a: { - default: typeof import("./index.cts"); -}; -export declare const b: typeof import("./index.mts"); -export declare const c: { - default: typeof import("."); + default: typeof import("package/cjs"); }; +export declare const b: typeof import("package/mjs"); +export declare const c: typeof import("package"); export declare const f: { cjsMain: true; default: typeof import("inner"); @@ -158,9 +142,7 @@ export declare const a: { default: typeof import("package/cjs"); }; export declare const b: typeof import("package/mjs"); -export declare const c: { - default: typeof import("package"); -}; +export declare const c: typeof import("package"); export declare const f: { cjsMain: true; default: typeof import("inner"); @@ -175,10 +157,8 @@ export declare const e: typeof import("inner/mjs"); export declare const a: Promise<{ default: typeof import("./index.cts"); }>; -export declare const b: Promise; -export declare const c: Promise<{ - default: typeof import("."); -}>; +export declare const b: Promise; +export declare const c: Promise; export declare const f: Promise<{ cjsMain: true; default: typeof import("inner"); @@ -188,4 +168,4 @@ export declare const d: Promise<{ cjsNonmain: true; default: typeof import("inner/cjs"); }>; -export declare const e: Promise; +export declare const e: Promise; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).js.diff index d1b723343b..35b8550621 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).js.diff @@ -1,114 +1,11 @@ --- old.nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).js +++ new.nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).js -@@= skipped -70, +70 lines =@@ - } - - //// [index.js] --export {}; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - //// [index.mjs] --export {}; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - //// [index.cjs] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - //// [other.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.f = exports.c = exports.b = exports.a = void 0; - // esm format file --export const a = await import("package/cjs"); --export const b = await import("package/mjs"); --export const c = await import("package"); --export const f = await import("inner"); -+exports.a = await import("package/cjs"); -+exports.b = await import("package/mjs"); -+exports.c = await import("package"); -+exports.f = await import("inner"); - //// [other2.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.e = exports.d = void 0; - // esm format file --export const d = await import("inner/cjs"); --export const e = await import("inner/mjs"); -+exports.d = await import("inner/cjs"); -+exports.e = await import("inner/mjs"); - //// [other.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.f = exports.c = exports.b = exports.a = void 0; - // esm format file --export const a = await import("package/cjs"); --export const b = await import("package/mjs"); --export const c = await import("package"); --export const f = await import("inner"); -+exports.a = await import("package/cjs"); -+exports.b = await import("package/mjs"); -+exports.c = await import("package"); -+exports.f = await import("inner"); - //// [other2.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.e = exports.d = void 0; - // esm format file --export const d = await import("inner/cjs"); --export const e = await import("inner/mjs"); -+exports.d = await import("inner/cjs"); -+exports.e = await import("inner/mjs"); - //// [other.cjs] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); -@@= skipped -52, +66 lines =@@ - export {}; - //// [other.d.ts] - export declare const a: { -- default: typeof import("package/cjs"); --}; --export declare const b: typeof import("package/mjs"); --export declare const c: typeof import("package"); -+ default: typeof import("./index.cts"); -+}; -+export declare const b: typeof import("./index.mts"); -+export declare const c: { -+ default: typeof import("."); -+}; - export declare const f: { - cjsMain: true; - default: typeof import("inner"); -@@= skipped -19, +21 lines =@@ - default: typeof import("package/cjs"); - }; - export declare const b: typeof import("package/mjs"); --export declare const c: typeof import("package"); -+export declare const c: { -+ default: typeof import("package"); -+}; - export declare const f: { - cjsMain: true; - default: typeof import("inner"); -@@= skipped -13, +15 lines =@@ +@@= skipped -154, +154 lines =@@ export declare const e: typeof import("inner/mjs"); //// [other.d.cts] export declare const a: Promise<{ - default: typeof import("./index.cjs"); --}>; --export declare const b: Promise; --export declare const c: Promise; + default: typeof import("./index.cts"); -+}>; -+export declare const b: Promise; -+export declare const c: Promise<{ -+ default: typeof import("."); -+}>; - export declare const f: Promise<{ - cjsMain: true; - default: typeof import("inner"); -@@= skipped -13, +15 lines =@@ - cjsNonmain: true; - default: typeof import("inner/cjs"); }>; --export declare const e: Promise; -+export declare const e: Promise; \ No newline at end of file + export declare const b: Promise; + export declare const c: Promise; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).types index fe65a70478..9f4bf477f6 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).types @@ -27,9 +27,9 @@ export const b = await import("package/mjs"); >"package/mjs" : "package/mjs" export const c = await import("package"); ->c : { default: typeof import("index"); } ->await import("package") : { default: typeof import("index"); } ->import("package") : Promise<{ default: typeof import("index"); }> +>c : typeof import("index") +>await import("package") : typeof import("index") +>import("package") : Promise >"package" : "package" export const f = await import("inner"); @@ -67,9 +67,9 @@ export const b = await import("package/mjs"); >"package/mjs" : "package/mjs" export const c = await import("package"); ->c : { default: typeof import("index"); } ->await import("package") : { default: typeof import("index"); } ->import("package") : Promise<{ default: typeof import("index"); }> +>c : typeof import("index") +>await import("package") : typeof import("index") +>import("package") : Promise >"package" : "package" export const f = await import("inner"); @@ -100,13 +100,13 @@ export const a = import("package/cjs"); >"package/cjs" : "package/cjs" export const b = import("package/mjs"); ->b : Promise ->import("package/mjs") : Promise +>b : Promise +>import("package/mjs") : Promise >"package/mjs" : "package/mjs" export const c = import("package"); ->c : Promise<{ default: typeof import("index"); }> ->import("package") : Promise<{ default: typeof import("index"); }> +>c : Promise +>import("package") : Promise >"package" : "package" export const f = import("inner"); @@ -122,8 +122,8 @@ export const d = import("inner/cjs"); >"inner/cjs" : "inner/cjs" export const e = import("inner/mjs"); ->e : Promise ->import("inner/mjs") : Promise +>e : Promise +>import("inner/mjs") : Promise >"inner/mjs" : "inner/mjs" === node_modules/inner/index.d.ts === diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).types.diff deleted file mode 100644 index b6cb0edebd..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).types.diff +++ /dev/null @@ -1,57 +0,0 @@ ---- old.nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).types -+++ new.nodeModulesDeclarationEmitDynamicImportWithPackageExports(module=node20).types -@@= skipped -26, +26 lines =@@ - >"package/mjs" : "package/mjs" - - export const c = await import("package"); -->c : typeof import("index") -->await import("package") : typeof import("index") -->import("package") : Promise -+>c : { default: typeof import("index"); } -+>await import("package") : { default: typeof import("index"); } -+>import("package") : Promise<{ default: typeof import("index"); }> - >"package" : "package" - - export const f = await import("inner"); -@@= skipped -40, +40 lines =@@ - >"package/mjs" : "package/mjs" - - export const c = await import("package"); -->c : typeof import("index") -->await import("package") : typeof import("index") -->import("package") : Promise -+>c : { default: typeof import("index"); } -+>await import("package") : { default: typeof import("index"); } -+>import("package") : Promise<{ default: typeof import("index"); }> - >"package" : "package" - - export const f = await import("inner"); -@@= skipped -33, +33 lines =@@ - >"package/cjs" : "package/cjs" - - export const b = import("package/mjs"); -->b : Promise -->import("package/mjs") : Promise -+>b : Promise -+>import("package/mjs") : Promise - >"package/mjs" : "package/mjs" - - export const c = import("package"); -->c : Promise -->import("package") : Promise -+>c : Promise<{ default: typeof import("index"); }> -+>import("package") : Promise<{ default: typeof import("index"); }> - >"package" : "package" - - export const f = import("inner"); -@@= skipped -22, +22 lines =@@ - >"inner/cjs" : "inner/cjs" - - export const e = import("inner/mjs"); -->e : Promise -->import("inner/mjs") : Promise -+>e : Promise -+>import("inner/mjs") : Promise - >"inner/mjs" : "inner/mjs" - - === node_modules/inner/index.d.ts === \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node20).errors.txt index 42e0135c94..0dbba02dff 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node20).errors.txt @@ -1,4 +1,3 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. @@ -14,7 +13,6 @@ node_modules/inner/index.d.mts(5,1): error TS1036: Statements are not allowed in node_modules/inner/index.d.ts(5,1): error TS1036: Statements are not allowed in ambient contexts. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. ==== index.ts (3 errors) ==== // esm format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node20).errors.txt.diff index 2d3c51a908..7ea35d1c06 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node20).errors.txt.diff @@ -1,7 +1,6 @@ --- old.nodeModulesDeclarationEmitWithPackageExports(module=node20).errors.txt +++ new.nodeModulesDeclarationEmitWithPackageExports(module=node20).errors.txt @@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. +index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. +index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. @@ -17,7 +16,6 @@ node_modules/inner/index.d.ts(5,1): error TS1036: Statements are not allowed in ambient contexts. -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.ts (0 errors) ==== - // esm format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node20).js index 9c18403d16..cec3b8c991 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node20).js @@ -92,53 +92,80 @@ export const cjsNonmain = true; } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.f = exports.e = exports.d = exports.c = exports.b = exports.a = void 0; // esm format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); -exports.a = cjs; -exports.b = mjs; -exports.c = type; -const cjsi = require("inner/cjs"); -const mjsi = require("inner/mjs"); -const typei = require("inner"); -exports.d = cjsi; -exports.e = mjsi; -exports.f = typei; +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +export const a = cjs; +export const b = mjs; +export const c = type; +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; +export const d = cjsi; +export const e = mjsi; +export const f = typei; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.f = exports.e = exports.d = exports.c = exports.b = exports.a = void 0; // esm format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); -exports.a = cjs; -exports.b = mjs; -exports.c = type; -const cjsi = require("inner/cjs"); -const mjsi = require("inner/mjs"); -const typei = require("inner"); -exports.d = cjsi; -exports.e = mjsi; -exports.f = typei; +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +export const a = cjs; +export const b = mjs; +export const c = type; +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; +export const d = cjsi; +export const e = mjsi; +export const f = typei; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); exports.f = exports.e = exports.d = exports.c = exports.b = exports.a = void 0; // cjs format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); +const cjs = __importStar(require("package/cjs")); +const mjs = __importStar(require("package/mjs")); +const type = __importStar(require("package")); exports.a = cjs; exports.b = mjs; exports.c = type; -const cjsi = require("inner/cjs"); -const mjsi = require("inner/mjs"); -const typei = require("inner"); +const cjsi = __importStar(require("inner/cjs")); +const mjsi = __importStar(require("inner/mjs")); +const typei = __importStar(require("inner")); exports.d = cjsi; exports.e = mjsi; exports.f = typei; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node20).js.diff index f651571932..31cf9c1545 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesDeclarationEmitWithPackageExports(module=node20).js.diff @@ -5,104 +5,23 @@ } +//// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.f = exports.e = exports.d = exports.c = exports.b = exports.a = void 0; +// esm format file -+const cjs = require("package/cjs"); -+const mjs = require("package/mjs"); -+const type = require("package"); -+exports.a = cjs; -+exports.b = mjs; -+exports.c = type; -+const cjsi = require("inner/cjs"); -+const mjsi = require("inner/mjs"); -+const typei = require("inner"); -+exports.d = cjsi; -+exports.e = mjsi; -+exports.f = typei; ++import * as cjs from "package/cjs"; ++import * as mjs from "package/mjs"; ++import * as type from "package"; ++export const a = cjs; ++export const b = mjs; ++export const c = type; ++import * as cjsi from "inner/cjs"; ++import * as mjsi from "inner/mjs"; ++import * as typei from "inner"; ++export const d = cjsi; ++export const e = mjsi; ++export const f = typei; //// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.f = exports.e = exports.d = exports.c = exports.b = exports.a = void 0; // esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --export const a = cjs; --export const b = mjs; --export const c = type; --import * as cjsi from "inner/cjs"; --import * as mjsi from "inner/mjs"; --import * as typei from "inner"; --export const d = cjsi; --export const e = mjsi; --export const f = typei; -+const cjs = require("package/cjs"); -+const mjs = require("package/mjs"); -+const type = require("package"); -+exports.a = cjs; -+exports.b = mjs; -+exports.c = type; -+const cjsi = require("inner/cjs"); -+const mjsi = require("inner/mjs"); -+const typei = require("inner"); -+exports.d = cjsi; -+exports.e = mjsi; -+exports.f = typei; - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - exports.f = exports.e = exports.d = exports.c = exports.b = exports.a = void 0; - // cjs format file --const cjs = __importStar(require("package/cjs")); --const mjs = __importStar(require("package/mjs")); --const type = __importStar(require("package")); -+const cjs = require("package/cjs"); -+const mjs = require("package/mjs"); -+const type = require("package"); - exports.a = cjs; - exports.b = mjs; - exports.c = type; --const cjsi = __importStar(require("inner/cjs")); --const mjsi = __importStar(require("inner/mjs")); --const typei = __importStar(require("inner")); -+const cjsi = require("inner/cjs"); -+const mjsi = require("inner/mjs"); -+const typei = require("inner"); + import * as cjs from "package/cjs"; +@@= skipped -64, +78 lines =@@ exports.d = cjsi; exports.e = mjsi; exports.f = typei; @@ -144,7 +63,7 @@ import * as cjsi from "inner/cjs"; import * as mjsi from "inner/mjs"; import * as typei from "inner"; -@@= skipped -94, +74 lines =@@ +@@= skipped -30, +23 lines =@@ export declare const e: typeof mjsi; export declare const f: typeof typei; //// [index.d.cts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDynamicImport(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesDynamicImport(module=node20).errors.txt deleted file mode 100644 index a655ed99d1..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDynamicImport(module=node20).errors.txt +++ /dev/null @@ -1,34 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2468: Cannot find global value 'Promise'. -index.ts(3,32): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -subfolder/index.ts(3,32): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2468: Cannot find global value 'Promise'. -==== subfolder/index.ts (1 errors) ==== - // cjs format file - export async function main() { - const { readFile } = await import("fs"); - ~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - } -==== index.ts (1 errors) ==== - // esm format file - export async function main() { - const { readFile } = await import("fs"); - ~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - } -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module" - } -==== subfolder/package.json (0 errors) ==== - { - "type": "commonjs" - } -==== types.d.ts (0 errors) ==== - declare module "fs"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDynamicImport(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesDynamicImport(module=node20).errors.txt.diff deleted file mode 100644 index de9ac74c57..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDynamicImport(module=node20).errors.txt.diff +++ /dev/null @@ -1,38 +0,0 @@ ---- old.nodeModulesDynamicImport(module=node20).errors.txt -+++ new.nodeModulesDynamicImport(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+error TS2468: Cannot find global value 'Promise'. -+index.ts(3,32): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+subfolder/index.ts(3,32): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+!!! error TS2468: Cannot find global value 'Promise'. -+==== subfolder/index.ts (1 errors) ==== -+ // cjs format file -+ export async function main() { -+ const { readFile } = await import("fs"); -+ ~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ } -+==== index.ts (1 errors) ==== -+ // esm format file -+ export async function main() { -+ const { readFile } = await import("fs"); -+ ~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ } -+==== package.json (0 errors) ==== -+ { -+ "name": "package", -+ "private": true, -+ "type": "module" -+ } -+==== subfolder/package.json (0 errors) ==== -+ { -+ "type": "commonjs" -+ } -+==== types.d.ts (0 errors) ==== -+ declare module "fs"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDynamicImport(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesDynamicImport(module=node20).js index bf08c0a12b..378a054d25 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDynamicImport(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesDynamicImport(module=node20).js @@ -32,11 +32,8 @@ async function main() { const { readFile } = await import("fs"); } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.main = main; // esm format file -async function main() { +export async function main() { const { readFile } = await import("fs"); } diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesDynamicImport(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesDynamicImport(module=node20).js.diff deleted file mode 100644 index 0fd4de873a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesDynamicImport(module=node20).js.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.nodeModulesDynamicImport(module=node20).js -+++ new.nodeModulesDynamicImport(module=node20).js -@@= skipped -31, +31 lines =@@ - const { readFile } = await import("fs"); - } - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.main = main; - // esm format file --export async function main() { -+async function main() { - const { readFile } = await import("fs"); - } diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportAssignments(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesExportAssignments(module=node20).errors.txt index e50b0b09b1..edb49c7a61 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportAssignments(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportAssignments(module=node20).errors.txt @@ -1,15 +1,16 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. +index.ts(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== subfolder/index.ts (0 errors) ==== // cjs format file const a = {}; export = a; -==== index.ts (0 errors) ==== +==== index.ts (1 errors) ==== // esm format file const a = {}; export = a; + ~~~~~~~~~~~ +!!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. ==== package.json (0 errors) ==== { "name": "package", diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportAssignments(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportAssignments(module=node20).errors.txt.diff deleted file mode 100644 index feb3f5a4d0..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportAssignments(module=node20).errors.txt.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- old.nodeModulesExportAssignments(module=node20).errors.txt -+++ new.nodeModulesExportAssignments(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ --index.ts(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. -- -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== subfolder/index.ts (0 errors) ==== - // cjs format file - const a = {}; - export = a; --==== index.ts (1 errors) ==== -+==== index.ts (0 errors) ==== - // esm format file - const a = {}; - export = a; -- ~~~~~~~~~~~ --!!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. - ==== package.json (0 errors) ==== - { - "name": "package", \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportAssignments(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesExportAssignments(module=node20).js index 9154d21a05..2d09438ae7 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportAssignments(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportAssignments(module=node20).js @@ -25,10 +25,9 @@ export = a; const a = {}; module.exports = a; //// [index.js] -"use strict"; // esm format file const a = {}; -module.exports = a; +export {}; //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportAssignments(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportAssignments(module=node20).js.diff deleted file mode 100644 index 2859fc5f47..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportAssignments(module=node20).js.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.nodeModulesExportAssignments(module=node20).js -+++ new.nodeModulesExportAssignments(module=node20).js -@@= skipped -24, +24 lines =@@ - const a = {}; - module.exports = a; - //// [index.js] -+"use strict"; - // esm format file - const a = {}; --export {}; -+module.exports = a; - - - //// [index.d.ts] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node20).errors.txt index 55591636a6..7e86097227 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node20).errors.txt @@ -1,25 +1,15 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2468: Cannot find global value 'Promise'. index.ts(2,23): error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. -index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other'. This is likely not portable. A type annotation is necessary. -index.ts(3,19): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -index.ts(3,25): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2468: Cannot find global value 'Promise'. -==== index.ts (4 errors) ==== +==== index.ts (2 errors) ==== // esm format file import { Thing } from "inner/other"; ~~~~~~~~~~~~~ !!! error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. export const a = (await import("inner")).x(); ~ -!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other'. This is likely not portable. A type annotation is necessary. - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. ==== node_modules/inner/index.d.ts (0 errors) ==== // esm format file export { x } from "./other.js"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node20).errors.txt.diff deleted file mode 100644 index 19f1eede66..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node20).errors.txt.diff +++ /dev/null @@ -1,33 +0,0 @@ ---- old.nodeModulesExportsBlocksSpecifierResolution(module=node20).errors.txt -+++ new.nodeModulesExportsBlocksSpecifierResolution(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+error TS2468: Cannot find global value 'Promise'. - index.ts(2,23): error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. --index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. -- -- --==== index.ts (2 errors) ==== -+index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other'. This is likely not portable. A type annotation is necessary. -+index.ts(3,19): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+index.ts(3,25): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+!!! error TS2468: Cannot find global value 'Promise'. -+==== index.ts (4 errors) ==== - // esm format file - import { Thing } from "inner/other"; - ~~~~~~~~~~~~~ - !!! error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. - export const a = (await import("inner")).x(); - ~ --!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. -+!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other'. This is likely not portable. A type annotation is necessary. -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - ==== node_modules/inner/index.d.ts (0 errors) ==== - // esm format file - export { x } from "./other.js"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node20).js index f558b624be..8ce6f039f9 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node20).js @@ -27,10 +27,7 @@ export const x: () => Thing; } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.a = void 0; -exports.a = (await import("inner")).x(); +export const a = (await import("inner")).x(); //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node20).js.diff index 6e9c90d11c..bd91f3c3b9 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksSpecifierResolution(module=node20).js.diff @@ -1,14 +1,9 @@ --- old.nodeModulesExportsBlocksSpecifierResolution(module=node20).js +++ new.nodeModulesExportsBlocksSpecifierResolution(module=node20).js -@@= skipped -26, +26 lines =@@ - } +@@= skipped -27, +27 lines =@@ //// [index.js] --export const a = (await import("inner")).x(); -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.a = void 0; -+exports.a = (await import("inner")).x(); + export const a = (await import("inner")).x(); + + +//// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node20).errors.txt index 37a1b1be0a..8300f6aaaa 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node20).errors.txt @@ -1,4 +1,3 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. /main.cts(1,16): error TS7016: Could not find a declaration file for module 'exports-and-types-versions/foo'. '/node_modules/exports-and-types-versions/dist/foo.js' implicitly has an 'any' type. If the 'exports-and-types-versions' package actually exposes this module, try adding a new declaration (.d.ts) file containing `declare module 'exports-and-types-versions/foo';` /main.cts(2,16): error TS2307: Cannot find module 'exports-and-types-versions/nope' or its corresponding type declarations. @@ -9,7 +8,6 @@ error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspeci /main.mts(5,16): error TS2307: Cannot find module 'exports-and-types-versions/versioned-nah' or its corresponding type declarations. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /node_modules/exports-and-types-versions/package.json (0 errors) ==== { "name": "exports-and-types-versions", diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node20).errors.txt.diff index 40655da946..70c6cfa3d3 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node20).errors.txt.diff @@ -4,18 +4,16 @@ -error TS6504: File '/node_modules/exports-and-types-versions/dist/foo.js' is a JavaScript file. Did you mean to enable the 'allowJs' option? - The file is in the program because: - Root file specified for compilation -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. /main.cts(1,16): error TS7016: Could not find a declaration file for module 'exports-and-types-versions/foo'. '/node_modules/exports-and-types-versions/dist/foo.js' implicitly has an 'any' type. If the 'exports-and-types-versions' package actually exposes this module, try adding a new declaration (.d.ts) file containing `declare module 'exports-and-types-versions/foo';` /main.cts(2,16): error TS2307: Cannot find module 'exports-and-types-versions/nope' or its corresponding type declarations. -@@= skipped -10, +8 lines =@@ +@@= skipped -10, +7 lines =@@ /main.mts(5,16): error TS2307: Cannot find module 'exports-and-types-versions/versioned-nah' or its corresponding type declarations. -!!! error TS6504: File '/node_modules/exports-and-types-versions/dist/foo.js' is a JavaScript file. Did you mean to enable the 'allowJs' option? -!!! error TS6504: The file is in the program because: -!!! error TS6504: Root file specified for compilation -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /node_modules/exports-and-types-versions/package.json (0 errors) ==== { "name": "exports-and-types-versions", \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node20).js index f7796d030e..396ca2dfc4 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node20).js @@ -67,5 +67,4 @@ import {} from "just-types-versions/foo"; "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); //// [main.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node20).js.diff deleted file mode 100644 index 2cf01b48ca..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node20).js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.nodeModulesExportsBlocksTypesVersions(module=node20).js -+++ new.nodeModulesExportsBlocksTypesVersions(module=node20).js -@@= skipped -66, +66 lines =@@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - //// [main.mjs] --export {}; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node20).trace.json b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node20).trace.json index f9de318d95..3de2816eff 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node20).trace.json +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsBlocksTypesVersions(module=node20).trace.json @@ -1,6 +1,6 @@ ======== Resolving module 'exports-and-types-versions/foo' from '/main.cts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/package.json' does not exist. Loading module 'exports-and-types-versions/foo' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. @@ -21,8 +21,8 @@ File '/node_modules/exports-and-types-versions/dist/foo.js' exists - use it as a Resolving real path for '/node_modules/exports-and-types-versions/dist/foo.js', result '/node_modules/exports-and-types-versions/dist/foo.js'. ======== Module name 'exports-and-types-versions/foo' was successfully resolved to '/node_modules/exports-and-types-versions/dist/foo.js' with Package ID 'exports-and-types-versions/dist/foo.js@1.0.0'. ======== ======== Resolving module 'exports-and-types-versions/nope' from '/main.cts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/package.json' does not exist according to earlier cached lookups. Loading module 'exports-and-types-versions/nope' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. @@ -34,8 +34,8 @@ File '/node_modules/exports-and-types-versions/package.json' exists according to Export specifier './nope' does not exist in package.json scope at path '/node_modules/exports-and-types-versions'. ======== Module name 'exports-and-types-versions/nope' was not resolved. ======== ======== Resolving module 'exports-and-types-versions/yep' from '/main.cts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/package.json' does not exist according to earlier cached lookups. Loading module 'exports-and-types-versions/yep' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. @@ -50,8 +50,8 @@ Exiting conditional exports. Resolving real path for '/node_modules/exports-and-types-versions/types/foo.d.ts', result '/node_modules/exports-and-types-versions/types/foo.d.ts'. ======== Module name 'exports-and-types-versions/yep' was successfully resolved to '/node_modules/exports-and-types-versions/types/foo.d.ts' with Package ID 'exports-and-types-versions/types/foo.d.ts@1.0.0'. ======== ======== Resolving module 'exports-and-types-versions/versioned-yep' from '/main.cts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/package.json' does not exist according to earlier cached lookups. Loading module 'exports-and-types-versions/versioned-yep' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. @@ -66,8 +66,8 @@ Exiting conditional exports. Resolving real path for '/node_modules/exports-and-types-versions/types/foo.d.ts', result '/node_modules/exports-and-types-versions/types/foo.d.ts'. ======== Module name 'exports-and-types-versions/versioned-yep' was successfully resolved to '/node_modules/exports-and-types-versions/types/foo.d.ts' with Package ID 'exports-and-types-versions/types/foo.d.ts@1.0.0'. ======== ======== Resolving module 'exports-and-types-versions/versioned-nah' from '/main.cts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/package.json' does not exist according to earlier cached lookups. Loading module 'exports-and-types-versions/versioned-nah' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. @@ -85,8 +85,8 @@ Exiting conditional exports. Export specifier './versioned-nah' does not exist in package.json scope at path '/node_modules/exports-and-types-versions'. ======== Module name 'exports-and-types-versions/versioned-nah' was not resolved. ======== ======== Resolving module 'just-types-versions/foo' from '/main.cts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/package.json' does not exist according to earlier cached lookups. Loading module 'just-types-versions/foo' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. @@ -99,8 +99,8 @@ File '/node_modules/just-types-versions/types/foo.d.ts' exists - use it as a nam Resolving real path for '/node_modules/just-types-versions/types/foo.d.ts', result '/node_modules/just-types-versions/types/foo.d.ts'. ======== Module name 'just-types-versions/foo' was successfully resolved to '/node_modules/just-types-versions/types/foo.d.ts'. ======== ======== Resolving module 'exports-and-types-versions/foo' from '/main.mts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'import', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. File '/package.json' does not exist according to earlier cached lookups. Loading module 'exports-and-types-versions/foo' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. @@ -132,8 +132,8 @@ File '/node_modules/exports-and-types-versions/types/foo.d.ts' exists - use it a Resolving real path for '/node_modules/exports-and-types-versions/types/foo.d.ts', result '/node_modules/exports-and-types-versions/types/foo.d.ts'. ======== Module name 'exports-and-types-versions/foo' was successfully resolved to '/node_modules/exports-and-types-versions/dist/foo.js' with Package ID 'exports-and-types-versions/dist/foo.js@1.0.0'. ======== ======== Resolving module 'exports-and-types-versions/nope' from '/main.mts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'import', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. File '/package.json' does not exist according to earlier cached lookups. Loading module 'exports-and-types-versions/nope' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. @@ -145,8 +145,8 @@ File '/node_modules/exports-and-types-versions/package.json' exists according to Export specifier './nope' does not exist in package.json scope at path '/node_modules/exports-and-types-versions'. ======== Module name 'exports-and-types-versions/nope' was not resolved. ======== ======== Resolving module 'exports-and-types-versions/yep' from '/main.mts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'import', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. File '/package.json' does not exist according to earlier cached lookups. Loading module 'exports-and-types-versions/yep' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. @@ -161,8 +161,8 @@ Exiting conditional exports. Resolving real path for '/node_modules/exports-and-types-versions/types/foo.d.ts', result '/node_modules/exports-and-types-versions/types/foo.d.ts'. ======== Module name 'exports-and-types-versions/yep' was successfully resolved to '/node_modules/exports-and-types-versions/types/foo.d.ts' with Package ID 'exports-and-types-versions/types/foo.d.ts@1.0.0'. ======== ======== Resolving module 'exports-and-types-versions/versioned-yep' from '/main.mts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'import', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. File '/package.json' does not exist according to earlier cached lookups. Loading module 'exports-and-types-versions/versioned-yep' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. @@ -177,8 +177,8 @@ Exiting conditional exports. Resolving real path for '/node_modules/exports-and-types-versions/types/foo.d.ts', result '/node_modules/exports-and-types-versions/types/foo.d.ts'. ======== Module name 'exports-and-types-versions/versioned-yep' was successfully resolved to '/node_modules/exports-and-types-versions/types/foo.d.ts' with Package ID 'exports-and-types-versions/types/foo.d.ts@1.0.0'. ======== ======== Resolving module 'exports-and-types-versions/versioned-nah' from '/main.mts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'import', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. File '/package.json' does not exist according to earlier cached lookups. Loading module 'exports-and-types-versions/versioned-nah' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. @@ -196,8 +196,8 @@ Exiting conditional exports. Export specifier './versioned-nah' does not exist in package.json scope at path '/node_modules/exports-and-types-versions'. ======== Module name 'exports-and-types-versions/versioned-nah' was not resolved. ======== ======== Resolving module 'just-types-versions/foo' from '/main.mts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'import', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. File '/package.json' does not exist according to earlier cached lookups. Loading module 'just-types-versions/foo' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsDoubleAsterisk(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsDoubleAsterisk(module=node20).errors.txt index f95a2a053a..1ab8b6bb27 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsDoubleAsterisk(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsDoubleAsterisk(module=node20).errors.txt @@ -1,8 +1,6 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. /main.mts(1,16): error TS2307: Cannot find module 'double-asterisk/a/*/b/*/c/*' or its corresponding type declarations. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /node_modules/double-asterisk/package.json (0 errors) ==== { "name": "double-asterisk", diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsDoubleAsterisk(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsDoubleAsterisk(module=node20).errors.txt.diff deleted file mode 100644 index 78261c12e5..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsDoubleAsterisk(module=node20).errors.txt.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.nodeModulesExportsDoubleAsterisk(module=node20).errors.txt -+++ new.nodeModulesExportsDoubleAsterisk(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - /main.mts(1,16): error TS2307: Cannot find module 'double-asterisk/a/*/b/*/c/*' or its corresponding type declarations. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== /node_modules/double-asterisk/package.json (0 errors) ==== - { - "name": "double-asterisk", \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node20).errors.txt index 989de80998..358a0e6143 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node20).errors.txt @@ -1,25 +1,15 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2468: Cannot find global value 'Promise'. index.ts(2,23): error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. -index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other'. This is likely not portable. A type annotation is necessary. -index.ts(3,19): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -index.ts(3,25): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2468: Cannot find global value 'Promise'. -==== index.ts (4 errors) ==== +==== index.ts (2 errors) ==== // esm format file import { Thing } from "inner/other"; ~~~~~~~~~~~~~ !!! error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. export const a = (await import("inner")).x(); ~ -!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other'. This is likely not portable. A type annotation is necessary. - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. import {a as a2} from "package"; ==== node_modules/inner/index.ts (0 errors) ==== // esm format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node20).errors.txt.diff deleted file mode 100644 index a223b1162e..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node20).errors.txt.diff +++ /dev/null @@ -1,33 +0,0 @@ ---- old.nodeModulesExportsSourceTs(module=node20).errors.txt -+++ new.nodeModulesExportsSourceTs(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+error TS2468: Cannot find global value 'Promise'. - index.ts(2,23): error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. --index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. -- -- --==== index.ts (2 errors) ==== -+index.ts(3,14): error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other'. This is likely not portable. A type annotation is necessary. -+index.ts(3,19): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+index.ts(3,25): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+!!! error TS2468: Cannot find global value 'Promise'. -+==== index.ts (4 errors) ==== - // esm format file - import { Thing } from "inner/other"; - ~~~~~~~~~~~~~ - !!! error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. - export const a = (await import("inner")).x(); - ~ --!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other.js'. This is likely not portable. A type annotation is necessary. -+!!! error TS2742: The inferred type of 'a' cannot be named without a reference to './node_modules/inner/other'. This is likely not portable. A type annotation is necessary. -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - import {a as a2} from "package"; - ==== node_modules/inner/index.ts (0 errors) ==== - // esm format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node20).js index b36131ba71..be568de76d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node20).js @@ -28,22 +28,12 @@ export const x: () => Thing = null as any; } //// [other.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; -exports.x = null; +export const x = null; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file -const other_js_1 = require("./other.js"); -Object.defineProperty(exports, "x", { enumerable: true, get: function () { return other_js_1.x; } }); +export { x } from "./other.js"; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.a = void 0; -exports.a = (await import("inner")).x(); +export const a = (await import("inner")).x(); //// [other.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node20).js.diff index 27231a616c..89f464f85d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSourceTs(module=node20).js.diff @@ -1,32 +1,6 @@ --- old.nodeModulesExportsSourceTs(module=node20).js +++ new.nodeModulesExportsSourceTs(module=node20).js -@@= skipped -27, +27 lines =@@ - } - - //// [other.js] --export const x = null; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+exports.x = null; - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; - // esm format file --export { x } from "./other.js"; -+const other_js_1 = require("./other.js"); -+Object.defineProperty(exports, "x", { enumerable: true, get: function () { return other_js_1.x; } }); - //// [index.js] --export const a = (await import("inner")).x(); -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.a = void 0; -+exports.a = (await import("inner")).x(); - - - //// [other.d.ts] -@@= skipped -14, +24 lines =@@ +@@= skipped -41, +41 lines =@@ export declare const x: () => Thing; //// [index.d.ts] export { x } from "./other.js"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node20).errors.txt index 3b23bb27fc..08ce05322d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node20).errors.txt @@ -1,22 +1,12 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2468: Cannot find global value 'Promise'. index.ts(2,23): error TS2307: Cannot find module 'inner/other.js' or its corresponding type declarations. -index.ts(3,19): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -index.ts(3,25): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2468: Cannot find global value 'Promise'. -==== index.ts (3 errors) ==== +==== index.ts (1 errors) ==== // esm format file import { Thing } from "inner/other.js"; // should fail ~~~~~~~~~~~~~~~~ !!! error TS2307: Cannot find module 'inner/other.js' or its corresponding type declarations. export const a = (await import("inner")).x(); - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ==== node_modules/inner/index.d.ts (0 errors) ==== // esm format file export { x } from "./other.js"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node20).errors.txt.diff deleted file mode 100644 index 7f4d73b8f4..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node20).errors.txt.diff +++ /dev/null @@ -1,28 +0,0 @@ ---- old.nodeModulesExportsSpecifierGenerationConditions(module=node20).errors.txt -+++ new.nodeModulesExportsSpecifierGenerationConditions(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+error TS2468: Cannot find global value 'Promise'. - index.ts(2,23): error TS2307: Cannot find module 'inner/other.js' or its corresponding type declarations. -- -- --==== index.ts (1 errors) ==== -+index.ts(3,19): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+index.ts(3,25): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+!!! error TS2468: Cannot find global value 'Promise'. -+==== index.ts (3 errors) ==== - // esm format file - import { Thing } from "inner/other.js"; // should fail - ~~~~~~~~~~~~~~~~ - !!! error TS2307: Cannot find module 'inner/other.js' or its corresponding type declarations. - export const a = (await import("inner")).x(); -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - ==== node_modules/inner/index.d.ts (0 errors) ==== - // esm format file - export { x } from "./other.js"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node20).js index 0b91e6e8c2..5db58ae2f7 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node20).js @@ -34,10 +34,7 @@ export const x: () => Thing; } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.a = void 0; -exports.a = (await import("inner")).x(); +export const a = (await import("inner")).x(); //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node20).js.diff deleted file mode 100644 index 3aee866d9b..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationConditions(module=node20).js.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.nodeModulesExportsSpecifierGenerationConditions(module=node20).js -+++ new.nodeModulesExportsSpecifierGenerationConditions(module=node20).js -@@= skipped -33, +33 lines =@@ - } - - //// [index.js] --export const a = (await import("inner")).x(); -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.a = void 0; -+exports.a = (await import("inner")).x(); - - - //// [index.d.ts] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node20).errors.txt index 776f5c3154..f7015dbf60 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node20).errors.txt @@ -1,22 +1,12 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2468: Cannot find global value 'Promise'. index.ts(2,23): error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. -index.ts(3,19): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -index.ts(3,25): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2468: Cannot find global value 'Promise'. -==== index.ts (3 errors) ==== +==== index.ts (1 errors) ==== // esm format file import { Thing } from "inner/other"; ~~~~~~~~~~~~~ !!! error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. export const a = (await import("inner/index.js")).x(); - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ==== node_modules/inner/index.d.ts (0 errors) ==== // esm format file export { x } from "./other.js"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node20).errors.txt.diff deleted file mode 100644 index 78dc802542..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node20).errors.txt.diff +++ /dev/null @@ -1,28 +0,0 @@ ---- old.nodeModulesExportsSpecifierGenerationDirectory(module=node20).errors.txt -+++ new.nodeModulesExportsSpecifierGenerationDirectory(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+error TS2468: Cannot find global value 'Promise'. - index.ts(2,23): error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. -- -- --==== index.ts (1 errors) ==== -+index.ts(3,19): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+index.ts(3,25): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+!!! error TS2468: Cannot find global value 'Promise'. -+==== index.ts (3 errors) ==== - // esm format file - import { Thing } from "inner/other"; - ~~~~~~~~~~~~~ - !!! error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. - export const a = (await import("inner/index.js")).x(); -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - ==== node_modules/inner/index.d.ts (0 errors) ==== - // esm format file - export { x } from "./other.js"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node20).js index a29dc3b42f..c0d6b006b3 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node20).js @@ -29,10 +29,7 @@ export const x: () => Thing; } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.a = void 0; -exports.a = (await import("inner/index.js")).x(); +export const a = (await import("inner/index.js")).x(); //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node20).js.diff deleted file mode 100644 index 1ef50899e4..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationDirectory(module=node20).js.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.nodeModulesExportsSpecifierGenerationDirectory(module=node20).js -+++ new.nodeModulesExportsSpecifierGenerationDirectory(module=node20).js -@@= skipped -28, +28 lines =@@ - } - - //// [index.js] --export const a = (await import("inner/index.js")).x(); -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.a = void 0; -+exports.a = (await import("inner/index.js")).x(); - - - //// [index.d.ts] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node20).errors.txt index deab9a9102..002881ca1c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node20).errors.txt @@ -1,22 +1,12 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2468: Cannot find global value 'Promise'. index.ts(2,23): error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. -index.ts(3,19): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -index.ts(3,25): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2468: Cannot find global value 'Promise'. -==== index.ts (3 errors) ==== +==== index.ts (1 errors) ==== // esm format file import { Thing } from "inner/other"; ~~~~~~~~~~~~~ !!! error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. export const a = (await import("inner/index.js")).x(); - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ==== node_modules/inner/index.d.ts (0 errors) ==== // esm format file export { x } from "./other.js"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node20).errors.txt.diff deleted file mode 100644 index c16b95b304..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node20).errors.txt.diff +++ /dev/null @@ -1,28 +0,0 @@ ---- old.nodeModulesExportsSpecifierGenerationPattern(module=node20).errors.txt -+++ new.nodeModulesExportsSpecifierGenerationPattern(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+error TS2468: Cannot find global value 'Promise'. - index.ts(2,23): error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. -- -- --==== index.ts (1 errors) ==== -+index.ts(3,19): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+index.ts(3,25): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+!!! error TS2468: Cannot find global value 'Promise'. -+==== index.ts (3 errors) ==== - // esm format file - import { Thing } from "inner/other"; - ~~~~~~~~~~~~~ - !!! error TS2307: Cannot find module 'inner/other' or its corresponding type declarations. - export const a = (await import("inner/index.js")).x(); -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ ~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - ==== node_modules/inner/index.d.ts (0 errors) ==== - // esm format file - export { x } from "./other.js"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node20).js index 691f9516da..dcdd62bed6 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node20).js @@ -29,10 +29,7 @@ export const x: () => Thing; } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.a = void 0; -exports.a = (await import("inner/index.js")).x(); +export const a = (await import("inner/index.js")).x(); //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node20).js.diff deleted file mode 100644 index 54179a7172..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesExportsSpecifierGenerationPattern(module=node20).js.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.nodeModulesExportsSpecifierGenerationPattern(module=node20).js -+++ new.nodeModulesExportsSpecifierGenerationPattern(module=node20).js -@@= skipped -28, +28 lines =@@ - } - - //// [index.js] --export const a = (await import("inner/index.js")).x(); -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.a = void 0; -+exports.a = (await import("inner/index.js")).x(); - - - //// [index.d.ts] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesForbidenSyntax(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesForbidenSyntax(module=node20).errors.txt index 5b6a3a9e32..2a2784ec23 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesForbidenSyntax(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesForbidenSyntax(module=node20).errors.txt @@ -1,4 +1,3 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. index.cts(2,12): error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint. index.mts(2,12): error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint. subfolder/index.cts(2,12): error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint. @@ -9,7 +8,6 @@ subfolder2/index.cts(2,12): error TS7060: This syntax is reserved in files with subfolder2/index.mts(2,12): error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== subfolder/index.ts (0 errors) ==== // cjs format file const x = () => (void 0); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesForbidenSyntax(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesForbidenSyntax(module=node20).errors.txt.diff index 6ce3bfd7b6..6f0f8373bd 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesForbidenSyntax(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesForbidenSyntax(module=node20).errors.txt.diff @@ -1,7 +1,6 @@ --- old.nodeModulesForbidenSyntax(module=node20).errors.txt +++ new.nodeModulesForbidenSyntax(module=node20).errors.txt @@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. index.cts(2,12): error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint. -index.cts(2,20): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. -index.cts(2,23): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. @@ -26,11 +25,8 @@ subfolder2/index.mts(2,12): error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint. -subfolder2/index.mts(2,20): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. -subfolder2/index.mts(2,23): error TS7059: This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead. -- -- -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. + + ==== subfolder/index.ts (0 errors) ==== // cjs format file const x = () => (void 0); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesForbidenSyntax(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesForbidenSyntax(module=node20).js index 43e30cd2d2..4cca6af5a5 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesForbidenSyntax(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesForbidenSyntax(module=node20).js @@ -81,12 +81,9 @@ exports.x = void 0; const x = () => (void 0); exports.x = x; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = () => (void 0); -exports.x = x; +export { x }; //// [index.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -102,26 +99,17 @@ exports.x = void 0; const x = () => (void 0); exports.x = x; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = () => (void 0); -exports.x = x; +export { x }; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = () => (void 0); -exports.x = x; +export { x }; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = () => (void 0); -exports.x = x; +export { x }; //// [index.cjs] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -130,12 +118,9 @@ exports.x = void 0; const x = () => (void 0); exports.x = x; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = () => (void 0); -exports.x = x; +export { x }; //// [index.cjs] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); @@ -144,12 +129,9 @@ exports.x = void 0; const x = () => (void 0); exports.x = x; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = () => (void 0); -exports.x = x; +export { x }; //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesForbidenSyntax(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesForbidenSyntax(module=node20).js.diff deleted file mode 100644 index cb12c8b5de..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesForbidenSyntax(module=node20).js.diff +++ /dev/null @@ -1,129 +0,0 @@ ---- old.nodeModulesForbidenSyntax(module=node20).js -+++ new.nodeModulesForbidenSyntax(module=node20).js -@@= skipped -80, +80 lines =@@ - const x = () => (void 0); - exports.x = x; - //// [index.mjs] --// esm format file --const x = () => (void 0); --export { x }; --//// [index.js] --"use strict"; --Object.defineProperty(exports, "__esModule", { value: true }); --exports.x = void 0; --// cjs format file --const x = () => (void 0); --exports.x = x; --//// [index.cjs] --"use strict"; --Object.defineProperty(exports, "__esModule", { value: true }); --exports.x = void 0; --// cjs format file --const x = () => (void 0); --exports.x = x; --//// [index.mjs] --// esm format file --const x = () => (void 0); --export { x }; --//// [index.js] --// esm format file --const x = () => (void 0); --export { x }; --//// [index.mjs] --// esm format file --const x = () => (void 0); --export { x }; --//// [index.cjs] --"use strict"; --Object.defineProperty(exports, "__esModule", { value: true }); --exports.x = void 0; --// cjs format file --const x = () => (void 0); --exports.x = x; --//// [index.mjs] --// esm format file --const x = () => (void 0); --export { x }; --//// [index.cjs] --"use strict"; --Object.defineProperty(exports, "__esModule", { value: true }); --exports.x = void 0; --// cjs format file --const x = () => (void 0); --exports.x = x; --//// [index.js] --// esm format file --const x = () => (void 0); --export { x }; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// esm format file -+const x = () => (void 0); -+exports.x = x; -+//// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// cjs format file -+const x = () => (void 0); -+exports.x = x; -+//// [index.cjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// cjs format file -+const x = () => (void 0); -+exports.x = x; -+//// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// esm format file -+const x = () => (void 0); -+exports.x = x; -+//// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// esm format file -+const x = () => (void 0); -+exports.x = x; -+//// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// esm format file -+const x = () => (void 0); -+exports.x = x; -+//// [index.cjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// cjs format file -+const x = () => (void 0); -+exports.x = x; -+//// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// esm format file -+const x = () => (void 0); -+exports.x = x; -+//// [index.cjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// cjs format file -+const x = () => (void 0); -+exports.x = x; -+//// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; -+// esm format file -+const x = () => (void 0); -+exports.x = x; - - - //// [index.d.ts] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesGeneratedNameCollisions(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesGeneratedNameCollisions(module=node20).errors.txt index 348ada08aa..cba5d90874 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesGeneratedNameCollisions(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesGeneratedNameCollisions(module=node20).errors.txt @@ -1,13 +1,8 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -index.ts(2,10): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. -index.ts(3,7): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. -index.ts(5,14): error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. subfolder/index.ts(2,10): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. subfolder/index.ts(3,7): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. subfolder/index.ts(5,14): error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== subfolder/index.ts (3 errors) ==== // cjs format file function require() {} @@ -21,18 +16,12 @@ subfolder/index.ts(5,14): error TS1216: Identifier expected. '__esModule' is res ~~~~~~~~~~ !!! error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. export {require, exports, Object}; -==== index.ts (3 errors) ==== +==== index.ts (0 errors) ==== // esm format file function require() {} - ~~~~~~~ -!!! error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. const exports = {}; - ~~~~~~~ -!!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. class Object {} export const __esModule = false; - ~~~~~~~~~~ -!!! error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. export {require, exports, Object}; ==== package.json (0 errors) ==== { diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesGeneratedNameCollisions(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesGeneratedNameCollisions(module=node20).errors.txt.diff index cf0adc9518..4e05f3c0b9 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesGeneratedNameCollisions(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesGeneratedNameCollisions(module=node20).errors.txt.diff @@ -1,10 +1,6 @@ --- old.nodeModulesGeneratedNameCollisions(module=node20).errors.txt +++ new.nodeModulesGeneratedNameCollisions(module=node20).errors.txt @@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+index.ts(2,10): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. -+index.ts(3,7): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. -+index.ts(5,14): error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. subfolder/index.ts(2,10): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. subfolder/index.ts(3,7): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. -subfolder/index.ts(4,7): error TS2725: Class name cannot be 'Object' when targeting ES5 and above with module Node20. @@ -12,12 +8,11 @@ -==== subfolder/index.ts (4 errors) ==== -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. +==== subfolder/index.ts (3 errors) ==== // cjs format file function require() {} ~~~~~~~ -@@= skipped -12, +16 lines =@@ +@@= skipped -12, +11 lines =@@ ~~~~~~~ !!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. class Object {} @@ -25,21 +20,4 @@ -!!! error TS2725: Class name cannot be 'Object' when targeting ES5 and above with module Node20. export const __esModule = false; ~~~~~~~~~~ - !!! error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. - export {require, exports, Object}; --==== index.ts (0 errors) ==== -+==== index.ts (3 errors) ==== - // esm format file - function require() {} -+ ~~~~~~~ -+!!! error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. - const exports = {}; -+ ~~~~~~~ -+!!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. - class Object {} - export const __esModule = false; -+ ~~~~~~~~~~ -+!!! error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. - export {require, exports, Object}; - ==== package.json (0 errors) ==== - { \ No newline at end of file + !!! error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesGeneratedNameCollisions(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesGeneratedNameCollisions(module=node20).js index d399ccc45b..3b196cd32c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesGeneratedNameCollisions(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesGeneratedNameCollisions(module=node20).js @@ -39,18 +39,13 @@ class Object { exports.Object = Object; exports.__esModule = false; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Object = exports.exports = exports.__esModule = void 0; -exports.require = require; // esm format file function require() { } const exports = {}; -exports.exports = exports; class Object { } -exports.Object = Object; -exports.__esModule = false; +export const __esModule = false; +export { require, exports, Object }; //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesGeneratedNameCollisions(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesGeneratedNameCollisions(module=node20).js.diff deleted file mode 100644 index 44d4c33826..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesGeneratedNameCollisions(module=node20).js.diff +++ /dev/null @@ -1,23 +0,0 @@ ---- old.nodeModulesGeneratedNameCollisions(module=node20).js -+++ new.nodeModulesGeneratedNameCollisions(module=node20).js -@@= skipped -38, +38 lines =@@ - exports.Object = Object; - exports.__esModule = false; - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.Object = exports.exports = exports.__esModule = void 0; -+exports.require = require; - // esm format file - function require() { } - const exports = {}; -+exports.exports = exports; - class Object { - } --export const __esModule = false; --export { require, exports, Object }; -+exports.Object = Object; -+exports.__esModule = false; - - - //// [index.d.ts] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node20).errors.txt index 52276b78eb..f4002d5a5a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node20).errors.txt @@ -1,24 +1,17 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2468: Cannot find global value 'Promise'. -index.ts(1,35): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -otherc.cts(1,35): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -otherc.cts(2,15): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +index.ts(1,35): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +otherc.cts(1,35): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. otherc.cts(2,40): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'node20', 'nodenext', or 'preserve'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2468: Cannot find global value 'Promise'. ==== index.ts (1 errors) ==== import json from "./package.json" assert { type: "json" }; ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -==== otherc.cts (3 errors) ==== +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +==== otherc.cts (2 errors) ==== import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'node20', 'nodenext', or 'preserve'. ==== package.json (0 errors) ==== diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node20).errors.txt.diff index f576df6162..3feaff9e32 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node20).errors.txt.diff @@ -1,36 +1,23 @@ --- old.nodeModulesImportAssertions(module=node20).errors.txt +++ new.nodeModulesImportAssertions(module=node20).errors.txt @@= skipped -0, +0 lines =@@ --index.ts(1,35): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. --otherc.cts(1,35): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -- -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+error TS2468: Cannot find global value 'Promise'. -+index.ts(1,35): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -+otherc.cts(1,35): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -+otherc.cts(2,15): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + index.ts(1,35): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + otherc.cts(1,35): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +otherc.cts(2,40): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'node20', 'nodenext', or 'preserve'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+!!! error TS2468: Cannot find global value 'Promise'. + + ==== index.ts (1 errors) ==== import json from "./package.json" assert { type: "json" }; - ~~~~~~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. --==== otherc.cts (1 errors) ==== + ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -+==== otherc.cts (3 errors) ==== + !!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +-==== otherc.cts (1 errors) ==== ++==== otherc.cts (2 errors) ==== import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions - ~~~~~~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. + !!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'node20', 'nodenext', or 'preserve'. ==== package.json (0 errors) ==== diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node20).js index e8d43f0ad3..091166d523 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node20).js @@ -13,8 +13,7 @@ const json2 = import("./package.json", { assert: { type: "json" } }); // should } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //// [otherc.cjs] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node20).js.diff deleted file mode 100644 index 663a994898..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssertions(module=node20).js.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.nodeModulesImportAssertions(module=node20).js -+++ new.nodeModulesImportAssertions(module=node20).js -@@= skipped -12, +12 lines =@@ - } - - //// [index.js] --export {}; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - //// [otherc.cjs] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssignments(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssignments(module=node20).errors.txt deleted file mode 100644 index f5dc3bcd4a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssignments(module=node20).errors.txt +++ /dev/null @@ -1,33 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== subfolder/index.ts (0 errors) ==== - // cjs format file - import fs = require("fs"); - fs.readFile; - export import fs2 = require("fs"); -==== index.ts (0 errors) ==== - // esm format file - import fs = require("fs"); - fs.readFile; - export import fs2 = require("fs"); -==== file.ts (0 errors) ==== - // esm format file - const __require = null; - const _createRequire = null; - import fs = require("fs"); - fs.readFile; - export import fs2 = require("fs"); -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module" - } -==== subfolder/package.json (0 errors) ==== - { - "type": "commonjs" - } -==== types.d.ts (0 errors) ==== - declare module "fs"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssignments(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssignments(module=node20).errors.txt.diff deleted file mode 100644 index ec7114c370..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssignments(module=node20).errors.txt.diff +++ /dev/null @@ -1,37 +0,0 @@ ---- old.nodeModulesImportAssignments(module=node20).errors.txt -+++ new.nodeModulesImportAssignments(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== subfolder/index.ts (0 errors) ==== -+ // cjs format file -+ import fs = require("fs"); -+ fs.readFile; -+ export import fs2 = require("fs"); -+==== index.ts (0 errors) ==== -+ // esm format file -+ import fs = require("fs"); -+ fs.readFile; -+ export import fs2 = require("fs"); -+==== file.ts (0 errors) ==== -+ // esm format file -+ const __require = null; -+ const _createRequire = null; -+ import fs = require("fs"); -+ fs.readFile; -+ export import fs2 = require("fs"); -+==== package.json (0 errors) ==== -+ { -+ "name": "package", -+ "private": true, -+ "type": "module" -+ } -+==== subfolder/package.json (0 errors) ==== -+ { -+ "type": "commonjs" -+ } -+==== types.d.ts (0 errors) ==== -+ declare module "fs"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssignments(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssignments(module=node20).js index 4a8f44fd00..c73ff1177a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssignments(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssignments(module=node20).js @@ -38,21 +38,23 @@ const fs = require("fs"); fs.readFile; exports.fs2 = require("fs"); //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +import { createRequire as _createRequire } from "module"; +const __require = _createRequire(import.meta.url); // esm format file -const fs = require("fs"); +const fs = __require("fs"); fs.readFile; -exports.fs2 = require("fs"); +const fs2 = __require("fs"); +export { fs2 }; //// [file.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +import { createRequire as _createRequire_1 } from "module"; +const __require_1 = _createRequire_1(import.meta.url); // esm format file const __require = null; const _createRequire = null; -const fs = require("fs"); +const fs = __require_1("fs"); fs.readFile; -exports.fs2 = require("fs"); +const fs2 = __require_1("fs"); +export { fs2 }; //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssignments(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssignments(module=node20).js.diff deleted file mode 100644 index 487c7a16f5..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAssignments(module=node20).js.diff +++ /dev/null @@ -1,34 +0,0 @@ ---- old.nodeModulesImportAssignments(module=node20).js -+++ new.nodeModulesImportAssignments(module=node20).js -@@= skipped -37, +37 lines =@@ - fs.readFile; - exports.fs2 = require("fs"); - //// [index.js] --import { createRequire as _createRequire } from "module"; --const __require = _createRequire(import.meta.url); -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --const fs = __require("fs"); -+const fs = require("fs"); - fs.readFile; --const fs2 = __require("fs"); --export { fs2 }; -+exports.fs2 = require("fs"); - //// [file.js] --import { createRequire as _createRequire_1 } from "module"; --const __require_1 = _createRequire_1(import.meta.url); -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file - const __require = null; - const _createRequire = null; --const fs = __require_1("fs"); -+const fs = require("fs"); - fs.readFile; --const fs2 = __require_1("fs"); --export { fs2 }; -+exports.fs2 = require("fs"); - - - //// [index.d.ts] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node20).errors.txt index d88e87af1e..1e6ecc3460 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node20).errors.txt @@ -1,24 +1,14 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2468: Cannot find global value 'Promise'. -index.ts(1,35): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. otherc.cts(1,35): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -otherc.cts(2,15): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. otherc.cts(2,40): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'node20', 'nodenext', or 'preserve'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2468: Cannot find global value 'Promise'. -==== index.ts (1 errors) ==== +==== index.ts (0 errors) ==== import json from "./package.json" with { type: "json" }; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -==== otherc.cts (3 errors) ==== +==== otherc.cts (2 errors) ==== import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. const json2 = import("./package.json", { with: { type: "json" } }); // should be fine - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'node20', 'nodenext', or 'preserve'. ==== package.json (0 errors) ==== diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node20).errors.txt.diff index 044a03b824..d564201563 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node20).errors.txt.diff @@ -1,31 +1,18 @@ --- old.nodeModulesImportAttributes(module=node20).errors.txt +++ new.nodeModulesImportAttributes(module=node20).errors.txt @@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+error TS2468: Cannot find global value 'Promise'. -+index.ts(1,35): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. otherc.cts(1,35): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -- -- --==== index.ts (0 errors) ==== -+otherc.cts(2,15): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. +otherc.cts(2,40): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'node20', 'nodenext', or 'preserve'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+!!! error TS2468: Cannot find global value 'Promise'. -+==== index.ts (1 errors) ==== + + + ==== index.ts (0 errors) ==== import json from "./package.json" with { type: "json" }; -==== otherc.cts (1 errors) ==== -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -+==== otherc.cts (3 errors) ==== ++==== otherc.cts (2 errors) ==== import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. const json2 = import("./package.json", { with: { type: "json" } }); // should be fine -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. + ~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'node20', 'nodenext', or 'preserve'. ==== package.json (0 errors) ==== diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node20).js index 9653caaf24..fb3984fd32 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node20).js @@ -14,8 +14,7 @@ const json2 = import("./package.json", { with: { type: "json" } }); // should be //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //// [otherc.cjs] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node20).js.diff deleted file mode 100644 index 5fff2feb8f..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributes(module=node20).js.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.nodeModulesImportAttributes(module=node20).js -+++ new.nodeModulesImportAttributes(module=node20).js -@@= skipped -13, +13 lines =@@ - - - //// [index.js] --export {}; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - //// [otherc.cjs] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=node20).errors.txt index 632d06d35e..bf4698ad28 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=node20).errors.txt @@ -1,10 +1,8 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. /index.ts(6,50): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. /index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. /index.ts(7,49): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /index.ts (3 errors) ==== import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=node20).errors.txt.diff deleted file mode 100644 index e0b5269a03..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit1(module=node20).errors.txt.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- old.nodeModulesImportAttributesModeDeclarationEmit1(module=node20).errors.txt -+++ new.nodeModulesImportAttributesModeDeclarationEmit1(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - /index.ts(6,50): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - /index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. - /index.ts(7,49): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== /index.ts (3 errors) ==== - import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; - import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).errors.txt index addbdc7542..5c93150f88 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).errors.txt @@ -1,10 +1,8 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -/index.ts(6,50): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -/index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -/index.ts(7,49): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. +/index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. +/index.ts(6,50): error TS1454: `resolution-mode` can only be set for type-only imports. +/index.ts(7,49): error TS1454: `resolution-mode` can only be set for type-only imports. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /index.ts (3 errors) ==== import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; @@ -12,13 +10,13 @@ error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspeci export interface LocalInterface extends RequireInterface, ImportInterface {} import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; + ~~~~~~~~~~~~~~~~ +!!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS1454: `resolution-mode` can only be set for type-only imports. import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; - ~~~~~~~~~~~~~~~ -!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS1454: `resolution-mode` can only be set for type-only imports. export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).errors.txt.diff deleted file mode 100644 index 80d903d8bd..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).errors.txt.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesImportAttributesModeDeclarationEmit2(module=node20).errors.txt -+++ new.nodeModulesImportAttributesModeDeclarationEmit2(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ --/index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. --/index.ts(6,50): error TS1454: `resolution-mode` can only be set for type-only imports. --/index.ts(7,49): error TS1454: `resolution-mode` can only be set for type-only imports. -- -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+/index.ts(6,50): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -+/index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -+/index.ts(7,49): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== /index.ts (3 errors) ==== - import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; - import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; -@@= skipped -9, +11 lines =@@ - export interface LocalInterface extends RequireInterface, ImportInterface {} - - import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; -- ~~~~~~~~~~~~~~~~ --!!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1454: `resolution-mode` can only be set for type-only imports. -+!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; -+ ~~~~~~~~~~~~~~~ -+!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS1454: `resolution-mode` can only be set for type-only imports. -+!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - export interface Loc extends Req, Imp {} - - export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).js index 69c5d82a55..afe399f85b 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).js @@ -33,8 +33,7 @@ export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).js.diff deleted file mode 100644 index 9b61873921..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).js.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.nodeModulesImportAttributesModeDeclarationEmit2(module=node20).js -+++ new.nodeModulesImportAttributesModeDeclarationEmit2(module=node20).js -@@= skipped -32, +32 lines =@@ - - - //// [index.js] --export {}; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - - - //// [index.d.ts] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).symbols index ad56b2736e..d76777ff60 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).symbols @@ -13,10 +13,10 @@ export interface LocalInterface extends RequireInterface, ImportInterface {} >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; ->RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) >Req : Symbol(Req, Decl(index.ts, 5, 8)) import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) >Imp : Symbol(Imp, Decl(index.ts, 6, 8)) export interface Loc extends Req, Imp {} diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).symbols.diff deleted file mode 100644 index 546fdea999..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmit2(module=node20).symbols.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.nodeModulesImportAttributesModeDeclarationEmit2(module=node20).symbols -+++ new.nodeModulesImportAttributesModeDeclarationEmit2(module=node20).symbols -@@= skipped -12, +12 lines =@@ - >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) - - import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; -+>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) - >Req : Symbol(Req, Decl(index.ts, 5, 8)) - - import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; -->ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) - >Imp : Symbol(Imp, Decl(index.ts, 6, 8)) - - export interface Loc extends Req, Imp {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node20).errors.txt index 88079dbecb..c45ca1322b 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node20).errors.txt @@ -1,4 +1,3 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. /index.ts(2,45): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. /index.ts(2,71): error TS1453: `resolution-mode` should be either `require` or `import`. /index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. @@ -6,7 +5,6 @@ error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspeci /index.ts(6,76): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /index.ts (5 errors) ==== // incorrect mode import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node20).errors.txt.diff deleted file mode 100644 index 9c5c7ae7ba..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesModeDeclarationEmitErrors(module=node20).errors.txt.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.nodeModulesImportAttributesModeDeclarationEmitErrors(module=node20).errors.txt -+++ new.nodeModulesImportAttributesModeDeclarationEmitErrors(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - /index.ts(2,45): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - /index.ts(2,71): error TS1453: `resolution-mode` should be either `require` or `import`. - /index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -@@= skipped -4, +5 lines =@@ - /index.ts(6,76): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== /index.ts (5 errors) ==== - // incorrect mode - import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node20).errors.txt deleted file mode 100644 index bd5d0b5c58..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node20).errors.txt +++ /dev/null @@ -1,28 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -/index.ts(6,14): error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== /index.ts (1 errors) ==== - export type LocalInterface = - & import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface - & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; - - export const a = (null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface); - export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); - ~ -!!! error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. - -==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", - "version": "0.0.1", - "exports": { - "import": "./import.js", - "require": "./require.js" - } - } -==== /node_modules/pkg/import.d.ts (0 errors) ==== - export interface ImportInterface {} -==== /node_modules/pkg/require.d.ts (0 errors) ==== - export interface RequireInterface {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node20).errors.txt.diff deleted file mode 100644 index 83893a3db3..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node20).errors.txt.diff +++ /dev/null @@ -1,32 +0,0 @@ ---- old.nodeModulesImportAttributesTypeModeDeclarationEmit(module=node20).errors.txt -+++ new.nodeModulesImportAttributesTypeModeDeclarationEmit(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+/index.ts(6,14): error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== /index.ts (1 errors) ==== -+ export type LocalInterface = -+ & import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface -+ & import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface; -+ -+ export const a = (null as any as import("pkg", { with: {"resolution-mode": "require"} }).RequireInterface); -+ export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); -+ ~ -+!!! error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. -+ -+==== /node_modules/pkg/package.json (0 errors) ==== -+ { -+ "name": "pkg", -+ "version": "0.0.1", -+ "exports": { -+ "import": "./import.js", -+ "require": "./require.js" -+ } -+ } -+==== /node_modules/pkg/import.d.ts (0 errors) ==== -+ export interface ImportInterface {} -+==== /node_modules/pkg/require.d.ts (0 errors) ==== -+ export interface RequireInterface {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node20).js index 9fbb7e7ce6..cca2ca8a85 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node20).js @@ -33,4 +33,4 @@ exports.b = null; //// [index.d.ts] export type LocalInterface = import("pkg", { with: { "resolution-mode": "require" } }).RequireInterface & import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; export declare const a: import("pkg").RequireInterface; -export declare const b: any; +export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node20).js.diff index 7d0d22ec4b..cd6f54231b 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmit(module=node20).js.diff @@ -5,6 +5,5 @@ //// [index.d.ts] export type LocalInterface = import("pkg", { with: { "resolution-mode": "require" } }).RequireInterface & import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; -export declare const a: import("pkg", { with: { "resolution-mode": "require" } }).RequireInterface; --export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; +export declare const a: import("pkg").RequireInterface; -+export declare const b: any; \ No newline at end of file + export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node20).errors.txt index 858b72088e..1075b870f1 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node20).errors.txt @@ -1,8 +1,5 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2468: Cannot find global value 'Promise'. /index.ts(2,49): error TS1453: `resolution-mode` should be either `require` or `import`. /index.ts(5,76): error TS1453: `resolution-mode` should be either `require` or `import`. -/index.ts(6,14): error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. /other.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? /other.ts(3,22): error TS1005: 'with' expected. /other.ts(3,39): error TS1005: ';' expected. @@ -10,7 +7,6 @@ error TS2468: Cannot find global value 'Promise'. /other.ts(3,51): error TS1128: Declaration or statement expected. /other.ts(3,52): error TS1128: Declaration or statement expected. /other.ts(3,53): error TS2304: Cannot find name 'RequireInterface'. -/other.ts(4,7): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. /other.ts(4,22): error TS2353: Object literal may only specify known properties, and '"resolution-mode"' does not exist in type 'ImportCallOptions'. /other.ts(4,52): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. /other.ts(6,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? @@ -43,8 +39,10 @@ error TS2468: Cannot find global value 'Promise'. /other3.ts(3,55): error TS1005: ';' expected. /other3.ts(3,56): error TS1128: Declaration or statement expected. /other3.ts(3,57): error TS2304: Cannot find name 'RequireInterface'. -/other3.ts(4,7): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -/other3.ts(4,21): error TS2559: Type '{ "resolution-mode": string; }[]' has no properties in common with type 'ImportCallOptions'. +/other3.ts(4,21): error TS2322: Type '{ "resolution-mode": string; }[]' is not assignable to type 'ImportCallOptions'. + Types of property 'with' are incompatible. + Type '(index: number, value: { "resolution-mode": string; }) => { "resolution-mode": string; }[]' is not assignable to type 'ImportAttributes'. + Index signature for type 'string' is missing in type '(index: number, value: { "resolution-mode": string; }) => { "resolution-mode": string; }[]'. /other3.ts(4,56): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. /other3.ts(6,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? /other3.ts(6,48): error TS1005: '{' expected. @@ -60,7 +58,6 @@ error TS2468: Cannot find global value 'Promise'. /other4.ts(6,31): error TS1128: Declaration or statement expected. /other4.ts(6,32): error TS1128: Declaration or statement expected. /other4.ts(6,33): error TS2448: Block-scoped variable 'RequireInterface' used before its declaration. -/other4.ts(7,7): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. /other4.ts(7,21): error TS2448: Block-scoped variable 'Attribute2' used before its declaration. /other4.ts(7,33): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. /other4.ts(9,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? @@ -81,8 +78,6 @@ error TS2468: Cannot find global value 'Promise'. /other5.ts(6,62): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2468: Cannot find global value 'Promise'. ==== /node_modules/pkg/package.json (0 errors) ==== { "name": "pkg", @@ -98,7 +93,7 @@ error TS2468: Cannot find global value 'Promise'. ==== /node_modules/pkg/require.d.ts (0 errors) ==== export interface RequireInterface {} -==== /index.ts (3 errors) ==== +==== /index.ts (2 errors) ==== export type LocalInterface = & import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface ~~~~~~~~ @@ -109,10 +104,8 @@ error TS2468: Cannot find global value 'Promise'. ~~~~~~~~ !!! error TS1453: `resolution-mode` should be either `require` or `import`. export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); - ~ -!!! error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. -==== /other.ts (28 errors) ==== +==== /other.ts (27 errors) ==== // missing with: export type LocalInterface = & import("pkg", {"resolution-mode": "require"}).RequireInterface @@ -132,8 +125,6 @@ error TS2468: Cannot find global value 'Promise'. ~~~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'RequireInterface'. & import("pkg", {"resolution-mode": "import"}).ImportInterface; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ~~~~~~~~~~~~~~~~~ !!! error TS2353: Object literal may only specify known properties, and '"resolution-mode"' does not exist in type 'ImportCallOptions'. ~~~~~~~~~~~~~~~ @@ -201,7 +192,7 @@ error TS2468: Cannot find global value 'Promise'. ~~~~~~~~~~~~~~~ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -==== /other3.ts (17 errors) ==== +==== /other3.ts (16 errors) ==== // Array instead of object-y thing export type LocalInterface = & import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface @@ -219,10 +210,11 @@ error TS2468: Cannot find global value 'Promise'. ~~~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'RequireInterface'. & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2559: Type '{ "resolution-mode": string; }[]' has no properties in common with type 'ImportCallOptions'. +!!! error TS2322: Type '{ "resolution-mode": string; }[]' is not assignable to type 'ImportCallOptions'. +!!! error TS2322: Types of property 'with' are incompatible. +!!! error TS2322: Type '(index: number, value: { "resolution-mode": string; }) => { "resolution-mode": string; }[]' is not assignable to type 'ImportAttributes'. +!!! error TS2322: Index signature for type 'string' is missing in type '(index: number, value: { "resolution-mode": string; }) => { "resolution-mode": string; }[]'. ~~~~~~~~~~~~~~~ !!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. @@ -247,7 +239,7 @@ error TS2468: Cannot find global value 'Promise'. ~ !!! error TS1005: ',' expected. -==== /other4.ts (19 errors) ==== +==== /other4.ts (18 errors) ==== // Indirected attribute objecty-thing - not allowed type Attribute1 = { with: {"resolution-mode": "require"} }; type Attribute2 = { with: {"resolution-mode": "import"} }; @@ -270,8 +262,6 @@ error TS2468: Cannot find global value 'Promise'. !!! error TS2448: Block-scoped variable 'RequireInterface' used before its declaration. !!! related TS2728 /other4.ts:9:60: 'RequireInterface' is declared here. & import("pkg", Attribute2).ImportInterface; - ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ~~~~~~~~~~ !!! error TS2448: Block-scoped variable 'Attribute2' used before its declaration. !!! related TS2728 /other4.ts:10:48: 'Attribute2' is declared here. diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node20).errors.txt.diff deleted file mode 100644 index da3d725881..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node20).errors.txt.diff +++ /dev/null @@ -1,121 +0,0 @@ ---- old.nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node20).errors.txt -+++ new.nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+error TS2468: Cannot find global value 'Promise'. - /index.ts(2,49): error TS1453: `resolution-mode` should be either `require` or `import`. - /index.ts(5,76): error TS1453: `resolution-mode` should be either `require` or `import`. -+/index.ts(6,14): error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. - /other.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? - /other.ts(3,22): error TS1005: 'with' expected. - /other.ts(3,39): error TS1005: ';' expected. -@@= skipped -6, +9 lines =@@ - /other.ts(3,51): error TS1128: Declaration or statement expected. - /other.ts(3,52): error TS1128: Declaration or statement expected. - /other.ts(3,53): error TS2304: Cannot find name 'RequireInterface'. -+/other.ts(4,7): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - /other.ts(4,22): error TS2353: Object literal may only specify known properties, and '"resolution-mode"' does not exist in type 'ImportCallOptions'. - /other.ts(4,52): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. - /other.ts(6,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? -@@= skipped -32, +33 lines =@@ - /other3.ts(3,55): error TS1005: ';' expected. - /other3.ts(3,56): error TS1128: Declaration or statement expected. - /other3.ts(3,57): error TS2304: Cannot find name 'RequireInterface'. --/other3.ts(4,21): error TS2322: Type '{ "resolution-mode": string; }[]' is not assignable to type 'ImportCallOptions'. -- Types of property 'with' are incompatible. -- Type '(index: number, value: { "resolution-mode": string; }) => { "resolution-mode": string; }[]' is not assignable to type 'ImportAttributes'. -- Index signature for type 'string' is missing in type '(index: number, value: { "resolution-mode": string; }) => { "resolution-mode": string; }[]'. -+/other3.ts(4,7): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+/other3.ts(4,21): error TS2559: Type '{ "resolution-mode": string; }[]' has no properties in common with type 'ImportCallOptions'. - /other3.ts(4,56): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. - /other3.ts(6,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? - /other3.ts(6,48): error TS1005: '{' expected. -@@= skipped -19, +17 lines =@@ - /other4.ts(6,31): error TS1128: Declaration or statement expected. - /other4.ts(6,32): error TS1128: Declaration or statement expected. - /other4.ts(6,33): error TS2448: Block-scoped variable 'RequireInterface' used before its declaration. -+/other4.ts(7,7): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - /other4.ts(7,21): error TS2448: Block-scoped variable 'Attribute2' used before its declaration. - /other4.ts(7,33): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. - /other4.ts(9,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? -@@= skipped -20, +21 lines =@@ - /other5.ts(6,62): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+!!! error TS2468: Cannot find global value 'Promise'. - ==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", -@@= skipped -15, +17 lines =@@ - ==== /node_modules/pkg/require.d.ts (0 errors) ==== - export interface RequireInterface {} - --==== /index.ts (2 errors) ==== -+==== /index.ts (3 errors) ==== - export type LocalInterface = - & import("pkg", { with: {"resolution-mode": "foobar"} }).RequireInterface - ~~~~~~~~ -@@= skipped -11, +11 lines =@@ - ~~~~~~~~ - !!! error TS1453: `resolution-mode` should be either `require` or `import`. - export const b = (null as any as import("pkg", { with: {"resolution-mode": "import"} }).ImportInterface); -+ ~ -+!!! error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. - --==== /other.ts (27 errors) ==== -+==== /other.ts (28 errors) ==== - // missing with: - export type LocalInterface = - & import("pkg", {"resolution-mode": "require"}).RequireInterface -@@= skipped -21, +23 lines =@@ - ~~~~~~~~~~~~~~~~ - !!! error TS2304: Cannot find name 'RequireInterface'. - & import("pkg", {"resolution-mode": "import"}).ImportInterface; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - ~~~~~~~~~~~~~~~~~ - !!! error TS2353: Object literal may only specify known properties, and '"resolution-mode"' does not exist in type 'ImportCallOptions'. - ~~~~~~~~~~~~~~~ -@@= skipped -67, +69 lines =@@ - ~~~~~~~~~~~~~~~ - !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. - --==== /other3.ts (16 errors) ==== -+==== /other3.ts (17 errors) ==== - // Array instead of object-y thing - export type LocalInterface = - & import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface -@@= skipped -18, +18 lines =@@ - ~~~~~~~~~~~~~~~~ - !!! error TS2304: Cannot find name 'RequireInterface'. - & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2322: Type '{ "resolution-mode": string; }[]' is not assignable to type 'ImportCallOptions'. --!!! error TS2322: Types of property 'with' are incompatible. --!!! error TS2322: Type '(index: number, value: { "resolution-mode": string; }) => { "resolution-mode": string; }[]' is not assignable to type 'ImportAttributes'. --!!! error TS2322: Index signature for type 'string' is missing in type '(index: number, value: { "resolution-mode": string; }) => { "resolution-mode": string; }[]'. -+!!! error TS2559: Type '{ "resolution-mode": string; }[]' has no properties in common with type 'ImportCallOptions'. - ~~~~~~~~~~~~~~~ - !!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. - -@@= skipped -29, +28 lines =@@ - ~ - !!! error TS1005: ',' expected. - --==== /other4.ts (18 errors) ==== -+==== /other4.ts (19 errors) ==== - // Indirected attribute objecty-thing - not allowed - type Attribute1 = { with: {"resolution-mode": "require"} }; - type Attribute2 = { with: {"resolution-mode": "import"} }; -@@= skipped -23, +23 lines =@@ - !!! error TS2448: Block-scoped variable 'RequireInterface' used before its declaration. - !!! related TS2728 /other4.ts:9:60: 'RequireInterface' is declared here. - & import("pkg", Attribute2).ImportInterface; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - ~~~~~~~~~~ - !!! error TS2448: Block-scoped variable 'Attribute2' used before its declaration. - !!! related TS2728 /other4.ts:10:48: 'Attribute2' is declared here. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node20).js index 3ec56874ba..63b333fded 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node20).js @@ -128,7 +128,7 @@ exports.b = null; //// [index.d.ts] export type LocalInterface = import("pkg", { with: { "resolution-mode": "foobar" } }).RequireInterface & import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; export declare const a: import("pkg").RequireInterface; -export declare const b: any; +export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; //// [other.d.ts] export type LocalInterface = import("pkg", { with: {} }); export declare const a: any; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node20).js.diff index 61fe56d44a..03248211ea 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportAttributesTypeModeDeclarationEmitErrors(module=node20).js.diff @@ -5,9 +5,8 @@ //// [index.d.ts] export type LocalInterface = import("pkg", { with: { "resolution-mode": "foobar" } }).RequireInterface & import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; -export declare const a: import("pkg", { with: { "resolution-mode": "foobar" } }).RequireInterface; --export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; +export declare const a: import("pkg").RequireInterface; -+export declare const b: any; + export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; //// [other.d.ts] export type LocalInterface = import("pkg", { with: {} }); -export declare const a: import("pkg", { with: {} }); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions(module=node20).errors.txt deleted file mode 100644 index 4e7150fb30..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions(module=node20).errors.txt +++ /dev/null @@ -1,32 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== subfolder/index.ts (0 errors) ==== - // cjs format file - import {default as _fs} from "fs"; - _fs.readFile; - import * as fs from "fs"; - fs.readFile; -==== index.ts (0 errors) ==== - // esm format file - import {default as _fs} from "fs"; - _fs.readFile; - import * as fs from "fs"; - fs.readFile; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module" - } -==== subfolder/package.json (0 errors) ==== - { - "type": "commonjs" - } -==== types.d.ts (0 errors) ==== - declare module "fs"; - declare module "tslib" { - export {}; - // intentionally missing all helpers - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions(module=node20).errors.txt.diff index 8e855c24c0..b24e7cf8c7 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions(module=node20).errors.txt.diff @@ -6,19 +6,35 @@ - - -==== subfolder/index.ts (2 errors) ==== -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== subfolder/index.ts (0 errors) ==== - // cjs format file - import {default as _fs} from "fs"; +- // cjs format file +- import {default as _fs} from "fs"; - ~~~~~~~~~~~~~~ -!!! error TS2343: This syntax requires an imported helper named '__importDefault' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. - _fs.readFile; - import * as fs from "fs"; +- _fs.readFile; +- import * as fs from "fs"; - ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2343: This syntax requires an imported helper named '__importStar' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. - fs.readFile; - ==== index.ts (0 errors) ==== - // esm format file \ No newline at end of file +- fs.readFile; +-==== index.ts (0 errors) ==== +- // esm format file +- import {default as _fs} from "fs"; +- _fs.readFile; +- import * as fs from "fs"; +- fs.readFile; +-==== package.json (0 errors) ==== +- { +- "name": "package", +- "private": true, +- "type": "module" +- } +-==== subfolder/package.json (0 errors) ==== +- { +- "type": "commonjs" +- } +-==== types.d.ts (0 errors) ==== +- declare module "fs"; +- declare module "tslib" { +- export {}; +- // intentionally missing all helpers +- } ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions(module=node20).js index aab681b9db..4712d65a09 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions(module=node20).js @@ -32,18 +32,17 @@ declare module "tslib" { //// [index.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); // cjs format file -const fs_1 = require("fs"); +const fs_1 = tslib_1.__importDefault(require("fs")); fs_1.default.readFile; -const fs = require("fs"); +const fs = tslib_1.__importStar(require("fs")); fs.readFile; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const fs_1 = require("fs"); -fs_1.default.readFile; -const fs = require("fs"); +import { default as _fs } from "fs"; +_fs.readFile; +import * as fs from "fs"; fs.readFile; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions(module=node20).js.diff deleted file mode 100644 index 41daad3780..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions(module=node20).js.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.nodeModulesImportHelpersCollisions(module=node20).js -+++ new.nodeModulesImportHelpersCollisions(module=node20).js -@@= skipped -31, +31 lines =@@ - //// [index.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --const tslib_1 = require("tslib"); - // cjs format file --const fs_1 = tslib_1.__importDefault(require("fs")); -+const fs_1 = require("fs"); - fs_1.default.readFile; --const fs = tslib_1.__importStar(require("fs")); -+const fs = require("fs"); - fs.readFile; - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import { default as _fs } from "fs"; --_fs.readFile; --import * as fs from "fs"; -+const fs_1 = require("fs"); -+fs_1.default.readFile; -+const fs = require("fs"); - fs.readFile; - diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions2(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions2(module=node20).errors.txt deleted file mode 100644 index 528640dfca..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions2(module=node20).errors.txt +++ /dev/null @@ -1,28 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== subfolder/index.ts (0 errors) ==== - // cjs format file - export * from "fs"; - export * as fs from "fs"; -==== index.ts (0 errors) ==== - // esm format file - export * from "fs"; - export * as fs from "fs"; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module" - } -==== subfolder/package.json (0 errors) ==== - { - "type": "commonjs" - } -==== types.d.ts (0 errors) ==== - declare module "fs"; - declare module "tslib" { - export {}; - // intentionally missing all helpers - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions2(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions2(module=node20).errors.txt.diff index 98a280a836..a270e18c18 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions2(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions2(module=node20).errors.txt.diff @@ -6,18 +6,31 @@ - - -==== subfolder/index.ts (2 errors) ==== -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== subfolder/index.ts (0 errors) ==== - // cjs format file - export * from "fs"; +- // cjs format file +- export * from "fs"; - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2343: This syntax requires an imported helper named '__exportStar' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. - export * as fs from "fs"; +- export * as fs from "fs"; - ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2343: This syntax requires an imported helper named '__importStar' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. - ==== index.ts (0 errors) ==== - // esm format file - export * from "fs"; \ No newline at end of file +-==== index.ts (0 errors) ==== +- // esm format file +- export * from "fs"; +- export * as fs from "fs"; +-==== package.json (0 errors) ==== +- { +- "name": "package", +- "private": true, +- "type": "module" +- } +-==== subfolder/package.json (0 errors) ==== +- { +- "type": "commonjs" +- } +-==== types.d.ts (0 errors) ==== +- declare module "fs"; +- declare module "tslib" { +- export {}; +- // intentionally missing all helpers +- } ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions2(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions2(module=node20).js index 261ce2d4e5..c058d00e21 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions2(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions2(module=node20).js @@ -32,15 +32,11 @@ exports.fs = void 0; const tslib_1 = require("tslib"); // cjs format file tslib_1.__exportStar(require("fs"), exports); -exports.fs = require("fs"); +exports.fs = tslib_1.__importStar(require("fs")); //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.fs = void 0; -const tslib_1 = require("tslib"); // esm format file -tslib_1.__exportStar(require("fs"), exports); -exports.fs = require("fs"); +export * from "fs"; +export * as fs from "fs"; //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions2(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions2(module=node20).js.diff deleted file mode 100644 index a7ab464c9d..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions2(module=node20).js.diff +++ /dev/null @@ -1,21 +0,0 @@ ---- old.nodeModulesImportHelpersCollisions2(module=node20).js -+++ new.nodeModulesImportHelpersCollisions2(module=node20).js -@@= skipped -31, +31 lines =@@ - const tslib_1 = require("tslib"); - // cjs format file - tslib_1.__exportStar(require("fs"), exports); --exports.fs = tslib_1.__importStar(require("fs")); -+exports.fs = require("fs"); - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.fs = void 0; -+const tslib_1 = require("tslib"); - // esm format file --export * from "fs"; --export * as fs from "fs"; -+tslib_1.__exportStar(require("fs"), exports); -+exports.fs = require("fs"); - - - //// [index.d.ts] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions3(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions3(module=node20).errors.txt deleted file mode 100644 index 0554ea2a84..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions3(module=node20).errors.txt +++ /dev/null @@ -1,26 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== subfolder/index.ts (0 errors) ==== - // cjs format file - export {default} from "fs"; -==== index.ts (0 errors) ==== - // esm format file - export {default} from "fs"; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module" - } -==== subfolder/package.json (0 errors) ==== - { - "type": "commonjs" - } -==== types.d.ts (0 errors) ==== - declare module "fs"; - declare module "tslib" { - export {}; - // intentionally missing all helpers - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions3(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions3(module=node20).errors.txt.diff index 33922b346e..de662bf184 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions3(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions3(module=node20).errors.txt.diff @@ -5,15 +5,27 @@ - - -==== subfolder/index.ts (1 errors) ==== -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== subfolder/index.ts (0 errors) ==== - // cjs format file - export {default} from "fs"; +- // cjs format file +- export {default} from "fs"; - ~~~~~~~ -!!! error TS2343: This syntax requires an imported helper named '__importDefault' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. - ==== index.ts (0 errors) ==== - // esm format file - export {default} from "fs"; \ No newline at end of file +-==== index.ts (0 errors) ==== +- // esm format file +- export {default} from "fs"; +-==== package.json (0 errors) ==== +- { +- "name": "package", +- "private": true, +- "type": "module" +- } +-==== subfolder/package.json (0 errors) ==== +- { +- "type": "commonjs" +- } +-==== types.d.ts (0 errors) ==== +- declare module "fs"; +- declare module "tslib" { +- export {}; +- // intentionally missing all helpers +- } ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions3(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions3(module=node20).js index 95fcaaf972..f0c393ef76 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions3(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions3(module=node20).js @@ -27,16 +27,13 @@ declare module "tslib" { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; +const tslib_1 = require("tslib"); // cjs format file const fs_1 = require("fs"); -Object.defineProperty(exports, "default", { enumerable: true, get: function () { return fs_1.default; } }); +Object.defineProperty(exports, "default", { enumerable: true, get: function () { return tslib_1.__importDefault(fs_1).default; } }); //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = void 0; // esm format file -const fs_1 = require("fs"); -Object.defineProperty(exports, "default", { enumerable: true, get: function () { return fs_1.default; } }); +export { default } from "fs"; //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions3(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions3(module=node20).js.diff index b140abfd97..e4ae6774d8 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions3(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportHelpersCollisions3(module=node20).js.diff @@ -5,19 +5,10 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; -var tslib_1 = require("tslib"); ++const tslib_1 = require("tslib"); // cjs format file -var fs_1 = require("fs"); --Object.defineProperty(exports, "default", { enumerable: true, get: function () { return tslib_1.__importDefault(fs_1).default; } }); +const fs_1 = require("fs"); -+Object.defineProperty(exports, "default", { enumerable: true, get: function () { return fs_1.default; } }); + Object.defineProperty(exports, "default", { enumerable: true, get: function () { return tslib_1.__importDefault(fs_1).default; } }); //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.default = void 0; - // esm format file --export { default } from "fs"; -+const fs_1 = require("fs"); -+Object.defineProperty(exports, "default", { enumerable: true, get: function () { return fs_1.default; } }); - - - //// [index.d.ts] \ No newline at end of file + // esm format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportMeta(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportMeta(module=node20).errors.txt index fc1e358478..dc4849ff50 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportMeta(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportMeta(module=node20).errors.txt @@ -1,20 +1,15 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -index.ts(2,11): error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. subfolder/index.ts(2,11): error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== subfolder/index.ts (1 errors) ==== // cjs format file const x = import.meta.url; ~~~~~~~~~~~ !!! error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. export {x}; -==== index.ts (1 errors) ==== +==== index.ts (0 errors) ==== // esm format file const x = import.meta.url; - ~~~~~~~~~~~ -!!! error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. export {x}; ==== package.json (0 errors) ==== { diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportMeta(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportMeta(module=node20).errors.txt.diff deleted file mode 100644 index 977ab6e7c5..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportMeta(module=node20).errors.txt.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- old.nodeModulesImportMeta(module=node20).errors.txt -+++ new.nodeModulesImportMeta(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+index.ts(2,11): error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. - subfolder/index.ts(2,11): error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== subfolder/index.ts (1 errors) ==== - // cjs format file - const x = import.meta.url; - ~~~~~~~~~~~ - !!! error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. - export {x}; --==== index.ts (0 errors) ==== -+==== index.ts (1 errors) ==== - // esm format file - const x = import.meta.url; -+ ~~~~~~~~~~~ -+!!! error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. - export {x}; - ==== package.json (0 errors) ==== - { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportMeta(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportMeta(module=node20).js index a42ca0aa55..aa962a90bd 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportMeta(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportMeta(module=node20).js @@ -27,12 +27,9 @@ exports.x = void 0; const x = import.meta.url; exports.x = x; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = import.meta.url; -exports.x = x; +export { x }; //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportMeta(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportMeta(module=node20).js.diff deleted file mode 100644 index 49987bc374..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportMeta(module=node20).js.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.nodeModulesImportMeta(module=node20).js -+++ new.nodeModulesImportMeta(module=node20).js -@@= skipped -26, +26 lines =@@ - const x = import.meta.url; - exports.x = x; - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; - // esm format file - const x = import.meta.url; --export { x }; -+exports.x = x; - - - //// [index.d.ts] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=node20).errors.txt index 138464954c..b81d5cf9c7 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=node20).errors.txt @@ -1,10 +1,8 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -/index.ts(6,50): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +/index.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. /index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -/index.ts(7,49): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +/index.ts(7,49): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /index.ts (3 errors) ==== import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; @@ -13,12 +11,12 @@ error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspeci import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=node20).errors.txt.diff index 08f7f04a96..08655babfe 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit1(module=node20).errors.txt.diff @@ -1,35 +1,17 @@ --- old.nodeModulesImportModeDeclarationEmit1(module=node20).errors.txt +++ new.nodeModulesImportModeDeclarationEmit1(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ --/index.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+/index.ts(6,50): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. - /index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. --/index.ts(7,49): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -- -- -+/index.ts(7,49): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== /index.ts (3 errors) ==== - import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; - import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; -@@= skipped -9, +11 lines =@@ +@@= skipped -9, +9 lines =@@ export interface LocalInterface extends RequireInterface, ImportInterface {} import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; - ~~~~~~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. + !!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. - ~~~~~~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. + !!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. export interface Loc extends Req, Imp {} - - export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; \ No newline at end of file + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).errors.txt index e9b0ad8554..4d278fd27c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).errors.txt @@ -1,10 +1,8 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -/index.ts(6,50): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -/index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -/index.ts(7,49): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +/index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. +/index.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/index.ts(7,49): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /index.ts (3 errors) ==== import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; @@ -12,13 +10,13 @@ error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspeci export interface LocalInterface extends RequireInterface, ImportInterface {} import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; + ~~~~~~~~~~~~~~~~ +!!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; - ~~~~~~~~~~~~~~~ -!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. export interface Loc extends Req, Imp {} export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).errors.txt.diff index 9268ebaf28..5cc2b7a0cb 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).errors.txt.diff @@ -1,38 +1,15 @@ --- old.nodeModulesImportModeDeclarationEmit2(module=node20).errors.txt +++ new.nodeModulesImportModeDeclarationEmit2(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ --/index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. --/index.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. --/index.ts(7,49): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -- -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+/index.ts(6,50): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -+/index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -+/index.ts(7,49): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== /index.ts (3 errors) ==== - import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; - import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; -@@= skipped -9, +11 lines =@@ - export interface LocalInterface extends RequireInterface, ImportInterface {} - +@@= skipped -11, +11 lines =@@ import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; -- ~~~~~~~~~~~~~~~~ --!!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. + ~~~~~~~~~~~~~~~~ + !!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. - ~~~~~~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. + !!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; - ~~~~~~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -+ ~~~~~~~~~~~~~~~ -+!!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. + !!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. export interface Loc extends Req, Imp {} - - export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; \ No newline at end of file + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).js index 7495778bd6..fad19d466a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).js @@ -33,8 +33,7 @@ export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).js.diff deleted file mode 100644 index bf70dd1922..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).js.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.nodeModulesImportModeDeclarationEmit2(module=node20).js -+++ new.nodeModulesImportModeDeclarationEmit2(module=node20).js -@@= skipped -32, +32 lines =@@ - - - //// [index.js] --export {}; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - - - //// [index.d.ts] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).symbols index 21ec7573e9..8d280aee6f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).symbols @@ -13,10 +13,10 @@ export interface LocalInterface extends RequireInterface, ImportInterface {} >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; ->RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) >Req : Symbol(Req, Decl(index.ts, 5, 8)) import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) >Imp : Symbol(Imp, Decl(index.ts, 6, 8)) export interface Loc extends Req, Imp {} diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).symbols.diff deleted file mode 100644 index a3ae55dd43..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmit2(module=node20).symbols.diff +++ /dev/null @@ -1,14 +0,0 @@ ---- old.nodeModulesImportModeDeclarationEmit2(module=node20).symbols -+++ new.nodeModulesImportModeDeclarationEmit2(module=node20).symbols -@@= skipped -12, +12 lines =@@ - >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) - - import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; -+>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) - >Req : Symbol(Req, Decl(index.ts, 5, 8)) - - import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; -->ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) - >Imp : Symbol(Imp, Decl(index.ts, 6, 8)) - - export interface Loc extends Req, Imp {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=node20).errors.txt index 1c6cd18d79..3615fe44ff 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=node20).errors.txt @@ -1,17 +1,15 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -/index.ts(2,45): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +/index.ts(2,45): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. /index.ts(2,73): error TS1453: `resolution-mode` should be either `require` or `import`. /index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -/index.ts(4,39): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -/index.ts(6,76): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +/index.ts(4,39): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/index.ts(6,76): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /index.ts (5 errors) ==== // incorrect mode import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ~~~~~~~~ !!! error TS1453: `resolution-mode` should be either `require` or `import`. // not type-only @@ -19,11 +17,11 @@ error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspeci ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. // not exclusively type-only import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. export interface LocalInterface extends RequireInterface, ImportInterface {} diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=node20).errors.txt.diff index 338a065a9a..4dd761a4be 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportModeDeclarationEmitErrors1(module=node20).errors.txt.diff @@ -1,43 +1,25 @@ --- old.nodeModulesImportModeDeclarationEmitErrors1(module=node20).errors.txt +++ new.nodeModulesImportModeDeclarationEmitErrors1(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ --/index.ts(2,45): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+/index.ts(2,45): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. - /index.ts(2,73): error TS1453: `resolution-mode` should be either `require` or `import`. - /index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. --/index.ts(4,39): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. --/index.ts(6,76): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -- -- -+/index.ts(4,39): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -+/index.ts(6,76): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. +@@= skipped -7, +7 lines =@@ ==== /index.ts (5 errors) ==== // incorrect mode import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; - ~~~~~~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. + !!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ~~~~~~~~ !!! error TS1453: `resolution-mode` should be either `require` or `import`. - // not type-only +@@= skipped -8, +8 lines =@@ import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. - ~~~~~~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. + !!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. // not exclusively type-only import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; - ~~~~~~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. + !!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - export interface LocalInterface extends RequireInterface, ImportInterface {} - \ No newline at end of file + export interface LocalInterface extends RequireInterface, ImportInterface {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionIntoExport(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionIntoExport(module=node20).errors.txt deleted file mode 100644 index d176b3aa9a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionIntoExport(module=node20).errors.txt +++ /dev/null @@ -1,26 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== index.ts (0 errors) ==== - // esm format file - import * as type from "#type"; - type; -==== index.mts (0 errors) ==== - // esm format file - import * as type from "#type"; - type; -==== index.cts (0 errors) ==== - // esm format file - import * as type from "#type"; - type; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module", - "exports": "./index.cjs", - "imports": { - "#type": "package" - } - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionIntoExport(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionIntoExport(module=node20).errors.txt.diff deleted file mode 100644 index b4d424595c..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionIntoExport(module=node20).errors.txt.diff +++ /dev/null @@ -1,30 +0,0 @@ ---- old.nodeModulesImportResolutionIntoExport(module=node20).errors.txt -+++ new.nodeModulesImportResolutionIntoExport(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== index.ts (0 errors) ==== -+ // esm format file -+ import * as type from "#type"; -+ type; -+==== index.mts (0 errors) ==== -+ // esm format file -+ import * as type from "#type"; -+ type; -+==== index.cts (0 errors) ==== -+ // esm format file -+ import * as type from "#type"; -+ type; -+==== package.json (0 errors) ==== -+ { -+ "name": "package", -+ "private": true, -+ "type": "module", -+ "exports": "./index.cjs", -+ "imports": { -+ "#type": "package" -+ } -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionIntoExport(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionIntoExport(module=node20).js index 1a56ef1572..a60b20a63d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionIntoExport(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionIntoExport(module=node20).js @@ -25,21 +25,50 @@ type; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const type = require("#type"); +const type = __importStar(require("#type")); type; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const type = require("#type"); +import * as type from "#type"; type; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const type = require("#type"); +import * as type from "#type"; type; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionIntoExport(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionIntoExport(module=node20).js.diff deleted file mode 100644 index dfe7aff034..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionIntoExport(module=node20).js.diff +++ /dev/null @@ -1,59 +0,0 @@ ---- old.nodeModulesImportResolutionIntoExport(module=node20).js -+++ new.nodeModulesImportResolutionIntoExport(module=node20).js -@@= skipped -24, +24 lines =@@ - - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --const type = __importStar(require("#type")); -+const type = require("#type"); - type; - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as type from "#type"; -+const type = require("#type"); - type; - //// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as type from "#type"; -+const type = require("#type"); - type; - diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionNoCycle(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionNoCycle(module=node20).errors.txt index 5e909768fb..01d8a2fd08 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionNoCycle(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionNoCycle(module=node20).errors.txt @@ -1,10 +1,8 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. index.cts(2,23): error TS2307: Cannot find module '#type' or its corresponding type declarations. index.mts(2,23): error TS2307: Cannot find module '#type' or its corresponding type declarations. index.ts(2,23): error TS2307: Cannot find module '#type' or its corresponding type declarations. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== index.ts (1 errors) ==== // esm format file import * as type from "#type"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionNoCycle(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionNoCycle(module=node20).errors.txt.diff deleted file mode 100644 index 095146d6a2..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionNoCycle(module=node20).errors.txt.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- old.nodeModulesImportResolutionNoCycle(module=node20).errors.txt -+++ new.nodeModulesImportResolutionNoCycle(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - index.cts(2,23): error TS2307: Cannot find module '#type' or its corresponding type declarations. - index.mts(2,23): error TS2307: Cannot find module '#type' or its corresponding type declarations. - index.ts(2,23): error TS2307: Cannot find module '#type' or its corresponding type declarations. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== index.ts (1 errors) ==== - // esm format file - import * as type from "#type"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionNoCycle(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionNoCycle(module=node20).js index 4d9239ee43..fa6401e1a4 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionNoCycle(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionNoCycle(module=node20).js @@ -24,22 +24,51 @@ type; } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const type = require("#type"); +import * as type from "#type"; type; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const type = require("#type"); +import * as type from "#type"; type; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const type = require("#type"); +const type = __importStar(require("#type")); type; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionNoCycle(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionNoCycle(module=node20).js.diff deleted file mode 100644 index fb7688b906..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportResolutionNoCycle(module=node20).js.diff +++ /dev/null @@ -1,60 +0,0 @@ ---- old.nodeModulesImportResolutionNoCycle(module=node20).js -+++ new.nodeModulesImportResolutionNoCycle(module=node20).js -@@= skipped -23, +23 lines =@@ - } - - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as type from "#type"; -+const type = require("#type"); - type; - //// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as type from "#type"; -+const type = require("#type"); - type; - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --const type = __importStar(require("#type")); -+const type = require("#type"); - type; - diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node20).errors.txt deleted file mode 100644 index 6dcd7d2b07..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node20).errors.txt +++ /dev/null @@ -1,28 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -/index.ts(6,14): error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== /index.ts (1 errors) ==== - export type LocalInterface = - & import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface - & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; - - export const a = (null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface); - export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); - ~ -!!! error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. - -==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", - "version": "0.0.1", - "exports": { - "import": "./import.js", - "require": "./require.js" - } - } -==== /node_modules/pkg/import.d.ts (0 errors) ==== - export interface ImportInterface {} -==== /node_modules/pkg/require.d.ts (0 errors) ==== - export interface RequireInterface {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node20).errors.txt.diff deleted file mode 100644 index 5090854ce7..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node20).errors.txt.diff +++ /dev/null @@ -1,32 +0,0 @@ ---- old.nodeModulesImportTypeModeDeclarationEmit1(module=node20).errors.txt -+++ new.nodeModulesImportTypeModeDeclarationEmit1(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+/index.ts(6,14): error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== /index.ts (1 errors) ==== -+ export type LocalInterface = -+ & import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface -+ & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; -+ -+ export const a = (null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface); -+ export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); -+ ~ -+!!! error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. -+ -+==== /node_modules/pkg/package.json (0 errors) ==== -+ { -+ "name": "pkg", -+ "version": "0.0.1", -+ "exports": { -+ "import": "./import.js", -+ "require": "./require.js" -+ } -+ } -+==== /node_modules/pkg/import.d.ts (0 errors) ==== -+ export interface ImportInterface {} -+==== /node_modules/pkg/require.d.ts (0 errors) ==== -+ export interface RequireInterface {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node20).js index 26d582ef14..6c0a3531fa 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node20).js @@ -33,4 +33,4 @@ exports.b = null; //// [index.d.ts] export type LocalInterface = import("pkg", { assert: { "resolution-mode": "require" } }).RequireInterface & import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; export declare const a: import("pkg").RequireInterface; -export declare const b: any; +export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node20).js.diff deleted file mode 100644 index e10cb6750a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node20).js.diff +++ /dev/null @@ -1,8 +0,0 @@ ---- old.nodeModulesImportTypeModeDeclarationEmit1(module=node20).js -+++ new.nodeModulesImportTypeModeDeclarationEmit1(module=node20).js -@@= skipped -32, +32 lines =@@ - //// [index.d.ts] - export type LocalInterface = import("pkg", { assert: { "resolution-mode": "require" } }).RequireInterface & import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; - export declare const a: import("pkg").RequireInterface; --export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; -+export declare const b: any; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).errors.txt index 6bd5fde7a4..632a556e13 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).errors.txt @@ -1,8 +1,5 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2468: Cannot find global value 'Promise'. /index.ts(2,51): error TS1453: `resolution-mode` should be either `require` or `import`. /index.ts(5,78): error TS1453: `resolution-mode` should be either `require` or `import`. -/index.ts(6,14): error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. /other.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? /other.ts(3,22): error TS1005: 'with' expected. /other.ts(3,39): error TS1005: ';' expected. @@ -10,7 +7,6 @@ error TS2468: Cannot find global value 'Promise'. /other.ts(3,51): error TS1128: Declaration or statement expected. /other.ts(3,52): error TS1128: Declaration or statement expected. /other.ts(3,53): error TS2304: Cannot find name 'RequireInterface'. -/other.ts(4,7): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. /other.ts(4,22): error TS2353: Object literal may only specify known properties, and '"resolution-mode"' does not exist in type 'ImportCallOptions'. /other.ts(4,52): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. /other.ts(6,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? @@ -43,8 +39,10 @@ error TS2468: Cannot find global value 'Promise'. /other3.ts(3,55): error TS1005: ';' expected. /other3.ts(3,56): error TS1128: Declaration or statement expected. /other3.ts(3,57): error TS2304: Cannot find name 'RequireInterface'. -/other3.ts(4,7): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -/other3.ts(4,21): error TS2559: Type '{ "resolution-mode": string; }[]' has no properties in common with type 'ImportCallOptions'. +/other3.ts(4,21): error TS2322: Type '{ "resolution-mode": string; }[]' is not assignable to type 'ImportCallOptions'. + Types of property 'with' are incompatible. + Type '(index: number, value: { "resolution-mode": string; }) => { "resolution-mode": string; }[]' is not assignable to type 'ImportAttributes'. + Index signature for type 'string' is missing in type '(index: number, value: { "resolution-mode": string; }) => { "resolution-mode": string; }[]'. /other3.ts(4,56): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. /other3.ts(6,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? /other3.ts(6,48): error TS1005: '{' expected. @@ -60,7 +58,6 @@ error TS2468: Cannot find global value 'Promise'. /other4.ts(6,29): error TS1128: Declaration or statement expected. /other4.ts(6,30): error TS1128: Declaration or statement expected. /other4.ts(6,31): error TS2448: Block-scoped variable 'RequireInterface' used before its declaration. -/other4.ts(7,7): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. /other4.ts(7,21): error TS2448: Block-scoped variable 'Asserts2' used before its declaration. /other4.ts(7,31): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. /other4.ts(9,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? @@ -81,8 +78,6 @@ error TS2468: Cannot find global value 'Promise'. /other5.ts(6,64): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2468: Cannot find global value 'Promise'. ==== /node_modules/pkg/package.json (0 errors) ==== { "name": "pkg", @@ -96,7 +91,7 @@ error TS2468: Cannot find global value 'Promise'. export interface ImportInterface {} ==== /node_modules/pkg/require.d.ts (0 errors) ==== export interface RequireInterface {} -==== /index.ts (3 errors) ==== +==== /index.ts (2 errors) ==== export type LocalInterface = & import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface ~~~~~~~~ @@ -107,9 +102,7 @@ error TS2468: Cannot find global value 'Promise'. ~~~~~~~~ !!! error TS1453: `resolution-mode` should be either `require` or `import`. export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); - ~ -!!! error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. -==== /other.ts (28 errors) ==== +==== /other.ts (27 errors) ==== // missing assert: export type LocalInterface = & import("pkg", {"resolution-mode": "require"}).RequireInterface @@ -129,8 +122,6 @@ error TS2468: Cannot find global value 'Promise'. ~~~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'RequireInterface'. & import("pkg", {"resolution-mode": "import"}).ImportInterface; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ~~~~~~~~~~~~~~~~~ !!! error TS2353: Object literal may only specify known properties, and '"resolution-mode"' does not exist in type 'ImportCallOptions'. ~~~~~~~~~~~~~~~ @@ -196,7 +187,7 @@ error TS2468: Cannot find global value 'Promise'. !!! error TS1455: `resolution-mode` is the only valid key for type import assertions. ~~~~~~~~~~~~~~~ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -==== /other3.ts (17 errors) ==== +==== /other3.ts (16 errors) ==== // Array instead of object-y thing export type LocalInterface = & import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface @@ -214,10 +205,11 @@ error TS2468: Cannot find global value 'Promise'. ~~~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'RequireInterface'. & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2559: Type '{ "resolution-mode": string; }[]' has no properties in common with type 'ImportCallOptions'. +!!! error TS2322: Type '{ "resolution-mode": string; }[]' is not assignable to type 'ImportCallOptions'. +!!! error TS2322: Types of property 'with' are incompatible. +!!! error TS2322: Type '(index: number, value: { "resolution-mode": string; }) => { "resolution-mode": string; }[]' is not assignable to type 'ImportAttributes'. +!!! error TS2322: Index signature for type 'string' is missing in type '(index: number, value: { "resolution-mode": string; }) => { "resolution-mode": string; }[]'. ~~~~~~~~~~~~~~~ !!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. @@ -241,7 +233,7 @@ error TS2468: Cannot find global value 'Promise'. !!! error TS2538: Type '{ "resolution-mode": "import"; }' cannot be used as an index type. ~ !!! error TS1005: ',' expected. -==== /other4.ts (19 errors) ==== +==== /other4.ts (18 errors) ==== // Indirected assertion objecty-thing - not allowed type Asserts1 = { assert: {"resolution-mode": "require"} }; type Asserts2 = { assert: {"resolution-mode": "import"} }; @@ -264,8 +256,6 @@ error TS2468: Cannot find global value 'Promise'. !!! error TS2448: Block-scoped variable 'RequireInterface' used before its declaration. !!! related TS2728 /other4.ts:9:58: 'RequireInterface' is declared here. & import("pkg", Asserts2).ImportInterface; - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. ~~~~~~~~ !!! error TS2448: Block-scoped variable 'Asserts2' used before its declaration. !!! related TS2728 /other4.ts:10:48: 'Asserts2' is declared here. diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).errors.txt.diff deleted file mode 100644 index 7cdb0b84c9..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).errors.txt.diff +++ /dev/null @@ -1,120 +0,0 @@ ---- old.nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).errors.txt -+++ new.nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+error TS2468: Cannot find global value 'Promise'. - /index.ts(2,51): error TS1453: `resolution-mode` should be either `require` or `import`. - /index.ts(5,78): error TS1453: `resolution-mode` should be either `require` or `import`. -+/index.ts(6,14): error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. - /other.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? - /other.ts(3,22): error TS1005: 'with' expected. - /other.ts(3,39): error TS1005: ';' expected. -@@= skipped -6, +9 lines =@@ - /other.ts(3,51): error TS1128: Declaration or statement expected. - /other.ts(3,52): error TS1128: Declaration or statement expected. - /other.ts(3,53): error TS2304: Cannot find name 'RequireInterface'. -+/other.ts(4,7): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - /other.ts(4,22): error TS2353: Object literal may only specify known properties, and '"resolution-mode"' does not exist in type 'ImportCallOptions'. - /other.ts(4,52): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. - /other.ts(6,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? -@@= skipped -32, +33 lines =@@ - /other3.ts(3,55): error TS1005: ';' expected. - /other3.ts(3,56): error TS1128: Declaration or statement expected. - /other3.ts(3,57): error TS2304: Cannot find name 'RequireInterface'. --/other3.ts(4,21): error TS2322: Type '{ "resolution-mode": string; }[]' is not assignable to type 'ImportCallOptions'. -- Types of property 'with' are incompatible. -- Type '(index: number, value: { "resolution-mode": string; }) => { "resolution-mode": string; }[]' is not assignable to type 'ImportAttributes'. -- Index signature for type 'string' is missing in type '(index: number, value: { "resolution-mode": string; }) => { "resolution-mode": string; }[]'. -+/other3.ts(4,7): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+/other3.ts(4,21): error TS2559: Type '{ "resolution-mode": string; }[]' has no properties in common with type 'ImportCallOptions'. - /other3.ts(4,56): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. - /other3.ts(6,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? - /other3.ts(6,48): error TS1005: '{' expected. -@@= skipped -19, +17 lines =@@ - /other4.ts(6,29): error TS1128: Declaration or statement expected. - /other4.ts(6,30): error TS1128: Declaration or statement expected. - /other4.ts(6,31): error TS2448: Block-scoped variable 'RequireInterface' used before its declaration. -+/other4.ts(7,7): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - /other4.ts(7,21): error TS2448: Block-scoped variable 'Asserts2' used before its declaration. - /other4.ts(7,31): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. - /other4.ts(9,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? -@@= skipped -20, +21 lines =@@ - /other5.ts(6,64): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+!!! error TS2468: Cannot find global value 'Promise'. - ==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", -@@= skipped -13, +15 lines =@@ - export interface ImportInterface {} - ==== /node_modules/pkg/require.d.ts (0 errors) ==== - export interface RequireInterface {} --==== /index.ts (2 errors) ==== -+==== /index.ts (3 errors) ==== - export type LocalInterface = - & import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface - ~~~~~~~~ -@@= skipped -11, +11 lines =@@ - ~~~~~~~~ - !!! error TS1453: `resolution-mode` should be either `require` or `import`. - export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); --==== /other.ts (27 errors) ==== -+ ~ -+!!! error TS2742: The inferred type of 'b' cannot be named without a reference to './node_modules/pkg/import'. This is likely not portable. A type annotation is necessary. -+==== /other.ts (28 errors) ==== - // missing assert: - export type LocalInterface = - & import("pkg", {"resolution-mode": "require"}).RequireInterface -@@= skipped -20, +22 lines =@@ - ~~~~~~~~~~~~~~~~ - !!! error TS2304: Cannot find name 'RequireInterface'. - & import("pkg", {"resolution-mode": "import"}).ImportInterface; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - ~~~~~~~~~~~~~~~~~ - !!! error TS2353: Object literal may only specify known properties, and '"resolution-mode"' does not exist in type 'ImportCallOptions'. - ~~~~~~~~~~~~~~~ -@@= skipped -65, +67 lines =@@ - !!! error TS1455: `resolution-mode` is the only valid key for type import assertions. - ~~~~~~~~~~~~~~~ - !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. --==== /other3.ts (16 errors) ==== -+==== /other3.ts (17 errors) ==== - // Array instead of object-y thing - export type LocalInterface = - & import("pkg", [ {"resolution-mode": "require"} ]).RequireInterface -@@= skipped -18, +18 lines =@@ - ~~~~~~~~~~~~~~~~ - !!! error TS2304: Cannot find name 'RequireInterface'. - & import("pkg", [ {"resolution-mode": "import"} ]).ImportInterface; -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2322: Type '{ "resolution-mode": string; }[]' is not assignable to type 'ImportCallOptions'. --!!! error TS2322: Types of property 'with' are incompatible. --!!! error TS2322: Type '(index: number, value: { "resolution-mode": string; }) => { "resolution-mode": string; }[]' is not assignable to type 'ImportAttributes'. --!!! error TS2322: Index signature for type 'string' is missing in type '(index: number, value: { "resolution-mode": string; }) => { "resolution-mode": string; }[]'. -+!!! error TS2559: Type '{ "resolution-mode": string; }[]' has no properties in common with type 'ImportCallOptions'. - ~~~~~~~~~~~~~~~ - !!! error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. - -@@= skipped -28, +27 lines =@@ - !!! error TS2538: Type '{ "resolution-mode": "import"; }' cannot be used as an index type. - ~ - !!! error TS1005: ',' expected. --==== /other4.ts (18 errors) ==== -+==== /other4.ts (19 errors) ==== - // Indirected assertion objecty-thing - not allowed - type Asserts1 = { assert: {"resolution-mode": "require"} }; - type Asserts2 = { assert: {"resolution-mode": "import"} }; -@@= skipped -23, +23 lines =@@ - !!! error TS2448: Block-scoped variable 'RequireInterface' used before its declaration. - !!! related TS2728 /other4.ts:9:58: 'RequireInterface' is declared here. - & import("pkg", Asserts2).ImportInterface; -+ ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - ~~~~~~~~ - !!! error TS2448: Block-scoped variable 'Asserts2' used before its declaration. - !!! related TS2728 /other4.ts:10:48: 'Asserts2' is declared here. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).js index 6b491cb1bd..061f57d2e6 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).js @@ -122,7 +122,7 @@ exports.b = null; //// [index.d.ts] export type LocalInterface = import("pkg", { assert: { "resolution-mode": "foobar" } }).RequireInterface & import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; export declare const a: import("pkg").RequireInterface; -export declare const b: any; +export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; //// [other.d.ts] export type LocalInterface = import("pkg", { with: {} }); export declare const a: any; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).js.diff index c7446b4bba..82d0678794 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).js.diff @@ -1,11 +1,7 @@ --- old.nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).js +++ new.nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).js -@@= skipped -121, +121 lines =@@ - //// [index.d.ts] - export type LocalInterface = import("pkg", { assert: { "resolution-mode": "foobar" } }).RequireInterface & import("pkg", { assert: { "resolution-mode": "import" } }).ImportInterface; - export declare const a: import("pkg").RequireInterface; --export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; -+export declare const b: any; +@@= skipped -124, +124 lines =@@ + export declare const b: import("pkg", { with: { "resolution-mode": "import" } }).ImportInterface; //// [other.d.ts] export type LocalInterface = import("pkg", { with: {} }); -export declare const a: import("pkg", { with: {} }); @@ -15,7 +11,7 @@ //// [other2.d.ts] export type LocalInterface = import("pkg", { assert: { "bad": "require" } }).RequireInterface & import("pkg", { assert: { "bad": "import" } }).ImportInterface; export declare const a: import("pkg").RequireInterface; -@@= skipped -17, +17 lines =@@ +@@= skipped -14, +14 lines =@@ export declare const b: any; //// [other4.d.ts] export type LocalInterface = import("pkg", { with: {} }); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node20).errors.txt index 0ab4871a8a..d828b1b8da 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node20).errors.txt @@ -1,4 +1,3 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. /loosey.cts(1,36): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. /loosey.cts(6,9): error TS2339: Property 'default' does not exist on type '{ version: number; }'. /main.mts(2,22): error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'Node20'. @@ -9,7 +8,6 @@ error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspeci /main.mts(12,9): error TS2339: Property 'version' does not exist on type '{ default: { version: number; }; }'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /node_modules/not.json/package.json (0 errors) ==== { "name": "not.json", diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node20).errors.txt.diff deleted file mode 100644 index 1841f1f7bf..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesJson(module=node20).errors.txt.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.nodeModulesJson(module=node20).errors.txt -+++ new.nodeModulesJson(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - /loosey.cts(1,36): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - /loosey.cts(6,9): error TS2339: Property 'default' does not exist on type '{ version: number; }'. - /main.mts(2,22): error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'Node20'. -@@= skipped -7, +8 lines =@@ - /main.mts(12,9): error TS2339: Property 'version' does not exist on type '{ default: { version: number; }; }'. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== /node_modules/not.json/package.json (0 errors) ==== - { - "name": "not.json", \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).errors.txt index c3a3b37e59..4c1ba7fcce 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).errors.txt @@ -1,30 +1,15 @@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. +index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. +index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. index.cts(9,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.ts (3 errors) ==== +==== index.ts (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -34,17 +19,11 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== index.mts (3 errors) ==== +==== index.mts (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -54,17 +33,15 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== index.cts (4 errors) ==== +==== index.cts (3 errors) ==== // cjs format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. import * as type from "package"; ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. cjs; mjs; type; @@ -76,7 +53,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -87,6 +67,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -94,7 +77,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -124,4 +110,5 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ "./mjs": "./index.mjs", ".": "./index.js" } - } \ No newline at end of file + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).errors.txt.diff deleted file mode 100644 index 416acbdd60..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).errors.txt.diff +++ /dev/null @@ -1,120 +0,0 @@ ---- old.nodeModulesPackageExports(module=node16).errors.txt -+++ new.nodeModulesPackageExports(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. --index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - index.cts(9,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -+index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. - - - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.ts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.mts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.cts (3 errors) ==== -+==== index.ts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.mts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.cts (4 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -55, +75 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs"; - ~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).js index 53f53dc3c1..1b38f77f6d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).js @@ -44,6 +44,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -52,6 +55,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -60,6 +66,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -86,22 +95,9 @@ export { type }; "./mjs": "./index.mjs", ".": "./index.js" } -} +} + -//// [index.js] -// esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; -cjs; -mjs; -type; -import * as cjsi from "inner/cjs"; -import * as mjsi from "inner/mjs"; -import * as typei from "inner"; -cjsi; -mjsi; -typei; //// [index.mjs] // esm format file import * as cjs from "package/cjs"; @@ -165,11 +161,25 @@ const typei = __importStar(require("inner")); cjsi; mjsi; typei; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; +cjsi; +mjsi; +typei; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).js.diff deleted file mode 100644 index 8d29012f51..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).js.diff +++ /dev/null @@ -1,53 +0,0 @@ ---- old.nodeModulesPackageExports(module=node16).js -+++ new.nodeModulesPackageExports(module=node16).js -@@= skipped -87, +87 lines =@@ - } - } - -+//// [index.js] -+// esm format file -+import * as cjs from "package/cjs"; -+import * as mjs from "package/mjs"; -+import * as type from "package"; -+cjs; -+mjs; -+type; -+import * as cjsi from "inner/cjs"; -+import * as mjsi from "inner/mjs"; -+import * as typei from "inner"; -+cjsi; -+mjsi; -+typei; - //// [index.mjs] - // esm format file - import * as cjs from "package/cjs"; -@@= skipped -63, +77 lines =@@ - cjsi; - mjsi; - typei; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/cjs"; --import * as mjsi from "inner/mjs"; --import * as typei from "inner"; --cjsi; --mjsi; --typei; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).symbols index 378496d0a4..991d0d05c6 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).symbols @@ -116,61 +116,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).symbols.diff deleted file mode 100644 index 4801bd4be0..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackageExports(module=node16).symbols -+++ new.nodeModulesPackageExports(module=node16).symbols -@@= skipped -125, +125 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).types index 67faa06aa6..4dca52efaf 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).types @@ -3,22 +3,22 @@ === index.ts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -41,22 +41,22 @@ typei; === index.mts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -79,22 +79,22 @@ typei; === index.cts === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -116,6 +116,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -136,6 +142,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -156,6 +168,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).types.diff deleted file mode 100644 index edf00e2a30..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node16).types.diff +++ /dev/null @@ -1,212 +0,0 @@ ---- old.nodeModulesPackageExports(module=node16).types -+++ new.nodeModulesPackageExports(module=node16).types -@@= skipped -2, +2 lines =@@ - === index.ts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.mts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.cts === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs"; - >mjs : typeof mjs - - import * as type from "inner"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -61, +61 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).errors.txt index c3a3b37e59..4c1ba7fcce 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).errors.txt @@ -1,30 +1,15 @@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. +index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. +index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. index.cts(9,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.ts (3 errors) ==== +==== index.ts (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -34,17 +19,11 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== index.mts (3 errors) ==== +==== index.mts (0 errors) ==== // esm format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. cjs; mjs; type; @@ -54,17 +33,15 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== index.cts (4 errors) ==== +==== index.cts (3 errors) ==== // cjs format file import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. import * as mjs from "package/mjs"; ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. import * as type from "package"; ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. +!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. cjs; mjs; type; @@ -76,7 +53,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -87,6 +67,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -94,7 +77,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; @@ -124,4 +110,5 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ "./mjs": "./index.mjs", ".": "./index.js" } - } \ No newline at end of file + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).errors.txt.diff deleted file mode 100644 index b95e8cb421..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).errors.txt.diff +++ /dev/null @@ -1,120 +0,0 @@ ---- old.nodeModulesPackageExports(module=node18).errors.txt -+++ new.nodeModulesPackageExports(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --index.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. --index.cts(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - index.cts(9,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -+index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. - - - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.ts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.mts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.cts (3 errors) ==== -+==== index.ts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.mts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.cts (4 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -55, +75 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs"; - ~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).js index 53f53dc3c1..1b38f77f6d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).js @@ -44,6 +44,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -52,6 +55,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -60,6 +66,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -86,22 +95,9 @@ export { type }; "./mjs": "./index.mjs", ".": "./index.js" } -} +} + -//// [index.js] -// esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; -cjs; -mjs; -type; -import * as cjsi from "inner/cjs"; -import * as mjsi from "inner/mjs"; -import * as typei from "inner"; -cjsi; -mjsi; -typei; //// [index.mjs] // esm format file import * as cjs from "package/cjs"; @@ -165,11 +161,25 @@ const typei = __importStar(require("inner")); cjsi; mjsi; typei; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; +cjsi; +mjsi; +typei; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).js.diff deleted file mode 100644 index 20989c5ae2..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).js.diff +++ /dev/null @@ -1,53 +0,0 @@ ---- old.nodeModulesPackageExports(module=node18).js -+++ new.nodeModulesPackageExports(module=node18).js -@@= skipped -87, +87 lines =@@ - } - } - -+//// [index.js] -+// esm format file -+import * as cjs from "package/cjs"; -+import * as mjs from "package/mjs"; -+import * as type from "package"; -+cjs; -+mjs; -+type; -+import * as cjsi from "inner/cjs"; -+import * as mjsi from "inner/mjs"; -+import * as typei from "inner"; -+cjsi; -+mjsi; -+typei; - //// [index.mjs] - // esm format file - import * as cjs from "package/cjs"; -@@= skipped -63, +77 lines =@@ - cjsi; - mjsi; - typei; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/cjs"; --import * as mjsi from "inner/mjs"; --import * as typei from "inner"; --cjsi; --mjsi; --typei; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).symbols index 378496d0a4..991d0d05c6 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).symbols @@ -116,61 +116,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).symbols.diff deleted file mode 100644 index 4cd29da040..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackageExports(module=node18).symbols -+++ new.nodeModulesPackageExports(module=node18).symbols -@@= skipped -125, +125 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).types index 67faa06aa6..4dca52efaf 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).types @@ -3,22 +3,22 @@ === index.ts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -41,22 +41,22 @@ typei; === index.mts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -79,22 +79,22 @@ typei; === index.cts === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -116,6 +116,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -136,6 +142,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -156,6 +168,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).types.diff deleted file mode 100644 index 7d89191a71..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node18).types.diff +++ /dev/null @@ -1,212 +0,0 @@ ---- old.nodeModulesPackageExports(module=node18).types -+++ new.nodeModulesPackageExports(module=node18).types -@@= skipped -2, +2 lines =@@ - === index.ts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.mts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.cts === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs"; - >mjs : typeof mjs - - import * as type from "inner"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -61, +61 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).errors.txt deleted file mode 100644 index cd2e8c262c..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).errors.txt +++ /dev/null @@ -1,120 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.ts (3 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/cjs"; - import * as mjsi from "inner/mjs"; - import * as typei from "inner"; - cjsi; - mjsi; - typei; -==== index.mts (3 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/cjs"; - import * as mjsi from "inner/mjs"; - import * as typei from "inner"; - cjsi; - mjsi; - typei; -==== index.cts (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/cjs"; - import * as mjsi from "inner/mjs"; - import * as typei from "inner"; - cjsi; - mjsi; - typei; -==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; - export { mjs }; - export { type }; -==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/cjs"; - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; - export { mjs }; - export { type }; -==== node_modules/inner/index.d.cts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; - export { mjs }; - export { type }; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module", - "exports": { - "./cjs": "./index.cjs", - "./mjs": "./index.mjs", - ".": "./index.js" - } - } -==== node_modules/inner/package.json (0 errors) ==== - { - "name": "inner", - "private": true, - "exports": { - "./cjs": "./index.cjs", - "./mjs": "./index.mjs", - ".": "./index.js" - } - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).errors.txt.diff deleted file mode 100644 index b5302f6b7e..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).errors.txt.diff +++ /dev/null @@ -1,117 +0,0 @@ ---- old.nodeModulesPackageExports(module=node20).errors.txt -+++ new.nodeModulesPackageExports(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -- -- -+index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.ts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.mts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.cts (0 errors) ==== -+==== index.ts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.mts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.cts (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -44, +72 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).js index 0c6d333921..1b38f77f6d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).js @@ -44,6 +44,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -52,6 +55,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -60,6 +66,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -86,61 +95,91 @@ export { type }; "./mjs": "./index.mjs", ".": "./index.js" } -} +} -//// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); + +//// [index.mjs] // esm format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; cjs; mjs; type; -const cjsi = require("inner/cjs"); -const mjsi = require("inner/mjs"); -const typei = require("inner"); +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; cjsi; mjsi; typei; -//// [index.mjs] +//// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); -// esm format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); +// cjs format file +const cjs = __importStar(require("package/cjs")); +const mjs = __importStar(require("package/mjs")); +const type = __importStar(require("package")); cjs; mjs; type; -const cjsi = require("inner/cjs"); -const mjsi = require("inner/mjs"); -const typei = require("inner"); +const cjsi = __importStar(require("inner/cjs")); +const mjsi = __importStar(require("inner/mjs")); +const typei = __importStar(require("inner")); cjsi; mjsi; typei; -//// [index.cjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -// cjs format file -const cjs = require("package/cjs"); -const mjs = require("package/mjs"); -const type = require("package"); +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; cjs; mjs; type; -const cjsi = require("inner/cjs"); -const mjsi = require("inner/mjs"); -const typei = require("inner"); +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; cjsi; mjsi; typei; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).js.diff deleted file mode 100644 index 17c70b0fff..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).js.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesPackageExports(module=node20).js -+++ new.nodeModulesPackageExports(module=node20).js -@@= skipped -87, +87 lines =@@ - } - } - -+//// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+// esm format file -+const cjs = require("package/cjs"); -+const mjs = require("package/mjs"); -+const type = require("package"); -+cjs; -+mjs; -+type; -+const cjsi = require("inner/cjs"); -+const mjsi = require("inner/mjs"); -+const typei = require("inner"); -+cjsi; -+mjsi; -+typei; - //// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; -+const cjs = require("package/cjs"); -+const mjs = require("package/mjs"); -+const type = require("package"); - cjs; - mjs; - type; --import * as cjsi from "inner/cjs"; --import * as mjsi from "inner/mjs"; --import * as typei from "inner"; -+const cjsi = require("inner/cjs"); -+const mjsi = require("inner/mjs"); -+const typei = require("inner"); - cjsi; - mjsi; - typei; - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - // cjs format file --const cjs = __importStar(require("package/cjs")); --const mjs = __importStar(require("package/mjs")); --const type = __importStar(require("package")); --cjs; --mjs; --type; --const cjsi = __importStar(require("inner/cjs")); --const mjsi = __importStar(require("inner/mjs")); --const typei = __importStar(require("inner")); --cjsi; --mjsi; --typei; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/cjs"; --import * as mjsi from "inner/mjs"; --import * as typei from "inner"; --cjsi; --mjsi; --typei; -- -- -+const cjs = require("package/cjs"); -+const mjs = require("package/mjs"); -+const type = require("package"); -+cjs; -+mjs; -+type; -+const cjsi = require("inner/cjs"); -+const mjsi = require("inner/mjs"); -+const typei = require("inner"); -+cjsi; -+mjsi; -+typei; -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).symbols index 378496d0a4..991d0d05c6 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).symbols @@ -116,61 +116,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).symbols.diff deleted file mode 100644 index 4e9e7bab24..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackageExports(module=node20).symbols -+++ new.nodeModulesPackageExports(module=node20).symbols -@@= skipped -125, +125 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).types index 67faa06aa6..4dca52efaf 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).types @@ -3,22 +3,22 @@ === index.ts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -41,22 +41,22 @@ typei; === index.mts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -79,22 +79,22 @@ typei; === index.cts === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -116,6 +116,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -136,6 +142,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -156,6 +168,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).types.diff deleted file mode 100644 index db1a459945..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=node20).types.diff +++ /dev/null @@ -1,212 +0,0 @@ ---- old.nodeModulesPackageExports(module=node20).types -+++ new.nodeModulesPackageExports(module=node20).types -@@= skipped -2, +2 lines =@@ - === index.ts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.mts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.cts === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs"; - >mjs : typeof mjs - - import * as type from "inner"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -61, +61 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).errors.txt deleted file mode 100644 index 965adec9a2..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).errors.txt +++ /dev/null @@ -1,118 +0,0 @@ -error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - -!!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.ts (3 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/cjs"; - import * as mjsi from "inner/mjs"; - import * as typei from "inner"; - cjsi; - mjsi; - typei; -==== index.mts (3 errors) ==== - // esm format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/cjs"; - import * as mjsi from "inner/mjs"; - import * as typei from "inner"; - cjsi; - mjsi; - typei; -==== index.cts (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ -!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ -!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/cjs"; - import * as mjsi from "inner/mjs"; - import * as typei from "inner"; - cjsi; - mjsi; - typei; -==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; - export { mjs }; - export { type }; -==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/cjs"; - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; - export { mjs }; - export { type }; -==== node_modules/inner/index.d.cts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; - export { mjs }; - export { type }; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module", - "exports": { - "./cjs": "./index.cjs", - "./mjs": "./index.mjs", - ".": "./index.js" - } - } -==== node_modules/inner/package.json (0 errors) ==== - { - "name": "inner", - "private": true, - "exports": { - "./cjs": "./index.cjs", - "./mjs": "./index.mjs", - ".": "./index.js" - } - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).errors.txt.diff deleted file mode 100644 index 959f1e7201..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,113 +0,0 @@ ---- old.nodeModulesPackageExports(module=nodenext).errors.txt -+++ new.nodeModulesPackageExports(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -+index.cts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.ts(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.ts(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.ts(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.ts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.mts (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.cts (0 errors) ==== -+==== index.ts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.mts (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.cts (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -44, +70 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).js index 53f53dc3c1..1b38f77f6d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).js @@ -44,6 +44,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -52,6 +55,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -60,6 +66,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs"; import * as mjs from "inner/mjs"; import * as type from "inner"; @@ -86,22 +95,9 @@ export { type }; "./mjs": "./index.mjs", ".": "./index.js" } -} +} + -//// [index.js] -// esm format file -import * as cjs from "package/cjs"; -import * as mjs from "package/mjs"; -import * as type from "package"; -cjs; -mjs; -type; -import * as cjsi from "inner/cjs"; -import * as mjsi from "inner/mjs"; -import * as typei from "inner"; -cjsi; -mjsi; -typei; //// [index.mjs] // esm format file import * as cjs from "package/cjs"; @@ -165,11 +161,25 @@ const typei = __importStar(require("inner")); cjsi; mjsi; typei; +//// [index.js] +// esm format file +import * as cjs from "package/cjs"; +import * as mjs from "package/mjs"; +import * as type from "package"; +cjs; +mjs; +type; +import * as cjsi from "inner/cjs"; +import * as mjsi from "inner/mjs"; +import * as typei from "inner"; +cjsi; +mjsi; +typei; -//// [index.d.ts] -export {}; //// [index.d.mts] export {}; //// [index.d.cts] export {}; +//// [index.d.ts] +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).js.diff deleted file mode 100644 index e6df4ccb71..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).js.diff +++ /dev/null @@ -1,53 +0,0 @@ ---- old.nodeModulesPackageExports(module=nodenext).js -+++ new.nodeModulesPackageExports(module=nodenext).js -@@= skipped -87, +87 lines =@@ - } - } - -+//// [index.js] -+// esm format file -+import * as cjs from "package/cjs"; -+import * as mjs from "package/mjs"; -+import * as type from "package"; -+cjs; -+mjs; -+type; -+import * as cjsi from "inner/cjs"; -+import * as mjsi from "inner/mjs"; -+import * as typei from "inner"; -+cjsi; -+mjsi; -+typei; - //// [index.mjs] - // esm format file - import * as cjs from "package/cjs"; -@@= skipped -63, +77 lines =@@ - cjsi; - mjsi; - typei; --//// [index.js] --// esm format file --import * as cjs from "package/cjs"; --import * as mjs from "package/mjs"; --import * as type from "package"; --cjs; --mjs; --type; --import * as cjsi from "inner/cjs"; --import * as mjsi from "inner/mjs"; --import * as typei from "inner"; --cjsi; --mjsi; --typei; -- -- -+ -+ -+//// [index.d.ts] -+export {}; - //// [index.d.mts] - export {}; - //// [index.d.cts] --export {}; --//// [index.d.ts] - export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).symbols index 378496d0a4..991d0d05c6 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).symbols @@ -116,61 +116,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).symbols.diff deleted file mode 100644 index 3f3cb3b59e..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackageExports(module=nodenext).symbols -+++ new.nodeModulesPackageExports(module=nodenext).symbols -@@= skipped -125, +125 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).types index 67faa06aa6..4dca52efaf 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).types @@ -3,22 +3,22 @@ === index.ts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -41,22 +41,22 @@ typei; === index.mts === // esm format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -79,22 +79,22 @@ typei; === index.cts === // cjs format file import * as cjs from "package/cjs"; ->cjs : any +>cjs : typeof cjs import * as mjs from "package/mjs"; ->mjs : any +>mjs : typeof mjs import * as type from "package"; ->type : any +>type : typeof type cjs; ->cjs : any +>cjs : typeof cjs mjs; ->mjs : any +>mjs : typeof mjs type; ->type : any +>type : typeof type import * as cjsi from "inner/cjs"; >cjsi : typeof cjsi @@ -116,6 +116,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -136,6 +142,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs"; >cjs : typeof cjs @@ -156,6 +168,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).types.diff deleted file mode 100644 index 9730a78e76..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageExports(module=nodenext).types.diff +++ /dev/null @@ -1,212 +0,0 @@ ---- old.nodeModulesPackageExports(module=nodenext).types -+++ new.nodeModulesPackageExports(module=nodenext).types -@@= skipped -2, +2 lines =@@ - === index.ts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.mts === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.cts === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs"; - >mjs : typeof mjs - - import * as type from "inner"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -61, +61 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=node20).errors.txt deleted file mode 100644 index c3e59bf425..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=node20).errors.txt +++ /dev/null @@ -1,40 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== index.ts (0 errors) ==== - // esm format file - import * as cjs from "#cjs"; - import * as mjs from "#mjs"; - import * as type from "#type"; - cjs; - mjs; - type; -==== index.mts (0 errors) ==== - // esm format file - import * as cjs from "#cjs"; - import * as mjs from "#mjs"; - import * as type from "#type"; - cjs; - mjs; - type; -==== index.cts (0 errors) ==== - // esm format file - import * as cjs from "#cjs"; - import * as mjs from "#mjs"; - import * as type from "#type"; - cjs; - mjs; - type; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module", - "exports": "./index.js", - "imports": { - "#cjs": "./index.cjs", - "#mjs": "./index.mjs", - "#type": "./index.js" - } - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=node20).errors.txt.diff deleted file mode 100644 index 553179169b..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=node20).errors.txt.diff +++ /dev/null @@ -1,44 +0,0 @@ ---- old.nodeModulesPackageImports(module=node20).errors.txt -+++ new.nodeModulesPackageImports(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== index.ts (0 errors) ==== -+ // esm format file -+ import * as cjs from "#cjs"; -+ import * as mjs from "#mjs"; -+ import * as type from "#type"; -+ cjs; -+ mjs; -+ type; -+==== index.mts (0 errors) ==== -+ // esm format file -+ import * as cjs from "#cjs"; -+ import * as mjs from "#mjs"; -+ import * as type from "#type"; -+ cjs; -+ mjs; -+ type; -+==== index.cts (0 errors) ==== -+ // esm format file -+ import * as cjs from "#cjs"; -+ import * as mjs from "#mjs"; -+ import * as type from "#type"; -+ cjs; -+ mjs; -+ type; -+==== package.json (0 errors) ==== -+ { -+ "name": "package", -+ "private": true, -+ "type": "module", -+ "exports": "./index.js", -+ "imports": { -+ "#cjs": "./index.cjs", -+ "#mjs": "./index.mjs", -+ "#type": "./index.js" -+ } -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=node20).js index 0144a3d9cd..c25d1005e9 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=node20).js @@ -38,32 +38,61 @@ type; } //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjs = require("#cjs"); -const mjs = require("#mjs"); -const type = require("#type"); +import * as cjs from "#cjs"; +import * as mjs from "#mjs"; +import * as type from "#type"; cjs; mjs; type; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjs = require("#cjs"); -const mjs = require("#mjs"); -const type = require("#type"); +const cjs = __importStar(require("#cjs")); +const mjs = __importStar(require("#mjs")); +const type = __importStar(require("#type")); cjs; mjs; type; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjs = require("#cjs"); -const mjs = require("#mjs"); -const type = require("#type"); +import * as cjs from "#cjs"; +import * as mjs from "#mjs"; +import * as type from "#type"; cjs; mjs; type; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=node20).js.diff deleted file mode 100644 index ab50dbec17..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=node20).js.diff +++ /dev/null @@ -1,77 +0,0 @@ ---- old.nodeModulesPackageImports(module=node20).js -+++ new.nodeModulesPackageImports(module=node20).js -@@= skipped -37, +37 lines =@@ - } - - //// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as cjs from "#cjs"; --import * as mjs from "#mjs"; --import * as type from "#type"; -+const cjs = require("#cjs"); -+const mjs = require("#mjs"); -+const type = require("#type"); - cjs; - mjs; - type; - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --const cjs = __importStar(require("#cjs")); --const mjs = __importStar(require("#mjs")); --const type = __importStar(require("#type")); -+const cjs = require("#cjs"); -+const mjs = require("#mjs"); -+const type = require("#type"); - cjs; - mjs; - type; - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as cjs from "#cjs"; --import * as mjs from "#mjs"; --import * as type from "#type"; -+const cjs = require("#cjs"); -+const mjs = require("#mjs"); -+const type = require("#type"); - cjs; - mjs; - type; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=node20).trace.json b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=node20).trace.json index 2cf0830bae..55a35f71bd 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=node20).trace.json +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackageImports(module=node20).trace.json @@ -1,70 +1,70 @@ ======== Resolving module '#cjs' from '/.src/index.ts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. Found 'package.json' at '/.src/package.json'. Using 'imports' subpath '#cjs' with target './index.cjs'. File name '/.src/index.cjs' has a '.cjs' extension - stripping it. File '/.src/index.cts' exists - use it as a name resolution result. ======== Module name '#cjs' was successfully resolved to '/.src/index.cts'. ======== ======== Resolving module '#mjs' from '/.src/index.ts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. File '/.src/package.json' exists according to earlier cached lookups. Using 'imports' subpath '#mjs' with target './index.mjs'. File name '/.src/index.mjs' has a '.mjs' extension - stripping it. File '/.src/index.mts' exists - use it as a name resolution result. ======== Module name '#mjs' was successfully resolved to '/.src/index.mts'. ======== ======== Resolving module '#type' from '/.src/index.ts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. File '/.src/package.json' exists according to earlier cached lookups. Using 'imports' subpath '#type' with target './index.js'. File name '/.src/index.js' has a '.js' extension - stripping it. File '/.src/index.ts' exists - use it as a name resolution result. ======== Module name '#type' was successfully resolved to '/.src/index.ts'. ======== ======== Resolving module '#cjs' from '/.src/index.cts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/package.json' exists according to earlier cached lookups. Using 'imports' subpath '#cjs' with target './index.cjs'. File name '/.src/index.cjs' has a '.cjs' extension - stripping it. File '/.src/index.cts' exists - use it as a name resolution result. ======== Module name '#cjs' was successfully resolved to '/.src/index.cts'. ======== ======== Resolving module '#mjs' from '/.src/index.cts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/package.json' exists according to earlier cached lookups. Using 'imports' subpath '#mjs' with target './index.mjs'. File name '/.src/index.mjs' has a '.mjs' extension - stripping it. File '/.src/index.mts' exists - use it as a name resolution result. ======== Module name '#mjs' was successfully resolved to '/.src/index.mts'. ======== ======== Resolving module '#type' from '/.src/index.cts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/package.json' exists according to earlier cached lookups. Using 'imports' subpath '#type' with target './index.js'. File name '/.src/index.js' has a '.js' extension - stripping it. File '/.src/index.ts' exists - use it as a name resolution result. ======== Module name '#type' was successfully resolved to '/.src/index.ts'. ======== ======== Resolving module '#cjs' from '/.src/index.mts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'import', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. File '/.src/package.json' exists according to earlier cached lookups. Using 'imports' subpath '#cjs' with target './index.cjs'. File name '/.src/index.cjs' has a '.cjs' extension - stripping it. File '/.src/index.cts' exists - use it as a name resolution result. ======== Module name '#cjs' was successfully resolved to '/.src/index.cts'. ======== ======== Resolving module '#mjs' from '/.src/index.mts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'import', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. File '/.src/package.json' exists according to earlier cached lookups. Using 'imports' subpath '#mjs' with target './index.mjs'. File name '/.src/index.mjs' has a '.mjs' extension - stripping it. File '/.src/index.mts' exists - use it as a name resolution result. ======== Module name '#mjs' was successfully resolved to '/.src/index.mts'. ======== ======== Resolving module '#type' from '/.src/index.mts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'import', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. File '/.src/package.json' exists according to earlier cached lookups. Using 'imports' subpath '#type' with target './index.js'. File name '/.src/index.js' has a '.js' extension - stripping it. diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).errors.txt index 8805dce4dc..edded79874 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).errors.txt @@ -1,6 +1,6 @@ index.cts(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. ==== index.ts (0 errors) ==== @@ -29,7 +29,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -40,6 +43,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -47,7 +53,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).errors.txt.diff deleted file mode 100644 index 33b0fbc52c..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).errors.txt.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.nodeModulesPackagePatternExports(module=node16).errors.txt -+++ new.nodeModulesPackagePatternExports(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ - index.cts(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - - -@@= skipped -29, +28 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index"; - ~~~~~~~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).js index 16d7442eb7..fd642683ab 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).symbols index 495d39b65a..80efcda8a2 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).symbols.diff deleted file mode 100644 index e61594f40d..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackagePatternExports(module=node16).symbols -+++ new.nodeModulesPackagePatternExports(module=node16).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).types index 953c741c90..1162099dc3 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).types.diff deleted file mode 100644 index a1c7499804..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node16).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesPackagePatternExports(module=node16).types -+++ new.nodeModulesPackagePatternExports(module=node16).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; - >mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).errors.txt index 8805dce4dc..edded79874 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).errors.txt @@ -1,6 +1,6 @@ index.cts(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. ==== index.ts (0 errors) ==== @@ -29,7 +29,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -40,6 +43,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -47,7 +53,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).errors.txt.diff deleted file mode 100644 index dc743a6e3b..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).errors.txt.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.nodeModulesPackagePatternExports(module=node18).errors.txt -+++ new.nodeModulesPackagePatternExports(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ - index.cts(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - - -@@= skipped -29, +28 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index"; - ~~~~~~~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).js index 16d7442eb7..fd642683ab 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).symbols index 495d39b65a..80efcda8a2 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).symbols.diff deleted file mode 100644 index b1fdabb2e7..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackagePatternExports(module=node18).symbols -+++ new.nodeModulesPackagePatternExports(module=node18).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).types index 953c741c90..1162099dc3 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).types.diff deleted file mode 100644 index ce6a5bb0e8..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node18).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesPackagePatternExports(module=node18).types -+++ new.nodeModulesPackagePatternExports(module=node18).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; - >mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).errors.txt deleted file mode 100644 index ed4a986720..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).errors.txt +++ /dev/null @@ -1,69 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== index.ts (0 errors) ==== - // esm format file - import * as cjsi from "inner/cjs/index"; - import * as mjsi from "inner/mjs/index"; - import * as typei from "inner/js/index"; - cjsi; - mjsi; - typei; -==== index.mts (0 errors) ==== - // esm format file - import * as cjsi from "inner/cjs/index"; - import * as mjsi from "inner/mjs/index"; - import * as typei from "inner/js/index"; - cjsi; - mjsi; - typei; -==== index.cts (0 errors) ==== - // cjs format file - import * as cjsi from "inner/cjs/index"; - import * as mjsi from "inner/mjs/index"; - import * as typei from "inner/js/index"; - cjsi; - mjsi; - typei; -==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; - import * as mjs from "inner/mjs/index"; - import * as type from "inner/js/index"; - export { cjs }; - export { mjs }; - export { type }; -==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/cjs/index"; - import * as mjs from "inner/mjs/index"; - import * as type from "inner/js/index"; - export { cjs }; - export { mjs }; - export { type }; -==== node_modules/inner/index.d.cts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; - import * as mjs from "inner/mjs/index"; - import * as type from "inner/js/index"; - export { cjs }; - export { mjs }; - export { type }; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module" - } -==== node_modules/inner/package.json (0 errors) ==== - { - "name": "inner", - "private": true, - "exports": { - "./cjs/*": "./*.cjs", - "./mjs/*": "./*.mjs", - "./js/*": "./*.js" - } - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).errors.txt.diff deleted file mode 100644 index f0b2c2a1ba..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).errors.txt.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.nodeModulesPackagePatternExports(module=node20).errors.txt -+++ new.nodeModulesPackagePatternExports(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -- -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== index.ts (0 errors) ==== - // esm format file - import * as cjsi from "inner/cjs/index"; -@@= skipped -24, +25 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index"; - import * as type from "inner/js/index"; - export { cjs }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).js index 7de6c11c18..fd642683ab 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -67,32 +76,61 @@ export { type }; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjsi = require("inner/cjs/index"); -const mjsi = require("inner/mjs/index"); -const typei = require("inner/js/index"); +import * as cjsi from "inner/cjs/index"; +import * as mjsi from "inner/mjs/index"; +import * as typei from "inner/js/index"; cjsi; mjsi; typei; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjsi = require("inner/cjs/index"); -const mjsi = require("inner/mjs/index"); -const typei = require("inner/js/index"); +import * as cjsi from "inner/cjs/index"; +import * as mjsi from "inner/mjs/index"; +import * as typei from "inner/js/index"; cjsi; mjsi; typei; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // cjs format file -const cjsi = require("inner/cjs/index"); -const mjsi = require("inner/mjs/index"); -const typei = require("inner/js/index"); +const cjsi = __importStar(require("inner/cjs/index")); +const mjsi = __importStar(require("inner/mjs/index")); +const typei = __importStar(require("inner/js/index")); cjsi; mjsi; typei; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).js.diff deleted file mode 100644 index 25cfbdbef8..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).js.diff +++ /dev/null @@ -1,77 +0,0 @@ ---- old.nodeModulesPackagePatternExports(module=node20).js -+++ new.nodeModulesPackagePatternExports(module=node20).js -@@= skipped -66, +66 lines =@@ - - - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as cjsi from "inner/cjs/index"; --import * as mjsi from "inner/mjs/index"; --import * as typei from "inner/js/index"; -+const cjsi = require("inner/cjs/index"); -+const mjsi = require("inner/mjs/index"); -+const typei = require("inner/js/index"); - cjsi; - mjsi; - typei; - //// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as cjsi from "inner/cjs/index"; --import * as mjsi from "inner/mjs/index"; --import * as typei from "inner/js/index"; -+const cjsi = require("inner/cjs/index"); -+const mjsi = require("inner/mjs/index"); -+const typei = require("inner/js/index"); - cjsi; - mjsi; - typei; - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - // cjs format file --const cjsi = __importStar(require("inner/cjs/index")); --const mjsi = __importStar(require("inner/mjs/index")); --const typei = __importStar(require("inner/js/index")); -+const cjsi = require("inner/cjs/index"); -+const mjsi = require("inner/mjs/index"); -+const typei = require("inner/js/index"); - cjsi; - mjsi; - typei; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).symbols index 495d39b65a..80efcda8a2 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).symbols.diff deleted file mode 100644 index 6082514674..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackagePatternExports(module=node20).symbols -+++ new.nodeModulesPackagePatternExports(module=node20).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).types index 953c741c90..1162099dc3 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).types.diff deleted file mode 100644 index 185e002670..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=node20).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesPackagePatternExports(module=node20).types -+++ new.nodeModulesPackagePatternExports(module=node20).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; - >mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).errors.txt.diff deleted file mode 100644 index 4dee5d096a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,74 +0,0 @@ ---- old.nodeModulesPackagePatternExports(module=nodenext).errors.txt -+++ new.nodeModulesPackagePatternExports(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -- -- --==== index.ts (0 errors) ==== -- // esm format file -- import * as cjsi from "inner/cjs/index"; -- import * as mjsi from "inner/mjs/index"; -- import * as typei from "inner/js/index"; -- cjsi; -- mjsi; -- typei; --==== index.mts (0 errors) ==== -- // esm format file -- import * as cjsi from "inner/cjs/index"; -- import * as mjsi from "inner/mjs/index"; -- import * as typei from "inner/js/index"; -- cjsi; -- mjsi; -- typei; --==== index.cts (0 errors) ==== -- // cjs format file -- import * as cjsi from "inner/cjs/index"; -- import * as mjsi from "inner/mjs/index"; -- import * as typei from "inner/js/index"; -- cjsi; -- mjsi; -- typei; --==== node_modules/inner/index.d.ts (1 errors) ==== -- // cjs format file -- import * as cjs from "inner/cjs/index"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. -- import * as mjs from "inner/mjs/index"; -- import * as type from "inner/js/index"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== node_modules/inner/index.d.mts (0 errors) ==== -- // esm format file -- import * as cjs from "inner/cjs/index"; -- import * as mjs from "inner/mjs/index"; -- import * as type from "inner/js/index"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== node_modules/inner/index.d.cts (0 errors) ==== -- // cjs format file -- import * as cjs from "inner/cjs/index"; -- import * as mjs from "inner/mjs/index"; -- import * as type from "inner/js/index"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== package.json (0 errors) ==== -- { -- "name": "package", -- "private": true, -- "type": "module" -- } --==== node_modules/inner/package.json (0 errors) ==== -- { -- "name": "inner", -- "private": true, -- "exports": { -- "./cjs/*": "./*.cjs", -- "./mjs/*": "./*.mjs", -- "./js/*": "./*.js" -- } -- } -- -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).js index 16d7442eb7..fd642683ab 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).symbols index 495d39b65a..80efcda8a2 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).symbols.diff deleted file mode 100644 index 976d0a42fb..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackagePatternExports(module=nodenext).symbols -+++ new.nodeModulesPackagePatternExports(module=nodenext).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).types index 953c741c90..1162099dc3 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).types.diff deleted file mode 100644 index b2f81d75d6..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExports(module=nodenext).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesPackagePatternExports(module=nodenext).types -+++ new.nodeModulesPackagePatternExports(module=nodenext).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; - >mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).errors.txt index 491a598cda..ca1c1e7352 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).errors.txt @@ -8,17 +8,17 @@ index.mts(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or it index.ts(2,23): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. index.ts(3,23): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. index.ts(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.cts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.cts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.cts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.mts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.mts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.mts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.ts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/exclude/test.d.cts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.cts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.cts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.mts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.mts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.mts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.ts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. ==== index.ts (3 errors) ==== @@ -83,7 +83,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi2; mjsi2; typei2; -==== node_modules/inner/exclude/index.d.ts (3 errors) ==== +==== node_modules/inner/exclude/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/exclude/test.d.ts (3 errors) ==== // cjs format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -97,7 +100,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/exclude/index.d.mts (3 errors) ==== +==== node_modules/inner/exclude/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/exclude/test.d.mts (3 errors) ==== // esm format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -111,7 +117,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/exclude/index.d.cts (3 errors) ==== +==== node_modules/inner/exclude/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/exclude/test.d.cts (3 errors) ==== // cjs format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -125,7 +134,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -136,6 +148,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -143,7 +158,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -171,4 +189,5 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ "./js/*": "./*.js", "./js/exclude/*": null } - } \ No newline at end of file + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).errors.txt.diff deleted file mode 100644 index 59c7ffbc5c..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).errors.txt.diff +++ /dev/null @@ -1,23 +0,0 @@ ---- old.nodeModulesPackagePatternExportsExclude(module=node16).errors.txt -+++ new.nodeModulesPackagePatternExportsExclude(module=node16).errors.txt -@@= skipped -17, +17 lines =@@ - node_modules/inner/exclude/index.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. - node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - - -@@= skipped -108, +107 lines =@@ - export { cjs }; - export { mjs }; - export { type }; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index"; - ~~~~~~~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).js index 5fe735dbc3..86bc3022de 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).js @@ -44,6 +44,9 @@ mjsi2; typei2; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/exclude/index"; import * as mjs from "inner/mjs/exclude/index"; import * as type from "inner/js/exclude/index"; @@ -52,6 +55,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/exclude/index"; import * as mjs from "inner/mjs/exclude/index"; import * as type from "inner/js/exclude/index"; @@ -60,6 +66,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/exclude/index"; import * as mjs from "inner/mjs/exclude/index"; import * as type from "inner/js/exclude/index"; @@ -68,6 +77,9 @@ export { mjs }; export { type }; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -76,6 +88,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -84,6 +99,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -108,7 +126,8 @@ export { type }; "./js/*": "./*.js", "./js/exclude/*": null } -} +} + //// [index.js] // esm format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).symbols index 9bcd25bcd7..8f1e180a5e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).symbols @@ -116,121 +116,151 @@ typei2; === node_modules/inner/exclude/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/exclude/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/exclude/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/exclude/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/exclude/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/exclude/test.d.mts === +// esm format file import * as cjs from "inner/cjs/exclude/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/exclude/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/exclude/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/exclude/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/exclude/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/exclude/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/exclude/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).symbols.diff deleted file mode 100644 index 4e7b9ae82f..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackagePatternExportsExclude(module=node16).symbols -+++ new.nodeModulesPackagePatternExportsExclude(module=node16).symbols -@@= skipped -185, +185 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).types index 8bdf18e1e4..893175b77c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).types @@ -116,6 +116,12 @@ typei2; === node_modules/inner/exclude/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/exclude/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; >cjs : any @@ -136,6 +142,12 @@ export { type }; === node_modules/inner/exclude/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/exclude/test.d.mts === +// esm format file import * as cjs from "inner/cjs/exclude/index"; >cjs : any @@ -156,6 +168,12 @@ export { type }; === node_modules/inner/exclude/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/exclude/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; >cjs : any @@ -176,6 +194,12 @@ export { type }; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -196,6 +220,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -216,6 +246,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).types.diff deleted file mode 100644 index ae03ffea99..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node16).types.diff +++ /dev/null @@ -1,134 +0,0 @@ ---- old.nodeModulesPackagePatternExportsExclude(module=node16).types -+++ new.nodeModulesPackagePatternExportsExclude(module=node16).types -@@= skipped -23, +23 lines =@@ - >cjsi2 : typeof cjsi2 - - import * as mjsi2 from "inner/mjs/index"; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - import * as typei2 from "inner/js/index"; - >typei2 : typeof typei2 -@@= skipped -9, +9 lines =@@ - >cjsi2 : typeof cjsi2 - - mjsi2; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - typei2; - >typei2 : typeof typei2 -@@= skipped -29, +29 lines =@@ - >cjsi2 : typeof cjsi2 - - import * as mjsi2 from "inner/mjs/index"; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - import * as typei2 from "inner/js/index"; - >typei2 : typeof typei2 -@@= skipped -9, +9 lines =@@ - >cjsi2 : typeof cjsi2 - - mjsi2; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - typei2; - >typei2 : typeof typei2 -@@= skipped -29, +29 lines =@@ - >cjsi2 : typeof cjsi2 - - import * as mjsi2 from "inner/mjs/index"; -->mjsi2 : typeof cjsi2.mjs -+>mjsi2 : typeof mjsi2 - - import * as typei2 from "inner/js/index"; -->typei2 : typeof cjsi2.mjs.cjs.type -+>typei2 : typeof typei2 - - cjsi2; - >cjsi2 : typeof cjsi2 - - mjsi2; -->mjsi2 : typeof cjsi2.mjs -+>mjsi2 : typeof mjsi2 - - typei2; -->typei2 : typeof cjsi2.mjs.cjs.type -+>typei2 : typeof typei2 - - === node_modules/inner/exclude/index.d.ts === - // cjs format file -@@= skipped -77, +77 lines =@@ - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; - >mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -23, +23 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt index 491a598cda..ca1c1e7352 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt @@ -8,17 +8,17 @@ index.mts(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or it index.ts(2,23): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. index.ts(3,23): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. index.ts(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.cts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.cts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.cts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.mts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.mts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.mts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.ts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/exclude/test.d.cts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.cts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.cts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.mts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.mts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.mts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.ts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. ==== index.ts (3 errors) ==== @@ -83,7 +83,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi2; mjsi2; typei2; -==== node_modules/inner/exclude/index.d.ts (3 errors) ==== +==== node_modules/inner/exclude/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/exclude/test.d.ts (3 errors) ==== // cjs format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -97,7 +100,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/exclude/index.d.mts (3 errors) ==== +==== node_modules/inner/exclude/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/exclude/test.d.mts (3 errors) ==== // esm format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -111,7 +117,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/exclude/index.d.cts (3 errors) ==== +==== node_modules/inner/exclude/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/exclude/test.d.cts (3 errors) ==== // cjs format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -125,7 +134,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -136,6 +148,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -143,7 +158,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -171,4 +189,5 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ "./js/*": "./*.js", "./js/exclude/*": null } - } \ No newline at end of file + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt.diff deleted file mode 100644 index a13dc3c492..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).errors.txt.diff +++ /dev/null @@ -1,23 +0,0 @@ ---- old.nodeModulesPackagePatternExportsExclude(module=node18).errors.txt -+++ new.nodeModulesPackagePatternExportsExclude(module=node18).errors.txt -@@= skipped -17, +17 lines =@@ - node_modules/inner/exclude/index.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. - node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - - -@@= skipped -108, +107 lines =@@ - export { cjs }; - export { mjs }; - export { type }; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index"; - ~~~~~~~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).js index 5fe735dbc3..86bc3022de 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).js @@ -44,6 +44,9 @@ mjsi2; typei2; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/exclude/index"; import * as mjs from "inner/mjs/exclude/index"; import * as type from "inner/js/exclude/index"; @@ -52,6 +55,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/exclude/index"; import * as mjs from "inner/mjs/exclude/index"; import * as type from "inner/js/exclude/index"; @@ -60,6 +66,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/exclude/index"; import * as mjs from "inner/mjs/exclude/index"; import * as type from "inner/js/exclude/index"; @@ -68,6 +77,9 @@ export { mjs }; export { type }; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -76,6 +88,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -84,6 +99,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -108,7 +126,8 @@ export { type }; "./js/*": "./*.js", "./js/exclude/*": null } -} +} + //// [index.js] // esm format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).symbols index 9bcd25bcd7..8f1e180a5e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).symbols @@ -116,121 +116,151 @@ typei2; === node_modules/inner/exclude/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/exclude/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/exclude/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/exclude/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/exclude/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/exclude/test.d.mts === +// esm format file import * as cjs from "inner/cjs/exclude/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/exclude/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/exclude/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/exclude/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/exclude/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/exclude/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/exclude/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).symbols.diff deleted file mode 100644 index 866ec52ea4..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackagePatternExportsExclude(module=node18).symbols -+++ new.nodeModulesPackagePatternExportsExclude(module=node18).symbols -@@= skipped -185, +185 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).types index 8bdf18e1e4..893175b77c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).types @@ -116,6 +116,12 @@ typei2; === node_modules/inner/exclude/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/exclude/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; >cjs : any @@ -136,6 +142,12 @@ export { type }; === node_modules/inner/exclude/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/exclude/test.d.mts === +// esm format file import * as cjs from "inner/cjs/exclude/index"; >cjs : any @@ -156,6 +168,12 @@ export { type }; === node_modules/inner/exclude/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/exclude/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; >cjs : any @@ -176,6 +194,12 @@ export { type }; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -196,6 +220,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -216,6 +246,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).types.diff deleted file mode 100644 index 920348eae4..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node18).types.diff +++ /dev/null @@ -1,134 +0,0 @@ ---- old.nodeModulesPackagePatternExportsExclude(module=node18).types -+++ new.nodeModulesPackagePatternExportsExclude(module=node18).types -@@= skipped -23, +23 lines =@@ - >cjsi2 : typeof cjsi2 - - import * as mjsi2 from "inner/mjs/index"; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - import * as typei2 from "inner/js/index"; - >typei2 : typeof typei2 -@@= skipped -9, +9 lines =@@ - >cjsi2 : typeof cjsi2 - - mjsi2; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - typei2; - >typei2 : typeof typei2 -@@= skipped -29, +29 lines =@@ - >cjsi2 : typeof cjsi2 - - import * as mjsi2 from "inner/mjs/index"; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - import * as typei2 from "inner/js/index"; - >typei2 : typeof typei2 -@@= skipped -9, +9 lines =@@ - >cjsi2 : typeof cjsi2 - - mjsi2; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - typei2; - >typei2 : typeof typei2 -@@= skipped -29, +29 lines =@@ - >cjsi2 : typeof cjsi2 - - import * as mjsi2 from "inner/mjs/index"; -->mjsi2 : typeof cjsi2.mjs -+>mjsi2 : typeof mjsi2 - - import * as typei2 from "inner/js/index"; -->typei2 : typeof cjsi2.mjs.cjs.type -+>typei2 : typeof typei2 - - cjsi2; - >cjsi2 : typeof cjsi2 - - mjsi2; -->mjsi2 : typeof cjsi2.mjs -+>mjsi2 : typeof mjsi2 - - typei2; -->typei2 : typeof cjsi2.mjs.cjs.type -+>typei2 : typeof typei2 - - === node_modules/inner/exclude/index.d.ts === - // cjs format file -@@= skipped -77, +77 lines =@@ - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; - >mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -23, +23 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).errors.txt index 294d009582..2a889543f6 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).errors.txt @@ -1,4 +1,3 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. index.cts(2,23): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. index.cts(3,23): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. index.cts(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. @@ -8,18 +7,17 @@ index.mts(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or it index.ts(2,23): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. index.ts(3,23): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. index.ts(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.cts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.cts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.cts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.mts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.mts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.mts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.ts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.cts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.cts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.cts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.mts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.mts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.mts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.ts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== index.ts (3 errors) ==== // esm format file import * as cjsi from "inner/cjs/exclude/index"; @@ -80,7 +78,10 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i cjsi2; mjsi2; typei2; -==== node_modules/inner/exclude/index.d.ts (3 errors) ==== +==== node_modules/inner/exclude/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/exclude/test.d.ts (3 errors) ==== // cjs format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -94,7 +95,10 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/exclude/index.d.mts (3 errors) ==== +==== node_modules/inner/exclude/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/exclude/test.d.mts (3 errors) ==== // esm format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -108,7 +112,10 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/exclude/index.d.cts (3 errors) ==== +==== node_modules/inner/exclude/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/exclude/test.d.cts (3 errors) ==== // cjs format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -123,6 +130,9 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i export { mjs }; export { type }; ==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (0 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -131,6 +141,9 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -139,6 +152,9 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i export { mjs }; export { type }; ==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (0 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -164,4 +180,5 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i "./js/*": "./*.js", "./js/exclude/*": null } - } \ No newline at end of file + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).errors.txt.diff deleted file mode 100644 index 77a825c121..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).errors.txt.diff +++ /dev/null @@ -1,33 +0,0 @@ ---- old.nodeModulesPackagePatternExportsExclude(module=node20).errors.txt -+++ new.nodeModulesPackagePatternExportsExclude(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - index.cts(2,23): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. - index.cts(3,23): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. - index.cts(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -@@= skipped -15, +16 lines =@@ - node_modules/inner/exclude/index.d.ts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. - node_modules/inner/exclude/index.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. - node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -- -- -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== index.ts (3 errors) ==== - // esm format file - import * as cjsi from "inner/cjs/exclude/index"; -@@= skipped -105, +105 lines =@@ - export { cjs }; - export { mjs }; - export { type }; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index"; - import * as type from "inner/js/index"; - export { cjs }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).js index 47d4d67006..86bc3022de 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).js @@ -44,6 +44,9 @@ mjsi2; typei2; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/exclude/index"; import * as mjs from "inner/mjs/exclude/index"; import * as type from "inner/js/exclude/index"; @@ -52,6 +55,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/exclude/index"; import * as mjs from "inner/mjs/exclude/index"; import * as type from "inner/js/exclude/index"; @@ -60,6 +66,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/exclude/index"; import * as mjs from "inner/mjs/exclude/index"; import * as type from "inner/js/exclude/index"; @@ -68,6 +77,9 @@ export { mjs }; export { type }; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -76,6 +88,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -84,6 +99,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -108,53 +126,83 @@ export { type }; "./js/*": "./*.js", "./js/exclude/*": null } -} +} + //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjsi = require("inner/cjs/exclude/index"); -const mjsi = require("inner/mjs/exclude/index"); -const typei = require("inner/js/exclude/index"); +import * as cjsi from "inner/cjs/exclude/index"; +import * as mjsi from "inner/mjs/exclude/index"; +import * as typei from "inner/js/exclude/index"; cjsi; mjsi; typei; -const cjsi2 = require("inner/cjs/index"); -const mjsi2 = require("inner/mjs/index"); -const typei2 = require("inner/js/index"); +import * as cjsi2 from "inner/cjs/index"; +import * as mjsi2 from "inner/mjs/index"; +import * as typei2 from "inner/js/index"; cjsi2; mjsi2; typei2; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjsi = require("inner/cjs/exclude/index"); -const mjsi = require("inner/mjs/exclude/index"); -const typei = require("inner/js/exclude/index"); +import * as cjsi from "inner/cjs/exclude/index"; +import * as mjsi from "inner/mjs/exclude/index"; +import * as typei from "inner/js/exclude/index"; cjsi; mjsi; typei; -const cjsi2 = require("inner/cjs/index"); -const mjsi2 = require("inner/mjs/index"); -const typei2 = require("inner/js/index"); +import * as cjsi2 from "inner/cjs/index"; +import * as mjsi2 from "inner/mjs/index"; +import * as typei2 from "inner/js/index"; cjsi2; mjsi2; typei2; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // cjs format file -const cjsi = require("inner/cjs/exclude/index"); -const mjsi = require("inner/mjs/exclude/index"); -const typei = require("inner/js/exclude/index"); +const cjsi = __importStar(require("inner/cjs/exclude/index")); +const mjsi = __importStar(require("inner/mjs/exclude/index")); +const typei = __importStar(require("inner/js/exclude/index")); cjsi; mjsi; typei; -const cjsi2 = require("inner/cjs/index"); -const mjsi2 = require("inner/mjs/index"); -const typei2 = require("inner/js/index"); +const cjsi2 = __importStar(require("inner/cjs/index")); +const mjsi2 = __importStar(require("inner/mjs/index")); +const typei2 = __importStar(require("inner/js/index")); cjsi2; mjsi2; typei2; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).js.diff deleted file mode 100644 index 24dcd30773..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).js.diff +++ /dev/null @@ -1,104 +0,0 @@ ---- old.nodeModulesPackagePatternExportsExclude(module=node20).js -+++ new.nodeModulesPackagePatternExportsExclude(module=node20).js -@@= skipped -110, +110 lines =@@ - } - - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as cjsi from "inner/cjs/exclude/index"; --import * as mjsi from "inner/mjs/exclude/index"; --import * as typei from "inner/js/exclude/index"; -+const cjsi = require("inner/cjs/exclude/index"); -+const mjsi = require("inner/mjs/exclude/index"); -+const typei = require("inner/js/exclude/index"); - cjsi; - mjsi; - typei; --import * as cjsi2 from "inner/cjs/index"; --import * as mjsi2 from "inner/mjs/index"; --import * as typei2 from "inner/js/index"; -+const cjsi2 = require("inner/cjs/index"); -+const mjsi2 = require("inner/mjs/index"); -+const typei2 = require("inner/js/index"); - cjsi2; - mjsi2; - typei2; - //// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as cjsi from "inner/cjs/exclude/index"; --import * as mjsi from "inner/mjs/exclude/index"; --import * as typei from "inner/js/exclude/index"; -+const cjsi = require("inner/cjs/exclude/index"); -+const mjsi = require("inner/mjs/exclude/index"); -+const typei = require("inner/js/exclude/index"); - cjsi; - mjsi; - typei; --import * as cjsi2 from "inner/cjs/index"; --import * as mjsi2 from "inner/mjs/index"; --import * as typei2 from "inner/js/index"; -+const cjsi2 = require("inner/cjs/index"); -+const mjsi2 = require("inner/mjs/index"); -+const typei2 = require("inner/js/index"); - cjsi2; - mjsi2; - typei2; - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - // cjs format file --const cjsi = __importStar(require("inner/cjs/exclude/index")); --const mjsi = __importStar(require("inner/mjs/exclude/index")); --const typei = __importStar(require("inner/js/exclude/index")); -+const cjsi = require("inner/cjs/exclude/index"); -+const mjsi = require("inner/mjs/exclude/index"); -+const typei = require("inner/js/exclude/index"); - cjsi; - mjsi; - typei; --const cjsi2 = __importStar(require("inner/cjs/index")); --const mjsi2 = __importStar(require("inner/mjs/index")); --const typei2 = __importStar(require("inner/js/index")); -+const cjsi2 = require("inner/cjs/index"); -+const mjsi2 = require("inner/mjs/index"); -+const typei2 = require("inner/js/index"); - cjsi2; - mjsi2; - typei2; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).symbols index 9bcd25bcd7..8f1e180a5e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).symbols @@ -116,121 +116,151 @@ typei2; === node_modules/inner/exclude/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/exclude/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/exclude/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/exclude/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/exclude/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/exclude/test.d.mts === +// esm format file import * as cjs from "inner/cjs/exclude/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/exclude/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/exclude/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/exclude/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/exclude/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/exclude/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/exclude/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).symbols.diff deleted file mode 100644 index d499d5611f..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackagePatternExportsExclude(module=node20).symbols -+++ new.nodeModulesPackagePatternExportsExclude(module=node20).symbols -@@= skipped -185, +185 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).types index 8bdf18e1e4..893175b77c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).types @@ -116,6 +116,12 @@ typei2; === node_modules/inner/exclude/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/exclude/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; >cjs : any @@ -136,6 +142,12 @@ export { type }; === node_modules/inner/exclude/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/exclude/test.d.mts === +// esm format file import * as cjs from "inner/cjs/exclude/index"; >cjs : any @@ -156,6 +168,12 @@ export { type }; === node_modules/inner/exclude/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/exclude/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; >cjs : any @@ -176,6 +194,12 @@ export { type }; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -196,6 +220,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -216,6 +246,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).types.diff deleted file mode 100644 index 354ba167c7..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=node20).types.diff +++ /dev/null @@ -1,134 +0,0 @@ ---- old.nodeModulesPackagePatternExportsExclude(module=node20).types -+++ new.nodeModulesPackagePatternExportsExclude(module=node20).types -@@= skipped -23, +23 lines =@@ - >cjsi2 : typeof cjsi2 - - import * as mjsi2 from "inner/mjs/index"; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - import * as typei2 from "inner/js/index"; - >typei2 : typeof typei2 -@@= skipped -9, +9 lines =@@ - >cjsi2 : typeof cjsi2 - - mjsi2; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - typei2; - >typei2 : typeof typei2 -@@= skipped -29, +29 lines =@@ - >cjsi2 : typeof cjsi2 - - import * as mjsi2 from "inner/mjs/index"; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - import * as typei2 from "inner/js/index"; - >typei2 : typeof typei2 -@@= skipped -9, +9 lines =@@ - >cjsi2 : typeof cjsi2 - - mjsi2; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - typei2; - >typei2 : typeof typei2 -@@= skipped -29, +29 lines =@@ - >cjsi2 : typeof cjsi2 - - import * as mjsi2 from "inner/mjs/index"; -->mjsi2 : typeof cjsi2.mjs -+>mjsi2 : typeof mjsi2 - - import * as typei2 from "inner/js/index"; -->typei2 : typeof cjsi2.mjs.cjs.type -+>typei2 : typeof typei2 - - cjsi2; - >cjsi2 : typeof cjsi2 - - mjsi2; -->mjsi2 : typeof cjsi2.mjs -+>mjsi2 : typeof mjsi2 - - typei2; -->typei2 : typeof cjsi2.mjs.cjs.type -+>typei2 : typeof typei2 - - === node_modules/inner/exclude/index.d.ts === - // cjs format file -@@= skipped -77, +77 lines =@@ - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; - >mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -23, +23 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt index 7b905f13c1..2a889543f6 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt @@ -7,15 +7,15 @@ index.mts(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or it index.ts(2,23): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. index.ts(3,23): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. index.ts(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.cts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.cts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.cts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.mts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.mts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.mts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.ts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. -node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.cts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.cts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.cts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.mts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.mts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.mts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.ts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. +node_modules/inner/exclude/test.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. ==== index.ts (3 errors) ==== @@ -78,7 +78,10 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i cjsi2; mjsi2; typei2; -==== node_modules/inner/exclude/index.d.ts (3 errors) ==== +==== node_modules/inner/exclude/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/exclude/test.d.ts (3 errors) ==== // cjs format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -92,7 +95,10 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/exclude/index.d.mts (3 errors) ==== +==== node_modules/inner/exclude/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/exclude/test.d.mts (3 errors) ==== // esm format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -106,7 +112,10 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/exclude/index.d.cts (3 errors) ==== +==== node_modules/inner/exclude/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/exclude/test.d.cts (3 errors) ==== // cjs format file import * as cjs from "inner/cjs/exclude/index"; ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -121,6 +130,9 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i export { mjs }; export { type }; ==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (0 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -129,6 +141,9 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -137,6 +152,9 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i export { mjs }; export { type }; ==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (0 errors) ==== // cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; @@ -162,4 +180,5 @@ node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'i "./js/*": "./*.js", "./js/exclude/*": null } - } \ No newline at end of file + } + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt.diff deleted file mode 100644 index 222b759f1a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,23 +0,0 @@ ---- old.nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt -+++ new.nodeModulesPackagePatternExportsExclude(module=nodenext).errors.txt -@@= skipped -15, +15 lines =@@ - node_modules/inner/exclude/index.d.ts(2,22): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. - node_modules/inner/exclude/index.d.ts(3,22): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. - node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - - - ==== index.ts (3 errors) ==== -@@= skipped -105, +104 lines =@@ - export { cjs }; - export { mjs }; - export { type }; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index"; - import * as type from "inner/js/index"; - export { cjs }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).js index 5fe735dbc3..86bc3022de 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).js @@ -44,6 +44,9 @@ mjsi2; typei2; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/exclude/index"; import * as mjs from "inner/mjs/exclude/index"; import * as type from "inner/js/exclude/index"; @@ -52,6 +55,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/exclude/index"; import * as mjs from "inner/mjs/exclude/index"; import * as type from "inner/js/exclude/index"; @@ -60,6 +66,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/exclude/index"; import * as mjs from "inner/mjs/exclude/index"; import * as type from "inner/js/exclude/index"; @@ -68,6 +77,9 @@ export { mjs }; export { type }; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -76,6 +88,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -84,6 +99,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index"; import * as mjs from "inner/mjs/index"; import * as type from "inner/js/index"; @@ -108,7 +126,8 @@ export { type }; "./js/*": "./*.js", "./js/exclude/*": null } -} +} + //// [index.js] // esm format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).symbols index 9bcd25bcd7..8f1e180a5e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).symbols @@ -116,121 +116,151 @@ typei2; === node_modules/inner/exclude/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/exclude/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/exclude/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/exclude/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/exclude/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/exclude/test.d.mts === +// esm format file import * as cjs from "inner/cjs/exclude/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/exclude/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/exclude/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/exclude/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/exclude/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/exclude/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/exclude/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).symbols.diff deleted file mode 100644 index 4d2881e721..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackagePatternExportsExclude(module=nodenext).symbols -+++ new.nodeModulesPackagePatternExportsExclude(module=nodenext).symbols -@@= skipped -185, +185 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).types index 8bdf18e1e4..893175b77c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).types @@ -116,6 +116,12 @@ typei2; === node_modules/inner/exclude/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/exclude/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; >cjs : any @@ -136,6 +142,12 @@ export { type }; === node_modules/inner/exclude/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/exclude/test.d.mts === +// esm format file import * as cjs from "inner/cjs/exclude/index"; >cjs : any @@ -156,6 +168,12 @@ export { type }; === node_modules/inner/exclude/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/exclude/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/exclude/index"; >cjs : any @@ -176,6 +194,12 @@ export { type }; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -196,6 +220,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs @@ -216,6 +246,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).types.diff deleted file mode 100644 index 6a0208d1ed..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsExclude(module=nodenext).types.diff +++ /dev/null @@ -1,134 +0,0 @@ ---- old.nodeModulesPackagePatternExportsExclude(module=nodenext).types -+++ new.nodeModulesPackagePatternExportsExclude(module=nodenext).types -@@= skipped -23, +23 lines =@@ - >cjsi2 : typeof cjsi2 - - import * as mjsi2 from "inner/mjs/index"; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - import * as typei2 from "inner/js/index"; - >typei2 : typeof typei2 -@@= skipped -9, +9 lines =@@ - >cjsi2 : typeof cjsi2 - - mjsi2; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - typei2; - >typei2 : typeof typei2 -@@= skipped -29, +29 lines =@@ - >cjsi2 : typeof cjsi2 - - import * as mjsi2 from "inner/mjs/index"; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - import * as typei2 from "inner/js/index"; - >typei2 : typeof typei2 -@@= skipped -9, +9 lines =@@ - >cjsi2 : typeof cjsi2 - - mjsi2; -->mjsi2 : typeof cjsi2.cjs.mjs -+>mjsi2 : typeof mjsi2 - - typei2; - >typei2 : typeof typei2 -@@= skipped -29, +29 lines =@@ - >cjsi2 : typeof cjsi2 - - import * as mjsi2 from "inner/mjs/index"; -->mjsi2 : typeof cjsi2.mjs -+>mjsi2 : typeof mjsi2 - - import * as typei2 from "inner/js/index"; -->typei2 : typeof cjsi2.mjs.cjs.type -+>typei2 : typeof typei2 - - cjsi2; - >cjsi2 : typeof cjsi2 - - mjsi2; -->mjsi2 : typeof cjsi2.mjs -+>mjsi2 : typeof mjsi2 - - typei2; -->typei2 : typeof cjsi2.mjs.cjs.type -+>typei2 : typeof typei2 - - === node_modules/inner/exclude/index.d.ts === - // cjs format file -@@= skipped -77, +77 lines =@@ - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; - >mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -23, +23 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).errors.txt index 2210b62d74..df6aa2d2e6 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).errors.txt @@ -1,6 +1,6 @@ index.cts(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. ==== index.ts (0 errors) ==== @@ -29,7 +29,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; @@ -40,6 +43,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; @@ -47,7 +53,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).errors.txt.diff deleted file mode 100644 index c8e9804b85..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).errors.txt.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.nodeModulesPackagePatternExportsTrailers(module=node16).errors.txt -+++ new.nodeModulesPackagePatternExportsTrailers(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ - index.cts(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. - - -@@= skipped -29, +28 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index.mjs"; - ~~~~~~~~~~~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).js index 7e40184e6a..52eefeb460 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).symbols index 8b4f028de2..c8615a5f47 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).symbols.diff deleted file mode 100644 index 6efcd2e82c..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackagePatternExportsTrailers(module=node16).symbols -+++ new.nodeModulesPackagePatternExportsTrailers(module=node16).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).trace.json b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).trace.json index df9bceab10..586e2b5caf 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).trace.json +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).trace.json @@ -38,9 +38,12 @@ File '/.src/node_modules/inner/index.tsx' does not exist. File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.cts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.mts'. ======== Module resolution kind is not specified, using 'Node16'. -Resolving in CJS mode with conditions 'require', 'types', 'node'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -48,9 +51,12 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.cts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.mts'. ======== Module resolution kind is not specified, using 'Node16'. -Resolving in CJS mode with conditions 'require', 'types', 'node'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -58,9 +64,12 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.cts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/index.mts'. ======== Module resolution kind is not specified, using 'Node16'. -Resolving in CJS mode with conditions 'require', 'types', 'node'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. @@ -69,9 +78,12 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.mts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.cts'. ======== Module resolution kind is not specified, using 'Node16'. -Resolving in ESM mode with conditions 'import', 'types', 'node'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -79,9 +91,12 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.mts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.cts'. ======== Module resolution kind is not specified, using 'Node16'. -Resolving in ESM mode with conditions 'import', 'types', 'node'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -89,9 +104,12 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.mts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/index.cts'. ======== Module resolution kind is not specified, using 'Node16'. -Resolving in ESM mode with conditions 'import', 'types', 'node'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. @@ -100,7 +118,7 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.ts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.ts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. @@ -110,7 +128,7 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.ts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/test.d.ts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. @@ -120,7 +138,7 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.ts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/test.d.ts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. @@ -131,12 +149,9 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.mts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.mts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in ESM mode with conditions 'import', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -144,12 +159,9 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.mts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/test.d.mts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in ESM mode with conditions 'import', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -157,12 +169,9 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/index.mts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/test.d.mts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in ESM mode with conditions 'import', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. @@ -171,12 +180,9 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.cts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.cts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'require', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -184,12 +190,9 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.cts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/test.d.cts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'require', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -197,12 +200,9 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/index.cts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/test.d.cts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'require', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).types index 7d054eb128..7f7b1d09ed 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).types.diff deleted file mode 100644 index 0eb34521ce..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node16).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesPackagePatternExportsTrailers(module=node16).types -+++ new.nodeModulesPackagePatternExportsTrailers(module=node16).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; - >mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt index 2210b62d74..df6aa2d2e6 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt @@ -1,6 +1,6 @@ index.cts(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. -node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. -node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. +node_modules/inner/test.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. +node_modules/inner/test.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. ==== index.ts (0 errors) ==== @@ -29,7 +29,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ cjsi; mjsi; typei; -==== node_modules/inner/index.d.ts (1 errors) ==== +==== node_modules/inner/index.d.ts (0 errors) ==== + // cjs format file + export const implicitCjsSource = true; +==== node_modules/inner/test.d.ts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; @@ -40,6 +43,9 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { mjs }; export { type }; ==== node_modules/inner/index.d.mts (0 errors) ==== + // esm format file + export const mjsSource = true; +==== node_modules/inner/test.d.mts (0 errors) ==== // esm format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; @@ -47,7 +53,10 @@ node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJ export { cjs }; export { mjs }; export { type }; -==== node_modules/inner/index.d.cts (1 errors) ==== +==== node_modules/inner/index.d.cts (0 errors) ==== + // cjs format file + export const cjsSource = true; +==== node_modules/inner/test.d.cts (1 errors) ==== // cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt.diff deleted file mode 100644 index 9477452c75..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt -+++ new.nodeModulesPackagePatternExportsTrailers(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ - index.cts(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. - - -@@= skipped -29, +28 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index.mjs"; - ~~~~~~~~~~~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).js index 7e40184e6a..52eefeb460 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).symbols index 8b4f028de2..c8615a5f47 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).symbols.diff deleted file mode 100644 index dbec2322af..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackagePatternExportsTrailers(module=node18).symbols -+++ new.nodeModulesPackagePatternExportsTrailers(module=node18).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).trace.json b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).trace.json index df9bceab10..586e2b5caf 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).trace.json +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).trace.json @@ -38,9 +38,12 @@ File '/.src/node_modules/inner/index.tsx' does not exist. File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.cts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.mts'. ======== Module resolution kind is not specified, using 'Node16'. -Resolving in CJS mode with conditions 'require', 'types', 'node'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -48,9 +51,12 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.cts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.mts'. ======== Module resolution kind is not specified, using 'Node16'. -Resolving in CJS mode with conditions 'require', 'types', 'node'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -58,9 +64,12 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.cts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/index.mts'. ======== Module resolution kind is not specified, using 'Node16'. -Resolving in CJS mode with conditions 'require', 'types', 'node'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. @@ -69,9 +78,12 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.mts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.cts'. ======== Module resolution kind is not specified, using 'Node16'. -Resolving in ESM mode with conditions 'import', 'types', 'node'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -79,9 +91,12 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.mts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.cts'. ======== Module resolution kind is not specified, using 'Node16'. -Resolving in ESM mode with conditions 'import', 'types', 'node'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -89,9 +104,12 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.mts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/index.cts'. ======== Module resolution kind is not specified, using 'Node16'. -Resolving in ESM mode with conditions 'import', 'types', 'node'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. @@ -100,7 +118,7 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.ts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.ts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. @@ -110,7 +128,7 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.ts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/test.d.ts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. @@ -120,7 +138,7 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.ts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/test.d.ts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. @@ -131,12 +149,9 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.mts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.mts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in ESM mode with conditions 'import', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -144,12 +159,9 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.mts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/test.d.mts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in ESM mode with conditions 'import', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -157,12 +169,9 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/index.mts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/test.d.mts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in ESM mode with conditions 'import', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. @@ -171,12 +180,9 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.cts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.cts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'require', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -184,12 +190,9 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.cts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/test.d.cts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'require', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -197,12 +200,9 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/index.cts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/test.d.cts'. ======== Module resolution kind is not specified, using 'Node16'. Resolving in CJS mode with conditions 'require', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).types index 7d054eb128..7f7b1d09ed 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).types.diff deleted file mode 100644 index db52145154..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node18).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesPackagePatternExportsTrailers(module=node18).types -+++ new.nodeModulesPackagePatternExportsTrailers(module=node18).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; - >mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).errors.txt deleted file mode 100644 index 719d75264b..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).errors.txt +++ /dev/null @@ -1,69 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== index.ts (0 errors) ==== - // esm format file - import * as cjsi from "inner/cjs/index.cjs"; - import * as mjsi from "inner/mjs/index.mjs"; - import * as typei from "inner/js/index.js"; - cjsi; - mjsi; - typei; -==== index.mts (0 errors) ==== - // esm format file - import * as cjsi from "inner/cjs/index.cjs"; - import * as mjsi from "inner/mjs/index.mjs"; - import * as typei from "inner/js/index.js"; - cjsi; - mjsi; - typei; -==== index.cts (0 errors) ==== - // cjs format file - import * as cjsi from "inner/cjs/index.cjs"; - import * as mjsi from "inner/mjs/index.mjs"; - import * as typei from "inner/js/index.js"; - cjsi; - mjsi; - typei; -==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; - import * as mjs from "inner/mjs/index.mjs"; - import * as type from "inner/js/index.js"; - export { cjs }; - export { mjs }; - export { type }; -==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/cjs/index.cjs"; - import * as mjs from "inner/mjs/index.mjs"; - import * as type from "inner/js/index.js"; - export { cjs }; - export { mjs }; - export { type }; -==== node_modules/inner/index.d.cts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; - import * as mjs from "inner/mjs/index.mjs"; - import * as type from "inner/js/index.js"; - export { cjs }; - export { mjs }; - export { type }; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module" - } -==== node_modules/inner/package.json (0 errors) ==== - { - "name": "inner", - "private": true, - "exports": { - "./cjs/*.cjs": "./*.cjs", - "./mjs/*.mjs": "./*.mjs", - "./js/*.js": "./*.js" - } - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).errors.txt.diff deleted file mode 100644 index 86de4c001a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).errors.txt.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.nodeModulesPackagePatternExportsTrailers(module=node20).errors.txt -+++ new.nodeModulesPackagePatternExportsTrailers(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -- -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== index.ts (0 errors) ==== - // esm format file - import * as cjsi from "inner/cjs/index.cjs"; -@@= skipped -24, +25 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index.mjs"; - import * as type from "inner/js/index.js"; - export { cjs }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).js index 2cfbc7f1fa..52eefeb460 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -67,32 +76,61 @@ export { type }; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjsi = require("inner/cjs/index.cjs"); -const mjsi = require("inner/mjs/index.mjs"); -const typei = require("inner/js/index.js"); +import * as cjsi from "inner/cjs/index.cjs"; +import * as mjsi from "inner/mjs/index.mjs"; +import * as typei from "inner/js/index.js"; cjsi; mjsi; typei; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const cjsi = require("inner/cjs/index.cjs"); -const mjsi = require("inner/mjs/index.mjs"); -const typei = require("inner/js/index.js"); +import * as cjsi from "inner/cjs/index.cjs"; +import * as mjsi from "inner/mjs/index.mjs"; +import * as typei from "inner/js/index.js"; cjsi; mjsi; typei; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // cjs format file -const cjsi = require("inner/cjs/index.cjs"); -const mjsi = require("inner/mjs/index.mjs"); -const typei = require("inner/js/index.js"); +const cjsi = __importStar(require("inner/cjs/index.cjs")); +const mjsi = __importStar(require("inner/mjs/index.mjs")); +const typei = __importStar(require("inner/js/index.js")); cjsi; mjsi; typei; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).js.diff deleted file mode 100644 index b0579fb6ca..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).js.diff +++ /dev/null @@ -1,77 +0,0 @@ ---- old.nodeModulesPackagePatternExportsTrailers(module=node20).js -+++ new.nodeModulesPackagePatternExportsTrailers(module=node20).js -@@= skipped -66, +66 lines =@@ - - - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as cjsi from "inner/cjs/index.cjs"; --import * as mjsi from "inner/mjs/index.mjs"; --import * as typei from "inner/js/index.js"; -+const cjsi = require("inner/cjs/index.cjs"); -+const mjsi = require("inner/mjs/index.mjs"); -+const typei = require("inner/js/index.js"); - cjsi; - mjsi; - typei; - //// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as cjsi from "inner/cjs/index.cjs"; --import * as mjsi from "inner/mjs/index.mjs"; --import * as typei from "inner/js/index.js"; -+const cjsi = require("inner/cjs/index.cjs"); -+const mjsi = require("inner/mjs/index.mjs"); -+const typei = require("inner/js/index.js"); - cjsi; - mjsi; - typei; - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - // cjs format file --const cjsi = __importStar(require("inner/cjs/index.cjs")); --const mjsi = __importStar(require("inner/mjs/index.mjs")); --const typei = __importStar(require("inner/js/index.js")); -+const cjsi = require("inner/cjs/index.cjs"); -+const mjsi = require("inner/mjs/index.mjs"); -+const typei = require("inner/js/index.js"); - cjsi; - mjsi; - typei; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).symbols index 8b4f028de2..c8615a5f47 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).symbols.diff deleted file mode 100644 index bc462f6f50..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackagePatternExportsTrailers(module=node20).symbols -+++ new.nodeModulesPackagePatternExportsTrailers(module=node20).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).trace.json b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).trace.json index 06b7bca3a7..ab77c5a400 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).trace.json +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).trace.json @@ -1,6 +1,6 @@ ======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.ts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. Found 'package.json' at '/.src/package.json'. Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. @@ -12,8 +12,8 @@ File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== ======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.ts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. File '/.src/package.json' exists according to earlier cached lookups. Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. @@ -25,8 +25,8 @@ File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== ======== Resolving module 'inner/js/index.js' from '/.src/index.ts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. File '/.src/package.json' exists according to earlier cached lookups. Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. @@ -38,9 +38,12 @@ File '/.src/node_modules/inner/index.tsx' does not exist. File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.cts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.mts'. ======== +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -48,9 +51,12 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.cts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.mts'. ======== +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -58,9 +64,12 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.cts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +======== Resolving module 'inner/js/index.js' from '/.src/index.mts'. ======== +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. @@ -69,9 +78,12 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.mts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'import', 'types'. +======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.cts'. ======== +Module resolution kind is not specified, using 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -79,9 +91,12 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.mts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'import', 'types'. +======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.cts'. ======== +Module resolution kind is not specified, using 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -89,9 +104,12 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.mts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'import', 'types'. +======== Resolving module 'inner/js/index.js' from '/.src/index.cts'. ======== +Module resolution kind is not specified, using 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. @@ -100,9 +118,9 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.ts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.ts'. ======== +Module resolution kind is not specified, using 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -110,9 +128,9 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.ts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/test.d.ts'. ======== +Module resolution kind is not specified, using 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -120,9 +138,9 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.ts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. +======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/test.d.ts'. ======== +Module resolution kind is not specified, using 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. @@ -131,12 +149,9 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.mts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'import', 'types'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. +======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.mts'. ======== +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -144,12 +159,9 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.mts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'import', 'types'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. +======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/test.d.mts'. ======== +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -157,12 +169,9 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/index.mts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'import', 'types'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. +======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/test.d.mts'. ======== +Module resolution kind is not specified, using 'Node16'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. @@ -171,12 +180,9 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.cts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. +======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.cts'. ======== +Module resolution kind is not specified, using 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -184,12 +190,9 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.cts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. +======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/test.d.cts'. ======== +Module resolution kind is not specified, using 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -197,12 +200,9 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/index.cts'. ======== -Module resolution kind is not specified, using 'Bundler'. -Resolving in CJS mode with conditions 'require', 'types'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration, JSON. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. +======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/test.d.cts'. ======== +Module resolution kind is not specified, using 'Node16'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).types index 7d054eb128..7f7b1d09ed 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).types.diff deleted file mode 100644 index 60501fc3e5..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=node20).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesPackagePatternExportsTrailers(module=node20).types -+++ new.nodeModulesPackagePatternExportsTrailers(module=node20).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; - >mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).errors.txt.diff deleted file mode 100644 index 140525150f..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,74 +0,0 @@ ---- old.nodeModulesPackagePatternExportsTrailers(module=nodenext).errors.txt -+++ new.nodeModulesPackagePatternExportsTrailers(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -- -- --==== index.ts (0 errors) ==== -- // esm format file -- import * as cjsi from "inner/cjs/index.cjs"; -- import * as mjsi from "inner/mjs/index.mjs"; -- import * as typei from "inner/js/index.js"; -- cjsi; -- mjsi; -- typei; --==== index.mts (0 errors) ==== -- // esm format file -- import * as cjsi from "inner/cjs/index.cjs"; -- import * as mjsi from "inner/mjs/index.mjs"; -- import * as typei from "inner/js/index.js"; -- cjsi; -- mjsi; -- typei; --==== index.cts (0 errors) ==== -- // cjs format file -- import * as cjsi from "inner/cjs/index.cjs"; -- import * as mjsi from "inner/mjs/index.mjs"; -- import * as typei from "inner/js/index.js"; -- cjsi; -- mjsi; -- typei; --==== node_modules/inner/index.d.ts (1 errors) ==== -- // cjs format file -- import * as cjs from "inner/cjs/index.cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. -- import * as mjs from "inner/mjs/index.mjs"; -- import * as type from "inner/js/index.js"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== node_modules/inner/index.d.mts (0 errors) ==== -- // esm format file -- import * as cjs from "inner/cjs/index.cjs"; -- import * as mjs from "inner/mjs/index.mjs"; -- import * as type from "inner/js/index.js"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== node_modules/inner/index.d.cts (0 errors) ==== -- // cjs format file -- import * as cjs from "inner/cjs/index.cjs"; -- import * as mjs from "inner/mjs/index.mjs"; -- import * as type from "inner/js/index.js"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== package.json (0 errors) ==== -- { -- "name": "package", -- "private": true, -- "type": "module" -- } --==== node_modules/inner/package.json (0 errors) ==== -- { -- "name": "inner", -- "private": true, -- "exports": { -- "./cjs/*.cjs": "./*.cjs", -- "./mjs/*.mjs": "./*.mjs", -- "./js/*.js": "./*.js" -- } -- } -- -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).js b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).js index 7e40184e6a..52eefeb460 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).js @@ -26,6 +26,9 @@ mjsi; typei; //// [index.d.ts] // cjs format file +export const implicitCjsSource = true; +//// [test.d.ts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -34,6 +37,9 @@ export { mjs }; export { type }; //// [index.d.mts] // esm format file +export const mjsSource = true; +//// [test.d.mts] +// esm format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; @@ -42,6 +48,9 @@ export { mjs }; export { type }; //// [index.d.cts] // cjs format file +export const cjsSource = true; +//// [test.d.cts] +// cjs format file import * as cjs from "inner/cjs/index.cjs"; import * as mjs from "inner/mjs/index.mjs"; import * as type from "inner/js/index.js"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).symbols index 8b4f028de2..c8615a5f47 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).symbols @@ -62,61 +62,76 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : Symbol(implicitCjsSource, Decl(index.d.ts, 1, 12)) + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.ts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.ts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.ts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.ts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.ts, 3, 6)) +>type : Symbol(type, Decl(test.d.ts, 3, 6)) export { cjs }; ->cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.ts, 4, 8)) export { mjs }; ->mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.ts, 5, 8)) export { type }; ->type : Symbol(type.type, Decl(index.d.ts, 6, 8)) +>type : Symbol(type, Decl(test.d.ts, 6, 8)) === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : Symbol(mjsSource, Decl(index.d.mts, 1, 12)) + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.mts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.mts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.mts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.mts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.mts, 3, 6)) +>type : Symbol(type, Decl(test.d.mts, 3, 6)) export { cjs }; ->cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.mts, 4, 8)) export { mjs }; ->mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.mts, 5, 8)) export { type }; ->type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) +>type : Symbol(type, Decl(test.d.mts, 6, 8)) === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : Symbol(cjsSource, Decl(index.d.cts, 1, 12)) + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; ->cjs : Symbol(cjs, Decl(index.d.cts, 1, 6)) +>cjs : Symbol(cjs, Decl(test.d.cts, 1, 6)) import * as mjs from "inner/mjs/index.mjs"; ->mjs : Symbol(mjs, Decl(index.d.cts, 2, 6)) +>mjs : Symbol(mjs, Decl(test.d.cts, 2, 6)) import * as type from "inner/js/index.js"; ->type : Symbol(type, Decl(index.d.cts, 3, 6)) +>type : Symbol(type, Decl(test.d.cts, 3, 6)) export { cjs }; ->cjs : Symbol(cjs.cjs, Decl(index.d.cts, 4, 8)) +>cjs : Symbol(cjs, Decl(test.d.cts, 4, 8)) export { mjs }; ->mjs : Symbol(cjs.mjs, Decl(index.d.cts, 5, 8)) +>mjs : Symbol(mjs, Decl(test.d.cts, 5, 8)) export { type }; ->type : Symbol(cjs.type, Decl(index.d.cts, 6, 8)) +>type : Symbol(type, Decl(test.d.cts, 6, 8)) diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).symbols.diff deleted file mode 100644 index f5dd3186c0..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).symbols.diff +++ /dev/null @@ -1,36 +0,0 @@ ---- old.nodeModulesPackagePatternExportsTrailers(module=nodenext).symbols -+++ new.nodeModulesPackagePatternExportsTrailers(module=nodenext).symbols -@@= skipped -71, +71 lines =@@ - >type : Symbol(type, Decl(index.d.ts, 3, 6)) - - export { cjs }; -->cjs : Symbol(mjs.cjs.cjs.type.cjs, Decl(index.d.ts, 4, 8)) -+>cjs : Symbol(type.cjs, Decl(index.d.ts, 4, 8)) - - export { mjs }; -->mjs : Symbol(mjs.cjs.cjs.type.mjs, Decl(index.d.ts, 5, 8)) -+>mjs : Symbol(type.mjs, Decl(index.d.ts, 5, 8)) - - export { type }; -->type : Symbol(mjs.cjs.cjs.type.type, Decl(index.d.ts, 6, 8)) -+>type : Symbol(type.type, Decl(index.d.ts, 6, 8)) - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -20, +20 lines =@@ - >type : Symbol(type, Decl(index.d.mts, 3, 6)) - - export { cjs }; -->cjs : Symbol(cjs.cjs.mjs.cjs, Decl(index.d.mts, 4, 8)) -+>cjs : Symbol(mjs.cjs, Decl(index.d.mts, 4, 8)) - - export { mjs }; -->mjs : Symbol(cjs.cjs.mjs.mjs, Decl(index.d.mts, 5, 8)) -+>mjs : Symbol(mjs.mjs, Decl(index.d.mts, 5, 8)) - - export { type }; -->type : Symbol(cjs.cjs.mjs.type, Decl(index.d.mts, 6, 8)) -+>type : Symbol(mjs.type, Decl(index.d.mts, 6, 8)) - - === node_modules/inner/index.d.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).trace.json b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).trace.json index f537658d65..937c9e4784 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).trace.json +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).trace.json @@ -38,9 +38,12 @@ File '/.src/node_modules/inner/index.tsx' does not exist. File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.cts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.mts'. ======== Module resolution kind is not specified, using 'NodeNext'. -Resolving in CJS mode with conditions 'require', 'types', 'node'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -48,9 +51,12 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.cts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.mts'. ======== Module resolution kind is not specified, using 'NodeNext'. -Resolving in CJS mode with conditions 'require', 'types', 'node'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -58,9 +64,12 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.cts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/index.mts'. ======== Module resolution kind is not specified, using 'NodeNext'. -Resolving in CJS mode with conditions 'require', 'types', 'node'. +Resolving in ESM mode with conditions 'import', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. @@ -69,9 +78,12 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.mts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.cts'. ======== Module resolution kind is not specified, using 'NodeNext'. -Resolving in ESM mode with conditions 'import', 'types', 'node'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -79,9 +91,12 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.mts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.cts'. ======== Module resolution kind is not specified, using 'NodeNext'. -Resolving in ESM mode with conditions 'import', 'types', 'node'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -89,9 +104,12 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.mts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/index.cts'. ======== Module resolution kind is not specified, using 'NodeNext'. -Resolving in ESM mode with conditions 'import', 'types', 'node'. +Resolving in CJS mode with conditions 'require', 'types', 'node'. +File '/.src/package.json' exists according to earlier cached lookups. +Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. +Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. @@ -100,7 +118,7 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/index.d.ts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.ts'. ======== Module resolution kind is not specified, using 'NodeNext'. Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. @@ -110,7 +128,7 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/index.d.ts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/test.d.ts'. ======== Module resolution kind is not specified, using 'NodeNext'. Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. @@ -120,7 +138,7 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/index.d.ts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/test.d.ts'. ======== Module resolution kind is not specified, using 'NodeNext'. Resolving in CJS mode with conditions 'require', 'types', 'node'. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. @@ -131,12 +149,9 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.mts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.mts'. ======== Module resolution kind is not specified, using 'NodeNext'. Resolving in ESM mode with conditions 'import', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -144,12 +159,9 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.mts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/test.d.mts'. ======== Module resolution kind is not specified, using 'NodeNext'. Resolving in ESM mode with conditions 'import', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -157,12 +169,9 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/index.mts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/test.d.mts'. ======== Module resolution kind is not specified, using 'NodeNext'. Resolving in ESM mode with conditions 'import', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. @@ -171,12 +180,9 @@ File '/.src/node_modules/inner/index.tsx' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.ts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.ts', result '/.src/node_modules/inner/index.d.ts'. ======== Module name 'inner/js/index.js' was successfully resolved to '/.src/node_modules/inner/index.d.ts'. ======== -======== Resolving module 'inner/cjs/index.cjs' from '/.src/index.cts'. ======== +======== Resolving module 'inner/cjs/index.cjs' from '/.src/node_modules/inner/test.d.cts'. ======== Module resolution kind is not specified, using 'NodeNext'. Resolving in CJS mode with conditions 'require', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/cjs/index.cjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './cjs/*.cjs' with target './index.cjs'. File name '/.src/node_modules/inner/index.cjs' has a '.cjs' extension - stripping it. @@ -184,12 +190,9 @@ File '/.src/node_modules/inner/index.cts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.cts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.cts', result '/.src/node_modules/inner/index.d.cts'. ======== Module name 'inner/cjs/index.cjs' was successfully resolved to '/.src/node_modules/inner/index.d.cts'. ======== -======== Resolving module 'inner/mjs/index.mjs' from '/.src/index.cts'. ======== +======== Resolving module 'inner/mjs/index.mjs' from '/.src/node_modules/inner/test.d.cts'. ======== Module resolution kind is not specified, using 'NodeNext'. Resolving in CJS mode with conditions 'require', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/mjs/index.mjs' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './mjs/*.mjs' with target './index.mjs'. File name '/.src/node_modules/inner/index.mjs' has a '.mjs' extension - stripping it. @@ -197,12 +200,9 @@ File '/.src/node_modules/inner/index.mts' does not exist according to earlier ca File '/.src/node_modules/inner/index.d.mts' exists - use it as a name resolution result. Resolving real path for '/.src/node_modules/inner/index.d.mts', result '/.src/node_modules/inner/index.d.mts'. ======== Module name 'inner/mjs/index.mjs' was successfully resolved to '/.src/node_modules/inner/index.d.mts'. ======== -======== Resolving module 'inner/js/index.js' from '/.src/index.cts'. ======== +======== Resolving module 'inner/js/index.js' from '/.src/node_modules/inner/test.d.cts'. ======== Module resolution kind is not specified, using 'NodeNext'. Resolving in CJS mode with conditions 'require', 'types', 'node'. -File '/.src/package.json' exists according to earlier cached lookups. -Loading module 'inner/js/index.js' from 'node_modules' folder, target file types: TypeScript, JavaScript, Declaration. -Searching all ancestor node_modules directories for preferred extensions: TypeScript, Declaration. File '/.src/node_modules/inner/package.json' exists according to earlier cached lookups. Using 'exports' subpath './js/*.js' with target './index.js'. File name '/.src/node_modules/inner/index.js' has a '.js' extension - stripping it. diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).types index 7d054eb128..7f7b1d09ed 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).types @@ -62,6 +62,12 @@ typei; === node_modules/inner/index.d.ts === // cjs format file +export const implicitCjsSource = true; +>implicitCjsSource : true +>true : true + +=== node_modules/inner/test.d.ts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -82,6 +88,12 @@ export { type }; === node_modules/inner/index.d.mts === // esm format file +export const mjsSource = true; +>mjsSource : true +>true : true + +=== node_modules/inner/test.d.mts === +// esm format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs @@ -102,6 +114,12 @@ export { type }; === node_modules/inner/index.d.cts === // cjs format file +export const cjsSource = true; +>cjsSource : true +>true : true + +=== node_modules/inner/test.d.cts === +// cjs format file import * as cjs from "inner/cjs/index.cjs"; >cjs : typeof cjs diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).types.diff deleted file mode 100644 index edc61e89d4..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesPackagePatternExportsTrailers(module=nodenext).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesPackagePatternExportsTrailers(module=nodenext).types -+++ new.nodeModulesPackagePatternExportsTrailers(module=nodenext).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; - >mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).errors.txt index 57fa0360c3..5a28c77e93 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).errors.txt @@ -1,4 +1,3 @@ -index.cts(5,33): error TS2339: Property 'name' does not exist on type 'string'. index.mts(1,34): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. index.mts(3,38): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. index.ts(1,34): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. @@ -15,14 +14,12 @@ index.ts(3,38): error TS2823: Import attributes are only supported when the '--m !!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. export const thing = ns; export const name2 = ns.default.name; -==== index.cts (1 errors) ==== +==== index.cts (0 errors) ==== import pkg from "./package.json"; export const name = pkg.name; import * as ns from "./package.json"; export const thing = ns; export const name2 = ns.default.name; - ~~~~ -!!! error TS2339: Property 'name' does not exist on type 'string'. ==== index.mts (2 errors) ==== import pkg from "./package.json" with { type: "json" }; ~~~~~~~~~~~~~~~~~~~~~ diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).errors.txt.diff deleted file mode 100644 index de3ff5ceb2..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).errors.txt.diff +++ /dev/null @@ -1,23 +0,0 @@ ---- old.nodeModulesResolveJsonModule(module=node16).errors.txt -+++ new.nodeModulesResolveJsonModule(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ -+index.cts(5,33): error TS2339: Property 'name' does not exist on type 'string'. - index.mts(1,34): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. - index.mts(3,38): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. - index.ts(1,34): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. -@@= skipped -13, +14 lines =@@ - !!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. - export const thing = ns; - export const name2 = ns.default.name; --==== index.cts (0 errors) ==== -+==== index.cts (1 errors) ==== - import pkg from "./package.json"; - export const name = pkg.name; - import * as ns from "./package.json"; - export const thing = ns; - export const name2 = ns.default.name; -+ ~~~~ -+!!! error TS2339: Property 'name' does not exist on type 'string'. - ==== index.mts (2 errors) ==== - import pkg from "./package.json" with { type: "json" }; - ~~~~~~~~~~~~~~~~~~~~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).js b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).js index f310acacc7..5194c1c452 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).js @@ -109,9 +109,14 @@ export declare const thing: { name: string; version: string; type: string; - default: string; + default: { + name: string; + version: string; + type: string; + default: string; + }; }; -export declare const name2: any; +export declare const name2: string; //// [index.d.mts] export declare const name: string; export declare const thing: { diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).js.diff deleted file mode 100644 index e549926d35..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).js.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.nodeModulesResolveJsonModule(module=node16).js -+++ new.nodeModulesResolveJsonModule(module=node16).js -@@= skipped -108, +108 lines =@@ - name: string; - version: string; - type: string; -- default: { -- name: string; -- version: string; -- type: string; -- default: string; -- }; -+ default: string; - }; --export declare const name2: string; -+export declare const name2: any; - //// [index.d.mts] - export declare const name: string; - export declare const thing: { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).symbols index 569f4b48c0..e38476567a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).symbols @@ -44,9 +44,11 @@ export const thing = ns; export const name2 = ns.default.name; >name2 : Symbol(name2, Decl(index.cts, 4, 12)) ->ns.default : Symbol(default, Decl(package.json, 3, 21)) +>ns.default.name : Symbol("name", Decl(package.json, 0, 1)) +>ns.default : Symbol("package") >ns : Symbol(ns, Decl(index.cts, 2, 6)) ->default : Symbol(default, Decl(package.json, 3, 21)) +>default : Symbol("package") +>name : Symbol("name", Decl(package.json, 0, 1)) === index.mts === import pkg from "./package.json" with { type: "json" }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).symbols.diff deleted file mode 100644 index 75e1f38439..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).symbols.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.nodeModulesResolveJsonModule(module=node16).symbols -+++ new.nodeModulesResolveJsonModule(module=node16).symbols -@@= skipped -43, +43 lines =@@ - - export const name2 = ns.default.name; - >name2 : Symbol(name2, Decl(index.cts, 4, 12)) -->ns.default.name : Symbol("name", Decl(package.json, 0, 1)) -->ns.default : Symbol("package") -+>ns.default : Symbol(default, Decl(package.json, 3, 21)) - >ns : Symbol(ns, Decl(index.cts, 2, 6)) -->default : Symbol("package") -->name : Symbol("name", Decl(package.json, 0, 1)) -+>default : Symbol(default, Decl(package.json, 3, 21)) - - === index.mts === - import pkg from "./package.json" with { type: "json" }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).types b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).types index 8fd2b5dc73..10ecedb434 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).types @@ -38,19 +38,19 @@ export const name = pkg.name; >name : string import * as ns from "./package.json"; ->ns : { name: string; version: string; type: string; default: string; } +>ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } export const thing = ns; ->thing : { name: string; version: string; type: string; default: string; } ->ns : { name: string; version: string; type: string; default: string; } +>thing : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } +>ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } export const name2 = ns.default.name; ->name2 : any ->ns.default.name : any ->ns.default : string ->ns : { name: string; version: string; type: string; default: string; } ->default : string ->name : any +>name2 : string +>ns.default.name : string +>ns.default : { name: string; version: string; type: string; default: string; } +>ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } +>default : { name: string; version: string; type: string; default: string; } +>name : string === index.mts === import pkg from "./package.json" with { type: "json" }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).types.diff deleted file mode 100644 index cf78840e09..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node16).types.diff +++ /dev/null @@ -1,31 +0,0 @@ ---- old.nodeModulesResolveJsonModule(module=node16).types -+++ new.nodeModulesResolveJsonModule(module=node16).types -@@= skipped -37, +37 lines =@@ - >name : string - - import * as ns from "./package.json"; -->ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } -+>ns : { name: string; version: string; type: string; default: string; } - - export const thing = ns; -->thing : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } -->ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } -+>thing : { name: string; version: string; type: string; default: string; } -+>ns : { name: string; version: string; type: string; default: string; } - - export const name2 = ns.default.name; -->name2 : string -->ns.default.name : string -->ns.default : { name: string; version: string; type: string; default: string; } -->ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } -->default : { name: string; version: string; type: string; default: string; } -->name : string -+>name2 : any -+>ns.default.name : any -+>ns.default : string -+>ns : { name: string; version: string; type: string; default: string; } -+>default : string -+>name : any - - === index.mts === - import pkg from "./package.json" with { type: "json" }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).errors.txt deleted file mode 100644 index 10ebcd6562..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).errors.txt +++ /dev/null @@ -1,30 +0,0 @@ -index.cts(5,33): error TS2339: Property 'name' does not exist on type 'string'. - - -==== index.ts (0 errors) ==== - import pkg from "./package.json" with { type: "json" }; - export const name = pkg.name; - import * as ns from "./package.json" with { type: "json" }; - export const thing = ns; - export const name2 = ns.default.name; -==== index.cts (1 errors) ==== - import pkg from "./package.json"; - export const name = pkg.name; - import * as ns from "./package.json"; - export const thing = ns; - export const name2 = ns.default.name; - ~~~~ -!!! error TS2339: Property 'name' does not exist on type 'string'. -==== index.mts (0 errors) ==== - import pkg from "./package.json" with { type: "json" }; - export const name = pkg.name; - import * as ns from "./package.json" with { type: "json" }; - export const thing = ns; - export const name2 = ns.default.name; -==== package.json (0 errors) ==== - { - "name": "pkg", - "version": "0.0.1", - "type": "module", - "default": "misedirection" - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).errors.txt.diff deleted file mode 100644 index 0363f40d0f..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).errors.txt.diff +++ /dev/null @@ -1,34 +0,0 @@ ---- old.nodeModulesResolveJsonModule(module=node18).errors.txt -+++ new.nodeModulesResolveJsonModule(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ -- -+index.cts(5,33): error TS2339: Property 'name' does not exist on type 'string'. -+ -+ -+==== index.ts (0 errors) ==== -+ import pkg from "./package.json" with { type: "json" }; -+ export const name = pkg.name; -+ import * as ns from "./package.json" with { type: "json" }; -+ export const thing = ns; -+ export const name2 = ns.default.name; -+==== index.cts (1 errors) ==== -+ import pkg from "./package.json"; -+ export const name = pkg.name; -+ import * as ns from "./package.json"; -+ export const thing = ns; -+ export const name2 = ns.default.name; -+ ~~~~ -+!!! error TS2339: Property 'name' does not exist on type 'string'. -+==== index.mts (0 errors) ==== -+ import pkg from "./package.json" with { type: "json" }; -+ export const name = pkg.name; -+ import * as ns from "./package.json" with { type: "json" }; -+ export const thing = ns; -+ export const name2 = ns.default.name; -+==== package.json (0 errors) ==== -+ { -+ "name": "pkg", -+ "version": "0.0.1", -+ "type": "module", -+ "default": "misedirection" -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).js b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).js index f310acacc7..5194c1c452 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).js @@ -109,9 +109,14 @@ export declare const thing: { name: string; version: string; type: string; - default: string; + default: { + name: string; + version: string; + type: string; + default: string; + }; }; -export declare const name2: any; +export declare const name2: string; //// [index.d.mts] export declare const name: string; export declare const thing: { diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).js.diff deleted file mode 100644 index dd5c415c8e..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).js.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.nodeModulesResolveJsonModule(module=node18).js -+++ new.nodeModulesResolveJsonModule(module=node18).js -@@= skipped -108, +108 lines =@@ - name: string; - version: string; - type: string; -- default: { -- name: string; -- version: string; -- type: string; -- default: string; -- }; -+ default: string; - }; --export declare const name2: string; -+export declare const name2: any; - //// [index.d.mts] - export declare const name: string; - export declare const thing: { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).symbols index 569f4b48c0..e38476567a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).symbols @@ -44,9 +44,11 @@ export const thing = ns; export const name2 = ns.default.name; >name2 : Symbol(name2, Decl(index.cts, 4, 12)) ->ns.default : Symbol(default, Decl(package.json, 3, 21)) +>ns.default.name : Symbol("name", Decl(package.json, 0, 1)) +>ns.default : Symbol("package") >ns : Symbol(ns, Decl(index.cts, 2, 6)) ->default : Symbol(default, Decl(package.json, 3, 21)) +>default : Symbol("package") +>name : Symbol("name", Decl(package.json, 0, 1)) === index.mts === import pkg from "./package.json" with { type: "json" }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).symbols.diff deleted file mode 100644 index 9001e12b6d..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).symbols.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.nodeModulesResolveJsonModule(module=node18).symbols -+++ new.nodeModulesResolveJsonModule(module=node18).symbols -@@= skipped -43, +43 lines =@@ - - export const name2 = ns.default.name; - >name2 : Symbol(name2, Decl(index.cts, 4, 12)) -->ns.default.name : Symbol("name", Decl(package.json, 0, 1)) -->ns.default : Symbol("package") -+>ns.default : Symbol(default, Decl(package.json, 3, 21)) - >ns : Symbol(ns, Decl(index.cts, 2, 6)) -->default : Symbol("package") -->name : Symbol("name", Decl(package.json, 0, 1)) -+>default : Symbol(default, Decl(package.json, 3, 21)) - - === index.mts === - import pkg from "./package.json" with { type: "json" }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).types b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).types index 8fd2b5dc73..10ecedb434 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).types @@ -38,19 +38,19 @@ export const name = pkg.name; >name : string import * as ns from "./package.json"; ->ns : { name: string; version: string; type: string; default: string; } +>ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } export const thing = ns; ->thing : { name: string; version: string; type: string; default: string; } ->ns : { name: string; version: string; type: string; default: string; } +>thing : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } +>ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } export const name2 = ns.default.name; ->name2 : any ->ns.default.name : any ->ns.default : string ->ns : { name: string; version: string; type: string; default: string; } ->default : string ->name : any +>name2 : string +>ns.default.name : string +>ns.default : { name: string; version: string; type: string; default: string; } +>ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } +>default : { name: string; version: string; type: string; default: string; } +>name : string === index.mts === import pkg from "./package.json" with { type: "json" }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).types.diff index 9c95540b00..95ebbedeff 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node18).types.diff @@ -18,33 +18,7 @@ export const thing = ns; >thing : { default: { name: string; version: string; type: string; default: string; }; } -@@= skipped -25, +25 lines =@@ - >name : string - - import * as ns from "./package.json"; -->ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } -+>ns : { name: string; version: string; type: string; default: string; } - - export const thing = ns; -->thing : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } -->ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } -+>thing : { name: string; version: string; type: string; default: string; } -+>ns : { name: string; version: string; type: string; default: string; } - - export const name2 = ns.default.name; -->name2 : string -->ns.default.name : string -->ns.default : { name: string; version: string; type: string; default: string; } -->ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } -->default : { name: string; version: string; type: string; default: string; } -->name : string -+>name2 : any -+>ns.default.name : any -+>ns.default : string -+>ns : { name: string; version: string; type: string; default: string; } -+>default : string -+>name : any - +@@= skipped -42, +42 lines =@@ === index.mts === import pkg from "./package.json" with { type: "json" }; >pkg : { name: string; version: string; type: string; default: string; } @@ -53,7 +27,7 @@ export const name = pkg.name; >name : string -@@= skipped -27, +27 lines =@@ +@@= skipped -10, +10 lines =@@ import * as ns from "./package.json" with { type: "json" }; >ns : { default: { name: string; version: string; type: string; default: string; }; } diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).errors.txt deleted file mode 100644 index 5de66406d8..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).errors.txt +++ /dev/null @@ -1,41 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -index.cts(5,33): error TS2339: Property 'name' does not exist on type 'string'. -index.ts(1,34): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -index.ts(3,38): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -index.ts(5,33): error TS2339: Property 'name' does not exist on type 'string'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== index.ts (3 errors) ==== - import pkg from "./package.json" with { type: "json" }; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - export const name = pkg.name; - import * as ns from "./package.json" with { type: "json" }; - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. - export const thing = ns; - export const name2 = ns.default.name; - ~~~~ -!!! error TS2339: Property 'name' does not exist on type 'string'. -==== index.cts (1 errors) ==== - import pkg from "./package.json"; - export const name = pkg.name; - import * as ns from "./package.json"; - export const thing = ns; - export const name2 = ns.default.name; - ~~~~ -!!! error TS2339: Property 'name' does not exist on type 'string'. -==== index.mts (0 errors) ==== - import pkg from "./package.json" with { type: "json" }; - export const name = pkg.name; - import * as ns from "./package.json" with { type: "json" }; - export const thing = ns; - export const name2 = ns.default.name; -==== package.json (0 errors) ==== - { - "name": "pkg", - "version": "0.0.1", - "type": "module", - "default": "misedirection" - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).errors.txt.diff deleted file mode 100644 index 0093846b57..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).errors.txt.diff +++ /dev/null @@ -1,45 +0,0 @@ ---- old.nodeModulesResolveJsonModule(module=node20).errors.txt -+++ new.nodeModulesResolveJsonModule(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+index.cts(5,33): error TS2339: Property 'name' does not exist on type 'string'. -+index.ts(1,34): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -+index.ts(3,38): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -+index.ts(5,33): error TS2339: Property 'name' does not exist on type 'string'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== index.ts (3 errors) ==== -+ import pkg from "./package.json" with { type: "json" }; -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -+ export const name = pkg.name; -+ import * as ns from "./package.json" with { type: "json" }; -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -+ export const thing = ns; -+ export const name2 = ns.default.name; -+ ~~~~ -+!!! error TS2339: Property 'name' does not exist on type 'string'. -+==== index.cts (1 errors) ==== -+ import pkg from "./package.json"; -+ export const name = pkg.name; -+ import * as ns from "./package.json"; -+ export const thing = ns; -+ export const name2 = ns.default.name; -+ ~~~~ -+!!! error TS2339: Property 'name' does not exist on type 'string'. -+==== index.mts (0 errors) ==== -+ import pkg from "./package.json" with { type: "json" }; -+ export const name = pkg.name; -+ import * as ns from "./package.json" with { type: "json" }; -+ export const thing = ns; -+ export const name2 = ns.default.name; -+==== package.json (0 errors) ==== -+ { -+ "name": "pkg", -+ "version": "0.0.1", -+ "type": "module", -+ "default": "misedirection" -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).js index e0c8814c68..5194c1c452 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).js @@ -34,52 +34,89 @@ export const name2 = ns.default.name; "default": "misedirection" } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.name2 = exports.thing = exports.name = void 0; -const package_json_1 = require("./package.json"); -exports.name = package_json_1.default.name; -const ns = require("./package.json"); -exports.thing = ns; -exports.name2 = ns.default.name; +import pkg from "./package.json" with { type: "json" }; +export const name = pkg.name; +import * as ns from "./package.json" with { type: "json" }; +export const thing = ns; +export const name2 = ns.default.name; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.name2 = exports.thing = exports.name = void 0; -const package_json_1 = require("./package.json"); +const package_json_1 = __importDefault(require("./package.json")); exports.name = package_json_1.default.name; -const ns = require("./package.json"); +const ns = __importStar(require("./package.json")); exports.thing = ns; exports.name2 = ns.default.name; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.name2 = exports.thing = exports.name = void 0; -const package_json_1 = require("./package.json"); -exports.name = package_json_1.default.name; -const ns = require("./package.json"); -exports.thing = ns; -exports.name2 = ns.default.name; +import pkg from "./package.json" with { type: "json" }; +export const name = pkg.name; +import * as ns from "./package.json" with { type: "json" }; +export const thing = ns; +export const name2 = ns.default.name; //// [index.d.ts] export declare const name: string; export declare const thing: { - name: string; - version: string; - type: string; - default: string; + default: { + name: string; + version: string; + type: string; + default: string; + }; }; -export declare const name2: any; +export declare const name2: string; //// [index.d.cts] export declare const name: string; export declare const thing: { name: string; version: string; type: string; - default: string; + default: { + name: string; + version: string; + type: string; + default: string; + }; }; -export declare const name2: any; +export declare const name2: string; //// [index.d.mts] export declare const name: string; export declare const thing: { diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).js.diff deleted file mode 100644 index 3f6b266450..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).js.diff +++ /dev/null @@ -1,117 +0,0 @@ ---- old.nodeModulesResolveJsonModule(module=node20).js -+++ new.nodeModulesResolveJsonModule(module=node20).js -@@= skipped -33, +33 lines =@@ - "default": "misedirection" - } - //// [index.js] --import pkg from "./package.json" with { type: "json" }; --export const name = pkg.name; --import * as ns from "./package.json" with { type: "json" }; --export const thing = ns; --export const name2 = ns.default.name; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.name2 = exports.thing = exports.name = void 0; -+const package_json_1 = require("./package.json"); -+exports.name = package_json_1.default.name; -+const ns = require("./package.json"); -+exports.thing = ns; -+exports.name2 = ns.default.name; - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); --var __importDefault = (this && this.__importDefault) || function (mod) { -- return (mod && mod.__esModule) ? mod : { "default": mod }; --}; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.name2 = exports.thing = exports.name = void 0; --const package_json_1 = __importDefault(require("./package.json")); -+const package_json_1 = require("./package.json"); - exports.name = package_json_1.default.name; --const ns = __importStar(require("./package.json")); -+const ns = require("./package.json"); - exports.thing = ns; - exports.name2 = ns.default.name; - //// [index.mjs] --import pkg from "./package.json" with { type: "json" }; --export const name = pkg.name; --import * as ns from "./package.json" with { type: "json" }; --export const thing = ns; --export const name2 = ns.default.name; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.name2 = exports.thing = exports.name = void 0; -+const package_json_1 = require("./package.json"); -+exports.name = package_json_1.default.name; -+const ns = require("./package.json"); -+exports.thing = ns; -+exports.name2 = ns.default.name; - - - //// [index.d.ts] - export declare const name: string; - export declare const thing: { -- default: { -- name: string; -- version: string; -- type: string; -- default: string; -- }; -+ name: string; -+ version: string; -+ type: string; -+ default: string; - }; --export declare const name2: string; -+export declare const name2: any; - //// [index.d.cts] - export declare const name: string; - export declare const thing: { - name: string; - version: string; - type: string; -- default: { -- name: string; -- version: string; -- type: string; -- default: string; -- }; -+ default: string; - }; --export declare const name2: string; -+export declare const name2: any; - //// [index.d.mts] - export declare const name: string; - export declare const thing: { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).symbols index bef5d92629..e38476567a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).symbols @@ -19,9 +19,11 @@ export const thing = ns; export const name2 = ns.default.name; >name2 : Symbol(name2, Decl(index.ts, 4, 12)) ->ns.default : Symbol(default, Decl(package.json, 3, 21)) +>ns.default.name : Symbol("name", Decl(package.json, 0, 1)) +>ns.default : Symbol("package") >ns : Symbol(ns, Decl(index.ts, 2, 6)) ->default : Symbol(default, Decl(package.json, 3, 21)) +>default : Symbol("package") +>name : Symbol("name", Decl(package.json, 0, 1)) === index.cts === import pkg from "./package.json"; @@ -42,9 +44,11 @@ export const thing = ns; export const name2 = ns.default.name; >name2 : Symbol(name2, Decl(index.cts, 4, 12)) ->ns.default : Symbol(default, Decl(package.json, 3, 21)) +>ns.default.name : Symbol("name", Decl(package.json, 0, 1)) +>ns.default : Symbol("package") >ns : Symbol(ns, Decl(index.cts, 2, 6)) ->default : Symbol(default, Decl(package.json, 3, 21)) +>default : Symbol("package") +>name : Symbol("name", Decl(package.json, 0, 1)) === index.mts === import pkg from "./package.json" with { type: "json" }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).symbols.diff deleted file mode 100644 index b9063592ce..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).symbols.diff +++ /dev/null @@ -1,30 +0,0 @@ ---- old.nodeModulesResolveJsonModule(module=node20).symbols -+++ new.nodeModulesResolveJsonModule(module=node20).symbols -@@= skipped -18, +18 lines =@@ - - export const name2 = ns.default.name; - >name2 : Symbol(name2, Decl(index.ts, 4, 12)) -->ns.default.name : Symbol("name", Decl(package.json, 0, 1)) -->ns.default : Symbol("package") -+>ns.default : Symbol(default, Decl(package.json, 3, 21)) - >ns : Symbol(ns, Decl(index.ts, 2, 6)) -->default : Symbol("package") -->name : Symbol("name", Decl(package.json, 0, 1)) -+>default : Symbol(default, Decl(package.json, 3, 21)) - - === index.cts === - import pkg from "./package.json"; -@@= skipped -25, +23 lines =@@ - - export const name2 = ns.default.name; - >name2 : Symbol(name2, Decl(index.cts, 4, 12)) -->ns.default.name : Symbol("name", Decl(package.json, 0, 1)) -->ns.default : Symbol("package") -+>ns.default : Symbol(default, Decl(package.json, 3, 21)) - >ns : Symbol(ns, Decl(index.cts, 2, 6)) -->default : Symbol("package") -->name : Symbol("name", Decl(package.json, 0, 1)) -+>default : Symbol(default, Decl(package.json, 3, 21)) - - === index.mts === - import pkg from "./package.json" with { type: "json" }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).types index acee90d541..10ecedb434 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).types @@ -12,20 +12,20 @@ export const name = pkg.name; >name : string import * as ns from "./package.json" with { type: "json" }; ->ns : { name: string; version: string; type: string; default: string; } +>ns : { default: { name: string; version: string; type: string; default: string; }; } >type : any export const thing = ns; ->thing : { name: string; version: string; type: string; default: string; } ->ns : { name: string; version: string; type: string; default: string; } +>thing : { default: { name: string; version: string; type: string; default: string; }; } +>ns : { default: { name: string; version: string; type: string; default: string; }; } export const name2 = ns.default.name; ->name2 : any ->ns.default.name : any ->ns.default : string ->ns : { name: string; version: string; type: string; default: string; } ->default : string ->name : any +>name2 : string +>ns.default.name : string +>ns.default : { name: string; version: string; type: string; default: string; } +>ns : { default: { name: string; version: string; type: string; default: string; }; } +>default : { name: string; version: string; type: string; default: string; } +>name : string === index.cts === import pkg from "./package.json"; @@ -38,19 +38,19 @@ export const name = pkg.name; >name : string import * as ns from "./package.json"; ->ns : { name: string; version: string; type: string; default: string; } +>ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } export const thing = ns; ->thing : { name: string; version: string; type: string; default: string; } ->ns : { name: string; version: string; type: string; default: string; } +>thing : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } +>ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } export const name2 = ns.default.name; ->name2 : any ->ns.default.name : any ->ns.default : string ->ns : { name: string; version: string; type: string; default: string; } ->default : string ->name : any +>name2 : string +>ns.default.name : string +>ns.default : { name: string; version: string; type: string; default: string; } +>ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } +>default : { name: string; version: string; type: string; default: string; } +>name : string === index.mts === import pkg from "./package.json" with { type: "json" }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).types.diff index e68ca2723b..8ddea0652d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=node20).types.diff @@ -9,64 +9,16 @@ export const name = pkg.name; >name : string -@@= skipped -9, +9 lines =@@ - >name : string +@@= skipped -10, +10 lines =@@ import * as ns from "./package.json" with { type: "json" }; -->ns : { default: { name: string; version: string; type: string; default: string; }; } + >ns : { default: { name: string; version: string; type: string; default: string; }; } ->type : error -+>ns : { name: string; version: string; type: string; default: string; } +>type : any export const thing = ns; -->thing : { default: { name: string; version: string; type: string; default: string; }; } -->ns : { default: { name: string; version: string; type: string; default: string; }; } -+>thing : { name: string; version: string; type: string; default: string; } -+>ns : { name: string; version: string; type: string; default: string; } - - export const name2 = ns.default.name; -->name2 : string -->ns.default.name : string -->ns.default : { name: string; version: string; type: string; default: string; } -->ns : { default: { name: string; version: string; type: string; default: string; }; } -->default : { name: string; version: string; type: string; default: string; } -->name : string -+>name2 : any -+>ns.default.name : any -+>ns.default : string -+>ns : { name: string; version: string; type: string; default: string; } -+>default : string -+>name : any - - === index.cts === - import pkg from "./package.json"; -@@= skipped -26, +26 lines =@@ - >name : string - - import * as ns from "./package.json"; -->ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } -+>ns : { name: string; version: string; type: string; default: string; } - - export const thing = ns; -->thing : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } -->ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } -+>thing : { name: string; version: string; type: string; default: string; } -+>ns : { name: string; version: string; type: string; default: string; } - - export const name2 = ns.default.name; -->name2 : string -->ns.default.name : string -->ns.default : { name: string; version: string; type: string; default: string; } -->ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } -->default : { name: string; version: string; type: string; default: string; } -->name : string -+>name2 : any -+>ns.default.name : any -+>ns.default : string -+>ns : { name: string; version: string; type: string; default: string; } -+>default : string -+>name : any - + >thing : { default: { name: string; version: string; type: string; default: string; }; } +@@= skipped -42, +42 lines =@@ === index.mts === import pkg from "./package.json" with { type: "json" }; >pkg : { name: string; version: string; type: string; default: string; } @@ -75,7 +27,7 @@ export const name = pkg.name; >name : string -@@= skipped -27, +27 lines =@@ +@@= skipped -10, +10 lines =@@ import * as ns from "./package.json" with { type: "json" }; >ns : { default: { name: string; version: string; type: string; default: string; }; } diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).errors.txt deleted file mode 100644 index 10ebcd6562..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).errors.txt +++ /dev/null @@ -1,30 +0,0 @@ -index.cts(5,33): error TS2339: Property 'name' does not exist on type 'string'. - - -==== index.ts (0 errors) ==== - import pkg from "./package.json" with { type: "json" }; - export const name = pkg.name; - import * as ns from "./package.json" with { type: "json" }; - export const thing = ns; - export const name2 = ns.default.name; -==== index.cts (1 errors) ==== - import pkg from "./package.json"; - export const name = pkg.name; - import * as ns from "./package.json"; - export const thing = ns; - export const name2 = ns.default.name; - ~~~~ -!!! error TS2339: Property 'name' does not exist on type 'string'. -==== index.mts (0 errors) ==== - import pkg from "./package.json" with { type: "json" }; - export const name = pkg.name; - import * as ns from "./package.json" with { type: "json" }; - export const thing = ns; - export const name2 = ns.default.name; -==== package.json (0 errors) ==== - { - "name": "pkg", - "version": "0.0.1", - "type": "module", - "default": "misedirection" - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).errors.txt.diff deleted file mode 100644 index 3aaa56d587..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,34 +0,0 @@ ---- old.nodeModulesResolveJsonModule(module=nodenext).errors.txt -+++ new.nodeModulesResolveJsonModule(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ -- -+index.cts(5,33): error TS2339: Property 'name' does not exist on type 'string'. -+ -+ -+==== index.ts (0 errors) ==== -+ import pkg from "./package.json" with { type: "json" }; -+ export const name = pkg.name; -+ import * as ns from "./package.json" with { type: "json" }; -+ export const thing = ns; -+ export const name2 = ns.default.name; -+==== index.cts (1 errors) ==== -+ import pkg from "./package.json"; -+ export const name = pkg.name; -+ import * as ns from "./package.json"; -+ export const thing = ns; -+ export const name2 = ns.default.name; -+ ~~~~ -+!!! error TS2339: Property 'name' does not exist on type 'string'. -+==== index.mts (0 errors) ==== -+ import pkg from "./package.json" with { type: "json" }; -+ export const name = pkg.name; -+ import * as ns from "./package.json" with { type: "json" }; -+ export const thing = ns; -+ export const name2 = ns.default.name; -+==== package.json (0 errors) ==== -+ { -+ "name": "pkg", -+ "version": "0.0.1", -+ "type": "module", -+ "default": "misedirection" -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).js b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).js index f310acacc7..5194c1c452 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).js @@ -109,9 +109,14 @@ export declare const thing: { name: string; version: string; type: string; - default: string; + default: { + name: string; + version: string; + type: string; + default: string; + }; }; -export declare const name2: any; +export declare const name2: string; //// [index.d.mts] export declare const name: string; export declare const thing: { diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).js.diff deleted file mode 100644 index a2eb6240f1..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).js.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.nodeModulesResolveJsonModule(module=nodenext).js -+++ new.nodeModulesResolveJsonModule(module=nodenext).js -@@= skipped -108, +108 lines =@@ - name: string; - version: string; - type: string; -- default: { -- name: string; -- version: string; -- type: string; -- default: string; -- }; -+ default: string; - }; --export declare const name2: string; -+export declare const name2: any; - //// [index.d.mts] - export declare const name: string; - export declare const thing: { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).symbols index 569f4b48c0..e38476567a 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).symbols @@ -44,9 +44,11 @@ export const thing = ns; export const name2 = ns.default.name; >name2 : Symbol(name2, Decl(index.cts, 4, 12)) ->ns.default : Symbol(default, Decl(package.json, 3, 21)) +>ns.default.name : Symbol("name", Decl(package.json, 0, 1)) +>ns.default : Symbol("package") >ns : Symbol(ns, Decl(index.cts, 2, 6)) ->default : Symbol(default, Decl(package.json, 3, 21)) +>default : Symbol("package") +>name : Symbol("name", Decl(package.json, 0, 1)) === index.mts === import pkg from "./package.json" with { type: "json" }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).symbols.diff deleted file mode 100644 index 2d36d37729..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).symbols.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.nodeModulesResolveJsonModule(module=nodenext).symbols -+++ new.nodeModulesResolveJsonModule(module=nodenext).symbols -@@= skipped -43, +43 lines =@@ - - export const name2 = ns.default.name; - >name2 : Symbol(name2, Decl(index.cts, 4, 12)) -->ns.default.name : Symbol("name", Decl(package.json, 0, 1)) -->ns.default : Symbol("package") -+>ns.default : Symbol(default, Decl(package.json, 3, 21)) - >ns : Symbol(ns, Decl(index.cts, 2, 6)) -->default : Symbol("package") -->name : Symbol("name", Decl(package.json, 0, 1)) -+>default : Symbol(default, Decl(package.json, 3, 21)) - - === index.mts === - import pkg from "./package.json" with { type: "json" }; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).types b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).types index 8fd2b5dc73..10ecedb434 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).types @@ -38,19 +38,19 @@ export const name = pkg.name; >name : string import * as ns from "./package.json"; ->ns : { name: string; version: string; type: string; default: string; } +>ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } export const thing = ns; ->thing : { name: string; version: string; type: string; default: string; } ->ns : { name: string; version: string; type: string; default: string; } +>thing : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } +>ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } export const name2 = ns.default.name; ->name2 : any ->ns.default.name : any ->ns.default : string ->ns : { name: string; version: string; type: string; default: string; } ->default : string ->name : any +>name2 : string +>ns.default.name : string +>ns.default : { name: string; version: string; type: string; default: string; } +>ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } +>default : { name: string; version: string; type: string; default: string; } +>name : string === index.mts === import pkg from "./package.json" with { type: "json" }; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).types.diff index 2dbb41b979..9d3a87b686 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).types.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesResolveJsonModule(module=nodenext).types.diff @@ -18,33 +18,7 @@ export const thing = ns; >thing : { default: { name: string; version: string; type: string; default: string; }; } -@@= skipped -25, +25 lines =@@ - >name : string - - import * as ns from "./package.json"; -->ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } -+>ns : { name: string; version: string; type: string; default: string; } - - export const thing = ns; -->thing : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } -->ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } -+>thing : { name: string; version: string; type: string; default: string; } -+>ns : { name: string; version: string; type: string; default: string; } - - export const name2 = ns.default.name; -->name2 : string -->ns.default.name : string -->ns.default : { name: string; version: string; type: string; default: string; } -->ns : { name: string; version: string; type: string; default: { name: string; version: string; type: string; default: string; }; } -->default : { name: string; version: string; type: string; default: string; } -->name : string -+>name2 : any -+>ns.default.name : any -+>ns.default : string -+>ns : { name: string; version: string; type: string; default: string; } -+>default : string -+>name : any - +@@= skipped -42, +42 lines =@@ === index.mts === import pkg from "./package.json" with { type: "json" }; >pkg : { name: string; version: string; type: string; default: string; } @@ -53,7 +27,7 @@ export const name = pkg.name; >name : string -@@= skipped -27, +27 lines =@@ +@@= skipped -10, +10 lines =@@ import * as ns from "./package.json" with { type: "json" }; >ns : { default: { name: string; version: string; type: string; default: string; }; } diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).errors.txt deleted file mode 100644 index e8320ee816..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).errors.txt +++ /dev/null @@ -1,56 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -error TS2468: Cannot find global value 'Promise'. -index.ts(6,23): error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.ts(7,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -index.ts(8,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -subfolder/index.ts(6,23): error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -subfolder/index.ts(7,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -subfolder/index.ts(8,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -!!! error TS2468: Cannot find global value 'Promise'. -==== subfolder/index.ts (3 errors) ==== - // cjs format file - import {h} from "../index.js"; - import mod = require("../index.js"); - import {f as _f} from "./index.js"; - import mod2 = require("./index.js"); - export async function f() { - ~ -!!! error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const mod3 = await import ("../index.js"); - ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const mod4 = await import ("./index.js"); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - h(); - } -==== index.ts (3 errors) ==== - // esm format file - import {h as _h} from "./index.js"; - import mod = require("./index.js"); - import {f} from "./subfolder/index.js"; - import mod2 = require("./subfolder/index.js"); - export async function h() { - ~ -!!! error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const mod3 = await import ("./index.js"); - ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const mod4 = await import ("./subfolder/index.js"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - f(); - } -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module" - } -==== subfolder/package.json (0 errors) ==== - { - "type": "commonjs" - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).errors.txt.diff deleted file mode 100644 index 0760cb7d8e..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).errors.txt.diff +++ /dev/null @@ -1,60 +0,0 @@ ---- old.nodeModulesSynchronousCallErrors(module=node20).errors.txt -+++ new.nodeModulesSynchronousCallErrors(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+error TS2468: Cannot find global value 'Promise'. -+index.ts(6,23): error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.ts(7,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.ts(8,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+subfolder/index.ts(6,23): error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+subfolder/index.ts(7,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+subfolder/index.ts(8,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+!!! error TS2468: Cannot find global value 'Promise'. -+==== subfolder/index.ts (3 errors) ==== -+ // cjs format file -+ import {h} from "../index.js"; -+ import mod = require("../index.js"); -+ import {f as _f} from "./index.js"; -+ import mod2 = require("./index.js"); -+ export async function f() { -+ ~ -+!!! error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ const mod3 = await import ("../index.js"); -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ const mod4 = await import ("./index.js"); -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ h(); -+ } -+==== index.ts (3 errors) ==== -+ // esm format file -+ import {h as _h} from "./index.js"; -+ import mod = require("./index.js"); -+ import {f} from "./subfolder/index.js"; -+ import mod2 = require("./subfolder/index.js"); -+ export async function h() { -+ ~ -+!!! error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ const mod3 = await import ("./index.js"); -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ const mod4 = await import ("./subfolder/index.js"); -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ f(); -+ } -+==== package.json (0 errors) ==== -+ { -+ "name": "package", -+ "private": true, -+ "type": "module" -+ } -+==== subfolder/package.json (0 errors) ==== -+ { -+ "type": "commonjs" -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).js index 0b0f71fc7f..f317196b7b 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).js @@ -34,14 +34,11 @@ export async function h() { } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.h = h; -const index_js_1 = require("./subfolder/index.js"); -async function h() { +import { f } from "./subfolder/index.js"; +export async function h() { const mod3 = await import("./index.js"); const mod4 = await import("./subfolder/index.js"); - (0, index_js_1.f)(); + f(); } //// [index.js] "use strict"; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).js.diff deleted file mode 100644 index d57e90cc69..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).js.diff +++ /dev/null @@ -1,20 +0,0 @@ ---- old.nodeModulesSynchronousCallErrors(module=node20).js -+++ new.nodeModulesSynchronousCallErrors(module=node20).js -@@= skipped -33, +33 lines =@@ - } - - //// [index.js] --import { f } from "./subfolder/index.js"; --export async function h() { -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.h = h; -+const index_js_1 = require("./subfolder/index.js"); -+async function h() { - const mod3 = await import("./index.js"); - const mod4 = await import("./subfolder/index.js"); -- f(); -+ (0, index_js_1.f)(); - } - //// [index.js] - "use strict"; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).types index 80bd761f00..f4631698cc 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).types @@ -19,9 +19,9 @@ export async function f() { >f : () => Promise const mod3 = await import ("../index.js"); ->mod3 : { h(): Promise; default: typeof mod; } ->await import ("../index.js") : { h(): Promise; default: typeof mod; } ->import ("../index.js") : Promise<{ h(): Promise; default: typeof mod; }> +>mod3 : typeof mod +>await import ("../index.js") : typeof mod +>import ("../index.js") : Promise >"../index.js" : "../index.js" const mod4 = await import ("./index.js"); @@ -53,9 +53,9 @@ export async function h() { >h : () => Promise const mod3 = await import ("./index.js"); ->mod3 : { h(): Promise; default: typeof mod; } ->await import ("./index.js") : { h(): Promise; default: typeof mod; } ->import ("./index.js") : Promise<{ h(): Promise; default: typeof mod; }> +>mod3 : typeof mod +>await import ("./index.js") : typeof mod +>import ("./index.js") : Promise >"./index.js" : "./index.js" const mod4 = await import ("./subfolder/index.js"); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).types.diff deleted file mode 100644 index 5620ac4315..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesSynchronousCallErrors(module=node20).types.diff +++ /dev/null @@ -1,28 +0,0 @@ ---- old.nodeModulesSynchronousCallErrors(module=node20).types -+++ new.nodeModulesSynchronousCallErrors(module=node20).types -@@= skipped -18, +18 lines =@@ - >f : () => Promise - - const mod3 = await import ("../index.js"); -->mod3 : typeof mod -->await import ("../index.js") : typeof mod -->import ("../index.js") : Promise -+>mod3 : { h(): Promise; default: typeof mod; } -+>await import ("../index.js") : { h(): Promise; default: typeof mod; } -+>import ("../index.js") : Promise<{ h(): Promise; default: typeof mod; }> - >"../index.js" : "../index.js" - - const mod4 = await import ("./index.js"); -@@= skipped -34, +34 lines =@@ - >h : () => Promise - - const mod3 = await import ("./index.js"); -->mod3 : typeof mod -->await import ("./index.js") : typeof mod -->import ("./index.js") : Promise -+>mod3 : { h(): Promise; default: typeof mod; } -+>await import ("./index.js") : { h(): Promise; default: typeof mod; } -+>import ("./index.js") : Promise<{ h(): Promise; default: typeof mod; }> - >"./index.js" : "./index.js" - - const mod4 = await import ("./subfolder/index.js"); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTopLevelAwait(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTopLevelAwait(module=node20).errors.txt index 656d8963ca..0fd2e5390c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTopLevelAwait(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTopLevelAwait(module=node20).errors.txt @@ -1,29 +1,21 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -index.ts(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -index.ts(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -subfolder/index.ts(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -subfolder/index.ts(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +subfolder/index.ts(2,11): error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. +subfolder/index.ts(4,5): error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== subfolder/index.ts (2 errors) ==== // cjs format file const x = await 1; ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. +!!! error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. export {x}; for await (const y of []) {} ~~~~~ -!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -==== index.ts (2 errors) ==== +!!! error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. +==== index.ts (0 errors) ==== // esm format file const x = await 1; - ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. export {x}; for await (const y of []) {} - ~~~~~ -!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. ==== package.json (0 errors) ==== { "name": "package", diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTopLevelAwait(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTopLevelAwait(module=node20).errors.txt.diff deleted file mode 100644 index 5365a9abbb..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTopLevelAwait(module=node20).errors.txt.diff +++ /dev/null @@ -1,39 +0,0 @@ ---- old.nodeModulesTopLevelAwait(module=node20).errors.txt -+++ new.nodeModulesTopLevelAwait(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ --subfolder/index.ts(2,11): error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. --subfolder/index.ts(4,5): error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. -- -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+index.ts(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+index.ts(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+subfolder/index.ts(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+subfolder/index.ts(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== subfolder/index.ts (2 errors) ==== - // cjs format file - const x = await 1; - ~~~~~ --!!! error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - export {x}; - for await (const y of []) {} - ~~~~~ --!!! error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. --==== index.ts (0 errors) ==== -+!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+==== index.ts (2 errors) ==== - // esm format file - const x = await 1; -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - export {x}; - for await (const y of []) {} -+ ~~~~~ -+!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ==== package.json (0 errors) ==== - { - "name": "package", \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTopLevelAwait(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesTopLevelAwait(module=node20).js index c39cdd61df..8d33777f0c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTopLevelAwait(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTopLevelAwait(module=node20).js @@ -30,12 +30,9 @@ const x = await 1; exports.x = x; for await (const y of []) { } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.x = void 0; // esm format file const x = await 1; -exports.x = x; +export { x }; for await (const y of []) { } diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTopLevelAwait(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTopLevelAwait(module=node20).js.diff deleted file mode 100644 index 8eb24ad109..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTopLevelAwait(module=node20).js.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.nodeModulesTopLevelAwait(module=node20).js -+++ new.nodeModulesTopLevelAwait(module=node20).js -@@= skipped -29, +29 lines =@@ - exports.x = x; - for await (const y of []) { } - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+exports.x = void 0; - // esm format file - const x = await 1; --export { x }; -+exports.x = x; - for await (const y of []) { } - diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node20).errors.txt deleted file mode 100644 index 1ce07783b4..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node20).errors.txt +++ /dev/null @@ -1,26 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== /index.ts (0 errors) ==== - /// - export interface LocalInterface extends RequireInterface {} -==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", - "version": "0.0.1", - "exports": { - "import": "./import.js", - "require": "./require.js" - } - } -==== /node_modules/pkg/import.d.ts (0 errors) ==== - export {}; - declare global { - interface ImportInterface {} - } -==== /node_modules/pkg/require.d.ts (0 errors) ==== - export {}; - declare global { - interface RequireInterface {} - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node20).errors.txt.diff deleted file mode 100644 index 6e8adca070..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node20).errors.txt.diff +++ /dev/null @@ -1,30 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node20).errors.txt -+++ new.nodeModulesTripleSlashReferenceModeDeclarationEmit1(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== /index.ts (0 errors) ==== -+ /// -+ export interface LocalInterface extends RequireInterface {} -+==== /node_modules/pkg/package.json (0 errors) ==== -+ { -+ "name": "pkg", -+ "version": "0.0.1", -+ "exports": { -+ "import": "./import.js", -+ "require": "./require.js" -+ } -+ } -+==== /node_modules/pkg/import.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ interface ImportInterface {} -+ } -+==== /node_modules/pkg/require.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ interface RequireInterface {} -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).errors.txt deleted file mode 100644 index 0f998dfd3f..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).errors.txt +++ /dev/null @@ -1,34 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -/index.ts(2,41): error TS2304: Cannot find name 'ImportInterface'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== /index.ts (1 errors) ==== - /// - export interface LocalInterface extends ImportInterface {} - ~~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'ImportInterface'. -==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", - "version": "0.0.1", - "exports": { - "import": "./import.js", - "require": "./require.js" - } - } -==== /node_modules/pkg/import.d.ts (0 errors) ==== - export {}; - declare global { - interface ImportInterface {} - } -==== /node_modules/pkg/require.d.ts (0 errors) ==== - export {}; - declare global { - interface RequireInterface {} - } -==== /package.json (0 errors) ==== - { - "private": true, - "type": "module" - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).errors.txt.diff deleted file mode 100644 index 6ed6c524a2..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).errors.txt.diff +++ /dev/null @@ -1,38 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).errors.txt -+++ new.nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+/index.ts(2,41): error TS2304: Cannot find name 'ImportInterface'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== /index.ts (1 errors) ==== -+ /// -+ export interface LocalInterface extends ImportInterface {} -+ ~~~~~~~~~~~~~~~ -+!!! error TS2304: Cannot find name 'ImportInterface'. -+==== /node_modules/pkg/package.json (0 errors) ==== -+ { -+ "name": "pkg", -+ "version": "0.0.1", -+ "exports": { -+ "import": "./import.js", -+ "require": "./require.js" -+ } -+ } -+==== /node_modules/pkg/import.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ interface ImportInterface {} -+ } -+==== /node_modules/pkg/require.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ interface RequireInterface {} -+ } -+==== /package.json (0 errors) ==== -+ { -+ "private": true, -+ "type": "module" -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).js index ae8fe6ec2a..86c97ee2d0 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).js @@ -29,9 +29,8 @@ declare global { export interface LocalInterface extends ImportInterface {} //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); /// +export {}; //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).js.diff deleted file mode 100644 index 13ae5bbeca..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).js.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).js -+++ new.nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).js -@@= skipped -28, +28 lines =@@ - export interface LocalInterface extends ImportInterface {} - - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - /// --export {}; - - - //// [index.d.ts] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).symbols index f410e5fca7..dfccc41309 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).symbols @@ -4,12 +4,13 @@ /// export interface LocalInterface extends ImportInterface {} >LocalInterface : Symbol(LocalInterface, Decl(index.ts, 0, 0)) +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 1, 16)) -=== /node_modules/pkg/require.d.ts === +=== /node_modules/pkg/import.d.ts === export {}; declare global { ->global : Symbol(global, Decl(require.d.ts, 0, 10)) +>global : Symbol(global, Decl(import.d.ts, 0, 10)) - interface RequireInterface {} ->RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 1, 16)) + interface ImportInterface {} +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 1, 16)) } diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).symbols.diff deleted file mode 100644 index e93c8b3a84..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).symbols.diff +++ /dev/null @@ -1,20 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).symbols -+++ new.nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).symbols -@@= skipped -3, +3 lines =@@ - /// - export interface LocalInterface extends ImportInterface {} - >LocalInterface : Symbol(LocalInterface, Decl(index.ts, 0, 0)) -->ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 1, 16)) - --=== /node_modules/pkg/import.d.ts === -+=== /node_modules/pkg/require.d.ts === - export {}; - declare global { -->global : Symbol(global, Decl(import.d.ts, 0, 10)) -+>global : Symbol(global, Decl(require.d.ts, 0, 10)) - -- interface ImportInterface {} -->ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 1, 16)) -+ interface RequireInterface {} -+>RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 1, 16)) - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).types index 161a51956e..f2f8e65465 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).types @@ -4,10 +4,10 @@ /// export interface LocalInterface extends ImportInterface {} -=== /node_modules/pkg/require.d.ts === +=== /node_modules/pkg/import.d.ts === export {}; declare global { >global : any - interface RequireInterface {} + interface ImportInterface {} } diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).types.diff deleted file mode 100644 index 716f5d421c..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).types.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).types -+++ new.nodeModulesTripleSlashReferenceModeDeclarationEmit2(module=node20).types -@@= skipped -3, +3 lines =@@ - - /// - export interface LocalInterface extends ImportInterface {} --=== /node_modules/pkg/import.d.ts === -+=== /node_modules/pkg/require.d.ts === - export {}; - declare global { - >global : any - -- interface ImportInterface {} -+ interface RequireInterface {} - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node20).errors.txt deleted file mode 100644 index 040d70fd36..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node20).errors.txt +++ /dev/null @@ -1,31 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== /index.ts (0 errors) ==== - /// - export interface LocalInterface extends RequireInterface {} -==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", - "version": "0.0.1", - "exports": { - "import": "./import.js", - "require": "./require.js" - } - } -==== /node_modules/pkg/import.d.ts (0 errors) ==== - export {}; - declare global { - interface ImportInterface {} - } -==== /node_modules/pkg/require.d.ts (0 errors) ==== - export {}; - declare global { - interface RequireInterface {} - } -==== /package.json (0 errors) ==== - { - "private": true, - "type": "module" - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node20).errors.txt.diff deleted file mode 100644 index 28f19cdb47..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node20).errors.txt.diff +++ /dev/null @@ -1,35 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node20).errors.txt -+++ new.nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== /index.ts (0 errors) ==== -+ /// -+ export interface LocalInterface extends RequireInterface {} -+==== /node_modules/pkg/package.json (0 errors) ==== -+ { -+ "name": "pkg", -+ "version": "0.0.1", -+ "exports": { -+ "import": "./import.js", -+ "require": "./require.js" -+ } -+ } -+==== /node_modules/pkg/import.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ interface ImportInterface {} -+ } -+==== /node_modules/pkg/require.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ interface RequireInterface {} -+ } -+==== /package.json (0 errors) ==== -+ { -+ "private": true, -+ "type": "module" -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node20).js index 48b106a94a..a8890a9178 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node20).js @@ -29,9 +29,8 @@ declare global { export interface LocalInterface extends RequireInterface {} //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); /// +export {}; //// [index.d.ts] diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node20).js.diff deleted file mode 100644 index 06771ef4ed..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node20).js.diff +++ /dev/null @@ -1,13 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node20).js -+++ new.nodeModulesTripleSlashReferenceModeDeclarationEmit3(module=node20).js -@@= skipped -28, +28 lines =@@ - export interface LocalInterface extends RequireInterface {} - - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - /// --export {}; - - - //// [index.d.ts] \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit4(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit4(module=node20).errors.txt deleted file mode 100644 index bcea9d5c5d..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit4(module=node20).errors.txt +++ /dev/null @@ -1,26 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== /index.ts (0 errors) ==== - /// - export interface LocalInterface extends ImportInterface {} -==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", - "version": "0.0.1", - "exports": { - "import": "./import.js", - "require": "./require.js" - } - } -==== /node_modules/pkg/import.d.ts (0 errors) ==== - export {}; - declare global { - interface ImportInterface {} - } -==== /node_modules/pkg/require.d.ts (0 errors) ==== - export {}; - declare global { - interface RequireInterface {} - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit4(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit4(module=node20).errors.txt.diff deleted file mode 100644 index 7f771eaac2..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit4(module=node20).errors.txt.diff +++ /dev/null @@ -1,30 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeDeclarationEmit4(module=node20).errors.txt -+++ new.nodeModulesTripleSlashReferenceModeDeclarationEmit4(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== /index.ts (0 errors) ==== -+ /// -+ export interface LocalInterface extends ImportInterface {} -+==== /node_modules/pkg/package.json (0 errors) ==== -+ { -+ "name": "pkg", -+ "version": "0.0.1", -+ "exports": { -+ "import": "./import.js", -+ "require": "./require.js" -+ } -+ } -+==== /node_modules/pkg/import.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ interface ImportInterface {} -+ } -+==== /node_modules/pkg/require.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ interface RequireInterface {} -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit5(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit5(module=node20).errors.txt deleted file mode 100644 index 4c502aa92d..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit5(module=node20).errors.txt +++ /dev/null @@ -1,27 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== /index.ts (0 errors) ==== - /// - /// - export interface LocalInterface extends ImportInterface, RequireInterface {} -==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", - "version": "0.0.1", - "exports": { - "import": "./import.js", - "require": "./require.js" - } - } -==== /node_modules/pkg/import.d.ts (0 errors) ==== - export {}; - declare global { - interface ImportInterface {} - } -==== /node_modules/pkg/require.d.ts (0 errors) ==== - export {}; - declare global { - interface RequireInterface {} - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit5(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit5(module=node20).errors.txt.diff deleted file mode 100644 index 033f95dcaa..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit5(module=node20).errors.txt.diff +++ /dev/null @@ -1,31 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeDeclarationEmit5(module=node20).errors.txt -+++ new.nodeModulesTripleSlashReferenceModeDeclarationEmit5(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== /index.ts (0 errors) ==== -+ /// -+ /// -+ export interface LocalInterface extends ImportInterface, RequireInterface {} -+==== /node_modules/pkg/package.json (0 errors) ==== -+ { -+ "name": "pkg", -+ "version": "0.0.1", -+ "exports": { -+ "import": "./import.js", -+ "require": "./require.js" -+ } -+ } -+==== /node_modules/pkg/import.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ interface ImportInterface {} -+ } -+==== /node_modules/pkg/require.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ interface RequireInterface {} -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node20).errors.txt deleted file mode 100644 index 588b23d7fc..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node20).errors.txt +++ /dev/null @@ -1,31 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== /index.ts (0 errors) ==== - import obj from "./uses.js" - export default (obj as typeof obj); -==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", - "version": "0.0.1", - "exports": { - "import": "./import.js", - "require": "./require.js" - } - } -==== /node_modules/pkg/import.d.ts (0 errors) ==== - export {}; - declare global { - interface ImportInterface {} - function getInterI(): ImportInterface; - } -==== /node_modules/pkg/require.d.ts (0 errors) ==== - export {}; - declare global { - interface RequireInterface {} - function getInterR(): RequireInterface; - } -==== /uses.ts (0 errors) ==== - /// - export default getInterR(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node20).errors.txt.diff deleted file mode 100644 index 7d3995402b..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node20).errors.txt.diff +++ /dev/null @@ -1,35 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node20).errors.txt -+++ new.nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== /index.ts (0 errors) ==== -+ import obj from "./uses.js" -+ export default (obj as typeof obj); -+==== /node_modules/pkg/package.json (0 errors) ==== -+ { -+ "name": "pkg", -+ "version": "0.0.1", -+ "exports": { -+ "import": "./import.js", -+ "require": "./require.js" -+ } -+ } -+==== /node_modules/pkg/import.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ interface ImportInterface {} -+ function getInterI(): ImportInterface; -+ } -+==== /node_modules/pkg/require.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ interface RequireInterface {} -+ function getInterR(): RequireInterface; -+ } -+==== /uses.ts (0 errors) ==== -+ /// -+ export default getInterR(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node20).js index ca5d9f4a4c..b91a324b32 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node20).js @@ -35,8 +35,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.default = getInterR(); //// [index.js] "use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", { value: true }); -const uses_js_1 = require("./uses.js"); +const uses_js_1 = __importDefault(require("./uses.js")); exports.default = uses_js_1.default; @@ -47,3 +50,43 @@ export default _default; //// [index.d.ts] declare const _default: RequireInterface; export default _default; + + +//// [DtsFileErrors] + + +out/index.d.ts(1,25): error TS2304: Cannot find name 'RequireInterface'. + + +==== out/index.d.ts (1 errors) ==== + declare const _default: RequireInterface; + ~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'RequireInterface'. + export default _default; + +==== /node_modules/pkg/package.json (0 errors) ==== + { + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } + } +==== /node_modules/pkg/import.d.ts (0 errors) ==== + export {}; + declare global { + interface ImportInterface {} + function getInterI(): ImportInterface; + } +==== /node_modules/pkg/require.d.ts (0 errors) ==== + export {}; + declare global { + interface RequireInterface {} + function getInterR(): RequireInterface; + } +==== out/uses.d.ts (0 errors) ==== + /// + declare const _default: RequireInterface; + export default _default; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node20).js.diff index 98990ba603..102a66bb27 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node20).js.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node20).js.diff @@ -1,23 +1,50 @@ --- old.nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node20).js +++ new.nodeModulesTripleSlashReferenceModeDeclarationEmit6(module=node20).js -@@= skipped -34, +34 lines =@@ - exports.default = getInterR(); - //// [index.js] - "use strict"; --var __importDefault = (this && this.__importDefault) || function (mod) { -- return (mod && mod.__esModule) ? mod : { "default": mod }; --}; - Object.defineProperty(exports, "__esModule", { value: true }); --const uses_js_1 = __importDefault(require("./uses.js")); -+const uses_js_1 = require("./uses.js"); - exports.default = uses_js_1.default; - - -@@= skipped -13, +10 lines =@@ +@@= skipped -47, +47 lines =@@ declare const _default: RequireInterface; export default _default; //// [index.d.ts] -import obj from "./uses.js"; -declare const _default: typeof obj; +declare const _default: RequireInterface; - export default _default; \ No newline at end of file + export default _default; ++ ++ ++//// [DtsFileErrors] ++ ++ ++out/index.d.ts(1,25): error TS2304: Cannot find name 'RequireInterface'. ++ ++ ++==== out/index.d.ts (1 errors) ==== ++ declare const _default: RequireInterface; ++ ~~~~~~~~~~~~~~~~ ++!!! error TS2304: Cannot find name 'RequireInterface'. ++ export default _default; ++ ++==== /node_modules/pkg/package.json (0 errors) ==== ++ { ++ "name": "pkg", ++ "version": "0.0.1", ++ "exports": { ++ "import": "./import.js", ++ "require": "./require.js" ++ } ++ } ++==== /node_modules/pkg/import.d.ts (0 errors) ==== ++ export {}; ++ declare global { ++ interface ImportInterface {} ++ function getInterI(): ImportInterface; ++ } ++==== /node_modules/pkg/require.d.ts (0 errors) ==== ++ export {}; ++ declare global { ++ interface RequireInterface {} ++ function getInterR(): RequireInterface; ++ } ++==== out/uses.d.ts (0 errors) ==== ++ /// ++ declare const _default: RequireInterface; ++ export default _default; ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).errors.txt deleted file mode 100644 index 66d0faad35..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).errors.txt +++ /dev/null @@ -1,58 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -/index.ts(4,28): error TS2339: Property 'default' does not exist on type 'RequireInterface'. -/sub1/uses.ts(2,16): error TS2552: Cannot find name 'getInterI'. Did you mean 'getInterR'? - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== /index.ts (1 errors) ==== - // only an esm file can `import` both kinds of files - import obj1 from "./sub1/uses.js" - import obj2 from "./sub2/uses.js" - export default [obj1, obj2.default] as const; - ~~~~~~~ -!!! error TS2339: Property 'default' does not exist on type 'RequireInterface'. -==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", - "version": "0.0.1", - "exports": { - "import": "./import.js", - "require": "./require.js" - } - } -==== /node_modules/pkg/import.d.ts (0 errors) ==== - export {}; - declare global { - interface ImportInterface { _i: any; } - function getInterI(): ImportInterface; - } -==== /node_modules/pkg/require.d.ts (0 errors) ==== - export {}; - declare global { - interface RequireInterface { _r: any; } - function getInterR(): RequireInterface; - } -==== /sub1/uses.ts (1 errors) ==== - /// - export default getInterI(); - ~~~~~~~~~ -!!! error TS2552: Cannot find name 'getInterI'. Did you mean 'getInterR'? -!!! related TS2728 /node_modules/pkg/require.d.ts:4:14: 'getInterR' is declared here. -==== /sub1/package.json (0 errors) ==== - { - "private": true, - "type": "module" - } -==== /sub2/uses.ts (0 errors) ==== - /// - export default getInterR(); -==== /sub2/package.json (0 errors) ==== - { - "private": true, - "type": "commonjs" - } -==== /package.json (0 errors) ==== - { - "private": true, - "type": "module" - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).errors.txt.diff deleted file mode 100644 index 90986eae32..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).errors.txt.diff +++ /dev/null @@ -1,62 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).errors.txt -+++ new.nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+/index.ts(4,28): error TS2339: Property 'default' does not exist on type 'RequireInterface'. -+/sub1/uses.ts(2,16): error TS2552: Cannot find name 'getInterI'. Did you mean 'getInterR'? -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== /index.ts (1 errors) ==== -+ // only an esm file can `import` both kinds of files -+ import obj1 from "./sub1/uses.js" -+ import obj2 from "./sub2/uses.js" -+ export default [obj1, obj2.default] as const; -+ ~~~~~~~ -+!!! error TS2339: Property 'default' does not exist on type 'RequireInterface'. -+==== /node_modules/pkg/package.json (0 errors) ==== -+ { -+ "name": "pkg", -+ "version": "0.0.1", -+ "exports": { -+ "import": "./import.js", -+ "require": "./require.js" -+ } -+ } -+==== /node_modules/pkg/import.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ interface ImportInterface { _i: any; } -+ function getInterI(): ImportInterface; -+ } -+==== /node_modules/pkg/require.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ interface RequireInterface { _r: any; } -+ function getInterR(): RequireInterface; -+ } -+==== /sub1/uses.ts (1 errors) ==== -+ /// -+ export default getInterI(); -+ ~~~~~~~~~ -+!!! error TS2552: Cannot find name 'getInterI'. Did you mean 'getInterR'? -+!!! related TS2728 /node_modules/pkg/require.d.ts:4:14: 'getInterR' is declared here. -+==== /sub1/package.json (0 errors) ==== -+ { -+ "private": true, -+ "type": "module" -+ } -+==== /sub2/uses.ts (0 errors) ==== -+ /// -+ export default getInterR(); -+==== /sub2/package.json (0 errors) ==== -+ { -+ "private": true, -+ "type": "commonjs" -+ } -+==== /package.json (0 errors) ==== -+ { -+ "private": true, -+ "type": "module" -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).js index abe1baa3b1..e6134a8988 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).js @@ -49,32 +49,91 @@ import obj2 from "./sub2/uses.js" export default [obj1, obj2.default] as const; //// [uses.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); /// -exports.default = getInterI(); +export default getInterI(); //// [uses.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /// exports.default = getInterR(); //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // only an esm file can `import` both kinds of files -const uses_js_1 = require("./sub1/uses.js"); -const uses_js_2 = require("./sub2/uses.js"); -exports.default = [uses_js_1.default, uses_js_2.default.default]; +import obj1 from "./sub1/uses.js"; +import obj2 from "./sub2/uses.js"; +export default [obj1, obj2.default]; //// [uses.d.ts] /// -declare const _default: any; +declare const _default: ImportInterface; export default _default; //// [uses.d.ts] /// declare const _default: RequireInterface; export default _default; //// [index.d.ts] -declare const _default: readonly [any, any]; +declare const _default: readonly [ImportInterface, RequireInterface]; export default _default; + + +//// [DtsFileErrors] + + +out/index.d.ts(1,35): error TS2304: Cannot find name 'ImportInterface'. +out/index.d.ts(1,52): error TS2304: Cannot find name 'RequireInterface'. + + +==== out/index.d.ts (2 errors) ==== + declare const _default: readonly [ImportInterface, RequireInterface]; + ~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'ImportInterface'. + ~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'RequireInterface'. + export default _default; + +==== /node_modules/pkg/package.json (0 errors) ==== + { + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } + } +==== /node_modules/pkg/import.d.ts (0 errors) ==== + export {}; + declare global { + interface ImportInterface { _i: any; } + function getInterI(): ImportInterface; + } +==== /node_modules/pkg/require.d.ts (0 errors) ==== + export {}; + declare global { + interface RequireInterface { _r: any; } + function getInterR(): RequireInterface; + } +==== out/sub1/uses.d.ts (0 errors) ==== + /// + declare const _default: ImportInterface; + export default _default; + +==== /sub1/package.json (0 errors) ==== + { + "private": true, + "type": "module" + } +==== out/sub2/uses.d.ts (0 errors) ==== + /// + declare const _default: RequireInterface; + export default _default; + +==== /sub2/package.json (0 errors) ==== + { + "private": true, + "type": "commonjs" + } +==== /package.json (0 errors) ==== + { + "private": true, + "type": "module" + } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).js.diff deleted file mode 100644 index 35a539835f..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).js.diff +++ /dev/null @@ -1,104 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).js -+++ new.nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).js -@@= skipped -48, +48 lines =@@ - export default [obj1, obj2.default] as const; - - //// [uses.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - /// --export default getInterI(); -+exports.default = getInterI(); - //// [uses.js] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - /// - exports.default = getInterR(); - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // only an esm file can `import` both kinds of files --import obj1 from "./sub1/uses.js"; --import obj2 from "./sub2/uses.js"; --export default [obj1, obj2.default]; -+const uses_js_1 = require("./sub1/uses.js"); -+const uses_js_2 = require("./sub2/uses.js"); -+exports.default = [uses_js_1.default, uses_js_2.default.default]; - - - //// [uses.d.ts] - /// --declare const _default: ImportInterface; -+declare const _default: any; - export default _default; - //// [uses.d.ts] - /// - declare const _default: RequireInterface; - export default _default; - //// [index.d.ts] --declare const _default: readonly [ImportInterface, RequireInterface]; -+declare const _default: readonly [any, any]; - export default _default; -- -- --//// [DtsFileErrors] -- -- --out/index.d.ts(1,35): error TS2304: Cannot find name 'ImportInterface'. --out/index.d.ts(1,52): error TS2304: Cannot find name 'RequireInterface'. -- -- --==== out/index.d.ts (2 errors) ==== -- declare const _default: readonly [ImportInterface, RequireInterface]; -- ~~~~~~~~~~~~~~~ --!!! error TS2304: Cannot find name 'ImportInterface'. -- ~~~~~~~~~~~~~~~~ --!!! error TS2304: Cannot find name 'RequireInterface'. -- export default _default; -- --==== /node_modules/pkg/package.json (0 errors) ==== -- { -- "name": "pkg", -- "version": "0.0.1", -- "exports": { -- "import": "./import.js", -- "require": "./require.js" -- } -- } --==== /node_modules/pkg/import.d.ts (0 errors) ==== -- export {}; -- declare global { -- interface ImportInterface { _i: any; } -- function getInterI(): ImportInterface; -- } --==== /node_modules/pkg/require.d.ts (0 errors) ==== -- export {}; -- declare global { -- interface RequireInterface { _r: any; } -- function getInterR(): RequireInterface; -- } --==== out/sub1/uses.d.ts (0 errors) ==== -- /// -- declare const _default: ImportInterface; -- export default _default; -- --==== /sub1/package.json (0 errors) ==== -- { -- "private": true, -- "type": "module" -- } --==== out/sub2/uses.d.ts (0 errors) ==== -- /// -- declare const _default: RequireInterface; -- export default _default; -- --==== /sub2/package.json (0 errors) ==== -- { -- "private": true, -- "type": "commonjs" -- } --==== /package.json (0 errors) ==== -- { -- "private": true, -- "type": "module" -- } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).symbols index 1899b1069e..26fb303638 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).symbols @@ -10,9 +10,24 @@ import obj2 from "./sub2/uses.js" export default [obj1, obj2.default] as const; >obj1 : Symbol(obj1, Decl(index.ts, 1, 6)) +>obj2.default : Symbol(obj2.default, Decl(uses.ts, 0, 0)) >obj2 : Symbol(obj2, Decl(index.ts, 2, 6)) +>default : Symbol(obj2.default, Decl(uses.ts, 0, 0)) >const : Symbol(const) +=== /node_modules/pkg/import.d.ts === +export {}; +declare global { +>global : Symbol(global, Decl(import.d.ts, 0, 10)) + + interface ImportInterface { _i: any; } +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 1, 16)) +>_i : Symbol(ImportInterface._i, Decl(import.d.ts, 2, 31)) + + function getInterI(): ImportInterface; +>getInterI : Symbol(getInterI, Decl(import.d.ts, 2, 42)) +>ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 1, 16)) +} === /node_modules/pkg/require.d.ts === export {}; declare global { @@ -27,9 +42,10 @@ declare global { >RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 1, 16)) } === /sub1/uses.ts === - /// export default getInterI(); +>getInterI : Symbol(getInterI, Decl(import.d.ts, 2, 42)) + === /sub2/uses.ts === /// export default getInterR(); diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).symbols.diff deleted file mode 100644 index 2b3ecfe5a6..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).symbols.diff +++ /dev/null @@ -1,39 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).symbols -+++ new.nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).symbols -@@= skipped -9, +9 lines =@@ - - export default [obj1, obj2.default] as const; - >obj1 : Symbol(obj1, Decl(index.ts, 1, 6)) -->obj2.default : Symbol(obj2.default, Decl(uses.ts, 0, 0)) - >obj2 : Symbol(obj2, Decl(index.ts, 2, 6)) -->default : Symbol(obj2.default, Decl(uses.ts, 0, 0)) - >const : Symbol(const) - --=== /node_modules/pkg/import.d.ts === --export {}; --declare global { -->global : Symbol(global, Decl(import.d.ts, 0, 10)) -- -- interface ImportInterface { _i: any; } -->ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 1, 16)) -->_i : Symbol(ImportInterface._i, Decl(import.d.ts, 2, 31)) -- -- function getInterI(): ImportInterface; -->getInterI : Symbol(getInterI, Decl(import.d.ts, 2, 42)) -->ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 1, 16)) --} - === /node_modules/pkg/require.d.ts === - export {}; - declare global { -@@= skipped -32, +17 lines =@@ - >RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 1, 16)) - } - === /sub1/uses.ts === -+ - /// - export default getInterI(); -->getInterI : Symbol(getInterI, Decl(import.d.ts, 2, 42)) -- - === /sub2/uses.ts === - /// - export default getInterR(); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).types index fc698ca4ed..8fe9ea5bac 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).types @@ -3,19 +3,30 @@ === /index.ts === // only an esm file can `import` both kinds of files import obj1 from "./sub1/uses.js" ->obj1 : any +>obj1 : ImportInterface import obj2 from "./sub2/uses.js" ->obj2 : RequireInterface +>obj2 : typeof obj2 export default [obj1, obj2.default] as const; ->[obj1, obj2.default] as const : readonly [any, any] ->[obj1, obj2.default] : readonly [any, any] ->obj1 : any ->obj2.default : any ->obj2 : RequireInterface ->default : any +>[obj1, obj2.default] as const : readonly [ImportInterface, RequireInterface] +>[obj1, obj2.default] : readonly [ImportInterface, RequireInterface] +>obj1 : ImportInterface +>obj2.default : RequireInterface +>obj2 : typeof obj2 +>default : RequireInterface + +=== /node_modules/pkg/import.d.ts === +export {}; +declare global { +>global : typeof global + interface ImportInterface { _i: any; } +>_i : any + + function getInterI(): ImportInterface; +>getInterI : () => ImportInterface +} === /node_modules/pkg/require.d.ts === export {}; declare global { @@ -30,8 +41,8 @@ declare global { === /sub1/uses.ts === /// export default getInterI(); ->getInterI() : any ->getInterI : any +>getInterI() : ImportInterface +>getInterI : () => ImportInterface === /sub2/uses.ts === /// diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).types.diff deleted file mode 100644 index 02ee90b833..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).types.diff +++ /dev/null @@ -1,53 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).types -+++ new.nodeModulesTripleSlashReferenceModeDeclarationEmit7(module=node20).types -@@= skipped -2, +2 lines =@@ - === /index.ts === - // only an esm file can `import` both kinds of files - import obj1 from "./sub1/uses.js" -->obj1 : ImportInterface -+>obj1 : any - - import obj2 from "./sub2/uses.js" -->obj2 : typeof obj2 -+>obj2 : RequireInterface - - export default [obj1, obj2.default] as const; -->[obj1, obj2.default] as const : readonly [ImportInterface, RequireInterface] -->[obj1, obj2.default] : readonly [ImportInterface, RequireInterface] -->obj1 : ImportInterface -->obj2.default : RequireInterface -->obj2 : typeof obj2 -->default : RequireInterface -- --=== /node_modules/pkg/import.d.ts === --export {}; --declare global { -->global : typeof global -- -- interface ImportInterface { _i: any; } -->_i : any -- -- function getInterI(): ImportInterface; -->getInterI : () => ImportInterface --} -+>[obj1, obj2.default] as const : readonly [any, any] -+>[obj1, obj2.default] : readonly [any, any] -+>obj1 : any -+>obj2.default : any -+>obj2 : RequireInterface -+>default : any -+ - === /node_modules/pkg/require.d.ts === - export {}; - declare global { -@@= skipped -38, +27 lines =@@ - === /sub1/uses.ts === - /// - export default getInterI(); -->getInterI() : ImportInterface -->getInterI : () => ImportInterface -+>getInterI() : any -+>getInterI : any - - === /sub2/uses.ts === - /// \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride1(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride1(module=node20).errors.txt index f24f5f5c43..c9a6ac7931 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride1(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride1(module=node20).errors.txt @@ -1,8 +1,6 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. /index.ts(2,1): error TS2304: Cannot find name 'foo'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /index.ts (1 errors) ==== /// foo; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride1(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride1(module=node20).errors.txt.diff deleted file mode 100644 index f0e06f71af..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride1(module=node20).errors.txt.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeOverride1(module=node20).errors.txt -+++ new.nodeModulesTripleSlashReferenceModeOverride1(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - /index.ts(2,1): error TS2304: Cannot find name 'foo'. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== /index.ts (1 errors) ==== - /// - foo; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).errors.txt index 9cc5e69b09..13991aa135 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).errors.txt @@ -1,14 +1,12 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -/index.ts(2,1): error TS2304: Cannot find name 'foo'. +/index.ts(3,1): error TS2304: Cannot find name 'bar'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /index.ts (1 errors) ==== /// foo; // foo should resolve while bar should not, since index.js is esm - ~~~ -!!! error TS2304: Cannot find name 'foo'. bar; + ~~~ +!!! error TS2304: Cannot find name 'bar'. export {}; ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).errors.txt.diff deleted file mode 100644 index 0f5122051f..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).errors.txt.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeOverride2(module=node20).errors.txt -+++ new.nodeModulesTripleSlashReferenceModeOverride2(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ --/index.ts(3,1): error TS2304: Cannot find name 'bar'. -- -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+/index.ts(2,1): error TS2304: Cannot find name 'foo'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== /index.ts (1 errors) ==== - /// - foo; // foo should resolve while bar should not, since index.js is esm -- bar; - ~~~ --!!! error TS2304: Cannot find name 'bar'. -+!!! error TS2304: Cannot find name 'foo'. -+ bar; - export {}; - ==== /node_modules/pkg/package.json (0 errors) ==== - { \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).js index 70cf2e6b25..aee176689b 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).js @@ -31,8 +31,7 @@ bar; export {}; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); /// foo; // foo should resolve while bar should not, since index.js is esm bar; +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).js.diff deleted file mode 100644 index 3c3eeee983..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).js.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeOverride2(module=node20).js -+++ new.nodeModulesTripleSlashReferenceModeOverride2(module=node20).js -@@= skipped -30, +30 lines =@@ - export {}; - - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - /// - foo; // foo should resolve while bar should not, since index.js is esm - bar; --export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).symbols index 834fc88eb4..0f65d258dc 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).symbols @@ -3,15 +3,15 @@ === /index.ts === /// foo; // foo should resolve while bar should not, since index.js is esm -bar; ->bar : Symbol(bar, Decl(require.d.ts, 2, 7)) +>foo : Symbol(foo, Decl(import.d.ts, 2, 7)) +bar; export {}; -=== /node_modules/pkg/require.d.ts === +=== /node_modules/pkg/import.d.ts === export {}; declare global { ->global : Symbol(global, Decl(require.d.ts, 0, 10)) +>global : Symbol(global, Decl(import.d.ts, 0, 10)) - var bar: number; ->bar : Symbol(bar, Decl(require.d.ts, 2, 7)) + var foo: number; +>foo : Symbol(foo, Decl(import.d.ts, 2, 7)) } diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).symbols.diff deleted file mode 100644 index 0e1268161a..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).symbols.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeOverride2(module=node20).symbols -+++ new.nodeModulesTripleSlashReferenceModeOverride2(module=node20).symbols -@@= skipped -2, +2 lines =@@ - === /index.ts === - /// - foo; // foo should resolve while bar should not, since index.js is esm -->foo : Symbol(foo, Decl(import.d.ts, 2, 7)) -- - bar; -+>bar : Symbol(bar, Decl(require.d.ts, 2, 7)) -+ - export {}; --=== /node_modules/pkg/import.d.ts === -+=== /node_modules/pkg/require.d.ts === - export {}; - declare global { -->global : Symbol(global, Decl(import.d.ts, 0, 10)) -+>global : Symbol(global, Decl(require.d.ts, 0, 10)) - -- var foo: number; -->foo : Symbol(foo, Decl(import.d.ts, 2, 7)) -+ var bar: number; -+>bar : Symbol(bar, Decl(require.d.ts, 2, 7)) - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).types b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).types index 235394cd2c..3b7a7ec78e 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).types @@ -3,17 +3,17 @@ === /index.ts === /// foo; // foo should resolve while bar should not, since index.js is esm ->foo : any +>foo : number bar; ->bar : number +>bar : any export {}; -=== /node_modules/pkg/require.d.ts === +=== /node_modules/pkg/import.d.ts === export {}; declare global { >global : typeof global - var bar: number; ->bar : number + var foo: number; +>foo : number } diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).types.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).types.diff deleted file mode 100644 index 353d9b309b..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride2(module=node20).types.diff +++ /dev/null @@ -1,25 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeOverride2(module=node20).types -+++ new.nodeModulesTripleSlashReferenceModeOverride2(module=node20).types -@@= skipped -2, +2 lines =@@ - === /index.ts === - /// - foo; // foo should resolve while bar should not, since index.js is esm -->foo : number -+>foo : any - - bar; -->bar : any -+>bar : number - - export {}; --=== /node_modules/pkg/import.d.ts === -+=== /node_modules/pkg/require.d.ts === - export {}; - declare global { - >global : typeof global - -- var foo: number; -->foo : number -+ var bar: number; -+>bar : number - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride3(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride3(module=node20).errors.txt index 084fe9f4e0..477d247984 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride3(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride3(module=node20).errors.txt @@ -1,8 +1,6 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. /index.ts(2,1): error TS2304: Cannot find name 'foo'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /index.ts (1 errors) ==== /// foo; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride3(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride3(module=node20).errors.txt.diff deleted file mode 100644 index 936d9207bd..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride3(module=node20).errors.txt.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeOverride3(module=node20).errors.txt -+++ new.nodeModulesTripleSlashReferenceModeOverride3(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - /index.ts(2,1): error TS2304: Cannot find name 'foo'. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== /index.ts (1 errors) ==== - /// - foo; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride3(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride3(module=node20).js index 7bde651a81..c6806f897d 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride3(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride3(module=node20).js @@ -31,8 +31,7 @@ bar; // bar should resolve while foo should not, since even though index.js is e export {}; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); /// foo; bar; // bar should resolve while foo should not, since even though index.js is esm, the reference is cjs +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride3(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride3(module=node20).js.diff deleted file mode 100644 index c41774a12d..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride3(module=node20).js.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeOverride3(module=node20).js -+++ new.nodeModulesTripleSlashReferenceModeOverride3(module=node20).js -@@= skipped -30, +30 lines =@@ - export {}; - - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - /// - foo; - bar; // bar should resolve while foo should not, since even though index.js is esm, the reference is cjs --export {}; \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride4(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride4(module=node20).errors.txt index ccc0b63956..3d7f07f277 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride4(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride4(module=node20).errors.txt @@ -1,8 +1,6 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. /index.ts(3,1): error TS2304: Cannot find name 'bar'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /index.ts (1 errors) ==== /// foo; // foo should resolve while bar should not, since even though index.js is cjs, the refernce is esm diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride4(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride4(module=node20).errors.txt.diff deleted file mode 100644 index 7ebaea0307..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride4(module=node20).errors.txt.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeOverride4(module=node20).errors.txt -+++ new.nodeModulesTripleSlashReferenceModeOverride4(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - /index.ts(3,1): error TS2304: Cannot find name 'bar'. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== /index.ts (1 errors) ==== - /// - foo; // foo should resolve while bar should not, since even though index.js is cjs, the refernce is esm \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride5(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride5(module=node20).errors.txt deleted file mode 100644 index f1800f46cb..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride5(module=node20).errors.txt +++ /dev/null @@ -1,31 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== /index.ts (0 errors) ==== - /// - /// - // Both `foo` and `bar` should resolve, as _both_ entrypoints are included by the two - // references above. - foo; - bar; - export {}; -==== /node_modules/pkg/package.json (0 errors) ==== - { - "name": "pkg", - "version": "0.0.1", - "exports": { - "import": "./import.js", - "require": "./require.js" - } - } -==== /node_modules/pkg/import.d.ts (0 errors) ==== - export {}; - declare global { - var foo: number; - } -==== /node_modules/pkg/require.d.ts (0 errors) ==== - export {}; - declare global { - var bar: number; - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride5(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride5(module=node20).errors.txt.diff deleted file mode 100644 index 50392d66b5..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverride5(module=node20).errors.txt.diff +++ /dev/null @@ -1,35 +0,0 @@ ---- old.nodeModulesTripleSlashReferenceModeOverride5(module=node20).errors.txt -+++ new.nodeModulesTripleSlashReferenceModeOverride5(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== /index.ts (0 errors) ==== -+ /// -+ /// -+ // Both `foo` and `bar` should resolve, as _both_ entrypoints are included by the two -+ // references above. -+ foo; -+ bar; -+ export {}; -+==== /node_modules/pkg/package.json (0 errors) ==== -+ { -+ "name": "pkg", -+ "version": "0.0.1", -+ "exports": { -+ "import": "./import.js", -+ "require": "./require.js" -+ } -+ } -+==== /node_modules/pkg/import.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ var foo: number; -+ } -+==== /node_modules/pkg/require.d.ts (0 errors) ==== -+ export {}; -+ declare global { -+ var bar: number; -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node20).errors.txt index aaf67babaf..cd6427d480 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node20).errors.txt @@ -1,8 +1,6 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. /index.ts(2,1): error TS2304: Cannot find name 'foo'. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /index.ts (1 errors) ==== /// foo; // bad resolution mode, which resolves is arbitrary diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node20).errors.txt.diff index 2b5265bb72..7302a4c5be 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTripleSlashReferenceModeOverrideModeError(module=node20).errors.txt.diff @@ -2,12 +2,10 @@ +++ new.nodeModulesTripleSlashReferenceModeOverrideModeError(module=node20).errors.txt @@= skipped -0, +0 lines =@@ -/index.ts(1,23): error TS1453: `resolution-mode` should be either `require` or `import`. -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. /index.ts(2,1): error TS2304: Cannot find name 'foo'. -==== /index.ts (2 errors) ==== -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. +==== /index.ts (1 errors) ==== /// - ~~~ diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTsFiles(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTsFiles(module=node20).errors.txt deleted file mode 100644 index 2e1790dd69..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTsFiles(module=node20).errors.txt +++ /dev/null @@ -1,12 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== /index.ts (0 errors) ==== - import { add } from "lodash-ts/add.ts"; // Ok - -==== /node_modules/lodash-ts/add.ts (0 errors) ==== - export function add(a: number, b: number) { - return a + b; - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTsFiles(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTsFiles(module=node20).errors.txt.diff deleted file mode 100644 index c8c77ac55c..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTsFiles(module=node20).errors.txt.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.nodeModulesTsFiles(module=node20).errors.txt -+++ new.nodeModulesTsFiles(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== /index.ts (0 errors) ==== -+ import { add } from "lodash-ts/add.ts"; // Ok -+ -+==== /node_modules/lodash-ts/add.ts (0 errors) ==== -+ export function add(a: number, b: number) { -+ return a + b; -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node16).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node16).symbols index 21f0eeeb44..8ec3cb25a7 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node16).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node16).symbols @@ -6,9 +6,9 @@ import * as mod from "inner"; >mod : Symbol(mod, Decl(index.ts, 1, 6)) mod.correctVersionApplied; ->mod.correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) +>mod.correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) >mod : Symbol(mod, Decl(index.ts, 1, 6)) ->correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) +>correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) === index.mts === // esm format file @@ -16,9 +16,9 @@ import * as mod from "inner"; >mod : Symbol(mod, Decl(index.mts, 1, 6)) mod.correctVersionApplied; ->mod.correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) +>mod.correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) >mod : Symbol(mod, Decl(index.mts, 1, 6)) ->correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) +>correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) === index.cts === // cjs format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node16).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node16).symbols.diff deleted file mode 100644 index 11d9c3446e..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node16).symbols.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.nodeModulesTypesVersionPackageExports(module=node16).symbols -+++ new.nodeModulesTypesVersionPackageExports(module=node16).symbols -@@= skipped -5, +5 lines =@@ - >mod : Symbol(mod, Decl(index.ts, 1, 6)) - - mod.correctVersionApplied; -->mod.correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) -+>mod.correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) - >mod : Symbol(mod, Decl(index.ts, 1, 6)) -->correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) -+>correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) - - === index.mts === - // esm format file -@@= skipped -10, +10 lines =@@ - >mod : Symbol(mod, Decl(index.mts, 1, 6)) - - mod.correctVersionApplied; -->mod.correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) -+>mod.correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) - >mod : Symbol(mod, Decl(index.mts, 1, 6)) -->correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) -+>correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) - - === index.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node18).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node18).symbols index 21f0eeeb44..8ec3cb25a7 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node18).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node18).symbols @@ -6,9 +6,9 @@ import * as mod from "inner"; >mod : Symbol(mod, Decl(index.ts, 1, 6)) mod.correctVersionApplied; ->mod.correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) +>mod.correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) >mod : Symbol(mod, Decl(index.ts, 1, 6)) ->correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) +>correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) === index.mts === // esm format file @@ -16,9 +16,9 @@ import * as mod from "inner"; >mod : Symbol(mod, Decl(index.mts, 1, 6)) mod.correctVersionApplied; ->mod.correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) +>mod.correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) >mod : Symbol(mod, Decl(index.mts, 1, 6)) ->correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) +>correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) === index.cts === // cjs format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node18).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node18).symbols.diff deleted file mode 100644 index 4b22e37906..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node18).symbols.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.nodeModulesTypesVersionPackageExports(module=node18).symbols -+++ new.nodeModulesTypesVersionPackageExports(module=node18).symbols -@@= skipped -5, +5 lines =@@ - >mod : Symbol(mod, Decl(index.ts, 1, 6)) - - mod.correctVersionApplied; -->mod.correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) -+>mod.correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) - >mod : Symbol(mod, Decl(index.ts, 1, 6)) -->correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) -+>correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) - - === index.mts === - // esm format file -@@= skipped -10, +10 lines =@@ - >mod : Symbol(mod, Decl(index.mts, 1, 6)) - - mod.correctVersionApplied; -->mod.correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) -+>mod.correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) - >mod : Symbol(mod, Decl(index.mts, 1, 6)) -->correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) -+>correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) - - === index.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).errors.txt deleted file mode 100644 index 22c440df85..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).errors.txt +++ /dev/null @@ -1,55 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== index.ts (0 errors) ==== - // esm format file - import * as mod from "inner"; - mod.correctVersionApplied; - -==== index.mts (0 errors) ==== - // esm format file - import * as mod from "inner"; - mod.correctVersionApplied; - -==== index.cts (0 errors) ==== - // cjs format file - import * as mod from "inner"; - mod.correctVersionApplied; - -==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - export const noConditionsApplied = true; -==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - export const importConditionApplied = true; -==== node_modules/inner/index.d.cts (0 errors) ==== - // cjs format file - export const wrongConditionApplied = true; -==== node_modules/inner/old-types.d.ts (0 errors) ==== - export const noVersionApplied = true; -==== node_modules/inner/new-types.d.ts (0 errors) ==== - export const correctVersionApplied = true; -==== node_modules/inner/future-types.d.ts (0 errors) ==== - export const futureVersionApplied = true; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module" - } -==== node_modules/inner/package.json (0 errors) ==== - { - "name": "inner", - "private": true, - "exports": { - ".": { - "types@>=10000": "./future-types.d.ts", - "types@>=1": "./new-types.d.ts", - "types": "./old-types.d.ts", - "import": "./index.mjs", - "node": "./index.js" - } - } - } - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).errors.txt.diff deleted file mode 100644 index a58cf39714..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).errors.txt.diff +++ /dev/null @@ -1,59 +0,0 @@ ---- old.nodeModulesTypesVersionPackageExports(module=node20).errors.txt -+++ new.nodeModulesTypesVersionPackageExports(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== index.ts (0 errors) ==== -+ // esm format file -+ import * as mod from "inner"; -+ mod.correctVersionApplied; -+ -+==== index.mts (0 errors) ==== -+ // esm format file -+ import * as mod from "inner"; -+ mod.correctVersionApplied; -+ -+==== index.cts (0 errors) ==== -+ // cjs format file -+ import * as mod from "inner"; -+ mod.correctVersionApplied; -+ -+==== node_modules/inner/index.d.ts (0 errors) ==== -+ // cjs format file -+ export const noConditionsApplied = true; -+==== node_modules/inner/index.d.mts (0 errors) ==== -+ // esm format file -+ export const importConditionApplied = true; -+==== node_modules/inner/index.d.cts (0 errors) ==== -+ // cjs format file -+ export const wrongConditionApplied = true; -+==== node_modules/inner/old-types.d.ts (0 errors) ==== -+ export const noVersionApplied = true; -+==== node_modules/inner/new-types.d.ts (0 errors) ==== -+ export const correctVersionApplied = true; -+==== node_modules/inner/future-types.d.ts (0 errors) ==== -+ export const futureVersionApplied = true; -+==== package.json (0 errors) ==== -+ { -+ "name": "package", -+ "private": true, -+ "type": "module" -+ } -+==== node_modules/inner/package.json (0 errors) ==== -+ { -+ "name": "inner", -+ "private": true, -+ "exports": { -+ ".": { -+ "types@>=10000": "./future-types.d.ts", -+ "types@>=1": "./new-types.d.ts", -+ "types": "./old-types.d.ts", -+ "import": "./index.mjs", -+ "node": "./index.js" -+ } -+ } -+ } -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).js index e731a9a327..0a09964a04 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).js @@ -53,22 +53,51 @@ export const futureVersionApplied = true; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const mod = require("inner"); +import * as mod from "inner"; mod.correctVersionApplied; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const mod = require("inner"); +import * as mod from "inner"; mod.correctVersionApplied; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // cjs format file -const mod = require("inner"); +const mod = __importStar(require("inner")); mod.correctVersionApplied; diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).js.diff deleted file mode 100644 index e3009a9fbb..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).js.diff +++ /dev/null @@ -1,60 +0,0 @@ ---- old.nodeModulesTypesVersionPackageExports(module=node20).js -+++ new.nodeModulesTypesVersionPackageExports(module=node20).js -@@= skipped -52, +52 lines =@@ - - - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as mod from "inner"; -+const mod = require("inner"); - mod.correctVersionApplied; - //// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as mod from "inner"; -+const mod = require("inner"); - mod.correctVersionApplied; - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - // cjs format file --const mod = __importStar(require("inner")); -+const mod = require("inner"); - mod.correctVersionApplied; - diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).symbols index 21f0eeeb44..8ec3cb25a7 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).symbols @@ -6,9 +6,9 @@ import * as mod from "inner"; >mod : Symbol(mod, Decl(index.ts, 1, 6)) mod.correctVersionApplied; ->mod.correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) +>mod.correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) >mod : Symbol(mod, Decl(index.ts, 1, 6)) ->correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) +>correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) === index.mts === // esm format file @@ -16,9 +16,9 @@ import * as mod from "inner"; >mod : Symbol(mod, Decl(index.mts, 1, 6)) mod.correctVersionApplied; ->mod.correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) +>mod.correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) >mod : Symbol(mod, Decl(index.mts, 1, 6)) ->correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) +>correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) === index.cts === // cjs format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).symbols.diff deleted file mode 100644 index 2c7e8326f4..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=node20).symbols.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.nodeModulesTypesVersionPackageExports(module=node20).symbols -+++ new.nodeModulesTypesVersionPackageExports(module=node20).symbols -@@= skipped -5, +5 lines =@@ - >mod : Symbol(mod, Decl(index.ts, 1, 6)) - - mod.correctVersionApplied; -->mod.correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) -+>mod.correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) - >mod : Symbol(mod, Decl(index.ts, 1, 6)) -->correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) -+>correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) - - === index.mts === - // esm format file -@@= skipped -10, +10 lines =@@ - >mod : Symbol(mod, Decl(index.mts, 1, 6)) - - mod.correctVersionApplied; -->mod.correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) -+>mod.correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) - >mod : Symbol(mod, Decl(index.mts, 1, 6)) -->correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) -+>correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) - - === index.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=nodenext).symbols b/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=nodenext).symbols index 21f0eeeb44..8ec3cb25a7 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=nodenext).symbols +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=nodenext).symbols @@ -6,9 +6,9 @@ import * as mod from "inner"; >mod : Symbol(mod, Decl(index.ts, 1, 6)) mod.correctVersionApplied; ->mod.correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) +>mod.correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) >mod : Symbol(mod, Decl(index.ts, 1, 6)) ->correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) +>correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) === index.mts === // esm format file @@ -16,9 +16,9 @@ import * as mod from "inner"; >mod : Symbol(mod, Decl(index.mts, 1, 6)) mod.correctVersionApplied; ->mod.correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) +>mod.correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) >mod : Symbol(mod, Decl(index.mts, 1, 6)) ->correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) +>correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) === index.cts === // cjs format file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=nodenext).symbols.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=nodenext).symbols.diff deleted file mode 100644 index 1ee4fa9395..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesTypesVersionPackageExports(module=nodenext).symbols.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.nodeModulesTypesVersionPackageExports(module=nodenext).symbols -+++ new.nodeModulesTypesVersionPackageExports(module=nodenext).symbols -@@= skipped -5, +5 lines =@@ - >mod : Symbol(mod, Decl(index.ts, 1, 6)) - - mod.correctVersionApplied; -->mod.correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) -+>mod.correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) - >mod : Symbol(mod, Decl(index.ts, 1, 6)) -->correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) -+>correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) - - === index.mts === - // esm format file -@@= skipped -10, +10 lines =@@ - >mod : Symbol(mod, Decl(index.mts, 1, 6)) - - mod.correctVersionApplied; -->mod.correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) -+>mod.correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) - >mod : Symbol(mod, Decl(index.mts, 1, 6)) -->correctVersionApplied : Symbol(correctVersionApplied, Decl(new-types.d.ts, 0, 12)) -+>correctVersionApplied : Symbol(mod.correctVersionApplied, Decl(new-types.d.ts, 0, 12)) - - === index.cts === - // cjs format file \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodePackageSelfName(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodePackageSelfName(module=node20).errors.txt deleted file mode 100644 index 0dc2a46ccf..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodePackageSelfName(module=node20).errors.txt +++ /dev/null @@ -1,23 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== index.ts (0 errors) ==== - // esm format file - import * as self from "package"; - self; -==== index.mts (0 errors) ==== - // esm format file - import * as self from "package"; - self; -==== index.cts (0 errors) ==== - // esm format file - import * as self from "package"; - self; -==== package.json (0 errors) ==== - { - "name": "package", - "private": true, - "type": "module", - "exports": "./index.js" - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodePackageSelfName(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodePackageSelfName(module=node20).errors.txt.diff deleted file mode 100644 index 9f8d98beab..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodePackageSelfName(module=node20).errors.txt.diff +++ /dev/null @@ -1,27 +0,0 @@ ---- old.nodePackageSelfName(module=node20).errors.txt -+++ new.nodePackageSelfName(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== index.ts (0 errors) ==== -+ // esm format file -+ import * as self from "package"; -+ self; -+==== index.mts (0 errors) ==== -+ // esm format file -+ import * as self from "package"; -+ self; -+==== index.cts (0 errors) ==== -+ // esm format file -+ import * as self from "package"; -+ self; -+==== package.json (0 errors) ==== -+ { -+ "name": "package", -+ "private": true, -+ "type": "module", -+ "exports": "./index.js" -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodePackageSelfName(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodePackageSelfName(module=node20).js index 808f7208b8..dc65d690cf 100644 --- a/testdata/baselines/reference/submodule/conformance/nodePackageSelfName(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodePackageSelfName(module=node20).js @@ -21,22 +21,51 @@ self; } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const self = require("package"); +import * as self from "package"; self; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const self = require("package"); +import * as self from "package"; self; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const self = require("package"); +const self = __importStar(require("package")); self; diff --git a/testdata/baselines/reference/submodule/conformance/nodePackageSelfName(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodePackageSelfName(module=node20).js.diff deleted file mode 100644 index cea0f0b80e..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodePackageSelfName(module=node20).js.diff +++ /dev/null @@ -1,60 +0,0 @@ ---- old.nodePackageSelfName(module=node20).js -+++ new.nodePackageSelfName(module=node20).js -@@= skipped -20, +20 lines =@@ - } - - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as self from "package"; -+const self = require("package"); - self; - //// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as self from "package"; -+const self = require("package"); - self; - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --const self = __importStar(require("package")); -+const self = require("package"); - self; - diff --git a/testdata/baselines/reference/submodule/conformance/nodePackageSelfNameScoped(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodePackageSelfNameScoped(module=node20).errors.txt deleted file mode 100644 index 0852852eb9..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodePackageSelfNameScoped(module=node20).errors.txt +++ /dev/null @@ -1,23 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== index.ts (0 errors) ==== - // esm format file - import * as self from "@scope/package"; - self; -==== index.mts (0 errors) ==== - // esm format file - import * as self from "@scope/package"; - self; -==== index.cts (0 errors) ==== - // cjs format file - import * as self from "@scope/package"; - self; -==== package.json (0 errors) ==== - { - "name": "@scope/package", - "private": true, - "type": "module", - "exports": "./index.js" - } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodePackageSelfNameScoped(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodePackageSelfNameScoped(module=node20).errors.txt.diff deleted file mode 100644 index 0c5e2ee783..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodePackageSelfNameScoped(module=node20).errors.txt.diff +++ /dev/null @@ -1,27 +0,0 @@ ---- old.nodePackageSelfNameScoped(module=node20).errors.txt -+++ new.nodePackageSelfNameScoped(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== index.ts (0 errors) ==== -+ // esm format file -+ import * as self from "@scope/package"; -+ self; -+==== index.mts (0 errors) ==== -+ // esm format file -+ import * as self from "@scope/package"; -+ self; -+==== index.cts (0 errors) ==== -+ // cjs format file -+ import * as self from "@scope/package"; -+ self; -+==== package.json (0 errors) ==== -+ { -+ "name": "@scope/package", -+ "private": true, -+ "type": "module", -+ "exports": "./index.js" -+ } \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodePackageSelfNameScoped(module=node20).js b/testdata/baselines/reference/submodule/conformance/nodePackageSelfNameScoped(module=node20).js index 0ab838fc3e..f9d633df6f 100644 --- a/testdata/baselines/reference/submodule/conformance/nodePackageSelfNameScoped(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nodePackageSelfNameScoped(module=node20).js @@ -21,22 +21,51 @@ self; } //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const self = require("@scope/package"); +import * as self from "@scope/package"; self; //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); // esm format file -const self = require("@scope/package"); +import * as self from "@scope/package"; self; //// [index.cjs] "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); Object.defineProperty(exports, "__esModule", { value: true }); // cjs format file -const self = require("@scope/package"); +const self = __importStar(require("@scope/package")); self; diff --git a/testdata/baselines/reference/submodule/conformance/nodePackageSelfNameScoped(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nodePackageSelfNameScoped(module=node20).js.diff deleted file mode 100644 index c8c7177806..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nodePackageSelfNameScoped(module=node20).js.diff +++ /dev/null @@ -1,60 +0,0 @@ ---- old.nodePackageSelfNameScoped(module=node20).js -+++ new.nodePackageSelfNameScoped(module=node20).js -@@= skipped -20, +20 lines =@@ - } - - //// [index.js] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as self from "@scope/package"; -+const self = require("@scope/package"); - self; - //// [index.mjs] -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - // esm format file --import * as self from "@scope/package"; -+const self = require("@scope/package"); - self; - //// [index.cjs] - "use strict"; --var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- var desc = Object.getOwnPropertyDescriptor(m, k); -- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { -- desc = { enumerable: true, get: function() { return m[k]; } }; -- } -- Object.defineProperty(o, k2, desc); --}) : (function(o, m, k, k2) { -- if (k2 === undefined) k2 = k; -- o[k2] = m[k]; --})); --var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { -- Object.defineProperty(o, "default", { enumerable: true, value: v }); --}) : function(o, v) { -- o["default"] = v; --}); --var __importStar = (this && this.__importStar) || (function () { -- var ownKeys = function(o) { -- ownKeys = Object.getOwnPropertyNames || function (o) { -- var ar = []; -- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; -- return ar; -- }; -- return ownKeys(o); -- }; -- return function (mod) { -- if (mod && mod.__esModule) return mod; -- var result = {}; -- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); -- __setModuleDefault(result, mod); -- return result; -- }; --})(); - Object.defineProperty(exports, "__esModule", { value: true }); - // cjs format file --const self = __importStar(require("@scope/package")); -+const self = require("@scope/package"); - self; - diff --git a/testdata/baselines/reference/submodule/conformance/nonTSExtensions(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nonTSExtensions(module=node20).errors.txt deleted file mode 100644 index fde53ef312..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nonTSExtensions(module=node20).errors.txt +++ /dev/null @@ -1,13 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== example.json (0 errors) ==== - {} - -==== styles.d.css.ts (0 errors) ==== - export {}; - -==== index.mts (0 errors) ==== - import {} from "./example.json" with { type: "json" }; // Ok - import {} from "./styles.css"; // Ok \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nonTSExtensions(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nonTSExtensions(module=node20).errors.txt.diff deleted file mode 100644 index 46899befb5..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nonTSExtensions(module=node20).errors.txt.diff +++ /dev/null @@ -1,17 +0,0 @@ ---- old.nonTSExtensions(module=node20).errors.txt -+++ new.nonTSExtensions(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== example.json (0 errors) ==== -+ {} -+ -+==== styles.d.css.ts (0 errors) ==== -+ export {}; -+ -+==== index.mts (0 errors) ==== -+ import {} from "./example.json" with { type: "json" }; // Ok -+ import {} from "./styles.css"; // Ok \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nonTSExtensions(module=node20).js b/testdata/baselines/reference/submodule/conformance/nonTSExtensions(module=node20).js index 7952812e2f..117d199aa7 100644 --- a/testdata/baselines/reference/submodule/conformance/nonTSExtensions(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/nonTSExtensions(module=node20).js @@ -11,5 +11,4 @@ import {} from "./example.json" with { type: "json" }; // Ok import {} from "./styles.css"; // Ok //// [index.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; diff --git a/testdata/baselines/reference/submodule/conformance/nonTSExtensions(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/nonTSExtensions(module=node20).js.diff deleted file mode 100644 index 3d87f69e61..0000000000 --- a/testdata/baselines/reference/submodule/conformance/nonTSExtensions(module=node20).js.diff +++ /dev/null @@ -1,9 +0,0 @@ ---- old.nonTSExtensions(module=node20).js -+++ new.nonTSExtensions(module=node20).js -@@= skipped -10, +10 lines =@@ - import {} from "./styles.css"; // Ok - - //// [index.mjs] --export {}; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/packageJsonImportsErrors(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/packageJsonImportsErrors(module=node20).errors.txt index a24608608b..8167e0cafd 100644 --- a/testdata/baselines/reference/submodule/conformance/packageJsonImportsErrors(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/packageJsonImportsErrors(module=node20).errors.txt @@ -1,8 +1,6 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. /index.ts(2,16): error TS2877: This import uses a '.ts' extension to resolve to an input TypeScript file, but will not be rewritten during emit because it is not a relative path. -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ==== /package.json (0 errors) ==== { "name": "pkg", diff --git a/testdata/baselines/reference/submodule/conformance/packageJsonImportsErrors(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/packageJsonImportsErrors(module=node20).errors.txt.diff deleted file mode 100644 index 0433a98687..0000000000 --- a/testdata/baselines/reference/submodule/conformance/packageJsonImportsErrors(module=node20).errors.txt.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- old.packageJsonImportsErrors(module=node20).errors.txt -+++ new.packageJsonImportsErrors(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - /index.ts(2,16): error TS2877: This import uses a '.ts' extension to resolve to an input TypeScript file, but will not be rewritten during emit because it is not a relative path. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== /package.json (0 errors) ==== - { - "name": "pkg", \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/packageJsonImportsErrors(module=node20).js b/testdata/baselines/reference/submodule/conformance/packageJsonImportsErrors(module=node20).js index c735076d9e..5a0805f046 100644 --- a/testdata/baselines/reference/submodule/conformance/packageJsonImportsErrors(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/packageJsonImportsErrors(module=node20).js @@ -28,14 +28,10 @@ import {} from "#internal/foo.ts"; // Error import {} from "pkg/foo.ts"; // Ok //// [foo.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //// [foo.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //// [index.js] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const _foo_ts_1 = require("#foo.ts"); // Ok -const foo_ts_1 = require("#internal/foo.ts"); // Error -const foo_ts_2 = require("pkg/foo.ts"); // Ok +import {} from "#foo.ts"; // Ok +import {} from "#internal/foo.ts"; // Error +import {} from "pkg/foo.ts"; // Ok diff --git a/testdata/baselines/reference/submodule/conformance/packageJsonImportsErrors(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/packageJsonImportsErrors(module=node20).js.diff deleted file mode 100644 index 0857b0dc76..0000000000 --- a/testdata/baselines/reference/submodule/conformance/packageJsonImportsErrors(module=node20).js.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.packageJsonImportsErrors(module=node20).js -+++ new.packageJsonImportsErrors(module=node20).js -@@= skipped -27, +27 lines =@@ - import {} from "pkg/foo.ts"; // Ok - - //// [foo.js] --export {}; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - //// [foo.js] --export {}; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - //// [index.js] --import {} from "#foo.ts"; // Ok --import {} from "#internal/foo.ts"; // Error --import {} from "pkg/foo.ts"; // Ok -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); -+const _foo_ts_1 = require("#foo.ts"); // Ok -+const foo_ts_1 = require("#internal/foo.ts"); // Error -+const foo_ts_2 = require("pkg/foo.ts"); // Ok \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).errors.txt deleted file mode 100644 index 5aab49a4c7..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).errors.txt +++ /dev/null @@ -1,15 +0,0 @@ -error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - - -!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -==== module.mts (0 errors) ==== - export {}; - -==== common.cts (0 errors) ==== - import type {} from "./module.mts"; - import type {} from "./module.mts" with { "resolution-mode": "import" }; - import type {} from "./module.mts" with { "resolution-mode": "require" }; - type _1 = typeof import("./module.mts"); - type _2 = typeof import("./module.mts", { with: { "resolution-mode": "import" } }); - type _3 = typeof import("./module.mts", { with: { "resolution-mode": "require" } }); - \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).errors.txt.diff deleted file mode 100644 index ad2ae09289..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).errors.txt.diff +++ /dev/null @@ -1,19 +0,0 @@ ---- old.typeOnlyESMImportFromCJS(module=node20).errors.txt -+++ new.typeOnlyESMImportFromCJS(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== module.mts (0 errors) ==== -+ export {}; -+ -+==== common.cts (0 errors) ==== -+ import type {} from "./module.mts"; -+ import type {} from "./module.mts" with { "resolution-mode": "import" }; -+ import type {} from "./module.mts" with { "resolution-mode": "require" }; -+ type _1 = typeof import("./module.mts"); -+ type _2 = typeof import("./module.mts", { with: { "resolution-mode": "import" } }); -+ type _3 = typeof import("./module.mts", { with: { "resolution-mode": "require" } }); -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).js b/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).js index 5ba6ae1ae7..01b406ded5 100644 --- a/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).js +++ b/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).js @@ -13,8 +13,7 @@ type _3 = typeof import("./module.mts", { with: { "resolution-mode": "require" } //// [module.mjs] -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); +export {}; //// [common.cjs] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).js.diff b/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).js.diff deleted file mode 100644 index c7e753f5b9..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).js.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.typeOnlyESMImportFromCJS(module=node20).js -+++ new.typeOnlyESMImportFromCJS(module=node20).js -@@= skipped -12, +12 lines =@@ - - - //// [module.mjs] --export {}; -+"use strict"; -+Object.defineProperty(exports, "__esModule", { value: true }); - //// [common.cjs] - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).types b/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).types index a97ffa95be..c94b254bed 100644 --- a/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).types +++ b/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).types @@ -9,11 +9,11 @@ import type {} from "./module.mts"; import type {} from "./module.mts" with { "resolution-mode": "import" }; import type {} from "./module.mts" with { "resolution-mode": "require" }; type _1 = typeof import("./module.mts"); ->_1 : typeof import("module") +>_1 : typeof import("module", { with: { "resolution-mode": "import" } }) type _2 = typeof import("./module.mts", { with: { "resolution-mode": "import" } }); ->_2 : typeof import("module") +>_2 : typeof import("module", { with: { "resolution-mode": "import" } }) type _3 = typeof import("./module.mts", { with: { "resolution-mode": "require" } }); ->_3 : typeof import("module") +>_3 : typeof import("module", { with: { "resolution-mode": "import" } }) diff --git a/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).types.diff b/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).types.diff deleted file mode 100644 index cb1750eeec..0000000000 --- a/testdata/baselines/reference/submodule/conformance/typeOnlyESMImportFromCJS(module=node20).types.diff +++ /dev/null @@ -1,16 +0,0 @@ ---- old.typeOnlyESMImportFromCJS(module=node20).types -+++ new.typeOnlyESMImportFromCJS(module=node20).types -@@= skipped -8, +8 lines =@@ - import type {} from "./module.mts" with { "resolution-mode": "import" }; - import type {} from "./module.mts" with { "resolution-mode": "require" }; - type _1 = typeof import("./module.mts"); -->_1 : typeof import("module", { with: { "resolution-mode": "import" } }) -+>_1 : typeof import("module") - - type _2 = typeof import("./module.mts", { with: { "resolution-mode": "import" } }); -->_2 : typeof import("module", { with: { "resolution-mode": "import" } }) -+>_2 : typeof import("module") - - type _3 = typeof import("./module.mts", { with: { "resolution-mode": "require" } }); -->_3 : typeof import("module", { with: { "resolution-mode": "import" } }) -+>_3 : typeof import("module") diff --git a/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsCJS.symbols b/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsCJS.symbols index b961f39a84..f29e0d0485 100644 --- a/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsCJS.symbols +++ b/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsCJS.symbols @@ -36,7 +36,7 @@ import type { funciton as funciton2 } from "./decl"; // ok I guess? >funciton2 : Symbol(funciton2, Decl(main.ts, 3, 13)) import("./decl"); // error ->"./decl" : Symbol(esmy2, Decl(decl.d.ts, 0, 0)) +>"./decl" : Symbol("/decl", Decl(decl.d.ts, 0, 0)) type T = typeof import("./decl"); // ok >T : Symbol(T, Decl(main.ts, 4, 17)) diff --git a/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsCJS.symbols.diff b/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsCJS.symbols.diff index b681206bf8..23c7dd49db 100644 --- a/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsCJS.symbols.diff +++ b/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsCJS.symbols.diff @@ -8,9 +8,4 @@ +>funciton : Symbol(funciton, Decl(decl.d.ts, 1, 20)) >funciton2 : Symbol(funciton2, Decl(main.ts, 3, 13)) - import("./decl"); // error -->"./decl" : Symbol("/decl", Decl(decl.d.ts, 0, 0)) -+>"./decl" : Symbol(esmy2, Decl(decl.d.ts, 0, 0)) - - type T = typeof import("./decl"); // ok - >T : Symbol(T, Decl(main.ts, 4, 17)) \ No newline at end of file + import("./decl"); // error \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsCJS.types b/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsCJS.types index 25286bf5e4..cc0780ce99 100644 --- a/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsCJS.types +++ b/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsCJS.types @@ -36,11 +36,11 @@ import type { funciton as funciton2 } from "./decl"; // ok I guess? >funciton2 : any import("./decl"); // error ->import("./decl") : Promise +>import("./decl") : Promise >"./decl" : "./decl" type T = typeof import("./decl"); // ok ->T : typeof esmy2 +>T : typeof import("/decl") export {}; // error export const x = 1; // error @@ -49,7 +49,7 @@ export const x = 1; // error export interface I {} // ok export type { T }; // ok ->T : typeof esmy2 +>T : typeof import("/decl") export namespace JustTypes { export type T = number; diff --git a/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsCJS.types.diff b/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsCJS.types.diff deleted file mode 100644 index 3af74f3d2f..0000000000 --- a/testdata/baselines/reference/submodule/conformance/verbatimModuleSyntaxRestrictionsCJS.types.diff +++ /dev/null @@ -1,25 +0,0 @@ ---- old.verbatimModuleSyntaxRestrictionsCJS.types -+++ new.verbatimModuleSyntaxRestrictionsCJS.types -@@= skipped -35, +35 lines =@@ - >funciton2 : any - - import("./decl"); // error -->import("./decl") : Promise -+>import("./decl") : Promise - >"./decl" : "./decl" - - type T = typeof import("./decl"); // ok -->T : typeof import("/decl") -+>T : typeof esmy2 - - export {}; // error - export const x = 1; // error -@@= skipped -13, +13 lines =@@ - - export interface I {} // ok - export type { T }; // ok -->T : typeof import("/decl") -+>T : typeof esmy2 - - export namespace JustTypes { - export type T = number; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports1.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports1.errors.txt.diff deleted file mode 100644 index f01a9dd5b2..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports1.errors.txt.diff +++ /dev/null @@ -1,41 +0,0 @@ ---- old.esmModuleExports1.errors.txt -+++ new.esmModuleExports1.errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+/importer-cjs.cjs(2,5): error TS2351: This expression is not constructable. -+ Type 'typeof import("/exporter")' has no construct signatures. -+/importer-cts.cts(2,5): error TS2351: This expression is not constructable. -+ Type 'typeof import("/exporter")' has no construct signatures. -+/importer-cts.cts(8,5): error TS2351: This expression is not constructable. -+ Type 'typeof import("/exporter")' has no construct signatures. - /importer-cts.cts(10,10): error TS2614: Module '"./exporter.mjs"' has no exported member 'Oops'. Did you mean to use 'import Oops from "./exporter.mjs"' instead? - - --==== /importer-cjs.cjs (0 errors) ==== -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== /importer-cjs.cjs (1 errors) ==== - const Foo = require("./exporter.mjs"); - new Foo(); -+ ~~~ -+!!! error TS2351: This expression is not constructable. -+!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. - --==== /importer-cts.cts (1 errors) ==== -+==== /importer-cts.cts (3 errors) ==== - import Foo = require("./exporter.mjs"); - new Foo(); -+ ~~~ -+!!! error TS2351: This expression is not constructable. -+!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. - - import Foo2 from "./exporter.mjs"; - new Foo2(); - - import * as Foo3 from "./exporter.mjs"; - new Foo3(); -+ ~~~~ -+!!! error TS2351: This expression is not constructable. -+!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. - - import { Oops } from "./exporter.mjs"; - ~~~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports1.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports1.types.diff deleted file mode 100644 index 910ac40e24..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports1.types.diff +++ /dev/null @@ -1,44 +0,0 @@ ---- old.esmModuleExports1.types -+++ new.esmModuleExports1.types -@@= skipped -2, +2 lines =@@ - === /importer-cjs.cjs === - const Foo = require("./exporter.mjs"); - >Foo : typeof Foo -->require("./exporter.mjs") : typeof import("/exporter", { with: { "resolution-mode": "import" } }) -+>require("./exporter.mjs") : typeof Foo - >require : any - >"./exporter.mjs" : "./exporter.mjs" - - new Foo(); -->new Foo() : Foo -+>new Foo() : any - >Foo : typeof Foo - - === /importer-cts.cts === -@@= skipped -13, +13 lines =@@ - >Foo : typeof Foo - - new Foo(); -->new Foo() : Foo -+>new Foo() : any - >Foo : typeof Foo - - import Foo2 from "./exporter.mjs"; -->Foo2 : typeof Foo -+>Foo2 : typeof Foo2 - - new Foo2(); -->new Foo2() : Foo -->Foo2 : typeof Foo -+>new Foo2() : Foo2 -+>Foo2 : typeof Foo2 - - import * as Foo3 from "./exporter.mjs"; - >Foo3 : typeof Foo - - new Foo3(); -->new Foo3() : Foo -+>new Foo3() : any - >Foo3 : typeof Foo - - import { Oops } from "./exporter.mjs"; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports2(esmoduleinterop=false).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports2(esmoduleinterop=false).errors.txt.diff deleted file mode 100644 index c7302644be..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports2(esmoduleinterop=false).errors.txt.diff +++ /dev/null @@ -1,49 +0,0 @@ ---- old.esmModuleExports2(esmoduleinterop=false).errors.txt -+++ new.esmModuleExports2(esmoduleinterop=false).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - /importer-cjs.cjs(2,5): error TS2351: This expression is not constructable. -- Type 'String' has no construct signatures. -+ Type 'typeof import("/exporter")' has no construct signatures. - /importer-cts.cts(2,5): error TS2351: This expression is not constructable. -- Type 'String' has no construct signatures. --/importer-cts.cts(4,8): error TS1259: Module '"/exporter"' can only be default-imported using the 'esModuleInterop' flag -+ Type 'typeof import("/exporter")' has no construct signatures. - /importer-cts.cts(8,5): error TS2351: This expression is not constructable. -- Type 'String' has no construct signatures. -+ Type 'typeof import("/exporter")' has no construct signatures. - /importer-cts.cts(10,10): error TS2614: Module '"./exporter.mjs"' has no exported member 'Oops'. Did you mean to use 'import Oops from "./exporter.mjs"' instead? - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== /importer-cjs.cjs (1 errors) ==== - const Foo = require("./exporter.mjs"); - new Foo(); - ~~~ - !!! error TS2351: This expression is not constructable. --!!! error TS2351: Type 'String' has no construct signatures. -+!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. - --==== /importer-cts.cts (4 errors) ==== -+==== /importer-cts.cts (3 errors) ==== - import Foo = require("./exporter.mjs"); - new Foo(); - ~~~ - !!! error TS2351: This expression is not constructable. --!!! error TS2351: Type 'String' has no construct signatures. -+!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. - - import Foo2 from "./exporter.mjs"; -- ~~~~ --!!! error TS1259: Module '"/exporter"' can only be default-imported using the 'esModuleInterop' flag - new Foo2(); - - import * as Foo3 from "./exporter.mjs"; - new Foo3(); - ~~~~ - !!! error TS2351: This expression is not constructable. --!!! error TS2351: Type 'String' has no construct signatures. -+!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. - - import { Oops } from "./exporter.mjs"; - ~~~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports2(esmoduleinterop=false).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports2(esmoduleinterop=false).types.diff deleted file mode 100644 index 36b987f2d2..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports2(esmoduleinterop=false).types.diff +++ /dev/null @@ -1,49 +0,0 @@ ---- old.esmModuleExports2(esmoduleinterop=false).types -+++ new.esmModuleExports2(esmoduleinterop=false).types -@@= skipped -1, +1 lines =@@ - - === /importer-cjs.cjs === - const Foo = require("./exporter.mjs"); -->Foo : "oops" -->require("./exporter.mjs") : typeof import("/exporter", { with: { "resolution-mode": "import" } }) -+>Foo : typeof Foo -+>require("./exporter.mjs") : typeof Foo - >require : any - >"./exporter.mjs" : "./exporter.mjs" - - new Foo(); - >new Foo() : any -->Foo : "oops" -+>Foo : typeof Foo - - === /importer-cts.cts === - import Foo = require("./exporter.mjs"); -->Foo : "oops" -+>Foo : typeof Foo - - new Foo(); - >new Foo() : any -->Foo : "oops" -+>Foo : typeof Foo - - import Foo2 from "./exporter.mjs"; -->Foo2 : any -+>Foo2 : typeof Foo2 - - new Foo2(); -->new Foo2() : any -->Foo2 : any -+>new Foo2() : Foo2 -+>Foo2 : typeof Foo2 - - import * as Foo3 from "./exporter.mjs"; -->Foo3 : "oops" -+>Foo3 : typeof Foo - - new Foo3(); - >new Foo3() : any -->Foo3 : "oops" -+>Foo3 : typeof Foo - - import { Oops } from "./exporter.mjs"; - >Oops : any \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports2(esmoduleinterop=true).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports2(esmoduleinterop=true).errors.txt.diff deleted file mode 100644 index 78bdac8da5..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports2(esmoduleinterop=true).errors.txt.diff +++ /dev/null @@ -1,51 +0,0 @@ ---- old.esmModuleExports2(esmoduleinterop=true).errors.txt -+++ new.esmModuleExports2(esmoduleinterop=true).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - /importer-cjs.cjs(2,5): error TS2351: This expression is not constructable. -- Type 'String' has no construct signatures. -+ Type 'typeof import("/exporter")' has no construct signatures. - /importer-cts.cts(2,5): error TS2351: This expression is not constructable. -- Type 'String' has no construct signatures. --/importer-cts.cts(5,5): error TS2351: This expression is not constructable. -- Type 'String' has no construct signatures. -+ Type 'typeof import("/exporter")' has no construct signatures. - /importer-cts.cts(8,5): error TS2351: This expression is not constructable. -- Type 'String' has no construct signatures. -+ Type 'typeof import("/exporter")' has no construct signatures. - /importer-cts.cts(10,10): error TS2614: Module '"./exporter.mjs"' has no exported member 'Oops'. Did you mean to use 'import Oops from "./exporter.mjs"' instead? - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== /importer-cjs.cjs (1 errors) ==== - const Foo = require("./exporter.mjs"); - new Foo(); - ~~~ - !!! error TS2351: This expression is not constructable. --!!! error TS2351: Type 'String' has no construct signatures. -+!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. - --==== /importer-cts.cts (4 errors) ==== -+==== /importer-cts.cts (3 errors) ==== - import Foo = require("./exporter.mjs"); - new Foo(); - ~~~ - !!! error TS2351: This expression is not constructable. --!!! error TS2351: Type 'String' has no construct signatures. -+!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. - - import Foo2 from "./exporter.mjs"; - new Foo2(); -- ~~~~ --!!! error TS2351: This expression is not constructable. --!!! error TS2351: Type 'String' has no construct signatures. - - import * as Foo3 from "./exporter.mjs"; - new Foo3(); - ~~~~ - !!! error TS2351: This expression is not constructable. --!!! error TS2351: Type 'String' has no construct signatures. -+!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. - - import { Oops } from "./exporter.mjs"; - ~~~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports2(esmoduleinterop=true).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports2(esmoduleinterop=true).types.diff deleted file mode 100644 index be30f1ca4a..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports2(esmoduleinterop=true).types.diff +++ /dev/null @@ -1,49 +0,0 @@ ---- old.esmModuleExports2(esmoduleinterop=true).types -+++ new.esmModuleExports2(esmoduleinterop=true).types -@@= skipped -1, +1 lines =@@ - - === /importer-cjs.cjs === - const Foo = require("./exporter.mjs"); -->Foo : "oops" -->require("./exporter.mjs") : typeof import("/exporter", { with: { "resolution-mode": "import" } }) -+>Foo : typeof Foo -+>require("./exporter.mjs") : typeof Foo - >require : any - >"./exporter.mjs" : "./exporter.mjs" - - new Foo(); - >new Foo() : any -->Foo : "oops" -+>Foo : typeof Foo - - === /importer-cts.cts === - import Foo = require("./exporter.mjs"); -->Foo : "oops" -+>Foo : typeof Foo - - new Foo(); - >new Foo() : any -->Foo : "oops" -+>Foo : typeof Foo - - import Foo2 from "./exporter.mjs"; -->Foo2 : "oops" -+>Foo2 : typeof Foo2 - - new Foo2(); -->new Foo2() : any -->Foo2 : "oops" -+>new Foo2() : Foo2 -+>Foo2 : typeof Foo2 - - import * as Foo3 from "./exporter.mjs"; -->Foo3 : "oops" -+>Foo3 : typeof Foo - - new Foo3(); - >new Foo3() : any -->Foo3 : "oops" -+>Foo3 : typeof Foo - - import { Oops } from "./exporter.mjs"; - >Oops : any \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports3.errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports3.errors.txt.diff deleted file mode 100644 index c720e9cad5..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports3.errors.txt.diff +++ /dev/null @@ -1,53 +0,0 @@ ---- old.esmModuleExports3.errors.txt -+++ new.esmModuleExports3.errors.txt -@@= skipped -0, +0 lines =@@ --/importer-cjs.cjs(2,5): error TS1362: 'Foo' cannot be used as a value because it was exported using 'export type'. --/importer-cts.cts(2,5): error TS1362: 'Foo' cannot be used as a value because it was exported using 'export type'. --/importer-cts.cts(5,5): error TS1362: 'Foo2' cannot be used as a value because it was exported using 'export type'. --/importer-cts.cts(8,5): error TS1362: 'Foo3' cannot be used as a value because it was exported using 'export type'. -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+/importer-cjs.cjs(2,5): error TS2351: This expression is not constructable. -+ Type 'typeof import("/exporter")' has no construct signatures. -+/importer-cts.cts(2,5): error TS2351: This expression is not constructable. -+ Type 'typeof import("/exporter")' has no construct signatures. -+/importer-cts.cts(8,5): error TS2351: This expression is not constructable. -+ Type 'typeof import("/exporter")' has no construct signatures. - /importer-cts.cts(10,10): error TS2614: Module '"./exporter.mjs"' has no exported member 'Oops'. Did you mean to use 'import Oops from "./exporter.mjs"' instead? - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== /importer-cjs.cjs (1 errors) ==== - const Foo = require("./exporter.mjs"); - new Foo(); - ~~~ --!!! error TS1362: 'Foo' cannot be used as a value because it was exported using 'export type'. --!!! related TS1377 /exporter.mts:2:15: 'Foo' was exported here. -+!!! error TS2351: This expression is not constructable. -+!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. - --==== /importer-cts.cts (4 errors) ==== -+==== /importer-cts.cts (3 errors) ==== - import Foo = require("./exporter.mjs"); - new Foo(); - ~~~ --!!! error TS1362: 'Foo' cannot be used as a value because it was exported using 'export type'. --!!! related TS1377 /exporter.mts:2:15: 'Foo' was exported here. -+!!! error TS2351: This expression is not constructable. -+!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. - - import Foo2 from "./exporter.mjs"; - new Foo2(); -- ~~~~ --!!! error TS1362: 'Foo2' cannot be used as a value because it was exported using 'export type'. --!!! related TS1377 /exporter.mts:2:15: 'Foo2' was exported here. - - import * as Foo3 from "./exporter.mjs"; - new Foo3(); - ~~~~ --!!! error TS1362: 'Foo3' cannot be used as a value because it was exported using 'export type'. --!!! related TS1377 /exporter.mts:2:15: 'Foo3' was exported here. -+!!! error TS2351: This expression is not constructable. -+!!! error TS2351: Type 'typeof import("/exporter")' has no construct signatures. - - import { Oops } from "./exporter.mjs"; - ~~~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports3.types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports3.types.diff deleted file mode 100644 index 8a8247ef98..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/esmModuleExports3.types.diff +++ /dev/null @@ -1,44 +0,0 @@ ---- old.esmModuleExports3.types -+++ new.esmModuleExports3.types -@@= skipped -2, +2 lines =@@ - === /importer-cjs.cjs === - const Foo = require("./exporter.mjs"); - >Foo : typeof Foo -->require("./exporter.mjs") : typeof import("/exporter", { with: { "resolution-mode": "import" } }) -+>require("./exporter.mjs") : typeof Foo - >require : any - >"./exporter.mjs" : "./exporter.mjs" - - new Foo(); -->new Foo() : Foo -+>new Foo() : any - >Foo : typeof Foo - - === /importer-cts.cts === -@@= skipped -13, +13 lines =@@ - >Foo : typeof Foo - - new Foo(); -->new Foo() : Foo -+>new Foo() : any - >Foo : typeof Foo - - import Foo2 from "./exporter.mjs"; -->Foo2 : typeof Foo -+>Foo2 : typeof Foo2 - - new Foo2(); -->new Foo2() : Foo -->Foo2 : typeof Foo -+>new Foo2() : Foo2 -+>Foo2 : typeof Foo2 - - import * as Foo3 from "./exporter.mjs"; - >Foo3 : typeof Foo - - new Foo3(); -->new Foo3() : Foo -+>new Foo3() : any - >Foo3 : typeof Foo - - import { Oops } from "./exporter.mjs"; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeAllowJsPackageSelfName(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeAllowJsPackageSelfName(module=node20).errors.txt.diff index 806389ea07..7b97f306cc 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeAllowJsPackageSelfName(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeAllowJsPackageSelfName(module=node20).errors.txt.diff @@ -1,16 +1,12 @@ --- old.nodeAllowJsPackageSelfName(module=node20).errors.txt +++ new.nodeAllowJsPackageSelfName(module=node20).errors.txt @@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -- -- +index.cjs(2,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. +index.js(2,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. +index.mjs(2,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. + + !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.js (0 errors) ==== - // esm format file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=node16).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=node16).types.diff deleted file mode 100644 index 5a104315ec..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=node16).types.diff +++ /dev/null @@ -1,128 +0,0 @@ ---- old.nodeModulesAllowJs1(module=node16).types -+++ new.nodeModulesAllowJs1(module=node16).types -@@= skipped -251, +251 lines =@@ - >m25 : typeof m1 - - import m26 = require("./subfolder"); -->m26 : typeof m26 -+>m26 : typeof m4 - - import m27 = require("./subfolder/"); -->m27 : typeof m26 -+>m27 : typeof m4 - - import m28 = require("./subfolder/index"); -->m28 : typeof m26 -+>m28 : typeof m4 - - import m29 = require("./subfolder2"); -->m29 : typeof m29 -+>m29 : typeof m7 - - import m30 = require("./subfolder2/"); -->m30 : typeof m29 -+>m30 : typeof m7 - - import m31 = require("./subfolder2/index"); -->m31 : typeof m29 -+>m31 : typeof m7 - - import m32 = require("./subfolder2/another"); - >m32 : typeof m10 -@@= skipped -36, +36 lines =@@ - - void m26; - >void m26 : undefined -->m26 : typeof m26 -+>m26 : typeof m4 - - void m27; - >void m27 : undefined -->m27 : typeof m26 -+>m27 : typeof m4 - - void m28; - >void m28 : undefined -->m28 : typeof m26 -+>m28 : typeof m4 - - void m29; - >void m29 : undefined -->m29 : typeof m29 -+>m29 : typeof m7 - - void m30; - >void m30 : undefined -->m30 : typeof m29 -+>m30 : typeof m7 - - void m31; - >void m31 : undefined -->m31 : typeof m29 -+>m31 : typeof m7 - - void m32; - >void m32 : undefined -@@= skipped -575, +575 lines =@@ - >m25 : typeof m1 - - import m26 = require("./subfolder"); -->m26 : typeof m26 -+>m26 : typeof m4 - - import m27 = require("./subfolder/"); -->m27 : typeof m26 -+>m27 : typeof m4 - - import m28 = require("./subfolder/index"); -->m28 : typeof m26 -+>m28 : typeof m4 - - import m29 = require("./subfolder2"); -->m29 : typeof m29 -+>m29 : typeof m7 - - import m30 = require("./subfolder2/"); -->m30 : typeof m29 -+>m30 : typeof m7 - - import m31 = require("./subfolder2/index"); -->m31 : typeof m29 -+>m31 : typeof m7 - - import m32 = require("./subfolder2/another"); - >m32 : typeof m10 -@@= skipped -36, +36 lines =@@ - - void m26; - >void m26 : undefined -->m26 : typeof m26 -+>m26 : typeof m4 - - void m27; - >void m27 : undefined -->m27 : typeof m26 -+>m27 : typeof m4 - - void m28; - >void m28 : undefined -->m28 : typeof m26 -+>m28 : typeof m4 - - void m29; - >void m29 : undefined -->m29 : typeof m29 -+>m29 : typeof m7 - - void m30; - >void m30 : undefined -->m30 : typeof m29 -+>m30 : typeof m7 - - void m31; - >void m31 : undefined -->m31 : typeof m29 -+>m31 : typeof m7 - - void m32; - >void m32 : undefined \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=node18).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=node18).types.diff deleted file mode 100644 index 53da4828c6..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=node18).types.diff +++ /dev/null @@ -1,128 +0,0 @@ ---- old.nodeModulesAllowJs1(module=node18).types -+++ new.nodeModulesAllowJs1(module=node18).types -@@= skipped -251, +251 lines =@@ - >m25 : typeof m1 - - import m26 = require("./subfolder"); -->m26 : typeof m26 -+>m26 : typeof m4 - - import m27 = require("./subfolder/"); -->m27 : typeof m26 -+>m27 : typeof m4 - - import m28 = require("./subfolder/index"); -->m28 : typeof m26 -+>m28 : typeof m4 - - import m29 = require("./subfolder2"); -->m29 : typeof m29 -+>m29 : typeof m7 - - import m30 = require("./subfolder2/"); -->m30 : typeof m29 -+>m30 : typeof m7 - - import m31 = require("./subfolder2/index"); -->m31 : typeof m29 -+>m31 : typeof m7 - - import m32 = require("./subfolder2/another"); - >m32 : typeof m10 -@@= skipped -36, +36 lines =@@ - - void m26; - >void m26 : undefined -->m26 : typeof m26 -+>m26 : typeof m4 - - void m27; - >void m27 : undefined -->m27 : typeof m26 -+>m27 : typeof m4 - - void m28; - >void m28 : undefined -->m28 : typeof m26 -+>m28 : typeof m4 - - void m29; - >void m29 : undefined -->m29 : typeof m29 -+>m29 : typeof m7 - - void m30; - >void m30 : undefined -->m30 : typeof m29 -+>m30 : typeof m7 - - void m31; - >void m31 : undefined -->m31 : typeof m29 -+>m31 : typeof m7 - - void m32; - >void m32 : undefined -@@= skipped -575, +575 lines =@@ - >m25 : typeof m1 - - import m26 = require("./subfolder"); -->m26 : typeof m26 -+>m26 : typeof m4 - - import m27 = require("./subfolder/"); -->m27 : typeof m26 -+>m27 : typeof m4 - - import m28 = require("./subfolder/index"); -->m28 : typeof m26 -+>m28 : typeof m4 - - import m29 = require("./subfolder2"); -->m29 : typeof m29 -+>m29 : typeof m7 - - import m30 = require("./subfolder2/"); -->m30 : typeof m29 -+>m30 : typeof m7 - - import m31 = require("./subfolder2/index"); -->m31 : typeof m29 -+>m31 : typeof m7 - - import m32 = require("./subfolder2/another"); - >m32 : typeof m10 -@@= skipped -36, +36 lines =@@ - - void m26; - >void m26 : undefined -->m26 : typeof m26 -+>m26 : typeof m4 - - void m27; - >void m27 : undefined -->m27 : typeof m26 -+>m27 : typeof m4 - - void m28; - >void m28 : undefined -->m28 : typeof m26 -+>m28 : typeof m4 - - void m29; - >void m29 : undefined -->m29 : typeof m29 -+>m29 : typeof m7 - - void m30; - >void m30 : undefined -->m30 : typeof m29 -+>m30 : typeof m7 - - void m31; - >void m31 : undefined -->m31 : typeof m29 -+>m31 : typeof m7 - - void m32; - >void m32 : undefined \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=node20).errors.txt.diff deleted file mode 100644 index a9f0e9934d..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=node20).errors.txt.diff +++ /dev/null @@ -1,398 +0,0 @@ ---- old.nodeModulesAllowJs1(module=node20).errors.txt -+++ new.nodeModulesAllowJs1(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+error TS2468: Cannot find global value 'Promise'. - index.cjs(51,1): error TS8002: 'import ... =' can only be used in TypeScript files. - index.cjs(52,1): error TS8002: 'import ... =' can only be used in TypeScript files. - index.cjs(53,1): error TS8002: 'import ... =' can only be used in TypeScript files. -@@= skipped -8, +10 lines =@@ - index.cjs(59,1): error TS8002: 'import ... =' can only be used in TypeScript files. - index.cjs(60,1): error TS8002: 'import ... =' can only be used in TypeScript files. - index.cjs(61,1): error TS8002: 'import ... =' can only be used in TypeScript files. --index.cjs(75,21): error TS2307: Cannot find module './' or its corresponding type declarations. --index.cjs(76,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? --index.cjs(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.cjs(78,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.cjs(79,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? --index.cjs(80,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.cjs(81,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.cjs(82,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? --index.cjs(83,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.cjs(84,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.cjs(85,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? --index.js(14,22): error TS2307: Cannot find module './' or its corresponding type declarations. --index.js(15,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? --index.js(16,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.js(17,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.js(18,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? --index.js(19,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.js(20,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.js(21,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? --index.js(22,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.js(23,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.js(24,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -+index.cjs(75,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cjs(76,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cjs(77,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cjs(78,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cjs(79,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cjs(80,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cjs(81,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cjs(82,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cjs(83,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cjs(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.cjs(85,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - index.js(50,1): error TS8002: 'import ... =' can only be used in TypeScript files. - index.js(51,1): error TS8002: 'import ... =' can only be used in TypeScript files. - index.js(52,1): error TS8002: 'import ... =' can only be used in TypeScript files. -@@= skipped -33, +22 lines =@@ - index.js(58,1): error TS8002: 'import ... =' can only be used in TypeScript files. - index.js(59,1): error TS8002: 'import ... =' can only be used in TypeScript files. - index.js(60,1): error TS8002: 'import ... =' can only be used in TypeScript files. --index.js(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. --index.js(75,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? --index.js(76,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.js(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.js(78,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? --index.js(79,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.js(80,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.js(81,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? --index.js(82,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.js(83,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.js(84,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? --index.mjs(14,22): error TS2307: Cannot find module './' or its corresponding type declarations. --index.mjs(15,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? --index.mjs(16,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mjs(17,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mjs(18,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? --index.mjs(19,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mjs(20,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mjs(21,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? --index.mjs(22,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mjs(23,22): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mjs(24,22): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -+index.js(74,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.js(75,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.js(76,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.js(77,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.js(78,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.js(79,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.js(80,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.js(81,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.js(82,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.js(83,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.js(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - index.mjs(50,1): error TS8002: 'import ... =' can only be used in TypeScript files. - index.mjs(51,1): error TS8002: 'import ... =' can only be used in TypeScript files. - index.mjs(52,1): error TS8002: 'import ... =' can only be used in TypeScript files. -@@= skipped -33, +22 lines =@@ - index.mjs(58,1): error TS8002: 'import ... =' can only be used in TypeScript files. - index.mjs(59,1): error TS8002: 'import ... =' can only be used in TypeScript files. - index.mjs(60,1): error TS8002: 'import ... =' can only be used in TypeScript files. --index.mjs(74,21): error TS2307: Cannot find module './' or its corresponding type declarations. --index.mjs(75,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? --index.mjs(76,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mjs(77,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mjs(78,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? --index.mjs(79,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mjs(80,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mjs(81,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? --index.mjs(82,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mjs(83,21): error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. --index.mjs(84,21): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -- -- -+index.mjs(74,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mjs(75,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mjs(76,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mjs(77,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mjs(78,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mjs(79,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mjs(80,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mjs(81,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mjs(82,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mjs(83,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.mjs(84,14): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+!!! error TS2468: Cannot find global value 'Promise'. - ==== subfolder/index.js (0 errors) ==== - // cjs format file - const x = 1; -@@= skipped -49, +51 lines =@@ - // esm format file - const x = 1; - export {x}; --==== index.js (33 errors) ==== -+==== index.js (22 errors) ==== - import * as m1 from "./index.js"; - import * as m2 from "./index.mjs"; - import * as m3 from "./index.cjs"; -@@= skipped -15, +15 lines =@@ - import * as m12 from "./subfolder2/another/index.cjs"; - // The next ones shouldn't all work - esm format files have no index resolution or extension resolution - import * as m13 from "./"; -- ~~~~ --!!! error TS2307: Cannot find module './' or its corresponding type declarations. - import * as m14 from "./index"; -- ~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? - import * as m15 from "./subfolder"; -- ~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m16 from "./subfolder/"; -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m17 from "./subfolder/index"; -- ~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? - import * as m18 from "./subfolder2"; -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m19 from "./subfolder2/"; -- ~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m20 from "./subfolder2/index"; -- ~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? - import * as m21 from "./subfolder2/another"; -- ~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m22 from "./subfolder2/another/"; -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m23 from "./subfolder2/another/index"; -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? - void m1; - void m2; - void m3; -@@= skipped -104, +82 lines =@@ - - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); -- ~~~~ --!!! error TS2307: Cannot find module './' or its corresponding type declarations. -+ ~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m36 = import("./index"); -- ~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m37 = import("./subfolder"); -- ~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m38 = import("./subfolder/"); -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m39 = import("./subfolder/index"); -- ~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m40 = import("./subfolder2"); -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m41 = import("./subfolder2/"); -- ~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m42 = import("./subfolder2/index"); -- ~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m43 = import("./subfolder2/another"); -- ~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m44 = import("./subfolder2/another/"); -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m45 = import("./subfolder2/another/index"); -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - // esm format file - const x = 1; - export {x}; -@@= skipped -133, +133 lines =@@ - - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); -- ~~~~ --!!! error TS2307: Cannot find module './' or its corresponding type declarations. -+ ~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m36 = import("./index"); -- ~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m37 = import("./subfolder"); -- ~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m38 = import("./subfolder/"); -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m39 = import("./subfolder/index"); -- ~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m40 = import("./subfolder2"); -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m41 = import("./subfolder2/"); -- ~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m42 = import("./subfolder2/index"); -- ~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m43 = import("./subfolder2/another"); -- ~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m44 = import("./subfolder2/another/"); -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m45 = import("./subfolder2/another/index"); -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - // cjs format file - const x = 1; - export {x}; --==== index.mjs (33 errors) ==== -+==== index.mjs (22 errors) ==== - import * as m1 from "./index.js"; - import * as m2 from "./index.mjs"; - import * as m3 from "./index.cjs"; -@@= skipped -50, +50 lines =@@ - import * as m12 from "./subfolder2/another/index.cjs"; - // The next ones should all fail - esm format files have no index resolution or extension resolution - import * as m13 from "./"; -- ~~~~ --!!! error TS2307: Cannot find module './' or its corresponding type declarations. - import * as m14 from "./index"; -- ~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? - import * as m15 from "./subfolder"; -- ~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m16 from "./subfolder/"; -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m17 from "./subfolder/index"; -- ~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? - import * as m18 from "./subfolder2"; -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m19 from "./subfolder2/"; -- ~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m20 from "./subfolder2/index"; -- ~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? - import * as m21 from "./subfolder2/another"; -- ~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m22 from "./subfolder2/another/"; -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. - import * as m23 from "./subfolder2/another/index"; -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? - void m1; - void m2; - void m3; -@@= skipped -104, +82 lines =@@ - - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); -- ~~~~ --!!! error TS2307: Cannot find module './' or its corresponding type declarations. -+ ~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m36 = import("./index"); -- ~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './index.mjs'? -+ ~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m37 = import("./subfolder"); -- ~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m38 = import("./subfolder/"); -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m39 = import("./subfolder/index"); -- ~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m40 = import("./subfolder2"); -- ~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m41 = import("./subfolder2/"); -- ~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m42 = import("./subfolder2/index"); -- ~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m43 = import("./subfolder2/another"); -- ~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m44 = import("./subfolder2/another/"); -- ~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const _m45 = import("./subfolder2/another/index"); -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --!!! error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './subfolder2/another/index.mjs'? -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - - // esm format file - const x = 1; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=node20).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=node20).types.diff deleted file mode 100644 index 9e089d1819..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=node20).types.diff +++ /dev/null @@ -1,587 +0,0 @@ ---- old.nodeModulesAllowJs1(module=node20).types -+++ new.nodeModulesAllowJs1(module=node20).types -@@= skipped -119, +119 lines =@@ - - // The next ones shouldn't all work - esm format files have no index resolution or extension resolution - import * as m13 from "./"; -->m13 : any -+>m13 : typeof m1 - - import * as m14 from "./index"; -->m14 : any -+>m14 : typeof m1 - - import * as m15 from "./subfolder"; -->m15 : any -+>m15 : typeof m4 - - import * as m16 from "./subfolder/"; -->m16 : any -+>m16 : typeof m4 - - import * as m17 from "./subfolder/index"; -->m17 : any -+>m17 : typeof m4 - - import * as m18 from "./subfolder2"; -->m18 : any -+>m18 : typeof m7 - - import * as m19 from "./subfolder2/"; -->m19 : any -+>m19 : typeof m7 - - import * as m20 from "./subfolder2/index"; -->m20 : any -+>m20 : typeof m7 - - import * as m21 from "./subfolder2/another"; -->m21 : any -+>m21 : typeof m10 - - import * as m22 from "./subfolder2/another/"; -->m22 : any -+>m22 : typeof m10 - - import * as m23 from "./subfolder2/another/index"; -->m23 : any -+>m23 : typeof m10 - - void m1; - >void m1 : undefined -@@= skipped -82, +82 lines =@@ - - void m13; - >void m13 : undefined -->m13 : any -+>m13 : typeof m1 - - void m14; - >void m14 : undefined -->m14 : any -+>m14 : typeof m1 - - void m15; - >void m15 : undefined -->m15 : any -+>m15 : typeof m4 - - void m16; - >void m16 : undefined -->m16 : any -+>m16 : typeof m4 - - void m17; - >void m17 : undefined -->m17 : any -+>m17 : typeof m4 - - void m18; - >void m18 : undefined -->m18 : any -+>m18 : typeof m7 - - void m19; - >void m19 : undefined -->m19 : any -+>m19 : typeof m7 - - void m20; - >void m20 : undefined -->m20 : any -+>m20 : typeof m7 - - void m21; - >void m21 : undefined -->m21 : any -+>m21 : typeof m10 - - void m22; - >void m22 : undefined -->m22 : any -+>m22 : typeof m10 - - void m23; - >void m23 : undefined -->m23 : any -+>m23 : typeof m10 - - // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) - import m24 = require("./"); -@@= skipped -50, +50 lines =@@ - >m25 : typeof m1 - - import m26 = require("./subfolder"); -->m26 : typeof m26 -+>m26 : typeof m4 - - import m27 = require("./subfolder/"); -->m27 : typeof m26 -+>m27 : typeof m4 - - import m28 = require("./subfolder/index"); -->m28 : typeof m26 -+>m28 : typeof m4 - - import m29 = require("./subfolder2"); -->m29 : typeof m29 -+>m29 : typeof m7 - - import m30 = require("./subfolder2/"); -->m30 : typeof m29 -+>m30 : typeof m7 - - import m31 = require("./subfolder2/index"); -->m31 : typeof m29 -+>m31 : typeof m7 - - import m32 = require("./subfolder2/another"); - >m32 : typeof m10 -@@= skipped -36, +36 lines =@@ - - void m26; - >void m26 : undefined -->m26 : typeof m26 -+>m26 : typeof m4 - - void m27; - >void m27 : undefined -->m27 : typeof m26 -+>m27 : typeof m4 - - void m28; - >void m28 : undefined -->m28 : typeof m26 -+>m28 : typeof m4 - - void m29; - >void m29 : undefined -->m29 : typeof m29 -+>m29 : typeof m7 - - void m30; - >void m30 : undefined -->m30 : typeof m29 -+>m30 : typeof m7 - - void m31; - >void m31 : undefined -->m31 : typeof m29 -+>m31 : typeof m7 - - void m32; - >void m32 : undefined -@@= skipped -36, +36 lines =@@ - - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); -->_m35 : Promise -->import("./") : Promise -+>_m35 : Promise<{ x: 1; default: typeof m1; }> -+>import("./") : Promise<{ x: 1; default: typeof m1; }> - >"./" : "./" - - const _m36 = import("./index"); -->_m36 : Promise -->import("./index") : Promise -+>_m36 : Promise<{ x: 1; default: typeof m1; }> -+>import("./index") : Promise<{ x: 1; default: typeof m1; }> - >"./index" : "./index" - - const _m37 = import("./subfolder"); -->_m37 : Promise -->import("./subfolder") : Promise -+>_m37 : Promise<{ x: 1; default: typeof m4; }> -+>import("./subfolder") : Promise<{ x: 1; default: typeof m4; }> - >"./subfolder" : "./subfolder" - - const _m38 = import("./subfolder/"); -->_m38 : Promise -->import("./subfolder/") : Promise -+>_m38 : Promise<{ x: 1; default: typeof m4; }> -+>import("./subfolder/") : Promise<{ x: 1; default: typeof m4; }> - >"./subfolder/" : "./subfolder/" - - const _m39 = import("./subfolder/index"); -->_m39 : Promise -->import("./subfolder/index") : Promise -+>_m39 : Promise<{ x: 1; default: typeof m4; }> -+>import("./subfolder/index") : Promise<{ x: 1; default: typeof m4; }> - >"./subfolder/index" : "./subfolder/index" - - const _m40 = import("./subfolder2"); -->_m40 : Promise -->import("./subfolder2") : Promise -+>_m40 : Promise<{ x: 1; default: typeof m7; }> -+>import("./subfolder2") : Promise<{ x: 1; default: typeof m7; }> - >"./subfolder2" : "./subfolder2" - - const _m41 = import("./subfolder2/"); -->_m41 : Promise -->import("./subfolder2/") : Promise -+>_m41 : Promise<{ x: 1; default: typeof m7; }> -+>import("./subfolder2/") : Promise<{ x: 1; default: typeof m7; }> - >"./subfolder2/" : "./subfolder2/" - - const _m42 = import("./subfolder2/index"); -->_m42 : Promise -->import("./subfolder2/index") : Promise -+>_m42 : Promise<{ x: 1; default: typeof m7; }> -+>import("./subfolder2/index") : Promise<{ x: 1; default: typeof m7; }> - >"./subfolder2/index" : "./subfolder2/index" - - const _m43 = import("./subfolder2/another"); -->_m43 : Promise -->import("./subfolder2/another") : Promise -+>_m43 : Promise<{ x: 1; default: typeof m10; }> -+>import("./subfolder2/another") : Promise<{ x: 1; default: typeof m10; }> - >"./subfolder2/another" : "./subfolder2/another" - - const _m44 = import("./subfolder2/another/"); -->_m44 : Promise -->import("./subfolder2/another/") : Promise -+>_m44 : Promise<{ x: 1; default: typeof m10; }> -+>import("./subfolder2/another/") : Promise<{ x: 1; default: typeof m10; }> - >"./subfolder2/another/" : "./subfolder2/another/" - - const _m45 = import("./subfolder2/another/index"); -->_m45 : Promise -->import("./subfolder2/another/index") : Promise -+>_m45 : Promise<{ x: 1; default: typeof m10; }> -+>import("./subfolder2/another/index") : Promise<{ x: 1; default: typeof m10; }> - >"./subfolder2/another/index" : "./subfolder2/another/index" - - // esm format file -@@= skipped -306, +306 lines =@@ - - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); -->_m35 : Promise -->import("./") : Promise -+>_m35 : Promise<{ x: 1; default: typeof m1; }> -+>import("./") : Promise<{ x: 1; default: typeof m1; }> - >"./" : "./" - - const _m36 = import("./index"); -->_m36 : Promise -->import("./index") : Promise -+>_m36 : Promise<{ x: 1; default: typeof m1; }> -+>import("./index") : Promise<{ x: 1; default: typeof m1; }> - >"./index" : "./index" - - const _m37 = import("./subfolder"); -->_m37 : Promise -->import("./subfolder") : Promise -+>_m37 : Promise<{ x: 1; default: typeof m4; }> -+>import("./subfolder") : Promise<{ x: 1; default: typeof m4; }> - >"./subfolder" : "./subfolder" - - const _m38 = import("./subfolder/"); -->_m38 : Promise -->import("./subfolder/") : Promise -+>_m38 : Promise<{ x: 1; default: typeof m4; }> -+>import("./subfolder/") : Promise<{ x: 1; default: typeof m4; }> - >"./subfolder/" : "./subfolder/" - - const _m39 = import("./subfolder/index"); -->_m39 : Promise -->import("./subfolder/index") : Promise -+>_m39 : Promise<{ x: 1; default: typeof m4; }> -+>import("./subfolder/index") : Promise<{ x: 1; default: typeof m4; }> - >"./subfolder/index" : "./subfolder/index" - - const _m40 = import("./subfolder2"); -->_m40 : Promise -->import("./subfolder2") : Promise -+>_m40 : Promise<{ x: 1; default: typeof m7; }> -+>import("./subfolder2") : Promise<{ x: 1; default: typeof m7; }> - >"./subfolder2" : "./subfolder2" - - const _m41 = import("./subfolder2/"); -->_m41 : Promise -->import("./subfolder2/") : Promise -+>_m41 : Promise<{ x: 1; default: typeof m7; }> -+>import("./subfolder2/") : Promise<{ x: 1; default: typeof m7; }> - >"./subfolder2/" : "./subfolder2/" - - const _m42 = import("./subfolder2/index"); -->_m42 : Promise -->import("./subfolder2/index") : Promise -+>_m42 : Promise<{ x: 1; default: typeof m7; }> -+>import("./subfolder2/index") : Promise<{ x: 1; default: typeof m7; }> - >"./subfolder2/index" : "./subfolder2/index" - - const _m43 = import("./subfolder2/another"); -->_m43 : Promise -->import("./subfolder2/another") : Promise -+>_m43 : Promise<{ x: 1; default: typeof m10; }> -+>import("./subfolder2/another") : Promise<{ x: 1; default: typeof m10; }> - >"./subfolder2/another" : "./subfolder2/another" - - const _m44 = import("./subfolder2/another/"); -->_m44 : Promise -->import("./subfolder2/another/") : Promise -+>_m44 : Promise<{ x: 1; default: typeof m10; }> -+>import("./subfolder2/another/") : Promise<{ x: 1; default: typeof m10; }> - >"./subfolder2/another/" : "./subfolder2/another/" - - const _m45 = import("./subfolder2/another/index"); -->_m45 : Promise -->import("./subfolder2/another/index") : Promise -+>_m45 : Promise<{ x: 1; default: typeof m10; }> -+>import("./subfolder2/another/index") : Promise<{ x: 1; default: typeof m10; }> - >"./subfolder2/another/index" : "./subfolder2/another/index" - - // cjs format file -@@= skipped -101, +101 lines =@@ - - // The next ones should all fail - esm format files have no index resolution or extension resolution - import * as m13 from "./"; -->m13 : any -+>m13 : typeof m1 - - import * as m14 from "./index"; -->m14 : any -+>m14 : typeof m1 - - import * as m15 from "./subfolder"; -->m15 : any -+>m15 : typeof m4 - - import * as m16 from "./subfolder/"; -->m16 : any -+>m16 : typeof m4 - - import * as m17 from "./subfolder/index"; -->m17 : any -+>m17 : typeof m4 - - import * as m18 from "./subfolder2"; -->m18 : any -+>m18 : typeof m7 - - import * as m19 from "./subfolder2/"; -->m19 : any -+>m19 : typeof m7 - - import * as m20 from "./subfolder2/index"; -->m20 : any -+>m20 : typeof m7 - - import * as m21 from "./subfolder2/another"; -->m21 : any -+>m21 : typeof m10 - - import * as m22 from "./subfolder2/another/"; -->m22 : any -+>m22 : typeof m10 - - import * as m23 from "./subfolder2/another/index"; -->m23 : any -+>m23 : typeof m10 - - void m1; - >void m1 : undefined -@@= skipped -82, +82 lines =@@ - - void m13; - >void m13 : undefined -->m13 : any -+>m13 : typeof m1 - - void m14; - >void m14 : undefined -->m14 : any -+>m14 : typeof m1 - - void m15; - >void m15 : undefined -->m15 : any -+>m15 : typeof m4 - - void m16; - >void m16 : undefined -->m16 : any -+>m16 : typeof m4 - - void m17; - >void m17 : undefined -->m17 : any -+>m17 : typeof m4 - - void m18; - >void m18 : undefined -->m18 : any -+>m18 : typeof m7 - - void m19; - >void m19 : undefined -->m19 : any -+>m19 : typeof m7 - - void m20; - >void m20 : undefined -->m20 : any -+>m20 : typeof m7 - - void m21; - >void m21 : undefined -->m21 : any -+>m21 : typeof m10 - - void m22; - >void m22 : undefined -->m22 : any -+>m22 : typeof m10 - - void m23; - >void m23 : undefined -->m23 : any -+>m23 : typeof m10 - - // These should _mostly_ work - `import = require` always desugars to require calls, which do have extension and index resolution (but can't load anything that resolves to esm!) - import m24 = require("./"); -@@= skipped -50, +50 lines =@@ - >m25 : typeof m1 - - import m26 = require("./subfolder"); -->m26 : typeof m26 -+>m26 : typeof m4 - - import m27 = require("./subfolder/"); -->m27 : typeof m26 -+>m27 : typeof m4 - - import m28 = require("./subfolder/index"); -->m28 : typeof m26 -+>m28 : typeof m4 - - import m29 = require("./subfolder2"); -->m29 : typeof m29 -+>m29 : typeof m7 - - import m30 = require("./subfolder2/"); -->m30 : typeof m29 -+>m30 : typeof m7 - - import m31 = require("./subfolder2/index"); -->m31 : typeof m29 -+>m31 : typeof m7 - - import m32 = require("./subfolder2/another"); - >m32 : typeof m10 -@@= skipped -36, +36 lines =@@ - - void m26; - >void m26 : undefined -->m26 : typeof m26 -+>m26 : typeof m4 - - void m27; - >void m27 : undefined -->m27 : typeof m26 -+>m27 : typeof m4 - - void m28; - >void m28 : undefined -->m28 : typeof m26 -+>m28 : typeof m4 - - void m29; - >void m29 : undefined -->m29 : typeof m29 -+>m29 : typeof m7 - - void m30; - >void m30 : undefined -->m30 : typeof m29 -+>m30 : typeof m7 - - void m31; - >void m31 : undefined -->m31 : typeof m29 -+>m31 : typeof m7 - - void m32; - >void m32 : undefined -@@= skipped -36, +36 lines =@@ - - // These shouldn't work - dynamic `import()` always uses the esm resolver, which does not have extension resolution - const _m35 = import("./"); -->_m35 : Promise -->import("./") : Promise -+>_m35 : Promise<{ x: 1; default: typeof m1; }> -+>import("./") : Promise<{ x: 1; default: typeof m1; }> - >"./" : "./" - - const _m36 = import("./index"); -->_m36 : Promise -->import("./index") : Promise -+>_m36 : Promise<{ x: 1; default: typeof m1; }> -+>import("./index") : Promise<{ x: 1; default: typeof m1; }> - >"./index" : "./index" - - const _m37 = import("./subfolder"); -->_m37 : Promise -->import("./subfolder") : Promise -+>_m37 : Promise<{ x: 1; default: typeof m4; }> -+>import("./subfolder") : Promise<{ x: 1; default: typeof m4; }> - >"./subfolder" : "./subfolder" - - const _m38 = import("./subfolder/"); -->_m38 : Promise -->import("./subfolder/") : Promise -+>_m38 : Promise<{ x: 1; default: typeof m4; }> -+>import("./subfolder/") : Promise<{ x: 1; default: typeof m4; }> - >"./subfolder/" : "./subfolder/" - - const _m39 = import("./subfolder/index"); -->_m39 : Promise -->import("./subfolder/index") : Promise -+>_m39 : Promise<{ x: 1; default: typeof m4; }> -+>import("./subfolder/index") : Promise<{ x: 1; default: typeof m4; }> - >"./subfolder/index" : "./subfolder/index" - - const _m40 = import("./subfolder2"); -->_m40 : Promise -->import("./subfolder2") : Promise -+>_m40 : Promise<{ x: 1; default: typeof m7; }> -+>import("./subfolder2") : Promise<{ x: 1; default: typeof m7; }> - >"./subfolder2" : "./subfolder2" - - const _m41 = import("./subfolder2/"); -->_m41 : Promise -->import("./subfolder2/") : Promise -+>_m41 : Promise<{ x: 1; default: typeof m7; }> -+>import("./subfolder2/") : Promise<{ x: 1; default: typeof m7; }> - >"./subfolder2/" : "./subfolder2/" - - const _m42 = import("./subfolder2/index"); -->_m42 : Promise -->import("./subfolder2/index") : Promise -+>_m42 : Promise<{ x: 1; default: typeof m7; }> -+>import("./subfolder2/index") : Promise<{ x: 1; default: typeof m7; }> - >"./subfolder2/index" : "./subfolder2/index" - - const _m43 = import("./subfolder2/another"); -->_m43 : Promise -->import("./subfolder2/another") : Promise -+>_m43 : Promise<{ x: 1; default: typeof m10; }> -+>import("./subfolder2/another") : Promise<{ x: 1; default: typeof m10; }> - >"./subfolder2/another" : "./subfolder2/another" - - const _m44 = import("./subfolder2/another/"); -->_m44 : Promise -->import("./subfolder2/another/") : Promise -+>_m44 : Promise<{ x: 1; default: typeof m10; }> -+>import("./subfolder2/another/") : Promise<{ x: 1; default: typeof m10; }> - >"./subfolder2/another/" : "./subfolder2/another/" - - const _m45 = import("./subfolder2/another/index"); -->_m45 : Promise -->import("./subfolder2/another/index") : Promise -+>_m45 : Promise<{ x: 1; default: typeof m10; }> -+>import("./subfolder2/another/index") : Promise<{ x: 1; default: typeof m10; }> - >"./subfolder2/another/index" : "./subfolder2/another/index" - - // esm format file \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=nodenext).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=nodenext).types.diff deleted file mode 100644 index 5c5a7e7e7e..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJs1(module=nodenext).types.diff +++ /dev/null @@ -1,128 +0,0 @@ ---- old.nodeModulesAllowJs1(module=nodenext).types -+++ new.nodeModulesAllowJs1(module=nodenext).types -@@= skipped -251, +251 lines =@@ - >m25 : typeof m1 - - import m26 = require("./subfolder"); -->m26 : typeof m26 -+>m26 : typeof m4 - - import m27 = require("./subfolder/"); -->m27 : typeof m26 -+>m27 : typeof m4 - - import m28 = require("./subfolder/index"); -->m28 : typeof m26 -+>m28 : typeof m4 - - import m29 = require("./subfolder2"); -->m29 : typeof m29 -+>m29 : typeof m7 - - import m30 = require("./subfolder2/"); -->m30 : typeof m29 -+>m30 : typeof m7 - - import m31 = require("./subfolder2/index"); -->m31 : typeof m29 -+>m31 : typeof m7 - - import m32 = require("./subfolder2/another"); - >m32 : typeof m10 -@@= skipped -36, +36 lines =@@ - - void m26; - >void m26 : undefined -->m26 : typeof m26 -+>m26 : typeof m4 - - void m27; - >void m27 : undefined -->m27 : typeof m26 -+>m27 : typeof m4 - - void m28; - >void m28 : undefined -->m28 : typeof m26 -+>m28 : typeof m4 - - void m29; - >void m29 : undefined -->m29 : typeof m29 -+>m29 : typeof m7 - - void m30; - >void m30 : undefined -->m30 : typeof m29 -+>m30 : typeof m7 - - void m31; - >void m31 : undefined -->m31 : typeof m29 -+>m31 : typeof m7 - - void m32; - >void m32 : undefined -@@= skipped -575, +575 lines =@@ - >m25 : typeof m1 - - import m26 = require("./subfolder"); -->m26 : typeof m26 -+>m26 : typeof m4 - - import m27 = require("./subfolder/"); -->m27 : typeof m26 -+>m27 : typeof m4 - - import m28 = require("./subfolder/index"); -->m28 : typeof m26 -+>m28 : typeof m4 - - import m29 = require("./subfolder2"); -->m29 : typeof m29 -+>m29 : typeof m7 - - import m30 = require("./subfolder2/"); -->m30 : typeof m29 -+>m30 : typeof m7 - - import m31 = require("./subfolder2/index"); -->m31 : typeof m29 -+>m31 : typeof m7 - - import m32 = require("./subfolder2/another"); - >m32 : typeof m10 -@@= skipped -36, +36 lines =@@ - - void m26; - >void m26 : undefined -->m26 : typeof m26 -+>m26 : typeof m4 - - void m27; - >void m27 : undefined -->m27 : typeof m26 -+>m27 : typeof m4 - - void m28; - >void m28 : undefined -->m28 : typeof m26 -+>m28 : typeof m4 - - void m29; - >void m29 : undefined -->m29 : typeof m29 -+>m29 : typeof m7 - - void m30; - >void m30 : undefined -->m30 : typeof m29 -+>m30 : typeof m7 - - void m31; - >void m31 : undefined -->m31 : typeof m29 -+>m31 : typeof m7 - - void m32; - >void m32 : undefined \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsCjsFromJs(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsCjsFromJs(module=node20).errors.txt.diff index a866888d64..a627b9e85e 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsCjsFromJs(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsCjsFromJs(module=node20).errors.txt.diff @@ -2,11 +2,9 @@ +++ new.nodeModulesAllowJsCjsFromJs(module=node20).errors.txt @@= skipped -0, +0 lines =@@ - -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. +bar.ts(1,8): error TS2613: Module '"foo"' has no default export. Did you mean to use 'import { foo } from "foo"' instead? + + -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. +==== foo.cjs (0 errors) ==== + exports.foo = "foo" +==== bar.ts (1 errors) ==== diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).errors.txt.diff deleted file mode 100644 index e08d1da38d..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).errors.txt.diff +++ /dev/null @@ -1,139 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=node16).errors.txt -+++ new.nodeModulesAllowJsConditionalPackageExports(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --index.cjs(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. --index.cjs(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. --node_modules/inner/index.d.mts(2,13): error TS2303: Circular definition of import alias 'cjs'. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -+index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.js (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.mjs (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.cjs (2 errors) ==== -+==== index.js (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.mjs (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.cjs (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -57, +76 lines =@@ - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; -@@= skipped -13, +11 lines =@@ - export { type }; - export { ts }; - export const implicitCjsSource = true; --==== node_modules/inner/index.d.mts (1 errors) ==== -+==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).types.diff deleted file mode 100644 index 2dffe05f69..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node16).types.diff +++ /dev/null @@ -1,199 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=node16).types -+++ new.nodeModulesAllowJsConditionalPackageExports(module=node16).types -@@= skipped -2, +2 lines =@@ - === index.js === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -52, +52 lines =@@ - === index.mjs === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -52, +52 lines =@@ - === index.cjs === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -24, +24 lines =@@ - >mjsi : typeof cjsi - - import * as typei from "inner"; -->typei : typeof cjsi.type -+>typei : typeof typei - - import * as ts from "inner/types"; - >ts : typeof cjsi -@@= skipped -17, +17 lines =@@ - - typei.implicitCjsSource; - >typei.implicitCjsSource : true -->typei : typeof cjsi.type -+>typei : typeof typei - >implicitCjsSource : true - - ts.cjsSource; -@@= skipped -11, +11 lines =@@ - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : typeof cjs - - import * as type from "inner"; -->type : typeof mjs.type -+>type : typeof type - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : typeof cjs - - export { type }; -->type : typeof mjs.type -+>type : typeof type - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const implicitCjsSource = true; - >implicitCjsSource : true -@@= skipped -30, +30 lines =@@ - === node_modules/inner/index.d.mts === - // esm format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : typeof cjs - - import * as type from "inner"; -->type : typeof mjs -+>type : typeof cjs - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : typeof cjs - - export { type }; -->type : typeof mjs -+>type : typeof cjs - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const mjsSource = true; - >mjsSource : true -@@= skipped -36, +36 lines =@@ - >mjs : typeof cjs - - import * as type from "inner"; -->type : typeof cjs.type -+>type : typeof type - - import * as ts from "inner/types"; - >ts : typeof cjs -@@= skipped -12, +12 lines =@@ - >mjs : typeof cjs - - export { type }; -->type : typeof cjs.type -+>type : typeof type - - export { ts }; - >ts : typeof cjs \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt.diff deleted file mode 100644 index 1dc19bd5b1..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt.diff +++ /dev/null @@ -1,139 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt -+++ new.nodeModulesAllowJsConditionalPackageExports(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --index.cjs(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. --index.cjs(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. --node_modules/inner/index.d.mts(2,13): error TS2303: Circular definition of import alias 'cjs'. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -+index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.js (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.mjs (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.cjs (2 errors) ==== -+==== index.js (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.mjs (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.cjs (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -57, +76 lines =@@ - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; -@@= skipped -13, +11 lines =@@ - export { type }; - export { ts }; - export const implicitCjsSource = true; --==== node_modules/inner/index.d.mts (1 errors) ==== -+==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).types.diff deleted file mode 100644 index d7b146de5d..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node18).types.diff +++ /dev/null @@ -1,199 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=node18).types -+++ new.nodeModulesAllowJsConditionalPackageExports(module=node18).types -@@= skipped -2, +2 lines =@@ - === index.js === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -52, +52 lines =@@ - === index.mjs === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -52, +52 lines =@@ - === index.cjs === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -24, +24 lines =@@ - >mjsi : typeof cjsi - - import * as typei from "inner"; -->typei : typeof cjsi.type -+>typei : typeof typei - - import * as ts from "inner/types"; - >ts : typeof cjsi -@@= skipped -17, +17 lines =@@ - - typei.implicitCjsSource; - >typei.implicitCjsSource : true -->typei : typeof cjsi.type -+>typei : typeof typei - >implicitCjsSource : true - - ts.cjsSource; -@@= skipped -11, +11 lines =@@ - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : typeof cjs - - import * as type from "inner"; -->type : typeof mjs.type -+>type : typeof type - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : typeof cjs - - export { type }; -->type : typeof mjs.type -+>type : typeof type - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const implicitCjsSource = true; - >implicitCjsSource : true -@@= skipped -30, +30 lines =@@ - === node_modules/inner/index.d.mts === - // esm format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : typeof cjs - - import * as type from "inner"; -->type : typeof mjs -+>type : typeof cjs - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : typeof cjs - - export { type }; -->type : typeof mjs -+>type : typeof cjs - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const mjsSource = true; - >mjsSource : true -@@= skipped -36, +36 lines =@@ - >mjs : typeof cjs - - import * as type from "inner"; -->type : typeof cjs.type -+>type : typeof type - - import * as ts from "inner/types"; - >ts : typeof cjs -@@= skipped -12, +12 lines =@@ - >mjs : typeof cjs - - export { type }; -->type : typeof cjs.type -+>type : typeof type - - export { ts }; - >ts : typeof cjs \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).errors.txt.diff deleted file mode 100644 index e202428077..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).errors.txt.diff +++ /dev/null @@ -1,192 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=node20).errors.txt -+++ new.nodeModulesAllowJsConditionalPackageExports(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --node_modules/inner/index.d.mts(2,13): error TS2303: Circular definition of import alias 'cjs'. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -- -- -+index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.cjs(9,23): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -+index.cjs(10,24): error TS2307: Cannot find module 'inner' or its corresponding type declarations. -+index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.js(9,23): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -+index.js(10,24): error TS2307: Cannot find module 'inner' or its corresponding type declarations. -+index.js(12,6): error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -+index.js(15,4): error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -+index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mjs(8,23): error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. -+node_modules/inner/index.d.cts(3,22): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -+node_modules/inner/index.d.cts(4,23): error TS2307: Cannot find module 'inner' or its corresponding type declarations. -+node_modules/inner/index.d.mts(2,22): error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. -+node_modules/inner/index.d.ts(3,22): error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -+node_modules/inner/index.d.ts(4,23): error TS2307: Cannot find module 'inner' or its corresponding type declarations. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.js (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.mjs (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.cjs (0 errors) ==== -+==== index.js (7 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. -+ import * as typei from "inner"; -+ ~~~~~~~ -+!!! error TS2307: Cannot find module 'inner' or its corresponding type declarations. -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ ~~~~~~~~~ -+!!! error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -+!!! related TS2728 node_modules/inner/index.d.cts:10:14: 'cjsSource' is declared here. -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+ ~~~~~~~~~ -+!!! error TS2551: Property 'mjsSource' does not exist on type 'typeof import("node_modules/inner/index")'. Did you mean 'cjsSource'? -+!!! related TS2728 node_modules/inner/index.d.cts:10:14: 'cjsSource' is declared here. -+==== index.mjs (4 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.cjs (5 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; - import * as cjsi from "inner/a"; - import * as mjsi from "inner/b"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. - import * as typei from "inner"; -+ ~~~~~~~ -+!!! error TS2307: Cannot find module 'inner' or its corresponding type declarations. - import * as ts from "inner/types"; - cjsi.cjsSource; - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (2 errors) ==== - // cjs format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. - import * as type from "inner"; -+ ~~~~~~~ -+!!! error TS2307: Cannot find module 'inner' or its corresponding type declarations. - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; -@@= skipped -67, +124 lines =@@ - ==== node_modules/inner/index.d.mts (1 errors) ==== - // esm format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'inner/a' or its corresponding type declarations. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; -@@= skipped -10, +10 lines =@@ - export { type }; - export { ts }; - export const mjsSource = true; --==== node_modules/inner/index.d.cts (0 errors) ==== -+==== node_modules/inner/index.d.cts (2 errors) ==== - // cjs format file - import * as cjs from "inner/a"; - import * as mjs from "inner/b"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'inner/b' or its corresponding type declarations. - import * as type from "inner"; -+ ~~~~~~~ -+!!! error TS2307: Cannot find module 'inner' or its corresponding type declarations. - import * as ts from "inner/types"; - export { cjs }; - export { mjs }; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).types.diff deleted file mode 100644 index 3bda3207a5..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=node20).types.diff +++ /dev/null @@ -1,264 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=node20).types -+++ new.nodeModulesAllowJsConditionalPackageExports(module=node20).types -@@= skipped -2, +2 lines =@@ - === index.js === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/b"; -->mjsi : typeof cjsi -+>mjsi : any - - import * as typei from "inner"; -->typei : typeof cjsi -+>typei : any - - import * as ts from "inner/types"; - >ts : typeof cjsi - - cjsi.mjsSource; -->cjsi.mjsSource : true -+>cjsi.mjsSource : any - >cjsi : typeof cjsi -->mjsSource : true -+>mjsSource : any - - mjsi.mjsSource; -->mjsi.mjsSource : true -->mjsi : typeof cjsi -->mjsSource : true -+>mjsi.mjsSource : any -+>mjsi : any -+>mjsSource : any - - typei.mjsSource; -->typei.mjsSource : true -->typei : typeof cjsi -->mjsSource : true -+>typei.mjsSource : any -+>typei : any -+>mjsSource : any - - ts.mjsSource; -->ts.mjsSource : true -+>ts.mjsSource : any - >ts : typeof cjsi -->mjsSource : true -+>mjsSource : any - - === index.mjs === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; -->cjsi : typeof cjsi -+>cjsi : any - - import * as mjsi from "inner/b"; -->mjsi : typeof cjsi -+>mjsi : typeof mjsi - - import * as typei from "inner"; -->typei : typeof cjsi -+>typei : typeof mjsi - - import * as ts from "inner/types"; -->ts : typeof cjsi -+>ts : typeof mjsi - - cjsi.mjsSource; -->cjsi.mjsSource : true -->cjsi : typeof cjsi -->mjsSource : true -+>cjsi.mjsSource : any -+>cjsi : any -+>mjsSource : any - - mjsi.mjsSource; - >mjsi.mjsSource : true -->mjsi : typeof cjsi -+>mjsi : typeof mjsi - >mjsSource : true - - typei.mjsSource; - >typei.mjsSource : true -->typei : typeof cjsi -+>typei : typeof mjsi - >mjsSource : true - - ts.mjsSource; - >ts.mjsSource : true -->ts : typeof cjsi -+>ts : typeof mjsi - >mjsSource : true - - === index.cjs === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/b"; -->mjsi : typeof cjsi -+>mjsi : any - - import * as typei from "inner"; -->typei : typeof cjsi.type -+>typei : any - - import * as ts from "inner/types"; - >ts : typeof cjsi -@@= skipped -139, +139 lines =@@ - >cjsSource : true - - mjsi.cjsSource; -->mjsi.cjsSource : true -->mjsi : typeof cjsi -->cjsSource : true -+>mjsi.cjsSource : any -+>mjsi : any -+>cjsSource : any - - typei.implicitCjsSource; -->typei.implicitCjsSource : true -->typei : typeof cjsi.type -->implicitCjsSource : true -+>typei.implicitCjsSource : any -+>typei : any -+>implicitCjsSource : any - - ts.cjsSource; - >ts.cjsSource : true -@@= skipped -17, +17 lines =@@ - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "inner"; -->type : typeof mjs.type -+>type : any - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : any - - export { type }; -->type : typeof mjs.type -+>type : any - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const implicitCjsSource = true; - >implicitCjsSource : true -@@= skipped -63, +63 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof cjs -+>mjs : any - - import * as type from "inner"; -->type : typeof cjs.type -+>type : any - - import * as ts from "inner/types"; - >ts : typeof cjs -@@= skipped -12, +12 lines =@@ - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs -+>mjs : any - - export { type }; -->type : typeof cjs.type -+>type : any - - export { ts }; - >ts : typeof cjs \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt.diff deleted file mode 100644 index 2ef14964d2..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,135 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt -+++ new.nodeModulesAllowJsConditionalPackageExports(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --node_modules/inner/index.d.mts(2,13): error TS2303: Circular definition of import alias 'cjs'. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -+index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.js (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.mjs (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/a"; -- import * as mjsi from "inner/b"; -- import * as typei from "inner"; -- import * as ts from "inner/types"; -- cjsi.mjsSource; -- mjsi.mjsSource; -- typei.mjsSource; -- ts.mjsSource; --==== index.cjs (0 errors) ==== -+==== index.js (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.mjs (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/a"; -+ import * as mjsi from "inner/b"; -+ import * as typei from "inner"; -+ import * as ts from "inner/types"; -+ cjsi.mjsSource; -+ mjsi.mjsSource; -+ typei.mjsSource; -+ ts.mjsSource; -+==== index.cjs (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -51, +76 lines =@@ - mjsi.cjsSource; - typei.implicitCjsSource; - ts.cjsSource; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; -@@= skipped -13, +11 lines =@@ - export { type }; - export { ts }; - export const implicitCjsSource = true; --==== node_modules/inner/index.d.mts (1 errors) ==== -+==== node_modules/inner/index.d.mts (0 errors) ==== - // esm format file - import * as cjs from "inner/a"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/b"; - import * as type from "inner"; - import * as ts from "inner/types"; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).types.diff deleted file mode 100644 index 68322d3ac2..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsConditionalPackageExports(module=nodenext).types.diff +++ /dev/null @@ -1,199 +0,0 @@ ---- old.nodeModulesAllowJsConditionalPackageExports(module=nodenext).types -+++ new.nodeModulesAllowJsConditionalPackageExports(module=nodenext).types -@@= skipped -2, +2 lines =@@ - === index.js === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -52, +52 lines =@@ - === index.mjs === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -52, +52 lines =@@ - === index.cjs === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/a"; - >cjsi : typeof cjsi -@@= skipped -24, +24 lines =@@ - >mjsi : typeof cjsi - - import * as typei from "inner"; -->typei : typeof cjsi.type -+>typei : typeof typei - - import * as ts from "inner/types"; - >ts : typeof cjsi -@@= skipped -17, +17 lines =@@ - - typei.implicitCjsSource; - >typei.implicitCjsSource : true -->typei : typeof cjsi.type -+>typei : typeof typei - >implicitCjsSource : true - - ts.cjsSource; -@@= skipped -11, +11 lines =@@ - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : typeof cjs - - import * as type from "inner"; -->type : typeof mjs.type -+>type : typeof type - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : typeof cjs - - export { type }; -->type : typeof mjs.type -+>type : typeof type - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const implicitCjsSource = true; - >implicitCjsSource : true -@@= skipped -30, +30 lines =@@ - === node_modules/inner/index.d.mts === - // esm format file - import * as cjs from "inner/a"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/b"; -->mjs : typeof mjs -+>mjs : typeof cjs - - import * as type from "inner"; -->type : typeof mjs -+>type : typeof cjs - - import * as ts from "inner/types"; -->ts : typeof mjs -+>ts : typeof cjs - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; -->mjs : typeof mjs -+>mjs : typeof cjs - - export { type }; -->type : typeof mjs -+>type : typeof cjs - - export { ts }; -->ts : typeof mjs -+>ts : typeof cjs - - export const mjsSource = true; - >mjsSource : true -@@= skipped -36, +36 lines =@@ - >mjs : typeof cjs - - import * as type from "inner"; -->type : typeof cjs.type -+>type : typeof type - - import * as ts from "inner/types"; - >ts : typeof cjs -@@= skipped -12, +12 lines =@@ - >mjs : typeof cjs - - export { type }; -->type : typeof cjs.type -+>type : typeof type - - export { ts }; - >ts : typeof cjs \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsDynamicImport(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsDynamicImport(module=node20).errors.txt.diff deleted file mode 100644 index b4effb63a5..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsDynamicImport(module=node20).errors.txt.diff +++ /dev/null @@ -1,38 +0,0 @@ ---- old.nodeModulesAllowJsDynamicImport(module=node20).errors.txt -+++ new.nodeModulesAllowJsDynamicImport(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+error TS2468: Cannot find global value 'Promise'. -+index.js(3,32): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+subfolder/index.js(3,32): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+!!! error TS2468: Cannot find global value 'Promise'. -+==== subfolder/index.js (1 errors) ==== -+ // cjs format file -+ export async function main() { -+ const { readFile } = await import("fs"); -+ ~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ } -+==== index.js (1 errors) ==== -+ // esm format file -+ export async function main() { -+ const { readFile } = await import("fs"); -+ ~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ } -+==== package.json (0 errors) ==== -+ { -+ "name": "package", -+ "private": true, -+ "type": "module" -+ } -+==== subfolder/package.json (0 errors) ==== -+ { -+ "type": "commonjs" -+ } -+==== types.d.ts (0 errors) ==== -+ declare module "fs"; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=node20).errors.txt.diff index 0ddbd3ec8e..4132764be7 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportAssignment(module=node20).errors.txt.diff @@ -2,37 +2,18 @@ +++ new.nodeModulesAllowJsExportAssignment(module=node20).errors.txt @@= skipped -0, +0 lines =@@ -file.js(4,1): error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. --index.js(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. ++file.js(4,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. + index.js(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. index.js(3,1): error TS8003: 'export =' can only be used in TypeScript files. subfolder/index.js(3,1): error TS8003: 'export =' can only be used in TypeScript files. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== subfolder/index.js (1 errors) ==== - // cjs format file - const a = {}; -@@= skipped -13, +13 lines =@@ - // cjs format file - const a = {}; - module.exports = a; --==== index.js (2 errors) ==== -+==== index.js (1 errors) ==== - // esm format file - const a = {}; - export = a; - ~~~~~~~~~~~ --!!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. -- ~~~~~~~~~~~ - !!! error TS8003: 'export =' can only be used in TypeScript files. --==== file.js (1 errors) ==== -+==== file.js (0 errors) ==== - // esm format file +@@= skipped -26, +26 lines =@@ import "fs"; const a = {}; module.exports = a; - ~~~~~~ -!!! error TS2580: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`. ++ ~~~~~~~~~~~~~~~~~~ ++!!! error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. ==== package.json (0 errors) ==== { "name": "package", \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node20).errors.txt.diff deleted file mode 100644 index 457ef0f8c8..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node20).errors.txt.diff +++ /dev/null @@ -1,12 +0,0 @@ ---- old.nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node20).errors.txt -+++ new.nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== foo.cjs (0 errors) ==== -+ // this file is a module despite having no imports -+==== bar.js (0 errors) ==== -+ // however this file is _not_ a module \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node20).errors.txt.diff index 6f6deff5c8..b45c36835f 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsGeneratedNameCollisions(module=node20).errors.txt.diff @@ -1,10 +1,6 @@ --- old.nodeModulesAllowJsGeneratedNameCollisions(module=node20).errors.txt +++ new.nodeModulesAllowJsGeneratedNameCollisions(module=node20).errors.txt @@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+index.js(2,10): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. -+index.js(3,7): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. -+index.js(5,14): error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. subfolder/index.js(2,10): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. subfolder/index.js(3,7): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. -subfolder/index.js(4,7): error TS2725: Class name cannot be 'Object' when targeting ES5 and above with module Node20. @@ -12,12 +8,11 @@ -==== subfolder/index.js (4 errors) ==== -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. +==== subfolder/index.js (3 errors) ==== // cjs format file function require() {} ~~~~~~~ -@@= skipped -12, +16 lines =@@ +@@= skipped -12, +11 lines =@@ ~~~~~~~ !!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. class Object {} @@ -25,21 +20,4 @@ -!!! error TS2725: Class name cannot be 'Object' when targeting ES5 and above with module Node20. export const __esModule = false; ~~~~~~~~~~ - !!! error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. - export {require, exports, Object}; --==== index.js (0 errors) ==== -+==== index.js (3 errors) ==== - // esm format file - function require() {} -+ ~~~~~~~ -+!!! error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. - const exports = {}; -+ ~~~~~~~ -+!!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. - class Object {} - export const __esModule = false; -+ ~~~~~~~~~~ -+!!! error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. - export {require, exports, Object}; - ==== package.json (0 errors) ==== - { \ No newline at end of file + !!! error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsImportAssignment(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsImportAssignment(module=node20).errors.txt.diff deleted file mode 100644 index cacb6ea95a..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsImportAssignment(module=node20).errors.txt.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.nodeModulesAllowJsImportAssignment(module=node20).errors.txt -+++ new.nodeModulesAllowJsImportAssignment(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - file.js(4,1): error TS8002: 'import ... =' can only be used in TypeScript files. - file.js(6,1): error TS8002: 'import ... =' can only be used in TypeScript files. - index.js(2,1): error TS8002: 'import ... =' can only be used in TypeScript files. -@@= skipped -5, +6 lines =@@ - subfolder/index.js(4,1): error TS8002: 'import ... =' can only be used in TypeScript files. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== subfolder/index.js (2 errors) ==== - // cjs format file - import fs = require("fs"); \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsImportHelpersCollisions1(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsImportHelpersCollisions1(module=node20).errors.txt.diff index 8735318e09..f6fae83200 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsImportHelpersCollisions1(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsImportHelpersCollisions1(module=node20).errors.txt.diff @@ -6,19 +6,35 @@ - - -==== subfolder/index.js (2 errors) ==== -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== subfolder/index.js (0 errors) ==== - // cjs format file - import {default as _fs} from "fs"; +- // cjs format file +- import {default as _fs} from "fs"; - ~~~~~~~~~~~~~~ -!!! error TS2343: This syntax requires an imported helper named '__importDefault' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. - _fs.readFile; - import * as fs from "fs"; +- _fs.readFile; +- import * as fs from "fs"; - ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2343: This syntax requires an imported helper named '__importStar' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. - fs.readFile; - ==== index.js (0 errors) ==== - // esm format file \ No newline at end of file +- fs.readFile; +-==== index.js (0 errors) ==== +- // esm format file +- import {default as _fs} from "fs"; +- _fs.readFile; +- import * as fs from "fs"; +- fs.readFile; +-==== package.json (0 errors) ==== +- { +- "name": "package", +- "private": true, +- "type": "module" +- } +-==== subfolder/package.json (0 errors) ==== +- { +- "type": "commonjs" +- } +-==== types.d.ts (0 errors) ==== +- declare module "fs"; +- declare module "tslib" { +- export {}; +- // intentionally missing all helpers +- } ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsImportHelpersCollisions2(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsImportHelpersCollisions2(module=node20).errors.txt.diff index d227545c64..555476b054 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsImportHelpersCollisions2(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsImportHelpersCollisions2(module=node20).errors.txt.diff @@ -6,18 +6,31 @@ - - -==== subfolder/index.ts (2 errors) ==== -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== subfolder/index.ts (0 errors) ==== - // cjs format file - export * from "fs"; +- // cjs format file +- export * from "fs"; - ~~~~~~~~~~~~~~~~~~~ -!!! error TS2343: This syntax requires an imported helper named '__exportStar' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. - export * as fs from "fs"; +- export * as fs from "fs"; - ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2343: This syntax requires an imported helper named '__importStar' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. - ==== index.js (0 errors) ==== - // esm format file - export * from "fs"; \ No newline at end of file +-==== index.js (0 errors) ==== +- // esm format file +- export * from "fs"; +- export * as fs from "fs"; +-==== package.json (0 errors) ==== +- { +- "name": "package", +- "private": true, +- "type": "module" +- } +-==== subfolder/package.json (0 errors) ==== +- { +- "type": "commonjs" +- } +-==== types.d.ts (0 errors) ==== +- declare module "fs"; +- declare module "tslib" { +- export {}; +- // intentionally missing all helpers +- } ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsImportHelpersCollisions3(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsImportHelpersCollisions3(module=node20).errors.txt.diff index dadedfa87a..c1e1af6d7c 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsImportHelpersCollisions3(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsImportHelpersCollisions3(module=node20).errors.txt.diff @@ -5,15 +5,31 @@ - - -==== subfolder/index.js (1 errors) ==== -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+==== subfolder/index.js (0 errors) ==== - // cjs format file - export {default} from "fs"; +- // cjs format file +- export {default} from "fs"; - ~~~~~~~ -!!! error TS2343: This syntax requires an imported helper named '__importDefault' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. - export {default as foo} from "fs"; - export {bar as baz} from "fs"; - ==== index.js (0 errors) ==== \ No newline at end of file +- export {default as foo} from "fs"; +- export {bar as baz} from "fs"; +-==== index.js (0 errors) ==== +- // esm format file +- export {default} from "fs"; +- export {default as foo} from "fs"; +- export {bar as baz} from "fs"; +-==== package.json (0 errors) ==== +- { +- "name": "package", +- "private": true, +- "type": "module" +- } +-==== subfolder/package.json (0 errors) ==== +- { +- "type": "commonjs" +- } +-==== types.d.ts (0 errors) ==== +- declare module "fs"; +- declare module "tslib" { +- export {}; +- // intentionally missing all helpers +- } ++ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsImportMeta(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsImportMeta(module=node20).errors.txt.diff deleted file mode 100644 index 2c508c1be7..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsImportMeta(module=node20).errors.txt.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- old.nodeModulesAllowJsImportMeta(module=node20).errors.txt -+++ new.nodeModulesAllowJsImportMeta(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+index.js(2,11): error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. - subfolder/index.js(2,11): error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== subfolder/index.js (1 errors) ==== - // cjs format file - const x = import.meta.url; - ~~~~~~~~~~~ - !!! error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. - export {x}; --==== index.js (0 errors) ==== -+==== index.js (1 errors) ==== - // esm format file - const x = import.meta.url; -+ ~~~~~~~~~~~ -+!!! error TS1470: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. - export {x}; - ==== package.json (0 errors) ==== - { \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node16).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node16).errors.txt.diff deleted file mode 100644 index e593bff0b7..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node16).errors.txt.diff +++ /dev/null @@ -1,120 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=node16).errors.txt -+++ new.nodeModulesAllowJsPackageExports(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --index.cjs(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. --index.cjs(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - index.cjs(9,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -+index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. - - - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.js (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.mjs (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.cjs (3 errors) ==== -+==== index.js (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.mjs (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.cjs (4 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -55, +75 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs"; - ~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node16).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node16).types.diff deleted file mode 100644 index fef834137b..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node16).types.diff +++ /dev/null @@ -1,212 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=node16).types -+++ new.nodeModulesAllowJsPackageExports(module=node16).types -@@= skipped -2, +2 lines =@@ - === index.js === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.mjs === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.cjs === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs"; - >mjs : typeof mjs - - import * as type from "inner"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -61, +61 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node18).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node18).errors.txt.diff deleted file mode 100644 index 7df9bf176f..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node18).errors.txt.diff +++ /dev/null @@ -1,120 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=node18).errors.txt -+++ new.nodeModulesAllowJsPackageExports(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --index.cjs(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. --index.cjs(4,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - index.cjs(9,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. -+index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. - - - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.js (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.mjs (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.cjs (3 errors) ==== -+==== index.js (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.mjs (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.cjs (4 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; - ~~~~~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package/mjs")' call instead. -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; - ~~~~~~~~~ --!!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("package")' call instead. -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -55, +75 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs"; - ~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node18).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node18).types.diff deleted file mode 100644 index 0cb07ae47e..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node18).types.diff +++ /dev/null @@ -1,212 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=node18).types -+++ new.nodeModulesAllowJsPackageExports(module=node18).types -@@= skipped -2, +2 lines =@@ - === index.js === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.mjs === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.cjs === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs"; - >mjs : typeof mjs - - import * as type from "inner"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -61, +61 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node20).errors.txt.diff deleted file mode 100644 index 813ea4bbc6..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node20).errors.txt.diff +++ /dev/null @@ -1,117 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=node20).errors.txt -+++ new.nodeModulesAllowJsPackageExports(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -- -- -+index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.js (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.mjs (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.cjs (0 errors) ==== -+==== index.js (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.mjs (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.cjs (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -44, +72 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node20).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node20).types.diff deleted file mode 100644 index 9a046a7cc5..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=node20).types.diff +++ /dev/null @@ -1,212 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=node20).types -+++ new.nodeModulesAllowJsPackageExports(module=node20).types -@@= skipped -2, +2 lines =@@ - === index.js === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.mjs === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.cjs === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs"; - >mjs : typeof mjs - - import * as type from "inner"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -61, +61 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=nodenext).errors.txt.diff deleted file mode 100644 index c15c3e629d..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,113 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=nodenext).errors.txt -+++ new.nodeModulesAllowJsPackageExports(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ - error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -+index.cjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.cjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.cjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.js(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.js(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.js(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. -+index.mjs(2,22): error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+index.mjs(3,22): error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+index.mjs(4,23): error TS2307: Cannot find module 'package' or its corresponding type declarations. - - - !!! error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. --==== index.js (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.mjs (0 errors) ==== -- // esm format file -- import * as cjs from "package/cjs"; -- import * as mjs from "package/mjs"; -- import * as type from "package"; -- cjs; -- mjs; -- type; -- import * as cjsi from "inner/cjs"; -- import * as mjsi from "inner/mjs"; -- import * as typei from "inner"; -- cjsi; -- mjsi; -- typei; --==== index.cjs (0 errors) ==== -+==== index.js (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.mjs (3 errors) ==== -+ // esm format file -+ import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. -+ import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. -+ import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. -+ cjs; -+ mjs; -+ type; -+ import * as cjsi from "inner/cjs"; -+ import * as mjsi from "inner/mjs"; -+ import * as typei from "inner"; -+ cjsi; -+ mjsi; -+ typei; -+==== index.cjs (3 errors) ==== - // cjs format file - import * as cjs from "package/cjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/cjs' or its corresponding type declarations. - import * as mjs from "package/mjs"; -+ ~~~~~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package/mjs' or its corresponding type declarations. - import * as type from "package"; -+ ~~~~~~~~~ -+!!! error TS2307: Cannot find module 'package' or its corresponding type declarations. - cjs; - mjs; - type; -@@= skipped -44, +70 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs"; - import * as type from "inner"; - export { cjs }; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=nodenext).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=nodenext).types.diff deleted file mode 100644 index 9090c96128..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageExports(module=nodenext).types.diff +++ /dev/null @@ -1,212 +0,0 @@ ---- old.nodeModulesAllowJsPackageExports(module=nodenext).types -+++ new.nodeModulesAllowJsPackageExports(module=nodenext).types -@@= skipped -2, +2 lines =@@ - === index.js === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.mjs === - // esm format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; - >typei : typeof typei -@@= skipped -30, +30 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -8, +8 lines =@@ - === index.cjs === - // cjs format file - import * as cjs from "package/cjs"; -->cjs : typeof cjs -+>cjs : any - - import * as mjs from "package/mjs"; -->mjs : typeof mjs -+>mjs : any - - import * as type from "package"; -->type : typeof type -+>type : any - - cjs; -->cjs : typeof cjs -+>cjs : any - - mjs; -->mjs : typeof mjs -+>mjs : any - - type; -->type : typeof type -+>type : any - - import * as cjsi from "inner/cjs"; - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs"; - >mjs : typeof mjs - - import * as type from "inner"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -61, +61 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageImports(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageImports(module=node20).errors.txt.diff index d9a3fd7038..51da4daa1b 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageImports(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackageImports(module=node20).errors.txt.diff @@ -1,10 +1,7 @@ --- old.nodeModulesAllowJsPackageImports(module=node20).errors.txt +++ new.nodeModulesAllowJsPackageImports(module=node20).errors.txt @@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. error TS2210: The project root is ambiguous, but is required to resolve import map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -- -- +index.cjs(2,22): error TS2307: Cannot find module '#cjs' or its corresponding type declarations. +index.cjs(3,22): error TS2307: Cannot find module '#mjs' or its corresponding type declarations. +index.cjs(4,23): error TS2307: Cannot find module '#type' or its corresponding type declarations. @@ -14,9 +11,8 @@ +index.mjs(2,22): error TS2307: Cannot find module '#cjs' or its corresponding type declarations. +index.mjs(3,22): error TS2307: Cannot find module '#mjs' or its corresponding type declarations. +index.mjs(4,23): error TS2307: Cannot find module '#type' or its corresponding type declarations. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. + + !!! error TS2210: The project root is ambiguous, but is required to resolve import map entry '.' in file 'package.json'. Supply the `rootDir` compiler option to disambiguate. -==== index.js (0 errors) ==== - // esm format file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).errors.txt.diff deleted file mode 100644 index d8edc7785a..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).errors.txt.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExports(module=node16).errors.txt -+++ new.nodeModulesAllowJsPackagePatternExports(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ - index.cjs(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - - -@@= skipped -29, +28 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index"; - ~~~~~~~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).types.diff deleted file mode 100644 index f588eaafe5..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node16).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExports(module=node16).types -+++ new.nodeModulesAllowJsPackagePatternExports(module=node16).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; - >mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt.diff deleted file mode 100644 index d3235546df..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt -+++ new.nodeModulesAllowJsPackagePatternExports(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ - index.cjs(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. - - -@@= skipped -29, +28 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index"; - ~~~~~~~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).types.diff deleted file mode 100644 index 86cb0215d7..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node18).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExports(module=node18).types -+++ new.nodeModulesAllowJsPackagePatternExports(module=node18).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; - >mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).errors.txt.diff deleted file mode 100644 index 69acc68c62..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).errors.txt.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExports(module=node20).errors.txt -+++ new.nodeModulesAllowJsPackagePatternExports(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -- -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== index.js (0 errors) ==== - // esm format file - import * as cjsi from "inner/cjs/index"; -@@= skipped -24, +25 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index"; - import * as type from "inner/js/index"; - export { cjs }; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).types.diff deleted file mode 100644 index c71f993ccd..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=node20).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExports(module=node20).types -+++ new.nodeModulesAllowJsPackagePatternExports(module=node20).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; - >mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).errors.txt.diff deleted file mode 100644 index b07ff1defa..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,74 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExports(module=nodenext).errors.txt -+++ new.nodeModulesAllowJsPackagePatternExports(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -- -- --==== index.js (0 errors) ==== -- // esm format file -- import * as cjsi from "inner/cjs/index"; -- import * as mjsi from "inner/mjs/index"; -- import * as typei from "inner/js/index"; -- cjsi; -- mjsi; -- typei; --==== index.mjs (0 errors) ==== -- // esm format file -- import * as cjsi from "inner/cjs/index"; -- import * as mjsi from "inner/mjs/index"; -- import * as typei from "inner/js/index"; -- cjsi; -- mjsi; -- typei; --==== index.cjs (0 errors) ==== -- // cjs format file -- import * as cjsi from "inner/cjs/index"; -- import * as mjsi from "inner/mjs/index"; -- import * as typei from "inner/js/index"; -- cjsi; -- mjsi; -- typei; --==== node_modules/inner/index.d.ts (1 errors) ==== -- // cjs format file -- import * as cjs from "inner/cjs/index"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. -- import * as mjs from "inner/mjs/index"; -- import * as type from "inner/js/index"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== node_modules/inner/index.d.mts (0 errors) ==== -- // esm format file -- import * as cjs from "inner/cjs/index"; -- import * as mjs from "inner/mjs/index"; -- import * as type from "inner/js/index"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== node_modules/inner/index.d.cts (0 errors) ==== -- // cjs format file -- import * as cjs from "inner/cjs/index"; -- import * as mjs from "inner/mjs/index"; -- import * as type from "inner/js/index"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== package.json (0 errors) ==== -- { -- "name": "package", -- "private": true, -- "type": "module" -- } --==== node_modules/inner/package.json (0 errors) ==== -- { -- "name": "inner", -- "private": true, -- "exports": { -- "./cjs/*": "./*.cjs", -- "./mjs/*": "./*.mjs", -- "./js/*": "./*.js" -- } -- } -- -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).types.diff deleted file mode 100644 index dfcec69d5b..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExports(module=nodenext).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExports(module=nodenext).types -+++ new.nodeModulesAllowJsPackagePatternExports(module=nodenext).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; - >mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsExclude(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsExclude(module=node20).errors.txt.diff deleted file mode 100644 index 359f8ed9a2..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsExclude(module=node20).errors.txt.diff +++ /dev/null @@ -1,15 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsExclude(module=node20).errors.txt -+++ new.nodeModulesAllowJsPackagePatternExportsExclude(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - index.cjs(2,23): error TS2307: Cannot find module 'inner/cjs/exclude/index' or its corresponding type declarations. - index.cjs(3,23): error TS2307: Cannot find module 'inner/mjs/exclude/index' or its corresponding type declarations. - index.cjs(4,24): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. -@@= skipped -17, +18 lines =@@ - node_modules/inner/exclude/index.d.ts(4,23): error TS2307: Cannot find module 'inner/js/exclude/index' or its corresponding type declarations. - - -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== index.js (3 errors) ==== - // esm format file - import * as cjsi from "inner/cjs/exclude/index"; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).errors.txt.diff deleted file mode 100644 index 318d7c9f6c..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).errors.txt.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).errors.txt -+++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).errors.txt -@@= skipped -0, +0 lines =@@ - index.cjs(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. - - -@@= skipped -29, +28 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index.mjs"; - ~~~~~~~~~~~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).types.diff deleted file mode 100644 index 8e657345b4..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).types -+++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=node16).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; - >mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt.diff deleted file mode 100644 index 6e005d3729..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt.diff +++ /dev/null @@ -1,22 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt -+++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).errors.txt -@@= skipped -0, +0 lines =@@ - index.cjs(3,23): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. - node_modules/inner/index.d.cts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. - node_modules/inner/index.d.ts(3,22): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. - - -@@= skipped -29, +28 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (2 errors) ==== -+==== node_modules/inner/index.d.ts (1 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index.mjs"; - ~~~~~~~~~~~~~~~~~~~~~ - !!! error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("inner/mjs/index.mjs")' call instead. \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).types.diff deleted file mode 100644 index 9ef7fde633..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).types -+++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=node18).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; - >mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).errors.txt.diff deleted file mode 100644 index 4816e4b1ba..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).errors.txt.diff +++ /dev/null @@ -1,26 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).errors.txt -+++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -- -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== index.js (0 errors) ==== - // esm format file - import * as cjsi from "inner/cjs/index.cjs"; -@@= skipped -24, +25 lines =@@ - cjsi; - mjsi; - typei; --==== node_modules/inner/index.d.ts (1 errors) ==== -+==== node_modules/inner/index.d.ts (0 errors) ==== - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. - import * as mjs from "inner/mjs/index.mjs"; - import * as type from "inner/js/index.js"; - export { cjs }; \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).types.diff deleted file mode 100644 index 1dcb539099..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).types -+++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=node20).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; - >mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).errors.txt.diff deleted file mode 100644 index d8a2e4916c..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).errors.txt.diff +++ /dev/null @@ -1,74 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).errors.txt -+++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).errors.txt -@@= skipped -0, +0 lines =@@ --node_modules/inner/index.d.ts(2,13): error TS2303: Circular definition of import alias 'cjs'. -- -- --==== index.js (0 errors) ==== -- // esm format file -- import * as cjsi from "inner/cjs/index.cjs"; -- import * as mjsi from "inner/mjs/index.mjs"; -- import * as typei from "inner/js/index.js"; -- cjsi; -- mjsi; -- typei; --==== index.mjs (0 errors) ==== -- // esm format file -- import * as cjsi from "inner/cjs/index.cjs"; -- import * as mjsi from "inner/mjs/index.mjs"; -- import * as typei from "inner/js/index.js"; -- cjsi; -- mjsi; -- typei; --==== index.cjs (0 errors) ==== -- // cjs format file -- import * as cjsi from "inner/cjs/index.cjs"; -- import * as mjsi from "inner/mjs/index.mjs"; -- import * as typei from "inner/js/index.js"; -- cjsi; -- mjsi; -- typei; --==== node_modules/inner/index.d.ts (1 errors) ==== -- // cjs format file -- import * as cjs from "inner/cjs/index.cjs"; -- ~~~ --!!! error TS2303: Circular definition of import alias 'cjs'. -- import * as mjs from "inner/mjs/index.mjs"; -- import * as type from "inner/js/index.js"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== node_modules/inner/index.d.mts (0 errors) ==== -- // esm format file -- import * as cjs from "inner/cjs/index.cjs"; -- import * as mjs from "inner/mjs/index.mjs"; -- import * as type from "inner/js/index.js"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== node_modules/inner/index.d.cts (0 errors) ==== -- // cjs format file -- import * as cjs from "inner/cjs/index.cjs"; -- import * as mjs from "inner/mjs/index.mjs"; -- import * as type from "inner/js/index.js"; -- export { cjs }; -- export { mjs }; -- export { type }; --==== package.json (0 errors) ==== -- { -- "name": "package", -- "private": true, -- "type": "module" -- } --==== node_modules/inner/package.json (0 errors) ==== -- { -- "name": "inner", -- "private": true, -- "exports": { -- "./cjs/*.cjs": "./*.cjs", -- "./mjs/*.mjs": "./*.mjs", -- "./js/*.js": "./*.js" -- } -- } -- -+ \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).types.diff deleted file mode 100644 index 32aa176903..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).types.diff +++ /dev/null @@ -1,131 +0,0 @@ ---- old.nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).types -+++ new.nodeModulesAllowJsPackagePatternExportsTrailers(module=nodenext).types -@@= skipped -5, +5 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; - >typei : typeof typei -@@= skipped -9, +9 lines =@@ - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.cjs.mjs -+>mjsi : typeof mjsi - - typei; - >typei : typeof typei -@@= skipped -11, +11 lines =@@ - >cjsi : typeof cjsi - - import * as mjsi from "inner/mjs/index.mjs"; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - import * as typei from "inner/js/index.js"; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - cjsi; - >cjsi : typeof cjsi - - mjsi; -->mjsi : typeof cjsi.mjs -+>mjsi : typeof mjsi - - typei; -->typei : typeof cjsi.mjs.cjs.type -+>typei : typeof typei - - === node_modules/inner/index.d.ts === - // cjs format file - import * as cjs from "inner/cjs/index.cjs"; -->cjs : any -+>cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; - >mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - export { cjs }; -->cjs : any -+>cjs : typeof cjs - - export { mjs }; - >mjs : typeof mjs - - export { type }; -->type : typeof mjs.cjs.cjs.type -+>type : typeof type - - === node_modules/inner/index.d.mts === - // esm format file -@@= skipped -40, +40 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.cjs.mjs.type -+>type : typeof type - - === node_modules/inner/index.d.cts === - // cjs format file -@@= skipped -20, +20 lines =@@ - >cjs : typeof cjs - - import * as mjs from "inner/mjs/index.mjs"; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - import * as type from "inner/js/index.js"; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type - - export { cjs }; - >cjs : typeof cjs - - export { mjs }; -->mjs : typeof cjs.mjs -+>mjs : typeof mjs - - export { type }; -->type : typeof cjs.mjs.cjs.type -+>type : typeof type diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).errors.txt.diff deleted file mode 100644 index a2dd4148f9..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).errors.txt.diff +++ /dev/null @@ -1,60 +0,0 @@ ---- old.nodeModulesAllowJsSynchronousCallErrors(module=node20).errors.txt -+++ new.nodeModulesAllowJsSynchronousCallErrors(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+error TS2468: Cannot find global value 'Promise'. - index.js(3,1): error TS8002: 'import ... =' can only be used in TypeScript files. - index.js(5,1): error TS8002: 'import ... =' can only be used in TypeScript files. -+index.js(6,23): error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.js(7,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+index.js(8,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - subfolder/index.js(3,1): error TS8002: 'import ... =' can only be used in TypeScript files. - subfolder/index.js(5,1): error TS8002: 'import ... =' can only be used in TypeScript files. -- -- --==== subfolder/index.js (2 errors) ==== -+subfolder/index.js(6,23): error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+subfolder/index.js(7,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+subfolder/index.js(8,24): error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+!!! error TS2468: Cannot find global value 'Promise'. -+==== subfolder/index.js (5 errors) ==== - // cjs format file - import {h} from "../index.js"; - import mod = require("../index.js"); -@@= skipped -14, +24 lines =@@ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - !!! error TS8002: 'import ... =' can only be used in TypeScript files. - export async function f() { -+ ~ -+!!! error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const mod3 = await import ("../index.js"); -+ ~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const mod4 = await import ("./index.js"); -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - h(); - } --==== index.js (2 errors) ==== -+==== index.js (5 errors) ==== - // esm format file - import {h as _h} from "./index.js"; - import mod = require("./index.js"); -@@= skipped -15, +21 lines =@@ - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - !!! error TS8002: 'import ... =' can only be used in TypeScript files. - export async function h() { -+ ~ -+!!! error TS2705: An async function or method in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const mod3 = await import ("./index.js"); -+ ~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - const mod4 = await import ("./subfolder/index.js"); -+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+!!! error TS2712: A dynamic import call in ES5 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. - f(); - } - ==== package.json (0 errors) ==== \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).types.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).types.diff deleted file mode 100644 index 3e4d28f7ef..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsSynchronousCallErrors(module=node20).types.diff +++ /dev/null @@ -1,28 +0,0 @@ ---- old.nodeModulesAllowJsSynchronousCallErrors(module=node20).types -+++ new.nodeModulesAllowJsSynchronousCallErrors(module=node20).types -@@= skipped -18, +18 lines =@@ - >f : () => Promise - - const mod3 = await import ("../index.js"); -->mod3 : typeof mod -->await import ("../index.js") : typeof mod -->import ("../index.js") : Promise -+>mod3 : { h(): Promise; default: typeof mod; } -+>await import ("../index.js") : { h(): Promise; default: typeof mod; } -+>import ("../index.js") : Promise<{ h(): Promise; default: typeof mod; }> - >"../index.js" : "../index.js" - - const mod4 = await import ("./index.js"); -@@= skipped -34, +34 lines =@@ - >h : () => Promise - - const mod3 = await import ("./index.js"); -->mod3 : typeof mod -->await import ("./index.js") : typeof mod -->import ("./index.js") : Promise -+>mod3 : { h(): Promise; default: typeof mod; } -+>await import ("./index.js") : { h(): Promise; default: typeof mod; } -+>import ("./index.js") : Promise<{ h(): Promise; default: typeof mod; }> - >"./index.js" : "./index.js" - - const mod4 = await import ("./subfolder/index.js"); \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsTopLevelAwait(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsTopLevelAwait(module=node20).errors.txt.diff deleted file mode 100644 index 42ebe78169..0000000000 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesAllowJsTopLevelAwait(module=node20).errors.txt.diff +++ /dev/null @@ -1,39 +0,0 @@ ---- old.nodeModulesAllowJsTopLevelAwait(module=node20).errors.txt -+++ new.nodeModulesAllowJsTopLevelAwait(module=node20).errors.txt -@@= skipped -0, +0 lines =@@ --subfolder/index.js(2,11): error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. --subfolder/index.js(4,5): error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. -- -- -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. -+index.js(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+index.js(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+subfolder/index.js(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+subfolder/index.js(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+ -+ -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== subfolder/index.js (2 errors) ==== - // cjs format file - const x = await 1; - ~~~~~ --!!! error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - export {x}; - for await (const y of []) {} - ~~~~~ --!!! error TS1309: The current file is a CommonJS module and cannot use 'await' at the top level. --==== index.js (0 errors) ==== -+!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. -+==== index.js (2 errors) ==== - // esm format file - const x = await 1; -+ ~~~~~ -+!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - export {x}; - for await (const y of []) {} -+ ~~~~~ -+!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'node20', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher. - ==== package.json (0 errors) ==== - { - "name": "package", \ No newline at end of file diff --git a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesCJSEmit1(module=node20).errors.txt.diff b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesCJSEmit1(module=node20).errors.txt.diff index 4c3562dec9..6e13ad03cb 100644 --- a/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesCJSEmit1(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submoduleAccepted/conformance/nodeModulesCJSEmit1(module=node20).errors.txt.diff @@ -2,15 +2,11 @@ +++ new.nodeModulesCJSEmit1(module=node20).errors.txt @@= skipped -0, +0 lines =@@ -/3.cjs(2,1): error TS2304: Cannot find name 'exports'. -+error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. +/5.cjs(1,8): error TS1192: Module '"/2"' has no default export. /5.cjs(2,8): error TS1192: Module '"/3"' has no default export. -+!!! error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node20'. - ==== /1.cjs (0 errors) ==== - module.exports = {}; - +@@= skipped -7, +7 lines =@@ ==== /2.cjs (0 errors) ==== exports.foo = 0;