typescript 5.6.0-dev.20240626 → 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 +142 -157
- package/lib/typescript.d.ts +14 -14
- package/lib/typescript.js +247 -283
- package/package.json +12 -12
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";
|
|
@@ -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;
|
|
@@ -91777,6 +91785,7 @@ function createTypeChecker(host) {
|
|
|
91777
91785
|
}
|
|
91778
91786
|
case 7 /* ES2022 */:
|
|
91779
91787
|
case 99 /* ESNext */:
|
|
91788
|
+
case 200 /* Preserve */:
|
|
91780
91789
|
case 4 /* System */:
|
|
91781
91790
|
if (languageVersion >= 4 /* ES2017 */) {
|
|
91782
91791
|
break;
|
|
@@ -124793,12 +124802,18 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
124793
124802
|
}
|
|
124794
124803
|
function resolveModuleNamesWorker(moduleNames, containingFile, reusedNames) {
|
|
124795
124804
|
var _a2, _b2;
|
|
124796
|
-
if (!moduleNames.length) return emptyArray;
|
|
124797
124805
|
const containingFileName = getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory);
|
|
124798
124806
|
const redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
124799
124807
|
(_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Program, "resolveModuleNamesWorker", { containingFileName });
|
|
124800
124808
|
mark("beforeResolveModule");
|
|
124801
|
-
const result = actualResolveModuleNamesWorker(
|
|
124809
|
+
const result = actualResolveModuleNamesWorker(
|
|
124810
|
+
moduleNames,
|
|
124811
|
+
containingFileName,
|
|
124812
|
+
redirectedReference,
|
|
124813
|
+
options,
|
|
124814
|
+
containingFile,
|
|
124815
|
+
reusedNames
|
|
124816
|
+
);
|
|
124802
124817
|
mark("afterResolveModule");
|
|
124803
124818
|
measure("ResolveModule", "beforeResolveModule", "afterResolveModule");
|
|
124804
124819
|
(_b2 = tracing) == null ? void 0 : _b2.pop();
|
|
@@ -124806,13 +124821,19 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
124806
124821
|
}
|
|
124807
124822
|
function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile, reusedNames) {
|
|
124808
124823
|
var _a2, _b2;
|
|
124809
|
-
if (!typeDirectiveNames.length) return [];
|
|
124810
124824
|
const containingSourceFile = !isString(containingFile) ? containingFile : void 0;
|
|
124811
124825
|
const containingFileName = !isString(containingFile) ? getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory) : containingFile;
|
|
124812
124826
|
const redirectedReference = containingSourceFile && getRedirectReferenceForResolution(containingSourceFile);
|
|
124813
124827
|
(_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Program, "resolveTypeReferenceDirectiveNamesWorker", { containingFileName });
|
|
124814
124828
|
mark("beforeResolveTypeReference");
|
|
124815
|
-
const result = actualResolveTypeReferenceDirectiveNamesWorker(
|
|
124829
|
+
const result = actualResolveTypeReferenceDirectiveNamesWorker(
|
|
124830
|
+
typeDirectiveNames,
|
|
124831
|
+
containingFileName,
|
|
124832
|
+
redirectedReference,
|
|
124833
|
+
options,
|
|
124834
|
+
containingSourceFile,
|
|
124835
|
+
reusedNames
|
|
124836
|
+
);
|
|
124816
124837
|
mark("afterResolveTypeReference");
|
|
124817
124838
|
measure("ResolveTypeReference", "beforeResolveTypeReference", "afterResolveTypeReference");
|
|
124818
124839
|
(_b2 = tracing) == null ? void 0 : _b2.pop();
|
|
@@ -124882,144 +124903,123 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
124882
124903
|
}
|
|
124883
124904
|
return classifiableNames;
|
|
124884
124905
|
}
|
|
124885
|
-
function resolveModuleNamesReusingOldState(moduleNames,
|
|
124886
|
-
|
|
124887
|
-
|
|
124888
|
-
|
|
124889
|
-
|
|
124890
|
-
|
|
124891
|
-
|
|
124892
|
-
|
|
124893
|
-
|
|
124894
|
-
|
|
124895
|
-
|
|
124896
|
-
|
|
124897
|
-
|
|
124898
|
-
|
|
124899
|
-
|
|
124900
|
-
|
|
124901
|
-
if (
|
|
124902
|
-
|
|
124903
|
-
if (oldResolution == null ? void 0 : oldResolution.resolvedModule) {
|
|
124904
|
-
if (isTraceEnabled(options, host)) {
|
|
124905
|
-
trace(
|
|
124906
|
-
host,
|
|
124907
|
-
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,
|
|
124908
|
-
moduleName.text,
|
|
124909
|
-
getNormalizedAbsolutePath(file.originalFileName, currentDirectory),
|
|
124910
|
-
oldResolution.resolvedModule.resolvedFileName,
|
|
124911
|
-
oldResolution.resolvedModule.packageId && packageIdToString(oldResolution.resolvedModule.packageId)
|
|
124912
|
-
);
|
|
124913
|
-
}
|
|
124914
|
-
(result ?? (result = new Array(moduleNames.length)))[i] = oldResolution;
|
|
124915
|
-
(reusedNames ?? (reusedNames = [])).push(moduleName);
|
|
124916
|
-
continue;
|
|
124917
|
-
}
|
|
124918
|
-
}
|
|
124919
|
-
let resolvesToAmbientModuleInNonModifiedFile = false;
|
|
124920
|
-
if (contains(file.ambientModuleNames, moduleName.text)) {
|
|
124921
|
-
resolvesToAmbientModuleInNonModifiedFile = true;
|
|
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));
|
|
124924
|
-
}
|
|
124925
|
-
} else {
|
|
124926
|
-
resolvesToAmbientModuleInNonModifiedFile = moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName);
|
|
124927
|
-
}
|
|
124928
|
-
if (resolvesToAmbientModuleInNonModifiedFile) {
|
|
124929
|
-
(result || (result = new Array(moduleNames.length)))[i] = predictedToResolveToAmbientModuleMarker;
|
|
124930
|
-
} else {
|
|
124931
|
-
(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));
|
|
124932
124924
|
}
|
|
124925
|
+
return true;
|
|
124926
|
+
} else {
|
|
124927
|
+
return moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName, file);
|
|
124933
124928
|
}
|
|
124934
|
-
|
|
124935
|
-
|
|
124936
|
-
|
|
124937
|
-
|
|
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;
|
|
124938
124936
|
}
|
|
124939
|
-
|
|
124940
|
-
|
|
124941
|
-
|
|
124942
|
-
result[i] = resolutions[j];
|
|
124943
|
-
j++;
|
|
124944
|
-
}
|
|
124937
|
+
const unmodifiedFile = ambientModuleNameToUnmodifiedFileName.get(moduleName.text);
|
|
124938
|
+
if (!unmodifiedFile) {
|
|
124939
|
+
return false;
|
|
124945
124940
|
}
|
|
124946
|
-
|
|
124947
|
-
|
|
124948
|
-
function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName) {
|
|
124949
|
-
var _a2;
|
|
124950
|
-
const resolutionToFile = (_a2 = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, getModeForUsageLocation2(file, moduleName))) == null ? void 0 : _a2.resolvedModule;
|
|
124951
|
-
const resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
|
|
124952
|
-
if (resolutionToFile && resolvedFile) {
|
|
124953
|
-
return false;
|
|
124954
|
-
}
|
|
124955
|
-
const unmodifiedFile = ambientModuleNameToUnmodifiedFileName.get(moduleName.text);
|
|
124956
|
-
if (!unmodifiedFile) {
|
|
124957
|
-
return false;
|
|
124958
|
-
}
|
|
124959
|
-
if (isTraceEnabled(options, host)) {
|
|
124960
|
-
trace(host, Diagnostics.Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified, moduleName.text, unmodifiedFile);
|
|
124961
|
-
}
|
|
124962
|
-
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);
|
|
124963
124943
|
}
|
|
124944
|
+
return true;
|
|
124964
124945
|
}
|
|
124965
124946
|
function resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectiveNames, containingFile) {
|
|
124966
|
-
|
|
124967
|
-
|
|
124968
|
-
|
|
124969
|
-
|
|
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,
|
|
124970
124979
|
containingFile,
|
|
124971
124980
|
/*reusedNames*/
|
|
124972
124981
|
void 0
|
|
124973
124982
|
);
|
|
124974
124983
|
}
|
|
124975
|
-
let
|
|
124984
|
+
let unknownEntries;
|
|
124985
|
+
let unknownEntryIndices;
|
|
124976
124986
|
let result;
|
|
124977
124987
|
let reusedNames;
|
|
124978
|
-
const
|
|
124979
|
-
|
|
124980
|
-
|
|
124981
|
-
|
|
124982
|
-
|
|
124983
|
-
|
|
124984
|
-
const
|
|
124985
|
-
const
|
|
124986
|
-
|
|
124987
|
-
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) {
|
|
124988
124997
|
if (isTraceEnabled(options, host)) {
|
|
124989
124998
|
trace(
|
|
124990
124999
|
host,
|
|
124991
|
-
|
|
124992
|
-
|
|
124993
|
-
|
|
124994
|
-
|
|
124995
|
-
|
|
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)
|
|
124996
125005
|
);
|
|
124997
125006
|
}
|
|
124998
|
-
(result ?? (result = new Array(
|
|
125007
|
+
(result ?? (result = new Array(entries.length)))[i] = oldResolution;
|
|
124999
125008
|
(reusedNames ?? (reusedNames = [])).push(entry);
|
|
125000
125009
|
continue;
|
|
125001
125010
|
}
|
|
125002
125011
|
}
|
|
125003
|
-
(
|
|
125004
|
-
|
|
125005
|
-
|
|
125006
|
-
|
|
125007
|
-
|
|
125008
|
-
containingFile,
|
|
125009
|
-
reusedNames
|
|
125010
|
-
);
|
|
125011
|
-
if (!result) {
|
|
125012
|
-
Debug.assert(resolutions.length === typeDirectiveNames.length);
|
|
125013
|
-
return resolutions;
|
|
125014
|
-
}
|
|
125015
|
-
let j = 0;
|
|
125016
|
-
for (let i = 0; i < result.length; i++) {
|
|
125017
|
-
if (!result[i]) {
|
|
125018
|
-
result[i] = resolutions[j];
|
|
125019
|
-
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);
|
|
125020
125017
|
}
|
|
125021
125018
|
}
|
|
125022
|
-
|
|
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);
|
|
125023
125023
|
return result;
|
|
125024
125024
|
}
|
|
125025
125025
|
function canReuseProjectReferences() {
|
|
@@ -129716,12 +129716,6 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
129716
129716
|
clear: clear2,
|
|
129717
129717
|
onChangesAffectModuleResolution
|
|
129718
129718
|
};
|
|
129719
|
-
function getResolvedModule(resolution) {
|
|
129720
|
-
return resolution.resolvedModule;
|
|
129721
|
-
}
|
|
129722
|
-
function getResolvedTypeReferenceDirective(resolution) {
|
|
129723
|
-
return resolution.resolvedTypeReferenceDirective;
|
|
129724
|
-
}
|
|
129725
129719
|
function clear2() {
|
|
129726
129720
|
clearMap(directoryWatchesOfFailedLookups, closeFileWatcherOf);
|
|
129727
129721
|
clearMap(fileWatchesOfAffectingLocations, closeFileWatcherOf);
|
|
@@ -129803,7 +129797,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
129803
129797
|
stopWatchFailedLookupLocationOfResolution(
|
|
129804
129798
|
resolution,
|
|
129805
129799
|
resolutionHost.toPath(getInferredLibraryNameResolveFrom(resolutionHost.getCompilationSettings(), getCurrentDirectory(), libFileName)),
|
|
129806
|
-
|
|
129800
|
+
getResolvedModuleFromResolution
|
|
129807
129801
|
);
|
|
129808
129802
|
resolvedLibraries.delete(libFileName);
|
|
129809
129803
|
}
|
|
@@ -129983,7 +129977,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
129983
129977
|
getModuleResolutionHost(resolutionHost),
|
|
129984
129978
|
typeReferenceDirectiveResolutionCache
|
|
129985
129979
|
),
|
|
129986
|
-
getResolutionWithResolvedFileName:
|
|
129980
|
+
getResolutionWithResolvedFileName: getResolvedTypeReferenceDirectiveFromResolution,
|
|
129987
129981
|
shouldRetryResolution: (resolution) => resolution.resolvedTypeReferenceDirective === void 0,
|
|
129988
129982
|
deferWatchingNonRelativeResolution: false
|
|
129989
129983
|
});
|
|
@@ -130004,7 +129998,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
130004
129998
|
resolutionHost,
|
|
130005
129999
|
moduleResolutionCache
|
|
130006
130000
|
),
|
|
130007
|
-
getResolutionWithResolvedFileName:
|
|
130001
|
+
getResolutionWithResolvedFileName: getResolvedModuleFromResolution,
|
|
130008
130002
|
shouldRetryResolution: (resolution) => !resolution.resolvedModule || !resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension),
|
|
130009
130003
|
logChanges: logChangesWhenResolvingModule,
|
|
130010
130004
|
deferWatchingNonRelativeResolution: true
|
|
@@ -130022,17 +130016,17 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
130022
130016
|
libraryName,
|
|
130023
130017
|
resolution,
|
|
130024
130018
|
path,
|
|
130025
|
-
|
|
130019
|
+
getResolvedModuleFromResolution,
|
|
130026
130020
|
/*deferWatchingNonRelativeResolution*/
|
|
130027
130021
|
false
|
|
130028
130022
|
);
|
|
130029
130023
|
resolvedLibraries.set(libFileName, resolution);
|
|
130030
130024
|
if (existingResolution) {
|
|
130031
|
-
stopWatchFailedLookupLocationOfResolution(existingResolution, path,
|
|
130025
|
+
stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolvedModuleFromResolution);
|
|
130032
130026
|
}
|
|
130033
130027
|
} else {
|
|
130034
130028
|
if (isTraceEnabled(options, host)) {
|
|
130035
|
-
const resolved =
|
|
130029
|
+
const resolved = getResolvedModuleFromResolution(resolution);
|
|
130036
130030
|
trace(
|
|
130037
130031
|
host,
|
|
130038
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,
|
|
@@ -130071,27 +130065,20 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
130071
130065
|
return endsWith(dirPath, "/node_modules/@types");
|
|
130072
130066
|
}
|
|
130073
130067
|
function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName, deferWatchingNonRelativeResolution) {
|
|
130074
|
-
var _a;
|
|
130075
|
-
if (resolution.refCount) {
|
|
130076
|
-
resolution.refCount++;
|
|
130077
|
-
Debug.assertIsDefined(resolution.files);
|
|
130078
|
-
} else {
|
|
130079
|
-
resolution.refCount = 1;
|
|
130080
|
-
Debug.assert(!((_a = resolution.files) == null ? void 0 : _a.size));
|
|
130081
|
-
if (!deferWatchingNonRelativeResolution || isExternalModuleNameRelative(name)) {
|
|
130082
|
-
watchFailedLookupLocationOfResolution(resolution);
|
|
130083
|
-
} else {
|
|
130084
|
-
nonRelativeExternalModuleResolutions.add(name, resolution);
|
|
130085
|
-
}
|
|
130086
|
-
const resolved = getResolutionWithResolvedFileName(resolution);
|
|
130087
|
-
if (resolved && resolved.resolvedFileName) {
|
|
130088
|
-
const key = resolutionHost.toPath(resolved.resolvedFileName);
|
|
130089
|
-
let resolutions = resolvedFileToResolution.get(key);
|
|
130090
|
-
if (!resolutions) resolvedFileToResolution.set(key, resolutions = /* @__PURE__ */ new Set());
|
|
130091
|
-
resolutions.add(resolution);
|
|
130092
|
-
}
|
|
130093
|
-
}
|
|
130094
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
|
+
}
|
|
130095
130082
|
}
|
|
130096
130083
|
function watchFailedLookupLocation(failedLookupLocation, setAtRoot) {
|
|
130097
130084
|
const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
@@ -130116,7 +130103,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
130116
130103
|
return setAtRoot;
|
|
130117
130104
|
}
|
|
130118
130105
|
function watchFailedLookupLocationOfResolution(resolution) {
|
|
130119
|
-
|
|
130106
|
+
var _a;
|
|
130107
|
+
Debug.assert(!!((_a = resolution.files) == null ? void 0 : _a.size));
|
|
130120
130108
|
const { failedLookupLocations, affectingLocations, alternateResult } = resolution;
|
|
130121
130109
|
if (!(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !(affectingLocations == null ? void 0 : affectingLocations.length) && !alternateResult) return;
|
|
130122
130110
|
if ((failedLookupLocations == null ? void 0 : failedLookupLocations.length) || alternateResult) resolutionsWithFailedLookups.add(resolution);
|
|
@@ -130142,7 +130130,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
130142
130130
|
watchAffectingLocationsOfResolution(resolution, !(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !alternateResult);
|
|
130143
130131
|
}
|
|
130144
130132
|
function watchAffectingLocationsOfResolution(resolution, addToResolutionsWithOnlyAffectingLocations) {
|
|
130145
|
-
|
|
130133
|
+
var _a;
|
|
130134
|
+
Debug.assert(!!((_a = resolution.files) == null ? void 0 : _a.size));
|
|
130146
130135
|
const { affectingLocations } = resolution;
|
|
130147
130136
|
if (!(affectingLocations == null ? void 0 : affectingLocations.length)) return;
|
|
130148
130137
|
if (addToResolutionsWithOnlyAffectingLocations) resolutionsWithOnlyAffectingLocations.add(resolution);
|
|
@@ -130329,10 +130318,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
130329
130318
|
}
|
|
130330
130319
|
function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName, syncDirWatcherRemove) {
|
|
130331
130320
|
Debug.checkDefined(resolution.files).delete(filePath);
|
|
130332
|
-
resolution.
|
|
130333
|
-
|
|
130334
|
-
return;
|
|
130335
|
-
}
|
|
130321
|
+
if (resolution.files.size) return;
|
|
130322
|
+
resolution.files = void 0;
|
|
130336
130323
|
const resolved = getResolutionWithResolvedFileName(resolution);
|
|
130337
130324
|
if (resolved && resolved.resolvedFileName) {
|
|
130338
130325
|
const key = resolutionHost.toPath(resolved.resolvedFileName);
|
|
@@ -130397,8 +130384,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
130397
130384
|
resolvedProjectReference.commandLine.fileNames.forEach((f) => removeResolutionsOfFile(resolutionHost.toPath(f)));
|
|
130398
130385
|
}
|
|
130399
130386
|
function removeResolutionsOfFile(filePath, syncDirWatcherRemove) {
|
|
130400
|
-
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath,
|
|
130401
|
-
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath,
|
|
130387
|
+
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModuleFromResolution, syncDirWatcherRemove);
|
|
130388
|
+
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirectiveFromResolution, syncDirWatcherRemove);
|
|
130402
130389
|
}
|
|
130403
130390
|
function invalidateResolutions(resolutions, canInvalidate) {
|
|
130404
130391
|
if (!resolutions) return false;
|
|
@@ -179640,6 +179627,8 @@ __export(ts_exports2, {
|
|
|
179640
179627
|
getResolvePackageJsonExports: () => getResolvePackageJsonExports,
|
|
179641
179628
|
getResolvePackageJsonImports: () => getResolvePackageJsonImports,
|
|
179642
179629
|
getResolvedExternalModuleName: () => getResolvedExternalModuleName,
|
|
179630
|
+
getResolvedModuleFromResolution: () => getResolvedModuleFromResolution,
|
|
179631
|
+
getResolvedTypeReferenceDirectiveFromResolution: () => getResolvedTypeReferenceDirectiveFromResolution,
|
|
179643
179632
|
getRestIndicatorOfBindingOrAssignmentElement: () => getRestIndicatorOfBindingOrAssignmentElement,
|
|
179644
179633
|
getRestParameterElementType: () => getRestParameterElementType,
|
|
179645
179634
|
getRightMostAssignedExpression: () => getRightMostAssignedExpression,
|
|
@@ -181136,20 +181125,19 @@ __export(ts_server_exports3, {
|
|
|
181136
181125
|
LogLevel: () => LogLevel2,
|
|
181137
181126
|
Msg: () => Msg,
|
|
181138
181127
|
OpenFileInfoTelemetryEvent: () => OpenFileInfoTelemetryEvent,
|
|
181139
|
-
Project: () =>
|
|
181128
|
+
Project: () => Project2,
|
|
181140
181129
|
ProjectInfoTelemetryEvent: () => ProjectInfoTelemetryEvent,
|
|
181141
181130
|
ProjectKind: () => ProjectKind,
|
|
181142
181131
|
ProjectLanguageServiceStateEvent: () => ProjectLanguageServiceStateEvent,
|
|
181143
181132
|
ProjectLoadingFinishEvent: () => ProjectLoadingFinishEvent,
|
|
181144
181133
|
ProjectLoadingStartEvent: () => ProjectLoadingStartEvent,
|
|
181145
|
-
ProjectService: () =>
|
|
181134
|
+
ProjectService: () => ProjectService2,
|
|
181146
181135
|
ProjectsUpdatedInBackgroundEvent: () => ProjectsUpdatedInBackgroundEvent,
|
|
181147
181136
|
ScriptInfo: () => ScriptInfo,
|
|
181148
181137
|
ScriptVersionCache: () => ScriptVersionCache,
|
|
181149
181138
|
Session: () => Session3,
|
|
181150
181139
|
TextStorage: () => TextStorage,
|
|
181151
181140
|
ThrottledOperations: () => ThrottledOperations,
|
|
181152
|
-
TypingsCache: () => TypingsCache,
|
|
181153
181141
|
TypingsInstallerAdapter: () => TypingsInstallerAdapter,
|
|
181154
181142
|
allFilesAreJsOrDts: () => allFilesAreJsOrDts,
|
|
181155
181143
|
allRootFilesAreJsOrDts: () => allRootFilesAreJsOrDts,
|
|
@@ -182489,102 +182477,6 @@ function failIfInvalidLocation(location) {
|
|
|
182489
182477
|
Debug.assert(location.offset > 0, `Expected offset to be non-${location.offset === 0 ? "zero" : "negative"}`);
|
|
182490
182478
|
}
|
|
182491
182479
|
|
|
182492
|
-
// src/server/typingsCache.ts
|
|
182493
|
-
var nullTypingsInstaller = {
|
|
182494
|
-
isKnownTypesPackageName: returnFalse,
|
|
182495
|
-
// Should never be called because we never provide a types registry.
|
|
182496
|
-
installPackage: notImplemented,
|
|
182497
|
-
enqueueInstallTypingsRequest: noop,
|
|
182498
|
-
attach: noop,
|
|
182499
|
-
onProjectClosed: noop,
|
|
182500
|
-
globalTypingsCacheLocation: void 0
|
|
182501
|
-
// TODO: GH#18217
|
|
182502
|
-
};
|
|
182503
|
-
function setIsEqualTo(arr1, arr2) {
|
|
182504
|
-
if (arr1 === arr2) {
|
|
182505
|
-
return true;
|
|
182506
|
-
}
|
|
182507
|
-
if ((arr1 || emptyArray2).length === 0 && (arr2 || emptyArray2).length === 0) {
|
|
182508
|
-
return true;
|
|
182509
|
-
}
|
|
182510
|
-
const set = /* @__PURE__ */ new Map();
|
|
182511
|
-
let unique = 0;
|
|
182512
|
-
for (const v of arr1) {
|
|
182513
|
-
if (set.get(v) !== true) {
|
|
182514
|
-
set.set(v, true);
|
|
182515
|
-
unique++;
|
|
182516
|
-
}
|
|
182517
|
-
}
|
|
182518
|
-
for (const v of arr2) {
|
|
182519
|
-
const isSet = set.get(v);
|
|
182520
|
-
if (isSet === void 0) {
|
|
182521
|
-
return false;
|
|
182522
|
-
}
|
|
182523
|
-
if (isSet === true) {
|
|
182524
|
-
set.set(v, false);
|
|
182525
|
-
unique--;
|
|
182526
|
-
}
|
|
182527
|
-
}
|
|
182528
|
-
return unique === 0;
|
|
182529
|
-
}
|
|
182530
|
-
function typeAcquisitionChanged(opt1, opt2) {
|
|
182531
|
-
return opt1.enable !== opt2.enable || !setIsEqualTo(opt1.include, opt2.include) || !setIsEqualTo(opt1.exclude, opt2.exclude);
|
|
182532
|
-
}
|
|
182533
|
-
function compilerOptionsChanged(opt1, opt2) {
|
|
182534
|
-
return getAllowJSCompilerOption(opt1) !== getAllowJSCompilerOption(opt2);
|
|
182535
|
-
}
|
|
182536
|
-
function unresolvedImportsChanged(imports1, imports2) {
|
|
182537
|
-
if (imports1 === imports2) {
|
|
182538
|
-
return false;
|
|
182539
|
-
}
|
|
182540
|
-
return !arrayIsEqualTo(imports1, imports2);
|
|
182541
|
-
}
|
|
182542
|
-
var TypingsCache = class {
|
|
182543
|
-
constructor(installer) {
|
|
182544
|
-
this.installer = installer;
|
|
182545
|
-
this.perProjectCache = /* @__PURE__ */ new Map();
|
|
182546
|
-
}
|
|
182547
|
-
isKnownTypesPackageName(name) {
|
|
182548
|
-
return this.installer.isKnownTypesPackageName(name);
|
|
182549
|
-
}
|
|
182550
|
-
installPackage(options) {
|
|
182551
|
-
return this.installer.installPackage(options);
|
|
182552
|
-
}
|
|
182553
|
-
enqueueInstallTypingsForProject(project, unresolvedImports, forceRefresh) {
|
|
182554
|
-
const typeAcquisition = project.getTypeAcquisition();
|
|
182555
|
-
if (!typeAcquisition || !typeAcquisition.enable) {
|
|
182556
|
-
return;
|
|
182557
|
-
}
|
|
182558
|
-
const entry = this.perProjectCache.get(project.getProjectName());
|
|
182559
|
-
if (forceRefresh || !entry || typeAcquisitionChanged(typeAcquisition, entry.typeAcquisition) || compilerOptionsChanged(project.getCompilationSettings(), entry.compilerOptions) || unresolvedImportsChanged(unresolvedImports, entry.unresolvedImports)) {
|
|
182560
|
-
this.perProjectCache.set(project.getProjectName(), {
|
|
182561
|
-
compilerOptions: project.getCompilationSettings(),
|
|
182562
|
-
typeAcquisition,
|
|
182563
|
-
typings: entry ? entry.typings : emptyArray2,
|
|
182564
|
-
unresolvedImports,
|
|
182565
|
-
poisoned: true
|
|
182566
|
-
});
|
|
182567
|
-
this.installer.enqueueInstallTypingsRequest(project, typeAcquisition, unresolvedImports);
|
|
182568
|
-
}
|
|
182569
|
-
}
|
|
182570
|
-
updateTypingsForProject(projectName, compilerOptions, typeAcquisition, unresolvedImports, newTypings) {
|
|
182571
|
-
const typings = sort(newTypings);
|
|
182572
|
-
this.perProjectCache.set(projectName, {
|
|
182573
|
-
compilerOptions,
|
|
182574
|
-
typeAcquisition,
|
|
182575
|
-
typings,
|
|
182576
|
-
unresolvedImports,
|
|
182577
|
-
poisoned: false
|
|
182578
|
-
});
|
|
182579
|
-
return !typeAcquisition || !typeAcquisition.enable ? emptyArray2 : typings;
|
|
182580
|
-
}
|
|
182581
|
-
onProjectClosed(project) {
|
|
182582
|
-
if (this.perProjectCache.delete(project.getProjectName())) {
|
|
182583
|
-
this.installer.onProjectClosed(project);
|
|
182584
|
-
}
|
|
182585
|
-
}
|
|
182586
|
-
};
|
|
182587
|
-
|
|
182588
182480
|
// src/server/project.ts
|
|
182589
182481
|
var ProjectKind = /* @__PURE__ */ ((ProjectKind2) => {
|
|
182590
182482
|
ProjectKind2[ProjectKind2["Inferred"] = 0] = "Inferred";
|
|
@@ -182659,7 +182551,46 @@ function hasNoTypeScriptSource(fileNames) {
|
|
|
182659
182551
|
function isGeneratedFileWatcher(watch) {
|
|
182660
182552
|
return watch.generatedFilePath !== void 0;
|
|
182661
182553
|
}
|
|
182662
|
-
|
|
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 {
|
|
182663
182594
|
/** @internal */
|
|
182664
182595
|
constructor(projectName, projectKind, projectService, documentRegistry, hasExplicitListOfFiles, lastFileExceededProgramSize, compilerOptions, compileOnSaveEnabled, watchOptions, directoryStructureHost, currentDirectory) {
|
|
182665
182596
|
this.projectKind = projectKind;
|
|
@@ -182822,18 +182753,15 @@ var Project3 = class _Project {
|
|
|
182822
182753
|
return { pluginConfigEntry, resolvedModule, errorLogs };
|
|
182823
182754
|
}
|
|
182824
182755
|
isKnownTypesPackageName(name) {
|
|
182825
|
-
return this.
|
|
182756
|
+
return this.projectService.typingsInstaller.isKnownTypesPackageName(name);
|
|
182826
182757
|
}
|
|
182827
182758
|
installPackage(options) {
|
|
182828
|
-
return this.
|
|
182759
|
+
return this.projectService.typingsInstaller.installPackage({ ...options, projectName: this.projectName, projectRootPath: this.toPath(this.currentDirectory) });
|
|
182829
182760
|
}
|
|
182830
182761
|
/** @internal */
|
|
182831
182762
|
getGlobalTypingsCacheLocation() {
|
|
182832
182763
|
return this.getGlobalCache();
|
|
182833
182764
|
}
|
|
182834
|
-
get typingsCache() {
|
|
182835
|
-
return this.projectService.typingsCache;
|
|
182836
|
-
}
|
|
182837
182765
|
/** @internal */
|
|
182838
182766
|
getSymlinkCache() {
|
|
182839
182767
|
if (!this.symlinks) {
|
|
@@ -183236,7 +183164,8 @@ var Project3 = class _Project {
|
|
|
183236
183164
|
}
|
|
183237
183165
|
close() {
|
|
183238
183166
|
var _a;
|
|
183239
|
-
this.projectService.
|
|
183167
|
+
if (this.typingsCache) this.projectService.typingsInstaller.onProjectClosed(this);
|
|
183168
|
+
this.typingsCache = void 0;
|
|
183240
183169
|
this.closeWatchingTypingLocations();
|
|
183241
183170
|
this.cleanupProgram();
|
|
183242
183171
|
forEach(this.externalFiles, (externalFile) => this.detachScriptInfoIfNotRoot(externalFile));
|
|
@@ -183501,7 +183430,7 @@ var Project3 = class _Project {
|
|
|
183501
183430
|
if (hasNewProgram || changedFiles.length) {
|
|
183502
183431
|
this.lastCachedUnresolvedImportsList = getUnresolvedImports(this.program, this.cachedUnresolvedImportsPerFile);
|
|
183503
183432
|
}
|
|
183504
|
-
this.
|
|
183433
|
+
this.enqueueInstallTypingsForProject(hasAddedorRemovedFiles);
|
|
183505
183434
|
} else {
|
|
183506
183435
|
this.lastCachedUnresolvedImportsList = void 0;
|
|
183507
183436
|
}
|
|
@@ -183519,7 +183448,29 @@ var Project3 = class _Project {
|
|
|
183519
183448
|
return !hasNewProgram;
|
|
183520
183449
|
}
|
|
183521
183450
|
/** @internal */
|
|
183522
|
-
|
|
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);
|
|
183523
183474
|
if (enumerateInsertsAndDeletes(
|
|
183524
183475
|
typingFiles,
|
|
183525
183476
|
this.typingFiles,
|
|
@@ -184305,7 +184256,7 @@ function extractUnresolvedImportsFromSourceFile(program, file, ambientModules, c
|
|
|
184305
184256
|
return unresolvedImports || emptyArray2;
|
|
184306
184257
|
});
|
|
184307
184258
|
}
|
|
184308
|
-
var InferredProject2 = class extends
|
|
184259
|
+
var InferredProject2 = class extends Project2 {
|
|
184309
184260
|
/** @internal */
|
|
184310
184261
|
constructor(projectService, documentRegistry, compilerOptions, watchOptions, projectRootPath, currentDirectory, typeAcquisition) {
|
|
184311
184262
|
super(
|
|
@@ -184399,7 +184350,7 @@ var InferredProject2 = class extends Project3 {
|
|
|
184399
184350
|
};
|
|
184400
184351
|
}
|
|
184401
184352
|
};
|
|
184402
|
-
var AuxiliaryProject = class extends
|
|
184353
|
+
var AuxiliaryProject = class extends Project2 {
|
|
184403
184354
|
constructor(projectService, documentRegistry, compilerOptions, currentDirectory) {
|
|
184404
184355
|
super(
|
|
184405
184356
|
projectService.newAuxiliaryProjectName(),
|
|
@@ -184426,7 +184377,7 @@ var AuxiliaryProject = class extends Project3 {
|
|
|
184426
184377
|
return;
|
|
184427
184378
|
}
|
|
184428
184379
|
};
|
|
184429
|
-
var _AutoImportProviderProject = class _AutoImportProviderProject extends
|
|
184380
|
+
var _AutoImportProviderProject = class _AutoImportProviderProject extends Project2 {
|
|
184430
184381
|
/** @internal */
|
|
184431
184382
|
constructor(hostProject, initialRootNames, documentRegistry, compilerOptions) {
|
|
184432
184383
|
super(
|
|
@@ -184693,7 +184644,7 @@ _AutoImportProviderProject.compilerOptionsOverrides = {
|
|
|
184693
184644
|
noLib: true
|
|
184694
184645
|
};
|
|
184695
184646
|
var AutoImportProviderProject = _AutoImportProviderProject;
|
|
184696
|
-
var ConfiguredProject2 = class extends
|
|
184647
|
+
var ConfiguredProject2 = class extends Project2 {
|
|
184697
184648
|
/** @internal */
|
|
184698
184649
|
constructor(configFileName, canonicalConfigFilePath, projectService, documentRegistry, cachedDirectoryStructureHost, pendingUpdateReason) {
|
|
184699
184650
|
super(
|
|
@@ -184898,7 +184849,7 @@ var ConfiguredProject2 = class extends Project3 {
|
|
|
184898
184849
|
updateErrorForNoInputFiles(fileNames, this.getConfigFilePath(), this.getCompilerOptions().configFile.configFileSpecs, this.projectErrors, this.canConfigFileJsonReportNoInputFiles);
|
|
184899
184850
|
}
|
|
184900
184851
|
};
|
|
184901
|
-
var ExternalProject = class extends
|
|
184852
|
+
var ExternalProject = class extends Project2 {
|
|
184902
184853
|
/** @internal */
|
|
184903
184854
|
constructor(externalProjectName, projectService, documentRegistry, compilerOptions, lastFileExceededProgramSize, compileOnSaveEnabled, projectFilePath, watchOptions) {
|
|
184904
184855
|
super(
|
|
@@ -185105,6 +185056,16 @@ function findProjectByName(projectName, projects) {
|
|
|
185105
185056
|
}
|
|
185106
185057
|
}
|
|
185107
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
|
+
};
|
|
185108
185069
|
var noopConfigFileWatcher = { close: noop };
|
|
185109
185070
|
function getConfigFileNameFromCache(info, cache) {
|
|
185110
185071
|
if (!cache) return void 0;
|
|
@@ -185525,7 +185486,6 @@ var _ProjectService = class _ProjectService {
|
|
|
185525
185486
|
this.logger.info("No types map provided; using the default");
|
|
185526
185487
|
}
|
|
185527
185488
|
this.typingsInstaller.attach(this);
|
|
185528
|
-
this.typingsCache = new TypingsCache(this.typingsInstaller);
|
|
185529
185489
|
this.hostConfiguration = {
|
|
185530
185490
|
formatCodeOptions: getDefaultFormatCodeSettings(this.host.newLine),
|
|
185531
185491
|
preferences: emptyOptions,
|
|
@@ -185618,12 +185578,15 @@ var _ProjectService = class _ProjectService {
|
|
|
185618
185578
|
}
|
|
185619
185579
|
switch (response.kind) {
|
|
185620
185580
|
case ActionSet:
|
|
185621
|
-
project.updateTypingFiles(
|
|
185581
|
+
project.updateTypingFiles(
|
|
185582
|
+
response.compilerOptions,
|
|
185583
|
+
response.typeAcquisition,
|
|
185584
|
+
response.unresolvedImports,
|
|
185585
|
+
response.typings
|
|
185586
|
+
);
|
|
185622
185587
|
return;
|
|
185623
185588
|
case ActionInvalidate:
|
|
185624
|
-
|
|
185625
|
-
project,
|
|
185626
|
-
project.lastCachedUnresolvedImportsList,
|
|
185589
|
+
project.enqueueInstallTypingsForProject(
|
|
185627
185590
|
/*forceRefresh*/
|
|
185628
185591
|
true
|
|
185629
185592
|
);
|
|
@@ -188357,7 +188320,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
188357
188320
|
return;
|
|
188358
188321
|
}
|
|
188359
188322
|
if (this.host.importPlugin) {
|
|
188360
|
-
const importPromise =
|
|
188323
|
+
const importPromise = Project2.importServicePluginAsync(
|
|
188361
188324
|
pluginConfigEntry,
|
|
188362
188325
|
searchPaths,
|
|
188363
188326
|
this.host,
|
|
@@ -188371,7 +188334,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
188371
188334
|
}
|
|
188372
188335
|
this.endEnablePlugin(
|
|
188373
188336
|
project,
|
|
188374
|
-
|
|
188337
|
+
Project2.importServicePluginSync(
|
|
188375
188338
|
pluginConfigEntry,
|
|
188376
188339
|
searchPaths,
|
|
188377
188340
|
this.host,
|
|
@@ -188560,7 +188523,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
188560
188523
|
};
|
|
188561
188524
|
/** Makes a filename safe to insert in a RegExp */
|
|
188562
188525
|
_ProjectService.filenameEscapeRegexp = /[-/\\^$*+?.()|[\]{}]/g;
|
|
188563
|
-
var
|
|
188526
|
+
var ProjectService2 = _ProjectService;
|
|
188564
188527
|
function createIncompleteCompletionsCache() {
|
|
188565
188528
|
let info;
|
|
188566
188529
|
return {
|
|
@@ -189928,7 +189891,7 @@ var Session3 = class _Session {
|
|
|
189928
189891
|
canUseWatchEvents: opts.canUseWatchEvents,
|
|
189929
189892
|
incrementalVerifier: opts.incrementalVerifier
|
|
189930
189893
|
};
|
|
189931
|
-
this.projectService = new
|
|
189894
|
+
this.projectService = new ProjectService2(settings);
|
|
189932
189895
|
this.projectService.setPerformanceEventHandler(this.performanceEventHandler.bind(this));
|
|
189933
189896
|
this.gcTimer = new GcTimer(
|
|
189934
189897
|
this.host,
|
|
@@ -193093,20 +193056,19 @@ __export(ts_server_exports4, {
|
|
|
193093
193056
|
LogLevel: () => LogLevel2,
|
|
193094
193057
|
Msg: () => Msg,
|
|
193095
193058
|
OpenFileInfoTelemetryEvent: () => OpenFileInfoTelemetryEvent,
|
|
193096
|
-
Project: () =>
|
|
193059
|
+
Project: () => Project2,
|
|
193097
193060
|
ProjectInfoTelemetryEvent: () => ProjectInfoTelemetryEvent,
|
|
193098
193061
|
ProjectKind: () => ProjectKind,
|
|
193099
193062
|
ProjectLanguageServiceStateEvent: () => ProjectLanguageServiceStateEvent,
|
|
193100
193063
|
ProjectLoadingFinishEvent: () => ProjectLoadingFinishEvent,
|
|
193101
193064
|
ProjectLoadingStartEvent: () => ProjectLoadingStartEvent,
|
|
193102
|
-
ProjectService: () =>
|
|
193065
|
+
ProjectService: () => ProjectService2,
|
|
193103
193066
|
ProjectsUpdatedInBackgroundEvent: () => ProjectsUpdatedInBackgroundEvent,
|
|
193104
193067
|
ScriptInfo: () => ScriptInfo,
|
|
193105
193068
|
ScriptVersionCache: () => ScriptVersionCache,
|
|
193106
193069
|
Session: () => Session3,
|
|
193107
193070
|
TextStorage: () => TextStorage,
|
|
193108
193071
|
ThrottledOperations: () => ThrottledOperations,
|
|
193109
|
-
TypingsCache: () => TypingsCache,
|
|
193110
193072
|
TypingsInstallerAdapter: () => TypingsInstallerAdapter,
|
|
193111
193073
|
allFilesAreJsOrDts: () => allFilesAreJsOrDts,
|
|
193112
193074
|
allRootFilesAreJsOrDts: () => allRootFilesAreJsOrDts,
|
|
@@ -194162,6 +194124,8 @@ if (typeof console !== "undefined") {
|
|
|
194162
194124
|
getResolvePackageJsonExports,
|
|
194163
194125
|
getResolvePackageJsonImports,
|
|
194164
194126
|
getResolvedExternalModuleName,
|
|
194127
|
+
getResolvedModuleFromResolution,
|
|
194128
|
+
getResolvedTypeReferenceDirectiveFromResolution,
|
|
194165
194129
|
getRestIndicatorOfBindingOrAssignmentElement,
|
|
194166
194130
|
getRestParameterElementType,
|
|
194167
194131
|
getRightMostAssignedExpression,
|