typescript 5.5.0-dev.20240519 → 5.5.0-dev.20240521

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.5";
21
- var version = `${versionMajorMinor}.0-dev.20240519`;
21
+ var version = `${versionMajorMinor}.0-dev.20240521`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -120263,7 +120263,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120263
120263
  return file2 || void 0;
120264
120264
  }
120265
120265
  let redirectedPath;
120266
- if (isReferencedFile(reason) && !useSourceOfProjectReferenceRedirect) {
120266
+ if (!useSourceOfProjectReferenceRedirect) {
120267
120267
  const redirectProject = getProjectReferenceRedirectProject(fileName);
120268
120268
  if (redirectProject) {
120269
120269
  if (redirectProject.commandLine.options.outFile) {
@@ -122608,6 +122608,7 @@ function getBuildInfo2(state) {
122608
122608
  const latestChangedDtsFile = state.latestChangedDtsFile ? relativeToBuildInfoEnsuringAbsolutePath(state.latestChangedDtsFile) : void 0;
122609
122609
  const fileNames = [];
122610
122610
  const fileNameToFileId = /* @__PURE__ */ new Map();
122611
+ const rootFileNames = new Set(state.program.getRootFileNames().map((f) => toPath(f, currentDirectory, state.program.getCanonicalFileName)));
122611
122612
  const root = [];
122612
122613
  if (state.compilerOptions.outFile) {
122613
122614
  const fileInfos2 = arrayFrom(state.fileInfos.entries(), ([key, value]) => {
@@ -122619,6 +122620,7 @@ function getBuildInfo2(state) {
122619
122620
  fileNames,
122620
122621
  fileInfos: fileInfos2,
122621
122622
  root,
122623
+ resolvedRoot: toResolvedRoot(),
122622
122624
  options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions),
122623
122625
  outSignature: state.outSignature,
122624
122626
  latestChangedDtsFile,
@@ -122648,7 +122650,8 @@ function getBuildInfo2(state) {
122648
122650
  if (!isJsonSourceFile(file) && sourceFileMayBeEmitted(file, state.program)) {
122649
122651
  const emitSignature = (_b = state.emitSignatures) == null ? void 0 : _b.get(key);
122650
122652
  if (emitSignature !== actualSignature) {
122651
- (emitSignatures || (emitSignatures = [])).push(
122653
+ emitSignatures = append(
122654
+ emitSignatures,
122652
122655
  emitSignature === void 0 ? fileId : (
122653
122656
  // There is no emit, encode as false
122654
122657
  // fileId, signature: emptyArray if signature only differs in dtsMap option than our own compilerOptions otherwise EmitSignature
@@ -122695,7 +122698,8 @@ function getBuildInfo2(state) {
122695
122698
  const file = state.program.getSourceFileByPath(path);
122696
122699
  if (!file || !sourceFileMayBeEmitted(file, state.program)) continue;
122697
122700
  const fileId = toFileId(path), pendingEmit = state.affectedFilesPendingEmit.get(path);
122698
- (affectedFilesPendingEmit || (affectedFilesPendingEmit = [])).push(
122701
+ affectedFilesPendingEmit = append(
122702
+ affectedFilesPendingEmit,
122699
122703
  pendingEmit === fullEmitForOptions ? fileId : (
122700
122704
  // Pending full emit per options
122701
122705
  pendingEmit === 8 /* Dts */ ? [fileId] : (
@@ -122711,7 +122715,7 @@ function getBuildInfo2(state) {
122711
122715
  let changeFileSet;
122712
122716
  if (state.changedFilesSet.size) {
122713
122717
  for (const path of arrayFrom(state.changedFilesSet.keys()).sort(compareStringsCaseSensitive)) {
122714
- (changeFileSet || (changeFileSet = [])).push(toFileId(path));
122718
+ changeFileSet = append(changeFileSet, toFileId(path));
122715
122719
  }
122716
122720
  }
122717
122721
  const emitDiagnosticsPerFile = convertToProgramBuildInfoDiagnostics(state.emitDiagnosticsPerFile);
@@ -122719,6 +122723,7 @@ function getBuildInfo2(state) {
122719
122723
  fileNames,
122720
122724
  fileInfos,
122721
122725
  root,
122726
+ resolvedRoot: toResolvedRoot(),
122722
122727
  options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions),
122723
122728
  fileIdsList,
122724
122729
  referencedMap,
@@ -122749,8 +122754,8 @@ function getBuildInfo2(state) {
122749
122754
  const key = fileIds.join();
122750
122755
  let fileIdListId = fileNamesToFileIdListId == null ? void 0 : fileNamesToFileIdListId.get(key);
122751
122756
  if (fileIdListId === void 0) {
122752
- (fileIdsList || (fileIdsList = [])).push(fileIds);
122753
- (fileNamesToFileIdListId || (fileNamesToFileIdListId = /* @__PURE__ */ new Map())).set(key, fileIdListId = fileIdsList.length);
122757
+ fileIdsList = append(fileIdsList, fileIds);
122758
+ (fileNamesToFileIdListId ?? (fileNamesToFileIdListId = /* @__PURE__ */ new Map())).set(key, fileIdListId = fileIdsList.length);
122754
122759
  }
122755
122760
  return fileIdListId;
122756
122761
  }
@@ -122767,6 +122772,16 @@ function getBuildInfo2(state) {
122767
122772
  root[root.length - 2] = [lastButOne, fileId];
122768
122773
  return root.length = root.length - 1;
122769
122774
  }
122775
+ function toResolvedRoot() {
122776
+ let result;
122777
+ rootFileNames.forEach((path) => {
122778
+ const file = state.program.getSourceFileByPath(path);
122779
+ if (file && path !== file.resolvedPath) {
122780
+ result = append(result, [toFileId(file.resolvedPath), toFileId(path)]);
122781
+ }
122782
+ });
122783
+ return result;
122784
+ }
122770
122785
  function convertToProgramBuildInfoCompilerOptions(options) {
122771
122786
  let result;
122772
122787
  const { optionsNameMap } = getOptionsNameMap();
@@ -122800,7 +122815,8 @@ function getBuildInfo2(state) {
122800
122815
  if (diagnostics) {
122801
122816
  for (const key of arrayFrom(diagnostics.keys()).sort(compareStringsCaseSensitive)) {
122802
122817
  const value = diagnostics.get(key);
122803
- (result || (result = [])).push(
122818
+ result = append(
122819
+ result,
122804
122820
  value.length ? [
122805
122821
  toFileId(key),
122806
122822
  convertToReusableDiagnostics(value)
@@ -123289,7 +123305,8 @@ function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
123289
123305
  const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
123290
123306
  const fileInfos = /* @__PURE__ */ new Map();
123291
123307
  let rootIndex = 0;
123292
- const roots = [];
123308
+ const roots = /* @__PURE__ */ new Map();
123309
+ const resolvedRoots = new Map(program.resolvedRoot);
123293
123310
  program.fileInfos.forEach((fileInfo, index) => {
123294
123311
  const path = toPath(program.fileNames[index], buildInfoDirectory, getCanonicalFileName);
123295
123312
  const version2 = isString(fileInfo) ? fileInfo : fileInfo.version;
@@ -123299,16 +123316,24 @@ function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
123299
123316
  const fileId = index + 1;
123300
123317
  if (isArray(current)) {
123301
123318
  if (current[0] <= fileId && fileId <= current[1]) {
123302
- roots.push(path);
123319
+ addRoot(fileId, path);
123303
123320
  if (current[1] === fileId) rootIndex++;
123304
123321
  }
123305
123322
  } else if (current === fileId) {
123306
- roots.push(path);
123323
+ addRoot(fileId, path);
123307
123324
  rootIndex++;
123308
123325
  }
123309
123326
  }
123310
123327
  });
123311
123328
  return { fileInfos, roots };
123329
+ function addRoot(fileId, path) {
123330
+ const root = resolvedRoots.get(fileId);
123331
+ if (root) {
123332
+ roots.set(toPath(program.fileNames[root - 1], buildInfoDirectory, getCanonicalFileName), path);
123333
+ } else {
123334
+ roots.set(path, void 0);
123335
+ }
123336
+ }
123312
123337
  }
123313
123338
  function createRedirectedBuilderProgram(getState, configFileParsingDiagnostics) {
123314
123339
  return {
@@ -126904,13 +126929,15 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
126904
126929
  reason: `${inputFile} does not exist`
126905
126930
  };
126906
126931
  }
126932
+ const inputPath = buildInfoProgram ? toPath2(state, inputFile) : void 0;
126907
126933
  if (buildInfoTime && buildInfoTime < inputTime) {
126908
126934
  let version2;
126909
126935
  let currentVersion;
126910
126936
  if (buildInfoProgram) {
126911
126937
  if (!buildInfoVersionMap) buildInfoVersionMap = getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
126912
- version2 = buildInfoVersionMap.fileInfos.get(toPath2(state, inputFile));
126913
- const text = version2 ? state.readFileWithCache(inputFile) : void 0;
126938
+ const resolvedInputPath = buildInfoVersionMap.roots.get(inputPath);
126939
+ version2 = buildInfoVersionMap.fileInfos.get(resolvedInputPath ?? inputPath);
126940
+ const text = version2 ? state.readFileWithCache(resolvedInputPath ?? inputFile) : void 0;
126914
126941
  currentVersion = text !== void 0 ? getSourceFileVersionAsHashFromText(host, text) : void 0;
126915
126942
  if (version2 && version2 === currentVersion) pseudoInputUpToDate = true;
126916
126943
  }
@@ -126926,18 +126953,21 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
126926
126953
  newestInputFileName = inputFile;
126927
126954
  newestInputFileTime = inputTime;
126928
126955
  }
126929
- if (buildInfoProgram) seenRoots.add(toPath2(state, inputFile));
126956
+ if (buildInfoProgram) seenRoots.add(inputPath);
126930
126957
  }
126931
126958
  if (buildInfoProgram) {
126932
126959
  if (!buildInfoVersionMap) buildInfoVersionMap = getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
126933
- for (const existingRoot of buildInfoVersionMap.roots) {
126934
- if (!seenRoots.has(existingRoot)) {
126935
- return {
126936
- type: 9 /* OutOfDateRoots */,
126937
- buildInfoFile: buildInfoPath,
126938
- inputFile: existingRoot
126939
- };
126940
- }
126960
+ const existingRoot = forEachEntry(
126961
+ buildInfoVersionMap.roots,
126962
+ // File was root file when project was built but its not any more
126963
+ (_resolved, existingRoot2) => !seenRoots.has(existingRoot2) ? existingRoot2 : void 0
126964
+ );
126965
+ if (existingRoot) {
126966
+ return {
126967
+ type: 9 /* OutOfDateRoots */,
126968
+ buildInfoFile: buildInfoPath,
126969
+ inputFile: existingRoot
126970
+ };
126941
126971
  }
126942
126972
  }
126943
126973
  if (!buildInfoPath) {
@@ -2756,7 +2756,6 @@ declare namespace ts {
2756
2756
  private compilerOptions;
2757
2757
  compileOnSaveEnabled: boolean;
2758
2758
  protected watchOptions: WatchOptions | undefined;
2759
- private rootFiles;
2760
2759
  private rootFilesMap;
2761
2760
  private program;
2762
2761
  private externalFiles;
@@ -2837,7 +2836,7 @@ declare namespace ts {
2837
2836
  private detachScriptInfoIfNotRoot;
2838
2837
  isClosed(): boolean;
2839
2838
  hasRoots(): boolean;
2840
- getRootFiles(): ts.server.NormalizedPath[];
2839
+ getRootFiles(): NormalizedPath[];
2841
2840
  getRootScriptInfos(): ts.server.ScriptInfo[];
2842
2841
  getScriptInfos(): ScriptInfo[];
2843
2842
  getExcludedFiles(): readonly NormalizedPath[];
package/lib/typescript.js CHANGED
@@ -2368,7 +2368,7 @@ module.exports = __toCommonJS(typescript_exports);
2368
2368
 
2369
2369
  // src/compiler/corePublic.ts
2370
2370
  var versionMajorMinor = "5.5";
2371
- var version = `${versionMajorMinor}.0-dev.20240519`;
2371
+ var version = `${versionMajorMinor}.0-dev.20240521`;
2372
2372
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2373
2373
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2374
2374
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -125297,7 +125297,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
125297
125297
  return file2 || void 0;
125298
125298
  }
125299
125299
  let redirectedPath;
125300
- if (isReferencedFile(reason) && !useSourceOfProjectReferenceRedirect) {
125300
+ if (!useSourceOfProjectReferenceRedirect) {
125301
125301
  const redirectProject = getProjectReferenceRedirectProject(fileName);
125302
125302
  if (redirectProject) {
125303
125303
  if (redirectProject.commandLine.options.outFile) {
@@ -127668,6 +127668,7 @@ function getBuildInfo2(state) {
127668
127668
  const latestChangedDtsFile = state.latestChangedDtsFile ? relativeToBuildInfoEnsuringAbsolutePath(state.latestChangedDtsFile) : void 0;
127669
127669
  const fileNames = [];
127670
127670
  const fileNameToFileId = /* @__PURE__ */ new Map();
127671
+ const rootFileNames = new Set(state.program.getRootFileNames().map((f) => toPath(f, currentDirectory, state.program.getCanonicalFileName)));
127671
127672
  const root = [];
127672
127673
  if (state.compilerOptions.outFile) {
127673
127674
  const fileInfos2 = arrayFrom(state.fileInfos.entries(), ([key, value]) => {
@@ -127679,6 +127680,7 @@ function getBuildInfo2(state) {
127679
127680
  fileNames,
127680
127681
  fileInfos: fileInfos2,
127681
127682
  root,
127683
+ resolvedRoot: toResolvedRoot(),
127682
127684
  options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions),
127683
127685
  outSignature: state.outSignature,
127684
127686
  latestChangedDtsFile,
@@ -127708,7 +127710,8 @@ function getBuildInfo2(state) {
127708
127710
  if (!isJsonSourceFile(file) && sourceFileMayBeEmitted(file, state.program)) {
127709
127711
  const emitSignature = (_b = state.emitSignatures) == null ? void 0 : _b.get(key);
127710
127712
  if (emitSignature !== actualSignature) {
127711
- (emitSignatures || (emitSignatures = [])).push(
127713
+ emitSignatures = append(
127714
+ emitSignatures,
127712
127715
  emitSignature === void 0 ? fileId : (
127713
127716
  // There is no emit, encode as false
127714
127717
  // fileId, signature: emptyArray if signature only differs in dtsMap option than our own compilerOptions otherwise EmitSignature
@@ -127755,7 +127758,8 @@ function getBuildInfo2(state) {
127755
127758
  const file = state.program.getSourceFileByPath(path);
127756
127759
  if (!file || !sourceFileMayBeEmitted(file, state.program)) continue;
127757
127760
  const fileId = toFileId(path), pendingEmit = state.affectedFilesPendingEmit.get(path);
127758
- (affectedFilesPendingEmit || (affectedFilesPendingEmit = [])).push(
127761
+ affectedFilesPendingEmit = append(
127762
+ affectedFilesPendingEmit,
127759
127763
  pendingEmit === fullEmitForOptions ? fileId : (
127760
127764
  // Pending full emit per options
127761
127765
  pendingEmit === 8 /* Dts */ ? [fileId] : (
@@ -127771,7 +127775,7 @@ function getBuildInfo2(state) {
127771
127775
  let changeFileSet;
127772
127776
  if (state.changedFilesSet.size) {
127773
127777
  for (const path of arrayFrom(state.changedFilesSet.keys()).sort(compareStringsCaseSensitive)) {
127774
- (changeFileSet || (changeFileSet = [])).push(toFileId(path));
127778
+ changeFileSet = append(changeFileSet, toFileId(path));
127775
127779
  }
127776
127780
  }
127777
127781
  const emitDiagnosticsPerFile = convertToProgramBuildInfoDiagnostics(state.emitDiagnosticsPerFile);
@@ -127779,6 +127783,7 @@ function getBuildInfo2(state) {
127779
127783
  fileNames,
127780
127784
  fileInfos,
127781
127785
  root,
127786
+ resolvedRoot: toResolvedRoot(),
127782
127787
  options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions),
127783
127788
  fileIdsList,
127784
127789
  referencedMap,
@@ -127809,8 +127814,8 @@ function getBuildInfo2(state) {
127809
127814
  const key = fileIds.join();
127810
127815
  let fileIdListId = fileNamesToFileIdListId == null ? void 0 : fileNamesToFileIdListId.get(key);
127811
127816
  if (fileIdListId === void 0) {
127812
- (fileIdsList || (fileIdsList = [])).push(fileIds);
127813
- (fileNamesToFileIdListId || (fileNamesToFileIdListId = /* @__PURE__ */ new Map())).set(key, fileIdListId = fileIdsList.length);
127817
+ fileIdsList = append(fileIdsList, fileIds);
127818
+ (fileNamesToFileIdListId ?? (fileNamesToFileIdListId = /* @__PURE__ */ new Map())).set(key, fileIdListId = fileIdsList.length);
127814
127819
  }
127815
127820
  return fileIdListId;
127816
127821
  }
@@ -127827,6 +127832,16 @@ function getBuildInfo2(state) {
127827
127832
  root[root.length - 2] = [lastButOne, fileId];
127828
127833
  return root.length = root.length - 1;
127829
127834
  }
127835
+ function toResolvedRoot() {
127836
+ let result;
127837
+ rootFileNames.forEach((path) => {
127838
+ const file = state.program.getSourceFileByPath(path);
127839
+ if (file && path !== file.resolvedPath) {
127840
+ result = append(result, [toFileId(file.resolvedPath), toFileId(path)]);
127841
+ }
127842
+ });
127843
+ return result;
127844
+ }
127830
127845
  function convertToProgramBuildInfoCompilerOptions(options) {
127831
127846
  let result;
127832
127847
  const { optionsNameMap } = getOptionsNameMap();
@@ -127860,7 +127875,8 @@ function getBuildInfo2(state) {
127860
127875
  if (diagnostics) {
127861
127876
  for (const key of arrayFrom(diagnostics.keys()).sort(compareStringsCaseSensitive)) {
127862
127877
  const value = diagnostics.get(key);
127863
- (result || (result = [])).push(
127878
+ result = append(
127879
+ result,
127864
127880
  value.length ? [
127865
127881
  toFileId(key),
127866
127882
  convertToReusableDiagnostics(value)
@@ -128354,7 +128370,8 @@ function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
128354
128370
  const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
128355
128371
  const fileInfos = /* @__PURE__ */ new Map();
128356
128372
  let rootIndex = 0;
128357
- const roots = [];
128373
+ const roots = /* @__PURE__ */ new Map();
128374
+ const resolvedRoots = new Map(program.resolvedRoot);
128358
128375
  program.fileInfos.forEach((fileInfo, index) => {
128359
128376
  const path = toPath(program.fileNames[index], buildInfoDirectory, getCanonicalFileName);
128360
128377
  const version2 = isString(fileInfo) ? fileInfo : fileInfo.version;
@@ -128364,16 +128381,24 @@ function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
128364
128381
  const fileId = index + 1;
128365
128382
  if (isArray(current)) {
128366
128383
  if (current[0] <= fileId && fileId <= current[1]) {
128367
- roots.push(path);
128384
+ addRoot(fileId, path);
128368
128385
  if (current[1] === fileId) rootIndex++;
128369
128386
  }
128370
128387
  } else if (current === fileId) {
128371
- roots.push(path);
128388
+ addRoot(fileId, path);
128372
128389
  rootIndex++;
128373
128390
  }
128374
128391
  }
128375
128392
  });
128376
128393
  return { fileInfos, roots };
128394
+ function addRoot(fileId, path) {
128395
+ const root = resolvedRoots.get(fileId);
128396
+ if (root) {
128397
+ roots.set(toPath(program.fileNames[root - 1], buildInfoDirectory, getCanonicalFileName), path);
128398
+ } else {
128399
+ roots.set(path, void 0);
128400
+ }
128401
+ }
128377
128402
  }
128378
128403
  function createRedirectedBuilderProgram(getState, configFileParsingDiagnostics) {
128379
128404
  return {
@@ -132029,13 +132054,15 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
132029
132054
  reason: `${inputFile} does not exist`
132030
132055
  };
132031
132056
  }
132057
+ const inputPath = buildInfoProgram ? toPath2(state, inputFile) : void 0;
132032
132058
  if (buildInfoTime && buildInfoTime < inputTime) {
132033
132059
  let version2;
132034
132060
  let currentVersion;
132035
132061
  if (buildInfoProgram) {
132036
132062
  if (!buildInfoVersionMap) buildInfoVersionMap = getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
132037
- version2 = buildInfoVersionMap.fileInfos.get(toPath2(state, inputFile));
132038
- const text = version2 ? state.readFileWithCache(inputFile) : void 0;
132063
+ const resolvedInputPath = buildInfoVersionMap.roots.get(inputPath);
132064
+ version2 = buildInfoVersionMap.fileInfos.get(resolvedInputPath ?? inputPath);
132065
+ const text = version2 ? state.readFileWithCache(resolvedInputPath ?? inputFile) : void 0;
132039
132066
  currentVersion = text !== void 0 ? getSourceFileVersionAsHashFromText(host, text) : void 0;
132040
132067
  if (version2 && version2 === currentVersion) pseudoInputUpToDate = true;
132041
132068
  }
@@ -132051,18 +132078,21 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
132051
132078
  newestInputFileName = inputFile;
132052
132079
  newestInputFileTime = inputTime;
132053
132080
  }
132054
- if (buildInfoProgram) seenRoots.add(toPath2(state, inputFile));
132081
+ if (buildInfoProgram) seenRoots.add(inputPath);
132055
132082
  }
132056
132083
  if (buildInfoProgram) {
132057
132084
  if (!buildInfoVersionMap) buildInfoVersionMap = getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
132058
- for (const existingRoot of buildInfoVersionMap.roots) {
132059
- if (!seenRoots.has(existingRoot)) {
132060
- return {
132061
- type: 9 /* OutOfDateRoots */,
132062
- buildInfoFile: buildInfoPath,
132063
- inputFile: existingRoot
132064
- };
132065
- }
132085
+ const existingRoot = forEachEntry(
132086
+ buildInfoVersionMap.roots,
132087
+ // File was root file when project was built but its not any more
132088
+ (_resolved, existingRoot2) => !seenRoots.has(existingRoot2) ? existingRoot2 : void 0
132089
+ );
132090
+ if (existingRoot) {
132091
+ return {
132092
+ type: 9 /* OutOfDateRoots */,
132093
+ buildInfoFile: buildInfoPath,
132094
+ inputFile: existingRoot
132095
+ };
132066
132096
  }
132067
132097
  }
132068
132098
  if (!buildInfoPath) {
@@ -181408,7 +181438,6 @@ var Project3 = class _Project {
181408
181438
  this.compilerOptions = compilerOptions;
181409
181439
  this.compileOnSaveEnabled = compileOnSaveEnabled;
181410
181440
  this.watchOptions = watchOptions;
181411
- this.rootFiles = [];
181412
181441
  this.rootFilesMap = /* @__PURE__ */ new Map();
181413
181442
  /** @internal */
181414
181443
  this.plugins = [];
@@ -181610,7 +181639,7 @@ var Project3 = class _Project {
181610
181639
  return void 0;
181611
181640
  }
181612
181641
  getScriptFileNames() {
181613
- if (!this.rootFiles) {
181642
+ if (!this.rootFilesMap.size) {
181614
181643
  return emptyArray;
181615
181644
  }
181616
181645
  let result;
@@ -181632,7 +181661,6 @@ var Project3 = class _Project {
181632
181661
  if (scriptInfo) {
181633
181662
  const existingValue = this.rootFilesMap.get(scriptInfo.path);
181634
181663
  if (existingValue && existingValue.info !== scriptInfo) {
181635
- this.rootFiles.push(scriptInfo);
181636
181664
  existingValue.info = scriptInfo;
181637
181665
  }
181638
181666
  scriptInfo.attachToProject(this);
@@ -181985,11 +182013,11 @@ var Project3 = class _Project {
181985
182013
  this.closeWatchingTypingLocations();
181986
182014
  this.cleanupProgram();
181987
182015
  forEach(this.externalFiles, (externalFile) => this.detachScriptInfoIfNotRoot(externalFile));
181988
- for (const root of this.rootFiles) {
181989
- root.detachFromProject(this);
181990
- }
182016
+ this.rootFilesMap.forEach((root) => {
182017
+ var _a2;
182018
+ return (_a2 = root.info) == null ? void 0 : _a2.detachFromProject(this);
182019
+ });
181991
182020
  this.projectService.pendingEnsureProjectForOpenFiles = true;
181992
- this.rootFiles = void 0;
181993
182021
  this.rootFilesMap = void 0;
181994
182022
  this.externalFiles = void 0;
181995
182023
  this.program = void 0;
@@ -182032,28 +182060,32 @@ var Project3 = class _Project {
182032
182060
  }
182033
182061
  }
182034
182062
  isClosed() {
182035
- return this.rootFiles === void 0;
182063
+ return this.rootFilesMap === void 0;
182036
182064
  }
182037
182065
  hasRoots() {
182038
- return this.rootFiles && this.rootFiles.length > 0;
182066
+ var _a;
182067
+ return !!((_a = this.rootFilesMap) == null ? void 0 : _a.size);
182039
182068
  }
182040
182069
  /** @internal */
182041
182070
  isOrphan() {
182042
182071
  return false;
182043
182072
  }
182044
182073
  getRootFiles() {
182045
- return this.rootFiles && this.rootFiles.map((info) => info.fileName);
182074
+ return this.rootFilesMap && arrayFrom(mapDefinedIterator(this.rootFilesMap.values(), (value) => {
182075
+ var _a;
182076
+ return (_a = value.info) == null ? void 0 : _a.fileName;
182077
+ }));
182046
182078
  }
182047
182079
  /** @internal */
182048
182080
  getRootFilesMap() {
182049
182081
  return this.rootFilesMap;
182050
182082
  }
182051
182083
  getRootScriptInfos() {
182052
- return this.rootFiles;
182084
+ return arrayFrom(mapDefinedIterator(this.rootFilesMap.values(), (value) => value.info));
182053
182085
  }
182054
182086
  getScriptInfos() {
182055
182087
  if (!this.languageServiceEnabled) {
182056
- return this.rootFiles;
182088
+ return this.getRootScriptInfos();
182057
182089
  }
182058
182090
  return map(this.program.getSourceFiles(), (sourceFile) => {
182059
182091
  const scriptInfo = this.projectService.getScriptInfoForPath(sourceFile.resolvedPath);
@@ -182137,13 +182169,12 @@ var Project3 = class _Project {
182137
182169
  return false;
182138
182170
  }
182139
182171
  isRoot(info) {
182140
- var _a;
182141
- return this.rootFilesMap && ((_a = this.rootFilesMap.get(info.path)) == null ? void 0 : _a.info) === info;
182172
+ var _a, _b;
182173
+ return ((_b = (_a = this.rootFilesMap) == null ? void 0 : _a.get(info.path)) == null ? void 0 : _b.info) === info;
182142
182174
  }
182143
182175
  // add a root file to project
182144
182176
  addRoot(info, fileName) {
182145
182177
  Debug.assert(!this.isRoot(info));
182146
- this.rootFiles.push(info);
182147
182178
  this.rootFilesMap.set(info.path, { fileName: fileName || info.fileName, info });
182148
182179
  info.attachToProject(this);
182149
182180
  this.markAsDirty();
@@ -182409,6 +182440,15 @@ var Project3 = class _Project {
182409
182440
  }
182410
182441
  });
182411
182442
  }
182443
+ this.rootFilesMap.forEach((value, path) => {
182444
+ var _a2;
182445
+ const file = this.program.getSourceFileByPath(path);
182446
+ const info = value.info;
182447
+ if (!file || ((_a2 = value.info) == null ? void 0 : _a2.path) === file.resolvedPath) return;
182448
+ value.info = this.projectService.getScriptInfo(file.fileName);
182449
+ Debug.assert(value.info.isAttached(this));
182450
+ info == null ? void 0 : info.detachFromProject(this);
182451
+ });
182412
182452
  updateMissingFilePathsWatch(
182413
182453
  this.program,
182414
182454
  this.missingFilesMap || (this.missingFilesMap = /* @__PURE__ */ new Map()),
@@ -182801,7 +182841,6 @@ var Project3 = class _Project {
182801
182841
  }
182802
182842
  // remove a root file from project
182803
182843
  removeRoot(info) {
182804
- orderedRemoveItem(this.rootFiles, info);
182805
182844
  this.rootFilesMap.delete(info.path);
182806
182845
  }
182807
182846
  /** @internal */
@@ -185496,6 +185535,7 @@ var _ProjectService = class _ProjectService {
185496
185535
  configFileExistenceInfo.config.watchedDirectoriesStale = void 0;
185497
185536
  }
185498
185537
  updateNonInferredProjectFiles(project, files, propertyReader) {
185538
+ var _a;
185499
185539
  const projectRootFilesMap = project.getRootFilesMap();
185500
185540
  const newRootScriptInfoMap = /* @__PURE__ */ new Map();
185501
185541
  for (const f of files) {
@@ -185507,7 +185547,7 @@ var _ProjectService = class _ProjectService {
185507
185547
  path = normalizedPathToPath(fileName, this.currentDirectory, this.toCanonicalFileName);
185508
185548
  const existingValue = projectRootFilesMap.get(path);
185509
185549
  if (existingValue) {
185510
- if (existingValue.info) {
185550
+ if (((_a = existingValue.info) == null ? void 0 : _a.path) === path) {
185511
185551
  project.removeFile(
185512
185552
  existingValue.info,
185513
185553
  /*fileExists*/
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "typescript",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.5.0-dev.20240519",
5
+ "version": "5.5.0-dev.20240521",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -110,5 +110,5 @@
110
110
  "node": "20.1.0",
111
111
  "npm": "8.19.4"
112
112
  },
113
- "gitHead": "79a851426c514a12a75b342e8dd2460ee6615f73"
113
+ "gitHead": "ba78807aa10e062e2fa2cd24f89109b4aff38c59"
114
114
  }