@typescript-deploys/pr-build 5.2.0-pr-54718-7 → 5.2.0-pr-54922-6

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/tsserver.js CHANGED
@@ -2327,7 +2327,7 @@ module.exports = __toCommonJS(server_exports);
2327
2327
 
2328
2328
  // src/compiler/corePublic.ts
2329
2329
  var versionMajorMinor = "5.2";
2330
- var version = `${versionMajorMinor}.0-insiders.20230630`;
2330
+ var version = `${versionMajorMinor}.0-insiders.20230707`;
2331
2331
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2332
2332
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2333
2333
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -3839,8 +3839,8 @@ function unorderedRemoveFirstItemWhere(array, predicate) {
3839
3839
  }
3840
3840
  return false;
3841
3841
  }
3842
- function createGetCanonicalFileName(useCaseSensitiveFileNames) {
3843
- return useCaseSensitiveFileNames ? identity : toFileNameLowerCase;
3842
+ function createGetCanonicalFileName(useCaseSensitiveFileNames2) {
3843
+ return useCaseSensitiveFileNames2 ? identity : toFileNameLowerCase;
3844
3844
  }
3845
3845
  function patternText({ prefix, suffix }) {
3846
3846
  return `${prefix}*${suffix}`;
@@ -7677,10 +7677,10 @@ function createDynamicPriorityPollingWatchFile(host) {
7677
7677
  pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === 250 /* Low */ ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingInterval === 250 /* Low */ ? "pollLowPollingIntervalQueue" : "pollPollingIntervalQueue", pollingIntervalQueue(pollingInterval));
7678
7678
  }
7679
7679
  }
