typescript 5.1.0-dev.20230419 → 5.1.0-dev.20230421
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 +207 -41
- package/lib/tsserver.js +346 -166
- package/lib/tsserverlibrary.d.ts +31 -7
- package/lib/tsserverlibrary.js +344 -160
- package/lib/typescript.d.ts +15 -2
- package/lib/typescript.js +245 -62
- package/lib/typingsInstaller.js +3 -1
- package/package.json +5 -3
package/lib/tsserverlibrary.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.1";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230421`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -34847,7 +34847,9 @@ ${lanes.join("\n")}
|
|
|
34847
34847
|
const usedBrace = parseOptional(19 /* OpenBraceToken */);
|
|
34848
34848
|
const pos = getNodePos();
|
|
34849
34849
|
const expression = parsePropertyAccessEntityNameExpression();
|
|
34850
|
+
scanner2.setInJSDocType(true);
|
|
34850
34851
|
const typeArguments = tryParseTypeArguments();
|
|
34852
|
+
scanner2.setInJSDocType(false);
|
|
34851
34853
|
const node = factory2.createExpressionWithTypeArguments(expression, typeArguments);
|
|
34852
34854
|
const res = finishNode(node, pos);
|
|
34853
34855
|
if (usedBrace) {
|
|
@@ -39501,13 +39503,12 @@ ${lanes.join("\n")}
|
|
|
39501
39503
|
nonRelativeNameResolutionCache.update(options2);
|
|
39502
39504
|
}
|
|
39503
39505
|
}
|
|
39504
|
-
function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options) {
|
|
39506
|
+
function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache) {
|
|
39505
39507
|
const result = createModuleOrTypeReferenceResolutionCache(
|
|
39506
39508
|
currentDirectory,
|
|
39507
39509
|
getCanonicalFileName,
|
|
39508
39510
|
options,
|
|
39509
|
-
|
|
39510
|
-
void 0,
|
|
39511
|
+
packageJsonInfoCache,
|
|
39511
39512
|
getOriginalOrResolvedModuleFileName
|
|
39512
39513
|
);
|
|
39513
39514
|
result.getOrCreateCacheForModuleName = (nonRelativeName, mode, redirectedReference) => result.getOrCreateCacheForNonRelativeName(nonRelativeName, mode, redirectedReference);
|
|
@@ -39522,6 +39523,12 @@ ${lanes.join("\n")}
|
|
|
39522
39523
|
getOriginalOrResolvedTypeReferenceFileName
|
|
39523
39524
|
);
|
|
39524
39525
|
}
|
|
39526
|
+
function getOptionsForLibraryResolution(options) {
|
|
39527
|
+
return { moduleResolution: 2 /* Node10 */, traceResolution: options.traceResolution };
|
|
39528
|
+
}
|
|
39529
|
+
function resolveLibrary(libraryName, resolveFrom, compilerOptions, host, cache) {
|
|
39530
|
+
return resolveModuleName(libraryName, resolveFrom, getOptionsForLibraryResolution(compilerOptions), host, cache);
|
|
39531
|
+
}
|
|
39525
39532
|
function resolveModuleNameFromCache(moduleName, containingFile, cache, mode) {
|
|
39526
39533
|
const containingDirectory = getDirectoryPath(containingFile);
|
|
39527
39534
|
return cache.getFromDirectoryCache(
|
|
@@ -56757,7 +56764,8 @@ ${lanes.join("\n")}
|
|
|
56757
56764
|
thisParameter = createSymbolWithType(createSymbol(1 /* FunctionScopedVariable */, "this" /* This */), getTypeFromTypeNode(thisTag.typeExpression));
|
|
56758
56765
|
}
|
|
56759
56766
|
}
|
|
56760
|
-
const
|
|
56767
|
+
const hostDeclaration = isJSDocSignature(declaration) ? getEffectiveJSDocHost(declaration) : declaration;
|
|
56768
|
+
const classType = hostDeclaration && isConstructorDeclaration(hostDeclaration) ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(hostDeclaration.parent.symbol)) : void 0;
|
|
56761
56769
|
const typeParameters = classType ? classType.localTypeParameters : getTypeParametersFromDeclaration(declaration);
|
|
56762
56770
|
if (hasRestParameter(declaration) || isInJSFile(declaration) && maybeAddJsSyntheticRestParameter(declaration, parameters)) {
|
|
56763
56771
|
flags |= 1 /* HasRestParameter */;
|
|
@@ -116109,6 +116117,25 @@ ${lanes.join("\n")}
|
|
|
116109
116117
|
});
|
|
116110
116118
|
}
|
|
116111
116119
|
}
|
|
116120
|
+
function getInferredLibraryNameResolveFrom(options, currentDirectory, libFileName) {
|
|
116121
|
+
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : currentDirectory;
|
|
116122
|
+
return combinePaths(containingDirectory, `__lib_node_modules_lookup_${libFileName}__.ts`);
|
|
116123
|
+
}
|
|
116124
|
+
function getLibraryNameFromLibFileName(libFileName) {
|
|
116125
|
+
const components = libFileName.split(".");
|
|
116126
|
+
let path = components[1];
|
|
116127
|
+
let i = 2;
|
|
116128
|
+
while (components[i] && components[i] !== "d") {
|
|
116129
|
+
path += (i === 2 ? "/" : "-") + components[i];
|
|
116130
|
+
i++;
|
|
116131
|
+
}
|
|
116132
|
+
return "@typescript/lib-" + path;
|
|
116133
|
+
}
|
|
116134
|
+
function getLibFileNameFromLibReference(libReference) {
|
|
116135
|
+
const libName = toFileNameLowerCase(libReference.fileName);
|
|
116136
|
+
const libFileName = libMap.get(libName);
|
|
116137
|
+
return { libName, libFileName };
|
|
116138
|
+
}
|
|
116112
116139
|
function isReferencedFile(reason) {
|
|
116113
116140
|
switch (reason == null ? void 0 : reason.kind) {
|
|
116114
116141
|
case 3 /* Import */:
|
|
@@ -116152,7 +116179,7 @@ ${lanes.join("\n")}
|
|
|
116152
116179
|
}
|
|
116153
116180
|
return { file, pos, end, packageId };
|
|
116154
116181
|
}
|
|
116155
|
-
function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) {
|
|
116182
|
+
function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolutions, hasInvalidatedLibResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) {
|
|
116156
116183
|
if (!program || (hasChangedAutomaticTypeDirectiveNames == null ? void 0 : hasChangedAutomaticTypeDirectiveNames()))
|
|
116157
116184
|
return false;
|
|
116158
116185
|
if (!arrayIsEqualTo(program.getRootFileNames(), rootFileNames))
|
|
@@ -116167,6 +116194,8 @@ ${lanes.join("\n")}
|
|
|
116167
116194
|
const currentOptions = program.getCompilerOptions();
|
|
116168
116195
|
if (!compareDataObjects(currentOptions, newOptions))
|
|
116169
116196
|
return false;
|
|
116197
|
+
if (program.resolvedLibReferences && forEachEntry(program.resolvedLibReferences, (_value, libFileName) => hasInvalidatedLibResolutions(libFileName)))
|
|
116198
|
+
return false;
|
|
116170
116199
|
if (currentOptions.configFile && newOptions.configFile)
|
|
116171
116200
|
return currentOptions.configFile.text === newOptions.configFile.text;
|
|
116172
116201
|
return true;
|
|
@@ -116259,6 +116288,8 @@ ${lanes.join("\n")}
|
|
|
116259
116288
|
let fileProcessingDiagnostics;
|
|
116260
116289
|
let automaticTypeDirectiveNames;
|
|
116261
116290
|
let automaticTypeDirectiveResolutions;
|
|
116291
|
+
let resolvedLibReferences;
|
|
116292
|
+
let resolvedLibProcessing;
|
|
116262
116293
|
const maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0;
|
|
116263
116294
|
let currentNodeModulesDepth = 0;
|
|
116264
116295
|
const modulesWithElidedImports = /* @__PURE__ */ new Map();
|
|
@@ -116346,6 +116377,14 @@ ${lanes.join("\n")}
|
|
|
116346
116377
|
createTypeReferenceResolutionLoader
|
|
116347
116378
|
);
|
|
116348
116379
|
}
|
|
116380
|
+
const hasInvalidatedLibResolutions = host.hasInvalidatedLibResolutions || returnFalse;
|
|
116381
|
+
let actualResolveLibrary;
|
|
116382
|
+
if (host.resolveLibrary) {
|
|
116383
|
+
actualResolveLibrary = host.resolveLibrary.bind(host);
|
|
116384
|
+
} else {
|
|
116385
|
+
const libraryResolutionCache = createModuleResolutionCache(currentDirectory, getCanonicalFileName, options, moduleResolutionCache == null ? void 0 : moduleResolutionCache.getPackageJsonInfoCache());
|
|
116386
|
+
actualResolveLibrary = (libraryName, resolveFrom, options2) => resolveLibrary(libraryName, resolveFrom, options2, host, libraryResolutionCache);
|
|
116387
|
+
}
|
|
116349
116388
|
const packageIdToSourceFile = /* @__PURE__ */ new Map();
|
|
116350
116389
|
let sourceFileToPackageName = /* @__PURE__ */ new Map();
|
|
116351
116390
|
let redirectTargetsMap = createMultiMap();
|
|
@@ -116512,6 +116551,7 @@ ${lanes.join("\n")}
|
|
|
116512
116551
|
);
|
|
116513
116552
|
}
|
|
116514
116553
|
oldProgram = void 0;
|
|
116554
|
+
resolvedLibProcessing = void 0;
|
|
116515
116555
|
const program = {
|
|
116516
116556
|
getRootFileNames: () => rootNames,
|
|
116517
116557
|
getSourceFile,
|
|
@@ -116553,6 +116593,7 @@ ${lanes.join("\n")}
|
|
|
116553
116593
|
sourceFileToPackageName,
|
|
116554
116594
|
redirectTargetsMap,
|
|
116555
116595
|
usesUriStyleNodeCoreModules,
|
|
116596
|
+
resolvedLibReferences,
|
|
116556
116597
|
isEmittedFile,
|
|
116557
116598
|
getConfigFileParsingDiagnostics: getConfigFileParsingDiagnostics2,
|
|
116558
116599
|
getProjectReferences,
|
|
@@ -117041,6 +117082,9 @@ ${lanes.join("\n")}
|
|
|
117041
117082
|
if (changesAffectingProgramStructure(oldOptions, options)) {
|
|
117042
117083
|
return 1 /* SafeModules */;
|
|
117043
117084
|
}
|
|
117085
|
+
if (oldProgram.resolvedLibReferences && forEachEntry(oldProgram.resolvedLibReferences, (resolution, libFileName) => pathForLibFileWorker(libFileName).actual !== resolution.actual)) {
|
|
117086
|
+
return 1 /* SafeModules */;
|
|
117087
|
+
}
|
|
117044
117088
|
if (host.hasChangedAutomaticTypeDirectiveNames) {
|
|
117045
117089
|
if (host.hasChangedAutomaticTypeDirectiveNames())
|
|
117046
117090
|
return 1 /* SafeModules */;
|
|
@@ -117077,6 +117121,7 @@ ${lanes.join("\n")}
|
|
|
117077
117121
|
sourceFileToPackageName = oldProgram.sourceFileToPackageName;
|
|
117078
117122
|
redirectTargetsMap = oldProgram.redirectTargetsMap;
|
|
117079
117123
|
usesUriStyleNodeCoreModules = oldProgram.usesUriStyleNodeCoreModules;
|
|
117124
|
+
resolvedLibReferences = oldProgram.resolvedLibReferences;
|
|
117080
117125
|
return 2 /* Completely */;
|
|
117081
117126
|
}
|
|
117082
117127
|
function getEmitHost(writeFileCallback) {
|
|
@@ -117186,7 +117231,7 @@ ${lanes.join("\n")}
|
|
|
117186
117231
|
if (!options.lib) {
|
|
117187
117232
|
return equalityComparer(file.fileName, getDefaultLibraryFileName());
|
|
117188
117233
|
} else {
|
|
117189
|
-
return some(options.lib, (libFileName) => equalityComparer(file.fileName,
|
|
117234
|
+
return some(options.lib, (libFileName) => equalityComparer(file.fileName, resolvedLibReferences.get(libFileName).actual));
|
|
117190
117235
|
}
|
|
117191
117236
|
}
|
|
117192
117237
|
function getTypeChecker() {
|
|
@@ -117777,11 +117822,10 @@ ${lanes.join("\n")}
|
|
|
117777
117822
|
}
|
|
117778
117823
|
}
|
|
117779
117824
|
function getLibFileFromReference(ref) {
|
|
117780
|
-
|
|
117781
|
-
const libFileName =
|
|
117782
|
-
|
|
117783
|
-
|
|
117784
|
-
}
|
|
117825
|
+
var _a2;
|
|
117826
|
+
const { libFileName } = getLibFileNameFromLibReference(ref);
|
|
117827
|
+
const actualFileName = libFileName && ((_a2 = resolvedLibReferences == null ? void 0 : resolvedLibReferences.get(libFileName)) == null ? void 0 : _a2.actual);
|
|
117828
|
+
return actualFileName !== void 0 ? getSourceFile(actualFileName) : void 0;
|
|
117785
117829
|
}
|
|
117786
117830
|
function getSourceFileFromReference(referencingFile, ref) {
|
|
117787
117831
|
return getSourceFileFromReferenceWorker(resolveTripleslashReference(ref.fileName, referencingFile.fileName), getSourceFile);
|
|
@@ -118206,25 +118250,55 @@ ${lanes.join("\n")}
|
|
|
118206
118250
|
}
|
|
118207
118251
|
}
|
|
118208
118252
|
function pathForLibFile(libFileName) {
|
|
118209
|
-
const
|
|
118210
|
-
|
|
118211
|
-
|
|
118212
|
-
|
|
118213
|
-
|
|
118214
|
-
|
|
118215
|
-
|
|
118216
|
-
|
|
118217
|
-
|
|
118218
|
-
const
|
|
118219
|
-
if (
|
|
118220
|
-
return
|
|
118221
|
-
|
|
118222
|
-
|
|
118253
|
+
const existing = resolvedLibReferences == null ? void 0 : resolvedLibReferences.get(libFileName);
|
|
118254
|
+
if (existing)
|
|
118255
|
+
return existing.actual;
|
|
118256
|
+
const result = pathForLibFileWorker(libFileName);
|
|
118257
|
+
(resolvedLibReferences ?? (resolvedLibReferences = /* @__PURE__ */ new Map())).set(libFileName, result);
|
|
118258
|
+
return result.actual;
|
|
118259
|
+
}
|
|
118260
|
+
function pathForLibFileWorker(libFileName) {
|
|
118261
|
+
var _a2, _b2, _c2, _d2, _e2;
|
|
118262
|
+
const existing = resolvedLibProcessing == null ? void 0 : resolvedLibProcessing.get(libFileName);
|
|
118263
|
+
if (existing)
|
|
118264
|
+
return existing;
|
|
118265
|
+
if (structureIsReused !== 0 /* Not */ && oldProgram && !hasInvalidatedLibResolutions(libFileName)) {
|
|
118266
|
+
const oldResolution = (_a2 = oldProgram.resolvedLibReferences) == null ? void 0 : _a2.get(libFileName);
|
|
118267
|
+
if (oldResolution) {
|
|
118268
|
+
if (oldResolution.resolution && isTraceEnabled(options, host)) {
|
|
118269
|
+
const libraryName2 = getLibraryNameFromLibFileName(libFileName);
|
|
118270
|
+
const resolveFrom2 = getInferredLibraryNameResolveFrom(options, currentDirectory, libFileName);
|
|
118271
|
+
trace(
|
|
118272
|
+
host,
|
|
118273
|
+
oldResolution.resolution.resolvedModule ? oldResolution.resolution.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 : Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_not_resolved,
|
|
118274
|
+
libraryName2,
|
|
118275
|
+
getNormalizedAbsolutePath(resolveFrom2, currentDirectory),
|
|
118276
|
+
(_b2 = oldResolution.resolution.resolvedModule) == null ? void 0 : _b2.resolvedFileName,
|
|
118277
|
+
((_c2 = oldResolution.resolution.resolvedModule) == null ? void 0 : _c2.packageId) && packageIdToString(oldResolution.resolution.resolvedModule.packageId)
|
|
118278
|
+
);
|
|
118279
|
+
}
|
|
118280
|
+
(resolvedLibProcessing ?? (resolvedLibProcessing = /* @__PURE__ */ new Map())).set(libFileName, oldResolution);
|
|
118281
|
+
return oldResolution;
|
|
118282
|
+
}
|
|
118283
|
+
}
|
|
118284
|
+
const libraryName = getLibraryNameFromLibFileName(libFileName);
|
|
118285
|
+
const resolveFrom = getInferredLibraryNameResolveFrom(options, currentDirectory, libFileName);
|
|
118286
|
+
(_d2 = tracing) == null ? void 0 : _d2.push(tracing.Phase.Program, "resolveLibrary", { resolveFrom });
|
|
118287
|
+
mark("beforeResolveLibrary");
|
|
118288
|
+
const resolution = actualResolveLibrary(libraryName, resolveFrom, options, libFileName);
|
|
118289
|
+
mark("afterResolveLibrary");
|
|
118290
|
+
measure("ResolveLibrary", "beforeResolveLibrary", "afterResolveLibrary");
|
|
118291
|
+
(_e2 = tracing) == null ? void 0 : _e2.pop();
|
|
118292
|
+
const result = {
|
|
118293
|
+
resolution,
|
|
118294
|
+
actual: resolution.resolvedModule ? resolution.resolvedModule.resolvedFileName : combinePaths(defaultLibraryPath, libFileName)
|
|
118295
|
+
};
|
|
118296
|
+
(resolvedLibProcessing ?? (resolvedLibProcessing = /* @__PURE__ */ new Map())).set(libFileName, result);
|
|
118297
|
+
return result;
|
|
118223
118298
|
}
|
|
118224
118299
|
function processLibReferenceDirectives(file) {
|
|
118225
118300
|
forEach(file.libReferenceDirectives, (libReference, index) => {
|
|
118226
|
-
const libName =
|
|
118227
|
-
const libFileName = libMap.get(libName);
|
|
118301
|
+
const { libName, libFileName } = getLibFileNameFromLibReference(libReference);
|
|
118228
118302
|
if (libFileName) {
|
|
118229
118303
|
processRootFile(
|
|
118230
118304
|
pathForLibFile(libFileName),
|
|
@@ -121381,7 +121455,7 @@ ${lanes.join("\n")}
|
|
|
121381
121455
|
let failedLookupChecks;
|
|
121382
121456
|
let startsWithPathChecks;
|
|
121383
121457
|
let isInDirectoryChecks;
|
|
121384
|
-
let
|
|
121458
|
+
let allModuleAndTypeResolutionsAreInvalidated = false;
|
|
121385
121459
|
const getCurrentDirectory = memoize(() => resolutionHost.getCurrentDirectory());
|
|
121386
121460
|
const cachedDirectoryStructureHost = resolutionHost.getCachedDirectoryStructureHost();
|
|
121387
121461
|
const resolvedModuleNames = /* @__PURE__ */ new Map();
|
|
@@ -121397,6 +121471,13 @@ ${lanes.join("\n")}
|
|
|
121397
121471
|
resolutionHost.getCompilationSettings(),
|
|
121398
121472
|
moduleResolutionCache.getPackageJsonInfoCache()
|
|
121399
121473
|
);
|
|
121474
|
+
const resolvedLibraries = /* @__PURE__ */ new Map();
|
|
121475
|
+
const libraryResolutionCache = createModuleResolutionCache(
|
|
121476
|
+
getCurrentDirectory(),
|
|
121477
|
+
resolutionHost.getCanonicalFileName,
|
|
121478
|
+
getOptionsForLibraryResolution(resolutionHost.getCompilationSettings()),
|
|
121479
|
+
moduleResolutionCache.getPackageJsonInfoCache()
|
|
121480
|
+
);
|
|
121400
121481
|
const directoryWatchesOfFailedLookups = /* @__PURE__ */ new Map();
|
|
121401
121482
|
const fileWatchesOfAffectingLocations = /* @__PURE__ */ new Map();
|
|
121402
121483
|
const rootDir = getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirectory);
|
|
@@ -121413,6 +121494,7 @@ ${lanes.join("\n")}
|
|
|
121413
121494
|
finishCachingPerDirectoryResolution,
|
|
121414
121495
|
resolveModuleNameLiterals,
|
|
121415
121496
|
resolveTypeReferenceDirectiveReferences,
|
|
121497
|
+
resolveLibrary: resolveLibrary2,
|
|
121416
121498
|
resolveSingleModuleNameWithoutWatching,
|
|
121417
121499
|
removeResolutionsFromProjectReferenceRedirects,
|
|
121418
121500
|
removeResolutionsOfFile,
|
|
@@ -121448,16 +121530,18 @@ ${lanes.join("\n")}
|
|
|
121448
121530
|
isInDirectoryChecks = void 0;
|
|
121449
121531
|
affectingPathChecks = void 0;
|
|
121450
121532
|
affectingPathChecksForFile = void 0;
|
|
121451
|
-
|
|
121533
|
+
allModuleAndTypeResolutionsAreInvalidated = false;
|
|
121452
121534
|
moduleResolutionCache.clear();
|
|
121453
121535
|
typeReferenceDirectiveResolutionCache.clear();
|
|
121454
121536
|
moduleResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
121455
121537
|
typeReferenceDirectiveResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
121538
|
+
libraryResolutionCache.clear();
|
|
121456
121539
|
impliedFormatPackageJsons.clear();
|
|
121540
|
+
resolvedLibraries.clear();
|
|
121457
121541
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
121458
121542
|
}
|
|
121459
121543
|
function onChangesAffectModuleResolution() {
|
|
121460
|
-
|
|
121544
|
+
allModuleAndTypeResolutionsAreInvalidated = true;
|
|
121461
121545
|
moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
121462
121546
|
typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
121463
121547
|
moduleResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
@@ -121478,24 +121562,45 @@ ${lanes.join("\n")}
|
|
|
121478
121562
|
const value = filesWithInvalidatedNonRelativeUnresolvedImports.get(path);
|
|
121479
121563
|
return !!value && !!value.length;
|
|
121480
121564
|
}
|
|
121481
|
-
function createHasInvalidatedResolutions(customHasInvalidatedResolutions) {
|
|
121565
|
+
function createHasInvalidatedResolutions(customHasInvalidatedResolutions, customHasInvalidatedLibResolutions) {
|
|
121482
121566
|
invalidateResolutionsOfFailedLookupLocations();
|
|
121483
121567
|
const collected = filesWithInvalidatedResolutions;
|
|
121484
121568
|
filesWithInvalidatedResolutions = void 0;
|
|
121485
|
-
return
|
|
121569
|
+
return {
|
|
121570
|
+
hasInvalidatedResolutions: (path) => customHasInvalidatedResolutions(path) || allModuleAndTypeResolutionsAreInvalidated || !!(collected == null ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path),
|
|
121571
|
+
hasInvalidatedLibResolutions: (libFileName) => {
|
|
121572
|
+
var _a;
|
|
121573
|
+
return customHasInvalidatedLibResolutions(libFileName) || !!((_a = resolvedLibraries == null ? void 0 : resolvedLibraries.get(libFileName)) == null ? void 0 : _a.isInvalidated);
|
|
121574
|
+
}
|
|
121575
|
+
};
|
|
121486
121576
|
}
|
|
121487
121577
|
function startCachingPerDirectoryResolution() {
|
|
121488
121578
|
moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
121489
121579
|
typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
121580
|
+
libraryResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
121490
121581
|
nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
|
|
121491
121582
|
nonRelativeExternalModuleResolutions.clear();
|
|
121492
121583
|
}
|
|
121584
|
+
function cleanupLibResolutionWatching(newProgram) {
|
|
121585
|
+
resolvedLibraries.forEach((resolution, libFileName) => {
|
|
121586
|
+
var _a;
|
|
121587
|
+
if (!((_a = newProgram == null ? void 0 : newProgram.resolvedLibReferences) == null ? void 0 : _a.has(libFileName))) {
|
|
121588
|
+
stopWatchFailedLookupLocationOfResolution(
|
|
121589
|
+
resolution,
|
|
121590
|
+
resolutionHost.toPath(getInferredLibraryNameResolveFrom(newProgram.getCompilerOptions(), getCurrentDirectory(), libFileName)),
|
|
121591
|
+
getResolvedModule2
|
|
121592
|
+
);
|
|
121593
|
+
resolvedLibraries.delete(libFileName);
|
|
121594
|
+
}
|
|
121595
|
+
});
|
|
121596
|
+
}
|
|
121493
121597
|
function finishCachingPerDirectoryResolution(newProgram, oldProgram) {
|
|
121494
121598
|
filesWithInvalidatedNonRelativeUnresolvedImports = void 0;
|
|
121495
|
-
|
|
121599
|
+
allModuleAndTypeResolutionsAreInvalidated = false;
|
|
121496
121600
|
nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
|
|
121497
121601
|
nonRelativeExternalModuleResolutions.clear();
|
|
121498
121602
|
if (newProgram !== oldProgram) {
|
|
121603
|
+
cleanupLibResolutionWatching(newProgram);
|
|
121499
121604
|
newProgram == null ? void 0 : newProgram.getSourceFiles().forEach((newFile) => {
|
|
121500
121605
|
var _a;
|
|
121501
121606
|
const expected = isExternalOrCommonJsModule(newFile) ? ((_a = newFile.packageJsonLocations) == null ? void 0 : _a.length) ?? 0 : 0;
|
|
@@ -121604,7 +121709,7 @@ ${lanes.join("\n")}
|
|
|
121604
121709
|
const name = loader.nameAndMode.getName(entry);
|
|
121605
121710
|
const mode = loader.nameAndMode.getMode(entry, containingSourceFile);
|
|
121606
121711
|
let resolution = resolutionsInFile.get(name, mode);
|
|
121607
|
-
if (!seenNamesInFile.has(name, mode) && (
|
|
121712
|
+
if (!seenNamesInFile.has(name, mode) && (allModuleAndTypeResolutionsAreInvalidated || unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate
|
|
121608
121713
|
hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution))) {
|
|
121609
121714
|
const existingResolution = resolution;
|
|
121610
121715
|
resolution = loader.resolve(name, mode);
|
|
@@ -121713,6 +121818,41 @@ ${lanes.join("\n")}
|
|
|
121713
121818
|
// Defer non relative resolution watch because we could be using ambient modules
|
|
121714
121819
|
});
|
|
121715
121820
|
}
|
|
121821
|
+
function resolveLibrary2(libraryName, resolveFrom, options, libFileName) {
|
|
121822
|
+
var _a;
|
|
121823
|
+
const host = ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost;
|
|
121824
|
+
let resolution = resolvedLibraries == null ? void 0 : resolvedLibraries.get(libFileName);
|
|
121825
|
+
if (!resolution || resolution.isInvalidated) {
|
|
121826
|
+
const existingResolution = resolution;
|
|
121827
|
+
resolution = resolveLibrary(libraryName, resolveFrom, options, host, libraryResolutionCache);
|
|
121828
|
+
const path = resolutionHost.toPath(resolveFrom);
|
|
121829
|
+
watchFailedLookupLocationsOfExternalModuleResolutions(
|
|
121830
|
+
libraryName,
|
|
121831
|
+
resolution,
|
|
121832
|
+
path,
|
|
121833
|
+
getResolvedModule2,
|
|
121834
|
+
/*deferWatchingNonRelativeResolution*/
|
|
121835
|
+
false
|
|
121836
|
+
);
|
|
121837
|
+
resolvedLibraries.set(libFileName, resolution);
|
|
121838
|
+
if (existingResolution) {
|
|
121839
|
+
stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolvedModule2);
|
|
121840
|
+
}
|
|
121841
|
+
} else {
|
|
121842
|
+
if (isTraceEnabled(options, host)) {
|
|
121843
|
+
const resolved = getResolvedModule2(resolution);
|
|
121844
|
+
trace(
|
|
121845
|
+
host,
|
|
121846
|
+
(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,
|
|
121847
|
+
libraryName,
|
|
121848
|
+
resolveFrom,
|
|
121849
|
+
resolved == null ? void 0 : resolved.resolvedFileName,
|
|
121850
|
+
(resolved == null ? void 0 : resolved.packageId) && packageIdToString(resolved.packageId)
|
|
121851
|
+
);
|
|
121852
|
+
}
|
|
121853
|
+
}
|
|
121854
|
+
return resolution;
|
|
121855
|
+
}
|
|
121716
121856
|
function resolveSingleModuleNameWithoutWatching(moduleName, containingFile) {
|
|
121717
121857
|
const path = resolutionHost.toPath(containingFile);
|
|
121718
121858
|
const resolutionsInFile = resolvedModuleNames.get(path);
|
|
@@ -122035,9 +122175,12 @@ ${lanes.join("\n")}
|
|
|
122035
122175
|
}
|
|
122036
122176
|
function invalidateResolutionsOfFailedLookupLocations() {
|
|
122037
122177
|
var _a;
|
|
122038
|
-
if (
|
|
122178
|
+
if (allModuleAndTypeResolutionsAreInvalidated) {
|
|
122039
122179
|
affectingPathChecksForFile = void 0;
|
|
122040
122180
|
invalidatePackageJsonMap();
|
|
122181
|
+
if (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks || affectingPathChecks) {
|
|
122182
|
+
invalidateResolutions(resolvedLibraries, canInvalidateFailedLookupResolution);
|
|
122183
|
+
}
|
|
122041
122184
|
failedLookupChecks = void 0;
|
|
122042
122185
|
startsWithPathChecks = void 0;
|
|
122043
122186
|
isInDirectoryChecks = void 0;
|
|
@@ -122952,9 +123095,11 @@ ${lanes.join("\n")}
|
|
|
122952
123095
|
if (!compilerHost.resolveTypeReferenceDirectiveReferences && !compilerHost.resolveTypeReferenceDirectives) {
|
|
122953
123096
|
compilerHost.resolveTypeReferenceDirectiveReferences = resolutionCache.resolveTypeReferenceDirectiveReferences.bind(resolutionCache);
|
|
122954
123097
|
}
|
|
123098
|
+
compilerHost.resolveLibrary = !host.resolveLibrary ? resolutionCache.resolveLibrary.bind(resolutionCache) : host.resolveLibrary.bind(host);
|
|
122955
123099
|
compilerHost.getModuleResolutionCache = host.resolveModuleNameLiterals || host.resolveModuleNames ? maybeBind(host, host.getModuleResolutionCache) : () => resolutionCache.getModuleResolutionCache();
|
|
122956
123100
|
const userProvidedResolution = !!host.resolveModuleNameLiterals || !!host.resolveTypeReferenceDirectiveReferences || !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives;
|
|
122957
123101
|
const customHasInvalidatedResolutions = userProvidedResolution ? maybeBind(host, host.hasInvalidatedResolutions) || returnTrue : returnFalse;
|
|
123102
|
+
const customHasInvalidLibResolutions = host.resolveLibrary ? maybeBind(host, host.hasInvalidatedLibResolutions) || returnTrue : returnFalse;
|
|
122958
123103
|
builderProgram = readBuilderProgram(compilerOptions, compilerHost);
|
|
122959
123104
|
synchronizeProgram();
|
|
122960
123105
|
watchConfigFileWildCardDirectories();
|
|
@@ -123019,7 +123164,7 @@ ${lanes.join("\n")}
|
|
|
123019
123164
|
resolutionCache.onChangesAffectModuleResolution();
|
|
123020
123165
|
}
|
|
123021
123166
|
}
|
|
123022
|
-
const hasInvalidatedResolutions = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions);
|
|
123167
|
+
const { hasInvalidatedResolutions, hasInvalidatedLibResolutions } = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions, customHasInvalidLibResolutions);
|
|
123023
123168
|
const {
|
|
123024
123169
|
originalReadFile,
|
|
123025
123170
|
originalFileExists,
|
|
@@ -123028,7 +123173,7 @@ ${lanes.join("\n")}
|
|
|
123028
123173
|
originalWriteFile,
|
|
123029
123174
|
readFileWithCache
|
|
123030
123175
|
} = changeCompilerHostLikeToUseCache(compilerHost, toPath3);
|
|
123031
|
-
if (isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, (path) => getSourceVersion(path, readFileWithCache), (fileName) => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
123176
|
+
if (isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, (path) => getSourceVersion(path, readFileWithCache), (fileName) => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasInvalidatedLibResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
123032
123177
|
if (hasChangedConfigFileParsingErrors) {
|
|
123033
123178
|
if (reportFileChangeDetectedOnCreateProgram) {
|
|
123034
123179
|
reportWatchDiagnostic(Diagnostics.File_change_detected_Starting_incremental_compilation);
|
|
@@ -123049,7 +123194,7 @@ ${lanes.join("\n")}
|
|
|
123049
123194
|
if (reportFileChangeDetectedOnCreateProgram) {
|
|
123050
123195
|
reportWatchDiagnostic(Diagnostics.File_change_detected_Starting_incremental_compilation);
|
|
123051
123196
|
}
|
|
123052
|
-
createNewProgram(hasInvalidatedResolutions);
|
|
123197
|
+
createNewProgram(hasInvalidatedResolutions, hasInvalidatedLibResolutions);
|
|
123053
123198
|
}
|
|
123054
123199
|
reportFileChangeDetectedOnCreateProgram = false;
|
|
123055
123200
|
if (host.afterProgramCreate && program !== builderProgram) {
|
|
@@ -123062,7 +123207,7 @@ ${lanes.join("\n")}
|
|
|
123062
123207
|
compilerHost.writeFile = originalWriteFile;
|
|
123063
123208
|
return builderProgram;
|
|
123064
123209
|
}
|
|
123065
|
-
function createNewProgram(hasInvalidatedResolutions) {
|
|
123210
|
+
function createNewProgram(hasInvalidatedResolutions, hasInvalidatedLibResolutions) {
|
|
123066
123211
|
writeLog("CreatingProgramWith::");
|
|
123067
123212
|
writeLog(` roots: ${JSON.stringify(rootFileNames)}`);
|
|
123068
123213
|
writeLog(` options: ${JSON.stringify(compilerOptions)}`);
|
|
@@ -123073,6 +123218,7 @@ ${lanes.join("\n")}
|
|
|
123073
123218
|
hasChangedConfigFileParsingErrors = false;
|
|
123074
123219
|
resolutionCache.startCachingPerDirectoryResolution();
|
|
123075
123220
|
compilerHost.hasInvalidatedResolutions = hasInvalidatedResolutions;
|
|
123221
|
+
compilerHost.hasInvalidatedLibResolutions = hasInvalidatedLibResolutions;
|
|
123076
123222
|
compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames;
|
|
123077
123223
|
const oldProgram = getCurrentProgram();
|
|
123078
123224
|
builderProgram = createProgram2(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
|
|
@@ -123657,6 +123803,7 @@ ${lanes.join("\n")}
|
|
|
123657
123803
|
compilerHost.getParsedCommandLine = (fileName) => parseConfigFile(state, fileName, toResolvedConfigFilePath(state, fileName));
|
|
123658
123804
|
compilerHost.resolveModuleNameLiterals = maybeBind(host, host.resolveModuleNameLiterals);
|
|
123659
123805
|
compilerHost.resolveTypeReferenceDirectiveReferences = maybeBind(host, host.resolveTypeReferenceDirectiveReferences);
|
|
123806
|
+
compilerHost.resolveLibrary = maybeBind(host, host.resolveLibrary);
|
|
123660
123807
|
compilerHost.resolveModuleNames = maybeBind(host, host.resolveModuleNames);
|
|
123661
123808
|
compilerHost.resolveTypeReferenceDirectives = maybeBind(host, host.resolveTypeReferenceDirectives);
|
|
123662
123809
|
compilerHost.getModuleResolutionCache = maybeBind(host, host.getModuleResolutionCache);
|
|
@@ -123694,6 +123841,23 @@ ${lanes.join("\n")}
|
|
|
123694
123841
|
createTypeReferenceResolutionLoader
|
|
123695
123842
|
);
|
|
123696
123843
|
}
|
|
123844
|
+
let libraryResolutionCache;
|
|
123845
|
+
if (!compilerHost.resolveLibrary) {
|
|
123846
|
+
libraryResolutionCache = createModuleResolutionCache(
|
|
123847
|
+
compilerHost.getCurrentDirectory(),
|
|
123848
|
+
compilerHost.getCanonicalFileName,
|
|
123849
|
+
/*options*/
|
|
123850
|
+
void 0,
|
|
123851
|
+
moduleResolutionCache == null ? void 0 : moduleResolutionCache.getPackageJsonInfoCache()
|
|
123852
|
+
);
|
|
123853
|
+
compilerHost.resolveLibrary = (libraryName, resolveFrom, options2) => resolveLibrary(
|
|
123854
|
+
libraryName,
|
|
123855
|
+
resolveFrom,
|
|
123856
|
+
options2,
|
|
123857
|
+
host,
|
|
123858
|
+
libraryResolutionCache
|
|
123859
|
+
);
|
|
123860
|
+
}
|
|
123697
123861
|
compilerHost.getBuildInfo = (fileName, configFilePath) => getBuildInfo3(
|
|
123698
123862
|
state,
|
|
123699
123863
|
fileName,
|
|
@@ -123725,6 +123889,7 @@ ${lanes.join("\n")}
|
|
|
123725
123889
|
compilerHost,
|
|
123726
123890
|
moduleResolutionCache,
|
|
123727
123891
|
typeReferenceDirectiveResolutionCache,
|
|
123892
|
+
libraryResolutionCache,
|
|
123728
123893
|
// Mutable state
|
|
123729
123894
|
buildOrder: void 0,
|
|
123730
123895
|
readFileWithCache: (f) => host.readFile(f),
|
|
@@ -123942,7 +124107,7 @@ ${lanes.join("\n")}
|
|
|
123942
124107
|
function disableCache(state) {
|
|
123943
124108
|
if (!state.cache)
|
|
123944
124109
|
return;
|
|
123945
|
-
const { cache, host, compilerHost, extendedConfigCache, moduleResolutionCache, typeReferenceDirectiveResolutionCache } = state;
|
|
124110
|
+
const { cache, host, compilerHost, extendedConfigCache, moduleResolutionCache, typeReferenceDirectiveResolutionCache, libraryResolutionCache } = state;
|
|
123946
124111
|
host.readFile = cache.originalReadFile;
|
|
123947
124112
|
host.fileExists = cache.originalFileExists;
|
|
123948
124113
|
host.directoryExists = cache.originalDirectoryExists;
|
|
@@ -123953,6 +124118,7 @@ ${lanes.join("\n")}
|
|
|
123953
124118
|
extendedConfigCache.clear();
|
|
123954
124119
|
moduleResolutionCache == null ? void 0 : moduleResolutionCache.clear();
|
|
123955
124120
|
typeReferenceDirectiveResolutionCache == null ? void 0 : typeReferenceDirectiveResolutionCache.clear();
|
|
124121
|
+
libraryResolutionCache == null ? void 0 : libraryResolutionCache.clear();
|
|
123956
124122
|
state.cache = void 0;
|
|
123957
124123
|
}
|
|
123958
124124
|
function clearProjectStatus(state, resolved) {
|
|
@@ -129096,10 +129262,10 @@ ${lanes.join("\n")}
|
|
|
129096
129262
|
158 /* UniqueKeyword */,
|
|
129097
129263
|
159 /* UnknownKeyword */
|
|
129098
129264
|
];
|
|
129099
|
-
QuotePreference = /* @__PURE__ */ ((
|
|
129100
|
-
|
|
129101
|
-
|
|
129102
|
-
return
|
|
129265
|
+
QuotePreference = /* @__PURE__ */ ((QuotePreference6) => {
|
|
129266
|
+
QuotePreference6[QuotePreference6["Single"] = 0] = "Single";
|
|
129267
|
+
QuotePreference6[QuotePreference6["Double"] = 1] = "Double";
|
|
129268
|
+
return QuotePreference6;
|
|
129103
129269
|
})(QuotePreference || {});
|
|
129104
129270
|
displayPartWriter = getDisplayPartWriter();
|
|
129105
129271
|
lineFeed2 = "\n";
|
|
@@ -133868,6 +134034,7 @@ ${lanes.join("\n")}
|
|
|
133868
134034
|
const rootFileNames = host.getScriptFileNames().slice();
|
|
133869
134035
|
const newSettings = host.getCompilationSettings() || getDefaultCompilerOptions2();
|
|
133870
134036
|
const hasInvalidatedResolutions = host.hasInvalidatedResolutions || returnFalse;
|
|
134037
|
+
const hasInvalidatedLibResolutions = maybeBind(host, host.hasInvalidatedLibResolutions) || returnFalse;
|
|
133871
134038
|
const hasChangedAutomaticTypeDirectiveNames = maybeBind(host, host.hasChangedAutomaticTypeDirectiveNames);
|
|
133872
134039
|
const projectReferences = (_b = host.getProjectReferences) == null ? void 0 : _b.call(host);
|
|
133873
134040
|
let parsedCommandLines;
|
|
@@ -133898,6 +134065,7 @@ ${lanes.join("\n")}
|
|
|
133898
134065
|
onReleaseOldSourceFile,
|
|
133899
134066
|
onReleaseParsedCommandLine,
|
|
133900
134067
|
hasInvalidatedResolutions,
|
|
134068
|
+
hasInvalidatedLibResolutions,
|
|
133901
134069
|
hasChangedAutomaticTypeDirectiveNames,
|
|
133902
134070
|
trace: maybeBind(host, host.trace),
|
|
133903
134071
|
resolveModuleNames: maybeBind(host, host.resolveModuleNames),
|
|
@@ -133906,6 +134074,7 @@ ${lanes.join("\n")}
|
|
|
133906
134074
|
resolveTypeReferenceDirectives: maybeBind(host, host.resolveTypeReferenceDirectives),
|
|
133907
134075
|
resolveModuleNameLiterals: maybeBind(host, host.resolveModuleNameLiterals),
|
|
133908
134076
|
resolveTypeReferenceDirectiveReferences: maybeBind(host, host.resolveTypeReferenceDirectiveReferences),
|
|
134077
|
+
resolveLibrary: maybeBind(host, host.resolveLibrary),
|
|
133909
134078
|
useSourceOfProjectReferenceRedirect: maybeBind(host, host.useSourceOfProjectReferenceRedirect),
|
|
133910
134079
|
getParsedCommandLine
|
|
133911
134080
|
};
|
|
@@ -133927,7 +134096,7 @@ ${lanes.join("\n")}
|
|
|
133927
134096
|
onUnRecoverableConfigFileDiagnostic: noop
|
|
133928
134097
|
};
|
|
133929
134098
|
const documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings);
|
|
133930
|
-
if (isProgramUptoDate(program, rootFileNames, newSettings, (_path, fileName) => host.getScriptVersion(fileName), (fileName) => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
134099
|
+
if (isProgramUptoDate(program, rootFileNames, newSettings, (_path, fileName) => host.getScriptVersion(fileName), (fileName) => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasInvalidatedLibResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
133931
134100
|
return;
|
|
133932
134101
|
}
|
|
133933
134102
|
const options = {
|
|
@@ -134231,7 +134400,7 @@ ${lanes.join("\n")}
|
|
|
134231
134400
|
const sourceFile = getValidSourceFile(fileName);
|
|
134232
134401
|
return DocumentHighlights.getDocumentHighlights(program, cancellationToken, sourceFile, position, sourceFilesToSearch);
|
|
134233
134402
|
}
|
|
134234
|
-
function findRenameLocations(fileName, position, findInStrings, findInComments,
|
|
134403
|
+
function findRenameLocations(fileName, position, findInStrings, findInComments, preferences) {
|
|
134235
134404
|
synchronizeHostData();
|
|
134236
134405
|
const sourceFile = getValidSourceFile(fileName);
|
|
134237
134406
|
const node = getAdjustedRenameLocation(getTouchingPropertyName(sourceFile, position));
|
|
@@ -134248,11 +134417,13 @@ ${lanes.join("\n")}
|
|
|
134248
134417
|
};
|
|
134249
134418
|
});
|
|
134250
134419
|
} else {
|
|
134420
|
+
const quotePreference = getQuotePreference(sourceFile, preferences ?? emptyOptions);
|
|
134421
|
+
const providePrefixAndSuffixTextForRename = typeof preferences === "boolean" ? preferences : preferences == null ? void 0 : preferences.providePrefixAndSuffixTextForRename;
|
|
134251
134422
|
return getReferencesWorker2(
|
|
134252
134423
|
node,
|
|
134253
134424
|
position,
|
|
134254
134425
|
{ findInStrings, findInComments, providePrefixAndSuffixTextForRename, use: ts_FindAllReferences_exports.FindReferencesUse.Rename },
|
|
134255
|
-
(entry, originalNode, checker) => ts_FindAllReferences_exports.toRenameLocation(entry, originalNode, checker, providePrefixAndSuffixTextForRename || false)
|
|
134426
|
+
(entry, originalNode, checker) => ts_FindAllReferences_exports.toRenameLocation(entry, originalNode, checker, providePrefixAndSuffixTextForRename || false, quotePreference)
|
|
134256
134427
|
);
|
|
134257
134428
|
}
|
|
134258
134429
|
}
|
|
@@ -134497,6 +134668,7 @@ ${lanes.join("\n")}
|
|
|
134497
134668
|
const token = findPrecedingToken(position, sourceFile);
|
|
134498
134669
|
if (!token || token.parent.kind === 311 /* SourceFile */)
|
|
134499
134670
|
return void 0;
|
|
134671
|
+
const jsxTagWordPattern = "[a-zA-Z0-9:\\-\\._$]*";
|
|
134500
134672
|
if (isJsxFragment(token.parent.parent)) {
|
|
134501
134673
|
const openFragment = token.parent.parent.openingFragment;
|
|
134502
134674
|
const closeFragment = token.parent.parent.closingFragment;
|
|
@@ -134506,7 +134678,10 @@ ${lanes.join("\n")}
|
|
|
134506
134678
|
const closePos = closeFragment.getStart(sourceFile) + 2;
|
|
134507
134679
|
if (position !== openPos && position !== closePos)
|
|
134508
134680
|
return void 0;
|
|
134509
|
-
return {
|
|
134681
|
+
return {
|
|
134682
|
+
ranges: [{ start: openPos, length: 0 }, { start: closePos, length: 0 }],
|
|
134683
|
+
wordPattern: jsxTagWordPattern
|
|
134684
|
+
};
|
|
134510
134685
|
} else {
|
|
134511
134686
|
const tag = findAncestor(
|
|
134512
134687
|
token.parent,
|
|
@@ -134532,7 +134707,8 @@ ${lanes.join("\n")}
|
|
|
134532
134707
|
if (openingTagText !== closeTag.tagName.getText(sourceFile))
|
|
134533
134708
|
return void 0;
|
|
134534
134709
|
return {
|
|
134535
|
-
ranges: [{ start: openTagStart, length: openTagEnd - openTagStart }, { start: closeTagStart, length: closeTagEnd - closeTagStart }]
|
|
134710
|
+
ranges: [{ start: openTagStart, length: openTagEnd - openTagStart }, { start: closeTagStart, length: closeTagEnd - closeTagStart }],
|
|
134711
|
+
wordPattern: jsxTagWordPattern
|
|
134536
134712
|
};
|
|
134537
134713
|
}
|
|
134538
134714
|
}
|
|
@@ -134834,10 +135010,10 @@ ${lanes.join("\n")}
|
|
|
134834
135010
|
function getSmartSelectionRange2(fileName, position) {
|
|
134835
135011
|
return ts_SmartSelectionRange_exports.getSmartSelectionRange(position, syntaxTreeCache.getCurrentSourceFile(fileName));
|
|
134836
135012
|
}
|
|
134837
|
-
function getApplicableRefactors2(fileName, positionOrRange, preferences = emptyOptions, triggerReason, kind) {
|
|
135013
|
+
function getApplicableRefactors2(fileName, positionOrRange, preferences = emptyOptions, triggerReason, kind, includeInteractiveActions) {
|
|
134838
135014
|
synchronizeHostData();
|
|
134839
135015
|
const file = getValidSourceFile(fileName);
|
|
134840
|
-
return ts_refactor_exports.getApplicableRefactors(getRefactorContext(file, positionOrRange, preferences, emptyOptions, triggerReason, kind));
|
|
135016
|
+
return ts_refactor_exports.getApplicableRefactors(getRefactorContext(file, positionOrRange, preferences, emptyOptions, triggerReason, kind), includeInteractiveActions);
|
|
134841
135017
|
}
|
|
134842
135018
|
function getEditsForRefactor2(fileName, formatOptions, positionOrRange, refactorName13, actionName2, preferences = emptyOptions) {
|
|
134843
135019
|
synchronizeHostData();
|
|
@@ -136251,10 +136427,10 @@ ${lanes.join("\n")}
|
|
|
136251
136427
|
() => this.languageService.getSmartSelectionRange(fileName, position)
|
|
136252
136428
|
);
|
|
136253
136429
|
}
|
|
136254
|
-
findRenameLocations(fileName, position, findInStrings, findInComments,
|
|
136430
|
+
findRenameLocations(fileName, position, findInStrings, findInComments, preferences) {
|
|
136255
136431
|
return this.forwardJSONCall(
|
|
136256
|
-
`findRenameLocations('${fileName}', ${position}, ${findInStrings}, ${findInComments}
|
|
136257
|
-
() => this.languageService.findRenameLocations(fileName, position, findInStrings, findInComments,
|
|
136432
|
+
`findRenameLocations('${fileName}', ${position}, ${findInStrings}, ${findInComments})`,
|
|
136433
|
+
() => this.languageService.findRenameLocations(fileName, position, findInStrings, findInComments, preferences)
|
|
136258
136434
|
);
|
|
136259
136435
|
}
|
|
136260
136436
|
/// GET BRACE MATCHING
|
|
@@ -150024,7 +150200,7 @@ ${lanes.join("\n")}
|
|
|
150024
150200
|
) : isEqualityOperatorKind(previousToken.kind) && isBinaryExpression(parent2) && isEqualityOperatorKind(parent2.operatorToken.kind) ? (
|
|
150025
150201
|
// completion at `x ===/**/` should be for the right side
|
|
150026
150202
|
checker.getTypeAtLocation(parent2.left)
|
|
150027
|
-
) : checker.getContextualType(previousToken);
|
|
150203
|
+
) : checker.getContextualType(previousToken, 4 /* Completions */) || checker.getContextualType(previousToken);
|
|
150028
150204
|
}
|
|
150029
150205
|
}
|
|
150030
150206
|
function getFirstSymbolInChain(symbol, enclosingDeclaration, checker) {
|
|
@@ -151199,7 +151375,7 @@ ${lanes.join("\n")}
|
|
|
151199
151375
|
return true;
|
|
151200
151376
|
}
|
|
151201
151377
|
}
|
|
151202
|
-
return isDeclarationName(contextToken2) && !isShorthandPropertyAssignment(contextToken2.parent) && !isJsxAttribute(contextToken2.parent) && !((isClassLike(contextToken2.parent) || isInterfaceDeclaration(contextToken2.parent)) && (contextToken2 !== previousToken || position > previousToken.end));
|
|
151378
|
+
return isDeclarationName(contextToken2) && !isShorthandPropertyAssignment(contextToken2.parent) && !isJsxAttribute(contextToken2.parent) && !((isClassLike(contextToken2.parent) || isInterfaceDeclaration(contextToken2.parent) || isTypeParameterDeclaration(contextToken2.parent)) && (contextToken2 !== previousToken || position > previousToken.end));
|
|
151203
151379
|
}
|
|
151204
151380
|
function isPreviousPropertyDeclarationTerminated(contextToken2, position2) {
|
|
151205
151381
|
return contextToken2.kind !== 64 /* EqualsToken */ && (contextToken2.kind === 27 /* SemicolonToken */ || !positionsAreOnSameLine(contextToken2.end, position2, sourceFile));
|
|
@@ -153636,8 +153812,8 @@ ${lanes.join("\n")}
|
|
|
153636
153812
|
const { displayParts, symbolKind } = ts_SymbolDisplay_exports.getSymbolDisplayPartsDocumentationAndSymbolKind(checker, symbol, enclosingDeclaration.getSourceFile(), enclosingDeclaration, enclosingDeclaration, meaning);
|
|
153637
153813
|
return { displayParts, kind: symbolKind };
|
|
153638
153814
|
}
|
|
153639
|
-
function toRenameLocation(entry, originalNode, checker, providePrefixAndSuffixText) {
|
|
153640
|
-
return { ...entryToDocumentSpan(entry), ...providePrefixAndSuffixText && getPrefixAndSuffixText(entry, originalNode, checker) };
|
|
153815
|
+
function toRenameLocation(entry, originalNode, checker, providePrefixAndSuffixText, quotePreference) {
|
|
153816
|
+
return { ...entryToDocumentSpan(entry), ...providePrefixAndSuffixText && getPrefixAndSuffixText(entry, originalNode, checker, quotePreference) };
|
|
153641
153817
|
}
|
|
153642
153818
|
function toReferencedSymbolEntry(entry, symbol) {
|
|
153643
153819
|
const referenceEntry = toReferenceEntry(entry);
|
|
@@ -153673,7 +153849,7 @@ ${lanes.join("\n")}
|
|
|
153673
153849
|
};
|
|
153674
153850
|
}
|
|
153675
153851
|
}
|
|
153676
|
-
function getPrefixAndSuffixText(entry, originalNode, checker) {
|
|
153852
|
+
function getPrefixAndSuffixText(entry, originalNode, checker, quotePreference) {
|
|
153677
153853
|
if (entry.kind !== 0 /* Span */ && isIdentifier(originalNode)) {
|
|
153678
153854
|
const { node, kind } = entry;
|
|
153679
153855
|
const parent2 = node.parent;
|
|
@@ -153704,6 +153880,10 @@ ${lanes.join("\n")}
|
|
|
153704
153880
|
return originalNode === entry.node || checker.getSymbolAtLocation(originalNode) === checker.getSymbolAtLocation(entry.node) ? { prefixText: name + " as " } : { suffixText: " as " + name };
|
|
153705
153881
|
}
|
|
153706
153882
|
}
|
|
153883
|
+
if (entry.kind !== 0 /* Span */ && isNumericLiteral(entry.node) && isAccessExpression(entry.node.parent)) {
|
|
153884
|
+
const quote2 = getQuoteFromPreference(quotePreference);
|
|
153885
|
+
return { prefixText: quote2, suffixText: quote2 };
|
|
153886
|
+
}
|
|
153707
153887
|
return emptyOptions;
|
|
153708
153888
|
}
|
|
153709
153889
|
function toImplementationLocation(entry, checker) {
|
|
@@ -157557,10 +157737,10 @@ ${lanes.join("\n")}
|
|
|
157557
157737
|
function registerRefactor(name, refactor) {
|
|
157558
157738
|
refactors.set(name, refactor);
|
|
157559
157739
|
}
|
|
157560
|
-
function getApplicableRefactors(context) {
|
|
157740
|
+
function getApplicableRefactors(context, includeInteractiveActions) {
|
|
157561
157741
|
return arrayFrom(flatMapIterator(refactors.values(), (refactor) => {
|
|
157562
157742
|
var _a;
|
|
157563
|
-
return context.cancellationToken && context.cancellationToken.isCancellationRequested() || !((_a = refactor.kinds) == null ? void 0 : _a.some((kind) => refactorKindBeginsWith(kind, context.kind))) ? void 0 : refactor.getAvailableActions(context);
|
|
157743
|
+
return context.cancellationToken && context.cancellationToken.isCancellationRequested() || !((_a = refactor.kinds) == null ? void 0 : _a.some((kind) => refactorKindBeginsWith(kind, context.kind))) ? void 0 : refactor.getAvailableActions(context, includeInteractiveActions);
|
|
157564
157744
|
}));
|
|
157565
157745
|
}
|
|
157566
157746
|
function getEditsForRefactor(context, refactorName13, actionName2) {
|
|
@@ -170323,34 +170503,49 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
170323
170503
|
updateProjectIfDirty(this);
|
|
170324
170504
|
return hasOneOrMoreJsAndNoTsFiles(this);
|
|
170325
170505
|
}
|
|
170326
|
-
static resolveModule(moduleName, initialDir, host, log
|
|
170327
|
-
|
|
170328
|
-
|
|
170329
|
-
|
|
170330
|
-
|
|
170506
|
+
static resolveModule(moduleName, initialDir, host, log) {
|
|
170507
|
+
return Project3.importServicePluginSync({ name: moduleName }, [initialDir], host, log).resolvedModule;
|
|
170508
|
+
}
|
|
170509
|
+
/** @internal */
|
|
170510
|
+
static importServicePluginSync(pluginConfigEntry, searchPaths, host, log) {
|
|
170511
|
+
Debug.assertIsDefined(host.require);
|
|
170512
|
+
let errorLogs;
|
|
170513
|
+
let resolvedModule;
|
|
170514
|
+
for (const initialDir of searchPaths) {
|
|
170515
|
+
const resolvedPath = normalizeSlashes(host.resolvePath(combinePaths(initialDir, "node_modules")));
|
|
170516
|
+
log(`Loading ${pluginConfigEntry.name} from ${initialDir} (resolved to ${resolvedPath})`);
|
|
170517
|
+
const result = host.require(resolvedPath, pluginConfigEntry.name);
|
|
170518
|
+
if (!result.error) {
|
|
170519
|
+
resolvedModule = result.module;
|
|
170520
|
+
break;
|
|
170521
|
+
}
|
|
170331
170522
|
const err = result.error.stack || result.error.message || JSON.stringify(result.error);
|
|
170332
|
-
(
|
|
170333
|
-
return void 0;
|
|
170523
|
+
(errorLogs ?? (errorLogs = [])).push(`Failed to load module '${pluginConfigEntry.name}' from ${resolvedPath}: ${err}`);
|
|
170334
170524
|
}
|
|
170335
|
-
return
|
|
170525
|
+
return { pluginConfigEntry, resolvedModule, errorLogs };
|
|
170336
170526
|
}
|
|
170337
170527
|
/** @internal */
|
|
170338
|
-
static async importServicePluginAsync(
|
|
170528
|
+
static async importServicePluginAsync(pluginConfigEntry, searchPaths, host, log) {
|
|
170339
170529
|
Debug.assertIsDefined(host.importPlugin);
|
|
170340
|
-
|
|
170341
|
-
|
|
170342
|
-
|
|
170343
|
-
|
|
170344
|
-
|
|
170345
|
-
|
|
170346
|
-
|
|
170347
|
-
|
|
170348
|
-
|
|
170530
|
+
let errorLogs;
|
|
170531
|
+
let resolvedModule;
|
|
170532
|
+
for (const initialDir of searchPaths) {
|
|
170533
|
+
const resolvedPath = combinePaths(initialDir, "node_modules");
|
|
170534
|
+
log(`Dynamically importing ${pluginConfigEntry.name} from ${initialDir} (resolved to ${resolvedPath})`);
|
|
170535
|
+
let result;
|
|
170536
|
+
try {
|
|
170537
|
+
result = await host.importPlugin(resolvedPath, pluginConfigEntry.name);
|
|
170538
|
+
} catch (e) {
|
|
170539
|
+
result = { module: void 0, error: e };
|
|
170540
|
+
}
|
|
170541
|
+
if (!result.error) {
|
|
170542
|
+
resolvedModule = result.module;
|
|
170543
|
+
break;
|
|
170544
|
+
}
|
|
170349
170545
|
const err = result.error.stack || result.error.message || JSON.stringify(result.error);
|
|
170350
|
-
(
|
|
170351
|
-
return void 0;
|
|
170546
|
+
(errorLogs ?? (errorLogs = [])).push(`Failed to dynamically import module '${pluginConfigEntry.name}' from ${resolvedPath}: ${err}`);
|
|
170352
170547
|
}
|
|
170353
|
-
return
|
|
170548
|
+
return { pluginConfigEntry, resolvedModule, errorLogs };
|
|
170354
170549
|
}
|
|
170355
170550
|
isKnownTypesPackageName(name) {
|
|
170356
170551
|
return this.typingsCache.isKnownTypesPackageName(name);
|
|
@@ -170477,6 +170672,10 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
170477
170672
|
reusedNames
|
|
170478
170673
|
);
|
|
170479
170674
|
}
|
|
170675
|
+
/** @internal */
|
|
170676
|
+
resolveLibrary(libraryName, resolveFrom, options, libFileName) {
|
|
170677
|
+
return this.resolutionCache.resolveLibrary(libraryName, resolveFrom, options, libFileName);
|
|
170678
|
+
}
|
|
170480
170679
|
directoryExists(path) {
|
|
170481
170680
|
return this.directoryStructureHost.directoryExists(path);
|
|
170482
170681
|
}
|
|
@@ -171041,7 +171240,9 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
171041
171240
|
Debug.assert(!this.isClosed(), "Called update graph worker of closed project");
|
|
171042
171241
|
this.writeLog(`Starting updateGraphWorker: Project: ${this.getProjectName()}`);
|
|
171043
171242
|
const start = timestamp();
|
|
171044
|
-
|
|
171243
|
+
const { hasInvalidatedResolutions, hasInvalidatedLibResolutions } = this.resolutionCache.createHasInvalidatedResolutions(returnFalse, returnFalse);
|
|
171244
|
+
this.hasInvalidatedResolutions = hasInvalidatedResolutions;
|
|
171245
|
+
this.hasInvalidatedLibResolutions = hasInvalidatedLibResolutions;
|
|
171045
171246
|
this.resolutionCache.startCachingPerDirectoryResolution();
|
|
171046
171247
|
this.program = this.languageService.getProgram();
|
|
171047
171248
|
this.dirty = false;
|
|
@@ -171458,7 +171659,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
171458
171659
|
combinePaths(this.projectService.getExecutingFilePath(), "../../..")
|
|
171459
171660
|
];
|
|
171460
171661
|
}
|
|
171461
|
-
enableGlobalPlugins(options
|
|
171662
|
+
enableGlobalPlugins(options) {
|
|
171462
171663
|
if (!this.projectService.globalPlugins.length)
|
|
171463
171664
|
return;
|
|
171464
171665
|
const host = this.projectService.host;
|
|
@@ -171473,67 +171674,13 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
171473
171674
|
if (options.plugins && options.plugins.some((p) => p.name === globalPluginName))
|
|
171474
171675
|
continue;
|
|
171475
171676
|
this.projectService.logger.info(`Loading global plugin ${globalPluginName}`);
|
|
171476
|
-
this.enablePlugin({ name: globalPluginName, global: true }, searchPaths
|
|
171677
|
+
this.enablePlugin({ name: globalPluginName, global: true }, searchPaths);
|
|
171477
171678
|
}
|
|
171478
171679
|
}
|
|
171479
|
-
|
|
171480
|
-
|
|
171481
|
-
*
|
|
171482
|
-
* @internal
|
|
171483
|
-
*/
|
|
171484
|
-
beginEnablePluginSync(pluginConfigEntry, searchPaths, pluginConfigOverrides) {
|
|
171485
|
-
Debug.assertIsDefined(this.projectService.host.require);
|
|
171486
|
-
let errorLogs;
|
|
171487
|
-
const log = (message) => this.projectService.logger.info(message);
|
|
171488
|
-
const logError = (message) => {
|
|
171489
|
-
(errorLogs ?? (errorLogs = [])).push(message);
|
|
171490
|
-
};
|
|
171491
|
-
const resolvedModule = firstDefined(searchPaths, (searchPath) => Project3.resolveModule(pluginConfigEntry.name, searchPath, this.projectService.host, log, logError));
|
|
171492
|
-
return { pluginConfigEntry, pluginConfigOverrides, resolvedModule, errorLogs };
|
|
171493
|
-
}
|
|
171494
|
-
/**
|
|
171495
|
-
* Performs the initial steps of enabling a plugin by finding and instantiating the module for a plugin asynchronously using dynamic `import`.
|
|
171496
|
-
*
|
|
171497
|
-
* @internal
|
|
171498
|
-
*/
|
|
171499
|
-
async beginEnablePluginAsync(pluginConfigEntry, searchPaths, pluginConfigOverrides) {
|
|
171500
|
-
Debug.assertIsDefined(this.projectService.host.importPlugin);
|
|
171501
|
-
let errorLogs;
|
|
171502
|
-
const log = (message) => this.projectService.logger.info(message);
|
|
171503
|
-
const logError = (message) => {
|
|
171504
|
-
(errorLogs ?? (errorLogs = [])).push(message);
|
|
171505
|
-
};
|
|
171506
|
-
let resolvedModule;
|
|
171507
|
-
for (const searchPath of searchPaths) {
|
|
171508
|
-
resolvedModule = await Project3.importServicePluginAsync(pluginConfigEntry.name, searchPath, this.projectService.host, log, logError);
|
|
171509
|
-
if (resolvedModule !== void 0) {
|
|
171510
|
-
break;
|
|
171511
|
-
}
|
|
171512
|
-
}
|
|
171513
|
-
return { pluginConfigEntry, pluginConfigOverrides, resolvedModule, errorLogs };
|
|
171514
|
-
}
|
|
171515
|
-
/**
|
|
171516
|
-
* Performs the remaining steps of enabling a plugin after its module has been instantiated.
|
|
171517
|
-
*
|
|
171518
|
-
* @internal
|
|
171519
|
-
*/
|
|
171520
|
-
endEnablePlugin({ pluginConfigEntry, pluginConfigOverrides, resolvedModule, errorLogs }) {
|
|
171521
|
-
if (resolvedModule) {
|
|
171522
|
-
const configurationOverride = pluginConfigOverrides && pluginConfigOverrides.get(pluginConfigEntry.name);
|
|
171523
|
-
if (configurationOverride) {
|
|
171524
|
-
const pluginName = pluginConfigEntry.name;
|
|
171525
|
-
pluginConfigEntry = configurationOverride;
|
|
171526
|
-
pluginConfigEntry.name = pluginName;
|
|
171527
|
-
}
|
|
171528
|
-
this.enableProxy(resolvedModule, pluginConfigEntry);
|
|
171529
|
-
} else {
|
|
171530
|
-
forEach(errorLogs, (message) => this.projectService.logger.info(message));
|
|
171531
|
-
this.projectService.logger.info(`Couldn't find ${pluginConfigEntry.name}`);
|
|
171532
|
-
}
|
|
171533
|
-
}
|
|
171534
|
-
enablePlugin(pluginConfigEntry, searchPaths, pluginConfigOverrides) {
|
|
171535
|
-
this.projectService.requestEnablePlugin(this, pluginConfigEntry, searchPaths, pluginConfigOverrides);
|
|
171680
|
+
enablePlugin(pluginConfigEntry, searchPaths) {
|
|
171681
|
+
this.projectService.requestEnablePlugin(this, pluginConfigEntry, searchPaths);
|
|
171536
171682
|
}
|
|
171683
|
+
/** @internal */
|
|
171537
171684
|
enableProxy(pluginModuleFactory, configEntry) {
|
|
171538
171685
|
try {
|
|
171539
171686
|
if (typeof pluginModuleFactory !== "function") {
|
|
@@ -171727,7 +171874,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
171727
171874
|
};
|
|
171728
171875
|
InferredProject2 = class extends Project3 {
|
|
171729
171876
|
/** @internal */
|
|
171730
|
-
constructor(projectService, documentRegistry, compilerOptions, watchOptions, projectRootPath, currentDirectory,
|
|
171877
|
+
constructor(projectService, documentRegistry, compilerOptions, watchOptions, projectRootPath, currentDirectory, typeAcquisition) {
|
|
171731
171878
|
super(
|
|
171732
171879
|
projectService.newInferredProjectName(),
|
|
171733
171880
|
0 /* Inferred */,
|
|
@@ -171751,7 +171898,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
171751
171898
|
if (!projectRootPath && !projectService.useSingleInferredProject) {
|
|
171752
171899
|
this.canonicalCurrentDirectory = projectService.toCanonicalFileName(this.currentDirectory);
|
|
171753
171900
|
}
|
|
171754
|
-
this.enableGlobalPlugins(this.getCompilerOptions()
|
|
171901
|
+
this.enableGlobalPlugins(this.getCompilerOptions());
|
|
171755
171902
|
}
|
|
171756
171903
|
toggleJsInferredProject(isJsInferredProject) {
|
|
171757
171904
|
if (isJsInferredProject !== this._isJsInferredProject) {
|
|
@@ -172217,7 +172364,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
172217
172364
|
return (_a = this.getCurrentProgram()) == null ? void 0 : _a.forEachResolvedProjectReference(cb);
|
|
172218
172365
|
}
|
|
172219
172366
|
/** @internal */
|
|
172220
|
-
enablePluginsWithOptions(options
|
|
172367
|
+
enablePluginsWithOptions(options) {
|
|
172221
172368
|
var _a;
|
|
172222
172369
|
this.plugins.length = 0;
|
|
172223
172370
|
if (!((_a = options.plugins) == null ? void 0 : _a.length) && !this.projectService.globalPlugins.length)
|
|
@@ -172235,10 +172382,10 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
172235
172382
|
}
|
|
172236
172383
|
if (options.plugins) {
|
|
172237
172384
|
for (const pluginConfigEntry of options.plugins) {
|
|
172238
|
-
this.enablePlugin(pluginConfigEntry, searchPaths
|
|
172385
|
+
this.enablePlugin(pluginConfigEntry, searchPaths);
|
|
172239
172386
|
}
|
|
172240
172387
|
}
|
|
172241
|
-
return this.enableGlobalPlugins(options
|
|
172388
|
+
return this.enableGlobalPlugins(options);
|
|
172242
172389
|
}
|
|
172243
172390
|
/**
|
|
172244
172391
|
* Get the errors that dont have any file name associated
|
|
@@ -172331,7 +172478,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
172331
172478
|
};
|
|
172332
172479
|
ExternalProject2 = class extends Project3 {
|
|
172333
172480
|
/** @internal */
|
|
172334
|
-
constructor(externalProjectName, projectService, documentRegistry, compilerOptions, lastFileExceededProgramSize, compileOnSaveEnabled, projectFilePath,
|
|
172481
|
+
constructor(externalProjectName, projectService, documentRegistry, compilerOptions, lastFileExceededProgramSize, compileOnSaveEnabled, projectFilePath, watchOptions) {
|
|
172335
172482
|
super(
|
|
172336
172483
|
externalProjectName,
|
|
172337
172484
|
2 /* External */,
|
|
@@ -172349,7 +172496,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
172349
172496
|
this.externalProjectName = externalProjectName;
|
|
172350
172497
|
this.compileOnSaveEnabled = compileOnSaveEnabled;
|
|
172351
172498
|
this.excludedFiles = [];
|
|
172352
|
-
this.enableGlobalPlugins(this.getCompilerOptions()
|
|
172499
|
+
this.enableGlobalPlugins(this.getCompilerOptions());
|
|
172353
172500
|
}
|
|
172354
172501
|
updateGraph() {
|
|
172355
172502
|
const result = super.updateGraph();
|
|
@@ -173711,7 +173858,6 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
173711
173858
|
options.compileOnSave === void 0 ? true : options.compileOnSave,
|
|
173712
173859
|
/*projectFilePath*/
|
|
173713
173860
|
void 0,
|
|
173714
|
-
this.currentPluginConfigOverrides,
|
|
173715
173861
|
watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.watchOptions
|
|
173716
173862
|
);
|
|
173717
173863
|
project.setProjectErrors(watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.errors);
|
|
@@ -173860,7 +174006,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
173860
174006
|
project.enableLanguageService();
|
|
173861
174007
|
this.watchWildcards(configFilename, configFileExistenceInfo, project);
|
|
173862
174008
|
}
|
|
173863
|
-
project.enablePluginsWithOptions(compilerOptions
|
|
174009
|
+
project.enablePluginsWithOptions(compilerOptions);
|
|
173864
174010
|
const filesToAdd = parsedCommandLine.fileNames.concat(project.getExternalFiles());
|
|
173865
174011
|
this.updateRootAndOptionsOfNonInferredProject(project, filesToAdd, fileNamePropertyReader, compilerOptions, parsedCommandLine.typeAcquisition, parsedCommandLine.compileOnSave, parsedCommandLine.watchOptions);
|
|
173866
174012
|
(_b = tracing) == null ? void 0 : _b.pop();
|
|
@@ -174201,7 +174347,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
174201
174347
|
typeAcquisition = this.typeAcquisitionForInferredProjects;
|
|
174202
174348
|
}
|
|
174203
174349
|
watchOptionsAndErrors = watchOptionsAndErrors || void 0;
|
|
174204
|
-
const project = new InferredProject2(this, this.documentRegistry, compilerOptions, watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.watchOptions, projectRootPath, currentDirectory,
|
|
174350
|
+
const project = new InferredProject2(this, this.documentRegistry, compilerOptions, watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.watchOptions, projectRootPath, currentDirectory, typeAcquisition);
|
|
174205
174351
|
project.setProjectErrors(watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.errors);
|
|
174206
174352
|
if (isSingleInferredProject) {
|
|
174207
174353
|
this.inferredProjects.unshift(project);
|
|
@@ -175428,8 +175574,11 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
175428
175574
|
}
|
|
175429
175575
|
return false;
|
|
175430
175576
|
}
|
|
175431
|
-
/**
|
|
175432
|
-
|
|
175577
|
+
/**
|
|
175578
|
+
* Performs the initial steps of enabling a plugin by finding and instantiating the module for a plugin either asynchronously or synchronously
|
|
175579
|
+
* @internal
|
|
175580
|
+
*/
|
|
175581
|
+
requestEnablePlugin(project, pluginConfigEntry, searchPaths) {
|
|
175433
175582
|
if (!this.host.importPlugin && !this.host.require) {
|
|
175434
175583
|
this.logger.info("Plugins were requested but not running in environment that supports 'require'. Nothing will be loaded");
|
|
175435
175584
|
return;
|
|
@@ -175440,7 +175589,12 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
175440
175589
|
return;
|
|
175441
175590
|
}
|
|
175442
175591
|
if (this.host.importPlugin) {
|
|
175443
|
-
const importPromise =
|
|
175592
|
+
const importPromise = Project3.importServicePluginAsync(
|
|
175593
|
+
pluginConfigEntry,
|
|
175594
|
+
searchPaths,
|
|
175595
|
+
this.host,
|
|
175596
|
+
(s) => this.logger.info(s)
|
|
175597
|
+
);
|
|
175444
175598
|
this.pendingPluginEnablements ?? (this.pendingPluginEnablements = /* @__PURE__ */ new Map());
|
|
175445
175599
|
let promises = this.pendingPluginEnablements.get(project);
|
|
175446
175600
|
if (!promises)
|
|
@@ -175448,7 +175602,31 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
175448
175602
|
promises.push(importPromise);
|
|
175449
175603
|
return;
|
|
175450
175604
|
}
|
|
175451
|
-
|
|
175605
|
+
this.endEnablePlugin(project, Project3.importServicePluginSync(
|
|
175606
|
+
pluginConfigEntry,
|
|
175607
|
+
searchPaths,
|
|
175608
|
+
this.host,
|
|
175609
|
+
(s) => this.logger.info(s)
|
|
175610
|
+
));
|
|
175611
|
+
}
|
|
175612
|
+
/**
|
|
175613
|
+
* Performs the remaining steps of enabling a plugin after its module has been instantiated.
|
|
175614
|
+
* @internal
|
|
175615
|
+
*/
|
|
175616
|
+
endEnablePlugin(project, { pluginConfigEntry, resolvedModule, errorLogs }) {
|
|
175617
|
+
var _a;
|
|
175618
|
+
if (resolvedModule) {
|
|
175619
|
+
const configurationOverride = (_a = this.currentPluginConfigOverrides) == null ? void 0 : _a.get(pluginConfigEntry.name);
|
|
175620
|
+
if (configurationOverride) {
|
|
175621
|
+
const pluginName = pluginConfigEntry.name;
|
|
175622
|
+
pluginConfigEntry = configurationOverride;
|
|
175623
|
+
pluginConfigEntry.name = pluginName;
|
|
175624
|
+
}
|
|
175625
|
+
project.enableProxy(resolvedModule, pluginConfigEntry);
|
|
175626
|
+
} else {
|
|
175627
|
+
forEach(errorLogs, (message) => this.logger.info(message));
|
|
175628
|
+
this.logger.info(`Couldn't find ${pluginConfigEntry.name}`);
|
|
175629
|
+
}
|
|
175452
175630
|
}
|
|
175453
175631
|
/** @internal */
|
|
175454
175632
|
hasNewPluginEnablementRequests() {
|
|
@@ -175502,7 +175680,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
175502
175680
|
return;
|
|
175503
175681
|
}
|
|
175504
175682
|
for (const result of results) {
|
|
175505
|
-
|
|
175683
|
+
this.endEnablePlugin(project, result);
|
|
175506
175684
|
}
|
|
175507
175685
|
this.delayUpdateProjectGraph(project);
|
|
175508
175686
|
}
|
|
@@ -175870,14 +176048,14 @@ ${json}${newLine}`;
|
|
|
175870
176048
|
function createDocumentSpanSet() {
|
|
175871
176049
|
return createSet(({ textSpan }) => textSpan.start + 100003 * textSpan.length, documentSpansEqual);
|
|
175872
176050
|
}
|
|
175873
|
-
function getRenameLocationsWorker(projects, defaultProject, initialLocation, findInStrings, findInComments,
|
|
176051
|
+
function getRenameLocationsWorker(projects, defaultProject, initialLocation, findInStrings, findInComments, preferences) {
|
|
175874
176052
|
const perProjectResults = getPerProjectReferences(
|
|
175875
176053
|
projects,
|
|
175876
176054
|
defaultProject,
|
|
175877
176055
|
initialLocation,
|
|
175878
176056
|
/*isForRename*/
|
|
175879
176057
|
true,
|
|
175880
|
-
(project, position) => project.getLanguageService().findRenameLocations(position.fileName, position.pos, findInStrings, findInComments,
|
|
176058
|
+
(project, position) => project.getLanguageService().findRenameLocations(position.fileName, position.pos, findInStrings, findInComments, preferences),
|
|
175881
176059
|
(renameLocation, cb) => cb(documentSpanLocation(renameLocation))
|
|
175882
176060
|
);
|
|
175883
176061
|
if (isArray(perProjectResults)) {
|
|
@@ -180659,6 +180837,7 @@ ${e.message}`;
|
|
|
180659
180837
|
getImportNeedsImportStarHelper: () => getImportNeedsImportStarHelper,
|
|
180660
180838
|
getIndentSize: () => getIndentSize,
|
|
180661
180839
|
getIndentString: () => getIndentString,
|
|
180840
|
+
getInferredLibraryNameResolveFrom: () => getInferredLibraryNameResolveFrom,
|
|
180662
180841
|
getInitializedVariables: () => getInitializedVariables,
|
|
180663
180842
|
getInitializerOfBinaryExpression: () => getInitializerOfBinaryExpression,
|
|
180664
180843
|
getInitializerOfBindingOrAssignmentElement: () => getInitializerOfBindingOrAssignmentElement,
|
|
@@ -180779,6 +180958,7 @@ ${e.message}`;
|
|
|
180779
180958
|
getOperatorAssociativity: () => getOperatorAssociativity,
|
|
180780
180959
|
getOperatorPrecedence: () => getOperatorPrecedence,
|
|
180781
180960
|
getOptionFromName: () => getOptionFromName,
|
|
180961
|
+
getOptionsForLibraryResolution: () => getOptionsForLibraryResolution,
|
|
180782
180962
|
getOptionsNameMap: () => getOptionsNameMap,
|
|
180783
180963
|
getOrCreateEmitNode: () => getOrCreateEmitNode,
|
|
180784
180964
|
getOrCreateExternalHelpersModuleNameIfNeeded: () => getOrCreateExternalHelpersModuleNameIfNeeded,
|
|
@@ -181890,6 +182070,7 @@ ${e.message}`;
|
|
|
181890
182070
|
resolutionExtensionIsTSOrJson: () => resolutionExtensionIsTSOrJson,
|
|
181891
182071
|
resolveConfigFileProjectName: () => resolveConfigFileProjectName,
|
|
181892
182072
|
resolveJSModule: () => resolveJSModule,
|
|
182073
|
+
resolveLibrary: () => resolveLibrary,
|
|
181893
182074
|
resolveModuleName: () => resolveModuleName,
|
|
181894
182075
|
resolveModuleNameFromCache: () => resolveModuleNameFromCache,
|
|
181895
182076
|
resolvePackageNameToPackageJson: () => resolvePackageNameToPackageJson,
|
|
@@ -183034,6 +183215,7 @@ ${e.message}`;
|
|
|
183034
183215
|
getImportNeedsImportStarHelper: () => getImportNeedsImportStarHelper,
|
|
183035
183216
|
getIndentSize: () => getIndentSize,
|
|
183036
183217
|
getIndentString: () => getIndentString,
|
|
183218
|
+
getInferredLibraryNameResolveFrom: () => getInferredLibraryNameResolveFrom,
|
|
183037
183219
|
getInitializedVariables: () => getInitializedVariables,
|
|
183038
183220
|
getInitializerOfBinaryExpression: () => getInitializerOfBinaryExpression,
|
|
183039
183221
|
getInitializerOfBindingOrAssignmentElement: () => getInitializerOfBindingOrAssignmentElement,
|
|
@@ -183154,6 +183336,7 @@ ${e.message}`;
|
|
|
183154
183336
|
getOperatorAssociativity: () => getOperatorAssociativity,
|
|
183155
183337
|
getOperatorPrecedence: () => getOperatorPrecedence,
|
|
183156
183338
|
getOptionFromName: () => getOptionFromName,
|
|
183339
|
+
getOptionsForLibraryResolution: () => getOptionsForLibraryResolution,
|
|
183157
183340
|
getOptionsNameMap: () => getOptionsNameMap,
|
|
183158
183341
|
getOrCreateEmitNode: () => getOrCreateEmitNode,
|
|
183159
183342
|
getOrCreateExternalHelpersModuleNameIfNeeded: () => getOrCreateExternalHelpersModuleNameIfNeeded,
|
|
@@ -184265,6 +184448,7 @@ ${e.message}`;
|
|
|
184265
184448
|
resolutionExtensionIsTSOrJson: () => resolutionExtensionIsTSOrJson,
|
|
184266
184449
|
resolveConfigFileProjectName: () => resolveConfigFileProjectName,
|
|
184267
184450
|
resolveJSModule: () => resolveJSModule,
|
|
184451
|
+
resolveLibrary: () => resolveLibrary,
|
|
184268
184452
|
resolveModuleName: () => resolveModuleName,
|
|
184269
184453
|
resolveModuleNameFromCache: () => resolveModuleNameFromCache,
|
|
184270
184454
|
resolvePackageNameToPackageJson: () => resolvePackageNameToPackageJson,
|