typescript 5.6.0-dev.20240717 → 5.6.0-dev.20240719
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.webworker.d.ts +79 -100
- package/lib/lib.webworker.iterable.d.ts +1 -5
- package/lib/tsc.js +268 -115
- package/lib/typescript.d.ts +89 -22
- package/lib/typescript.js +445 -242
- package/package.json +16 -15
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,
|
|
@@ -692,6 +693,7 @@ __export(typescript_exports, {
|
|
|
692
693
|
getDefaultLibFilePath: () => getDefaultLibFilePath,
|
|
693
694
|
getDefaultLikeExportInfo: () => getDefaultLikeExportInfo,
|
|
694
695
|
getDefaultLikeExportNameFromDeclaration: () => getDefaultLikeExportNameFromDeclaration,
|
|
696
|
+
getDefaultResolutionModeForFileWorker: () => getDefaultResolutionModeForFileWorker,
|
|
695
697
|
getDiagnosticText: () => getDiagnosticText,
|
|
696
698
|
getDiagnosticsWithinSpan: () => getDiagnosticsWithinSpan,
|
|
697
699
|
getDirectoryPath: () => getDirectoryPath,
|
|
@@ -722,6 +724,7 @@ __export(typescript_exports, {
|
|
|
722
724
|
getEmitFlags: () => getEmitFlags,
|
|
723
725
|
getEmitHelpers: () => getEmitHelpers,
|
|
724
726
|
getEmitModuleDetectionKind: () => getEmitModuleDetectionKind,
|
|
727
|
+
getEmitModuleFormatOfFileWorker: () => getEmitModuleFormatOfFileWorker,
|
|
725
728
|
getEmitModuleKind: () => getEmitModuleKind,
|
|
726
729
|
getEmitModuleResolutionKind: () => getEmitModuleResolutionKind,
|
|
727
730
|
getEmitScriptTarget: () => getEmitScriptTarget,
|
|
@@ -772,6 +775,7 @@ __export(typescript_exports, {
|
|
|
772
775
|
getIdentifierGeneratedImportReference: () => getIdentifierGeneratedImportReference,
|
|
773
776
|
getIdentifierTypeArguments: () => getIdentifierTypeArguments,
|
|
774
777
|
getImmediatelyInvokedFunctionExpression: () => getImmediatelyInvokedFunctionExpression,
|
|
778
|
+
getImpliedNodeFormatForEmitWorker: () => getImpliedNodeFormatForEmitWorker,
|
|
775
779
|
getImpliedNodeFormatForFile: () => getImpliedNodeFormatForFile,
|
|
776
780
|
getImpliedNodeFormatForFileWorker: () => getImpliedNodeFormatForFileWorker,
|
|
777
781
|
getImportNeedsImportDefaultHelper: () => getImportNeedsImportDefaultHelper,
|
|
@@ -877,7 +881,6 @@ __export(typescript_exports, {
|
|
|
877
881
|
getNameOfScriptTarget: () => getNameOfScriptTarget,
|
|
878
882
|
getNameOrArgument: () => getNameOrArgument,
|
|
879
883
|
getNameTable: () => getNameTable,
|
|
880
|
-
getNamesForExportedSymbol: () => getNamesForExportedSymbol,
|
|
881
884
|
getNamespaceDeclarationNode: () => getNamespaceDeclarationNode,
|
|
882
885
|
getNewLineCharacter: () => getNewLineCharacter,
|
|
883
886
|
getNewLineKind: () => getNewLineKind,
|
|
@@ -1114,6 +1117,7 @@ __export(typescript_exports, {
|
|
|
1114
1117
|
ignoreSourceNewlines: () => ignoreSourceNewlines,
|
|
1115
1118
|
ignoredPaths: () => ignoredPaths,
|
|
1116
1119
|
importFromModuleSpecifier: () => importFromModuleSpecifier,
|
|
1120
|
+
importSyntaxAffectsModuleResolution: () => importSyntaxAffectsModuleResolution,
|
|
1117
1121
|
indexOfAnyCharCode: () => indexOfAnyCharCode,
|
|
1118
1122
|
indexOfNode: () => indexOfNode,
|
|
1119
1123
|
indicesOf: () => indicesOf,
|
|
@@ -2159,11 +2163,11 @@ __export(typescript_exports, {
|
|
|
2159
2163
|
transformESDecorators: () => transformESDecorators,
|
|
2160
2164
|
transformESNext: () => transformESNext,
|
|
2161
2165
|
transformGenerators: () => transformGenerators,
|
|
2166
|
+
transformImpliedNodeFormatDependentModule: () => transformImpliedNodeFormatDependentModule,
|
|
2162
2167
|
transformJsx: () => transformJsx,
|
|
2163
2168
|
transformLegacyDecorators: () => transformLegacyDecorators,
|
|
2164
2169
|
transformModule: () => transformModule,
|
|
2165
2170
|
transformNamedEvaluation: () => transformNamedEvaluation,
|
|
2166
|
-
transformNodeModule: () => transformNodeModule,
|
|
2167
2171
|
transformNodes: () => transformNodes,
|
|
2168
2172
|
transformSystemModule: () => transformSystemModule,
|
|
2169
2173
|
transformTypeScript: () => transformTypeScript,
|
|
@@ -2252,7 +2256,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2252
2256
|
|
|
2253
2257
|
// src/compiler/corePublic.ts
|
|
2254
2258
|
var versionMajorMinor = "5.6";
|
|
2255
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2259
|
+
var version = `${versionMajorMinor}.0-dev.20240719`;
|
|
2256
2260
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2257
2261
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2258
2262
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6088,6 +6092,7 @@ var FilePreprocessingDiagnosticsKind = /* @__PURE__ */ ((FilePreprocessingDiagno
|
|
|
6088
6092
|
var EmitOnly = /* @__PURE__ */ ((EmitOnly4) => {
|
|
6089
6093
|
EmitOnly4[EmitOnly4["Js"] = 0] = "Js";
|
|
6090
6094
|
EmitOnly4[EmitOnly4["Dts"] = 1] = "Dts";
|
|
6095
|
+
EmitOnly4[EmitOnly4["BuilderSignature"] = 2] = "BuilderSignature";
|
|
6091
6096
|
return EmitOnly4;
|
|
6092
6097
|
})(EmitOnly || {});
|
|
6093
6098
|
var StructureIsReused = /* @__PURE__ */ ((StructureIsReused2) => {
|
|
@@ -6725,22 +6730,22 @@ var ScriptKind = /* @__PURE__ */ ((ScriptKind7) => {
|
|
|
6725
6730
|
ScriptKind7[ScriptKind7["Deferred"] = 7] = "Deferred";
|
|
6726
6731
|
return ScriptKind7;
|
|
6727
6732
|
})(ScriptKind || {});
|
|
6728
|
-
var ScriptTarget = /* @__PURE__ */ ((
|
|
6729
|
-
|
|
6730
|
-
|
|
6731
|
-
|
|
6732
|
-
|
|
6733
|
-
|
|
6734
|
-
|
|
6735
|
-
|
|
6736
|
-
|
|
6737
|
-
|
|
6738
|
-
|
|
6739
|
-
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
|
|
6743
|
-
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;
|
|
6744
6749
|
})(ScriptTarget || {});
|
|
6745
6750
|
var LanguageVariant = /* @__PURE__ */ ((LanguageVariant4) => {
|
|
6746
6751
|
LanguageVariant4[LanguageVariant4["Standard"] = 0] = "Standard";
|
|
@@ -9295,6 +9300,7 @@ var Diagnostics = {
|
|
|
9295
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 }'."),
|
|
9296
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."),
|
|
9297
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'."),
|
|
9298
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."),
|
|
9299
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."),
|
|
9300
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."),
|
|
@@ -9503,6 +9509,7 @@ var Diagnostics = {
|
|
|
9503
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."),
|
|
9504
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."),
|
|
9505
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."),
|
|
9506
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."),
|
|
9507
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."),
|
|
9508
9515
|
Call_signature_return_types_0_and_1_are_incompatible: diag(
|
|
@@ -12374,9 +12381,16 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12374
12381
|
case 34 /* doubleQuote */:
|
|
12375
12382
|
return '"';
|
|
12376
12383
|
case 117 /* u */:
|
|
12377
|
-
if (
|
|
12384
|
+
if (pos < end && charCodeUnchecked(pos) === 123 /* openBrace */) {
|
|
12378
12385
|
pos -= 2;
|
|
12379
|
-
|
|
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;
|
|
12380
12394
|
}
|
|
12381
12395
|
for (; pos < start2 + 6; pos++) {
|
|
12382
12396
|
if (!(pos < end && isHexDigit(charCodeUnchecked(pos)))) {
|
|
@@ -12394,7 +12408,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
12394
12408
|
const nextStart = pos;
|
|
12395
12409
|
let nextPos = pos + 2;
|
|
12396
12410
|
for (; nextPos < nextStart + 6; nextPos++) {
|
|
12397
|
-
if (!isHexDigit(charCodeUnchecked(
|
|
12411
|
+
if (!isHexDigit(charCodeUnchecked(nextPos))) {
|
|
12398
12412
|
return escapedValueString;
|
|
12399
12413
|
}
|
|
12400
12414
|
}
|
|
@@ -14022,7 +14036,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
14022
14036
|
return value;
|
|
14023
14037
|
}
|
|
14024
14038
|
function scanSourceCharacter() {
|
|
14025
|
-
const size = anyUnicodeMode ? charSize(
|
|
14039
|
+
const size = anyUnicodeMode ? charSize(codePointChecked(pos)) : 1;
|
|
14026
14040
|
pos += size;
|
|
14027
14041
|
return size > 0 ? text.substring(pos - size, pos) : "";
|
|
14028
14042
|
}
|
|
@@ -18508,6 +18522,23 @@ function isFunctionSymbol(symbol) {
|
|
|
18508
18522
|
const decl = symbol.valueDeclaration;
|
|
18509
18523
|
return decl.kind === 262 /* FunctionDeclaration */ || isVariableDeclaration(decl) && decl.initializer && isFunctionLike(decl.initializer);
|
|
18510
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
|
+
}
|
|
18511
18542
|
function tryGetModuleSpecifierFromDeclaration(node) {
|
|
18512
18543
|
var _a, _b;
|
|
18513
18544
|
switch (node.kind) {
|
|
@@ -21491,8 +21522,8 @@ function walkTreeForJSXTags(node) {
|
|
|
21491
21522
|
function isFileModuleFromUsingJSXTag(file) {
|
|
21492
21523
|
return !file.isDeclarationFile ? walkTreeForJSXTags(file) : void 0;
|
|
21493
21524
|
}
|
|
21494
|
-
function isFileForcedToBeModuleByFormat(file) {
|
|
21495
|
-
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;
|
|
21496
21527
|
}
|
|
21497
21528
|
function getSetExternalModuleIndicator(options) {
|
|
21498
21529
|
switch (getEmitModuleDetectionKind(options)) {
|
|
@@ -21511,10 +21542,14 @@ function getSetExternalModuleIndicator(options) {
|
|
|
21511
21542
|
}
|
|
21512
21543
|
checks.push(isFileForcedToBeModuleByFormat);
|
|
21513
21544
|
const combined = or(...checks);
|
|
21514
|
-
const callback = (file) => void (file.externalModuleIndicator = combined(file));
|
|
21545
|
+
const callback = (file) => void (file.externalModuleIndicator = combined(file, options));
|
|
21515
21546
|
return callback;
|
|
21516
21547
|
}
|
|
21517
21548
|
}
|
|
21549
|
+
function importSyntaxAffectsModuleResolution(options) {
|
|
21550
|
+
const moduleResolution = getEmitModuleResolutionKind(options);
|
|
21551
|
+
return 3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */ || getResolvePackageJsonExports(options) || getResolvePackageJsonImports(options);
|
|
21552
|
+
}
|
|
21518
21553
|
function createComputedCompilerOptions(options) {
|
|
21519
21554
|
return options;
|
|
21520
21555
|
}
|
|
@@ -31001,7 +31036,7 @@ function createExternalHelpersImportDeclarationIfNeeded(nodeFactory, helperFacto
|
|
|
31001
31036
|
if (compilerOptions.importHelpers && isEffectiveExternalModule(sourceFile, compilerOptions)) {
|
|
31002
31037
|
let namedBindings;
|
|
31003
31038
|
const moduleKind = getEmitModuleKind(compilerOptions);
|
|
31004
|
-
if (moduleKind >= 5 /* ES2015 */ && moduleKind <= 99 /* ESNext */ || sourceFile
|
|
31039
|
+
if (moduleKind >= 5 /* ES2015 */ && moduleKind <= 99 /* ESNext */ || getImpliedNodeFormatForEmitWorker(sourceFile, compilerOptions) === 99 /* ESNext */) {
|
|
31005
31040
|
const helpers = getEmitHelpers(sourceFile);
|
|
31006
31041
|
if (helpers) {
|
|
31007
31042
|
const helperNames = [];
|
|
@@ -31066,8 +31101,7 @@ function getOrCreateExternalHelpersModuleNameIfNeeded(factory2, node, compilerOp
|
|
|
31066
31101
|
if (externalHelpersModuleName) {
|
|
31067
31102
|
return externalHelpersModuleName;
|
|
31068
31103
|
}
|
|
31069
|
-
|
|
31070
|
-
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 */;
|
|
31071
31105
|
if (!create) {
|
|
31072
31106
|
const helpers = getEmitHelpers(node);
|
|
31073
31107
|
if (helpers) {
|
|
@@ -40040,7 +40074,6 @@ var commonOptionsWithBuild = [
|
|
|
40040
40074
|
affectsBuildInfo: true,
|
|
40041
40075
|
showInSimplifiedHelpView: true,
|
|
40042
40076
|
category: Diagnostics.Emit,
|
|
40043
|
-
transpileOptionValue: void 0,
|
|
40044
40077
|
defaultValueDescription: false,
|
|
40045
40078
|
description: Diagnostics.Create_sourcemaps_for_d_ts_files
|
|
40046
40079
|
},
|
|
@@ -48777,13 +48810,15 @@ var RelativePreference = /* @__PURE__ */ ((RelativePreference2) => {
|
|
|
48777
48810
|
RelativePreference2[RelativePreference2["ExternalNonRelative"] = 3] = "ExternalNonRelative";
|
|
48778
48811
|
return RelativePreference2;
|
|
48779
48812
|
})(RelativePreference || {});
|
|
48780
|
-
function getModuleSpecifierPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding }, compilerOptions, importingSourceFile, oldImportSpecifier) {
|
|
48813
|
+
function getModuleSpecifierPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding }, host, compilerOptions, importingSourceFile, oldImportSpecifier) {
|
|
48781
48814
|
const filePreferredEnding = getPreferredEnding();
|
|
48782
48815
|
return {
|
|
48783
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 */,
|
|
48784
48817
|
getAllowedEndingsInPreferredOrder: (syntaxImpliedNodeFormat) => {
|
|
48785
|
-
const
|
|
48786
|
-
|
|
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 */) {
|
|
48787
48822
|
if (shouldAllowImportingTsExtension(compilerOptions, importingSourceFile.fileName)) {
|
|
48788
48823
|
return [3 /* TsExtension */, 2 /* JsExtension */];
|
|
48789
48824
|
}
|
|
@@ -48814,19 +48849,19 @@ function getModuleSpecifierPreferences({ importModuleSpecifierPreference, import
|
|
|
48814
48849
|
}
|
|
48815
48850
|
return getModuleSpecifierEndingPreference(
|
|
48816
48851
|
importModuleSpecifierEnding,
|
|
48817
|
-
resolutionMode ?? importingSourceFile
|
|
48852
|
+
resolutionMode ?? getDefaultResolutionModeForFile(importingSourceFile, host, compilerOptions),
|
|
48818
48853
|
compilerOptions,
|
|
48819
48854
|
isFullSourceFile(importingSourceFile) ? importingSourceFile : void 0
|
|
48820
48855
|
);
|
|
48821
48856
|
}
|
|
48822
48857
|
}
|
|
48823
48858
|
function updateModuleSpecifier(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, oldImportSpecifier, options = {}) {
|
|
48824
|
-
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);
|
|
48825
48860
|
if (res === oldImportSpecifier) return void 0;
|
|
48826
48861
|
return res;
|
|
48827
48862
|
}
|
|
48828
48863
|
function getModuleSpecifier(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, options = {}) {
|
|
48829
|
-
return getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getModuleSpecifierPreferences({}, compilerOptions, importingSourceFile), {}, options);
|
|
48864
|
+
return getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getModuleSpecifierPreferences({}, host, compilerOptions, importingSourceFile), {}, options);
|
|
48830
48865
|
}
|
|
48831
48866
|
function getNodeModulesPackageName(compilerOptions, importingSourceFile, nodeModulesFileName, host, preferences, options = {}) {
|
|
48832
48867
|
const info = getInfo(importingSourceFile.fileName, host);
|
|
@@ -48856,7 +48891,7 @@ function getModuleSpecifierWorker(compilerOptions, importingSourceFile, importin
|
|
|
48856
48891
|
/*packageNameOnly*/
|
|
48857
48892
|
void 0,
|
|
48858
48893
|
options.overrideImportMode
|
|
48859
|
-
)) || getLocalModuleSpecifier(toFileName2, info, compilerOptions, host, options.overrideImportMode || importingSourceFile
|
|
48894
|
+
)) || getLocalModuleSpecifier(toFileName2, info, compilerOptions, host, options.overrideImportMode || getDefaultResolutionModeForFile(importingSourceFile, host, compilerOptions), preferences);
|
|
48860
48895
|
}
|
|
48861
48896
|
function tryGetModuleSpecifiersFromCache(moduleSymbol, importingSourceFile, host, userPreferences, options = {}) {
|
|
48862
48897
|
const result = tryGetModuleSpecifiersFromCacheWorker(
|
|
@@ -48927,17 +48962,21 @@ function getLocalModuleSpecifierBetweenFileNames(importingFile, targetFileName,
|
|
|
48927
48962
|
compilerOptions,
|
|
48928
48963
|
host,
|
|
48929
48964
|
importMode,
|
|
48930
|
-
getModuleSpecifierPreferences({}, compilerOptions, importingFile)
|
|
48965
|
+
getModuleSpecifierPreferences({}, host, compilerOptions, importingFile)
|
|
48931
48966
|
);
|
|
48932
48967
|
}
|
|
48933
48968
|
function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
|
|
48934
48969
|
const info = getInfo(importingSourceFile.fileName, host);
|
|
48935
|
-
const preferences = getModuleSpecifierPreferences(userPreferences, compilerOptions, importingSourceFile);
|
|
48970
|
+
const preferences = getModuleSpecifierPreferences(userPreferences, host, compilerOptions, importingSourceFile);
|
|
48936
48971
|
const existingSpecifier = isFullSourceFile(importingSourceFile) && forEach(modulePaths, (modulePath) => forEach(
|
|
48937
48972
|
host.getFileIncludeReasons().get(toPath(modulePath.path, host.getCurrentDirectory(), info.getCanonicalFileName)),
|
|
48938
48973
|
(reason) => {
|
|
48939
48974
|
if (reason.kind !== 3 /* Import */ || reason.file !== importingSourceFile.path) return void 0;
|
|
48940
|
-
|
|
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
|
+
}
|
|
48941
48980
|
const specifier = getModuleNameStringLiteralAt(importingSourceFile, reason.index).text;
|
|
48942
48981
|
return preferences.relativePreference !== 1 /* NonRelative */ || !pathIsRelative(specifier) ? specifier : void 0;
|
|
48943
48982
|
}
|
|
@@ -49467,7 +49506,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
|
|
|
49467
49506
|
if (!parts) {
|
|
49468
49507
|
return void 0;
|
|
49469
49508
|
}
|
|
49470
|
-
const preferences = getModuleSpecifierPreferences(userPreferences, options, importingSourceFile);
|
|
49509
|
+
const preferences = getModuleSpecifierPreferences(userPreferences, host, options, importingSourceFile);
|
|
49471
49510
|
const allowedEndings = preferences.getAllowedEndingsInPreferredOrder();
|
|
49472
49511
|
let moduleSpecifier = path;
|
|
49473
49512
|
let isPackageRootPath = false;
|
|
@@ -49517,7 +49556,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
|
|
|
49517
49556
|
const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
49518
49557
|
if (isPackageJsonInfo(cachedPackageJson) || cachedPackageJson === void 0 && host.fileExists(packageJsonPath)) {
|
|
49519
49558
|
const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || tryParseJson(host.readFile(packageJsonPath));
|
|
49520
|
-
const importMode = overrideMode || importingSourceFile
|
|
49559
|
+
const importMode = overrideMode || getDefaultResolutionModeForFile(importingSourceFile, host, options);
|
|
49521
49560
|
if (getResolvePackageJsonExports(options)) {
|
|
49522
49561
|
const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
|
|
49523
49562
|
const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
|
|
@@ -49667,6 +49706,9 @@ function getRelativePathIfInSameVolume(path, directoryPath, getCanonicalFileName
|
|
|
49667
49706
|
function isPathRelativeToParent(path) {
|
|
49668
49707
|
return startsWith(path, "..");
|
|
49669
49708
|
}
|
|
49709
|
+
function getDefaultResolutionModeForFile(file, host, compilerOptions) {
|
|
49710
|
+
return isFullSourceFile(file) ? host.getDefaultResolutionModeForFile(file) : getDefaultResolutionModeForFileWorker(file, compilerOptions);
|
|
49711
|
+
}
|
|
49670
49712
|
|
|
49671
49713
|
// src/compiler/checker.ts
|
|
49672
49714
|
var ambientModuleSymbolRegex = /^".+"$/;
|
|
@@ -51887,22 +51929,28 @@ function createTypeChecker(host) {
|
|
|
51887
51929
|
function isSyntacticDefault(node) {
|
|
51888
51930
|
return isExportAssignment(node) && !node.isExportEquals || hasSyntacticModifier(node, 2048 /* Default */) || isExportSpecifier(node) || isNamespaceExport(node);
|
|
51889
51931
|
}
|
|
51890
|
-
function
|
|
51891
|
-
return isStringLiteralLike(usage) ? host.
|
|
51932
|
+
function getEmitSyntaxForModuleSpecifierExpression(usage) {
|
|
51933
|
+
return isStringLiteralLike(usage) ? host.getEmitSyntaxForUsageLocation(getSourceFileOfNode(usage), usage) : void 0;
|
|
51892
51934
|
}
|
|
51893
51935
|
function isESMFormatImportImportingCommonjsFormatFile(usageMode, targetMode) {
|
|
51894
51936
|
return usageMode === 99 /* ESNext */ && targetMode === 1 /* CommonJS */;
|
|
51895
51937
|
}
|
|
51896
|
-
function
|
|
51897
|
-
|
|
51898
|
-
|
|
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;
|
|
51899
51944
|
}
|
|
51900
51945
|
function canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, usage) {
|
|
51901
|
-
const usageMode = file &&
|
|
51902
|
-
if (file && usageMode !== void 0
|
|
51903
|
-
const
|
|
51904
|
-
if (usageMode === 99 /* ESNext */
|
|
51905
|
-
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;
|
|
51906
51954
|
}
|
|
51907
51955
|
}
|
|
51908
51956
|
if (!allowSyntheticDefaultImports) {
|
|
@@ -51961,7 +52009,7 @@ function createTypeChecker(host) {
|
|
|
51961
52009
|
if (!specifier) {
|
|
51962
52010
|
return exportDefaultSymbol;
|
|
51963
52011
|
}
|
|
51964
|
-
const hasDefaultOnly =
|
|
52012
|
+
const hasDefaultOnly = isOnlyImportableAsDefault(specifier);
|
|
51965
52013
|
const hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
|
|
51966
52014
|
if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
|
|
51967
52015
|
if (hasExportAssignmentSymbol(moduleSymbol) && !allowSyntheticDefaultImports) {
|
|
@@ -52163,7 +52211,7 @@ function createTypeChecker(host) {
|
|
|
52163
52211
|
let symbolFromModule = getExportOfModule(targetSymbol, nameText, specifier, dontResolveAlias);
|
|
52164
52212
|
if (symbolFromModule === void 0 && nameText === "default" /* Default */) {
|
|
52165
52213
|
const file = (_a = moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
|
|
52166
|
-
if (
|
|
52214
|
+
if (isOnlyImportableAsDefault(moduleSpecifier) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
|
|
52167
52215
|
symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
|
|
52168
52216
|
}
|
|
52169
52217
|
}
|
|
@@ -52767,7 +52815,7 @@ function createTypeChecker(host) {
|
|
|
52767
52815
|
/*requireStringLiteralLikeArgument*/
|
|
52768
52816
|
true
|
|
52769
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);
|
|
52770
|
-
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile
|
|
52818
|
+
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : host.getDefaultResolutionModeForFile(currentSourceFile);
|
|
52771
52819
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
52772
52820
|
const resolvedModule = (_g = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _g.resolvedModule;
|
|
52773
52821
|
const resolutionDiagnostic = errorNode && resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
@@ -52980,7 +53028,7 @@ function createTypeChecker(host) {
|
|
|
52980
53028
|
return cloneTypeAsModuleType(symbol, defaultOnlyType, referenceParent);
|
|
52981
53029
|
}
|
|
52982
53030
|
const targetFile = (_a = moduleSymbol == null ? void 0 : moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
|
|
52983
|
-
const isEsmCjsRef = targetFile && isESMFormatImportImportingCommonjsFormatFile(
|
|
53031
|
+
const isEsmCjsRef = targetFile && isESMFormatImportImportingCommonjsFormatFile(getEmitSyntaxForModuleSpecifierExpression(reference), host.getImpliedNodeFormatForEmit(targetFile));
|
|
52984
53032
|
if (getESModuleInterop(compilerOptions) || isEsmCjsRef) {
|
|
52985
53033
|
let sigs = getSignaturesOfStructuredType(type, 0 /* Call */);
|
|
52986
53034
|
if (!sigs || !sigs.length) {
|
|
@@ -55600,8 +55648,10 @@ function createTypeChecker(host) {
|
|
|
55600
55648
|
}
|
|
55601
55649
|
return getSourceFileOfNode(getNonAugmentationDeclaration(symbol)).fileName;
|
|
55602
55650
|
}
|
|
55651
|
+
const enclosingDeclaration = getOriginalNode(context.enclosingDeclaration);
|
|
55652
|
+
const originalModuleSpecifier = canHaveModuleSpecifier(enclosingDeclaration) ? tryGetModuleSpecifierFromDeclaration(enclosingDeclaration) : void 0;
|
|
55603
55653
|
const contextFile = context.enclosingFile;
|
|
55604
|
-
const resolutionMode = overrideImportMode || (contextFile
|
|
55654
|
+
const resolutionMode = overrideImportMode || originalModuleSpecifier && host.getModeForUsageLocation(contextFile, originalModuleSpecifier) || contextFile && host.getDefaultResolutionModeForFile(contextFile);
|
|
55605
55655
|
const cacheKey = createModeAwareCacheKey(contextFile.path, resolutionMode);
|
|
55606
55656
|
const links = getSymbolLinks(symbol);
|
|
55607
55657
|
let specifier = links.specifierCache && links.specifierCache.get(cacheKey);
|
|
@@ -60650,18 +60700,18 @@ function createTypeChecker(host) {
|
|
|
60650
60700
|
function getExpandedParameters(sig, skipUnionExpanding) {
|
|
60651
60701
|
if (signatureHasRestParameter(sig)) {
|
|
60652
60702
|
const restIndex = sig.parameters.length - 1;
|
|
60653
|
-
const
|
|
60654
|
-
const restType = getTypeOfSymbol(
|
|
60703
|
+
const restSymbol = sig.parameters[restIndex];
|
|
60704
|
+
const restType = getTypeOfSymbol(restSymbol);
|
|
60655
60705
|
if (isTupleType(restType)) {
|
|
60656
|
-
return [expandSignatureParametersWithTupleMembers(restType, restIndex,
|
|
60706
|
+
return [expandSignatureParametersWithTupleMembers(restType, restIndex, restSymbol)];
|
|
60657
60707
|
} else if (!skipUnionExpanding && restType.flags & 1048576 /* Union */ && every(restType.types, isTupleType)) {
|
|
60658
|
-
return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex,
|
|
60708
|
+
return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex, restSymbol));
|
|
60659
60709
|
}
|
|
60660
60710
|
}
|
|
60661
60711
|
return [sig.parameters];
|
|
60662
|
-
function expandSignatureParametersWithTupleMembers(restType, restIndex,
|
|
60712
|
+
function expandSignatureParametersWithTupleMembers(restType, restIndex, restSymbol) {
|
|
60663
60713
|
const elementTypes = getTypeArguments(restType);
|
|
60664
|
-
const associatedNames = getUniqAssociatedNamesFromTupleType(restType,
|
|
60714
|
+
const associatedNames = getUniqAssociatedNamesFromTupleType(restType, restSymbol);
|
|
60665
60715
|
const restParams = map(elementTypes, (t, i) => {
|
|
60666
60716
|
const name = associatedNames && associatedNames[i] ? associatedNames[i] : getParameterNameAtPosition(sig, restIndex + i, restType);
|
|
60667
60717
|
const flags = restType.target.elementFlags[i];
|
|
@@ -60672,19 +60722,29 @@ function createTypeChecker(host) {
|
|
|
60672
60722
|
});
|
|
60673
60723
|
return concatenate(sig.parameters.slice(0, restIndex), restParams);
|
|
60674
60724
|
}
|
|
60675
|
-
function getUniqAssociatedNamesFromTupleType(type,
|
|
60676
|
-
const
|
|
60677
|
-
|
|
60678
|
-
const
|
|
60679
|
-
const
|
|
60680
|
-
|
|
60681
|
-
|
|
60682
|
-
|
|
60683
|
-
|
|
60684
|
-
|
|
60685
|
-
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
|
+
}
|
|
60686
60735
|
}
|
|
60687
|
-
|
|
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;
|
|
60688
60748
|
}
|
|
60689
60749
|
}
|
|
60690
60750
|
function getDefaultConstructSignatures(classType) {
|
|
@@ -74176,7 +74236,7 @@ function createTypeChecker(host) {
|
|
|
74176
74236
|
if (!canCollectSymbolAliasAccessabilityData) {
|
|
74177
74237
|
return;
|
|
74178
74238
|
}
|
|
74179
|
-
if (location.flags & 33554432 /* Ambient */) {
|
|
74239
|
+
if (location.flags & 33554432 /* Ambient */ && !isPropertySignature(location) && !isPropertyDeclaration(location)) {
|
|
74180
74240
|
return;
|
|
74181
74241
|
}
|
|
74182
74242
|
switch (hint) {
|
|
@@ -80098,7 +80158,7 @@ function createTypeChecker(host) {
|
|
|
80098
80158
|
return createAnonymousType(anonymousSymbol, memberTable, emptyArray, emptyArray, emptyArray);
|
|
80099
80159
|
}
|
|
80100
80160
|
function getTypeWithSyntheticDefaultOnly(type, symbol, originalSymbol, moduleSpecifier) {
|
|
80101
|
-
const hasDefaultOnly =
|
|
80161
|
+
const hasDefaultOnly = isOnlyImportableAsDefault(moduleSpecifier);
|
|
80102
80162
|
if (hasDefaultOnly && type && !isErrorType(type)) {
|
|
80103
80163
|
const synthType = type;
|
|
80104
80164
|
if (!synthType.defaultOnlyType) {
|
|
@@ -80424,14 +80484,45 @@ function createTypeChecker(host) {
|
|
|
80424
80484
|
!!declaration && (hasInitializer(declaration) || isOptionalDeclaration(declaration))
|
|
80425
80485
|
);
|
|
80426
80486
|
}
|
|
80427
|
-
function
|
|
80487
|
+
function getTupleElementLabelFromBindingElement(node, index, elementFlags) {
|
|
80488
|
+
switch (node.name.kind) {
|
|
80489
|
+
case 80 /* Identifier */: {
|
|
80490
|
+
const name = node.name.escapedText;
|
|
80491
|
+
if (node.dotDotDotToken) {
|
|
80492
|
+
return elementFlags & 12 /* Variable */ ? name : `${name}_${index}`;
|
|
80493
|
+
} else {
|
|
80494
|
+
return elementFlags & 3 /* Fixed */ ? name : `${name}_n`;
|
|
80495
|
+
}
|
|
80496
|
+
}
|
|
80497
|
+
case 207 /* ArrayBindingPattern */: {
|
|
80498
|
+
if (node.dotDotDotToken) {
|
|
80499
|
+
const elements = node.name.elements;
|
|
80500
|
+
const lastElement = tryCast(lastOrUndefined(elements), isBindingElement);
|
|
80501
|
+
const elementCount = elements.length - ((lastElement == null ? void 0 : lastElement.dotDotDotToken) ? 1 : 0);
|
|
80502
|
+
if (index < elementCount) {
|
|
80503
|
+
const element = elements[index];
|
|
80504
|
+
if (isBindingElement(element)) {
|
|
80505
|
+
return getTupleElementLabelFromBindingElement(element, index, elementFlags);
|
|
80506
|
+
}
|
|
80507
|
+
} else if (lastElement == null ? void 0 : lastElement.dotDotDotToken) {
|
|
80508
|
+
return getTupleElementLabelFromBindingElement(lastElement, index - elementCount, elementFlags);
|
|
80509
|
+
}
|
|
80510
|
+
}
|
|
80511
|
+
break;
|
|
80512
|
+
}
|
|
80513
|
+
}
|
|
80514
|
+
return `arg_${index}`;
|
|
80515
|
+
}
|
|
80516
|
+
function getTupleElementLabel(d, index = 0, elementFlags = 3 /* Fixed */, restSymbol) {
|
|
80428
80517
|
if (!d) {
|
|
80429
|
-
|
|
80518
|
+
const restParameter = tryCast(restSymbol == null ? void 0 : restSymbol.valueDeclaration, isParameter);
|
|
80519
|
+
return restParameter ? getTupleElementLabelFromBindingElement(restParameter, index, elementFlags) : `${(restSymbol == null ? void 0 : restSymbol.escapedName) ?? "arg"}_${index}`;
|
|
80430
80520
|
}
|
|
80431
80521
|
Debug.assert(isIdentifier(d.name));
|
|
80432
80522
|
return d.name.escapedText;
|
|
80433
80523
|
}
|
|
80434
80524
|
function getParameterNameAtPosition(signature, pos, overrideRestType) {
|
|
80525
|
+
var _a;
|
|
80435
80526
|
const paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0);
|
|
80436
80527
|
if (pos < paramCount) {
|
|
80437
80528
|
return signature.parameters[pos].escapedName;
|
|
@@ -80439,9 +80530,11 @@ function createTypeChecker(host) {
|
|
|
80439
80530
|
const restParameter = signature.parameters[paramCount] || unknownSymbol;
|
|
80440
80531
|
const restType = overrideRestType || getTypeOfSymbol(restParameter);
|
|
80441
80532
|
if (isTupleType(restType)) {
|
|
80442
|
-
const
|
|
80533
|
+
const tupleType = restType.target;
|
|
80443
80534
|
const index = pos - paramCount;
|
|
80444
|
-
|
|
80535
|
+
const associatedName = (_a = tupleType.labeledElementDeclarations) == null ? void 0 : _a[index];
|
|
80536
|
+
const elementFlags = tupleType.elementFlags[index];
|
|
80537
|
+
return getTupleElementLabel(associatedName, index, elementFlags, restParameter);
|
|
80445
80538
|
}
|
|
80446
80539
|
return restParameter.escapedName;
|
|
80447
80540
|
}
|
|
@@ -85372,7 +85465,7 @@ function createTypeChecker(host) {
|
|
|
85372
85465
|
});
|
|
85373
85466
|
}
|
|
85374
85467
|
function checkCollisionWithRequireExportsInGeneratedCode(node, name) {
|
|
85375
|
-
if (
|
|
85468
|
+
if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) >= 5 /* ES2015 */) {
|
|
85376
85469
|
return;
|
|
85377
85470
|
}
|
|
85378
85471
|
if (!name || !needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) {
|
|
@@ -86793,7 +86886,7 @@ function createTypeChecker(host) {
|
|
|
86793
86886
|
}
|
|
86794
86887
|
}
|
|
86795
86888
|
function checkClassNameCollisionWithObject(name) {
|
|
86796
|
-
if (languageVersion >= 1 /* ES5 */ && name.escapedText === "Object" && (
|
|
86889
|
+
if (languageVersion >= 1 /* ES5 */ && name.escapedText === "Object" && host.getEmitModuleFormatOfFile(getSourceFileOfNode(name)) < 5 /* ES2015 */) {
|
|
86797
86890
|
error2(name, Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_with_module_0, ModuleKind[moduleKind]);
|
|
86798
86891
|
}
|
|
86799
86892
|
}
|
|
@@ -87873,7 +87966,7 @@ function createTypeChecker(host) {
|
|
|
87873
87966
|
getNodeLinks(node).flags |= 2048 /* LexicalModuleMergesWithClass */;
|
|
87874
87967
|
}
|
|
87875
87968
|
}
|
|
87876
|
-
if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 307 /* SourceFile */ && (
|
|
87969
|
+
if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 307 /* SourceFile */ && host.getEmitModuleFormatOfFile(node.parent) === 1 /* CommonJS */) {
|
|
87877
87970
|
const exportModifier = (_b = node.modifiers) == null ? void 0 : _b.find((m) => m.kind === 95 /* ExportKeyword */);
|
|
87878
87971
|
if (exportModifier) {
|
|
87879
87972
|
error2(exportModifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
@@ -88093,8 +88186,10 @@ function createTypeChecker(host) {
|
|
|
88093
88186
|
}
|
|
88094
88187
|
}
|
|
88095
88188
|
}
|
|
88096
|
-
if (compilerOptions.verbatimModuleSyntax && node.kind !== 271 /* ImportEqualsDeclaration */ && !isInJSFile(node) && (
|
|
88189
|
+
if (compilerOptions.verbatimModuleSyntax && node.kind !== 271 /* ImportEqualsDeclaration */ && !isInJSFile(node) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
|
|
88097
88190
|
error2(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
88191
|
+
} else if (moduleKind === 200 /* Preserve */ && node.kind !== 271 /* ImportEqualsDeclaration */ && node.kind !== 260 /* VariableDeclaration */ && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
|
|
88192
|
+
error2(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve);
|
|
88098
88193
|
}
|
|
88099
88194
|
}
|
|
88100
88195
|
if (isImportSpecifier(node)) {
|
|
@@ -88135,7 +88230,7 @@ function createTypeChecker(host) {
|
|
|
88135
88230
|
checkAliasSymbol(node);
|
|
88136
88231
|
if (node.kind === 276 /* ImportSpecifier */) {
|
|
88137
88232
|
checkModuleExportName(node.propertyName);
|
|
88138
|
-
if (moduleExportNameIsDefault(node.propertyName || node.name) && getESModuleInterop(compilerOptions) &&
|
|
88233
|
+
if (moduleExportNameIsDefault(node.propertyName || node.name) && getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */) {
|
|
88139
88234
|
checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
|
|
88140
88235
|
}
|
|
88141
88236
|
}
|
|
@@ -88157,7 +88252,7 @@ function createTypeChecker(host) {
|
|
|
88157
88252
|
if (validForTypeAttributes && override) {
|
|
88158
88253
|
return;
|
|
88159
88254
|
}
|
|
88160
|
-
const mode = moduleKind === 199 /* NodeNext */ && declaration.moduleSpecifier &&
|
|
88255
|
+
const mode = moduleKind === 199 /* NodeNext */ && declaration.moduleSpecifier && getEmitSyntaxForModuleSpecifierExpression(declaration.moduleSpecifier);
|
|
88161
88256
|
if (mode !== 99 /* ESNext */ && moduleKind !== 99 /* ESNext */ && moduleKind !== 200 /* Preserve */) {
|
|
88162
88257
|
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;
|
|
88163
88258
|
return grammarErrorOnNode(node, message);
|
|
@@ -88190,7 +88285,7 @@ function createTypeChecker(host) {
|
|
|
88190
88285
|
if (importClause.namedBindings) {
|
|
88191
88286
|
if (importClause.namedBindings.kind === 274 /* NamespaceImport */) {
|
|
88192
88287
|
checkImportBinding(importClause.namedBindings);
|
|
88193
|
-
if (
|
|
88288
|
+
if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && getESModuleInterop(compilerOptions)) {
|
|
88194
88289
|
checkExternalEmitHelpers(node, 65536 /* ImportStar */);
|
|
88195
88290
|
}
|
|
88196
88291
|
} else {
|
|
@@ -88230,7 +88325,7 @@ function createTypeChecker(host) {
|
|
|
88230
88325
|
grammarErrorOnNode(node, Diagnostics.An_import_alias_cannot_use_import_type);
|
|
88231
88326
|
}
|
|
88232
88327
|
} else {
|
|
88233
|
-
if (
|
|
88328
|
+
if (5 /* ES2015 */ <= moduleKind && moduleKind <= 99 /* ESNext */ && !node.isTypeOnly && !(node.flags & 33554432 /* Ambient */)) {
|
|
88234
88329
|
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);
|
|
88235
88330
|
}
|
|
88236
88331
|
}
|
|
@@ -88260,7 +88355,7 @@ function createTypeChecker(host) {
|
|
|
88260
88355
|
checkAliasSymbol(node.exportClause);
|
|
88261
88356
|
checkModuleExportName(node.exportClause.name);
|
|
88262
88357
|
}
|
|
88263
|
-
if (
|
|
88358
|
+
if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */) {
|
|
88264
88359
|
if (node.exportClause) {
|
|
88265
88360
|
if (getESModuleInterop(compilerOptions)) {
|
|
88266
88361
|
checkExternalEmitHelpers(node, 65536 /* ImportStar */);
|
|
@@ -88319,7 +88414,7 @@ function createTypeChecker(host) {
|
|
|
88319
88414
|
markLinkedReferences(node, 7 /* ExportSpecifier */);
|
|
88320
88415
|
}
|
|
88321
88416
|
} else {
|
|
88322
|
-
if (getESModuleInterop(compilerOptions) &&
|
|
88417
|
+
if (getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && moduleExportNameIsDefault(node.propertyName || node.name)) {
|
|
88323
88418
|
checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
|
|
88324
88419
|
}
|
|
88325
88420
|
}
|
|
@@ -88345,7 +88440,7 @@ function createTypeChecker(host) {
|
|
|
88345
88440
|
if (typeAnnotationNode) {
|
|
88346
88441
|
checkTypeAssignableTo(checkExpressionCached(node.expression), getTypeFromTypeNode(typeAnnotationNode), node.expression);
|
|
88347
88442
|
}
|
|
88348
|
-
const isIllegalExportDefaultInCJS = !node.isExportEquals && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax && (
|
|
88443
|
+
const isIllegalExportDefaultInCJS = !node.isExportEquals && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */;
|
|
88349
88444
|
if (node.expression.kind === 80 /* Identifier */) {
|
|
88350
88445
|
const id = node.expression;
|
|
88351
88446
|
const sym = getExportSymbolOfValueSymbolIfExported(resolveEntityName(
|
|
@@ -88425,7 +88520,7 @@ function createTypeChecker(host) {
|
|
|
88425
88520
|
grammarErrorOnNode(node.expression, Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context);
|
|
88426
88521
|
}
|
|
88427
88522
|
if (node.isExportEquals) {
|
|
88428
|
-
if (moduleKind >= 5 /* ES2015 */ && moduleKind !== 200 /* Preserve */ && (node.flags & 33554432 /* Ambient */ && getSourceFileOfNode(node)
|
|
88523
|
+
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 */)) {
|
|
88429
88524
|
grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
|
|
88430
88525
|
} else if (moduleKind === 4 /* System */ && !(node.flags & 33554432 /* Ambient */)) {
|
|
88431
88526
|
grammarErrorOnNode(node, Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system);
|
|
@@ -90970,7 +91065,7 @@ function createTypeChecker(host) {
|
|
|
90970
91065
|
break;
|
|
90971
91066
|
case 95 /* ExportKeyword */:
|
|
90972
91067
|
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
|
|
90973
|
-
node.kind !== 267 /* ModuleDeclaration */ && node.parent.kind === 307 /* SourceFile */ && (
|
|
91068
|
+
node.kind !== 267 /* ModuleDeclaration */ && node.parent.kind === 307 /* SourceFile */ && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
|
|
90974
91069
|
return grammarErrorOnNode(modifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
90975
91070
|
}
|
|
90976
91071
|
if (flags & 32 /* Export */) {
|
|
@@ -91880,7 +91975,7 @@ function createTypeChecker(host) {
|
|
|
91880
91975
|
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;
|
|
91881
91976
|
return grammarErrorOnNode(node.exclamationToken, message);
|
|
91882
91977
|
}
|
|
91883
|
-
if ((
|
|
91978
|
+
if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && !(node.parent.parent.flags & 33554432 /* Ambient */) && hasSyntacticModifier(node.parent.parent, 32 /* Export */)) {
|
|
91884
91979
|
checkESModuleMarker(node.name);
|
|
91885
91980
|
}
|
|
91886
91981
|
return !!blockScopeKind && checkGrammarNameInLetOrConstDeclarations(node.name);
|
|
@@ -92381,7 +92476,9 @@ function createBasicNodeBuilderModuleSpecifierResolutionHost(host) {
|
|
|
92381
92476
|
isSourceOfProjectReferenceRedirect: (fileName) => host.isSourceOfProjectReferenceRedirect(fileName),
|
|
92382
92477
|
fileExists: (fileName) => host.fileExists(fileName),
|
|
92383
92478
|
getFileIncludeReasons: () => host.getFileIncludeReasons(),
|
|
92384
|
-
readFile: host.readFile ? (fileName) => host.readFile(fileName) : void 0
|
|
92479
|
+
readFile: host.readFile ? (fileName) => host.readFile(fileName) : void 0,
|
|
92480
|
+
getDefaultResolutionModeForFile: (file) => host.getDefaultResolutionModeForFile(file),
|
|
92481
|
+
getModeForResolutionAtIndex: (file, index) => host.getModeForResolutionAtIndex(file, index)
|
|
92385
92482
|
};
|
|
92386
92483
|
}
|
|
92387
92484
|
var SymbolTrackerImpl = class _SymbolTrackerImpl {
|
|
@@ -112234,7 +112331,7 @@ function transformModule(context) {
|
|
|
112234
112331
|
case 354 /* PartiallyEmittedExpression */:
|
|
112235
112332
|
return visitPartiallyEmittedExpression(node, valueIsDiscarded);
|
|
112236
112333
|
case 213 /* CallExpression */:
|
|
112237
|
-
if (isImportCall(node) && currentSourceFile
|
|
112334
|
+
if (isImportCall(node) && host.shouldTransformImportCall(currentSourceFile)) {
|
|
112238
112335
|
return visitImportCallExpression(node);
|
|
112239
112336
|
}
|
|
112240
112337
|
break;
|
|
@@ -115230,8 +115327,8 @@ function transformECMAScriptModule(context) {
|
|
|
115230
115327
|
}
|
|
115231
115328
|
}
|
|
115232
115329
|
|
|
115233
|
-
// src/compiler/transformers/module/
|
|
115234
|
-
function
|
|
115330
|
+
// src/compiler/transformers/module/impliedNodeFormatDependent.ts
|
|
115331
|
+
function transformImpliedNodeFormatDependentModule(context) {
|
|
115235
115332
|
const previousOnSubstituteNode = context.onSubstituteNode;
|
|
115236
115333
|
const previousOnEmitNode = context.onEmitNode;
|
|
115237
115334
|
const esmTransform = transformECMAScriptModule(context);
|
|
@@ -115242,6 +115339,7 @@ function transformNodeModule(context) {
|
|
|
115242
115339
|
const cjsTransform = transformModule(context);
|
|
115243
115340
|
const cjsOnSubstituteNode = context.onSubstituteNode;
|
|
115244
115341
|
const cjsOnEmitNode = context.onEmitNode;
|
|
115342
|
+
const getEmitModuleFormatOfFile2 = (file) => context.getEmitHost().getEmitModuleFormatOfFile(file);
|
|
115245
115343
|
context.onSubstituteNode = onSubstituteNode;
|
|
115246
115344
|
context.onEmitNode = onEmitNode;
|
|
115247
115345
|
context.enableSubstitution(307 /* SourceFile */);
|
|
@@ -115256,7 +115354,7 @@ function transformNodeModule(context) {
|
|
|
115256
115354
|
if (!currentSourceFile) {
|
|
115257
115355
|
return previousOnSubstituteNode(hint, node);
|
|
115258
115356
|
}
|
|
115259
|
-
if (currentSourceFile
|
|
115357
|
+
if (getEmitModuleFormatOfFile2(currentSourceFile) >= 5 /* ES2015 */) {
|
|
115260
115358
|
return esmOnSubstituteNode(hint, node);
|
|
115261
115359
|
}
|
|
115262
115360
|
return cjsOnSubstituteNode(hint, node);
|
|
@@ -115269,13 +115367,13 @@ function transformNodeModule(context) {
|
|
|
115269
115367
|
if (!currentSourceFile) {
|
|
115270
115368
|
return previousOnEmitNode(hint, node, emitCallback);
|
|
115271
115369
|
}
|
|
115272
|
-
if (currentSourceFile
|
|
115370
|
+
if (getEmitModuleFormatOfFile2(currentSourceFile) >= 5 /* ES2015 */) {
|
|
115273
115371
|
return esmOnEmitNode(hint, node, emitCallback);
|
|
115274
115372
|
}
|
|
115275
115373
|
return cjsOnEmitNode(hint, node, emitCallback);
|
|
115276
115374
|
}
|
|
115277
115375
|
function getModuleTransformForFile(file) {
|
|
115278
|
-
return file
|
|
115376
|
+
return getEmitModuleFormatOfFile2(file) >= 5 /* ES2015 */ ? esmTransform : cjsTransform;
|
|
115279
115377
|
}
|
|
115280
115378
|
function transformSourceFile(node) {
|
|
115281
115379
|
if (node.isDeclarationFile) {
|
|
@@ -117400,17 +117498,18 @@ function isProcessedComponent(node) {
|
|
|
117400
117498
|
// src/compiler/transformer.ts
|
|
117401
117499
|
function getModuleTransformer(moduleKind) {
|
|
117402
117500
|
switch (moduleKind) {
|
|
117501
|
+
case 200 /* Preserve */:
|
|
117502
|
+
return transformECMAScriptModule;
|
|
117403
117503
|
case 99 /* ESNext */:
|
|
117404
117504
|
case 7 /* ES2022 */:
|
|
117405
117505
|
case 6 /* ES2020 */:
|
|
117406
117506
|
case 5 /* ES2015 */:
|
|
117407
|
-
case 200 /* Preserve */:
|
|
117408
|
-
return transformECMAScriptModule;
|
|
117409
|
-
case 4 /* System */:
|
|
117410
|
-
return transformSystemModule;
|
|
117411
117507
|
case 100 /* Node16 */:
|
|
117412
117508
|
case 199 /* NodeNext */:
|
|
117413
|
-
|
|
117509
|
+
case 1 /* CommonJS */:
|
|
117510
|
+
return transformImpliedNodeFormatDependentModule;
|
|
117511
|
+
case 4 /* System */:
|
|
117512
|
+
return transformSystemModule;
|
|
117414
117513
|
default:
|
|
117415
117514
|
return transformModule;
|
|
117416
117515
|
}
|
|
@@ -118138,6 +118237,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
118138
118237
|
newLine: compilerOptions.newLine,
|
|
118139
118238
|
noEmitHelpers: compilerOptions.noEmitHelpers,
|
|
118140
118239
|
module: getEmitModuleKind(compilerOptions),
|
|
118240
|
+
moduleResolution: getEmitModuleResolutionKind(compilerOptions),
|
|
118141
118241
|
target: getEmitScriptTarget(compilerOptions),
|
|
118142
118242
|
sourceMap: compilerOptions.sourceMap,
|
|
118143
118243
|
inlineSourceMap: compilerOptions.inlineSourceMap,
|
|
@@ -118200,8 +118300,9 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
118200
118300
|
newLine: compilerOptions.newLine,
|
|
118201
118301
|
noEmitHelpers: true,
|
|
118202
118302
|
module: compilerOptions.module,
|
|
118303
|
+
moduleResolution: compilerOptions.moduleResolution,
|
|
118203
118304
|
target: compilerOptions.target,
|
|
118204
|
-
sourceMap:
|
|
118305
|
+
sourceMap: emitOnly !== 2 /* BuilderSignature */ && compilerOptions.declarationMap,
|
|
118205
118306
|
inlineSourceMap: compilerOptions.inlineSourceMap,
|
|
118206
118307
|
extendedDiagnostics: compilerOptions.extendedDiagnostics,
|
|
118207
118308
|
onlyPrintJsDocStyle: true,
|
|
@@ -123718,7 +123819,6 @@ function getModeForUsageLocation(file, usage, compilerOptions) {
|
|
|
123718
123819
|
return getModeForUsageLocationWorker(file, usage, compilerOptions);
|
|
123719
123820
|
}
|
|
123720
123821
|
function getModeForUsageLocationWorker(file, usage, compilerOptions) {
|
|
123721
|
-
var _a;
|
|
123722
123822
|
if (isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent) || isJSDocImportTag(usage.parent)) {
|
|
123723
123823
|
const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(usage.parent);
|
|
123724
123824
|
if (isTypeOnly) {
|
|
@@ -123734,19 +123834,28 @@ function getModeForUsageLocationWorker(file, usage, compilerOptions) {
|
|
|
123734
123834
|
return override;
|
|
123735
123835
|
}
|
|
123736
123836
|
}
|
|
123737
|
-
if (compilerOptions &&
|
|
123738
|
-
return usage
|
|
123739
|
-
usage.parent,
|
|
123740
|
-
/*requireStringLiteralLikeArgument*/
|
|
123741
|
-
false
|
|
123742
|
-
) ? 1 /* CommonJS */ : 99 /* ESNext */;
|
|
123837
|
+
if (compilerOptions && importSyntaxAffectsModuleResolution(compilerOptions)) {
|
|
123838
|
+
return getEmitSyntaxForUsageLocationWorker(file, usage, compilerOptions);
|
|
123743
123839
|
}
|
|
123744
|
-
|
|
123745
|
-
|
|
123746
|
-
|
|
123840
|
+
}
|
|
123841
|
+
function getEmitSyntaxForUsageLocationWorker(file, usage, compilerOptions) {
|
|
123842
|
+
var _a;
|
|
123843
|
+
if (!compilerOptions) {
|
|
123844
|
+
return void 0;
|
|
123747
123845
|
}
|
|
123748
123846
|
const exprParentParent = (_a = walkUpParenthesizedExpressions(usage.parent)) == null ? void 0 : _a.parent;
|
|
123749
|
-
|
|
123847
|
+
if (exprParentParent && isImportEqualsDeclaration(exprParentParent) || isRequireCall(
|
|
123848
|
+
usage.parent,
|
|
123849
|
+
/*requireStringLiteralLikeArgument*/
|
|
123850
|
+
false
|
|
123851
|
+
)) {
|
|
123852
|
+
return 1 /* CommonJS */;
|
|
123853
|
+
}
|
|
123854
|
+
if (isImportCall(walkUpParenthesizedExpressions(usage.parent))) {
|
|
123855
|
+
return shouldTransformImportCallWorker(file, compilerOptions) ? 1 /* CommonJS */ : 99 /* ESNext */;
|
|
123856
|
+
}
|
|
123857
|
+
const fileEmitMode = getEmitModuleFormatOfFileWorker(file, compilerOptions);
|
|
123858
|
+
return fileEmitMode === 1 /* CommonJS */ ? 1 /* CommonJS */ : emitModuleKindIsNonNodeESM(fileEmitMode) || fileEmitMode === 200 /* Preserve */ ? 99 /* ESNext */ : void 0;
|
|
123750
123859
|
}
|
|
123751
123860
|
function getResolutionModeOverride(node, grammarErrorOnNode) {
|
|
123752
123861
|
if (!node) return void 0;
|
|
@@ -123803,7 +123912,7 @@ function getTypeReferenceResolutionName(entry) {
|
|
|
123803
123912
|
}
|
|
123804
123913
|
var typeReferenceResolutionNameAndModeGetter = {
|
|
123805
123914
|
getName: getTypeReferenceResolutionName,
|
|
123806
|
-
getMode: (entry, file) => getModeForFileReference(entry, file
|
|
123915
|
+
getMode: (entry, file, compilerOptions) => getModeForFileReference(entry, file && getDefaultResolutionModeForFileWorker(file, compilerOptions))
|
|
123807
123916
|
};
|
|
123808
123917
|
function createTypeReferenceResolutionLoader(containingFile, redirectedReference, options, host, cache) {
|
|
123809
123918
|
return {
|
|
@@ -124443,6 +124552,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
124443
124552
|
isSourceFileFromExternalLibrary,
|
|
124444
124553
|
isSourceFileDefaultLibrary,
|
|
124445
124554
|
getModeForUsageLocation: getModeForUsageLocation2,
|
|
124555
|
+
getEmitSyntaxForUsageLocation,
|
|
124446
124556
|
getModeForResolutionAtIndex: getModeForResolutionAtIndex2,
|
|
124447
124557
|
getSourceFileFromReference,
|
|
124448
124558
|
getLibFileFromReference,
|
|
@@ -124471,6 +124581,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
124471
124581
|
forEachResolvedProjectReference: forEachResolvedProjectReference2,
|
|
124472
124582
|
isSourceOfProjectReferenceRedirect,
|
|
124473
124583
|
getRedirectReferenceForResolutionFromSourceOfProject,
|
|
124584
|
+
getCompilerOptionsForFile,
|
|
124585
|
+
getDefaultResolutionModeForFile: getDefaultResolutionModeForFile2,
|
|
124586
|
+
getEmitModuleFormatOfFile: getEmitModuleFormatOfFile2,
|
|
124587
|
+
getImpliedNodeFormatForEmit: getImpliedNodeFormatForEmit2,
|
|
124588
|
+
shouldTransformImportCall,
|
|
124474
124589
|
emitBuildInfo,
|
|
124475
124590
|
fileExists,
|
|
124476
124591
|
readFile,
|
|
@@ -125025,6 +125140,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
125025
125140
|
getSymlinkCache,
|
|
125026
125141
|
writeFile: writeFileCallback || writeFile2,
|
|
125027
125142
|
isEmitBlocked,
|
|
125143
|
+
shouldTransformImportCall,
|
|
125144
|
+
getEmitModuleFormatOfFile: getEmitModuleFormatOfFile2,
|
|
125145
|
+
getDefaultResolutionModeForFile: getDefaultResolutionModeForFile2,
|
|
125146
|
+
getModeForResolutionAtIndex: getModeForResolutionAtIndex2,
|
|
125028
125147
|
readFile: (f) => host.readFile(f),
|
|
125029
125148
|
fileExists: (f) => {
|
|
125030
125149
|
const path = toPath3(f);
|
|
@@ -126104,10 +126223,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
126104
126223
|
const resolvedTypeReferenceDirective = resolutions[index];
|
|
126105
126224
|
const fileName = ref.fileName;
|
|
126106
126225
|
resolutionsInFile.set(fileName, getModeForFileReference(ref, file.impliedNodeFormat), resolvedTypeReferenceDirective);
|
|
126107
|
-
const mode = ref.resolutionMode || file
|
|
126226
|
+
const mode = ref.resolutionMode || getDefaultResolutionModeForFile2(file);
|
|
126108
126227
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: 5 /* TypeReferenceDirective */, file: file.path, index });
|
|
126109
126228
|
}
|
|
126110
126229
|
}
|
|
126230
|
+
function getCompilerOptionsForFile(file) {
|
|
126231
|
+
var _a2;
|
|
126232
|
+
return ((_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options) || options;
|
|
126233
|
+
}
|
|
126111
126234
|
function processTypeReferenceDirective(typeReferenceDirective, mode, resolution, reason) {
|
|
126112
126235
|
var _a2, _b2;
|
|
126113
126236
|
(_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 });
|
|
@@ -126208,13 +126331,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
126208
126331
|
return host.getCanonicalFileName(fileName);
|
|
126209
126332
|
}
|
|
126210
126333
|
function processImportedModules(file) {
|
|
126211
|
-
var _a2;
|
|
126212
126334
|
collectExternalModuleReferences(file);
|
|
126213
126335
|
if (file.imports.length || file.moduleAugmentations.length) {
|
|
126214
126336
|
const moduleNames = getModuleNames(file);
|
|
126215
126337
|
const resolutions = (resolvedModulesProcessing == null ? void 0 : resolvedModulesProcessing.get(file.path)) || resolveModuleNamesReusingOldState(moduleNames, file);
|
|
126216
126338
|
Debug.assert(resolutions.length === moduleNames.length);
|
|
126217
|
-
const optionsForFile = (
|
|
126339
|
+
const optionsForFile = getCompilerOptionsForFile(file);
|
|
126218
126340
|
const resolutionsInFile = createModeAwareCache();
|
|
126219
126341
|
(resolvedModules ?? (resolvedModules = /* @__PURE__ */ new Map())).set(file.path, resolutionsInFile);
|
|
126220
126342
|
for (let index = 0; index < moduleNames.length; index++) {
|
|
@@ -126763,7 +126885,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
126763
126885
|
redirectInfo = cachedChain.redirectInfo;
|
|
126764
126886
|
} else {
|
|
126765
126887
|
reasons == null ? void 0 : reasons.forEach(processReason);
|
|
126766
|
-
redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file);
|
|
126888
|
+
redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file, getCompilerOptionsForFile(file));
|
|
126767
126889
|
}
|
|
126768
126890
|
if (fileProcessingReason) processReason(fileProcessingReason);
|
|
126769
126891
|
const processedExtraReason = (seenReasons == null ? void 0 : seenReasons.size) !== (reasons == null ? void 0 : reasons.length);
|
|
@@ -127121,13 +127243,53 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
127121
127243
|
return symlinks;
|
|
127122
127244
|
}
|
|
127123
127245
|
function getModeForUsageLocation2(file, usage) {
|
|
127124
|
-
|
|
127125
|
-
|
|
127126
|
-
|
|
127246
|
+
return getModeForUsageLocationWorker(file, usage, getCompilerOptionsForFile(file));
|
|
127247
|
+
}
|
|
127248
|
+
function getEmitSyntaxForUsageLocation(file, usage) {
|
|
127249
|
+
return getEmitSyntaxForUsageLocationWorker(file, usage, getCompilerOptionsForFile(file));
|
|
127127
127250
|
}
|
|
127128
127251
|
function getModeForResolutionAtIndex2(file, index) {
|
|
127129
127252
|
return getModeForUsageLocation2(file, getModuleNameStringLiteralAt(file, index));
|
|
127130
127253
|
}
|
|
127254
|
+
function getDefaultResolutionModeForFile2(sourceFile) {
|
|
127255
|
+
return getDefaultResolutionModeForFileWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
|
|
127256
|
+
}
|
|
127257
|
+
function getImpliedNodeFormatForEmit2(sourceFile) {
|
|
127258
|
+
return getImpliedNodeFormatForEmitWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
|
|
127259
|
+
}
|
|
127260
|
+
function getEmitModuleFormatOfFile2(sourceFile) {
|
|
127261
|
+
return getEmitModuleFormatOfFileWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
|
|
127262
|
+
}
|
|
127263
|
+
function shouldTransformImportCall(sourceFile) {
|
|
127264
|
+
return shouldTransformImportCallWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
|
|
127265
|
+
}
|
|
127266
|
+
}
|
|
127267
|
+
function shouldTransformImportCallWorker(sourceFile, options) {
|
|
127268
|
+
const moduleKind = getEmitModuleKind(options);
|
|
127269
|
+
if (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */ || moduleKind === 200 /* Preserve */) {
|
|
127270
|
+
return false;
|
|
127271
|
+
}
|
|
127272
|
+
return getEmitModuleFormatOfFileWorker(sourceFile, options) < 5 /* ES2015 */;
|
|
127273
|
+
}
|
|
127274
|
+
function getEmitModuleFormatOfFileWorker(sourceFile, options) {
|
|
127275
|
+
return getImpliedNodeFormatForEmitWorker(sourceFile, options) ?? getEmitModuleKind(options);
|
|
127276
|
+
}
|
|
127277
|
+
function getImpliedNodeFormatForEmitWorker(sourceFile, options) {
|
|
127278
|
+
var _a, _b;
|
|
127279
|
+
const moduleKind = getEmitModuleKind(options);
|
|
127280
|
+
if (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
|
|
127281
|
+
return sourceFile.impliedNodeFormat;
|
|
127282
|
+
}
|
|
127283
|
+
if (sourceFile.impliedNodeFormat === 1 /* CommonJS */ && (((_a = sourceFile.packageJsonScope) == null ? void 0 : _a.contents.packageJsonContent.type) === "commonjs" || fileExtensionIsOneOf(sourceFile.fileName, [".cjs" /* Cjs */, ".cts" /* Cts */]))) {
|
|
127284
|
+
return 1 /* CommonJS */;
|
|
127285
|
+
}
|
|
127286
|
+
if (sourceFile.impliedNodeFormat === 99 /* ESNext */ && (((_b = sourceFile.packageJsonScope) == null ? void 0 : _b.contents.packageJsonContent.type) === "module" || fileExtensionIsOneOf(sourceFile.fileName, [".mjs" /* Mjs */, ".mts" /* Mts */]))) {
|
|
127287
|
+
return 99 /* ESNext */;
|
|
127288
|
+
}
|
|
127289
|
+
return void 0;
|
|
127290
|
+
}
|
|
127291
|
+
function getDefaultResolutionModeForFileWorker(sourceFile, options) {
|
|
127292
|
+
return importSyntaxAffectsModuleResolution(options) ? getImpliedNodeFormatForEmitWorker(sourceFile, options) : void 0;
|
|
127131
127293
|
}
|
|
127132
127294
|
function updateHostForUseSourceOfProjectReferenceRedirect(host) {
|
|
127133
127295
|
let setOfDeclarationDirectories;
|
|
@@ -127596,8 +127758,7 @@ var BuilderState;
|
|
|
127596
127758
|
);
|
|
127597
127759
|
},
|
|
127598
127760
|
cancellationToken,
|
|
127599
|
-
/*
|
|
127600
|
-
true,
|
|
127761
|
+
2 /* BuilderSignature */,
|
|
127601
127762
|
/*customTransformers*/
|
|
127602
127763
|
void 0,
|
|
127603
127764
|
/*forceDtsEmit*/
|
|
@@ -130593,10 +130754,10 @@ function explainFiles(program, write) {
|
|
|
130593
130754
|
for (const file of program.getSourceFiles()) {
|
|
130594
130755
|
write(`${toFileName(file, relativeFileName)}`);
|
|
130595
130756
|
(_a = reasons.get(file.path)) == null ? void 0 : _a.forEach((reason) => write(` ${fileIncludeReasonToDiagnostics(program, reason, relativeFileName).messageText}`));
|
|
130596
|
-
(_b = explainIfFileIsRedirectAndImpliedFormat(file, relativeFileName)) == null ? void 0 : _b.forEach((d) => write(` ${d.messageText}`));
|
|
130757
|
+
(_b = explainIfFileIsRedirectAndImpliedFormat(file, program.getCompilerOptionsForFile(file), relativeFileName)) == null ? void 0 : _b.forEach((d) => write(` ${d.messageText}`));
|
|
130597
130758
|
}
|
|
130598
130759
|
}
|
|
130599
|
-
function explainIfFileIsRedirectAndImpliedFormat(file, fileNameConvertor) {
|
|
130760
|
+
function explainIfFileIsRedirectAndImpliedFormat(file, options, fileNameConvertor) {
|
|
130600
130761
|
var _a;
|
|
130601
130762
|
let result;
|
|
130602
130763
|
if (file.path !== file.resolvedPath) {
|
|
@@ -130616,7 +130777,7 @@ function explainIfFileIsRedirectAndImpliedFormat(file, fileNameConvertor) {
|
|
|
130616
130777
|
));
|
|
130617
130778
|
}
|
|
130618
130779
|
if (isExternalOrCommonJsModule(file)) {
|
|
130619
|
-
switch (file
|
|
130780
|
+
switch (getImpliedNodeFormatForEmitWorker(file, options)) {
|
|
130620
130781
|
case 99 /* ESNext */:
|
|
130621
130782
|
if (file.packageJsonScope) {
|
|
130622
130783
|
(result ?? (result = [])).push(chainDiagnosticMessages(
|
|
@@ -137153,7 +137314,9 @@ function createModuleSpecifierResolutionHost(program, host) {
|
|
|
137153
137314
|
isSourceOfProjectReferenceRedirect: (fileName) => program.isSourceOfProjectReferenceRedirect(fileName),
|
|
137154
137315
|
getNearestAncestorDirectoryWithPackageJson: maybeBind(host, host.getNearestAncestorDirectoryWithPackageJson),
|
|
137155
137316
|
getFileIncludeReasons: () => program.getFileIncludeReasons(),
|
|
137156
|
-
getCommonSourceDirectory: () => program.getCommonSourceDirectory()
|
|
137317
|
+
getCommonSourceDirectory: () => program.getCommonSourceDirectory(),
|
|
137318
|
+
getDefaultResolutionModeForFile: (file) => program.getDefaultResolutionModeForFile(file),
|
|
137319
|
+
getModeForResolutionAtIndex: (file, index) => program.getModeForResolutionAtIndex(file, index)
|
|
137157
137320
|
};
|
|
137158
137321
|
}
|
|
137159
137322
|
function getModuleSpecifierResolverHost(program, host) {
|
|
@@ -138250,36 +138413,12 @@ function mapOneOrMany(valueOrArray, f, resultSelector = identity) {
|
|
|
138250
138413
|
function firstOrOnly(valueOrArray) {
|
|
138251
138414
|
return isArray(valueOrArray) ? first(valueOrArray) : valueOrArray;
|
|
138252
138415
|
}
|
|
138253
|
-
function getNamesForExportedSymbol(symbol, scriptTarget) {
|
|
138254
|
-
if (needsNameFromDeclaration(symbol)) {
|
|
138255
|
-
const fromDeclaration = getDefaultLikeExportNameFromDeclaration(symbol);
|
|
138256
|
-
if (fromDeclaration) return fromDeclaration;
|
|
138257
|
-
const fileNameCase = moduleSymbolToValidIdentifier(
|
|
138258
|
-
getSymbolParentOrFail(symbol),
|
|
138259
|
-
scriptTarget,
|
|
138260
|
-
/*forceCapitalize*/
|
|
138261
|
-
false
|
|
138262
|
-
);
|
|
138263
|
-
const capitalized = moduleSymbolToValidIdentifier(
|
|
138264
|
-
getSymbolParentOrFail(symbol),
|
|
138265
|
-
scriptTarget,
|
|
138266
|
-
/*forceCapitalize*/
|
|
138267
|
-
true
|
|
138268
|
-
);
|
|
138269
|
-
if (fileNameCase === capitalized) return fileNameCase;
|
|
138270
|
-
return [fileNameCase, capitalized];
|
|
138271
|
-
}
|
|
138272
|
-
return symbol.name;
|
|
138273
|
-
}
|
|
138274
138416
|
function getNameForExportedSymbol(symbol, scriptTarget, preferCapitalized) {
|
|
138275
|
-
if (
|
|
138417
|
+
if (symbol.escapedName === "export=" /* ExportEquals */ || symbol.escapedName === "default" /* Default */) {
|
|
138276
138418
|
return getDefaultLikeExportNameFromDeclaration(symbol) || moduleSymbolToValidIdentifier(getSymbolParentOrFail(symbol), scriptTarget, !!preferCapitalized);
|
|
138277
138419
|
}
|
|
138278
138420
|
return symbol.name;
|
|
138279
138421
|
}
|
|
138280
|
-
function needsNameFromDeclaration(symbol) {
|
|
138281
|
-
return !(symbol.flags & 33554432 /* Transient */) && (symbol.escapedName === "export=" /* ExportEquals */ || symbol.escapedName === "default" /* Default */);
|
|
138282
|
-
}
|
|
138283
138422
|
function getDefaultLikeExportNameFromDeclaration(symbol) {
|
|
138284
138423
|
return firstDefined(symbol.declarations, (d) => {
|
|
138285
138424
|
var _a, _b, _c;
|
|
@@ -138442,9 +138581,13 @@ function fileShouldUseJavaScriptRequire(file, program, host, preferRequire) {
|
|
|
138442
138581
|
if (!hasJSFileExtension(fileName)) {
|
|
138443
138582
|
return false;
|
|
138444
138583
|
}
|
|
138445
|
-
const compilerOptions = program.getCompilerOptions();
|
|
138584
|
+
const compilerOptions = typeof file === "string" ? program.getCompilerOptions() : program.getCompilerOptionsForFile(file);
|
|
138446
138585
|
const moduleKind = getEmitModuleKind(compilerOptions);
|
|
138447
|
-
const
|
|
138586
|
+
const sourceFileLike = typeof file === "string" ? {
|
|
138587
|
+
fileName: file,
|
|
138588
|
+
impliedNodeFormat: getImpliedNodeFormatForFile(toPath(file, host.getCurrentDirectory(), hostGetCanonicalFileName(host)), (_a = program.getPackageJsonInfoCache) == null ? void 0 : _a.call(program), host, compilerOptions)
|
|
138589
|
+
} : file;
|
|
138590
|
+
const impliedNodeFormat = getImpliedNodeFormatForEmitWorker(sourceFileLike, compilerOptions);
|
|
138448
138591
|
if (impliedNodeFormat === 99 /* ESNext */) {
|
|
138449
138592
|
return false;
|
|
138450
138593
|
}
|
|
@@ -138556,6 +138699,7 @@ function createCacheableExportInfoMap(host) {
|
|
|
138556
138699
|
const namedSymbol = isDefault && getLocalSymbolForExportDefault(symbol) || symbol;
|
|
138557
138700
|
const names = exportKind === 0 /* Named */ || isExternalModuleSymbol(namedSymbol) ? unescapeLeadingUnderscores(symbolTableKey) : getNamesForExportedSymbol(
|
|
138558
138701
|
namedSymbol,
|
|
138702
|
+
checker,
|
|
138559
138703
|
/*scriptTarget*/
|
|
138560
138704
|
void 0
|
|
138561
138705
|
);
|
|
@@ -138891,7 +139035,15 @@ function getDefaultLikeExportInfo(moduleSymbol, checker) {
|
|
|
138891
139035
|
function isImportableSymbol(symbol, checker) {
|
|
138892
139036
|
return !checker.isUndefinedSymbol(symbol) && !checker.isUnknownSymbol(symbol) && !isKnownSymbol(symbol) && !isPrivateIdentifierSymbol(symbol);
|
|
138893
139037
|
}
|
|
138894
|
-
function
|
|
139038
|
+
function getNamesForExportedSymbol(defaultExport, checker, scriptTarget) {
|
|
139039
|
+
let names;
|
|
139040
|
+
forEachNameOfDefaultExport(defaultExport, checker, scriptTarget, (name, capitalizedName) => {
|
|
139041
|
+
names = capitalizedName ? [name, capitalizedName] : name;
|
|
139042
|
+
return true;
|
|
139043
|
+
});
|
|
139044
|
+
return Debug.checkDefined(names);
|
|
139045
|
+
}
|
|
139046
|
+
function forEachNameOfDefaultExport(defaultExport, checker, scriptTarget, cb) {
|
|
138895
139047
|
let chain;
|
|
138896
139048
|
let current = defaultExport;
|
|
138897
139049
|
const seen = /* @__PURE__ */ new Map();
|
|
@@ -138911,7 +139063,20 @@ function forEachNameOfDefaultExport(defaultExport, checker, compilerOptions, pre
|
|
|
138911
139063
|
}
|
|
138912
139064
|
for (const symbol of chain ?? emptyArray) {
|
|
138913
139065
|
if (symbol.parent && isExternalModuleSymbol(symbol.parent)) {
|
|
138914
|
-
const final = cb(
|
|
139066
|
+
const final = cb(
|
|
139067
|
+
moduleSymbolToValidIdentifier(
|
|
139068
|
+
symbol.parent,
|
|
139069
|
+
scriptTarget,
|
|
139070
|
+
/*forceCapitalize*/
|
|
139071
|
+
false
|
|
139072
|
+
),
|
|
139073
|
+
moduleSymbolToValidIdentifier(
|
|
139074
|
+
symbol.parent,
|
|
139075
|
+
scriptTarget,
|
|
139076
|
+
/*forceCapitalize*/
|
|
139077
|
+
true
|
|
139078
|
+
)
|
|
139079
|
+
);
|
|
138915
139080
|
if (final) return final;
|
|
138916
139081
|
}
|
|
138917
139082
|
}
|
|
@@ -141437,7 +141602,7 @@ function computeSuggestionDiagnostics(sourceFile, program, cancellationToken) {
|
|
|
141437
141602
|
program.getSemanticDiagnostics(sourceFile, cancellationToken);
|
|
141438
141603
|
const diags = [];
|
|
141439
141604
|
const checker = program.getTypeChecker();
|
|
141440
|
-
const isCommonJSFile = sourceFile
|
|
141605
|
+
const isCommonJSFile = program.getImpliedNodeFormatForEmit(sourceFile) === 1 /* CommonJS */ || fileExtensionIsOneOf(sourceFile.fileName, [".cts" /* Cts */, ".cjs" /* Cjs */]);
|
|
141441
141606
|
if (!isCommonJSFile && sourceFile.commonJsModuleIndicator && (programContainsEsModules(program) || compilerOptionsIndicateEsModules(program.getCompilerOptions())) && containsTopLevelCommonjs(sourceFile)) {
|
|
141442
141607
|
diags.push(createDiagnosticForNode(getErrorNodeFromCommonJsIndicator(sourceFile.commonJsModuleIndicator), Diagnostics.File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module));
|
|
141443
141608
|
}
|
|
@@ -154551,7 +154716,7 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
|
|
|
154551
154716
|
compilerOptions,
|
|
154552
154717
|
createModuleSpecifierResolutionHost(program, host)
|
|
154553
154718
|
);
|
|
154554
|
-
const importKind = getImportKind(futureExportingSourceFile, exportKind,
|
|
154719
|
+
const importKind = getImportKind(futureExportingSourceFile, exportKind, program);
|
|
154555
154720
|
const addAsTypeOnly = getAddAsTypeOnly(
|
|
154556
154721
|
isImportUsageValidAsTypeOnly,
|
|
154557
154722
|
/*isForNewImportDeclaration*/
|
|
@@ -154891,7 +155056,7 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
|
|
|
154891
155056
|
}
|
|
154892
155057
|
function createImportSpecifierResolver(importingFile, program, host, preferences) {
|
|
154893
155058
|
const packageJsonImportFilter = createPackageJsonImportFilter(importingFile, preferences, host);
|
|
154894
|
-
const importMap = createExistingImportMap(
|
|
155059
|
+
const importMap = createExistingImportMap(importingFile, program);
|
|
154895
155060
|
return { getModuleSpecifierForBestExportInfo };
|
|
154896
155061
|
function getModuleSpecifierForBestExportInfo(exportInfo, position, isValidTypeOnlyUseSite, fromCacheOnly) {
|
|
154897
155062
|
const { fixes, computedWithoutCacheCount } = getImportFixes(
|
|
@@ -154998,7 +155163,7 @@ function getSingleExportInfoForSymbol(symbol, symbolName2, moduleSymbol, program
|
|
|
154998
155163
|
}
|
|
154999
155164
|
}
|
|
155000
155165
|
}
|
|
155001
|
-
function getImportFixes(exportInfos, usagePosition, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences, importMap = isFullSourceFile(sourceFile) ? createExistingImportMap(
|
|
155166
|
+
function getImportFixes(exportInfos, usagePosition, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences, importMap = isFullSourceFile(sourceFile) ? createExistingImportMap(sourceFile, program) : void 0, fromCacheOnly) {
|
|
155002
155167
|
const checker = program.getTypeChecker();
|
|
155003
155168
|
const existingImports = importMap ? flatMap(exportInfos, importMap.getImportsForExportInfo) : emptyArray;
|
|
155004
155169
|
const useNamespace = usagePosition !== void 0 && tryUseExistingNamespaceImport(existingImports, usagePosition);
|
|
@@ -155113,7 +155278,8 @@ function tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker
|
|
|
155113
155278
|
};
|
|
155114
155279
|
}
|
|
155115
155280
|
}
|
|
155116
|
-
function createExistingImportMap(
|
|
155281
|
+
function createExistingImportMap(importingFile, program) {
|
|
155282
|
+
const checker = program.getTypeChecker();
|
|
155117
155283
|
let importMap;
|
|
155118
155284
|
for (const moduleSpecifier of importingFile.imports) {
|
|
155119
155285
|
const i = importFromModuleSpecifier(moduleSpecifier);
|
|
@@ -155134,7 +155300,7 @@ function createExistingImportMap(checker, importingFile, compilerOptions) {
|
|
|
155134
155300
|
const matchingDeclarations = importMap == null ? void 0 : importMap.get(getSymbolId(moduleSymbol));
|
|
155135
155301
|
if (!matchingDeclarations) return emptyArray;
|
|
155136
155302
|
if (isSourceFileJS(importingFile) && !(targetFlags & 111551 /* Value */) && !every(matchingDeclarations, isJSDocImportTag)) return emptyArray;
|
|
155137
|
-
const importKind = getImportKind(importingFile, exportKind,
|
|
155303
|
+
const importKind = getImportKind(importingFile, exportKind, program);
|
|
155138
155304
|
return matchingDeclarations.map((declaration) => ({ declaration, importKind, symbol, targetFlags }));
|
|
155139
155305
|
}
|
|
155140
155306
|
};
|
|
@@ -155149,8 +155315,8 @@ function shouldUseRequire(sourceFile, program) {
|
|
|
155149
155315
|
if (compilerOptions.configFile) {
|
|
155150
155316
|
return getEmitModuleKind(compilerOptions) < 5 /* ES2015 */;
|
|
155151
155317
|
}
|
|
155152
|
-
if (sourceFile
|
|
155153
|
-
if (sourceFile
|
|
155318
|
+
if (getImpliedNodeFormatForEmit(sourceFile, program) === 1 /* CommonJS */) return true;
|
|
155319
|
+
if (getImpliedNodeFormatForEmit(sourceFile, program) === 99 /* ESNext */) return false;
|
|
155154
155320
|
for (const otherFile of program.getSourceFiles()) {
|
|
155155
155321
|
if (otherFile === sourceFile || !isSourceFileJS(otherFile) || program.isSourceFileFromExternalLibrary(otherFile)) continue;
|
|
155156
155322
|
if (otherFile.commonJsModuleIndicator && !otherFile.externalModuleIndicator) return true;
|
|
@@ -155202,20 +155368,13 @@ function getNewImportFixes(program, sourceFile, usagePosition, isValidTypeOnlyUs
|
|
|
155202
155368
|
if (!importedSymbolHasValueMeaning && isJs && usagePosition !== void 0) {
|
|
155203
155369
|
return { kind: 1 /* JsdocTypeImport */, moduleSpecifierKind, moduleSpecifier, usagePosition, exportInfo: exportInfo2, isReExport: i > 0 };
|
|
155204
155370
|
}
|
|
155205
|
-
const importKind = getImportKind(sourceFile, exportInfo2.exportKind,
|
|
155371
|
+
const importKind = getImportKind(sourceFile, exportInfo2.exportKind, program);
|
|
155206
155372
|
let qualification;
|
|
155207
155373
|
if (usagePosition !== void 0 && importKind === 3 /* CommonJS */ && exportInfo2.exportKind === 0 /* Named */) {
|
|
155208
155374
|
const exportEquals = checker.resolveExternalModuleSymbol(exportInfo2.moduleSymbol);
|
|
155209
155375
|
let namespacePrefix;
|
|
155210
155376
|
if (exportEquals !== exportInfo2.moduleSymbol) {
|
|
155211
|
-
namespacePrefix = forEachNameOfDefaultExport(
|
|
155212
|
-
exportEquals,
|
|
155213
|
-
checker,
|
|
155214
|
-
compilerOptions,
|
|
155215
|
-
/*preferCapitalizedNames*/
|
|
155216
|
-
false,
|
|
155217
|
-
identity
|
|
155218
|
-
);
|
|
155377
|
+
namespacePrefix = forEachNameOfDefaultExport(exportEquals, checker, getEmitScriptTarget(compilerOptions), identity);
|
|
155219
155378
|
}
|
|
155220
155379
|
namespacePrefix || (namespacePrefix = moduleSymbolToValidIdentifier(
|
|
155221
155380
|
exportInfo2.moduleSymbol,
|
|
@@ -155388,8 +155547,8 @@ function getUmdSymbol(token, checker) {
|
|
|
155388
155547
|
}
|
|
155389
155548
|
return void 0;
|
|
155390
155549
|
}
|
|
155391
|
-
function getImportKind(importingFile, exportKind,
|
|
155392
|
-
if (
|
|
155550
|
+
function getImportKind(importingFile, exportKind, program, forceImportKeyword) {
|
|
155551
|
+
if (program.getCompilerOptions().verbatimModuleSyntax && getEmitModuleFormatOfFile(importingFile, program) === 1 /* CommonJS */) {
|
|
155393
155552
|
return 3 /* CommonJS */;
|
|
155394
155553
|
}
|
|
155395
155554
|
switch (exportKind) {
|
|
@@ -155398,18 +155557,18 @@ function getImportKind(importingFile, exportKind, compilerOptions, forceImportKe
|
|
|
155398
155557
|
case 1 /* Default */:
|
|
155399
155558
|
return 1 /* Default */;
|
|
155400
155559
|
case 2 /* ExportEquals */:
|
|
155401
|
-
return getExportEqualsImportKind(importingFile,
|
|
155560
|
+
return getExportEqualsImportKind(importingFile, program.getCompilerOptions(), !!forceImportKeyword);
|
|
155402
155561
|
case 3 /* UMD */:
|
|
155403
|
-
return getUmdImportKind(importingFile,
|
|
155562
|
+
return getUmdImportKind(importingFile, program, !!forceImportKeyword);
|
|
155404
155563
|
default:
|
|
155405
155564
|
return Debug.assertNever(exportKind);
|
|
155406
155565
|
}
|
|
155407
155566
|
}
|
|
155408
|
-
function getUmdImportKind(importingFile,
|
|
155409
|
-
if (getAllowSyntheticDefaultImports(
|
|
155567
|
+
function getUmdImportKind(importingFile, program, forceImportKeyword) {
|
|
155568
|
+
if (getAllowSyntheticDefaultImports(program.getCompilerOptions())) {
|
|
155410
155569
|
return 1 /* Default */;
|
|
155411
155570
|
}
|
|
155412
|
-
const moduleKind = getEmitModuleKind(
|
|
155571
|
+
const moduleKind = getEmitModuleKind(program.getCompilerOptions());
|
|
155413
155572
|
switch (moduleKind) {
|
|
155414
155573
|
case 2 /* AMD */:
|
|
155415
155574
|
case 1 /* CommonJS */:
|
|
@@ -155428,7 +155587,7 @@ function getUmdImportKind(importingFile, compilerOptions, forceImportKeyword) {
|
|
|
155428
155587
|
return 2 /* Namespace */;
|
|
155429
155588
|
case 100 /* Node16 */:
|
|
155430
155589
|
case 199 /* NodeNext */:
|
|
155431
|
-
return importingFile
|
|
155590
|
+
return getImpliedNodeFormatForEmit(importingFile, program) === 99 /* ESNext */ ? 2 /* Namespace */ : 3 /* CommonJS */;
|
|
155432
155591
|
default:
|
|
155433
155592
|
return Debug.assertNever(moduleKind, `Unexpected moduleKind ${moduleKind}`);
|
|
155434
155593
|
}
|
|
@@ -155511,7 +155670,7 @@ function getExportInfos(symbolName2, isJsxTagName, currentTokenMeaning, cancella
|
|
|
155511
155670
|
cancellationToken.throwIfCancellationRequested();
|
|
155512
155671
|
const compilerOptions = program2.getCompilerOptions();
|
|
155513
155672
|
const defaultInfo = getDefaultLikeExportInfo(moduleSymbol, checker);
|
|
155514
|
-
if (defaultInfo && symbolFlagsHaveMeaning(checker.getSymbolFlags(defaultInfo.symbol), currentTokenMeaning) && forEachNameOfDefaultExport(defaultInfo.symbol, checker, compilerOptions,
|
|
155673
|
+
if (defaultInfo && symbolFlagsHaveMeaning(checker.getSymbolFlags(defaultInfo.symbol), currentTokenMeaning) && forEachNameOfDefaultExport(defaultInfo.symbol, checker, getEmitScriptTarget(compilerOptions), (name, capitalizedName) => (isJsxTagName ? capitalizedName ?? name : name) === symbolName2)) {
|
|
155515
155674
|
addSymbol(moduleSymbol, sourceFile, defaultInfo.symbol, defaultInfo.exportKind, program2, isFromPackageJson);
|
|
155516
155675
|
}
|
|
155517
155676
|
const exportSymbolWithIdenticalName = checker.tryGetMemberInModuleExportsAndProperties(symbolName2, moduleSymbol);
|
|
@@ -155912,6 +156071,12 @@ function createConstEqualsRequireDeclaration(name, quotedModuleSpecifier) {
|
|
|
155912
156071
|
function symbolFlagsHaveMeaning(flags, meaning) {
|
|
155913
156072
|
return meaning === 7 /* All */ ? true : meaning & 1 /* Value */ ? !!(flags & 111551 /* Value */) : meaning & 2 /* Type */ ? !!(flags & 788968 /* Type */) : meaning & 4 /* Namespace */ ? !!(flags & 1920 /* Namespace */) : false;
|
|
155914
156073
|
}
|
|
156074
|
+
function getImpliedNodeFormatForEmit(file, program) {
|
|
156075
|
+
return isFullSourceFile(file) ? program.getImpliedNodeFormatForEmit(file) : getImpliedNodeFormatForEmitWorker(file, program.getCompilerOptions());
|
|
156076
|
+
}
|
|
156077
|
+
function getEmitModuleFormatOfFile(file, program) {
|
|
156078
|
+
return isFullSourceFile(file) ? program.getEmitModuleFormatOfFile(file) : getEmitModuleFormatOfFileWorker(file, program.getCompilerOptions());
|
|
156079
|
+
}
|
|
155915
156080
|
|
|
155916
156081
|
// src/services/codefixes/fixAddMissingConstraint.ts
|
|
155917
156082
|
var fixId17 = "addMissingConstraint";
|
|
@@ -161566,6 +161731,14 @@ function tryGetAutoImportableReferenceFromTypeNode(importTypeNode, scriptTarget)
|
|
|
161566
161731
|
function visit(node) {
|
|
161567
161732
|
if (isLiteralImportTypeNode(node) && node.qualifier) {
|
|
161568
161733
|
const firstIdentifier = getFirstIdentifier(node.qualifier);
|
|
161734
|
+
if (!firstIdentifier.symbol) {
|
|
161735
|
+
return visitEachChild(
|
|
161736
|
+
node,
|
|
161737
|
+
visit,
|
|
161738
|
+
/*context*/
|
|
161739
|
+
void 0
|
|
161740
|
+
);
|
|
161741
|
+
}
|
|
161569
161742
|
const name = getNameForExportedSymbol(firstIdentifier.symbol, scriptTarget);
|
|
161570
161743
|
const qualifier = name !== firstIdentifier.text ? replaceFirstIdentifierOfEntityName(node.qualifier, factory.createIdentifier(name)) : node.qualifier;
|
|
161571
161744
|
symbols = append(symbols, firstIdentifier.symbol);
|
|
@@ -163186,10 +163359,12 @@ function getJSDocParamAnnotation(paramName, initializer, dotDotDotToken, isJs, i
|
|
|
163186
163359
|
const printer = isSnippet ? createSnippetPrinter({
|
|
163187
163360
|
removeComments: true,
|
|
163188
163361
|
module: options.module,
|
|
163362
|
+
moduleResolution: options.moduleResolution,
|
|
163189
163363
|
target: options.target
|
|
163190
163364
|
}) : createPrinter({
|
|
163191
163365
|
removeComments: true,
|
|
163192
163366
|
module: options.module,
|
|
163367
|
+
moduleResolution: options.moduleResolution,
|
|
163193
163368
|
target: options.target
|
|
163194
163369
|
});
|
|
163195
163370
|
setEmitFlags(typeNode, 1 /* SingleLine */);
|
|
@@ -163445,6 +163620,7 @@ function getExhaustiveCaseSnippets(caseBlock, sourceFile, preferences, options,
|
|
|
163445
163620
|
const printer = createSnippetPrinter({
|
|
163446
163621
|
removeComments: true,
|
|
163447
163622
|
module: options.module,
|
|
163623
|
+
moduleResolution: options.moduleResolution,
|
|
163448
163624
|
target: options.target,
|
|
163449
163625
|
newLine: getNewLineKind(newLineChar)
|
|
163450
163626
|
});
|
|
@@ -163631,7 +163807,7 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
|
|
|
163631
163807
|
if (originIsResolvedExport(origin)) {
|
|
163632
163808
|
sourceDisplay = [textPart(origin.moduleSpecifier)];
|
|
163633
163809
|
if (importStatementCompletion) {
|
|
163634
|
-
({ insertText, replacementSpan } = getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile,
|
|
163810
|
+
({ insertText, replacementSpan } = getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, program, preferences));
|
|
163635
163811
|
isSnippet = preferences.includeCompletionsWithSnippetText ? true : void 0;
|
|
163636
163812
|
}
|
|
163637
163813
|
}
|
|
@@ -163772,6 +163948,7 @@ function getEntryForMemberCompletion(host, program, options, preferences, name,
|
|
|
163772
163948
|
const printer = createSnippetPrinter({
|
|
163773
163949
|
removeComments: true,
|
|
163774
163950
|
module: options.module,
|
|
163951
|
+
moduleResolution: options.moduleResolution,
|
|
163775
163952
|
target: options.target,
|
|
163776
163953
|
omitTrailingSemicolon: false,
|
|
163777
163954
|
newLine: getNewLineKind(getNewLineOrDefaultFromHost(host, formatContext == null ? void 0 : formatContext.options))
|
|
@@ -163922,6 +164099,7 @@ function getEntryForObjectLiteralMethodCompletion(symbol, name, enclosingDeclara
|
|
|
163922
164099
|
const printer = createSnippetPrinter({
|
|
163923
164100
|
removeComments: true,
|
|
163924
164101
|
module: options.module,
|
|
164102
|
+
moduleResolution: options.moduleResolution,
|
|
163925
164103
|
target: options.target,
|
|
163926
164104
|
omitTrailingSemicolon: false,
|
|
163927
164105
|
newLine: getNewLineKind(getNewLineOrDefaultFromHost(host, formatContext == null ? void 0 : formatContext.options))
|
|
@@ -163942,6 +164120,7 @@ function getEntryForObjectLiteralMethodCompletion(symbol, name, enclosingDeclara
|
|
|
163942
164120
|
const signaturePrinter = createPrinter({
|
|
163943
164121
|
removeComments: true,
|
|
163944
164122
|
module: options.module,
|
|
164123
|
+
moduleResolution: options.moduleResolution,
|
|
163945
164124
|
target: options.target,
|
|
163946
164125
|
omitTrailingSemicolon: true
|
|
163947
164126
|
});
|
|
@@ -164203,7 +164382,7 @@ function completionEntryDataToSymbolOriginInfo(data, completionName, moduleSymbo
|
|
|
164203
164382
|
};
|
|
164204
164383
|
return unresolvedOrigin;
|
|
164205
164384
|
}
|
|
164206
|
-
function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile,
|
|
164385
|
+
function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, program, preferences) {
|
|
164207
164386
|
const replacementSpan = importStatementCompletion.replacementSpan;
|
|
164208
164387
|
const quotedModuleSpecifier = escapeSnippetText(quote(sourceFile, preferences, origin.moduleSpecifier));
|
|
164209
164388
|
const exportKind = origin.isDefaultExport ? 1 /* Default */ : origin.exportName === "export=" /* ExportEquals */ ? 2 /* ExportEquals */ : 0 /* Named */;
|
|
@@ -164211,7 +164390,7 @@ function getInsertTextAndReplacementSpanForImportCompletion(name, importStatemen
|
|
|
164211
164390
|
const importKind = ts_codefix_exports.getImportKind(
|
|
164212
164391
|
sourceFile,
|
|
164213
164392
|
exportKind,
|
|
164214
|
-
|
|
164393
|
+
program,
|
|
164215
164394
|
/*forceImportKeyword*/
|
|
164216
164395
|
true
|
|
164217
164396
|
);
|
|
@@ -166590,7 +166769,7 @@ function createNameAndKindSet() {
|
|
|
166590
166769
|
}
|
|
166591
166770
|
function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences, includeSymbol) {
|
|
166592
166771
|
if (isInReferenceComment(sourceFile, position)) {
|
|
166593
|
-
const entries = getTripleSlashReferenceCompletion(sourceFile, position,
|
|
166772
|
+
const entries = getTripleSlashReferenceCompletion(sourceFile, position, program, host);
|
|
166594
166773
|
return entries && convertPathCompletions(entries);
|
|
166595
166774
|
}
|
|
166596
166775
|
if (isInString(sourceFile, position, contextToken)) {
|
|
@@ -166913,7 +167092,7 @@ function getStringLiteralCompletionsFromModuleNamesWorker(sourceFile, node, prog
|
|
|
166913
167092
|
const compilerOptions = program.getCompilerOptions();
|
|
166914
167093
|
const typeChecker = program.getTypeChecker();
|
|
166915
167094
|
const extensionOptions = getExtensionOptions(compilerOptions, 1 /* ModuleSpecifier */, sourceFile, typeChecker, preferences, mode);
|
|
166916
|
-
return isPathRelativeToScript(literalValue) || !compilerOptions.baseUrl && !compilerOptions.paths && (isRootedDiskPath(literalValue) || isUrl(literalValue)) ? getCompletionEntriesForRelativeModules(literalValue, scriptDirectory,
|
|
167095
|
+
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);
|
|
166917
167096
|
}
|
|
166918
167097
|
function getExtensionOptions(compilerOptions, referenceKind, importingSourceFile, typeChecker, preferences, resolutionMode) {
|
|
166919
167098
|
return {
|
|
@@ -166924,14 +167103,15 @@ function getExtensionOptions(compilerOptions, referenceKind, importingSourceFile
|
|
|
166924
167103
|
resolutionMode
|
|
166925
167104
|
};
|
|
166926
167105
|
}
|
|
166927
|
-
function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory,
|
|
167106
|
+
function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, program, host, scriptPath, extensionOptions) {
|
|
167107
|
+
const compilerOptions = program.getCompilerOptions();
|
|
166928
167108
|
if (compilerOptions.rootDirs) {
|
|
166929
167109
|
return getCompletionEntriesForDirectoryFragmentWithRootDirs(
|
|
166930
167110
|
compilerOptions.rootDirs,
|
|
166931
167111
|
literalValue,
|
|
166932
167112
|
scriptDirectory,
|
|
166933
167113
|
extensionOptions,
|
|
166934
|
-
|
|
167114
|
+
program,
|
|
166935
167115
|
host,
|
|
166936
167116
|
scriptPath
|
|
166937
167117
|
);
|
|
@@ -166940,6 +167120,7 @@ function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, c
|
|
|
166940
167120
|
literalValue,
|
|
166941
167121
|
scriptDirectory,
|
|
166942
167122
|
extensionOptions,
|
|
167123
|
+
program,
|
|
166943
167124
|
host,
|
|
166944
167125
|
/*moduleSpecifierIsRelative*/
|
|
166945
167126
|
true,
|
|
@@ -166966,7 +167147,8 @@ function getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptDirectory, ign
|
|
|
166966
167147
|
compareStringsCaseSensitive
|
|
166967
167148
|
);
|
|
166968
167149
|
}
|
|
166969
|
-
function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptDirectory, extensionOptions,
|
|
167150
|
+
function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptDirectory, extensionOptions, program, host, exclude) {
|
|
167151
|
+
const compilerOptions = program.getCompilerOptions();
|
|
166970
167152
|
const basePath = compilerOptions.project || host.getCurrentDirectory();
|
|
166971
167153
|
const ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames());
|
|
166972
167154
|
const baseDirectories = getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptDirectory, ignoreCase);
|
|
@@ -166975,6 +167157,7 @@ function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment
|
|
|
166975
167157
|
fragment,
|
|
166976
167158
|
baseDirectory,
|
|
166977
167159
|
extensionOptions,
|
|
167160
|
+
program,
|
|
166978
167161
|
host,
|
|
166979
167162
|
/*moduleSpecifierIsRelative*/
|
|
166980
167163
|
true,
|
|
@@ -166983,7 +167166,7 @@ function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment
|
|
|
166983
167166
|
(itemA, itemB) => itemA.name === itemB.name && itemA.kind === itemB.kind && itemA.extension === itemB.extension
|
|
166984
167167
|
);
|
|
166985
167168
|
}
|
|
166986
|
-
function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, extensionOptions, host, moduleSpecifierIsRelative, exclude, result = createNameAndKindSet()) {
|
|
167169
|
+
function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, extensionOptions, program, host, moduleSpecifierIsRelative, exclude, result = createNameAndKindSet()) {
|
|
166987
167170
|
var _a;
|
|
166988
167171
|
if (fragment === void 0) {
|
|
166989
167172
|
fragment = "";
|
|
@@ -167008,7 +167191,7 @@ function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, ext
|
|
|
167008
167191
|
if (versionPaths) {
|
|
167009
167192
|
const packageDirectory = getDirectoryPath(packageJsonPath);
|
|
167010
167193
|
const pathInPackage = absolutePath.slice(ensureTrailingDirectorySeparator(packageDirectory).length);
|
|
167011
|
-
if (addCompletionEntriesFromPaths(result, pathInPackage, packageDirectory, extensionOptions, host, versionPaths)) {
|
|
167194
|
+
if (addCompletionEntriesFromPaths(result, pathInPackage, packageDirectory, extensionOptions, program, host, versionPaths)) {
|
|
167012
167195
|
return result;
|
|
167013
167196
|
}
|
|
167014
167197
|
}
|
|
@@ -167034,7 +167217,7 @@ function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, ext
|
|
|
167034
167217
|
}
|
|
167035
167218
|
const { name, extension } = getFilenameWithExtensionOption(
|
|
167036
167219
|
getBaseFileName(filePath),
|
|
167037
|
-
|
|
167220
|
+
program,
|
|
167038
167221
|
extensionOptions,
|
|
167039
167222
|
/*isExportsWildcard*/
|
|
167040
167223
|
false
|
|
@@ -167053,7 +167236,7 @@ function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, ext
|
|
|
167053
167236
|
}
|
|
167054
167237
|
return result;
|
|
167055
167238
|
}
|
|
167056
|
-
function getFilenameWithExtensionOption(name,
|
|
167239
|
+
function getFilenameWithExtensionOption(name, program, extensionOptions, isExportsWildcard) {
|
|
167057
167240
|
const nonJsResult = ts_moduleSpecifiers_exports.tryGetRealFileNameForNonJsDeclarationFileName(name);
|
|
167058
167241
|
if (nonJsResult) {
|
|
167059
167242
|
return { name: nonJsResult, extension: tryGetExtensionFromPath2(nonJsResult) };
|
|
@@ -167063,7 +167246,8 @@ function getFilenameWithExtensionOption(name, compilerOptions, extensionOptions,
|
|
|
167063
167246
|
}
|
|
167064
167247
|
let allowedEndings = getModuleSpecifierPreferences(
|
|
167065
167248
|
{ importModuleSpecifierEnding: extensionOptions.endingPreference },
|
|
167066
|
-
|
|
167249
|
+
program,
|
|
167250
|
+
program.getCompilerOptions(),
|
|
167067
167251
|
extensionOptions.importingSourceFile
|
|
167068
167252
|
).getAllowedEndingsInPreferredOrder(extensionOptions.resolutionMode);
|
|
167069
167253
|
if (isExportsWildcard) {
|
|
@@ -167073,16 +167257,16 @@ function getFilenameWithExtensionOption(name, compilerOptions, extensionOptions,
|
|
|
167073
167257
|
if (fileExtensionIsOneOf(name, supportedTSImplementationExtensions)) {
|
|
167074
167258
|
return { name, extension: tryGetExtensionFromPath2(name) };
|
|
167075
167259
|
}
|
|
167076
|
-
const outputExtension2 = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name,
|
|
167260
|
+
const outputExtension2 = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name, program.getCompilerOptions());
|
|
167077
167261
|
return outputExtension2 ? { name: changeExtension(name, outputExtension2), extension: outputExtension2 } : { name, extension: tryGetExtensionFromPath2(name) };
|
|
167078
167262
|
}
|
|
167079
167263
|
if (!isExportsWildcard && (allowedEndings[0] === 0 /* Minimal */ || allowedEndings[0] === 1 /* Index */) && fileExtensionIsOneOf(name, [".js" /* Js */, ".jsx" /* Jsx */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */])) {
|
|
167080
167264
|
return { name: removeFileExtension(name), extension: tryGetExtensionFromPath2(name) };
|
|
167081
167265
|
}
|
|
167082
|
-
const outputExtension = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name,
|
|
167266
|
+
const outputExtension = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name, program.getCompilerOptions());
|
|
167083
167267
|
return outputExtension ? { name: changeExtension(name, outputExtension), extension: outputExtension } : { name, extension: tryGetExtensionFromPath2(name) };
|
|
167084
167268
|
}
|
|
167085
|
-
function addCompletionEntriesFromPaths(result, fragment, baseDirectory, extensionOptions, host, paths) {
|
|
167269
|
+
function addCompletionEntriesFromPaths(result, fragment, baseDirectory, extensionOptions, program, host, paths) {
|
|
167086
167270
|
const getPatternsForKey = (key) => paths[key];
|
|
167087
167271
|
const comparePaths2 = (a, b) => {
|
|
167088
167272
|
const patternA = tryParsePattern(a);
|
|
@@ -167098,13 +167282,14 @@ function addCompletionEntriesFromPaths(result, fragment, baseDirectory, extensio
|
|
|
167098
167282
|
fragment,
|
|
167099
167283
|
baseDirectory,
|
|
167100
167284
|
extensionOptions,
|
|
167285
|
+
program,
|
|
167101
167286
|
host,
|
|
167102
167287
|
getOwnKeys(paths),
|
|
167103
167288
|
getPatternsForKey,
|
|
167104
167289
|
comparePaths2
|
|
167105
167290
|
);
|
|
167106
167291
|
}
|
|
167107
|
-
function addCompletionEntriesFromPathsOrExports(result, isExports, fragment, baseDirectory, extensionOptions, host, keys, getPatternsForKey, comparePaths2) {
|
|
167292
|
+
function addCompletionEntriesFromPathsOrExports(result, isExports, fragment, baseDirectory, extensionOptions, program, host, keys, getPatternsForKey, comparePaths2) {
|
|
167108
167293
|
let pathResults = [];
|
|
167109
167294
|
let matchedPath;
|
|
167110
167295
|
for (const key of keys) {
|
|
@@ -167123,7 +167308,7 @@ function addCompletionEntriesFromPathsOrExports(result, isExports, fragment, bas
|
|
|
167123
167308
|
if (typeof pathPattern === "string" || matchedPath === void 0 || comparePaths2(key, matchedPath) !== 1 /* GreaterThan */) {
|
|
167124
167309
|
pathResults.push({
|
|
167125
167310
|
matchedPattern: isMatch,
|
|
167126
|
-
results: getCompletionsForPathMapping(keyWithoutLeadingDotSlash, patterns, fragment, baseDirectory, extensionOptions, isExports && isMatch, host).map(({ name, kind, extension }) => nameAndKind(name, kind, extension))
|
|
167311
|
+
results: getCompletionsForPathMapping(keyWithoutLeadingDotSlash, patterns, fragment, baseDirectory, extensionOptions, isExports && isMatch, program, host).map(({ name, kind, extension }) => nameAndKind(name, kind, extension))
|
|
167127
167312
|
});
|
|
167128
167313
|
}
|
|
167129
167314
|
}
|
|
@@ -167131,7 +167316,9 @@ function addCompletionEntriesFromPathsOrExports(result, isExports, fragment, bas
|
|
|
167131
167316
|
pathResults.forEach((pathResult) => pathResult.results.forEach((r) => result.add(r)));
|
|
167132
167317
|
return matchedPath !== void 0;
|
|
167133
167318
|
}
|
|
167134
|
-
function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode,
|
|
167319
|
+
function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, program, host, extensionOptions) {
|
|
167320
|
+
const typeChecker = program.getTypeChecker();
|
|
167321
|
+
const compilerOptions = program.getCompilerOptions();
|
|
167135
167322
|
const { baseUrl, paths } = compilerOptions;
|
|
167136
167323
|
const result = createNameAndKindSet();
|
|
167137
167324
|
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
|
@@ -167141,6 +167328,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, c
|
|
|
167141
167328
|
fragment,
|
|
167142
167329
|
absolute,
|
|
167143
167330
|
extensionOptions,
|
|
167331
|
+
program,
|
|
167144
167332
|
host,
|
|
167145
167333
|
/*moduleSpecifierIsRelative*/
|
|
167146
167334
|
false,
|
|
@@ -167151,7 +167339,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, c
|
|
|
167151
167339
|
}
|
|
167152
167340
|
if (paths) {
|
|
167153
167341
|
const absolute = getPathsBasePath(compilerOptions, host);
|
|
167154
|
-
addCompletionEntriesFromPaths(result, fragment, absolute, extensionOptions, host, paths);
|
|
167342
|
+
addCompletionEntriesFromPaths(result, fragment, absolute, extensionOptions, program, host, paths);
|
|
167155
167343
|
}
|
|
167156
167344
|
const fragmentDirectory = getFragmentDirectory(fragment);
|
|
167157
167345
|
for (const ambientName of getAmbientModuleCompletions(fragment, fragmentDirectory, typeChecker)) {
|
|
@@ -167162,7 +167350,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, c
|
|
|
167162
167350
|
void 0
|
|
167163
167351
|
));
|
|
167164
167352
|
}
|
|
167165
|
-
getCompletionEntriesFromTypings(host,
|
|
167353
|
+
getCompletionEntriesFromTypings(host, program, scriptPath, fragmentDirectory, extensionOptions, result);
|
|
167166
167354
|
if (moduleResolutionUsesNodeModules(moduleResolution)) {
|
|
167167
167355
|
let foundGlobal = false;
|
|
167168
167356
|
if (fragmentDirectory === void 0) {
|
|
@@ -167187,6 +167375,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, c
|
|
|
167187
167375
|
fragment,
|
|
167188
167376
|
nodeModules,
|
|
167189
167377
|
extensionOptions,
|
|
167378
|
+
program,
|
|
167190
167379
|
host,
|
|
167191
167380
|
/*moduleSpecifierIsRelative*/
|
|
167192
167381
|
false,
|
|
@@ -167231,6 +167420,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, c
|
|
|
167231
167420
|
fragmentSubpath,
|
|
167232
167421
|
packageDirectory,
|
|
167233
167422
|
extensionOptions,
|
|
167423
|
+
program,
|
|
167234
167424
|
host,
|
|
167235
167425
|
keys,
|
|
167236
167426
|
(key) => singleElementArray(getPatternFromFirstMatchingCondition(exports2[key], conditions)),
|
|
@@ -167263,7 +167453,7 @@ function getPatternFromFirstMatchingCondition(target, conditions) {
|
|
|
167263
167453
|
function getFragmentDirectory(fragment) {
|
|
167264
167454
|
return containsSlash(fragment) ? hasTrailingDirectorySeparator(fragment) ? fragment : getDirectoryPath(fragment) : void 0;
|
|
167265
167455
|
}
|
|
167266
|
-
function getCompletionsForPathMapping(path, patterns, fragment, packageDirectory, extensionOptions, isExportsWildcard, host) {
|
|
167456
|
+
function getCompletionsForPathMapping(path, patterns, fragment, packageDirectory, extensionOptions, isExportsWildcard, program, host) {
|
|
167267
167457
|
if (!endsWith(path, "*")) {
|
|
167268
167458
|
return !path.includes("*") ? justPathMappingName(path, "script" /* scriptElement */) : emptyArray;
|
|
167269
167459
|
}
|
|
@@ -167273,15 +167463,15 @@ function getCompletionsForPathMapping(path, patterns, fragment, packageDirectory
|
|
|
167273
167463
|
const starIsFullPathComponent = path[path.length - 2] === "/";
|
|
167274
167464
|
return starIsFullPathComponent ? justPathMappingName(pathPrefix, "directory" /* directory */) : flatMap(patterns, (pattern) => {
|
|
167275
167465
|
var _a;
|
|
167276
|
-
return (_a = getModulesForPathsPattern("", packageDirectory, pattern, extensionOptions, isExportsWildcard, host)) == null ? void 0 : _a.map(({ name, ...rest }) => ({ name: pathPrefix + name, ...rest }));
|
|
167466
|
+
return (_a = getModulesForPathsPattern("", packageDirectory, pattern, extensionOptions, isExportsWildcard, program, host)) == null ? void 0 : _a.map(({ name, ...rest }) => ({ name: pathPrefix + name, ...rest }));
|
|
167277
167467
|
});
|
|
167278
167468
|
}
|
|
167279
|
-
return flatMap(patterns, (pattern) => getModulesForPathsPattern(remainingFragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, host));
|
|
167469
|
+
return flatMap(patterns, (pattern) => getModulesForPathsPattern(remainingFragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, program, host));
|
|
167280
167470
|
function justPathMappingName(name, kind) {
|
|
167281
167471
|
return startsWith(name, fragment) ? [{ name: removeTrailingDirectorySeparator(name), kind, extension: void 0 }] : emptyArray;
|
|
167282
167472
|
}
|
|
167283
167473
|
}
|
|
167284
|
-
function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, host) {
|
|
167474
|
+
function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, program, host) {
|
|
167285
167475
|
if (!host.readDirectory) {
|
|
167286
167476
|
return void 0;
|
|
167287
167477
|
}
|
|
@@ -167314,7 +167504,7 @@ function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensio
|
|
|
167314
167504
|
if (containsSlash(trimmedWithPattern)) {
|
|
167315
167505
|
return directoryResult(getPathComponents(removeLeadingDirectorySeparator(trimmedWithPattern))[1]);
|
|
167316
167506
|
}
|
|
167317
|
-
const { name, extension } = getFilenameWithExtensionOption(trimmedWithPattern,
|
|
167507
|
+
const { name, extension } = getFilenameWithExtensionOption(trimmedWithPattern, program, extensionOptions, isExportsWildcard);
|
|
167318
167508
|
return nameAndKind(name, "script" /* scriptElement */, extension);
|
|
167319
167509
|
}
|
|
167320
167510
|
});
|
|
@@ -167342,7 +167532,8 @@ function getAmbientModuleCompletions(fragment, fragmentDirectory, checker) {
|
|
|
167342
167532
|
}
|
|
167343
167533
|
return nonRelativeModuleNames;
|
|
167344
167534
|
}
|
|
167345
|
-
function getTripleSlashReferenceCompletion(sourceFile, position,
|
|
167535
|
+
function getTripleSlashReferenceCompletion(sourceFile, position, program, host) {
|
|
167536
|
+
const compilerOptions = program.getCompilerOptions();
|
|
167346
167537
|
const token = getTokenAtPosition(sourceFile, position);
|
|
167347
167538
|
const commentRanges = getLeadingCommentRanges(sourceFile.text, token.pos);
|
|
167348
167539
|
const range = commentRanges && find(commentRanges, (commentRange) => position >= commentRange.pos && position <= commentRange.end);
|
|
@@ -167360,14 +167551,16 @@ function getTripleSlashReferenceCompletion(sourceFile, position, compilerOptions
|
|
|
167360
167551
|
toComplete,
|
|
167361
167552
|
scriptPath,
|
|
167362
167553
|
getExtensionOptions(compilerOptions, 0 /* Filename */, sourceFile),
|
|
167554
|
+
program,
|
|
167363
167555
|
host,
|
|
167364
167556
|
/*moduleSpecifierIsRelative*/
|
|
167365
167557
|
true,
|
|
167366
167558
|
sourceFile.path
|
|
167367
|
-
) : kind === "types" ? getCompletionEntriesFromTypings(host,
|
|
167559
|
+
) : kind === "types" ? getCompletionEntriesFromTypings(host, program, scriptPath, getFragmentDirectory(toComplete), getExtensionOptions(compilerOptions, 1 /* ModuleSpecifier */, sourceFile)) : Debug.fail();
|
|
167368
167560
|
return addReplacementSpans(toComplete, range.pos + prefix.length, arrayFrom(names.values()));
|
|
167369
167561
|
}
|
|
167370
|
-
function getCompletionEntriesFromTypings(host,
|
|
167562
|
+
function getCompletionEntriesFromTypings(host, program, scriptPath, fragmentDirectory, extensionOptions, result = createNameAndKindSet()) {
|
|
167563
|
+
const options = program.getCompilerOptions();
|
|
167371
167564
|
const seen = /* @__PURE__ */ new Map();
|
|
167372
167565
|
const typeRoots = tryAndIgnoreErrors(() => getEffectiveTypeRoots(options, host)) || emptyArray;
|
|
167373
167566
|
for (const root of typeRoots) {
|
|
@@ -167401,6 +167594,7 @@ function getCompletionEntriesFromTypings(host, options, scriptPath, fragmentDire
|
|
|
167401
167594
|
remainingFragment,
|
|
167402
167595
|
baseDirectory,
|
|
167403
167596
|
extensionOptions,
|
|
167597
|
+
program,
|
|
167404
167598
|
host,
|
|
167405
167599
|
/*moduleSpecifierIsRelative*/
|
|
167406
167600
|
false,
|
|
@@ -178733,6 +178927,7 @@ __export(ts_exports2, {
|
|
|
178733
178927
|
canHaveJSDoc: () => canHaveJSDoc,
|
|
178734
178928
|
canHaveLocals: () => canHaveLocals,
|
|
178735
178929
|
canHaveModifiers: () => canHaveModifiers,
|
|
178930
|
+
canHaveModuleSpecifier: () => canHaveModuleSpecifier,
|
|
178736
178931
|
canHaveSymbol: () => canHaveSymbol,
|
|
178737
178932
|
canIncludeBindAndCheckDiagnostics: () => canIncludeBindAndCheckDiagnostics,
|
|
178738
178933
|
canJsonReportNoInputFiles: () => canJsonReportNoInputFiles,
|
|
@@ -179177,6 +179372,7 @@ __export(ts_exports2, {
|
|
|
179177
179372
|
getDefaultLibFilePath: () => getDefaultLibFilePath,
|
|
179178
179373
|
getDefaultLikeExportInfo: () => getDefaultLikeExportInfo,
|
|
179179
179374
|
getDefaultLikeExportNameFromDeclaration: () => getDefaultLikeExportNameFromDeclaration,
|
|
179375
|
+
getDefaultResolutionModeForFileWorker: () => getDefaultResolutionModeForFileWorker,
|
|
179180
179376
|
getDiagnosticText: () => getDiagnosticText,
|
|
179181
179377
|
getDiagnosticsWithinSpan: () => getDiagnosticsWithinSpan,
|
|
179182
179378
|
getDirectoryPath: () => getDirectoryPath,
|
|
@@ -179207,6 +179403,7 @@ __export(ts_exports2, {
|
|
|
179207
179403
|
getEmitFlags: () => getEmitFlags,
|
|
179208
179404
|
getEmitHelpers: () => getEmitHelpers,
|
|
179209
179405
|
getEmitModuleDetectionKind: () => getEmitModuleDetectionKind,
|
|
179406
|
+
getEmitModuleFormatOfFileWorker: () => getEmitModuleFormatOfFileWorker,
|
|
179210
179407
|
getEmitModuleKind: () => getEmitModuleKind,
|
|
179211
179408
|
getEmitModuleResolutionKind: () => getEmitModuleResolutionKind,
|
|
179212
179409
|
getEmitScriptTarget: () => getEmitScriptTarget,
|
|
@@ -179257,6 +179454,7 @@ __export(ts_exports2, {
|
|
|
179257
179454
|
getIdentifierGeneratedImportReference: () => getIdentifierGeneratedImportReference,
|
|
179258
179455
|
getIdentifierTypeArguments: () => getIdentifierTypeArguments,
|
|
179259
179456
|
getImmediatelyInvokedFunctionExpression: () => getImmediatelyInvokedFunctionExpression,
|
|
179457
|
+
getImpliedNodeFormatForEmitWorker: () => getImpliedNodeFormatForEmitWorker,
|
|
179260
179458
|
getImpliedNodeFormatForFile: () => getImpliedNodeFormatForFile,
|
|
179261
179459
|
getImpliedNodeFormatForFileWorker: () => getImpliedNodeFormatForFileWorker,
|
|
179262
179460
|
getImportNeedsImportDefaultHelper: () => getImportNeedsImportDefaultHelper,
|
|
@@ -179362,7 +179560,6 @@ __export(ts_exports2, {
|
|
|
179362
179560
|
getNameOfScriptTarget: () => getNameOfScriptTarget,
|
|
179363
179561
|
getNameOrArgument: () => getNameOrArgument,
|
|
179364
179562
|
getNameTable: () => getNameTable,
|
|
179365
|
-
getNamesForExportedSymbol: () => getNamesForExportedSymbol,
|
|
179366
179563
|
getNamespaceDeclarationNode: () => getNamespaceDeclarationNode,
|
|
179367
179564
|
getNewLineCharacter: () => getNewLineCharacter,
|
|
179368
179565
|
getNewLineKind: () => getNewLineKind,
|
|
@@ -179599,6 +179796,7 @@ __export(ts_exports2, {
|
|
|
179599
179796
|
ignoreSourceNewlines: () => ignoreSourceNewlines,
|
|
179600
179797
|
ignoredPaths: () => ignoredPaths,
|
|
179601
179798
|
importFromModuleSpecifier: () => importFromModuleSpecifier,
|
|
179799
|
+
importSyntaxAffectsModuleResolution: () => importSyntaxAffectsModuleResolution,
|
|
179602
179800
|
indexOfAnyCharCode: () => indexOfAnyCharCode,
|
|
179603
179801
|
indexOfNode: () => indexOfNode,
|
|
179604
179802
|
indicesOf: () => indicesOf,
|
|
@@ -180644,11 +180842,11 @@ __export(ts_exports2, {
|
|
|
180644
180842
|
transformESDecorators: () => transformESDecorators,
|
|
180645
180843
|
transformESNext: () => transformESNext,
|
|
180646
180844
|
transformGenerators: () => transformGenerators,
|
|
180845
|
+
transformImpliedNodeFormatDependentModule: () => transformImpliedNodeFormatDependentModule,
|
|
180647
180846
|
transformJsx: () => transformJsx,
|
|
180648
180847
|
transformLegacyDecorators: () => transformLegacyDecorators,
|
|
180649
180848
|
transformModule: () => transformModule,
|
|
180650
180849
|
transformNamedEvaluation: () => transformNamedEvaluation,
|
|
180651
|
-
transformNodeModule: () => transformNodeModule,
|
|
180652
180850
|
transformNodes: () => transformNodes,
|
|
180653
180851
|
transformSystemModule: () => transformSystemModule,
|
|
180654
180852
|
transformTypeScript: () => transformTypeScript,
|
|
@@ -181519,7 +181717,7 @@ __export(ts_server_protocol_exports, {
|
|
|
181519
181717
|
NewLineKind: () => NewLineKind2,
|
|
181520
181718
|
OrganizeImportsMode: () => OrganizeImportsMode,
|
|
181521
181719
|
PollingWatchKind: () => PollingWatchKind2,
|
|
181522
|
-
ScriptTarget: () =>
|
|
181720
|
+
ScriptTarget: () => ScriptTarget11,
|
|
181523
181721
|
SemicolonPreference: () => SemicolonPreference,
|
|
181524
181722
|
WatchDirectoryKind: () => WatchDirectoryKind2,
|
|
181525
181723
|
WatchFileKind: () => WatchFileKind2
|
|
@@ -181710,24 +181908,24 @@ var NewLineKind2 = /* @__PURE__ */ ((NewLineKind3) => {
|
|
|
181710
181908
|
NewLineKind3["Lf"] = "Lf";
|
|
181711
181909
|
return NewLineKind3;
|
|
181712
181910
|
})(NewLineKind2 || {});
|
|
181713
|
-
var
|
|
181714
|
-
|
|
181715
|
-
|
|
181716
|
-
|
|
181717
|
-
|
|
181718
|
-
|
|
181719
|
-
|
|
181720
|
-
|
|
181721
|
-
|
|
181722
|
-
|
|
181723
|
-
|
|
181724
|
-
|
|
181725
|
-
|
|
181726
|
-
|
|
181727
|
-
|
|
181728
|
-
|
|
181729
|
-
return
|
|
181730
|
-
})(
|
|
181911
|
+
var ScriptTarget11 = /* @__PURE__ */ ((ScriptTarget12) => {
|
|
181912
|
+
ScriptTarget12["ES3"] = "es3";
|
|
181913
|
+
ScriptTarget12["ES5"] = "es5";
|
|
181914
|
+
ScriptTarget12["ES6"] = "es6";
|
|
181915
|
+
ScriptTarget12["ES2015"] = "es2015";
|
|
181916
|
+
ScriptTarget12["ES2016"] = "es2016";
|
|
181917
|
+
ScriptTarget12["ES2017"] = "es2017";
|
|
181918
|
+
ScriptTarget12["ES2018"] = "es2018";
|
|
181919
|
+
ScriptTarget12["ES2019"] = "es2019";
|
|
181920
|
+
ScriptTarget12["ES2020"] = "es2020";
|
|
181921
|
+
ScriptTarget12["ES2021"] = "es2021";
|
|
181922
|
+
ScriptTarget12["ES2022"] = "es2022";
|
|
181923
|
+
ScriptTarget12["ES2023"] = "es2023";
|
|
181924
|
+
ScriptTarget12["ESNext"] = "esnext";
|
|
181925
|
+
ScriptTarget12["JSON"] = "json";
|
|
181926
|
+
ScriptTarget12["Latest"] = "esnext" /* ESNext */;
|
|
181927
|
+
return ScriptTarget12;
|
|
181928
|
+
})(ScriptTarget11 || {});
|
|
181731
181929
|
{
|
|
181732
181930
|
}
|
|
181733
181931
|
|
|
@@ -182869,7 +183067,7 @@ var Project2 = class _Project {
|
|
|
182869
183067
|
return this.projectName;
|
|
182870
183068
|
}
|
|
182871
183069
|
removeLocalTypingsFromTypeAcquisition(newTypeAcquisition) {
|
|
182872
|
-
if (!newTypeAcquisition || !newTypeAcquisition.include) {
|
|
183070
|
+
if (!newTypeAcquisition.enable || !newTypeAcquisition.include) {
|
|
182873
183071
|
return newTypeAcquisition;
|
|
182874
183072
|
}
|
|
182875
183073
|
return { ...newTypeAcquisition, include: this.removeExistingTypings(newTypeAcquisition.include) };
|
|
@@ -183307,8 +183505,9 @@ var Project2 = class _Project {
|
|
|
183307
183505
|
return this.program;
|
|
183308
183506
|
}
|
|
183309
183507
|
removeExistingTypings(include) {
|
|
183508
|
+
if (!include.length) return include;
|
|
183310
183509
|
const existing = getAutomaticTypeDirectiveNames(this.getCompilerOptions(), this.directoryStructureHost);
|
|
183311
|
-
return
|
|
183510
|
+
return filter(include, (i) => !existing.includes(i));
|
|
183312
183511
|
}
|
|
183313
183512
|
updateGraphWorker() {
|
|
183314
183513
|
var _a, _b;
|
|
@@ -193092,6 +193291,7 @@ if (typeof console !== "undefined") {
|
|
|
193092
193291
|
canHaveJSDoc,
|
|
193093
193292
|
canHaveLocals,
|
|
193094
193293
|
canHaveModifiers,
|
|
193294
|
+
canHaveModuleSpecifier,
|
|
193095
193295
|
canHaveSymbol,
|
|
193096
193296
|
canIncludeBindAndCheckDiagnostics,
|
|
193097
193297
|
canJsonReportNoInputFiles,
|
|
@@ -193536,6 +193736,7 @@ if (typeof console !== "undefined") {
|
|
|
193536
193736
|
getDefaultLibFilePath,
|
|
193537
193737
|
getDefaultLikeExportInfo,
|
|
193538
193738
|
getDefaultLikeExportNameFromDeclaration,
|
|
193739
|
+
getDefaultResolutionModeForFileWorker,
|
|
193539
193740
|
getDiagnosticText,
|
|
193540
193741
|
getDiagnosticsWithinSpan,
|
|
193541
193742
|
getDirectoryPath,
|
|
@@ -193566,6 +193767,7 @@ if (typeof console !== "undefined") {
|
|
|
193566
193767
|
getEmitFlags,
|
|
193567
193768
|
getEmitHelpers,
|
|
193568
193769
|
getEmitModuleDetectionKind,
|
|
193770
|
+
getEmitModuleFormatOfFileWorker,
|
|
193569
193771
|
getEmitModuleKind,
|
|
193570
193772
|
getEmitModuleResolutionKind,
|
|
193571
193773
|
getEmitScriptTarget,
|
|
@@ -193616,6 +193818,7 @@ if (typeof console !== "undefined") {
|
|
|
193616
193818
|
getIdentifierGeneratedImportReference,
|
|
193617
193819
|
getIdentifierTypeArguments,
|
|
193618
193820
|
getImmediatelyInvokedFunctionExpression,
|
|
193821
|
+
getImpliedNodeFormatForEmitWorker,
|
|
193619
193822
|
getImpliedNodeFormatForFile,
|
|
193620
193823
|
getImpliedNodeFormatForFileWorker,
|
|
193621
193824
|
getImportNeedsImportDefaultHelper,
|
|
@@ -193721,7 +193924,6 @@ if (typeof console !== "undefined") {
|
|
|
193721
193924
|
getNameOfScriptTarget,
|
|
193722
193925
|
getNameOrArgument,
|
|
193723
193926
|
getNameTable,
|
|
193724
|
-
getNamesForExportedSymbol,
|
|
193725
193927
|
getNamespaceDeclarationNode,
|
|
193726
193928
|
getNewLineCharacter,
|
|
193727
193929
|
getNewLineKind,
|
|
@@ -193958,6 +194160,7 @@ if (typeof console !== "undefined") {
|
|
|
193958
194160
|
ignoreSourceNewlines,
|
|
193959
194161
|
ignoredPaths,
|
|
193960
194162
|
importFromModuleSpecifier,
|
|
194163
|
+
importSyntaxAffectsModuleResolution,
|
|
193961
194164
|
indexOfAnyCharCode,
|
|
193962
194165
|
indexOfNode,
|
|
193963
194166
|
indicesOf,
|
|
@@ -195003,11 +195206,11 @@ if (typeof console !== "undefined") {
|
|
|
195003
195206
|
transformESDecorators,
|
|
195004
195207
|
transformESNext,
|
|
195005
195208
|
transformGenerators,
|
|
195209
|
+
transformImpliedNodeFormatDependentModule,
|
|
195006
195210
|
transformJsx,
|
|
195007
195211
|
transformLegacyDecorators,
|
|
195008
195212
|
transformModule,
|
|
195009
195213
|
transformNamedEvaluation,
|
|
195010
|
-
transformNodeModule,
|
|
195011
195214
|
transformNodes,
|
|
195012
195215
|
transformSystemModule,
|
|
195013
195216
|
transformTypeScript,
|