typescript 5.6.0-dev.20240809 → 5.6.0-dev.20240810

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.6";
21
- var version = `${versionMajorMinor}.0-dev.20240809`;
21
+ var version = `${versionMajorMinor}.0-dev.20240810`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -5527,6 +5527,13 @@ function changeAnyExtension(path, ext, extensions, ignoreCase) {
5527
5527
  const pathext = extensions !== void 0 && ignoreCase !== void 0 ? getAnyExtensionFromPath(path, extensions, ignoreCase) : getAnyExtensionFromPath(path);
5528
5528
  return pathext ? path.slice(0, path.length - pathext.length) + (startsWith(ext, ".") ? ext : "." + ext) : path;
5529
5529
  }
5530
+ function changeFullExtension(path, newExtension) {
5531
+ const declarationExtension = getDeclarationFileExtension(path);
5532
+ if (declarationExtension) {
5533
+ return path.slice(0, path.length - declarationExtension.length) + (startsWith(newExtension, ".") ? newExtension : "." + newExtension);
5534
+ }
5535
+ return changeAnyExtension(path, newExtension);
5536
+ }
5530
5537
  var relativePathSegmentRegExp = /(?:\/\/)|(?:^|\/)\.\.?(?:$|\/)/;
5531
5538
  function comparePathsWorker(a, b, componentComparer) {
5532
5539
  if (a === b) return 0 /* EqualTo */;
@@ -18255,6 +18262,9 @@ function hasJSFileExtension(fileName) {
18255
18262
  function hasTSFileExtension(fileName) {
18256
18263
  return some(supportedTSExtensionsFlat, (extension) => fileExtensionIs(fileName, extension));
18257
18264
  }
18265
+ function hasImplementationTSFileExtension(fileName) {
18266
+ return some(supportedTSImplementationExtensions, (extension) => fileExtensionIs(fileName, extension)) && !isDeclarationFileName(fileName);
18267
+ }
18258
18268
  function usesExtensionsOnImports({ imports }, hasExtension2 = or(hasJSFileExtension, hasTSFileExtension)) {
18259
18269
  return firstDefined(imports, ({ text }) => pathIsRelative(text) && !fileExtensionIsOneOf(text, extensionsNotSupportingExtensionlessResolution) ? hasExtension2(text) : void 0) || false;
18260
18270
  }
@@ -44343,9 +44353,32 @@ function createGetSymbolWalker(getRestTypeOfSignature, getTypePredicateOfSignatu
44343
44353
  }
44344
44354
 
44345
44355
  // src/compiler/moduleSpecifiers.ts
44346
- function getModuleSpecifierPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding }, host, compilerOptions, importingSourceFile, oldImportSpecifier) {
44356
+ var stringToRegex = memoizeOne((pattern) => {
44357
+ try {
44358
+ let slash = pattern.indexOf("/");
44359
+ if (slash !== 0) {
44360
+ return new RegExp(pattern);
44361
+ }
44362
+ const lastSlash = pattern.lastIndexOf("/");
44363
+ if (slash === lastSlash) {
44364
+ return new RegExp(pattern);
44365
+ }
44366
+ while ((slash = pattern.indexOf("/", slash + 1)) !== lastSlash) {
44367
+ if (pattern[slash - 1] !== "\\") {
44368
+ return new RegExp(pattern);
44369
+ }
44370
+ }
44371
+ const flags = pattern.substring(lastSlash + 1).replace(/[^iu]/g, "");
44372
+ pattern = pattern.substring(1, lastSlash);
44373
+ return new RegExp(pattern, flags);
44374
+ } catch {
44375
+ return void 0;
44376
+ }
44377
+ });
44378
+ function getModuleSpecifierPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding, autoImportSpecifierExcludeRegexes }, host, compilerOptions, importingSourceFile, oldImportSpecifier) {
44347
44379
  const filePreferredEnding = getPreferredEnding();
44348
44380
  return {
44381
+ excludeRegexes: autoImportSpecifierExcludeRegexes,
44349
44382
  relativePreference: oldImportSpecifier !== void 0 ? isExternalModuleNameRelative(oldImportSpecifier) ? 0 /* Relative */ : 1 /* NonRelative */ : importModuleSpecifierPreference === "relative" ? 0 /* Relative */ : importModuleSpecifierPreference === "non-relative" ? 1 /* NonRelative */ : importModuleSpecifierPreference === "project-relative" ? 3 /* ExternalNonRelative */ : 2 /* Shortest */,
44350
44383
  getAllowedEndingsInPreferredOrder: (syntaxImpliedNodeFormat) => {
44351
44384
  const impliedNodeFormat = getDefaultResolutionModeForFile(importingSourceFile, host, compilerOptions);
@@ -44414,7 +44447,13 @@ function getModuleSpecifiers(moduleSymbol, checker, compilerOptions, importingSo
44414
44447
  function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
44415
44448
  let computedWithoutCache = false;
44416
44449
  const ambient = tryGetModuleNameFromAmbientModule(moduleSymbol, checker);
44417
- if (ambient) return { kind: "ambient", moduleSpecifiers: [ambient], computedWithoutCache };
44450
+ if (ambient) {
44451
+ return {
44452
+ kind: "ambient",
44453
+ moduleSpecifiers: !(forAutoImport && isExcludedByRegex(ambient, userPreferences.autoImportSpecifierExcludeRegexes)) ? [ambient] : emptyArray,
44454
+ computedWithoutCache
44455
+ };
44456
+ }
44418
44457
  let [kind, specifiers, moduleSourceFile, modulePaths, cache] = tryGetModuleSpecifiersFromCacheWorker(
44419
44458
  moduleSymbol,
44420
44459
  importingSourceFile,
@@ -44474,9 +44513,11 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
44474
44513
  void 0,
44475
44514
  options.overrideImportMode
44476
44515
  ) : void 0;
44477
- nodeModulesSpecifiers = append(nodeModulesSpecifiers, specifier);
44478
- if (specifier && modulePath.isRedirect) {
44479
- return { kind: "node_modules", moduleSpecifiers: nodeModulesSpecifiers, computedWithoutCache: true };
44516
+ if (specifier && !(forAutoImport && isExcludedByRegex(specifier, preferences.excludeRegexes))) {
44517
+ nodeModulesSpecifiers = append(nodeModulesSpecifiers, specifier);
44518
+ if (modulePath.isRedirect) {
44519
+ return { kind: "node_modules", moduleSpecifiers: nodeModulesSpecifiers, computedWithoutCache: true };
44520
+ }
44480
44521
  }
44481
44522
  if (!specifier) {
44482
44523
  const local = getLocalModuleSpecifier(
@@ -44489,7 +44530,7 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
44489
44530
  /*pathsOnly*/
44490
44531
  modulePath.isRedirect
44491
44532
  );
44492
- if (!local) {
44533
+ if (!local || forAutoImport && isExcludedByRegex(local, preferences.excludeRegexes)) {
44493
44534
  continue;
44494
44535
  }
44495
44536
  if (modulePath.isRedirect) {
@@ -44505,7 +44546,13 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
44505
44546
  }
44506
44547
  }
44507
44548
  }
44508
- return (pathsSpecifiers == null ? void 0 : pathsSpecifiers.length) ? { kind: "paths", moduleSpecifiers: pathsSpecifiers, computedWithoutCache: true } : (redirectPathsSpecifiers == null ? void 0 : redirectPathsSpecifiers.length) ? { kind: "redirect", moduleSpecifiers: redirectPathsSpecifiers, computedWithoutCache: true } : (nodeModulesSpecifiers == null ? void 0 : nodeModulesSpecifiers.length) ? { kind: "node_modules", moduleSpecifiers: nodeModulesSpecifiers, computedWithoutCache: true } : { kind: "relative", moduleSpecifiers: Debug.checkDefined(relativeSpecifiers), computedWithoutCache: true };
44549
+ return (pathsSpecifiers == null ? void 0 : pathsSpecifiers.length) ? { kind: "paths", moduleSpecifiers: pathsSpecifiers, computedWithoutCache: true } : (redirectPathsSpecifiers == null ? void 0 : redirectPathsSpecifiers.length) ? { kind: "redirect", moduleSpecifiers: redirectPathsSpecifiers, computedWithoutCache: true } : (nodeModulesSpecifiers == null ? void 0 : nodeModulesSpecifiers.length) ? { kind: "node_modules", moduleSpecifiers: nodeModulesSpecifiers, computedWithoutCache: true } : { kind: "relative", moduleSpecifiers: relativeSpecifiers ?? emptyArray, computedWithoutCache: true };
44550
+ }
44551
+ function isExcludedByRegex(moduleSpecifier, excludeRegexes) {
44552
+ return some(excludeRegexes, (pattern) => {
44553
+ var _a;
44554
+ return !!((_a = stringToRegex(pattern)) == null ? void 0 : _a.test(moduleSpecifier));
44555
+ });
44509
44556
  }
44510
44557
  function getInfo(importingSourceFileName, host) {
44511
44558
  importingSourceFileName = getNormalizedAbsolutePath(importingSourceFileName, host.getCurrentDirectory());
@@ -44518,7 +44565,7 @@ function getInfo(importingSourceFileName, host) {
44518
44565
  canonicalSourceDirectory: getCanonicalFileName(sourceDirectory)
44519
44566
  };
44520
44567
  }
44521
- function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, importMode, { getAllowedEndingsInPreferredOrder: getAllowedEndingsInPrefererredOrder, relativePreference }, pathsOnly) {
44568
+ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, importMode, { getAllowedEndingsInPreferredOrder: getAllowedEndingsInPrefererredOrder, relativePreference, excludeRegexes }, pathsOnly) {
44522
44569
  const { baseUrl, paths, rootDirs } = compilerOptions;
44523
44570
  if (pathsOnly && !paths) {
44524
44571
  return void 0;
@@ -44534,7 +44581,14 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
44534
44581
  if (!relativeToBaseUrl) {
44535
44582
  return pathsOnly ? void 0 : relativePath;
44536
44583
  }
44537
- const fromPackageJsonImports = pathsOnly ? void 0 : tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory, compilerOptions, host, importMode);
44584
+ const fromPackageJsonImports = pathsOnly ? void 0 : tryGetModuleNameFromPackageJsonImports(
44585
+ moduleFileName,
44586
+ sourceDirectory,
44587
+ compilerOptions,
44588
+ host,
44589
+ importMode,
44590
+ prefersTsExtension(allowedEndings)
44591
+ );
44538
44592
  const fromPaths = pathsOnly || fromPackageJsonImports === void 0 ? paths && tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) : void 0;
44539
44593
  if (pathsOnly) {
44540
44594
  return fromPaths;
@@ -44543,6 +44597,14 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
44543
44597
  if (!maybeNonRelative) {
44544
44598
  return relativePath;
44545
44599
  }
44600
+ const relativeIsExcluded = isExcludedByRegex(relativePath, excludeRegexes);
44601
+ const nonRelativeIsExcluded = isExcludedByRegex(maybeNonRelative, excludeRegexes);
44602
+ if (!relativeIsExcluded && nonRelativeIsExcluded) {
44603
+ return relativePath;
44604
+ }
44605
+ if (relativeIsExcluded && !nonRelativeIsExcluded) {
44606
+ return maybeNonRelative;
44607
+ }
44546
44608
  if (relativePreference === 1 /* NonRelative */ && !pathIsRelative(maybeNonRelative)) {
44547
44609
  return maybeNonRelative;
44548
44610
  }
@@ -44767,7 +44829,7 @@ function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, hos
44767
44829
  return ending !== 0 /* Minimal */ || value === processEnding(relativeToBaseUrl, [ending], compilerOptions, host);
44768
44830
  }
44769
44831
  }
44770
- function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, exports2, conditions, mode, isImports) {
44832
+ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, exports2, conditions, mode, isImports, preferTsExtension) {
44771
44833
  if (typeof exports2 === "string") {
44772
44834
  const ignoreCase = !hostUsesCaseSensitiveFileNames(host);
44773
44835
  const getCommonSourceDirectory2 = () => host.getCommonSourceDirectory();
@@ -44779,6 +44841,7 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
44779
44841
  void 0
44780
44842
  );
44781
44843
  const extensionSwappedTarget = hasTSFileExtension(targetFilePath) ? removeFileExtension(targetFilePath) + tryGetJSExtensionForFile(targetFilePath, options) : void 0;
44844
+ const canTryTsExtension = preferTsExtension && hasImplementationTSFileExtension(targetFilePath);
44782
44845
  switch (mode) {
44783
44846
  case 0 /* Exact */:
44784
44847
  if (extensionSwappedTarget && comparePaths(extensionSwappedTarget, pathOrPattern, ignoreCase) === 0 /* EqualTo */ || comparePaths(targetFilePath, pathOrPattern, ignoreCase) === 0 /* EqualTo */ || outputFile && comparePaths(outputFile, pathOrPattern, ignoreCase) === 0 /* EqualTo */ || declarationFile && comparePaths(declarationFile, pathOrPattern, ignoreCase) === 0 /* EqualTo */) {
@@ -44786,6 +44849,19 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
44786
44849
  }
44787
44850
  break;
44788
44851
  case 1 /* Directory */:
44852
+ if (canTryTsExtension && containsPath(targetFilePath, pathOrPattern, ignoreCase)) {
44853
+ const fragment = getRelativePathFromDirectory(
44854
+ pathOrPattern,
44855
+ targetFilePath,
44856
+ /*ignoreCase*/
44857
+ false
44858
+ );
44859
+ return { moduleFileToTry: getNormalizedAbsolutePath(
44860
+ combinePaths(combinePaths(packageName, exports2), fragment),
44861
+ /*currentDirectory*/
44862
+ void 0
44863
+ ) };
44864
+ }
44789
44865
  if (extensionSwappedTarget && containsPath(pathOrPattern, extensionSwappedTarget, ignoreCase)) {
44790
44866
  const fragment = getRelativePathFromDirectory(
44791
44867
  pathOrPattern,
@@ -44799,7 +44875,7 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
44799
44875
  void 0
44800
44876
  ) };
44801
44877
  }
44802
- if (containsPath(pathOrPattern, targetFilePath, ignoreCase)) {
44878
+ if (!canTryTsExtension && containsPath(pathOrPattern, targetFilePath, ignoreCase)) {
44803
44879
  const fragment = getRelativePathFromDirectory(
44804
44880
  pathOrPattern,
44805
44881
  targetFilePath,
@@ -44822,12 +44898,12 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
44822
44898
  return { moduleFileToTry: combinePaths(packageName, fragment) };
44823
44899
  }
44824
44900
  if (declarationFile && containsPath(pathOrPattern, declarationFile, ignoreCase)) {
44825
- const fragment = getRelativePathFromDirectory(
44901
+ const fragment = changeFullExtension(getRelativePathFromDirectory(
44826
44902
  pathOrPattern,
44827
44903
  declarationFile,
44828
44904
  /*ignoreCase*/
44829
44905
  false
44830
- );
44906
+ ), getJSExtensionForFile(declarationFile, options));
44831
44907
  return { moduleFileToTry: combinePaths(packageName, fragment) };
44832
44908
  }
44833
44909
  break;
@@ -44835,11 +44911,15 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
44835
44911
  const starPos = pathOrPattern.indexOf("*");
44836
44912
  const leadingSlice = pathOrPattern.slice(0, starPos);
44837
44913
  const trailingSlice = pathOrPattern.slice(starPos + 1);
44914
+ if (canTryTsExtension && startsWith(targetFilePath, leadingSlice, ignoreCase) && endsWith(targetFilePath, trailingSlice, ignoreCase)) {
44915
+ const starReplacement = targetFilePath.slice(leadingSlice.length, targetFilePath.length - trailingSlice.length);
44916
+ return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
44917
+ }
44838
44918
  if (extensionSwappedTarget && startsWith(extensionSwappedTarget, leadingSlice, ignoreCase) && endsWith(extensionSwappedTarget, trailingSlice, ignoreCase)) {
44839
44919
  const starReplacement = extensionSwappedTarget.slice(leadingSlice.length, extensionSwappedTarget.length - trailingSlice.length);
44840
44920
  return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
44841
44921
  }
44842
- if (startsWith(targetFilePath, leadingSlice, ignoreCase) && endsWith(targetFilePath, trailingSlice, ignoreCase)) {
44922
+ if (!canTryTsExtension && startsWith(targetFilePath, leadingSlice, ignoreCase) && endsWith(targetFilePath, trailingSlice, ignoreCase)) {
44843
44923
  const starReplacement = targetFilePath.slice(leadingSlice.length, targetFilePath.length - trailingSlice.length);
44844
44924
  return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
44845
44925
  }
@@ -44849,17 +44929,19 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
44849
44929
  }
44850
44930
  if (declarationFile && startsWith(declarationFile, leadingSlice, ignoreCase) && endsWith(declarationFile, trailingSlice, ignoreCase)) {
44851
44931
  const starReplacement = declarationFile.slice(leadingSlice.length, declarationFile.length - trailingSlice.length);
44852
- return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
44932
+ const substituted = replaceFirstStar(packageName, starReplacement);
44933
+ const jsExtension = tryGetJSExtensionForFile(declarationFile, options);
44934
+ return jsExtension ? { moduleFileToTry: changeFullExtension(substituted, jsExtension) } : void 0;
44853
44935
  }
44854
44936
  break;
44855
44937
  }
44856
44938
  } else if (Array.isArray(exports2)) {
44857
- return forEach(exports2, (e) => tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, e, conditions, mode, isImports));
44939
+ return forEach(exports2, (e) => tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, e, conditions, mode, isImports, preferTsExtension));
44858
44940
  } else if (typeof exports2 === "object" && exports2 !== null) {
44859
44941
  for (const key of getOwnKeys(exports2)) {
44860
44942
  if (key === "default" || conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(conditions, key)) {
44861
44943
  const subTarget = exports2[key];
44862
- const result = tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode, isImports);
44944
+ const result = tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode, isImports, preferTsExtension);
44863
44945
  if (result) {
44864
44946
  return result;
44865
44947
  }
@@ -44887,6 +44969,8 @@ function tryGetModuleNameFromExports(options, host, targetFilePath, packageDirec
44887
44969
  conditions,
44888
44970
  mode,
44889
44971
  /*isImports*/
44972
+ false,
44973
+ /*preferTsExtension*/
44890
44974
  false
44891
44975
  );
44892
44976
  });
@@ -44901,10 +44985,12 @@ function tryGetModuleNameFromExports(options, host, targetFilePath, packageDirec
44901
44985
  conditions,
44902
44986
  0 /* Exact */,
44903
44987
  /*isImports*/
44988
+ false,
44989
+ /*preferTsExtension*/
44904
44990
  false
44905
44991
  );
44906
44992
  }
44907
- function tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory, options, host, importMode) {
44993
+ function tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory, options, host, importMode, preferTsExtension) {
44908
44994
  var _a, _b, _c;
44909
44995
  if (!host.readFile || !getResolvePackageJsonImports(options)) {
44910
44996
  return void 0;
@@ -44937,7 +45023,8 @@ function tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory,
44937
45023
  conditions,
44938
45024
  mode,
44939
45025
  /*isImports*/
44940
- true
45026
+ true,
45027
+ preferTsExtension
44941
45028
  );
44942
45029
  })) == null ? void 0 : _c.moduleFileToTry;
44943
45030
  }
@@ -45019,7 +45106,15 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
45019
45106
  const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
45020
45107
  const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
45021
45108
  const conditions = getConditions(options, importMode);
45022
- const fromExports = (packageJsonContent == null ? void 0 : packageJsonContent.exports) ? tryGetModuleNameFromExports(options, host, path, packageRootPath, packageName2, packageJsonContent.exports, conditions) : void 0;
45109
+ const fromExports = (packageJsonContent == null ? void 0 : packageJsonContent.exports) ? tryGetModuleNameFromExports(
45110
+ options,
45111
+ host,
45112
+ path,
45113
+ packageRootPath,
45114
+ packageName2,
45115
+ packageJsonContent.exports,
45116
+ conditions
45117
+ ) : void 0;
45023
45118
  if (fromExports) {
45024
45119
  return { ...fromExports, verbatimFromExports: true };
45025
45120
  }
@@ -45167,6 +45262,10 @@ function isPathRelativeToParent(path) {
45167
45262
  function getDefaultResolutionModeForFile(file, host, compilerOptions) {
45168
45263
  return isFullSourceFile(file) ? host.getDefaultResolutionModeForFile(file) : getDefaultResolutionModeForFileWorker(file, compilerOptions);
45169
45264
  }
45265
+ function prefersTsExtension(allowedEndings) {
45266
+ const tsPriority = allowedEndings.indexOf(3 /* TsExtension */);
45267
+ return tsPriority > -1 && tsPriority < allowedEndings.indexOf(2 /* JsExtension */);
45268
+ }
45170
45269
 
45171
45270
  // src/compiler/checker.ts
45172
45271
  var ambientModuleSymbolRegex = /^".+"$/;
@@ -8241,6 +8241,7 @@ declare namespace ts {
8241
8241
  readonly interactiveInlayHints?: boolean;
8242
8242
  readonly allowRenameOfImportPath?: boolean;
8243
8243
  readonly autoImportFileExcludePatterns?: string[];
8244
+ readonly autoImportSpecifierExcludeRegexes?: string[];
8244
8245
  readonly preferTypeOnlyAutoImports?: boolean;
8245
8246
  /**
8246
8247
  * Indicates whether imports should be organized in a case-insensitive manner.
package/lib/typescript.js CHANGED
@@ -1084,6 +1084,7 @@ __export(typescript_exports, {
1084
1084
  hasEffectiveModifiers: () => hasEffectiveModifiers,
1085
1085
  hasEffectiveReadonlyModifier: () => hasEffectiveReadonlyModifier,
1086
1086
  hasExtension: () => hasExtension,
1087
+ hasImplementationTSFileExtension: () => hasImplementationTSFileExtension,
1087
1088
  hasIndexSignature: () => hasIndexSignature,
1088
1089
  hasInferredType: () => hasInferredType,
1089
1090
  hasInitializer: () => hasInitializer,
@@ -2261,7 +2262,7 @@ module.exports = __toCommonJS(typescript_exports);
2261
2262
 
2262
2263
  // src/compiler/corePublic.ts
2263
2264
  var versionMajorMinor = "5.6";
2264
- var version = `${versionMajorMinor}.0-dev.20240809`;
2265
+ var version = `${versionMajorMinor}.0-dev.20240810`;
2265
2266
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2266
2267
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2267
2268
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -22238,6 +22239,9 @@ function hasJSFileExtension(fileName) {
22238
22239
  function hasTSFileExtension(fileName) {
22239
22240
  return some(supportedTSExtensionsFlat, (extension) => fileExtensionIs(fileName, extension));
22240
22241
  }
22242
+ function hasImplementationTSFileExtension(fileName) {
22243
+ return some(supportedTSImplementationExtensions, (extension) => fileExtensionIs(fileName, extension)) && !isDeclarationFileName(fileName);
22244
+ }
22241
22245
  var ModuleSpecifierEnding = /* @__PURE__ */ ((ModuleSpecifierEnding2) => {
22242
22246
  ModuleSpecifierEnding2[ModuleSpecifierEnding2["Minimal"] = 0] = "Minimal";
22243
22247
  ModuleSpecifierEnding2[ModuleSpecifierEnding2["Index"] = 1] = "Index";
@@ -48886,6 +48890,28 @@ __export(ts_moduleSpecifiers_exports, {
48886
48890
  });
48887
48891
 
48888
48892
  // src/compiler/moduleSpecifiers.ts
48893
+ var stringToRegex = memoizeOne((pattern) => {
48894
+ try {
48895
+ let slash = pattern.indexOf("/");
48896
+ if (slash !== 0) {
48897
+ return new RegExp(pattern);
48898
+ }
48899
+ const lastSlash = pattern.lastIndexOf("/");
48900
+ if (slash === lastSlash) {
48901
+ return new RegExp(pattern);
48902
+ }
48903
+ while ((slash = pattern.indexOf("/", slash + 1)) !== lastSlash) {
48904
+ if (pattern[slash - 1] !== "\\") {
48905
+ return new RegExp(pattern);
48906
+ }
48907
+ }
48908
+ const flags = pattern.substring(lastSlash + 1).replace(/[^iu]/g, "");
48909
+ pattern = pattern.substring(1, lastSlash);
48910
+ return new RegExp(pattern, flags);
48911
+ } catch {
48912
+ return void 0;
48913
+ }
48914
+ });
48889
48915
  var RelativePreference = /* @__PURE__ */ ((RelativePreference2) => {
48890
48916
  RelativePreference2[RelativePreference2["Relative"] = 0] = "Relative";
48891
48917
  RelativePreference2[RelativePreference2["NonRelative"] = 1] = "NonRelative";
@@ -48893,9 +48919,10 @@ var RelativePreference = /* @__PURE__ */ ((RelativePreference2) => {
48893
48919
  RelativePreference2[RelativePreference2["ExternalNonRelative"] = 3] = "ExternalNonRelative";
48894
48920
  return RelativePreference2;
48895
48921
  })(RelativePreference || {});
48896
- function getModuleSpecifierPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding }, host, compilerOptions, importingSourceFile, oldImportSpecifier) {
48922
+ function getModuleSpecifierPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding, autoImportSpecifierExcludeRegexes }, host, compilerOptions, importingSourceFile, oldImportSpecifier) {
48897
48923
  const filePreferredEnding = getPreferredEnding();
48898
48924
  return {
48925
+ excludeRegexes: autoImportSpecifierExcludeRegexes,
48899
48926
  relativePreference: oldImportSpecifier !== void 0 ? isExternalModuleNameRelative(oldImportSpecifier) ? 0 /* Relative */ : 1 /* NonRelative */ : importModuleSpecifierPreference === "relative" ? 0 /* Relative */ : importModuleSpecifierPreference === "non-relative" ? 1 /* NonRelative */ : importModuleSpecifierPreference === "project-relative" ? 3 /* ExternalNonRelative */ : 2 /* Shortest */,
48900
48927
  getAllowedEndingsInPreferredOrder: (syntaxImpliedNodeFormat) => {
48901
48928
  const impliedNodeFormat = getDefaultResolutionModeForFile(importingSourceFile, host, compilerOptions);
@@ -49012,7 +49039,13 @@ function getModuleSpecifiers(moduleSymbol, checker, compilerOptions, importingSo
49012
49039
  function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
49013
49040
  let computedWithoutCache = false;
49014
49041
  const ambient = tryGetModuleNameFromAmbientModule(moduleSymbol, checker);
49015
- if (ambient) return { kind: "ambient", moduleSpecifiers: [ambient], computedWithoutCache };
49042
+ if (ambient) {
49043
+ return {
49044
+ kind: "ambient",
49045
+ moduleSpecifiers: !(forAutoImport && isExcludedByRegex(ambient, userPreferences.autoImportSpecifierExcludeRegexes)) ? [ambient] : emptyArray,
49046
+ computedWithoutCache
49047
+ };
49048
+ }
49016
49049
  let [kind, specifiers, moduleSourceFile, modulePaths, cache] = tryGetModuleSpecifiersFromCacheWorker(
49017
49050
  moduleSymbol,
49018
49051
  importingSourceFile,
@@ -49084,9 +49117,11 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
49084
49117
  void 0,
49085
49118
  options.overrideImportMode
49086
49119
  ) : void 0;
49087
- nodeModulesSpecifiers = append(nodeModulesSpecifiers, specifier);
49088
- if (specifier && modulePath.isRedirect) {
49089
- return { kind: "node_modules", moduleSpecifiers: nodeModulesSpecifiers, computedWithoutCache: true };
49120
+ if (specifier && !(forAutoImport && isExcludedByRegex(specifier, preferences.excludeRegexes))) {
49121
+ nodeModulesSpecifiers = append(nodeModulesSpecifiers, specifier);
49122
+ if (modulePath.isRedirect) {
49123
+ return { kind: "node_modules", moduleSpecifiers: nodeModulesSpecifiers, computedWithoutCache: true };
49124
+ }
49090
49125
  }
49091
49126
  if (!specifier) {
49092
49127
  const local = getLocalModuleSpecifier(
@@ -49099,7 +49134,7 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
49099
49134
  /*pathsOnly*/
49100
49135
  modulePath.isRedirect
49101
49136
  );
49102
- if (!local) {
49137
+ if (!local || forAutoImport && isExcludedByRegex(local, preferences.excludeRegexes)) {
49103
49138
  continue;
49104
49139
  }
49105
49140
  if (modulePath.isRedirect) {
@@ -49115,7 +49150,13 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
49115
49150
  }
49116
49151
  }
49117
49152
  }
49118
- return (pathsSpecifiers == null ? void 0 : pathsSpecifiers.length) ? { kind: "paths", moduleSpecifiers: pathsSpecifiers, computedWithoutCache: true } : (redirectPathsSpecifiers == null ? void 0 : redirectPathsSpecifiers.length) ? { kind: "redirect", moduleSpecifiers: redirectPathsSpecifiers, computedWithoutCache: true } : (nodeModulesSpecifiers == null ? void 0 : nodeModulesSpecifiers.length) ? { kind: "node_modules", moduleSpecifiers: nodeModulesSpecifiers, computedWithoutCache: true } : { kind: "relative", moduleSpecifiers: Debug.checkDefined(relativeSpecifiers), computedWithoutCache: true };
49153
+ return (pathsSpecifiers == null ? void 0 : pathsSpecifiers.length) ? { kind: "paths", moduleSpecifiers: pathsSpecifiers, computedWithoutCache: true } : (redirectPathsSpecifiers == null ? void 0 : redirectPathsSpecifiers.length) ? { kind: "redirect", moduleSpecifiers: redirectPathsSpecifiers, computedWithoutCache: true } : (nodeModulesSpecifiers == null ? void 0 : nodeModulesSpecifiers.length) ? { kind: "node_modules", moduleSpecifiers: nodeModulesSpecifiers, computedWithoutCache: true } : { kind: "relative", moduleSpecifiers: relativeSpecifiers ?? emptyArray, computedWithoutCache: true };
49154
+ }
49155
+ function isExcludedByRegex(moduleSpecifier, excludeRegexes) {
49156
+ return some(excludeRegexes, (pattern) => {
49157
+ var _a;
49158
+ return !!((_a = stringToRegex(pattern)) == null ? void 0 : _a.test(moduleSpecifier));
49159
+ });
49119
49160
  }
49120
49161
  function getInfo(importingSourceFileName, host) {
49121
49162
  importingSourceFileName = getNormalizedAbsolutePath(importingSourceFileName, host.getCurrentDirectory());
@@ -49128,7 +49169,7 @@ function getInfo(importingSourceFileName, host) {
49128
49169
  canonicalSourceDirectory: getCanonicalFileName(sourceDirectory)
49129
49170
  };
49130
49171
  }
49131
- function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, importMode, { getAllowedEndingsInPreferredOrder: getAllowedEndingsInPrefererredOrder, relativePreference }, pathsOnly) {
49172
+ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, importMode, { getAllowedEndingsInPreferredOrder: getAllowedEndingsInPrefererredOrder, relativePreference, excludeRegexes }, pathsOnly) {
49132
49173
  const { baseUrl, paths, rootDirs } = compilerOptions;
49133
49174
  if (pathsOnly && !paths) {
49134
49175
  return void 0;
@@ -49144,7 +49185,14 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
49144
49185
  if (!relativeToBaseUrl) {
49145
49186
  return pathsOnly ? void 0 : relativePath;
49146
49187
  }
49147
- const fromPackageJsonImports = pathsOnly ? void 0 : tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory, compilerOptions, host, importMode);
49188
+ const fromPackageJsonImports = pathsOnly ? void 0 : tryGetModuleNameFromPackageJsonImports(
49189
+ moduleFileName,
49190
+ sourceDirectory,
49191
+ compilerOptions,
49192
+ host,
49193
+ importMode,
49194
+ prefersTsExtension(allowedEndings)
49195
+ );
49148
49196
  const fromPaths = pathsOnly || fromPackageJsonImports === void 0 ? paths && tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) : void 0;
49149
49197
  if (pathsOnly) {
49150
49198
  return fromPaths;
@@ -49153,6 +49201,14 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
49153
49201
  if (!maybeNonRelative) {
49154
49202
  return relativePath;
49155
49203
  }
49204
+ const relativeIsExcluded = isExcludedByRegex(relativePath, excludeRegexes);
49205
+ const nonRelativeIsExcluded = isExcludedByRegex(maybeNonRelative, excludeRegexes);
49206
+ if (!relativeIsExcluded && nonRelativeIsExcluded) {
49207
+ return relativePath;
49208
+ }
49209
+ if (relativeIsExcluded && !nonRelativeIsExcluded) {
49210
+ return maybeNonRelative;
49211
+ }
49156
49212
  if (relativePreference === 1 /* NonRelative */ && !pathIsRelative(maybeNonRelative)) {
49157
49213
  return maybeNonRelative;
49158
49214
  }
@@ -49392,7 +49448,7 @@ function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, hos
49392
49448
  return ending !== 0 /* Minimal */ || value === processEnding(relativeToBaseUrl, [ending], compilerOptions, host);
49393
49449
  }
49394
49450
  }
49395
- function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, exports2, conditions, mode, isImports) {
49451
+ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, exports2, conditions, mode, isImports, preferTsExtension) {
49396
49452
  if (typeof exports2 === "string") {
49397
49453
  const ignoreCase = !hostUsesCaseSensitiveFileNames(host);
49398
49454
  const getCommonSourceDirectory2 = () => host.getCommonSourceDirectory();
@@ -49404,6 +49460,7 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
49404
49460
  void 0
49405
49461
  );
49406
49462
  const extensionSwappedTarget = hasTSFileExtension(targetFilePath) ? removeFileExtension(targetFilePath) + tryGetJSExtensionForFile(targetFilePath, options) : void 0;
49463
+ const canTryTsExtension = preferTsExtension && hasImplementationTSFileExtension(targetFilePath);
49407
49464
  switch (mode) {
49408
49465
  case 0 /* Exact */:
49409
49466
  if (extensionSwappedTarget && comparePaths(extensionSwappedTarget, pathOrPattern, ignoreCase) === 0 /* EqualTo */ || comparePaths(targetFilePath, pathOrPattern, ignoreCase) === 0 /* EqualTo */ || outputFile && comparePaths(outputFile, pathOrPattern, ignoreCase) === 0 /* EqualTo */ || declarationFile && comparePaths(declarationFile, pathOrPattern, ignoreCase) === 0 /* EqualTo */) {
@@ -49411,6 +49468,19 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
49411
49468
  }
49412
49469
  break;
49413
49470
  case 1 /* Directory */:
49471
+ if (canTryTsExtension && containsPath(targetFilePath, pathOrPattern, ignoreCase)) {
49472
+ const fragment = getRelativePathFromDirectory(
49473
+ pathOrPattern,
49474
+ targetFilePath,
49475
+ /*ignoreCase*/
49476
+ false
49477
+ );
49478
+ return { moduleFileToTry: getNormalizedAbsolutePath(
49479
+ combinePaths(combinePaths(packageName, exports2), fragment),
49480
+ /*currentDirectory*/
49481
+ void 0
49482
+ ) };
49483
+ }
49414
49484
  if (extensionSwappedTarget && containsPath(pathOrPattern, extensionSwappedTarget, ignoreCase)) {
49415
49485
  const fragment = getRelativePathFromDirectory(
49416
49486
  pathOrPattern,
@@ -49424,7 +49494,7 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
49424
49494
  void 0
49425
49495
  ) };
49426
49496
  }
49427
- if (containsPath(pathOrPattern, targetFilePath, ignoreCase)) {
49497
+ if (!canTryTsExtension && containsPath(pathOrPattern, targetFilePath, ignoreCase)) {
49428
49498
  const fragment = getRelativePathFromDirectory(
49429
49499
  pathOrPattern,
49430
49500
  targetFilePath,
@@ -49447,12 +49517,12 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
49447
49517
  return { moduleFileToTry: combinePaths(packageName, fragment) };
49448
49518
  }
49449
49519
  if (declarationFile && containsPath(pathOrPattern, declarationFile, ignoreCase)) {
49450
- const fragment = getRelativePathFromDirectory(
49520
+ const fragment = changeFullExtension(getRelativePathFromDirectory(
49451
49521
  pathOrPattern,
49452
49522
  declarationFile,
49453
49523
  /*ignoreCase*/
49454
49524
  false
49455
- );
49525
+ ), getJSExtensionForFile(declarationFile, options));
49456
49526
  return { moduleFileToTry: combinePaths(packageName, fragment) };
49457
49527
  }
49458
49528
  break;
@@ -49460,11 +49530,15 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
49460
49530
  const starPos = pathOrPattern.indexOf("*");
49461
49531
  const leadingSlice = pathOrPattern.slice(0, starPos);
49462
49532
  const trailingSlice = pathOrPattern.slice(starPos + 1);
49533
+ if (canTryTsExtension && startsWith(targetFilePath, leadingSlice, ignoreCase) && endsWith(targetFilePath, trailingSlice, ignoreCase)) {
49534
+ const starReplacement = targetFilePath.slice(leadingSlice.length, targetFilePath.length - trailingSlice.length);
49535
+ return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
49536
+ }
49463
49537
  if (extensionSwappedTarget && startsWith(extensionSwappedTarget, leadingSlice, ignoreCase) && endsWith(extensionSwappedTarget, trailingSlice, ignoreCase)) {
49464
49538
  const starReplacement = extensionSwappedTarget.slice(leadingSlice.length, extensionSwappedTarget.length - trailingSlice.length);
49465
49539
  return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
49466
49540
  }
49467
- if (startsWith(targetFilePath, leadingSlice, ignoreCase) && endsWith(targetFilePath, trailingSlice, ignoreCase)) {
49541
+ if (!canTryTsExtension && startsWith(targetFilePath, leadingSlice, ignoreCase) && endsWith(targetFilePath, trailingSlice, ignoreCase)) {
49468
49542
  const starReplacement = targetFilePath.slice(leadingSlice.length, targetFilePath.length - trailingSlice.length);
49469
49543
  return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
49470
49544
  }
@@ -49474,17 +49548,19 @@ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, pac
49474
49548
  }
49475
49549
  if (declarationFile && startsWith(declarationFile, leadingSlice, ignoreCase) && endsWith(declarationFile, trailingSlice, ignoreCase)) {
49476
49550
  const starReplacement = declarationFile.slice(leadingSlice.length, declarationFile.length - trailingSlice.length);
49477
- return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
49551
+ const substituted = replaceFirstStar(packageName, starReplacement);
49552
+ const jsExtension = tryGetJSExtensionForFile(declarationFile, options);
49553
+ return jsExtension ? { moduleFileToTry: changeFullExtension(substituted, jsExtension) } : void 0;
49478
49554
  }
49479
49555
  break;
49480
49556
  }
49481
49557
  } else if (Array.isArray(exports2)) {
49482
- return forEach(exports2, (e) => tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, e, conditions, mode, isImports));
49558
+ return forEach(exports2, (e) => tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, e, conditions, mode, isImports, preferTsExtension));
49483
49559
  } else if (typeof exports2 === "object" && exports2 !== null) {
49484
49560
  for (const key of getOwnKeys(exports2)) {
49485
49561
  if (key === "default" || conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(conditions, key)) {
49486
49562
  const subTarget = exports2[key];
49487
- const result = tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode, isImports);
49563
+ const result = tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode, isImports, preferTsExtension);
49488
49564
  if (result) {
49489
49565
  return result;
49490
49566
  }
@@ -49512,6 +49588,8 @@ function tryGetModuleNameFromExports(options, host, targetFilePath, packageDirec
49512
49588
  conditions,
49513
49589
  mode,
49514
49590
  /*isImports*/
49591
+ false,
49592
+ /*preferTsExtension*/
49515
49593
  false
49516
49594
  );
49517
49595
  });
@@ -49526,10 +49604,12 @@ function tryGetModuleNameFromExports(options, host, targetFilePath, packageDirec
49526
49604
  conditions,
49527
49605
  0 /* Exact */,
49528
49606
  /*isImports*/
49607
+ false,
49608
+ /*preferTsExtension*/
49529
49609
  false
49530
49610
  );
49531
49611
  }
49532
- function tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory, options, host, importMode) {
49612
+ function tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory, options, host, importMode, preferTsExtension) {
49533
49613
  var _a, _b, _c;
49534
49614
  if (!host.readFile || !getResolvePackageJsonImports(options)) {
49535
49615
  return void 0;
@@ -49562,7 +49642,8 @@ function tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory,
49562
49642
  conditions,
49563
49643
  mode,
49564
49644
  /*isImports*/
49565
- true
49645
+ true,
49646
+ preferTsExtension
49566
49647
  );
49567
49648
  })) == null ? void 0 : _c.moduleFileToTry;
49568
49649
  }
@@ -49644,7 +49725,15 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
49644
49725
  const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
49645
49726
  const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
49646
49727
  const conditions = getConditions(options, importMode);
49647
- const fromExports = (packageJsonContent == null ? void 0 : packageJsonContent.exports) ? tryGetModuleNameFromExports(options, host, path, packageRootPath, packageName2, packageJsonContent.exports, conditions) : void 0;
49728
+ const fromExports = (packageJsonContent == null ? void 0 : packageJsonContent.exports) ? tryGetModuleNameFromExports(
49729
+ options,
49730
+ host,
49731
+ path,
49732
+ packageRootPath,
49733
+ packageName2,
49734
+ packageJsonContent.exports,
49735
+ conditions
49736
+ ) : void 0;
49648
49737
  if (fromExports) {
49649
49738
  return { ...fromExports, verbatimFromExports: true };
49650
49739
  }
@@ -49792,6 +49881,10 @@ function isPathRelativeToParent(path) {
49792
49881
  function getDefaultResolutionModeForFile(file, host, compilerOptions) {
49793
49882
  return isFullSourceFile(file) ? host.getDefaultResolutionModeForFile(file) : getDefaultResolutionModeForFileWorker(file, compilerOptions);
49794
49883
  }
49884
+ function prefersTsExtension(allowedEndings) {
49885
+ const tsPriority = allowedEndings.indexOf(3 /* TsExtension */);
49886
+ return tsPriority > -1 && tsPriority < allowedEndings.indexOf(2 /* JsExtension */);
49887
+ }
49795
49888
 
49796
49889
  // src/compiler/checker.ts
49797
49890
  var ambientModuleSymbolRegex = /^".+"$/;
@@ -163318,9 +163411,9 @@ function originIsComputedPropertyName(origin) {
163318
163411
  return !!(origin && origin.kind & 512 /* ComputedPropertyName */);
163319
163412
  }
163320
163413
  function resolvingModuleSpecifiers(logPrefix, host, resolver, program, position, preferences, isForImportStatementCompletion, isValidTypeOnlyUseSite, cb) {
163321
- var _a, _b, _c;
163414
+ var _a, _b, _c, _d;
163322
163415
  const start = timestamp();
163323
- const needsFullResolution = isForImportStatementCompletion || moduleResolutionSupportsPackageJsonExportsAndImports(getEmitModuleResolutionKind(program.getCompilerOptions()));
163416
+ const needsFullResolution = isForImportStatementCompletion || getResolvePackageJsonExports(program.getCompilerOptions()) || ((_a = preferences.autoImportSpecifierExcludeRegexes) == null ? void 0 : _a.length);
163324
163417
  let skippedAny = false;
163325
163418
  let ambientCount = 0;
163326
163419
  let resolvedCount = 0;
@@ -163333,9 +163426,9 @@ function resolvingModuleSpecifiers(logPrefix, host, resolver, program, position,
163333
163426
  resolvedBeyondLimit: () => resolvedCount > moduleSpecifierResolutionLimit
163334
163427
  });
163335
163428
  const hitRateMessage = cacheAttemptCount ? ` (${(resolvedFromCacheCount / cacheAttemptCount * 100).toFixed(1)}% hit rate)` : "";
163336
- (_a = host.log) == null ? void 0 : _a.call(host, `${logPrefix}: resolved ${resolvedCount} module specifiers, plus ${ambientCount} ambient and ${resolvedFromCacheCount} from cache${hitRateMessage}`);
163337
- (_b = host.log) == null ? void 0 : _b.call(host, `${logPrefix}: response is ${skippedAny ? "incomplete" : "complete"}`);
163338
- (_c = host.log) == null ? void 0 : _c.call(host, `${logPrefix}: ${timestamp() - start}`);
163429
+ (_b = host.log) == null ? void 0 : _b.call(host, `${logPrefix}: resolved ${resolvedCount} module specifiers, plus ${ambientCount} ambient and ${resolvedFromCacheCount} from cache${hitRateMessage}`);
163430
+ (_c = host.log) == null ? void 0 : _c.call(host, `${logPrefix}: response is ${skippedAny ? "incomplete" : "complete"}`);
163431
+ (_d = host.log) == null ? void 0 : _d.call(host, `${logPrefix}: ${timestamp() - start}`);
163339
163432
  return result;
163340
163433
  function tryResolve(exportInfo, isFromAmbientModule) {
163341
163434
  if (isFromAmbientModule) {
@@ -166847,7 +166940,13 @@ function getJsDocTagAtPosition(node, position) {
166847
166940
  }
166848
166941
  function getPropertiesForObjectExpression(contextualType, completionsType, obj, checker) {
166849
166942
  const hasCompletionsType = completionsType && completionsType !== contextualType;
166850
- const type = hasCompletionsType && !(completionsType.flags & 3 /* AnyOrUnknown */) ? checker.getUnionType([contextualType, completionsType]) : contextualType;
166943
+ const promiseFilteredContextualType = checker.getUnionType(
166944
+ filter(
166945
+ contextualType.flags & 1048576 /* Union */ ? contextualType.types : [contextualType],
166946
+ (t) => !checker.getPromisedTypeOfPromise(t)
166947
+ )
166948
+ );
166949
+ const type = hasCompletionsType && !(completionsType.flags & 3 /* AnyOrUnknown */) ? checker.getUnionType([promiseFilteredContextualType, completionsType]) : promiseFilteredContextualType;
166851
166950
  const properties = getApparentProperties(type, obj, checker);
166852
166951
  return type.isClass() && containsNonPublicProperties(properties) ? [] : hasCompletionsType ? filter(properties, hasDeclarationOtherThanSelf) : properties;
166853
166952
  function hasDeclarationOtherThanSelf(member) {
@@ -180282,6 +180381,7 @@ __export(ts_exports2, {
180282
180381
  hasEffectiveModifiers: () => hasEffectiveModifiers,
180283
180382
  hasEffectiveReadonlyModifier: () => hasEffectiveReadonlyModifier,
180284
180383
  hasExtension: () => hasExtension,
180384
+ hasImplementationTSFileExtension: () => hasImplementationTSFileExtension,
180285
180385
  hasIndexSignature: () => hasIndexSignature,
180286
180386
  hasInferredType: () => hasInferredType,
180287
180387
  hasInitializer: () => hasInitializer,
@@ -194668,6 +194768,7 @@ if (typeof console !== "undefined") {
194668
194768
  hasEffectiveModifiers,
194669
194769
  hasEffectiveReadonlyModifier,
194670
194770
  hasExtension,
194771
+ hasImplementationTSFileExtension,
194671
194772
  hasIndexSignature,
194672
194773
  hasInferredType,
194673
194774
  hasInitializer,
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.6.0-dev.20240809",
5
+ "version": "5.6.0-dev.20240810",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -114,5 +114,5 @@
114
114
  "node": "20.1.0",
115
115
  "npm": "8.19.4"
116
116
  },
117
- "gitHead": "1bb1d2a6105a9a05a10409265f35cbe37d89b3e6"
117
+ "gitHead": "4b12d82b6bb4c8e2ad7df3219ae7282e360e62f9"
118
118
  }