typescript 5.7.0-dev.20240918 → 5.7.0-dev.20240920

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.7";
21
- var version = `${versionMajorMinor}.0-dev.20240918`;
21
+ var version = `${versionMajorMinor}.0-dev.20240920`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -6928,7 +6928,6 @@ var Diagnostics = {
6928
6928
  Option_0_1_has_been_removed_Please_remove_it_from_your_configuration: diag(5108, 1 /* Error */, "Option_0_1_has_been_removed_Please_remove_it_from_your_configuration_5108", "Option '{0}={1}' has been removed. Please remove it from your configuration."),
6929
6929
  Option_moduleResolution_must_be_set_to_0_or_left_unspecified_when_option_module_is_set_to_1: diag(5109, 1 /* Error */, "Option_moduleResolution_must_be_set_to_0_or_left_unspecified_when_option_module_is_set_to_1_5109", "Option 'moduleResolution' must be set to '{0}' (or left unspecified) when option 'module' is set to '{1}'."),
6930
6930
  Option_module_must_be_set_to_0_when_option_moduleResolution_is_set_to_1: diag(5110, 1 /* Error */, "Option_module_must_be_set_to_0_when_option_moduleResolution_is_set_to_1_5110", "Option 'module' must be set to '{0}' when option 'moduleResolution' is set to '{1}'."),
6931
- Option_tsBuildInfoFile_cannot_be_specified_without_specifying_option_incremental_or_composite_or_if_not_running_tsc_b: diag(5111, 1 /* Error */, "Option_tsBuildInfoFile_cannot_be_specified_without_specifying_option_incremental_or_composite_or_if__5111", "Option 'tsBuildInfoFile' cannot be specified without specifying option 'incremental' or 'composite' or if not running 'tsc -b'."),
6932
6931
  Generates_a_sourcemap_for_each_corresponding_d_ts_file: diag(6e3, 3 /* Message */, "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000", "Generates a sourcemap for each corresponding '.d.ts' file."),
6933
6932
  Concatenate_and_emit_output_to_single_file: diag(6001, 3 /* Message */, "Concatenate_and_emit_output_to_single_file_6001", "Concatenate and emit output to single file."),
6934
6933
  Generates_corresponding_d_ts_file: diag(6002, 3 /* Message */, "Generates_corresponding_d_ts_file_6002", "Generates corresponding '.d.ts' file."),
@@ -38504,6 +38503,9 @@ function getErrorForNoInputFiles({ includeSpecs, excludeSpecs }, configFileName)
38504
38503
  function shouldReportNoInputFiles(fileNames, canJsonReportNoInutFiles, resolutionStack) {
38505
38504
  return fileNames.length === 0 && canJsonReportNoInutFiles && (!resolutionStack || resolutionStack.length === 0);
38506
38505
  }
38506
+ function isSolutionConfig(config) {
38507
+ return !config.fileNames.length && hasProperty(config.raw, "references");
38508
+ }
38507
38509
  function canJsonReportNoInputFiles(raw) {
38508
38510
  return !hasProperty(raw, "files") && !hasProperty(raw, "references");
38509
38511
  }
@@ -120102,15 +120104,22 @@ function forEachProjectReference(projectReferences, resolvedProjectReferences, c
120102
120104
  const result = cbRef(projectReferences2, parent);
120103
120105
  if (result) return result;
120104
120106
  }
120105
- return forEach(resolvedProjectReferences2, (resolvedRef, index) => {
120106
- if (resolvedRef && (seenResolvedRefs == null ? void 0 : seenResolvedRefs.has(resolvedRef.sourceFile.path))) {
120107
- return void 0;
120107
+ let skipChildren;
120108
+ return forEach(
120109
+ resolvedProjectReferences2,
120110
+ (resolvedRef, index) => {
120111
+ if (resolvedRef && (seenResolvedRefs == null ? void 0 : seenResolvedRefs.has(resolvedRef.sourceFile.path))) {
120112
+ (skipChildren ?? (skipChildren = /* @__PURE__ */ new Set())).add(resolvedRef);
120113
+ return void 0;
120114
+ }
120115
+ const result = cbResolvedRef(resolvedRef, parent, index);
120116
+ if (result || !resolvedRef) return result;
120117
+ (seenResolvedRefs || (seenResolvedRefs = /* @__PURE__ */ new Set())).add(resolvedRef.sourceFile.path);
120108
120118
  }
120109
- const result = cbResolvedRef(resolvedRef, parent, index);
120110
- if (result || !resolvedRef) return result;
120111
- (seenResolvedRefs || (seenResolvedRefs = /* @__PURE__ */ new Set())).add(resolvedRef.sourceFile.path);
120112
- return worker(resolvedRef.commandLine.projectReferences, resolvedRef.references, resolvedRef);
120113
- });
120119
+ ) || forEach(
120120
+ resolvedProjectReferences2,
120121
+ (resolvedRef) => resolvedRef && !(skipChildren == null ? void 0 : skipChildren.has(resolvedRef)) ? worker(resolvedRef.commandLine.projectReferences, resolvedRef.references, resolvedRef) : void 0
120122
+ );
120114
120123
  }
120115
120124
  }
