@typescript-deploys/pr-build 5.1.0-pr-53489-15 → 5.1.0-pr-51328-50

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 CHANGED
@@ -332,9 +332,14 @@ interface CallableFunction extends Function {
332
332
  /**
333
333
  * Calls the function with the specified object as the this value and the elements of specified array as the arguments.
334
334
  * @param thisArg The object to be used as the this object.
335
- * @param args An array of argument values to be passed to the function.
336
335
  */
337
336
  apply<T, R>(this: (this: T) => R, thisArg: T): R;
337
+
338
+ /**
339
+ * Calls the function with the specified object as the this value and the elements of specified array as the arguments.
340
+ * @param thisArg The object to be used as the this object.
341
+ * @param args An array of argument values to be passed to the function.
342
+ */
338
343
  apply<T, A extends any[], R>(this: (this: T, ...args: A) => R, thisArg: T, args: A): R;
339
344
 
340
345
  /**
@@ -348,23 +353,29 @@ interface CallableFunction extends Function {
348
353
  * For a given function, creates a bound function that has the same body as the original function.
349
354
  * The this object of the bound function is associated with the specified object, and has the specified initial parameters.
350
355
  * @param thisArg The object to be used as the this object.
351
- * @param args Arguments to bind to the parameters of the function.
352
356
  */
353
357
  bind<T>(this: T, thisArg: ThisParameterType<T>): OmitThisParameter<T>;
354
- bind<T, A0, A extends any[], R>(this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R;
355
- bind<T, A0, A1, A extends any[], R>(this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R;
356
- bind<T, A0, A1, A2, A extends any[], R>(this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R;
357
- bind<T, A0, A1, A2, A3, A extends any[], R>(this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R;
358
- bind<T, AX, R>(this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R;
358
+
359
+ /**
360
+ * For a given function, creates a bound function that has the same body as the original function.
361
+ * The this object of the bound function is associated with the specified object, and has the specified initial parameters.
362
+ * @param thisArg The object to be used as the this object.
363
+ * @param args Arguments to bind to the parameters of the function.
364
+ */
365
+ bind<T, A extends any[], B extends any[], R>(this: (this: T, ...args: [...A, ...B]) => R, thisArg: T, ...args: A): (...args: B) => R;
359
366
  }
360
367
 
361
368
  interface NewableFunction extends Function {
362
369
  /**
363
370
  * Calls the function with the specified object as the this value and the elements of specified array as the arguments.
364
371
  * @param thisArg The object to be used as the this object.
365
- * @param args An array of argument values to be passed to the function.
366
372
  */
367
373
  apply<T>(this: new () => T, thisArg: T): void;
374
+ /**
375
+ * Calls the function with the specified object as the this value and the elements of specified array as the arguments.
376
+ * @param thisArg The object to be used as the this object.
377
+ * @param args An array of argument values to be passed to the function.
378
+ */
368
379
  apply<T, A extends any[]>(this: new (...args: A) => T, thisArg: T, args: A): void;
369
380
 
370
381
  /**
@@ -378,14 +389,16 @@ interface NewableFunction extends Function {
378
389
  * For a given function, creates a bound function that has the same body as the original function.
379
390
  * The this object of the bound function is associated with the specified object, and has the specified initial parameters.
380
391
  * @param thisArg The object to be used as the this object.
381
- * @param args Arguments to bind to the parameters of the function.
382
392
  */
383
393
  bind<T>(this: T, thisArg: any): T;
384
- bind<A0, A extends any[], R>(this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R;
385
- bind<A0, A1, A extends any[], R>(this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R;
386
- bind<A0, A1, A2, A extends any[], R>(this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R;
387
- bind<A0, A1, A2, A3, A extends any[], R>(this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R;
388
- bind<AX, R>(this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R;
394
+
395
+ /**
396
+ * For a given function, creates a bound function that has the same body as the original function.
397
+ * The this object of the bound function is associated with the specified object, and has the specified initial parameters.
398
+ * @param thisArg The object to be used as the this object.
399
+ * @param args Arguments to bind to the parameters of the function.
400
+ */
401
+ bind<A extends any[], B extends any[], R>(this: new (...args: [...A, ...B]) => R, thisArg: any, ...args: A): new (...args: B) => R;
389
402
  }
390
403
 
391
404
  interface IArguments {
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.20230412`;
21
+ var version = `${versionMajorMinor}.0-insiders.20230413`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -5294,6 +5294,10 @@ 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
+ }
5297
5301
  function pathIsAbsolute(path) {
5298
5302
  return getEncodedRootLength(path) !== 0;
5299
5303
  }
@@ -5442,11 +5446,11 @@ function getPathComponents(path, currentDirectory = "") {
5442
5446
  path = combinePaths(currentDirectory, path);
5443
5447
  return pathComponents(path, getRootLength(path));
5444
5448
  }
5445
- function getPathFromPathComponents(pathComponents2) {
5449
+ function getPathFromPathComponents(pathComponents2, length2) {
5446
5450
  if (pathComponents2.length === 0)
5447
5451
  return "";
5448
5452
  const root = pathComponents2[0] && ensureTrailingDirectorySeparator(pathComponents2[0]);
5449
- return root + pathComponents2.slice(1).join(directorySeparator);
5453
+ return root + pathComponents2.slice(1, length2).join(directorySeparator);
5450
5454
  }
5451
5455
  function normalizeSlashes(path) {
5452
5456
  return path.indexOf("\\") !== -1 ? path.replace(backslashRegExp, directorySeparator) : path;
@@ -7741,7 +7745,8 @@ var Diagnostics = {
7741
7745
  _0_is_possibly_null_or_undefined: diag(18049, 1 /* Error */, "_0_is_possibly_null_or_undefined_18049", "'{0}' is possibly 'null' or 'undefined'."),
7742
7746
  The_value_0_cannot_be_used_here: diag(18050, 1 /* Error */, "The_value_0_cannot_be_used_here_18050", "The value '{0}' cannot be used here."),
7743
7747
  Compiler_option_0_cannot_be_given_an_empty_string: diag(18051, 1 /* Error */, "Compiler_option_0_cannot_be_given_an_empty_string_18051", "Compiler option '{0}' cannot be given an empty string."),
7744
- Non_abstract_class_0_does_not_implement_all_abstract_members_of_1: diag(18052, 1 /* Error */, "Non_abstract_class_0_does_not_implement_all_abstract_members_of_1_18052", "Non-abstract class '{0}' does not implement all abstract members of '{1}'")
7748
+ Non_abstract_class_0_does_not_implement_all_abstract_members_of_1: diag(18052, 1 /* Error */, "Non_abstract_class_0_does_not_implement_all_abstract_members_of_1_18052", "Non-abstract class '{0}' does not implement all abstract members of '{1}'"),
7749
+ Its_type_0_is_not_a_valid_JSX_element_type: diag(18053, 1 /* Error */, "Its_type_0_is_not_a_valid_JSX_element_type_18053", "Its type '{0}' is not a valid JSX element type.")
7745
7750
  };
7746
7751
 
7747
7752
  // src/compiler/scanner.ts
@@ -18559,7 +18564,7 @@ function createNodeFactory(flags, baseFactory2) {
18559
18564
  function createBigIntLiteral(value) {
18560
18565
  const node = createBaseToken(10 /* BigIntLiteral */);
18561
18566
  node.text = typeof value === "string" ? value : pseudoBigIntToString(value) + "n";
18562
- node.transformFlags |= 4 /* ContainsESNext */;
18567
+ node.transformFlags |= 32 /* ContainsES2020 */;
18563
18568
  return node;
18564
18569
  }
18565
18570
  function createBaseStringLiteral(text, isSingleQuote) {
@@ -20069,7 +20074,7 @@ function createNodeFactory(flags, baseFactory2) {
20069
20074
  node.transformFlags |= 1024 /* ContainsES2015 */;
20070
20075
  break;
20071
20076
  case 102 /* ImportKeyword */:
20072
- node.transformFlags |= 4 /* ContainsESNext */;
20077
+ node.transformFlags |= 32 /* ContainsES2020 */;
20073
20078
  break;
20074
20079
  default:
20075
20080
  return Debug.assertNever(keywordToken);
@@ -20597,7 +20602,7 @@ function createNodeFactory(flags, baseFactory2) {
20597
20602
  function createNamespaceExport(name) {
20598
20603
  const node = createBaseDeclaration(279 /* NamespaceExport */);
20599
20604
  node.name = name;
20600
- node.transformFlags |= propagateChildFlags(node.name) | 4 /* ContainsESNext */;
20605
+ node.transformFlags |= propagateChildFlags(node.name) | 32 /* ContainsES2020 */;
20601
20606
  node.transformFlags &= ~67108864 /* ContainsPossibleTopLevelAwait */;
20602
20607
  return node;
20603
20608
  }
@@ -44749,11 +44754,6 @@ function createTypeChecker(host) {
44749
44754
  diagnosticMessage = error(errorLocation, Diagnostics.Class_0_used_before_its_declaration, declarationName);
44750
44755
  } else if (result.flags & 256 /* RegularEnum */) {
44751
44756
  diagnosticMessage = error(errorLocation, Diagnostics.Enum_0_used_before_its_declaration, declarationName);
44752
- } else {
44753
- Debug.assert(!!(result.flags & 128 /* ConstEnum */));
44754
- if (shouldPreserveConstEnums(compilerOptions)) {
44755
- diagnosticMessage = error(errorLocation, Diagnostics.Enum_0_used_before_its_declaration, declarationName);
44756
- }
44757
44757
  }
44758
44758
  if (diagnosticMessage) {
44759
44759
  addRelatedInfo(
@@ -54064,35 +54064,7 @@ function createTypeChecker(host) {
54064
54064
  return emptyArray;
54065
54065
  }
54066
54066
  function getSignaturesOfType(type, kind) {
54067
- const result = getSignaturesOfStructuredType(getReducedApparentType(type), kind);
54068
- if (kind === 0 /* Call */ && !length(result) && type.flags & 1048576 /* Union */) {
54069
- if (type.arrayFallbackSignatures) {
54070
- return type.arrayFallbackSignatures;
54071
- }
54072
- let memberName;
54073
- if (everyType(type, (t) => {
54074
- var _a2;
54075
- return !!((_a2 = t.symbol) == null ? void 0 : _a2.parent) && isArrayOrTupleSymbol(t.symbol.parent) && (!memberName ? (memberName = t.symbol.escapedName, true) : memberName === t.symbol.escapedName);
54076
- })) {
54077
- const arrayArg = mapType(type, (t) => getMappedType((isReadonlyArraySymbol(t.symbol.parent) ? globalReadonlyArrayType : globalArrayType).typeParameters[0], t.mapper));
54078
- const arrayType = createArrayType(arrayArg, someType(type, (t) => isReadonlyArraySymbol(t.symbol.parent)));
54079
- return type.arrayFallbackSignatures = getSignaturesOfType(getTypeOfPropertyOfType(arrayType, memberName), kind);
54080
- }
54081
- type.arrayFallbackSignatures = result;
54082
- }
54083
- return result;
54084
- }
54085
- function isArrayOrTupleSymbol(symbol) {
54086
- if (!symbol || !globalArrayType.symbol || !globalReadonlyArrayType.symbol) {
54087
- return false;
54088
- }
54089
- return !!getSymbolIfSameReference(symbol, globalArrayType.symbol) || !!getSymbolIfSameReference(symbol, globalReadonlyArrayType.symbol);
54090
- }
54091
- function isReadonlyArraySymbol(symbol) {
54092
- if (!symbol || !globalReadonlyArrayType.symbol) {
54093
- return false;
54094
- }
54095
- return !!getSymbolIfSameReference(symbol, globalReadonlyArrayType.symbol);
54067
+ return getSignaturesOfStructuredType(getReducedApparentType(type), kind);
54096
54068
  }
54097
54069
  function findIndexInfo(indexInfos, keyType) {
54098
54070
  return find(indexInfos, (info) => info.keyType === keyType);
@@ -68196,6 +68168,12 @@ function createTypeChecker(host) {
68196
68168
  return getUnionType([jsxElementType, nullType]);
68197
68169
  }
68198
68170
  }
68171
+ function getJsxElementTypeTypeAt(location) {
68172
+ const type = getJsxType(JsxNames.ElementType, location);
68173
+ if (isErrorType(type))
68174
+ return void 0;
68175
+ return type;
68176
+ }
68199
68177
  function getJsxIntrinsicTagNamesAt(location) {
68200
68178
  const intrinsics = getJsxType(JsxNames.IntrinsicElements, location);
68201
68179
  return intrinsics ? getPropertiesOfType(intrinsics) : emptyArray;
@@ -68258,7 +68236,22 @@ function createTypeChecker(host) {
68258
68236
  const jsxOpeningLikeNode = node;
68259
68237
  const sig = getResolvedSignature(jsxOpeningLikeNode);
68260
68238
  checkDeprecatedSignature(sig, node);
68261
- checkJsxReturnAssignableToAppropriateBound(getJsxReferenceKind(jsxOpeningLikeNode), getReturnTypeOfSignature(sig), jsxOpeningLikeNode);
68239
+ const elementTypeConstraint = getJsxElementTypeTypeAt(jsxOpeningLikeNode);
68240
+ if (elementTypeConstraint !== void 0) {
68241
+ const tagName = jsxOpeningLikeNode.tagName;
68242
+ const tagType = isJsxIntrinsicIdentifier(tagName) ? getStringLiteralType(tagName.escapedText) : checkExpression(tagName);
68243
+ checkTypeRelatedTo(tagType, elementTypeConstraint, assignableRelation, tagName, Diagnostics.Its_type_0_is_not_a_valid_JSX_element_type, () => {
68244
+ const componentName = getTextOfNode(tagName);
68245
+ return chainDiagnosticMessages(
68246
+ /*details*/
68247
+ void 0,
68248
+ Diagnostics._0_cannot_be_used_as_a_JSX_component,
68249
+ componentName
68250
+ );
68251
+ });
68252
+ } else {
68253
+ checkJsxReturnAssignableToAppropriateBound(getJsxReferenceKind(jsxOpeningLikeNode), getReturnTypeOfSignature(sig), jsxOpeningLikeNode);
68254
+ }
68262
68255
  }
68263
68256
  }
68264
68257
  function isKnownProperty(targetType, name, isComparingJsxAttributes) {
@@ -83017,6 +83010,7 @@ var JsxNames;
83017
83010
  JsxNames2.ElementAttributesPropertyNameContainer = "ElementAttributesProperty";
83018
83011
  JsxNames2.ElementChildrenAttributeNameContainer = "ElementChildrenAttribute";
83019
83012
  JsxNames2.Element = "Element";
83013
+ JsxNames2.ElementType = "ElementType";
83020
83014
  JsxNames2.IntrinsicAttributes = "IntrinsicAttributes";
83021
83015
  JsxNames2.IntrinsicClassAttributes = "IntrinsicClassAttributes";
83022
83016
  JsxNames2.LibraryManagedAttributes = "LibraryManagedAttributes";
@@ -118132,60 +118126,62 @@ function removeIgnoredPath(path) {
118132
118126
  }
118133
118127
  return some(ignoredPaths, (searchPath) => stringContains(path, searchPath)) ? void 0 : path;
118134
118128
  }
118135
- function canWatchDirectoryOrFile(dirPath) {
118136
- const rootLength = getRootLength(dirPath);
118137
- if (dirPath.length === rootLength) {
118138
- return false;
118139
- }
118140
- let nextDirectorySeparator = dirPath.indexOf(directorySeparator, rootLength);
118141
- if (nextDirectorySeparator === -1) {
118142
- return false;
118143
- }
118144
- let pathPartForUserCheck = dirPath.substring(rootLength, nextDirectorySeparator + 1);
118145
- const isNonDirectorySeparatorRoot = rootLength > 1 || dirPath.charCodeAt(0) !== 47 /* slash */;
118146
- if (isNonDirectorySeparatorRoot && dirPath.search(/[a-zA-Z]:/) !== 0 && // Non dos style paths
118147
- pathPartForUserCheck.search(/[a-zA-Z]\$\//) === 0) {
118148
- nextDirectorySeparator = dirPath.indexOf(directorySeparator, nextDirectorySeparator + 1);
118149
- if (nextDirectorySeparator === -1) {
118150
- return false;
118151
- }
118152
- pathPartForUserCheck = dirPath.substring(rootLength + pathPartForUserCheck.length, nextDirectorySeparator + 1);
118129
+ function perceivedOsRootLengthForWatching(pathComponents2, length2) {
118130
+ if (length2 <= 1)
118131
+ return 1;
118132
+ let userCheckIndex = 1;
118133
+ let isDosStyle = pathComponents2[0].search(/[a-zA-Z]:/) === 0;
118134
+ if (pathComponents2[0] !== directorySeparator && !isDosStyle && // Non dos style paths
118135
+ pathComponents2[1].search(/[a-zA-Z]\$$/) === 0) {
118136
+ if (length2 === 2)
118137
+ return 2;
118138
+ userCheckIndex = 2;
118139
+ isDosStyle = true;
118153
118140
  }
118154
- if (isNonDirectorySeparatorRoot && pathPartForUserCheck.search(/users\//i) !== 0) {
118155
- return true;
118141
+ if (isDosStyle && !pathComponents2[userCheckIndex].match(/^users$/i)) {
118142
+ return userCheckIndex;
118156
118143
  }
118157
- for (let searchIndex = nextDirectorySeparator + 1, searchLevels = 2; searchLevels > 0; searchLevels--) {
118158
- searchIndex = dirPath.indexOf(directorySeparator, searchIndex) + 1;
118159
- if (searchIndex === 0) {
118160
- return false;
118161
- }
118162
- }
118163
- return true;
118144
+ return userCheckIndex + 2;
118164
118145
  }
118165
- function canWatchAtTypes(atTypes, rootPath) {
118166
- const dirPath = getDirectoryPath(getDirectoryPath(atTypes));
118167
- return dirPath === rootPath || canWatchDirectoryOrFile(dirPath);
118146
+ function canWatchDirectoryOrFile(pathComponents2, length2) {
118147
+ if (length2 === void 0)
118148
+ length2 = pathComponents2.length;
118149
+ if (length2 <= 2)
118150
+ return false;
118151
+ const perceivedOsRootLength = perceivedOsRootLengthForWatching(pathComponents2, length2);
118152
+ return length2 > perceivedOsRootLength + 1;
118168
118153
  }
118169
- function isInDirectoryPath(dir, file) {
118170
- if (dir === void 0 || file.length <= dir.length) {
118154
+ function canWatchAtTypes(atTypes) {
118155
+ return canWatchAffectedPackageJsonOrNodeModulesOfAtTypes(getDirectoryPath(atTypes));
118156
+ }
118157
+ function isInDirectoryPath(dirComponents, fileOrDirComponents) {
118158
+ if (fileOrDirComponents.length < fileOrDirComponents.length)
118171
118159
  return false;
118160
+ for (let i = 0; i < dirComponents.length; i++) {
118161
+ if (fileOrDirComponents[i] !== dirComponents[i])
118162
+ return false;
118172
118163
  }
118173
- return startsWith(file, dir) && file[dir.length] === directorySeparator;
118164
+ return true;
118165
+ }
118166
+ function canWatchAffectedPackageJsonOrNodeModulesOfAtTypes(fileOrDirPath) {
118167
+ return canWatchDirectoryOrFile(getPathComponents(fileOrDirPath));
118174
118168
  }
118175
118169
  function canWatchAffectingLocation(filePath) {
118176
- return canWatchDirectoryOrFile(filePath);
118177
- }
118178
- function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath, rootDir, rootPath, rootSplitLength, getCurrentDirectory) {
118179
- if (isInDirectoryPath(rootPath, failedLookupLocationPath)) {
118180
- failedLookupLocation = isRootedDiskPath(failedLookupLocation) ? normalizePath(failedLookupLocation) : getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory());
118181
- const failedLookupPathSplit = failedLookupLocationPath.split(directorySeparator);
118182
- const failedLookupSplit = failedLookupLocation.split(directorySeparator);
118183
- Debug.assert(failedLookupSplit.length === failedLookupPathSplit.length, `FailedLookup: ${failedLookupLocation} failedLookupLocationPath: ${failedLookupLocationPath}`);
118184
- if (failedLookupPathSplit.length > rootSplitLength + 1) {
118185
- return {
118186
- dir: failedLookupSplit.slice(0, rootSplitLength + 1).join(directorySeparator),
118187
- dirPath: failedLookupPathSplit.slice(0, rootSplitLength + 1).join(directorySeparator)
118188
- };
118170
+ return canWatchAffectedPackageJsonOrNodeModulesOfAtTypes(filePath);
118171
+ }
118172
+ function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath, rootDir, rootPath, rootPathComponents, getCurrentDirectory) {
118173
+ const failedLookupPathComponents = getPathComponents(failedLookupLocationPath);
118174
+ failedLookupLocation = isRootedDiskPath(failedLookupLocation) ? normalizePath(failedLookupLocation) : getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory());
118175
+ const failedLookupComponents = getPathComponents(failedLookupLocation);
118176
+ const perceivedOsRootLength = perceivedOsRootLengthForWatching(failedLookupPathComponents, failedLookupPathComponents.length);
118177
+ if (failedLookupPathComponents.length <= perceivedOsRootLength + 1)
118178
+ return void 0;
118179
+ const nodeModulesIndex = failedLookupPathComponents.indexOf("node_modules");
118180
+ if (nodeModulesIndex !== -1 && nodeModulesIndex + 1 <= perceivedOsRootLength + 1)
118181
+ return void 0;
118182
+ if (isInDirectoryPath(rootPathComponents, failedLookupPathComponents)) {
118183
+ if (failedLookupPathComponents.length > rootPathComponents.length + 1) {
118184
+ return getDirectoryOfFailedLookupWatch(failedLookupComponents, failedLookupPathComponents, Math.max(rootPathComponents.length + 1, perceivedOsRootLength + 1));
118189
118185
  } else {
118190
118186
  return {
118191
118187
  dir: rootDir,
@@ -118195,45 +118191,55 @@ function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLoo
118195
118191
  }
118196
118192
  }
118197
118193
  return getDirectoryToWatchFromFailedLookupLocationDirectory(
118198
- getDirectoryPath(getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory())),
118199
- getDirectoryPath(failedLookupLocationPath),
118200
- rootPath
118194
+ failedLookupComponents,
118195
+ failedLookupPathComponents,
118196
+ failedLookupPathComponents.length - 1,
118197
+ perceivedOsRootLength,
118198
+ nodeModulesIndex,
118199
+ rootPathComponents
118201
118200
  );
118202
118201
  }
118203
- function getDirectoryToWatchFromFailedLookupLocationDirectory(dir, dirPath, rootPath) {
118204
- while (pathContainsNodeModules(dirPath)) {
118205
- dir = getDirectoryPath(dir);
118206
- dirPath = getDirectoryPath(dirPath);
118207
- }
118208
- if (isNodeModulesDirectory(dirPath)) {
118209
- return canWatchDirectoryOrFile(getDirectoryPath(dirPath)) ? { dir, dirPath } : void 0;
118202
+ function getDirectoryToWatchFromFailedLookupLocationDirectory(dirComponents, dirPathComponents, dirPathComponentsLength, perceivedOsRootLength, nodeModulesIndex, rootPathComponents) {
118203
+ if (nodeModulesIndex !== -1) {
118204
+ return getDirectoryOfFailedLookupWatch(dirComponents, dirPathComponents, nodeModulesIndex + 1);
118210
118205
  }
118211
118206
  let nonRecursive = true;
118212
- let subDirectoryPath, subDirectory;
118213
- if (rootPath !== void 0) {
118214
- while (!isInDirectoryPath(dirPath, rootPath)) {
118215
- const parentPath = getDirectoryPath(dirPath);
118216
- if (parentPath === dirPath) {
118217
- break;
118218
- }
118207
+ let length2 = dirPathComponentsLength;
118208
+ for (let i = 0; i < dirPathComponentsLength; i++) {
118209
+ if (dirPathComponents[i] !== rootPathComponents[i]) {
118219
118210
  nonRecursive = false;
118220
- subDirectoryPath = dirPath;
118221
- subDirectory = dir;
118222
- dirPath = parentPath;
118223
- dir = getDirectoryPath(dir);
118211
+ length2 = Math.max(i + 1, perceivedOsRootLength + 1);
118212
+ break;
118224
118213
  }
118225
118214
  }
118226
- return canWatchDirectoryOrFile(dirPath) ? { dir: subDirectory || dir, dirPath: subDirectoryPath || dirPath, nonRecursive } : void 0;
118215
+ return getDirectoryOfFailedLookupWatch(dirComponents, dirPathComponents, length2, nonRecursive);
118227
118216
  }
118228
- function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath, rootPath, filterCustomPath) {
118229
- if (isInDirectoryPath(rootPath, typeRootPath)) {
118217
+ function getDirectoryOfFailedLookupWatch(dirComponents, dirPathComponents, length2, nonRecursive) {
118218
+ return {
118219
+ dir: getPathFromPathComponents(dirComponents, length2),
118220
+ dirPath: getPathFromPathComponents(dirPathComponents, length2),
118221
+ nonRecursive
118222
+ };
118223
+ }
118224
+ function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath, rootPath, rootPathComponents, getCurrentDirectory, filterCustomPath) {
118225
+ const typeRootPathComponents = getPathComponents(typeRootPath);
118226
+ if (isInDirectoryPath(rootPathComponents, typeRootPathComponents)) {
118230
118227
  return rootPath;
118231
118228
  }
118232
- const toWatch = getDirectoryToWatchFromFailedLookupLocationDirectory(typeRoot, typeRootPath, rootPath);
118229
+ typeRoot = isRootedDiskPath(typeRoot) ? normalizePath(typeRoot) : getNormalizedAbsolutePath(typeRoot, getCurrentDirectory());
118230
+ const toWatch = getDirectoryToWatchFromFailedLookupLocationDirectory(
118231
+ getPathComponents(typeRoot),
118232
+ typeRootPathComponents,
118233
+ typeRootPathComponents.length,
118234
+ perceivedOsRootLengthForWatching(typeRootPathComponents, typeRootPathComponents.length),
118235
+ typeRootPathComponents.indexOf("node_modules"),
118236
+ rootPathComponents
118237
+ );
118233
118238
  return toWatch && filterCustomPath(toWatch.dirPath) ? toWatch.dirPath : void 0;
118234
118239
  }
118235
118240
  function getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirectory) {
118236
- return rootDirForResolution && removeTrailingDirectorySeparator(getNormalizedAbsolutePath(rootDirForResolution, getCurrentDirectory()));
118241
+ const normalized = getNormalizedAbsolutePath(rootDirForResolution, getCurrentDirectory());
118242
+ return !isDiskPathRoot(normalized) ? removeTrailingDirectorySeparator(normalized) : normalized;
118237
118243
  }
118238
118244
  function createResolutionCache(resolutionHost, rootDirForResolution, logChangesWhenResolvingModule) {
118239
118245
  let filesWithChangedSetOfUnresolvedImports;
@@ -118265,13 +118271,11 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118265
118271
  resolutionHost.getCompilationSettings(),
118266
118272
  moduleResolutionCache.getPackageJsonInfoCache()
118267
118273
  );
118268
- const failedLookupDefaultExtensions = [".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */, ".json" /* Json */];
118269
- const customFailedLookupPaths = /* @__PURE__ */ new Map();
118270
118274
  const directoryWatchesOfFailedLookups = /* @__PURE__ */ new Map();
118271
118275
  const fileWatchesOfAffectingLocations = /* @__PURE__ */ new Map();
118272
118276
  const rootDir = getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirectory);
118273
- const rootPath = rootDir && resolutionHost.toPath(rootDir);
118274
- const rootSplitLength = rootPath !== void 0 ? rootPath.split(directorySeparator).length : 0;
118277
+ const rootPath = resolutionHost.toPath(rootDir);
118278
+ const rootPathComponents = getPathComponents(rootPath);
118275
118279
  const typeRootsWatches = /* @__PURE__ */ new Map();
118276
118280
  return {
118277
118281
  getModuleResolutionCache: () => moduleResolutionCache,
@@ -118305,7 +118309,6 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118305
118309
  function clear2() {
118306
118310
  clearMap(directoryWatchesOfFailedLookups, closeFileWatcherOf);
118307
118311
  clearMap(fileWatchesOfAffectingLocations, closeFileWatcherOf);
118308
- customFailedLookupPaths.clear();
118309
118312
  nonRelativeExternalModuleResolutions.clear();
118310
118313
  closeTypeRootsWatch();
118311
118314
  resolvedModuleNames.clear();
@@ -118585,9 +118588,6 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118585
118588
  function isNodeModulesAtTypesDirectory(dirPath) {
118586
118589
  return endsWith(dirPath, "/node_modules/@types");
118587
118590
  }
118588
- function isPathWithDefaultFailedLookupExtension(path) {
118589
- return fileExtensionIsOneOf(path, failedLookupDefaultExtensions);
118590
- }
118591
118591
  function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName) {
118592
118592
  var _a2, _b;
118593
118593
  if (resolution.refCount) {
@@ -118628,15 +118628,11 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118628
118628
  failedLookupLocationPath,
118629
118629
  rootDir,
118630
118630
  rootPath,
118631
- rootSplitLength,
118631
+ rootPathComponents,
118632
118632
  getCurrentDirectory
118633
118633
  );
118634
118634
  if (toWatch) {
118635
118635
  const { dir, dirPath, nonRecursive } = toWatch;
118636
- if (!isPathWithDefaultFailedLookupExtension(failedLookupLocationPath)) {
118637
- const refCount = customFailedLookupPaths.get(failedLookupLocationPath) || 0;
118638
- customFailedLookupPaths.set(failedLookupLocationPath, refCount + 1);
118639
- }
118640
118636
  if (dirPath === rootPath) {
118641
118637
  Debug.assert(nonRecursive);
118642
118638
  setAtRoot = true;
@@ -118771,20 +118767,11 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118771
118767
  failedLookupLocationPath,
118772
118768
  rootDir,
118773
118769
  rootPath,
118774
- rootSplitLength,
118770
+ rootPathComponents,
118775
118771
  getCurrentDirectory
118776
118772
  );
118777
118773
  if (toWatch) {
118778
118774
  const { dirPath } = toWatch;
118779
- const refCount = customFailedLookupPaths.get(failedLookupLocationPath);
118780
- if (refCount) {
118781
- if (refCount === 1) {
118782
- customFailedLookupPaths.delete(failedLookupLocationPath);
118783
- } else {
118784
- Debug.assert(refCount > 1);
118785
- customFailedLookupPaths.set(failedLookupLocationPath, refCount - 1);
118786
- }
118787
- }
118788
118775
  if (dirPath === rootPath) {
118789
118776
  removeAtRoot = true;
118790
118777
  } else {
@@ -118882,10 +118869,10 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118882
118869
  (failedLookupChecks || (failedLookupChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
118883
118870
  (startsWithPathChecks || (startsWithPathChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
118884
118871
  } else {
118885
- if (!isPathWithDefaultFailedLookupExtension(fileOrDirectoryPath) && !customFailedLookupPaths.has(fileOrDirectoryPath)) {
118872
+ if (isEmittedFileOfProgram(resolutionHost.getCurrentProgram(), fileOrDirectoryPath)) {
118886
118873
  return false;
118887
118874
  }
118888
- if (isEmittedFileOfProgram(resolutionHost.getCurrentProgram(), fileOrDirectoryPath)) {
118875
+ if (fileExtensionIs(fileOrDirectoryPath, ".map")) {
118889
118876
  return false;
118890
118877
  }
118891
118878
  (failedLookupChecks || (failedLookupChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
@@ -118932,7 +118919,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118932
118919
  return (_a2 = resolution.failedLookupLocations) == null ? void 0 : _a2.some((location) => isInvalidatedFailedLookup(resolutionHost.toPath(location)));
118933
118920
  }
118934
118921
  function isInvalidatedFailedLookup(locationPath) {
118935
- 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);
118922
+ 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()) || [], (dirPath) => locationPath.length > dirPath.length && startsWith(locationPath, dirPath) && (isDiskPathRoot(dirPath) || locationPath[dirPath.length] === directorySeparator) ? true : void 0);
118936
118923
  }
118937
118924
  function canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution) {
118938
118925
  var _a2;
@@ -118953,6 +118940,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118953
118940
  typeRoot,
118954
118941
  typeRootPath,
118955
118942
  rootPath,
118943
+ rootPathComponents,
118944
+ getCurrentDirectory,
118956
118945
  (dirPath2) => directoryWatchesOfFailedLookups.has(dirPath2)
118957
118946
  );
118958
118947
  if (dirPath) {
@@ -118983,7 +118972,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118983
118972
  function canWatchTypeRootPath(typeRoot) {
118984
118973
  if (resolutionHost.getCompilationSettings().typeRoots)
118985
118974
  return true;
118986
- return canWatchAtTypes(resolutionHost.toPath(typeRoot), rootPath);
118975
+ return canWatchAtTypes(resolutionHost.toPath(typeRoot));
118987
118976
  }
118988
118977
  }
118989
118978
  function resolutionIsSymlink(resolution) {