typescript 4.9.0-dev.20220905 → 4.9.0-dev.20220907

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
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
69
69
  var ts;
70
70
  (function (ts) {
71
71
  ts.versionMajorMinor = "4.9";
72
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220905");
72
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220907");
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -3733,7 +3733,6 @@ var ts;
3733
3733
  createPollingIntervalBasedLevels(customLevels ? __assign(__assign({}, defaultLevels), customLevels) : defaultLevels);
3734
3734
  }
3735
3735
  }
3736
- ts.setCustomPollingValues = setCustomPollingValues;
3737
3736
  function pollWatchedFileQueue(host, queue, pollIndex, chunkSize, callbackOnWatchFileStat) {
3738
3737
  var definedValueCopyToIndex = pollIndex;
3739
3738
  for (var canVisit = queue.length; chunkSize && canVisit; nextPollIndex(), canVisit--) {
@@ -3871,7 +3870,6 @@ var ts;
3871
3870
  pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === PollingInterval.Low ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingIntervalQueue(pollingInterval));
3872
3871
  }
3873
3872
  }
3874
- ts.createDynamicPriorityPollingWatchFile = createDynamicPriorityPollingWatchFile;
3875
3873
  function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames) {
3876
3874
  var fileWatcherCallbacks = ts.createMultiMap();
3877
3875
  var dirWatchers = new ts.Map();
@@ -3946,37 +3944,31 @@ var ts;
3946
3944
  pollScheduled = host.setTimeout(pollQueue, PollingInterval.High);
3947
3945
  }
3948
3946
  }
3949
- function createSingleFileWatcherPerName(watchFile, useCaseSensitiveFileNames) {
3950
- var cache = new ts.Map();
3951
- var callbacksCache = ts.createMultiMap();
3947
+ function createSingleWatcherPerName(cache, useCaseSensitiveFileNames, name, callback, createWatcher) {
3952
3948
  var toCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
3953
- return function (fileName, callback, pollingInterval, options) {
3954
- var path = toCanonicalFileName(fileName);
3955
- var existing = cache.get(path);
3956
- if (existing) {
3957
- existing.refCount++;
3958
- }
3959
- else {
3960
- cache.set(path, {
3961
- watcher: watchFile(fileName, function (fileName, eventKind, modifiedTime) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind, modifiedTime); }); }, pollingInterval, options),
3962
- refCount: 1
3963
- });
3949
+ var path = toCanonicalFileName(name);
3950
+ var existing = cache.get(path);
3951
+ if (existing) {
3952
+ existing.callbacks.push(callback);
3953
+ }
3954
+ else {
3955
+ cache.set(path, {
3956
+ watcher: createWatcher((function (param1, param2, param3) { var _a; return (_a = cache.get(path)) === null || _a === void 0 ? void 0 : _a.callbacks.slice().forEach(function (cb) { return cb(param1, param2, param3); }); })),
3957
+ callbacks: [callback]
3958
+ });
3959
+ }
3960
+ return {
3961
+ close: function () {
3962
+ var watcher = cache.get(path);
3963
+ if (!watcher)
3964
+ return;
3965
+ if (!ts.orderedRemoveItem(watcher.callbacks, callback) || watcher.callbacks.length)
3966
+ return;
3967
+ cache.delete(path);
3968
+ ts.closeFileWatcherOf(watcher);
3964
3969
  }
3965
- callbacksCache.add(path, callback);
3966
- return {
3967
- close: function () {
3968
- var watcher = ts.Debug.checkDefined(cache.get(path));
3969
- callbacksCache.remove(path, callback);
3970
- watcher.refCount--;
3971
- if (watcher.refCount)
3972
- return;
3973
- cache.delete(path);
3974
- ts.closeFileWatcherOf(watcher);
3975
- }
3976
- };
3977
3970
  };
3978
3971
  }
3979
- ts.createSingleFileWatcherPerName = createSingleFileWatcherPerName;
3980
3972
  function onWatchedFileStat(watchedFile, modifiedTime) {
3981
3973
  var oldTime = watchedFile.mtime.getTime();
3982
3974
  var newTime = modifiedTime.getTime();
@@ -3987,7 +3979,6 @@ var ts;
3987
3979
  }
3988
3980
  return false;
3989
3981
  }
3990
- ts.onWatchedFileStat = onWatchedFileStat;
3991
3982
  function getFileWatcherEventKind(oldTime, newTime) {
3992
3983
  return oldTime === 0
3993
3984
  ? FileWatcherEventKind.Created
@@ -4194,11 +4185,9 @@ var ts;
4194
4185
  return ts.stringContains(toCanonicalFilePath(path), searchPath);
4195
4186
  }
4196
4187
  }
4197
- ts.createDirectoryWatcherSupportingRecursive = createDirectoryWatcherSupportingRecursive;
4198
4188
  function createFileWatcherCallback(callback) {
4199
4189
  return function (_fileName, eventKind, modifiedTime) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); };
4200
4190
  }
4201
- ts.createFileWatcherCallback = createFileWatcherCallback;
4202
4191
  function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime) {
4203
4192
  return function (eventName, _relativeFileName, modifiedTime) {
4204
4193
  if (eventName === "rename") {
@@ -4225,7 +4214,10 @@ var ts;
4225
4214
  };
4226
4215
  }
4227
4216
  function createSystemWatchFunctions(_a) {
4228
- var pollingWatchFile = _a.pollingWatchFile, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog;
4217
+ var pollingWatchFileWorker = _a.pollingWatchFileWorker, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog;
4218
+ var pollingWatches = new ts.Map();
4219
+ var fsWatches = new ts.Map();
4220
+ var fsWatchesRecursive = new ts.Map();
4229
4221
  var dynamicPollingWatchFile;
4230
4222
  var fixedChunkSizePollingWatchFile;
4231
4223
  var nonPollingWatchFile;
@@ -4281,7 +4273,7 @@ var ts;
4281
4273
  default:
4282
4274
  return useNonPollingWatchers ?
4283
4275
  generateWatchFileOptions(ts.WatchFileKind.UseFsEventsOnParentDirectory, ts.PollingWatchKind.PriorityInterval, options) :
4284
- { watchFile: (defaultWatchFileKind === null || defaultWatchFileKind === void 0 ? void 0 : defaultWatchFileKind()) || ts.WatchFileKind.FixedPollingInterval };
4276
+ { watchFile: (defaultWatchFileKind === null || defaultWatchFileKind === void 0 ? void 0 : defaultWatchFileKind()) || ts.WatchFileKind.UseFsEvents };
4285
4277
  }
4286
4278
  }
4287
4279
  function generateWatchFileOptions(watchFile, fallbackPolling, options) {
@@ -4346,7 +4338,13 @@ var ts;
4346
4338
  };
4347
4339
  }
4348
4340
  }
4341
+ function pollingWatchFile(fileName, callback, pollingInterval, options) {
4342
+ return createSingleWatcherPerName(pollingWatches, useCaseSensitiveFileNames, fileName, callback, function (cb) { return pollingWatchFileWorker(fileName, cb, pollingInterval, options); });
4343
+ }
4349
4344
  function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
4345
+ return createSingleWatcherPerName(recursive ? fsWatchesRecursive : fsWatches, useCaseSensitiveFileNames, fileOrDirectory, callback, function (cb) { return fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, cb, recursive, fallbackPollingInterval, fallbackOptions); });
4346
+ }
4347
+ function fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
4350
4348
  var lastDirectoryPartWithDirectorySeparator;
4351
4349
  var lastDirectoryPart;
