typescript 5.1.0-dev.20230420 → 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 +341 -161
- package/lib/tsserverlibrary.d.ts +6 -6
- package/lib/tsserverlibrary.js +339 -155
- package/lib/typescript.d.ts +3 -1
- package/lib/typescript.js +240 -57
- package/lib/typingsInstaller.js +3 -1
- package/package.json +5 -3
package/lib/typescript.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) {
|
|
@@ -129110,10 +129276,10 @@ ${lanes.join("\n")}
|
|
|
129110
129276
|
158 /* UniqueKeyword */,
|
|
129111
129277
|
159 /* UnknownKeyword */
|
|
129112
129278
|
];
|
|
129113
|
-
QuotePreference = /* @__PURE__ */ ((
|
|
129114
|
-
|
|
129115
|
-
|
|
129116
|
-
return
|
|
129279
|
+
QuotePreference = /* @__PURE__ */ ((QuotePreference6) => {
|
|
129280
|
+
QuotePreference6[QuotePreference6["Single"] = 0] = "Single";
|
|
129281
|
+
QuotePreference6[QuotePreference6["Double"] = 1] = "Double";
|
|
129282
|
+
return QuotePreference6;
|
|
129117
129283
|
})(QuotePreference || {});
|
|
129118
129284
|
displayPartWriter = getDisplayPartWriter();
|
|
129119
129285
|
lineFeed2 = "\n";
|
|
@@ -133882,6 +134048,7 @@ ${lanes.join("\n")}
|
|
|
133882
134048
|
const rootFileNames = host.getScriptFileNames().slice();
|
|
133883
134049
|
const newSettings = host.getCompilationSettings() || getDefaultCompilerOptions2();
|
|
133884
134050
|
const hasInvalidatedResolutions = host.hasInvalidatedResolutions || returnFalse;
|
|
134051
|
+
const hasInvalidatedLibResolutions = maybeBind(host, host.hasInvalidatedLibResolutions) || returnFalse;
|
|
133885
134052
|
const hasChangedAutomaticTypeDirectiveNames = maybeBind(host, host.hasChangedAutomaticTypeDirectiveNames);
|
|
133886
134053
|
const projectReferences = (_b = host.getProjectReferences) == null ? void 0 : _b.call(host);
|
|
133887
134054
|
let parsedCommandLines;
|
|
@@ -133912,6 +134079,7 @@ ${lanes.join("\n")}
|
|
|
133912
134079
|
onReleaseOldSourceFile,
|
|
133913
134080
|
onReleaseParsedCommandLine,
|
|
133914
134081
|
hasInvalidatedResolutions,
|
|
134082
|
+
hasInvalidatedLibResolutions,
|
|
133915
134083
|
hasChangedAutomaticTypeDirectiveNames,
|
|
133916
134084
|
trace: maybeBind(host, host.trace),
|
|
133917
134085
|
resolveModuleNames: maybeBind(host, host.resolveModuleNames),
|
|
@@ -133920,6 +134088,7 @@ ${lanes.join("\n")}
|
|
|
133920
134088
|
resolveTypeReferenceDirectives: maybeBind(host, host.resolveTypeReferenceDirectives),
|
|
133921
134089
|
resolveModuleNameLiterals: maybeBind(host, host.resolveModuleNameLiterals),
|
|
133922
134090
|
resolveTypeReferenceDirectiveReferences: maybeBind(host, host.resolveTypeReferenceDirectiveReferences),
|
|
134091
|
+
resolveLibrary: maybeBind(host, host.resolveLibrary),
|
|
133923
134092
|
useSourceOfProjectReferenceRedirect: maybeBind(host, host.useSourceOfProjectReferenceRedirect),
|
|
133924
134093
|
getParsedCommandLine
|
|
133925
134094
|
};
|
|
@@ -133941,7 +134110,7 @@ ${lanes.join("\n")}
|
|
|
133941
134110
|
onUnRecoverableConfigFileDiagnostic: noop
|
|
133942
134111
|
};
|
|
133943
134112
|
const documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings);
|
|
133944
|
-
if (isProgramUptoDate(program, rootFileNames, newSettings, (_path, fileName) => host.getScriptVersion(fileName), (fileName) => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
134113
|
+
if (isProgramUptoDate(program, rootFileNames, newSettings, (_path, fileName) => host.getScriptVersion(fileName), (fileName) => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasInvalidatedLibResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
133945
134114
|
return;
|
|
133946
134115
|
}
|
|
133947
134116
|
const options = {
|
|
@@ -134245,7 +134414,7 @@ ${lanes.join("\n")}
|
|
|
134245
134414
|
const sourceFile = getValidSourceFile(fileName);
|
|
134246
134415
|
return DocumentHighlights.getDocumentHighlights(program, cancellationToken, sourceFile, position, sourceFilesToSearch);
|
|
134247
134416
|
}
|
|
134248
|
-
function findRenameLocations(fileName, position, findInStrings, findInComments,
|
|
134417
|
+
function findRenameLocations(fileName, position, findInStrings, findInComments, preferences) {
|
|
134249
134418
|
synchronizeHostData();
|
|
134250
134419
|
const sourceFile = getValidSourceFile(fileName);
|
|
134251
134420
|
const node = getAdjustedRenameLocation(getTouchingPropertyName(sourceFile, position));
|
|
@@ -134262,11 +134431,13 @@ ${lanes.join("\n")}
|
|
|
134262
134431
|
};
|
|
134263
134432
|
});
|
|
134264
134433
|
} else {
|
|
134434
|
+
const quotePreference = getQuotePreference(sourceFile, preferences ?? emptyOptions);
|
|
134435
|
+
const providePrefixAndSuffixTextForRename = typeof preferences === "boolean" ? preferences : preferences == null ? void 0 : preferences.providePrefixAndSuffixTextForRename;
|
|
134265
134436
|
return getReferencesWorker(
|
|
134266
134437
|
node,
|
|
134267
134438
|
position,
|
|
134268
134439
|
{ findInStrings, findInComments, providePrefixAndSuffixTextForRename, use: ts_FindAllReferences_exports.FindReferencesUse.Rename },
|
|
134269
|
-
(entry, originalNode, checker) => ts_FindAllReferences_exports.toRenameLocation(entry, originalNode, checker, providePrefixAndSuffixTextForRename || false)
|
|
134440
|
+
(entry, originalNode, checker) => ts_FindAllReferences_exports.toRenameLocation(entry, originalNode, checker, providePrefixAndSuffixTextForRename || false, quotePreference)
|
|
134270
134441
|
);
|
|
134271
134442
|
}
|
|
134272
134443
|
}
|
|
@@ -134511,6 +134682,7 @@ ${lanes.join("\n")}
|
|
|
134511
134682
|
const token = findPrecedingToken(position, sourceFile);
|
|
134512
134683
|
if (!token || token.parent.kind === 311 /* SourceFile */)
|
|
134513
134684
|
return void 0;
|
|
134685
|
+
const jsxTagWordPattern = "[a-zA-Z0-9:\\-\\._$]*";
|
|
134514
134686
|
if (isJsxFragment(token.parent.parent)) {
|
|
134515
134687
|
const openFragment = token.parent.parent.openingFragment;
|
|
134516
134688
|
const closeFragment = token.parent.parent.closingFragment;
|
|
@@ -134520,7 +134692,10 @@ ${lanes.join("\n")}
|
|
|
134520
134692
|
const closePos = closeFragment.getStart(sourceFile) + 2;
|
|
134521
134693
|
if (position !== openPos && position !== closePos)
|
|
134522
134694
|
return void 0;
|
|
134523
|
-
return {
|
|
134695
|
+
return {
|
|
134696
|
+
ranges: [{ start: openPos, length: 0 }, { start: closePos, length: 0 }],
|
|
134697
|
+
wordPattern: jsxTagWordPattern
|
|
134698
|
+
};
|
|
134524
134699
|
} else {
|
|
134525
134700
|
const tag = findAncestor(
|
|
134526
134701
|
token.parent,
|
|
@@ -134546,7 +134721,8 @@ ${lanes.join("\n")}
|
|
|
134546
134721
|
if (openingTagText !== closeTag.tagName.getText(sourceFile))
|
|
134547
134722
|
return void 0;
|
|
134548
134723
|
return {
|
|
134549
|
-
ranges: [{ start: openTagStart, length: openTagEnd - openTagStart }, { start: closeTagStart, length: closeTagEnd - closeTagStart }]
|
|
134724
|
+
ranges: [{ start: openTagStart, length: openTagEnd - openTagStart }, { start: closeTagStart, length: closeTagEnd - closeTagStart }],
|
|
134725
|
+
wordPattern: jsxTagWordPattern
|
|
134550
134726
|
};
|
|
134551
134727
|
}
|
|
134552
134728
|
}
|
|
@@ -136265,10 +136441,10 @@ ${lanes.join("\n")}
|
|
|
136265
136441
|
() => this.languageService.getSmartSelectionRange(fileName, position)
|
|
136266
136442
|
);
|
|
136267
136443
|
}
|
|
136268
|
-
findRenameLocations(fileName, position, findInStrings, findInComments,
|
|
136444
|
+
findRenameLocations(fileName, position, findInStrings, findInComments, preferences) {
|
|
136269
136445
|
return this.forwardJSONCall(
|
|
136270
|
-
`findRenameLocations('${fileName}', ${position}, ${findInStrings}, ${findInComments}
|
|
136271
|
-
() => this.languageService.findRenameLocations(fileName, position, findInStrings, findInComments,
|
|
136446
|
+
`findRenameLocations('${fileName}', ${position}, ${findInStrings}, ${findInComments})`,
|
|
136447
|
+
() => this.languageService.findRenameLocations(fileName, position, findInStrings, findInComments, preferences)
|
|
136272
136448
|
);
|
|
136273
136449
|
}
|
|
136274
136450
|
/// GET BRACE MATCHING
|
|
@@ -150038,7 +150214,7 @@ ${lanes.join("\n")}
|
|
|
150038
150214
|
) : isEqualityOperatorKind(previousToken.kind) && isBinaryExpression(parent2) && isEqualityOperatorKind(parent2.operatorToken.kind) ? (
|
|
150039
150215
|
// completion at `x ===/**/` should be for the right side
|
|
150040
150216
|
checker.getTypeAtLocation(parent2.left)
|
|
150041
|
-
) : checker.getContextualType(previousToken);
|
|
150217
|
+
) : checker.getContextualType(previousToken, 4 /* Completions */) || checker.getContextualType(previousToken);
|
|
150042
150218
|
}
|
|
150043
150219
|
}
|
|
150044
150220
|
function getFirstSymbolInChain(symbol, enclosingDeclaration, checker) {
|
|
@@ -153650,8 +153826,8 @@ ${lanes.join("\n")}
|
|
|
153650
153826
|
const { displayParts, symbolKind } = ts_SymbolDisplay_exports.getSymbolDisplayPartsDocumentationAndSymbolKind(checker, symbol, enclosingDeclaration.getSourceFile(), enclosingDeclaration, enclosingDeclaration, meaning);
|
|
153651
153827
|
return { displayParts, kind: symbolKind };
|
|
153652
153828
|
}
|
|
153653
|
-
function toRenameLocation(entry, originalNode, checker, providePrefixAndSuffixText) {
|
|
153654
|
-
return { ...entryToDocumentSpan(entry), ...providePrefixAndSuffixText && getPrefixAndSuffixText(entry, originalNode, checker) };
|
|
153829
|
+
function toRenameLocation(entry, originalNode, checker, providePrefixAndSuffixText, quotePreference) {
|
|
153830
|
+
return { ...entryToDocumentSpan(entry), ...providePrefixAndSuffixText && getPrefixAndSuffixText(entry, originalNode, checker, quotePreference) };
|
|
153655
153831
|
}
|
|
153656
153832
|
function toReferencedSymbolEntry(entry, symbol) {
|
|
153657
153833
|
const referenceEntry = toReferenceEntry(entry);
|
|
@@ -153687,7 +153863,7 @@ ${lanes.join("\n")}
|
|
|
153687
153863
|
};
|
|
153688
153864
|
}
|
|
153689
153865
|
}
|
|
153690
|
-
function getPrefixAndSuffixText(entry, originalNode, checker) {
|
|
153866
|
+
function getPrefixAndSuffixText(entry, originalNode, checker, quotePreference) {
|
|
153691
153867
|
if (entry.kind !== 0 /* Span */ && isIdentifier(originalNode)) {
|
|
153692
153868
|
const { node, kind } = entry;
|
|
153693
153869
|
const parent2 = node.parent;
|
|
@@ -153718,6 +153894,10 @@ ${lanes.join("\n")}
|
|
|
153718
153894
|
return originalNode === entry.node || checker.getSymbolAtLocation(originalNode) === checker.getSymbolAtLocation(entry.node) ? { prefixText: name + " as " } : { suffixText: " as " + name };
|
|
153719
153895
|
}
|
|
153720
153896
|
}
|
|
153897
|
+
if (entry.kind !== 0 /* Span */ && isNumericLiteral(entry.node) && isAccessExpression(entry.node.parent)) {
|
|
153898
|
+
const quote2 = getQuoteFromPreference(quotePreference);
|
|
153899
|
+
return { prefixText: quote2, suffixText: quote2 };
|
|
153900
|
+
}
|
|
153721
153901
|
return emptyOptions;
|
|
153722
153902
|
}
|
|
153723
153903
|
function toImplementationLocation(entry, checker) {
|
|
@@ -169329,6 +169509,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
169329
169509
|
getImportNeedsImportStarHelper: () => getImportNeedsImportStarHelper,
|
|
169330
169510
|
getIndentSize: () => getIndentSize,
|
|
169331
169511
|
getIndentString: () => getIndentString,
|
|
169512
|
+
getInferredLibraryNameResolveFrom: () => getInferredLibraryNameResolveFrom,
|
|
169332
169513
|
getInitializedVariables: () => getInitializedVariables,
|
|
169333
169514
|
getInitializerOfBinaryExpression: () => getInitializerOfBinaryExpression,
|
|
169334
169515
|
getInitializerOfBindingOrAssignmentElement: () => getInitializerOfBindingOrAssignmentElement,
|
|
@@ -169449,6 +169630,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
169449
169630
|
getOperatorAssociativity: () => getOperatorAssociativity,
|
|
169450
169631
|
getOperatorPrecedence: () => getOperatorPrecedence,
|
|
169451
169632
|
getOptionFromName: () => getOptionFromName,
|
|
169633
|
+
getOptionsForLibraryResolution: () => getOptionsForLibraryResolution,
|
|
169452
169634
|
getOptionsNameMap: () => getOptionsNameMap,
|
|
169453
169635
|
getOrCreateEmitNode: () => getOrCreateEmitNode,
|
|
169454
169636
|
getOrCreateExternalHelpersModuleNameIfNeeded: () => getOrCreateExternalHelpersModuleNameIfNeeded,
|
|
@@ -170560,6 +170742,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
170560
170742
|
resolutionExtensionIsTSOrJson: () => resolutionExtensionIsTSOrJson,
|
|
170561
170743
|
resolveConfigFileProjectName: () => resolveConfigFileProjectName,
|
|
170562
170744
|
resolveJSModule: () => resolveJSModule,
|
|
170745
|
+
resolveLibrary: () => resolveLibrary,
|
|
170563
170746
|
resolveModuleName: () => resolveModuleName,
|
|
170564
170747
|
resolveModuleNameFromCache: () => resolveModuleNameFromCache,
|
|
170565
170748
|
resolvePackageNameToPackageJson: () => resolvePackageNameToPackageJson,
|