@typescript-deploys/pr-build 5.7.0-pr-53017-15 → 5.7.0-pr-59767-6
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/lib.es5.d.ts +0 -9
- package/lib/tsc.js +166 -99
- package/lib/typescript.d.ts +3 -0
- package/lib/typescript.js +180 -106
- package/package.json +1 -1
package/lib/lib.es5.d.ts
CHANGED
|
@@ -1677,15 +1677,6 @@ type NoInfer<T> = intrinsic;
|
|
|
1677
1677
|
*/
|
|
1678
1678
|
interface ThisType<T> {}
|
|
1679
1679
|
|
|
1680
|
-
/**
|
|
1681
|
-
* Type instantiated to perform partial inferences from indexed accesses
|
|
1682
|
-
*/
|
|
1683
|
-
type PartialInference<T, Keys extends string> = ({
|
|
1684
|
-
[K in Keys]: {
|
|
1685
|
-
[K1 in K]: T;
|
|
1686
|
-
};
|
|
1687
|
-
})[Keys];
|
|
1688
|
-
|
|
1689
1680
|
/**
|
|
1690
1681
|
* Stores types to be used with WeakSet, WeakMap, WeakRef, and FinalizationRegistry
|
|
1691
1682
|
*/
|
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.7";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20240917`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -6753,6 +6753,9 @@ var Diagnostics = {
|
|
|
6753
6753
|
This_expression_is_always_nullish: diag(2871, 1 /* Error */, "This_expression_is_always_nullish_2871", "This expression is always nullish."),
|
|
6754
6754
|
This_kind_of_expression_is_always_truthy: diag(2872, 1 /* Error */, "This_kind_of_expression_is_always_truthy_2872", "This kind of expression is always truthy."),
|
|
6755
6755
|
This_kind_of_expression_is_always_falsy: diag(2873, 1 /* Error */, "This_kind_of_expression_is_always_falsy_2873", "This kind of expression is always falsy."),
|
|
6756
|
+
This_relative_import_path_is_unsafe_to_rewrite_because_it_looks_like_a_file_name_but_actually_resolves_to_0: diag(2874, 1 /* Error */, "This_relative_import_path_is_unsafe_to_rewrite_because_it_looks_like_a_file_name_but_actually_resolv_2874", 'This relative import path is unsafe to rewrite because it looks like a file name, but actually resolves to "{0}".'),
|
|
6757
|
+
This_import_uses_a_0_extension_to_resolve_to_an_input_TypeScript_file_but_will_not_be_rewritten_during_emit_because_it_is_not_a_relative_path: diag(2875, 1 /* Error */, "This_import_uses_a_0_extension_to_resolve_to_an_input_TypeScript_file_but_will_not_be_rewritten_duri_2875", "This import uses a '{0}' extension to resolve to an input TypeScript file, but will not be rewritten during emit because it is not a relative path."),
|
|
6758
|
+
This_import_path_is_unsafe_to_rewrite_because_it_resolves_to_another_project_and_the_relative_path_between_the_projects_output_files_is_not_the_same_as_the_relative_path_between_its_input_files: diag(2876, 1 /* Error */, "This_import_path_is_unsafe_to_rewrite_because_it_resolves_to_another_project_and_the_relative_path_b_2876", "This import path is unsafe to rewrite because it resolves to another project, and the relative path between the projects' output files is not the same as the relative path between its input files."),
|
|
6756
6759
|
Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
|
6757
6760
|
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
|
|
6758
6761
|
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
|
|
@@ -7310,6 +7313,7 @@ var Diagnostics = {
|
|
|
7310
7313
|
Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0: diag(6418, 3 /* Message */, "Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0_6418", "Searching all ancestor node_modules directories for fallback extensions: {0}."),
|
|
7311
7314
|
Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_program_needs_to_report_errors: diag(6419, 3 /* Message */, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_program_needs_to_report_errors_6419", "Project '{0}' is out of date because buildinfo file '{1}' indicates that program needs to report errors."),
|
|
7312
7315
|
Project_0_is_out_of_date_because_1: diag(6420, 3 /* Message */, "Project_0_is_out_of_date_because_1_6420", "Project '{0}' is out of date because {1}."),
|
|
7316
|
+
Rewrite_ts_tsx_mts_and_cts_file_extensions_in_relative_import_paths_to_their_JavaScript_equivalent_in_output_files: diag(6421, 3 /* Message */, "Rewrite_ts_tsx_mts_and_cts_file_extensions_in_relative_import_paths_to_their_JavaScript_equivalent_i_6421", "Rewrite '.ts', '.tsx', '.mts', and '.cts' file extensions in relative import paths to their JavaScript equivalent in output files."),
|
|
7313
7317
|
The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, 3 /* Message */, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"),
|
|
7314
7318
|
The_expected_type_comes_from_this_index_signature: diag(6501, 3 /* Message */, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."),
|
|
7315
7319
|
The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, 3 /* Message */, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."),
|
|
@@ -11835,6 +11839,9 @@ function isTypeOnlyExportDeclaration(node) {
|
|
|
11835
11839
|
function isTypeOnlyImportOrExportDeclaration(node) {
|
|
11836
11840
|
return isTypeOnlyImportDeclaration(node) || isTypeOnlyExportDeclaration(node);
|
|
11837
11841
|
}
|
|
11842
|
+
function isPartOfTypeOnlyImportOrExportDeclaration(node) {
|
|
11843
|
+
return findAncestor(node, isTypeOnlyImportOrExportDeclaration) !== void 0;
|
|
11844
|
+
}
|
|
11838
11845
|
function isImportAttributeName(node) {
|
|
11839
11846
|
return isStringLiteral(node) || isIdentifier(node);
|
|
11840
11847
|
}
|
|
@@ -15008,6 +15015,9 @@ function tryGetModuleSpecifierFromDeclaration(node) {
|
|
|
15008
15015
|
Debug.assertNever(node);
|
|
15009
15016
|
}
|
|
15010
15017
|
}
|
|
15018
|
+
function shouldRewriteModuleSpecifier(specifier, compilerOptions) {
|
|
15019
|
+
return !!compilerOptions.rewriteRelativeImportExtensions && pathIsRelative(specifier) && !isDeclarationFileName(specifier);
|
|
15020
|
+
}
|
|
15011
15021
|
function getExternalModuleName(node) {
|
|
15012
15022
|
switch (node.kind) {
|
|
15013
15023
|
case 272 /* ImportDeclaration */:
|
|
@@ -17140,6 +17150,12 @@ function getLinesBetweenPositionAndNextNonWhitespaceCharacter(pos, stopPos, sour
|
|
|
17140
17150
|
);
|
|
17141
17151
|
return getLinesBetweenPositions(sourceFile, pos, Math.min(stopPos, nextPos));
|
|
17142
17152
|
}
|
|
17153
|
+
function rangeContainsRange(r1, r2) {
|
|
17154
|
+
return startEndContainsRange(r1.pos, r1.end, r2);
|
|
17155
|
+
}
|
|
17156
|
+
function startEndContainsRange(start, end, range) {
|
|
17157
|
+
return start <= range.pos && end >= range.end;
|
|
17158
|
+
}
|
|
17143
17159
|
function getPreviousNonWhitespacePosition(pos, stopPos = 0, sourceFile) {
|
|
17144
17160
|
while (pos-- > stopPos) {
|
|
17145
17161
|
if (!isWhiteSpaceLike(sourceFile.text.charCodeAt(pos))) {
|
|
@@ -17732,6 +17748,12 @@ function createComputedCompilerOptions(options) {
|
|
|
17732
17748
|
return options;
|
|
17733
17749
|
}
|
|
17734
17750
|
var _computedOptions = createComputedCompilerOptions({
|
|
17751
|
+
allowImportingTsExtensions: {
|
|
17752
|
+
dependencies: ["rewriteRelativeImportExtensions"],
|
|
17753
|
+
computeValue: (compilerOptions) => {
|
|
17754
|
+
return !!(compilerOptions.allowImportingTsExtensions || compilerOptions.rewriteRelativeImportExtensions);
|
|
17755
|
+
}
|
|
17756
|
+
},
|
|
17735
17757
|
target: {
|
|
17736
17758
|
dependencies: ["module"],
|
|
17737
17759
|
computeValue: (compilerOptions) => {
|
|
@@ -17946,6 +17968,7 @@ var _computedOptions = createComputedCompilerOptions({
|
|
|
17946
17968
|
}
|
|
17947
17969
|
});
|
|
17948
17970
|
var computedOptions = _computedOptions;
|
|
17971
|
+
var getAllowImportingTsExtensions = _computedOptions.allowImportingTsExtensions.computeValue;
|
|
17949
17972
|
var getEmitScriptTarget = _computedOptions.target.computeValue;
|
|
17950
17973
|
var getEmitModuleKind = _computedOptions.module.computeValue;
|
|
17951
17974
|
var getEmitModuleResolutionKind = _computedOptions.moduleResolution.computeValue;
|
|
@@ -36819,6 +36842,15 @@ var commandOptionsWithoutBuild = [
|
|
|
36819
36842
|
defaultValueDescription: false,
|
|
36820
36843
|
transpileOptionValue: void 0
|
|
36821
36844
|
},
|
|
36845
|
+
{
|
|
36846
|
+
name: "rewriteRelativeImportExtensions",
|
|
36847
|
+
type: "boolean",
|
|
36848
|
+
affectsSemanticDiagnostics: true,
|
|
36849
|
+
affectsBuildInfo: true,
|
|
36850
|
+
category: Diagnostics.Modules,
|
|
36851
|
+
description: Diagnostics.Rewrite_ts_tsx_mts_and_cts_file_extensions_in_relative_import_paths_to_their_JavaScript_equivalent_in_output_files,
|
|
36852
|
+
defaultValueDescription: false
|
|
36853
|
+
},
|
|
36822
36854
|
{
|
|
36823
36855
|
name: "resolvePackageJsonExports",
|
|
36824
36856
|
type: "boolean",
|
|
@@ -40449,10 +40481,11 @@ function loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecor
|
|
|
40449
40481
|
}
|
|
40450
40482
|
return tryAddingExtensions(extensionless, extensions, extension, onlyRecordFailures, state);
|
|
40451
40483
|
}
|
|
40452
|
-
function loadFileNameFromPackageJsonField(extensions, candidate, onlyRecordFailures, state) {
|
|
40484
|
+
function loadFileNameFromPackageJsonField(extensions, candidate, packageJsonValue, onlyRecordFailures, state) {
|
|
40453
40485
|
if (extensions & 1 /* TypeScript */ && fileExtensionIsOneOf(candidate, supportedTSImplementationExtensions) || extensions & 4 /* Declaration */ && fileExtensionIsOneOf(candidate, supportedDeclarationExtensions)) {
|
|
40454
40486
|
const result = tryFile(candidate, onlyRecordFailures, state);
|
|
40455
|
-
|
|
40487
|
+
const ext = tryExtractTSExtension(candidate);
|
|
40488
|
+
return result !== void 0 ? { path: candidate, ext, resolvedUsingTsExtension: packageJsonValue ? !endsWith(packageJsonValue, ext) : void 0 } : void 0;
|
|
40456
40489
|
}
|
|
40457
40490
|
if (state.isConfigLookup && extensions === 8 /* Json */ && fileExtensionIs(candidate, ".json" /* Json */)) {
|
|
40458
40491
|
const result = tryFile(candidate, onlyRecordFailures, state);
|
|
@@ -40641,7 +40674,14 @@ function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFail
|
|
|
40641
40674
|
}
|
|
40642
40675
|
}
|
|
40643
40676
|
const loader = (extensions2, candidate2, onlyRecordFailures2, state2) => {
|
|
40644
|
-
const fromFile = loadFileNameFromPackageJsonField(
|
|
40677
|
+
const fromFile = loadFileNameFromPackageJsonField(
|
|
40678
|
+
extensions2,
|
|
40679
|
+
candidate2,
|
|
40680
|
+
/*packageJsonValue*/
|
|
40681
|
+
void 0,
|
|
40682
|
+
onlyRecordFailures2,
|
|
40683
|
+
state2
|
|
40684
|
+
);
|
|
40645
40685
|
if (fromFile) {
|
|
40646
40686
|
return noPackageId(fromFile);
|
|
40647
40687
|
}
|
|
@@ -40997,6 +41037,7 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
|
|
|
40997
41037
|
return toSearchResult(withPackageId(scope, loadFileNameFromPackageJsonField(
|
|
40998
41038
|
extensions,
|
|
40999
41039
|
finalPath,
|
|
41040
|
+
target,
|
|
41000
41041
|
/*onlyRecordFailures*/
|
|
41001
41042
|
false,
|
|
41002
41043
|
state
|
|
@@ -41109,6 +41150,8 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
|
|
|
41109
41150
|
return toSearchResult(withPackageId(scope, loadFileNameFromPackageJsonField(
|
|
41110
41151
|
extensions,
|
|
41111
41152
|
possibleInputWithInputExtension,
|
|
41153
|
+
/*packageJsonValue*/
|
|
41154
|
+
void 0,
|
|
41112
41155
|
/*onlyRecordFailures*/
|
|
41113
41156
|
false,
|
|
41114
41157
|
state
|
|
@@ -41471,7 +41514,7 @@ function resolveFromTypeRoot(moduleName, state) {
|
|
|
41471
41514
|
}
|
|
41472
41515
|
}
|
|
41473
41516
|
function shouldAllowImportingTsExtension(compilerOptions, fromFileName) {
|
|
41474
|
-
return
|
|
41517
|
+
return getAllowImportingTsExtensions(compilerOptions) || !!fromFileName && isDeclarationFileName(fromFileName);
|
|
41475
41518
|
}
|
|
41476
41519
|
function loadModuleFromGlobalCache(moduleName, projectName, compilerOptions, host, globalCache, packageJsonInfoCache) {
|
|
41477
41520
|
const traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
@@ -48722,6 +48765,36 @@ function createTypeChecker(host) {
|
|
|
48722
48765
|
const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference));
|
|
48723
48766
|
error(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension);
|
|
48724
48767
|
}
|
|
48768
|
+
} else if (compilerOptions.rewriteRelativeImportExtensions && !(location.flags & 33554432 /* Ambient */) && !isDeclarationFileName(moduleReference) && !isLiteralImportTypeNode(location) && !isPartOfTypeOnlyImportOrExportDeclaration(location)) {
|
|
48769
|
+
const shouldRewrite = shouldRewriteModuleSpecifier(moduleReference, compilerOptions);
|
|
48770
|
+
if (!resolvedModule.resolvedUsingTsExtension && shouldRewrite) {
|
|
48771
|
+
error(
|
|
48772
|
+
errorNode,
|
|
48773
|
+
Diagnostics.This_relative_import_path_is_unsafe_to_rewrite_because_it_looks_like_a_file_name_but_actually_resolves_to_0,
|
|
48774
|
+
getRelativePathFromFile(getNormalizedAbsolutePath(currentSourceFile.fileName, host.getCurrentDirectory()), resolvedModule.resolvedFileName, hostGetCanonicalFileName(host))
|
|
48775
|
+
);
|
|
48776
|
+
} else if (resolvedModule.resolvedUsingTsExtension && !shouldRewrite && sourceFileMayBeEmitted(sourceFile, host)) {
|
|
48777
|
+
error(
|
|
48778
|
+
errorNode,
|
|
48779
|
+
Diagnostics.This_import_uses_a_0_extension_to_resolve_to_an_input_TypeScript_file_but_will_not_be_rewritten_during_emit_because_it_is_not_a_relative_path,
|
|
48780
|
+
getAnyExtensionFromPath(moduleReference)
|
|
48781
|
+
);
|
|
48782
|
+
} else if (resolvedModule.resolvedUsingTsExtension && shouldRewrite) {
|
|
48783
|
+
const redirect = host.getResolvedProjectReferenceToRedirect(sourceFile.path);
|
|
48784
|
+
if (redirect) {
|
|
48785
|
+
const ignoreCase = !host.useCaseSensitiveFileNames();
|
|
48786
|
+
const ownRootDir = host.getCommonSourceDirectory();
|
|
48787
|
+
const otherRootDir = getCommonSourceDirectoryOfConfig(redirect.commandLine, ignoreCase);
|
|
48788
|
+
const rootDirPath = getRelativePathFromDirectory(ownRootDir, otherRootDir, ignoreCase);
|
|
48789
|
+
const outDirPath = getRelativePathFromDirectory(compilerOptions.outDir || ownRootDir, redirect.commandLine.options.outDir || otherRootDir, ignoreCase);
|
|
48790
|
+
if (rootDirPath !== outDirPath) {
|
|
48791
|
+
error(
|
|
48792
|
+
errorNode,
|
|
48793
|
+
Diagnostics.This_import_path_is_unsafe_to_rewrite_because_it_resolves_to_another_project_and_the_relative_path_between_the_projects_output_files_is_not_the_same_as_the_relative_path_between_its_input_files
|
|
48794
|
+
);
|
|
48795
|
+
}
|
|
48796
|
+
}
|
|
48797
|
+
}
|
|
48725
48798
|
}
|
|
48726
48799
|
if (sourceFile.symbol) {
|
|
48727
48800
|
if (errorNode && resolvedModule.isExternalLibraryImport && !resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
|
|
@@ -52533,7 +52606,7 @@ function createTypeChecker(host) {
|
|
|
52533
52606
|
}
|
|
52534
52607
|
return factory.updateImportTypeNode(
|
|
52535
52608
|
node,
|
|
52536
|
-
factory.updateLiteralTypeNode(node.argument,
|
|
52609
|
+
factory.updateLiteralTypeNode(node.argument, rewriteModuleSpecifier2(node, node.argument.literal)),
|
|
52537
52610
|
visitNode(node.attributes, visitExistingNodeTreeSymbols, isImportAttributes),
|
|
52538
52611
|
visitNode(node.qualifier, visitExistingNodeTreeSymbols, isEntityName),
|
|
52539
52612
|
visitNodes2(node.typeArguments, visitExistingNodeTreeSymbols, isTypeNode),
|
|
@@ -52687,7 +52760,7 @@ function createTypeChecker(host) {
|
|
|
52687
52760
|
function getNameForJSDocFunctionParameter(p, index) {
|
|
52688
52761
|
return p.name && isIdentifier(p.name) && p.name.escapedText === "this" ? "this" : getEffectiveDotDotDotForParameter(p) ? `args` : `arg${index}`;
|
|
52689
52762
|
}
|
|
52690
|
-
function
|
|
52763
|
+
function rewriteModuleSpecifier2(parent, lit) {
|
|
52691
52764
|
if (context.bundled || context.enclosingFile !== getSourceFileOfNode(lit)) {
|
|
52692
52765
|
let name = lit.text;
|
|
52693
52766
|
const nodeSymbol = getNodeLinks(node).resolvedSymbol;
|
|
@@ -66951,8 +67024,7 @@ function createTypeChecker(host) {
|
|
|
66951
67024
|
priority: void 0,
|
|
66952
67025
|
topLevel: true,
|
|
66953
67026
|
isFixed: false,
|
|
66954
|
-
impliedArity: void 0
|
|
66955
|
-
indexes: void 0
|
|
67027
|
+
impliedArity: void 0
|
|
66956
67028
|
};
|
|
66957
67029
|
}
|
|
66958
67030
|
function cloneInferenceInfo(inference) {
|
|
@@ -66964,8 +67036,7 @@ function createTypeChecker(host) {
|
|
|
66964
67036
|
priority: inference.priority,
|
|
66965
67037
|
topLevel: inference.topLevel,
|
|
66966
67038
|
isFixed: inference.isFixed,
|
|
66967
|
-
impliedArity: inference.impliedArity
|
|
66968
|
-
indexes: inference.indexes && inference.indexes.slice()
|
|
67039
|
+
impliedArity: inference.impliedArity
|
|
66969
67040
|
};
|
|
66970
67041
|
}
|
|
66971
67042
|
function cloneInferredPartOfContext(context) {
|
|
@@ -67083,7 +67154,7 @@ function createTypeChecker(host) {
|
|
|
67083
67154
|
const templateType = getTemplateTypeFromMappedType(target);
|
|
67084
67155
|
const inference = createInferenceInfo(typeParameter);
|
|
67085
67156
|
inferTypes([inference], sourceType, templateType);
|
|
67086
|
-
return getTypeFromInference(inference) ||
|
|
67157
|
+
return getTypeFromInference(inference) || unknownType;
|
|
67087
67158
|
}
|
|
67088
67159
|
function inferReverseMappedType(source, target, constraint) {
|
|
67089
67160
|
const cacheKey = source.id + "," + target.id + "," + constraint.id;
|
|
@@ -67430,24 +67501,6 @@ function createTypeChecker(host) {
|
|
|
67430
67501
|
} else if (source.flags & 8388608 /* IndexedAccess */ && target.flags & 8388608 /* IndexedAccess */) {
|
|
67431
67502
|
inferFromTypes(source.objectType, target.objectType);
|
|
67432
67503
|
inferFromTypes(source.indexType, target.indexType);
|
|
67433
|
-
} else if (!(priority & 1 /* NakedTypeVariable */) && target.flags & 8388608 /* IndexedAccess */) {
|
|
67434
|
-
if (isFromInferenceBlockedSource(source)) {
|
|
67435
|
-
return;
|
|
67436
|
-
}
|
|
67437
|
-
const inference = getInferenceInfoForType(getActualTypeVariable(target.objectType));
|
|
67438
|
-
if (inference) {
|
|
67439
|
-
if (getObjectFlags(source) & 262144 /* NonInferrableType */ || source === nonInferrableAnyType) {
|
|
67440
|
-
return;
|
|
67441
|
-
}
|
|
67442
|
-
if (!inference.isFixed) {
|
|
67443
|
-
const inferenceTypeSymbol = getGlobalSymbol("PartialInference", 788968 /* Type */, Diagnostics.Cannot_find_global_type_0);
|
|
67444
|
-
const inferenceType = inferenceTypeSymbol && getDeclaredTypeOfSymbol(inferenceTypeSymbol);
|
|
67445
|
-
if (inferenceType && inferenceType !== unknownType) {
|
|
67446
|
-
const mapper = createTypeMapper(getSymbolLinks(inferenceTypeSymbol).typeParameters, [source, target.indexType]);
|
|
67447
|
-
inference.indexes = append(inference.indexes, instantiateType(inferenceType, mapper));
|
|
67448
|
-
}
|
|
67449
|
-
}
|
|
67450
|
-
}
|
|
67451
67504
|
} else if (source.flags & 268435456 /* StringMapping */ && target.flags & 268435456 /* StringMapping */) {
|
|
67452
67505
|
if (source.symbol === target.symbol) {
|
|
67453
67506
|
inferFromTypes(source.type, target.type);
|
|
@@ -67951,51 +68004,6 @@ function createTypeChecker(host) {
|
|
|
67951
68004
|
const preferCovariantType = inferredCovariantType && (!inferredContravariantType || !(inferredCovariantType.flags & (131072 /* Never */ | 1 /* Any */)) && some(inference.contraCandidates, (t) => isTypeAssignableTo(inferredCovariantType, t)) && every(context.inferences, (other) => other !== inference && getConstraintOfTypeParameter(other.typeParameter) !== inference.typeParameter || every(other.candidates, (t) => isTypeAssignableTo(t, inferredCovariantType))));
|
|
67952
68005
|
inferredType = preferCovariantType ? inferredCovariantType : inferredContravariantType;
|
|
67953
68006
|
fallbackType = preferCovariantType ? inferredContravariantType : inferredCovariantType;
|
|
67954
|
-
} else if (inference.indexes) {
|
|
67955
|
-
let aggregateInference = getIntersectionType(inference.indexes);
|
|
67956
|
-
const constraint2 = getConstraintOfTypeParameter(inference.typeParameter);
|
|
67957
|
-
if (constraint2) {
|
|
67958
|
-
const instantiatedConstraint = instantiateType(constraint2, context.nonFixingMapper);
|
|
67959
|
-
if (instantiatedConstraint.flags & 1048576 /* Union */ && !context.compareTypes(aggregateInference, getTypeWithThisArgument(instantiatedConstraint, aggregateInference))) {
|
|
67960
|
-
const discriminantProps = findDiscriminantProperties(getPropertiesOfType(aggregateInference), instantiatedConstraint);
|
|
67961
|
-
if (discriminantProps) {
|
|
67962
|
-
let match;
|
|
67963
|
-
findDiscriminant:
|
|
67964
|
-
for (const p of discriminantProps) {
|
|
67965
|
-
const candidatePropType = getTypeOfPropertyOfType(aggregateInference, p.escapedName);
|
|
67966
|
-
for (const type of instantiatedConstraint.types) {
|
|
67967
|
-
const propType = getTypeOfPropertyOfType(type, p.escapedName);
|
|
67968
|
-
if (propType && candidatePropType && checkTypeAssignableTo(
|
|
67969
|
-
candidatePropType,
|
|
67970
|
-
propType,
|
|
67971
|
-
/*errorNode*/
|
|
67972
|
-
void 0
|
|
67973
|
-
)) {
|
|
67974
|
-
if (match && match !== type) {
|
|
67975
|
-
match = void 0;
|
|
67976
|
-
break findDiscriminant;
|
|
67977
|
-
} else {
|
|
67978
|
-
match = type;
|
|
67979
|
-
}
|
|
67980
|
-
}
|
|
67981
|
-
}
|
|
67982
|
-
}
|
|
67983
|
-
if (match) {
|
|
67984
|
-
aggregateInference = getSpreadType(
|
|
67985
|
-
match,
|
|
67986
|
-
aggregateInference,
|
|
67987
|
-
/*symbol*/
|
|
67988
|
-
void 0,
|
|
67989
|
-
/*propegatedFlags*/
|
|
67990
|
-
0,
|
|
67991
|
-
/*readonly*/
|
|
67992
|
-
false
|
|
67993
|
-
);
|
|
67994
|
-
}
|
|
67995
|
-
}
|
|
67996
|
-
}
|
|
67997
|
-
}
|
|
67998
|
-
inferredType = aggregateInference;
|
|
67999
68007
|
} else if (context.flags & 1 /* NoDefault */) {
|
|
68000
68008
|
inferredType = silentNeverType;
|
|
68001
68009
|
} else {
|
|
@@ -88826,7 +88834,7 @@ function createBasicNodeBuilderModuleSpecifierResolutionHost(host) {
|
|
|
88826
88834
|
var _a;
|
|
88827
88835
|
return (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host);
|
|
88828
88836
|
},
|
|
88829
|
-
useCaseSensitiveFileNames:
|
|
88837
|
+
useCaseSensitiveFileNames: () => host.useCaseSensitiveFileNames(),
|
|
88830
88838
|
redirectTargetsMap: host.redirectTargetsMap,
|
|
88831
88839
|
getProjectReferenceRedirect: (fileName) => host.getProjectReferenceRedirect(fileName),
|
|
88832
88840
|
isSourceOfProjectReferenceRedirect: (fileName) => host.isSourceOfProjectReferenceRedirect(fileName),
|
|
@@ -91093,6 +91101,13 @@ function isSimpleParameter(node) {
|
|
|
91093
91101
|
function isSimpleParameterList(nodes) {
|
|
91094
91102
|
return every(nodes, isSimpleParameter);
|
|
91095
91103
|
}
|
|
91104
|
+
function rewriteModuleSpecifier(node, compilerOptions) {
|
|
91105
|
+
if (!node || !isStringLiteral(node) || !shouldRewriteModuleSpecifier(node.text, compilerOptions)) {
|
|
91106
|
+
return node;
|
|
91107
|
+
}
|
|
91108
|
+
const updatedText = changeExtension(node.text, getOutputExtension(node.text, compilerOptions));
|
|
91109
|
+
return updatedText !== node.text ? setOriginalNode(setTextRange(factory.createStringLiteral(updatedText, node.singleQuote), node), node) : node;
|
|
91110
|
+
}
|
|
91096
91111
|
|
|
91097
91112
|
// src/compiler/transformers/destructuring.ts
|
|
91098
91113
|
function flattenDestructuringAssignment(node, visitor, context, level, needsValue, createAssignmentCallback) {
|
|
@@ -93411,7 +93426,14 @@ function transformTypeScript(context) {
|
|
|
93411
93426
|
return void 0;
|
|
93412
93427
|
}
|
|
93413
93428
|
if (!node.exportClause || isNamespaceExport(node.exportClause)) {
|
|
93414
|
-
return
|
|
93429
|
+
return factory2.updateExportDeclaration(
|
|
93430
|
+
node,
|
|
93431
|
+
node.modifiers,
|
|
93432
|
+
node.isTypeOnly,
|
|
93433
|
+
node.exportClause,
|
|
93434
|
+
node.moduleSpecifier,
|
|
93435
|
+
node.attributes
|
|
93436
|
+
);
|
|
93415
93437
|
}
|
|
93416
93438
|
const allowEmpty = !!compilerOptions.verbatimModuleSyntax;
|
|
93417
93439
|
const exportClause = visitNode(
|
|
@@ -93450,8 +93472,10 @@ function transformTypeScript(context) {
|
|
|
93450
93472
|
return void 0;
|
|
93451
93473
|
}
|
|
93452
93474
|
if (isExternalModuleImportEqualsDeclaration(node)) {
|
|
93453
|
-
|
|
93454
|
-
|
|
93475
|
+
if (!shouldEmitAliasDeclaration(node)) {
|
|
93476
|
+
return void 0;
|
|
93477
|
+
}
|
|
93478
|
+
return visitEachChild(node, visitor, context);
|
|
93455
93479
|
}
|
|
93456
93480
|
if (!shouldEmitImportEqualsDeclaration(node)) {
|
|
93457
93481
|
return void 0;
|
|
@@ -108818,7 +108842,7 @@ function transformModule(context) {
|
|
|
108818
108842
|
}
|
|
108819
108843
|
const externalModuleName = getExternalModuleNameLiteral(factory2, node, currentSourceFile, host, resolver, compilerOptions);
|
|
108820
108844
|
const firstArgument = visitNode(firstOrUndefined(node.arguments), visitor, isExpression);
|
|
108821
|
-
const argument = externalModuleName && (!firstArgument || !isStringLiteral(firstArgument) || firstArgument.text !== externalModuleName.text) ? externalModuleName : firstArgument;
|
|
108845
|
+
const argument = externalModuleName && (!firstArgument || !isStringLiteral(firstArgument) || firstArgument.text !== externalModuleName.text) ? externalModuleName : rewriteModuleSpecifier(firstArgument, compilerOptions);
|
|
108822
108846
|
const containsLexicalThis = !!(node.transformFlags & 16384 /* ContainsLexicalThis */);
|
|
108823
108847
|
switch (compilerOptions.module) {
|
|
108824
108848
|
case 2 /* AMD */:
|
|
@@ -109149,7 +109173,7 @@ function transformModule(context) {
|
|
|
109149
109173
|
const moduleName = getExternalModuleNameLiteral(factory2, importNode, currentSourceFile, host, resolver, compilerOptions);
|
|
109150
109174
|
const args = [];
|
|
109151
109175
|
if (moduleName) {
|
|
109152
|
-
args.push(moduleName);
|
|
109176
|
+
args.push(rewriteModuleSpecifier(moduleName, compilerOptions));
|
|
109153
109177
|
}
|
|
109154
109178
|
return factory2.createCallExpression(
|
|
109155
109179
|
factory2.createIdentifier("require"),
|
|
@@ -111245,6 +111269,7 @@ function transformECMAScriptModule(context) {
|
|
|
111245
111269
|
context.enableEmitNotification(307 /* SourceFile */);
|
|
111246
111270
|
context.enableSubstitution(80 /* Identifier */);
|
|
111247
111271
|
const noSubstitution = /* @__PURE__ */ new Set();
|
|
111272
|
+
let importCallsToRewrite;
|
|
111248
111273
|
let helperNameSubstitutions;
|
|
111249
111274
|
let currentSourceFile;
|
|
111250
111275
|
let importRequireStatements;
|
|
@@ -111256,6 +111281,7 @@ function transformECMAScriptModule(context) {
|
|
|
111256
111281
|
if (isExternalModule(node) || getIsolatedModules(compilerOptions)) {
|
|
111257
111282
|
currentSourceFile = node;
|
|
111258
111283
|
importRequireStatements = void 0;
|
|
111284
|
+
importCallsToRewrite = compilerOptions.rewriteRelativeImportExtensions ? mapDefined(node.imports, (name) => isImportCall(name.parent) && shouldRewriteModuleSpecifier(name.text, compilerOptions) ? name.parent : void 0) : void 0;
|
|
111259
111285
|
let result = updateExternalModule(node);
|
|
111260
111286
|
currentSourceFile = void 0;
|
|
111261
111287
|
if (importRequireStatements) {
|
|
@@ -111298,14 +111324,50 @@ function transformECMAScriptModule(context) {
|
|
|
111298
111324
|
case 278 /* ExportDeclaration */:
|
|
111299
111325
|
const exportDecl = node;
|
|
111300
111326
|
return visitExportDeclaration(exportDecl);
|
|
111327
|
+
case 272 /* ImportDeclaration */:
|
|
111328
|
+
return visitImportDeclaration(node);
|
|
111329
|
+
case 213 /* CallExpression */:
|
|
111330
|
+
if (node === (importCallsToRewrite == null ? void 0 : importCallsToRewrite[0])) {
|
|
111331
|
+
importCallsToRewrite.shift();
|
|
111332
|
+
return visitImportCall(node);
|
|
111333
|
+
}
|
|
111334
|
+
break;
|
|
111335
|
+
default:
|
|
111336
|
+
if ((importCallsToRewrite == null ? void 0 : importCallsToRewrite.length) && rangeContainsRange(node, importCallsToRewrite[0])) {
|
|
111337
|
+
return visitEachChild(node, visitor, context);
|
|
111338
|
+
}
|
|
111301
111339
|
}
|
|
111302
111340
|
return node;
|
|
111303
111341
|
}
|
|
111342
|
+
function visitImportDeclaration(node) {
|
|
111343
|
+
if (!compilerOptions.rewriteRelativeImportExtensions) {
|
|
111344
|
+
return node;
|
|
111345
|
+
}
|
|
111346
|
+
const updatedModuleSpecifier = rewriteModuleSpecifier(node.moduleSpecifier, compilerOptions);
|
|
111347
|
+
if (updatedModuleSpecifier === node.moduleSpecifier) {
|
|
111348
|
+
return node;
|
|
111349
|
+
}
|
|
111350
|
+
return factory2.updateImportDeclaration(
|
|
111351
|
+
node,
|
|
111352
|
+
node.modifiers,
|
|
111353
|
+
node.importClause,
|
|
111354
|
+
updatedModuleSpecifier,
|
|
111355
|
+
node.attributes
|
|
111356
|
+
);
|
|
111357
|
+
}
|
|
111358
|
+
function visitImportCall(node) {
|
|
111359
|
+
return factory2.updateCallExpression(
|
|
111360
|
+
node,
|
|
111361
|
+
node.expression,
|
|
111362
|
+
node.typeArguments,
|
|
111363
|
+
[rewriteModuleSpecifier(node.arguments[0], compilerOptions), ...node.arguments.slice(1)]
|
|
111364
|
+
);
|
|
111365
|
+
}
|
|
111304
111366
|
function createRequireCall(importNode) {
|
|
111305
111367
|
const moduleName = getExternalModuleNameLiteral(factory2, importNode, Debug.checkDefined(currentSourceFile), host, resolver, compilerOptions);
|
|
111306
111368
|
const args = [];
|
|
111307
111369
|
if (moduleName) {
|
|
111308
|
-
args.push(moduleName);
|
|
111370
|
+
args.push(rewriteModuleSpecifier(moduleName, compilerOptions));
|
|
111309
111371
|
}
|
|
111310
111372
|
if (getEmitModuleKind(compilerOptions) === 200 /* Preserve */) {
|
|
111311
111373
|
return factory2.createCallExpression(
|
|
@@ -111450,11 +111512,16 @@ function transformECMAScriptModule(context) {
|
|
|
111450
111512
|
return node;
|
|
111451
111513
|
}
|
|
111452
111514
|
function visitExportDeclaration(node) {
|
|
111453
|
-
|
|
111454
|
-
|
|
111455
|
-
|
|
111456
|
-
|
|
111457
|
-
|
|
111515
|
+
const updatedModuleSpecifier = rewriteModuleSpecifier(node.moduleSpecifier, compilerOptions);
|
|
111516
|
+
if (compilerOptions.module !== void 0 && compilerOptions.module > 5 /* ES2015 */ || !node.exportClause || !isNamespaceExport(node.exportClause) || !node.moduleSpecifier) {
|
|
111517
|
+
return !node.moduleSpecifier || updatedModuleSpecifier === node.moduleSpecifier ? node : factory2.updateExportDeclaration(
|
|
111518
|
+
node,
|
|
111519
|
+
node.modifiers,
|
|
111520
|
+
node.isTypeOnly,
|
|
111521
|
+
node.exportClause,
|
|
111522
|
+
updatedModuleSpecifier,
|
|
111523
|
+
node.attributes
|
|
111524
|
+
);
|
|
111458
111525
|
}
|
|
111459
111526
|
const oldIdentifier = node.exportClause.name;
|
|
111460
111527
|
const synthName = factory2.getGeneratedNameForNode(oldIdentifier);
|
|
@@ -111470,7 +111537,7 @@ function transformECMAScriptModule(context) {
|
|
|
111470
111537
|
synthName
|
|
111471
111538
|
)
|
|
111472
111539
|
),
|
|
111473
|
-
|
|
111540
|
+
updatedModuleSpecifier,
|
|
111474
111541
|
node.attributes
|
|
111475
111542
|
);
|
|
111476
111543
|
setOriginalNode(importDecl, node.exportClause);
|
|
@@ -112616,7 +112683,7 @@ function transformDeclarations(context) {
|
|
|
112616
112683
|
}
|
|
112617
112684
|
return setCommentRange(updated, getCommentRange(original));
|
|
112618
112685
|
}
|
|
112619
|
-
function
|
|
112686
|
+
function rewriteModuleSpecifier2(parent, input) {
|
|
112620
112687
|
if (!input) return void 0;
|
|
112621
112688
|
resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== 267 /* ModuleDeclaration */ && parent.kind !== 205 /* ImportType */;
|
|
112622
112689
|
if (isStringLiteralLike(input)) {
|
|
@@ -112638,7 +112705,7 @@ function transformDeclarations(context) {
|
|
|
112638
112705
|
decl.modifiers,
|
|
112639
112706
|
decl.isTypeOnly,
|
|
112640
112707
|
decl.name,
|
|
112641
|
-
factory2.updateExternalModuleReference(decl.moduleReference,
|
|
112708
|
+
factory2.updateExternalModuleReference(decl.moduleReference, rewriteModuleSpecifier2(decl, specifier))
|
|
112642
112709
|
);
|
|
112643
112710
|
} else {
|
|
112644
112711
|
const oldDiag = getSymbolAccessibilityDiagnostic;
|
|
@@ -112654,7 +112721,7 @@ function transformDeclarations(context) {
|
|
|
112654
112721
|
decl,
|
|
112655
112722
|
decl.modifiers,
|
|
112656
112723
|
decl.importClause,
|
|
112657
|
-
|
|
112724
|
+
rewriteModuleSpecifier2(decl, decl.moduleSpecifier),
|
|
112658
112725
|
tryGetResolutionModeOverride(decl.attributes)
|
|
112659
112726
|
);
|
|
112660
112727
|
}
|
|
@@ -112670,7 +112737,7 @@ function transformDeclarations(context) {
|
|
|
112670
112737
|
/*namedBindings*/
|
|
112671
112738
|
void 0
|
|
112672
112739
|
),
|
|
112673
|
-
|
|
112740
|
+
rewriteModuleSpecifier2(decl, decl.moduleSpecifier),
|
|
112674
112741
|
tryGetResolutionModeOverride(decl.attributes)
|
|
112675
112742
|
);
|
|
112676
112743
|
}
|
|
@@ -112688,7 +112755,7 @@ function transformDeclarations(context) {
|
|
|
112688
112755
|
visibleDefaultBinding,
|
|
112689
112756
|
namedBindings
|
|
112690
112757
|
),
|
|
112691
|
-
|
|
112758
|
+
rewriteModuleSpecifier2(decl, decl.moduleSpecifier),
|
|
112692
112759
|
tryGetResolutionModeOverride(decl.attributes)
|
|
112693
112760
|
) : void 0;
|
|
112694
112761
|
}
|
|
@@ -112703,7 +112770,7 @@ function transformDeclarations(context) {
|
|
|
112703
112770
|
visibleDefaultBinding,
|
|
112704
112771
|
bindingList && bindingList.length ? factory2.updateNamedImports(decl.importClause.namedBindings, bindingList) : void 0
|
|
112705
112772
|
),
|
|
112706
|
-
|
|
112773
|
+
rewriteModuleSpecifier2(decl, decl.moduleSpecifier),
|
|
112707
112774
|
tryGetResolutionModeOverride(decl.attributes)
|
|
112708
112775
|
);
|
|
112709
112776
|
}
|
|
@@ -112716,7 +112783,7 @@ function transformDeclarations(context) {
|
|
|
112716
112783
|
decl.modifiers,
|
|
112717
112784
|
/*importClause*/
|
|
112718
112785
|
void 0,
|
|
112719
|
-
|
|
112786
|
+
rewriteModuleSpecifier2(decl, decl.moduleSpecifier),
|
|
112720
112787
|
tryGetResolutionModeOverride(decl.attributes)
|
|
112721
112788
|
);
|
|
112722
112789
|
}
|
|
@@ -113030,7 +113097,7 @@ function transformDeclarations(context) {
|
|
|
113030
113097
|
if (!isLiteralImportTypeNode(input)) return cleanup(input);
|
|
113031
113098
|
return cleanup(factory2.updateImportTypeNode(
|
|
113032
113099
|
input,
|
|
113033
|
-
factory2.updateLiteralTypeNode(input.argument,
|
|
113100
|
+
factory2.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier2(input, input.argument.literal)),
|
|
113034
113101
|
input.attributes,
|
|
113035
113102
|
input.qualifier,
|
|
113036
113103
|
visitNodes2(input.typeArguments, visitDeclarationSubtree, isTypeNode),
|
|
@@ -113083,7 +113150,7 @@ function transformDeclarations(context) {
|
|
|
113083
113150
|
input.modifiers,
|
|
113084
113151
|
input.isTypeOnly,
|
|
113085
113152
|
input.exportClause,
|
|
113086
|
-
|
|
113153
|
+
rewriteModuleSpecifier2(input, input.moduleSpecifier),
|
|
113087
113154
|
tryGetResolutionModeOverride(input.attributes)
|
|
113088
113155
|
);
|
|
113089
113156
|
}
|
|
@@ -113333,7 +113400,7 @@ function transformDeclarations(context) {
|
|
|
113333
113400
|
return cleanup(updateModuleDeclarationAndKeyword(
|
|
113334
113401
|
input,
|
|
113335
113402
|
mods,
|
|
113336
|
-
isExternalModuleAugmentation(input) ?
|
|
113403
|
+
isExternalModuleAugmentation(input) ? rewriteModuleSpecifier2(input, input.name) : input.name,
|
|
113337
113404
|
body
|
|
113338
113405
|
));
|
|
113339
113406
|
} else {
|
|
@@ -122889,7 +122956,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
122889
122956
|
createDiagnosticForOptionName(Diagnostics.Option_verbatimModuleSyntax_cannot_be_used_when_module_is_set_to_UMD_AMD_or_System, "verbatimModuleSyntax");
|
|
122890
122957
|
}
|
|
122891
122958
|
}
|
|
122892
|
-
if (options.allowImportingTsExtensions && !(options.noEmit || options.emitDeclarationOnly)) {
|
|
122959
|
+
if (options.allowImportingTsExtensions && !(options.noEmit || options.emitDeclarationOnly || options.rewriteRelativeImportExtensions)) {
|
|
122893
122960
|
createOptionValueDiagnostic("allowImportingTsExtensions", Diagnostics.Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set);
|
|
122894
122961
|
}
|
|
122895
122962
|
const moduleResolution = getEmitModuleResolutionKind(options);
|
package/lib/typescript.d.ts
CHANGED
|
@@ -7023,6 +7023,7 @@ declare namespace ts {
|
|
|
7023
7023
|
removeComments?: boolean;
|
|
7024
7024
|
resolvePackageJsonExports?: boolean;
|
|
7025
7025
|
resolvePackageJsonImports?: boolean;
|
|
7026
|
+
rewriteRelativeImportExtensions?: boolean;
|
|
7026
7027
|
rootDir?: string;
|
|
7027
7028
|
rootDirs?: string[];
|
|
7028
7029
|
skipLibCheck?: boolean;
|
|
@@ -8697,6 +8698,7 @@ declare namespace ts {
|
|
|
8697
8698
|
function isTypeOnlyImportDeclaration(node: Node): node is TypeOnlyImportDeclaration;
|
|
8698
8699
|
function isTypeOnlyExportDeclaration(node: Node): node is TypeOnlyExportDeclaration;
|
|
8699
8700
|
function isTypeOnlyImportOrExportDeclaration(node: Node): node is TypeOnlyAliasDeclaration;
|
|
8701
|
+
function isPartOfTypeOnlyImportOrExportDeclaration(node: Node): boolean;
|
|
8700
8702
|
function isStringTextContainingNode(node: Node): node is StringLiteral | TemplateLiteralToken;
|
|
8701
8703
|
function isImportAttributeName(node: Node): node is ImportAttributeName;
|
|
8702
8704
|
function isModifier(node: Node): node is Modifier;
|
|
@@ -9405,6 +9407,7 @@ declare namespace ts {
|
|
|
9405
9407
|
* @param context A lexical environment context for the visitor.
|
|
9406
9408
|
*/
|
|
9407
9409
|
function visitEachChild<T extends Node>(node: T | undefined, visitor: Visitor, context: TransformationContext | undefined, nodesVisitor?: typeof visitNodes, tokenVisitor?: Visitor): T | undefined;
|
|
9410
|
+
function rewriteModuleSpecifier(node: Expression | undefined, compilerOptions: CompilerOptions): Expression | undefined;
|
|
9408
9411
|
function getTsBuildInfoEmitOutputFilePath(options: CompilerOptions): string | undefined;
|
|
9409
9412
|
function getOutputFileNames(commandLine: ParsedCommandLine, inputFileName: string, ignoreCase: boolean): readonly string[];
|
|
9410
9413
|
function createPrinter(printerOptions?: PrinterOptions, handlers?: PrintHandlers): Printer;
|
package/lib/typescript.js
CHANGED
|
@@ -635,6 +635,7 @@ __export(typescript_exports, {
|
|
|
635
635
|
getAllKeys: () => getAllKeys,
|
|
636
636
|
getAllProjectOutputs: () => getAllProjectOutputs,
|
|
637
637
|
getAllSuperTypeNodes: () => getAllSuperTypeNodes,
|
|
638
|
+
getAllowImportingTsExtensions: () => getAllowImportingTsExtensions,
|
|
638
639
|
getAllowJSCompilerOption: () => getAllowJSCompilerOption,
|
|
639
640
|
getAllowSyntheticDefaultImports: () => getAllowSyntheticDefaultImports,
|
|
640
641
|
getAncestor: () => getAncestor,
|
|
@@ -1622,6 +1623,7 @@ __export(typescript_exports, {
|
|
|
1622
1623
|
isParseTreeNode: () => isParseTreeNode,
|
|
1623
1624
|
isPartOfParameterDeclaration: () => isPartOfParameterDeclaration,
|
|
1624
1625
|
isPartOfTypeNode: () => isPartOfTypeNode,
|
|
1626
|
+
isPartOfTypeOnlyImportOrExportDeclaration: () => isPartOfTypeOnlyImportOrExportDeclaration,
|
|
1625
1627
|
isPartOfTypeQuery: () => isPartOfTypeQuery,
|
|
1626
1628
|
isPartiallyEmittedExpression: () => isPartiallyEmittedExpression,
|
|
1627
1629
|
isPatternMatch: () => isPatternMatch,
|
|
@@ -2019,6 +2021,7 @@ __export(typescript_exports, {
|
|
|
2019
2021
|
returnTrue: () => returnTrue,
|
|
2020
2022
|
returnUndefined: () => returnUndefined,
|
|
2021
2023
|
returnsPromise: () => returnsPromise,
|
|
2024
|
+
rewriteModuleSpecifier: () => rewriteModuleSpecifier,
|
|
2022
2025
|
sameFlatMap: () => sameFlatMap,
|
|
2023
2026
|
sameMap: () => sameMap,
|
|
2024
2027
|
sameMapping: () => sameMapping,
|
|
@@ -2064,6 +2067,7 @@ __export(typescript_exports, {
|
|
|
2064
2067
|
setValueDeclaration: () => setValueDeclaration,
|
|
2065
2068
|
shouldAllowImportingTsExtension: () => shouldAllowImportingTsExtension,
|
|
2066
2069
|
shouldPreserveConstEnums: () => shouldPreserveConstEnums,
|
|
2070
|
+
shouldRewriteModuleSpecifier: () => shouldRewriteModuleSpecifier,
|
|
2067
2071
|
shouldUseUriStyleNodeCoreModules: () => shouldUseUriStyleNodeCoreModules,
|
|
2068
2072
|
showModuleSpecifier: () => showModuleSpecifier,
|
|
2069
2073
|
signatureHasRestParameter: () => signatureHasRestParameter,
|
|
@@ -2269,7 +2273,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2269
2273
|
|
|
2270
2274
|
// src/compiler/corePublic.ts
|
|
2271
2275
|
var versionMajorMinor = "5.7";
|
|
2272
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2276
|
+
var version = `${versionMajorMinor}.0-insiders.20240917`;
|
|
2273
2277
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2274
2278
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2275
2279
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -10120,6 +10124,9 @@ var Diagnostics = {
|
|
|
10120
10124
|
This_expression_is_always_nullish: diag(2871, 1 /* Error */, "This_expression_is_always_nullish_2871", "This expression is always nullish."),
|
|
10121
10125
|
This_kind_of_expression_is_always_truthy: diag(2872, 1 /* Error */, "This_kind_of_expression_is_always_truthy_2872", "This kind of expression is always truthy."),
|
|
10122
10126
|
This_kind_of_expression_is_always_falsy: diag(2873, 1 /* Error */, "This_kind_of_expression_is_always_falsy_2873", "This kind of expression is always falsy."),
|
|
10127
|
+
This_relative_import_path_is_unsafe_to_rewrite_because_it_looks_like_a_file_name_but_actually_resolves_to_0: diag(2874, 1 /* Error */, "This_relative_import_path_is_unsafe_to_rewrite_because_it_looks_like_a_file_name_but_actually_resolv_2874", 'This relative import path is unsafe to rewrite because it looks like a file name, but actually resolves to "{0}".'),
|
|
10128
|
+
This_import_uses_a_0_extension_to_resolve_to_an_input_TypeScript_file_but_will_not_be_rewritten_during_emit_because_it_is_not_a_relative_path: diag(2875, 1 /* Error */, "This_import_uses_a_0_extension_to_resolve_to_an_input_TypeScript_file_but_will_not_be_rewritten_duri_2875", "This import uses a '{0}' extension to resolve to an input TypeScript file, but will not be rewritten during emit because it is not a relative path."),
|
|
10129
|
+
This_import_path_is_unsafe_to_rewrite_because_it_resolves_to_another_project_and_the_relative_path_between_the_projects_output_files_is_not_the_same_as_the_relative_path_between_its_input_files: diag(2876, 1 /* Error */, "This_import_path_is_unsafe_to_rewrite_because_it_resolves_to_another_project_and_the_relative_path_b_2876", "This import path is unsafe to rewrite because it resolves to another project, and the relative path between the projects' output files is not the same as the relative path between its input files."),
|
|
10123
10130
|
Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
|
10124
10131
|
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
|
|
10125
10132
|
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
|
|
@@ -10677,6 +10684,7 @@ var Diagnostics = {
|
|
|
10677
10684
|
Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0: diag(6418, 3 /* Message */, "Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0_6418", "Searching all ancestor node_modules directories for fallback extensions: {0}."),
|
|
10678
10685
|
Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_program_needs_to_report_errors: diag(6419, 3 /* Message */, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_program_needs_to_report_errors_6419", "Project '{0}' is out of date because buildinfo file '{1}' indicates that program needs to report errors."),
|
|
10679
10686
|
Project_0_is_out_of_date_because_1: diag(6420, 3 /* Message */, "Project_0_is_out_of_date_because_1_6420", "Project '{0}' is out of date because {1}."),
|
|
10687
|
+
Rewrite_ts_tsx_mts_and_cts_file_extensions_in_relative_import_paths_to_their_JavaScript_equivalent_in_output_files: diag(6421, 3 /* Message */, "Rewrite_ts_tsx_mts_and_cts_file_extensions_in_relative_import_paths_to_their_JavaScript_equivalent_i_6421", "Rewrite '.ts', '.tsx', '.mts', and '.cts' file extensions in relative import paths to their JavaScript equivalent in output files."),
|
|
10680
10688
|
The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, 3 /* Message */, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"),
|
|
10681
10689
|
The_expected_type_comes_from_this_index_signature: diag(6501, 3 /* Message */, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."),
|
|
10682
10690
|
The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, 3 /* Message */, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."),
|
|
@@ -15366,6 +15374,9 @@ function isTypeOnlyExportDeclaration(node) {
|
|
|
15366
15374
|
function isTypeOnlyImportOrExportDeclaration(node) {
|
|
15367
15375
|
return isTypeOnlyImportDeclaration(node) || isTypeOnlyExportDeclaration(node);
|
|
15368
15376
|
}
|
|
15377
|
+
function isPartOfTypeOnlyImportOrExportDeclaration(node) {
|
|
15378
|
+
return findAncestor(node, isTypeOnlyImportOrExportDeclaration) !== void 0;
|
|
15379
|
+
}
|
|
15369
15380
|
function isStringTextContainingNode(node) {
|
|
15370
15381
|
return node.kind === 11 /* StringLiteral */ || isTemplateLiteralKind(node.kind);
|
|
15371
15382
|
}
|
|
@@ -18702,6 +18713,9 @@ function tryGetImportFromModuleSpecifier(node) {
|
|
|
18702
18713
|
return void 0;
|
|
18703
18714
|
}
|
|
18704
18715
|
}
|
|
18716
|
+
function shouldRewriteModuleSpecifier(specifier, compilerOptions) {
|
|
18717
|
+
return !!compilerOptions.rewriteRelativeImportExtensions && pathIsRelative(specifier) && !isDeclarationFileName(specifier);
|
|
18718
|
+
}
|
|
18705
18719
|
function getExternalModuleName(node) {
|
|
18706
18720
|
switch (node.kind) {
|
|
18707
18721
|
case 272 /* ImportDeclaration */:
|
|
@@ -21004,6 +21018,12 @@ function getLinesBetweenPositionAndNextNonWhitespaceCharacter(pos, stopPos, sour
|
|
|
21004
21018
|
);
|
|
21005
21019
|
return getLinesBetweenPositions(sourceFile, pos, Math.min(stopPos, nextPos));
|
|
21006
21020
|
}
|
|
21021
|
+
function rangeContainsRange(r1, r2) {
|
|
21022
|
+
return startEndContainsRange(r1.pos, r1.end, r2);
|
|
21023
|
+
}
|
|
21024
|
+
function startEndContainsRange(start, end, range) {
|
|
21025
|
+
return start <= range.pos && end >= range.end;
|
|
21026
|
+
}
|
|
21007
21027
|
function getPreviousNonWhitespacePosition(pos, stopPos = 0, sourceFile) {
|
|
21008
21028
|
while (pos-- > stopPos) {
|
|
21009
21029
|
if (!isWhiteSpaceLike(sourceFile.text.charCodeAt(pos))) {
|
|
@@ -21669,6 +21689,12 @@ function createComputedCompilerOptions(options) {
|
|
|
21669
21689
|
return options;
|
|
21670
21690
|
}
|
|
21671
21691
|
var _computedOptions = createComputedCompilerOptions({
|
|
21692
|
+
allowImportingTsExtensions: {
|
|
21693
|
+
dependencies: ["rewriteRelativeImportExtensions"],
|
|
21694
|
+
computeValue: (compilerOptions) => {
|
|
21695
|
+
return !!(compilerOptions.allowImportingTsExtensions || compilerOptions.rewriteRelativeImportExtensions);
|
|
21696
|
+
}
|
|
21697
|
+
},
|
|
21672
21698
|
target: {
|
|
21673
21699
|
dependencies: ["module"],
|
|
21674
21700
|
computeValue: (compilerOptions) => {
|
|
@@ -21883,6 +21909,7 @@ var _computedOptions = createComputedCompilerOptions({
|
|
|
21883
21909
|
}
|
|
21884
21910
|
});
|
|
21885
21911
|
var computedOptions = _computedOptions;
|
|
21912
|
+
var getAllowImportingTsExtensions = _computedOptions.allowImportingTsExtensions.computeValue;
|
|
21886
21913
|
var getEmitScriptTarget = _computedOptions.target.computeValue;
|
|
21887
21914
|
var getEmitModuleKind = _computedOptions.module.computeValue;
|
|
21888
21915
|
var getEmitModuleResolutionKind = _computedOptions.moduleResolution.computeValue;
|
|
@@ -41062,6 +41089,15 @@ var commandOptionsWithoutBuild = [
|
|
|
41062
41089
|
defaultValueDescription: false,
|
|
41063
41090
|
transpileOptionValue: void 0
|
|
41064
41091
|
},
|
|
41092
|
+
{
|
|
41093
|
+
name: "rewriteRelativeImportExtensions",
|
|
41094
|
+
type: "boolean",
|
|
41095
|
+
affectsSemanticDiagnostics: true,
|
|
41096
|
+
affectsBuildInfo: true,
|
|
41097
|
+
category: Diagnostics.Modules,
|
|
41098
|
+
description: Diagnostics.Rewrite_ts_tsx_mts_and_cts_file_extensions_in_relative_import_paths_to_their_JavaScript_equivalent_in_output_files,
|
|
41099
|
+
defaultValueDescription: false
|
|
41100
|
+
},
|
|
41065
41101
|
{
|
|
41066
41102
|
name: "resolvePackageJsonExports",
|
|
41067
41103
|
type: "boolean",
|
|
@@ -44810,10 +44846,11 @@ function loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecor
|
|
|
44810
44846
|
}
|
|
44811
44847
|
return tryAddingExtensions(extensionless, extensions, extension, onlyRecordFailures, state);
|
|
44812
44848
|
}
|
|
44813
|
-
function loadFileNameFromPackageJsonField(extensions, candidate, onlyRecordFailures, state) {
|
|
44849
|
+
function loadFileNameFromPackageJsonField(extensions, candidate, packageJsonValue, onlyRecordFailures, state) {
|
|
44814
44850
|
if (extensions & 1 /* TypeScript */ && fileExtensionIsOneOf(candidate, supportedTSImplementationExtensions) || extensions & 4 /* Declaration */ && fileExtensionIsOneOf(candidate, supportedDeclarationExtensions)) {
|
|
44815
44851
|
const result = tryFile(candidate, onlyRecordFailures, state);
|
|
44816
|
-
|
|
44852
|
+
const ext = tryExtractTSExtension(candidate);
|
|
44853
|
+
return result !== void 0 ? { path: candidate, ext, resolvedUsingTsExtension: packageJsonValue ? !endsWith(packageJsonValue, ext) : void 0 } : void 0;
|
|
44817
44854
|
}
|
|
44818
44855
|
if (state.isConfigLookup && extensions === 8 /* Json */ && fileExtensionIs(candidate, ".json" /* Json */)) {
|
|
44819
44856
|
const result = tryFile(candidate, onlyRecordFailures, state);
|
|
@@ -44975,6 +45012,7 @@ function loadEntrypointsFromExportMap(scope, exports2, state, extensions) {
|
|
|
44975
45012
|
const result = loadFileNameFromPackageJsonField(
|
|
44976
45013
|
extensions,
|
|
44977
45014
|
finalPath,
|
|
45015
|
+
target,
|
|
44978
45016
|
/*onlyRecordFailures*/
|
|
44979
45017
|
false,
|
|
44980
45018
|
state
|
|
@@ -45116,7 +45154,14 @@ function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFail
|
|
|
45116
45154
|
}
|
|
45117
45155
|
}
|
|
45118
45156
|
const loader = (extensions2, candidate2, onlyRecordFailures2, state2) => {
|
|
45119
|
-
const fromFile = loadFileNameFromPackageJsonField(
|
|
45157
|
+
const fromFile = loadFileNameFromPackageJsonField(
|
|
45158
|
+
extensions2,
|
|
45159
|
+
candidate2,
|
|
45160
|
+
/*packageJsonValue*/
|
|
45161
|
+
void 0,
|
|
45162
|
+
onlyRecordFailures2,
|
|
45163
|
+
state2
|
|
45164
|
+
);
|
|
45120
45165
|
if (fromFile) {
|
|
45121
45166
|
return noPackageId(fromFile);
|
|
45122
45167
|
}
|
|
@@ -45472,6 +45517,7 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
|
|
|
45472
45517
|
return toSearchResult(withPackageId(scope, loadFileNameFromPackageJsonField(
|
|
45473
45518
|
extensions,
|
|
45474
45519
|
finalPath,
|
|
45520
|
+
target,
|
|
45475
45521
|
/*onlyRecordFailures*/
|
|
45476
45522
|
false,
|
|
45477
45523
|
state
|
|
@@ -45584,6 +45630,8 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
|
|
|
45584
45630
|
return toSearchResult(withPackageId(scope, loadFileNameFromPackageJsonField(
|
|
45585
45631
|
extensions,
|
|
45586
45632
|
possibleInputWithInputExtension,
|
|
45633
|
+
/*packageJsonValue*/
|
|
45634
|
+
void 0,
|
|
45587
45635
|
/*onlyRecordFailures*/
|
|
45588
45636
|
false,
|
|
45589
45637
|
state
|
|
@@ -45946,7 +45994,7 @@ function resolveFromTypeRoot(moduleName, state) {
|
|
|
45946
45994
|
}
|
|
45947
45995
|
}
|
|
45948
45996
|
function shouldAllowImportingTsExtension(compilerOptions, fromFileName) {
|
|
45949
|
-
return
|
|
45997
|
+
return getAllowImportingTsExtensions(compilerOptions) || !!fromFileName && isDeclarationFileName(fromFileName);
|
|
45950
45998
|
}
|
|
45951
45999
|
function loadModuleFromGlobalCache(moduleName, projectName, compilerOptions, host, globalCache, packageJsonInfoCache) {
|
|
45952
46000
|
const traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
@@ -53315,6 +53363,36 @@ function createTypeChecker(host) {
|
|
|
53315
53363
|
const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference));
|
|
53316
53364
|
error2(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension);
|
|
53317
53365
|
}
|
|
53366
|
+
} else if (compilerOptions.rewriteRelativeImportExtensions && !(location.flags & 33554432 /* Ambient */) && !isDeclarationFileName(moduleReference) && !isLiteralImportTypeNode(location) && !isPartOfTypeOnlyImportOrExportDeclaration(location)) {
|
|
53367
|
+
const shouldRewrite = shouldRewriteModuleSpecifier(moduleReference, compilerOptions);
|
|
53368
|
+
if (!resolvedModule.resolvedUsingTsExtension && shouldRewrite) {
|
|
53369
|
+
error2(
|
|
53370
|
+
errorNode,
|
|
53371
|
+
Diagnostics.This_relative_import_path_is_unsafe_to_rewrite_because_it_looks_like_a_file_name_but_actually_resolves_to_0,
|
|
53372
|
+
getRelativePathFromFile(getNormalizedAbsolutePath(currentSourceFile.fileName, host.getCurrentDirectory()), resolvedModule.resolvedFileName, hostGetCanonicalFileName(host))
|
|
53373
|
+
);
|
|
53374
|
+
} else if (resolvedModule.resolvedUsingTsExtension && !shouldRewrite && sourceFileMayBeEmitted(sourceFile, host)) {
|
|
53375
|
+
error2(
|
|
53376
|
+
errorNode,
|
|
53377
|
+
Diagnostics.This_import_uses_a_0_extension_to_resolve_to_an_input_TypeScript_file_but_will_not_be_rewritten_during_emit_because_it_is_not_a_relative_path,
|
|
53378
|
+
getAnyExtensionFromPath(moduleReference)
|
|
53379
|
+
);
|
|
53380
|
+
} else if (resolvedModule.resolvedUsingTsExtension && shouldRewrite) {
|
|
53381
|
+
const redirect = host.getResolvedProjectReferenceToRedirect(sourceFile.path);
|
|
53382
|
+
if (redirect) {
|
|
53383
|
+
const ignoreCase = !host.useCaseSensitiveFileNames();
|
|
53384
|
+
const ownRootDir = host.getCommonSourceDirectory();
|
|
53385
|
+
const otherRootDir = getCommonSourceDirectoryOfConfig(redirect.commandLine, ignoreCase);
|
|
53386
|
+
const rootDirPath = getRelativePathFromDirectory(ownRootDir, otherRootDir, ignoreCase);
|
|
53387
|
+
const outDirPath = getRelativePathFromDirectory(compilerOptions.outDir || ownRootDir, redirect.commandLine.options.outDir || otherRootDir, ignoreCase);
|
|
53388
|
+
if (rootDirPath !== outDirPath) {
|
|
53389
|
+
error2(
|
|
53390
|
+
errorNode,
|
|
53391
|
+
Diagnostics.This_import_path_is_unsafe_to_rewrite_because_it_resolves_to_another_project_and_the_relative_path_between_the_projects_output_files_is_not_the_same_as_the_relative_path_between_its_input_files
|
|
53392
|
+
);
|
|
53393
|
+
}
|
|
53394
|
+
}
|
|
53395
|
+
}
|
|
53318
53396
|
}
|
|
53319
53397
|
if (sourceFile.symbol) {
|
|
53320
53398
|
if (errorNode && resolvedModule.isExternalLibraryImport && !resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
|
|
@@ -57126,7 +57204,7 @@ function createTypeChecker(host) {
|
|
|
57126
57204
|
}
|
|
57127
57205
|
return factory.updateImportTypeNode(
|
|
57128
57206
|
node,
|
|
57129
|
-
factory.updateLiteralTypeNode(node.argument,
|
|
57207
|
+
factory.updateLiteralTypeNode(node.argument, rewriteModuleSpecifier2(node, node.argument.literal)),
|
|
57130
57208
|
visitNode(node.attributes, visitExistingNodeTreeSymbols, isImportAttributes),
|
|
57131
57209
|
visitNode(node.qualifier, visitExistingNodeTreeSymbols, isEntityName),
|
|
57132
57210
|
visitNodes2(node.typeArguments, visitExistingNodeTreeSymbols, isTypeNode),
|
|
@@ -57280,7 +57358,7 @@ function createTypeChecker(host) {
|
|
|
57280
57358
|
function getNameForJSDocFunctionParameter(p, index) {
|
|
57281
57359
|
return p.name && isIdentifier(p.name) && p.name.escapedText === "this" ? "this" : getEffectiveDotDotDotForParameter(p) ? `args` : `arg${index}`;
|
|
57282
57360
|
}
|
|
57283
|
-
function
|
|
57361
|
+
function rewriteModuleSpecifier2(parent2, lit) {
|
|
57284
57362
|
if (context.bundled || context.enclosingFile !== getSourceFileOfNode(lit)) {
|
|
57285
57363
|
let name = lit.text;
|
|
57286
57364
|
const nodeSymbol = getNodeLinks(node).resolvedSymbol;
|
|
@@ -71544,8 +71622,7 @@ function createTypeChecker(host) {
|
|
|
71544
71622
|
priority: void 0,
|
|
71545
71623
|
topLevel: true,
|
|
71546
71624
|
isFixed: false,
|
|
71547
|
-
impliedArity: void 0
|
|
71548
|
-
indexes: void 0
|
|
71625
|
+
impliedArity: void 0
|
|
71549
71626
|
};
|
|
71550
71627
|
}
|
|
71551
71628
|
function cloneInferenceInfo(inference) {
|
|
@@ -71557,8 +71634,7 @@ function createTypeChecker(host) {
|
|
|
71557
71634
|
priority: inference.priority,
|
|
71558
71635
|
topLevel: inference.topLevel,
|
|
71559
71636
|
isFixed: inference.isFixed,
|
|
71560
|
-
impliedArity: inference.impliedArity
|
|
71561
|
-
indexes: inference.indexes && inference.indexes.slice()
|
|
71637
|
+
impliedArity: inference.impliedArity
|
|
71562
71638
|
};
|
|
71563
71639
|
}
|
|
71564
71640
|
function cloneInferredPartOfContext(context) {
|
|
@@ -71676,7 +71752,7 @@ function createTypeChecker(host) {
|
|
|
71676
71752
|
const templateType = getTemplateTypeFromMappedType(target);
|
|
71677
71753
|
const inference = createInferenceInfo(typeParameter);
|
|
71678
71754
|
inferTypes([inference], sourceType, templateType);
|
|
71679
|
-
return getTypeFromInference(inference) ||
|
|
71755
|
+
return getTypeFromInference(inference) || unknownType;
|
|
71680
71756
|
}
|
|
71681
71757
|
function inferReverseMappedType(source, target, constraint) {
|
|
71682
71758
|
const cacheKey = source.id + "," + target.id + "," + constraint.id;
|
|
@@ -72023,24 +72099,6 @@ function createTypeChecker(host) {
|
|
|
72023
72099
|
} else if (source.flags & 8388608 /* IndexedAccess */ && target.flags & 8388608 /* IndexedAccess */) {
|
|
72024
72100
|
inferFromTypes(source.objectType, target.objectType);
|
|
72025
72101
|
inferFromTypes(source.indexType, target.indexType);
|
|
72026
|
-
} else if (!(priority & 1 /* NakedTypeVariable */) && target.flags & 8388608 /* IndexedAccess */) {
|
|
72027
|
-
if (isFromInferenceBlockedSource(source)) {
|
|
72028
|
-
return;
|
|
72029
|
-
}
|
|
72030
|
-
const inference = getInferenceInfoForType(getActualTypeVariable(target.objectType));
|
|
72031
|
-
if (inference) {
|
|
72032
|
-
if (getObjectFlags(source) & 262144 /* NonInferrableType */ || source === nonInferrableAnyType) {
|
|
72033
|
-
return;
|
|
72034
|
-
}
|
|
72035
|
-
if (!inference.isFixed) {
|
|
72036
|
-
const inferenceTypeSymbol = getGlobalSymbol("PartialInference", 788968 /* Type */, Diagnostics.Cannot_find_global_type_0);
|
|
72037
|
-
const inferenceType = inferenceTypeSymbol && getDeclaredTypeOfSymbol(inferenceTypeSymbol);
|
|
72038
|
-
if (inferenceType && inferenceType !== unknownType) {
|
|
72039
|
-
const mapper = createTypeMapper(getSymbolLinks(inferenceTypeSymbol).typeParameters, [source, target.indexType]);
|
|
72040
|
-
inference.indexes = append(inference.indexes, instantiateType(inferenceType, mapper));
|
|
72041
|
-
}
|
|
72042
|
-
}
|
|
72043
|
-
}
|
|
72044
72102
|
} else if (source.flags & 268435456 /* StringMapping */ && target.flags & 268435456 /* StringMapping */) {
|
|
72045
72103
|
if (source.symbol === target.symbol) {
|
|
72046
72104
|
inferFromTypes(source.type, target.type);
|
|
@@ -72544,51 +72602,6 @@ function createTypeChecker(host) {
|
|
|
72544
72602
|
const preferCovariantType = inferredCovariantType && (!inferredContravariantType || !(inferredCovariantType.flags & (131072 /* Never */ | 1 /* Any */)) && some(inference.contraCandidates, (t) => isTypeAssignableTo(inferredCovariantType, t)) && every(context.inferences, (other) => other !== inference && getConstraintOfTypeParameter(other.typeParameter) !== inference.typeParameter || every(other.candidates, (t) => isTypeAssignableTo(t, inferredCovariantType))));
|
|
72545
72603
|
inferredType = preferCovariantType ? inferredCovariantType : inferredContravariantType;
|
|
72546
72604
|
fallbackType = preferCovariantType ? inferredContravariantType : inferredCovariantType;
|
|
72547
|
-
} else if (inference.indexes) {
|
|
72548
|
-
let aggregateInference = getIntersectionType(inference.indexes);
|
|
72549
|
-
const constraint2 = getConstraintOfTypeParameter(inference.typeParameter);
|
|
72550
|
-
if (constraint2) {
|
|
72551
|
-
const instantiatedConstraint = instantiateType(constraint2, context.nonFixingMapper);
|
|
72552
|
-
if (instantiatedConstraint.flags & 1048576 /* Union */ && !context.compareTypes(aggregateInference, getTypeWithThisArgument(instantiatedConstraint, aggregateInference))) {
|
|
72553
|
-
const discriminantProps = findDiscriminantProperties(getPropertiesOfType(aggregateInference), instantiatedConstraint);
|
|
72554
|
-
if (discriminantProps) {
|
|
72555
|
-
let match;
|
|
72556
|
-
findDiscriminant:
|
|
72557
|
-
for (const p of discriminantProps) {
|
|
72558
|
-
const candidatePropType = getTypeOfPropertyOfType(aggregateInference, p.escapedName);
|
|
72559
|
-
for (const type of instantiatedConstraint.types) {
|
|
72560
|
-
const propType = getTypeOfPropertyOfType(type, p.escapedName);
|
|
72561
|
-
if (propType && candidatePropType && checkTypeAssignableTo(
|
|
72562
|
-
candidatePropType,
|
|
72563
|
-
propType,
|
|
72564
|
-
/*errorNode*/
|
|
72565
|
-
void 0
|
|
72566
|
-
)) {
|
|
72567
|
-
if (match && match !== type) {
|
|
72568
|
-
match = void 0;
|
|
72569
|
-
break findDiscriminant;
|
|
72570
|
-
} else {
|
|
72571
|
-
match = type;
|
|
72572
|
-
}
|
|
72573
|
-
}
|
|
72574
|
-
}
|
|
72575
|
-
}
|
|
72576
|
-
if (match) {
|
|
72577
|
-
aggregateInference = getSpreadType(
|
|
72578
|
-
match,
|
|
72579
|
-
aggregateInference,
|
|
72580
|
-
/*symbol*/
|
|
72581
|
-
void 0,
|
|
72582
|
-
/*propegatedFlags*/
|
|
72583
|
-
0,
|
|
72584
|
-
/*readonly*/
|
|
72585
|
-
false
|
|
72586
|
-
);
|
|
72587
|
-
}
|
|
72588
|
-
}
|
|
72589
|
-
}
|
|
72590
|
-
}
|
|
72591
|
-
inferredType = aggregateInference;
|
|
72592
72605
|
} else if (context.flags & 1 /* NoDefault */) {
|
|
72593
72606
|
inferredType = silentNeverType;
|
|
72594
72607
|
} else {
|
|
@@ -93419,7 +93432,7 @@ function createBasicNodeBuilderModuleSpecifierResolutionHost(host) {
|
|
|
93419
93432
|
var _a;
|
|
93420
93433
|
return (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host);
|
|
93421
93434
|
},
|
|
93422
|
-
useCaseSensitiveFileNames:
|
|
93435
|
+
useCaseSensitiveFileNames: () => host.useCaseSensitiveFileNames(),
|
|
93423
93436
|
redirectTargetsMap: host.redirectTargetsMap,
|
|
93424
93437
|
getProjectReferenceRedirect: (fileName) => host.getProjectReferenceRedirect(fileName),
|
|
93425
93438
|
isSourceOfProjectReferenceRedirect: (fileName) => host.isSourceOfProjectReferenceRedirect(fileName),
|
|
@@ -95858,6 +95871,13 @@ function isSimpleParameter(node) {
|
|
|
95858
95871
|
function isSimpleParameterList(nodes) {
|
|
95859
95872
|
return every(nodes, isSimpleParameter);
|
|
95860
95873
|
}
|
|
95874
|
+
function rewriteModuleSpecifier(node, compilerOptions) {
|
|
95875
|
+
if (!node || !isStringLiteral(node) || !shouldRewriteModuleSpecifier(node.text, compilerOptions)) {
|
|
95876
|
+
return node;
|
|
95877
|
+
}
|
|
95878
|
+
const updatedText = changeExtension(node.text, getOutputExtension(node.text, compilerOptions));
|
|
95879
|
+
return updatedText !== node.text ? setOriginalNode(setTextRange(factory.createStringLiteral(updatedText, node.singleQuote), node), node) : node;
|
|
95880
|
+
}
|
|
95861
95881
|
|
|
95862
95882
|
// src/compiler/transformers/destructuring.ts
|
|
95863
95883
|
var FlattenLevel = /* @__PURE__ */ ((FlattenLevel2) => {
|
|
@@ -98186,7 +98206,14 @@ function transformTypeScript(context) {
|
|
|
98186
98206
|
return void 0;
|
|
98187
98207
|
}
|
|
98188
98208
|
if (!node.exportClause || isNamespaceExport(node.exportClause)) {
|
|
98189
|
-
return
|
|
98209
|
+
return factory2.updateExportDeclaration(
|
|
98210
|
+
node,
|
|
98211
|
+
node.modifiers,
|
|
98212
|
+
node.isTypeOnly,
|
|
98213
|
+
node.exportClause,
|
|
98214
|
+
node.moduleSpecifier,
|
|
98215
|
+
node.attributes
|
|
98216
|
+
);
|
|
98190
98217
|
}
|
|
98191
98218
|
const allowEmpty = !!compilerOptions.verbatimModuleSyntax;
|
|
98192
98219
|
const exportClause = visitNode(
|
|
@@ -98225,8 +98252,10 @@ function transformTypeScript(context) {
|
|
|
98225
98252
|
return void 0;
|
|
98226
98253
|
}
|
|
98227
98254
|
if (isExternalModuleImportEqualsDeclaration(node)) {
|
|
98228
|
-
|
|
98229
|
-
|
|
98255
|
+
if (!shouldEmitAliasDeclaration(node)) {
|
|
98256
|
+
return void 0;
|
|
98257
|
+
}
|
|
98258
|
+
return visitEachChild(node, visitor, context);
|
|
98230
98259
|
}
|
|
98231
98260
|
if (!shouldEmitImportEqualsDeclaration(node)) {
|
|
98232
98261
|
return void 0;
|
|
@@ -113593,7 +113622,7 @@ function transformModule(context) {
|
|
|
113593
113622
|
}
|
|
113594
113623
|
const externalModuleName = getExternalModuleNameLiteral(factory2, node, currentSourceFile, host, resolver, compilerOptions);
|
|
113595
113624
|
const firstArgument = visitNode(firstOrUndefined(node.arguments), visitor, isExpression);
|
|
113596
|
-
const argument = externalModuleName && (!firstArgument || !isStringLiteral(firstArgument) || firstArgument.text !== externalModuleName.text) ? externalModuleName : firstArgument;
|
|
113625
|
+
const argument = externalModuleName && (!firstArgument || !isStringLiteral(firstArgument) || firstArgument.text !== externalModuleName.text) ? externalModuleName : rewriteModuleSpecifier(firstArgument, compilerOptions);
|
|
113597
113626
|
const containsLexicalThis = !!(node.transformFlags & 16384 /* ContainsLexicalThis */);
|
|
113598
113627
|
switch (compilerOptions.module) {
|
|
113599
113628
|
case 2 /* AMD */:
|
|
@@ -113924,7 +113953,7 @@ function transformModule(context) {
|
|
|
113924
113953
|
const moduleName = getExternalModuleNameLiteral(factory2, importNode, currentSourceFile, host, resolver, compilerOptions);
|
|
113925
113954
|
const args = [];
|
|
113926
113955
|
if (moduleName) {
|
|
113927
|
-
args.push(moduleName);
|
|
113956
|
+
args.push(rewriteModuleSpecifier(moduleName, compilerOptions));
|
|
113928
113957
|
}
|
|
113929
113958
|
return factory2.createCallExpression(
|
|
113930
113959
|
factory2.createIdentifier("require"),
|
|
@@ -116020,6 +116049,7 @@ function transformECMAScriptModule(context) {
|
|
|
116020
116049
|
context.enableEmitNotification(307 /* SourceFile */);
|
|
116021
116050
|
context.enableSubstitution(80 /* Identifier */);
|
|
116022
116051
|
const noSubstitution = /* @__PURE__ */ new Set();
|
|
116052
|
+
let importCallsToRewrite;
|
|
116023
116053
|
let helperNameSubstitutions;
|
|
116024
116054
|
let currentSourceFile;
|
|
116025
116055
|
let importRequireStatements;
|
|
@@ -116031,6 +116061,7 @@ function transformECMAScriptModule(context) {
|
|
|
116031
116061
|
if (isExternalModule(node) || getIsolatedModules(compilerOptions)) {
|
|
116032
116062
|
currentSourceFile = node;
|
|
116033
116063
|
importRequireStatements = void 0;
|
|
116064
|
+
importCallsToRewrite = compilerOptions.rewriteRelativeImportExtensions ? mapDefined(node.imports, (name) => isImportCall(name.parent) && shouldRewriteModuleSpecifier(name.text, compilerOptions) ? name.parent : void 0) : void 0;
|
|
116034
116065
|
let result = updateExternalModule(node);
|
|
116035
116066
|
currentSourceFile = void 0;
|
|
116036
116067
|
if (importRequireStatements) {
|
|
@@ -116073,14 +116104,50 @@ function transformECMAScriptModule(context) {
|
|
|
116073
116104
|
case 278 /* ExportDeclaration */:
|
|
116074
116105
|
const exportDecl = node;
|
|
116075
116106
|
return visitExportDeclaration(exportDecl);
|
|
116107
|
+
case 272 /* ImportDeclaration */:
|
|
116108
|
+
return visitImportDeclaration(node);
|
|
116109
|
+
case 213 /* CallExpression */:
|
|
116110
|
+
if (node === (importCallsToRewrite == null ? void 0 : importCallsToRewrite[0])) {
|
|
116111
|
+
importCallsToRewrite.shift();
|
|
116112
|
+
return visitImportCall(node);
|
|
116113
|
+
}
|
|
116114
|
+
break;
|
|
116115
|
+
default:
|
|
116116
|
+
if ((importCallsToRewrite == null ? void 0 : importCallsToRewrite.length) && rangeContainsRange(node, importCallsToRewrite[0])) {
|
|
116117
|
+
return visitEachChild(node, visitor, context);
|
|
116118
|
+
}
|
|
116076
116119
|
}
|
|
116077
116120
|
return node;
|
|
116078
116121
|
}
|
|
116122
|
+
function visitImportDeclaration(node) {
|
|
116123
|
+
if (!compilerOptions.rewriteRelativeImportExtensions) {
|
|
116124
|
+
return node;
|
|
116125
|
+
}
|
|
116126
|
+
const updatedModuleSpecifier = rewriteModuleSpecifier(node.moduleSpecifier, compilerOptions);
|
|
116127
|
+
if (updatedModuleSpecifier === node.moduleSpecifier) {
|
|
116128
|
+
return node;
|
|
116129
|
+
}
|
|
116130
|
+
return factory2.updateImportDeclaration(
|
|
116131
|
+
node,
|
|
116132
|
+
node.modifiers,
|
|
116133
|
+
node.importClause,
|
|
116134
|
+
updatedModuleSpecifier,
|
|
116135
|
+
node.attributes
|
|
116136
|
+
);
|
|
116137
|
+
}
|
|
116138
|
+
function visitImportCall(node) {
|
|
116139
|
+
return factory2.updateCallExpression(
|
|
116140
|
+
node,
|
|
116141
|
+
node.expression,
|
|
116142
|
+
node.typeArguments,
|
|
116143
|
+
[rewriteModuleSpecifier(node.arguments[0], compilerOptions), ...node.arguments.slice(1)]
|
|
116144
|
+
);
|
|
116145
|
+
}
|
|
116079
116146
|
function createRequireCall2(importNode) {
|
|
116080
116147
|
const moduleName = getExternalModuleNameLiteral(factory2, importNode, Debug.checkDefined(currentSourceFile), host, resolver, compilerOptions);
|
|
116081
116148
|
const args = [];
|
|
116082
116149
|
if (moduleName) {
|
|
116083
|
-
args.push(moduleName);
|
|
116150
|
+
args.push(rewriteModuleSpecifier(moduleName, compilerOptions));
|
|
116084
116151
|
}
|
|
116085
116152
|
if (getEmitModuleKind(compilerOptions) === 200 /* Preserve */) {
|
|
116086
116153
|
return factory2.createCallExpression(
|
|
@@ -116225,11 +116292,16 @@ function transformECMAScriptModule(context) {
|
|
|
116225
116292
|
return node;
|
|
116226
116293
|
}
|
|
116227
116294
|
function visitExportDeclaration(node) {
|
|
116228
|
-
|
|
116229
|
-
|
|
116230
|
-
|
|
116231
|
-
|
|
116232
|
-
|
|
116295
|
+
const updatedModuleSpecifier = rewriteModuleSpecifier(node.moduleSpecifier, compilerOptions);
|
|
116296
|
+
if (compilerOptions.module !== void 0 && compilerOptions.module > 5 /* ES2015 */ || !node.exportClause || !isNamespaceExport(node.exportClause) || !node.moduleSpecifier) {
|
|
116297
|
+
return !node.moduleSpecifier || updatedModuleSpecifier === node.moduleSpecifier ? node : factory2.updateExportDeclaration(
|
|
116298
|
+
node,
|
|
116299
|
+
node.modifiers,
|
|
116300
|
+
node.isTypeOnly,
|
|
116301
|
+
node.exportClause,
|
|
116302
|
+
updatedModuleSpecifier,
|
|
116303
|
+
node.attributes
|
|
116304
|
+
);
|
|
116233
116305
|
}
|
|
116234
116306
|
const oldIdentifier = node.exportClause.name;
|
|
116235
116307
|
const synthName = factory2.getGeneratedNameForNode(oldIdentifier);
|
|
@@ -116245,7 +116317,7 @@ function transformECMAScriptModule(context) {
|
|
|
116245
116317
|
synthName
|
|
116246
116318
|
)
|
|
116247
116319
|
),
|
|
116248
|
-
|
|
116320
|
+
updatedModuleSpecifier,
|
|
116249
116321
|
node.attributes
|
|
116250
116322
|
);
|
|
116251
116323
|
setOriginalNode(importDecl, node.exportClause);
|
|
@@ -117391,7 +117463,7 @@ function transformDeclarations(context) {
|
|
|
117391
117463
|
}
|
|
117392
117464
|
return setCommentRange(updated, getCommentRange(original));
|
|
117393
117465
|
}
|
|
117394
|
-
function
|
|
117466
|
+
function rewriteModuleSpecifier2(parent2, input) {
|
|
117395
117467
|
if (!input) return void 0;
|
|
117396
117468
|
resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent2.kind !== 267 /* ModuleDeclaration */ && parent2.kind !== 205 /* ImportType */;
|
|
117397
117469
|
if (isStringLiteralLike(input)) {
|
|
@@ -117413,7 +117485,7 @@ function transformDeclarations(context) {
|
|
|
117413
117485
|
decl.modifiers,
|
|
117414
117486
|
decl.isTypeOnly,
|
|
117415
117487
|
decl.name,
|
|
117416
|
-
factory2.updateExternalModuleReference(decl.moduleReference,
|
|
117488
|
+
factory2.updateExternalModuleReference(decl.moduleReference, rewriteModuleSpecifier2(decl, specifier))
|
|
117417
117489
|
);
|
|
117418
117490
|
} else {
|
|
117419
117491
|
const oldDiag = getSymbolAccessibilityDiagnostic;
|
|
@@ -117429,7 +117501,7 @@ function transformDeclarations(context) {
|
|
|
117429
117501
|
decl,
|
|
117430
117502
|
decl.modifiers,
|
|
117431
117503
|
decl.importClause,
|
|
117432
|
-
|
|
117504
|
+
rewriteModuleSpecifier2(decl, decl.moduleSpecifier),
|
|
117433
117505
|
tryGetResolutionModeOverride(decl.attributes)
|
|
117434
117506
|
);
|
|
117435
117507
|
}
|
|
@@ -117445,7 +117517,7 @@ function transformDeclarations(context) {
|
|
|
117445
117517
|
/*namedBindings*/
|
|
117446
117518
|
void 0
|
|
117447
117519
|
),
|
|
117448
|
-
|
|
117520
|
+
rewriteModuleSpecifier2(decl, decl.moduleSpecifier),
|
|
117449
117521
|
tryGetResolutionModeOverride(decl.attributes)
|
|
117450
117522
|
);
|
|
117451
117523
|
}
|
|
@@ -117463,7 +117535,7 @@ function transformDeclarations(context) {
|
|
|
117463
117535
|
visibleDefaultBinding,
|
|
117464
117536
|
namedBindings
|
|
117465
117537
|
),
|
|
117466
|
-
|
|
117538
|
+
rewriteModuleSpecifier2(decl, decl.moduleSpecifier),
|
|
117467
117539
|
tryGetResolutionModeOverride(decl.attributes)
|
|
117468
117540
|
) : void 0;
|
|
117469
117541
|
}
|
|
@@ -117478,7 +117550,7 @@ function transformDeclarations(context) {
|
|
|
117478
117550
|
visibleDefaultBinding,
|
|
117479
117551
|
bindingList && bindingList.length ? factory2.updateNamedImports(decl.importClause.namedBindings, bindingList) : void 0
|
|
117480
117552
|
),
|
|
117481
|
-
|
|
117553
|
+
rewriteModuleSpecifier2(decl, decl.moduleSpecifier),
|
|
117482
117554
|
tryGetResolutionModeOverride(decl.attributes)
|
|
117483
117555
|
);
|
|
117484
117556
|
}
|
|
@@ -117491,7 +117563,7 @@ function transformDeclarations(context) {
|
|
|
117491
117563
|
decl.modifiers,
|
|
117492
117564
|
/*importClause*/
|
|
117493
117565
|
void 0,
|
|
117494
|
-
|
|
117566
|
+
rewriteModuleSpecifier2(decl, decl.moduleSpecifier),
|
|
117495
117567
|
tryGetResolutionModeOverride(decl.attributes)
|
|
117496
117568
|
);
|
|
117497
117569
|
}
|
|
@@ -117805,7 +117877,7 @@ function transformDeclarations(context) {
|
|
|
117805
117877
|
if (!isLiteralImportTypeNode(input)) return cleanup(input);
|
|
117806
117878
|
return cleanup(factory2.updateImportTypeNode(
|
|
117807
117879
|
input,
|
|
117808
|
-
factory2.updateLiteralTypeNode(input.argument,
|
|
117880
|
+
factory2.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier2(input, input.argument.literal)),
|
|
117809
117881
|
input.attributes,
|
|
117810
117882
|
input.qualifier,
|
|
117811
117883
|
visitNodes2(input.typeArguments, visitDeclarationSubtree, isTypeNode),
|
|
@@ -117858,7 +117930,7 @@ function transformDeclarations(context) {
|
|
|
117858
117930
|
input.modifiers,
|
|
117859
117931
|
input.isTypeOnly,
|
|
117860
117932
|
input.exportClause,
|
|
117861
|
-
|
|
117933
|
+
rewriteModuleSpecifier2(input, input.moduleSpecifier),
|
|
117862
117934
|
tryGetResolutionModeOverride(input.attributes)
|
|
117863
117935
|
);
|
|
117864
117936
|
}
|
|
@@ -118108,7 +118180,7 @@ function transformDeclarations(context) {
|
|
|
118108
118180
|
return cleanup(updateModuleDeclarationAndKeyword(
|
|
118109
118181
|
input,
|
|
118110
118182
|
mods,
|
|
118111
|
-
isExternalModuleAugmentation(input) ?
|
|
118183
|
+
isExternalModuleAugmentation(input) ? rewriteModuleSpecifier2(input, input.name) : input.name,
|
|
118112
118184
|
body
|
|
118113
118185
|
));
|
|
118114
118186
|
} else {
|
|
@@ -127721,7 +127793,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
127721
127793
|
createDiagnosticForOptionName(Diagnostics.Option_verbatimModuleSyntax_cannot_be_used_when_module_is_set_to_UMD_AMD_or_System, "verbatimModuleSyntax");
|
|
127722
127794
|
}
|
|
127723
127795
|
}
|
|
127724
|
-
if (options.allowImportingTsExtensions && !(options.noEmit || options.emitDeclarationOnly)) {
|
|
127796
|
+
if (options.allowImportingTsExtensions && !(options.noEmit || options.emitDeclarationOnly || options.rewriteRelativeImportExtensions)) {
|
|
127725
127797
|
createOptionValueDiagnostic("allowImportingTsExtensions", Diagnostics.Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set);
|
|
127726
127798
|
}
|
|
127727
127799
|
const moduleResolution = getEmitModuleResolutionKind(options);
|
|
@@ -137308,9 +137380,6 @@ function getLineStartPositionForPosition(position, sourceFile) {
|
|
|
137308
137380
|
const line = sourceFile.getLineAndCharacterOfPosition(position).line;
|
|
137309
137381
|
return lineStarts[line];
|
|
137310
137382
|
}
|
|
137311
|
-
function rangeContainsRange(r1, r2) {
|
|
137312
|
-
return startEndContainsRange(r1.pos, r1.end, r2);
|
|
137313
|
-
}
|
|
137314
137383
|
function rangeContainsRangeExclusive(r1, r2) {
|
|
137315
137384
|
return rangeContainsPositionExclusive(r1, r2.pos) && rangeContainsPositionExclusive(r1, r2.end);
|
|
137316
137385
|
}
|
|
@@ -137320,9 +137389,6 @@ function rangeContainsPosition(r, pos) {
|
|
|
137320
137389
|
function rangeContainsPositionExclusive(r, pos) {
|
|
137321
137390
|
return r.pos < pos && pos < r.end;
|
|
137322
137391
|
}
|
|
137323
|
-
function startEndContainsRange(start, end, range) {
|
|
137324
|
-
return start <= range.pos && end >= range.end;
|
|
137325
|
-
}
|
|
137326
137392
|
function rangeContainsStartEnd(range, start, end) {
|
|
137327
137393
|
return range.pos <= start && range.end >= end;
|
|
137328
137394
|
}
|
|
@@ -138342,7 +138408,7 @@ function createModuleSpecifierResolutionHost(program, host) {
|
|
|
138342
138408
|
fileExists: (fileName) => program.fileExists(fileName),
|
|
138343
138409
|
getCurrentDirectory: () => host.getCurrentDirectory(),
|
|
138344
138410
|
readFile: maybeBind(host, host.readFile),
|
|
138345
|
-
useCaseSensitiveFileNames: maybeBind(host, host.useCaseSensitiveFileNames),
|
|
138411
|
+
useCaseSensitiveFileNames: maybeBind(host, host.useCaseSensitiveFileNames) || program.useCaseSensitiveFileNames,
|
|
138346
138412
|
getSymlinkCache: maybeBind(host, host.getSymlinkCache) || program.getSymlinkCache,
|
|
138347
138413
|
getModuleSpecifierCache: maybeBind(host, host.getModuleSpecifierCache),
|
|
138348
138414
|
getPackageJsonInfoCache: () => {
|
|
@@ -181008,6 +181074,7 @@ __export(ts_exports2, {
|
|
|
181008
181074
|
getAllKeys: () => getAllKeys,
|
|
181009
181075
|
getAllProjectOutputs: () => getAllProjectOutputs,
|
|
181010
181076
|
getAllSuperTypeNodes: () => getAllSuperTypeNodes,
|
|
181077
|
+
getAllowImportingTsExtensions: () => getAllowImportingTsExtensions,
|
|
181011
181078
|
getAllowJSCompilerOption: () => getAllowJSCompilerOption,
|
|
181012
181079
|
getAllowSyntheticDefaultImports: () => getAllowSyntheticDefaultImports,
|
|
181013
181080
|
getAncestor: () => getAncestor,
|
|
@@ -181995,6 +182062,7 @@ __export(ts_exports2, {
|
|
|
181995
182062
|
isParseTreeNode: () => isParseTreeNode,
|
|
181996
182063
|
isPartOfParameterDeclaration: () => isPartOfParameterDeclaration,
|
|
181997
182064
|
isPartOfTypeNode: () => isPartOfTypeNode,
|
|
182065
|
+
isPartOfTypeOnlyImportOrExportDeclaration: () => isPartOfTypeOnlyImportOrExportDeclaration,
|
|
181998
182066
|
isPartOfTypeQuery: () => isPartOfTypeQuery,
|
|
181999
182067
|
isPartiallyEmittedExpression: () => isPartiallyEmittedExpression,
|
|
182000
182068
|
isPatternMatch: () => isPatternMatch,
|
|
@@ -182392,6 +182460,7 @@ __export(ts_exports2, {
|
|
|
182392
182460
|
returnTrue: () => returnTrue,
|
|
182393
182461
|
returnUndefined: () => returnUndefined,
|
|
182394
182462
|
returnsPromise: () => returnsPromise,
|
|
182463
|
+
rewriteModuleSpecifier: () => rewriteModuleSpecifier,
|
|
182395
182464
|
sameFlatMap: () => sameFlatMap,
|
|
182396
182465
|
sameMap: () => sameMap,
|
|
182397
182466
|
sameMapping: () => sameMapping,
|
|
@@ -182437,6 +182506,7 @@ __export(ts_exports2, {
|
|
|
182437
182506
|
setValueDeclaration: () => setValueDeclaration,
|
|
182438
182507
|
shouldAllowImportingTsExtension: () => shouldAllowImportingTsExtension,
|
|
182439
182508
|
shouldPreserveConstEnums: () => shouldPreserveConstEnums,
|
|
182509
|
+
shouldRewriteModuleSpecifier: () => shouldRewriteModuleSpecifier,
|
|
182440
182510
|
shouldUseUriStyleNodeCoreModules: () => shouldUseUriStyleNodeCoreModules,
|
|
182441
182511
|
showModuleSpecifier: () => showModuleSpecifier,
|
|
182442
182512
|
signatureHasRestParameter: () => signatureHasRestParameter,
|
|
@@ -195407,6 +195477,7 @@ if (typeof console !== "undefined") {
|
|
|
195407
195477
|
getAllKeys,
|
|
195408
195478
|
getAllProjectOutputs,
|
|
195409
195479
|
getAllSuperTypeNodes,
|
|
195480
|
+
getAllowImportingTsExtensions,
|
|
195410
195481
|
getAllowJSCompilerOption,
|
|
195411
195482
|
getAllowSyntheticDefaultImports,
|
|
195412
195483
|
getAncestor,
|
|
@@ -196394,6 +196465,7 @@ if (typeof console !== "undefined") {
|
|
|
196394
196465
|
isParseTreeNode,
|
|
196395
196466
|
isPartOfParameterDeclaration,
|
|
196396
196467
|
isPartOfTypeNode,
|
|
196468
|
+
isPartOfTypeOnlyImportOrExportDeclaration,
|
|
196397
196469
|
isPartOfTypeQuery,
|
|
196398
196470
|
isPartiallyEmittedExpression,
|
|
196399
196471
|
isPatternMatch,
|
|
@@ -196791,6 +196863,7 @@ if (typeof console !== "undefined") {
|
|
|
196791
196863
|
returnTrue,
|
|
196792
196864
|
returnUndefined,
|
|
196793
196865
|
returnsPromise,
|
|
196866
|
+
rewriteModuleSpecifier,
|
|
196794
196867
|
sameFlatMap,
|
|
196795
196868
|
sameMap,
|
|
196796
196869
|
sameMapping,
|
|
@@ -196836,6 +196909,7 @@ if (typeof console !== "undefined") {
|
|
|
196836
196909
|
setValueDeclaration,
|
|
196837
196910
|
shouldAllowImportingTsExtension,
|
|
196838
196911
|
shouldPreserveConstEnums,
|
|
196912
|
+
shouldRewriteModuleSpecifier,
|
|
196839
196913
|
shouldUseUriStyleNodeCoreModules,
|
|
196840
196914
|
showModuleSpecifier,
|
|
196841
196915
|
signatureHasRestParameter,
|
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.7.0-pr-
|
|
5
|
+
"version": "5.7.0-pr-59767-6",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|