@typescript-deploys/pr-build 5.4.0-pr-55015-10 → 5.4.0-pr-55774-37

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
@@ -4521,6 +4521,7 @@ function createSystemWatchFunctions({
4521
4521
  useNonPollingWatchers,
4522
4522
  tscWatchDirectory,
4523
4523
  inodeWatching,
4524
+ fsWatchWithTimestamp,
4524
4525
  sysLog: sysLog2
4525
4526
  }) {
4526
4527
  const pollingWatches = /* @__PURE__ */ new Map();
@@ -4759,7 +4760,7 @@ function createSystemWatchFunctions({
4759
4760
  return watchPresentFileSystemEntryWithFsWatchFile();
4760
4761
  }
4761
4762
  try {
4762
- const presentWatcher = fsWatchWorker(
4763
+ const presentWatcher = (!fsWatchWithTimestamp ? fsWatchWorker : fsWatchWorkerHandlingTimestamp)(
4763
4764
  fileOrDirectory,
4764
4765
  recursive,
4765
4766
  inodeWatching ? callbackChangingToMissingFileSystemEntry : callback
@@ -4822,6 +4823,18 @@ function createSystemWatchFunctions({
4822
4823
  );
4823
4824
  }
4824
4825
  }
4826
+ function fsWatchWorkerHandlingTimestamp(fileOrDirectory, recursive, callback) {
4827
+ let modifiedTime = getModifiedTime3(fileOrDirectory) || missingFileModifiedTime;
4828
+ return fsWatchWorker(fileOrDirectory, recursive, (eventName, relativeFileName, currentModifiedTime) => {
4829
+ if (eventName === "change") {
4830
+ currentModifiedTime || (currentModifiedTime = getModifiedTime3(fileOrDirectory) || missingFileModifiedTime);
4831
+ if (currentModifiedTime.getTime() === modifiedTime.getTime())
4832
+ return;
4833
+ }
4834
+ modifiedTime = currentModifiedTime || getModifiedTime3(fileOrDirectory) || missingFileModifiedTime;
4835
+ callback(eventName, relativeFileName, modifiedTime);
4836
+ });
4837
+ }
4825
4838
  }
4826
4839
  function patchWriteFileEnsuringDirectory(sys2) {
4827
4840
  const originalWriteFile = sys2.writeFile;
@@ -4850,12 +4863,13 @@ var sys = (() => {
4850
4863
  let activeSession;
4851
4864
  let profilePath = "./profile.cpuprofile";
4852
4865
  const Buffer = require("buffer").Buffer;
4853
- const isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
4866
+ const isMacOs = process.platform === "darwin";
4867
+ const isLinuxOrMacOs = process.platform === "linux" || isMacOs;
4854
4868
  const platform = _os.platform();
4855
4869
  const useCaseSensitiveFileNames2 = isFileSystemCaseSensitive();
4856
4870
  const fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync;
4857
4871
  const executingFilePath = __filename.endsWith("sys.js") ? _path.join(_path.dirname(__dirname), "__fake__.js") : __filename;
4858
- const fsSupportsRecursiveFsWatch = process.platform === "win32" || process.platform === "darwin";
4872
+ const fsSupportsRecursiveFsWatch = process.platform === "win32" || isMacOs;
4859
4873
  const getCurrentDirectory = memoize(() => process.cwd());
4860
4874
  const { watchFile: watchFile2, watchDirectory } = createSystemWatchFunctions({
4861
4875
  pollingWatchFileWorker: fsWatchFileWorker,
@@ -4875,6 +4889,7 @@ var sys = (() => {
4875
4889
  useNonPollingWatchers: !!process.env.TSC_NONPOLLING_WATCHER,
4876
4890
  tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
4877
4891
  inodeWatching: isLinuxOrMacOs,
4892
+ fsWatchWithTimestamp: isMacOs,
4878
4893
  sysLog
4879
4894
  });
4880
4895
  const nodeSystem = {
@@ -16448,22 +16463,6 @@ function getResolvePackageJsonExports(compilerOptions) {
16448
16463
  }
16449
16464
  return false;
16450
16465
  }
16451
- function getResolvePackageJsonImports(compilerOptions) {
16452
- const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
16453
- if (!moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
16454
- return false;
16455
- }
16456
- if (compilerOptions.resolvePackageJsonExports !== void 0) {
16457
- return compilerOptions.resolvePackageJsonExports;
16458
- }
16459
- switch (moduleResolution) {
16460
- case 3 /* Node16 */:
16461
- case 99 /* NodeNext */:
16462
- case 100 /* Bundler */:
16463
- return true;
16464
- }
16465
- return false;
16466
- }
16467
16466
  function getResolveJsonModule(compilerOptions) {
16468
16467
  if (compilerOptions.resolveJsonModule !== void 0) {
16469
16468
  return compilerOptions.resolveJsonModule;
@@ -42377,13 +42376,6 @@ function createGetSymbolWalker(getRestTypeOfSignature, getTypePredicateOfSignatu
42377
42376
  }
42378
42377
 
42379
42378
  // src/compiler/moduleSpecifiers.ts
42380
- function safeJsonRead(packageJsonPath, readFile) {
42381
- try {
42382
- return JSON.parse(readFile(packageJsonPath));
42383
- } catch {
42384
- return {};
42385
- }
42386
- }
42387
42379
  function getPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding }, compilerOptions, importingSourceFile, oldImportSpecifier) {
42388
42380
  const preferredEnding = getPreferredEnding();
42389
42381
  return {
@@ -42576,7 +42568,7 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
42576
42568
  const { sourceDirectory, getCanonicalFileName } = info;
42577
42569
  const allowedEndings = getAllowedEndingsInPrefererredOrder(importMode);
42578
42570
  const relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, allowedEndings, compilerOptions) || processEnding(ensurePathIsNonModuleName(getRelativePathFromDirectory(sourceDirectory, moduleFileName, getCanonicalFileName)), allowedEndings, compilerOptions);
42579
- if (!baseUrl && !paths && !getResolvePackageJsonImports(compilerOptions) || relativePreference === 0 /* Relative */) {
42571
+ if (!baseUrl && !paths || relativePreference === 0 /* Relative */) {
42580
42572
  return pathsOnly ? void 0 : relativePath;
42581
42573
  }
42582
42574
  const baseDirectory = getNormalizedAbsolutePath(getPathsBasePath(compilerOptions, host) || baseUrl, host.getCurrentDirectory());
@@ -42584,12 +42576,11 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
42584
42576
  if (!relativeToBaseUrl) {
42585
42577
  return pathsOnly ? void 0 : relativePath;
42586
42578
  }
42587
- const fromPackageJsonImports = pathsOnly ? void 0 : tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory, compilerOptions, host, importMode);
42588
- const fromPaths = pathsOnly || fromPackageJsonImports === void 0 ? paths && tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) : void 0;
42579
+ const fromPaths = paths && tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions);
42589
42580
  if (pathsOnly) {
42590
42581
  return fromPaths;
42591
42582
  }
42592
- const maybeNonRelative = fromPackageJsonImports ?? (fromPaths === void 0 && baseUrl !== void 0 ? processEnding(relativeToBaseUrl, allowedEndings, compilerOptions) : fromPaths);
42583
+ const maybeNonRelative = fromPaths === void 0 && baseUrl !== void 0 ? processEnding(relativeToBaseUrl, allowedEndings, compilerOptions) : fromPaths;
42593
42584
  if (!maybeNonRelative) {
42594
42585
  return relativePath;
42595
42586
  }
@@ -42628,8 +42619,8 @@ function getNearestAncestorDirectoryWithPackageJson(host, fileName) {
42628
42619
  if (host.getNearestAncestorDirectoryWithPackageJson) {
42629
42620
  return host.getNearestAncestorDirectoryWithPackageJson(fileName);
42630
42621
  }
42631
- return forEachAncestorDirectory(fileName, (directory) => {
42632
- return host.fileExists(combinePaths(directory, "package.json")) ? directory : void 0;
42622
+ return !!forEachAncestorDirectory(fileName, (directory) => {
42623
+ return host.fileExists(combinePaths(directory, "package.json")) ? true : void 0;
42633
42624
  });
42634
42625
  }
42635
42626
  function forEachFileNameOfModule(importingFileName, importedFileName, host, preferSymlinks, cb) {
@@ -42800,40 +42791,8 @@ function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, hos
42800
42791
  return ending !== 0 /* Minimal */ || value === processEnding(relativeToBaseUrl, [ending], compilerOptions, host);
42801
42792
  }
42802
42793
  }
42803
- function getOutputPath(targetFilePath, options, commonSourceDirectory) {
42804
- return changeExtension(
42805
- options.outDir ? resolvePath(
42806
- options.outDir,
42807
- getRelativePathFromDirectory(
42808
- commonSourceDirectory,
42809
- targetFilePath,
42810
- /*ignoreCase*/
42811
- false
42812
- )
42813
- ) : targetFilePath,
42814
- getOutputExtension(targetFilePath, options)
42815
- );
42816
- }
42817
- function getOutputDeclarationPath(targetFilePath, options, commonSourceDirectory) {
42818
- const declarationDir = options.declarationDir || options.outDir;
42819
- return changeExtension(
42820
- declarationDir ? resolvePath(
42821
- declarationDir,
42822
- getRelativePathFromDirectory(
42823
- commonSourceDirectory,
42824
- targetFilePath,
42825
- /*ignoreCase*/
42826
- false
42827
- )
42828
- ) : targetFilePath,
42829
- getDeclarationEmitExtensionForPath(targetFilePath)
42830
- );
42831
- }
42832
- function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, exports, conditions, mode, isImports) {
42794
+ function tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, exports, conditions, mode = 0 /* Exact */) {
42833
42795
  if (typeof exports === "string") {
42834
- const commonSourceDirectory = host.getCommonSourceDirectory();
42835
- const outputFile = isImports && getOutputPath(targetFilePath, options, commonSourceDirectory);
42836
- const declarationFile = isImports && getOutputDeclarationPath(targetFilePath, options, commonSourceDirectory);
42837
42796
  const pathOrPattern = getNormalizedAbsolutePath(
42838
42797
  combinePaths(packageDirectory, exports),
42839
42798
  /*currentDirectory*/
@@ -42842,24 +42801,11 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
42842
42801
  const extensionSwappedTarget = hasTSFileExtension(targetFilePath) ? removeFileExtension(targetFilePath) + tryGetJSExtensionForFile(targetFilePath, options) : void 0;
42843
42802
  switch (mode) {
42844
42803
  case 0 /* Exact */:
42845
- if (extensionSwappedTarget && comparePaths(extensionSwappedTarget, pathOrPattern) === 0 /* EqualTo */ || comparePaths(targetFilePath, pathOrPattern) === 0 /* EqualTo */ || outputFile && comparePaths(outputFile, pathOrPattern) === 0 /* EqualTo */ || declarationFile && comparePaths(declarationFile, pathOrPattern) === 0 /* EqualTo */) {
42804
+ if (comparePaths(targetFilePath, pathOrPattern) === 0 /* EqualTo */ || extensionSwappedTarget && comparePaths(extensionSwappedTarget, pathOrPattern) === 0 /* EqualTo */) {
42846
42805
  return { moduleFileToTry: packageName };
42847
42806
  }
42848
42807
  break;
42849
42808
  case 1 /* Directory */:
42850
- if (extensionSwappedTarget && containsPath(pathOrPattern, extensionSwappedTarget)) {
42851
- const fragment = getRelativePathFromDirectory(
42852
- pathOrPattern,
42853
- extensionSwappedTarget,
42854
- /*ignoreCase*/
42855
- false
42856
- );
42857
- return { moduleFileToTry: getNormalizedAbsolutePath(
42858
- combinePaths(combinePaths(packageName, exports), fragment),
42859
- /*currentDirectory*/
42860
- void 0
42861
- ) };
42862
- }
42863
42809
  if (containsPath(pathOrPattern, targetFilePath)) {
42864
42810
  const fragment = getRelativePathFromDirectory(
42865
42811
  pathOrPattern,
@@ -42873,136 +42819,48 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
42873
42819
  void 0
42874
42820
  ) };
42875
42821
  }
42876
- if (outputFile && containsPath(pathOrPattern, outputFile)) {
42877
- const fragment = getRelativePathFromDirectory(
42878
- pathOrPattern,
42879
- outputFile,
42880
- /*ignoreCase*/
42881
- false
42882
- );
42883
- return { moduleFileToTry: combinePaths(packageName, fragment) };
42884
- }
42885
- if (declarationFile && containsPath(pathOrPattern, declarationFile)) {
42886
- const fragment = getRelativePathFromDirectory(
42887
- pathOrPattern,
42888
- declarationFile,
42889
- /*ignoreCase*/
42890
- false
42891
- );
42892
- return { moduleFileToTry: combinePaths(packageName, fragment) };
42893
- }
42894
42822
  break;
42895
42823
  case 2 /* Pattern */:
42896
42824
  const starPos = pathOrPattern.indexOf("*");
42897
42825
  const leadingSlice = pathOrPattern.slice(0, starPos);
42898
42826
  const trailingSlice = pathOrPattern.slice(starPos + 1);
42899
- if (extensionSwappedTarget && startsWith(extensionSwappedTarget, leadingSlice) && endsWith(extensionSwappedTarget, trailingSlice)) {
42900
- const starReplacement = extensionSwappedTarget.slice(leadingSlice.length, extensionSwappedTarget.length - trailingSlice.length);
42901
- return { moduleFileToTry: packageName.replace("*", starReplacement) };
42902
- }
42903
42827
  if (startsWith(targetFilePath, leadingSlice) && endsWith(targetFilePath, trailingSlice)) {
42904
42828
  const starReplacement = targetFilePath.slice(leadingSlice.length, targetFilePath.length - trailingSlice.length);
42905
42829
  return { moduleFileToTry: packageName.replace("*", starReplacement) };
42906
42830
  }
42907
- if (outputFile && startsWith(outputFile, leadingSlice) && endsWith(outputFile, trailingSlice)) {
42908
- const starReplacement = outputFile.slice(leadingSlice.length, outputFile.length - trailingSlice.length);
42909
- return { moduleFileToTry: packageName.replace("*", starReplacement) };
42910
- }
42911
- if (declarationFile && startsWith(declarationFile, leadingSlice) && endsWith(declarationFile, trailingSlice)) {
42912
- const starReplacement = declarationFile.slice(leadingSlice.length, declarationFile.length - trailingSlice.length);
42831
+ if (extensionSwappedTarget && startsWith(extensionSwappedTarget, leadingSlice) && endsWith(extensionSwappedTarget, trailingSlice)) {
42832
+ const starReplacement = extensionSwappedTarget.slice(leadingSlice.length, extensionSwappedTarget.length - trailingSlice.length);
42913
42833
  return { moduleFileToTry: packageName.replace("*", starReplacement) };
42914
42834
  }
42915
42835
  break;
42916
42836
  }
42917
42837
  } else if (Array.isArray(exports)) {
42918
- return forEach(exports, (e) => tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, e, conditions, mode, isImports));
42838
+ return forEach(exports, (e) => tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, e, conditions));
42919
42839
  } else if (typeof exports === "object" && exports !== null) {
42920
- for (const key of getOwnKeys(exports)) {
42921
- if (key === "default" || conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(conditions, key)) {
42922
- const subTarget = exports[key];
42923
- const result = tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode, isImports);
42924
- if (result) {
42925
- return result;
42840
+ if (allKeysStartWithDot(exports)) {
42841
+ return forEach(getOwnKeys(exports), (k) => {
42842
+ const subPackageName = getNormalizedAbsolutePath(
42843
+ combinePaths(packageName, k),
42844
+ /*currentDirectory*/
42845
+ void 0
42846
+ );
42847
+ const mode2 = endsWith(k, "/") ? 1 /* Directory */ : k.includes("*") ? 2 /* Pattern */ : 0 /* Exact */;
42848
+ return tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, subPackageName, exports[k], conditions, mode2);
42849
+ });
42850
+ } else {
42851
+ for (const key of getOwnKeys(exports)) {
42852
+ if (key === "default" || conditions.includes(key) || isApplicableVersionedTypesKey(conditions, key)) {
42853
+ const subTarget = exports[key];
42854
+ const result = tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode);
42855
+ if (result) {
42856
+ return result;
42857
+ }
42926
42858
  }
42927
42859
  }
42928
42860
  }
42929
42861
  }
42930
42862
  return void 0;
42931
42863
  }
42932
- function tryGetModuleNameFromExports(options, host, targetFilePath, packageDirectory, packageName, exports, conditions) {
42933
- if (typeof exports === "object" && exports !== null && !Array.isArray(exports) && allKeysStartWithDot(exports)) {
42934
- return forEach(getOwnKeys(exports), (k) => {
42935
- const subPackageName = getNormalizedAbsolutePath(
42936
- combinePaths(packageName, k),
42937
- /*currentDirectory*/
42938
- void 0
42939
- );
42940
- const mode = endsWith(k, "/") ? 1 /* Directory */ : k.includes("*") ? 2 /* Pattern */ : 0 /* Exact */;
42941
- return tryGetModuleNameFromExportsOrImports(
42942
- options,
42943
- host,
42944
- targetFilePath,
42945
- packageDirectory,
42946
- subPackageName,
42947
- exports[k],
42948
- conditions,
42949
- mode,
42950
- /*isImports*/
42951
- false
42952
- );
42953
- });
42954
- }
42955
- return tryGetModuleNameFromExportsOrImports(
42956
- options,
42957
- host,
42958
- targetFilePath,
42959
- packageDirectory,
42960
- packageName,
42961
- exports,
42962
- conditions,
42963
- 0 /* Exact */,
42964
- /*isImports*/
42965
- false
42966
- );
42967
- }
42968
- function tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory, options, host, importMode) {
42969
- var _a, _b, _c;
42970
- if (!host.readFile || !getResolvePackageJsonImports(options)) {
42971
- return void 0;
42972
- }
42973
- const ancestorDirectoryWithPackageJson = getNearestAncestorDirectoryWithPackageJson(host, sourceDirectory);
42974
- if (!ancestorDirectoryWithPackageJson) {
42975
- return void 0;
42976
- }
42977
- const packageJsonPath = combinePaths(ancestorDirectoryWithPackageJson, "package.json");
42978
- const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
42979
- if (typeof cachedPackageJson !== "object" && cachedPackageJson !== void 0 || !host.fileExists(packageJsonPath)) {
42980
- return void 0;
42981
- }
42982
- const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || safeJsonRead(packageJsonPath, host.readFile);
42983
- const imports = packageJsonContent == null ? void 0 : packageJsonContent.imports;
42984
- if (!imports) {
42985
- return void 0;
42986
- }
42987
- const conditions = getConditions(options, importMode);
42988
- return (_c = forEach(getOwnKeys(imports), (k) => {
42989
- if (!startsWith(k, "#") || k === "#" || startsWith(k, "#/"))
42990
- return void 0;
42991
- const mode = endsWith(k, "/") ? 1 /* Directory */ : k.includes("*") ? 2 /* Pattern */ : 0 /* Exact */;
42992
- return tryGetModuleNameFromExportsOrImports(
42993
- options,
42994
- host,
42995
- moduleFileName,
42996
- ancestorDirectoryWithPackageJson,
42997
- k,
42998
- imports[k],
42999
- conditions,
43000
- mode,
43001
- /*isImports*/
43002
- true
43003
- );
43004
- })) == null ? void 0 : _c.moduleFileToTry;
43005
- }
43006
42864
  function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, allowedEndings, compilerOptions) {
43007
42865
  const normalizedTargetPaths = getPathsRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName);
43008
42866
  if (normalizedTargetPaths === void 0) {
@@ -43076,15 +42934,16 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
43076
42934
  let maybeBlockedByTypesVersions = false;
43077
42935
  const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
43078
42936
  if (typeof cachedPackageJson === "object" || cachedPackageJson === void 0 && host.fileExists(packageJsonPath)) {
43079
- const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || safeJsonRead(packageJsonPath, host.readFile);
42937
+ const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
43080
42938
  const importMode = overrideMode || importingSourceFile.impliedNodeFormat;
43081
42939
  if (getResolvePackageJsonExports(options)) {
43082
42940
  const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
43083
42941
  const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
43084
42942
  const conditions = getConditions(options, importMode);
43085
- const fromExports = packageJsonContent.exports ? tryGetModuleNameFromExports(options, host, path, packageRootPath, packageName2, packageJsonContent.exports, conditions) : void 0;
42943
+ const fromExports = packageJsonContent.exports ? tryGetModuleNameFromExports(options, path, packageRootPath, packageName2, packageJsonContent.exports, conditions) : void 0;
43086
42944
  if (fromExports) {
43087
- return { ...fromExports, verbatimFromExports: true };
42945
+ const withJsExtension = !hasTSFileExtension(fromExports.moduleFileToTry) ? fromExports : { moduleFileToTry: removeFileExtension(fromExports.moduleFileToTry) + tryGetJSExtensionForFile(fromExports.moduleFileToTry, options) };
42946
+ return { ...withJsExtension, verbatimFromExports: true };
43088
42947
  }
43089
42948
  if (packageJsonContent.exports) {
43090
42949
  return { moduleFileToTry: path, blockedByExports: true };
@@ -54379,6 +54238,14 @@ function createTypeChecker(host) {
54379
54238
  return getCheckFlags(s) & 4096 /* Late */;
54380
54239
  }
54381
54240
  function forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(type, include, stringsOnly, cb) {
54241
+ if (isTupleType(type)) {
54242
+ forEachType(getUnionType(getElementTypes(type).map((_, i) => getStringLiteralType("" + i))), cb);
54243
+ return;
54244
+ }
54245
+ if (isArrayType(type)) {
54246
+ cb(numberType);
54247
+ return;
54248
+ }
54382
54249
  for (const prop of getPropertiesOfType(type)) {
54383
54250
  cb(getLiteralTypeFromProperty(prop, include));
54384
54251
  }
@@ -56215,7 +56082,7 @@ function createTypeChecker(host) {
56215
56082
  if (constraint) {
56216
56083
  constraints = append(constraints, constraint);
56217
56084
  }
56218
- } else if (type.flags & 262144 /* TypeParameter */ && parent.kind === 200 /* MappedType */ && node === parent.type) {
56085
+ } else if (type.flags & 262144 /* TypeParameter */ && parent.kind === 200 /* MappedType */ && (node === parent.type || node === parent.nameType)) {
56219
56086
  const mappedType = getTypeFromTypeNode(parent);
56220
56087
  if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) {
56221
56088
  const typeParameter = getHomomorphicTypeVariable(mappedType);
package/lib/tsserver.js CHANGED
@@ -8041,6 +8041,7 @@ function createSystemWatchFunctions({
8041
8041
  useNonPollingWatchers,
8042
8042
  tscWatchDirectory,
8043
8043
  inodeWatching,
8044
+ fsWatchWithTimestamp,
8044
8045
  sysLog: sysLog2
8045
8046
  }) {
8046
8047
  const pollingWatches = /* @__PURE__ */ new Map();
@@ -8279,7 +8280,7 @@ function createSystemWatchFunctions({
8279
8280
  return watchPresentFileSystemEntryWithFsWatchFile();
8280
8281
  }
8281
8282
  try {
8282
- const presentWatcher = fsWatchWorker(
8283
+ const presentWatcher = (!fsWatchWithTimestamp ? fsWatchWorker : fsWatchWorkerHandlingTimestamp)(
8283
8284
  fileOrDirectory,
8284
8285
  recursive,
8285
8286
  inodeWatching ? callbackChangingToMissingFileSystemEntry : callback
@@ -8342,6 +8343,18 @@ function createSystemWatchFunctions({
8342
8343
  );
8343
8344
  }
8344
8345
  }
8346
+ function fsWatchWorkerHandlingTimestamp(fileOrDirectory, recursive, callback) {
8347
+ let modifiedTime = getModifiedTime3(fileOrDirectory) || missingFileModifiedTime;
8348
+ return fsWatchWorker(fileOrDirectory, recursive, (eventName, relativeFileName, currentModifiedTime) => {
8349
+ if (eventName === "change") {
8350
+ currentModifiedTime || (currentModifiedTime = getModifiedTime3(fileOrDirectory) || missingFileModifiedTime);
8351
+ if (currentModifiedTime.getTime() === modifiedTime.getTime())
8352
+ return;
8353
+ }
8354
+ modifiedTime = currentModifiedTime || getModifiedTime3(fileOrDirectory) || missingFileModifiedTime;
8355
+ callback(eventName, relativeFileName, modifiedTime);
8356
+ });
8357
+ }
8345
8358
  }
8346
8359
  function patchWriteFileEnsuringDirectory(sys2) {
8347
8360
  const originalWriteFile = sys2.writeFile;
@@ -8370,12 +8383,13 @@ var sys = (() => {
8370
8383
  let activeSession;
8371
8384
  let profilePath = "./profile.cpuprofile";
8372
8385
  const Buffer2 = require("buffer").Buffer;
8373
- const isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
8386
+ const isMacOs = process.platform === "darwin";
8387
+ const isLinuxOrMacOs = process.platform === "linux" || isMacOs;
8374
8388
  const platform = _os.platform();
8375
8389
  const useCaseSensitiveFileNames2 = isFileSystemCaseSensitive();
8376
8390
  const fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync;
8377
8391
  const executingFilePath = __filename.endsWith("sys.js") ? _path.join(_path.dirname(__dirname), "__fake__.js") : __filename;
8378
- const fsSupportsRecursiveFsWatch = process.platform === "win32" || process.platform === "darwin";
8392
+ const fsSupportsRecursiveFsWatch = process.platform === "win32" || isMacOs;
8379
8393
  const getCurrentDirectory = memoize(() => process.cwd());
8380
8394
  const { watchFile: watchFile2, watchDirectory } = createSystemWatchFunctions({
8381
8395
  pollingWatchFileWorker: fsWatchFileWorker,
@@ -8395,6 +8409,7 @@ var sys = (() => {
8395
8409
  useNonPollingWatchers: !!process.env.TSC_NONPOLLING_WATCHER,
8396
8410
  tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
8397
8411
  inodeWatching: isLinuxOrMacOs,
8412
+ fsWatchWithTimestamp: isMacOs,
8398
8413
  sysLog
8399
8414
  });
8400
8415
  const nodeSystem = {
@@ -47039,13 +47054,6 @@ __export(ts_moduleSpecifiers_exports, {
47039
47054
  });
47040
47055
 
47041
47056
  // src/compiler/moduleSpecifiers.ts
47042
- function safeJsonRead(packageJsonPath, readFile) {
47043
- try {
47044
- return JSON.parse(readFile(packageJsonPath));
47045
- } catch {
47046
- return {};
47047
- }
47048
- }
47049
47057
  function getPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding }, compilerOptions, importingSourceFile, oldImportSpecifier) {
47050
47058
  const preferredEnding = getPreferredEnding();
47051
47059
  return {
@@ -47268,7 +47276,7 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
47268
47276
  const { sourceDirectory, getCanonicalFileName } = info;
47269
47277
  const allowedEndings = getAllowedEndingsInPrefererredOrder(importMode);
47270
47278
  const relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, allowedEndings, compilerOptions) || processEnding(ensurePathIsNonModuleName(getRelativePathFromDirectory(sourceDirectory, moduleFileName, getCanonicalFileName)), allowedEndings, compilerOptions);
47271
- if (!baseUrl && !paths && !getResolvePackageJsonImports(compilerOptions) || relativePreference === 0 /* Relative */) {
47279
+ if (!baseUrl && !paths || relativePreference === 0 /* Relative */) {
47272
47280
  return pathsOnly ? void 0 : relativePath;
47273
47281
  }
47274
47282
  const baseDirectory = getNormalizedAbsolutePath(getPathsBasePath(compilerOptions, host) || baseUrl, host.getCurrentDirectory());
@@ -47276,12 +47284,11 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
47276
47284
  if (!relativeToBaseUrl) {
47277
47285
  return pathsOnly ? void 0 : relativePath;
47278
47286
  }
47279
- const fromPackageJsonImports = pathsOnly ? void 0 : tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory, compilerOptions, host, importMode);
47280
- const fromPaths = pathsOnly || fromPackageJsonImports === void 0 ? paths && tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) : void 0;
47287
+ const fromPaths = paths && tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions);
47281
47288
  if (pathsOnly) {
47282
47289
  return fromPaths;
47283
47290
  }
47284
- const maybeNonRelative = fromPackageJsonImports ?? (fromPaths === void 0 && baseUrl !== void 0 ? processEnding(relativeToBaseUrl, allowedEndings, compilerOptions) : fromPaths);
47291
+ const maybeNonRelative = fromPaths === void 0 && baseUrl !== void 0 ? processEnding(relativeToBaseUrl, allowedEndings, compilerOptions) : fromPaths;
47285
47292
  if (!maybeNonRelative) {
47286
47293
  return relativePath;
47287
47294
  }
@@ -47320,8 +47327,8 @@ function getNearestAncestorDirectoryWithPackageJson(host, fileName) {
47320
47327
  if (host.getNearestAncestorDirectoryWithPackageJson) {
47321
47328
  return host.getNearestAncestorDirectoryWithPackageJson(fileName);
47322
47329
  }
47323
- return forEachAncestorDirectory(fileName, (directory) => {
47324
- return host.fileExists(combinePaths(directory, "package.json")) ? directory : void 0;
47330
+ return !!forEachAncestorDirectory(fileName, (directory) => {
47331
+ return host.fileExists(combinePaths(directory, "package.json")) ? true : void 0;
47325
47332
  });
47326
47333
  }
47327
47334
  function forEachFileNameOfModule(importingFileName, importedFileName, host, preferSymlinks, cb) {
@@ -47492,40 +47499,8 @@ function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, hos
47492
47499
  return ending !== 0 /* Minimal */ || value === processEnding(relativeToBaseUrl, [ending], compilerOptions, host);
47493
47500
  }
47494
47501
  }
47495
- function getOutputPath(targetFilePath, options, commonSourceDirectory) {
47496
- return changeExtension(
47497
- options.outDir ? resolvePath(
47498
- options.outDir,
47499
- getRelativePathFromDirectory(
47500
- commonSourceDirectory,
47501
- targetFilePath,
47502
- /*ignoreCase*/
47503
- false
47504
- )
47505
- ) : targetFilePath,
47506
- getOutputExtension(targetFilePath, options)
47507
- );
47508
- }
47509
- function getOutputDeclarationPath(targetFilePath, options, commonSourceDirectory) {
47510
- const declarationDir = options.declarationDir || options.outDir;
47511
- return changeExtension(
47512
- declarationDir ? resolvePath(
47513
- declarationDir,
47514
- getRelativePathFromDirectory(
47515
- commonSourceDirectory,
47516
- targetFilePath,
47517
- /*ignoreCase*/
47518
- false
47519
- )
47520
- ) : targetFilePath,
47521
- getDeclarationEmitExtensionForPath(targetFilePath)
47522
- );
47523
- }
47524
- function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, exports, conditions, mode, isImports) {
47502
+ function tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, exports, conditions, mode = 0 /* Exact */) {
47525
47503
  if (typeof exports === "string") {
47526
- const commonSourceDirectory = host.getCommonSourceDirectory();
47527
- const outputFile = isImports && getOutputPath(targetFilePath, options, commonSourceDirectory);
47528
- const declarationFile = isImports && getOutputDeclarationPath(targetFilePath, options, commonSourceDirectory);
47529
47504
  const pathOrPattern = getNormalizedAbsolutePath(
47530
47505
  combinePaths(packageDirectory, exports),
47531
47506
  /*currentDirectory*/
@@ -47534,24 +47509,11 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
47534
47509
  const extensionSwappedTarget = hasTSFileExtension(targetFilePath) ? removeFileExtension(targetFilePath) + tryGetJSExtensionForFile(targetFilePath, options) : void 0;
47535
47510
  switch (mode) {
47536
47511
  case 0 /* Exact */:
47537
- if (extensionSwappedTarget && comparePaths(extensionSwappedTarget, pathOrPattern) === 0 /* EqualTo */ || comparePaths(targetFilePath, pathOrPattern) === 0 /* EqualTo */ || outputFile && comparePaths(outputFile, pathOrPattern) === 0 /* EqualTo */ || declarationFile && comparePaths(declarationFile, pathOrPattern) === 0 /* EqualTo */) {
47512
+ if (comparePaths(targetFilePath, pathOrPattern) === 0 /* EqualTo */ || extensionSwappedTarget && comparePaths(extensionSwappedTarget, pathOrPattern) === 0 /* EqualTo */) {
47538
47513
  return { moduleFileToTry: packageName };
47539
47514
  }
47540
47515
  break;
47541
47516
  case 1 /* Directory */:
47542
- if (extensionSwappedTarget && containsPath(pathOrPattern, extensionSwappedTarget)) {
47543
- const fragment = getRelativePathFromDirectory(
47544
- pathOrPattern,
47545
- extensionSwappedTarget,
47546
- /*ignoreCase*/
47547
- false
47548
- );
47549
- return { moduleFileToTry: getNormalizedAbsolutePath(
47550
- combinePaths(combinePaths(packageName, exports), fragment),
47551
- /*currentDirectory*/
47552
- void 0
47553
- ) };
47554
- }
47555
47517
  if (containsPath(pathOrPattern, targetFilePath)) {
47556
47518
  const fragment = getRelativePathFromDirectory(
47557
47519
  pathOrPattern,
@@ -47565,136 +47527,48 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
47565
47527
  void 0
47566
47528
  ) };
47567
47529
  }
47568
- if (outputFile && containsPath(pathOrPattern, outputFile)) {
47569
- const fragment = getRelativePathFromDirectory(
47570
- pathOrPattern,
47571
- outputFile,
47572
- /*ignoreCase*/
47573
- false
47574
- );
47575
- return { moduleFileToTry: combinePaths(packageName, fragment) };
47576
- }
47577
- if (declarationFile && containsPath(pathOrPattern, declarationFile)) {
47578
- const fragment = getRelativePathFromDirectory(
47579
- pathOrPattern,
47580
- declarationFile,
47581
- /*ignoreCase*/
47582
- false
47583
- );
47584
- return { moduleFileToTry: combinePaths(packageName, fragment) };
47585
- }
47586
47530
  break;
47587
47531
  case 2 /* Pattern */:
47588
47532
  const starPos = pathOrPattern.indexOf("*");
47589
47533
  const leadingSlice = pathOrPattern.slice(0, starPos);
47590
47534
  const trailingSlice = pathOrPattern.slice(starPos + 1);
47591
- if (extensionSwappedTarget && startsWith(extensionSwappedTarget, leadingSlice) && endsWith(extensionSwappedTarget, trailingSlice)) {
47592
- const starReplacement = extensionSwappedTarget.slice(leadingSlice.length, extensionSwappedTarget.length - trailingSlice.length);
47593
- return { moduleFileToTry: packageName.replace("*", starReplacement) };
47594
- }
47595
47535
  if (startsWith(targetFilePath, leadingSlice) && endsWith(targetFilePath, trailingSlice)) {
47596
47536
  const starReplacement = targetFilePath.slice(leadingSlice.length, targetFilePath.length - trailingSlice.length);
47597
47537
  return { moduleFileToTry: packageName.replace("*", starReplacement) };
47598
47538
  }
47599
- if (outputFile && startsWith(outputFile, leadingSlice) && endsWith(outputFile, trailingSlice)) {
47600
- const starReplacement = outputFile.slice(leadingSlice.length, outputFile.length - trailingSlice.length);
47601
- return { moduleFileToTry: packageName.replace("*", starReplacement) };
47602
- }
47603
- if (declarationFile && startsWith(declarationFile, leadingSlice) && endsWith(declarationFile, trailingSlice)) {
47604
- const starReplacement = declarationFile.slice(leadingSlice.length, declarationFile.length - trailingSlice.length);
47539
+ if (extensionSwappedTarget && startsWith(extensionSwappedTarget, leadingSlice) && endsWith(extensionSwappedTarget, trailingSlice)) {
47540
+ const starReplacement = extensionSwappedTarget.slice(leadingSlice.length, extensionSwappedTarget.length - trailingSlice.length);
47605
47541
  return { moduleFileToTry: packageName.replace("*", starReplacement) };
47606
47542
  }
47607
47543
  break;
47608
47544
  }
47609
47545
  } else if (Array.isArray(exports)) {
47610
- return forEach(exports, (e) => tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, e, conditions, mode, isImports));
47546
+ return forEach(exports, (e) => tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, e, conditions));
47611
47547
  } else if (typeof exports === "object" && exports !== null) {
47612
- for (const key of getOwnKeys(exports)) {
47613
- if (key === "default" || conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(conditions, key)) {
47614
- const subTarget = exports[key];
47615
- const result = tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode, isImports);
47616
- if (result) {
47617
- return result;
47548
+ if (allKeysStartWithDot(exports)) {
47549
+ return forEach(getOwnKeys(exports), (k) => {
47550
+ const subPackageName = getNormalizedAbsolutePath(
47551
+ combinePaths(packageName, k),
47552
+ /*currentDirectory*/
47553
+ void 0
47554
+ );
47555
+ const mode2 = endsWith(k, "/") ? 1 /* Directory */ : k.includes("*") ? 2 /* Pattern */ : 0 /* Exact */;
47556
+ return tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, subPackageName, exports[k], conditions, mode2);
47557
+ });
47558
+ } else {
47559
+ for (const key of getOwnKeys(exports)) {
47560
+ if (key === "default" || conditions.includes(key) || isApplicableVersionedTypesKey(conditions, key)) {
47561
+ const subTarget = exports[key];
47562
+ const result = tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode);
47563
+ if (result) {
47564
+ return result;
47565
+ }
47618
47566
  }
47619
47567
  }
47620
47568
  }
47621
47569
  }
47622
47570
  return void 0;
47623
47571
  }
47624
- function tryGetModuleNameFromExports(options, host, targetFilePath, packageDirectory, packageName, exports, conditions) {
47625
- if (typeof exports === "object" && exports !== null && !Array.isArray(exports) && allKeysStartWithDot(exports)) {
47626
- return forEach(getOwnKeys(exports), (k) => {
47627
- const subPackageName = getNormalizedAbsolutePath(
47628
- combinePaths(packageName, k),
47629
- /*currentDirectory*/
47630
- void 0
47631
- );
47632
- const mode = endsWith(k, "/") ? 1 /* Directory */ : k.includes("*") ? 2 /* Pattern */ : 0 /* Exact */;
47633
- return tryGetModuleNameFromExportsOrImports(
47634
- options,
47635
- host,
47636
- targetFilePath,
47637
- packageDirectory,
47638
- subPackageName,
47639
- exports[k],
47640
- conditions,
47641
- mode,
47642
- /*isImports*/
47643
- false
47644
- );
47645
- });
47646
- }
47647
- return tryGetModuleNameFromExportsOrImports(
47648
- options,
47649
- host,
47650
- targetFilePath,
47651
- packageDirectory,
47652
- packageName,
47653
- exports,
47654
- conditions,
47655
- 0 /* Exact */,
47656
- /*isImports*/
47657
- false
47658
- );
47659
- }
47660
- function tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory, options, host, importMode) {
47661
- var _a, _b, _c;
47662
- if (!host.readFile || !getResolvePackageJsonImports(options)) {
47663
- return void 0;
47664
- }
47665
- const ancestorDirectoryWithPackageJson = getNearestAncestorDirectoryWithPackageJson(host, sourceDirectory);
47666
- if (!ancestorDirectoryWithPackageJson) {
47667
- return void 0;
47668
- }
47669
- const packageJsonPath = combinePaths(ancestorDirectoryWithPackageJson, "package.json");
47670
- const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
47671
- if (typeof cachedPackageJson !== "object" && cachedPackageJson !== void 0 || !host.fileExists(packageJsonPath)) {
47672
- return void 0;
47673
- }
47674
- const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || safeJsonRead(packageJsonPath, host.readFile);
47675
- const imports = packageJsonContent == null ? void 0 : packageJsonContent.imports;
47676
- if (!imports) {
47677
- return void 0;
47678
- }
47679
- const conditions = getConditions(options, importMode);
47680
- return (_c = forEach(getOwnKeys(imports), (k) => {
47681
- if (!startsWith(k, "#") || k === "#" || startsWith(k, "#/"))
47682
- return void 0;
47683
- const mode = endsWith(k, "/") ? 1 /* Directory */ : k.includes("*") ? 2 /* Pattern */ : 0 /* Exact */;
47684
- return tryGetModuleNameFromExportsOrImports(
47685
- options,
47686
- host,
47687
- moduleFileName,
47688
- ancestorDirectoryWithPackageJson,
47689
- k,
47690
- imports[k],
47691
- conditions,
47692
- mode,
47693
- /*isImports*/
47694
- true
47695
- );
47696
- })) == null ? void 0 : _c.moduleFileToTry;
47697
- }
47698
47572
  function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, allowedEndings, compilerOptions) {
47699
47573
  const normalizedTargetPaths = getPathsRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName);
47700
47574
  if (normalizedTargetPaths === void 0) {
@@ -47768,15 +47642,16 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
47768
47642
  let maybeBlockedByTypesVersions = false;
47769
47643
  const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
47770
47644
  if (typeof cachedPackageJson === "object" || cachedPackageJson === void 0 && host.fileExists(packageJsonPath)) {
47771
- const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || safeJsonRead(packageJsonPath, host.readFile);
47645
+ const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
47772
47646
  const importMode = overrideMode || importingSourceFile.impliedNodeFormat;
47773
47647
  if (getResolvePackageJsonExports(options)) {
47774
47648
  const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
47775
47649
  const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
47776
47650
  const conditions = getConditions(options, importMode);
47777
- const fromExports = packageJsonContent.exports ? tryGetModuleNameFromExports(options, host, path, packageRootPath, packageName2, packageJsonContent.exports, conditions) : void 0;
47651
+ const fromExports = packageJsonContent.exports ? tryGetModuleNameFromExports(options, path, packageRootPath, packageName2, packageJsonContent.exports, conditions) : void 0;
47778
47652
  if (fromExports) {
47779
- return { ...fromExports, verbatimFromExports: true };
47653
+ const withJsExtension = !hasTSFileExtension(fromExports.moduleFileToTry) ? fromExports : { moduleFileToTry: removeFileExtension(fromExports.moduleFileToTry) + tryGetJSExtensionForFile(fromExports.moduleFileToTry, options) };
47654
+ return { ...withJsExtension, verbatimFromExports: true };
47780
47655
  }
47781
47656
  if (packageJsonContent.exports) {
47782
47657
  return { moduleFileToTry: path, blockedByExports: true };
@@ -59071,6 +58946,14 @@ function createTypeChecker(host) {
59071
58946
  return getCheckFlags(s) & 4096 /* Late */;
59072
58947
  }
59073
58948
  function forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(type, include, stringsOnly, cb) {
58949
+ if (isTupleType(type)) {
58950
+ forEachType(getUnionType(getElementTypes(type).map((_, i) => getStringLiteralType("" + i))), cb);
58951
+ return;
58952
+ }
58953
+ if (isArrayType(type)) {
58954
+ cb(numberType);
58955
+ return;
58956
+ }
59074
58957
  for (const prop of getPropertiesOfType(type)) {
59075
58958
  cb(getLiteralTypeFromProperty(prop, include));
59076
58959
  }
@@ -60907,7 +60790,7 @@ function createTypeChecker(host) {
60907
60790
  if (constraint) {
60908
60791
  constraints = append(constraints, constraint);
60909
60792
  }
60910
- } else if (type.flags & 262144 /* TypeParameter */ && parent2.kind === 200 /* MappedType */ && node === parent2.type) {
60793
+ } else if (type.flags & 262144 /* TypeParameter */ && parent2.kind === 200 /* MappedType */ && (node === parent2.type || node === parent2.nameType)) {
60911
60794
  const mappedType = getTypeFromTypeNode(parent2);
60912
60795
  if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) {
60913
60796
  const typeParameter = getHomomorphicTypeVariable(mappedType);
@@ -133150,8 +133033,7 @@ function createModuleSpecifierResolutionHost(program, host) {
133150
133033
  getProjectReferenceRedirect: (fileName) => program.getProjectReferenceRedirect(fileName),
133151
133034
  isSourceOfProjectReferenceRedirect: (fileName) => program.isSourceOfProjectReferenceRedirect(fileName),
133152
133035
  getNearestAncestorDirectoryWithPackageJson: maybeBind(host, host.getNearestAncestorDirectoryWithPackageJson),
133153
- getFileIncludeReasons: () => program.getFileIncludeReasons(),
133154
- getCommonSourceDirectory: () => program.getCommonSourceDirectory()
133036
+ getFileIncludeReasons: () => program.getFileIncludeReasons()
133155
133037
  };
133156
133038
  }
133157
133039
  function getModuleSpecifierResolverHost(program, host) {
package/lib/typescript.js CHANGED
@@ -5779,6 +5779,7 @@ ${lanes.join("\n")}
5779
5779
  useNonPollingWatchers,
5780
5780
  tscWatchDirectory,
5781
5781
  inodeWatching,
5782
+ fsWatchWithTimestamp,
5782
5783
  sysLog: sysLog2
5783
5784
  }) {
5784
5785
  const pollingWatches = /* @__PURE__ */ new Map();
@@ -6017,7 +6018,7 @@ ${lanes.join("\n")}
6017
6018
  return watchPresentFileSystemEntryWithFsWatchFile();
6018
6019
  }
6019
6020
  try {
6020
- const presentWatcher = fsWatchWorker(
6021
+ const presentWatcher = (!fsWatchWithTimestamp ? fsWatchWorker : fsWatchWorkerHandlingTimestamp)(
6021
6022
  fileOrDirectory,
6022
6023
  recursive,
6023
6024
  inodeWatching ? callbackChangingToMissingFileSystemEntry : callback
@@ -6080,6 +6081,18 @@ ${lanes.join("\n")}
6080
6081
  );
6081
6082
  }
6082
6083
  }
6084
+ function fsWatchWorkerHandlingTimestamp(fileOrDirectory, recursive, callback) {
6085
+ let modifiedTime = getModifiedTime3(fileOrDirectory) || missingFileModifiedTime;
6086
+ return fsWatchWorker(fileOrDirectory, recursive, (eventName, relativeFileName, currentModifiedTime) => {
6087
+ if (eventName === "change") {
6088
+ currentModifiedTime || (currentModifiedTime = getModifiedTime3(fileOrDirectory) || missingFileModifiedTime);
6089
+ if (currentModifiedTime.getTime() === modifiedTime.getTime())
6090
+ return;
6091
+ }
6092
+ modifiedTime = currentModifiedTime || getModifiedTime3(fileOrDirectory) || missingFileModifiedTime;
6093
+ callback(eventName, relativeFileName, modifiedTime);
6094
+ });
6095
+ }
6083
6096
  }
6084
6097
  function patchWriteFileEnsuringDirectory(sys2) {
6085
6098
  const originalWriteFile = sys2.writeFile;
@@ -6139,12 +6152,13 @@ ${lanes.join("\n")}
6139
6152
  let activeSession;
6140
6153
  let profilePath = "./profile.cpuprofile";
6141
6154
  const Buffer2 = require("buffer").Buffer;
6142
- const isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
6155
+ const isMacOs = process.platform === "darwin";
6156
+ const isLinuxOrMacOs = process.platform === "linux" || isMacOs;
6143
6157
  const platform = _os.platform();
6144
6158
  const useCaseSensitiveFileNames2 = isFileSystemCaseSensitive();
6145
6159
  const fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync;
6146
6160
  const executingFilePath = __filename.endsWith("sys.js") ? _path.join(_path.dirname(__dirname), "__fake__.js") : __filename;
6147
- const fsSupportsRecursiveFsWatch = process.platform === "win32" || process.platform === "darwin";
6161
+ const fsSupportsRecursiveFsWatch = process.platform === "win32" || isMacOs;
6148
6162
  const getCurrentDirectory = memoize(() => process.cwd());
6149
6163
  const { watchFile: watchFile2, watchDirectory } = createSystemWatchFunctions({
6150
6164
  pollingWatchFileWorker: fsWatchFileWorker,
@@ -6164,6 +6178,7 @@ ${lanes.join("\n")}
6164
6178
  useNonPollingWatchers: !!process.env.TSC_NONPOLLING_WATCHER,
6165
6179
  tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
6166
6180
  inodeWatching: isLinuxOrMacOs,
6181
+ fsWatchWithTimestamp: isMacOs,
6167
6182
  sysLog
6168
6183
  });
6169
6184
  const nodeSystem = {
@@ -44902,13 +44917,6 @@ ${lanes.join("\n")}
44902
44917
  });
44903
44918
 
44904
44919
  // src/compiler/moduleSpecifiers.ts
44905
- function safeJsonRead(packageJsonPath, readFile) {
44906
- try {
44907
- return JSON.parse(readFile(packageJsonPath));
44908
- } catch {
44909
- return {};
44910
- }
44911
- }
44912
44920
  function getPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding }, compilerOptions, importingSourceFile, oldImportSpecifier) {
44913
44921
  const preferredEnding = getPreferredEnding();
44914
44922
  return {
@@ -45131,7 +45139,7 @@ ${lanes.join("\n")}
45131
45139
  const { sourceDirectory, getCanonicalFileName } = info;
45132
45140
  const allowedEndings = getAllowedEndingsInPrefererredOrder(importMode);
45133
45141
  const relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, allowedEndings, compilerOptions) || processEnding(ensurePathIsNonModuleName(getRelativePathFromDirectory(sourceDirectory, moduleFileName, getCanonicalFileName)), allowedEndings, compilerOptions);
45134
- if (!baseUrl && !paths && !getResolvePackageJsonImports(compilerOptions) || relativePreference === 0 /* Relative */) {
45142
+ if (!baseUrl && !paths || relativePreference === 0 /* Relative */) {
45135
45143
  return pathsOnly ? void 0 : relativePath;
45136
45144
  }
45137
45145
  const baseDirectory = getNormalizedAbsolutePath(getPathsBasePath(compilerOptions, host) || baseUrl, host.getCurrentDirectory());
@@ -45139,12 +45147,11 @@ ${lanes.join("\n")}
45139
45147
  if (!relativeToBaseUrl) {
45140
45148
  return pathsOnly ? void 0 : relativePath;
45141
45149
  }
45142
- const fromPackageJsonImports = pathsOnly ? void 0 : tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory, compilerOptions, host, importMode);
45143
- const fromPaths = pathsOnly || fromPackageJsonImports === void 0 ? paths && tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) : void 0;
45150
+ const fromPaths = paths && tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions);
45144
45151
  if (pathsOnly) {
45145
45152
  return fromPaths;
45146
45153
  }
45147
- const maybeNonRelative = fromPackageJsonImports ?? (fromPaths === void 0 && baseUrl !== void 0 ? processEnding(relativeToBaseUrl, allowedEndings, compilerOptions) : fromPaths);
45154
+ const maybeNonRelative = fromPaths === void 0 && baseUrl !== void 0 ? processEnding(relativeToBaseUrl, allowedEndings, compilerOptions) : fromPaths;
45148
45155
  if (!maybeNonRelative) {
45149
45156
  return relativePath;
45150
45157
  }
@@ -45183,8 +45190,8 @@ ${lanes.join("\n")}
45183
45190
  if (host.getNearestAncestorDirectoryWithPackageJson) {
45184
45191
  return host.getNearestAncestorDirectoryWithPackageJson(fileName);
45185
45192
  }
45186
- return forEachAncestorDirectory(fileName, (directory) => {
45187
- return host.fileExists(combinePaths(directory, "package.json")) ? directory : void 0;
45193
+ return !!forEachAncestorDirectory(fileName, (directory) => {
45194
+ return host.fileExists(combinePaths(directory, "package.json")) ? true : void 0;
45188
45195
  });
45189
45196
  }
45190
45197
  function forEachFileNameOfModule(importingFileName, importedFileName, host, preferSymlinks, cb) {
@@ -45355,40 +45362,8 @@ ${lanes.join("\n")}
45355
45362
  return ending !== 0 /* Minimal */ || value === processEnding(relativeToBaseUrl, [ending], compilerOptions, host);
45356
45363
  }
45357
45364
  }
45358
- function getOutputPath(targetFilePath, options, commonSourceDirectory) {
45359
- return changeExtension(
45360
- options.outDir ? resolvePath(
45361
- options.outDir,
45362
- getRelativePathFromDirectory(
45363
- commonSourceDirectory,
45364
- targetFilePath,
45365
- /*ignoreCase*/
45366
- false
45367
- )
45368
- ) : targetFilePath,
45369
- getOutputExtension(targetFilePath, options)
45370
- );
45371
- }
45372
- function getOutputDeclarationPath(targetFilePath, options, commonSourceDirectory) {
45373
- const declarationDir = options.declarationDir || options.outDir;
45374
- return changeExtension(
45375
- declarationDir ? resolvePath(
45376
- declarationDir,
45377
- getRelativePathFromDirectory(
45378
- commonSourceDirectory,
45379
- targetFilePath,
45380
- /*ignoreCase*/
45381
- false
45382
- )
45383
- ) : targetFilePath,
45384
- getDeclarationEmitExtensionForPath(targetFilePath)
45385
- );
45386
- }
45387
- function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, exports, conditions, mode, isImports) {
45365
+ function tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, exports, conditions, mode = 0 /* Exact */) {
45388
45366
  if (typeof exports === "string") {
45389
- const commonSourceDirectory = host.getCommonSourceDirectory();
45390
- const outputFile = isImports && getOutputPath(targetFilePath, options, commonSourceDirectory);
45391
- const declarationFile = isImports && getOutputDeclarationPath(targetFilePath, options, commonSourceDirectory);
45392
45367
  const pathOrPattern = getNormalizedAbsolutePath(
45393
45368
  combinePaths(packageDirectory, exports),
45394
45369
  /*currentDirectory*/
@@ -45397,24 +45372,11 @@ ${lanes.join("\n")}
45397
45372
  const extensionSwappedTarget = hasTSFileExtension(targetFilePath) ? removeFileExtension(targetFilePath) + tryGetJSExtensionForFile(targetFilePath, options) : void 0;
45398
45373
  switch (mode) {
45399
45374
  case 0 /* Exact */:
45400
- if (extensionSwappedTarget && comparePaths(extensionSwappedTarget, pathOrPattern) === 0 /* EqualTo */ || comparePaths(targetFilePath, pathOrPattern) === 0 /* EqualTo */ || outputFile && comparePaths(outputFile, pathOrPattern) === 0 /* EqualTo */ || declarationFile && comparePaths(declarationFile, pathOrPattern) === 0 /* EqualTo */) {
45375
+ if (comparePaths(targetFilePath, pathOrPattern) === 0 /* EqualTo */ || extensionSwappedTarget && comparePaths(extensionSwappedTarget, pathOrPattern) === 0 /* EqualTo */) {
45401
45376
  return { moduleFileToTry: packageName };
45402
45377
  }
45403
45378
  break;
45404
45379
  case 1 /* Directory */:
45405
- if (extensionSwappedTarget && containsPath(pathOrPattern, extensionSwappedTarget)) {
45406
- const fragment = getRelativePathFromDirectory(
45407
- pathOrPattern,
45408
- extensionSwappedTarget,
45409
- /*ignoreCase*/
45410
- false
45411
- );
45412
- return { moduleFileToTry: getNormalizedAbsolutePath(
45413
- combinePaths(combinePaths(packageName, exports), fragment),
45414
- /*currentDirectory*/
45415
- void 0
45416
- ) };
45417
- }
45418
45380
  if (containsPath(pathOrPattern, targetFilePath)) {
45419
45381
  const fragment = getRelativePathFromDirectory(
45420
45382
  pathOrPattern,
@@ -45428,136 +45390,48 @@ ${lanes.join("\n")}
45428
45390
  void 0
45429
45391
  ) };
45430
45392
  }
45431
- if (outputFile && containsPath(pathOrPattern, outputFile)) {
45432
- const fragment = getRelativePathFromDirectory(
45433
- pathOrPattern,
45434
- outputFile,
45435
- /*ignoreCase*/
45436
- false
45437
- );
45438
- return { moduleFileToTry: combinePaths(packageName, fragment) };
45439
- }
45440
- if (declarationFile && containsPath(pathOrPattern, declarationFile)) {
45441
- const fragment = getRelativePathFromDirectory(
45442
- pathOrPattern,
45443
- declarationFile,
45444
- /*ignoreCase*/
45445
- false
45446
- );
45447
- return { moduleFileToTry: combinePaths(packageName, fragment) };
45448
- }
45449
45393
  break;
45450
45394
  case 2 /* Pattern */:
45451
45395
  const starPos = pathOrPattern.indexOf("*");
45452
45396
  const leadingSlice = pathOrPattern.slice(0, starPos);
45453
45397
  const trailingSlice = pathOrPattern.slice(starPos + 1);
45454
- if (extensionSwappedTarget && startsWith(extensionSwappedTarget, leadingSlice) && endsWith(extensionSwappedTarget, trailingSlice)) {
45455
- const starReplacement = extensionSwappedTarget.slice(leadingSlice.length, extensionSwappedTarget.length - trailingSlice.length);
45456
- return { moduleFileToTry: packageName.replace("*", starReplacement) };
45457
- }
45458
45398
  if (startsWith(targetFilePath, leadingSlice) && endsWith(targetFilePath, trailingSlice)) {
45459
45399
  const starReplacement = targetFilePath.slice(leadingSlice.length, targetFilePath.length - trailingSlice.length);
45460
45400
  return { moduleFileToTry: packageName.replace("*", starReplacement) };
45461
45401
  }
45462
- if (outputFile && startsWith(outputFile, leadingSlice) && endsWith(outputFile, trailingSlice)) {
45463
- const starReplacement = outputFile.slice(leadingSlice.length, outputFile.length - trailingSlice.length);
45464
- return { moduleFileToTry: packageName.replace("*", starReplacement) };
45465
- }
45466
- if (declarationFile && startsWith(declarationFile, leadingSlice) && endsWith(declarationFile, trailingSlice)) {
45467
- const starReplacement = declarationFile.slice(leadingSlice.length, declarationFile.length - trailingSlice.length);
45402
+ if (extensionSwappedTarget && startsWith(extensionSwappedTarget, leadingSlice) && endsWith(extensionSwappedTarget, trailingSlice)) {
45403
+ const starReplacement = extensionSwappedTarget.slice(leadingSlice.length, extensionSwappedTarget.length - trailingSlice.length);
45468
45404
  return { moduleFileToTry: packageName.replace("*", starReplacement) };
45469
45405
  }
45470
45406
  break;
45471
45407
  }
45472
45408
  } else if (Array.isArray(exports)) {
45473
- return forEach(exports, (e) => tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, e, conditions, mode, isImports));
45409
+ return forEach(exports, (e) => tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, e, conditions));
45474
45410
  } else if (typeof exports === "object" && exports !== null) {
45475
- for (const key of getOwnKeys(exports)) {
45476
- if (key === "default" || conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(conditions, key)) {
45477
- const subTarget = exports[key];
45478
- const result = tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode, isImports);
45479
- if (result) {
45480
- return result;
45411
+ if (allKeysStartWithDot(exports)) {
45412
+ return forEach(getOwnKeys(exports), (k) => {
45413
+ const subPackageName = getNormalizedAbsolutePath(
45414
+ combinePaths(packageName, k),
45415
+ /*currentDirectory*/
45416
+ void 0
45417
+ );
45418
+ const mode2 = endsWith(k, "/") ? 1 /* Directory */ : k.includes("*") ? 2 /* Pattern */ : 0 /* Exact */;
45419
+ return tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, subPackageName, exports[k], conditions, mode2);
45420
+ });
45421
+ } else {
45422
+ for (const key of getOwnKeys(exports)) {
45423
+ if (key === "default" || conditions.includes(key) || isApplicableVersionedTypesKey(conditions, key)) {
45424
+ const subTarget = exports[key];
45425
+ const result = tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode);
45426
+ if (result) {
45427
+ return result;
45428
+ }
45481
45429
  }
45482
45430
  }
45483
45431
  }
45484
45432
  }
45485
45433
  return void 0;
45486
45434
  }
45487
- function tryGetModuleNameFromExports(options, host, targetFilePath, packageDirectory, packageName, exports, conditions) {
45488
- if (typeof exports === "object" && exports !== null && !Array.isArray(exports) && allKeysStartWithDot(exports)) {
45489
- return forEach(getOwnKeys(exports), (k) => {
45490
- const subPackageName = getNormalizedAbsolutePath(
45491
- combinePaths(packageName, k),
45492
- /*currentDirectory*/
45493
- void 0
45494
- );
45495
- const mode = endsWith(k, "/") ? 1 /* Directory */ : k.includes("*") ? 2 /* Pattern */ : 0 /* Exact */;
45496
- return tryGetModuleNameFromExportsOrImports(
45497
- options,
45498
- host,
45499
- targetFilePath,
45500
- packageDirectory,
45501
- subPackageName,
45502
- exports[k],
45503
- conditions,
45504
- mode,
45505
- /*isImports*/
45506
- false
45507
- );
45508
- });
45509
- }
45510
- return tryGetModuleNameFromExportsOrImports(
45511
- options,
45512
- host,
45513
- targetFilePath,
45514
- packageDirectory,
45515
- packageName,
45516
- exports,
45517
- conditions,
45518
- 0 /* Exact */,
45519
- /*isImports*/
45520
- false
45521
- );
45522
- }
45523
- function tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory, options, host, importMode) {
45524
- var _a, _b, _c;
45525
- if (!host.readFile || !getResolvePackageJsonImports(options)) {
45526
- return void 0;
45527
- }
45528
- const ancestorDirectoryWithPackageJson = getNearestAncestorDirectoryWithPackageJson(host, sourceDirectory);
45529
- if (!ancestorDirectoryWithPackageJson) {
45530
- return void 0;
45531
- }
45532
- const packageJsonPath = combinePaths(ancestorDirectoryWithPackageJson, "package.json");
45533
- const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
45534
- if (typeof cachedPackageJson !== "object" && cachedPackageJson !== void 0 || !host.fileExists(packageJsonPath)) {
45535
- return void 0;
45536
- }
45537
- const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || safeJsonRead(packageJsonPath, host.readFile);
45538
- const imports = packageJsonContent == null ? void 0 : packageJsonContent.imports;
45539
- if (!imports) {
45540
- return void 0;
45541
- }
45542
- const conditions = getConditions(options, importMode);
45543
- return (_c = forEach(getOwnKeys(imports), (k) => {
45544
- if (!startsWith(k, "#") || k === "#" || startsWith(k, "#/"))
45545
- return void 0;
45546
- const mode = endsWith(k, "/") ? 1 /* Directory */ : k.includes("*") ? 2 /* Pattern */ : 0 /* Exact */;
45547
- return tryGetModuleNameFromExportsOrImports(
45548
- options,
45549
- host,
45550
- moduleFileName,
45551
- ancestorDirectoryWithPackageJson,
45552
- k,
45553
- imports[k],
45554
- conditions,
45555
- mode,
45556
- /*isImports*/
45557
- true
45558
- );
45559
- })) == null ? void 0 : _c.moduleFileToTry;
45560
- }
45561
45435
  function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, allowedEndings, compilerOptions) {
45562
45436
  const normalizedTargetPaths = getPathsRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName);
45563
45437
  if (normalizedTargetPaths === void 0) {
@@ -45631,15 +45505,16 @@ ${lanes.join("\n")}
45631
45505
  let maybeBlockedByTypesVersions = false;
45632
45506
  const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
45633
45507
  if (typeof cachedPackageJson === "object" || cachedPackageJson === void 0 && host.fileExists(packageJsonPath)) {
45634
- const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || safeJsonRead(packageJsonPath, host.readFile);
45508
+ const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
45635
45509
  const importMode = overrideMode || importingSourceFile.impliedNodeFormat;
45636
45510
  if (getResolvePackageJsonExports(options)) {
45637
45511
  const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
45638
45512
  const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
45639
45513
  const conditions = getConditions(options, importMode);
45640
- const fromExports = packageJsonContent.exports ? tryGetModuleNameFromExports(options, host, path, packageRootPath, packageName2, packageJsonContent.exports, conditions) : void 0;
45514
+ const fromExports = packageJsonContent.exports ? tryGetModuleNameFromExports(options, path, packageRootPath, packageName2, packageJsonContent.exports, conditions) : void 0;
45641
45515
  if (fromExports) {
45642
- return { ...fromExports, verbatimFromExports: true };
45516
+ const withJsExtension = !hasTSFileExtension(fromExports.moduleFileToTry) ? fromExports : { moduleFileToTry: removeFileExtension(fromExports.moduleFileToTry) + tryGetJSExtensionForFile(fromExports.moduleFileToTry, options) };
45517
+ return { ...withJsExtension, verbatimFromExports: true };
45643
45518
  }
45644
45519
  if (packageJsonContent.exports) {
45645
45520
  return { moduleFileToTry: path, blockedByExports: true };
@@ -56836,6 +56711,14 @@ ${lanes.join("\n")}
56836
56711
  return getCheckFlags(s) & 4096 /* Late */;
56837
56712
  }
56838
56713
  function forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(type, include, stringsOnly, cb) {
56714
+ if (isTupleType(type)) {
56715
+ forEachType(getUnionType(getElementTypes(type).map((_, i) => getStringLiteralType("" + i))), cb);
56716
+ return;
56717
+ }
56718
+ if (isArrayType(type)) {
56719
+ cb(numberType);
56720
+ return;
56721
+ }
56839
56722
  for (const prop of getPropertiesOfType(type)) {
56840
56723
  cb(getLiteralTypeFromProperty(prop, include));
56841
56724
  }
@@ -58672,7 +58555,7 @@ ${lanes.join("\n")}
58672
58555
  if (constraint) {
58673
58556
  constraints = append(constraints, constraint);
58674
58557
  }
58675
- } else if (type.flags & 262144 /* TypeParameter */ && parent2.kind === 200 /* MappedType */ && node === parent2.type) {
58558
+ } else if (type.flags & 262144 /* TypeParameter */ && parent2.kind === 200 /* MappedType */ && (node === parent2.type || node === parent2.nameType)) {
58676
58559
  const mappedType = getTypeFromTypeNode(parent2);
58677
58560
  if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) {
58678
58561
  const typeParameter = getHomomorphicTypeVariable(mappedType);
@@ -131420,8 +131303,7 @@ ${lanes.join("\n")}
131420
131303
  getProjectReferenceRedirect: (fileName) => program.getProjectReferenceRedirect(fileName),
131421
131304
  isSourceOfProjectReferenceRedirect: (fileName) => program.isSourceOfProjectReferenceRedirect(fileName),
131422
131305
  getNearestAncestorDirectoryWithPackageJson: maybeBind(host, host.getNearestAncestorDirectoryWithPackageJson),
131423
- getFileIncludeReasons: () => program.getFileIncludeReasons(),
131424
- getCommonSourceDirectory: () => program.getCommonSourceDirectory()
131306
+ getFileIncludeReasons: () => program.getFileIncludeReasons()
131425
131307
  };
131426
131308
  }
131427
131309
  function getModuleSpecifierResolverHost(program, host) {
@@ -3934,6 +3934,7 @@ function createSystemWatchFunctions({
3934
3934
  useNonPollingWatchers,
3935
3935
  tscWatchDirectory,
3936
3936
  inodeWatching,
3937
+ fsWatchWithTimestamp,
3937
3938
  sysLog: sysLog2
3938
3939
  }) {
3939
3940
  const pollingWatches = /* @__PURE__ */ new Map();
@@ -4172,7 +4173,7 @@ function createSystemWatchFunctions({
4172
4173
  return watchPresentFileSystemEntryWithFsWatchFile();
4173
4174
  }
4174
4175
  try {
4175
- const presentWatcher = fsWatchWorker(
4176
+ const presentWatcher = (!fsWatchWithTimestamp ? fsWatchWorker : fsWatchWorkerHandlingTimestamp)(
4176
4177
  fileOrDirectory,
4177
4178
  recursive,
4178
4179
  inodeWatching ? callbackChangingToMissingFileSystemEntry : callback
@@ -4235,6 +4236,18 @@ function createSystemWatchFunctions({
4235
4236
  );
4236
4237
  }
4237
4238
  }
4239
+ function fsWatchWorkerHandlingTimestamp(fileOrDirectory, recursive, callback) {
4240
+ let modifiedTime = getModifiedTime2(fileOrDirectory) || missingFileModifiedTime;
4241
+ return fsWatchWorker(fileOrDirectory, recursive, (eventName, relativeFileName, currentModifiedTime) => {
4242
+ if (eventName === "change") {
4243
+ currentModifiedTime || (currentModifiedTime = getModifiedTime2(fileOrDirectory) || missingFileModifiedTime);
4244
+ if (currentModifiedTime.getTime() === modifiedTime.getTime())
4245
+ return;
4246
+ }
4247
+ modifiedTime = currentModifiedTime || getModifiedTime2(fileOrDirectory) || missingFileModifiedTime;
4248
+ callback(eventName, relativeFileName, modifiedTime);
4249
+ });
4250
+ }
4238
4251
  }
4239
4252
  function patchWriteFileEnsuringDirectory(sys2) {
4240
4253
  const originalWriteFile = sys2.writeFile;
@@ -4263,12 +4276,13 @@ var sys = (() => {
4263
4276
  let activeSession;
4264
4277
  let profilePath = "./profile.cpuprofile";
4265
4278
  const Buffer2 = require("buffer").Buffer;
4266
- const isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
4279
+ const isMacOs = process.platform === "darwin";
4280
+ const isLinuxOrMacOs = process.platform === "linux" || isMacOs;
4267
4281
  const platform = _os.platform();
4268
4282
  const useCaseSensitiveFileNames2 = isFileSystemCaseSensitive();
4269
4283
  const fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync;
4270
4284
  const executingFilePath = __filename.endsWith("sys.js") ? _path.join(_path.dirname(__dirname), "__fake__.js") : __filename;
4271
- const fsSupportsRecursiveFsWatch = process.platform === "win32" || process.platform === "darwin";
4285
+ const fsSupportsRecursiveFsWatch = process.platform === "win32" || isMacOs;
4272
4286
  const getCurrentDirectory = memoize(() => process.cwd());
4273
4287
  const { watchFile, watchDirectory } = createSystemWatchFunctions({
4274
4288
  pollingWatchFileWorker: fsWatchFileWorker,
@@ -4288,6 +4302,7 @@ var sys = (() => {
4288
4302
  useNonPollingWatchers: !!process.env.TSC_NONPOLLING_WATCHER,
4289
4303
  tscWatchDirectory: process.env.TSC_WATCHDIRECTORY,
4290
4304
  inodeWatching: isLinuxOrMacOs,
4305
+ fsWatchWithTimestamp: isMacOs,
4291
4306
  sysLog
4292
4307
  });
4293
4308
  const nodeSystem = {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@typescript-deploys/pr-build",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.4.0-pr-55015-10",
5
+ "version": "5.4.0-pr-55774-37",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -115,5 +115,5 @@
115
115
  "node": "20.1.0",
116
116
  "npm": "8.19.4"
117
117
  },
118
- "gitHead": "d6f199d69cfaf8f69510f81d95c5358f1f16e9a7"
118
+ "gitHead": "5dbc02ba770ef61d5f9cbbc9e5aeb1ee2a686529"
119
119
  }