4352
4350
  if (inodeWatching) {
@@ -4484,7 +4482,7 @@ var ts;
4484
4482
  var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin");
4485
4483
  var getCurrentDirectory = ts.memoize(function () { return process.cwd(); });
4486
4484
  var _b = createSystemWatchFunctions({
4487
- pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames),
4485
+ pollingWatchFileWorker: fsWatchFileWorker,
4488
4486
  getModifiedTime: getModifiedTime,
4489
4487
  setTimeout: setTimeout,
4490
4488
  clearTimeout: clearTimeout,
package/lib/tsserver.js CHANGED
@@ -109,7 +109,7 @@ var ts;
109
109
  // The following is baselined as a literal template type without intervention
110
110
  /** The version of the TypeScript compiler release */
111
111
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
112
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220905");
112
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220907");
113
113
  /* @internal */
114
114
  var Comparison;
115
115
  (function (Comparison) {
@@ -6147,7 +6147,6 @@ var ts;
6147
6147
  var pollingChunkSize = createPollingIntervalBasedLevels(defaultChunkLevels);
6148
6148
  /* @internal */
6149
6149
  ts.unchangedPollThresholds = createPollingIntervalBasedLevels(defaultChunkLevels);
6150
- /* @internal */
6151
6150
  function setCustomPollingValues(system) {
6152
6151
  if (!system.getEnvironmentVariable) {
6153
6152
  return;
@@ -6190,7 +6189,6 @@ var ts;
6190
6189
  createPollingIntervalBasedLevels(customLevels ? __assign(__assign({}, defaultLevels), customLevels) : defaultLevels);
6191
6190
  }
6192
6191
  }
6193
- ts.setCustomPollingValues = setCustomPollingValues;
6194
6192
  function pollWatchedFileQueue(host, queue, pollIndex, chunkSize, callbackOnWatchFileStat) {
6195
6193
  var definedValueCopyToIndex = pollIndex;
6196
6194
  // Max visit would be all elements of the queue
@@ -6236,7 +6234,6 @@ var ts;
6236
6234
  }
6237
6235
  }
6238
6236
  }
6239
- /* @internal */
6240
6237
  function createDynamicPriorityPollingWatchFile(host) {
6241
6238
  var watchedFiles = [];
6242
6239
  var changedFilesInLastPoll = [];
@@ -6345,7 +6342,6 @@ var ts;
6345
6342
  pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === PollingInterval.Low ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingIntervalQueue(pollingInterval));
6346
6343
  }
6347
6344
  }
6348
- ts.createDynamicPriorityPollingWatchFile = createDynamicPriorityPollingWatchFile;
6349
6345
  function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames) {
6350
6346
  // One file can have multiple watchers
6351
6347
  var fileWatcherCallbacks = ts.createMultiMap();
@@ -6424,42 +6420,38 @@ var ts;
6424
6420
  pollScheduled = host.setTimeout(pollQueue, PollingInterval.High);
6425
6421
  }
6426
6422
  }
6427
- /* @internal */
6428
- function createSingleFileWatcherPerName(watchFile, useCaseSensitiveFileNames) {
6429
- var cache = new ts.Map();
6430
- var callbacksCache = ts.createMultiMap();
6423
+ function createSingleWatcherPerName(cache, useCaseSensitiveFileNames, name, callback, createWatcher) {
6431
6424
  var toCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
6432
- return function (fileName, callback, pollingInterval, options) {
6433
- var path = toCanonicalFileName(fileName);
6434
- var existing = cache.get(path);
6435
- if (existing) {
6436
- existing.refCount++;
6437
- }
6438
- else {
6439
- cache.set(path, {
6440
- watcher: watchFile(fileName, function (fileName, eventKind, modifiedTime) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind, modifiedTime); }); }, pollingInterval, options),
6441
- refCount: 1
6442
- });
6425
+ var path = toCanonicalFileName(name);
6426
+ var existing = cache.get(path);
6427
+ if (existing) {
6428
+ existing.callbacks.push(callback);
6429
+ }
6430
+ else {
6431
+ cache.set(path, {
6432
+ watcher: createWatcher((
6433
+ // Cant infer types correctly so lets satisfy checker
6434
+ function (param1, param2, param3) { var _a; return (_a = cache.get(path)) === null || _a === void 0 ? void 0 : _a.callbacks.slice().forEach(function (cb) { return cb(param1, param2, param3); }); })),
6435
+ callbacks: [callback]
6436
+ });
6437
+ }
6438
+ return {
6439
+ close: function () {
6440
+ var watcher = cache.get(path);
6441
+ // Watcher is not expected to be undefined, but if it is normally its because
6442
+ // exception was thrown somewhere else and watch state is not what it should be
6443
+ if (!watcher)
6444
+ return;
6445
+ if (!ts.orderedRemoveItem(watcher.callbacks, callback) || watcher.callbacks.length)
6446
+ return;
6447
+ cache.delete(path);
6448
+ ts.closeFileWatcherOf(watcher);
6443
6449
  }
6444
- callbacksCache.add(path, callback);
6445
- return {
6446
- close: function () {
6447
- var watcher = ts.Debug.checkDefined(cache.get(path));
6448
- callbacksCache.remove(path, callback);
6449
- watcher.refCount--;
6450
- if (watcher.refCount)
6451
- return;
6452
- cache.delete(path);
6453
- ts.closeFileWatcherOf(watcher);
6454
- }
6455
- };
6456
6450
  };
6457
6451
  }
6458
- ts.createSingleFileWatcherPerName = createSingleFileWatcherPerName;
6459
6452
  /**
6460
6453
  * Returns true if file status changed
6461
6454
  */
6462
- /*@internal*/
6463
6455
  function onWatchedFileStat(watchedFile, modifiedTime) {
6464
6456
  var oldTime = watchedFile.mtime.getTime();
6465
6457
  var newTime = modifiedTime.getTime();
@@ -6471,7 +6463,6 @@ var ts;
6471
6463
  }
6472
6464
  return false;
6473
6465
  }
6474
- ts.onWatchedFileStat = onWatchedFileStat;
6475
6466
  /*@internal*/
6476
6467
  function getFileWatcherEventKind(oldTime, newTime) {
6477
6468
  return oldTime === 0
@@ -6499,7 +6490,6 @@ var ts;
6499
6490
  * that means if this is recursive watcher, watch the children directories as well
6500
6491
  * (eg on OS that dont support recursive watch using fs.watch use fs.watchFile)
6501
6492
  */
6502
- /*@internal*/
6503
6493
  function createDirectoryWatcherSupportingRecursive(_a) {
6504
6494
  var watchDirectory = _a.watchDirectory, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, fileSystemEntryExists = _a.fileSystemEntryExists, realpath = _a.realpath, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout;
6505
6495
  var cache = new ts.Map();
@@ -6708,18 +6698,15 @@ var ts;
6708
6698
  return ts.stringContains(toCanonicalFilePath(path), searchPath);
6709
6699
  }
6710
6700
  }
6711
- ts.createDirectoryWatcherSupportingRecursive = createDirectoryWatcherSupportingRecursive;
6712
6701
  /*@internal*/
6713
6702
  var FileSystemEntryKind;
6714
6703
  (function (FileSystemEntryKind) {
6715
6704
  FileSystemEntryKind[FileSystemEntryKind["File"] = 0] = "File";
6716
6705
  FileSystemEntryKind[FileSystemEntryKind["Directory"] = 1] = "Directory";
6717
6706
  })(FileSystemEntryKind = ts.FileSystemEntryKind || (ts.FileSystemEntryKind = {}));
6718
- /*@internal*/
6719
6707
  function createFileWatcherCallback(callback) {
6720
6708
  return function (_fileName, eventKind, modifiedTime) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); };
6721
6709
  }