120116
120125
  var inferredTypesContainingFile = "__inferred type names__.ts";
@@ -120208,7 +120217,13 @@ function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion,
120208
120217
  if (oldResolvedRef.commandLine.options.configFile !== newParsedCommandLine.options.configFile) return false;
120209
120218
  if (!arrayIsEqualTo(oldResolvedRef.commandLine.fileNames, newParsedCommandLine.fileNames)) return false;
120210
120219
  (seenResolvedRefs || (seenResolvedRefs = [])).push(oldResolvedRef);
120211
- return !forEach(oldResolvedRef.references, (childResolvedRef, index) => !resolvedProjectReferenceUptoDate(childResolvedRef, oldResolvedRef.commandLine.projectReferences[index]));
120220
+ return !forEach(
120221
+ oldResolvedRef.references,
120222
+ (childResolvedRef, index) => !resolvedProjectReferenceUptoDate(
120223
+ childResolvedRef,
120224
+ oldResolvedRef.commandLine.projectReferences[index]
120225
+ )
120226
+ );
120212
120227
  }
120213
120228
  const refPath = resolveProjectReferencePath(oldRef);
120214
120229
  return !getParsedCommandLine(refPath);
@@ -122639,11 +122654,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
122639
122654
  }
122640
122655
  }
122641
122656
  const outputFile = options.outFile;
122642
- if (options.tsBuildInfoFile) {
122643
- if (!canEmitTsBuildInfo(options)) {
122644
- createDiagnosticForOptionName(Diagnostics.Option_tsBuildInfoFile_cannot_be_specified_without_specifying_option_incremental_or_composite_or_if_not_running_tsc_b, "tsBuildInfoFile");
122645
- }
122646
- } else if (options.incremental && !outputFile && !options.configFilePath) {
122657
+ if (!options.tsBuildInfoFile && options.incremental && !outputFile && !options.configFilePath) {
122647
122658
  programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified));
122648
122659
  }
122649
122660
  verifyDeprecatedCompilerOptions();
@@ -123151,7 +123162,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
123151
123162
  case 1 /* SourceFromProjectReference */:
123152
123163
  case 2 /* OutputFromProjectReference */:
123153
123164
  const referencedResolvedRef = Debug.checkDefined(resolvedProjectReferences == null ? void 0 : resolvedProjectReferences[reason.index]);
123154
- const referenceInfo = forEachProjectReference(projectReferences, resolvedProjectReferences, (resolvedRef, parent, index2) => resolvedRef === referencedResolvedRef ? { sourceFile: (parent == null ? void 0 : parent.sourceFile) || options.configFile, index: index2 } : void 0);
123165
+ const referenceInfo = forEachProjectReference(
123166
+ projectReferences,
123167
+ resolvedProjectReferences,
123168
+ (resolvedRef, parent, index2) => resolvedRef === referencedResolvedRef ? { sourceFile: (parent == null ? void 0 : parent.sourceFile) || options.configFile, index: index2 } : void 0
123169
+ );
123155
123170
  if (!referenceInfo) return void 0;
123156
123171
  const { sourceFile, index } = referenceInfo;
123157
123172
  const referencesSyntax = forEachTsConfigPropArray(sourceFile, "references", (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0);
@@ -123186,27 +123201,31 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
123186
123201
  }
