@typescript-deploys/pr-build 5.9.0-pr-61739-2 → 5.9.0-pr-61746-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 +73 -103
- package/lib/typescript.js +77 -107
- 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.9";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20250521`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -16534,7 +16534,7 @@ function sourceFileMayBeEmitted(sourceFile, host, forceDtsEmit) {
|
|
|
16534
16534
|
if (forceDtsEmit) return true;
|
|
16535
16535
|
if (host.isSourceOfProjectReferenceRedirect(sourceFile.fileName)) return false;
|
|
16536
16536
|
if (!isJsonSourceFile(sourceFile)) return true;
|
|
16537
|
-
if (host.
|
|
16537
|
+
if (host.getRedirectFromSourceFile(sourceFile.fileName)) return false;
|
|
16538
16538
|
if (options.outFile) return true;
|
|
16539
16539
|
if (!options.outDir) return false;
|
|
16540
16540
|
if (options.rootDir || options.composite && options.configFilePath) {
|
|
@@ -19967,7 +19967,7 @@ function forEachResolvedProjectReference(resolvedProjectReferences, cb) {
|
|
|
19967
19967
|
/*projectReferences*/
|
|
19968
19968
|
void 0,
|
|
19969
19969
|
resolvedProjectReferences,
|
|
19970
|
-
(resolvedRef
|
|
19970
|
+
(resolvedRef) => resolvedRef && cb(resolvedRef)
|
|
19971
19971
|
);
|
|
19972
19972
|
}
|
|
19973
19973
|
function forEachProjectReference(projectReferences, resolvedProjectReferences, cbResolvedRef, cbRef) {
|
|
@@ -45462,10 +45462,10 @@ function getNearestAncestorDirectoryWithPackageJson(host, fileName) {
|
|
|
45462
45462
|
);
|
|
45463
45463
|
}
|
|
45464
45464
|
function forEachFileNameOfModule(importingFileName, importedFileName, host, preferSymlinks, cb) {
|
|
45465
|
-
var _a;
|
|
45465
|
+
var _a, _b;
|
|
45466
45466
|
const getCanonicalFileName = hostGetCanonicalFileName(host);
|
|
45467
45467
|
const cwd = host.getCurrentDirectory();
|
|
45468
|
-
const referenceRedirect = host.isSourceOfProjectReferenceRedirect(importedFileName) ? host.
|
|
45468
|
+
const referenceRedirect = host.isSourceOfProjectReferenceRedirect(importedFileName) ? (_a = host.getRedirectFromSourceFile(importedFileName)) == null ? void 0 : _a.outputDts : void 0;
|
|
45469
45469
|
const importedPath = toPath(importedFileName, cwd, getCanonicalFileName);
|
|
45470
45470
|
const redirects = host.redirectTargetsMap.get(importedPath) || emptyArray;
|
|
45471
45471
|
const importedFileNames = [...referenceRedirect ? [referenceRedirect] : emptyArray, importedFileName, ...redirects];
|
|
@@ -45475,7 +45475,7 @@ function forEachFileNameOfModule(importingFileName, importedFileName, host, pref
|
|
|
45475
45475
|
const result2 = forEach(targets, (p) => !(shouldFilterIgnoredPaths && containsIgnoredPath(p)) && cb(p, referenceRedirect === p));
|
|
45476
45476
|
if (result2) return result2;
|
|
45477
45477
|
}
|
|
45478
|
-
const symlinkedDirectories = (
|
|
45478
|
+
const symlinkedDirectories = (_b = host.getSymlinkCache) == null ? void 0 : _b.call(host).getSymlinkedDirectoriesByRealpath();
|
|
45479
45479
|
const fullImportedFileName = getNormalizedAbsolutePath(importedFileName, cwd);
|
|
45480
45480
|
const result = symlinkedDirectories && forEachAncestorDirectoryStoppingAtGlobalCache(
|
|
45481
45481
|
host,
|
|
@@ -49222,7 +49222,7 @@ function createTypeChecker(host) {
|
|
|
49222
49222
|
return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, !ignoreErrors ? moduleReferenceExpression : void 0, isForAugmentation) : void 0;
|
|
49223
49223
|
}
|
|
49224
49224
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) {
|
|
49225
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
49225
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
49226
49226
|
if (errorNode && startsWith(moduleReference, "@types/")) {
|
|
49227
49227
|
const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
49228
49228
|
const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
|
|
@@ -49281,7 +49281,7 @@ function createTypeChecker(host) {
|
|
|
49281
49281
|
getAnyExtensionFromPath(moduleReference)
|
|
49282
49282
|
);
|
|
49283
49283
|
} else if (resolvedModule.resolvedUsingTsExtension && shouldRewrite) {
|
|
49284
|
-
const redirect = host.
|
|
49284
|
+
const redirect = (_i = host.getRedirectFromSourceFile(sourceFile.path)) == null ? void 0 : _i.resolvedRef;
|
|
49285
49285
|
if (redirect) {
|
|
49286
49286
|
const ignoreCase = !host.useCaseSensitiveFileNames();
|
|
49287
49287
|
const ownRootDir = host.getCommonSourceDirectory();
|
|
@@ -49321,7 +49321,7 @@ function createTypeChecker(host) {
|
|
|
49321
49321
|
if (ext === ".ts" /* Ts */ || ext === ".js" /* Js */ || ext === ".tsx" /* Tsx */ || ext === ".jsx" /* Jsx */) {
|
|
49322
49322
|
diagnosticDetails = createModeMismatchDetails(currentSourceFile);
|
|
49323
49323
|
}
|
|
49324
|
-
const message = (overrideHost == null ? void 0 : overrideHost.kind) === 272 /* ImportDeclaration */ && ((
|
|
49324
|
+
const message = (overrideHost == null ? void 0 : overrideHost.kind) === 272 /* ImportDeclaration */ && ((_j = overrideHost.importClause) == null ? void 0 : _j.isTypeOnly) ? Diagnostics.Type_only_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribute : (overrideHost == null ? void 0 : overrideHost.kind) === 205 /* ImportType */ ? Diagnostics.Type_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribute : Diagnostics.The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_referenced_file_is_an_ECMAScript_module_and_cannot_be_imported_with_require_Consider_writing_a_dynamic_import_0_call_instead;
|
|
49325
49325
|
diagnostics.add(createDiagnosticForNodeFromMessageChain(
|
|
49326
49326
|
getSourceFileOfNode(errorNode),
|
|
49327
49327
|
errorNode,
|
|
@@ -49369,9 +49369,9 @@ function createTypeChecker(host) {
|
|
|
49369
49369
|
}
|
|
49370
49370
|
if (moduleNotFoundError) {
|
|
49371
49371
|
if (resolvedModule) {
|
|
49372
|
-
const redirect = host.
|
|
49373
|
-
if (redirect) {
|
|
49374
|
-
error(errorNode, Diagnostics.Output_file_0_has_not_been_built_from_source_file_1, redirect, resolvedModule.resolvedFileName);
|
|
49372
|
+
const redirect = host.getRedirectFromSourceFile(resolvedModule.resolvedFileName);
|
|
49373
|
+
if (redirect == null ? void 0 : redirect.outputDts) {
|
|
49374
|
+
error(errorNode, Diagnostics.Output_file_0_has_not_been_built_from_source_file_1, redirect.outputDts, resolvedModule.resolvedFileName);
|
|
49375
49375
|
return void 0;
|
|
49376
49376
|
}
|
|
49377
49377
|
}
|
|
@@ -49384,14 +49384,14 @@ function createTypeChecker(host) {
|
|
|
49384
49384
|
error(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
49385
49385
|
} else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
49386
49386
|
const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
|
|
49387
|
-
const suggestedExt = (
|
|
49387
|
+
const suggestedExt = (_k = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _k[1];
|
|
49388
49388
|
if (suggestedExt) {
|
|
49389
49389
|
error(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0, moduleReference + suggestedExt);
|
|
49390
49390
|
} else {
|
|
49391
49391
|
error(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Consider_adding_an_extension_to_the_import_path);
|
|
49392
49392
|
}
|
|
49393
49393
|
} else {
|
|
49394
|
-
if ((
|
|
49394
|
+
if ((_l = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _l.alternateResult) {
|
|
49395
49395
|
const errorInfo = createModuleNotFoundChain(currentSourceFile, host, moduleReference, mode, moduleReference);
|
|
49396
49396
|
errorOrSuggestion(
|
|
49397
49397
|
/*isError*/
|
|
@@ -89994,7 +89994,7 @@ function createBasicNodeBuilderModuleSpecifierResolutionHost(host) {
|
|
|
89994
89994
|
},
|
|
89995
89995
|
useCaseSensitiveFileNames: () => host.useCaseSensitiveFileNames(),
|
|
89996
89996
|
redirectTargetsMap: host.redirectTargetsMap,
|
|
89997
|
-
|
|
89997
|
+
getRedirectFromSourceFile: (fileName) => host.getRedirectFromSourceFile(fileName),
|
|
89998
89998
|
isSourceOfProjectReferenceRedirect: (fileName) => host.isSourceOfProjectReferenceRedirect(fileName),
|
|
89999
89999
|
fileExists: (fileName) => host.fileExists(fileName),
|
|
90000
90000
|
getFileIncludeReasons: () => host.getFileIncludeReasons(),
|
|
@@ -121860,9 +121860,8 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
121860
121860
|
const filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? /* @__PURE__ */ new Map() : void 0;
|
|
121861
121861
|
let resolvedProjectReferences;
|
|
121862
121862
|
let projectReferenceRedirects;
|
|
121863
|
-
let
|
|
121864
|
-
let
|
|
121865
|
-
let hasResolvedReferencencesInNodeModules = false;
|
|
121863
|
+
let mapSourceFileToResolvedRef;
|
|
121864
|
+
let mapOutputFileToResolvedRef;
|
|
121866
121865
|
const useSourceOfProjectReferenceRedirect = !!((_d = host.useSourceOfProjectReferenceRedirect) == null ? void 0 : _d.call(host)) && !options.disableSourceOfProjectReferenceRedirect;
|
|
121867
121866
|
const { onProgramCreateComplete, fileExists, directoryExists } = updateHostForUseSourceOfProjectReferenceRedirect({
|
|
121868
121867
|
compilerHost: host,
|
|
@@ -121870,7 +121869,7 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
121870
121869
|
useSourceOfProjectReferenceRedirect,
|
|
121871
121870
|
toPath: toPath3,
|
|
121872
121871
|
getResolvedProjectReferences,
|
|
121873
|
-
|
|
121872
|
+
getRedirectFromOutput,
|
|
121874
121873
|
forEachResolvedProjectReference: forEachResolvedProjectReference2
|
|
121875
121874
|
});
|
|
121876
121875
|
const readFile = host.readFile.bind(host);
|
|
@@ -122080,8 +122079,7 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
122080
122079
|
getConfigFileParsingDiagnostics: getConfigFileParsingDiagnostics2,
|
|
122081
122080
|
getProjectReferences,
|
|
122082
122081
|
getResolvedProjectReferences,
|
|
122083
|
-
|
|
122084
|
-
getResolvedProjectReferenceToRedirect,
|
|
122082
|
+
getRedirectFromSourceFile,
|
|
122085
122083
|
getResolvedProjectReferenceByPath,
|
|
122086
122084
|
forEachResolvedProjectReference: forEachResolvedProjectReference2,
|
|
122087
122085
|
isSourceOfProjectReferenceRedirect,
|
|
@@ -122214,8 +122212,8 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
122214
122212
|
return result;
|
|
122215
122213
|
}
|
|
122216
122214
|
function getRedirectReferenceForResolution(file) {
|
|
122217
|
-
const redirect =
|
|
122218
|
-
if (redirect || !isDeclarationFileName(file.originalFileName)) return redirect;
|
|
122215
|
+
const redirect = getRedirectFromSourceFile(file.originalFileName);
|
|
122216
|
+
if (redirect || !isDeclarationFileName(file.originalFileName)) return redirect == null ? void 0 : redirect.resolvedRef;
|
|
122219
122217
|
const resultFromDts = getRedirectReferenceForResolutionFromSourceOfProject(file.path);
|
|
122220
122218
|
if (resultFromDts) return resultFromDts;
|
|
122221
122219
|
if (!host.realpath || !options.preserveSymlinks || !file.originalFileName.includes(nodeModulesPathPart)) return void 0;
|
|
@@ -122223,14 +122221,8 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
122223
122221
|
return realDeclarationPath === file.path ? void 0 : getRedirectReferenceForResolutionFromSourceOfProject(realDeclarationPath);
|
|
122224
122222
|
}
|
|
122225
122223
|
function getRedirectReferenceForResolutionFromSourceOfProject(filePath) {
|
|
122226
|
-
|
|
122227
|
-
|
|
122228
|
-
if (!source) return void 0;
|
|
122229
|
-
return forEachResolvedProjectReference2((resolvedRef) => {
|
|
122230
|
-
const out = resolvedRef.commandLine.options.outFile;
|
|
122231
|
-
if (!out) return void 0;
|
|
122232
|
-
return toPath3(out) === filePath ? resolvedRef : void 0;
|
|
122233
|
-
});
|
|
122224
|
+
var _a2;
|
|
122225
|
+
return (_a2 = getRedirectFromOutput(filePath)) == null ? void 0 : _a2.resolvedRef;
|
|
122234
122226
|
}
|
|
122235
122227
|
function compareDefaultLibFiles(a, b) {
|
|
122236
122228
|
return compareValues(getDefaultLibFilePriority(a), getDefaultLibFilePriority(b));
|
|
@@ -122602,8 +122594,7 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
122602
122594
|
getSourceFileByPath: program.getSourceFileByPath,
|
|
122603
122595
|
getSourceFiles: program.getSourceFiles,
|
|
122604
122596
|
isSourceFileFromExternalLibrary,
|
|
122605
|
-
|
|
122606
|
-
getProjectReferenceRedirect,
|
|
122597
|
+
getRedirectFromSourceFile,
|
|
122607
122598
|
isSourceOfProjectReferenceRedirect,
|
|
122608
122599
|
getSymlinkCache,
|
|
122609
122600
|
writeFile: writeFileCallback || writeFile2,
|
|
@@ -123318,9 +123309,9 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
123318
123309
|
const sourceFile = getSourceFile2(fileName);
|
|
123319
123310
|
if (fail) {
|
|
123320
123311
|
if (!sourceFile) {
|
|
123321
|
-
const redirect =
|
|
123322
|
-
if (redirect) {
|
|
123323
|
-
fail(Diagnostics.Output_file_0_has_not_been_built_from_source_file_1, redirect, fileName);
|
|
123312
|
+
const redirect = getRedirectFromSourceFile(fileName);
|
|
123313
|
+
if (redirect == null ? void 0 : redirect.outputDts) {
|
|
123314
|
+
fail(Diagnostics.Output_file_0_has_not_been_built_from_source_file_1, redirect.outputDts, fileName);
|
|
123324
123315
|
} else {
|
|
123325
123316
|
fail(Diagnostics.File_0_not_found, fileName);
|
|
123326
123317
|
}
|
|
@@ -123406,16 +123397,16 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
123406
123397
|
return typeof result === "object" ? { ...result, languageVersion, setExternalModuleIndicator: setExternalModuleIndicator2, jsDocParsingMode: host2.jsDocParsingMode } : { languageVersion, impliedNodeFormat: result, setExternalModuleIndicator: setExternalModuleIndicator2, jsDocParsingMode: host2.jsDocParsingMode };
|
|
123407
123398
|
}
|
|
123408
123399
|
function findSourceFileWorker(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId) {
|
|
123409
|
-
var _a2;
|
|
123400
|
+
var _a2, _b2, _c2, _d2;
|
|
123410
123401
|
const path = toPath3(fileName);
|
|
123411
123402
|
if (useSourceOfProjectReferenceRedirect) {
|
|
123412
|
-
let source =
|
|
123403
|
+
let source = (_a2 = getRedirectFromOutput(path)) == null ? void 0 : _a2.source;
|
|
123413
123404
|
if (!source && host.realpath && options.preserveSymlinks && isDeclarationFileName(fileName) && fileName.includes(nodeModulesPathPart)) {
|
|
123414
123405
|
const realPath2 = toPath3(host.realpath(fileName));
|
|
123415
|
-
if (realPath2 !== path) source =
|
|
123406
|
+
if (realPath2 !== path) source = (_b2 = getRedirectFromOutput(realPath2)) == null ? void 0 : _b2.source;
|
|
123416
123407
|
}
|
|
123417
123408
|
if (source) {
|
|
123418
|
-
const file2 =
|
|
123409
|
+
const file2 = findSourceFile(source, isDefaultLib, ignoreNoDefaultLib, reason, packageId);
|
|
123419
123410
|
if (file2) addFileToFilesByName(
|
|
123420
123411
|
file2,
|
|
123421
123412
|
path,
|
|
@@ -123439,7 +123430,7 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
123439
123430
|
const checkedName = file2.fileName;
|
|
123440
123431
|
const isRedirect = toPath3(checkedName) !== toPath3(fileName);
|
|
123441
123432
|
if (isRedirect) {
|
|
123442
|
-
fileName =
|
|
123433
|
+
fileName = ((_c2 = getRedirectFromSourceFile(fileName)) == null ? void 0 : _c2.outputDts) || fileName;
|
|
123443
123434
|
}
|
|
123444
123435
|
const checkedAbsolutePath = getNormalizedAbsolutePathWithoutRoot(checkedName, currentDirectory);
|
|
123445
123436
|
const inputAbsolutePath = getNormalizedAbsolutePathWithoutRoot(fileName, currentDirectory);
|
|
@@ -123468,14 +123459,13 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
123468
123459
|
}
|
|
123469
123460
|
let redirectedPath;
|
|
123470
123461
|
if (!useSourceOfProjectReferenceRedirect) {
|
|
123471
|
-
const redirectProject =
|
|
123472
|
-
if (redirectProject) {
|
|
123473
|
-
if (redirectProject.commandLine.options.outFile) {
|
|
123462
|
+
const redirectProject = getRedirectFromSourceFile(fileName);
|
|
123463
|
+
if (redirectProject == null ? void 0 : redirectProject.outputDts) {
|
|
123464
|
+
if (redirectProject.resolvedRef.commandLine.options.outFile) {
|
|
123474
123465
|
return void 0;
|
|
123475
123466
|
}
|
|
123476
|
-
|
|
123477
|
-
|
|
123478
|
-
redirectedPath = toPath3(redirect);
|
|
123467
|
+
fileName = redirectProject.outputDts;
|
|
123468
|
+
redirectedPath = toPath3(redirectProject.outputDts);
|
|
123479
123469
|
}
|
|
123480
123470
|
}
|
|
123481
123471
|
const sourceFileOptions = getCreateSourceFileOptions(fileName, moduleResolutionCache, host, options);
|
|
@@ -123519,7 +123509,7 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
123519
123509
|
file.path = path;
|
|
123520
123510
|
file.resolvedPath = toPath3(fileName);
|
|
123521
123511
|
file.originalFileName = originalFileName;
|
|
123522
|
-
file.packageJsonLocations = ((
|
|
123512
|
+
file.packageJsonLocations = ((_d2 = sourceFileOptions.packageJsonLocations) == null ? void 0 : _d2.length) ? sourceFileOptions.packageJsonLocations : void 0;
|
|
123523
123513
|
file.packageJsonScope = sourceFileOptions.packageJsonScope;
|
|
123524
123514
|
addFileIncludeReason(
|
|
123525
123515
|
file,
|
|
@@ -123574,60 +123564,17 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
123574
123564
|
if (file !== void 0) missingFileNames.delete(path);
|
|
123575
123565
|
else missingFileNames.set(path, fileName);
|
|
123576
123566
|
}
|
|
123577
|
-
function
|
|
123578
|
-
|
|
123579
|
-
return referencedProject && getProjectReferenceOutputName(referencedProject, fileName);
|
|
123580
|
-
}
|
|
123581
|
-
function getProjectReferenceRedirectProject(fileName) {
|
|
123582
|
-
if (!resolvedProjectReferences || !resolvedProjectReferences.length || isDeclarationFileName(fileName) || fileExtensionIs(fileName, ".json" /* Json */)) {
|
|
123583
|
-
return void 0;
|
|
123584
|
-
}
|
|
123585
|
-
return getResolvedProjectReferenceToRedirect(fileName);
|
|
123586
|
-
}
|
|
123587
|
-
function getProjectReferenceOutputName(referencedProject, fileName) {
|
|
123588
|
-
const out = referencedProject.commandLine.options.outFile;
|
|
123589
|
-
return out ? changeExtension(out, ".d.ts" /* Dts */) : getOutputDeclarationFileName(fileName, referencedProject.commandLine, !host.useCaseSensitiveFileNames());
|
|
123590
|
-
}
|
|
123591
|
-
function getResolvedProjectReferenceToRedirect(fileName) {
|
|
123592
|
-
if (mapFromFileToProjectReferenceRedirects === void 0) {
|
|
123593
|
-
mapFromFileToProjectReferenceRedirects = /* @__PURE__ */ new Map();
|
|
123594
|
-
forEachResolvedProjectReference2((referencedProject) => {
|
|
123595
|
-
if (toPath3(options.configFilePath) !== referencedProject.sourceFile.path) {
|
|
123596
|
-
referencedProject.commandLine.fileNames.forEach((f) => mapFromFileToProjectReferenceRedirects.set(toPath3(f), referencedProject.sourceFile.path));
|
|
123597
|
-
}
|
|
123598
|
-
});
|
|
123599
|
-
}
|
|
123600
|
-
const referencedProjectPath = mapFromFileToProjectReferenceRedirects.get(toPath3(fileName));
|
|
123601
|
-
return referencedProjectPath && getResolvedProjectReferenceByPath(referencedProjectPath);
|
|
123567
|
+
function getRedirectFromSourceFile(fileName) {
|
|
123568
|
+
return mapSourceFileToResolvedRef == null ? void 0 : mapSourceFileToResolvedRef.get(toPath3(fileName));
|
|
123602
123569
|
}
|
|
123603
123570
|
function forEachResolvedProjectReference2(cb) {
|
|
123604
123571
|
return forEachResolvedProjectReference(resolvedProjectReferences, cb);
|
|
123605
123572
|
}
|
|
123606
|
-
function
|
|
123607
|
-
|
|
123608
|
-
if (!hasResolvedReferencencesInNodeModules && pathContainsNodeModules(path)) return void 0;
|
|
123609
|
-
if (mapFromToProjectReferenceRedirectSource === void 0) {
|
|
123610
|
-
mapFromToProjectReferenceRedirectSource = /* @__PURE__ */ new Map();
|
|
123611
|
-
forEachResolvedProjectReference2((resolvedRef) => {
|
|
123612
|
-
const out = resolvedRef.commandLine.options.outFile;
|
|
123613
|
-
if (out) {
|
|
123614
|
-
const outputDts = changeExtension(out, ".d.ts" /* Dts */);
|
|
123615
|
-
mapFromToProjectReferenceRedirectSource.set(toPath3(outputDts), true);
|
|
123616
|
-
} else {
|
|
123617
|
-
const getCommonSourceDirectory3 = memoize(() => getCommonSourceDirectoryOfConfig(resolvedRef.commandLine, !host.useCaseSensitiveFileNames()));
|
|
123618
|
-
forEach(resolvedRef.commandLine.fileNames, (fileName) => {
|
|
123619
|
-
if (!isDeclarationFileName(fileName) && !fileExtensionIs(fileName, ".json" /* Json */)) {
|
|
123620
|
-
const outputDts = getOutputDeclarationFileName(fileName, resolvedRef.commandLine, !host.useCaseSensitiveFileNames(), getCommonSourceDirectory3);
|
|
123621
|
-
mapFromToProjectReferenceRedirectSource.set(toPath3(outputDts), fileName);
|
|
123622
|
-
}
|
|
123623
|
-
});
|
|
123624
|
-
}
|
|
123625
|
-
});
|
|
123626
|
-
}
|
|
123627
|
-
return mapFromToProjectReferenceRedirectSource.get(path);
|
|
123573
|
+
function getRedirectFromOutput(path) {
|
|
123574
|
+
return mapOutputFileToResolvedRef == null ? void 0 : mapOutputFileToResolvedRef.get(path);
|
|
123628
123575
|
}
|
|
123629
123576
|
function isSourceOfProjectReferenceRedirect(fileName) {
|
|
123630
|
-
return useSourceOfProjectReferenceRedirect && !!
|
|
123577
|
+
return useSourceOfProjectReferenceRedirect && !!getRedirectFromSourceFile(fileName);
|
|
123631
123578
|
}
|
|
123632
123579
|
function getResolvedProjectReferenceByPath(projectReferencePath) {
|
|
123633
123580
|
if (!projectReferenceRedirects) {
|
|
@@ -123795,7 +123742,7 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
123795
123742
|
continue;
|
|
123796
123743
|
}
|
|
123797
123744
|
const isFromNodeModulesSearch = resolution.isExternalLibraryImport;
|
|
123798
|
-
const isJsFile = !resolutionExtensionIsTSOrJson(resolution.extension) && !
|
|
123745
|
+
const isJsFile = !resolutionExtensionIsTSOrJson(resolution.extension) && !getRedirectFromSourceFile(resolution.resolvedFileName);
|
|
123799
123746
|
const isJsFileFromNodeModules = isFromNodeModulesSearch && isJsFile && (!resolution.originalPath || pathContainsNodeModules(resolution.resolvedFileName));
|
|
123800
123747
|
const resolvedFileName = resolution.resolvedFileName;
|
|
123801
123748
|
if (isFromNodeModulesSearch) {
|
|
@@ -123903,11 +123850,32 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
123903
123850
|
sourceFile.path = sourceFilePath;
|
|
123904
123851
|
sourceFile.resolvedPath = sourceFilePath;
|
|
123905
123852
|
sourceFile.originalFileName = refPath;
|
|
123906
|
-
if (!hasResolvedReferencencesInNodeModules && (pathContainsNodeModules(sourceFile.resolvedPath) || pathContainsNodeModules(sourceFile.path))) {
|
|
123907
|
-
hasResolvedReferencencesInNodeModules = true;
|
|
123908
|
-
}
|
|
123909
123853
|
const resolvedRef = { commandLine, sourceFile };
|
|
123910
123854
|
projectReferenceRedirects.set(sourceFilePath, resolvedRef);
|
|
123855
|
+
if (options.configFile !== sourceFile) {
|
|
123856
|
+
mapSourceFileToResolvedRef ?? (mapSourceFileToResolvedRef = /* @__PURE__ */ new Map());
|
|
123857
|
+
mapOutputFileToResolvedRef ?? (mapOutputFileToResolvedRef = /* @__PURE__ */ new Map());
|
|
123858
|
+
let outDts;
|
|
123859
|
+
if (commandLine.options.outFile) {
|
|
123860
|
+
outDts = changeExtension(commandLine.options.outFile, ".d.ts" /* Dts */);
|
|
123861
|
+
mapOutputFileToResolvedRef == null ? void 0 : mapOutputFileToResolvedRef.set(toPath3(outDts), { resolvedRef });
|
|
123862
|
+
}
|
|
123863
|
+
const getCommonSourceDirectory3 = memoize(() => getCommonSourceDirectoryOfConfig(resolvedRef.commandLine, !host.useCaseSensitiveFileNames()));
|
|
123864
|
+
commandLine.fileNames.forEach((fileName) => {
|
|
123865
|
+
if (isDeclarationFileName(fileName)) return;
|
|
123866
|
+
const path = toPath3(fileName);
|
|
123867
|
+
let outputDts;
|
|
123868
|
+
if (!fileExtensionIs(fileName, ".json" /* Json */)) {
|
|
123869
|
+
if (!commandLine.options.outFile) {
|
|
123870
|
+
outputDts = getOutputDeclarationFileName(fileName, resolvedRef.commandLine, !host.useCaseSensitiveFileNames(), getCommonSourceDirectory3);
|
|
123871
|
+
mapOutputFileToResolvedRef.set(toPath3(outputDts), { resolvedRef, source: fileName });
|
|
123872
|
+
} else {
|
|
123873
|
+
outputDts = outDts;
|
|
123874
|
+
}
|
|
123875
|
+
}
|
|
123876
|
+
mapSourceFileToResolvedRef.set(path, { resolvedRef, outputDts });
|
|
123877
|
+
});
|
|
123878
|
+
}
|
|
123911
123879
|
if (commandLine.projectReferences) {
|
|
123912
123880
|
resolvedRef.references = commandLine.projectReferences.map(parseProjectReferenceConfigFile);
|
|
123913
123881
|
}
|
|
@@ -124628,7 +124596,7 @@ function updateHostForUseSourceOfProjectReferenceRedirect(host) {
|
|
|
124628
124596
|
);
|
|
124629
124597
|
}
|
|
124630
124598
|
function fileExistsIfProjectReferenceDts(file) {
|
|
124631
|
-
const source = host.
|
|
124599
|
+
const source = host.getRedirectFromOutput(host.toPath(file));
|
|
124632
124600
|
return source !== void 0 ? isString(source) ? originalFileExists.call(host.compilerHost, source) : true : void 0;
|
|
124633
124601
|
}
|
|
124634
124602
|
function directoryExistsIfProjectReferenceDeclDir(dir) {
|
|
@@ -125158,7 +125126,8 @@ var BuilderState;
|
|
|
125158
125126
|
return symbol && getReferencedFilesFromImportedModuleSymbol(symbol);
|
|
125159
125127
|
}
|
|
125160
125128
|
function getReferencedFileFromFileName(program, fileName, sourceFileDirectory, getCanonicalFileName) {
|
|
125161
|
-
|
|
125129
|
+
var _a;
|
|
125130
|
+
return toPath(((_a = program.getRedirectFromSourceFile(fileName)) == null ? void 0 : _a.outputDts) || fileName, sourceFileDirectory, getCanonicalFileName);
|
|
125162
125131
|
}
|
|
125163
125132
|
function getReferencedFiles(program, sourceFile, getCanonicalFileName) {
|
|
125164
125133
|
let referencedFiles;
|
|
@@ -127433,12 +127402,13 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
127433
127402
|
shouldRetryResolution,
|
|
127434
127403
|
logChanges
|
|
127435
127404
|
}) {
|
|
127405
|
+
var _a;
|
|
127436
127406
|
const path = resolutionHost.toPath(containingFile);
|
|
127437
127407
|
const resolutionsInFile = perFileCache.get(path) || perFileCache.set(path, createModeAwareCache()).get(path);
|
|
127438
127408
|
const resolvedModules = [];
|
|
127439
127409
|
const hasInvalidatedNonRelativeUnresolvedImport = logChanges && isFileWithInvalidatedNonRelativeUnresolvedImports(path);
|
|
127440
127410
|
const program = resolutionHost.getCurrentProgram();
|
|
127441
|
-
const oldRedirect = program && program.
|
|
127411
|
+
const oldRedirect = program && ((_a = program.getRedirectFromSourceFile(containingFile)) == null ? void 0 : _a.resolvedRef);
|
|
127442
127412
|
const unmatchedRedirects = oldRedirect ? !redirectedReference || redirectedReference.sourceFile.path !== oldRedirect.sourceFile.path : !!redirectedReference;
|
|
127443
127413
|
const seenNamesInFile = createModeAwareCache();
|
|
127444
127414
|
for (const entry of entries) {
|
package/lib/typescript.js
CHANGED
|
@@ -2286,7 +2286,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2286
2286
|
|
|
2287
2287
|
// src/compiler/corePublic.ts
|
|
2288
2288
|
var versionMajorMinor = "5.9";
|
|
2289
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2289
|
+
var version = `${versionMajorMinor}.0-insiders.20250521`;
|
|
2290
2290
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2291
2291
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2292
2292
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -20350,7 +20350,7 @@ function sourceFileMayBeEmitted(sourceFile, host, forceDtsEmit) {
|
|
|
20350
20350
|
if (forceDtsEmit) return true;
|
|
20351
20351
|
if (host.isSourceOfProjectReferenceRedirect(sourceFile.fileName)) return false;
|
|
20352
20352
|
if (!isJsonSourceFile(sourceFile)) return true;
|
|
20353
|
-
if (host.
|
|
20353
|
+
if (host.getRedirectFromSourceFile(sourceFile.fileName)) return false;
|
|
20354
20354
|
if (options.outFile) return true;
|
|
20355
20355
|
if (!options.outDir) return false;
|
|
20356
20356
|
if (options.rootDir || options.composite && options.configFilePath) {
|
|
@@ -24065,7 +24065,7 @@ function forEachResolvedProjectReference(resolvedProjectReferences, cb) {
|
|
|
24065
24065
|
/*projectReferences*/
|
|
24066
24066
|
void 0,
|
|
24067
24067
|
resolvedProjectReferences,
|
|
24068
|
-
(resolvedRef
|
|
24068
|
+
(resolvedRef) => resolvedRef && cb(resolvedRef)
|
|
24069
24069
|
);
|
|
24070
24070
|
}
|
|
24071
24071
|
function forEachProjectReference(projectReferences, resolvedProjectReferences, cbResolvedRef, cbRef) {
|
|
@@ -50059,10 +50059,10 @@ function getNearestAncestorDirectoryWithPackageJson(host, fileName) {
|
|
|
50059
50059
|
);
|
|
50060
50060
|
}
|
|
50061
50061
|
function forEachFileNameOfModule(importingFileName, importedFileName, host, preferSymlinks, cb) {
|
|
50062
|
-
var _a;
|
|
50062
|
+
var _a, _b;
|
|
50063
50063
|
const getCanonicalFileName = hostGetCanonicalFileName(host);
|
|
50064
50064
|
const cwd = host.getCurrentDirectory();
|
|
50065
|
-
const referenceRedirect = host.isSourceOfProjectReferenceRedirect(importedFileName) ? host.
|
|
50065
|
+
const referenceRedirect = host.isSourceOfProjectReferenceRedirect(importedFileName) ? (_a = host.getRedirectFromSourceFile(importedFileName)) == null ? void 0 : _a.outputDts : void 0;
|
|
50066
50066
|
const importedPath = toPath(importedFileName, cwd, getCanonicalFileName);
|
|
50067
50067
|
const redirects = host.redirectTargetsMap.get(importedPath) || emptyArray;
|
|
50068
50068
|
const importedFileNames = [...referenceRedirect ? [referenceRedirect] : emptyArray, importedFileName, ...redirects];
|
|
@@ -50072,7 +50072,7 @@ function forEachFileNameOfModule(importingFileName, importedFileName, host, pref
|
|
|
50072
50072
|
const result2 = forEach(targets, (p) => !(shouldFilterIgnoredPaths && containsIgnoredPath(p)) && cb(p, referenceRedirect === p));
|
|
50073
50073
|
if (result2) return result2;
|
|
50074
50074
|
}
|
|
50075
|
-
const symlinkedDirectories = (
|
|
50075
|
+
const symlinkedDirectories = (_b = host.getSymlinkCache) == null ? void 0 : _b.call(host).getSymlinkedDirectoriesByRealpath();
|
|
50076
50076
|
const fullImportedFileName = getNormalizedAbsolutePath(importedFileName, cwd);
|
|
50077
50077
|
const result = symlinkedDirectories && forEachAncestorDirectoryStoppingAtGlobalCache(
|
|
50078
50078
|
host,
|
|
@@ -53834,7 +53834,7 @@ function createTypeChecker(host) {
|
|
|
53834
53834
|
return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, !ignoreErrors ? moduleReferenceExpression : void 0, isForAugmentation) : void 0;
|
|
53835
53835
|
}
|
|
53836
53836
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) {
|
|
53837
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
53837
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
53838
53838
|
if (errorNode && startsWith(moduleReference, "@types/")) {
|
|
53839
53839
|
const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
53840
53840
|
const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
|
|
@@ -53893,7 +53893,7 @@ function createTypeChecker(host) {
|
|
|
53893
53893
|
getAnyExtensionFromPath(moduleReference)
|
|
53894
53894
|
);
|
|
53895
53895
|
} else if (resolvedModule.resolvedUsingTsExtension && shouldRewrite) {
|
|
53896
|
-
const redirect = host.
|
|
53896
|
+
const redirect = (_i = host.getRedirectFromSourceFile(sourceFile.path)) == null ? void 0 : _i.resolvedRef;
|
|
53897
53897
|
if (redirect) {
|
|
53898
53898
|
const ignoreCase = !host.useCaseSensitiveFileNames();
|
|
53899
53899
|
const ownRootDir = host.getCommonSourceDirectory();
|
|
@@ -53933,7 +53933,7 @@ function createTypeChecker(host) {
|
|
|
53933
53933
|
if (ext === ".ts" /* Ts */ || ext === ".js" /* Js */ || ext === ".tsx" /* Tsx */ || ext === ".jsx" /* Jsx */) {
|
|
53934
53934
|
diagnosticDetails = createModeMismatchDetails(currentSourceFile);
|
|
53935
53935
|
}
|
|
53936
|
-
const message = (overrideHost == null ? void 0 : overrideHost.kind) === 272 /* ImportDeclaration */ && ((
|
|
53936
|
+
const message = (overrideHost == null ? void 0 : overrideHost.kind) === 272 /* ImportDeclaration */ && ((_j = overrideHost.importClause) == null ? void 0 : _j.isTypeOnly) ? Diagnostics.Type_only_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribute : (overrideHost == null ? void 0 : overrideHost.kind) === 205 /* ImportType */ ? Diagnostics.Type_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribute : Diagnostics.The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_referenced_file_is_an_ECMAScript_module_and_cannot_be_imported_with_require_Consider_writing_a_dynamic_import_0_call_instead;
|
|
53937
53937
|
diagnostics.add(createDiagnosticForNodeFromMessageChain(
|
|
53938
53938
|
getSourceFileOfNode(errorNode),
|
|
53939
53939
|
errorNode,
|
|
@@ -53981,9 +53981,9 @@ function createTypeChecker(host) {
|
|
|
53981
53981
|
}
|
|
53982
53982
|
if (moduleNotFoundError) {
|
|
53983
53983
|
if (resolvedModule) {
|
|
53984
|
-
const redirect = host.
|
|
53985
|
-
if (redirect) {
|
|
53986
|
-
error2(errorNode, Diagnostics.Output_file_0_has_not_been_built_from_source_file_1, redirect, resolvedModule.resolvedFileName);
|
|
53984
|
+
const redirect = host.getRedirectFromSourceFile(resolvedModule.resolvedFileName);
|
|
53985
|
+
if (redirect == null ? void 0 : redirect.outputDts) {
|
|
53986
|
+
error2(errorNode, Diagnostics.Output_file_0_has_not_been_built_from_source_file_1, redirect.outputDts, resolvedModule.resolvedFileName);
|
|
53987
53987
|
return void 0;
|
|
53988
53988
|
}
|
|
53989
53989
|
}
|
|
@@ -53996,14 +53996,14 @@ function createTypeChecker(host) {
|
|
|
53996
53996
|
error2(errorNode, Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
53997
53997
|
} else if (mode === 99 /* ESNext */ && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
53998
53998
|
const absoluteRef = getNormalizedAbsolutePath(moduleReference, getDirectoryPath(currentSourceFile.path));
|
|
53999
|
-
const suggestedExt = (
|
|
53999
|
+
const suggestedExt = (_k = suggestedExtensions.find(([actualExt, _importExt]) => host.fileExists(absoluteRef + actualExt))) == null ? void 0 : _k[1];
|
|
54000
54000
|
if (suggestedExt) {
|
|
54001
54001
|
error2(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0, moduleReference + suggestedExt);
|
|
54002
54002
|
} else {
|
|
54003
54003
|
error2(errorNode, Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Consider_adding_an_extension_to_the_import_path);
|
|
54004
54004
|
}
|
|
54005
54005
|
} else {
|
|
54006
|
-
if ((
|
|
54006
|
+
if ((_l = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _l.alternateResult) {
|
|
54007
54007
|
const errorInfo = createModuleNotFoundChain(currentSourceFile, host, moduleReference, mode, moduleReference);
|
|
54008
54008
|
errorOrSuggestion(
|
|
54009
54009
|
/*isError*/
|
|
@@ -94606,7 +94606,7 @@ function createBasicNodeBuilderModuleSpecifierResolutionHost(host) {
|
|
|
94606
94606
|
},
|
|
94607
94607
|
useCaseSensitiveFileNames: () => host.useCaseSensitiveFileNames(),
|
|
94608
94608
|
redirectTargetsMap: host.redirectTargetsMap,
|
|
94609
|
-
|
|
94609
|
+
getRedirectFromSourceFile: (fileName) => host.getRedirectFromSourceFile(fileName),
|
|
94610
94610
|
isSourceOfProjectReferenceRedirect: (fileName) => host.isSourceOfProjectReferenceRedirect(fileName),
|
|
94611
94611
|
fileExists: (fileName) => host.fileExists(fileName),
|
|
94612
94612
|
getFileIncludeReasons: () => host.getFileIncludeReasons(),
|
|
@@ -126711,9 +126711,8 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
126711
126711
|
const filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? /* @__PURE__ */ new Map() : void 0;
|
|
126712
126712
|
let resolvedProjectReferences;
|
|
126713
126713
|
let projectReferenceRedirects;
|
|
126714
|
-
let
|
|
126715
|
-
let
|
|
126716
|
-
let hasResolvedReferencencesInNodeModules = false;
|
|
126714
|
+
let mapSourceFileToResolvedRef;
|
|
126715
|
+
let mapOutputFileToResolvedRef;
|
|
126717
126716
|
const useSourceOfProjectReferenceRedirect = !!((_d = host.useSourceOfProjectReferenceRedirect) == null ? void 0 : _d.call(host)) && !options.disableSourceOfProjectReferenceRedirect;
|
|
126718
126717
|
const { onProgramCreateComplete, fileExists, directoryExists } = updateHostForUseSourceOfProjectReferenceRedirect({
|
|
126719
126718
|
compilerHost: host,
|
|
@@ -126721,7 +126720,7 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
126721
126720
|
useSourceOfProjectReferenceRedirect,
|
|
126722
126721
|
toPath: toPath3,
|
|
126723
126722
|
getResolvedProjectReferences,
|
|
126724
|
-
|
|
126723
|
+
getRedirectFromOutput,
|
|
126725
126724
|
forEachResolvedProjectReference: forEachResolvedProjectReference2
|
|
126726
126725
|
});
|
|
126727
126726
|
const readFile = host.readFile.bind(host);
|
|
@@ -126931,8 +126930,7 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
126931
126930
|
getConfigFileParsingDiagnostics: getConfigFileParsingDiagnostics2,
|
|
126932
126931
|
getProjectReferences,
|
|
126933
126932
|
getResolvedProjectReferences,
|
|
126934
|
-
|
|
126935
|
-
getResolvedProjectReferenceToRedirect,
|
|
126933
|
+
getRedirectFromSourceFile,
|
|
126936
126934
|
getResolvedProjectReferenceByPath,
|
|
126937
126935
|
forEachResolvedProjectReference: forEachResolvedProjectReference2,
|
|
126938
126936
|
isSourceOfProjectReferenceRedirect,
|
|
@@ -127065,8 +127063,8 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
127065
127063
|
return result;
|
|
127066
127064
|
}
|
|
127067
127065
|
function getRedirectReferenceForResolution(file) {
|
|
127068
|
-
const redirect =
|
|
127069
|
-
if (redirect || !isDeclarationFileName(file.originalFileName)) return redirect;
|
|
127066
|
+
const redirect = getRedirectFromSourceFile(file.originalFileName);
|
|
127067
|
+
if (redirect || !isDeclarationFileName(file.originalFileName)) return redirect == null ? void 0 : redirect.resolvedRef;
|
|
127070
127068
|
const resultFromDts = getRedirectReferenceForResolutionFromSourceOfProject(file.path);
|
|
127071
127069
|
if (resultFromDts) return resultFromDts;
|
|
127072
127070
|
if (!host.realpath || !options.preserveSymlinks || !file.originalFileName.includes(nodeModulesPathPart)) return void 0;
|
|
@@ -127074,14 +127072,8 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
127074
127072
|
return realDeclarationPath === file.path ? void 0 : getRedirectReferenceForResolutionFromSourceOfProject(realDeclarationPath);
|
|
127075
127073
|
}
|
|
127076
127074
|
function getRedirectReferenceForResolutionFromSourceOfProject(filePath) {
|
|
127077
|
-
|
|
127078
|
-
|
|
127079
|
-
if (!source) return void 0;
|
|
127080
|
-
return forEachResolvedProjectReference2((resolvedRef) => {
|
|
127081
|
-
const out = resolvedRef.commandLine.options.outFile;
|
|
127082
|
-
if (!out) return void 0;
|
|
127083
|
-
return toPath3(out) === filePath ? resolvedRef : void 0;
|
|
127084
|
-
});
|
|
127075
|
+
var _a2;
|
|
127076
|
+
return (_a2 = getRedirectFromOutput(filePath)) == null ? void 0 : _a2.resolvedRef;
|
|
127085
127077
|
}
|
|
127086
127078
|
function compareDefaultLibFiles(a, b) {
|
|
127087
127079
|
return compareValues(getDefaultLibFilePriority(a), getDefaultLibFilePriority(b));
|
|
@@ -127453,8 +127445,7 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
127453
127445
|
getSourceFileByPath: program.getSourceFileByPath,
|
|
127454
127446
|
getSourceFiles: program.getSourceFiles,
|
|
127455
127447
|
isSourceFileFromExternalLibrary,
|
|
127456
|
-
|
|
127457
|
-
getProjectReferenceRedirect,
|
|
127448
|
+
getRedirectFromSourceFile,
|
|
127458
127449
|
isSourceOfProjectReferenceRedirect,
|
|
127459
127450
|
getSymlinkCache,
|
|
127460
127451
|
writeFile: writeFileCallback || writeFile2,
|
|
@@ -128169,9 +128160,9 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
128169
128160
|
const sourceFile = getSourceFile2(fileName);
|
|
128170
128161
|
if (fail) {
|
|
128171
128162
|
if (!sourceFile) {
|
|
128172
|
-
const redirect =
|
|
128173
|
-
if (redirect) {
|
|
128174
|
-
fail(Diagnostics.Output_file_0_has_not_been_built_from_source_file_1, redirect, fileName);
|
|
128163
|
+
const redirect = getRedirectFromSourceFile(fileName);
|
|
128164
|
+
if (redirect == null ? void 0 : redirect.outputDts) {
|
|
128165
|
+
fail(Diagnostics.Output_file_0_has_not_been_built_from_source_file_1, redirect.outputDts, fileName);
|
|
128175
128166
|
} else {
|
|
128176
128167
|
fail(Diagnostics.File_0_not_found, fileName);
|
|
128177
128168
|
}
|
|
@@ -128257,16 +128248,16 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
128257
128248
|
return typeof result === "object" ? { ...result, languageVersion, setExternalModuleIndicator: setExternalModuleIndicator2, jsDocParsingMode: host2.jsDocParsingMode } : { languageVersion, impliedNodeFormat: result, setExternalModuleIndicator: setExternalModuleIndicator2, jsDocParsingMode: host2.jsDocParsingMode };
|
|
128258
128249
|
}
|
|
128259
128250
|
function findSourceFileWorker(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId) {
|
|
128260
|
-
var _a2;
|
|
128251
|
+
var _a2, _b2, _c2, _d2;
|
|
128261
128252
|
const path = toPath3(fileName);
|
|
128262
128253
|
if (useSourceOfProjectReferenceRedirect) {
|
|
128263
|
-
let source =
|
|
128254
|
+
let source = (_a2 = getRedirectFromOutput(path)) == null ? void 0 : _a2.source;
|
|
128264
128255
|
if (!source && host.realpath && options.preserveSymlinks && isDeclarationFileName(fileName) && fileName.includes(nodeModulesPathPart)) {
|
|
128265
128256
|
const realPath2 = toPath3(host.realpath(fileName));
|
|
128266
|
-
if (realPath2 !== path) source =
|
|
128257
|
+
if (realPath2 !== path) source = (_b2 = getRedirectFromOutput(realPath2)) == null ? void 0 : _b2.source;
|
|
128267
128258
|
}
|
|
128268
128259
|
if (source) {
|
|
128269
|
-
const file2 =
|
|
128260
|
+
const file2 = findSourceFile(source, isDefaultLib, ignoreNoDefaultLib, reason, packageId);
|
|
128270
128261
|
if (file2) addFileToFilesByName(
|
|
128271
128262
|
file2,
|
|
128272
128263
|
path,
|
|
@@ -128290,7 +128281,7 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
128290
128281
|
const checkedName = file2.fileName;
|
|
128291
128282
|
const isRedirect = toPath3(checkedName) !== toPath3(fileName);
|
|
128292
128283
|
if (isRedirect) {
|
|
128293
|
-
fileName =
|
|
128284
|
+
fileName = ((_c2 = getRedirectFromSourceFile(fileName)) == null ? void 0 : _c2.outputDts) || fileName;
|
|
128294
128285
|
}
|
|
128295
128286
|
const checkedAbsolutePath = getNormalizedAbsolutePathWithoutRoot(checkedName, currentDirectory);
|
|
128296
128287
|
const inputAbsolutePath = getNormalizedAbsolutePathWithoutRoot(fileName, currentDirectory);
|
|
@@ -128319,14 +128310,13 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
128319
128310
|
}
|
|
128320
128311
|
let redirectedPath;
|
|
128321
128312
|
if (!useSourceOfProjectReferenceRedirect) {
|
|
128322
|
-
const redirectProject =
|
|
128323
|
-
if (redirectProject) {
|
|
128324
|
-
if (redirectProject.commandLine.options.outFile) {
|
|
128313
|
+
const redirectProject = getRedirectFromSourceFile(fileName);
|
|
128314
|
+
if (redirectProject == null ? void 0 : redirectProject.outputDts) {
|
|
128315
|
+
if (redirectProject.resolvedRef.commandLine.options.outFile) {
|
|
128325
128316
|
return void 0;
|
|
128326
128317
|
}
|
|
128327
|
-
|
|
128328
|
-
|
|
128329
|
-
redirectedPath = toPath3(redirect);
|
|
128318
|
+
fileName = redirectProject.outputDts;
|
|
128319
|
+
redirectedPath = toPath3(redirectProject.outputDts);
|
|
128330
128320
|
}
|
|
128331
128321
|
}
|
|
128332
128322
|
const sourceFileOptions = getCreateSourceFileOptions(fileName, moduleResolutionCache, host, options);
|
|
@@ -128370,7 +128360,7 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
128370
128360
|
file.path = path;
|
|
128371
128361
|
file.resolvedPath = toPath3(fileName);
|
|
128372
128362
|
file.originalFileName = originalFileName;
|
|
128373
|
-
file.packageJsonLocations = ((
|
|
128363
|
+
file.packageJsonLocations = ((_d2 = sourceFileOptions.packageJsonLocations) == null ? void 0 : _d2.length) ? sourceFileOptions.packageJsonLocations : void 0;
|
|
128374
128364
|
file.packageJsonScope = sourceFileOptions.packageJsonScope;
|
|
128375
128365
|
addFileIncludeReason(
|
|
128376
128366
|
file,
|
|
@@ -128425,60 +128415,17 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
128425
128415
|
if (file !== void 0) missingFileNames.delete(path);
|
|
128426
128416
|
else missingFileNames.set(path, fileName);
|
|
128427
128417
|
}
|
|
128428
|
-
function
|
|
128429
|
-
|
|
128430
|
-
return referencedProject && getProjectReferenceOutputName(referencedProject, fileName);
|
|
128431
|
-
}
|
|
128432
|
-
function getProjectReferenceRedirectProject(fileName) {
|
|
128433
|
-
if (!resolvedProjectReferences || !resolvedProjectReferences.length || isDeclarationFileName(fileName) || fileExtensionIs(fileName, ".json" /* Json */)) {
|
|
128434
|
-
return void 0;
|
|
128435
|
-
}
|
|
128436
|
-
return getResolvedProjectReferenceToRedirect(fileName);
|
|
128437
|
-
}
|
|
128438
|
-
function getProjectReferenceOutputName(referencedProject, fileName) {
|
|
128439
|
-
const out = referencedProject.commandLine.options.outFile;
|
|
128440
|
-
return out ? changeExtension(out, ".d.ts" /* Dts */) : getOutputDeclarationFileName(fileName, referencedProject.commandLine, !host.useCaseSensitiveFileNames());
|
|
128441
|
-
}
|
|
128442
|
-
function getResolvedProjectReferenceToRedirect(fileName) {
|
|
128443
|
-
if (mapFromFileToProjectReferenceRedirects === void 0) {
|
|
128444
|
-
mapFromFileToProjectReferenceRedirects = /* @__PURE__ */ new Map();
|
|
128445
|
-
forEachResolvedProjectReference2((referencedProject) => {
|
|
128446
|
-
if (toPath3(options.configFilePath) !== referencedProject.sourceFile.path) {
|
|
128447
|
-
referencedProject.commandLine.fileNames.forEach((f) => mapFromFileToProjectReferenceRedirects.set(toPath3(f), referencedProject.sourceFile.path));
|
|
128448
|
-
}
|
|
128449
|
-
});
|
|
128450
|
-
}
|
|
128451
|
-
const referencedProjectPath = mapFromFileToProjectReferenceRedirects.get(toPath3(fileName));
|
|
128452
|
-
return referencedProjectPath && getResolvedProjectReferenceByPath(referencedProjectPath);
|
|
128418
|
+
function getRedirectFromSourceFile(fileName) {
|
|
128419
|
+
return mapSourceFileToResolvedRef == null ? void 0 : mapSourceFileToResolvedRef.get(toPath3(fileName));
|
|
128453
128420
|
}
|
|
128454
128421
|
function forEachResolvedProjectReference2(cb) {
|
|
128455
128422
|
return forEachResolvedProjectReference(resolvedProjectReferences, cb);
|
|
128456
128423
|
}
|
|
128457
|
-
function
|
|
128458
|
-
|
|
128459
|
-
if (!hasResolvedReferencencesInNodeModules && pathContainsNodeModules(path)) return void 0;
|
|
128460
|
-
if (mapFromToProjectReferenceRedirectSource === void 0) {
|
|
128461
|
-
mapFromToProjectReferenceRedirectSource = /* @__PURE__ */ new Map();
|
|
128462
|
-
forEachResolvedProjectReference2((resolvedRef) => {
|
|
128463
|
-
const out = resolvedRef.commandLine.options.outFile;
|
|
128464
|
-
if (out) {
|
|
128465
|
-
const outputDts = changeExtension(out, ".d.ts" /* Dts */);
|
|
128466
|
-
mapFromToProjectReferenceRedirectSource.set(toPath3(outputDts), true);
|
|
128467
|
-
} else {
|
|
128468
|
-
const getCommonSourceDirectory3 = memoize(() => getCommonSourceDirectoryOfConfig(resolvedRef.commandLine, !host.useCaseSensitiveFileNames()));
|
|
128469
|
-
forEach(resolvedRef.commandLine.fileNames, (fileName) => {
|
|
128470
|
-
if (!isDeclarationFileName(fileName) && !fileExtensionIs(fileName, ".json" /* Json */)) {
|
|
128471
|
-
const outputDts = getOutputDeclarationFileName(fileName, resolvedRef.commandLine, !host.useCaseSensitiveFileNames(), getCommonSourceDirectory3);
|
|
128472
|
-
mapFromToProjectReferenceRedirectSource.set(toPath3(outputDts), fileName);
|
|
128473
|
-
}
|
|
128474
|
-
});
|
|
128475
|
-
}
|
|
128476
|
-
});
|
|
128477
|
-
}
|
|
128478
|
-
return mapFromToProjectReferenceRedirectSource.get(path);
|
|
128424
|
+
function getRedirectFromOutput(path) {
|
|
128425
|
+
return mapOutputFileToResolvedRef == null ? void 0 : mapOutputFileToResolvedRef.get(path);
|
|
128479
128426
|
}
|
|
128480
128427
|
function isSourceOfProjectReferenceRedirect(fileName) {
|
|
128481
|
-
return useSourceOfProjectReferenceRedirect && !!
|
|
128428
|
+
return useSourceOfProjectReferenceRedirect && !!getRedirectFromSourceFile(fileName);
|
|
128482
128429
|
}
|
|
128483
128430
|
function getResolvedProjectReferenceByPath(projectReferencePath) {
|
|
128484
128431
|
if (!projectReferenceRedirects) {
|
|
@@ -128646,7 +128593,7 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
128646
128593
|
continue;
|
|
128647
128594
|
}
|
|
128648
128595
|
const isFromNodeModulesSearch = resolution.isExternalLibraryImport;
|
|
128649
|
-
const isJsFile = !resolutionExtensionIsTSOrJson(resolution.extension) && !
|
|
128596
|
+
const isJsFile = !resolutionExtensionIsTSOrJson(resolution.extension) && !getRedirectFromSourceFile(resolution.resolvedFileName);
|
|
128650
128597
|
const isJsFileFromNodeModules = isFromNodeModulesSearch && isJsFile && (!resolution.originalPath || pathContainsNodeModules(resolution.resolvedFileName));
|
|
128651
128598
|
const resolvedFileName = resolution.resolvedFileName;
|
|
128652
128599
|
if (isFromNodeModulesSearch) {
|
|
@@ -128754,11 +128701,32 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi
|
|
|
128754
128701
|
sourceFile.path = sourceFilePath;
|
|
128755
128702
|
sourceFile.resolvedPath = sourceFilePath;
|
|
128756
128703
|
sourceFile.originalFileName = refPath;
|
|
128757
|
-
if (!hasResolvedReferencencesInNodeModules && (pathContainsNodeModules(sourceFile.resolvedPath) || pathContainsNodeModules(sourceFile.path))) {
|
|
128758
|
-
hasResolvedReferencencesInNodeModules = true;
|
|
128759
|
-
}
|
|
128760
128704
|
const resolvedRef = { commandLine, sourceFile };
|
|
128761
128705
|
projectReferenceRedirects.set(sourceFilePath, resolvedRef);
|
|
128706
|
+
if (options.configFile !== sourceFile) {
|
|
128707
|
+
mapSourceFileToResolvedRef ?? (mapSourceFileToResolvedRef = /* @__PURE__ */ new Map());
|
|
128708
|
+
mapOutputFileToResolvedRef ?? (mapOutputFileToResolvedRef = /* @__PURE__ */ new Map());
|
|
128709
|
+
let outDts;
|
|
128710
|
+
if (commandLine.options.outFile) {
|
|
128711
|
+
outDts = changeExtension(commandLine.options.outFile, ".d.ts" /* Dts */);
|
|
128712
|
+
mapOutputFileToResolvedRef == null ? void 0 : mapOutputFileToResolvedRef.set(toPath3(outDts), { resolvedRef });
|
|
128713
|
+
}
|
|
128714
|
+
const getCommonSourceDirectory3 = memoize(() => getCommonSourceDirectoryOfConfig(resolvedRef.commandLine, !host.useCaseSensitiveFileNames()));
|
|
128715
|
+
commandLine.fileNames.forEach((fileName) => {
|
|
128716
|
+
if (isDeclarationFileName(fileName)) return;
|
|
128717
|
+
const path = toPath3(fileName);
|
|
128718
|
+
let outputDts;
|
|
128719
|
+
if (!fileExtensionIs(fileName, ".json" /* Json */)) {
|
|
128720
|
+
if (!commandLine.options.outFile) {
|
|
128721
|
+
outputDts = getOutputDeclarationFileName(fileName, resolvedRef.commandLine, !host.useCaseSensitiveFileNames(), getCommonSourceDirectory3);
|
|
128722
|
+
mapOutputFileToResolvedRef.set(toPath3(outputDts), { resolvedRef, source: fileName });
|
|
128723
|
+
} else {
|
|
128724
|
+
outputDts = outDts;
|
|
128725
|
+
}
|
|
128726
|
+
}
|
|
128727
|
+
mapSourceFileToResolvedRef.set(path, { resolvedRef, outputDts });
|
|
128728
|
+
});
|
|
128729
|
+
}
|
|
128762
128730
|
if (commandLine.projectReferences) {
|
|
128763
128731
|
resolvedRef.references = commandLine.projectReferences.map(parseProjectReferenceConfigFile);
|
|
128764
128732
|
}
|
|
@@ -129479,7 +129447,7 @@ function updateHostForUseSourceOfProjectReferenceRedirect(host) {
|
|
|
129479
129447
|
);
|
|
129480
129448
|
}
|
|
129481
129449
|
function fileExistsIfProjectReferenceDts(file) {
|
|
129482
|
-
const source = host.
|
|
129450
|
+
const source = host.getRedirectFromOutput(host.toPath(file));
|
|
129483
129451
|
return source !== void 0 ? isString(source) ? originalFileExists.call(host.compilerHost, source) : true : void 0;
|
|
129484
129452
|
}
|
|
129485
129453
|
function directoryExistsIfProjectReferenceDeclDir(dir) {
|
|
@@ -130023,7 +129991,8 @@ var BuilderState;
|
|
|
130023
129991
|
return symbol && getReferencedFilesFromImportedModuleSymbol(symbol);
|
|
130024
129992
|
}
|
|
130025
129993
|
function getReferencedFileFromFileName(program, fileName, sourceFileDirectory, getCanonicalFileName) {
|
|
130026
|
-
|
|
129994
|
+
var _a;
|
|
129995
|
+
return toPath(((_a = program.getRedirectFromSourceFile(fileName)) == null ? void 0 : _a.outputDts) || fileName, sourceFileDirectory, getCanonicalFileName);
|
|
130027
129996
|
}
|
|
130028
129997
|
function getReferencedFiles(program, sourceFile, getCanonicalFileName) {
|
|
130029
129998
|
let referencedFiles;
|
|
@@ -132345,12 +132314,13 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
132345
132314
|
shouldRetryResolution,
|
|
132346
132315
|
logChanges
|
|
132347
132316
|
}) {
|
|
132317
|
+
var _a;
|
|
132348
132318
|
const path = resolutionHost.toPath(containingFile);
|
|
132349
132319
|
const resolutionsInFile = perFileCache.get(path) || perFileCache.set(path, createModeAwareCache()).get(path);
|
|
132350
132320
|
const resolvedModules = [];
|
|
132351
132321
|
const hasInvalidatedNonRelativeUnresolvedImport = logChanges && isFileWithInvalidatedNonRelativeUnresolvedImports(path);
|
|
132352
132322
|
const program = resolutionHost.getCurrentProgram();
|
|
132353
|
-
const oldRedirect = program && program.
|
|
132323
|
+
const oldRedirect = program && ((_a = program.getRedirectFromSourceFile(containingFile)) == null ? void 0 : _a.resolvedRef);
|
|
132354
132324
|
const unmatchedRedirects = oldRedirect ? !redirectedReference || redirectedReference.sourceFile.path !== oldRedirect.sourceFile.path : !!redirectedReference;
|
|
132355
132325
|
const seenNamesInFile = createModeAwareCache();
|
|
132356
132326
|
for (const entry of entries) {
|
|
@@ -140497,7 +140467,7 @@ function createModuleSpecifierResolutionHost(program, host) {
|
|
|
140497
140467
|
},
|
|
140498
140468
|
getGlobalTypingsCacheLocation: maybeBind(host, host.getGlobalTypingsCacheLocation),
|
|
140499
140469
|
redirectTargetsMap: program.redirectTargetsMap,
|
|
140500
|
-
|
|
140470
|
+
getRedirectFromSourceFile: (fileName) => program.getRedirectFromSourceFile(fileName),
|
|
140501
140471
|
isSourceOfProjectReferenceRedirect: (fileName) => program.isSourceOfProjectReferenceRedirect(fileName),
|
|
140502
140472
|
getNearestAncestorDirectoryWithPackageJson: maybeBind(host, host.getNearestAncestorDirectoryWithPackageJson),
|
|
140503
140473
|
getFileIncludeReasons: () => program.getFileIncludeReasons(),
|
|
@@ -186878,7 +186848,7 @@ var Project2 = class _Project {
|
|
|
186878
186848
|
this.projectService.onProjectCreation(this);
|
|
186879
186849
|
}
|
|
186880
186850
|
/** @internal */
|
|
186881
|
-
|
|
186851
|
+
getRedirectFromSourceFile(_fileName) {
|
|
186882
186852
|
return void 0;
|
|
186883
186853
|
}
|
|
186884
186854
|
isNonTsProject() {
|
|
@@ -188927,9 +188897,9 @@ var ConfiguredProject2 = class extends Project2 {
|
|
|
188927
188897
|
(this.potentialProjectReferences || (this.potentialProjectReferences = /* @__PURE__ */ new Set())).add(canonicalConfigPath);
|
|
188928
188898
|
}
|
|
188929
188899
|
/** @internal */
|
|
188930
|
-
|
|
188900
|
+
getRedirectFromSourceFile(fileName) {
|
|
188931
188901
|
const program = this.getCurrentProgram();
|
|
188932
|
-
return program && program.
|
|
188902
|
+
return program && program.getRedirectFromSourceFile(fileName);
|
|
188933
188903
|
}
|
|
188934
188904
|
/** @internal */
|
|
188935
188905
|
forEachResolvedProjectReference(cb) {
|
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.9.0-pr-
|
|
5
|
+
"version": "5.9.0-pr-61746-2",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|