typescript 5.0.0-dev.20221115 → 5.0.0-dev.20221117
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.es5.d.ts +1 -1
- package/lib/tsc.js +317 -377
- package/lib/tsserver.js +748 -750
- package/lib/tsserverlibrary.d.ts +2 -4
- package/lib/tsserverlibrary.js +760 -752
- package/lib/typescript.d.ts +2 -4
- package/lib/typescript.js +756 -749
- package/lib/typingsInstaller.js +149 -221
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -23,7 +23,7 @@ var __export = (target, all) => {
|
|
|
23
23
|
|
|
24
24
|
// src/compiler/corePublic.ts
|
|
25
25
|
var versionMajorMinor = "5.0";
|
|
26
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
26
|
+
var version = `${versionMajorMinor}.0-dev.20221117`;
|
|
27
27
|
|
|
28
28
|
// src/compiler/core.ts
|
|
29
29
|
var emptyArray = [];
|
|
@@ -1294,15 +1294,9 @@ function isNodeLikeSystem() {
|
|
|
1294
1294
|
// src/compiler/debug.ts
|
|
1295
1295
|
var Debug;
|
|
1296
1296
|
((Debug2) => {
|
|
1297
|
-
let typeScriptVersion2;
|
|
1298
1297
|
let currentAssertionLevel = 0 /* None */;
|
|
1299
1298
|
Debug2.currentLogLevel = 2 /* Warning */;
|
|
1300
1299
|
Debug2.isDebugging = false;
|
|
1301
|
-
Debug2.enableDeprecationWarnings = true;
|
|
1302
|
-
function getTypeScriptVersion() {
|
|
1303
|
-
return typeScriptVersion2 != null ? typeScriptVersion2 : typeScriptVersion2 = new Version(version);
|
|
1304
|
-
}
|
|
1305
|
-
Debug2.getTypeScriptVersion = getTypeScriptVersion;
|
|
1306
1300
|
function shouldLog(level) {
|
|
1307
1301
|
return Debug2.currentLogLevel <= level;
|
|
1308
1302
|
}
|
|
@@ -1818,52 +1812,6 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
|
|
|
1818
1812
|
isDebugInfoEnabled = true;
|
|
1819
1813
|
}
|
|
1820
1814
|
Debug2.enableDebugInfo = enableDebugInfo;
|
|
1821
|
-
function formatDeprecationMessage(name, error, errorAfter, since, message) {
|
|
1822
|
-
let deprecationMessage = error ? "DeprecationError: " : "DeprecationWarning: ";
|
|
1823
|
-
deprecationMessage += `'${name}' `;
|
|
1824
|
-
deprecationMessage += since ? `has been deprecated since v${since}` : "is deprecated";
|
|
1825
|
-
deprecationMessage += error ? " and can no longer be used." : errorAfter ? ` and will no longer be usable after v${errorAfter}.` : ".";
|
|
1826
|
-
deprecationMessage += message ? ` ${formatStringFromArgs(message, [name], 0)}` : "";
|
|
1827
|
-
return deprecationMessage;
|
|
1828
|
-
}
|
|
1829
|
-
function createErrorDeprecation(name, errorAfter, since, message) {
|
|
1830
|
-
const deprecationMessage = formatDeprecationMessage(name, true, errorAfter, since, message);
|
|
1831
|
-
return () => {
|
|
1832
|
-
throw new TypeError(deprecationMessage);
|
|
1833
|
-
};
|
|
1834
|
-
}
|
|
1835
|
-
function createWarningDeprecation(name, errorAfter, since, message) {
|
|
1836
|
-
let hasWrittenDeprecation = false;
|
|
1837
|
-
return () => {
|
|
1838
|
-
if (Debug2.enableDeprecationWarnings && !hasWrittenDeprecation) {
|
|
1839
|
-
log.warn(formatDeprecationMessage(name, false, errorAfter, since, message));
|
|
1840
|
-
hasWrittenDeprecation = true;
|
|
1841
|
-
}
|
|
1842
|
-
};
|
|
1843
|
-
}
|
|
1844
|
-
function createDeprecation(name, options = {}) {
|
|
1845
|
-
var _a2, _b;
|
|
1846
|
-
const version2 = typeof options.typeScriptVersion === "string" ? new Version(options.typeScriptVersion) : (_a2 = options.typeScriptVersion) != null ? _a2 : getTypeScriptVersion();
|
|
1847
|
-
const errorAfter = typeof options.errorAfter === "string" ? new Version(options.errorAfter) : options.errorAfter;
|
|
1848
|
-
const warnAfter = typeof options.warnAfter === "string" ? new Version(options.warnAfter) : options.warnAfter;
|
|
1849
|
-
const since = typeof options.since === "string" ? new Version(options.since) : (_b = options.since) != null ? _b : warnAfter;
|
|
1850
|
-
const error = options.error || errorAfter && version2.compareTo(errorAfter) <= 0;
|
|
1851
|
-
const warn = !warnAfter || version2.compareTo(warnAfter) >= 0;
|
|
1852
|
-
return error ? createErrorDeprecation(name, errorAfter, since, options.message) : warn ? createWarningDeprecation(name, errorAfter, since, options.message) : noop;
|
|
1853
|
-
}
|
|
1854
|
-
Debug2.createDeprecation = createDeprecation;
|
|
1855
|
-
function wrapFunction(deprecation, func) {
|
|
1856
|
-
return function() {
|
|
1857
|
-
deprecation();
|
|
1858
|
-
return func.apply(this, arguments);
|
|
1859
|
-
};
|
|
1860
|
-
}
|
|
1861
|
-
function deprecate(func, options) {
|
|
1862
|
-
var _a2;
|
|
1863
|
-
const deprecation = createDeprecation((_a2 = options == null ? void 0 : options.name) != null ? _a2 : getFunctionName(func), options);
|
|
1864
|
-
return wrapFunction(deprecation, func);
|
|
1865
|
-
}
|
|
1866
|
-
Debug2.deprecate = deprecate;
|
|
1867
1815
|
function formatVariance(varianceFlags) {
|
|
1868
1816
|
const variance = varianceFlags & 7 /* VarianceMask */;
|
|
1869
1817
|
let result = variance === 0 /* Invariant */ ? "in out" : variance === 3 /* Bivariant */ ? "[bivariant]" : variance === 2 /* Contravariant */ ? "in" : variance === 1 /* Covariant */ ? "out" : variance === 4 /* Independent */ ? "[independent]" : "";
|
|
@@ -3712,6 +3660,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
3712
3660
|
return TypeFlags2;
|
|
3713
3661
|
})(TypeFlags || {});
|
|
3714
3662
|
var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
|
|
3663
|
+
ObjectFlags3[ObjectFlags3["None"] = 0] = "None";
|
|
3715
3664
|
ObjectFlags3[ObjectFlags3["Class"] = 1] = "Class";
|
|
3716
3665
|
ObjectFlags3[ObjectFlags3["Interface"] = 2] = "Interface";
|
|
3717
3666
|
ObjectFlags3[ObjectFlags3["Reference"] = 4] = "Reference";
|
|
@@ -6776,10 +6725,10 @@ var Diagnostics = {
|
|
|
6776
6725
|
Module_name_0_matched_pattern_1: diag(6092, 3 /* Message */, "Module_name_0_matched_pattern_1_6092", "Module name '{0}', matched pattern '{1}'."),
|
|
6777
6726
|
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}'."),
|
|
6778
6727
|
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}'."),
|
|
6779
|
-
|
|
6728
|
+
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}."),
|
|
6780
6729
|
File_0_does_not_exist: diag(6096, 3 /* Message */, "File_0_does_not_exist_6096", "File '{0}' does not exist."),
|
|
6781
6730
|
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."),
|
|
6782
|
-
|
|
6731
|
+
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}."),
|
|
6783
6732
|
Found_package_json_at_0: diag(6099, 3 /* Message */, "Found_package_json_at_0_6099", "Found 'package.json' at '{0}'."),
|
|
6784
6733
|
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."),
|
|
6785
6734
|
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}'."),
|
|
@@ -15134,6 +15083,7 @@ var supportedJSExtensionsFlat = flatten(supportedJSExtensions);
|
|
|
15134
15083
|
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 */]];
|
|
15135
15084
|
var allSupportedExtensionsWithJson = [...allSupportedExtensions, [".json" /* Json */]];
|
|
15136
15085
|
var supportedDeclarationExtensions = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */];
|
|
15086
|
+
var supportedTSImplementationExtensions = [".ts" /* Ts */, ".cts" /* Cts */, ".mts" /* Mts */, ".tsx" /* Tsx */];
|
|
15137
15087
|
function getSupportedExtensions(options, extraFileExtensions) {
|
|
15138
15088
|
const needJsExtensions = options && getAllowJSCompilerOption(options);
|
|
15139
15089
|
if (!extraFileExtensions || extraFileExtensions.length === 0) {
|
|
@@ -21121,7 +21071,7 @@ var asyncDelegator = {
|
|
|
21121
21071
|
var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {
|
|
21122
21072
|
var i, p;
|
|
21123
21073
|
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
21124
|
-
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done:
|
|
21074
|
+
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
|
|
21125
21075
|
};`
|
|
21126
21076
|
};
|
|
21127
21077
|
var asyncValues = {
|
|
@@ -32722,15 +32672,18 @@ function removeIgnoredPackageId(r) {
|
|
|
32722
32672
|
return { path: r.path, ext: r.extension };
|
|
32723
32673
|
}
|
|
32724
32674
|
}
|
|
32725
|
-
|
|
32726
|
-
|
|
32727
|
-
|
|
32728
|
-
|
|
32729
|
-
|
|
32730
|
-
|
|
32731
|
-
|
|
32732
|
-
|
|
32733
|
-
|
|
32675
|
+
function formatExtensions(extensions) {
|
|
32676
|
+
const result = [];
|
|
32677
|
+
if (extensions & 1 /* TypeScript */)
|
|
32678
|
+
result.push("TypeScript");
|
|
32679
|
+
if (extensions & 2 /* JavaScript */)
|
|
32680
|
+
result.push("JavaScript");
|
|
32681
|
+
if (extensions & 4 /* Declaration */)
|
|
32682
|
+
result.push("Declaration");
|
|
32683
|
+
if (extensions & 8 /* Json */)
|
|
32684
|
+
result.push("JSON");
|
|
32685
|
+
return result.join(", ");
|
|
32686
|
+
}
|
|
32734
32687
|
function resolvedTypeScriptOnly(resolved) {
|
|
32735
32688
|
if (!resolved) {
|
|
32736
32689
|
return void 0;
|
|
@@ -32934,7 +32887,8 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
|
|
|
32934
32887
|
features,
|
|
32935
32888
|
conditions,
|
|
32936
32889
|
requestContainingDirectory: containingDirectory,
|
|
32937
|
-
reportDiagnostic: (diag2) => void diagnostics.push(diag2)
|
|
32890
|
+
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
32891
|
+
isConfigLookup: false
|
|
32938
32892
|
};
|
|
32939
32893
|
let resolved = primaryLookup();
|
|
32940
32894
|
let primary = true;
|
|
@@ -32984,7 +32938,7 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
|
|
|
32984
32938
|
}
|
|
32985
32939
|
return resolvedTypeScriptOnly(
|
|
32986
32940
|
loadNodeModuleFromDirectory(
|
|
32987
|
-
4 /*
|
|
32941
|
+
4 /* Declaration */,
|
|
32988
32942
|
candidate,
|
|
32989
32943
|
!directoryExists,
|
|
32990
32944
|
moduleResolutionState
|
|
@@ -33005,11 +32959,11 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
|
|
|
33005
32959
|
}
|
|
33006
32960
|
let result2;
|
|
33007
32961
|
if (!isExternalModuleNameRelative(typeReferenceDirectiveName)) {
|
|
33008
|
-
const searchResult = loadModuleFromNearestNodeModulesDirectory(4 /*
|
|
32962
|
+
const searchResult = loadModuleFromNearestNodeModulesDirectory(4 /* Declaration */, typeReferenceDirectiveName, initialLocationForSecondaryLookup, moduleResolutionState, void 0, void 0);
|
|
33009
32963
|
result2 = searchResult && searchResult.value;
|
|
33010
32964
|
} else {
|
|
33011
32965
|
const { path: candidate } = normalizePathForCJSResolution(initialLocationForSecondaryLookup, typeReferenceDirectiveName);
|
|
33012
|
-
result2 = nodeLoadModuleByRelativeName(4 /*
|
|
32966
|
+
result2 = nodeLoadModuleByRelativeName(4 /* Declaration */, candidate, false, moduleResolutionState, true);
|
|
33013
32967
|
}
|
|
33014
32968
|
return resolvedTypeScriptOnly(result2);
|
|
33015
32969
|
} else {
|
|
@@ -33525,38 +33479,42 @@ function nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions,
|
|
|
33525
33479
|
resolutionMode
|
|
33526
33480
|
);
|
|
33527
33481
|
}
|
|
33528
|
-
var jsOnlyExtensions = [1 /* JavaScript */];
|
|
33529
|
-
var tsExtensions = [0 /* TypeScript */, 1 /* JavaScript */];
|
|
33530
|
-
var tsPlusJsonExtensions = [...tsExtensions, 2 /* Json */];
|
|
33531
|
-
var tsconfigExtensions = [3 /* TSConfig */];
|
|
33532
33482
|
function nodeNextModuleNameResolverWorker(features, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
33533
33483
|
const containingDirectory = getDirectoryPath(containingFile);
|
|
33534
33484
|
const esmMode = resolutionMode === 99 /* ESNext */ ? 32 /* EsmMode */ : 0;
|
|
33535
|
-
let extensions = compilerOptions.noDtsResolution ?
|
|
33485
|
+
let extensions = compilerOptions.noDtsResolution ? 3 /* ImplementationFiles */ : 1 /* TypeScript */ | 2 /* JavaScript */ | 4 /* Declaration */;
|
|
33536
33486
|
if (compilerOptions.resolveJsonModule) {
|
|
33537
|
-
extensions
|
|
33487
|
+
extensions |= 8 /* Json */;
|
|
33538
33488
|
}
|
|
33539
|
-
return nodeModuleNameResolverWorker(features | esmMode, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference);
|
|
33489
|
+
return nodeModuleNameResolverWorker(features | esmMode, moduleName, containingDirectory, compilerOptions, host, cache, extensions, false, redirectedReference);
|
|
33540
33490
|
}
|
|
33541
33491
|
function tryResolveJSModuleWorker(moduleName, initialDir, host) {
|
|
33542
|
-
return nodeModuleNameResolverWorker(
|
|
33492
|
+
return nodeModuleNameResolverWorker(
|
|
33493
|
+
0 /* None */,
|
|
33494
|
+
moduleName,
|
|
33495
|
+
initialDir,
|
|
33496
|
+
{ moduleResolution: 2 /* NodeJs */, allowJs: true },
|
|
33497
|
+
host,
|
|
33498
|
+
void 0,
|
|
33499
|
+
2 /* JavaScript */,
|
|
33500
|
+
false,
|
|
33501
|
+
void 0
|
|
33502
|
+
);
|
|
33543
33503
|
}
|
|
33544
|
-
function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference,
|
|
33504
|
+
function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, isConfigLookup) {
|
|
33545
33505
|
let extensions;
|
|
33546
|
-
if (
|
|
33547
|
-
extensions =
|
|
33506
|
+
if (isConfigLookup) {
|
|
33507
|
+
extensions = 8 /* Json */;
|
|
33548
33508
|
} else if (compilerOptions.noDtsResolution) {
|
|
33549
|
-
extensions =
|
|
33550
|
-
if (compilerOptions.allowJs)
|
|
33551
|
-
extensions.push(1 /* JavaScript */);
|
|
33509
|
+
extensions = 3 /* ImplementationFiles */;
|
|
33552
33510
|
if (compilerOptions.resolveJsonModule)
|
|
33553
|
-
extensions
|
|
33511
|
+
extensions |= 8 /* Json */;
|
|
33554
33512
|
} else {
|
|
33555
|
-
extensions = compilerOptions.resolveJsonModule ?
|
|
33513
|
+
extensions = compilerOptions.resolveJsonModule ? 1 /* TypeScript */ | 2 /* JavaScript */ | 4 /* Declaration */ | 8 /* Json */ : 1 /* TypeScript */ | 2 /* JavaScript */ | 4 /* Declaration */;
|
|
33556
33514
|
}
|
|
33557
|
-
return nodeModuleNameResolverWorker(0 /* None */, moduleName, getDirectoryPath(containingFile), compilerOptions, host, cache, extensions, redirectedReference);
|
|
33515
|
+
return nodeModuleNameResolverWorker(0 /* None */, moduleName, getDirectoryPath(containingFile), compilerOptions, host, cache, extensions, !!isConfigLookup, redirectedReference);
|
|
33558
33516
|
}
|
|
33559
|
-
function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference) {
|
|
33517
|
+
function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, isConfigLookup, redirectedReference) {
|
|
33560
33518
|
var _a2, _b;
|
|
33561
33519
|
const traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
33562
33520
|
const failedLookupLocations = [];
|
|
@@ -33576,12 +33534,20 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
|
|
|
33576
33534
|
features,
|
|
33577
33535
|
conditions,
|
|
33578
33536
|
requestContainingDirectory: containingDirectory,
|
|
33579
|
-
reportDiagnostic: (diag2) => void diagnostics.push(diag2)
|
|
33537
|
+
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
33538
|
+
isConfigLookup
|
|
33580
33539
|
};
|
|
33581
33540
|
if (traceEnabled && getEmitModuleResolutionKind(compilerOptions) >= 3 /* Node16 */ && getEmitModuleResolutionKind(compilerOptions) <= 99 /* NodeNext */) {
|
|
33582
33541
|
trace(host, Diagnostics.Resolving_in_0_mode_with_conditions_1, features & 32 /* EsmMode */ ? "ESM" : "CJS", conditions.map((c) => `'${c}'`).join(", "));
|
|
33583
33542
|
}
|
|
33584
|
-
|
|
33543
|
+
let result;
|
|
33544
|
+
if (getEmitModuleResolutionKind(compilerOptions) === 2 /* NodeJs */) {
|
|
33545
|
+
const priorityExtensions = extensions & (1 /* TypeScript */ | 4 /* Declaration */);
|
|
33546
|
+
const secondaryExtensions = extensions & ~(1 /* TypeScript */ | 4 /* Declaration */);
|
|
33547
|
+
result = priorityExtensions && tryResolve(priorityExtensions) || secondaryExtensions && tryResolve(secondaryExtensions) || void 0;
|
|
33548
|
+
} else {
|
|
33549
|
+
result = tryResolve(extensions);
|
|
33550
|
+
}
|
|
33585
33551
|
return createResolvedModuleWithFailedLookupLocations(
|
|
33586
33552
|
(_a2 = result == null ? void 0 : result.value) == null ? void 0 : _a2.resolved,
|
|
33587
33553
|
(_b = result == null ? void 0 : result.value) == null ? void 0 : _b.isExternalLibraryImport,
|
|
@@ -33606,7 +33572,7 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
|
|
|
33606
33572
|
}
|
|
33607
33573
|
if (!resolved2) {
|
|
33608
33574
|
if (traceEnabled) {
|
|
33609
|
-
trace(host, Diagnostics.
|
|
33575
|
+
trace(host, Diagnostics.Loading_module_0_from_node_modules_folder_target_file_types_Colon_1, moduleName, formatExtensions(extensions2));
|
|
33610
33576
|
}
|
|
33611
33577
|
resolved2 = loadModuleFromNearestNodeModulesDirectory(extensions2, moduleName, containingDirectory, state, cache, redirectedReference);
|
|
33612
33578
|
}
|
|
@@ -33647,7 +33613,7 @@ function realPath(path, host, traceEnabled) {
|
|
|
33647
33613
|
}
|
|
33648
33614
|
function nodeLoadModuleByRelativeName(extensions, candidate, onlyRecordFailures, state, considerPackageJson) {
|
|
33649
33615
|
if (state.traceEnabled) {
|
|
33650
|
-
trace(state.host, Diagnostics.
|
|
33616
|
+
trace(state.host, Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_types_Colon_1, candidate, formatExtensions(extensions));
|
|
33651
33617
|
}
|
|
33652
33618
|
if (!hasTrailingDirectorySeparator(candidate)) {
|
|
33653
33619
|
if (!onlyRecordFailures) {
|
|
@@ -33705,10 +33671,9 @@ function loadModuleFromFileNoPackageId(extensions, candidate, onlyRecordFailures
|
|
|
33705
33671
|
return noPackageId(loadModuleFromFile(extensions, candidate, onlyRecordFailures, state));
|
|
33706
33672
|
}
|
|
33707
33673
|
function loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) {
|
|
33708
|
-
|
|
33709
|
-
|
|
33710
|
-
|
|
33711
|
-
return extensionLess === void 0 && extensions === 2 /* Json */ ? void 0 : tryAddingExtensions(extensionLess || candidate, extensions, extension, onlyRecordFailures, state);
|
|
33674
|
+
const resolvedByReplacingExtension = loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
|
|
33675
|
+
if (resolvedByReplacingExtension) {
|
|
33676
|
+
return resolvedByReplacingExtension;
|
|
33712
33677
|
}
|
|
33713
33678
|
if (!(state.features & 32 /* EsmMode */)) {
|
|
33714
33679
|
const resolvedByAddingExtension = tryAddingExtensions(candidate, extensions, "", onlyRecordFailures, state);
|
|
@@ -33716,10 +33681,9 @@ function loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) {
|
|
|
33716
33681
|
return resolvedByAddingExtension;
|
|
33717
33682
|
}
|
|
33718
33683
|
}
|
|
33719
|
-
return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
|
|
33720
33684
|
}
|
|
33721
33685
|
function loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state) {
|
|
33722
|
-
if (hasJSFileExtension(candidate) || fileExtensionIs(candidate, ".json" /* Json */)
|
|
33686
|
+
if (hasJSFileExtension(candidate) || extensions & 8 /* Json */ && fileExtensionIs(candidate, ".json" /* Json */)) {
|
|
33723
33687
|
const extensionless = removeFileExtension(candidate);
|
|
33724
33688
|
const extension = candidate.substring(extensionless.length);
|
|
33725
33689
|
if (state.traceEnabled) {
|
|
@@ -33729,7 +33693,7 @@ function loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecor
|
|
|
33729
33693
|
}
|
|
33730
33694
|
}
|
|
33731
33695
|
function loadJSOrExactTSFileName(extensions, candidate, onlyRecordFailures, state) {
|
|
33732
|
-
if (
|
|
33696
|
+
if (extensions & 1 /* TypeScript */ && fileExtensionIsOneOf(candidate, supportedTSImplementationExtensions) || extensions & 4 /* Declaration */ && fileExtensionIsOneOf(candidate, supportedDeclarationExtensions)) {
|
|
33733
33697
|
const result = tryFile(candidate, onlyRecordFailures, state);
|
|
33734
33698
|
return result !== void 0 ? { path: candidate, ext: tryExtractTSExtension(candidate) } : void 0;
|
|
33735
33699
|
}
|
|
@@ -33742,59 +33706,32 @@ function tryAddingExtensions(candidate, extensions, originalExtension, onlyRecor
|
|
|
33742
33706
|
onlyRecordFailures = !directoryProbablyExists(directory, state.host);
|
|
33743
33707
|
}
|
|
33744
33708
|
}
|
|
33745
|
-
switch (
|
|
33746
|
-
case
|
|
33747
|
-
|
|
33748
|
-
|
|
33749
|
-
|
|
33750
|
-
|
|
33751
|
-
|
|
33752
|
-
|
|
33753
|
-
|
|
33754
|
-
|
|
33755
|
-
|
|
33756
|
-
|
|
33757
|
-
|
|
33758
|
-
|
|
33759
|
-
|
|
33760
|
-
return
|
|
33761
|
-
}
|
|
33762
|
-
case 0 /* TypeScript */:
|
|
33763
|
-
case 5 /* TsOnly */:
|
|
33764
|
-
const useDts = extensions === 0 /* TypeScript */;
|
|
33765
|
-
switch (originalExtension) {
|
|
33766
|
-
case ".mjs" /* Mjs */:
|
|
33767
|
-
case ".mts" /* Mts */:
|
|
33768
|
-
case ".d.mts" /* Dmts */:
|
|
33769
|
-
return tryExtension(".mts" /* Mts */) || (useDts ? tryExtension(".d.mts" /* Dmts */) : void 0);
|
|
33770
|
-
case ".cjs" /* Cjs */:
|
|
33771
|
-
case ".cts" /* Cts */:
|
|
33772
|
-
case ".d.cts" /* Dcts */:
|
|
33773
|
-
return tryExtension(".cts" /* Cts */) || (useDts ? tryExtension(".d.cts" /* Dcts */) : void 0);
|
|
33774
|
-
case ".json" /* Json */:
|
|
33775
|
-
candidate += ".json" /* Json */;
|
|
33776
|
-
return useDts ? tryExtension(".d.ts" /* Dts */) : void 0;
|
|
33777
|
-
default:
|
|
33778
|
-
return tryExtension(".ts" /* Ts */) || tryExtension(".tsx" /* Tsx */) || (useDts ? tryExtension(".d.ts" /* Dts */) : void 0);
|
|
33779
|
-
}
|
|
33780
|
-
case 1 /* JavaScript */:
|
|
33781
|
-
switch (originalExtension) {
|
|
33782
|
-
case ".mjs" /* Mjs */:
|
|
33783
|
-
case ".mts" /* Mts */:
|
|
33784
|
-
case ".d.mts" /* Dmts */:
|
|
33785
|
-
return tryExtension(".mjs" /* Mjs */);
|
|
33786
|
-
case ".cjs" /* Cjs */:
|
|
33787
|
-
case ".cts" /* Cts */:
|
|
33788
|
-
case ".d.cts" /* Dcts */:
|
|
33789
|
-
return tryExtension(".cjs" /* Cjs */);
|
|
33790
|
-
case ".json" /* Json */:
|
|
33791
|
-
return tryExtension(".json" /* Json */);
|
|
33792
|
-
default:
|
|
33793
|
-
return tryExtension(".js" /* Js */) || tryExtension(".jsx" /* Jsx */);
|
|
33709
|
+
switch (originalExtension) {
|
|
33710
|
+
case ".mjs" /* Mjs */:
|
|
33711
|
+
case ".mts" /* Mts */:
|
|
33712
|
+
case ".d.mts" /* Dmts */:
|
|
33713
|
+
return extensions & 1 /* TypeScript */ && tryExtension(".mts" /* Mts */) || extensions & 4 /* Declaration */ && tryExtension(".d.mts" /* Dmts */) || extensions & 2 /* JavaScript */ && tryExtension(".mjs" /* Mjs */) || void 0;
|
|
33714
|
+
case ".cjs" /* Cjs */:
|
|
33715
|
+
case ".cts" /* Cts */:
|
|
33716
|
+
case ".d.cts" /* Dcts */:
|
|
33717
|
+
return extensions & 1 /* TypeScript */ && tryExtension(".cts" /* Cts */) || extensions & 4 /* Declaration */ && tryExtension(".d.cts" /* Dcts */) || extensions & 2 /* JavaScript */ && tryExtension(".cjs" /* Cjs */) || void 0;
|
|
33718
|
+
case ".json" /* Json */:
|
|
33719
|
+
const originalCandidate = candidate;
|
|
33720
|
+
if (extensions & 4 /* Declaration */) {
|
|
33721
|
+
candidate += ".json" /* Json */;
|
|
33722
|
+
const result = tryExtension(".d.ts" /* Dts */);
|
|
33723
|
+
if (result)
|
|
33724
|
+
return result;
|
|
33794
33725
|
}
|
|
33795
|
-
|
|
33796
|
-
|
|
33797
|
-
|
|
33726
|
+
if (extensions & 8 /* Json */) {
|
|
33727
|
+
candidate = originalCandidate;
|
|
33728
|
+
const result = tryExtension(".json" /* Json */);
|
|
33729
|
+
if (result)
|
|
33730
|
+
return result;
|
|
33731
|
+
}
|
|
33732
|
+
return void 0;
|
|
33733
|
+
default:
|
|
33734
|
+
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;
|
|
33798
33735
|
}
|
|
33799
33736
|
function tryExtension(ext) {
|
|
33800
33737
|
const path = tryFile(candidate + ext, onlyRecordFailures, state);
|
|
@@ -33843,7 +33780,8 @@ function getTemporaryModuleResolutionState(packageJsonInfoCache, host, options)
|
|
|
33843
33780
|
features: 0 /* None */,
|
|
33844
33781
|
conditions: emptyArray,
|
|
33845
33782
|
requestContainingDirectory: void 0,
|
|
33846
|
-
reportDiagnostic: noop
|
|
33783
|
+
reportDiagnostic: noop,
|
|
33784
|
+
isConfigLookup: false
|
|
33847
33785
|
};
|
|
33848
33786
|
}
|
|
33849
33787
|
function getPackageScopeForPath(fileName, state) {
|
|
@@ -33902,23 +33840,10 @@ function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
|
33902
33840
|
function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, jsonContent, versionPaths) {
|
|
33903
33841
|
let packageFile;
|
|
33904
33842
|
if (jsonContent) {
|
|
33905
|
-
|
|
33906
|
-
|
|
33907
|
-
|
|
33908
|
-
|
|
33909
|
-
packageFile = readPackageJsonMainField(jsonContent, candidate, state);
|
|
33910
|
-
break;
|
|
33911
|
-
case 0 /* TypeScript */:
|
|
33912
|
-
packageFile = readPackageJsonTypesFields(jsonContent, candidate, state) || readPackageJsonMainField(jsonContent, candidate, state);
|
|
33913
|
-
break;
|
|
33914
|
-
case 4 /* DtsOnly */:
|
|
33915
|
-
packageFile = readPackageJsonTypesFields(jsonContent, candidate, state);
|
|
33916
|
-
break;
|
|
33917
|
-
case 3 /* TSConfig */:
|
|
33918
|
-
packageFile = readPackageJsonTSConfigField(jsonContent, candidate, state);
|
|
33919
|
-
break;
|
|
33920
|
-
default:
|
|
33921
|
-
return Debug.assertNever(extensions);
|
|
33843
|
+
if (state.isConfigLookup) {
|
|
33844
|
+
packageFile = readPackageJsonTSConfigField(jsonContent, candidate, state);
|
|
33845
|
+
} else {
|
|
33846
|
+
packageFile = extensions & 4 /* Declaration */ && readPackageJsonTypesFields(jsonContent, candidate, state) || extensions & (3 /* ImplementationFiles */ | 4 /* Declaration */) && readPackageJsonMainField(jsonContent, candidate, state) || void 0;
|
|
33922
33847
|
}
|
|
33923
33848
|
}
|
|
33924
33849
|
const loader = (extensions2, candidate2, onlyRecordFailures2, state2) => {
|
|
@@ -33932,18 +33857,18 @@ function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFail
|
|
|
33932
33857
|
trace(state2.host, Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromFile);
|
|
33933
33858
|
}
|
|
33934
33859
|
}
|
|
33935
|
-
const
|
|
33860
|
+
const expandedExtensions = extensions2 === 4 /* Declaration */ ? 1 /* TypeScript */ | 4 /* Declaration */ : extensions2;
|
|
33936
33861
|
const features = state2.features;
|
|
33937
33862
|
if ((jsonContent == null ? void 0 : jsonContent.type) !== "module") {
|
|
33938
33863
|
state2.features &= ~32 /* EsmMode */;
|
|
33939
33864
|
}
|
|
33940
|
-
const result = nodeLoadModuleByRelativeName(
|
|
33865
|
+
const result = nodeLoadModuleByRelativeName(expandedExtensions, candidate2, onlyRecordFailures2, state2, false);
|
|
33941
33866
|
state2.features = features;
|
|
33942
33867
|
return result;
|
|
33943
33868
|
};
|
|
33944
33869
|
const onlyRecordFailuresForPackageFile = packageFile ? !directoryProbablyExists(getDirectoryPath(packageFile), state.host) : void 0;
|
|
33945
33870
|
const onlyRecordFailuresForIndex = onlyRecordFailures || !directoryProbablyExists(candidate, state.host);
|
|
33946
|
-
const indexPath = combinePaths(candidate,
|
|
33871
|
+
const indexPath = combinePaths(candidate, state.isConfigLookup ? "tsconfig" : "index");
|
|
33947
33872
|
if (versionPaths && (!packageFile || containsPath(candidate, packageFile))) {
|
|
33948
33873
|
const moduleName = getRelativePathFromDirectory(candidate, packageFile || indexPath, false);
|
|
33949
33874
|
if (state.traceEnabled) {
|
|
@@ -33966,19 +33891,7 @@ function resolvedIfExtensionMatches(extensions, path) {
|
|
|
33966
33891
|
return ext !== void 0 && extensionIsOk(extensions, ext) ? { path, ext } : void 0;
|
|
33967
33892
|
}
|
|
33968
33893
|
function extensionIsOk(extensions, extension) {
|
|
33969
|
-
|
|
33970
|
-
case 1 /* JavaScript */:
|
|
33971
|
-
return extension === ".js" /* Js */ || extension === ".jsx" /* Jsx */ || extension === ".mjs" /* Mjs */ || extension === ".cjs" /* Cjs */;
|
|
33972
|
-
case 3 /* TSConfig */:
|
|
33973
|
-
case 2 /* Json */:
|
|
33974
|
-
return extension === ".json" /* Json */;
|
|
33975
|
-
case 0 /* TypeScript */:
|
|
33976
|
-
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 */;
|
|
33977
|
-
case 5 /* TsOnly */:
|
|
33978
|
-
return extension === ".ts" /* Ts */ || extension === ".tsx" /* Tsx */ || extension === ".mts" /* Mts */ || extension === ".cts" /* Cts */;
|
|
33979
|
-
case 4 /* DtsOnly */:
|
|
33980
|
-
return extension === ".d.ts" /* Dts */ || extension === ".d.mts" /* Dmts */ || extension === ".d.cts" /* Dcts */;
|
|
33981
|
-
}
|
|
33894
|
+
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;
|
|
33982
33895
|
}
|
|
33983
33896
|
function parsePackageName(moduleName) {
|
|
33984
33897
|
let idx = moduleName.indexOf(directorySeparator);
|
|
@@ -34140,7 +34053,7 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
|
|
|
34140
34053
|
const combinedLookup = pattern ? target.replace(/\*/g, subpath) : target + subpath;
|
|
34141
34054
|
traceIfEnabled(state, Diagnostics.Using_0_subpath_1_with_target_2, "imports", key, combinedLookup);
|
|
34142
34055
|
traceIfEnabled(state, Diagnostics.Resolving_module_0_from_1, combinedLookup, scope.packageDirectory + "/");
|
|
34143
|
-
const result = nodeModuleNameResolverWorker(state.features, combinedLookup, scope.packageDirectory + "/", state.compilerOptions, state.host, cache,
|
|
34056
|
+
const result = nodeModuleNameResolverWorker(state.features, combinedLookup, scope.packageDirectory + "/", state.compilerOptions, state.host, cache, extensions, false, redirectedReference);
|
|
34144
34057
|
return toSearchResult(result.resolvedModule ? { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension, packageId: result.resolvedModule.packageId, originalPath: result.resolvedModule.originalPath } : void 0);
|
|
34145
34058
|
}
|
|
34146
34059
|
if (state.traceEnabled) {
|
|
@@ -34231,7 +34144,7 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
|
|
|
34231
34144
|
}
|
|
34232
34145
|
function tryLoadInputFileForPath(finalPath, entry, packagePath, isImports2) {
|
|
34233
34146
|
var _a2, _b, _c, _d;
|
|
34234
|
-
if (
|
|
34147
|
+
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)) {
|
|
34235
34148
|
const getCanonicalFileName = hostGetCanonicalFileName({ useCaseSensitiveFileNames });
|
|
34236
34149
|
const commonSourceDirGuesses = [];
|
|
34237
34150
|
if (state.compilerOptions.rootDir || state.compilerOptions.composite && state.compilerOptions.configFilePath) {
|
|
@@ -34268,10 +34181,9 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
|
|
|
34268
34181
|
if (fileExtensionIs(possibleInputBase, ext)) {
|
|
34269
34182
|
const inputExts = getPossibleOriginalInputExtensionForExtension(possibleInputBase);
|
|
34270
34183
|
for (const possibleExt of inputExts) {
|
|
34271
|
-
|
|
34272
|
-
if (extensions === 0 /* TypeScript */ && hasJSFileExtension(possibleInputWithInputExtension) || extensions === 1 /* JavaScript */ && hasTSFileExtension(possibleInputWithInputExtension)) {
|
|
34184
|
+
if (!extensionIsOk(extensions, possibleExt))
|
|
34273
34185
|
continue;
|
|
34274
|
-
|
|
34186
|
+
const possibleInputWithInputExtension = changeAnyExtension(possibleInputBase, possibleExt, ext, !useCaseSensitiveFileNames());
|
|
34275
34187
|
if (state.host.fileExists(possibleInputWithInputExtension)) {
|
|
34276
34188
|
return toSearchResult(withPackageId(scope, loadJSOrExactTSFileName(extensions, possibleInputWithInputExtension, false, state)));
|
|
34277
34189
|
}
|
|
@@ -34312,19 +34224,31 @@ function loadModuleFromNearestNodeModulesDirectory(extensions, moduleName, direc
|
|
|
34312
34224
|
return loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName, directory, state, false, cache, redirectedReference);
|
|
34313
34225
|
}
|
|
34314
34226
|
function loadModuleFromNearestNodeModulesDirectoryTypesScope(moduleName, directory, state) {
|
|
34315
|
-
return loadModuleFromNearestNodeModulesDirectoryWorker(4 /*
|
|
34227
|
+
return loadModuleFromNearestNodeModulesDirectoryWorker(4 /* Declaration */, moduleName, directory, state, true, void 0, void 0);
|
|
34316
34228
|
}
|
|
34317
34229
|
function loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName, directory, state, typesScopeOnly, cache, redirectedReference) {
|
|
34318
34230
|
const perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName, state.features === 0 ? void 0 : state.features & 32 /* EsmMode */ ? 99 /* ESNext */ : 1 /* CommonJS */, redirectedReference);
|
|
34319
|
-
|
|
34320
|
-
|
|
34321
|
-
|
|
34322
|
-
|
|
34323
|
-
|
|
34231
|
+
const priorityExtensions = extensions & (1 /* TypeScript */ | 4 /* Declaration */);
|
|
34232
|
+
const secondaryExtensions = extensions & ~(1 /* TypeScript */ | 4 /* Declaration */);
|
|
34233
|
+
if (priorityExtensions) {
|
|
34234
|
+
const result = lookup(priorityExtensions);
|
|
34235
|
+
if (result)
|
|
34236
|
+
return result;
|
|
34237
|
+
}
|
|
34238
|
+
if (secondaryExtensions && !typesScopeOnly) {
|
|
34239
|
+
return lookup(secondaryExtensions);
|
|
34240
|
+
}
|
|
34241
|
+
function lookup(extensions2) {
|
|
34242
|
+
return forEachAncestorDirectory(normalizeSlashes(directory), (ancestorDirectory) => {
|
|
34243
|
+
if (getBaseFileName(ancestorDirectory) !== "node_modules") {
|
|
34244
|
+
const resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, ancestorDirectory, state);
|
|
34245
|
+
if (resolutionFromCache) {
|
|
34246
|
+
return resolutionFromCache;
|
|
34247
|
+
}
|
|
34248
|
+
return toSearchResult(loadModuleFromImmediateNodeModulesDirectory(extensions2, moduleName, ancestorDirectory, state, typesScopeOnly, cache, redirectedReference));
|
|
34324
34249
|
}
|
|
34325
|
-
|
|
34326
|
-
|
|
34327
|
-
});
|
|
34250
|
+
});
|
|
34251
|
+
}
|
|
34328
34252
|
}
|
|
34329
34253
|
function loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, directory, state, typesScopeOnly, cache, redirectedReference) {
|
|
34330
34254
|
const nodeModulesFolder = combinePaths(directory, "node_modules");
|
|
@@ -34332,11 +34256,13 @@ function loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, dir
|
|
|
34332
34256
|
if (!nodeModulesFolderExists && state.traceEnabled) {
|
|
34333
34257
|
trace(state.host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesFolder);
|
|
34334
34258
|
}
|
|
34335
|
-
|
|
34336
|
-
|
|
34337
|
-
|
|
34259
|
+
if (!typesScopeOnly) {
|
|
34260
|
+
const packageResult = loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, state, cache, redirectedReference);
|
|
34261
|
+
if (packageResult) {
|
|
34262
|
+
return packageResult;
|
|
34263
|
+
}
|
|
34338
34264
|
}
|
|
34339
|
-
if (extensions
|
|
34265
|
+
if (extensions & 4 /* Declaration */) {
|
|
34340
34266
|
const nodeModulesAtTypes2 = combinePaths(nodeModulesFolder, "@types");
|
|
34341
34267
|
let nodeModulesAtTypesExists = nodeModulesFolderExists;
|
|
34342
34268
|
if (nodeModulesFolderExists && !directoryProbablyExists(nodeModulesAtTypes2, state.host)) {
|
|
@@ -34345,7 +34271,7 @@ function loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, dir
|
|
|
34345
34271
|
}
|
|
34346
34272
|
nodeModulesAtTypesExists = false;
|
|
34347
34273
|
}
|
|
34348
|
-
return loadModuleFromSpecificNodeModulesDirectory(4 /*
|
|
34274
|
+
return loadModuleFromSpecificNodeModulesDirectory(4 /* Declaration */, mangleScopedPackageNameWithTrace(moduleName, state), nodeModulesAtTypes2, nodeModulesAtTypesExists, state, cache, redirectedReference);
|
|
34349
34275
|
}
|
|
34350
34276
|
}
|
|
34351
34277
|
function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state, cache, redirectedReference) {
|
|
@@ -34486,9 +34412,10 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
|
|
|
34486
34412
|
features: 0 /* None */,
|
|
34487
34413
|
conditions: [],
|
|
34488
34414
|
requestContainingDirectory: containingDirectory,
|
|
34489
|
-
reportDiagnostic: (diag2) => void diagnostics.push(diag2)
|
|
34415
|
+
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
34416
|
+
isConfigLookup: false
|
|
34490
34417
|
};
|
|
34491
|
-
const resolved = tryResolve(
|
|
34418
|
+
const resolved = tryResolve(1 /* TypeScript */ | 4 /* Declaration */) || tryResolve(2 /* JavaScript */ | (compilerOptions.resolveJsonModule ? 8 /* Json */ : 0));
|
|
34492
34419
|
return createResolvedModuleWithFailedLookupLocations(
|
|
34493
34420
|
resolved && resolved.value,
|
|
34494
34421
|
false,
|
|
@@ -34515,7 +34442,7 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
|
|
|
34515
34442
|
if (resolved2) {
|
|
34516
34443
|
return resolved2;
|
|
34517
34444
|
}
|
|
34518
|
-
if (extensions
|
|
34445
|
+
if (extensions & (1 /* TypeScript */ | 4 /* Declaration */)) {
|
|
34519
34446
|
return loadModuleFromNearestNodeModulesDirectoryTypesScope(moduleName, containingDirectory, state);
|
|
34520
34447
|
}
|
|
34521
34448
|
} else {
|
|
@@ -34542,9 +34469,10 @@ function loadModuleFromGlobalCache(moduleName, projectName, compilerOptions, hos
|
|
|
34542
34469
|
features: 0 /* None */,
|
|
34543
34470
|
conditions: [],
|
|
34544
34471
|
requestContainingDirectory: void 0,
|
|
34545
|
-
reportDiagnostic: (diag2) => void diagnostics.push(diag2)
|
|
34472
|
+
reportDiagnostic: (diag2) => void diagnostics.push(diag2),
|
|
34473
|
+
isConfigLookup: false
|
|
34546
34474
|
};
|
|
34547
|
-
const resolved = loadModuleFromImmediateNodeModulesDirectory(4 /*
|
|
34475
|
+
const resolved = loadModuleFromImmediateNodeModulesDirectory(4 /* Declaration */, moduleName, globalCache, state, false, void 0, void 0);
|
|
34548
34476
|
return createResolvedModuleWithFailedLookupLocations(
|
|
34549
34477
|
resolved,
|
|
34550
34478
|
true,
|
|
@@ -37494,6 +37422,7 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
|
|
|
37494
37422
|
const importedFileIsInNodeModules = some(modulePaths, (p) => p.isInNodeModules);
|
|
37495
37423
|
let nodeModulesSpecifiers;
|
|
37496
37424
|
let pathsSpecifiers;
|
|
37425
|
+
let redirectPathsSpecifiers;
|
|
37497
37426
|
let relativeSpecifiers;
|
|
37498
37427
|
for (const modulePath of modulePaths) {
|
|
37499
37428
|
const specifier = tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, userPreferences, void 0, options.overrideImportMode);
|
|
@@ -37501,60 +37430,77 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
|
|
|
37501
37430
|
if (specifier && modulePath.isRedirect) {
|
|
37502
37431
|
return nodeModulesSpecifiers;
|
|
37503
37432
|
}
|
|
37504
|
-
if (!specifier
|
|
37505
|
-
const local = getLocalModuleSpecifier(
|
|
37506
|
-
|
|
37433
|
+
if (!specifier) {
|
|
37434
|
+
const local = getLocalModuleSpecifier(
|
|
37435
|
+
modulePath.path,
|
|
37436
|
+
info,
|
|
37437
|
+
compilerOptions,
|
|
37438
|
+
host,
|
|
37439
|
+
options.overrideImportMode || importingSourceFile.impliedNodeFormat,
|
|
37440
|
+
preferences,
|
|
37441
|
+
modulePath.isRedirect
|
|
37442
|
+
);
|
|
37443
|
+
if (!local) {
|
|
37444
|
+
continue;
|
|
37445
|
+
}
|
|
37446
|
+
if (modulePath.isRedirect) {
|
|
37447
|
+
redirectPathsSpecifiers = append(redirectPathsSpecifiers, local);
|
|
37448
|
+
} else if (pathIsBareSpecifier(local)) {
|
|
37507
37449
|
pathsSpecifiers = append(pathsSpecifiers, local);
|
|
37508
37450
|
} else if (!importedFileIsInNodeModules || modulePath.isInNodeModules) {
|
|
37509
37451
|
relativeSpecifiers = append(relativeSpecifiers, local);
|
|
37510
37452
|
}
|
|
37511
37453
|
}
|
|
37512
37454
|
}
|
|
37513
|
-
return (pathsSpecifiers == null ? void 0 : pathsSpecifiers.length) ? pathsSpecifiers : (nodeModulesSpecifiers == null ? void 0 : nodeModulesSpecifiers.length) ? nodeModulesSpecifiers : Debug.checkDefined(relativeSpecifiers);
|
|
37455
|
+
return (pathsSpecifiers == null ? void 0 : pathsSpecifiers.length) ? pathsSpecifiers : (redirectPathsSpecifiers == null ? void 0 : redirectPathsSpecifiers.length) ? redirectPathsSpecifiers : (nodeModulesSpecifiers == null ? void 0 : nodeModulesSpecifiers.length) ? nodeModulesSpecifiers : Debug.checkDefined(relativeSpecifiers);
|
|
37514
37456
|
}
|
|
37515
37457
|
function getInfo(importingSourceFileName, host) {
|
|
37516
37458
|
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames ? host.useCaseSensitiveFileNames() : true);
|
|
37517
37459
|
const sourceDirectory = getDirectoryPath(importingSourceFileName);
|
|
37518
37460
|
return { getCanonicalFileName, importingSourceFileName, sourceDirectory };
|
|
37519
37461
|
}
|
|
37520
|
-
function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, importMode, { ending, relativePreference }) {
|
|
37462
|
+
function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, importMode, { ending, relativePreference }, pathsOnly) {
|
|
37521
37463
|
const { baseUrl, paths, rootDirs } = compilerOptions;
|
|
37464
|
+
if (pathsOnly && !paths) {
|
|
37465
|
+
return void 0;
|
|
37466
|
+
}
|
|
37522
37467
|
const { sourceDirectory, getCanonicalFileName } = info;
|
|
37523
37468
|
const relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) || removeExtensionAndIndexPostFix(ensurePathIsNonModuleName(getRelativePathFromDirectory(sourceDirectory, moduleFileName, getCanonicalFileName)), ending, compilerOptions);
|
|
37524
37469
|
if (!baseUrl && !paths || relativePreference === 0 /* Relative */) {
|
|
37525
|
-
return relativePath;
|
|
37470
|
+
return pathsOnly ? void 0 : relativePath;
|
|
37526
37471
|
}
|
|
37527
37472
|
const baseDirectory = getNormalizedAbsolutePath(getPathsBasePath(compilerOptions, host) || baseUrl, host.getCurrentDirectory());
|
|
37528
37473
|
const relativeToBaseUrl = getRelativePathIfInDirectory(moduleFileName, baseDirectory, getCanonicalFileName);
|
|
37529
37474
|
if (!relativeToBaseUrl) {
|
|
37530
|
-
return relativePath;
|
|
37475
|
+
return pathsOnly ? void 0 : relativePath;
|
|
37531
37476
|
}
|
|
37532
37477
|
const fromPaths = paths && tryGetModuleNameFromPaths(relativeToBaseUrl, paths, getAllowedEndings(ending, compilerOptions, importMode), host, compilerOptions);
|
|
37533
|
-
|
|
37534
|
-
|
|
37478
|
+
if (pathsOnly) {
|
|
37479
|
+
return fromPaths;
|
|
37480
|
+
}
|
|
37481
|
+
const maybeNonRelative = fromPaths === void 0 && baseUrl !== void 0 ? removeExtensionAndIndexPostFix(relativeToBaseUrl, ending, compilerOptions) : fromPaths;
|
|
37482
|
+
if (!maybeNonRelative) {
|
|
37535
37483
|
return relativePath;
|
|
37536
37484
|
}
|
|
37537
|
-
if (relativePreference === 1 /* NonRelative */) {
|
|
37538
|
-
return
|
|
37485
|
+
if (relativePreference === 1 /* NonRelative */ && !pathIsRelative(maybeNonRelative)) {
|
|
37486
|
+
return maybeNonRelative;
|
|
37539
37487
|
}
|
|
37540
|
-
if (relativePreference === 3 /* ExternalNonRelative */) {
|
|
37488
|
+
if (relativePreference === 3 /* ExternalNonRelative */ && !pathIsRelative(maybeNonRelative)) {
|
|
37541
37489
|
const projectDirectory = compilerOptions.configFilePath ? toPath(getDirectoryPath(compilerOptions.configFilePath), host.getCurrentDirectory(), info.getCanonicalFileName) : info.getCanonicalFileName(host.getCurrentDirectory());
|
|
37542
37490
|
const modulePath = toPath(moduleFileName, projectDirectory, getCanonicalFileName);
|
|
37543
37491
|
const sourceIsInternal = startsWith(sourceDirectory, projectDirectory);
|
|
37544
37492
|
const targetIsInternal = startsWith(modulePath, projectDirectory);
|
|
37545
37493
|
if (sourceIsInternal && !targetIsInternal || !sourceIsInternal && targetIsInternal) {
|
|
37546
|
-
return
|
|
37494
|
+
return maybeNonRelative;
|
|
37547
37495
|
}
|
|
37548
37496
|
const nearestTargetPackageJson = getNearestAncestorDirectoryWithPackageJson(host, getDirectoryPath(modulePath));
|
|
37549
37497
|
const nearestSourcePackageJson = getNearestAncestorDirectoryWithPackageJson(host, sourceDirectory);
|
|
37550
37498
|
if (nearestSourcePackageJson !== nearestTargetPackageJson) {
|
|
37551
|
-
return
|
|
37499
|
+
return maybeNonRelative;
|
|
37552
37500
|
}
|
|
37553
37501
|
return relativePath;
|
|
37554
37502
|
}
|
|
37555
|
-
|
|
37556
|
-
Debug.assertNever(relativePreference);
|
|
37557
|
-
return isPathRelativeToParent(nonRelative) || countPathComponents(relativePath) < countPathComponents(nonRelative) ? relativePath : nonRelative;
|
|
37503
|
+
return isPathRelativeToParent(maybeNonRelative) || countPathComponents(relativePath) < countPathComponents(maybeNonRelative) ? relativePath : maybeNonRelative;
|
|
37558
37504
|
}
|
|
37559
37505
|
function countPathComponents(path) {
|
|
37560
37506
|
let count = 0;
|
|
@@ -38115,6 +38061,7 @@ var CheckMode = /* @__PURE__ */ ((CheckMode3) => {
|
|
|
38115
38061
|
return CheckMode3;
|
|
38116
38062
|
})(CheckMode || {});
|
|
38117
38063
|
var SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
|
|
38064
|
+
SignatureCheckMode3[SignatureCheckMode3["None"] = 0] = "None";
|
|
38118
38065
|
SignatureCheckMode3[SignatureCheckMode3["BivariantCallback"] = 1] = "BivariantCallback";
|
|
38119
38066
|
SignatureCheckMode3[SignatureCheckMode3["StrictCallback"] = 2] = "StrictCallback";
|
|
38120
38067
|
SignatureCheckMode3[SignatureCheckMode3["IgnoreReturnTypes"] = 4] = "IgnoreReturnTypes";
|
|
@@ -38132,7 +38079,7 @@ var intrinsicTypeKinds = new Map(getEntries({
|
|
|
38132
38079
|
function SymbolLinks() {
|
|
38133
38080
|
}
|
|
38134
38081
|
function NodeLinks() {
|
|
38135
|
-
this.flags = 0
|
|
38082
|
+
this.flags = 0 /* None */;
|
|
38136
38083
|
}
|
|
38137
38084
|
function getNodeId(node) {
|
|
38138
38085
|
if (!node.id) {
|
|
@@ -38977,7 +38924,7 @@ function createTypeChecker(host) {
|
|
|
38977
38924
|
function createSymbol(flags, name, checkFlags) {
|
|
38978
38925
|
symbolCount++;
|
|
38979
38926
|
const symbol = new Symbol12(flags | 33554432 /* Transient */, name);
|
|
38980
|
-
symbol.checkFlags = checkFlags || 0
|
|
38927
|
+
symbol.checkFlags = checkFlags || 0 /* None */;
|
|
38981
38928
|
return symbol;
|
|
38982
38929
|
}
|
|
38983
38930
|
function getExcludedSymbolFlags(flags) {
|
|
@@ -41288,7 +41235,7 @@ function createTypeChecker(host) {
|
|
|
41288
41235
|
function createOriginType(flags) {
|
|
41289
41236
|
return new Type7(checker, flags);
|
|
41290
41237
|
}
|
|
41291
|
-
function createIntrinsicType(kind, intrinsicName, objectFlags = 0) {
|
|
41238
|
+
function createIntrinsicType(kind, intrinsicName, objectFlags = 0 /* None */) {
|
|
41292
41239
|
const type = createType(kind);
|
|
41293
41240
|
type.intrinsicName = intrinsicName;
|
|
41294
41241
|
type.objectFlags = objectFlags;
|
|
@@ -48129,7 +48076,7 @@ function createTypeChecker(host) {
|
|
|
48129
48076
|
function containsArgumentsReference(declaration) {
|
|
48130
48077
|
const links = getNodeLinks(declaration);
|
|
48131
48078
|
if (links.containsArgumentsReference === void 0) {
|
|
48132
|
-
if (links.flags &
|
|
48079
|
+
if (links.flags & 512 /* CaptureArguments */) {
|
|
48133
48080
|
links.containsArgumentsReference = true;
|
|
48134
48081
|
} else {
|
|
48135
48082
|
links.containsArgumentsReference = traverse(declaration.body);
|
|
@@ -52029,7 +51976,7 @@ function createTypeChecker(host) {
|
|
|
52029
51976
|
return compareSignaturesRelated(
|
|
52030
51977
|
source,
|
|
52031
51978
|
target,
|
|
52032
|
-
ignoreReturnTypes ? 4 /* IgnoreReturnTypes */ : 0
|
|
51979
|
+
ignoreReturnTypes ? 4 /* IgnoreReturnTypes */ : 0 /* None */,
|
|
52033
51980
|
false,
|
|
52034
51981
|
void 0,
|
|
52035
51982
|
void 0,
|
|
@@ -52263,7 +52210,9 @@ function createTypeChecker(host) {
|
|
|
52263
52210
|
if (relation === assignableRelation || relation === comparableRelation) {
|
|
52264
52211
|
if (s & 1 /* Any */)
|
|
52265
52212
|
return true;
|
|
52266
|
-
if (s &
|
|
52213
|
+
if (s & 8 /* Number */ && (t & 32 /* Enum */ || t & 256 /* NumberLiteral */ && t & 1024 /* EnumLiteral */))
|
|
52214
|
+
return true;
|
|
52215
|
+
if (s & 256 /* NumberLiteral */ && !(s & 1024 /* EnumLiteral */) && (t & 32 /* Enum */ || t & 256 /* NumberLiteral */ && t & 1024 /* EnumLiteral */ && source.value === target.value))
|
|
52267
52216
|
return true;
|
|
52268
52217
|
if (isUnknownLikeUnionType(target))
|
|
52269
52218
|
return true;
|
|
@@ -55326,7 +55275,7 @@ function createTypeChecker(host) {
|
|
|
55326
55275
|
pos = p;
|
|
55327
55276
|
}
|
|
55328
55277
|
}
|
|
55329
|
-
function inferTypes(inferences, originalSource, originalTarget, priority = 0
|
|
55278
|
+
function inferTypes(inferences, originalSource, originalTarget, priority = 0 /* None */, contravariant = false) {
|
|
55330
55279
|
let bivariant = false;
|
|
55331
55280
|
let propagationType;
|
|
55332
55281
|
let inferencePriority = 2048 /* MaxValue */;
|
|
@@ -57768,8 +57717,8 @@ function createTypeChecker(host) {
|
|
|
57768
57717
|
}
|
|
57769
57718
|
const parent = getRootDeclaration(symbol.valueDeclaration).parent;
|
|
57770
57719
|
const links = getNodeLinks(parent);
|
|
57771
|
-
if (!(links.flags &
|
|
57772
|
-
links.flags |=
|
|
57720
|
+
if (!(links.flags & 524288 /* AssignmentsMarked */)) {
|
|
57721
|
+
links.flags |= 524288 /* AssignmentsMarked */;
|
|
57773
57722
|
if (!hasParentWithAssignmentsMarked(parent)) {
|
|
57774
57723
|
markNodeAssignments(parent);
|
|
57775
57724
|
}
|
|
@@ -57777,7 +57726,7 @@ function createTypeChecker(host) {
|
|
|
57777
57726
|
return symbol.isAssigned || false;
|
|
57778
57727
|
}
|
|
57779
57728
|
function hasParentWithAssignmentsMarked(node) {
|
|
57780
|
-
return !!findAncestor(node.parent, (node2) => (isFunctionLike(node2) || isCatchClause(node2)) && !!(getNodeLinks(node2).flags &
|
|
57729
|
+
return !!findAncestor(node.parent, (node2) => (isFunctionLike(node2) || isCatchClause(node2)) && !!(getNodeLinks(node2).flags & 524288 /* AssignmentsMarked */));
|
|
57781
57730
|
}
|
|
57782
57731
|
function markNodeAssignments(node) {
|
|
57783
57732
|
if (node.kind === 79 /* Identifier */) {
|
|
@@ -57856,11 +57805,11 @@ function createTypeChecker(host) {
|
|
|
57856
57805
|
const parent = declaration.parent.parent;
|
|
57857
57806
|
if (parent.kind === 257 /* VariableDeclaration */ && getCombinedNodeFlags(declaration) & 2 /* Const */ || parent.kind === 166 /* Parameter */) {
|
|
57858
57807
|
const links = getNodeLinks(parent);
|
|
57859
|
-
if (!(links.flags &
|
|
57860
|
-
links.flags |=
|
|
57808
|
+
if (!(links.flags & 16777216 /* InCheckIdentifier */)) {
|
|
57809
|
+
links.flags |= 16777216 /* InCheckIdentifier */;
|
|
57861
57810
|
const parentType = getTypeForBindingElementParent(parent, 0 /* Normal */);
|
|
57862
57811
|
const parentTypeConstraint = parentType && mapType(parentType, getBaseConstraintOrType);
|
|
57863
|
-
links.flags &= ~
|
|
57812
|
+
links.flags &= ~16777216 /* InCheckIdentifier */;
|
|
57864
57813
|
if (parentTypeConstraint && parentTypeConstraint.flags & 1048576 /* Union */ && !(parent.kind === 166 /* Parameter */ && isSymbolAssigned(symbol))) {
|
|
57865
57814
|
const pattern = declaration.parent;
|
|
57866
57815
|
const narrowedType = getFlowTypeOfReference(pattern, parentTypeConstraint, parentTypeConstraint, void 0, location.flowNode);
|
|
@@ -57910,7 +57859,7 @@ function createTypeChecker(host) {
|
|
|
57910
57859
|
error(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method);
|
|
57911
57860
|
}
|
|
57912
57861
|
}
|
|
57913
|
-
getNodeLinks(container).flags |=
|
|
57862
|
+
getNodeLinks(container).flags |= 512 /* CaptureArguments */;
|
|
57914
57863
|
return getTypeOfSymbol(symbol);
|
|
57915
57864
|
}
|
|
57916
57865
|
if (shouldMarkIdentifierAliasReferenced(node)) {
|
|
@@ -57927,8 +57876,8 @@ function createTypeChecker(host) {
|
|
|
57927
57876
|
let container = getContainingClass(node);
|
|
57928
57877
|
while (container !== void 0) {
|
|
57929
57878
|
if (container === declaration && container.name !== node) {
|
|
57930
|
-
getNodeLinks(declaration).flags |=
|
|
57931
|
-
getNodeLinks(node).flags |=
|
|
57879
|
+
getNodeLinks(declaration).flags |= 1048576 /* ClassWithConstructorReference */;
|
|
57880
|
+
getNodeLinks(node).flags |= 2097152 /* ConstructorReferenceInClass */;
|
|
57932
57881
|
break;
|
|
57933
57882
|
}
|
|
57934
57883
|
container = getContainingClass(container);
|
|
@@ -57938,8 +57887,8 @@ function createTypeChecker(host) {
|
|
|
57938
57887
|
while (container.kind !== 308 /* SourceFile */) {
|
|
57939
57888
|
if (container.parent === declaration) {
|
|
57940
57889
|
if (isPropertyDeclaration(container) && isStatic(container) || isClassStaticBlockDeclaration(container)) {
|
|
57941
|
-
getNodeLinks(declaration).flags |=
|
|
57942
|
-
getNodeLinks(node).flags |=
|
|
57890
|
+
getNodeLinks(declaration).flags |= 1048576 /* ClassWithConstructorReference */;
|
|
57891
|
+
getNodeLinks(node).flags |= 2097152 /* ConstructorReferenceInClass */;
|
|
57943
57892
|
}
|
|
57944
57893
|
break;
|
|
57945
57894
|
}
|
|
@@ -58053,7 +58002,7 @@ function createTypeChecker(host) {
|
|
|
58053
58002
|
const part = getPartOfForStatementContainingNode(node.parent, container);
|
|
58054
58003
|
if (part) {
|
|
58055
58004
|
const links = getNodeLinks(part);
|
|
58056
|
-
links.flags |=
|
|
58005
|
+
links.flags |= 8192 /* ContainsCapturedBlockScopeBinding */;
|
|
58057
58006
|
const capturedBindings = links.capturedBlockScopeBindings || (links.capturedBlockScopeBindings = []);
|
|
58058
58007
|
pushIfUnique(capturedBindings, symbol);
|
|
58059
58008
|
if (part === container.initializer) {
|
|
@@ -58063,19 +58012,19 @@ function createTypeChecker(host) {
|
|
|
58063
58012
|
}
|
|
58064
58013
|
}
|
|
58065
58014
|
if (capturesBlockScopeBindingInLoopBody) {
|
|
58066
|
-
getNodeLinks(enclosingIterationStatement).flags |=
|
|
58015
|
+
getNodeLinks(enclosingIterationStatement).flags |= 4096 /* LoopWithCapturedBlockScopedBinding */;
|
|
58067
58016
|
}
|
|
58068
58017
|
}
|
|
58069
58018
|
if (isForStatement(container)) {
|
|
58070
58019
|
const varDeclList = getAncestor(symbol.valueDeclaration, 258 /* VariableDeclarationList */);
|
|
58071
58020
|
if (varDeclList && varDeclList.parent === container && isAssignedInBodyOfForStatement(node, container)) {
|
|
58072
|
-
getNodeLinks(symbol.valueDeclaration).flags |=
|
|
58021
|
+
getNodeLinks(symbol.valueDeclaration).flags |= 262144 /* NeedsLoopOutParameter */;
|
|
58073
58022
|
}
|
|
58074
58023
|
}
|
|
58075
|
-
getNodeLinks(symbol.valueDeclaration).flags |=
|
|
58024
|
+
getNodeLinks(symbol.valueDeclaration).flags |= 32768 /* BlockScopedBindingInLoop */;
|
|
58076
58025
|
}
|
|
58077
58026
|
if (isCaptured) {
|
|
58078
|
-
getNodeLinks(symbol.valueDeclaration).flags |=
|
|
58027
|
+
getNodeLinks(symbol.valueDeclaration).flags |= 16384 /* CapturedBlockScopedBinding */;
|
|
58079
58028
|
}
|
|
58080
58029
|
}
|
|
58081
58030
|
function isBindingCapturedByNode(node, decl) {
|
|
@@ -58292,23 +58241,23 @@ function createTypeChecker(host) {
|
|
|
58292
58241
|
checkThisBeforeSuper(node, container, Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class);
|
|
58293
58242
|
}
|
|
58294
58243
|
if (isStatic(container) || isCallExpression2) {
|
|
58295
|
-
nodeCheckFlag =
|
|
58244
|
+
nodeCheckFlag = 32 /* SuperStatic */;
|
|
58296
58245
|
if (!isCallExpression2 && languageVersion >= 2 /* ES2015 */ && languageVersion <= 8 /* ES2021 */ && (isPropertyDeclaration(container) || isClassStaticBlockDeclaration(container))) {
|
|
58297
58246
|
forEachEnclosingBlockScopeContainer(node.parent, (current) => {
|
|
58298
58247
|
if (!isSourceFile(current) || isExternalOrCommonJsModule(current)) {
|
|
58299
|
-
getNodeLinks(current).flags |=
|
|
58248
|
+
getNodeLinks(current).flags |= 8388608 /* ContainsSuperPropertyInStaticInitializer */;
|
|
58300
58249
|
}
|
|
58301
58250
|
});
|
|
58302
58251
|
}
|
|
58303
58252
|
} else {
|
|
58304
|
-
nodeCheckFlag =
|
|
58253
|
+
nodeCheckFlag = 16 /* SuperInstance */;
|
|
58305
58254
|
}
|
|
58306
58255
|
getNodeLinks(node).flags |= nodeCheckFlag;
|
|
58307
58256
|
if (container.kind === 171 /* MethodDeclaration */ && inAsyncFunction) {
|
|
58308
58257
|
if (isSuperProperty(node.parent) && isAssignmentTarget(node.parent)) {
|
|
58309
|
-
getNodeLinks(container).flags |=
|
|
58258
|
+
getNodeLinks(container).flags |= 256 /* MethodWithSuperPropertyAssignmentInAsync */;
|
|
58310
58259
|
} else {
|
|
58311
|
-
getNodeLinks(container).flags |=
|
|
58260
|
+
getNodeLinks(container).flags |= 128 /* MethodWithSuperPropertyAccessInAsync */;
|
|
58312
58261
|
}
|
|
58313
58262
|
}
|
|
58314
58263
|
if (needToCaptureLexicalThis) {
|
|
@@ -58336,7 +58285,7 @@ function createTypeChecker(host) {
|
|
|
58336
58285
|
error(node, Diagnostics.super_cannot_be_referenced_in_constructor_arguments);
|
|
58337
58286
|
return errorType;
|
|
58338
58287
|
}
|
|
58339
|
-
return nodeCheckFlag ===
|
|
58288
|
+
return nodeCheckFlag === 32 /* SuperStatic */ ? getBaseConstructorTypeOfClass(classType) : getTypeWithThisArgument(baseClassType, classType.thisType);
|
|
58340
58289
|
function isLegalUsageOfSuperExpression(container2) {
|
|
58341
58290
|
if (!container2) {
|
|
58342
58291
|
return false;
|
|
@@ -59351,9 +59300,9 @@ function createTypeChecker(host) {
|
|
|
59351
59300
|
const container = getEnclosingBlockScopeContainer(node.parent.parent);
|
|
59352
59301
|
const enclosingIterationStatement = getEnclosingIterationStatement(container);
|
|
59353
59302
|
if (enclosingIterationStatement) {
|
|
59354
|
-
getNodeLinks(enclosingIterationStatement).flags |=
|
|
59355
|
-
getNodeLinks(node).flags |=
|
|
59356
|
-
getNodeLinks(node.parent.parent).flags |=
|
|
59303
|
+
getNodeLinks(enclosingIterationStatement).flags |= 4096 /* LoopWithCapturedBlockScopedBinding */;
|
|
59304
|
+
getNodeLinks(node).flags |= 32768 /* BlockScopedBindingInLoop */;
|
|
59305
|
+
getNodeLinks(node.parent.parent).flags |= 32768 /* BlockScopedBindingInLoop */;
|
|
59357
59306
|
}
|
|
59358
59307
|
}
|
|
59359
59308
|
if (links.resolvedType.flags & 98304 /* Nullable */ || !isTypeAssignableToKind(links.resolvedType, 402653316 /* StringLike */ | 296 /* NumberLike */ | 12288 /* ESSymbolLike */) && !isTypeAssignableTo(links.resolvedType, stringNumberSymbolType)) {
|
|
@@ -63340,10 +63289,10 @@ function createTypeChecker(host) {
|
|
|
63340
63289
|
}
|
|
63341
63290
|
function contextuallyCheckFunctionExpressionOrObjectLiteralMethod(node, checkMode) {
|
|
63342
63291
|
const links = getNodeLinks(node);
|
|
63343
|
-
if (!(links.flags &
|
|
63292
|
+
if (!(links.flags & 64 /* ContextChecked */)) {
|
|
63344
63293
|
const contextualSignature = getContextualSignature(node);
|
|
63345
|
-
if (!(links.flags &
|
|
63346
|
-
links.flags |=
|
|
63294
|
+
if (!(links.flags & 64 /* ContextChecked */)) {
|
|
63295
|
+
links.flags |= 64 /* ContextChecked */;
|
|
63347
63296
|
const signature = firstOrUndefined(getSignaturesOfType(getTypeOfSymbol(getSymbolOfNode(node)), 0 /* Call */));
|
|
63348
63297
|
if (!signature) {
|
|
63349
63298
|
return;
|
|
@@ -65333,13 +65282,13 @@ function createTypeChecker(host) {
|
|
|
65333
65282
|
function setNodeLinksForPrivateIdentifierScope(node) {
|
|
65334
65283
|
if (isPrivateIdentifier(node.name) && languageVersion < 99 /* ESNext */) {
|
|
65335
65284
|
for (let lexicalScope = getEnclosingBlockScopeContainer(node); !!lexicalScope; lexicalScope = getEnclosingBlockScopeContainer(lexicalScope)) {
|
|
65336
|
-
getNodeLinks(lexicalScope).flags |=
|
|
65285
|
+
getNodeLinks(lexicalScope).flags |= 4194304 /* ContainsClassWithPrivateIdentifiers */;
|
|
65337
65286
|
}
|
|
65338
65287
|
if (isClassExpression(node.parent)) {
|
|
65339
65288
|
const enclosingIterationStatement = getEnclosingIterationStatement(node.parent);
|
|
65340
65289
|
if (enclosingIterationStatement) {
|
|
65341
|
-
getNodeLinks(node.name).flags |=
|
|
65342
|
-
getNodeLinks(enclosingIterationStatement).flags |=
|
|
65290
|
+
getNodeLinks(node.name).flags |= 32768 /* BlockScopedBindingInLoop */;
|
|
65291
|
+
getNodeLinks(enclosingIterationStatement).flags |= 4096 /* LoopWithCapturedBlockScopedBinding */;
|
|
65343
65292
|
}
|
|
65344
65293
|
}
|
|
65345
65294
|
}
|
|
@@ -66934,7 +66883,7 @@ function createTypeChecker(host) {
|
|
|
66934
66883
|
}
|
|
66935
66884
|
function checkWeakMapSetCollision(node) {
|
|
66936
66885
|
const enclosingBlockScope = getEnclosingBlockScopeContainer(node);
|
|
66937
|
-
if (getNodeCheckFlags(enclosingBlockScope) &
|
|
66886
|
+
if (getNodeCheckFlags(enclosingBlockScope) & 4194304 /* ContainsClassWithPrivateIdentifiers */) {
|
|
66938
66887
|
Debug.assert(isNamedDeclaration(node) && isIdentifier(node.name) && typeof node.name.escapedText === "string", "The target of a WeakMap/WeakSet collision check should be an identifier");
|
|
66939
66888
|
errorSkippedOn("noEmit", node, Diagnostics.Compiler_reserves_name_0_when_emitting_private_identifier_downlevel, node.name.escapedText);
|
|
66940
66889
|
}
|
|
@@ -66948,18 +66897,18 @@ function createTypeChecker(host) {
|
|
|
66948
66897
|
let hasCollision = false;
|
|
66949
66898
|
if (isClassExpression(node)) {
|
|
66950
66899
|
for (const member of node.members) {
|
|
66951
|
-
if (getNodeCheckFlags(member) &
|
|
66900
|
+
if (getNodeCheckFlags(member) & 8388608 /* ContainsSuperPropertyInStaticInitializer */) {
|
|
66952
66901
|
hasCollision = true;
|
|
66953
66902
|
break;
|
|
66954
66903
|
}
|
|
66955
66904
|
}
|
|
66956
66905
|
} else if (isFunctionExpression(node)) {
|
|
66957
|
-
if (getNodeCheckFlags(node) &
|
|
66906
|
+
if (getNodeCheckFlags(node) & 8388608 /* ContainsSuperPropertyInStaticInitializer */) {
|
|
66958
66907
|
hasCollision = true;
|
|
66959
66908
|
}
|
|
66960
66909
|
} else {
|
|
66961
66910
|
const container = getEnclosingBlockScopeContainer(node);
|
|
66962
|
-
if (container && getNodeCheckFlags(container) &
|
|
66911
|
+
if (container && getNodeCheckFlags(container) & 8388608 /* ContainsSuperPropertyInStaticInitializer */) {
|
|
66963
66912
|
hasCollision = true;
|
|
66964
66913
|
}
|
|
66965
66914
|
}
|
|
@@ -68844,8 +68793,8 @@ function createTypeChecker(host) {
|
|
|
68844
68793
|
}
|
|
68845
68794
|
function computeEnumMemberValues(node) {
|
|
68846
68795
|
const nodeLinks2 = getNodeLinks(node);
|
|
68847
|
-
if (!(nodeLinks2.flags &
|
|
68848
|
-
nodeLinks2.flags |=
|
|
68796
|
+
if (!(nodeLinks2.flags & 1024 /* EnumValuesComputed */)) {
|
|
68797
|
+
nodeLinks2.flags |= 1024 /* EnumValuesComputed */;
|
|
68849
68798
|
let autoValue = 0;
|
|
68850
68799
|
for (const member of node.members) {
|
|
68851
68800
|
const value = computeMemberValue(member, autoValue);
|
|
@@ -69121,7 +69070,7 @@ function createTypeChecker(host) {
|
|
|
69121
69070
|
}
|
|
69122
69071
|
const mergedClass = getDeclarationOfKind(symbol, 260 /* ClassDeclaration */);
|
|
69123
69072
|
if (mergedClass && inSameLexicalScope(node, mergedClass)) {
|
|
69124
|
-
getNodeLinks(node).flags |=
|
|
69073
|
+
getNodeLinks(node).flags |= 2048 /* LexicalModuleMergesWithClass */;
|
|
69125
69074
|
}
|
|
69126
69075
|
}
|
|
69127
69076
|
if (isAmbientExternalModule) {
|
|
@@ -70752,8 +70701,8 @@ function createTypeChecker(host) {
|
|
|
70752
70701
|
const nodeLinks2 = getNodeLinks(symbol.valueDeclaration);
|
|
70753
70702
|
if (resolveName(container.parent, symbol.escapedName, 111551 /* Value */, void 0, void 0, false)) {
|
|
70754
70703
|
links.isDeclarationWithCollidingName = true;
|
|
70755
|
-
} else if (nodeLinks2.flags &
|
|
70756
|
-
const isDeclaredInLoop = nodeLinks2.flags &
|
|
70704
|
+
} else if (nodeLinks2.flags & 16384 /* CapturedBlockScopedBinding */) {
|
|
70705
|
+
const isDeclaredInLoop = nodeLinks2.flags & 32768 /* BlockScopedBindingInLoop */;
|
|
70757
70706
|
const inLoopInitializer = isIterationStatement(container, false);
|
|
70758
70707
|
const inLoopBodyBlock = container.kind === 238 /* Block */ && isIterationStatement(container.parent, false);
|
|
70759
70708
|
links.isDeclarationWithCollidingName = !isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || !inLoopInitializer && !inLoopBodyBlock);
|
|
@@ -74189,10 +74138,10 @@ var visitEachChildTable = {
|
|
|
74189
74138
|
nodeVisitor(node.initializer, visitor, isExpression)
|
|
74190
74139
|
);
|
|
74191
74140
|
},
|
|
74192
|
-
[308 /* SourceFile */]: function visitEachChildOfSourceFile(node, visitor, context,
|
|
74141
|
+
[308 /* SourceFile */]: function visitEachChildOfSourceFile(node, visitor, context, _nodesVisitor, _nodeVisitor, _tokenVisitor) {
|
|
74193
74142
|
return context.factory.updateSourceFile(
|
|
74194
74143
|
node,
|
|
74195
|
-
visitLexicalEnvironment(node.statements, visitor, context
|
|
74144
|
+
visitLexicalEnvironment(node.statements, visitor, context)
|
|
74196
74145
|
);
|
|
74197
74146
|
},
|
|
74198
74147
|
[353 /* PartiallyEmittedExpression */]: function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
|
|
@@ -77728,12 +77677,12 @@ function transformClassFields(context) {
|
|
|
77728
77677
|
function visitClassExpressionInNewClassLexicalEnvironment(node, facts) {
|
|
77729
77678
|
const isDecoratedClassDeclaration = !!(facts & 1 /* ClassWasDecorated */);
|
|
77730
77679
|
const staticPropertiesOrClassStaticBlocks = getStaticPropertiesAndClassStaticBlock(node);
|
|
77731
|
-
const isClassWithConstructorReference = resolver.getNodeCheckFlags(node) &
|
|
77680
|
+
const isClassWithConstructorReference = resolver.getNodeCheckFlags(node) & 1048576 /* ClassWithConstructorReference */;
|
|
77732
77681
|
let temp;
|
|
77733
77682
|
function createClassTempVar() {
|
|
77734
77683
|
const classCheckFlags = resolver.getNodeCheckFlags(node);
|
|
77735
|
-
const isClassWithConstructorReference2 = classCheckFlags &
|
|
77736
|
-
const requiresBlockScopedVar = classCheckFlags &
|
|
77684
|
+
const isClassWithConstructorReference2 = classCheckFlags & 1048576 /* ClassWithConstructorReference */;
|
|
77685
|
+
const requiresBlockScopedVar = classCheckFlags & 32768 /* BlockScopedBindingInLoop */;
|
|
77737
77686
|
return factory2.createTempVariable(requiresBlockScopedVar ? addBlockScopedVariable : hoistVariableDeclaration, !!isClassWithConstructorReference2);
|
|
77738
77687
|
}
|
|
77739
77688
|
if (facts & 2 /* NeedsClassConstructorReference */) {
|
|
@@ -78246,7 +78195,7 @@ function transformClassFields(context) {
|
|
|
78246
78195
|
}
|
|
78247
78196
|
function trySubstituteClassAlias(node) {
|
|
78248
78197
|
if (enabledSubstitutions & 1 /* ClassAliases */) {
|
|
78249
|
-
if (resolver.getNodeCheckFlags(node) &
|
|
78198
|
+
if (resolver.getNodeCheckFlags(node) & 2097152 /* ConstructorReferenceInClass */) {
|
|
78250
78199
|
const declaration = resolver.getReferencedValueDeclaration(node);
|
|
78251
78200
|
if (declaration) {
|
|
78252
78201
|
const classAlias = classAliases[declaration.id];
|
|
@@ -78269,7 +78218,7 @@ function transformClassFields(context) {
|
|
|
78269
78218
|
const alreadyTransformed = isAssignmentExpression(innerExpression) && isGeneratedIdentifier(innerExpression.left);
|
|
78270
78219
|
if (!alreadyTransformed && !inlinable && shouldHoist) {
|
|
78271
78220
|
const generatedName = factory2.getGeneratedNameForNode(name);
|
|
78272
|
-
if (resolver.getNodeCheckFlags(name) &
|
|
78221
|
+
if (resolver.getNodeCheckFlags(name) & 32768 /* BlockScopedBindingInLoop */) {
|
|
78273
78222
|
addBlockScopedVariable(generatedName);
|
|
78274
78223
|
} else {
|
|
78275
78224
|
hoistVariableDeclaration(generatedName);
|
|
@@ -78418,7 +78367,7 @@ function transformClassFields(context) {
|
|
|
78418
78367
|
const { className } = getPrivateIdentifierEnvironment();
|
|
78419
78368
|
const prefix = className ? { prefix: "_", node: className, suffix: "_" } : "_";
|
|
78420
78369
|
const identifier = typeof name === "object" ? factory2.getGeneratedNameForNode(name, 16 /* Optimistic */ | 8 /* ReservedInNestedScopes */, prefix, suffix) : typeof name === "string" ? factory2.createUniqueName(name, 16 /* Optimistic */, prefix, suffix) : factory2.createTempVariable(void 0, true, prefix, suffix);
|
|
78421
|
-
if (resolver.getNodeCheckFlags(node) &
|
|
78370
|
+
if (resolver.getNodeCheckFlags(node) & 32768 /* BlockScopedBindingInLoop */) {
|
|
78422
78371
|
addBlockScopedVariable(identifier);
|
|
78423
78372
|
} else {
|
|
78424
78373
|
hoistVariableDeclaration(identifier);
|
|
@@ -79283,7 +79232,7 @@ function transformLegacyDecorators(context) {
|
|
|
79283
79232
|
}
|
|
79284
79233
|
}
|
|
79285
79234
|
function getClassAliasIfNeeded(node) {
|
|
79286
|
-
if (resolver.getNodeCheckFlags(node) &
|
|
79235
|
+
if (resolver.getNodeCheckFlags(node) & 1048576 /* ClassWithConstructorReference */) {
|
|
79287
79236
|
enableSubstitutionForClassAliases();
|
|
79288
79237
|
const classAlias = factory2.createUniqueName(node.name && !isGeneratedIdentifier(node.name) ? idText(node.name) : "default");
|
|
79289
79238
|
classAliases[getOriginalNodeId(node)] = classAlias;
|
|
@@ -79317,7 +79266,7 @@ function transformLegacyDecorators(context) {
|
|
|
79317
79266
|
}
|
|
79318
79267
|
function trySubstituteClassAlias(node) {
|
|
79319
79268
|
if (classAliases) {
|
|
79320
|
-
if (resolver.getNodeCheckFlags(node) &
|
|
79269
|
+
if (resolver.getNodeCheckFlags(node) & 2097152 /* ConstructorReferenceInClass */) {
|
|
79321
79270
|
const declaration = resolver.getReferencedValueDeclaration(node);
|
|
79322
79271
|
if (declaration) {
|
|
79323
79272
|
const classAlias = classAliases[declaration.id];
|
|
@@ -79352,7 +79301,7 @@ function transformES2017(context) {
|
|
|
79352
79301
|
let capturedSuperProperties;
|
|
79353
79302
|
let hasSuperElementAccess;
|
|
79354
79303
|
const substitutedSuperAccessors = [];
|
|
79355
|
-
let contextFlags = 0
|
|
79304
|
+
let contextFlags = 0 /* None */;
|
|
79356
79305
|
const previousOnEmitNode = context.onEmitNode;
|
|
79357
79306
|
const previousOnSubstituteNode = context.onSubstituteNode;
|
|
79358
79307
|
context.onEmitNode = onEmitNode;
|
|
@@ -79679,7 +79628,7 @@ function transformES2017(context) {
|
|
|
79679
79628
|
hasSuperElementAccess = false;
|
|
79680
79629
|
let updated = visitFunctionBody(node.body, visitor, context);
|
|
79681
79630
|
const originalMethod = getOriginalNode(node, isFunctionLikeDeclaration);
|
|
79682
|
-
const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && resolver.getNodeCheckFlags(node) & (
|
|
79631
|
+
const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && resolver.getNodeCheckFlags(node) & (256 /* MethodWithSuperPropertyAssignmentInAsync */ | 128 /* MethodWithSuperPropertyAccessInAsync */) && (getFunctionFlags(originalMethod) & 3 /* AsyncGenerator */) !== 3 /* AsyncGenerator */;
|
|
79683
79632
|
if (emitSuperHelpers) {
|
|
79684
79633
|
enableSubstitutionForAsyncMethodsWithSuper();
|
|
79685
79634
|
if (capturedSuperProperties.size) {
|
|
@@ -79690,9 +79639,9 @@ function transformES2017(context) {
|
|
|
79690
79639
|
updated = factory2.updateBlock(updated, statements);
|
|
79691
79640
|
}
|
|
79692
79641
|
if (hasSuperElementAccess) {
|
|
79693
|
-
if (resolver.getNodeCheckFlags(node) &
|
|
79642
|
+
if (resolver.getNodeCheckFlags(node) & 256 /* MethodWithSuperPropertyAssignmentInAsync */) {
|
|
79694
79643
|
addEmitHelper(updated, advancedAsyncSuperHelper);
|
|
79695
|
-
} else if (resolver.getNodeCheckFlags(node) &
|
|
79644
|
+
} else if (resolver.getNodeCheckFlags(node) & 128 /* MethodWithSuperPropertyAccessInAsync */) {
|
|
79696
79645
|
addEmitHelper(updated, asyncSuperHelper);
|
|
79697
79646
|
}
|
|
79698
79647
|
}
|
|
@@ -79707,7 +79656,7 @@ function transformES2017(context) {
|
|
|
79707
79656
|
const nodeType = original.type;
|
|
79708
79657
|
const promiseConstructor = languageVersion < 2 /* ES2015 */ ? getPromiseConstructor(nodeType) : void 0;
|
|
79709
79658
|
const isArrowFunction2 = node.kind === 216 /* ArrowFunction */;
|
|
79710
|
-
const hasLexicalArguments = (resolver.getNodeCheckFlags(node) &
|
|
79659
|
+
const hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 512 /* CaptureArguments */) !== 0;
|
|
79711
79660
|
const savedEnclosingFunctionParameterNames = enclosingFunctionParameterNames;
|
|
79712
79661
|
enclosingFunctionParameterNames = /* @__PURE__ */ new Set();
|
|
79713
79662
|
for (const parameter of node.parameters) {
|
|
@@ -79734,7 +79683,7 @@ function transformES2017(context) {
|
|
|
79734
79683
|
)
|
|
79735
79684
|
);
|
|
79736
79685
|
insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
|
|
79737
|
-
const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && resolver.getNodeCheckFlags(node) & (
|
|
79686
|
+
const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && resolver.getNodeCheckFlags(node) & (256 /* MethodWithSuperPropertyAssignmentInAsync */ | 128 /* MethodWithSuperPropertyAccessInAsync */);
|
|
79738
79687
|
if (emitSuperHelpers) {
|
|
79739
79688
|
enableSubstitutionForAsyncMethodsWithSuper();
|
|
79740
79689
|
if (capturedSuperProperties.size) {
|
|
@@ -79746,9 +79695,9 @@ function transformES2017(context) {
|
|
|
79746
79695
|
const block = factory2.createBlock(statements, true);
|
|
79747
79696
|
setTextRange(block, node.body);
|
|
79748
79697
|
if (emitSuperHelpers && hasSuperElementAccess) {
|
|
79749
|
-
if (resolver.getNodeCheckFlags(node) &
|
|
79698
|
+
if (resolver.getNodeCheckFlags(node) & 256 /* MethodWithSuperPropertyAssignmentInAsync */) {
|
|
79750
79699
|
addEmitHelper(block, advancedAsyncSuperHelper);
|
|
79751
|
-
} else if (resolver.getNodeCheckFlags(node) &
|
|
79700
|
+
} else if (resolver.getNodeCheckFlags(node) & 128 /* MethodWithSuperPropertyAccessInAsync */) {
|
|
79752
79701
|
addEmitHelper(block, asyncSuperHelper);
|
|
79753
79702
|
}
|
|
79754
79703
|
}
|
|
@@ -79808,7 +79757,7 @@ function transformES2017(context) {
|
|
|
79808
79757
|
}
|
|
79809
79758
|
function onEmitNode(hint, node, emitCallback) {
|
|
79810
79759
|
if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */ && isSuperContainer(node)) {
|
|
79811
|
-
const superContainerFlags = resolver.getNodeCheckFlags(node) & (
|
|
79760
|
+
const superContainerFlags = resolver.getNodeCheckFlags(node) & (128 /* MethodWithSuperPropertyAccessInAsync */ | 256 /* MethodWithSuperPropertyAssignmentInAsync */);
|
|
79812
79761
|
if (superContainerFlags !== enclosingSuperContainerFlags) {
|
|
79813
79762
|
const savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
|
|
79814
79763
|
enclosingSuperContainerFlags = superContainerFlags;
|
|
@@ -79884,7 +79833,7 @@ function transformES2017(context) {
|
|
|
79884
79833
|
return kind === 260 /* ClassDeclaration */ || kind === 173 /* Constructor */ || kind === 171 /* MethodDeclaration */ || kind === 174 /* GetAccessor */ || kind === 175 /* SetAccessor */;
|
|
79885
79834
|
}
|
|
79886
79835
|
function createSuperElementAccessInAsyncMethod(argumentExpression, location) {
|
|
79887
|
-
if (enclosingSuperContainerFlags &
|
|
79836
|
+
if (enclosingSuperContainerFlags & 256 /* MethodWithSuperPropertyAssignmentInAsync */) {
|
|
79888
79837
|
return setTextRange(
|
|
79889
79838
|
factory2.createPropertyAccessExpression(
|
|
79890
79839
|
factory2.createCallExpression(
|
|
@@ -79909,7 +79858,7 @@ function transformES2017(context) {
|
|
|
79909
79858
|
}
|
|
79910
79859
|
}
|
|
79911
79860
|
function createSuperAccessVariableStatement(factory2, resolver, node, names) {
|
|
79912
|
-
const hasBinding = (resolver.getNodeCheckFlags(node) &
|
|
79861
|
+
const hasBinding = (resolver.getNodeCheckFlags(node) & 256 /* MethodWithSuperPropertyAssignmentInAsync */) !== 0;
|
|
79913
79862
|
const accessors = [];
|
|
79914
79863
|
names.forEach((_, key) => {
|
|
79915
79864
|
const name = unescapeLeadingUnderscores(key);
|
|
@@ -80847,7 +80796,7 @@ function transformES2018(context) {
|
|
|
80847
80796
|
!!(hierarchyFacts & 1 /* HasLexicalThis */)
|
|
80848
80797
|
)
|
|
80849
80798
|
);
|
|
80850
|
-
const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && resolver.getNodeCheckFlags(node) & (
|
|
80799
|
+
const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && resolver.getNodeCheckFlags(node) & (256 /* MethodWithSuperPropertyAssignmentInAsync */ | 128 /* MethodWithSuperPropertyAccessInAsync */);
|
|
80851
80800
|
if (emitSuperHelpers) {
|
|
80852
80801
|
enableSubstitutionForAsyncMethodsWithSuper();
|
|
80853
80802
|
const variableStatement = createSuperAccessVariableStatement(factory2, resolver, node, capturedSuperProperties);
|
|
@@ -80858,9 +80807,9 @@ function transformES2018(context) {
|
|
|
80858
80807
|
insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
|
|
80859
80808
|
const block = factory2.updateBlock(node.body, statements);
|
|
80860
80809
|
if (emitSuperHelpers && hasSuperElementAccess) {
|
|
80861
|
-
if (resolver.getNodeCheckFlags(node) &
|
|
80810
|
+
if (resolver.getNodeCheckFlags(node) & 256 /* MethodWithSuperPropertyAssignmentInAsync */) {
|
|
80862
80811
|
addEmitHelper(block, advancedAsyncSuperHelper);
|
|
80863
|
-
} else if (resolver.getNodeCheckFlags(node) &
|
|
80812
|
+
} else if (resolver.getNodeCheckFlags(node) & 128 /* MethodWithSuperPropertyAccessInAsync */) {
|
|
80864
80813
|
addEmitHelper(block, asyncSuperHelper);
|
|
80865
80814
|
}
|
|
80866
80815
|
}
|
|
@@ -80970,7 +80919,7 @@ function transformES2018(context) {
|
|
|
80970
80919
|
}
|
|
80971
80920
|
function onEmitNode(hint, node, emitCallback) {
|
|
80972
80921
|
if (enabledSubstitutions & 1 /* AsyncMethodsWithSuper */ && isSuperContainer(node)) {
|
|
80973
|
-
const superContainerFlags = resolver.getNodeCheckFlags(node) & (
|
|
80922
|
+
const superContainerFlags = resolver.getNodeCheckFlags(node) & (128 /* MethodWithSuperPropertyAccessInAsync */ | 256 /* MethodWithSuperPropertyAssignmentInAsync */);
|
|
80974
80923
|
if (superContainerFlags !== enclosingSuperContainerFlags) {
|
|
80975
80924
|
const savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags;
|
|
80976
80925
|
enclosingSuperContainerFlags = superContainerFlags;
|
|
@@ -81046,7 +80995,7 @@ function transformES2018(context) {
|
|
|
81046
80995
|
return kind === 260 /* ClassDeclaration */ || kind === 173 /* Constructor */ || kind === 171 /* MethodDeclaration */ || kind === 174 /* GetAccessor */ || kind === 175 /* SetAccessor */;
|
|
81047
80996
|
}
|
|
81048
80997
|
function createSuperElementAccessInAsyncMethod(argumentExpression, location) {
|
|
81049
|
-
if (enclosingSuperContainerFlags &
|
|
80998
|
+
if (enclosingSuperContainerFlags & 256 /* MethodWithSuperPropertyAssignmentInAsync */) {
|
|
81050
80999
|
return setTextRange(
|
|
81051
81000
|
factory2.createPropertyAccessExpression(
|
|
81052
81001
|
factory2.createCallExpression(
|
|
@@ -83402,8 +83351,8 @@ function transformES2015(context) {
|
|
|
83402
83351
|
}
|
|
83403
83352
|
function shouldEmitExplicitInitializerForLetDeclaration(node) {
|
|
83404
83353
|
const flags = resolver.getNodeCheckFlags(node);
|
|
83405
|
-
const isCapturedInFunction = flags &
|
|
83406
|
-
const isDeclaredInLoop = flags &
|
|
83354
|
+
const isCapturedInFunction = flags & 16384 /* CapturedBlockScopedBinding */;
|
|
83355
|
+
const isDeclaredInLoop = flags & 32768 /* BlockScopedBindingInLoop */;
|
|
83407
83356
|
const emittedAsTopLevel = (hierarchyFacts & 64 /* TopLevel */) !== 0 || isCapturedInFunction && isDeclaredInLoop && (hierarchyFacts & 512 /* IterationStatementBlock */) !== 0;
|
|
83408
83357
|
const emitExplicitInitializer = !emittedAsTopLevel && (hierarchyFacts & 4096 /* ForInOrForOfStatement */) === 0 && (!resolver.isDeclarationWithCollidingName(node) || isDeclaredInLoop && !isCapturedInFunction && (hierarchyFacts & (2048 /* ForStatement */ | 4096 /* ForInOrForOfStatement */)) === 0);
|
|
83409
83358
|
return emitExplicitInitializer;
|
|
@@ -83764,7 +83713,7 @@ function transformES2015(context) {
|
|
|
83764
83713
|
return factory2.inlineExpressions(expressions);
|
|
83765
83714
|
}
|
|
83766
83715
|
function shouldConvertPartOfIterationStatement(node) {
|
|
83767
|
-
return (resolver.getNodeCheckFlags(node) &
|
|
83716
|
+
return (resolver.getNodeCheckFlags(node) & 8192 /* ContainsCapturedBlockScopeBinding */) !== 0;
|
|
83768
83717
|
}
|
|
83769
83718
|
function shouldConvertInitializerOfForStatement(node) {
|
|
83770
83719
|
return isForStatement(node) && !!node.initializer && shouldConvertPartOfIterationStatement(node.initializer);
|
|
@@ -83779,7 +83728,7 @@ function transformES2015(context) {
|
|
|
83779
83728
|
return shouldConvertBodyOfIterationStatement(node) || shouldConvertInitializerOfForStatement(node);
|
|
83780
83729
|
}
|
|
83781
83730
|
function shouldConvertBodyOfIterationStatement(node) {
|
|
83782
|
-
return (resolver.getNodeCheckFlags(node) &
|
|
83731
|
+
return (resolver.getNodeCheckFlags(node) & 4096 /* LoopWithCapturedBlockScopedBinding */) !== 0;
|
|
83783
83732
|
}
|
|
83784
83733
|
function hoistVariableDeclarationDeclaredInConvertedLoop(state, node) {
|
|
83785
83734
|
if (!state.hoistedLocalVariables) {
|
|
@@ -84240,10 +84189,10 @@ function transformES2015(context) {
|
|
|
84240
84189
|
} else {
|
|
84241
84190
|
loopParameters.push(factory2.createParameterDeclaration(void 0, void 0, name));
|
|
84242
84191
|
const checkFlags = resolver.getNodeCheckFlags(decl);
|
|
84243
|
-
if (checkFlags &
|
|
84192
|
+
if (checkFlags & 262144 /* NeedsLoopOutParameter */ || hasCapturedBindingsInForHead) {
|
|
84244
84193
|
const outParamName = factory2.createUniqueName("out_" + idText(name));
|
|
84245
|
-
let flags = 0
|
|
84246
|
-
if (checkFlags &
|
|
84194
|
+
let flags = 0 /* None */;
|
|
84195
|
+
if (checkFlags & 262144 /* NeedsLoopOutParameter */) {
|
|
84247
84196
|
flags |= 1 /* Body */;
|
|
84248
84197
|
}
|
|
84249
84198
|
if (isForStatement(container)) {
|
|
@@ -92160,7 +92109,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
92160
92109
|
const sourceMap = sourceMapGenerator.toString();
|
|
92161
92110
|
writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, false, sourceFiles);
|
|
92162
92111
|
if (printer.bundleFileInfo)
|
|
92163
|
-
printer.bundleFileInfo.mapHash = computeSignature(sourceMap,
|
|
92112
|
+
printer.bundleFileInfo.mapHash = computeSignature(sourceMap, host);
|
|
92164
92113
|
}
|
|
92165
92114
|
} else {
|
|
92166
92115
|
writer.writeLine();
|
|
@@ -92168,7 +92117,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
92168
92117
|
const text = writer.getText();
|
|
92169
92118
|
writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos, diagnostics: transform.diagnostics });
|
|
92170
92119
|
if (printer.bundleFileInfo)
|
|
92171
|
-
printer.bundleFileInfo.hash = computeSignature(text,
|
|
92120
|
+
printer.bundleFileInfo.hash = computeSignature(text, host);
|
|
92172
92121
|
writer.clear();
|
|
92173
92122
|
}
|
|
92174
92123
|
function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) {
|
|
@@ -92314,7 +92263,6 @@ function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
|
|
|
92314
92263
|
return result;
|
|
92315
92264
|
}
|
|
92316
92265
|
function emitUsingBuildInfoWorker(config, host, getCommandLine, customTransformers) {
|
|
92317
|
-
const createHash = maybeBind(host, host.createHash);
|
|
92318
92266
|
const { buildInfoPath, jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath } = getOutputPathsForBundle(config.options, false);
|
|
92319
92267
|
const buildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath);
|
|
92320
92268
|
if (!buildInfo)
|
|
@@ -92324,22 +92272,22 @@ function emitUsingBuildInfoWorker(config, host, getCommandLine, customTransforme
|
|
|
92324
92272
|
const jsFileText = host.readFile(Debug.checkDefined(jsFilePath));
|
|
92325
92273
|
if (!jsFileText)
|
|
92326
92274
|
return jsFilePath;
|
|
92327
|
-
if (computeSignature(jsFileText,
|
|
92275
|
+
if (computeSignature(jsFileText, host) !== buildInfo.bundle.js.hash)
|
|
92328
92276
|
return jsFilePath;
|
|
92329
92277
|
const sourceMapText = sourceMapFilePath && host.readFile(sourceMapFilePath);
|
|
92330
92278
|
if (sourceMapFilePath && !sourceMapText || config.options.inlineSourceMap)
|
|
92331
92279
|
return sourceMapFilePath || "inline sourcemap decoding";
|
|
92332
|
-
if (sourceMapFilePath && computeSignature(sourceMapText,
|
|
92280
|
+
if (sourceMapFilePath && computeSignature(sourceMapText, host) !== buildInfo.bundle.js.mapHash)
|
|
92333
92281
|
return sourceMapFilePath;
|
|
92334
92282
|
const declarationText = declarationFilePath && host.readFile(declarationFilePath);
|
|
92335
92283
|
if (declarationFilePath && !declarationText)
|
|
92336
92284
|
return declarationFilePath;
|
|
92337
|
-
if (declarationFilePath && computeSignature(declarationText,
|
|
92285
|
+
if (declarationFilePath && computeSignature(declarationText, host) !== buildInfo.bundle.dts.hash)
|
|
92338
92286
|
return declarationFilePath;
|
|
92339
92287
|
const declarationMapText = declarationMapPath && host.readFile(declarationMapPath);
|
|
92340
92288
|
if (declarationMapPath && !declarationMapText || config.options.inlineSourceMap)
|
|
92341
92289
|
return declarationMapPath || "inline sourcemap decoding";
|
|
92342
|
-
if (declarationMapPath && computeSignature(declarationMapText,
|
|
92290
|
+
if (declarationMapPath && computeSignature(declarationMapText, host) !== buildInfo.bundle.dts.mapHash)
|
|
92343
92291
|
return declarationMapPath;
|
|
92344
92292
|
const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
|
|
92345
92293
|
const ownPrependInput = createInputFilesWithFileTexts(
|
|
@@ -92409,7 +92357,7 @@ function emitUsingBuildInfoWorker(config, host, getCommandLine, customTransforme
|
|
|
92409
92357
|
getBuildInfo: (bundle) => {
|
|
92410
92358
|
const program = buildInfo.program;
|
|
92411
92359
|
if (program && changedDtsText !== void 0 && config.options.composite) {
|
|
92412
|
-
program.outSignature = computeSignature(changedDtsText,
|
|
92360
|
+
program.outSignature = computeSignature(changedDtsText, host, changedDtsData);
|
|
92413
92361
|
}
|
|
92414
92362
|
const { js, dts, sourceFiles } = buildInfo.bundle;
|
|
92415
92363
|
bundle.js.sources = js.sources;
|
|
@@ -92422,7 +92370,7 @@ function emitUsingBuildInfoWorker(config, host, getCommandLine, customTransforme
|
|
|
92422
92370
|
getSourceFileFromReference: returnUndefined,
|
|
92423
92371
|
redirectTargetsMap: createMultiMap(),
|
|
92424
92372
|
getFileIncludeReasons: notImplemented,
|
|
92425
|
-
createHash
|
|
92373
|
+
createHash: maybeBind(host, host.createHash)
|
|
92426
92374
|
};
|
|
92427
92375
|
emitFiles(
|
|
92428
92376
|
notImplementedResolver,
|
|
@@ -100479,7 +100427,7 @@ var BuilderState;
|
|
|
100479
100427
|
return oldState && !oldState.referencedMap === !newReferencedMap;
|
|
100480
100428
|
}
|
|
100481
100429
|
BuilderState2.canReuseOldState = canReuseOldState;
|
|
100482
|
-
function create(newProgram,
|
|
100430
|
+
function create(newProgram, oldState, disableUseFileVersionAsSignature) {
|
|
100483
100431
|
var _a2, _b, _c;
|
|
100484
100432
|
const fileInfos = /* @__PURE__ */ new Map();
|
|
100485
100433
|
const options = newProgram.getCompilerOptions();
|
|
@@ -100487,6 +100435,7 @@ var BuilderState;
|
|
|
100487
100435
|
const referencedMap = options.module !== 0 /* None */ && !isOutFile ? createManyToManyPathMap() : void 0;
|
|
100488
100436
|
const exportedModulesMap = referencedMap ? createManyToManyPathMap() : void 0;
|
|
100489
100437
|
const useOldState = canReuseOldState(referencedMap, oldState);
|
|
100438
|
+
const getCanonicalFileName = createGetCanonicalFileName(newProgram.useCaseSensitiveFileNames());
|
|
100490
100439
|
newProgram.getTypeChecker();
|
|
100491
100440
|
for (const sourceFile of newProgram.getSourceFiles()) {
|
|
100492
100441
|
const version2 = Debug.checkDefined(sourceFile.version, "Program intended to be used with Builder should have source files with versions set");
|
|
@@ -100525,30 +100474,29 @@ var BuilderState;
|
|
|
100525
100474
|
state.allFileNames = void 0;
|
|
100526
100475
|
}
|
|
100527
100476
|
BuilderState2.releaseCache = releaseCache2;
|
|
100528
|
-
function getFilesAffectedBy(state, programOfThisState, path, cancellationToken,
|
|
100477
|
+
function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, host) {
|
|
100529
100478
|
var _a2, _b;
|
|
100530
100479
|
const result = getFilesAffectedByWithOldState(
|
|
100531
100480
|
state,
|
|
100532
100481
|
programOfThisState,
|
|
100533
100482
|
path,
|
|
100534
100483
|
cancellationToken,
|
|
100535
|
-
|
|
100536
|
-
getCanonicalFileName
|
|
100484
|
+
host
|
|
100537
100485
|
);
|
|
100538
100486
|
(_a2 = state.oldSignatures) == null ? void 0 : _a2.clear();
|
|
100539
100487
|
(_b = state.oldExportedModulesMap) == null ? void 0 : _b.clear();
|
|
100540
100488
|
return result;
|
|
100541
100489
|
}
|
|
100542
100490
|
BuilderState2.getFilesAffectedBy = getFilesAffectedBy;
|
|
100543
|
-
function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken,
|
|
100491
|
+
function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, host) {
|
|
100544
100492
|
const sourceFile = programOfThisState.getSourceFileByPath(path);
|
|
100545
100493
|
if (!sourceFile) {
|
|
100546
100494
|
return emptyArray;
|
|
100547
100495
|
}
|
|
100548
|
-
if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken,
|
|
100496
|
+
if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, host)) {
|
|
100549
100497
|
return [sourceFile];
|
|
100550
100498
|
}
|
|
100551
|
-
return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken,
|
|
100499
|
+
return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, host);
|
|
100552
100500
|
}
|
|
100553
100501
|
BuilderState2.getFilesAffectedByWithOldState = getFilesAffectedByWithOldState;
|
|
100554
100502
|
function updateSignatureOfFile(state, signature, path) {
|
|
@@ -100556,7 +100504,7 @@ var BuilderState;
|
|
|
100556
100504
|
(state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = /* @__PURE__ */ new Set())).add(path);
|
|
100557
100505
|
}
|
|
100558
100506
|
BuilderState2.updateSignatureOfFile = updateSignatureOfFile;
|
|
100559
|
-
function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken,
|
|
100507
|
+
function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, host, useFileVersionAsSignature = state.useFileVersionAsSignature) {
|
|
100560
100508
|
var _a2;
|
|
100561
100509
|
if ((_a2 = state.hasCalledUpdateShapeSignature) == null ? void 0 : _a2.has(sourceFile.resolvedPath))
|
|
100562
100510
|
return false;
|
|
@@ -100569,10 +100517,10 @@ var BuilderState;
|
|
|
100569
100517
|
(fileName, text, _writeByteOrderMark, _onError, sourceFiles, data) => {
|
|
100570
100518
|
Debug.assert(isDeclarationFileName(fileName), `File extension for signature expected to be dts: Got:: ${fileName}`);
|
|
100571
100519
|
latestSignature = computeSignatureWithDiagnostics(
|
|
100520
|
+
programOfThisState,
|
|
100572
100521
|
sourceFile,
|
|
100573
100522
|
text,
|
|
100574
|
-
|
|
100575
|
-
getCanonicalFileName,
|
|
100523
|
+
host,
|
|
100576
100524
|
data
|
|
100577
100525
|
);
|
|
100578
100526
|
if (latestSignature !== prevSignature) {
|
|
@@ -100711,7 +100659,7 @@ var BuilderState;
|
|
|
100711
100659
|
}
|
|
100712
100660
|
return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
|
|
100713
100661
|
}
|
|
100714
|
-
function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken,
|
|
100662
|
+
function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, host) {
|
|
100715
100663
|
if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
|
|
100716
100664
|
return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
|
|
100717
100665
|
}
|
|
@@ -100727,7 +100675,7 @@ var BuilderState;
|
|
|
100727
100675
|
if (!seenFileNamesMap.has(currentPath)) {
|
|
100728
100676
|
const currentSourceFile = programOfThisState.getSourceFileByPath(currentPath);
|
|
100729
100677
|
seenFileNamesMap.set(currentPath, currentSourceFile);
|
|
100730
|
-
if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken,
|
|
100678
|
+
if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, host)) {
|
|
100731
100679
|
queue.push(...getReferencedByPaths(state, currentSourceFile.resolvedPath));
|
|
100732
100680
|
}
|
|
100733
100681
|
}
|
|
@@ -100769,9 +100717,9 @@ function getPendingEmitKind(optionsOrEmitKind, oldOptionsOrEmitKind) {
|
|
|
100769
100717
|
function hasSameKeys(map1, map2) {
|
|
100770
100718
|
return map1 === map2 || map1 !== void 0 && map2 !== void 0 && map1.size === map2.size && !forEachKey(map1, (key) => !map2.has(key));
|
|
100771
100719
|
}
|
|
100772
|
-
function createBuilderProgramState(newProgram,
|
|
100720
|
+
function createBuilderProgramState(newProgram, oldState, disableUseFileVersionAsSignature) {
|
|
100773
100721
|
var _a2, _b;
|
|
100774
|
-
const state = BuilderState.create(newProgram,
|
|
100722
|
+
const state = BuilderState.create(newProgram, oldState, disableUseFileVersionAsSignature);
|
|
100775
100723
|
state.program = newProgram;
|
|
100776
100724
|
const compilerOptions = newProgram.getCompilerOptions();
|
|
100777
100725
|
state.compilerOptions = compilerOptions;
|
|
@@ -100815,7 +100763,7 @@ function createBuilderProgramState(newProgram, getCanonicalFileName, oldState, d
|
|
|
100815
100763
|
return;
|
|
100816
100764
|
const diagnostics = oldState.semanticDiagnosticsPerFile.get(sourceFilePath);
|
|
100817
100765
|
if (diagnostics) {
|
|
100818
|
-
state.semanticDiagnosticsPerFile.set(sourceFilePath, oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram
|
|
100766
|
+
state.semanticDiagnosticsPerFile.set(sourceFilePath, oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram) : diagnostics);
|
|
100819
100767
|
if (!state.semanticDiagnosticsFromOldState) {
|
|
100820
100768
|
state.semanticDiagnosticsFromOldState = /* @__PURE__ */ new Set();
|
|
100821
100769
|
}
|
|
@@ -100875,10 +100823,11 @@ function addFileToChangeSet(state, path) {
|
|
|
100875
100823
|
function getEmitSignatureFromOldSignature(options, oldOptions, oldEmitSignature) {
|
|
100876
100824
|
return !!options.declarationMap === !!oldOptions.declarationMap ? oldEmitSignature : isString(oldEmitSignature) ? [oldEmitSignature] : oldEmitSignature[0];
|
|
100877
100825
|
}
|
|
100878
|
-
function convertToDiagnostics(diagnostics, newProgram
|
|
100826
|
+
function convertToDiagnostics(diagnostics, newProgram) {
|
|
100879
100827
|
if (!diagnostics.length)
|
|
100880
100828
|
return emptyArray;
|
|
100881
|
-
|
|
100829
|
+
let buildInfoDirectory;
|
|
100830
|
+
let getCanonicalFileName;
|
|
100882
100831
|
return diagnostics.map((diagnostic) => {
|
|
100883
100832
|
const result = convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPath3);
|
|
100884
100833
|
result.reportsUnnecessary = diagnostic.reportsUnnecessary;
|
|
@@ -100890,7 +100839,8 @@ function convertToDiagnostics(diagnostics, newProgram, getCanonicalFileName) {
|
|
|
100890
100839
|
return result;
|
|
100891
100840
|
});
|
|
100892
100841
|
function toPath3(path) {
|
|
100893
|
-
|
|
100842
|
+
buildInfoDirectory != null ? buildInfoDirectory : buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(getTsBuildInfoEmitOutputFilePath(newProgram.getCompilerOptions()), newProgram.getCurrentDirectory()));
|
|
100843
|
+
return toPath(path, buildInfoDirectory, getCanonicalFileName != null ? getCanonicalFileName : getCanonicalFileName = createGetCanonicalFileName(newProgram.useCaseSensitiveFileNames()));
|
|
100894
100844
|
}
|
|
100895
100845
|
}
|
|
100896
100846
|
function convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPath3) {
|
|
@@ -100932,7 +100882,7 @@ function restoreBuilderProgramEmitState(state, savedEmitState) {
|
|
|
100932
100882
|
function assertSourceFileOkWithoutNextAffectedCall(state, sourceFile) {
|
|
100933
100883
|
Debug.assert(!sourceFile || !state.affectedFiles || state.affectedFiles[state.affectedFilesIndex - 1] !== sourceFile || !state.semanticDiagnosticsPerFile.has(sourceFile.resolvedPath));
|
|
100934
100884
|
}
|
|
100935
|
-
function getNextAffectedFile(state, cancellationToken,
|
|
100885
|
+
function getNextAffectedFile(state, cancellationToken, host) {
|
|
100936
100886
|
var _a2, _b;
|
|
100937
100887
|
while (true) {
|
|
100938
100888
|
const { affectedFiles } = state;
|
|
@@ -100948,8 +100898,6 @@ function getNextAffectedFile(state, cancellationToken, computeHash, getCanonical
|
|
|
100948
100898
|
state,
|
|
100949
100899
|
affectedFile,
|
|
100950
100900
|
cancellationToken,
|
|
100951
|
-
computeHash,
|
|
100952
|
-
getCanonicalFileName,
|
|
100953
100901
|
host
|
|
100954
100902
|
);
|
|
100955
100903
|
return affectedFile;
|
|
@@ -100977,8 +100925,7 @@ function getNextAffectedFile(state, cancellationToken, computeHash, getCanonical
|
|
|
100977
100925
|
program,
|
|
100978
100926
|
nextKey.value,
|
|
100979
100927
|
cancellationToken,
|
|
100980
|
-
|
|
100981
|
-
getCanonicalFileName
|
|
100928
|
+
host
|
|
100982
100929
|
);
|
|
100983
100930
|
state.currentChangedFilePath = nextKey.value;
|
|
100984
100931
|
state.affectedFilesIndex = 0;
|
|
@@ -101030,7 +100977,7 @@ function removeDiagnosticsOfLibraryFiles(state) {
|
|
|
101030
100977
|
);
|
|
101031
100978
|
}
|
|
101032
100979
|
}
|
|
101033
|
-
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken,
|
|
100980
|
+
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, host) {
|
|
101034
100981
|
removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
|
|
101035
100982
|
if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
|
|
101036
100983
|
removeDiagnosticsOfLibraryFiles(state);
|
|
@@ -101039,8 +100986,7 @@ function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken
|
|
|
101039
100986
|
Debug.checkDefined(state.program),
|
|
101040
100987
|
affectedFile,
|
|
101041
100988
|
cancellationToken,
|
|
101042
|
-
|
|
101043
|
-
getCanonicalFileName
|
|
100989
|
+
host
|
|
101044
100990
|
);
|
|
101045
100991
|
return;
|
|
101046
100992
|
}
|
|
@@ -101050,12 +100996,10 @@ function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken
|
|
|
101050
100996
|
state,
|
|
101051
100997
|
affectedFile,
|
|
101052
100998
|
cancellationToken,
|
|
101053
|
-
computeHash,
|
|
101054
|
-
getCanonicalFileName,
|
|
101055
100999
|
host
|
|
101056
101000
|
);
|
|
101057
101001
|
}
|
|
101058
|
-
function handleDtsMayChangeOf(state, path, cancellationToken,
|
|
101002
|
+
function handleDtsMayChangeOf(state, path, cancellationToken, host) {
|
|
101059
101003
|
removeSemanticDiagnosticsOf(state, path);
|
|
101060
101004
|
if (!state.changedFilesSet.has(path)) {
|
|
101061
101005
|
const program = Debug.checkDefined(state.program);
|
|
@@ -101066,8 +101010,7 @@ function handleDtsMayChangeOf(state, path, cancellationToken, computeHash, getCa
|
|
|
101066
101010
|
program,
|
|
101067
101011
|
sourceFile,
|
|
101068
101012
|
cancellationToken,
|
|
101069
|
-
|
|
101070
|
-
getCanonicalFileName,
|
|
101013
|
+
host,
|
|
101071
101014
|
!host.disableUseFileVersionAsSignature
|
|
101072
101015
|
);
|
|
101073
101016
|
if (getEmitDeclarations(state.compilerOptions)) {
|
|
@@ -101089,7 +101032,7 @@ function isChangedSignature(state, path) {
|
|
|
101089
101032
|
const newSignature = Debug.checkDefined(state.fileInfos.get(path)).signature;
|
|
101090
101033
|
return newSignature !== oldSignature;
|
|
101091
101034
|
}
|
|
101092
|
-
function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken,
|
|
101035
|
+
function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, host) {
|
|
101093
101036
|
var _a2;
|
|
101094
101037
|
if (!((_a2 = state.fileInfos.get(filePath)) == null ? void 0 : _a2.affectsGlobalScope))
|
|
101095
101038
|
return false;
|
|
@@ -101097,14 +101040,12 @@ function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, com
|
|
|
101097
101040
|
state,
|
|
101098
101041
|
file.resolvedPath,
|
|
101099
101042
|
cancellationToken,
|
|
101100
|
-
computeHash,
|
|
101101
|
-
getCanonicalFileName,
|
|
101102
101043
|
host
|
|
101103
101044
|
));
|
|
101104
101045
|
removeDiagnosticsOfLibraryFiles(state);
|
|
101105
101046
|
return true;
|
|
101106
101047
|
}
|
|
101107
|
-
function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken,
|
|
101048
|
+
function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, host) {
|
|
101108
101049
|
var _a2;
|
|
101109
101050
|
if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
|
|
101110
101051
|
return;
|
|
@@ -101118,9 +101059,9 @@ function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile
|
|
|
101118
101059
|
const currentPath = queue.pop();
|
|
101119
101060
|
if (!seenFileNamesMap.has(currentPath)) {
|
|
101120
101061
|
seenFileNamesMap.set(currentPath, true);
|
|
101121
|
-
if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken,
|
|
101062
|
+
if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, host))
|
|
101122
101063
|
return;
|
|
101123
|
-
handleDtsMayChangeOf(state, currentPath, cancellationToken,
|
|
101064
|
+
handleDtsMayChangeOf(state, currentPath, cancellationToken, host);
|
|
101124
101065
|
if (isChangedSignature(state, currentPath)) {
|
|
101125
101066
|
const currentSourceFile = Debug.checkDefined(state.program).getSourceFileByPath(currentPath);
|
|
101126
101067
|
queue.push(...BuilderState.getReferencedByPaths(state, currentSourceFile.resolvedPath));
|
|
@@ -101130,7 +101071,7 @@ function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile
|
|
|
101130
101071
|
}
|
|
101131
101072
|
const seenFileAndExportsOfFile = /* @__PURE__ */ new Set();
|
|
101132
101073
|
(_a2 = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) == null ? void 0 : _a2.forEach((exportedFromPath) => {
|
|
101133
|
-
if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken,
|
|
101074
|
+
if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, host))
|
|
101134
101075
|
return true;
|
|
101135
101076
|
const references = state.referencedMap.getKeys(exportedFromPath);
|
|
101136
101077
|
return references && forEachKey(
|
|
@@ -101140,28 +101081,24 @@ function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile
|
|
|
101140
101081
|
filePath,
|
|
101141
101082
|
seenFileAndExportsOfFile,
|
|
101142
101083
|
cancellationToken,
|
|
101143
|
-
computeHash,
|
|
101144
|
-
getCanonicalFileName,
|
|
101145
101084
|
host
|
|
101146
101085
|
)
|
|
101147
101086
|
);
|
|
101148
101087
|
});
|
|
101149
101088
|
}
|
|
101150
|
-
function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken,
|
|
101089
|
+
function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, host) {
|
|
101151
101090
|
var _a2, _b;
|
|
101152
101091
|
if (!tryAddToSet(seenFileAndExportsOfFile, filePath))
|
|
101153
101092
|
return void 0;
|
|
101154
|
-
if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken,
|
|
101093
|
+
if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, host))
|
|
101155
101094
|
return true;
|
|
101156
|
-
handleDtsMayChangeOf(state, filePath, cancellationToken,
|
|
101095
|
+
handleDtsMayChangeOf(state, filePath, cancellationToken, host);
|
|
101157
101096
|
(_a2 = state.exportedModulesMap.getKeys(filePath)) == null ? void 0 : _a2.forEach(
|
|
101158
101097
|
(exportedFromPath) => handleDtsMayChangeOfFileAndExportsOfFile(
|
|
101159
101098
|
state,
|
|
101160
101099
|
exportedFromPath,
|
|
101161
101100
|
seenFileAndExportsOfFile,
|
|
101162
101101
|
cancellationToken,
|
|
101163
|
-
computeHash,
|
|
101164
|
-
getCanonicalFileName,
|
|
101165
101102
|
host
|
|
101166
101103
|
)
|
|
101167
101104
|
);
|
|
@@ -101170,8 +101107,6 @@ function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndEx
|
|
|
101170
101107
|
state,
|
|
101171
101108
|
referencingFilePath,
|
|
101172
101109
|
cancellationToken,
|
|
101173
|
-
computeHash,
|
|
101174
|
-
getCanonicalFileName,
|
|
101175
101110
|
host
|
|
101176
101111
|
)
|
|
101177
101112
|
);
|
|
@@ -101200,9 +101135,10 @@ function getBinderAndCheckerDiagnosticsOfFile(state, sourceFile, cancellationTok
|
|
|
101200
101135
|
function isProgramBundleEmitBuildInfo(info) {
|
|
101201
101136
|
return !!outFile(info.options || {});
|
|
101202
101137
|
}
|
|
101203
|
-
function getBuildInfo2(state,
|
|
101138
|
+
function getBuildInfo2(state, bundle) {
|
|
101204
101139
|
var _a2, _b, _c;
|
|
101205
101140
|
const currentDirectory = Debug.checkDefined(state.program).getCurrentDirectory();
|
|
101141
|
+
const getCanonicalFileName = createGetCanonicalFileName(state.program.useCaseSensitiveFileNames());
|
|
101206
101142
|
const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
|
|
101207
101143
|
const latestChangedDtsFile = state.latestChangedDtsFile ? relativeToBuildInfoEnsuringAbsolutePath(state.latestChangedDtsFile) : void 0;
|
|
101208
101144
|
const fileNames = [];
|
|
@@ -101421,8 +101357,9 @@ function getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldP
|
|
|
101421
101357
|
function getTextHandlingSourceMapForSignature(text, data) {
|
|
101422
101358
|
return (data == null ? void 0 : data.sourceMapUrlPos) !== void 0 ? text.substring(0, data.sourceMapUrlPos) : text;
|
|
101423
101359
|
}
|
|
101424
|
-
function computeSignatureWithDiagnostics(sourceFile, text,
|
|
101425
|
-
var _a2;
|
|
101360
|
+
function computeSignatureWithDiagnostics(program, sourceFile, text, host, data) {
|
|
101361
|
+
var _a2, _b;
|
|
101362
|
+
let getCanonicalFileName;
|
|
101426
101363
|
text = getTextHandlingSourceMapForSignature(text, data);
|
|
101427
101364
|
let sourceFileDirectory;
|
|
101428
101365
|
if ((_a2 = data == null ? void 0 : data.diagnostics) == null ? void 0 : _a2.length) {
|
|
@@ -101430,7 +101367,7 @@ function computeSignatureWithDiagnostics(sourceFile, text, computeHash, getCanon
|
|
|
101430
101367
|
(diagnostic) => `${locationInfo(diagnostic)}${DiagnosticCategory[diagnostic.category]}${diagnostic.code}: ${flattenDiagnosticMessageText2(diagnostic.messageText)}`
|
|
101431
101368
|
).join("\n");
|
|
101432
101369
|
}
|
|
101433
|
-
return (
|
|
101370
|
+
return ((_b = host.createHash) != null ? _b : generateDjb2Hash)(text);
|
|
101434
101371
|
function flattenDiagnosticMessageText2(diagnostic) {
|
|
101435
101372
|
return isString(diagnostic) ? diagnostic : diagnostic === void 0 ? "" : !diagnostic.next ? diagnostic.messageText : diagnostic.messageText + diagnostic.next.map(flattenDiagnosticMessageText2).join("\n");
|
|
101436
101373
|
}
|
|
@@ -101439,11 +101376,16 @@ function computeSignatureWithDiagnostics(sourceFile, text, computeHash, getCanon
|
|
|
101439
101376
|
return `(${diagnostic.start},${diagnostic.length})`;
|
|
101440
101377
|
if (sourceFileDirectory === void 0)
|
|
101441
101378
|
sourceFileDirectory = getDirectoryPath(sourceFile.resolvedPath);
|
|
101442
|
-
return `${ensurePathIsNonModuleName(getRelativePathFromDirectory(
|
|
101379
|
+
return `${ensurePathIsNonModuleName(getRelativePathFromDirectory(
|
|
101380
|
+
sourceFileDirectory,
|
|
101381
|
+
diagnostic.file.resolvedPath,
|
|
101382
|
+
getCanonicalFileName != null ? getCanonicalFileName : getCanonicalFileName = createGetCanonicalFileName(program.useCaseSensitiveFileNames())
|
|
101383
|
+
))}(${diagnostic.start},${diagnostic.length})`;
|
|
101443
101384
|
}
|
|
101444
101385
|
}
|
|
101445
|
-
function computeSignature(text,
|
|
101446
|
-
|
|
101386
|
+
function computeSignature(text, host, data) {
|
|
101387
|
+
var _a2;
|
|
101388
|
+
return ((_a2 = host.createHash) != null ? _a2 : generateDjb2Hash)(getTextHandlingSourceMapForSignature(text, data));
|
|
101447
101389
|
}
|
|
101448
101390
|
function createBuilderProgram(kind, { newProgram, host, oldProgram, configFileParsingDiagnostics }) {
|
|
101449
101391
|
let oldState = oldProgram && oldProgram.getState();
|
|
@@ -101452,10 +101394,8 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
|
|
|
101452
101394
|
oldState = void 0;
|
|
101453
101395
|
return oldProgram;
|
|
101454
101396
|
}
|
|
101455
|
-
const
|
|
101456
|
-
|
|
101457
|
-
const state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
|
|
101458
|
-
newProgram.getBuildInfo = (bundle) => getBuildInfo2(state, getCanonicalFileName, bundle);
|
|
101397
|
+
const state = createBuilderProgramState(newProgram, oldState, host.disableUseFileVersionAsSignature);
|
|
101398
|
+
newProgram.getBuildInfo = (bundle) => getBuildInfo2(state, bundle);
|
|
101459
101399
|
newProgram = void 0;
|
|
101460
101400
|
oldProgram = void 0;
|
|
101461
101401
|
oldState = void 0;
|
|
@@ -101489,7 +101429,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
|
|
|
101489
101429
|
}
|
|
101490
101430
|
function emitNextAffectedFile(writeFile2, cancellationToken, emitOnlyDtsFiles, customTransformers) {
|
|
101491
101431
|
var _a2, _b, _c, _d, _e;
|
|
101492
|
-
let affected = getNextAffectedFile(state, cancellationToken,
|
|
101432
|
+
let affected = getNextAffectedFile(state, cancellationToken, host);
|
|
101493
101433
|
const programEmitKind = getBuilderFileEmit(state.compilerOptions);
|
|
101494
101434
|
let emitKind = emitOnlyDtsFiles ? programEmitKind & 24 /* AllDts */ : programEmitKind;
|
|
101495
101435
|
if (!affected) {
|
|
@@ -101563,10 +101503,10 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
|
|
|
101563
101503
|
const info = state.fileInfos.get(file.resolvedPath);
|
|
101564
101504
|
if (info.signature === file.version) {
|
|
101565
101505
|
const signature = computeSignatureWithDiagnostics(
|
|
101506
|
+
state.program,
|
|
101566
101507
|
file,
|
|
101567
101508
|
text,
|
|
101568
|
-
|
|
101569
|
-
getCanonicalFileName,
|
|
101509
|
+
host,
|
|
101570
101510
|
data
|
|
101571
101511
|
);
|
|
101572
101512
|
if (!((_a2 = data == null ? void 0 : data.diagnostics) == null ? void 0 : _a2.length))
|
|
@@ -101610,7 +101550,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
|
|
|
101610
101550
|
state.program.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data);
|
|
101611
101551
|
function handleNewSignature(oldSignatureFormat, newSignature) {
|
|
101612
101552
|
const oldSignature = !oldSignatureFormat || isString(oldSignatureFormat) ? oldSignatureFormat : oldSignatureFormat[0];
|
|
101613
|
-
newSignature != null ? newSignature : newSignature = computeSignature(text,
|
|
101553
|
+
newSignature != null ? newSignature : newSignature = computeSignature(text, host, data);
|
|
101614
101554
|
if (newSignature === oldSignature) {
|
|
101615
101555
|
if (oldSignatureFormat === oldSignature)
|
|
101616
101556
|
return void 0;
|
|
@@ -101666,7 +101606,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
|
|
|
101666
101606
|
}
|
|
101667
101607
|
function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) {
|
|
101668
101608
|
while (true) {
|
|
101669
|
-
const affected = getNextAffectedFile(state, cancellationToken,
|
|
101609
|
+
const affected = getNextAffectedFile(state, cancellationToken, host);
|
|
101670
101610
|
let result;
|
|
101671
101611
|
if (!affected)
|
|
101672
101612
|
return void 0;
|