typescript 5.1.0-dev.20230418 → 5.1.0-dev.20230419

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.1";
21
- var version = `${versionMajorMinor}.0-dev.20230418`;
21
+ var version = `${versionMajorMinor}.0-dev.20230419`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -16601,7 +16601,7 @@ function getScriptKindFromFileName(fileName) {
16601
16601
  var supportedTSExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */], [".cts" /* Cts */, ".d.cts" /* Dcts */], [".mts" /* Mts */, ".d.mts" /* Dmts */]];
16602
16602
  var supportedTSExtensionsFlat = flatten(supportedTSExtensions);
16603
16603
  var supportedTSExtensionsWithJson = [...supportedTSExtensions, [".json" /* Json */]];
16604
- var supportedTSExtensionsForExtractExtension = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */, ".cts" /* Cts */, ".mts" /* Mts */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".cts" /* Cts */, ".mts" /* Mts */];
16604
+ var supportedTSExtensionsForExtractExtension = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */, ".cts" /* Cts */, ".mts" /* Mts */, ".ts" /* Ts */, ".tsx" /* Tsx */];
16605
16605
  var supportedJSExtensions = [[".js" /* Js */, ".jsx" /* Jsx */], [".mjs" /* Mjs */], [".cjs" /* Cjs */]];
16606
16606
  var supportedJSExtensionsFlat = flatten(supportedJSExtensions);
16607
16607
  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 */]];
@@ -110666,7 +110666,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
110666
110666
  }
110667
110667
  }