6722
- ts.createFileWatcherCallback = createFileWatcherCallback;
6723
6710
  function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime) {
6724
6711
  return function (eventName, _relativeFileName, modifiedTime) {
6725
6712
  if (eventName === "rename") {
@@ -6753,7 +6740,10 @@ var ts;
6753
6740
  }
6754
6741
  /*@internal*/
6755
6742
  function createSystemWatchFunctions(_a) {
6756
- var pollingWatchFile = _a.pollingWatchFile, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog;
6743
+ var pollingWatchFileWorker = _a.pollingWatchFileWorker, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog;
6744
+ var pollingWatches = new ts.Map();
6745
+ var fsWatches = new ts.Map();
6746
+ var fsWatchesRecursive = new ts.Map();
6757
6747
  var dynamicPollingWatchFile;
6758
6748
  var fixedChunkSizePollingWatchFile;
6759
6749
  var nonPollingWatchFile;
@@ -6817,7 +6807,7 @@ var ts;
6817
6807
  // Use notifications from FS to watch with falling back to fs.watchFile
6818
6808
  generateWatchFileOptions(ts.WatchFileKind.UseFsEventsOnParentDirectory, ts.PollingWatchKind.PriorityInterval, options) :
6819
6809
  // Default to do not use fixed polling interval
6820
- { watchFile: (defaultWatchFileKind === null || defaultWatchFileKind === void 0 ? void 0 : defaultWatchFileKind()) || ts.WatchFileKind.FixedPollingInterval };
6810
+ { watchFile: (defaultWatchFileKind === null || defaultWatchFileKind === void 0 ? void 0 : defaultWatchFileKind()) || ts.WatchFileKind.UseFsEvents };
6821
6811
  }
6822
6812
  }
6823
6813
  function generateWatchFileOptions(watchFile, fallbackPolling, options) {
@@ -6888,7 +6878,13 @@ var ts;
6888
6878
  };
6889
6879
  }
6890
6880
  }
6881
+ function pollingWatchFile(fileName, callback, pollingInterval, options) {
6882
+ return createSingleWatcherPerName(pollingWatches, useCaseSensitiveFileNames, fileName, callback, function (cb) { return pollingWatchFileWorker(fileName, cb, pollingInterval, options); });
6883
+ }
6891
6884
  function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
6885
+ return createSingleWatcherPerName(recursive ? fsWatchesRecursive : fsWatches, useCaseSensitiveFileNames, fileOrDirectory, callback, function (cb) { return fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, cb, recursive, fallbackPollingInterval, fallbackOptions); });
6886
+ }
6887
+ function fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
6892
6888
  var lastDirectoryPartWithDirectorySeparator;
6893
6889
  var lastDirectoryPart;
6894
6890
  if (inodeWatching) {
@@ -7067,7 +7063,7 @@ var ts;
7067
7063
  var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin");
7068
7064
  var getCurrentDirectory = ts.memoize(function () { return process.cwd(); });
7069
7065
  var _b = createSystemWatchFunctions({
7070
- pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames),
7066
+ pollingWatchFileWorker: fsWatchFileWorker,
7071
7067
  getModifiedTime: getModifiedTime,
7072
7068
  setTimeout: setTimeout,
7073
7069
  clearTimeout: clearTimeout,
@@ -184465,20 +184461,6 @@ var ts;
184465
184461
  }
184466
184462
  // Override sys.write because fs.writeSync is not reliable on Node 4
184467
184463
  sys.write = function (s) { return writeMessage(sys.bufferFrom(s, "utf8")); };
184468
- // REVIEW: for now this implementation uses polling.
184469
- // The advantage of polling is that it works reliably
184470
- // on all os and with network mounted files.
184471
- // For 90 referenced files, the average time to detect
184472
- // changes is 2*msInterval (by default 5 seconds).
184473
- // The overhead of this is .04 percent (1/2500) with
184474
- // average pause of < 1 millisecond (and max
184475
- // pause less than 1.5 milliseconds); question is
184476
- // do we anticipate reference sets in the 100s and
184477
- // do we care about waiting 10-20 seconds to detect
184478
- // changes for large reference sets? If so, do we want
184479
- // to increase the chunk size or decrease the interval
184480
- // time dynamically to match the large reference set?
184481
- sys.defaultWatchFileKind = function () { return ts.WatchFileKind.FixedChunkSizePolling; };
184482
184464
  /* eslint-disable no-restricted-globals */
184483
184465
  sys.setTimeout = setTimeout;
184484
184466
  sys.clearTimeout = clearTimeout;
@@ -108,7 +108,7 @@ var ts;
108
108
  // The following is baselined as a literal template type without intervention
109
109
  /** The version of the TypeScript compiler release */
110
110
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
111
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220905");
111
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220907");
112
112
  /* @internal */
113
113
  var Comparison;
114
114
  (function (Comparison) {
@@ -6146,7 +6146,6 @@ var ts;
6146
6146
  var pollingChunkSize = createPollingIntervalBasedLevels(defaultChunkLevels);
6147
6147
  /* @internal */
6148
6148
  ts.unchangedPollThresholds = createPollingIntervalBasedLevels(defaultChunkLevels);
6149
- /* @internal */
6150
6149
  function setCustomPollingValues(system) {
6151
6150
  if (!system.getEnvironmentVariable) {
6152
6151
  return;
@@ -6189,7 +6188,6 @@ var ts;
6189
6188
  createPollingIntervalBasedLevels(customLevels ? __assign(__assign({}, defaultLevels), customLevels) : defaultLevels);
6190
6189
  }
6191
6190
  }
6192
- ts.setCustomPollingValues = setCustomPollingValues;
6193
6191
  function pollWatchedFileQueue(host, queue, pollIndex, chunkSize, callbackOnWatchFileStat) {
6194
6192
  var definedValueCopyToIndex = pollIndex;
6195
6193
  // Max visit would be all elements of the queue
@@ -6235,7 +6233,6 @@ var ts;
6235
6233
  }
6236
6234
  }
6237
6235
  }
6238
- /* @internal */
6239
6236
  function createDynamicPriorityPollingWatchFile(host) {
6240
6237
  var watchedFiles = [];
6241
6238
  var changedFilesInLastPoll = [];
@@ -6344,7 +6341,6 @@ var ts;
6344
6341
  pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === PollingInterval.Low ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingIntervalQueue(pollingInterval));
6345
6342
  }
6346
6343
  }
6347
- ts.createDynamicPriorityPollingWatchFile = createDynamicPriorityPollingWatchFile;
6348
6344
  function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames) {
6349
6345
  // One file can have multiple watchers
6350
6346
  var fileWatcherCallbacks = ts.createMultiMap();
@@ -6423,42 +6419,38 @@ var ts;
6423
6419
  pollScheduled = host.setTimeout(pollQueue, PollingInterval.High);
6424
6420
  }
6425
6421
  }
