@typescript-deploys/pr-build 5.6.0-pr-59285-2 → 5.6.0-pr-59352-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/lib.dom.d.ts +349 -858
- package/lib/lib.dom.iterable.d.ts +2 -6
- package/lib/lib.es2023.array.d.ts +5 -5
- package/lib/lib.webworker.d.ts +79 -100
- package/lib/lib.webworker.iterable.d.ts +1 -5
- package/lib/tsc.js +333 -179
- package/lib/typescript.d.ts +89 -22
- package/lib/typescript.js +523 -314
- package/package.json +15 -14
package/lib/typescript.js
CHANGED
|
@@ -248,6 +248,7 @@ __export(typescript_exports, {
|
|
|
248
248
|
canHaveJSDoc: () => canHaveJSDoc,
|
|
249
249
|
canHaveLocals: () => canHaveLocals,
|
|
250
250
|
canHaveModifiers: () => canHaveModifiers,
|
|
251
|
+
canHaveModuleSpecifier: () => canHaveModuleSpecifier,
|
|
251
252
|
canHaveSymbol: () => canHaveSymbol,
|
|
252
253
|
canIncludeBindAndCheckDiagnostics: () => canIncludeBindAndCheckDiagnostics,
|
|
253
254
|
canJsonReportNoInputFiles: () => canJsonReportNoInputFiles,
|
|
@@ -410,6 +411,7 @@ __export(typescript_exports, {
|
|
|
410
411
|
createMemberAccessForPropertyName: () => createMemberAccessForPropertyName,
|
|
411
412
|
createModeAwareCache: () => createModeAwareCache,
|
|
412
413
|
createModeAwareCacheKey: () => createModeAwareCacheKey,
|
|
414
|
+
createModeMismatchDetails: () => createModeMismatchDetails,
|
|
413
415
|
createModuleNotFoundChain: () => createModuleNotFoundChain,
|
|
414
416
|
createModuleResolutionCache: () => createModuleResolutionCache,
|
|
415
417
|
createModuleResolutionLoader: () => createModuleResolutionLoader,
|
|
@@ -691,6 +693,7 @@ __export(typescript_exports, {
|
|
|
691
693
|
getDefaultLibFilePath: () => getDefaultLibFilePath,
|
|
692
694
|
getDefaultLikeExportInfo: () => getDefaultLikeExportInfo,
|
|
693
695
|
getDefaultLikeExportNameFromDeclaration: () => getDefaultLikeExportNameFromDeclaration,
|
|
696
|
+
getDefaultResolutionModeForFileWorker: () => getDefaultResolutionModeForFileWorker,
|
|
694
697
|
getDiagnosticText: () => getDiagnosticText,
|
|
695
698
|
getDiagnosticsWithinSpan: () => getDiagnosticsWithinSpan,
|
|
696
699
|
getDirectoryPath: () => getDirectoryPath,
|
|
@@ -721,6 +724,7 @@ __export(typescript_exports, {
|
|
|
721
724
|
getEmitFlags: () => getEmitFlags,
|
|
722
725
|
getEmitHelpers: () => getEmitHelpers,
|
|
723
726
|
getEmitModuleDetectionKind: () => getEmitModuleDetectionKind,
|
|
727
|
+
getEmitModuleFormatOfFileWorker: () => getEmitModuleFormatOfFileWorker,
|
|
724
728
|
getEmitModuleKind: () => getEmitModuleKind,
|
|
725
729
|
getEmitModuleResolutionKind: () => getEmitModuleResolutionKind,
|
|
726
730
|
getEmitScriptTarget: () => getEmitScriptTarget,
|
|
@@ -771,6 +775,7 @@ __export(typescript_exports, {
|
|
|
771
775
|
getIdentifierGeneratedImportReference: () => getIdentifierGeneratedImportReference,
|
|
772
776
|
getIdentifierTypeArguments: () => getIdentifierTypeArguments,
|
|
773
777
|
getImmediatelyInvokedFunctionExpression: () => getImmediatelyInvokedFunctionExpression,
|
|
778
|
+
getImpliedNodeFormatForEmitWorker: () => getImpliedNodeFormatForEmitWorker,
|
|
774
779
|
getImpliedNodeFormatForFile: () => getImpliedNodeFormatForFile,
|
|
775
780
|
getImpliedNodeFormatForFileWorker: () => getImpliedNodeFormatForFileWorker,
|
|
776
781
|
getImportNeedsImportDefaultHelper: () => getImportNeedsImportDefaultHelper,
|
|
@@ -876,7 +881,6 @@ __export(typescript_exports, {
|
|
|
876
881
|
getNameOfScriptTarget: () => getNameOfScriptTarget,
|
|
877
882
|
getNameOrArgument: () => getNameOrArgument,
|
|
878
883
|
getNameTable: () => getNameTable,
|
|
879
|
-
getNamesForExportedSymbol: () => getNamesForExportedSymbol,
|
|
880
884
|
getNamespaceDeclarationNode: () => getNamespaceDeclarationNode,
|
|
881
885
|
getNewLineCharacter: () => getNewLineCharacter,
|
|
882
886
|
getNewLineKind: () => getNewLineKind,
|
|
@@ -1113,6 +1117,7 @@ __export(typescript_exports, {
|
|
|
1113
1117
|
ignoreSourceNewlines: () => ignoreSourceNewlines,
|
|
1114
1118
|
ignoredPaths: () => ignoredPaths,
|
|
1115
1119
|
importFromModuleSpecifier: () => importFromModuleSpecifier,
|
|
1120
|
+
importSyntaxAffectsModuleResolution: () => importSyntaxAffectsModuleResolution,
|
|
1116
1121
|
indexOfAnyCharCode: () => indexOfAnyCharCode,
|
|
1117
1122
|
indexOfNode: () => indexOfNode,
|
|
1118
1123
|
indicesOf: () => indicesOf,
|
|
@@ -2158,11 +2163,11 @@ __export(typescript_exports, {
|
|
|
2158
2163
|
transformESDecorators: () => transformESDecorators,
|
|
2159
2164
|
transformESNext: () => transformESNext,
|
|
2160
2165
|
transformGenerators: () => transformGenerators,
|
|
2166
|
+
transformImpliedNodeFormatDependentModule: () => transformImpliedNodeFormatDependentModule,
|
|
2161
2167
|
transformJsx: () => transformJsx,
|
|
2162
2168
|
transformLegacyDecorators: () => transformLegacyDecorators,
|
|
2163
2169
|
transformModule: () => transformModule,
|
|
2164
2170
|
transformNamedEvaluation: () => transformNamedEvaluation,
|
|
2165
|
-
transformNodeModule: () => transformNodeModule,
|
|
2166
2171
|
transformNodes: () => transformNodes,
|
|
2167
2172
|
transformSystemModule: () => transformSystemModule,
|
|
2168
2173
|
transformTypeScript: () => transformTypeScript,
|
|
@@ -2251,7 +2256,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2251
2256
|
|
|
2252
2257
|
// src/compiler/corePublic.ts
|
|
2253
2258
|
var versionMajorMinor = "5.6";
|
|
2254
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2259
|
+
var version = `${versionMajorMinor}.0-insiders.20240719`;
|
|
2255
2260
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2256
2261
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2257
2262
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -5051,10 +5056,12 @@ function tryGetPerformance() {
|
|
|
5051
5056
|
if (isNodeLikeSystem()) {
|
|
5052
5057
|
try {
|
|
5053
5058
|
const { performance: performance2 } = require("perf_hooks");
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
|
|
5059
|
+
if (performance2) {
|
|
5060
|
+
return {
|
|
5061
|
+
shouldWriteNativeEvents: false,
|
|
5062
|
+
performance: performance2
|
|
5063
|
+
};
|
|
5064
|
+
}
|
|
5058
5065
|
} catch {
|
|
5059
5066
|
}
|
|
5060
5067
|
}
|
|
@@ -6085,6 +6092,7 @@ var FilePreprocessingDiagnosticsKind = /* @__PURE__ */ ((FilePreprocessingDiagno
|
|
|
6085
6092
|
var EmitOnly = /* @__PURE__ */ ((EmitOnly4) => {
|
|
6086
6093
|
EmitOnly4[EmitOnly4["Js"] = 0] = "Js";
|
|
6087
6094
|
EmitOnly4[EmitOnly4["Dts"] = 1] = "Dts";
|
|
6095
|
+
EmitOnly4[EmitOnly4["BuilderSignature"] = 2] = "BuilderSignature";
|
|
6088
6096
|
return EmitOnly4;
|
|
6089
6097
|
})(EmitOnly || {});
|
|
6090
6098
|
var StructureIsReused = /* @__PURE__ */ ((StructureIsReused2) => {
|
|
@@ -6722,22 +6730,22 @@ var ScriptKind = /* @__PURE__ */ ((ScriptKind7) => {
|
|
|
6722
6730
|
ScriptKind7[ScriptKind7["Deferred"] = 7] = "Deferred";
|
|
6723
6731
|
return ScriptKind7;
|
|
6724
6732
|
})(ScriptKind || {});
|
|
6725
|
-
var ScriptTarget = /* @__PURE__ */ ((
|
|
6726
|
-
|
|
6727
|
-
|
|
6728
|
-
|
|
6729
|
-
|
|
6730
|
-
|
|
6731
|
-
|
|
6732
|
-
|
|
6733
|
-
|
|
6734
|
-
|
|
6735
|
-
|
|
6736
|
-
|
|
6737
|
-
|
|
6738
|
-
|
|
6739
|
-
|
|
6740
|
-
return
|
|
6733
|
+
var ScriptTarget = /* @__PURE__ */ ((ScriptTarget12) => {
|
|
6734
|
+
ScriptTarget12[ScriptTarget12["ES3"] = 0] = "ES3";
|
|
6735
|
+
ScriptTarget12[ScriptTarget12["ES5"] = 1] = "ES5";
|
|
6736
|
+
ScriptTarget12[ScriptTarget12["ES2015"] = 2] = "ES2015";
|
|
6737
|
+
ScriptTarget12[ScriptTarget12["ES2016"] = 3] = "ES2016";
|
|
6738
|
+
ScriptTarget12[ScriptTarget12["ES2017"] = 4] = "ES2017";
|
|
6739
|
+
ScriptTarget12[ScriptTarget12["ES2018"] = 5] = "ES2018";
|
|
6740
|
+
ScriptTarget12[ScriptTarget12["ES2019"] = 6] = "ES2019";
|
|
6741
|
+
ScriptTarget12[ScriptTarget12["ES2020"] = 7] = "ES2020";
|
|
6742
|
+
ScriptTarget12[ScriptTarget12["ES2021"] = 8] = "ES2021";
|
|
6743
|
+
ScriptTarget12[ScriptTarget12["ES2022"] = 9] = "ES2022";
|
|
6744
|
+
ScriptTarget12[ScriptTarget12["ES2023"] = 10] = "ES2023";
|
|
6745
|
+
ScriptTarget12[ScriptTarget12["ESNext"] = 99] = "ESNext";
|
|
6746
|
+
ScriptTarget12[ScriptTarget12["JSON"] = 100] = "JSON";
|
|
6747
|
+
ScriptTarget12[ScriptTarget12["Latest"] = 99 /* ESNext */] = "Latest";
|
|
6748
|
+
return ScriptTarget12;
|
|
6741
6749
|
})(ScriptTarget || {});
|
|
6742
6750
|
var LanguageVariant = /* @__PURE__ */ ((LanguageVariant4) => {
|
|
6743
6751
|
LanguageVariant4[LanguageVariant4["Standard"] = 0] = "Standard";
|
|
@@ -9292,6 +9300,7 @@ var Diagnostics = {
|
|
|
9292
9300
|
_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 }'."),
|
|
9293
9301
|
_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."),
|
|
9294
9302
|
_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 }'."),
|
|
9303
|
+
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'."),
|
|
9295
9304
|
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."),
|
|
9296
9305
|
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."),
|
|
9297
9306
|
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."),
|
|
@@ -9500,6 +9509,7 @@ var Diagnostics = {
|
|
|
9500
9509
|
This_character_cannot_be_escaped_in_a_regular_expression: diag(1535, 1 /* Error */, "This_character_cannot_be_escaped_in_a_regular_expression_1535", "This character cannot be escaped in a regular expression."),
|
|
9501
9510
|
Octal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class_If_this_was_intended_as_an_escape_sequence_use_the_syntax_0_instead: diag(1536, 1 /* Error */, "Octal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class_If_this_was_intended__1536", "Octal escape sequences and backreferences are not allowed in a character class. If this was intended as an escape sequence, use the syntax '{0}' instead."),
|
|
9502
9511
|
Decimal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class: diag(1537, 1 /* Error */, "Decimal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class_1537", "Decimal escape sequences and backreferences are not allowed in a character class."),
|
|
9512
|
+
Unicode_escape_sequences_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v_flag_is_set: diag(1538, 1 /* Error */, "Unicode_escape_sequences_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v_flag_is_se_1538", "Unicode escape sequences are only available when the Unicode (u) flag or the Unicode Sets (v) flag is set."),
|
|
9503
9513
|
The_types_of_0_are_incompatible_between_these_types: diag(2200, 1 /* Error */, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
|
|
9504
9514
|
The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, 1 /* Error */, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
|
|
9505
9515
|
Call_signature_return_types_0_and_1_are_incompatible: diag(
|
|
@@ -12371,9 +12381,16 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12371
12381
|
case 34 /* doubleQuote */:
|
|
12372
12382
|
return '"';
|
|
12373
12383
|
case 117 /* u */:
|
|
12374
|
-
if (
|
|
12384
|
+
if (pos < end && charCodeUnchecked(pos) === 123 /* openBrace */) {
|
|
12375
12385
|
pos -= 2;
|
|
12376
|
-
|
|
12386
|
+
const result = scanExtendedUnicodeEscape(!!(flags & 6 /* ReportInvalidEscapeErrors */));
|
|
12387
|
+
if (!(flags & 17 /* AllowExtendedUnicodeEscape */)) {
|
|
12388
|
+
tokenFlags |= 2048 /* ContainsInvalidEscape */;
|
|
12389
|
+
if (flags & 6 /* ReportInvalidEscapeErrors */) {
|
|
12390
|
+
error2(Diagnostics.Unicode_escape_sequences_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v_flag_is_set, start2, pos - start2);
|
|
12391
|
+
}
|
|
12392
|
+
}
|
|
12393
|
+
return result;
|
|
12377
12394
|
}
|
|
12378
12395
|
for (; pos < start2 + 6; pos++) {
|
|
12379
12396
|
if (!(pos < end && isHexDigit(charCodeUnchecked(pos)))) {
|
|
@@ -12391,7 +12408,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12391
12408
|
const nextStart = pos;
|
|
12392
12409
|
let nextPos = pos + 2;
|
|
12393
12410
|
for (; nextPos < nextStart + 6; nextPos++) {
|
|
12394
|
-
if (!isHexDigit(charCodeUnchecked(
|
|
12411
|
+
if (!isHexDigit(charCodeUnchecked(nextPos))) {
|
|
12395
12412
|
return escapedValueString;
|
|
12396
12413
|
}
|
|
12397
12414
|
}
|
|
@@ -14019,7 +14036,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
14019
14036
|
return value;
|
|
14020
14037
|
}
|
|
14021
14038
|
function scanSourceCharacter() {
|
|
14022
|
-
const size = anyUnicodeMode ? charSize(
|
|
14039
|
+
const size = anyUnicodeMode ? charSize(codePointChecked(pos)) : 1;
|
|
14023
14040
|
pos += size;
|
|
14024
14041
|
return size > 0 ? text.substring(pos - size, pos) : "";
|
|
14025
14042
|
}
|
|
@@ -16169,6 +16186,34 @@ function createModuleNotFoundChain(sourceFile, host, moduleReference, mode, pack
|
|
|
16169
16186
|
if (result) result.repopulateInfo = () => ({ moduleReference, mode, packageName: packageName === moduleReference ? void 0 : packageName });
|
|
16170
16187
|
return result;
|
|
16171
16188
|
}
|
|
16189
|
+
function createModeMismatchDetails(currentSourceFile) {
|
|
16190
|
+
const ext = tryGetExtensionFromPath2(currentSourceFile.fileName);
|
|
16191
|
+
const scope = currentSourceFile.packageJsonScope;
|
|
16192
|
+
const targetExt = ext === ".ts" /* Ts */ ? ".mts" /* Mts */ : ext === ".js" /* Js */ ? ".mjs" /* Mjs */ : void 0;
|
|
16193
|
+
const result = scope && !scope.contents.packageJsonContent.type ? targetExt ? chainDiagnosticMessages(
|
|
16194
|
+
/*details*/
|
|
16195
|
+
void 0,
|
|
16196
|
+
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1,
|
|
16197
|
+
targetExt,
|
|
16198
|
+
combinePaths(scope.packageDirectory, "package.json")
|
|
16199
|
+
) : chainDiagnosticMessages(
|
|
16200
|
+
/*details*/
|
|
16201
|
+
void 0,
|
|
16202
|
+
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0,
|
|
16203
|
+
combinePaths(scope.packageDirectory, "package.json")
|
|
16204
|
+
) : targetExt ? chainDiagnosticMessages(
|
|
16205
|
+
/*details*/
|
|
16206
|
+
void 0,
|
|
16207
|
+
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_package_json_file_with_type_Colon_module,
|
|
16208
|
+
targetExt
|
|
16209
|
+
) : chainDiagnosticMessages(
|
|
16210
|
+
/*details*/
|
|
16211
|
+
void 0,
|
|
16212
|
+
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module
|
|
16213
|
+
);
|
|
16214
|
+
result.repopulateInfo = () => true;
|
|
16215
|
+
return result;
|
|
16216
|
+
}
|
|
16172
16217
|
function packageIdIsEqual(a, b) {
|
|
16173
16218
|
return a === b || !!a && !!b && a.name === b.name && a.subModuleName === b.subModuleName && a.version === b.version && a.peerDependencies === b.peerDependencies;
|
|
16174
16219
|
}
|
|
@@ -18141,7 +18186,7 @@ function isInExpressionContext(node) {
|
|
|
18141
18186
|
case 233 /* ExpressionWithTypeArguments */:
|
|
18142
18187
|
return parent2.expression === node && !isPartOfTypeNode(parent2);
|
|
18143
18188
|
case 304 /* ShorthandPropertyAssignment */:
|
|
18144
|
-
return
|
|
18189
|
+
return parent2.objectAssignmentInitializer === node;
|
|
18145
18190
|
case 238 /* SatisfiesExpression */:
|
|
18146
18191
|
return node === parent2.expression;
|
|
18147
18192
|
default:
|
|
@@ -18477,6 +18522,23 @@ function isFunctionSymbol(symbol) {
|
|
|
18477
18522
|
const decl = symbol.valueDeclaration;
|
|
18478
18523
|
return decl.kind === 262 /* FunctionDeclaration */ || isVariableDeclaration(decl) && decl.initializer && isFunctionLike(decl.initializer);
|
|
18479
18524
|
}
|
|
18525
|
+
function canHaveModuleSpecifier(node) {
|
|
18526
|
+
switch (node == null ? void 0 : node.kind) {
|
|
18527
|
+
case 260 /* VariableDeclaration */:
|
|
18528
|
+
case 208 /* BindingElement */:
|
|
18529
|
+
case 272 /* ImportDeclaration */:
|
|
18530
|
+
case 278 /* ExportDeclaration */:
|
|
18531
|
+
case 271 /* ImportEqualsDeclaration */:
|
|
18532
|
+
case 273 /* ImportClause */:
|
|
18533
|
+
case 280 /* NamespaceExport */:
|
|
18534
|
+
case 274 /* NamespaceImport */:
|
|
18535
|
+
case 281 /* ExportSpecifier */:
|
|
18536
|
+
case 276 /* ImportSpecifier */:
|
|
18537
|
+
case 205 /* ImportType */:
|
|
18538
|
+
return true;
|
|
18539
|
+
}
|
|
18540
|
+
return false;
|
|
18541
|
+
}
|
|
18480
18542
|
function tryGetModuleSpecifierFromDeclaration(node) {
|
|
18481
18543
|
var _a, _b;
|
|
18482
18544
|
switch (node.kind) {
|
|
@@ -21460,8 +21522,8 @@ function walkTreeForJSXTags(node) {
|
|
|
21460
21522
|
function isFileModuleFromUsingJSXTag(file) {
|
|
21461
21523
|
return !file.isDeclarationFile ? walkTreeForJSXTags(file) : void 0;
|
|
21462
21524
|
}
|
|
21463
|
-
function isFileForcedToBeModuleByFormat(file) {
|
|
21464
|
-
return (file
|
|
21525
|
+
function isFileForcedToBeModuleByFormat(file, options) {
|
|
21526
|
+
return (getImpliedNodeFormatForEmitWorker(file, options) === 99 /* ESNext */ || fileExtensionIsOneOf(file.fileName, [".cjs" /* Cjs */, ".cts" /* Cts */, ".mjs" /* Mjs */, ".mts" /* Mts */])) && !file.isDeclarationFile ? true : void 0;
|
|
21465
21527
|
}
|
|
21466
21528
|
function getSetExternalModuleIndicator(options) {
|
|
21467
21529
|
switch (getEmitModuleDetectionKind(options)) {
|
|
@@ -21480,10 +21542,14 @@ function getSetExternalModuleIndicator(options) {
|
|
|
21480
21542
|
}
|
|
21481
21543
|
checks.push(isFileForcedToBeModuleByFormat);
|
|
21482
21544
|
const combined = or(...checks);
|
|
21483
|
-
const callback = (file) => void (file.externalModuleIndicator = combined(file));
|
|
21545
|
+
const callback = (file) => void (file.externalModuleIndicator = combined(file, options));
|
|
21484
21546
|
return callback;
|
|
21485
21547
|
}
|
|
21486
21548
|
}
|
|
21549
|
+
function importSyntaxAffectsModuleResolution(options) {
|
|
21550
|
+
const moduleResolution = getEmitModuleResolutionKind(options);
|
|
21551
|
+
return 3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */ || getResolvePackageJsonExports(options) || getResolvePackageJsonImports(options);
|
|
21552
|
+
}
|
|
21487
21553
|
function createComputedCompilerOptions(options) {
|
|
21488
21554
|
return options;
|
|
21489
21555
|
}
|
|
@@ -30970,7 +31036,7 @@ function createExternalHelpersImportDeclarationIfNeeded(nodeFactory, helperFacto
|
|
|
30970
31036
|
if (compilerOptions.importHelpers && isEffectiveExternalModule(sourceFile, compilerOptions)) {
|
|
30971
31037
|
let namedBindings;
|
|
30972
31038
|
const moduleKind = getEmitModuleKind(compilerOptions);
|
|
30973
|
-
if (moduleKind >= 5 /* ES2015 */ && moduleKind <= 99 /* ESNext */ || sourceFile
|
|
31039
|
+
if (moduleKind >= 5 /* ES2015 */ && moduleKind <= 99 /* ESNext */ || getImpliedNodeFormatForEmitWorker(sourceFile, compilerOptions) === 99 /* ESNext */) {
|
|
30974
31040
|
const helpers = getEmitHelpers(sourceFile);
|
|
30975
31041
|
if (helpers) {
|
|
30976
31042
|
const helperNames = [];
|
|
@@ -31035,8 +31101,7 @@ function getOrCreateExternalHelpersModuleNameIfNeeded(factory2, node, compilerOp
|
|
|
31035
31101
|
if (externalHelpersModuleName) {
|
|
31036
31102
|
return externalHelpersModuleName;
|
|
31037
31103
|
}
|
|
31038
|
-
|
|
31039
|
-
let create = (hasExportStarsToExportValues || getESModuleInterop(compilerOptions) && hasImportStarOrImportDefault) && moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || node.impliedNodeFormat === 1 /* CommonJS */);
|
|
31104
|
+
let create = (hasExportStarsToExportValues || getESModuleInterop(compilerOptions) && hasImportStarOrImportDefault) && getEmitModuleFormatOfFileWorker(node, compilerOptions) < 4 /* System */;
|
|
31040
31105
|
if (!create) {
|
|
31041
31106
|
const helpers = getEmitHelpers(node);
|
|
31042
31107
|
if (helpers) {
|
|
@@ -40009,7 +40074,6 @@ var commonOptionsWithBuild = [
|
|
|
40009
40074
|
affectsBuildInfo: true,
|
|
40010
40075
|
showInSimplifiedHelpView: true,
|
|
40011
40076
|
category: Diagnostics.Emit,
|
|
40012
|
-
transpileOptionValue: void 0,
|
|
40013
40077
|
defaultValueDescription: false,
|
|
40014
40078
|
description: Diagnostics.Create_sourcemaps_for_d_ts_files
|
|
40015
40079
|
},
|
|
@@ -44617,22 +44681,16 @@ function getTemporaryModuleResolutionState(packageJsonInfoCache, host, options)
|
|
|
44617
44681
|
resolvedPackageDirectory: false
|
|
44618
44682
|
};
|
|
44619
44683
|
}
|
|
44620
|
-
function getPackageScopeForPath(
|
|
44621
|
-
|
|
44622
|
-
|
|
44623
|
-
|
|
44624
|
-
|
|
44625
|
-
getPathFromPathComponents(parts),
|
|
44684
|
+
function getPackageScopeForPath(directory, state) {
|
|
44685
|
+
return forEachAncestorDirectory(
|
|
44686
|
+
directory,
|
|
44687
|
+
(dir) => getPackageJsonInfo(
|
|
44688
|
+
dir,
|
|
44626
44689
|
/*onlyRecordFailures*/
|
|
44627
44690
|
false,
|
|
44628
44691
|
state
|
|
44629
|
-
)
|
|
44630
|
-
|
|
44631
|
-
return pkg;
|
|
44632
|
-
}
|
|
44633
|
-
parts.pop();
|
|
44634
|
-
}
|
|
44635
|
-
return void 0;
|
|
44692
|
+
)
|
|
44693
|
+
);
|
|
44636
44694
|
}
|
|
44637
44695
|
function getVersionPathsOfPackageJsonInfo(packageJsonInfo, state) {
|
|
44638
44696
|
if (packageJsonInfo.contents.versionPaths === void 0) {
|
|
@@ -44795,7 +44853,7 @@ function noKeyStartsWithDot(obj) {
|
|
|
44795
44853
|
}
|
|
44796
44854
|
function loadModuleFromSelfNameReference(extensions, moduleName, directory, state, cache, redirectedReference) {
|
|
44797
44855
|
var _a, _b;
|
|
44798
|
-
const directoryPath = getNormalizedAbsolutePath(
|
|
44856
|
+
const directoryPath = getNormalizedAbsolutePath(directory, (_b = (_a = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a));
|
|
44799
44857
|
const scope = getPackageScopeForPath(directoryPath, state);
|
|
44800
44858
|
if (!scope || !scope.contents.packageJsonContent.exports) {
|
|
44801
44859
|
return void 0;
|
|
@@ -44891,7 +44949,7 @@ function loadModuleFromImports(extensions, moduleName, directory, state, cache,
|
|
|
44891
44949
|
void 0
|
|
44892
44950
|
);
|
|
44893
44951
|
}
|
|
44894
|
-
const directoryPath = getNormalizedAbsolutePath(
|
|
44952
|
+
const directoryPath = getNormalizedAbsolutePath(directory, (_b = (_a = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a));
|
|
44895
44953
|
const scope = getPackageScopeForPath(directoryPath, state);
|
|
44896
44954
|
if (!scope) {
|
|
44897
44955
|
if (state.traceEnabled) {
|
|
@@ -48752,13 +48810,15 @@ var RelativePreference = /* @__PURE__ */ ((RelativePreference2) => {
|
|
|
48752
48810
|
RelativePreference2[RelativePreference2["ExternalNonRelative"] = 3] = "ExternalNonRelative";
|
|
48753
48811
|
return RelativePreference2;
|
|
48754
48812
|
})(RelativePreference || {});
|
|
48755
|
-
function getModuleSpecifierPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding }, compilerOptions, importingSourceFile, oldImportSpecifier) {
|
|
48813
|
+
function getModuleSpecifierPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding }, host, compilerOptions, importingSourceFile, oldImportSpecifier) {
|
|
48756
48814
|
const filePreferredEnding = getPreferredEnding();
|
|
48757
48815
|
return {
|
|
48758
48816
|
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 */,
|
|
48759
48817
|
getAllowedEndingsInPreferredOrder: (syntaxImpliedNodeFormat) => {
|
|
48760
|
-
const
|
|
48761
|
-
|
|
48818
|
+
const impliedNodeFormat = getDefaultResolutionModeForFile(importingSourceFile, host, compilerOptions);
|
|
48819
|
+
const preferredEnding = syntaxImpliedNodeFormat !== impliedNodeFormat ? getPreferredEnding(syntaxImpliedNodeFormat) : filePreferredEnding;
|
|
48820
|
+
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
|
48821
|
+
if ((syntaxImpliedNodeFormat ?? impliedNodeFormat) === 99 /* ESNext */ && 3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */) {
|
|
48762
48822
|
if (shouldAllowImportingTsExtension(compilerOptions, importingSourceFile.fileName)) {
|
|
48763
48823
|
return [3 /* TsExtension */, 2 /* JsExtension */];
|
|
48764
48824
|
}
|
|
@@ -48789,19 +48849,19 @@ function getModuleSpecifierPreferences({ importModuleSpecifierPreference, import
|
|
|
48789
48849
|
}
|
|
48790
48850
|
return getModuleSpecifierEndingPreference(
|
|
48791
48851
|
importModuleSpecifierEnding,
|
|
48792
|
-
resolutionMode ?? importingSourceFile
|
|
48852
|
+
resolutionMode ?? getDefaultResolutionModeForFile(importingSourceFile, host, compilerOptions),
|
|
48793
48853
|
compilerOptions,
|
|
48794
48854
|
isFullSourceFile(importingSourceFile) ? importingSourceFile : void 0
|
|
48795
48855
|
);
|
|
48796
48856
|
}
|
|
48797
48857
|
}
|
|
48798
48858
|
function updateModuleSpecifier(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, oldImportSpecifier, options = {}) {
|
|
48799
|
-
const res = getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getModuleSpecifierPreferences({}, compilerOptions, importingSourceFile, oldImportSpecifier), {}, options);
|
|
48859
|
+
const res = getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getModuleSpecifierPreferences({}, host, compilerOptions, importingSourceFile, oldImportSpecifier), {}, options);
|
|
48800
48860
|
if (res === oldImportSpecifier) return void 0;
|
|
48801
48861
|
return res;
|
|
48802
48862
|
}
|
|
48803
48863
|
function getModuleSpecifier(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, options = {}) {
|
|
48804
|
-
return getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getModuleSpecifierPreferences({}, compilerOptions, importingSourceFile), {}, options);
|
|
48864
|
+
return getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getModuleSpecifierPreferences({}, host, compilerOptions, importingSourceFile), {}, options);
|
|
48805
48865
|
}
|
|
48806
48866
|
function getNodeModulesPackageName(compilerOptions, importingSourceFile, nodeModulesFileName, host, preferences, options = {}) {
|
|
48807
48867
|
const info = getInfo(importingSourceFile.fileName, host);
|
|
@@ -48831,7 +48891,7 @@ function getModuleSpecifierWorker(compilerOptions, importingSourceFile, importin
|
|
|
48831
48891
|
/*packageNameOnly*/
|
|
48832
48892
|
void 0,
|
|
48833
48893
|
options.overrideImportMode
|
|
48834
|
-
)) || getLocalModuleSpecifier(toFileName2, info, compilerOptions, host, options.overrideImportMode || importingSourceFile
|
|
48894
|
+
)) || getLocalModuleSpecifier(toFileName2, info, compilerOptions, host, options.overrideImportMode || getDefaultResolutionModeForFile(importingSourceFile, host, compilerOptions), preferences);
|
|
48835
48895
|
}
|
|
48836
48896
|
function tryGetModuleSpecifiersFromCache(moduleSymbol, importingSourceFile, host, userPreferences, options = {}) {
|
|
48837
48897
|
const result = tryGetModuleSpecifiersFromCacheWorker(
|
|
@@ -48902,17 +48962,21 @@ function getLocalModuleSpecifierBetweenFileNames(importingFile, targetFileName,
|
|
|
48902
48962
|
compilerOptions,
|
|
48903
48963
|
host,
|
|
48904
48964
|
importMode,
|
|
48905
|
-
getModuleSpecifierPreferences({}, compilerOptions, importingFile)
|
|
48965
|
+
getModuleSpecifierPreferences({}, host, compilerOptions, importingFile)
|
|
48906
48966
|
);
|
|
48907
48967
|
}
|
|
48908
48968
|
function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
|
|
48909
48969
|
const info = getInfo(importingSourceFile.fileName, host);
|
|
48910
|
-
const preferences = getModuleSpecifierPreferences(userPreferences, compilerOptions, importingSourceFile);
|
|
48970
|
+
const preferences = getModuleSpecifierPreferences(userPreferences, host, compilerOptions, importingSourceFile);
|
|
48911
48971
|
const existingSpecifier = isFullSourceFile(importingSourceFile) && forEach(modulePaths, (modulePath) => forEach(
|
|
48912
48972
|
host.getFileIncludeReasons().get(toPath(modulePath.path, host.getCurrentDirectory(), info.getCanonicalFileName)),
|
|
48913
48973
|
(reason) => {
|
|
48914
48974
|
if (reason.kind !== 3 /* Import */ || reason.file !== importingSourceFile.path) return void 0;
|
|
48915
|
-
|
|
48975
|
+
const existingMode = host.getModeForResolutionAtIndex(importingSourceFile, reason.index);
|
|
48976
|
+
const targetMode = options.overrideImportMode ?? host.getDefaultResolutionModeForFile(importingSourceFile);
|
|
48977
|
+
if (existingMode !== targetMode && existingMode !== void 0 && targetMode !== void 0) {
|
|
48978
|
+
return void 0;
|
|
48979
|
+
}
|
|
48916
48980
|
const specifier = getModuleNameStringLiteralAt(importingSourceFile, reason.index).text;
|
|
48917
48981
|
return preferences.relativePreference !== 1 /* NonRelative */ || !pathIsRelative(specifier) ? specifier : void 0;
|
|
48918
48982
|
}
|
|
@@ -49120,7 +49184,7 @@ function getAllModulePathsWorker(info, importedFileName, host, compilerOptions,
|
|
|
49120
49184
|
if (cache && links && host.readFile && !pathContainsNodeModules(info.importingSourceFileName)) {
|
|
49121
49185
|
Debug.type(host);
|
|
49122
49186
|
const state = getTemporaryModuleResolutionState(cache.getPackageJsonInfoCache(), host, {});
|
|
49123
|
-
const packageJson = getPackageScopeForPath(info.importingSourceFileName, state);
|
|
49187
|
+
const packageJson = getPackageScopeForPath(getDirectoryPath(info.importingSourceFileName), state);
|
|
49124
49188
|
if (packageJson) {
|
|
49125
49189
|
const toResolve = getAllRuntimeDependencies(packageJson.contents.packageJsonContent);
|
|
49126
49190
|
for (const depName of toResolve || emptyArray) {
|
|
@@ -49442,7 +49506,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
|
|
|
49442
49506
|
if (!parts) {
|
|
49443
49507
|
return void 0;
|
|
49444
49508
|
}
|
|
49445
|
-
const preferences = getModuleSpecifierPreferences(userPreferences, options, importingSourceFile);
|
|
49509
|
+
const preferences = getModuleSpecifierPreferences(userPreferences, host, options, importingSourceFile);
|
|
49446
49510
|
const allowedEndings = preferences.getAllowedEndingsInPreferredOrder();
|
|
49447
49511
|
let moduleSpecifier = path;
|
|
49448
49512
|
let isPackageRootPath = false;
|
|
@@ -49492,7 +49556,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
|
|
|
49492
49556
|
const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
49493
49557
|
if (isPackageJsonInfo(cachedPackageJson) || cachedPackageJson === void 0 && host.fileExists(packageJsonPath)) {
|
|
49494
49558
|
const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || tryParseJson(host.readFile(packageJsonPath));
|
|
49495
|
-
const importMode = overrideMode || importingSourceFile
|
|
49559
|
+
const importMode = overrideMode || getDefaultResolutionModeForFile(importingSourceFile, host, options);
|
|
49496
49560
|
if (getResolvePackageJsonExports(options)) {
|
|
49497
49561
|
const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
|
|
49498
49562
|
const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
|
|
@@ -49642,6 +49706,9 @@ function getRelativePathIfInSameVolume(path, directoryPath, getCanonicalFileName
|
|
|
49642
49706
|
function isPathRelativeToParent(path) {
|
|
49643
49707
|
return startsWith(path, "..");
|
|
49644
49708
|
}
|
|
49709
|
+
function getDefaultResolutionModeForFile(file, host, compilerOptions) {
|
|
49710
|
+
return isFullSourceFile(file) ? host.getDefaultResolutionModeForFile(file) : getDefaultResolutionModeForFileWorker(file, compilerOptions);
|
|
49711
|
+
}
|
|
49645
49712
|
|
|
49646
49713
|
// src/compiler/checker.ts
|
|
49647
49714
|
var ambientModuleSymbolRegex = /^".+"$/;
|
|
@@ -51862,22 +51929,28 @@ function createTypeChecker(host) {
|
|
|
51862
51929
|
function isSyntacticDefault(node) {
|
|
51863
51930
|
return isExportAssignment(node) && !node.isExportEquals || hasSyntacticModifier(node, 2048 /* Default */) || isExportSpecifier(node) || isNamespaceExport(node);
|
|
51864
51931
|
}
|
|
51865
|
-
function
|
|
51866
|
-
return isStringLiteralLike(usage) ? host.
|
|
51932
|
+
function getEmitSyntaxForModuleSpecifierExpression(usage) {
|
|
51933
|
+
return isStringLiteralLike(usage) ? host.getEmitSyntaxForUsageLocation(getSourceFileOfNode(usage), usage) : void 0;
|
|
51867
51934
|
}
|
|
51868
51935
|
function isESMFormatImportImportingCommonjsFormatFile(usageMode, targetMode) {
|
|
51869
51936
|
return usageMode === 99 /* ESNext */ && targetMode === 1 /* CommonJS */;
|
|
51870
51937
|
}
|
|
51871
|
-
function
|
|
51872
|
-
|
|
51873
|
-
|
|
51938
|
+
function isOnlyImportableAsDefault(usage) {
|
|
51939
|
+
if (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
|
|
51940
|
+
const usageMode = getEmitSyntaxForModuleSpecifierExpression(usage);
|
|
51941
|
+
return usageMode === 99 /* ESNext */ && endsWith(usage.text, ".json" /* Json */);
|
|
51942
|
+
}
|
|
51943
|
+
return false;
|
|
51874
51944
|
}
|
|
51875
51945
|
function canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, usage) {
|
|
51876
|
-
const usageMode = file &&
|
|
51877
|
-
if (file && usageMode !== void 0
|
|
51878
|
-
const
|
|
51879
|
-
if (usageMode === 99 /* ESNext */
|
|
51880
|
-
return
|
|
51946
|
+
const usageMode = file && getEmitSyntaxForModuleSpecifierExpression(usage);
|
|
51947
|
+
if (file && usageMode !== void 0) {
|
|
51948
|
+
const targetMode = host.getImpliedNodeFormatForEmit(file);
|
|
51949
|
+
if (usageMode === 99 /* ESNext */ && targetMode === 1 /* CommonJS */ && 100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
|
|
51950
|
+
return true;
|
|
51951
|
+
}
|
|
51952
|
+
if (usageMode === 99 /* ESNext */ && targetMode === 99 /* ESNext */) {
|
|
51953
|
+
return false;
|
|
51881
51954
|
}
|
|
51882
51955
|
}
|
|
51883
51956
|
if (!allowSyntheticDefaultImports) {
|
|
@@ -51936,7 +52009,7 @@ function createTypeChecker(host) {
|
|
|
51936
52009
|
if (!specifier) {
|
|
51937
52010
|
return exportDefaultSymbol;
|
|
51938
52011
|
}
|
|
51939
|
-
const hasDefaultOnly =
|
|
52012
|
+
const hasDefaultOnly = isOnlyImportableAsDefault(specifier);
|
|
51940
52013
|
const hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
|
|
51941
52014
|
if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
|
|
51942
52015
|
if (hasExportAssignmentSymbol(moduleSymbol) && !allowSyntheticDefaultImports) {
|
|
@@ -52138,7 +52211,7 @@ function createTypeChecker(host) {
|
|
|
52138
52211
|
let symbolFromModule = getExportOfModule(targetSymbol, nameText, specifier, dontResolveAlias);
|
|
52139
52212
|
if (symbolFromModule === void 0 && nameText === "default" /* Default */) {
|
|
52140
52213
|
const file = (_a = moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
|
|
52141
|
-
if (
|
|
52214
|
+
if (isOnlyImportableAsDefault(moduleSpecifier) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
|
|
52142
52215
|
symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
|
|
52143
52216
|
}
|
|
52144
52217
|
}
|
|
@@ -52742,7 +52815,7 @@ function createTypeChecker(host) {
|
|
|
52742
52815
|
/*requireStringLiteralLikeArgument*/
|
|
52743
52816
|
true
|
|
52744
52817
|
) ? 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);
|
|
52745
|
-
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile
|
|
52818
|
+
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : host.getDefaultResolutionModeForFile(currentSourceFile);
|
|
52746
52819
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
52747
52820
|
const resolvedModule = (_g = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _g.resolvedModule;
|
|
52748
52821
|
const resolutionDiagnostic = errorNode && resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
@@ -52789,41 +52862,7 @@ function createTypeChecker(host) {
|
|
|
52789
52862
|
let diagnosticDetails;
|
|
52790
52863
|
const ext = tryGetExtensionFromPath2(currentSourceFile.fileName);
|
|
52791
52864
|
if (ext === ".ts" /* Ts */ || ext === ".js" /* Js */ || ext === ".tsx" /* Tsx */ || ext === ".jsx" /* Jsx */) {
|
|
52792
|
-
|
|
52793
|
-
const targetExt = ext === ".ts" /* Ts */ ? ".mts" /* Mts */ : ext === ".js" /* Js */ ? ".mjs" /* Mjs */ : void 0;
|
|
52794
|
-
if (scope && !scope.contents.packageJsonContent.type) {
|
|
52795
|
-
if (targetExt) {
|
|
52796
|
-
diagnosticDetails = chainDiagnosticMessages(
|
|
52797
|
-
/*details*/
|
|
52798
|
-
void 0,
|
|
52799
|
-
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1,
|
|
52800
|
-
targetExt,
|
|
52801
|
-
combinePaths(scope.packageDirectory, "package.json")
|
|
52802
|
-
);
|
|
52803
|
-
} else {
|
|
52804
|
-
diagnosticDetails = chainDiagnosticMessages(
|
|
52805
|
-
/*details*/
|
|
52806
|
-
void 0,
|
|
52807
|
-
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0,
|
|
52808
|
-
combinePaths(scope.packageDirectory, "package.json")
|
|
52809
|
-
);
|
|
52810
|
-
}
|
|
52811
|
-
} else {
|
|
52812
|
-
if (targetExt) {
|
|
52813
|
-
diagnosticDetails = chainDiagnosticMessages(
|
|
52814
|
-
/*details*/
|
|
52815
|
-
void 0,
|
|
52816
|
-
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_package_json_file_with_type_Colon_module,
|
|
52817
|
-
targetExt
|
|
52818
|
-
);
|
|
52819
|
-
} else {
|
|
52820
|
-
diagnosticDetails = chainDiagnosticMessages(
|
|
52821
|
-
/*details*/
|
|
52822
|
-
void 0,
|
|
52823
|
-
Diagnostics.To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module
|
|
52824
|
-
);
|
|
52825
|
-
}
|
|
52826
|
-
}
|
|
52865
|
+
diagnosticDetails = createModeMismatchDetails(currentSourceFile);
|
|
52827
52866
|
}
|
|
52828
52867
|
diagnostics.add(createDiagnosticForNodeFromMessageChain(
|
|
52829
52868
|
getSourceFileOfNode(errorNode),
|
|
@@ -52989,7 +53028,7 @@ function createTypeChecker(host) {
|
|
|
52989
53028
|
return cloneTypeAsModuleType(symbol, defaultOnlyType, referenceParent);
|
|
52990
53029
|
}
|
|
52991
53030
|
const targetFile = (_a = moduleSymbol == null ? void 0 : moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
|
|
52992
|
-
const isEsmCjsRef = targetFile && isESMFormatImportImportingCommonjsFormatFile(
|
|
53031
|
+
const isEsmCjsRef = targetFile && isESMFormatImportImportingCommonjsFormatFile(getEmitSyntaxForModuleSpecifierExpression(reference), host.getImpliedNodeFormatForEmit(targetFile));
|
|
52993
53032
|
if (getESModuleInterop(compilerOptions) || isEsmCjsRef) {
|
|
52994
53033
|
let sigs = getSignaturesOfStructuredType(type, 0 /* Call */);
|
|
52995
53034
|
if (!sigs || !sigs.length) {
|
|
@@ -55609,8 +55648,10 @@ function createTypeChecker(host) {
|
|
|
55609
55648
|
}
|
|
55610
55649
|
return getSourceFileOfNode(getNonAugmentationDeclaration(symbol)).fileName;
|
|
55611
55650
|
}
|
|
55651
|
+
const enclosingDeclaration = getOriginalNode(context.enclosingDeclaration);
|
|
55652
|
+
const originalModuleSpecifier = canHaveModuleSpecifier(enclosingDeclaration) ? tryGetModuleSpecifierFromDeclaration(enclosingDeclaration) : void 0;
|
|
55612
55653
|
const contextFile = context.enclosingFile;
|
|
55613
|
-
const resolutionMode = overrideImportMode || (contextFile
|
|
55654
|
+
const resolutionMode = overrideImportMode || originalModuleSpecifier && host.getModeForUsageLocation(contextFile, originalModuleSpecifier) || contextFile && host.getDefaultResolutionModeForFile(contextFile);
|
|
55614
55655
|
const cacheKey = createModeAwareCacheKey(contextFile.path, resolutionMode);
|
|
55615
55656
|
const links = getSymbolLinks(symbol);
|
|
55616
55657
|
let specifier = links.specifierCache && links.specifierCache.get(cacheKey);
|
|
@@ -56683,7 +56724,7 @@ function createTypeChecker(host) {
|
|
|
56683
56724
|
if (result) {
|
|
56684
56725
|
if (result.pos !== -1 || result.end !== -1) {
|
|
56685
56726
|
if (result === nodes) {
|
|
56686
|
-
result = factory.createNodeArray(nodes, nodes.hasTrailingComma);
|
|
56727
|
+
result = factory.createNodeArray(nodes.slice(), nodes.hasTrailingComma);
|
|
56687
56728
|
}
|
|
56688
56729
|
setTextRangePosEnd(result, -1, -1);
|
|
56689
56730
|
}
|
|
@@ -60659,18 +60700,18 @@ function createTypeChecker(host) {
|
|
|
60659
60700
|
function getExpandedParameters(sig, skipUnionExpanding) {
|
|
60660
60701
|
if (signatureHasRestParameter(sig)) {
|
|
60661
60702
|
const restIndex = sig.parameters.length - 1;
|
|
60662
|
-
const
|
|
60663
|
-
const restType = getTypeOfSymbol(
|
|
60703
|
+
const restSymbol = sig.parameters[restIndex];
|
|
60704
|
+
const restType = getTypeOfSymbol(restSymbol);
|
|
60664
60705
|
if (isTupleType(restType)) {
|
|
60665
|
-
return [expandSignatureParametersWithTupleMembers(restType, restIndex,
|
|
60706
|
+
return [expandSignatureParametersWithTupleMembers(restType, restIndex, restSymbol)];
|
|
60666
60707
|
} else if (!skipUnionExpanding && restType.flags & 1048576 /* Union */ && every(restType.types, isTupleType)) {
|
|
60667
|
-
return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex,
|
|
60708
|
+
return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex, restSymbol));
|
|
60668
60709
|
}
|
|
60669
60710
|
}
|
|
60670
60711
|
return [sig.parameters];
|
|
60671
|
-
function expandSignatureParametersWithTupleMembers(restType, restIndex,
|
|
60712
|
+
function expandSignatureParametersWithTupleMembers(restType, restIndex, restSymbol) {
|
|
60672
60713
|
const elementTypes = getTypeArguments(restType);
|
|
60673
|
-
const associatedNames = getUniqAssociatedNamesFromTupleType(restType,
|
|
60714
|
+
const associatedNames = getUniqAssociatedNamesFromTupleType(restType, restSymbol);
|
|
60674
60715
|
const restParams = map(elementTypes, (t, i) => {
|
|
60675
60716
|
const name = associatedNames && associatedNames[i] ? associatedNames[i] : getParameterNameAtPosition(sig, restIndex + i, restType);
|
|
60676
60717
|
const flags = restType.target.elementFlags[i];
|
|
@@ -60681,19 +60722,29 @@ function createTypeChecker(host) {
|
|
|
60681
60722
|
});
|
|
60682
60723
|
return concatenate(sig.parameters.slice(0, restIndex), restParams);
|
|
60683
60724
|
}
|
|
60684
|
-
function getUniqAssociatedNamesFromTupleType(type,
|
|
60685
|
-
const
|
|
60686
|
-
|
|
60687
|
-
const
|
|
60688
|
-
const
|
|
60689
|
-
|
|
60690
|
-
|
|
60691
|
-
|
|
60692
|
-
|
|
60693
|
-
|
|
60694
|
-
return `${name}_${prevCounter}`;
|
|
60725
|
+
function getUniqAssociatedNamesFromTupleType(type, restSymbol) {
|
|
60726
|
+
const names = map(type.target.labeledElementDeclarations, (labeledElement, i) => getTupleElementLabel(labeledElement, i, type.target.elementFlags[i], restSymbol));
|
|
60727
|
+
if (names) {
|
|
60728
|
+
const duplicates = [];
|
|
60729
|
+
const uniqueNames = /* @__PURE__ */ new Set();
|
|
60730
|
+
for (let i = 0; i < names.length; i++) {
|
|
60731
|
+
const name = names[i];
|
|
60732
|
+
if (!tryAddToSet(uniqueNames, name)) {
|
|
60733
|
+
duplicates.push(i);
|
|
60734
|
+
}
|
|
60695
60735
|
}
|
|
60696
|
-
|
|
60736
|
+
const counters = /* @__PURE__ */ new Map();
|
|
60737
|
+
for (const i of duplicates) {
|
|
60738
|
+
let counter = counters.get(names[i]) ?? 1;
|
|
60739
|
+
let name;
|
|
60740
|
+
while (!tryAddToSet(uniqueNames, name = `${names[i]}_${counter}`)) {
|
|
60741
|
+
counter++;
|
|
60742
|
+
}
|
|
60743
|
+
names[i] = name;
|
|
60744
|
+
counters.set(names[i], counter + 1);
|
|
60745
|
+
}
|
|
60746
|
+
}
|
|
60747
|
+
return names;
|
|
60697
60748
|
}
|
|
60698
60749
|
}
|
|
60699
60750
|
function getDefaultConstructSignatures(classType) {
|
|
@@ -72353,6 +72404,9 @@ function createTypeChecker(host) {
|
|
|
72353
72404
|
function recombineUnknownType(type) {
|
|
72354
72405
|
return type === unknownUnionType ? unknownType : type;
|
|
72355
72406
|
}
|
|
72407
|
+
function getUnknownIfMaybeUnknown(type) {
|
|
72408
|
+
return strictNullChecks && type.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(type) || unknownType : type;
|
|
72409
|
+
}
|
|
72356
72410
|
function getTypeWithDefault(type, defaultExpression) {
|
|
72357
72411
|
return defaultExpression ? getUnionType([getNonUndefinedType(type), getTypeOfExpression(defaultExpression)]) : type;
|
|
72358
72412
|
}
|
|
@@ -74185,7 +74239,7 @@ function createTypeChecker(host) {
|
|
|
74185
74239
|
if (!canCollectSymbolAliasAccessabilityData) {
|
|
74186
74240
|
return;
|
|
74187
74241
|
}
|
|
74188
|
-
if (location.flags & 33554432 /* Ambient */) {
|
|
74242
|
+
if (location.flags & 33554432 /* Ambient */ && !isPropertySignature(location) && !isPropertyDeclaration(location)) {
|
|
74189
74243
|
return;
|
|
74190
74244
|
}
|
|
74191
74245
|
switch (hint) {
|
|
@@ -77176,7 +77230,7 @@ function createTypeChecker(host) {
|
|
|
77176
77230
|
checkGrammarJsxElement(node);
|
|
77177
77231
|
}
|
|
77178
77232
|
checkJsxPreconditions(node);
|
|
77179
|
-
|
|
77233
|
+
markJsxAliasReferenced(node);
|
|
77180
77234
|
if (isNodeOpeningLikeElement) {
|
|
77181
77235
|
const jsxOpeningLikeNode = node;
|
|
77182
77236
|
const sig = getResolvedSignature(jsxOpeningLikeNode);
|
|
@@ -80107,7 +80161,7 @@ function createTypeChecker(host) {
|
|
|
80107
80161
|
return createAnonymousType(anonymousSymbol, memberTable, emptyArray, emptyArray, emptyArray);
|
|
80108
80162
|
}
|
|
80109
80163
|
function getTypeWithSyntheticDefaultOnly(type, symbol, originalSymbol, moduleSpecifier) {
|
|
80110
|
-
const hasDefaultOnly =
|
|
80164
|
+
const hasDefaultOnly = isOnlyImportableAsDefault(moduleSpecifier);
|
|
80111
80165
|
if (hasDefaultOnly && type && !isErrorType(type)) {
|
|
80112
80166
|
const synthType = type;
|
|
80113
80167
|
if (!synthType.defaultOnlyType) {
|
|
@@ -80433,14 +80487,45 @@ function createTypeChecker(host) {
|
|
|
80433
80487
|
!!declaration && (hasInitializer(declaration) || isOptionalDeclaration(declaration))
|
|
80434
80488
|
);
|
|
80435
80489
|
}
|
|
80436
|
-
function
|
|
80490
|
+
function getTupleElementLabelFromBindingElement(node, index, elementFlags) {
|
|
80491
|
+
switch (node.name.kind) {
|
|
80492
|
+
case 80 /* Identifier */: {
|
|
80493
|
+
const name = node.name.escapedText;
|
|
80494
|
+
if (node.dotDotDotToken) {
|
|
80495
|
+
return elementFlags & 12 /* Variable */ ? name : `${name}_${index}`;
|
|
80496
|
+
} else {
|
|
80497
|
+
return elementFlags & 3 /* Fixed */ ? name : `${name}_n`;
|
|
80498
|
+
}
|
|
80499
|
+
}
|
|
80500
|
+
case 207 /* ArrayBindingPattern */: {
|
|
80501
|
+
if (node.dotDotDotToken) {
|
|
80502
|
+
const elements = node.name.elements;
|
|
80503
|
+
const lastElement = tryCast(lastOrUndefined(elements), isBindingElement);
|
|
80504
|
+
const elementCount = elements.length - ((lastElement == null ? void 0 : lastElement.dotDotDotToken) ? 1 : 0);
|
|
80505
|
+
if (index < elementCount) {
|
|
80506
|
+
const element = elements[index];
|
|
80507
|
+
if (isBindingElement(element)) {
|
|
80508
|
+
return getTupleElementLabelFromBindingElement(element, index, elementFlags);
|
|
80509
|
+
}
|
|
80510
|
+
} else if (lastElement == null ? void 0 : lastElement.dotDotDotToken) {
|
|
80511
|
+
return getTupleElementLabelFromBindingElement(lastElement, index - elementCount, elementFlags);
|
|
80512
|
+
}
|
|
80513
|
+
}
|
|
80514
|
+
break;
|
|
80515
|
+
}
|
|
80516
|
+
}
|
|
80517
|
+
return `arg_${index}`;
|
|
80518
|
+
}
|
|
80519
|
+
function getTupleElementLabel(d, index = 0, elementFlags = 3 /* Fixed */, restSymbol) {
|
|
80437
80520
|
if (!d) {
|
|
80438
|
-
|
|
80521
|
+
const restParameter = tryCast(restSymbol == null ? void 0 : restSymbol.valueDeclaration, isParameter);
|
|
80522
|
+
return restParameter ? getTupleElementLabelFromBindingElement(restParameter, index, elementFlags) : `${(restSymbol == null ? void 0 : restSymbol.escapedName) ?? "arg"}_${index}`;
|
|
80439
80523
|
}
|
|
80440
80524
|
Debug.assert(isIdentifier(d.name));
|
|
80441
80525
|
return d.name.escapedText;
|
|
80442
80526
|
}
|
|
80443
80527
|
function getParameterNameAtPosition(signature, pos, overrideRestType) {
|
|
80528
|
+
var _a;
|
|
80444
80529
|
const paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0);
|
|
80445
80530
|
if (pos < paramCount) {
|
|
80446
80531
|
return signature.parameters[pos].escapedName;
|
|
@@ -80448,9 +80533,11 @@ function createTypeChecker(host) {
|
|
|
80448
80533
|
const restParameter = signature.parameters[paramCount] || unknownSymbol;
|
|
80449
80534
|
const restType = overrideRestType || getTypeOfSymbol(restParameter);
|
|
80450
80535
|
if (isTupleType(restType)) {
|
|
80451
|
-
const
|
|
80536
|
+
const tupleType = restType.target;
|
|
80452
80537
|
const index = pos - paramCount;
|
|
80453
|
-
|
|
80538
|
+
const associatedName = (_a = tupleType.labeledElementDeclarations) == null ? void 0 : _a[index];
|
|
80539
|
+
const elementFlags = tupleType.elementFlags[index];
|
|
80540
|
+
return getTupleElementLabel(associatedName, index, elementFlags, restParameter);
|
|
80454
80541
|
}
|
|
80455
80542
|
return restParameter.escapedName;
|
|
80456
80543
|
}
|
|
@@ -82388,8 +82475,8 @@ function createTypeChecker(host) {
|
|
|
82388
82475
|
case 33 /* LessThanEqualsToken */:
|
|
82389
82476
|
case 34 /* GreaterThanEqualsToken */:
|
|
82390
82477
|
if (checkForDisallowedESSymbolOperand(operator)) {
|
|
82391
|
-
leftType = getBaseTypeOfLiteralTypeForComparison(checkNonNullType(leftType, left));
|
|
82392
|
-
rightType = getBaseTypeOfLiteralTypeForComparison(checkNonNullType(rightType, right));
|
|
82478
|
+
leftType = getBaseTypeOfLiteralTypeForComparison(checkNonNullType(getUnknownIfMaybeUnknown(leftType), left));
|
|
82479
|
+
rightType = getBaseTypeOfLiteralTypeForComparison(checkNonNullType(getUnknownIfMaybeUnknown(rightType), right));
|
|
82393
82480
|
reportOperatorErrorUnless((left2, right2) => {
|
|
82394
82481
|
if (isTypeAny(left2) || isTypeAny(right2)) {
|
|
82395
82482
|
return true;
|
|
@@ -85381,7 +85468,7 @@ function createTypeChecker(host) {
|
|
|
85381
85468
|
});
|
|
85382
85469
|
}
|
|
85383
85470
|
function checkCollisionWithRequireExportsInGeneratedCode(node, name) {
|
|
85384
|
-
if (
|
|
85471
|
+
if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) >= 5 /* ES2015 */) {
|
|
85385
85472
|
return;
|
|
85386
85473
|
}
|
|
85387
85474
|
if (!name || !needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) {
|
|
@@ -86802,7 +86889,7 @@ function createTypeChecker(host) {
|
|
|
86802
86889
|
}
|
|
86803
86890
|
}
|
|
86804
86891
|
function checkClassNameCollisionWithObject(name) {
|
|
86805
|
-
if (languageVersion >= 1 /* ES5 */ && name.escapedText === "Object" && (
|
|
86892
|
+
if (languageVersion >= 1 /* ES5 */ && name.escapedText === "Object" && host.getEmitModuleFormatOfFile(getSourceFileOfNode(name)) < 5 /* ES2015 */) {
|
|
86806
86893
|
error2(name, Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_with_module_0, ModuleKind[moduleKind]);
|
|
86807
86894
|
}
|
|
86808
86895
|
}
|
|
@@ -87882,7 +87969,7 @@ function createTypeChecker(host) {
|
|
|
87882
87969
|
getNodeLinks(node).flags |= 2048 /* LexicalModuleMergesWithClass */;
|
|
87883
87970
|
}
|
|
87884
87971
|
}
|
|
87885
|
-
if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 307 /* SourceFile */ && (
|
|
87972
|
+
if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 307 /* SourceFile */ && host.getEmitModuleFormatOfFile(node.parent) === 1 /* CommonJS */) {
|
|
87886
87973
|
const exportModifier = (_b = node.modifiers) == null ? void 0 : _b.find((m) => m.kind === 95 /* ExportKeyword */);
|
|
87887
87974
|
if (exportModifier) {
|
|
87888
87975
|
error2(exportModifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
@@ -88102,8 +88189,10 @@ function createTypeChecker(host) {
|
|
|
88102
88189
|
}
|
|
88103
88190
|
}
|
|
88104
88191
|
}
|
|
88105
|
-
if (compilerOptions.verbatimModuleSyntax && node.kind !== 271 /* ImportEqualsDeclaration */ && !isInJSFile(node) && (
|
|
88192
|
+
if (compilerOptions.verbatimModuleSyntax && node.kind !== 271 /* ImportEqualsDeclaration */ && !isInJSFile(node) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
|
|
88106
88193
|
error2(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
88194
|
+
} else if (moduleKind === 200 /* Preserve */ && node.kind !== 271 /* ImportEqualsDeclaration */ && node.kind !== 260 /* VariableDeclaration */ && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
|
|
88195
|
+
error2(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve);
|
|
88107
88196
|
}
|
|
88108
88197
|
}
|
|
88109
88198
|
if (isImportSpecifier(node)) {
|
|
@@ -88144,7 +88233,7 @@ function createTypeChecker(host) {
|
|
|
88144
88233
|
checkAliasSymbol(node);
|
|
88145
88234
|
if (node.kind === 276 /* ImportSpecifier */) {
|
|
88146
88235
|
checkModuleExportName(node.propertyName);
|
|
88147
|
-
if (moduleExportNameIsDefault(node.propertyName || node.name) && getESModuleInterop(compilerOptions) &&
|
|
88236
|
+
if (moduleExportNameIsDefault(node.propertyName || node.name) && getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */) {
|
|
88148
88237
|
checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
|
|
88149
88238
|
}
|
|
88150
88239
|
}
|
|
@@ -88166,7 +88255,7 @@ function createTypeChecker(host) {
|
|
|
88166
88255
|
if (validForTypeAttributes && override) {
|
|
88167
88256
|
return;
|
|
88168
88257
|
}
|
|
88169
|
-
const mode = moduleKind === 199 /* NodeNext */ && declaration.moduleSpecifier &&
|
|
88258
|
+
const mode = moduleKind === 199 /* NodeNext */ && declaration.moduleSpecifier && getEmitSyntaxForModuleSpecifierExpression(declaration.moduleSpecifier);
|
|
88170
88259
|
if (mode !== 99 /* ESNext */ && moduleKind !== 99 /* ESNext */ && moduleKind !== 200 /* Preserve */) {
|
|
88171
88260
|
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;
|
|
88172
88261
|
return grammarErrorOnNode(node, message);
|
|
@@ -88199,7 +88288,7 @@ function createTypeChecker(host) {
|
|
|
88199
88288
|
if (importClause.namedBindings) {
|
|
88200
88289
|
if (importClause.namedBindings.kind === 274 /* NamespaceImport */) {
|
|
88201
88290
|
checkImportBinding(importClause.namedBindings);
|
|
88202
|
-
if (
|
|
88291
|
+
if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && getESModuleInterop(compilerOptions)) {
|
|
88203
88292
|
checkExternalEmitHelpers(node, 65536 /* ImportStar */);
|
|
88204
88293
|
}
|
|
88205
88294
|
} else {
|
|
@@ -88239,7 +88328,7 @@ function createTypeChecker(host) {
|
|
|
88239
88328
|
grammarErrorOnNode(node, Diagnostics.An_import_alias_cannot_use_import_type);
|
|
88240
88329
|
}
|
|
88241
88330
|
} else {
|
|
88242
|
-
if (
|
|
88331
|
+
if (5 /* ES2015 */ <= moduleKind && moduleKind <= 99 /* ESNext */ && !node.isTypeOnly && !(node.flags & 33554432 /* Ambient */)) {
|
|
88243
88332
|
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);
|
|
88244
88333
|
}
|
|
88245
88334
|
}
|
|
@@ -88269,7 +88358,7 @@ function createTypeChecker(host) {
|
|
|
88269
88358
|
checkAliasSymbol(node.exportClause);
|
|
88270
88359
|
checkModuleExportName(node.exportClause.name);
|
|
88271
88360
|
}
|
|
88272
|
-
if (
|
|
88361
|
+
if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */) {
|
|
88273
88362
|
if (node.exportClause) {
|
|
88274
88363
|
if (getESModuleInterop(compilerOptions)) {
|
|
88275
88364
|
checkExternalEmitHelpers(node, 65536 /* ImportStar */);
|
|
@@ -88328,7 +88417,7 @@ function createTypeChecker(host) {
|
|
|
88328
88417
|
markLinkedReferences(node, 7 /* ExportSpecifier */);
|
|
88329
88418
|
}
|
|
88330
88419
|
} else {
|
|
88331
|
-
if (getESModuleInterop(compilerOptions) &&
|
|
88420
|
+
if (getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && moduleExportNameIsDefault(node.propertyName || node.name)) {
|
|
88332
88421
|
checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
|
|
88333
88422
|
}
|
|
88334
88423
|
}
|
|
@@ -88354,7 +88443,7 @@ function createTypeChecker(host) {
|
|
|
88354
88443
|
if (typeAnnotationNode) {
|
|
88355
88444
|
checkTypeAssignableTo(checkExpressionCached(node.expression), getTypeFromTypeNode(typeAnnotationNode), node.expression);
|
|
88356
88445
|
}
|
|
88357
|
-
const isIllegalExportDefaultInCJS = !node.isExportEquals && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax && (
|
|
88446
|
+
const isIllegalExportDefaultInCJS = !node.isExportEquals && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */;
|
|
88358
88447
|
if (node.expression.kind === 80 /* Identifier */) {
|
|
88359
88448
|
const id = node.expression;
|
|
88360
88449
|
const sym = getExportSymbolOfValueSymbolIfExported(resolveEntityName(
|
|
@@ -88434,7 +88523,7 @@ function createTypeChecker(host) {
|
|
|
88434
88523
|
grammarErrorOnNode(node.expression, Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context);
|
|
88435
88524
|
}
|
|
88436
88525
|
if (node.isExportEquals) {
|
|
88437
|
-
if (moduleKind >= 5 /* ES2015 */ && moduleKind !== 200 /* Preserve */ && (node.flags & 33554432 /* Ambient */ && getSourceFileOfNode(node)
|
|
88526
|
+
if (moduleKind >= 5 /* ES2015 */ && moduleKind !== 200 /* Preserve */ && (node.flags & 33554432 /* Ambient */ && host.getImpliedNodeFormatForEmit(getSourceFileOfNode(node)) === 99 /* ESNext */ || !(node.flags & 33554432 /* Ambient */) && host.getImpliedNodeFormatForEmit(getSourceFileOfNode(node)) !== 1 /* CommonJS */)) {
|
|
88438
88527
|
grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
|
|
88439
88528
|
} else if (moduleKind === 4 /* System */ && !(node.flags & 33554432 /* Ambient */)) {
|
|
88440
88529
|
grammarErrorOnNode(node, Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system);
|
|
@@ -90025,10 +90114,13 @@ function createTypeChecker(host) {
|
|
|
90025
90114
|
function checkChildIdentifiers(node2) {
|
|
90026
90115
|
forEachNodeRecursively(node2, checkIdentifiers);
|
|
90027
90116
|
}
|
|
90117
|
+
function isExpressionNodeOrShorthandPropertyAssignmentName(node2) {
|
|
90118
|
+
return isExpressionNode(node2) || isShorthandPropertyAssignment(node2.parent) && (node2.parent.objectAssignmentInitializer ?? node2.parent.name) === node2;
|
|
90119
|
+
}
|
|
90028
90120
|
function checkSingleIdentifier(node2) {
|
|
90029
90121
|
const nodeLinks2 = getNodeLinks(node2);
|
|
90030
90122
|
nodeLinks2.calculatedFlags |= 536870912 /* ConstructorReference */ | 16384 /* CapturedBlockScopedBinding */ | 32768 /* BlockScopedBindingInLoop */;
|
|
90031
|
-
if (isIdentifier(node2) &&
|
|
90123
|
+
if (isIdentifier(node2) && isExpressionNodeOrShorthandPropertyAssignmentName(node2) && !(isPropertyAccessExpression(node2.parent) && node2.parent.name === node2)) {
|
|
90032
90124
|
const s = getResolvedSymbol(node2);
|
|
90033
90125
|
if (s && s !== unknownSymbol) {
|
|
90034
90126
|
checkIdentifierCalculateNodeCheckFlags(node2, s);
|
|
@@ -90976,7 +91068,7 @@ function createTypeChecker(host) {
|
|
|
90976
91068
|
break;
|
|
90977
91069
|
case 95 /* ExportKeyword */:
|
|
90978
91070
|
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
|
|
90979
|
-
node.kind !== 267 /* ModuleDeclaration */ && node.parent.kind === 307 /* SourceFile */ && (
|
|
91071
|
+
node.kind !== 267 /* ModuleDeclaration */ && node.parent.kind === 307 /* SourceFile */ && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
|
|
90980
91072
|
return grammarErrorOnNode(modifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
90981
91073
|
}
|
|
90982
91074
|
if (flags & 32 /* Export */) {
|
|
@@ -91886,7 +91978,7 @@ function createTypeChecker(host) {
|
|
|
91886
91978
|
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;
|
|
91887
91979
|
return grammarErrorOnNode(node.exclamationToken, message);
|
|
91888
91980
|
}
|
|
91889
|
-
if ((
|
|
91981
|
+
if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && !(node.parent.parent.flags & 33554432 /* Ambient */) && hasSyntacticModifier(node.parent.parent, 32 /* Export */)) {
|
|
91890
91982
|
checkESModuleMarker(node.name);
|
|
91891
91983
|
}
|
|
91892
91984
|
return !!blockScopeKind && checkGrammarNameInLetOrConstDeclarations(node.name);
|
|
@@ -92387,7 +92479,9 @@ function createBasicNodeBuilderModuleSpecifierResolutionHost(host) {
|
|
|
92387
92479
|
isSourceOfProjectReferenceRedirect: (fileName) => host.isSourceOfProjectReferenceRedirect(fileName),
|
|
92388
92480
|
fileExists: (fileName) => host.fileExists(fileName),
|
|
92389
92481
|
getFileIncludeReasons: () => host.getFileIncludeReasons(),
|
|
92390
|
-
readFile: host.readFile ? (fileName) => host.readFile(fileName) : void 0
|
|
92482
|
+
readFile: host.readFile ? (fileName) => host.readFile(fileName) : void 0,
|
|
92483
|
+
getDefaultResolutionModeForFile: (file) => host.getDefaultResolutionModeForFile(file),
|
|
92484
|
+
getModeForResolutionAtIndex: (file, index) => host.getModeForResolutionAtIndex(file, index)
|
|
92391
92485
|
};
|
|
92392
92486
|
}
|
|
92393
92487
|
var SymbolTrackerImpl = class _SymbolTrackerImpl {
|
|
@@ -112240,7 +112334,7 @@ function transformModule(context) {
|
|
|
112240
112334
|
case 354 /* PartiallyEmittedExpression */:
|
|
112241
112335
|
return visitPartiallyEmittedExpression(node, valueIsDiscarded);
|
|
112242
112336
|
case 213 /* CallExpression */:
|
|
112243
|
-
if (isImportCall(node) && currentSourceFile
|
|
112337
|
+
if (isImportCall(node) && host.shouldTransformImportCall(currentSourceFile)) {
|
|
112244
112338
|
return visitImportCallExpression(node);
|
|
112245
112339
|
}
|
|
112246
112340
|
break;
|
|
@@ -115236,8 +115330,8 @@ function transformECMAScriptModule(context) {
|
|
|
115236
115330
|
}
|
|
115237
115331
|
}
|
|
115238
115332
|
|
|
115239
|
-
// src/compiler/transformers/module/
|
|
115240
|
-
function
|
|
115333
|
+
// src/compiler/transformers/module/impliedNodeFormatDependent.ts
|
|
115334
|
+
function transformImpliedNodeFormatDependentModule(context) {
|
|
115241
115335
|
const previousOnSubstituteNode = context.onSubstituteNode;
|
|
115242
115336
|
const previousOnEmitNode = context.onEmitNode;
|
|
115243
115337
|
const esmTransform = transformECMAScriptModule(context);
|
|
@@ -115248,6 +115342,7 @@ function transformNodeModule(context) {
|
|
|
115248
115342
|
const cjsTransform = transformModule(context);
|
|
115249
115343
|
const cjsOnSubstituteNode = context.onSubstituteNode;
|
|
115250
115344
|
const cjsOnEmitNode = context.onEmitNode;
|
|
115345
|
+
const getEmitModuleFormatOfFile2 = (file) => context.getEmitHost().getEmitModuleFormatOfFile(file);
|
|
115251
115346
|
context.onSubstituteNode = onSubstituteNode;
|
|
115252
115347
|
context.onEmitNode = onEmitNode;
|
|
115253
115348
|
context.enableSubstitution(307 /* SourceFile */);
|
|
@@ -115262,7 +115357,7 @@ function transformNodeModule(context) {
|
|
|
115262
115357
|
if (!currentSourceFile) {
|
|
115263
115358
|
return previousOnSubstituteNode(hint, node);
|
|
115264
115359
|
}
|
|
115265
|
-
if (currentSourceFile
|
|
115360
|
+
if (getEmitModuleFormatOfFile2(currentSourceFile) >= 5 /* ES2015 */) {
|
|
115266
115361
|
return esmOnSubstituteNode(hint, node);
|
|
115267
115362
|
}
|
|
115268
115363
|
return cjsOnSubstituteNode(hint, node);
|
|
@@ -115275,13 +115370,13 @@ function transformNodeModule(context) {
|
|
|
115275
115370
|
if (!currentSourceFile) {
|
|
115276
115371
|
return previousOnEmitNode(hint, node, emitCallback);
|
|
115277
115372
|
}
|
|
115278
|
-
if (currentSourceFile
|
|
115373
|
+
if (getEmitModuleFormatOfFile2(currentSourceFile) >= 5 /* ES2015 */) {
|
|
115279
115374
|
return esmOnEmitNode(hint, node, emitCallback);
|
|
115280
115375
|
}
|
|
115281
115376
|
return cjsOnEmitNode(hint, node, emitCallback);
|
|
115282
115377
|
}
|
|
115283
115378
|
function getModuleTransformForFile(file) {
|
|
115284
|
-
return file
|
|
115379
|
+
return getEmitModuleFormatOfFile2(file) >= 5 /* ES2015 */ ? esmTransform : cjsTransform;
|
|
115285
115380
|
}
|
|
115286
115381
|
function transformSourceFile(node) {
|
|
115287
115382
|
if (node.isDeclarationFile) {
|
|
@@ -117406,17 +117501,18 @@ function isProcessedComponent(node) {
|
|
|
117406
117501
|
// src/compiler/transformer.ts
|
|
117407
117502
|
function getModuleTransformer(moduleKind) {
|
|
117408
117503
|
switch (moduleKind) {
|
|
117504
|
+
case 200 /* Preserve */:
|
|
117505
|
+
return transformECMAScriptModule;
|
|
117409
117506
|
case 99 /* ESNext */:
|
|
117410
117507
|
case 7 /* ES2022 */:
|
|
117411
117508
|
case 6 /* ES2020 */:
|
|
117412
117509
|
case 5 /* ES2015 */:
|
|
117413
|
-
case 200 /* Preserve */:
|
|
117414
|
-
return transformECMAScriptModule;
|
|
117415
|
-
case 4 /* System */:
|
|
117416
|
-
return transformSystemModule;
|
|
117417
117510
|
case 100 /* Node16 */:
|
|
117418
117511
|
case 199 /* NodeNext */:
|
|
117419
|
-
|
|
117512
|
+
case 1 /* CommonJS */:
|
|
117513
|
+
return transformImpliedNodeFormatDependentModule;
|
|
117514
|
+
case 4 /* System */:
|
|
117515
|
+
return transformSystemModule;
|
|
117420
117516
|
default:
|
|
117421
117517
|
return transformModule;
|
|
117422
117518
|
}
|
|
@@ -118144,6 +118240,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
118144
118240
|
newLine: compilerOptions.newLine,
|
|
118145
118241
|
noEmitHelpers: compilerOptions.noEmitHelpers,
|
|
118146
118242
|
module: getEmitModuleKind(compilerOptions),
|
|
118243
|
+
moduleResolution: getEmitModuleResolutionKind(compilerOptions),
|
|
118147
118244
|
target: getEmitScriptTarget(compilerOptions),
|
|
118148
118245
|
sourceMap: compilerOptions.sourceMap,
|
|
118149
118246
|
inlineSourceMap: compilerOptions.inlineSourceMap,
|
|
@@ -118206,8 +118303,9 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
118206
118303
|
newLine: compilerOptions.newLine,
|
|
118207
118304
|
noEmitHelpers: true,
|
|
118208
118305
|
module: compilerOptions.module,
|
|
118306
|
+
moduleResolution: compilerOptions.moduleResolution,
|
|
118209
118307
|
target: compilerOptions.target,
|
|
118210
|
-
sourceMap:
|
|
118308
|
+
sourceMap: emitOnly !== 2 /* BuilderSignature */ && compilerOptions.declarationMap,
|
|
118211
118309
|
inlineSourceMap: compilerOptions.inlineSourceMap,
|
|
118212
118310
|
extendedDiagnostics: compilerOptions.extendedDiagnostics,
|
|
118213
118311
|
onlyPrintJsDocStyle: true,
|
|
@@ -123724,7 +123822,6 @@ function getModeForUsageLocation(file, usage, compilerOptions) {
|
|
|
123724
123822
|
return getModeForUsageLocationWorker(file, usage, compilerOptions);
|
|
123725
123823
|
}
|
|
123726
123824
|
function getModeForUsageLocationWorker(file, usage, compilerOptions) {
|
|
123727
|
-
var _a;
|
|
123728
123825
|
if (isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent) || isJSDocImportTag(usage.parent)) {
|
|
123729
123826
|
const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(usage.parent);
|
|
123730
123827
|
if (isTypeOnly) {
|
|
@@ -123740,19 +123837,28 @@ function getModeForUsageLocationWorker(file, usage, compilerOptions) {
|
|
|
123740
123837
|
return override;
|
|
123741
123838
|
}
|
|
123742
123839
|
}
|
|
123743
|
-
if (compilerOptions &&
|
|
123744
|
-
return usage
|
|
123745
|
-
usage.parent,
|
|
123746
|
-
/*requireStringLiteralLikeArgument*/
|
|
123747
|
-
false
|
|
123748
|
-
) ? 1 /* CommonJS */ : 99 /* ESNext */;
|
|
123840
|
+
if (compilerOptions && importSyntaxAffectsModuleResolution(compilerOptions)) {
|
|
123841
|
+
return getEmitSyntaxForUsageLocationWorker(file, usage, compilerOptions);
|
|
123749
123842
|
}
|
|
123750
|
-
|
|
123751
|
-
|
|
123752
|
-
|
|
123843
|
+
}
|
|
123844
|
+
function getEmitSyntaxForUsageLocationWorker(file, usage, compilerOptions) {
|
|
123845
|
+
var _a;
|
|
123846
|
+
if (!compilerOptions) {
|
|
123847
|
+
return void 0;
|
|
123753
123848
|
}
|
|
123754
123849
|
const exprParentParent = (_a = walkUpParenthesizedExpressions(usage.parent)) == null ? void 0 : _a.parent;
|
|
123755
|
-
|
|
123850
|
+
if (exprParentParent && isImportEqualsDeclaration(exprParentParent) || isRequireCall(
|
|
123851
|
+
usage.parent,
|
|
123852
|
+
/*requireStringLiteralLikeArgument*/
|
|
123853
|
+
false
|
|
123854
|
+
)) {
|
|
123855
|
+
return 1 /* CommonJS */;
|
|
123856
|
+
}
|
|
123857
|
+
if (isImportCall(walkUpParenthesizedExpressions(usage.parent))) {
|
|
123858
|
+
return shouldTransformImportCallWorker(file, compilerOptions) ? 1 /* CommonJS */ : 99 /* ESNext */;
|
|
123859
|
+
}
|
|
123860
|
+
const fileEmitMode = getEmitModuleFormatOfFileWorker(file, compilerOptions);
|
|
123861
|
+
return fileEmitMode === 1 /* CommonJS */ ? 1 /* CommonJS */ : emitModuleKindIsNonNodeESM(fileEmitMode) || fileEmitMode === 200 /* Preserve */ ? 99 /* ESNext */ : void 0;
|
|
123756
123862
|
}
|
|
123757
123863
|
function getResolutionModeOverride(node, grammarErrorOnNode) {
|
|
123758
123864
|
if (!node) return void 0;
|
|
@@ -123809,7 +123915,7 @@ function getTypeReferenceResolutionName(entry) {
|
|
|
123809
123915
|
}
|
|
123810
123916
|
var typeReferenceResolutionNameAndModeGetter = {
|
|
123811
123917
|
getName: getTypeReferenceResolutionName,
|
|
123812
|
-
getMode: (entry, file) => getModeForFileReference(entry, file
|
|
123918
|
+
getMode: (entry, file, compilerOptions) => getModeForFileReference(entry, file && getDefaultResolutionModeForFileWorker(file, compilerOptions))
|
|
123813
123919
|
};
|
|
123814
123920
|
function createTypeReferenceResolutionLoader(containingFile, redirectedReference, options, host, cache) {
|
|
123815
123921
|
return {
|
|
@@ -123995,7 +124101,7 @@ function getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host,
|
|
|
123995
124101
|
const packageJsonLocations = [];
|
|
123996
124102
|
state.failedLookupLocations = packageJsonLocations;
|
|
123997
124103
|
state.affectingLocations = packageJsonLocations;
|
|
123998
|
-
const packageJsonScope = getPackageScopeForPath(fileName, state);
|
|
124104
|
+
const packageJsonScope = getPackageScopeForPath(getDirectoryPath(fileName), state);
|
|
123999
124105
|
const impliedNodeFormat = (packageJsonScope == null ? void 0 : packageJsonScope.contents.packageJsonContent.type) === "module" ? 99 /* ESNext */ : 1 /* CommonJS */;
|
|
124000
124106
|
return { impliedNodeFormat, packageJsonLocations, packageJsonScope };
|
|
124001
124107
|
}
|
|
@@ -124449,6 +124555,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
124449
124555
|
isSourceFileFromExternalLibrary,
|
|
124450
124556
|
isSourceFileDefaultLibrary,
|
|
124451
124557
|
getModeForUsageLocation: getModeForUsageLocation2,
|
|
124558
|
+
getEmitSyntaxForUsageLocation,
|
|
124452
124559
|
getModeForResolutionAtIndex: getModeForResolutionAtIndex2,
|
|
124453
124560
|
getSourceFileFromReference,
|
|
124454
124561
|
getLibFileFromReference,
|
|
@@ -124477,6 +124584,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
124477
124584
|
forEachResolvedProjectReference: forEachResolvedProjectReference2,
|
|
124478
124585
|
isSourceOfProjectReferenceRedirect,
|
|
124479
124586
|
getRedirectReferenceForResolutionFromSourceOfProject,
|
|
124587
|
+
getCompilerOptionsForFile,
|
|
124588
|
+
getDefaultResolutionModeForFile: getDefaultResolutionModeForFile2,
|
|
124589
|
+
getEmitModuleFormatOfFile: getEmitModuleFormatOfFile2,
|
|
124590
|
+
getImpliedNodeFormatForEmit: getImpliedNodeFormatForEmit2,
|
|
124591
|
+
shouldTransformImportCall,
|
|
124480
124592
|
emitBuildInfo,
|
|
124481
124593
|
fileExists,
|
|
124482
124594
|
readFile,
|
|
@@ -125031,6 +125143,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
125031
125143
|
getSymlinkCache,
|
|
125032
125144
|
writeFile: writeFileCallback || writeFile2,
|
|
125033
125145
|
isEmitBlocked,
|
|
125146
|
+
shouldTransformImportCall,
|
|
125147
|
+
getEmitModuleFormatOfFile: getEmitModuleFormatOfFile2,
|
|
125148
|
+
getDefaultResolutionModeForFile: getDefaultResolutionModeForFile2,
|
|
125149
|
+
getModeForResolutionAtIndex: getModeForResolutionAtIndex2,
|
|
125034
125150
|
readFile: (f) => host.readFile(f),
|
|
125035
125151
|
fileExists: (f) => {
|
|
125036
125152
|
const path = toPath3(f);
|
|
@@ -126110,10 +126226,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
126110
126226
|
const resolvedTypeReferenceDirective = resolutions[index];
|
|
126111
126227
|
const fileName = ref.fileName;
|
|
126112
126228
|
resolutionsInFile.set(fileName, getModeForFileReference(ref, file.impliedNodeFormat), resolvedTypeReferenceDirective);
|
|
126113
|
-
const mode = ref.resolutionMode || file
|
|
126229
|
+
const mode = ref.resolutionMode || getDefaultResolutionModeForFile2(file);
|
|
126114
126230
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: 5 /* TypeReferenceDirective */, file: file.path, index });
|
|
126115
126231
|
}
|
|
126116
126232
|
}
|
|
126233
|
+
function getCompilerOptionsForFile(file) {
|
|
126234
|
+
var _a2;
|
|
126235
|
+
return ((_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options) || options;
|
|
126236
|
+
}
|
|
126117
126237
|
function processTypeReferenceDirective(typeReferenceDirective, mode, resolution, reason) {
|
|
126118
126238
|
var _a2, _b2;
|
|
126119
126239
|
(_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 });
|
|
@@ -126214,13 +126334,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
126214
126334
|
return host.getCanonicalFileName(fileName);
|
|
126215
126335
|
}
|
|
126216
126336
|
function processImportedModules(file) {
|
|
126217
|
-
var _a2;
|
|
126218
126337
|
collectExternalModuleReferences(file);
|
|
126219
126338
|
if (file.imports.length || file.moduleAugmentations.length) {
|
|
126220
126339
|
const moduleNames = getModuleNames(file);
|
|
126221
126340
|
const resolutions = (resolvedModulesProcessing == null ? void 0 : resolvedModulesProcessing.get(file.path)) || resolveModuleNamesReusingOldState(moduleNames, file);
|
|
126222
126341
|
Debug.assert(resolutions.length === moduleNames.length);
|
|
126223
|
-
const optionsForFile = (
|
|
126342
|
+
const optionsForFile = getCompilerOptionsForFile(file);
|
|
126224
126343
|
const resolutionsInFile = createModeAwareCache();
|
|
126225
126344
|
(resolvedModules ?? (resolvedModules = /* @__PURE__ */ new Map())).set(file.path, resolutionsInFile);
|
|
126226
126345
|
for (let index = 0; index < moduleNames.length; index++) {
|
|
@@ -126769,7 +126888,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
126769
126888
|
redirectInfo = cachedChain.redirectInfo;
|
|
126770
126889
|
} else {
|
|
126771
126890
|
reasons == null ? void 0 : reasons.forEach(processReason);
|
|
126772
|
-
redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file);
|
|
126891
|
+
redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file, getCompilerOptionsForFile(file));
|
|
126773
126892
|
}
|
|
126774
126893
|
if (fileProcessingReason) processReason(fileProcessingReason);
|
|
126775
126894
|
const processedExtraReason = (seenReasons == null ? void 0 : seenReasons.size) !== (reasons == null ? void 0 : reasons.length);
|
|
@@ -127127,13 +127246,53 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
127127
127246
|
return symlinks;
|
|
127128
127247
|
}
|
|
127129
127248
|
function getModeForUsageLocation2(file, usage) {
|
|
127130
|
-
|
|
127131
|
-
|
|
127132
|
-
|
|
127249
|
+
return getModeForUsageLocationWorker(file, usage, getCompilerOptionsForFile(file));
|
|
127250
|
+
}
|
|
127251
|
+
function getEmitSyntaxForUsageLocation(file, usage) {
|
|
127252
|
+
return getEmitSyntaxForUsageLocationWorker(file, usage, getCompilerOptionsForFile(file));
|
|
127133
127253
|
}
|
|
127134
127254
|
function getModeForResolutionAtIndex2(file, index) {
|
|
127135
127255
|
return getModeForUsageLocation2(file, getModuleNameStringLiteralAt(file, index));
|
|
127136
127256
|
}
|
|
127257
|
+
function getDefaultResolutionModeForFile2(sourceFile) {
|
|
127258
|
+
return getDefaultResolutionModeForFileWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
|
|
127259
|
+
}
|
|
127260
|
+
function getImpliedNodeFormatForEmit2(sourceFile) {
|
|
127261
|
+
return getImpliedNodeFormatForEmitWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
|
|
127262
|
+
}
|
|
127263
|
+
function getEmitModuleFormatOfFile2(sourceFile) {
|
|
127264
|
+
return getEmitModuleFormatOfFileWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
|
|
127265
|
+
}
|
|
127266
|
+
function shouldTransformImportCall(sourceFile) {
|
|
127267
|
+
return shouldTransformImportCallWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
|
|
127268
|
+
}
|
|
127269
|
+
}
|
|
127270
|
+
function shouldTransformImportCallWorker(sourceFile, options) {
|
|
127271
|
+
const moduleKind = getEmitModuleKind(options);
|
|
127272
|
+
if (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */ || moduleKind === 200 /* Preserve */) {
|
|
127273
|
+
return false;
|
|
127274
|
+
}
|
|
127275
|
+
return getEmitModuleFormatOfFileWorker(sourceFile, options) < 5 /* ES2015 */;
|
|
127276
|
+
}
|
|
127277
|
+
function getEmitModuleFormatOfFileWorker(sourceFile, options) {
|
|
127278
|
+
return getImpliedNodeFormatForEmitWorker(sourceFile, options) ?? getEmitModuleKind(options);
|
|
127279
|
+
}
|
|
127280
|
+
function getImpliedNodeFormatForEmitWorker(sourceFile, options) {
|
|
127281
|
+
var _a, _b;
|
|
127282
|
+
const moduleKind = getEmitModuleKind(options);
|
|
127283
|
+
if (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
|
|
127284
|
+
return sourceFile.impliedNodeFormat;
|
|
127285
|
+
}
|
|
127286
|
+
if (sourceFile.impliedNodeFormat === 1 /* CommonJS */ && (((_a = sourceFile.packageJsonScope) == null ? void 0 : _a.contents.packageJsonContent.type) === "commonjs" || fileExtensionIsOneOf(sourceFile.fileName, [".cjs" /* Cjs */, ".cts" /* Cts */]))) {
|
|
127287
|
+
return 1 /* CommonJS */;
|
|
127288
|
+
}
|
|
127289
|
+
if (sourceFile.impliedNodeFormat === 99 /* ESNext */ && (((_b = sourceFile.packageJsonScope) == null ? void 0 : _b.contents.packageJsonContent.type) === "module" || fileExtensionIsOneOf(sourceFile.fileName, [".mjs" /* Mjs */, ".mts" /* Mts */]))) {
|
|
127290
|
+
return 99 /* ESNext */;
|
|
127291
|
+
}
|
|
127292
|
+
return void 0;
|
|
127293
|
+
}
|
|
127294
|
+
function getDefaultResolutionModeForFileWorker(sourceFile, options) {
|
|
127295
|
+
return importSyntaxAffectsModuleResolution(options) ? getImpliedNodeFormatForEmitWorker(sourceFile, options) : void 0;
|
|
127137
127296
|
}
|
|
127138
127297
|
function updateHostForUseSourceOfProjectReferenceRedirect(host) {
|
|
127139
127298
|
let setOfDeclarationDirectories;
|
|
@@ -127602,8 +127761,7 @@ var BuilderState;
|
|
|
127602
127761
|
);
|
|
127603
127762
|
},
|
|
127604
127763
|
cancellationToken,
|
|
127605
|
-
/*
|
|
127606
|
-
true,
|
|
127764
|
+
2 /* BuilderSignature */,
|
|
127607
127765
|
/*customTransformers*/
|
|
127608
127766
|
void 0,
|
|
127609
127767
|
/*forceDtsEmit*/
|
|
@@ -127939,7 +128097,12 @@ function repopulateDiagnostics(diagnostics, newProgram) {
|
|
|
127939
128097
|
}
|
|
127940
128098
|
function convertOrRepopulateDiagnosticMessageChain(chain, sourceFile, newProgram, repopulateInfo) {
|
|
127941
128099
|
const info = repopulateInfo(chain);
|
|
127942
|
-
if (info) {
|
|
128100
|
+
if (info === true) {
|
|
128101
|
+
return {
|
|
128102
|
+
...createModeMismatchDetails(sourceFile),
|
|
128103
|
+
next: convertOrRepopulateDiagnosticMessageChainArray(chain.next, sourceFile, newProgram, repopulateInfo)
|
|
128104
|
+
};
|
|
128105
|
+
} else if (info) {
|
|
127943
128106
|
return {
|
|
127944
128107
|
...createModuleNotFoundChain(sourceFile, newProgram, info.moduleReference, info.mode, info.packageName || info.moduleReference),
|
|
127945
128108
|
next: convertOrRepopulateDiagnosticMessageChainArray(chain.next, sourceFile, newProgram, repopulateInfo)
|
|
@@ -129702,7 +129865,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
129702
129865
|
cleanupLibResolutionWatching(newProgram);
|
|
129703
129866
|
newProgram == null ? void 0 : newProgram.getSourceFiles().forEach((newFile) => {
|
|
129704
129867
|
var _a;
|
|
129705
|
-
const expected =
|
|
129868
|
+
const expected = ((_a = newFile.packageJsonLocations) == null ? void 0 : _a.length) ?? 0;
|
|
129706
129869
|
const existing = impliedFormatPackageJsons.get(newFile.resolvedPath) ?? emptyArray;
|
|
129707
129870
|
for (let i = existing.length; i < expected; i++) {
|
|
129708
129871
|
createFileWatcherOfAffectingLocation(
|
|
@@ -130594,10 +130757,10 @@ function explainFiles(program, write) {
|
|
|
130594
130757
|
for (const file of program.getSourceFiles()) {
|
|
130595
130758
|
write(`${toFileName(file, relativeFileName)}`);
|
|
130596
130759
|
(_a = reasons.get(file.path)) == null ? void 0 : _a.forEach((reason) => write(` ${fileIncludeReasonToDiagnostics(program, reason, relativeFileName).messageText}`));
|
|
130597
|
-
(_b = explainIfFileIsRedirectAndImpliedFormat(file, relativeFileName)) == null ? void 0 : _b.forEach((d) => write(` ${d.messageText}`));
|
|
130760
|
+
(_b = explainIfFileIsRedirectAndImpliedFormat(file, program.getCompilerOptionsForFile(file), relativeFileName)) == null ? void 0 : _b.forEach((d) => write(` ${d.messageText}`));
|
|
130598
130761
|
}
|
|
130599
130762
|
}
|
|
130600
|
-
function explainIfFileIsRedirectAndImpliedFormat(file, fileNameConvertor) {
|
|
130763
|
+
function explainIfFileIsRedirectAndImpliedFormat(file, options, fileNameConvertor) {
|
|
130601
130764
|
var _a;
|
|
130602
130765
|
let result;
|
|
130603
130766
|
if (file.path !== file.resolvedPath) {
|
|
@@ -130617,7 +130780,7 @@ function explainIfFileIsRedirectAndImpliedFormat(file, fileNameConvertor) {
|
|
|
130617
130780
|
));
|
|
130618
130781
|
}
|
|
130619
130782
|
if (isExternalOrCommonJsModule(file)) {
|
|
130620
|
-
switch (file
|
|
130783
|
+
switch (getImpliedNodeFormatForEmitWorker(file, options)) {
|
|
130621
130784
|
case 99 /* ESNext */:
|
|
130622
130785
|
if (file.packageJsonScope) {
|
|
130623
130786
|
(result ?? (result = [])).push(chainDiagnosticMessages(
|
|
@@ -137154,7 +137317,9 @@ function createModuleSpecifierResolutionHost(program, host) {
|
|
|
137154
137317
|
isSourceOfProjectReferenceRedirect: (fileName) => program.isSourceOfProjectReferenceRedirect(fileName),
|
|
137155
137318
|
getNearestAncestorDirectoryWithPackageJson: maybeBind(host, host.getNearestAncestorDirectoryWithPackageJson),
|
|
137156
137319
|
getFileIncludeReasons: () => program.getFileIncludeReasons(),
|
|
137157
|
-
getCommonSourceDirectory: () => program.getCommonSourceDirectory()
|
|
137320
|
+
getCommonSourceDirectory: () => program.getCommonSourceDirectory(),
|
|
137321
|
+
getDefaultResolutionModeForFile: (file) => program.getDefaultResolutionModeForFile(file),
|
|
137322
|
+
getModeForResolutionAtIndex: (file, index) => program.getModeForResolutionAtIndex(file, index)
|
|
137158
137323
|
};
|
|
137159
137324
|
}
|
|
137160
137325
|
function getModuleSpecifierResolverHost(program, host) {
|
|
@@ -138251,36 +138416,12 @@ function mapOneOrMany(valueOrArray, f, resultSelector = identity) {
|
|
|
138251
138416
|
function firstOrOnly(valueOrArray) {
|
|
138252
138417
|
return isArray(valueOrArray) ? first(valueOrArray) : valueOrArray;
|
|
138253
138418
|
}
|
|
138254
|
-
function getNamesForExportedSymbol(symbol, scriptTarget) {
|
|
138255
|
-
if (needsNameFromDeclaration(symbol)) {
|
|
138256
|
-
const fromDeclaration = getDefaultLikeExportNameFromDeclaration(symbol);
|
|
138257
|
-
if (fromDeclaration) return fromDeclaration;
|
|
138258
|
-
const fileNameCase = moduleSymbolToValidIdentifier(
|
|
138259
|
-
getSymbolParentOrFail(symbol),
|
|
138260
|
-
scriptTarget,
|
|
138261
|
-
/*forceCapitalize*/
|
|
138262
|
-
false
|
|
138263
|
-
);
|
|
138264
|
-
const capitalized = moduleSymbolToValidIdentifier(
|
|
138265
|
-
getSymbolParentOrFail(symbol),
|
|
138266
|
-
scriptTarget,
|
|
138267
|
-
/*forceCapitalize*/
|
|
138268
|
-
true
|
|
138269
|
-
);
|
|
138270
|
-
if (fileNameCase === capitalized) return fileNameCase;
|
|
138271
|
-
return [fileNameCase, capitalized];
|
|
138272
|
-
}
|
|
138273
|
-
return symbol.name;
|
|
138274
|
-
}
|
|
138275
138419
|
function getNameForExportedSymbol(symbol, scriptTarget, preferCapitalized) {
|
|
138276
|
-
if (
|
|
138420
|
+
if (symbol.escapedName === "export=" /* ExportEquals */ || symbol.escapedName === "default" /* Default */) {
|
|
138277
138421
|
return getDefaultLikeExportNameFromDeclaration(symbol) || moduleSymbolToValidIdentifier(getSymbolParentOrFail(symbol), scriptTarget, !!preferCapitalized);
|
|
138278
138422
|
}
|
|
138279
138423
|
return symbol.name;
|
|
138280
138424
|
}
|
|
138281
|
-
function needsNameFromDeclaration(symbol) {
|
|
138282
|
-
return !(symbol.flags & 33554432 /* Transient */) && (symbol.escapedName === "export=" /* ExportEquals */ || symbol.escapedName === "default" /* Default */);
|
|
138283
|
-
}
|
|
138284
138425
|
function getDefaultLikeExportNameFromDeclaration(symbol) {
|
|
138285
138426
|
return firstDefined(symbol.declarations, (d) => {
|
|
138286
138427
|
var _a, _b, _c;
|
|
@@ -138443,9 +138584,13 @@ function fileShouldUseJavaScriptRequire(file, program, host, preferRequire) {
|
|
|
138443
138584
|
if (!hasJSFileExtension(fileName)) {
|
|
138444
138585
|
return false;
|
|
138445
138586
|
}
|
|
138446
|
-
const compilerOptions = program.getCompilerOptions();
|
|
138587
|
+
const compilerOptions = typeof file === "string" ? program.getCompilerOptions() : program.getCompilerOptionsForFile(file);
|
|
138447
138588
|
const moduleKind = getEmitModuleKind(compilerOptions);
|
|
138448
|
-
const
|
|
138589
|
+
const sourceFileLike = typeof file === "string" ? {
|
|
138590
|
+
fileName: file,
|
|
138591
|
+
impliedNodeFormat: getImpliedNodeFormatForFile(toPath(file, host.getCurrentDirectory(), hostGetCanonicalFileName(host)), (_a = program.getPackageJsonInfoCache) == null ? void 0 : _a.call(program), host, compilerOptions)
|
|
138592
|
+
} : file;
|
|
138593
|
+
const impliedNodeFormat = getImpliedNodeFormatForEmitWorker(sourceFileLike, compilerOptions);
|
|
138449
138594
|
if (impliedNodeFormat === 99 /* ESNext */) {
|
|
138450
138595
|
return false;
|
|
138451
138596
|
}
|
|
@@ -138557,6 +138702,7 @@ function createCacheableExportInfoMap(host) {
|
|
|
138557
138702
|
const namedSymbol = isDefault && getLocalSymbolForExportDefault(symbol) || symbol;
|
|
138558
138703
|
const names = exportKind === 0 /* Named */ || isExternalModuleSymbol(namedSymbol) ? unescapeLeadingUnderscores(symbolTableKey) : getNamesForExportedSymbol(
|
|
138559
138704
|
namedSymbol,
|
|
138705
|
+
checker,
|
|
138560
138706
|
/*scriptTarget*/
|
|
138561
138707
|
void 0
|
|
138562
138708
|
);
|
|
@@ -138892,7 +139038,15 @@ function getDefaultLikeExportInfo(moduleSymbol, checker) {
|
|
|
138892
139038
|
function isImportableSymbol(symbol, checker) {
|
|
138893
139039
|
return !checker.isUndefinedSymbol(symbol) && !checker.isUnknownSymbol(symbol) && !isKnownSymbol(symbol) && !isPrivateIdentifierSymbol(symbol);
|
|
138894
139040
|
}
|
|
138895
|
-
function
|
|
139041
|
+
function getNamesForExportedSymbol(defaultExport, checker, scriptTarget) {
|
|
139042
|
+
let names;
|
|
139043
|
+
forEachNameOfDefaultExport(defaultExport, checker, scriptTarget, (name, capitalizedName) => {
|
|
139044
|
+
names = capitalizedName ? [name, capitalizedName] : name;
|
|
139045
|
+
return true;
|
|
139046
|
+
});
|
|
139047
|
+
return Debug.checkDefined(names);
|
|
139048
|
+
}
|
|
139049
|
+
function forEachNameOfDefaultExport(defaultExport, checker, scriptTarget, cb) {
|
|
138896
139050
|
let chain;
|
|
138897
139051
|
let current = defaultExport;
|
|
138898
139052
|
const seen = /* @__PURE__ */ new Map();
|
|
@@ -138912,7 +139066,20 @@ function forEachNameOfDefaultExport(defaultExport, checker, compilerOptions, pre
|
|
|
138912
139066
|
}
|
|
138913
139067
|
for (const symbol of chain ?? emptyArray) {
|
|
138914
139068
|
if (symbol.parent && isExternalModuleSymbol(symbol.parent)) {
|
|
138915
|
-
const final = cb(
|
|
139069
|
+
const final = cb(
|
|
139070
|
+
moduleSymbolToValidIdentifier(
|
|
139071
|
+
symbol.parent,
|
|
139072
|
+
scriptTarget,
|
|
139073
|
+
/*forceCapitalize*/
|
|
139074
|
+
false
|
|
139075
|
+
),
|
|
139076
|
+
moduleSymbolToValidIdentifier(
|
|
139077
|
+
symbol.parent,
|
|
139078
|
+
scriptTarget,
|
|
139079
|
+
/*forceCapitalize*/
|
|
139080
|
+
true
|
|
139081
|
+
)
|
|
139082
|
+
);
|
|
138916
139083
|
if (final) return final;
|
|
138917
139084
|
}
|
|
138918
139085
|
}
|
|
@@ -141438,7 +141605,7 @@ function computeSuggestionDiagnostics(sourceFile, program, cancellationToken) {
|
|
|
141438
141605
|
program.getSemanticDiagnostics(sourceFile, cancellationToken);
|
|
141439
141606
|
const diags = [];
|
|
141440
141607
|
const checker = program.getTypeChecker();
|
|
141441
|
-
const isCommonJSFile = sourceFile
|
|
141608
|
+
const isCommonJSFile = program.getImpliedNodeFormatForEmit(sourceFile) === 1 /* CommonJS */ || fileExtensionIsOneOf(sourceFile.fileName, [".cts" /* Cts */, ".cjs" /* Cjs */]);
|
|
141442
141609
|
if (!isCommonJSFile && sourceFile.commonJsModuleIndicator && (programContainsEsModules(program) || compilerOptionsIndicateEsModules(program.getCompilerOptions())) && containsTopLevelCommonjs(sourceFile)) {
|
|
141443
141610
|
diags.push(createDiagnosticForNode(getErrorNodeFromCommonJsIndicator(sourceFile.commonJsModuleIndicator), Diagnostics.File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module));
|
|
141444
141611
|
}
|
|
@@ -154552,7 +154719,7 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
|
|
|
154552
154719
|
compilerOptions,
|
|
154553
154720
|
createModuleSpecifierResolutionHost(program, host)
|
|
154554
154721
|
);
|
|
154555
|
-
const importKind = getImportKind(futureExportingSourceFile, exportKind,
|
|
154722
|
+
const importKind = getImportKind(futureExportingSourceFile, exportKind, program);
|
|
154556
154723
|
const addAsTypeOnly = getAddAsTypeOnly(
|
|
154557
154724
|
isImportUsageValidAsTypeOnly,
|
|
154558
154725
|
/*isForNewImportDeclaration*/
|
|
@@ -154892,7 +155059,7 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
|
|
|
154892
155059
|
}
|
|
154893
155060
|
function createImportSpecifierResolver(importingFile, program, host, preferences) {
|
|
154894
155061
|
const packageJsonImportFilter = createPackageJsonImportFilter(importingFile, preferences, host);
|
|
154895
|
-
const importMap = createExistingImportMap(
|
|
155062
|
+
const importMap = createExistingImportMap(importingFile, program);
|
|
154896
155063
|
return { getModuleSpecifierForBestExportInfo };
|
|
154897
155064
|
function getModuleSpecifierForBestExportInfo(exportInfo, position, isValidTypeOnlyUseSite, fromCacheOnly) {
|
|
154898
155065
|
const { fixes, computedWithoutCacheCount } = getImportFixes(
|
|
@@ -154999,7 +155166,7 @@ function getSingleExportInfoForSymbol(symbol, symbolName2, moduleSymbol, program
|
|
|
154999
155166
|
}
|
|
155000
155167
|
}
|
|
155001
155168
|
}
|
|
155002
|
-
function getImportFixes(exportInfos, usagePosition, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences, importMap = isFullSourceFile(sourceFile) ? createExistingImportMap(
|
|
155169
|
+
function getImportFixes(exportInfos, usagePosition, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences, importMap = isFullSourceFile(sourceFile) ? createExistingImportMap(sourceFile, program) : void 0, fromCacheOnly) {
|
|
155003
155170
|
const checker = program.getTypeChecker();
|
|
155004
155171
|
const existingImports = importMap ? flatMap(exportInfos, importMap.getImportsForExportInfo) : emptyArray;
|
|
155005
155172
|
const useNamespace = usagePosition !== void 0 && tryUseExistingNamespaceImport(existingImports, usagePosition);
|
|
@@ -155114,7 +155281,8 @@ function tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker
|
|
|
155114
155281
|
};
|
|
155115
155282
|
}
|
|
155116
155283
|
}
|
|
155117
|
-
function createExistingImportMap(
|
|
155284
|
+
function createExistingImportMap(importingFile, program) {
|
|
155285
|
+
const checker = program.getTypeChecker();
|
|
155118
155286
|
let importMap;
|
|
155119
155287
|
for (const moduleSpecifier of importingFile.imports) {
|
|
155120
155288
|
const i = importFromModuleSpecifier(moduleSpecifier);
|
|
@@ -155135,7 +155303,7 @@ function createExistingImportMap(checker, importingFile, compilerOptions) {
|
|
|
155135
155303
|
const matchingDeclarations = importMap == null ? void 0 : importMap.get(getSymbolId(moduleSymbol));
|
|
155136
155304
|
if (!matchingDeclarations) return emptyArray;
|
|
155137
155305
|
if (isSourceFileJS(importingFile) && !(targetFlags & 111551 /* Value */) && !every(matchingDeclarations, isJSDocImportTag)) return emptyArray;
|
|
155138
|
-
const importKind = getImportKind(importingFile, exportKind,
|
|
155306
|
+
const importKind = getImportKind(importingFile, exportKind, program);
|
|
155139
155307
|
return matchingDeclarations.map((declaration) => ({ declaration, importKind, symbol, targetFlags }));
|
|
155140
155308
|
}
|
|
155141
155309
|
};
|
|
@@ -155150,8 +155318,8 @@ function shouldUseRequire(sourceFile, program) {
|
|
|
155150
155318
|
if (compilerOptions.configFile) {
|
|
155151
155319
|
return getEmitModuleKind(compilerOptions) < 5 /* ES2015 */;
|
|
155152
155320
|
}
|
|
155153
|
-
if (sourceFile
|
|
155154
|
-
if (sourceFile
|
|
155321
|
+
if (getImpliedNodeFormatForEmit(sourceFile, program) === 1 /* CommonJS */) return true;
|
|
155322
|
+
if (getImpliedNodeFormatForEmit(sourceFile, program) === 99 /* ESNext */) return false;
|
|
155155
155323
|
for (const otherFile of program.getSourceFiles()) {
|
|
155156
155324
|
if (otherFile === sourceFile || !isSourceFileJS(otherFile) || program.isSourceFileFromExternalLibrary(otherFile)) continue;
|
|
155157
155325
|
if (otherFile.commonJsModuleIndicator && !otherFile.externalModuleIndicator) return true;
|
|
@@ -155203,20 +155371,13 @@ function getNewImportFixes(program, sourceFile, usagePosition, isValidTypeOnlyUs
|
|
|
155203
155371
|
if (!importedSymbolHasValueMeaning && isJs && usagePosition !== void 0) {
|
|
155204
155372
|
return { kind: 1 /* JsdocTypeImport */, moduleSpecifierKind, moduleSpecifier, usagePosition, exportInfo: exportInfo2, isReExport: i > 0 };
|
|
155205
155373
|
}
|
|
155206
|
-
const importKind = getImportKind(sourceFile, exportInfo2.exportKind,
|
|
155374
|
+
const importKind = getImportKind(sourceFile, exportInfo2.exportKind, program);
|
|
155207
155375
|
let qualification;
|
|
155208
155376
|
if (usagePosition !== void 0 && importKind === 3 /* CommonJS */ && exportInfo2.exportKind === 0 /* Named */) {
|
|
155209
155377
|
const exportEquals = checker.resolveExternalModuleSymbol(exportInfo2.moduleSymbol);
|
|
155210
155378
|
let namespacePrefix;
|
|
155211
155379
|
if (exportEquals !== exportInfo2.moduleSymbol) {
|
|
155212
|
-
namespacePrefix = forEachNameOfDefaultExport(
|
|
155213
|
-
exportEquals,
|
|
155214
|
-
checker,
|
|
155215
|
-
compilerOptions,
|
|
155216
|
-
/*preferCapitalizedNames*/
|
|
155217
|
-
false,
|
|
155218
|
-
identity
|
|
155219
|
-
);
|
|
155380
|
+
namespacePrefix = forEachNameOfDefaultExport(exportEquals, checker, getEmitScriptTarget(compilerOptions), identity);
|
|
155220
155381
|
}
|
|
155221
155382
|
namespacePrefix || (namespacePrefix = moduleSymbolToValidIdentifier(
|
|
155222
155383
|
exportInfo2.moduleSymbol,
|
|
@@ -155389,8 +155550,8 @@ function getUmdSymbol(token, checker) {
|
|
|
155389
155550
|
}
|
|
155390
155551
|
return void 0;
|
|
155391
155552
|
}
|
|
155392
|
-
function getImportKind(importingFile, exportKind,
|
|
155393
|
-
if (
|
|
155553
|
+
function getImportKind(importingFile, exportKind, program, forceImportKeyword) {
|
|
155554
|
+
if (program.getCompilerOptions().verbatimModuleSyntax && getEmitModuleFormatOfFile(importingFile, program) === 1 /* CommonJS */) {
|
|
155394
155555
|
return 3 /* CommonJS */;
|
|
155395
155556
|
}
|
|
155396
155557
|
switch (exportKind) {
|
|
@@ -155399,18 +155560,18 @@ function getImportKind(importingFile, exportKind, compilerOptions, forceImportKe
|
|
|
155399
155560
|
case 1 /* Default */:
|
|
155400
155561
|
return 1 /* Default */;
|
|
155401
155562
|
case 2 /* ExportEquals */:
|
|
155402
|
-
return getExportEqualsImportKind(importingFile,
|
|
155563
|
+
return getExportEqualsImportKind(importingFile, program.getCompilerOptions(), !!forceImportKeyword);
|
|
155403
155564
|
case 3 /* UMD */:
|
|
155404
|
-
return getUmdImportKind(importingFile,
|
|
155565
|
+
return getUmdImportKind(importingFile, program, !!forceImportKeyword);
|
|
155405
155566
|
default:
|
|
155406
155567
|
return Debug.assertNever(exportKind);
|
|
155407
155568
|
}
|
|
155408
155569
|
}
|
|
155409
|
-
function getUmdImportKind(importingFile,
|
|
155410
|
-
if (getAllowSyntheticDefaultImports(
|
|
155570
|
+
function getUmdImportKind(importingFile, program, forceImportKeyword) {
|
|
155571
|
+
if (getAllowSyntheticDefaultImports(program.getCompilerOptions())) {
|
|
155411
155572
|
return 1 /* Default */;
|
|
155412
155573
|
}
|
|
155413
|
-
const moduleKind = getEmitModuleKind(
|
|
155574
|
+
const moduleKind = getEmitModuleKind(program.getCompilerOptions());
|
|
155414
155575
|
switch (moduleKind) {
|
|
155415
155576
|
case 2 /* AMD */:
|
|
155416
155577
|
case 1 /* CommonJS */:
|
|
@@ -155429,7 +155590,7 @@ function getUmdImportKind(importingFile, compilerOptions, forceImportKeyword) {
|
|
|
155429
155590
|
return 2 /* Namespace */;
|
|
155430
155591
|
case 100 /* Node16 */:
|
|
155431
155592
|
case 199 /* NodeNext */:
|
|
155432
|
-
return importingFile
|
|
155593
|
+
return getImpliedNodeFormatForEmit(importingFile, program) === 99 /* ESNext */ ? 2 /* Namespace */ : 3 /* CommonJS */;
|
|
155433
155594
|
default:
|
|
155434
155595
|
return Debug.assertNever(moduleKind, `Unexpected moduleKind ${moduleKind}`);
|
|
155435
155596
|
}
|
|
@@ -155512,7 +155673,7 @@ function getExportInfos(symbolName2, isJsxTagName, currentTokenMeaning, cancella
|
|
|
155512
155673
|
cancellationToken.throwIfCancellationRequested();
|
|
155513
155674
|
const compilerOptions = program2.getCompilerOptions();
|
|
155514
155675
|
const defaultInfo = getDefaultLikeExportInfo(moduleSymbol, checker);
|
|
155515
|
-
if (defaultInfo && symbolFlagsHaveMeaning(checker.getSymbolFlags(defaultInfo.symbol), currentTokenMeaning) && forEachNameOfDefaultExport(defaultInfo.symbol, checker, compilerOptions,
|
|
155676
|
+
if (defaultInfo && symbolFlagsHaveMeaning(checker.getSymbolFlags(defaultInfo.symbol), currentTokenMeaning) && forEachNameOfDefaultExport(defaultInfo.symbol, checker, getEmitScriptTarget(compilerOptions), (name, capitalizedName) => (isJsxTagName ? capitalizedName ?? name : name) === symbolName2)) {
|
|
155516
155677
|
addSymbol(moduleSymbol, sourceFile, defaultInfo.symbol, defaultInfo.exportKind, program2, isFromPackageJson);
|
|
155517
155678
|
}
|
|
155518
155679
|
const exportSymbolWithIdenticalName = checker.tryGetMemberInModuleExportsAndProperties(symbolName2, moduleSymbol);
|
|
@@ -155913,6 +156074,12 @@ function createConstEqualsRequireDeclaration(name, quotedModuleSpecifier) {
|
|
|
155913
156074
|
function symbolFlagsHaveMeaning(flags, meaning) {
|
|
155914
156075
|
return meaning === 7 /* All */ ? true : meaning & 1 /* Value */ ? !!(flags & 111551 /* Value */) : meaning & 2 /* Type */ ? !!(flags & 788968 /* Type */) : meaning & 4 /* Namespace */ ? !!(flags & 1920 /* Namespace */) : false;
|
|
155915
156076
|
}
|
|
156077
|
+
function getImpliedNodeFormatForEmit(file, program) {
|
|
156078
|
+
return isFullSourceFile(file) ? program.getImpliedNodeFormatForEmit(file) : getImpliedNodeFormatForEmitWorker(file, program.getCompilerOptions());
|
|
156079
|
+
}
|
|
156080
|
+
function getEmitModuleFormatOfFile(file, program) {
|
|
156081
|
+
return isFullSourceFile(file) ? program.getEmitModuleFormatOfFile(file) : getEmitModuleFormatOfFileWorker(file, program.getCompilerOptions());
|
|
156082
|
+
}
|
|
155916
156083
|
|
|
155917
156084
|
// src/services/codefixes/fixAddMissingConstraint.ts
|
|
155918
156085
|
var fixId17 = "addMissingConstraint";
|
|
@@ -161567,6 +161734,14 @@ function tryGetAutoImportableReferenceFromTypeNode(importTypeNode, scriptTarget)
|
|
|
161567
161734
|
function visit(node) {
|
|
161568
161735
|
if (isLiteralImportTypeNode(node) && node.qualifier) {
|
|
161569
161736
|
const firstIdentifier = getFirstIdentifier(node.qualifier);
|
|
161737
|
+
if (!firstIdentifier.symbol) {
|
|
161738
|
+
return visitEachChild(
|
|
161739
|
+
node,
|
|
161740
|
+
visit,
|
|
161741
|
+
/*context*/
|
|
161742
|
+
void 0
|
|
161743
|
+
);
|
|
161744
|
+
}
|
|
161570
161745
|
const name = getNameForExportedSymbol(firstIdentifier.symbol, scriptTarget);
|
|
161571
161746
|
const qualifier = name !== firstIdentifier.text ? replaceFirstIdentifierOfEntityName(node.qualifier, factory.createIdentifier(name)) : node.qualifier;
|
|
161572
161747
|
symbols = append(symbols, firstIdentifier.symbol);
|
|
@@ -162069,7 +162244,7 @@ var errorCodes54 = [Diagnostics.require_call_may_be_converted_to_an_import.code]
|
|
|
162069
162244
|
registerCodeFix({
|
|
162070
162245
|
errorCodes: errorCodes54,
|
|
162071
162246
|
getCodeActions(context) {
|
|
162072
|
-
const info = getInfo18(context.sourceFile, context.program, context.span.start);
|
|
162247
|
+
const info = getInfo18(context.sourceFile, context.program, context.span.start, context.preferences);
|
|
162073
162248
|
if (!info) {
|
|
162074
162249
|
return void 0;
|
|
162075
162250
|
}
|
|
@@ -162078,14 +162253,14 @@ registerCodeFix({
|
|
|
162078
162253
|
},
|
|
162079
162254
|
fixIds: [fixId42],
|
|
162080
162255
|
getAllCodeActions: (context) => codeFixAll(context, errorCodes54, (changes, diag2) => {
|
|
162081
|
-
const info = getInfo18(diag2.file, context.program, diag2.start);
|
|
162256
|
+
const info = getInfo18(diag2.file, context.program, diag2.start, context.preferences);
|
|
162082
162257
|
if (info) {
|
|
162083
162258
|
doChange35(changes, context.sourceFile, info);
|
|
162084
162259
|
}
|
|
162085
162260
|
})
|
|
162086
162261
|
});
|
|
162087
162262
|
function doChange35(changes, sourceFile, info) {
|
|
162088
|
-
const { allowSyntheticDefaults, defaultImportName, namedImports, statement,
|
|
162263
|
+
const { allowSyntheticDefaults, defaultImportName, namedImports, statement, moduleSpecifier } = info;
|
|
162089
162264
|
changes.replaceNode(
|
|
162090
162265
|
sourceFile,
|
|
162091
162266
|
statement,
|
|
@@ -162095,7 +162270,7 @@ function doChange35(changes, sourceFile, info) {
|
|
|
162095
162270
|
/*isTypeOnly*/
|
|
162096
162271
|
false,
|
|
162097
162272
|
defaultImportName,
|
|
162098
|
-
factory.createExternalModuleReference(
|
|
162273
|
+
factory.createExternalModuleReference(moduleSpecifier)
|
|
162099
162274
|
) : factory.createImportDeclaration(
|
|
162100
162275
|
/*modifiers*/
|
|
162101
162276
|
void 0,
|
|
@@ -162105,13 +162280,13 @@ function doChange35(changes, sourceFile, info) {
|
|
|
162105
162280
|
defaultImportName,
|
|
162106
162281
|
namedImports
|
|
162107
162282
|
),
|
|
162108
|
-
|
|
162283
|
+
moduleSpecifier,
|
|
162109
162284
|
/*attributes*/
|
|
162110
162285
|
void 0
|
|
162111
162286
|
)
|
|
162112
162287
|
);
|
|
162113
162288
|
}
|
|
162114
|
-
function getInfo18(sourceFile, program, pos) {
|
|
162289
|
+
function getInfo18(sourceFile, program, pos, preferences) {
|
|
162115
162290
|
const { parent: parent2 } = getTokenAtPosition(sourceFile, pos);
|
|
162116
162291
|
if (!isRequireCall(
|
|
162117
162292
|
parent2,
|
|
@@ -162121,15 +162296,17 @@ function getInfo18(sourceFile, program, pos) {
|
|
|
162121
162296
|
Debug.failBadSyntaxKind(parent2);
|
|
162122
162297
|
}
|
|
162123
162298
|
const decl = cast(parent2.parent, isVariableDeclaration);
|
|
162299
|
+
const quotePreference = getQuotePreference(sourceFile, preferences);
|
|
162124
162300
|
const defaultImportName = tryCast(decl.name, isIdentifier);
|
|
162125
162301
|
const namedImports = isObjectBindingPattern(decl.name) ? tryCreateNamedImportsFromObjectBindingPattern(decl.name) : void 0;
|
|
162126
162302
|
if (defaultImportName || namedImports) {
|
|
162303
|
+
const moduleSpecifier = first(parent2.arguments);
|
|
162127
162304
|
return {
|
|
162128
162305
|
allowSyntheticDefaults: getAllowSyntheticDefaultImports(program.getCompilerOptions()),
|
|
162129
162306
|
defaultImportName,
|
|
162130
162307
|
namedImports,
|
|
162131
162308
|
statement: cast(decl.parent.parent, isVariableStatement),
|
|
162132
|
-
|
|
162309
|
+
moduleSpecifier: isNoSubstitutionTemplateLiteral(moduleSpecifier) ? factory.createStringLiteral(moduleSpecifier.text, quotePreference === 0 /* Single */) : moduleSpecifier
|
|
162133
162310
|
};
|
|
162134
162311
|
}
|
|
162135
162312
|
}
|
|
@@ -163185,10 +163362,12 @@ function getJSDocParamAnnotation(paramName, initializer, dotDotDotToken, isJs, i
|
|
|
163185
163362
|
const printer = isSnippet ? createSnippetPrinter({
|
|
163186
163363
|
removeComments: true,
|
|
163187
163364
|
module: options.module,
|
|
163365
|
+
moduleResolution: options.moduleResolution,
|
|
163188
163366
|
target: options.target
|
|
163189
163367
|
}) : createPrinter({
|
|
163190
163368
|
removeComments: true,
|
|
163191
163369
|
module: options.module,
|
|
163370
|
+
moduleResolution: options.moduleResolution,
|
|
163192
163371
|
target: options.target
|
|
163193
163372
|
});
|
|
163194
163373
|
setEmitFlags(typeNode, 1 /* SingleLine */);
|
|
@@ -163444,6 +163623,7 @@ function getExhaustiveCaseSnippets(caseBlock, sourceFile, preferences, options,
|
|
|
163444
163623
|
const printer = createSnippetPrinter({
|
|
163445
163624
|
removeComments: true,
|
|
163446
163625
|
module: options.module,
|
|
163626
|
+
moduleResolution: options.moduleResolution,
|
|
163447
163627
|
target: options.target,
|
|
163448
163628
|
newLine: getNewLineKind(newLineChar)
|
|
163449
163629
|
});
|
|
@@ -163630,7 +163810,7 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
|
|
|
163630
163810
|
if (originIsResolvedExport(origin)) {
|
|
163631
163811
|
sourceDisplay = [textPart(origin.moduleSpecifier)];
|
|
163632
163812
|
if (importStatementCompletion) {
|
|
163633
|
-
({ insertText, replacementSpan } = getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile,
|
|
163813
|
+
({ insertText, replacementSpan } = getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, program, preferences));
|
|
163634
163814
|
isSnippet = preferences.includeCompletionsWithSnippetText ? true : void 0;
|
|
163635
163815
|
}
|
|
163636
163816
|
}
|
|
@@ -163771,6 +163951,7 @@ function getEntryForMemberCompletion(host, program, options, preferences, name,
|
|
|
163771
163951
|
const printer = createSnippetPrinter({
|
|
163772
163952
|
removeComments: true,
|
|
163773
163953
|
module: options.module,
|
|
163954
|
+
moduleResolution: options.moduleResolution,
|
|
163774
163955
|
target: options.target,
|
|
163775
163956
|
omitTrailingSemicolon: false,
|
|
163776
163957
|
newLine: getNewLineKind(getNewLineOrDefaultFromHost(host, formatContext == null ? void 0 : formatContext.options))
|
|
@@ -163921,6 +164102,7 @@ function getEntryForObjectLiteralMethodCompletion(symbol, name, enclosingDeclara
|
|
|
163921
164102
|
const printer = createSnippetPrinter({
|
|
163922
164103
|
removeComments: true,
|
|
163923
164104
|
module: options.module,
|
|
164105
|
+
moduleResolution: options.moduleResolution,
|
|
163924
164106
|
target: options.target,
|
|
163925
164107
|
omitTrailingSemicolon: false,
|
|
163926
164108
|
newLine: getNewLineKind(getNewLineOrDefaultFromHost(host, formatContext == null ? void 0 : formatContext.options))
|
|
@@ -163941,6 +164123,7 @@ function getEntryForObjectLiteralMethodCompletion(symbol, name, enclosingDeclara
|
|
|
163941
164123
|
const signaturePrinter = createPrinter({
|
|
163942
164124
|
removeComments: true,
|
|
163943
164125
|
module: options.module,
|
|
164126
|
+
moduleResolution: options.moduleResolution,
|
|
163944
164127
|
target: options.target,
|
|
163945
164128
|
omitTrailingSemicolon: true
|
|
163946
164129
|
});
|
|
@@ -164202,7 +164385,7 @@ function completionEntryDataToSymbolOriginInfo(data, completionName, moduleSymbo
|
|
|
164202
164385
|
};
|
|
164203
164386
|
return unresolvedOrigin;
|
|
164204
164387
|
}
|
|
164205
|
-
function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile,
|
|
164388
|
+
function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, program, preferences) {
|
|
164206
164389
|
const replacementSpan = importStatementCompletion.replacementSpan;
|
|
164207
164390
|
const quotedModuleSpecifier = escapeSnippetText(quote(sourceFile, preferences, origin.moduleSpecifier));
|
|
164208
164391
|
const exportKind = origin.isDefaultExport ? 1 /* Default */ : origin.exportName === "export=" /* ExportEquals */ ? 2 /* ExportEquals */ : 0 /* Named */;
|
|
@@ -164210,7 +164393,7 @@ function getInsertTextAndReplacementSpanForImportCompletion(name, importStatemen
|
|
|
164210
164393
|
const importKind = ts_codefix_exports.getImportKind(
|
|
164211
164394
|
sourceFile,
|
|
164212
164395
|
exportKind,
|
|
164213
|
-
|
|
164396
|
+
program,
|
|
164214
164397
|
/*forceImportKeyword*/
|
|
164215
164398
|
true
|
|
164216
164399
|
);
|
|
@@ -166589,7 +166772,7 @@ function createNameAndKindSet() {
|
|
|
166589
166772
|
}
|
|
166590
166773
|
function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences, includeSymbol) {
|
|
166591
166774
|
if (isInReferenceComment(sourceFile, position)) {
|
|
166592
|
-
const entries = getTripleSlashReferenceCompletion(sourceFile, position,
|
|
166775
|
+
const entries = getTripleSlashReferenceCompletion(sourceFile, position, program, host);
|
|
166593
166776
|
return entries && convertPathCompletions(entries);
|
|
166594
166777
|
}
|
|
166595
166778
|
if (isInString(sourceFile, position, contextToken)) {
|
|
@@ -166912,7 +167095,7 @@ function getStringLiteralCompletionsFromModuleNamesWorker(sourceFile, node, prog
|
|
|
166912
167095
|
const compilerOptions = program.getCompilerOptions();
|
|
166913
167096
|
const typeChecker = program.getTypeChecker();
|
|
166914
167097
|
const extensionOptions = getExtensionOptions(compilerOptions, 1 /* ModuleSpecifier */, sourceFile, typeChecker, preferences, mode);
|
|
166915
|
-
return isPathRelativeToScript(literalValue) || !compilerOptions.baseUrl && !compilerOptions.paths && (isRootedDiskPath(literalValue) || isUrl(literalValue)) ? getCompletionEntriesForRelativeModules(literalValue, scriptDirectory,
|
|
167098
|
+
return isPathRelativeToScript(literalValue) || !compilerOptions.baseUrl && !compilerOptions.paths && (isRootedDiskPath(literalValue) || isUrl(literalValue)) ? getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, program, host, scriptPath, extensionOptions) : getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, mode, program, host, extensionOptions);
|
|
166916
167099
|
}
|
|
166917
167100
|
function getExtensionOptions(compilerOptions, referenceKind, importingSourceFile, typeChecker, preferences, resolutionMode) {
|
|
166918
167101
|
return {
|
|
@@ -166923,14 +167106,15 @@ function getExtensionOptions(compilerOptions, referenceKind, importingSourceFile
|
|
|
166923
167106
|
resolutionMode
|
|
166924
167107
|
};
|
|
166925
167108
|
}
|
|
166926
|
-
function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory,
|
|
167109
|
+
function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, program, host, scriptPath, extensionOptions) {
|
|
167110
|
+
const compilerOptions = program.getCompilerOptions();
|
|
166927
167111
|
if (compilerOptions.rootDirs) {
|
|
166928
167112
|
return getCompletionEntriesForDirectoryFragmentWithRootDirs(
|
|
166929
167113
|
compilerOptions.rootDirs,
|
|
166930
167114
|
literalValue,
|
|
166931
167115
|
scriptDirectory,
|
|
166932
167116
|
extensionOptions,
|
|
166933
|
-
|
|
167117
|
+
program,
|
|
166934
167118
|
host,
|
|
166935
167119
|
scriptPath
|
|
166936
167120
|
);
|
|
@@ -166939,6 +167123,7 @@ function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, c
|
|
|
166939
167123
|
literalValue,
|
|
166940
167124
|
scriptDirectory,
|
|
166941
167125
|
extensionOptions,
|
|
167126
|
+
program,
|
|
166942
167127
|
host,
|
|
166943
167128
|
/*moduleSpecifierIsRelative*/
|
|
166944
167129
|
true,
|
|
@@ -166965,7 +167150,8 @@ function getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptDirectory, ign
|
|
|
166965
167150
|
compareStringsCaseSensitive
|
|
166966
167151
|
);
|
|
166967
167152
|
}
|
|
166968
|
-
function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptDirectory, extensionOptions,
|
|
167153
|
+
function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptDirectory, extensionOptions, program, host, exclude) {
|
|
167154
|
+
const compilerOptions = program.getCompilerOptions();
|
|
166969
167155
|
const basePath = compilerOptions.project || host.getCurrentDirectory();
|
|
166970
167156
|
const ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames());
|
|
166971
167157
|
const baseDirectories = getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptDirectory, ignoreCase);
|
|
@@ -166974,6 +167160,7 @@ function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment
|
|
|
166974
167160
|
fragment,
|
|
166975
167161
|
baseDirectory,
|
|
166976
167162
|
extensionOptions,
|
|
167163
|
+
program,
|
|
166977
167164
|
host,
|
|
166978
167165
|
/*moduleSpecifierIsRelative*/
|
|
166979
167166
|
true,
|
|
@@ -166982,7 +167169,7 @@ function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment
|
|
|
166982
167169
|
(itemA, itemB) => itemA.name === itemB.name && itemA.kind === itemB.kind && itemA.extension === itemB.extension
|
|
166983
167170
|
);
|
|
166984
167171
|
}
|
|
166985
|
-
function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, extensionOptions, host, moduleSpecifierIsRelative, exclude, result = createNameAndKindSet()) {
|
|
167172
|
+
function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, extensionOptions, program, host, moduleSpecifierIsRelative, exclude, result = createNameAndKindSet()) {
|
|
166986
167173
|
var _a;
|
|
166987
167174
|
if (fragment === void 0) {
|
|
166988
167175
|
fragment = "";
|
|
@@ -167007,7 +167194,7 @@ function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, ext
|
|
|
167007
167194
|
if (versionPaths) {
|
|
167008
167195
|
const packageDirectory = getDirectoryPath(packageJsonPath);
|
|
167009
167196
|
const pathInPackage = absolutePath.slice(ensureTrailingDirectorySeparator(packageDirectory).length);
|
|
167010
|
-
if (addCompletionEntriesFromPaths(result, pathInPackage, packageDirectory, extensionOptions, host, versionPaths)) {
|
|
167197
|
+
if (addCompletionEntriesFromPaths(result, pathInPackage, packageDirectory, extensionOptions, program, host, versionPaths)) {
|
|
167011
167198
|
return result;
|
|
167012
167199
|
}
|
|
167013
167200
|
}
|
|
@@ -167033,7 +167220,7 @@ function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, ext
|
|
|
167033
167220
|
}
|
|
167034
167221
|
const { name, extension } = getFilenameWithExtensionOption(
|
|
167035
167222
|
getBaseFileName(filePath),
|
|
167036
|
-
|
|
167223
|
+
program,
|
|
167037
167224
|
extensionOptions,
|
|
167038
167225
|
/*isExportsWildcard*/
|
|
167039
167226
|
false
|
|
@@ -167052,7 +167239,7 @@ function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, ext
|
|
|
167052
167239
|
}
|
|
167053
167240
|
return result;
|
|
167054
167241
|
}
|
|
167055
|
-
function getFilenameWithExtensionOption(name,
|
|
167242
|
+
function getFilenameWithExtensionOption(name, program, extensionOptions, isExportsWildcard) {
|
|
167056
167243
|
const nonJsResult = ts_moduleSpecifiers_exports.tryGetRealFileNameForNonJsDeclarationFileName(name);
|
|
167057
167244
|
if (nonJsResult) {
|
|
167058
167245
|
return { name: nonJsResult, extension: tryGetExtensionFromPath2(nonJsResult) };
|
|
@@ -167062,7 +167249,8 @@ function getFilenameWithExtensionOption(name, compilerOptions, extensionOptions,
|
|
|
167062
167249
|
}
|
|
167063
167250
|
let allowedEndings = getModuleSpecifierPreferences(
|
|
167064
167251
|
{ importModuleSpecifierEnding: extensionOptions.endingPreference },
|
|
167065
|
-
|
|
167252
|
+
program,
|
|
167253
|
+
program.getCompilerOptions(),
|
|
167066
167254
|
extensionOptions.importingSourceFile
|
|
167067
167255
|
).getAllowedEndingsInPreferredOrder(extensionOptions.resolutionMode);
|
|
167068
167256
|
if (isExportsWildcard) {
|
|
@@ -167072,16 +167260,16 @@ function getFilenameWithExtensionOption(name, compilerOptions, extensionOptions,
|
|
|
167072
167260
|
if (fileExtensionIsOneOf(name, supportedTSImplementationExtensions)) {
|
|
167073
167261
|
return { name, extension: tryGetExtensionFromPath2(name) };
|
|
167074
167262
|
}
|
|
167075
|
-
const outputExtension2 = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name,
|
|
167263
|
+
const outputExtension2 = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name, program.getCompilerOptions());
|
|
167076
167264
|
return outputExtension2 ? { name: changeExtension(name, outputExtension2), extension: outputExtension2 } : { name, extension: tryGetExtensionFromPath2(name) };
|
|
167077
167265
|
}
|
|
167078
167266
|
if (!isExportsWildcard && (allowedEndings[0] === 0 /* Minimal */ || allowedEndings[0] === 1 /* Index */) && fileExtensionIsOneOf(name, [".js" /* Js */, ".jsx" /* Jsx */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */])) {
|
|
167079
167267
|
return { name: removeFileExtension(name), extension: tryGetExtensionFromPath2(name) };
|
|
167080
167268
|
}
|
|
167081
|
-
const outputExtension = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name,
|
|
167269
|
+
const outputExtension = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name, program.getCompilerOptions());
|
|
167082
167270
|
return outputExtension ? { name: changeExtension(name, outputExtension), extension: outputExtension } : { name, extension: tryGetExtensionFromPath2(name) };
|
|
167083
167271
|
}
|
|
167084
|
-
function addCompletionEntriesFromPaths(result, fragment, baseDirectory, extensionOptions, host, paths) {
|
|
167272
|
+
function addCompletionEntriesFromPaths(result, fragment, baseDirectory, extensionOptions, program, host, paths) {
|
|
167085
167273
|
const getPatternsForKey = (key) => paths[key];
|
|
167086
167274
|
const comparePaths2 = (a, b) => {
|
|
167087
167275
|
const patternA = tryParsePattern(a);
|
|
@@ -167097,13 +167285,14 @@ function addCompletionEntriesFromPaths(result, fragment, baseDirectory, extensio
|
|
|
167097
167285
|
fragment,
|
|
167098
167286
|
baseDirectory,
|
|
167099
167287
|
extensionOptions,
|
|
167288
|
+
program,
|
|
167100
167289
|
host,
|
|
167101
167290
|
getOwnKeys(paths),
|
|
167102
167291
|
getPatternsForKey,
|
|
167103
167292
|
comparePaths2
|
|
167104
167293
|
);
|
|
167105
167294
|
}
|
|
167106
|
-
function addCompletionEntriesFromPathsOrExports(result, isExports, fragment, baseDirectory, extensionOptions, host, keys, getPatternsForKey, comparePaths2) {
|
|
167295
|
+
function addCompletionEntriesFromPathsOrExports(result, isExports, fragment, baseDirectory, extensionOptions, program, host, keys, getPatternsForKey, comparePaths2) {
|
|
167107
167296
|
let pathResults = [];
|
|
167108
167297
|
let matchedPath;
|
|
167109
167298
|
for (const key of keys) {
|
|
@@ -167122,7 +167311,7 @@ function addCompletionEntriesFromPathsOrExports(result, isExports, fragment, bas
|
|
|
167122
167311
|
if (typeof pathPattern === "string" || matchedPath === void 0 || comparePaths2(key, matchedPath) !== 1 /* GreaterThan */) {
|
|
167123
167312
|
pathResults.push({
|
|
167124
167313
|
matchedPattern: isMatch,
|
|
167125
|
-
results: getCompletionsForPathMapping(keyWithoutLeadingDotSlash, patterns, fragment, baseDirectory, extensionOptions, isExports && isMatch, host).map(({ name, kind, extension }) => nameAndKind(name, kind, extension))
|
|
167314
|
+
results: getCompletionsForPathMapping(keyWithoutLeadingDotSlash, patterns, fragment, baseDirectory, extensionOptions, isExports && isMatch, program, host).map(({ name, kind, extension }) => nameAndKind(name, kind, extension))
|
|
167126
167315
|
});
|
|
167127
167316
|
}
|
|
167128
167317
|
}
|
|
@@ -167130,7 +167319,9 @@ function addCompletionEntriesFromPathsOrExports(result, isExports, fragment, bas
|
|
|
167130
167319
|
pathResults.forEach((pathResult) => pathResult.results.forEach((r) => result.add(r)));
|
|
167131
167320
|
return matchedPath !== void 0;
|
|
167132
167321
|
}
|
|
167133
|
-
function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode,
|
|
167322
|
+
function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, program, host, extensionOptions) {
|
|
167323
|
+
const typeChecker = program.getTypeChecker();
|
|
167324
|
+
const compilerOptions = program.getCompilerOptions();
|
|
167134
167325
|
const { baseUrl, paths } = compilerOptions;
|
|
167135
167326
|
const result = createNameAndKindSet();
|
|
167136
167327
|
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
|
@@ -167140,6 +167331,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, c
|
|
|
167140
167331
|
fragment,
|
|
167141
167332
|
absolute,
|
|
167142
167333
|
extensionOptions,
|
|
167334
|
+
program,
|
|
167143
167335
|
host,
|
|
167144
167336
|
/*moduleSpecifierIsRelative*/
|
|
167145
167337
|
false,
|
|
@@ -167150,7 +167342,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, c
|
|
|
167150
167342
|
}
|
|
167151
167343
|
if (paths) {
|
|
167152
167344
|
const absolute = getPathsBasePath(compilerOptions, host);
|
|
167153
|
-
addCompletionEntriesFromPaths(result, fragment, absolute, extensionOptions, host, paths);
|
|
167345
|
+
addCompletionEntriesFromPaths(result, fragment, absolute, extensionOptions, program, host, paths);
|
|
167154
167346
|
}
|
|
167155
167347
|
const fragmentDirectory = getFragmentDirectory(fragment);
|
|
167156
167348
|
for (const ambientName of getAmbientModuleCompletions(fragment, fragmentDirectory, typeChecker)) {
|
|
@@ -167161,7 +167353,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, c
|
|
|
167161
167353
|
void 0
|
|
167162
167354
|
));
|
|
167163
167355
|
}
|
|
167164
|
-
getCompletionEntriesFromTypings(host,
|
|
167356
|
+
getCompletionEntriesFromTypings(host, program, scriptPath, fragmentDirectory, extensionOptions, result);
|
|
167165
167357
|
if (moduleResolutionUsesNodeModules(moduleResolution)) {
|
|
167166
167358
|
let foundGlobal = false;
|
|
167167
167359
|
if (fragmentDirectory === void 0) {
|
|
@@ -167186,6 +167378,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, c
|
|
|
167186
167378
|
fragment,
|
|
167187
167379
|
nodeModules,
|
|
167188
167380
|
extensionOptions,
|
|
167381
|
+
program,
|
|
167189
167382
|
host,
|
|
167190
167383
|
/*moduleSpecifierIsRelative*/
|
|
167191
167384
|
false,
|
|
@@ -167230,6 +167423,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, c
|
|
|
167230
167423
|
fragmentSubpath,
|
|
167231
167424
|
packageDirectory,
|
|
167232
167425
|
extensionOptions,
|
|
167426
|
+
program,
|
|
167233
167427
|
host,
|
|
167234
167428
|
keys,
|
|
167235
167429
|
(key) => singleElementArray(getPatternFromFirstMatchingCondition(exports2[key], conditions)),
|
|
@@ -167262,7 +167456,7 @@ function getPatternFromFirstMatchingCondition(target, conditions) {
|
|
|
167262
167456
|
function getFragmentDirectory(fragment) {
|
|
167263
167457
|
return containsSlash(fragment) ? hasTrailingDirectorySeparator(fragment) ? fragment : getDirectoryPath(fragment) : void 0;
|
|
167264
167458
|
}
|
|
167265
|
-
function getCompletionsForPathMapping(path, patterns, fragment, packageDirectory, extensionOptions, isExportsWildcard, host) {
|
|
167459
|
+
function getCompletionsForPathMapping(path, patterns, fragment, packageDirectory, extensionOptions, isExportsWildcard, program, host) {
|
|
167266
167460
|
if (!endsWith(path, "*")) {
|
|
167267
167461
|
return !path.includes("*") ? justPathMappingName(path, "script" /* scriptElement */) : emptyArray;
|
|
167268
167462
|
}
|
|
@@ -167272,15 +167466,15 @@ function getCompletionsForPathMapping(path, patterns, fragment, packageDirectory
|
|
|
167272
167466
|
const starIsFullPathComponent = path[path.length - 2] === "/";
|
|
167273
167467
|
return starIsFullPathComponent ? justPathMappingName(pathPrefix, "directory" /* directory */) : flatMap(patterns, (pattern) => {
|
|
167274
167468
|
var _a;
|
|
167275
|
-
return (_a = getModulesForPathsPattern("", packageDirectory, pattern, extensionOptions, isExportsWildcard, host)) == null ? void 0 : _a.map(({ name, ...rest }) => ({ name: pathPrefix + name, ...rest }));
|
|
167469
|
+
return (_a = getModulesForPathsPattern("", packageDirectory, pattern, extensionOptions, isExportsWildcard, program, host)) == null ? void 0 : _a.map(({ name, ...rest }) => ({ name: pathPrefix + name, ...rest }));
|
|
167276
167470
|
});
|
|
167277
167471
|
}
|
|
167278
|
-
return flatMap(patterns, (pattern) => getModulesForPathsPattern(remainingFragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, host));
|
|
167472
|
+
return flatMap(patterns, (pattern) => getModulesForPathsPattern(remainingFragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, program, host));
|
|
167279
167473
|
function justPathMappingName(name, kind) {
|
|
167280
167474
|
return startsWith(name, fragment) ? [{ name: removeTrailingDirectorySeparator(name), kind, extension: void 0 }] : emptyArray;
|
|
167281
167475
|
}
|
|
167282
167476
|
}
|
|
167283
|
-
function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, host) {
|
|
167477
|
+
function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, program, host) {
|
|
167284
167478
|
if (!host.readDirectory) {
|
|
167285
167479
|
return void 0;
|
|
167286
167480
|
}
|
|
@@ -167313,7 +167507,7 @@ function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensio
|
|
|
167313
167507
|
if (containsSlash(trimmedWithPattern)) {
|
|
167314
167508
|
return directoryResult(getPathComponents(removeLeadingDirectorySeparator(trimmedWithPattern))[1]);
|
|
167315
167509
|
}
|
|
167316
|
-
const { name, extension } = getFilenameWithExtensionOption(trimmedWithPattern,
|
|
167510
|
+
const { name, extension } = getFilenameWithExtensionOption(trimmedWithPattern, program, extensionOptions, isExportsWildcard);
|
|
167317
167511
|
return nameAndKind(name, "script" /* scriptElement */, extension);
|
|
167318
167512
|
}
|
|
167319
167513
|
});
|
|
@@ -167341,7 +167535,8 @@ function getAmbientModuleCompletions(fragment, fragmentDirectory, checker) {
|
|
|
167341
167535
|
}
|
|
167342
167536
|
return nonRelativeModuleNames;
|
|
167343
167537
|
}
|
|
167344
|
-
function getTripleSlashReferenceCompletion(sourceFile, position,
|
|
167538
|
+
function getTripleSlashReferenceCompletion(sourceFile, position, program, host) {
|
|
167539
|
+
const compilerOptions = program.getCompilerOptions();
|
|
167345
167540
|
const token = getTokenAtPosition(sourceFile, position);
|
|
167346
167541
|
const commentRanges = getLeadingCommentRanges(sourceFile.text, token.pos);
|
|
167347
167542
|
const range = commentRanges && find(commentRanges, (commentRange) => position >= commentRange.pos && position <= commentRange.end);
|
|
@@ -167359,14 +167554,16 @@ function getTripleSlashReferenceCompletion(sourceFile, position, compilerOptions
|
|
|
167359
167554
|
toComplete,
|
|
167360
167555
|
scriptPath,
|
|
167361
167556
|
getExtensionOptions(compilerOptions, 0 /* Filename */, sourceFile),
|
|
167557
|
+
program,
|
|
167362
167558
|
host,
|
|
167363
167559
|
/*moduleSpecifierIsRelative*/
|
|
167364
167560
|
true,
|
|
167365
167561
|
sourceFile.path
|
|
167366
|
-
) : kind === "types" ? getCompletionEntriesFromTypings(host,
|
|
167562
|
+
) : kind === "types" ? getCompletionEntriesFromTypings(host, program, scriptPath, getFragmentDirectory(toComplete), getExtensionOptions(compilerOptions, 1 /* ModuleSpecifier */, sourceFile)) : Debug.fail();
|
|
167367
167563
|
return addReplacementSpans(toComplete, range.pos + prefix.length, arrayFrom(names.values()));
|
|
167368
167564
|
}
|
|
167369
|
-
function getCompletionEntriesFromTypings(host,
|
|
167565
|
+
function getCompletionEntriesFromTypings(host, program, scriptPath, fragmentDirectory, extensionOptions, result = createNameAndKindSet()) {
|
|
167566
|
+
const options = program.getCompilerOptions();
|
|
167370
167567
|
const seen = /* @__PURE__ */ new Map();
|
|
167371
167568
|
const typeRoots = tryAndIgnoreErrors(() => getEffectiveTypeRoots(options, host)) || emptyArray;
|
|
167372
167569
|
for (const root of typeRoots) {
|
|
@@ -167400,6 +167597,7 @@ function getCompletionEntriesFromTypings(host, options, scriptPath, fragmentDire
|
|
|
167400
167597
|
remainingFragment,
|
|
167401
167598
|
baseDirectory,
|
|
167402
167599
|
extensionOptions,
|
|
167600
|
+
program,
|
|
167403
167601
|
host,
|
|
167404
167602
|
/*moduleSpecifierIsRelative*/
|
|
167405
167603
|
false,
|
|
@@ -178732,6 +178930,7 @@ __export(ts_exports2, {
|
|
|
178732
178930
|
canHaveJSDoc: () => canHaveJSDoc,
|
|
178733
178931
|
canHaveLocals: () => canHaveLocals,
|
|
178734
178932
|
canHaveModifiers: () => canHaveModifiers,
|
|
178933
|
+
canHaveModuleSpecifier: () => canHaveModuleSpecifier,
|
|
178735
178934
|
canHaveSymbol: () => canHaveSymbol,
|
|
178736
178935
|
canIncludeBindAndCheckDiagnostics: () => canIncludeBindAndCheckDiagnostics,
|
|
178737
178936
|
canJsonReportNoInputFiles: () => canJsonReportNoInputFiles,
|
|
@@ -178894,6 +179093,7 @@ __export(ts_exports2, {
|
|
|
178894
179093
|
createMemberAccessForPropertyName: () => createMemberAccessForPropertyName,
|
|
178895
179094
|
createModeAwareCache: () => createModeAwareCache,
|
|
178896
179095
|
createModeAwareCacheKey: () => createModeAwareCacheKey,
|
|
179096
|
+
createModeMismatchDetails: () => createModeMismatchDetails,
|
|
178897
179097
|
createModuleNotFoundChain: () => createModuleNotFoundChain,
|
|
178898
179098
|
createModuleResolutionCache: () => createModuleResolutionCache,
|
|
178899
179099
|
createModuleResolutionLoader: () => createModuleResolutionLoader,
|
|
@@ -179175,6 +179375,7 @@ __export(ts_exports2, {
|
|
|
179175
179375
|
getDefaultLibFilePath: () => getDefaultLibFilePath,
|
|
179176
179376
|
getDefaultLikeExportInfo: () => getDefaultLikeExportInfo,
|
|
179177
179377
|
getDefaultLikeExportNameFromDeclaration: () => getDefaultLikeExportNameFromDeclaration,
|
|
179378
|
+
getDefaultResolutionModeForFileWorker: () => getDefaultResolutionModeForFileWorker,
|
|
179178
179379
|
getDiagnosticText: () => getDiagnosticText,
|
|
179179
179380
|
getDiagnosticsWithinSpan: () => getDiagnosticsWithinSpan,
|
|
179180
179381
|
getDirectoryPath: () => getDirectoryPath,
|
|
@@ -179205,6 +179406,7 @@ __export(ts_exports2, {
|
|
|
179205
179406
|
getEmitFlags: () => getEmitFlags,
|
|
179206
179407
|
getEmitHelpers: () => getEmitHelpers,
|
|
179207
179408
|
getEmitModuleDetectionKind: () => getEmitModuleDetectionKind,
|
|
179409
|
+
getEmitModuleFormatOfFileWorker: () => getEmitModuleFormatOfFileWorker,
|
|
179208
179410
|
getEmitModuleKind: () => getEmitModuleKind,
|
|
179209
179411
|
getEmitModuleResolutionKind: () => getEmitModuleResolutionKind,
|
|
179210
179412
|
getEmitScriptTarget: () => getEmitScriptTarget,
|
|
@@ -179255,6 +179457,7 @@ __export(ts_exports2, {
|
|
|
179255
179457
|
getIdentifierGeneratedImportReference: () => getIdentifierGeneratedImportReference,
|
|
179256
179458
|
getIdentifierTypeArguments: () => getIdentifierTypeArguments,
|
|
179257
179459
|
getImmediatelyInvokedFunctionExpression: () => getImmediatelyInvokedFunctionExpression,
|
|
179460
|
+
getImpliedNodeFormatForEmitWorker: () => getImpliedNodeFormatForEmitWorker,
|
|
179258
179461
|
getImpliedNodeFormatForFile: () => getImpliedNodeFormatForFile,
|
|
179259
179462
|
getImpliedNodeFormatForFileWorker: () => getImpliedNodeFormatForFileWorker,
|
|
179260
179463
|
getImportNeedsImportDefaultHelper: () => getImportNeedsImportDefaultHelper,
|
|
@@ -179360,7 +179563,6 @@ __export(ts_exports2, {
|
|
|
179360
179563
|
getNameOfScriptTarget: () => getNameOfScriptTarget,
|
|
179361
179564
|
getNameOrArgument: () => getNameOrArgument,
|
|
179362
179565
|
getNameTable: () => getNameTable,
|
|
179363
|
-
getNamesForExportedSymbol: () => getNamesForExportedSymbol,
|
|
179364
179566
|
getNamespaceDeclarationNode: () => getNamespaceDeclarationNode,
|
|
179365
179567
|
getNewLineCharacter: () => getNewLineCharacter,
|
|
179366
179568
|
getNewLineKind: () => getNewLineKind,
|
|
@@ -179597,6 +179799,7 @@ __export(ts_exports2, {
|
|
|
179597
179799
|
ignoreSourceNewlines: () => ignoreSourceNewlines,
|
|
179598
179800
|
ignoredPaths: () => ignoredPaths,
|
|
179599
179801
|
importFromModuleSpecifier: () => importFromModuleSpecifier,
|
|
179802
|
+
importSyntaxAffectsModuleResolution: () => importSyntaxAffectsModuleResolution,
|
|
179600
179803
|
indexOfAnyCharCode: () => indexOfAnyCharCode,
|
|
179601
179804
|
indexOfNode: () => indexOfNode,
|
|
179602
179805
|
indicesOf: () => indicesOf,
|
|
@@ -180642,11 +180845,11 @@ __export(ts_exports2, {
|
|
|
180642
180845
|
transformESDecorators: () => transformESDecorators,
|
|
180643
180846
|
transformESNext: () => transformESNext,
|
|
180644
180847
|
transformGenerators: () => transformGenerators,
|
|
180848
|
+
transformImpliedNodeFormatDependentModule: () => transformImpliedNodeFormatDependentModule,
|
|
180645
180849
|
transformJsx: () => transformJsx,
|
|
180646
180850
|
transformLegacyDecorators: () => transformLegacyDecorators,
|
|
180647
180851
|
transformModule: () => transformModule,
|
|
180648
180852
|
transformNamedEvaluation: () => transformNamedEvaluation,
|
|
180649
|
-
transformNodeModule: () => transformNodeModule,
|
|
180650
180853
|
transformNodes: () => transformNodes,
|
|
180651
180854
|
transformSystemModule: () => transformSystemModule,
|
|
180652
180855
|
transformTypeScript: () => transformTypeScript,
|
|
@@ -181517,7 +181720,7 @@ __export(ts_server_protocol_exports, {
|
|
|
181517
181720
|
NewLineKind: () => NewLineKind2,
|
|
181518
181721
|
OrganizeImportsMode: () => OrganizeImportsMode,
|
|
181519
181722
|
PollingWatchKind: () => PollingWatchKind2,
|
|
181520
|
-
ScriptTarget: () =>
|
|
181723
|
+
ScriptTarget: () => ScriptTarget11,
|
|
181521
181724
|
SemicolonPreference: () => SemicolonPreference,
|
|
181522
181725
|
WatchDirectoryKind: () => WatchDirectoryKind2,
|
|
181523
181726
|
WatchFileKind: () => WatchFileKind2
|
|
@@ -181708,24 +181911,24 @@ var NewLineKind2 = /* @__PURE__ */ ((NewLineKind3) => {
|
|
|
181708
181911
|
NewLineKind3["Lf"] = "Lf";
|
|
181709
181912
|
return NewLineKind3;
|
|
181710
181913
|
})(NewLineKind2 || {});
|
|
181711
|
-
var
|
|
181712
|
-
|
|
181713
|
-
|
|
181714
|
-
|
|
181715
|
-
|
|
181716
|
-
|
|
181717
|
-
|
|
181718
|
-
|
|
181719
|
-
|
|
181720
|
-
|
|
181721
|
-
|
|
181722
|
-
|
|
181723
|
-
|
|
181724
|
-
|
|
181725
|
-
|
|
181726
|
-
|
|
181727
|
-
return
|
|
181728
|
-
})(
|
|
181914
|
+
var ScriptTarget11 = /* @__PURE__ */ ((ScriptTarget12) => {
|
|
181915
|
+
ScriptTarget12["ES3"] = "es3";
|
|
181916
|
+
ScriptTarget12["ES5"] = "es5";
|
|
181917
|
+
ScriptTarget12["ES6"] = "es6";
|
|
181918
|
+
ScriptTarget12["ES2015"] = "es2015";
|
|
181919
|
+
ScriptTarget12["ES2016"] = "es2016";
|
|
181920
|
+
ScriptTarget12["ES2017"] = "es2017";
|
|
181921
|
+
ScriptTarget12["ES2018"] = "es2018";
|
|
181922
|
+
ScriptTarget12["ES2019"] = "es2019";
|
|
181923
|
+
ScriptTarget12["ES2020"] = "es2020";
|
|
181924
|
+
ScriptTarget12["ES2021"] = "es2021";
|
|
181925
|
+
ScriptTarget12["ES2022"] = "es2022";
|
|
181926
|
+
ScriptTarget12["ES2023"] = "es2023";
|
|
181927
|
+
ScriptTarget12["ESNext"] = "esnext";
|
|
181928
|
+
ScriptTarget12["JSON"] = "json";
|
|
181929
|
+
ScriptTarget12["Latest"] = "esnext" /* ESNext */;
|
|
181930
|
+
return ScriptTarget12;
|
|
181931
|
+
})(ScriptTarget11 || {});
|
|
181729
181932
|
{
|
|
181730
181933
|
}
|
|
181731
181934
|
|
|
@@ -182867,7 +183070,7 @@ var Project2 = class _Project {
|
|
|
182867
183070
|
return this.projectName;
|
|
182868
183071
|
}
|
|
182869
183072
|
removeLocalTypingsFromTypeAcquisition(newTypeAcquisition) {
|
|
182870
|
-
if (!newTypeAcquisition || !newTypeAcquisition.include) {
|
|
183073
|
+
if (!newTypeAcquisition.enable || !newTypeAcquisition.include) {
|
|
182871
183074
|
return newTypeAcquisition;
|
|
182872
183075
|
}
|
|
182873
183076
|
return { ...newTypeAcquisition, include: this.removeExistingTypings(newTypeAcquisition.include) };
|
|
@@ -183305,8 +183508,9 @@ var Project2 = class _Project {
|
|
|
183305
183508
|
return this.program;
|
|
183306
183509
|
}
|
|
183307
183510
|
removeExistingTypings(include) {
|
|
183511
|
+
if (!include.length) return include;
|
|
183308
183512
|
const existing = getAutomaticTypeDirectiveNames(this.getCompilerOptions(), this.directoryStructureHost);
|
|
183309
|
-
return
|
|
183513
|
+
return filter(include, (i) => !existing.includes(i));
|
|
183310
183514
|
}
|
|
183311
183515
|
updateGraphWorker() {
|
|
183312
183516
|
var _a, _b;
|
|
@@ -190213,7 +190417,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
190213
190417
|
const packageDirectory = fileName.substring(0, nodeModulesPathParts.packageRootIndex);
|
|
190214
190418
|
const packageJsonCache = (_a2 = project.getModuleResolutionCache()) == null ? void 0 : _a2.getPackageJsonInfoCache();
|
|
190215
190419
|
const compilerOptions = project.getCompilationSettings();
|
|
190216
|
-
const packageJson = getPackageScopeForPath(getNormalizedAbsolutePath(packageDirectory
|
|
190420
|
+
const packageJson = getPackageScopeForPath(getNormalizedAbsolutePath(packageDirectory, project.getCurrentDirectory()), getTemporaryModuleResolutionState(packageJsonCache, project, compilerOptions));
|
|
190217
190421
|
if (!packageJson) return void 0;
|
|
190218
190422
|
const entrypoints = getEntrypointsFromPackageJsonInfo(
|
|
190219
190423
|
packageJson,
|
|
@@ -193090,6 +193294,7 @@ if (typeof console !== "undefined") {
|
|
|
193090
193294
|
canHaveJSDoc,
|
|
193091
193295
|
canHaveLocals,
|
|
193092
193296
|
canHaveModifiers,
|
|
193297
|
+
canHaveModuleSpecifier,
|
|
193093
193298
|
canHaveSymbol,
|
|
193094
193299
|
canIncludeBindAndCheckDiagnostics,
|
|
193095
193300
|
canJsonReportNoInputFiles,
|
|
@@ -193252,6 +193457,7 @@ if (typeof console !== "undefined") {
|
|
|
193252
193457
|
createMemberAccessForPropertyName,
|
|
193253
193458
|
createModeAwareCache,
|
|
193254
193459
|
createModeAwareCacheKey,
|
|
193460
|
+
createModeMismatchDetails,
|
|
193255
193461
|
createModuleNotFoundChain,
|
|
193256
193462
|
createModuleResolutionCache,
|
|
193257
193463
|
createModuleResolutionLoader,
|
|
@@ -193533,6 +193739,7 @@ if (typeof console !== "undefined") {
|
|
|
193533
193739
|
getDefaultLibFilePath,
|
|
193534
193740
|
getDefaultLikeExportInfo,
|
|
193535
193741
|
getDefaultLikeExportNameFromDeclaration,
|
|
193742
|
+
getDefaultResolutionModeForFileWorker,
|
|
193536
193743
|
getDiagnosticText,
|
|
193537
193744
|
getDiagnosticsWithinSpan,
|
|
193538
193745
|
getDirectoryPath,
|
|
@@ -193563,6 +193770,7 @@ if (typeof console !== "undefined") {
|
|
|
193563
193770
|
getEmitFlags,
|
|
193564
193771
|
getEmitHelpers,
|
|
193565
193772
|
getEmitModuleDetectionKind,
|
|
193773
|
+
getEmitModuleFormatOfFileWorker,
|
|
193566
193774
|
getEmitModuleKind,
|
|
193567
193775
|
getEmitModuleResolutionKind,
|
|
193568
193776
|
getEmitScriptTarget,
|
|
@@ -193613,6 +193821,7 @@ if (typeof console !== "undefined") {
|
|
|
193613
193821
|
getIdentifierGeneratedImportReference,
|
|
193614
193822
|
getIdentifierTypeArguments,
|
|
193615
193823
|
getImmediatelyInvokedFunctionExpression,
|
|
193824
|
+
getImpliedNodeFormatForEmitWorker,
|
|
193616
193825
|
getImpliedNodeFormatForFile,
|
|
193617
193826
|
getImpliedNodeFormatForFileWorker,
|
|
193618
193827
|
getImportNeedsImportDefaultHelper,
|
|
@@ -193718,7 +193927,6 @@ if (typeof console !== "undefined") {
|
|
|
193718
193927
|
getNameOfScriptTarget,
|
|
193719
193928
|
getNameOrArgument,
|
|
193720
193929
|
getNameTable,
|
|
193721
|
-
getNamesForExportedSymbol,
|
|
193722
193930
|
getNamespaceDeclarationNode,
|
|
193723
193931
|
getNewLineCharacter,
|
|
193724
193932
|
getNewLineKind,
|
|
@@ -193955,6 +194163,7 @@ if (typeof console !== "undefined") {
|
|
|
193955
194163
|
ignoreSourceNewlines,
|
|
193956
194164
|
ignoredPaths,
|
|
193957
194165
|
importFromModuleSpecifier,
|
|
194166
|
+
importSyntaxAffectsModuleResolution,
|
|
193958
194167
|
indexOfAnyCharCode,
|
|
193959
194168
|
indexOfNode,
|
|
193960
194169
|
indicesOf,
|
|
@@ -195000,11 +195209,11 @@ if (typeof console !== "undefined") {
|
|
|
195000
195209
|
transformESDecorators,
|
|
195001
195210
|
transformESNext,
|
|
195002
195211
|
transformGenerators,
|
|
195212
|
+
transformImpliedNodeFormatDependentModule,
|
|
195003
195213
|
transformJsx,
|
|
195004
195214
|
transformLegacyDecorators,
|
|
195005
195215
|
transformModule,
|
|
195006
195216
|
transformNamedEvaluation,
|
|
195007
|
-
transformNodeModule,
|
|
195008
195217
|
transformNodes,
|
|
195009
195218
|
transformSystemModule,
|
|
195010
195219
|
transformTypeScript,
|