110668
110668
  function emitEmbeddedStatement(parent, node) {
110669
- if (isBlock(node) || getEmitFlags(parent) & 1 /* SingleLine */) {
110669
+ if (isBlock(node) || getEmitFlags(parent) & 1 /* SingleLine */ || preserveSourceNewlines && !getLeadingLineTerminatorCount(parent, node, 0 /* None */)) {
110670
110670
  writeSpace();
110671
110671
  emit(node);
110672
110672
  } else {
@@ -113530,7 +113530,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
113530
113530
  automaticTypeDirectiveResolutions = createModeAwareCache();
113531
113531
  if (automaticTypeDirectiveNames.length) {
113532
113532
  (_k = tracing) == null ? void 0 : _k.push(tracing.Phase.Program, "processTypeReferences", { count: automaticTypeDirectiveNames.length });
113533
- const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : host.getCurrentDirectory();
113533
+ const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : currentDirectory;
113534
113534
  const containingFilename = combinePaths(containingDirectory, inferredTypesContainingFile);
113535
113535
  const resolutions = resolveTypeReferenceDirectiveNamesReusingOldState(automaticTypeDirectiveNames, containingFilename);
113536
113536
  for (let i = 0; i < automaticTypeDirectiveNames.length; i++) {
@@ -115321,8 +115321,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
115321
115321
  path += (i === 2 ? "/" : "-") + components[i];
115322
115322
  i++;
115323
115323
  }
115324
- const resolveFrom = combinePaths(currentDirectory, `__lib_node_modules_lookup_${libFileName}__.ts`);
115325
- const localOverrideModuleResult = resolveModuleName("@typescript/lib-" + path, resolveFrom, { moduleResolution: 2 /* Node10 */ }, host, moduleResolutionCache);
115324
+ const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : currentDirectory;
115325
+ const resolveFrom = combinePaths(containingDirectory, `__lib_node_modules_lookup_${libFileName}__.ts`);
115326
+ const localOverrideModuleResult = resolveModuleName("@typescript/lib-" + path, resolveFrom, { moduleResolution: 2 /* Node10 */, traceResolution: options.traceResolution }, host, moduleResolutionCache);
115326
115327
  if (localOverrideModuleResult == null ? void 0 : localOverrideModuleResult.resolvedModule) {
115327
115328
  return localOverrideModuleResult.resolvedModule.resolvedFileName;
115328
115329
  }
@@ -115457,7 +115458,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
115457
115458
  void 0
115458
115459
  );
115459
115460
  } else {
115460
- const basePath = getNormalizedAbsolutePath(getDirectoryPath(refPath), host.getCurrentDirectory());
115461
+ const basePath = getNormalizedAbsolutePath(getDirectoryPath(refPath), currentDirectory);
115461
115462
  sourceFile = host.getSourceFile(refPath, 100 /* JSON */);
115462
115463
  addFileToFilesByName(
115463
115464
  sourceFile,
@@ -118298,6 +118299,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118298
118299
  let failedLookupChecks;
118299
118300
  let startsWithPathChecks;
118300
118301
  let isInDirectoryChecks;
118302
+ let allResolutionsAreInvalidated = false;
118301
118303
  const getCurrentDirectory = memoize(() => resolutionHost.getCurrentDirectory());
118302
118304
  const cachedDirectoryStructureHost = resolutionHost.getCachedDirectoryStructureHost();
118303
118305
  const resolvedModuleNames = /* @__PURE__ */ new Map();
@@ -118340,7 +118342,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118340
118342
  isFileWithInvalidatedNonRelativeUnresolvedImports,
118341
118343
  updateTypeRootsWatch,
118342
118344
  closeTypeRootsWatch,
118343
- clear: clear2
118345
+ clear: clear2,
118346
+ onChangesAffectModuleResolution
118344
118347
  };
118345
118348
  function getResolvedModule2(resolution) {
118346
118349
  return resolution.resolvedModule;
@@ -118363,6 +118366,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118363
118366
  isInDirectoryChecks = void 0;
118364
118367
  affectingPathChecks = void 0;
118365
118368
  affectingPathChecksForFile = void 0;
118369
+ allResolutionsAreInvalidated = false;
118366
118370
  moduleResolutionCache.clear();
118367
118371
  typeReferenceDirectiveResolutionCache.clear();
118368
118372
  moduleResolutionCache.update(resolutionHost.getCompilationSettings());
@@ -118370,6 +118374,13 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118370
118374
  impliedFormatPackageJsons.clear();
118371
118375
  hasChangedAutomaticTypeDirectiveNames = false;
118372
118376
  }
118377
+ function onChangesAffectModuleResolution() {
118378
+ allResolutionsAreInvalidated = true;
118379
+ moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
118380
+ typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
118381
+ moduleResolutionCache.update(resolutionHost.getCompilationSettings());
118382
+ typeReferenceDirectiveResolutionCache.update(resolutionHost.getCompilationSettings());
118383
+ }
118373
118384
  function startRecordingFilesWithChangedResolutions() {
118374
118385
  filesWithChangedSetOfUnresolvedImports = [];
118375
118386
  }
@@ -118389,7 +118400,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118389
118400
  invalidateResolutionsOfFailedLookupLocations();
118390
118401
  const collected = filesWithInvalidatedResolutions;
118391
118402
  filesWithInvalidatedResolutions = void 0;
118392
- return (path) => customHasInvalidatedResolutions(path) || !!(collected == null ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path);
118403
+ return (path) => customHasInvalidatedResolutions(path) || allResolutionsAreInvalidated || !!(collected == null ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path);
118393
118404
  }
118394
118405
  function startCachingPerDirectoryResolution() {
118395
118406
  moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
@@ -118399,6 +118410,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118399
118410
  }
118400
118411
  function finishCachingPerDirectoryResolution(newProgram, oldProgram) {
118401
118412
  filesWithInvalidatedNonRelativeUnresolvedImports = void 0;
118413
+ allResolutionsAreInvalidated = false;
118402
118414
  nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
118403
118415
  nonRelativeExternalModuleResolutions.clear();
118404
118416
  if (newProgram !== oldProgram) {
@@ -118510,8 +118522,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118510
118522
  const name = loader.nameAndMode.getName(entry);
118511
118523
  const mode = loader.nameAndMode.getMode(entry, containingSourceFile);
118512
118524
  let resolution = resolutionsInFile.get(name, mode);
118513
- if (!seenNamesInFile.has(name, mode) && unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate
118514
- hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution)) {
118525
+ if (!seenNamesInFile.has(name, mode) && (allResolutionsAreInvalidated || unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate
118526
+ hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution))) {
118515
118527
  const existingResolution = resolution;
118516
118528
  resolution = loader.resolve(name, mode);
118517
118529
  if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
@@ -118933,8 +118945,23 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118933
118945
  }
118934
118946
  resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
118935
118947
  }
118948
+ function invalidatePackageJsonMap() {
118949
+ const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
118950
+ if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
118951
+ packageJsonMap.forEach((_value, path) => isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : void 0);
118952
+ }
118953
+ }
118936
118954
  function invalidateResolutionsOfFailedLookupLocations() {
118937
118955
  var _a;
118956
+ if (allResolutionsAreInvalidated) {
118957
+ affectingPathChecksForFile = void 0;
118958
+ invalidatePackageJsonMap();
118959
+ failedLookupChecks = void 0;
118960
+ startsWithPathChecks = void 0;
118961
+ isInDirectoryChecks = void 0;
118962
+ affectingPathChecks = void 0;
118963
+ return true;
118964
+ }
118938
118965
  let invalidated = false;
118939
118966
  if (affectingPathChecksForFile) {
118940
118967
  (_a = resolutionHost.getCurrentProgram()) == null ? void 0 : _a.getSourceFiles().forEach((f) => {
@@ -118949,10 +118976,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118949
118976
  return invalidated;
118950
118977
  }
118951
118978
  invalidated = invalidateResolutions(resolutionsWithFailedLookups, canInvalidateFailedLookupResolution) || invalidated;
118952
- const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
118953
- if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
118954
- packageJsonMap.forEach((_value, path) => isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : void 0);
118955
- }
118979
+ invalidatePackageJsonMap();
118956
118980
  failedLookupChecks = void 0;
118957
118981
  startsWithPathChecks = void 0;
118958
118982
  isInDirectoryChecks = void 0;
@@ -119871,7 +119895,8 @@ function createWatchProgram(host) {
119871
119895
  if (hasChangedCompilerOptions) {
119872
119896
  newLine = updateNewLine();
119873
119897
  if (program && changesAffectModuleResolution(program.getCompilerOptions(), compilerOptions)) {
119874
- resolutionCache.clear();
119898
+ debugger;
119899
+ resolutionCache.onChangesAffectModuleResolution();
119875
119900
  }
119876
119901
  }
119877
119902
  const hasInvalidatedResolutions = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions);
package/lib/tsserver.js CHANGED
@@ -2301,7 +2301,7 @@ module.exports = __toCommonJS(server_exports);
2301
2301
 
2302
2302
  // src/compiler/corePublic.ts
2303
2303
  var versionMajorMinor = "5.1";
2304
- var version = `${versionMajorMinor}.0-dev.20230418`;
2304
+ var version = `${versionMajorMinor}.0-dev.20230419`;
2305
2305
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2306
2306
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2307
2307
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -20751,7 +20751,7 @@ function getScriptKindFromFileName(fileName) {
20751
20751
  var supportedTSExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */], [".cts" /* Cts */, ".d.cts" /* Dcts */], [".mts" /* Mts */, ".d.mts" /* Dmts */]];
20752
20752
  var supportedTSExtensionsFlat = flatten(supportedTSExtensions);
20753
20753
  var supportedTSExtensionsWithJson = [...supportedTSExtensions, [".json" /* Json */]];
20754
- var supportedTSExtensionsForExtractExtension = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */, ".cts" /* Cts */, ".mts" /* Mts */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".cts" /* Cts */, ".mts" /* Mts */];
20754
+ var supportedTSExtensionsForExtractExtension = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */, ".cts" /* Cts */, ".mts" /* Mts */, ".ts" /* Ts */, ".tsx" /* Tsx */];
20755
20755
  var supportedJSExtensions = [[".js" /* Js */, ".jsx" /* Jsx */], [".mjs" /* Mjs */], [".cjs" /* Cjs */]];
20756
20756
  var supportedJSExtensionsFlat = flatten(supportedJSExtensions);
20757
20757
  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 */]];
@@ -115502,7 +115502,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
115502
115502
  }
115503
115503
  }
