@typescript-deploys/pr-build 5.1.0-pr-53591-4 → 5.1.0-pr-53739-12
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/lib.es5.d.ts +1 -1
- package/lib/tsc.js +163 -110
- package/lib/tsserver.js +174 -121
- package/lib/tsserverlibrary.js +175 -121
- package/lib/typescript.js +164 -111
- package/lib/typingsInstaller.js +2 -2
- package/package.json +2 -2
package/lib/lib.es5.d.ts
CHANGED
|
@@ -1832,7 +1832,7 @@ interface DataView {
|
|
|
1832
1832
|
|
|
1833
1833
|
interface DataViewConstructor {
|
|
1834
1834
|
readonly prototype: DataView;
|
|
1835
|
-
new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;
|
|
1835
|
+
new(buffer: ArrayBufferLike & { BYTES_PER_ELEMENT?: never }, byteOffset?: number, byteLength?: number): DataView;
|
|
1836
1836
|
}
|
|
1837
1837
|
declare var DataView: DataViewConstructor;
|
|
1838
1838
|
|
package/lib/tsc.js
CHANGED
|
@@ -5294,10 +5294,6 @@ function isAnyDirectorySeparator(charCode) {
|
|
|
5294
5294
|
function isRootedDiskPath(path) {
|
|
5295
5295
|
return getEncodedRootLength(path) > 0;
|
|
5296
5296
|
}
|
|
5297
|
-
function isDiskPathRoot(path) {
|
|
5298
|
-
const rootLength = getEncodedRootLength(path);
|
|
5299
|
-
return rootLength > 0 && rootLength === path.length;
|
|
5300
|
-
}
|
|
5301
5297
|
function pathIsAbsolute(path) {
|
|
5302
5298
|
return getEncodedRootLength(path) !== 0;
|
|
5303
5299
|
}
|
|
@@ -5446,11 +5442,11 @@ function getPathComponents(path, currentDirectory = "") {
|
|
|
5446
5442
|
path = combinePaths(currentDirectory, path);
|
|
5447
5443
|
return pathComponents(path, getRootLength(path));
|
|
5448
5444
|
}
|
|
5449
|
-
function getPathFromPathComponents(pathComponents2
|
|
5445
|
+
function getPathFromPathComponents(pathComponents2) {
|
|
5450
5446
|
if (pathComponents2.length === 0)
|
|
5451
5447
|
return "";
|
|
5452
5448
|
const root = pathComponents2[0] && ensureTrailingDirectorySeparator(pathComponents2[0]);
|
|
5453
|
-
return root + pathComponents2.slice(1
|
|
5449
|
+
return root + pathComponents2.slice(1).join(directorySeparator);
|
|
5454
5450
|
}
|
|
5455
5451
|
function normalizeSlashes(path) {
|
|
5456
5452
|
return path.indexOf("\\") !== -1 ? path.replace(backslashRegExp, directorySeparator) : path;
|
|
@@ -42572,6 +42568,7 @@ function isInstantiatedModule(node, preserveConstEnums) {
|
|
|
42572
42568
|
const moduleState = getModuleInstanceState(node);
|
|
42573
42569
|
return moduleState === 1 /* Instantiated */ || preserveConstEnums && moduleState === 2 /* ConstEnumOnly */;
|
|
42574
42570
|
}
|
|
42571
|
+
var UNION_CROSS_PRODUCT_SIZE_LIMIT = 1e5;
|
|
42575
42572
|
function createTypeChecker(host) {
|
|
42576
42573
|
var getPackagesMap = memoize(() => {
|
|
42577
42574
|
var map2 = /* @__PURE__ */ new Map();
|
|
@@ -51744,7 +51741,12 @@ function createTypeChecker(host) {
|
|
|
51744
51741
|
if (!links.type) {
|
|
51745
51742
|
Debug.assertIsDefined(links.deferralParent);
|
|
51746
51743
|
Debug.assertIsDefined(links.deferralConstituents);
|
|
51747
|
-
|
|
51744
|
+
const operation = links.deferralParent.flags & 1048576 /* Union */ ? getUnionType : getIntersectionType;
|
|
51745
|
+
let result = operation(links.deferralConstituents);
|
|
51746
|
+
for (const part of links.deferredMismatchedParts || emptyArray) {
|
|
51747
|
+
result = operation([result, getTypeOfSymbol(part)]);
|
|
51748
|
+
}
|
|
51749
|
+
links.type = result;
|
|
51748
51750
|
}
|
|
51749
51751
|
return links.type;
|
|
51750
51752
|
}
|
|
@@ -51752,8 +51754,12 @@ function createTypeChecker(host) {
|
|
|
51752
51754
|
const links = getSymbolLinks(symbol);
|
|
51753
51755
|
if (!links.writeType && links.deferralWriteConstituents) {
|
|
51754
51756
|
Debug.assertIsDefined(links.deferralParent);
|
|
51755
|
-
|
|
51756
|
-
|
|
51757
|
+
const operation = links.deferralParent.flags & 1048576 /* Union */ ? getUnionType : getIntersectionType;
|
|
51758
|
+
let result = operation(links.deferralWriteConstituents);
|
|
51759
|
+
for (const part of links.deferredMismatchedParts || emptyArray) {
|
|
51760
|
+
result = operation([result, getTypeOfSymbol(part)]);
|
|
51761
|
+
}
|
|
51762
|
+
links.writeType = result;
|
|
51757
51763
|
}
|
|
51758
51764
|
return links.writeType;
|
|
51759
51765
|
}
|
|
@@ -53790,7 +53796,7 @@ function createTypeChecker(host) {
|
|
|
53790
53796
|
return getReducedType(getApparentType(getReducedType(type)));
|
|
53791
53797
|
}
|
|
53792
53798
|
function createUnionOrIntersectionProperty(containingType, name, skipObjectFunctionPropertyAugment) {
|
|
53793
|
-
var _a2, _b, _c;
|
|
53799
|
+
var _a2, _b, _c, _d;
|
|
53794
53800
|
let singleProp;
|
|
53795
53801
|
let propSet;
|
|
53796
53802
|
let indexTypes;
|
|
@@ -53872,8 +53878,9 @@ function createTypeChecker(host) {
|
|
|
53872
53878
|
let declarations;
|
|
53873
53879
|
let firstType;
|
|
53874
53880
|
let nameType;
|
|
53875
|
-
|
|
53881
|
+
let propTypes = [];
|
|
53876
53882
|
let writeTypes;
|
|
53883
|
+
let deferredMismatchedParts;
|
|
53877
53884
|
let firstValueDeclaration;
|
|
53878
53885
|
let hasNonUniformValueDeclaration = false;
|
|
53879
53886
|
for (const prop of props) {
|
|
@@ -53883,6 +53890,24 @@ function createTypeChecker(host) {
|
|
|
53883
53890
|
hasNonUniformValueDeclaration = true;
|
|
53884
53891
|
}
|
|
53885
53892
|
declarations = addRange(declarations, prop.declarations);
|
|
53893
|
+
if (getCheckFlags(prop) & 65536 /* DeferredType */) {
|
|
53894
|
+
checkFlags |= getCheckFlags(prop) & (131072 /* HasNeverType */ | 64 /* HasNonUniformType */ | 128 /* HasLiteralType */);
|
|
53895
|
+
if (!nameType) {
|
|
53896
|
+
nameType = getSymbolLinks(prop).nameType;
|
|
53897
|
+
}
|
|
53898
|
+
if ((((_d = getSymbolLinks(prop).deferralParent) == null ? void 0 : _d.flags) & 3145728 /* UnionOrIntersection */) === (containingType.flags & 3145728 /* UnionOrIntersection */)) {
|
|
53899
|
+
const deferredWriteTypes = getSymbolLinks(prop).deferralWriteConstituents;
|
|
53900
|
+
if (deferredWriteTypes) {
|
|
53901
|
+
writeTypes = concatenate(!writeTypes ? propTypes.slice() : writeTypes, deferredWriteTypes);
|
|
53902
|
+
}
|
|
53903
|
+
propTypes = concatenate(propTypes, getSymbolLinks(prop).deferralConstituents);
|
|
53904
|
+
deferredMismatchedParts = concatenate(deferredMismatchedParts, getSymbolLinks(prop).deferredMismatchedParts);
|
|
53905
|
+
break;
|
|
53906
|
+
} else {
|
|
53907
|
+
deferredMismatchedParts = append(deferredMismatchedParts, prop);
|
|
53908
|
+
break;
|
|
53909
|
+
}
|
|
53910
|
+
}
|
|
53886
53911
|
const type = getTypeOfSymbol(prop);
|
|
53887
53912
|
if (!firstType) {
|
|
53888
53913
|
firstType = type;
|
|
@@ -53913,11 +53938,12 @@ function createTypeChecker(host) {
|
|
|
53913
53938
|
}
|
|
53914
53939
|
result.declarations = declarations;
|
|
53915
53940
|
result.links.nameType = nameType;
|
|
53916
|
-
if (propTypes.length > 2) {
|
|
53941
|
+
if (propTypes.length > 2 || deferredMismatchedParts) {
|
|
53917
53942
|
result.links.checkFlags |= 65536 /* DeferredType */;
|
|
53918
53943
|
result.links.deferralParent = containingType;
|
|
53919
53944
|
result.links.deferralConstituents = propTypes;
|
|
53920
53945
|
result.links.deferralWriteConstituents = writeTypes;
|
|
53946
|
+
result.links.deferredMismatchedParts = deferredMismatchedParts;
|
|
53921
53947
|
} else {
|
|
53922
53948
|
result.links.type = isUnion ? getUnionType(propTypes) : getIntersectionType(propTypes);
|
|
53923
53949
|
if (writeTypes) {
|
|
@@ -56274,7 +56300,7 @@ function createTypeChecker(host) {
|
|
|
56274
56300
|
function getIntersectionType(types, aliasSymbol, aliasTypeArguments, noSupertypeReduction) {
|
|
56275
56301
|
const typeMembershipMap = /* @__PURE__ */ new Map();
|
|
56276
56302
|
const includes = addTypesToIntersection(typeMembershipMap, 0, types);
|
|
56277
|
-
|
|
56303
|
+
let typeSet = arrayFrom(typeMembershipMap.values());
|
|
56278
56304
|
if (includes & 131072 /* Never */) {
|
|
56279
56305
|
return contains(typeSet, silentNeverType) ? silentNeverType : neverType;
|
|
56280
56306
|
}
|
|
@@ -56306,6 +56332,8 @@ function createTypeChecker(host) {
|
|
|
56306
56332
|
const id = getTypeListId(typeSet) + getAliasId(aliasSymbol, aliasTypeArguments);
|
|
56307
56333
|
let result = intersectionTypes.get(id);
|
|
56308
56334
|
if (!result) {
|
|
56335
|
+
const originalSet = typeSet;
|
|
56336
|
+
let runningResult;
|
|
56309
56337
|
if (includes & 1048576 /* Union */) {
|
|
56310
56338
|
if (intersectUnionsOfPrimitiveTypes(typeSet)) {
|
|
56311
56339
|
result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
|
|
@@ -56317,12 +56345,32 @@ function createTypeChecker(host) {
|
|
|
56317
56345
|
removeFromEach(typeSet, 65536 /* Null */);
|
|
56318
56346
|
result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
56319
56347
|
} else {
|
|
56348
|
+
if (getCrossProductUnionSize(typeSet) >= UNION_CROSS_PRODUCT_SIZE_LIMIT && every(typeSet, (t) => !!(t.flags & 1048576 /* Union */) || !!(t.flags & 402784252 /* Primitive */))) {
|
|
56349
|
+
if (typeSet.length > 2 || some(typeSet, (t) => getReducedType(t) !== t)) {
|
|
56350
|
+
runningResult = getReducedType(typeSet[0]);
|
|
56351
|
+
for (let i = 1; i < typeSet.length; i++) {
|
|
56352
|
+
const reducedElem = getReducedType(typeSet[i]);
|
|
56353
|
+
runningResult = reducedElem.flags & 402784252 /* Primitive */ && everyType(runningResult, (t) => !!(t.flags & 524288 /* Object */)) ? neverType : getReducedType(intersectTypes(runningResult, reducedElem));
|
|
56354
|
+
if (i === typeSet.length - 1 || isTypeAny(runningResult) || runningResult.flags & 131072 /* Never */) {
|
|
56355
|
+
return runningResult;
|
|
56356
|
+
}
|
|
56357
|
+
if (!(runningResult.flags & 1048576 /* Union */) || runningResult.types.length > typeSet.length) {
|
|
56358
|
+
typeSet = typeSet.slice(i + 1);
|
|
56359
|
+
break;
|
|
56360
|
+
}
|
|
56361
|
+
}
|
|
56362
|
+
}
|
|
56363
|
+
}
|
|
56320
56364
|
if (!checkCrossProductUnion(typeSet)) {
|
|
56321
56365
|
return errorType;
|
|
56322
56366
|
}
|
|
56323
56367
|
const constituents = getCrossProductIntersections(typeSet);
|
|
56324
|
-
|
|
56325
|
-
|
|
56368
|
+
if (runningResult && runningResult !== typeSet[0]) {
|
|
56369
|
+
result = getIntersectionType([runningResult, getUnionType(constituents, 1 /* Literal */)], aliasSymbol, aliasTypeArguments);
|
|
56370
|
+
} else {
|
|
56371
|
+
const origin = some(constituents, (t) => !!(t.flags & 2097152 /* Intersection */)) && getConstituentCountOfTypes(constituents) > getConstituentCountOfTypes(typeSet) ? createOriginUnionOrIntersectionType(2097152 /* Intersection */, originalSet) : void 0;
|
|
56372
|
+
result = getUnionType(constituents, 1 /* Literal */, aliasSymbol, aliasTypeArguments, origin);
|
|
56373
|
+
}
|
|
56326
56374
|
}
|
|
56327
56375
|
} else {
|
|
56328
56376
|
result = createIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
|
|
@@ -56337,7 +56385,7 @@ function createTypeChecker(host) {
|
|
|
56337
56385
|
function checkCrossProductUnion(types) {
|
|
56338
56386
|
var _a2;
|
|
56339
56387
|
const size = getCrossProductUnionSize(types);
|
|
56340
|
-
if (size >=
|
|
56388
|
+
if (size >= UNION_CROSS_PRODUCT_SIZE_LIMIT) {
|
|
56341
56389
|
(_a2 = tracing) == null ? void 0 : _a2.instant(tracing.Phase.CheckTypes, "checkCrossProductUnion_DepthLimit", { typeIds: types.map((t) => t.id), size });
|
|
56342
56390
|
error(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
|
|
56343
56391
|
return false;
|
|
@@ -118112,62 +118160,60 @@ function removeIgnoredPath(path) {
|
|
|
118112
118160
|
}
|
|
118113
118161
|
return some(ignoredPaths, (searchPath) => stringContains(path, searchPath)) ? void 0 : path;
|
|
118114
118162
|
}
|
|
118115
|
-
function
|
|
118116
|
-
|
|
118117
|
-
|
|
118118
|
-
let userCheckIndex = 1;
|
|
118119
|
-
let isDosStyle = pathComponents2[0].search(/[a-zA-Z]:/) === 0;
|
|
118120
|
-
if (pathComponents2[0] !== directorySeparator && !isDosStyle && // Non dos style paths
|
|
118121
|
-
pathComponents2[1].search(/[a-zA-Z]\$$/) === 0) {
|
|
118122
|
-
if (length2 === 2)
|
|
118123
|
-
return 2;
|
|
118124
|
-
userCheckIndex = 2;
|
|
118125
|
-
isDosStyle = true;
|
|
118126
|
-
}
|
|
118127
|
-
if (isDosStyle && !pathComponents2[userCheckIndex].match(/^users$/i)) {
|
|
118128
|
-
return userCheckIndex;
|
|
118129
|
-
}
|
|
118130
|
-
return userCheckIndex + 2;
|
|
118131
|
-
}
|
|
118132
|
-
function canWatchDirectoryOrFile(pathComponents2, length2) {
|
|
118133
|
-
if (length2 === void 0)
|
|
118134
|
-
length2 = pathComponents2.length;
|
|
118135
|
-
if (length2 <= 2)
|
|
118163
|
+
function canWatchDirectoryOrFile(dirPath) {
|
|
118164
|
+
const rootLength = getRootLength(dirPath);
|
|
118165
|
+
if (dirPath.length === rootLength) {
|
|
118136
118166
|
return false;
|
|
118137
|
-
|
|
118138
|
-
|
|
118139
|
-
|
|
118140
|
-
function canWatchAtTypes(atTypes) {
|
|
118141
|
-
return canWatchAffectedPackageJsonOrNodeModulesOfAtTypes(getDirectoryPath(atTypes));
|
|
118142
|
-
}
|
|
118143
|
-
function isInDirectoryPath(dirComponents, fileOrDirComponents) {
|
|
118144
|
-
if (fileOrDirComponents.length < fileOrDirComponents.length)
|
|
118167
|
+
}
|
|
118168
|
+
let nextDirectorySeparator = dirPath.indexOf(directorySeparator, rootLength);
|
|
118169
|
+
if (nextDirectorySeparator === -1) {
|
|
118145
118170
|
return false;
|
|
118146
|
-
|
|
118147
|
-
|
|
118171
|
+
}
|
|
118172
|
+
let pathPartForUserCheck = dirPath.substring(rootLength, nextDirectorySeparator + 1);
|
|
118173
|
+
const isNonDirectorySeparatorRoot = rootLength > 1 || dirPath.charCodeAt(0) !== 47 /* slash */;
|
|
118174
|
+
if (isNonDirectorySeparatorRoot && dirPath.search(/[a-zA-Z]:/) !== 0 && // Non dos style paths
|
|
118175
|
+
pathPartForUserCheck.search(/[a-zA-Z]\$\//) === 0) {
|
|
118176
|
+
nextDirectorySeparator = dirPath.indexOf(directorySeparator, nextDirectorySeparator + 1);
|
|
118177
|
+
if (nextDirectorySeparator === -1) {
|
|
118148
118178
|
return false;
|
|
118179
|
+
}
|
|
118180
|
+
pathPartForUserCheck = dirPath.substring(rootLength + pathPartForUserCheck.length, nextDirectorySeparator + 1);
|
|
118181
|
+
}
|
|
118182
|
+
if (isNonDirectorySeparatorRoot && pathPartForUserCheck.search(/users\//i) !== 0) {
|
|
118183
|
+
return true;
|
|
118184
|
+
}
|
|
118185
|
+
for (let searchIndex = nextDirectorySeparator + 1, searchLevels = 2; searchLevels > 0; searchLevels--) {
|
|
118186
|
+
searchIndex = dirPath.indexOf(directorySeparator, searchIndex) + 1;
|
|
118187
|
+
if (searchIndex === 0) {
|
|
118188
|
+
return false;
|
|
118189
|
+
}
|
|
118149
118190
|
}
|
|
118150
118191
|
return true;
|
|
118151
118192
|
}
|
|
118152
|
-
function
|
|
118153
|
-
|
|
118193
|
+
function canWatchAtTypes(atTypes, rootPath) {
|
|
118194
|
+
const dirPath = getDirectoryPath(getDirectoryPath(atTypes));
|
|
118195
|
+
return dirPath === rootPath || canWatchDirectoryOrFile(dirPath);
|
|
118196
|
+
}
|
|
118197
|
+
function isInDirectoryPath(dir, file) {
|
|
118198
|
+
if (dir === void 0 || file.length <= dir.length) {
|
|
118199
|
+
return false;
|
|
118200
|
+
}
|
|
118201
|
+
return startsWith(file, dir) && file[dir.length] === directorySeparator;
|
|
118154
118202
|
}
|
|
118155
118203
|
function canWatchAffectingLocation(filePath) {
|
|
118156
|
-
return
|
|
118157
|
-
}
|
|
118158
|
-
function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath, rootDir, rootPath,
|
|
118159
|
-
|
|
118160
|
-
|
|
118161
|
-
|
|
118162
|
-
|
|
118163
|
-
|
|
118164
|
-
|
|
118165
|
-
|
|
118166
|
-
|
|
118167
|
-
|
|
118168
|
-
|
|
118169
|
-
if (failedLookupPathComponents.length > rootPathComponents.length + 1) {
|
|
118170
|
-
return getDirectoryOfFailedLookupWatch(failedLookupComponents, failedLookupPathComponents, Math.max(rootPathComponents.length + 1, perceivedOsRootLength + 1));
|
|
118204
|
+
return canWatchDirectoryOrFile(filePath);
|
|
118205
|
+
}
|
|
118206
|
+
function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath, rootDir, rootPath, rootSplitLength, getCurrentDirectory) {
|
|
118207
|
+
if (isInDirectoryPath(rootPath, failedLookupLocationPath)) {
|
|
118208
|
+
failedLookupLocation = isRootedDiskPath(failedLookupLocation) ? normalizePath(failedLookupLocation) : getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory());
|
|
118209
|
+
const failedLookupPathSplit = failedLookupLocationPath.split(directorySeparator);
|
|
118210
|
+
const failedLookupSplit = failedLookupLocation.split(directorySeparator);
|
|
118211
|
+
Debug.assert(failedLookupSplit.length === failedLookupPathSplit.length, `FailedLookup: ${failedLookupLocation} failedLookupLocationPath: ${failedLookupLocationPath}`);
|
|
118212
|
+
if (failedLookupPathSplit.length > rootSplitLength + 1) {
|
|
118213
|
+
return {
|
|
118214
|
+
dir: failedLookupSplit.slice(0, rootSplitLength + 1).join(directorySeparator),
|
|
118215
|
+
dirPath: failedLookupPathSplit.slice(0, rootSplitLength + 1).join(directorySeparator)
|
|
118216
|
+
};
|
|
118171
118217
|
} else {
|
|
118172
118218
|
return {
|
|
118173
118219
|
dir: rootDir,
|
|
@@ -118177,55 +118223,45 @@ function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLoo
|
|
|
118177
118223
|
}
|
|
118178
118224
|
}
|
|
118179
118225
|
return getDirectoryToWatchFromFailedLookupLocationDirectory(
|
|
118180
|
-
|
|
118181
|
-
|
|
118182
|
-
|
|
118183
|
-
perceivedOsRootLength,
|
|
118184
|
-
nodeModulesIndex,
|
|
118185
|
-
rootPathComponents
|
|
118226
|
+
getDirectoryPath(getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory())),
|
|
118227
|
+
getDirectoryPath(failedLookupLocationPath),
|
|
118228
|
+
rootPath
|
|
118186
118229
|
);
|
|
118187
118230
|
}
|
|
118188
|
-
function getDirectoryToWatchFromFailedLookupLocationDirectory(
|
|
118189
|
-
|
|
118190
|
-
|
|
118231
|
+
function getDirectoryToWatchFromFailedLookupLocationDirectory(dir, dirPath, rootPath) {
|
|
118232
|
+
while (pathContainsNodeModules(dirPath)) {
|
|
118233
|
+
dir = getDirectoryPath(dir);
|
|
118234
|
+
dirPath = getDirectoryPath(dirPath);
|
|
118235
|
+
}
|
|
118236
|
+
if (isNodeModulesDirectory(dirPath)) {
|
|
118237
|
+
return canWatchDirectoryOrFile(getDirectoryPath(dirPath)) ? { dir, dirPath } : void 0;
|
|
118191
118238
|
}
|
|
118192
118239
|
let nonRecursive = true;
|
|
118193
|
-
let
|
|
118194
|
-
|
|
118195
|
-
|
|
118240
|
+
let subDirectoryPath, subDirectory;
|
|
118241
|
+
if (rootPath !== void 0) {
|
|
118242
|
+
while (!isInDirectoryPath(dirPath, rootPath)) {
|
|
118243
|
+
const parentPath = getDirectoryPath(dirPath);
|
|
118244
|
+
if (parentPath === dirPath) {
|
|
118245
|
+
break;
|
|
118246
|
+
}
|
|
118196
118247
|
nonRecursive = false;
|
|
118197
|
-
|
|
118198
|
-
|
|
118248
|
+
subDirectoryPath = dirPath;
|
|
118249
|
+
subDirectory = dir;
|
|
118250
|
+
dirPath = parentPath;
|
|
118251
|
+
dir = getDirectoryPath(dir);
|
|
118199
118252
|
}
|
|
118200
118253
|
}
|
|
118201
|
-
return
|
|
118254
|
+
return canWatchDirectoryOrFile(dirPath) ? { dir: subDirectory || dir, dirPath: subDirectoryPath || dirPath, nonRecursive } : void 0;
|
|
118202
118255
|
}
|
|
118203
|
-
function
|
|
118204
|
-
|
|
118205
|
-
dir: getPathFromPathComponents(dirComponents, length2),
|
|
118206
|
-
dirPath: getPathFromPathComponents(dirPathComponents, length2),
|
|
118207
|
-
nonRecursive
|
|
118208
|
-
};
|
|
118209
|
-
}
|
|
118210
|
-
function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath, rootPath, rootPathComponents, getCurrentDirectory, filterCustomPath) {
|
|
118211
|
-
const typeRootPathComponents = getPathComponents(typeRootPath);
|
|
118212
|
-
if (isInDirectoryPath(rootPathComponents, typeRootPathComponents)) {
|
|
118256
|
+
function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath, rootPath, filterCustomPath) {
|
|
118257
|
+
if (isInDirectoryPath(rootPath, typeRootPath)) {
|
|
118213
118258
|
return rootPath;
|
|
118214
118259
|
}
|
|
118215
|
-
|
|
118216
|
-
const toWatch = getDirectoryToWatchFromFailedLookupLocationDirectory(
|
|
118217
|
-
getPathComponents(typeRoot),
|
|
118218
|
-
typeRootPathComponents,
|
|
118219
|
-
typeRootPathComponents.length,
|
|
118220
|
-
perceivedOsRootLengthForWatching(typeRootPathComponents, typeRootPathComponents.length),
|
|
118221
|
-
typeRootPathComponents.indexOf("node_modules"),
|
|
118222
|
-
rootPathComponents
|
|
118223
|
-
);
|
|
118260
|
+
const toWatch = getDirectoryToWatchFromFailedLookupLocationDirectory(typeRoot, typeRootPath, rootPath);
|
|
118224
118261
|
return toWatch && filterCustomPath(toWatch.dirPath) ? toWatch.dirPath : void 0;
|
|
118225
118262
|
}
|
|
118226
118263
|
function getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirectory) {
|
|
118227
|
-
|
|
118228
|
-
return !isDiskPathRoot(normalized) ? removeTrailingDirectorySeparator(normalized) : normalized;
|
|
118264
|
+
return rootDirForResolution && removeTrailingDirectorySeparator(getNormalizedAbsolutePath(rootDirForResolution, getCurrentDirectory()));
|
|
118229
118265
|
}
|
|
118230
118266
|
function createResolutionCache(resolutionHost, rootDirForResolution, logChangesWhenResolvingModule) {
|
|
118231
118267
|
let filesWithChangedSetOfUnresolvedImports;
|
|
@@ -118257,11 +118293,13 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118257
118293
|
resolutionHost.getCompilationSettings(),
|
|
118258
118294
|
moduleResolutionCache.getPackageJsonInfoCache()
|
|
118259
118295
|
);
|
|
118296
|
+
const failedLookupDefaultExtensions = [".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */, ".json" /* Json */];
|
|
118297
|
+
const customFailedLookupPaths = /* @__PURE__ */ new Map();
|
|
118260
118298
|
const directoryWatchesOfFailedLookups = /* @__PURE__ */ new Map();
|
|
118261
118299
|
const fileWatchesOfAffectingLocations = /* @__PURE__ */ new Map();
|
|
118262
118300
|
const rootDir = getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirectory);
|
|
118263
|
-
const rootPath = resolutionHost.toPath(rootDir);
|
|
118264
|
-
const
|
|
118301
|
+
const rootPath = rootDir && resolutionHost.toPath(rootDir);
|
|
118302
|
+
const rootSplitLength = rootPath !== void 0 ? rootPath.split(directorySeparator).length : 0;
|
|
118265
118303
|
const typeRootsWatches = /* @__PURE__ */ new Map();
|
|
118266
118304
|
return {
|
|
118267
118305
|
getModuleResolutionCache: () => moduleResolutionCache,
|
|
@@ -118295,6 +118333,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118295
118333
|
function clear2() {
|
|
118296
118334
|
clearMap(directoryWatchesOfFailedLookups, closeFileWatcherOf);
|
|
118297
118335
|
clearMap(fileWatchesOfAffectingLocations, closeFileWatcherOf);
|
|
118336
|
+
customFailedLookupPaths.clear();
|
|
118298
118337
|
nonRelativeExternalModuleResolutions.clear();
|
|
118299
118338
|
closeTypeRootsWatch();
|
|
118300
118339
|
resolvedModuleNames.clear();
|
|
@@ -118574,6 +118613,9 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118574
118613
|
function isNodeModulesAtTypesDirectory(dirPath) {
|
|
118575
118614
|
return endsWith(dirPath, "/node_modules/@types");
|
|
118576
118615
|
}
|
|
118616
|
+
function isPathWithDefaultFailedLookupExtension(path) {
|
|
118617
|
+
return fileExtensionIsOneOf(path, failedLookupDefaultExtensions);
|
|
118618
|
+
}
|
|
118577
118619
|
function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName) {
|
|
118578
118620
|
var _a2, _b;
|
|
118579
118621
|
if (resolution.refCount) {
|
|
@@ -118614,11 +118656,15 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118614
118656
|
failedLookupLocationPath,
|
|
118615
118657
|
rootDir,
|
|
118616
118658
|
rootPath,
|
|
118617
|
-
|
|
118659
|
+
rootSplitLength,
|
|
118618
118660
|
getCurrentDirectory
|
|
118619
118661
|
);
|
|
118620
118662
|
if (toWatch) {
|
|
118621
118663
|
const { dir, dirPath, nonRecursive } = toWatch;
|
|
118664
|
+
if (!isPathWithDefaultFailedLookupExtension(failedLookupLocationPath)) {
|
|
118665
|
+
const refCount = customFailedLookupPaths.get(failedLookupLocationPath) || 0;
|
|
118666
|
+
customFailedLookupPaths.set(failedLookupLocationPath, refCount + 1);
|
|
118667
|
+
}
|
|
118622
118668
|
if (dirPath === rootPath) {
|
|
118623
118669
|
Debug.assert(nonRecursive);
|
|
118624
118670
|
setAtRoot = true;
|
|
@@ -118753,11 +118799,20 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118753
118799
|
failedLookupLocationPath,
|
|
118754
118800
|
rootDir,
|
|
118755
118801
|
rootPath,
|
|
118756
|
-
|
|
118802
|
+
rootSplitLength,
|
|
118757
118803
|
getCurrentDirectory
|
|
118758
118804
|
);
|
|
118759
118805
|
if (toWatch) {
|
|
118760
118806
|
const { dirPath } = toWatch;
|
|
118807
|
+
const refCount = customFailedLookupPaths.get(failedLookupLocationPath);
|
|
118808
|
+
if (refCount) {
|
|
118809
|
+
if (refCount === 1) {
|
|
118810
|
+
customFailedLookupPaths.delete(failedLookupLocationPath);
|
|
118811
|
+
} else {
|
|
118812
|
+
Debug.assert(refCount > 1);
|
|
118813
|
+
customFailedLookupPaths.set(failedLookupLocationPath, refCount - 1);
|
|
118814
|
+
}
|
|
118815
|
+
}
|
|
118761
118816
|
if (dirPath === rootPath) {
|
|
118762
118817
|
removeAtRoot = true;
|
|
118763
118818
|
} else {
|
|
@@ -118855,10 +118910,10 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118855
118910
|
(failedLookupChecks || (failedLookupChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
|
|
118856
118911
|
(startsWithPathChecks || (startsWithPathChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
|
|
118857
118912
|
} else {
|
|
118858
|
-
if (
|
|
118913
|
+
if (!isPathWithDefaultFailedLookupExtension(fileOrDirectoryPath) && !customFailedLookupPaths.has(fileOrDirectoryPath)) {
|
|
118859
118914
|
return false;
|
|
118860
118915
|
}
|
|
118861
|
-
if (
|
|
118916
|
+
if (isEmittedFileOfProgram(resolutionHost.getCurrentProgram(), fileOrDirectoryPath)) {
|
|
118862
118917
|
return false;
|
|
118863
118918
|
}
|
|
118864
118919
|
(failedLookupChecks || (failedLookupChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
|
|
@@ -118905,7 +118960,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118905
118960
|
return (_a2 = resolution.failedLookupLocations) == null ? void 0 : _a2.some((location) => isInvalidatedFailedLookup(resolutionHost.toPath(location)));
|
|
118906
118961
|
}
|
|
118907
118962
|
function isInvalidatedFailedLookup(locationPath) {
|
|
118908
|
-
return (failedLookupChecks == null ? void 0 : failedLookupChecks.has(locationPath)) || firstDefinedIterator((startsWithPathChecks == null ? void 0 : startsWithPathChecks.keys()) || [], (fileOrDirectoryPath) => startsWith(locationPath, fileOrDirectoryPath) ? true : void 0) || firstDefinedIterator((isInDirectoryChecks == null ? void 0 : isInDirectoryChecks.keys()) || [], (
|
|
118963
|
+
return (failedLookupChecks == null ? void 0 : failedLookupChecks.has(locationPath)) || firstDefinedIterator((startsWithPathChecks == null ? void 0 : startsWithPathChecks.keys()) || [], (fileOrDirectoryPath) => startsWith(locationPath, fileOrDirectoryPath) ? true : void 0) || firstDefinedIterator((isInDirectoryChecks == null ? void 0 : isInDirectoryChecks.keys()) || [], (fileOrDirectoryPath) => isInDirectoryPath(fileOrDirectoryPath, locationPath) ? true : void 0);
|
|
118909
118964
|
}
|
|
118910
118965
|
function canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution) {
|
|
118911
118966
|
var _a2;
|
|
@@ -118926,8 +118981,6 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118926
118981
|
typeRoot,
|
|
118927
118982
|
typeRootPath,
|
|
118928
118983
|
rootPath,
|
|
118929
|
-
rootPathComponents,
|
|
118930
|
-
getCurrentDirectory,
|
|
118931
118984
|
(dirPath2) => directoryWatchesOfFailedLookups.has(dirPath2)
|
|
118932
118985
|
);
|
|
118933
118986
|
if (dirPath) {
|
|
@@ -118958,7 +119011,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
118958
119011
|
function canWatchTypeRootPath(typeRoot) {
|
|
118959
119012
|
if (resolutionHost.getCompilationSettings().typeRoots)
|
|
118960
119013
|
return true;
|
|
118961
|
-
return canWatchAtTypes(resolutionHost.toPath(typeRoot));
|
|
119014
|
+
return canWatchAtTypes(resolutionHost.toPath(typeRoot), rootPath);
|
|
118962
119015
|
}
|
|
118963
119016
|
}
|
|
118964
119017
|
function resolutionIsSymlink(resolution) {
|