typescript 5.5.0-dev.20240508 → 5.5.0-dev.20240510
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 +338 -167
- package/lib/typescript.d.ts +53 -0
- package/lib/typescript.js +636 -338
- package/package.json +2 -2
package/lib/typescript.js
CHANGED
|
@@ -95,7 +95,7 @@ __export(typescript_exports, {
|
|
|
95
95
|
IndexKind: () => IndexKind,
|
|
96
96
|
InferenceFlags: () => InferenceFlags,
|
|
97
97
|
InferencePriority: () => InferencePriority,
|
|
98
|
-
InlayHintKind: () =>
|
|
98
|
+
InlayHintKind: () => InlayHintKind2,
|
|
99
99
|
InlayHints: () => ts_InlayHints_exports,
|
|
100
100
|
InternalEmitFlags: () => InternalEmitFlags,
|
|
101
101
|
InternalSymbolName: () => InternalSymbolName,
|
|
@@ -632,6 +632,7 @@ __export(typescript_exports, {
|
|
|
632
632
|
forEachKey: () => forEachKey,
|
|
633
633
|
forEachLeadingCommentRange: () => forEachLeadingCommentRange,
|
|
634
634
|
forEachNameInAccessChainWalkingLeft: () => forEachNameInAccessChainWalkingLeft,
|
|
635
|
+
forEachNameOfDefaultExport: () => forEachNameOfDefaultExport,
|
|
635
636
|
forEachPropertyAssignment: () => forEachPropertyAssignment,
|
|
636
637
|
forEachResolvedProjectReference: () => forEachResolvedProjectReference,
|
|
637
638
|
forEachReturnStatement: () => forEachReturnStatement,
|
|
@@ -728,11 +729,11 @@ __export(typescript_exports, {
|
|
|
728
729
|
getDeclaredExpandoInitializer: () => getDeclaredExpandoInitializer,
|
|
729
730
|
getDecorators: () => getDecorators,
|
|
730
731
|
getDefaultCompilerOptions: () => getDefaultCompilerOptions2,
|
|
731
|
-
getDefaultExportInfoWorker: () => getDefaultExportInfoWorker,
|
|
732
732
|
getDefaultFormatCodeSettings: () => getDefaultFormatCodeSettings,
|
|
733
733
|
getDefaultLibFileName: () => getDefaultLibFileName,
|
|
734
734
|
getDefaultLibFilePath: () => getDefaultLibFilePath,
|
|
735
735
|
getDefaultLikeExportInfo: () => getDefaultLikeExportInfo,
|
|
736
|
+
getDefaultLikeExportNameFromDeclaration: () => getDefaultLikeExportNameFromDeclaration,
|
|
736
737
|
getDefaultResolutionModeForFileWorker: () => getDefaultResolutionModeForFileWorker,
|
|
737
738
|
getDiagnosticText: () => getDiagnosticText,
|
|
738
739
|
getDiagnosticsWithinSpan: () => getDiagnosticsWithinSpan,
|
|
@@ -1067,6 +1068,7 @@ __export(typescript_exports, {
|
|
|
1067
1068
|
getSwitchedType: () => getSwitchedType,
|
|
1068
1069
|
getSymbolId: () => getSymbolId,
|
|
1069
1070
|
getSymbolNameForPrivateIdentifier: () => getSymbolNameForPrivateIdentifier,
|
|
1071
|
+
getSymbolParentOrFail: () => getSymbolParentOrFail,
|
|
1070
1072
|
getSymbolTarget: () => getSymbolTarget,
|
|
1071
1073
|
getSyntacticClassifications: () => getSyntacticClassifications,
|
|
1072
1074
|
getSyntacticModifierFlags: () => getSyntacticModifierFlags,
|
|
@@ -1931,7 +1933,9 @@ __export(typescript_exports, {
|
|
|
1931
1933
|
moduleResolutionOptionDeclarations: () => moduleResolutionOptionDeclarations,
|
|
1932
1934
|
moduleResolutionSupportsPackageJsonExportsAndImports: () => moduleResolutionSupportsPackageJsonExportsAndImports,
|
|
1933
1935
|
moduleResolutionUsesNodeModules: () => moduleResolutionUsesNodeModules,
|
|
1936
|
+
moduleSpecifierToValidIdentifier: () => moduleSpecifierToValidIdentifier,
|
|
1934
1937
|
moduleSpecifiers: () => ts_moduleSpecifiers_exports,
|
|
1938
|
+
moduleSymbolToValidIdentifier: () => moduleSymbolToValidIdentifier,
|
|
1935
1939
|
moveEmitHelpers: () => moveEmitHelpers,
|
|
1936
1940
|
moveRangeEnd: () => moveRangeEnd,
|
|
1937
1941
|
moveRangePastDecorators: () => moveRangePastDecorators,
|
|
@@ -2011,6 +2015,7 @@ __export(typescript_exports, {
|
|
|
2011
2015
|
parsePackageName: () => parsePackageName,
|
|
2012
2016
|
parsePseudoBigInt: () => parsePseudoBigInt,
|
|
2013
2017
|
parseValidBigInt: () => parseValidBigInt,
|
|
2018
|
+
pasteEdits: () => ts_PasteEdits_exports,
|
|
2014
2019
|
patchWriteFileEnsuringDirectory: () => patchWriteFileEnsuringDirectory,
|
|
2015
2020
|
pathContainsNodeModules: () => pathContainsNodeModules,
|
|
2016
2021
|
pathIsAbsolute: () => pathIsAbsolute,
|
|
@@ -2364,7 +2369,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2364
2369
|
|
|
2365
2370
|
// src/compiler/corePublic.ts
|
|
2366
2371
|
var versionMajorMinor = "5.5";
|
|
2367
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2372
|
+
var version = `${versionMajorMinor}.0-dev.20240510`;
|
|
2368
2373
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2369
2374
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2370
2375
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6342,7 +6347,7 @@ var NodeBuilderFlags = /* @__PURE__ */ ((NodeBuilderFlags2) => {
|
|
|
6342
6347
|
NodeBuilderFlags2[NodeBuilderFlags2["NoSyntacticPrinter"] = -2147483648] = "NoSyntacticPrinter";
|
|
6343
6348
|
NodeBuilderFlags2[NodeBuilderFlags2["AllowNodeModulesRelativePaths"] = 67108864] = "AllowNodeModulesRelativePaths";
|
|
6344
6349
|
NodeBuilderFlags2[NodeBuilderFlags2["DoNotIncludeSymbolChain"] = 134217728] = "DoNotIncludeSymbolChain";
|
|
6345
|
-
NodeBuilderFlags2[NodeBuilderFlags2["
|
|
6350
|
+
NodeBuilderFlags2[NodeBuilderFlags2["AllowUnresolvedNames"] = 1] = "AllowUnresolvedNames";
|
|
6346
6351
|
NodeBuilderFlags2[NodeBuilderFlags2["IgnoreErrors"] = 70221824] = "IgnoreErrors";
|
|
6347
6352
|
NodeBuilderFlags2[NodeBuilderFlags2["InObjectTypeLiteral"] = 4194304] = "InObjectTypeLiteral";
|
|
6348
6353
|
NodeBuilderFlags2[NodeBuilderFlags2["InTypeAlias"] = 8388608] = "InTypeAlias";
|
|
@@ -6911,22 +6916,22 @@ var ScriptKind = /* @__PURE__ */ ((ScriptKind7) => {
|
|
|
6911
6916
|
ScriptKind7[ScriptKind7["Deferred"] = 7] = "Deferred";
|
|
6912
6917
|
return ScriptKind7;
|
|
6913
6918
|
})(ScriptKind || {});
|
|
6914
|
-
var ScriptTarget = /* @__PURE__ */ ((
|
|
6915
|
-
|
|
6916
|
-
|
|
6917
|
-
|
|
6918
|
-
|
|
6919
|
-
|
|
6920
|
-
|
|
6921
|
-
|
|
6922
|
-
|
|
6923
|
-
|
|
6924
|
-
|
|
6925
|
-
|
|
6926
|
-
|
|
6927
|
-
|
|
6928
|
-
|
|
6929
|
-
return
|
|
6919
|
+
var ScriptTarget = /* @__PURE__ */ ((ScriptTarget11) => {
|
|
6920
|
+
ScriptTarget11[ScriptTarget11["ES3"] = 0] = "ES3";
|
|
6921
|
+
ScriptTarget11[ScriptTarget11["ES5"] = 1] = "ES5";
|
|
6922
|
+
ScriptTarget11[ScriptTarget11["ES2015"] = 2] = "ES2015";
|
|
6923
|
+
ScriptTarget11[ScriptTarget11["ES2016"] = 3] = "ES2016";
|
|
6924
|
+
ScriptTarget11[ScriptTarget11["ES2017"] = 4] = "ES2017";
|
|
6925
|
+
ScriptTarget11[ScriptTarget11["ES2018"] = 5] = "ES2018";
|
|
6926
|
+
ScriptTarget11[ScriptTarget11["ES2019"] = 6] = "ES2019";
|
|
6927
|
+
ScriptTarget11[ScriptTarget11["ES2020"] = 7] = "ES2020";
|
|
6928
|
+
ScriptTarget11[ScriptTarget11["ES2021"] = 8] = "ES2021";
|
|
6929
|
+
ScriptTarget11[ScriptTarget11["ES2022"] = 9] = "ES2022";
|
|
6930
|
+
ScriptTarget11[ScriptTarget11["ES2023"] = 10] = "ES2023";
|
|
6931
|
+
ScriptTarget11[ScriptTarget11["ESNext"] = 99] = "ESNext";
|
|
6932
|
+
ScriptTarget11[ScriptTarget11["JSON"] = 100] = "JSON";
|
|
6933
|
+
ScriptTarget11[ScriptTarget11["Latest"] = 99 /* ESNext */] = "Latest";
|
|
6934
|
+
return ScriptTarget11;
|
|
6930
6935
|
})(ScriptTarget || {});
|
|
6931
6936
|
var LanguageVariant = /* @__PURE__ */ ((LanguageVariant4) => {
|
|
6932
6937
|
LanguageVariant4[LanguageVariant4["Standard"] = 0] = "Standard";
|
|
@@ -50266,7 +50271,8 @@ function createTypeChecker(host) {
|
|
|
50266
50271
|
getTypeOnlyAliasDeclaration,
|
|
50267
50272
|
getMemberOverrideModifierStatus,
|
|
50268
50273
|
isTypeParameterPossiblyReferenced,
|
|
50269
|
-
typeHasCallOrConstructSignatures
|
|
50274
|
+
typeHasCallOrConstructSignatures,
|
|
50275
|
+
getSymbolFlags
|
|
50270
50276
|
};
|
|
50271
50277
|
function getCandidateSignaturesForStringLiteralCompletions(call, editingArgument) {
|
|
50272
50278
|
const candidatesSet = /* @__PURE__ */ new Set();
|
|
@@ -52456,37 +52462,6 @@ function createTypeChecker(host) {
|
|
|
52456
52462
|
}
|
|
52457
52463
|
return void 0;
|
|
52458
52464
|
}
|
|
52459
|
-
function markExportAsReferenced(node) {
|
|
52460
|
-
if (!canCollectSymbolAliasAccessabilityData) {
|
|
52461
|
-
return;
|
|
52462
|
-
}
|
|
52463
|
-
const symbol = getSymbolOfDeclaration(node);
|
|
52464
|
-
const target = resolveAlias(symbol);
|
|
52465
|
-
if (target) {
|
|
52466
|
-
const markAlias = target === unknownSymbol || getSymbolFlags(
|
|
52467
|
-
symbol,
|
|
52468
|
-
/*excludeTypeOnlyMeanings*/
|
|
52469
|
-
true
|
|
52470
|
-
) & 111551 /* Value */ && !isConstEnumOrConstEnumOnlyModule(target);
|
|
52471
|
-
if (markAlias) {
|
|
52472
|
-
markAliasSymbolAsReferenced(symbol);
|
|
52473
|
-
}
|
|
52474
|
-
}
|
|
52475
|
-
}
|
|
52476
|
-
function markAliasSymbolAsReferenced(symbol) {
|
|
52477
|
-
Debug.assert(canCollectSymbolAliasAccessabilityData);
|
|
52478
|
-
const links = getSymbolLinks(symbol);
|
|
52479
|
-
if (!links.referenced) {
|
|
52480
|
-
links.referenced = true;
|
|
52481
|
-
const node = getDeclarationOfAliasSymbol(symbol);
|
|
52482
|
-
if (!node) return Debug.fail();
|
|
52483
|
-
if (isInternalModuleImportEqualsDeclaration(node)) {
|
|
52484
|
-
if (getSymbolFlags(resolveSymbol(symbol)) & 111551 /* Value */) {
|
|
52485
|
-
checkExpressionCached(node.moduleReference);
|
|
52486
|
-
}
|
|
52487
|
-
}
|
|
52488
|
-
}
|
|
52489
|
-
}
|
|
52490
52465
|
function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, dontResolveAlias) {
|
|
52491
52466
|
if (entityName.kind === 80 /* Identifier */ && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {
|
|
52492
52467
|
entityName = entityName.parent;
|
|
@@ -55918,7 +55893,7 @@ function createTypeChecker(host) {
|
|
|
55918
55893
|
var _a;
|
|
55919
55894
|
const addUndefined = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration);
|
|
55920
55895
|
const enclosingDeclaration = context.enclosingDeclaration;
|
|
55921
|
-
if (!isErrorType(type)
|
|
55896
|
+
if (enclosingDeclaration && (!isErrorType(type) || context.flags & 1 /* AllowUnresolvedNames */)) {
|
|
55922
55897
|
const declWithExistingAnnotation = declaration && getNonlocalEffectiveTypeAnnotationNode(declaration) ? declaration : getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
|
|
55923
55898
|
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
55924
55899
|
const existing = getNonlocalEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
@@ -56207,7 +56182,7 @@ function createTypeChecker(host) {
|
|
|
56207
56182
|
);
|
|
56208
56183
|
}
|
|
56209
56184
|
if (isNamedDeclaration(node) && node.name.kind === 167 /* ComputedPropertyName */ && !isLateBindableName(node.name)) {
|
|
56210
|
-
if (!(context.flags & 1 /*
|
|
56185
|
+
if (!(context.flags & 1 /* AllowUnresolvedNames */ && hasDynamicName(node) && isEntityNameExpression(node.name.expression) && checkComputedPropertyName(node.name).flags & 1 /* Any */)) {
|
|
56211
56186
|
return void 0;
|
|
56212
56187
|
}
|
|
56213
56188
|
}
|
|
@@ -73711,6 +73686,248 @@ function createTypeChecker(host) {
|
|
|
73711
73686
|
return false;
|
|
73712
73687
|
});
|
|
73713
73688
|
}
|
|
73689
|
+
function markLinkedReferences(location, hint, propSymbol, parentType) {
|
|
73690
|
+
if (!canCollectSymbolAliasAccessabilityData) {
|
|
73691
|
+
return;
|
|
73692
|
+
}
|
|
73693
|
+
if (location.flags & 33554432 /* Ambient */) {
|
|
73694
|
+
return;
|
|
73695
|
+
}
|
|
73696
|
+
switch (hint) {
|
|
73697
|
+
case 1 /* Identifier */:
|
|
73698
|
+
return markIdentifierAliasReferenced(location);
|
|
73699
|
+
case 2 /* Property */:
|
|
73700
|
+
return markPropertyAliasReferenced(location, propSymbol, parentType);
|
|
73701
|
+
case 3 /* ExportAssignment */:
|
|
73702
|
+
return markExportAssignmentAliasReferenced(location);
|
|
73703
|
+
case 4 /* Jsx */:
|
|
73704
|
+
return markJsxAliasReferenced(location);
|
|
73705
|
+
case 5 /* AsyncFunction */:
|
|
73706
|
+
return markAsyncFunctionAliasReferenced(location);
|
|
73707
|
+
case 6 /* ExportImportEquals */:
|
|
73708
|
+
return markImportEqualsAliasReferenced(location);
|
|
73709
|
+
case 7 /* ExportSpecifier */:
|
|
73710
|
+
return markExportSpecifierAliasReferenced(location);
|
|
73711
|
+
case 8 /* Decorator */:
|
|
73712
|
+
return markDecoratorAliasReferenced(location);
|
|
73713
|
+
case 0 /* Unspecified */: {
|
|
73714
|
+
if (isIdentifier(location) && (isExpressionNode(location) || isShorthandPropertyAssignment(location.parent) || isImportEqualsDeclaration(location.parent) && location.parent.moduleReference === location) && shouldMarkIdentifierAliasReferenced(location)) {
|
|
73715
|
+
if (isPropertyAccessOrQualifiedName(location.parent)) {
|
|
73716
|
+
const left = isPropertyAccessExpression(location.parent) ? location.parent.expression : location.parent.left;
|
|
73717
|
+
if (left !== location) return;
|
|
73718
|
+
}
|
|
73719
|
+
markIdentifierAliasReferenced(location);
|
|
73720
|
+
return;
|
|
73721
|
+
}
|
|
73722
|
+
if (isPropertyAccessOrQualifiedName(location)) {
|
|
73723
|
+
let topProp = location;
|
|
73724
|
+
while (isPropertyAccessOrQualifiedName(topProp)) {
|
|
73725
|
+
if (isPartOfTypeNode(topProp)) return;
|
|
73726
|
+
topProp = topProp.parent;
|
|
73727
|
+
}
|
|
73728
|
+
return markPropertyAliasReferenced(location);
|
|
73729
|
+
}
|
|
73730
|
+
if (isExportAssignment(location)) {
|
|
73731
|
+
return markExportAssignmentAliasReferenced(location);
|
|
73732
|
+
}
|
|
73733
|
+
if (isJsxOpeningLikeElement(location) || isJsxOpeningFragment(location)) {
|
|
73734
|
+
return markJsxAliasReferenced(location);
|
|
73735
|
+
}
|
|
73736
|
+
if (isFunctionLikeDeclaration(location) || isMethodSignature(location)) {
|
|
73737
|
+
return markAsyncFunctionAliasReferenced(location);
|
|
73738
|
+
}
|
|
73739
|
+
if (isImportEqualsDeclaration(location)) {
|
|
73740
|
+
if (isInternalModuleImportEqualsDeclaration(location) || checkExternalImportOrExportDeclaration(location)) {
|
|
73741
|
+
return markImportEqualsAliasReferenced(location);
|
|
73742
|
+
}
|
|
73743
|
+
return;
|
|
73744
|
+
}
|
|
73745
|
+
if (isExportSpecifier(location)) {
|
|
73746
|
+
return markExportSpecifierAliasReferenced(location);
|
|
73747
|
+
}
|
|
73748
|
+
if (!compilerOptions.emitDecoratorMetadata) {
|
|
73749
|
+
return;
|
|
73750
|
+
}
|
|
73751
|
+
if (!canHaveDecorators(location) || !hasDecorators(location) || !location.modifiers || !nodeCanBeDecorated(legacyDecorators, location, location.parent, location.parent.parent)) {
|
|
73752
|
+
return;
|
|
73753
|
+
}
|
|
73754
|
+
return markDecoratorAliasReferenced(location);
|
|
73755
|
+
}
|
|
73756
|
+
default:
|
|
73757
|
+
Debug.assertNever(hint, `Unhandled reference hint: ${hint}`);
|
|
73758
|
+
}
|
|
73759
|
+
}
|
|
73760
|
+
function markIdentifierAliasReferenced(location) {
|
|
73761
|
+
const symbol = getResolvedSymbol(location);
|
|
73762
|
+
if (symbol && symbol !== argumentsSymbol && symbol !== unknownSymbol && !isThisInTypeQuery(location)) {
|
|
73763
|
+
markAliasReferenced(symbol, location);
|
|
73764
|
+
}
|
|
73765
|
+
}
|
|
73766
|
+
function markPropertyAliasReferenced(location, propSymbol, parentType) {
|
|
73767
|
+
const left = isPropertyAccessExpression(location) ? location.expression : location.left;
|
|
73768
|
+
if (isThisIdentifier(left) || !isIdentifier(left)) {
|
|
73769
|
+
return;
|
|
73770
|
+
}
|
|
73771
|
+
const parentSymbol = getResolvedSymbol(left);
|
|
73772
|
+
if (!parentSymbol || parentSymbol === unknownSymbol) {
|
|
73773
|
+
return;
|
|
73774
|
+
}
|
|
73775
|
+
if (getIsolatedModules(compilerOptions) || shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(location)) {
|
|
73776
|
+
markAliasReferenced(parentSymbol, location);
|
|
73777
|
+
return;
|
|
73778
|
+
}
|
|
73779
|
+
const leftType = parentType || checkExpressionCached(left);
|
|
73780
|
+
if (isTypeAny(leftType) || leftType === silentNeverType) {
|
|
73781
|
+
markAliasReferenced(parentSymbol, location);
|
|
73782
|
+
return;
|
|
73783
|
+
}
|
|
73784
|
+
let prop = propSymbol;
|
|
73785
|
+
if (!prop && !parentType) {
|
|
73786
|
+
const right = isPropertyAccessExpression(location) ? location.name : location.right;
|
|
73787
|
+
const lexicallyScopedSymbol = isPrivateIdentifier(right) && lookupSymbolForPrivateIdentifierDeclaration(right.escapedText, right);
|
|
73788
|
+
const assignmentKind = getAssignmentTargetKind(location);
|
|
73789
|
+
const apparentType = getApparentType(assignmentKind !== 0 /* None */ || isMethodAccessForCall(location) ? getWidenedType(leftType) : leftType);
|
|
73790
|
+
prop = isPrivateIdentifier(right) ? lexicallyScopedSymbol && getPrivateIdentifierPropertyOfType(apparentType, lexicallyScopedSymbol) || void 0 : getPropertyOfType(apparentType, right.escapedText);
|
|
73791
|
+
}
|
|
73792
|
+
if (!(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* EnumMember */ && location.parent.kind === 306 /* EnumMember */))) {
|
|
73793
|
+
markAliasReferenced(parentSymbol, location);
|
|
73794
|
+
}
|
|
73795
|
+
return;
|
|
73796
|
+
}
|
|
73797
|
+
function markExportAssignmentAliasReferenced(location) {
|
|
73798
|
+
if (isIdentifier(location.expression)) {
|
|
73799
|
+
const id = location.expression;
|
|
73800
|
+
const sym = getExportSymbolOfValueSymbolIfExported(resolveEntityName(
|
|
73801
|
+
id,
|
|
73802
|
+
-1 /* All */,
|
|
73803
|
+
/*ignoreErrors*/
|
|
73804
|
+
true,
|
|
73805
|
+
/*dontResolveAlias*/
|
|
73806
|
+
true,
|
|
73807
|
+
location
|
|
73808
|
+
));
|
|
73809
|
+
if (sym) {
|
|
73810
|
+
markAliasReferenced(sym, id);
|
|
73811
|
+
}
|
|
73812
|
+
}
|
|
73813
|
+
}
|
|
73814
|
+
function markJsxAliasReferenced(node) {
|
|
73815
|
+
if (!getJsxNamespaceContainerForImplicitImport(node)) {
|
|
73816
|
+
const jsxFactoryRefErr = diagnostics && compilerOptions.jsx === 2 /* React */ ? Diagnostics.Cannot_find_name_0 : void 0;
|
|
73817
|
+
const jsxFactoryNamespace = getJsxNamespace(node);
|
|
73818
|
+
const jsxFactoryLocation = isJsxOpeningLikeElement(node) ? node.tagName : node;
|
|
73819
|
+
let jsxFactorySym;
|
|
73820
|
+
if (!(isJsxOpeningFragment(node) && jsxFactoryNamespace === "null")) {
|
|
73821
|
+
jsxFactorySym = resolveName(
|
|
73822
|
+
jsxFactoryLocation,
|
|
73823
|
+
jsxFactoryNamespace,
|
|
73824
|
+
111551 /* Value */,
|
|
73825
|
+
jsxFactoryRefErr,
|
|
73826
|
+
/*isUse*/
|
|
73827
|
+
true
|
|
73828
|
+
);
|
|
73829
|
+
}
|
|
73830
|
+
if (jsxFactorySym) {
|
|
73831
|
+
jsxFactorySym.isReferenced = -1 /* All */;
|
|
73832
|
+
if (canCollectSymbolAliasAccessabilityData && jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
|
|
73833
|
+
markAliasSymbolAsReferenced(jsxFactorySym);
|
|
73834
|
+
}
|
|
73835
|
+
}
|
|
73836
|
+
if (isJsxOpeningFragment(node)) {
|
|
73837
|
+
const file = getSourceFileOfNode(node);
|
|
73838
|
+
const localJsxNamespace = getLocalJsxNamespace(file);
|
|
73839
|
+
if (localJsxNamespace) {
|
|
73840
|
+
resolveName(
|
|
73841
|
+
jsxFactoryLocation,
|
|
73842
|
+
localJsxNamespace,
|
|
73843
|
+
111551 /* Value */,
|
|
73844
|
+
jsxFactoryRefErr,
|
|
73845
|
+
/*isUse*/
|
|
73846
|
+
true
|
|
73847
|
+
);
|
|
73848
|
+
}
|
|
73849
|
+
}
|
|
73850
|
+
}
|
|
73851
|
+
return;
|
|
73852
|
+
}
|
|
73853
|
+
function markAsyncFunctionAliasReferenced(location) {
|
|
73854
|
+
if (languageVersion < 2 /* ES2015 */) {
|
|
73855
|
+
if (getFunctionFlags(location) & 2 /* Async */) {
|
|
73856
|
+
const returnTypeNode = getEffectiveReturnTypeNode(location);
|
|
73857
|
+
markTypeNodeAsReferenced(returnTypeNode);
|
|
73858
|
+
}
|
|
73859
|
+
}
|
|
73860
|
+
}
|
|
73861
|
+
function markImportEqualsAliasReferenced(location) {
|
|
73862
|
+
if (hasSyntacticModifier(location, 32 /* Export */)) {
|
|
73863
|
+
markExportAsReferenced(location);
|
|
73864
|
+
}
|
|
73865
|
+
}
|
|
73866
|
+
function markExportSpecifierAliasReferenced(location) {
|
|
73867
|
+
if (!location.parent.parent.moduleSpecifier && !location.isTypeOnly && !location.parent.parent.isTypeOnly) {
|
|
73868
|
+
const exportedName = location.propertyName || location.name;
|
|
73869
|
+
const symbol = resolveName(
|
|
73870
|
+
exportedName,
|
|
73871
|
+
exportedName.escapedText,
|
|
73872
|
+
111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */,
|
|
73873
|
+
/*nameNotFoundMessage*/
|
|
73874
|
+
void 0,
|
|
73875
|
+
/*isUse*/
|
|
73876
|
+
true
|
|
73877
|
+
);
|
|
73878
|
+
if (symbol && (symbol === undefinedSymbol || symbol === globalThisSymbol || symbol.declarations && isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) {
|
|
73879
|
+
} else {
|
|
73880
|
+
const target = symbol && (symbol.flags & 2097152 /* Alias */ ? resolveAlias(symbol) : symbol);
|
|
73881
|
+
if (!target || getSymbolFlags(target) & 111551 /* Value */) {
|
|
73882
|
+
markExportAsReferenced(location);
|
|
73883
|
+
markIdentifierAliasReferenced(location.propertyName || location.name);
|
|
73884
|
+
}
|
|
73885
|
+
}
|
|
73886
|
+
return;
|
|
73887
|
+
}
|
|
73888
|
+
}
|
|
73889
|
+
function markDecoratorAliasReferenced(node) {
|
|
73890
|
+
if (compilerOptions.emitDecoratorMetadata) {
|
|
73891
|
+
const firstDecorator = find(node.modifiers, isDecorator);
|
|
73892
|
+
if (!firstDecorator) {
|
|
73893
|
+
return;
|
|
73894
|
+
}
|
|
73895
|
+
checkExternalEmitHelpers(firstDecorator, 16 /* Metadata */);
|
|
73896
|
+
switch (node.kind) {
|
|
73897
|
+
case 263 /* ClassDeclaration */:
|
|
73898
|
+
const constructor = getFirstConstructorWithBody(node);
|
|
73899
|
+
if (constructor) {
|
|
73900
|
+
for (const parameter of constructor.parameters) {
|
|
73901
|
+
markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
|
|
73902
|
+
}
|
|
73903
|
+
}
|
|
73904
|
+
break;
|
|
73905
|
+
case 177 /* GetAccessor */:
|
|
73906
|
+
case 178 /* SetAccessor */:
|
|
73907
|
+
const otherKind = node.kind === 177 /* GetAccessor */ ? 178 /* SetAccessor */ : 177 /* GetAccessor */;
|
|
73908
|
+
const otherAccessor = getDeclarationOfKind(getSymbolOfDeclaration(node), otherKind);
|
|
73909
|
+
markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor));
|
|
73910
|
+
break;
|
|
73911
|
+
case 174 /* MethodDeclaration */:
|
|
73912
|
+
for (const parameter of node.parameters) {
|
|
73913
|
+
markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
|
|
73914
|
+
}
|
|
73915
|
+
markDecoratorMedataDataTypeNodeAsReferenced(getEffectiveReturnTypeNode(node));
|
|
73916
|
+
break;
|
|
73917
|
+
case 172 /* PropertyDeclaration */:
|
|
73918
|
+
markDecoratorMedataDataTypeNodeAsReferenced(getEffectiveTypeAnnotationNode(node));
|
|
73919
|
+
break;
|
|
73920
|
+
case 169 /* Parameter */:
|
|
73921
|
+
markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node));
|
|
73922
|
+
const containingSignature = node.parent;
|
|
73923
|
+
for (const parameter of containingSignature.parameters) {
|
|
73924
|
+
markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
|
|
73925
|
+
}
|
|
73926
|
+
markDecoratorMedataDataTypeNodeAsReferenced(getEffectiveReturnTypeNode(containingSignature));
|
|
73927
|
+
break;
|
|
73928
|
+
}
|
|
73929
|
+
}
|
|
73930
|
+
}
|
|
73714
73931
|
function markAliasReferenced(symbol, location) {
|
|
73715
73932
|
if (!canCollectSymbolAliasAccessabilityData) {
|
|
73716
73933
|
return;
|
|
@@ -73732,6 +73949,77 @@ function createTypeChecker(host) {
|
|
|
73732
73949
|
}
|
|
73733
73950
|
}
|
|
73734
73951
|
}
|
|
73952
|
+
function markAliasSymbolAsReferenced(symbol) {
|
|
73953
|
+
Debug.assert(canCollectSymbolAliasAccessabilityData);
|
|
73954
|
+
const links = getSymbolLinks(symbol);
|
|
73955
|
+
if (!links.referenced) {
|
|
73956
|
+
links.referenced = true;
|
|
73957
|
+
const node = getDeclarationOfAliasSymbol(symbol);
|
|
73958
|
+
if (!node) return Debug.fail();
|
|
73959
|
+
if (isInternalModuleImportEqualsDeclaration(node)) {
|
|
73960
|
+
if (getSymbolFlags(resolveSymbol(symbol)) & 111551 /* Value */) {
|
|
73961
|
+
const left = getFirstIdentifier(node.moduleReference);
|
|
73962
|
+
markIdentifierAliasReferenced(left);
|
|
73963
|
+
}
|
|
73964
|
+
}
|
|
73965
|
+
}
|
|
73966
|
+
}
|
|
73967
|
+
function markExportAsReferenced(node) {
|
|
73968
|
+
const symbol = getSymbolOfDeclaration(node);
|
|
73969
|
+
const target = resolveAlias(symbol);
|
|
73970
|
+
if (target) {
|
|
73971
|
+
const markAlias = target === unknownSymbol || getSymbolFlags(
|
|
73972
|
+
symbol,
|
|
73973
|
+
/*excludeTypeOnlyMeanings*/
|
|
73974
|
+
true
|
|
73975
|
+
) & 111551 /* Value */ && !isConstEnumOrConstEnumOnlyModule(target);
|
|
73976
|
+
if (markAlias) {
|
|
73977
|
+
markAliasSymbolAsReferenced(symbol);
|
|
73978
|
+
}
|
|
73979
|
+
}
|
|
73980
|
+
}
|
|
73981
|
+
function markEntityNameOrEntityExpressionAsReference(typeName, forDecoratorMetadata) {
|
|
73982
|
+
if (!typeName) return;
|
|
73983
|
+
const rootName = getFirstIdentifier(typeName);
|
|
73984
|
+
const meaning = (typeName.kind === 80 /* Identifier */ ? 788968 /* Type */ : 1920 /* Namespace */) | 2097152 /* Alias */;
|
|
73985
|
+
const rootSymbol = resolveName(
|
|
73986
|
+
rootName,
|
|
73987
|
+
rootName.escapedText,
|
|
73988
|
+
meaning,
|
|
73989
|
+
/*nameNotFoundMessage*/
|
|
73990
|
+
void 0,
|
|
73991
|
+
/*isUse*/
|
|
73992
|
+
true
|
|
73993
|
+
);
|
|
73994
|
+
if (rootSymbol && rootSymbol.flags & 2097152 /* Alias */) {
|
|
73995
|
+
if (canCollectSymbolAliasAccessabilityData && symbolIsValue(rootSymbol) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol)) && !getTypeOnlyAliasDeclaration(rootSymbol)) {
|
|
73996
|
+
markAliasSymbolAsReferenced(rootSymbol);
|
|
73997
|
+
} else if (forDecoratorMetadata && getIsolatedModules(compilerOptions) && getEmitModuleKind(compilerOptions) >= 5 /* ES2015 */ && !symbolIsValue(rootSymbol) && !some(rootSymbol.declarations, isTypeOnlyImportOrExportDeclaration)) {
|
|
73998
|
+
const diag2 = error2(typeName, Diagnostics.A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled);
|
|
73999
|
+
const aliasDeclaration = find(rootSymbol.declarations || emptyArray, isAliasSymbolDeclaration2);
|
|
74000
|
+
if (aliasDeclaration) {
|
|
74001
|
+
addRelatedInfo(diag2, createDiagnosticForNode(aliasDeclaration, Diagnostics._0_was_imported_here, idText(rootName)));
|
|
74002
|
+
}
|
|
74003
|
+
}
|
|
74004
|
+
}
|
|
74005
|
+
}
|
|
74006
|
+
function markTypeNodeAsReferenced(node) {
|
|
74007
|
+
markEntityNameOrEntityExpressionAsReference(
|
|
74008
|
+
node && getEntityNameFromTypeNode(node),
|
|
74009
|
+
/*forDecoratorMetadata*/
|
|
74010
|
+
false
|
|
74011
|
+
);
|
|
74012
|
+
}
|
|
74013
|
+
function markDecoratorMedataDataTypeNodeAsReferenced(node) {
|
|
74014
|
+
const entityName = getEntityNameForDecoratorMetadata(node);
|
|
74015
|
+
if (entityName && isEntityName(entityName)) {
|
|
74016
|
+
markEntityNameOrEntityExpressionAsReference(
|
|
74017
|
+
entityName,
|
|
74018
|
+
/*forDecoratorMetadata*/
|
|
74019
|
+
true
|
|
74020
|
+
);
|
|
74021
|
+
}
|
|
74022
|
+
}
|
|
73735
74023
|
function getNarrowedTypeOfSymbol(symbol, location, checkMode) {
|
|
73736
74024
|
var _a;
|
|
73737
74025
|
const type = getTypeOfSymbol(symbol, checkMode);
|
|
@@ -73827,7 +74115,7 @@ function createTypeChecker(host) {
|
|
|
73827
74115
|
return getTypeOfSymbol(symbol);
|
|
73828
74116
|
}
|
|
73829
74117
|
if (shouldMarkIdentifierAliasReferenced(node)) {
|
|
73830
|
-
|
|
74118
|
+
markLinkedReferences(node, 1 /* Identifier */);
|
|
73831
74119
|
}
|
|
73832
74120
|
const localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
|
|
73833
74121
|
const targetSymbol = resolveAliasWithDeprecationCheck(localOrExportSymbol, node);
|
|
@@ -76370,42 +76658,7 @@ function createTypeChecker(host) {
|
|
|
76370
76658
|
checkGrammarJsxElement(node);
|
|
76371
76659
|
}
|
|
76372
76660
|
checkJsxPreconditions(node);
|
|
76373
|
-
|
|
76374
|
-
const jsxFactoryRefErr = diagnostics && compilerOptions.jsx === 2 /* React */ ? Diagnostics.Cannot_find_name_0 : void 0;
|
|
76375
|
-
const jsxFactoryNamespace = getJsxNamespace(node);
|
|
76376
|
-
const jsxFactoryLocation = isNodeOpeningLikeElement ? node.tagName : node;
|
|
76377
|
-
let jsxFactorySym;
|
|
76378
|
-
if (!(isJsxOpeningFragment(node) && jsxFactoryNamespace === "null")) {
|
|
76379
|
-
jsxFactorySym = resolveName(
|
|
76380
|
-
jsxFactoryLocation,
|
|
76381
|
-
jsxFactoryNamespace,
|
|
76382
|
-
111551 /* Value */,
|
|
76383
|
-
jsxFactoryRefErr,
|
|
76384
|
-
/*isUse*/
|
|
76385
|
-
true
|
|
76386
|
-
);
|
|
76387
|
-
}
|
|
76388
|
-
if (jsxFactorySym) {
|
|
76389
|
-
jsxFactorySym.isReferenced = -1 /* All */;
|
|
76390
|
-
if (canCollectSymbolAliasAccessabilityData && jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
|
|
76391
|
-
markAliasSymbolAsReferenced(jsxFactorySym);
|
|
76392
|
-
}
|
|
76393
|
-
}
|
|
76394
|
-
if (isJsxOpeningFragment(node)) {
|
|
76395
|
-
const file = getSourceFileOfNode(node);
|
|
76396
|
-
const localJsxNamespace = getLocalJsxNamespace(file);
|
|
76397
|
-
if (localJsxNamespace) {
|
|
76398
|
-
resolveName(
|
|
76399
|
-
jsxFactoryLocation,
|
|
76400
|
-
localJsxNamespace,
|
|
76401
|
-
111551 /* Value */,
|
|
76402
|
-
jsxFactoryRefErr,
|
|
76403
|
-
/*isUse*/
|
|
76404
|
-
true
|
|
76405
|
-
);
|
|
76406
|
-
}
|
|
76407
|
-
}
|
|
76408
|
-
}
|
|
76661
|
+
markLinkedReferences(node, 4 /* Jsx */);
|
|
76409
76662
|
if (isNodeOpeningLikeElement) {
|
|
76410
76663
|
const jsxOpeningLikeNode = node;
|
|
76411
76664
|
const sig = getResolvedSignature(jsxOpeningLikeNode);
|
|
@@ -76836,7 +77089,13 @@ function createTypeChecker(host) {
|
|
|
76836
77089
|
} else {
|
|
76837
77090
|
if (isAnyLike) {
|
|
76838
77091
|
if (isIdentifier(left) && parentSymbol) {
|
|
76839
|
-
|
|
77092
|
+
markLinkedReferences(
|
|
77093
|
+
node,
|
|
77094
|
+
2 /* Property */,
|
|
77095
|
+
/*propSymbol*/
|
|
77096
|
+
void 0,
|
|
77097
|
+
leftType
|
|
77098
|
+
);
|
|
76840
77099
|
}
|
|
76841
77100
|
return isErrorType(apparentType) ? errorType : apparentType;
|
|
76842
77101
|
}
|
|
@@ -76849,9 +77108,7 @@ function createTypeChecker(host) {
|
|
|
76849
77108
|
node.kind === 166 /* QualifiedName */
|
|
76850
77109
|
);
|
|
76851
77110
|
}
|
|
76852
|
-
|
|
76853
|
-
markAliasReferenced(parentSymbol, node);
|
|
76854
|
-
}
|
|
77111
|
+
markLinkedReferences(node, 2 /* Property */, prop, leftType);
|
|
76855
77112
|
let propType;
|
|
76856
77113
|
if (!prop) {
|
|
76857
77114
|
const indexInfo = !isPrivateIdentifier(right) && (assignmentKind === 0 /* None */ || !isGenericObjectType(leftType) || isThisTypeParameter(leftType)) ? getApplicableIndexInfoForName(apparentType, right.escapedText) : void 0;
|
|
@@ -83784,7 +84041,7 @@ function createTypeChecker(host) {
|
|
|
83784
84041
|
return;
|
|
83785
84042
|
}
|
|
83786
84043
|
} else {
|
|
83787
|
-
|
|
84044
|
+
markLinkedReferences(node, 5 /* AsyncFunction */);
|
|
83788
84045
|
if (isErrorType(returnType)) {
|
|
83789
84046
|
return;
|
|
83790
84047
|
}
|
|
@@ -83968,48 +84225,6 @@ function createTypeChecker(host) {
|
|
|
83968
84225
|
voidType
|
|
83969
84226
|
);
|
|
83970
84227
|
}
|
|
83971
|
-
function markTypeNodeAsReferenced(node) {
|
|
83972
|
-
markEntityNameOrEntityExpressionAsReference(
|
|
83973
|
-
node && getEntityNameFromTypeNode(node),
|
|
83974
|
-
/*forDecoratorMetadata*/
|
|
83975
|
-
false
|
|
83976
|
-
);
|
|
83977
|
-
}
|
|
83978
|
-
function markEntityNameOrEntityExpressionAsReference(typeName, forDecoratorMetadata) {
|
|
83979
|
-
if (!typeName) return;
|
|
83980
|
-
const rootName = getFirstIdentifier(typeName);
|
|
83981
|
-
const meaning = (typeName.kind === 80 /* Identifier */ ? 788968 /* Type */ : 1920 /* Namespace */) | 2097152 /* Alias */;
|
|
83982
|
-
const rootSymbol = resolveName(
|
|
83983
|
-
rootName,
|
|
83984
|
-
rootName.escapedText,
|
|
83985
|
-
meaning,
|
|
83986
|
-
/*nameNotFoundMessage*/
|
|
83987
|
-
void 0,
|
|
83988
|
-
/*isUse*/
|
|
83989
|
-
true
|
|
83990
|
-
);
|
|
83991
|
-
if (rootSymbol && rootSymbol.flags & 2097152 /* Alias */) {
|
|
83992
|
-
if (canCollectSymbolAliasAccessabilityData && symbolIsValue(rootSymbol) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol)) && !getTypeOnlyAliasDeclaration(rootSymbol)) {
|
|
83993
|
-
markAliasSymbolAsReferenced(rootSymbol);
|
|
83994
|
-
} else if (forDecoratorMetadata && getIsolatedModules(compilerOptions) && getEmitModuleKind(compilerOptions) >= 5 /* ES2015 */ && !symbolIsValue(rootSymbol) && !some(rootSymbol.declarations, isTypeOnlyImportOrExportDeclaration)) {
|
|
83995
|
-
const diag2 = error2(typeName, Diagnostics.A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled);
|
|
83996
|
-
const aliasDeclaration = find(rootSymbol.declarations || emptyArray, isAliasSymbolDeclaration2);
|
|
83997
|
-
if (aliasDeclaration) {
|
|
83998
|
-
addRelatedInfo(diag2, createDiagnosticForNode(aliasDeclaration, Diagnostics._0_was_imported_here, idText(rootName)));
|
|
83999
|
-
}
|
|
84000
|
-
}
|
|
84001
|
-
}
|
|
84002
|
-
}
|
|
84003
|
-
function markDecoratorMedataDataTypeNodeAsReferenced(node) {
|
|
84004
|
-
const entityName = getEntityNameForDecoratorMetadata(node);
|
|
84005
|
-
if (entityName && isEntityName(entityName)) {
|
|
84006
|
-
markEntityNameOrEntityExpressionAsReference(
|
|
84007
|
-
entityName,
|
|
84008
|
-
/*forDecoratorMetadata*/
|
|
84009
|
-
true
|
|
84010
|
-
);
|
|
84011
|
-
}
|
|
84012
|
-
}
|
|
84013
84228
|
function getEntityNameForDecoratorMetadata(node) {
|
|
84014
84229
|
if (node) {
|
|
84015
84230
|
switch (node.kind) {
|
|
@@ -84089,42 +84304,7 @@ function createTypeChecker(host) {
|
|
|
84089
84304
|
}
|
|
84090
84305
|
}
|
|
84091
84306
|
}
|
|
84092
|
-
|
|
84093
|
-
checkExternalEmitHelpers(firstDecorator, 16 /* Metadata */);
|
|
84094
|
-
switch (node.kind) {
|
|
84095
|
-
case 263 /* ClassDeclaration */:
|
|
84096
|
-
const constructor = getFirstConstructorWithBody(node);
|
|
84097
|
-
if (constructor) {
|
|
84098
|
-
for (const parameter of constructor.parameters) {
|
|
84099
|
-
markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
|
|
84100
|
-
}
|
|
84101
|
-
}
|
|
84102
|
-
break;
|
|
84103
|
-
case 177 /* GetAccessor */:
|
|
84104
|
-
case 178 /* SetAccessor */:
|
|
84105
|
-
const otherKind = node.kind === 177 /* GetAccessor */ ? 178 /* SetAccessor */ : 177 /* GetAccessor */;
|
|
84106
|
-
const otherAccessor = getDeclarationOfKind(getSymbolOfDeclaration(node), otherKind);
|
|
84107
|
-
markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor));
|
|
84108
|
-
break;
|
|
84109
|
-
case 174 /* MethodDeclaration */:
|
|
84110
|
-
for (const parameter of node.parameters) {
|
|
84111
|
-
markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
|
|
84112
|
-
}
|
|
84113
|
-
markDecoratorMedataDataTypeNodeAsReferenced(getEffectiveReturnTypeNode(node));
|
|
84114
|
-
break;
|
|
84115
|
-
case 172 /* PropertyDeclaration */:
|
|
84116
|
-
markDecoratorMedataDataTypeNodeAsReferenced(getEffectiveTypeAnnotationNode(node));
|
|
84117
|
-
break;
|
|
84118
|
-
case 169 /* Parameter */:
|
|
84119
|
-
markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node));
|
|
84120
|
-
const containingSignature = node.parent;
|
|
84121
|
-
for (const parameter of containingSignature.parameters) {
|
|
84122
|
-
markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
|
|
84123
|
-
}
|
|
84124
|
-
markDecoratorMedataDataTypeNodeAsReferenced(getEffectiveReturnTypeNode(containingSignature));
|
|
84125
|
-
break;
|
|
84126
|
-
}
|
|
84127
|
-
}
|
|
84307
|
+
markLinkedReferences(node, 8 /* Decorator */);
|
|
84128
84308
|
for (const modifier of node.modifiers) {
|
|
84129
84309
|
if (isDecorator(modifier)) {
|
|
84130
84310
|
checkDecorator(modifier);
|
|
@@ -87465,9 +87645,7 @@ function createTypeChecker(host) {
|
|
|
87465
87645
|
checkGrammarModifiers(node);
|
|
87466
87646
|
if (isInternalModuleImportEqualsDeclaration(node) || checkExternalImportOrExportDeclaration(node)) {
|
|
87467
87647
|
checkImportBinding(node);
|
|
87468
|
-
|
|
87469
|
-
markExportAsReferenced(node);
|
|
87470
|
-
}
|
|
87648
|
+
markLinkedReferences(node, 6 /* ExportImportEquals */);
|
|
87471
87649
|
if (node.moduleReference.kind !== 283 /* ExternalModuleReference */) {
|
|
87472
87650
|
const target = resolveAlias(getSymbolOfDeclaration(node));
|
|
87473
87651
|
if (target !== unknownSymbol) {
|
|
@@ -87565,13 +87743,7 @@ function createTypeChecker(host) {
|
|
|
87565
87743
|
if (symbol && (symbol === undefinedSymbol || symbol === globalThisSymbol || symbol.declarations && isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) {
|
|
87566
87744
|
error2(exportedName, Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, idText(exportedName));
|
|
87567
87745
|
} else {
|
|
87568
|
-
|
|
87569
|
-
markExportAsReferenced(node);
|
|
87570
|
-
}
|
|
87571
|
-
const target = symbol && (symbol.flags & 2097152 /* Alias */ ? resolveAlias(symbol) : symbol);
|
|
87572
|
-
if (!target || getSymbolFlags(target) & 111551 /* Value */) {
|
|
87573
|
-
checkExpressionCached(node.propertyName || node.name);
|
|
87574
|
-
}
|
|
87746
|
+
markLinkedReferences(node, 7 /* ExportSpecifier */);
|
|
87575
87747
|
}
|
|
87576
87748
|
} else {
|
|
87577
87749
|
if (getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && idText(node.propertyName || node.name) === "default") {
|
|
@@ -87613,8 +87785,8 @@ function createTypeChecker(host) {
|
|
|
87613
87785
|
node
|
|
87614
87786
|
));
|
|
87615
87787
|
if (sym) {
|
|
87788
|
+
markLinkedReferences(node, 3 /* ExportAssignment */);
|
|
87616
87789
|
const typeOnlyDeclaration = getTypeOnlyAliasDeclaration(sym, 111551 /* Value */);
|
|
87617
|
-
markAliasReferenced(sym, id);
|
|
87618
87790
|
if (getSymbolFlags(sym) & 111551 /* Value */) {
|
|
87619
87791
|
checkExpressionCached(id);
|
|
87620
87792
|
if (!isIllegalExportDefaultInCJS && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax && typeOnlyDeclaration) {
|
|
@@ -114856,7 +115028,7 @@ function getDeclarationDiagnostics(host, resolver, file) {
|
|
|
114856
115028
|
);
|
|
114857
115029
|
return result.diagnostics;
|
|
114858
115030
|
}
|
|
114859
|
-
var declarationEmitNodeBuilderFlags = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ | 1 /*
|
|
115031
|
+
var declarationEmitNodeBuilderFlags = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ | 1 /* AllowUnresolvedNames */ | 4 /* GenerateNamesForShadowedTypeParams */ | 1 /* NoTruncation */;
|
|
114860
115032
|
function transformDeclarations(context) {
|
|
114861
115033
|
const throwDiagnostic = () => Debug.fail("Diagnostic emitted without context");
|
|
114862
115034
|
let getSymbolAccessibilityDiagnostic = throwDiagnostic;
|
|
@@ -134420,12 +134592,12 @@ var CompletionTriggerKind = /* @__PURE__ */ ((CompletionTriggerKind2) => {
|
|
|
134420
134592
|
CompletionTriggerKind2[CompletionTriggerKind2["TriggerForIncompleteCompletions"] = 3] = "TriggerForIncompleteCompletions";
|
|
134421
134593
|
return CompletionTriggerKind2;
|
|
134422
134594
|
})(CompletionTriggerKind || {});
|
|
134423
|
-
var
|
|
134424
|
-
|
|
134425
|
-
|
|
134426
|
-
|
|
134427
|
-
return
|
|
134428
|
-
})(
|
|
134595
|
+
var InlayHintKind2 = /* @__PURE__ */ ((InlayHintKind3) => {
|
|
134596
|
+
InlayHintKind3["Type"] = "Type";
|
|
134597
|
+
InlayHintKind3["Parameter"] = "Parameter";
|
|
134598
|
+
InlayHintKind3["Enum"] = "Enum";
|
|
134599
|
+
return InlayHintKind3;
|
|
134600
|
+
})(InlayHintKind2 || {});
|
|
134429
134601
|
var HighlightSpanKind = /* @__PURE__ */ ((HighlightSpanKind2) => {
|
|
134430
134602
|
HighlightSpanKind2["none"] = "none";
|
|
134431
134603
|
HighlightSpanKind2["definition"] = "definition";
|
|
@@ -134676,13 +134848,13 @@ var scanner = createScanner(
|
|
|
134676
134848
|
/*skipTrivia*/
|
|
134677
134849
|
true
|
|
134678
134850
|
);
|
|
134679
|
-
var SemanticMeaning = /* @__PURE__ */ ((
|
|
134680
|
-
|
|
134681
|
-
|
|
134682
|
-
|
|
134683
|
-
|
|
134684
|
-
|
|
134685
|
-
return
|
|
134851
|
+
var SemanticMeaning = /* @__PURE__ */ ((SemanticMeaning2) => {
|
|
134852
|
+
SemanticMeaning2[SemanticMeaning2["None"] = 0] = "None";
|
|
134853
|
+
SemanticMeaning2[SemanticMeaning2["Value"] = 1] = "Value";
|
|
134854
|
+
SemanticMeaning2[SemanticMeaning2["Type"] = 2] = "Type";
|
|
134855
|
+
SemanticMeaning2[SemanticMeaning2["Namespace"] = 4] = "Namespace";
|
|
134856
|
+
SemanticMeaning2[SemanticMeaning2["All"] = 7] = "All";
|
|
134857
|
+
return SemanticMeaning2;
|
|
134686
134858
|
})(SemanticMeaning || {});
|
|
134687
134859
|
function getMeaningFromDeclaration(node) {
|
|
134688
134860
|
switch (node.kind) {
|
|
@@ -136631,7 +136803,11 @@ function getPrecedingNonSpaceCharacterPosition(text, position) {
|
|
|
136631
136803
|
function getSynthesizedDeepClone(node, includeTrivia = true) {
|
|
136632
136804
|
const clone2 = node && getSynthesizedDeepCloneWorker(node);
|
|
136633
136805
|
if (clone2 && !includeTrivia) suppressLeadingAndTrailingTrivia(clone2);
|
|
136634
|
-
return
|
|
136806
|
+
return setParentRecursive(
|
|
136807
|
+
clone2,
|
|
136808
|
+
/*incremental*/
|
|
136809
|
+
false
|
|
136810
|
+
);
|
|
136635
136811
|
}
|
|
136636
136812
|
function getSynthesizedDeepCloneWithReplacements(node, includeTrivia, replaceNode) {
|
|
136637
136813
|
let clone2 = replaceNode(node);
|
|
@@ -137228,13 +137404,13 @@ function getNamesForExportedSymbol(symbol, scriptTarget) {
|
|
|
137228
137404
|
if (needsNameFromDeclaration(symbol)) {
|
|
137229
137405
|
const fromDeclaration = getDefaultLikeExportNameFromDeclaration(symbol);
|
|
137230
137406
|
if (fromDeclaration) return fromDeclaration;
|
|
137231
|
-
const fileNameCase =
|
|
137407
|
+
const fileNameCase = moduleSymbolToValidIdentifier(
|
|
137232
137408
|
getSymbolParentOrFail(symbol),
|
|
137233
137409
|
scriptTarget,
|
|
137234
137410
|
/*forceCapitalize*/
|
|
137235
137411
|
false
|
|
137236
137412
|
);
|
|
137237
|
-
const capitalized =
|
|
137413
|
+
const capitalized = moduleSymbolToValidIdentifier(
|
|
137238
137414
|
getSymbolParentOrFail(symbol),
|
|
137239
137415
|
scriptTarget,
|
|
137240
137416
|
/*forceCapitalize*/
|
|
@@ -137247,7 +137423,7 @@ function getNamesForExportedSymbol(symbol, scriptTarget) {
|
|
|
137247
137423
|
}
|
|
137248
137424
|
function getNameForExportedSymbol(symbol, scriptTarget, preferCapitalized) {
|
|
137249
137425
|
if (needsNameFromDeclaration(symbol)) {
|
|
137250
|
-
return getDefaultLikeExportNameFromDeclaration(symbol) ||
|
|
137426
|
+
return getDefaultLikeExportNameFromDeclaration(symbol) || moduleSymbolToValidIdentifier(getSymbolParentOrFail(symbol), scriptTarget, !!preferCapitalized);
|
|
137251
137427
|
}
|
|
137252
137428
|
return symbol.name;
|
|
137253
137429
|
}
|
|
@@ -137278,6 +137454,36 @@ function getSymbolParentOrFail(symbol) {
|
|
|
137278
137454
|
}).join(", ")}.`
|
|
137279
137455
|
);
|
|
137280
137456
|
}
|
|
137457
|
+
function moduleSymbolToValidIdentifier(moduleSymbol, target, forceCapitalize) {
|
|
137458
|
+
return moduleSpecifierToValidIdentifier(removeFileExtension(stripQuotes(moduleSymbol.name)), target, forceCapitalize);
|
|
137459
|
+
}
|
|
137460
|
+
function moduleSpecifierToValidIdentifier(moduleSpecifier, target, forceCapitalize) {
|
|
137461
|
+
const baseName = getBaseFileName(removeSuffix(moduleSpecifier, "/index"));
|
|
137462
|
+
let res = "";
|
|
137463
|
+
let lastCharWasValid = true;
|
|
137464
|
+
const firstCharCode = baseName.charCodeAt(0);
|
|
137465
|
+
if (isIdentifierStart(firstCharCode, target)) {
|
|
137466
|
+
res += String.fromCharCode(firstCharCode);
|
|
137467
|
+
if (forceCapitalize) {
|
|
137468
|
+
res = res.toUpperCase();
|
|
137469
|
+
}
|
|
137470
|
+
} else {
|
|
137471
|
+
lastCharWasValid = false;
|
|
137472
|
+
}
|
|
137473
|
+
for (let i = 1; i < baseName.length; i++) {
|
|
137474
|
+
const ch = baseName.charCodeAt(i);
|
|
137475
|
+
const isValid = isIdentifierPart(ch, target);
|
|
137476
|
+
if (isValid) {
|
|
137477
|
+
let char = String.fromCharCode(ch);
|
|
137478
|
+
if (!lastCharWasValid) {
|
|
137479
|
+
char = char.toUpperCase();
|
|
137480
|
+
}
|
|
137481
|
+
res += char;
|
|
137482
|
+
}
|
|
137483
|
+
lastCharWasValid = isValid;
|
|
137484
|
+
}
|
|
137485
|
+
return !isStringANonContextualKeyword(res) ? res || "_" : `_${res}`;
|
|
137486
|
+
}
|
|
137281
137487
|
function stringContainsAt(haystack, needle, startIndex) {
|
|
137282
137488
|
const needleLength = needle.length;
|
|
137283
137489
|
if (needleLength + startIndex > haystack.length) {
|
|
@@ -137781,7 +137987,6 @@ function getExportInfoMap(importingFile, host, program, preferences, cancellatio
|
|
|
137781
137987
|
return cache;
|
|
137782
137988
|
}
|
|
137783
137989
|
(_d = host.log) == null ? void 0 : _d.call(host, "getExportInfoMap: cache miss or empty; calculating new results");
|
|
137784
|
-
const compilerOptions = program.getCompilerOptions();
|
|
137785
137990
|
let moduleCount = 0;
|
|
137786
137991
|
try {
|
|
137787
137992
|
forEachExternalModuleToImportFrom(
|
|
@@ -137794,7 +137999,7 @@ function getExportInfoMap(importingFile, host, program, preferences, cancellatio
|
|
|
137794
137999
|
if (++moduleCount % 100 === 0) cancellationToken == null ? void 0 : cancellationToken.throwIfCancellationRequested();
|
|
137795
138000
|
const seenExports = /* @__PURE__ */ new Map();
|
|
137796
138001
|
const checker = program2.getTypeChecker();
|
|
137797
|
-
const defaultInfo = getDefaultLikeExportInfo(moduleSymbol, checker
|
|
138002
|
+
const defaultInfo = getDefaultLikeExportInfo(moduleSymbol, checker);
|
|
137798
138003
|
if (defaultInfo && isImportableSymbol(defaultInfo.symbol, checker)) {
|
|
137799
138004
|
cache.add(
|
|
137800
138005
|
importingFile.path,
|
|
@@ -137830,48 +138035,37 @@ function getExportInfoMap(importingFile, host, program, preferences, cancellatio
|
|
|
137830
138035
|
(_e = host.log) == null ? void 0 : _e.call(host, `getExportInfoMap: done in ${timestamp() - start} ms`);
|
|
137831
138036
|
return cache;
|
|
137832
138037
|
}
|
|
137833
|
-
function getDefaultLikeExportInfo(moduleSymbol, checker
|
|
137834
|
-
const exported = getDefaultLikeExportWorker(moduleSymbol, checker);
|
|
137835
|
-
if (!exported) return void 0;
|
|
137836
|
-
const { symbol, exportKind } = exported;
|
|
137837
|
-
const info = getDefaultExportInfoWorker(symbol, checker, compilerOptions);
|
|
137838
|
-
return info && { symbol, exportKind, ...info };
|
|
137839
|
-
}
|
|
137840
|
-
function isImportableSymbol(symbol, checker) {
|
|
137841
|
-
return !checker.isUndefinedSymbol(symbol) && !checker.isUnknownSymbol(symbol) && !isKnownSymbol(symbol) && !isPrivateIdentifierSymbol(symbol);
|
|
137842
|
-
}
|
|
137843
|
-
function getDefaultLikeExportWorker(moduleSymbol, checker) {
|
|
138038
|
+
function getDefaultLikeExportInfo(moduleSymbol, checker) {
|
|
137844
138039
|
const exportEquals = checker.resolveExternalModuleSymbol(moduleSymbol);
|
|
137845
138040
|
if (exportEquals !== moduleSymbol) return { symbol: exportEquals, exportKind: 2 /* ExportEquals */ };
|
|
137846
138041
|
const defaultExport = checker.tryGetMemberInModuleExports("default" /* Default */, moduleSymbol);
|
|
137847
138042
|
if (defaultExport) return { symbol: defaultExport, exportKind: 1 /* Default */ };
|
|
137848
138043
|
}
|
|
137849
|
-
function
|
|
137850
|
-
|
|
137851
|
-
|
|
137852
|
-
|
|
137853
|
-
|
|
137854
|
-
|
|
137855
|
-
|
|
137856
|
-
|
|
137857
|
-
|
|
138044
|
+
function isImportableSymbol(symbol, checker) {
|
|
138045
|
+
return !checker.isUndefinedSymbol(symbol) && !checker.isUnknownSymbol(symbol) && !isKnownSymbol(symbol) && !isPrivateIdentifierSymbol(symbol);
|
|
138046
|
+
}
|
|
138047
|
+
function forEachNameOfDefaultExport(defaultExport, checker, compilerOptions, preferCapitalizedNames, cb) {
|
|
138048
|
+
let chain;
|
|
138049
|
+
let current = defaultExport;
|
|
138050
|
+
while (current) {
|
|
138051
|
+
const fromDeclaration = getDefaultLikeExportNameFromDeclaration(current);
|
|
138052
|
+
if (fromDeclaration) {
|
|
138053
|
+
const final = cb(fromDeclaration);
|
|
138054
|
+
if (final) return final;
|
|
137858
138055
|
}
|
|
138056
|
+
if (current.escapedName !== "default" /* Default */ && current.escapedName !== "export=" /* ExportEquals */) {
|
|
138057
|
+
const final = cb(current.name);
|
|
138058
|
+
if (final) return final;
|
|
138059
|
+
}
|
|
138060
|
+
chain = append(chain, current);
|
|
138061
|
+
current = current.flags & 2097152 /* Alias */ ? checker.getImmediateAliasedSymbol(current) : void 0;
|
|
137859
138062
|
}
|
|
137860
|
-
|
|
137861
|
-
|
|
137862
|
-
|
|
137863
|
-
|
|
137864
|
-
}
|
|
137865
|
-
function getNameForExportDefault(symbol) {
|
|
137866
|
-
return symbol.declarations && firstDefined(symbol.declarations, (declaration) => {
|
|
137867
|
-
var _a;
|
|
137868
|
-
if (isExportAssignment(declaration)) {
|
|
137869
|
-
return (_a = tryCast(skipOuterExpressions(declaration.expression), isIdentifier)) == null ? void 0 : _a.text;
|
|
137870
|
-
} else if (isExportSpecifier(declaration)) {
|
|
137871
|
-
Debug.assert(declaration.name.text === "default" /* Default */, "Expected the specifier to be a default export");
|
|
137872
|
-
return declaration.propertyName && declaration.propertyName.text;
|
|
138063
|
+
for (const symbol of chain ?? emptyArray) {
|
|
138064
|
+
if (symbol.parent && isExternalModuleSymbol(symbol.parent)) {
|
|
138065
|
+
const final = cb(moduleSymbolToValidIdentifier(symbol.parent, getEmitScriptTarget(compilerOptions), preferCapitalizedNames));
|
|
138066
|
+
if (final) return final;
|
|
137873
138067
|
}
|
|
137874
|
-
}
|
|
138068
|
+
}
|
|
137875
138069
|
}
|
|
137876
138070
|
|
|
137877
138071
|
// src/services/classifier.ts
|
|
@@ -141643,6 +141837,7 @@ function cleanText(text) {
|
|
|
141643
141837
|
var ts_refactor_exports = {};
|
|
141644
141838
|
__export(ts_refactor_exports, {
|
|
141645
141839
|
addExportToChanges: () => addExportToChanges,
|
|
141840
|
+
addExportsInOldFile: () => addExportsInOldFile,
|
|
141646
141841
|
addImportsForMovedSymbols: () => addImportsForMovedSymbols,
|
|
141647
141842
|
addNewFileToTsconfig: () => addNewFileToTsconfig,
|
|
141648
141843
|
addOrRemoveBracesToArrowFunction: () => ts_refactor_addOrRemoveBracesToArrowFunction_exports,
|
|
@@ -141663,6 +141858,7 @@ __export(ts_refactor_exports, {
|
|
|
141663
141858
|
generateGetAccessorAndSetAccessor: () => ts_refactor_generateGetAccessorAndSetAccessor_exports,
|
|
141664
141859
|
getApplicableRefactors: () => getApplicableRefactors,
|
|
141665
141860
|
getEditsForRefactor: () => getEditsForRefactor,
|
|
141861
|
+
getExistingLocals: () => getExistingLocals,
|
|
141666
141862
|
getIdentifierForNode: () => getIdentifierForNode,
|
|
141667
141863
|
getNewStatementsAndRemoveFromOldFile: () => getNewStatementsAndRemoveFromOldFile,
|
|
141668
141864
|
getStatementsToMove: () => getStatementsToMove,
|
|
@@ -142086,7 +142282,7 @@ function doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, toConve
|
|
|
142086
142282
|
toConvertSymbols.add(symbol);
|
|
142087
142283
|
}
|
|
142088
142284
|
});
|
|
142089
|
-
const preferredName = moduleSpecifier && isStringLiteral(moduleSpecifier) ?
|
|
142285
|
+
const preferredName = moduleSpecifier && isStringLiteral(moduleSpecifier) ? moduleSpecifierToValidIdentifier(moduleSpecifier.text, 99 /* ESNext */) : "module";
|
|
142090
142286
|
function hasNamespaceNameConflict(namedImport) {
|
|
142091
142287
|
return !!ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(namedImport.name, checker, sourceFile, (id) => {
|
|
142092
142288
|
const symbol = checker.resolveName(
|
|
@@ -142700,7 +142896,7 @@ function getNamespaceLikeImport(node) {
|
|
|
142700
142896
|
}
|
|
142701
142897
|
}
|
|
142702
142898
|
function updateNamespaceLikeImport(changes, sourceFile, checker, movedSymbols, newModuleSpecifier, oldImportId, oldImportNode, quotePreference) {
|
|
142703
|
-
const preferredNewNamespaceName =
|
|
142899
|
+
const preferredNewNamespaceName = moduleSpecifierToValidIdentifier(newModuleSpecifier, 99 /* ESNext */);
|
|
142704
142900
|
let needUniqueName = false;
|
|
142705
142901
|
const toChange = [];
|
|
142706
142902
|
ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(oldImportId, checker, sourceFile, (ref) => {
|
|
@@ -147915,7 +148111,8 @@ var invalidOperationsInPartialSemanticMode = [
|
|
|
147915
148111
|
"provideCallHierarchyIncomingCalls",
|
|
147916
148112
|
"provideCallHierarchyOutgoingCalls",
|
|
147917
148113
|
"provideInlayHints",
|
|
147918
|
-
"getSupportedCodeFixes"
|
|
148114
|
+
"getSupportedCodeFixes",
|
|
148115
|
+
"getPasteEdits"
|
|
147919
148116
|
];
|
|
147920
148117
|
var invalidOperationsInSyntacticMode = [
|
|
147921
148118
|
...invalidOperationsInPartialSemanticMode,
|
|
@@ -148319,6 +148516,19 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
148319
148516
|
tags
|
|
148320
148517
|
};
|
|
148321
148518
|
}
|
|
148519
|
+
function getPasteEdits(args, formatOptions) {
|
|
148520
|
+
synchronizeHostData();
|
|
148521
|
+
return ts_PasteEdits_exports.pasteEditsProvider(
|
|
148522
|
+
getValidSourceFile(args.targetFile),
|
|
148523
|
+
args.pastedText,
|
|
148524
|
+
args.pasteLocations,
|
|
148525
|
+
args.copiedFrom ? { file: getValidSourceFile(args.copiedFrom.file), range: args.copiedFrom.range } : void 0,
|
|
148526
|
+
host,
|
|
148527
|
+
args.preferences,
|
|
148528
|
+
ts_formatting_exports.getFormatContext(formatOptions, host),
|
|
148529
|
+
cancellationToken
|
|
148530
|
+
);
|
|
148531
|
+
}
|
|
148322
148532
|
function getNodeForQuickInfo(node) {
|
|
148323
148533
|
if (isNewExpression(node.parent) && node.pos === node.parent.pos) {
|
|
148324
148534
|
return node.parent.expression;
|
|
@@ -148569,12 +148779,12 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
148569
148779
|
return ts_codefix_exports.getFixes({ errorCode, sourceFile, span, program, host, cancellationToken, formatContext, preferences });
|
|
148570
148780
|
});
|
|
148571
148781
|
}
|
|
148572
|
-
function getCombinedCodeFix(scope,
|
|
148782
|
+
function getCombinedCodeFix(scope, fixId55, formatOptions, preferences = emptyOptions) {
|
|
148573
148783
|
synchronizeHostData();
|
|
148574
148784
|
Debug.assert(scope.type === "file");
|
|
148575
148785
|
const sourceFile = getValidSourceFile(scope.fileName);
|
|
148576
148786
|
const formatContext = ts_formatting_exports.getFormatContext(formatOptions, host);
|
|
148577
|
-
return ts_codefix_exports.getAllFixes({ fixId:
|
|
148787
|
+
return ts_codefix_exports.getAllFixes({ fixId: fixId55, sourceFile, program, host, cancellationToken, formatContext, preferences });
|
|
148578
148788
|
}
|
|
148579
148789
|
function organizeImports2(args, formatOptions, preferences = emptyOptions) {
|
|
148580
148790
|
synchronizeHostData();
|
|
@@ -149094,7 +149304,8 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
149094
149304
|
commentSelection,
|
|
149095
149305
|
uncommentSelection,
|
|
149096
149306
|
provideInlayHints: provideInlayHints2,
|
|
149097
|
-
getSupportedCodeFixes
|
|
149307
|
+
getSupportedCodeFixes,
|
|
149308
|
+
getPasteEdits
|
|
149098
149309
|
};
|
|
149099
149310
|
switch (languageServiceMode) {
|
|
149100
149311
|
case 0 /* Semantic */:
|
|
@@ -150212,8 +150423,6 @@ __export(ts_codefix_exports, {
|
|
|
150212
150423
|
getSupportedErrorCodes: () => getSupportedErrorCodes,
|
|
150213
150424
|
importFixName: () => importFixName,
|
|
150214
150425
|
importSymbols: () => importSymbols,
|
|
150215
|
-
moduleSpecifierToValidIdentifier: () => moduleSpecifierToValidIdentifier,
|
|
150216
|
-
moduleSymbolToValidIdentifier: () => moduleSymbolToValidIdentifier,
|
|
150217
150426
|
parameterShouldGetTypeFromJSDoc: () => parameterShouldGetTypeFromJSDoc,
|
|
150218
150427
|
registerCodeFix: () => registerCodeFix,
|
|
150219
150428
|
setJsonCompilerOptionValue: () => setJsonCompilerOptionValue,
|
|
@@ -150236,14 +150445,14 @@ function createCodeFixActionWithoutFixAll(fixName8, changes, description3) {
|
|
|
150236
150445
|
void 0
|
|
150237
150446
|
);
|
|
150238
150447
|
}
|
|
150239
|
-
function createCodeFixAction(fixName8, changes, description3,
|
|
150240
|
-
return createCodeFixActionWorker(fixName8, diagnosticToString(description3), changes,
|
|
150448
|
+
function createCodeFixAction(fixName8, changes, description3, fixId55, fixAllDescription, command) {
|
|
150449
|
+
return createCodeFixActionWorker(fixName8, diagnosticToString(description3), changes, fixId55, diagnosticToString(fixAllDescription), command);
|
|
150241
150450
|
}
|
|
150242
|
-
function createCodeFixActionMaybeFixAll(fixName8, changes, description3,
|
|
150243
|
-
return createCodeFixActionWorker(fixName8, diagnosticToString(description3), changes,
|
|
150451
|
+
function createCodeFixActionMaybeFixAll(fixName8, changes, description3, fixId55, fixAllDescription, command) {
|
|
150452
|
+
return createCodeFixActionWorker(fixName8, diagnosticToString(description3), changes, fixId55, fixAllDescription && diagnosticToString(fixAllDescription), command);
|
|
150244
150453
|
}
|
|
150245
|
-
function createCodeFixActionWorker(fixName8, description3, changes,
|
|
150246
|
-
return { fixName: fixName8, description: description3, changes, fixId:
|
|
150454
|
+
function createCodeFixActionWorker(fixName8, description3, changes, fixId55, fixAllDescription, command) {
|
|
150455
|
+
return { fixName: fixName8, description: description3, changes, fixId: fixId55, fixAllDescription, commands: command ? [command] : void 0 };
|
|
150247
150456
|
}
|
|
150248
150457
|
function registerCodeFix(reg) {
|
|
150249
150458
|
for (const error2 of reg.errorCodes) {
|
|
@@ -150251,9 +150460,9 @@ function registerCodeFix(reg) {
|
|
|
150251
150460
|
errorCodeToFixes.add(String(error2), reg);
|
|
150252
150461
|
}
|
|
150253
150462
|
if (reg.fixIds) {
|
|
150254
|
-
for (const
|
|
150255
|
-
Debug.assert(!fixIdToRegistration.has(
|
|
150256
|
-
fixIdToRegistration.set(
|
|
150463
|
+
for (const fixId55 of reg.fixIds) {
|
|
150464
|
+
Debug.assert(!fixIdToRegistration.has(fixId55));
|
|
150465
|
+
fixIdToRegistration.set(fixId55, reg);
|
|
150257
150466
|
}
|
|
150258
150467
|
}
|
|
150259
150468
|
}
|
|
@@ -150269,8 +150478,8 @@ function removeFixIdIfFixAllUnavailable(registration, diagnostics) {
|
|
|
150269
150478
|
if (maybeFixableDiagnostics > 1) break;
|
|
150270
150479
|
}
|
|
150271
150480
|
const fixAllUnavailable = maybeFixableDiagnostics < 2;
|
|
150272
|
-
return ({ fixId:
|
|
150273
|
-
return fixAllUnavailable ? action : { ...action, fixId:
|
|
150481
|
+
return ({ fixId: fixId55, fixAllDescription, ...action }) => {
|
|
150482
|
+
return fixAllUnavailable ? action : { ...action, fixId: fixId55, fixAllDescription };
|
|
150274
150483
|
};
|
|
150275
150484
|
}
|
|
150276
150485
|
function getFixes(context) {
|
|
@@ -153774,7 +153983,6 @@ function getAllExportInfoForSymbol(importingFile, symbol, symbolName2, moduleSym
|
|
|
153774
153983
|
}
|
|
153775
153984
|
function getSingleExportInfoForSymbol(symbol, symbolName2, moduleSymbol, program, host) {
|
|
153776
153985
|
var _a, _b;
|
|
153777
|
-
const compilerOptions = program.getCompilerOptions();
|
|
153778
153986
|
const mainProgramInfo = getInfoWithChecker(
|
|
153779
153987
|
program.getTypeChecker(),
|
|
153780
153988
|
/*isFromPackageJson*/
|
|
@@ -153790,7 +153998,7 @@ function getSingleExportInfoForSymbol(symbol, symbolName2, moduleSymbol, program
|
|
|
153790
153998
|
true
|
|
153791
153999
|
), `Could not find symbol in specified module for code actions`);
|
|
153792
154000
|
function getInfoWithChecker(checker, isFromPackageJson) {
|
|
153793
|
-
const defaultInfo = getDefaultLikeExportInfo(moduleSymbol, checker
|
|
154001
|
+
const defaultInfo = getDefaultLikeExportInfo(moduleSymbol, checker);
|
|
153794
154002
|
if (defaultInfo && skipAlias(defaultInfo.symbol, checker) === symbol) {
|
|
153795
154003
|
return { symbol: defaultInfo.symbol, moduleSymbol, moduleFileName: void 0, exportKind: defaultInfo.exportKind, targetFlags: skipAlias(symbol, checker).flags, isFromPackageJson };
|
|
153796
154004
|
}
|
|
@@ -153800,12 +154008,9 @@ function getSingleExportInfoForSymbol(symbol, symbolName2, moduleSymbol, program
|
|
|
153800
154008
|
}
|
|
153801
154009
|
}
|
|
153802
154010
|
}
|
|
153803
|
-
function isFutureSymbolExportInfoArray(info) {
|
|
153804
|
-
return info[0].symbol === void 0;
|
|
153805
|
-
}
|
|
153806
154011
|
function getImportFixes(exportInfos, usagePosition, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences, importMap = isFullSourceFile(sourceFile) ? createExistingImportMap(sourceFile, program) : void 0, fromCacheOnly) {
|
|
153807
154012
|
const checker = program.getTypeChecker();
|
|
153808
|
-
const existingImports = importMap
|
|
154013
|
+
const existingImports = importMap ? flatMap(exportInfos, importMap.getImportsForExportInfo) : emptyArray;
|
|
153809
154014
|
const useNamespace = usagePosition !== void 0 && tryUseExistingNamespaceImport(existingImports, usagePosition);
|
|
153810
154015
|
const addToExisting = tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker, program.getCompilerOptions());
|
|
153811
154016
|
if (addToExisting) {
|
|
@@ -154001,7 +154206,6 @@ function getNewImportFixes(program, sourceFile, usagePosition, isValidTypeOnlyUs
|
|
|
154001
154206
|
);
|
|
154002
154207
|
computedWithoutCacheCount += computedWithoutCache ? 1 : 0;
|
|
154003
154208
|
return mapDefined(moduleSpecifiers, (moduleSpecifier) => {
|
|
154004
|
-
var _a;
|
|
154005
154209
|
if (rejectNodeModulesRelativePaths && pathContainsNodeModules(moduleSpecifier)) {
|
|
154006
154210
|
return void 0;
|
|
154007
154211
|
}
|
|
@@ -154014,7 +154218,14 @@ function getNewImportFixes(program, sourceFile, usagePosition, isValidTypeOnlyUs
|
|
|
154014
154218
|
const exportEquals = checker.resolveExternalModuleSymbol(exportInfo2.moduleSymbol);
|
|
154015
154219
|
let namespacePrefix;
|
|
154016
154220
|
if (exportEquals !== exportInfo2.moduleSymbol) {
|
|
154017
|
-
namespacePrefix = (
|
|
154221
|
+
namespacePrefix = forEachNameOfDefaultExport(
|
|
154222
|
+
exportEquals,
|
|
154223
|
+
checker,
|
|
154224
|
+
compilerOptions,
|
|
154225
|
+
/*preferCapitalizedNames*/
|
|
154226
|
+
false,
|
|
154227
|
+
identity
|
|
154228
|
+
);
|
|
154018
154229
|
}
|
|
154019
154230
|
namespacePrefix || (namespacePrefix = moduleSymbolToValidIdentifier(
|
|
154020
154231
|
exportInfo2.moduleSymbol,
|
|
@@ -154298,12 +154509,12 @@ function getExportInfos(symbolName2, isJsxTagName, currentTokenMeaning, cancella
|
|
|
154298
154509
|
const checker = program2.getTypeChecker();
|
|
154299
154510
|
cancellationToken.throwIfCancellationRequested();
|
|
154300
154511
|
const compilerOptions = program2.getCompilerOptions();
|
|
154301
|
-
const defaultInfo = getDefaultLikeExportInfo(moduleSymbol, checker
|
|
154302
|
-
if (defaultInfo && (defaultInfo.
|
|
154512
|
+
const defaultInfo = getDefaultLikeExportInfo(moduleSymbol, checker);
|
|
154513
|
+
if (defaultInfo && symbolFlagsHaveMeaning(checker.getSymbolFlags(defaultInfo.symbol), currentTokenMeaning) && forEachNameOfDefaultExport(defaultInfo.symbol, checker, compilerOptions, isJsxTagName, (name) => name === symbolName2)) {
|
|
154303
154514
|
addSymbol(moduleSymbol, sourceFile, defaultInfo.symbol, defaultInfo.exportKind, program2, isFromPackageJson);
|
|
154304
154515
|
}
|
|
154305
154516
|
const exportSymbolWithIdenticalName = checker.tryGetMemberInModuleExportsAndProperties(symbolName2, moduleSymbol);
|
|
154306
|
-
if (exportSymbolWithIdenticalName &&
|
|
154517
|
+
if (exportSymbolWithIdenticalName && symbolFlagsHaveMeaning(checker.getSymbolFlags(exportSymbolWithIdenticalName), currentTokenMeaning)) {
|
|
154307
154518
|
addSymbol(moduleSymbol, sourceFile, exportSymbolWithIdenticalName, 0 /* Named */, program2, isFromPackageJson);
|
|
154308
154519
|
}
|
|
154309
154520
|
});
|
|
@@ -154697,38 +154908,8 @@ function createConstEqualsRequireDeclaration(name, quotedModuleSpecifier) {
|
|
|
154697
154908
|
], 2 /* Const */)
|
|
154698
154909
|
);
|
|
154699
154910
|
}
|
|
154700
|
-
function
|
|
154701
|
-
return
|
|
154702
|
-
}
|
|
154703
|
-
function moduleSymbolToValidIdentifier(moduleSymbol, target, forceCapitalize) {
|
|
154704
|
-
return moduleSpecifierToValidIdentifier(removeFileExtension(stripQuotes(moduleSymbol.name)), target, forceCapitalize);
|
|
154705
|
-
}
|
|
154706
|
-
function moduleSpecifierToValidIdentifier(moduleSpecifier, target, forceCapitalize) {
|
|
154707
|
-
const baseName = getBaseFileName(removeSuffix(moduleSpecifier, "/index"));
|
|
154708
|
-
let res = "";
|
|
154709
|
-
let lastCharWasValid = true;
|
|
154710
|
-
const firstCharCode = baseName.charCodeAt(0);
|
|
154711
|
-
if (isIdentifierStart(firstCharCode, target)) {
|
|
154712
|
-
res += String.fromCharCode(firstCharCode);
|
|
154713
|
-
if (forceCapitalize) {
|
|
154714
|
-
res = res.toUpperCase();
|
|
154715
|
-
}
|
|
154716
|
-
} else {
|
|
154717
|
-
lastCharWasValid = false;
|
|
154718
|
-
}
|
|
154719
|
-
for (let i = 1; i < baseName.length; i++) {
|
|
154720
|
-
const ch = baseName.charCodeAt(i);
|
|
154721
|
-
const isValid = isIdentifierPart(ch, target);
|
|
154722
|
-
if (isValid) {
|
|
154723
|
-
let char = String.fromCharCode(ch);
|
|
154724
|
-
if (!lastCharWasValid) {
|
|
154725
|
-
char = char.toUpperCase();
|
|
154726
|
-
}
|
|
154727
|
-
res += char;
|
|
154728
|
-
}
|
|
154729
|
-
lastCharWasValid = isValid;
|
|
154730
|
-
}
|
|
154731
|
-
return !isStringANonContextualKeyword(res) ? res || "_" : `_${res}`;
|
|
154911
|
+
function symbolFlagsHaveMeaning(flags, meaning) {
|
|
154912
|
+
return meaning === 7 /* All */ ? true : meaning & 1 /* Value */ ? !!(flags & 111551 /* Value */) : meaning & 2 /* Type */ ? !!(flags & 788968 /* Type */) : meaning & 4 /* Namespace */ ? !!(flags & 1920 /* Namespace */) : false;
|
|
154732
154913
|
}
|
|
154733
154914
|
function getImpliedNodeFormatForEmit(file, program) {
|
|
154734
154915
|
return isFullSourceFile(file) ? program.getImpliedNodeFormatForEmit(file) : getImpliedNodeFormatForEmitWorker(file, program.getCompilerOptions());
|
|
@@ -154914,10 +155095,10 @@ registerCodeFix({
|
|
|
154914
155095
|
const { errorCode, span } = context;
|
|
154915
155096
|
const info = errorCodeFixIdMap[errorCode];
|
|
154916
155097
|
if (!info) return emptyArray;
|
|
154917
|
-
const { descriptions, fixId:
|
|
155098
|
+
const { descriptions, fixId: fixId55, fixAllDescriptions } = info;
|
|
154918
155099
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (changes2) => dispatchChanges(changes2, context, errorCode, span.start));
|
|
154919
155100
|
return [
|
|
154920
|
-
createCodeFixActionMaybeFixAll(fixName, changes, descriptions,
|
|
155101
|
+
createCodeFixActionMaybeFixAll(fixName, changes, descriptions, fixId55, fixAllDescriptions)
|
|
154921
155102
|
];
|
|
154922
155103
|
},
|
|
154923
155104
|
fixIds: [fixName, fixAddOverrideId, fixRemoveOverrideId],
|
|
@@ -155693,7 +155874,7 @@ registerCodeFix({
|
|
|
155693
155874
|
},
|
|
155694
155875
|
fixIds: [fixMissingMember, fixMissingFunctionDeclaration, fixMissingProperties, fixMissingAttributes],
|
|
155695
155876
|
getAllCodeActions: (context) => {
|
|
155696
|
-
const { program, fixId:
|
|
155877
|
+
const { program, fixId: fixId55 } = context;
|
|
155697
155878
|
const checker = program.getTypeChecker();
|
|
155698
155879
|
const seen = /* @__PURE__ */ new Map();
|
|
155699
155880
|
const typeDeclToMembers = /* @__PURE__ */ new Map();
|
|
@@ -155703,11 +155884,11 @@ registerCodeFix({
|
|
|
155703
155884
|
if (!info || !addToSeen(seen, getNodeId(info.parentDeclaration) + "#" + (info.kind === 3 /* ObjectLiteral */ ? info.identifier : info.token.text))) {
|
|
155704
155885
|
return;
|
|
155705
155886
|
}
|
|
155706
|
-
if (
|
|
155887
|
+
if (fixId55 === fixMissingFunctionDeclaration && (info.kind === 2 /* Function */ || info.kind === 5 /* Signature */)) {
|
|
155707
155888
|
addFunctionDeclaration(changes, context, info);
|
|
155708
|
-
} else if (
|
|
155889
|
+
} else if (fixId55 === fixMissingProperties && info.kind === 3 /* ObjectLiteral */) {
|
|
155709
155890
|
addObjectLiteralProperties(changes, context, info);
|
|
155710
|
-
} else if (
|
|
155891
|
+
} else if (fixId55 === fixMissingAttributes && info.kind === 4 /* JsxAttributes */) {
|
|
155711
155892
|
addJsxAttributes(changes, context, info);
|
|
155712
155893
|
} else {
|
|
155713
155894
|
if (info.kind === 1 /* Enum */) {
|
|
@@ -157578,20 +157759,20 @@ registerCodeFix({
|
|
|
157578
157759
|
actions2.push(fix(type, fixIdNullable, Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types));
|
|
157579
157760
|
}
|
|
157580
157761
|
return actions2;
|
|
157581
|
-
function fix(type2,
|
|
157762
|
+
function fix(type2, fixId55, fixAllDescription) {
|
|
157582
157763
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange29(t, sourceFile, typeNode, type2, checker));
|
|
157583
|
-
return createCodeFixAction("jdocTypes", changes, [Diagnostics.Change_0_to_1, original, checker.typeToString(type2)],
|
|
157764
|
+
return createCodeFixAction("jdocTypes", changes, [Diagnostics.Change_0_to_1, original, checker.typeToString(type2)], fixId55, fixAllDescription);
|
|
157584
157765
|
}
|
|
157585
157766
|
},
|
|
157586
157767
|
fixIds: [fixIdPlain, fixIdNullable],
|
|
157587
157768
|
getAllCodeActions(context) {
|
|
157588
|
-
const { fixId:
|
|
157769
|
+
const { fixId: fixId55, program, sourceFile } = context;
|
|
157589
157770
|
const checker = program.getTypeChecker();
|
|
157590
157771
|
return codeFixAll(context, errorCodes45, (changes, err) => {
|
|
157591
157772
|
const info = getInfo15(err.file, err.start, checker);
|
|
157592
157773
|
if (!info) return;
|
|
157593
157774
|
const { typeNode, type } = info;
|
|
157594
|
-
const fixedType = typeNode.kind === 314 /* JSDocNullableType */ &&
|
|
157775
|
+
const fixedType = typeNode.kind === 314 /* JSDocNullableType */ && fixId55 === fixIdNullable ? checker.getNullableType(type, 32768 /* Undefined */) : type;
|
|
157595
157776
|
doChange29(changes, sourceFile, typeNode, fixedType, checker);
|
|
157596
157777
|
});
|
|
157597
157778
|
}
|
|
@@ -177031,6 +177212,79 @@ var SmartIndenter;
|
|
|
177031
177212
|
}
|
|
177032
177213
|
})(SmartIndenter || (SmartIndenter = {}));
|
|
177033
177214
|
|
|
177215
|
+
// src/services/_namespaces/ts.PasteEdits.ts
|
|
177216
|
+
var ts_PasteEdits_exports = {};
|
|
177217
|
+
__export(ts_PasteEdits_exports, {
|
|
177218
|
+
pasteEditsProvider: () => pasteEditsProvider
|
|
177219
|
+
});
|
|
177220
|
+
|
|
177221
|
+
// src/services/pasteEdits.ts
|
|
177222
|
+
var fixId54 = "providePostPasteEdits";
|
|
177223
|
+
function pasteEditsProvider(targetFile, pastedText, pasteLocations, copiedFrom, host, preferences, formatContext, cancellationToken) {
|
|
177224
|
+
const changes = ts_textChanges_exports.ChangeTracker.with({ host, formatContext, preferences }, (changeTracker) => pasteEdits(targetFile, pastedText, pasteLocations, copiedFrom, host, preferences, formatContext, cancellationToken, changeTracker));
|
|
177225
|
+
return { edits: changes, fixId: fixId54 };
|
|
177226
|
+
}
|
|
177227
|
+
function pasteEdits(targetFile, pastedText, pasteLocations, copiedFrom, host, preferences, formatContext, cancellationToken, changes) {
|
|
177228
|
+
let actualPastedText;
|
|
177229
|
+
if (pastedText.length !== pasteLocations.length) {
|
|
177230
|
+
actualPastedText = pastedText.length === 1 ? pastedText : [pastedText.join("\n")];
|
|
177231
|
+
}
|
|
177232
|
+
pasteLocations.forEach((paste, i) => {
|
|
177233
|
+
changes.replaceRangeWithText(
|
|
177234
|
+
targetFile,
|
|
177235
|
+
{ pos: paste.pos, end: paste.end },
|
|
177236
|
+
actualPastedText ? actualPastedText[0] : pastedText[i]
|
|
177237
|
+
);
|
|
177238
|
+
});
|
|
177239
|
+
const statements = [];
|
|
177240
|
+
let newText = targetFile.text;
|
|
177241
|
+
for (let i = pasteLocations.length - 1; i >= 0; i--) {
|
|
177242
|
+
const { pos, end } = pasteLocations[i];
|
|
177243
|
+
newText = actualPastedText ? newText.slice(0, pos) + actualPastedText[0] + newText.slice(end) : newText.slice(0, pos) + pastedText[i] + newText.slice(end);
|
|
177244
|
+
}
|
|
177245
|
+
Debug.checkDefined(host.runWithTemporaryFileUpdate).call(host, targetFile.fileName, newText, (updatedProgram, originalProgram, updatedFile) => {
|
|
177246
|
+
const importAdder = ts_codefix_exports.createImportAdder(updatedFile, updatedProgram, preferences, host);
|
|
177247
|
+
if (copiedFrom == null ? void 0 : copiedFrom.range) {
|
|
177248
|
+
Debug.assert(copiedFrom.range.length === pastedText.length);
|
|
177249
|
+
copiedFrom.range.forEach((copy) => {
|
|
177250
|
+
addRange(statements, copiedFrom.file.statements, getLineOfLocalPosition(copiedFrom.file, copy.pos), getLineOfLocalPosition(copiedFrom.file, copy.end) + 1);
|
|
177251
|
+
});
|
|
177252
|
+
const usage = getUsageInfo(copiedFrom.file, statements, originalProgram.getTypeChecker(), getExistingLocals(updatedFile, statements, originalProgram.getTypeChecker()));
|
|
177253
|
+
Debug.assertIsDefined(originalProgram);
|
|
177254
|
+
const useEsModuleSyntax = !fileShouldUseJavaScriptRequire(targetFile.fileName, originalProgram, host, !!copiedFrom.file.commonJsModuleIndicator);
|
|
177255
|
+
addExportsInOldFile(copiedFrom.file, usage.targetFileImportsFromOldFile, changes, useEsModuleSyntax);
|
|
177256
|
+
addTargetFileImports(copiedFrom.file, usage.oldImportsNeededByTargetFile, usage.targetFileImportsFromOldFile, originalProgram.getTypeChecker(), updatedProgram, importAdder);
|
|
177257
|
+
} else {
|
|
177258
|
+
const context = {
|
|
177259
|
+
sourceFile: updatedFile,
|
|
177260
|
+
program: originalProgram,
|
|
177261
|
+
cancellationToken,
|
|
177262
|
+
host,
|
|
177263
|
+
preferences,
|
|
177264
|
+
formatContext
|
|
177265
|
+
};
|
|
177266
|
+
forEachChild(updatedFile, function cb(node) {
|
|
177267
|
+
if (isIdentifier(node) && !(originalProgram == null ? void 0 : originalProgram.getTypeChecker().resolveName(
|
|
177268
|
+
node.text,
|
|
177269
|
+
node,
|
|
177270
|
+
-1 /* All */,
|
|
177271
|
+
/*excludeGlobals*/
|
|
177272
|
+
false
|
|
177273
|
+
))) {
|
|
177274
|
+
importAdder.addImportForUnresolvedIdentifier(
|
|
177275
|
+
context,
|
|
177276
|
+
node,
|
|
177277
|
+
/*useAutoImportProvider*/
|
|
177278
|
+
true
|
|
177279
|
+
);
|
|
177280
|
+
}
|
|
177281
|
+
node.forEachChild(cb);
|
|
177282
|
+
});
|
|
177283
|
+
}
|
|
177284
|
+
importAdder.writeFixes(changes, getQuotePreference(copiedFrom ? copiedFrom.file : targetFile, preferences));
|
|
177285
|
+
});
|
|
177286
|
+
}
|
|
177287
|
+
|
|
177034
177288
|
// src/server/_namespaces/ts.ts
|
|
177035
177289
|
var ts_exports2 = {};
|
|
177036
177290
|
__export(ts_exports2, {
|
|
@@ -177093,7 +177347,7 @@ __export(ts_exports2, {
|
|
|
177093
177347
|
IndexKind: () => IndexKind,
|
|
177094
177348
|
InferenceFlags: () => InferenceFlags,
|
|
177095
177349
|
InferencePriority: () => InferencePriority,
|
|
177096
|
-
InlayHintKind: () =>
|
|
177350
|
+
InlayHintKind: () => InlayHintKind2,
|
|
177097
177351
|
InlayHints: () => ts_InlayHints_exports,
|
|
177098
177352
|
InternalEmitFlags: () => InternalEmitFlags,
|
|
177099
177353
|
InternalSymbolName: () => InternalSymbolName,
|
|
@@ -177630,6 +177884,7 @@ __export(ts_exports2, {
|
|
|
177630
177884
|
forEachKey: () => forEachKey,
|
|
177631
177885
|
forEachLeadingCommentRange: () => forEachLeadingCommentRange,
|
|
177632
177886
|
forEachNameInAccessChainWalkingLeft: () => forEachNameInAccessChainWalkingLeft,
|
|
177887
|
+
forEachNameOfDefaultExport: () => forEachNameOfDefaultExport,
|
|
177633
177888
|
forEachPropertyAssignment: () => forEachPropertyAssignment,
|
|
177634
177889
|
forEachResolvedProjectReference: () => forEachResolvedProjectReference,
|
|
177635
177890
|
forEachReturnStatement: () => forEachReturnStatement,
|
|
@@ -177726,11 +177981,11 @@ __export(ts_exports2, {
|
|
|
177726
177981
|
getDeclaredExpandoInitializer: () => getDeclaredExpandoInitializer,
|
|
177727
177982
|
getDecorators: () => getDecorators,
|
|
177728
177983
|
getDefaultCompilerOptions: () => getDefaultCompilerOptions2,
|
|
177729
|
-
getDefaultExportInfoWorker: () => getDefaultExportInfoWorker,
|
|
177730
177984
|
getDefaultFormatCodeSettings: () => getDefaultFormatCodeSettings,
|
|
177731
177985
|
getDefaultLibFileName: () => getDefaultLibFileName,
|
|
177732
177986
|
getDefaultLibFilePath: () => getDefaultLibFilePath,
|
|
177733
177987
|
getDefaultLikeExportInfo: () => getDefaultLikeExportInfo,
|
|
177988
|
+
getDefaultLikeExportNameFromDeclaration: () => getDefaultLikeExportNameFromDeclaration,
|
|
177734
177989
|
getDefaultResolutionModeForFileWorker: () => getDefaultResolutionModeForFileWorker,
|
|
177735
177990
|
getDiagnosticText: () => getDiagnosticText,
|
|
177736
177991
|
getDiagnosticsWithinSpan: () => getDiagnosticsWithinSpan,
|
|
@@ -178065,6 +178320,7 @@ __export(ts_exports2, {
|
|
|
178065
178320
|
getSwitchedType: () => getSwitchedType,
|
|
178066
178321
|
getSymbolId: () => getSymbolId,
|
|
178067
178322
|
getSymbolNameForPrivateIdentifier: () => getSymbolNameForPrivateIdentifier,
|
|
178323
|
+
getSymbolParentOrFail: () => getSymbolParentOrFail,
|
|
178068
178324
|
getSymbolTarget: () => getSymbolTarget,
|
|
178069
178325
|
getSyntacticClassifications: () => getSyntacticClassifications,
|
|
178070
178326
|
getSyntacticModifierFlags: () => getSyntacticModifierFlags,
|
|
@@ -178929,7 +179185,9 @@ __export(ts_exports2, {
|
|
|
178929
179185
|
moduleResolutionOptionDeclarations: () => moduleResolutionOptionDeclarations,
|
|
178930
179186
|
moduleResolutionSupportsPackageJsonExportsAndImports: () => moduleResolutionSupportsPackageJsonExportsAndImports,
|
|
178931
179187
|
moduleResolutionUsesNodeModules: () => moduleResolutionUsesNodeModules,
|
|
179188
|
+
moduleSpecifierToValidIdentifier: () => moduleSpecifierToValidIdentifier,
|
|
178932
179189
|
moduleSpecifiers: () => ts_moduleSpecifiers_exports,
|
|
179190
|
+
moduleSymbolToValidIdentifier: () => moduleSymbolToValidIdentifier,
|
|
178933
179191
|
moveEmitHelpers: () => moveEmitHelpers,
|
|
178934
179192
|
moveRangeEnd: () => moveRangeEnd,
|
|
178935
179193
|
moveRangePastDecorators: () => moveRangePastDecorators,
|
|
@@ -179009,6 +179267,7 @@ __export(ts_exports2, {
|
|
|
179009
179267
|
parsePackageName: () => parsePackageName,
|
|
179010
179268
|
parsePseudoBigInt: () => parsePseudoBigInt,
|
|
179011
179269
|
parseValidBigInt: () => parseValidBigInt,
|
|
179270
|
+
pasteEdits: () => ts_PasteEdits_exports,
|
|
179012
179271
|
patchWriteFileEnsuringDirectory: () => patchWriteFileEnsuringDirectory,
|
|
179013
179272
|
pathContainsNodeModules: () => pathContainsNodeModules,
|
|
179014
179273
|
pathIsAbsolute: () => pathIsAbsolute,
|
|
@@ -180168,7 +180427,7 @@ __export(ts_server_protocol_exports, {
|
|
|
180168
180427
|
NewLineKind: () => NewLineKind2,
|
|
180169
180428
|
OrganizeImportsMode: () => OrganizeImportsMode,
|
|
180170
180429
|
PollingWatchKind: () => PollingWatchKind2,
|
|
180171
|
-
ScriptTarget: () =>
|
|
180430
|
+
ScriptTarget: () => ScriptTarget10,
|
|
180172
180431
|
SemicolonPreference: () => SemicolonPreference,
|
|
180173
180432
|
WatchDirectoryKind: () => WatchDirectoryKind2,
|
|
180174
180433
|
WatchFileKind: () => WatchFileKind2
|
|
@@ -180265,6 +180524,7 @@ var CommandTypes = /* @__PURE__ */ ((CommandTypes2) => {
|
|
|
180265
180524
|
CommandTypes2["GetApplicableRefactors"] = "getApplicableRefactors";
|
|
180266
180525
|
CommandTypes2["GetEditsForRefactor"] = "getEditsForRefactor";
|
|
180267
180526
|
CommandTypes2["GetMoveToRefactoringFileSuggestions"] = "getMoveToRefactoringFileSuggestions";
|
|
180527
|
+
CommandTypes2["GetPasteEdits"] = "getPasteEdits";
|
|
180268
180528
|
CommandTypes2["GetEditsForRefactorFull"] = "getEditsForRefactor-full";
|
|
180269
180529
|
CommandTypes2["OrganizeImports"] = "organizeImports";
|
|
180270
180530
|
CommandTypes2["OrganizeImportsFull"] = "organizeImports-full";
|
|
@@ -180357,24 +180617,24 @@ var NewLineKind2 = /* @__PURE__ */ ((NewLineKind3) => {
|
|
|
180357
180617
|
NewLineKind3["Lf"] = "Lf";
|
|
180358
180618
|
return NewLineKind3;
|
|
180359
180619
|
})(NewLineKind2 || {});
|
|
180360
|
-
var
|
|
180361
|
-
|
|
180362
|
-
|
|
180363
|
-
|
|
180364
|
-
|
|
180365
|
-
|
|
180366
|
-
|
|
180367
|
-
|
|
180368
|
-
|
|
180369
|
-
|
|
180370
|
-
|
|
180371
|
-
|
|
180372
|
-
|
|
180373
|
-
|
|
180374
|
-
|
|
180375
|
-
|
|
180376
|
-
return
|
|
180377
|
-
})(
|
|
180620
|
+
var ScriptTarget10 = /* @__PURE__ */ ((ScriptTarget11) => {
|
|
180621
|
+
ScriptTarget11["ES3"] = "es3";
|
|
180622
|
+
ScriptTarget11["ES5"] = "es5";
|
|
180623
|
+
ScriptTarget11["ES6"] = "es6";
|
|
180624
|
+
ScriptTarget11["ES2015"] = "es2015";
|
|
180625
|
+
ScriptTarget11["ES2016"] = "es2016";
|
|
180626
|
+
ScriptTarget11["ES2017"] = "es2017";
|
|
180627
|
+
ScriptTarget11["ES2018"] = "es2018";
|
|
180628
|
+
ScriptTarget11["ES2019"] = "es2019";
|
|
180629
|
+
ScriptTarget11["ES2020"] = "es2020";
|
|
180630
|
+
ScriptTarget11["ES2021"] = "es2021";
|
|
180631
|
+
ScriptTarget11["ES2022"] = "es2022";
|
|
180632
|
+
ScriptTarget11["ES2023"] = "es2023";
|
|
180633
|
+
ScriptTarget11["ESNext"] = "esnext";
|
|
180634
|
+
ScriptTarget11["JSON"] = "json";
|
|
180635
|
+
ScriptTarget11["Latest"] = "esnext" /* ESNext */;
|
|
180636
|
+
return ScriptTarget11;
|
|
180637
|
+
})(ScriptTarget10 || {});
|
|
180378
180638
|
{
|
|
180379
180639
|
}
|
|
180380
180640
|
|
|
@@ -182633,6 +182893,17 @@ var Project3 = class _Project {
|
|
|
182633
182893
|
return this.noDtsResolutionProject;
|
|
182634
182894
|
}
|
|
182635
182895
|
/** @internal */
|
|
182896
|
+
runWithTemporaryFileUpdate(rootFile, updatedText, cb) {
|
|
182897
|
+
var _a, _b, _c, _d, _e;
|
|
182898
|
+
const originalProgram = this.program;
|
|
182899
|
+
const originalText = (_b = (_a = this.program) == null ? void 0 : _a.getSourceFile(rootFile)) == null ? void 0 : _b.getText();
|
|
182900
|
+
Debug.assert(this.program && this.program.getSourceFile(rootFile) && originalText);
|
|
182901
|
+
(_c = this.getScriptInfo(rootFile)) == null ? void 0 : _c.editContent(0, this.program.getSourceFile(rootFile).getText().length, updatedText);
|
|
182902
|
+
this.updateGraph();
|
|
182903
|
+
cb(this.program, originalProgram, (_d = this.program) == null ? void 0 : _d.getSourceFile(rootFile));
|
|
182904
|
+
(_e = this.getScriptInfo(rootFile)) == null ? void 0 : _e.editContent(0, this.program.getSourceFile(rootFile).getText().length, originalText);
|
|
182905
|
+
}
|
|
182906
|
+
/** @internal */
|
|
182636
182907
|
getCompilerOptionsForNoDtsResolutionProject() {
|
|
182637
182908
|
return {
|
|
182638
182909
|
...this.getCompilerOptions(),
|
|
@@ -187468,7 +187739,8 @@ var invalidPartialSemanticModeCommands = [
|
|
|
187468
187739
|
"getEditsForFileRename-full" /* GetEditsForFileRenameFull */,
|
|
187469
187740
|
"prepareCallHierarchy" /* PrepareCallHierarchy */,
|
|
187470
187741
|
"provideCallHierarchyIncomingCalls" /* ProvideCallHierarchyIncomingCalls */,
|
|
187471
|
-
"provideCallHierarchyOutgoingCalls" /* ProvideCallHierarchyOutgoingCalls
|
|
187742
|
+
"provideCallHierarchyOutgoingCalls" /* ProvideCallHierarchyOutgoingCalls */,
|
|
187743
|
+
"getPasteEdits" /* GetPasteEdits */
|
|
187472
187744
|
];
|
|
187473
187745
|
var invalidSyntacticModeCommands = [
|
|
187474
187746
|
...invalidPartialSemanticModeCommands,
|
|
@@ -188016,6 +188288,9 @@ var Session3 = class _Session {
|
|
|
188016
188288
|
["getMoveToRefactoringFileSuggestions" /* GetMoveToRefactoringFileSuggestions */]: (request) => {
|
|
188017
188289
|
return this.requiredResponse(this.getMoveToRefactoringFileSuggestions(request.arguments));
|
|
188018
188290
|
},
|
|
188291
|
+
["getPasteEdits" /* GetPasteEdits */]: (request) => {
|
|
188292
|
+
return this.requiredResponse(this.getPasteEdits(request.arguments));
|
|
188293
|
+
},
|
|
188019
188294
|
["getEditsForRefactor-full" /* GetEditsForRefactorFull */]: (request) => {
|
|
188020
188295
|
return this.requiredResponse(this.getEditsForRefactor(
|
|
188021
188296
|
request.arguments,
|
|
@@ -189799,6 +190074,21 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
189799
190074
|
const scriptInfo = project.getScriptInfoForNormalizedPath(file);
|
|
189800
190075
|
return project.getLanguageService().getMoveToRefactoringFileSuggestions(file, this.extractPositionOrRange(args, scriptInfo), this.getPreferences(file));
|
|
189801
190076
|
}
|
|
190077
|
+
getPasteEdits(args) {
|
|
190078
|
+
const { file, project } = this.getFileAndProject(args);
|
|
190079
|
+
const copiedFrom = args.copiedFrom ? { file: args.copiedFrom.file, range: args.copiedFrom.spans.map((copies) => this.getRange({ file: args.copiedFrom.file, startLine: copies.start.line, startOffset: copies.start.offset, endLine: copies.end.line, endOffset: copies.end.offset }, project.getScriptInfoForNormalizedPath(toNormalizedPath(args.copiedFrom.file)))) } : void 0;
|
|
190080
|
+
const result = project.getLanguageService().getPasteEdits(
|
|
190081
|
+
{
|
|
190082
|
+
targetFile: file,
|
|
190083
|
+
pastedText: args.pastedText,
|
|
190084
|
+
pasteLocations: args.pasteLocations.map((paste) => this.getRange({ file, startLine: paste.start.line, startOffset: paste.start.offset, endLine: paste.end.line, endOffset: paste.end.offset }, project.getScriptInfoForNormalizedPath(file))),
|
|
190085
|
+
copiedFrom,
|
|
190086
|
+
preferences: this.getPreferences(file)
|
|
190087
|
+
},
|
|
190088
|
+
this.getFormatOptions(file)
|
|
190089
|
+
);
|
|
190090
|
+
return result && this.mapPasteEditsAction(result);
|
|
190091
|
+
}
|
|
189802
190092
|
organizeImports(args, simplifiedResult) {
|
|
189803
190093
|
Debug.assert(args.scope.type === "file");
|
|
189804
190094
|
const { file, project } = this.getFileAndProject(args.scope.args);
|
|
@@ -189865,10 +190155,10 @@ ${e.message}`;
|
|
|
189865
190155
|
}
|
|
189866
190156
|
return simplifiedResult ? codeActions.map((codeAction) => this.mapCodeFixAction(codeAction)) : codeActions;
|
|
189867
190157
|
}
|
|
189868
|
-
getCombinedCodeFix({ scope, fixId:
|
|
190158
|
+
getCombinedCodeFix({ scope, fixId: fixId55 }, simplifiedResult) {
|
|
189869
190159
|
Debug.assert(scope.type === "file");
|
|
189870
190160
|
const { file, project } = this.getFileAndProject(scope.args);
|
|
189871
|
-
const res = project.getLanguageService().getCombinedCodeFix({ type: "file", fileName: file },
|
|
190161
|
+
const res = project.getLanguageService().getCombinedCodeFix({ type: "file", fileName: file }, fixId55, this.getFormatOptions(file), this.getPreferences(file));
|
|
189872
190162
|
if (simplifiedResult) {
|
|
189873
190163
|
return { changes: this.mapTextChangesToCodeEdits(res.changes), commands: res.commands };
|
|
189874
190164
|
} else {
|
|
@@ -189907,8 +190197,11 @@ ${e.message}`;
|
|
|
189907
190197
|
mapCodeAction({ description: description3, changes, commands }) {
|
|
189908
190198
|
return { description: description3, changes: this.mapTextChangesToCodeEdits(changes), commands };
|
|
189909
190199
|
}
|
|
189910
|
-
mapCodeFixAction({ fixName: fixName8, description: description3, changes, commands, fixId:
|
|
189911
|
-
return { fixName: fixName8, description: description3, changes: this.mapTextChangesToCodeEdits(changes), commands, fixId:
|
|
190200
|
+
mapCodeFixAction({ fixName: fixName8, description: description3, changes, commands, fixId: fixId55, fixAllDescription }) {
|
|
190201
|
+
return { fixName: fixName8, description: description3, changes: this.mapTextChangesToCodeEdits(changes), commands, fixId: fixId55, fixAllDescription };
|
|
190202
|
+
}
|
|
190203
|
+
mapPasteEditsAction({ edits, fixId: fixId55 }) {
|
|
190204
|
+
return { edits: this.mapTextChangesToCodeEdits(edits), fixId: fixId55 };
|
|
189912
190205
|
}
|
|
189913
190206
|
mapTextChangesToCodeEdits(textChanges2) {
|
|
189914
190207
|
return textChanges2.map((change) => this.mapTextChangeToCodeEdit(change));
|
|
@@ -191933,6 +192226,7 @@ if (typeof console !== "undefined") {
|
|
|
191933
192226
|
forEachKey,
|
|
191934
192227
|
forEachLeadingCommentRange,
|
|
191935
192228
|
forEachNameInAccessChainWalkingLeft,
|
|
192229
|
+
forEachNameOfDefaultExport,
|
|
191936
192230
|
forEachPropertyAssignment,
|
|
191937
192231
|
forEachResolvedProjectReference,
|
|
191938
192232
|
forEachReturnStatement,
|
|
@@ -192029,11 +192323,11 @@ if (typeof console !== "undefined") {
|
|
|
192029
192323
|
getDeclaredExpandoInitializer,
|
|
192030
192324
|
getDecorators,
|
|
192031
192325
|
getDefaultCompilerOptions,
|
|
192032
|
-
getDefaultExportInfoWorker,
|
|
192033
192326
|
getDefaultFormatCodeSettings,
|
|
192034
192327
|
getDefaultLibFileName,
|
|
192035
192328
|
getDefaultLibFilePath,
|
|
192036
192329
|
getDefaultLikeExportInfo,
|
|
192330
|
+
getDefaultLikeExportNameFromDeclaration,
|
|
192037
192331
|
getDefaultResolutionModeForFileWorker,
|
|
192038
192332
|
getDiagnosticText,
|
|
192039
192333
|
getDiagnosticsWithinSpan,
|
|
@@ -192368,6 +192662,7 @@ if (typeof console !== "undefined") {
|
|
|
192368
192662
|
getSwitchedType,
|
|
192369
192663
|
getSymbolId,
|
|
192370
192664
|
getSymbolNameForPrivateIdentifier,
|
|
192665
|
+
getSymbolParentOrFail,
|
|
192371
192666
|
getSymbolTarget,
|
|
192372
192667
|
getSyntacticClassifications,
|
|
192373
192668
|
getSyntacticModifierFlags,
|
|
@@ -193232,7 +193527,9 @@ if (typeof console !== "undefined") {
|
|
|
193232
193527
|
moduleResolutionOptionDeclarations,
|
|
193233
193528
|
moduleResolutionSupportsPackageJsonExportsAndImports,
|
|
193234
193529
|
moduleResolutionUsesNodeModules,
|
|
193530
|
+
moduleSpecifierToValidIdentifier,
|
|
193235
193531
|
moduleSpecifiers,
|
|
193532
|
+
moduleSymbolToValidIdentifier,
|
|
193236
193533
|
moveEmitHelpers,
|
|
193237
193534
|
moveRangeEnd,
|
|
193238
193535
|
moveRangePastDecorators,
|
|
@@ -193312,6 +193609,7 @@ if (typeof console !== "undefined") {
|
|
|
193312
193609
|
parsePackageName,
|
|
193313
193610
|
parsePseudoBigInt,
|
|
193314
193611
|
parseValidBigInt,
|
|
193612
|
+
pasteEdits,
|
|
193315
193613
|
patchWriteFileEnsuringDirectory,
|
|
193316
193614
|
pathContainsNodeModules,
|
|
193317
193615
|
pathIsAbsolute,
|