115504
115504
  function emitEmbeddedStatement(parent2, node) {
115505
- if (isBlock(node) || getEmitFlags(parent2) & 1 /* SingleLine */) {
115505
+ if (isBlock(node) || getEmitFlags(parent2) & 1 /* SingleLine */ || preserveSourceNewlines && !getLeadingLineTerminatorCount(parent2, node, 0 /* None */)) {
115506
115506
  writeSpace();
115507
115507
  emit(node);
115508
115508
  } else {
@@ -118420,7 +118420,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118420
118420
  automaticTypeDirectiveResolutions = createModeAwareCache();
118421
118421
  if (automaticTypeDirectiveNames.length) {
118422
118422
  (_k = tracing) == null ? void 0 : _k.push(tracing.Phase.Program, "processTypeReferences", { count: automaticTypeDirectiveNames.length });
118423
- const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : host.getCurrentDirectory();
118423
+ const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : currentDirectory;
118424
118424
  const containingFilename = combinePaths(containingDirectory, inferredTypesContainingFile);
118425
118425
  const resolutions = resolveTypeReferenceDirectiveNamesReusingOldState(automaticTypeDirectiveNames, containingFilename);
118426
118426
  for (let i = 0; i < automaticTypeDirectiveNames.length; i++) {
@@ -120211,8 +120211,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120211
120211
  path += (i === 2 ? "/" : "-") + components[i];
120212
120212
  i++;
120213
120213
  }
120214
- const resolveFrom = combinePaths(currentDirectory, `__lib_node_modules_lookup_${libFileName}__.ts`);
120215
- const localOverrideModuleResult = resolveModuleName("@typescript/lib-" + path, resolveFrom, { moduleResolution: 2 /* Node10 */ }, host, moduleResolutionCache);
120214
+ const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : currentDirectory;
120215
+ const resolveFrom = combinePaths(containingDirectory, `__lib_node_modules_lookup_${libFileName}__.ts`);
120216
+ const localOverrideModuleResult = resolveModuleName("@typescript/lib-" + path, resolveFrom, { moduleResolution: 2 /* Node10 */, traceResolution: options.traceResolution }, host, moduleResolutionCache);
120216
120217
  if (localOverrideModuleResult == null ? void 0 : localOverrideModuleResult.resolvedModule) {
120217
120218
  return localOverrideModuleResult.resolvedModule.resolvedFileName;
120218
120219
  }
@@ -120347,7 +120348,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120347
120348
  void 0
120348
120349
  );
120349
120350
  } else {
120350
- const basePath = getNormalizedAbsolutePath(getDirectoryPath(refPath), host.getCurrentDirectory());
120351
+ const basePath = getNormalizedAbsolutePath(getDirectoryPath(refPath), currentDirectory);
120351
120352
  sourceFile = host.getSourceFile(refPath, 100 /* JSON */);
120352
120353
  addFileToFilesByName(
120353
120354
  sourceFile,
@@ -123223,6 +123224,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123223
123224
  let failedLookupChecks;
123224
123225
  let startsWithPathChecks;
123225
123226
  let isInDirectoryChecks;
123227
+ let allResolutionsAreInvalidated = false;
123226
123228
  const getCurrentDirectory = memoize(() => resolutionHost.getCurrentDirectory());
123227
123229
  const cachedDirectoryStructureHost = resolutionHost.getCachedDirectoryStructureHost();
123228
123230
  const resolvedModuleNames = /* @__PURE__ */ new Map();
@@ -123265,7 +123267,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123265
123267
  isFileWithInvalidatedNonRelativeUnresolvedImports,
123266
123268
  updateTypeRootsWatch,
123267
123269
  closeTypeRootsWatch,
123268
- clear: clear2
123270
+ clear: clear2,
123271
+ onChangesAffectModuleResolution
123269
123272
  };
123270
123273
  function getResolvedModule2(resolution) {
123271
123274
  return resolution.resolvedModule;
@@ -123288,6 +123291,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123288
123291
  isInDirectoryChecks = void 0;
123289
123292
  affectingPathChecks = void 0;
123290
123293
  affectingPathChecksForFile = void 0;
123294
+ allResolutionsAreInvalidated = false;
123291
123295
  moduleResolutionCache.clear();
123292
123296
  typeReferenceDirectiveResolutionCache.clear();
123293
123297
  moduleResolutionCache.update(resolutionHost.getCompilationSettings());
@@ -123295,6 +123299,13 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123295
123299
  impliedFormatPackageJsons.clear();
123296
123300
  hasChangedAutomaticTypeDirectiveNames = false;
123297
123301
  }
123302
+ function onChangesAffectModuleResolution() {
123303
+ allResolutionsAreInvalidated = true;
123304
+ moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
123305
+ typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
123306
+ moduleResolutionCache.update(resolutionHost.getCompilationSettings());
123307
+ typeReferenceDirectiveResolutionCache.update(resolutionHost.getCompilationSettings());
123308
+ }
123298
123309
  function startRecordingFilesWithChangedResolutions() {
123299
123310
  filesWithChangedSetOfUnresolvedImports = [];
123300
123311
  }
@@ -123314,7 +123325,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123314
123325
  invalidateResolutionsOfFailedLookupLocations();
123315
123326
  const collected = filesWithInvalidatedResolutions;
123316
123327
  filesWithInvalidatedResolutions = void 0;
123317
- return (path) => customHasInvalidatedResolutions(path) || !!(collected == null ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path);
123328
+ return (path) => customHasInvalidatedResolutions(path) || allResolutionsAreInvalidated || !!(collected == null ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path);
123318
123329
  }
123319
123330
  function startCachingPerDirectoryResolution() {
123320
123331
  moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
@@ -123324,6 +123335,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123324
123335
  }
123325
123336
  function finishCachingPerDirectoryResolution(newProgram, oldProgram) {
123326
123337
  filesWithInvalidatedNonRelativeUnresolvedImports = void 0;
123338
+ allResolutionsAreInvalidated = false;
123327
123339
  nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
123328
123340
  nonRelativeExternalModuleResolutions.clear();
123329
123341
  if (newProgram !== oldProgram) {
@@ -123435,8 +123447,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123435
123447
  const name = loader.nameAndMode.getName(entry);
123436
123448
  const mode = loader.nameAndMode.getMode(entry, containingSourceFile);
123437
123449
  let resolution = resolutionsInFile.get(name, mode);
123438
- if (!seenNamesInFile.has(name, mode) && unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate
123439
- hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution)) {
123450
+ if (!seenNamesInFile.has(name, mode) && (allResolutionsAreInvalidated || unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate
123451
+ hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution))) {
123440
123452
  const existingResolution = resolution;
123441
123453
  resolution = loader.resolve(name, mode);
123442
123454
  if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
@@ -123858,8 +123870,23 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123858
123870
  }
123859
123871
  resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
123860
123872
  }
123873
+ function invalidatePackageJsonMap() {
123874
+ const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
123875
+ if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
123876
+ packageJsonMap.forEach((_value, path) => isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : void 0);
123877
+ }
123878
+ }
123861
123879
  function invalidateResolutionsOfFailedLookupLocations() {
123862
123880
  var _a;
123881
+ if (allResolutionsAreInvalidated) {
123882
+ affectingPathChecksForFile = void 0;
123883
+ invalidatePackageJsonMap();
123884
+ failedLookupChecks = void 0;
123885
+ startsWithPathChecks = void 0;
123886
+ isInDirectoryChecks = void 0;
123887
+ affectingPathChecks = void 0;
123888
+ return true;
123889
+ }
123863
123890
  let invalidated = false;
123864
123891
  if (affectingPathChecksForFile) {
123865
123892
  (_a = resolutionHost.getCurrentProgram()) == null ? void 0 : _a.getSourceFiles().forEach((f) => {
@@ -123874,10 +123901,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123874
123901
  return invalidated;
123875
123902
  }
123876
123903
  invalidated = invalidateResolutions(resolutionsWithFailedLookups, canInvalidateFailedLookupResolution) || invalidated;
123877
- const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
123878
- if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
123879
- packageJsonMap.forEach((_value, path) => isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : void 0);
123880
- }
123904
+ invalidatePackageJsonMap();
123881
123905
  failedLookupChecks = void 0;
123882
123906
  startsWithPathChecks = void 0;
123883
123907
  isInDirectoryChecks = void 0;
@@ -124821,7 +124845,8 @@ function createWatchProgram(host) {
124821
124845
  if (hasChangedCompilerOptions) {
124822
124846
  newLine = updateNewLine();
124823
124847
  if (program && changesAffectModuleResolution(program.getCompilerOptions(), compilerOptions)) {
124824
- resolutionCache.clear();
124848
+ debugger;
124849
+ resolutionCache.onChangesAffectModuleResolution();
124825
124850
  }
124826
124851
  }
124827
124852
  const hasInvalidatedResolutions = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions);
@@ -173946,7 +173971,7 @@ var Project3 = class {
173946
173971
  if (changesAffectModuleResolution(oldOptions, compilerOptions)) {
173947
173972
  this.cachedUnresolvedImportsPerFile.clear();
173948
173973
  this.lastCachedUnresolvedImportsList = void 0;
173949
- this.resolutionCache.clear();
173974
+ this.resolutionCache.onChangesAffectModuleResolution();
173950
173975
  this.moduleSpecifierCache.clear();
173951
173976
  }
173952
173977
  this.markAsDirty();
@@ -174416,13 +174441,18 @@ var InferredProject2 = class extends Project3 {
174416
174441
  /*isJsInferredProject*/
174417
174442
  true
174418
174443
  );
174444
+ } else if (this.isOrphan() && this._isJsInferredProject && !info.isJavaScript()) {
174445
+ this.toggleJsInferredProject(
174446
+ /*isJsInferredProject*/
174447
+ false
174448
+ );
174419
174449
  }
174420
174450
  super.addRoot(info);
174421
174451
  }
174422
174452
  removeRoot(info) {
174423
174453
  this.projectService.stopWatchingConfigFilesForInferredProjectRoot(info);
174424
174454
  super.removeRoot(info);
174425
- if (this._isJsInferredProject && info.isJavaScript()) {
174455
+ if (!this.isOrphan() && this._isJsInferredProject && info.isJavaScript()) {
174426
174456
  if (every(this.getRootScriptInfos(), (rootInfo) => !rootInfo.isJavaScript())) {
174427
174457
  this.toggleJsInferredProject(
174428
174458
  /*isJsInferredProject*/
@@ -179524,7 +179554,7 @@ var Session3 = class {
179524
179554
  }));
179525
179555
  this.host = opts.host;
179526
179556
  this.cancellationToken = opts.cancellationToken;
179527
- this.typingsInstaller = opts.typingsInstaller;
179557
+ this.typingsInstaller = opts.typingsInstaller || nullTypingsInstaller;
179528
179558
  this.byteLength = opts.byteLength;
179529
179559
  this.hrtime = opts.hrtime;
179530
179560
  this.logger = opts.logger;
@@ -3554,7 +3554,7 @@ declare namespace ts {
3554
3554
  cancellationToken: HostCancellationToken;
3555
3555
  useSingleInferredProject: boolean;
3556
3556
  useInferredProjectPerProjectRoot: boolean;
3557
- typingsInstaller: ITypingsInstaller;
3557
+ typingsInstaller?: ITypingsInstaller;
3558
3558
  eventHandler?: ProjectServiceEventHandler;
3559
3559
  suppressDiagnosticEvents?: boolean;
3560
3560
  throttleWaitMilliseconds?: number;
@@ -3826,7 +3826,7 @@ declare namespace ts {
3826
3826
  cancellationToken: ServerCancellationToken;
3827
3827
  useSingleInferredProject: boolean;
3828
3828
  useInferredProjectPerProjectRoot: boolean;
3829
- typingsInstaller: ITypingsInstaller;
3829
+ typingsInstaller?: ITypingsInstaller;
3830
3830
  byteLength: (buf: string, encoding?: BufferEncoding) => number;
3831
3831
  hrtime: (start?: [
3832
3832
  number,
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.1";
38
- version = `${versionMajorMinor}.0-dev.20230418`;
38
+ version = `${versionMajorMinor}.0-dev.20230419`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -19288,7 +19288,7 @@ ${lanes.join("\n")}
19288
19288
  supportedTSExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */], [".cts" /* Cts */, ".d.cts" /* Dcts */], [".mts" /* Mts */, ".d.mts" /* Dmts */]];
19289
19289
  supportedTSExtensionsFlat = flatten(supportedTSExtensions);
19290
19290
  supportedTSExtensionsWithJson = [...supportedTSExtensions, [".json" /* Json */]];
19291
- supportedTSExtensionsForExtractExtension = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */, ".cts" /* Cts */, ".mts" /* Mts */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".cts" /* Cts */, ".mts" /* Mts */];
19291
+ supportedTSExtensionsForExtractExtension = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */, ".cts" /* Cts */, ".mts" /* Mts */, ".ts" /* Ts */, ".tsx" /* Tsx */];
19292
19292
  supportedJSExtensions = [[".js" /* Js */, ".jsx" /* Jsx */], [".mjs" /* Mjs */], [".cjs" /* Cjs */]];
19293
19293
  supportedJSExtensionsFlat = flatten(supportedJSExtensions);
19294
19294
  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 */]];
@@ -113561,7 +113561,7 @@ ${lanes.join("\n")}
113561
113561
  }
113562
113562
  }
113563
113563
  function emitEmbeddedStatement(parent2, node) {
113564
- if (isBlock(node) || getEmitFlags(parent2) & 1 /* SingleLine */) {
113564
+ if (isBlock(node) || getEmitFlags(parent2) & 1 /* SingleLine */ || preserveSourceNewlines && !getLeadingLineTerminatorCount(parent2, node, 0 /* None */)) {
113565
113565
  writeSpace();
113566
113566
  emit(node);
113567
113567
  } else {
@@ -116422,7 +116422,7 @@ ${lanes.join("\n")}
116422
116422
  automaticTypeDirectiveResolutions = createModeAwareCache();
116423
116423
  if (automaticTypeDirectiveNames.length) {
116424
116424
  (_k = tracing) == null ? void 0 : _k.push(tracing.Phase.Program, "processTypeReferences", { count: automaticTypeDirectiveNames.length });
116425
- const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : host.getCurrentDirectory();
116425
+ const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : currentDirectory;
116426
116426
  const containingFilename = combinePaths(containingDirectory, inferredTypesContainingFile);
116427
116427
  const resolutions = resolveTypeReferenceDirectiveNamesReusingOldState(automaticTypeDirectiveNames, containingFilename);
116428
116428
  for (let i = 0; i < automaticTypeDirectiveNames.length; i++) {
@@ -118213,8 +118213,9 @@ ${lanes.join("\n")}
118213
118213
  path += (i === 2 ? "/" : "-") + components[i];
118214
118214
  i++;
118215
118215
  }
118216
- const resolveFrom = combinePaths(currentDirectory, `__lib_node_modules_lookup_${libFileName}__.ts`);
118217
- const localOverrideModuleResult = resolveModuleName("@typescript/lib-" + path, resolveFrom, { moduleResolution: 2 /* Node10 */ }, host, moduleResolutionCache);
118216
+ const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : currentDirectory;
118217
+ const resolveFrom = combinePaths(containingDirectory, `__lib_node_modules_lookup_${libFileName}__.ts`);
118218
+ const localOverrideModuleResult = resolveModuleName("@typescript/lib-" + path, resolveFrom, { moduleResolution: 2 /* Node10 */, traceResolution: options.traceResolution }, host, moduleResolutionCache);
118218
118219
  if (localOverrideModuleResult == null ? void 0 : localOverrideModuleResult.resolvedModule) {
118219
118220
  return localOverrideModuleResult.resolvedModule.resolvedFileName;
118220
118221
  }
@@ -118349,7 +118350,7 @@ ${lanes.join("\n")}
118349
118350
  void 0
118350
118351
  );
118351
118352
  } else {
118352
- const basePath = getNormalizedAbsolutePath(getDirectoryPath(refPath), host.getCurrentDirectory());
118353
+ const basePath = getNormalizedAbsolutePath(getDirectoryPath(refPath), currentDirectory);
118353
118354
  sourceFile = host.getSourceFile(refPath, 100 /* JSON */);
118354
118355
  addFileToFilesByName(
118355
118356
  sourceFile,
@@ -121380,6 +121381,7 @@ ${lanes.join("\n")}
121380
121381
  let failedLookupChecks;
121381
121382
  let startsWithPathChecks;
121382
121383
  let isInDirectoryChecks;
121384
+ let allResolutionsAreInvalidated = false;
121383
121385
  const getCurrentDirectory = memoize(() => resolutionHost.getCurrentDirectory());
121384
121386
  const cachedDirectoryStructureHost = resolutionHost.getCachedDirectoryStructureHost();
121385
121387
  const resolvedModuleNames = /* @__PURE__ */ new Map();
@@ -121422,7 +121424,8 @@ ${lanes.join("\n")}
121422
121424
  isFileWithInvalidatedNonRelativeUnresolvedImports,
121423
121425
  updateTypeRootsWatch,
121424
121426
  closeTypeRootsWatch,
121425
- clear: clear2
121427
+ clear: clear2,
121428
+ onChangesAffectModuleResolution
121426
121429
  };
121427
121430
  function getResolvedModule2(resolution) {
121428
121431
  return resolution.resolvedModule;
@@ -121445,6 +121448,7 @@ ${lanes.join("\n")}
121445
121448
  isInDirectoryChecks = void 0;
121446
121449
  affectingPathChecks = void 0;
121447
121450
  affectingPathChecksForFile = void 0;
121451
+ allResolutionsAreInvalidated = false;
121448
121452
  moduleResolutionCache.clear();
121449
121453
  typeReferenceDirectiveResolutionCache.clear();
121450
121454
  moduleResolutionCache.update(resolutionHost.getCompilationSettings());
@@ -121452,6 +121456,13 @@ ${lanes.join("\n")}
121452
121456
  impliedFormatPackageJsons.clear();
121453
121457
  hasChangedAutomaticTypeDirectiveNames = false;
121454
121458
  }
121459
+ function onChangesAffectModuleResolution() {
121460
+ allResolutionsAreInvalidated = true;
121461
+ moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
121462
+ typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
121463
+ moduleResolutionCache.update(resolutionHost.getCompilationSettings());
121464
+ typeReferenceDirectiveResolutionCache.update(resolutionHost.getCompilationSettings());
121465
+ }
121455
121466
  function startRecordingFilesWithChangedResolutions() {
121456
121467
  filesWithChangedSetOfUnresolvedImports = [];
121457
121468
  }
@@ -121471,7 +121482,7 @@ ${lanes.join("\n")}
121471
121482
  invalidateResolutionsOfFailedLookupLocations();
121472
121483
  const collected = filesWithInvalidatedResolutions;
121473
121484
  filesWithInvalidatedResolutions = void 0;
121474
- return (path) => customHasInvalidatedResolutions(path) || !!(collected == null ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path);
121485
+ return (path) => customHasInvalidatedResolutions(path) || allResolutionsAreInvalidated || !!(collected == null ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path);
121475
121486
  }
121476
121487
  function startCachingPerDirectoryResolution() {
121477
121488
  moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
@@ -121481,6 +121492,7 @@ ${lanes.join("\n")}
121481
121492
  }
121482
121493
  function finishCachingPerDirectoryResolution(newProgram, oldProgram) {
121483
121494
  filesWithInvalidatedNonRelativeUnresolvedImports = void 0;
121495
+ allResolutionsAreInvalidated = false;
121484
121496
  nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
121485
121497
  nonRelativeExternalModuleResolutions.clear();
121486
121498
  if (newProgram !== oldProgram) {
@@ -121592,8 +121604,8 @@ ${lanes.join("\n")}
121592
121604
  const name = loader.nameAndMode.getName(entry);
121593
121605
  const mode = loader.nameAndMode.getMode(entry, containingSourceFile);
121594
121606
  let resolution = resolutionsInFile.get(name, mode);
121595
- if (!seenNamesInFile.has(name, mode) && unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate
121596
- hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution)) {
121607
+ if (!seenNamesInFile.has(name, mode) && (allResolutionsAreInvalidated || unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate
121608
+ hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution))) {
121597
121609
  const existingResolution = resolution;
121598
121610
  resolution = loader.resolve(name, mode);
121599
121611
  if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
@@ -122015,8 +122027,23 @@ ${lanes.join("\n")}
122015
122027
  }
122016
122028
  resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
122017
122029
  }
122030
+ function invalidatePackageJsonMap() {
122031
+ const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
122032
+ if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
122033
+ packageJsonMap.forEach((_value, path) => isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : void 0);
122034
+ }
122035
+ }
122018
122036
  function invalidateResolutionsOfFailedLookupLocations() {
122019
122037
  var _a;
122038
+ if (allResolutionsAreInvalidated) {
122039
+ affectingPathChecksForFile = void 0;
122040
+ invalidatePackageJsonMap();
122041
+ failedLookupChecks = void 0;
122042
+ startsWithPathChecks = void 0;
122043
+ isInDirectoryChecks = void 0;
122044
+ affectingPathChecks = void 0;
122045
+ return true;
122046
+ }
122020
122047
  let invalidated = false;
122021
122048
  if (affectingPathChecksForFile) {
122022
122049
  (_a = resolutionHost.getCurrentProgram()) == null ? void 0 : _a.getSourceFiles().forEach((f) => {
@@ -122031,10 +122058,7 @@ ${lanes.join("\n")}
122031
122058
  return invalidated;
122032
122059
  }
122033
122060
  invalidated = invalidateResolutions(resolutionsWithFailedLookups, canInvalidateFailedLookupResolution) || invalidated;
122034
- const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
122035
- if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
122036
- packageJsonMap.forEach((_value, path) => isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : void 0);
122037
- }
122061
+ invalidatePackageJsonMap();
122038
122062
  failedLookupChecks = void 0;
122039
122063
  startsWithPathChecks = void 0;
122040
122064
  isInDirectoryChecks = void 0;
@@ -122991,7 +123015,8 @@ ${lanes.join("\n")}
122991
123015
  if (hasChangedCompilerOptions) {
122992
123016
  newLine = updateNewLine();
122993
123017
  if (program && changesAffectModuleResolution(program.getCompilerOptions(), compilerOptions)) {
122994
- resolutionCache.clear();
123018
+ debugger;
123019
+ resolutionCache.onChangesAffectModuleResolution();
122995
123020
  }
122996
123021
  }
122997
123022
  const hasInvalidatedResolutions = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions);
@@ -171307,7 +171332,7 @@ ${options.prefix}` : "\n" : options.prefix
171307
171332
  if (changesAffectModuleResolution(oldOptions, compilerOptions)) {
171308
171333
  this.cachedUnresolvedImportsPerFile.clear();
171309
171334
  this.lastCachedUnresolvedImportsList = void 0;
171310
- this.resolutionCache.clear();
171335
+ this.resolutionCache.onChangesAffectModuleResolution();
171311
171336
  this.moduleSpecifierCache.clear();
171312
171337
  }
171313
171338
  this.markAsDirty();
@@ -171755,13 +171780,18 @@ ${options.prefix}` : "\n" : options.prefix
171755
171780
  /*isJsInferredProject*/
171756
171781
  true
171757
171782
  );
171783
+ } else if (this.isOrphan() && this._isJsInferredProject && !info.isJavaScript()) {
171784
+ this.toggleJsInferredProject(
171785
+ /*isJsInferredProject*/
171786
+ false
171787
+ );
171758
171788
  }
171759
171789
  super.addRoot(info);
171760
171790
  }
