typescript 5.0.0-dev.20221114 → 5.0.0-dev.20221116

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.
@@ -50,7 +50,7 @@ var path = __toESM(require("path"));
50
50
 
51
51
  // src/compiler/corePublic.ts
52
52
  var versionMajorMinor = "5.0";
53
- var version = `${versionMajorMinor}.0-dev.20221114`;
53
+ var version = `${versionMajorMinor}.0-dev.20221116`;
54
54
 
55
55
  // src/compiler/core.ts
56
56
  var emptyArray = [];
@@ -909,15 +909,9 @@ function isNodeLikeSystem() {
909
909
  // src/compiler/debug.ts
910
910
  var Debug;
911
911
  ((Debug2) => {
912
- let typeScriptVersion2;
913
912
  let currentAssertionLevel = 0 /* None */;
914
913
  Debug2.currentLogLevel = 2 /* Warning */;
915
914
  Debug2.isDebugging = false;
916
- Debug2.enableDeprecationWarnings = true;
917
- function getTypeScriptVersion() {
918
- return typeScriptVersion2 != null ? typeScriptVersion2 : typeScriptVersion2 = new Version(version);
919
- }
920
- Debug2.getTypeScriptVersion = getTypeScriptVersion;
921
915
  function shouldLog(level) {
922
916
  return Debug2.currentLogLevel <= level;
923
917
  }
@@ -1433,52 +1427,6 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
1433
1427
  isDebugInfoEnabled = true;
1434
1428
  }
1435
1429
  Debug2.enableDebugInfo = enableDebugInfo;
1436
- function formatDeprecationMessage(name, error, errorAfter, since, message) {
1437
- let deprecationMessage = error ? "DeprecationError: " : "DeprecationWarning: ";
1438
- deprecationMessage += `'${name}' `;
1439
- deprecationMessage += since ? `has been deprecated since v${since}` : "is deprecated";
1440
- deprecationMessage += error ? " and can no longer be used." : errorAfter ? ` and will no longer be usable after v${errorAfter}.` : ".";
1441
- deprecationMessage += message ? ` ${formatStringFromArgs(message, [name], 0)}` : "";
1442
- return deprecationMessage;
1443
- }
1444
- function createErrorDeprecation(name, errorAfter, since, message) {
1445
- const deprecationMessage = formatDeprecationMessage(name, true, errorAfter, since, message);
1446
- return () => {
1447
- throw new TypeError(deprecationMessage);
1448
- };
1449
- }
1450
- function createWarningDeprecation(name, errorAfter, since, message) {
1451
- let hasWrittenDeprecation = false;
1452
- return () => {
1453
- if (Debug2.enableDeprecationWarnings && !hasWrittenDeprecation) {
1454
- log2.warn(formatDeprecationMessage(name, false, errorAfter, since, message));
1455
- hasWrittenDeprecation = true;
1456
- }
1457
- };
1458
- }
1459
- function createDeprecation(name, options = {}) {
1460
- var _a2, _b;
1461
- const version2 = typeof options.typeScriptVersion === "string" ? new Version(options.typeScriptVersion) : (_a2 = options.typeScriptVersion) != null ? _a2 : getTypeScriptVersion();
1462
- const errorAfter = typeof options.errorAfter === "string" ? new Version(options.errorAfter) : options.errorAfter;
1463
- const warnAfter = typeof options.warnAfter === "string" ? new Version(options.warnAfter) : options.warnAfter;
1464
- const since = typeof options.since === "string" ? new Version(options.since) : (_b = options.since) != null ? _b : warnAfter;
1465
- const error = options.error || errorAfter && version2.compareTo(errorAfter) <= 0;
1466
- const warn = !warnAfter || version2.compareTo(warnAfter) >= 0;
1467
- return error ? createErrorDeprecation(name, errorAfter, since, options.message) : warn ? createWarningDeprecation(name, errorAfter, since, options.message) : noop;
1468
- }
1469
- Debug2.createDeprecation = createDeprecation;
1470
- function wrapFunction(deprecation, func) {
1471
- return function() {
1472
- deprecation();
1473
- return func.apply(this, arguments);
1474
- };
1475
- }
1476
- function deprecate(func, options) {
1477
- var _a2;
1478
- const deprecation = createDeprecation((_a2 = options == null ? void 0 : options.name) != null ? _a2 : getFunctionName(func), options);
1479
- return wrapFunction(deprecation, func);
1480
- }
1481
- Debug2.deprecate = deprecate;
1482
1430
  function formatVariance(varianceFlags) {
1483
1431
  const variance = varianceFlags & 7 /* VarianceMask */;
1484
1432
  let result = variance === 0 /* Invariant */ ? "in out" : variance === 3 /* Bivariant */ ? "[bivariant]" : variance === 2 /* Contravariant */ ? "in" : variance === 1 /* Covariant */ ? "out" : variance === 4 /* Independent */ ? "[independent]" : "";
@@ -6219,10 +6167,10 @@ var Diagnostics = {
6219
6167
  Module_name_0_matched_pattern_1: diag(6092, 3 /* Message */, "Module_name_0_matched_pattern_1_6092", "Module name '{0}', matched pattern '{1}'."),
6220
6168
  Trying_substitution_0_candidate_module_location_Colon_1: diag(6093, 3 /* Message */, "Trying_substitution_0_candidate_module_location_Colon_1_6093", "Trying substitution '{0}', candidate module location: '{1}'."),
6221
6169
  Resolving_module_name_0_relative_to_base_url_1_2: diag(6094, 3 /* Message */, "Resolving_module_name_0_relative_to_base_url_1_2_6094", "Resolving module name '{0}' relative to base url '{1}' - '{2}'."),
6222
- Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1: diag(6095, 3 /* Message */, "Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1_6095", "Loading module as file / folder, candidate module location '{0}', target file type '{1}'."),
6170
+ Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_types_Colon_1: diag(6095, 3 /* Message */, "Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_types_Colon_1_6095", "Loading module as file / folder, candidate module location '{0}', target file types: {1}."),
6223
6171
  File_0_does_not_exist: diag(6096, 3 /* Message */, "File_0_does_not_exist_6096", "File '{0}' does not exist."),
6224
6172
  File_0_exist_use_it_as_a_name_resolution_result: diag(6097, 3 /* Message */, "File_0_exist_use_it_as_a_name_resolution_result_6097", "File '{0}' exist - use it as a name resolution result."),
6225
- Loading_module_0_from_node_modules_folder_target_file_type_1: diag(6098, 3 /* Message */, "Loading_module_0_from_node_modules_folder_target_file_type_1_6098", "Loading module '{0}' from 'node_modules' folder, target file type '{1}'."),
6173
+ Loading_module_0_from_node_modules_folder_target_file_types_Colon_1: diag(6098, 3 /* Message */, "Loading_module_0_from_node_modules_folder_target_file_types_Colon_1_6098", "Loading module '{0}' from 'node_modules' folder, target file types: {1}."),
6226
6174
  Found_package_json_at_0: diag(6099, 3 /* Message */, "Found_package_json_at_0_6099", "Found 'package.json' at '{0}'."),
6227
6175
  package_json_does_not_have_a_0_field: diag(6100, 3 /* Message */, "package_json_does_not_have_a_0_field_6100", "'package.json' does not have a '{0}' field."),
6228
6176
  package_json_has_0_field_1_that_references_2: diag(6101, 3 /* Message */, "package_json_has_0_field_1_that_references_2_6101", "'package.json' has '{0}' field '{1}' that references '{2}'."),
@@ -11456,12 +11404,10 @@ var supportedJSExtensionsFlat = flatten(supportedJSExtensions);
11456
11404
  var allSupportedExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */, ".js" /* Js */, ".jsx" /* Jsx */], [".cts" /* Cts */, ".d.cts" /* Dcts */, ".cjs" /* Cjs */], [".mts" /* Mts */, ".d.mts" /* Dmts */, ".mjs" /* Mjs */]];
11457
11405
  var allSupportedExtensionsWithJson = [...allSupportedExtensions, [".json" /* Json */]];
11458
11406
  var supportedDeclarationExtensions = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */];
11407
+ var supportedTSImplementationExtensions = [".ts" /* Ts */, ".cts" /* Cts */, ".mts" /* Mts */, ".tsx" /* Tsx */];
11459
11408
  function hasJSFileExtension(fileName) {
11460
11409
  return some(supportedJSExtensionsFlat, (extension) => fileExtensionIs(fileName, extension));
11461
11410
  }
11462
- function hasTSFileExtension(fileName) {
11463
- return some(supportedTSExtensionsFlat, (extension) => fileExtensionIs(fileName, extension));
11464
- }
11465
11411
  var extensionsToRemove = [".d.ts" /* Dts */, ".d.mts" /* Dmts */, ".d.cts" /* Dcts */, ".mjs" /* Mjs */, ".mts" /* Mts */, ".cjs" /* Cjs */, ".cts" /* Cts */, ".ts" /* Ts */, ".js" /* Js */, ".tsx" /* Tsx */, ".jsx" /* Jsx */, ".json" /* Json */];
11466
11412
  function removeFileExtension(path2) {
11467
11413
  for (const ext of extensionsToRemove) {
@@ -25795,15 +25741,18 @@ function removeIgnoredPackageId(r) {
25795
25741
  return { path: r.path, ext: r.extension };
25796
25742
  }
25797
25743
  }
25798
- var Extensions = /* @__PURE__ */ ((Extensions2) => {
25799
- Extensions2[Extensions2["TypeScript"] = 0] = "TypeScript";
25800
- Extensions2[Extensions2["JavaScript"] = 1] = "JavaScript";
25801
- Extensions2[Extensions2["Json"] = 2] = "Json";
25802
- Extensions2[Extensions2["TSConfig"] = 3] = "TSConfig";
25803
- Extensions2[Extensions2["DtsOnly"] = 4] = "DtsOnly";
25804
- Extensions2[Extensions2["TsOnly"] = 5] = "TsOnly";
25805
- return Extensions2;
25806
- })(Extensions || {});
25744
+ function formatExtensions(extensions) {
25745
+ const result = [];
25746
+ if (extensions & 1 /* TypeScript */)
25747
+ result.push("TypeScript");
25748
+ if (extensions & 2 /* JavaScript */)
25749
+ result.push("JavaScript");
25750
+ if (extensions & 4 /* Declaration */)
25751
+ result.push("Declaration");
25752
+ if (extensions & 8 /* Json */)
25753
+ result.push("JSON");
25754
+ return result.join(", ");
25755
+ }
25807
25756
  function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache) {
25808
25757
  if (resultFromCache) {
25809
25758
  resultFromCache.failedLookupLocations.push(...failedLookupLocations);
@@ -26128,38 +26077,42 @@ function nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions,
26128
26077
  resolutionMode
26129
26078
  );
26130
26079
  }
26131
- var jsOnlyExtensions = [1 /* JavaScript */];
26132
- var tsExtensions = [0 /* TypeScript */, 1 /* JavaScript */];
26133
- var tsPlusJsonExtensions = [...tsExtensions, 2 /* Json */];
26134
- var tsconfigExtensions = [3 /* TSConfig */];
26135
26080
  function nodeNextModuleNameResolverWorker(features, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
26136
26081
  const containingDirectory = getDirectoryPath(containingFile);
26137
26082
  const esmMode = resolutionMode === 99 /* ESNext */ ? 32 /* EsmMode */ : 0;
26138
- let extensions = compilerOptions.noDtsResolution ? [5 /* TsOnly */, 1 /* JavaScript */] : tsExtensions;
26083
+ let extensions = compilerOptions.noDtsResolution ? 3 /* ImplementationFiles */ : 1 /* TypeScript */ | 2 /* JavaScript */ | 4 /* Declaration */;
26139
26084
  if (compilerOptions.resolveJsonModule) {
26140
- extensions = [...extensions, 2 /* Json */];
26085
+ extensions |= 8 /* Json */;
26141
26086
  }
26142
- return nodeModuleNameResolverWorker(features | esmMode, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference);
26087
+ return nodeModuleNameResolverWorker(features | esmMode, moduleName, containingDirectory, compilerOptions, host, cache, extensions, false, redirectedReference);
26143
26088
  }
26144
26089
  function tryResolveJSModuleWorker(moduleName, initialDir, host) {
26145
- return nodeModuleNameResolverWorker(0 /* None */, moduleName, initialDir, { moduleResolution: 2 /* NodeJs */, allowJs: true }, host, void 0, jsOnlyExtensions, void 0);
26090
+ return nodeModuleNameResolverWorker(
26091
+ 0 /* None */,
26092
+ moduleName,
26093
+ initialDir,
26094
+ { moduleResolution: 2 /* NodeJs */, allowJs: true },
26095
+ host,
26096
+ void 0,
26097
+ 2 /* JavaScript */,
26098
+ false,
26099
+ void 0
26100
+ );
26146
26101
  }
26147
- function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, lookupConfig) {
26102
+ function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, isConfigLookup) {
26148
26103
  let extensions;
26149
- if (lookupConfig) {
26150
- extensions = tsconfigExtensions;
26104
+ if (isConfigLookup) {
26105
+ extensions = 8 /* Json */;
26151
26106
  } else if (compilerOptions.noDtsResolution) {
26152
- extensions = [5 /* TsOnly */];
26153
- if (compilerOptions.allowJs)
26154
- extensions.push(1 /* JavaScript */);
26107
+ extensions = 3 /* ImplementationFiles */;
26155
26108
  if (compilerOptions.resolveJsonModule)
26156
- extensions.push(2 /* Json */);
26109
+ extensions |= 8 /* Json */;
26157
26110
  } else {
26158
- extensions = compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions;
26111
+ extensions = compilerOptions.resolveJsonModule ? 1 /* TypeScript */ | 2 /* JavaScript */ | 4 /* Declaration */ | 8 /* Json */ : 1 /* TypeScript */ | 2 /* JavaScript */ | 4 /* Declaration */;
26159
26112
  }
26160
- return nodeModuleNameResolverWorker(0 /* None */, moduleName, getDirectoryPath(containingFile), compilerOptions, host, cache, extensions, redirectedReference);
26113
+ return nodeModuleNameResolverWorker(0 /* None */, moduleName, getDirectoryPath(containingFile), compilerOptions, host, cache, extensions, !!isConfigLookup, redirectedReference);
26161
26114
  }
26162
- function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference) {
26115
+ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, isConfigLookup, redirectedReference) {
26163
26116
  var _a2, _b;
26164
26117
  const traceEnabled = isTraceEnabled(compilerOptions, host);
26165
26118
  const failedLookupLocations = [];
@@ -26179,12 +26132,20 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
26179
26132
  features,
26180
26133
  conditions,
26181
26134
  requestContainingDirectory: containingDirectory,
26182
- reportDiagnostic: (diag2) => void diagnostics.push(diag2)
26135
+ reportDiagnostic: (diag2) => void diagnostics.push(diag2),
26136
+ isConfigLookup
26183
26137
  };