123187
123202
  function verifyProjectReferences() {
123188
123203
  const buildInfoPath = !options.suppressOutputPathCheck ? getTsBuildInfoEmitOutputFilePath(options) : void 0;
123189
- forEachProjectReference(projectReferences, resolvedProjectReferences, (resolvedRef, parent, index) => {
123190
- const ref = (parent ? parent.commandLine.projectReferences : projectReferences)[index];
123191
- const parentFile = parent && parent.sourceFile;
123192
- verifyDeprecatedProjectReference(ref, parentFile, index);
123193
- if (!resolvedRef) {
123194
- createDiagnosticForReference(parentFile, index, Diagnostics.File_0_not_found, ref.path);
123195
- return;
123196
- }
123197
- const options2 = resolvedRef.commandLine.options;
123198
- if (!options2.composite || options2.noEmit) {
123199
- const inputs = parent ? parent.commandLine.fileNames : rootNames;
123200
- if (inputs.length) {
123201
- if (!options2.composite) createDiagnosticForReference(parentFile, index, Diagnostics.Referenced_project_0_must_have_setting_composite_Colon_true, ref.path);
123202
- if (options2.noEmit) createDiagnosticForReference(parentFile, index, Diagnostics.Referenced_project_0_may_not_disable_emit, ref.path);
123204
+ forEachProjectReference(
123205
+ projectReferences,
123206
+ resolvedProjectReferences,
123207
+ (resolvedRef, parent, index) => {
123208
+ const ref = (parent ? parent.commandLine.projectReferences : projectReferences)[index];
123209
+ const parentFile = parent && parent.sourceFile;
123210
+ verifyDeprecatedProjectReference(ref, parentFile, index);
123211
+ if (!resolvedRef) {
123212
+ createDiagnosticForReference(parentFile, index, Diagnostics.File_0_not_found, ref.path);
123213
+ return;
123214
+ }
123215
+ const options2 = resolvedRef.commandLine.options;
123216
+ if (!options2.composite || options2.noEmit) {
123217
+ const inputs = parent ? parent.commandLine.fileNames : rootNames;
123218
+ if (inputs.length) {
123219
+ if (!options2.composite) createDiagnosticForReference(parentFile, index, Diagnostics.Referenced_project_0_must_have_setting_composite_Colon_true, ref.path);
123220
+ if (options2.noEmit) createDiagnosticForReference(parentFile, index, Diagnostics.Referenced_project_0_may_not_disable_emit, ref.path);
123221
+ }
123222
+ }
123223
+ if (!parent && buildInfoPath && buildInfoPath === getTsBuildInfoEmitOutputFilePath(options2)) {
123224
+ createDiagnosticForReference(parentFile, index, Diagnostics.Cannot_write_file_0_because_it_will_overwrite_tsbuildinfo_file_generated_by_referenced_project_1, buildInfoPath, ref.path);
123225
+ hasEmitBlockingDiagnostics.set(toPath3(buildInfoPath), true);
123203
123226
  }
123204
123227
  }
123205
- if (!parent && buildInfoPath && buildInfoPath === getTsBuildInfoEmitOutputFilePath(options2)) {
123206
- createDiagnosticForReference(parentFile, index, Diagnostics.Cannot_write_file_0_because_it_will_overwrite_tsbuildinfo_file_generated_by_referenced_project_1, buildInfoPath, ref.path);
123207
- hasEmitBlockingDiagnostics.set(toPath3(buildInfoPath), true);
123208
- }
123209
- });
123228
+ );
123210
123229
  }
123211
123230
  function createDiagnosticForOptionPathKeyValue(key, valueIndex, message, ...args) {
123212
123231
  let needCompilerDiagnostic = true;
@@ -127761,7 +127780,13 @@ function createWatchProgram(host) {
127761
127780
  Debug.assert(configFileName);
127762
127781
  updateLevel = 0 /* Update */;
127763
127782
  rootFileNames = getFileNamesFromConfigSpecs(compilerOptions.configFile.configFileSpecs, getNormalizedAbsolutePath(getDirectoryPath(configFileName), currentDirectory), compilerOptions, parseConfigFileHost, extraFileExtensions);
127764
- if (updateErrorForNoInputFiles(rootFileNames, getNormalizedAbsolutePath(configFileName, currentDirectory), compilerOptions.configFile.configFileSpecs, configFileParsingDiagnostics, canConfigFileJsonReportNoInputFiles)) {
127783
+ if (updateErrorForNoInputFiles(
127784
+ rootFileNames,
127785
+ getNormalizedAbsolutePath(configFileName, currentDirectory),
127786
+ compilerOptions.configFile.configFileSpecs,
127787
+ configFileParsingDiagnostics,
127788
+ canConfigFileJsonReportNoInputFiles
127789
+ )) {
127765
127790
  hasChangedConfigFileParsingErrors = true;
127766
127791
  }
127767
127792
  synchronizeProgram();
@@ -128722,7 +128747,13 @@ function getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue) {
128722
128747
  watchPackageJsonFiles(state, project, projectPath, config);
128723
128748
  } else if (updateLevel === 1 /* RootNamesAndUpdate */) {
128724
128749
  config.fileNames = getFileNamesFromConfigSpecs(config.options.configFile.configFileSpecs, getDirectoryPath(project), config.options, state.parseConfigFileHost);
128725
- updateErrorForNoInputFiles(config.fileNames, project, config.options.configFile.configFileSpecs, config.errors, canJsonReportNoInputFiles(config.raw));
128750
+ updateErrorForNoInputFiles(
128751
+ config.fileNames,
128752
+ project,
128753
+ config.options.configFile.configFileSpecs,
128754
+ config.errors,
128755
+ canJsonReportNoInputFiles(config.raw)
128756
+ );
128726
128757
  watchInputFiles(state, project, projectPath, config);
128727
128758
  watchPackageJsonFiles(state, project, projectPath, config);
128728
128759
  }
@@ -128903,11 +128934,7 @@ function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime,
128903
128934
  }
128904
128935
  function getUpToDateStatusWorker(state, project, resolvedPath) {
128905
128936
  var _a, _b, _c, _d, _e;
128906
- if (!project.fileNames.length && !canJsonReportNoInputFiles(project.raw)) {
128907
- return {
128908
- type: 16 /* ContainerOnly */
128909
- };
128910
- }
128937
+ if (isSolutionConfig(project)) return { type: 16 /* ContainerOnly */ };
128911
128938
  let referenceStatuses;
128912
128939
  const force = !!state.options.force;
128913
128940
  if (project.projectReferences) {
@@ -363,6 +363,10 @@ declare namespace ts {
363
363
  * Indicate if the file name list of the project is needed
364
364
  */
365
365
  needFileNameList: boolean;
366
+ /**
367
+ * if true returns details about default configured project calculation
368
+ */
369
+ needDefaultConfiguredProjectInfo?: boolean;
366
370
  }
367
371
  /**
368
372
  * A request to get the project information of the current file.
@@ -386,6 +390,17 @@ declare namespace ts {
386
390
  */
387
391
  projectFileName: string;
388
392
  }
393
+ /**
394
+ * Details about the default project for the file if tsconfig file is found
395
+ */
396
+ export interface DefaultConfiguredProjectInfo {
397
+ /** List of config files looked and did not match because file was not part of root file names */
398
+ notMatchedByConfig?: readonly string[];
399
+ /** List of projects which were loaded but file was not part of the project or is file from referenced project */
400
+ notInProject?: readonly string[];
401
+ /** Configured project used as default */
402
+ defaultProject?: string;
403
+ }
389
404
  /**
390
405
  * Response message body for "projectInfo" request
391
406
  */
@@ -403,6 +418,10 @@ declare namespace ts {
403
418
  * Indicates if the project has a active language service instance
404
419
  */
405
420
  languageServiceDisabled?: boolean;
421
+ /**
422
+ * Information about default project
423
+ */
424
+ configuredProjectInfo?: DefaultConfiguredProjectInfo;
406
425
  }
407
426
  /**
408
427
  * Represents diagnostic info that includes location of diagnostic in two forms
@@ -2827,7 +2846,6 @@ declare namespace ts {
2827
2846
  private lastReportedFileNames;
2828
2847
  private lastReportedVersion;
2829
2848
  protected projectErrors: Diagnostic[] | undefined;
2830
- protected isInitialLoadPending: () => boolean;
2831
2849
  private typingsCache;
2832
2850
  private typingWatchers;
2833
2851
  private readonly cancellationToken;
@@ -3275,6 +3293,7 @@ declare namespace ts {
3275
3293
  private deleteScriptInfo;
3276
3294
  private configFileExists;
3277
3295
  private createConfigFileWatcherForParsedConfig;
3296
+ private ensureConfigFileWatcherForProject;
3278
3297
  private forEachConfigFileLocation;
3279
3298
  private getConfigFileNameForFileFromCache;
3280
3299
  private setConfigFileNameForFileInCache;
@@ -3288,6 +3307,7 @@ declare namespace ts {
3288
3307
  private updateNonInferredProjectFiles;
3289
3308
  private updateRootAndOptionsOfNonInferredProject;
3290
3309
  private reloadFileNamesOfParsedConfig;
3310
+ private setProjectForReload;
3291
3311
  private clearSemanticCache;
3292
3312
  private getOrCreateInferredProjectForProjectRootPathIfEnabled;
3293
3313
  private getOrCreateSingleInferredProjectIfEnabled;
@@ -3334,6 +3354,8 @@ declare namespace ts {
3334
3354
  private getOrCreateOpenScriptInfo;
3335
3355
  private assignProjectToOpenedScriptInfo;
3336
3356
  private tryFindDefaultConfiguredProjectForOpenScriptInfo;
3357
+ private isMatchedByConfig;
3358
+ private tryFindDefaultConfiguredProjectForOpenScriptInfoOrClosedFileInfo;
3337
3359
  private tryFindDefaultConfiguredProjectAndLoadAncestorsForOpenScriptInfo;
3338
3360
  private ensureProjectChildren;
3339
3361
  private cleanupConfiguredProjects;
@@ -3481,6 +3503,7 @@ declare namespace ts {
3481
3503
  private setCompilerOptionsForInferredProjects;
3482
3504
  private getProjectInfo;
3483
3505
  private getProjectInfoWorker;
3506
+ private getDefaultConfiguredProjectInfo;
3484
3507
  private getRenameInfo;
3485
3508
  private getProjects;
3486
3509
  private getDefaultProject;