171761
171791
  removeRoot(info) {
171762
171792
  this.projectService.stopWatchingConfigFilesForInferredProjectRoot(info);
171763
171793
  super.removeRoot(info);
171764
- if (this._isJsInferredProject && info.isJavaScript()) {
171794
+ if (!this.isOrphan() && this._isJsInferredProject && info.isJavaScript()) {
171765
171795
  if (every(this.getRootScriptInfos(), (rootInfo) => !rootInfo.isJavaScript())) {
171766
171796
  this.toggleJsInferredProject(
171767
171797
  /*isJsInferredProject*/
@@ -176958,7 +176988,7 @@ ${json}${newLine}`;
176958
176988
  }));
176959
176989
  this.host = opts.host;
176960
176990
  this.cancellationToken = opts.cancellationToken;
176961
- this.typingsInstaller = opts.typingsInstaller;
176991
+ this.typingsInstaller = opts.typingsInstaller || nullTypingsInstaller;
176962
176992
  this.byteLength = opts.byteLength;
176963
176993
  this.hrtime = opts.hrtime;
176964
176994
  this.logger = opts.logger;
package/lib/typescript.js CHANGED
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.1";
38
- version = `${versionMajorMinor}.0-dev.20230418`;
38
+ version = `${versionMajorMinor}.0-dev.20230419`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -19288,7 +19288,7 @@ ${lanes.join("\n")}
19288
19288
  supportedTSExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */], [".cts" /* Cts */, ".d.cts" /* Dcts */], [".mts" /* Mts */, ".d.mts" /* Dmts */]];
19289
19289
  supportedTSExtensionsFlat = flatten(supportedTSExtensions);
19290
19290
  supportedTSExtensionsWithJson = [...supportedTSExtensions, [".json" /* Json */]];
19291
- supportedTSExtensionsForExtractExtension = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */, ".cts" /* Cts */, ".mts" /* Mts */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".cts" /* Cts */, ".mts" /* Mts */];
19291
+ supportedTSExtensionsForExtractExtension = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */, ".cts" /* Cts */, ".mts" /* Mts */, ".ts" /* Ts */, ".tsx" /* Tsx */];
19292
19292
  supportedJSExtensions = [[".js" /* Js */, ".jsx" /* Jsx */], [".mjs" /* Mjs */], [".cjs" /* Cjs */]];
19293
19293
  supportedJSExtensionsFlat = flatten(supportedJSExtensions);
19294
19294
  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 */]];
@@ -113561,7 +113561,7 @@ ${lanes.join("\n")}
113561
113561
  }
113562
113562
  }
113563
113563
  function emitEmbeddedStatement(parent2, node) {
113564
- if (isBlock(node) || getEmitFlags(parent2) & 1 /* SingleLine */) {
113564
+ if (isBlock(node) || getEmitFlags(parent2) & 1 /* SingleLine */ || preserveSourceNewlines && !getLeadingLineTerminatorCount(parent2, node, 0 /* None */)) {
113565
113565
  writeSpace();
113566
113566
  emit(node);
113567
113567
  } else {
@@ -116422,7 +116422,7 @@ ${lanes.join("\n")}
116422
116422
  automaticTypeDirectiveResolutions = createModeAwareCache();
116423
116423
  if (automaticTypeDirectiveNames.length) {
116424
116424
  (_k = tracing) == null ? void 0 : _k.push(tracing.Phase.Program, "processTypeReferences", { count: automaticTypeDirectiveNames.length });
116425
- const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : host.getCurrentDirectory();
116425
+ const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : currentDirectory;
116426
116426
  const containingFilename = combinePaths(containingDirectory, inferredTypesContainingFile);
116427
116427
  const resolutions = resolveTypeReferenceDirectiveNamesReusingOldState(automaticTypeDirectiveNames, containingFilename);
116428
116428
  for (let i = 0; i < automaticTypeDirectiveNames.length; i++) {
@@ -118213,8 +118213,9 @@ ${lanes.join("\n")}
118213
118213
  path += (i === 2 ? "/" : "-") + components[i];
118214
118214
  i++;
118215
118215
  }
118216
- const resolveFrom = combinePaths(currentDirectory, `__lib_node_modules_lookup_${libFileName}__.ts`);
118217
- const localOverrideModuleResult = resolveModuleName("@typescript/lib-" + path, resolveFrom, { moduleResolution: 2 /* Node10 */ }, host, moduleResolutionCache);
118216
+ const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : currentDirectory;
118217
+ const resolveFrom = combinePaths(containingDirectory, `__lib_node_modules_lookup_${libFileName}__.ts`);
118218
+ const localOverrideModuleResult = resolveModuleName("@typescript/lib-" + path, resolveFrom, { moduleResolution: 2 /* Node10 */, traceResolution: options.traceResolution }, host, moduleResolutionCache);
118218
118219
  if (localOverrideModuleResult == null ? void 0 : localOverrideModuleResult.resolvedModule) {
118219
118220
  return localOverrideModuleResult.resolvedModule.resolvedFileName;
118220
118221
  }
@@ -118349,7 +118350,7 @@ ${lanes.join("\n")}
118349
118350
  void 0
118350
118351
  );
118351
118352
  } else {
118352
- const basePath = getNormalizedAbsolutePath(getDirectoryPath(refPath), host.getCurrentDirectory());
118353
+ const basePath = getNormalizedAbsolutePath(getDirectoryPath(refPath), currentDirectory);
118353
118354
  sourceFile = host.getSourceFile(refPath, 100 /* JSON */);
118354
118355
  addFileToFilesByName(
118355
118356
  sourceFile,
@@ -121380,6 +121381,7 @@ ${lanes.join("\n")}
121380
121381
  let failedLookupChecks;
121381
121382
  let startsWithPathChecks;
121382
121383
  let isInDirectoryChecks;
121384
+ let allResolutionsAreInvalidated = false;
121383
121385
  const getCurrentDirectory = memoize(() => resolutionHost.getCurrentDirectory());
121384
121386
  const cachedDirectoryStructureHost = resolutionHost.getCachedDirectoryStructureHost();
121385
121387
  const resolvedModuleNames = /* @__PURE__ */ new Map();
@@ -121422,7 +121424,8 @@ ${lanes.join("\n")}
121422
121424
  isFileWithInvalidatedNonRelativeUnresolvedImports,
121423
121425
  updateTypeRootsWatch,
121424
121426
  closeTypeRootsWatch,
121425
- clear: clear2
121427
+ clear: clear2,
121428
+ onChangesAffectModuleResolution
121426
121429
  };
121427
121430
  function getResolvedModule2(resolution) {
121428
121431
  return resolution.resolvedModule;
@@ -121445,6 +121448,7 @@ ${lanes.join("\n")}
121445
121448
  isInDirectoryChecks = void 0;
121446
121449
  affectingPathChecks = void 0;
121447
121450
  affectingPathChecksForFile = void 0;
121451
+ allResolutionsAreInvalidated = false;
121448
121452
  moduleResolutionCache.clear();
121449
121453
  typeReferenceDirectiveResolutionCache.clear();
121450
121454
  moduleResolutionCache.update(resolutionHost.getCompilationSettings());
@@ -121452,6 +121456,13 @@ ${lanes.join("\n")}
121452
121456
  impliedFormatPackageJsons.clear();
121453
121457
  hasChangedAutomaticTypeDirectiveNames = false;
121454
121458
  }
121459
+ function onChangesAffectModuleResolution() {
121460
+ allResolutionsAreInvalidated = true;
121461
+ moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
121462
+ typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
121463
+ moduleResolutionCache.update(resolutionHost.getCompilationSettings());
121464
+ typeReferenceDirectiveResolutionCache.update(resolutionHost.getCompilationSettings());
121465
+ }
121455
121466
  function startRecordingFilesWithChangedResolutions() {
121456
121467
  filesWithChangedSetOfUnresolvedImports = [];
121457
121468
  }
@@ -121471,7 +121482,7 @@ ${lanes.join("\n")}
121471
121482
  invalidateResolutionsOfFailedLookupLocations();
121472
121483
  const collected = filesWithInvalidatedResolutions;
121473
121484
  filesWithInvalidatedResolutions = void 0;
121474
- return (path) => customHasInvalidatedResolutions(path) || !!(collected == null ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path);
121485
+ return (path) => customHasInvalidatedResolutions(path) || allResolutionsAreInvalidated || !!(collected == null ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path);
121475
121486
  }
121476
121487
  function startCachingPerDirectoryResolution() {
121477
121488
  moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
@@ -121481,6 +121492,7 @@ ${lanes.join("\n")}
121481
121492
  }
121482
121493
  function finishCachingPerDirectoryResolution(newProgram, oldProgram) {
121483
121494
  filesWithInvalidatedNonRelativeUnresolvedImports = void 0;
121495
+ allResolutionsAreInvalidated = false;
121484
121496
  nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
121485
121497
  nonRelativeExternalModuleResolutions.clear();
121486
121498
  if (newProgram !== oldProgram) {
@@ -121592,8 +121604,8 @@ ${lanes.join("\n")}
121592
121604
  const name = loader.nameAndMode.getName(entry);
121593
121605
  const mode = loader.nameAndMode.getMode(entry, containingSourceFile);
121594
121606
  let resolution = resolutionsInFile.get(name, mode);
121595
- if (!seenNamesInFile.has(name, mode) && unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate
121596
- hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution)) {
121607
+ if (!seenNamesInFile.has(name, mode) && (allResolutionsAreInvalidated || unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate
121608
+ hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution))) {
121597
121609
  const existingResolution = resolution;
121598
121610
  resolution = loader.resolve(name, mode);
121599
121611
  if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
@@ -122015,8 +122027,23 @@ ${lanes.join("\n")}
122015
122027
  }
122016
122028
  resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
122017
122029
  }
122030
+ function invalidatePackageJsonMap() {
122031
+ const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
122032
+ if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
122033
+ packageJsonMap.forEach((_value, path) => isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : void 0);
122034
+ }
122035
+ }
122018
122036
  function invalidateResolutionsOfFailedLookupLocations() {
122019
122037
  var _a;
122038
+ if (allResolutionsAreInvalidated) {
122039
+ affectingPathChecksForFile = void 0;
122040
+ invalidatePackageJsonMap();
122041
+ failedLookupChecks = void 0;
122042
+ startsWithPathChecks = void 0;
122043
+ isInDirectoryChecks = void 0;
122044
+ affectingPathChecks = void 0;
122045
+ return true;
122046
+ }
122020
122047
  let invalidated = false;
122021
122048
  if (affectingPathChecksForFile) {
122022
122049
  (_a = resolutionHost.getCurrentProgram()) == null ? void 0 : _a.getSourceFiles().forEach((f) => {
@@ -122031,10 +122058,7 @@ ${lanes.join("\n")}
122031
122058
  return invalidated;
122032
122059
  }
122033
122060
  invalidated = invalidateResolutions(resolutionsWithFailedLookups, canInvalidateFailedLookupResolution) || invalidated;
122034
- const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
122035
- if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
122036
- packageJsonMap.forEach((_value, path) => isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : void 0);
122037
- }
122061
+ invalidatePackageJsonMap();
122038
122062
  failedLookupChecks = void 0;
122039
122063
  startsWithPathChecks = void 0;
122040
122064
  isInDirectoryChecks = void 0;
@@ -122991,7 +123015,8 @@ ${lanes.join("\n")}
122991
123015
  if (hasChangedCompilerOptions) {
122992
123016
  newLine = updateNewLine();
122993
123017
  if (program && changesAffectModuleResolution(program.getCompilerOptions(), compilerOptions)) {
122994
- resolutionCache.clear();
123018
+ debugger;
123019
+ resolutionCache.onChangesAffectModuleResolution();
122995
123020
  }
122996
123021
  }
122997
123022
  const hasInvalidatedResolutions = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions);
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.1";
57
- var version = `${versionMajorMinor}.0-dev.20230418`;
57
+ var version = `${versionMajorMinor}.0-dev.20230419`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
@@ -11483,7 +11483,7 @@ function getScriptKindFromFileName(fileName) {
11483
11483
  var supportedTSExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */], [".cts" /* Cts */, ".d.cts" /* Dcts */], [".mts" /* Mts */, ".d.mts" /* Dmts */]];
11484
11484
  var supportedTSExtensionsFlat = flatten(supportedTSExtensions);
11485
11485
  var supportedTSExtensionsWithJson = [...supportedTSExtensions, [".json" /* Json */]];
11486
- var supportedTSExtensionsForExtractExtension = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */, ".cts" /* Cts */, ".mts" /* Mts */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".cts" /* Cts */, ".mts" /* Mts */];
11486
+ var supportedTSExtensionsForExtractExtension = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */, ".cts" /* Cts */, ".mts" /* Mts */, ".ts" /* Ts */, ".tsx" /* Tsx */];
11487
11487
  var supportedJSExtensions = [[".js" /* Js */, ".jsx" /* Jsx */], [".mjs" /* Mjs */], [".cjs" /* Cjs */]];
11488
11488
  var supportedJSExtensionsFlat = flatten(supportedJSExtensions);
11489
11489
  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 */]];
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.1.0-dev.20230418",
5
+ "version": "5.1.0-dev.20230419",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -113,5 +113,5 @@
113
113
  "node": "14.21.1",
114
114
  "npm": "8.19.3"
115
115
  },
116
- "gitHead": "3d3b2c724eb7adb8afbd44d2e3ad48fa8b0e8a84"
116
+ "gitHead": "d346d57162d74d1919b4fc1510b856fdcd7dbed2"
117
117
  }