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/tsserver.js
CHANGED
|
@@ -787,6 +787,7 @@ __export(server_exports, {
|
|
|
787
787
|
getImportNeedsImportStarHelper: () => getImportNeedsImportStarHelper,
|
|
788
788
|
getIndentSize: () => getIndentSize,
|
|
789
789
|
getIndentString: () => getIndentString,
|
|
790
|
+
getInferredLibraryNameResolveFrom: () => getInferredLibraryNameResolveFrom,
|
|
790
791
|
getInitializedVariables: () => getInitializedVariables,
|
|
791
792
|
getInitializerOfBinaryExpression: () => getInitializerOfBinaryExpression,
|
|
792
793
|
getInitializerOfBindingOrAssignmentElement: () => getInitializerOfBindingOrAssignmentElement,
|
|
@@ -907,6 +908,7 @@ __export(server_exports, {
|
|
|
907
908
|
getOperatorAssociativity: () => getOperatorAssociativity,
|
|
908
909
|
getOperatorPrecedence: () => getOperatorPrecedence,
|
|
909
910
|
getOptionFromName: () => getOptionFromName,
|
|
911
|
+
getOptionsForLibraryResolution: () => getOptionsForLibraryResolution,
|
|
910
912
|
getOptionsNameMap: () => getOptionsNameMap,
|
|
911
913
|
getOrCreateEmitNode: () => getOrCreateEmitNode,
|
|
912
914
|
getOrCreateExternalHelpersModuleNameIfNeeded: () => getOrCreateExternalHelpersModuleNameIfNeeded,
|
|
@@ -2018,6 +2020,7 @@ __export(server_exports, {
|
|
|
2018
2020
|
resolutionExtensionIsTSOrJson: () => resolutionExtensionIsTSOrJson,
|
|
2019
2021
|
resolveConfigFileProjectName: () => resolveConfigFileProjectName,
|
|
2020
2022
|
resolveJSModule: () => resolveJSModule,
|
|
2023
|
+
resolveLibrary: () => resolveLibrary,
|
|
2021
2024
|
resolveModuleName: () => resolveModuleName,
|
|
2022
2025
|
resolveModuleNameFromCache: () => resolveModuleNameFromCache,
|
|
2023
2026
|
resolvePackageNameToPackageJson: () => resolvePackageNameToPackageJson,
|
|
@@ -2301,7 +2304,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2301
2304
|
|
|
2302
2305
|
// src/compiler/corePublic.ts
|
|
2303
2306
|
var versionMajorMinor = "5.1";
|
|
2304
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2307
|
+
var version = `${versionMajorMinor}.0-dev.20230421`;
|
|
2305
2308
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2306
2309
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2307
2310
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -36748,7 +36751,9 @@ var Parser;
|
|
|
36748
36751
|
const usedBrace = parseOptional(19 /* OpenBraceToken */);
|
|
36749
36752
|
const pos = getNodePos();
|
|
36750
36753
|
const expression = parsePropertyAccessEntityNameExpression();
|
|
36754
|
+
scanner2.setInJSDocType(true);
|
|
36751
36755
|
const typeArguments = tryParseTypeArguments();
|
|
36756
|
+
scanner2.setInJSDocType(false);
|
|
36752
36757
|
const node = factory2.createExpressionWithTypeArguments(expression, typeArguments);
|
|
36753
36758
|
const res = finishNode(node, pos);
|
|
36754
36759
|
if (usedBrace) {
|
|
@@ -41616,13 +41621,12 @@ function createModuleOrTypeReferenceResolutionCache(currentDirectory, getCanonic
|
|
|
41616
41621
|
nonRelativeNameResolutionCache.update(options2);
|
|
41617
41622
|
}
|
|
41618
41623
|
}
|
|
41619
|
-
function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options) {
|
|
41624
|
+
function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache) {
|
|
41620
41625
|
const result = createModuleOrTypeReferenceResolutionCache(
|
|
41621
41626
|
currentDirectory,
|
|
41622
41627
|
getCanonicalFileName,
|
|
41623
41628
|
options,
|
|
41624
|
-
|
|
41625
|
-
void 0,
|
|
41629
|
+
packageJsonInfoCache,
|
|
41626
41630
|
getOriginalOrResolvedModuleFileName
|
|
41627
41631
|
);
|
|
41628
41632
|
result.getOrCreateCacheForModuleName = (nonRelativeName, mode, redirectedReference) => result.getOrCreateCacheForNonRelativeName(nonRelativeName, mode, redirectedReference);
|
|
@@ -41637,6 +41641,12 @@ function createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanoni
|
|
|
41637
41641
|
getOriginalOrResolvedTypeReferenceFileName
|
|
41638
41642
|
);
|
|
41639
41643
|
}
|
|
41644
|
+
function getOptionsForLibraryResolution(options) {
|
|
41645
|
+
return { moduleResolution: 2 /* Node10 */, traceResolution: options.traceResolution };
|
|
41646
|
+
}
|
|
41647
|
+
function resolveLibrary(libraryName, resolveFrom, compilerOptions, host, cache) {
|
|
41648
|
+
return resolveModuleName(libraryName, resolveFrom, getOptionsForLibraryResolution(compilerOptions), host, cache);
|
|
41649
|
+
}
|
|
41640
41650
|
function resolveModuleNameFromCache(moduleName, containingFile, cache, mode) {
|
|
41641
41651
|
const containingDirectory = getDirectoryPath(containingFile);
|
|
41642
41652
|
return cache.getFromDirectoryCache(
|
|
@@ -58963,7 +58973,8 @@ function createTypeChecker(host) {
|
|
|
58963
58973
|
thisParameter = createSymbolWithType(createSymbol(1 /* FunctionScopedVariable */, "this" /* This */), getTypeFromTypeNode(thisTag.typeExpression));
|
|
58964
58974
|
}
|
|
58965
58975
|
}
|
|
58966
|
-
const
|
|
58976
|
+
const hostDeclaration = isJSDocSignature(declaration) ? getEffectiveJSDocHost(declaration) : declaration;
|
|
58977
|
+
const classType = hostDeclaration && isConstructorDeclaration(hostDeclaration) ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(hostDeclaration.parent.symbol)) : void 0;
|
|
58967
58978
|
const typeParameters = classType ? classType.localTypeParameters : getTypeParametersFromDeclaration(declaration);
|
|
58968
58979
|
if (hasRestParameter(declaration) || isInJSFile(declaration) && maybeAddJsSyntheticRestParameter(declaration, parameters)) {
|
|
58969
58980
|
flags |= 1 /* HasRestParameter */;
|
|
@@ -118013,6 +118024,25 @@ function forEachProjectReference(projectReferences, resolvedProjectReferences, c
|
|
|
118013
118024
|
}
|
|
118014
118025
|
}
|
|
118015
118026
|
var inferredTypesContainingFile = "__inferred type names__.ts";
|
|
118027
|
+
function getInferredLibraryNameResolveFrom(options, currentDirectory, libFileName) {
|
|
118028
|
+
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : currentDirectory;
|
|
118029
|
+
return combinePaths(containingDirectory, `__lib_node_modules_lookup_${libFileName}__.ts`);
|
|
118030
|
+
}
|
|
118031
|
+
function getLibraryNameFromLibFileName(libFileName) {
|
|
118032
|
+
const components = libFileName.split(".");
|
|
118033
|
+
let path = components[1];
|
|
118034
|
+
let i = 2;
|
|
118035
|
+
while (components[i] && components[i] !== "d") {
|
|
118036
|
+
path += (i === 2 ? "/" : "-") + components[i];
|
|
118037
|
+
i++;
|
|
118038
|
+
}
|
|
118039
|
+
return "@typescript/lib-" + path;
|
|
118040
|
+
}
|
|
118041
|
+
function getLibFileNameFromLibReference(libReference) {
|
|
118042
|
+
const libName = toFileNameLowerCase(libReference.fileName);
|
|
118043
|
+
const libFileName = libMap.get(libName);
|
|
118044
|
+
return { libName, libFileName };
|
|
118045
|
+
}
|
|
118016
118046
|
function isReferencedFile(reason) {
|
|
118017
118047
|
switch (reason == null ? void 0 : reason.kind) {
|
|
118018
118048
|
case 3 /* Import */:
|
|
@@ -118056,7 +118086,7 @@ function getReferencedFileLocation(getSourceFileByPath, ref) {
|
|
|
118056
118086
|
}
|
|
118057
118087
|
return { file, pos, end, packageId };
|
|
118058
118088
|
}
|
|
118059
|
-
function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) {
|
|
118089
|
+
function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolutions, hasInvalidatedLibResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) {
|
|
118060
118090
|
if (!program || (hasChangedAutomaticTypeDirectiveNames == null ? void 0 : hasChangedAutomaticTypeDirectiveNames()))
|
|
118061
118091
|
return false;
|
|
118062
118092
|
if (!arrayIsEqualTo(program.getRootFileNames(), rootFileNames))
|
|
@@ -118071,6 +118101,8 @@ function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion,
|
|
|
118071
118101
|
const currentOptions = program.getCompilerOptions();
|
|
118072
118102
|
if (!compareDataObjects(currentOptions, newOptions))
|
|
118073
118103
|
return false;
|
|
118104
|
+
if (program.resolvedLibReferences && forEachEntry(program.resolvedLibReferences, (_value, libFileName) => hasInvalidatedLibResolutions(libFileName)))
|
|
118105
|
+
return false;
|
|
118074
118106
|
if (currentOptions.configFile && newOptions.configFile)
|
|
118075
118107
|
return currentOptions.configFile.text === newOptions.configFile.text;
|
|
118076
118108
|
return true;
|
|
@@ -118257,6 +118289,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118257
118289
|
let fileProcessingDiagnostics;
|
|
118258
118290
|
let automaticTypeDirectiveNames;
|
|
118259
118291
|
let automaticTypeDirectiveResolutions;
|
|
118292
|
+
let resolvedLibReferences;
|
|
118293
|
+
let resolvedLibProcessing;
|
|
118260
118294
|
const maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0;
|
|
118261
118295
|
let currentNodeModulesDepth = 0;
|
|
118262
118296
|
const modulesWithElidedImports = /* @__PURE__ */ new Map();
|
|
@@ -118344,6 +118378,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118344
118378
|
createTypeReferenceResolutionLoader
|
|
118345
118379
|
);
|
|
118346
118380
|
}
|
|
118381
|
+
const hasInvalidatedLibResolutions = host.hasInvalidatedLibResolutions || returnFalse;
|
|
118382
|
+
let actualResolveLibrary;
|
|
118383
|
+
if (host.resolveLibrary) {
|
|
118384
|
+
actualResolveLibrary = host.resolveLibrary.bind(host);
|
|
118385
|
+
} else {
|
|
118386
|
+
const libraryResolutionCache = createModuleResolutionCache(currentDirectory, getCanonicalFileName, options, moduleResolutionCache == null ? void 0 : moduleResolutionCache.getPackageJsonInfoCache());
|
|
118387
|
+
actualResolveLibrary = (libraryName, resolveFrom, options2) => resolveLibrary(libraryName, resolveFrom, options2, host, libraryResolutionCache);
|
|
118388
|
+
}
|
|
118347
118389
|
const packageIdToSourceFile = /* @__PURE__ */ new Map();
|
|
118348
118390
|
let sourceFileToPackageName = /* @__PURE__ */ new Map();
|
|
118349
118391
|
let redirectTargetsMap = createMultiMap();
|
|
@@ -118510,6 +118552,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118510
118552
|
);
|
|
118511
118553
|
}
|
|
118512
118554
|
oldProgram = void 0;
|
|
118555
|
+
resolvedLibProcessing = void 0;
|
|
118513
118556
|
const program = {
|
|
118514
118557
|
getRootFileNames: () => rootNames,
|
|
118515
118558
|
getSourceFile,
|
|
@@ -118551,6 +118594,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118551
118594
|
sourceFileToPackageName,
|
|
118552
118595
|
redirectTargetsMap,
|
|
118553
118596
|
usesUriStyleNodeCoreModules,
|
|
118597
|
+
resolvedLibReferences,
|
|
118554
118598
|
isEmittedFile,
|
|
118555
118599
|
getConfigFileParsingDiagnostics: getConfigFileParsingDiagnostics2,
|
|
118556
118600
|
getProjectReferences,
|
|
@@ -119039,6 +119083,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119039
119083
|
if (changesAffectingProgramStructure(oldOptions, options)) {
|
|
119040
119084
|
return 1 /* SafeModules */;
|
|
119041
119085
|
}
|
|
119086
|
+
if (oldProgram.resolvedLibReferences && forEachEntry(oldProgram.resolvedLibReferences, (resolution, libFileName) => pathForLibFileWorker(libFileName).actual !== resolution.actual)) {
|
|
119087
|
+
return 1 /* SafeModules */;
|
|
119088
|
+
}
|
|
119042
119089
|
if (host.hasChangedAutomaticTypeDirectiveNames) {
|
|
119043
119090
|
if (host.hasChangedAutomaticTypeDirectiveNames())
|
|
119044
119091
|
return 1 /* SafeModules */;
|
|
@@ -119075,6 +119122,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119075
119122
|
sourceFileToPackageName = oldProgram.sourceFileToPackageName;
|
|
119076
119123
|
redirectTargetsMap = oldProgram.redirectTargetsMap;
|
|
119077
119124
|
usesUriStyleNodeCoreModules = oldProgram.usesUriStyleNodeCoreModules;
|
|
119125
|
+
resolvedLibReferences = oldProgram.resolvedLibReferences;
|
|
119078
119126
|
return 2 /* Completely */;
|
|
119079
119127
|
}
|
|
119080
119128
|
function getEmitHost(writeFileCallback) {
|
|
@@ -119184,7 +119232,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119184
119232
|
if (!options.lib) {
|
|
119185
119233
|
return equalityComparer(file.fileName, getDefaultLibraryFileName());
|
|
119186
119234
|
} else {
|
|
119187
|
-
return some(options.lib, (libFileName) => equalityComparer(file.fileName,
|
|
119235
|
+
return some(options.lib, (libFileName) => equalityComparer(file.fileName, resolvedLibReferences.get(libFileName).actual));
|
|
119188
119236
|
}
|
|
119189
119237
|
}
|
|
119190
119238
|
function getTypeChecker() {
|
|
@@ -119775,11 +119823,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119775
119823
|
}
|
|
119776
119824
|
}
|
|
119777
119825
|
function getLibFileFromReference(ref) {
|
|
119778
|
-
|
|
119779
|
-
const libFileName =
|
|
119780
|
-
|
|
119781
|
-
|
|
119782
|
-
}
|
|
119826
|
+
var _a2;
|
|
119827
|
+
const { libFileName } = getLibFileNameFromLibReference(ref);
|
|
119828
|
+
const actualFileName = libFileName && ((_a2 = resolvedLibReferences == null ? void 0 : resolvedLibReferences.get(libFileName)) == null ? void 0 : _a2.actual);
|
|
119829
|
+
return actualFileName !== void 0 ? getSourceFile(actualFileName) : void 0;
|
|
119783
119830
|
}
|
|
119784
119831
|
function getSourceFileFromReference(referencingFile, ref) {
|
|
119785
119832
|
return getSourceFileFromReferenceWorker(resolveTripleslashReference(ref.fileName, referencingFile.fileName), getSourceFile);
|
|
@@ -120204,25 +120251,55 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120204
120251
|
}
|
|
120205
120252
|
}
|
|
120206
120253
|
function pathForLibFile(libFileName) {
|
|
120207
|
-
const
|
|
120208
|
-
|
|
120209
|
-
|
|
120210
|
-
|
|
120211
|
-
|
|
120212
|
-
|
|
120213
|
-
|
|
120214
|
-
|
|
120215
|
-
|
|
120216
|
-
const
|
|
120217
|
-
if (
|
|
120218
|
-
return
|
|
120254
|
+
const existing = resolvedLibReferences == null ? void 0 : resolvedLibReferences.get(libFileName);
|
|
120255
|
+
if (existing)
|
|
120256
|
+
return existing.actual;
|
|
120257
|
+
const result = pathForLibFileWorker(libFileName);
|
|
120258
|
+
(resolvedLibReferences ?? (resolvedLibReferences = /* @__PURE__ */ new Map())).set(libFileName, result);
|
|
120259
|
+
return result.actual;
|
|
120260
|
+
}
|
|
120261
|
+
function pathForLibFileWorker(libFileName) {
|
|
120262
|
+
var _a2, _b2, _c2, _d2, _e2;
|
|
120263
|
+
const existing = resolvedLibProcessing == null ? void 0 : resolvedLibProcessing.get(libFileName);
|
|
120264
|
+
if (existing)
|
|
120265
|
+
return existing;
|
|
120266
|
+
if (structureIsReused !== 0 /* Not */ && oldProgram && !hasInvalidatedLibResolutions(libFileName)) {
|
|
120267
|
+
const oldResolution = (_a2 = oldProgram.resolvedLibReferences) == null ? void 0 : _a2.get(libFileName);
|
|
120268
|
+
if (oldResolution) {
|
|
120269
|
+
if (oldResolution.resolution && isTraceEnabled(options, host)) {
|
|
120270
|
+
const libraryName2 = getLibraryNameFromLibFileName(libFileName);
|
|
120271
|
+
const resolveFrom2 = getInferredLibraryNameResolveFrom(options, currentDirectory, libFileName);
|
|
120272
|
+
trace(
|
|
120273
|
+
host,
|
|
120274
|
+
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,
|
|
120275
|
+
libraryName2,
|
|
120276
|
+
getNormalizedAbsolutePath(resolveFrom2, currentDirectory),
|
|
120277
|
+
(_b2 = oldResolution.resolution.resolvedModule) == null ? void 0 : _b2.resolvedFileName,
|
|
120278
|
+
((_c2 = oldResolution.resolution.resolvedModule) == null ? void 0 : _c2.packageId) && packageIdToString(oldResolution.resolution.resolvedModule.packageId)
|
|
120279
|
+
);
|
|
120280
|
+
}
|
|
120281
|
+
(resolvedLibProcessing ?? (resolvedLibProcessing = /* @__PURE__ */ new Map())).set(libFileName, oldResolution);
|
|
120282
|
+
return oldResolution;
|
|
120283
|
+
}
|
|
120219
120284
|
}
|
|
120220
|
-
|
|
120285
|
+
const libraryName = getLibraryNameFromLibFileName(libFileName);
|
|
120286
|
+
const resolveFrom = getInferredLibraryNameResolveFrom(options, currentDirectory, libFileName);
|
|
120287
|
+
(_d2 = tracing) == null ? void 0 : _d2.push(tracing.Phase.Program, "resolveLibrary", { resolveFrom });
|
|
120288
|
+
mark("beforeResolveLibrary");
|
|
120289
|
+
const resolution = actualResolveLibrary(libraryName, resolveFrom, options, libFileName);
|
|
120290
|
+
mark("afterResolveLibrary");
|
|
120291
|
+
measure("ResolveLibrary", "beforeResolveLibrary", "afterResolveLibrary");
|
|
120292
|
+
(_e2 = tracing) == null ? void 0 : _e2.pop();
|
|
120293
|
+
const result = {
|
|
120294
|
+
resolution,
|
|
120295
|
+
actual: resolution.resolvedModule ? resolution.resolvedModule.resolvedFileName : combinePaths(defaultLibraryPath, libFileName)
|
|
120296
|
+
};
|
|
120297
|
+
(resolvedLibProcessing ?? (resolvedLibProcessing = /* @__PURE__ */ new Map())).set(libFileName, result);
|
|
120298
|
+
return result;
|
|
120221
120299
|
}
|
|
120222
120300
|
function processLibReferenceDirectives(file) {
|
|
120223
120301
|
forEach(file.libReferenceDirectives, (libReference, index) => {
|
|
120224
|
-
const libName =
|
|
120225
|
-
const libFileName = libMap.get(libName);
|
|
120302
|
+
const { libName, libFileName } = getLibFileNameFromLibReference(libReference);
|
|
120226
120303
|
if (libFileName) {
|
|
120227
120304
|
processRootFile(
|
|
120228
120305
|
pathForLibFile(libFileName),
|
|
@@ -123224,7 +123301,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123224
123301
|
let failedLookupChecks;
|
|
123225
123302
|
let startsWithPathChecks;
|
|
123226
123303
|
let isInDirectoryChecks;
|
|
123227
|
-
let
|
|
123304
|
+
let allModuleAndTypeResolutionsAreInvalidated = false;
|
|
123228
123305
|
const getCurrentDirectory = memoize(() => resolutionHost.getCurrentDirectory());
|
|
123229
123306
|
const cachedDirectoryStructureHost = resolutionHost.getCachedDirectoryStructureHost();
|
|
123230
123307
|
const resolvedModuleNames = /* @__PURE__ */ new Map();
|
|
@@ -123240,6 +123317,13 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123240
123317
|
resolutionHost.getCompilationSettings(),
|
|
123241
123318
|
moduleResolutionCache.getPackageJsonInfoCache()
|
|
123242
123319
|
);
|
|
123320
|
+
const resolvedLibraries = /* @__PURE__ */ new Map();
|
|
123321
|
+
const libraryResolutionCache = createModuleResolutionCache(
|
|
123322
|
+
getCurrentDirectory(),
|
|
123323
|
+
resolutionHost.getCanonicalFileName,
|
|
123324
|
+
getOptionsForLibraryResolution(resolutionHost.getCompilationSettings()),
|
|
123325
|
+
moduleResolutionCache.getPackageJsonInfoCache()
|
|
123326
|
+
);
|
|
123243
123327
|
const directoryWatchesOfFailedLookups = /* @__PURE__ */ new Map();
|
|
123244
123328
|
const fileWatchesOfAffectingLocations = /* @__PURE__ */ new Map();
|
|
123245
123329
|
const rootDir = getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirectory);
|
|
@@ -123256,6 +123340,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123256
123340
|
finishCachingPerDirectoryResolution,
|
|
123257
123341
|
resolveModuleNameLiterals,
|
|
123258
123342
|
resolveTypeReferenceDirectiveReferences,
|
|
123343
|
+
resolveLibrary: resolveLibrary2,
|
|
123259
123344
|
resolveSingleModuleNameWithoutWatching,
|
|
123260
123345
|
removeResolutionsFromProjectReferenceRedirects,
|
|
123261
123346
|
removeResolutionsOfFile,
|
|
@@ -123291,16 +123376,18 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123291
123376
|
isInDirectoryChecks = void 0;
|
|
123292
123377
|
affectingPathChecks = void 0;
|
|
123293
123378
|
affectingPathChecksForFile = void 0;
|
|
123294
|
-
|
|
123379
|
+
allModuleAndTypeResolutionsAreInvalidated = false;
|
|
123295
123380
|
moduleResolutionCache.clear();
|
|
123296
123381
|
typeReferenceDirectiveResolutionCache.clear();
|
|
123297
123382
|
moduleResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
123298
123383
|
typeReferenceDirectiveResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
123384
|
+
libraryResolutionCache.clear();
|
|
123299
123385
|
impliedFormatPackageJsons.clear();
|
|
123386
|
+
resolvedLibraries.clear();
|
|
123300
123387
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
123301
123388
|
}
|
|
123302
123389
|
function onChangesAffectModuleResolution() {
|
|
123303
|
-
|
|
123390
|
+
allModuleAndTypeResolutionsAreInvalidated = true;
|
|
123304
123391
|
moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
123305
123392
|
typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
123306
123393
|
moduleResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
@@ -123321,24 +123408,45 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123321
123408
|
const value = filesWithInvalidatedNonRelativeUnresolvedImports.get(path);
|
|
123322
123409
|
return !!value && !!value.length;
|
|
123323
123410
|
}
|
|
123324
|
-
function createHasInvalidatedResolutions(customHasInvalidatedResolutions) {
|
|
123411
|
+
function createHasInvalidatedResolutions(customHasInvalidatedResolutions, customHasInvalidatedLibResolutions) {
|
|
123325
123412
|
invalidateResolutionsOfFailedLookupLocations();
|
|
123326
123413
|
const collected = filesWithInvalidatedResolutions;
|
|
123327
123414
|
filesWithInvalidatedResolutions = void 0;
|
|
123328
|
-
return
|
|
123415
|
+
return {
|
|
123416
|
+
hasInvalidatedResolutions: (path) => customHasInvalidatedResolutions(path) || allModuleAndTypeResolutionsAreInvalidated || !!(collected == null ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path),
|
|
123417
|
+
hasInvalidatedLibResolutions: (libFileName) => {
|
|
123418
|
+
var _a;
|
|
123419
|
+
return customHasInvalidatedLibResolutions(libFileName) || !!((_a = resolvedLibraries == null ? void 0 : resolvedLibraries.get(libFileName)) == null ? void 0 : _a.isInvalidated);
|
|
123420
|
+
}
|
|
123421
|
+
};
|
|
123329
123422
|
}
|
|
123330
123423
|
function startCachingPerDirectoryResolution() {
|
|
123331
123424
|
moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
123332
123425
|
typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
123426
|
+
libraryResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
123333
123427
|
nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
|
|
123334
123428
|
nonRelativeExternalModuleResolutions.clear();
|
|
123335
123429
|
}
|
|
123430
|
+
function cleanupLibResolutionWatching(newProgram) {
|
|
123431
|
+
resolvedLibraries.forEach((resolution, libFileName) => {
|
|
123432
|
+
var _a;
|
|
123433
|
+
if (!((_a = newProgram == null ? void 0 : newProgram.resolvedLibReferences) == null ? void 0 : _a.has(libFileName))) {
|
|
123434
|
+
stopWatchFailedLookupLocationOfResolution(
|
|
123435
|
+
resolution,
|
|
123436
|
+
resolutionHost.toPath(getInferredLibraryNameResolveFrom(newProgram.getCompilerOptions(), getCurrentDirectory(), libFileName)),
|
|
123437
|
+
getResolvedModule2
|
|
123438
|
+
);
|
|
123439
|
+
resolvedLibraries.delete(libFileName);
|
|
123440
|
+
}
|
|
123441
|
+
});
|
|
123442
|
+
}
|
|
123336
123443
|
function finishCachingPerDirectoryResolution(newProgram, oldProgram) {
|
|
123337
123444
|
filesWithInvalidatedNonRelativeUnresolvedImports = void 0;
|
|
123338
|
-
|
|
123445
|
+
allModuleAndTypeResolutionsAreInvalidated = false;
|
|
123339
123446
|
nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
|
|
123340
123447
|
nonRelativeExternalModuleResolutions.clear();
|
|
123341
123448
|
if (newProgram !== oldProgram) {
|
|
123449
|
+
cleanupLibResolutionWatching(newProgram);
|
|
123342
123450
|
newProgram == null ? void 0 : newProgram.getSourceFiles().forEach((newFile) => {
|
|
123343
123451
|
var _a;
|
|
123344
123452
|
const expected = isExternalOrCommonJsModule(newFile) ? ((_a = newFile.packageJsonLocations) == null ? void 0 : _a.length) ?? 0 : 0;
|
|
@@ -123447,7 +123555,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123447
123555
|
const name = loader.nameAndMode.getName(entry);
|
|
123448
123556
|
const mode = loader.nameAndMode.getMode(entry, containingSourceFile);
|
|
123449
123557
|
let resolution = resolutionsInFile.get(name, mode);
|
|
123450
|
-
if (!seenNamesInFile.has(name, mode) && (
|
|
123558
|
+
if (!seenNamesInFile.has(name, mode) && (allModuleAndTypeResolutionsAreInvalidated || unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate
|
|
123451
123559
|
hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution))) {
|
|
123452
123560
|
const existingResolution = resolution;
|
|
123453
123561
|
resolution = loader.resolve(name, mode);
|
|
@@ -123556,6 +123664,41 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123556
123664
|
// Defer non relative resolution watch because we could be using ambient modules
|
|
123557
123665
|
});
|
|
123558
123666
|
}
|
|
123667
|
+
function resolveLibrary2(libraryName, resolveFrom, options, libFileName) {
|
|
123668
|
+
var _a;
|
|
123669
|
+
const host = ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost;
|
|
123670
|
+
let resolution = resolvedLibraries == null ? void 0 : resolvedLibraries.get(libFileName);
|
|
123671
|
+
if (!resolution || resolution.isInvalidated) {
|
|
123672
|
+
const existingResolution = resolution;
|
|
123673
|
+
resolution = resolveLibrary(libraryName, resolveFrom, options, host, libraryResolutionCache);
|
|
123674
|
+
const path = resolutionHost.toPath(resolveFrom);
|
|
123675
|
+
watchFailedLookupLocationsOfExternalModuleResolutions(
|
|
123676
|
+
libraryName,
|
|
123677
|
+
resolution,
|
|
123678
|
+
path,
|
|
123679
|
+
getResolvedModule2,
|
|
123680
|
+
/*deferWatchingNonRelativeResolution*/
|
|
123681
|
+
false
|
|
123682
|
+
);
|
|
123683
|
+
resolvedLibraries.set(libFileName, resolution);
|
|
123684
|
+
if (existingResolution) {
|
|
123685
|
+
stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolvedModule2);
|
|
123686
|
+
}
|
|
123687
|
+
} else {
|
|
123688
|
+
if (isTraceEnabled(options, host)) {
|
|
123689
|
+
const resolved = getResolvedModule2(resolution);
|
|
123690
|
+
trace(
|
|
123691
|
+
host,
|
|
123692
|
+
(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,
|
|
123693
|
+
libraryName,
|
|
123694
|
+
resolveFrom,
|
|
123695
|
+
resolved == null ? void 0 : resolved.resolvedFileName,
|
|
123696
|
+
(resolved == null ? void 0 : resolved.packageId) && packageIdToString(resolved.packageId)
|
|
123697
|
+
);
|
|
123698
|
+
}
|
|
123699
|
+
}
|
|
123700
|
+
return resolution;
|
|
123701
|
+
}
|
|
123559
123702
|
function resolveSingleModuleNameWithoutWatching(moduleName, containingFile) {
|
|
123560
123703
|
const path = resolutionHost.toPath(containingFile);
|
|
123561
123704
|
const resolutionsInFile = resolvedModuleNames.get(path);
|
|
@@ -123878,9 +124021,12 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
123878
124021
|
}
|
|
123879
124022
|
function invalidateResolutionsOfFailedLookupLocations() {
|
|
123880
124023
|
var _a;
|
|
123881
|
-
if (
|
|
124024
|
+
if (allModuleAndTypeResolutionsAreInvalidated) {
|
|
123882
124025
|
affectingPathChecksForFile = void 0;
|
|
123883
124026
|
invalidatePackageJsonMap();
|
|
124027
|
+
if (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks || affectingPathChecks) {
|
|
124028
|
+
invalidateResolutions(resolvedLibraries, canInvalidateFailedLookupResolution);
|
|
124029
|
+
}
|
|
123884
124030
|
failedLookupChecks = void 0;
|
|
123885
124031
|
startsWithPathChecks = void 0;
|
|
123886
124032
|
isInDirectoryChecks = void 0;
|
|
@@ -124782,9 +124928,11 @@ function createWatchProgram(host) {
|
|
|
124782
124928
|
if (!compilerHost.resolveTypeReferenceDirectiveReferences && !compilerHost.resolveTypeReferenceDirectives) {
|
|
124783
124929
|
compilerHost.resolveTypeReferenceDirectiveReferences = resolutionCache.resolveTypeReferenceDirectiveReferences.bind(resolutionCache);
|
|
124784
124930
|
}
|
|
124931
|
+
compilerHost.resolveLibrary = !host.resolveLibrary ? resolutionCache.resolveLibrary.bind(resolutionCache) : host.resolveLibrary.bind(host);
|
|
124785
124932
|
compilerHost.getModuleResolutionCache = host.resolveModuleNameLiterals || host.resolveModuleNames ? maybeBind(host, host.getModuleResolutionCache) : () => resolutionCache.getModuleResolutionCache();
|
|
124786
124933
|
const userProvidedResolution = !!host.resolveModuleNameLiterals || !!host.resolveTypeReferenceDirectiveReferences || !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives;
|
|
124787
124934
|
const customHasInvalidatedResolutions = userProvidedResolution ? maybeBind(host, host.hasInvalidatedResolutions) || returnTrue : returnFalse;
|
|
124935
|
+
const customHasInvalidLibResolutions = host.resolveLibrary ? maybeBind(host, host.hasInvalidatedLibResolutions) || returnTrue : returnFalse;
|
|
124788
124936
|
builderProgram = readBuilderProgram(compilerOptions, compilerHost);
|
|
124789
124937
|
synchronizeProgram();
|
|
124790
124938
|
watchConfigFileWildCardDirectories();
|
|
@@ -124849,7 +124997,7 @@ function createWatchProgram(host) {
|
|
|
124849
124997
|
resolutionCache.onChangesAffectModuleResolution();
|
|
124850
124998
|
}
|
|
124851
124999
|
}
|
|
124852
|
-
const hasInvalidatedResolutions = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions);
|
|
125000
|
+
const { hasInvalidatedResolutions, hasInvalidatedLibResolutions } = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions, customHasInvalidLibResolutions);
|
|
124853
125001
|
const {
|
|
124854
125002
|
originalReadFile,
|
|
124855
125003
|
originalFileExists,
|
|
@@ -124858,7 +125006,7 @@ function createWatchProgram(host) {
|
|
|
124858
125006
|
originalWriteFile,
|
|
124859
125007
|
readFileWithCache
|
|
124860
125008
|
} = changeCompilerHostLikeToUseCache(compilerHost, toPath3);
|
|
124861
|
-
if (isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, (path) => getSourceVersion(path, readFileWithCache), (fileName) => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
125009
|
+
if (isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, (path) => getSourceVersion(path, readFileWithCache), (fileName) => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasInvalidatedLibResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
124862
125010
|
if (hasChangedConfigFileParsingErrors) {
|
|
124863
125011
|
if (reportFileChangeDetectedOnCreateProgram) {
|
|
124864
125012
|
reportWatchDiagnostic(Diagnostics.File_change_detected_Starting_incremental_compilation);
|
|
@@ -124879,7 +125027,7 @@ function createWatchProgram(host) {
|
|
|
124879
125027
|
if (reportFileChangeDetectedOnCreateProgram) {
|
|
124880
125028
|
reportWatchDiagnostic(Diagnostics.File_change_detected_Starting_incremental_compilation);
|
|
124881
125029
|
}
|
|
124882
|
-
createNewProgram(hasInvalidatedResolutions);
|
|
125030
|
+
createNewProgram(hasInvalidatedResolutions, hasInvalidatedLibResolutions);
|
|
124883
125031
|
}
|
|
124884
125032
|
reportFileChangeDetectedOnCreateProgram = false;
|
|
124885
125033
|
if (host.afterProgramCreate && program !== builderProgram) {
|
|
@@ -124892,7 +125040,7 @@ function createWatchProgram(host) {
|
|
|
124892
125040
|
compilerHost.writeFile = originalWriteFile;
|
|
124893
125041
|
return builderProgram;
|
|
124894
125042
|
}
|
|
124895
|
-
function createNewProgram(hasInvalidatedResolutions) {
|
|
125043
|
+
function createNewProgram(hasInvalidatedResolutions, hasInvalidatedLibResolutions) {
|
|
124896
125044
|
writeLog("CreatingProgramWith::");
|
|
124897
125045
|
writeLog(` roots: ${JSON.stringify(rootFileNames)}`);
|
|
124898
125046
|
writeLog(` options: ${JSON.stringify(compilerOptions)}`);
|
|
@@ -124903,6 +125051,7 @@ function createWatchProgram(host) {
|
|
|
124903
125051
|
hasChangedConfigFileParsingErrors = false;
|
|
124904
125052
|
resolutionCache.startCachingPerDirectoryResolution();
|
|
124905
125053
|
compilerHost.hasInvalidatedResolutions = hasInvalidatedResolutions;
|
|
125054
|
+
compilerHost.hasInvalidatedLibResolutions = hasInvalidatedLibResolutions;
|
|
124906
125055
|
compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames;
|
|
124907
125056
|
const oldProgram = getCurrentProgram();
|
|
124908
125057
|
builderProgram = createProgram2(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
|
|
@@ -125476,6 +125625,7 @@ function createSolutionBuilderState(watch, hostOrHostWithWatch, rootNames, optio
|
|
|
125476
125625
|
compilerHost.getParsedCommandLine = (fileName) => parseConfigFile(state, fileName, toResolvedConfigFilePath(state, fileName));
|
|
125477
125626
|
compilerHost.resolveModuleNameLiterals = maybeBind(host, host.resolveModuleNameLiterals);
|
|
125478
125627
|
compilerHost.resolveTypeReferenceDirectiveReferences = maybeBind(host, host.resolveTypeReferenceDirectiveReferences);
|
|
125628
|
+
compilerHost.resolveLibrary = maybeBind(host, host.resolveLibrary);
|
|
125479
125629
|
compilerHost.resolveModuleNames = maybeBind(host, host.resolveModuleNames);
|
|
125480
125630
|
compilerHost.resolveTypeReferenceDirectives = maybeBind(host, host.resolveTypeReferenceDirectives);
|
|
125481
125631
|
compilerHost.getModuleResolutionCache = maybeBind(host, host.getModuleResolutionCache);
|
|
@@ -125513,6 +125663,23 @@ function createSolutionBuilderState(watch, hostOrHostWithWatch, rootNames, optio
|
|
|
125513
125663
|
createTypeReferenceResolutionLoader
|
|
125514
125664
|
);
|
|
125515
125665
|
}
|
|
125666
|
+
let libraryResolutionCache;
|
|
125667
|
+
if (!compilerHost.resolveLibrary) {
|
|
125668
|
+
libraryResolutionCache = createModuleResolutionCache(
|
|
125669
|
+
compilerHost.getCurrentDirectory(),
|
|
125670
|
+
compilerHost.getCanonicalFileName,
|
|
125671
|
+
/*options*/
|
|
125672
|
+
void 0,
|
|
125673
|
+
moduleResolutionCache == null ? void 0 : moduleResolutionCache.getPackageJsonInfoCache()
|
|
125674
|
+
);
|
|
125675
|
+
compilerHost.resolveLibrary = (libraryName, resolveFrom, options2) => resolveLibrary(
|
|
125676
|
+
libraryName,
|
|
125677
|
+
resolveFrom,
|
|
125678
|
+
options2,
|
|
125679
|
+
host,
|
|
125680
|
+
libraryResolutionCache
|
|
125681
|
+
);
|
|
125682
|
+
}
|
|
125516
125683
|
compilerHost.getBuildInfo = (fileName, configFilePath) => getBuildInfo3(
|
|
125517
125684
|
state,
|
|
125518
125685
|
fileName,
|
|
@@ -125544,6 +125711,7 @@ function createSolutionBuilderState(watch, hostOrHostWithWatch, rootNames, optio
|
|
|
125544
125711
|
compilerHost,
|
|
125545
125712
|
moduleResolutionCache,
|
|
125546
125713
|
typeReferenceDirectiveResolutionCache,
|
|
125714
|
+
libraryResolutionCache,
|
|
125547
125715
|
// Mutable state
|
|
125548
125716
|
buildOrder: void 0,
|
|
125549
125717
|
readFileWithCache: (f) => host.readFile(f),
|
|
@@ -125761,7 +125929,7 @@ function enableCache(state) {
|
|
|
125761
125929
|
function disableCache(state) {
|
|
125762
125930
|
if (!state.cache)
|
|
125763
125931
|
return;
|
|
125764
|
-
const { cache, host, compilerHost, extendedConfigCache, moduleResolutionCache, typeReferenceDirectiveResolutionCache } = state;
|
|
125932
|
+
const { cache, host, compilerHost, extendedConfigCache, moduleResolutionCache, typeReferenceDirectiveResolutionCache, libraryResolutionCache } = state;
|
|
125765
125933
|
host.readFile = cache.originalReadFile;
|
|
125766
125934
|
host.fileExists = cache.originalFileExists;
|
|
125767
125935
|
host.directoryExists = cache.originalDirectoryExists;
|
|
@@ -125772,6 +125940,7 @@ function disableCache(state) {
|
|
|
125772
125940
|
extendedConfigCache.clear();
|
|
125773
125941
|
moduleResolutionCache == null ? void 0 : moduleResolutionCache.clear();
|
|
125774
125942
|
typeReferenceDirectiveResolutionCache == null ? void 0 : typeReferenceDirectiveResolutionCache.clear();
|
|
125943
|
+
libraryResolutionCache == null ? void 0 : libraryResolutionCache.clear();
|
|
125775
125944
|
state.cache = void 0;
|
|
125776
125945
|
}
|
|
125777
125946
|
function clearProjectStatus(state, resolved) {
|
|
@@ -129529,10 +129698,10 @@ function makeImport(defaultImport, namedImports, moduleSpecifier, quotePreferenc
|
|
|
129529
129698
|
function makeStringLiteral(text, quotePreference) {
|
|
129530
129699
|
return factory.createStringLiteral(text, quotePreference === 0 /* Single */);
|
|
129531
129700
|
}
|
|
129532
|
-
var QuotePreference = /* @__PURE__ */ ((
|
|
129533
|
-
|
|
129534
|
-
|
|
129535
|
-
return
|
|
129701
|
+
var QuotePreference = /* @__PURE__ */ ((QuotePreference6) => {
|
|
129702
|
+
QuotePreference6[QuotePreference6["Single"] = 0] = "Single";
|
|
129703
|
+
QuotePreference6[QuotePreference6["Double"] = 1] = "Double";
|
|
129704
|
+
return QuotePreference6;
|
|
129536
129705
|
})(QuotePreference || {});
|
|
129537
129706
|
function quotePreferenceFromString(str, sourceFile) {
|
|
129538
129707
|
return isStringDoubleQuoted(str, sourceFile) ? 1 /* Double */ : 0 /* Single */;
|
|
@@ -136115,6 +136284,7 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
136115
136284
|
const rootFileNames = host.getScriptFileNames().slice();
|
|
136116
136285
|
const newSettings = host.getCompilationSettings() || getDefaultCompilerOptions2();
|
|
136117
136286
|
const hasInvalidatedResolutions = host.hasInvalidatedResolutions || returnFalse;
|
|
136287
|
+
const hasInvalidatedLibResolutions = maybeBind(host, host.hasInvalidatedLibResolutions) || returnFalse;
|
|
136118
136288
|
const hasChangedAutomaticTypeDirectiveNames = maybeBind(host, host.hasChangedAutomaticTypeDirectiveNames);
|
|
136119
136289
|
const projectReferences = (_b = host.getProjectReferences) == null ? void 0 : _b.call(host);
|
|
136120
136290
|
let parsedCommandLines;
|
|
@@ -136145,6 +136315,7 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
136145
136315
|
onReleaseOldSourceFile,
|
|
136146
136316
|
onReleaseParsedCommandLine,
|
|
136147
136317
|
hasInvalidatedResolutions,
|
|
136318
|
+
hasInvalidatedLibResolutions,
|
|
136148
136319
|
hasChangedAutomaticTypeDirectiveNames,
|
|
136149
136320
|
trace: maybeBind(host, host.trace),
|
|
136150
136321
|
resolveModuleNames: maybeBind(host, host.resolveModuleNames),
|
|
@@ -136153,6 +136324,7 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
136153
136324
|
resolveTypeReferenceDirectives: maybeBind(host, host.resolveTypeReferenceDirectives),
|
|
136154
136325
|
resolveModuleNameLiterals: maybeBind(host, host.resolveModuleNameLiterals),
|
|
136155
136326
|
resolveTypeReferenceDirectiveReferences: maybeBind(host, host.resolveTypeReferenceDirectiveReferences),
|
|
136327
|
+
resolveLibrary: maybeBind(host, host.resolveLibrary),
|
|
136156
136328
|
useSourceOfProjectReferenceRedirect: maybeBind(host, host.useSourceOfProjectReferenceRedirect),
|
|
136157
136329
|
getParsedCommandLine
|
|
136158
136330
|
};
|
|
@@ -136174,7 +136346,7 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
136174
136346
|
onUnRecoverableConfigFileDiagnostic: noop
|
|
136175
136347
|
};
|
|
136176
136348
|
const documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings);
|
|
136177
|
-
if (isProgramUptoDate(program, rootFileNames, newSettings, (_path, fileName) => host.getScriptVersion(fileName), (fileName) => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
136349
|
+
if (isProgramUptoDate(program, rootFileNames, newSettings, (_path, fileName) => host.getScriptVersion(fileName), (fileName) => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasInvalidatedLibResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
136178
136350
|
return;
|
|
136179
136351
|
}
|
|
136180
136352
|
const options = {
|
|
@@ -136478,7 +136650,7 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
136478
136650
|
const sourceFile = getValidSourceFile(fileName);
|
|
136479
136651
|
return DocumentHighlights.getDocumentHighlights(program, cancellationToken, sourceFile, position, sourceFilesToSearch);
|
|
136480
136652
|
}
|
|
136481
|
-
function findRenameLocations(fileName, position, findInStrings, findInComments,
|
|
136653
|
+
function findRenameLocations(fileName, position, findInStrings, findInComments, preferences) {
|
|
136482
136654
|
synchronizeHostData();
|
|
136483
136655
|
const sourceFile = getValidSourceFile(fileName);
|
|
136484
136656
|
const node = getAdjustedRenameLocation(getTouchingPropertyName(sourceFile, position));
|
|
@@ -136495,11 +136667,13 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
136495
136667
|
};
|
|
136496
136668
|
});
|
|
136497
136669
|
} else {
|
|
136670
|
+
const quotePreference = getQuotePreference(sourceFile, preferences ?? emptyOptions);
|
|
136671
|
+
const providePrefixAndSuffixTextForRename = typeof preferences === "boolean" ? preferences : preferences == null ? void 0 : preferences.providePrefixAndSuffixTextForRename;
|
|
136498
136672
|
return getReferencesWorker2(
|
|
136499
136673
|
node,
|
|
136500
136674
|
position,
|
|
136501
136675
|
{ findInStrings, findInComments, providePrefixAndSuffixTextForRename, use: ts_FindAllReferences_exports.FindReferencesUse.Rename },
|
|
136502
|
-
(entry, originalNode, checker) => ts_FindAllReferences_exports.toRenameLocation(entry, originalNode, checker, providePrefixAndSuffixTextForRename || false)
|
|
136676
|
+
(entry, originalNode, checker) => ts_FindAllReferences_exports.toRenameLocation(entry, originalNode, checker, providePrefixAndSuffixTextForRename || false, quotePreference)
|
|
136503
136677
|
);
|
|
136504
136678
|
}
|
|
136505
136679
|
}
|
|
@@ -136744,6 +136918,7 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
136744
136918
|
const token = findPrecedingToken(position, sourceFile);
|
|
136745
136919
|
if (!token || token.parent.kind === 311 /* SourceFile */)
|
|
136746
136920
|
return void 0;
|
|
136921
|
+
const jsxTagWordPattern = "[a-zA-Z0-9:\\-\\._$]*";
|
|
136747
136922
|
if (isJsxFragment(token.parent.parent)) {
|
|
136748
136923
|
const openFragment = token.parent.parent.openingFragment;
|
|
136749
136924
|
const closeFragment = token.parent.parent.closingFragment;
|
|
@@ -136753,7 +136928,10 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
136753
136928
|
const closePos = closeFragment.getStart(sourceFile) + 2;
|
|
136754
136929
|
if (position !== openPos && position !== closePos)
|
|
136755
136930
|
return void 0;
|
|
136756
|
-
return {
|
|
136931
|
+
return {
|
|
136932
|
+
ranges: [{ start: openPos, length: 0 }, { start: closePos, length: 0 }],
|
|
136933
|
+
wordPattern: jsxTagWordPattern
|
|
136934
|
+
};
|
|
136757
136935
|
} else {
|
|
136758
136936
|
const tag = findAncestor(
|
|
136759
136937
|
token.parent,
|
|
@@ -136779,7 +136957,8 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
136779
136957
|
if (openingTagText !== closeTag.tagName.getText(sourceFile))
|
|
136780
136958
|
return void 0;
|
|
136781
136959
|
return {
|
|
136782
|
-
ranges: [{ start: openTagStart, length: openTagEnd - openTagStart }, { start: closeTagStart, length: closeTagEnd - closeTagStart }]
|
|
136960
|
+
ranges: [{ start: openTagStart, length: openTagEnd - openTagStart }, { start: closeTagStart, length: closeTagEnd - closeTagStart }],
|
|
136961
|
+
wordPattern: jsxTagWordPattern
|
|
136783
136962
|
};
|
|
136784
136963
|
}
|
|
136785
136964
|
}
|
|
@@ -137807,10 +137986,10 @@ var LanguageServiceShimObject = class extends ShimBase {
|
|
|
137807
137986
|
() => this.languageService.getSmartSelectionRange(fileName, position)
|
|
137808
137987
|
);
|
|
137809
137988
|
}
|
|
137810
|
-
findRenameLocations(fileName, position, findInStrings, findInComments,
|
|
137989
|
+
findRenameLocations(fileName, position, findInStrings, findInComments, preferences) {
|
|
137811
137990
|
return this.forwardJSONCall(
|
|
137812
|
-
`findRenameLocations('${fileName}', ${position}, ${findInStrings}, ${findInComments}
|
|
137813
|
-
() => this.languageService.findRenameLocations(fileName, position, findInStrings, findInComments,
|
|
137991
|
+
`findRenameLocations('${fileName}', ${position}, ${findInStrings}, ${findInComments})`,
|
|
137992
|
+
() => this.languageService.findRenameLocations(fileName, position, findInStrings, findInComments, preferences)
|
|
137814
137993
|
);
|
|
137815
137994
|
}
|
|
137816
137995
|
/// GET BRACE MATCHING
|
|
@@ -150993,7 +151172,7 @@ function getContextualType(previousToken, position, sourceFile, checker) {
|
|
|
150993
151172
|
) : isEqualityOperatorKind(previousToken.kind) && isBinaryExpression(parent2) && isEqualityOperatorKind(parent2.operatorToken.kind) ? (
|
|
150994
151173
|
// completion at `x ===/**/` should be for the right side
|
|
150995
151174
|
checker.getTypeAtLocation(parent2.left)
|
|
150996
|
-
) : checker.getContextualType(previousToken);
|
|
151175
|
+
) : checker.getContextualType(previousToken, 4 /* Completions */) || checker.getContextualType(previousToken);
|
|
150997
151176
|
}
|
|
150998
151177
|
}
|
|
150999
151178
|
function getFirstSymbolInChain(symbol, enclosingDeclaration, checker) {
|
|
@@ -154545,8 +154724,8 @@ function getDefinitionKindAndDisplayParts(symbol, checker, node) {
|
|
|
154545
154724
|
const { displayParts, symbolKind } = ts_SymbolDisplay_exports.getSymbolDisplayPartsDocumentationAndSymbolKind(checker, symbol, enclosingDeclaration.getSourceFile(), enclosingDeclaration, enclosingDeclaration, meaning);
|
|
154546
154725
|
return { displayParts, kind: symbolKind };
|
|
154547
154726
|
}
|
|
154548
|
-
function toRenameLocation(entry, originalNode, checker, providePrefixAndSuffixText) {
|
|
154549
|
-
return { ...entryToDocumentSpan(entry), ...providePrefixAndSuffixText && getPrefixAndSuffixText(entry, originalNode, checker) };
|
|
154727
|
+
function toRenameLocation(entry, originalNode, checker, providePrefixAndSuffixText, quotePreference) {
|
|
154728
|
+
return { ...entryToDocumentSpan(entry), ...providePrefixAndSuffixText && getPrefixAndSuffixText(entry, originalNode, checker, quotePreference) };
|
|
154550
154729
|
}
|
|
154551
154730
|
function toReferencedSymbolEntry(entry, symbol) {
|
|
154552
154731
|
const referenceEntry = toReferenceEntry(entry);
|
|
@@ -154582,7 +154761,7 @@ function entryToDocumentSpan(entry) {
|
|
|
154582
154761
|
};
|
|
154583
154762
|
}
|
|
154584
154763
|
}
|
|
154585
|
-
function getPrefixAndSuffixText(entry, originalNode, checker) {
|
|
154764
|
+
function getPrefixAndSuffixText(entry, originalNode, checker, quotePreference) {
|
|
154586
154765
|
if (entry.kind !== 0 /* Span */ && isIdentifier(originalNode)) {
|
|
154587
154766
|
const { node, kind } = entry;
|
|
154588
154767
|
const parent2 = node.parent;
|
|
@@ -154613,6 +154792,10 @@ function getPrefixAndSuffixText(entry, originalNode, checker) {
|
|
|
154613
154792
|
return originalNode === entry.node || checker.getSymbolAtLocation(originalNode) === checker.getSymbolAtLocation(entry.node) ? { prefixText: name + " as " } : { suffixText: " as " + name };
|
|
154614
154793
|
}
|
|
154615
154794
|
}
|
|
154795
|
+
if (entry.kind !== 0 /* Span */ && isNumericLiteral(entry.node) && isAccessExpression(entry.node.parent)) {
|
|
154796
|
+
const quote2 = getQuoteFromPreference(quotePreference);
|
|
154797
|
+
return { prefixText: quote2, suffixText: quote2 };
|
|
154798
|
+
}
|
|
154616
154799
|
return emptyOptions;
|
|
154617
154800
|
}
|
|
154618
154801
|
function toImplementationLocation(entry, checker) {
|
|
@@ -169577,6 +169760,7 @@ __export(ts_exports2, {
|
|
|
169577
169760
|
getImportNeedsImportStarHelper: () => getImportNeedsImportStarHelper,
|
|
169578
169761
|
getIndentSize: () => getIndentSize,
|
|
169579
169762
|
getIndentString: () => getIndentString,
|
|
169763
|
+
getInferredLibraryNameResolveFrom: () => getInferredLibraryNameResolveFrom,
|
|
169580
169764
|
getInitializedVariables: () => getInitializedVariables,
|
|
169581
169765
|
getInitializerOfBinaryExpression: () => getInitializerOfBinaryExpression,
|
|
169582
169766
|
getInitializerOfBindingOrAssignmentElement: () => getInitializerOfBindingOrAssignmentElement,
|
|
@@ -169697,6 +169881,7 @@ __export(ts_exports2, {
|
|
|
169697
169881
|
getOperatorAssociativity: () => getOperatorAssociativity,
|
|
169698
169882
|
getOperatorPrecedence: () => getOperatorPrecedence,
|
|
169699
169883
|
getOptionFromName: () => getOptionFromName,
|
|
169884
|
+
getOptionsForLibraryResolution: () => getOptionsForLibraryResolution,
|
|
169700
169885
|
getOptionsNameMap: () => getOptionsNameMap,
|
|
169701
169886
|
getOrCreateEmitNode: () => getOrCreateEmitNode,
|
|
169702
169887
|
getOrCreateExternalHelpersModuleNameIfNeeded: () => getOrCreateExternalHelpersModuleNameIfNeeded,
|
|
@@ -170808,6 +170993,7 @@ __export(ts_exports2, {
|
|
|
170808
170993
|
resolutionExtensionIsTSOrJson: () => resolutionExtensionIsTSOrJson,
|
|
170809
170994
|
resolveConfigFileProjectName: () => resolveConfigFileProjectName,
|
|
170810
170995
|
resolveJSModule: () => resolveJSModule,
|
|
170996
|
+
resolveLibrary: () => resolveLibrary,
|
|
170811
170997
|
resolveModuleName: () => resolveModuleName,
|
|
170812
170998
|
resolveModuleNameFromCache: () => resolveModuleNameFromCache,
|
|
170813
170999
|
resolvePackageNameToPackageJson: () => resolvePackageNameToPackageJson,
|
|
@@ -172962,34 +173148,49 @@ var Project3 = class {
|
|
|
172962
173148
|
updateProjectIfDirty(this);
|
|
172963
173149
|
return hasOneOrMoreJsAndNoTsFiles(this);
|
|
172964
173150
|
}
|
|
172965
|
-
static resolveModule(moduleName, initialDir, host, log
|
|
172966
|
-
|
|
172967
|
-
|
|
172968
|
-
|
|
172969
|
-
|
|
173151
|
+
static resolveModule(moduleName, initialDir, host, log) {
|
|
173152
|
+
return Project3.importServicePluginSync({ name: moduleName }, [initialDir], host, log).resolvedModule;
|
|
173153
|
+
}
|
|
173154
|
+
/** @internal */
|
|
173155
|
+
static importServicePluginSync(pluginConfigEntry, searchPaths, host, log) {
|
|
173156
|
+
Debug.assertIsDefined(host.require);
|
|
173157
|
+
let errorLogs;
|
|
173158
|
+
let resolvedModule;
|
|
173159
|
+
for (const initialDir of searchPaths) {
|
|
173160
|
+
const resolvedPath = normalizeSlashes(host.resolvePath(combinePaths(initialDir, "node_modules")));
|
|
173161
|
+
log(`Loading ${pluginConfigEntry.name} from ${initialDir} (resolved to ${resolvedPath})`);
|
|
173162
|
+
const result = host.require(resolvedPath, pluginConfigEntry.name);
|
|
173163
|
+
if (!result.error) {
|
|
173164
|
+
resolvedModule = result.module;
|
|
173165
|
+
break;
|
|
173166
|
+
}
|
|
172970
173167
|
const err = result.error.stack || result.error.message || JSON.stringify(result.error);
|
|
172971
|
-
(
|
|
172972
|
-
return void 0;
|
|
173168
|
+
(errorLogs ?? (errorLogs = [])).push(`Failed to load module '${pluginConfigEntry.name}' from ${resolvedPath}: ${err}`);
|
|
172973
173169
|
}
|
|
172974
|
-
return
|
|
173170
|
+
return { pluginConfigEntry, resolvedModule, errorLogs };
|
|
172975
173171
|
}
|
|
172976
173172
|
/** @internal */
|
|
172977
|
-
static async importServicePluginAsync(
|
|
173173
|
+
static async importServicePluginAsync(pluginConfigEntry, searchPaths, host, log) {
|
|
172978
173174
|
Debug.assertIsDefined(host.importPlugin);
|
|
172979
|
-
|
|
172980
|
-
|
|
172981
|
-
|
|
172982
|
-
|
|
172983
|
-
|
|
172984
|
-
|
|
172985
|
-
|
|
172986
|
-
|
|
172987
|
-
|
|
173175
|
+
let errorLogs;
|
|
173176
|
+
let resolvedModule;
|
|
173177
|
+
for (const initialDir of searchPaths) {
|
|
173178
|
+
const resolvedPath = combinePaths(initialDir, "node_modules");
|
|
173179
|
+
log(`Dynamically importing ${pluginConfigEntry.name} from ${initialDir} (resolved to ${resolvedPath})`);
|
|
173180
|
+
let result;
|
|
173181
|
+
try {
|
|
173182
|
+
result = await host.importPlugin(resolvedPath, pluginConfigEntry.name);
|
|
173183
|
+
} catch (e) {
|
|
173184
|
+
result = { module: void 0, error: e };
|
|
173185
|
+
}
|
|
173186
|
+
if (!result.error) {
|
|
173187
|
+
resolvedModule = result.module;
|
|
173188
|
+
break;
|
|
173189
|
+
}
|
|
172988
173190
|
const err = result.error.stack || result.error.message || JSON.stringify(result.error);
|
|
172989
|
-
(
|
|
172990
|
-
return void 0;
|
|
173191
|
+
(errorLogs ?? (errorLogs = [])).push(`Failed to dynamically import module '${pluginConfigEntry.name}' from ${resolvedPath}: ${err}`);
|
|
172991
173192
|
}
|
|
172992
|
-
return
|
|
173193
|
+
return { pluginConfigEntry, resolvedModule, errorLogs };
|
|
172993
173194
|
}
|
|
172994
173195
|
isKnownTypesPackageName(name) {
|
|
172995
173196
|
return this.typingsCache.isKnownTypesPackageName(name);
|
|
@@ -173116,6 +173317,10 @@ var Project3 = class {
|
|
|
173116
173317
|
reusedNames
|
|
173117
173318
|
);
|
|
173118
173319
|
}
|
|
173320
|
+
/** @internal */
|
|
173321
|
+
resolveLibrary(libraryName, resolveFrom, options, libFileName) {
|
|
173322
|
+
return this.resolutionCache.resolveLibrary(libraryName, resolveFrom, options, libFileName);
|
|
173323
|
+
}
|
|
173119
173324
|
directoryExists(path) {
|
|
173120
173325
|
return this.directoryStructureHost.directoryExists(path);
|
|
173121
173326
|
}
|
|
@@ -173680,7 +173885,9 @@ var Project3 = class {
|
|
|
173680
173885
|
Debug.assert(!this.isClosed(), "Called update graph worker of closed project");
|
|
173681
173886
|
this.writeLog(`Starting updateGraphWorker: Project: ${this.getProjectName()}`);
|
|
173682
173887
|
const start2 = timestamp();
|
|
173683
|
-
|
|
173888
|
+
const { hasInvalidatedResolutions, hasInvalidatedLibResolutions } = this.resolutionCache.createHasInvalidatedResolutions(returnFalse, returnFalse);
|
|
173889
|
+
this.hasInvalidatedResolutions = hasInvalidatedResolutions;
|
|
173890
|
+
this.hasInvalidatedLibResolutions = hasInvalidatedLibResolutions;
|
|
173684
173891
|
this.resolutionCache.startCachingPerDirectoryResolution();
|
|
173685
173892
|
this.program = this.languageService.getProgram();
|
|
173686
173893
|
this.dirty = false;
|
|
@@ -174097,7 +174304,7 @@ var Project3 = class {
|
|
|
174097
174304
|
combinePaths(this.projectService.getExecutingFilePath(), "../../..")
|
|
174098
174305
|
];
|
|
174099
174306
|
}
|
|
174100
|
-
enableGlobalPlugins(options
|
|
174307
|
+
enableGlobalPlugins(options) {
|
|
174101
174308
|
if (!this.projectService.globalPlugins.length)
|
|
174102
174309
|
return;
|
|
174103
174310
|
const host = this.projectService.host;
|
|
@@ -174112,67 +174319,13 @@ var Project3 = class {
|
|
|
174112
174319
|
if (options.plugins && options.plugins.some((p) => p.name === globalPluginName))
|
|
174113
174320
|
continue;
|
|
174114
174321
|
this.projectService.logger.info(`Loading global plugin ${globalPluginName}`);
|
|
174115
|
-
this.enablePlugin({ name: globalPluginName, global: true }, searchPaths
|
|
174322
|
+
this.enablePlugin({ name: globalPluginName, global: true }, searchPaths);
|
|
174116
174323
|
}
|
|
174117
174324
|
}
|
|
174118
|
-
|
|
174119
|
-
|
|
174120
|
-
*
|
|
174121
|
-
* @internal
|
|
174122
|
-
*/
|
|
174123
|
-
beginEnablePluginSync(pluginConfigEntry, searchPaths, pluginConfigOverrides) {
|
|
174124
|
-
Debug.assertIsDefined(this.projectService.host.require);
|
|
174125
|
-
let errorLogs;
|
|
174126
|
-
const log = (message) => this.projectService.logger.info(message);
|
|
174127
|
-
const logError = (message) => {
|
|
174128
|
-
(errorLogs ?? (errorLogs = [])).push(message);
|
|
174129
|
-
};
|
|
174130
|
-
const resolvedModule = firstDefined(searchPaths, (searchPath) => Project3.resolveModule(pluginConfigEntry.name, searchPath, this.projectService.host, log, logError));
|
|
174131
|
-
return { pluginConfigEntry, pluginConfigOverrides, resolvedModule, errorLogs };
|
|
174132
|
-
}
|
|
174133
|
-
/**
|
|
174134
|
-
* Performs the initial steps of enabling a plugin by finding and instantiating the module for a plugin asynchronously using dynamic `import`.
|
|
174135
|
-
*
|
|
174136
|
-
* @internal
|
|
174137
|
-
*/
|
|
174138
|
-
async beginEnablePluginAsync(pluginConfigEntry, searchPaths, pluginConfigOverrides) {
|
|
174139
|
-
Debug.assertIsDefined(this.projectService.host.importPlugin);
|
|
174140
|
-
let errorLogs;
|
|
174141
|
-
const log = (message) => this.projectService.logger.info(message);
|
|
174142
|
-
const logError = (message) => {
|
|
174143
|
-
(errorLogs ?? (errorLogs = [])).push(message);
|
|
174144
|
-
};
|
|
174145
|
-
let resolvedModule;
|
|
174146
|
-
for (const searchPath of searchPaths) {
|
|
174147
|
-
resolvedModule = await Project3.importServicePluginAsync(pluginConfigEntry.name, searchPath, this.projectService.host, log, logError);
|
|
174148
|
-
if (resolvedModule !== void 0) {
|
|
174149
|
-
break;
|
|
174150
|
-
}
|
|
174151
|
-
}
|
|
174152
|
-
return { pluginConfigEntry, pluginConfigOverrides, resolvedModule, errorLogs };
|
|
174153
|
-
}
|
|
174154
|
-
/**
|
|
174155
|
-
* Performs the remaining steps of enabling a plugin after its module has been instantiated.
|
|
174156
|
-
*
|
|
174157
|
-
* @internal
|
|
174158
|
-
*/
|
|
174159
|
-
endEnablePlugin({ pluginConfigEntry, pluginConfigOverrides, resolvedModule, errorLogs }) {
|
|
174160
|
-
if (resolvedModule) {
|
|
174161
|
-
const configurationOverride = pluginConfigOverrides && pluginConfigOverrides.get(pluginConfigEntry.name);
|
|
174162
|
-
if (configurationOverride) {
|
|
174163
|
-
const pluginName = pluginConfigEntry.name;
|
|
174164
|
-
pluginConfigEntry = configurationOverride;
|
|
174165
|
-
pluginConfigEntry.name = pluginName;
|
|
174166
|
-
}
|
|
174167
|
-
this.enableProxy(resolvedModule, pluginConfigEntry);
|
|
174168
|
-
} else {
|
|
174169
|
-
forEach(errorLogs, (message) => this.projectService.logger.info(message));
|
|
174170
|
-
this.projectService.logger.info(`Couldn't find ${pluginConfigEntry.name}`);
|
|
174171
|
-
}
|
|
174172
|
-
}
|
|
174173
|
-
enablePlugin(pluginConfigEntry, searchPaths, pluginConfigOverrides) {
|
|
174174
|
-
this.projectService.requestEnablePlugin(this, pluginConfigEntry, searchPaths, pluginConfigOverrides);
|
|
174325
|
+
enablePlugin(pluginConfigEntry, searchPaths) {
|
|
174326
|
+
this.projectService.requestEnablePlugin(this, pluginConfigEntry, searchPaths);
|
|
174175
174327
|
}
|
|
174328
|
+
/** @internal */
|
|
174176
174329
|
enableProxy(pluginModuleFactory, configEntry) {
|
|
174177
174330
|
try {
|
|
174178
174331
|
if (typeof pluginModuleFactory !== "function") {
|
|
@@ -174388,7 +174541,7 @@ function extractUnresolvedImportsFromSourceFile(file, ambientModules, cachedUnre
|
|
|
174388
174541
|
}
|
|
174389
174542
|
var InferredProject2 = class extends Project3 {
|
|
174390
174543
|
/** @internal */
|
|
174391
|
-
constructor(projectService, documentRegistry, compilerOptions, watchOptions, projectRootPath, currentDirectory,
|
|
174544
|
+
constructor(projectService, documentRegistry, compilerOptions, watchOptions, projectRootPath, currentDirectory, typeAcquisition) {
|
|
174392
174545
|
super(
|
|
174393
174546
|
projectService.newInferredProjectName(),
|
|
174394
174547
|
0 /* Inferred */,
|
|
@@ -174412,7 +174565,7 @@ var InferredProject2 = class extends Project3 {
|
|
|
174412
174565
|
if (!projectRootPath && !projectService.useSingleInferredProject) {
|
|
174413
174566
|
this.canonicalCurrentDirectory = projectService.toCanonicalFileName(this.currentDirectory);
|
|
174414
174567
|
}
|
|
174415
|
-
this.enableGlobalPlugins(this.getCompilerOptions()
|
|
174568
|
+
this.enableGlobalPlugins(this.getCompilerOptions());
|
|
174416
174569
|
}
|
|
174417
174570
|
toggleJsInferredProject(isJsInferredProject) {
|
|
174418
174571
|
if (isJsInferredProject !== this._isJsInferredProject) {
|
|
@@ -174878,7 +175031,7 @@ var ConfiguredProject2 = class extends Project3 {
|
|
|
174878
175031
|
return (_a = this.getCurrentProgram()) == null ? void 0 : _a.forEachResolvedProjectReference(cb);
|
|
174879
175032
|
}
|
|
174880
175033
|
/** @internal */
|
|
174881
|
-
enablePluginsWithOptions(options
|
|
175034
|
+
enablePluginsWithOptions(options) {
|
|
174882
175035
|
var _a;
|
|
174883
175036
|
this.plugins.length = 0;
|
|
174884
175037
|
if (!((_a = options.plugins) == null ? void 0 : _a.length) && !this.projectService.globalPlugins.length)
|
|
@@ -174896,10 +175049,10 @@ var ConfiguredProject2 = class extends Project3 {
|
|
|
174896
175049
|
}
|
|
174897
175050
|
if (options.plugins) {
|
|
174898
175051
|
for (const pluginConfigEntry of options.plugins) {
|
|
174899
|
-
this.enablePlugin(pluginConfigEntry, searchPaths
|
|
175052
|
+
this.enablePlugin(pluginConfigEntry, searchPaths);
|
|
174900
175053
|
}
|
|
174901
175054
|
}
|
|
174902
|
-
return this.enableGlobalPlugins(options
|
|
175055
|
+
return this.enableGlobalPlugins(options);
|
|
174903
175056
|
}
|
|
174904
175057
|
/**
|
|
174905
175058
|
* Get the errors that dont have any file name associated
|
|
@@ -174992,7 +175145,7 @@ var ConfiguredProject2 = class extends Project3 {
|
|
|
174992
175145
|
};
|
|
174993
175146
|
var ExternalProject2 = class extends Project3 {
|
|
174994
175147
|
/** @internal */
|
|
174995
|
-
constructor(externalProjectName, projectService, documentRegistry, compilerOptions, lastFileExceededProgramSize, compileOnSaveEnabled, projectFilePath,
|
|
175148
|
+
constructor(externalProjectName, projectService, documentRegistry, compilerOptions, lastFileExceededProgramSize, compileOnSaveEnabled, projectFilePath, watchOptions) {
|
|
174996
175149
|
super(
|
|
174997
175150
|
externalProjectName,
|
|
174998
175151
|
2 /* External */,
|
|
@@ -175010,7 +175163,7 @@ var ExternalProject2 = class extends Project3 {
|
|
|
175010
175163
|
this.externalProjectName = externalProjectName;
|
|
175011
175164
|
this.compileOnSaveEnabled = compileOnSaveEnabled;
|
|
175012
175165
|
this.excludedFiles = [];
|
|
175013
|
-
this.enableGlobalPlugins(this.getCompilerOptions()
|
|
175166
|
+
this.enableGlobalPlugins(this.getCompilerOptions());
|
|
175014
175167
|
}
|
|
175015
175168
|
updateGraph() {
|
|
175016
175169
|
const result = super.updateGraph();
|
|
@@ -176346,7 +176499,6 @@ var _ProjectService = class {
|
|
|
176346
176499
|
options.compileOnSave === void 0 ? true : options.compileOnSave,
|
|
176347
176500
|
/*projectFilePath*/
|
|
176348
176501
|
void 0,
|
|
176349
|
-
this.currentPluginConfigOverrides,
|
|
176350
176502
|
watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.watchOptions
|
|
176351
176503
|
);
|
|
176352
176504
|
project.setProjectErrors(watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.errors);
|
|
@@ -176495,7 +176647,7 @@ var _ProjectService = class {
|
|
|
176495
176647
|
project.enableLanguageService();
|
|
176496
176648
|
this.watchWildcards(configFilename, configFileExistenceInfo, project);
|
|
176497
176649
|
}
|
|
176498
|
-
project.enablePluginsWithOptions(compilerOptions
|
|
176650
|
+
project.enablePluginsWithOptions(compilerOptions);
|
|
176499
176651
|
const filesToAdd = parsedCommandLine.fileNames.concat(project.getExternalFiles());
|
|
176500
176652
|
this.updateRootAndOptionsOfNonInferredProject(project, filesToAdd, fileNamePropertyReader, compilerOptions, parsedCommandLine.typeAcquisition, parsedCommandLine.compileOnSave, parsedCommandLine.watchOptions);
|
|
176501
176653
|
(_b = tracing) == null ? void 0 : _b.pop();
|
|
@@ -176836,7 +176988,7 @@ var _ProjectService = class {
|
|
|
176836
176988
|
typeAcquisition = this.typeAcquisitionForInferredProjects;
|
|
176837
176989
|
}
|
|
176838
176990
|
watchOptionsAndErrors = watchOptionsAndErrors || void 0;
|
|
176839
|
-
const project = new InferredProject2(this, this.documentRegistry, compilerOptions, watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.watchOptions, projectRootPath, currentDirectory,
|
|
176991
|
+
const project = new InferredProject2(this, this.documentRegistry, compilerOptions, watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.watchOptions, projectRootPath, currentDirectory, typeAcquisition);
|
|
176840
176992
|
project.setProjectErrors(watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.errors);
|
|
176841
176993
|
if (isSingleInferredProject) {
|
|
176842
176994
|
this.inferredProjects.unshift(project);
|
|
@@ -178063,8 +178215,11 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
178063
178215
|
}
|
|
178064
178216
|
return false;
|
|
178065
178217
|
}
|
|
178066
|
-
/**
|
|
178067
|
-
|
|
178218
|
+
/**
|
|
178219
|
+
* Performs the initial steps of enabling a plugin by finding and instantiating the module for a plugin either asynchronously or synchronously
|
|
178220
|
+
* @internal
|
|
178221
|
+
*/
|
|
178222
|
+
requestEnablePlugin(project, pluginConfigEntry, searchPaths) {
|
|
178068
178223
|
if (!this.host.importPlugin && !this.host.require) {
|
|
178069
178224
|
this.logger.info("Plugins were requested but not running in environment that supports 'require'. Nothing will be loaded");
|
|
178070
178225
|
return;
|
|
@@ -178075,7 +178230,12 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
178075
178230
|
return;
|
|
178076
178231
|
}
|
|
178077
178232
|
if (this.host.importPlugin) {
|
|
178078
|
-
const importPromise =
|
|
178233
|
+
const importPromise = Project3.importServicePluginAsync(
|
|
178234
|
+
pluginConfigEntry,
|
|
178235
|
+
searchPaths,
|
|
178236
|
+
this.host,
|
|
178237
|
+
(s) => this.logger.info(s)
|
|
178238
|
+
);
|
|
178079
178239
|
this.pendingPluginEnablements ?? (this.pendingPluginEnablements = /* @__PURE__ */ new Map());
|
|
178080
178240
|
let promises = this.pendingPluginEnablements.get(project);
|
|
178081
178241
|
if (!promises)
|
|
@@ -178083,7 +178243,31 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
178083
178243
|
promises.push(importPromise);
|
|
178084
178244
|
return;
|
|
178085
178245
|
}
|
|
178086
|
-
|
|
178246
|
+
this.endEnablePlugin(project, Project3.importServicePluginSync(
|
|
178247
|
+
pluginConfigEntry,
|
|
178248
|
+
searchPaths,
|
|
178249
|
+
this.host,
|
|
178250
|
+
(s) => this.logger.info(s)
|
|
178251
|
+
));
|
|
178252
|
+
}
|
|
178253
|
+
/**
|
|
178254
|
+
* Performs the remaining steps of enabling a plugin after its module has been instantiated.
|
|
178255
|
+
* @internal
|
|
178256
|
+
*/
|
|
178257
|
+
endEnablePlugin(project, { pluginConfigEntry, resolvedModule, errorLogs }) {
|
|
178258
|
+
var _a;
|
|
178259
|
+
if (resolvedModule) {
|
|
178260
|
+
const configurationOverride = (_a = this.currentPluginConfigOverrides) == null ? void 0 : _a.get(pluginConfigEntry.name);
|
|
178261
|
+
if (configurationOverride) {
|
|
178262
|
+
const pluginName = pluginConfigEntry.name;
|
|
178263
|
+
pluginConfigEntry = configurationOverride;
|
|
178264
|
+
pluginConfigEntry.name = pluginName;
|
|
178265
|
+
}
|
|
178266
|
+
project.enableProxy(resolvedModule, pluginConfigEntry);
|
|
178267
|
+
} else {
|
|
178268
|
+
forEach(errorLogs, (message) => this.logger.info(message));
|
|
178269
|
+
this.logger.info(`Couldn't find ${pluginConfigEntry.name}`);
|
|
178270
|
+
}
|
|
178087
178271
|
}
|
|
178088
178272
|
/** @internal */
|
|
178089
178273
|
hasNewPluginEnablementRequests() {
|
|
@@ -178137,7 +178321,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
178137
178321
|
return;
|
|
178138
178322
|
}
|
|
178139
178323
|
for (const result of results) {
|
|
178140
|
-
|
|
178324
|
+
this.endEnablePlugin(project, result);
|
|
178141
178325
|
}
|
|
178142
178326
|
this.delayUpdateProjectGraph(project);
|
|
178143
178327
|
}
|
|
@@ -178599,14 +178783,14 @@ function combineProjectOutput(defaultValue, getValue, projects, action) {
|
|
|
178599
178783
|
function createDocumentSpanSet() {
|
|
178600
178784
|
return createSet(({ textSpan }) => textSpan.start + 100003 * textSpan.length, documentSpansEqual);
|
|
178601
178785
|
}
|
|
178602
|
-
function getRenameLocationsWorker(projects, defaultProject, initialLocation, findInStrings, findInComments,
|
|
178786
|
+
function getRenameLocationsWorker(projects, defaultProject, initialLocation, findInStrings, findInComments, preferences) {
|
|
178603
178787
|
const perProjectResults = getPerProjectReferences(
|
|
178604
178788
|
projects,
|
|
178605
178789
|
defaultProject,
|
|
178606
178790
|
initialLocation,
|
|
178607
178791
|
/*isForRename*/
|
|
178608
178792
|
true,
|
|
178609
|
-
(project, position) => project.getLanguageService().findRenameLocations(position.fileName, position.pos, findInStrings, findInComments,
|
|
178793
|
+
(project, position) => project.getLanguageService().findRenameLocations(position.fileName, position.pos, findInStrings, findInComments, preferences),
|
|
178610
178794
|
(renameLocation, cb) => cb(documentSpanLocation(renameLocation))
|
|
178611
178795
|
);
|
|
178612
178796
|
if (isArray(perProjectResults)) {
|
|
@@ -182753,13 +182937,6 @@ function initializeNodeSystem() {
|
|
|
182753
182937
|
return (_a = global.gc) == null ? void 0 : _a.call(global);
|
|
182754
182938
|
};
|
|
182755
182939
|
}
|
|
182756
|
-
sys2.require = (initialDir, moduleName) => {
|
|
182757
|
-
try {
|
|
182758
|
-
return { module: require(resolveJSModule(moduleName, initialDir, sys2)), error: void 0 };
|
|
182759
|
-
} catch (error) {
|
|
182760
|
-
return { module: void 0, error };
|
|
182761
|
-
}
|
|
182762
|
-
};
|
|
182763
182940
|
let cancellationToken;
|
|
182764
182941
|
try {
|
|
182765
182942
|
const factory2 = require("./cancellationToken");
|
|
@@ -184017,6 +184194,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
184017
184194
|
getImportNeedsImportStarHelper,
|
|
184018
184195
|
getIndentSize,
|
|
184019
184196
|
getIndentString,
|
|
184197
|
+
getInferredLibraryNameResolveFrom,
|
|
184020
184198
|
getInitializedVariables,
|
|
184021
184199
|
getInitializerOfBinaryExpression,
|
|
184022
184200
|
getInitializerOfBindingOrAssignmentElement,
|
|
@@ -184137,6 +184315,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
184137
184315
|
getOperatorAssociativity,
|
|
184138
184316
|
getOperatorPrecedence,
|
|
184139
184317
|
getOptionFromName,
|
|
184318
|
+
getOptionsForLibraryResolution,
|
|
184140
184319
|
getOptionsNameMap,
|
|
184141
184320
|
getOrCreateEmitNode,
|
|
184142
184321
|
getOrCreateExternalHelpersModuleNameIfNeeded,
|
|
@@ -185248,6 +185427,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
185248
185427
|
resolutionExtensionIsTSOrJson,
|
|
185249
185428
|
resolveConfigFileProjectName,
|
|
185250
185429
|
resolveJSModule,
|
|
185430
|
+
resolveLibrary,
|
|
185251
185431
|
resolveModuleName,
|
|
185252
185432
|
resolveModuleNameFromCache,
|
|
185253
185433
|
resolvePackageNameToPackageJson,
|