26184
26138
  if (traceEnabled && getEmitModuleResolutionKind(compilerOptions) >= 3 /* Node16 */ && getEmitModuleResolutionKind(compilerOptions) <= 99 /* NodeNext */) {
26185
26139
  trace(host, Diagnostics.Resolving_in_0_mode_with_conditions_1, features & 32 /* EsmMode */ ? "ESM" : "CJS", conditions.map((c) => `'${c}'`).join(", "));
26186
26140
  }
26187
- const result = forEach(extensions, (ext) => tryResolve(ext));
26141
+ let result;
26142
+ if (getEmitModuleResolutionKind(compilerOptions) === 2 /* NodeJs */) {
26143
+ const priorityExtensions = extensions & (1 /* TypeScript */ | 4 /* Declaration */);
26144
+ const secondaryExtensions = extensions & ~(1 /* TypeScript */ | 4 /* Declaration */);
26145
+ result = priorityExtensions && tryResolve(priorityExtensions) || secondaryExtensions && tryResolve(secondaryExtensions) || void 0;
26146
+ } else {
26147
+ result = tryResolve(extensions);
26148
+ }
26188
26149
  return createResolvedModuleWithFailedLookupLocations(
26189
26150
  (_a2 = result == null ? void 0 : result.value) == null ? void 0 : _a2.resolved,
26190
26151
  (_b = result == null ? void 0 : result.value) == null ? void 0 : _b.isExternalLibraryImport,
@@ -26209,7 +26170,7 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
26209
26170
  }
26210
26171
  if (!resolved2) {
26211
26172
  if (traceEnabled) {
26212
- trace(host, Diagnostics.Loading_module_0_from_node_modules_folder_target_file_type_1, moduleName, Extensions[extensions2]);
26173
+ trace(host, Diagnostics.Loading_module_0_from_node_modules_folder_target_file_types_Colon_1, moduleName, formatExtensions(extensions2));
26213
26174
  }
26214
26175
  resolved2 = loadModuleFromNearestNodeModulesDirectory(extensions2, moduleName, containingDirectory, state, cache, redirectedReference);
26215
26176
  }
@@ -26250,7 +26211,7 @@ function realPath(path2, host, traceEnabled) {
26250
26211
  }
26251
26212
  function nodeLoadModuleByRelativeName(extensions, candidate, onlyRecordFailures, state, considerPackageJson) {
26252
26213
  if (state.traceEnabled) {
26253
- trace(state.host, Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1, candidate, Extensions[extensions]);
26214
+ trace(state.host, Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_types_Colon_1, candidate, formatExtensions(extensions));
26254
26215
  }
26255
26216
  if (!hasTrailingDirectorySeparator(candidate)) {
26256
26217
  if (!onlyRecordFailures) {
@@ -26308,10 +26269,9 @@ function loadModuleFromFileNoPackageId(extensions, candidate, onlyRecordFailures
26308
26269
  return noPackageId(loadModuleFromFile(extensions, candidate, onlyRecordFailures, state));
26309
26270
  }
26310
26271
  function loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) {
26311
- if (extensions === 2 /* Json */ || extensions === 3 /* TSConfig */) {
26312
- const extensionLess = tryRemoveExtension(candidate, ".json" /* Json */);
26313
- const extension = extensionLess ? candidate.substring(extensionLess.length) : "";
26314
- return extensionLess === void 0 && extensions === 2 /* Json */ ? void 0 : tryAddingExtensions(extensionLess || candidate, extensions, extension, onlyRecordFailures, state);
26272
+ const resolvedByReplacingExtension = loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
26273
+ if (resolvedByReplacingExtension) {
26274
+ return resolvedByReplacingExtension;
26315
26275
  }
26316
26276
  if (!(state.features & 32 /* EsmMode */)) {
26317
26277
  const resolvedByAddingExtension = tryAddingExtensions(candidate, extensions, "", onlyRecordFailures, state);
@@ -26319,10 +26279,9 @@ function loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) {
26319
26279
  return resolvedByAddingExtension;
26320
26280
  }
26321
26281
  }
26322
- return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
26323
26282
  }
26324
26283
  function loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state) {
26325
- if (hasJSFileExtension(candidate) || fileExtensionIs(candidate, ".json" /* Json */) && state.compilerOptions.resolveJsonModule) {
26284
+ if (hasJSFileExtension(candidate) || extensions & 8 /* Json */ && fileExtensionIs(candidate, ".json" /* Json */)) {
26326
26285
  const extensionless = removeFileExtension(candidate);
26327
26286
  const extension = candidate.substring(extensionless.length);
26328
26287
  if (state.traceEnabled) {
@@ -26332,7 +26291,7 @@ function loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecor
26332
26291
  }
26333
26292
  }
26334
26293
  function loadJSOrExactTSFileName(extensions, candidate, onlyRecordFailures, state) {
26335
- if ((extensions === 0 /* TypeScript */ || extensions === 4 /* DtsOnly */) && fileExtensionIsOneOf(candidate, supportedTSExtensionsFlat)) {
26294
+ if (extensions & 1 /* TypeScript */ && fileExtensionIsOneOf(candidate, supportedTSImplementationExtensions) || extensions & 4 /* Declaration */ && fileExtensionIsOneOf(candidate, supportedDeclarationExtensions)) {
26336
26295
  const result = tryFile(candidate, onlyRecordFailures, state);
26337
26296
  return result !== void 0 ? { path: candidate, ext: tryExtractTSExtension(candidate) } : void 0;
26338
26297
  }
@@ -26345,59 +26304,32 @@ function tryAddingExtensions(candidate, extensions, originalExtension, onlyRecor
26345
26304
  onlyRecordFailures = !directoryProbablyExists(directory, state.host);
26346
26305
  }
26347
26306
  }
26348
- switch (extensions) {
26349
- case 4 /* DtsOnly */:
26350
- switch (originalExtension) {
26351
- case ".mjs" /* Mjs */:
26352
- case ".mts" /* Mts */:
26353
- case ".d.mts" /* Dmts */:
26354
- return tryExtension(".d.mts" /* Dmts */);
26355
- case ".cjs" /* Cjs */:
26356
- case ".cts" /* Cts */:
26357
- case ".d.cts" /* Dcts */:
26358
- return tryExtension(".d.cts" /* Dcts */);
26359
- case ".json" /* Json */:
26360
- candidate += ".json" /* Json */;
26361
- return tryExtension(".d.ts" /* Dts */);
26362
- default:
26363
- return tryExtension(".d.ts" /* Dts */);
26364
- }
26365
- case 0 /* TypeScript */:
26366
- case 5 /* TsOnly */:
26367
- const useDts = extensions === 0 /* TypeScript */;
26368
- switch (originalExtension) {
26369
- case ".mjs" /* Mjs */:
26370
- case ".mts" /* Mts */:
26371
- case ".d.mts" /* Dmts */:
26372
- return tryExtension(".mts" /* Mts */) || (useDts ? tryExtension(".d.mts" /* Dmts */) : void 0);
26373
- case ".cjs" /* Cjs */:
26374
- case ".cts" /* Cts */:
26375
- case ".d.cts" /* Dcts */:
26376
- return tryExtension(".cts" /* Cts */) || (useDts ? tryExtension(".d.cts" /* Dcts */) : void 0);
26377
- case ".json" /* Json */:
26378
- candidate += ".json" /* Json */;
26379
- return useDts ? tryExtension(".d.ts" /* Dts */) : void 0;
26380
- default:
26381
- return tryExtension(".ts" /* Ts */) || tryExtension(".tsx" /* Tsx */) || (useDts ? tryExtension(".d.ts" /* Dts */) : void 0);
26382
- }
26383
- case 1 /* JavaScript */:
26384
- switch (originalExtension) {
26385
- case ".mjs" /* Mjs */:
26386
- case ".mts" /* Mts */:
26387
- case ".d.mts" /* Dmts */:
26388
- return tryExtension(".mjs" /* Mjs */);
26389
- case ".cjs" /* Cjs */:
26390
- case ".cts" /* Cts */:
26391
- case ".d.cts" /* Dcts */:
26392
- return tryExtension(".cjs" /* Cjs */);
26393
- case ".json" /* Json */:
26394
- return tryExtension(".json" /* Json */);
26395
- default:
26396
- return tryExtension(".js" /* Js */) || tryExtension(".jsx" /* Jsx */);
26307
+ switch (originalExtension) {
26308
+ case ".mjs" /* Mjs */:
26309
+ case ".mts" /* Mts */:
26310
+ case ".d.mts" /* Dmts */:
26311
+ return extensions & 1 /* TypeScript */ && tryExtension(".mts" /* Mts */) || extensions & 4 /* Declaration */ && tryExtension(".d.mts" /* Dmts */) || extensions & 2 /* JavaScript */ && tryExtension(".mjs" /* Mjs */) || void 0;
26312
+ case ".cjs" /* Cjs */:
26313
+ case ".cts" /* Cts */:
26314
+ case ".d.cts" /* Dcts */:
26315
+ return extensions & 1 /* TypeScript */ && tryExtension(".cts" /* Cts */) || extensions & 4 /* Declaration */ && tryExtension(".d.cts" /* Dcts */) || extensions & 2 /* JavaScript */ && tryExtension(".cjs" /* Cjs */) || void 0;
26316
+ case ".json" /* Json */:
26317
+ const originalCandidate = candidate;
26318
+ if (extensions & 4 /* Declaration */) {
26319
+ candidate += ".json" /* Json */;
26320
+ const result = tryExtension(".d.ts" /* Dts */);
26321
+ if (result)
26322
+ return result;
26323
+ }
26324
+ if (extensions & 8 /* Json */) {
26325
+ candidate = originalCandidate;
26326
+ const result = tryExtension(".json" /* Json */);
26327
+ if (result)
26328
+ return result;
26397
26329
  }
26398
- case 3 /* TSConfig */:
26399
- case 2 /* Json */:
26400
- return tryExtension(".json" /* Json */);
26330
+ return void 0;
26331
+ default:
26332
+ return extensions & 1 /* TypeScript */ && (tryExtension(".ts" /* Ts */) || tryExtension(".tsx" /* Tsx */)) || extensions & 4 /* Declaration */ && tryExtension(".d.ts" /* Dts */) || extensions & 2 /* JavaScript */ && (tryExtension(".js" /* Js */) || tryExtension(".jsx" /* Jsx */)) || state.isConfigLookup && tryExtension(".json" /* Json */) || void 0;
26401
26333
  }
26402
26334
  function tryExtension(ext) {
26403
26335
  const path2 = tryFile(candidate + ext, onlyRecordFailures, state);
@@ -26491,23 +26423,10 @@ function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
26491
26423
  function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, jsonContent, versionPaths) {
26492
26424
  let packageFile;
26493
26425
  if (jsonContent) {
26494
- switch (extensions) {
26495
- case 1 /* JavaScript */:
26496
- case 2 /* Json */:
26497
- case 5 /* TsOnly */:
26498
- packageFile = readPackageJsonMainField(jsonContent, candidate, state);
26499
- break;
26500
- case 0 /* TypeScript */:
26501
- packageFile = readPackageJsonTypesFields(jsonContent, candidate, state) || readPackageJsonMainField(jsonContent, candidate, state);
26502
- break;
26503
- case 4 /* DtsOnly */:
26504
- packageFile = readPackageJsonTypesFields(jsonContent, candidate, state);
26505
- break;
26506
- case 3 /* TSConfig */:
26507
- packageFile = readPackageJsonTSConfigField(jsonContent, candidate, state);
26508
- break;
26509
- default:
26510
- return Debug.assertNever(extensions);
26426
+ if (state.isConfigLookup) {
26427
+ packageFile = readPackageJsonTSConfigField(jsonContent, candidate, state);
26428
+ } else {
26429
+ packageFile = extensions & 4 /* Declaration */ && readPackageJsonTypesFields(jsonContent, candidate, state) || extensions & (3 /* ImplementationFiles */ | 4 /* Declaration */) && readPackageJsonMainField(jsonContent, candidate, state) || void 0;
26511
26430
  }
26512
26431
  }
26513
26432
  const loader = (extensions2, candidate2, onlyRecordFailures2, state2) => {
@@ -26521,18 +26440,18 @@ function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFail
26521
26440
  trace(state2.host, Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromFile);
26522
26441
  }
26523
26442
  }
26524
- const nextExtensions = extensions2 === 4 /* DtsOnly */ ? 0 /* TypeScript */ : extensions2;
26443
+ const expandedExtensions = extensions2 === 4 /* Declaration */ ? 1 /* TypeScript */ | 4 /* Declaration */ : extensions2;
26525
26444
  const features = state2.features;
26526
26445
  if ((jsonContent == null ? void 0 : jsonContent.type) !== "module") {
26527
26446
  state2.features &= ~32 /* EsmMode */;
26528
26447
  }
26529
- const result = nodeLoadModuleByRelativeName(nextExtensions, candidate2, onlyRecordFailures2, state2, false);
26448
+ const result = nodeLoadModuleByRelativeName(expandedExtensions, candidate2, onlyRecordFailures2, state2, false);
26530
26449
  state2.features = features;
26531
26450
  return result;
26532
26451
  };
26533
26452
  const onlyRecordFailuresForPackageFile = packageFile ? !directoryProbablyExists(getDirectoryPath(packageFile), state.host) : void 0;
26534
26453
  const onlyRecordFailuresForIndex = onlyRecordFailures || !directoryProbablyExists(candidate, state.host);
26535
- const indexPath = combinePaths(candidate, extensions === 3 /* TSConfig */ ? "tsconfig" : "index");
26454
+ const indexPath = combinePaths(candidate, state.isConfigLookup ? "tsconfig" : "index");
26536
26455
  if (versionPaths && (!packageFile || containsPath(candidate, packageFile))) {
26537
26456
  const moduleName = getRelativePathFromDirectory(candidate, packageFile || indexPath, false);
26538
26457
  if (state.traceEnabled) {
@@ -26555,19 +26474,7 @@ function resolvedIfExtensionMatches(extensions, path2) {
26555
26474
  return ext !== void 0 && extensionIsOk(extensions, ext) ? { path: path2, ext } : void 0;
26556
26475
  }
26557
26476
  function extensionIsOk(extensions, extension) {
26558
- switch (extensions) {
26559
- case 1 /* JavaScript */:
26560
- return extension === ".js" /* Js */ || extension === ".jsx" /* Jsx */ || extension === ".mjs" /* Mjs */ || extension === ".cjs" /* Cjs */;
26561
- case 3 /* TSConfig */:
26562
- case 2 /* Json */:
26563
- return extension === ".json" /* Json */;
26564
- case 0 /* TypeScript */:
26565
- return extension === ".ts" /* Ts */ || extension === ".tsx" /* Tsx */ || extension === ".mts" /* Mts */ || extension === ".cts" /* Cts */ || extension === ".d.ts" /* Dts */ || extension === ".d.mts" /* Dmts */ || extension === ".d.cts" /* Dcts */;
26566
- case 5 /* TsOnly */:
26567
- return extension === ".ts" /* Ts */ || extension === ".tsx" /* Tsx */ || extension === ".mts" /* Mts */ || extension === ".cts" /* Cts */;
26568
- case 4 /* DtsOnly */:
26569
- return extension === ".d.ts" /* Dts */ || extension === ".d.mts" /* Dmts */ || extension === ".d.cts" /* Dcts */;
26570
- }
26477
+ return extensions & 2 /* JavaScript */ && (extension === ".js" /* Js */ || extension === ".jsx" /* Jsx */ || extension === ".mjs" /* Mjs */ || extension === ".cjs" /* Cjs */) || extensions & 1 /* TypeScript */ && (extension === ".ts" /* Ts */ || extension === ".tsx" /* Tsx */ || extension === ".mts" /* Mts */ || extension === ".cts" /* Cts */) || extensions & 4 /* Declaration */ && (extension === ".d.ts" /* Dts */ || extension === ".d.mts" /* Dmts */ || extension === ".d.cts" /* Dcts */) || extensions & 8 /* Json */ && extension === ".json" /* Json */ || false;
26571
26478
  }
26572
26479
  function parsePackageName(moduleName) {
26573
26480
  let idx = moduleName.indexOf(directorySeparator);
@@ -26729,7 +26636,7 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
26729
26636
  const combinedLookup = pattern ? target.replace(/\*/g, subpath) : target + subpath;
26730
26637
  traceIfEnabled(state, Diagnostics.Using_0_subpath_1_with_target_2, "imports", key, combinedLookup);
26731
26638
  traceIfEnabled(state, Diagnostics.Resolving_module_0_from_1, combinedLookup, scope.packageDirectory + "/");
26732
- const result = nodeModuleNameResolverWorker(state.features, combinedLookup, scope.packageDirectory + "/", state.compilerOptions, state.host, cache, [extensions], redirectedReference);
26639
+ const result = nodeModuleNameResolverWorker(state.features, combinedLookup, scope.packageDirectory + "/", state.compilerOptions, state.host, cache, extensions, false, redirectedReference);
26733
26640
  return toSearchResult(result.resolvedModule ? { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension, packageId: result.resolvedModule.packageId, originalPath: result.resolvedModule.originalPath } : void 0);
26734
26641
  }
26735
26642
  if (state.traceEnabled) {
@@ -26820,7 +26727,7 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
26820
26727
  }
26821
26728
  function tryLoadInputFileForPath(finalPath, entry, packagePath, isImports2) {
26822
26729
  var _a2, _b, _c, _d;
26823
- if ((extensions === 0 /* TypeScript */ || extensions === 1 /* JavaScript */ || extensions === 2 /* Json */) && (state.compilerOptions.declarationDir || state.compilerOptions.outDir) && finalPath.indexOf("/node_modules/") === -1 && (state.compilerOptions.configFile ? containsPath(scope.packageDirectory, toAbsolutePath(state.compilerOptions.configFile.fileName), !useCaseSensitiveFileNames()) : true)) {
26730
+ if (!state.isConfigLookup && (state.compilerOptions.declarationDir || state.compilerOptions.outDir) && finalPath.indexOf("/node_modules/") === -1 && (state.compilerOptions.configFile ? containsPath(scope.packageDirectory, toAbsolutePath(state.compilerOptions.configFile.fileName), !useCaseSensitiveFileNames()) : true)) {
26824
26731
  const getCanonicalFileName = hostGetCanonicalFileName({ useCaseSensitiveFileNames });
26825
26732
  const commonSourceDirGuesses = [];
26826
26733
  if (state.compilerOptions.rootDir || state.compilerOptions.composite && state.compilerOptions.configFilePath) {
@@ -26857,10 +26764,9 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
26857
26764
  if (fileExtensionIs(possibleInputBase, ext)) {
26858
26765
  const inputExts = getPossibleOriginalInputExtensionForExtension(possibleInputBase);
26859
26766
  for (const possibleExt of inputExts) {
26860
- const possibleInputWithInputExtension = changeAnyExtension(possibleInputBase, possibleExt, ext, !useCaseSensitiveFileNames());
26861
- if (extensions === 0 /* TypeScript */ && hasJSFileExtension(possibleInputWithInputExtension) || extensions === 1 /* JavaScript */ && hasTSFileExtension(possibleInputWithInputExtension)) {
26767
+ if (!extensionIsOk(extensions, possibleExt))
26862
26768
  continue;
26863
- }
26769
+ const possibleInputWithInputExtension = changeAnyExtension(possibleInputBase, possibleExt, ext, !useCaseSensitiveFileNames());
26864
26770
  if (state.host.fileExists(possibleInputWithInputExtension)) {
26865
26771
  return toSearchResult(withPackageId(scope, loadJSOrExactTSFileName(extensions, possibleInputWithInputExtension, false, state)));
26866
26772
  }
@@ -26901,19 +26807,31 @@ function loadModuleFromNearestNodeModulesDirectory(extensions, moduleName, direc
26901
26807
  return loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName, directory, state, false, cache, redirectedReference);
26902
26808
  }
26903
26809
  function loadModuleFromNearestNodeModulesDirectoryTypesScope(moduleName, directory, state) {
26904
- return loadModuleFromNearestNodeModulesDirectoryWorker(4 /* DtsOnly */, moduleName, directory, state, true, void 0, void 0);
26810
+ return loadModuleFromNearestNodeModulesDirectoryWorker(4 /* Declaration */, moduleName, directory, state, true, void 0, void 0);
26905
26811
  }
26906
26812
  function loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName, directory, state, typesScopeOnly, cache, redirectedReference) {
26907
26813
  const perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName, state.features === 0 ? void 0 : state.features & 32 /* EsmMode */ ? 99 /* ESNext */ : 1 /* CommonJS */, redirectedReference);
26908
- return forEachAncestorDirectory(normalizeSlashes(directory), (ancestorDirectory) => {
26909
- if (getBaseFileName(ancestorDirectory) !== "node_modules") {
26910
- const resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, ancestorDirectory, state);
26911
- if (resolutionFromCache) {
26912
- return resolutionFromCache;
26814
+ const priorityExtensions = extensions & (1 /* TypeScript */ | 4 /* Declaration */);
26815
+ const secondaryExtensions = extensions & ~(1 /* TypeScript */ | 4 /* Declaration */);
26816
+ if (priorityExtensions) {
26817
+ const result = lookup(priorityExtensions);
26818
+ if (result)
26819
+ return result;
26820
+ }
26821
+ if (secondaryExtensions && !typesScopeOnly) {
26822
+ return lookup(secondaryExtensions);
26823
+ }
26824
+ function lookup(extensions2) {
26825
+ return forEachAncestorDirectory(normalizeSlashes(directory), (ancestorDirectory) => {
26826
+ if (getBaseFileName(ancestorDirectory) !== "node_modules") {
26827
+ const resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, ancestorDirectory, state);
26828
+ if (resolutionFromCache) {
26829
+ return resolutionFromCache;
26830
+ }
26831
+ return toSearchResult(loadModuleFromImmediateNodeModulesDirectory(extensions2, moduleName, ancestorDirectory, state, typesScopeOnly, cache, redirectedReference));
26913
26832
  }
26914
- return toSearchResult(loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, ancestorDirectory, state, typesScopeOnly, cache, redirectedReference));
26915
- }
26916
- });
26833
+ });
26834
+ }
26917
26835
  }
26918
26836
  function loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, directory, state, typesScopeOnly, cache, redirectedReference) {
26919
26837
  const nodeModulesFolder = combinePaths(directory, "node_modules");
@@ -26921,11 +26839,13 @@ function loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, dir
26921
26839
  if (!nodeModulesFolderExists && state.traceEnabled) {
26922
26840
  trace(state.host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesFolder);
26923
26841
  }
26924
- const packageResult = typesScopeOnly ? void 0 : loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, state, cache, redirectedReference);
26925
- if (packageResult) {
26926
- return packageResult;
26842
+ if (!typesScopeOnly) {
26843
+ const packageResult = loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, state, cache, redirectedReference);
26844
+ if (packageResult) {
26845
+ return packageResult;
26846
+ }
26927
26847
  }
26928
- if (extensions === 0 /* TypeScript */ || extensions === 4 /* DtsOnly */) {
26848
+ if (extensions & 4 /* Declaration */) {
26929
26849
  const nodeModulesAtTypes2 = combinePaths(nodeModulesFolder, "@types");
26930
26850
  let nodeModulesAtTypesExists = nodeModulesFolderExists;
26931
26851
  if (nodeModulesFolderExists && !directoryProbablyExists(nodeModulesAtTypes2, state.host)) {
@@ -26934,7 +26854,7 @@ function loadModuleFromImmediateNodeModulesDirectory(extensions, moduleName, dir
26934
26854
  }
26935
26855
  nodeModulesAtTypesExists = false;
26936
26856
  }
26937
- return loadModuleFromSpecificNodeModulesDirectory(4 /* DtsOnly */, mangleScopedPackageNameWithTrace(moduleName, state), nodeModulesAtTypes2, nodeModulesAtTypesExists, state, cache, redirectedReference);
26857
+ return loadModuleFromSpecificNodeModulesDirectory(4 /* Declaration */, mangleScopedPackageNameWithTrace(moduleName, state), nodeModulesAtTypes2, nodeModulesAtTypesExists, state, cache, redirectedReference);
26938
26858
  }
26939
26859
  }
26940
26860
  function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state, cache, redirectedReference) {
@@ -27062,9 +26982,10 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
27062
26982
  features: 0 /* None */,
27063
26983
  conditions: [],
27064
26984
  requestContainingDirectory: containingDirectory,
27065
- reportDiagnostic: (diag2) => void diagnostics.push(diag2)
26985
+ reportDiagnostic: (diag2) => void diagnostics.push(diag2),
26986
+ isConfigLookup: false
27066
26987
  };
27067
- const resolved = tryResolve(0 /* TypeScript */) || tryResolve(1 /* JavaScript */);
26988
+ const resolved = tryResolve(1 /* TypeScript */ | 4 /* Declaration */) || tryResolve(2 /* JavaScript */ | (compilerOptions.resolveJsonModule ? 8 /* Json */ : 0));
27068
26989
  return createResolvedModuleWithFailedLookupLocations(
27069
26990
  resolved && resolved.value,
27070
26991
  false,
@@ -27091,7 +27012,7 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
27091
27012
  if (resolved2) {
27092
27013
  return resolved2;
27093
27014
  }
27094
- if (extensions === 0 /* TypeScript */) {
27015
+ if (extensions & (1 /* TypeScript */ | 4 /* Declaration */)) {
27095
27016
  return loadModuleFromNearestNodeModulesDirectoryTypesScope(moduleName, containingDirectory, state);
27096
27017
  }
27097
27018
  } else {
@@ -31137,10 +31058,10 @@ var visitEachChildTable = {
31137
31058
  nodeVisitor(node.initializer, visitor, isExpression)
31138
31059
  );
31139
31060
  },
31140
- [308 /* SourceFile */]: function visitEachChildOfSourceFile(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) {
31061
+ [308 /* SourceFile */]: function visitEachChildOfSourceFile(node, visitor, context, _nodesVisitor, _nodeVisitor, _tokenVisitor) {
31141
31062
  return context.factory.updateSourceFile(
31142
31063
  node,
31143
- visitLexicalEnvironment(node.statements, visitor, context, void 0, void 0, nodesVisitor)
31064
+ visitLexicalEnvironment(node.statements, visitor, context)
31144
31065
  );
31145
31066
  },
31146
31067
  [353 /* PartiallyEmittedExpression */]: function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) {
@@ -31795,7 +31716,7 @@ var BuilderState;
31795
31716
  return oldState && !oldState.referencedMap === !newReferencedMap;
31796
31717
  }
31797
31718
  BuilderState2.canReuseOldState = canReuseOldState;
31798
- function create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
31719
+ function create(newProgram, oldState, disableUseFileVersionAsSignature) {
31799
31720
  var _a2, _b, _c;
31800
31721
  const fileInfos = /* @__PURE__ */ new Map();
31801
31722
  const options = newProgram.getCompilerOptions();
@@ -31803,6 +31724,7 @@ var BuilderState;
31803
31724
  const referencedMap = options.module !== 0 /* None */ && !isOutFile ? createManyToManyPathMap() : void 0;
31804
31725
  const exportedModulesMap = referencedMap ? createManyToManyPathMap() : void 0;
31805
31726
  const useOldState = canReuseOldState(referencedMap, oldState);
31727
+ const getCanonicalFileName = createGetCanonicalFileName(newProgram.useCaseSensitiveFileNames());
31806
31728
  newProgram.getTypeChecker();
31807
31729
  for (const sourceFile of newProgram.getSourceFiles()) {
31808
31730
  const version2 = Debug.checkDefined(sourceFile.version, "Program intended to be used with Builder should have source files with versions set");
@@ -31841,30 +31763,29 @@ var BuilderState;
31841
31763
  state.allFileNames = void 0;
31842
31764
  }
31843
31765
  BuilderState2.releaseCache = releaseCache;
31844
- function getFilesAffectedBy(state, programOfThisState, path2, cancellationToken, computeHash, getCanonicalFileName) {
31766
+ function getFilesAffectedBy(state, programOfThisState, path2, cancellationToken, host) {
31845
31767
  var _a2, _b;
31846
31768
  const result = getFilesAffectedByWithOldState(
31847
31769
  state,
31848
31770
  programOfThisState,
31849
31771
  path2,
31850
31772
  cancellationToken,
31851
- computeHash,
31852
- getCanonicalFileName
31773
+ host
31853
31774
  );
31854
31775
  (_a2 = state.oldSignatures) == null ? void 0 : _a2.clear();
31855
31776
  (_b = state.oldExportedModulesMap) == null ? void 0 : _b.clear();
31856
31777
  return result;
31857
31778
  }
31858
31779
  BuilderState2.getFilesAffectedBy = getFilesAffectedBy;
31859
- function getFilesAffectedByWithOldState(state, programOfThisState, path2, cancellationToken, computeHash, getCanonicalFileName) {
31780
+ function getFilesAffectedByWithOldState(state, programOfThisState, path2, cancellationToken, host) {
31860
31781
  const sourceFile = programOfThisState.getSourceFileByPath(path2);
31861
31782
  if (!sourceFile) {
31862
31783
  return emptyArray;
31863
31784
  }
31864
- if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, getCanonicalFileName)) {
31785
+ if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, host)) {
31865
31786
  return [sourceFile];
31866
31787
  }
31867
- return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash, getCanonicalFileName);
31788
+ return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, host);
31868
31789
  }
31869
31790
  BuilderState2.getFilesAffectedByWithOldState = getFilesAffectedByWithOldState;
31870
31791
  function updateSignatureOfFile(state, signature, path2) {
@@ -31872,7 +31793,7 @@ var BuilderState;
31872
31793
  (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = /* @__PURE__ */ new Set())).add(path2);
31873
31794
  }
31874
31795
  BuilderState2.updateSignatureOfFile = updateSignatureOfFile;
31875
- function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, getCanonicalFileName, useFileVersionAsSignature = state.useFileVersionAsSignature) {
31796
+ function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, host, useFileVersionAsSignature = state.useFileVersionAsSignature) {
31876
31797
  var _a2;
31877
31798
  if ((_a2 = state.hasCalledUpdateShapeSignature) == null ? void 0 : _a2.has(sourceFile.resolvedPath))
31878
31799
  return false;
@@ -31885,10 +31806,10 @@ var BuilderState;
31885
31806
  (fileName, text, _writeByteOrderMark, _onError, sourceFiles, data) => {
31886
31807
  Debug.assert(isDeclarationFileName(fileName), `File extension for signature expected to be dts: Got:: ${fileName}`);
31887
31808
  latestSignature = computeSignatureWithDiagnostics(
31809
+ programOfThisState,
31888
31810
  sourceFile,
31889
31811
  text,
31890
- computeHash,
31891
- getCanonicalFileName,
31812
+ host,
31892
31813
  data
31893
31814
  );
31894
31815
  if (latestSignature !== prevSignature) {
@@ -32027,7 +31948,7 @@ var BuilderState;
32027
31948
  }
32028
31949
  return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
32029
31950
  }
32030
- function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash, getCanonicalFileName) {
31951
+ function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, host) {
32031
31952
  if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
32032
31953
  return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
32033
31954
  }
@@ -32043,7 +31964,7 @@ var BuilderState;
32043
31964
  if (!seenFileNamesMap.has(currentPath)) {
32044
31965
  const currentSourceFile = programOfThisState.getSourceFileByPath(currentPath);
32045
31966
  seenFileNamesMap.set(currentPath, currentSourceFile);
32046
- if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash, getCanonicalFileName)) {
31967
+ if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, host)) {
32047
31968
  queue.push(...getReferencedByPaths(state, currentSourceFile.resolvedPath));
32048
31969
  }
32049
31970
  }
@@ -32056,8 +31977,9 @@ var BuilderState;
32056
31977
  function getTextHandlingSourceMapForSignature(text, data) {
32057
31978
  return (data == null ? void 0 : data.sourceMapUrlPos) !== void 0 ? text.substring(0, data.sourceMapUrlPos) : text;
32058
31979
  }
32059
- function computeSignatureWithDiagnostics(sourceFile, text, computeHash, getCanonicalFileName, data) {
32060
- var _a2;
31980
+ function computeSignatureWithDiagnostics(program, sourceFile, text, host, data) {
31981
+ var _a2, _b;
31982
+ let getCanonicalFileName;
32061
31983
  text = getTextHandlingSourceMapForSignature(text, data);
32062
31984
  let sourceFileDirectory;
32063
31985
  if ((_a2 = data == null ? void 0 : data.diagnostics) == null ? void 0 : _a2.length) {
@@ -32065,7 +31987,7 @@ function computeSignatureWithDiagnostics(sourceFile, text, computeHash, getCanon
32065
31987
  (diagnostic) => `${locationInfo(diagnostic)}${DiagnosticCategory[diagnostic.category]}${diagnostic.code}: ${flattenDiagnosticMessageText2(diagnostic.messageText)}`
32066
31988
  ).join("\n");
32067
31989
  }
32068
- return (computeHash != null ? computeHash : generateDjb2Hash)(text);
31990
+ return ((_b = host.createHash) != null ? _b : generateDjb2Hash)(text);
32069
31991
  function flattenDiagnosticMessageText2(diagnostic) {
32070
31992
  return isString(diagnostic) ? diagnostic : diagnostic === void 0 ? "" : !diagnostic.next ? diagnostic.messageText : diagnostic.messageText + diagnostic.next.map(flattenDiagnosticMessageText2).join("\n");
32071
31993
  }
@@ -32074,7 +31996,11 @@ function computeSignatureWithDiagnostics(sourceFile, text, computeHash, getCanon
32074
31996
  return `(${diagnostic.start},${diagnostic.length})`;
32075
31997
  if (sourceFileDirectory === void 0)
32076
31998
  sourceFileDirectory = getDirectoryPath(sourceFile.resolvedPath);
32077
- return `${ensurePathIsNonModuleName(getRelativePathFromDirectory(sourceFileDirectory, diagnostic.file.resolvedPath, getCanonicalFileName))}(${diagnostic.start},${diagnostic.length})`;
31999
+ return `${ensurePathIsNonModuleName(getRelativePathFromDirectory(
32000
+ sourceFileDirectory,
32001
+ diagnostic.file.resolvedPath,
32002
+ getCanonicalFileName != null ? getCanonicalFileName : getCanonicalFileName = createGetCanonicalFileName(program.useCaseSensitiveFileNames())
32003
+ ))}(${diagnostic.start},${diagnostic.length})`;
32078
32004
  }
32079
32005
  }
32080
32006