@typescript-deploys/pr-build 5.1.0-pr-53799-9 → 5.1.0-pr-53714-11
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 +80 -35
- package/lib/tsserver.js +88 -38
- package/lib/tsserverlibrary.d.ts +2 -2
- package/lib/tsserverlibrary.js +88 -38
- package/lib/typescript.js +80 -35
- package/lib/typingsInstaller.js +7 -7
- package/package.json +2 -2
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.20230418`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -16601,7 +16601,7 @@ function getScriptKindFromFileName(fileName) {
|
|
|
16601
16601
|
var supportedTSExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */], [".cts" /* Cts */, ".d.cts" /* Dcts */], [".mts" /* Mts */, ".d.mts" /* Dmts */]];
|
|
16602
16602
|
var supportedTSExtensionsFlat = flatten(supportedTSExtensions);
|
|
16603
16603
|
var supportedTSExtensionsWithJson = [...supportedTSExtensions, [".json" /* Json */]];
|
|
16604
|
-
var supportedTSExtensionsForExtractExtension = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */, ".cts" /* Cts */, ".mts" /* Mts */, ".ts" /* Ts */, ".tsx" /* Tsx
|
|
16604
|
+
var supportedTSExtensionsForExtractExtension = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */, ".cts" /* Cts */, ".mts" /* Mts */, ".ts" /* Ts */, ".tsx" /* Tsx */];
|
|
16605
16605
|
var supportedJSExtensions = [[".js" /* Js */, ".jsx" /* Jsx */], [".mjs" /* Mjs */], [".cjs" /* Cjs */]];
|
|
16606
16606
|
var supportedJSExtensionsFlat = flatten(supportedJSExtensions);
|
|
16607
16607
|
var allSupportedExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */, ".js" /* Js */, ".jsx" /* Jsx */], [".cts" /* Cts */, ".d.cts" /* Dcts */, ".cjs" /* Cjs */], [".mts" /* Mts */, ".d.mts" /* Dmts */, ".mjs" /* Mjs */]];
|
|
@@ -37633,22 +37633,22 @@ var nodeModulesPathPart = "/node_modules/";
|
|
|
37633
37633
|
function pathContainsNodeModules(path) {
|
|
37634
37634
|
return stringContains(path, nodeModulesPathPart);
|
|
37635
37635
|
}
|
|
37636
|
-
function parseNodeModuleFromPath(resolved) {
|
|
37636
|
+
function parseNodeModuleFromPath(resolved, isFolder) {
|
|
37637
37637
|
const path = normalizePath(resolved);
|
|
37638
37638
|
const idx = path.lastIndexOf(nodeModulesPathPart);
|
|
37639
37639
|
if (idx === -1) {
|
|
37640
37640
|
return void 0;
|
|
37641
37641
|
}
|
|
37642
37642
|
const indexAfterNodeModules = idx + nodeModulesPathPart.length;
|
|
37643
|
-
let indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterNodeModules);
|
|
37643
|
+
let indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterNodeModules, isFolder);
|
|
37644
37644
|
if (path.charCodeAt(indexAfterNodeModules) === 64 /* at */) {
|
|
37645
|
-
indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterPackageName);
|
|
37645
|
+
indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterPackageName, isFolder);
|
|
37646
37646
|
}
|
|
37647
37647
|
return path.slice(0, indexAfterPackageName);
|
|
37648
37648
|
}
|
|
37649
|
-
function moveToNextDirectorySeparatorIfAvailable(path, prevSeparatorIndex) {
|
|
37649
|
+
function moveToNextDirectorySeparatorIfAvailable(path, prevSeparatorIndex, isFolder) {
|
|
37650
37650
|
const nextSeparatorIndex = path.indexOf(directorySeparator, prevSeparatorIndex + 1);
|
|
37651
|
-
return nextSeparatorIndex === -1 ? prevSeparatorIndex : nextSeparatorIndex;
|
|
37651
|
+
return nextSeparatorIndex === -1 ? isFolder ? path.length : prevSeparatorIndex : nextSeparatorIndex;
|
|
37652
37652
|
}
|
|
37653
37653
|
function loadModuleFromFileNoPackageId(extensions, candidate, onlyRecordFailures, state) {
|
|
37654
37654
|
return noPackageId(loadModuleFromFile(extensions, candidate, onlyRecordFailures, state));
|
|
@@ -39024,7 +39024,7 @@ function createBinder() {
|
|
|
39024
39024
|
return getSymbolNameForPrivateIdentifier(containingClassSymbol, name.escapedText);
|
|
39025
39025
|
}
|
|
39026
39026
|
if (isJsxNamespacedName(name)) {
|
|
39027
|
-
return
|
|
39027
|
+
return getEscapedTextOfJsxNamespacedName(name);
|
|
39028
39028
|
}
|
|
39029
39029
|
return isPropertyNameLiteral(name) ? getEscapedTextOfIdentifierOrLiteral(name) : void 0;
|
|
39030
39030
|
}
|
|
@@ -39469,7 +39469,7 @@ function createBinder() {
|
|
|
39469
39469
|
case 36 /* ExclamationEqualsToken */:
|
|
39470
39470
|
case 37 /* EqualsEqualsEqualsToken */:
|
|
39471
39471
|
case 38 /* ExclamationEqualsEqualsToken */:
|
|
39472
|
-
return isNarrowableOperand(expr.left) || isNarrowableOperand(expr.right) || isNarrowingTypeofOperands(expr.right, expr.left) || isNarrowingTypeofOperands(expr.left, expr.right);
|
|
39472
|
+
return isNarrowableOperand(expr.left) || isNarrowableOperand(expr.right) || isNarrowingTypeofOperands(expr.right, expr.left) || isNarrowingTypeofOperands(expr.left, expr.right) || (isBooleanLiteral(expr.right) && isNarrowingExpression(expr.left) || isBooleanLiteral(expr.left) && isNarrowingExpression(expr.right));
|
|
39473
39473
|
case 104 /* InstanceOfKeyword */:
|
|
39474
39474
|
return isNarrowableOperand(expr.left);
|
|
39475
39475
|
case 103 /* InKeyword */:
|
|
@@ -57159,16 +57159,18 @@ function createTypeChecker(host) {
|
|
|
57159
57159
|
while (true) {
|
|
57160
57160
|
if (tailCount === 1e3) {
|
|
57161
57161
|
error(currentNode, Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
|
|
57162
|
-
|
|
57163
|
-
break;
|
|
57162
|
+
return errorType;
|
|
57164
57163
|
}
|
|
57165
|
-
const checkTuples = isSimpleTupleType(root.node.checkType) && isSimpleTupleType(root.node.extendsType) && length(root.node.checkType.elements) === length(root.node.extendsType.elements);
|
|
57166
57164
|
const checkType = instantiateType(getActualTypeVariable(root.checkType), mapper);
|
|
57167
|
-
const checkTypeDeferred = isDeferredType(checkType, checkTuples);
|
|
57168
57165
|
const extendsType = instantiateType(root.extendsType, mapper);
|
|
57166
|
+
if (checkType === errorType || extendsType === errorType) {
|
|
57167
|
+
return errorType;
|
|
57168
|
+
}
|
|
57169
57169
|
if (checkType === wildcardType || extendsType === wildcardType) {
|
|
57170
57170
|
return wildcardType;
|
|
57171
57171
|
}
|
|
57172
|
+
const checkTuples = isSimpleTupleType(root.node.checkType) && isSimpleTupleType(root.node.extendsType) && length(root.node.checkType.elements) === length(root.node.extendsType.elements);
|
|
57173
|
+
const checkTypeDeferred = isDeferredType(checkType, checkTuples);
|
|
57172
57174
|
let combinedMapper;
|
|
57173
57175
|
if (root.inferTypeParameters) {
|
|
57174
57176
|
const freshParams = sameMap(root.inferTypeParameters, maybeCloneTypeParameter);
|
|
@@ -65085,7 +65087,7 @@ function createTypeChecker(host) {
|
|
|
65085
65087
|
}
|
|
65086
65088
|
function isTypePresencePossible(type, propName, assumeTrue) {
|
|
65087
65089
|
const prop = getPropertyOfType(type, propName);
|
|
65088
|
-
return prop ? !!(prop.flags & 16777216 /* Optional */) || assumeTrue : !!getApplicableIndexInfoForName(type, propName) || !assumeTrue;
|
|
65090
|
+
return prop ? !!(prop.flags & 16777216 /* Optional */ || getCheckFlags(prop) & 48 /* Partial */) || assumeTrue : !!getApplicableIndexInfoForName(type, propName) || !assumeTrue;
|
|
65089
65091
|
}
|
|
65090
65092
|
function narrowTypeByInKeyword(type, nameType, assumeTrue) {
|
|
65091
65093
|
const name = getPropertyNameFromType(nameType);
|
|
@@ -65106,6 +65108,10 @@ function createTypeChecker(host) {
|
|
|
65106
65108
|
}
|
|
65107
65109
|
return type;
|
|
65108
65110
|
}
|
|
65111
|
+
function narrowTypeByBooleanComparison(type, expr, bool, operator, assumeTrue) {
|
|
65112
|
+
assumeTrue = assumeTrue !== (bool.kind === 112 /* TrueKeyword */) !== (operator !== 38 /* ExclamationEqualsEqualsToken */ && operator !== 36 /* ExclamationEqualsToken */);
|
|
65113
|
+
return narrowType(type, expr, assumeTrue);
|
|
65114
|
+
}
|
|
65109
65115
|
function narrowTypeByBinaryExpression(type, expr, assumeTrue) {
|
|
65110
65116
|
switch (expr.operatorToken.kind) {
|
|
65111
65117
|
case 64 /* EqualsToken */:
|
|
@@ -65153,6 +65159,12 @@ function createTypeChecker(host) {
|
|
|
65153
65159
|
if (isMatchingConstructorReference(right)) {
|
|
65154
65160
|
return narrowTypeByConstructor(type, operator, left, assumeTrue);
|
|
65155
65161
|
}
|
|
65162
|
+
if (isBooleanLiteral(right)) {
|
|
65163
|
+
return narrowTypeByBooleanComparison(type, left, right, operator, assumeTrue);
|
|
65164
|
+
}
|
|
65165
|
+
if (isBooleanLiteral(left)) {
|
|
65166
|
+
return narrowTypeByBooleanComparison(type, right, left, operator, assumeTrue);
|
|
65167
|
+
}
|
|
65156
65168
|
break;
|
|
65157
65169
|
case 104 /* InstanceOfKeyword */:
|
|
65158
65170
|
return narrowTypeByInstanceof(type, expr, assumeTrue);
|
|
@@ -66893,7 +66905,7 @@ function createTypeChecker(host) {
|
|
|
66893
66905
|
return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional, contextFlags) : void 0;
|
|
66894
66906
|
}
|
|
66895
66907
|
function getContextualTypeForChildJsxExpression(node, child, contextFlags) {
|
|
66896
|
-
const attributesType = getApparentTypeOfContextualType(node.openingElement.
|
|
66908
|
+
const attributesType = getApparentTypeOfContextualType(node.openingElement.attributes, contextFlags);
|
|
66897
66909
|
const jsxChildrenPropertyName = getJsxElementChildrenPropertyName(getJsxNamespaceAt(node));
|
|
66898
66910
|
if (!(attributesType && !isTypeAny(attributesType) && jsxChildrenPropertyName && jsxChildrenPropertyName !== "")) {
|
|
66899
66911
|
return void 0;
|
|
@@ -110664,7 +110676,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
110664
110676
|
}
|
|
110665
110677
|
}
|
|
110666
110678
|
function emitEmbeddedStatement(parent, node) {
|
|
110667
|
-
if (isBlock(node) || getEmitFlags(parent) & 1 /* SingleLine */) {
|
|
110679
|
+
if (isBlock(node) || getEmitFlags(parent) & 1 /* SingleLine */ || preserveSourceNewlines && !getLeadingLineTerminatorCount(parent, node, 0 /* None */)) {
|
|
110668
110680
|
writeSpace();
|
|
110669
110681
|
emit(node);
|
|
110670
110682
|
} else {
|
|
@@ -113528,7 +113540,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
113528
113540
|
automaticTypeDirectiveResolutions = createModeAwareCache();
|
|
113529
113541
|
if (automaticTypeDirectiveNames.length) {
|
|
113530
113542
|
(_k = tracing) == null ? void 0 : _k.push(tracing.Phase.Program, "processTypeReferences", { count: automaticTypeDirectiveNames.length });
|
|
113531
|
-
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) :
|
|
113543
|
+
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : currentDirectory;
|
|
113532
113544
|
const containingFilename = combinePaths(containingDirectory, inferredTypesContainingFile);
|
|
113533
113545
|
const resolutions = resolveTypeReferenceDirectiveNamesReusingOldState(automaticTypeDirectiveNames, containingFilename);
|
|
113534
113546
|
for (let i = 0; i < automaticTypeDirectiveNames.length; i++) {
|
|
@@ -115319,8 +115331,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115319
115331
|
path += (i === 2 ? "/" : "-") + components[i];
|
|
115320
115332
|
i++;
|
|
115321
115333
|
}
|
|
115322
|
-
const
|
|
115323
|
-
const
|
|
115334
|
+
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : currentDirectory;
|
|
115335
|
+
const resolveFrom = combinePaths(containingDirectory, `__lib_node_modules_lookup_${libFileName}__.ts`);
|
|
115336
|
+
const localOverrideModuleResult = resolveModuleName("@typescript/lib-" + path, resolveFrom, { moduleResolution: 2 /* Node10 */, traceResolution: options.traceResolution }, host, moduleResolutionCache);
|
|
115324
115337
|
if (localOverrideModuleResult == null ? void 0 : localOverrideModuleResult.resolvedModule) {
|
|
115325
115338
|
return localOverrideModuleResult.resolvedModule.resolvedFileName;
|
|
115326
115339
|
}
|
|
@@ -115455,7 +115468,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
115455
115468
|
void 0
|
|
115456
115469
|
);
|
|
115457
115470
|
} else {
|
|
115458
|
-
const basePath = getNormalizedAbsolutePath(getDirectoryPath(refPath),
|
|
115471
|
+
const basePath = getNormalizedAbsolutePath(getDirectoryPath(refPath), currentDirectory);
|
|
115459
115472
|
sourceFile = host.getSourceFile(refPath, 100 /* JSON */);
|
|
115460
115473
|
addFileToFilesByName(
|
|
115461
115474
|
sourceFile,
|
|
@@ -118296,6 +118309,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118296
118309
|
let failedLookupChecks;
|
|
118297
118310
|
let startsWithPathChecks;
|
|
118298
118311
|
let isInDirectoryChecks;
|
|
118312
|
+
let allResolutionsAreInvalidated = false;
|
|
118299
118313
|
const getCurrentDirectory = memoize(() => resolutionHost.getCurrentDirectory());
|
|
118300
118314
|
const cachedDirectoryStructureHost = resolutionHost.getCachedDirectoryStructureHost();
|
|
118301
118315
|
const resolvedModuleNames = /* @__PURE__ */ new Map();
|
|
@@ -118338,7 +118352,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118338
118352
|
isFileWithInvalidatedNonRelativeUnresolvedImports,
|
|
118339
118353
|
updateTypeRootsWatch,
|
|
118340
118354
|
closeTypeRootsWatch,
|
|
118341
|
-
clear: clear2
|
|
118355
|
+
clear: clear2,
|
|
118356
|
+
onChangesAffectModuleResolution
|
|
118342
118357
|
};
|
|
118343
118358
|
function getResolvedModule2(resolution) {
|
|
118344
118359
|
return resolution.resolvedModule;
|
|
@@ -118361,6 +118376,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118361
118376
|
isInDirectoryChecks = void 0;
|
|
118362
118377
|
affectingPathChecks = void 0;
|
|
118363
118378
|
affectingPathChecksForFile = void 0;
|
|
118379
|
+
allResolutionsAreInvalidated = false;
|
|
118364
118380
|
moduleResolutionCache.clear();
|
|
118365
118381
|
typeReferenceDirectiveResolutionCache.clear();
|
|
118366
118382
|
moduleResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
@@ -118368,6 +118384,13 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118368
118384
|
impliedFormatPackageJsons.clear();
|
|
118369
118385
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
118370
118386
|
}
|
|
118387
|
+
function onChangesAffectModuleResolution() {
|
|
118388
|
+
allResolutionsAreInvalidated = true;
|
|
118389
|
+
moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
118390
|
+
typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
118391
|
+
moduleResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
118392
|
+
typeReferenceDirectiveResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
118393
|
+
}
|
|
118371
118394
|
function startRecordingFilesWithChangedResolutions() {
|
|
118372
118395
|
filesWithChangedSetOfUnresolvedImports = [];
|
|
118373
118396
|
}
|
|
@@ -118387,7 +118410,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118387
118410
|
invalidateResolutionsOfFailedLookupLocations();
|
|
118388
118411
|
const collected = filesWithInvalidatedResolutions;
|
|
118389
118412
|
filesWithInvalidatedResolutions = void 0;
|
|
118390
|
-
return (path) => customHasInvalidatedResolutions(path) || !!(collected == null ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path);
|
|
118413
|
+
return (path) => customHasInvalidatedResolutions(path) || allResolutionsAreInvalidated || !!(collected == null ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path);
|
|
118391
118414
|
}
|
|
118392
118415
|
function startCachingPerDirectoryResolution() {
|
|
118393
118416
|
moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
@@ -118397,6 +118420,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118397
118420
|
}
|
|
118398
118421
|
function finishCachingPerDirectoryResolution(newProgram, oldProgram) {
|
|
118399
118422
|
filesWithInvalidatedNonRelativeUnresolvedImports = void 0;
|
|
118423
|
+
allResolutionsAreInvalidated = false;
|
|
118400
118424
|
nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
|
|
118401
118425
|
nonRelativeExternalModuleResolutions.clear();
|
|
118402
118426
|
if (newProgram !== oldProgram) {
|
|
@@ -118491,6 +118515,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118491
118515
|
reusedNames,
|
|
118492
118516
|
loader,
|
|
118493
118517
|
getResolutionWithResolvedFileName,
|
|
118518
|
+
deferWatchingNonRelativeResolution,
|
|
118494
118519
|
shouldRetryResolution,
|
|
118495
118520
|
logChanges
|
|
118496
118521
|
}) {
|
|
@@ -118507,15 +118532,15 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118507
118532
|
const name = loader.nameAndMode.getName(entry);
|
|
118508
118533
|
const mode = loader.nameAndMode.getMode(entry, containingSourceFile);
|
|
118509
118534
|
let resolution = resolutionsInFile.get(name, mode);
|
|
118510
|
-
if (!seenNamesInFile.has(name, mode) && unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate
|
|
118511
|
-
hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution)) {
|
|
118535
|
+
if (!seenNamesInFile.has(name, mode) && (allResolutionsAreInvalidated || unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate
|
|
118536
|
+
hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution))) {
|
|
118512
118537
|
const existingResolution = resolution;
|
|
118513
118538
|
resolution = loader.resolve(name, mode);
|
|
118514
118539
|
if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
|
|
118515
118540
|
resolutionHost.onDiscoveredSymlink();
|
|
118516
118541
|
}
|
|
118517
118542
|
resolutionsInFile.set(name, mode, resolution);
|
|
118518
|
-
watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName);
|
|
118543
|
+
watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName, deferWatchingNonRelativeResolution);
|
|
118519
118544
|
if (existingResolution) {
|
|
118520
118545
|
stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolutionWithResolvedFileName);
|
|
118521
118546
|
}
|
|
@@ -118591,7 +118616,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118591
118616
|
typeReferenceDirectiveResolutionCache
|
|
118592
118617
|
),
|
|
118593
118618
|
getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective,
|
|
118594
|
-
shouldRetryResolution: (resolution) => resolution.resolvedTypeReferenceDirective === void 0
|
|
118619
|
+
shouldRetryResolution: (resolution) => resolution.resolvedTypeReferenceDirective === void 0,
|
|
118620
|
+
deferWatchingNonRelativeResolution: false
|
|
118595
118621
|
});
|
|
118596
118622
|
}
|
|
118597
118623
|
function resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
|
|
@@ -118610,7 +118636,9 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118610
118636
|
),
|
|
118611
118637
|
getResolutionWithResolvedFileName: getResolvedModule2,
|
|
118612
118638
|
shouldRetryResolution: (resolution) => !resolution.resolvedModule || !resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension),
|
|
118613
|
-
logChanges: logChangesWhenResolvingModule
|
|
118639
|
+
logChanges: logChangesWhenResolvingModule,
|
|
118640
|
+
deferWatchingNonRelativeResolution: true
|
|
118641
|
+
// Defer non relative resolution watch because we could be using ambient modules
|
|
118614
118642
|
});
|
|
118615
118643
|
}
|
|
118616
118644
|
function resolveSingleModuleNameWithoutWatching(moduleName, containingFile) {
|
|
@@ -118628,7 +118656,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118628
118656
|
function isNodeModulesAtTypesDirectory(dirPath) {
|
|
118629
118657
|
return endsWith(dirPath, "/node_modules/@types");
|
|
118630
118658
|
}
|
|
118631
|
-
function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName) {
|
|
118659
|
+
function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName, deferWatchingNonRelativeResolution) {
|
|
118632
118660
|
var _a;
|
|
118633
118661
|
if (resolution.refCount) {
|
|
118634
118662
|
resolution.refCount++;
|
|
@@ -118636,7 +118664,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118636
118664
|
} else {
|
|
118637
118665
|
resolution.refCount = 1;
|
|
118638
118666
|
Debug.assert(!((_a = resolution.files) == null ? void 0 : _a.size));
|
|
118639
|
-
if (isExternalModuleNameRelative(name)) {
|
|
118667
|
+
if (!deferWatchingNonRelativeResolution || isExternalModuleNameRelative(name)) {
|
|
118640
118668
|
watchFailedLookupLocationOfResolution(resolution);
|
|
118641
118669
|
} else {
|
|
118642
118670
|
nonRelativeExternalModuleResolutions.add(name, resolution);
|
|
@@ -118916,15 +118944,34 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118916
118944
|
return false;
|
|
118917
118945
|
}
|
|
118918
118946
|
(failedLookupChecks || (failedLookupChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
|
|
118919
|
-
const packagePath = parseNodeModuleFromPath(
|
|
118947
|
+
const packagePath = parseNodeModuleFromPath(
|
|
118948
|
+
fileOrDirectoryPath,
|
|
118949
|
+
/*isFolder*/
|
|
118950
|
+
true
|
|
118951
|
+
);
|
|
118920
118952
|
if (packagePath)
|
|
118921
118953
|
(startsWithPathChecks || (startsWithPathChecks = /* @__PURE__ */ new Set())).add(packagePath);
|
|
118922
118954
|
}
|
|
118923
118955
|
}
|
|
118924
118956
|
resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
|
|
118925
118957
|
}
|
|
118958
|
+
function invalidatePackageJsonMap() {
|
|
118959
|
+
const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
|
|
118960
|
+
if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
|
|
118961
|
+
packageJsonMap.forEach((_value, path) => isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : void 0);
|
|
118962
|
+
}
|
|
118963
|
+
}
|
|
118926
118964
|
function invalidateResolutionsOfFailedLookupLocations() {
|
|
118927
118965
|
var _a;
|
|
118966
|
+
if (allResolutionsAreInvalidated) {
|
|
118967
|
+
affectingPathChecksForFile = void 0;
|
|
118968
|
+
invalidatePackageJsonMap();
|
|
118969
|
+
failedLookupChecks = void 0;
|
|
118970
|
+
startsWithPathChecks = void 0;
|
|
118971
|
+
isInDirectoryChecks = void 0;
|
|
118972
|
+
affectingPathChecks = void 0;
|
|
118973
|
+
return true;
|
|
118974
|
+
}
|
|
118928
118975
|
let invalidated = false;
|
|
118929
118976
|
if (affectingPathChecksForFile) {
|
|
118930
118977
|
(_a = resolutionHost.getCurrentProgram()) == null ? void 0 : _a.getSourceFiles().forEach((f) => {
|
|
@@ -118939,10 +118986,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118939
118986
|
return invalidated;
|
|
118940
118987
|
}
|
|
118941
118988
|
invalidated = invalidateResolutions(resolutionsWithFailedLookups, canInvalidateFailedLookupResolution) || invalidated;
|
|
118942
|
-
|
|
118943
|
-
if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
|
|
118944
|
-
packageJsonMap.forEach((_value, path) => isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : void 0);
|
|
118945
|
-
}
|
|
118989
|
+
invalidatePackageJsonMap();
|
|
118946
118990
|
failedLookupChecks = void 0;
|
|
118947
118991
|
startsWithPathChecks = void 0;
|
|
118948
118992
|
isInDirectoryChecks = void 0;
|
|
@@ -119861,7 +119905,8 @@ function createWatchProgram(host) {
|
|
|
119861
119905
|
if (hasChangedCompilerOptions) {
|
|
119862
119906
|
newLine = updateNewLine();
|
|
119863
119907
|
if (program && changesAffectModuleResolution(program.getCompilerOptions(), compilerOptions)) {
|
|
119864
|
-
|
|
119908
|
+
debugger;
|
|
119909
|
+
resolutionCache.onChangesAffectModuleResolution();
|
|
119865
119910
|
}
|
|
119866
119911
|
}
|
|
119867
119912
|
const hasInvalidatedResolutions = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions);
|