6426
- /* @internal */
6427
- function createSingleFileWatcherPerName(watchFile, useCaseSensitiveFileNames) {
6428
- var cache = new ts.Map();
6429
- var callbacksCache = ts.createMultiMap();
6422
+ function createSingleWatcherPerName(cache, useCaseSensitiveFileNames, name, callback, createWatcher) {
6430
6423
  var toCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
6431
- return function (fileName, callback, pollingInterval, options) {
6432
- var path = toCanonicalFileName(fileName);
6433
- var existing = cache.get(path);
6434
- if (existing) {
6435
- existing.refCount++;
6436
- }
6437
- else {
6438
- cache.set(path, {
6439
- watcher: watchFile(fileName, function (fileName, eventKind, modifiedTime) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind, modifiedTime); }); }, pollingInterval, options),
6440
- refCount: 1
6441
- });
6424
+ var path = toCanonicalFileName(name);
6425
+ var existing = cache.get(path);
6426
+ if (existing) {
6427
+ existing.callbacks.push(callback);
6428
+ }
6429
+ else {
6430
+ cache.set(path, {
6431
+ watcher: createWatcher((
6432
+ // Cant infer types correctly so lets satisfy checker
6433
+ function (param1, param2, param3) { var _a; return (_a = cache.get(path)) === null || _a === void 0 ? void 0 : _a.callbacks.slice().forEach(function (cb) { return cb(param1, param2, param3); }); })),
6434
+ callbacks: [callback]
6435
+ });
6436
+ }
6437
+ return {
6438
+ close: function () {
6439
+ var watcher = cache.get(path);
6440
+ // Watcher is not expected to be undefined, but if it is normally its because
6441
+ // exception was thrown somewhere else and watch state is not what it should be
6442
+ if (!watcher)
6443
+ return;
6444
+ if (!ts.orderedRemoveItem(watcher.callbacks, callback) || watcher.callbacks.length)
6445
+ return;
6446
+ cache.delete(path);
6447
+ ts.closeFileWatcherOf(watcher);
6442
6448
  }
6443
- callbacksCache.add(path, callback);
6444
- return {
6445
- close: function () {
6446
- var watcher = ts.Debug.checkDefined(cache.get(path));
6447
- callbacksCache.remove(path, callback);
6448
- watcher.refCount--;
6449
- if (watcher.refCount)
6450
- return;
6451
- cache.delete(path);
6452
- ts.closeFileWatcherOf(watcher);
6453
- }
6454
- };
6455
6449
  };
6456
6450
  }
6457
- ts.createSingleFileWatcherPerName = createSingleFileWatcherPerName;
6458
6451
  /**
6459
6452
  * Returns true if file status changed
6460
6453
  */
6461
- /*@internal*/
6462
6454
  function onWatchedFileStat(watchedFile, modifiedTime) {
6463
6455
  var oldTime = watchedFile.mtime.getTime();
6464
6456
  var newTime = modifiedTime.getTime();
@@ -6470,7 +6462,6 @@ var ts;
6470
6462
  }
6471
6463
  return false;
6472
6464
  }
6473
- ts.onWatchedFileStat = onWatchedFileStat;
6474
6465
  /*@internal*/
6475
6466
  function getFileWatcherEventKind(oldTime, newTime) {
6476
6467
  return oldTime === 0
@@ -6498,7 +6489,6 @@ var ts;
6498
6489
  * that means if this is recursive watcher, watch the children directories as well
6499
6490
  * (eg on OS that dont support recursive watch using fs.watch use fs.watchFile)
6500
6491
  */
6501
- /*@internal*/
6502
6492
  function createDirectoryWatcherSupportingRecursive(_a) {
6503
6493
  var watchDirectory = _a.watchDirectory, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, fileSystemEntryExists = _a.fileSystemEntryExists, realpath = _a.realpath, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout;
6504
6494
  var cache = new ts.Map();
@@ -6707,18 +6697,15 @@ var ts;
6707
6697
  return ts.stringContains(toCanonicalFilePath(path), searchPath);
6708
6698
  }
6709
6699
  }
6710
- ts.createDirectoryWatcherSupportingRecursive = createDirectoryWatcherSupportingRecursive;
6711
6700
  /*@internal*/
6712
6701
  var FileSystemEntryKind;
6713
6702
  (function (FileSystemEntryKind) {
6714
6703
  FileSystemEntryKind[FileSystemEntryKind["File"] = 0] = "File";
6715
6704
  FileSystemEntryKind[FileSystemEntryKind["Directory"] = 1] = "Directory";
6716
6705
  })(FileSystemEntryKind = ts.FileSystemEntryKind || (ts.FileSystemEntryKind = {}));
6717
- /*@internal*/
6718
6706
  function createFileWatcherCallback(callback) {
6719
6707
  return function (_fileName, eventKind, modifiedTime) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); };
6720
6708
  }
6721
- ts.createFileWatcherCallback = createFileWatcherCallback;
6722
6709
  function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime) {
6723
6710
  return function (eventName, _relativeFileName, modifiedTime) {
6724
6711
  if (eventName === "rename") {
@@ -6752,7 +6739,10 @@ var ts;
6752
6739
  }
6753
6740
  /*@internal*/
6754
6741
  function createSystemWatchFunctions(_a) {
6755
- var pollingWatchFile = _a.pollingWatchFile, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog;
6742
+ var pollingWatchFileWorker = _a.pollingWatchFileWorker, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog;
6743
+ var pollingWatches = new ts.Map();
6744
+ var fsWatches = new ts.Map();
6745
+ var fsWatchesRecursive = new ts.Map();
6756
6746
  var dynamicPollingWatchFile;
6757
6747
  var fixedChunkSizePollingWatchFile;
6758
6748
  var nonPollingWatchFile;
@@ -6816,7 +6806,7 @@ var ts;
6816
6806
  // Use notifications from FS to watch with falling back to fs.watchFile
6817
6807
  generateWatchFileOptions(ts.WatchFileKind.UseFsEventsOnParentDirectory, ts.PollingWatchKind.PriorityInterval, options) :
6818
6808
  // Default to do not use fixed polling interval
6819
- { watchFile: (defaultWatchFileKind === null || defaultWatchFileKind === void 0 ? void 0 : defaultWatchFileKind()) || ts.WatchFileKind.FixedPollingInterval };
6809
+ { watchFile: (defaultWatchFileKind === null || defaultWatchFileKind === void 0 ? void 0 : defaultWatchFileKind()) || ts.WatchFileKind.UseFsEvents };
6820
6810
  }
6821
6811
  }
6822
6812
  function generateWatchFileOptions(watchFile, fallbackPolling, options) {
@@ -6887,7 +6877,13 @@ var ts;
6887
6877
  };
6888
6878
  }
6889
6879
  }
6880
+ function pollingWatchFile(fileName, callback, pollingInterval, options) {
6881
+ return createSingleWatcherPerName(pollingWatches, useCaseSensitiveFileNames, fileName, callback, function (cb) { return pollingWatchFileWorker(fileName, cb, pollingInterval, options); });
6882
+ }
6890
6883
  function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
6884
+ return createSingleWatcherPerName(recursive ? fsWatchesRecursive : fsWatches, useCaseSensitiveFileNames, fileOrDirectory, callback, function (cb) { return fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, cb, recursive, fallbackPollingInterval, fallbackOptions); });
6885
+ }
6886
+ function fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
6891
6887
  var lastDirectoryPartWithDirectorySeparator;
6892
6888
  var lastDirectoryPart;
6893
6889
  if (inodeWatching) {
@@ -7066,7 +7062,7 @@ var ts;
7066
7062
  var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin");
7067
7063
  var getCurrentDirectory = ts.memoize(function () { return process.cwd(); });
7068
7064
  var _b = createSystemWatchFunctions({
7069
- pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames),
7065
+ pollingWatchFileWorker: fsWatchFileWorker,
7070
7066
  getModifiedTime: getModifiedTime,
7071
7067
  setTimeout: setTimeout,
7072
7068
  clearTimeout: clearTimeout,
package/lib/typescript.js CHANGED
@@ -99,7 +99,7 @@ var ts;
99
99
  // The following is baselined as a literal template type without intervention
100
100
  /** The version of the TypeScript compiler release */
101
101
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
102
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220905");
102
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220907");
103
103
  /* @internal */
104
104
  var Comparison;
105
105
  (function (Comparison) {
@@ -6137,7 +6137,6 @@ var ts;
6137
6137
  var pollingChunkSize = createPollingIntervalBasedLevels(defaultChunkLevels);
6138
6138
  /* @internal */
6139
6139
  ts.unchangedPollThresholds = createPollingIntervalBasedLevels(defaultChunkLevels);
6140
- /* @internal */
6141
6140
  function setCustomPollingValues(system) {
6142
6141
  if (!system.getEnvironmentVariable) {
6143
6142
  return;
@@ -6180,7 +6179,6 @@ var ts;
6180
6179
  createPollingIntervalBasedLevels(customLevels ? __assign(__assign({}, defaultLevels), customLevels) : defaultLevels);
6181
6180
  }
6182
6181
  }
6183
- ts.setCustomPollingValues = setCustomPollingValues;
6184
6182
  function pollWatchedFileQueue(host, queue, pollIndex, chunkSize, callbackOnWatchFileStat) {
6185
6183
  var definedValueCopyToIndex = pollIndex;
6186
6184
  // Max visit would be all elements of the queue
@@ -6226,7 +6224,6 @@ var ts;
6226
6224
  }
6227
6225
  }
6228
6226
  }
6229
- /* @internal */
6230
6227
  function createDynamicPriorityPollingWatchFile(host) {
6231
6228
  var watchedFiles = [];
6232
6229
  var changedFilesInLastPoll = [];
@@ -6335,7 +6332,6 @@ var ts;
6335
6332
  pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === PollingInterval.Low ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingIntervalQueue(pollingInterval));
6336
6333
  }
6337
6334
  }
