typescript 5.5.1-rc → 5.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +129 -202
- package/lib/typescript.d.ts +22 -89
- package/lib/typescript.js +199 -314
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.5";
|
|
21
|
-
var version = "5.5.
|
|
21
|
+
var version = "5.5.2";
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -5923,7 +5923,6 @@ var Diagnostics = {
|
|
|
5923
5923
|
_0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_export_type_0_as_default: diag(1290, 1 /* Error */, "_0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_1290", "'{0}' resolves to a type-only declaration and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'export type { {0} as default }'."),
|
|
5924
5924
|
_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_import_type_where_0_is_imported: diag(1291, 1 /* Error */, "_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enable_1291", "'{0}' resolves to a type and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'import type' where '{0}' is imported."),
|
|
5925
5925
|
_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_export_type_0_as_default: diag(1292, 1 /* Error */, "_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enable_1292", "'{0}' resolves to a type and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'export type { {0} as default }'."),
|
|
5926
|
-
ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve: diag(1293, 1 /* Error */, "ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293", "ESM syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'."),
|
|
5927
5926
|
with_statements_are_not_allowed_in_an_async_function_block: diag(1300, 1 /* Error */, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
|
|
5928
5927
|
await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, 1 /* Error */, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."),
|
|
5929
5928
|
The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level: diag(1309, 1 /* Error */, "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309", "The current file is a CommonJS module and cannot use 'await' at the top level."),
|
|
@@ -12459,6 +12458,9 @@ function createSymbolTable(symbols) {
|
|
|
12459
12458
|
function isTransientSymbol(symbol) {
|
|
12460
12459
|
return (symbol.flags & 33554432 /* Transient */) !== 0;
|
|
12461
12460
|
}
|
|
12461
|
+
function isExternalModuleSymbol(moduleSymbol) {
|
|
12462
|
+
return !!(moduleSymbol.flags & 1536 /* Module */) && moduleSymbol.escapedName.charCodeAt(0) === 34 /* doubleQuote */;
|
|
12463
|
+
}
|
|
12462
12464
|
var stringWriter = createSingleLineStringWriter();
|
|
12463
12465
|
function createSingleLineStringWriter() {
|
|
12464
12466
|
var str = "";
|
|
@@ -14736,23 +14738,6 @@ function isFunctionSymbol(symbol) {
|
|
|
14736
14738
|
const decl = symbol.valueDeclaration;
|
|
14737
14739
|
return decl.kind === 262 /* FunctionDeclaration */ || isVariableDeclaration(decl) && decl.initializer && isFunctionLike(decl.initializer);
|
|
14738
14740
|
}
|
|
14739
|
-
function canHaveModuleSpecifier(node) {
|
|
14740
|
-
switch (node == null ? void 0 : node.kind) {
|
|
14741
|
-
case 260 /* VariableDeclaration */:
|
|
14742
|
-
case 208 /* BindingElement */:
|
|
14743
|
-
case 272 /* ImportDeclaration */:
|
|
14744
|
-
case 278 /* ExportDeclaration */:
|
|
14745
|
-
case 271 /* ImportEqualsDeclaration */:
|
|
14746
|
-
case 273 /* ImportClause */:
|
|
14747
|
-
case 280 /* NamespaceExport */:
|
|
14748
|
-
case 274 /* NamespaceImport */:
|
|
14749
|
-
case 281 /* ExportSpecifier */:
|
|
14750
|
-
case 276 /* ImportSpecifier */:
|
|
14751
|
-
case 205 /* ImportType */:
|
|
14752
|
-
return true;
|
|
14753
|
-
}
|
|
14754
|
-
return false;
|
|
14755
|
-
}
|
|
14756
14741
|
function tryGetModuleSpecifierFromDeclaration(node) {
|
|
14757
14742
|
var _a, _b;
|
|
14758
14743
|
switch (node.kind) {
|
|
@@ -17470,8 +17455,8 @@ function walkTreeForJSXTags(node) {
|
|
|
17470
17455
|
function isFileModuleFromUsingJSXTag(file) {
|
|
17471
17456
|
return !file.isDeclarationFile ? walkTreeForJSXTags(file) : void 0;
|
|
17472
17457
|
}
|
|
17473
|
-
function isFileForcedToBeModuleByFormat(file
|
|
17474
|
-
return (
|
|
17458
|
+
function isFileForcedToBeModuleByFormat(file) {
|
|
17459
|
+
return (file.impliedNodeFormat === 99 /* ESNext */ || fileExtensionIsOneOf(file.fileName, [".cjs" /* Cjs */, ".cts" /* Cts */, ".mjs" /* Mjs */, ".mts" /* Mts */])) && !file.isDeclarationFile ? true : void 0;
|
|
17475
17460
|
}
|
|
17476
17461
|
function getSetExternalModuleIndicator(options) {
|
|
17477
17462
|
switch (getEmitModuleDetectionKind(options)) {
|
|
@@ -17490,14 +17475,10 @@ function getSetExternalModuleIndicator(options) {
|
|
|
17490
17475
|
}
|
|
17491
17476
|
checks.push(isFileForcedToBeModuleByFormat);
|
|
17492
17477
|
const combined = or(...checks);
|
|
17493
|
-
const callback = (file) => void (file.externalModuleIndicator = combined(file
|
|
17478
|
+
const callback = (file) => void (file.externalModuleIndicator = combined(file));
|
|
17494
17479
|
return callback;
|
|
17495
17480
|
}
|
|
17496
17481
|
}
|
|
17497
|
-
function importSyntaxAffectsModuleResolution(options) {
|
|
17498
|
-
const moduleResolution = getEmitModuleResolutionKind(options);
|
|
17499
|
-
return 3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */ || getResolvePackageJsonExports(options) || getResolvePackageJsonImports(options);
|
|
17500
|
-
}
|
|
17501
17482
|
function createComputedCompilerOptions(options) {
|
|
17502
17483
|
return options;
|
|
17503
17484
|
}
|
|
@@ -19171,7 +19152,7 @@ function createNameResolver({
|
|
|
19171
19152
|
}
|
|
19172
19153
|
break;
|
|
19173
19154
|
}
|
|
19174
|
-
if (isSelfReferenceLocation(location)) {
|
|
19155
|
+
if (isSelfReferenceLocation(location, lastLocation)) {
|
|
19175
19156
|
lastSelfReferenceLocation = location;
|
|
19176
19157
|
}
|
|
19177
19158
|
lastLocation = location;
|
|
@@ -19272,8 +19253,10 @@ function createNameResolver({
|
|
|
19272
19253
|
}
|
|
19273
19254
|
return !getImmediatelyInvokedFunctionExpression(location);
|
|
19274
19255
|
}
|
|
19275
|
-
function isSelfReferenceLocation(node) {
|
|
19256
|
+
function isSelfReferenceLocation(node, lastLocation) {
|
|
19276
19257
|
switch (node.kind) {
|
|
19258
|
+
case 169 /* Parameter */:
|
|
19259
|
+
return !!lastLocation && lastLocation === node.name;
|
|
19277
19260
|
case 262 /* FunctionDeclaration */:
|
|
19278
19261
|
case 263 /* ClassDeclaration */:
|
|
19279
19262
|
case 264 /* InterfaceDeclaration */:
|
|
@@ -26655,7 +26638,7 @@ function createExternalHelpersImportDeclarationIfNeeded(nodeFactory, helperFacto
|
|
|
26655
26638
|
if (compilerOptions.importHelpers && isEffectiveExternalModule(sourceFile, compilerOptions)) {
|
|
26656
26639
|
let namedBindings;
|
|
26657
26640
|
const moduleKind = getEmitModuleKind(compilerOptions);
|
|
26658
|
-
if (moduleKind >= 5 /* ES2015 */ && moduleKind <= 99 /* ESNext */ ||
|
|
26641
|
+
if (moduleKind >= 5 /* ES2015 */ && moduleKind <= 99 /* ESNext */ || sourceFile.impliedNodeFormat === 99 /* ESNext */) {
|
|
26659
26642
|
const helpers = getEmitHelpers(sourceFile);
|
|
26660
26643
|
if (helpers) {
|
|
26661
26644
|
const helperNames = [];
|
|
@@ -26720,7 +26703,8 @@ function getOrCreateExternalHelpersModuleNameIfNeeded(factory2, node, compilerOp
|
|
|
26720
26703
|
if (externalHelpersModuleName) {
|
|
26721
26704
|
return externalHelpersModuleName;
|
|
26722
26705
|
}
|
|
26723
|
-
|
|
26706
|
+
const moduleKind = getEmitModuleKind(compilerOptions);
|
|
26707
|
+
let create = (hasExportStarsToExportValues || getESModuleInterop(compilerOptions) && hasImportStarOrImportDefault) && moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || node.impliedNodeFormat === 1 /* CommonJS */);
|
|
26724
26708
|
if (!create) {
|
|
26725
26709
|
const helpers = getEmitHelpers(node);
|
|
26726
26710
|
if (helpers) {
|
|
@@ -44129,15 +44113,13 @@ function createGetSymbolWalker(getRestTypeOfSignature, getTypePredicateOfSignatu
|
|
|
44129
44113
|
}
|
|
44130
44114
|
|
|
44131
44115
|
// src/compiler/moduleSpecifiers.ts
|
|
44132
|
-
function getModuleSpecifierPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding },
|
|
44116
|
+
function getModuleSpecifierPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding }, compilerOptions, importingSourceFile, oldImportSpecifier) {
|
|
44133
44117
|
const filePreferredEnding = getPreferredEnding();
|
|
44134
44118
|
return {
|
|
44135
44119
|
relativePreference: oldImportSpecifier !== void 0 ? isExternalModuleNameRelative(oldImportSpecifier) ? 0 /* Relative */ : 1 /* NonRelative */ : importModuleSpecifierPreference === "relative" ? 0 /* Relative */ : importModuleSpecifierPreference === "non-relative" ? 1 /* NonRelative */ : importModuleSpecifierPreference === "project-relative" ? 3 /* ExternalNonRelative */ : 2 /* Shortest */,
|
|
44136
44120
|
getAllowedEndingsInPreferredOrder: (syntaxImpliedNodeFormat) => {
|
|
44137
|
-
const
|
|
44138
|
-
|
|
44139
|
-
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
|
44140
|
-
if ((syntaxImpliedNodeFormat ?? impliedNodeFormat) === 99 /* ESNext */ && 3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */) {
|
|
44121
|
+
const preferredEnding = syntaxImpliedNodeFormat !== importingSourceFile.impliedNodeFormat ? getPreferredEnding(syntaxImpliedNodeFormat) : filePreferredEnding;
|
|
44122
|
+
if ((syntaxImpliedNodeFormat ?? importingSourceFile.impliedNodeFormat) === 99 /* ESNext */) {
|
|
44141
44123
|
if (shouldAllowImportingTsExtension(compilerOptions, importingSourceFile.fileName)) {
|
|
44142
44124
|
return [3 /* TsExtension */, 2 /* JsExtension */];
|
|
44143
44125
|
}
|
|
@@ -44168,7 +44150,7 @@ function getModuleSpecifierPreferences({ importModuleSpecifierPreference, import
|
|
|
44168
44150
|
}
|
|
44169
44151
|
return getModuleSpecifierEndingPreference(
|
|
44170
44152
|
importModuleSpecifierEnding,
|
|
44171
|
-
resolutionMode ??
|
|
44153
|
+
resolutionMode ?? importingSourceFile.impliedNodeFormat,
|
|
44172
44154
|
compilerOptions,
|
|
44173
44155
|
isFullSourceFile(importingSourceFile) ? importingSourceFile : void 0
|
|
44174
44156
|
);
|
|
@@ -44226,16 +44208,12 @@ function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions
|
|
|
44226
44208
|
}
|
|
44227
44209
|
function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
|
|
44228
44210
|
const info = getInfo(importingSourceFile.fileName, host);
|
|
44229
|
-
const preferences = getModuleSpecifierPreferences(userPreferences,
|
|
44211
|
+
const preferences = getModuleSpecifierPreferences(userPreferences, compilerOptions, importingSourceFile);
|
|
44230
44212
|
const existingSpecifier = isFullSourceFile(importingSourceFile) && forEach(modulePaths, (modulePath) => forEach(
|
|
44231
44213
|
host.getFileIncludeReasons().get(toPath(modulePath.path, host.getCurrentDirectory(), info.getCanonicalFileName)),
|
|
44232
44214
|
(reason) => {
|
|
44233
44215
|
if (reason.kind !== 3 /* Import */ || reason.file !== importingSourceFile.path) return void 0;
|
|
44234
|
-
|
|
44235
|
-
const targetMode = options.overrideImportMode ?? host.getDefaultResolutionModeForFile(importingSourceFile);
|
|
44236
|
-
if (existingMode !== targetMode && existingMode !== void 0 && targetMode !== void 0) {
|
|
44237
|
-
return void 0;
|
|
44238
|
-
}
|
|
44216
|
+
if (importingSourceFile.impliedNodeFormat && importingSourceFile.impliedNodeFormat !== getModeForResolutionAtIndex(importingSourceFile, reason.index, compilerOptions)) return void 0;
|
|
44239
44217
|
const specifier = getModuleNameStringLiteralAt(importingSourceFile, reason.index).text;
|
|
44240
44218
|
return preferences.relativePreference !== 1 /* NonRelative */ || !pathIsRelative(specifier) ? specifier : void 0;
|
|
44241
44219
|
}
|
|
@@ -44750,7 +44728,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
|
|
|
44750
44728
|
if (!parts) {
|
|
44751
44729
|
return void 0;
|
|
44752
44730
|
}
|
|
44753
|
-
const preferences = getModuleSpecifierPreferences(userPreferences,
|
|
44731
|
+
const preferences = getModuleSpecifierPreferences(userPreferences, options, importingSourceFile);
|
|
44754
44732
|
const allowedEndings = preferences.getAllowedEndingsInPreferredOrder();
|
|
44755
44733
|
let moduleSpecifier = path;
|
|
44756
44734
|
let isPackageRootPath = false;
|
|
@@ -44800,7 +44778,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
|
|
|
44800
44778
|
const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
44801
44779
|
if (isPackageJsonInfo(cachedPackageJson) || cachedPackageJson === void 0 && host.fileExists(packageJsonPath)) {
|
|
44802
44780
|
const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || tryParseJson(host.readFile(packageJsonPath));
|
|
44803
|
-
const importMode = overrideMode ||
|
|
44781
|
+
const importMode = overrideMode || importingSourceFile.impliedNodeFormat;
|
|
44804
44782
|
if (getResolvePackageJsonExports(options)) {
|
|
44805
44783
|
const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
|
|
44806
44784
|
const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
|
|
@@ -44950,9 +44928,6 @@ function getRelativePathIfInSameVolume(path, directoryPath, getCanonicalFileName
|
|
|
44950
44928
|
function isPathRelativeToParent(path) {
|
|
44951
44929
|
return startsWith(path, "..");
|
|
44952
44930
|
}
|
|
44953
|
-
function getDefaultResolutionModeForFile(file, host, compilerOptions) {
|
|
44954
|
-
return isFullSourceFile(file) ? host.getDefaultResolutionModeForFile(file) : getDefaultResolutionModeForFileWorker(file, compilerOptions);
|
|
44955
|
-
}
|
|
44956
44931
|
|
|
44957
44932
|
// src/compiler/checker.ts
|
|
44958
44933
|
var ambientModuleSymbolRegex = /^".+"$/;
|
|
@@ -47159,28 +47134,22 @@ function createTypeChecker(host) {
|
|
|
47159
47134
|
function isSyntacticDefault(node) {
|
|
47160
47135
|
return isExportAssignment(node) && !node.isExportEquals || hasSyntacticModifier(node, 2048 /* Default */) || isExportSpecifier(node) || isNamespaceExport(node);
|
|
47161
47136
|
}
|
|
47162
|
-
function
|
|
47163
|
-
return isStringLiteralLike(usage) ? host.
|
|
47137
|
+
function getUsageModeForExpression(usage) {
|
|
47138
|
+
return isStringLiteralLike(usage) ? host.getModeForUsageLocation(getSourceFileOfNode(usage), usage) : void 0;
|
|
47164
47139
|
}
|
|
47165
47140
|
function isESMFormatImportImportingCommonjsFormatFile(usageMode, targetMode) {
|
|
47166
47141
|
return usageMode === 99 /* ESNext */ && targetMode === 1 /* CommonJS */;
|
|
47167
47142
|
}
|
|
47168
|
-
function
|
|
47169
|
-
|
|
47170
|
-
|
|
47171
|
-
return usageMode === 99 /* ESNext */ && endsWith(usage.text, ".json" /* Json */);
|
|
47172
|
-
}
|
|
47173
|
-
return false;
|
|
47143
|
+
function isOnlyImportedAsDefault(usage) {
|
|
47144
|
+
const usageMode = getUsageModeForExpression(usage);
|
|
47145
|
+
return usageMode === 99 /* ESNext */ && endsWith(usage.text, ".json" /* Json */);
|
|
47174
47146
|
}
|
|
47175
47147
|
function canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, usage) {
|
|
47176
|
-
const usageMode = file &&
|
|
47177
|
-
if (file && usageMode !== void 0) {
|
|
47178
|
-
const
|
|
47179
|
-
if (usageMode === 99 /* ESNext */
|
|
47180
|
-
return
|
|
47181
|
-
}
|
|
47182
|
-
if (usageMode === 99 /* ESNext */ && targetMode === 99 /* ESNext */) {
|
|
47183
|
-
return false;
|
|
47148
|
+
const usageMode = file && getUsageModeForExpression(usage);
|
|
47149
|
+
if (file && usageMode !== void 0 && 100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
|
|
47150
|
+
const result = isESMFormatImportImportingCommonjsFormatFile(usageMode, file.impliedNodeFormat);
|
|
47151
|
+
if (usageMode === 99 /* ESNext */ || result) {
|
|
47152
|
+
return result;
|
|
47184
47153
|
}
|
|
47185
47154
|
}
|
|
47186
47155
|
if (!allowSyntheticDefaultImports) {
|
|
@@ -47239,7 +47208,7 @@ function createTypeChecker(host) {
|
|
|
47239
47208
|
if (!specifier) {
|
|
47240
47209
|
return exportDefaultSymbol;
|
|
47241
47210
|
}
|
|
47242
|
-
const hasDefaultOnly =
|
|
47211
|
+
const hasDefaultOnly = isOnlyImportedAsDefault(specifier);
|
|
47243
47212
|
const hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
|
|
47244
47213
|
if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
|
|
47245
47214
|
if (hasExportAssignmentSymbol(moduleSymbol) && !allowSyntheticDefaultImports) {
|
|
@@ -47440,7 +47409,7 @@ function createTypeChecker(host) {
|
|
|
47440
47409
|
let symbolFromModule = getExportOfModule(targetSymbol, name, specifier, dontResolveAlias);
|
|
47441
47410
|
if (symbolFromModule === void 0 && name.escapedText === "default" /* Default */) {
|
|
47442
47411
|
const file = (_a = moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
|
|
47443
|
-
if (
|
|
47412
|
+
if (isOnlyImportedAsDefault(moduleSpecifier) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
|
|
47444
47413
|
symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
|
|
47445
47414
|
}
|
|
47446
47415
|
}
|
|
@@ -48040,7 +48009,7 @@ function createTypeChecker(host) {
|
|
|
48040
48009
|
/*requireStringLiteralLikeArgument*/
|
|
48041
48010
|
true
|
|
48042
48011
|
) ? location.initializer.arguments[0] : void 0) || ((_c = findAncestor(location, isImportCall)) == null ? void 0 : _c.arguments[0]) || ((_d = findAncestor(location, isImportDeclaration)) == null ? void 0 : _d.moduleSpecifier) || ((_e = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? void 0 : _e.moduleReference.expression) || ((_f = findAncestor(location, isExportDeclaration)) == null ? void 0 : _f.moduleSpecifier);
|
|
48043
|
-
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) :
|
|
48012
|
+
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
48044
48013
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
48045
48014
|
const resolvedModule = (_g = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _g.resolvedModule;
|
|
48046
48015
|
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
@@ -48284,7 +48253,7 @@ function createTypeChecker(host) {
|
|
|
48284
48253
|
return cloneTypeAsModuleType(symbol, defaultOnlyType, referenceParent);
|
|
48285
48254
|
}
|
|
48286
48255
|
const targetFile = (_a = moduleSymbol == null ? void 0 : moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
|
|
48287
|
-
const isEsmCjsRef = targetFile && isESMFormatImportImportingCommonjsFormatFile(
|
|
48256
|
+
const isEsmCjsRef = targetFile && isESMFormatImportImportingCommonjsFormatFile(getUsageModeForExpression(reference), targetFile.impliedNodeFormat);
|
|
48288
48257
|
if (getESModuleInterop(compilerOptions) || isEsmCjsRef) {
|
|
48289
48258
|
let sigs = getSignaturesOfStructuredType(type, 0 /* Call */);
|
|
48290
48259
|
if (!sigs || !sigs.length) {
|
|
@@ -50890,10 +50859,8 @@ function createTypeChecker(host) {
|
|
|
50890
50859
|
}
|
|
50891
50860
|
return getSourceFileOfNode(getNonAugmentationDeclaration(symbol)).fileName;
|
|
50892
50861
|
}
|
|
50893
|
-
const enclosingDeclaration = getOriginalNode(context.enclosingDeclaration);
|
|
50894
|
-
const originalModuleSpecifier = canHaveModuleSpecifier(enclosingDeclaration) ? tryGetModuleSpecifierFromDeclaration(enclosingDeclaration) : void 0;
|
|
50895
50862
|
const contextFile = context.enclosingFile;
|
|
50896
|
-
const resolutionMode = overrideImportMode ||
|
|
50863
|
+
const resolutionMode = overrideImportMode || (contextFile == null ? void 0 : contextFile.impliedNodeFormat);
|
|
50897
50864
|
const cacheKey = createModeAwareCacheKey(contextFile.path, resolutionMode);
|
|
50898
50865
|
const links = getSymbolLinks(symbol);
|
|
50899
50866
|
let specifier = links.specifierCache && links.specifierCache.get(cacheKey);
|
|
@@ -51715,7 +51682,7 @@ function createTypeChecker(host) {
|
|
|
51715
51682
|
}
|
|
51716
51683
|
if (isJSDocTypeLiteral(node)) {
|
|
51717
51684
|
return factory.createTypeLiteralNode(map(node.jsDocPropertyTags, (t) => {
|
|
51718
|
-
const name = isIdentifier(t.name) ? t.name : t.name.right;
|
|
51685
|
+
const name = visitNode(isIdentifier(t.name) ? t.name : t.name.right, visitExistingNodeTreeSymbols, isIdentifier);
|
|
51719
51686
|
const typeViaParent = getTypeOfPropertyOfType(getTypeFromTypeNode2(context, node), name.escapedText);
|
|
51720
51687
|
const overrideTypeNode = typeViaParent && t.typeExpression && getTypeFromTypeNode2(context, t.typeExpression.type) !== typeViaParent ? typeToTypeNodeHelper(typeViaParent, context) : void 0;
|
|
51721
51688
|
return factory.createPropertySignature(
|
|
@@ -51759,7 +51726,7 @@ function createTypeChecker(host) {
|
|
|
51759
51726
|
void 0,
|
|
51760
51727
|
getEffectiveDotDotDotForParameter(p),
|
|
51761
51728
|
setTextRange2(context, factory.createIdentifier(getNameForJSDocFunctionParameter(p, i)), p),
|
|
51762
|
-
p.questionToken,
|
|
51729
|
+
factory.cloneNode(p.questionToken),
|
|
51763
51730
|
visitNode(p.type, visitExistingNodeTreeSymbols, isTypeNode),
|
|
51764
51731
|
/*initializer*/
|
|
51765
51732
|
void 0
|
|
@@ -51774,7 +51741,7 @@ function createTypeChecker(host) {
|
|
|
51774
51741
|
void 0,
|
|
51775
51742
|
getEffectiveDotDotDotForParameter(p),
|
|
51776
51743
|
setTextRange2(context, factory.createIdentifier(getNameForJSDocFunctionParameter(p, i)), p),
|
|
51777
|
-
p.questionToken,
|
|
51744
|
+
factory.cloneNode(p.questionToken),
|
|
51778
51745
|
visitNode(p.type, visitExistingNodeTreeSymbols, isTypeNode),
|
|
51779
51746
|
/*initializer*/
|
|
51780
51747
|
void 0
|
|
@@ -51793,7 +51760,7 @@ function createTypeChecker(host) {
|
|
|
51793
51760
|
if (isTypeParameterDeclaration(node)) {
|
|
51794
51761
|
return factory.updateTypeParameterDeclaration(
|
|
51795
51762
|
node,
|
|
51796
|
-
node.modifiers,
|
|
51763
|
+
visitNodes2(node.modifiers, visitExistingNodeTreeSymbols, isModifier),
|
|
51797
51764
|
setTextRange2(context, typeParameterToName(getDeclaredTypeOfSymbol(getSymbolOfDeclaration(node)), context), node),
|
|
51798
51765
|
visitNode(node.constraint, visitExistingNodeTreeSymbols, isTypeNode),
|
|
51799
51766
|
visitNode(node.default, visitExistingNodeTreeSymbols, isTypeNode)
|
|
@@ -51825,8 +51792,8 @@ function createTypeChecker(host) {
|
|
|
51825
51792
|
return factory.updateImportTypeNode(
|
|
51826
51793
|
node,
|
|
51827
51794
|
factory.updateLiteralTypeNode(node.argument, rewriteModuleSpecifier(node, node.argument.literal)),
|
|
51828
|
-
node.attributes,
|
|
51829
|
-
node.qualifier,
|
|
51795
|
+
visitNode(node.attributes, visitExistingNodeTreeSymbols, isImportAttributes),
|
|
51796
|
+
visitNode(node.qualifier, visitExistingNodeTreeSymbols, isEntityName),
|
|
51830
51797
|
visitNodes2(node.typeArguments, visitExistingNodeTreeSymbols, isTypeNode),
|
|
51831
51798
|
node.isTypeOf
|
|
51832
51799
|
);
|
|
@@ -51862,8 +51829,28 @@ function createTypeChecker(host) {
|
|
|
51862
51829
|
} else {
|
|
51863
51830
|
const type = getWidenedType(getRegularTypeOfExpression(node.expression));
|
|
51864
51831
|
const computedPropertyNameType = typeToTypeNodeHelper(type, context);
|
|
51865
|
-
|
|
51866
|
-
|
|
51832
|
+
let literal;
|
|
51833
|
+
if (isLiteralTypeNode(computedPropertyNameType)) {
|
|
51834
|
+
literal = computedPropertyNameType.literal;
|
|
51835
|
+
} else {
|
|
51836
|
+
const evaluated = evaluateEntityNameExpression(node.expression);
|
|
51837
|
+
const literalNode = typeof evaluated.value === "string" ? factory.createStringLiteral(
|
|
51838
|
+
evaluated.value,
|
|
51839
|
+
/*isSingleQuote*/
|
|
51840
|
+
void 0
|
|
51841
|
+
) : typeof evaluated.value === "number" ? factory.createNumericLiteral(
|
|
51842
|
+
evaluated.value,
|
|
51843
|
+
/*numericLiteralFlags*/
|
|
51844
|
+
0
|
|
51845
|
+
) : void 0;
|
|
51846
|
+
if (!literalNode) {
|
|
51847
|
+
if (isImportTypeNode(computedPropertyNameType)) {
|
|
51848
|
+
trackComputedName(node.expression, context.enclosingDeclaration, context);
|
|
51849
|
+
}
|
|
51850
|
+
return node;
|
|
51851
|
+
}
|
|
51852
|
+
literal = literalNode;
|
|
51853
|
+
}
|
|
51867
51854
|
if (literal.kind === 11 /* StringLiteral */ && isIdentifierText(literal.text, getEmitScriptTarget(compilerOptions))) {
|
|
51868
51855
|
return factory.createIdentifier(literal.text);
|
|
51869
51856
|
}
|
|
@@ -51880,9 +51867,9 @@ function createTypeChecker(host) {
|
|
|
51880
51867
|
hadError = hadError || introducesError;
|
|
51881
51868
|
parameterName = result;
|
|
51882
51869
|
} else {
|
|
51883
|
-
parameterName = node.parameterName;
|
|
51870
|
+
parameterName = factory.cloneNode(node.parameterName);
|
|
51884
51871
|
}
|
|
51885
|
-
return factory.updateTypePredicateNode(node, node.assertsModifier, parameterName, visitNode(node.type, visitExistingNodeTreeSymbols, isTypeNode));
|
|
51872
|
+
return factory.updateTypePredicateNode(node, factory.cloneNode(node.assertsModifier), parameterName, visitNode(node.type, visitExistingNodeTreeSymbols, isTypeNode));
|
|
51886
51873
|
}
|
|
51887
51874
|
if (isTupleTypeNode(node) || isTypeLiteralNode(node) || isMappedTypeNode(node)) {
|
|
51888
51875
|
const visited = visitEachChild2(node, visitExistingNodeTreeSymbols);
|
|
@@ -51973,7 +51960,7 @@ function createTypeChecker(host) {
|
|
|
51973
51960
|
/*yieldModuleSymbol*/
|
|
51974
51961
|
true
|
|
51975
51962
|
)[0];
|
|
51976
|
-
if (parentSymbol && parentSymbol
|
|
51963
|
+
if (parentSymbol && isExternalModuleSymbol(parentSymbol)) {
|
|
51977
51964
|
name = getSpecifierForModuleSymbol(parentSymbol, context);
|
|
51978
51965
|
} else {
|
|
51979
51966
|
const targetFile = getExternalModuleFileFromDeclaration(parent);
|
|
@@ -75357,7 +75344,7 @@ function createTypeChecker(host) {
|
|
|
75357
75344
|
return createAnonymousType(anonymousSymbol, memberTable, emptyArray, emptyArray, emptyArray);
|
|
75358
75345
|
}
|
|
75359
75346
|
function getTypeWithSyntheticDefaultOnly(type, symbol, originalSymbol, moduleSpecifier) {
|
|
75360
|
-
const hasDefaultOnly =
|
|
75347
|
+
const hasDefaultOnly = isOnlyImportedAsDefault(moduleSpecifier);
|
|
75361
75348
|
if (hasDefaultOnly && type && !isErrorType(type)) {
|
|
75362
75349
|
const synthType = type;
|
|
75363
75350
|
if (!synthType.defaultOnlyType) {
|
|
@@ -80584,7 +80571,7 @@ function createTypeChecker(host) {
|
|
|
80584
80571
|
});
|
|
80585
80572
|
}
|
|
80586
80573
|
function checkCollisionWithRequireExportsInGeneratedCode(node, name) {
|
|
80587
|
-
if (
|
|
80574
|
+
if (moduleKind >= 5 /* ES2015 */ && !(moduleKind >= 100 /* Node16 */ && getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
|
|
80588
80575
|
return;
|
|
80589
80576
|
}
|
|
80590
80577
|
if (!name || !needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) {
|
|
@@ -82005,7 +81992,7 @@ function createTypeChecker(host) {
|
|
|
82005
81992
|
}
|
|
82006
81993
|
}
|
|
82007
81994
|
function checkClassNameCollisionWithObject(name) {
|
|
82008
|
-
if (languageVersion >= 1 /* ES5 */ && name.escapedText === "Object" &&
|
|
81995
|
+
if (languageVersion >= 1 /* ES5 */ && name.escapedText === "Object" && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(name).impliedNodeFormat === 1 /* CommonJS */)) {
|
|
82009
81996
|
error(name, Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_with_module_0, ModuleKind[moduleKind]);
|
|
82010
81997
|
}
|
|
82011
81998
|
}
|
|
@@ -83086,7 +83073,7 @@ function createTypeChecker(host) {
|
|
|
83086
83073
|
getNodeLinks(node).flags |= 2048 /* LexicalModuleMergesWithClass */;
|
|
83087
83074
|
}
|
|
83088
83075
|
}
|
|
83089
|
-
if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 307 /* SourceFile */ &&
|
|
83076
|
+
if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 307 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || node.parent.impliedNodeFormat === 1 /* CommonJS */)) {
|
|
83090
83077
|
const exportModifier = (_b = node.modifiers) == null ? void 0 : _b.find((m) => m.kind === 95 /* ExportKeyword */);
|
|
83091
83078
|
if (exportModifier) {
|
|
83092
83079
|
error(exportModifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
@@ -83296,10 +83283,8 @@ function createTypeChecker(host) {
|
|
|
83296
83283
|
}
|
|
83297
83284
|
}
|
|
83298
83285
|
}
|
|
83299
|
-
if (compilerOptions.verbatimModuleSyntax && node.kind !== 271 /* ImportEqualsDeclaration */ && !isInJSFile(node) &&
|
|
83286
|
+
if (compilerOptions.verbatimModuleSyntax && node.kind !== 271 /* ImportEqualsDeclaration */ && !isInJSFile(node) && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
|
|
83300
83287
|
error(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
83301
|
-
} else if (moduleKind === 200 /* Preserve */ && node.kind !== 271 /* ImportEqualsDeclaration */ && node.kind !== 260 /* VariableDeclaration */ && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
|
|
83302
|
-
error(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve);
|
|
83303
83288
|
}
|
|
83304
83289
|
}
|
|
83305
83290
|
if (isImportSpecifier(node)) {
|
|
@@ -83338,7 +83323,7 @@ function createTypeChecker(host) {
|
|
|
83338
83323
|
function checkImportBinding(node) {
|
|
83339
83324
|
checkCollisionsForDeclarationName(node, node.name);
|
|
83340
83325
|
checkAliasSymbol(node);
|
|
83341
|
-
if (node.kind === 276 /* ImportSpecifier */ && idText(node.propertyName || node.name) === "default" && getESModuleInterop(compilerOptions) &&
|
|
83326
|
+
if (node.kind === 276 /* ImportSpecifier */ && idText(node.propertyName || node.name) === "default" && getESModuleInterop(compilerOptions) && moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
|
|
83342
83327
|
checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
|
|
83343
83328
|
}
|
|
83344
83329
|
}
|
|
@@ -83359,7 +83344,7 @@ function createTypeChecker(host) {
|
|
|
83359
83344
|
if (validForTypeAttributes && override) {
|
|
83360
83345
|
return;
|
|
83361
83346
|
}
|
|
83362
|
-
const mode = moduleKind === 199 /* NodeNext */ && declaration.moduleSpecifier &&
|
|
83347
|
+
const mode = moduleKind === 199 /* NodeNext */ && declaration.moduleSpecifier && getUsageModeForExpression(declaration.moduleSpecifier);
|
|
83363
83348
|
if (mode !== 99 /* ESNext */ && moduleKind !== 99 /* ESNext */ && moduleKind !== 200 /* Preserve */) {
|
|
83364
83349
|
const message = isImportAttributes2 ? moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve : moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_assertions_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve;
|
|
83365
83350
|
return grammarErrorOnNode(node, message);
|
|
@@ -83392,7 +83377,7 @@ function createTypeChecker(host) {
|
|
|
83392
83377
|
if (importClause.namedBindings) {
|
|
83393
83378
|
if (importClause.namedBindings.kind === 274 /* NamespaceImport */) {
|
|
83394
83379
|
checkImportBinding(importClause.namedBindings);
|
|
83395
|
-
if (
|
|
83380
|
+
if (moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */) && getESModuleInterop(compilerOptions)) {
|
|
83396
83381
|
checkExternalEmitHelpers(node, 65536 /* ImportStar */);
|
|
83397
83382
|
}
|
|
83398
83383
|
} else {
|
|
@@ -83432,7 +83417,7 @@ function createTypeChecker(host) {
|
|
|
83432
83417
|
grammarErrorOnNode(node, Diagnostics.An_import_alias_cannot_use_import_type);
|
|
83433
83418
|
}
|
|
83434
83419
|
} else {
|
|
83435
|
-
if (5 /* ES2015 */
|
|
83420
|
+
if (moduleKind >= 5 /* ES2015 */ && moduleKind !== 200 /* Preserve */ && getSourceFileOfNode(node).impliedNodeFormat === void 0 && !node.isTypeOnly && !(node.flags & 33554432 /* Ambient */)) {
|
|
83436
83421
|
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);
|
|
83437
83422
|
}
|
|
83438
83423
|
}
|
|
@@ -83461,7 +83446,7 @@ function createTypeChecker(host) {
|
|
|
83461
83446
|
} else if (node.exportClause) {
|
|
83462
83447
|
checkAliasSymbol(node.exportClause);
|
|
83463
83448
|
}
|
|
83464
|
-
if (
|
|
83449
|
+
if (moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
|
|
83465
83450
|
if (node.exportClause) {
|
|
83466
83451
|
if (getESModuleInterop(compilerOptions)) {
|
|
83467
83452
|
checkExternalEmitHelpers(node, 65536 /* ImportStar */);
|
|
@@ -83514,7 +83499,7 @@ function createTypeChecker(host) {
|
|
|
83514
83499
|
markLinkedReferences(node, 7 /* ExportSpecifier */);
|
|
83515
83500
|
}
|
|
83516
83501
|
} else {
|
|
83517
|
-
if (getESModuleInterop(compilerOptions) &&
|
|
83502
|
+
if (getESModuleInterop(compilerOptions) && moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */) && idText(node.propertyName || node.name) === "default") {
|
|
83518
83503
|
checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
|
|
83519
83504
|
}
|
|
83520
83505
|
}
|
|
@@ -83540,7 +83525,7 @@ function createTypeChecker(host) {
|
|
|
83540
83525
|
if (typeAnnotationNode) {
|
|
83541
83526
|
checkTypeAssignableTo(checkExpressionCached(node.expression), getTypeFromTypeNode(typeAnnotationNode), node.expression);
|
|
83542
83527
|
}
|
|
83543
|
-
const isIllegalExportDefaultInCJS = !node.isExportEquals && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax &&
|
|
83528
|
+
const isIllegalExportDefaultInCJS = !node.isExportEquals && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */);
|
|
83544
83529
|
if (node.expression.kind === 80 /* Identifier */) {
|
|
83545
83530
|
const id = node.expression;
|
|
83546
83531
|
const sym = getExportSymbolOfValueSymbolIfExported(resolveEntityName(
|
|
@@ -83620,7 +83605,7 @@ function createTypeChecker(host) {
|
|
|
83620
83605
|
grammarErrorOnNode(node.expression, Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context);
|
|
83621
83606
|
}
|
|
83622
83607
|
if (node.isExportEquals) {
|
|
83623
|
-
if (moduleKind >= 5 /* ES2015 */ && moduleKind !== 200 /* Preserve */ && (node.flags & 33554432 /* Ambient */ &&
|
|
83608
|
+
if (moduleKind >= 5 /* ES2015 */ && moduleKind !== 200 /* Preserve */ && (node.flags & 33554432 /* Ambient */ && getSourceFileOfNode(node).impliedNodeFormat === 99 /* ESNext */ || !(node.flags & 33554432 /* Ambient */) && getSourceFileOfNode(node).impliedNodeFormat !== 1 /* CommonJS */)) {
|
|
83624
83609
|
grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
|
|
83625
83610
|
} else if (moduleKind === 4 /* System */ && !(node.flags & 33554432 /* Ambient */)) {
|
|
83626
83611
|
grammarErrorOnNode(node, Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system);
|
|
@@ -86118,7 +86103,7 @@ function createTypeChecker(host) {
|
|
|
86118
86103
|
break;
|
|
86119
86104
|
case 95 /* ExportKeyword */:
|
|
86120
86105
|
if (compilerOptions.verbatimModuleSyntax && !(node.flags & 33554432 /* Ambient */) && node.kind !== 265 /* TypeAliasDeclaration */ && node.kind !== 264 /* InterfaceDeclaration */ && // ModuleDeclaration needs to be checked that it is uninstantiated later
|
|
86121
|
-
node.kind !== 267 /* ModuleDeclaration */ && node.parent.kind === 307 /* SourceFile */ &&
|
|
86106
|
+
node.kind !== 267 /* ModuleDeclaration */ && node.parent.kind === 307 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
|
|
86122
86107
|
return grammarErrorOnNode(modifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
86123
86108
|
}
|
|
86124
86109
|
if (flags & 32 /* Export */) {
|
|
@@ -87027,7 +87012,7 @@ function createTypeChecker(host) {
|
|
|
87027
87012
|
const message = node.initializer ? Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions : !node.type ? Diagnostics.Declarations_with_definite_assignment_assertions_must_also_have_type_annotations : Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context;
|
|
87028
87013
|
return grammarErrorOnNode(node.exclamationToken, message);
|
|
87029
87014
|
}
|
|
87030
|
-
if (
|
|
87015
|
+
if ((moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */) && moduleKind !== 4 /* System */ && !(node.parent.parent.flags & 33554432 /* Ambient */) && hasSyntacticModifier(node.parent.parent, 32 /* Export */)) {
|
|
87031
87016
|
checkESModuleMarker(node.name);
|
|
87032
87017
|
}
|
|
87033
87018
|
return !!blockScopeKind && checkGrammarNameInLetOrConstDeclarations(node.name);
|
|
@@ -87528,9 +87513,7 @@ function createBasicNodeBuilderModuleSpecifierResolutionHost(host) {
|
|
|
87528
87513
|
isSourceOfProjectReferenceRedirect: (fileName) => host.isSourceOfProjectReferenceRedirect(fileName),
|
|
87529
87514
|
fileExists: (fileName) => host.fileExists(fileName),
|
|
87530
87515
|
getFileIncludeReasons: () => host.getFileIncludeReasons(),
|
|
87531
|
-
readFile: host.readFile ? (fileName) => host.readFile(fileName) : void 0
|
|
87532
|
-
getDefaultResolutionModeForFile: (file) => host.getDefaultResolutionModeForFile(file),
|
|
87533
|
-
getModeForResolutionAtIndex: (file, index) => host.getModeForResolutionAtIndex(file, index)
|
|
87516
|
+
readFile: host.readFile ? (fileName) => host.readFile(fileName) : void 0
|
|
87534
87517
|
};
|
|
87535
87518
|
}
|
|
87536
87519
|
var SymbolTrackerImpl = class _SymbolTrackerImpl {
|
|
@@ -107195,7 +107178,7 @@ function transformModule(context) {
|
|
|
107195
107178
|
case 354 /* PartiallyEmittedExpression */:
|
|
107196
107179
|
return visitPartiallyEmittedExpression(node, valueIsDiscarded);
|
|
107197
107180
|
case 213 /* CallExpression */:
|
|
107198
|
-
if (isImportCall(node) &&
|
|
107181
|
+
if (isImportCall(node) && currentSourceFile.impliedNodeFormat === void 0) {
|
|
107199
107182
|
return visitImportCallExpression(node);
|
|
107200
107183
|
}
|
|
107201
107184
|
break;
|
|
@@ -110190,8 +110173,8 @@ function transformECMAScriptModule(context) {
|
|
|
110190
110173
|
}
|
|
110191
110174
|
}
|
|
110192
110175
|
|
|
110193
|
-
// src/compiler/transformers/module/
|
|
110194
|
-
function
|
|
110176
|
+
// src/compiler/transformers/module/node.ts
|
|
110177
|
+
function transformNodeModule(context) {
|
|
110195
110178
|
const previousOnSubstituteNode = context.onSubstituteNode;
|
|
110196
110179
|
const previousOnEmitNode = context.onEmitNode;
|
|
110197
110180
|
const esmTransform = transformECMAScriptModule(context);
|
|
@@ -110202,7 +110185,6 @@ function transformImpliedNodeFormatDependentModule(context) {
|
|
|
110202
110185
|
const cjsTransform = transformModule(context);
|
|
110203
110186
|
const cjsOnSubstituteNode = context.onSubstituteNode;
|
|
110204
110187
|
const cjsOnEmitNode = context.onEmitNode;
|
|
110205
|
-
const getEmitModuleFormatOfFile = (file) => context.getEmitHost().getEmitModuleFormatOfFile(file);
|
|
110206
110188
|
context.onSubstituteNode = onSubstituteNode;
|
|
110207
110189
|
context.onEmitNode = onEmitNode;
|
|
110208
110190
|
context.enableSubstitution(307 /* SourceFile */);
|
|
@@ -110217,7 +110199,7 @@ function transformImpliedNodeFormatDependentModule(context) {
|
|
|
110217
110199
|
if (!currentSourceFile) {
|
|
110218
110200
|
return previousOnSubstituteNode(hint, node);
|
|
110219
110201
|
}
|
|
110220
|
-
if (
|
|
110202
|
+
if (currentSourceFile.impliedNodeFormat === 99 /* ESNext */) {
|
|
110221
110203
|
return esmOnSubstituteNode(hint, node);
|
|
110222
110204
|
}
|
|
110223
110205
|
return cjsOnSubstituteNode(hint, node);
|
|
@@ -110230,13 +110212,13 @@ function transformImpliedNodeFormatDependentModule(context) {
|
|
|
110230
110212
|
if (!currentSourceFile) {
|
|
110231
110213
|
return previousOnEmitNode(hint, node, emitCallback);
|
|
110232
110214
|
}
|
|
110233
|
-
if (
|
|
110215
|
+
if (currentSourceFile.impliedNodeFormat === 99 /* ESNext */) {
|
|
110234
110216
|
return esmOnEmitNode(hint, node, emitCallback);
|
|
110235
110217
|
}
|
|
110236
110218
|
return cjsOnEmitNode(hint, node, emitCallback);
|
|
110237
110219
|
}
|
|
110238
110220
|
function getModuleTransformForFile(file) {
|
|
110239
|
-
return
|
|
110221
|
+
return file.impliedNodeFormat === 99 /* ESNext */ ? esmTransform : cjsTransform;
|
|
110240
110222
|
}
|
|
110241
110223
|
function transformSourceFile(node) {
|
|
110242
110224
|
if (node.isDeclarationFile) {
|
|
@@ -112356,18 +112338,17 @@ function isProcessedComponent(node) {
|
|
|
112356
112338
|
// src/compiler/transformer.ts
|
|
112357
112339
|
function getModuleTransformer(moduleKind) {
|
|
112358
112340
|
switch (moduleKind) {
|
|
112359
|
-
case 200 /* Preserve */:
|
|
112360
|
-
return transformECMAScriptModule;
|
|
112361
112341
|
case 99 /* ESNext */:
|
|
112362
112342
|
case 7 /* ES2022 */:
|
|
112363
112343
|
case 6 /* ES2020 */:
|
|
112364
112344
|
case 5 /* ES2015 */:
|
|
112365
|
-
case
|
|
112366
|
-
|
|
112367
|
-
case 1 /* CommonJS */:
|
|
112368
|
-
return transformImpliedNodeFormatDependentModule;
|
|
112345
|
+
case 200 /* Preserve */:
|
|
112346
|
+
return transformECMAScriptModule;
|
|
112369
112347
|
case 4 /* System */:
|
|
112370
112348
|
return transformSystemModule;
|
|
112349
|
+
case 100 /* Node16 */:
|
|
112350
|
+
case 199 /* NodeNext */:
|
|
112351
|
+
return transformNodeModule;
|
|
112371
112352
|
default:
|
|
112372
112353
|
return transformModule;
|
|
112373
112354
|
}
|
|
@@ -113086,7 +113067,6 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
113086
113067
|
newLine: compilerOptions.newLine,
|
|
113087
113068
|
noEmitHelpers: compilerOptions.noEmitHelpers,
|
|
113088
113069
|
module: getEmitModuleKind(compilerOptions),
|
|
113089
|
-
moduleResolution: getEmitModuleResolutionKind(compilerOptions),
|
|
113090
113070
|
target: getEmitScriptTarget(compilerOptions),
|
|
113091
113071
|
sourceMap: compilerOptions.sourceMap,
|
|
113092
113072
|
inlineSourceMap: compilerOptions.inlineSourceMap,
|
|
@@ -113149,7 +113129,6 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
113149
113129
|
newLine: compilerOptions.newLine,
|
|
113150
113130
|
noEmitHelpers: true,
|
|
113151
113131
|
module: compilerOptions.module,
|
|
113152
|
-
moduleResolution: compilerOptions.moduleResolution,
|
|
113153
113132
|
target: compilerOptions.target,
|
|
113154
113133
|
sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
|
|
113155
113134
|
inlineSourceMap: compilerOptions.inlineSourceMap,
|
|
@@ -118607,6 +118586,9 @@ function flattenDiagnosticMessageText(diag2, newLine, indent2 = 0) {
|
|
|
118607
118586
|
function getModeForFileReference(ref, containingFileMode) {
|
|
118608
118587
|
return (isString(ref) ? containingFileMode : ref.resolutionMode) || containingFileMode;
|
|
118609
118588
|
}
|
|
118589
|
+
function getModeForResolutionAtIndex(file, index, compilerOptions) {
|
|
118590
|
+
return getModeForUsageLocationWorker(file, getModuleNameStringLiteralAt(file, index), compilerOptions);
|
|
118591
|
+
}
|
|
118610
118592
|
function isExclusivelyTypeOnlyImportOrExport(decl) {
|
|
118611
118593
|
var _a;
|
|
118612
118594
|
if (isExportDeclaration(decl)) {
|
|
@@ -118621,6 +118603,7 @@ function getModeForUsageLocation(file, usage, compilerOptions) {
|
|
|
118621
118603
|
return getModeForUsageLocationWorker(file, usage, compilerOptions);
|
|
118622
118604
|
}
|
|
118623
118605
|
function getModeForUsageLocationWorker(file, usage, compilerOptions) {
|
|
118606
|
+
var _a;
|
|
118624
118607
|
if (isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent)) {
|
|
118625
118608
|
const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(usage.parent);
|
|
118626
118609
|
if (isTypeOnly) {
|
|
@@ -118636,28 +118619,19 @@ function getModeForUsageLocationWorker(file, usage, compilerOptions) {
|
|
|
118636
118619
|
return override;
|
|
118637
118620
|
}
|
|
118638
118621
|
}
|
|
118639
|
-
if (compilerOptions &&
|
|
118640
|
-
return
|
|
118622
|
+
if (compilerOptions && getEmitModuleKind(compilerOptions) === 200 /* Preserve */) {
|
|
118623
|
+
return usage.parent.parent && isImportEqualsDeclaration(usage.parent.parent) || isRequireCall(
|
|
118624
|
+
usage.parent,
|
|
118625
|
+
/*requireStringLiteralLikeArgument*/
|
|
118626
|
+
false
|
|
118627
|
+
) ? 1 /* CommonJS */ : 99 /* ESNext */;
|
|
118641
118628
|
}
|
|
118642
|
-
|
|
118643
|
-
|
|
118644
|
-
|
|
118645
|
-
if (!compilerOptions) {
|
|
118646
|
-
return void 0;
|
|
118629
|
+
if (file.impliedNodeFormat === void 0) return void 0;
|
|
118630
|
+
if (file.impliedNodeFormat !== 99 /* ESNext */) {
|
|
118631
|
+
return isImportCall(walkUpParenthesizedExpressions(usage.parent)) ? 99 /* ESNext */ : 1 /* CommonJS */;
|
|
118647
118632
|
}
|
|
118648
118633
|
const exprParentParent = (_a = walkUpParenthesizedExpressions(usage.parent)) == null ? void 0 : _a.parent;
|
|
118649
|
-
|
|
118650
|
-
usage.parent,
|
|
118651
|
-
/*requireStringLiteralLikeArgument*/
|
|
118652
|
-
false
|
|
118653
|
-
)) {
|
|
118654
|
-
return 1 /* CommonJS */;
|
|
118655
|
-
}
|
|
118656
|
-
if (isImportCall(walkUpParenthesizedExpressions(usage.parent))) {
|
|
118657
|
-
return shouldTransformImportCallWorker(file, compilerOptions) ? 1 /* CommonJS */ : 99 /* ESNext */;
|
|
118658
|
-
}
|
|
118659
|
-
const fileEmitMode = getEmitModuleFormatOfFileWorker(file, compilerOptions);
|
|
118660
|
-
return fileEmitMode === 1 /* CommonJS */ ? 1 /* CommonJS */ : emitModuleKindIsNonNodeESM(fileEmitMode) || fileEmitMode === 200 /* Preserve */ ? 99 /* ESNext */ : void 0;
|
|
118634
|
+
return exprParentParent && isImportEqualsDeclaration(exprParentParent) ? 1 /* CommonJS */ : 99 /* ESNext */;
|
|
118661
118635
|
}
|
|
118662
118636
|
function getResolutionModeOverride(node, grammarErrorOnNode) {
|
|
118663
118637
|
if (!node) return void 0;
|
|
@@ -118714,7 +118688,7 @@ function getTypeReferenceResolutionName(entry) {
|
|
|
118714
118688
|
}
|
|
118715
118689
|
var typeReferenceResolutionNameAndModeGetter = {
|
|
118716
118690
|
getName: getTypeReferenceResolutionName,
|
|
118717
|
-
getMode: (entry, file
|
|
118691
|
+
getMode: (entry, file) => getModeForFileReference(entry, file == null ? void 0 : file.impliedNodeFormat)
|
|
118718
118692
|
};
|
|
118719
118693
|
function createTypeReferenceResolutionLoader(containingFile, redirectedReference, options, host, cache) {
|
|
118720
118694
|
return {
|
|
@@ -118884,7 +118858,13 @@ function getConfigFileParsingDiagnostics(configFileParseResult) {
|
|
|
118884
118858
|
return configFileParseResult.options.configFile ? [...configFileParseResult.options.configFile.parseDiagnostics, ...configFileParseResult.errors] : configFileParseResult.errors;
|
|
118885
118859
|
}
|
|
118886
118860
|
function getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host, options) {
|
|
118887
|
-
|
|
118861
|
+
switch (getEmitModuleResolutionKind(options)) {
|
|
118862
|
+
case 3 /* Node16 */:
|
|
118863
|
+
case 99 /* NodeNext */:
|
|
118864
|
+
return fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".mjs" /* Mjs */]) ? 99 /* ESNext */ : fileExtensionIsOneOf(fileName, [".d.cts" /* Dcts */, ".cts" /* Cts */, ".cjs" /* Cjs */]) ? 1 /* CommonJS */ : fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */]) ? lookupFromPackageJson() : void 0;
|
|
118865
|
+
default:
|
|
118866
|
+
return void 0;
|
|
118867
|
+
}
|
|
118888
118868
|
function lookupFromPackageJson() {
|
|
118889
118869
|
const state = getTemporaryModuleResolutionState(packageJsonInfoCache, host, options);
|
|
118890
118870
|
const packageJsonLocations = [];
|
|
@@ -119343,8 +119323,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119343
119323
|
isSourceFileFromExternalLibrary,
|
|
119344
119324
|
isSourceFileDefaultLibrary,
|
|
119345
119325
|
getModeForUsageLocation: getModeForUsageLocation2,
|
|
119346
|
-
|
|
119347
|
-
getModeForResolutionAtIndex,
|
|
119326
|
+
getModeForResolutionAtIndex: getModeForResolutionAtIndex2,
|
|
119348
119327
|
getSourceFileFromReference,
|
|
119349
119328
|
getLibFileFromReference,
|
|
119350
119329
|
sourceFileToPackageName,
|
|
@@ -119372,11 +119351,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119372
119351
|
forEachResolvedProjectReference: forEachResolvedProjectReference2,
|
|
119373
119352
|
isSourceOfProjectReferenceRedirect,
|
|
119374
119353
|
getRedirectReferenceForResolutionFromSourceOfProject,
|
|
119375
|
-
getCompilerOptionsForFile,
|
|
119376
|
-
getDefaultResolutionModeForFile: getDefaultResolutionModeForFile2,
|
|
119377
|
-
getEmitModuleFormatOfFile,
|
|
119378
|
-
getImpliedNodeFormatForEmit,
|
|
119379
|
-
shouldTransformImportCall,
|
|
119380
119354
|
emitBuildInfo,
|
|
119381
119355
|
fileExists,
|
|
119382
119356
|
readFile,
|
|
@@ -119959,10 +119933,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119959
119933
|
getSymlinkCache,
|
|
119960
119934
|
writeFile: writeFileCallback || writeFile2,
|
|
119961
119935
|
isEmitBlocked,
|
|
119962
|
-
shouldTransformImportCall,
|
|
119963
|
-
getEmitModuleFormatOfFile,
|
|
119964
|
-
getDefaultResolutionModeForFile: getDefaultResolutionModeForFile2,
|
|
119965
|
-
getModeForResolutionAtIndex,
|
|
119966
119936
|
readFile: (f) => host.readFile(f),
|
|
119967
119937
|
fileExists: (f) => {
|
|
119968
119938
|
const path = toPath3(f);
|
|
@@ -121012,14 +120982,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121012
120982
|
const resolvedTypeReferenceDirective = resolutions[index];
|
|
121013
120983
|
const fileName = ref.fileName;
|
|
121014
120984
|
resolutionsInFile.set(fileName, getModeForFileReference(ref, file.impliedNodeFormat), resolvedTypeReferenceDirective);
|
|
121015
|
-
const mode = ref.resolutionMode ||
|
|
120985
|
+
const mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
121016
120986
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: 5 /* TypeReferenceDirective */, file: file.path, index });
|
|
121017
120987
|
}
|
|
121018
120988
|
}
|
|
121019
|
-
function getCompilerOptionsForFile(file) {
|
|
121020
|
-
var _a2;
|
|
121021
|
-
return ((_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options) || options;
|
|
121022
|
-
}
|
|
121023
120989
|
function processTypeReferenceDirective(typeReferenceDirective, mode, resolution, reason) {
|
|
121024
120990
|
var _a2, _b2;
|
|
121025
120991
|
(_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Program, "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!resolution.resolvedTypeReferenceDirective, refKind: reason.kind, refPath: isReferencedFile(reason) ? reason.file : void 0 });
|
|
@@ -121120,12 +121086,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121120
121086
|
return host.getCanonicalFileName(fileName);
|
|
121121
121087
|
}
|
|
121122
121088
|
function processImportedModules(file) {
|
|
121089
|
+
var _a2;
|
|
121123
121090
|
collectExternalModuleReferences(file);
|
|
121124
121091
|
if (file.imports.length || file.moduleAugmentations.length) {
|
|
121125
121092
|
const moduleNames = getModuleNames(file);
|
|
121126
121093
|
const resolutions = (resolvedModulesProcessing == null ? void 0 : resolvedModulesProcessing.get(file.path)) || resolveModuleNamesReusingOldState(moduleNames, file);
|
|
121127
121094
|
Debug.assert(resolutions.length === moduleNames.length);
|
|
121128
|
-
const optionsForFile =
|
|
121095
|
+
const optionsForFile = ((_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options) || options;
|
|
121129
121096
|
const resolutionsInFile = createModeAwareCache();
|
|
121130
121097
|
(resolvedModules ?? (resolvedModules = /* @__PURE__ */ new Map())).set(file.path, resolutionsInFile);
|
|
121131
121098
|
for (let index = 0; index < moduleNames.length; index++) {
|
|
@@ -121681,7 +121648,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121681
121648
|
redirectInfo = cachedChain.redirectInfo;
|
|
121682
121649
|
} else {
|
|
121683
121650
|
reasons == null ? void 0 : reasons.forEach(processReason);
|
|
121684
|
-
redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file
|
|
121651
|
+
redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file);
|
|
121685
121652
|
}
|
|
121686
121653
|
if (fileProcessingReason) processReason(fileProcessingReason);
|
|
121687
121654
|
const processedExtraReason = (seenReasons == null ? void 0 : seenReasons.size) !== (reasons == null ? void 0 : reasons.length);
|
|
@@ -122039,53 +122006,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
122039
122006
|
return symlinks;
|
|
122040
122007
|
}
|
|
122041
122008
|
function getModeForUsageLocation2(file, usage) {
|
|
122042
|
-
|
|
122043
|
-
|
|
122044
|
-
|
|
122045
|
-
return getEmitSyntaxForUsageLocationWorker(file, usage, getCompilerOptionsForFile(file));
|
|
122009
|
+
var _a2;
|
|
122010
|
+
const optionsForFile = ((_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options) || options;
|
|
122011
|
+
return getModeForUsageLocationWorker(file, usage, optionsForFile);
|
|
122046
122012
|
}
|
|
122047
|
-
function
|
|
122013
|
+
function getModeForResolutionAtIndex2(file, index) {
|
|
122048
122014
|
return getModeForUsageLocation2(file, getModuleNameStringLiteralAt(file, index));
|
|
122049
122015
|
}
|
|
122050
|
-
function getDefaultResolutionModeForFile2(sourceFile) {
|
|
122051
|
-
return getDefaultResolutionModeForFileWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
|
|
122052
|
-
}
|
|
122053
|
-
function getImpliedNodeFormatForEmit(sourceFile) {
|
|
122054
|
-
return getImpliedNodeFormatForEmitWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
|
|
122055
|
-
}
|
|
122056
|
-
function getEmitModuleFormatOfFile(sourceFile) {
|
|
122057
|
-
return getEmitModuleFormatOfFileWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
|
|
122058
|
-
}
|
|
122059
|
-
function shouldTransformImportCall(sourceFile) {
|
|
122060
|
-
return shouldTransformImportCallWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
|
|
122061
|
-
}
|
|
122062
|
-
}
|
|
122063
|
-
function shouldTransformImportCallWorker(sourceFile, options) {
|
|
122064
|
-
const moduleKind = getEmitModuleKind(options);
|
|
122065
|
-
if (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */ || moduleKind === 200 /* Preserve */) {
|
|
122066
|
-
return false;
|
|
122067
|
-
}
|
|
122068
|
-
return getEmitModuleFormatOfFileWorker(sourceFile, options) < 5 /* ES2015 */;
|
|
122069
|
-
}
|
|
122070
|
-
function getEmitModuleFormatOfFileWorker(sourceFile, options) {
|
|
122071
|
-
return getImpliedNodeFormatForEmitWorker(sourceFile, options) ?? getEmitModuleKind(options);
|
|
122072
|
-
}
|
|
122073
|
-
function getImpliedNodeFormatForEmitWorker(sourceFile, options) {
|
|
122074
|
-
var _a, _b;
|
|
122075
|
-
const moduleKind = getEmitModuleKind(options);
|
|
122076
|
-
if (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
|
|
122077
|
-
return sourceFile.impliedNodeFormat;
|
|
122078
|
-
}
|
|
122079
|
-
if (sourceFile.impliedNodeFormat === 1 /* CommonJS */ && (((_a = sourceFile.packageJsonScope) == null ? void 0 : _a.contents.packageJsonContent.type) === "commonjs" || fileExtensionIsOneOf(sourceFile.fileName, [".cjs" /* Cjs */, ".cts" /* Cts */]))) {
|
|
122080
|
-
return 1 /* CommonJS */;
|
|
122081
|
-
}
|
|
122082
|
-
if (sourceFile.impliedNodeFormat === 99 /* ESNext */ && (((_b = sourceFile.packageJsonScope) == null ? void 0 : _b.contents.packageJsonContent.type) === "module" || fileExtensionIsOneOf(sourceFile.fileName, [".mjs" /* Mjs */, ".mts" /* Mts */]))) {
|
|
122083
|
-
return 99 /* ESNext */;
|
|
122084
|
-
}
|
|
122085
|
-
return void 0;
|
|
122086
|
-
}
|
|
122087
|
-
function getDefaultResolutionModeForFileWorker(sourceFile, options) {
|
|
122088
|
-
return importSyntaxAffectsModuleResolution(options) ? getImpliedNodeFormatForEmitWorker(sourceFile, options) : void 0;
|
|
122089
122016
|
}
|
|
122090
122017
|
function updateHostForUseSourceOfProjectReferenceRedirect(host) {
|
|
122091
122018
|
let setOfDeclarationDirectories;
|
|
@@ -125269,10 +125196,10 @@ function explainFiles(program, write) {
|
|
|
125269
125196
|
for (const file of program.getSourceFiles()) {
|
|
125270
125197
|
write(`${toFileName(file, relativeFileName)}`);
|
|
125271
125198
|
(_a = reasons.get(file.path)) == null ? void 0 : _a.forEach((reason) => write(` ${fileIncludeReasonToDiagnostics(program, reason, relativeFileName).messageText}`));
|
|
125272
|
-
(_b = explainIfFileIsRedirectAndImpliedFormat(file,
|
|
125199
|
+
(_b = explainIfFileIsRedirectAndImpliedFormat(file, relativeFileName)) == null ? void 0 : _b.forEach((d) => write(` ${d.messageText}`));
|
|
125273
125200
|
}
|
|
125274
125201
|
}
|
|
125275
|
-
function explainIfFileIsRedirectAndImpliedFormat(file,
|
|
125202
|
+
function explainIfFileIsRedirectAndImpliedFormat(file, fileNameConvertor) {
|
|
125276
125203
|
var _a;
|
|
125277
125204
|
let result;
|
|
125278
125205
|
if (file.path !== file.resolvedPath) {
|
|
@@ -125292,7 +125219,7 @@ function explainIfFileIsRedirectAndImpliedFormat(file, options, fileNameConverto
|
|
|
125292
125219
|
));
|
|
125293
125220
|
}
|
|
125294
125221
|
if (isExternalOrCommonJsModule(file)) {
|
|
125295
|
-
switch (
|
|
125222
|
+
switch (file.impliedNodeFormat) {
|
|
125296
125223
|
case 99 /* ESNext */:
|
|
125297
125224
|
if (file.packageJsonScope) {
|
|
125298
125225
|
(result ?? (result = [])).push(chainDiagnosticMessages(
|