typescript 5.5.0-dev.20240320 → 5.5.0-dev.20240322
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +138 -409
- package/lib/tsserver.js +108 -114
- package/lib/typescript.d.ts +1 -0
- package/lib/typescript.js +154 -385
- package/lib/typingsInstaller.js +18 -24
- package/package.json +10 -10
package/lib/typescript.js
CHANGED
|
@@ -2326,7 +2326,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2326
2326
|
|
|
2327
2327
|
// src/compiler/corePublic.ts
|
|
2328
2328
|
var versionMajorMinor = "5.5";
|
|
2329
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2329
|
+
var version = `${versionMajorMinor}.0-dev.20240322`;
|
|
2330
2330
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2331
2331
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2332
2332
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -7393,7 +7393,8 @@ var commentPragmas = {
|
|
|
7393
7393
|
{ name: "lib", optional: true, captureSpan: true },
|
|
7394
7394
|
{ name: "path", optional: true, captureSpan: true },
|
|
7395
7395
|
{ name: "no-default-lib", optional: true },
|
|
7396
|
-
{ name: "resolution-mode", optional: true }
|
|
7396
|
+
{ name: "resolution-mode", optional: true },
|
|
7397
|
+
{ name: "preserve", optional: true }
|
|
7397
7398
|
],
|
|
7398
7399
|
kind: 1 /* TripleSlashXML */
|
|
7399
7400
|
},
|
|
@@ -11347,7 +11348,9 @@ var Diagnostics = {
|
|
|
11347
11348
|
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."),
|
|
11348
11349
|
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."),
|
|
11349
11350
|
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."),
|
|
11350
|
-
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.")
|
|
11351
|
+
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."),
|
|
11352
|
+
_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."),
|
|
11353
|
+
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.")
|
|
11351
11354
|
};
|
|
11352
11355
|
|
|
11353
11356
|
// src/compiler/scanner.ts
|
|
@@ -36965,7 +36968,7 @@ var Parser;
|
|
|
36965
36968
|
80 /* Identifier */,
|
|
36966
36969
|
/*reportAtCurrentPosition*/
|
|
36967
36970
|
false
|
|
36968
|
-
) :
|
|
36971
|
+
) : parseIdentifierName()), pos);
|
|
36969
36972
|
}
|
|
36970
36973
|
while (token() === 81 /* PrivateIdentifier */) {
|
|
36971
36974
|
reScanHashToken();
|
|
@@ -37913,16 +37916,17 @@ function processPragmasIntoFields(context, reportDiagnostic) {
|
|
|
37913
37916
|
const typeReferenceDirectives = context.typeReferenceDirectives;
|
|
37914
37917
|
const libReferenceDirectives = context.libReferenceDirectives;
|
|
37915
37918
|
forEach(toArray(entryOrList), (arg) => {
|
|
37916
|
-
const { types, lib, path, ["resolution-mode"]: res } = arg.arguments;
|
|
37919
|
+
const { types, lib, path, ["resolution-mode"]: res, preserve: _preserve } = arg.arguments;
|
|
37920
|
+
const preserve = _preserve === "true" ? true : void 0;
|
|
37917
37921
|
if (arg.arguments["no-default-lib"] === "true") {
|
|
37918
37922
|
context.hasNoDefaultLib = true;
|
|
37919
37923
|
} else if (types) {
|
|
37920
37924
|
const parsed = parseResolutionMode(res, types.pos, types.end, reportDiagnostic);
|
|
37921
|
-
typeReferenceDirectives.push({ pos: types.pos, end: types.end, fileName: types.value, ...parsed ? { resolutionMode: parsed } : {} });
|
|
37925
|
+
typeReferenceDirectives.push({ pos: types.pos, end: types.end, fileName: types.value, ...parsed ? { resolutionMode: parsed } : {}, ...preserve ? { preserve } : {} });
|
|
37922
37926
|
} else if (lib) {
|
|
37923
|
-
libReferenceDirectives.push({ pos: lib.pos, end: lib.end, fileName: lib.value });
|
|
37927
|
+
libReferenceDirectives.push({ pos: lib.pos, end: lib.end, fileName: lib.value, ...preserve ? { preserve } : {} });
|
|
37924
37928
|
} else if (path) {
|
|
37925
|
-
referencedFiles.push({ pos: path.pos, end: path.end, fileName: path.value });
|
|
37929
|
+
referencedFiles.push({ pos: path.pos, end: path.end, fileName: path.value, ...preserve ? { preserve } : {} });
|
|
37926
37930
|
} else {
|
|
37927
37931
|
reportDiagnostic(arg.range.pos, arg.range.end - arg.range.pos, Diagnostics.Invalid_reference_directive_syntax);
|
|
37928
37932
|
}
|
|
@@ -48319,12 +48323,9 @@ function createTypeChecker(host) {
|
|
|
48319
48323
|
getExactOptionalProperties,
|
|
48320
48324
|
getAllPossiblePropertiesOfTypes,
|
|
48321
48325
|
getSuggestedSymbolForNonexistentProperty,
|
|
48322
|
-
getSuggestionForNonexistentProperty,
|
|
48323
48326
|
getSuggestedSymbolForNonexistentJSXAttribute,
|
|
48324
48327
|
getSuggestedSymbolForNonexistentSymbol: (location, name, meaning) => getSuggestedSymbolForNonexistentSymbol(location, escapeLeadingUnderscores(name), meaning),
|
|
48325
|
-
getSuggestionForNonexistentSymbol: (location, name, meaning) => getSuggestionForNonexistentSymbol(location, escapeLeadingUnderscores(name), meaning),
|
|
48326
48328
|
getSuggestedSymbolForNonexistentModule,
|
|
48327
|
-
getSuggestionForNonexistentExport,
|
|
48328
48329
|
getSuggestedSymbolForNonexistentClassMember,
|
|
48329
48330
|
getBaseConstraintOfType,
|
|
48330
48331
|
getDefaultFromTypeParameter: (type) => type && type.flags & 262144 /* TypeParameter */ ? getDefaultFromTypeParameter(type) : void 0,
|
|
@@ -52352,15 +52353,19 @@ function createTypeChecker(host) {
|
|
|
52352
52353
|
return true;
|
|
52353
52354
|
}
|
|
52354
52355
|
}
|
|
52355
|
-
function
|
|
52356
|
+
function getMeaningOfEntityNameReference(entityName) {
|
|
52356
52357
|
let meaning;
|
|
52357
52358
|
if (entityName.parent.kind === 186 /* TypeQuery */ || entityName.parent.kind === 233 /* ExpressionWithTypeArguments */ && !isPartOfTypeNode(entityName.parent) || entityName.parent.kind === 167 /* ComputedPropertyName */) {
|
|
52358
52359
|
meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
|
|
52359
|
-
} else if (entityName.kind === 166 /* QualifiedName */ || entityName.kind === 211 /* PropertyAccessExpression */ || entityName.parent.kind === 271 /* ImportEqualsDeclaration */) {
|
|
52360
|
+
} else if (entityName.kind === 166 /* QualifiedName */ || entityName.kind === 211 /* PropertyAccessExpression */ || entityName.parent.kind === 271 /* ImportEqualsDeclaration */ || entityName.parent.kind === 166 /* QualifiedName */ && entityName.parent.left === entityName || entityName.parent.kind === 211 /* PropertyAccessExpression */ && entityName.parent.expression === entityName || entityName.parent.kind === 212 /* ElementAccessExpression */ && entityName.parent.expression === entityName) {
|
|
52360
52361
|
meaning = 1920 /* Namespace */;
|
|
52361
52362
|
} else {
|
|
52362
52363
|
meaning = 788968 /* Type */;
|
|
52363
52364
|
}
|
|
52365
|
+
return meaning;
|
|
52366
|
+
}
|
|
52367
|
+
function isEntityNameVisible(entityName, enclosingDeclaration) {
|
|
52368
|
+
const meaning = getMeaningOfEntityNameReference(entityName);
|
|
52364
52369
|
const firstIdentifier = getFirstIdentifier(entityName);
|
|
52365
52370
|
const symbol = resolveName(
|
|
52366
52371
|
enclosingDeclaration,
|
|
@@ -54035,14 +54040,6 @@ function createTypeChecker(host) {
|
|
|
54035
54040
|
return file.moduleName;
|
|
54036
54041
|
}
|
|
54037
54042
|
if (!file) {
|
|
54038
|
-
if (context.tracker.trackReferencedAmbientModule) {
|
|
54039
|
-
const ambientDecls = filter(symbol.declarations, isAmbientModule);
|
|
54040
|
-
if (length(ambientDecls)) {
|
|
54041
|
-
for (const decl of ambientDecls) {
|
|
54042
|
-
context.tracker.trackReferencedAmbientModule(decl, symbol);
|
|
54043
|
-
}
|
|
54044
|
-
}
|
|
54045
|
-
}
|
|
54046
54043
|
if (ambientModuleSymbolRegex.test(symbol.escapedName)) {
|
|
54047
54044
|
return symbol.escapedName.substring(1, symbol.escapedName.length - 1);
|
|
54048
54045
|
}
|
|
@@ -54135,8 +54132,6 @@ function createTypeChecker(host) {
|
|
|
54135
54132
|
}
|
|
54136
54133
|
}
|
|
54137
54134
|
const lit = factory.createLiteralTypeNode(factory.createStringLiteral(specifier));
|
|
54138
|
-
if (context.tracker.trackExternalModuleSymbolOfImportTypeNode)
|
|
54139
|
-
context.tracker.trackExternalModuleSymbolOfImportTypeNode(chain[0]);
|
|
54140
54135
|
context.approximateLength += specifier.length + 10;
|
|
54141
54136
|
if (!nonRootParts || isEntityName(nonRootParts)) {
|
|
54142
54137
|
if (nonRootParts) {
|
|
@@ -54477,9 +54472,10 @@ function createTypeChecker(host) {
|
|
|
54477
54472
|
introducesError = true;
|
|
54478
54473
|
return { introducesError, node };
|
|
54479
54474
|
}
|
|
54475
|
+
const meaning = getMeaningOfEntityNameReference(node);
|
|
54480
54476
|
const sym = resolveEntityName(
|
|
54481
54477
|
leftmost,
|
|
54482
|
-
|
|
54478
|
+
meaning,
|
|
54483
54479
|
/*ignoreErrors*/
|
|
54484
54480
|
true,
|
|
54485
54481
|
/*dontResolveAlias*/
|
|
@@ -54489,7 +54485,7 @@ function createTypeChecker(host) {
|
|
|
54489
54485
|
if (isSymbolAccessible(
|
|
54490
54486
|
sym,
|
|
54491
54487
|
context.enclosingDeclaration,
|
|
54492
|
-
|
|
54488
|
+
meaning,
|
|
54493
54489
|
/*shouldComputeAliasesToMakeVisible*/
|
|
54494
54490
|
false
|
|
54495
54491
|
).accessibility !== 0 /* Accessible */) {
|
|
@@ -54497,7 +54493,7 @@ function createTypeChecker(host) {
|
|
|
54497
54493
|
introducesError = true;
|
|
54498
54494
|
}
|
|
54499
54495
|
} else {
|
|
54500
|
-
context.tracker.trackSymbol(sym, context.enclosingDeclaration,
|
|
54496
|
+
context.tracker.trackSymbol(sym, context.enclosingDeclaration, meaning);
|
|
54501
54497
|
includePrivateSymbol == null ? void 0 : includePrivateSymbol(sym);
|
|
54502
54498
|
}
|
|
54503
54499
|
if (isIdentifier(node)) {
|
|
@@ -54695,18 +54691,6 @@ function createTypeChecker(host) {
|
|
|
54695
54691
|
return factory.createStringLiteral(newName);
|
|
54696
54692
|
}
|
|
54697
54693
|
}
|
|
54698
|
-
} else {
|
|
54699
|
-
if (context.tracker && context.tracker.trackExternalModuleSymbolOfImportTypeNode) {
|
|
54700
|
-
const moduleSym = resolveExternalModuleNameWorker(
|
|
54701
|
-
lit,
|
|
54702
|
-
lit,
|
|
54703
|
-
/*moduleNotFoundError*/
|
|
54704
|
-
void 0
|
|
54705
|
-
);
|
|
54706
|
-
if (moduleSym) {
|
|
54707
|
-
context.tracker.trackExternalModuleSymbolOfImportTypeNode(moduleSym);
|
|
54708
|
-
}
|
|
54709
|
-
}
|
|
54710
54694
|
}
|
|
54711
54695
|
return lit;
|
|
54712
54696
|
}
|
|
@@ -62464,6 +62448,9 @@ function createTypeChecker(host) {
|
|
|
62464
62448
|
} else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && (t.types[0].flags & 65536 /* Null */ || t.types[1].flags & 65536 /* Null */)))) {
|
|
62465
62449
|
removeFromEach(typeSet, 65536 /* Null */);
|
|
62466
62450
|
result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
62451
|
+
} else if (typeSet.length >= 4) {
|
|
62452
|
+
const middle = Math.floor(typeSet.length / 2);
|
|
62453
|
+
result = getIntersectionType([getIntersectionType(typeSet.slice(0, middle)), getIntersectionType(typeSet.slice(middle))], aliasSymbol, aliasTypeArguments);
|
|
62467
62454
|
} else {
|
|
62468
62455
|
if (!checkCrossProductUnion(typeSet)) {
|
|
62469
62456
|
return errorType;
|
|
@@ -75540,17 +75527,9 @@ function createTypeChecker(host) {
|
|
|
75540
75527
|
);
|
|
75541
75528
|
return result;
|
|
75542
75529
|
}
|
|
75543
|
-
function getSuggestionForNonexistentSymbol(location, outerName, meaning) {
|
|
75544
|
-
const symbolResult = getSuggestedSymbolForNonexistentSymbol(location, outerName, meaning);
|
|
75545
|
-
return symbolResult && symbolName(symbolResult);
|
|
75546
|
-
}
|
|
75547
75530
|
function getSuggestedSymbolForNonexistentModule(name, targetModule) {
|
|
75548
75531
|
return targetModule.exports && getSpellingSuggestionForName(idText(name), getExportsOfModuleAsArray(targetModule), 2623475 /* ModuleMember */);
|
|
75549
75532
|
}
|
|
75550
|
-
function getSuggestionForNonexistentExport(name, targetModule) {
|
|
75551
|
-
const suggestion = getSuggestedSymbolForNonexistentModule(name, targetModule);
|
|
75552
|
-
return suggestion && symbolName(suggestion);
|
|
75553
|
-
}
|
|
75554
75533
|
function getSuggestionForNonexistentIndexSignature(objectType, expr, keyedType) {
|
|
75555
75534
|
function hasProp(name) {
|
|
75556
75535
|
const prop = getPropertyOfObjectType(objectType, name);
|
|
@@ -85271,14 +85250,16 @@ function createTypeChecker(host) {
|
|
|
85271
85250
|
if (!(nodeLinks2.flags & 1024 /* EnumValuesComputed */)) {
|
|
85272
85251
|
nodeLinks2.flags |= 1024 /* EnumValuesComputed */;
|
|
85273
85252
|
let autoValue = 0;
|
|
85253
|
+
let previous;
|
|
85274
85254
|
for (const member of node.members) {
|
|
85275
|
-
const value = computeMemberValue(member, autoValue);
|
|
85255
|
+
const value = computeMemberValue(member, autoValue, previous);
|
|
85276
85256
|
getNodeLinks(member).enumMemberValue = value;
|
|
85277
85257
|
autoValue = typeof value === "number" ? value + 1 : void 0;
|
|
85258
|
+
previous = member;
|
|
85278
85259
|
}
|
|
85279
85260
|
}
|
|
85280
85261
|
}
|
|
85281
|
-
function computeMemberValue(member, autoValue) {
|
|
85262
|
+
function computeMemberValue(member, autoValue, previous) {
|
|
85282
85263
|
if (isComputedNonLiteralName(member.name)) {
|
|
85283
85264
|
error2(member.name, Diagnostics.Computed_property_names_are_not_allowed_in_enums);
|
|
85284
85265
|
} else {
|
|
@@ -85293,11 +85274,17 @@ function createTypeChecker(host) {
|
|
|
85293
85274
|
if (member.parent.flags & 33554432 /* Ambient */ && !isEnumConst(member.parent)) {
|
|
85294
85275
|
return void 0;
|
|
85295
85276
|
}
|
|
85296
|
-
if (autoValue
|
|
85297
|
-
|
|
85277
|
+
if (autoValue === void 0) {
|
|
85278
|
+
error2(member.name, Diagnostics.Enum_member_must_have_initializer);
|
|
85279
|
+
return void 0;
|
|
85280
|
+
}
|
|
85281
|
+
if (getIsolatedModules(compilerOptions) && (previous == null ? void 0 : previous.initializer) && !isSyntacticallyNumericConstant(previous.initializer)) {
|
|
85282
|
+
error2(
|
|
85283
|
+
member.name,
|
|
85284
|
+
Diagnostics.Enum_member_following_a_non_literal_numeric_member_must_have_an_initializer_when_isolatedModules_is_enabled
|
|
85285
|
+
);
|
|
85298
85286
|
}
|
|
85299
|
-
|
|
85300
|
-
return void 0;
|
|
85287
|
+
return autoValue;
|
|
85301
85288
|
}
|
|
85302
85289
|
function computeConstantValue(member) {
|
|
85303
85290
|
const isConstEnum = isEnumConst(member.parent);
|
|
@@ -85309,6 +85296,12 @@ function createTypeChecker(host) {
|
|
|
85309
85296
|
initializer,
|
|
85310
85297
|
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
|
|
85311
85298
|
);
|
|
85299
|
+
} else if (getIsolatedModules(compilerOptions) && typeof value === "string" && !isSyntacticallyString(initializer)) {
|
|
85300
|
+
error2(
|
|
85301
|
+
initializer,
|
|
85302
|
+
Diagnostics._0_has_a_string_type_but_must_have_syntactically_recognizable_string_syntax_when_isolatedModules_is_enabled,
|
|
85303
|
+
`${idText(member.parent.name)}.${getTextOfPropertyName(member.name)}`
|
|
85304
|
+
);
|
|
85312
85305
|
}
|
|
85313
85306
|
} else if (isConstEnum) {
|
|
85314
85307
|
error2(initializer, Diagnostics.const_enum_member_initializers_must_be_constant_expressions);
|
|
@@ -85319,6 +85312,18 @@ function createTypeChecker(host) {
|
|
|
85319
85312
|
}
|
|
85320
85313
|
return value;
|
|
85321
85314
|
}
|
|
85315
|
+
function isSyntacticallyNumericConstant(expr) {
|
|
85316
|
+
expr = skipOuterExpressions(expr);
|
|
85317
|
+
switch (expr.kind) {
|
|
85318
|
+
case 224 /* PrefixUnaryExpression */:
|
|
85319
|
+
return isSyntacticallyNumericConstant(expr.operand);
|
|
85320
|
+
case 226 /* BinaryExpression */:
|
|
85321
|
+
return isSyntacticallyNumericConstant(expr.left) && isSyntacticallyNumericConstant(expr.right);
|
|
85322
|
+
case 9 /* NumericLiteral */:
|
|
85323
|
+
return true;
|
|
85324
|
+
}
|
|
85325
|
+
return false;
|
|
85326
|
+
}
|
|
85322
85327
|
function evaluate(expr, location) {
|
|
85323
85328
|
switch (expr.kind) {
|
|
85324
85329
|
case 224 /* PrefixUnaryExpression */:
|
|
@@ -87348,23 +87353,6 @@ function createTypeChecker(host) {
|
|
|
87348
87353
|
const isPropertyName2 = (isPropertyAccessExpression(parent2) || isPropertyAssignment(parent2)) && parent2.name === node;
|
|
87349
87354
|
return !isPropertyName2 && getReferencedValueSymbol(node) === argumentsSymbol;
|
|
87350
87355
|
}
|
|
87351
|
-
function moduleExportsSomeValue(moduleReferenceExpression) {
|
|
87352
|
-
let moduleSymbol = resolveExternalModuleName(moduleReferenceExpression.parent, moduleReferenceExpression);
|
|
87353
|
-
if (!moduleSymbol || isShorthandAmbientModuleSymbol(moduleSymbol)) {
|
|
87354
|
-
return true;
|
|
87355
|
-
}
|
|
87356
|
-
const hasExportAssignment = hasExportAssignmentSymbol(moduleSymbol);
|
|
87357
|
-
moduleSymbol = resolveExternalModuleSymbol(moduleSymbol);
|
|
87358
|
-
const symbolLinks2 = getSymbolLinks(moduleSymbol);
|
|
87359
|
-
if (symbolLinks2.exportsSomeValue === void 0) {
|
|
87360
|
-
symbolLinks2.exportsSomeValue = hasExportAssignment ? !!(moduleSymbol.flags & 111551 /* Value */) : forEachEntry(getExportsOfModule(moduleSymbol), isValue);
|
|
87361
|
-
}
|
|
87362
|
-
return symbolLinks2.exportsSomeValue;
|
|
87363
|
-
function isValue(s) {
|
|
87364
|
-
s = resolveSymbol(s);
|
|
87365
|
-
return s && !!(getSymbolFlags(s) & 111551 /* Value */);
|
|
87366
|
-
}
|
|
87367
|
-
}
|
|
87368
87356
|
function isNameOfModuleOrEnumDeclaration(node) {
|
|
87369
87357
|
return isModuleOrEnumDeclaration(node.parent) && node === node.parent.name;
|
|
87370
87358
|
}
|
|
@@ -87941,20 +87929,6 @@ function createTypeChecker(host) {
|
|
|
87941
87929
|
}
|
|
87942
87930
|
}
|
|
87943
87931
|
function createResolver() {
|
|
87944
|
-
const resolvedTypeReferenceDirectives = host.getResolvedTypeReferenceDirectives();
|
|
87945
|
-
let fileToDirective;
|
|
87946
|
-
if (resolvedTypeReferenceDirectives) {
|
|
87947
|
-
fileToDirective = /* @__PURE__ */ new Map();
|
|
87948
|
-
resolvedTypeReferenceDirectives.forEach(({ resolvedTypeReferenceDirective }, key, mode) => {
|
|
87949
|
-
if (!(resolvedTypeReferenceDirective == null ? void 0 : resolvedTypeReferenceDirective.resolvedFileName)) {
|
|
87950
|
-
return;
|
|
87951
|
-
}
|
|
87952
|
-
const file = host.getSourceFile(resolvedTypeReferenceDirective.resolvedFileName);
|
|
87953
|
-
if (file) {
|
|
87954
|
-
addReferencedFilesToTypeDirective(file, key, mode);
|
|
87955
|
-
}
|
|
87956
|
-
});
|
|
87957
|
-
}
|
|
87958
87932
|
return {
|
|
87959
87933
|
getReferencedExportContainer,
|
|
87960
87934
|
getReferencedImportDeclaration,
|
|
@@ -87994,14 +87968,11 @@ function createTypeChecker(host) {
|
|
|
87994
87968
|
getReferencedValueDeclarations,
|
|
87995
87969
|
getTypeReferenceSerializationKind,
|
|
87996
87970
|
isOptionalParameter,
|
|
87997
|
-
moduleExportsSomeValue,
|
|
87998
87971
|
isArgumentsLocalBinding,
|
|
87999
87972
|
getExternalModuleFileFromDeclaration: (nodeIn) => {
|
|
88000
87973
|
const node = getParseTreeNode(nodeIn, hasPossibleExternalModuleReference);
|
|
88001
87974
|
return node && getExternalModuleFileFromDeclaration(node);
|
|
88002
87975
|
},
|
|
88003
|
-
getTypeReferenceDirectivesForEntityName,
|
|
88004
|
-
getTypeReferenceDirectivesForSymbol,
|
|
88005
87976
|
isLiteralConstDeclaration,
|
|
88006
87977
|
isLateBound: (nodeIn) => {
|
|
88007
87978
|
const node = getParseTreeNode(nodeIn, isDeclaration);
|
|
@@ -88025,12 +87996,6 @@ function createTypeChecker(host) {
|
|
|
88025
87996
|
getAccessor
|
|
88026
87997
|
};
|
|
88027
87998
|
},
|
|
88028
|
-
getSymbolOfExternalModuleSpecifier: (moduleName) => resolveExternalModuleNameWorker(
|
|
88029
|
-
moduleName,
|
|
88030
|
-
moduleName,
|
|
88031
|
-
/*moduleNotFoundError*/
|
|
88032
|
-
void 0
|
|
88033
|
-
),
|
|
88034
87999
|
isBindingCapturedByNode: (node, decl) => {
|
|
88035
88000
|
const parseNode = getParseTreeNode(node);
|
|
88036
88001
|
const parseDecl = getParseTreeNode(decl);
|
|
@@ -88045,16 +88010,7 @@ function createTypeChecker(host) {
|
|
|
88045
88010
|
}
|
|
88046
88011
|
return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, tracker, bundled);
|
|
88047
88012
|
},
|
|
88048
|
-
isImportRequiredByAugmentation
|
|
88049
|
-
tryFindAmbientModule: (moduleReferenceExpression) => {
|
|
88050
|
-
const node = getParseTreeNode(moduleReferenceExpression);
|
|
88051
|
-
const moduleSpecifier = node && isStringLiteralLike(node) ? node.text : void 0;
|
|
88052
|
-
return moduleSpecifier !== void 0 ? tryFindAmbientModule(
|
|
88053
|
-
moduleSpecifier,
|
|
88054
|
-
/*withAugmentations*/
|
|
88055
|
-
true
|
|
88056
|
-
) : void 0;
|
|
88057
|
-
}
|
|
88013
|
+
isImportRequiredByAugmentation
|
|
88058
88014
|
};
|
|
88059
88015
|
function isImportRequiredByAugmentation(node) {
|
|
88060
88016
|
const file = getSourceFileOfNode(node);
|
|
@@ -88081,84 +88037,6 @@ function createTypeChecker(host) {
|
|
|
88081
88037
|
}
|
|
88082
88038
|
return false;
|
|
88083
88039
|
}
|
|
88084
|
-
function isInHeritageClause(node) {
|
|
88085
|
-
return node.parent && node.parent.kind === 233 /* ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 298 /* HeritageClause */;
|
|
88086
|
-
}
|
|
88087
|
-
function getTypeReferenceDirectivesForEntityName(node) {
|
|
88088
|
-
if (!fileToDirective) {
|
|
88089
|
-
return void 0;
|
|
88090
|
-
}
|
|
88091
|
-
let meaning;
|
|
88092
|
-
if (node.parent.kind === 167 /* ComputedPropertyName */) {
|
|
88093
|
-
meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
|
|
88094
|
-
} else {
|
|
88095
|
-
meaning = 788968 /* Type */ | 1920 /* Namespace */;
|
|
88096
|
-
if (node.kind === 80 /* Identifier */ && isInTypeQuery(node) || node.kind === 211 /* PropertyAccessExpression */ && !isInHeritageClause(node)) {
|
|
88097
|
-
meaning = 111551 /* Value */ | 1048576 /* ExportValue */;
|
|
88098
|
-
}
|
|
88099
|
-
}
|
|
88100
|
-
const symbol = resolveEntityName(
|
|
88101
|
-
node,
|
|
88102
|
-
meaning,
|
|
88103
|
-
/*ignoreErrors*/
|
|
88104
|
-
true
|
|
88105
|
-
);
|
|
88106
|
-
return symbol && symbol !== unknownSymbol ? getTypeReferenceDirectivesForSymbol(symbol, meaning) : void 0;
|
|
88107
|
-
}
|
|
88108
|
-
function getTypeReferenceDirectivesForSymbol(symbol, meaning) {
|
|
88109
|
-
if (!fileToDirective || !isSymbolFromTypeDeclarationFile(symbol)) {
|
|
88110
|
-
return void 0;
|
|
88111
|
-
}
|
|
88112
|
-
let typeReferenceDirectives;
|
|
88113
|
-
for (const decl of symbol.declarations) {
|
|
88114
|
-
if (decl.symbol && decl.symbol.flags & meaning) {
|
|
88115
|
-
const file = getSourceFileOfNode(decl);
|
|
88116
|
-
const typeReferenceDirective = fileToDirective.get(file.path);
|
|
88117
|
-
if (typeReferenceDirective) {
|
|
88118
|
-
(typeReferenceDirectives || (typeReferenceDirectives = [])).push(typeReferenceDirective);
|
|
88119
|
-
} else {
|
|
88120
|
-
return void 0;
|
|
88121
|
-
}
|
|
88122
|
-
}
|
|
88123
|
-
}
|
|
88124
|
-
return typeReferenceDirectives;
|
|
88125
|
-
}
|
|
88126
|
-
function isSymbolFromTypeDeclarationFile(symbol) {
|
|
88127
|
-
if (!symbol.declarations) {
|
|
88128
|
-
return false;
|
|
88129
|
-
}
|
|
88130
|
-
let current = symbol;
|
|
88131
|
-
while (true) {
|
|
88132
|
-
const parent2 = getParentOfSymbol(current);
|
|
88133
|
-
if (parent2) {
|
|
88134
|
-
current = parent2;
|
|
88135
|
-
} else {
|
|
88136
|
-
break;
|
|
88137
|
-
}
|
|
88138
|
-
}
|
|
88139
|
-
if (current.valueDeclaration && current.valueDeclaration.kind === 307 /* SourceFile */ && current.flags & 512 /* ValueModule */) {
|
|
88140
|
-
return false;
|
|
88141
|
-
}
|
|
88142
|
-
for (const decl of symbol.declarations) {
|
|
88143
|
-
const file = getSourceFileOfNode(decl);
|
|
88144
|
-
if (fileToDirective.has(file.path)) {
|
|
88145
|
-
return true;
|
|
88146
|
-
}
|
|
88147
|
-
}
|
|
88148
|
-
return false;
|
|
88149
|
-
}
|
|
88150
|
-
function addReferencedFilesToTypeDirective(file, key, mode) {
|
|
88151
|
-
if (fileToDirective.has(file.path))
|
|
88152
|
-
return;
|
|
88153
|
-
fileToDirective.set(file.path, [key, mode]);
|
|
88154
|
-
for (const { fileName } of file.referencedFiles) {
|
|
88155
|
-
const resolvedFile = resolveTripleslashReference(fileName, file.fileName);
|
|
88156
|
-
const referencedFile = host.getSourceFile(resolvedFile);
|
|
88157
|
-
if (referencedFile) {
|
|
88158
|
-
addReferencedFilesToTypeDirective(referencedFile, key, mode || file.impliedNodeFormat);
|
|
88159
|
-
}
|
|
88160
|
-
}
|
|
88161
|
-
}
|
|
88162
88040
|
}
|
|
88163
88041
|
function getExternalModuleFileFromDeclaration(declaration) {
|
|
88164
88042
|
const specifier = declaration.kind === 267 /* ModuleDeclaration */ ? tryCast(declaration.name, isStringLiteral) : getExternalModuleName(declaration);
|
|
@@ -90082,20 +89960,6 @@ var SymbolTrackerImpl = class _SymbolTrackerImpl {
|
|
|
90082
89960
|
this.inner.reportTruncationError();
|
|
90083
89961
|
}
|
|
90084
89962
|
}
|
|
90085
|
-
trackReferencedAmbientModule(decl, symbol) {
|
|
90086
|
-
var _a;
|
|
90087
|
-
if ((_a = this.inner) == null ? void 0 : _a.trackReferencedAmbientModule) {
|
|
90088
|
-
this.onDiagnosticReported();
|
|
90089
|
-
this.inner.trackReferencedAmbientModule(decl, symbol);
|
|
90090
|
-
}
|
|
90091
|
-
}
|
|
90092
|
-
trackExternalModuleSymbolOfImportTypeNode(symbol) {
|
|
90093
|
-
var _a;
|
|
90094
|
-
if ((_a = this.inner) == null ? void 0 : _a.trackExternalModuleSymbolOfImportTypeNode) {
|
|
90095
|
-
this.onDiagnosticReported();
|
|
90096
|
-
this.inner.trackExternalModuleSymbolOfImportTypeNode(symbol);
|
|
90097
|
-
}
|
|
90098
|
-
}
|
|
90099
89963
|
reportNonlocalAugmentation(containingFile, parentSymbol, augmentingSymbol) {
|
|
90100
89964
|
var _a;
|
|
90101
89965
|
if ((_a = this.inner) == null ? void 0 : _a.reportNonlocalAugmentation) {
|
|
@@ -113287,11 +113151,9 @@ function transformDeclarations(context) {
|
|
|
113287
113151
|
let needsScopeFixMarker = false;
|
|
113288
113152
|
let resultHasScopeMarker = false;
|
|
113289
113153
|
let enclosingDeclaration;
|
|
113290
|
-
let necessaryTypeReferences;
|
|
113291
113154
|
let lateMarkedStatements;
|
|
113292
113155
|
let lateStatementReplacementMap;
|
|
113293
113156
|
let suppressNewDiagnosticContexts;
|
|
113294
|
-
let exportedModulesFromDeclarationEmit;
|
|
113295
113157
|
const { factory: factory2 } = context;
|
|
113296
113158
|
const host = context.getEmitHost();
|
|
113297
113159
|
const symbolTracker = {
|
|
@@ -113303,49 +113165,19 @@ function transformDeclarations(context) {
|
|
|
113303
113165
|
reportLikelyUnsafeImportRequiredError,
|
|
113304
113166
|
reportTruncationError,
|
|
113305
113167
|
moduleResolverHost: host,
|
|
113306
|
-
trackReferencedAmbientModule,
|
|
113307
|
-
trackExternalModuleSymbolOfImportTypeNode,
|
|
113308
113168
|
reportNonlocalAugmentation,
|
|
113309
113169
|
reportNonSerializableProperty
|
|
113310
113170
|
};
|
|
113311
113171
|
let errorNameNode;
|
|
113312
113172
|
let errorFallbackNode;
|
|
113313
113173
|
let currentSourceFile;
|
|
113314
|
-
let
|
|
113315
|
-
let
|
|
113316
|
-
let
|
|
113174
|
+
let rawReferencedFiles;
|
|
113175
|
+
let rawTypeReferenceDirectives;
|
|
113176
|
+
let rawLibReferenceDirectives;
|
|
113317
113177
|
const resolver = context.getEmitResolver();
|
|
113318
113178
|
const options = context.getCompilerOptions();
|
|
113319
|
-
const {
|
|
113179
|
+
const { stripInternal } = options;
|
|
113320
113180
|
return transformRoot;
|
|
113321
|
-
function recordTypeReferenceDirectivesIfNecessary(typeReferenceDirectives) {
|
|
113322
|
-
if (!typeReferenceDirectives) {
|
|
113323
|
-
return;
|
|
113324
|
-
}
|
|
113325
|
-
necessaryTypeReferences = necessaryTypeReferences || /* @__PURE__ */ new Set();
|
|
113326
|
-
for (const ref of typeReferenceDirectives) {
|
|
113327
|
-
necessaryTypeReferences.add(ref);
|
|
113328
|
-
}
|
|
113329
|
-
}
|
|
113330
|
-
function trackReferencedAmbientModule(node, symbol) {
|
|
113331
|
-
const directives = resolver.getTypeReferenceDirectivesForSymbol(symbol, -1 /* All */);
|
|
113332
|
-
if (length(directives)) {
|
|
113333
|
-
return recordTypeReferenceDirectivesIfNecessary(directives);
|
|
113334
|
-
}
|
|
113335
|
-
const container = getSourceFileOfNode(node);
|
|
113336
|
-
refs.set(getOriginalNodeId(container), container);
|
|
113337
|
-
}
|
|
113338
|
-
function trackReferencedAmbientModuleFromImport(node) {
|
|
113339
|
-
const moduleSpecifier = tryGetModuleSpecifierFromDeclaration(node);
|
|
113340
|
-
const symbol = moduleSpecifier && resolver.tryFindAmbientModule(moduleSpecifier);
|
|
113341
|
-
if (symbol == null ? void 0 : symbol.declarations) {
|
|
113342
|
-
for (const decl of symbol.declarations) {
|
|
113343
|
-
if (isAmbientModule(decl) && getSourceFileOfNode(decl) !== currentSourceFile) {
|
|
113344
|
-
trackReferencedAmbientModule(decl, symbol);
|
|
113345
|
-
}
|
|
113346
|
-
}
|
|
113347
|
-
}
|
|
113348
|
-
}
|
|
113349
113181
|
function handleSymbolAccessibilityError(symbolAccessibilityResult) {
|
|
113350
113182
|
if (symbolAccessibilityResult.accessibility === 0 /* Accessible */) {
|
|
113351
113183
|
if (symbolAccessibilityResult.aliasesToMakeVisible) {
|
|
@@ -113370,11 +113202,6 @@ function transformDeclarations(context) {
|
|
|
113370
113202
|
}
|
|
113371
113203
|
return false;
|
|
113372
113204
|
}
|
|
113373
|
-
function trackExternalModuleSymbolOfImportTypeNode(symbol) {
|
|
113374
|
-
if (!isBundledEmit) {
|
|
113375
|
-
(exportedModulesFromDeclarationEmit || (exportedModulesFromDeclarationEmit = [])).push(symbol);
|
|
113376
|
-
}
|
|
113377
|
-
}
|
|
113378
113205
|
function trackSymbol(symbol, enclosingDeclaration2, meaning) {
|
|
113379
113206
|
if (symbol.flags & 262144 /* TypeParameter */)
|
|
113380
113207
|
return false;
|
|
@@ -113385,7 +113212,6 @@ function transformDeclarations(context) {
|
|
|
113385
113212
|
/*shouldComputeAliasToMarkVisible*/
|
|
113386
113213
|
true
|
|
113387
113214
|
));
|
|
113388
|
-
recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForSymbol(symbol, meaning));
|
|
113389
113215
|
return issuedDiagnostic;
|
|
113390
113216
|
}
|
|
113391
113217
|
function reportPrivateInBaseOfClassExpression(propertyName) {
|
|
@@ -113457,8 +113283,9 @@ function transformDeclarations(context) {
|
|
|
113457
113283
|
}
|
|
113458
113284
|
if (node.kind === 308 /* Bundle */) {
|
|
113459
113285
|
isBundledEmit = true;
|
|
113460
|
-
|
|
113461
|
-
|
|
113286
|
+
rawReferencedFiles = [];
|
|
113287
|
+
rawTypeReferenceDirectives = [];
|
|
113288
|
+
rawLibReferenceDirectives = [];
|
|
113462
113289
|
let hasNoDefaultLib = false;
|
|
113463
113290
|
const bundle = factory2.createBundle(
|
|
113464
113291
|
map(node.sourceFiles, (sourceFile) => {
|
|
@@ -113473,8 +113300,7 @@ function transformDeclarations(context) {
|
|
|
113473
113300
|
getSymbolAccessibilityDiagnostic = throwDiagnostic;
|
|
113474
113301
|
needsScopeFixMarker = false;
|
|
113475
113302
|
resultHasScopeMarker = false;
|
|
113476
|
-
|
|
113477
|
-
collectLibs(sourceFile, libs2);
|
|
113303
|
+
collectFileReferences(sourceFile);
|
|
113478
113304
|
if (isExternalOrCommonJsModule(sourceFile) || isJsonSourceFile(sourceFile)) {
|
|
113479
113305
|
resultHasExternalModuleIndicator = false;
|
|
113480
113306
|
needsDeclare = false;
|
|
@@ -113521,18 +113347,16 @@ function transformDeclarations(context) {
|
|
|
113521
113347
|
);
|
|
113522
113348
|
})
|
|
113523
113349
|
);
|
|
113524
|
-
bundle.syntheticFileReferences = [];
|
|
113525
|
-
bundle.syntheticTypeReferences = getFileReferencesForUsedTypeReferences();
|
|
113526
|
-
bundle.syntheticLibReferences = getLibReferences();
|
|
113527
|
-
bundle.hasNoDefaultLib = hasNoDefaultLib;
|
|
113528
113350
|
const outputFilePath2 = getDirectoryPath(normalizeSlashes(getOutputPathsFor(
|
|
113529
113351
|
node,
|
|
113530
113352
|
host,
|
|
113531
113353
|
/*forceDtsPaths*/
|
|
113532
113354
|
true
|
|
113533
113355
|
).declarationFilePath));
|
|
113534
|
-
|
|
113535
|
-
|
|
113356
|
+
bundle.syntheticFileReferences = getReferencedFiles(outputFilePath2);
|
|
113357
|
+
bundle.syntheticTypeReferences = getTypeReferences();
|
|
113358
|
+
bundle.syntheticLibReferences = getLibReferences();
|
|
113359
|
+
bundle.hasNoDefaultLib = hasNoDefaultLib;
|
|
113536
113360
|
return bundle;
|
|
113537
113361
|
}
|
|
113538
113362
|
needsDeclare = true;
|
|
@@ -113546,66 +113370,68 @@ function transformDeclarations(context) {
|
|
|
113546
113370
|
suppressNewDiagnosticContexts = false;
|
|
113547
113371
|
lateMarkedStatements = void 0;
|
|
113548
113372
|
lateStatementReplacementMap = /* @__PURE__ */ new Map();
|
|
113549
|
-
|
|
113550
|
-
|
|
113551
|
-
|
|
113552
|
-
|
|
113553
|
-
const outputFilePath = getDirectoryPath(normalizeSlashes(getOutputPathsFor(
|
|
113554
|
-
node,
|
|
113555
|
-
host,
|
|
113556
|
-
/*forceDtsPaths*/
|
|
113557
|
-
true
|
|
113558
|
-
).declarationFilePath));
|
|
113559
|
-
const referenceVisitor = mapReferencesIntoArray(references, outputFilePath);
|
|
113373
|
+
rawReferencedFiles = [];
|
|
113374
|
+
rawTypeReferenceDirectives = [];
|
|
113375
|
+
rawLibReferenceDirectives = [];
|
|
113376
|
+
collectFileReferences(currentSourceFile);
|
|
113560
113377
|
let combinedStatements;
|
|
113561
113378
|
if (isSourceFileJS(currentSourceFile)) {
|
|
113562
113379
|
combinedStatements = factory2.createNodeArray(transformDeclarationsForJS(node));
|
|
113563
|
-
refs.forEach(referenceVisitor);
|
|
113564
|
-
emittedImports = filter(combinedStatements, isAnyImportSyntax);
|
|
113565
113380
|
} else {
|
|
113566
113381
|
const statements = visitNodes2(node.statements, visitDeclarationStatements, isStatement);
|
|
113567
113382
|
combinedStatements = setTextRange(factory2.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), node.statements);
|
|
113568
|
-
refs.forEach(referenceVisitor);
|
|
113569
|
-
emittedImports = filter(combinedStatements, isAnyImportSyntax);
|
|
113570
113383
|
if (isExternalModule(node) && (!resultHasExternalModuleIndicator || needsScopeFixMarker && !resultHasScopeMarker)) {
|
|
113571
113384
|
combinedStatements = setTextRange(factory2.createNodeArray([...combinedStatements, createEmptyExports(factory2)]), combinedStatements);
|
|
113572
113385
|
}
|
|
113573
113386
|
}
|
|
113387
|
+
const outputFilePath = getDirectoryPath(normalizeSlashes(getOutputPathsFor(
|
|
113388
|
+
node,
|
|
113389
|
+
host,
|
|
113390
|
+
/*forceDtsPaths*/
|
|
113391
|
+
true
|
|
113392
|
+
).declarationFilePath));
|
|
113574
113393
|
return factory2.updateSourceFile(
|
|
113575
113394
|
node,
|
|
113576
113395
|
combinedStatements,
|
|
113577
113396
|
/*isDeclarationFile*/
|
|
113578
113397
|
true,
|
|
113579
|
-
|
|
113580
|
-
|
|
113398
|
+
getReferencedFiles(outputFilePath),
|
|
113399
|
+
getTypeReferences(),
|
|
113581
113400
|
node.hasNoDefaultLib,
|
|
113582
113401
|
getLibReferences()
|
|
113583
113402
|
);
|
|
113584
|
-
function
|
|
113585
|
-
|
|
113403
|
+
function collectFileReferences(sourceFile) {
|
|
113404
|
+
rawReferencedFiles = concatenate(rawReferencedFiles, map(sourceFile.referencedFiles, (f) => [sourceFile, f]));
|
|
113405
|
+
rawTypeReferenceDirectives = concatenate(rawTypeReferenceDirectives, sourceFile.typeReferenceDirectives);
|
|
113406
|
+
rawLibReferenceDirectives = concatenate(rawLibReferenceDirectives, sourceFile.libReferenceDirectives);
|
|
113586
113407
|
}
|
|
113587
|
-
function
|
|
113588
|
-
|
|
113408
|
+
function copyFileReferenceAsSynthetic(ref) {
|
|
113409
|
+
const newRef = { ...ref };
|
|
113410
|
+
newRef.pos = -1;
|
|
113411
|
+
newRef.end = -1;
|
|
113412
|
+
return newRef;
|
|
113589
113413
|
}
|
|
113590
|
-
function
|
|
113591
|
-
|
|
113592
|
-
|
|
113593
|
-
|
|
113594
|
-
|
|
113595
|
-
|
|
113596
|
-
return void 0;
|
|
113597
|
-
}
|
|
113598
|
-
} else if (isImportDeclaration(importStatement) && isStringLiteral(importStatement.moduleSpecifier) && importStatement.moduleSpecifier.text === typeName) {
|
|
113599
|
-
return void 0;
|
|
113600
|
-
}
|
|
113601
|
-
}
|
|
113602
|
-
}
|
|
113603
|
-
return { fileName: typeName, pos: -1, end: -1, ...mode ? { resolutionMode: mode } : void 0 };
|
|
113414
|
+
function getTypeReferences() {
|
|
113415
|
+
return mapDefined(rawTypeReferenceDirectives, (ref) => {
|
|
113416
|
+
if (!ref.preserve)
|
|
113417
|
+
return void 0;
|
|
113418
|
+
return copyFileReferenceAsSynthetic(ref);
|
|
113419
|
+
});
|
|
113604
113420
|
}
|
|
113605
|
-
function
|
|
113606
|
-
return (
|
|
113607
|
-
if (
|
|
113608
|
-
return;
|
|
113421
|
+
function getLibReferences() {
|
|
113422
|
+
return mapDefined(rawLibReferenceDirectives, (ref) => {
|
|
113423
|
+
if (!ref.preserve)
|
|
113424
|
+
return void 0;
|
|
113425
|
+
return copyFileReferenceAsSynthetic(ref);
|
|
113426
|
+
});
|
|
113427
|
+
}
|
|
113428
|
+
function getReferencedFiles(outputFilePath2) {
|
|
113429
|
+
return mapDefined(rawReferencedFiles, ([sourceFile, ref]) => {
|
|
113430
|
+
if (!ref.preserve)
|
|
113431
|
+
return void 0;
|
|
113432
|
+
const file = host.getSourceFileFromReference(sourceFile, ref);
|
|
113433
|
+
if (!file) {
|
|
113434
|
+
return void 0;
|
|
113609
113435
|
}
|
|
113610
113436
|
let declFileName;
|
|
113611
113437
|
if (file.isDeclarationFile) {
|
|
@@ -113621,61 +113447,22 @@ function transformDeclarations(context) {
|
|
|
113621
113447
|
);
|
|
113622
113448
|
declFileName = paths.declarationFilePath || paths.jsFilePath || file.fileName;
|
|
113623
113449
|
}
|
|
113624
|
-
if (declFileName)
|
|
113625
|
-
|
|
113626
|
-
|
|
113627
|
-
|
|
113628
|
-
|
|
113629
|
-
|
|
113630
|
-
|
|
113631
|
-
|
|
113632
|
-
|
|
113633
|
-
|
|
113634
|
-
|
|
113635
|
-
|
|
113636
|
-
|
|
113637
|
-
|
|
113638
|
-
return;
|
|
113639
|
-
}
|
|
113640
|
-
let fileName = getRelativePathToDirectoryOrUrl(
|
|
113641
|
-
outputFilePath2,
|
|
113642
|
-
declFileName,
|
|
113643
|
-
host.getCurrentDirectory(),
|
|
113644
|
-
host.getCanonicalFileName,
|
|
113645
|
-
/*isAbsolutePathAnUrl*/
|
|
113646
|
-
false
|
|
113647
|
-
);
|
|
113648
|
-
if (startsWith(fileName, "./") && hasExtension(fileName)) {
|
|
113649
|
-
fileName = fileName.substring(2);
|
|
113650
|
-
}
|
|
113651
|
-
if (startsWith(fileName, "node_modules/") || pathContainsNodeModules(fileName)) {
|
|
113652
|
-
return;
|
|
113653
|
-
}
|
|
113654
|
-
references2.push({ pos: -1, end: -1, fileName });
|
|
113655
|
-
}
|
|
113656
|
-
};
|
|
113450
|
+
if (!declFileName)
|
|
113451
|
+
return void 0;
|
|
113452
|
+
const fileName = getRelativePathToDirectoryOrUrl(
|
|
113453
|
+
outputFilePath2,
|
|
113454
|
+
declFileName,
|
|
113455
|
+
host.getCurrentDirectory(),
|
|
113456
|
+
host.getCanonicalFileName,
|
|
113457
|
+
/*isAbsolutePathAnUrl*/
|
|
113458
|
+
false
|
|
113459
|
+
);
|
|
113460
|
+
const newRef = copyFileReferenceAsSynthetic(ref);
|
|
113461
|
+
newRef.fileName = fileName;
|
|
113462
|
+
return newRef;
|
|
113463
|
+
});
|
|
113657
113464
|
}
|
|
113658
113465
|
}
|
|
113659
|
-
function collectReferences(sourceFile, ret) {
|
|
113660
|
-
if (noResolve || isSourceFileJS(sourceFile))
|
|
113661
|
-
return ret;
|
|
113662
|
-
forEach(sourceFile.referencedFiles, (f) => {
|
|
113663
|
-
const elem = host.getSourceFileFromReference(sourceFile, f);
|
|
113664
|
-
if (elem) {
|
|
113665
|
-
ret.set(getOriginalNodeId(elem), elem);
|
|
113666
|
-
}
|
|
113667
|
-
});
|
|
113668
|
-
return ret;
|
|
113669
|
-
}
|
|
113670
|
-
function collectLibs(sourceFile, ret) {
|
|
113671
|
-
forEach(sourceFile.libReferenceDirectives, (ref) => {
|
|
113672
|
-
const lib = host.getLibFileFromReference(ref);
|
|
113673
|
-
if (lib) {
|
|
113674
|
-
ret.set(toFileNameLowerCase(ref.fileName), true);
|
|
113675
|
-
}
|
|
113676
|
-
});
|
|
113677
|
-
return ret;
|
|
113678
|
-
}
|
|
113679
113466
|
function filterBindingPatternInitializers(name) {
|
|
113680
113467
|
if (name.kind === 80 /* Identifier */) {
|
|
113681
113468
|
return name;
|
|
@@ -113874,7 +113661,6 @@ function transformDeclarations(context) {
|
|
|
113874
113661
|
function checkEntityNameVisibility(entityName, enclosingDeclaration2) {
|
|
113875
113662
|
const visibilityResult = resolver.isEntityNameVisible(entityName, enclosingDeclaration2);
|
|
113876
113663
|
handleSymbolAccessibilityError(visibilityResult);
|
|
113877
|
-
recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName));
|
|
113878
113664
|
}
|
|
113879
113665
|
function preserveJsDoc(updated, original) {
|
|
113880
113666
|
if (hasJSDocNodes(updated) && hasJSDocNodes(original)) {
|
|
@@ -113892,11 +113678,6 @@ function transformDeclarations(context) {
|
|
|
113892
113678
|
if (newName) {
|
|
113893
113679
|
return factory2.createStringLiteral(newName);
|
|
113894
113680
|
}
|
|
113895
|
-
} else {
|
|
113896
|
-
const symbol = resolver.getSymbolOfExternalModuleSpecifier(input);
|
|
113897
|
-
if (symbol) {
|
|
113898
|
-
(exportedModulesFromDeclarationEmit || (exportedModulesFromDeclarationEmit = [])).push(symbol);
|
|
113899
|
-
}
|
|
113900
113681
|
}
|
|
113901
113682
|
}
|
|
113902
113683
|
return input;
|
|
@@ -114289,7 +114070,6 @@ function transformDeclarations(context) {
|
|
|
114289
114070
|
case 205 /* ImportType */: {
|
|
114290
114071
|
if (!isLiteralImportTypeNode(input))
|
|
114291
114072
|
return cleanup(input);
|
|
114292
|
-
trackReferencedAmbientModuleFromImport(input);
|
|
114293
114073
|
return cleanup(factory2.updateImportTypeNode(
|
|
114294
114074
|
input,
|
|
114295
114075
|
factory2.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)),
|
|
@@ -114341,7 +114121,6 @@ function transformDeclarations(context) {
|
|
|
114341
114121
|
resultHasExternalModuleIndicator = true;
|
|
114342
114122
|
}
|
|
114343
114123
|
resultHasScopeMarker = true;
|
|
114344
|
-
trackReferencedAmbientModuleFromImport(input);
|
|
114345
114124
|
return factory2.updateExportDeclaration(
|
|
114346
114125
|
input,
|
|
114347
114126
|
input.modifiers,
|
|
@@ -114416,18 +114195,10 @@ function transformDeclarations(context) {
|
|
|
114416
114195
|
return;
|
|
114417
114196
|
switch (input.kind) {
|
|
114418
114197
|
case 271 /* ImportEqualsDeclaration */: {
|
|
114419
|
-
|
|
114420
|
-
if (transformed) {
|
|
114421
|
-
trackReferencedAmbientModuleFromImport(input);
|
|
114422
|
-
}
|
|
114423
|
-
return transformed;
|
|
114198
|
+
return transformImportEqualsDeclaration(input);
|
|
114424
114199
|
}
|
|
114425
114200
|
case 272 /* ImportDeclaration */: {
|
|
114426
|
-
|
|
114427
|
-
if (transformed) {
|
|
114428
|
-
trackReferencedAmbientModuleFromImport(input);
|
|
114429
|
-
}
|
|
114430
|
-
return transformed;
|
|
114201
|
+
return transformImportDeclaration(input);
|
|
114431
114202
|
}
|
|
114432
114203
|
}
|
|
114433
114204
|
if (isDeclaration(input) && isDeclarationAndNotVisible(input))
|
|
@@ -115997,20 +115768,15 @@ var notImplementedResolver = {
|
|
|
115997
115768
|
getReferencedValueDeclarations: notImplemented,
|
|
115998
115769
|
getTypeReferenceSerializationKind: notImplemented,
|
|
115999
115770
|
isOptionalParameter: notImplemented,
|
|
116000
|
-
moduleExportsSomeValue: notImplemented,
|
|
116001
115771
|
isArgumentsLocalBinding: notImplemented,
|
|
116002
115772
|
getExternalModuleFileFromDeclaration: notImplemented,
|
|
116003
|
-
getTypeReferenceDirectivesForEntityName: notImplemented,
|
|
116004
|
-
getTypeReferenceDirectivesForSymbol: notImplemented,
|
|
116005
115773
|
isLiteralConstDeclaration: notImplemented,
|
|
116006
115774
|
getJsxFactoryEntity: notImplemented,
|
|
116007
115775
|
getJsxFragmentFactoryEntity: notImplemented,
|
|
116008
115776
|
getAllAccessorDeclarations: notImplemented,
|
|
116009
|
-
getSymbolOfExternalModuleSpecifier: notImplemented,
|
|
116010
115777
|
isBindingCapturedByNode: notImplemented,
|
|
116011
115778
|
getDeclarationStatementsForSourceFile: notImplemented,
|
|
116012
|
-
isImportRequiredByAugmentation: notImplemented
|
|
116013
|
-
tryFindAmbientModule: notImplemented
|
|
115779
|
+
isImportRequiredByAugmentation: notImplemented
|
|
116014
115780
|
};
|
|
116015
115781
|
var createPrinterWithDefaults = /* @__PURE__ */ memoize(() => createPrinter({}));
|
|
116016
115782
|
var createPrinterWithRemoveComments = /* @__PURE__ */ memoize(() => createPrinter({ removeComments: true }));
|
|
@@ -118765,19 +118531,17 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
118765
118531
|
writeLine();
|
|
118766
118532
|
}
|
|
118767
118533
|
}
|
|
118768
|
-
|
|
118769
|
-
|
|
118770
|
-
|
|
118771
|
-
|
|
118772
|
-
|
|
118773
|
-
|
|
118774
|
-
|
|
118775
|
-
writeLine();
|
|
118776
|
-
}
|
|
118777
|
-
for (const directive of libs2) {
|
|
118778
|
-
writeComment(`/// <reference lib="${directive.fileName}" />`);
|
|
118779
|
-
writeLine();
|
|
118534
|
+
function writeDirectives(kind, directives) {
|
|
118535
|
+
for (const directive of directives) {
|
|
118536
|
+
const resolutionMode = directive.resolutionMode ? `resolution-mode="${directive.resolutionMode === 99 /* ESNext */ ? "import" : "require"}" ` : "";
|
|
118537
|
+
const preserve = directive.preserve ? `preserve="true" ` : "";
|
|
118538
|
+
writeComment(`/// <reference ${kind}="${directive.fileName}" ${resolutionMode}${preserve}/>`);
|
|
118539
|
+
writeLine();
|
|
118540
|
+
}
|
|
118780
118541
|
}
|
|
118542
|
+
writeDirectives("path", files);
|
|
118543
|
+
writeDirectives("types", types);
|
|
118544
|
+
writeDirectives("lib", libs2);
|
|
118781
118545
|
}
|
|
118782
118546
|
function emitSourceFileWorker(node) {
|
|
118783
118547
|
const statements = node.statements;
|
|
@@ -122657,7 +122421,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
122657
122421
|
getSourceFile: program.getSourceFile,
|
|
122658
122422
|
getSourceFileByPath: program.getSourceFileByPath,
|
|
122659
122423
|
getSourceFiles: program.getSourceFiles,
|
|
122660
|
-
getLibFileFromReference: program.getLibFileFromReference,
|
|
122661
122424
|
isSourceFileFromExternalLibrary,
|
|
122662
122425
|
getResolvedProjectReferenceToRedirect,
|
|
122663
122426
|
getProjectReferenceRedirect,
|
|
@@ -131405,11 +131168,11 @@ var OrganizeImportsMode = /* @__PURE__ */ ((OrganizeImportsMode2) => {
|
|
|
131405
131168
|
OrganizeImportsMode2["RemoveUnused"] = "RemoveUnused";
|
|
131406
131169
|
return OrganizeImportsMode2;
|
|
131407
131170
|
})(OrganizeImportsMode || {});
|
|
131408
|
-
var CompletionTriggerKind = /* @__PURE__ */ ((
|
|
131409
|
-
|
|
131410
|
-
|
|
131411
|
-
|
|
131412
|
-
return
|
|
131171
|
+
var CompletionTriggerKind = /* @__PURE__ */ ((CompletionTriggerKind2) => {
|
|
131172
|
+
CompletionTriggerKind2[CompletionTriggerKind2["Invoked"] = 1] = "Invoked";
|
|
131173
|
+
CompletionTriggerKind2[CompletionTriggerKind2["TriggerCharacter"] = 2] = "TriggerCharacter";
|
|
131174
|
+
CompletionTriggerKind2[CompletionTriggerKind2["TriggerForIncompleteCompletions"] = 3] = "TriggerForIncompleteCompletions";
|
|
131175
|
+
return CompletionTriggerKind2;
|
|
131413
131176
|
})(CompletionTriggerKind || {});
|
|
131414
131177
|
var InlayHintKind = /* @__PURE__ */ ((InlayHintKind2) => {
|
|
131415
131178
|
InlayHintKind2["Type"] = "Type";
|
|
@@ -133029,9 +132792,13 @@ function createTextSpanFromNode(node, sourceFile, endNode2) {
|
|
|
133029
132792
|
return createTextSpanFromBounds(node.getStart(sourceFile), (endNode2 || node).getEnd());
|
|
133030
132793
|
}
|
|
133031
132794
|
function createTextSpanFromStringLiteralLikeContent(node) {
|
|
133032
|
-
|
|
133033
|
-
|
|
133034
|
-
|
|
132795
|
+
let replacementEnd = node.getEnd() - 1;
|
|
132796
|
+
if (node.isUnterminated) {
|
|
132797
|
+
if (node.getStart() === replacementEnd)
|
|
132798
|
+
return void 0;
|
|
132799
|
+
replacementEnd = node.getEnd();
|
|
132800
|
+
}
|
|
132801
|
+
return createTextSpanFromBounds(node.getStart() + 1, replacementEnd);
|
|
133035
132802
|
}
|
|
133036
132803
|
function createTextRangeFromNode(node, sourceFile) {
|
|
133037
132804
|
return createRange(node.getStart(sourceFile), node.end);
|
|
@@ -140054,7 +139821,9 @@ function updateImportsInOtherFiles(changes, program, host, oldFile, movedSymbols
|
|
|
140054
139821
|
return !!symbol && movedSymbols.has(symbol);
|
|
140055
139822
|
};
|
|
140056
139823
|
deleteUnusedImports(sourceFile, importNode, changes, shouldMove);
|
|
140057
|
-
const pathToTargetFileWithExtension = resolvePath(getDirectoryPath(oldFile.
|
|
139824
|
+
const pathToTargetFileWithExtension = resolvePath(getDirectoryPath(getNormalizedAbsolutePath(oldFile.fileName, program.getCurrentDirectory())), targetFileName);
|
|
139825
|
+
if (getStringComparer(!program.useCaseSensitiveFileNames())(pathToTargetFileWithExtension, sourceFile.fileName) === 0 /* EqualTo */)
|
|
139826
|
+
return;
|
|
140058
139827
|
const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.fileName, pathToTargetFileWithExtension, createModuleSpecifierResolutionHost(program, host));
|
|
140059
139828
|
const newImportDeclaration = filterImport(importNode, makeStringLiteral(newModuleSpecifier, quotePreference), shouldMove);
|
|
140060
139829
|
if (newImportDeclaration)
|
|
@@ -140189,7 +139958,7 @@ function createOldFileImportsFromTargetFile(sourceFile, targetFileNeedExport, ta
|
|
|
140189
139958
|
return makeImportOrRequire(sourceFile, defaultImport, imports, targetFileNameWithExtension, program, host, useEs6Imports, quotePreference);
|
|
140190
139959
|
}
|
|
140191
139960
|
function makeImportOrRequire(sourceFile, defaultImport, imports, targetFileNameWithExtension, program, host, useEs6Imports, quotePreference) {
|
|
140192
|
-
const pathToTargetFile = resolvePath(getDirectoryPath(sourceFile.
|
|
139961
|
+
const pathToTargetFile = resolvePath(getDirectoryPath(getNormalizedAbsolutePath(sourceFile.fileName, program.getCurrentDirectory())), targetFileNameWithExtension);
|
|
140193
139962
|
const pathToTargetFileWithCorrectExtension = getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.fileName, pathToTargetFile, createModuleSpecifierResolutionHost(program, host));
|
|
140194
139963
|
if (useEs6Imports) {
|
|
140195
139964
|
const specifiers = imports.map((i) => factory.createImportSpecifier(
|