6338
- ts.createDynamicPriorityPollingWatchFile = createDynamicPriorityPollingWatchFile;
6339
6335
  function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames) {
6340
6336
  // One file can have multiple watchers
6341
6337
  var fileWatcherCallbacks = ts.createMultiMap();
@@ -6414,42 +6410,38 @@ var ts;
6414
6410
  pollScheduled = host.setTimeout(pollQueue, PollingInterval.High);
6415
6411
  }
6416
6412
  }
6417
- /* @internal */
6418
- function createSingleFileWatcherPerName(watchFile, useCaseSensitiveFileNames) {
6419
- var cache = new ts.Map();
6420
- var callbacksCache = ts.createMultiMap();
6413
+ function createSingleWatcherPerName(cache, useCaseSensitiveFileNames, name, callback, createWatcher) {
6421
6414
  var toCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
6422
- return function (fileName, callback, pollingInterval, options) {
6423
- var path = toCanonicalFileName(fileName);
6424
- var existing = cache.get(path);
6425
- if (existing) {
6426
- existing.refCount++;
6427
- }
6428
- else {
6429
- cache.set(path, {
6430
- watcher: watchFile(fileName, function (fileName, eventKind, modifiedTime) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind, modifiedTime); }); }, pollingInterval, options),
6431
- refCount: 1
6432
- });
6415
+ var path = toCanonicalFileName(name);
6416
+ var existing = cache.get(path);
6417
+ if (existing) {
6418
+ existing.callbacks.push(callback);
6419
+ }
6420
+ else {
6421
+ cache.set(path, {
6422
+ watcher: createWatcher((
6423
+ // Cant infer types correctly so lets satisfy checker
6424
+ function (param1, param2, param3) { var _a; return (_a = cache.get(path)) === null || _a === void 0 ? void 0 : _a.callbacks.slice().forEach(function (cb) { return cb(param1, param2, param3); }); })),
6425
+ callbacks: [callback]
6426
+ });
6427
+ }
6428
+ return {
6429
+ close: function () {
6430
+ var watcher = cache.get(path);
6431
+ // Watcher is not expected to be undefined, but if it is normally its because
6432
+ // exception was thrown somewhere else and watch state is not what it should be
6433
+ if (!watcher)
6434
+ return;
6435
+ if (!ts.orderedRemoveItem(watcher.callbacks, callback) || watcher.callbacks.length)
6436
+ return;
6437
+ cache.delete(path);
6438
+ ts.closeFileWatcherOf(watcher);
6433
6439
  }
6434
- callbacksCache.add(path, callback);
6435
- return {
6436
- close: function () {
6437
- var watcher = ts.Debug.checkDefined(cache.get(path));
6438
- callbacksCache.remove(path, callback);
6439
- watcher.refCount--;
6440
- if (watcher.refCount)
6441
- return;
6442
- cache.delete(path);
6443
- ts.closeFileWatcherOf(watcher);
6444
- }
6445
- };
6446
6440
  };
6447
6441
  }
6448
- ts.createSingleFileWatcherPerName = createSingleFileWatcherPerName;
6449
6442
  /**
6450
6443
  * Returns true if file status changed
6451
6444
  */
6452
- /*@internal*/
6453
6445
  function onWatchedFileStat(watchedFile, modifiedTime) {
6454
6446
  var oldTime = watchedFile.mtime.getTime();
6455
6447
  var newTime = modifiedTime.getTime();
@@ -6461,7 +6453,6 @@ var ts;
6461
6453
  }
6462
6454
  return false;
6463
6455
  }
6464
- ts.onWatchedFileStat = onWatchedFileStat;
6465
6456
  /*@internal*/
6466
6457
  function getFileWatcherEventKind(oldTime, newTime) {
6467
6458
  return oldTime === 0
@@ -6489,7 +6480,6 @@ var ts;
6489
6480
  * that means if this is recursive watcher, watch the children directories as well
6490
6481
  * (eg on OS that dont support recursive watch using fs.watch use fs.watchFile)
6491
6482
  */
6492
- /*@internal*/
6493
6483
  function createDirectoryWatcherSupportingRecursive(_a) {
6494
6484
  var watchDirectory = _a.watchDirectory, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, fileSystemEntryExists = _a.fileSystemEntryExists, realpath = _a.realpath, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout;
6495
6485
  var cache = new ts.Map();
@@ -6698,18 +6688,15 @@ var ts;
6698
6688
  return ts.stringContains(toCanonicalFilePath(path), searchPath);
6699
6689
  }
6700
6690
  }
6701
- ts.createDirectoryWatcherSupportingRecursive = createDirectoryWatcherSupportingRecursive;
6702
6691
  /*@internal*/
6703
6692
  var FileSystemEntryKind;
6704
6693
  (function (FileSystemEntryKind) {
6705
6694
  FileSystemEntryKind[FileSystemEntryKind["File"] = 0] = "File";
6706
6695
  FileSystemEntryKind[FileSystemEntryKind["Directory"] = 1] = "Directory";
6707
6696
  })(FileSystemEntryKind = ts.FileSystemEntryKind || (ts.FileSystemEntryKind = {}));
6708
- /*@internal*/
6709
6697
  function createFileWatcherCallback(callback) {
6710
6698
  return function (_fileName, eventKind, modifiedTime) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); };
6711
6699
  }
6712
- ts.createFileWatcherCallback = createFileWatcherCallback;
6713
6700
  function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime) {
6714
6701
  return function (eventName, _relativeFileName, modifiedTime) {
6715
6702
  if (eventName === "rename") {
@@ -6743,7 +6730,10 @@ var ts;
6743
6730
  }
6744
6731
  /*@internal*/
6745
6732
  function createSystemWatchFunctions(_a) {
6746
- var pollingWatchFile = _a.pollingWatchFile, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog;
6733
+ var pollingWatchFileWorker = _a.pollingWatchFileWorker, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog;
6734
+ var pollingWatches = new ts.Map();
6735
+ var fsWatches = new ts.Map();
6736
+ var fsWatchesRecursive = new ts.Map();
6747
6737
  var dynamicPollingWatchFile;
6748
6738
  var fixedChunkSizePollingWatchFile;
6749
6739
  var nonPollingWatchFile;
@@ -6807,7 +6797,7 @@ var ts;
6807
6797
  // Use notifications from FS to watch with falling back to fs.watchFile
6808
6798
  generateWatchFileOptions(ts.WatchFileKind.UseFsEventsOnParentDirectory, ts.PollingWatchKind.PriorityInterval, options) :
6809
6799
  // Default to do not use fixed polling interval
6810
- { watchFile: (defaultWatchFileKind === null || defaultWatchFileKind === void 0 ? void 0 : defaultWatchFileKind()) || ts.WatchFileKind.FixedPollingInterval };
6800
+ { watchFile: (defaultWatchFileKind === null || defaultWatchFileKind === void 0 ? void 0 : defaultWatchFileKind()) || ts.WatchFileKind.UseFsEvents };
6811
6801
  }
6812
6802
  }
6813
6803
  function generateWatchFileOptions(watchFile, fallbackPolling, options) {
@@ -6878,7 +6868,13 @@ var ts;
6878
6868
  };
6879
6869
  }
