@typescript-deploys/pr-build 5.1.0-pr-53903-8 → 5.1.0-pr-53943-7
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 +234 -54
- package/lib/tsserver.js +266 -63
- package/lib/tsserverlibrary.d.ts +26 -2
- package/lib/tsserverlibrary.js +264 -64
- package/lib/typescript.d.ts +13 -2
- package/lib/typescript.js +254 -63
- package/lib/typingsInstaller.js +3 -1
- package/package.json +5 -3
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.1";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20230420`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -32360,7 +32360,9 @@ var Parser;
|
|
|
32360
32360
|
const usedBrace = parseOptional(19 /* OpenBraceToken */);
|
|
32361
32361
|
const pos = getNodePos();
|
|
32362
32362
|
const expression = parsePropertyAccessEntityNameExpression();
|
|
32363
|
+
scanner.setInJSDocType(true);
|
|
32363
32364
|
const typeArguments = tryParseTypeArguments();
|
|
32365
|
+
scanner.setInJSDocType(false);
|
|
32364
32366
|
const node = factory2.createExpressionWithTypeArguments(expression, typeArguments);
|
|
32365
32367
|
const res = finishNode(node, pos);
|
|
32366
32368
|
if (usedBrace) {
|
|
@@ -37140,13 +37142,12 @@ function createModuleOrTypeReferenceResolutionCache(currentDirectory, getCanonic
|
|
|
37140
37142
|
nonRelativeNameResolutionCache.update(options2);
|
|
37141
37143
|
}
|
|
37142
37144
|
}
|
|
37143
|
-
function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options) {
|
|
37145
|
+
function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache) {
|
|
37144
37146
|
const result = createModuleOrTypeReferenceResolutionCache(
|
|
37145
37147
|
currentDirectory,
|
|
37146
37148
|
getCanonicalFileName,
|
|
37147
37149
|
options,
|
|
37148
|
-
|
|
37149
|
-
void 0,
|
|
37150
|
+
packageJsonInfoCache,
|
|
37150
37151
|
getOriginalOrResolvedModuleFileName
|
|
37151
37152
|
);
|
|
37152
37153
|
result.getOrCreateCacheForModuleName = (nonRelativeName, mode, redirectedReference) => result.getOrCreateCacheForNonRelativeName(nonRelativeName, mode, redirectedReference);
|
|
@@ -37161,6 +37162,12 @@ function createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanoni
|
|
|
37161
37162
|
getOriginalOrResolvedTypeReferenceFileName
|
|
37162
37163
|
);
|
|
37163
37164
|
}
|
|
37165
|
+
function getOptionsForLibraryResolution(options) {
|
|
37166
|
+
return { moduleResolution: 2 /* Node10 */, traceResolution: options.traceResolution };
|
|
37167
|
+
}
|
|
37168
|
+
function resolveLibrary(libraryName, resolveFrom, compilerOptions, host, cache) {
|
|
37169
|
+
return resolveModuleName(libraryName, resolveFrom, getOptionsForLibraryResolution(compilerOptions), host, cache);
|
|
37170
|
+
}
|
|
37164
37171
|
function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
37165
37172
|
var _a, _b, _c;
|
|
37166
37173
|
const traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
@@ -66937,7 +66944,6 @@ function createTypeChecker(host) {
|
|
|
66937
66944
|
case 9 /* NumericLiteral */:
|
|
66938
66945
|
case 10 /* BigIntLiteral */:
|
|
66939
66946
|
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
66940
|
-
case 227 /* TemplateExpression */:
|
|
66941
66947
|
case 112 /* TrueKeyword */:
|
|
66942
66948
|
case 97 /* FalseKeyword */:
|
|
66943
66949
|
case 106 /* NullKeyword */:
|
|
@@ -67224,18 +67230,10 @@ function createTypeChecker(host) {
|
|
|
67224
67230
|
function getJsxManagedAttributesFromLocatedAttributes(context, ns, attributesType) {
|
|
67225
67231
|
const managedSym = getJsxLibraryManagedAttributes(ns);
|
|
67226
67232
|
if (managedSym) {
|
|
67227
|
-
const declaredManagedType = getDeclaredTypeOfSymbol(managedSym);
|
|
67228
67233
|
const ctorType = getStaticTypeOfReferencedJsxConstructor(context);
|
|
67229
|
-
|
|
67230
|
-
|
|
67231
|
-
|
|
67232
|
-
const args = fillMissingTypeArguments([ctorType, attributesType], params, 2, isInJSFile(context));
|
|
67233
|
-
return getTypeAliasInstantiation(managedSym, args);
|
|
67234
|
-
}
|
|
67235
|
-
}
|
|
67236
|
-
if (length(declaredManagedType.typeParameters) >= 2) {
|
|
67237
|
-
const args = fillMissingTypeArguments([ctorType, attributesType], declaredManagedType.typeParameters, 2, isInJSFile(context));
|
|
67238
|
-
return createTypeReference(declaredManagedType, args);
|
|
67234
|
+
const result = instantiateAliasOrInterfaceWithDefaults(managedSym, isInJSFile(context), ctorType, attributesType);
|
|
67235
|
+
if (result) {
|
|
67236
|
+
return result;
|
|
67239
67237
|
}
|
|
67240
67238
|
}
|
|
67241
67239
|
return attributesType;
|
|
@@ -68122,6 +68120,9 @@ function createTypeChecker(host) {
|
|
|
68122
68120
|
function getJsxLibraryManagedAttributes(jsxNamespace) {
|
|
68123
68121
|
return jsxNamespace && getSymbol(jsxNamespace.exports, JsxNames.LibraryManagedAttributes, 788968 /* Type */);
|
|
68124
68122
|
}
|
|
68123
|
+
function getJsxElementTypeSymbol(jsxNamespace) {
|
|
68124
|
+
return jsxNamespace && getSymbol(jsxNamespace.exports, JsxNames.ElementType, 788968 /* Type */);
|
|
68125
|
+
}
|
|
68125
68126
|
function getJsxElementPropertiesName(jsxNamespace) {
|
|
68126
68127
|
return getNameFromJsxElementAttributesContainer(JsxNames.ElementAttributesPropertyNameContainer, jsxNamespace);
|
|
68127
68128
|
}
|
|
@@ -68228,11 +68229,32 @@ function createTypeChecker(host) {
|
|
|
68228
68229
|
}
|
|
68229
68230
|
}
|
|
68230
68231
|
function getJsxElementTypeTypeAt(location) {
|
|
68231
|
-
const
|
|
68232
|
-
if (
|
|
68232
|
+
const ns = getJsxNamespaceAt(location);
|
|
68233
|
+
if (!ns)
|
|
68234
|
+
return void 0;
|
|
68235
|
+
const sym = getJsxElementTypeSymbol(ns);
|
|
68236
|
+
if (!sym)
|
|
68237
|
+
return void 0;
|
|
68238
|
+
const type = instantiateAliasOrInterfaceWithDefaults(sym, isInJSFile(location));
|
|
68239
|
+
if (!type || isErrorType(type))
|
|
68233
68240
|
return void 0;
|
|
68234
68241
|
return type;
|
|
68235
68242
|
}
|
|
68243
|
+
function instantiateAliasOrInterfaceWithDefaults(managedSym, inJs, ...typeArguments) {
|
|
68244
|
+
const declaredManagedType = getDeclaredTypeOfSymbol(managedSym);
|
|
68245
|
+
if (managedSym.flags & 524288 /* TypeAlias */) {
|
|
68246
|
+
const params = getSymbolLinks(managedSym).typeParameters;
|
|
68247
|
+
if (length(params) >= typeArguments.length) {
|
|
68248
|
+
const args = fillMissingTypeArguments(typeArguments, params, typeArguments.length, inJs);
|
|
68249
|
+
return length(args) === 0 ? declaredManagedType : getTypeAliasInstantiation(managedSym, args);
|
|
68250
|
+
}
|
|
68251
|
+
}
|
|
68252
|
+
if (length(declaredManagedType.typeParameters) >= typeArguments.length) {
|
|
68253
|
+
const args = fillMissingTypeArguments(typeArguments, declaredManagedType.typeParameters, typeArguments.length, inJs);
|
|
68254
|
+
return createTypeReference(declaredManagedType, args);
|
|
68255
|
+
}
|
|
68256
|
+
return void 0;
|
|
68257
|
+
}
|
|
68236
68258
|
function getJsxIntrinsicTagNamesAt(location) {
|
|
68237
68259
|
const intrinsics = getJsxType(JsxNames.IntrinsicElements, location);
|
|
68238
68260
|
return intrinsics ? getPropertiesOfType(intrinsics) : emptyArray;
|
|
@@ -113128,6 +113150,25 @@ function forEachProjectReference(projectReferences, resolvedProjectReferences, c
|
|
|
113128
113150
|
}
|
|
113129
113151
|
}
|
|
113130
113152
|
var inferredTypesContainingFile = "__inferred type names__.ts";
|
|
113153
|
+
function getInferredLibraryNameResolveFrom(options, currentDirectory, libFileName) {
|
|
113154
|
+
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : currentDirectory;
|
|
113155
|
+
return combinePaths(containingDirectory, `__lib_node_modules_lookup_${libFileName}__.ts`);
|
|
113156
|
+
}
|
|
113157
|
+
function getLibraryNameFromLibFileName(libFileName) {
|
|
113158
|
+
const components = libFileName.split(".");
|
|
113159
|
+
let path = components[1];
|
|
113160
|
+
let i = 2;
|
|
113161
|
+
while (components[i] && components[i] !== "d") {
|
|
113162
|
+
path += (i === 2 ? "/" : "-") + components[i];
|
|
113163
|
+
i++;
|
|
113164
|
+
}
|
|
113165
|
+
return "@typescript/lib-" + path;
|
|
113166
|
+
}
|
|
113167
|
+
function getLibFileNameFromLibReference(libReference) {
|
|
113168
|
+
const libName = toFileNameLowerCase(libReference.fileName);
|
|
113169
|
+
const libFileName = libMap.get(libName);
|
|
113170
|
+
return { libName, libFileName };
|
|
113171
|
+
}
|
|
113131
113172
|
function isReferencedFile(reason) {
|
|
113132
113173
|
switch (reason == null ? void 0 : reason.kind) {
|
|
113133
113174
|
case 3 /* Import */:
|
|
@@ -113171,7 +113212,7 @@ function getReferencedFileLocation(getSourceFileByPath, ref) {
|
|
|
113171
113212
|
}
|
|
113172
113213
|
return { file, pos, end, packageId };
|
|
113173
113214
|
}
|
|
113174
|
-
function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) {
|
|
113215
|
+
function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolutions, hasInvalidatedLibResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) {
|
|
113175
113216
|
if (!program || (hasChangedAutomaticTypeDirectiveNames == null ? void 0 : hasChangedAutomaticTypeDirectiveNames()))
|
|
113176
113217
|
return false;
|
|
113177
113218
|
if (!arrayIsEqualTo(program.getRootFileNames(), rootFileNames))
|
|
@@ -113186,6 +113227,8 @@ function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion,
|
|
|
113186
113227
|
const currentOptions = program.getCompilerOptions();
|
|
113187
113228
|
if (!compareDataObjects(currentOptions, newOptions))
|
|
113188
113229
|
return false;
|
|
113230
|
+
if (program.resolvedLibReferences && forEachEntry(program.resolvedLibReferences, (_value, libFileName) => hasInvalidatedLibResolutions(libFileName)))
|
|
113231
|
+
return false;
|
|
113189
113232
|
if (currentOptions.configFile && newOptions.configFile)
|
|
113190
113233
|
return currentOptions.configFile.text === newOptions.configFile.text;
|
|
113191
113234
|
return true;
|
|
@@ -113368,6 +113411,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
113368
113411
|
let fileProcessingDiagnostics;
|
|
113369
113412
|
let automaticTypeDirectiveNames;
|
|
113370
113413
|
let automaticTypeDirectiveResolutions;
|
|
113414
|
+
let resolvedLibReferences;
|
|
113415
|
+
let resolvedLibProcessing;
|
|
113371
113416
|
const maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0;
|
|
113372
113417
|
let currentNodeModulesDepth = 0;
|
|
113373
113418
|
const modulesWithElidedImports = /* @__PURE__ */ new Map();
|
|
@@ -113455,6 +113500,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
113455
113500
|
createTypeReferenceResolutionLoader
|
|
113456
113501
|
);
|
|
113457
113502
|
}
|
|
113503
|
+
const hasInvalidatedLibResolutions = host.hasInvalidatedLibResolutions || returnFalse;
|
|
113504
|
+
let actualResolveLibrary;
|
|
113505
|
+
if (host.resolveLibrary) {
|
|
113506
|
+
actualResolveLibrary = host.resolveLibrary.bind(host);
|
|
113507
|
+
} else {
|
|
113508
|
+
const libraryResolutionCache = createModuleResolutionCache(currentDirectory, getCanonicalFileName, options, moduleResolutionCache == null ? void 0 : moduleResolutionCache.getPackageJsonInfoCache());
|
|
113509
|
+
actualResolveLibrary = (libraryName, resolveFrom, options2) => resolveLibrary(libraryName, resolveFrom, options2, host, libraryResolutionCache);
|
|
113510
|
+
}
|
|
113458
113511
|
const packageIdToSourceFile = /* @__PURE__ */ new Map();
|
|
113459
113512
|
let sourceFileToPackageName = /* @__PURE__ */ new Map();
|
|
113460
113513
|
let redirectTargetsMap = createMultiMap();
|
|
@@ -113621,6 +113674,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
113621
113674
|
);
|
|
113622
113675
|
}
|
|
113623
113676
|
oldProgram = void 0;
|
|
113677
|
+
resolvedLibProcessing = void 0;
|
|
113624
113678
|
const program = {
|
|
113625
113679
|
getRootFileNames: () => rootNames,
|
|
113626
113680
|
getSourceFile,
|
|
@@ -113662,6 +113716,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
113662
113716
|
sourceFileToPackageName,
|
|
113663
113717
|
redirectTargetsMap,
|
|
113664
113718
|
usesUriStyleNodeCoreModules,
|
|
113719
|
+
resolvedLibReferences,
|
|
113665
113720
|
isEmittedFile,
|
|
113666
113721
|
getConfigFileParsingDiagnostics: getConfigFileParsingDiagnostics2,
|
|
113667
113722
|
getProjectReferences,
|
|
@@ -114150,6 +114205,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
114150
114205
|
if (changesAffectingProgramStructure(oldOptions, options)) {
|
|
114151
114206
|
return 1 /* SafeModules */;
|
|
114152
114207
|
}
|
|
114208
|
+
if (oldProgram.resolvedLibReferences && forEachEntry(oldProgram.resolvedLibReferences, (resolution, libFileName) => pathForLibFileWorker(libFileName).actual !== resolution.actual)) {
|
|
114209
|
+
return 1 /* SafeModules */;
|
|
114210
|
+
}
|
|
114153
114211
|
if (host.hasChangedAutomaticTypeDirectiveNames) {
|
|
114154
114212
|
if (host.hasChangedAutomaticTypeDirectiveNames())
|
|
114155
114213
|
return 1 /* SafeModules */;
|
|
@@ -114186,6 +114244,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
114186
114244
|
sourceFileToPackageName = oldProgram.sourceFileToPackageName;
|
|
114187
114245
|
redirectTargetsMap = oldProgram.redirectTargetsMap;
|
|
114188
114246
|
usesUriStyleNodeCoreModules = oldProgram.usesUriStyleNodeCoreModules;
|
|
114247
|
+
resolvedLibReferences = oldProgram.resolvedLibReferences;
|
|
114189
114248
|
return 2 /* Completely */;
|
|
114190
114249
|
}
|
|
114191
114250
|
function getEmitHost(writeFileCallback) {
|
|
@@ -114295,7 +114354,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
114295
114354
|
if (!options.lib) {
|
|
114296
114355
|
return equalityComparer(file.fileName, getDefaultLibraryFileName());
|
|
114297
114356
|
} else {
|
|
114298
|
-
return some(options.lib, (libFileName) => equalityComparer(file.fileName,
|
|
114357
|
+
return some(options.lib, (libFileName) => equalityComparer(file.fileName, resolvedLibReferences.get(libFileName).actual));
|
|
114299
114358
|
}
|
|
114300
114359
|
}
|
|
114301
114360
|
function getTypeChecker() {
|
|
@@ -114886,11 +114945,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
114886
114945
|
}
|
|
114887
114946
|
}
|
|
114888
114947
|
function getLibFileFromReference(ref) {
|
|
114889
|
-
|
|
114890
|
-
const libFileName =
|
|
114891
|
-
|
|
114892
|
-
|
|
114893
|
-
}
|
|
114948
|
+
var _a2;
|
|
114949
|
+
const { libFileName } = getLibFileNameFromLibReference(ref);
|
|
114950
|
+
const actualFileName = libFileName && ((_a2 = resolvedLibReferences == null ? void 0 : resolvedLibReferences.get(libFileName)) == null ? void 0 : _a2.actual);
|
|
114951
|
+
return actualFileName !== void 0 ? getSourceFile(actualFileName) : void 0;
|
|
114894
114952
|
}
|
|
114895
114953
|
function getSourceFileFromReference(referencingFile, ref) {
|
|
114896
114954
|
return getSourceFileFromReferenceWorker(resolveTripleslashReference(ref.fileName, referencingFile.fileName), getSourceFile);
|
|
@@ -115315,25 +115373,55 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115315
115373
|
}
|
|
115316
115374
|
}
|
|
115317
115375
|
function pathForLibFile(libFileName) {
|
|
115318
|
-
const
|
|
115319
|
-
|
|
115320
|
-
|
|
115321
|
-
|
|
115322
|
-
|
|
115323
|
-
|
|
115324
|
-
|
|
115325
|
-
|
|
115326
|
-
|
|
115327
|
-
const
|
|
115328
|
-
if (
|
|
115329
|
-
return
|
|
115330
|
-
|
|
115331
|
-
|
|
115376
|
+
const existing = resolvedLibReferences == null ? void 0 : resolvedLibReferences.get(libFileName);
|
|
115377
|
+
if (existing)
|
|
115378
|
+
return existing.actual;
|
|
115379
|
+
const result = pathForLibFileWorker(libFileName);
|
|
115380
|
+
(resolvedLibReferences ?? (resolvedLibReferences = /* @__PURE__ */ new Map())).set(libFileName, result);
|
|
115381
|
+
return result.actual;
|
|
115382
|
+
}
|
|
115383
|
+
function pathForLibFileWorker(libFileName) {
|
|
115384
|
+
var _a2, _b2, _c2, _d2, _e2;
|
|
115385
|
+
const existing = resolvedLibProcessing == null ? void 0 : resolvedLibProcessing.get(libFileName);
|
|
115386
|
+
if (existing)
|
|
115387
|
+
return existing;
|
|
115388
|
+
if (structureIsReused !== 0 /* Not */ && oldProgram && !hasInvalidatedLibResolutions(libFileName)) {
|
|
115389
|
+
const oldResolution = (_a2 = oldProgram.resolvedLibReferences) == null ? void 0 : _a2.get(libFileName);
|
|
115390
|
+
if (oldResolution) {
|
|
115391
|
+
if (oldResolution.resolution && isTraceEnabled(options, host)) {
|
|
115392
|
+
const libraryName2 = getLibraryNameFromLibFileName(libFileName);
|
|
115393
|
+
const resolveFrom2 = getInferredLibraryNameResolveFrom(options, currentDirectory, libFileName);
|
|
115394
|
+
trace(
|
|
115395
|
+
host,
|
|
115396
|
+
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,
|
|
115397
|
+
libraryName2,
|
|
115398
|
+
getNormalizedAbsolutePath(resolveFrom2, currentDirectory),
|
|
115399
|
+
(_b2 = oldResolution.resolution.resolvedModule) == null ? void 0 : _b2.resolvedFileName,
|
|
115400
|
+
((_c2 = oldResolution.resolution.resolvedModule) == null ? void 0 : _c2.packageId) && packageIdToString(oldResolution.resolution.resolvedModule.packageId)
|
|
115401
|
+
);
|
|
115402
|
+
}
|
|
115403
|
+
(resolvedLibProcessing ?? (resolvedLibProcessing = /* @__PURE__ */ new Map())).set(libFileName, oldResolution);
|
|
115404
|
+
return oldResolution;
|
|
115405
|
+
}
|
|
115406
|
+
}
|
|
115407
|
+
const libraryName = getLibraryNameFromLibFileName(libFileName);
|
|
115408
|
+
const resolveFrom = getInferredLibraryNameResolveFrom(options, currentDirectory, libFileName);
|
|
115409
|
+
(_d2 = tracing) == null ? void 0 : _d2.push(tracing.Phase.Program, "resolveLibrary", { resolveFrom });
|
|
115410
|
+
mark("beforeResolveLibrary");
|
|
115411
|
+
const resolution = actualResolveLibrary(libraryName, resolveFrom, options, libFileName);
|
|
115412
|
+
mark("afterResolveLibrary");
|
|
115413
|
+
measure("ResolveLibrary", "beforeResolveLibrary", "afterResolveLibrary");
|
|
115414
|
+
(_e2 = tracing) == null ? void 0 : _e2.pop();
|
|
115415
|
+
const result = {
|
|
115416
|
+
resolution,
|
|
115417
|
+
actual: resolution.resolvedModule ? resolution.resolvedModule.resolvedFileName : combinePaths(defaultLibraryPath, libFileName)
|
|
115418
|
+
};
|
|
115419
|
+
(resolvedLibProcessing ?? (resolvedLibProcessing = /* @__PURE__ */ new Map())).set(libFileName, result);
|
|
115420
|
+
return result;
|
|
115332
115421
|
}
|
|
115333
115422
|
function processLibReferenceDirectives(file) {
|
|
115334
115423
|
forEach(file.libReferenceDirectives, (libReference, index) => {
|
|
115335
|
-
const libName =
|
|
115336
|
-
const libFileName = libMap.get(libName);
|
|
115424
|
+
const { libName, libFileName } = getLibFileNameFromLibReference(libReference);
|
|
115337
115425
|
if (libFileName) {
|
|
115338
115426
|
processRootFile(
|
|
115339
115427
|
pathForLibFile(libFileName),
|
|
@@ -118300,7 +118388,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118300
118388
|
let failedLookupChecks;
|
|
118301
118389
|
let startsWithPathChecks;
|
|
118302
118390
|
let isInDirectoryChecks;
|
|
118303
|
-
let
|
|
118391
|
+
let allModuleAndTypeResolutionsAreInvalidated = false;
|
|
118304
118392
|
const getCurrentDirectory = memoize(() => resolutionHost.getCurrentDirectory());
|
|
118305
118393
|
const cachedDirectoryStructureHost = resolutionHost.getCachedDirectoryStructureHost();
|
|
118306
118394
|
const resolvedModuleNames = /* @__PURE__ */ new Map();
|
|
@@ -118316,6 +118404,13 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118316
118404
|
resolutionHost.getCompilationSettings(),
|
|
118317
118405
|
moduleResolutionCache.getPackageJsonInfoCache()
|
|
118318
118406
|
);
|
|
118407
|
+
const resolvedLibraries = /* @__PURE__ */ new Map();
|
|
118408
|
+
const libraryResolutionCache = createModuleResolutionCache(
|
|
118409
|
+
getCurrentDirectory(),
|
|
118410
|
+
resolutionHost.getCanonicalFileName,
|
|
118411
|
+
getOptionsForLibraryResolution(resolutionHost.getCompilationSettings()),
|
|
118412
|
+
moduleResolutionCache.getPackageJsonInfoCache()
|
|
118413
|
+
);
|
|
118319
118414
|
const directoryWatchesOfFailedLookups = /* @__PURE__ */ new Map();
|
|
118320
118415
|
const fileWatchesOfAffectingLocations = /* @__PURE__ */ new Map();
|
|
118321
118416
|
const rootDir = getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirectory);
|
|
@@ -118332,6 +118427,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118332
118427
|
finishCachingPerDirectoryResolution,
|
|
118333
118428
|
resolveModuleNameLiterals,
|
|
118334
118429
|
resolveTypeReferenceDirectiveReferences,
|
|
118430
|
+
resolveLibrary: resolveLibrary2,
|
|
118335
118431
|
resolveSingleModuleNameWithoutWatching,
|
|
118336
118432
|
removeResolutionsFromProjectReferenceRedirects,
|
|
118337
118433
|
removeResolutionsOfFile,
|
|
@@ -118367,16 +118463,18 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118367
118463
|
isInDirectoryChecks = void 0;
|
|
118368
118464
|
affectingPathChecks = void 0;
|
|
118369
118465
|
affectingPathChecksForFile = void 0;
|
|
118370
|
-
|
|
118466
|
+
allModuleAndTypeResolutionsAreInvalidated = false;
|
|
118371
118467
|
moduleResolutionCache.clear();
|
|
118372
118468
|
typeReferenceDirectiveResolutionCache.clear();
|
|
118373
118469
|
moduleResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
118374
118470
|
typeReferenceDirectiveResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
118471
|
+
libraryResolutionCache.clear();
|
|
118375
118472
|
impliedFormatPackageJsons.clear();
|
|
118473
|
+
resolvedLibraries.clear();
|
|
118376
118474
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
118377
118475
|
}
|
|
118378
118476
|
function onChangesAffectModuleResolution() {
|
|
118379
|
-
|
|
118477
|
+
allModuleAndTypeResolutionsAreInvalidated = true;
|
|
118380
118478
|
moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
118381
118479
|
typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
118382
118480
|
moduleResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
@@ -118397,24 +118495,45 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118397
118495
|
const value = filesWithInvalidatedNonRelativeUnresolvedImports.get(path);
|
|
118398
118496
|
return !!value && !!value.length;
|
|
118399
118497
|
}
|
|
118400
|
-
function createHasInvalidatedResolutions(customHasInvalidatedResolutions) {
|
|
118498
|
+
function createHasInvalidatedResolutions(customHasInvalidatedResolutions, customHasInvalidatedLibResolutions) {
|
|
118401
118499
|
invalidateResolutionsOfFailedLookupLocations();
|
|
118402
118500
|
const collected = filesWithInvalidatedResolutions;
|
|
118403
118501
|
filesWithInvalidatedResolutions = void 0;
|
|
118404
|
-
return
|
|
118502
|
+
return {
|
|
118503
|
+
hasInvalidatedResolutions: (path) => customHasInvalidatedResolutions(path) || allModuleAndTypeResolutionsAreInvalidated || !!(collected == null ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path),
|
|
118504
|
+
hasInvalidatedLibResolutions: (libFileName) => {
|
|
118505
|
+
var _a;
|
|
118506
|
+
return customHasInvalidatedLibResolutions(libFileName) || !!((_a = resolvedLibraries == null ? void 0 : resolvedLibraries.get(libFileName)) == null ? void 0 : _a.isInvalidated);
|
|
118507
|
+
}
|
|
118508
|
+
};
|
|
118405
118509
|
}
|
|
118406
118510
|
function startCachingPerDirectoryResolution() {
|
|
118407
118511
|
moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
118408
118512
|
typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
118513
|
+
libraryResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
118409
118514
|
nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
|
|
118410
118515
|
nonRelativeExternalModuleResolutions.clear();
|
|
118411
118516
|
}
|
|
118517
|
+
function cleanupLibResolutionWatching(newProgram) {
|
|
118518
|
+
resolvedLibraries.forEach((resolution, libFileName) => {
|
|
118519
|
+
var _a;
|
|
118520
|
+
if (!((_a = newProgram == null ? void 0 : newProgram.resolvedLibReferences) == null ? void 0 : _a.has(libFileName))) {
|
|
118521
|
+
stopWatchFailedLookupLocationOfResolution(
|
|
118522
|
+
resolution,
|
|
118523
|
+
resolutionHost.toPath(getInferredLibraryNameResolveFrom(newProgram.getCompilerOptions(), getCurrentDirectory(), libFileName)),
|
|
118524
|
+
getResolvedModule2
|
|
118525
|
+
);
|
|
118526
|
+
resolvedLibraries.delete(libFileName);
|
|
118527
|
+
}
|
|
118528
|
+
});
|
|
118529
|
+
}
|
|
118412
118530
|
function finishCachingPerDirectoryResolution(newProgram, oldProgram) {
|
|
118413
118531
|
filesWithInvalidatedNonRelativeUnresolvedImports = void 0;
|
|
118414
|
-
|
|
118532
|
+
allModuleAndTypeResolutionsAreInvalidated = false;
|
|
118415
118533
|
nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
|
|
118416
118534
|
nonRelativeExternalModuleResolutions.clear();
|
|
118417
118535
|
if (newProgram !== oldProgram) {
|
|
118536
|
+
cleanupLibResolutionWatching(newProgram);
|
|
118418
118537
|
newProgram == null ? void 0 : newProgram.getSourceFiles().forEach((newFile) => {
|
|
118419
118538
|
var _a;
|
|
118420
118539
|
const expected = isExternalOrCommonJsModule(newFile) ? ((_a = newFile.packageJsonLocations) == null ? void 0 : _a.length) ?? 0 : 0;
|
|
@@ -118523,7 +118642,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118523
118642
|
const name = loader.nameAndMode.getName(entry);
|
|
118524
118643
|
const mode = loader.nameAndMode.getMode(entry, containingSourceFile);
|
|
118525
118644
|
let resolution = resolutionsInFile.get(name, mode);
|
|
118526
|
-
if (!seenNamesInFile.has(name, mode) && (
|
|
118645
|
+
if (!seenNamesInFile.has(name, mode) && (allModuleAndTypeResolutionsAreInvalidated || unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate
|
|
118527
118646
|
hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution))) {
|
|
118528
118647
|
const existingResolution = resolution;
|
|
118529
118648
|
resolution = loader.resolve(name, mode);
|
|
@@ -118632,6 +118751,41 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118632
118751
|
// Defer non relative resolution watch because we could be using ambient modules
|
|
118633
118752
|
});
|
|
118634
118753
|
}
|
|
118754
|
+
function resolveLibrary2(libraryName, resolveFrom, options, libFileName) {
|
|
118755
|
+
var _a;
|
|
118756
|
+
const host = ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost;
|
|
118757
|
+
let resolution = resolvedLibraries == null ? void 0 : resolvedLibraries.get(libFileName);
|
|
118758
|
+
if (!resolution || resolution.isInvalidated) {
|
|
118759
|
+
const existingResolution = resolution;
|
|
118760
|
+
resolution = resolveLibrary(libraryName, resolveFrom, options, host, libraryResolutionCache);
|
|
118761
|
+
const path = resolutionHost.toPath(resolveFrom);
|
|
118762
|
+
watchFailedLookupLocationsOfExternalModuleResolutions(
|
|
118763
|
+
libraryName,
|
|
118764
|
+
resolution,
|
|
118765
|
+
path,
|
|
118766
|
+
getResolvedModule2,
|
|
118767
|
+
/*deferWatchingNonRelativeResolution*/
|
|
118768
|
+
false
|
|
118769
|
+
);
|
|
118770
|
+
resolvedLibraries.set(libFileName, resolution);
|
|
118771
|
+
if (existingResolution) {
|
|
118772
|
+
stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolvedModule2);
|
|
118773
|
+
}
|
|
118774
|
+
} else {
|
|
118775
|
+
if (isTraceEnabled(options, host)) {
|
|
118776
|
+
const resolved = getResolvedModule2(resolution);
|
|
118777
|
+
trace(
|
|
118778
|
+
host,
|
|
118779
|
+
(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,
|
|
118780
|
+
libraryName,
|
|
118781
|
+
resolveFrom,
|
|
118782
|
+
resolved == null ? void 0 : resolved.resolvedFileName,
|
|
118783
|
+
(resolved == null ? void 0 : resolved.packageId) && packageIdToString(resolved.packageId)
|
|
118784
|
+
);
|
|
118785
|
+
}
|
|
118786
|
+
}
|
|
118787
|
+
return resolution;
|
|
118788
|
+
}
|
|
118635
118789
|
function resolveSingleModuleNameWithoutWatching(moduleName, containingFile) {
|
|
118636
118790
|
const path = resolutionHost.toPath(containingFile);
|
|
118637
118791
|
const resolutionsInFile = resolvedModuleNames.get(path);
|
|
@@ -118954,9 +119108,12 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118954
119108
|
}
|
|
118955
119109
|
function invalidateResolutionsOfFailedLookupLocations() {
|
|
118956
119110
|
var _a;
|
|
118957
|
-
if (
|
|
119111
|
+
if (allModuleAndTypeResolutionsAreInvalidated) {
|
|
118958
119112
|
affectingPathChecksForFile = void 0;
|
|
118959
119113
|
invalidatePackageJsonMap();
|
|
119114
|
+
if (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks || affectingPathChecks) {
|
|
119115
|
+
invalidateResolutions(resolvedLibraries, canInvalidateFailedLookupResolution);
|
|
119116
|
+
}
|
|
118960
119117
|
failedLookupChecks = void 0;
|
|
118961
119118
|
startsWithPathChecks = void 0;
|
|
118962
119119
|
isInDirectoryChecks = void 0;
|
|
@@ -119833,9 +119990,11 @@ function createWatchProgram(host) {
|
|
|
119833
119990
|
if (!compilerHost.resolveTypeReferenceDirectiveReferences && !compilerHost.resolveTypeReferenceDirectives) {
|
|
119834
119991
|
compilerHost.resolveTypeReferenceDirectiveReferences = resolutionCache.resolveTypeReferenceDirectiveReferences.bind(resolutionCache);
|
|
119835
119992
|
}
|
|
119993
|
+
compilerHost.resolveLibrary = !host.resolveLibrary ? resolutionCache.resolveLibrary.bind(resolutionCache) : host.resolveLibrary.bind(host);
|
|
119836
119994
|
compilerHost.getModuleResolutionCache = host.resolveModuleNameLiterals || host.resolveModuleNames ? maybeBind(host, host.getModuleResolutionCache) : () => resolutionCache.getModuleResolutionCache();
|
|
119837
119995
|
const userProvidedResolution = !!host.resolveModuleNameLiterals || !!host.resolveTypeReferenceDirectiveReferences || !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives;
|
|
119838
119996
|
const customHasInvalidatedResolutions = userProvidedResolution ? maybeBind(host, host.hasInvalidatedResolutions) || returnTrue : returnFalse;
|
|
119997
|
+
const customHasInvalidLibResolutions = host.resolveLibrary ? maybeBind(host, host.hasInvalidatedLibResolutions) || returnTrue : returnFalse;
|
|
119839
119998
|
builderProgram = readBuilderProgram(compilerOptions, compilerHost);
|
|
119840
119999
|
synchronizeProgram();
|
|
119841
120000
|
watchConfigFileWildCardDirectories();
|
|
@@ -119900,7 +120059,7 @@ function createWatchProgram(host) {
|
|
|
119900
120059
|
resolutionCache.onChangesAffectModuleResolution();
|
|
119901
120060
|
}
|
|
119902
120061
|
}
|
|
119903
|
-
const hasInvalidatedResolutions = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions);
|
|
120062
|
+
const { hasInvalidatedResolutions, hasInvalidatedLibResolutions } = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions, customHasInvalidLibResolutions);
|
|
119904
120063
|
const {
|
|
119905
120064
|
originalReadFile,
|
|
119906
120065
|
originalFileExists,
|
|
@@ -119909,7 +120068,7 @@ function createWatchProgram(host) {
|
|
|
119909
120068
|
originalWriteFile,
|
|
119910
120069
|
readFileWithCache
|
|
119911
120070
|
} = changeCompilerHostLikeToUseCache(compilerHost, toPath3);
|
|
119912
|
-
if (isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, (path) => getSourceVersion(path, readFileWithCache), (fileName) => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
120071
|
+
if (isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, (path) => getSourceVersion(path, readFileWithCache), (fileName) => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasInvalidatedLibResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
119913
120072
|
if (hasChangedConfigFileParsingErrors) {
|
|
119914
120073
|
if (reportFileChangeDetectedOnCreateProgram) {
|
|
119915
120074
|
reportWatchDiagnostic(Diagnostics.File_change_detected_Starting_incremental_compilation);
|
|
@@ -119930,7 +120089,7 @@ function createWatchProgram(host) {
|
|
|
119930
120089
|
if (reportFileChangeDetectedOnCreateProgram) {
|
|
119931
120090
|
reportWatchDiagnostic(Diagnostics.File_change_detected_Starting_incremental_compilation);
|
|
119932
120091
|
}
|
|
119933
|
-
createNewProgram(hasInvalidatedResolutions);
|
|
120092
|
+
createNewProgram(hasInvalidatedResolutions, hasInvalidatedLibResolutions);
|
|
119934
120093
|
}
|
|
119935
120094
|
reportFileChangeDetectedOnCreateProgram = false;
|
|
119936
120095
|
if (host.afterProgramCreate && program !== builderProgram) {
|
|
@@ -119943,7 +120102,7 @@ function createWatchProgram(host) {
|
|
|
119943
120102
|
compilerHost.writeFile = originalWriteFile;
|
|
119944
120103
|
return builderProgram;
|
|
119945
120104
|
}
|
|
119946
|
-
function createNewProgram(hasInvalidatedResolutions) {
|
|
120105
|
+
function createNewProgram(hasInvalidatedResolutions, hasInvalidatedLibResolutions) {
|
|
119947
120106
|
writeLog("CreatingProgramWith::");
|
|
119948
120107
|
writeLog(` roots: ${JSON.stringify(rootFileNames)}`);
|
|
119949
120108
|
writeLog(` options: ${JSON.stringify(compilerOptions)}`);
|
|
@@ -119954,6 +120113,7 @@ function createWatchProgram(host) {
|
|
|
119954
120113
|
hasChangedConfigFileParsingErrors = false;
|
|
119955
120114
|
resolutionCache.startCachingPerDirectoryResolution();
|
|
119956
120115
|
compilerHost.hasInvalidatedResolutions = hasInvalidatedResolutions;
|
|
120116
|
+
compilerHost.hasInvalidatedLibResolutions = hasInvalidatedLibResolutions;
|
|
119957
120117
|
compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames;
|
|
119958
120118
|
const oldProgram = getCurrentProgram();
|
|
119959
120119
|
builderProgram = createProgram2(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
|
|
@@ -120506,6 +120666,7 @@ function createSolutionBuilderState(watch, hostOrHostWithWatch, rootNames, optio
|
|
|
120506
120666
|
compilerHost.getParsedCommandLine = (fileName) => parseConfigFile(state, fileName, toResolvedConfigFilePath(state, fileName));
|
|
120507
120667
|
compilerHost.resolveModuleNameLiterals = maybeBind(host, host.resolveModuleNameLiterals);
|
|
120508
120668
|
compilerHost.resolveTypeReferenceDirectiveReferences = maybeBind(host, host.resolveTypeReferenceDirectiveReferences);
|
|
120669
|
+
compilerHost.resolveLibrary = maybeBind(host, host.resolveLibrary);
|
|
120509
120670
|
compilerHost.resolveModuleNames = maybeBind(host, host.resolveModuleNames);
|
|
120510
120671
|
compilerHost.resolveTypeReferenceDirectives = maybeBind(host, host.resolveTypeReferenceDirectives);
|
|
120511
120672
|
compilerHost.getModuleResolutionCache = maybeBind(host, host.getModuleResolutionCache);
|
|
@@ -120543,6 +120704,23 @@ function createSolutionBuilderState(watch, hostOrHostWithWatch, rootNames, optio
|
|
|
120543
120704
|
createTypeReferenceResolutionLoader
|
|
120544
120705
|
);
|
|
120545
120706
|
}
|
|
120707
|
+
let libraryResolutionCache;
|
|
120708
|
+
if (!compilerHost.resolveLibrary) {
|
|
120709
|
+
libraryResolutionCache = createModuleResolutionCache(
|
|
120710
|
+
compilerHost.getCurrentDirectory(),
|
|
120711
|
+
compilerHost.getCanonicalFileName,
|
|
120712
|
+
/*options*/
|
|
120713
|
+
void 0,
|
|
120714
|
+
moduleResolutionCache == null ? void 0 : moduleResolutionCache.getPackageJsonInfoCache()
|
|
120715
|
+
);
|
|
120716
|
+
compilerHost.resolveLibrary = (libraryName, resolveFrom, options2) => resolveLibrary(
|
|
120717
|
+
libraryName,
|
|
120718
|
+
resolveFrom,
|
|
120719
|
+
options2,
|
|
120720
|
+
host,
|
|
120721
|
+
libraryResolutionCache
|
|
120722
|
+
);
|
|
120723
|
+
}
|
|
120546
120724
|
compilerHost.getBuildInfo = (fileName, configFilePath) => getBuildInfo3(
|
|
120547
120725
|
state,
|
|
120548
120726
|
fileName,
|
|
@@ -120574,6 +120752,7 @@ function createSolutionBuilderState(watch, hostOrHostWithWatch, rootNames, optio
|
|
|
120574
120752
|
compilerHost,
|
|
120575
120753
|
moduleResolutionCache,
|
|
120576
120754
|
typeReferenceDirectiveResolutionCache,
|
|
120755
|
+
libraryResolutionCache,
|
|
120577
120756
|
// Mutable state
|
|
120578
120757
|
buildOrder: void 0,
|
|
120579
120758
|
readFileWithCache: (f) => host.readFile(f),
|
|
@@ -120791,7 +120970,7 @@ function enableCache(state) {
|
|
|
120791
120970
|
function disableCache(state) {
|
|
120792
120971
|
if (!state.cache)
|
|
120793
120972
|
return;
|
|
120794
|
-
const { cache, host, compilerHost, extendedConfigCache, moduleResolutionCache, typeReferenceDirectiveResolutionCache } = state;
|
|
120973
|
+
const { cache, host, compilerHost, extendedConfigCache, moduleResolutionCache, typeReferenceDirectiveResolutionCache, libraryResolutionCache } = state;
|
|
120795
120974
|
host.readFile = cache.originalReadFile;
|
|
120796
120975
|
host.fileExists = cache.originalFileExists;
|
|
120797
120976
|
host.directoryExists = cache.originalDirectoryExists;
|
|
@@ -120802,6 +120981,7 @@ function disableCache(state) {
|
|
|
120802
120981
|
extendedConfigCache.clear();
|
|
120803
120982
|
moduleResolutionCache == null ? void 0 : moduleResolutionCache.clear();
|
|
120804
120983
|
typeReferenceDirectiveResolutionCache == null ? void 0 : typeReferenceDirectiveResolutionCache.clear();
|
|
120984
|
+
libraryResolutionCache == null ? void 0 : libraryResolutionCache.clear();
|
|
120805
120985
|
state.cache = void 0;
|
|
120806
120986
|
}
|
|
120807
120987
|
function clearProjectStatus(state, resolved) {
|