diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 78bca28c26b15..030bc6076aa8d 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -2370,7 +2370,7 @@ namespace ts { function checkStrictModeLabeledStatement(node: LabeledStatement) { // Grammar checking for labeledStatement - if (inStrictMode && options.target! >= ScriptTarget.ES2015) { + if (inStrictMode && getEmitScriptTarget(options) >= ScriptTarget.ES2015) { if (isDeclarationStatement(node.statement) || isVariableStatement(node.statement)) { errorOnFirstToken(node.label, Diagnostics.A_label_is_not_allowed_here); } diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 38c193758be7a..6225cd3839d37 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1497,7 +1497,7 @@ namespace ts { } else if (isParameterPropertyDeclaration(declaration, declaration.parent)) { // foo = this.bar is illegal in esnext+useDefineForClassFields when bar is a parameter property - return !(compilerOptions.target === ScriptTarget.ESNext && useDefineForClassFields + return !(getEmitScriptTarget(compilerOptions) === ScriptTarget.ESNext && useDefineForClassFields && getContainingClass(declaration) === getContainingClass(usage) && isUsedInFunctionOrInstanceProperty(usage, declaration)); } @@ -1528,7 +1528,7 @@ namespace ts { return true; } if (isUsedInFunctionOrInstanceProperty(usage, declaration)) { - if (compilerOptions.target === ScriptTarget.ESNext && useDefineForClassFields + if (getEmitScriptTarget(compilerOptions) === ScriptTarget.ESNext && useDefineForClassFields && getContainingClass(declaration) && (isPropertyDeclaration(declaration) || isParameterPropertyDeclaration(declaration, declaration.parent))) { return !isPropertyImmediatelyReferencedWithinDeclaration(declaration, usage, /*stopAtAnyPropertyDeclaration*/ true); @@ -1920,7 +1920,7 @@ namespace ts { case SyntaxKind.ArrowFunction: // when targeting ES6 or higher there is no 'arguments' in an arrow function // for lower compile targets the resolved symbol is used to emit an error - if (compilerOptions.target! >= ScriptTarget.ES2015) { + if (getEmitScriptTarget(compilerOptions) >= ScriptTarget.ES2015) { break; } // falls through @@ -2094,7 +2094,7 @@ namespace ts { // Perform extra checks only if error reporting was requested if (nameNotFoundMessage) { - if (propertyWithInvalidInitializer && !(compilerOptions.target === ScriptTarget.ESNext && useDefineForClassFields)) { + if (propertyWithInvalidInitializer && !(getEmitScriptTarget(compilerOptions) === ScriptTarget.ESNext && useDefineForClassFields)) { // We have a match, but the reference occurred within a property initializer and the identifier also binds // to a local variable in the constructor where the code will be emitted. Note that this is actually allowed // with ESNext+useDefineForClassFields because the scope semantics are different. @@ -2735,7 +2735,7 @@ namespace ts { if (!isIdentifier(name)) { return undefined; } - const suppressInteropError = name.escapedText === InternalSymbolName.Default && !!(compilerOptions.allowSyntheticDefaultImports || compilerOptions.esModuleInterop); + const suppressInteropError = name.escapedText === InternalSymbolName.Default && !!(compilerOptions.allowSyntheticDefaultImports || getESModuleInterop(compilerOptions)); const targetSymbol = resolveESModuleSymbol(moduleSymbol, moduleSpecifier, /*dontResolveAlias*/ false, suppressInteropError); if (targetSymbol) { if (name.escapedText) { @@ -2824,18 +2824,18 @@ namespace ts { function reportInvalidImportEqualsExportMember(node: ImportDeclaration | ExportDeclaration | VariableDeclaration, name: Identifier, declarationName: string, moduleName: string) { if (moduleKind >= ModuleKind.ES2015) { - const message = compilerOptions.esModuleInterop ? Diagnostics._0_can_only_be_imported_by_using_a_default_import : + const message = getESModuleInterop(compilerOptions) ? Diagnostics._0_can_only_be_imported_by_using_a_default_import : Diagnostics._0_can_only_be_imported_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import; error(name, message, declarationName); } else { if (isInJSFile(node)) { - const message = compilerOptions.esModuleInterop ? Diagnostics._0_can_only_be_imported_by_using_a_require_call_or_by_using_a_default_import : + const message = getESModuleInterop(compilerOptions) ? Diagnostics._0_can_only_be_imported_by_using_a_require_call_or_by_using_a_default_import : Diagnostics._0_can_only_be_imported_by_using_a_require_call_or_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import; error(name, message, declarationName); } else { - const message = compilerOptions.esModuleInterop ? Diagnostics._0_can_only_be_imported_by_using_import_1_require_2_or_a_default_import : + const message = getESModuleInterop(compilerOptions) ? Diagnostics._0_can_only_be_imported_by_using_import_1_require_2_or_a_default_import : Diagnostics._0_can_only_be_imported_by_using_import_1_require_2_or_by_turning_on_the_esModuleInterop_flag_and_using_a_default_import; error(name, message, declarationName, declarationName, moduleName); } @@ -3297,6 +3297,12 @@ namespace ts { if (resolvedModule.isExternalLibraryImport && !resolutionExtensionIsTSOrJson(resolvedModule.extension)) { errorOnImplicitAnyModule(/*isError*/ false, errorNode, resolvedModule, moduleReference); } + if (getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.Node12 || getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.NodeNext) { + const isSyncImport = (currentSourceFile.impliedNodeFormat === ModuleKind.CommonJS && !findAncestor(location, isImportCall)) || !!findAncestor(location, isImportEqualsDeclaration); + if (isSyncImport && sourceFile.impliedNodeFormat === ModuleKind.ESNext) { + error(errorNode, Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_es_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead, moduleReference); + } + } // merged symbol is module declaration symbol combined with all augmentations return getMergedSymbol(sourceFile.symbol); } @@ -3358,7 +3364,6 @@ namespace ts { * Direct users to import source with .js extension if outputting an ES module. * @see https://github.com/microsoft/TypeScript/issues/42151 */ - const moduleKind = getEmitModuleKind(compilerOptions); if (moduleKind >= ModuleKind.ES2015) { replacedImportSource += ".js"; } @@ -3366,7 +3371,7 @@ namespace ts { } else if (!compilerOptions.resolveJsonModule && fileExtensionIs(moduleReference, Extension.Json) && - getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.NodeJs && + getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.Classic && hasJsonModuleEmitEnabled(compilerOptions)) { error(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference); } @@ -3450,7 +3455,7 @@ namespace ts { return symbol; } - if (compilerOptions.esModuleInterop) { + if (getESModuleInterop(compilerOptions)) { const referenceParent = referencingLocation.parent; if ( (isImportDeclaration(referenceParent) && getNamespaceDeclarationNode(referenceParent)) || @@ -5765,7 +5770,7 @@ namespace ts { const nonRootParts = chain.length > 1 ? createAccessFromSymbolChain(chain, chain.length - 1, 1) : undefined; const typeParameterNodes = overrideTypeArguments || lookupTypeParameterNodes(chain, 0, context); const specifier = getSpecifierForModuleSymbol(chain[0], context); - if (!(context.flags & NodeBuilderFlags.AllowNodeModulesRelativePaths) && getEmitModuleResolutionKind(compilerOptions) === ModuleResolutionKind.NodeJs && specifier.indexOf("/node_modules/") >= 0) { + if (!(context.flags & NodeBuilderFlags.AllowNodeModulesRelativePaths) && getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.Classic && specifier.indexOf("/node_modules/") >= 0) { // If ultimately we can only name the symbol with a reference that dives into a `node_modules` folder, we should error // since declaration files with these kinds of references are liable to fail when published :( context.encounteredError = true; @@ -6014,7 +6019,7 @@ namespace ts { if (nameType) { if (nameType.flags & TypeFlags.StringOrNumberLiteral) { const name = "" + (nameType as StringLiteralType | NumberLiteralType).value; - if (!isIdentifierText(name, compilerOptions.target) && !isNumericLiteralName(name)) { + if (!isIdentifierText(name, getEmitScriptTarget(compilerOptions)) && !isNumericLiteralName(name)) { return factory.createStringLiteral(name, !!singleQuote); } if (isNumericLiteralName(name) && startsWith(name, "-")) { @@ -6029,7 +6034,7 @@ namespace ts { } function createPropertyNameNodeForIdentifierOrLiteral(name: string, stringNamed?: boolean, singleQuote?: boolean) { - return isIdentifierText(name, compilerOptions.target) ? factory.createIdentifier(name) : + return isIdentifierText(name, getEmitScriptTarget(compilerOptions)) ? factory.createIdentifier(name) : !stringNamed && isNumericLiteralName(name) && +name >= 0 ? factory.createNumericLiteral(+name) : factory.createStringLiteral(name, !!singleQuote); } @@ -7142,7 +7147,7 @@ namespace ts { return; } let verbatimTargetName = unescapeLeadingUnderscores(target.escapedName); - if (verbatimTargetName === InternalSymbolName.ExportEquals && (compilerOptions.esModuleInterop || compilerOptions.allowSyntheticDefaultImports)) { + if (verbatimTargetName === InternalSymbolName.ExportEquals && (getESModuleInterop(compilerOptions) || compilerOptions.allowSyntheticDefaultImports)) { // target refers to an `export=` symbol that was hoisted into a synthetic default - rename here to match verbatimTargetName = InternalSymbolName.Default; } @@ -7831,7 +7836,7 @@ namespace ts { if (nameType) { if (nameType.flags & TypeFlags.StringOrNumberLiteral) { const name = "" + (nameType as StringLiteralType | NumberLiteralType).value; - if (!isIdentifierText(name, compilerOptions.target) && !isNumericLiteralName(name)) { + if (!isIdentifierText(name, getEmitScriptTarget(compilerOptions)) && !isNumericLiteralName(name)) { return `"${escapeString(name, CharacterCodes.doubleQuote)}"`; } if (isNumericLiteralName(name) && startsWith(name, "-")) { @@ -17506,7 +17511,7 @@ namespace ts { path = `${str}`; } // Otherwise write a dotted name if possible - else if (isIdentifierText(str, compilerOptions.target)) { + else if (isIdentifierText(str, getEmitScriptTarget(compilerOptions))) { path = `${path}.${str}`; } // Failing that, check if the name is already a computed name @@ -24561,7 +24566,7 @@ namespace ts { break; case SyntaxKind.PropertyDeclaration: case SyntaxKind.PropertySignature: - if (hasSyntacticModifier(container, ModifierFlags.Static) && !(compilerOptions.target === ScriptTarget.ESNext && useDefineForClassFields)) { + if (hasSyntacticModifier(container, ModifierFlags.Static) && !(getEmitScriptTarget(compilerOptions) === ScriptTarget.ESNext && useDefineForClassFields)) { error(node, Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks } @@ -27388,7 +27393,7 @@ namespace ts { grammarErrorOnNode(right, Diagnostics.Cannot_assign_to_private_method_0_Private_methods_are_not_writable, idText(right)); } - if (lexicallyScopedSymbol?.valueDeclaration && (compilerOptions.target === ScriptTarget.ESNext && !useDefineForClassFields)) { + if (lexicallyScopedSymbol?.valueDeclaration && (getEmitScriptTarget(compilerOptions) === ScriptTarget.ESNext && !useDefineForClassFields)) { const lexicalClass = getContainingClass(lexicallyScopedSymbol.valueDeclaration); const parentStaticFieldInitializer = findAncestor(node, (n) => { if (n === lexicalClass) return "quit"; @@ -30298,7 +30303,14 @@ namespace ts { function checkImportMetaProperty(node: MetaProperty) { if (moduleKind !== ModuleKind.ES2020 && moduleKind !== ModuleKind.ESNext && moduleKind !== ModuleKind.System) { - error(node, Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_esnext_or_system); + if (moduleKind === ModuleKind.Node12 || moduleKind === ModuleKind.NodeNext) { + if (getSourceFileOfNode(node).impliedNodeFormat !== ModuleKind.ESNext) { + error(node, Diagnostics.The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output); + } + } + else { + error(node, Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_esnext_system_node12_or_nodenext); + } } const file = getSourceFileOfNode(node); Debug.assert(!!(file.flags & NodeFlags.PossiblyContainsImportMeta), "Containing file is missing import meta node flag."); @@ -31265,10 +31277,10 @@ namespace ts { Diagnostics.await_expressions_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); diagnostics.add(diagnostic); } - if ((moduleKind !== ModuleKind.ESNext && moduleKind !== ModuleKind.System) || languageVersion < ScriptTarget.ES2017) { + if ((moduleKind !== ModuleKind.ESNext && moduleKind !== ModuleKind.System && !(moduleKind === ModuleKind.NodeNext && getSourceFileOfNode(node).impliedNodeFormat === ModuleKind.ESNext)) || languageVersion < ScriptTarget.ES2017) { span = getSpanOfTokenAtPosition(sourceFile, node.pos); const diagnostic = createFileDiagnostic(sourceFile, span.start, span.length, - Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_esnext_or_system_and_the_target_option_is_set_to_es2017_or_higher); + Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher); diagnostics.add(diagnostic); } } @@ -33488,7 +33500,7 @@ namespace ts { // - The constructor declares parameter properties // or the containing class declares instance member variables with initializers. const superCallShouldBeFirst = - (compilerOptions.target !== ScriptTarget.ESNext || !useDefineForClassFields) && + (getEmitScriptTarget(compilerOptions) !== ScriptTarget.ESNext || !useDefineForClassFields) && (some((node.parent as ClassDeclaration).members, isInstancePropertyWithInitializerOrPrivateIdentifierProperty) || some(node.parameters, p => hasSyntacticModifier(p, ModifierFlags.ParameterPropertyModifier))); @@ -35347,7 +35359,7 @@ namespace ts { function checkCollisionWithRequireExportsInGeneratedCode(node: Node, name: Identifier) { // No need to check for require or exports for ES6 modules and later - if (moduleKind >= ModuleKind.ES2015) { + if (moduleKind >= ModuleKind.ES2015 && !(moduleKind >= ModuleKind.Node12 && getSourceFileOfNode(node).impliedNodeFormat === ModuleKind.CommonJS)) { return; } @@ -37038,8 +37050,8 @@ namespace ts { * The name cannot be used as 'Object' of user defined types with special target. */ function checkClassNameCollisionWithObject(name: Identifier): void { - if (languageVersion === ScriptTarget.ES5 && name.escapedText === "Object" - && moduleKind < ModuleKind.ES2015) { + if (languageVersion >= ScriptTarget.ES5 && name.escapedText === "Object" + && (moduleKind < ModuleKind.ES2015 || getSourceFileOfNode(name).impliedNodeFormat === ModuleKind.CommonJS)) { error(name, Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_with_module_0, ModuleKind[moduleKind]); // https://github.com/Microsoft/TypeScript/issues/17494 } } @@ -38239,8 +38251,8 @@ namespace ts { checkAliasSymbol(node); if (node.kind === SyntaxKind.ImportSpecifier && idText(node.propertyName || node.name) === "default" && - compilerOptions.esModuleInterop && - moduleKind !== ModuleKind.System && moduleKind < ModuleKind.ES2015) { + getESModuleInterop(compilerOptions) && + moduleKind !== ModuleKind.System && (moduleKind < ModuleKind.ES2015 || getSourceFileOfNode(node).impliedNodeFormat === ModuleKind.CommonJS)) { checkExternalEmitHelpers(node, ExternalEmitHelpers.ImportDefault); } } @@ -38262,7 +38274,7 @@ namespace ts { if (importClause.namedBindings) { if (importClause.namedBindings.kind === SyntaxKind.NamespaceImport) { checkImportBinding(importClause.namedBindings); - if (moduleKind !== ModuleKind.System && moduleKind < ModuleKind.ES2015 && compilerOptions.esModuleInterop) { + if (moduleKind !== ModuleKind.System && (moduleKind < ModuleKind.ES2015 || getSourceFileOfNode(node).impliedNodeFormat === ModuleKind.CommonJS) && getESModuleInterop(compilerOptions)) { // import * as ns from "foo"; checkExternalEmitHelpers(node, ExternalEmitHelpers.ImportStar); } @@ -38310,7 +38322,7 @@ namespace ts { } } else { - if (moduleKind >= ModuleKind.ES2015 && !node.isTypeOnly && !(node.flags & NodeFlags.Ambient)) { + if (moduleKind >= ModuleKind.ES2015 && getSourceFileOfNode(node).impliedNodeFormat === undefined && !node.isTypeOnly && !(node.flags & NodeFlags.Ambient)) { // Import equals declaration is deprecated in es6 or above grammarErrorOnNode(node, Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead); } @@ -38355,12 +38367,12 @@ namespace ts { else if (node.exportClause) { checkAliasSymbol(node.exportClause); } - if (moduleKind !== ModuleKind.System && moduleKind < ModuleKind.ES2015) { + if (moduleKind !== ModuleKind.System && (moduleKind < ModuleKind.ES2015 || getSourceFileOfNode(node).impliedNodeFormat === ModuleKind.CommonJS)) { if (node.exportClause) { // export * as ns from "foo"; // For ES2015 modules, we emit it as a pair of `import * as a_1 ...; export { a_1 as ns }` and don't need the helper. // We only use the helper here when in esModuleInterop - if (compilerOptions.esModuleInterop) { + if (getESModuleInterop(compilerOptions)) { checkExternalEmitHelpers(node, ExternalEmitHelpers.ImportStar); } } @@ -38451,9 +38463,9 @@ namespace ts { } } else { - if (compilerOptions.esModuleInterop && + if (getESModuleInterop(compilerOptions) && moduleKind !== ModuleKind.System && - moduleKind < ModuleKind.ES2015 && + (moduleKind < ModuleKind.ES2015 || getSourceFileOfNode(node).impliedNodeFormat === ModuleKind.CommonJS) && idText(node.propertyName || node.name) === "default") { checkExternalEmitHelpers(node, ExternalEmitHelpers.ImportDefault); } @@ -38516,7 +38528,7 @@ namespace ts { } if (node.isExportEquals && !(node.flags & NodeFlags.Ambient)) { - if (moduleKind >= ModuleKind.ES2015) { + if (moduleKind >= ModuleKind.ES2015 && getSourceFileOfNode(node).impliedNodeFormat !== ModuleKind.CommonJS) { // export assignment is not supported in es6 modules grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead); } @@ -41596,9 +41608,9 @@ namespace ts { diagnostics.add(createDiagnosticForNode(forInOrOfStatement.awaitModifier, Diagnostics.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)); } - if ((moduleKind !== ModuleKind.ESNext && moduleKind !== ModuleKind.System) || languageVersion < ScriptTarget.ES2017) { + if ((moduleKind !== ModuleKind.ESNext && moduleKind !== ModuleKind.System && !(moduleKind === ModuleKind.NodeNext && getSourceFileOfNode(forInOrOfStatement).impliedNodeFormat === ModuleKind.ESNext)) || languageVersion < ScriptTarget.ES2017) { diagnostics.add(createDiagnosticForNode(forInOrOfStatement.awaitModifier, - Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_esnext_or_system_and_the_target_option_is_set_to_es2017_or_higher)); + Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher)); } } } @@ -41977,8 +41989,7 @@ namespace ts { return grammarErrorOnNode(node.exclamationToken, message); } - const moduleKind = getEmitModuleKind(compilerOptions); - if (moduleKind < ModuleKind.ES2015 && moduleKind !== ModuleKind.System && + if ((moduleKind < ModuleKind.ES2015 || getSourceFileOfNode(node).impliedNodeFormat === ModuleKind.CommonJS) && moduleKind !== ModuleKind.System && !(node.parent.parent.flags & NodeFlags.Ambient) && hasSyntacticModifier(node.parent.parent, ModifierFlags.Export)) { checkESModuleMarker(node.name); } @@ -42348,7 +42359,7 @@ namespace ts { function checkGrammarImportCallExpression(node: ImportCall): boolean { if (moduleKind === ModuleKind.ES2015) { - return grammarErrorOnNode(node, Diagnostics.Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_esnext_commonjs_amd_system_or_umd); + return grammarErrorOnNode(node, Diagnostics.Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_esnext_commonjs_amd_system_umd_node12_or_nodenext); } if (node.typeArguments) { diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 687c388223e51..7b61bd51ffe6b 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -381,7 +381,9 @@ namespace ts { es6: ModuleKind.ES2015, es2015: ModuleKind.ES2015, es2020: ModuleKind.ES2020, - esnext: ModuleKind.ESNext + esnext: ModuleKind.ESNext, + node12: ModuleKind.Node12, + nodenext: ModuleKind.NodeNext, })), affectsModuleResolution: true, affectsEmit: true, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index d2ddbc8b0a4ec..274c91179c817 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -944,7 +944,7 @@ "category": "Error", "code": 1322 }, - "Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.": { + "Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'.": { "category": "Error", "code": 1323 }, @@ -1020,7 +1020,7 @@ "category": "Error", "code": 1342 }, - "The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'.": { + "The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'.": { "category": "Error", "code": 1343 }, @@ -1152,7 +1152,7 @@ "category": "Message", "code": 1377 }, - "Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext' or 'system', and the 'target' option is set to 'es2017' or higher.": { + "Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.": { "category": "Error", "code": 1378 }, @@ -1368,7 +1368,7 @@ "category": "Error", "code": 1431 }, - "Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext' or 'system', and the 'target' option is set to 'es2017' or higher.": { + "Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.": { "category": "Error", "code": 1432 }, @@ -1376,6 +1376,14 @@ "category": "Error", "code": 1433 }, + "The 'import.meta' meta-property is not allowed in files which will build into CommonJS output.": { + "category": "Error", + "code": 1434 + }, + "Module '{0}' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead.": { + "category": "Error", + "code": 1435 + }, "The types of '{0}' are incompatible between these types.": { "category": "Error", diff --git a/src/compiler/factory/emitHelpers.ts b/src/compiler/factory/emitHelpers.ts index f3e0004efd407..8bc64e4d08f1c 100644 --- a/src/compiler/factory/emitHelpers.ts +++ b/src/compiler/factory/emitHelpers.ts @@ -133,7 +133,7 @@ namespace ts { // ES2018 Helpers function createAssignHelper(attributesSegments: Expression[]) { - if (context.getCompilerOptions().target! >= ScriptTarget.ES2015) { + if (getEmitScriptTarget(context.getCompilerOptions()) >= ScriptTarget.ES2015) { return factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Object"), "assign"), /*typeArguments*/ undefined, attributesSegments); diff --git a/src/compiler/factory/nodeFactory.ts b/src/compiler/factory/nodeFactory.ts index 4b75321a84ee2..4607171fc7b26 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -5055,6 +5055,7 @@ namespace ts { node.transformFlags = propagateChildrenFlags(node.statements) | propagateChildFlags(node.endOfFileToken); + node.impliedNodeFormat = source.impliedNodeFormat; return node; } diff --git a/src/compiler/factory/utilities.ts b/src/compiler/factory/utilities.ts index a8397d33f5407..e5639d4d2f307 100644 --- a/src/compiler/factory/utilities.ts +++ b/src/compiler/factory/utilities.ts @@ -405,7 +405,7 @@ namespace ts { if (compilerOptions.importHelpers && isEffectiveExternalModule(sourceFile, compilerOptions)) { let namedBindings: NamedImportBindings | undefined; const moduleKind = getEmitModuleKind(compilerOptions); - if (moduleKind >= ModuleKind.ES2015 && moduleKind <= ModuleKind.ESNext) { + if ((moduleKind >= ModuleKind.ES2015 && moduleKind <= ModuleKind.ESNext) || sourceFile.impliedNodeFormat === ModuleKind.ESNext) { // use named imports const helpers = getEmitHelpers(sourceFile); if (helpers) { @@ -462,9 +462,9 @@ namespace ts { } const moduleKind = getEmitModuleKind(compilerOptions); - let create = (hasExportStarsToExportValues || (compilerOptions.esModuleInterop && hasImportStarOrImportDefault)) + let create = (hasExportStarsToExportValues || (getESModuleInterop(compilerOptions) && hasImportStarOrImportDefault)) && moduleKind !== ModuleKind.System - && moduleKind < ModuleKind.ES2015; + && (moduleKind < ModuleKind.ES2015 || node.impliedNodeFormat === ModuleKind.CommonJS); if (!create) { const helpers = getEmitHelpers(node); if (helpers) { diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index 897aafa261113..ab5f754e9eeb3 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -113,6 +113,7 @@ namespace ts { typesVersions?: MapLike>; main?: string; tsconfig?: string; + type?: string; } interface PackageJson extends PackageJsonPathFields { @@ -816,7 +817,20 @@ namespace ts { else { let moduleResolution = compilerOptions.moduleResolution; if (moduleResolution === undefined) { - moduleResolution = getEmitModuleKind(compilerOptions) === ModuleKind.CommonJS ? ModuleResolutionKind.NodeJs : ModuleResolutionKind.Classic; + switch (getEmitModuleKind(compilerOptions)) { + case ModuleKind.CommonJS: + moduleResolution = ModuleResolutionKind.NodeJs; + break; + case ModuleKind.Node12: + moduleResolution = ModuleResolutionKind.Node12; + break; + case ModuleKind.NodeNext: + moduleResolution = ModuleResolutionKind.NodeNext; + break; + default: + moduleResolution = ModuleResolutionKind.Classic; + break; + } if (traceEnabled) { trace(host, Diagnostics.Module_resolution_kind_is_not_specified_using_0, ModuleResolutionKind[moduleResolution]); } @@ -829,6 +843,8 @@ namespace ts { perfLogger.logStartResolveModule(moduleName /* , containingFile, ModuleResolutionKind[moduleResolution]*/); switch (moduleResolution) { + case ModuleResolutionKind.Node12: + case ModuleResolutionKind.NodeNext: // TODO: Implement node12/nodenext resolution rules case ModuleResolutionKind.NodeJs: result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference); break; @@ -1310,7 +1326,8 @@ namespace ts { versionPaths: VersionPaths | undefined; } - function getPackageJsonInfo(packageDirectory: string, onlyRecordFailures: boolean, state: ModuleResolutionState): PackageJsonInfo | undefined { + /*@internal*/ + export function getPackageJsonInfo(packageDirectory: string, onlyRecordFailures: boolean, state: ModuleResolutionState): PackageJsonInfo | undefined { const { host, traceEnabled } = state; const packageJsonPath = combinePaths(packageDirectory, "package.json"); if (onlyRecordFailures) { diff --git a/src/compiler/moduleSpecifiers.ts b/src/compiler/moduleSpecifiers.ts index 45b31154344c8..cd43fe379afe8 100644 --- a/src/compiler/moduleSpecifiers.ts +++ b/src/compiler/moduleSpecifiers.ts @@ -683,6 +683,14 @@ namespace ts.moduleSpecifiers { return ext; case Extension.TsBuildInfo: return Debug.fail(`Extension ${Extension.TsBuildInfo} is unsupported:: FileName:: ${fileName}`); + case Extension.Dmts: + case Extension.Mts: + case Extension.Mjs: + return Extension.Mjs; + case Extension.Dcts: + case Extension.Cts: + case Extension.Cjs: + return Extension.Cjs; default: return Debug.assertNever(ext); } diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 91529ceada8d4..bc68220e9879a 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -738,6 +738,55 @@ namespace ts { configFileParseResult.errors; } + /** + * A function for determining if a given file is esm or cjs format, assuming modern node module resolution rules, as configured by the + * `options` parameter. + * + * @param fileName The normalized absolute path to check the format of (it need not exist on disk) + * @param packageJsonInfoCache (Optional) A cache for package file lookups - it's best to have a cache when this function is called often + * @param host The ModuleResolutionHost which can perform the filesystem lookups for package json data + * @param options The compiler options to perform the analysis under - relevant options are `moduleResolution` and `traceResolution` + * @returns `undefined` if the path has no relevant implied format, `ModuleKind.ESNext` for esm format, and `ModuleKind.CommonJS` for cjs format + */ + export function getImpliedNodeFormatForFile(fileName: Path, packageJsonInfoCache: PackageJsonInfoCache | undefined, host: ModuleResolutionHost, options: CompilerOptions): ModuleKind.ESNext | ModuleKind.CommonJS | undefined { + switch (getEmitModuleResolutionKind(options)) { + case ModuleResolutionKind.Node12: + case ModuleResolutionKind.NodeNext: + return fileExtensionIsOneOf(fileName, [Extension.Dmts, Extension.Mts, Extension.Mjs]) ? ModuleKind.ESNext : + fileExtensionIsOneOf(fileName, [Extension.Dcts, Extension.Cts, Extension.Cjs]) ? ModuleKind.CommonJS : + fileExtensionIsOneOf(fileName, [Extension.Dts, Extension.Ts, Extension.Tsx, Extension.Js, Extension.Jsx]) ? lookupFromPackageJson() : + undefined; // other extensions, like `json` or `tsbuildinfo`, are set as `undefined` here but they should never be fed through the transformer pipeline + default: + return undefined; + } + function lookupFromPackageJson(): ModuleKind.ESNext | ModuleKind.CommonJS { + const state: { + host: ModuleResolutionHost; + compilerOptions: CompilerOptions; + traceEnabled: boolean; + failedLookupLocations: Push; + resultFromCache?: ResolvedModuleWithFailedLookupLocations; + packageJsonInfoCache: PackageJsonInfoCache | undefined; + } = { + host, + compilerOptions: options, + traceEnabled: isTraceEnabled(options, host), + failedLookupLocations: [], + packageJsonInfoCache + }; + const parts = getPathComponents(fileName); + parts.pop(); + while (parts.length > 0) { + const pkg = getPackageJsonInfo(getPathFromPathComponents(parts), /*onlyRecordFailures*/ false, state); + if (pkg) { + return pkg.packageJsonContent?.type === "module" ? ModuleKind.ESNext : ModuleKind.CommonJS; + } + parts.pop(); + } + return ModuleKind.CommonJS; + } + } + /** * Determine if source file needs to be re-created even if its text hasn't changed */ @@ -1453,8 +1502,8 @@ namespace ts { for (const oldSourceFile of oldSourceFiles) { let newSourceFile = host.getSourceFileByPath - ? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.resolvedPath, options.target!, /*onError*/ undefined, shouldCreateNewSourceFile) - : host.getSourceFile(oldSourceFile.fileName, options.target!, /*onError*/ undefined, shouldCreateNewSourceFile); // TODO: GH#18217 + ? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.resolvedPath, getEmitScriptTarget(options), /*onError*/ undefined, shouldCreateNewSourceFile) + : host.getSourceFile(oldSourceFile.fileName, getEmitScriptTarget(options), /*onError*/ undefined, shouldCreateNewSourceFile); // TODO: GH#18217 if (!newSourceFile) { return StructureIsReused.Not; @@ -2609,7 +2658,7 @@ namespace ts { // We haven't looked for this file, do so now and cache result const file = host.getSourceFile( fileName, - options.target!, + getEmitScriptTarget(options), hostErrorMessage => addFilePreprocessingFileExplainingDiagnostic(/*file*/ undefined, reason, Diagnostics.Cannot_read_file_0_Colon_1, [fileName, hostErrorMessage]), shouldCreateNewSourceFile ); @@ -2642,6 +2691,10 @@ namespace ts { file.path = path; file.resolvedPath = toPath(fileName); file.originalFileName = originalFileName; + // It's a _little odd_ that we can't set `impliedNodeFormat` until the program step - but it's the first and only time we have a resolution cache + // and a freshly made source file node on hand at the same time, and we need both to set the field. Persisting the resolution cache all the way + // to the check and emit steps would be bad - so we much prefer detecting and storing the format information on the source file node upfront. + file.impliedNodeFormat = getImpliedNodeFormatForFile(file.resolvedPath, moduleResolutionCache?.getPackageJsonInfoCache(), host, options); addFileIncludeReason(file, reason); if (host.useCaseSensitiveFileNames()) { @@ -3176,7 +3229,7 @@ namespace ts { createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noImplicitUseStrict", "alwaysStrict"); } - const languageVersion = options.target || ScriptTarget.ES3; + const languageVersion = getEmitScriptTarget(options); const firstNonAmbientExternalModuleSourceFile = find(files, f => isExternalModule(f) && !f.isDeclarationFile); if (options.isolatedModules) { @@ -3461,7 +3514,7 @@ namespace ts { message = Diagnostics.File_is_library_specified_here; break; } - const target = forEachEntry(targetOptionDeclaration.type, (value, key) => value === options.target ? key : undefined); + const target = forEachEntry(targetOptionDeclaration.type, (value, key) => value === getEmitScriptTarget(options) ? key : undefined); configFileNode = target ? getOptionsSyntaxByValue("target", target) : undefined; message = Diagnostics.File_is_default_library_for_target_specified_here; break; diff --git a/src/compiler/transformer.ts b/src/compiler/transformer.ts index 732205c00a34b..4c4b07d23a43a 100644 --- a/src/compiler/transformer.ts +++ b/src/compiler/transformer.ts @@ -8,6 +8,9 @@ namespace ts { return transformECMAScriptModule; case ModuleKind.System: return transformSystemModule; + case ModuleKind.Node12: + case ModuleKind.NodeNext: + return transformNodeModule; default: return transformModule; } diff --git a/src/compiler/transformers/classFields.ts b/src/compiler/transformers/classFields.ts index e820851dde949..afc5ea20be579 100644 --- a/src/compiler/transformers/classFields.ts +++ b/src/compiler/transformers/classFields.ts @@ -139,7 +139,7 @@ namespace ts { function transformSourceFile(node: SourceFile) { const options = context.getCompilerOptions(); if (node.isDeclarationFile - || useDefineForClassFields && options.target === ScriptTarget.ESNext) { + || useDefineForClassFields && getEmitScriptTarget(options) === ScriptTarget.ESNext) { return node; } const visited = visitEachChild(node, visitor, context); diff --git a/src/compiler/transformers/jsx.ts b/src/compiler/transformers/jsx.ts index 55c606f883218..7cc7c53550330 100644 --- a/src/compiler/transformers/jsx.ts +++ b/src/compiler/transformers/jsx.ts @@ -292,7 +292,7 @@ namespace ts { // When there are no attributes, React wants "null" } else { - const target = compilerOptions.target; + const target = getEmitScriptTarget(compilerOptions); if (target && target >= ScriptTarget.ES2018) { objectProperties = factory.createObjectLiteralExpression( flatten( diff --git a/src/compiler/transformers/module/esnextAnd2015.ts b/src/compiler/transformers/module/esnextAnd2015.ts index 4a7e297722e86..a4e75b84c8b7f 100644 --- a/src/compiler/transformers/module/esnextAnd2015.ts +++ b/src/compiler/transformers/module/esnextAnd2015.ts @@ -5,7 +5,10 @@ namespace ts { factory, getEmitHelperFactory: emitHelpers, } = context; + const host = context.getEmitHost(); + const resolver = context.getEmitResolver(); const compilerOptions = context.getCompilerOptions(); + const languageVersion = getEmitScriptTarget(compilerOptions); const previousOnEmitNode = context.onEmitNode; const previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; @@ -14,6 +17,8 @@ namespace ts { context.enableSubstitution(SyntaxKind.Identifier); let helperNameSubstitutions: ESMap | undefined; + let currentSourceFile: SourceFile | undefined; + let importRequireStatements: [ImportDeclaration, VariableStatement] | undefined; return chainBundle(context, transformSourceFile); function transformSourceFile(node: SourceFile) { @@ -22,7 +27,16 @@ namespace ts { } if (isExternalModule(node) || compilerOptions.isolatedModules) { - const result = updateExternalModule(node); + currentSourceFile = node; + importRequireStatements = undefined; + let result = updateExternalModule(node); + currentSourceFile = undefined; + if (importRequireStatements) { + result = factory.updateSourceFile( + result, + setTextRange(factory.createNodeArray(insertStatementsAfterCustomPrologue(result.statements.slice(), importRequireStatements)), result.statements), + ); + } if (!isExternalModule(node) || some(result.statements, isExternalModuleIndicator)) { return result; } @@ -55,8 +69,10 @@ namespace ts { function visitor(node: Node): VisitResult { switch (node.kind) { case SyntaxKind.ImportEqualsDeclaration: - // Elide `import=` as it is not legal with --module ES6 - return undefined; + // Though an error in es2020 modules, in node-flavor es2020 modules, we can helpfully transform this to a synthetic `require` call + // To give easy access to a synchronous `require` in node-flavor esm. We do the transform even in scenarios where we error, but `import.meta.url` + // is available, just because the output is reasonable for a node-like runtime. + return getEmitScriptTarget(compilerOptions) >= ModuleKind.ES2020 ? visitImportEqualsDeclaration(node as ImportEqualsDeclaration) : undefined; case SyntaxKind.ExportAssignment: return visitExportAssignment(node as ExportAssignment); case SyntaxKind.ExportDeclaration: @@ -67,6 +83,106 @@ namespace ts { return node; } + /** + * Creates a `require()` call to import an external module. + * + * @param importNode The declararation to import. + */ + function createRequireCall(importNode: ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration) { + const moduleName = getExternalModuleNameLiteral(factory, importNode, Debug.checkDefined(currentSourceFile), host, resolver, compilerOptions); + const args: Expression[] = []; + if (moduleName) { + args.push(moduleName); + } + + if (!importRequireStatements) { + const createRequireName = factory.createUniqueName("_createRequire", GeneratedIdentifierFlags.Optimistic | GeneratedIdentifierFlags.FileLevel); + const importStatement = factory.createImportDeclaration( + /*decorators*/ undefined, + /*modifiers*/ undefined, + factory.createImportClause( + /*isTypeOnly*/ false, + /*name*/ undefined, + factory.createNamedImports([ + factory.createImportSpecifier(factory.createIdentifier("createRequire"), createRequireName) + ]) + ), + factory.createStringLiteral("module") + ); + const requireHelperName = factory.createUniqueName("__require", GeneratedIdentifierFlags.Optimistic | GeneratedIdentifierFlags.FileLevel); + const requireStatement = factory.createVariableStatement( + /*modifiers*/ undefined, + factory.createVariableDeclarationList( + [ + factory.createVariableDeclaration( + requireHelperName, + /*exclamationToken*/ undefined, + /*type*/ undefined, + factory.createCallExpression(factory.cloneNode(createRequireName), /*typeArguments*/ undefined, [ + factory.createPropertyAccessExpression(factory.createMetaProperty(SyntaxKind.ImportKeyword, factory.createIdentifier("meta")), factory.createIdentifier("url")) + ]) + ) + ], + /*flags*/ languageVersion >= ScriptTarget.ES2015 ? NodeFlags.Const : NodeFlags.None + ) + ); + importRequireStatements = [importStatement, requireStatement]; + + } + + const name = importRequireStatements[1].declarationList.declarations[0].name; + Debug.assertNode(name, isIdentifier); + return factory.createCallExpression(factory.cloneNode(name), /*typeArguments*/ undefined, args); + } + + /** + * Visits an ImportEqualsDeclaration node. + * + * @param node The node to visit. + */ + function visitImportEqualsDeclaration(node: ImportEqualsDeclaration): VisitResult { + Debug.assert(isExternalModuleImportEqualsDeclaration(node), "import= for internal module references should be handled in an earlier transformer."); + + let statements: Statement[] | undefined; + statements = append(statements, + setOriginalNode( + setTextRange( + factory.createVariableStatement( + /*modifiers*/ undefined, + factory.createVariableDeclarationList( + [ + factory.createVariableDeclaration( + factory.cloneNode(node.name), + /*exclamationToken*/ undefined, + /*type*/ undefined, + createRequireCall(node) + ) + ], + /*flags*/ languageVersion >= ScriptTarget.ES2015 ? NodeFlags.Const : NodeFlags.None + ) + ), + node), + node + ) + ); + + statements = appendExportsOfImportEqualsDeclaration(statements, node); + + return singleOrMany(statements); + } + + function appendExportsOfImportEqualsDeclaration(statements: Statement[] | undefined, node: ImportEqualsDeclaration) { + if (hasSyntacticModifier(node, ModifierFlags.Export)) { + statements = append(statements, factory.createExportDeclaration( + /*decorators*/ undefined, + /*modifiers*/ undefined, + node.isTypeOnly, + factory.createNamedExports([factory.createExportSpecifier(/*propertyName*/ undefined, idText(node.name))]) + )); + } + return statements; + } + function visitExportAssignment(node: ExportAssignment): VisitResult { // Elide `export=` as it is not legal with --module ES6 return node.isExportEquals ? undefined : node; diff --git a/src/compiler/transformers/module/module.ts b/src/compiler/transformers/module/module.ts index 4d0f1d22b69f1..2c7d747c30ede 100644 --- a/src/compiler/transformers/module/module.ts +++ b/src/compiler/transformers/module/module.ts @@ -546,7 +546,7 @@ namespace ts { return node; } - if (isImportCall(node)) { + if (isImportCall(node) && currentSourceFile.impliedNodeFormat === undefined) { return visitImportCallExpression(node); } else if (isDestructuringAssignment(node)) { @@ -715,7 +715,7 @@ namespace ts { } const promise = factory.createNewExpression(factory.createIdentifier("Promise"), /*typeArguments*/ undefined, [func]); - if (compilerOptions.esModuleInterop) { + if (getESModuleInterop(compilerOptions)) { return factory.createCallExpression(factory.createPropertyAccessExpression(promise, factory.createIdentifier("then")), /*typeArguments*/ undefined, [emitHelpers().createImportStarCallbackHelper()]); } return promise; @@ -729,7 +729,7 @@ namespace ts { // if we simply do require in resolve callback in Promise constructor. We will execute the loading immediately const promiseResolveCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Promise"), "resolve"), /*typeArguments*/ undefined, /*argumentsArray*/ []); let requireCall: Expression = factory.createCallExpression(factory.createIdentifier("require"), /*typeArguments*/ undefined, arg ? [arg] : []); - if (compilerOptions.esModuleInterop) { + if (getESModuleInterop(compilerOptions)) { requireCall = emitHelpers().createImportStarHelper(requireCall); } @@ -765,7 +765,7 @@ namespace ts { } function getHelperExpressionForExport(node: ExportDeclaration, innerExpr: Expression) { - if (!compilerOptions.esModuleInterop || getEmitFlags(node) & EmitFlags.NeverApplyImportHelper) { + if (!getESModuleInterop(compilerOptions) || getEmitFlags(node) & EmitFlags.NeverApplyImportHelper) { return innerExpr; } if (getExportNeedsImportStarHelper(node)) { @@ -775,7 +775,7 @@ namespace ts { } function getHelperExpressionForImport(node: ImportDeclaration, innerExpr: Expression) { - if (!compilerOptions.esModuleInterop || getEmitFlags(node) & EmitFlags.NeverApplyImportHelper) { + if (!getESModuleInterop(compilerOptions) || getEmitFlags(node) & EmitFlags.NeverApplyImportHelper) { return innerExpr; } if (getImportNeedsImportStarHelper(node)) { @@ -1035,7 +1035,7 @@ namespace ts { } else { const exportNeedsImportDefault = - !!compilerOptions.esModuleInterop && + !!getESModuleInterop(compilerOptions) && !(getEmitFlags(node) & EmitFlags.NeverApplyImportHelper) && idText(specifier.propertyName || specifier.name) === "default"; const exportedValue = factory.createPropertyAccessExpression( diff --git a/src/compiler/transformers/module/node.ts b/src/compiler/transformers/module/node.ts new file mode 100644 index 0000000000000..b1addf4f3ece2 --- /dev/null +++ b/src/compiler/transformers/module/node.ts @@ -0,0 +1,84 @@ +/*@internal*/ +namespace ts { + export function transformNodeModule(context: TransformationContext) { + const previousOnSubstituteNode = context.onSubstituteNode; + const previousOnEmitNode = context.onEmitNode; + + const esmTransform = transformECMAScriptModule(context); + + const esmOnSubstituteNode = context.onSubstituteNode; + const esmOnEmitNode = context.onEmitNode; + + context.onSubstituteNode = previousOnSubstituteNode; + context.onEmitNode = previousOnEmitNode; + + const cjsTransform = transformModule(context); + + const cjsOnSubstituteNode = context.onSubstituteNode; + const cjsOnEmitNode = context.onEmitNode; + + context.onSubstituteNode = onSubstituteNode; + context.onEmitNode = onEmitNode; + context.enableSubstitution(SyntaxKind.SourceFile); + context.enableEmitNotification(SyntaxKind.SourceFile); + + let currentSourceFile: SourceFile | undefined; + return transformSourceFileOrBundle; + + function onSubstituteNode(hint: EmitHint, node: Node) { + if (isSourceFile(node)) { + currentSourceFile = node; + // Neither component transform wants substitution notifications for `SourceFile`s, and, in fact, relies on + // the source file emit notification to setup scope variables for substitutions (so we _cannot_ call their substitute + // functions on source files safely, as that context only gets setup in a later pipeline phase!) + return previousOnSubstituteNode(hint, node); + } + else { + if (!currentSourceFile) { + return previousOnSubstituteNode(hint, node); + } + if (currentSourceFile.impliedNodeFormat === ModuleKind.ESNext) { + return esmOnSubstituteNode(hint, node); + } + return cjsOnSubstituteNode(hint, node); + } + } + + function onEmitNode(hint: EmitHint, node: Node, emitCallback: (hint: EmitHint, node: Node) => void): void { + if (isSourceFile(node)) { + currentSourceFile = node; + } + if (!currentSourceFile) { + return previousOnEmitNode(hint, node, emitCallback); + } + if (currentSourceFile.impliedNodeFormat === ModuleKind.ESNext) { + return esmOnEmitNode(hint, node, emitCallback); + } + return cjsOnEmitNode(hint, node, emitCallback); + } + + function getModuleTransformForFile(file: SourceFile): (typeof esmTransform) { + return file.impliedNodeFormat === ModuleKind.ESNext ? esmTransform : cjsTransform; + } + + function transformSourceFile(node: SourceFile) { + if (node.isDeclarationFile) { + return node; + } + + currentSourceFile = node; + const result = getModuleTransformForFile(node)(node); + currentSourceFile = undefined; + Debug.assert(isSourceFile(result)); + return result; + } + + function transformSourceFileOrBundle(node: SourceFile | Bundle) { + return node.kind === SyntaxKind.SourceFile ? transformSourceFile(node) : transformBundle(node); + } + + function transformBundle(node: Bundle) { + return context.factory.createBundle(map(node.sourceFiles, transformSourceFile), node.prepends); + } + } +} diff --git a/src/compiler/tsconfig.json b/src/compiler/tsconfig.json index 5f118cf1e47bd..c5db068d120c1 100644 --- a/src/compiler/tsconfig.json +++ b/src/compiler/tsconfig.json @@ -63,6 +63,7 @@ "transformers/module/module.ts", "transformers/module/system.ts", "transformers/module/esnextAnd2015.ts", + "transformers/module/node.ts", "transformers/declarations/diagnostics.ts", "transformers/declarations.ts", "transformer.ts", diff --git a/src/compiler/types.ts b/src/compiler/types.ts index e375b0a77acac..d6e196b707c34 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -3532,6 +3532,20 @@ namespace ts { hasNoDefaultLib: boolean; languageVersion: ScriptTarget; + + /** + * When `module` is `Node12` or `NodeNext`, this field controls weather the + * source file in question is an ESNext-output-format file, or a CommonJS-output-format + * module. This is derived by the module resolver as it looks up the file, since + * it is derived from either the file extension of the module, or the containing + * `package.json` context, and affects both checking and emit. + * + * It is _public_ so that (pre)transformers can set this field, + * since it switches the builtin `node` module transform. Generally speaking, if unset, + * the field is treated as though it is `ModuleKind.CommonJS`. + */ + impliedNodeFormat?: ModuleKind.ESNext | ModuleKind.CommonJS; + /* @internal */ scriptKind: ScriptKind; /** @@ -5893,7 +5907,13 @@ namespace ts { export enum ModuleResolutionKind { Classic = 1, - NodeJs = 2 + NodeJs = 2, + // Starting with node12, node's module resolver has significant departures from tranditional cjs resolution + // to better support ecmascript modules and their use within node - more features are still being added, so + // we can expect it co change over time, and as such, offer both a `NodeNext` moving resolution target, and a `Node12` + // version-anchored resolution target + Node12 = 3, + NodeNext = 99, // Not simply `Node12` so that compiled code linked against TS can use the `Next` value reliably (same as with `ModuleKind`) } export interface PluginImport { @@ -6046,7 +6066,7 @@ namespace ts { suppressExcessPropertyErrors?: boolean; suppressImplicitAnyIndexErrors?: boolean; /* @internal */ suppressOutputPathCheck?: boolean; - target?: ScriptTarget; // TODO: GH#18217 frequently asserted as defined + target?: ScriptTarget; traceResolution?: boolean; useUnknownInCatchVariables?: boolean; resolveJsonModule?: boolean; @@ -6098,7 +6118,11 @@ namespace ts { // module kind). ES2015 = 5, ES2020 = 6, - ESNext = 99 + ESNext = 99, + + // Node12+ is an amalgam of commonjs (albeit updated) and es2020+, and represents a distinct module system from es2020/esnext + Node12 = 100, + NodeNext = 199, } export const enum JsxEmit { @@ -6492,7 +6516,13 @@ namespace ts { Js = ".js", Jsx = ".jsx", Json = ".json", - TsBuildInfo = ".tsbuildinfo" + TsBuildInfo = ".tsbuildinfo", + Mjs = ".mjs", + Mts = ".mts", + Dmts = ".d.mts", + Cjs = ".cjs", + Cts = ".cts", + Dcts = ".d.cts", } export interface ResolvedModuleWithFailedLookupLocations { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 71689f76c7013..3b949fa7807a9 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -787,8 +787,12 @@ namespace ts { return symbol.declarations?.find(d => !isExternalModuleAugmentation(d) && !(isModuleDeclaration(d) && isGlobalScopeAugmentation(d))); } + function isCommonJSContainingModuleKind(kind: ModuleKind) { + return kind === ModuleKind.CommonJS || kind === ModuleKind.Node12 || kind === ModuleKind.NodeNext; + } + export function isEffectiveExternalModule(node: SourceFile, compilerOptions: CompilerOptions) { - return isExternalModule(node) || compilerOptions.isolatedModules || ((getEmitModuleKind(compilerOptions) === ModuleKind.CommonJS) && !!node.commonJsModuleIndicator); + return isExternalModule(node) || compilerOptions.isolatedModules || (isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator); } /** @@ -6016,8 +6020,11 @@ namespace ts { return scriptKind === ScriptKind.TSX || scriptKind === ScriptKind.JSX || scriptKind === ScriptKind.JS || scriptKind === ScriptKind.JSON ? LanguageVariant.JSX : LanguageVariant.Standard; } - export function getEmitScriptTarget(compilerOptions: CompilerOptions) { - return compilerOptions.target || ScriptTarget.ES3; + export function getEmitScriptTarget(compilerOptions: {module?: CompilerOptions["module"], target?: CompilerOptions["target"]}) { + return compilerOptions.target || + (compilerOptions.module === ModuleKind.Node12 && ScriptTarget.ES2020) || + (compilerOptions.module === ModuleKind.NodeNext && ScriptTarget.ESNext) || + ScriptTarget.ES3; } export function getEmitModuleKind(compilerOptions: {module?: CompilerOptions["module"], target?: CompilerOptions["target"]}) { @@ -6029,7 +6036,20 @@ namespace ts { export function getEmitModuleResolutionKind(compilerOptions: CompilerOptions) { let moduleResolution = compilerOptions.moduleResolution; if (moduleResolution === undefined) { - moduleResolution = getEmitModuleKind(compilerOptions) === ModuleKind.CommonJS ? ModuleResolutionKind.NodeJs : ModuleResolutionKind.Classic; + switch (getEmitModuleKind(compilerOptions)) { + case ModuleKind.CommonJS: + moduleResolution = ModuleResolutionKind.NodeJs; + break; + case ModuleKind.Node12: + moduleResolution = ModuleResolutionKind.Node12; + break; + case ModuleKind.NodeNext: + moduleResolution = ModuleResolutionKind.NodeNext; + break; + default: + moduleResolution = ModuleResolutionKind.Classic; + break; + } } return moduleResolution; } @@ -6059,11 +6079,23 @@ namespace ts { return !!(getEmitDeclarations(options) && options.declarationMap); } + export function getESModuleInterop(compilerOptions: CompilerOptions) { + if (compilerOptions.esModuleInterop !== undefined) { + return compilerOptions.esModuleInterop; + } + switch (getEmitModuleKind(compilerOptions)) { + case ModuleKind.Node12: + case ModuleKind.NodeNext: + return true; + } + return undefined; + } + export function getAllowSyntheticDefaultImports(compilerOptions: CompilerOptions) { const moduleKind = getEmitModuleKind(compilerOptions); return compilerOptions.allowSyntheticDefaultImports !== undefined ? compilerOptions.allowSyntheticDefaultImports - : compilerOptions.esModuleInterop || + : getESModuleInterop(compilerOptions) || moduleKind === ModuleKind.System; } @@ -6100,7 +6132,7 @@ namespace ts { } export function getUseDefineForClassFields(compilerOptions: CompilerOptions): boolean { - return compilerOptions.useDefineForClassFields === undefined ? compilerOptions.target === ScriptTarget.ESNext : compilerOptions.useDefineForClassFields; + return compilerOptions.useDefineForClassFields === undefined ? getEmitScriptTarget(compilerOptions) === ScriptTarget.ESNext : compilerOptions.useDefineForClassFields; } export function compilerOptionsAffectSemanticDiagnostics(newOptions: CompilerOptions, oldOptions: CompilerOptions): boolean { diff --git a/src/compiler/utilitiesPublic.ts b/src/compiler/utilitiesPublic.ts index b156908537953..1aaa23278e96f 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -11,7 +11,7 @@ namespace ts { } export function getDefaultLibFileName(options: CompilerOptions): string { - switch (options.target) { + switch (getEmitScriptTarget(options)) { case ScriptTarget.ESNext: return "lib.esnext.full.d.ts"; case ScriptTarget.ES2021: diff --git a/src/compiler/watch.ts b/src/compiler/watch.ts index 78dc141344741..d444e63c800c9 100644 --- a/src/compiler/watch.ts +++ b/src/compiler/watch.ts @@ -279,7 +279,7 @@ namespace ts { ); case FileIncludeKind.LibFile: if (reason.index !== undefined) return chainDiagnosticMessages(/*details*/ undefined, Diagnostics.Library_0_specified_in_compilerOptions, options.lib![reason.index]); - const target = forEachEntry(targetOptionDeclaration.type, (value, key) => value === options.target ? key : undefined); + const target = forEachEntry(targetOptionDeclaration.type, (value, key) => value === getEmitScriptTarget(options) ? key : undefined); return chainDiagnosticMessages( /*details*/ undefined, target ? diff --git a/src/harness/compilerImpl.ts b/src/harness/compilerImpl.ts index 41003356fc23a..7d42ccea2c0bd 100644 --- a/src/harness/compilerImpl.ts +++ b/src/harness/compilerImpl.ts @@ -249,7 +249,7 @@ namespace compiler { } // establish defaults (aligns with old harness) - if (compilerOptions.target === undefined) compilerOptions.target = ts.ScriptTarget.ES3; + if (compilerOptions.target === undefined && compilerOptions.module !== ts.ModuleKind.Node12 && compilerOptions.module !== ts.ModuleKind.NodeNext) compilerOptions.target = ts.ScriptTarget.ES3; if (compilerOptions.newLine === undefined) compilerOptions.newLine = ts.NewLineKind.CarriageReturnLineFeed; if (compilerOptions.skipDefaultLibCheck === undefined) compilerOptions.skipDefaultLibCheck = true; if (compilerOptions.noErrorTruncation === undefined) compilerOptions.noErrorTruncation = true; diff --git a/src/harness/harnessIO.ts b/src/harness/harnessIO.ts index a34e4a6e45f13..f7775ed98218a 100644 --- a/src/harness/harnessIO.ts +++ b/src/harness/harnessIO.ts @@ -265,7 +265,7 @@ namespace Harness { } export function getDefaultLibFileName(options: ts.CompilerOptions): string { - switch (options.target) { + switch (ts.getEmitScriptTarget(options)) { case ts.ScriptTarget.ESNext: case ts.ScriptTarget.ES2017: return "lib.es2017.d.ts"; @@ -385,7 +385,7 @@ namespace Harness { symlinks?: vfs.FileSet ): compiler.CompilationResult { const options: ts.CompilerOptions & HarnessOptions = compilerOptions ? ts.cloneCompilerOptions(compilerOptions) : { noResolve: false }; - options.target = options.target || ts.ScriptTarget.ES3; + options.target = ts.getEmitScriptTarget(options); options.newLine = options.newLine || ts.NewLineKind.CarriageReturnLineFeed; options.noErrorTruncation = true; options.skipDefaultLibCheck = typeof options.skipDefaultLibCheck === "undefined" ? true : options.skipDefaultLibCheck; @@ -891,7 +891,7 @@ namespace Harness { jsCode += "\r\n"; } if (!result.diagnostics.length && !ts.endsWith(file.file, ts.Extension.Json)) { - const fileParseResult = ts.createSourceFile(file.file, file.text, options.target || ts.ScriptTarget.ES3, /*parentNodes*/ false, ts.endsWith(file.file, "x") ? ts.ScriptKind.JSX : ts.ScriptKind.JS); + const fileParseResult = ts.createSourceFile(file.file, file.text, ts.getEmitScriptTarget(options), /*parentNodes*/ false, ts.endsWith(file.file, "x") ? ts.ScriptKind.JSX : ts.ScriptKind.JS); if (ts.length(fileParseResult.parseDiagnostics)) { jsCode += getErrorBaseline([file.asTestFile()], fileParseResult.parseDiagnostics); return; diff --git a/src/services/codefixes/convertFunctionToEs6Class.ts b/src/services/codefixes/convertFunctionToEs6Class.ts index 70de7a1978d14..8a20f68840d4c 100644 --- a/src/services/codefixes/convertFunctionToEs6Class.ts +++ b/src/services/codefixes/convertFunctionToEs6Class.ts @@ -259,7 +259,7 @@ namespace ts.codefix { } if (isStringLiteralLike(propName)) { - return isIdentifierText(propName.text, compilerOptions.target) ? factory.createIdentifier(propName.text) + return isIdentifierText(propName.text, getEmitScriptTarget(compilerOptions)) ? factory.createIdentifier(propName.text) : isNoSubstitutionTemplateLiteral(propName) ? factory.createStringLiteral(propName.text, quotePreference === QuotePreference.Single) : propName; } diff --git a/src/services/codefixes/convertToEs6Module.ts b/src/services/codefixes/convertToEs6Module.ts index e15c507a4ef65..1a5a92abb78f8 100644 --- a/src/services/codefixes/convertToEs6Module.ts +++ b/src/services/codefixes/convertToEs6Module.ts @@ -5,7 +5,7 @@ namespace ts.codefix { getCodeActions(context) { const { sourceFile, program, preferences } = context; const changes = textChanges.ChangeTracker.with(context, changes => { - const moduleExportsChangedToDefault = convertFileToEs6Module(sourceFile, program.getTypeChecker(), changes, program.getCompilerOptions().target!, getQuotePreference(sourceFile, preferences)); + const moduleExportsChangedToDefault = convertFileToEs6Module(sourceFile, program.getTypeChecker(), changes, getEmitScriptTarget(program.getCompilerOptions()), getQuotePreference(sourceFile, preferences)); if (moduleExportsChangedToDefault) { for (const importingFile of program.getSourceFiles()) { fixImportOfModuleExports(importingFile, sourceFile, changes, getQuotePreference(importingFile, preferences)); diff --git a/src/services/codefixes/fixModuleAndTargetOptions.ts b/src/services/codefixes/fixModuleAndTargetOptions.ts index 16ea0fab7fd07..45e1185cac909 100644 --- a/src/services/codefixes/fixModuleAndTargetOptions.ts +++ b/src/services/codefixes/fixModuleAndTargetOptions.ts @@ -2,8 +2,8 @@ namespace ts.codefix { registerCodeFix({ errorCodes: [ - Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_esnext_or_system_and_the_target_option_is_set_to_es2017_or_higher.code, - Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_esnext_or_system_and_the_target_option_is_set_to_es2017_or_higher.code, + Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher.code, + Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher.code, ], getCodeActions: context => { const compilerOptions = context.program.getCompilerOptions(); diff --git a/src/services/codefixes/fixSpelling.ts b/src/services/codefixes/fixSpelling.ts index 6d80e1f900899..787c4d70ac63c 100644 --- a/src/services/codefixes/fixSpelling.ts +++ b/src/services/codefixes/fixSpelling.ts @@ -19,15 +19,15 @@ namespace ts.codefix { const info = getInfo(sourceFile, context.span.start, context, errorCode); if (!info) return undefined; const { node, suggestedSymbol } = info; - const { target } = context.host.getCompilationSettings(); - const changes = textChanges.ChangeTracker.with(context, t => doChange(t, sourceFile, node, suggestedSymbol, target!)); + const target = getEmitScriptTarget(context.host.getCompilationSettings()); + const changes = textChanges.ChangeTracker.with(context, t => doChange(t, sourceFile, node, suggestedSymbol, target)); return [createCodeFixAction("spelling", changes, [Diagnostics.Change_spelling_to_0, symbolName(suggestedSymbol)], fixId, Diagnostics.Fix_all_detected_spelling_errors)]; }, fixIds: [fixId], getAllCodeActions: context => codeFixAll(context, errorCodes, (changes, diag) => { const info = getInfo(diag.file, diag.start, context, diag.code); - const { target } = context.host.getCompilationSettings(); - if (info) doChange(changes, context.sourceFile, info.node, info.suggestedSymbol, target!); + const target = getEmitScriptTarget(context.host.getCompilationSettings()); + if (info) doChange(changes, context.sourceFile, info.node, info.suggestedSymbol, target); }), }); diff --git a/src/services/codefixes/importFixes.ts b/src/services/codefixes/importFixes.ts index 061aeaaca7733..0653d0a10db27 100644 --- a/src/services/codefixes/importFixes.ts +++ b/src/services/codefixes/importFixes.ts @@ -252,7 +252,7 @@ namespace ts.codefix { } const defaultInfo = getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions); - if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, compilerOptions.target) === symbolName) && skipAlias(defaultInfo.symbol, checker) === exportedSymbol && isImportable(program, moduleFile, isFromPackageJson)) { + if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, getEmitScriptTarget(compilerOptions)) === symbolName) && skipAlias(defaultInfo.symbol, checker) === exportedSymbol && isImportable(program, moduleFile, isFromPackageJson)) { result.push({ symbol: defaultInfo.symbol, moduleSymbol, exportKind: defaultInfo.exportKind, exportedSymbolIsTypeOnly: isTypeOnlySymbol(defaultInfo.symbol, checker), isFromPackageJson }); } @@ -604,6 +604,9 @@ namespace ts.codefix { case ModuleKind.None: // Fall back to the `import * as ns` style import. return ImportKind.Namespace; + case ModuleKind.Node12: + case ModuleKind.NodeNext: + return importingFile.impliedNodeFormat === ModuleKind.ESNext ? ImportKind.Namespace : ImportKind.CommonJS; default: return Debug.assertNever(moduleKind, `Unexpected moduleKind ${moduleKind}`); } @@ -668,7 +671,7 @@ namespace ts.codefix { const compilerOptions = program.getCompilerOptions(); const defaultInfo = getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions); - if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, compilerOptions.target) === symbolName) && symbolHasMeaning(defaultInfo.symbolForMeaning, currentTokenMeaning)) { + if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, getEmitScriptTarget(compilerOptions)) === symbolName) && symbolHasMeaning(defaultInfo.symbolForMeaning, currentTokenMeaning)) { addSymbol(moduleSymbol, sourceFile, defaultInfo.symbol, defaultInfo.exportKind, program, isFromPackageJson); } @@ -744,7 +747,7 @@ namespace ts.codefix { defaultExport.escapedName !== InternalSymbolName.ExportEquals) { return { symbolForMeaning: defaultExport, name: defaultExport.getName() }; } - return { symbolForMeaning: defaultExport, name: getNameForExportedSymbol(defaultExport, compilerOptions.target) }; + return { symbolForMeaning: defaultExport, name: getNameForExportedSymbol(defaultExport, getEmitScriptTarget(compilerOptions)) }; } function getNameForExportDefault(symbol: Symbol): string | undefined { diff --git a/src/services/completions.ts b/src/services/completions.ts index e97753908f7c4..5227655a6eee6 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -263,7 +263,7 @@ namespace ts.Completions { location, sourceFile, typeChecker, - compilerOptions.target!, + getEmitScriptTarget(compilerOptions), log, completionKind, preferences, @@ -277,7 +277,7 @@ namespace ts.Completions { symbolToOriginInfoMap, symbolToSortTextIdMap ); - getJSCompletionEntries(sourceFile, location.pos, uniqueNames, compilerOptions.target!, entries); // TODO: GH#18217 + getJSCompletionEntries(sourceFile, location.pos, uniqueNames, getEmitScriptTarget(compilerOptions), entries); // TODO: GH#18217 } else { if (!isNewIdentifierLocation && (!symbols || symbols.length === 0) && keywordFilters === KeywordCompletionFilters.None) { @@ -291,7 +291,7 @@ namespace ts.Completions { location, sourceFile, typeChecker, - compilerOptions.target!, + getEmitScriptTarget(compilerOptions), log, completionKind, preferences, @@ -794,7 +794,7 @@ namespace ts.Completions { // completion entry. return firstDefined(symbols, (symbol, index): SymbolCompletion | undefined => { const origin = symbolToOriginInfoMap[index]; - const info = getCompletionEntryDisplayNameForSymbol(symbol, compilerOptions.target!, origin, completionKind, completionData.isJsxIdentifierExpected); + const info = getCompletionEntryDisplayNameForSymbol(symbol, getEmitScriptTarget(compilerOptions), origin, completionKind, completionData.isJsxIdentifierExpected); return info && info.name === entryId.name && getSourceFromOrigin(origin) === entryId.source ? { type: "symbol" as const, symbol, location, origin, previousToken, isJsxInitializer, isTypeOnlyLocation } : undefined; @@ -910,7 +910,7 @@ namespace ts.Completions { exportedSymbol, moduleSymbol, sourceFile, - getNameForExportedSymbol(symbol, compilerOptions.target), + getNameForExportedSymbol(symbol, getEmitScriptTarget(compilerOptions)), host, program, formatContext, diff --git a/src/services/documentRegistry.ts b/src/services/documentRegistry.ts index 77e64bf618bd2..719f219025929 100644 --- a/src/services/documentRegistry.ts +++ b/src/services/documentRegistry.ts @@ -201,7 +201,7 @@ namespace ts { acquiring: boolean, scriptKind?: ScriptKind): SourceFile { scriptKind = ensureScriptKind(fileName, scriptKind); - const scriptTarget = scriptKind === ScriptKind.JSON ? ScriptTarget.JSON : compilationSettings.target || ScriptTarget.ES5; + const scriptTarget = scriptKind === ScriptKind.JSON ? ScriptTarget.JSON : getEmitScriptTarget(compilationSettings); const bucket = getOrUpdate(buckets, key, () => new Map()); const bucketEntry = bucket.get(path); let entry = bucketEntry && getDocumentRegistryEntry(bucketEntry, scriptKind); diff --git a/src/services/stringCompletions.ts b/src/services/stringCompletions.ts index 92d205ed8bcdb..0a726e3fb1d7d 100644 --- a/src/services/stringCompletions.ts +++ b/src/services/stringCompletions.ts @@ -91,6 +91,12 @@ namespace ts.Completions.StringCompletions { case Extension.Jsx: return ScriptElementKindModifier.jsxModifier; case Extension.Ts: return ScriptElementKindModifier.tsModifier; case Extension.Tsx: return ScriptElementKindModifier.tsxModifier; + case Extension.Dmts: return ScriptElementKindModifier.dmtsModifier; + case Extension.Mjs: return ScriptElementKindModifier.mjsModifier; + case Extension.Mts: return ScriptElementKindModifier.mtsModifier; + case Extension.Dcts: return ScriptElementKindModifier.dctsModifier; + case Extension.Cjs: return ScriptElementKindModifier.cjsModifier; + case Extension.Cts: return ScriptElementKindModifier.ctsModifier; case Extension.TsBuildInfo: return Debug.fail(`Extension ${Extension.TsBuildInfo} is unsupported.`); case undefined: return ScriptElementKindModifier.none; default: diff --git a/src/services/transpile.ts b/src/services/transpile.ts index 0ac54f8d172ca..5b73b91bd7f47 100644 --- a/src/services/transpile.ts +++ b/src/services/transpile.ts @@ -48,7 +48,7 @@ namespace ts { // if jsx is specified then treat file as .tsx const inputFileName = transpileOptions.fileName || (transpileOptions.compilerOptions && transpileOptions.compilerOptions.jsx ? "module.tsx" : "module.ts"); - const sourceFile = createSourceFile(inputFileName, input, options.target!); // TODO: GH#18217 + const sourceFile = createSourceFile(inputFileName, input, getEmitScriptTarget(options)); if (transpileOptions.moduleName) { sourceFile.moduleName = transpileOptions.moduleName; } diff --git a/src/services/types.ts b/src/services/types.ts index be1d09ff69c57..6cd7a7c07f7e8 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -1446,6 +1446,12 @@ namespace ts { jsModifier = ".js", jsxModifier = ".jsx", jsonModifier = ".json", + dmtsModifier = ".d.mts", + mtsModifier = ".mts", + mjsModifier = ".mjs", + dctsModifier = ".d.cts", + ctsModifier = ".cts", + cjsModifier = ".cjs", } export const enum ClassificationTypeNames { diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 6ffa3607c8ccb..d64bfc85129b0 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1831,7 +1831,7 @@ namespace ts { return program.getSourceFiles().some(s => !s.isDeclarationFile && !program.isSourceFileFromExternalLibrary(s) && !!s.externalModuleIndicator); } export function compilerOptionsIndicateEs6Modules(compilerOptions: CompilerOptions): boolean { - return !!compilerOptions.module || compilerOptions.target! >= ScriptTarget.ES2015 || !!compilerOptions.noEmit; + return !!compilerOptions.module || getEmitScriptTarget(compilerOptions) >= ScriptTarget.ES2015 || !!compilerOptions.noEmit; } export function createModuleSpecifierResolutionHost(program: Program, host: LanguageServiceHost): ModuleSpecifierResolutionHost { diff --git a/src/testRunner/unittests/config/commandLineParsing.ts b/src/testRunner/unittests/config/commandLineParsing.ts index 2b973991f8c41..50bb22cdfbc8e 100644 --- a/src/testRunner/unittests/config/commandLineParsing.ts +++ b/src/testRunner/unittests/config/commandLineParsing.ts @@ -159,7 +159,7 @@ namespace ts { start: undefined, length: undefined, }, { - messageText: "Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext'.", + messageText: "Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext', 'node12', 'nodenext'.", category: Diagnostics.Argument_for_0_option_must_be_Colon_1.category, code: Diagnostics.Argument_for_0_option_must_be_Colon_1.code, diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 376ebc377765f..e4d59e91e786c 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -1983,6 +1983,18 @@ declare namespace ts { */ hasNoDefaultLib: boolean; languageVersion: ScriptTarget; + /** + * When `module` is `Node12` or `NodeNext`, this field controls weather the + * source file in question is an ESNext-output-format file, or a CommonJS-output-format + * module. This is derived by the module resolver as it looks up the file, since + * it is derived from either the file extension of the module, or the containing + * `package.json` context, and affects both checking and emit. + * + * It is _public_ so that (pre)transformers can set this field, + * since it switches the builtin `node` module transform. Generally speaking, if unset, + * the field is treated as though it is `ModuleKind.CommonJS`. + */ + impliedNodeFormat?: ModuleKind.ESNext | ModuleKind.CommonJS; } export interface Bundle extends Node { readonly kind: SyntaxKind.Bundle; @@ -2796,7 +2808,9 @@ declare namespace ts { } export enum ModuleResolutionKind { Classic = 1, - NodeJs = 2 + NodeJs = 2, + Node12 = 3, + NodeNext = 99 } export interface PluginImport { name: string; @@ -2957,7 +2971,9 @@ declare namespace ts { System = 4, ES2015 = 5, ES2020 = 6, - ESNext = 99 + ESNext = 99, + Node12 = 100, + NodeNext = 199 } export enum JsxEmit { None = 0, @@ -3102,7 +3118,13 @@ declare namespace ts { Js = ".js", Jsx = ".jsx", Json = ".json", - TsBuildInfo = ".tsbuildinfo" + TsBuildInfo = ".tsbuildinfo", + Mjs = ".mjs", + Mts = ".mts", + Dmts = ".d.mts", + Cjs = ".cjs", + Cts = ".cts", + Dcts = ".d.cts" } export interface ResolvedModuleWithFailedLookupLocations { readonly resolvedModule: ResolvedModuleFull | undefined; @@ -4744,6 +4766,14 @@ declare namespace ts { export {}; } declare namespace ts { + interface ModuleResolutionState { + host: ModuleResolutionHost; + compilerOptions: CompilerOptions; + traceEnabled: boolean; + failedLookupLocations: Push; + resultFromCache?: ResolvedModuleWithFailedLookupLocations; + packageJsonInfoCache: PackageJsonInfoCache | undefined; + } export function getEffectiveTypeRoots(options: CompilerOptions, host: GetEffectiveTypeRootsHost): string[] | undefined; /** * @param {string | undefined} containingFile - file that contains type reference directive, can be undefined if containing file is unknown. @@ -4906,6 +4936,17 @@ declare namespace ts { export function formatDiagnosticsWithColorAndContext(diagnostics: readonly Diagnostic[], host: FormatDiagnosticsHost): string; export function flattenDiagnosticMessageText(diag: string | DiagnosticMessageChain | undefined, newLine: string, indent?: number): string; export function getConfigFileParsingDiagnostics(configFileParseResult: ParsedCommandLine): readonly Diagnostic[]; + /** + * A function for determining if a given file is esm or cjs format, assuming modern node module resolution rules, as configured by the + * `options` parameter. + * + * @param fileName The normalized absolute path to check the format of (it need not exist on disk) + * @param packageJsonInfoCache (Optional) A cache for package file lookups - it's best to have a cache when this function is called often + * @param host The ModuleResolutionHost which can perform the filesystem lookups for package json data + * @param options The compiler options to perform the analysis under - relevant options are `moduleResolution` and `traceResolution` + * @returns `undefined` if the path has no relevant implied format, `ModuleKind.ESNext` for esm format, and `ModuleKind.CommonJS` for cjs format + */ + export function getImpliedNodeFormatForFile(fileName: Path, packageJsonInfoCache: PackageJsonInfoCache | undefined, host: ModuleResolutionHost, options: CompilerOptions): ModuleKind.ESNext | ModuleKind.CommonJS | undefined; /** * Create a new 'Program' instance. A Program is an immutable collection of 'SourceFile's and a 'CompilerOptions' * that represent a compilation unit. @@ -6449,7 +6490,13 @@ declare namespace ts { tsxModifier = ".tsx", jsModifier = ".js", jsxModifier = ".jsx", - jsonModifier = ".json" + jsonModifier = ".json", + dmtsModifier = ".d.mts", + mtsModifier = ".mts", + mjsModifier = ".mjs", + dctsModifier = ".d.cts", + ctsModifier = ".cts", + cjsModifier = ".cjs" } enum ClassificationTypeNames { comment = "comment", diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index ea5e5d3eeefd4..967e947f1f444 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -1983,6 +1983,18 @@ declare namespace ts { */ hasNoDefaultLib: boolean; languageVersion: ScriptTarget; + /** + * When `module` is `Node12` or `NodeNext`, this field controls weather the + * source file in question is an ESNext-output-format file, or a CommonJS-output-format + * module. This is derived by the module resolver as it looks up the file, since + * it is derived from either the file extension of the module, or the containing + * `package.json` context, and affects both checking and emit. + * + * It is _public_ so that (pre)transformers can set this field, + * since it switches the builtin `node` module transform. Generally speaking, if unset, + * the field is treated as though it is `ModuleKind.CommonJS`. + */ + impliedNodeFormat?: ModuleKind.ESNext | ModuleKind.CommonJS; } export interface Bundle extends Node { readonly kind: SyntaxKind.Bundle; @@ -2796,7 +2808,9 @@ declare namespace ts { } export enum ModuleResolutionKind { Classic = 1, - NodeJs = 2 + NodeJs = 2, + Node12 = 3, + NodeNext = 99 } export interface PluginImport { name: string; @@ -2957,7 +2971,9 @@ declare namespace ts { System = 4, ES2015 = 5, ES2020 = 6, - ESNext = 99 + ESNext = 99, + Node12 = 100, + NodeNext = 199 } export enum JsxEmit { None = 0, @@ -3102,7 +3118,13 @@ declare namespace ts { Js = ".js", Jsx = ".jsx", Json = ".json", - TsBuildInfo = ".tsbuildinfo" + TsBuildInfo = ".tsbuildinfo", + Mjs = ".mjs", + Mts = ".mts", + Dmts = ".d.mts", + Cjs = ".cjs", + Cts = ".cts", + Dcts = ".d.cts" } export interface ResolvedModuleWithFailedLookupLocations { readonly resolvedModule: ResolvedModuleFull | undefined; @@ -4744,6 +4766,14 @@ declare namespace ts { export {}; } declare namespace ts { + interface ModuleResolutionState { + host: ModuleResolutionHost; + compilerOptions: CompilerOptions; + traceEnabled: boolean; + failedLookupLocations: Push; + resultFromCache?: ResolvedModuleWithFailedLookupLocations; + packageJsonInfoCache: PackageJsonInfoCache | undefined; + } export function getEffectiveTypeRoots(options: CompilerOptions, host: GetEffectiveTypeRootsHost): string[] | undefined; /** * @param {string | undefined} containingFile - file that contains type reference directive, can be undefined if containing file is unknown. @@ -4906,6 +4936,17 @@ declare namespace ts { export function formatDiagnosticsWithColorAndContext(diagnostics: readonly Diagnostic[], host: FormatDiagnosticsHost): string; export function flattenDiagnosticMessageText(diag: string | DiagnosticMessageChain | undefined, newLine: string, indent?: number): string; export function getConfigFileParsingDiagnostics(configFileParseResult: ParsedCommandLine): readonly Diagnostic[]; + /** + * A function for determining if a given file is esm or cjs format, assuming modern node module resolution rules, as configured by the + * `options` parameter. + * + * @param fileName The normalized absolute path to check the format of (it need not exist on disk) + * @param packageJsonInfoCache (Optional) A cache for package file lookups - it's best to have a cache when this function is called often + * @param host The ModuleResolutionHost which can perform the filesystem lookups for package json data + * @param options The compiler options to perform the analysis under - relevant options are `moduleResolution` and `traceResolution` + * @returns `undefined` if the path has no relevant implied format, `ModuleKind.ESNext` for esm format, and `ModuleKind.CommonJS` for cjs format + */ + export function getImpliedNodeFormatForFile(fileName: Path, packageJsonInfoCache: PackageJsonInfoCache | undefined, host: ModuleResolutionHost, options: CompilerOptions): ModuleKind.ESNext | ModuleKind.CommonJS | undefined; /** * Create a new 'Program' instance. A Program is an immutable collection of 'SourceFile's and a 'CompilerOptions' * that represent a compilation unit. @@ -6449,7 +6490,13 @@ declare namespace ts { tsxModifier = ".tsx", jsModifier = ".js", jsxModifier = ".jsx", - jsonModifier = ".json" + jsonModifier = ".json", + dmtsModifier = ".d.mts", + mtsModifier = ".mts", + mjsModifier = ".mjs", + dctsModifier = ".d.cts", + ctsModifier = ".cts", + cjsModifier = ".cjs" } enum ClassificationTypeNames { comment = "comment", diff --git a/tests/baselines/reference/awaitInNonAsyncFunction.errors.txt b/tests/baselines/reference/awaitInNonAsyncFunction.errors.txt index ee1aa75d3cc74..6a5b413c154c2 100644 --- a/tests/baselines/reference/awaitInNonAsyncFunction.errors.txt +++ b/tests/baselines/reference/awaitInNonAsyncFunction.errors.txt @@ -12,8 +12,8 @@ tests/cases/compiler/awaitInNonAsyncFunction.ts(30,9): error TS1103: 'for await' tests/cases/compiler/awaitInNonAsyncFunction.ts(31,5): error TS1308: 'await' expressions are only allowed within async functions and at the top levels of modules. tests/cases/compiler/awaitInNonAsyncFunction.ts(34,7): error TS1103: 'for await' loops are only allowed within async functions and at the top levels of modules. tests/cases/compiler/awaitInNonAsyncFunction.ts(35,5): error TS1308: 'await' expressions are only allowed within async functions and at the top levels of modules. -tests/cases/compiler/awaitInNonAsyncFunction.ts(39,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext' or 'system', and the 'target' option is set to 'es2017' or higher. -tests/cases/compiler/awaitInNonAsyncFunction.ts(40,1): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext' or 'system', and the 'target' option is set to 'es2017' or higher. +tests/cases/compiler/awaitInNonAsyncFunction.ts(39,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher. +tests/cases/compiler/awaitInNonAsyncFunction.ts(40,1): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher. ==== tests/cases/compiler/awaitInNonAsyncFunction.ts (16 errors) ==== @@ -97,7 +97,7 @@ tests/cases/compiler/awaitInNonAsyncFunction.ts(40,1): error TS1378: Top-level ' for await (const _ of []); ~~~~~ -!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext' or 'system', and the 'target' option is set to 'es2017' or higher. +!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher. await null; ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext' or 'system', and the 'target' option is set to 'es2017' or higher. \ No newline at end of file +!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher. \ No newline at end of file diff --git a/tests/baselines/reference/emitHelpersWithLocalCollisions(module=node12).js b/tests/baselines/reference/emitHelpersWithLocalCollisions(module=node12).js new file mode 100644 index 0000000000000..8aed6c9347aa2 --- /dev/null +++ b/tests/baselines/reference/emitHelpersWithLocalCollisions(module=node12).js @@ -0,0 +1,27 @@ +//// [a.ts] +declare var dec: any, __decorate: any; +@dec export class A { +} + +const o = { a: 1 }; +const y = { ...o }; + + +//// [a.js] +"use strict"; +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.A = void 0; +let A = class A { +}; +A = __decorate([ + dec +], A); +exports.A = A; +const o = { a: 1 }; +const y = Object.assign({}, o); diff --git a/tests/baselines/reference/emitHelpersWithLocalCollisions(module=nodenext).js b/tests/baselines/reference/emitHelpersWithLocalCollisions(module=nodenext).js new file mode 100644 index 0000000000000..8aed6c9347aa2 --- /dev/null +++ b/tests/baselines/reference/emitHelpersWithLocalCollisions(module=nodenext).js @@ -0,0 +1,27 @@ +//// [a.ts] +declare var dec: any, __decorate: any; +@dec export class A { +} + +const o = { a: 1 }; +const y = { ...o }; + + +//// [a.js] +"use strict"; +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.A = void 0; +let A = class A { +}; +A = __decorate([ + dec +], A); +exports.A = A; +const o = { a: 1 }; +const y = Object.assign({}, o); diff --git a/tests/baselines/reference/importCallExpressionErrorInES2015.errors.txt b/tests/baselines/reference/importCallExpressionErrorInES2015.errors.txt index d55a470765854..95937040daa0d 100644 --- a/tests/baselines/reference/importCallExpressionErrorInES2015.errors.txt +++ b/tests/baselines/reference/importCallExpressionErrorInES2015.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/dynamicImport/1.ts(1,1): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'. -tests/cases/conformance/dynamicImport/1.ts(2,10): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'. -tests/cases/conformance/dynamicImport/1.ts(8,16): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'. +tests/cases/conformance/dynamicImport/1.ts(1,1): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'. +tests/cases/conformance/dynamicImport/1.ts(2,10): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'. +tests/cases/conformance/dynamicImport/1.ts(8,16): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'. ==== tests/cases/conformance/dynamicImport/0.ts (0 errors) ==== @@ -9,10 +9,10 @@ tests/cases/conformance/dynamicImport/1.ts(8,16): error TS1323: Dynamic imports ==== tests/cases/conformance/dynamicImport/1.ts (3 errors) ==== import("./0"); ~~~~~~~~~~~~~ -!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'. +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'. var p1 = import("./0"); ~~~~~~~~~~~~~ -!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'. +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'. p1.then(zero => { return zero.foo(); }) @@ -20,5 +20,5 @@ tests/cases/conformance/dynamicImport/1.ts(8,16): error TS1323: Dynamic imports function foo() { const p2 = import("./0"); ~~~~~~~~~~~~~ -!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'. +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'. } \ No newline at end of file diff --git a/tests/baselines/reference/importCallExpressionNestedES2015.errors.txt b/tests/baselines/reference/importCallExpressionNestedES2015.errors.txt index 6a0efe8747b20..4d1f7a55b3ce8 100644 --- a/tests/baselines/reference/importCallExpressionNestedES2015.errors.txt +++ b/tests/baselines/reference/importCallExpressionNestedES2015.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/dynamicImport/index.ts(2,18): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'. -tests/cases/conformance/dynamicImport/index.ts(2,32): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'. +tests/cases/conformance/dynamicImport/index.ts(2,18): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'. +tests/cases/conformance/dynamicImport/index.ts(2,32): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'. ==== tests/cases/conformance/dynamicImport/foo.ts (0 errors) ==== @@ -9,7 +9,7 @@ tests/cases/conformance/dynamicImport/index.ts(2,32): error TS1323: Dynamic impo async function foo() { return await import((await import("./foo")).default); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'. +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'. ~~~~~~~~~~~~~~~ -!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'. +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'. } \ No newline at end of file diff --git a/tests/baselines/reference/importCallExpressionNestedES20152.errors.txt b/tests/baselines/reference/importCallExpressionNestedES20152.errors.txt index 6a0efe8747b20..4d1f7a55b3ce8 100644 --- a/tests/baselines/reference/importCallExpressionNestedES20152.errors.txt +++ b/tests/baselines/reference/importCallExpressionNestedES20152.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/dynamicImport/index.ts(2,18): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'. -tests/cases/conformance/dynamicImport/index.ts(2,32): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'. +tests/cases/conformance/dynamicImport/index.ts(2,18): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'. +tests/cases/conformance/dynamicImport/index.ts(2,32): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'. ==== tests/cases/conformance/dynamicImport/foo.ts (0 errors) ==== @@ -9,7 +9,7 @@ tests/cases/conformance/dynamicImport/index.ts(2,32): error TS1323: Dynamic impo async function foo() { return await import((await import("./foo")).default); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'. +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'. ~~~~~~~~~~~~~~~ -!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'. +!!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'. } \ No newline at end of file diff --git a/tests/baselines/reference/importMeta(module=commonjs,target=es5).errors.txt b/tests/baselines/reference/importMeta(module=commonjs,target=es5).errors.txt index c152da9696952..ba01672d75a8f 100644 --- a/tests/baselines/reference/importMeta(module=commonjs,target=es5).errors.txt +++ b/tests/baselines/reference/importMeta(module=commonjs,target=es5).errors.txt @@ -1,25 +1,25 @@ error TS2468: Cannot find global value 'Promise'. -tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,32): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,32): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,44): error TS2339: Property 'blah' does not exist on type 'ImportMeta'. -tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,51): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,51): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,63): error TS2339: Property 'blue' does not exist on type 'ImportMeta'. -tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,70): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. -tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(2,1): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,70): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. +tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(2,1): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(2,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access. -tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(11,21): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(11,21): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. tests/cases/conformance/es2019/importMeta/example.ts(2,2): error TS2705: An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -tests/cases/conformance/es2019/importMeta/example.ts(3,59): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. -tests/cases/conformance/es2019/importMeta/example.ts(6,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +tests/cases/conformance/es2019/importMeta/example.ts(3,59): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. +tests/cases/conformance/es2019/importMeta/example.ts(6,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. tests/cases/conformance/es2019/importMeta/example.ts(6,28): error TS2339: Property 'scriptElement' does not exist on type 'ImportMeta'. -tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(1,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. -tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(2,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(1,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. +tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(2,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(2,23): error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? -tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(3,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(3,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(3,23): error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? -tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(1,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. -tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(2,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(1,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. +tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(2,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(2,22): error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? -tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,22): error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? @@ -31,12 +31,12 @@ tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,22): error TS !!! error TS2705: An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString()); ~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. const blob = await response.blob(); const size = import.meta.scriptElement.dataset.size || 300; ~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. ~~~~~~~~~~~~~ !!! error TS2339: Property 'scriptElement' does not exist on type 'ImportMeta'. @@ -50,48 +50,48 @@ tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,22): error TS ==== tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts (5 errors) ==== export let x = import.meta; ~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. export let y = import.metal; ~~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. ~~~~~ !!! error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? export let z = import.import.import.malkovich; ~~~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. ~~~~~~ !!! error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? ==== tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts (5 errors) ==== let globalA = import.meta; ~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. let globalB = import.metal; ~~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. ~~~~~ !!! error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? let globalC = import.import.import.malkovich; ~~~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. ~~~~~~ !!! error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? ==== tests/cases/conformance/es2019/importMeta/assignmentTargets.ts (8 errors) ==== export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta; ~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. ~~~~ !!! error TS2339: Property 'blah' does not exist on type 'ImportMeta'. ~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. ~~~~ !!! error TS2339: Property 'blue' does not exist on type 'ImportMeta'. ~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. import.meta = foo; ~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. ~~~~~~~~~~~ !!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access. @@ -104,4 +104,4 @@ tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,22): error TS const { a, b, c } = import.meta.wellKnownProperty; ~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. \ No newline at end of file +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. \ No newline at end of file diff --git a/tests/baselines/reference/importMeta(module=commonjs,target=esnext).errors.txt b/tests/baselines/reference/importMeta(module=commonjs,target=esnext).errors.txt index c152da9696952..ba01672d75a8f 100644 --- a/tests/baselines/reference/importMeta(module=commonjs,target=esnext).errors.txt +++ b/tests/baselines/reference/importMeta(module=commonjs,target=esnext).errors.txt @@ -1,25 +1,25 @@ error TS2468: Cannot find global value 'Promise'. -tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,32): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,32): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,44): error TS2339: Property 'blah' does not exist on type 'ImportMeta'. -tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,51): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,51): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,63): error TS2339: Property 'blue' does not exist on type 'ImportMeta'. -tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,70): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. -tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(2,1): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(1,70): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. +tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(2,1): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(2,1): error TS2364: The left-hand side of an assignment expression must be a variable or a property access. -tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(11,21): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +tests/cases/conformance/es2019/importMeta/assignmentTargets.ts(11,21): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. tests/cases/conformance/es2019/importMeta/example.ts(2,2): error TS2705: An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. -tests/cases/conformance/es2019/importMeta/example.ts(3,59): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. -tests/cases/conformance/es2019/importMeta/example.ts(6,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +tests/cases/conformance/es2019/importMeta/example.ts(3,59): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. +tests/cases/conformance/es2019/importMeta/example.ts(6,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. tests/cases/conformance/es2019/importMeta/example.ts(6,28): error TS2339: Property 'scriptElement' does not exist on type 'ImportMeta'. -tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(1,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. -tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(2,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(1,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. +tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(2,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(2,23): error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? -tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(3,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(3,16): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts(3,23): error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? -tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(1,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. -tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(2,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(1,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. +tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(2,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(2,22): error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? -tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,15): error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,22): error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? @@ -31,12 +31,12 @@ tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,22): error TS !!! error TS2705: An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option. const response = await fetch(new URL("../hamsters.jpg", import.meta.url).toString()); ~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. const blob = await response.blob(); const size = import.meta.scriptElement.dataset.size || 300; ~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. ~~~~~~~~~~~~~ !!! error TS2339: Property 'scriptElement' does not exist on type 'ImportMeta'. @@ -50,48 +50,48 @@ tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,22): error TS ==== tests/cases/conformance/es2019/importMeta/moduleLookingFile01.ts (5 errors) ==== export let x = import.meta; ~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. export let y = import.metal; ~~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. ~~~~~ !!! error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? export let z = import.import.import.malkovich; ~~~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. ~~~~~~ !!! error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? ==== tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts (5 errors) ==== let globalA = import.meta; ~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. let globalB = import.metal; ~~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. ~~~~~ !!! error TS17012: 'metal' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? let globalC = import.import.import.malkovich; ~~~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. ~~~~~~ !!! error TS17012: 'import' is not a valid meta-property for keyword 'import'. Did you mean 'meta'? ==== tests/cases/conformance/es2019/importMeta/assignmentTargets.ts (8 errors) ==== export const foo: ImportMeta = import.meta.blah = import.meta.blue = import.meta; ~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. ~~~~ !!! error TS2339: Property 'blah' does not exist on type 'ImportMeta'. ~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. ~~~~ !!! error TS2339: Property 'blue' does not exist on type 'ImportMeta'. ~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. import.meta = foo; ~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. ~~~~~~~~~~~ !!! error TS2364: The left-hand side of an assignment expression must be a variable or a property access. @@ -104,4 +104,4 @@ tests/cases/conformance/es2019/importMeta/scriptLookingFile01.ts(3,22): error TS const { a, b, c } = import.meta.wellKnownProperty; ~~~~~~~~~~~ -!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'. \ No newline at end of file +!!! error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'. \ No newline at end of file diff --git a/tests/baselines/reference/nodeModules1(module=node12).js b/tests/baselines/reference/nodeModules1(module=node12).js new file mode 100644 index 0000000000000..3742bb13c5f2a --- /dev/null +++ b/tests/baselines/reference/nodeModules1(module=node12).js @@ -0,0 +1,58 @@ +//// [tests/cases/conformance/node/nodeModules1.ts] //// + +//// [index.ts] +// cjs format file +const x = 1; +export {x}; +//// [index.ts] +// cjs format file +const x = 1; +export {x}; +//// [index.ts] +// esm format file +const x = 1; +export {x}; +//// [index.ts] +// esm format file +const x = 1; +export {x}; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} +//// [package.json] +{ +} +//// [package.json] +{ + "type": "module" +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// cjs 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.js] +// esm format file +const x = 1; +export { x }; +//// [index.js] +// esm format file +const x = 1; +export { x }; diff --git a/tests/baselines/reference/nodeModules1(module=node12).symbols b/tests/baselines/reference/nodeModules1(module=node12).symbols new file mode 100644 index 0000000000000..e1653429c87db --- /dev/null +++ b/tests/baselines/reference/nodeModules1(module=node12).symbols @@ -0,0 +1,32 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +const x = 1; +>x : Symbol(x, Decl(index.ts, 1, 5)) + +export {x}; +>x : Symbol(x, Decl(index.ts, 2, 8)) + +=== tests/cases/conformance/node/subfolder2/index.ts === +// cjs format file +const x = 1; +>x : Symbol(x, Decl(index.ts, 1, 5)) + +export {x}; +>x : Symbol(x, Decl(index.ts, 2, 8)) + +=== tests/cases/conformance/node/subfolder2/another/index.ts === +// esm format file +const x = 1; +>x : Symbol(x, Decl(index.ts, 1, 5)) + +export {x}; +>x : Symbol(x, Decl(index.ts, 2, 8)) + +=== tests/cases/conformance/node/index.ts === +// esm format file +const x = 1; +>x : Symbol(x, Decl(index.ts, 1, 5)) + +export {x}; +>x : Symbol(x, Decl(index.ts, 2, 8)) + diff --git a/tests/baselines/reference/nodeModules1(module=node12).types b/tests/baselines/reference/nodeModules1(module=node12).types new file mode 100644 index 0000000000000..1c479a5e7bd48 --- /dev/null +++ b/tests/baselines/reference/nodeModules1(module=node12).types @@ -0,0 +1,36 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +const x = 1; +>x : 1 +>1 : 1 + +export {x}; +>x : 1 + +=== tests/cases/conformance/node/subfolder2/index.ts === +// cjs format file +const x = 1; +>x : 1 +>1 : 1 + +export {x}; +>x : 1 + +=== tests/cases/conformance/node/subfolder2/another/index.ts === +// esm format file +const x = 1; +>x : 1 +>1 : 1 + +export {x}; +>x : 1 + +=== tests/cases/conformance/node/index.ts === +// esm format file +const x = 1; +>x : 1 +>1 : 1 + +export {x}; +>x : 1 + diff --git a/tests/baselines/reference/nodeModules1(module=nodenext).js b/tests/baselines/reference/nodeModules1(module=nodenext).js new file mode 100644 index 0000000000000..3742bb13c5f2a --- /dev/null +++ b/tests/baselines/reference/nodeModules1(module=nodenext).js @@ -0,0 +1,58 @@ +//// [tests/cases/conformance/node/nodeModules1.ts] //// + +//// [index.ts] +// cjs format file +const x = 1; +export {x}; +//// [index.ts] +// cjs format file +const x = 1; +export {x}; +//// [index.ts] +// esm format file +const x = 1; +export {x}; +//// [index.ts] +// esm format file +const x = 1; +export {x}; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} +//// [package.json] +{ +} +//// [package.json] +{ + "type": "module" +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// cjs 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.js] +// esm format file +const x = 1; +export { x }; +//// [index.js] +// esm format file +const x = 1; +export { x }; diff --git a/tests/baselines/reference/nodeModules1(module=nodenext).symbols b/tests/baselines/reference/nodeModules1(module=nodenext).symbols new file mode 100644 index 0000000000000..e1653429c87db --- /dev/null +++ b/tests/baselines/reference/nodeModules1(module=nodenext).symbols @@ -0,0 +1,32 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +const x = 1; +>x : Symbol(x, Decl(index.ts, 1, 5)) + +export {x}; +>x : Symbol(x, Decl(index.ts, 2, 8)) + +=== tests/cases/conformance/node/subfolder2/index.ts === +// cjs format file +const x = 1; +>x : Symbol(x, Decl(index.ts, 1, 5)) + +export {x}; +>x : Symbol(x, Decl(index.ts, 2, 8)) + +=== tests/cases/conformance/node/subfolder2/another/index.ts === +// esm format file +const x = 1; +>x : Symbol(x, Decl(index.ts, 1, 5)) + +export {x}; +>x : Symbol(x, Decl(index.ts, 2, 8)) + +=== tests/cases/conformance/node/index.ts === +// esm format file +const x = 1; +>x : Symbol(x, Decl(index.ts, 1, 5)) + +export {x}; +>x : Symbol(x, Decl(index.ts, 2, 8)) + diff --git a/tests/baselines/reference/nodeModules1(module=nodenext).types b/tests/baselines/reference/nodeModules1(module=nodenext).types new file mode 100644 index 0000000000000..1c479a5e7bd48 --- /dev/null +++ b/tests/baselines/reference/nodeModules1(module=nodenext).types @@ -0,0 +1,36 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +const x = 1; +>x : 1 +>1 : 1 + +export {x}; +>x : 1 + +=== tests/cases/conformance/node/subfolder2/index.ts === +// cjs format file +const x = 1; +>x : 1 +>1 : 1 + +export {x}; +>x : 1 + +=== tests/cases/conformance/node/subfolder2/another/index.ts === +// esm format file +const x = 1; +>x : 1 +>1 : 1 + +export {x}; +>x : 1 + +=== tests/cases/conformance/node/index.ts === +// esm format file +const x = 1; +>x : 1 +>1 : 1 + +export {x}; +>x : 1 + diff --git a/tests/baselines/reference/nodeModulesDynamicImport(module=node12).js b/tests/baselines/reference/nodeModulesDynamicImport(module=node12).js new file mode 100644 index 0000000000000..71f2979b2146e --- /dev/null +++ b/tests/baselines/reference/nodeModulesDynamicImport(module=node12).js @@ -0,0 +1,39 @@ +//// [tests/cases/conformance/node/nodeModulesDynamicImport.ts] //// + +//// [index.ts] +// cjs format file +export async function main() { + const { readFile } = await import("fs"); +} +//// [index.ts] +// esm format file +export async function main() { + const { readFile } = await import("fs"); +} +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} +//// [types.d.ts] +declare module "fs"; + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.main = void 0; +// cjs format file +async function main() { + const { readFile } = await import("fs"); +} +exports.main = main; +//// [index.js] +// esm format file +export async function main() { + const { readFile } = await import("fs"); +} diff --git a/tests/baselines/reference/nodeModulesDynamicImport(module=node12).symbols b/tests/baselines/reference/nodeModulesDynamicImport(module=node12).symbols new file mode 100644 index 0000000000000..69296bc3fa993 --- /dev/null +++ b/tests/baselines/reference/nodeModulesDynamicImport(module=node12).symbols @@ -0,0 +1,22 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +export async function main() { +>main : Symbol(main, Decl(index.ts, 0, 0)) + + const { readFile } = await import("fs"); +>readFile : Symbol(readFile, Decl(index.ts, 2, 11)) +>"fs" : Symbol("fs", Decl(types.d.ts, 0, 0)) +} +=== tests/cases/conformance/node/index.ts === +// esm format file +export async function main() { +>main : Symbol(main, Decl(index.ts, 0, 0)) + + const { readFile } = await import("fs"); +>readFile : Symbol(readFile, Decl(index.ts, 2, 11)) +>"fs" : Symbol("fs", Decl(types.d.ts, 0, 0)) +} +=== tests/cases/conformance/node/types.d.ts === +declare module "fs"; +>"fs" : Symbol("fs", Decl(types.d.ts, 0, 0)) + diff --git a/tests/baselines/reference/nodeModulesDynamicImport(module=node12).types b/tests/baselines/reference/nodeModulesDynamicImport(module=node12).types new file mode 100644 index 0000000000000..879fb7ca71bf8 --- /dev/null +++ b/tests/baselines/reference/nodeModulesDynamicImport(module=node12).types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +export async function main() { +>main : () => Promise + + const { readFile } = await import("fs"); +>readFile : any +>await import("fs") : any +>import("fs") : Promise +>"fs" : "fs" +} +=== tests/cases/conformance/node/index.ts === +// esm format file +export async function main() { +>main : () => Promise + + const { readFile } = await import("fs"); +>readFile : any +>await import("fs") : any +>import("fs") : Promise +>"fs" : "fs" +} +=== tests/cases/conformance/node/types.d.ts === +declare module "fs"; +>"fs" : any + diff --git a/tests/baselines/reference/nodeModulesDynamicImport(module=nodenext).js b/tests/baselines/reference/nodeModulesDynamicImport(module=nodenext).js new file mode 100644 index 0000000000000..71f2979b2146e --- /dev/null +++ b/tests/baselines/reference/nodeModulesDynamicImport(module=nodenext).js @@ -0,0 +1,39 @@ +//// [tests/cases/conformance/node/nodeModulesDynamicImport.ts] //// + +//// [index.ts] +// cjs format file +export async function main() { + const { readFile } = await import("fs"); +} +//// [index.ts] +// esm format file +export async function main() { + const { readFile } = await import("fs"); +} +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} +//// [types.d.ts] +declare module "fs"; + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.main = void 0; +// cjs format file +async function main() { + const { readFile } = await import("fs"); +} +exports.main = main; +//// [index.js] +// esm format file +export async function main() { + const { readFile } = await import("fs"); +} diff --git a/tests/baselines/reference/nodeModulesDynamicImport(module=nodenext).symbols b/tests/baselines/reference/nodeModulesDynamicImport(module=nodenext).symbols new file mode 100644 index 0000000000000..69296bc3fa993 --- /dev/null +++ b/tests/baselines/reference/nodeModulesDynamicImport(module=nodenext).symbols @@ -0,0 +1,22 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +export async function main() { +>main : Symbol(main, Decl(index.ts, 0, 0)) + + const { readFile } = await import("fs"); +>readFile : Symbol(readFile, Decl(index.ts, 2, 11)) +>"fs" : Symbol("fs", Decl(types.d.ts, 0, 0)) +} +=== tests/cases/conformance/node/index.ts === +// esm format file +export async function main() { +>main : Symbol(main, Decl(index.ts, 0, 0)) + + const { readFile } = await import("fs"); +>readFile : Symbol(readFile, Decl(index.ts, 2, 11)) +>"fs" : Symbol("fs", Decl(types.d.ts, 0, 0)) +} +=== tests/cases/conformance/node/types.d.ts === +declare module "fs"; +>"fs" : Symbol("fs", Decl(types.d.ts, 0, 0)) + diff --git a/tests/baselines/reference/nodeModulesDynamicImport(module=nodenext).types b/tests/baselines/reference/nodeModulesDynamicImport(module=nodenext).types new file mode 100644 index 0000000000000..879fb7ca71bf8 --- /dev/null +++ b/tests/baselines/reference/nodeModulesDynamicImport(module=nodenext).types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +export async function main() { +>main : () => Promise + + const { readFile } = await import("fs"); +>readFile : any +>await import("fs") : any +>import("fs") : Promise +>"fs" : "fs" +} +=== tests/cases/conformance/node/index.ts === +// esm format file +export async function main() { +>main : () => Promise + + const { readFile } = await import("fs"); +>readFile : any +>await import("fs") : any +>import("fs") : Promise +>"fs" : "fs" +} +=== tests/cases/conformance/node/types.d.ts === +declare module "fs"; +>"fs" : any + diff --git a/tests/baselines/reference/nodeModulesExportAssignments(module=node12).errors.txt b/tests/baselines/reference/nodeModulesExportAssignments(module=node12).errors.txt new file mode 100644 index 0000000000000..cef2966380663 --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportAssignments(module=node12).errors.txt @@ -0,0 +1,23 @@ +tests/cases/conformance/node/index.ts(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. + + +==== tests/cases/conformance/node/subfolder/index.ts (0 errors) ==== + // cjs format file + const a = {}; + export = a; +==== tests/cases/conformance/node/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. +==== tests/cases/conformance/node/package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module" + } +==== tests/cases/conformance/node/subfolder/package.json (0 errors) ==== + { + "type": "commonjs" + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesExportAssignments(module=node12).js b/tests/baselines/reference/nodeModulesExportAssignments(module=node12).js new file mode 100644 index 0000000000000..687d129e52e4e --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportAssignments(module=node12).js @@ -0,0 +1,30 @@ +//// [tests/cases/conformance/node/nodeModulesExportAssignments.ts] //// + +//// [index.ts] +// cjs format file +const a = {}; +export = a; +//// [index.ts] +// esm format file +const a = {}; +export = a; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} + +//// [index.js] +"use strict"; +// cjs format file +const a = {}; +module.exports = a; +//// [index.js] +// esm format file +const a = {}; +export {}; diff --git a/tests/baselines/reference/nodeModulesExportAssignments(module=node12).symbols b/tests/baselines/reference/nodeModulesExportAssignments(module=node12).symbols new file mode 100644 index 0000000000000..4552dd34157ab --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportAssignments(module=node12).symbols @@ -0,0 +1,16 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +const a = {}; +>a : Symbol(a, Decl(index.ts, 1, 5)) + +export = a; +>a : Symbol(a, Decl(index.ts, 1, 5)) + +=== tests/cases/conformance/node/index.ts === +// esm format file +const a = {}; +>a : Symbol(a, Decl(index.ts, 1, 5)) + +export = a; +>a : Symbol(a, Decl(index.ts, 1, 5)) + diff --git a/tests/baselines/reference/nodeModulesExportAssignments(module=node12).types b/tests/baselines/reference/nodeModulesExportAssignments(module=node12).types new file mode 100644 index 0000000000000..73f7e0869eba3 --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportAssignments(module=node12).types @@ -0,0 +1,18 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +const a = {}; +>a : {} +>{} : {} + +export = a; +>a : {} + +=== tests/cases/conformance/node/index.ts === +// esm format file +const a = {}; +>a : {} +>{} : {} + +export = a; +>a : {} + diff --git a/tests/baselines/reference/nodeModulesExportAssignments(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesExportAssignments(module=nodenext).errors.txt new file mode 100644 index 0000000000000..cef2966380663 --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportAssignments(module=nodenext).errors.txt @@ -0,0 +1,23 @@ +tests/cases/conformance/node/index.ts(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. + + +==== tests/cases/conformance/node/subfolder/index.ts (0 errors) ==== + // cjs format file + const a = {}; + export = a; +==== tests/cases/conformance/node/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. +==== tests/cases/conformance/node/package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module" + } +==== tests/cases/conformance/node/subfolder/package.json (0 errors) ==== + { + "type": "commonjs" + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesExportAssignments(module=nodenext).js b/tests/baselines/reference/nodeModulesExportAssignments(module=nodenext).js new file mode 100644 index 0000000000000..687d129e52e4e --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportAssignments(module=nodenext).js @@ -0,0 +1,30 @@ +//// [tests/cases/conformance/node/nodeModulesExportAssignments.ts] //// + +//// [index.ts] +// cjs format file +const a = {}; +export = a; +//// [index.ts] +// esm format file +const a = {}; +export = a; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} + +//// [index.js] +"use strict"; +// cjs format file +const a = {}; +module.exports = a; +//// [index.js] +// esm format file +const a = {}; +export {}; diff --git a/tests/baselines/reference/nodeModulesExportAssignments(module=nodenext).symbols b/tests/baselines/reference/nodeModulesExportAssignments(module=nodenext).symbols new file mode 100644 index 0000000000000..4552dd34157ab --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportAssignments(module=nodenext).symbols @@ -0,0 +1,16 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +const a = {}; +>a : Symbol(a, Decl(index.ts, 1, 5)) + +export = a; +>a : Symbol(a, Decl(index.ts, 1, 5)) + +=== tests/cases/conformance/node/index.ts === +// esm format file +const a = {}; +>a : Symbol(a, Decl(index.ts, 1, 5)) + +export = a; +>a : Symbol(a, Decl(index.ts, 1, 5)) + diff --git a/tests/baselines/reference/nodeModulesExportAssignments(module=nodenext).types b/tests/baselines/reference/nodeModulesExportAssignments(module=nodenext).types new file mode 100644 index 0000000000000..73f7e0869eba3 --- /dev/null +++ b/tests/baselines/reference/nodeModulesExportAssignments(module=nodenext).types @@ -0,0 +1,18 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +const a = {}; +>a : {} +>{} : {} + +export = a; +>a : {} + +=== tests/cases/conformance/node/index.ts === +// esm format file +const a = {}; +>a : {} +>{} : {} + +export = a; +>a : {} + diff --git a/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node12).errors.txt b/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node12).errors.txt new file mode 100644 index 0000000000000..bcf0d1d592ca8 --- /dev/null +++ b/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node12).errors.txt @@ -0,0 +1,38 @@ +tests/cases/conformance/node/subfolder/index.ts(2,10): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. +tests/cases/conformance/node/subfolder/index.ts(3,7): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. +tests/cases/conformance/node/subfolder/index.ts(4,7): error TS2725: Class name cannot be 'Object' when targeting ES5 with module Node12. +tests/cases/conformance/node/subfolder/index.ts(5,14): error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. + + +==== tests/cases/conformance/node/subfolder/index.ts (4 errors) ==== + // cjs 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 {} + ~~~~~~ +!!! error TS2725: Class name cannot be 'Object' when targeting ES5 with module Node12. + export const __esModule = false; + ~~~~~~~~~~ +!!! error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. + export {require, exports, Object}; +==== tests/cases/conformance/node/index.ts (0 errors) ==== + // esm format file + function require() {} + const exports = {}; + class Object {} + export const __esModule = false; + export {require, exports, Object}; +==== tests/cases/conformance/node/package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module" + } +==== tests/cases/conformance/node/subfolder/package.json (0 errors) ==== + { + "type": "commonjs" + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node12).js b/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node12).js new file mode 100644 index 0000000000000..cc5f8296acfc8 --- /dev/null +++ b/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node12).js @@ -0,0 +1,48 @@ +//// [tests/cases/conformance/node/nodeModulesGeneratedNameCollisions.ts] //// + +//// [index.ts] +// cjs format file +function require() {} +const exports = {}; +class Object {} +export const __esModule = false; +export {require, exports, Object}; +//// [index.ts] +// esm format file +function require() {} +const exports = {}; +class Object {} +export const __esModule = false; +export {require, exports, Object}; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Object = exports.exports = exports.require = exports.__esModule = void 0; +// cjs format file +function require() { } +exports.require = require; +const exports = {}; +exports.exports = exports; +class Object { +} +exports.Object = Object; +exports.__esModule = false; +//// [index.js] +// esm format file +function require() { } +const exports = {}; +class Object { +} +export const __esModule = false; +export { require, exports, Object }; diff --git a/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node12).symbols b/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node12).symbols new file mode 100644 index 0000000000000..9e967fe93b7a4 --- /dev/null +++ b/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node12).symbols @@ -0,0 +1,38 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +function require() {} +>require : Symbol(require, Decl(index.ts, 0, 0)) + +const exports = {}; +>exports : Symbol(exports, Decl(index.ts, 2, 5)) + +class Object {} +>Object : Symbol(Object, Decl(index.ts, 2, 19)) + +export const __esModule = false; +>__esModule : Symbol(__esModule, Decl(index.ts, 4, 12)) + +export {require, exports, Object}; +>require : Symbol(require, Decl(index.ts, 5, 8)) +>exports : Symbol(exports, Decl(index.ts, 5, 16)) +>Object : Symbol(Object, Decl(index.ts, 5, 25)) + +=== tests/cases/conformance/node/index.ts === +// esm format file +function require() {} +>require : Symbol(require, Decl(index.ts, 0, 0)) + +const exports = {}; +>exports : Symbol(exports, Decl(index.ts, 2, 5)) + +class Object {} +>Object : Symbol(Object, Decl(index.ts, 2, 19)) + +export const __esModule = false; +>__esModule : Symbol(__esModule, Decl(index.ts, 4, 12)) + +export {require, exports, Object}; +>require : Symbol(require, Decl(index.ts, 5, 8)) +>exports : Symbol(exports, Decl(index.ts, 5, 16)) +>Object : Symbol(Object, Decl(index.ts, 5, 25)) + diff --git a/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node12).types b/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node12).types new file mode 100644 index 0000000000000..094de6c869242 --- /dev/null +++ b/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=node12).types @@ -0,0 +1,42 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +function require() {} +>require : () => void + +const exports = {}; +>exports : {} +>{} : {} + +class Object {} +>Object : Object + +export const __esModule = false; +>__esModule : false +>false : false + +export {require, exports, Object}; +>require : () => void +>exports : {} +>Object : typeof Object + +=== tests/cases/conformance/node/index.ts === +// esm format file +function require() {} +>require : () => void + +const exports = {}; +>exports : {} +>{} : {} + +class Object {} +>Object : Object + +export const __esModule = false; +>__esModule : false +>false : false + +export {require, exports, Object}; +>require : () => void +>exports : {} +>Object : typeof Object + diff --git a/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=nodenext).errors.txt new file mode 100644 index 0000000000000..abc62c363a23c --- /dev/null +++ b/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=nodenext).errors.txt @@ -0,0 +1,38 @@ +tests/cases/conformance/node/subfolder/index.ts(2,10): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module. +tests/cases/conformance/node/subfolder/index.ts(3,7): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module. +tests/cases/conformance/node/subfolder/index.ts(4,7): error TS2725: Class name cannot be 'Object' when targeting ES5 with module NodeNext. +tests/cases/conformance/node/subfolder/index.ts(5,14): error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. + + +==== tests/cases/conformance/node/subfolder/index.ts (4 errors) ==== + // cjs 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 {} + ~~~~~~ +!!! error TS2725: Class name cannot be 'Object' when targeting ES5 with module NodeNext. + export const __esModule = false; + ~~~~~~~~~~ +!!! error TS1216: Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules. + export {require, exports, Object}; +==== tests/cases/conformance/node/index.ts (0 errors) ==== + // esm format file + function require() {} + const exports = {}; + class Object {} + export const __esModule = false; + export {require, exports, Object}; +==== tests/cases/conformance/node/package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module" + } +==== tests/cases/conformance/node/subfolder/package.json (0 errors) ==== + { + "type": "commonjs" + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=nodenext).js b/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=nodenext).js new file mode 100644 index 0000000000000..cc5f8296acfc8 --- /dev/null +++ b/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=nodenext).js @@ -0,0 +1,48 @@ +//// [tests/cases/conformance/node/nodeModulesGeneratedNameCollisions.ts] //// + +//// [index.ts] +// cjs format file +function require() {} +const exports = {}; +class Object {} +export const __esModule = false; +export {require, exports, Object}; +//// [index.ts] +// esm format file +function require() {} +const exports = {}; +class Object {} +export const __esModule = false; +export {require, exports, Object}; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Object = exports.exports = exports.require = exports.__esModule = void 0; +// cjs format file +function require() { } +exports.require = require; +const exports = {}; +exports.exports = exports; +class Object { +} +exports.Object = Object; +exports.__esModule = false; +//// [index.js] +// esm format file +function require() { } +const exports = {}; +class Object { +} +export const __esModule = false; +export { require, exports, Object }; diff --git a/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=nodenext).symbols b/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=nodenext).symbols new file mode 100644 index 0000000000000..9e967fe93b7a4 --- /dev/null +++ b/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=nodenext).symbols @@ -0,0 +1,38 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +function require() {} +>require : Symbol(require, Decl(index.ts, 0, 0)) + +const exports = {}; +>exports : Symbol(exports, Decl(index.ts, 2, 5)) + +class Object {} +>Object : Symbol(Object, Decl(index.ts, 2, 19)) + +export const __esModule = false; +>__esModule : Symbol(__esModule, Decl(index.ts, 4, 12)) + +export {require, exports, Object}; +>require : Symbol(require, Decl(index.ts, 5, 8)) +>exports : Symbol(exports, Decl(index.ts, 5, 16)) +>Object : Symbol(Object, Decl(index.ts, 5, 25)) + +=== tests/cases/conformance/node/index.ts === +// esm format file +function require() {} +>require : Symbol(require, Decl(index.ts, 0, 0)) + +const exports = {}; +>exports : Symbol(exports, Decl(index.ts, 2, 5)) + +class Object {} +>Object : Symbol(Object, Decl(index.ts, 2, 19)) + +export const __esModule = false; +>__esModule : Symbol(__esModule, Decl(index.ts, 4, 12)) + +export {require, exports, Object}; +>require : Symbol(require, Decl(index.ts, 5, 8)) +>exports : Symbol(exports, Decl(index.ts, 5, 16)) +>Object : Symbol(Object, Decl(index.ts, 5, 25)) + diff --git a/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=nodenext).types b/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=nodenext).types new file mode 100644 index 0000000000000..094de6c869242 --- /dev/null +++ b/tests/baselines/reference/nodeModulesGeneratedNameCollisions(module=nodenext).types @@ -0,0 +1,42 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +function require() {} +>require : () => void + +const exports = {}; +>exports : {} +>{} : {} + +class Object {} +>Object : Object + +export const __esModule = false; +>__esModule : false +>false : false + +export {require, exports, Object}; +>require : () => void +>exports : {} +>Object : typeof Object + +=== tests/cases/conformance/node/index.ts === +// esm format file +function require() {} +>require : () => void + +const exports = {}; +>exports : {} +>{} : {} + +class Object {} +>Object : Object + +export const __esModule = false; +>__esModule : false +>false : false + +export {require, exports, Object}; +>require : () => void +>exports : {} +>Object : typeof Object + diff --git a/tests/baselines/reference/nodeModulesImportAssignments(module=node12).js b/tests/baselines/reference/nodeModulesImportAssignments(module=node12).js new file mode 100644 index 0000000000000..509c046355ebe --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAssignments(module=node12).js @@ -0,0 +1,57 @@ +//// [tests/cases/conformance/node/nodeModulesImportAssignments.ts] //// + +//// [index.ts] +// cjs format file +import fs = require("fs"); +fs.readFile; +export import fs2 = require("fs"); +//// [index.ts] +// esm format file +import fs = require("fs"); +fs.readFile; +export import fs2 = require("fs"); +//// [file.ts] +// esm format file +const __require = null; +const _createRequire = null; +import fs = require("fs"); +fs.readFile; +export import fs2 = require("fs"); +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} +//// [types.d.ts] +declare module "fs"; + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// cjs format file +const fs = require("fs"); +fs.readFile; +exports.fs2 = require("fs"); +//// [index.js] +import { createRequire as _createRequire } from "module"; +const __require = _createRequire(import.meta.url); +// esm format file +const fs = __require("fs"); +fs.readFile; +const fs2 = __require("fs"); +export { fs2 }; +//// [file.js] +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_1("fs"); +fs.readFile; +const fs2 = __require_1("fs"); +export { fs2 }; diff --git a/tests/baselines/reference/nodeModulesImportAssignments(module=node12).symbols b/tests/baselines/reference/nodeModulesImportAssignments(module=node12).symbols new file mode 100644 index 0000000000000..ae7fbc666da4c --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAssignments(module=node12).symbols @@ -0,0 +1,43 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +import fs = require("fs"); +>fs : Symbol(fs, Decl(index.ts, 0, 0)) + +fs.readFile; +>fs : Symbol(fs, Decl(index.ts, 0, 0)) + +export import fs2 = require("fs"); +>fs2 : Symbol(fs2, Decl(index.ts, 2, 12)) + +=== tests/cases/conformance/node/index.ts === +// esm format file +import fs = require("fs"); +>fs : Symbol(fs, Decl(index.ts, 0, 0)) + +fs.readFile; +>fs : Symbol(fs, Decl(index.ts, 0, 0)) + +export import fs2 = require("fs"); +>fs2 : Symbol(fs2, Decl(index.ts, 2, 12)) + +=== tests/cases/conformance/node/file.ts === +// esm format file +const __require = null; +>__require : Symbol(__require, Decl(file.ts, 1, 5)) + +const _createRequire = null; +>_createRequire : Symbol(_createRequire, Decl(file.ts, 2, 5)) + +import fs = require("fs"); +>fs : Symbol(fs, Decl(file.ts, 2, 28)) + +fs.readFile; +>fs : Symbol(fs, Decl(file.ts, 2, 28)) + +export import fs2 = require("fs"); +>fs2 : Symbol(fs2, Decl(file.ts, 4, 12)) + +=== tests/cases/conformance/node/types.d.ts === +declare module "fs"; +>"fs" : Symbol("fs", Decl(types.d.ts, 0, 0)) + diff --git a/tests/baselines/reference/nodeModulesImportAssignments(module=node12).types b/tests/baselines/reference/nodeModulesImportAssignments(module=node12).types new file mode 100644 index 0000000000000..21af2cd798f58 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAssignments(module=node12).types @@ -0,0 +1,51 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +import fs = require("fs"); +>fs : any + +fs.readFile; +>fs.readFile : any +>fs : any +>readFile : any + +export import fs2 = require("fs"); +>fs2 : any + +=== tests/cases/conformance/node/index.ts === +// esm format file +import fs = require("fs"); +>fs : any + +fs.readFile; +>fs.readFile : any +>fs : any +>readFile : any + +export import fs2 = require("fs"); +>fs2 : any + +=== tests/cases/conformance/node/file.ts === +// esm format file +const __require = null; +>__require : any +>null : null + +const _createRequire = null; +>_createRequire : any +>null : null + +import fs = require("fs"); +>fs : any + +fs.readFile; +>fs.readFile : any +>fs : any +>readFile : any + +export import fs2 = require("fs"); +>fs2 : any + +=== tests/cases/conformance/node/types.d.ts === +declare module "fs"; +>"fs" : any + diff --git a/tests/baselines/reference/nodeModulesImportAssignments(module=nodenext).js b/tests/baselines/reference/nodeModulesImportAssignments(module=nodenext).js new file mode 100644 index 0000000000000..509c046355ebe --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAssignments(module=nodenext).js @@ -0,0 +1,57 @@ +//// [tests/cases/conformance/node/nodeModulesImportAssignments.ts] //// + +//// [index.ts] +// cjs format file +import fs = require("fs"); +fs.readFile; +export import fs2 = require("fs"); +//// [index.ts] +// esm format file +import fs = require("fs"); +fs.readFile; +export import fs2 = require("fs"); +//// [file.ts] +// esm format file +const __require = null; +const _createRequire = null; +import fs = require("fs"); +fs.readFile; +export import fs2 = require("fs"); +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} +//// [types.d.ts] +declare module "fs"; + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// cjs format file +const fs = require("fs"); +fs.readFile; +exports.fs2 = require("fs"); +//// [index.js] +import { createRequire as _createRequire } from "module"; +const __require = _createRequire(import.meta.url); +// esm format file +const fs = __require("fs"); +fs.readFile; +const fs2 = __require("fs"); +export { fs2 }; +//// [file.js] +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_1("fs"); +fs.readFile; +const fs2 = __require_1("fs"); +export { fs2 }; diff --git a/tests/baselines/reference/nodeModulesImportAssignments(module=nodenext).symbols b/tests/baselines/reference/nodeModulesImportAssignments(module=nodenext).symbols new file mode 100644 index 0000000000000..ae7fbc666da4c --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAssignments(module=nodenext).symbols @@ -0,0 +1,43 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +import fs = require("fs"); +>fs : Symbol(fs, Decl(index.ts, 0, 0)) + +fs.readFile; +>fs : Symbol(fs, Decl(index.ts, 0, 0)) + +export import fs2 = require("fs"); +>fs2 : Symbol(fs2, Decl(index.ts, 2, 12)) + +=== tests/cases/conformance/node/index.ts === +// esm format file +import fs = require("fs"); +>fs : Symbol(fs, Decl(index.ts, 0, 0)) + +fs.readFile; +>fs : Symbol(fs, Decl(index.ts, 0, 0)) + +export import fs2 = require("fs"); +>fs2 : Symbol(fs2, Decl(index.ts, 2, 12)) + +=== tests/cases/conformance/node/file.ts === +// esm format file +const __require = null; +>__require : Symbol(__require, Decl(file.ts, 1, 5)) + +const _createRequire = null; +>_createRequire : Symbol(_createRequire, Decl(file.ts, 2, 5)) + +import fs = require("fs"); +>fs : Symbol(fs, Decl(file.ts, 2, 28)) + +fs.readFile; +>fs : Symbol(fs, Decl(file.ts, 2, 28)) + +export import fs2 = require("fs"); +>fs2 : Symbol(fs2, Decl(file.ts, 4, 12)) + +=== tests/cases/conformance/node/types.d.ts === +declare module "fs"; +>"fs" : Symbol("fs", Decl(types.d.ts, 0, 0)) + diff --git a/tests/baselines/reference/nodeModulesImportAssignments(module=nodenext).types b/tests/baselines/reference/nodeModulesImportAssignments(module=nodenext).types new file mode 100644 index 0000000000000..21af2cd798f58 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportAssignments(module=nodenext).types @@ -0,0 +1,51 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +import fs = require("fs"); +>fs : any + +fs.readFile; +>fs.readFile : any +>fs : any +>readFile : any + +export import fs2 = require("fs"); +>fs2 : any + +=== tests/cases/conformance/node/index.ts === +// esm format file +import fs = require("fs"); +>fs : any + +fs.readFile; +>fs.readFile : any +>fs : any +>readFile : any + +export import fs2 = require("fs"); +>fs2 : any + +=== tests/cases/conformance/node/file.ts === +// esm format file +const __require = null; +>__require : any +>null : null + +const _createRequire = null; +>_createRequire : any +>null : null + +import fs = require("fs"); +>fs : any + +fs.readFile; +>fs.readFile : any +>fs : any +>readFile : any + +export import fs2 = require("fs"); +>fs2 : any + +=== tests/cases/conformance/node/types.d.ts === +declare module "fs"; +>"fs" : any + diff --git a/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=node12).errors.txt b/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=node12).errors.txt new file mode 100644 index 0000000000000..b4ae0ff6fb045 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=node12).errors.txt @@ -0,0 +1,36 @@ +tests/cases/conformance/node/subfolder/index.ts(2,9): error TS2343: This syntax requires an imported helper named '__importDefault' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/node/subfolder/index.ts(4,1): error TS2343: This syntax requires an imported helper named '__importStar' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + + +==== tests/cases/conformance/node/subfolder/index.ts (2 errors) ==== + // 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"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2343: This syntax requires an imported helper named '__importStar' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + fs.readFile; +==== tests/cases/conformance/node/index.ts (0 errors) ==== + // esm format file + import {default as _fs} from "fs"; + _fs.readFile; + import * as fs from "fs"; + fs.readFile; +==== tests/cases/conformance/node/package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module" + } +==== tests/cases/conformance/node/subfolder/package.json (0 errors) ==== + { + "type": "commonjs" + } +==== tests/cases/conformance/node/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/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=node12).js b/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=node12).js new file mode 100644 index 0000000000000..639365720512b --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=node12).js @@ -0,0 +1,46 @@ +//// [tests/cases/conformance/node/nodeModulesImportHelpersCollisions.ts] //// + +//// [index.ts] +// cjs format file +import {default as _fs} from "fs"; +_fs.readFile; +import * as fs from "fs"; +fs.readFile; +//// [index.ts] +// esm format file +import {default as _fs} from "fs"; +_fs.readFile; +import * as fs from "fs"; +fs.readFile; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} +//// [types.d.ts] +declare module "fs"; +declare module "tslib" { + export {}; + // intentionally missing all helpers +} + +//// [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")); +fs_1.default.readFile; +const fs = tslib_1.__importStar(require("fs")); +fs.readFile; +//// [index.js] +// esm format file +import { default as _fs } from "fs"; +_fs.readFile; +import * as fs from "fs"; +fs.readFile; diff --git a/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=node12).symbols b/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=node12).symbols new file mode 100644 index 0000000000000..996840abd4e8b --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=node12).symbols @@ -0,0 +1,40 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +import {default as _fs} from "fs"; +>default : Symbol(_fs, Decl(types.d.ts, 0, 0)) +>_fs : Symbol(_fs, Decl(index.ts, 1, 8)) + +_fs.readFile; +>_fs : Symbol(_fs, Decl(index.ts, 1, 8)) + +import * as fs from "fs"; +>fs : Symbol(fs, Decl(index.ts, 3, 6)) + +fs.readFile; +>fs : Symbol(fs, Decl(index.ts, 3, 6)) + +=== tests/cases/conformance/node/index.ts === +// esm format file +import {default as _fs} from "fs"; +>default : Symbol(_fs, Decl(types.d.ts, 0, 0)) +>_fs : Symbol(_fs, Decl(index.ts, 1, 8)) + +_fs.readFile; +>_fs : Symbol(_fs, Decl(index.ts, 1, 8)) + +import * as fs from "fs"; +>fs : Symbol(fs, Decl(index.ts, 3, 6)) + +fs.readFile; +>fs : Symbol(fs, Decl(index.ts, 3, 6)) + +=== tests/cases/conformance/node/types.d.ts === +declare module "fs"; +>"fs" : Symbol("fs", Decl(types.d.ts, 0, 0)) + +declare module "tslib" { +>"tslib" : Symbol("tslib", Decl(types.d.ts, 0, 20)) + + export {}; + // intentionally missing all helpers +} diff --git a/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=node12).types b/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=node12).types new file mode 100644 index 0000000000000..e08e9456be9a5 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=node12).types @@ -0,0 +1,48 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +import {default as _fs} from "fs"; +>default : any +>_fs : any + +_fs.readFile; +>_fs.readFile : any +>_fs : any +>readFile : any + +import * as fs from "fs"; +>fs : any + +fs.readFile; +>fs.readFile : any +>fs : any +>readFile : any + +=== tests/cases/conformance/node/index.ts === +// esm format file +import {default as _fs} from "fs"; +>default : any +>_fs : any + +_fs.readFile; +>_fs.readFile : any +>_fs : any +>readFile : any + +import * as fs from "fs"; +>fs : any + +fs.readFile; +>fs.readFile : any +>fs : any +>readFile : any + +=== tests/cases/conformance/node/types.d.ts === +declare module "fs"; +>"fs" : any + +declare module "tslib" { +>"tslib" : typeof import("tslib") + + export {}; + // intentionally missing all helpers +} diff --git a/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=nodenext).errors.txt new file mode 100644 index 0000000000000..b4ae0ff6fb045 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=nodenext).errors.txt @@ -0,0 +1,36 @@ +tests/cases/conformance/node/subfolder/index.ts(2,9): error TS2343: This syntax requires an imported helper named '__importDefault' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/node/subfolder/index.ts(4,1): error TS2343: This syntax requires an imported helper named '__importStar' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + + +==== tests/cases/conformance/node/subfolder/index.ts (2 errors) ==== + // 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"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2343: This syntax requires an imported helper named '__importStar' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + fs.readFile; +==== tests/cases/conformance/node/index.ts (0 errors) ==== + // esm format file + import {default as _fs} from "fs"; + _fs.readFile; + import * as fs from "fs"; + fs.readFile; +==== tests/cases/conformance/node/package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module" + } +==== tests/cases/conformance/node/subfolder/package.json (0 errors) ==== + { + "type": "commonjs" + } +==== tests/cases/conformance/node/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/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=nodenext).js b/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=nodenext).js new file mode 100644 index 0000000000000..639365720512b --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=nodenext).js @@ -0,0 +1,46 @@ +//// [tests/cases/conformance/node/nodeModulesImportHelpersCollisions.ts] //// + +//// [index.ts] +// cjs format file +import {default as _fs} from "fs"; +_fs.readFile; +import * as fs from "fs"; +fs.readFile; +//// [index.ts] +// esm format file +import {default as _fs} from "fs"; +_fs.readFile; +import * as fs from "fs"; +fs.readFile; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} +//// [types.d.ts] +declare module "fs"; +declare module "tslib" { + export {}; + // intentionally missing all helpers +} + +//// [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")); +fs_1.default.readFile; +const fs = tslib_1.__importStar(require("fs")); +fs.readFile; +//// [index.js] +// esm format file +import { default as _fs } from "fs"; +_fs.readFile; +import * as fs from "fs"; +fs.readFile; diff --git a/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=nodenext).symbols b/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=nodenext).symbols new file mode 100644 index 0000000000000..996840abd4e8b --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=nodenext).symbols @@ -0,0 +1,40 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +import {default as _fs} from "fs"; +>default : Symbol(_fs, Decl(types.d.ts, 0, 0)) +>_fs : Symbol(_fs, Decl(index.ts, 1, 8)) + +_fs.readFile; +>_fs : Symbol(_fs, Decl(index.ts, 1, 8)) + +import * as fs from "fs"; +>fs : Symbol(fs, Decl(index.ts, 3, 6)) + +fs.readFile; +>fs : Symbol(fs, Decl(index.ts, 3, 6)) + +=== tests/cases/conformance/node/index.ts === +// esm format file +import {default as _fs} from "fs"; +>default : Symbol(_fs, Decl(types.d.ts, 0, 0)) +>_fs : Symbol(_fs, Decl(index.ts, 1, 8)) + +_fs.readFile; +>_fs : Symbol(_fs, Decl(index.ts, 1, 8)) + +import * as fs from "fs"; +>fs : Symbol(fs, Decl(index.ts, 3, 6)) + +fs.readFile; +>fs : Symbol(fs, Decl(index.ts, 3, 6)) + +=== tests/cases/conformance/node/types.d.ts === +declare module "fs"; +>"fs" : Symbol("fs", Decl(types.d.ts, 0, 0)) + +declare module "tslib" { +>"tslib" : Symbol("tslib", Decl(types.d.ts, 0, 20)) + + export {}; + // intentionally missing all helpers +} diff --git a/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=nodenext).types b/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=nodenext).types new file mode 100644 index 0000000000000..e08e9456be9a5 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions(module=nodenext).types @@ -0,0 +1,48 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +import {default as _fs} from "fs"; +>default : any +>_fs : any + +_fs.readFile; +>_fs.readFile : any +>_fs : any +>readFile : any + +import * as fs from "fs"; +>fs : any + +fs.readFile; +>fs.readFile : any +>fs : any +>readFile : any + +=== tests/cases/conformance/node/index.ts === +// esm format file +import {default as _fs} from "fs"; +>default : any +>_fs : any + +_fs.readFile; +>_fs.readFile : any +>_fs : any +>readFile : any + +import * as fs from "fs"; +>fs : any + +fs.readFile; +>fs.readFile : any +>fs : any +>readFile : any + +=== tests/cases/conformance/node/types.d.ts === +declare module "fs"; +>"fs" : any + +declare module "tslib" { +>"tslib" : typeof import("tslib") + + export {}; + // intentionally missing all helpers +} diff --git a/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=node12).errors.txt b/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=node12).errors.txt new file mode 100644 index 0000000000000..d2f62391af269 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=node12).errors.txt @@ -0,0 +1,32 @@ +tests/cases/conformance/node/subfolder/index.ts(2,1): error TS2343: This syntax requires an imported helper named '__exportStar' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/node/subfolder/index.ts(3,1): error TS2343: This syntax requires an imported helper named '__importStar' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + + +==== tests/cases/conformance/node/subfolder/index.ts (2 errors) ==== + // 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"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2343: This syntax requires an imported helper named '__importStar' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +==== tests/cases/conformance/node/index.ts (0 errors) ==== + // esm format file + export * from "fs"; + export * as fs from "fs"; +==== tests/cases/conformance/node/package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module" + } +==== tests/cases/conformance/node/subfolder/package.json (0 errors) ==== + { + "type": "commonjs" + } +==== tests/cases/conformance/node/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/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=node12).js b/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=node12).js new file mode 100644 index 0000000000000..ab4cb1492b745 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=node12).js @@ -0,0 +1,39 @@ +//// [tests/cases/conformance/node/nodeModulesImportHelpersCollisions2.ts] //// + +//// [index.ts] +// cjs format file +export * from "fs"; +export * as fs from "fs"; +//// [index.ts] +// esm format file +export * from "fs"; +export * as fs from "fs"; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} +//// [types.d.ts] +declare module "fs"; +declare module "tslib" { + export {}; + // intentionally missing all helpers +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.fs = void 0; +const tslib_1 = require("tslib"); +// cjs format file +tslib_1.__exportStar(require("fs"), exports); +exports.fs = tslib_1.__importStar(require("fs")); +//// [index.js] +// esm format file +export * from "fs"; +export * as fs from "fs"; diff --git a/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=node12).symbols b/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=node12).symbols new file mode 100644 index 0000000000000..367ba59adf00f --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=node12).symbols @@ -0,0 +1,22 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +export * from "fs"; +export * as fs from "fs"; +>fs : Symbol(fs, Decl(index.ts, 2, 6)) + +=== tests/cases/conformance/node/index.ts === +// esm format file +export * from "fs"; +export * as fs from "fs"; +>fs : Symbol(fs, Decl(index.ts, 2, 6)) + +=== tests/cases/conformance/node/types.d.ts === +declare module "fs"; +>"fs" : Symbol("fs", Decl(types.d.ts, 0, 0)) + +declare module "tslib" { +>"tslib" : Symbol("tslib", Decl(types.d.ts, 0, 20)) + + export {}; + // intentionally missing all helpers +} diff --git a/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=node12).types b/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=node12).types new file mode 100644 index 0000000000000..6a468baefa7d1 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=node12).types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +export * from "fs"; +export * as fs from "fs"; +>fs : any + +=== tests/cases/conformance/node/index.ts === +// esm format file +export * from "fs"; +export * as fs from "fs"; +>fs : any + +=== tests/cases/conformance/node/types.d.ts === +declare module "fs"; +>"fs" : any + +declare module "tslib" { +>"tslib" : typeof import("tslib") + + export {}; + // intentionally missing all helpers +} diff --git a/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=nodenext).errors.txt new file mode 100644 index 0000000000000..d2f62391af269 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=nodenext).errors.txt @@ -0,0 +1,32 @@ +tests/cases/conformance/node/subfolder/index.ts(2,1): error TS2343: This syntax requires an imported helper named '__exportStar' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +tests/cases/conformance/node/subfolder/index.ts(3,1): error TS2343: This syntax requires an imported helper named '__importStar' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + + +==== tests/cases/conformance/node/subfolder/index.ts (2 errors) ==== + // 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"; + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2343: This syntax requires an imported helper named '__importStar' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. +==== tests/cases/conformance/node/index.ts (0 errors) ==== + // esm format file + export * from "fs"; + export * as fs from "fs"; +==== tests/cases/conformance/node/package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module" + } +==== tests/cases/conformance/node/subfolder/package.json (0 errors) ==== + { + "type": "commonjs" + } +==== tests/cases/conformance/node/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/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=nodenext).js b/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=nodenext).js new file mode 100644 index 0000000000000..ab4cb1492b745 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=nodenext).js @@ -0,0 +1,39 @@ +//// [tests/cases/conformance/node/nodeModulesImportHelpersCollisions2.ts] //// + +//// [index.ts] +// cjs format file +export * from "fs"; +export * as fs from "fs"; +//// [index.ts] +// esm format file +export * from "fs"; +export * as fs from "fs"; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} +//// [types.d.ts] +declare module "fs"; +declare module "tslib" { + export {}; + // intentionally missing all helpers +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.fs = void 0; +const tslib_1 = require("tslib"); +// cjs format file +tslib_1.__exportStar(require("fs"), exports); +exports.fs = tslib_1.__importStar(require("fs")); +//// [index.js] +// esm format file +export * from "fs"; +export * as fs from "fs"; diff --git a/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=nodenext).symbols b/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=nodenext).symbols new file mode 100644 index 0000000000000..367ba59adf00f --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=nodenext).symbols @@ -0,0 +1,22 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +export * from "fs"; +export * as fs from "fs"; +>fs : Symbol(fs, Decl(index.ts, 2, 6)) + +=== tests/cases/conformance/node/index.ts === +// esm format file +export * from "fs"; +export * as fs from "fs"; +>fs : Symbol(fs, Decl(index.ts, 2, 6)) + +=== tests/cases/conformance/node/types.d.ts === +declare module "fs"; +>"fs" : Symbol("fs", Decl(types.d.ts, 0, 0)) + +declare module "tslib" { +>"tslib" : Symbol("tslib", Decl(types.d.ts, 0, 20)) + + export {}; + // intentionally missing all helpers +} diff --git a/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=nodenext).types b/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=nodenext).types new file mode 100644 index 0000000000000..6a468baefa7d1 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions2(module=nodenext).types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +export * from "fs"; +export * as fs from "fs"; +>fs : any + +=== tests/cases/conformance/node/index.ts === +// esm format file +export * from "fs"; +export * as fs from "fs"; +>fs : any + +=== tests/cases/conformance/node/types.d.ts === +declare module "fs"; +>"fs" : any + +declare module "tslib" { +>"tslib" : typeof import("tslib") + + export {}; + // intentionally missing all helpers +} diff --git a/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=node12).errors.txt b/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=node12).errors.txt new file mode 100644 index 0000000000000..d511944f39332 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=node12).errors.txt @@ -0,0 +1,27 @@ +tests/cases/conformance/node/subfolder/index.ts(2,9): error TS2343: This syntax requires an imported helper named '__importDefault' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + + +==== tests/cases/conformance/node/subfolder/index.ts (1 errors) ==== + // 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'. +==== tests/cases/conformance/node/index.ts (0 errors) ==== + // esm format file + export {default} from "fs"; +==== tests/cases/conformance/node/package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module" + } +==== tests/cases/conformance/node/subfolder/package.json (0 errors) ==== + { + "type": "commonjs" + } +==== tests/cases/conformance/node/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/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=node12).js b/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=node12).js new file mode 100644 index 0000000000000..b541d7253fb3d --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=node12).js @@ -0,0 +1,38 @@ +//// [tests/cases/conformance/node/nodeModulesImportHelpersCollisions3.ts] //// + +//// [index.ts] +// cjs format file +export {default} from "fs"; +//// [index.ts] +// esm format file +export {default} from "fs"; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} +//// [types.d.ts] +declare module "fs"; +declare module "tslib" { + export {}; + // intentionally missing all helpers +} + +//// [index.js] +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = void 0; +// cjs format file +var fs_1 = require("fs"); +Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(fs_1).default; } }); +//// [index.js] +// esm format file +export { default } from "fs"; diff --git a/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=node12).symbols b/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=node12).symbols new file mode 100644 index 0000000000000..aec1d32dab1d4 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=node12).symbols @@ -0,0 +1,20 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +export {default} from "fs"; +>default : Symbol(default, Decl(index.ts, 1, 8)) + +=== tests/cases/conformance/node/index.ts === +// esm format file +export {default} from "fs"; +>default : Symbol(default, Decl(index.ts, 1, 8)) + +=== tests/cases/conformance/node/types.d.ts === +declare module "fs"; +>"fs" : Symbol("fs", Decl(types.d.ts, 0, 0)) + +declare module "tslib" { +>"tslib" : Symbol("tslib", Decl(types.d.ts, 0, 20)) + + export {}; + // intentionally missing all helpers +} diff --git a/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=node12).types b/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=node12).types new file mode 100644 index 0000000000000..eef93356ac7bc --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=node12).types @@ -0,0 +1,20 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +export {default} from "fs"; +>default : any + +=== tests/cases/conformance/node/index.ts === +// esm format file +export {default} from "fs"; +>default : any + +=== tests/cases/conformance/node/types.d.ts === +declare module "fs"; +>"fs" : any + +declare module "tslib" { +>"tslib" : typeof import("tslib") + + export {}; + // intentionally missing all helpers +} diff --git a/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=nodenext).errors.txt new file mode 100644 index 0000000000000..d511944f39332 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=nodenext).errors.txt @@ -0,0 +1,27 @@ +tests/cases/conformance/node/subfolder/index.ts(2,9): error TS2343: This syntax requires an imported helper named '__importDefault' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'. + + +==== tests/cases/conformance/node/subfolder/index.ts (1 errors) ==== + // 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'. +==== tests/cases/conformance/node/index.ts (0 errors) ==== + // esm format file + export {default} from "fs"; +==== tests/cases/conformance/node/package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module" + } +==== tests/cases/conformance/node/subfolder/package.json (0 errors) ==== + { + "type": "commonjs" + } +==== tests/cases/conformance/node/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/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=nodenext).js b/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=nodenext).js new file mode 100644 index 0000000000000..b541d7253fb3d --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=nodenext).js @@ -0,0 +1,38 @@ +//// [tests/cases/conformance/node/nodeModulesImportHelpersCollisions3.ts] //// + +//// [index.ts] +// cjs format file +export {default} from "fs"; +//// [index.ts] +// esm format file +export {default} from "fs"; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} +//// [types.d.ts] +declare module "fs"; +declare module "tslib" { + export {}; + // intentionally missing all helpers +} + +//// [index.js] +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = void 0; +// cjs format file +var fs_1 = require("fs"); +Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(fs_1).default; } }); +//// [index.js] +// esm format file +export { default } from "fs"; diff --git a/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=nodenext).symbols b/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=nodenext).symbols new file mode 100644 index 0000000000000..aec1d32dab1d4 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=nodenext).symbols @@ -0,0 +1,20 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +export {default} from "fs"; +>default : Symbol(default, Decl(index.ts, 1, 8)) + +=== tests/cases/conformance/node/index.ts === +// esm format file +export {default} from "fs"; +>default : Symbol(default, Decl(index.ts, 1, 8)) + +=== tests/cases/conformance/node/types.d.ts === +declare module "fs"; +>"fs" : Symbol("fs", Decl(types.d.ts, 0, 0)) + +declare module "tslib" { +>"tslib" : Symbol("tslib", Decl(types.d.ts, 0, 20)) + + export {}; + // intentionally missing all helpers +} diff --git a/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=nodenext).types b/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=nodenext).types new file mode 100644 index 0000000000000..eef93356ac7bc --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportHelpersCollisions3(module=nodenext).types @@ -0,0 +1,20 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +export {default} from "fs"; +>default : any + +=== tests/cases/conformance/node/index.ts === +// esm format file +export {default} from "fs"; +>default : any + +=== tests/cases/conformance/node/types.d.ts === +declare module "fs"; +>"fs" : any + +declare module "tslib" { +>"tslib" : typeof import("tslib") + + export {}; + // intentionally missing all helpers +} diff --git a/tests/baselines/reference/nodeModulesImportMeta(module=node12).errors.txt b/tests/baselines/reference/nodeModulesImportMeta(module=node12).errors.txt new file mode 100644 index 0000000000000..3a7d1f4399ab7 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportMeta(module=node12).errors.txt @@ -0,0 +1,23 @@ +tests/cases/conformance/node/subfolder/index.ts(2,11): error TS1434: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. + + +==== tests/cases/conformance/node/subfolder/index.ts (1 errors) ==== + // cjs format file + const x = import.meta.url; + ~~~~~~~~~~~ +!!! error TS1434: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. + export {x}; +==== tests/cases/conformance/node/index.ts (0 errors) ==== + // esm format file + const x = import.meta.url; + export {x}; +==== tests/cases/conformance/node/package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module" + } +==== tests/cases/conformance/node/subfolder/package.json (0 errors) ==== + { + "type": "commonjs" + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportMeta(module=node12).js b/tests/baselines/reference/nodeModulesImportMeta(module=node12).js new file mode 100644 index 0000000000000..a236853057399 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportMeta(module=node12).js @@ -0,0 +1,32 @@ +//// [tests/cases/conformance/node/nodeModulesImportMeta.ts] //// + +//// [index.ts] +// cjs format file +const x = import.meta.url; +export {x}; +//// [index.ts] +// esm format file +const x = import.meta.url; +export {x}; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// cjs format file +const x = import.meta.url; +exports.x = x; +//// [index.js] +// esm format file +const x = import.meta.url; +export { x }; diff --git a/tests/baselines/reference/nodeModulesImportMeta(module=node12).symbols b/tests/baselines/reference/nodeModulesImportMeta(module=node12).symbols new file mode 100644 index 0000000000000..4f320ebf560e0 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportMeta(module=node12).symbols @@ -0,0 +1,20 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +const x = import.meta.url; +>x : Symbol(x, Decl(index.ts, 1, 5)) +>import.meta.url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --)) +>url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --)) + +export {x}; +>x : Symbol(x, Decl(index.ts, 2, 8)) + +=== tests/cases/conformance/node/index.ts === +// esm format file +const x = import.meta.url; +>x : Symbol(x, Decl(index.ts, 1, 5)) +>import.meta.url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --)) +>url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --)) + +export {x}; +>x : Symbol(x, Decl(index.ts, 2, 8)) + diff --git a/tests/baselines/reference/nodeModulesImportMeta(module=node12).types b/tests/baselines/reference/nodeModulesImportMeta(module=node12).types new file mode 100644 index 0000000000000..6f64dc2b5faa6 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportMeta(module=node12).types @@ -0,0 +1,24 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +const x = import.meta.url; +>x : string +>import.meta.url : string +>import.meta : ImportMeta +>meta : any +>url : string + +export {x}; +>x : string + +=== tests/cases/conformance/node/index.ts === +// esm format file +const x = import.meta.url; +>x : string +>import.meta.url : string +>import.meta : ImportMeta +>meta : any +>url : string + +export {x}; +>x : string + diff --git a/tests/baselines/reference/nodeModulesImportMeta(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportMeta(module=nodenext).errors.txt new file mode 100644 index 0000000000000..3a7d1f4399ab7 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportMeta(module=nodenext).errors.txt @@ -0,0 +1,23 @@ +tests/cases/conformance/node/subfolder/index.ts(2,11): error TS1434: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. + + +==== tests/cases/conformance/node/subfolder/index.ts (1 errors) ==== + // cjs format file + const x = import.meta.url; + ~~~~~~~~~~~ +!!! error TS1434: The 'import.meta' meta-property is not allowed in files which will build into CommonJS output. + export {x}; +==== tests/cases/conformance/node/index.ts (0 errors) ==== + // esm format file + const x = import.meta.url; + export {x}; +==== tests/cases/conformance/node/package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module" + } +==== tests/cases/conformance/node/subfolder/package.json (0 errors) ==== + { + "type": "commonjs" + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesImportMeta(module=nodenext).js b/tests/baselines/reference/nodeModulesImportMeta(module=nodenext).js new file mode 100644 index 0000000000000..a236853057399 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportMeta(module=nodenext).js @@ -0,0 +1,32 @@ +//// [tests/cases/conformance/node/nodeModulesImportMeta.ts] //// + +//// [index.ts] +// cjs format file +const x = import.meta.url; +export {x}; +//// [index.ts] +// esm format file +const x = import.meta.url; +export {x}; +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// cjs format file +const x = import.meta.url; +exports.x = x; +//// [index.js] +// esm format file +const x = import.meta.url; +export { x }; diff --git a/tests/baselines/reference/nodeModulesImportMeta(module=nodenext).symbols b/tests/baselines/reference/nodeModulesImportMeta(module=nodenext).symbols new file mode 100644 index 0000000000000..4f320ebf560e0 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportMeta(module=nodenext).symbols @@ -0,0 +1,20 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +const x = import.meta.url; +>x : Symbol(x, Decl(index.ts, 1, 5)) +>import.meta.url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --)) +>url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --)) + +export {x}; +>x : Symbol(x, Decl(index.ts, 2, 8)) + +=== tests/cases/conformance/node/index.ts === +// esm format file +const x = import.meta.url; +>x : Symbol(x, Decl(index.ts, 1, 5)) +>import.meta.url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --)) +>url : Symbol(ImportMeta.url, Decl(lib.dom.d.ts, --, --)) + +export {x}; +>x : Symbol(x, Decl(index.ts, 2, 8)) + diff --git a/tests/baselines/reference/nodeModulesImportMeta(module=nodenext).types b/tests/baselines/reference/nodeModulesImportMeta(module=nodenext).types new file mode 100644 index 0000000000000..6f64dc2b5faa6 --- /dev/null +++ b/tests/baselines/reference/nodeModulesImportMeta(module=nodenext).types @@ -0,0 +1,24 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +const x = import.meta.url; +>x : string +>import.meta.url : string +>import.meta : ImportMeta +>meta : any +>url : string + +export {x}; +>x : string + +=== tests/cases/conformance/node/index.ts === +// esm format file +const x = import.meta.url; +>x : string +>import.meta.url : string +>import.meta : ImportMeta +>meta : any +>url : string + +export {x}; +>x : string + diff --git a/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node12).errors.txt b/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node12).errors.txt new file mode 100644 index 0000000000000..2569b342924dc --- /dev/null +++ b/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node12).errors.txt @@ -0,0 +1,43 @@ +tests/cases/conformance/node/index.ts(3,22): error TS1435: Module './index.js' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead. +tests/cases/conformance/node/subfolder/index.ts(2,17): error TS1435: Module '../index.js' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead. +tests/cases/conformance/node/subfolder/index.ts(3,22): error TS1435: Module '../index.js' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead. + + +==== tests/cases/conformance/node/subfolder/index.ts (2 errors) ==== + // cjs format file + import {h} from "../index.js"; + ~~~~~~~~~~~~~ +!!! error TS1435: Module '../index.js' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead. + import mod = require("../index.js"); + ~~~~~~~~~~~~~ +!!! error TS1435: Module '../index.js' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead. + import {f as _f} from "./index.js"; + import mod2 = require("./index.js"); + export async function f() { + const mod3 = await import ("../index.js"); + const mod4 = await import ("./index.js"); + h(); + } +==== tests/cases/conformance/node/index.ts (1 errors) ==== + // esm format file + import {h as _h} from "./index.js"; + import mod = require("./index.js"); + ~~~~~~~~~~~~ +!!! error TS1435: Module './index.js' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead. + import {f} from "./subfolder/index.js"; + import mod2 = require("./subfolder/index.js"); + export async function h() { + const mod3 = await import ("./index.js"); + const mod4 = await import ("./subfolder/index.js"); + f(); + } +==== tests/cases/conformance/node/package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module" + } +==== tests/cases/conformance/node/subfolder/package.json (0 errors) ==== + { + "type": "commonjs" + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node12).js b/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node12).js new file mode 100644 index 0000000000000..8dffe7c87517a --- /dev/null +++ b/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node12).js @@ -0,0 +1,54 @@ +//// [tests/cases/conformance/node/nodeModulesSynchronousCallErrors.ts] //// + +//// [index.ts] +// 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() { + const mod3 = await import ("../index.js"); + const mod4 = await import ("./index.js"); + h(); +} +//// [index.ts] +// 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() { + const mod3 = await import ("./index.js"); + const mod4 = await import ("./subfolder/index.js"); + f(); +} +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} + +//// [index.js] +import { f } from "./subfolder/index.js"; +export async function h() { + const mod3 = await import("./index.js"); + const mod4 = await import("./subfolder/index.js"); + f(); +} +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.f = void 0; +// cjs format file +const index_js_1 = require("../index.js"); +async function f() { + const mod3 = await import("../index.js"); + const mod4 = await import("./index.js"); + index_js_1.h(); +} +exports.f = f; diff --git a/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node12).symbols b/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node12).symbols new file mode 100644 index 0000000000000..8b03ab0af9f41 --- /dev/null +++ b/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node12).symbols @@ -0,0 +1,58 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +import {h} from "../index.js"; +>h : Symbol(h, Decl(index.ts, 1, 8)) + +import mod = require("../index.js"); +>mod : Symbol(mod, Decl(index.ts, 1, 30)) + +import {f as _f} from "./index.js"; +>f : Symbol(f, Decl(index.ts, 4, 36)) +>_f : Symbol(_f, Decl(index.ts, 3, 8)) + +import mod2 = require("./index.js"); +>mod2 : Symbol(mod2, Decl(index.ts, 3, 35)) + +export async function f() { +>f : Symbol(f, Decl(index.ts, 4, 36)) + + const mod3 = await import ("../index.js"); +>mod3 : Symbol(mod3, Decl(index.ts, 6, 9)) +>"../index.js" : Symbol(mod, Decl(index.ts, 0, 0)) + + const mod4 = await import ("./index.js"); +>mod4 : Symbol(mod4, Decl(index.ts, 7, 9)) +>"./index.js" : Symbol(mod2, Decl(index.ts, 0, 0)) + + h(); +>h : Symbol(h, Decl(index.ts, 1, 8)) +} +=== tests/cases/conformance/node/index.ts === +// esm format file +import {h as _h} from "./index.js"; +>h : Symbol(h, Decl(index.ts, 4, 46)) +>_h : Symbol(_h, Decl(index.ts, 1, 8)) + +import mod = require("./index.js"); +>mod : Symbol(mod, Decl(index.ts, 1, 35)) + +import {f} from "./subfolder/index.js"; +>f : Symbol(f, Decl(index.ts, 3, 8)) + +import mod2 = require("./subfolder/index.js"); +>mod2 : Symbol(mod2, Decl(index.ts, 3, 39)) + +export async function h() { +>h : Symbol(h, Decl(index.ts, 4, 46)) + + const mod3 = await import ("./index.js"); +>mod3 : Symbol(mod3, Decl(index.ts, 6, 9)) +>"./index.js" : Symbol(mod, Decl(index.ts, 0, 0)) + + const mod4 = await import ("./subfolder/index.js"); +>mod4 : Symbol(mod4, Decl(index.ts, 7, 9)) +>"./subfolder/index.js" : Symbol(mod2, Decl(index.ts, 0, 0)) + + f(); +>f : Symbol(f, Decl(index.ts, 3, 8)) +} diff --git a/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node12).types b/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node12).types new file mode 100644 index 0000000000000..8ca6d52152161 --- /dev/null +++ b/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=node12).types @@ -0,0 +1,68 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +import {h} from "../index.js"; +>h : () => Promise + +import mod = require("../index.js"); +>mod : typeof mod + +import {f as _f} from "./index.js"; +>f : () => Promise +>_f : () => Promise + +import mod2 = require("./index.js"); +>mod2 : typeof mod2 + +export async function f() { +>f : () => Promise + + const mod3 = await import ("../index.js"); +>mod3 : typeof mod +>await import ("../index.js") : typeof mod +>import ("../index.js") : Promise +>"../index.js" : "../index.js" + + const mod4 = await import ("./index.js"); +>mod4 : typeof mod2 +>await import ("./index.js") : typeof mod2 +>import ("./index.js") : Promise +>"./index.js" : "./index.js" + + h(); +>h() : Promise +>h : () => Promise +} +=== tests/cases/conformance/node/index.ts === +// esm format file +import {h as _h} from "./index.js"; +>h : () => Promise +>_h : () => Promise + +import mod = require("./index.js"); +>mod : typeof mod + +import {f} from "./subfolder/index.js"; +>f : () => Promise + +import mod2 = require("./subfolder/index.js"); +>mod2 : typeof mod2 + +export async function h() { +>h : () => Promise + + const mod3 = await import ("./index.js"); +>mod3 : typeof mod +>await import ("./index.js") : typeof mod +>import ("./index.js") : Promise +>"./index.js" : "./index.js" + + const mod4 = await import ("./subfolder/index.js"); +>mod4 : typeof mod2 +>await import ("./subfolder/index.js") : typeof mod2 +>import ("./subfolder/index.js") : Promise +>"./subfolder/index.js" : "./subfolder/index.js" + + f(); +>f() : Promise +>f : () => Promise +} diff --git a/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=nodenext).errors.txt new file mode 100644 index 0000000000000..2569b342924dc --- /dev/null +++ b/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=nodenext).errors.txt @@ -0,0 +1,43 @@ +tests/cases/conformance/node/index.ts(3,22): error TS1435: Module './index.js' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead. +tests/cases/conformance/node/subfolder/index.ts(2,17): error TS1435: Module '../index.js' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead. +tests/cases/conformance/node/subfolder/index.ts(3,22): error TS1435: Module '../index.js' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead. + + +==== tests/cases/conformance/node/subfolder/index.ts (2 errors) ==== + // cjs format file + import {h} from "../index.js"; + ~~~~~~~~~~~~~ +!!! error TS1435: Module '../index.js' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead. + import mod = require("../index.js"); + ~~~~~~~~~~~~~ +!!! error TS1435: Module '../index.js' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead. + import {f as _f} from "./index.js"; + import mod2 = require("./index.js"); + export async function f() { + const mod3 = await import ("../index.js"); + const mod4 = await import ("./index.js"); + h(); + } +==== tests/cases/conformance/node/index.ts (1 errors) ==== + // esm format file + import {h as _h} from "./index.js"; + import mod = require("./index.js"); + ~~~~~~~~~~~~ +!!! error TS1435: Module './index.js' cannot be imported using this construct. The specifier only resolves to an es module, which cannot be imported synchronously. Use dynamic import instead. + import {f} from "./subfolder/index.js"; + import mod2 = require("./subfolder/index.js"); + export async function h() { + const mod3 = await import ("./index.js"); + const mod4 = await import ("./subfolder/index.js"); + f(); + } +==== tests/cases/conformance/node/package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module" + } +==== tests/cases/conformance/node/subfolder/package.json (0 errors) ==== + { + "type": "commonjs" + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=nodenext).js b/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=nodenext).js new file mode 100644 index 0000000000000..8dffe7c87517a --- /dev/null +++ b/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=nodenext).js @@ -0,0 +1,54 @@ +//// [tests/cases/conformance/node/nodeModulesSynchronousCallErrors.ts] //// + +//// [index.ts] +// 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() { + const mod3 = await import ("../index.js"); + const mod4 = await import ("./index.js"); + h(); +} +//// [index.ts] +// 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() { + const mod3 = await import ("./index.js"); + const mod4 = await import ("./subfolder/index.js"); + f(); +} +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} + +//// [index.js] +import { f } from "./subfolder/index.js"; +export async function h() { + const mod3 = await import("./index.js"); + const mod4 = await import("./subfolder/index.js"); + f(); +} +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.f = void 0; +// cjs format file +const index_js_1 = require("../index.js"); +async function f() { + const mod3 = await import("../index.js"); + const mod4 = await import("./index.js"); + index_js_1.h(); +} +exports.f = f; diff --git a/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=nodenext).symbols b/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=nodenext).symbols new file mode 100644 index 0000000000000..8b03ab0af9f41 --- /dev/null +++ b/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=nodenext).symbols @@ -0,0 +1,58 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +import {h} from "../index.js"; +>h : Symbol(h, Decl(index.ts, 1, 8)) + +import mod = require("../index.js"); +>mod : Symbol(mod, Decl(index.ts, 1, 30)) + +import {f as _f} from "./index.js"; +>f : Symbol(f, Decl(index.ts, 4, 36)) +>_f : Symbol(_f, Decl(index.ts, 3, 8)) + +import mod2 = require("./index.js"); +>mod2 : Symbol(mod2, Decl(index.ts, 3, 35)) + +export async function f() { +>f : Symbol(f, Decl(index.ts, 4, 36)) + + const mod3 = await import ("../index.js"); +>mod3 : Symbol(mod3, Decl(index.ts, 6, 9)) +>"../index.js" : Symbol(mod, Decl(index.ts, 0, 0)) + + const mod4 = await import ("./index.js"); +>mod4 : Symbol(mod4, Decl(index.ts, 7, 9)) +>"./index.js" : Symbol(mod2, Decl(index.ts, 0, 0)) + + h(); +>h : Symbol(h, Decl(index.ts, 1, 8)) +} +=== tests/cases/conformance/node/index.ts === +// esm format file +import {h as _h} from "./index.js"; +>h : Symbol(h, Decl(index.ts, 4, 46)) +>_h : Symbol(_h, Decl(index.ts, 1, 8)) + +import mod = require("./index.js"); +>mod : Symbol(mod, Decl(index.ts, 1, 35)) + +import {f} from "./subfolder/index.js"; +>f : Symbol(f, Decl(index.ts, 3, 8)) + +import mod2 = require("./subfolder/index.js"); +>mod2 : Symbol(mod2, Decl(index.ts, 3, 39)) + +export async function h() { +>h : Symbol(h, Decl(index.ts, 4, 46)) + + const mod3 = await import ("./index.js"); +>mod3 : Symbol(mod3, Decl(index.ts, 6, 9)) +>"./index.js" : Symbol(mod, Decl(index.ts, 0, 0)) + + const mod4 = await import ("./subfolder/index.js"); +>mod4 : Symbol(mod4, Decl(index.ts, 7, 9)) +>"./subfolder/index.js" : Symbol(mod2, Decl(index.ts, 0, 0)) + + f(); +>f : Symbol(f, Decl(index.ts, 3, 8)) +} diff --git a/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=nodenext).types b/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=nodenext).types new file mode 100644 index 0000000000000..8ca6d52152161 --- /dev/null +++ b/tests/baselines/reference/nodeModulesSynchronousCallErrors(module=nodenext).types @@ -0,0 +1,68 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +import {h} from "../index.js"; +>h : () => Promise + +import mod = require("../index.js"); +>mod : typeof mod + +import {f as _f} from "./index.js"; +>f : () => Promise +>_f : () => Promise + +import mod2 = require("./index.js"); +>mod2 : typeof mod2 + +export async function f() { +>f : () => Promise + + const mod3 = await import ("../index.js"); +>mod3 : typeof mod +>await import ("../index.js") : typeof mod +>import ("../index.js") : Promise +>"../index.js" : "../index.js" + + const mod4 = await import ("./index.js"); +>mod4 : typeof mod2 +>await import ("./index.js") : typeof mod2 +>import ("./index.js") : Promise +>"./index.js" : "./index.js" + + h(); +>h() : Promise +>h : () => Promise +} +=== tests/cases/conformance/node/index.ts === +// esm format file +import {h as _h} from "./index.js"; +>h : () => Promise +>_h : () => Promise + +import mod = require("./index.js"); +>mod : typeof mod + +import {f} from "./subfolder/index.js"; +>f : () => Promise + +import mod2 = require("./subfolder/index.js"); +>mod2 : typeof mod2 + +export async function h() { +>h : () => Promise + + const mod3 = await import ("./index.js"); +>mod3 : typeof mod +>await import ("./index.js") : typeof mod +>import ("./index.js") : Promise +>"./index.js" : "./index.js" + + const mod4 = await import ("./subfolder/index.js"); +>mod4 : typeof mod2 +>await import ("./subfolder/index.js") : typeof mod2 +>import ("./subfolder/index.js") : Promise +>"./subfolder/index.js" : "./subfolder/index.js" + + f(); +>f() : Promise +>f : () => Promise +} diff --git a/tests/baselines/reference/nodeModulesTopLevelAwait(module=node12).errors.txt b/tests/baselines/reference/nodeModulesTopLevelAwait(module=node12).errors.txt new file mode 100644 index 0000000000000..3a02a6e3d3737 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTopLevelAwait(module=node12).errors.txt @@ -0,0 +1,34 @@ +tests/cases/conformance/node/index.ts(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher. +tests/cases/conformance/node/index.ts(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher. +tests/cases/conformance/node/subfolder/index.ts(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher. +tests/cases/conformance/node/subfolder/index.ts(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher. + + +==== tests/cases/conformance/node/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 'esnext', 'system', or 'nodenext', 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 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher. +==== tests/cases/conformance/node/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 'esnext', 'system', or 'nodenext', 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 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher. +==== tests/cases/conformance/node/package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module" + } +==== tests/cases/conformance/node/subfolder/package.json (0 errors) ==== + { + "type": "commonjs" + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesTopLevelAwait(module=node12).js b/tests/baselines/reference/nodeModulesTopLevelAwait(module=node12).js new file mode 100644 index 0000000000000..ee36688fe4cf3 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTopLevelAwait(module=node12).js @@ -0,0 +1,36 @@ +//// [tests/cases/conformance/node/nodeModulesTopLevelAwait.ts] //// + +//// [index.ts] +// cjs format file +const x = await 1; +export {x}; +for await (const y of []) {} +//// [index.ts] +// esm format file +const x = await 1; +export {x}; +for await (const y of []) {} +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// cjs format file +const x = await 1; +exports.x = x; +for await (const y of []) { } +//// [index.js] +// esm format file +const x = await 1; +export { x }; +for await (const y of []) { } diff --git a/tests/baselines/reference/nodeModulesTopLevelAwait(module=node12).symbols b/tests/baselines/reference/nodeModulesTopLevelAwait(module=node12).symbols new file mode 100644 index 0000000000000..624f09cb77334 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTopLevelAwait(module=node12).symbols @@ -0,0 +1,22 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +const x = await 1; +>x : Symbol(x, Decl(index.ts, 1, 5)) + +export {x}; +>x : Symbol(x, Decl(index.ts, 2, 8)) + +for await (const y of []) {} +>y : Symbol(y, Decl(index.ts, 3, 16)) + +=== tests/cases/conformance/node/index.ts === +// esm format file +const x = await 1; +>x : Symbol(x, Decl(index.ts, 1, 5)) + +export {x}; +>x : Symbol(x, Decl(index.ts, 2, 8)) + +for await (const y of []) {} +>y : Symbol(y, Decl(index.ts, 3, 16)) + diff --git a/tests/baselines/reference/nodeModulesTopLevelAwait(module=node12).types b/tests/baselines/reference/nodeModulesTopLevelAwait(module=node12).types new file mode 100644 index 0000000000000..ae8108f4020a2 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTopLevelAwait(module=node12).types @@ -0,0 +1,28 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +const x = await 1; +>x : 1 +>await 1 : 1 +>1 : 1 + +export {x}; +>x : 1 + +for await (const y of []) {} +>y : any +>[] : undefined[] + +=== tests/cases/conformance/node/index.ts === +// esm format file +const x = await 1; +>x : 1 +>await 1 : 1 +>1 : 1 + +export {x}; +>x : 1 + +for await (const y of []) {} +>y : any +>[] : undefined[] + diff --git a/tests/baselines/reference/nodeModulesTopLevelAwait(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesTopLevelAwait(module=nodenext).errors.txt new file mode 100644 index 0000000000000..a8fa4008492e7 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTopLevelAwait(module=nodenext).errors.txt @@ -0,0 +1,28 @@ +tests/cases/conformance/node/subfolder/index.ts(2,11): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher. +tests/cases/conformance/node/subfolder/index.ts(4,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher. + + +==== tests/cases/conformance/node/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 'esnext', 'system', or 'nodenext', 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 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher. +==== tests/cases/conformance/node/index.ts (0 errors) ==== + // esm format file + const x = await 1; + export {x}; + for await (const y of []) {} +==== tests/cases/conformance/node/package.json (0 errors) ==== + { + "name": "package", + "private": true, + "type": "module" + } +==== tests/cases/conformance/node/subfolder/package.json (0 errors) ==== + { + "type": "commonjs" + } \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesTopLevelAwait(module=nodenext).js b/tests/baselines/reference/nodeModulesTopLevelAwait(module=nodenext).js new file mode 100644 index 0000000000000..ee36688fe4cf3 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTopLevelAwait(module=nodenext).js @@ -0,0 +1,36 @@ +//// [tests/cases/conformance/node/nodeModulesTopLevelAwait.ts] //// + +//// [index.ts] +// cjs format file +const x = await 1; +export {x}; +for await (const y of []) {} +//// [index.ts] +// esm format file +const x = await 1; +export {x}; +for await (const y of []) {} +//// [package.json] +{ + "name": "package", + "private": true, + "type": "module" +} +//// [package.json] +{ + "type": "commonjs" +} + +//// [index.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.x = void 0; +// cjs format file +const x = await 1; +exports.x = x; +for await (const y of []) { } +//// [index.js] +// esm format file +const x = await 1; +export { x }; +for await (const y of []) { } diff --git a/tests/baselines/reference/nodeModulesTopLevelAwait(module=nodenext).symbols b/tests/baselines/reference/nodeModulesTopLevelAwait(module=nodenext).symbols new file mode 100644 index 0000000000000..624f09cb77334 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTopLevelAwait(module=nodenext).symbols @@ -0,0 +1,22 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +const x = await 1; +>x : Symbol(x, Decl(index.ts, 1, 5)) + +export {x}; +>x : Symbol(x, Decl(index.ts, 2, 8)) + +for await (const y of []) {} +>y : Symbol(y, Decl(index.ts, 3, 16)) + +=== tests/cases/conformance/node/index.ts === +// esm format file +const x = await 1; +>x : Symbol(x, Decl(index.ts, 1, 5)) + +export {x}; +>x : Symbol(x, Decl(index.ts, 2, 8)) + +for await (const y of []) {} +>y : Symbol(y, Decl(index.ts, 3, 16)) + diff --git a/tests/baselines/reference/nodeModulesTopLevelAwait(module=nodenext).types b/tests/baselines/reference/nodeModulesTopLevelAwait(module=nodenext).types new file mode 100644 index 0000000000000..ae8108f4020a2 --- /dev/null +++ b/tests/baselines/reference/nodeModulesTopLevelAwait(module=nodenext).types @@ -0,0 +1,28 @@ +=== tests/cases/conformance/node/subfolder/index.ts === +// cjs format file +const x = await 1; +>x : 1 +>await 1 : 1 +>1 : 1 + +export {x}; +>x : 1 + +for await (const y of []) {} +>y : any +>[] : undefined[] + +=== tests/cases/conformance/node/index.ts === +// esm format file +const x = await 1; +>x : 1 +>await 1 : 1 +>1 : 1 + +export {x}; +>x : 1 + +for await (const y of []) {} +>y : any +>[] : undefined[] + diff --git a/tests/baselines/reference/parser.forAwait.es2018.errors.txt b/tests/baselines/reference/parser.forAwait.es2018.errors.txt index cc70ef748d0a7..5969e4b6256b1 100644 --- a/tests/baselines/reference/parser.forAwait.es2018.errors.txt +++ b/tests/baselines/reference/parser.forAwait.es2018.errors.txt @@ -8,10 +8,10 @@ tests/cases/conformance/parser/ecmascript2018/forAwait/inFunctionDeclWithExprIsE tests/cases/conformance/parser/ecmascript2018/forAwait/inGeneratorWithDeclIsError.ts(3,9): error TS1103: 'for await' loops are only allowed within async functions and at the top levels of modules. tests/cases/conformance/parser/ecmascript2018/forAwait/inGeneratorWithExprIsError.ts(3,9): error TS1103: 'for await' loops are only allowed within async functions and at the top levels of modules. tests/cases/conformance/parser/ecmascript2018/forAwait/topLevelWithDeclIsError.ts(1,5): error TS1431: '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. -tests/cases/conformance/parser/ecmascript2018/forAwait/topLevelWithDeclIsError.ts(1,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext' or 'system', and the 'target' option is set to 'es2017' or higher. +tests/cases/conformance/parser/ecmascript2018/forAwait/topLevelWithDeclIsError.ts(1,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher. tests/cases/conformance/parser/ecmascript2018/forAwait/topLevelWithDeclIsError.ts(1,23): error TS2304: Cannot find name 'y'. tests/cases/conformance/parser/ecmascript2018/forAwait/topLevelWithExprIsError.ts(1,5): error TS1431: '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. -tests/cases/conformance/parser/ecmascript2018/forAwait/topLevelWithExprIsError.ts(1,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext' or 'system', and the 'target' option is set to 'es2017' or higher. +tests/cases/conformance/parser/ecmascript2018/forAwait/topLevelWithExprIsError.ts(1,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher. tests/cases/conformance/parser/ecmascript2018/forAwait/topLevelWithExprIsError.ts(1,12): error TS2304: Cannot find name 'x'. tests/cases/conformance/parser/ecmascript2018/forAwait/topLevelWithExprIsError.ts(1,17): error TS2304: Cannot find name 'y'. @@ -21,7 +21,7 @@ tests/cases/conformance/parser/ecmascript2018/forAwait/topLevelWithExprIsError.t ~~~~~ !!! error TS1431: '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. ~~~~~ -!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext' or 'system', and the 'target' option is set to 'es2017' or higher. +!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher. ~ !!! error TS2304: Cannot find name 'y'. } @@ -30,7 +30,7 @@ tests/cases/conformance/parser/ecmascript2018/forAwait/topLevelWithExprIsError.t ~~~~~ !!! error TS1431: '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. ~~~~~ -!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext' or 'system', and the 'target' option is set to 'es2017' or higher. +!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher. ~ !!! error TS2304: Cannot find name 'x'. ~ diff --git a/tests/baselines/reference/topLevelAwait.1(module=esnext,target=es2015).errors.txt b/tests/baselines/reference/topLevelAwait.1(module=esnext,target=es2015).errors.txt index aeea7ac641fa2..1c4b9b820b7ed 100644 --- a/tests/baselines/reference/topLevelAwait.1(module=esnext,target=es2015).errors.txt +++ b/tests/baselines/reference/topLevelAwait.1(module=esnext,target=es2015).errors.txt @@ -1,13 +1,13 @@ -tests/cases/conformance/externalModules/index.ts(2,1): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext' or 'system', and the 'target' option is set to 'es2017' or higher. -tests/cases/conformance/externalModules/index.ts(46,3): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext' or 'system', and the 'target' option is set to 'es2017' or higher. -tests/cases/conformance/externalModules/other.ts(9,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext' or 'system', and the 'target' option is set to 'es2017' or higher. +tests/cases/conformance/externalModules/index.ts(2,1): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher. +tests/cases/conformance/externalModules/index.ts(46,3): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher. +tests/cases/conformance/externalModules/other.ts(9,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher. ==== tests/cases/conformance/externalModules/index.ts (2 errors) ==== export const x = 1; await x; ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext' or 'system', and the 'target' option is set to 'es2017' or higher. +!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher. // reparse element access as await await [x]; @@ -53,7 +53,7 @@ tests/cases/conformance/externalModules/other.ts(9,5): error TS1432: Top-level ' declare const dec: any; @(await dec) ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext' or 'system', and the 'target' option is set to 'es2017' or higher. +!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher. class C { } @@ -84,7 +84,7 @@ tests/cases/conformance/externalModules/other.ts(9,5): error TS1432: Top-level ' for await (const item of arr) { ~~~~~ -!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext' or 'system', and the 'target' option is set to 'es2017' or higher. +!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher. item; } \ No newline at end of file diff --git a/tests/baselines/reference/topLevelAwait.1(module=system,target=es2015).errors.txt b/tests/baselines/reference/topLevelAwait.1(module=system,target=es2015).errors.txt index aeea7ac641fa2..1c4b9b820b7ed 100644 --- a/tests/baselines/reference/topLevelAwait.1(module=system,target=es2015).errors.txt +++ b/tests/baselines/reference/topLevelAwait.1(module=system,target=es2015).errors.txt @@ -1,13 +1,13 @@ -tests/cases/conformance/externalModules/index.ts(2,1): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext' or 'system', and the 'target' option is set to 'es2017' or higher. -tests/cases/conformance/externalModules/index.ts(46,3): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext' or 'system', and the 'target' option is set to 'es2017' or higher. -tests/cases/conformance/externalModules/other.ts(9,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext' or 'system', and the 'target' option is set to 'es2017' or higher. +tests/cases/conformance/externalModules/index.ts(2,1): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher. +tests/cases/conformance/externalModules/index.ts(46,3): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher. +tests/cases/conformance/externalModules/other.ts(9,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher. ==== tests/cases/conformance/externalModules/index.ts (2 errors) ==== export const x = 1; await x; ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext' or 'system', and the 'target' option is set to 'es2017' or higher. +!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher. // reparse element access as await await [x]; @@ -53,7 +53,7 @@ tests/cases/conformance/externalModules/other.ts(9,5): error TS1432: Top-level ' declare const dec: any; @(await dec) ~~~~~ -!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext' or 'system', and the 'target' option is set to 'es2017' or higher. +!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher. class C { } @@ -84,7 +84,7 @@ tests/cases/conformance/externalModules/other.ts(9,5): error TS1432: Top-level ' for await (const item of arr) { ~~~~~ -!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext' or 'system', and the 'target' option is set to 'es2017' or higher. +!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher. item; } \ No newline at end of file diff --git a/tests/baselines/reference/transpile/Report an error when compiler-options module-kind is out-of-range.errors.txt b/tests/baselines/reference/transpile/Report an error when compiler-options module-kind is out-of-range.errors.txt index 812f55c9be313..f4a6f8d147e63 100644 --- a/tests/baselines/reference/transpile/Report an error when compiler-options module-kind is out-of-range.errors.txt +++ b/tests/baselines/reference/transpile/Report an error when compiler-options module-kind is out-of-range.errors.txt @@ -1,6 +1,6 @@ -error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext'. +error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext', 'node12', 'nodenext'. -!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext'. +!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext', 'node12', 'nodenext'. ==== file.ts (0 errors) ==== \ No newline at end of file diff --git a/tests/baselines/reference/transpile/Report an error when compiler-options module-kind is out-of-range.oldTranspile.errors.txt b/tests/baselines/reference/transpile/Report an error when compiler-options module-kind is out-of-range.oldTranspile.errors.txt index 812f55c9be313..f4a6f8d147e63 100644 --- a/tests/baselines/reference/transpile/Report an error when compiler-options module-kind is out-of-range.oldTranspile.errors.txt +++ b/tests/baselines/reference/transpile/Report an error when compiler-options module-kind is out-of-range.oldTranspile.errors.txt @@ -1,6 +1,6 @@ -error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext'. +error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext', 'node12', 'nodenext'. -!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext'. +!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext', 'node12', 'nodenext'. ==== file.ts (0 errors) ==== \ No newline at end of file diff --git a/tests/baselines/reference/transpile/Report an error when compiler-options target-script is out-of-range.errors.txt b/tests/baselines/reference/transpile/Report an error when compiler-options target-script is out-of-range.errors.txt index 812f55c9be313..f4a6f8d147e63 100644 --- a/tests/baselines/reference/transpile/Report an error when compiler-options target-script is out-of-range.errors.txt +++ b/tests/baselines/reference/transpile/Report an error when compiler-options target-script is out-of-range.errors.txt @@ -1,6 +1,6 @@ -error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext'. +error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext', 'node12', 'nodenext'. -!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext'. +!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext', 'node12', 'nodenext'. ==== file.ts (0 errors) ==== \ No newline at end of file diff --git a/tests/baselines/reference/transpile/Report an error when compiler-options target-script is out-of-range.oldTranspile.errors.txt b/tests/baselines/reference/transpile/Report an error when compiler-options target-script is out-of-range.oldTranspile.errors.txt index 812f55c9be313..f4a6f8d147e63 100644 --- a/tests/baselines/reference/transpile/Report an error when compiler-options target-script is out-of-range.oldTranspile.errors.txt +++ b/tests/baselines/reference/transpile/Report an error when compiler-options target-script is out-of-range.oldTranspile.errors.txt @@ -1,6 +1,6 @@ -error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext'. +error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext', 'node12', 'nodenext'. -!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext'. +!!! error TS6046: Argument for '--module' option must be: 'none', 'commonjs', 'amd', 'system', 'umd', 'es6', 'es2015', 'es2020', 'esnext', 'node12', 'nodenext'. ==== file.ts (0 errors) ==== \ No newline at end of file diff --git a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/files-containing-json-file.js b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/files-containing-json-file.js index 99b510573dea5..03141f667957e 100644 --- a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/files-containing-json-file.js +++ b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/files-containing-json-file.js @@ -62,7 +62,7 @@ Output:: [12:00:00 AM] Building project '/src/tsconfig_withFiles.json'... lib/lib.d.ts - Default library + Default library for target 'es3' src/src/hello.json Imported via "./hello.json" from file 'src/src/index.ts' Part of 'files' list in tsconfig.json diff --git a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-and-files.js b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-and-files.js index 593636109c951..512502e4ba199 100644 --- a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-and-files.js +++ b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-and-files.js @@ -65,7 +65,7 @@ Output:: [12:00:00 AM] Building project '/src/tsconfig_withIncludeAndFiles.json'... lib/lib.d.ts - Default library + Default library for target 'es3' src/src/hello.json Part of 'files' list in tsconfig.json Imported via "./hello.json" from file 'src/src/index.ts' diff --git a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-of-json-along-with-other-include-and-file-name-matches-ts-file.js b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-of-json-along-with-other-include-and-file-name-matches-ts-file.js index 54cfc7a358bcd..a061332c37d79 100644 --- a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-of-json-along-with-other-include-and-file-name-matches-ts-file.js +++ b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-of-json-along-with-other-include-and-file-name-matches-ts-file.js @@ -60,7 +60,7 @@ Output:: [12:00:00 AM] Building project '/src/tsconfig_withIncludeOfJson.json'... lib/lib.d.ts - Default library + Default library for target 'es3' src/src/index.json Imported via "./index.json" from file 'src/src/index.ts' Matched by include pattern 'src/**/*.json' in 'src/tsconfig_withIncludeOfJson.json' diff --git a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-of-json-along-with-other-include.js b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-of-json-along-with-other-include.js index c425de68849b1..fba5c04a46c20 100644 --- a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-of-json-along-with-other-include.js +++ b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-of-json-along-with-other-include.js @@ -62,7 +62,7 @@ Output:: [12:00:00 AM] Building project '/src/tsconfig_withIncludeOfJson.json'... lib/lib.d.ts - Default library + Default library for target 'es3' src/src/hello.json Imported via "./hello.json" from file 'src/src/index.ts' Matched by include pattern 'src/**/*.json' in 'src/tsconfig_withIncludeOfJson.json' diff --git a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-only.js b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-only.js index a81ce99803d35..af959e9d08178 100644 --- a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-only.js +++ b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/include-only.js @@ -67,7 +67,7 @@ Output::    ~~~~~~~~~~~~~~ lib/lib.d.ts - Default library + Default library for target 'es3' src/src/hello.json Imported via "./hello.json" from file 'src/src/index.ts' src/src/index.ts diff --git a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/sourcemap.js b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/sourcemap.js index ec62927b95a62..5ab390978ea2f 100644 --- a/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/sourcemap.js +++ b/tests/baselines/reference/tsbuild/resolveJsonModule/initial-build/sourcemap.js @@ -62,7 +62,7 @@ Output:: [12:01:00 AM] Building project '/src/tsconfig_withFiles.json'... lib/lib.d.ts - Default library + Default library for target 'es3' src/src/hello.json Imported via "./hello.json" from file 'src/src/index.ts' Part of 'files' list in tsconfig.json diff --git a/tests/baselines/reference/tsbuild/sample1/initial-build/explainFiles.js b/tests/baselines/reference/tsbuild/sample1/initial-build/explainFiles.js index ea560846edfb0..74c2463e3a398 100644 --- a/tests/baselines/reference/tsbuild/sample1/initial-build/explainFiles.js +++ b/tests/baselines/reference/tsbuild/sample1/initial-build/explainFiles.js @@ -108,7 +108,7 @@ Output:: [12:01:00 AM] Building project '/src/core/tsconfig.json'... lib/lib.d.ts - Default library + Default library for target 'es3' src/core/anotherModule.ts Matched by include pattern '**/*' in 'src/core/tsconfig.json' src/core/index.ts @@ -120,7 +120,7 @@ src/core/some_decl.d.ts [12:01:00 AM] Building project '/src/logic/tsconfig.json'... lib/lib.d.ts - Default library + Default library for target 'es3' src/core/index.d.ts Imported via '../core/index' from file 'src/logic/index.ts' File is output of project reference source 'src/core/index.ts' @@ -134,7 +134,7 @@ src/logic/index.ts [12:01:00 AM] Building project '/src/tests/tsconfig.json'... lib/lib.d.ts - Default library + Default library for target 'es3' src/core/index.d.ts Imported via '../core/index' from file 'src/tests/index.ts' File is output of project reference source 'src/core/index.ts' @@ -450,7 +450,7 @@ Output:: [12:04:00 AM] Updating unchanged output timestamps of project '/src/core/tsconfig.json'... lib/lib.d.ts - Default library + Default library for target 'es3' src/core/anotherModule.ts Matched by include pattern '**/*' in 'src/core/tsconfig.json' src/core/index.ts @@ -462,7 +462,7 @@ src/core/some_decl.d.ts [12:04:00 AM] Building project '/src/logic/tsconfig.json'... lib/lib.d.ts - Default library + Default library for target 'es3' src/core/index.d.ts Imported via '../core/index' from file 'src/logic/index.ts' File is output of project reference source 'src/core/index.ts' @@ -476,7 +476,7 @@ src/logic/index.ts [12:04:00 AM] Building project '/src/tests/tsconfig.json'... lib/lib.d.ts - Default library + Default library for target 'es3' src/core/index.d.ts Imported via '../core/index' from file 'src/tests/index.ts' File is output of project reference source 'src/core/index.ts' @@ -753,7 +753,7 @@ Output:: [12:07:00 AM] Updating unchanged output timestamps of project '/src/core/tsconfig.json'... lib/lib.d.ts - Default library + Default library for target 'es3' src/core/anotherModule.ts Matched by include pattern '**/*' in 'src/core/tsconfig.json' src/core/index.ts diff --git a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/jsxImportSource-option-changed.js b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/jsxImportSource-option-changed.js index 87cfcd2ce0d08..3cd4195acc2a0 100644 --- a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/jsxImportSource-option-changed.js +++ b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/jsxImportSource-option-changed.js @@ -52,7 +52,7 @@ Output:: File is matched by 'files' list specified here. ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' node_modules/react/jsx-Runtime/index.d.ts Part of 'files' list in tsconfig.json Imported via "react/jsx-runtime" from file 'index.tsx' with packageId 'react/jsx-runtime/index.d.ts@0.0.1' to import 'jsx' and 'jsxs' factory functions diff --git a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-Windows-style-drive-root-is-lowercase.js b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-Windows-style-drive-root-is-lowercase.js index 121a11936580a..4a9d9e07bb163 100644 --- a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-Windows-style-drive-root-is-lowercase.js +++ b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-Windows-style-drive-root-is-lowercase.js @@ -36,7 +36,7 @@ Output:: [12:00:17 AM] Starting compilation in watch mode... a/lib/lib.d.ts - Default library + Default library for target 'es3' project/a.ts Matched by include pattern '**/*' in 'project/tsconfig.json' Imported via "C://project/a" from file 'project/b.ts' @@ -114,7 +114,7 @@ Output:: [12:00:25 AM] File change detected. Starting incremental compilation... a/lib/lib.d.ts - Default library + Default library for target 'es3' project/a.ts Matched by include pattern '**/*' in 'project/tsconfig.json' Imported via "C://project/a" from file 'project/b.ts' diff --git a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-Windows-style-drive-root-is-uppercase.js b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-Windows-style-drive-root-is-uppercase.js index 0abafe3c5b6db..0e2cde15186f8 100644 --- a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-Windows-style-drive-root-is-uppercase.js +++ b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-Windows-style-drive-root-is-uppercase.js @@ -36,7 +36,7 @@ Output:: [12:00:17 AM] Starting compilation in watch mode... a/lib/lib.d.ts - Default library + Default library for target 'es3' project/a.ts Matched by include pattern '**/*' in 'project/tsconfig.json' Imported via "C://project/a" from file 'project/b.ts' @@ -114,7 +114,7 @@ Output:: [12:00:25 AM] File change detected. Starting incremental compilation... a/lib/lib.d.ts - Default library + Default library for target 'es3' project/a.ts Matched by include pattern '**/*' in 'project/tsconfig.json' Imported via "C://project/a" from file 'project/b.ts' diff --git a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-both-directory-symlink-target-and-import-match-disk.js b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-both-directory-symlink-target-and-import-match-disk.js index 181eee57a71c5..8b8b3038d208e 100644 --- a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-both-directory-symlink-target-and-import-match-disk.js +++ b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-both-directory-symlink-target-and-import-match-disk.js @@ -37,7 +37,7 @@ Output:: [12:00:27 AM] Starting compilation in watch mode... ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' XY/a.ts Imported via "./XY/a" from file 'b.ts' Matched by include pattern '**/*' in 'tsconfig.json' @@ -145,7 +145,7 @@ Output:: [12:00:33 AM] File change detected. Starting incremental compilation... ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' XY/a.ts Imported via "./XY/a" from file 'b.ts' Matched by include pattern '**/*' in 'tsconfig.json' diff --git a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-both-file-symlink-target-and-import-match-disk.js b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-both-file-symlink-target-and-import-match-disk.js index 05eeb3365cb64..6c9aea2605ef9 100644 --- a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-both-file-symlink-target-and-import-match-disk.js +++ b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-both-file-symlink-target-and-import-match-disk.js @@ -37,7 +37,7 @@ Output:: [12:00:25 AM] Starting compilation in watch mode... ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' XY.ts Matched by include pattern '**/*' in 'tsconfig.json' Imported via "./XY" from file 'b.ts' @@ -129,7 +129,7 @@ Output:: [12:00:35 AM] File change detected. Starting incremental compilation... ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' XY.ts Matched by include pattern '**/*' in 'tsconfig.json' Imported via "./XY" from file 'b.ts' diff --git a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-directory-symlink-target-matches-disk-but-import-does-not.js b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-directory-symlink-target-matches-disk-but-import-does-not.js index dea0a4fec861c..19203a08aa874 100644 --- a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-directory-symlink-target-matches-disk-but-import-does-not.js +++ b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-directory-symlink-target-matches-disk-but-import-does-not.js @@ -37,7 +37,7 @@ Output:: [12:00:27 AM] Starting compilation in watch mode... ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' XY/a.ts Imported via "./XY/a" from file 'b.ts' Matched by include pattern '**/*' in 'tsconfig.json' @@ -145,7 +145,7 @@ Output:: [12:00:33 AM] File change detected. Starting incremental compilation... ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' XY/a.ts Imported via "./XY/a" from file 'b.ts' Matched by include pattern '**/*' in 'tsconfig.json' diff --git a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-file-symlink-target-matches-disk-but-import-does-not.js b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-file-symlink-target-matches-disk-but-import-does-not.js index 43cfc8369f1e8..b56177b127508 100644 --- a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-file-symlink-target-matches-disk-but-import-does-not.js +++ b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-file-symlink-target-matches-disk-but-import-does-not.js @@ -37,7 +37,7 @@ Output:: [12:00:25 AM] Starting compilation in watch mode... ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' XY.ts Matched by include pattern '**/*' in 'tsconfig.json' Imported via "./XY" from file 'b.ts' @@ -129,7 +129,7 @@ Output:: [12:00:35 AM] File change detected. Starting incremental compilation... ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' XY.ts Matched by include pattern '**/*' in 'tsconfig.json' Imported via "./XY" from file 'b.ts' diff --git a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import,-directory-symlink-target,-and-disk-are-all-different.js b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import,-directory-symlink-target,-and-disk-are-all-different.js index 430cef763a643..7ec540b0a74dd 100644 --- a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import,-directory-symlink-target,-and-disk-are-all-different.js +++ b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import,-directory-symlink-target,-and-disk-are-all-different.js @@ -42,7 +42,7 @@ Output::    ~~~~~~~~ ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' link/a.ts Imported via "./link/a" from file 'b.ts' b.ts @@ -156,7 +156,7 @@ Output::    ~~~~~~~~ ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' link/a.ts Imported via "./link/a" from file 'b.ts' b.ts diff --git a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import,-file-symlink-target,-and-disk-are-all-different.js b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import,-file-symlink-target,-and-disk-are-all-different.js index 9d53e28a9f3a9..464d7d53ed849 100644 --- a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import,-file-symlink-target,-and-disk-are-all-different.js +++ b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import,-file-symlink-target,-and-disk-are-all-different.js @@ -42,7 +42,7 @@ Output::    ~~~~~~ ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' XY.ts Matched by include pattern '**/*' in 'tsconfig.json' link.ts @@ -142,7 +142,7 @@ Output::    ~~~~~~ ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' XY.ts Matched by include pattern '**/*' in 'tsconfig.json' link.ts diff --git a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import-and-directory-symlink-target-agree-but-do-not-match-disk.js b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import-and-directory-symlink-target-agree-but-do-not-match-disk.js index 6f50b59b2ae9a..7fff9ecdeec2b 100644 --- a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import-and-directory-symlink-target-agree-but-do-not-match-disk.js +++ b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import-and-directory-symlink-target-agree-but-do-not-match-disk.js @@ -45,7 +45,7 @@ Output::    ~~~~~~~~ ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' Xy/a.ts Imported via "./Xy/a" from file 'b.ts' Matched by include pattern '**/*' in 'tsconfig.json' @@ -161,7 +161,7 @@ Output::    ~~~~~~~~ ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' Xy/a.ts Imported via "./Xy/a" from file 'b.ts' Matched by include pattern '**/*' in 'tsconfig.json' diff --git a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import-and-file-symlink-target-agree-but-do-not-match-disk.js b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import-and-file-symlink-target-agree-but-do-not-match-disk.js index 12396b4bbacb7..5e893c36767d5 100644 --- a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import-and-file-symlink-target-agree-but-do-not-match-disk.js +++ b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import-and-file-symlink-target-agree-but-do-not-match-disk.js @@ -45,7 +45,7 @@ Output::    ~~~~~~ ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' XY.ts Matched by include pattern '**/*' in 'tsconfig.json' Imported via "./Xy" from file 'b.ts' @@ -145,7 +145,7 @@ Output::    ~~~~~~ ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' XY.ts Matched by include pattern '**/*' in 'tsconfig.json' Imported via "./Xy" from file 'b.ts' diff --git a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import-matches-disk-but-directory-symlink-target-does-not.js b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import-matches-disk-but-directory-symlink-target-does-not.js index 67d0909b607e3..d51b695e68415 100644 --- a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import-matches-disk-but-directory-symlink-target-does-not.js +++ b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import-matches-disk-but-directory-symlink-target-does-not.js @@ -45,7 +45,7 @@ Output::    ~~~~~~~~ ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' Xy/a.ts Imported via "./Xy/a" from file 'b.ts' Matched by include pattern '**/*' in 'tsconfig.json' @@ -161,7 +161,7 @@ Output::    ~~~~~~~~ ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' Xy/a.ts Imported via "./Xy/a" from file 'b.ts' Matched by include pattern '**/*' in 'tsconfig.json' diff --git a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import-matches-disk-but-file-symlink-target-does-not.js b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import-matches-disk-but-file-symlink-target-does-not.js index c6307c61ad097..68c66df2d9e0f 100644 --- a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import-matches-disk-but-file-symlink-target-does-not.js +++ b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-import-matches-disk-but-file-symlink-target-does-not.js @@ -45,7 +45,7 @@ Output::    ~~~~~~ ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' XY.ts Matched by include pattern '**/*' in 'tsconfig.json' Imported via "./Xy" from file 'b.ts' @@ -145,7 +145,7 @@ Output::    ~~~~~~ ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' XY.ts Matched by include pattern '**/*' in 'tsconfig.json' Imported via "./Xy" from file 'b.ts' diff --git a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-relative-information-file-location-changes.js b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-relative-information-file-location-changes.js index 165657371ce24..8804f135d405e 100644 --- a/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-relative-information-file-location-changes.js +++ b/tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/when-relative-information-file-location-changes.js @@ -59,7 +59,7 @@ Output:: File is included via import here. ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ModuleC.ts Imported via "./ModuleC" from file 'moduleA.ts' Imported via "./moduleC" from file 'moduleB.ts' @@ -168,7 +168,7 @@ Output:: File is included via import here. ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ModuleC.ts Imported via "./ModuleC" from file 'moduleA.ts' Imported via "./moduleC" from file 'moduleB.ts' diff --git a/tests/baselines/reference/tscWatch/incremental/jsxImportSource-option-changed-incremental.js b/tests/baselines/reference/tscWatch/incremental/jsxImportSource-option-changed-incremental.js index b2cf4bfc9b5ae..6f9a9a986978b 100644 --- a/tests/baselines/reference/tscWatch/incremental/jsxImportSource-option-changed-incremental.js +++ b/tests/baselines/reference/tscWatch/incremental/jsxImportSource-option-changed-incremental.js @@ -58,7 +58,7 @@ export const App = () =>
; /a/lib/tsc.js -i --explainFiles Output:: ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' node_modules/react/jsx-runtime/index.d.ts Imported via "react/jsx-runtime" from file 'index.tsx' with packageId 'react/jsx-runtime/index.d.ts@0.0.1' to import 'jsx' and 'jsxs' factory functions index.tsx @@ -167,7 +167,7 @@ Output::    ~~~~~ ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' node_modules/preact/jsx-runtime/index.d.ts Imported via "preact/jsx-runtime" from file 'index.tsx' with packageId 'preact/jsx-runtime/index.d.ts@0.0.1' to import 'jsx' and 'jsxs' factory functions index.tsx diff --git a/tests/baselines/reference/tscWatch/incremental/jsxImportSource-option-changed-watch.js b/tests/baselines/reference/tscWatch/incremental/jsxImportSource-option-changed-watch.js index e06cc13e9f3d0..d8a896af90c6b 100644 --- a/tests/baselines/reference/tscWatch/incremental/jsxImportSource-option-changed-watch.js +++ b/tests/baselines/reference/tscWatch/incremental/jsxImportSource-option-changed-watch.js @@ -61,7 +61,7 @@ Output:: [12:00:39 AM] Starting compilation in watch mode... ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' node_modules/react/jsx-runtime/index.d.ts Imported via "react/jsx-runtime" from file 'index.tsx' with packageId 'react/jsx-runtime/index.d.ts@0.0.1' to import 'jsx' and 'jsxs' factory functions index.tsx @@ -189,7 +189,7 @@ Output::    ~~~~~ ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' node_modules/preact/jsx-runtime/index.d.ts Imported via "preact/jsx-runtime" from file 'index.tsx' with packageId 'preact/jsx-runtime/index.d.ts@0.0.1' to import 'jsx' and 'jsxs' factory functions index.tsx diff --git a/tests/baselines/reference/tscWatch/programUpdates/changes-in-files-are-reflected-in-project-structure.js b/tests/baselines/reference/tscWatch/programUpdates/changes-in-files-are-reflected-in-project-structure.js index af5a1e98a1b21..fb7461a79c76b 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/changes-in-files-are-reflected-in-project-structure.js +++ b/tests/baselines/reference/tscWatch/programUpdates/changes-in-files-are-reflected-in-project-structure.js @@ -28,7 +28,7 @@ Output:: [12:00:19 AM] Starting compilation in watch mode... a/lib/lib.d.ts - Default library + Default library for target 'es3' a/b/f2.ts Imported via "./f2" from file 'a/b/f1.ts' a/b/f1.ts @@ -100,7 +100,7 @@ Output:: [12:00:27 AM] File change detected. Starting incremental compilation... a/lib/lib.d.ts - Default library + Default library for target 'es3' a/c/f3.ts Imported via "../c/f3" from file 'a/b/f2.ts' a/b/f2.ts diff --git a/tests/baselines/reference/tscWatch/programUpdates/handle-recreated-files-correctly.js b/tests/baselines/reference/tscWatch/programUpdates/handle-recreated-files-correctly.js index 407b2a4b4fdcc..b824bf667c4e2 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/handle-recreated-files-correctly.js +++ b/tests/baselines/reference/tscWatch/programUpdates/handle-recreated-files-correctly.js @@ -28,7 +28,7 @@ Output:: [12:00:17 AM] Starting compilation in watch mode... a/lib/lib.d.ts - Default library + Default library for target 'es3' a/b/commonFile1.ts Matched by include pattern '**/*' in 'a/b/tsconfig.json' a/b/commonFile2.ts @@ -91,7 +91,7 @@ Output:: [12:00:25 AM] File change detected. Starting incremental compilation... a/lib/lib.d.ts - Default library + Default library for target 'es3' a/b/commonFile1.ts Matched by include pattern '**/*' in 'a/b/tsconfig.json' a/b/commonFile2.ts @@ -150,7 +150,7 @@ Output:: [12:00:34 AM] File change detected. Starting incremental compilation... a/lib/lib.d.ts - Default library + Default library for target 'es3' a/b/commonFile1.ts Matched by include pattern '**/*' in 'a/b/tsconfig.json' [12:00:38 AM] Found 0 errors. Watching for file changes. @@ -199,7 +199,7 @@ Output:: [12:00:41 AM] File change detected. Starting incremental compilation... a/lib/lib.d.ts - Default library + Default library for target 'es3' a/b/commonFile1.ts Matched by include pattern '**/*' in 'a/b/tsconfig.json' a/b/commonFile2.ts diff --git a/tests/baselines/reference/tscWatch/programUpdates/should-reflect-change-in-config-file.js b/tests/baselines/reference/tscWatch/programUpdates/should-reflect-change-in-config-file.js index 7e342de7d08d7..93b1540d7761b 100644 --- a/tests/baselines/reference/tscWatch/programUpdates/should-reflect-change-in-config-file.js +++ b/tests/baselines/reference/tscWatch/programUpdates/should-reflect-change-in-config-file.js @@ -31,7 +31,7 @@ Output:: [12:00:17 AM] Starting compilation in watch mode... a/lib/lib.d.ts - Default library + Default library for target 'es3' a/b/commonFile1.ts Part of 'files' list in tsconfig.json a/b/commonFile2.ts @@ -92,7 +92,7 @@ Output:: [12:00:25 AM] File change detected. Starting incremental compilation... a/lib/lib.d.ts - Default library + Default library for target 'es3' a/b/commonFile1.ts Part of 'files' list in tsconfig.json a/b/commonFile2.ts @@ -154,7 +154,7 @@ Output:: [12:00:36 AM] File change detected. Starting incremental compilation... a/lib/lib.d.ts - Default library + Default library for target 'es3' a/b/commonFile1.ts Part of 'files' list in tsconfig.json [12:00:40 AM] Found 0 errors. Watching for file changes. diff --git a/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-after-watcher-is-invoked,-ask-errors-on-it-after-old-one-without-file-being-in-config.js b/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-after-watcher-is-invoked,-ask-errors-on-it-after-old-one-without-file-being-in-config.js index 325bc051f381f..96d0a07984ea5 100644 --- a/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-after-watcher-is-invoked,-ask-errors-on-it-after-old-one-without-file-being-in-config.js +++ b/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-after-watcher-is-invoked,-ask-errors-on-it-after-old-one-without-file-being-in-config.js @@ -32,7 +32,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/bar.ts Matched by include pattern './src' in 'tsconfig.json' src/foo.ts diff --git a/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-after-watcher-is-invoked,-ask-errors-on-it-after-old-one.js b/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-after-watcher-is-invoked,-ask-errors-on-it-after-old-one.js index 337fd59507a6d..dfb62bb307403 100644 --- a/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-after-watcher-is-invoked,-ask-errors-on-it-after-old-one.js +++ b/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-after-watcher-is-invoked,-ask-errors-on-it-after-old-one.js @@ -32,7 +32,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/bar.ts Matched by include pattern './src' in 'tsconfig.json' src/foo.ts @@ -71,7 +71,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/bar.ts Matched by include pattern './src' in 'tsconfig.json' src/foo.ts diff --git a/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-after-watcher-is-invoked,-ask-errors-on-it-before-old-one-without-file-being-in-config.js b/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-after-watcher-is-invoked,-ask-errors-on-it-before-old-one-without-file-being-in-config.js index 7702cbca6d98b..8084ad64c472d 100644 --- a/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-after-watcher-is-invoked,-ask-errors-on-it-before-old-one-without-file-being-in-config.js +++ b/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-after-watcher-is-invoked,-ask-errors-on-it-before-old-one-without-file-being-in-config.js @@ -32,7 +32,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/bar.ts Matched by include pattern './src' in 'tsconfig.json' src/foo.ts diff --git a/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-after-watcher-is-invoked,-ask-errors-on-it-before-old-one.js b/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-after-watcher-is-invoked,-ask-errors-on-it-before-old-one.js index 6bf78ae82a4c5..e5da699f3861a 100644 --- a/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-after-watcher-is-invoked,-ask-errors-on-it-before-old-one.js +++ b/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-after-watcher-is-invoked,-ask-errors-on-it-before-old-one.js @@ -32,7 +32,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/bar.ts Matched by include pattern './src' in 'tsconfig.json' src/foo.ts @@ -71,7 +71,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/bar.ts Matched by include pattern './src' in 'tsconfig.json' src/foo.ts diff --git a/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-before-watcher-is-invoked,-ask-errors-on-it-after-old-one-without-file-being-in-config.js b/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-before-watcher-is-invoked,-ask-errors-on-it-after-old-one-without-file-being-in-config.js index 1c39c0c715d34..4336a83c99f93 100644 --- a/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-before-watcher-is-invoked,-ask-errors-on-it-after-old-one-without-file-being-in-config.js +++ b/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-before-watcher-is-invoked,-ask-errors-on-it-after-old-one-without-file-being-in-config.js @@ -32,7 +32,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/bar.ts Matched by include pattern './src' in 'tsconfig.json' src/foo.ts diff --git a/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-before-watcher-is-invoked,-ask-errors-on-it-after-old-one.js b/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-before-watcher-is-invoked,-ask-errors-on-it-after-old-one.js index c829851b74ff9..6a0eac03a9f58 100644 --- a/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-before-watcher-is-invoked,-ask-errors-on-it-after-old-one.js +++ b/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-before-watcher-is-invoked,-ask-errors-on-it-after-old-one.js @@ -32,7 +32,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/bar.ts Matched by include pattern './src' in 'tsconfig.json' src/foo.ts @@ -120,7 +120,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/bar.ts Matched by include pattern './src' in 'tsconfig.json' src/foo.ts diff --git a/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-before-watcher-is-invoked,-ask-errors-on-it-before-old-one-without-file-being-in-config.js b/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-before-watcher-is-invoked,-ask-errors-on-it-before-old-one-without-file-being-in-config.js index 7f69e67354d27..f96320da3a712 100644 --- a/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-before-watcher-is-invoked,-ask-errors-on-it-before-old-one-without-file-being-in-config.js +++ b/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-before-watcher-is-invoked,-ask-errors-on-it-before-old-one-without-file-being-in-config.js @@ -32,7 +32,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/bar.ts Matched by include pattern './src' in 'tsconfig.json' src/foo.ts diff --git a/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-before-watcher-is-invoked,-ask-errors-on-it-before-old-one.js b/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-before-watcher-is-invoked,-ask-errors-on-it-before-old-one.js index a667534acafff..62214db3c51e3 100644 --- a/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-before-watcher-is-invoked,-ask-errors-on-it-before-old-one.js +++ b/tests/baselines/reference/tsserver/configuredProjects/creating-new-file-and-then-open-it-before-watcher-is-invoked,-ask-errors-on-it-before-old-one.js @@ -32,7 +32,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/bar.ts Matched by include pattern './src' in 'tsconfig.json' src/foo.ts @@ -126,7 +126,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/bar.ts Matched by include pattern './src' in 'tsconfig.json' src/foo.ts diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-changing-module-name-with-different-casing.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-changing-module-name-with-different-casing.js index f01516e4e14e8..4b5747816f6be 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-changing-module-name-with-different-casing.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/when-changing-module-name-with-different-casing.js @@ -33,7 +33,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' Logger.ts Matched by include pattern '**/*' in 'tsconfig.json' Imported via "./Logger" from file 'another.ts' diff --git a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/works-when-renaming-file-with-different-casing.js b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/works-when-renaming-file-with-different-casing.js index ed681eaf86b15..1af314f8ae86a 100644 --- a/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/works-when-renaming-file-with-different-casing.js +++ b/tests/baselines/reference/tsserver/forceConsistentCasingInFileNames/works-when-renaming-file-with-different-casing.js @@ -33,7 +33,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' Logger.ts Matched by include pattern '**/*' in 'tsconfig.json' Imported via "./Logger" from file 'another.ts' diff --git a/tests/baselines/reference/tsserver/projectErrors/configFileDiagnostic-events-are-generated-when-the-config-file-changes.js b/tests/baselines/reference/tsserver/projectErrors/configFileDiagnostic-events-are-generated-when-the-config-file-changes.js index 8c242cf0fecd9..c290bb78497b0 100644 --- a/tests/baselines/reference/tsserver/projectErrors/configFileDiagnostic-events-are-generated-when-the-config-file-changes.js +++ b/tests/baselines/reference/tsserver/projectErrors/configFileDiagnostic-events-are-generated-when-the-config-file-changes.js @@ -29,7 +29,7 @@ Project '/a/b/tsconfig.json' (Configured) ../lib/lib.d.ts - Default library + Default library for target 'es3' app.ts Matched by include pattern '**/*' in 'tsconfig.json' diff --git a/tests/baselines/reference/tsserver/projectErrors/configFileDiagnostic-events-are-generated-when-the-config-file-doesnt-have-errors.js b/tests/baselines/reference/tsserver/projectErrors/configFileDiagnostic-events-are-generated-when-the-config-file-doesnt-have-errors.js index 9688e4a49068f..99c6e880c5c2c 100644 --- a/tests/baselines/reference/tsserver/projectErrors/configFileDiagnostic-events-are-generated-when-the-config-file-doesnt-have-errors.js +++ b/tests/baselines/reference/tsserver/projectErrors/configFileDiagnostic-events-are-generated-when-the-config-file-doesnt-have-errors.js @@ -29,7 +29,7 @@ Project '/a/b/tsconfig.json' (Configured) ../lib/lib.d.ts - Default library + Default library for target 'es3' app.ts Matched by include pattern '**/*' in 'tsconfig.json' diff --git a/tests/baselines/reference/tsserver/projectErrors/configFileDiagnostic-events-are-generated-when-the-config-file-has-errors.js b/tests/baselines/reference/tsserver/projectErrors/configFileDiagnostic-events-are-generated-when-the-config-file-has-errors.js index 032b65c6a58a9..127e18a12073d 100644 --- a/tests/baselines/reference/tsserver/projectErrors/configFileDiagnostic-events-are-generated-when-the-config-file-has-errors.js +++ b/tests/baselines/reference/tsserver/projectErrors/configFileDiagnostic-events-are-generated-when-the-config-file-has-errors.js @@ -29,7 +29,7 @@ Project '/a/b/tsconfig.json' (Configured) ../lib/lib.d.ts - Default library + Default library for target 'es3' app.ts Matched by include pattern '**/*' in 'tsconfig.json' diff --git a/tests/baselines/reference/tsserver/projectErrors/configFileDiagnostic-events-are-not-generated-when-the-config-file-does-not-include-file-opened-and-config-file-has-errors.js b/tests/baselines/reference/tsserver/projectErrors/configFileDiagnostic-events-are-not-generated-when-the-config-file-does-not-include-file-opened-and-config-file-has-errors.js index b0684a5698ddc..f882b6b064d5a 100644 --- a/tests/baselines/reference/tsserver/projectErrors/configFileDiagnostic-events-are-not-generated-when-the-config-file-does-not-include-file-opened-and-config-file-has-errors.js +++ b/tests/baselines/reference/tsserver/projectErrors/configFileDiagnostic-events-are-not-generated-when-the-config-file-does-not-include-file-opened-and-config-file-has-errors.js @@ -28,7 +28,7 @@ Project '/a/b/tsconfig.json' (Configured) ../lib/lib.d.ts - Default library + Default library for target 'es3' app.ts Part of 'files' list in tsconfig.json diff --git a/tests/baselines/reference/tsserver/projectErrors/configFileDiagnostic-events-are-not-generated-when-the-config-file-does-not-include-file-opened-and-doesnt-contain-any-errors.js b/tests/baselines/reference/tsserver/projectErrors/configFileDiagnostic-events-are-not-generated-when-the-config-file-does-not-include-file-opened-and-doesnt-contain-any-errors.js index 25d9ca79a925d..77afe57d1a0a2 100644 --- a/tests/baselines/reference/tsserver/projectErrors/configFileDiagnostic-events-are-not-generated-when-the-config-file-does-not-include-file-opened-and-doesnt-contain-any-errors.js +++ b/tests/baselines/reference/tsserver/projectErrors/configFileDiagnostic-events-are-not-generated-when-the-config-file-does-not-include-file-opened-and-doesnt-contain-any-errors.js @@ -28,7 +28,7 @@ Project '/a/b/tsconfig.json' (Configured) ../lib/lib.d.ts - Default library + Default library for target 'es3' app.ts Part of 'files' list in tsconfig.json diff --git a/tests/baselines/reference/tsserver/projectErrors/configFileDiagnostic-events-are-not-generated-when-the-config-file-has-errors-but-suppressDiagnosticEvents-is-true.js b/tests/baselines/reference/tsserver/projectErrors/configFileDiagnostic-events-are-not-generated-when-the-config-file-has-errors-but-suppressDiagnosticEvents-is-true.js index b729e90e9b23c..41cfb0ff06673 100644 --- a/tests/baselines/reference/tsserver/projectErrors/configFileDiagnostic-events-are-not-generated-when-the-config-file-has-errors-but-suppressDiagnosticEvents-is-true.js +++ b/tests/baselines/reference/tsserver/projectErrors/configFileDiagnostic-events-are-not-generated-when-the-config-file-has-errors-but-suppressDiagnosticEvents-is-true.js @@ -29,7 +29,7 @@ Project '/a/b/tsconfig.json' (Configured) ../lib/lib.d.ts - Default library + Default library for target 'es3' app.ts Matched by include pattern '**/*' in 'tsconfig.json' diff --git a/tests/baselines/reference/tsserver/projectErrors/configFileDiagnostic-events-contains-the-project-reference-errors.js b/tests/baselines/reference/tsserver/projectErrors/configFileDiagnostic-events-contains-the-project-reference-errors.js index 921b483df6b03..64727ed96257e 100644 --- a/tests/baselines/reference/tsserver/projectErrors/configFileDiagnostic-events-contains-the-project-reference-errors.js +++ b/tests/baselines/reference/tsserver/projectErrors/configFileDiagnostic-events-contains-the-project-reference-errors.js @@ -42,7 +42,7 @@ Project '/a/b/tsconfig.json' (Configured) ../lib/lib.d.ts - Default library + Default library for target 'es3' app.ts Part of 'files' list in tsconfig.json diff --git a/tests/baselines/reference/tsserver/projectErrors/correct-errors-when-resolution-resolves-to-file-that-has-same-ambient-module-and-is-also-module.js b/tests/baselines/reference/tsserver/projectErrors/correct-errors-when-resolution-resolves-to-file-that-has-same-ambient-module-and-is-also-module.js index 8cd0bada0c782..ed371ee59a548 100644 --- a/tests/baselines/reference/tsserver/projectErrors/correct-errors-when-resolution-resolves-to-file-that-has-same-ambient-module-and-is-also-module.js +++ b/tests/baselines/reference/tsserver/projectErrors/correct-errors-when-resolution-resolves-to-file-that-has-same-ambient-module-and-is-also-module.js @@ -35,7 +35,7 @@ Project '/users/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' node_modules/@custom/plugin/proposed.d.ts Imported via './proposed' from file 'node_modules/@custom/plugin/index.d.ts' node_modules/@custom/plugin/index.d.ts diff --git a/tests/baselines/reference/tsserver/projectErrors/folder-rename-updates-project-structure-and-reports-no-errors.js b/tests/baselines/reference/tsserver/projectErrors/folder-rename-updates-project-structure-and-reports-no-errors.js index b505843b86c3e..9d4011c2649fc 100644 --- a/tests/baselines/reference/tsserver/projectErrors/folder-rename-updates-project-structure-and-reports-no-errors.js +++ b/tests/baselines/reference/tsserver/projectErrors/folder-rename-updates-project-structure-and-reports-no-errors.js @@ -42,7 +42,7 @@ event: event: {"seq":0,"type":"event","event":"telemetry","body":{"telemetryEventName":"projectInfo","payload":{"projectId":"c56abb8c7c51bef5953613f05226da8e72cd9eafe09ab58ca2ccd81b65ba193a","fileStats":{"js":0,"jsSize":0,"jsx":0,"jsxSize":0,"ts":2,"tsSize":154,"tsx":0,"tsxSize":0,"dts":0,"dtsSize":0,"deferred":0,"deferredSize":0},"compilerOptions":{"module":"none"},"typeAcquisition":{"enable":false,"include":false,"exclude":false},"extends":false,"files":false,"include":false,"exclude":true,"compileOnSave":false,"configFileName":"tsconfig.json","projectType":"configured","languageServiceEnabled":true,"version":"FakeVersion"}}} event: - {"seq":0,"type":"event","event":"configFileDiag","body":{"triggerFile":"/a/b/projects/myproject/bar/app.ts","configFile":"/a/b/projects/myproject/tsconfig.json","diagnostics":[{"text":"File '/a/lib/lib.d.ts' not found.\n The file is in the program because:\n Default library","code":6053,"category":"error"},{"text":"Cannot find global type 'Array'.","code":2318,"category":"error"},{"text":"Cannot find global type 'Boolean'.","code":2318,"category":"error"},{"text":"Cannot find global type 'Function'.","code":2318,"category":"error"},{"text":"Cannot find global type 'IArguments'.","code":2318,"category":"error"},{"text":"Cannot find global type 'Number'.","code":2318,"category":"error"},{"text":"Cannot find global type 'Object'.","code":2318,"category":"error"},{"text":"Cannot find global type 'RegExp'.","code":2318,"category":"error"},{"text":"Cannot find global type 'String'.","code":2318,"category":"error"},{"start":{"line":1,"offset":37},"end":{"line":1,"offset":45},"text":"Unknown compiler option 'targer'. Did you mean 'target'?","code":5025,"category":"error","fileName":"/a/b/projects/myproject/tsconfig.json"}]}} + {"seq":0,"type":"event","event":"configFileDiag","body":{"triggerFile":"/a/b/projects/myproject/bar/app.ts","configFile":"/a/b/projects/myproject/tsconfig.json","diagnostics":[{"text":"File '/a/lib/lib.d.ts' not found.\n The file is in the program because:\n Default library for target 'es3'","code":6053,"category":"error"},{"text":"Cannot find global type 'Array'.","code":2318,"category":"error"},{"text":"Cannot find global type 'Boolean'.","code":2318,"category":"error"},{"text":"Cannot find global type 'Function'.","code":2318,"category":"error"},{"text":"Cannot find global type 'IArguments'.","code":2318,"category":"error"},{"text":"Cannot find global type 'Number'.","code":2318,"category":"error"},{"text":"Cannot find global type 'Object'.","code":2318,"category":"error"},{"text":"Cannot find global type 'RegExp'.","code":2318,"category":"error"},{"text":"Cannot find global type 'String'.","code":2318,"category":"error"},{"start":{"line":1,"offset":37},"end":{"line":1,"offset":45},"text":"Unknown compiler option 'targer'. Did you mean 'target'?","code":5025,"category":"error","fileName":"/a/b/projects/myproject/tsconfig.json"}]}} Project '/a/b/projects/myproject/tsconfig.json' (Configured) Files (2) diff --git a/tests/baselines/reference/tsserver/projectErrors/npm-install-when-timeout-occurs-after-installation.js b/tests/baselines/reference/tsserver/projectErrors/npm-install-when-timeout-occurs-after-installation.js index 61a0843e82382..cd9a7a1343134 100644 --- a/tests/baselines/reference/tsserver/projectErrors/npm-install-when-timeout-occurs-after-installation.js +++ b/tests/baselines/reference/tsserver/projectErrors/npm-install-when-timeout-occurs-after-installation.js @@ -33,7 +33,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/main.ts Matched by include pattern '**/*' in 'tsconfig.json' @@ -233,7 +233,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' node_modules/@angular/core/index.d.ts Imported via '@angular/core' from file 'src/main.ts' src/main.ts diff --git a/tests/baselines/reference/tsserver/projectErrors/npm-install-when-timeout-occurs-inbetween-installation.js b/tests/baselines/reference/tsserver/projectErrors/npm-install-when-timeout-occurs-inbetween-installation.js index 8c22a7cd8e362..1346caf1e8b87 100644 --- a/tests/baselines/reference/tsserver/projectErrors/npm-install-when-timeout-occurs-inbetween-installation.js +++ b/tests/baselines/reference/tsserver/projectErrors/npm-install-when-timeout-occurs-inbetween-installation.js @@ -33,7 +33,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/main.ts Matched by include pattern '**/*' in 'tsconfig.json' @@ -256,7 +256,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' node_modules/@angular/core/index.d.ts Imported via '@angular/core' from file 'src/main.ts' src/main.ts diff --git a/tests/baselines/reference/tsserver/projectErrors/should-not-report-incorrect-error-when-json-is-root-file-found-by-tsconfig.js b/tests/baselines/reference/tsserver/projectErrors/should-not-report-incorrect-error-when-json-is-root-file-found-by-tsconfig.js index 789290aa830d7..0d1830af78290 100644 --- a/tests/baselines/reference/tsserver/projectErrors/should-not-report-incorrect-error-when-json-is-root-file-found-by-tsconfig.js +++ b/tests/baselines/reference/tsserver/projectErrors/should-not-report-incorrect-error-when-json-is-root-file-found-by-tsconfig.js @@ -36,7 +36,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/blabla.json Imported via "./blabla.json" from file 'src/test.ts' Matched by include pattern './src/*.json' in 'tsconfig.json' diff --git a/tests/baselines/reference/tsserver/projectErrors/should-report-error-when-json-is-not-root-file-found-by-tsconfig.js b/tests/baselines/reference/tsserver/projectErrors/should-report-error-when-json-is-not-root-file-found-by-tsconfig.js index 6d6136fac9911..3d897aa23e320 100644 --- a/tests/baselines/reference/tsserver/projectErrors/should-report-error-when-json-is-not-root-file-found-by-tsconfig.js +++ b/tests/baselines/reference/tsserver/projectErrors/should-report-error-when-json-is-not-root-file-found-by-tsconfig.js @@ -35,7 +35,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/blabla.json Imported via "./blabla.json" from file 'src/test.ts' src/test.ts diff --git a/tests/baselines/reference/tsserver/projectErrors/when-semantic-error-returns-includes-global-error-gerErr-with-sync-commands.js b/tests/baselines/reference/tsserver/projectErrors/when-semantic-error-returns-includes-global-error-gerErr-with-sync-commands.js index 7eae40f0de5cc..ac2b48eaed2a7 100644 --- a/tests/baselines/reference/tsserver/projectErrors/when-semantic-error-returns-includes-global-error-gerErr-with-sync-commands.js +++ b/tests/baselines/reference/tsserver/projectErrors/when-semantic-error-returns-includes-global-error-gerErr-with-sync-commands.js @@ -27,7 +27,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ui.ts Matched by include pattern '**/*' in 'tsconfig.json' diff --git a/tests/baselines/reference/tsserver/projectErrors/when-semantic-error-returns-includes-global-error-getErr.js b/tests/baselines/reference/tsserver/projectErrors/when-semantic-error-returns-includes-global-error-getErr.js index 78983bd3745bc..e7f57c4b839e2 100644 --- a/tests/baselines/reference/tsserver/projectErrors/when-semantic-error-returns-includes-global-error-getErr.js +++ b/tests/baselines/reference/tsserver/projectErrors/when-semantic-error-returns-includes-global-error-getErr.js @@ -29,7 +29,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ui.ts Matched by include pattern '**/*' in 'tsconfig.json' diff --git a/tests/baselines/reference/tsserver/projectErrors/when-semantic-error-returns-includes-global-error-geterrForProject.js b/tests/baselines/reference/tsserver/projectErrors/when-semantic-error-returns-includes-global-error-geterrForProject.js index 364821360fa61..ca2aec830655e 100644 --- a/tests/baselines/reference/tsserver/projectErrors/when-semantic-error-returns-includes-global-error-geterrForProject.js +++ b/tests/baselines/reference/tsserver/projectErrors/when-semantic-error-returns-includes-global-error-geterrForProject.js @@ -29,7 +29,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ui.ts Matched by include pattern '**/*' in 'tsconfig.json' diff --git a/tests/baselines/reference/tsserver/projectLanguageServiceStateEvent/large-file-size-is-determined-correctly.js b/tests/baselines/reference/tsserver/projectLanguageServiceStateEvent/large-file-size-is-determined-correctly.js index 8d1455b514238..98221e5c651b8 100644 --- a/tests/baselines/reference/tsserver/projectLanguageServiceStateEvent/large-file-size-is-determined-correctly.js +++ b/tests/baselines/reference/tsserver/projectLanguageServiceStateEvent/large-file-size-is-determined-correctly.js @@ -33,7 +33,7 @@ Project '/a/jsconfig.json' (Configured) lib/lib.d.ts - Default library + Default library for target 'es3' app.js Matched by include pattern '**/*' in 'jsconfig.json' diff --git a/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-dependency-project-is-not-open-gerErr-with-sync-commands.js b/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-dependency-project-is-not-open-gerErr-with-sync-commands.js index 45c47d45b079e..c4626262b1f57 100644 --- a/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-dependency-project-is-not-open-gerErr-with-sync-commands.js +++ b/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-dependency-project-is-not-open-gerErr-with-sync-commands.js @@ -53,7 +53,7 @@ Project '/user/username/projects/myproject/usage/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../dependency/fns.ts Imported via '../decls/fns' from file 'usage.ts' usage.ts diff --git a/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-dependency-project-is-not-open-getErr.js b/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-dependency-project-is-not-open-getErr.js index 561c60b7d7d08..5ec2fe654cf39 100644 --- a/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-dependency-project-is-not-open-getErr.js +++ b/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-dependency-project-is-not-open-getErr.js @@ -55,7 +55,7 @@ Project '/user/username/projects/myproject/usage/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../dependency/fns.ts Imported via '../decls/fns' from file 'usage.ts' usage.ts diff --git a/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-dependency-project-is-not-open-geterrForProject.js b/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-dependency-project-is-not-open-geterrForProject.js index ec714b9f6dfef..9aac5c5526945 100644 --- a/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-dependency-project-is-not-open-geterrForProject.js +++ b/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-dependency-project-is-not-open-geterrForProject.js @@ -55,7 +55,7 @@ Project '/user/username/projects/myproject/usage/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../dependency/fns.ts Imported via '../decls/fns' from file 'usage.ts' usage.ts diff --git a/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-the-depedency-file-is-open-gerErr-with-sync-commands.js b/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-the-depedency-file-is-open-gerErr-with-sync-commands.js index da8fb9a79ca01..615d011501120 100644 --- a/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-the-depedency-file-is-open-gerErr-with-sync-commands.js +++ b/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-the-depedency-file-is-open-gerErr-with-sync-commands.js @@ -53,7 +53,7 @@ Project '/user/username/projects/myproject/usage/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../dependency/fns.ts Imported via '../decls/fns' from file 'usage.ts' usage.ts @@ -89,7 +89,7 @@ Project '/user/username/projects/myproject/dependency/tsconfig.json' (Configured ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' fns.ts Matched by include pattern '**/*' in 'tsconfig.json' diff --git a/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-the-depedency-file-is-open-getErr.js b/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-the-depedency-file-is-open-getErr.js index a650ce4c29fe1..1c9a4d1781926 100644 --- a/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-the-depedency-file-is-open-getErr.js +++ b/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-the-depedency-file-is-open-getErr.js @@ -55,7 +55,7 @@ Project '/user/username/projects/myproject/usage/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../dependency/fns.ts Imported via '../decls/fns' from file 'usage.ts' usage.ts @@ -99,7 +99,7 @@ Project '/user/username/projects/myproject/dependency/tsconfig.json' (Configured ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' fns.ts Matched by include pattern '**/*' in 'tsconfig.json' diff --git a/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-the-depedency-file-is-open-geterrForProject.js b/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-the-depedency-file-is-open-geterrForProject.js index 684abf3f76755..18e76ddb5e077 100644 --- a/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-the-depedency-file-is-open-geterrForProject.js +++ b/tests/baselines/reference/tsserver/projectReferenceErrors/with-module-scenario-when-the-depedency-file-is-open-geterrForProject.js @@ -55,7 +55,7 @@ Project '/user/username/projects/myproject/usage/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../dependency/fns.ts Imported via '../decls/fns' from file 'usage.ts' usage.ts @@ -99,7 +99,7 @@ Project '/user/username/projects/myproject/dependency/tsconfig.json' (Configured ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' fns.ts Matched by include pattern '**/*' in 'tsconfig.json' diff --git a/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-dependency-project-is-not-open-gerErr-with-sync-commands.js b/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-dependency-project-is-not-open-gerErr-with-sync-commands.js index a0f7645600aa5..d54d8a8ed4c58 100644 --- a/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-dependency-project-is-not-open-gerErr-with-sync-commands.js +++ b/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-dependency-project-is-not-open-gerErr-with-sync-commands.js @@ -52,7 +52,7 @@ Project '/user/username/projects/myproject/usage/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../dependency/fns.ts Source from referenced project '../dependency/tsconfig.json' included because '--outFile' specified usage.ts diff --git a/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-dependency-project-is-not-open-getErr.js b/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-dependency-project-is-not-open-getErr.js index 8df29aefc933e..cd4980e3517a8 100644 --- a/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-dependency-project-is-not-open-getErr.js +++ b/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-dependency-project-is-not-open-getErr.js @@ -54,7 +54,7 @@ Project '/user/username/projects/myproject/usage/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../dependency/fns.ts Source from referenced project '../dependency/tsconfig.json' included because '--outFile' specified usage.ts diff --git a/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-dependency-project-is-not-open-geterrForProject.js b/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-dependency-project-is-not-open-geterrForProject.js index 5324f46408194..0441470c96582 100644 --- a/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-dependency-project-is-not-open-geterrForProject.js +++ b/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-dependency-project-is-not-open-geterrForProject.js @@ -54,7 +54,7 @@ Project '/user/username/projects/myproject/usage/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../dependency/fns.ts Source from referenced project '../dependency/tsconfig.json' included because '--outFile' specified usage.ts diff --git a/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-the-depedency-file-is-open-gerErr-with-sync-commands.js b/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-the-depedency-file-is-open-gerErr-with-sync-commands.js index 46987608856db..07b7d01685ea4 100644 --- a/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-the-depedency-file-is-open-gerErr-with-sync-commands.js +++ b/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-the-depedency-file-is-open-gerErr-with-sync-commands.js @@ -52,7 +52,7 @@ Project '/user/username/projects/myproject/usage/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../dependency/fns.ts Source from referenced project '../dependency/tsconfig.json' included because '--outFile' specified usage.ts @@ -88,7 +88,7 @@ Project '/user/username/projects/myproject/dependency/tsconfig.json' (Configured ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' fns.ts Matched by include pattern '**/*' in 'tsconfig.json' diff --git a/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-the-depedency-file-is-open-getErr.js b/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-the-depedency-file-is-open-getErr.js index 38a5700630c27..bfd0a68ad057d 100644 --- a/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-the-depedency-file-is-open-getErr.js +++ b/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-the-depedency-file-is-open-getErr.js @@ -54,7 +54,7 @@ Project '/user/username/projects/myproject/usage/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../dependency/fns.ts Source from referenced project '../dependency/tsconfig.json' included because '--outFile' specified usage.ts @@ -98,7 +98,7 @@ Project '/user/username/projects/myproject/dependency/tsconfig.json' (Configured ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' fns.ts Matched by include pattern '**/*' in 'tsconfig.json' diff --git a/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-the-depedency-file-is-open-geterrForProject.js b/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-the-depedency-file-is-open-geterrForProject.js index 24c278e2f9905..d9f23968cc7c8 100644 --- a/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-the-depedency-file-is-open-geterrForProject.js +++ b/tests/baselines/reference/tsserver/projectReferenceErrors/with-non-module-when-the-depedency-file-is-open-geterrForProject.js @@ -54,7 +54,7 @@ Project '/user/username/projects/myproject/usage/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../dependency/fns.ts Source from referenced project '../dependency/tsconfig.json' included because '--outFile' specified usage.ts @@ -98,7 +98,7 @@ Project '/user/username/projects/myproject/dependency/tsconfig.json' (Configured ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' fns.ts Matched by include pattern '**/*' in 'tsconfig.json' diff --git a/tests/baselines/reference/tsserver/projectReferences/ancestor-and-project-ref-management.js b/tests/baselines/reference/tsserver/projectReferences/ancestor-and-project-ref-management.js index c3b9c6f8d0df5..79bc5aad59d86 100644 --- a/tests/baselines/reference/tsserver/projectReferences/ancestor-and-project-ref-management.js +++ b/tests/baselines/reference/tsserver/projectReferences/ancestor-and-project-ref-management.js @@ -51,7 +51,7 @@ Project '/user/username/projects/container/compositeExec/tsconfig.json' (Configu ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../lib/index.ts Source from referenced project '../lib/tsconfig.json' included because '--outFile' specified index.ts @@ -134,7 +134,7 @@ Project '/user/username/projects/container/lib/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' index.ts Part of 'files' list in tsconfig.json @@ -196,7 +196,7 @@ Project '/user/username/projects/container/exec/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../lib/index.ts Source from referenced project '../lib/tsconfig.json' included because '--outFile' specified index.ts @@ -353,7 +353,7 @@ Project '/user/username/projects/container/compositeExec/tsconfig.json' (Configu ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../lib/index.ts Source from referenced project '../lib/tsconfig.json' included because '--outFile' specified index.ts @@ -383,7 +383,7 @@ Project '/user/username/projects/container/lib/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' index.ts Part of 'files' list in tsconfig.json @@ -401,7 +401,7 @@ Project '/user/username/projects/container/exec/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../lib/index.ts Source from referenced project '../lib/tsconfig.json' included because '--outFile' specified index.ts diff --git a/tests/baselines/reference/tsserver/projectReferences/auto-import-with-referenced-project-when-built-with-disableSourceOfProjectReferenceRedirect.js b/tests/baselines/reference/tsserver/projectReferences/auto-import-with-referenced-project-when-built-with-disableSourceOfProjectReferenceRedirect.js index e7dda323106b0..e6199451d9dcf 100644 --- a/tests/baselines/reference/tsserver/projectReferences/auto-import-with-referenced-project-when-built-with-disableSourceOfProjectReferenceRedirect.js +++ b/tests/baselines/reference/tsserver/projectReferences/auto-import-with-referenced-project-when-built-with-disableSourceOfProjectReferenceRedirect.js @@ -68,7 +68,7 @@ Project '/user/username/projects/myproject/app/src/program/tsconfig.json' (Confi ../../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../../../shared/bld/library/index.d.ts Imported via "shared" from file 'bar.ts' with packageId 'shared/bld/library/index.d.ts@1.0.0' bar.ts diff --git a/tests/baselines/reference/tsserver/projectReferences/auto-import-with-referenced-project-when-built.js b/tests/baselines/reference/tsserver/projectReferences/auto-import-with-referenced-project-when-built.js index c76675540b864..74bfa4b020392 100644 --- a/tests/baselines/reference/tsserver/projectReferences/auto-import-with-referenced-project-when-built.js +++ b/tests/baselines/reference/tsserver/projectReferences/auto-import-with-referenced-project-when-built.js @@ -67,7 +67,7 @@ Project '/user/username/projects/myproject/app/src/program/tsconfig.json' (Confi ../../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../../../shared/src/library/index.ts Imported via "shared" from file 'bar.ts' with packageId 'shared/bld/library/index.d.ts@1.0.0' bar.ts diff --git a/tests/baselines/reference/tsserver/projectReferences/auto-import-with-referenced-project.js b/tests/baselines/reference/tsserver/projectReferences/auto-import-with-referenced-project.js index c76675540b864..74bfa4b020392 100644 --- a/tests/baselines/reference/tsserver/projectReferences/auto-import-with-referenced-project.js +++ b/tests/baselines/reference/tsserver/projectReferences/auto-import-with-referenced-project.js @@ -67,7 +67,7 @@ Project '/user/username/projects/myproject/app/src/program/tsconfig.json' (Confi ../../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../../../shared/src/library/index.ts Imported via "shared" from file 'bar.ts' with packageId 'shared/bld/library/index.d.ts@1.0.0' bar.ts diff --git a/tests/baselines/reference/tsserver/projectReferences/can-successfully-find-references-with-out-option.js b/tests/baselines/reference/tsserver/projectReferences/can-successfully-find-references-with-out-option.js index 901557f3c9ef1..1b0c0d2f7c153 100644 --- a/tests/baselines/reference/tsserver/projectReferences/can-successfully-find-references-with-out-option.js +++ b/tests/baselines/reference/tsserver/projectReferences/can-successfully-find-references-with-out-option.js @@ -51,7 +51,7 @@ Project '/user/username/projects/container/compositeExec/tsconfig.json' (Configu ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../lib/index.ts Source from referenced project '../lib/tsconfig.json' included because '--outFile' specified index.ts @@ -94,7 +94,7 @@ Project '/user/username/projects/container/lib/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' index.ts Part of 'files' list in tsconfig.json @@ -156,7 +156,7 @@ Project '/user/username/projects/container/exec/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../lib/index.ts Source from referenced project '../lib/tsconfig.json' included because '--outFile' specified index.ts diff --git a/tests/baselines/reference/tsserver/projectReferences/disables-looking-into-the-child-project-if-disableReferencedProjectLoad-is-set-in-first-indirect-project-but-not-in-another-one.js b/tests/baselines/reference/tsserver/projectReferences/disables-looking-into-the-child-project-if-disableReferencedProjectLoad-is-set-in-first-indirect-project-but-not-in-another-one.js index 82ed7b753a83d..9a63c26b17209 100644 --- a/tests/baselines/reference/tsserver/projectReferences/disables-looking-into-the-child-project-if-disableReferencedProjectLoad-is-set-in-first-indirect-project-but-not-in-another-one.js +++ b/tests/baselines/reference/tsserver/projectReferences/disables-looking-into-the-child-project-if-disableReferencedProjectLoad-is-set-in-first-indirect-project-but-not-in-another-one.js @@ -101,7 +101,7 @@ Project '/user/username/projects/myproject/tsconfig-src.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' Matched by include pattern './src/**/*' in 'tsconfig-src.json' @@ -234,7 +234,7 @@ Project '/user/username/projects/myproject/tsconfig-src.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' Matched by include pattern './src/**/*' in 'tsconfig-src.json' @@ -355,7 +355,7 @@ Project '/user/username/projects/myproject/tsconfig-src.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' Matched by include pattern './src/**/*' in 'tsconfig-src.json' diff --git a/tests/baselines/reference/tsserver/projectReferences/disables-looking-into-the-child-project-if-disableReferencedProjectLoad-is-set-in-indirect-project.js b/tests/baselines/reference/tsserver/projectReferences/disables-looking-into-the-child-project-if-disableReferencedProjectLoad-is-set-in-indirect-project.js index 45020c168612c..7e48c98547aa0 100644 --- a/tests/baselines/reference/tsserver/projectReferences/disables-looking-into-the-child-project-if-disableReferencedProjectLoad-is-set-in-indirect-project.js +++ b/tests/baselines/reference/tsserver/projectReferences/disables-looking-into-the-child-project-if-disableReferencedProjectLoad-is-set-in-indirect-project.js @@ -81,7 +81,7 @@ Project '/user/username/projects/myproject/tsconfig-indirect1.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' src/main.ts @@ -214,7 +214,7 @@ Project '/user/username/projects/myproject/tsconfig-indirect1.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' src/main.ts @@ -318,7 +318,7 @@ Project '/user/username/projects/myproject/tsconfig-indirect1.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' src/main.ts diff --git a/tests/baselines/reference/tsserver/projectReferences/does-not-error-on-container-only-project.js b/tests/baselines/reference/tsserver/projectReferences/does-not-error-on-container-only-project.js index d9c6845a1a686..43b8000ef66b6 100644 --- a/tests/baselines/reference/tsserver/projectReferences/does-not-error-on-container-only-project.js +++ b/tests/baselines/reference/tsserver/projectReferences/does-not-error-on-container-only-project.js @@ -49,7 +49,7 @@ Project '/user/username/projects/container/compositeExec/tsconfig.json' (Configu ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../lib/index.ts Source from referenced project '../lib/tsconfig.json' included because '--outFile' specified index.ts @@ -90,7 +90,7 @@ Project '/user/username/projects/container/exec/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../lib/index.ts Source from referenced project '../lib/tsconfig.json' included because '--outFile' specified index.ts @@ -112,7 +112,7 @@ Project '/user/username/projects/container/lib/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' index.ts Part of 'files' list in tsconfig.json diff --git a/tests/baselines/reference/tsserver/projectReferences/finding-local-reference-doesnt-load-ancestor/sibling-projects.js b/tests/baselines/reference/tsserver/projectReferences/finding-local-reference-doesnt-load-ancestor/sibling-projects.js index b3b922c4b2c3b..e0b4059ce9765 100644 --- a/tests/baselines/reference/tsserver/projectReferences/finding-local-reference-doesnt-load-ancestor/sibling-projects.js +++ b/tests/baselines/reference/tsserver/projectReferences/finding-local-reference-doesnt-load-ancestor/sibling-projects.js @@ -32,7 +32,7 @@ Project '/user/username/projects/solution/compiler/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' types.ts Part of 'files' list in tsconfig.json program.ts @@ -117,7 +117,7 @@ Project '/user/username/projects/solution/services/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../compiler/types.ts Source from referenced project '../compiler/tsconfig.json' included because '--module' is specified as 'none' ../compiler/program.ts diff --git a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-and-solution-is-built-with-preserveSymlinks.js b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-and-solution-is-built-with-preserveSymlinks.js index f969c5b84e566..a9013a77c9bf3 100644 --- a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-and-solution-is-built-with-preserveSymlinks.js +++ b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-and-solution-is-built-with-preserveSymlinks.js @@ -71,7 +71,7 @@ Project '/user/username/projects/myproject/packages/A/tsconfig.json' (Configured ../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../B/src/index.ts Imported via 'b' from file 'src/index.ts' ../B/src/bar.ts diff --git a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-and-solution-is-built.js b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-and-solution-is-built.js index e60b86b81078d..04e4eb883df31 100644 --- a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-and-solution-is-built.js +++ b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-and-solution-is-built.js @@ -69,7 +69,7 @@ Project '/user/username/projects/myproject/packages/A/tsconfig.json' (Configured ../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../B/src/index.ts Imported via 'b' from file 'src/index.ts' ../B/src/bar.ts diff --git a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-and-solution-is-not-built-with-preserveSymlinks.js b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-and-solution-is-not-built-with-preserveSymlinks.js index f969c5b84e566..a9013a77c9bf3 100644 --- a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-and-solution-is-not-built-with-preserveSymlinks.js +++ b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-and-solution-is-not-built-with-preserveSymlinks.js @@ -71,7 +71,7 @@ Project '/user/username/projects/myproject/packages/A/tsconfig.json' (Configured ../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../B/src/index.ts Imported via 'b' from file 'src/index.ts' ../B/src/bar.ts diff --git a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-and-solution-is-not-built.js b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-and-solution-is-not-built.js index e60b86b81078d..04e4eb883df31 100644 --- a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-and-solution-is-not-built.js +++ b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-and-solution-is-not-built.js @@ -69,7 +69,7 @@ Project '/user/username/projects/myproject/packages/A/tsconfig.json' (Configured ../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../B/src/index.ts Imported via 'b' from file 'src/index.ts' ../B/src/bar.ts diff --git a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-with-scoped-package-and-solution-is-built-with-preserveSymlinks.js b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-with-scoped-package-and-solution-is-built-with-preserveSymlinks.js index 8b26d25ed154a..2f1e96760ad2a 100644 --- a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-with-scoped-package-and-solution-is-built-with-preserveSymlinks.js +++ b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-with-scoped-package-and-solution-is-built-with-preserveSymlinks.js @@ -71,7 +71,7 @@ Project '/user/username/projects/myproject/packages/A/tsconfig.json' (Configured ../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../B/src/index.ts Imported via '@issue/b' from file 'src/index.ts' ../B/src/bar.ts diff --git a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-with-scoped-package-and-solution-is-built.js b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-with-scoped-package-and-solution-is-built.js index 66046c4b53eb7..ef0145096da1f 100644 --- a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-with-scoped-package-and-solution-is-built.js +++ b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-with-scoped-package-and-solution-is-built.js @@ -69,7 +69,7 @@ Project '/user/username/projects/myproject/packages/A/tsconfig.json' (Configured ../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../B/src/index.ts Imported via '@issue/b' from file 'src/index.ts' ../B/src/bar.ts diff --git a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-with-scoped-package-and-solution-is-not-built-with-preserveSymlinks.js b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-with-scoped-package-and-solution-is-not-built-with-preserveSymlinks.js index 8b26d25ed154a..2f1e96760ad2a 100644 --- a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-with-scoped-package-and-solution-is-not-built-with-preserveSymlinks.js +++ b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-with-scoped-package-and-solution-is-not-built-with-preserveSymlinks.js @@ -71,7 +71,7 @@ Project '/user/username/projects/myproject/packages/A/tsconfig.json' (Configured ../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../B/src/index.ts Imported via '@issue/b' from file 'src/index.ts' ../B/src/bar.ts diff --git a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-with-scoped-package-and-solution-is-not-built.js b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-with-scoped-package-and-solution-is-not-built.js index 66046c4b53eb7..ef0145096da1f 100644 --- a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-with-scoped-package-and-solution-is-not-built.js +++ b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-packageJson-has-types-field-and-has-index.ts-with-scoped-package-and-solution-is-not-built.js @@ -69,7 +69,7 @@ Project '/user/username/projects/myproject/packages/A/tsconfig.json' (Configured ../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../B/src/index.ts Imported via '@issue/b' from file 'src/index.ts' ../B/src/bar.ts diff --git a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-and-solution-is-built-with-preserveSymlinks.js b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-and-solution-is-built-with-preserveSymlinks.js index 7726579e91a68..9a61dfad25320 100644 --- a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-and-solution-is-built-with-preserveSymlinks.js +++ b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-and-solution-is-built-with-preserveSymlinks.js @@ -71,7 +71,7 @@ Project '/user/username/projects/myproject/packages/A/tsconfig.json' (Configured ../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../B/src/foo.ts Imported via 'b/lib/foo' from file 'src/test.ts' ../B/src/bar/foo.ts diff --git a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-and-solution-is-built.js b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-and-solution-is-built.js index f22cf5c905156..f6845aa802776 100644 --- a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-and-solution-is-built.js +++ b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-and-solution-is-built.js @@ -69,7 +69,7 @@ Project '/user/username/projects/myproject/packages/A/tsconfig.json' (Configured ../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../B/src/foo.ts Imported via 'b/lib/foo' from file 'src/test.ts' ../B/src/bar/foo.ts diff --git a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-and-solution-is-not-built-with-preserveSymlinks.js b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-and-solution-is-not-built-with-preserveSymlinks.js index 7726579e91a68..9a61dfad25320 100644 --- a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-and-solution-is-not-built-with-preserveSymlinks.js +++ b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-and-solution-is-not-built-with-preserveSymlinks.js @@ -71,7 +71,7 @@ Project '/user/username/projects/myproject/packages/A/tsconfig.json' (Configured ../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../B/src/foo.ts Imported via 'b/lib/foo' from file 'src/test.ts' ../B/src/bar/foo.ts diff --git a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-and-solution-is-not-built.js b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-and-solution-is-not-built.js index f22cf5c905156..f6845aa802776 100644 --- a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-and-solution-is-not-built.js +++ b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-and-solution-is-not-built.js @@ -69,7 +69,7 @@ Project '/user/username/projects/myproject/packages/A/tsconfig.json' (Configured ../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../B/src/foo.ts Imported via 'b/lib/foo' from file 'src/test.ts' ../B/src/bar/foo.ts diff --git a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-with-scoped-package-and-solution-is-built-with-preserveSymlinks.js b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-with-scoped-package-and-solution-is-built-with-preserveSymlinks.js index 85a0c966f68a0..a77a219fa9442 100644 --- a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-with-scoped-package-and-solution-is-built-with-preserveSymlinks.js +++ b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-with-scoped-package-and-solution-is-built-with-preserveSymlinks.js @@ -71,7 +71,7 @@ Project '/user/username/projects/myproject/packages/A/tsconfig.json' (Configured ../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../B/src/foo.ts Imported via '@issue/b/lib/foo' from file 'src/test.ts' ../B/src/bar/foo.ts diff --git a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-with-scoped-package-and-solution-is-built.js b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-with-scoped-package-and-solution-is-built.js index 1ff4238c7230d..8cd1d9f315d28 100644 --- a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-with-scoped-package-and-solution-is-built.js +++ b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-with-scoped-package-and-solution-is-built.js @@ -69,7 +69,7 @@ Project '/user/username/projects/myproject/packages/A/tsconfig.json' (Configured ../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../B/src/foo.ts Imported via '@issue/b/lib/foo' from file 'src/test.ts' ../B/src/bar/foo.ts diff --git a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-with-scoped-package-and-solution-is-not-built-with-preserveSymlinks.js b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-with-scoped-package-and-solution-is-not-built-with-preserveSymlinks.js index 85a0c966f68a0..a77a219fa9442 100644 --- a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-with-scoped-package-and-solution-is-not-built-with-preserveSymlinks.js +++ b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-with-scoped-package-and-solution-is-not-built-with-preserveSymlinks.js @@ -71,7 +71,7 @@ Project '/user/username/projects/myproject/packages/A/tsconfig.json' (Configured ../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../B/src/foo.ts Imported via '@issue/b/lib/foo' from file 'src/test.ts' ../B/src/bar/foo.ts diff --git a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-with-scoped-package-and-solution-is-not-built.js b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-with-scoped-package-and-solution-is-not-built.js index 1ff4238c7230d..8cd1d9f315d28 100644 --- a/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-with-scoped-package-and-solution-is-not-built.js +++ b/tests/baselines/reference/tsserver/projectReferences/monorepo-like-with-symlinks-when-referencing-file-from-subFolder-with-scoped-package-and-solution-is-not-built.js @@ -69,7 +69,7 @@ Project '/user/username/projects/myproject/packages/A/tsconfig.json' (Configured ../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../B/src/foo.ts Imported via '@issue/b/lib/foo' from file 'src/test.ts' ../B/src/bar/foo.ts diff --git a/tests/baselines/reference/tsserver/projectReferences/new-file-is-added-to-the-referenced-project-when-referenced-project-is-not-open-with-disableSourceOfProjectReferenceRedirect.js b/tests/baselines/reference/tsserver/projectReferences/new-file-is-added-to-the-referenced-project-when-referenced-project-is-not-open-with-disableSourceOfProjectReferenceRedirect.js index 6067b76e4445c..33ff2899bb102 100644 --- a/tests/baselines/reference/tsserver/projectReferences/new-file-is-added-to-the-referenced-project-when-referenced-project-is-not-open-with-disableSourceOfProjectReferenceRedirect.js +++ b/tests/baselines/reference/tsserver/projectReferences/new-file-is-added-to-the-referenced-project-when-referenced-project-is-not-open-with-disableSourceOfProjectReferenceRedirect.js @@ -55,7 +55,7 @@ Project '/user/username/projects/myproject/projects/project2/tsconfig.json' (Con ../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../project1/class1.d.ts Output from referenced project '../project1/tsconfig.json' included because '--module' is specified as 'none' class2.ts @@ -119,7 +119,7 @@ Project '/user/username/projects/myproject/projects/project2/tsconfig.json' (Con ../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../project1/class1.d.ts Output from referenced project '../project1/tsconfig.json' included because '--module' is specified as 'none' ../project1/class3.d.ts @@ -171,7 +171,7 @@ Project '/user/username/projects/myproject/projects/project2/tsconfig.json' (Con ../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../project1/class1.d.ts Output from referenced project '../project1/tsconfig.json' included because '--module' is specified as 'none' class2.ts @@ -216,7 +216,7 @@ Project '/user/username/projects/myproject/projects/project2/tsconfig.json' (Con ../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../project1/class1.d.ts Output from referenced project '../project1/tsconfig.json' included because '--module' is specified as 'none' ../project1/class3.d.ts diff --git a/tests/baselines/reference/tsserver/projectReferences/new-file-is-added-to-the-referenced-project-when-referenced-project-is-not-open.js b/tests/baselines/reference/tsserver/projectReferences/new-file-is-added-to-the-referenced-project-when-referenced-project-is-not-open.js index b49dd3463821d..b7dd8d659e8cd 100644 --- a/tests/baselines/reference/tsserver/projectReferences/new-file-is-added-to-the-referenced-project-when-referenced-project-is-not-open.js +++ b/tests/baselines/reference/tsserver/projectReferences/new-file-is-added-to-the-referenced-project-when-referenced-project-is-not-open.js @@ -54,7 +54,7 @@ Project '/user/username/projects/myproject/projects/project2/tsconfig.json' (Con ../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../project1/class1.ts Source from referenced project '../project1/tsconfig.json' included because '--module' is specified as 'none' class2.ts @@ -88,7 +88,7 @@ Project '/user/username/projects/myproject/projects/project2/tsconfig.json' (Con ../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../project1/class1.ts Source from referenced project '../project1/tsconfig.json' included because '--module' is specified as 'none' ../project1/class3.ts diff --git a/tests/baselines/reference/tsserver/projectReferences/new-file-is-added-to-the-referenced-project-when-referenced-project-is-open-with-disableSourceOfProjectReferenceRedirect.js b/tests/baselines/reference/tsserver/projectReferences/new-file-is-added-to-the-referenced-project-when-referenced-project-is-open-with-disableSourceOfProjectReferenceRedirect.js index e17a9ec7915e3..7f2d161a7d719 100644 --- a/tests/baselines/reference/tsserver/projectReferences/new-file-is-added-to-the-referenced-project-when-referenced-project-is-open-with-disableSourceOfProjectReferenceRedirect.js +++ b/tests/baselines/reference/tsserver/projectReferences/new-file-is-added-to-the-referenced-project-when-referenced-project-is-open-with-disableSourceOfProjectReferenceRedirect.js @@ -55,7 +55,7 @@ Project '/user/username/projects/myproject/projects/project2/tsconfig.json' (Con ../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../project1/class1.d.ts Output from referenced project '../project1/tsconfig.json' included because '--module' is specified as 'none' class2.ts @@ -92,7 +92,7 @@ Project '/user/username/projects/myproject/projects/project1/tsconfig.json' (Con ../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' class1.ts Matched by include pattern '**/*' in 'tsconfig.json' @@ -136,7 +136,7 @@ Project '/user/username/projects/myproject/projects/project1/tsconfig.json' (Con ../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' class1.ts Matched by include pattern '**/*' in 'tsconfig.json' class3.ts @@ -193,7 +193,7 @@ Project '/user/username/projects/myproject/projects/project2/tsconfig.json' (Con ../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../project1/class1.d.ts Output from referenced project '../project1/tsconfig.json' included because '--module' is specified as 'none' ../project1/class3.d.ts @@ -257,7 +257,7 @@ Project '/user/username/projects/myproject/projects/project2/tsconfig.json' (Con ../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../project1/class1.d.ts Output from referenced project '../project1/tsconfig.json' included because '--module' is specified as 'none' class2.ts @@ -314,7 +314,7 @@ Project '/user/username/projects/myproject/projects/project2/tsconfig.json' (Con ../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../project1/class1.d.ts Output from referenced project '../project1/tsconfig.json' included because '--module' is specified as 'none' ../project1/class3.d.ts diff --git a/tests/baselines/reference/tsserver/projectReferences/new-file-is-added-to-the-referenced-project-when-referenced-project-is-open.js b/tests/baselines/reference/tsserver/projectReferences/new-file-is-added-to-the-referenced-project-when-referenced-project-is-open.js index 6d615c5d9cca1..e599b581ce232 100644 --- a/tests/baselines/reference/tsserver/projectReferences/new-file-is-added-to-the-referenced-project-when-referenced-project-is-open.js +++ b/tests/baselines/reference/tsserver/projectReferences/new-file-is-added-to-the-referenced-project-when-referenced-project-is-open.js @@ -54,7 +54,7 @@ Project '/user/username/projects/myproject/projects/project2/tsconfig.json' (Con ../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../project1/class1.ts Source from referenced project '../project1/tsconfig.json' included because '--module' is specified as 'none' class2.ts @@ -92,7 +92,7 @@ Project '/user/username/projects/myproject/projects/project1/tsconfig.json' (Con ../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' class1.ts Matched by include pattern '**/*' in 'tsconfig.json' @@ -132,7 +132,7 @@ Project '/user/username/projects/myproject/projects/project2/tsconfig.json' (Con ../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../project1/class1.ts Source from referenced project '../project1/tsconfig.json' included because '--module' is specified as 'none' ../project1/class3.ts @@ -152,7 +152,7 @@ Project '/user/username/projects/myproject/projects/project1/tsconfig.json' (Con ../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' class1.ts Matched by include pattern '**/*' in 'tsconfig.json' class3.ts diff --git a/tests/baselines/reference/tsserver/projectReferences/project-is-directly-referenced-by-solution.js b/tests/baselines/reference/tsserver/projectReferences/project-is-directly-referenced-by-solution.js index 0491fc90397c8..733f44198e166 100644 --- a/tests/baselines/reference/tsserver/projectReferences/project-is-directly-referenced-by-solution.js +++ b/tests/baselines/reference/tsserver/projectReferences/project-is-directly-referenced-by-solution.js @@ -60,7 +60,7 @@ Project '/user/username/projects/myproject/tsconfig-src.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' Matched by include pattern './src/**/*' in 'tsconfig-src.json' @@ -201,7 +201,7 @@ Project '/user/username/projects/myproject/tsconfig-src.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' Matched by include pattern './src/**/*' in 'tsconfig-src.json' @@ -281,7 +281,7 @@ Project '/user/username/projects/myproject/tsconfig-src.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' Matched by include pattern './src/**/*' in 'tsconfig-src.json' @@ -537,7 +537,7 @@ Project '/user/username/projects/myproject/indirect3/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../target/src/helpers/functions.d.ts Imported via 'helpers/functions' from file '../target/src/main.d.ts' ../target/src/main.d.ts @@ -571,7 +571,7 @@ Project '/user/username/projects/myproject/tsconfig-src.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' Matched by include pattern './src/**/*' in 'tsconfig-src.json' @@ -668,7 +668,7 @@ Project '/user/username/projects/myproject/tsconfig-src.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' Matched by include pattern './src/**/*' in 'tsconfig-src.json' diff --git a/tests/baselines/reference/tsserver/projectReferences/project-is-indirectly-referenced-by-solution.js b/tests/baselines/reference/tsserver/projectReferences/project-is-indirectly-referenced-by-solution.js index 1fc3aca66dd00..f98f0ac84e7ad 100644 --- a/tests/baselines/reference/tsserver/projectReferences/project-is-indirectly-referenced-by-solution.js +++ b/tests/baselines/reference/tsserver/projectReferences/project-is-indirectly-referenced-by-solution.js @@ -100,7 +100,7 @@ Project '/user/username/projects/myproject/tsconfig-src.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' Matched by include pattern './src/**/*' in 'tsconfig-src.json' @@ -243,7 +243,7 @@ Project '/user/username/projects/myproject/tsconfig-src.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' Matched by include pattern './src/**/*' in 'tsconfig-src.json' @@ -363,7 +363,7 @@ Project '/user/username/projects/myproject/tsconfig-src.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' Matched by include pattern './src/**/*' in 'tsconfig-src.json' @@ -606,7 +606,7 @@ Project '/user/username/projects/myproject/tsconfig-indirect1.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' src/main.ts @@ -637,7 +637,7 @@ Project '/user/username/projects/myproject/tsconfig-indirect2.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' src/main.ts @@ -743,7 +743,7 @@ Project '/user/username/projects/myproject/indirect3/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../target/src/helpers/functions.d.ts Imported via 'helpers/functions' from file '../target/src/main.d.ts' ../target/src/main.d.ts @@ -777,7 +777,7 @@ Project '/user/username/projects/myproject/tsconfig-src.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' Matched by include pattern './src/**/*' in 'tsconfig-src.json' @@ -797,7 +797,7 @@ Project '/user/username/projects/myproject/tsconfig-indirect1.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' src/main.ts @@ -819,7 +819,7 @@ Project '/user/username/projects/myproject/tsconfig-indirect2.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' src/main.ts @@ -960,7 +960,7 @@ Project '/user/username/projects/myproject/tsconfig-src.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' Matched by include pattern './src/**/*' in 'tsconfig-src.json' @@ -996,7 +996,7 @@ Project '/user/username/projects/myproject/tsconfig-indirect1.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' src/main.ts @@ -1025,7 +1025,7 @@ Project '/user/username/projects/myproject/tsconfig-indirect2.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' src/main.ts diff --git a/tests/baselines/reference/tsserver/projectReferences/root-file-is-file-from-referenced-project-and-using-declaration-maps.js b/tests/baselines/reference/tsserver/projectReferences/root-file-is-file-from-referenced-project-and-using-declaration-maps.js index 0730f12780e09..7b780c70d9461 100644 --- a/tests/baselines/reference/tsserver/projectReferences/root-file-is-file-from-referenced-project-and-using-declaration-maps.js +++ b/tests/baselines/reference/tsserver/projectReferences/root-file-is-file-from-referenced-project-and-using-declaration-maps.js @@ -39,7 +39,7 @@ Project '/user/username/projects/project/src/common/tsconfig.json' (Configured) ../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' input/keyboard.ts Imported via 'common/input/keyboard' from file 'input/keyboard.test.ts' Matched by include pattern './**/*' in 'tsconfig.json' @@ -116,7 +116,7 @@ Project '/user/username/projects/project/src/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../out/input/keyboard.d.ts Imported via 'common/input/keyboard' from file 'terminal.ts' Imported via 'common/input/keyboard' from file 'common/input/keyboard.test.ts' diff --git a/tests/baselines/reference/tsserver/projectReferences/root-file-is-file-from-referenced-project.js b/tests/baselines/reference/tsserver/projectReferences/root-file-is-file-from-referenced-project.js index 6c9ab0042f3ae..087b11925fd3f 100644 --- a/tests/baselines/reference/tsserver/projectReferences/root-file-is-file-from-referenced-project.js +++ b/tests/baselines/reference/tsserver/projectReferences/root-file-is-file-from-referenced-project.js @@ -39,7 +39,7 @@ Project '/user/username/projects/project/src/common/tsconfig.json' (Configured) ../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' input/keyboard.ts Imported via 'common/input/keyboard' from file 'input/keyboard.test.ts' Matched by include pattern './**/*' in 'tsconfig.json' @@ -115,7 +115,7 @@ Project '/user/username/projects/project/src/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' common/input/keyboard.ts Imported via 'common/input/keyboard' from file 'terminal.ts' Imported via 'common/input/keyboard' from file 'common/input/keyboard.test.ts' diff --git a/tests/baselines/reference/tsserver/projectReferences/solution-with-its-own-files-and-disables-looking-into-the-child-project-if-disableReferencedProjectLoad-is-set-in-first-indirect-project-but-not-in-another-one.js b/tests/baselines/reference/tsserver/projectReferences/solution-with-its-own-files-and-disables-looking-into-the-child-project-if-disableReferencedProjectLoad-is-set-in-first-indirect-project-but-not-in-another-one.js index 409f4ec3ab500..9ccdf36a3e7d8 100644 --- a/tests/baselines/reference/tsserver/projectReferences/solution-with-its-own-files-and-disables-looking-into-the-child-project-if-disableReferencedProjectLoad-is-set-in-first-indirect-project-but-not-in-another-one.js +++ b/tests/baselines/reference/tsserver/projectReferences/solution-with-its-own-files-and-disables-looking-into-the-child-project-if-disableReferencedProjectLoad-is-set-in-first-indirect-project-but-not-in-another-one.js @@ -96,7 +96,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' src/main.ts @@ -127,7 +127,7 @@ Project '/user/username/projects/myproject/tsconfig-src.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' Matched by include pattern './src/**/*' in 'tsconfig-src.json' @@ -250,7 +250,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' src/main.ts @@ -275,7 +275,7 @@ Project '/user/username/projects/myproject/tsconfig-src.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' Matched by include pattern './src/**/*' in 'tsconfig-src.json' @@ -395,7 +395,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' src/main.ts @@ -424,7 +424,7 @@ Project '/user/username/projects/myproject/tsconfig-src.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' Matched by include pattern './src/**/*' in 'tsconfig-src.json' diff --git a/tests/baselines/reference/tsserver/projectReferences/solution-with-its-own-files-and-disables-looking-into-the-child-project-if-disableReferencedProjectLoad-is-set-in-indirect-project.js b/tests/baselines/reference/tsserver/projectReferences/solution-with-its-own-files-and-disables-looking-into-the-child-project-if-disableReferencedProjectLoad-is-set-in-indirect-project.js index 657f545b7bd0b..3ff42e8c78ea1 100644 --- a/tests/baselines/reference/tsserver/projectReferences/solution-with-its-own-files-and-disables-looking-into-the-child-project-if-disableReferencedProjectLoad-is-set-in-indirect-project.js +++ b/tests/baselines/reference/tsserver/projectReferences/solution-with-its-own-files-and-disables-looking-into-the-child-project-if-disableReferencedProjectLoad-is-set-in-indirect-project.js @@ -74,7 +74,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' src/main.ts @@ -106,7 +106,7 @@ Project '/user/username/projects/myproject/tsconfig-indirect1.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' src/main.ts @@ -230,7 +230,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' src/main.ts @@ -254,7 +254,7 @@ Project '/user/username/projects/myproject/tsconfig-indirect1.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' src/main.ts @@ -354,7 +354,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' src/main.ts @@ -384,7 +384,7 @@ Project '/user/username/projects/myproject/tsconfig-indirect1.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' src/main.ts diff --git a/tests/baselines/reference/tsserver/projectReferences/solution-with-its-own-files-and-disables-looking-into-the-child-project-if-disableReferencedProjectLoad-is-set.js b/tests/baselines/reference/tsserver/projectReferences/solution-with-its-own-files-and-disables-looking-into-the-child-project-if-disableReferencedProjectLoad-is-set.js index 7bacd99ea0871..777ac2ad63b24 100644 --- a/tests/baselines/reference/tsserver/projectReferences/solution-with-its-own-files-and-disables-looking-into-the-child-project-if-disableReferencedProjectLoad-is-set.js +++ b/tests/baselines/reference/tsserver/projectReferences/solution-with-its-own-files-and-disables-looking-into-the-child-project-if-disableReferencedProjectLoad-is-set.js @@ -54,7 +54,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' src/main.ts @@ -161,7 +161,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' src/main.ts @@ -240,7 +240,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' src/main.ts diff --git a/tests/baselines/reference/tsserver/projectReferences/solution-with-its-own-files-and-project-found-is-not-solution-but-references-open-file-through-project-reference.js b/tests/baselines/reference/tsserver/projectReferences/solution-with-its-own-files-and-project-found-is-not-solution-but-references-open-file-through-project-reference.js index 5e41243f1dbdc..557538b6f45e1 100644 --- a/tests/baselines/reference/tsserver/projectReferences/solution-with-its-own-files-and-project-found-is-not-solution-but-references-open-file-through-project-reference.js +++ b/tests/baselines/reference/tsserver/projectReferences/solution-with-its-own-files-and-project-found-is-not-solution-but-references-open-file-through-project-reference.js @@ -53,7 +53,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' src/main.ts @@ -82,7 +82,7 @@ Project '/user/username/projects/myproject/tsconfig-src.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' Matched by include pattern './src/**/*' in 'tsconfig-src.json' @@ -214,7 +214,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' src/main.ts @@ -235,7 +235,7 @@ Project '/user/username/projects/myproject/tsconfig-src.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' Matched by include pattern './src/**/*' in 'tsconfig-src.json' @@ -311,7 +311,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' src/main.ts @@ -338,7 +338,7 @@ Project '/user/username/projects/myproject/tsconfig-src.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' Matched by include pattern './src/**/*' in 'tsconfig-src.json' @@ -612,7 +612,7 @@ Project '/user/username/projects/myproject/indirect3/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../target/src/helpers/functions.d.ts Imported via 'helpers/functions' from file '../target/src/main.d.ts' ../target/src/main.d.ts @@ -637,7 +637,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' src/main.ts @@ -658,7 +658,7 @@ Project '/user/username/projects/myproject/tsconfig-src.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' Matched by include pattern './src/**/*' in 'tsconfig-src.json' @@ -751,7 +751,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' src/main.ts @@ -778,7 +778,7 @@ Project '/user/username/projects/myproject/tsconfig-src.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' Matched by include pattern './src/**/*' in 'tsconfig-src.json' diff --git a/tests/baselines/reference/tsserver/projectReferences/solution-with-its-own-files-and-project-is-indirectly-referenced-by-solution.js b/tests/baselines/reference/tsserver/projectReferences/solution-with-its-own-files-and-project-is-indirectly-referenced-by-solution.js index ae073122bf4a7..172371c9136b7 100644 --- a/tests/baselines/reference/tsserver/projectReferences/solution-with-its-own-files-and-project-is-indirectly-referenced-by-solution.js +++ b/tests/baselines/reference/tsserver/projectReferences/solution-with-its-own-files-and-project-is-indirectly-referenced-by-solution.js @@ -95,7 +95,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' src/main.ts @@ -126,7 +126,7 @@ Project '/user/username/projects/myproject/tsconfig-src.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' Matched by include pattern './src/**/*' in 'tsconfig-src.json' @@ -259,7 +259,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' src/main.ts @@ -284,7 +284,7 @@ Project '/user/username/projects/myproject/tsconfig-src.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' Matched by include pattern './src/**/*' in 'tsconfig-src.json' @@ -403,7 +403,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' src/main.ts @@ -432,7 +432,7 @@ Project '/user/username/projects/myproject/tsconfig-src.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' Matched by include pattern './src/**/*' in 'tsconfig-src.json' @@ -696,7 +696,7 @@ Project '/user/username/projects/myproject/tsconfig-indirect1.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' src/main.ts @@ -735,7 +735,7 @@ Project '/user/username/projects/myproject/tsconfig-indirect2.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' src/main.ts @@ -841,7 +841,7 @@ Project '/user/username/projects/myproject/indirect3/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../target/src/helpers/functions.d.ts Imported via 'helpers/functions' from file '../target/src/main.d.ts' ../target/src/main.d.ts @@ -867,7 +867,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' src/main.ts @@ -890,7 +890,7 @@ Project '/user/username/projects/myproject/tsconfig-src.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' Matched by include pattern './src/**/*' in 'tsconfig-src.json' @@ -910,7 +910,7 @@ Project '/user/username/projects/myproject/tsconfig-indirect1.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' src/main.ts @@ -932,7 +932,7 @@ Project '/user/username/projects/myproject/tsconfig-indirect2.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' src/main.ts @@ -1071,7 +1071,7 @@ Project '/user/username/projects/myproject/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' src/main.ts @@ -1100,7 +1100,7 @@ Project '/user/username/projects/myproject/tsconfig-src.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' Matched by include pattern './src/**/*' in 'tsconfig-src.json' @@ -1135,7 +1135,7 @@ Project '/user/username/projects/myproject/tsconfig-indirect1.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' src/main.ts @@ -1164,7 +1164,7 @@ Project '/user/username/projects/myproject/tsconfig-indirect2.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/helpers/functions.ts Imported via 'helpers/functions' from file 'src/main.ts' src/main.ts diff --git a/tests/baselines/reference/tsserver/projectReferences/special-handling-of-localness-when-using-arrow-function-as-object-literal-property-is-loaded-through-indirect-assignment-with-original-declaration-local-to-project-is-treated-as-local.js b/tests/baselines/reference/tsserver/projectReferences/special-handling-of-localness-when-using-arrow-function-as-object-literal-property-is-loaded-through-indirect-assignment-with-original-declaration-local-to-project-is-treated-as-local.js index a38fee1014521..002fd13a1027c 100644 --- a/tests/baselines/reference/tsserver/projectReferences/special-handling-of-localness-when-using-arrow-function-as-object-literal-property-is-loaded-through-indirect-assignment-with-original-declaration-local-to-project-is-treated-as-local.js +++ b/tests/baselines/reference/tsserver/projectReferences/special-handling-of-localness-when-using-arrow-function-as-object-literal-property-is-loaded-through-indirect-assignment-with-original-declaration-local-to-project-is-treated-as-local.js @@ -56,7 +56,7 @@ Project '/user/username/projects/solution/api/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../shared/src/index.ts Imported via "../../shared/dist" from file 'src/server.ts' src/server.ts @@ -99,7 +99,7 @@ Project '/user/username/projects/solution/shared/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/index.ts Matched by include pattern 'src' in 'tsconfig.json' diff --git a/tests/baselines/reference/tsserver/projectReferences/special-handling-of-localness-when-using-arrow-function-as-object-literal-property.js b/tests/baselines/reference/tsserver/projectReferences/special-handling-of-localness-when-using-arrow-function-as-object-literal-property.js index 4952ad577f57a..05dbc65c8940c 100644 --- a/tests/baselines/reference/tsserver/projectReferences/special-handling-of-localness-when-using-arrow-function-as-object-literal-property.js +++ b/tests/baselines/reference/tsserver/projectReferences/special-handling-of-localness-when-using-arrow-function-as-object-literal-property.js @@ -56,7 +56,7 @@ Project '/user/username/projects/solution/api/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../shared/src/index.ts Imported via "../../shared/dist" from file 'src/server.ts' src/server.ts @@ -99,7 +99,7 @@ Project '/user/username/projects/solution/shared/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/index.ts Matched by include pattern 'src' in 'tsconfig.json' @@ -168,7 +168,7 @@ Project '/user/username/projects/solution/app/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../shared/src/index.ts Imported via "../../shared/dist" from file 'src/app.ts' src/app.ts diff --git a/tests/baselines/reference/tsserver/projectReferences/special-handling-of-localness-when-using-arrow-function-assignment.js b/tests/baselines/reference/tsserver/projectReferences/special-handling-of-localness-when-using-arrow-function-assignment.js index 9d7bd0466e250..94d141350d905 100644 --- a/tests/baselines/reference/tsserver/projectReferences/special-handling-of-localness-when-using-arrow-function-assignment.js +++ b/tests/baselines/reference/tsserver/projectReferences/special-handling-of-localness-when-using-arrow-function-assignment.js @@ -56,7 +56,7 @@ Project '/user/username/projects/solution/api/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../shared/src/index.ts Imported via "../../shared/dist" from file 'src/server.ts' src/server.ts @@ -99,7 +99,7 @@ Project '/user/username/projects/solution/shared/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/index.ts Matched by include pattern 'src' in 'tsconfig.json' @@ -168,7 +168,7 @@ Project '/user/username/projects/solution/app/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../shared/src/index.ts Imported via "../../shared/dist" from file 'src/app.ts' src/app.ts diff --git a/tests/baselines/reference/tsserver/projectReferences/special-handling-of-localness-when-using-method-of-class-expression.js b/tests/baselines/reference/tsserver/projectReferences/special-handling-of-localness-when-using-method-of-class-expression.js index 08ead42ba29b1..90ba1f57746a1 100644 --- a/tests/baselines/reference/tsserver/projectReferences/special-handling-of-localness-when-using-method-of-class-expression.js +++ b/tests/baselines/reference/tsserver/projectReferences/special-handling-of-localness-when-using-method-of-class-expression.js @@ -56,7 +56,7 @@ Project '/user/username/projects/solution/api/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../shared/src/index.ts Imported via "../../shared/dist" from file 'src/server.ts' src/server.ts @@ -99,7 +99,7 @@ Project '/user/username/projects/solution/shared/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/index.ts Matched by include pattern 'src' in 'tsconfig.json' @@ -168,7 +168,7 @@ Project '/user/username/projects/solution/app/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../shared/src/index.ts Imported via "../../shared/dist" from file 'src/app.ts' src/app.ts diff --git a/tests/baselines/reference/tsserver/projectReferences/special-handling-of-localness-when-using-object-literal-property.js b/tests/baselines/reference/tsserver/projectReferences/special-handling-of-localness-when-using-object-literal-property.js index 4bad4c371a6fa..08dfbe0bb76f3 100644 --- a/tests/baselines/reference/tsserver/projectReferences/special-handling-of-localness-when-using-object-literal-property.js +++ b/tests/baselines/reference/tsserver/projectReferences/special-handling-of-localness-when-using-object-literal-property.js @@ -56,7 +56,7 @@ Project '/user/username/projects/solution/api/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../shared/src/index.ts Imported via "../../shared/dist" from file 'src/server.ts' src/server.ts @@ -99,7 +99,7 @@ Project '/user/username/projects/solution/shared/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/index.ts Matched by include pattern 'src' in 'tsconfig.json' @@ -168,7 +168,7 @@ Project '/user/username/projects/solution/app/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../shared/src/index.ts Imported via "../../shared/dist" from file 'src/app.ts' src/app.ts diff --git a/tests/baselines/reference/tsserver/projectReferences/when-files-from-two-projects-are-open-and-one-project-references.js b/tests/baselines/reference/tsserver/projectReferences/when-files-from-two-projects-are-open-and-one-project-references.js index 4c42d2445d25b..f4b045872292a 100644 --- a/tests/baselines/reference/tsserver/projectReferences/when-files-from-two-projects-are-open-and-one-project-references.js +++ b/tests/baselines/reference/tsserver/projectReferences/when-files-from-two-projects-are-open-and-one-project-references.js @@ -242,7 +242,7 @@ Project '/user/username/projects/myproject/main/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/file1.ts Matched by include pattern '**/*' in 'tsconfig.json' @@ -275,7 +275,7 @@ Project '/user/username/projects/myproject/core/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/file1.ts Matched by include pattern '**/*' in 'tsconfig.json' @@ -313,7 +313,7 @@ Project '/user/username/projects/myproject/indirect/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/file1.ts Matched by include pattern '**/*' in 'tsconfig.json' @@ -334,7 +334,7 @@ Project '/user/username/projects/myproject/coreRef1/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/file1.ts Matched by include pattern '**/*' in 'tsconfig.json' @@ -355,7 +355,7 @@ Project '/user/username/projects/myproject/indirectDisabledChildLoad1/tsconfig.j ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/file1.ts Matched by include pattern '**/*' in 'tsconfig.json' @@ -376,7 +376,7 @@ Project '/user/username/projects/myproject/indirectDisabledChildLoad2/tsconfig.j ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/file1.ts Matched by include pattern '**/*' in 'tsconfig.json' @@ -397,7 +397,7 @@ Project '/user/username/projects/myproject/refToCoreRef3/tsconfig.json' (Configu ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/file1.ts Matched by include pattern '**/*' in 'tsconfig.json' @@ -418,7 +418,7 @@ Project '/user/username/projects/myproject/coreRef3/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/file1.ts Matched by include pattern '**/*' in 'tsconfig.json' diff --git a/tests/baselines/reference/tsserver/projectReferences/when-the-referenced-projects-have-allowJs-and-emitDeclarationOnly.js b/tests/baselines/reference/tsserver/projectReferences/when-the-referenced-projects-have-allowJs-and-emitDeclarationOnly.js index 37b36b07abe29..dc9685be6c87c 100644 --- a/tests/baselines/reference/tsserver/projectReferences/when-the-referenced-projects-have-allowJs-and-emitDeclarationOnly.js +++ b/tests/baselines/reference/tsserver/projectReferences/when-the-referenced-projects-have-allowJs-and-emitDeclarationOnly.js @@ -70,7 +70,7 @@ Project '/user/username/projects/myproject/packages/consumer/tsconfig.json' (Con ../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../emit-composite/src/testModule.js Imported via './testModule' from file '../emit-composite/src/index.js' ../emit-composite/src/index.js diff --git a/tests/baselines/reference/tsserver/projectReferences/with-disableSolutionSearching-solution-and-siblings-are-not-loaded.js b/tests/baselines/reference/tsserver/projectReferences/with-disableSolutionSearching-solution-and-siblings-are-not-loaded.js index af244659e889f..c979a5b84dd6f 100644 --- a/tests/baselines/reference/tsserver/projectReferences/with-disableSolutionSearching-solution-and-siblings-are-not-loaded.js +++ b/tests/baselines/reference/tsserver/projectReferences/with-disableSolutionSearching-solution-and-siblings-are-not-loaded.js @@ -33,7 +33,7 @@ Project '/user/username/projects/solution/compiler/tsconfig.json' (Configured) ../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' types.ts Part of 'files' list in tsconfig.json program.ts diff --git a/tests/baselines/reference/tsserver/projects/getting-errors-from-closed-script-info-does-not-throw-exception-because-of-getting-project-from-orphan-script-info.js b/tests/baselines/reference/tsserver/projects/getting-errors-from-closed-script-info-does-not-throw-exception-because-of-getting-project-from-orphan-script-info.js index ab3c92b0b9a1d..d80fa072de0c4 100644 --- a/tests/baselines/reference/tsserver/projects/getting-errors-from-closed-script-info-does-not-throw-exception-because-of-getting-project-from-orphan-script-info.js +++ b/tests/baselines/reference/tsserver/projects/getting-errors-from-closed-script-info-does-not-throw-exception-because-of-getting-project-from-orphan-script-info.js @@ -27,7 +27,7 @@ Project '/a/b/tsconfig.json' (Configured) ../lib/lib.d.ts - Default library + Default library for target 'es3' app.ts Matched by include pattern '**/*' in 'tsconfig.json' diff --git a/tests/baselines/reference/tsserver/projects/handles-delayed-directory-watch-invoke-on-file-creation.js b/tests/baselines/reference/tsserver/projects/handles-delayed-directory-watch-invoke-on-file-creation.js index 306fe238706cd..fddcb0fa0e0c3 100644 --- a/tests/baselines/reference/tsserver/projects/handles-delayed-directory-watch-invoke-on-file-creation.js +++ b/tests/baselines/reference/tsserver/projects/handles-delayed-directory-watch-invoke-on-file-creation.js @@ -32,7 +32,7 @@ Project '/users/username/projects/project/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' b.ts Matched by include pattern '**/*' in 'tsconfig.json' sub/a.ts @@ -101,7 +101,7 @@ Project '/users/username/projects/project/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' b.ts Matched by include pattern '**/*' in 'tsconfig.json' a.ts @@ -167,7 +167,7 @@ Project '/users/username/projects/project/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' b.ts Matched by include pattern '**/*' in 'tsconfig.json' @@ -273,7 +273,7 @@ Project '/users/username/projects/project/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' b.ts Matched by include pattern '**/*' in 'tsconfig.json' sub/a.ts diff --git a/tests/baselines/reference/tsserver/symLinks/module-resolution-when-project-compiles-from-sources.js b/tests/baselines/reference/tsserver/symLinks/module-resolution-when-project-compiles-from-sources.js index a77bb2e51b5fe..cb3c63b45f1cb 100644 --- a/tests/baselines/reference/tsserver/symLinks/module-resolution-when-project-compiles-from-sources.js +++ b/tests/baselines/reference/tsserver/symLinks/module-resolution-when-project-compiles-from-sources.js @@ -45,7 +45,7 @@ Project '/users/username/projects/myproject/javascript/packages/recognizers-date ../../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/datetime/baseDate.ts Matched by include pattern 'src' in 'tsconfig.json' @@ -103,7 +103,7 @@ Project '/users/username/projects/myproject/javascript/packages/recognizers-date ../../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../recognizers-text/dist/types/recognizers-text.d.ts Imported via "@microsoft/recognizers-text" from file 'src/datetime/baseDate.ts' src/datetime/baseDate.ts diff --git a/tests/baselines/reference/tsserver/symLinks/module-resolution-when-project-has-node_modules-setup-but-doesnt-have-modules-in-typings-folder-and-then-recompiles.js b/tests/baselines/reference/tsserver/symLinks/module-resolution-when-project-has-node_modules-setup-but-doesnt-have-modules-in-typings-folder-and-then-recompiles.js index e34260a45bdb2..73d3cc01ddeed 100644 --- a/tests/baselines/reference/tsserver/symLinks/module-resolution-when-project-has-node_modules-setup-but-doesnt-have-modules-in-typings-folder-and-then-recompiles.js +++ b/tests/baselines/reference/tsserver/symLinks/module-resolution-when-project-has-node_modules-setup-but-doesnt-have-modules-in-typings-folder-and-then-recompiles.js @@ -45,7 +45,7 @@ Project '/users/username/projects/myproject/javascript/packages/recognizers-date ../../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/datetime/baseDate.ts Matched by include pattern 'src' in 'tsconfig.json' diff --git a/tests/baselines/reference/tsserver/symLinks/module-resolution-when-project-recompiles-after-deleting-generated-folders.js b/tests/baselines/reference/tsserver/symLinks/module-resolution-when-project-recompiles-after-deleting-generated-folders.js index 8358625f4853e..8135d10fc6a27 100644 --- a/tests/baselines/reference/tsserver/symLinks/module-resolution-when-project-recompiles-after-deleting-generated-folders.js +++ b/tests/baselines/reference/tsserver/symLinks/module-resolution-when-project-recompiles-after-deleting-generated-folders.js @@ -41,7 +41,7 @@ Project '/users/username/projects/myproject/javascript/packages/recognizers-date ../../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../recognizers-text/dist/types/recognizers-text.d.ts Imported via "@microsoft/recognizers-text" from file 'src/datetime/baseDate.ts' src/datetime/baseDate.ts @@ -93,7 +93,7 @@ Project '/users/username/projects/myproject/javascript/packages/recognizers-date ../../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/datetime/baseDate.ts Matched by include pattern 'src' in 'tsconfig.json' diff --git a/tests/baselines/reference/tsserver/symLinks/module-resolution-with-path-mapping-when-project-compiles-from-sources.js b/tests/baselines/reference/tsserver/symLinks/module-resolution-with-path-mapping-when-project-compiles-from-sources.js index 170cbacc4d17f..d7f9852e16033 100644 --- a/tests/baselines/reference/tsserver/symLinks/module-resolution-with-path-mapping-when-project-compiles-from-sources.js +++ b/tests/baselines/reference/tsserver/symLinks/module-resolution-with-path-mapping-when-project-compiles-from-sources.js @@ -57,7 +57,7 @@ Project '/users/username/projects/myproject/javascript/packages/recognizers-date ../../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/datetime/baseDate.ts Matched by include pattern 'src' in 'tsconfig.json' @@ -128,7 +128,7 @@ Project '/users/username/projects/myproject/javascript/packages/recognizers-date ../../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../recognizers-text/dist/types/recognizers-text.d.ts Imported via "@microsoft/recognizers-text" from file 'src/datetime/baseDate.ts' src/datetime/baseDate.ts diff --git a/tests/baselines/reference/tsserver/symLinks/module-resolution-with-path-mapping-when-project-has-node_modules-setup-but-doesnt-have-modules-in-typings-folder-and-then-recompiles.js b/tests/baselines/reference/tsserver/symLinks/module-resolution-with-path-mapping-when-project-has-node_modules-setup-but-doesnt-have-modules-in-typings-folder-and-then-recompiles.js index cd7d0a69f8dfb..c0d72dafd98fb 100644 --- a/tests/baselines/reference/tsserver/symLinks/module-resolution-with-path-mapping-when-project-has-node_modules-setup-but-doesnt-have-modules-in-typings-folder-and-then-recompiles.js +++ b/tests/baselines/reference/tsserver/symLinks/module-resolution-with-path-mapping-when-project-has-node_modules-setup-but-doesnt-have-modules-in-typings-folder-and-then-recompiles.js @@ -57,7 +57,7 @@ Project '/users/username/projects/myproject/javascript/packages/recognizers-date ../../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/datetime/baseDate.ts Matched by include pattern 'src' in 'tsconfig.json' @@ -120,7 +120,7 @@ Project '/users/username/projects/myproject/javascript/packages/recognizers-date ../../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../recognizers-text/dist/types/recognizers-text.d.ts Imported via "@microsoft/recognizers-text" from file 'src/datetime/baseDate.ts' src/datetime/baseDate.ts diff --git a/tests/baselines/reference/tsserver/symLinks/module-resolution-with-path-mapping-when-project-recompiles-after-deleting-generated-folders.js b/tests/baselines/reference/tsserver/symLinks/module-resolution-with-path-mapping-when-project-recompiles-after-deleting-generated-folders.js index b170b793afd68..03d1e2e66885c 100644 --- a/tests/baselines/reference/tsserver/symLinks/module-resolution-with-path-mapping-when-project-recompiles-after-deleting-generated-folders.js +++ b/tests/baselines/reference/tsserver/symLinks/module-resolution-with-path-mapping-when-project-recompiles-after-deleting-generated-folders.js @@ -47,7 +47,7 @@ Project '/users/username/projects/myproject/javascript/packages/recognizers-date ../../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../recognizers-text/dist/types/recognizers-text.d.ts Imported via "@microsoft/recognizers-text" from file 'src/datetime/baseDate.ts' src/datetime/baseDate.ts @@ -105,7 +105,7 @@ Project '/users/username/projects/myproject/javascript/packages/recognizers-date ../../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' src/datetime/baseDate.ts Matched by include pattern 'src' in 'tsconfig.json' @@ -176,7 +176,7 @@ Project '/users/username/projects/myproject/javascript/packages/recognizers-date ../../../../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' ../recognizers-text/dist/types/recognizers-text.d.ts Imported via "@microsoft/recognizers-text" from file 'src/datetime/baseDate.ts' src/datetime/baseDate.ts diff --git a/tests/baselines/reference/tsserver/symLinks/rename-in-common-file-renames-all-project.js b/tests/baselines/reference/tsserver/symLinks/rename-in-common-file-renames-all-project.js index 4911e8dd31f46..8c65341cf397e 100644 --- a/tests/baselines/reference/tsserver/symLinks/rename-in-common-file-renames-all-project.js +++ b/tests/baselines/reference/tsserver/symLinks/rename-in-common-file-renames-all-project.js @@ -31,7 +31,7 @@ Project '/users/username/projects/a/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' c/fc.ts Imported via "./c/fc" from file 'a.ts' Matched by include pattern '**/*' in 'tsconfig.json' @@ -78,7 +78,7 @@ Project '/users/username/projects/b/tsconfig.json' (Configured) ../../../../a/lib/lib.d.ts - Default library + Default library for target 'es3' c/fc.ts Imported via "./c/fc" from file 'b.ts' Matched by include pattern '**/*' in 'tsconfig.json' diff --git a/tests/cases/conformance/node/nodeModules1.ts b/tests/cases/conformance/node/nodeModules1.ts new file mode 100644 index 0000000000000..9d81258595ae8 --- /dev/null +++ b/tests/cases/conformance/node/nodeModules1.ts @@ -0,0 +1,34 @@ +// @module: node12,nodenext +// @filename: subfolder/index.ts +// cjs format file +const x = 1; +export {x}; +// @filename: subfolder2/index.ts +// cjs format file +const x = 1; +export {x}; +// @filename: subfolder2/another/index.ts +// esm format file +const x = 1; +export {x}; +// @filename: index.ts +// esm format file +const x = 1; +export {x}; +// @filename: package.json +{ + "name": "package", + "private": true, + "type": "module" +} +// @filename: subfolder/package.json +{ + "type": "commonjs" +} +// @filename: subfolder2/package.json +{ +} +// @filename: subfolder2/another/package.json +{ + "type": "module" +} \ No newline at end of file diff --git a/tests/cases/conformance/node/nodeModulesDynamicImport.ts b/tests/cases/conformance/node/nodeModulesDynamicImport.ts new file mode 100644 index 0000000000000..75a5dcfc88cfb --- /dev/null +++ b/tests/cases/conformance/node/nodeModulesDynamicImport.ts @@ -0,0 +1,23 @@ +// @module: node12,nodenext +// @filename: subfolder/index.ts +// cjs format file +export async function main() { + const { readFile } = await import("fs"); +} +// @filename: index.ts +// esm format file +export async function main() { + const { readFile } = await import("fs"); +} +// @filename: package.json +{ + "name": "package", + "private": true, + "type": "module" +} +// @filename: subfolder/package.json +{ + "type": "commonjs" +} +// @filename: types.d.ts +declare module "fs"; \ No newline at end of file diff --git a/tests/cases/conformance/node/nodeModulesExportAssignments.ts b/tests/cases/conformance/node/nodeModulesExportAssignments.ts new file mode 100644 index 0000000000000..ba604d85090ac --- /dev/null +++ b/tests/cases/conformance/node/nodeModulesExportAssignments.ts @@ -0,0 +1,19 @@ +// @module: node12,nodenext +// @filename: subfolder/index.ts +// cjs format file +const a = {}; +export = a; +// @filename: index.ts +// esm format file +const a = {}; +export = a; +// @filename: package.json +{ + "name": "package", + "private": true, + "type": "module" +} +// @filename: subfolder/package.json +{ + "type": "commonjs" +} \ No newline at end of file diff --git a/tests/cases/conformance/node/nodeModulesGeneratedNameCollisions.ts b/tests/cases/conformance/node/nodeModulesGeneratedNameCollisions.ts new file mode 100644 index 0000000000000..5f708e1454c7b --- /dev/null +++ b/tests/cases/conformance/node/nodeModulesGeneratedNameCollisions.ts @@ -0,0 +1,25 @@ +// @module: node12,nodenext +// @filename: subfolder/index.ts +// cjs format file +function require() {} +const exports = {}; +class Object {} +export const __esModule = false; +export {require, exports, Object}; +// @filename: index.ts +// esm format file +function require() {} +const exports = {}; +class Object {} +export const __esModule = false; +export {require, exports, Object}; +// @filename: package.json +{ + "name": "package", + "private": true, + "type": "module" +} +// @filename: subfolder/package.json +{ + "type": "commonjs" +} \ No newline at end of file diff --git a/tests/cases/conformance/node/nodeModulesImportAssignments.ts b/tests/cases/conformance/node/nodeModulesImportAssignments.ts new file mode 100644 index 0000000000000..d89c23438256a --- /dev/null +++ b/tests/cases/conformance/node/nodeModulesImportAssignments.ts @@ -0,0 +1,30 @@ +// @module: node12,nodenext +// @filename: subfolder/index.ts +// cjs format file +import fs = require("fs"); +fs.readFile; +export import fs2 = require("fs"); +// @filename: index.ts +// esm format file +import fs = require("fs"); +fs.readFile; +export import fs2 = require("fs"); +// @filename: file.ts +// esm format file +const __require = null; +const _createRequire = null; +import fs = require("fs"); +fs.readFile; +export import fs2 = require("fs"); +// @filename: package.json +{ + "name": "package", + "private": true, + "type": "module" +} +// @filename: subfolder/package.json +{ + "type": "commonjs" +} +// @filename: types.d.ts +declare module "fs"; \ No newline at end of file diff --git a/tests/cases/conformance/node/nodeModulesImportHelpersCollisions.ts b/tests/cases/conformance/node/nodeModulesImportHelpersCollisions.ts new file mode 100644 index 0000000000000..95f3830e818fa --- /dev/null +++ b/tests/cases/conformance/node/nodeModulesImportHelpersCollisions.ts @@ -0,0 +1,30 @@ +// @module: node12,nodenext +// @importHelpers: true +// @filename: subfolder/index.ts +// cjs format file +import {default as _fs} from "fs"; +_fs.readFile; +import * as fs from "fs"; +fs.readFile; +// @filename: index.ts +// esm format file +import {default as _fs} from "fs"; +_fs.readFile; +import * as fs from "fs"; +fs.readFile; +// @filename: package.json +{ + "name": "package", + "private": true, + "type": "module" +} +// @filename: subfolder/package.json +{ + "type": "commonjs" +} +// @filename: types.d.ts +declare module "fs"; +declare module "tslib" { + export {}; + // intentionally missing all helpers +} \ No newline at end of file diff --git a/tests/cases/conformance/node/nodeModulesImportHelpersCollisions2.ts b/tests/cases/conformance/node/nodeModulesImportHelpersCollisions2.ts new file mode 100644 index 0000000000000..f018d86e63848 --- /dev/null +++ b/tests/cases/conformance/node/nodeModulesImportHelpersCollisions2.ts @@ -0,0 +1,26 @@ +// @module: node12,nodenext +// @importHelpers: true +// @filename: subfolder/index.ts +// cjs format file +export * from "fs"; +export * as fs from "fs"; +// @filename: index.ts +// esm format file +export * from "fs"; +export * as fs from "fs"; +// @filename: package.json +{ + "name": "package", + "private": true, + "type": "module" +} +// @filename: subfolder/package.json +{ + "type": "commonjs" +} +// @filename: types.d.ts +declare module "fs"; +declare module "tslib" { + export {}; + // intentionally missing all helpers +} \ No newline at end of file diff --git a/tests/cases/conformance/node/nodeModulesImportHelpersCollisions3.ts b/tests/cases/conformance/node/nodeModulesImportHelpersCollisions3.ts new file mode 100644 index 0000000000000..b661affe17a2c --- /dev/null +++ b/tests/cases/conformance/node/nodeModulesImportHelpersCollisions3.ts @@ -0,0 +1,24 @@ +// @module: node12,nodenext +// @importHelpers: true +// @filename: subfolder/index.ts +// cjs format file +export {default} from "fs"; +// @filename: index.ts +// esm format file +export {default} from "fs"; +// @filename: package.json +{ + "name": "package", + "private": true, + "type": "module" +} +// @filename: subfolder/package.json +{ + "type": "commonjs" +} +// @filename: types.d.ts +declare module "fs"; +declare module "tslib" { + export {}; + // intentionally missing all helpers +} \ No newline at end of file diff --git a/tests/cases/conformance/node/nodeModulesImportMeta.ts b/tests/cases/conformance/node/nodeModulesImportMeta.ts new file mode 100644 index 0000000000000..ea83d1b33b3b3 --- /dev/null +++ b/tests/cases/conformance/node/nodeModulesImportMeta.ts @@ -0,0 +1,19 @@ +// @module: node12,nodenext +// @filename: subfolder/index.ts +// cjs format file +const x = import.meta.url; +export {x}; +// @filename: index.ts +// esm format file +const x = import.meta.url; +export {x}; +// @filename: package.json +{ + "name": "package", + "private": true, + "type": "module" +} +// @filename: subfolder/package.json +{ + "type": "commonjs" +} \ No newline at end of file diff --git a/tests/cases/conformance/node/nodeModulesSynchronousCallErrors.ts b/tests/cases/conformance/node/nodeModulesSynchronousCallErrors.ts new file mode 100644 index 0000000000000..8505ee4775096 --- /dev/null +++ b/tests/cases/conformance/node/nodeModulesSynchronousCallErrors.ts @@ -0,0 +1,33 @@ +// @module: node12,nodenext +// @filename: subfolder/index.ts +// 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() { + const mod3 = await import ("../index.js"); + const mod4 = await import ("./index.js"); + h(); +} +// @filename: index.ts +// 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() { + const mod3 = await import ("./index.js"); + const mod4 = await import ("./subfolder/index.js"); + f(); +} +// @filename: package.json +{ + "name": "package", + "private": true, + "type": "module" +} +// @filename: subfolder/package.json +{ + "type": "commonjs" +} \ No newline at end of file diff --git a/tests/cases/conformance/node/nodeModulesTopLevelAwait.ts b/tests/cases/conformance/node/nodeModulesTopLevelAwait.ts new file mode 100644 index 0000000000000..4c950c0072f1d --- /dev/null +++ b/tests/cases/conformance/node/nodeModulesTopLevelAwait.ts @@ -0,0 +1,21 @@ +// @module: node12,nodenext +// @filename: subfolder/index.ts +// cjs format file +const x = await 1; +export {x}; +for await (const y of []) {} +// @filename: index.ts +// esm format file +const x = await 1; +export {x}; +for await (const y of []) {} +// @filename: package.json +{ + "name": "package", + "private": true, + "type": "module" +} +// @filename: subfolder/package.json +{ + "type": "commonjs" +} \ No newline at end of file