typescript 5.4.3 → 5.4.4

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
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.4";
21
- var version = "5.4.3";
21
+ var version = "5.4.4";
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -4145,14 +4145,17 @@ function createDynamicPriorityPollingWatchFile(host) {
4145
4145
  pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === 250 /* Low */ ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingInterval === 250 /* Low */ ? "pollLowPollingIntervalQueue" : "pollPollingIntervalQueue", pollingIntervalQueue(pollingInterval));
4146
4146
  }
4147
4147
  }
4148
- function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames2) {
4148
+ function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames2, getModifiedTime3, fsWatchWithTimestamp) {
4149
4149
  const fileWatcherCallbacks = createMultiMap();
4150
+ const fileTimestamps = fsWatchWithTimestamp ? /* @__PURE__ */ new Map() : void 0;
4150
4151
  const dirWatchers = /* @__PURE__ */ new Map();
4151
4152
  const toCanonicalName = createGetCanonicalFileName(useCaseSensitiveFileNames2);
4152
4153
  return nonPollingWatchFile;
4153
4154
  function nonPollingWatchFile(fileName, callback, _pollingInterval, fallbackOptions) {
4154
4155
  const filePath = toCanonicalName(fileName);
4155
- fileWatcherCallbacks.add(filePath, callback);
4156
+ if (fileWatcherCallbacks.add(filePath, callback).length === 1 && fileTimestamps) {
4157
+ fileTimestamps.set(filePath, getModifiedTime3(fileName) || missingFileModifiedTime);
4158
+ }
4156
4159
  const dirPath = getDirectoryPath(filePath) || ".";
4157
4160
  const watcher = dirWatchers.get(dirPath) || createDirectoryWatcher(getDirectoryPath(fileName) || ".", dirPath, fallbackOptions);
4158
4161
  watcher.referenceCount++;
@@ -4172,14 +4175,31 @@ function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFi
4172
4175
  const watcher = fsWatch(
4173
4176
  dirName,
4174
4177
  1 /* Directory */,
4175
- (_eventName, relativeFileName, modifiedTime) => {
4178
+ (eventName, relativeFileName) => {
4176
4179
  if (!isString(relativeFileName))
4177
4180
  return;
4178
4181
  const fileName = getNormalizedAbsolutePath(relativeFileName, dirName);
4179
- const callbacks = fileName && fileWatcherCallbacks.get(toCanonicalName(fileName));
4182
+ const filePath = toCanonicalName(fileName);
4183
+ const callbacks = fileName && fileWatcherCallbacks.get(filePath);
4180
4184
  if (callbacks) {
4185
+ let currentModifiedTime;
4186
+ let eventKind = 1 /* Changed */;
4187
+ if (fileTimestamps) {
4188
+ const existingTime = fileTimestamps.get(filePath);
4189
+ if (eventName === "change") {
4190
+ currentModifiedTime = getModifiedTime3(fileName) || missingFileModifiedTime;
4191
+ if (currentModifiedTime.getTime() === existingTime.getTime())
4192
+ return;
4193
+ }
4194
+ currentModifiedTime || (currentModifiedTime = getModifiedTime3(fileName) || missingFileModifiedTime);
4195
+ fileTimestamps.set(filePath, currentModifiedTime);
4196
+ if (existingTime === missingFileModifiedTime)
4197
+ eventKind = 0 /* Created */;
4198
+ else if (currentModifiedTime === missingFileModifiedTime)
4199
+ eventKind = 2 /* Deleted */;
4200
+ }
4181
4201
  for (const fileCallback of callbacks) {
4182
- fileCallback(fileName, 1 /* Changed */, modifiedTime);
4202
+ fileCallback(fileName, eventKind, currentModifiedTime);
4183
4203
  }
4184
4204
  }
4185
4205
  },
@@ -4573,7 +4593,7 @@ function createSystemWatchFunctions({
4573
4593
  );
4574
4594
  case 5 /* UseFsEventsOnParentDirectory */:
4575
4595
  if (!nonPollingWatchFile) {
4576
- nonPollingWatchFile = createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames2);
4596
+ nonPollingWatchFile = createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames2, getModifiedTime3, fsWatchWithTimestamp);
4577
4597
  }
4578
4598
  return nonPollingWatchFile(fileName, callback, pollingInterval, getFallbackOptions(options));
4579
4599
  default:
@@ -4748,7 +4768,7 @@ function createSystemWatchFunctions({
4748
4768
  return watchPresentFileSystemEntryWithFsWatchFile();
4749
4769
  }
4750
4770
  try {
4751
- const presentWatcher = (!fsWatchWithTimestamp ? fsWatchWorker : fsWatchWorkerHandlingTimestamp)(
4771
+ const presentWatcher = (entryKind === 1 /* Directory */ || !fsWatchWithTimestamp ? fsWatchWorker : fsWatchWorkerHandlingTimestamp)(
4752
4772
  fileOrDirectory,
4753
4773
  recursive,
4754
4774
  inodeWatching ? callbackChangingToMissingFileSystemEntry : callback
@@ -42862,13 +42882,21 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
42862
42882
  }
42863
42883
  const nearestTargetPackageJson = getNearestAncestorDirectoryWithPackageJson(host, getDirectoryPath(modulePath));
42864
42884
  const nearestSourcePackageJson = getNearestAncestorDirectoryWithPackageJson(host, sourceDirectory);
42865
- if (nearestSourcePackageJson !== nearestTargetPackageJson) {
42885
+ const ignoreCase = !hostUsesCaseSensitiveFileNames(host);
42886
+ if (!packageJsonPathsAreEqual(nearestTargetPackageJson, nearestSourcePackageJson, ignoreCase)) {
42866
42887
  return maybeNonRelative;
42867
42888
  }
42868
42889
  return relativePath;
42869
42890
  }
42870
42891
  return isPathRelativeToParent(maybeNonRelative) || countPathComponents(relativePath) < countPathComponents(maybeNonRelative) ? relativePath : maybeNonRelative;
42871
42892
  }
42893
+ function packageJsonPathsAreEqual(a, b, ignoreCase) {
42894
+ if (a === b)
42895
+ return true;
42896
+ if (a === void 0 || b === void 0)
42897
+ return false;
42898
+ return comparePaths(a, b, ignoreCase) === 0 /* EqualTo */;
42899
+ }
42872
42900
  function countPathComponents(path) {
42873
42901
  let count = 0;
42874
42902
  for (let i = startsWith(path, "./") ? 2 : 0; i < path.length; i++) {
@@ -47996,15 +48024,19 @@ function createTypeChecker(host) {
47996
48024
  return true;
47997
48025
  }
47998
48026
  }
47999
- function isEntityNameVisible(entityName, enclosingDeclaration) {
48027
+ function getMeaningOfEntityNameReference(entityName) {
48000
48028
  let meaning;
48001
48029
  if (entityName.parent.kind === 186 /* TypeQuery */ || entityName.parent.kind === 233 /* ExpressionWithTypeArguments */ && !isPartOfTypeNode(entityName.parent) || entityName.parent.kind === 167 /* ComputedPropertyName */) {
48002
48030
  meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
48003
- } else if (entityName.kind === 166 /* QualifiedName */ || entityName.kind === 211 /* PropertyAccessExpression */ || entityName.parent.kind === 271 /* ImportEqualsDeclaration */) {
48031
+ } else if (entityName.kind === 166 /* QualifiedName */ || entityName.kind === 211 /* PropertyAccessExpression */ || entityName.parent.kind === 271 /* ImportEqualsDeclaration */ || entityName.parent.kind === 166 /* QualifiedName */ && entityName.parent.left === entityName || entityName.parent.kind === 211 /* PropertyAccessExpression */ && entityName.parent.expression === entityName || entityName.parent.kind === 212 /* ElementAccessExpression */ && entityName.parent.expression === entityName) {
48004
48032
  meaning = 1920 /* Namespace */;
48005
48033
  } else {
48006
48034
  meaning = 788968 /* Type */;
48007
48035
  }
48036
+ return meaning;
48037
+ }
48038
+ function isEntityNameVisible(entityName, enclosingDeclaration) {
48039
+ const meaning = getMeaningOfEntityNameReference(entityName);
48008
48040
  const firstIdentifier = getFirstIdentifier(entityName);
48009
48041
  const symbol = resolveName(
48010
48042
  enclosingDeclaration,
@@ -50065,9 +50097,10 @@ function createTypeChecker(host) {
50065
50097
  introducesError = true;
50066
50098
  return { introducesError, node };
50067
50099
  }
50100
+ const meaning = getMeaningOfEntityNameReference(node);
50068
50101
  const sym = resolveEntityName(
50069
50102
  leftmost,
50070
- -1 /* All */,
50103
+ meaning,
50071
50104
  /*ignoreErrors*/
50072
50105
  true,
50073
50106
  /*dontResolveAlias*/
@@ -50077,13 +50110,13 @@ function createTypeChecker(host) {
50077
50110
  if (isSymbolAccessible(
50078
50111
  sym,
50079
50112
  context.enclosingDeclaration,
50080
- -1 /* All */,
50113
+ meaning,
50081
50114
  /*shouldComputeAliasesToMakeVisible*/
50082
50115
  false
50083
50116
  ).accessibility !== 0 /* Accessible */) {
50084
50117
  introducesError = true;
50085
50118
  } else {
50086
- context.tracker.trackSymbol(sym, context.enclosingDeclaration, -1 /* All */);
50119
+ context.tracker.trackSymbol(sym, context.enclosingDeclaration, meaning);
50087
50120
  includePrivateSymbol == null ? void 0 : includePrivateSymbol(sym);
50088
50121
  }
50089
50122
  if (isIdentifier(node)) {
@@ -57990,6 +58023,9 @@ function createTypeChecker(host) {
57990
58023
  } else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && (t.types[0].flags & 65536 /* Null */ || t.types[1].flags & 65536 /* Null */)))) {
57991
58024
  removeFromEach(typeSet, 65536 /* Null */);
57992
58025
  result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
58026
+ } else if (typeSet.length >= 4) {
58027
+ const middle = Math.floor(typeSet.length / 2);
58028
+ result = getIntersectionType([getIntersectionType(typeSet.slice(0, middle)), getIntersectionType(typeSet.slice(middle))], aliasSymbol, aliasTypeArguments);
57993
58029
  } else {
57994
58030
  if (!checkCrossProductUnion(typeSet)) {
57995
58031
  return errorType;
package/lib/tsserver.js CHANGED
@@ -2340,7 +2340,7 @@ module.exports = __toCommonJS(server_exports);
2340
2340
 
2341
2341
  // src/compiler/corePublic.ts
2342
2342
  var versionMajorMinor = "5.4";
2343
- var version = "5.4.3";
2343
+ var version = "5.4.4";
2344
2344
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2345
2345
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2346
2346
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -7688,14 +7688,17 @@ function createDynamicPriorityPollingWatchFile(host) {
7688
7688
  pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === 250 /* Low */ ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingInterval === 250 /* Low */ ? "pollLowPollingIntervalQueue" : "pollPollingIntervalQueue", pollingIntervalQueue(pollingInterval));
7689
7689
  }
7690
7690
  }
7691
- function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames2) {
7691
+ function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames2, getModifiedTime3, fsWatchWithTimestamp) {
7692
7692
  const fileWatcherCallbacks = createMultiMap();
7693
+ const fileTimestamps = fsWatchWithTimestamp ? /* @__PURE__ */ new Map() : void 0;
7693
7694
  const dirWatchers = /* @__PURE__ */ new Map();
7694
7695
  const toCanonicalName = createGetCanonicalFileName(useCaseSensitiveFileNames2);
7695
7696
  return nonPollingWatchFile;
7696
7697
  function nonPollingWatchFile(fileName, callback, _pollingInterval, fallbackOptions) {
7697
7698
  const filePath = toCanonicalName(fileName);
7698
- fileWatcherCallbacks.add(filePath, callback);
7699
+ if (fileWatcherCallbacks.add(filePath, callback).length === 1 && fileTimestamps) {
7700
+ fileTimestamps.set(filePath, getModifiedTime3(fileName) || missingFileModifiedTime);
7701
+ }
7699
7702
  const dirPath = getDirectoryPath(filePath) || ".";
7700
7703
  const watcher = dirWatchers.get(dirPath) || createDirectoryWatcher(getDirectoryPath(fileName) || ".", dirPath, fallbackOptions);
7701
7704
  watcher.referenceCount++;
@@ -7715,14 +7718,31 @@ function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFi
7715
7718
  const watcher = fsWatch(
7716
7719
  dirName,
7717
7720
  1 /* Directory */,
7718
- (_eventName, relativeFileName, modifiedTime) => {
7721
+ (eventName, relativeFileName) => {
7719
7722
  if (!isString(relativeFileName))
7720
7723
  return;
7721
7724
  const fileName = getNormalizedAbsolutePath(relativeFileName, dirName);
7722
- const callbacks = fileName && fileWatcherCallbacks.get(toCanonicalName(fileName));
7725
+ const filePath = toCanonicalName(fileName);
7726
+ const callbacks = fileName && fileWatcherCallbacks.get(filePath);
7723
7727
  if (callbacks) {
7728
+ let currentModifiedTime;
7729
+ let eventKind = 1 /* Changed */;
7730
+ if (fileTimestamps) {
7731
+ const existingTime = fileTimestamps.get(filePath);
7732
+ if (eventName === "change") {
7733
+ currentModifiedTime = getModifiedTime3(fileName) || missingFileModifiedTime;
7734
+ if (currentModifiedTime.getTime() === existingTime.getTime())
7735
+ return;
7736
+ }
7737
+ currentModifiedTime || (currentModifiedTime = getModifiedTime3(fileName) || missingFileModifiedTime);
7738
+ fileTimestamps.set(filePath, currentModifiedTime);
7739
+ if (existingTime === missingFileModifiedTime)
7740
+ eventKind = 0 /* Created */;
7741
+ else if (currentModifiedTime === missingFileModifiedTime)
7742
+ eventKind = 2 /* Deleted */;
7743
+ }
7724
7744
  for (const fileCallback of callbacks) {
7725
- fileCallback(fileName, 1 /* Changed */, modifiedTime);
7745
+ fileCallback(fileName, eventKind, currentModifiedTime);
7726
7746
  }
7727
7747
  }
7728
7748
  },
@@ -8121,7 +8141,7 @@ function createSystemWatchFunctions({
8121
8141
  );
8122
8142
  case 5 /* UseFsEventsOnParentDirectory */:
8123
8143
  if (!nonPollingWatchFile) {
8124
- nonPollingWatchFile = createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames2);
8144
+ nonPollingWatchFile = createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames2, getModifiedTime3, fsWatchWithTimestamp);
8125
8145
  }
8126
8146
  return nonPollingWatchFile(fileName, callback, pollingInterval, getFallbackOptions(options));
8127
8147
  default:
@@ -8296,7 +8316,7 @@ function createSystemWatchFunctions({
8296
8316
  return watchPresentFileSystemEntryWithFsWatchFile();
8297
8317
  }
8298
8318
  try {
8299
- const presentWatcher = (!fsWatchWithTimestamp ? fsWatchWorker : fsWatchWorkerHandlingTimestamp)(
8319
+ const presentWatcher = (entryKind === 1 /* Directory */ || !fsWatchWithTimestamp ? fsWatchWorker : fsWatchWorkerHandlingTimestamp)(
8300
8320
  fileOrDirectory,
8301
8321
  recursive,
8302
8322
  inodeWatching ? callbackChangingToMissingFileSystemEntry : callback
@@ -47606,13 +47626,21 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
47606
47626
  }
47607
47627
  const nearestTargetPackageJson = getNearestAncestorDirectoryWithPackageJson(host, getDirectoryPath(modulePath));
47608
47628
  const nearestSourcePackageJson = getNearestAncestorDirectoryWithPackageJson(host, sourceDirectory);
47609
- if (nearestSourcePackageJson !== nearestTargetPackageJson) {
47629
+ const ignoreCase = !hostUsesCaseSensitiveFileNames(host);
47630
+ if (!packageJsonPathsAreEqual(nearestTargetPackageJson, nearestSourcePackageJson, ignoreCase)) {
47610
47631
  return maybeNonRelative;
47611
47632
  }
47612
47633
  return relativePath;
47613
47634
  }
47614
47635
  return isPathRelativeToParent(maybeNonRelative) || countPathComponents(relativePath) < countPathComponents(maybeNonRelative) ? relativePath : maybeNonRelative;
47615
47636
  }
47637
+ function packageJsonPathsAreEqual(a, b, ignoreCase) {
47638
+ if (a === b)
47639
+ return true;
47640
+ if (a === void 0 || b === void 0)
47641
+ return false;
47642
+ return comparePaths(a, b, ignoreCase) === 0 /* EqualTo */;
47643
+ }
47616
47644
  function countPathComponents(path) {
47617
47645
  let count = 0;
47618
47646
  for (let i = startsWith(path, "./") ? 2 : 0; i < path.length; i++) {
@@ -52740,15 +52768,19 @@ function createTypeChecker(host) {
52740
52768
  return true;
52741
52769
  }
52742
52770
  }
52743
- function isEntityNameVisible(entityName, enclosingDeclaration) {
52771
+ function getMeaningOfEntityNameReference(entityName) {
52744
52772
  let meaning;
52745
52773
  if (entityName.parent.kind === 186 /* TypeQuery */ || entityName.parent.kind === 233 /* ExpressionWithTypeArguments */ && !isPartOfTypeNode(entityName.parent) || entityName.parent.kind === 167 /* ComputedPropertyName */) {
52746
52774
  meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
52747
- } else if (entityName.kind === 166 /* QualifiedName */ || entityName.kind === 211 /* PropertyAccessExpression */ || entityName.parent.kind === 271 /* ImportEqualsDeclaration */) {
52775
+ } else if (entityName.kind === 166 /* QualifiedName */ || entityName.kind === 211 /* PropertyAccessExpression */ || entityName.parent.kind === 271 /* ImportEqualsDeclaration */ || entityName.parent.kind === 166 /* QualifiedName */ && entityName.parent.left === entityName || entityName.parent.kind === 211 /* PropertyAccessExpression */ && entityName.parent.expression === entityName || entityName.parent.kind === 212 /* ElementAccessExpression */ && entityName.parent.expression === entityName) {
52748
52776
  meaning = 1920 /* Namespace */;
52749
52777
  } else {
52750
52778
  meaning = 788968 /* Type */;
52751
52779
  }
52780
+ return meaning;
52781
+ }
52782
+ function isEntityNameVisible(entityName, enclosingDeclaration) {
52783
+ const meaning = getMeaningOfEntityNameReference(entityName);
52752
52784
  const firstIdentifier = getFirstIdentifier(entityName);
52753
52785
  const symbol = resolveName(
52754
52786
  enclosingDeclaration,
@@ -54809,9 +54841,10 @@ function createTypeChecker(host) {
54809
54841
  introducesError = true;
54810
54842
  return { introducesError, node };
54811
54843
  }
54844
+ const meaning = getMeaningOfEntityNameReference(node);
54812
54845
  const sym = resolveEntityName(
54813
54846
  leftmost,
54814
- -1 /* All */,
54847
+ meaning,
54815
54848
  /*ignoreErrors*/
54816
54849
  true,
54817
54850
  /*dontResolveAlias*/
@@ -54821,13 +54854,13 @@ function createTypeChecker(host) {
54821
54854
  if (isSymbolAccessible(
54822
54855
  sym,
54823
54856
  context.enclosingDeclaration,
54824
- -1 /* All */,
54857
+ meaning,
54825
54858
  /*shouldComputeAliasesToMakeVisible*/
54826
54859
  false
54827
54860
  ).accessibility !== 0 /* Accessible */) {
54828
54861
  introducesError = true;
54829
54862
  } else {
54830
- context.tracker.trackSymbol(sym, context.enclosingDeclaration, -1 /* All */);
54863
+ context.tracker.trackSymbol(sym, context.enclosingDeclaration, meaning);
54831
54864
  includePrivateSymbol == null ? void 0 : includePrivateSymbol(sym);
54832
54865
  }
54833
54866
  if (isIdentifier(node)) {
@@ -62734,6 +62767,9 @@ function createTypeChecker(host) {
62734
62767
  } else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && (t.types[0].flags & 65536 /* Null */ || t.types[1].flags & 65536 /* Null */)))) {
62735
62768
  removeFromEach(typeSet, 65536 /* Null */);
62736
62769
  result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
62770
+ } else if (typeSet.length >= 4) {
62771
+ const middle = Math.floor(typeSet.length / 2);
62772
+ result = getIntersectionType([getIntersectionType(typeSet.slice(0, middle)), getIntersectionType(typeSet.slice(middle))], aliasSymbol, aliasTypeArguments);
62737
62773
  } else {
62738
62774
  if (!checkCrossProductUnion(typeSet)) {
62739
62775
  return errorType;
@@ -160728,10 +160764,7 @@ function getContextualType(previousToken, position, sourceFile, checker) {
160728
160764
  return isJsxExpression(parent2) && !isJsxElement(parent2.parent) && !isJsxFragment(parent2.parent) ? checker.getContextualTypeForJsxAttribute(parent2.parent) : void 0;
160729
160765
  default:
160730
160766
  const argInfo = ts_SignatureHelp_exports.getArgumentInfoForCompletions(previousToken, position, sourceFile, checker);
160731
- return argInfo ? (
160732
- // At `,`, treat this as the next argument after the comma.
160733
- checker.getContextualTypeForArgumentAtIndex(argInfo.invocation, argInfo.argumentIndex + (previousToken.kind === 28 /* CommaToken */ ? 1 : 0))
160734
- ) : isEqualityOperatorKind(previousToken.kind) && isBinaryExpression(parent2) && isEqualityOperatorKind(parent2.operatorToken.kind) ? (
160767
+ return argInfo ? checker.getContextualTypeForArgumentAtIndex(argInfo.invocation, argInfo.argumentIndex) : isEqualityOperatorKind(previousToken.kind) && isBinaryExpression(parent2) && isEqualityOperatorKind(parent2.operatorToken.kind) ? (
160735
160768
  // completion at `x ===/**/` should be for the right side
160736
160769
  checker.getTypeAtLocation(parent2.left)
160737
160770
  ) : checker.getContextualType(previousToken, 4 /* Completions */) || checker.getContextualType(previousToken);
@@ -169099,12 +169132,7 @@ function getArgumentOrParameterListInfo(node, position, sourceFile, checker) {
169099
169132
  if (!info)
169100
169133
  return void 0;
169101
169134
  const { list, argumentIndex } = info;
169102
- const argumentCount = getArgumentCount(
169103
- list,
169104
- /*ignoreTrailingComma*/
169105
- isInString(sourceFile, position, node),
169106
- checker
169107
- );
169135
+ const argumentCount = getArgumentCount(checker, list);
169108
169136
  if (argumentIndex !== 0) {
169109
169137
  Debug.assertLessThan(argumentIndex, argumentCount);
169110
169138
  }
@@ -169116,7 +169144,7 @@ function getArgumentOrParameterListAndIndex(node, sourceFile, checker) {
169116
169144
  return { list: getChildListThatStartsWithOpenerToken(node.parent, node, sourceFile), argumentIndex: 0 };
169117
169145
  } else {
169118
169146
  const list = findContainingList(node);
169119
- return list && { list, argumentIndex: getArgumentIndex(list, node, checker) };
169147
+ return list && { list, argumentIndex: getArgumentIndex(checker, list, node) };
169120
169148
  }
169121
169149
  }
169122
169150
  function getImmediatelyContainingArgumentInfo(node, position, sourceFile, checker) {
@@ -169246,24 +169274,6 @@ function chooseBetterSymbol(s) {
169246
169274
  return isFunctionTypeNode(d) ? (_a = tryCast(d.parent, canHaveSymbol)) == null ? void 0 : _a.symbol : void 0;
169247
169275
  }) || s : s;
169248
169276
  }
169249
- function getArgumentIndex(argumentsList, node, checker) {
169250
- const args = argumentsList.getChildren();
169251
- let argumentIndex = 0;
169252
- for (let pos = 0; pos < length(args); pos++) {
169253
- const child = args[pos];
169254
- if (child === node) {
169255
- break;
169256
- }
169257
- if (isSpreadElement(child)) {
169258
- argumentIndex = argumentIndex + getSpreadElementCount(child, checker) + (pos > 0 ? pos : 0);
169259
- } else {
169260
- if (child.kind !== 28 /* CommaToken */) {
169261
- argumentIndex++;
169262
- }
169263
- }
169264
- }
169265
- return argumentIndex;
169266
- }
169267
169277
  function getSpreadElementCount(node, checker) {
169268
169278
  const spreadType = checker.getTypeAtLocation(node.expression);
169269
169279
  if (checker.isTupleType(spreadType)) {
@@ -169276,19 +169286,48 @@ function getSpreadElementCount(node, checker) {
169276
169286
  }
169277
169287
  return 0;
169278
169288
  }
169279
- function getArgumentCount(argumentsList, ignoreTrailingComma, checker) {
169280
- const listChildren = argumentsList.getChildren();
169281
- let argumentCount = 0;
169282
- for (const child of listChildren) {
169289
+ function getArgumentIndex(checker, argumentsList, node) {
169290
+ return getArgumentIndexOrCount(checker, argumentsList, node);
169291
+ }
169292
+ function getArgumentCount(checker, argumentsList) {
169293
+ return getArgumentIndexOrCount(
169294
+ checker,
169295
+ argumentsList,
169296
+ /*node*/
169297
+ void 0
169298
+ );
169299
+ }
169300
+ function getArgumentIndexOrCount(checker, argumentsList, node) {
169301
+ const args = argumentsList.getChildren();
169302
+ let argumentIndex = 0;
169303
+ let skipComma = false;
169304
+ for (const child of args) {
169305
+ if (node && child === node) {
169306
+ if (!skipComma && child.kind === 28 /* CommaToken */) {
169307
+ argumentIndex++;
169308
+ }
169309
+ return argumentIndex;
169310
+ }
169283
169311
  if (isSpreadElement(child)) {
169284
- argumentCount = argumentCount + getSpreadElementCount(child, checker);
169312
+ argumentIndex += getSpreadElementCount(child, checker);
169313
+ skipComma = true;
169314
+ continue;
169285
169315
  }
169316
+ if (child.kind !== 28 /* CommaToken */) {
169317
+ argumentIndex++;
169318
+ skipComma = true;
169319
+ continue;
169320
+ }
169321
+ if (skipComma) {
169322
+ skipComma = false;
169323
+ continue;
169324
+ }
169325
+ argumentIndex++;
169286
169326
  }
169287
- argumentCount = argumentCount + countWhere(listChildren, (arg) => arg.kind !== 28 /* CommaToken */);
169288
- if (!ignoreTrailingComma && listChildren.length > 0 && last(listChildren).kind === 28 /* CommaToken */) {
169289
- argumentCount++;
169327
+ if (node) {
169328
+ return argumentIndex;
169290
169329
  }
169291
- return argumentCount;
169330
+ return args.length && last(args).kind === 28 /* CommaToken */ ? argumentIndex + 1 : argumentIndex;
169292
169331
  }
169293
169332
  function getArgumentIndexForTemplatePiece(spanIndex, node, position, sourceFile) {
169294
169333
  Debug.assert(position >= node.getStart(), "Assumed 'position' could not occur before node.");
@@ -181088,7 +181127,16 @@ function createWatchFactoryHostUsingWatchEvents(service, canUseWatchEvents) {
181088
181127
  recursive ? watchedDirectoriesRecursive : watchedDirectories,
181089
181128
  path,
181090
181129
  callback,
181091
- (id) => ({ eventName: CreateDirectoryWatcherEvent, data: { id, path, recursive: !!recursive } })
181130
+ (id) => ({
181131
+ eventName: CreateDirectoryWatcherEvent,
181132
+ data: {
181133
+ id,
181134
+ path,
181135
+ recursive: !!recursive,
181136
+ // Special case node_modules as we watch it for changes to closed script infos as well
181137
+ ignoreUpdate: !path.endsWith("/node_modules") ? true : void 0
181138
+ }
181139
+ })
181092
181140
  );
181093
181141
  }
181094
181142
  function getOrCreateFileWatcher({ pathToId, idToCallbacks }, path, callback, event) {
@@ -181115,24 +181163,28 @@ function createWatchFactoryHostUsingWatchEvents(service, canUseWatchEvents) {
181115
181163
  }
181116
181164
  };
181117
181165
  }
181118
- function onWatchChange({ id, path, eventType }) {
181119
- onFileWatcherCallback(id, path, eventType);
181120
- onDirectoryWatcherCallback(watchedDirectories, id, path, eventType);
181121
- onDirectoryWatcherCallback(watchedDirectoriesRecursive, id, path, eventType);
181166
+ function onWatchChange(args) {
181167
+ if (isArray(args))
181168
+ args.forEach(onWatchChangeRequestArgs);
181169
+ else
181170
+ onWatchChangeRequestArgs(args);
181122
181171
  }
181123
- function onFileWatcherCallback(id, eventPath, eventType) {
181124
- var _a;
181125
- (_a = watchedFiles.idToCallbacks.get(id)) == null ? void 0 : _a.forEach((callback) => {
181126
- const eventKind = eventType === "create" ? 0 /* Created */ : eventType === "delete" ? 2 /* Deleted */ : 1 /* Changed */;
181127
- callback(eventPath, eventKind);
181128
- });
181172
+ function onWatchChangeRequestArgs({ id, created, deleted, updated }) {
181173
+ onWatchEventType(id, created, 0 /* Created */);
181174
+ onWatchEventType(id, deleted, 2 /* Deleted */);
181175
+ onWatchEventType(id, updated, 1 /* Changed */);
181129
181176
  }
181130
- function onDirectoryWatcherCallback({ idToCallbacks }, id, eventPath, eventType) {
181131
- var _a;
181132
- if (eventType === "update")
181177
+ function onWatchEventType(id, paths, eventKind) {
181178
+ if (!(paths == null ? void 0 : paths.length))
181133
181179
  return;
181134
- (_a = idToCallbacks.get(id)) == null ? void 0 : _a.forEach((callback) => {
181135
- callback(eventPath);
181180
+ forEachCallback(watchedFiles, id, paths, (callback, eventPath) => callback(eventPath, eventKind));
181181
+ forEachCallback(watchedDirectories, id, paths, (callback, eventPath) => callback(eventPath));
181182
+ forEachCallback(watchedDirectoriesRecursive, id, paths, (callback, eventPath) => callback(eventPath));
181183
+ }
181184
+ function forEachCallback(hostWatcherMap, id, eventPaths, cb) {
181185
+ var _a;
181186
+ (_a = hostWatcherMap.idToCallbacks.get(id)) == null ? void 0 : _a.forEach((callback) => {
181187
+ eventPaths.forEach((eventPath) => cb(callback, normalizeSlashes(eventPath)));
181136
181188
  });
181137
181189
  }
181138
181190
  }
@@ -1510,12 +1510,13 @@ declare namespace ts {
1510
1510
  }
1511
1511
  interface WatchChangeRequest extends Request {
1512
1512
  command: CommandTypes.WatchChange;
1513
- arguments: WatchChangeRequestArgs;
1513
+ arguments: WatchChangeRequestArgs | readonly WatchChangeRequestArgs[];
1514
1514
  }
1515
1515
  interface WatchChangeRequestArgs {
1516
1516
  id: number;
1517
- path: string;
1518
- eventType: "create" | "delete" | "update";
1517
+ created?: string[];
1518
+ deleted?: string[];
1519
+ updated?: string[];
1519
1520
  }
1520
1521
  /**
1521
1522
  * Request to obtain the list of files that should be regenerated if target file is recompiled.
@@ -2452,6 +2453,7 @@ declare namespace ts {
2452
2453
  readonly id: number;
2453
2454
  readonly path: string;
2454
2455
  readonly recursive: boolean;
2456
+ readonly ignoreUpdate?: boolean;
2455
2457
  }
2456
2458
  type CloseFileWatcherEventName = "closeFileWatcher";
2457
2459
  interface CloseFileWatcherEvent extends Event {
package/lib/typescript.js CHANGED
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.4";
38
- version = "5.4.3";
38
+ version = "5.4.4";
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -5423,14 +5423,17 @@ ${lanes.join("\n")}
5423
5423
  pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === 250 /* Low */ ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingInterval === 250 /* Low */ ? "pollLowPollingIntervalQueue" : "pollPollingIntervalQueue", pollingIntervalQueue(pollingInterval));
5424
5424
  }
5425
5425
  }
5426
- function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames2) {
5426
+ function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames2, getModifiedTime3, fsWatchWithTimestamp) {
5427
5427
  const fileWatcherCallbacks = createMultiMap();
5428
+ const fileTimestamps = fsWatchWithTimestamp ? /* @__PURE__ */ new Map() : void 0;
5428
5429
  const dirWatchers = /* @__PURE__ */ new Map();
5429
5430
  const toCanonicalName = createGetCanonicalFileName(useCaseSensitiveFileNames2);
5430
5431
  return nonPollingWatchFile;
5431
5432
  function nonPollingWatchFile(fileName, callback, _pollingInterval, fallbackOptions) {
5432
5433
  const filePath = toCanonicalName(fileName);
5433
- fileWatcherCallbacks.add(filePath, callback);
5434
+ if (fileWatcherCallbacks.add(filePath, callback).length === 1 && fileTimestamps) {
5435
+ fileTimestamps.set(filePath, getModifiedTime3(fileName) || missingFileModifiedTime);
5436
+ }
5434
5437
  const dirPath = getDirectoryPath(filePath) || ".";
5435
5438
  const watcher = dirWatchers.get(dirPath) || createDirectoryWatcher(getDirectoryPath(fileName) || ".", dirPath, fallbackOptions);
5436
5439
  watcher.referenceCount++;
@@ -5450,14 +5453,31 @@ ${lanes.join("\n")}
5450
5453
  const watcher = fsWatch(
5451
5454
  dirName,
5452
5455
  1 /* Directory */,
5453
- (_eventName, relativeFileName, modifiedTime) => {
5456
+ (eventName, relativeFileName) => {
5454
5457
  if (!isString(relativeFileName))
5455
5458
  return;
5456
5459
  const fileName = getNormalizedAbsolutePath(relativeFileName, dirName);
5457
- const callbacks = fileName && fileWatcherCallbacks.get(toCanonicalName(fileName));
5460
+ const filePath = toCanonicalName(fileName);
5461
+ const callbacks = fileName && fileWatcherCallbacks.get(filePath);
5458
5462
  if (callbacks) {
5463
+ let currentModifiedTime;
5464
+ let eventKind = 1 /* Changed */;
5465
+ if (fileTimestamps) {
5466
+ const existingTime = fileTimestamps.get(filePath);
5467
+ if (eventName === "change") {
5468
+ currentModifiedTime = getModifiedTime3(fileName) || missingFileModifiedTime;
5469
+ if (currentModifiedTime.getTime() === existingTime.getTime())
5470
+ return;
5471
+ }
5472
+ currentModifiedTime || (currentModifiedTime = getModifiedTime3(fileName) || missingFileModifiedTime);
5473
+ fileTimestamps.set(filePath, currentModifiedTime);
5474
+ if (existingTime === missingFileModifiedTime)
5475
+ eventKind = 0 /* Created */;
5476
+ else if (currentModifiedTime === missingFileModifiedTime)
5477
+ eventKind = 2 /* Deleted */;
5478
+ }
5459
5479
  for (const fileCallback of callbacks) {
5460
- fileCallback(fileName, 1 /* Changed */, modifiedTime);
5480
+ fileCallback(fileName, eventKind, currentModifiedTime);
5461
5481
  }
5462
5482
  }
5463
5483
  },
@@ -5849,7 +5869,7 @@ ${lanes.join("\n")}
5849
5869
  );
5850
5870
  case 5 /* UseFsEventsOnParentDirectory */:
5851
5871
  if (!nonPollingWatchFile) {
5852
- nonPollingWatchFile = createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames2);
5872
+ nonPollingWatchFile = createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames2, getModifiedTime3, fsWatchWithTimestamp);
5853
5873
  }
5854
5874
  return nonPollingWatchFile(fileName, callback, pollingInterval, getFallbackOptions(options));
5855
5875
  default:
@@ -6024,7 +6044,7 @@ ${lanes.join("\n")}
6024
6044
  return watchPresentFileSystemEntryWithFsWatchFile();
6025
6045
  }
6026
6046
  try {
6027
- const presentWatcher = (!fsWatchWithTimestamp ? fsWatchWorker : fsWatchWorkerHandlingTimestamp)(
6047
+ const presentWatcher = (entryKind === 1 /* Directory */ || !fsWatchWithTimestamp ? fsWatchWorker : fsWatchWorkerHandlingTimestamp)(
6028
6048
  fileOrDirectory,
6029
6049
  recursive,
6030
6050
  inodeWatching ? callbackChangingToMissingFileSystemEntry : callback
@@ -45450,13 +45470,21 @@ ${lanes.join("\n")}
45450
45470
  }
45451
45471
  const nearestTargetPackageJson = getNearestAncestorDirectoryWithPackageJson(host, getDirectoryPath(modulePath));
45452
45472
  const nearestSourcePackageJson = getNearestAncestorDirectoryWithPackageJson(host, sourceDirectory);
45453
- if (nearestSourcePackageJson !== nearestTargetPackageJson) {
45473
+ const ignoreCase = !hostUsesCaseSensitiveFileNames(host);
45474
+ if (!packageJsonPathsAreEqual(nearestTargetPackageJson, nearestSourcePackageJson, ignoreCase)) {
45454
45475
  return maybeNonRelative;
45455
45476
  }
45456
45477
  return relativePath;
45457
45478
  }
45458
45479
  return isPathRelativeToParent(maybeNonRelative) || countPathComponents(relativePath) < countPathComponents(maybeNonRelative) ? relativePath : maybeNonRelative;
45459
45480
  }
45481
+ function packageJsonPathsAreEqual(a, b, ignoreCase) {
45482
+ if (a === b)
45483
+ return true;
45484
+ if (a === void 0 || b === void 0)
45485
+ return false;
45486
+ return comparePaths(a, b, ignoreCase) === 0 /* EqualTo */;
45487
+ }
45460
45488
  function countPathComponents(path) {
45461
45489
  let count = 0;
45462
45490
  for (let i = startsWith(path, "./") ? 2 : 0; i < path.length; i++) {
@@ -50495,15 +50523,19 @@ ${lanes.join("\n")}
50495
50523
  return true;
50496
50524
  }
50497
50525
  }
50498
- function isEntityNameVisible(entityName, enclosingDeclaration) {
50526
+ function getMeaningOfEntityNameReference(entityName) {
50499
50527
  let meaning;
50500
50528
  if (entityName.parent.kind === 186 /* TypeQuery */ || entityName.parent.kind === 233 /* ExpressionWithTypeArguments */ && !isPartOfTypeNode(entityName.parent) || entityName.parent.kind === 167 /* ComputedPropertyName */) {
50501
50529
  meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
50502
- } else if (entityName.kind === 166 /* QualifiedName */ || entityName.kind === 211 /* PropertyAccessExpression */ || entityName.parent.kind === 271 /* ImportEqualsDeclaration */) {
50530
+ } else if (entityName.kind === 166 /* QualifiedName */ || entityName.kind === 211 /* PropertyAccessExpression */ || entityName.parent.kind === 271 /* ImportEqualsDeclaration */ || entityName.parent.kind === 166 /* QualifiedName */ && entityName.parent.left === entityName || entityName.parent.kind === 211 /* PropertyAccessExpression */ && entityName.parent.expression === entityName || entityName.parent.kind === 212 /* ElementAccessExpression */ && entityName.parent.expression === entityName) {
50503
50531
  meaning = 1920 /* Namespace */;
50504
50532
  } else {
50505
50533
  meaning = 788968 /* Type */;
50506
50534
  }
50535
+ return meaning;
50536
+ }
50537
+ function isEntityNameVisible(entityName, enclosingDeclaration) {
50538
+ const meaning = getMeaningOfEntityNameReference(entityName);
50507
50539
  const firstIdentifier = getFirstIdentifier(entityName);
50508
50540
  const symbol = resolveName(
50509
50541
  enclosingDeclaration,
@@ -52564,9 +52596,10 @@ ${lanes.join("\n")}
52564
52596
  introducesError = true;
52565
52597
  return { introducesError, node };
52566
52598
  }
52599
+ const meaning = getMeaningOfEntityNameReference(node);
52567
52600
  const sym = resolveEntityName(
52568
52601
  leftmost,
52569
- -1 /* All */,
52602
+ meaning,
52570
52603
  /*ignoreErrors*/
52571
52604
  true,
52572
52605
  /*dontResolveAlias*/
@@ -52576,13 +52609,13 @@ ${lanes.join("\n")}
52576
52609
  if (isSymbolAccessible(
52577
52610
  sym,
52578
52611
  context.enclosingDeclaration,
52579
- -1 /* All */,
52612
+ meaning,
52580
52613
  /*shouldComputeAliasesToMakeVisible*/
52581
52614
  false
52582
52615
  ).accessibility !== 0 /* Accessible */) {
52583
52616
  introducesError = true;
52584
52617
  } else {
52585
- context.tracker.trackSymbol(sym, context.enclosingDeclaration, -1 /* All */);
52618
+ context.tracker.trackSymbol(sym, context.enclosingDeclaration, meaning);
52586
52619
  includePrivateSymbol == null ? void 0 : includePrivateSymbol(sym);
52587
52620
  }
52588
52621
  if (isIdentifier(node)) {
@@ -60489,6 +60522,9 @@ ${lanes.join("\n")}
60489
60522
  } else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && (t.types[0].flags & 65536 /* Null */ || t.types[1].flags & 65536 /* Null */)))) {
60490
60523
  removeFromEach(typeSet, 65536 /* Null */);
60491
60524
  result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
60525
+ } else if (typeSet.length >= 4) {
60526
+ const middle = Math.floor(typeSet.length / 2);
60527
+ result = getIntersectionType([getIntersectionType(typeSet.slice(0, middle)), getIntersectionType(typeSet.slice(middle))], aliasSymbol, aliasTypeArguments);
60492
60528
  } else {
60493
60529
  if (!checkCrossProductUnion(typeSet)) {
60494
60530
  return errorType;
@@ -159942,10 +159978,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
159942
159978
  return isJsxExpression(parent2) && !isJsxElement(parent2.parent) && !isJsxFragment(parent2.parent) ? checker.getContextualTypeForJsxAttribute(parent2.parent) : void 0;
159943
159979
  default:
159944
159980
  const argInfo = ts_SignatureHelp_exports.getArgumentInfoForCompletions(previousToken, position, sourceFile, checker);
159945
- return argInfo ? (
159946
- // At `,`, treat this as the next argument after the comma.
159947
- checker.getContextualTypeForArgumentAtIndex(argInfo.invocation, argInfo.argumentIndex + (previousToken.kind === 28 /* CommaToken */ ? 1 : 0))
159948
- ) : isEqualityOperatorKind(previousToken.kind) && isBinaryExpression(parent2) && isEqualityOperatorKind(parent2.operatorToken.kind) ? (
159981
+ return argInfo ? checker.getContextualTypeForArgumentAtIndex(argInfo.invocation, argInfo.argumentIndex) : isEqualityOperatorKind(previousToken.kind) && isBinaryExpression(parent2) && isEqualityOperatorKind(parent2.operatorToken.kind) ? (
159949
159982
  // completion at `x ===/**/` should be for the right side
159950
159983
  checker.getTypeAtLocation(parent2.left)
159951
159984
  ) : checker.getContextualType(previousToken, 4 /* Completions */) || checker.getContextualType(previousToken);
@@ -168509,12 +168542,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
168509
168542
  if (!info)
168510
168543
  return void 0;
168511
168544
  const { list, argumentIndex } = info;
168512
- const argumentCount = getArgumentCount(
168513
- list,
168514
- /*ignoreTrailingComma*/
168515
- isInString(sourceFile, position, node),
168516
- checker
168517
- );
168545
+ const argumentCount = getArgumentCount(checker, list);
168518
168546
  if (argumentIndex !== 0) {
168519
168547
  Debug.assertLessThan(argumentIndex, argumentCount);
168520
168548
  }
@@ -168526,7 +168554,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
168526
168554
  return { list: getChildListThatStartsWithOpenerToken(node.parent, node, sourceFile), argumentIndex: 0 };
168527
168555
  } else {
168528
168556
  const list = findContainingList(node);
168529
- return list && { list, argumentIndex: getArgumentIndex(list, node, checker) };
168557
+ return list && { list, argumentIndex: getArgumentIndex(checker, list, node) };
168530
168558
  }
168531
168559
  }
168532
168560
  function getImmediatelyContainingArgumentInfo(node, position, sourceFile, checker) {
@@ -168656,24 +168684,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
168656
168684
  return isFunctionTypeNode(d) ? (_a = tryCast(d.parent, canHaveSymbol)) == null ? void 0 : _a.symbol : void 0;
168657
168685
  }) || s : s;
168658
168686
  }
168659
- function getArgumentIndex(argumentsList, node, checker) {
168660
- const args = argumentsList.getChildren();
168661
- let argumentIndex = 0;
168662
- for (let pos = 0; pos < length(args); pos++) {
168663
- const child = args[pos];
168664
- if (child === node) {
168665
- break;
168666
- }
168667
- if (isSpreadElement(child)) {
168668
- argumentIndex = argumentIndex + getSpreadElementCount(child, checker) + (pos > 0 ? pos : 0);
168669
- } else {
168670
- if (child.kind !== 28 /* CommaToken */) {
168671
- argumentIndex++;
168672
- }
168673
- }
168674
- }
168675
- return argumentIndex;
168676
- }
168677
168687
  function getSpreadElementCount(node, checker) {
168678
168688
  const spreadType = checker.getTypeAtLocation(node.expression);
168679
168689
  if (checker.isTupleType(spreadType)) {
@@ -168686,19 +168696,48 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
168686
168696
  }
168687
168697
  return 0;
168688
168698
  }
168689
- function getArgumentCount(argumentsList, ignoreTrailingComma, checker) {
168690
- const listChildren = argumentsList.getChildren();
168691
- let argumentCount = 0;
168692
- for (const child of listChildren) {
168699
+ function getArgumentIndex(checker, argumentsList, node) {
168700
+ return getArgumentIndexOrCount(checker, argumentsList, node);
168701
+ }
168702
+ function getArgumentCount(checker, argumentsList) {
168703
+ return getArgumentIndexOrCount(
168704
+ checker,
168705
+ argumentsList,
168706
+ /*node*/
168707
+ void 0
168708
+ );
168709
+ }
168710
+ function getArgumentIndexOrCount(checker, argumentsList, node) {
168711
+ const args = argumentsList.getChildren();
168712
+ let argumentIndex = 0;
168713
+ let skipComma = false;
168714
+ for (const child of args) {
168715
+ if (node && child === node) {
168716
+ if (!skipComma && child.kind === 28 /* CommaToken */) {
168717
+ argumentIndex++;
168718
+ }
168719
+ return argumentIndex;
168720
+ }
168693
168721
  if (isSpreadElement(child)) {
168694
- argumentCount = argumentCount + getSpreadElementCount(child, checker);
168722
+ argumentIndex += getSpreadElementCount(child, checker);
168723
+ skipComma = true;
168724
+ continue;
168725
+ }
168726
+ if (child.kind !== 28 /* CommaToken */) {
168727
+ argumentIndex++;
168728
+ skipComma = true;
168729
+ continue;
168730
+ }
168731
+ if (skipComma) {
168732
+ skipComma = false;
168733
+ continue;
168695
168734
  }
168735
+ argumentIndex++;
168696
168736
  }
168697
- argumentCount = argumentCount + countWhere(listChildren, (arg) => arg.kind !== 28 /* CommaToken */);
168698
- if (!ignoreTrailingComma && listChildren.length > 0 && last(listChildren).kind === 28 /* CommaToken */) {
168699
- argumentCount++;
168737
+ if (node) {
168738
+ return argumentIndex;
168700
168739
  }
168701
- return argumentCount;
168740
+ return args.length && last(args).kind === 28 /* CommaToken */ ? argumentIndex + 1 : argumentIndex;
168702
168741
  }
168703
168742
  function getArgumentIndexForTemplatePiece(spanIndex, node, position, sourceFile) {
168704
168743
  Debug.assert(position >= node.getStart(), "Assumed 'position' could not occur before node.");
@@ -178286,7 +178325,16 @@ ${options.prefix}` : "\n" : options.prefix
178286
178325
  recursive ? watchedDirectoriesRecursive : watchedDirectories,
178287
178326
  path,
178288
178327
  callback,
178289
- (id) => ({ eventName: CreateDirectoryWatcherEvent, data: { id, path, recursive: !!recursive } })
178328
+ (id) => ({
178329
+ eventName: CreateDirectoryWatcherEvent,
178330
+ data: {
178331
+ id,
178332
+ path,
178333
+ recursive: !!recursive,
178334
+ // Special case node_modules as we watch it for changes to closed script infos as well
178335
+ ignoreUpdate: !path.endsWith("/node_modules") ? true : void 0
178336
+ }
178337
+ })
178290
178338
  );
178291
178339
  }
178292
178340
  function getOrCreateFileWatcher({ pathToId, idToCallbacks }, path, callback, event) {
@@ -178313,24 +178361,28 @@ ${options.prefix}` : "\n" : options.prefix
178313
178361
  }
178314
178362
  };
178315
178363
  }
178316
- function onWatchChange({ id, path, eventType }) {
178317
- onFileWatcherCallback(id, path, eventType);
178318
- onDirectoryWatcherCallback(watchedDirectories, id, path, eventType);
178319
- onDirectoryWatcherCallback(watchedDirectoriesRecursive, id, path, eventType);
178364
+ function onWatchChange(args) {
178365
+ if (isArray(args))
178366
+ args.forEach(onWatchChangeRequestArgs);
178367
+ else
178368
+ onWatchChangeRequestArgs(args);
178320
178369
  }
178321
- function onFileWatcherCallback(id, eventPath, eventType) {
178322
- var _a;
178323
- (_a = watchedFiles.idToCallbacks.get(id)) == null ? void 0 : _a.forEach((callback) => {
178324
- const eventKind = eventType === "create" ? 0 /* Created */ : eventType === "delete" ? 2 /* Deleted */ : 1 /* Changed */;
178325
- callback(eventPath, eventKind);
178326
- });
178370
+ function onWatchChangeRequestArgs({ id, created, deleted, updated }) {
178371
+ onWatchEventType(id, created, 0 /* Created */);
178372
+ onWatchEventType(id, deleted, 2 /* Deleted */);
178373
+ onWatchEventType(id, updated, 1 /* Changed */);
178327
178374
  }
178328
- function onDirectoryWatcherCallback({ idToCallbacks }, id, eventPath, eventType) {
178329
- var _a;
178330
- if (eventType === "update")
178375
+ function onWatchEventType(id, paths, eventKind) {
178376
+ if (!(paths == null ? void 0 : paths.length))
178331
178377
  return;
178332
- (_a = idToCallbacks.get(id)) == null ? void 0 : _a.forEach((callback) => {
178333
- callback(eventPath);
178378
+ forEachCallback(watchedFiles, id, paths, (callback, eventPath) => callback(eventPath, eventKind));
178379
+ forEachCallback(watchedDirectories, id, paths, (callback, eventPath) => callback(eventPath));
178380
+ forEachCallback(watchedDirectoriesRecursive, id, paths, (callback, eventPath) => callback(eventPath));
178381
+ }
178382
+ function forEachCallback(hostWatcherMap, id, eventPaths, cb) {
178383
+ var _a;
178384
+ (_a = hostWatcherMap.idToCallbacks.get(id)) == null ? void 0 : _a.forEach((callback) => {
178385
+ eventPaths.forEach((eventPath) => cb(callback, normalizeSlashes(eventPath)));
178334
178386
  });
178335
178387
  }
178336
178388
  }
@@ -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.3";
57
+ var version = "5.4.4";
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.3",
5
+ "version": "5.4.4",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [