typescript 5.4.2 → 5.4.5

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.
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.4";
57
- var version = "5.4.2";
57
+ var version = "5.4.5";
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
@@ -3560,14 +3560,17 @@ function createDynamicPriorityPollingWatchFile(host) {
3560
3560
  pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === 250 /* Low */ ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingInterval === 250 /* Low */ ? "pollLowPollingIntervalQueue" : "pollPollingIntervalQueue", pollingIntervalQueue(pollingInterval));
3561
3561
  }
3562
3562
  }
3563
- function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames2) {
3563
+ function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames2, getModifiedTime2, fsWatchWithTimestamp) {
3564
3564
  const fileWatcherCallbacks = createMultiMap();
3565
+ const fileTimestamps = fsWatchWithTimestamp ? /* @__PURE__ */ new Map() : void 0;
3565
3566
  const dirWatchers = /* @__PURE__ */ new Map();
3566
3567
  const toCanonicalName = createGetCanonicalFileName(useCaseSensitiveFileNames2);
3567
3568
  return nonPollingWatchFile;
3568
3569
  function nonPollingWatchFile(fileName, callback, _pollingInterval, fallbackOptions) {
3569
3570
  const filePath = toCanonicalName(fileName);
3570
- fileWatcherCallbacks.add(filePath, callback);
3571
+ if (fileWatcherCallbacks.add(filePath, callback).length === 1 && fileTimestamps) {
3572
+ fileTimestamps.set(filePath, getModifiedTime2(fileName) || missingFileModifiedTime);
3573
+ }
3571
3574
  const dirPath = getDirectoryPath(filePath) || ".";
3572
3575
  const watcher = dirWatchers.get(dirPath) || createDirectoryWatcher(getDirectoryPath(fileName) || ".", dirPath, fallbackOptions);
3573
3576
  watcher.referenceCount++;
@@ -3587,14 +3590,31 @@ function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFi
3587
3590
  const watcher = fsWatch(
3588
3591
  dirName,
3589
3592
  1 /* Directory */,
3590
- (_eventName, relativeFileName, modifiedTime) => {
3593
+ (eventName, relativeFileName) => {
3591
3594
  if (!isString(relativeFileName))
3592
3595
  return;
3593
3596
  const fileName = getNormalizedAbsolutePath(relativeFileName, dirName);
3594
- const callbacks = fileName && fileWatcherCallbacks.get(toCanonicalName(fileName));
3597
+ const filePath = toCanonicalName(fileName);
3598
+ const callbacks = fileName && fileWatcherCallbacks.get(filePath);
3595
3599
  if (callbacks) {
3600
+ let currentModifiedTime;
3601
+ let eventKind = 1 /* Changed */;
3602
+ if (fileTimestamps) {
3603
+ const existingTime = fileTimestamps.get(filePath);
3604
+ if (eventName === "change") {
3605
+ currentModifiedTime = getModifiedTime2(fileName) || missingFileModifiedTime;
3606
+ if (currentModifiedTime.getTime() === existingTime.getTime())
3607
+ return;
3608
+ }
3609
+ currentModifiedTime || (currentModifiedTime = getModifiedTime2(fileName) || missingFileModifiedTime);
3610
+ fileTimestamps.set(filePath, currentModifiedTime);
3611
+ if (existingTime === missingFileModifiedTime)
3612
+ eventKind = 0 /* Created */;
3613
+ else if (currentModifiedTime === missingFileModifiedTime)
3614
+ eventKind = 2 /* Deleted */;
3615
+ }
3596
3616
  for (const fileCallback of callbacks) {
3597
- fileCallback(fileName, 1 /* Changed */, modifiedTime);
3617
+ fileCallback(fileName, eventKind, currentModifiedTime);
3598
3618
  }
3599
3619
  }
3600
3620
  },
@@ -3985,7 +4005,7 @@ function createSystemWatchFunctions({
3985
4005
  );
3986
4006
  case 5 /* UseFsEventsOnParentDirectory */:
3987
4007
  if (!nonPollingWatchFile) {
3988
- nonPollingWatchFile = createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames2);
4008
+ nonPollingWatchFile = createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames2, getModifiedTime2, fsWatchWithTimestamp);
3989
4009
  }
3990
4010
  return nonPollingWatchFile(fileName, callback, pollingInterval, getFallbackOptions(options));
3991
4011
  default:
@@ -4160,7 +4180,7 @@ function createSystemWatchFunctions({
4160
4180
  return watchPresentFileSystemEntryWithFsWatchFile();
4161
4181
  }
4162
4182
  try {
4163
- const presentWatcher = (!fsWatchWithTimestamp ? fsWatchWorker : fsWatchWorkerHandlingTimestamp)(
4183
+ const presentWatcher = (entryKind === 1 /* Directory */ || !fsWatchWithTimestamp ? fsWatchWorker : fsWatchWorkerHandlingTimestamp)(
4164
4184
  fileOrDirectory,
4165
4185
  recursive,
4166
4186
  inodeWatching ? callbackChangingToMissingFileSystemEntry : callback
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "typescript",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.4.2",
5
+ "version": "5.4.5",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [