typescript 5.5.0-dev.20240521 → 5.5.0-dev.20240522

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.5";
21
- var version = `${versionMajorMinor}.0-dev.20240521`;
21
+ var version = `${versionMajorMinor}.0-dev.20240522`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -11521,7 +11521,7 @@ function getTextOfJSDocComment(comment) {
11521
11521
  function formatJSDocLink(link) {
11522
11522
  const kind = link.kind === 324 /* JSDocLink */ ? "link" : link.kind === 325 /* JSDocLinkCode */ ? "linkcode" : "linkplain";
11523
11523
  const name = link.name ? entityNameToString(link.name) : "";
11524
- const space = link.name && link.text.startsWith("://") ? "" : " ";
11524
+ const space = link.name && (link.text === "" || link.text.startsWith("://")) ? "" : " ";
11525
11525
  return `{@${kind} ${name}${space}${link.text}}`;
11526
11526
  }
11527
11527
  function getEffectiveTypeParameterDeclarations(node) {
@@ -16877,6 +16877,9 @@ function getDeclarationModifierFlagsFromSymbol(s, isWrite = false) {
16877
16877
  }
16878
16878
  return 0;
16879
16879
  }
16880
+ function skipAlias(symbol, checker) {
16881
+ return symbol.flags & 2097152 /* Alias */ ? checker.getAliasedSymbol(symbol) : symbol;
16882
+ }
16880
16883
  function getCombinedLocalAndExportSymbolFlags(symbol) {
16881
16884
  return symbol.exportSymbol ? symbol.exportSymbol.flags | symbol.flags : symbol.flags;
16882
16885
  }
@@ -44085,7 +44088,7 @@ function tryGetModuleSpecifiersFromCacheWorker(moduleSymbol, importingSourceFile
44085
44088
  }
44086
44089
  const cache = (_a = host.getModuleSpecifierCache) == null ? void 0 : _a.call(host);
44087
44090
  const cached = cache == null ? void 0 : cache.get(importingSourceFile.path, moduleSourceFile.path, userPreferences, options);
44088
- return [cached == null ? void 0 : cached.moduleSpecifiers, moduleSourceFile, cached == null ? void 0 : cached.modulePaths, cache];
44091
+ return [cached == null ? void 0 : cached.kind, cached == null ? void 0 : cached.moduleSpecifiers, moduleSourceFile, cached == null ? void 0 : cached.modulePaths, cache];
44089
44092
  }
44090
44093
  function getModuleSpecifiers(moduleSymbol, checker, compilerOptions, importingSourceFile, host, userPreferences, options = {}) {
44091
44094
  return getModuleSpecifiersWithCacheInfo(
@@ -44103,16 +44106,16 @@ function getModuleSpecifiers(moduleSymbol, checker, compilerOptions, importingSo
44103
44106
  function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
44104
44107
  let computedWithoutCache = false;
44105
44108
  const ambient = tryGetModuleNameFromAmbientModule(moduleSymbol, checker);
44106
- if (ambient) return { moduleSpecifiers: [ambient], computedWithoutCache };
44107
- let [specifiers, moduleSourceFile, modulePaths, cache] = tryGetModuleSpecifiersFromCacheWorker(
44109
+ if (ambient) return { kind: "ambient", moduleSpecifiers: [ambient], computedWithoutCache };
44110
+ let [kind, specifiers, moduleSourceFile, modulePaths, cache] = tryGetModuleSpecifiersFromCacheWorker(
44108
44111
  moduleSymbol,
44109
44112
  importingSourceFile,
44110
44113
  host,
44111
44114
  userPreferences,
44112
44115
  options
44113
44116
  );
44114
- if (specifiers) return { moduleSpecifiers: specifiers, computedWithoutCache };
44115
- if (!moduleSourceFile) return { moduleSpecifiers: emptyArray, computedWithoutCache };
44117
+ if (specifiers) return { kind, moduleSpecifiers: specifiers, computedWithoutCache };
44118
+ if (!moduleSourceFile) return { kind: void 0, moduleSpecifiers: emptyArray, computedWithoutCache };
44116
44119
  computedWithoutCache = true;
44117
44120
  modulePaths || (modulePaths = getAllModulePathsWorker(getInfo(importingSourceFile.fileName, host), moduleSourceFile.originalFileName, host, compilerOptions, options));
44118
44121
  const result = computeModuleSpecifiers(
@@ -44124,8 +44127,8 @@ function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions
44124
44127
  options,
44125
44128
  forAutoImport
44126
44129
  );
44127
- cache == null ? void 0 : cache.set(importingSourceFile.path, moduleSourceFile.path, userPreferences, options, modulePaths, result);
44128
- return { moduleSpecifiers: result, computedWithoutCache };
44130
+ cache == null ? void 0 : cache.set(importingSourceFile.path, moduleSourceFile.path, userPreferences, options, result.kind, modulePaths, result.moduleSpecifiers);
44131
+ return result;
44129
44132
  }
44130
44133
  function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
44131
44134
  const info = getInfo(importingSourceFile.fileName, host);
@@ -44144,8 +44147,7 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
44144
44147
  }
44145
44148
  ));
44146
44149
  if (existingSpecifier) {
44147
- const moduleSpecifiers = [existingSpecifier];
44148
- return moduleSpecifiers;
44150
+ return { kind: void 0, moduleSpecifiers: [existingSpecifier], computedWithoutCache: true };
44149
44151
  }
44150
44152
  const importedFileIsInNodeModules = some(modulePaths, (p) => p.isInNodeModules);
44151
44153
  let nodeModulesSpecifiers;
@@ -44166,7 +44168,7 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
44166
44168
  ) : void 0;
44167
44169
  nodeModulesSpecifiers = append(nodeModulesSpecifiers, specifier);
44168
44170
  if (specifier && modulePath.isRedirect) {
44169
- return nodeModulesSpecifiers;
44171
+ return { kind: "node_modules", moduleSpecifiers: nodeModulesSpecifiers, computedWithoutCache: true };
44170
44172
  }
44171
44173
  if (!specifier) {
44172
44174
  const local = getLocalModuleSpecifier(
@@ -44195,7 +44197,7 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
44195
44197
  }
44196
44198
  }
44197
44199
  }
44198
- return (pathsSpecifiers == null ? void 0 : pathsSpecifiers.length) ? pathsSpecifiers : (redirectPathsSpecifiers == null ? void 0 : redirectPathsSpecifiers.length) ? redirectPathsSpecifiers : (nodeModulesSpecifiers == null ? void 0 : nodeModulesSpecifiers.length) ? nodeModulesSpecifiers : Debug.checkDefined(relativeSpecifiers);
44200
+ 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 };
44199
44201
  }
44200
44202
  function getInfo(importingSourceFileName, host) {
44201
44203
  importingSourceFileName = getNormalizedAbsolutePath(importingSourceFileName, host.getCurrentDirectory());
@@ -46090,8 +46092,8 @@ function createTypeChecker(host) {
46090
46092
  void 0
46091
46093
  );
46092
46094
  }
46093
- function getEmitResolver(sourceFile, cancellationToken2) {
46094
- getDiagnostics(sourceFile, cancellationToken2);
46095
+ function getEmitResolver(sourceFile, cancellationToken2, skipDiagnostics) {
46096
+ if (!skipDiagnostics) getDiagnostics(sourceFile, cancellationToken2);
46095
46097
  return emitResolver;
46096
46098
  }
46097
46099
  function lookupOrIssueError(location, message, ...args) {
@@ -49019,8 +49021,15 @@ function createTypeChecker(host) {
49019
49021
  ).accessibility === 0 /* Accessible */) {
49020
49022
  return { accessibility: 0 /* Accessible */ };
49021
49023
  }
49022
- return symbol && hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) || {
49023
- accessibility: 3 /* NotResolved */,
49024
+ if (!symbol) {
49025
+ return {
49026
+ accessibility: 3 /* NotResolved */,
49027
+ errorSymbolName: getTextOfNode(firstIdentifier),
49028
+ errorNode: firstIdentifier
49029
+ };
49030
+ }
49031
+ return hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) || {
49032
+ accessibility: 1 /* NotAccessible */,
49024
49033
  errorSymbolName: getTextOfNode(firstIdentifier),
49025
49034
  errorNode: firstIdentifier
49026
49035
  };
@@ -112460,6 +112469,9 @@ function getFirstProjectOutput(configFile, ignoreCase) {
112460
112469
  if (buildInfoPath) return buildInfoPath;
112461
112470
  return Debug.fail(`project ${configFile.options.configFilePath} expected to have at least one output`);
112462
112471
  }
112472
+ function emitResolverSkipsTypeChecking(emitOnly, forceDtsEmit) {
112473
+ return !!forceDtsEmit && !!emitOnly;
112474
+ }
112463
112475
  function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, declarationTransformers }, emitOnly, onlyBuildInfo, forceDtsEmit) {
112464
112476
  var compilerOptions = host.getCompilerOptions();
112465
112477
  var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap || getAreDeclarationMapsEnabled(compilerOptions) ? [] : void 0;
@@ -112577,7 +112589,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
112577
112589
  const sourceFiles = isSourceFile(sourceFileOrBundle) ? [sourceFileOrBundle] : sourceFileOrBundle.sourceFiles;
112578
112590
  const filesForEmit = forceDtsEmit ? sourceFiles : filter(sourceFiles, isSourceFileNotJson);
112579
112591
  const inputListOrBundle = compilerOptions.outFile ? [factory.createBundle(filesForEmit)] : filesForEmit;
112580
- if (emitOnly && !getEmitDeclarations(compilerOptions) || compilerOptions.noCheck) {
112592
+ if (emitOnly && !getEmitDeclarations(compilerOptions) || compilerOptions.noCheck || emitResolverSkipsTypeChecking(emitOnly, forceDtsEmit)) {
112581
112593
  filesForEmit.forEach(collectLinkedAliases);
112582
112594
  }
112583
112595
  const declarationTransform = transformNodes(
@@ -119513,17 +119525,25 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
119513
119525
  const result = handleNoEmitOptions(program2, sourceFile, writeFileCallback, cancellationToken);
119514
119526
  if (result) return result;
119515
119527
  }
119516
- const emitResolver = getTypeChecker().getEmitResolver(options.outFile ? void 0 : sourceFile, cancellationToken);
119528
+ const typeChecker2 = getTypeChecker();
119529
+ const emitResolver = typeChecker2.getEmitResolver(
119530
+ options.outFile ? void 0 : sourceFile,
119531
+ cancellationToken,
119532
+ emitResolverSkipsTypeChecking(emitOnly, forceDtsEmit)
119533
+ );
119517
119534
  mark("beforeEmit");
119518
- const emitResult = emitFiles(
119519
- emitResolver,
119520
- getEmitHost(writeFileCallback),
119521
- sourceFile,
119522
- getTransformers(options, customTransformers, emitOnly),
119523
- emitOnly,
119524
- /*onlyBuildInfo*/
119525
- false,
119526
- forceDtsEmit
119535
+ const emitResult = typeChecker2.runWithCancellationToken(
119536
+ cancellationToken,
119537
+ () => emitFiles(
119538
+ emitResolver,
119539
+ getEmitHost(writeFileCallback),
119540
+ sourceFile,
119541
+ getTransformers(options, customTransformers, emitOnly),
119542
+ emitOnly,
119543
+ /*onlyBuildInfo*/
119544
+ false,
119545
+ forceDtsEmit
119546
+ )
119527
119547
  );
119528
119548
  mark("afterEmit");
119529
119549
  measure("Emit", "beforeEmit", "afterEmit");
@@ -122474,7 +122494,7 @@ function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken
122474
122494
  host
122475
122495
  );
122476
122496
  }
122477
- function handleDtsMayChangeOf(state, path, cancellationToken, host) {
122497
+ function handleDtsMayChangeOf(state, path, invalidateJsFiles, cancellationToken, host) {
122478
122498
  removeSemanticDiagnosticsOf(state, path);
122479
122499
  if (!state.changedFilesSet.has(path)) {
122480
122500
  const program = Debug.checkDefined(state.program);
@@ -122489,7 +122509,9 @@ function handleDtsMayChangeOf(state, path, cancellationToken, host) {
122489
122509
  /*useFileVersionAsSignature*/
122490
122510
  true
122491
122511
  );
122492
- if (getEmitDeclarations(state.compilerOptions)) {
122512
+ if (invalidateJsFiles) {
122513
+ addToAffectedFilesPendingEmit(state, path, getBuilderFileEmit(state.compilerOptions));
122514
+ } else if (getEmitDeclarations(state.compilerOptions)) {
122493
122515
  addToAffectedFilesPendingEmit(state, path, state.compilerOptions.declarationMap ? 24 /* AllDts */ : 8 /* Dts */);
122494
122516
  }
122495
122517
  }
@@ -122508,7 +122530,7 @@ function isChangedSignature(state, path) {
122508
122530
  const newSignature = Debug.checkDefined(state.fileInfos.get(path)).signature;
122509
122531
  return newSignature !== oldSignature;
122510
122532
  }
122511
- function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, host) {
122533
+ function handleDtsMayChangeOfGlobalScope(state, filePath, invalidateJsFiles, cancellationToken, host) {
122512
122534
  var _a;
122513
122535
  if (!((_a = state.fileInfos.get(filePath)) == null ? void 0 : _a.affectsGlobalScope)) return false;
122514
122536
  BuilderState.getAllFilesExcludingDefaultLibraryFile(
@@ -122520,6 +122542,7 @@ function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, hos
122520
122542
  (file) => handleDtsMayChangeOf(
122521
122543
  state,
122522
122544
  file.resolvedPath,
122545
+ invalidateJsFiles,
122523
122546
  cancellationToken,
122524
122547
  host
122525
122548
  )
@@ -122528,7 +122551,7 @@ function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, hos
122528
122551
  return true;
122529
122552
  }
122530
122553
  function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, host) {
122531
- var _a;
122554
+ var _a, _b;
122532
122555
  if (!state.referencedMap || !state.changedFilesSet.has(affectedFile.resolvedPath)) return;
122533
122556
  if (!isChangedSignature(state, affectedFile.resolvedPath)) return;
122534
122557
  if (getIsolatedModules(state.compilerOptions)) {
@@ -122539,8 +122562,22 @@ function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile
122539
122562
  const currentPath = queue.pop();
122540
122563
  if (!seenFileNamesMap.has(currentPath)) {
122541
122564
  seenFileNamesMap.set(currentPath, true);
122542
- if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, host)) return;
122543
- handleDtsMayChangeOf(state, currentPath, cancellationToken, host);
122565
+ if (handleDtsMayChangeOfGlobalScope(
122566
+ state,
122567
+ currentPath,
122568
+ /*invalidateJsFiles*/
122569
+ false,
122570
+ cancellationToken,
122571
+ host
122572
+ )) return;
122573
+ handleDtsMayChangeOf(
122574
+ state,
122575
+ currentPath,
122576
+ /*invalidateJsFiles*/
122577
+ false,
122578
+ cancellationToken,
122579
+ host
122580
+ );
122544
122581
  if (isChangedSignature(state, currentPath)) {
122545
122582
  const currentSourceFile = Debug.checkDefined(state.program).getSourceFileByPath(currentPath);
122546
122583
  queue.push(...BuilderState.getReferencedByPaths(state, currentSourceFile.resolvedPath));
@@ -122549,27 +122586,38 @@ function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile
122549
122586
  }
122550
122587
  }
122551
122588
  const seenFileAndExportsOfFile = /* @__PURE__ */ new Set();
122552
- (_a = state.referencedMap.getKeys(affectedFile.resolvedPath)) == null ? void 0 : _a.forEach((exportedFromPath) => {
122553
- if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, host)) return true;
122589
+ const invalidateJsFiles = !!((_a = affectedFile.symbol) == null ? void 0 : _a.exports) && !!forEachEntry(
122590
+ affectedFile.symbol.exports,
122591
+ (exported) => {
122592
+ if ((exported.flags & 128 /* ConstEnum */) !== 0) return true;
122593
+ const aliased = skipAlias(exported, state.program.getTypeChecker());
122594
+ if (aliased === exported) return false;
122595
+ return (aliased.flags & 128 /* ConstEnum */) !== 0 && some(aliased.declarations, (d) => getSourceFileOfNode(d) === affectedFile);
122596
+ }
122597
+ );
122598
+ (_b = state.referencedMap.getKeys(affectedFile.resolvedPath)) == null ? void 0 : _b.forEach((exportedFromPath) => {
122599
+ if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, invalidateJsFiles, cancellationToken, host)) return true;
122554
122600
  const references = state.referencedMap.getKeys(exportedFromPath);
122555
122601
  return references && forEachKey(references, (filePath) => handleDtsMayChangeOfFileAndExportsOfFile(
122556
122602
  state,
122557
122603
  filePath,
122604
+ invalidateJsFiles,
122558
122605
  seenFileAndExportsOfFile,
122559
122606
  cancellationToken,
122560
122607
  host
122561
122608
  ));
122562
122609
  });
122563
122610
  }
122564
- function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, host) {
122611
+ function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, invalidateJsFiles, seenFileAndExportsOfFile, cancellationToken, host) {
122565
122612
  var _a;
122566
122613
  if (!tryAddToSet(seenFileAndExportsOfFile, filePath)) return void 0;
122567
- if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, host)) return true;
122568
- handleDtsMayChangeOf(state, filePath, cancellationToken, host);
122614
+ if (handleDtsMayChangeOfGlobalScope(state, filePath, invalidateJsFiles, cancellationToken, host)) return true;
122615
+ handleDtsMayChangeOf(state, filePath, invalidateJsFiles, cancellationToken, host);
122569
122616
  (_a = state.referencedMap.getKeys(filePath)) == null ? void 0 : _a.forEach(
122570
122617
  (referencingFilePath) => handleDtsMayChangeOfFileAndExportsOfFile(
122571
122618
  state,
122572
122619
  referencingFilePath,
122620
+ invalidateJsFiles,
122573
122621
  seenFileAndExportsOfFile,
122574
122622
  cancellationToken,
122575
122623
  host
package/lib/typescript.js CHANGED
@@ -532,6 +532,7 @@ __export(typescript_exports, {
532
532
  emitNewLineBeforeLeadingCommentOfPosition: () => emitNewLineBeforeLeadingCommentOfPosition,
533
533
  emitNewLineBeforeLeadingComments: () => emitNewLineBeforeLeadingComments,
534
534
  emitNewLineBeforeLeadingCommentsOfPosition: () => emitNewLineBeforeLeadingCommentsOfPosition,
535
+ emitResolverSkipsTypeChecking: () => emitResolverSkipsTypeChecking,
535
536
  emitSkippedWithNoDiagnostics: () => emitSkippedWithNoDiagnostics,
536
537
  emptyArray: () => emptyArray,
537
538
  emptyFileSystemEntries: () => emptyFileSystemEntries,
@@ -2368,7 +2369,7 @@ module.exports = __toCommonJS(typescript_exports);
2368
2369
 
2369
2370
  // src/compiler/corePublic.ts
2370
2371
  var versionMajorMinor = "5.5";
2371
- var version = `${versionMajorMinor}.0-dev.20240521`;
2372
+ var version = `${versionMajorMinor}.0-dev.20240522`;
2372
2373
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2373
2374
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2374
2375
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -15259,7 +15260,7 @@ function getTextOfJSDocComment(comment) {
15259
15260
  function formatJSDocLink(link) {
15260
15261
  const kind = link.kind === 324 /* JSDocLink */ ? "link" : link.kind === 325 /* JSDocLinkCode */ ? "linkcode" : "linkplain";
15261
15262
  const name = link.name ? entityNameToString(link.name) : "";
15262
- const space = link.name && link.text.startsWith("://") ? "" : " ";
15263
+ const space = link.name && (link.text === "" || link.text.startsWith("://")) ? "" : " ";
15263
15264
  return `{@${kind} ${name}${space}${link.text}}`;
15264
15265
  }
15265
15266
  function getEffectiveTypeParameterDeclarations(node) {
@@ -48837,13 +48838,14 @@ function getModuleSpecifierWorker(compilerOptions, importingSourceFile, importin
48837
48838
  )) || getLocalModuleSpecifier(toFileName2, info, compilerOptions, host, options.overrideImportMode || getDefaultResolutionModeForFile(importingSourceFile, host, compilerOptions), preferences);
48838
48839
  }
48839
48840
  function tryGetModuleSpecifiersFromCache(moduleSymbol, importingSourceFile, host, userPreferences, options = {}) {
48840
- return tryGetModuleSpecifiersFromCacheWorker(
48841
+ const result = tryGetModuleSpecifiersFromCacheWorker(
48841
48842
  moduleSymbol,
48842
48843
  importingSourceFile,
48843
48844
  host,
48844
48845
  userPreferences,
48845
48846
  options
48846
- )[0];
48847
+ );
48848
+ return result[1] && { kind: result[0], moduleSpecifiers: result[1], computedWithoutCache: false };
48847
48849
  }
48848
48850
  function tryGetModuleSpecifiersFromCacheWorker(moduleSymbol, importingSourceFile, host, userPreferences, options = {}) {
48849
48851
  var _a;
@@ -48853,7 +48855,7 @@ function tryGetModuleSpecifiersFromCacheWorker(moduleSymbol, importingSourceFile
48853
48855
  }
48854
48856
  const cache = (_a = host.getModuleSpecifierCache) == null ? void 0 : _a.call(host);
48855
48857
  const cached = cache == null ? void 0 : cache.get(importingSourceFile.path, moduleSourceFile.path, userPreferences, options);
48856
- return [cached == null ? void 0 : cached.moduleSpecifiers, moduleSourceFile, cached == null ? void 0 : cached.modulePaths, cache];
48858
+ return [cached == null ? void 0 : cached.kind, cached == null ? void 0 : cached.moduleSpecifiers, moduleSourceFile, cached == null ? void 0 : cached.modulePaths, cache];
48857
48859
  }
48858
48860
  function getModuleSpecifiers(moduleSymbol, checker, compilerOptions, importingSourceFile, host, userPreferences, options = {}) {
48859
48861
  return getModuleSpecifiersWithCacheInfo(
@@ -48871,16 +48873,16 @@ function getModuleSpecifiers(moduleSymbol, checker, compilerOptions, importingSo
48871
48873
  function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
48872
48874
  let computedWithoutCache = false;
48873
48875
  const ambient = tryGetModuleNameFromAmbientModule(moduleSymbol, checker);
48874
- if (ambient) return { moduleSpecifiers: [ambient], computedWithoutCache };
48875
- let [specifiers, moduleSourceFile, modulePaths, cache] = tryGetModuleSpecifiersFromCacheWorker(
48876
+ if (ambient) return { kind: "ambient", moduleSpecifiers: [ambient], computedWithoutCache };
48877
+ let [kind, specifiers, moduleSourceFile, modulePaths, cache] = tryGetModuleSpecifiersFromCacheWorker(
48876
48878
  moduleSymbol,
48877
48879
  importingSourceFile,
48878
48880
  host,
48879
48881
  userPreferences,
48880
48882
  options
48881
48883
  );
48882
- if (specifiers) return { moduleSpecifiers: specifiers, computedWithoutCache };
48883
- if (!moduleSourceFile) return { moduleSpecifiers: emptyArray, computedWithoutCache };
48884
+ if (specifiers) return { kind, moduleSpecifiers: specifiers, computedWithoutCache };
48885
+ if (!moduleSourceFile) return { kind: void 0, moduleSpecifiers: emptyArray, computedWithoutCache };
48884
48886
  computedWithoutCache = true;
48885
48887
  modulePaths || (modulePaths = getAllModulePathsWorker(getInfo(importingSourceFile.fileName, host), moduleSourceFile.originalFileName, host, compilerOptions, options));
48886
48888
  const result = computeModuleSpecifiers(
@@ -48892,8 +48894,8 @@ function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions
48892
48894
  options,
48893
48895
  forAutoImport
48894
48896
  );
48895
- cache == null ? void 0 : cache.set(importingSourceFile.path, moduleSourceFile.path, userPreferences, options, modulePaths, result);
48896
- return { moduleSpecifiers: result, computedWithoutCache };
48897
+ cache == null ? void 0 : cache.set(importingSourceFile.path, moduleSourceFile.path, userPreferences, options, result.kind, modulePaths, result.moduleSpecifiers);
48898
+ return result;
48897
48899
  }
48898
48900
  function getLocalModuleSpecifierBetweenFileNames(importingFile, targetFileName, compilerOptions, host, options = {}) {
48899
48901
  const info = getInfo(importingFile.fileName, host);
@@ -48924,8 +48926,7 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
48924
48926
  }
48925
48927
  ));
48926
48928
  if (existingSpecifier) {
48927
- const moduleSpecifiers = [existingSpecifier];
48928
- return moduleSpecifiers;
48929
+ return { kind: void 0, moduleSpecifiers: [existingSpecifier], computedWithoutCache: true };
48929
48930
  }
48930
48931
  const importedFileIsInNodeModules = some(modulePaths, (p) => p.isInNodeModules);
48931
48932
  let nodeModulesSpecifiers;
@@ -48946,7 +48947,7 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
48946
48947
  ) : void 0;
48947
48948
  nodeModulesSpecifiers = append(nodeModulesSpecifiers, specifier);
48948
48949
  if (specifier && modulePath.isRedirect) {
48949
- return nodeModulesSpecifiers;
48950
+ return { kind: "node_modules", moduleSpecifiers: nodeModulesSpecifiers, computedWithoutCache: true };
48950
48951
  }
48951
48952
  if (!specifier) {
48952
48953
  const local = getLocalModuleSpecifier(
@@ -48975,7 +48976,7 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
48975
48976
  }
48976
48977
  }
48977
48978
  }
48978
- return (pathsSpecifiers == null ? void 0 : pathsSpecifiers.length) ? pathsSpecifiers : (redirectPathsSpecifiers == null ? void 0 : redirectPathsSpecifiers.length) ? redirectPathsSpecifiers : (nodeModulesSpecifiers == null ? void 0 : nodeModulesSpecifiers.length) ? nodeModulesSpecifiers : Debug.checkDefined(relativeSpecifiers);
48979
+ 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 };
48979
48980
  }
48980
48981
  function getInfo(importingSourceFileName, host) {
48981
48982
  importingSourceFileName = getNormalizedAbsolutePath(importingSourceFileName, host.getCurrentDirectory());
@@ -50885,8 +50886,8 @@ function createTypeChecker(host) {
50885
50886
  void 0
50886
50887
  );
50887
50888
  }
50888
- function getEmitResolver(sourceFile, cancellationToken2) {
50889
- getDiagnostics2(sourceFile, cancellationToken2);
50889
+ function getEmitResolver(sourceFile, cancellationToken2, skipDiagnostics) {
50890
+ if (!skipDiagnostics) getDiagnostics2(sourceFile, cancellationToken2);
50890
50891
  return emitResolver;
50891
50892
  }
50892
50893
  function lookupOrIssueError(location, message, ...args) {
@@ -53814,8 +53815,15 @@ function createTypeChecker(host) {
53814
53815
  ).accessibility === 0 /* Accessible */) {
53815
53816
  return { accessibility: 0 /* Accessible */ };
53816
53817
  }
53817
- return symbol && hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) || {
53818
- accessibility: 3 /* NotResolved */,
53818
+ if (!symbol) {
53819
+ return {
53820
+ accessibility: 3 /* NotResolved */,
53821
+ errorSymbolName: getTextOfNode(firstIdentifier),
53822
+ errorNode: firstIdentifier
53823
+ };
53824
+ }
53825
+ return hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) || {
53826
+ accessibility: 1 /* NotAccessible */,
53819
53827
  errorSymbolName: getTextOfNode(firstIdentifier),
53820
53828
  errorNode: firstIdentifier
53821
53829
  };
@@ -117448,6 +117456,9 @@ function getFirstProjectOutput(configFile, ignoreCase) {
117448
117456
  if (buildInfoPath) return buildInfoPath;
117449
117457
  return Debug.fail(`project ${configFile.options.configFilePath} expected to have at least one output`);
117450
117458
  }
117459
+ function emitResolverSkipsTypeChecking(emitOnly, forceDtsEmit) {
117460
+ return !!forceDtsEmit && !!emitOnly;
117461
+ }
117451
117462
  function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, declarationTransformers }, emitOnly, onlyBuildInfo, forceDtsEmit) {
117452
117463
  var compilerOptions = host.getCompilerOptions();
117453
117464
  var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap || getAreDeclarationMapsEnabled(compilerOptions) ? [] : void 0;
@@ -117565,7 +117576,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
117565
117576
  const sourceFiles = isSourceFile(sourceFileOrBundle) ? [sourceFileOrBundle] : sourceFileOrBundle.sourceFiles;
117566
117577
  const filesForEmit = forceDtsEmit ? sourceFiles : filter(sourceFiles, isSourceFileNotJson);
117567
117578
  const inputListOrBundle = compilerOptions.outFile ? [factory.createBundle(filesForEmit)] : filesForEmit;
117568
- if (emitOnly && !getEmitDeclarations(compilerOptions) || compilerOptions.noCheck) {
117579
+ if (emitOnly && !getEmitDeclarations(compilerOptions) || compilerOptions.noCheck || emitResolverSkipsTypeChecking(emitOnly, forceDtsEmit)) {
117569
117580
  filesForEmit.forEach(collectLinkedAliases);
117570
117581
  }
117571
117582
  const declarationTransform = transformNodes(
@@ -124547,17 +124558,25 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
124547
124558
  const result = handleNoEmitOptions(program2, sourceFile, writeFileCallback, cancellationToken);
124548
124559
  if (result) return result;
124549
124560
  }
124550
- const emitResolver = getTypeChecker().getEmitResolver(options.outFile ? void 0 : sourceFile, cancellationToken);
124561
+ const typeChecker2 = getTypeChecker();
124562
+ const emitResolver = typeChecker2.getEmitResolver(
124563
+ options.outFile ? void 0 : sourceFile,
124564
+ cancellationToken,
124565
+ emitResolverSkipsTypeChecking(emitOnly, forceDtsEmit)
124566
+ );
124551
124567
  mark("beforeEmit");
124552
- const emitResult = emitFiles(
124553
- emitResolver,
124554
- getEmitHost(writeFileCallback),
124555
- sourceFile,
124556
- getTransformers(options, customTransformers, emitOnly),
124557
- emitOnly,
124558
- /*onlyBuildInfo*/
124559
- false,
124560
- forceDtsEmit
124568
+ const emitResult = typeChecker2.runWithCancellationToken(
124569
+ cancellationToken,
124570
+ () => emitFiles(
124571
+ emitResolver,
124572
+ getEmitHost(writeFileCallback),
124573
+ sourceFile,
124574
+ getTransformers(options, customTransformers, emitOnly),
124575
+ emitOnly,
124576
+ /*onlyBuildInfo*/
124577
+ false,
124578
+ forceDtsEmit
124579
+ )
124561
124580
  );
124562
124581
  mark("afterEmit");
124563
124582
  measure("Emit", "beforeEmit", "afterEmit");
@@ -127534,7 +127553,7 @@ function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken
127534
127553
  host
127535
127554
  );
127536
127555
  }
127537
- function handleDtsMayChangeOf(state, path, cancellationToken, host) {
127556
+ function handleDtsMayChangeOf(state, path, invalidateJsFiles, cancellationToken, host) {
127538
127557
  removeSemanticDiagnosticsOf(state, path);
127539
127558
  if (!state.changedFilesSet.has(path)) {
127540
127559
  const program = Debug.checkDefined(state.program);
@@ -127549,7 +127568,9 @@ function handleDtsMayChangeOf(state, path, cancellationToken, host) {
127549
127568
  /*useFileVersionAsSignature*/
127550
127569
  true
127551
127570
  );
127552
- if (getEmitDeclarations(state.compilerOptions)) {
127571
+ if (invalidateJsFiles) {
127572
+ addToAffectedFilesPendingEmit(state, path, getBuilderFileEmit(state.compilerOptions));
127573
+ } else if (getEmitDeclarations(state.compilerOptions)) {
127553
127574
  addToAffectedFilesPendingEmit(state, path, state.compilerOptions.declarationMap ? 24 /* AllDts */ : 8 /* Dts */);
127554
127575
  }
127555
127576
  }
@@ -127568,7 +127589,7 @@ function isChangedSignature(state, path) {
127568
127589
  const newSignature = Debug.checkDefined(state.fileInfos.get(path)).signature;
127569
127590
  return newSignature !== oldSignature;
127570
127591
  }
127571
- function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, host) {
127592
+ function handleDtsMayChangeOfGlobalScope(state, filePath, invalidateJsFiles, cancellationToken, host) {
127572
127593
  var _a;
127573
127594
  if (!((_a = state.fileInfos.get(filePath)) == null ? void 0 : _a.affectsGlobalScope)) return false;
127574
127595
  BuilderState.getAllFilesExcludingDefaultLibraryFile(
@@ -127580,6 +127601,7 @@ function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, hos
127580
127601
  (file) => handleDtsMayChangeOf(
127581
127602
  state,
127582
127603
  file.resolvedPath,
127604
+ invalidateJsFiles,
127583
127605
  cancellationToken,
127584
127606
  host
127585
127607
  )
@@ -127588,7 +127610,7 @@ function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, hos
127588
127610
  return true;
127589
127611
  }
127590
127612
  function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, host) {
127591
- var _a;
127613
+ var _a, _b;
127592
127614
  if (!state.referencedMap || !state.changedFilesSet.has(affectedFile.resolvedPath)) return;
127593
127615
  if (!isChangedSignature(state, affectedFile.resolvedPath)) return;
127594
127616
  if (getIsolatedModules(state.compilerOptions)) {
@@ -127599,8 +127621,22 @@ function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile
127599
127621
  const currentPath = queue.pop();
127600
127622
  if (!seenFileNamesMap.has(currentPath)) {
127601
127623
  seenFileNamesMap.set(currentPath, true);
127602
- if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, host)) return;
127603
- handleDtsMayChangeOf(state, currentPath, cancellationToken, host);
127624
+ if (handleDtsMayChangeOfGlobalScope(
127625
+ state,
127626
+ currentPath,
127627
+ /*invalidateJsFiles*/
127628
+ false,
127629
+ cancellationToken,
127630
+ host
127631
+ )) return;
127632
+ handleDtsMayChangeOf(
127633
+ state,
127634
+ currentPath,
127635
+ /*invalidateJsFiles*/
127636
+ false,
127637
+ cancellationToken,
127638
+ host
127639
+ );
127604
127640
  if (isChangedSignature(state, currentPath)) {
127605
127641
  const currentSourceFile = Debug.checkDefined(state.program).getSourceFileByPath(currentPath);
127606
127642
  queue.push(...BuilderState.getReferencedByPaths(state, currentSourceFile.resolvedPath));
@@ -127609,27 +127645,38 @@ function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile
127609
127645
  }
127610
127646
  }
127611
127647
  const seenFileAndExportsOfFile = /* @__PURE__ */ new Set();
127612
- (_a = state.referencedMap.getKeys(affectedFile.resolvedPath)) == null ? void 0 : _a.forEach((exportedFromPath) => {
127613
- if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, host)) return true;
127648
+ const invalidateJsFiles = !!((_a = affectedFile.symbol) == null ? void 0 : _a.exports) && !!forEachEntry(
127649
+ affectedFile.symbol.exports,
127650
+ (exported) => {
127651
+ if ((exported.flags & 128 /* ConstEnum */) !== 0) return true;
127652
+ const aliased = skipAlias(exported, state.program.getTypeChecker());
127653
+ if (aliased === exported) return false;
127654
+ return (aliased.flags & 128 /* ConstEnum */) !== 0 && some(aliased.declarations, (d) => getSourceFileOfNode(d) === affectedFile);
127655
+ }
127656
+ );
127657
+ (_b = state.referencedMap.getKeys(affectedFile.resolvedPath)) == null ? void 0 : _b.forEach((exportedFromPath) => {
127658
+ if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, invalidateJsFiles, cancellationToken, host)) return true;
127614
127659
  const references = state.referencedMap.getKeys(exportedFromPath);
127615
127660
  return references && forEachKey(references, (filePath) => handleDtsMayChangeOfFileAndExportsOfFile(
127616
127661
  state,
127617
127662
  filePath,
127663
+ invalidateJsFiles,
127618
127664
  seenFileAndExportsOfFile,
127619
127665
  cancellationToken,
127620
127666
  host
127621
127667
  ));
127622
127668
  });
127623
127669
  }
127624
- function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, host) {
127670
+ function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, invalidateJsFiles, seenFileAndExportsOfFile, cancellationToken, host) {
127625
127671
  var _a;
127626
127672
  if (!tryAddToSet(seenFileAndExportsOfFile, filePath)) return void 0;
127627
- if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, host)) return true;
127628
- handleDtsMayChangeOf(state, filePath, cancellationToken, host);
127673
+ if (handleDtsMayChangeOfGlobalScope(state, filePath, invalidateJsFiles, cancellationToken, host)) return true;
127674
+ handleDtsMayChangeOf(state, filePath, invalidateJsFiles, cancellationToken, host);
127629
127675
  (_a = state.referencedMap.getKeys(filePath)) == null ? void 0 : _a.forEach(
127630
127676
  (referencingFilePath) => handleDtsMayChangeOfFileAndExportsOfFile(
127631
127677
  state,
127632
127678
  referencingFilePath,
127679
+ invalidateJsFiles,
127633
127680
  seenFileAndExportsOfFile,
127634
127681
  cancellationToken,
127635
127682
  host
@@ -153720,6 +153767,7 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
153720
153767
  );
153721
153768
  const fix = {
153722
153769
  kind: 3 /* AddNew */,
153770
+ moduleSpecifierKind: "relative",
153723
153771
  moduleSpecifier,
153724
153772
  importKind,
153725
153773
  addAsTypeOnly,
@@ -154062,7 +154110,7 @@ function createImportSpecifierResolver(importingFile, program, host, preferences
154062
154110
  importMap,
154063
154111
  fromCacheOnly
154064
154112
  );
154065
- const result = getBestFix(fixes, importingFile, program, packageJsonImportFilter, host);
154113
+ const result = getBestFix(fixes, importingFile, program, packageJsonImportFilter, host, preferences);
154066
154114
  return result && { ...result, computedWithoutCacheCount };
154067
154115
  }
154068
154116
  }
@@ -154109,7 +154157,7 @@ function getPromoteTypeOnlyCompletionAction(sourceFile, symbolToken, program, ho
154109
154157
  }
154110
154158
  function getImportFixForSymbol(sourceFile, exportInfos, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
154111
154159
  const packageJsonImportFilter = createPackageJsonImportFilter(sourceFile, preferences, host);
154112
- return getBestFix(getImportFixes(exportInfos, position, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes, sourceFile, program, packageJsonImportFilter, host);
154160
+ return getBestFix(getImportFixes(exportInfos, position, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes, sourceFile, program, packageJsonImportFilter, host, preferences);
154113
154161
  }
154114
154162
  function codeFixActionToCodeAction({ description: description3, changes, commands }) {
154115
154163
  return { description: description3, changes, commands };
@@ -154184,7 +154232,7 @@ function tryUseExistingNamespaceImport(existingImports, position) {
154184
154232
  const namespacePrefix = getNamespaceLikeImportText(declaration);
154185
154233
  const moduleSpecifier = namespacePrefix && ((_a = tryGetModuleSpecifierFromDeclaration(declaration)) == null ? void 0 : _a.text);
154186
154234
  if (moduleSpecifier) {
154187
- return { kind: 0 /* UseNamespace */, namespacePrefix, usagePosition: position, moduleSpecifier };
154235
+ return { kind: 0 /* UseNamespace */, namespacePrefix, usagePosition: position, moduleSpecifierKind: void 0, moduleSpecifier };
154188
154236
  }
154189
154237
  });
154190
154238
  }
@@ -154228,7 +154276,7 @@ function tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker
154228
154276
  return void 0;
154229
154277
  }
154230
154278
  if (declaration.kind === 260 /* VariableDeclaration */) {
154231
- return (importKind === 0 /* Named */ || importKind === 1 /* Default */) && declaration.name.kind === 206 /* ObjectBindingPattern */ ? { kind: 2 /* AddToExisting */, importClauseOrBindingPattern: declaration.name, importKind, moduleSpecifier: declaration.initializer.arguments[0].text, addAsTypeOnly: 4 /* NotAllowed */ } : void 0;
154279
+ return (importKind === 0 /* Named */ || importKind === 1 /* Default */) && declaration.name.kind === 206 /* ObjectBindingPattern */ ? { kind: 2 /* AddToExisting */, importClauseOrBindingPattern: declaration.name, importKind, moduleSpecifierKind: void 0, moduleSpecifier: declaration.initializer.arguments[0].text, addAsTypeOnly: 4 /* NotAllowed */ } : void 0;
154232
154280
  }
154233
154281
  const { importClause } = declaration;
154234
154282
  if (!importClause || !isStringLiteralLike(declaration.moduleSpecifier)) {
@@ -154258,6 +154306,7 @@ function tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker
154258
154306
  kind: 2 /* AddToExisting */,
154259
154307
  importClauseOrBindingPattern: importClause,
154260
154308
  importKind,
154309
+ moduleSpecifierKind: void 0,
154261
154310
  moduleSpecifier: declaration.moduleSpecifier.text,
154262
154311
  addAsTypeOnly
154263
154312
  };