7680
- function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames) {
7680
+ function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames2) {
7681
7681
  const fileWatcherCallbacks = createMultiMap();
7682
7682
  const dirWatchers = /* @__PURE__ */ new Map();
7683
- const toCanonicalName = createGetCanonicalFileName(useCaseSensitiveFileNames);
7683
+ const toCanonicalName = createGetCanonicalFileName(useCaseSensitiveFileNames2);
7684
7684
  return nonPollingWatchFile;
7685
7685
  function nonPollingWatchFile(fileName, callback, _pollingInterval, fallbackOptions) {
7686
7686
  const filePath = toCanonicalName(fileName);
@@ -7756,8 +7756,8 @@ function createFixedChunkSizePollingWatchFile(host) {
7756
7756
  pollScheduled = host.setTimeout(pollQueue, 2e3 /* High */, "pollQueue");
7757
7757
  }
7758
7758
  }
7759
- function createSingleWatcherPerName(cache, useCaseSensitiveFileNames, name, callback, createWatcher) {
7760
- const toCanonicalFileName = createGetCanonicalFileName(useCaseSensitiveFileNames);
7759
+ function createSingleWatcherPerName(cache, useCaseSensitiveFileNames2, name, callback, createWatcher) {
7760
+ const toCanonicalFileName = createGetCanonicalFileName(useCaseSensitiveFileNames2);
7761
7761
  const path = toCanonicalFileName(name);
7762
7762
  const existing = cache.get(path);
7763
7763
  if (existing) {
@@ -7809,7 +7809,7 @@ function setSysLog(logger) {
7809
7809
  }
7810
7810
  function createDirectoryWatcherSupportingRecursive({
7811
7811
  watchDirectory,
7812
- useCaseSensitiveFileNames,
7812
+ useCaseSensitiveFileNames: useCaseSensitiveFileNames2,
7813
7813
  getCurrentDirectory,
7814
7814
  getAccessibleSortedChildDirectories,
7815
7815
  fileSystemEntryExists,
@@ -7821,8 +7821,8 @@ function createDirectoryWatcherSupportingRecursive({
7821
7821
  const callbackCache = createMultiMap();
7822
7822
  const cacheToUpdateChildWatches = /* @__PURE__ */ new Map();
7823
7823
  let timerToUpdateChildWatches;
7824
- const filePathComparer = getStringComparer(!useCaseSensitiveFileNames);
7825
- const toCanonicalFilePath = createGetCanonicalFileName(useCaseSensitiveFileNames);
7824
+ const filePathComparer = getStringComparer(!useCaseSensitiveFileNames2);
7825
+ const toCanonicalFilePath = createGetCanonicalFileName(useCaseSensitiveFileNames2);
7826
7826
  return (dirName, callback, recursive, options) => recursive ? createDirectoryWatcher(dirName, options, callback) : watchDirectory(dirName, callback, recursive, options);
7827
7827
  function createDirectoryWatcher(dirName, options, callback) {
7828
7828
  const dirPath = toCanonicalFilePath(dirName);
@@ -7989,12 +7989,12 @@ function createDirectoryWatcherSupportingRecursive({
7989
7989
  }
7990
7990
  }
7991
7991
  function isIgnoredPath(path, options) {
7992
- return some(ignoredPaths, (searchPath) => isInPath(path, searchPath)) || isIgnoredByWatchOptions(path, options, useCaseSensitiveFileNames, getCurrentDirectory);
7992
+ return some(ignoredPaths, (searchPath) => isInPath(path, searchPath)) || isIgnoredByWatchOptions(path, options, useCaseSensitiveFileNames2, getCurrentDirectory);
7993
7993
  }
7994
7994
  function isInPath(path, searchPath) {
7995
7995
  if (stringContains(path, searchPath))
7996
7996
  return true;
7997
- if (useCaseSensitiveFileNames)
7997
+ if (useCaseSensitiveFileNames2)
7998
7998
  return false;
7999
7999
  return stringContains(toCanonicalFilePath(path), searchPath);
8000
8000
  }
@@ -8017,14 +8017,14 @@ function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModi
8017
8017
  }
8018
8018
  };
8019
8019
  }
8020
- function isIgnoredByWatchOptions(pathToCheck, options, useCaseSensitiveFileNames, getCurrentDirectory) {
8021
- return ((options == null ? void 0 : options.excludeDirectories) || (options == null ? void 0 : options.excludeFiles)) && (matchesExclude(pathToCheck, options == null ? void 0 : options.excludeFiles, useCaseSensitiveFileNames, getCurrentDirectory()) || matchesExclude(pathToCheck, options == null ? void 0 : options.excludeDirectories, useCaseSensitiveFileNames, getCurrentDirectory()));
8020
+ function isIgnoredByWatchOptions(pathToCheck, options, useCaseSensitiveFileNames2, getCurrentDirectory) {
8021
+ return ((options == null ? void 0 : options.excludeDirectories) || (options == null ? void 0 : options.excludeFiles)) && (matchesExclude(pathToCheck, options == null ? void 0 : options.excludeFiles, useCaseSensitiveFileNames2, getCurrentDirectory()) || matchesExclude(pathToCheck, options == null ? void 0 : options.excludeDirectories, useCaseSensitiveFileNames2, getCurrentDirectory()));
8022
8022
  }
8023
- function createFsWatchCallbackForDirectoryWatcherCallback(directoryName, callback, options, useCaseSensitiveFileNames, getCurrentDirectory) {
8023
+ function createFsWatchCallbackForDirectoryWatcherCallback(directoryName, callback, options, useCaseSensitiveFileNames2, getCurrentDirectory) {
8024
8024
  return (eventName, relativeFileName) => {
8025
8025
  if (eventName === "rename") {
8026
8026
  const fileName = !relativeFileName ? directoryName : normalizePath(combinePaths(directoryName, relativeFileName));
8027
- if (!relativeFileName || !isIgnoredByWatchOptions(fileName, options, useCaseSensitiveFileNames, getCurrentDirectory)) {
8027
+ if (!relativeFileName || !isIgnoredByWatchOptions(fileName, options, useCaseSensitiveFileNames2, getCurrentDirectory)) {
8028
8028
  callback(fileName);
8029
8029
  }
8030
8030
  }
@@ -8037,7 +8037,7 @@ function createSystemWatchFunctions({
8037
8037
  clearTimeout: clearTimeout2,
8038
8038
  fsWatchWorker,
8039
8039
  fileSystemEntryExists,
8040
- useCaseSensitiveFileNames,
8040
+ useCaseSensitiveFileNames: useCaseSensitiveFileNames2,
8041
8041
  getCurrentDirectory,
8042
8042
  fsSupportsRecursiveFsWatch,
8043
8043
  getAccessibleSortedChildDirectories,
@@ -8109,7 +8109,7 @@ function createSystemWatchFunctions({
8109
8109
  );
8110
8110
  case 5 /* UseFsEventsOnParentDirectory */:
8111
8111
  if (!nonPollingWatchFile) {
8112
- nonPollingWatchFile = createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames);
8112
+ nonPollingWatchFile = createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames2);
8113
8113
  }
8114
8114
  return nonPollingWatchFile(fileName, callback, pollingInterval, getFallbackOptions(options));
8115
8115
  default:
@@ -8158,7 +8158,7 @@ function createSystemWatchFunctions({
8158
8158
  return fsWatch(
8159
8159
  directoryName,
8160
8160
  1 /* Directory */,
8161
- createFsWatchCallbackForDirectoryWatcherCallback(directoryName, callback, options, useCaseSensitiveFileNames, getCurrentDirectory),
8161
+ createFsWatchCallbackForDirectoryWatcherCallback(directoryName, callback, options, useCaseSensitiveFileNames2, getCurrentDirectory),
8162
8162
  recursive,
8163
8163
  500 /* Medium */,
8164
8164
  getFallbackOptions(options)
@@ -8166,7 +8166,7 @@ function createSystemWatchFunctions({
8166
8166
  }
8167
8167
  if (!hostRecursiveDirectoryWatcher) {
8168
8168
  hostRecursiveDirectoryWatcher = createDirectoryWatcherSupportingRecursive({
8169
- useCaseSensitiveFileNames,
8169
+ useCaseSensitiveFileNames: useCaseSensitiveFileNames2,
8170
8170
  getCurrentDirectory,
8171
8171
  fileSystemEntryExists,
8172
8172
  getAccessibleSortedChildDirectories,
@@ -8212,7 +8212,7 @@ function createSystemWatchFunctions({
8212
8212
  return fsWatch(
8213
8213
  directoryName,
8214
8214
  1 /* Directory */,
8215
- createFsWatchCallbackForDirectoryWatcherCallback(directoryName, callback, options, useCaseSensitiveFileNames, getCurrentDirectory),
8215
+ createFsWatchCallbackForDirectoryWatcherCallback(directoryName, callback, options, useCaseSensitiveFileNames2, getCurrentDirectory),
8216
8216
  recursive,
8217
8217
  500 /* Medium */,
8218
8218
  getFallbackOptions(watchDirectoryOptions)
@@ -8240,7 +8240,7 @@ function createSystemWatchFunctions({
8240
8240
  function pollingWatchFile(fileName, callback, pollingInterval, options) {
8241
8241
  return createSingleWatcherPerName(
8242
8242
  pollingWatches,
8243
- useCaseSensitiveFileNames,
8243
+ useCaseSensitiveFileNames2,
8244
8244
  fileName,
8245
8245
  callback,
8246
8246
  (cb) => pollingWatchFileWorker(fileName, cb, pollingInterval, options)
@@ -8249,7 +8249,7 @@ function createSystemWatchFunctions({
8249
8249
  function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) {
8250
8250
  return createSingleWatcherPerName(
8251
8251
  recursive ? fsWatchesRecursive : fsWatches,
8252
- useCaseSensitiveFileNames,
8252
+ useCaseSensitiveFileNames2,
8253
8253
  fileOrDirectory,
8254
8254
  callback,
8255
8255
  (cb) => fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, cb, recursive, fallbackPollingInterval, fallbackOptions)
@@ -8377,7 +8377,7 @@ var sys = (() => {
8377
8377
  const Buffer2 = require("buffer").Buffer;
8378
8378
  const isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
8379
8379
  const platform = _os.platform();
8380
- const useCaseSensitiveFileNames = isFileSystemCaseSensitive();
8380
+ const useCaseSensitiveFileNames2 = isFileSystemCaseSensitive();
8381
8381
  const fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync;
8382
8382
  const executingFilePath = __filename.endsWith("sys.js") ? _path.join(_path.dirname(__dirname), "__fake__.js") : __filename;
8383
8383
  const fsSupportsRecursiveFsWatch = process.platform === "win32" || process.platform === "darwin";
@@ -8388,7 +8388,7 @@ var sys = (() => {
8388
8388
  setTimeout,
8389
8389
  clearTimeout,
8390
8390
  fsWatchWorker,
8391
- useCaseSensitiveFileNames,
8391
+ useCaseSensitiveFileNames: useCaseSensitiveFileNames2,
8392
8392
  getCurrentDirectory,
8393
8393
  fileSystemEntryExists,
8394
8394
  // Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
@@ -8405,7 +8405,7 @@ var sys = (() => {
8405
8405
  const nodeSystem = {
8406
8406
  args: process.argv.slice(2),
8407
8407
  newLine: _os.EOL,
8408
- useCaseSensitiveFileNames,
8408
+ useCaseSensitiveFileNames: useCaseSensitiveFileNames2,
8409
8409
  write(s) {
8410
8410
  process.stdout.write(s);
8411
8411
  },
@@ -8534,12 +8534,12 @@ var sys = (() => {
8534
8534
  for (const node of profile.nodes) {
8535
8535
  if (node.callFrame.url) {
8536
8536
  const url = normalizeSlashes(node.callFrame.url);
8537
- if (containsPath(fileUrlRoot, url, useCaseSensitiveFileNames)) {
8537
+ if (containsPath(fileUrlRoot, url, useCaseSensitiveFileNames2)) {
8538
8538
  node.callFrame.url = getRelativePathToDirectoryOrUrl(
8539
8539
  fileUrlRoot,
8540
8540
  url,
8541
8541
  fileUrlRoot,
8542
- createGetCanonicalFileName(useCaseSensitiveFileNames),
8542
+ createGetCanonicalFileName(useCaseSensitiveFileNames2),
8543
8543
  /*isAbsolutePathAnUrl*/
8544
8544
  true
8545
8545
  );
@@ -8719,7 +8719,7 @@ var sys = (() => {
8719
8719
  }
8720
8720
  }
8721
8721
  function readDirectory(path, extensions, excludes, includes, depth) {
8722
- return matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, process.cwd(), depth, getAccessibleFileSystemEntries, realpath);
8722
+ return matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames2, process.cwd(), depth, getAccessibleFileSystemEntries, realpath);
8723
8723
  }
8724
8724
  function fileSystemEntryExists(path, entryKind) {
8725
8725
  const originalStackTraceLimit = Error.stackTraceLimit;
@@ -10986,6 +10986,7 @@ var Diagnostics = {
10986
10986
  Parameter_modifiers_can_only_be_used_in_TypeScript_files: diag(8012, 1 /* Error */, "Parameter_modifiers_can_only_be_used_in_TypeScript_files_8012", "Parameter modifiers can only be used in TypeScript files."),
10987
10987
  Non_null_assertions_can_only_be_used_in_TypeScript_files: diag(8013, 1 /* Error */, "Non_null_assertions_can_only_be_used_in_TypeScript_files_8013", "Non-null assertions can only be used in TypeScript files."),
10988
10988
  Type_assertion_expressions_can_only_be_used_in_TypeScript_files: diag(8016, 1 /* Error */, "Type_assertion_expressions_can_only_be_used_in_TypeScript_files_8016", "Type assertion expressions can only be used in TypeScript files."),
10989
+ Signature_declarations_can_only_be_used_in_TypeScript_files: diag(8017, 1 /* Error */, "Signature_declarations_can_only_be_used_in_TypeScript_files_8017", "Signature declarations can only be used in TypeScript files."),
10989
10990
  Report_errors_in_js_files: diag(8019, 3 /* Message */, "Report_errors_in_js_files_8019", "Report errors in .js files."),
10990
10991
  JSDoc_types_can_only_be_used_inside_documentation_comments: diag(8020, 1 /* Error */, "JSDoc_types_can_only_be_used_inside_documentation_comments_8020", "JSDoc types can only be used inside documentation comments."),
10991
10992
  JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags: diag(8021, 1 /* Error */, "JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021", "JSDoc '@typedef' tag should either have a type annotation or be followed by '@property' or '@member' tags."),
@@ -12114,7 +12115,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12114
12115
  if (withMinus)
12115
12116
  start3--;
12116
12117
  error2(Diagnostics.Octal_literals_are_not_allowed_Use_the_syntax_0, start3, pos - start3, literal);
12117
- return { type: 9 /* NumericLiteral */, value: tokenValue };
12118
+ return 9 /* NumericLiteral */;
12118
12119
  }
12119
12120
  } else {
12120
12121
  mainFragment = scanNumberFragment();
@@ -12154,20 +12155,18 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12154
12155
  }
12155
12156
  if (tokenFlags & 8192 /* ContainsLeadingZero */) {
12156
12157
  error2(Diagnostics.Decimals_with_leading_zeros_are_not_allowed, start3, end2 - start3);
12157
- return { type: 9 /* NumericLiteral */, value: "" + +result };
12158
+ tokenValue = "" + +result;
12159
+ return 9 /* NumericLiteral */;
12158
12160
  }
12159
12161
  if (decimalFragment !== void 0 || tokenFlags & 16 /* Scientific */) {
12160
12162
  checkForIdentifierStartAfterNumericLiteral(start3, decimalFragment === void 0 && !!(tokenFlags & 16 /* Scientific */));
12161
- return {
12162
- type: 9 /* NumericLiteral */,
12163
- value: "" + +result
12164
- // if value is not an integer, it can be safely coerced to a number
12165
- };
12163
+ tokenValue = "" + +result;
12164
+ return 9 /* NumericLiteral */;
12166
12165
  } else {
12167
12166
  tokenValue = result;
12168
12167
  const type = checkBigIntSuffix();
12169
12168
  checkForIdentifierStartAfterNumericLiteral(start3);
12170
- return { type, value: tokenValue };
12169
+ return type;
12171
12170
  }
12172
12171
  }
12173
12172
  function checkForIdentifierStartAfterNumericLiteral(numericStart, isScientific) {
@@ -12776,7 +12775,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12776
12775
  return token = 41 /* MinusToken */;
12777
12776
  case 46 /* dot */:
12778
12777
  if (isDigit(text.charCodeAt(pos + 1))) {
12779
- tokenValue = scanNumber().value;
12778
+ scanNumber();
12780
12779
  return token = 9 /* NumericLiteral */;
12781
12780
  }
12782
12781
  if (text.charCodeAt(pos + 1) === 46 /* dot */ && text.charCodeAt(pos + 2) === 46 /* dot */) {
@@ -12894,8 +12893,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12894
12893
  case 55 /* _7 */:
12895
12894
  case 56 /* _8 */:
12896
12895
  case 57 /* _9 */:
12897
- ({ type: token, value: tokenValue } = scanNumber());
12898
- return token;
12896
+ return token = scanNumber();
12899
12897
  case 58 /* colon */:
12900
12898
  pos++;
12901
12899
  return token = 59 /* ColonToken */;
@@ -20757,7 +20755,7 @@ function getSubPatternFromSpec(spec, basePath, usage, { singleAsteriskRegexFragm
20757
20755
  function replaceWildcardCharacter(match, singleAsteriskRegexFragment) {
20758
20756
  return match === "*" ? singleAsteriskRegexFragment : match === "?" ? "[^/]" : "\\" + match;
20759
20757
  }
20760
- function getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory) {
20758
+ function getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames2, currentDirectory) {
20761
20759
  path = normalizePath(path);
20762
20760
  currentDirectory = normalizePath(currentDirectory);
20763
20761
  const absolutePath = combinePaths(currentDirectory, path);
@@ -20766,22 +20764,22 @@ function getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNa
20766
20764
  includeFilePattern: getRegularExpressionForWildcard(includes, absolutePath, "files"),
20767
20765
  includeDirectoryPattern: getRegularExpressionForWildcard(includes, absolutePath, "directories"),
20768
20766
  excludePattern: getRegularExpressionForWildcard(excludes, absolutePath, "exclude"),
20769
- basePaths: getBasePaths(path, includes, useCaseSensitiveFileNames)
20767
+ basePaths: getBasePaths(path, includes, useCaseSensitiveFileNames2)
20770
20768
  };
20771
20769
  }
20772
- function getRegexFromPattern(pattern, useCaseSensitiveFileNames) {
20773
- return new RegExp(pattern, useCaseSensitiveFileNames ? "" : "i");
20770
+ function getRegexFromPattern(pattern, useCaseSensitiveFileNames2) {
20771
+ return new RegExp(pattern, useCaseSensitiveFileNames2 ? "" : "i");
20774
20772
  }
20775
- function matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries, realpath) {
20773
+ function matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames2, currentDirectory, depth, getFileSystemEntries, realpath) {
20776
20774
  path = normalizePath(path);
20777
20775
  currentDirectory = normalizePath(currentDirectory);
20778
- const patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory);
20779
- const includeFileRegexes = patterns.includeFilePatterns && patterns.includeFilePatterns.map((pattern) => getRegexFromPattern(pattern, useCaseSensitiveFileNames));
20780
- const includeDirectoryRegex = patterns.includeDirectoryPattern && getRegexFromPattern(patterns.includeDirectoryPattern, useCaseSensitiveFileNames);
20781
- const excludeRegex = patterns.excludePattern && getRegexFromPattern(patterns.excludePattern, useCaseSensitiveFileNames);
20776
+ const patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames2, currentDirectory);
20777
+ const includeFileRegexes = patterns.includeFilePatterns && patterns.includeFilePatterns.map((pattern) => getRegexFromPattern(pattern, useCaseSensitiveFileNames2));
20778
+ const includeDirectoryRegex = patterns.includeDirectoryPattern && getRegexFromPattern(patterns.includeDirectoryPattern, useCaseSensitiveFileNames2);
20779
+ const excludeRegex = patterns.excludePattern && getRegexFromPattern(patterns.excludePattern, useCaseSensitiveFileNames2);
20782
20780
  const results = includeFileRegexes ? includeFileRegexes.map(() => []) : [[]];
20783
20781
  const visited = /* @__PURE__ */ new Map();
20784
- const toCanonical = createGetCanonicalFileName(useCaseSensitiveFileNames);
20782
+ const toCanonical = createGetCanonicalFileName(useCaseSensitiveFileNames2);
20785
20783
  for (const basePath of patterns.basePaths) {
20786
20784
  visitDirectory(basePath, combinePaths(currentDirectory, basePath), depth);
20787
20785
  }
@@ -20823,7 +20821,7 @@ function matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNa
20823
20821
  }
20824
20822
  }
20825
20823
  }
20826
- function getBasePaths(path, includes, useCaseSensitiveFileNames) {
20824
+ function getBasePaths(path, includes, useCaseSensitiveFileNames2) {
20827
20825
  const basePaths = [path];
20828
20826
  if (includes) {
20829
20827
  const includeBasePaths = [];
@@ -20831,9 +20829,9 @@ function getBasePaths(path, includes, useCaseSensitiveFileNames) {
20831
20829
  const absolute = isRootedDiskPath(include) ? include : normalizePath(combinePaths(path, include));
20832
20830
  includeBasePaths.push(getIncludeBasePath(absolute));
20833
20831
  }
20834
- includeBasePaths.sort(getStringComparer(!useCaseSensitiveFileNames));
20832
+ includeBasePaths.sort(getStringComparer(!useCaseSensitiveFileNames2));
20835
20833
  for (const includeBasePath of includeBasePaths) {
20836
- if (every(basePaths, (basePath) => !containsPath(basePath, includeBasePath, path, !useCaseSensitiveFileNames))) {
20834
+ if (every(basePaths, (basePath) => !containsPath(basePath, includeBasePath, path, !useCaseSensitiveFileNames2))) {
20837
20835
  basePaths.push(includeBasePath);
20838
20836
  }
20839
20837
  }
@@ -30992,7 +30990,8 @@ var Parser;
30992
30990
  nextToken();
30993
30991
  const statements = parseList(0 /* SourceElements */, parseStatement);
30994
30992
  Debug.assert(token() === 1 /* EndOfFileToken */);
30995
- const endOfFileToken = addJSDocComment(parseTokenNode());
30993
+ const endHasJSDoc = hasPrecedingJSDocComment();
30994
+ const endOfFileToken = withJSDoc(parseTokenNode(), endHasJSDoc);
30996
30995
  const sourceFile = createSourceFile2(fileName, languageVersion2, scriptKind2, isDeclarationFile, statements, endOfFileToken, sourceFlags, setExternalModuleIndicator2);
30997
30996
  processCommentPragmas(sourceFile, sourceText);
30998
30997
  processPragmasIntoFields(sourceFile, reportPragmaDiagnostic);
@@ -31012,11 +31011,11 @@ var Parser;
31012
31011
  parseDiagnostics.push(createDetachedDiagnostic(fileName, pos, end, diagnostic));
31013
31012
  }
31014
31013
  }
31015
- function withJSDoc(node, hasJSDoc) {
31016
- return hasJSDoc ? addJSDocComment(node) : node;
31017
- }
31018
31014
  let hasDeprecatedTag = false;
31019
- function addJSDocComment(node) {
31015
+ function withJSDoc(node, hasJSDoc) {
31016
+ if (!hasJSDoc) {
31017
+ return node;
31018
+ }
31020
31019
  Debug.assert(!node.jsDoc);
31021
31020
  const jsDoc = mapDefined(getJSDocCommentRanges(node, sourceText), (comment) => JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos));
31022
31021
  if (jsDoc.length)
@@ -33531,12 +33530,14 @@ var Parser;
33531
33530
  return arrowExpression;
33532
33531
  }
33533
33532
  const pos = getNodePos();
33533
+ const hasJSDoc = hasPrecedingJSDocComment();
33534
33534
  const expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
33535
33535
  if (expr.kind === 80 /* Identifier */ && token() === 39 /* EqualsGreaterThanToken */) {
33536
33536
  return parseSimpleArrowFunctionExpression(
33537
33537
  pos,
33538
33538
  expr,
33539
33539
  allowReturnTypeInArrowFunction,
33540
+ hasJSDoc,
33540
33541
  /*asyncModifier*/
33541
33542
  void 0
33542
33543
  );
@@ -33582,7 +33583,7 @@ var Parser;
33582
33583
  ), pos);
33583
33584
  }
33584
33585
  }
33585
- function parseSimpleArrowFunctionExpression(pos, identifier, allowReturnTypeInArrowFunction, asyncModifier) {
33586
+ function parseSimpleArrowFunctionExpression(pos, identifier, allowReturnTypeInArrowFunction, hasJSDoc, asyncModifier) {
33586
33587
  Debug.assert(token() === 39 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
33587
33588
  const parameter = factory2.createParameterDeclaration(
33588
33589
  /*modifiers*/
@@ -33615,7 +33616,7 @@ var Parser;
33615
33616
  equalsGreaterThanToken,
33616
33617
  body
33617
33618
  );
33618
- return addJSDocComment(finishNode(node, pos));
33619
+ return withJSDoc(finishNode(node, pos), hasJSDoc);
33619
33620
  }
33620
33621
  function tryParseParenthesizedArrowFunctionExpression(allowReturnTypeInArrowFunction) {
33621
33622
  const triState = isParenthesizedArrowFunctionExpression();
@@ -33743,9 +33744,10 @@ var Parser;
33743
33744
  if (token() === 134 /* AsyncKeyword */) {
33744
33745
  if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) {
33745
33746
  const pos = getNodePos();
33747
+ const hasJSDoc = hasPrecedingJSDocComment();
33746
33748
  const asyncModifier = parseModifiersForArrowFunction();
33747
33749
  const expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
33748
- return parseSimpleArrowFunctionExpression(pos, expr, allowReturnTypeInArrowFunction, asyncModifier);
33750
+ return parseSimpleArrowFunctionExpression(pos, expr, allowReturnTypeInArrowFunction, hasJSDoc, asyncModifier);
33749
33751
  }
33750
33752
  }
33751
33753
  return void 0;
@@ -38500,6 +38502,7 @@ var commandOptionsWithoutBuild = [
38500
38502
  {
38501
38503
  name: "checkJs",
38502
38504
  type: "boolean",
38505
+ affectsModuleResolution: true,
38503
38506
  showInSimplifiedHelpView: true,
38504
38507
  category: Diagnostics.JavaScript_Support,
38505
38508
  description: Diagnostics.Enable_error_reporting_in_type_checked_JavaScript_files,
@@ -40945,19 +40948,19 @@ function getFileNamesFromConfigSpecs(configFileSpecs, basePath, options, host, e
40945
40948
  const wildcardFiles = arrayFrom(wildcardFileMap.values());
40946
40949
  return literalFiles.concat(wildcardFiles, arrayFrom(wildCardJsonFileMap.values()));
40947
40950
  }
40948
- function isExcludedFile(pathToCheck, spec, basePath, useCaseSensitiveFileNames, currentDirectory) {
40951
+ function isExcludedFile(pathToCheck, spec, basePath, useCaseSensitiveFileNames2, currentDirectory) {
40949
40952
  const { validatedFilesSpec, validatedIncludeSpecs, validatedExcludeSpecs } = spec;
40950
40953
  if (!length(validatedIncludeSpecs) || !length(validatedExcludeSpecs))
40951
40954
  return false;
40952
40955
  basePath = normalizePath(basePath);
40953
- const keyMapper = createGetCanonicalFileName(useCaseSensitiveFileNames);
40956
+ const keyMapper = createGetCanonicalFileName(useCaseSensitiveFileNames2);
40954
40957
  if (validatedFilesSpec) {
40955
40958
  for (const fileName of validatedFilesSpec) {
40956
40959
  if (keyMapper(getNormalizedAbsolutePath(fileName, basePath)) === pathToCheck)
40957
40960
  return false;
40958
40961
  }
40959
40962
  }
40960
- return matchesExcludeWorker(pathToCheck, validatedExcludeSpecs, useCaseSensitiveFileNames, currentDirectory, basePath);
40963
+ return matchesExcludeWorker(pathToCheck, validatedExcludeSpecs, useCaseSensitiveFileNames2, currentDirectory, basePath);
40961
40964
  }
40962
40965
  function invalidDotDotAfterRecursiveWildcard(s) {
40963
40966
  const wildcardIndex = startsWith(s, "**/") ? 0 : s.indexOf("/**/");
@@ -40967,17 +40970,17 @@ function invalidDotDotAfterRecursiveWildcard(s) {
40967
40970
  const lastDotIndex = endsWith(s, "/..") ? s.length : s.lastIndexOf("/../");
40968
40971
  return lastDotIndex > wildcardIndex;
40969
40972
  }
40970
- function matchesExclude(pathToCheck, excludeSpecs, useCaseSensitiveFileNames, currentDirectory) {
40973
+ function matchesExclude(pathToCheck, excludeSpecs, useCaseSensitiveFileNames2, currentDirectory) {
40971
40974
  return matchesExcludeWorker(
40972
40975
  pathToCheck,
40973
40976
  filter(excludeSpecs, (spec) => !invalidDotDotAfterRecursiveWildcard(spec)),
40974
- useCaseSensitiveFileNames,
40977
+ useCaseSensitiveFileNames2,
40975
40978
  currentDirectory
40976
40979
  );
40977
40980
  }
40978
- function matchesExcludeWorker(pathToCheck, excludeSpecs, useCaseSensitiveFileNames, currentDirectory, basePath) {
40981
+ function matchesExcludeWorker(pathToCheck, excludeSpecs, useCaseSensitiveFileNames2, currentDirectory, basePath) {
40979
40982
  const excludePattern = getRegularExpressionForWildcard(excludeSpecs, combinePaths(normalizePath(currentDirectory), basePath), "exclude");
40980
- const excludeRegex = excludePattern && getRegexFromPattern(excludePattern, useCaseSensitiveFileNames);
40983
+ const excludeRegex = excludePattern && getRegexFromPattern(excludePattern, useCaseSensitiveFileNames2);
40981
40984
  if (!excludeRegex)
40982
40985
  return false;
40983
40986
  if (excludeRegex.test(pathToCheck))
@@ -41007,9 +41010,9 @@ function specToDiagnostic(spec, disallowTrailingRecursion) {
41007
41010
  return [Diagnostics.File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec];
41008
41011
  }
41009
41012
  }
41010
- function getWildcardDirectories({ validatedIncludeSpecs: include, validatedExcludeSpecs: exclude }, path, useCaseSensitiveFileNames) {
41013
+ function getWildcardDirectories({ validatedIncludeSpecs: include, validatedExcludeSpecs: exclude }, path, useCaseSensitiveFileNames2) {
41011
41014
  const rawExcludeRegex = getRegularExpressionForWildcard(exclude, path, "exclude");
41012
- const excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames ? "" : "i");
41015
+ const excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames2 ? "" : "i");
41013
41016
  const wildcardDirectories = {};
41014
41017
  if (include !== void 0) {
41015
41018
  const recursiveKeys = [];
@@ -41018,7 +41021,7 @@ function getWildcardDirectories({ validatedIncludeSpecs: include, validatedExclu
41018
41021
  if (excludeRegex && excludeRegex.test(spec)) {
41019
41022
  continue;
41020
41023
  }
41021
- const match = getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames);
41024
+ const match = getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames2);
41022
41025
  if (match) {
41023
41026
  const { key, flags } = match;
41024
41027
  const existingFlags = wildcardDirectories[key];
@@ -41033,7 +41036,7 @@ function getWildcardDirectories({ validatedIncludeSpecs: include, validatedExclu
41033
41036
  for (const key in wildcardDirectories) {
41034
41037
  if (hasProperty(wildcardDirectories, key)) {
41035
41038
  for (const recursiveKey of recursiveKeys) {
41036
- if (key !== recursiveKey && containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) {
41039
+ if (key !== recursiveKey && containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames2)) {
41037
41040
  delete wildcardDirectories[key];
41038
41041
  }
41039
41042
  }
@@ -41042,20 +41045,20 @@ function getWildcardDirectories({ validatedIncludeSpecs: include, validatedExclu
41042
41045
  }
41043
41046
  return wildcardDirectories;
41044
41047
  }
41045
- function getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames) {
41048
+ function getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames2) {
41046
41049
  const match = wildcardDirectoryPattern.exec(spec);
41047
41050
  if (match) {
41048
41051
  const questionWildcardIndex = spec.indexOf("?");
41049
41052
  const starWildcardIndex = spec.indexOf("*");
41050
41053
  const lastDirectorySeperatorIndex = spec.lastIndexOf(directorySeparator);
41051
41054
  return {
41052
- key: useCaseSensitiveFileNames ? match[0] : toFileNameLowerCase(match[0]),
41055
+ key: useCaseSensitiveFileNames2 ? match[0] : toFileNameLowerCase(match[0]),
41053
41056
  flags: questionWildcardIndex !== -1 && questionWildcardIndex < lastDirectorySeperatorIndex || starWildcardIndex !== -1 && starWildcardIndex < lastDirectorySeperatorIndex ? 1 /* Recursive */ : 0 /* None */
41054
41057
  };
41055
41058
  }
41056
41059
  if (isImplicitGlob(spec.substring(spec.lastIndexOf(directorySeparator) + 1))) {
41057
41060
  return {
41058
- key: removeTrailingDirectorySeparator(useCaseSensitiveFileNames ? spec : toFileNameLowerCase(spec)),
41061
+ key: removeTrailingDirectorySeparator(useCaseSensitiveFileNames2 ? spec : toFileNameLowerCase(spec)),
41059
41062
  flags: 1 /* Recursive */
41060
41063
  };
41061
41064
  }
@@ -41201,6 +41204,18 @@ function formatExtensions(extensions) {
41201
41204
  result.push("JSON");
41202
41205
  return result.join(", ");
41203
41206
  }
41207
+ function extensionsToExtensionsArray(extensions) {
41208
+ const result = [];
41209
+ if (extensions & 1 /* TypeScript */)
41210
+ result.push(...supportedTSImplementationExtensions);
41211
+ if (extensions & 2 /* JavaScript */)
41212
+ result.push(...supportedJSExtensionsFlat);
41213
+ if (extensions & 4 /* Declaration */)
41214
+ result.push(...supportedDeclarationExtensions);
41215
+ if (extensions & 8 /* Json */)
41216
+ result.push(".json" /* Json */);
41217
+ return result;
41218
+ }
41204
41219
  function resolvedTypeScriptOnly(resolved) {
41205
41220
  if (!resolved) {
41206
41221
  return void 0;
@@ -41375,8 +41390,8 @@ function getDefaultTypeRoots(currentDirectory) {
41375
41390
  }
41376
41391
  var nodeModulesAtTypes = combinePaths("node_modules", "@types");
41377
41392
  function arePathsEqual(path1, path2, host) {
41378
- const useCaseSensitiveFileNames = typeof host.useCaseSensitiveFileNames === "function" ? host.useCaseSensitiveFileNames() : host.useCaseSensitiveFileNames;
41379
- return comparePaths(path1, path2, !useCaseSensitiveFileNames) === 0 /* EqualTo */;
41393
+ const useCaseSensitiveFileNames2 = typeof host.useCaseSensitiveFileNames === "function" ? host.useCaseSensitiveFileNames() : host.useCaseSensitiveFileNames;
41394
+ return comparePaths(path1, path2, !useCaseSensitiveFileNames2) === 0 /* EqualTo */;
41380
41395
  }
41381
41396
  function getOriginalAndResolvedFileName(fileName, host, traceEnabled) {
41382
41397
  const resolvedFileName = realPath(fileName, host, traceEnabled);
@@ -42653,7 +42668,7 @@ function getEntrypointsFromPackageJsonInfo(packageJsonInfo, options, host, cache
42653
42668
  arrayIsEqualTo
42654
42669
  );
42655
42670
  for (const conditions of conditionSets) {
42656
- const loadPackageJsonExportsState = { ...loadPackageJsonMainState, failedLookupLocations: [], conditions };
42671
+ const loadPackageJsonExportsState = { ...loadPackageJsonMainState, failedLookupLocations: [], conditions, host };
42657
42672
  const exportResolutions = loadEntrypointsFromExportMap(
42658
42673
  packageJsonInfo,
42659
42674
  packageJsonInfo.contents.packageJsonContent.exports,
@@ -42685,23 +42700,42 @@ function loadEntrypointsFromExportMap(scope, exports, state, extensions) {
42685
42700
  return entrypoints;
42686
42701
  function loadEntrypointsFromTargetExports(target) {
42687
42702
  var _a, _b;
42688
- if (typeof target === "string" && startsWith(target, "./") && target.indexOf("*") === -1) {
42689
- const partsAfterFirst = getPathComponents(target).slice(2);
42690
- if (partsAfterFirst.indexOf("..") >= 0 || partsAfterFirst.indexOf(".") >= 0 || partsAfterFirst.indexOf("node_modules") >= 0) {
42691
- return false;
42692
- }
42693
- const resolvedTarget = combinePaths(scope.packageDirectory, target);
42694
- const finalPath = getNormalizedAbsolutePath(resolvedTarget, (_b = (_a = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a));
42695
- const result = loadFileNameFromPackageJsonField(
42696
- extensions,
42697
- finalPath,
42698
- /*onlyRecordFailures*/
42699
- false,
42700
- state
42701
- );
42702
- if (result) {
42703
- entrypoints = appendIfUnique(entrypoints, result, (a, b) => a.path === b.path);
42704
- return true;
42703
+ if (typeof target === "string" && startsWith(target, "./")) {
42704
+ if (target.indexOf("*") >= 0 && state.host.readDirectory) {
42705
+ if (target.indexOf("*") !== target.lastIndexOf("*")) {
42706
+ return false;
42707
+ }
42708
+ state.host.readDirectory(
42709
+ scope.packageDirectory,
42710
+ extensionsToExtensionsArray(extensions),
42711
+ /*excludes*/
42712
+ void 0,
42713
+ [changeAnyExtension(target.replace("*", "**/*"), getDeclarationEmitExtensionForPath(target))]
42714
+ ).forEach((entry) => {
42715
+ entrypoints = appendIfUnique(entrypoints, {
42716
+ path: entry,
42717
+ ext: getAnyExtensionFromPath(entry),
42718
+ resolvedUsingTsExtension: void 0
42719
+ });
42720
+ });
42721
+ } else {
42722
+ const partsAfterFirst = getPathComponents(target).slice(2);
42723
+ if (partsAfterFirst.indexOf("..") >= 0 || partsAfterFirst.indexOf(".") >= 0 || partsAfterFirst.indexOf("node_modules") >= 0) {
42724
+ return false;
42725
+ }
42726
+ const resolvedTarget = combinePaths(scope.packageDirectory, target);
42727
+ const finalPath = getNormalizedAbsolutePath(resolvedTarget, (_b = (_a = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a));
42728
+ const result = loadFileNameFromPackageJsonField(
42729
+ extensions,
42730
+ finalPath,
42731
+ /*onlyRecordFailures*/
42732
+ false,
42733
+ state
42734
+ );
42735
+ if (result) {
42736
+ entrypoints = appendIfUnique(entrypoints, result, (a, b) => a.path === b.path);
42737
+ return true;
42738
+ }
42705
42739
  }
42706
42740
  } else if (Array.isArray(target)) {
42707
42741
  for (const t of target) {
@@ -42910,6 +42944,9 @@ function loadModuleFromSelfNameReference(extensions, moduleName, directory, stat
42910
42944
  }
42911
42945
  const trailingParts = parts.slice(nameParts.length);
42912
42946
  const subpath = !length(trailingParts) ? "." : `.${directorySeparator}${trailingParts.join(directorySeparator)}`;
42947
+ if (getAllowJSCompilerOption(state.compilerOptions) && !pathContainsNodeModules(directory)) {
42948
+ return loadModuleFromExports(scope, extensions, subpath, state, cache, redirectedReference);
42949
+ }
42913
42950
  const priorityExtensions = extensions & (1 /* TypeScript */ | 4 /* Declaration */);
42914
42951
  const secondaryExtensions = extensions & ~(1 /* TypeScript */ | 4 /* Declaration */);
42915
42952
  return loadModuleFromExports(scope, priorityExtensions, subpath, state, cache, redirectedReference) || loadModuleFromExports(scope, secondaryExtensions, subpath, state, cache, redirectedReference);
@@ -43257,13 +43294,10 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
43257
43294
  function combineDirectoryPath(root, dir) {
43258
43295
  return ensureTrailingDirectorySeparator(combinePaths(root, dir));
43259
43296
  }
43260
- function useCaseSensitiveFileNames() {
43261
- return !state.host.useCaseSensitiveFileNames ? true : typeof state.host.useCaseSensitiveFileNames === "boolean" ? state.host.useCaseSensitiveFileNames : state.host.useCaseSensitiveFileNames();
43262
- }
43263
43297
  function tryLoadInputFileForPath(finalPath, entry, packagePath, isImports2) {
43264
43298
  var _a, _b, _c, _d;
43265
- if (!state.isConfigLookup && (state.compilerOptions.declarationDir || state.compilerOptions.outDir) && finalPath.indexOf("/node_modules/") === -1 && (state.compilerOptions.configFile ? containsPath(scope.packageDirectory, toAbsolutePath(state.compilerOptions.configFile.fileName), !useCaseSensitiveFileNames()) : true)) {
43266
- const getCanonicalFileName = hostGetCanonicalFileName({ useCaseSensitiveFileNames });
43299
+ if (!state.isConfigLookup && (state.compilerOptions.declarationDir || state.compilerOptions.outDir) && finalPath.indexOf("/node_modules/") === -1 && (state.compilerOptions.configFile ? containsPath(scope.packageDirectory, toAbsolutePath(state.compilerOptions.configFile.fileName), !useCaseSensitiveFileNames(state)) : true)) {
43300
+ const getCanonicalFileName = hostGetCanonicalFileName({ useCaseSensitiveFileNames: () => useCaseSensitiveFileNames(state) });
43267
43301
  const commonSourceDirGuesses = [];
43268
43302
  if (state.compilerOptions.rootDir || state.compilerOptions.composite && state.compilerOptions.configFilePath) {
43269
43303
  const commonDir = toAbsolutePath(getCommonSourceDirectory(state.compilerOptions, () => [], ((_b = (_a = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a)) || "", getCanonicalFileName));
@@ -43292,7 +43326,7 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
43292
43326
  for (const commonSourceDirGuess of commonSourceDirGuesses) {
43293
43327
  const candidateDirectories = getOutputDirectoriesForBaseDirectory(commonSourceDirGuess);
43294
43328
  for (const candidateDir of candidateDirectories) {
43295
- if (containsPath(candidateDir, finalPath, !useCaseSensitiveFileNames())) {
43329
+ if (containsPath(candidateDir, finalPath, !useCaseSensitiveFileNames(state))) {
43296
43330
  const pathFragment = finalPath.slice(candidateDir.length + 1);
43297
43331
  const possibleInputBase = combinePaths(commonSourceDirGuess, pathFragment);
43298
43332
  const jsAndDtsExtensions = [".mjs" /* Mjs */, ".cjs" /* Cjs */, ".js" /* Js */, ".json" /* Json */, ".d.mts" /* Dmts */, ".d.cts" /* Dcts */, ".d.ts" /* Dts */];
@@ -43302,7 +43336,7 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
43302
43336
  for (const possibleExt of inputExts) {
43303
43337
  if (!extensionIsOk(extensions, possibleExt))
43304
43338
  continue;
43305
- const possibleInputWithInputExtension = changeAnyExtension(possibleInputBase, possibleExt, ext, !useCaseSensitiveFileNames());
43339
+ const possibleInputWithInputExtension = changeAnyExtension(possibleInputBase, possibleExt, ext, !useCaseSensitiveFileNames(state));
43306
43340
  if (state.host.fileExists(possibleInputWithInputExtension)) {
43307
43341
  return toSearchResult(withPackageId(scope, loadFileNameFromPackageJsonField(
43308
43342
  extensions,
@@ -43719,6 +43753,9 @@ function traceIfEnabled(state, diagnostic, ...args) {
43719
43753
  trace(state.host, diagnostic, ...args);
43720
43754
  }
43721
43755
  }
43756
+ function useCaseSensitiveFileNames(state) {
43757
+ return !state.host.useCaseSensitiveFileNames ? true : typeof state.host.useCaseSensitiveFileNames === "boolean" ? state.host.useCaseSensitiveFileNames : state.host.useCaseSensitiveFileNames();
43758
+ }
43722
43759
 
43723
43760
  // src/compiler/binder.ts
43724
43761
  var ModuleInstanceState = /* @__PURE__ */ ((ModuleInstanceState2) => {
@@ -47202,7 +47239,9 @@ function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, hos
47202
47239
  for (const { ending, value } of candidates) {
47203
47240
  if (value.length >= prefix.length + suffix.length && startsWith(value, prefix) && endsWith(value, suffix) && validateEnding({ ending, value })) {
47204
47241
  const matchedStar = value.substring(prefix.length, value.length - suffix.length);
47205
- return pathIsRelative(matchedStar) ? void 0 : key.replace("*", matchedStar);
47242
+ if (!pathIsRelative(matchedStar)) {
47243
+ return key.replace("*", matchedStar);
47244
+ }
47206
47245
  }
47207
47246
  }
47208
47247
  } else if (some(candidates, (c) => c.ending !== 0 /* Minimal */ && pattern === c.value) || some(candidates, (c) => c.ending === 0 /* Minimal */ && pattern === c.value && validateEnding(c))) {
@@ -47274,7 +47313,7 @@ function tryGetModuleNameFromExports(options, targetFilePath, packageDirectory,
47274
47313
  for (const key of getOwnKeys(exports)) {
47275
47314
  if (key === "default" || conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(conditions, key)) {
47276
47315
  const subTarget = exports[key];
47277
- const result = tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, subTarget, conditions);
47316
+ const result = tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode);
47278
47317
  if (result) {
47279
47318
  return result;
47280
47319
  }
@@ -48431,7 +48470,7 @@ function createTypeChecker(host) {
48431
48470
  };
48432
48471
  var amalgamatedDuplicates;
48433
48472
  var reverseMappedCache = /* @__PURE__ */ new Map();
48434
- var inInferTypeForHomomorphicMappedType = false;
48473
+ var homomorphicMappedTypeInferenceStack = [];
48435
48474
  var ambientModulesCache;
48436
48475
  var patternAmbientModules;
48437
48476
  var patternAmbientModuleAugmentations;
@@ -53022,6 +53061,7 @@ function createTypeChecker(host) {
53022
53061
  );
53023
53062
  }
53024
53063
  function signatureToSignatureDeclarationHelper(signature, kind, context, options) {
53064
+ var _a;
53025
53065
  const suppressAny = context.flags & 256 /* SuppressAnyReturnType */;
53026
53066
  if (suppressAny)
53027
53067
  context.flags &= ~256 /* SuppressAnyReturnType */;
@@ -53157,6 +53197,20 @@ function createTypeChecker(host) {
53157
53197
  if (typeArguments) {
53158
53198
  node.typeArguments = factory.createNodeArray(typeArguments);
53159
53199
  }
53200
+ if (((_a = signature.declaration) == null ? void 0 : _a.kind) === 330 /* JSDocSignature */ && signature.declaration.parent.kind === 346 /* JSDocOverloadTag */) {
53201
+ const comment = getTextOfNode(
53202
+ signature.declaration.parent.parent,
53203
+ /*includeTrivia*/
53204
+ true
53205
+ ).slice(2, -2).split(/\r\n|\n|\r/).map((line) => line.replace(/^\s+/, " ")).join("\n");
53206
+ addSyntheticLeadingComment(
53207
+ node,
53208
+ 3 /* MultiLineCommentTrivia */,
53209
+ comment,
53210
+ /*hasTrailingNewLine*/
53211
+ true
53212
+ );
53213
+ }
53160
53214
  cleanup == null ? void 0 : cleanup();
53161
53215
  return node;
53162
53216
  }
@@ -59934,7 +59988,7 @@ function createTypeChecker(host) {
59934
59988
  return ((_a = type.target.localTypeParameters) == null ? void 0 : _a.map(() => errorType)) || emptyArray;
59935
59989
  }
59936
59990
  const node = type.node;
59937
- const typeArguments = !node ? emptyArray : node.kind === 183 /* TypeReference */ ? concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments2(node, type.target.localTypeParameters)) : node.kind === 188 /* ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : map(node.elements, (element) => removeMissingType(getTypeFromTypeNode(element), element.kind === 190 /* OptionalType */));
59991
+ const typeArguments = !node ? emptyArray : node.kind === 183 /* TypeReference */ ? concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments2(node, type.target.localTypeParameters)) : node.kind === 188 /* ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : map(node.elements, getTypeFromTypeNode);
59938
59992
  if (popTypeResolution()) {
59939
59993
  type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments;
59940
59994
  } else {
@@ -67820,17 +67874,18 @@ function createTypeChecker(host) {
67820
67874
  );
67821
67875
  }
67822
67876
  function inferTypeForHomomorphicMappedType(source, target, constraint) {
67823
- if (inInferTypeForHomomorphicMappedType) {
67824
- return void 0;
67877
+ const cacheKey = source.id + "," + target.id + "," + constraint.id;
67878
+ if (reverseMappedCache.has(cacheKey)) {
67879
+ return reverseMappedCache.get(cacheKey);
67825
67880
  }
67826
- const key = source.id + "," + target.id + "," + constraint.id;
67827
- if (reverseMappedCache.has(key)) {
67828
- return reverseMappedCache.get(key);
67881
+ const recursionKey = source.id + "," + (target.target || target).id;
67882
+ if (contains(homomorphicMappedTypeInferenceStack, recursionKey)) {
67883
+ return void 0;
67829
67884
  }
67830
- inInferTypeForHomomorphicMappedType = true;
67885
+ homomorphicMappedTypeInferenceStack.push(recursionKey);
67831
67886
  const type = createReverseMappedType(source, target, constraint);
67832
- inInferTypeForHomomorphicMappedType = false;
67833
- reverseMappedCache.set(key, type);
67887
+ homomorphicMappedTypeInferenceStack.pop();
67888
+ reverseMappedCache.set(cacheKey, type);
67834
67889
  return type;
67835
67890
  }
67836
67891
  function isPartiallyInferableType(type) {
@@ -118841,14 +118896,14 @@ function getEmitListItem(emit, parenthesizerRule) {
118841
118896
  }
118842
118897
 
118843
118898
  // src/compiler/watchUtilities.ts
118844
- function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensitiveFileNames) {
118899
+ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensitiveFileNames2) {
118845
118900
  if (!host.getDirectories || !host.readDirectory) {
118846
118901
  return void 0;
118847
118902
  }
118848
118903
  const cachedReadDirectoryResult = /* @__PURE__ */ new Map();
118849
- const getCanonicalFileName = createGetCanonicalFileName(useCaseSensitiveFileNames);
118904
+ const getCanonicalFileName = createGetCanonicalFileName(useCaseSensitiveFileNames2);
118850
118905
  return {
118851
- useCaseSensitiveFileNames,
118906
+ useCaseSensitiveFileNames: useCaseSensitiveFileNames2,
118852
118907
  fileExists,
118853
118908
  readFile: (path, encoding) => host.readFile(path, encoding),
118854
118909
  directoryExists: host.directoryExists && directoryExists,
@@ -118970,7 +119025,7 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
118970
119025
  const rootResult = tryReadDirectory2(rootDir, rootDirPath);
118971
119026
  let rootSymLinkResult;
118972
119027
  if (rootResult !== void 0) {
118973
- return matchFiles(rootDir, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries, realpath);
119028
+ return matchFiles(rootDir, extensions, excludes, includes, useCaseSensitiveFileNames2, currentDirectory, depth, getFileSystemEntries, realpath);
118974
119029
  }
118975
119030
  return host.readDirectory(rootDir, extensions, excludes, includes, depth);
118976
119031
  function getFileSystemEntries(dir) {
@@ -119171,7 +119226,7 @@ function isIgnoredFileFromWildCardWatching({
119171
119226
  program,
119172
119227
  extraFileExtensions,
119173
119228
  currentDirectory,
119174
- useCaseSensitiveFileNames,
119229
+ useCaseSensitiveFileNames: useCaseSensitiveFileNames2,
119175
119230
  writeLog,
119176
119231
  toPath: toPath3
119177
119232
  }) {
@@ -119187,7 +119242,7 @@ function isIgnoredFileFromWildCardWatching({
119187
119242
  writeLog(`Project: ${configFileName} Detected file add/remove of non supported extension: ${fileOrDirectory}`);
119188
119243
  return true;
119189
119244
  }
119190
- if (isExcludedFile(fileOrDirectory, options.configFile.configFileSpecs, getNormalizedAbsolutePath(getDirectoryPath(configFileName), currentDirectory), useCaseSensitiveFileNames, currentDirectory)) {
119245
+ if (isExcludedFile(fileOrDirectory, options.configFile.configFileSpecs, getNormalizedAbsolutePath(getDirectoryPath(configFileName), currentDirectory), useCaseSensitiveFileNames2, currentDirectory)) {
119191
119246
  writeLog(`Project: ${configFileName} Detected excluded file: ${fileOrDirectory}`);
119192
119247
  return true;
119193
119248
  }
@@ -119250,7 +119305,7 @@ function getWatchFactory(host, watchLogLevel, log, getDetailWatchInfo2) {
119250
119305
  function createExcludeHandlingAddWatch(key) {
119251
119306
  return (file, cb, flags, options, detailInfo1, detailInfo2) => {
119252
119307
  var _a;
119253
- return !matchesExclude(file, key === "watchFile" ? options == null ? void 0 : options.excludeFiles : options == null ? void 0 : options.excludeDirectories, useCaseSensitiveFileNames(), ((_a = host.getCurrentDirectory) == null ? void 0 : _a.call(host)) || "") ? factory2[key].call(
119308
+ return !matchesExclude(file, key === "watchFile" ? options == null ? void 0 : options.excludeFiles : options == null ? void 0 : options.excludeDirectories, useCaseSensitiveFileNames2(), ((_a = host.getCurrentDirectory) == null ? void 0 : _a.call(host)) || "") ? factory2[key].call(
119254
119309
  /*thisArgs*/
119255
119310
  void 0,
119256
119311
  file,
@@ -119262,7 +119317,7 @@ function getWatchFactory(host, watchLogLevel, log, getDetailWatchInfo2) {
119262
119317
  ) : excludeWatcherFactory(file, flags, options, detailInfo1, detailInfo2);
119263
119318
  };
119264
119319
  }
119265
- function useCaseSensitiveFileNames() {
119320
+ function useCaseSensitiveFileNames2() {
119266
119321
  return typeof host.useCaseSensitiveFileNames === "boolean" ? host.useCaseSensitiveFileNames : host.useCaseSensitiveFileNames();
119267
119322
  }
119268
119323
  function createExcludeWatcherWithLogging(file, flags, options, detailInfo1, detailInfo2) {
@@ -121385,6 +121440,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
121385
121440
  case 265 /* TypeAliasDeclaration */:
121386
121441
  diagnostics.push(createDiagnosticForNode2(node, Diagnostics.Type_aliases_can_only_be_used_in_TypeScript_files));
121387
121442
  return "skip";
121443
+ case 176 /* Constructor */:
121444
+ case 174 /* MethodDeclaration */:
121445
+ case 262 /* FunctionDeclaration */:
121446
+ if (!node.body) {
121447
+ diagnostics.push(createDiagnosticForNode2(node, Diagnostics.Signature_declarations_can_only_be_used_in_TypeScript_files));
121448
+ return "skip";
121449
+ }
121450
+ return;
121388
121451
  case 266 /* EnumDeclaration */:
121389
121452
  const enumKeyword = Debug.checkDefined(tokenToString(94 /* EnumKeyword */));
121390
121453
  diagnostics.push(createDiagnosticForNode2(node, Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, enumKeyword));
@@ -123300,6 +123363,9 @@ function parseConfigHostFromCompilerHostLike(host, directoryStructureHost = host
123300
123363
  return directoryStructureHost.readDirectory(root, extensions, excludes, includes, depth);
123301
123364
  },
123302
123365
  readFile: (f) => directoryStructureHost.readFile(f),
123366
+ directoryExists: maybeBind(directoryStructureHost, directoryStructureHost.directoryExists),
123367
+ getDirectories: maybeBind(directoryStructureHost, directoryStructureHost.getDirectories),
123368
+ realpath: maybeBind(directoryStructureHost, directoryStructureHost.realpath),
123303
123369
  useCaseSensitiveFileNames: host.useCaseSensitiveFileNames(),
123304
123370
  getCurrentDirectory: () => host.getCurrentDirectory(),
123305
123371
  onUnRecoverableConfigFileDiagnostic: host.onUnRecoverableConfigFileDiagnostic || returnUndefined,
@@ -126339,12 +126405,12 @@ function getMatchedIncludeSpec(program, fileName) {
126339
126405
  return true;
126340
126406
  const isJsonFile = fileExtensionIs(fileName, ".json" /* Json */);
126341
126407
  const basePath = getDirectoryPath(getNormalizedAbsolutePath(configFile.fileName, program.getCurrentDirectory()));
126342
- const useCaseSensitiveFileNames = program.useCaseSensitiveFileNames();
126408
+ const useCaseSensitiveFileNames2 = program.useCaseSensitiveFileNames();
126343
126409
  return find((_b = configFile == null ? void 0 : configFile.configFileSpecs) == null ? void 0 : _b.validatedIncludeSpecs, (includeSpec) => {
126344
126410
  if (isJsonFile && !endsWith(includeSpec, ".json" /* Json */))
126345
126411
  return false;
126346
126412
  const pattern = getPatternFromSpec(includeSpec, basePath, "files");
126347
- return !!pattern && getRegexFromPattern(`(${pattern})$`, useCaseSensitiveFileNames).test(fileName);
126413
+ return !!pattern && getRegexFromPattern(`(${pattern})$`, useCaseSensitiveFileNames2).test(fileName);
126348
126414
  });
126349
126415
  }
126350
126416
  function fileIncludeReasonToDiagnostics(program, reason, fileNameConvertor) {
@@ -126573,7 +126639,7 @@ function createWatchFactory(host, options) {
126573
126639
  return result;
126574
126640
  }
126575
126641
  function createCompilerHostFromProgramHost(host, getCompilerOptions, directoryStructureHost = host) {
126576
- const useCaseSensitiveFileNames = host.useCaseSensitiveFileNames();
126642
+ const useCaseSensitiveFileNames2 = host.useCaseSensitiveFileNames();
126577
126643
  const compilerHost = {
126578
126644
  getSourceFile: createGetSourceFile(
126579
126645
  (fileName, encoding) => !encoding ? compilerHost.readFile(fileName) : host.readFile(fileName, encoding),
@@ -126589,8 +126655,8 @@ function createCompilerHostFromProgramHost(host, getCompilerOptions, directorySt
126589
126655
  (path) => host.directoryExists(path)
126590
126656
  ),
126591
126657
  getCurrentDirectory: memoize(() => host.getCurrentDirectory()),
126592
- useCaseSensitiveFileNames: () => useCaseSensitiveFileNames,
126593
- getCanonicalFileName: createGetCanonicalFileName(useCaseSensitiveFileNames),
126658
+ useCaseSensitiveFileNames: () => useCaseSensitiveFileNames2,
126659
+ getCanonicalFileName: createGetCanonicalFileName(useCaseSensitiveFileNames2),
126594
126660
  getNewLine: () => getNewLineCharacter(getCompilerOptions()),
126595
126661
  fileExists: (f) => host.fileExists(f),
126596
126662
  readFile: (f) => host.readFile(f),
@@ -126830,7 +126896,7 @@ function createWatchProgram(host) {
126830
126896
  const sourceFilesCache = /* @__PURE__ */ new Map();
126831
126897
  let missingFilePathsRequestedForRelease;
126832
126898
  let hasChangedCompilerOptions = false;
126833
- const useCaseSensitiveFileNames = host.useCaseSensitiveFileNames();
126899
+ const useCaseSensitiveFileNames2 = host.useCaseSensitiveFileNames();
126834
126900
  const currentDirectory = host.getCurrentDirectory();
126835
126901
  const { configFileName, optionsToExtend: optionsToExtendForConfigFile = {}, watchOptionsToExtend, extraFileExtensions, createProgram: createProgram2 } = host;
126836
126902
  let { rootFiles: rootFileNames, options: compilerOptions, watchOptions, projectReferences } = host;
@@ -126838,7 +126904,7 @@ function createWatchProgram(host) {
126838
126904
  let configFileParsingDiagnostics;
126839
126905
  let canConfigFileJsonReportNoInputFiles = false;
126840
126906
  let hasChangedConfigFileParsingErrors = false;
126841
- const cachedDirectoryStructureHost = configFileName === void 0 ? void 0 : createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensitiveFileNames);
126907
+ const cachedDirectoryStructureHost = configFileName === void 0 ? void 0 : createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensitiveFileNames2);
126842
126908
  const directoryStructureHost = cachedDirectoryStructureHost || host;
126843
126909
  const parseConfigFileHost = parseConfigHostFromCompilerHostLike(host, directoryStructureHost);
126844
126910
  let newLine = updateNewLine();
@@ -126856,8 +126922,8 @@ function createWatchProgram(host) {
126856
126922
  Debug.assert(compilerOptions);
126857
126923
  Debug.assert(rootFileNames);
126858
126924
  const { watchFile: watchFile2, watchDirectory, writeLog } = createWatchFactory(host, compilerOptions);
126859
- const getCanonicalFileName = createGetCanonicalFileName(useCaseSensitiveFileNames);
126860
- writeLog(`Current directory: ${currentDirectory} CaseSensitiveFileNames: ${useCaseSensitiveFileNames}`);
126925
+ const getCanonicalFileName = createGetCanonicalFileName(useCaseSensitiveFileNames2);
126926
+ writeLog(`Current directory: ${currentDirectory} CaseSensitiveFileNames: ${useCaseSensitiveFileNames2}`);
126861
126927
  let configFileWatcher;
126862
126928
  if (configFileName) {
126863
126929
  configFileWatcher = watchFile2(configFileName, scheduleProgramReload, 2e3 /* High */, watchOptions, WatchType.ConfigFile);
@@ -127363,7 +127429,7 @@ function createWatchProgram(host) {
127363
127429
  options: compilerOptions,
127364
127430
  program: getCurrentBuilderProgram() || rootFileNames,
127365
127431
  currentDirectory,
127366
- useCaseSensitiveFileNames,
127432
+ useCaseSensitiveFileNames: useCaseSensitiveFileNames2,
127367
127433
  writeLog,
127368
127434
  toPath: toPath3
127369
127435
  }))
@@ -127453,7 +127519,7 @@ function createWatchProgram(host) {
127453
127519
  options: config.parsedCommandLine.options,
127454
127520
  program: config.parsedCommandLine.fileNames,
127455
127521
  currentDirectory,
127456
- useCaseSensitiveFileNames,
127522
+ useCaseSensitiveFileNames: useCaseSensitiveFileNames2,
127457
127523
  writeLog,
127458
127524
  toPath: toPath3
127459
127525
  }))
@@ -133205,10 +133271,10 @@ function isImportablePath(fromPath, toPath3, getCanonicalFileName, globalCachePa
133205
133271
  }
133206
133272
  function forEachExternalModuleToImportFrom(program, host, preferences, useAutoImportProvider, cb) {
133207
133273
  var _a, _b;
133208
- const useCaseSensitiveFileNames = hostUsesCaseSensitiveFileNames(host);
133274
+ const useCaseSensitiveFileNames2 = hostUsesCaseSensitiveFileNames(host);
133209
133275
  const excludePatterns = preferences.autoImportFileExcludePatterns && mapDefined(preferences.autoImportFileExcludePatterns, (spec) => {
133210
133276
  const pattern = getPatternFromSpec(spec, "", "exclude");
133211
- return pattern ? getRegexFromPattern(pattern, useCaseSensitiveFileNames) : void 0;
133277
+ return pattern ? getRegexFromPattern(pattern, useCaseSensitiveFileNames2) : void 0;
133212
133278
  });
133213
133279
  forEachExternalModule(program.getTypeChecker(), program.getSourceFiles(), excludePatterns, (module2, file) => cb(
133214
133280
  module2,
@@ -134670,12 +134736,12 @@ var DocumentHighlights;
134670
134736
  function isDocumentRegistryEntry(entry) {
134671
134737
  return !!entry.sourceFile;
134672
134738
  }
134673
- function createDocumentRegistry(useCaseSensitiveFileNames, currentDirectory) {
134674
- return createDocumentRegistryInternal(useCaseSensitiveFileNames, currentDirectory);
134739
+ function createDocumentRegistry(useCaseSensitiveFileNames2, currentDirectory) {
134740
+ return createDocumentRegistryInternal(useCaseSensitiveFileNames2, currentDirectory);
134675
134741
  }
134676
- function createDocumentRegistryInternal(useCaseSensitiveFileNames, currentDirectory = "", externalCache) {
134742
+ function createDocumentRegistryInternal(useCaseSensitiveFileNames2, currentDirectory = "", externalCache) {
134677
134743
  const buckets = /* @__PURE__ */ new Map();
134678
- const getCanonicalFileName = createGetCanonicalFileName(!!useCaseSensitiveFileNames);
134744
+ const getCanonicalFileName = createGetCanonicalFileName(!!useCaseSensitiveFileNames2);
134679
134745
  function reportStats() {
134680
134746
  const bucketInfoArray = arrayFrom(buckets.keys()).filter((name) => name && name.charAt(0) === "_").map((name) => {
134681
134747
  const entries = buckets.get(name);
@@ -134878,12 +134944,12 @@ function getDocumentRegistryBucketKeyWithMode(key, mode) {
134878
134944
 
134879
134945
  // src/services/getEditsForFileRename.ts
134880
134946
  function getEditsForFileRename(program, oldFileOrDirPath, newFileOrDirPath, host, formatContext, preferences, sourceMapper) {
134881
- const useCaseSensitiveFileNames = hostUsesCaseSensitiveFileNames(host);
134882
- const getCanonicalFileName = createGetCanonicalFileName(useCaseSensitiveFileNames);
134947
+ const useCaseSensitiveFileNames2 = hostUsesCaseSensitiveFileNames(host);
134948
+ const getCanonicalFileName = createGetCanonicalFileName(useCaseSensitiveFileNames2);
134883
134949
  const oldToNew = getPathUpdater(oldFileOrDirPath, newFileOrDirPath, getCanonicalFileName, sourceMapper);
134884
134950
  const newToOld = getPathUpdater(newFileOrDirPath, oldFileOrDirPath, getCanonicalFileName, sourceMapper);
134885
134951
  return ts_textChanges_exports.ChangeTracker.with({ host, formatContext, preferences }, (changeTracker) => {
134886
- updateTsconfigFiles(program, changeTracker, oldToNew, oldFileOrDirPath, newFileOrDirPath, host.getCurrentDirectory(), useCaseSensitiveFileNames);
134952
+ updateTsconfigFiles(program, changeTracker, oldToNew, oldFileOrDirPath, newFileOrDirPath, host.getCurrentDirectory(), useCaseSensitiveFileNames2);
134887
134953
  updateImports(program, changeTracker, oldToNew, newToOld, host, getCanonicalFileName);
134888
134954
  });
134889
134955
  }
@@ -134905,7 +134971,7 @@ function makeCorrespondingRelativeChange(a0, b0, a1, getCanonicalFileName) {
134905
134971
  const rel = getRelativePathFromFile(a0, b0, getCanonicalFileName);
134906
134972
  return combinePathsSafe(getDirectoryPath(a1), rel);
134907
134973
  }
134908
- function updateTsconfigFiles(program, changeTracker, oldToNew, oldFileOrDirPath, newFileOrDirPath, currentDirectory, useCaseSensitiveFileNames) {
134974
+ function updateTsconfigFiles(program, changeTracker, oldToNew, oldFileOrDirPath, newFileOrDirPath, currentDirectory, useCaseSensitiveFileNames2) {
134909
134975
  const { configFile } = program.getCompilerOptions();
134910
134976
  if (!configFile)
134911
134977
  return;
@@ -134929,10 +134995,10 @@ function updateTsconfigFiles(program, changeTracker, oldToNew, oldFileOrDirPath,
134929
134995
  /*excludes*/
134930
134996
  [],
134931
134997
  includes,
134932
- useCaseSensitiveFileNames,
134998
+ useCaseSensitiveFileNames2,
134933
134999
  currentDirectory
134934
135000
  );
134935
- if (getRegexFromPattern(Debug.checkDefined(matchers.includeFilePattern), useCaseSensitiveFileNames).test(oldFileOrDirPath) && !getRegexFromPattern(Debug.checkDefined(matchers.includeFilePattern), useCaseSensitiveFileNames).test(newFileOrDirPath)) {
135001
+ if (getRegexFromPattern(Debug.checkDefined(matchers.includeFilePattern), useCaseSensitiveFileNames2).test(oldFileOrDirPath) && !getRegexFromPattern(Debug.checkDefined(matchers.includeFilePattern), useCaseSensitiveFileNames2).test(newFileOrDirPath)) {
134936
135002
  changeTracker.insertNodeAfter(configFile, last(property.initializer.elements), factory.createStringLiteral(relativePath(newFileOrDirPath)));
134937
135003
  }
134938
135004
  return;
@@ -134980,7 +135046,7 @@ function updateTsconfigFiles(program, changeTracker, oldToNew, oldFileOrDirPath,
134980
135046
  configDir,
134981
135047
  path,
134982
135048
  /*ignoreCase*/
134983
- !useCaseSensitiveFileNames
135049
+ !useCaseSensitiveFileNames2
134984
135050
  );
134985
135051
  }
134986
135052
  }
@@ -138260,7 +138326,7 @@ function getNewStatementsAndRemoveFromOldFile2(oldFile, targetFile, usage, chang
138260
138326
  const body = addExports(oldFile, toMove.all, usage.oldFileImportsFromTargetFile, useEsModuleSyntax);
138261
138327
  if (typeof targetFile !== "string") {
138262
138328
  if (targetFile.statements.length > 0) {
138263
- changes.insertNodesAfter(targetFile, targetFile.statements[targetFile.statements.length - 1], body);
138329
+ moveStatementsToTargetFile(changes, program, body, targetFile, toMove);
138264
138330
  } else {
138265
138331
  changes.insertNodesAtEndOfFile(
138266
138332
  targetFile,
@@ -139053,6 +139119,67 @@ function isNonVariableTopLevelDeclaration(node) {
139053
139119
  return false;
139054
139120
  }
139055
139121
  }
139122
+ function moveStatementsToTargetFile(changes, program, statements, targetFile, toMove) {
139123
+ var _a;
139124
+ const removedExports = /* @__PURE__ */ new Set();
139125
+ const targetExports = (_a = targetFile.symbol) == null ? void 0 : _a.exports;
139126
+ if (targetExports) {
139127
+ const checker = program.getTypeChecker();
139128
+ const targetToSourceExports = /* @__PURE__ */ new Map();
139129
+ for (const node of toMove.all) {
139130
+ if (isTopLevelDeclarationStatement(node) && hasSyntacticModifier(node, 1 /* Export */)) {
139131
+ forEachTopLevelDeclaration(node, (declaration) => {
139132
+ var _a2;
139133
+ const targetDeclarations = canHaveSymbol(declaration) ? (_a2 = targetExports.get(declaration.symbol.escapedName)) == null ? void 0 : _a2.declarations : void 0;
139134
+ const exportDeclaration = firstDefined(targetDeclarations, (d) => isExportDeclaration(d) ? d : isExportSpecifier(d) ? tryCast(d.parent.parent, isExportDeclaration) : void 0);
139135
+ if (exportDeclaration && exportDeclaration.moduleSpecifier) {
139136
+ targetToSourceExports.set(
139137
+ exportDeclaration,
139138
+ (targetToSourceExports.get(exportDeclaration) || /* @__PURE__ */ new Set()).add(declaration)
139139
+ );
139140
+ }
139141
+ });
139142
+ }
139143
+ }
139144
+ for (const [exportDeclaration, topLevelDeclarations] of arrayFrom(targetToSourceExports)) {
139145
+ if (exportDeclaration.exportClause && isNamedExports(exportDeclaration.exportClause) && length(exportDeclaration.exportClause.elements)) {
139146
+ const elements = exportDeclaration.exportClause.elements;
139147
+ const updatedElements = filter(elements, (elem) => find(skipAlias(elem.symbol, checker).declarations, (d) => isTopLevelDeclaration(d) && topLevelDeclarations.has(d)) === void 0);
139148
+ if (length(updatedElements) === 0) {
139149
+ changes.deleteNode(targetFile, exportDeclaration);
139150
+ removedExports.add(exportDeclaration);
139151
+ continue;
139152
+ }
139153
+ if (length(updatedElements) < length(elements)) {
139154
+ changes.replaceNode(
139155
+ targetFile,
139156
+ exportDeclaration,
139157
+ factory.updateExportDeclaration(
139158
+ exportDeclaration,
139159
+ exportDeclaration.modifiers,
139160
+ exportDeclaration.isTypeOnly,
139161
+ factory.updateNamedExports(exportDeclaration.exportClause, factory.createNodeArray(updatedElements, elements.hasTrailingComma)),
139162
+ exportDeclaration.moduleSpecifier,
139163
+ exportDeclaration.assertClause
139164
+ )
139165
+ );
139166
+ }
139167
+ }
139168
+ }
139169
+ }
139170
+ const lastReExport = findLast(targetFile.statements, (n) => isExportDeclaration(n) && !!n.moduleSpecifier && !removedExports.has(n));
139171
+ if (lastReExport) {
139172
+ changes.insertNodesBefore(
139173
+ targetFile,
139174
+ lastReExport,
139175
+ statements,
139176
+ /*blankLineBetween*/
139177
+ true
139178
+ );
139179
+ } else {
139180
+ changes.insertNodesAfter(targetFile, targetFile.statements[targetFile.statements.length - 1], statements);
139181
+ }
139182
+ }
139056
139183
  function getOverloadRangeToMove(sourceFile, statement) {
139057
139184
  if (isFunctionLikeDeclaration(statement)) {
139058
139185
  const declarations = statement.symbol.declarations;
@@ -143518,10 +143645,10 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
143518
143645
  host.log(message);
143519
143646
  }
143520
143647
  }
143521
- const useCaseSensitiveFileNames = hostUsesCaseSensitiveFileNames(host);
143522
- const getCanonicalFileName = createGetCanonicalFileName(useCaseSensitiveFileNames);
143648
+ const useCaseSensitiveFileNames2 = hostUsesCaseSensitiveFileNames(host);
143649
+ const getCanonicalFileName = createGetCanonicalFileName(useCaseSensitiveFileNames2);
143523
143650
  const sourceMapper = getSourceMapper({
143524
- useCaseSensitiveFileNames: () => useCaseSensitiveFileNames,
143651
+ useCaseSensitiveFileNames: () => useCaseSensitiveFileNames2,
143525
143652
  getCurrentDirectory: () => currentDirectory,
143526
143653
  getProgram,
143527
143654
  fileExists: maybeBind(host, host.fileExists),
@@ -143569,7 +143696,7 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
143569
143696
  getSourceFileByPath: getOrCreateSourceFileByPath,
143570
143697
  getCancellationToken: () => cancellationToken,
143571
143698
  getCanonicalFileName,
143572
- useCaseSensitiveFileNames: () => useCaseSensitiveFileNames,
143699
+ useCaseSensitiveFileNames: () => useCaseSensitiveFileNames2,
143573
143700
  getNewLine: () => getNewLineCharacter(newSettings),
143574
143701
  getDefaultLibFileName: (options2) => host.getDefaultLibFileName(options2),
143575
143702
  writeFile: noop,
@@ -143613,9 +143740,12 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
143613
143740
  compilerHost.getSourceFile = getSourceFileWithCache;
143614
143741
  (_c = host.setCompilerHost) == null ? void 0 : _c.call(host, compilerHost);
143615
143742
  const parseConfigHost = {
143616
- useCaseSensitiveFileNames,
143743
+ useCaseSensitiveFileNames: useCaseSensitiveFileNames2,
143617
143744
  fileExists: (fileName) => compilerHost.fileExists(fileName),
143618
143745
  readFile: (fileName) => compilerHost.readFile(fileName),
143746
+ directoryExists: (f) => compilerHost.directoryExists(f),
143747
+ getDirectories: (f) => compilerHost.getDirectories(f),
143748
+ realpath: compilerHost.realpath,
143619
143749
  readDirectory: (...args) => compilerHost.readDirectory(...args),
143620
143750
  trace: compilerHost.trace,
143621
143751
  getCurrentDirectory: compilerHost.getCurrentDirectory,
@@ -157667,6 +157797,13 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
157667
157797
  data = originToCompletionEntryData(origin);
157668
157798
  hasAction = !importStatementCompletion;
157669
157799
  }
157800
+ const parentNamedImportOrExport = findAncestor(location, isNamedImportsOrExports);
157801
+ if ((parentNamedImportOrExport == null ? void 0 : parentNamedImportOrExport.kind) === 275 /* NamedImports */) {
157802
+ const possibleToken = stringToToken(name);
157803
+ if (parentNamedImportOrExport && possibleToken && (possibleToken === 135 /* AwaitKeyword */ || isNonContextualKeyword(possibleToken))) {
157804
+ insertText = `${name} as ${name}_`;
157805
+ }
157806
+ }
157670
157807
  return {
157671
157808
  name,
157672
157809
  kind: ts_SymbolDisplay_exports.getSymbolKind(typeChecker, symbol, location),
@@ -158447,7 +158584,7 @@ function createCompletionDetails(name, kindModifiers, kind, displayParts, docume
158447
158584
  }
158448
158585
  function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source, cancellationToken) {
158449
158586
  if (data == null ? void 0 : data.moduleSpecifier) {
158450
- if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).replacementSpan) {
158587
+ if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken, sourceFile).replacementSpan) {
158451
158588
  return { codeActions: void 0, sourceDisplay: [textPart(data.moduleSpecifier)] };
158452
158589
  }
158453
158590
  }
@@ -158669,7 +158806,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
158669
158806
  let isNewIdentifierLocation = false;
158670
158807
  let flags = 0 /* None */;
158671
158808
  if (contextToken) {
158672
- const importStatementCompletionInfo = getImportStatementCompletionInfo(contextToken);
158809
+ const importStatementCompletionInfo = getImportStatementCompletionInfo(contextToken, sourceFile);
158673
158810
  if (importStatementCompletionInfo.keywordCompletion) {
158674
158811
  if (importStatementCompletionInfo.isKeywordOnlyCompletion) {
158675
158812
  return {
@@ -160313,7 +160450,7 @@ function tryGetObjectLiteralContextualType(node, typeChecker) {
160313
160450
  }
160314
160451
  return void 0;
160315
160452
  }
160316
- function getImportStatementCompletionInfo(contextToken) {
160453
+ function getImportStatementCompletionInfo(contextToken, sourceFile) {
160317
160454
  var _a, _b, _c;
160318
160455
  let keywordCompletion;
160319
160456
  let isKeywordOnlyCompletion = false;
@@ -160329,6 +160466,12 @@ function getImportStatementCompletionInfo(contextToken) {
160329
160466
  function getCandidate() {
160330
160467
  const parent2 = contextToken.parent;
160331
160468
  if (isImportEqualsDeclaration(parent2)) {
160469
+ const lastToken = parent2.getLastToken(sourceFile);
160470
+ if (isIdentifier(contextToken) && lastToken !== contextToken) {
160471
+ keywordCompletion = 161 /* FromKeyword */;
160472
+ isKeywordOnlyCompletion = true;
160473
+ return void 0;
160474
+ }
160332
160475
  keywordCompletion = contextToken.kind === 156 /* TypeKeyword */ ? void 0 : 156 /* TypeKeyword */;
160333
160476
  return isModuleSpecifierMissingOrEmpty(parent2.moduleReference) ? parent2 : void 0;
160334
160477
  }
@@ -160830,7 +160973,7 @@ function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, c
160830
160973
  extensionOptions,
160831
160974
  host,
160832
160975
  /*moduleSpecifierIsRelative*/
160833
- false,
160976
+ true,
160834
160977
  scriptPath
160835
160978
  ).values());
160836
160979
  }
@@ -161162,16 +161305,18 @@ function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensio
161162
161305
  const fragmentDirectory = fragmentHasPath ? hasTrailingDirectorySeparator(fragment) ? fragment : getDirectoryPath(fragment) : void 0;
161163
161306
  const expandedPrefixDirectory = fragmentHasPath ? combinePaths(normalizedPrefixDirectory, normalizedPrefixBase + fragmentDirectory) : normalizedPrefixDirectory;
161164
161307
  const normalizedSuffix = normalizePath(parsed.suffix);
161308
+ const declarationExtension = normalizedSuffix && getDeclarationEmitExtensionForPath("_" + normalizedSuffix);
161309
+ const matchingSuffixes = declarationExtension ? [changeExtension(normalizedSuffix, declarationExtension), normalizedSuffix] : [normalizedSuffix];
161165
161310
  const baseDirectory = normalizePath(combinePaths(packageDirectory, expandedPrefixDirectory));
161166
161311
  const completePrefix = fragmentHasPath ? baseDirectory : ensureTrailingDirectorySeparator(baseDirectory) + normalizedPrefixBase;
161167
- const includeGlob = normalizedSuffix ? "**/*" + normalizedSuffix : "./*";
161312
+ const includeGlobs = normalizedSuffix ? matchingSuffixes.map((suffix) => "**/*" + suffix) : ["./*"];
161168
161313
  const matches = mapDefined(tryReadDirectory(
161169
161314
  host,
161170
161315
  baseDirectory,
161171
161316
  extensionOptions.extensionsToSearch,
161172
161317
  /*exclude*/
161173
161318
  void 0,
161174
- [includeGlob]
161319
+ includeGlobs
161175
161320
  ), (match) => {
161176
161321
  const trimmedWithPattern = trimPrefixAndSuffix(match);
161177
161322
  if (trimmedWithPattern) {
@@ -161185,8 +161330,10 @@ function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensio
161185
161330
  const directories = normalizedSuffix ? emptyArray : mapDefined(tryGetDirectories(host, baseDirectory), (dir) => dir === "node_modules" ? void 0 : directoryResult(dir));
161186
161331
  return [...matches, ...directories];
161187
161332
  function trimPrefixAndSuffix(path) {
161188
- const inner = withoutStartAndEnd(normalizePath(path), completePrefix, normalizedSuffix);
161189
- return inner === void 0 ? void 0 : removeLeadingDirectorySeparator(inner);
161333
+ return firstDefined(matchingSuffixes, (suffix) => {
161334
+ const inner = withoutStartAndEnd(normalizePath(path), completePrefix, suffix);
161335
+ return inner === void 0 ? void 0 : removeLeadingDirectorySeparator(inner);
161336
+ });
161190
161337
  }
161191
161338
  }
161192
161339
  function withoutStartAndEnd(s, start2, end) {
@@ -167906,6 +168053,9 @@ var ChangeTracker = class _ChangeTracker {
167906
168053
  insertNodeBefore(sourceFile, before, newNode, blankLineBetween = false, options = {}) {
167907
168054
  this.insertNodeAt(sourceFile, getAdjustedStartPosition(sourceFile, before, options), newNode, this.getOptionsForInsertNodeBefore(before, newNode, blankLineBetween));
167908
168055
  }
168056
+ insertNodesBefore(sourceFile, before, newNodes, blankLineBetween = false, options = {}) {
168057
+ this.insertNodesAt(sourceFile, getAdjustedStartPosition(sourceFile, before, options), newNodes, this.getOptionsForInsertNodeBefore(before, first(newNodes), blankLineBetween));
168058
+ }
167909
168059
  insertModifierAt(sourceFile, pos, modifier, options = {}) {
167910
168060
  this.insertNodeAt(sourceFile, pos, factory.createToken(modifier), options);
167911
168061
  }
@@ -177075,7 +177225,7 @@ var Project3 = class _Project {
177075
177225
  return this.projectService.includePackageJsonAutoImports();
177076
177226
  }
177077
177227
  /** @internal */
177078
- getModuleResolutionHostForAutoImportProvider() {
177228
+ getHostForAutoImportProvider() {
177079
177229
  var _a, _b;
177080
177230
  if (this.program) {
177081
177231
  return {
@@ -177086,7 +177236,8 @@ var Project3 = class _Project {
177086
177236
  readFile: this.projectService.host.readFile.bind(this.projectService.host),
177087
177237
  getDirectories: this.projectService.host.getDirectories.bind(this.projectService.host),
177088
177238
  trace: (_b = this.projectService.host.trace) == null ? void 0 : _b.bind(this.projectService.host),
177089
- useCaseSensitiveFileNames: this.program.useCaseSensitiveFileNames()
177239
+ useCaseSensitiveFileNames: this.program.useCaseSensitiveFileNames(),
177240
+ readDirectory: this.projectService.host.readDirectory.bind(this.projectService.host)
177090
177241
  };
177091
177242
  }
177092
177243
  return this.projectService.host;
@@ -177114,7 +177265,7 @@ var Project3 = class _Project {
177114
177265
  if (dependencySelection) {
177115
177266
  (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Session, "getPackageJsonAutoImportProvider");
177116
177267
  const start2 = timestamp();
177117
- this.autoImportProviderHost = AutoImportProviderProject.create(dependencySelection, this, this.getModuleResolutionHostForAutoImportProvider(), this.documentRegistry);
177268
+ this.autoImportProviderHost = AutoImportProviderProject.create(dependencySelection, this, this.getHostForAutoImportProvider(), this.documentRegistry);
177118
177269
  if (this.autoImportProviderHost) {
177119
177270
  updateProjectIfDirty(this.autoImportProviderHost);
177120
177271
  this.sendPerformanceEvent("CreatePackageJsonAutoImportProvider", timestamp() - start2);
@@ -177352,7 +177503,7 @@ var _AutoImportProviderProject = class _AutoImportProviderProject extends Projec
177352
177503
  this.getParsedCommandLine = maybeBind(this.hostProject, this.hostProject.getParsedCommandLine);
177353
177504
  }
177354
177505
  /** @internal */
177355
- static getRootFileNames(dependencySelection, hostProject, moduleResolutionHost, compilerOptions) {
177506
+ static getRootFileNames(dependencySelection, hostProject, host, compilerOptions) {
177356
177507
  var _a, _b;
177357
177508
  if (!dependencySelection) {
177358
177509
  return emptyArray;
@@ -177382,7 +177533,7 @@ var _AutoImportProviderProject = class _AutoImportProviderProject extends Projec
177382
177533
  name,
177383
177534
  hostProject.currentDirectory,
177384
177535
  compilerOptions,
177385
- moduleResolutionHost,
177536
+ host,
177386
177537
  program.getModuleResolutionCache()
177387
177538
  );
177388
177539
  if (packageJson) {
@@ -177399,7 +177550,7 @@ var _AutoImportProviderProject = class _AutoImportProviderProject extends Projec
177399
177550
  `@types/${name}`,
177400
177551
  directory,
177401
177552
  compilerOptions,
177402
- moduleResolutionHost,
177553
+ host,
177403
177554
  program.getModuleResolutionCache()
177404
177555
  );
177405
177556
  if (typesPackageJson) {
@@ -177439,12 +177590,12 @@ var _AutoImportProviderProject = class _AutoImportProviderProject extends Projec
177439
177590
  const entrypoints = getEntrypointsFromPackageJsonInfo(
177440
177591
  packageJson,
177441
177592
  compilerOptions,
177442
- moduleResolutionHost,
177593
+ host,
177443
177594
  program2.getModuleResolutionCache(),
177444
177595
  resolveJs
177445
177596
  );
177446
177597
  if (entrypoints) {
177447
- const real = (_a2 = moduleResolutionHost.realpath) == null ? void 0 : _a2.call(moduleResolutionHost, packageJson.packageDirectory);
177598
+ const real = (_a2 = host.realpath) == null ? void 0 : _a2.call(host, packageJson.packageDirectory);
177448
177599
  const isSymlink = real && real !== packageJson.packageDirectory;
177449
177600
  if (isSymlink) {
177450
177601
  symlinkCache.setSymlinkedDirectory(packageJson.packageDirectory, {
@@ -177462,7 +177613,7 @@ var _AutoImportProviderProject = class _AutoImportProviderProject extends Projec
177462
177613
  }
177463
177614
  }
177464
177615
  /** @internal */
177465
- static create(dependencySelection, hostProject, moduleResolutionHost, documentRegistry) {
177616
+ static create(dependencySelection, hostProject, host, documentRegistry) {
177466
177617
  if (dependencySelection === 0 /* Off */) {
177467
177618
  return void 0;
177468
177619
  }
@@ -177470,7 +177621,7 @@ var _AutoImportProviderProject = class _AutoImportProviderProject extends Projec
177470
177621
  ...hostProject.getCompilerOptions(),
177471
177622
  ...this.compilerOptionsOverrides
177472
177623
  };
177473
- const rootNames = this.getRootFileNames(dependencySelection, hostProject, moduleResolutionHost, compilerOptions);
177624
+ const rootNames = this.getRootFileNames(dependencySelection, hostProject, host, compilerOptions);
177474
177625
  if (!rootNames.length) {
177475
177626
  return void 0;
177476
177627
  }
@@ -177489,7 +177640,7 @@ var _AutoImportProviderProject = class _AutoImportProviderProject extends Projec
177489
177640
  rootFileNames = _AutoImportProviderProject.getRootFileNames(
177490
177641
  this.hostProject.includePackageJsonAutoImports(),
177491
177642
  this.hostProject,
177492
- this.hostProject.getModuleResolutionHostForAutoImportProvider(),
177643
+ this.hostProject.getHostForAutoImportProvider(),
177493
177644
  this.getCompilationSettings()
177494
177645
  );
177495
177646
  }
@@ -177528,7 +177679,7 @@ var _AutoImportProviderProject = class _AutoImportProviderProject extends Projec
177528
177679
  onPackageJsonChange() {
177529
177680
  throw new Error("package.json changes should be notified on an AutoImportProvider's host project");
177530
177681
  }
177531
- getModuleResolutionHostForAutoImportProvider() {
177682
+ getHostForAutoImportProvider() {
177532
177683
  throw new Error("AutoImportProviderProject cannot provide its own host; use `hostProject.getModuleResolutionHostForAutomImportProvider()` instead.");
177533
177684
  }
177534
177685
  getProjectReferences() {