typescript 5.5.0-dev.20240319 → 5.5.0-dev.20240321
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.esnext.array.d.ts +35 -0
- package/lib/lib.esnext.d.ts +1 -0
- package/lib/tsc.js +130 -401
- package/lib/tsserver.js +108 -114
- package/lib/typescript.d.ts +1 -0
- package/lib/typescript.js +141 -372
- package/lib/typingsInstaller.js +18 -24
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.5";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20240321`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -3880,7 +3880,8 @@ var commentPragmas = {
|
|
|
3880
3880
|
{ name: "lib", optional: true, captureSpan: true },
|
|
3881
3881
|
{ name: "path", optional: true, captureSpan: true },
|
|
3882
3882
|
{ name: "no-default-lib", optional: true },
|
|
3883
|
-
{ name: "resolution-mode", optional: true }
|
|
3883
|
+
{ name: "resolution-mode", optional: true },
|
|
3884
|
+
{ name: "preserve", optional: true }
|
|
3884
3885
|
],
|
|
3885
3886
|
kind: 1 /* TripleSlashXML */
|
|
3886
3887
|
},
|
|
@@ -7792,7 +7793,9 @@ var Diagnostics = {
|
|
|
7792
7793
|
The_value_0_cannot_be_used_here: diag(18050, 1 /* Error */, "The_value_0_cannot_be_used_here_18050", "The value '{0}' cannot be used here."),
|
|
7793
7794
|
Compiler_option_0_cannot_be_given_an_empty_string: diag(18051, 1 /* Error */, "Compiler_option_0_cannot_be_given_an_empty_string_18051", "Compiler option '{0}' cannot be given an empty string."),
|
|
7794
7795
|
Its_type_0_is_not_a_valid_JSX_element_type: diag(18053, 1 /* Error */, "Its_type_0_is_not_a_valid_JSX_element_type_18053", "Its type '{0}' is not a valid JSX element type."),
|
|
7795
|
-
await_using_statements_cannot_be_used_inside_a_class_static_block: diag(18054, 1 /* Error */, "await_using_statements_cannot_be_used_inside_a_class_static_block_18054", "'await using' statements cannot be used inside a class static block.")
|
|
7796
|
+
await_using_statements_cannot_be_used_inside_a_class_static_block: diag(18054, 1 /* Error */, "await_using_statements_cannot_be_used_inside_a_class_static_block_18054", "'await using' statements cannot be used inside a class static block."),
|
|
7797
|
+
_0_has_a_string_type_but_must_have_syntactically_recognizable_string_syntax_when_isolatedModules_is_enabled: diag(18055, 1 /* Error */, "_0_has_a_string_type_but_must_have_syntactically_recognizable_string_syntax_when_isolatedModules_is__18055", "'{0}' has a string type, but must have syntactically recognizable string syntax when 'isolatedModules' is enabled."),
|
|
7798
|
+
Enum_member_following_a_non_literal_numeric_member_must_have_an_initializer_when_isolatedModules_is_enabled: diag(18056, 1 /* Error */, "Enum_member_following_a_non_literal_numeric_member_must_have_an_initializer_when_isolatedModules_is__18056", "Enum member following a non-literal numeric member must have an initializer when 'isolatedModules' is enabled.")
|
|
7796
7799
|
};
|
|
7797
7800
|
|
|
7798
7801
|
// src/compiler/scanner.ts
|
|
@@ -11850,6 +11853,9 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize(
|
|
|
11850
11853
|
es2015: [
|
|
11851
11854
|
"from",
|
|
11852
11855
|
"of"
|
|
11856
|
+
],
|
|
11857
|
+
esnext: [
|
|
11858
|
+
"fromAsync"
|
|
11853
11859
|
]
|
|
11854
11860
|
})),
|
|
11855
11861
|
ObjectConstructor: new Map(Object.entries({
|
|
@@ -32543,7 +32549,7 @@ var Parser;
|
|
|
32543
32549
|
80 /* Identifier */,
|
|
32544
32550
|
/*reportAtCurrentPosition*/
|
|
32545
32551
|
false
|
|
32546
|
-
) :
|
|
32552
|
+
) : parseIdentifierName()), pos);
|
|
32547
32553
|
}
|
|
32548
32554
|
while (token() === 81 /* PrivateIdentifier */) {
|
|
32549
32555
|
reScanHashToken();
|
|
@@ -33491,16 +33497,17 @@ function processPragmasIntoFields(context, reportDiagnostic) {
|
|
|
33491
33497
|
const typeReferenceDirectives = context.typeReferenceDirectives;
|
|
33492
33498
|
const libReferenceDirectives = context.libReferenceDirectives;
|
|
33493
33499
|
forEach(toArray(entryOrList), (arg) => {
|
|
33494
|
-
const { types, lib, path, ["resolution-mode"]: res } = arg.arguments;
|
|
33500
|
+
const { types, lib, path, ["resolution-mode"]: res, preserve: _preserve } = arg.arguments;
|
|
33501
|
+
const preserve = _preserve === "true" ? true : void 0;
|
|
33495
33502
|
if (arg.arguments["no-default-lib"] === "true") {
|
|
33496
33503
|
context.hasNoDefaultLib = true;
|
|
33497
33504
|
} else if (types) {
|
|
33498
33505
|
const parsed = parseResolutionMode(res, types.pos, types.end, reportDiagnostic);
|
|
33499
|
-
typeReferenceDirectives.push({ pos: types.pos, end: types.end, fileName: types.value, ...parsed ? { resolutionMode: parsed } : {} });
|
|
33506
|
+
typeReferenceDirectives.push({ pos: types.pos, end: types.end, fileName: types.value, ...parsed ? { resolutionMode: parsed } : {}, ...preserve ? { preserve } : {} });
|
|
33500
33507
|
} else if (lib) {
|
|
33501
|
-
libReferenceDirectives.push({ pos: lib.pos, end: lib.end, fileName: lib.value });
|
|
33508
|
+
libReferenceDirectives.push({ pos: lib.pos, end: lib.end, fileName: lib.value, ...preserve ? { preserve } : {} });
|
|
33502
33509
|
} else if (path) {
|
|
33503
|
-
referencedFiles.push({ pos: path.pos, end: path.end, fileName: path.value });
|
|
33510
|
+
referencedFiles.push({ pos: path.pos, end: path.end, fileName: path.value, ...preserve ? { preserve } : {} });
|
|
33504
33511
|
} else {
|
|
33505
33512
|
reportDiagnostic(arg.range.pos, arg.range.end - arg.range.pos, Diagnostics.Invalid_reference_directive_syntax);
|
|
33506
33513
|
}
|
|
@@ -33758,6 +33765,7 @@ var libEntries = [
|
|
|
33758
33765
|
["esnext.weakref", "lib.es2021.weakref.d.ts"],
|
|
33759
33766
|
["esnext.decorators", "lib.esnext.decorators.d.ts"],
|
|
33760
33767
|
["esnext.object", "lib.esnext.object.d.ts"],
|
|
33768
|
+
["esnext.array", "lib.esnext.array.d.ts"],
|
|
33761
33769
|
["esnext.regexp", "lib.esnext.regexp.d.ts"],
|
|
33762
33770
|
["decorators", "lib.decorators.d.ts"],
|
|
33763
33771
|
["decorators.legacy", "lib.decorators.legacy.d.ts"]
|
|
@@ -42304,24 +42312,6 @@ function getModuleSpecifierPreferences({ importModuleSpecifierPreference, import
|
|
|
42304
42312
|
);
|
|
42305
42313
|
}
|
|
42306
42314
|
}
|
|
42307
|
-
function getModuleSpecifier(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, options = {}) {
|
|
42308
|
-
return getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getModuleSpecifierPreferences({}, compilerOptions, importingSourceFile), {}, options);
|
|
42309
|
-
}
|
|
42310
|
-
function getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, preferences, userPreferences, options = {}) {
|
|
42311
|
-
const info = getInfo(importingSourceFileName, host);
|
|
42312
|
-
const modulePaths = getAllModulePaths(info, toFileName2, host, userPreferences, options);
|
|
42313
|
-
return firstDefined(modulePaths, (modulePath) => tryGetModuleNameAsNodeModule(
|
|
42314
|
-
modulePath,
|
|
42315
|
-
info,
|
|
42316
|
-
importingSourceFile,
|
|
42317
|
-
host,
|
|
42318
|
-
compilerOptions,
|
|
42319
|
-
userPreferences,
|
|
42320
|
-
/*packageNameOnly*/
|
|
42321
|
-
void 0,
|
|
42322
|
-
options.overrideImportMode
|
|
42323
|
-
)) || getLocalModuleSpecifier(toFileName2, info, compilerOptions, host, options.overrideImportMode || importingSourceFile.impliedNodeFormat, preferences);
|
|
42324
|
-
}
|
|
42325
42315
|
function tryGetModuleSpecifiersFromCacheWorker(moduleSymbol, importingSourceFile, host, userPreferences, options = {}) {
|
|
42326
42316
|
var _a;
|
|
42327
42317
|
const moduleSourceFile = getSourceFileOfModule(moduleSymbol);
|
|
@@ -42558,22 +42548,6 @@ function forEachFileNameOfModule(importingFileName, importedFileName, host, pref
|
|
|
42558
42548
|
});
|
|
42559
42549
|
return result || (preferSymlinks ? forEach(targets, (p) => shouldFilterIgnoredPaths && containsIgnoredPath(p) ? void 0 : cb(p, p === referenceRedirect)) : void 0);
|
|
42560
42550
|
}
|
|
42561
|
-
function getAllModulePaths(info, importedFileName, host, preferences, options = {}) {
|
|
42562
|
-
var _a;
|
|
42563
|
-
const importingFilePath = toPath(info.importingSourceFileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host));
|
|
42564
|
-
const importedFilePath = toPath(importedFileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host));
|
|
42565
|
-
const cache = (_a = host.getModuleSpecifierCache) == null ? void 0 : _a.call(host);
|
|
42566
|
-
if (cache) {
|
|
42567
|
-
const cached = cache.get(importingFilePath, importedFilePath, preferences, options);
|
|
42568
|
-
if (cached == null ? void 0 : cached.modulePaths)
|
|
42569
|
-
return cached.modulePaths;
|
|
42570
|
-
}
|
|
42571
|
-
const modulePaths = getAllModulePathsWorker(info, importedFileName, host);
|
|
42572
|
-
if (cache) {
|
|
42573
|
-
cache.setModulePaths(importingFilePath, importedFilePath, preferences, options, modulePaths);
|
|
42574
|
-
}
|
|
42575
|
-
return modulePaths;
|
|
42576
|
-
}
|
|
42577
42551
|
function getAllModulePathsWorker(info, importedFileName, host) {
|
|
42578
42552
|
const allFileNames = /* @__PURE__ */ new Map();
|
|
42579
42553
|
let importedFileFromNodeModules = false;
|
|
@@ -47141,13 +47115,6 @@ function createTypeChecker(host) {
|
|
|
47141
47115
|
});
|
|
47142
47116
|
}
|
|
47143
47117
|
function getSymbolIfSameReference(s1, s2) {
|
|
47144
|
-
var _a, _b;
|
|
47145
|
-
if (s1.flags & 524288 /* TypeAlias */ && ((_a = s2.declarations) == null ? void 0 : _a.find(isTypeAlias))) {
|
|
47146
|
-
s2 = getDeclaredTypeOfTypeAlias(s2).aliasSymbol || s2;
|
|
47147
|
-
}
|
|
47148
|
-
if (s2.flags & 524288 /* TypeAlias */ && ((_b = s1.declarations) == null ? void 0 : _b.find(isTypeAlias))) {
|
|
47149
|
-
s1 = getDeclaredTypeOfTypeAlias(s1).aliasSymbol || s1;
|
|
47150
|
-
}
|
|
47151
47118
|
if (getMergedSymbol(resolveSymbol(getMergedSymbol(s1))) === getMergedSymbol(resolveSymbol(getMergedSymbol(s2)))) {
|
|
47152
47119
|
return s1;
|
|
47153
47120
|
}
|
|
@@ -49310,14 +49277,6 @@ function createTypeChecker(host) {
|
|
|
49310
49277
|
return file.moduleName;
|
|
49311
49278
|
}
|
|
49312
49279
|
if (!file) {
|
|
49313
|
-
if (context.tracker.trackReferencedAmbientModule) {
|
|
49314
|
-
const ambientDecls = filter(symbol.declarations, isAmbientModule);
|
|
49315
|
-
if (length(ambientDecls)) {
|
|
49316
|
-
for (const decl of ambientDecls) {
|
|
49317
|
-
context.tracker.trackReferencedAmbientModule(decl, symbol);
|
|
49318
|
-
}
|
|
49319
|
-
}
|
|
49320
|
-
}
|
|
49321
49280
|
if (ambientModuleSymbolRegex.test(symbol.escapedName)) {
|
|
49322
49281
|
return symbol.escapedName.substring(1, symbol.escapedName.length - 1);
|
|
49323
49282
|
}
|
|
@@ -49410,8 +49369,6 @@ function createTypeChecker(host) {
|
|
|
49410
49369
|
}
|
|
49411
49370
|
}
|
|
49412
49371
|
const lit = factory.createLiteralTypeNode(factory.createStringLiteral(specifier));
|
|
49413
|
-
if (context.tracker.trackExternalModuleSymbolOfImportTypeNode)
|
|
49414
|
-
context.tracker.trackExternalModuleSymbolOfImportTypeNode(chain[0]);
|
|
49415
49372
|
context.approximateLength += specifier.length + 10;
|
|
49416
49373
|
if (!nonRootParts || isEntityName(nonRootParts)) {
|
|
49417
49374
|
if (nonRootParts) {
|
|
@@ -49970,18 +49927,6 @@ function createTypeChecker(host) {
|
|
|
49970
49927
|
return factory.createStringLiteral(newName);
|
|
49971
49928
|
}
|
|
49972
49929
|
}
|
|
49973
|
-
} else {
|
|
49974
|
-
if (context.tracker && context.tracker.trackExternalModuleSymbolOfImportTypeNode) {
|
|
49975
|
-
const moduleSym = resolveExternalModuleNameWorker(
|
|
49976
|
-
lit,
|
|
49977
|
-
lit,
|
|
49978
|
-
/*moduleNotFoundError*/
|
|
49979
|
-
void 0
|
|
49980
|
-
);
|
|
49981
|
-
if (moduleSym) {
|
|
49982
|
-
context.tracker.trackExternalModuleSymbolOfImportTypeNode(moduleSym);
|
|
49983
|
-
}
|
|
49984
|
-
}
|
|
49985
49930
|
}
|
|
49986
49931
|
return lit;
|
|
49987
49932
|
}
|
|
@@ -80546,19 +80491,21 @@ function createTypeChecker(host) {
|
|
|
80546
80491
|
if (!(nodeLinks2.flags & 1024 /* EnumValuesComputed */)) {
|
|
80547
80492
|
nodeLinks2.flags |= 1024 /* EnumValuesComputed */;
|
|
80548
80493
|
let autoValue = 0;
|
|
80494
|
+
let previous;
|
|
80549
80495
|
for (const member of node.members) {
|
|
80550
|
-
const value = computeMemberValue(member, autoValue);
|
|
80496
|
+
const value = computeMemberValue(member, autoValue, previous);
|
|
80551
80497
|
getNodeLinks(member).enumMemberValue = value;
|
|
80552
80498
|
autoValue = typeof value === "number" ? value + 1 : void 0;
|
|
80499
|
+
previous = member;
|
|
80553
80500
|
}
|
|
80554
80501
|
}
|
|
80555
80502
|
}
|
|
80556
|
-
function computeMemberValue(member, autoValue) {
|
|
80503
|
+
function computeMemberValue(member, autoValue, previous) {
|
|
80557
80504
|
if (isComputedNonLiteralName(member.name)) {
|
|
80558
80505
|
error(member.name, Diagnostics.Computed_property_names_are_not_allowed_in_enums);
|
|
80559
80506
|
} else {
|
|
80560
80507
|
const text = getTextOfPropertyName(member.name);
|
|
80561
|
-
if (isNumericLiteralName(text)) {
|
|
80508
|
+
if (isNumericLiteralName(text) && !isInfinityOrNaNString(text)) {
|
|
80562
80509
|
error(member.name, Diagnostics.An_enum_member_cannot_have_a_numeric_name);
|
|
80563
80510
|
}
|
|
80564
80511
|
}
|
|
@@ -80568,11 +80515,17 @@ function createTypeChecker(host) {
|
|
|
80568
80515
|
if (member.parent.flags & 33554432 /* Ambient */ && !isEnumConst(member.parent)) {
|
|
80569
80516
|
return void 0;
|
|
80570
80517
|
}
|
|
80571
|
-
if (autoValue
|
|
80572
|
-
|
|
80518
|
+
if (autoValue === void 0) {
|
|
80519
|
+
error(member.name, Diagnostics.Enum_member_must_have_initializer);
|
|
80520
|
+
return void 0;
|
|
80573
80521
|
}
|
|
80574
|
-
|
|
80575
|
-
|
|
80522
|
+
if (getIsolatedModules(compilerOptions) && (previous == null ? void 0 : previous.initializer) && !isSyntacticallyNumericConstant(previous.initializer)) {
|
|
80523
|
+
error(
|
|
80524
|
+
member.name,
|
|
80525
|
+
Diagnostics.Enum_member_following_a_non_literal_numeric_member_must_have_an_initializer_when_isolatedModules_is_enabled
|
|
80526
|
+
);
|
|
80527
|
+
}
|
|
80528
|
+
return autoValue;
|
|
80576
80529
|
}
|
|
80577
80530
|
function computeConstantValue(member) {
|
|
80578
80531
|
const isConstEnum = isEnumConst(member.parent);
|
|
@@ -80584,6 +80537,12 @@ function createTypeChecker(host) {
|
|
|
80584
80537
|
initializer,
|
|
80585
80538
|
isNaN(value) ? Diagnostics.const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN : Diagnostics.const_enum_member_initializer_was_evaluated_to_a_non_finite_value
|
|
80586
80539
|
);
|
|
80540
|
+
} else if (getIsolatedModules(compilerOptions) && typeof value === "string" && !isSyntacticallyString(initializer)) {
|
|
80541
|
+
error(
|
|
80542
|
+
initializer,
|
|
80543
|
+
Diagnostics._0_has_a_string_type_but_must_have_syntactically_recognizable_string_syntax_when_isolatedModules_is_enabled,
|
|
80544
|
+
`${idText(member.parent.name)}.${getTextOfPropertyName(member.name)}`
|
|
80545
|
+
);
|
|
80587
80546
|
}
|
|
80588
80547
|
} else if (isConstEnum) {
|
|
80589
80548
|
error(initializer, Diagnostics.const_enum_member_initializers_must_be_constant_expressions);
|
|
@@ -80594,6 +80553,18 @@ function createTypeChecker(host) {
|
|
|
80594
80553
|
}
|
|
80595
80554
|
return value;
|
|
80596
80555
|
}
|
|
80556
|
+
function isSyntacticallyNumericConstant(expr) {
|
|
80557
|
+
expr = skipOuterExpressions(expr);
|
|
80558
|
+
switch (expr.kind) {
|
|
80559
|
+
case 224 /* PrefixUnaryExpression */:
|
|
80560
|
+
return isSyntacticallyNumericConstant(expr.operand);
|
|
80561
|
+
case 226 /* BinaryExpression */:
|
|
80562
|
+
return isSyntacticallyNumericConstant(expr.left) && isSyntacticallyNumericConstant(expr.right);
|
|
80563
|
+
case 9 /* NumericLiteral */:
|
|
80564
|
+
return true;
|
|
80565
|
+
}
|
|
80566
|
+
return false;
|
|
80567
|
+
}
|
|
80597
80568
|
function evaluate(expr, location) {
|
|
80598
80569
|
switch (expr.kind) {
|
|
80599
80570
|
case 224 /* PrefixUnaryExpression */:
|
|
@@ -82623,23 +82594,6 @@ function createTypeChecker(host) {
|
|
|
82623
82594
|
const isPropertyName2 = (isPropertyAccessExpression(parent) || isPropertyAssignment(parent)) && parent.name === node;
|
|
82624
82595
|
return !isPropertyName2 && getReferencedValueSymbol(node) === argumentsSymbol;
|
|
82625
82596
|
}
|
|
82626
|
-
function moduleExportsSomeValue(moduleReferenceExpression) {
|
|
82627
|
-
let moduleSymbol = resolveExternalModuleName(moduleReferenceExpression.parent, moduleReferenceExpression);
|
|
82628
|
-
if (!moduleSymbol || isShorthandAmbientModuleSymbol(moduleSymbol)) {
|
|
82629
|
-
return true;
|
|
82630
|
-
}
|
|
82631
|
-
const hasExportAssignment = hasExportAssignmentSymbol(moduleSymbol);
|
|
82632
|
-
moduleSymbol = resolveExternalModuleSymbol(moduleSymbol);
|
|
82633
|
-
const symbolLinks2 = getSymbolLinks(moduleSymbol);
|
|
82634
|
-
if (symbolLinks2.exportsSomeValue === void 0) {
|
|
82635
|
-
symbolLinks2.exportsSomeValue = hasExportAssignment ? !!(moduleSymbol.flags & 111551 /* Value */) : forEachEntry(getExportsOfModule(moduleSymbol), isValue);
|
|
82636
|
-
}
|
|
82637
|
-
return symbolLinks2.exportsSomeValue;
|
|
82638
|
-
function isValue(s) {
|
|
82639
|
-
s = resolveSymbol(s);
|
|
82640
|
-
return s && !!(getSymbolFlags(s) & 111551 /* Value */);
|
|
82641
|
-
}
|
|
82642
|
-
}
|
|
82643
82597
|
function isNameOfModuleOrEnumDeclaration(node) {
|
|
82644
82598
|
return isModuleOrEnumDeclaration(node.parent) && node === node.parent.name;
|
|
82645
82599
|
}
|
|
@@ -83216,20 +83170,6 @@ function createTypeChecker(host) {
|
|
|
83216
83170
|
}
|
|
83217
83171
|
}
|
|
83218
83172
|
function createResolver() {
|
|
83219
|
-
const resolvedTypeReferenceDirectives = host.getResolvedTypeReferenceDirectives();
|
|
83220
|
-
let fileToDirective;
|
|
83221
|
-
if (resolvedTypeReferenceDirectives) {
|
|
83222
|
-
fileToDirective = /* @__PURE__ */ new Map();
|
|
83223
|
-
resolvedTypeReferenceDirectives.forEach(({ resolvedTypeReferenceDirective }, key, mode) => {
|
|
83224
|
-
if (!(resolvedTypeReferenceDirective == null ? void 0 : resolvedTypeReferenceDirective.resolvedFileName)) {
|
|
83225
|
-
return;
|
|
83226
|
-
}
|
|
83227
|
-
const file = host.getSourceFile(resolvedTypeReferenceDirective.resolvedFileName);
|
|
83228
|
-
if (file) {
|
|
83229
|
-
addReferencedFilesToTypeDirective(file, key, mode);
|
|
83230
|
-
}
|
|
83231
|
-
});
|
|
83232
|
-
}
|
|
83233
83173
|
return {
|
|
83234
83174
|
getReferencedExportContainer,
|
|
83235
83175
|
getReferencedImportDeclaration,
|
|
@@ -83269,14 +83209,11 @@ function createTypeChecker(host) {
|
|
|
83269
83209
|
getReferencedValueDeclarations,
|
|
83270
83210
|
getTypeReferenceSerializationKind,
|
|
83271
83211
|
isOptionalParameter,
|
|
83272
|
-
moduleExportsSomeValue,
|
|
83273
83212
|
isArgumentsLocalBinding,
|
|
83274
83213
|
getExternalModuleFileFromDeclaration: (nodeIn) => {
|
|
83275
83214
|
const node = getParseTreeNode(nodeIn, hasPossibleExternalModuleReference);
|
|
83276
83215
|
return node && getExternalModuleFileFromDeclaration(node);
|
|
83277
83216
|
},
|
|
83278
|
-
getTypeReferenceDirectivesForEntityName,
|
|
83279
|
-
getTypeReferenceDirectivesForSymbol,
|
|
83280
83217
|
isLiteralConstDeclaration,
|
|
83281
83218
|
isLateBound: (nodeIn) => {
|
|
83282
83219
|
const node = getParseTreeNode(nodeIn, isDeclaration);
|
|
@@ -83300,12 +83237,6 @@ function createTypeChecker(host) {
|
|
|
83300
83237
|
getAccessor
|
|
83301
83238
|
};
|
|
83302
83239
|
},
|
|
83303
|
-
getSymbolOfExternalModuleSpecifier: (moduleName) => resolveExternalModuleNameWorker(
|
|
83304
|
-
moduleName,
|
|
83305
|
-
moduleName,
|
|
83306
|
-
/*moduleNotFoundError*/
|
|
83307
|
-
void 0
|
|
83308
|
-
),
|
|
83309
83240
|
isBindingCapturedByNode: (node, decl) => {
|
|
83310
83241
|
const parseNode = getParseTreeNode(node);
|
|
83311
83242
|
const parseDecl = getParseTreeNode(decl);
|
|
@@ -83320,16 +83251,7 @@ function createTypeChecker(host) {
|
|
|
83320
83251
|
}
|
|
83321
83252
|
return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, tracker, bundled);
|
|
83322
83253
|
},
|
|
83323
|
-
isImportRequiredByAugmentation
|
|
83324
|
-
tryFindAmbientModule: (moduleReferenceExpression) => {
|
|
83325
|
-
const node = getParseTreeNode(moduleReferenceExpression);
|
|
83326
|
-
const moduleSpecifier = node && isStringLiteralLike(node) ? node.text : void 0;
|
|
83327
|
-
return moduleSpecifier !== void 0 ? tryFindAmbientModule(
|
|
83328
|
-
moduleSpecifier,
|
|
83329
|
-
/*withAugmentations*/
|
|
83330
|
-
true
|
|
83331
|
-
) : void 0;
|
|
83332
|
-
}
|
|
83254
|
+
isImportRequiredByAugmentation
|
|
83333
83255
|
};
|
|
83334
83256
|
function isImportRequiredByAugmentation(node) {
|
|
83335
83257
|
const file = getSourceFileOfNode(node);
|
|
@@ -83356,84 +83278,6 @@ function createTypeChecker(host) {
|
|
|
83356
83278
|
}
|
|
83357
83279
|
return false;
|
|
83358
83280
|
}
|
|
83359
|
-
function isInHeritageClause(node) {
|
|
83360
|
-
return node.parent && node.parent.kind === 233 /* ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 298 /* HeritageClause */;
|
|
83361
|
-
}
|
|
83362
|
-
function getTypeReferenceDirectivesForEntityName(node) {
|
|
83363
|
-
if (!fileToDirective) {
|
|
83364
|
-
return void 0;
|
|
83365
|
-
}
|
|
83366
|
-
let meaning;
|
|
83367
|
-
if (node.parent.kind === 167 /* ComputedPropertyName */) {
|
|
83368
|
-
meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
|
|
83369
|
-
} else {
|
|
83370
|
-
meaning = 788968 /* Type */ | 1920 /* Namespace */;
|
|
83371
|
-
if (node.kind === 80 /* Identifier */ && isInTypeQuery(node) || node.kind === 211 /* PropertyAccessExpression */ && !isInHeritageClause(node)) {
|
|
83372
|
-
meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
|
|
83373
|
-
}
|
|
83374
|
-
}
|
|
83375
|
-
const symbol = resolveEntityName(
|
|
83376
|
-
node,
|
|
83377
|
-
meaning,
|
|
83378
|
-
/*ignoreErrors*/
|
|
83379
|
-
true
|
|
83380
|
-
);
|
|
83381
|
-
return symbol && symbol !== unknownSymbol ? getTypeReferenceDirectivesForSymbol(symbol, meaning) : void 0;
|
|
83382
|
-
}
|
|
83383
|
-
function getTypeReferenceDirectivesForSymbol(symbol, meaning) {
|
|
83384
|
-
if (!fileToDirective || !isSymbolFromTypeDeclarationFile(symbol)) {
|
|
83385
|
-
return void 0;
|
|
83386
|
-
}
|
|
83387
|
-
let typeReferenceDirectives;
|
|
83388
|
-
for (const decl of symbol.declarations) {
|
|
83389
|
-
if (decl.symbol && decl.symbol.flags & meaning) {
|
|
83390
|
-
const file = getSourceFileOfNode(decl);
|
|
83391
|
-
const typeReferenceDirective = fileToDirective.get(file.path);
|
|
83392
|
-
if (typeReferenceDirective) {
|
|
83393
|
-
(typeReferenceDirectives || (typeReferenceDirectives = [])).push(typeReferenceDirective);
|
|
83394
|
-
} else {
|
|
83395
|
-
return void 0;
|
|
83396
|
-
}
|
|
83397
|
-
}
|
|
83398
|
-
}
|
|
83399
|
-
return typeReferenceDirectives;
|
|
83400
|
-
}
|
|
83401
|
-
function isSymbolFromTypeDeclarationFile(symbol) {
|
|
83402
|
-
if (!symbol.declarations) {
|
|
83403
|
-
return false;
|
|
83404
|
-
}
|
|
83405
|
-
let current = symbol;
|
|
83406
|
-
while (true) {
|
|
83407
|
-
const parent = getParentOfSymbol(current);
|
|
83408
|
-
if (parent) {
|
|
83409
|
-
current = parent;
|
|
83410
|
-
} else {
|
|
83411
|
-
break;
|
|
83412
|
-
}
|
|
83413
|
-
}
|
|
83414
|
-
if (current.valueDeclaration && current.valueDeclaration.kind === 307 /* SourceFile */ && current.flags & 512 /* ValueModule */) {
|
|
83415
|
-
return false;
|
|
83416
|
-
}
|
|
83417
|
-
for (const decl of symbol.declarations) {
|
|
83418
|
-
const file = getSourceFileOfNode(decl);
|
|
83419
|
-
if (fileToDirective.has(file.path)) {
|
|
83420
|
-
return true;
|
|
83421
|
-
}
|
|
83422
|
-
}
|
|
83423
|
-
return false;
|
|
83424
|
-
}
|
|
83425
|
-
function addReferencedFilesToTypeDirective(file, key, mode) {
|
|
83426
|
-
if (fileToDirective.has(file.path))
|
|
83427
|
-
return;
|
|
83428
|
-
fileToDirective.set(file.path, [key, mode]);
|
|
83429
|
-
for (const { fileName } of file.referencedFiles) {
|
|
83430
|
-
const resolvedFile = resolveTripleslashReference(fileName, file.fileName);
|
|
83431
|
-
const referencedFile = host.getSourceFile(resolvedFile);
|
|
83432
|
-
if (referencedFile) {
|
|
83433
|
-
addReferencedFilesToTypeDirective(referencedFile, key, mode || file.impliedNodeFormat);
|
|
83434
|
-
}
|
|
83435
|
-
}
|
|
83436
|
-
}
|
|
83437
83281
|
}
|
|
83438
83282
|
function getExternalModuleFileFromDeclaration(declaration) {
|
|
83439
83283
|
const specifier = declaration.kind === 267 /* ModuleDeclaration */ ? tryCast(declaration.name, isStringLiteral) : getExternalModuleName(declaration);
|
|
@@ -85357,20 +85201,6 @@ var SymbolTrackerImpl = class _SymbolTrackerImpl {
|
|
|
85357
85201
|
this.inner.reportTruncationError();
|
|
85358
85202
|
}
|
|
85359
85203
|
}
|
|
85360
|
-
trackReferencedAmbientModule(decl, symbol) {
|
|
85361
|
-
var _a;
|
|
85362
|
-
if ((_a = this.inner) == null ? void 0 : _a.trackReferencedAmbientModule) {
|
|
85363
|
-
this.onDiagnosticReported();
|
|
85364
|
-
this.inner.trackReferencedAmbientModule(decl, symbol);
|
|
85365
|
-
}
|
|
85366
|
-
}
|
|
85367
|
-
trackExternalModuleSymbolOfImportTypeNode(symbol) {
|
|
85368
|
-
var _a;
|
|
85369
|
-
if ((_a = this.inner) == null ? void 0 : _a.trackExternalModuleSymbolOfImportTypeNode) {
|
|
85370
|
-
this.onDiagnosticReported();
|
|
85371
|
-
this.inner.trackExternalModuleSymbolOfImportTypeNode(symbol);
|
|
85372
|
-
}
|
|
85373
|
-
}
|
|
85374
85204
|
reportNonlocalAugmentation(containingFile, parentSymbol, augmentingSymbol) {
|
|
85375
85205
|
var _a;
|
|
85376
85206
|
if ((_a = this.inner) == null ? void 0 : _a.reportNonlocalAugmentation) {
|
|
@@ -108375,11 +108205,9 @@ function transformDeclarations(context) {
|
|
|
108375
108205
|
let needsScopeFixMarker = false;
|
|
108376
108206
|
let resultHasScopeMarker = false;
|
|
108377
108207
|
let enclosingDeclaration;
|
|
108378
|
-
let necessaryTypeReferences;
|
|
108379
108208
|
let lateMarkedStatements;
|
|
108380
108209
|
let lateStatementReplacementMap;
|
|
108381
108210
|
let suppressNewDiagnosticContexts;
|
|
108382
|
-
let exportedModulesFromDeclarationEmit;
|
|
108383
108211
|
const { factory: factory2 } = context;
|
|
108384
108212
|
const host = context.getEmitHost();
|
|
108385
108213
|
const symbolTracker = {
|
|
@@ -108391,49 +108219,19 @@ function transformDeclarations(context) {
|
|
|
108391
108219
|
reportLikelyUnsafeImportRequiredError,
|
|
108392
108220
|
reportTruncationError,
|
|
108393
108221
|
moduleResolverHost: host,
|
|
108394
|
-
trackReferencedAmbientModule,
|
|
108395
|
-
trackExternalModuleSymbolOfImportTypeNode,
|
|
108396
108222
|
reportNonlocalAugmentation,
|
|
108397
108223
|
reportNonSerializableProperty
|
|
108398
108224
|
};
|
|
108399
108225
|
let errorNameNode;
|
|
108400
108226
|
let errorFallbackNode;
|
|
108401
108227
|
let currentSourceFile;
|
|
108402
|
-
let
|
|
108403
|
-
let
|
|
108404
|
-
let
|
|
108228
|
+
let rawReferencedFiles;
|
|
108229
|
+
let rawTypeReferenceDirectives;
|
|
108230
|
+
let rawLibReferenceDirectives;
|
|
108405
108231
|
const resolver = context.getEmitResolver();
|
|
108406
108232
|
const options = context.getCompilerOptions();
|
|
108407
|
-
const {
|
|
108233
|
+
const { stripInternal } = options;
|
|
108408
108234
|
return transformRoot;
|
|
108409
|
-
function recordTypeReferenceDirectivesIfNecessary(typeReferenceDirectives) {
|
|
108410
|
-
if (!typeReferenceDirectives) {
|
|
108411
|
-
return;
|
|
108412
|
-
}
|
|
108413
|
-
necessaryTypeReferences = necessaryTypeReferences || /* @__PURE__ */ new Set();
|
|
108414
|
-
for (const ref of typeReferenceDirectives) {
|
|
108415
|
-
necessaryTypeReferences.add(ref);
|
|
108416
|
-
}
|
|
108417
|
-
}
|
|
108418
|
-
function trackReferencedAmbientModule(node, symbol) {
|
|
108419
|
-
const directives = resolver.getTypeReferenceDirectivesForSymbol(symbol, -1 /* All */);
|
|
108420
|
-
if (length(directives)) {
|
|
108421
|
-
return recordTypeReferenceDirectivesIfNecessary(directives);
|
|
108422
|
-
}
|
|
108423
|
-
const container = getSourceFileOfNode(node);
|
|
108424
|
-
refs.set(getOriginalNodeId(container), container);
|
|
108425
|
-
}
|
|
108426
|
-
function trackReferencedAmbientModuleFromImport(node) {
|
|
108427
|
-
const moduleSpecifier = tryGetModuleSpecifierFromDeclaration(node);
|
|
108428
|
-
const symbol = moduleSpecifier && resolver.tryFindAmbientModule(moduleSpecifier);
|
|
108429
|
-
if (symbol == null ? void 0 : symbol.declarations) {
|
|
108430
|
-
for (const decl of symbol.declarations) {
|
|
108431
|
-
if (isAmbientModule(decl) && getSourceFileOfNode(decl) !== currentSourceFile) {
|
|
108432
|
-
trackReferencedAmbientModule(decl, symbol);
|
|
108433
|
-
}
|
|
108434
|
-
}
|
|
108435
|
-
}
|
|
108436
|
-
}
|
|
108437
108235
|
function handleSymbolAccessibilityError(symbolAccessibilityResult) {
|
|
108438
108236
|
if (symbolAccessibilityResult.accessibility === 0 /* Accessible */) {
|
|
108439
108237
|
if (symbolAccessibilityResult.aliasesToMakeVisible) {
|
|
@@ -108458,11 +108256,6 @@ function transformDeclarations(context) {
|
|
|
108458
108256
|
}
|
|
108459
108257
|
return false;
|
|
108460
108258
|
}
|
|
108461
|
-
function trackExternalModuleSymbolOfImportTypeNode(symbol) {
|
|
108462
|
-
if (!isBundledEmit) {
|
|
108463
|
-
(exportedModulesFromDeclarationEmit || (exportedModulesFromDeclarationEmit = [])).push(symbol);
|
|
108464
|
-
}
|
|
108465
|
-
}
|
|
108466
108259
|
function trackSymbol(symbol, enclosingDeclaration2, meaning) {
|
|
108467
108260
|
if (symbol.flags & 262144 /* TypeParameter */)
|
|
108468
108261
|
return false;
|
|
@@ -108473,7 +108266,6 @@ function transformDeclarations(context) {
|
|
|
108473
108266
|
/*shouldComputeAliasToMarkVisible*/
|
|
108474
108267
|
true
|
|
108475
108268
|
));
|
|
108476
|
-
recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForSymbol(symbol, meaning));
|
|
108477
108269
|
return issuedDiagnostic;
|
|
108478
108270
|
}
|
|
108479
108271
|
function reportPrivateInBaseOfClassExpression(propertyName) {
|
|
@@ -108545,8 +108337,9 @@ function transformDeclarations(context) {
|
|
|
108545
108337
|
}
|
|
108546
108338
|
if (node.kind === 308 /* Bundle */) {
|
|
108547
108339
|
isBundledEmit = true;
|
|
108548
|
-
|
|
108549
|
-
|
|
108340
|
+
rawReferencedFiles = [];
|
|
108341
|
+
rawTypeReferenceDirectives = [];
|
|
108342
|
+
rawLibReferenceDirectives = [];
|
|
108550
108343
|
let hasNoDefaultLib = false;
|
|
108551
108344
|
const bundle = factory2.createBundle(
|
|
108552
108345
|
map(node.sourceFiles, (sourceFile) => {
|
|
@@ -108561,8 +108354,7 @@ function transformDeclarations(context) {
|
|
|
108561
108354
|
getSymbolAccessibilityDiagnostic = throwDiagnostic;
|
|
108562
108355
|
needsScopeFixMarker = false;
|
|
108563
108356
|
resultHasScopeMarker = false;
|
|
108564
|
-
|
|
108565
|
-
collectLibs(sourceFile, libs2);
|
|
108357
|
+
collectFileReferences(sourceFile);
|
|
108566
108358
|
if (isExternalOrCommonJsModule(sourceFile) || isJsonSourceFile(sourceFile)) {
|
|
108567
108359
|
resultHasExternalModuleIndicator = false;
|
|
108568
108360
|
needsDeclare = false;
|
|
@@ -108609,18 +108401,16 @@ function transformDeclarations(context) {
|
|
|
108609
108401
|
);
|
|
108610
108402
|
})
|
|
108611
108403
|
);
|
|
108612
|
-
bundle.syntheticFileReferences = [];
|
|
108613
|
-
bundle.syntheticTypeReferences = getFileReferencesForUsedTypeReferences();
|
|
108614
|
-
bundle.syntheticLibReferences = getLibReferences();
|
|
108615
|
-
bundle.hasNoDefaultLib = hasNoDefaultLib;
|
|
108616
108404
|
const outputFilePath2 = getDirectoryPath(normalizeSlashes(getOutputPathsFor(
|
|
108617
108405
|
node,
|
|
108618
108406
|
host,
|
|
108619
108407
|
/*forceDtsPaths*/
|
|
108620
108408
|
true
|
|
108621
108409
|
).declarationFilePath));
|
|
108622
|
-
|
|
108623
|
-
|
|
108410
|
+
bundle.syntheticFileReferences = getReferencedFiles(outputFilePath2);
|
|
108411
|
+
bundle.syntheticTypeReferences = getTypeReferences();
|
|
108412
|
+
bundle.syntheticLibReferences = getLibReferences();
|
|
108413
|
+
bundle.hasNoDefaultLib = hasNoDefaultLib;
|
|
108624
108414
|
return bundle;
|
|
108625
108415
|
}
|
|
108626
108416
|
needsDeclare = true;
|
|
@@ -108634,66 +108424,68 @@ function transformDeclarations(context) {
|
|
|
108634
108424
|
suppressNewDiagnosticContexts = false;
|
|
108635
108425
|
lateMarkedStatements = void 0;
|
|
108636
108426
|
lateStatementReplacementMap = /* @__PURE__ */ new Map();
|
|
108637
|
-
|
|
108638
|
-
|
|
108639
|
-
|
|
108640
|
-
|
|
108641
|
-
const outputFilePath = getDirectoryPath(normalizeSlashes(getOutputPathsFor(
|
|
108642
|
-
node,
|
|
108643
|
-
host,
|
|
108644
|
-
/*forceDtsPaths*/
|
|
108645
|
-
true
|
|
108646
|
-
).declarationFilePath));
|
|
108647
|
-
const referenceVisitor = mapReferencesIntoArray(references, outputFilePath);
|
|
108427
|
+
rawReferencedFiles = [];
|
|
108428
|
+
rawTypeReferenceDirectives = [];
|
|
108429
|
+
rawLibReferenceDirectives = [];
|
|
108430
|
+
collectFileReferences(currentSourceFile);
|
|
108648
108431
|
let combinedStatements;
|
|
108649
108432
|
if (isSourceFileJS(currentSourceFile)) {
|
|
108650
108433
|
combinedStatements = factory2.createNodeArray(transformDeclarationsForJS(node));
|
|
108651
|
-
refs.forEach(referenceVisitor);
|
|
108652
|
-
emittedImports = filter(combinedStatements, isAnyImportSyntax);
|
|
108653
108434
|
} else {
|
|
108654
108435
|
const statements = visitNodes2(node.statements, visitDeclarationStatements, isStatement);
|
|
108655
108436
|
combinedStatements = setTextRange(factory2.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), node.statements);
|
|
108656
|
-
refs.forEach(referenceVisitor);
|
|
108657
|
-
emittedImports = filter(combinedStatements, isAnyImportSyntax);
|
|
108658
108437
|
if (isExternalModule(node) && (!resultHasExternalModuleIndicator || needsScopeFixMarker && !resultHasScopeMarker)) {
|
|
108659
108438
|
combinedStatements = setTextRange(factory2.createNodeArray([...combinedStatements, createEmptyExports(factory2)]), combinedStatements);
|
|
108660
108439
|
}
|
|
108661
108440
|
}
|
|
108441
|
+
const outputFilePath = getDirectoryPath(normalizeSlashes(getOutputPathsFor(
|
|
108442
|
+
node,
|
|
108443
|
+
host,
|
|
108444
|
+
/*forceDtsPaths*/
|
|
108445
|
+
true
|
|
108446
|
+
).declarationFilePath));
|
|
108662
108447
|
return factory2.updateSourceFile(
|
|
108663
108448
|
node,
|
|
108664
108449
|
combinedStatements,
|
|
108665
108450
|
/*isDeclarationFile*/
|
|
108666
108451
|
true,
|
|
108667
|
-
|
|
108668
|
-
|
|
108452
|
+
getReferencedFiles(outputFilePath),
|
|
108453
|
+
getTypeReferences(),
|
|
108669
108454
|
node.hasNoDefaultLib,
|
|
108670
108455
|
getLibReferences()
|
|
108671
108456
|
);
|
|
108672
|
-
function
|
|
108673
|
-
|
|
108457
|
+
function collectFileReferences(sourceFile) {
|
|
108458
|
+
rawReferencedFiles = concatenate(rawReferencedFiles, map(sourceFile.referencedFiles, (f) => [sourceFile, f]));
|
|
108459
|
+
rawTypeReferenceDirectives = concatenate(rawTypeReferenceDirectives, sourceFile.typeReferenceDirectives);
|
|
108460
|
+
rawLibReferenceDirectives = concatenate(rawLibReferenceDirectives, sourceFile.libReferenceDirectives);
|
|
108674
108461
|
}
|
|
108675
|
-
function
|
|
108676
|
-
|
|
108462
|
+
function copyFileReferenceAsSynthetic(ref) {
|
|
108463
|
+
const newRef = { ...ref };
|
|
108464
|
+
newRef.pos = -1;
|
|
108465
|
+
newRef.end = -1;
|
|
108466
|
+
return newRef;
|
|
108677
108467
|
}
|
|
108678
|
-
function
|
|
108679
|
-
|
|
108680
|
-
|
|
108681
|
-
|
|
108682
|
-
|
|
108683
|
-
|
|
108684
|
-
return void 0;
|
|
108685
|
-
}
|
|
108686
|
-
} else if (isImportDeclaration(importStatement) && isStringLiteral(importStatement.moduleSpecifier) && importStatement.moduleSpecifier.text === typeName) {
|
|
108687
|
-
return void 0;
|
|
108688
|
-
}
|
|
108689
|
-
}
|
|
108690
|
-
}
|
|
108691
|
-
return { fileName: typeName, pos: -1, end: -1, ...mode ? { resolutionMode: mode } : void 0 };
|
|
108468
|
+
function getTypeReferences() {
|
|
108469
|
+
return mapDefined(rawTypeReferenceDirectives, (ref) => {
|
|
108470
|
+
if (!ref.preserve)
|
|
108471
|
+
return void 0;
|
|
108472
|
+
return copyFileReferenceAsSynthetic(ref);
|
|
108473
|
+
});
|
|
108692
108474
|
}
|
|
108693
|
-
function
|
|
108694
|
-
return (
|
|
108695
|
-
if (
|
|
108696
|
-
return;
|
|
108475
|
+
function getLibReferences() {
|
|
108476
|
+
return mapDefined(rawLibReferenceDirectives, (ref) => {
|
|
108477
|
+
if (!ref.preserve)
|
|
108478
|
+
return void 0;
|
|
108479
|
+
return copyFileReferenceAsSynthetic(ref);
|
|
108480
|
+
});
|
|
108481
|
+
}
|
|
108482
|
+
function getReferencedFiles(outputFilePath2) {
|
|
108483
|
+
return mapDefined(rawReferencedFiles, ([sourceFile, ref]) => {
|
|
108484
|
+
if (!ref.preserve)
|
|
108485
|
+
return void 0;
|
|
108486
|
+
const file = host.getSourceFileFromReference(sourceFile, ref);
|
|
108487
|
+
if (!file) {
|
|
108488
|
+
return void 0;
|
|
108697
108489
|
}
|
|
108698
108490
|
let declFileName;
|
|
108699
108491
|
if (file.isDeclarationFile) {
|
|
@@ -108709,61 +108501,22 @@ function transformDeclarations(context) {
|
|
|
108709
108501
|
);
|
|
108710
108502
|
declFileName = paths.declarationFilePath || paths.jsFilePath || file.fileName;
|
|
108711
108503
|
}
|
|
108712
|
-
if (declFileName)
|
|
108713
|
-
|
|
108714
|
-
|
|
108715
|
-
|
|
108716
|
-
|
|
108717
|
-
|
|
108718
|
-
|
|
108719
|
-
|
|
108720
|
-
|
|
108721
|
-
|
|
108722
|
-
|
|
108723
|
-
|
|
108724
|
-
|
|
108725
|
-
|
|
108726
|
-
return;
|
|
108727
|
-
}
|
|
108728
|
-
let fileName = getRelativePathToDirectoryOrUrl(
|
|
108729
|
-
outputFilePath2,
|
|
108730
|
-
declFileName,
|
|
108731
|
-
host.getCurrentDirectory(),
|
|
108732
|
-
host.getCanonicalFileName,
|
|
108733
|
-
/*isAbsolutePathAnUrl*/
|
|
108734
|
-
false
|
|
108735
|
-
);
|
|
108736
|
-
if (startsWith(fileName, "./") && hasExtension(fileName)) {
|
|
108737
|
-
fileName = fileName.substring(2);
|
|
108738
|
-
}
|
|
108739
|
-
if (startsWith(fileName, "node_modules/") || pathContainsNodeModules(fileName)) {
|
|
108740
|
-
return;
|
|
108741
|
-
}
|
|
108742
|
-
references2.push({ pos: -1, end: -1, fileName });
|
|
108743
|
-
}
|
|
108744
|
-
};
|
|
108504
|
+
if (!declFileName)
|
|
108505
|
+
return void 0;
|
|
108506
|
+
const fileName = getRelativePathToDirectoryOrUrl(
|
|
108507
|
+
outputFilePath2,
|
|
108508
|
+
declFileName,
|
|
108509
|
+
host.getCurrentDirectory(),
|
|
108510
|
+
host.getCanonicalFileName,
|
|
108511
|
+
/*isAbsolutePathAnUrl*/
|
|
108512
|
+
false
|
|
108513
|
+
);
|
|
108514
|
+
const newRef = copyFileReferenceAsSynthetic(ref);
|
|
108515
|
+
newRef.fileName = fileName;
|
|
108516
|
+
return newRef;
|
|
108517
|
+
});
|
|
108745
108518
|
}
|
|
108746
108519
|
}
|
|
108747
|
-
function collectReferences(sourceFile, ret) {
|
|
108748
|
-
if (noResolve || isSourceFileJS(sourceFile))
|
|
108749
|
-
return ret;
|
|
108750
|
-
forEach(sourceFile.referencedFiles, (f) => {
|
|
108751
|
-
const elem = host.getSourceFileFromReference(sourceFile, f);
|
|
108752
|
-
if (elem) {
|
|
108753
|
-
ret.set(getOriginalNodeId(elem), elem);
|
|
108754
|
-
}
|
|
108755
|
-
});
|
|
108756
|
-
return ret;
|
|
108757
|
-
}
|
|
108758
|
-
function collectLibs(sourceFile, ret) {
|
|
108759
|
-
forEach(sourceFile.libReferenceDirectives, (ref) => {
|
|
108760
|
-
const lib = host.getLibFileFromReference(ref);
|
|
108761
|
-
if (lib) {
|
|
108762
|
-
ret.set(toFileNameLowerCase(ref.fileName), true);
|
|
108763
|
-
}
|
|
108764
|
-
});
|
|
108765
|
-
return ret;
|
|
108766
|
-
}
|
|
108767
108520
|
function filterBindingPatternInitializers(name) {
|
|
108768
108521
|
if (name.kind === 80 /* Identifier */) {
|
|
108769
108522
|
return name;
|
|
@@ -108962,7 +108715,6 @@ function transformDeclarations(context) {
|
|
|
108962
108715
|
function checkEntityNameVisibility(entityName, enclosingDeclaration2) {
|
|
108963
108716
|
const visibilityResult = resolver.isEntityNameVisible(entityName, enclosingDeclaration2);
|
|
108964
108717
|
handleSymbolAccessibilityError(visibilityResult);
|
|
108965
|
-
recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName));
|
|
108966
108718
|
}
|
|
108967
108719
|
function preserveJsDoc(updated, original) {
|
|
108968
108720
|
if (hasJSDocNodes(updated) && hasJSDocNodes(original)) {
|
|
@@ -108980,11 +108732,6 @@ function transformDeclarations(context) {
|
|
|
108980
108732
|
if (newName) {
|
|
108981
108733
|
return factory2.createStringLiteral(newName);
|
|
108982
108734
|
}
|
|
108983
|
-
} else {
|
|
108984
|
-
const symbol = resolver.getSymbolOfExternalModuleSpecifier(input);
|
|
108985
|
-
if (symbol) {
|
|
108986
|
-
(exportedModulesFromDeclarationEmit || (exportedModulesFromDeclarationEmit = [])).push(symbol);
|
|
108987
|
-
}
|
|
108988
108735
|
}
|
|
108989
108736
|
}
|
|
108990
108737
|
return input;
|
|
@@ -109377,7 +109124,6 @@ function transformDeclarations(context) {
|
|
|
109377
109124
|
case 205 /* ImportType */: {
|
|
109378
109125
|
if (!isLiteralImportTypeNode(input))
|
|
109379
109126
|
return cleanup(input);
|
|
109380
|
-
trackReferencedAmbientModuleFromImport(input);
|
|
109381
109127
|
return cleanup(factory2.updateImportTypeNode(
|
|
109382
109128
|
input,
|
|
109383
109129
|
factory2.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)),
|
|
@@ -109429,7 +109175,6 @@ function transformDeclarations(context) {
|
|
|
109429
109175
|
resultHasExternalModuleIndicator = true;
|
|
109430
109176
|
}
|
|
109431
109177
|
resultHasScopeMarker = true;
|
|
109432
|
-
trackReferencedAmbientModuleFromImport(input);
|
|
109433
109178
|
return factory2.updateExportDeclaration(
|
|
109434
109179
|
input,
|
|
109435
109180
|
input.modifiers,
|
|
@@ -109504,18 +109249,10 @@ function transformDeclarations(context) {
|
|
|
109504
109249
|
return;
|
|
109505
109250
|
switch (input.kind) {
|
|
109506
109251
|
case 271 /* ImportEqualsDeclaration */: {
|
|
109507
|
-
|
|
109508
|
-
if (transformed) {
|
|
109509
|
-
trackReferencedAmbientModuleFromImport(input);
|
|
109510
|
-
}
|
|
109511
|
-
return transformed;
|
|
109252
|
+
return transformImportEqualsDeclaration(input);
|
|
109512
109253
|
}
|
|
109513
109254
|
case 272 /* ImportDeclaration */: {
|
|
109514
|
-
|
|
109515
|
-
if (transformed) {
|
|
109516
|
-
trackReferencedAmbientModuleFromImport(input);
|
|
109517
|
-
}
|
|
109518
|
-
return transformed;
|
|
109255
|
+
return transformImportDeclaration(input);
|
|
109519
109256
|
}
|
|
109520
109257
|
}
|
|
109521
109258
|
if (isDeclaration(input) && isDeclarationAndNotVisible(input))
|
|
@@ -111074,20 +110811,15 @@ var notImplementedResolver = {
|
|
|
111074
110811
|
getReferencedValueDeclarations: notImplemented,
|
|
111075
110812
|
getTypeReferenceSerializationKind: notImplemented,
|
|
111076
110813
|
isOptionalParameter: notImplemented,
|
|
111077
|
-
moduleExportsSomeValue: notImplemented,
|
|
111078
110814
|
isArgumentsLocalBinding: notImplemented,
|
|
111079
110815
|
getExternalModuleFileFromDeclaration: notImplemented,
|
|
111080
|
-
getTypeReferenceDirectivesForEntityName: notImplemented,
|
|
111081
|
-
getTypeReferenceDirectivesForSymbol: notImplemented,
|
|
111082
110816
|
isLiteralConstDeclaration: notImplemented,
|
|
111083
110817
|
getJsxFactoryEntity: notImplemented,
|
|
111084
110818
|
getJsxFragmentFactoryEntity: notImplemented,
|
|
111085
110819
|
getAllAccessorDeclarations: notImplemented,
|
|
111086
|
-
getSymbolOfExternalModuleSpecifier: notImplemented,
|
|
111087
110820
|
isBindingCapturedByNode: notImplemented,
|
|
111088
110821
|
getDeclarationStatementsForSourceFile: notImplemented,
|
|
111089
|
-
isImportRequiredByAugmentation: notImplemented
|
|
111090
|
-
tryFindAmbientModule: notImplemented
|
|
110822
|
+
isImportRequiredByAugmentation: notImplemented
|
|
111091
110823
|
};
|
|
111092
110824
|
var createPrinterWithDefaults = /* @__PURE__ */ memoize(() => createPrinter({}));
|
|
111093
110825
|
var createPrinterWithRemoveComments = /* @__PURE__ */ memoize(() => createPrinter({ removeComments: true }));
|
|
@@ -113842,19 +113574,17 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
113842
113574
|
writeLine();
|
|
113843
113575
|
}
|
|
113844
113576
|
}
|
|
113845
|
-
|
|
113846
|
-
|
|
113847
|
-
|
|
113848
|
-
|
|
113849
|
-
|
|
113850
|
-
|
|
113851
|
-
|
|
113852
|
-
writeLine();
|
|
113853
|
-
}
|
|
113854
|
-
for (const directive of libs2) {
|
|
113855
|
-
writeComment(`/// <reference lib="${directive.fileName}" />`);
|
|
113856
|
-
writeLine();
|
|
113577
|
+
function writeDirectives(kind, directives) {
|
|
113578
|
+
for (const directive of directives) {
|
|
113579
|
+
const preserve = directive.preserve ? `preserve="true" ` : "";
|
|
113580
|
+
const resolutionMode = directive.resolutionMode && directive.resolutionMode !== (currentSourceFile == null ? void 0 : currentSourceFile.impliedNodeFormat) ? `resolution-mode="${directive.resolutionMode === 99 /* ESNext */ ? "import" : "require"}" ` : "";
|
|
113581
|
+
writeComment(`/// <reference ${kind}="${directive.fileName}" ${resolutionMode}${preserve}/>`);
|
|
113582
|
+
writeLine();
|
|
113583
|
+
}
|
|
113857
113584
|
}
|
|
113585
|
+
writeDirectives("path", files);
|
|
113586
|
+
writeDirectives("types", types);
|
|
113587
|
+
writeDirectives("lib", libs2);
|
|
113858
113588
|
}
|
|
113859
113589
|
function emitSourceFileWorker(node) {
|
|
113860
113590
|
const statements = node.statements;
|
|
@@ -117691,7 +117421,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
117691
117421
|
getSourceFile: program.getSourceFile,
|
|
117692
117422
|
getSourceFileByPath: program.getSourceFileByPath,
|
|
117693
117423
|
getSourceFiles: program.getSourceFiles,
|
|
117694
|
-
getLibFileFromReference: program.getLibFileFromReference,
|
|
117695
117424
|
isSourceFileFromExternalLibrary,
|
|
117696
117425
|
getResolvedProjectReferenceToRedirect,
|
|
117697
117426
|
getProjectReferenceRedirect,
|