@typescript-deploys/pr-build 5.5.0-pr-58380-2 → 5.5.0-pr-58398-2
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 +201 -59
- package/lib/typescript.js +208 -60
- package/package.json +1 -1
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-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20240502`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -13534,7 +13534,7 @@ function entityNameToString(name) {
|
|
|
13534
13534
|
return Debug.assertNever(name.name);
|
|
13535
13535
|
}
|
|
13536
13536
|
case 311 /* JSDocMemberName */:
|
|
13537
|
-
return entityNameToString(name.left) + entityNameToString(name.right);
|
|
13537
|
+
return entityNameToString(name.left) + "#" + entityNameToString(name.right);
|
|
13538
13538
|
case 295 /* JsxNamespacedName */:
|
|
13539
13539
|
return entityNameToString(name.namespace) + ":" + entityNameToString(name.name);
|
|
13540
13540
|
default:
|
|
@@ -36968,6 +36968,10 @@ var configDirTemplateSubstitutionOptions = optionDeclarations.filter(
|
|
|
36968
36968
|
var configDirTemplateSubstitutionWatchOptions = optionsForWatch.filter(
|
|
36969
36969
|
(option) => option.allowConfigDirTemplateSubstitution || !option.isCommandLineOnly && option.isFilePath
|
|
36970
36970
|
);
|
|
36971
|
+
var commandLineOptionOfCustomType = optionDeclarations.filter(isCommandLineOptionOfCustomType);
|
|
36972
|
+
function isCommandLineOptionOfCustomType(option) {
|
|
36973
|
+
return !isString(option.type);
|
|
36974
|
+
}
|
|
36971
36975
|
var optionsForBuild = [
|
|
36972
36976
|
{
|
|
36973
36977
|
name: "verbose",
|
|
@@ -44124,7 +44128,7 @@ function createBinder() {
|
|
|
44124
44128
|
const reportError = (
|
|
44125
44129
|
// report error on all statements except empty ones
|
|
44126
44130
|
isStatementButNotDeclaration(node) && node.kind !== 242 /* EmptyStatement */ || // report error on class declarations
|
|
44127
|
-
node.kind === 263 /* ClassDeclaration */ ||
|
|
44131
|
+
node.kind === 263 /* ClassDeclaration */ || // report error on instantiated modules or const-enums only modules if preserveConstEnums is set
|
|
44128
44132
|
node.kind === 267 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)
|
|
44129
44133
|
);
|
|
44130
44134
|
if (reportError) {
|
|
@@ -69003,7 +69007,7 @@ function createTypeChecker(host) {
|
|
|
69003
69007
|
if (!hasDefaultClause) {
|
|
69004
69008
|
return caseType;
|
|
69005
69009
|
}
|
|
69006
|
-
const defaultType = filterType(type, (t) => !(isUnitLikeType(t) && contains(switchTypes, getRegularTypeOfLiteralType(extractUnitType(t)))));
|
|
69010
|
+
const defaultType = filterType(type, (t) => !(isUnitLikeType(t) && contains(switchTypes, t.flags & 32768 /* Undefined */ ? undefinedType : getRegularTypeOfLiteralType(extractUnitType(t)))));
|
|
69007
69011
|
return caseType.flags & 131072 /* Never */ ? defaultType : getUnionType([caseType, defaultType]);
|
|
69008
69012
|
}
|
|
69009
69013
|
function narrowTypeByTypeName(type, typeName) {
|
|
@@ -118790,10 +118794,41 @@ function getLibraryNameFromLibFileName(libFileName) {
|
|
|
118790
118794
|
}
|
|
118791
118795
|
return "@typescript/lib-" + path;
|
|
118792
118796
|
}
|
|
118797
|
+
function getLibNameFromLibReference(libReference) {
|
|
118798
|
+
return toFileNameLowerCase(libReference.fileName);
|
|
118799
|
+
}
|
|
118793
118800
|
function getLibFileNameFromLibReference(libReference) {
|
|
118794
|
-
const libName =
|
|
118795
|
-
|
|
118796
|
-
|
|
118801
|
+
const libName = getLibNameFromLibReference(libReference);
|
|
118802
|
+
return libMap.get(libName);
|
|
118803
|
+
}
|
|
118804
|
+
function fileIncludeReasonIsEqual(a, b) {
|
|
118805
|
+
if (a === b)
|
|
118806
|
+
return true;
|
|
118807
|
+
if (a.kind !== b.kind)
|
|
118808
|
+
return false;
|
|
118809
|
+
switch (a.kind) {
|
|
118810
|
+
case 0 /* RootFile */:
|
|
118811
|
+
Debug.type(b);
|
|
118812
|
+
return a.index === b.index;
|
|
118813
|
+
case 6 /* LibFile */:
|
|
118814
|
+
Debug.type(b);
|
|
118815
|
+
return a.index === b.index;
|
|
118816
|
+
case 1 /* SourceFromProjectReference */:
|
|
118817
|
+
case 2 /* OutputFromProjectReference */:
|
|
118818
|
+
Debug.type(b);
|
|
118819
|
+
return a.index === b.index;
|
|
118820
|
+
case 3 /* Import */:
|
|
118821
|
+
case 4 /* ReferenceFile */:
|
|
118822
|
+
case 5 /* TypeReferenceDirective */:
|
|
118823
|
+
case 7 /* LibReferenceDirective */:
|
|
118824
|
+
Debug.type(b);
|
|
118825
|
+
return a.file === b.file && a.index === b.index;
|
|
118826
|
+
case 8 /* AutomaticTypeDirectiveFile */:
|
|
118827
|
+
Debug.type(b);
|
|
118828
|
+
return a.typeReference === b.typeReference && packageIdIsEqual(a.packageId, b.packageId);
|
|
118829
|
+
default:
|
|
118830
|
+
return Debug.assertNever(a);
|
|
118831
|
+
}
|
|
118797
118832
|
}
|
|
118798
118833
|
function isReferencedFile(reason) {
|
|
118799
118834
|
switch (reason == null ? void 0 : reason.kind) {
|
|
@@ -119019,6 +119054,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119019
119054
|
const createProgramOptions = isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions;
|
|
119020
119055
|
const { rootNames, options, configFileParsingDiagnostics, projectReferences, typeScriptVersion: typeScriptVersion2 } = createProgramOptions;
|
|
119021
119056
|
let { oldProgram } = createProgramOptions;
|
|
119057
|
+
for (const option of commandLineOptionOfCustomType) {
|
|
119058
|
+
if (hasProperty(options, option.name)) {
|
|
119059
|
+
if (typeof options[option.name] === "string") {
|
|
119060
|
+
throw new Error(`${option.name} is a string value; tsconfig JSON must be parsed with parseJsonSourceFileConfigFileContent or getParsedCommandLineOfConfigFile before passing to createProgram`);
|
|
119061
|
+
}
|
|
119062
|
+
}
|
|
119063
|
+
}
|
|
119022
119064
|
const reportInvalidIgnoreDeprecations = memoize(() => createOptionValueDiagnostic("ignoreDeprecations", Diagnostics.Invalid_value_for_ignoreDeprecations));
|
|
119023
119065
|
let processingDefaultLibFiles;
|
|
119024
119066
|
let processingOtherFiles;
|
|
@@ -119029,6 +119071,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119029
119071
|
let classifiableNames;
|
|
119030
119072
|
const ambientModuleNameToUnmodifiedFileName = /* @__PURE__ */ new Map();
|
|
119031
119073
|
let fileReasons = createMultiMap();
|
|
119074
|
+
let fileReasonsToChain;
|
|
119075
|
+
let reasonToRelatedInfo;
|
|
119032
119076
|
const cachedBindAndCheckDiagnosticsForFile = {};
|
|
119033
119077
|
const cachedDeclarationDiagnosticsForFile = {};
|
|
119034
119078
|
let resolvedTypeReferenceDirectives = createModeAwareCache();
|
|
@@ -119060,6 +119104,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119060
119104
|
const getDefaultLibraryFileName = memoize(() => host.getDefaultLibFileName(options));
|
|
119061
119105
|
const defaultLibraryPath = host.getDefaultLibLocation ? host.getDefaultLibLocation() : getDirectoryPath(getDefaultLibraryFileName());
|
|
119062
119106
|
const programDiagnostics = createDiagnosticCollection();
|
|
119107
|
+
let lazyProgramDiagnosticExplainingFile = [];
|
|
119063
119108
|
const currentDirectory = host.getCurrentDirectory();
|
|
119064
119109
|
const supportedExtensions = getSupportedExtensions(options);
|
|
119065
119110
|
const supportedExtensionsWithJsonIfResolveJsonModule = getSupportedExtensionsWithJsonIfResolveJsonModule(options, supportedExtensions);
|
|
@@ -119388,24 +119433,64 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119388
119433
|
writeFile: writeFile2
|
|
119389
119434
|
};
|
|
119390
119435
|
onProgramCreateComplete();
|
|
119391
|
-
fileProcessingDiagnostics == null ? void 0 : fileProcessingDiagnostics.forEach((diagnostic) => {
|
|
119392
|
-
switch (diagnostic.kind) {
|
|
119393
|
-
case 1 /* FilePreprocessingFileExplainingDiagnostic */:
|
|
119394
|
-
return programDiagnostics.add(createDiagnosticExplainingFile(diagnostic.file && getSourceFileByPath(diagnostic.file), diagnostic.fileProcessingReason, diagnostic.diagnostic, diagnostic.args || emptyArray));
|
|
119395
|
-
case 0 /* FilePreprocessingReferencedDiagnostic */:
|
|
119396
|
-
const { file, pos, end } = getReferencedFileLocation(program, diagnostic.reason);
|
|
119397
|
-
return programDiagnostics.add(createFileDiagnostic(file, Debug.checkDefined(pos), Debug.checkDefined(end) - pos, diagnostic.diagnostic, ...diagnostic.args || emptyArray));
|
|
119398
|
-
case 2 /* ResolutionDiagnostics */:
|
|
119399
|
-
return diagnostic.diagnostics.forEach((d) => programDiagnostics.add(d));
|
|
119400
|
-
default:
|
|
119401
|
-
Debug.assertNever(diagnostic);
|
|
119402
|
-
}
|
|
119403
|
-
});
|
|
119404
119436
|
verifyCompilerOptions();
|
|
119405
119437
|
mark("afterProgram");
|
|
119406
119438
|
measure("Program", "beforeProgram", "afterProgram");
|
|
119407
119439
|
(_p = tracing) == null ? void 0 : _p.pop();
|
|
119408
119440
|
return program;
|
|
119441
|
+
function updateAndGetProgramDiagnostics() {
|
|
119442
|
+
if (lazyProgramDiagnosticExplainingFile) {
|
|
119443
|
+
fileProcessingDiagnostics == null ? void 0 : fileProcessingDiagnostics.forEach((diagnostic) => {
|
|
119444
|
+
switch (diagnostic.kind) {
|
|
119445
|
+
case 1 /* FilePreprocessingFileExplainingDiagnostic */:
|
|
119446
|
+
return programDiagnostics.add(
|
|
119447
|
+
createDiagnosticExplainingFile(
|
|
119448
|
+
diagnostic.file && getSourceFileByPath(diagnostic.file),
|
|
119449
|
+
diagnostic.fileProcessingReason,
|
|
119450
|
+
diagnostic.diagnostic,
|
|
119451
|
+
diagnostic.args || emptyArray
|
|
119452
|
+
)
|
|
119453
|
+
);
|
|
119454
|
+
case 0 /* FilePreprocessingLibreferenceDiagnostic */:
|
|
119455
|
+
return programDiagnostics.add(filePreprocessingLibreferenceDiagnostic(diagnostic));
|
|
119456
|
+
case 2 /* ResolutionDiagnostics */:
|
|
119457
|
+
return diagnostic.diagnostics.forEach((d) => programDiagnostics.add(d));
|
|
119458
|
+
default:
|
|
119459
|
+
Debug.assertNever(diagnostic);
|
|
119460
|
+
}
|
|
119461
|
+
});
|
|
119462
|
+
lazyProgramDiagnosticExplainingFile.forEach(
|
|
119463
|
+
({ file, diagnostic, args }) => programDiagnostics.add(
|
|
119464
|
+
createDiagnosticExplainingFile(
|
|
119465
|
+
file,
|
|
119466
|
+
/*fileProcessingReason*/
|
|
119467
|
+
void 0,
|
|
119468
|
+
diagnostic,
|
|
119469
|
+
args
|
|
119470
|
+
)
|
|
119471
|
+
)
|
|
119472
|
+
);
|
|
119473
|
+
lazyProgramDiagnosticExplainingFile = void 0;
|
|
119474
|
+
fileReasonsToChain = void 0;
|
|
119475
|
+
reasonToRelatedInfo = void 0;
|
|
119476
|
+
}
|
|
119477
|
+
return programDiagnostics;
|
|
119478
|
+
}
|
|
119479
|
+
function filePreprocessingLibreferenceDiagnostic({ reason }) {
|
|
119480
|
+
const { file, pos, end } = getReferencedFileLocation(program, reason);
|
|
119481
|
+
const libReference = file.libReferenceDirectives[reason.index];
|
|
119482
|
+
const libName = getLibNameFromLibReference(libReference);
|
|
119483
|
+
const unqualifiedLibName = removeSuffix(removePrefix(libName, "lib."), ".d.ts");
|
|
119484
|
+
const suggestion = getSpellingSuggestion(unqualifiedLibName, libs, identity);
|
|
119485
|
+
return createFileDiagnostic(
|
|
119486
|
+
file,
|
|
119487
|
+
Debug.checkDefined(pos),
|
|
119488
|
+
Debug.checkDefined(end) - pos,
|
|
119489
|
+
suggestion ? Diagnostics.Cannot_find_lib_definition_for_0_Did_you_mean_1 : Diagnostics.Cannot_find_lib_definition_for_0,
|
|
119490
|
+
libName,
|
|
119491
|
+
suggestion
|
|
119492
|
+
);
|
|
119493
|
+
}
|
|
119409
119494
|
function getResolvedModule(file, moduleName, mode) {
|
|
119410
119495
|
var _a2;
|
|
119411
119496
|
return (_a2 = resolvedModules == null ? void 0 : resolvedModules.get(file.path)) == null ? void 0 : _a2.get(moduleName, mode);
|
|
@@ -120098,7 +120183,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120098
120183
|
if (skipTypeChecking(sourceFile, options, program)) {
|
|
120099
120184
|
return emptyArray;
|
|
120100
120185
|
}
|
|
120101
|
-
const programDiagnosticsInFile =
|
|
120186
|
+
const programDiagnosticsInFile = updateAndGetProgramDiagnostics().getDiagnostics(sourceFile.fileName);
|
|
120102
120187
|
if (!((_a2 = sourceFile.commentDirectives) == null ? void 0 : _a2.length)) {
|
|
120103
120188
|
return programDiagnosticsInFile;
|
|
120104
120189
|
}
|
|
@@ -120445,16 +120530,16 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120445
120530
|
}
|
|
120446
120531
|
function getOptionsDiagnostics() {
|
|
120447
120532
|
return sortAndDeduplicateDiagnostics(concatenate(
|
|
120448
|
-
|
|
120533
|
+
updateAndGetProgramDiagnostics().getGlobalDiagnostics(),
|
|
120449
120534
|
getOptionsDiagnosticsOfConfigFile()
|
|
120450
120535
|
));
|
|
120451
120536
|
}
|
|
120452
120537
|
function getOptionsDiagnosticsOfConfigFile() {
|
|
120453
120538
|
if (!options.configFile)
|
|
120454
120539
|
return emptyArray;
|
|
120455
|
-
let diagnostics =
|
|
120540
|
+
let diagnostics = updateAndGetProgramDiagnostics().getDiagnostics(options.configFile.fileName);
|
|
120456
120541
|
forEachResolvedProjectReference2((resolvedRef) => {
|
|
120457
|
-
diagnostics = concatenate(diagnostics,
|
|
120542
|
+
diagnostics = concatenate(diagnostics, updateAndGetProgramDiagnostics().getDiagnostics(resolvedRef.sourceFile.fileName));
|
|
120458
120543
|
});
|
|
120459
120544
|
return diagnostics;
|
|
120460
120545
|
}
|
|
@@ -120628,7 +120713,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120628
120713
|
}
|
|
120629
120714
|
function getLibFileFromReference(ref) {
|
|
120630
120715
|
var _a2;
|
|
120631
|
-
const
|
|
120716
|
+
const libFileName = getLibFileNameFromLibReference(ref);
|
|
120632
120717
|
const actualFileName = libFileName && ((_a2 = resolvedLibReferences == null ? void 0 : resolvedLibReferences.get(libFileName)) == null ? void 0 : _a2.actual);
|
|
120633
120718
|
return actualFileName !== void 0 ? getSourceFile(actualFileName) : void 0;
|
|
120634
120719
|
}
|
|
@@ -120876,8 +120961,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120876
120961
|
return file;
|
|
120877
120962
|
}
|
|
120878
120963
|
function addFileIncludeReason(file, reason) {
|
|
120879
|
-
if (file)
|
|
120880
|
-
fileReasons.
|
|
120964
|
+
if (file) {
|
|
120965
|
+
const existing = fileReasons.get(file.path);
|
|
120966
|
+
if (!some(existing, (r) => fileIncludeReasonIsEqual(r, reason))) {
|
|
120967
|
+
fileReasons.add(file.path, reason);
|
|
120968
|
+
}
|
|
120969
|
+
}
|
|
120881
120970
|
}
|
|
120882
120971
|
function addFileToFilesByName(file, path, fileName, redirectedPath) {
|
|
120883
120972
|
if (redirectedPath) {
|
|
@@ -121107,7 +121196,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121107
121196
|
}
|
|
121108
121197
|
function processLibReferenceDirectives(file) {
|
|
121109
121198
|
forEach(file.libReferenceDirectives, (libReference, index) => {
|
|
121110
|
-
const
|
|
121199
|
+
const libFileName = getLibFileNameFromLibReference(libReference);
|
|
121111
121200
|
if (libFileName) {
|
|
121112
121201
|
processRootFile(
|
|
121113
121202
|
pathForLibFile(libFileName),
|
|
@@ -121118,15 +121207,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121118
121207
|
{ kind: 7 /* LibReferenceDirective */, file: file.path, index }
|
|
121119
121208
|
);
|
|
121120
121209
|
} else {
|
|
121121
|
-
const unqualifiedLibName = removeSuffix(removePrefix(libName, "lib."), ".d.ts");
|
|
121122
|
-
const suggestion = getSpellingSuggestion(unqualifiedLibName, libs, identity);
|
|
121123
|
-
const diagnostic = suggestion ? Diagnostics.Cannot_find_lib_definition_for_0_Did_you_mean_1 : Diagnostics.Cannot_find_lib_definition_for_0;
|
|
121124
|
-
const args = suggestion ? [libName, suggestion] : [libName];
|
|
121125
121210
|
(fileProcessingDiagnostics || (fileProcessingDiagnostics = [])).push({
|
|
121126
|
-
kind: 0 /*
|
|
121127
|
-
reason: { kind: 7 /* LibReferenceDirective */, file: file.path, index }
|
|
121128
|
-
diagnostic,
|
|
121129
|
-
args
|
|
121211
|
+
kind: 0 /* FilePreprocessingLibreferenceDiagnostic */,
|
|
121212
|
+
reason: { kind: 7 /* LibReferenceDirective */, file: file.path, index }
|
|
121130
121213
|
});
|
|
121131
121214
|
}
|
|
121132
121215
|
});
|
|
@@ -121187,7 +121270,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121187
121270
|
if (!sourceFile.isDeclarationFile) {
|
|
121188
121271
|
const absoluteSourceFilePath = host.getCanonicalFileName(getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory));
|
|
121189
121272
|
if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) {
|
|
121190
|
-
|
|
121273
|
+
addLazyProgramDiagnosticExplainingFile(
|
|
121191
121274
|
sourceFile,
|
|
121192
121275
|
Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files,
|
|
121193
121276
|
[sourceFile.fileName, rootDirectory]
|
|
@@ -121317,7 +121400,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121317
121400
|
const rootPaths = new Set(rootNames.map(toPath3));
|
|
121318
121401
|
for (const file of files) {
|
|
121319
121402
|
if (sourceFileMayBeEmitted(file, program) && !rootPaths.has(file.path)) {
|
|
121320
|
-
|
|
121403
|
+
addLazyProgramDiagnosticExplainingFile(
|
|
121321
121404
|
file,
|
|
121322
121405
|
Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern,
|
|
121323
121406
|
[file.fileName, options.configFilePath || ""]
|
|
@@ -121680,31 +121763,90 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121680
121763
|
});
|
|
121681
121764
|
}
|
|
121682
121765
|
function createDiagnosticExplainingFile(file, fileProcessingReason, diagnostic, args) {
|
|
121683
|
-
|
|
121766
|
+
let seenReasons;
|
|
121767
|
+
const reasons = file && fileReasons.get(file.path);
|
|
121684
121768
|
let fileIncludeReasons;
|
|
121685
121769
|
let relatedInfo;
|
|
121686
121770
|
let locationReason = isReferencedFile(fileProcessingReason) ? fileProcessingReason : void 0;
|
|
121687
|
-
|
|
121688
|
-
|
|
121771
|
+
let fileIncludeReasonDetails;
|
|
121772
|
+
let redirectInfo;
|
|
121773
|
+
let cachedChain = file && (fileReasonsToChain == null ? void 0 : fileReasonsToChain.get(file.path));
|
|
121774
|
+
let chain;
|
|
121775
|
+
if (cachedChain) {
|
|
121776
|
+
if (cachedChain.fileIncludeReasonDetails) {
|
|
121777
|
+
seenReasons = new Set(reasons);
|
|
121778
|
+
reasons == null ? void 0 : reasons.forEach(populateRelatedInfo);
|
|
121779
|
+
} else {
|
|
121780
|
+
reasons == null ? void 0 : reasons.forEach(processReason);
|
|
121781
|
+
}
|
|
121782
|
+
redirectInfo = cachedChain.redirectInfo;
|
|
121783
|
+
} else {
|
|
121784
|
+
reasons == null ? void 0 : reasons.forEach(processReason);
|
|
121785
|
+
redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file, getCompilerOptionsForFile(file));
|
|
121786
|
+
}
|
|
121689
121787
|
if (fileProcessingReason)
|
|
121690
121788
|
processReason(fileProcessingReason);
|
|
121691
|
-
|
|
121692
|
-
|
|
121789
|
+
const processedExtraReason = (seenReasons == null ? void 0 : seenReasons.size) !== (reasons == null ? void 0 : reasons.length);
|
|
121790
|
+
if (locationReason && (seenReasons == null ? void 0 : seenReasons.size) === 1)
|
|
121791
|
+
seenReasons = void 0;
|
|
121792
|
+
if (seenReasons && cachedChain) {
|
|
121793
|
+
if (cachedChain.details && !processedExtraReason) {
|
|
121794
|
+
chain = chainDiagnosticMessages(cachedChain.details, diagnostic, ...args || emptyArray);
|
|
121795
|
+
} else if (cachedChain.fileIncludeReasonDetails) {
|
|
121796
|
+
if (!processedExtraReason) {
|
|
121797
|
+
if (!cachedFileIncludeDetailsHasProcessedExtraReason()) {
|
|
121798
|
+
fileIncludeReasonDetails = cachedChain.fileIncludeReasonDetails;
|
|
121799
|
+
} else {
|
|
121800
|
+
fileIncludeReasons = cachedChain.fileIncludeReasonDetails.next.slice(0, reasons.length);
|
|
121801
|
+
}
|
|
121802
|
+
} else {
|
|
121803
|
+
if (!cachedFileIncludeDetailsHasProcessedExtraReason()) {
|
|
121804
|
+
fileIncludeReasons = [...cachedChain.fileIncludeReasonDetails.next, fileIncludeReasons[0]];
|
|
121805
|
+
} else {
|
|
121806
|
+
fileIncludeReasons = append(cachedChain.fileIncludeReasonDetails.next.slice(0, reasons.length), fileIncludeReasons[0]);
|
|
121807
|
+
}
|
|
121808
|
+
}
|
|
121809
|
+
}
|
|
121810
|
+
}
|
|
121811
|
+
if (!chain) {
|
|
121812
|
+
if (!fileIncludeReasonDetails)
|
|
121813
|
+
fileIncludeReasonDetails = seenReasons && chainDiagnosticMessages(fileIncludeReasons, Diagnostics.The_file_is_in_the_program_because_Colon);
|
|
121814
|
+
chain = chainDiagnosticMessages(
|
|
121815
|
+
redirectInfo ? fileIncludeReasonDetails ? [fileIncludeReasonDetails, ...redirectInfo] : redirectInfo : fileIncludeReasonDetails,
|
|
121816
|
+
diagnostic,
|
|
121817
|
+
...args || emptyArray
|
|
121818
|
+
);
|
|
121819
|
+
}
|
|
121820
|
+
if (file) {
|
|
121821
|
+
if (cachedChain) {
|
|
121822
|
+
if (!cachedChain.fileIncludeReasonDetails || !processedExtraReason && fileIncludeReasonDetails) {
|
|
121823
|
+
cachedChain.fileIncludeReasonDetails = fileIncludeReasonDetails;
|
|
121824
|
+
}
|
|
121825
|
+
} else {
|
|
121826
|
+
(fileReasonsToChain ?? (fileReasonsToChain = /* @__PURE__ */ new Map())).set(file.path, cachedChain = { fileIncludeReasonDetails, redirectInfo });
|
|
121827
|
+
}
|
|
121828
|
+
if (!cachedChain.details && !processedExtraReason)
|
|
121829
|
+
cachedChain.details = chain.next;
|
|
121830
|
+
}
|
|
121693
121831
|
const location = locationReason && getReferencedFileLocation(program, locationReason);
|
|
121694
|
-
const fileIncludeReasonDetails = fileIncludeReasons && chainDiagnosticMessages(fileIncludeReasons, Diagnostics.The_file_is_in_the_program_because_Colon);
|
|
121695
|
-
const optionsForFile = file && getCompilerOptionsForFile(file) || options;
|
|
121696
|
-
const redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file, optionsForFile);
|
|
121697
|
-
const chain = chainDiagnosticMessages(redirectInfo ? fileIncludeReasonDetails ? [fileIncludeReasonDetails, ...redirectInfo] : redirectInfo : fileIncludeReasonDetails, diagnostic, ...args || emptyArray);
|
|
121698
121832
|
return location && isReferenceFileLocation(location) ? createFileDiagnosticFromMessageChain(location.file, location.pos, location.end - location.pos, chain, relatedInfo) : createCompilerDiagnosticFromMessageChain(chain, relatedInfo);
|
|
121699
121833
|
function processReason(reason) {
|
|
121700
|
-
(
|
|
121834
|
+
if (seenReasons == null ? void 0 : seenReasons.has(reason))
|
|
121835
|
+
return;
|
|
121836
|
+
(seenReasons ?? (seenReasons = /* @__PURE__ */ new Set())).add(reason);
|
|
121837
|
+
(fileIncludeReasons ?? (fileIncludeReasons = [])).push(fileIncludeReasonToDiagnostics(program, reason));
|
|
121838
|
+
populateRelatedInfo(reason);
|
|
121839
|
+
}
|
|
121840
|
+
function populateRelatedInfo(reason) {
|
|
121701
121841
|
if (!locationReason && isReferencedFile(reason)) {
|
|
121702
121842
|
locationReason = reason;
|
|
121703
121843
|
} else if (locationReason !== reason) {
|
|
121704
|
-
relatedInfo = append(relatedInfo,
|
|
121844
|
+
relatedInfo = append(relatedInfo, getFileIncludeReasonToRelatedInformation(reason));
|
|
121705
121845
|
}
|
|
121706
|
-
|
|
121707
|
-
|
|
121846
|
+
}
|
|
121847
|
+
function cachedFileIncludeDetailsHasProcessedExtraReason() {
|
|
121848
|
+
var _a2;
|
|
121849
|
+
return ((_a2 = cachedChain.fileIncludeReasonDetails.next) == null ? void 0 : _a2.length) !== (reasons == null ? void 0 : reasons.length);
|
|
121708
121850
|
}
|
|
121709
121851
|
}
|
|
121710
121852
|
function addFilePreprocessingFileExplainingDiagnostic(file, fileProcessingReason, diagnostic, args) {
|
|
@@ -121716,14 +121858,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121716
121858
|
args
|
|
121717
121859
|
});
|
|
121718
121860
|
}
|
|
121719
|
-
function
|
|
121720
|
-
|
|
121721
|
-
|
|
121722
|
-
|
|
121723
|
-
|
|
121724
|
-
|
|
121725
|
-
|
|
121726
|
-
|
|
121861
|
+
function addLazyProgramDiagnosticExplainingFile(file, diagnostic, args) {
|
|
121862
|
+
lazyProgramDiagnosticExplainingFile.push({ file, diagnostic, args });
|
|
121863
|
+
}
|
|
121864
|
+
function getFileIncludeReasonToRelatedInformation(reason) {
|
|
121865
|
+
let relatedInfo = reasonToRelatedInfo == null ? void 0 : reasonToRelatedInfo.get(reason);
|
|
121866
|
+
if (relatedInfo === void 0)
|
|
121867
|
+
(reasonToRelatedInfo ?? (reasonToRelatedInfo = /* @__PURE__ */ new Map())).set(reason, relatedInfo = fileIncludeReasonToRelatedInformation(reason) ?? false);
|
|
121868
|
+
return relatedInfo || void 0;
|
|
121727
121869
|
}
|
|
121728
121870
|
function fileIncludeReasonToRelatedInformation(reason) {
|
|
121729
121871
|
if (isReferencedFile(reason)) {
|
package/lib/typescript.js
CHANGED
|
@@ -302,6 +302,7 @@ __export(typescript_exports, {
|
|
|
302
302
|
collectExternalModuleInfo: () => collectExternalModuleInfo,
|
|
303
303
|
combine: () => combine,
|
|
304
304
|
combinePaths: () => combinePaths,
|
|
305
|
+
commandLineOptionOfCustomType: () => commandLineOptionOfCustomType,
|
|
305
306
|
commentPragmas: () => commentPragmas,
|
|
306
307
|
commonOptionsWithBuild: () => commonOptionsWithBuild,
|
|
307
308
|
commonPackageFolders: () => commonPackageFolders,
|
|
@@ -1983,6 +1984,7 @@ __export(typescript_exports, {
|
|
|
1983
1984
|
or: () => or,
|
|
1984
1985
|
orderedRemoveItem: () => orderedRemoveItem,
|
|
1985
1986
|
orderedRemoveItemAt: () => orderedRemoveItemAt,
|
|
1987
|
+
packageIdIsEqual: () => packageIdIsEqual,
|
|
1986
1988
|
packageIdToPackageName: () => packageIdToPackageName,
|
|
1987
1989
|
packageIdToString: () => packageIdToString,
|
|
1988
1990
|
paramHelper: () => paramHelper,
|
|
@@ -2362,7 +2364,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2362
2364
|
|
|
2363
2365
|
// src/compiler/corePublic.ts
|
|
2364
2366
|
var versionMajorMinor = "5.5";
|
|
2365
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2367
|
+
var version = `${versionMajorMinor}.0-insiders.20240502`;
|
|
2366
2368
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2367
2369
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2368
2370
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6353,7 +6355,7 @@ var FileIncludeKind = /* @__PURE__ */ ((FileIncludeKind2) => {
|
|
|
6353
6355
|
return FileIncludeKind2;
|
|
6354
6356
|
})(FileIncludeKind || {});
|
|
6355
6357
|
var FilePreprocessingDiagnosticsKind = /* @__PURE__ */ ((FilePreprocessingDiagnosticsKind2) => {
|
|
6356
|
-
FilePreprocessingDiagnosticsKind2[FilePreprocessingDiagnosticsKind2["
|
|
6358
|
+
FilePreprocessingDiagnosticsKind2[FilePreprocessingDiagnosticsKind2["FilePreprocessingLibreferenceDiagnostic"] = 0] = "FilePreprocessingLibreferenceDiagnostic";
|
|
6357
6359
|
FilePreprocessingDiagnosticsKind2[FilePreprocessingDiagnosticsKind2["FilePreprocessingFileExplainingDiagnostic"] = 1] = "FilePreprocessingFileExplainingDiagnostic";
|
|
6358
6360
|
FilePreprocessingDiagnosticsKind2[FilePreprocessingDiagnosticsKind2["ResolutionDiagnostics"] = 2] = "ResolutionDiagnostics";
|
|
6359
6361
|
return FilePreprocessingDiagnosticsKind2;
|
|
@@ -17460,7 +17462,7 @@ function entityNameToString(name) {
|
|
|
17460
17462
|
return Debug.assertNever(name.name);
|
|
17461
17463
|
}
|
|
17462
17464
|
case 311 /* JSDocMemberName */:
|
|
17463
|
-
return entityNameToString(name.left) + entityNameToString(name.right);
|
|
17465
|
+
return entityNameToString(name.left) + "#" + entityNameToString(name.right);
|
|
17464
17466
|
case 295 /* JsxNamespacedName */:
|
|
17465
17467
|
return entityNameToString(name.namespace) + ":" + entityNameToString(name.name);
|
|
17466
17468
|
default:
|
|
@@ -41444,6 +41446,10 @@ var configDirTemplateSubstitutionOptions = optionDeclarations.filter(
|
|
|
41444
41446
|
var configDirTemplateSubstitutionWatchOptions = optionsForWatch.filter(
|
|
41445
41447
|
(option) => option.allowConfigDirTemplateSubstitution || !option.isCommandLineOnly && option.isFilePath
|
|
41446
41448
|
);
|
|
41449
|
+
var commandLineOptionOfCustomType = optionDeclarations.filter(isCommandLineOptionOfCustomType);
|
|
41450
|
+
function isCommandLineOptionOfCustomType(option) {
|
|
41451
|
+
return !isString(option.type);
|
|
41452
|
+
}
|
|
41447
41453
|
var optionsForBuild = [
|
|
41448
41454
|
{
|
|
41449
41455
|
name: "verbose",
|
|
@@ -48855,7 +48861,7 @@ function createBinder() {
|
|
|
48855
48861
|
const reportError = (
|
|
48856
48862
|
// report error on all statements except empty ones
|
|
48857
48863
|
isStatementButNotDeclaration(node) && node.kind !== 242 /* EmptyStatement */ || // report error on class declarations
|
|
48858
|
-
node.kind === 263 /* ClassDeclaration */ ||
|
|
48864
|
+
node.kind === 263 /* ClassDeclaration */ || // report error on instantiated modules or const-enums only modules if preserveConstEnums is set
|
|
48859
48865
|
node.kind === 267 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)
|
|
48860
48866
|
);
|
|
48861
48867
|
if (reportError) {
|
|
@@ -73835,7 +73841,7 @@ function createTypeChecker(host) {
|
|
|
73835
73841
|
if (!hasDefaultClause) {
|
|
73836
73842
|
return caseType;
|
|
73837
73843
|
}
|
|
73838
|
-
const defaultType = filterType(type, (t) => !(isUnitLikeType(t) && contains(switchTypes, getRegularTypeOfLiteralType(extractUnitType(t)))));
|
|
73844
|
+
const defaultType = filterType(type, (t) => !(isUnitLikeType(t) && contains(switchTypes, t.flags & 32768 /* Undefined */ ? undefinedType : getRegularTypeOfLiteralType(extractUnitType(t)))));
|
|
73839
73845
|
return caseType.flags & 131072 /* Never */ ? defaultType : getUnionType([caseType, defaultType]);
|
|
73840
73846
|
}
|
|
73841
73847
|
function narrowTypeByTypeName(type, typeName) {
|
|
@@ -123862,10 +123868,41 @@ function getLibraryNameFromLibFileName(libFileName) {
|
|
|
123862
123868
|
}
|
|
123863
123869
|
return "@typescript/lib-" + path;
|
|
123864
123870
|
}
|
|
123871
|
+
function getLibNameFromLibReference(libReference) {
|
|
123872
|
+
return toFileNameLowerCase(libReference.fileName);
|
|
123873
|
+
}
|
|
123865
123874
|
function getLibFileNameFromLibReference(libReference) {
|
|
123866
|
-
const libName =
|
|
123867
|
-
|
|
123868
|
-
|
|
123875
|
+
const libName = getLibNameFromLibReference(libReference);
|
|
123876
|
+
return libMap.get(libName);
|
|
123877
|
+
}
|
|
123878
|
+
function fileIncludeReasonIsEqual(a, b) {
|
|
123879
|
+
if (a === b)
|
|
123880
|
+
return true;
|
|
123881
|
+
if (a.kind !== b.kind)
|
|
123882
|
+
return false;
|
|
123883
|
+
switch (a.kind) {
|
|
123884
|
+
case 0 /* RootFile */:
|
|
123885
|
+
Debug.type(b);
|
|
123886
|
+
return a.index === b.index;
|
|
123887
|
+
case 6 /* LibFile */:
|
|
123888
|
+
Debug.type(b);
|
|
123889
|
+
return a.index === b.index;
|
|
123890
|
+
case 1 /* SourceFromProjectReference */:
|
|
123891
|
+
case 2 /* OutputFromProjectReference */:
|
|
123892
|
+
Debug.type(b);
|
|
123893
|
+
return a.index === b.index;
|
|
123894
|
+
case 3 /* Import */:
|
|
123895
|
+
case 4 /* ReferenceFile */:
|
|
123896
|
+
case 5 /* TypeReferenceDirective */:
|
|
123897
|
+
case 7 /* LibReferenceDirective */:
|
|
123898
|
+
Debug.type(b);
|
|
123899
|
+
return a.file === b.file && a.index === b.index;
|
|
123900
|
+
case 8 /* AutomaticTypeDirectiveFile */:
|
|
123901
|
+
Debug.type(b);
|
|
123902
|
+
return a.typeReference === b.typeReference && packageIdIsEqual(a.packageId, b.packageId);
|
|
123903
|
+
default:
|
|
123904
|
+
return Debug.assertNever(a);
|
|
123905
|
+
}
|
|
123869
123906
|
}
|
|
123870
123907
|
function isReferencedFile(reason) {
|
|
123871
123908
|
switch (reason == null ? void 0 : reason.kind) {
|
|
@@ -124095,6 +124132,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
124095
124132
|
const createProgramOptions = isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions;
|
|
124096
124133
|
const { rootNames, options, configFileParsingDiagnostics, projectReferences, typeScriptVersion: typeScriptVersion3 } = createProgramOptions;
|
|
124097
124134
|
let { oldProgram } = createProgramOptions;
|
|
124135
|
+
for (const option of commandLineOptionOfCustomType) {
|
|
124136
|
+
if (hasProperty(options, option.name)) {
|
|
124137
|
+
if (typeof options[option.name] === "string") {
|
|
124138
|
+
throw new Error(`${option.name} is a string value; tsconfig JSON must be parsed with parseJsonSourceFileConfigFileContent or getParsedCommandLineOfConfigFile before passing to createProgram`);
|
|
124139
|
+
}
|
|
124140
|
+
}
|
|
124141
|
+
}
|
|
124098
124142
|
const reportInvalidIgnoreDeprecations = memoize(() => createOptionValueDiagnostic("ignoreDeprecations", Diagnostics.Invalid_value_for_ignoreDeprecations));
|
|
124099
124143
|
let processingDefaultLibFiles;
|
|
124100
124144
|
let processingOtherFiles;
|
|
@@ -124105,6 +124149,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
124105
124149
|
let classifiableNames;
|
|
124106
124150
|
const ambientModuleNameToUnmodifiedFileName = /* @__PURE__ */ new Map();
|
|
124107
124151
|
let fileReasons = createMultiMap();
|
|
124152
|
+
let fileReasonsToChain;
|
|
124153
|
+
let reasonToRelatedInfo;
|
|
124108
124154
|
const cachedBindAndCheckDiagnosticsForFile = {};
|
|
124109
124155
|
const cachedDeclarationDiagnosticsForFile = {};
|
|
124110
124156
|
let resolvedTypeReferenceDirectives = createModeAwareCache();
|
|
@@ -124136,6 +124182,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
124136
124182
|
const getDefaultLibraryFileName = memoize(() => host.getDefaultLibFileName(options));
|
|
124137
124183
|
const defaultLibraryPath = host.getDefaultLibLocation ? host.getDefaultLibLocation() : getDirectoryPath(getDefaultLibraryFileName());
|
|
124138
124184
|
const programDiagnostics = createDiagnosticCollection();
|
|
124185
|
+
let lazyProgramDiagnosticExplainingFile = [];
|
|
124139
124186
|
const currentDirectory = host.getCurrentDirectory();
|
|
124140
124187
|
const supportedExtensions = getSupportedExtensions(options);
|
|
124141
124188
|
const supportedExtensionsWithJsonIfResolveJsonModule = getSupportedExtensionsWithJsonIfResolveJsonModule(options, supportedExtensions);
|
|
@@ -124464,24 +124511,64 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
124464
124511
|
writeFile: writeFile2
|
|
124465
124512
|
};
|
|
124466
124513
|
onProgramCreateComplete();
|
|
124467
|
-
fileProcessingDiagnostics == null ? void 0 : fileProcessingDiagnostics.forEach((diagnostic) => {
|
|
124468
|
-
switch (diagnostic.kind) {
|
|
124469
|
-
case 1 /* FilePreprocessingFileExplainingDiagnostic */:
|
|
124470
|
-
return programDiagnostics.add(createDiagnosticExplainingFile(diagnostic.file && getSourceFileByPath(diagnostic.file), diagnostic.fileProcessingReason, diagnostic.diagnostic, diagnostic.args || emptyArray));
|
|
124471
|
-
case 0 /* FilePreprocessingReferencedDiagnostic */:
|
|
124472
|
-
const { file, pos, end } = getReferencedFileLocation(program, diagnostic.reason);
|
|
124473
|
-
return programDiagnostics.add(createFileDiagnostic(file, Debug.checkDefined(pos), Debug.checkDefined(end) - pos, diagnostic.diagnostic, ...diagnostic.args || emptyArray));
|
|
124474
|
-
case 2 /* ResolutionDiagnostics */:
|
|
124475
|
-
return diagnostic.diagnostics.forEach((d) => programDiagnostics.add(d));
|
|
124476
|
-
default:
|
|
124477
|
-
Debug.assertNever(diagnostic);
|
|
124478
|
-
}
|
|
124479
|
-
});
|
|
124480
124514
|
verifyCompilerOptions();
|
|
124481
124515
|
mark("afterProgram");
|
|
124482
124516
|
measure("Program", "beforeProgram", "afterProgram");
|
|
124483
124517
|
(_p = tracing) == null ? void 0 : _p.pop();
|
|
124484
124518
|
return program;
|
|
124519
|
+
function updateAndGetProgramDiagnostics() {
|
|
124520
|
+
if (lazyProgramDiagnosticExplainingFile) {
|
|
124521
|
+
fileProcessingDiagnostics == null ? void 0 : fileProcessingDiagnostics.forEach((diagnostic) => {
|
|
124522
|
+
switch (diagnostic.kind) {
|
|
124523
|
+
case 1 /* FilePreprocessingFileExplainingDiagnostic */:
|
|
124524
|
+
return programDiagnostics.add(
|
|
124525
|
+
createDiagnosticExplainingFile(
|
|
124526
|
+
diagnostic.file && getSourceFileByPath(diagnostic.file),
|
|
124527
|
+
diagnostic.fileProcessingReason,
|
|
124528
|
+
diagnostic.diagnostic,
|
|
124529
|
+
diagnostic.args || emptyArray
|
|
124530
|
+
)
|
|
124531
|
+
);
|
|
124532
|
+
case 0 /* FilePreprocessingLibreferenceDiagnostic */:
|
|
124533
|
+
return programDiagnostics.add(filePreprocessingLibreferenceDiagnostic(diagnostic));
|
|
124534
|
+
case 2 /* ResolutionDiagnostics */:
|
|
124535
|
+
return diagnostic.diagnostics.forEach((d) => programDiagnostics.add(d));
|
|
124536
|
+
default:
|
|
124537
|
+
Debug.assertNever(diagnostic);
|
|
124538
|
+
}
|
|
124539
|
+
});
|
|
124540
|
+
lazyProgramDiagnosticExplainingFile.forEach(
|
|
124541
|
+
({ file, diagnostic, args }) => programDiagnostics.add(
|
|
124542
|
+
createDiagnosticExplainingFile(
|
|
124543
|
+
file,
|
|
124544
|
+
/*fileProcessingReason*/
|
|
124545
|
+
void 0,
|
|
124546
|
+
diagnostic,
|
|
124547
|
+
args
|
|
124548
|
+
)
|
|
124549
|
+
)
|
|
124550
|
+
);
|
|
124551
|
+
lazyProgramDiagnosticExplainingFile = void 0;
|
|
124552
|
+
fileReasonsToChain = void 0;
|
|
124553
|
+
reasonToRelatedInfo = void 0;
|
|
124554
|
+
}
|
|
124555
|
+
return programDiagnostics;
|
|
124556
|
+
}
|
|
124557
|
+
function filePreprocessingLibreferenceDiagnostic({ reason }) {
|
|
124558
|
+
const { file, pos, end } = getReferencedFileLocation(program, reason);
|
|
124559
|
+
const libReference = file.libReferenceDirectives[reason.index];
|
|
124560
|
+
const libName = getLibNameFromLibReference(libReference);
|
|
124561
|
+
const unqualifiedLibName = removeSuffix(removePrefix(libName, "lib."), ".d.ts");
|
|
124562
|
+
const suggestion = getSpellingSuggestion(unqualifiedLibName, libs, identity);
|
|
124563
|
+
return createFileDiagnostic(
|
|
124564
|
+
file,
|
|
124565
|
+
Debug.checkDefined(pos),
|
|
124566
|
+
Debug.checkDefined(end) - pos,
|
|
124567
|
+
suggestion ? Diagnostics.Cannot_find_lib_definition_for_0_Did_you_mean_1 : Diagnostics.Cannot_find_lib_definition_for_0,
|
|
124568
|
+
libName,
|
|
124569
|
+
suggestion
|
|
124570
|
+
);
|
|
124571
|
+
}
|
|
124485
124572
|
function getResolvedModule(file, moduleName, mode) {
|
|
124486
124573
|
var _a2;
|
|
124487
124574
|
return (_a2 = resolvedModules == null ? void 0 : resolvedModules.get(file.path)) == null ? void 0 : _a2.get(moduleName, mode);
|
|
@@ -125174,7 +125261,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
125174
125261
|
if (skipTypeChecking(sourceFile, options, program)) {
|
|
125175
125262
|
return emptyArray;
|
|
125176
125263
|
}
|
|
125177
|
-
const programDiagnosticsInFile =
|
|
125264
|
+
const programDiagnosticsInFile = updateAndGetProgramDiagnostics().getDiagnostics(sourceFile.fileName);
|
|
125178
125265
|
if (!((_a2 = sourceFile.commentDirectives) == null ? void 0 : _a2.length)) {
|
|
125179
125266
|
return programDiagnosticsInFile;
|
|
125180
125267
|
}
|
|
@@ -125521,16 +125608,16 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
125521
125608
|
}
|
|
125522
125609
|
function getOptionsDiagnostics() {
|
|
125523
125610
|
return sortAndDeduplicateDiagnostics(concatenate(
|
|
125524
|
-
|
|
125611
|
+
updateAndGetProgramDiagnostics().getGlobalDiagnostics(),
|
|
125525
125612
|
getOptionsDiagnosticsOfConfigFile()
|
|
125526
125613
|
));
|
|
125527
125614
|
}
|
|
125528
125615
|
function getOptionsDiagnosticsOfConfigFile() {
|
|
125529
125616
|
if (!options.configFile)
|
|
125530
125617
|
return emptyArray;
|
|
125531
|
-
let diagnostics =
|
|
125618
|
+
let diagnostics = updateAndGetProgramDiagnostics().getDiagnostics(options.configFile.fileName);
|
|
125532
125619
|
forEachResolvedProjectReference2((resolvedRef) => {
|
|
125533
|
-
diagnostics = concatenate(diagnostics,
|
|
125620
|
+
diagnostics = concatenate(diagnostics, updateAndGetProgramDiagnostics().getDiagnostics(resolvedRef.sourceFile.fileName));
|
|
125534
125621
|
});
|
|
125535
125622
|
return diagnostics;
|
|
125536
125623
|
}
|
|
@@ -125704,7 +125791,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
125704
125791
|
}
|
|
125705
125792
|
function getLibFileFromReference(ref) {
|
|
125706
125793
|
var _a2;
|
|
125707
|
-
const
|
|
125794
|
+
const libFileName = getLibFileNameFromLibReference(ref);
|
|
125708
125795
|
const actualFileName = libFileName && ((_a2 = resolvedLibReferences == null ? void 0 : resolvedLibReferences.get(libFileName)) == null ? void 0 : _a2.actual);
|
|
125709
125796
|
return actualFileName !== void 0 ? getSourceFile(actualFileName) : void 0;
|
|
125710
125797
|
}
|
|
@@ -125952,8 +126039,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
125952
126039
|
return file;
|
|
125953
126040
|
}
|
|
125954
126041
|
function addFileIncludeReason(file, reason) {
|
|
125955
|
-
if (file)
|
|
125956
|
-
fileReasons.
|
|
126042
|
+
if (file) {
|
|
126043
|
+
const existing = fileReasons.get(file.path);
|
|
126044
|
+
if (!some(existing, (r) => fileIncludeReasonIsEqual(r, reason))) {
|
|
126045
|
+
fileReasons.add(file.path, reason);
|
|
126046
|
+
}
|
|
126047
|
+
}
|
|
125957
126048
|
}
|
|
125958
126049
|
function addFileToFilesByName(file, path, fileName, redirectedPath) {
|
|
125959
126050
|
if (redirectedPath) {
|
|
@@ -126183,7 +126274,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
126183
126274
|
}
|
|
126184
126275
|
function processLibReferenceDirectives(file) {
|
|
126185
126276
|
forEach(file.libReferenceDirectives, (libReference, index) => {
|
|
126186
|
-
const
|
|
126277
|
+
const libFileName = getLibFileNameFromLibReference(libReference);
|
|
126187
126278
|
if (libFileName) {
|
|
126188
126279
|
processRootFile(
|
|
126189
126280
|
pathForLibFile(libFileName),
|
|
@@ -126194,15 +126285,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
126194
126285
|
{ kind: 7 /* LibReferenceDirective */, file: file.path, index }
|
|
126195
126286
|
);
|
|
126196
126287
|
} else {
|
|
126197
|
-
const unqualifiedLibName = removeSuffix(removePrefix(libName, "lib."), ".d.ts");
|
|
126198
|
-
const suggestion = getSpellingSuggestion(unqualifiedLibName, libs, identity);
|
|
126199
|
-
const diagnostic = suggestion ? Diagnostics.Cannot_find_lib_definition_for_0_Did_you_mean_1 : Diagnostics.Cannot_find_lib_definition_for_0;
|
|
126200
|
-
const args = suggestion ? [libName, suggestion] : [libName];
|
|
126201
126288
|
(fileProcessingDiagnostics || (fileProcessingDiagnostics = [])).push({
|
|
126202
|
-
kind: 0 /*
|
|
126203
|
-
reason: { kind: 7 /* LibReferenceDirective */, file: file.path, index }
|
|
126204
|
-
diagnostic,
|
|
126205
|
-
args
|
|
126289
|
+
kind: 0 /* FilePreprocessingLibreferenceDiagnostic */,
|
|
126290
|
+
reason: { kind: 7 /* LibReferenceDirective */, file: file.path, index }
|
|
126206
126291
|
});
|
|
126207
126292
|
}
|
|
126208
126293
|
});
|
|
@@ -126263,7 +126348,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
126263
126348
|
if (!sourceFile.isDeclarationFile) {
|
|
126264
126349
|
const absoluteSourceFilePath = host.getCanonicalFileName(getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory));
|
|
126265
126350
|
if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) {
|
|
126266
|
-
|
|
126351
|
+
addLazyProgramDiagnosticExplainingFile(
|
|
126267
126352
|
sourceFile,
|
|
126268
126353
|
Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files,
|
|
126269
126354
|
[sourceFile.fileName, rootDirectory]
|
|
@@ -126393,7 +126478,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
126393
126478
|
const rootPaths = new Set(rootNames.map(toPath3));
|
|
126394
126479
|
for (const file of files) {
|
|
126395
126480
|
if (sourceFileMayBeEmitted(file, program) && !rootPaths.has(file.path)) {
|
|
126396
|
-
|
|
126481
|
+
addLazyProgramDiagnosticExplainingFile(
|
|
126397
126482
|
file,
|
|
126398
126483
|
Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern,
|
|
126399
126484
|
[file.fileName, options.configFilePath || ""]
|
|
@@ -126756,31 +126841,90 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
126756
126841
|
});
|
|
126757
126842
|
}
|
|
126758
126843
|
function createDiagnosticExplainingFile(file, fileProcessingReason, diagnostic, args) {
|
|
126759
|
-
|
|
126844
|
+
let seenReasons;
|
|
126845
|
+
const reasons = file && fileReasons.get(file.path);
|
|
126760
126846
|
let fileIncludeReasons;
|
|
126761
126847
|
let relatedInfo;
|
|
126762
126848
|
let locationReason = isReferencedFile(fileProcessingReason) ? fileProcessingReason : void 0;
|
|
126763
|
-
|
|
126764
|
-
|
|
126849
|
+
let fileIncludeReasonDetails;
|
|
126850
|
+
let redirectInfo;
|
|
126851
|
+
let cachedChain = file && (fileReasonsToChain == null ? void 0 : fileReasonsToChain.get(file.path));
|
|
126852
|
+
let chain;
|
|
126853
|
+
if (cachedChain) {
|
|
126854
|
+
if (cachedChain.fileIncludeReasonDetails) {
|
|
126855
|
+
seenReasons = new Set(reasons);
|
|
126856
|
+
reasons == null ? void 0 : reasons.forEach(populateRelatedInfo);
|
|
126857
|
+
} else {
|
|
126858
|
+
reasons == null ? void 0 : reasons.forEach(processReason);
|
|
126859
|
+
}
|
|
126860
|
+
redirectInfo = cachedChain.redirectInfo;
|
|
126861
|
+
} else {
|
|
126862
|
+
reasons == null ? void 0 : reasons.forEach(processReason);
|
|
126863
|
+
redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file, getCompilerOptionsForFile(file));
|
|
126864
|
+
}
|
|
126765
126865
|
if (fileProcessingReason)
|
|
126766
126866
|
processReason(fileProcessingReason);
|
|
126767
|
-
|
|
126768
|
-
|
|
126867
|
+
const processedExtraReason = (seenReasons == null ? void 0 : seenReasons.size) !== (reasons == null ? void 0 : reasons.length);
|
|
126868
|
+
if (locationReason && (seenReasons == null ? void 0 : seenReasons.size) === 1)
|
|
126869
|
+
seenReasons = void 0;
|
|
126870
|
+
if (seenReasons && cachedChain) {
|
|
126871
|
+
if (cachedChain.details && !processedExtraReason) {
|
|
126872
|
+
chain = chainDiagnosticMessages(cachedChain.details, diagnostic, ...args || emptyArray);
|
|
126873
|
+
} else if (cachedChain.fileIncludeReasonDetails) {
|
|
126874
|
+
if (!processedExtraReason) {
|
|
126875
|
+
if (!cachedFileIncludeDetailsHasProcessedExtraReason()) {
|
|
126876
|
+
fileIncludeReasonDetails = cachedChain.fileIncludeReasonDetails;
|
|
126877
|
+
} else {
|
|
126878
|
+
fileIncludeReasons = cachedChain.fileIncludeReasonDetails.next.slice(0, reasons.length);
|
|
126879
|
+
}
|
|
126880
|
+
} else {
|
|
126881
|
+
if (!cachedFileIncludeDetailsHasProcessedExtraReason()) {
|
|
126882
|
+
fileIncludeReasons = [...cachedChain.fileIncludeReasonDetails.next, fileIncludeReasons[0]];
|
|
126883
|
+
} else {
|
|
126884
|
+
fileIncludeReasons = append(cachedChain.fileIncludeReasonDetails.next.slice(0, reasons.length), fileIncludeReasons[0]);
|
|
126885
|
+
}
|
|
126886
|
+
}
|
|
126887
|
+
}
|
|
126888
|
+
}
|
|
126889
|
+
if (!chain) {
|
|
126890
|
+
if (!fileIncludeReasonDetails)
|
|
126891
|
+
fileIncludeReasonDetails = seenReasons && chainDiagnosticMessages(fileIncludeReasons, Diagnostics.The_file_is_in_the_program_because_Colon);
|
|
126892
|
+
chain = chainDiagnosticMessages(
|
|
126893
|
+
redirectInfo ? fileIncludeReasonDetails ? [fileIncludeReasonDetails, ...redirectInfo] : redirectInfo : fileIncludeReasonDetails,
|
|
126894
|
+
diagnostic,
|
|
126895
|
+
...args || emptyArray
|
|
126896
|
+
);
|
|
126897
|
+
}
|
|
126898
|
+
if (file) {
|
|
126899
|
+
if (cachedChain) {
|
|
126900
|
+
if (!cachedChain.fileIncludeReasonDetails || !processedExtraReason && fileIncludeReasonDetails) {
|
|
126901
|
+
cachedChain.fileIncludeReasonDetails = fileIncludeReasonDetails;
|
|
126902
|
+
}
|
|
126903
|
+
} else {
|
|
126904
|
+
(fileReasonsToChain ?? (fileReasonsToChain = /* @__PURE__ */ new Map())).set(file.path, cachedChain = { fileIncludeReasonDetails, redirectInfo });
|
|
126905
|
+
}
|
|
126906
|
+
if (!cachedChain.details && !processedExtraReason)
|
|
126907
|
+
cachedChain.details = chain.next;
|
|
126908
|
+
}
|
|
126769
126909
|
const location = locationReason && getReferencedFileLocation(program, locationReason);
|
|
126770
|
-
const fileIncludeReasonDetails = fileIncludeReasons && chainDiagnosticMessages(fileIncludeReasons, Diagnostics.The_file_is_in_the_program_because_Colon);
|
|
126771
|
-
const optionsForFile = file && getCompilerOptionsForFile(file) || options;
|
|
126772
|
-
const redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file, optionsForFile);
|
|
126773
|
-
const chain = chainDiagnosticMessages(redirectInfo ? fileIncludeReasonDetails ? [fileIncludeReasonDetails, ...redirectInfo] : redirectInfo : fileIncludeReasonDetails, diagnostic, ...args || emptyArray);
|
|
126774
126910
|
return location && isReferenceFileLocation(location) ? createFileDiagnosticFromMessageChain(location.file, location.pos, location.end - location.pos, chain, relatedInfo) : createCompilerDiagnosticFromMessageChain(chain, relatedInfo);
|
|
126775
126911
|
function processReason(reason) {
|
|
126776
|
-
(
|
|
126912
|
+
if (seenReasons == null ? void 0 : seenReasons.has(reason))
|
|
126913
|
+
return;
|
|
126914
|
+
(seenReasons ?? (seenReasons = /* @__PURE__ */ new Set())).add(reason);
|
|
126915
|
+
(fileIncludeReasons ?? (fileIncludeReasons = [])).push(fileIncludeReasonToDiagnostics(program, reason));
|
|
126916
|
+
populateRelatedInfo(reason);
|
|
126917
|
+
}
|
|
126918
|
+
function populateRelatedInfo(reason) {
|
|
126777
126919
|
if (!locationReason && isReferencedFile(reason)) {
|
|
126778
126920
|
locationReason = reason;
|
|
126779
126921
|
} else if (locationReason !== reason) {
|
|
126780
|
-
relatedInfo = append(relatedInfo,
|
|
126922
|
+
relatedInfo = append(relatedInfo, getFileIncludeReasonToRelatedInformation(reason));
|
|
126781
126923
|
}
|
|
126782
|
-
|
|
126783
|
-
|
|
126924
|
+
}
|
|
126925
|
+
function cachedFileIncludeDetailsHasProcessedExtraReason() {
|
|
126926
|
+
var _a2;
|
|
126927
|
+
return ((_a2 = cachedChain.fileIncludeReasonDetails.next) == null ? void 0 : _a2.length) !== (reasons == null ? void 0 : reasons.length);
|
|
126784
126928
|
}
|
|
126785
126929
|
}
|
|
126786
126930
|
function addFilePreprocessingFileExplainingDiagnostic(file, fileProcessingReason, diagnostic, args) {
|
|
@@ -126792,14 +126936,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
126792
126936
|
args
|
|
126793
126937
|
});
|
|
126794
126938
|
}
|
|
126795
|
-
function
|
|
126796
|
-
|
|
126797
|
-
|
|
126798
|
-
|
|
126799
|
-
|
|
126800
|
-
|
|
126801
|
-
|
|
126802
|
-
|
|
126939
|
+
function addLazyProgramDiagnosticExplainingFile(file, diagnostic, args) {
|
|
126940
|
+
lazyProgramDiagnosticExplainingFile.push({ file, diagnostic, args });
|
|
126941
|
+
}
|
|
126942
|
+
function getFileIncludeReasonToRelatedInformation(reason) {
|
|
126943
|
+
let relatedInfo = reasonToRelatedInfo == null ? void 0 : reasonToRelatedInfo.get(reason);
|
|
126944
|
+
if (relatedInfo === void 0)
|
|
126945
|
+
(reasonToRelatedInfo ?? (reasonToRelatedInfo = /* @__PURE__ */ new Map())).set(reason, relatedInfo = fileIncludeReasonToRelatedInformation(reason) ?? false);
|
|
126946
|
+
return relatedInfo || void 0;
|
|
126803
126947
|
}
|
|
126804
126948
|
function fileIncludeReasonToRelatedInformation(reason) {
|
|
126805
126949
|
if (isReferencedFile(reason)) {
|
|
@@ -179080,6 +179224,7 @@ __export(ts_exports2, {
|
|
|
179080
179224
|
collectExternalModuleInfo: () => collectExternalModuleInfo,
|
|
179081
179225
|
combine: () => combine,
|
|
179082
179226
|
combinePaths: () => combinePaths,
|
|
179227
|
+
commandLineOptionOfCustomType: () => commandLineOptionOfCustomType,
|
|
179083
179228
|
commentPragmas: () => commentPragmas,
|
|
179084
179229
|
commonOptionsWithBuild: () => commonOptionsWithBuild,
|
|
179085
179230
|
commonPackageFolders: () => commonPackageFolders,
|
|
@@ -180761,6 +180906,7 @@ __export(ts_exports2, {
|
|
|
180761
180906
|
or: () => or,
|
|
180762
180907
|
orderedRemoveItem: () => orderedRemoveItem,
|
|
180763
180908
|
orderedRemoveItemAt: () => orderedRemoveItemAt,
|
|
180909
|
+
packageIdIsEqual: () => packageIdIsEqual,
|
|
180764
180910
|
packageIdToPackageName: () => packageIdToPackageName,
|
|
180765
180911
|
packageIdToString: () => packageIdToString,
|
|
180766
180912
|
paramHelper: () => paramHelper,
|
|
@@ -193508,6 +193654,7 @@ if (typeof console !== "undefined") {
|
|
|
193508
193654
|
collectExternalModuleInfo,
|
|
193509
193655
|
combine,
|
|
193510
193656
|
combinePaths,
|
|
193657
|
+
commandLineOptionOfCustomType,
|
|
193511
193658
|
commentPragmas,
|
|
193512
193659
|
commonOptionsWithBuild,
|
|
193513
193660
|
commonPackageFolders,
|
|
@@ -195189,6 +195336,7 @@ if (typeof console !== "undefined") {
|
|
|
195189
195336
|
or,
|
|
195190
195337
|
orderedRemoveItem,
|
|
195191
195338
|
orderedRemoveItemAt,
|
|
195339
|
+
packageIdIsEqual,
|
|
195192
195340
|
packageIdToPackageName,
|
|
195193
195341
|
packageIdToString,
|
|
195194
195342
|
paramHelper,
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@typescript-deploys/pr-build",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.5.0-pr-
|
|
5
|
+
"version": "5.5.0-pr-58398-2",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|