6880
6870
  }
6871
+ function pollingWatchFile(fileName, callback, pollingInterval, options) {
6872
+ return createSingleWatcherPerName(pollingWatches, useCaseSensitiveFileNames, fileName, callback, function (cb) { return pollingWatchFileWorker(fileName, cb, pollingInterval, options); });
6873
+ }
6881
6874
  function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
6875
+ return createSingleWatcherPerName(recursive ? fsWatchesRecursive : fsWatches, useCaseSensitiveFileNames, fileOrDirectory, callback, function (cb) { return fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, cb, recursive, fallbackPollingInterval, fallbackOptions); });
6876
+ }
6877
+ function fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
6882
6878
  var lastDirectoryPartWithDirectorySeparator;
6883
6879
  var lastDirectoryPart;
6884
6880
  if (inodeWatching) {
@@ -7057,7 +7053,7 @@ var ts;
7057
7053
  var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin");
7058
7054
  var getCurrentDirectory = ts.memoize(function () { return process.cwd(); });
7059
7055
  var _b = createSystemWatchFunctions({
7060
- pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames),
7056
+ pollingWatchFileWorker: fsWatchFileWorker,
7061
7057
  getModifiedTime: getModifiedTime,
7062
7058
  setTimeout: setTimeout,
7063
7059
  clearTimeout: clearTimeout,
@@ -99,7 +99,7 @@ var ts;
99
99
  // The following is baselined as a literal template type without intervention
100
100
  /** The version of the TypeScript compiler release */
101
101
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
102
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220905");
102
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220907");
103
103
  /* @internal */
104
104
  var Comparison;
105
105
  (function (Comparison) {
@@ -6137,7 +6137,6 @@ var ts;
6137
6137
  var pollingChunkSize = createPollingIntervalBasedLevels(defaultChunkLevels);
6138
6138
  /* @internal */
6139
6139
  ts.unchangedPollThresholds = createPollingIntervalBasedLevels(defaultChunkLevels);
6140
- /* @internal */
6141
6140
  function setCustomPollingValues(system) {
6142
6141
  if (!system.getEnvironmentVariable) {
6143
6142
  return;
@@ -6180,7 +6179,6 @@ var ts;
6180
6179
  createPollingIntervalBasedLevels(customLevels ? __assign(__assign({}, defaultLevels), customLevels) : defaultLevels);
6181
6180
  }
6182
6181
  }
6183
- ts.setCustomPollingValues = setCustomPollingValues;
6184
6182
  function pollWatchedFileQueue(host, queue, pollIndex, chunkSize, callbackOnWatchFileStat) {
6185
6183
  var definedValueCopyToIndex = pollIndex;
6186
6184
  // Max visit would be all elements of the queue
@@ -6226,7 +6224,6 @@ var ts;
6226
6224
  }
6227
6225
  }
6228
6226
  }
6229
- /* @internal */
6230
6227
  function createDynamicPriorityPollingWatchFile(host) {
6231
6228
  var watchedFiles = [];
6232
6229
  var changedFilesInLastPoll = [];
@@ -6335,7 +6332,6 @@ var ts;
6335
6332
  pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === PollingInterval.Low ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingIntervalQueue(pollingInterval));
6336
6333
  }
6337
6334
  }
6338
- ts.createDynamicPriorityPollingWatchFile = createDynamicPriorityPollingWatchFile;
6339
6335
  function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames) {
6340
6336
  // One file can have multiple watchers
6341
6337
  var fileWatcherCallbacks = ts.createMultiMap();
@@ -6414,42 +6410,38 @@ var ts;
6414
6410
  pollScheduled = host.setTimeout(pollQueue, PollingInterval.High);
6415
6411
  }
6416
6412
  }
6417
- /* @internal */
6418
- function createSingleFileWatcherPerName(watchFile, useCaseSensitiveFileNames) {
6419
- var cache = new ts.Map();
6420
- var callbacksCache = ts.createMultiMap();
6413
+ function createSingleWatcherPerName(cache, useCaseSensitiveFileNames, name, callback, createWatcher) {
6421
6414
  var toCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
6422
- return function (fileName, callback, pollingInterval, options) {
6423
- var path = toCanonicalFileName(fileName);
6424
- var existing = cache.get(path);
6425
- if (existing) {
6426
- existing.refCount++;
6427
- }
6428
- else {
6429
- cache.set(path, {
6430
- watcher: watchFile(fileName, function (fileName, eventKind, modifiedTime) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind, modifiedTime); }); }, pollingInterval, options),
6431
- refCount: 1
6432
- });
6415
+ var path = toCanonicalFileName(name);
6416
+ var existing = cache.get(path);
6417
+ if (existing) {
6418
+ existing.callbacks.push(callback);
6419
+ }
6420
+ else {
6421
+ cache.set(path, {
6422
+ watcher: createWatcher((
6423
+ // Cant infer types correctly so lets satisfy checker
6424
+ function (param1, param2, param3) { var _a; return (_a = cache.get(path)) === null || _a === void 0 ? void 0 : _a.callbacks.slice().forEach(function (cb) { return cb(param1, param2, param3); }); })),
6425
+ callbacks: [callback]
6426
+ });
6427
+ }
6428
+ return {
6429
+ close: function () {
6430
+ var watcher = cache.get(path);
6431
+ // Watcher is not expected to be undefined, but if it is normally its because
6432
+ // exception was thrown somewhere else and watch state is not what it should be
6433
+ if (!watcher)
6434
+ return;
6435
+ if (!ts.orderedRemoveItem(watcher.callbacks, callback) || watcher.callbacks.length)
6436
+ return;
6437
+ cache.delete(path);
6438
+ ts.closeFileWatcherOf(watcher);
6433
6439
  }
6434
- callbacksCache.add(path, callback);
6435
- return {
6436
- close: function () {
6437
- var watcher = ts.Debug.checkDefined(cache.get(path));
6438
- callbacksCache.remove(path, callback);
6439
- watcher.refCount--;
6440
- if (watcher.refCount)
6441
- return;
6442
- cache.delete(path);
6443
- ts.closeFileWatcherOf(watcher);
6444
- }
6445
- };
6446
6440
  };
6447
6441
  }
6448
- ts.createSingleFileWatcherPerName = createSingleFileWatcherPerName;
6449
6442
  /**
6450
6443
  * Returns true if file status changed
6451
6444
  */
6452
- /*@internal*/
6453
6445
  function onWatchedFileStat(watchedFile, modifiedTime) {
6454
6446
  var oldTime = watchedFile.mtime.getTime();
6455
6447
  var newTime = modifiedTime.getTime();
@@ -6461,7 +6453,6 @@ var ts;
6461
6453
  }
6462
6454
  return false;
6463
6455
  }
6464
- ts.onWatchedFileStat = onWatchedFileStat;
6465
6456
  /*@internal*/
6466
6457
  function getFileWatcherEventKind(oldTime, newTime) {
6467
6458
  return oldTime === 0
@@ -6489,7 +6480,6 @@ var ts;
6489
6480
  * that means if this is recursive watcher, watch the children directories as well
6490
6481
  * (eg on OS that dont support recursive watch using fs.watch use fs.watchFile)
6491
6482
  */
6492
- /*@internal*/
6493
6483
  function createDirectoryWatcherSupportingRecursive(_a) {
6494
6484
  var watchDirectory = _a.watchDirectory, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, fileSystemEntryExists = _a.fileSystemEntryExists, realpath = _a.realpath, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout;
6495
6485
  var cache = new ts.Map();
@@ -6698,18 +6688,15 @@ var ts;
6698
6688
  return ts.stringContains(toCanonicalFilePath(path), searchPath);
6699
6689
  }
6700
6690
  }
