typescript 5.5.0-dev.20240320 → 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/tsc.js +125 -393
- package/lib/tsserver.js +108 -114
- package/lib/typescript.d.ts +1 -0
- package/lib/typescript.js +136 -364
- package/lib/typingsInstaller.js +18 -24
- package/package.json +2 -2
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.20240321`;
|
|
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
|
}
|
|
@@ -54035,14 +54039,6 @@ function createTypeChecker(host) {
|
|
|
54035
54039
|
return file.moduleName;
|
|
54036
54040
|
}
|
|
54037
54041
|
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
54042
|
if (ambientModuleSymbolRegex.test(symbol.escapedName)) {
|
|
54047
54043
|
return symbol.escapedName.substring(1, symbol.escapedName.length - 1);
|
|
54048
54044
|
}
|
|
@@ -54135,8 +54131,6 @@ function createTypeChecker(host) {
|
|
|
54135
54131
|
}
|
|
54136
54132
|
}
|
|
54137
54133
|
const lit = factory.createLiteralTypeNode(factory.createStringLiteral(specifier));
|
|
54138
|
-
if (context.tracker.trackExternalModuleSymbolOfImportTypeNode)
|
|
54139
|
-
context.tracker.trackExternalModuleSymbolOfImportTypeNode(chain[0]);
|
|
54140
54134
|
context.approximateLength += specifier.length + 10;
|
|
54141
54135
|
if (!nonRootParts || isEntityName(nonRootParts)) {
|
|
54142
54136
|
if (nonRootParts) {
|
|
@@ -54695,18 +54689,6 @@ function createTypeChecker(host) {
|
|
|
54695
54689
|
return factory.createStringLiteral(newName);
|
|
54696
54690
|
}
|
|
54697
54691
|
}
|
|
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
54692
|
}
|
|
54711
54693
|
return lit;
|
|
54712
54694
|
}
|
|
@@ -85271,14 +85253,16 @@ function createTypeChecker(host) {
|
|
|
85271
85253
|
if (!(nodeLinks2.flags & 1024 /* EnumValuesComputed */)) {
|
|
85272
85254
|
nodeLinks2.flags |= 1024 /* EnumValuesComputed */;
|
|
85273
85255
|
let autoValue = 0;
|
|
85256
|
+
let previous;
|
|
85274
85257
|
for (const member of node.members) {
|
|
85275
|
-
const value = computeMemberValue(member, autoValue);
|
|
85258
|
+
const value = computeMemberValue(member, autoValue, previous);
|
|
85276
85259
|
getNodeLinks(member).enumMemberValue = value;
|
|
85277
85260
|
autoValue = typeof value === "number" ? value + 1 : void 0;
|
|
85261
|
+
previous = member;
|
|
85278
85262
|
}
|
|
85279
85263
|
}
|
|
85280
85264
|
}
|
|
85281
|
-
function computeMemberValue(member, autoValue) {
|
|
85265
|
+
function computeMemberValue(member, autoValue, previous) {
|
|
85282
85266
|
if (isComputedNonLiteralName(member.name)) {
|
|
85283
85267
|
error2(member.name, Diagnostics.Computed_property_names_are_not_allowed_in_enums);
|
|
85284
85268
|
} else {
|
|
@@ -85293,11 +85277,17 @@ function createTypeChecker(host) {
|
|
|
85293
85277
|
if (member.parent.flags & 33554432 /* Ambient */ && !isEnumConst(member.parent)) {
|
|
85294
85278
|
return void 0;
|
|
85295
85279
|
}
|
|
85296
|
-
if (autoValue
|
|
85297
|
-
|
|
85280
|
+
if (autoValue === void 0) {
|
|
85281
|
+
error2(member.name, Diagnostics.Enum_member_must_have_initializer);
|
|
85282
|
+
return void 0;
|
|
85298
85283
|
}
|
|
85299
|
-
|
|
85300
|
-
|
|
85284
|
+
if (getIsolatedModules(compilerOptions) && (previous == null ? void 0 : previous.initializer) && !isSyntacticallyNumericConstant(previous.initializer)) {
|
|
85285
|
+
error2(
|
|
85286
|
+
member.name,
|
|
85287
|
+
Diagnostics.Enum_member_following_a_non_literal_numeric_member_must_have_an_initializer_when_isolatedModules_is_enabled
|
|
85288
|
+
);
|
|
85289
|
+
}
|
|
85290
|
+
return autoValue;
|
|
85301
85291
|
}
|
|
85302
85292
|
function computeConstantValue(member) {
|
|
85303
85293
|
const isConstEnum = isEnumConst(member.parent);
|
|
@@ -85309,6 +85299,12 @@ function createTypeChecker(host) {
|
|
|
85309
85299
|
initializer,
|
|
85310
85300
|
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
85301
|
);
|
|
85302
|
+
} else if (getIsolatedModules(compilerOptions) && typeof value === "string" && !isSyntacticallyString(initializer)) {
|
|
85303
|
+
error2(
|
|
85304
|
+
initializer,
|
|
85305
|
+
Diagnostics._0_has_a_string_type_but_must_have_syntactically_recognizable_string_syntax_when_isolatedModules_is_enabled,
|
|
85306
|
+
`${idText(member.parent.name)}.${getTextOfPropertyName(member.name)}`
|
|
85307
|
+
);
|
|
85312
85308
|
}
|
|
85313
85309
|
} else if (isConstEnum) {
|
|
85314
85310
|
error2(initializer, Diagnostics.const_enum_member_initializers_must_be_constant_expressions);
|
|
@@ -85319,6 +85315,18 @@ function createTypeChecker(host) {
|
|
|
85319
85315
|
}
|
|
85320
85316
|
return value;
|
|
85321
85317
|
}
|
|
85318
|
+
function isSyntacticallyNumericConstant(expr) {
|
|
85319
|
+
expr = skipOuterExpressions(expr);
|
|
85320
|
+
switch (expr.kind) {
|
|
85321
|
+
case 224 /* PrefixUnaryExpression */:
|
|
85322
|
+
return isSyntacticallyNumericConstant(expr.operand);
|
|
85323
|
+
case 226 /* BinaryExpression */:
|
|
85324
|
+
return isSyntacticallyNumericConstant(expr.left) && isSyntacticallyNumericConstant(expr.right);
|
|
85325
|
+
case 9 /* NumericLiteral */:
|
|
85326
|
+
return true;
|
|
85327
|
+
}
|
|
85328
|
+
return false;
|
|
85329
|
+
}
|
|
85322
85330
|
function evaluate(expr, location) {
|
|
85323
85331
|
switch (expr.kind) {
|
|
85324
85332
|
case 224 /* PrefixUnaryExpression */:
|
|
@@ -87348,23 +87356,6 @@ function createTypeChecker(host) {
|
|
|
87348
87356
|
const isPropertyName2 = (isPropertyAccessExpression(parent2) || isPropertyAssignment(parent2)) && parent2.name === node;
|
|
87349
87357
|
return !isPropertyName2 && getReferencedValueSymbol(node) === argumentsSymbol;
|
|
87350
87358
|
}
|
|
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
87359
|
function isNameOfModuleOrEnumDeclaration(node) {
|
|
87369
87360
|
return isModuleOrEnumDeclaration(node.parent) && node === node.parent.name;
|
|
87370
87361
|
}
|
|
@@ -87941,20 +87932,6 @@ function createTypeChecker(host) {
|
|
|
87941
87932
|
}
|
|
87942
87933
|
}
|
|
87943
87934
|
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
87935
|
return {
|
|
87959
87936
|
getReferencedExportContainer,
|
|
87960
87937
|
getReferencedImportDeclaration,
|
|
@@ -87994,14 +87971,11 @@ function createTypeChecker(host) {
|
|
|
87994
87971
|
getReferencedValueDeclarations,
|
|
87995
87972
|
getTypeReferenceSerializationKind,
|
|
87996
87973
|
isOptionalParameter,
|
|
87997
|
-
moduleExportsSomeValue,
|
|
87998
87974
|
isArgumentsLocalBinding,
|
|
87999
87975
|
getExternalModuleFileFromDeclaration: (nodeIn) => {
|
|
88000
87976
|
const node = getParseTreeNode(nodeIn, hasPossibleExternalModuleReference);
|
|
88001
87977
|
return node && getExternalModuleFileFromDeclaration(node);
|
|
88002
87978
|
},
|
|
88003
|
-
getTypeReferenceDirectivesForEntityName,
|
|
88004
|
-
getTypeReferenceDirectivesForSymbol,
|
|
88005
87979
|
isLiteralConstDeclaration,
|
|
88006
87980
|
isLateBound: (nodeIn) => {
|
|
88007
87981
|
const node = getParseTreeNode(nodeIn, isDeclaration);
|
|
@@ -88025,12 +87999,6 @@ function createTypeChecker(host) {
|
|
|
88025
87999
|
getAccessor
|
|
88026
88000
|
};
|
|
88027
88001
|
},
|
|
88028
|
-
getSymbolOfExternalModuleSpecifier: (moduleName) => resolveExternalModuleNameWorker(
|
|
88029
|
-
moduleName,
|
|
88030
|
-
moduleName,
|
|
88031
|
-
/*moduleNotFoundError*/
|
|
88032
|
-
void 0
|
|
88033
|
-
),
|
|
88034
88002
|
isBindingCapturedByNode: (node, decl) => {
|
|
88035
88003
|
const parseNode = getParseTreeNode(node);
|
|
88036
88004
|
const parseDecl = getParseTreeNode(decl);
|
|
@@ -88045,16 +88013,7 @@ function createTypeChecker(host) {
|
|
|
88045
88013
|
}
|
|
88046
88014
|
return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, tracker, bundled);
|
|
88047
88015
|
},
|
|
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
|
-
}
|
|
88016
|
+
isImportRequiredByAugmentation
|
|
88058
88017
|
};
|
|
88059
88018
|
function isImportRequiredByAugmentation(node) {
|
|
88060
88019
|
const file = getSourceFileOfNode(node);
|
|
@@ -88081,84 +88040,6 @@ function createTypeChecker(host) {
|
|
|
88081
88040
|
}
|
|
88082
88041
|
return false;
|
|
88083
88042
|
}
|
|
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
88043
|
}
|
|
88163
88044
|
function getExternalModuleFileFromDeclaration(declaration) {
|
|
88164
88045
|
const specifier = declaration.kind === 267 /* ModuleDeclaration */ ? tryCast(declaration.name, isStringLiteral) : getExternalModuleName(declaration);
|
|
@@ -90082,20 +89963,6 @@ var SymbolTrackerImpl = class _SymbolTrackerImpl {
|
|
|
90082
89963
|
this.inner.reportTruncationError();
|
|
90083
89964
|
}
|
|
90084
89965
|
}
|
|
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
89966
|
reportNonlocalAugmentation(containingFile, parentSymbol, augmentingSymbol) {
|
|
90100
89967
|
var _a;
|
|
90101
89968
|
if ((_a = this.inner) == null ? void 0 : _a.reportNonlocalAugmentation) {
|
|
@@ -113287,11 +113154,9 @@ function transformDeclarations(context) {
|
|
|
113287
113154
|
let needsScopeFixMarker = false;
|
|
113288
113155
|
let resultHasScopeMarker = false;
|
|
113289
113156
|
let enclosingDeclaration;
|
|
113290
|
-
let necessaryTypeReferences;
|
|
113291
113157
|
let lateMarkedStatements;
|
|
113292
113158
|
let lateStatementReplacementMap;
|
|
113293
113159
|
let suppressNewDiagnosticContexts;
|
|
113294
|
-
let exportedModulesFromDeclarationEmit;
|
|
113295
113160
|
const { factory: factory2 } = context;
|
|
113296
113161
|
const host = context.getEmitHost();
|
|
113297
113162
|
const symbolTracker = {
|
|
@@ -113303,49 +113168,19 @@ function transformDeclarations(context) {
|
|
|
113303
113168
|
reportLikelyUnsafeImportRequiredError,
|
|
113304
113169
|
reportTruncationError,
|
|
113305
113170
|
moduleResolverHost: host,
|
|
113306
|
-
trackReferencedAmbientModule,
|
|
113307
|
-
trackExternalModuleSymbolOfImportTypeNode,
|
|
113308
113171
|
reportNonlocalAugmentation,
|
|
113309
113172
|
reportNonSerializableProperty
|
|
113310
113173
|
};
|
|
113311
113174
|
let errorNameNode;
|
|
113312
113175
|
let errorFallbackNode;
|
|
113313
113176
|
let currentSourceFile;
|
|
113314
|
-
let
|
|
113315
|
-
let
|
|
113316
|
-
let
|
|
113177
|
+
let rawReferencedFiles;
|
|
113178
|
+
let rawTypeReferenceDirectives;
|
|
113179
|
+
let rawLibReferenceDirectives;
|
|
113317
113180
|
const resolver = context.getEmitResolver();
|
|
113318
113181
|
const options = context.getCompilerOptions();
|
|
113319
|
-
const {
|
|
113182
|
+
const { stripInternal } = options;
|
|
113320
113183
|
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
113184
|
function handleSymbolAccessibilityError(symbolAccessibilityResult) {
|
|
113350
113185
|
if (symbolAccessibilityResult.accessibility === 0 /* Accessible */) {
|
|
113351
113186
|
if (symbolAccessibilityResult.aliasesToMakeVisible) {
|
|
@@ -113370,11 +113205,6 @@ function transformDeclarations(context) {
|
|
|
113370
113205
|
}
|
|
113371
113206
|
return false;
|
|
113372
113207
|
}
|
|
113373
|
-
function trackExternalModuleSymbolOfImportTypeNode(symbol) {
|
|
113374
|
-
if (!isBundledEmit) {
|
|
113375
|
-
(exportedModulesFromDeclarationEmit || (exportedModulesFromDeclarationEmit = [])).push(symbol);
|
|
113376
|
-
}
|
|
113377
|
-
}
|
|
113378
113208
|
function trackSymbol(symbol, enclosingDeclaration2, meaning) {
|
|
113379
113209
|
if (symbol.flags & 262144 /* TypeParameter */)
|
|
113380
113210
|
return false;
|
|
@@ -113385,7 +113215,6 @@ function transformDeclarations(context) {
|
|
|
113385
113215
|
/*shouldComputeAliasToMarkVisible*/
|
|
113386
113216
|
true
|
|
113387
113217
|
));
|
|
113388
|
-
recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForSymbol(symbol, meaning));
|
|
113389
113218
|
return issuedDiagnostic;
|
|
113390
113219
|
}
|
|
113391
113220
|
function reportPrivateInBaseOfClassExpression(propertyName) {
|
|
@@ -113457,8 +113286,9 @@ function transformDeclarations(context) {
|
|
|
113457
113286
|
}
|
|
113458
113287
|
if (node.kind === 308 /* Bundle */) {
|
|
113459
113288
|
isBundledEmit = true;
|
|
113460
|
-
|
|
113461
|
-
|
|
113289
|
+
rawReferencedFiles = [];
|
|
113290
|
+
rawTypeReferenceDirectives = [];
|
|
113291
|
+
rawLibReferenceDirectives = [];
|
|
113462
113292
|
let hasNoDefaultLib = false;
|
|
113463
113293
|
const bundle = factory2.createBundle(
|
|
113464
113294
|
map(node.sourceFiles, (sourceFile) => {
|
|
@@ -113473,8 +113303,7 @@ function transformDeclarations(context) {
|
|
|
113473
113303
|
getSymbolAccessibilityDiagnostic = throwDiagnostic;
|
|
113474
113304
|
needsScopeFixMarker = false;
|
|
113475
113305
|
resultHasScopeMarker = false;
|
|
113476
|
-
|
|
113477
|
-
collectLibs(sourceFile, libs2);
|
|
113306
|
+
collectFileReferences(sourceFile);
|
|
113478
113307
|
if (isExternalOrCommonJsModule(sourceFile) || isJsonSourceFile(sourceFile)) {
|
|
113479
113308
|
resultHasExternalModuleIndicator = false;
|
|
113480
113309
|
needsDeclare = false;
|
|
@@ -113521,18 +113350,16 @@ function transformDeclarations(context) {
|
|
|
113521
113350
|
);
|
|
113522
113351
|
})
|
|
113523
113352
|
);
|
|
113524
|
-
bundle.syntheticFileReferences = [];
|
|
113525
|
-
bundle.syntheticTypeReferences = getFileReferencesForUsedTypeReferences();
|
|
113526
|
-
bundle.syntheticLibReferences = getLibReferences();
|
|
113527
|
-
bundle.hasNoDefaultLib = hasNoDefaultLib;
|
|
113528
113353
|
const outputFilePath2 = getDirectoryPath(normalizeSlashes(getOutputPathsFor(
|
|
113529
113354
|
node,
|
|
113530
113355
|
host,
|
|
113531
113356
|
/*forceDtsPaths*/
|
|
113532
113357
|
true
|
|
113533
113358
|
).declarationFilePath));
|
|
113534
|
-
|
|
113535
|
-
|
|
113359
|
+
bundle.syntheticFileReferences = getReferencedFiles(outputFilePath2);
|
|
113360
|
+
bundle.syntheticTypeReferences = getTypeReferences();
|
|
113361
|
+
bundle.syntheticLibReferences = getLibReferences();
|
|
113362
|
+
bundle.hasNoDefaultLib = hasNoDefaultLib;
|
|
113536
113363
|
return bundle;
|
|
113537
113364
|
}
|
|
113538
113365
|
needsDeclare = true;
|
|
@@ -113546,66 +113373,68 @@ function transformDeclarations(context) {
|
|
|
113546
113373
|
suppressNewDiagnosticContexts = false;
|
|
113547
113374
|
lateMarkedStatements = void 0;
|
|
113548
113375
|
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);
|
|
113376
|
+
rawReferencedFiles = [];
|
|
113377
|
+
rawTypeReferenceDirectives = [];
|
|
113378
|
+
rawLibReferenceDirectives = [];
|
|
113379
|
+
collectFileReferences(currentSourceFile);
|
|
113560
113380
|
let combinedStatements;
|
|
113561
113381
|
if (isSourceFileJS(currentSourceFile)) {
|
|
113562
113382
|
combinedStatements = factory2.createNodeArray(transformDeclarationsForJS(node));
|
|
113563
|
-
refs.forEach(referenceVisitor);
|
|
113564
|
-
emittedImports = filter(combinedStatements, isAnyImportSyntax);
|
|
113565
113383
|
} else {
|
|
113566
113384
|
const statements = visitNodes2(node.statements, visitDeclarationStatements, isStatement);
|
|
113567
113385
|
combinedStatements = setTextRange(factory2.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), node.statements);
|
|
113568
|
-
refs.forEach(referenceVisitor);
|
|
113569
|
-
emittedImports = filter(combinedStatements, isAnyImportSyntax);
|
|
113570
113386
|
if (isExternalModule(node) && (!resultHasExternalModuleIndicator || needsScopeFixMarker && !resultHasScopeMarker)) {
|
|
113571
113387
|
combinedStatements = setTextRange(factory2.createNodeArray([...combinedStatements, createEmptyExports(factory2)]), combinedStatements);
|
|
113572
113388
|
}
|
|
113573
113389
|
}
|
|
113390
|
+
const outputFilePath = getDirectoryPath(normalizeSlashes(getOutputPathsFor(
|
|
113391
|
+
node,
|
|
113392
|
+
host,
|
|
113393
|
+
/*forceDtsPaths*/
|
|
113394
|
+
true
|
|
113395
|
+
).declarationFilePath));
|
|
113574
113396
|
return factory2.updateSourceFile(
|
|
113575
113397
|
node,
|
|
113576
113398
|
combinedStatements,
|
|
113577
113399
|
/*isDeclarationFile*/
|
|
113578
113400
|
true,
|
|
113579
|
-
|
|
113580
|
-
|
|
113401
|
+
getReferencedFiles(outputFilePath),
|
|
113402
|
+
getTypeReferences(),
|
|
113581
113403
|
node.hasNoDefaultLib,
|
|
113582
113404
|
getLibReferences()
|
|
113583
113405
|
);
|
|
113584
|
-
function
|
|
113585
|
-
|
|
113406
|
+
function collectFileReferences(sourceFile) {
|
|
113407
|
+
rawReferencedFiles = concatenate(rawReferencedFiles, map(sourceFile.referencedFiles, (f) => [sourceFile, f]));
|
|
113408
|
+
rawTypeReferenceDirectives = concatenate(rawTypeReferenceDirectives, sourceFile.typeReferenceDirectives);
|
|
113409
|
+
rawLibReferenceDirectives = concatenate(rawLibReferenceDirectives, sourceFile.libReferenceDirectives);
|
|
113586
113410
|
}
|
|
113587
|
-
function
|
|
113588
|
-
|
|
113411
|
+
function copyFileReferenceAsSynthetic(ref) {
|
|
113412
|
+
const newRef = { ...ref };
|
|
113413
|
+
newRef.pos = -1;
|
|
113414
|
+
newRef.end = -1;
|
|
113415
|
+
return newRef;
|
|
113589
113416
|
}
|
|
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 };
|
|
113417
|
+
function getTypeReferences() {
|
|
113418
|
+
return mapDefined(rawTypeReferenceDirectives, (ref) => {
|
|
113419
|
+
if (!ref.preserve)
|
|
113420
|
+
return void 0;
|
|
113421
|
+
return copyFileReferenceAsSynthetic(ref);
|
|
113422
|
+
});
|
|
113604
113423
|
}
|
|
113605
|
-
function
|
|
113606
|
-
return (
|
|
113607
|
-
if (
|
|
113608
|
-
return;
|
|
113424
|
+
function getLibReferences() {
|
|
113425
|
+
return mapDefined(rawLibReferenceDirectives, (ref) => {
|
|
113426
|
+
if (!ref.preserve)
|
|
113427
|
+
return void 0;
|
|
113428
|
+
return copyFileReferenceAsSynthetic(ref);
|
|
113429
|
+
});
|
|
113430
|
+
}
|
|
113431
|
+
function getReferencedFiles(outputFilePath2) {
|
|
113432
|
+
return mapDefined(rawReferencedFiles, ([sourceFile, ref]) => {
|
|
113433
|
+
if (!ref.preserve)
|
|
113434
|
+
return void 0;
|
|
113435
|
+
const file = host.getSourceFileFromReference(sourceFile, ref);
|
|
113436
|
+
if (!file) {
|
|
113437
|
+
return void 0;
|
|
113609
113438
|
}
|
|
113610
113439
|
let declFileName;
|
|
113611
113440
|
if (file.isDeclarationFile) {
|
|
@@ -113621,61 +113450,22 @@ function transformDeclarations(context) {
|
|
|
113621
113450
|
);
|
|
113622
113451
|
declFileName = paths.declarationFilePath || paths.jsFilePath || file.fileName;
|
|
113623
113452
|
}
|
|
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
|
-
};
|
|
113453
|
+
if (!declFileName)
|
|
113454
|
+
return void 0;
|
|
113455
|
+
const fileName = getRelativePathToDirectoryOrUrl(
|
|
113456
|
+
outputFilePath2,
|
|
113457
|
+
declFileName,
|
|
113458
|
+
host.getCurrentDirectory(),
|
|
113459
|
+
host.getCanonicalFileName,
|
|
113460
|
+
/*isAbsolutePathAnUrl*/
|
|
113461
|
+
false
|
|
113462
|
+
);
|
|
113463
|
+
const newRef = copyFileReferenceAsSynthetic(ref);
|
|
113464
|
+
newRef.fileName = fileName;
|
|
113465
|
+
return newRef;
|
|
113466
|
+
});
|
|
113657
113467
|
}
|
|
113658
113468
|
}
|
|
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
113469
|
function filterBindingPatternInitializers(name) {
|
|
113680
113470
|
if (name.kind === 80 /* Identifier */) {
|
|
113681
113471
|
return name;
|
|
@@ -113874,7 +113664,6 @@ function transformDeclarations(context) {
|
|
|
113874
113664
|
function checkEntityNameVisibility(entityName, enclosingDeclaration2) {
|
|
113875
113665
|
const visibilityResult = resolver.isEntityNameVisible(entityName, enclosingDeclaration2);
|
|
113876
113666
|
handleSymbolAccessibilityError(visibilityResult);
|
|
113877
|
-
recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForEntityName(entityName));
|
|
113878
113667
|
}
|
|
113879
113668
|
function preserveJsDoc(updated, original) {
|
|
113880
113669
|
if (hasJSDocNodes(updated) && hasJSDocNodes(original)) {
|
|
@@ -113892,11 +113681,6 @@ function transformDeclarations(context) {
|
|
|
113892
113681
|
if (newName) {
|
|
113893
113682
|
return factory2.createStringLiteral(newName);
|
|
113894
113683
|
}
|
|
113895
|
-
} else {
|
|
113896
|
-
const symbol = resolver.getSymbolOfExternalModuleSpecifier(input);
|
|
113897
|
-
if (symbol) {
|
|
113898
|
-
(exportedModulesFromDeclarationEmit || (exportedModulesFromDeclarationEmit = [])).push(symbol);
|
|
113899
|
-
}
|
|
113900
113684
|
}
|
|
113901
113685
|
}
|
|
113902
113686
|
return input;
|
|
@@ -114289,7 +114073,6 @@ function transformDeclarations(context) {
|
|
|
114289
114073
|
case 205 /* ImportType */: {
|
|
114290
114074
|
if (!isLiteralImportTypeNode(input))
|
|
114291
114075
|
return cleanup(input);
|
|
114292
|
-
trackReferencedAmbientModuleFromImport(input);
|
|
114293
114076
|
return cleanup(factory2.updateImportTypeNode(
|
|
114294
114077
|
input,
|
|
114295
114078
|
factory2.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)),
|
|
@@ -114341,7 +114124,6 @@ function transformDeclarations(context) {
|
|
|
114341
114124
|
resultHasExternalModuleIndicator = true;
|
|
114342
114125
|
}
|
|
114343
114126
|
resultHasScopeMarker = true;
|
|
114344
|
-
trackReferencedAmbientModuleFromImport(input);
|
|
114345
114127
|
return factory2.updateExportDeclaration(
|
|
114346
114128
|
input,
|
|
114347
114129
|
input.modifiers,
|
|
@@ -114416,18 +114198,10 @@ function transformDeclarations(context) {
|
|
|
114416
114198
|
return;
|
|
114417
114199
|
switch (input.kind) {
|
|
114418
114200
|
case 271 /* ImportEqualsDeclaration */: {
|
|
114419
|
-
|
|
114420
|
-
if (transformed) {
|
|
114421
|
-
trackReferencedAmbientModuleFromImport(input);
|
|
114422
|
-
}
|
|
114423
|
-
return transformed;
|
|
114201
|
+
return transformImportEqualsDeclaration(input);
|
|
114424
114202
|
}
|
|
114425
114203
|
case 272 /* ImportDeclaration */: {
|
|
114426
|
-
|
|
114427
|
-
if (transformed) {
|
|
114428
|
-
trackReferencedAmbientModuleFromImport(input);
|
|
114429
|
-
}
|
|
114430
|
-
return transformed;
|
|
114204
|
+
return transformImportDeclaration(input);
|
|
114431
114205
|
}
|
|
114432
114206
|
}
|
|
114433
114207
|
if (isDeclaration(input) && isDeclarationAndNotVisible(input))
|
|
@@ -115997,20 +115771,15 @@ var notImplementedResolver = {
|
|
|
115997
115771
|
getReferencedValueDeclarations: notImplemented,
|
|
115998
115772
|
getTypeReferenceSerializationKind: notImplemented,
|
|
115999
115773
|
isOptionalParameter: notImplemented,
|
|
116000
|
-
moduleExportsSomeValue: notImplemented,
|
|
116001
115774
|
isArgumentsLocalBinding: notImplemented,
|
|
116002
115775
|
getExternalModuleFileFromDeclaration: notImplemented,
|
|
116003
|
-
getTypeReferenceDirectivesForEntityName: notImplemented,
|
|
116004
|
-
getTypeReferenceDirectivesForSymbol: notImplemented,
|
|
116005
115776
|
isLiteralConstDeclaration: notImplemented,
|
|
116006
115777
|
getJsxFactoryEntity: notImplemented,
|
|
116007
115778
|
getJsxFragmentFactoryEntity: notImplemented,
|
|
116008
115779
|
getAllAccessorDeclarations: notImplemented,
|
|
116009
|
-
getSymbolOfExternalModuleSpecifier: notImplemented,
|
|
116010
115780
|
isBindingCapturedByNode: notImplemented,
|
|
116011
115781
|
getDeclarationStatementsForSourceFile: notImplemented,
|
|
116012
|
-
isImportRequiredByAugmentation: notImplemented
|
|
116013
|
-
tryFindAmbientModule: notImplemented
|
|
115782
|
+
isImportRequiredByAugmentation: notImplemented
|
|
116014
115783
|
};
|
|
116015
115784
|
var createPrinterWithDefaults = /* @__PURE__ */ memoize(() => createPrinter({}));
|
|
116016
115785
|
var createPrinterWithRemoveComments = /* @__PURE__ */ memoize(() => createPrinter({ removeComments: true }));
|
|
@@ -118765,19 +118534,17 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
118765
118534
|
writeLine();
|
|
118766
118535
|
}
|
|
118767
118536
|
}
|
|
118768
|
-
|
|
118769
|
-
|
|
118770
|
-
|
|
118771
|
-
|
|
118772
|
-
|
|
118773
|
-
|
|
118774
|
-
|
|
118775
|
-
writeLine();
|
|
118776
|
-
}
|
|
118777
|
-
for (const directive of libs2) {
|
|
118778
|
-
writeComment(`/// <reference lib="${directive.fileName}" />`);
|
|
118779
|
-
writeLine();
|
|
118537
|
+
function writeDirectives(kind, directives) {
|
|
118538
|
+
for (const directive of directives) {
|
|
118539
|
+
const preserve = directive.preserve ? `preserve="true" ` : "";
|
|
118540
|
+
const resolutionMode = directive.resolutionMode && directive.resolutionMode !== (currentSourceFile == null ? void 0 : currentSourceFile.impliedNodeFormat) ? `resolution-mode="${directive.resolutionMode === 99 /* ESNext */ ? "import" : "require"}" ` : "";
|
|
118541
|
+
writeComment(`/// <reference ${kind}="${directive.fileName}" ${resolutionMode}${preserve}/>`);
|
|
118542
|
+
writeLine();
|
|
118543
|
+
}
|
|
118780
118544
|
}
|
|
118545
|
+
writeDirectives("path", files);
|
|
118546
|
+
writeDirectives("types", types);
|
|
118547
|
+
writeDirectives("lib", libs2);
|
|
118781
118548
|
}
|
|
118782
118549
|
function emitSourceFileWorker(node) {
|
|
118783
118550
|
const statements = node.statements;
|
|
@@ -122657,7 +122424,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
122657
122424
|
getSourceFile: program.getSourceFile,
|
|
122658
122425
|
getSourceFileByPath: program.getSourceFileByPath,
|
|
122659
122426
|
getSourceFiles: program.getSourceFiles,
|
|
122660
|
-
getLibFileFromReference: program.getLibFileFromReference,
|
|
122661
122427
|
isSourceFileFromExternalLibrary,
|
|
122662
122428
|
getResolvedProjectReferenceToRedirect,
|
|
122663
122429
|
getProjectReferenceRedirect,
|
|
@@ -133029,9 +132795,13 @@ function createTextSpanFromNode(node, sourceFile, endNode2) {
|
|
|
133029
132795
|
return createTextSpanFromBounds(node.getStart(sourceFile), (endNode2 || node).getEnd());
|
|
133030
132796
|
}
|
|
133031
132797
|
function createTextSpanFromStringLiteralLikeContent(node) {
|
|
133032
|
-
|
|
133033
|
-
|
|
133034
|
-
|
|
132798
|
+
let replacementEnd = node.getEnd() - 1;
|
|
132799
|
+
if (node.isUnterminated) {
|
|
132800
|
+
if (node.getStart() === replacementEnd)
|
|
132801
|
+
return void 0;
|
|
132802
|
+
replacementEnd = node.getEnd();
|
|
132803
|
+
}
|
|
132804
|
+
return createTextSpanFromBounds(node.getStart() + 1, replacementEnd);
|
|
133035
132805
|
}
|
|
133036
132806
|
function createTextRangeFromNode(node, sourceFile) {
|
|
133037
132807
|
return createRange(node.getStart(sourceFile), node.end);
|
|
@@ -140054,7 +139824,9 @@ function updateImportsInOtherFiles(changes, program, host, oldFile, movedSymbols
|
|
|
140054
139824
|
return !!symbol && movedSymbols.has(symbol);
|
|
140055
139825
|
};
|
|
140056
139826
|
deleteUnusedImports(sourceFile, importNode, changes, shouldMove);
|
|
140057
|
-
const pathToTargetFileWithExtension = resolvePath(getDirectoryPath(oldFile.
|
|
139827
|
+
const pathToTargetFileWithExtension = resolvePath(getDirectoryPath(getNormalizedAbsolutePath(oldFile.fileName, program.getCurrentDirectory())), targetFileName);
|
|
139828
|
+
if (getStringComparer(!program.useCaseSensitiveFileNames())(pathToTargetFileWithExtension, sourceFile.fileName) === 0 /* EqualTo */)
|
|
139829
|
+
return;
|
|
140058
139830
|
const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.fileName, pathToTargetFileWithExtension, createModuleSpecifierResolutionHost(program, host));
|
|
140059
139831
|
const newImportDeclaration = filterImport(importNode, makeStringLiteral(newModuleSpecifier, quotePreference), shouldMove);
|
|
140060
139832
|
if (newImportDeclaration)
|
|
@@ -140189,7 +139961,7 @@ function createOldFileImportsFromTargetFile(sourceFile, targetFileNeedExport, ta
|
|
|
140189
139961
|
return makeImportOrRequire(sourceFile, defaultImport, imports, targetFileNameWithExtension, program, host, useEs6Imports, quotePreference);
|
|
140190
139962
|
}
|
|
140191
139963
|
function makeImportOrRequire(sourceFile, defaultImport, imports, targetFileNameWithExtension, program, host, useEs6Imports, quotePreference) {
|
|
140192
|
-
const pathToTargetFile = resolvePath(getDirectoryPath(sourceFile.
|
|
139964
|
+
const pathToTargetFile = resolvePath(getDirectoryPath(getNormalizedAbsolutePath(sourceFile.fileName, program.getCurrentDirectory())), targetFileNameWithExtension);
|
|
140193
139965
|
const pathToTargetFileWithCorrectExtension = getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.fileName, pathToTargetFile, createModuleSpecifierResolutionHost(program, host));
|
|
140194
139966
|
if (useEs6Imports) {
|
|
140195
139967
|
const specifiers = imports.map((i) => factory.createImportSpecifier(
|