@typescript-deploys/pr-build 5.6.0-pr-59048-8 → 5.6.0-pr-59059-2

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 CHANGED
@@ -1078,10 +1078,10 @@ function matchedText(pattern, candidate) {
1078
1078
  Debug.assert(isPatternMatch(pattern, candidate));
1079
1079
  return candidate.substring(pattern.prefix.length, candidate.length - pattern.suffix.length);
1080
1080
  }
1081
- function findBestPatternMatch(values, getPattern, candidate, endIndex = values.length) {
1081
+ function findBestPatternMatch(values, getPattern, candidate) {
1082
1082
  let matchedValue;
1083
1083
  let longestMatchPrefixLength = -1;
1084
- for (let i = 0; i < endIndex; i++) {
1084
+ for (let i = 0; i < values.length; i++) {
1085
1085
  const v = values[i];
1086
1086
  const pattern = getPattern(v);
1087
1087
  if (isPatternMatch(pattern, candidate) && pattern.prefix.length > longestMatchPrefixLength) {
@@ -4902,6 +4902,7 @@ var sys = (() => {
4902
4902
  writeFile: writeFile2,
4903
4903
  watchFile: watchFile2,
4904
4904
  watchDirectory,
4905
+ preferNonRecursiveWatch: !fsSupportsRecursiveFsWatch,
4905
4906
  resolvePath: (path) => _path.resolve(path),
4906
4907
  fileExists,
4907
4908
  directoryExists,
@@ -18304,65 +18305,17 @@ var emptyFileSystemEntries = {
18304
18305
  files: emptyArray,
18305
18306
  directories: emptyArray
18306
18307
  };
18307
- var patternOrStringsCache = /* @__PURE__ */ new WeakMap();
18308
18308
  function matchPatternOrExact(patternOrStrings, candidate) {
18309
- let matchableStringSet;
18310
- let sortedPatterns;
18311
- const cacheEntry = patternOrStringsCache.get(patternOrStrings);
18312
- if (cacheEntry !== void 0) {
18313
- ({ matchableStringSet, sortedPatterns } = cacheEntry);
18314
- } else {
18315
- matchableStringSet = /* @__PURE__ */ new Set();
18316
- sortedPatterns = [];
18317
- for (const patternOrString of patternOrStrings) {
18318
- if (typeof patternOrString === "string") {
18319
- matchableStringSet.add(patternOrString);
18320
- } else {
18321
- sortedPatterns.push(patternOrString);
18322
- }
18323
- }
18324
- sortedPatterns.sort((a, b) => compareStringsCaseSensitive(a.prefix, b.prefix));
18325
- patternOrStringsCache.set(patternOrStrings, {
18326
- matchableStringSet,
18327
- sortedPatterns
18328
- });
18329
- }
18330
- if (matchableStringSet.has(candidate)) {
18331
- return candidate;
18332
- }
18333
- if (sortedPatterns.length === 0) {
18334
- return void 0;
18335
- }
18336
- let index = binarySearchKey(sortedPatterns, candidate, getPatternPrefix, compareStringsCaseSensitive);
18337
- if (index < 0) {
18338
- index = ~index;
18339
- }
18340
- if (index >= sortedPatterns.length) {
18341
- index--;
18342
- }
18343
- const groupPrefix = sortedPatterns[index].prefix;
18344
- while (index > 0 && groupPrefix === sortedPatterns[index - 1].prefix) {
18345
- index--;
18346
- }
18347
- for (let i = index; i < sortedPatterns.length; i++) {
18348
- const currentPattern = sortedPatterns[i];
18349
- if (currentPattern.prefix !== groupPrefix) {
18350
- break;
18309
+ const patterns = [];
18310
+ for (const patternOrString of patternOrStrings) {
18311
+ if (patternOrString === candidate) {
18312
+ return candidate;
18351
18313
  }
18352
- if (isPatternMatch(currentPattern, candidate)) {
18353
- return currentPattern;
18314
+ if (!isString(patternOrString)) {
18315
+ patterns.push(patternOrString);
18354
18316
  }
18355
18317
  }
18356
- return findBestPatternMatch(
18357
- sortedPatterns,
18358
- (_) => _,
18359
- candidate,
18360
- /*endIndex*/
18361
- index
18362
- );
18363
- }
18364
- function getPatternPrefix(pattern) {
18365
- return pattern.prefix;
18318
+ return findBestPatternMatch(patterns, (_) => _, candidate);
18366
18319
  }
18367
18320
  function sliceAfter(arr, value) {
18368
18321
  const index = arr.indexOf(value);
@@ -67644,7 +67597,11 @@ function createTypeChecker(host) {
67644
67597
  }
67645
67598
  function getTypeFactsWorker(type, callerOnlyNeeds) {
67646
67599
  if (type.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */)) {
67647
- type = getBaseConstraintOfType(type) || unknownType;
67600
+ const constraintType = getBaseConstraintOfType(type) || unknownType;
67601
+ if (strictNullChecks && type.flags & 465829888 /* Instantiable */ && constraintType === unknownType) {
67602
+ return callerOnlyNeeds;
67603
+ }
67604
+ type = constraintType;
67648
67605
  }
67649
67606
  const flags = type.flags;
67650
67607
  if (flags & (4 /* String */ | 268435456 /* StringMapping */)) {
@@ -67744,7 +67701,7 @@ function createTypeChecker(host) {
67744
67701
  return type;
67745
67702
  }
67746
67703
  const emptyAndOtherUnion = getUnionType([emptyObjectType, otherType]);
67747
- return mapType(type, (t) => hasTypeFacts(t, targetFacts) ? getIntersectionType([t, !(facts & otherIncludesFacts) && hasTypeFacts(t, otherFacts) ? emptyAndOtherUnion : emptyObjectType]) : t);
67704
+ return mapType(type, (t) => hasTypeFacts(t, targetFacts) ? getIntersectionType([t, (strictNullChecks || !(facts & otherIncludesFacts)) && hasTypeFacts(t, otherFacts) ? emptyAndOtherUnion : emptyObjectType]) : t);
67748
67705
  }
67749
67706
  function recombineUnknownType(type) {
67750
67707
  return type === unknownUnionType ? unknownType : type;
@@ -124354,7 +124311,7 @@ function canWatchAffectedPackageJsonOrNodeModulesOfAtTypes(fileOrDirPath) {
124354
124311
  function canWatchAffectingLocation(filePath) {
124355
124312
  return canWatchAffectedPackageJsonOrNodeModulesOfAtTypes(filePath);
124356
124313
  }
124357
- function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath, rootDir, rootPath, rootPathComponents, getCurrentDirectory) {
124314
+ function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath, rootDir, rootPath, rootPathComponents, getCurrentDirectory, preferNonRecursiveWatch) {
124358
124315
  const failedLookupPathComponents = getPathComponents(failedLookupLocationPath);
124359
124316
  failedLookupLocation = isRootedDiskPath(failedLookupLocation) ? normalizePath(failedLookupLocation) : getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory());
124360
124317
  const failedLookupComponents = getPathComponents(failedLookupLocation);
@@ -124386,10 +124343,11 @@ function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLoo
124386
124343
  perceivedOsRootLength,
124387
124344
  nodeModulesIndex,
124388
124345
  rootPathComponents,
124389
- lastNodeModulesIndex
124346
+ lastNodeModulesIndex,
124347
+ preferNonRecursiveWatch
124390
124348
  );
124391
124349
  }
124392
- function getDirectoryToWatchFromFailedLookupLocationDirectory(dirComponents, dirPathComponents, dirPathComponentsLength, perceivedOsRootLength, nodeModulesIndex, rootPathComponents, lastNodeModulesIndex) {
124350
+ function getDirectoryToWatchFromFailedLookupLocationDirectory(dirComponents, dirPathComponents, dirPathComponentsLength, perceivedOsRootLength, nodeModulesIndex, rootPathComponents, lastNodeModulesIndex, preferNonRecursiveWatch) {
124393
124351
  if (nodeModulesIndex !== -1) {
124394
124352
  return getDirectoryOfFailedLookupWatch(
124395
124353
  dirComponents,
@@ -124400,11 +124358,13 @@ function getDirectoryToWatchFromFailedLookupLocationDirectory(dirComponents, dir
124400
124358
  }
124401
124359
  let nonRecursive = true;
124402
124360
  let length2 = dirPathComponentsLength;
124403
- for (let i = 0; i < dirPathComponentsLength; i++) {
124404
- if (dirPathComponents[i] !== rootPathComponents[i]) {
124405
- nonRecursive = false;
124406
- length2 = Math.max(i + 1, perceivedOsRootLength + 1);
124407
- break;
124361
+ if (!preferNonRecursiveWatch) {
124362
+ for (let i = 0; i < dirPathComponentsLength; i++) {
124363
+ if (dirPathComponents[i] !== rootPathComponents[i]) {
124364
+ nonRecursive = false;
124365
+ length2 = Math.max(i + 1, perceivedOsRootLength + 1);
124366
+ break;
124367
+ }
124408
124368
  }
124409
124369
  }
124410
124370
  return getDirectoryOfFailedLookupWatch(
@@ -124432,7 +124392,7 @@ function getDirectoryOfFailedLookupWatch(dirComponents, dirPathComponents, lengt
124432
124392
  packageDirPath: packageDirLength !== void 0 ? getPathFromPathComponents(dirPathComponents, packageDirLength) : void 0
124433
124393
  };
124434
124394
  }
124435
- function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath, rootPath, rootPathComponents, getCurrentDirectory, filterCustomPath) {
124395
+ function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath, rootPath, rootPathComponents, getCurrentDirectory, preferNonRecursiveWatch, filterCustomPath) {
124436
124396
  const typeRootPathComponents = getPathComponents(typeRootPath);
124437
124397
  if (isInDirectoryPath(rootPathComponents, typeRootPathComponents)) {
124438
124398
  return rootPath;
@@ -124445,7 +124405,8 @@ function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootP
124445
124405
  perceivedOsRootLengthForWatching(typeRootPathComponents, typeRootPathComponents.length),
124446
124406
  typeRootPathComponents.indexOf("node_modules"),
124447
124407
  rootPathComponents,
124448
- typeRootPathComponents.lastIndexOf("node_modules")
124408
+ typeRootPathComponents.lastIndexOf("node_modules"),
124409
+ preferNonRecursiveWatch
124449
124410
  );
124450
124411
  return toWatch && filterCustomPath(toWatch.dirPath) ? toWatch.dirPath : void 0;
124451
124412
  }
@@ -124954,7 +124915,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
124954
124915
  rootDir,
124955
124916
  rootPath,
124956
124917
  rootPathComponents,
124957
- getCurrentDirectory
124918
+ getCurrentDirectory,
124919
+ resolutionHost.preferNonRecursiveWatch
124958
124920
  );
124959
124921
  if (toWatch) {
124960
124922
  const { dir, dirPath, nonRecursive, packageDir, packageDirPath } = toWatch;
@@ -125153,7 +125115,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
125153
125115
  rootDir,
125154
125116
  rootPath,
125155
125117
  rootPathComponents,
125156
- getCurrentDirectory
125118
+ getCurrentDirectory,
125119
+ resolutionHost.preferNonRecursiveWatch
125157
125120
  );
125158
125121
  if (toWatch) {
125159
125122
  const { dirPath, packageDirPath } = toWatch;
@@ -125381,6 +125344,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
125381
125344
  rootPath,
125382
125345
  rootPathComponents,
125383
125346
  getCurrentDirectory,
125347
+ resolutionHost.preferNonRecursiveWatch,
125384
125348
  (dirPath2) => directoryWatchesOfFailedLookups.has(dirPath2) || dirPathToSymlinkPackageRefCount.has(dirPath2)
125385
125349
  );
125386
125350
  if (dirPath) {
@@ -125849,7 +125813,8 @@ function createWatchHost(system = sys, reportWatchStatus2) {
125849
125813
  watchFile: maybeBind(system, system.watchFile) || returnNoopFileWatcher,
125850
125814
  watchDirectory: maybeBind(system, system.watchDirectory) || returnNoopFileWatcher,
125851
125815
  setTimeout: maybeBind(system, system.setTimeout) || noop,
125852
- clearTimeout: maybeBind(system, system.clearTimeout) || noop
125816
+ clearTimeout: maybeBind(system, system.clearTimeout) || noop,
125817
+ preferNonRecursiveWatch: system.preferNonRecursiveWatch
125853
125818
  };
125854
125819
  }
125855
125820
  var WatchType = {
@@ -126155,6 +126120,7 @@ function createWatchProgram(host) {
126155
126120
  compilerHost.toPath = toPath3;
126156
126121
  compilerHost.getCompilationSettings = () => compilerOptions;
126157
126122
  compilerHost.useSourceOfProjectReferenceRedirect = maybeBind(host, host.useSourceOfProjectReferenceRedirect);
126123
+ compilerHost.preferNonRecursiveWatch = host.preferNonRecursiveWatch;
126158
126124
  compilerHost.watchDirectoryOfFailedLookupLocation = (dir, cb, flags) => watchDirectory(dir, cb, flags, watchOptions, WatchType.FailedLookupLocations);
126159
126125
  compilerHost.watchAffectingFileLocation = (file, cb) => watchFile2(file, cb, 2e3 /* High */, watchOptions, WatchType.AffectingFileLocation);
126160
126126
  compilerHost.watchTypeRootsDirectory = (dir, cb, flags) => watchDirectory(dir, cb, flags, watchOptions, WatchType.TypeRoots);
@@ -2651,6 +2651,7 @@ declare namespace ts {
2651
2651
  interface ServerHost extends System {
2652
2652
  watchFile(path: string, callback: FileWatcherCallback, pollingInterval?: number, options?: WatchOptions): FileWatcher;
2653
2653
  watchDirectory(path: string, callback: DirectoryWatcherCallback, recursive?: boolean, options?: WatchOptions): FileWatcher;
2654
+ preferNonRecursiveWatch?: boolean;
2654
2655
  setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): any;
2655
2656
  clearTimeout(timeoutId: any): void;
2656
2657
  setImmediate(callback: (...args: any[]) => void, ...args: any[]): any;
@@ -9591,6 +9592,7 @@ declare namespace ts {
9591
9592
  setTimeout?(callback: (...args: any[]) => void, ms: number, ...args: any[]): any;
9592
9593
  /** If provided, will be used to reset existing delayed compilation */
9593
9594
  clearTimeout?(timeoutId: any): void;
9595
+ preferNonRecursiveWatch?: boolean;
9594
9596
  }
9595
9597
  interface ProgramHost<T extends BuilderProgram> {
9596
9598
  /**