6701
- ts.createDirectoryWatcherSupportingRecursive = createDirectoryWatcherSupportingRecursive;
6702
6691
  /*@internal*/
6703
6692
  var FileSystemEntryKind;
6704
6693
  (function (FileSystemEntryKind) {
6705
6694
  FileSystemEntryKind[FileSystemEntryKind["File"] = 0] = "File";
6706
6695
  FileSystemEntryKind[FileSystemEntryKind["Directory"] = 1] = "Directory";
6707
6696
  })(FileSystemEntryKind = ts.FileSystemEntryKind || (ts.FileSystemEntryKind = {}));
6708
- /*@internal*/
6709
6697
  function createFileWatcherCallback(callback) {
6710
6698
  return function (_fileName, eventKind, modifiedTime) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); };
6711
6699
  }
6712
- ts.createFileWatcherCallback = createFileWatcherCallback;
6713
6700
  function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime) {
6714
6701
  return function (eventName, _relativeFileName, modifiedTime) {
6715
6702
  if (eventName === "rename") {
@@ -6743,7 +6730,10 @@ var ts;
6743
6730
  }
6744
6731
  /*@internal*/
6745
6732
  function createSystemWatchFunctions(_a) {
6746
- var pollingWatchFile = _a.pollingWatchFile, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog;
6733
+ var pollingWatchFileWorker = _a.pollingWatchFileWorker, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog;
6734
+ var pollingWatches = new ts.Map();
6735
+ var fsWatches = new ts.Map();
6736
+ var fsWatchesRecursive = new ts.Map();
6747
6737
  var dynamicPollingWatchFile;
6748
6738
  var fixedChunkSizePollingWatchFile;
6749
6739
  var nonPollingWatchFile;
@@ -6807,7 +6797,7 @@ var ts;
6807
6797
  // Use notifications from FS to watch with falling back to fs.watchFile
6808
6798
  generateWatchFileOptions(ts.WatchFileKind.UseFsEventsOnParentDirectory, ts.PollingWatchKind.PriorityInterval, options) :
6809
6799
  // Default to do not use fixed polling interval
6810
- { watchFile: (defaultWatchFileKind === null || defaultWatchFileKind === void 0 ? void 0 : defaultWatchFileKind()) || ts.WatchFileKind.FixedPollingInterval };
6800
+ { watchFile: (defaultWatchFileKind === null || defaultWatchFileKind === void 0 ? void 0 : defaultWatchFileKind()) || ts.WatchFileKind.UseFsEvents };
6811
6801
  }
6812
6802
  }
6813
6803
  function generateWatchFileOptions(watchFile, fallbackPolling, options) {
@@ -6878,7 +6868,13 @@ var ts;
6878
6868
  };
6879
6869
  }
6880
6870
  }
6871
+ function pollingWatchFile(fileName, callback, pollingInterval, options) {
6872
+ return createSingleWatcherPerName(pollingWatches, useCaseSensitiveFileNames, fileName, callback, function (cb) { return pollingWatchFileWorker(fileName, cb, pollingInterval, options); });
6873
+ }
6881
6874
  function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
6875
+ return createSingleWatcherPerName(recursive ? fsWatchesRecursive : fsWatches, useCaseSensitiveFileNames, fileOrDirectory, callback, function (cb) { return fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, cb, recursive, fallbackPollingInterval, fallbackOptions); });
6876
+ }
6877
+ function fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
6882
6878
  var lastDirectoryPartWithDirectorySeparator;
6883
6879
  var lastDirectoryPart;
6884
6880
  if (inodeWatching) {
@@ -7057,7 +7053,7 @@ var ts;
7057
7053
  var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin");
7058
7054
  var getCurrentDirectory = ts.memoize(function () { return process.cwd(); });
7059
7055
  var _b = createSystemWatchFunctions({
7060
- pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames),
7056
+ pollingWatchFileWorker: fsWatchFileWorker,
7061
7057
  getModifiedTime: getModifiedTime,
7062
7058
  setTimeout: setTimeout,
7063
7059
  clearTimeout: clearTimeout,
@@ -89,7 +89,7 @@ var ts;
89
89
  // The following is baselined as a literal template type without intervention
90
90
  /** The version of the TypeScript compiler release */
91
91
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
92
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220905");
92
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220907");
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -6127,7 +6127,6 @@ var ts;
6127
6127
  var pollingChunkSize = createPollingIntervalBasedLevels(defaultChunkLevels);
6128
6128
  /* @internal */
6129
6129
  ts.unchangedPollThresholds = createPollingIntervalBasedLevels(defaultChunkLevels);
6130
- /* @internal */
6131
6130
  function setCustomPollingValues(system) {
6132
6131
  if (!system.getEnvironmentVariable) {
6133
6132
  return;
@@ -6170,7 +6169,6 @@ var ts;
6170
6169
  createPollingIntervalBasedLevels(customLevels ? __assign(__assign({}, defaultLevels), customLevels) : defaultLevels);
6171
6170
  }
6172
6171
  }
6173
- ts.setCustomPollingValues = setCustomPollingValues;
6174
6172
  function pollWatchedFileQueue(host, queue, pollIndex, chunkSize, callbackOnWatchFileStat) {
6175
6173
  var definedValueCopyToIndex = pollIndex;
6176
6174
  // Max visit would be all elements of the queue
@@ -6216,7 +6214,6 @@ var ts;
6216
6214
  }
6217
6215
  }
6218
6216
  }
6219
- /* @internal */
6220
6217
  function createDynamicPriorityPollingWatchFile(host) {
6221
6218
  var watchedFiles = [];
6222
6219
  var changedFilesInLastPoll = [];
@@ -6325,7 +6322,6 @@ var ts;
6325
6322
  pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === PollingInterval.Low ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingIntervalQueue(pollingInterval));
6326
6323
  }
6327
6324
  }
6328
- ts.createDynamicPriorityPollingWatchFile = createDynamicPriorityPollingWatchFile;
6329
6325
  function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames) {
6330
6326
  // One file can have multiple watchers
6331
6327
  var fileWatcherCallbacks = ts.createMultiMap();
@@ -6404,42 +6400,38 @@ var ts;
6404
6400
  pollScheduled = host.setTimeout(pollQueue, PollingInterval.High);
6405
6401
  }
6406
6402
  }
