typescript 5.6.0-dev.20240625 → 5.6.0-dev.20240627
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +154 -164
- package/lib/tsserver.js +31 -17
- package/lib/typescript.d.ts +14 -14
- package/lib/typescript.js +259 -290
- package/lib/typingsInstaller.js +2 -2
- package/package.json +15 -14
package/lib/typescript.js
CHANGED
|
@@ -1019,6 +1019,8 @@ __export(typescript_exports, {
|
|
|
1019
1019
|
getResolvePackageJsonExports: () => getResolvePackageJsonExports,
|
|
1020
1020
|
getResolvePackageJsonImports: () => getResolvePackageJsonImports,
|
|
1021
1021
|
getResolvedExternalModuleName: () => getResolvedExternalModuleName,
|
|
1022
|
+
getResolvedModuleFromResolution: () => getResolvedModuleFromResolution,
|
|
1023
|
+
getResolvedTypeReferenceDirectiveFromResolution: () => getResolvedTypeReferenceDirectiveFromResolution,
|
|
1022
1024
|
getRestIndicatorOfBindingOrAssignmentElement: () => getRestIndicatorOfBindingOrAssignmentElement,
|
|
1023
1025
|
getRestParameterElementType: () => getRestParameterElementType,
|
|
1024
1026
|
getRightMostAssignedExpression: () => getRightMostAssignedExpression,
|
|
@@ -2377,7 +2379,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2377
2379
|
|
|
2378
2380
|
// src/compiler/corePublic.ts
|
|
2379
2381
|
var versionMajorMinor = "5.6";
|
|
2380
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2382
|
+
var version = `${versionMajorMinor}.0-dev.20240627`;
|
|
2381
2383
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2382
2384
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2383
2385
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -9493,7 +9495,7 @@ var Diagnostics = {
|
|
|
9493
9495
|
Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1321, 1 /* Error */, "Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321", "Type of 'yield' operand in an async generator must either be a valid promise or must not contain a callable 'then' member."),
|
|
9494
9496
|
Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1322, 1 /* Error */, "Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322", "Type of iterated elements of a 'yield*' operand must either be a valid promise or must not contain a callable 'then' member."),
|
|
9495
9497
|
Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node16_or_nodenext: diag(1323, 1 /* Error */, "Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd__1323", "Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'."),
|
|
9496
|
-
|
|
9498
|
+
Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_nodenext_or_preserve: diag(1324, 1 /* Error */, "Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_nodene_1324", "Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'nodenext', or 'preserve'."),
|
|
9497
9499
|
Argument_of_dynamic_import_cannot_be_spread_element: diag(1325, 1 /* Error */, "Argument_of_dynamic_import_cannot_be_spread_element_1325", "Argument of dynamic import cannot be spread element."),
|
|
9498
9500
|
This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments: diag(1326, 1 /* Error */, "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326", "This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments."),
|
|
9499
9501
|
String_literal_with_double_quotes_expected: diag(1327, 1 /* Error */, "String_literal_with_double_quotes_expected_1327", "String literal with double quotes expected."),
|
|
@@ -16341,6 +16343,12 @@ function projectReferenceIsEqualTo(oldRef, newRef) {
|
|
|
16341
16343
|
function moduleResolutionIsEqualTo(oldResolution, newResolution) {
|
|
16342
16344
|
return oldResolution === newResolution || oldResolution.resolvedModule === newResolution.resolvedModule || !!oldResolution.resolvedModule && !!newResolution.resolvedModule && oldResolution.resolvedModule.isExternalLibraryImport === newResolution.resolvedModule.isExternalLibraryImport && oldResolution.resolvedModule.extension === newResolution.resolvedModule.extension && oldResolution.resolvedModule.resolvedFileName === newResolution.resolvedModule.resolvedFileName && oldResolution.resolvedModule.originalPath === newResolution.resolvedModule.originalPath && packageIdIsEqual(oldResolution.resolvedModule.packageId, newResolution.resolvedModule.packageId) && oldResolution.alternateResult === newResolution.alternateResult;
|
|
16343
16345
|
}
|
|
16346
|
+
function getResolvedModuleFromResolution(resolution) {
|
|
16347
|
+
return resolution.resolvedModule;
|
|
16348
|
+
}
|
|
16349
|
+
function getResolvedTypeReferenceDirectiveFromResolution(resolution) {
|
|
16350
|
+
return resolution.resolvedTypeReferenceDirective;
|
|
16351
|
+
}
|
|
16344
16352
|
function createModuleNotFoundChain(sourceFile, host, moduleReference, mode, packageName) {
|
|
16345
16353
|
var _a;
|
|
16346
16354
|
const alternateResult = (_a = host.getResolvedModule(sourceFile, moduleReference, mode)) == null ? void 0 : _a.alternateResult;
|
|
@@ -30045,17 +30053,22 @@ var disposeResourcesHelper = {
|
|
|
30045
30053
|
env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
30046
30054
|
env.hasError = true;
|
|
30047
30055
|
}
|
|
30056
|
+
var r, s = 0;
|
|
30048
30057
|
function next() {
|
|
30049
|
-
while (env.stack.
|
|
30050
|
-
var rec = env.stack.pop();
|
|
30058
|
+
while (r = env.stack.pop()) {
|
|
30051
30059
|
try {
|
|
30052
|
-
|
|
30053
|
-
if (
|
|
30060
|
+
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
30061
|
+
if (r.dispose) {
|
|
30062
|
+
var result = r.dispose.call(r.value);
|
|
30063
|
+
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
30064
|
+
}
|
|
30065
|
+
else s |= 1;
|
|
30054
30066
|
}
|
|
30055
30067
|
catch (e) {
|
|
30056
30068
|
fail(e);
|
|
30057
30069
|
}
|
|
30058
30070
|
}
|
|
30071
|
+
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
30059
30072
|
if (env.hasError) throw env.error;
|
|
30060
30073
|
}
|
|
30061
30074
|
return next();
|
|
@@ -91772,6 +91785,7 @@ function createTypeChecker(host) {
|
|
|
91772
91785
|
}
|
|
91773
91786
|
case 7 /* ES2022 */:
|
|
91774
91787
|
case 99 /* ESNext */:
|
|
91788
|
+
case 200 /* Preserve */:
|
|
91775
91789
|
case 4 /* System */:
|
|
91776
91790
|
if (languageVersion >= 4 /* ES2017 */) {
|
|
91777
91791
|
break;
|
|
@@ -92387,11 +92401,11 @@ function createTypeChecker(host) {
|
|
|
92387
92401
|
return grammarErrorOnNode(node, Diagnostics.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments);
|
|
92388
92402
|
}
|
|
92389
92403
|
const nodeArguments = node.arguments;
|
|
92390
|
-
if (moduleKind !== 99 /* ESNext */ && moduleKind !== 199 /* NodeNext */ && moduleKind !== 100 /* Node16 */) {
|
|
92404
|
+
if (moduleKind !== 99 /* ESNext */ && moduleKind !== 199 /* NodeNext */ && moduleKind !== 100 /* Node16 */ && moduleKind !== 200 /* Preserve */) {
|
|
92391
92405
|
checkGrammarForDisallowedTrailingComma(nodeArguments);
|
|
92392
92406
|
if (nodeArguments.length > 1) {
|
|
92393
92407
|
const importAttributesArgument = nodeArguments[1];
|
|
92394
|
-
return grammarErrorOnNode(importAttributesArgument, Diagnostics.
|
|
92408
|
+
return grammarErrorOnNode(importAttributesArgument, Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_nodenext_or_preserve);
|
|
92395
92409
|
}
|
|
92396
92410
|
}
|
|
92397
92411
|
if (nodeArguments.length === 0 || nodeArguments.length > 2) {
|
|
@@ -124788,12 +124802,18 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
124788
124802
|
}
|
|
124789
124803
|
function resolveModuleNamesWorker(moduleNames, containingFile, reusedNames) {
|
|
124790
124804
|
var _a2, _b2;
|
|
124791
|
-
if (!moduleNames.length) return emptyArray;
|
|
124792
124805
|
const containingFileName = getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory);
|
|
124793
124806
|
const redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
124794
124807
|
(_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Program, "resolveModuleNamesWorker", { containingFileName });
|
|
124795
124808
|
mark("beforeResolveModule");
|
|
124796
|
-
const result = actualResolveModuleNamesWorker(
|
|
124809
|
+
const result = actualResolveModuleNamesWorker(
|
|
124810
|
+
moduleNames,
|
|
124811
|
+
containingFileName,
|
|
124812
|
+
redirectedReference,
|
|
124813
|
+
options,
|
|
124814
|
+
containingFile,
|
|
124815
|
+
reusedNames
|
|
124816
|
+
);
|
|
124797
124817
|
mark("afterResolveModule");
|
|
124798
124818
|
measure("ResolveModule", "beforeResolveModule", "afterResolveModule");
|
|
124799
124819
|
(_b2 = tracing) == null ? void 0 : _b2.pop();
|
|
@@ -124801,13 +124821,19 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
124801
124821
|
}
|
|
124802
124822
|
function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile, reusedNames) {
|
|
124803
124823
|
var _a2, _b2;
|
|
124804
|
-
if (!typeDirectiveNames.length) return [];
|
|
124805
124824
|
const containingSourceFile = !isString(containingFile) ? containingFile : void 0;
|
|
124806
124825
|
const containingFileName = !isString(containingFile) ? getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory) : containingFile;
|
|
124807
124826
|
const redirectedReference = containingSourceFile && getRedirectReferenceForResolution(containingSourceFile);
|
|
124808
124827
|
(_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Program, "resolveTypeReferenceDirectiveNamesWorker", { containingFileName });
|
|
124809
124828
|
mark("beforeResolveTypeReference");
|
|
124810
|
-
const result = actualResolveTypeReferenceDirectiveNamesWorker(
|
|
124829
|
+
const result = actualResolveTypeReferenceDirectiveNamesWorker(
|
|
124830
|
+
typeDirectiveNames,
|
|
124831
|
+
containingFileName,
|
|
124832
|
+
redirectedReference,
|
|
124833
|
+
options,
|
|
124834
|
+
containingSourceFile,
|
|
124835
|
+
reusedNames
|
|
124836
|
+
);
|
|
124811
124837
|
mark("afterResolveTypeReference");
|
|
124812
124838
|
measure("ResolveTypeReference", "beforeResolveTypeReference", "afterResolveTypeReference");
|
|
124813
124839
|
(_b2 = tracing) == null ? void 0 : _b2.pop();
|
|
@@ -124877,144 +124903,123 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
124877
124903
|
}
|
|
124878
124904
|
return classifiableNames;
|
|
124879
124905
|
}
|
|
124880
|
-
function resolveModuleNamesReusingOldState(moduleNames,
|
|
124881
|
-
|
|
124882
|
-
|
|
124883
|
-
|
|
124884
|
-
|
|
124885
|
-
|
|
124886
|
-
|
|
124887
|
-
|
|
124888
|
-
|
|
124889
|
-
|
|
124890
|
-
|
|
124891
|
-
|
|
124892
|
-
|
|
124893
|
-
|
|
124894
|
-
|
|
124895
|
-
|
|
124896
|
-
if (
|
|
124897
|
-
|
|
124898
|
-
if (oldResolution == null ? void 0 : oldResolution.resolvedModule) {
|
|
124899
|
-
if (isTraceEnabled(options, host)) {
|
|
124900
|
-
trace(
|
|
124901
|
-
host,
|
|
124902
|
-
oldResolution.resolvedModule.packageId ? Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 : Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2,
|
|
124903
|
-
moduleName.text,
|
|
124904
|
-
getNormalizedAbsolutePath(file.originalFileName, currentDirectory),
|
|
124905
|
-
oldResolution.resolvedModule.resolvedFileName,
|
|
124906
|
-
oldResolution.resolvedModule.packageId && packageIdToString(oldResolution.resolvedModule.packageId)
|
|
124907
|
-
);
|
|
124908
|
-
}
|
|
124909
|
-
(result ?? (result = new Array(moduleNames.length)))[i] = oldResolution;
|
|
124910
|
-
(reusedNames ?? (reusedNames = [])).push(moduleName);
|
|
124911
|
-
continue;
|
|
124912
|
-
}
|
|
124913
|
-
}
|
|
124914
|
-
let resolvesToAmbientModuleInNonModifiedFile = false;
|
|
124915
|
-
if (contains(file.ambientModuleNames, moduleName.text)) {
|
|
124916
|
-
resolvesToAmbientModuleInNonModifiedFile = true;
|
|
124917
|
-
if (isTraceEnabled(options, host)) {
|
|
124918
|
-
trace(host, Diagnostics.Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1, moduleName.text, getNormalizedAbsolutePath(file.originalFileName, currentDirectory));
|
|
124919
|
-
}
|
|
124920
|
-
} else {
|
|
124921
|
-
resolvesToAmbientModuleInNonModifiedFile = moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName);
|
|
124922
|
-
}
|
|
124923
|
-
if (resolvesToAmbientModuleInNonModifiedFile) {
|
|
124924
|
-
(result || (result = new Array(moduleNames.length)))[i] = predictedToResolveToAmbientModuleMarker;
|
|
124925
|
-
} else {
|
|
124926
|
-
(unknownModuleNames ?? (unknownModuleNames = [])).push(moduleName);
|
|
124906
|
+
function resolveModuleNamesReusingOldState(moduleNames, containingFile) {
|
|
124907
|
+
return resolveNamesReusingOldState({
|
|
124908
|
+
entries: moduleNames,
|
|
124909
|
+
containingFile,
|
|
124910
|
+
containingSourceFile: containingFile,
|
|
124911
|
+
redirectedReference: getRedirectReferenceForResolution(containingFile),
|
|
124912
|
+
nameAndModeGetter: moduleResolutionNameAndModeGetter,
|
|
124913
|
+
resolutionWorker: resolveModuleNamesWorker,
|
|
124914
|
+
getResolutionFromOldProgram: (name, mode) => oldProgram == null ? void 0 : oldProgram.getResolvedModule(containingFile, name, mode),
|
|
124915
|
+
getResolved: getResolvedModuleFromResolution,
|
|
124916
|
+
canReuseResolutionsInFile: () => containingFile === (oldProgram == null ? void 0 : oldProgram.getSourceFile(containingFile.fileName)) && !hasInvalidatedResolutions(containingFile.path),
|
|
124917
|
+
isEntryResolvingToAmbientModule: moduleNameResolvesToAmbientModule
|
|
124918
|
+
});
|
|
124919
|
+
}
|
|
124920
|
+
function moduleNameResolvesToAmbientModule(moduleName, file) {
|
|
124921
|
+
if (contains(file.ambientModuleNames, moduleName.text)) {
|
|
124922
|
+
if (isTraceEnabled(options, host)) {
|
|
124923
|
+
trace(host, Diagnostics.Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1, moduleName.text, getNormalizedAbsolutePath(file.originalFileName, currentDirectory));
|
|
124927
124924
|
}
|
|
124925
|
+
return true;
|
|
124926
|
+
} else {
|
|
124927
|
+
return moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName, file);
|
|
124928
124928
|
}
|
|
124929
|
-
|
|
124930
|
-
|
|
124931
|
-
|
|
124932
|
-
|
|
124929
|
+
}
|
|
124930
|
+
function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName, file) {
|
|
124931
|
+
var _a2;
|
|
124932
|
+
const resolutionToFile = (_a2 = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, getModeForUsageLocation2(file, moduleName))) == null ? void 0 : _a2.resolvedModule;
|
|
124933
|
+
const resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
|
|
124934
|
+
if (resolutionToFile && resolvedFile) {
|
|
124935
|
+
return false;
|
|
124933
124936
|
}
|
|
124934
|
-
|
|
124935
|
-
|
|
124936
|
-
|
|
124937
|
-
result[i] = resolutions[j];
|
|
124938
|
-
j++;
|
|
124939
|
-
}
|
|
124937
|
+
const unmodifiedFile = ambientModuleNameToUnmodifiedFileName.get(moduleName.text);
|
|
124938
|
+
if (!unmodifiedFile) {
|
|
124939
|
+
return false;
|
|
124940
124940
|
}
|
|
124941
|
-
|
|
124942
|
-
|
|
124943
|
-
function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName) {
|
|
124944
|
-
var _a2;
|
|
124945
|
-
const resolutionToFile = (_a2 = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, getModeForUsageLocation2(file, moduleName))) == null ? void 0 : _a2.resolvedModule;
|
|
124946
|
-
const resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
|
|
124947
|
-
if (resolutionToFile && resolvedFile) {
|
|
124948
|
-
return false;
|
|
124949
|
-
}
|
|
124950
|
-
const unmodifiedFile = ambientModuleNameToUnmodifiedFileName.get(moduleName.text);
|
|
124951
|
-
if (!unmodifiedFile) {
|
|
124952
|
-
return false;
|
|
124953
|
-
}
|
|
124954
|
-
if (isTraceEnabled(options, host)) {
|
|
124955
|
-
trace(host, Diagnostics.Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified, moduleName.text, unmodifiedFile);
|
|
124956
|
-
}
|
|
124957
|
-
return true;
|
|
124941
|
+
if (isTraceEnabled(options, host)) {
|
|
124942
|
+
trace(host, Diagnostics.Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified, moduleName.text, unmodifiedFile);
|
|
124958
124943
|
}
|
|
124944
|
+
return true;
|
|
124959
124945
|
}
|
|
124960
124946
|
function resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectiveNames, containingFile) {
|
|
124961
|
-
|
|
124962
|
-
|
|
124963
|
-
|
|
124964
|
-
|
|
124947
|
+
const containingSourceFile = !isString(containingFile) ? containingFile : void 0;
|
|
124948
|
+
return resolveNamesReusingOldState({
|
|
124949
|
+
entries: typeDirectiveNames,
|
|
124950
|
+
containingFile,
|
|
124951
|
+
containingSourceFile,
|
|
124952
|
+
redirectedReference: containingSourceFile && getRedirectReferenceForResolution(containingSourceFile),
|
|
124953
|
+
nameAndModeGetter: typeReferenceResolutionNameAndModeGetter,
|
|
124954
|
+
resolutionWorker: resolveTypeReferenceDirectiveNamesWorker,
|
|
124955
|
+
getResolutionFromOldProgram: (name, mode) => {
|
|
124956
|
+
var _a2;
|
|
124957
|
+
return containingSourceFile ? oldProgram == null ? void 0 : oldProgram.getResolvedTypeReferenceDirective(containingSourceFile, name, mode) : (_a2 = oldProgram == null ? void 0 : oldProgram.getAutomaticTypeDirectiveResolutions()) == null ? void 0 : _a2.get(name, mode);
|
|
124958
|
+
},
|
|
124959
|
+
getResolved: getResolvedTypeReferenceDirectiveFromResolution,
|
|
124960
|
+
canReuseResolutionsInFile: () => containingSourceFile ? containingSourceFile === (oldProgram == null ? void 0 : oldProgram.getSourceFile(containingSourceFile.fileName)) && !hasInvalidatedResolutions(containingSourceFile.path) : !hasInvalidatedResolutions(toPath3(containingFile))
|
|
124961
|
+
});
|
|
124962
|
+
}
|
|
124963
|
+
function resolveNamesReusingOldState({
|
|
124964
|
+
entries,
|
|
124965
|
+
containingFile,
|
|
124966
|
+
containingSourceFile,
|
|
124967
|
+
redirectedReference,
|
|
124968
|
+
nameAndModeGetter,
|
|
124969
|
+
resolutionWorker,
|
|
124970
|
+
getResolutionFromOldProgram,
|
|
124971
|
+
getResolved,
|
|
124972
|
+
canReuseResolutionsInFile,
|
|
124973
|
+
isEntryResolvingToAmbientModule
|
|
124974
|
+
}) {
|
|
124975
|
+
if (!entries.length) return emptyArray;
|
|
124976
|
+
if (structureIsReused === 0 /* Not */ && (!isEntryResolvingToAmbientModule || !containingSourceFile.ambientModuleNames.length)) {
|
|
124977
|
+
return resolutionWorker(
|
|
124978
|
+
entries,
|
|
124965
124979
|
containingFile,
|
|
124966
124980
|
/*reusedNames*/
|
|
124967
124981
|
void 0
|
|
124968
124982
|
);
|
|
124969
124983
|
}
|
|
124970
|
-
let
|
|
124984
|
+
let unknownEntries;
|
|
124985
|
+
let unknownEntryIndices;
|
|
124971
124986
|
let result;
|
|
124972
124987
|
let reusedNames;
|
|
124973
|
-
const
|
|
124974
|
-
|
|
124975
|
-
|
|
124976
|
-
|
|
124977
|
-
|
|
124978
|
-
|
|
124979
|
-
const
|
|
124980
|
-
const
|
|
124981
|
-
|
|
124982
|
-
if (oldResolution == null ? void 0 : oldResolution.resolvedTypeReferenceDirective) {
|
|
124988
|
+
const reuseResolutions = canReuseResolutionsInFile();
|
|
124989
|
+
for (let i = 0; i < entries.length; i++) {
|
|
124990
|
+
const entry = entries[i];
|
|
124991
|
+
if (reuseResolutions) {
|
|
124992
|
+
const name = nameAndModeGetter.getName(entry);
|
|
124993
|
+
const mode = nameAndModeGetter.getMode(entry, containingSourceFile, (redirectedReference == null ? void 0 : redirectedReference.commandLine.options) ?? options);
|
|
124994
|
+
const oldResolution = getResolutionFromOldProgram(name, mode);
|
|
124995
|
+
const oldResolved = oldResolution && getResolved(oldResolution);
|
|
124996
|
+
if (oldResolved) {
|
|
124983
124997
|
if (isTraceEnabled(options, host)) {
|
|
124984
124998
|
trace(
|
|
124985
124999
|
host,
|
|
124986
|
-
|
|
124987
|
-
|
|
124988
|
-
|
|
124989
|
-
|
|
124990
|
-
|
|
125000
|
+
resolutionWorker === resolveModuleNamesWorker ? oldResolved.packageId ? Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 : Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2 : oldResolved.packageId ? Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 : Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2,
|
|
125001
|
+
name,
|
|
125002
|
+
containingSourceFile ? getNormalizedAbsolutePath(containingSourceFile.originalFileName, currentDirectory) : containingFile,
|
|
125003
|
+
oldResolved.resolvedFileName,
|
|
125004
|
+
oldResolved.packageId && packageIdToString(oldResolved.packageId)
|
|
124991
125005
|
);
|
|
124992
125006
|
}
|
|
124993
|
-
(result ?? (result = new Array(
|
|
125007
|
+
(result ?? (result = new Array(entries.length)))[i] = oldResolution;
|
|
124994
125008
|
(reusedNames ?? (reusedNames = [])).push(entry);
|
|
124995
125009
|
continue;
|
|
124996
125010
|
}
|
|
124997
125011
|
}
|
|
124998
|
-
(
|
|
124999
|
-
|
|
125000
|
-
|
|
125001
|
-
|
|
125002
|
-
|
|
125003
|
-
containingFile,
|
|
125004
|
-
reusedNames
|
|
125005
|
-
);
|
|
125006
|
-
if (!result) {
|
|
125007
|
-
Debug.assert(resolutions.length === typeDirectiveNames.length);
|
|
125008
|
-
return resolutions;
|
|
125009
|
-
}
|
|
125010
|
-
let j = 0;
|
|
125011
|
-
for (let i = 0; i < result.length; i++) {
|
|
125012
|
-
if (!result[i]) {
|
|
125013
|
-
result[i] = resolutions[j];
|
|
125014
|
-
j++;
|
|
125012
|
+
if (isEntryResolvingToAmbientModule == null ? void 0 : isEntryResolvingToAmbientModule(entry, containingFile)) {
|
|
125013
|
+
(result ?? (result = new Array(entries.length)))[i] = emptyResolution;
|
|
125014
|
+
} else {
|
|
125015
|
+
(unknownEntries ?? (unknownEntries = [])).push(entry);
|
|
125016
|
+
(unknownEntryIndices ?? (unknownEntryIndices = [])).push(i);
|
|
125015
125017
|
}
|
|
125016
125018
|
}
|
|
125017
|
-
|
|
125019
|
+
if (!unknownEntries) return result;
|
|
125020
|
+
const resolutions = resolutionWorker(unknownEntries, containingFile, reusedNames);
|
|
125021
|
+
if (!result) return resolutions;
|
|
125022
|
+
resolutions.forEach((resolution, index) => result[unknownEntryIndices[index]] = resolution);
|
|
125018
125023
|
return result;
|
|
125019
125024
|
}
|
|
125020
125025
|
function canReuseProjectReferences() {
|
|
@@ -129711,12 +129716,6 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
129711
129716
|
clear: clear2,
|
|
129712
129717
|
onChangesAffectModuleResolution
|
|
129713
129718
|
};
|
|
129714
|
-
function getResolvedModule(resolution) {
|
|
129715
|
-
return resolution.resolvedModule;
|
|
129716
|
-
}
|
|
129717
|
-
function getResolvedTypeReferenceDirective(resolution) {
|
|
129718
|
-
return resolution.resolvedTypeReferenceDirective;
|
|
129719
|
-
}
|
|
129720
129719
|
function clear2() {
|
|
129721
129720
|
clearMap(directoryWatchesOfFailedLookups, closeFileWatcherOf);
|
|
129722
129721
|
clearMap(fileWatchesOfAffectingLocations, closeFileWatcherOf);
|
|
@@ -129798,7 +129797,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
129798
129797
|
stopWatchFailedLookupLocationOfResolution(
|
|
129799
129798
|
resolution,
|
|
129800
129799
|
resolutionHost.toPath(getInferredLibraryNameResolveFrom(resolutionHost.getCompilationSettings(), getCurrentDirectory(), libFileName)),
|
|
129801
|
-
|
|
129800
|
+
getResolvedModuleFromResolution
|
|
129802
129801
|
);
|
|
129803
129802
|
resolvedLibraries.delete(libFileName);
|
|
129804
129803
|
}
|
|
@@ -129978,7 +129977,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
129978
129977
|
getModuleResolutionHost(resolutionHost),
|
|
129979
129978
|
typeReferenceDirectiveResolutionCache
|
|
129980
129979
|
),
|
|
129981
|
-
getResolutionWithResolvedFileName:
|
|
129980
|
+
getResolutionWithResolvedFileName: getResolvedTypeReferenceDirectiveFromResolution,
|
|
129982
129981
|
shouldRetryResolution: (resolution) => resolution.resolvedTypeReferenceDirective === void 0,
|
|
129983
129982
|
deferWatchingNonRelativeResolution: false
|
|
129984
129983
|
});
|
|
@@ -129999,7 +129998,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
129999
129998
|
resolutionHost,
|
|
130000
129999
|
moduleResolutionCache
|
|
130001
130000
|
),
|
|
130002
|
-
getResolutionWithResolvedFileName:
|
|
130001
|
+
getResolutionWithResolvedFileName: getResolvedModuleFromResolution,
|
|
130003
130002
|
shouldRetryResolution: (resolution) => !resolution.resolvedModule || !resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension),
|
|
130004
130003
|
logChanges: logChangesWhenResolvingModule,
|
|
130005
130004
|
deferWatchingNonRelativeResolution: true
|
|
@@ -130017,17 +130016,17 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
130017
130016
|
libraryName,
|
|
130018
130017
|
resolution,
|
|
130019
130018
|
path,
|
|
130020
|
-
|
|
130019
|
+
getResolvedModuleFromResolution,
|
|
130021
130020
|
/*deferWatchingNonRelativeResolution*/
|
|
130022
130021
|
false
|
|
130023
130022
|
);
|
|
130024
130023
|
resolvedLibraries.set(libFileName, resolution);
|
|
130025
130024
|
if (existingResolution) {
|
|
130026
|
-
stopWatchFailedLookupLocationOfResolution(existingResolution, path,
|
|
130025
|
+
stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolvedModuleFromResolution);
|
|
130027
130026
|
}
|
|
130028
130027
|
} else {
|
|
130029
130028
|
if (isTraceEnabled(options, host)) {
|
|
130030
|
-
const resolved =
|
|
130029
|
+
const resolved = getResolvedModuleFromResolution(resolution);
|
|
130031
130030
|
trace(
|
|
130032
130031
|
host,
|
|
130033
130032
|
(resolved == null ? void 0 : resolved.resolvedFileName) ? resolved.packageId ? Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 : Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2 : Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_not_resolved,
|
|
@@ -130066,27 +130065,20 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
130066
130065
|
return endsWith(dirPath, "/node_modules/@types");
|
|
130067
130066
|
}
|
|
130068
130067
|
function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName, deferWatchingNonRelativeResolution) {
|
|
130069
|
-
var _a;
|
|
130070
|
-
if (resolution.refCount) {
|
|
130071
|
-
resolution.refCount++;
|
|
130072
|
-
Debug.assertIsDefined(resolution.files);
|
|
130073
|
-
} else {
|
|
130074
|
-
resolution.refCount = 1;
|
|
130075
|
-
Debug.assert(!((_a = resolution.files) == null ? void 0 : _a.size));
|
|
130076
|
-
if (!deferWatchingNonRelativeResolution || isExternalModuleNameRelative(name)) {
|
|
130077
|
-
watchFailedLookupLocationOfResolution(resolution);
|
|
130078
|
-
} else {
|
|
130079
|
-
nonRelativeExternalModuleResolutions.add(name, resolution);
|
|
130080
|
-
}
|
|
130081
|
-
const resolved = getResolutionWithResolvedFileName(resolution);
|
|
130082
|
-
if (resolved && resolved.resolvedFileName) {
|
|
130083
|
-
const key = resolutionHost.toPath(resolved.resolvedFileName);
|
|
130084
|
-
let resolutions = resolvedFileToResolution.get(key);
|
|
130085
|
-
if (!resolutions) resolvedFileToResolution.set(key, resolutions = /* @__PURE__ */ new Set());
|
|
130086
|
-
resolutions.add(resolution);
|
|
130087
|
-
}
|
|
130088
|
-
}
|
|
130089
130068
|
(resolution.files ?? (resolution.files = /* @__PURE__ */ new Set())).add(filePath);
|
|
130069
|
+
if (resolution.files.size !== 1) return;
|
|
130070
|
+
if (!deferWatchingNonRelativeResolution || isExternalModuleNameRelative(name)) {
|
|
130071
|
+
watchFailedLookupLocationOfResolution(resolution);
|
|
130072
|
+
} else {
|
|
130073
|
+
nonRelativeExternalModuleResolutions.add(name, resolution);
|
|
130074
|
+
}
|
|
130075
|
+
const resolved = getResolutionWithResolvedFileName(resolution);
|
|
130076
|
+
if (resolved && resolved.resolvedFileName) {
|
|
130077
|
+
const key = resolutionHost.toPath(resolved.resolvedFileName);
|
|
130078
|
+
let resolutions = resolvedFileToResolution.get(key);
|
|
130079
|
+
if (!resolutions) resolvedFileToResolution.set(key, resolutions = /* @__PURE__ */ new Set());
|
|
130080
|
+
resolutions.add(resolution);
|
|
130081
|
+
}
|
|
130090
130082
|
}
|
|
130091
130083
|
function watchFailedLookupLocation(failedLookupLocation, setAtRoot) {
|
|
130092
130084
|
const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
@@ -130111,7 +130103,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
130111
130103
|
return setAtRoot;
|
|
130112
130104
|
}
|
|
130113
130105
|
function watchFailedLookupLocationOfResolution(resolution) {
|
|
130114
|
-
|
|
130106
|
+
var _a;
|
|
130107
|
+
Debug.assert(!!((_a = resolution.files) == null ? void 0 : _a.size));
|
|
130115
130108
|
const { failedLookupLocations, affectingLocations, alternateResult } = resolution;
|
|
130116
130109
|
if (!(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !(affectingLocations == null ? void 0 : affectingLocations.length) && !alternateResult) return;
|
|
130117
130110
|
if ((failedLookupLocations == null ? void 0 : failedLookupLocations.length) || alternateResult) resolutionsWithFailedLookups.add(resolution);
|
|
@@ -130137,7 +130130,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
130137
130130
|
watchAffectingLocationsOfResolution(resolution, !(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !alternateResult);
|
|
130138
130131
|
}
|
|
130139
130132
|
function watchAffectingLocationsOfResolution(resolution, addToResolutionsWithOnlyAffectingLocations) {
|
|
130140
|
-
|
|
130133
|
+
var _a;
|
|
130134
|
+
Debug.assert(!!((_a = resolution.files) == null ? void 0 : _a.size));
|
|
130141
130135
|
const { affectingLocations } = resolution;
|
|
130142
130136
|
if (!(affectingLocations == null ? void 0 : affectingLocations.length)) return;
|
|
130143
130137
|
if (addToResolutionsWithOnlyAffectingLocations) resolutionsWithOnlyAffectingLocations.add(resolution);
|
|
@@ -130324,10 +130318,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
130324
130318
|
}
|
|
130325
130319
|
function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName, syncDirWatcherRemove) {
|
|
130326
130320
|
Debug.checkDefined(resolution.files).delete(filePath);
|
|
130327
|
-
resolution.
|
|
130328
|
-
|
|
130329
|
-
return;
|
|
130330
|
-
}
|
|
130321
|
+
if (resolution.files.size) return;
|
|
130322
|
+
resolution.files = void 0;
|
|
130331
130323
|
const resolved = getResolutionWithResolvedFileName(resolution);
|
|
130332
130324
|
if (resolved && resolved.resolvedFileName) {
|
|
130333
130325
|
const key = resolutionHost.toPath(resolved.resolvedFileName);
|
|
@@ -130392,8 +130384,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
130392
130384
|
resolvedProjectReference.commandLine.fileNames.forEach((f) => removeResolutionsOfFile(resolutionHost.toPath(f)));
|
|
130393
130385
|
}
|
|
130394
130386
|
function removeResolutionsOfFile(filePath, syncDirWatcherRemove) {
|
|
130395
|
-
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath,
|
|
130396
|
-
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath,
|
|
130387
|
+
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModuleFromResolution, syncDirWatcherRemove);
|
|
130388
|
+
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirectiveFromResolution, syncDirWatcherRemove);
|
|
130397
130389
|
}
|
|
130398
130390
|
function invalidateResolutions(resolutions, canInvalidate) {
|
|
130399
130391
|
if (!resolutions) return false;
|
|
@@ -179635,6 +179627,8 @@ __export(ts_exports2, {
|
|
|
179635
179627
|
getResolvePackageJsonExports: () => getResolvePackageJsonExports,
|
|
179636
179628
|
getResolvePackageJsonImports: () => getResolvePackageJsonImports,
|
|
179637
179629
|
getResolvedExternalModuleName: () => getResolvedExternalModuleName,
|
|
179630
|
+
getResolvedModuleFromResolution: () => getResolvedModuleFromResolution,
|
|
179631
|
+
getResolvedTypeReferenceDirectiveFromResolution: () => getResolvedTypeReferenceDirectiveFromResolution,
|
|
179638
179632
|
getRestIndicatorOfBindingOrAssignmentElement: () => getRestIndicatorOfBindingOrAssignmentElement,
|
|
179639
179633
|
getRestParameterElementType: () => getRestParameterElementType,
|
|
179640
179634
|
getRightMostAssignedExpression: () => getRightMostAssignedExpression,
|
|
@@ -181131,20 +181125,19 @@ __export(ts_server_exports3, {
|
|
|
181131
181125
|
LogLevel: () => LogLevel2,
|
|
181132
181126
|
Msg: () => Msg,
|
|
181133
181127
|
OpenFileInfoTelemetryEvent: () => OpenFileInfoTelemetryEvent,
|
|
181134
|
-
Project: () =>
|
|
181128
|
+
Project: () => Project2,
|
|
181135
181129
|
ProjectInfoTelemetryEvent: () => ProjectInfoTelemetryEvent,
|
|
181136
181130
|
ProjectKind: () => ProjectKind,
|
|
181137
181131
|
ProjectLanguageServiceStateEvent: () => ProjectLanguageServiceStateEvent,
|
|
181138
181132
|
ProjectLoadingFinishEvent: () => ProjectLoadingFinishEvent,
|
|
181139
181133
|
ProjectLoadingStartEvent: () => ProjectLoadingStartEvent,
|
|
181140
|
-
ProjectService: () =>
|
|
181134
|
+
ProjectService: () => ProjectService2,
|
|
181141
181135
|
ProjectsUpdatedInBackgroundEvent: () => ProjectsUpdatedInBackgroundEvent,
|
|
181142
181136
|
ScriptInfo: () => ScriptInfo,
|
|
181143
181137
|
ScriptVersionCache: () => ScriptVersionCache,
|
|
181144
181138
|
Session: () => Session3,
|
|
181145
181139
|
TextStorage: () => TextStorage,
|
|
181146
181140
|
ThrottledOperations: () => ThrottledOperations,
|
|
181147
|
-
TypingsCache: () => TypingsCache,
|
|
181148
181141
|
TypingsInstallerAdapter: () => TypingsInstallerAdapter,
|
|
181149
181142
|
allFilesAreJsOrDts: () => allFilesAreJsOrDts,
|
|
181150
181143
|
allRootFilesAreJsOrDts: () => allRootFilesAreJsOrDts,
|
|
@@ -182484,102 +182477,6 @@ function failIfInvalidLocation(location) {
|
|
|
182484
182477
|
Debug.assert(location.offset > 0, `Expected offset to be non-${location.offset === 0 ? "zero" : "negative"}`);
|
|
182485
182478
|
}
|
|
182486
182479
|
|
|
182487
|
-
// src/server/typingsCache.ts
|
|
182488
|
-
var nullTypingsInstaller = {
|
|
182489
|
-
isKnownTypesPackageName: returnFalse,
|
|
182490
|
-
// Should never be called because we never provide a types registry.
|
|
182491
|
-
installPackage: notImplemented,
|
|
182492
|
-
enqueueInstallTypingsRequest: noop,
|
|
182493
|
-
attach: noop,
|
|
182494
|
-
onProjectClosed: noop,
|
|
182495
|
-
globalTypingsCacheLocation: void 0
|
|
182496
|
-
// TODO: GH#18217
|
|
182497
|
-
};
|
|
182498
|
-
function setIsEqualTo(arr1, arr2) {
|
|
182499
|
-
if (arr1 === arr2) {
|
|
182500
|
-
return true;
|
|
182501
|
-
}
|
|
182502
|
-
if ((arr1 || emptyArray2).length === 0 && (arr2 || emptyArray2).length === 0) {
|
|
182503
|
-
return true;
|
|
182504
|
-
}
|
|
182505
|
-
const set = /* @__PURE__ */ new Map();
|
|
182506
|
-
let unique = 0;
|
|
182507
|
-
for (const v of arr1) {
|
|
182508
|
-
if (set.get(v) !== true) {
|
|
182509
|
-
set.set(v, true);
|
|
182510
|
-
unique++;
|
|
182511
|
-
}
|
|
182512
|
-
}
|
|
182513
|
-
for (const v of arr2) {
|
|
182514
|
-
const isSet = set.get(v);
|
|
182515
|
-
if (isSet === void 0) {
|
|
182516
|
-
return false;
|
|
182517
|
-
}
|
|
182518
|
-
if (isSet === true) {
|
|
182519
|
-
set.set(v, false);
|
|
182520
|
-
unique--;
|
|
182521
|
-
}
|
|
182522
|
-
}
|
|
182523
|
-
return unique === 0;
|
|
182524
|
-
}
|
|
182525
|
-
function typeAcquisitionChanged(opt1, opt2) {
|
|
182526
|
-
return opt1.enable !== opt2.enable || !setIsEqualTo(opt1.include, opt2.include) || !setIsEqualTo(opt1.exclude, opt2.exclude);
|
|
182527
|
-
}
|
|
182528
|
-
function compilerOptionsChanged(opt1, opt2) {
|
|
182529
|
-
return getAllowJSCompilerOption(opt1) !== getAllowJSCompilerOption(opt2);
|
|
182530
|
-
}
|
|
182531
|
-
function unresolvedImportsChanged(imports1, imports2) {
|
|
182532
|
-
if (imports1 === imports2) {
|
|
182533
|
-
return false;
|
|
182534
|
-
}
|
|
182535
|
-
return !arrayIsEqualTo(imports1, imports2);
|
|
182536
|
-
}
|
|
182537
|
-
var TypingsCache = class {
|
|
182538
|
-
constructor(installer) {
|
|
182539
|
-
this.installer = installer;
|
|
182540
|
-
this.perProjectCache = /* @__PURE__ */ new Map();
|
|
182541
|
-
}
|
|
182542
|
-
isKnownTypesPackageName(name) {
|
|
182543
|
-
return this.installer.isKnownTypesPackageName(name);
|
|
182544
|
-
}
|
|
182545
|
-
installPackage(options) {
|
|
182546
|
-
return this.installer.installPackage(options);
|
|
182547
|
-
}
|
|
182548
|
-
enqueueInstallTypingsForProject(project, unresolvedImports, forceRefresh) {
|
|
182549
|
-
const typeAcquisition = project.getTypeAcquisition();
|
|
182550
|
-
if (!typeAcquisition || !typeAcquisition.enable) {
|
|
182551
|
-
return;
|
|
182552
|
-
}
|
|
182553
|
-
const entry = this.perProjectCache.get(project.getProjectName());
|
|
182554
|
-
if (forceRefresh || !entry || typeAcquisitionChanged(typeAcquisition, entry.typeAcquisition) || compilerOptionsChanged(project.getCompilationSettings(), entry.compilerOptions) || unresolvedImportsChanged(unresolvedImports, entry.unresolvedImports)) {
|
|
182555
|
-
this.perProjectCache.set(project.getProjectName(), {
|
|
182556
|
-
compilerOptions: project.getCompilationSettings(),
|
|
182557
|
-
typeAcquisition,
|
|
182558
|
-
typings: entry ? entry.typings : emptyArray2,
|
|
182559
|
-
unresolvedImports,
|
|
182560
|
-
poisoned: true
|
|
182561
|
-
});
|
|
182562
|
-
this.installer.enqueueInstallTypingsRequest(project, typeAcquisition, unresolvedImports);
|
|
182563
|
-
}
|
|
182564
|
-
}
|
|
182565
|
-
updateTypingsForProject(projectName, compilerOptions, typeAcquisition, unresolvedImports, newTypings) {
|
|
182566
|
-
const typings = sort(newTypings);
|
|
182567
|
-
this.perProjectCache.set(projectName, {
|
|
182568
|
-
compilerOptions,
|
|
182569
|
-
typeAcquisition,
|
|
182570
|
-
typings,
|
|
182571
|
-
unresolvedImports,
|
|
182572
|
-
poisoned: false
|
|
182573
|
-
});
|
|
182574
|
-
return !typeAcquisition || !typeAcquisition.enable ? emptyArray2 : typings;
|
|
182575
|
-
}
|
|
182576
|
-
onProjectClosed(project) {
|
|
182577
|
-
if (this.perProjectCache.delete(project.getProjectName())) {
|
|
182578
|
-
this.installer.onProjectClosed(project);
|
|
182579
|
-
}
|
|
182580
|
-
}
|
|
182581
|
-
};
|
|
182582
|
-
|
|
182583
182480
|
// src/server/project.ts
|
|
182584
182481
|
var ProjectKind = /* @__PURE__ */ ((ProjectKind2) => {
|
|
182585
182482
|
ProjectKind2[ProjectKind2["Inferred"] = 0] = "Inferred";
|
|
@@ -182654,7 +182551,46 @@ function hasNoTypeScriptSource(fileNames) {
|
|
|
182654
182551
|
function isGeneratedFileWatcher(watch) {
|
|
182655
182552
|
return watch.generatedFilePath !== void 0;
|
|
182656
182553
|
}
|
|
182657
|
-
|
|
182554
|
+
function setIsEqualTo(arr1, arr2) {
|
|
182555
|
+
if (arr1 === arr2) {
|
|
182556
|
+
return true;
|
|
182557
|
+
}
|
|
182558
|
+
if ((arr1 || emptyArray2).length === 0 && (arr2 || emptyArray2).length === 0) {
|
|
182559
|
+
return true;
|
|
182560
|
+
}
|
|
182561
|
+
const set = /* @__PURE__ */ new Map();
|
|
182562
|
+
let unique = 0;
|
|
182563
|
+
for (const v of arr1) {
|
|
182564
|
+
if (set.get(v) !== true) {
|
|
182565
|
+
set.set(v, true);
|
|
182566
|
+
unique++;
|
|
182567
|
+
}
|
|
182568
|
+
}
|
|
182569
|
+
for (const v of arr2) {
|
|
182570
|
+
const isSet = set.get(v);
|
|
182571
|
+
if (isSet === void 0) {
|
|
182572
|
+
return false;
|
|
182573
|
+
}
|
|
182574
|
+
if (isSet === true) {
|
|
182575
|
+
set.set(v, false);
|
|
182576
|
+
unique--;
|
|
182577
|
+
}
|
|
182578
|
+
}
|
|
182579
|
+
return unique === 0;
|
|
182580
|
+
}
|
|
182581
|
+
function typeAcquisitionChanged(opt1, opt2) {
|
|
182582
|
+
return opt1.enable !== opt2.enable || !setIsEqualTo(opt1.include, opt2.include) || !setIsEqualTo(opt1.exclude, opt2.exclude);
|
|
182583
|
+
}
|
|
182584
|
+
function compilerOptionsChanged(opt1, opt2) {
|
|
182585
|
+
return getAllowJSCompilerOption(opt1) !== getAllowJSCompilerOption(opt2);
|
|
182586
|
+
}
|
|
182587
|
+
function unresolvedImportsChanged(imports1, imports2) {
|
|
182588
|
+
if (imports1 === imports2) {
|
|
182589
|
+
return false;
|
|
182590
|
+
}
|
|
182591
|
+
return !arrayIsEqualTo(imports1, imports2);
|
|
182592
|
+
}
|
|
182593
|
+
var Project2 = class _Project {
|
|
182658
182594
|
/** @internal */
|
|
182659
182595
|
constructor(projectName, projectKind, projectService, documentRegistry, hasExplicitListOfFiles, lastFileExceededProgramSize, compilerOptions, compileOnSaveEnabled, watchOptions, directoryStructureHost, currentDirectory) {
|
|
182660
182596
|
this.projectKind = projectKind;
|
|
@@ -182817,18 +182753,15 @@ var Project3 = class _Project {
|
|
|
182817
182753
|
return { pluginConfigEntry, resolvedModule, errorLogs };
|
|
182818
182754
|
}
|
|
182819
182755
|
isKnownTypesPackageName(name) {
|
|
182820
|
-
return this.
|
|
182756
|
+
return this.projectService.typingsInstaller.isKnownTypesPackageName(name);
|
|
182821
182757
|
}
|
|
182822
182758
|
installPackage(options) {
|
|
182823
|
-
return this.
|
|
182759
|
+
return this.projectService.typingsInstaller.installPackage({ ...options, projectName: this.projectName, projectRootPath: this.toPath(this.currentDirectory) });
|
|
182824
182760
|
}
|
|
182825
182761
|
/** @internal */
|
|
182826
182762
|
getGlobalTypingsCacheLocation() {
|
|
182827
182763
|
return this.getGlobalCache();
|
|
182828
182764
|
}
|
|
182829
|
-
get typingsCache() {
|
|
182830
|
-
return this.projectService.typingsCache;
|
|
182831
|
-
}
|
|
182832
182765
|
/** @internal */
|
|
182833
182766
|
getSymlinkCache() {
|
|
182834
182767
|
if (!this.symlinks) {
|
|
@@ -183231,7 +183164,8 @@ var Project3 = class _Project {
|
|
|
183231
183164
|
}
|
|
183232
183165
|
close() {
|
|
183233
183166
|
var _a;
|
|
183234
|
-
this.projectService.
|
|
183167
|
+
if (this.typingsCache) this.projectService.typingsInstaller.onProjectClosed(this);
|
|
183168
|
+
this.typingsCache = void 0;
|
|
183235
183169
|
this.closeWatchingTypingLocations();
|
|
183236
183170
|
this.cleanupProgram();
|
|
183237
183171
|
forEach(this.externalFiles, (externalFile) => this.detachScriptInfoIfNotRoot(externalFile));
|
|
@@ -183496,7 +183430,7 @@ var Project3 = class _Project {
|
|
|
183496
183430
|
if (hasNewProgram || changedFiles.length) {
|
|
183497
183431
|
this.lastCachedUnresolvedImportsList = getUnresolvedImports(this.program, this.cachedUnresolvedImportsPerFile);
|
|
183498
183432
|
}
|
|
183499
|
-
this.
|
|
183433
|
+
this.enqueueInstallTypingsForProject(hasAddedorRemovedFiles);
|
|
183500
183434
|
} else {
|
|
183501
183435
|
this.lastCachedUnresolvedImportsList = void 0;
|
|
183502
183436
|
}
|
|
@@ -183514,7 +183448,29 @@ var Project3 = class _Project {
|
|
|
183514
183448
|
return !hasNewProgram;
|
|
183515
183449
|
}
|
|
183516
183450
|
/** @internal */
|
|
183517
|
-
|
|
183451
|
+
enqueueInstallTypingsForProject(forceRefresh) {
|
|
183452
|
+
const typeAcquisition = this.getTypeAcquisition();
|
|
183453
|
+
if (!typeAcquisition || !typeAcquisition.enable || this.projectService.typingsInstaller === nullTypingsInstaller) {
|
|
183454
|
+
return;
|
|
183455
|
+
}
|
|
183456
|
+
const entry = this.typingsCache;
|
|
183457
|
+
if (forceRefresh || !entry || typeAcquisitionChanged(typeAcquisition, entry.typeAcquisition) || compilerOptionsChanged(this.getCompilationSettings(), entry.compilerOptions) || unresolvedImportsChanged(this.lastCachedUnresolvedImportsList, entry.unresolvedImports)) {
|
|
183458
|
+
this.typingsCache = {
|
|
183459
|
+
compilerOptions: this.getCompilationSettings(),
|
|
183460
|
+
typeAcquisition,
|
|
183461
|
+
unresolvedImports: this.lastCachedUnresolvedImportsList
|
|
183462
|
+
};
|
|
183463
|
+
this.projectService.typingsInstaller.enqueueInstallTypingsRequest(this, typeAcquisition, this.lastCachedUnresolvedImportsList);
|
|
183464
|
+
}
|
|
183465
|
+
}
|
|
183466
|
+
/** @internal */
|
|
183467
|
+
updateTypingFiles(compilerOptions, typeAcquisition, unresolvedImports, newTypings) {
|
|
183468
|
+
this.typingsCache = {
|
|
183469
|
+
compilerOptions,
|
|
183470
|
+
typeAcquisition,
|
|
183471
|
+
unresolvedImports
|
|
183472
|
+
};
|
|
183473
|
+
const typingFiles = !typeAcquisition || !typeAcquisition.enable ? emptyArray2 : sort(newTypings);
|
|
183518
183474
|
if (enumerateInsertsAndDeletes(
|
|
183519
183475
|
typingFiles,
|
|
183520
183476
|
this.typingFiles,
|
|
@@ -184300,7 +184256,7 @@ function extractUnresolvedImportsFromSourceFile(program, file, ambientModules, c
|
|
|
184300
184256
|
return unresolvedImports || emptyArray2;
|
|
184301
184257
|
});
|
|
184302
184258
|
}
|
|
184303
|
-
var InferredProject2 = class extends
|
|
184259
|
+
var InferredProject2 = class extends Project2 {
|
|
184304
184260
|
/** @internal */
|
|
184305
184261
|
constructor(projectService, documentRegistry, compilerOptions, watchOptions, projectRootPath, currentDirectory, typeAcquisition) {
|
|
184306
184262
|
super(
|
|
@@ -184394,7 +184350,7 @@ var InferredProject2 = class extends Project3 {
|
|
|
184394
184350
|
};
|
|
184395
184351
|
}
|
|
184396
184352
|
};
|
|
184397
|
-
var AuxiliaryProject = class extends
|
|
184353
|
+
var AuxiliaryProject = class extends Project2 {
|
|
184398
184354
|
constructor(projectService, documentRegistry, compilerOptions, currentDirectory) {
|
|
184399
184355
|
super(
|
|
184400
184356
|
projectService.newAuxiliaryProjectName(),
|
|
@@ -184421,7 +184377,7 @@ var AuxiliaryProject = class extends Project3 {
|
|
|
184421
184377
|
return;
|
|
184422
184378
|
}
|
|
184423
184379
|
};
|
|
184424
|
-
var _AutoImportProviderProject = class _AutoImportProviderProject extends
|
|
184380
|
+
var _AutoImportProviderProject = class _AutoImportProviderProject extends Project2 {
|
|
184425
184381
|
/** @internal */
|
|
184426
184382
|
constructor(hostProject, initialRootNames, documentRegistry, compilerOptions) {
|
|
184427
184383
|
super(
|
|
@@ -184688,7 +184644,7 @@ _AutoImportProviderProject.compilerOptionsOverrides = {
|
|
|
184688
184644
|
noLib: true
|
|
184689
184645
|
};
|
|
184690
184646
|
var AutoImportProviderProject = _AutoImportProviderProject;
|
|
184691
|
-
var ConfiguredProject2 = class extends
|
|
184647
|
+
var ConfiguredProject2 = class extends Project2 {
|
|
184692
184648
|
/** @internal */
|
|
184693
184649
|
constructor(configFileName, canonicalConfigFilePath, projectService, documentRegistry, cachedDirectoryStructureHost, pendingUpdateReason) {
|
|
184694
184650
|
super(
|
|
@@ -184893,7 +184849,7 @@ var ConfiguredProject2 = class extends Project3 {
|
|
|
184893
184849
|
updateErrorForNoInputFiles(fileNames, this.getConfigFilePath(), this.getCompilerOptions().configFile.configFileSpecs, this.projectErrors, this.canConfigFileJsonReportNoInputFiles);
|
|
184894
184850
|
}
|
|
184895
184851
|
};
|
|
184896
|
-
var ExternalProject = class extends
|
|
184852
|
+
var ExternalProject = class extends Project2 {
|
|
184897
184853
|
/** @internal */
|
|
184898
184854
|
constructor(externalProjectName, projectService, documentRegistry, compilerOptions, lastFileExceededProgramSize, compileOnSaveEnabled, projectFilePath, watchOptions) {
|
|
184899
184855
|
super(
|
|
@@ -185100,6 +185056,16 @@ function findProjectByName(projectName, projects) {
|
|
|
185100
185056
|
}
|
|
185101
185057
|
}
|
|
185102
185058
|
}
|
|
185059
|
+
var nullTypingsInstaller = {
|
|
185060
|
+
isKnownTypesPackageName: returnFalse,
|
|
185061
|
+
// Should never be called because we never provide a types registry.
|
|
185062
|
+
installPackage: notImplemented,
|
|
185063
|
+
enqueueInstallTypingsRequest: noop,
|
|
185064
|
+
attach: noop,
|
|
185065
|
+
onProjectClosed: noop,
|
|
185066
|
+
globalTypingsCacheLocation: void 0
|
|
185067
|
+
// TODO: GH#18217
|
|
185068
|
+
};
|
|
185103
185069
|
var noopConfigFileWatcher = { close: noop };
|
|
185104
185070
|
function getConfigFileNameFromCache(info, cache) {
|
|
185105
185071
|
if (!cache) return void 0;
|
|
@@ -185520,7 +185486,6 @@ var _ProjectService = class _ProjectService {
|
|
|
185520
185486
|
this.logger.info("No types map provided; using the default");
|
|
185521
185487
|
}
|
|
185522
185488
|
this.typingsInstaller.attach(this);
|
|
185523
|
-
this.typingsCache = new TypingsCache(this.typingsInstaller);
|
|
185524
185489
|
this.hostConfiguration = {
|
|
185525
185490
|
formatCodeOptions: getDefaultFormatCodeSettings(this.host.newLine),
|
|
185526
185491
|
preferences: emptyOptions,
|
|
@@ -185613,12 +185578,15 @@ var _ProjectService = class _ProjectService {
|
|
|
185613
185578
|
}
|
|
185614
185579
|
switch (response.kind) {
|
|
185615
185580
|
case ActionSet:
|
|
185616
|
-
project.updateTypingFiles(
|
|
185581
|
+
project.updateTypingFiles(
|
|
185582
|
+
response.compilerOptions,
|
|
185583
|
+
response.typeAcquisition,
|
|
185584
|
+
response.unresolvedImports,
|
|
185585
|
+
response.typings
|
|
185586
|
+
);
|
|
185617
185587
|
return;
|
|
185618
185588
|
case ActionInvalidate:
|
|
185619
|
-
|
|
185620
|
-
project,
|
|
185621
|
-
project.lastCachedUnresolvedImportsList,
|
|
185589
|
+
project.enqueueInstallTypingsForProject(
|
|
185622
185590
|
/*forceRefresh*/
|
|
185623
185591
|
true
|
|
185624
185592
|
);
|
|
@@ -188352,7 +188320,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
188352
188320
|
return;
|
|
188353
188321
|
}
|
|
188354
188322
|
if (this.host.importPlugin) {
|
|
188355
|
-
const importPromise =
|
|
188323
|
+
const importPromise = Project2.importServicePluginAsync(
|
|
188356
188324
|
pluginConfigEntry,
|
|
188357
188325
|
searchPaths,
|
|
188358
188326
|
this.host,
|
|
@@ -188366,7 +188334,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
188366
188334
|
}
|
|
188367
188335
|
this.endEnablePlugin(
|
|
188368
188336
|
project,
|
|
188369
|
-
|
|
188337
|
+
Project2.importServicePluginSync(
|
|
188370
188338
|
pluginConfigEntry,
|
|
188371
188339
|
searchPaths,
|
|
188372
188340
|
this.host,
|
|
@@ -188555,7 +188523,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
188555
188523
|
};
|
|
188556
188524
|
/** Makes a filename safe to insert in a RegExp */
|
|
188557
188525
|
_ProjectService.filenameEscapeRegexp = /[-/\\^$*+?.()|[\]{}]/g;
|
|
188558
|
-
var
|
|
188526
|
+
var ProjectService2 = _ProjectService;
|
|
188559
188527
|
function createIncompleteCompletionsCache() {
|
|
188560
188528
|
let info;
|
|
188561
188529
|
return {
|
|
@@ -189923,7 +189891,7 @@ var Session3 = class _Session {
|
|
|
189923
189891
|
canUseWatchEvents: opts.canUseWatchEvents,
|
|
189924
189892
|
incrementalVerifier: opts.incrementalVerifier
|
|
189925
189893
|
};
|
|
189926
|
-
this.projectService = new
|
|
189894
|
+
this.projectService = new ProjectService2(settings);
|
|
189927
189895
|
this.projectService.setPerformanceEventHandler(this.performanceEventHandler.bind(this));
|
|
189928
189896
|
this.gcTimer = new GcTimer(
|
|
189929
189897
|
this.host,
|
|
@@ -193088,20 +193056,19 @@ __export(ts_server_exports4, {
|
|
|
193088
193056
|
LogLevel: () => LogLevel2,
|
|
193089
193057
|
Msg: () => Msg,
|
|
193090
193058
|
OpenFileInfoTelemetryEvent: () => OpenFileInfoTelemetryEvent,
|
|
193091
|
-
Project: () =>
|
|
193059
|
+
Project: () => Project2,
|
|
193092
193060
|
ProjectInfoTelemetryEvent: () => ProjectInfoTelemetryEvent,
|
|
193093
193061
|
ProjectKind: () => ProjectKind,
|
|
193094
193062
|
ProjectLanguageServiceStateEvent: () => ProjectLanguageServiceStateEvent,
|
|
193095
193063
|
ProjectLoadingFinishEvent: () => ProjectLoadingFinishEvent,
|
|
193096
193064
|
ProjectLoadingStartEvent: () => ProjectLoadingStartEvent,
|
|
193097
|
-
ProjectService: () =>
|
|
193065
|
+
ProjectService: () => ProjectService2,
|
|
193098
193066
|
ProjectsUpdatedInBackgroundEvent: () => ProjectsUpdatedInBackgroundEvent,
|
|
193099
193067
|
ScriptInfo: () => ScriptInfo,
|
|
193100
193068
|
ScriptVersionCache: () => ScriptVersionCache,
|
|
193101
193069
|
Session: () => Session3,
|
|
193102
193070
|
TextStorage: () => TextStorage,
|
|
193103
193071
|
ThrottledOperations: () => ThrottledOperations,
|
|
193104
|
-
TypingsCache: () => TypingsCache,
|
|
193105
193072
|
TypingsInstallerAdapter: () => TypingsInstallerAdapter,
|
|
193106
193073
|
allFilesAreJsOrDts: () => allFilesAreJsOrDts,
|
|
193107
193074
|
allRootFilesAreJsOrDts: () => allRootFilesAreJsOrDts,
|
|
@@ -194157,6 +194124,8 @@ if (typeof console !== "undefined") {
|
|
|
194157
194124
|
getResolvePackageJsonExports,
|
|
194158
194125
|
getResolvePackageJsonImports,
|
|
194159
194126
|
getResolvedExternalModuleName,
|
|
194127
|
+
getResolvedModuleFromResolution,
|
|
194128
|
+
getResolvedTypeReferenceDirectiveFromResolution,
|
|
194160
194129
|
getRestIndicatorOfBindingOrAssignmentElement,
|
|
194161
194130
|
getRestParameterElementType,
|
|
194162
194131
|
getRightMostAssignedExpression,
|