@@ -154319,7 +154368,7 @@ function getNewImportFixes(program, sourceFile, usagePosition, isValidTypeOnlyUs
154319
154368
  const getChecker = createGetChecker(program, host);
154320
154369
  const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
154321
154370
  const rejectNodeModulesRelativePaths = moduleResolutionUsesNodeModules(moduleResolution);
154322
- const getModuleSpecifiers2 = fromCacheOnly ? (exportInfo2) => ({ moduleSpecifiers: ts_moduleSpecifiers_exports.tryGetModuleSpecifiersFromCache(exportInfo2.moduleSymbol, sourceFile, moduleSpecifierResolutionHost, preferences), computedWithoutCache: false }) : (exportInfo2, checker) => ts_moduleSpecifiers_exports.getModuleSpecifiersWithCacheInfo(
154371
+ const getModuleSpecifiers2 = fromCacheOnly ? (exportInfo2) => ts_moduleSpecifiers_exports.tryGetModuleSpecifiersFromCache(exportInfo2.moduleSymbol, sourceFile, moduleSpecifierResolutionHost, preferences) : (exportInfo2, checker) => ts_moduleSpecifiers_exports.getModuleSpecifiersWithCacheInfo(
154323
154372
  exportInfo2.moduleSymbol,
154324
154373
  checker,
154325
154374
  compilerOptions,
@@ -154334,7 +154383,7 @@ function getNewImportFixes(program, sourceFile, usagePosition, isValidTypeOnlyUs
154334
154383
  let computedWithoutCacheCount = 0;
154335
154384
  const fixes = flatMap(exportInfo, (exportInfo2, i) => {
154336
154385
  const checker = getChecker(exportInfo2.isFromPackageJson);
154337
- const { computedWithoutCache, moduleSpecifiers } = getModuleSpecifiers2(exportInfo2, checker);
154386
+ const { computedWithoutCache, moduleSpecifiers, kind: moduleSpecifierKind } = getModuleSpecifiers2(exportInfo2, checker) ?? {};
154338
154387
  const importedSymbolHasValueMeaning = !!(exportInfo2.targetFlags & 111551 /* Value */);
154339
154388
  const addAsTypeOnly = getAddAsTypeOnly(
154340
154389
  isValidTypeOnlyUseSite,
@@ -154351,7 +154400,7 @@ function getNewImportFixes(program, sourceFile, usagePosition, isValidTypeOnlyUs
154351
154400
  return void 0;
154352
154401
  }
154353
154402
  if (!importedSymbolHasValueMeaning && isJs && usagePosition !== void 0) {
154354
- return { kind: 1 /* JsdocTypeImport */, moduleSpecifier, usagePosition, exportInfo: exportInfo2, isReExport: i > 0 };
154403
+ return { kind: 1 /* JsdocTypeImport */, moduleSpecifierKind, moduleSpecifier, usagePosition, exportInfo: exportInfo2, isReExport: i > 0 };
154355
154404
  }
154356
154405
  const importKind = getImportKind(sourceFile, exportInfo2.exportKind, program);
154357
154406
  let qualification;
@@ -154378,6 +154427,7 @@ function getNewImportFixes(program, sourceFile, usagePosition, isValidTypeOnlyUs
154378
154427
  }
154379
154428
  return {
154380
154429
  kind: 3 /* AddNew */,
154430
+ moduleSpecifierKind,
154381
154431
  moduleSpecifier,
154382
154432
  importKind,
154383
154433
  useRequire,
@@ -154407,7 +154457,7 @@ function newImportInfoFromExistingSpecifier({ declaration, importKind, symbol, t
154407
154457
  checker,
154408
154458
  compilerOptions
154409
154459
  );
154410
- return { kind: 3 /* AddNew */, moduleSpecifier, importKind, addAsTypeOnly, useRequire };
154460
+ return { kind: 3 /* AddNew */, moduleSpecifierKind: void 0, moduleSpecifier, importKind, addAsTypeOnly, useRequire };
154411
154461
  }
154412
154462
  }
154413
154463
  function getFixInfos(context, errorCode, pos, useAutoImportProvider) {
@@ -154425,18 +154475,18 @@ function getFixInfos(context, errorCode, pos, useAutoImportProvider) {
154425
154475
  info = getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider);
154426
154476
  }
154427
154477
  const packageJsonImportFilter = createPackageJsonImportFilter(context.sourceFile, context.preferences, context.host);
154428
- return info && sortFixInfo(info, context.sourceFile, context.program, packageJsonImportFilter, context.host);
154478
+ return info && sortFixInfo(info, context.sourceFile, context.program, packageJsonImportFilter, context.host, context.preferences);
154429
154479
  }
154430
- function sortFixInfo(fixes, sourceFile, program, packageJsonImportFilter, host) {
154480
+ function sortFixInfo(fixes, sourceFile, program, packageJsonImportFilter, host, preferences) {
154431
154481
  const _toPath = (fileName) => toPath(fileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host));
154432
- return sort(fixes, (a, b) => compareBooleans(!!a.isJsxNamespaceFix, !!b.isJsxNamespaceFix) || compareValues(a.fix.kind, b.fix.kind) || compareModuleSpecifiers(a.fix, b.fix, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier, _toPath));
154482
+ return sort(fixes, (a, b) => compareBooleans(!!a.isJsxNamespaceFix, !!b.isJsxNamespaceFix) || compareValues(a.fix.kind, b.fix.kind) || compareModuleSpecifiers(a.fix, b.fix, sourceFile, program, preferences, packageJsonImportFilter.allowsImportingSpecifier, _toPath));
154433
154483
  }
154434
154484
  function getFixInfosWithoutDiagnostic(context, symbolToken, useAutoImportProvider) {
154435
154485
  const info = getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider);
154436
154486
  const packageJsonImportFilter = createPackageJsonImportFilter(context.sourceFile, context.preferences, context.host);
154437
- return info && sortFixInfo(info, context.sourceFile, context.program, packageJsonImportFilter, context.host);
154487
+ return info && sortFixInfo(info, context.sourceFile, context.program, packageJsonImportFilter, context.host, context.preferences);
154438
154488
  }
154439
- function getBestFix(fixes, sourceFile, program, packageJsonImportFilter, host) {
154489
+ function getBestFix(fixes, sourceFile, program, packageJsonImportFilter, host, preferences) {
154440
154490
  if (!some(fixes)) return;
154441
154491
  if (fixes[0].kind === 0 /* UseNamespace */ || fixes[0].kind === 2 /* AddToExisting */) {
154442
154492
  return fixes[0];
@@ -154449,21 +154499,31 @@ function getBestFix(fixes, sourceFile, program, packageJsonImportFilter, host) {
154449
154499
  best,
154450
154500
  sourceFile,
154451
154501
  program,
154502
+ preferences,
154452
154503
  packageJsonImportFilter.allowsImportingSpecifier,
154453
154504
  (fileName) => toPath(fileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host))
154454
154505
  ) === -1 /* LessThan */ ? fix : best
154455
154506
  )
154456
154507
  );
154457
154508
  }
154458
- function compareModuleSpecifiers(a, b, importingFile, program, allowsImportingSpecifier, toPath3) {
154509
+ function compareModuleSpecifiers(a, b, importingFile, program, preferences, allowsImportingSpecifier, toPath3) {
154459
154510
  if (a.kind !== 0 /* UseNamespace */ && b.kind !== 0 /* UseNamespace */) {
154460
- return compareBooleans(allowsImportingSpecifier(b.moduleSpecifier), allowsImportingSpecifier(a.moduleSpecifier)) || compareNodeCoreModuleSpecifiers(a.moduleSpecifier, b.moduleSpecifier, importingFile, program) || compareBooleans(
154511
+ return compareBooleans(
154512
+ b.moduleSpecifierKind !== "node_modules" || allowsImportingSpecifier(b.moduleSpecifier),
154513
+ a.moduleSpecifierKind !== "node_modules" || allowsImportingSpecifier(a.moduleSpecifier)
154514
+ ) || compareModuleSpecifierRelativity(a, b, preferences) || compareNodeCoreModuleSpecifiers(a.moduleSpecifier, b.moduleSpecifier, importingFile, program) || compareBooleans(
154461
154515
  isFixPossiblyReExportingImportingFile(a, importingFile.path, toPath3),
154462
154516
  isFixPossiblyReExportingImportingFile(b, importingFile.path, toPath3)
154463
154517
  ) || compareNumberOfDirectorySeparators(a.moduleSpecifier, b.moduleSpecifier);
154464
154518
  }
154465
154519
  return 0 /* EqualTo */;
154466
154520
  }
154521
+ function compareModuleSpecifierRelativity(a, b, preferences) {
154522
+ if (preferences.importModuleSpecifierPreference === "non-relative" || preferences.importModuleSpecifierPreference === "project-relative") {
154523
+ return compareBooleans(a.moduleSpecifierKind === "relative", b.moduleSpecifierKind === "relative");
154524
+ }
154525
+ return 0 /* EqualTo */;
154526
+ }
154467
154527
  function isFixPossiblyReExportingImportingFile(fix, importingFilePath, toPath3) {
154468
154528
  var _a;
154469
154529
  if (fix.isReExport && ((_a = fix.exportInfo) == null ? void 0 : _a.moduleFileName) && isIndexFileName(fix.exportInfo.moduleFileName)) {
@@ -177371,13 +177431,6 @@ function pasteEdits(targetFile, pastedText, pasteLocations, copiedFrom, host, pr
177371
177431
  if (pastedText.length !== pasteLocations.length) {
177372
177432
  actualPastedText = pastedText.length === 1 ? pastedText : [pastedText.join("\n")];
177373
177433
  }
177374
- pasteLocations.forEach((paste, i) => {
177375
- changes.replaceRangeWithText(
177376
- targetFile,
177377
- { pos: paste.pos, end: paste.end },
177378
- actualPastedText ? actualPastedText[0] : pastedText[i]
177379
- );
177380
- });
177381
177434
  const statements = [];
177382
177435
  let newText = targetFile.text;
177383
177436
  for (let i = pasteLocations.length - 1; i >= 0; i--) {
@@ -177425,6 +177478,13 @@ function pasteEdits(targetFile, pastedText, pasteLocations, copiedFrom, host, pr
177425
177478
  }
177426
177479
  importAdder.writeFixes(changes, getQuotePreference(copiedFrom ? copiedFrom.file : targetFile, preferences));
177427
177480
  });
177481
+ pasteLocations.forEach((paste, i) => {
177482
+ changes.replaceRangeWithText(
177483
+ targetFile,
177484
+ { pos: paste.pos, end: paste.end },
177485
+ actualPastedText ? actualPastedText[0] : pastedText[i]
177486
+ );
177487
+ });
177428
177488
  }
177429
177489
 
177430
177490
  // src/server/_namespaces/ts.ts
@@ -177926,6 +177986,7 @@ __export(ts_exports2, {
177926
177986
  emitNewLineBeforeLeadingCommentOfPosition: () => emitNewLineBeforeLeadingCommentOfPosition,
177927
177987
  emitNewLineBeforeLeadingComments: () => emitNewLineBeforeLeadingComments,
177928
177988
  emitNewLineBeforeLeadingCommentsOfPosition: () => emitNewLineBeforeLeadingCommentsOfPosition,
177989
+ emitResolverSkipsTypeChecking: () => emitResolverSkipsTypeChecking,
177929
177990
  emitSkippedWithNoDiagnostics: () => emitSkippedWithNoDiagnostics,
177930
177991
  emptyArray: () => emptyArray,
177931
177992
  emptyFileSystemEntries: () => emptyFileSystemEntries,
@@ -183032,14 +183093,14 @@ var Project3 = class _Project {
183032
183093
  }
183033
183094
  /** @internal */
183034
183095
  runWithTemporaryFileUpdate(rootFile, updatedText, cb) {
183035
- var _a, _b, _c, _d, _e;
183096
+ var _a, _b, _c, _d;
183036
183097
  const originalProgram = this.program;
183037
- const originalText = (_b = (_a = this.program) == null ? void 0 : _a.getSourceFile(rootFile)) == null ? void 0 : _b.getText();
183038
- Debug.assert(this.program && this.program.getSourceFile(rootFile) && originalText);
183039
- (_c = this.getScriptInfo(rootFile)) == null ? void 0 : _c.editContent(0, this.program.getSourceFile(rootFile).getText().length, updatedText);
183098
+ const rootSourceFile = Debug.checkDefined((_a = this.program) == null ? void 0 : _a.getSourceFile(rootFile), "Expected file to be part of program");
183099
+ const originalText = Debug.checkDefined(rootSourceFile.getText());
183100
+ (_b = this.getScriptInfo(rootFile)) == null ? void 0 : _b.editContent(0, originalText.length, updatedText);
183040
183101
  this.updateGraph();
183041
- cb(this.program, originalProgram, (_d = this.program) == null ? void 0 : _d.getSourceFile(rootFile));
183042
- (_e = this.getScriptInfo(rootFile)) == null ? void 0 : _e.editContent(0, this.program.getSourceFile(rootFile).getText().length, originalText);
183102
+ cb(this.program, originalProgram, (_c = this.program) == null ? void 0 : _c.getSourceFile(rootFile));
183103
+ (_d = this.getScriptInfo(rootFile)) == null ? void 0 : _d.editContent(0, this.program.getSourceFile(rootFile).getText().length, originalText);
183043
183104
  }
183044
183105
  /** @internal */
183045
183106
  getCompilerOptionsForNoDtsResolutionProject() {
@@ -187340,8 +187401,9 @@ function createModuleSpecifierCache(host) {
187340
187401
  if (!cache || currentKey !== key(fromFileName, preferences, options)) return void 0;
187341
187402
  return cache.get(toFileName2);
187342
187403
  },
187343
- set(fromFileName, toFileName2, preferences, options, modulePaths, moduleSpecifiers) {
187404
+ set(fromFileName, toFileName2, preferences, options, kind, modulePaths, moduleSpecifiers) {
187344
187405
  ensureCache(fromFileName, preferences, options).set(toFileName2, createInfo(
187406
+ kind,
187345
187407
  modulePaths,
187346
187408
  moduleSpecifiers,
187347
187409
  /*isBlockedByPackageJsonDependencies*/
@@ -187369,6 +187431,8 @@ function createModuleSpecifierCache(host) {
187369
187431
  info.modulePaths = modulePaths;
187370
187432
  } else {
187371
187433
  cache2.set(toFileName2, createInfo(
187434
+ /*kind*/
187435
+ void 0,
187372
187436
  modulePaths,
187373
187437
  /*moduleSpecifiers*/
187374
187438
  void 0,
@@ -187384,6 +187448,8 @@ function createModuleSpecifierCache(host) {
187384
187448
  info.isBlockedByPackageJsonDependencies = isBlockedByPackageJsonDependencies;
187385
187449
  } else {
187386
187450
  cache2.set(toFileName2, createInfo(
187451
+ /*kind*/
187452
+ void 0,
187387
187453
  /*modulePaths*/
187388
187454
  void 0,
187389
187455
  /*moduleSpecifiers*/
@@ -187417,8 +187483,8 @@ function createModuleSpecifierCache(host) {
187417
187483
  function key(fromFileName, preferences, options) {
187418
187484
  return `${fromFileName},${preferences.importModuleSpecifierEnding},${preferences.importModuleSpecifierPreference},${options.overrideImportMode}`;
187419
187485
  }
187420
- function createInfo(modulePaths, moduleSpecifiers, isBlockedByPackageJsonDependencies) {
187421
- return { modulePaths, moduleSpecifiers, isBlockedByPackageJsonDependencies };
187486
+ function createInfo(kind, modulePaths, moduleSpecifiers, isBlockedByPackageJsonDependencies) {
187487
+ return { kind, modulePaths, moduleSpecifiers, isBlockedByPackageJsonDependencies };
187422
187488
  }
187423
187489
  }
187424
187490
 
@@ -192327,6 +192393,7 @@ if (typeof console !== "undefined") {
192327
192393
  emitNewLineBeforeLeadingCommentOfPosition,
192328
192394
  emitNewLineBeforeLeadingComments,
192329
192395
  emitNewLineBeforeLeadingCommentsOfPosition,
192396
+ emitResolverSkipsTypeChecking,
192330
192397
  emitSkippedWithNoDiagnostics,
192331
192398
  emptyArray,
192332
192399
  emptyFileSystemEntries,
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.5.0-dev.20240521",
5
+ "version": "5.5.0-dev.20240522",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -110,5 +110,5 @@
110
110
  "node": "20.1.0",
111
111
  "npm": "8.19.4"
112
112
  },
113
- "gitHead": "ba78807aa10e062e2fa2cd24f89109b4aff38c59"
113
+ "gitHead": "9370347f5b6bc72902c8d71ac80d20738849dabd"
114
114
  }