6407
- /* @internal */
6408
- function createSingleFileWatcherPerName(watchFile, useCaseSensitiveFileNames) {
6409
- var cache = new ts.Map();
6410
- var callbacksCache = ts.createMultiMap();
6403
+ function createSingleWatcherPerName(cache, useCaseSensitiveFileNames, name, callback, createWatcher) {
6411
6404
  var toCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames);
6412
- return function (fileName, callback, pollingInterval, options) {
6413
- var path = toCanonicalFileName(fileName);
6414
- var existing = cache.get(path);
6415
- if (existing) {
6416
- existing.refCount++;
6417
- }
6418
- else {
6419
- cache.set(path, {
6420
- watcher: watchFile(fileName, function (fileName, eventKind, modifiedTime) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind, modifiedTime); }); }, pollingInterval, options),
6421
- refCount: 1
6422
- });
6405
+ var path = toCanonicalFileName(name);
6406
+ var existing = cache.get(path);
6407
+ if (existing) {
6408
+ existing.callbacks.push(callback);
6409
+ }
6410
+ else {
6411
+ cache.set(path, {
6412
+ watcher: createWatcher((
6413
+ // Cant infer types correctly so lets satisfy checker
6414
+ function (param1, param2, param3) { var _a; return (_a = cache.get(path)) === null || _a === void 0 ? void 0 : _a.callbacks.slice().forEach(function (cb) { return cb(param1, param2, param3); }); })),
6415
+ callbacks: [callback]
6416
+ });
6417
+ }
6418
+ return {
6419
+ close: function () {
6420
+ var watcher = cache.get(path);
6421
+ // Watcher is not expected to be undefined, but if it is normally its because
6422
+ // exception was thrown somewhere else and watch state is not what it should be
6423
+ if (!watcher)
6424
+ return;
6425
+ if (!ts.orderedRemoveItem(watcher.callbacks, callback) || watcher.callbacks.length)
6426
+ return;
6427
+ cache.delete(path);
6428
+ ts.closeFileWatcherOf(watcher);
6423
6429
  }
6424
- callbacksCache.add(path, callback);
6425
- return {
6426
- close: function () {
6427
- var watcher = ts.Debug.checkDefined(cache.get(path));
6428
- callbacksCache.remove(path, callback);
6429
- watcher.refCount--;
6430
- if (watcher.refCount)
6431
- return;
6432
- cache.delete(path);
6433
- ts.closeFileWatcherOf(watcher);
6434
- }
6435
- };
6436
6430
  };
6437
6431
  }
6438
- ts.createSingleFileWatcherPerName = createSingleFileWatcherPerName;
6439
6432
  /**
6440
6433
  * Returns true if file status changed
6441
6434
  */
6442
- /*@internal*/
6443
6435
  function onWatchedFileStat(watchedFile, modifiedTime) {
6444
6436
  var oldTime = watchedFile.mtime.getTime();
6445
6437
  var newTime = modifiedTime.getTime();
@@ -6451,7 +6443,6 @@ var ts;
6451
6443
  }
6452
6444
  return false;
6453
6445
  }
6454
- ts.onWatchedFileStat = onWatchedFileStat;
6455
6446
  /*@internal*/
6456
6447
  function getFileWatcherEventKind(oldTime, newTime) {
6457
6448
  return oldTime === 0
@@ -6479,7 +6470,6 @@ var ts;
6479
6470
  * that means if this is recursive watcher, watch the children directories as well
6480
6471
  * (eg on OS that dont support recursive watch using fs.watch use fs.watchFile)
6481
6472
  */
6482
- /*@internal*/
6483
6473
  function createDirectoryWatcherSupportingRecursive(_a) {
6484
6474
  var watchDirectory = _a.watchDirectory, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, fileSystemEntryExists = _a.fileSystemEntryExists, realpath = _a.realpath, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout;
6485
6475
  var cache = new ts.Map();
@@ -6688,18 +6678,15 @@ var ts;
6688
6678
  return ts.stringContains(toCanonicalFilePath(path), searchPath);
6689
6679
  }
6690
6680
  }
6691
- ts.createDirectoryWatcherSupportingRecursive = createDirectoryWatcherSupportingRecursive;
6692
6681
  /*@internal*/
6693
6682
  var FileSystemEntryKind;
6694
6683
  (function (FileSystemEntryKind) {
6695
6684
  FileSystemEntryKind[FileSystemEntryKind["File"] = 0] = "File";
6696
6685
  FileSystemEntryKind[FileSystemEntryKind["Directory"] = 1] = "Directory";
6697
6686
  })(FileSystemEntryKind = ts.FileSystemEntryKind || (ts.FileSystemEntryKind = {}));
6698
- /*@internal*/
6699
6687
  function createFileWatcherCallback(callback) {
6700
6688
  return function (_fileName, eventKind, modifiedTime) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); };
6701
6689
  }
6702
- ts.createFileWatcherCallback = createFileWatcherCallback;
6703
6690
  function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime) {
6704
6691
  return function (eventName, _relativeFileName, modifiedTime) {
6705
6692
  if (eventName === "rename") {
@@ -6733,7 +6720,10 @@ var ts;
6733
6720
  }
6734
6721
  /*@internal*/
6735
6722
  function createSystemWatchFunctions(_a) {
6736
- var pollingWatchFile = _a.pollingWatchFile, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog;
6723
+ var pollingWatchFileWorker = _a.pollingWatchFileWorker, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog;
6724
+ var pollingWatches = new ts.Map();
6725
+ var fsWatches = new ts.Map();
6726
+ var fsWatchesRecursive = new ts.Map();
6737
6727
  var dynamicPollingWatchFile;
6738
6728
  var fixedChunkSizePollingWatchFile;
6739
6729
  var nonPollingWatchFile;
@@ -6797,7 +6787,7 @@ var ts;
6797
6787
  // Use notifications from FS to watch with falling back to fs.watchFile
6798
6788
  generateWatchFileOptions(ts.WatchFileKind.UseFsEventsOnParentDirectory, ts.PollingWatchKind.PriorityInterval, options) :
6799
6789
  // Default to do not use fixed polling interval
6800
- { watchFile: (defaultWatchFileKind === null || defaultWatchFileKind === void 0 ? void 0 : defaultWatchFileKind()) || ts.WatchFileKind.FixedPollingInterval };
6790
+ { watchFile: (defaultWatchFileKind === null || defaultWatchFileKind === void 0 ? void 0 : defaultWatchFileKind()) || ts.WatchFileKind.UseFsEvents };
6801
6791
  }
6802
6792
  }
6803
6793
  function generateWatchFileOptions(watchFile, fallbackPolling, options) {
@@ -6868,7 +6858,13 @@ var ts;
6868
6858
  };
6869
6859
  }
6870
6860
  }
6861
+ function pollingWatchFile(fileName, callback, pollingInterval, options) {
6862
+ return createSingleWatcherPerName(pollingWatches, useCaseSensitiveFileNames, fileName, callback, function (cb) { return pollingWatchFileWorker(fileName, cb, pollingInterval, options); });
6863
+ }
6871
6864
  function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
6865
+ return createSingleWatcherPerName(recursive ? fsWatchesRecursive : fsWatches, useCaseSensitiveFileNames, fileOrDirectory, callback, function (cb) { return fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, cb, recursive, fallbackPollingInterval, fallbackOptions); });
6866
+ }
6867
+ function fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
6872
6868
  var lastDirectoryPartWithDirectorySeparator;
6873
6869
  var lastDirectoryPart;
6874
6870
  if (inodeWatching) {
@@ -7047,7 +7043,7 @@ var ts;
7047
7043
  var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin");
7048
7044
  var getCurrentDirectory = ts.memoize(function () { return process.cwd(); });
7049
7045
  var _b = createSystemWatchFunctions({
7050
- pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames),
7046
+ pollingWatchFileWorker: fsWatchFileWorker,
7051
7047
  getModifiedTime: getModifiedTime,
7052
7048
  setTimeout: setTimeout,
7053
7049
  clearTimeout: clearTimeout,
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": "4.9.0-dev.20220905",
5
+ "version": "4.9.0-dev.20220907",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -90,7 +90,6 @@
90
90
  "mocha-fivemat-progress-reporter": "latest",
91
91
  "ms": "^2.1.3",
92
92
  "node-fetch": "^2.6.7",
93
- "prex": "^0.4.7",
94
93
  "source-map-support": "latest",
95
94
  "typescript": "^4.8.2",
96
95
  "vinyl": "latest",
@@ -110,7 +109,6 @@
110
109
  "clean": "gulp clean",
111
110
  "gulp": "gulp",
112
111
  "lint": "gulp lint",
113
- "lint:ci": "gulp lint --ci",
114
112
  "setup-hooks": "node scripts/link-hooks.js"
115
113
  },
116
114
  "browser": {