@typescript-deploys/pr-build 5.0.0-pr-51492-2 → 5.0.0-pr-50996-9
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.es2015.core.d.ts +2 -2
- package/lib/lib.es5.d.ts +1 -1
- package/lib/tsc.js +354 -408
- package/lib/tsserver.js +1025 -786
- package/lib/tsserverlibrary.d.ts +2 -4
- package/lib/tsserverlibrary.js +1037 -788
- package/lib/typescript.d.ts +2 -4
- package/lib/typescript.js +1029 -785
- package/lib/typingsInstaller.js +149 -221
- package/package.json +1 -1
package/lib/typingsInstaller.js
CHANGED
|
@@ -50,7 +50,7 @@ var path = __toESM(require("path"));
|
|
|
50
50
|
|
|
51
51
|
// src/compiler/corePublic.ts
|
|
52
52
|
var versionMajorMinor = "5.0";
|
|
53
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
53
|
+
var version = `${versionMajorMinor}.0-insiders.20221123`;
|
|
54
54
|
|
|
55
55
|
// src/compiler/core.ts
|
|
56
56
|
var emptyArray = [];
|
|
@@ -909,15 +909,9 @@ function isNodeLikeSystem() {
|
|
|
909
909
|
// src/compiler/debug.ts
|
|
910
910
|
var Debug;
|
|
911
911
|
((Debug2) => {
|
|
912
|
-
let typeScriptVersion2;
|
|
913
912
|
let currentAssertionLevel = 0 /* None */;
|
|
914
913
|
Debug2.currentLogLevel = 2 /* Warning */;
|
|
915
914
|
Debug2.isDebugging = false;
|
|
916
|
-
Debug2.enableDeprecationWarnings = true;
|
|
917
|
-
function getTypeScriptVersion() {
|
|
918
|
-
return typeScriptVersion2 != null ? typeScriptVersion2 : typeScriptVersion2 = new Version(version);
|
|
919
|
-
}
|
|
920
|
-
Debug2.getTypeScriptVersion = getTypeScriptVersion;
|
|
921
915
|
function shouldLog(level) {
|
|
922
916
|
return Debug2.currentLogLevel <= level;
|
|
923
917
|
}
|
|
@@ -1433,52 +1427,6 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
|
|
|
1433
1427
|
isDebugInfoEnabled = true;
|
|
1434
1428
|
}
|
|
1435
1429
|
Debug2.enableDebugInfo = enableDebugInfo;
|
|
1436
|
-
function formatDeprecationMessage(name, error, errorAfter, since, message) {
|
|
1437
|
-
let deprecationMessage = error ? "DeprecationError: " : "DeprecationWarning: ";
|
|
1438
|
-
deprecationMessage += `'${name}' `;
|
|
1439
|
-
deprecationMessage += since ? `has been deprecated since v${since}` : "is deprecated";
|
|
1440
|
-
deprecationMessage += error ? " and can no longer be used." : errorAfter ? ` and will no longer be usable after v${errorAfter}.` : ".";
|
|
1441
|
-
deprecationMessage += message ? ` ${formatStringFromArgs(message, [name], 0)}` : "";
|
|
1442
|
-
return deprecationMessage;
|
|
1443
|
-
}
|
|
1444
|
-
function createErrorDeprecation(name, errorAfter, since, message) {
|
|
1445
|
-
const deprecationMessage = formatDeprecationMessage(name, true, errorAfter, since, message);
|
|
1446
|
-
return () => {
|
|
1447
|
-
throw new TypeError(deprecationMessage);
|
|
1448
|
-
};
|
|
1449
|
-
}
|
|
1450
|
-
function createWarningDeprecation(name, errorAfter, since, message) {
|
|
1451
|
-
let hasWrittenDeprecation = false;
|
|
1452
|
-
return () => {
|
|
1453
|
-
if (Debug2.enableDeprecationWarnings && !hasWrittenDeprecation) {
|
|
1454
|
-
log2.warn(formatDeprecationMessage(name, false, errorAfter, since, message));
|
|
1455
|
-
hasWrittenDeprecation = true;
|
|
1456
|
-
}
|
|
1457
|
-
};
|
|
1458
|
-
}
|
|
1459
|
-
function createDeprecation(name, options = {}) {
|
|
1460
|
-
var _a2, _b;
|
|
1461
|
-
const version2 = typeof options.typeScriptVersion === "string" ? new Version(options.typeScriptVersion) : (_a2 = options.typeScriptVersion) != null ? _a2 : getTypeScriptVersion();
|
|
1462
|
-
const errorAfter = typeof options.errorAfter === "string" ? new Version(options.errorAfter) : options.errorAfter;
|
|
1463
|
-
const warnAfter = typeof options.warnAfter === "string" ? new Version(options.warnAfter) : options.warnAfter;
|
|
1464
|
-
const since = typeof options.since === "string" ? new Version(options.since) : (_b = options.since) != null ? _b : warnAfter;
|
|
1465
|
-
const error = options.error || errorAfter && version2.compareTo(errorAfter) <= 0;
|
|
1466
|
-
const warn = !warnAfter || version2.compareTo(warnAfter) >= 0;
|
|
1467
|
-
return error ? createErrorDeprecation(name, errorAfter, since, options.message) : warn ? createWarningDeprecation(name, errorAfter, since, options.message) : noop;
|
|
1468
|
-
}
|
|
1469
|
-
Debug2.createDeprecation = createDeprecation;
|
|
1470
|
-
function wrapFunction(deprecation, func) {
|
|
1471
|
-
return function() {
|
|
1472
|
-
deprecation();
|
|
1473
|
-
return func.apply(this, arguments);
|
|
1474
|
-
};
|
|
1475
|
-
}
|
|
1476
|
-
function deprecate(func, options) {
|
|
1477
|
-
var _a2;
|
|
1478
|
-
const deprecation = createDeprecation((_a2 = options == null ? void 0 : options.name) != null ? _a2 : getFunctionName(func), options);
|
|
1479
|
-
return wrapFunction(deprecation, func);
|
|
1480
|
-
}
|
|
1481
|
-
Debug2.deprecate = deprecate;
|
|
1482
1430
|
function formatVariance(varianceFlags) {
|
|
1483
1431
|
const variance = varianceFlags & 7 /* VarianceMask */;
|
|
1484
1432
|
let result = variance === 0 /* Invariant */ ? "in out" : variance === 3 /* Bivariant */ ? "[bivariant]" : variance === 2 /* Contravariant */ ? "in" : variance === 1 /* Covariant */ ? "out" : variance === 4 /* Independent */ ? "[independent]" : "";
|
|
@@ -3198,6 +3146,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
3198
3146
|
return TypeFlags2;
|
|
3199
3147
|
})(TypeFlags || {});
|
|
3200
3148
|
var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
|
|
3149
|
+
ObjectFlags3[ObjectFlags3["None"] = 0] = "None";
|
|
3201
3150
|
ObjectFlags3[ObjectFlags3["Class"] = 1] = "Class";
|
|
3202
3151
|
ObjectFlags3[ObjectFlags3["Interface"] = 2] = "Interface";
|
|
3203
3152
|
ObjectFlags3[ObjectFlags3["Reference"] = 4] = "Reference";
|
|
@@ -6219,10 +6168,10 @@ var Diagnostics = {
|
|
|
6219
6168
|
Module_name_0_matched_pattern_1: diag(6092, 3 /* Message */, "Module_name_0_matched_pattern_1_6092", "Module name '{0}', matched pattern '{1}'."),
|
|
6220
6169
|
Trying_substitution_0_candidate_module_location_Colon_1: diag(6093, 3 /* Message */, "Trying_substitution_0_candidate_module_location_Colon_1_6093", "Trying substitution '{0}', candidate module location: '{1}'."),
|
|
6221
6170
|
Resolving_module_name_0_relative_to_base_url_1_2: diag(6094, 3 /* Message */, "Resolving_module_name_0_relative_to_base_url_1_2_6094", "Resolving module name '{0}' relative to base url '{1}' - '{2}'."),
|
|
6222
|
-
|
|
6171
|
+
Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_types_Colon_1: diag(6095, 3 /* Message */, "Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_types_Colon_1_6095", "Loading module as file / folder, candidate module location '{0}', target file types: {1}."),
|
|
6223
6172
|
File_0_does_not_exist: diag(6096, 3 /* Message */, "File_0_does_not_exist_6096", "File '{0}' does not exist."),
|
|
6224
6173
|
File_0_exist_use_it_as_a_name_resolution_result: diag(6097, 3 /* Message */, "File_0_exist_use_it_as_a_name_resolution_result_6097", "File '{0}' exist - use it as a name resolution result."),
|
|
6225
|
-
|
|
6174
|
+
Loading_module_0_from_node_modules_folder_target_file_types_Colon_1: diag(6098, 3 /* Message */, "Loading_module_0_from_node_modules_folder_target_file_types_Colon_1_6098", "Loading module '{0}' from 'node_modules' folder, target file types: {1}."),
|
|
6226
6175
|
Found_package_json_at_0: diag(6099, 3 /* Message */, "Found_package_json_at_0_6099", "Found 'package.json' at '{0}'."),
|
|
6227
6176
|
package_json_does_not_have_a_0_field: diag(6100, 3 /* Message */, "package_json_does_not_have_a_0_field_6100", "'package.json' does not have a '{0}' field."),
|
|
6228
6177
|
package_json_has_0_field_1_that_references_2: diag(6101, 3 /* Message */, "package_json_has_0_field_1_that_references_2_6101", "'package.json' has '{0}' field '{1}' that references '{2}'."),
|
|
@@ -11456,12 +11405,10 @@ var supportedJSExtensionsFlat = flatten(supportedJSExtensions);
|
|
|
11456
11405
|
var allSupportedExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */, ".js" /* Js */, ".jsx" /* Jsx */], [".cts" /* Cts */, ".d.cts" /* Dcts */, ".cjs" /* Cjs */], [".mts" /* Mts */, ".d.mts" /* Dmts */, ".mjs" /* Mjs */]];
|
|
11457
11406
|
var allSupportedExtensionsWithJson = [...allSupportedExtensions, [".json" /* Json */]];
|
|
11458
11407
|
var supportedDeclarationExtensions = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */];
|
|
11408
|
+
var supportedTSImplementationExtensions = [".ts" /* Ts */, ".cts" /* Cts */, ".mts" /* Mts */, ".tsx" /* Tsx */];
|
|
11459
11409
|
function hasJSFileExtension(fileName) {
|
|
11460
11410
|
return some(supportedJSExtensionsFlat, (extension) => fileExtensionIs(fileName, extension));
|
|
11461
11411
|
}
|
|
11462
|
-
function hasTSFileExtension(fileName) {
|
|
11463
|
-
return some(supportedTSExtensionsFlat, (extension) => fileExtensionIs(fileName, extension));
|
|
11464
|
-
}
|
|
11465
11412
|
var extensionsToRemove = [".d.ts" /* Dts */, ".d.mts" /* Dmts */, ".d.cts" /* Dcts */, ".mjs" /* Mjs */, ".mts" /* Mts */, ".cjs" /* Cjs */, ".cts" /* Cts */, ".ts" /* Ts */, ".js" /* Js */, ".tsx" /* Tsx */, ".jsx" /* Jsx */, ".json" /* Json */];
|
|
11466
11413
|
function removeFileExtension(path2) {
|
|
11467
11414
|
for (const ext of extensionsToRemove) {
|
|
@@ -25795,15 +25742,18 @@ function removeIgnoredPackageId(r) {
|
|
|
25795
25742
|
return { path: r.path, ext: r.extension };
|
|
25796
25743
|
}
|
|
25797
25744
|
}
|
|
25798
|
-
|
|
25799
|
-
|
|
25800
|
-
|
|
25801
|
-
|
|
25802
|
-
|
|
25803
|
-
|
|
25804
|
-
|
|
25805
|
-
|
|
25806
|
-
|
|
25745
|
+
function formatExtensions(extensions) {
|
|
25746
|
+
const result = [];
|
|
25747
|
+
if (extensions & 1 /* TypeScript */)
|
|
25748
|
+
result.push("TypeScript");
|
|
25749
|
+
if (extensions & 2 /* JavaScript */)
|
|
25750
|
+
result.push("JavaScript");
|
|
25751
|
+
if (extensions & 4 /* Declaration */)
|
|
25752
|
+
result.push("Declaration");
|
|
25753
|
+
if (extensions & 8 /* Json */)
|
|
25754
|
+
result.push("JSON");
|
|
25755
|
+
return result.join(", ");
|
|
25756
|
+
}
|
|
25807
25757
|
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache) {
|
|
25808
25758
|
if (resultFromCache) {
|
|
25809
25759
|
resultFromCache.failedLookupLocations.push(...failedLookupLocations);
|
|
@@ -26128,38 +26078,42 @@ function nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions,
|
|
|
26128
26078
|
resolutionMode
|
|
26129
26079
|
);
|
|
26130
26080
|
}
|
|
26131
|
-
var jsOnlyExtensions = [1 /* JavaScript */];
|
|
26132
|
-
var tsExtensions = [0 /* TypeScript */, 1 /* JavaScript */];
|
|
26133
|
-
var tsPlusJsonExtensions = [...tsExtensions, 2 /* Json */];
|
|
26134
|
-
var tsconfigExtensions = [3 /* TSConfig */];
|
|
26135
26081
|
function nodeNextModuleNameResolverWorker(features, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
26136
26082
|
const containingDirectory = getDirectoryPath(containingFile);
|
|
26137
26083
|
const esmMode = resolutionMode === 99 /* ESNext */ ? 32 /* EsmMode */ : 0;
|
|
26138
|
-
let extensions = compilerOptions.noDtsResolution ?
|
|
26084
|
+
let extensions = compilerOptions.noDtsResolution ? 3 /* ImplementationFiles */ : 1 /* TypeScript */ | 2 /* JavaScript */ | 4 /* Declaration */;
|
|
26139
26085
|
if (compilerOptions.resolveJsonModule) {
|
|
26140
|
-
extensions
|
|
26086
|
+
extensions |= 8 /* Json */;
|
|
26141
26087
|
}
|
|
26142
|
-
return nodeModuleNameResolverWorker(features | esmMode, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference);
|
|
26088
|
+
return nodeModuleNameResolverWorker(features | esmMode, moduleName, containingDirectory, compilerOptions, host, cache, extensions, false, redirectedReference);
|
|
26143
26089
|
}
|
|
26144
26090
|
function tryResolveJSModuleWorker(moduleName, initialDir, host) {
|
|
26145
|
-
return nodeModuleNameResolverWorker(
|
|
26091
|
+
return nodeModuleNameResolverWorker(
|
|
26092
|
+
0 /* None */,
|
|
26093
|
+
moduleName,
|
|
26094
|
+
initialDir,
|
|
26095
|
+
{ moduleResolution: 2 /* NodeJs */, allowJs: true },
|
|
26096
|
+
host,
|
|
26097
|
+
void 0,
|
|
26098
|
+
2 /* JavaScript */,
|
|
26099
|
+
false,
|
|
26100
|
+
void 0
|
|
26101
|
+
);
|
|
26146
26102
|
}
|
|
26147
|
-
function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference,
|
|
26103
|
+
function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, isConfigLookup) {
|
|
26148
26104
|
let extensions;
|
|
26149
|
-
if (
|
|
26150
|
-
extensions =
|
|
26105
|
+
if (isConfigLookup) {
|
|
26106
|
+
extensions = 8 /* Json */;
|
|
26151
26107
|
} else if (compilerOptions.noDtsResolution) {
|
|
26152
|
-
extensions =
|
|
26153
|
-
if (compilerOptions.allowJs)
|
|
26154
|
-
extensions.push(1 /* JavaScript */);
|
|
26108
|
+
extensions = 3 /* ImplementationFiles */;
|
|
26155
26109
|
if (compilerOptions.resolveJsonModule)
|
|
26156
|
-
extensions
|
|
26110
|
+
extensions |= 8 /* Json */;
|
|
26157
26111
|
} else {
|
|
26158
|
-
extensions = compilerOptions.resolveJsonModule ?
|
|
26112
|
+
extensions = compilerOptions.resolveJsonModule ? 1 /* TypeScript */ | 2 /* JavaScript */ | 4 /* Declaration */ | 8 /* Json */ : 1 /* TypeScript */ | 2 /* JavaScript */ | 4 /* Declaration */;
|
|
26159
26113
|
}
|
|
26160
|
-
return nodeModuleNameResolverWorker(0 /* None */, moduleName, getDirectoryPath(containingFile), compilerOptions, host, cache, extensions, redirectedReference);
|
|
26114
|
+
return nodeModuleNameResolverWorker(0 /* None */, moduleName, getDirectoryPath(containingFile), compilerOptions, host, cache, extensions, !!isConfigLookup, redirectedReference);
|
|
26161
26115
|
}
|
|
26162
|
-
function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference) {
|
|
26116
|
+
function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, isConfigLookup, redirectedReference) {
|
|
26163
26117
|
var _a2, _b;
|
|
26164
26118
|
const traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
26165
26119
|
const failedLookupLocations = [];
|
|
@@ -26179,12 +26133,20 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
|
|
|
26179
26133
|
features,
|
|
26180
26134
|
conditions,
|
|
26181
26135
|
requestContainingDirectory: containingDirectory,
|
|
26182
|
-
reportDiagnostic: (diag2) => void diagnostics.push(diag2)
|
|
26136
|
+
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
26137
|
+
isConfigLookup
|
|
26183
26138
|
};
|
|
26184
26139
|
if (traceEnabled && getEmitModuleResolutionKind(compilerOptions) >= 3 /* Node16 */ && getEmitModuleResolutionKind(compilerOptions) <= 99 /* NodeNext */) {
|
|
26185
26140
|
trace(host, Diagnostics.Resolving_in_0_mode_with_conditions_1, features & 32 /* EsmMode */ ? "ESM" : "CJS", conditions.map((c) => `'${c}'`).join(", "));
|
|
26186
26141
|
}
|
|
26187
|
-
|
|
26142
|
+
let result;
|
|
26143
|
+
if (getEmitModuleResolutionKind(compilerOptions) === 2 /* NodeJs */) {
|
|
26144
|
+
const priorityExtensions = extensions & (1 /* TypeScript */ | 4 /* Declaration */);
|
|
26145
|
+
const secondaryExtensions = extensions & ~(1 /* TypeScript */ | 4 /* Declaration */);
|
|
26146
|
+
result = priorityExtensions && tryResolve(priorityExtensions) || secondaryExtensions && tryResolve(secondaryExtensions) || void 0;
|
|
26147
|
+
} else {
|
|
26148
|
+
result = tryResolve(extensions);
|
|
26149
|
+
}
|
|
26188
26150
|
return createResolvedModuleWithFailedLookupLocations(
|
|
26189
26151
|
(_a2 = result == null ? void 0 : result.value) == null ? void 0 : _a2.resolved,
|
|
26190
26152
|
(_b = result == null ? void 0 : result.value) == null ? void 0 : _b.isExternalLibraryImport,
|
|
@@ -26209,7 +26171,7 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
|
|
|
26209
26171
|
}
|
|
26210
26172
|
if (!resolved2) {
|
|
26211
26173
|
if (traceEnabled) {
|
|
26212
|
-
trace(host, Diagnostics.
|
|
26174
|
+
trace(host, Diagnostics.Loading_module_0_from_node_modules_folder_target_file_types_Colon_1, moduleName, formatExtensions(extensions2));
|
|
26213
26175
|
}
|
|
26214
26176
|
resolved2 = loadModuleFromNearestNodeModulesDirectory(extensions2, moduleName, containingDirectory, state, cache, redirectedReference);
|
|
26215
26177
|
}
|
|
@@ -26250,7 +26212,7 @@ function realPath(path2, host, traceEnabled) {
|
|
|
26250
26212
|
}
|
|
26251
26213
|
function nodeLoadModuleByRelativeName(extensions, candidate, onlyRecordFailures, state, considerPackageJson) {
|
|
26252
26214
|
if (state.traceEnabled) {
|
|
26253
|
-
trace(state.host, Diagnostics.
|
|
26215
|
+
trace(state.host, Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_types_Colon_1, candidate, formatExtensions(extensions));
|
|
26254
26216
|
}
|
|
26255
26217
|
if (!hasTrailingDirectorySeparator(candidate)) {
|
|
26256
26218
|
if (!onlyRecordFailures) {
|
|
@@ -26308,10 +26270,9 @@ function loadModuleFromFileNoPackageId(extensions, candidate, onlyRecordFailures
|
|
|
26308
26270
|
return noPackageId(loadModuleFromFile(extensions, candidate, onlyRecordFailures, state));
|
|
26309
26271
|
}
|
|
26310
26272
|
function loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) {
|
|
26311
|
-
|
|
26312
|
-
|
|
26313
|
-
|
|
26314
|
-
return extensionLess === void 0 && extensions === 2 /* Json */ ? void 0 : tryAddingExtensions(extensionLess || candidate, extensions, extension, onlyRecordFailures, state);
|
|
26273
|
+
const resolvedByReplacingExtension = loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
|
|
26274
|
+
if (resolvedByReplacingExtension) {
|
|
26275
|
+
return resolvedByReplacingExtension;
|
|
26315
26276
|
}
|
|
26316
26277
|
if (!(state.features & 32 /* EsmMode */)) {
|
|
26317
26278
|
const resolvedByAddingExtension = tryAddingExtensions(candidate, extensions, "", onlyRecordFailures, state);
|
|
@@ -26319,10 +26280,9 @@ function loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) {
|
|
|
26319
26280
|
return resolvedByAddingExtension;
|
|
26320
26281
|
}
|
|
26321
26282
|
}
|
|
26322
|
-
return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
|
|
26323
26283
|
}
|
|
26324
26284
|
function loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state) {
|
|
26325
|
-
if (hasJSFileExtension(candidate) || fileExtensionIs(candidate, ".json" /* Json */)
|
|
26285
|
+
if (hasJSFileExtension(candidate) || extensions & 8 /* Json */ && fileExtensionIs(candidate, ".json" /* Json */)) {
|
|
26326
26286
|
const extensionless = removeFileExtension(candidate);
|
|
26327
26287
|
const extension = candidate.substring(extensionless.length);
|
|
26328
26288
|
if (state.traceEnabled) {
|
|
@@ -26332,7 +26292,7 @@ function loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecor
|
|
|
26332
26292
|
}
|
|
26333
26293
|
}
|
|
26334
26294
|
function loadJSOrExactTSFileName(extensions, candidate, onlyRecordFailures, state) {
|
|
26335
|
-
if (
|
|
26295
|
+
if (extensions & 1 /* TypeScript */ && fileExtensionIsOneOf(candidate, supportedTSImplementationExtensions) || extensions & 4 /* Declaration */ && fileExtensionIsOneOf(candidate, supportedDeclarationExtensions)) {
|
|
26336
26296
|
const result = tryFile(candidate, onlyRecordFailures, state);
|
|
26337
26297
|
return result !== void 0 ? { path: candidate, ext: tryExtractTSExtension(candidate) } : void 0;
|
|
26338
26298
|
}
|
|
@@ -26345,59 +26305,32 @@ function tryAddingExtensions(candidate, extensions, originalExtension, onlyRecor
|
|
|
26345
26305
|
onlyRecordFailures = !directoryProbablyExists(directory, state.host);
|
|
26346
26306
|
}
|
|
26347
26307
|
}
|
|
26348
|
-
switch (
|
|
26349
|
-
case
|
|
26350
|
-
|
|
26351
|
-
|
|
26352
|
-
|
|
26353
|
-
|
|
26354
|
-
|
|
26355
|
-
|
|
26356
|
-
|
|
26357
|
-
|
|
26358
|
-
|
|
26359
|
-
|
|
26360
|
-
|
|
26361
|
-
|
|
26362
|
-
|
|
26363
|
-
return
|
|
26364
|
-
}
|
|
26365
|
-
|
|
26366
|
-
|
|
26367
|
-
|
|
26368
|
-
|
|
26369
|
-
|
|
26370
|
-
case ".mts" /* Mts */:
|
|
26371
|
-
case ".d.mts" /* Dmts */:
|
|
26372
|
-
return tryExtension(".mts" /* Mts */) || (useDts ? tryExtension(".d.mts" /* Dmts */) : void 0);
|
|
26373
|
-
case ".cjs" /* Cjs */:
|
|
26374
|
-
case ".cts" /* Cts */:
|
|
26375
|
-
case ".d.cts" /* Dcts */:
|
|
26376
|
-
return tryExtension(".cts" /* Cts */) || (useDts ? tryExtension(".d.cts" /* Dcts */) : void 0);
|
|
26377
|
-
case ".json" /* Json */:
|
|
26378
|
-
candidate += ".json" /* Json */;
|
|
26379
|
-
return useDts ? tryExtension(".d.ts" /* Dts */) : void 0;
|
|
26380
|
-
default:
|
|
26381
|
-
return tryExtension(".ts" /* Ts */) || tryExtension(".tsx" /* Tsx */) || (useDts ? tryExtension(".d.ts" /* Dts */) : void 0);
|
|
26382
|
-
}
|
|
26383
|
-
case 1 /* JavaScript */:
|
|
26384
|
-
switch (originalExtension) {
|
|
26385
|
-
case ".mjs" /* Mjs */:
|
|
26386
|
-
case ".mts" /* Mts */:
|
|
26387
|
-
case ".d.mts" /* Dmts */:
|
|
26388
|
-
return tryExtension(".mjs" /* Mjs */);
|
|
26389
|
-
case ".cjs" /* Cjs */:
|
|
26390
|
-
case ".cts" /* Cts */:
|
|
26391
|
-
case ".d.cts" /* Dcts */:
|
|
26392
|
-
return tryExtension(".cjs" /* Cjs */);
|
|
26393
|
-
case ".json" /* Json */:
|
|
26394
|
-
return tryExtension(".json" /* Json */);
|
|
26395
|
-
default:
|
|
26396
|
-
return tryExtension(".js" /* Js */) || tryExtension(".jsx" /* Jsx */);
|
|
26308
|
+
switch (originalExtension) {
|
|
26309
|
+
case ".mjs" /* Mjs */:
|
|
26310
|
+
case ".mts" /* Mts */:
|
|
26311
|
+
case ".d.mts" /* Dmts */:
|
|
26312
|
+
return extensions & 1 /* TypeScript */ && tryExtension(".mts" /* Mts */) || extensions & 4 /* Declaration */ && tryExtension(".d.mts" /* Dmts */) || extensions & 2 /* JavaScript */ && tryExtension(".mjs" /* Mjs */) || void 0;
|
|
26313
|
+
case ".cjs" /* Cjs */:
|
|
26314
|
+
case ".cts" /* Cts */:
|
|
26315
|
+
case ".d.cts" /* Dcts */:
|
|
26316
|
+
return extensions & 1 /* TypeScript */ && tryExtension(".cts" /* Cts */) || extensions & 4 /* Declaration */ && tryExtension(".d.cts" /* Dcts */) || extensions & 2 /* JavaScript */ && tryExtension(".cjs" /* Cjs */) || void 0;
|
|
26317
|
+
case ".json" /* Json */:
|
|
26318
|
+
const originalCandidate = candidate;
|
|
26319
|
+
if (extensions & 4 /* Declaration */) {
|
|
26320
|
+
candidate += ".json" /* Json */;
|
|
26321
|
+
const result = tryExtension(".d.ts" /* Dts */);
|
|
26322
|
+
if (result)
|
|
26323
|
+
return result;
|
|
26324
|
+
}
|
|
26325
|
+
if (extensions & 8 /* Json */) {
|
|
26326
|
+
candidate = originalCandidate;
|
|
26327
|
+
const result = tryExtension(".json" /* Json */);
|
|
26328
|
+
if (result)
|
|
26329
|
+
return result;
|
|
26397
26330
|
}
|
|
26398
|
-
|
|
26399
|
-
|
|
26400
|
-
return tryExtension(".json" /* Json */);
|
|
26331
|
+
return void 0;
|
|
26332
|
+
default:
|
|
26333
|
+
return extensions & 1 /* TypeScript */ && (tryExtension(".ts" /* Ts */) || tryExtension(".tsx" /* Tsx */)) || extensions & 4 /* Declaration */ && tryExtension(".d.ts" /* Dts */) || extensions & 2 /* JavaScript */ && (tryExtension(".js" /* Js */) || tryExtension(".jsx" /* Jsx */)) || state.isConfigLookup && tryExtension(".json" /* Json */) || void 0;
|
|
26401
26334
|
}
|
|
26402
26335
|
function tryExtension(ext) {
|
|
26403
26336
|
const path2 = tryFile(candidate + ext, onlyRecordFailures, state);
|
|
@@ -26491,23 +26424,10 @@ function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
|
26491
26424
|
function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, jsonContent, versionPaths) {
|
|
26492
26425
|
let packageFile;
|
|
26493
26426
|
if (jsonContent) {
|
|
26494
|
-
|
|
26495
|
-
|
|
26496
|
-
|
|
26497
|
-
|
|
26498
|
-
packageFile = readPackageJsonMainField(jsonContent, candidate, state);
|
|
26499
|
-
break;
|
|
26500
|
-
case 0 /* TypeScript */:
|
|
26501
|
-
packageFile = readPackageJsonTypesFields(jsonContent, candidate, state) || readPackageJsonMainField(jsonContent, candidate, state);
|
|
26502
|
-
break;
|
|
26503
|
-
case 4 /* DtsOnly */:
|
|
26504
|
-
packageFile = readPackageJsonTypesFields(jsonContent, candidate, state);
|
|
26505
|
-
break;
|
|
26506
|
-
case 3 /* TSConfig */:
|
|
26507
|
-
packageFile = readPackageJsonTSConfigField(jsonContent, candidate, state);
|
|
26508
|
-
break;
|
|
26509
|
-
default:
|
|
26510
|
-
return Debug.assertNever(extensions);
|
|
26427
|
+
if (state.isConfigLookup) {
|
|
26428
|
+
packageFile = readPackageJsonTSConfigField(jsonContent, candidate, state);
|
|
26429
|
+
} else {
|
|
26430
|
+
packageFile = extensions & 4 /* Declaration */ && readPackageJsonTypesFields(jsonContent, candidate, state) || extensions & (3 /* ImplementationFiles */ | 4 /* Declaration */) && readPackageJsonMainField(jsonContent, candidate, state) || void 0;
|
|
26511
26431
|
}
|
|
26512
26432
|
}
|
|
26513
26433
|
const loader = (extensions2, candidate2, onlyRecordFailures2, state2) => {
|
|
@@ -26521,18 +26441,18 @@ function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFail
|
|
|
26521
26441
|
trace(state2.host, Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromFile);
|
|
26522
26442
|
}
|
|
26523
26443
|
}
|
|
26524
|
-
const
|
|
26444
|
+
const expandedExtensions = extensions2 === 4 /* Declaration */ ? 1 /* TypeScript */ | 4 /* Declaration */ : extensions2;
|
|
26525
26445
|
const features = state2.features;
|
|
26526
26446
|
if ((jsonContent == null ? void 0 : jsonContent.type) !== "module") {
|
|
26527
26447
|
state2.features &= ~32 /* EsmMode */;
|
|
26528
26448
|
}
|
|
26529
|
-
const result = nodeLoadModuleByRelativeName(
|
|
26449
|
+
const result = nodeLoadModuleByRelativeName(expandedExtensions, candidate2, onlyRecordFailures2, state2, false);
|
|
26530
26450
|
state2.features = features;
|
|
26531
26451
|
return result;
|
|
26532
26452
|
};
|
|
26533
26453
|
const onlyRecordFailuresForPackageFile = packageFile ? !directoryProbablyExists(getDirectoryPath(packageFile), state.host) : void 0;
|
|
26534
26454
|
const onlyRecordFailuresForIndex = onlyRecordFailures || !directoryProbablyExists(candidate, state.host);
|
|
26535
|
-
const indexPath = combinePaths(candidate,
|
|
26455
|
+
const indexPath = combinePaths(candidate, state.isConfigLookup ? "tsconfig" : "index");
|
|
26536
26456
|
if (versionPaths && (!packageFile || containsPath(candidate, packageFile))) {
|
|
26537
26457
|
const moduleName = getRelativePathFromDirectory(candidate, packageFile || indexPath, false);
|
|
26538
26458
|
if (state.traceEnabled) {
|
|
@@ -26555,19 +26475,7 @@ function resolvedIfExtensionMatches(extensions, path2) {
|
|
|
26555
26475
|
return ext !== void 0 && extensionIsOk(extensions, ext) ? { path: path2, ext } : void 0;
|
|
26556
26476
|
}
|
|
26557
26477
|
function extensionIsOk(extensions, extension) {
|
|
26558
|
-
|
|
26559
|
-
case 1 /* JavaScript */:
|
|
26560
|
-
return extension === ".js" /* Js */ || extension === ".jsx" /* Jsx */ || extension === ".mjs" /* Mjs */ || extension === ".cjs" /* Cjs */;
|
|
26561
|
-
case 3 /* TSConfig */:
|
|
26562
|
-
case 2 /* Json */:
|
|
26563
|
-
return extension === ".json" /* Json */;
|
|
26564
|
-
case 0 /* TypeScript */:
|
|
26565
|
-
return extension === ".ts" /* Ts */ || extension === ".tsx" /* Tsx */ || extension === ".mts" /* Mts */ || extension === ".cts" /* Cts */ || extension === ".d.ts" /* Dts */ || extension === ".d.mts" /* Dmts */ || extension === ".d.cts" /* Dcts */;
|
|
26566
|
-
case 5 /* TsOnly */:
|
|
26567
|
-
return extension === ".ts" /* Ts */ || extension === ".tsx" /* Tsx */ || extension === ".mts" /* Mts */ || extension === ".cts" /* Cts */;
|
|
26568
|
-
case 4 /* DtsOnly */:
|
|
26569
|
-
return extension === ".d.ts" /* Dts */ || extension === ".d.mts" /* Dmts */ || extension === ".d.cts" /* Dcts */;
|
|
26570
|
-
}
|
|
26478
|
+
return extensions & 2 /* JavaScript */ && (extension === ".js" /* Js */ || extension === ".jsx" /* Jsx */ || extension === ".mjs" /* Mjs */ || extension === ".cjs" /* Cjs */) || extensions & 1 /* TypeScript */ && (extension === ".ts" /* Ts */ || extension === ".tsx" /* Tsx */ || extension === ".mts" /* Mts */ || extension === ".cts" /* Cts */) || extensions & 4 /* Declaration */ && (extension === ".d.ts" /* Dts */ || extension === ".d.mts" /* Dmts */ || extension === ".d.cts" /* Dcts */) || extensions & 8 /* Json */ && extension === ".json" /* Json */ || false;
|
|
26571
26479
|
}
|
|
26572
26480
|
function parsePackageName(moduleName) {
|
|
26573
26481
|
let idx = moduleName.indexOf(directorySeparator);
|
|
@@ -26729,7 +26637,7 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
|
|
|
26729
26637
|
const combinedLookup = pattern ? target.replace(/\*/g, subpath) : target + subpath;
|
|
26730
26638
|
traceIfEnabled(state, Diagnostics.Using_0_subpath_1_with_target_2, "imports", key, combinedLookup);
|
|
26731
26639
|
traceIfEnabled(state, Diagnostics.Resolving_module_0_from_1, combinedLookup, scope.packageDirectory + "/");
|
|
26732
|
-
const result = nodeModuleNameResolverWorker(state.features, combinedLookup, scope.packageDirectory + "/", state.compilerOptions, state.host, cache,
|
|
26640
|
+
const result = nodeModuleNameResolverWorker(state.features, combinedLookup, scope.packageDirectory + "/", state.compilerOptions, state.host, cache, extensions, false, redirectedReference);
|
|
26733
26641
|
return toSearchResult(result.resolvedModule ? { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension, packageId: result.resolvedModule.packageId, originalPath: result.resolvedModule.originalPath } : void 0);
|
|
26734
26642
|
}
|
|
26735
26643
|
if (state.traceEnabled) {
|
|
@@ -26820,7 +26728,7 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
|
|
|
26820
26728
|
}
|
|
26821
26729
|
function tryLoadInputFileForPath(finalPath, entry, packagePath, isImports2) {
|
|
26822
26730
|
var _a2, _b, _c, _d;
|
|
26823
|
-
if (
|
|
26731
|
+
if (!state.isConfigLookup && (state.compilerOptions.declarationDir || state.compilerOptions.outDir) && finalPath.indexOf("/node_modules/") === -1 && (state.compilerOptions.configFile ? containsPath(scope.packageDirectory, toAbsolutePath(state.compilerOptions.configFile.fileName), !useCaseSensitiveFileNames()) : true)) {
|
|
26824
26732
|
const getCanonicalFileName = hostGetCanonicalFileName({ useCaseSensitiveFileNames });
|
|
26825
26733
|
const commonSourceDirGuesses = [];
|
|
26826
26734
|
if (state.compilerOptions.rootDir || state.compilerOptions.composite && state.compilerOptions.configFilePath) {
|
|
@@ -26857,10 +26765,9 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
|
|
|
26857
26765
|
if (fileExtensionIs(possibleInputBase, ext)) {
|
|
26858
26766
|
const inputExts = getPossibleOriginalInputExtensionForExtension(possibleInputBase);
|
|
26859
26767
|
for (const possibleExt of inputExts) {
|
|
26860
|
-
|
|
26861
|
-
if (extensions === 0 /* TypeScript */ && hasJSFileExtension(possibleInputWithInputExtension) || extensions === 1 /* JavaScript */ && hasTSFileExtension(possibleInputWithInputExtension)) {
|
|
26768
|
+
if (!extensionIsOk(extensions, possibleExt))
|
|
26862
26769
|
continue;
|
|
26863
|
-
|
|
26770
|
+
const possibleInputWithInputExtension = changeAnyExtension(possibleInputBase, possibleExt, ext, !useCaseSensitiveFileNames());
|
|
26864
26771
|
if (state.host.fileExists(possibleInputWithInputExtension)) {
|
|
26865
26772
|
return toSearchResult(withPackageId(scope, loadJSOrExactTSFileName(extensions, possibleInputWithInputExtension, false, state)));
|
|
26866
26773
|
}
|
|
@@ -26901,19 +26808,31 @@ function loadModuleFromNearestNodeModulesDirectory(extensions, moduleName, direc
|
|
|
26901
26808
|
return loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName, directory, state, false, cache, redirectedReference);
|
|
26902
26809
|
}
|
|
26903
26810
|
function loadModuleFromNearestNodeModulesDirectoryTypesScope(moduleName, directory, state) {
|
|
26904
|
-
return loadModuleFromNearestNodeModulesDirectoryWorker(4 /*
|
|
26811
|
+
return loadModuleFromNearestNodeModulesDirectoryWorker(4 /* Declaration */, moduleName, directory, state, true, void 0, void 0);
|
|
26905
26812
|
}
|
|
26906
26813
|
function loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName, directory, state, typesScopeOnly, cache, redirectedReference) {
|
|
26907
26814
|
const perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName, state.features === 0 ? void 0 : state.features & 32 /* EsmMode */ ? 99 /* ESNext */ : 1 /* CommonJS */, redirectedReference);
|
|
26908
|
-
|
|
26909
|
-
|
|
26910
|
-
|
|
26911
|
-
|
|
26912
|
-
|
|
26815
|
+
const priorityExtensions = extensions & (1 /* TypeScript */ | 4 /* Declaration */);
|
|
26816
|
+
const secondaryExtensions = extensions & ~(1 /* TypeScript */ | 4 /* Declaration */);
|
|
26817
|
+
if (priorityExtensions) {
|
|
26818
|
+
const result = lookup(priorityExtensions);
|
|
26819
|
+
if (result)
|
|
26820
|
+
return result;
|
|
26821
|
+
}
|
|
26822
|
+
if (secondaryExtensions && !typesScopeOnly) {
|
|
26823
|
+
return lookup(secondaryExtensions);
|
|
26824
|
+
}
|
|
26825
|
+
function lookup(extensions2) {
|
|
26826
|
+
return forEachAncestorDirectory(normalizeSlashes(directory), (ancestorDirectory) => {
|
|
26827
|
+
if (getBaseFileName(ancestorDirectory) !== "node_modules") {
|
|
26828
|
+
const resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, ancestorDirectory, state);
|
|
26829
|
+
if (resolutionFromCache) {
|
|
26830
|
+
return resolutionFromCache;
|
|
26831
|
+
}
|
|
26832
|
+
return toSearchResult(loadModuleFromImmediateNodeModulesDirectory(extensions2, moduleName, ancestorDirectory, state, typesScopeOnly, cache, redirectedReference));
|
|
26913
26833
|
}
|
|
26914
|
-
|
|
26915
|
-
|
|
26916
|
-
});
|
|
26834
|
+
});
|
|
26835
|
+
}
|
|
26917
26836
|
}
|
|
26918
26837
|
function loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, directory, state, typesScopeOnly, cache, redirectedReference) {
|
|
26919
26838
|
const nodeModulesFolder = combinePaths(directory, "node_modules");
|
|
@@ -26921,11 +26840,13 @@ function loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, dir
|
|
|
26921
26840
|
if (!nodeModulesFolderExists && state.traceEnabled) {
|
|
26922
26841
|
trace(state.host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesFolder);
|
|
26923
26842
|
}
|
|
26924
|
-
|
|
26925
|
-
|
|
26926
|
-
|
|
26843
|
+
if (!typesScopeOnly) {
|
|
26844
|
+
const packageResult = loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, state, cache, redirectedReference);
|
|
26845
|
+
if (packageResult) {
|
|
26846
|
+
return packageResult;
|
|
26847
|
+
}
|
|
26927
26848
|
}
|
|
26928
|
-
if (extensions
|
|
26849
|
+
if (extensions & 4 /* Declaration */) {
|
|
26929
26850
|
const nodeModulesAtTypes2 = combinePaths(nodeModulesFolder, "@types");
|
|
26930
26851
|
let nodeModulesAtTypesExists = nodeModulesFolderExists;
|
|
26931
26852
|
if (nodeModulesFolderExists && !directoryProbablyExists(nodeModulesAtTypes2, state.host)) {
|
|
@@ -26934,7 +26855,7 @@ function loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, dir
|
|
|
26934
26855
|
}
|
|
26935
26856
|
nodeModulesAtTypesExists = false;
|
|
26936
26857
|
}
|
|
26937
|
-
return loadModuleFromSpecificNodeModulesDirectory(4 /*
|
|
26858
|
+
return loadModuleFromSpecificNodeModulesDirectory(4 /* Declaration */, mangleScopedPackageNameWithTrace(moduleName, state), nodeModulesAtTypes2, nodeModulesAtTypesExists, state, cache, redirectedReference);
|
|
26938
26859
|
}
|
|
26939
26860
|
}
|
|
26940
26861
|
function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state, cache, redirectedReference) {
|
|
@@ -27062,9 +26983,10 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
|
|
|
27062
26983
|
features: 0 /* None */,
|
|
27063
26984
|
conditions: [],
|
|
27064
26985
|
requestContainingDirectory: containingDirectory,
|
|
27065
|
-
reportDiagnostic: (diag2) => void diagnostics.push(diag2)
|
|
26986
|
+
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
26987
|
+
isConfigLookup: false
|
|
27066
26988
|
};
|
|
27067
|
-
const resolved = tryResolve(
|
|
26989
|
+
const resolved = tryResolve(1 /* TypeScript */ | 4 /* Declaration */) || tryResolve(2 /* JavaScript */ | (compilerOptions.resolveJsonModule ? 8 /* Json */ : 0));
|
|
27068
26990
|
return createResolvedModuleWithFailedLookupLocations(
|
|
27069
26991
|
resolved && resolved.value,
|
|
27070
26992
|
false,
|
|
@@ -27091,7 +27013,7 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
|
|
|
27091
27013
|
if (resolved2) {
|
|
27092
27014
|
return resolved2;
|
|
27093
27015
|
}
|
|
27094
|
-
if (extensions
|
|
27016
|
+
if (extensions & (1 /* TypeScript */ | 4 /* Declaration */)) {
|
|
27095
27017
|
return loadModuleFromNearestNodeModulesDirectoryTypesScope(moduleName, containingDirectory, state);
|
|
27096
27018
|
}
|
|
27097
27019
|
} else {
|
|
@@ -29874,6 +29796,7 @@ var CheckMode = /* @__PURE__ */ ((CheckMode3) => {
|
|
|
29874
29796
|
return CheckMode3;
|
|
29875
29797
|
})(CheckMode || {});
|
|
29876
29798
|
var SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
|
|
29799
|
+
SignatureCheckMode3[SignatureCheckMode3["None"] = 0] = "None";
|
|
29877
29800
|
SignatureCheckMode3[SignatureCheckMode3["BivariantCallback"] = 1] = "BivariantCallback";
|
|
29878
29801
|
SignatureCheckMode3[SignatureCheckMode3["StrictCallback"] = 2] = "StrictCallback";
|
|
29879
29802
|
SignatureCheckMode3[SignatureCheckMode3["IgnoreReturnTypes"] = 4] = "IgnoreReturnTypes";
|
|
@@ -31137,10 +31060,10 @@ var visitEachChildTable = {
|
|
|
31137
31060
|
nodeVisitor(node.initializer, visitor, isExpression)
|
|
31138
31061
|
);
|
|
31139
31062
|
},
|
|
31140
|
-
[308 /* SourceFile */]: function visitEachChildOfSourceFile(node, visitor, context,
|
|
31063
|
+
[308 /* SourceFile */]: function visitEachChildOfSourceFile(node, visitor, context, _nodesVisitor, _nodeVisitor, _tokenVisitor) {
|
|
31141
31064
|
return context.factory.updateSourceFile(
|
|
31142
31065
|
node,
|
|
31143
|
-
visitLexicalEnvironment(node.statements, visitor, context
|
|
31066
|
+
visitLexicalEnvironment(node.statements, visitor, context)
|
|
31144
31067
|
);
|
|
31145
31068
|
},
|
|
31146
31069
|
[353 /* PartiallyEmittedExpression */]: function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
|
|
@@ -31795,7 +31718,7 @@ var BuilderState;
|
|
|
31795
31718
|
return oldState && !oldState.referencedMap === !newReferencedMap;
|
|
31796
31719
|
}
|
|
31797
31720
|
BuilderState2.canReuseOldState = canReuseOldState;
|
|
31798
|
-
function create(newProgram,
|
|
31721
|
+
function create(newProgram, oldState, disableUseFileVersionAsSignature) {
|
|
31799
31722
|
var _a2, _b, _c;
|
|
31800
31723
|
const fileInfos = /* @__PURE__ */ new Map();
|
|
31801
31724
|
const options = newProgram.getCompilerOptions();
|
|
@@ -31803,6 +31726,7 @@ var BuilderState;
|
|
|
31803
31726
|
const referencedMap = options.module !== 0 /* None */ && !isOutFile ? createManyToManyPathMap() : void 0;
|
|
31804
31727
|
const exportedModulesMap = referencedMap ? createManyToManyPathMap() : void 0;
|
|
31805
31728
|
const useOldState = canReuseOldState(referencedMap, oldState);
|
|
31729
|
+
const getCanonicalFileName = createGetCanonicalFileName(newProgram.useCaseSensitiveFileNames());
|
|
31806
31730
|
newProgram.getTypeChecker();
|
|
31807
31731
|
for (const sourceFile of newProgram.getSourceFiles()) {
|
|
31808
31732
|
const version2 = Debug.checkDefined(sourceFile.version, "Program intended to be used with Builder should have source files with versions set");
|
|
@@ -31841,30 +31765,29 @@ var BuilderState;
|
|
|
31841
31765
|
state.allFileNames = void 0;
|
|
31842
31766
|
}
|
|
31843
31767
|
BuilderState2.releaseCache = releaseCache;
|
|
31844
|
-
function getFilesAffectedBy(state, programOfThisState, path2, cancellationToken,
|
|
31768
|
+
function getFilesAffectedBy(state, programOfThisState, path2, cancellationToken, host) {
|
|
31845
31769
|
var _a2, _b;
|
|
31846
31770
|
const result = getFilesAffectedByWithOldState(
|
|
31847
31771
|
state,
|
|
31848
31772
|
programOfThisState,
|
|
31849
31773
|
path2,
|
|
31850
31774
|
cancellationToken,
|
|
31851
|
-
|
|
31852
|
-
getCanonicalFileName
|
|
31775
|
+
host
|
|
31853
31776
|
);
|
|
31854
31777
|
(_a2 = state.oldSignatures) == null ? void 0 : _a2.clear();
|
|
31855
31778
|
(_b = state.oldExportedModulesMap) == null ? void 0 : _b.clear();
|
|
31856
31779
|
return result;
|
|
31857
31780
|
}
|
|
31858
31781
|
BuilderState2.getFilesAffectedBy = getFilesAffectedBy;
|
|
31859
|
-
function getFilesAffectedByWithOldState(state, programOfThisState, path2, cancellationToken,
|
|
31782
|
+
function getFilesAffectedByWithOldState(state, programOfThisState, path2, cancellationToken, host) {
|
|
31860
31783
|
const sourceFile = programOfThisState.getSourceFileByPath(path2);
|
|
31861
31784
|
if (!sourceFile) {
|
|
31862
31785
|
return emptyArray;
|
|
31863
31786
|
}
|
|
31864
|
-
if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken,
|
|
31787
|
+
if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, host)) {
|
|
31865
31788
|
return [sourceFile];
|
|
31866
31789
|
}
|
|
31867
|
-
return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken,
|
|
31790
|
+
return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, host);
|
|
31868
31791
|
}
|
|
31869
31792
|
BuilderState2.getFilesAffectedByWithOldState = getFilesAffectedByWithOldState;
|
|
31870
31793
|
function updateSignatureOfFile(state, signature, path2) {
|
|
@@ -31872,7 +31795,7 @@ var BuilderState;
|
|
|
31872
31795
|
(state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = /* @__PURE__ */ new Set())).add(path2);
|
|
31873
31796
|
}
|
|
31874
31797
|
BuilderState2.updateSignatureOfFile = updateSignatureOfFile;
|
|
31875
|
-
function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken,
|
|
31798
|
+
function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, host, useFileVersionAsSignature = state.useFileVersionAsSignature) {
|
|
31876
31799
|
var _a2;
|
|
31877
31800
|
if ((_a2 = state.hasCalledUpdateShapeSignature) == null ? void 0 : _a2.has(sourceFile.resolvedPath))
|
|
31878
31801
|
return false;
|
|
@@ -31885,10 +31808,10 @@ var BuilderState;
|
|
|
31885
31808
|
(fileName, text, _writeByteOrderMark, _onError, sourceFiles, data) => {
|
|
31886
31809
|
Debug.assert(isDeclarationFileName(fileName), `File extension for signature expected to be dts: Got:: ${fileName}`);
|
|
31887
31810
|
latestSignature = computeSignatureWithDiagnostics(
|
|
31811
|
+
programOfThisState,
|
|
31888
31812
|
sourceFile,
|
|
31889
31813
|
text,
|
|
31890
|
-
|
|
31891
|
-
getCanonicalFileName,
|
|
31814
|
+
host,
|
|
31892
31815
|
data
|
|
31893
31816
|
);
|
|
31894
31817
|
if (latestSignature !== prevSignature) {
|
|
@@ -32027,7 +31950,7 @@ var BuilderState;
|
|
|
32027
31950
|
}
|
|
32028
31951
|
return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
|
|
32029
31952
|
}
|
|
32030
|
-
function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken,
|
|
31953
|
+
function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, host) {
|
|
32031
31954
|
if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
|
|
32032
31955
|
return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
|
|
32033
31956
|
}
|
|
@@ -32043,7 +31966,7 @@ var BuilderState;
|
|
|
32043
31966
|
if (!seenFileNamesMap.has(currentPath)) {
|
|
32044
31967
|
const currentSourceFile = programOfThisState.getSourceFileByPath(currentPath);
|
|
32045
31968
|
seenFileNamesMap.set(currentPath, currentSourceFile);
|
|
32046
|
-
if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken,
|
|
31969
|
+
if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, host)) {
|
|
32047
31970
|
queue.push(...getReferencedByPaths(state, currentSourceFile.resolvedPath));
|
|
32048
31971
|
}
|
|
32049
31972
|
}
|
|
@@ -32056,8 +31979,9 @@ var BuilderState;
|
|
|
32056
31979
|
function getTextHandlingSourceMapForSignature(text, data) {
|
|
32057
31980
|
return (data == null ? void 0 : data.sourceMapUrlPos) !== void 0 ? text.substring(0, data.sourceMapUrlPos) : text;
|
|
32058
31981
|
}
|
|
32059
|
-
function computeSignatureWithDiagnostics(sourceFile, text,
|
|
32060
|
-
var _a2;
|
|
31982
|
+
function computeSignatureWithDiagnostics(program, sourceFile, text, host, data) {
|
|
31983
|
+
var _a2, _b;
|
|
31984
|
+
let getCanonicalFileName;
|
|
32061
31985
|
text = getTextHandlingSourceMapForSignature(text, data);
|
|
32062
31986
|
let sourceFileDirectory;
|
|
32063
31987
|
if ((_a2 = data == null ? void 0 : data.diagnostics) == null ? void 0 : _a2.length) {
|
|
@@ -32065,7 +31989,7 @@ function computeSignatureWithDiagnostics(sourceFile, text, computeHash, getCanon
|
|
|
32065
31989
|
(diagnostic) => `${locationInfo(diagnostic)}${DiagnosticCategory[diagnostic.category]}${diagnostic.code}: ${flattenDiagnosticMessageText2(diagnostic.messageText)}`
|
|
32066
31990
|
).join("\n");
|
|
32067
31991
|
}
|
|
32068
|
-
return (
|
|
31992
|
+
return ((_b = host.createHash) != null ? _b : generateDjb2Hash)(text);
|
|
32069
31993
|
function flattenDiagnosticMessageText2(diagnostic) {
|
|
32070
31994
|
return isString(diagnostic) ? diagnostic : diagnostic === void 0 ? "" : !diagnostic.next ? diagnostic.messageText : diagnostic.messageText + diagnostic.next.map(flattenDiagnosticMessageText2).join("\n");
|
|
32071
31995
|
}
|
|
@@ -32074,7 +31998,11 @@ function computeSignatureWithDiagnostics(sourceFile, text, computeHash, getCanon
|
|
|
32074
31998
|
return `(${diagnostic.start},${diagnostic.length})`;
|
|
32075
31999
|
if (sourceFileDirectory === void 0)
|
|
32076
32000
|
sourceFileDirectory = getDirectoryPath(sourceFile.resolvedPath);
|
|
32077
|
-
return `${ensurePathIsNonModuleName(getRelativePathFromDirectory(
|
|
32001
|
+
return `${ensurePathIsNonModuleName(getRelativePathFromDirectory(
|
|
32002
|
+
sourceFileDirectory,
|
|
32003
|
+
diagnostic.file.resolvedPath,
|
|
32004
|
+
getCanonicalFileName != null ? getCanonicalFileName : getCanonicalFileName = createGetCanonicalFileName(program.useCaseSensitiveFileNames())
|
|
32005
|
+
))}(${diagnostic.start},${diagnostic.length})`;
|
|
32078
32006
|
}
|
|
32079
32007
|
}
|
|
32080
32008
|
|