praxis-kit 2.0.2 → 3.1.0
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/dist/{chunk-ACAKUHH5.js → chunk-6RJN5B6L.js} +192 -175
- package/dist/codemod/index.d.ts +1 -20
- package/dist/codemod/index.js +668 -637
- package/dist/contract/index.d.ts +9 -9
- package/dist/contract/index.js +24 -13
- package/dist/eslint/index.js +16 -16
- package/dist/lit/index.d.ts +14 -14
- package/dist/lit/index.js +67 -56
- package/dist/{merge-refs-tA18zYP6.d.ts → merge-refs-CfAbwCKz.d.ts} +16 -14
- package/dist/preact/index.d.ts +16 -16
- package/dist/preact/index.js +63 -52
- package/dist/react/index.d.ts +8 -10
- package/dist/react/index.js +2 -6
- package/dist/react/legacy.d.ts +7 -7
- package/dist/react/legacy.js +3 -1
- package/dist/solid/index.d.ts +17 -17
- package/dist/solid/index.js +63 -52
- package/dist/svelte/index.d.ts +20 -20
- package/dist/svelte/index.js +60 -49
- package/dist/tailwind/index.js +23 -23
- package/dist/vite-plugin/index.d.ts +76 -50
- package/dist/vite-plugin/index.js +146 -41
- package/dist/vue/index.d.ts +16 -16
- package/dist/vue/index.js +63 -52
- package/dist/web/index.d.ts +14 -14
- package/dist/web/index.js +65 -54
- package/package.json +4 -4
package/dist/codemod/index.js
CHANGED
|
@@ -2059,7 +2059,7 @@ var require_typescript = __commonJS({
|
|
|
2059
2059
|
returnTrue: () => returnTrue,
|
|
2060
2060
|
returnUndefined: () => returnUndefined,
|
|
2061
2061
|
returnsPromise: () => returnsPromise,
|
|
2062
|
-
rewriteModuleSpecifier: () =>
|
|
2062
|
+
rewriteModuleSpecifier: () => rewriteModuleSpecifier2,
|
|
2063
2063
|
sameFlatMap: () => sameFlatMap,
|
|
2064
2064
|
sameMap: () => sameMap,
|
|
2065
2065
|
sameMapping: () => sameMapping,
|
|
@@ -23022,34 +23022,34 @@ ${lanes.join("\n")}
|
|
|
23022
23022
|
directories: directoriesMatcher,
|
|
23023
23023
|
exclude: excludeMatcher
|
|
23024
23024
|
};
|
|
23025
|
-
function getRegularExpressionForWildcard(specs, basePath,
|
|
23026
|
-
const patterns = getRegularExpressionsForWildcards(specs, basePath,
|
|
23025
|
+
function getRegularExpressionForWildcard(specs, basePath, usage2) {
|
|
23026
|
+
const patterns = getRegularExpressionsForWildcards(specs, basePath, usage2);
|
|
23027
23027
|
if (!patterns || !patterns.length) {
|
|
23028
23028
|
return void 0;
|
|
23029
23029
|
}
|
|
23030
23030
|
const pattern = patterns.map((pattern2) => `(?:${pattern2})`).join("|");
|
|
23031
|
-
const terminator =
|
|
23031
|
+
const terminator = usage2 === "exclude" ? "(?:$|/)" : "$";
|
|
23032
23032
|
return `^(?:${pattern})${terminator}`;
|
|
23033
23033
|
}
|
|
23034
|
-
function getRegularExpressionsForWildcards(specs, basePath,
|
|
23034
|
+
function getRegularExpressionsForWildcards(specs, basePath, usage2) {
|
|
23035
23035
|
if (specs === void 0 || specs.length === 0) {
|
|
23036
23036
|
return void 0;
|
|
23037
23037
|
}
|
|
23038
|
-
return flatMap(specs, (spec) => spec && getSubPatternFromSpec(spec, basePath,
|
|
23038
|
+
return flatMap(specs, (spec) => spec && getSubPatternFromSpec(spec, basePath, usage2, wildcardMatchers[usage2]));
|
|
23039
23039
|
}
|
|
23040
23040
|
function isImplicitGlob(lastPathComponent) {
|
|
23041
23041
|
return !/[.*?]/.test(lastPathComponent);
|
|
23042
23042
|
}
|
|
23043
|
-
function getPatternFromSpec(spec, basePath,
|
|
23044
|
-
const pattern = spec && getSubPatternFromSpec(spec, basePath,
|
|
23045
|
-
return pattern && `^(?:${pattern})${
|
|
23043
|
+
function getPatternFromSpec(spec, basePath, usage2) {
|
|
23044
|
+
const pattern = spec && getSubPatternFromSpec(spec, basePath, usage2, wildcardMatchers[usage2]);
|
|
23045
|
+
return pattern && `^(?:${pattern})${usage2 === "exclude" ? "(?:$|/)" : "$"}`;
|
|
23046
23046
|
}
|
|
23047
|
-
function getSubPatternFromSpec(spec, basePath,
|
|
23047
|
+
function getSubPatternFromSpec(spec, basePath, usage2, { singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter: replaceWildcardCharacter2 } = wildcardMatchers[usage2]) {
|
|
23048
23048
|
let subpattern = "";
|
|
23049
23049
|
let hasWrittenComponent = false;
|
|
23050
23050
|
const components = getNormalizedPathComponents(spec, basePath);
|
|
23051
23051
|
const lastComponent = last(components);
|
|
23052
|
-
if (
|
|
23052
|
+
if (usage2 !== "exclude" && lastComponent === "**") {
|
|
23053
23053
|
return void 0;
|
|
23054
23054
|
}
|
|
23055
23055
|
components[0] = removeTrailingDirectorySeparator(components[0]);
|
|
@@ -23061,14 +23061,14 @@ ${lanes.join("\n")}
|
|
|
23061
23061
|
if (component === "**") {
|
|
23062
23062
|
subpattern += doubleAsteriskRegexFragment;
|
|
23063
23063
|
} else {
|
|
23064
|
-
if (
|
|
23064
|
+
if (usage2 === "directories") {
|
|
23065
23065
|
subpattern += "(?:";
|
|
23066
23066
|
optionalCount++;
|
|
23067
23067
|
}
|
|
23068
23068
|
if (hasWrittenComponent) {
|
|
23069
23069
|
subpattern += directorySeparator;
|
|
23070
23070
|
}
|
|
23071
|
-
if (
|
|
23071
|
+
if (usage2 !== "exclude") {
|
|
23072
23072
|
let componentPattern = "";
|
|
23073
23073
|
if (component.charCodeAt(0) === 42) {
|
|
23074
23074
|
componentPattern += "(?:[^./]" + singleAsteriskRegexFragment + ")?";
|
|
@@ -56364,27 +56364,27 @@ ${lanes.join("\n")}
|
|
|
56364
56364
|
}
|
|
56365
56365
|
return Debug.fail("There should exist two symbols, one as property declaration and one as parameter declaration");
|
|
56366
56366
|
}
|
|
56367
|
-
function isBlockScopedNameDeclaredBeforeUse(declaration,
|
|
56367
|
+
function isBlockScopedNameDeclaredBeforeUse(declaration, usage2) {
|
|
56368
56368
|
const declarationFile = getSourceFileOfNode(declaration);
|
|
56369
|
-
const useFile = getSourceFileOfNode(
|
|
56369
|
+
const useFile = getSourceFileOfNode(usage2);
|
|
56370
56370
|
const declContainer = getEnclosingBlockScopeContainer(declaration);
|
|
56371
56371
|
if (declarationFile !== useFile) {
|
|
56372
|
-
if (moduleKind && (declarationFile.externalModuleIndicator || useFile.externalModuleIndicator) || !compilerOptions.outFile || isInTypeQuery(
|
|
56372
|
+
if (moduleKind && (declarationFile.externalModuleIndicator || useFile.externalModuleIndicator) || !compilerOptions.outFile || isInTypeQuery(usage2) || declaration.flags & 33554432) {
|
|
56373
56373
|
return true;
|
|
56374
56374
|
}
|
|
56375
|
-
if (isUsedInFunctionOrInstanceProperty(
|
|
56375
|
+
if (isUsedInFunctionOrInstanceProperty(usage2, declaration)) {
|
|
56376
56376
|
return true;
|
|
56377
56377
|
}
|
|
56378
56378
|
const sourceFiles = host.getSourceFiles();
|
|
56379
56379
|
return sourceFiles.indexOf(declarationFile) <= sourceFiles.indexOf(useFile);
|
|
56380
56380
|
}
|
|
56381
|
-
if (!!(
|
|
56381
|
+
if (!!(usage2.flags & 16777216) || isInTypeQuery(usage2) || isInAmbientOrTypeNode(usage2)) {
|
|
56382
56382
|
return true;
|
|
56383
56383
|
}
|
|
56384
|
-
if (declaration.pos <=
|
|
56384
|
+
if (declaration.pos <= usage2.pos && !(isPropertyDeclaration(declaration) && isThisProperty(usage2.parent) && !declaration.initializer && !declaration.exclamationToken)) {
|
|
56385
56385
|
if (declaration.kind === 209) {
|
|
56386
56386
|
const errorBindingElement = getAncestor(
|
|
56387
|
-
|
|
56387
|
+
usage2,
|
|
56388
56388
|
209
|
|
56389
56389
|
/* BindingElement */
|
|
56390
56390
|
);
|
|
@@ -56395,41 +56395,41 @@ ${lanes.join("\n")}
|
|
|
56395
56395
|
declaration,
|
|
56396
56396
|
261
|
|
56397
56397
|
/* VariableDeclaration */
|
|
56398
|
-
),
|
|
56398
|
+
), usage2);
|
|
56399
56399
|
} else if (declaration.kind === 261) {
|
|
56400
|
-
return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration,
|
|
56400
|
+
return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage2);
|
|
56401
56401
|
} else if (isClassLike(declaration)) {
|
|
56402
|
-
const container = findAncestor(
|
|
56402
|
+
const container = findAncestor(usage2, (n) => n === declaration ? "quit" : isComputedPropertyName(n) ? n.parent.parent === declaration : !legacyDecorators && isDecorator(n) && (n.parent === declaration || isMethodDeclaration(n.parent) && n.parent.parent === declaration || isGetOrSetAccessorDeclaration(n.parent) && n.parent.parent === declaration || isPropertyDeclaration(n.parent) && n.parent.parent === declaration || isParameter(n.parent) && n.parent.parent.parent === declaration));
|
|
56403
56403
|
if (!container) {
|
|
56404
56404
|
return true;
|
|
56405
56405
|
}
|
|
56406
56406
|
if (!legacyDecorators && isDecorator(container)) {
|
|
56407
|
-
return !!findAncestor(
|
|
56407
|
+
return !!findAncestor(usage2, (n) => n === container ? "quit" : isFunctionLike(n) && !getImmediatelyInvokedFunctionExpression(n));
|
|
56408
56408
|
}
|
|
56409
56409
|
return false;
|
|
56410
56410
|
} else if (isPropertyDeclaration(declaration)) {
|
|
56411
56411
|
return !isPropertyImmediatelyReferencedWithinDeclaration(
|
|
56412
56412
|
declaration,
|
|
56413
|
-
|
|
56413
|
+
usage2,
|
|
56414
56414
|
/*stopAtAnyPropertyDeclaration*/
|
|
56415
56415
|
false
|
|
56416
56416
|
);
|
|
56417
56417
|
} else if (isParameterPropertyDeclaration(declaration, declaration.parent)) {
|
|
56418
|
-
return !(emitStandardClassFields && getContainingClass(declaration) === getContainingClass(
|
|
56418
|
+
return !(emitStandardClassFields && getContainingClass(declaration) === getContainingClass(usage2) && isUsedInFunctionOrInstanceProperty(usage2, declaration));
|
|
56419
56419
|
}
|
|
56420
56420
|
return true;
|
|
56421
56421
|
}
|
|
56422
|
-
if (
|
|
56422
|
+
if (usage2.parent.kind === 282 || usage2.parent.kind === 278 && usage2.parent.isExportEquals) {
|
|
56423
56423
|
return true;
|
|
56424
56424
|
}
|
|
56425
|
-
if (
|
|
56425
|
+
if (usage2.kind === 278 && usage2.isExportEquals) {
|
|
56426
56426
|
return true;
|
|
56427
56427
|
}
|
|
56428
|
-
if (isUsedInFunctionOrInstanceProperty(
|
|
56428
|
+
if (isUsedInFunctionOrInstanceProperty(usage2, declaration)) {
|
|
56429
56429
|
if (emitStandardClassFields && getContainingClass(declaration) && (isPropertyDeclaration(declaration) || isParameterPropertyDeclaration(declaration, declaration.parent))) {
|
|
56430
56430
|
return !isPropertyImmediatelyReferencedWithinDeclaration(
|
|
56431
56431
|
declaration,
|
|
56432
|
-
|
|
56432
|
+
usage2,
|
|
56433
56433
|
/*stopAtAnyPropertyDeclaration*/
|
|
56434
56434
|
true
|
|
56435
56435
|
);
|
|
@@ -56438,24 +56438,24 @@ ${lanes.join("\n")}
|
|
|
56438
56438
|
}
|
|
56439
56439
|
}
|
|
56440
56440
|
return false;
|
|
56441
|
-
function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration2,
|
|
56441
|
+
function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration2, usage22) {
|
|
56442
56442
|
switch (declaration2.parent.parent.kind) {
|
|
56443
56443
|
case 244:
|
|
56444
56444
|
case 249:
|
|
56445
56445
|
case 251:
|
|
56446
|
-
if (isSameScopeDescendentOf(
|
|
56446
|
+
if (isSameScopeDescendentOf(usage22, declaration2, declContainer)) {
|
|
56447
56447
|
return true;
|
|
56448
56448
|
}
|
|
56449
56449
|
break;
|
|
56450
56450
|
}
|
|
56451
56451
|
const grandparent = declaration2.parent.parent;
|
|
56452
|
-
return isForInOrOfStatement(grandparent) && isSameScopeDescendentOf(
|
|
56452
|
+
return isForInOrOfStatement(grandparent) && isSameScopeDescendentOf(usage22, grandparent.expression, declContainer);
|
|
56453
56453
|
}
|
|
56454
|
-
function isUsedInFunctionOrInstanceProperty(
|
|
56455
|
-
return isUsedInFunctionOrInstancePropertyWorker(
|
|
56454
|
+
function isUsedInFunctionOrInstanceProperty(usage22, declaration2) {
|
|
56455
|
+
return isUsedInFunctionOrInstancePropertyWorker(usage22, declaration2);
|
|
56456
56456
|
}
|
|
56457
|
-
function isUsedInFunctionOrInstancePropertyWorker(
|
|
56458
|
-
return !!findAncestor(
|
|
56457
|
+
function isUsedInFunctionOrInstancePropertyWorker(usage22, declaration2) {
|
|
56458
|
+
return !!findAncestor(usage22, (current) => {
|
|
56459
56459
|
if (current === declContainer) {
|
|
56460
56460
|
return "quit";
|
|
56461
56461
|
}
|
|
@@ -56463,7 +56463,7 @@ ${lanes.join("\n")}
|
|
|
56463
56463
|
return !getImmediatelyInvokedFunctionExpression(current);
|
|
56464
56464
|
}
|
|
56465
56465
|
if (isClassStaticBlockDeclaration(current)) {
|
|
56466
|
-
return declaration2.pos <
|
|
56466
|
+
return declaration2.pos < usage22.pos;
|
|
56467
56467
|
}
|
|
56468
56468
|
const propertyDeclaration = tryCast(current.parent, isPropertyDeclaration);
|
|
56469
56469
|
if (propertyDeclaration) {
|
|
@@ -56473,7 +56473,7 @@ ${lanes.join("\n")}
|
|
|
56473
56473
|
if (declaration2.kind === 175) {
|
|
56474
56474
|
return true;
|
|
56475
56475
|
}
|
|
56476
|
-
if (isPropertyDeclaration(declaration2) && getContainingClass(
|
|
56476
|
+
if (isPropertyDeclaration(declaration2) && getContainingClass(usage22) === getContainingClass(declaration2)) {
|
|
56477
56477
|
const propName = declaration2.name;
|
|
56478
56478
|
if (isIdentifier(propName) || isPrivateIdentifier(propName)) {
|
|
56479
56479
|
const type = getTypeOfSymbol(getSymbolOfDeclaration(declaration2));
|
|
@@ -56485,7 +56485,7 @@ ${lanes.join("\n")}
|
|
|
56485
56485
|
}
|
|
56486
56486
|
} else {
|
|
56487
56487
|
const isDeclarationInstanceProperty = declaration2.kind === 173 && !isStatic(declaration2);
|
|
56488
|
-
if (!isDeclarationInstanceProperty || getContainingClass(
|
|
56488
|
+
if (!isDeclarationInstanceProperty || getContainingClass(usage22) !== getContainingClass(declaration2)) {
|
|
56489
56489
|
return true;
|
|
56490
56490
|
}
|
|
56491
56491
|
}
|
|
@@ -56503,11 +56503,11 @@ ${lanes.join("\n")}
|
|
|
56503
56503
|
return false;
|
|
56504
56504
|
});
|
|
56505
56505
|
}
|
|
56506
|
-
function isPropertyImmediatelyReferencedWithinDeclaration(declaration2,
|
|
56507
|
-
if (
|
|
56506
|
+
function isPropertyImmediatelyReferencedWithinDeclaration(declaration2, usage22, stopAtAnyPropertyDeclaration) {
|
|
56507
|
+
if (usage22.end > declaration2.end) {
|
|
56508
56508
|
return false;
|
|
56509
56509
|
}
|
|
56510
|
-
const ancestorChangingReferenceScope = findAncestor(
|
|
56510
|
+
const ancestorChangingReferenceScope = findAncestor(usage22, (node) => {
|
|
56511
56511
|
if (node === declaration2) {
|
|
56512
56512
|
return "quit";
|
|
56513
56513
|
}
|
|
@@ -57035,19 +57035,19 @@ ${lanes.join("\n")}
|
|
|
57035
57035
|
/* Default */
|
|
57036
57036
|
) || isExportSpecifier(node) || isNamespaceExport(node);
|
|
57037
57037
|
}
|
|
57038
|
-
function getEmitSyntaxForModuleSpecifierExpression(
|
|
57039
|
-
return isStringLiteralLike(
|
|
57038
|
+
function getEmitSyntaxForModuleSpecifierExpression(usage2) {
|
|
57039
|
+
return isStringLiteralLike(usage2) ? host.getEmitSyntaxForUsageLocation(getSourceFileOfNode(usage2), usage2) : void 0;
|
|
57040
57040
|
}
|
|
57041
57041
|
function isESMFormatImportImportingCommonjsFormatFile(usageMode, targetMode) {
|
|
57042
57042
|
return usageMode === 99 && targetMode === 1;
|
|
57043
57043
|
}
|
|
57044
|
-
function isOnlyImportableAsDefault(
|
|
57044
|
+
function isOnlyImportableAsDefault(usage2, resolvedModule) {
|
|
57045
57045
|
if (100 <= moduleKind && moduleKind <= 199) {
|
|
57046
|
-
const usageMode = getEmitSyntaxForModuleSpecifierExpression(
|
|
57046
|
+
const usageMode = getEmitSyntaxForModuleSpecifierExpression(usage2);
|
|
57047
57047
|
if (usageMode === 99) {
|
|
57048
57048
|
resolvedModule ?? (resolvedModule = resolveExternalModuleName(
|
|
57049
|
-
|
|
57050
|
-
|
|
57049
|
+
usage2,
|
|
57050
|
+
usage2,
|
|
57051
57051
|
/*ignoreErrors*/
|
|
57052
57052
|
true
|
|
57053
57053
|
));
|
|
@@ -57057,8 +57057,8 @@ ${lanes.join("\n")}
|
|
|
57057
57057
|
}
|
|
57058
57058
|
return false;
|
|
57059
57059
|
}
|
|
57060
|
-
function canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias,
|
|
57061
|
-
const usageMode = file && getEmitSyntaxForModuleSpecifierExpression(
|
|
57060
|
+
function canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, usage2) {
|
|
57061
|
+
const usageMode = file && getEmitSyntaxForModuleSpecifierExpression(usage2);
|
|
57062
57062
|
if (file && usageMode !== void 0) {
|
|
57063
57063
|
const targetMode = host.getImpliedNodeFormatForEmit(file);
|
|
57064
57064
|
if (usageMode === 99 && targetMode === 1 && 100 <= moduleKind && moduleKind <= 199) {
|
|
@@ -105310,7 +105310,7 @@ ${lanes.join("\n")}
|
|
|
105310
105310
|
function isSimpleParameterList(nodes) {
|
|
105311
105311
|
return every(nodes, isSimpleParameter);
|
|
105312
105312
|
}
|
|
105313
|
-
function
|
|
105313
|
+
function rewriteModuleSpecifier2(node, compilerOptions) {
|
|
105314
105314
|
if (!node || !isStringLiteral(node) || !shouldRewriteModuleSpecifier(node.text, compilerOptions)) {
|
|
105315
105315
|
return node;
|
|
105316
105316
|
}
|
|
@@ -124254,7 +124254,7 @@ ${lanes.join("\n")}
|
|
|
124254
124254
|
void 0,
|
|
124255
124255
|
visitNodes2(node.arguments, (arg) => {
|
|
124256
124256
|
if (arg === node.arguments[0]) {
|
|
124257
|
-
return isStringLiteralLike(arg) ?
|
|
124257
|
+
return isStringLiteralLike(arg) ? rewriteModuleSpecifier2(arg, compilerOptions) : emitHelpers().createRewriteRelativeImportExtensionsHelper(arg);
|
|
124258
124258
|
}
|
|
124259
124259
|
return visitor(arg);
|
|
124260
124260
|
}, isExpression)
|
|
@@ -124266,7 +124266,7 @@ ${lanes.join("\n")}
|
|
|
124266
124266
|
}
|
|
124267
124267
|
const externalModuleName = getExternalModuleNameLiteral(factory2, node, currentSourceFile, host, resolver, compilerOptions);
|
|
124268
124268
|
const firstArgument = visitNode(firstOrUndefined(node.arguments), visitor, isExpression);
|
|
124269
|
-
const argument = externalModuleName && (!firstArgument || !isStringLiteral(firstArgument) || firstArgument.text !== externalModuleName.text) ? externalModuleName : firstArgument && rewriteOrShim ? isStringLiteral(firstArgument) ?
|
|
124269
|
+
const argument = externalModuleName && (!firstArgument || !isStringLiteral(firstArgument) || firstArgument.text !== externalModuleName.text) ? externalModuleName : firstArgument && rewriteOrShim ? isStringLiteral(firstArgument) ? rewriteModuleSpecifier2(firstArgument, compilerOptions) : emitHelpers().createRewriteRelativeImportExtensionsHelper(firstArgument) : firstArgument;
|
|
124270
124270
|
const containsLexicalThis = !!(node.transformFlags & 16384);
|
|
124271
124271
|
switch (compilerOptions.module) {
|
|
124272
124272
|
case 2:
|
|
@@ -124607,7 +124607,7 @@ ${lanes.join("\n")}
|
|
|
124607
124607
|
const moduleName = getExternalModuleNameLiteral(factory2, importNode, currentSourceFile, host, resolver, compilerOptions);
|
|
124608
124608
|
const args = [];
|
|
124609
124609
|
if (moduleName) {
|
|
124610
|
-
args.push(
|
|
124610
|
+
args.push(rewriteModuleSpecifier2(moduleName, compilerOptions));
|
|
124611
124611
|
}
|
|
124612
124612
|
return factory2.createCallExpression(
|
|
124613
124613
|
factory2.createIdentifier("require"),
|
|
@@ -126887,7 +126887,7 @@ ${lanes.join("\n")}
|
|
|
126887
126887
|
if (!compilerOptions.rewriteRelativeImportExtensions) {
|
|
126888
126888
|
return node;
|
|
126889
126889
|
}
|
|
126890
|
-
const updatedModuleSpecifier =
|
|
126890
|
+
const updatedModuleSpecifier = rewriteModuleSpecifier2(node.moduleSpecifier, compilerOptions);
|
|
126891
126891
|
if (updatedModuleSpecifier === node.moduleSpecifier) {
|
|
126892
126892
|
return node;
|
|
126893
126893
|
}
|
|
@@ -126905,7 +126905,7 @@ ${lanes.join("\n")}
|
|
|
126905
126905
|
node.expression,
|
|
126906
126906
|
node.typeArguments,
|
|
126907
126907
|
[
|
|
126908
|
-
isStringLiteralLike(node.arguments[0]) ?
|
|
126908
|
+
isStringLiteralLike(node.arguments[0]) ? rewriteModuleSpecifier2(node.arguments[0], compilerOptions) : emitHelpers().createRewriteRelativeImportExtensionsHelper(node.arguments[0]),
|
|
126909
126909
|
...node.arguments.slice(1)
|
|
126910
126910
|
]
|
|
126911
126911
|
);
|
|
@@ -126914,7 +126914,7 @@ ${lanes.join("\n")}
|
|
|
126914
126914
|
const moduleName = getExternalModuleNameLiteral(factory2, importNode, Debug.checkDefined(currentSourceFile), host, resolver, compilerOptions);
|
|
126915
126915
|
const args = [];
|
|
126916
126916
|
if (moduleName) {
|
|
126917
|
-
args.push(
|
|
126917
|
+
args.push(rewriteModuleSpecifier2(moduleName, compilerOptions));
|
|
126918
126918
|
}
|
|
126919
126919
|
if (getEmitModuleKind(compilerOptions) === 200) {
|
|
126920
126920
|
return factory2.createCallExpression(
|
|
@@ -127073,7 +127073,7 @@ ${lanes.join("\n")}
|
|
|
127073
127073
|
return node;
|
|
127074
127074
|
}
|
|
127075
127075
|
function visitExportDeclaration(node) {
|
|
127076
|
-
const updatedModuleSpecifier =
|
|
127076
|
+
const updatedModuleSpecifier = rewriteModuleSpecifier2(node.moduleSpecifier, compilerOptions);
|
|
127077
127077
|
if (compilerOptions.module !== void 0 && compilerOptions.module > 5 || !node.exportClause || !isNamespaceExport(node.exportClause) || !node.moduleSpecifier) {
|
|
127078
127078
|
return !node.moduleSpecifier || updatedModuleSpecifier === node.moduleSpecifier ? node : factory2.updateExportDeclaration(
|
|
127079
127079
|
node,
|
|
@@ -128358,7 +128358,7 @@ ${lanes.join("\n")}
|
|
|
128358
128358
|
}
|
|
128359
128359
|
return setCommentRange(updated, getCommentRange(original));
|
|
128360
128360
|
}
|
|
128361
|
-
function
|
|
128361
|
+
function rewriteModuleSpecifier22(parent2, input) {
|
|
128362
128362
|
if (!input) return void 0;
|
|
128363
128363
|
resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent2.kind !== 268 && parent2.kind !== 206;
|
|
128364
128364
|
if (isStringLiteralLike(input)) {
|
|
@@ -128380,7 +128380,7 @@ ${lanes.join("\n")}
|
|
|
128380
128380
|
decl.modifiers,
|
|
128381
128381
|
decl.isTypeOnly,
|
|
128382
128382
|
decl.name,
|
|
128383
|
-
factory2.updateExternalModuleReference(decl.moduleReference,
|
|
128383
|
+
factory2.updateExternalModuleReference(decl.moduleReference, rewriteModuleSpecifier22(decl, specifier))
|
|
128384
128384
|
);
|
|
128385
128385
|
} else {
|
|
128386
128386
|
const oldDiag = getSymbolAccessibilityDiagnostic;
|
|
@@ -128396,7 +128396,7 @@ ${lanes.join("\n")}
|
|
|
128396
128396
|
decl,
|
|
128397
128397
|
decl.modifiers,
|
|
128398
128398
|
decl.importClause,
|
|
128399
|
-
|
|
128399
|
+
rewriteModuleSpecifier22(decl, decl.moduleSpecifier),
|
|
128400
128400
|
tryGetResolutionModeOverride(decl.attributes)
|
|
128401
128401
|
);
|
|
128402
128402
|
}
|
|
@@ -128413,7 +128413,7 @@ ${lanes.join("\n")}
|
|
|
128413
128413
|
/*namedBindings*/
|
|
128414
128414
|
void 0
|
|
128415
128415
|
),
|
|
128416
|
-
|
|
128416
|
+
rewriteModuleSpecifier22(decl, decl.moduleSpecifier),
|
|
128417
128417
|
tryGetResolutionModeOverride(decl.attributes)
|
|
128418
128418
|
);
|
|
128419
128419
|
}
|
|
@@ -128431,7 +128431,7 @@ ${lanes.join("\n")}
|
|
|
128431
128431
|
visibleDefaultBinding,
|
|
128432
128432
|
namedBindings
|
|
128433
128433
|
),
|
|
128434
|
-
|
|
128434
|
+
rewriteModuleSpecifier22(decl, decl.moduleSpecifier),
|
|
128435
128435
|
tryGetResolutionModeOverride(decl.attributes)
|
|
128436
128436
|
) : void 0;
|
|
128437
128437
|
}
|
|
@@ -128446,7 +128446,7 @@ ${lanes.join("\n")}
|
|
|
128446
128446
|
visibleDefaultBinding,
|
|
128447
128447
|
bindingList && bindingList.length ? factory2.updateNamedImports(decl.importClause.namedBindings, bindingList) : void 0
|
|
128448
128448
|
),
|
|
128449
|
-
|
|
128449
|
+
rewriteModuleSpecifier22(decl, decl.moduleSpecifier),
|
|
128450
128450
|
tryGetResolutionModeOverride(decl.attributes)
|
|
128451
128451
|
);
|
|
128452
128452
|
}
|
|
@@ -128459,7 +128459,7 @@ ${lanes.join("\n")}
|
|
|
128459
128459
|
decl.modifiers,
|
|
128460
128460
|
/*importClause*/
|
|
128461
128461
|
void 0,
|
|
128462
|
-
|
|
128462
|
+
rewriteModuleSpecifier22(decl, decl.moduleSpecifier),
|
|
128463
128463
|
tryGetResolutionModeOverride(decl.attributes)
|
|
128464
128464
|
);
|
|
128465
128465
|
}
|
|
@@ -128792,7 +128792,7 @@ ${lanes.join("\n")}
|
|
|
128792
128792
|
if (!isLiteralImportTypeNode(input)) return cleanup(input);
|
|
128793
128793
|
return cleanup(factory2.updateImportTypeNode(
|
|
128794
128794
|
input,
|
|
128795
|
-
factory2.updateLiteralTypeNode(input.argument,
|
|
128795
|
+
factory2.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier22(input, input.argument.literal)),
|
|
128796
128796
|
input.attributes,
|
|
128797
128797
|
input.qualifier,
|
|
128798
128798
|
visitNodes2(input.typeArguments, visitDeclarationSubtree, isTypeNode),
|
|
@@ -128853,7 +128853,7 @@ ${lanes.join("\n")}
|
|
|
128853
128853
|
input.modifiers,
|
|
128854
128854
|
input.isTypeOnly,
|
|
128855
128855
|
input.exportClause,
|
|
128856
|
-
|
|
128856
|
+
rewriteModuleSpecifier22(input, input.moduleSpecifier),
|
|
128857
128857
|
tryGetResolutionModeOverride(input.attributes)
|
|
128858
128858
|
);
|
|
128859
128859
|
}
|
|
@@ -129145,7 +129145,7 @@ ${lanes.join("\n")}
|
|
|
129145
129145
|
return cleanup(updateModuleDeclarationAndKeyword(
|
|
129146
129146
|
input,
|
|
129147
129147
|
mods,
|
|
129148
|
-
isExternalModuleAugmentation(input) ?
|
|
129148
|
+
isExternalModuleAugmentation(input) ? rewriteModuleSpecifier22(input, input.name) : input.name,
|
|
129149
129149
|
body
|
|
129150
129150
|
));
|
|
129151
129151
|
} else {
|
|
@@ -136267,43 +136267,43 @@ ${lanes.join("\n")}
|
|
|
136267
136267
|
}
|
|
136268
136268
|
return false;
|
|
136269
136269
|
}
|
|
136270
|
-
function getModeForUsageLocation(file,
|
|
136271
|
-
return getModeForUsageLocationWorker(file,
|
|
136270
|
+
function getModeForUsageLocation(file, usage2, compilerOptions) {
|
|
136271
|
+
return getModeForUsageLocationWorker(file, usage2, compilerOptions);
|
|
136272
136272
|
}
|
|
136273
|
-
function getModeForUsageLocationWorker(file,
|
|
136274
|
-
if (isImportDeclaration(
|
|
136275
|
-
const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(
|
|
136273
|
+
function getModeForUsageLocationWorker(file, usage2, compilerOptions) {
|
|
136274
|
+
if (isImportDeclaration(usage2.parent) || isExportDeclaration(usage2.parent) || isJSDocImportTag(usage2.parent)) {
|
|
136275
|
+
const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(usage2.parent);
|
|
136276
136276
|
if (isTypeOnly) {
|
|
136277
|
-
const override = getResolutionModeOverride(
|
|
136277
|
+
const override = getResolutionModeOverride(usage2.parent.attributes);
|
|
136278
136278
|
if (override) {
|
|
136279
136279
|
return override;
|
|
136280
136280
|
}
|
|
136281
136281
|
}
|
|
136282
136282
|
}
|
|
136283
|
-
if (
|
|
136284
|
-
const override = getResolutionModeOverride(
|
|
136283
|
+
if (usage2.parent.parent && isImportTypeNode(usage2.parent.parent)) {
|
|
136284
|
+
const override = getResolutionModeOverride(usage2.parent.parent.attributes);
|
|
136285
136285
|
if (override) {
|
|
136286
136286
|
return override;
|
|
136287
136287
|
}
|
|
136288
136288
|
}
|
|
136289
136289
|
if (compilerOptions && importSyntaxAffectsModuleResolution(compilerOptions)) {
|
|
136290
|
-
return getEmitSyntaxForUsageLocationWorker(file,
|
|
136290
|
+
return getEmitSyntaxForUsageLocationWorker(file, usage2, compilerOptions);
|
|
136291
136291
|
}
|
|
136292
136292
|
}
|
|
136293
|
-
function getEmitSyntaxForUsageLocationWorker(file,
|
|
136293
|
+
function getEmitSyntaxForUsageLocationWorker(file, usage2, compilerOptions) {
|
|
136294
136294
|
var _a;
|
|
136295
136295
|
if (!compilerOptions) {
|
|
136296
136296
|
return void 0;
|
|
136297
136297
|
}
|
|
136298
|
-
const exprParentParent = (_a = walkUpParenthesizedExpressions(
|
|
136298
|
+
const exprParentParent = (_a = walkUpParenthesizedExpressions(usage2.parent)) == null ? void 0 : _a.parent;
|
|
136299
136299
|
if (exprParentParent && isImportEqualsDeclaration(exprParentParent) || isRequireCall(
|
|
136300
|
-
|
|
136300
|
+
usage2.parent,
|
|
136301
136301
|
/*requireStringLiteralLikeArgument*/
|
|
136302
136302
|
false
|
|
136303
136303
|
)) {
|
|
136304
136304
|
return 1;
|
|
136305
136305
|
}
|
|
136306
|
-
if (isImportCall(walkUpParenthesizedExpressions(
|
|
136306
|
+
if (isImportCall(walkUpParenthesizedExpressions(usage2.parent))) {
|
|
136307
136307
|
return shouldTransformImportCallWorker(file, compilerOptions) ? 1 : 99;
|
|
136308
136308
|
}
|
|
136309
136309
|
const fileEmitMode = getEmitModuleFormatOfFileWorker(file, compilerOptions);
|
|
@@ -139535,11 +139535,11 @@ ${lanes.join("\n")}
|
|
|
139535
139535
|
}
|
|
139536
139536
|
return symlinks;
|
|
139537
139537
|
}
|
|
139538
|
-
function getModeForUsageLocation2(file,
|
|
139539
|
-
return getModeForUsageLocationWorker(file,
|
|
139538
|
+
function getModeForUsageLocation2(file, usage2) {
|
|
139539
|
+
return getModeForUsageLocationWorker(file, usage2, getCompilerOptionsForFile(file));
|
|
139540
139540
|
}
|
|
139541
|
-
function getEmitSyntaxForUsageLocation(file,
|
|
139542
|
-
return getEmitSyntaxForUsageLocationWorker(file,
|
|
139541
|
+
function getEmitSyntaxForUsageLocation(file, usage2) {
|
|
139542
|
+
return getEmitSyntaxForUsageLocationWorker(file, usage2, getCompilerOptionsForFile(file));
|
|
139543
139543
|
}
|
|
139544
139544
|
function getModeForResolutionAtIndex2(file, index) {
|
|
139545
139545
|
return getModeForUsageLocation2(file, getModuleNameStringLiteralAt(file, index));
|
|
@@ -147942,7 +147942,7 @@ ${lanes.join("\n")}
|
|
|
147942
147942
|
if (!resolver.canReuseTypeNode(context, node)) {
|
|
147943
147943
|
return resolver.serializeExistingTypeNode(context, node);
|
|
147944
147944
|
}
|
|
147945
|
-
const specifier =
|
|
147945
|
+
const specifier = rewriteModuleSpecifier22(node, node.argument.literal);
|
|
147946
147946
|
const literal = specifier === node.argument.literal ? reuseNode(context, node.argument.literal) : specifier;
|
|
147947
147947
|
return factory.updateImportTypeNode(
|
|
147948
147948
|
node,
|
|
@@ -148105,7 +148105,7 @@ ${lanes.join("\n")}
|
|
|
148105
148105
|
function getNameForJSDocFunctionParameter(p, index) {
|
|
148106
148106
|
return p.name && isIdentifier(p.name) && p.name.escapedText === "this" ? "this" : getEffectiveDotDotDotForParameter(p) ? `args` : `arg${index}`;
|
|
148107
148107
|
}
|
|
148108
|
-
function
|
|
148108
|
+
function rewriteModuleSpecifier22(parent2, lit) {
|
|
148109
148109
|
const newName = resolver.getModuleSpecifierOverride(context, parent2, lit);
|
|
148110
148110
|
return newName ? setOriginalNode(factory.createStringLiteral(newName), lit) : lit;
|
|
148111
148111
|
}
|
|
@@ -157842,23 +157842,23 @@ interface Symbol {
|
|
|
157842
157842
|
addNewFileToTsconfig(program, changes, oldFile.fileName, targetFile, hostGetCanonicalFileName(host));
|
|
157843
157843
|
}
|
|
157844
157844
|
}
|
|
157845
|
-
function getNewStatementsAndRemoveFromOldFile(oldFile, targetFile,
|
|
157845
|
+
function getNewStatementsAndRemoveFromOldFile(oldFile, targetFile, usage2, changes, toMove, program, host, preferences, importAdderForNewFile, importAdderForOldFile) {
|
|
157846
157846
|
const checker = program.getTypeChecker();
|
|
157847
157847
|
const prologueDirectives = takeWhile(oldFile.statements, isPrologueDirective);
|
|
157848
157848
|
const useEsModuleSyntax = !fileShouldUseJavaScriptRequire(targetFile.fileName, program, host, !!oldFile.commonJsModuleIndicator);
|
|
157849
157849
|
const quotePreference = getQuotePreference(oldFile, preferences);
|
|
157850
|
-
addImportsForMovedSymbols(
|
|
157851
|
-
deleteUnusedOldImports(oldFile, toMove.all,
|
|
157850
|
+
addImportsForMovedSymbols(usage2.oldFileImportsFromTargetFile, targetFile.fileName, importAdderForOldFile, program);
|
|
157851
|
+
deleteUnusedOldImports(oldFile, toMove.all, usage2.unusedImportsFromOldFile, importAdderForOldFile);
|
|
157852
157852
|
importAdderForOldFile.writeFixes(changes, quotePreference);
|
|
157853
157853
|
deleteMovedStatements(oldFile, toMove.ranges, changes);
|
|
157854
|
-
updateImportsInOtherFiles(changes, program, host, oldFile,
|
|
157855
|
-
addExportsInOldFile(oldFile,
|
|
157856
|
-
addTargetFileImports(oldFile,
|
|
157854
|
+
updateImportsInOtherFiles(changes, program, host, oldFile, usage2.movedSymbols, targetFile.fileName, quotePreference);
|
|
157855
|
+
addExportsInOldFile(oldFile, usage2.targetFileImportsFromOldFile, changes, useEsModuleSyntax);
|
|
157856
|
+
addTargetFileImports(oldFile, usage2.oldImportsNeededByTargetFile, usage2.targetFileImportsFromOldFile, checker, program, importAdderForNewFile);
|
|
157857
157857
|
if (!isFullSourceFile(targetFile) && prologueDirectives.length) {
|
|
157858
157858
|
changes.insertStatementsInNewFile(targetFile.fileName, prologueDirectives, oldFile);
|
|
157859
157859
|
}
|
|
157860
157860
|
importAdderForNewFile.writeFixes(changes, quotePreference);
|
|
157861
|
-
const body = addExports(oldFile, toMove.all, arrayFrom(
|
|
157861
|
+
const body = addExports(oldFile, toMove.all, arrayFrom(usage2.oldFileImportsFromTargetFile.keys()), useEsModuleSyntax);
|
|
157862
157862
|
if (isFullSourceFile(targetFile) && targetFile.statements.length > 0) {
|
|
157863
157863
|
moveStatementsToTargetFile(changes, program, body, targetFile, toMove);
|
|
157864
157864
|
} else if (isFullSourceFile(targetFile)) {
|
|
@@ -158277,7 +158277,7 @@ interface Symbol {
|
|
|
158277
158277
|
function createNewFileName(oldFile, program, host, toMove) {
|
|
158278
158278
|
const checker = program.getTypeChecker();
|
|
158279
158279
|
if (toMove) {
|
|
158280
|
-
const
|
|
158280
|
+
const usage2 = getUsageInfo(oldFile, toMove.all, checker);
|
|
158281
158281
|
const currentDirectory = getDirectoryPath(oldFile.fileName);
|
|
158282
158282
|
const extension = extensionFromPath(oldFile.fileName);
|
|
158283
158283
|
const newFileName = combinePaths(
|
|
@@ -158286,7 +158286,7 @@ interface Symbol {
|
|
|
158286
158286
|
// ensures the filename computed below isn't already taken
|
|
158287
158287
|
makeUniqueFilename(
|
|
158288
158288
|
// infers a name for the new file from the symbols being moved
|
|
158289
|
-
inferNewFileName(
|
|
158289
|
+
inferNewFileName(usage2.oldFileImportsFromTargetFile, usage2.movedSymbols),
|
|
158290
158290
|
extension,
|
|
158291
158291
|
currentDirectory,
|
|
158292
158292
|
host
|
|
@@ -158857,12 +158857,12 @@ interface Symbol {
|
|
|
158857
158857
|
});
|
|
158858
158858
|
function doChange4(oldFile, program, toMove, changes, host, context, preferences) {
|
|
158859
158859
|
const checker = program.getTypeChecker();
|
|
158860
|
-
const
|
|
158860
|
+
const usage2 = getUsageInfo(oldFile, toMove.all, checker);
|
|
158861
158861
|
const newFilename = createNewFileName(oldFile, program, host, toMove);
|
|
158862
158862
|
const newSourceFile = createFutureSourceFile(newFilename, oldFile.externalModuleIndicator ? 99 : oldFile.commonJsModuleIndicator ? 1 : void 0, program, host);
|
|
158863
158863
|
const importAdderForOldFile = ts_codefix_exports.createImportAdder(oldFile, context.program, context.preferences, context.host);
|
|
158864
158864
|
const importAdderForNewFile = ts_codefix_exports.createImportAdder(newSourceFile, context.program, context.preferences, context.host);
|
|
158865
|
-
getNewStatementsAndRemoveFromOldFile(oldFile, newSourceFile,
|
|
158865
|
+
getNewStatementsAndRemoveFromOldFile(oldFile, newSourceFile, usage2, changes, toMove, program, host, preferences, importAdderForNewFile, importAdderForOldFile);
|
|
158866
158866
|
addNewFileToTsconfig(program, changes, oldFile.fileName, newFilename, hostGetCanonicalFileName(host));
|
|
158867
158867
|
}
|
|
158868
158868
|
var ts_refactor_addOrRemoveBracesToArrowFunction_exports = {};
|
|
@@ -161046,10 +161046,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
161046
161046
|
const parameters = [];
|
|
161047
161047
|
const callArguments = [];
|
|
161048
161048
|
let writes;
|
|
161049
|
-
usagesInScope.forEach((
|
|
161049
|
+
usagesInScope.forEach((usage2, name) => {
|
|
161050
161050
|
let typeNode;
|
|
161051
161051
|
if (!isJS) {
|
|
161052
|
-
let type = checker.getTypeOfSymbolAtLocation(
|
|
161052
|
+
let type = checker.getTypeOfSymbolAtLocation(usage2.symbol, usage2.node);
|
|
161053
161053
|
type = checker.getBaseTypeOfLiteralType(type);
|
|
161054
161054
|
typeNode = ts_codefix_exports.typeToAutoImportableTypeNode(
|
|
161055
161055
|
checker,
|
|
@@ -161074,8 +161074,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
161074
161074
|
typeNode
|
|
161075
161075
|
);
|
|
161076
161076
|
parameters.push(paramDecl);
|
|
161077
|
-
if (
|
|
161078
|
-
(writes || (writes = [])).push(
|
|
161077
|
+
if (usage2.usage === 2) {
|
|
161078
|
+
(writes || (writes = [])).push(usage2);
|
|
161079
161079
|
}
|
|
161080
161080
|
callArguments.push(factory.createIdentifier(name));
|
|
161081
161081
|
});
|
|
@@ -161959,8 +161959,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
161959
161959
|
forEachChild(node, collectUsages);
|
|
161960
161960
|
}
|
|
161961
161961
|
}
|
|
161962
|
-
function recordUsage(n,
|
|
161963
|
-
const symbolId = recordUsagebySymbol(n,
|
|
161962
|
+
function recordUsage(n, usage2, isTypeNode2) {
|
|
161963
|
+
const symbolId = recordUsagebySymbol(n, usage2, isTypeNode2);
|
|
161964
161964
|
if (symbolId) {
|
|
161965
161965
|
for (let i = 0; i < scopes.length; i++) {
|
|
161966
161966
|
const substitution = substitutionsPerScope[i].get(symbolId);
|
|
@@ -161970,22 +161970,22 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
161970
161970
|
}
|
|
161971
161971
|
}
|
|
161972
161972
|
}
|
|
161973
|
-
function recordUsagebySymbol(identifier,
|
|
161973
|
+
function recordUsagebySymbol(identifier, usage2, isTypeName) {
|
|
161974
161974
|
const symbol = getSymbolReferencedByIdentifier(identifier);
|
|
161975
161975
|
if (!symbol) {
|
|
161976
161976
|
return void 0;
|
|
161977
161977
|
}
|
|
161978
161978
|
const symbolId = getSymbolId(symbol).toString();
|
|
161979
161979
|
const lastUsage = seenUsages.get(symbolId);
|
|
161980
|
-
if (lastUsage && lastUsage >=
|
|
161980
|
+
if (lastUsage && lastUsage >= usage2) {
|
|
161981
161981
|
return symbolId;
|
|
161982
161982
|
}
|
|
161983
|
-
seenUsages.set(symbolId,
|
|
161983
|
+
seenUsages.set(symbolId, usage2);
|
|
161984
161984
|
if (lastUsage) {
|
|
161985
161985
|
for (const perScope of usagesPerScope) {
|
|
161986
161986
|
const prevEntry = perScope.usages.get(identifier.text);
|
|
161987
161987
|
if (prevEntry) {
|
|
161988
|
-
perScope.usages.set(identifier.text, { usage, symbol, node: identifier });
|
|
161988
|
+
perScope.usages.set(identifier.text, { usage: usage2, symbol, node: identifier });
|
|
161989
161989
|
}
|
|
161990
161990
|
}
|
|
161991
161991
|
return symbolId;
|
|
@@ -161998,7 +161998,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
161998
161998
|
if (rangeContainsStartEnd(enclosingTextRange, declInFile.getStart(), declInFile.end)) {
|
|
161999
161999
|
return void 0;
|
|
162000
162000
|
}
|
|
162001
|
-
if (targetRange.facts & 2 &&
|
|
162001
|
+
if (targetRange.facts & 2 && usage2 === 2) {
|
|
162002
162002
|
const diag2 = createDiagnosticForNode(identifier, Messages.cannotExtractRangeThatContainsWritesToReferencesLocatedOutsideOfTheTargetRangeInGenerators);
|
|
162003
162003
|
for (const errors of functionErrorsPerScope) {
|
|
162004
162004
|
errors.push(diag2);
|
|
@@ -162030,7 +162030,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
162030
162030
|
constantErrorsPerScope[i].push(diag2);
|
|
162031
162031
|
}
|
|
162032
162032
|
} else {
|
|
162033
|
-
usagesPerScope[i].usages.set(identifier.text, { usage, symbol, node: identifier });
|
|
162033
|
+
usagesPerScope[i].usages.set(identifier.text, { usage: usage2, symbol, node: identifier });
|
|
162034
162034
|
}
|
|
162035
162035
|
}
|
|
162036
162036
|
}
|
|
@@ -168748,9 +168748,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
168748
168748
|
}
|
|
168749
168749
|
const checker = program.getTypeChecker();
|
|
168750
168750
|
for (const specifier2 of nonTypeOnlySpecifiers) {
|
|
168751
|
-
const isUsedAsValue = ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(specifier2.name, checker, sourceFile, (
|
|
168752
|
-
const symbol = checker.getSymbolAtLocation(
|
|
168753
|
-
return !!symbol && checker.symbolIsValue(symbol) || !isValidTypeOnlyAliasUseSite(
|
|
168751
|
+
const isUsedAsValue = ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(specifier2.name, checker, sourceFile, (usage2) => {
|
|
168752
|
+
const symbol = checker.getSymbolAtLocation(usage2);
|
|
168753
|
+
return !!symbol && checker.symbolIsValue(symbol) || !isValidTypeOnlyAliasUseSite(usage2);
|
|
168754
168754
|
});
|
|
168755
168755
|
if (isUsedAsValue) {
|
|
168756
168756
|
return false;
|
|
@@ -175396,12 +175396,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
175396
175396
|
if (references.length === 0 || !declaration.parameters) {
|
|
175397
175397
|
return void 0;
|
|
175398
175398
|
}
|
|
175399
|
-
const
|
|
175399
|
+
const usage2 = createEmptyUsage();
|
|
175400
175400
|
for (const reference of references) {
|
|
175401
175401
|
cancellationToken.throwIfCancellationRequested();
|
|
175402
|
-
calculateUsageOfNode(reference,
|
|
175402
|
+
calculateUsageOfNode(reference, usage2);
|
|
175403
175403
|
}
|
|
175404
|
-
const calls = [...
|
|
175404
|
+
const calls = [...usage2.constructs || [], ...usage2.calls || []];
|
|
175405
175405
|
return declaration.parameters.map((parameter, parameterIndex) => {
|
|
175406
175406
|
const types = [];
|
|
175407
175407
|
const isRest = isRestParameter(parameter);
|
|
@@ -175431,99 +175431,99 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
175431
175431
|
});
|
|
175432
175432
|
}
|
|
175433
175433
|
function thisParameter() {
|
|
175434
|
-
const
|
|
175434
|
+
const usage2 = createEmptyUsage();
|
|
175435
175435
|
for (const reference of references) {
|
|
175436
175436
|
cancellationToken.throwIfCancellationRequested();
|
|
175437
|
-
calculateUsageOfNode(reference,
|
|
175437
|
+
calculateUsageOfNode(reference, usage2);
|
|
175438
175438
|
}
|
|
175439
|
-
return combineTypes(
|
|
175439
|
+
return combineTypes(usage2.candidateThisTypes || emptyArray);
|
|
175440
175440
|
}
|
|
175441
175441
|
function inferTypesFromReferencesSingle(references2) {
|
|
175442
|
-
const
|
|
175442
|
+
const usage2 = createEmptyUsage();
|
|
175443
175443
|
for (const reference of references2) {
|
|
175444
175444
|
cancellationToken.throwIfCancellationRequested();
|
|
175445
|
-
calculateUsageOfNode(reference,
|
|
175445
|
+
calculateUsageOfNode(reference, usage2);
|
|
175446
175446
|
}
|
|
175447
|
-
return inferTypes(
|
|
175447
|
+
return inferTypes(usage2);
|
|
175448
175448
|
}
|
|
175449
|
-
function calculateUsageOfNode(node,
|
|
175449
|
+
function calculateUsageOfNode(node, usage2) {
|
|
175450
175450
|
while (isRightSideOfQualifiedNameOrPropertyAccess(node)) {
|
|
175451
175451
|
node = node.parent;
|
|
175452
175452
|
}
|
|
175453
175453
|
switch (node.parent.kind) {
|
|
175454
175454
|
case 245:
|
|
175455
|
-
inferTypeFromExpressionStatement(node,
|
|
175455
|
+
inferTypeFromExpressionStatement(node, usage2);
|
|
175456
175456
|
break;
|
|
175457
175457
|
case 226:
|
|
175458
|
-
|
|
175458
|
+
usage2.isNumber = true;
|
|
175459
175459
|
break;
|
|
175460
175460
|
case 225:
|
|
175461
|
-
inferTypeFromPrefixUnaryExpression(node.parent,
|
|
175461
|
+
inferTypeFromPrefixUnaryExpression(node.parent, usage2);
|
|
175462
175462
|
break;
|
|
175463
175463
|
case 227:
|
|
175464
|
-
inferTypeFromBinaryExpression(node, node.parent,
|
|
175464
|
+
inferTypeFromBinaryExpression(node, node.parent, usage2);
|
|
175465
175465
|
break;
|
|
175466
175466
|
case 297:
|
|
175467
175467
|
case 298:
|
|
175468
|
-
inferTypeFromSwitchStatementLabel(node.parent,
|
|
175468
|
+
inferTypeFromSwitchStatementLabel(node.parent, usage2);
|
|
175469
175469
|
break;
|
|
175470
175470
|
case 214:
|
|
175471
175471
|
case 215:
|
|
175472
175472
|
if (node.parent.expression === node) {
|
|
175473
|
-
inferTypeFromCallExpression(node.parent,
|
|
175473
|
+
inferTypeFromCallExpression(node.parent, usage2);
|
|
175474
175474
|
} else {
|
|
175475
|
-
inferTypeFromContextualType(node,
|
|
175475
|
+
inferTypeFromContextualType(node, usage2);
|
|
175476
175476
|
}
|
|
175477
175477
|
break;
|
|
175478
175478
|
case 212:
|
|
175479
|
-
inferTypeFromPropertyAccessExpression(node.parent,
|
|
175479
|
+
inferTypeFromPropertyAccessExpression(node.parent, usage2);
|
|
175480
175480
|
break;
|
|
175481
175481
|
case 213:
|
|
175482
|
-
inferTypeFromPropertyElementExpression(node.parent, node,
|
|
175482
|
+
inferTypeFromPropertyElementExpression(node.parent, node, usage2);
|
|
175483
175483
|
break;
|
|
175484
175484
|
case 304:
|
|
175485
175485
|
case 305:
|
|
175486
|
-
inferTypeFromPropertyAssignment(node.parent,
|
|
175486
|
+
inferTypeFromPropertyAssignment(node.parent, usage2);
|
|
175487
175487
|
break;
|
|
175488
175488
|
case 173:
|
|
175489
|
-
inferTypeFromPropertyDeclaration(node.parent,
|
|
175489
|
+
inferTypeFromPropertyDeclaration(node.parent, usage2);
|
|
175490
175490
|
break;
|
|
175491
175491
|
case 261: {
|
|
175492
175492
|
const { name, initializer } = node.parent;
|
|
175493
175493
|
if (node === name) {
|
|
175494
175494
|
if (initializer) {
|
|
175495
|
-
addCandidateType(
|
|
175495
|
+
addCandidateType(usage2, checker.getTypeAtLocation(initializer));
|
|
175496
175496
|
}
|
|
175497
175497
|
break;
|
|
175498
175498
|
}
|
|
175499
175499
|
}
|
|
175500
175500
|
// falls through
|
|
175501
175501
|
default:
|
|
175502
|
-
return inferTypeFromContextualType(node,
|
|
175502
|
+
return inferTypeFromContextualType(node, usage2);
|
|
175503
175503
|
}
|
|
175504
175504
|
}
|
|
175505
|
-
function inferTypeFromContextualType(node,
|
|
175505
|
+
function inferTypeFromContextualType(node, usage2) {
|
|
175506
175506
|
if (isExpressionNode(node)) {
|
|
175507
|
-
addCandidateType(
|
|
175507
|
+
addCandidateType(usage2, checker.getContextualType(node));
|
|
175508
175508
|
}
|
|
175509
175509
|
}
|
|
175510
|
-
function inferTypeFromExpressionStatement(node,
|
|
175511
|
-
addCandidateType(
|
|
175510
|
+
function inferTypeFromExpressionStatement(node, usage2) {
|
|
175511
|
+
addCandidateType(usage2, isCallExpression(node) ? checker.getVoidType() : checker.getAnyType());
|
|
175512
175512
|
}
|
|
175513
|
-
function inferTypeFromPrefixUnaryExpression(node,
|
|
175513
|
+
function inferTypeFromPrefixUnaryExpression(node, usage2) {
|
|
175514
175514
|
switch (node.operator) {
|
|
175515
175515
|
case 46:
|
|
175516
175516
|
case 47:
|
|
175517
175517
|
case 41:
|
|
175518
175518
|
case 55:
|
|
175519
|
-
|
|
175519
|
+
usage2.isNumber = true;
|
|
175520
175520
|
break;
|
|
175521
175521
|
case 40:
|
|
175522
|
-
|
|
175522
|
+
usage2.isNumberOrString = true;
|
|
175523
175523
|
break;
|
|
175524
175524
|
}
|
|
175525
175525
|
}
|
|
175526
|
-
function inferTypeFromBinaryExpression(node, parent2,
|
|
175526
|
+
function inferTypeFromBinaryExpression(node, parent2, usage2) {
|
|
175527
175527
|
switch (parent2.operatorToken.kind) {
|
|
175528
175528
|
// ExponentiationOperator
|
|
175529
175529
|
case 43:
|
|
@@ -175566,23 +175566,23 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
175566
175566
|
case 34:
|
|
175567
175567
|
const operandType = checker.getTypeAtLocation(parent2.left === node ? parent2.right : parent2.left);
|
|
175568
175568
|
if (operandType.flags & 98304) {
|
|
175569
|
-
addCandidateType(
|
|
175569
|
+
addCandidateType(usage2, operandType);
|
|
175570
175570
|
} else {
|
|
175571
|
-
|
|
175571
|
+
usage2.isNumber = true;
|
|
175572
175572
|
}
|
|
175573
175573
|
break;
|
|
175574
175574
|
case 65:
|
|
175575
175575
|
case 40:
|
|
175576
175576
|
const otherOperandType = checker.getTypeAtLocation(parent2.left === node ? parent2.right : parent2.left);
|
|
175577
175577
|
if (otherOperandType.flags & 98304) {
|
|
175578
|
-
addCandidateType(
|
|
175578
|
+
addCandidateType(usage2, otherOperandType);
|
|
175579
175579
|
} else if (otherOperandType.flags & 67648) {
|
|
175580
|
-
|
|
175580
|
+
usage2.isNumber = true;
|
|
175581
175581
|
} else if (otherOperandType.flags & 12583968) {
|
|
175582
|
-
|
|
175582
|
+
usage2.isString = true;
|
|
175583
175583
|
} else if (otherOperandType.flags & 1) {
|
|
175584
175584
|
} else {
|
|
175585
|
-
|
|
175585
|
+
usage2.isNumberOrString = true;
|
|
175586
175586
|
}
|
|
175587
175587
|
break;
|
|
175588
175588
|
// AssignmentOperators
|
|
@@ -175594,11 +175594,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
175594
175594
|
case 77:
|
|
175595
175595
|
case 78:
|
|
175596
175596
|
case 76:
|
|
175597
|
-
addCandidateType(
|
|
175597
|
+
addCandidateType(usage2, checker.getTypeAtLocation(parent2.left === node ? parent2.right : parent2.left));
|
|
175598
175598
|
break;
|
|
175599
175599
|
case 103:
|
|
175600
175600
|
if (node === parent2.left) {
|
|
175601
|
-
|
|
175601
|
+
usage2.isString = true;
|
|
175602
175602
|
}
|
|
175603
175603
|
break;
|
|
175604
175604
|
// LogicalOperator Or NullishCoalescing
|
|
@@ -175609,7 +175609,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
175609
175609
|
/*excludeCompoundAssignment*/
|
|
175610
175610
|
true
|
|
175611
175611
|
))) {
|
|
175612
|
-
addCandidateType(
|
|
175612
|
+
addCandidateType(usage2, checker.getTypeAtLocation(parent2.right));
|
|
175613
175613
|
}
|
|
175614
175614
|
break;
|
|
175615
175615
|
case 56:
|
|
@@ -175618,10 +175618,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
175618
175618
|
break;
|
|
175619
175619
|
}
|
|
175620
175620
|
}
|
|
175621
|
-
function inferTypeFromSwitchStatementLabel(parent2,
|
|
175622
|
-
addCandidateType(
|
|
175621
|
+
function inferTypeFromSwitchStatementLabel(parent2, usage2) {
|
|
175622
|
+
addCandidateType(usage2, checker.getTypeAtLocation(parent2.parent.parent.expression));
|
|
175623
175623
|
}
|
|
175624
|
-
function inferTypeFromCallExpression(parent2,
|
|
175624
|
+
function inferTypeFromCallExpression(parent2, usage2) {
|
|
175625
175625
|
const call = {
|
|
175626
175626
|
argumentTypes: [],
|
|
175627
175627
|
return_: createEmptyUsage()
|
|
@@ -175633,41 +175633,41 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
175633
175633
|
}
|
|
175634
175634
|
calculateUsageOfNode(parent2, call.return_);
|
|
175635
175635
|
if (parent2.kind === 214) {
|
|
175636
|
-
(
|
|
175636
|
+
(usage2.calls || (usage2.calls = [])).push(call);
|
|
175637
175637
|
} else {
|
|
175638
|
-
(
|
|
175638
|
+
(usage2.constructs || (usage2.constructs = [])).push(call);
|
|
175639
175639
|
}
|
|
175640
175640
|
}
|
|
175641
|
-
function inferTypeFromPropertyAccessExpression(parent2,
|
|
175641
|
+
function inferTypeFromPropertyAccessExpression(parent2, usage2) {
|
|
175642
175642
|
const name = escapeLeadingUnderscores(parent2.name.text);
|
|
175643
|
-
if (!
|
|
175644
|
-
|
|
175643
|
+
if (!usage2.properties) {
|
|
175644
|
+
usage2.properties = /* @__PURE__ */ new Map();
|
|
175645
175645
|
}
|
|
175646
|
-
const propertyUsage =
|
|
175646
|
+
const propertyUsage = usage2.properties.get(name) || createEmptyUsage();
|
|
175647
175647
|
calculateUsageOfNode(parent2, propertyUsage);
|
|
175648
|
-
|
|
175648
|
+
usage2.properties.set(name, propertyUsage);
|
|
175649
175649
|
}
|
|
175650
|
-
function inferTypeFromPropertyElementExpression(parent2, node,
|
|
175650
|
+
function inferTypeFromPropertyElementExpression(parent2, node, usage2) {
|
|
175651
175651
|
if (node === parent2.argumentExpression) {
|
|
175652
|
-
|
|
175652
|
+
usage2.isNumberOrString = true;
|
|
175653
175653
|
return;
|
|
175654
175654
|
} else {
|
|
175655
175655
|
const indexType = checker.getTypeAtLocation(parent2.argumentExpression);
|
|
175656
175656
|
const indexUsage = createEmptyUsage();
|
|
175657
175657
|
calculateUsageOfNode(parent2, indexUsage);
|
|
175658
175658
|
if (indexType.flags & 67648) {
|
|
175659
|
-
|
|
175659
|
+
usage2.numberIndex = indexUsage;
|
|
175660
175660
|
} else {
|
|
175661
|
-
|
|
175661
|
+
usage2.stringIndex = indexUsage;
|
|
175662
175662
|
}
|
|
175663
175663
|
}
|
|
175664
175664
|
}
|
|
175665
|
-
function inferTypeFromPropertyAssignment(assignment,
|
|
175665
|
+
function inferTypeFromPropertyAssignment(assignment, usage2) {
|
|
175666
175666
|
const nodeWithRealType = isVariableDeclaration(assignment.parent.parent) ? assignment.parent.parent : assignment.parent;
|
|
175667
|
-
addCandidateThisType(
|
|
175667
|
+
addCandidateThisType(usage2, checker.getTypeAtLocation(nodeWithRealType));
|
|
175668
175668
|
}
|
|
175669
|
-
function inferTypeFromPropertyDeclaration(declaration,
|
|
175670
|
-
addCandidateThisType(
|
|
175669
|
+
function inferTypeFromPropertyDeclaration(declaration, usage2) {
|
|
175670
|
+
addCandidateThisType(usage2, checker.getTypeAtLocation(declaration.parent));
|
|
175671
175671
|
}
|
|
175672
175672
|
function removeLowPriorityInferences(inferences, priorities) {
|
|
175673
175673
|
const toRemove = [];
|
|
@@ -175681,8 +175681,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
175681
175681
|
}
|
|
175682
175682
|
return inferences.filter((i) => toRemove.every((f) => !f(i)));
|
|
175683
175683
|
}
|
|
175684
|
-
function combineFromUsage(
|
|
175685
|
-
return combineTypes(inferTypes(
|
|
175684
|
+
function combineFromUsage(usage2) {
|
|
175685
|
+
return combineTypes(inferTypes(usage2));
|
|
175686
175686
|
}
|
|
175687
175687
|
function combineTypes(inferences) {
|
|
175688
175688
|
if (!inferences.length) return checker.getAnyType();
|
|
@@ -175777,26 +175777,26 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
175777
175777
|
indexInfos
|
|
175778
175778
|
);
|
|
175779
175779
|
}
|
|
175780
|
-
function inferTypes(
|
|
175780
|
+
function inferTypes(usage2) {
|
|
175781
175781
|
var _a, _b, _c;
|
|
175782
175782
|
const types = [];
|
|
175783
|
-
if (
|
|
175783
|
+
if (usage2.isNumber) {
|
|
175784
175784
|
types.push(checker.getNumberType());
|
|
175785
175785
|
}
|
|
175786
|
-
if (
|
|
175786
|
+
if (usage2.isString) {
|
|
175787
175787
|
types.push(checker.getStringType());
|
|
175788
175788
|
}
|
|
175789
|
-
if (
|
|
175789
|
+
if (usage2.isNumberOrString) {
|
|
175790
175790
|
types.push(checker.getUnionType([checker.getStringType(), checker.getNumberType()]));
|
|
175791
175791
|
}
|
|
175792
|
-
if (
|
|
175793
|
-
types.push(checker.createArrayType(combineFromUsage(
|
|
175792
|
+
if (usage2.numberIndex) {
|
|
175793
|
+
types.push(checker.createArrayType(combineFromUsage(usage2.numberIndex)));
|
|
175794
175794
|
}
|
|
175795
|
-
if (((_a =
|
|
175796
|
-
types.push(inferStructuralType(
|
|
175795
|
+
if (((_a = usage2.properties) == null ? void 0 : _a.size) || ((_b = usage2.constructs) == null ? void 0 : _b.length) || usage2.stringIndex) {
|
|
175796
|
+
types.push(inferStructuralType(usage2));
|
|
175797
175797
|
}
|
|
175798
|
-
const candidateTypes = (
|
|
175799
|
-
const callsType = ((_c =
|
|
175798
|
+
const candidateTypes = (usage2.candidateTypes || []).map((t) => checker.getBaseTypeOfLiteralType(t));
|
|
175799
|
+
const callsType = ((_c = usage2.calls) == null ? void 0 : _c.length) ? inferStructuralType(usage2) : void 0;
|
|
175800
175800
|
if (callsType && candidateTypes) {
|
|
175801
175801
|
types.push(checker.getUnionType(
|
|
175802
175802
|
[callsType, ...candidateTypes],
|
|
@@ -175811,23 +175811,23 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
175811
175811
|
types.push(...candidateTypes);
|
|
175812
175812
|
}
|
|
175813
175813
|
}
|
|
175814
|
-
types.push(...inferNamedTypesFromProperties(
|
|
175814
|
+
types.push(...inferNamedTypesFromProperties(usage2));
|
|
175815
175815
|
return types;
|
|
175816
175816
|
}
|
|
175817
|
-
function inferStructuralType(
|
|
175817
|
+
function inferStructuralType(usage2) {
|
|
175818
175818
|
const members = /* @__PURE__ */ new Map();
|
|
175819
|
-
if (
|
|
175820
|
-
|
|
175819
|
+
if (usage2.properties) {
|
|
175820
|
+
usage2.properties.forEach((u, name) => {
|
|
175821
175821
|
const symbol = checker.createSymbol(4, name);
|
|
175822
175822
|
symbol.links.type = combineFromUsage(u);
|
|
175823
175823
|
members.set(name, symbol);
|
|
175824
175824
|
});
|
|
175825
175825
|
}
|
|
175826
|
-
const callSignatures =
|
|
175827
|
-
const constructSignatures =
|
|
175828
|
-
const indexInfos =
|
|
175826
|
+
const callSignatures = usage2.calls ? [getSignatureFromCalls(usage2.calls)] : [];
|
|
175827
|
+
const constructSignatures = usage2.constructs ? [getSignatureFromCalls(usage2.constructs)] : [];
|
|
175828
|
+
const indexInfos = usage2.stringIndex ? [checker.createIndexInfo(
|
|
175829
175829
|
checker.getStringType(),
|
|
175830
|
-
combineFromUsage(
|
|
175830
|
+
combineFromUsage(usage2.stringIndex),
|
|
175831
175831
|
/*isReadonly*/
|
|
175832
175832
|
false
|
|
175833
175833
|
)] : [];
|
|
@@ -175840,17 +175840,17 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
175840
175840
|
indexInfos
|
|
175841
175841
|
);
|
|
175842
175842
|
}
|
|
175843
|
-
function inferNamedTypesFromProperties(
|
|
175844
|
-
if (!
|
|
175845
|
-
const types = builtins.filter((t) => allPropertiesAreAssignableToUsage(t,
|
|
175843
|
+
function inferNamedTypesFromProperties(usage2) {
|
|
175844
|
+
if (!usage2.properties || !usage2.properties.size) return [];
|
|
175845
|
+
const types = builtins.filter((t) => allPropertiesAreAssignableToUsage(t, usage2));
|
|
175846
175846
|
if (0 < types.length && types.length < 3) {
|
|
175847
|
-
return types.map((t) => inferInstantiationFromUsage(t,
|
|
175847
|
+
return types.map((t) => inferInstantiationFromUsage(t, usage2));
|
|
175848
175848
|
}
|
|
175849
175849
|
return [];
|
|
175850
175850
|
}
|
|
175851
|
-
function allPropertiesAreAssignableToUsage(type,
|
|
175852
|
-
if (!
|
|
175853
|
-
return !forEachEntry(
|
|
175851
|
+
function allPropertiesAreAssignableToUsage(type, usage2) {
|
|
175852
|
+
if (!usage2.properties) return false;
|
|
175853
|
+
return !forEachEntry(usage2.properties, (propUsage, name) => {
|
|
175854
175854
|
const source = checker.getTypeOfPropertyOfType(type, name);
|
|
175855
175855
|
if (!source) {
|
|
175856
175856
|
return true;
|
|
@@ -175867,15 +175867,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
175867
175867
|
}
|
|
175868
175868
|
});
|
|
175869
175869
|
}
|
|
175870
|
-
function inferInstantiationFromUsage(type,
|
|
175871
|
-
if (!(getObjectFlags(type) & 4) || !
|
|
175870
|
+
function inferInstantiationFromUsage(type, usage2) {
|
|
175871
|
+
if (!(getObjectFlags(type) & 4) || !usage2.properties) {
|
|
175872
175872
|
return type;
|
|
175873
175873
|
}
|
|
175874
175874
|
const generic = type.target;
|
|
175875
175875
|
const singleTypeParameter = singleOrUndefined(generic.typeParameters);
|
|
175876
175876
|
if (!singleTypeParameter) return type;
|
|
175877
175877
|
const types = [];
|
|
175878
|
-
|
|
175878
|
+
usage2.properties.forEach((propUsage, name) => {
|
|
175879
175879
|
const genericPropertyType = checker.getTypeOfPropertyOfType(generic, name);
|
|
175880
175880
|
Debug.assert(!!genericPropertyType, "generic should have all the properties of its reference.");
|
|
175881
175881
|
types.push(...inferTypeParameters(genericPropertyType, combineFromUsage(propUsage), singleTypeParameter));
|
|
@@ -175976,14 +175976,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
175976
175976
|
/* None */
|
|
175977
175977
|
);
|
|
175978
175978
|
}
|
|
175979
|
-
function addCandidateType(
|
|
175979
|
+
function addCandidateType(usage2, type) {
|
|
175980
175980
|
if (type && !(type.flags & 1) && !(type.flags & 262144)) {
|
|
175981
|
-
(
|
|
175981
|
+
(usage2.candidateTypes || (usage2.candidateTypes = [])).push(type);
|
|
175982
175982
|
}
|
|
175983
175983
|
}
|
|
175984
|
-
function addCandidateThisType(
|
|
175984
|
+
function addCandidateThisType(usage2, type) {
|
|
175985
175985
|
if (type && !(type.flags & 1) && !(type.flags & 262144)) {
|
|
175986
|
-
(
|
|
175986
|
+
(usage2.candidateThisTypes || (usage2.candidateThisTypes = [])).push(type);
|
|
175987
175987
|
}
|
|
175988
175988
|
}
|
|
175989
175989
|
}
|
|
@@ -196237,10 +196237,10 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
196237
196237
|
Debug.assertIsDefined(originalProgram, "no original program found");
|
|
196238
196238
|
const originalProgramTypeChecker = originalProgram.getTypeChecker();
|
|
196239
196239
|
const usageInfoRange = getUsageInfoRangeForPasteEdits(copiedFrom);
|
|
196240
|
-
const
|
|
196240
|
+
const usage2 = getUsageInfo(copiedFrom.file, statements, originalProgramTypeChecker, getExistingLocals(updatedFile, statements, originalProgramTypeChecker), usageInfoRange);
|
|
196241
196241
|
const useEsModuleSyntax = !fileShouldUseJavaScriptRequire(targetFile.fileName, originalProgram, host, !!copiedFrom.file.commonJsModuleIndicator);
|
|
196242
|
-
addExportsInOldFile(copiedFrom.file,
|
|
196243
|
-
addTargetFileImports(copiedFrom.file,
|
|
196242
|
+
addExportsInOldFile(copiedFrom.file, usage2.targetFileImportsFromOldFile, changes, useEsModuleSyntax);
|
|
196243
|
+
addTargetFileImports(copiedFrom.file, usage2.oldImportsNeededByTargetFile, usage2.targetFileImportsFromOldFile, originalProgramTypeChecker, updatedProgram, importAdder);
|
|
196244
196244
|
} else {
|
|
196245
196245
|
const context = {
|
|
196246
196246
|
sourceFile: updatedFile,
|
|
@@ -198310,7 +198310,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
198310
198310
|
returnTrue: () => returnTrue,
|
|
198311
198311
|
returnUndefined: () => returnUndefined,
|
|
198312
198312
|
returnsPromise: () => returnsPromise,
|
|
198313
|
-
rewriteModuleSpecifier: () =>
|
|
198313
|
+
rewriteModuleSpecifier: () => rewriteModuleSpecifier2,
|
|
198314
198314
|
sameFlatMap: () => sameFlatMap,
|
|
198315
198315
|
sameMap: () => sameMap,
|
|
198316
198316
|
sameMapping: () => sameMapping,
|
|
@@ -216125,9 +216125,9 @@ var require_dist = __commonJS({
|
|
|
216125
216125
|
}
|
|
216126
216126
|
});
|
|
216127
216127
|
|
|
216128
|
-
// ../../node_modules/.pnpm/tinyglobby@0.2.
|
|
216128
|
+
// ../../node_modules/.pnpm/tinyglobby@0.2.17/node_modules/tinyglobby/dist/index.cjs
|
|
216129
216129
|
var require_dist2 = __commonJS({
|
|
216130
|
-
"../../node_modules/.pnpm/tinyglobby@0.2.
|
|
216130
|
+
"../../node_modules/.pnpm/tinyglobby@0.2.17/node_modules/tinyglobby/dist/index.cjs"(exports) {
|
|
216131
216131
|
"use strict";
|
|
216132
216132
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
216133
216133
|
var __create2 = Object.create;
|
|
@@ -216155,9 +216155,10 @@ var require_dist2 = __commonJS({
|
|
|
216155
216155
|
var url = __require("url");
|
|
216156
216156
|
var fdir = require_dist();
|
|
216157
216157
|
var picomatch = require_picomatch2();
|
|
216158
|
-
picomatch = __toESM2(picomatch);
|
|
216158
|
+
picomatch = __toESM2(picomatch, 1);
|
|
216159
216159
|
var isReadonlyArray = Array.isArray;
|
|
216160
216160
|
var BACKSLASHES = /\\/g;
|
|
216161
|
+
var DRIVE_RELATIVE_PATH = /^[A-Za-z]:$/;
|
|
216161
216162
|
var isWin = process.platform === "win32";
|
|
216162
216163
|
var ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
|
|
216163
216164
|
function getPartialMatcher(patterns, options = {}) {
|
|
@@ -216223,24 +216224,27 @@ var require_dist2 = __commonJS({
|
|
|
216223
216224
|
return p[p.length - 1] === "/" && result !== "" ? `${result}/` : result || ".";
|
|
216224
216225
|
};
|
|
216225
216226
|
}
|
|
216227
|
+
function ensureNonDriveRelativePath(path$1) {
|
|
216228
|
+
return path$1.replace(DRIVE_RELATIVE_PATH, (match) => `${match}/`);
|
|
216229
|
+
}
|
|
216226
216230
|
var splitPatternOptions = { parts: true };
|
|
216227
|
-
function splitPattern(path$
|
|
216231
|
+
function splitPattern(path$2) {
|
|
216228
216232
|
var _result$parts;
|
|
216229
|
-
const result = picomatch.default.scan(path$
|
|
216230
|
-
return ((_result$parts = result.parts) === null || _result$parts === void 0 ? void 0 : _result$parts.length) ? result.parts : [path$
|
|
216233
|
+
const result = picomatch.default.scan(path$2, splitPatternOptions);
|
|
216234
|
+
return ((_result$parts = result.parts) === null || _result$parts === void 0 ? void 0 : _result$parts.length) ? result.parts : [path$2];
|
|
216231
216235
|
}
|
|
216232
216236
|
var ESCAPED_WIN32_BACKSLASHES = /\\(?![()[\]{}!+@])/g;
|
|
216233
|
-
function convertPosixPathToPattern(path$
|
|
216234
|
-
return escapePosixPath(path$
|
|
216237
|
+
function convertPosixPathToPattern(path$3) {
|
|
216238
|
+
return escapePosixPath(path$3);
|
|
216235
216239
|
}
|
|
216236
|
-
function convertWin32PathToPattern(path$
|
|
216237
|
-
return escapeWin32Path(path$
|
|
216240
|
+
function convertWin32PathToPattern(path$4) {
|
|
216241
|
+
return escapeWin32Path(path$4).replace(ESCAPED_WIN32_BACKSLASHES, "/");
|
|
216238
216242
|
}
|
|
216239
216243
|
var convertPathToPattern = isWin ? convertWin32PathToPattern : convertPosixPathToPattern;
|
|
216240
216244
|
var POSIX_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g;
|
|
216241
216245
|
var WIN32_UNESCAPED_GLOB_SYMBOLS = /(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g;
|
|
216242
|
-
var escapePosixPath = (path$
|
|
216243
|
-
var escapeWin32Path = (path$
|
|
216246
|
+
var escapePosixPath = (path$5) => path$5.replace(POSIX_UNESCAPED_GLOB_SYMBOLS, "\\$&");
|
|
216247
|
+
var escapeWin32Path = (path$6) => path$6.replace(WIN32_UNESCAPED_GLOB_SYMBOLS, "\\$&");
|
|
216244
216248
|
var escapePath = isWin ? escapeWin32Path : escapePosixPath;
|
|
216245
216249
|
function isDynamicPattern(pattern, options) {
|
|
216246
216250
|
if ((options === null || options === void 0 ? void 0 : options.caseSensitiveMatch) === false) return true;
|
|
@@ -216275,7 +216279,7 @@ var require_dist2 = __commonJS({
|
|
|
216275
216279
|
}
|
|
216276
216280
|
const potentialRoot = path.posix.join(cwd, parentDir.slice(i * 3));
|
|
216277
216281
|
if (potentialRoot[0] !== "." && props.root.length > potentialRoot.length) {
|
|
216278
|
-
props.root = potentialRoot;
|
|
216282
|
+
props.root = ensureNonDriveRelativePath(potentialRoot);
|
|
216279
216283
|
props.depthOffset = -n + i;
|
|
216280
216284
|
}
|
|
216281
216285
|
}
|
|
@@ -216295,7 +216299,7 @@ var require_dist2 = __commonJS({
|
|
|
216295
216299
|
}
|
|
216296
216300
|
props.depthOffset = newCommonPath.length;
|
|
216297
216301
|
props.commonPath = newCommonPath;
|
|
216298
|
-
props.root = newCommonPath.length > 0 ? path.posix.join(cwd, ...newCommonPath) : cwd;
|
|
216302
|
+
props.root = ensureNonDriveRelativePath(newCommonPath.length > 0 ? path.posix.join(cwd, ...newCommonPath) : cwd);
|
|
216299
216303
|
}
|
|
216300
216304
|
return result;
|
|
216301
216305
|
}
|
|
@@ -216384,18 +216388,15 @@ var require_dist2 = __commonJS({
|
|
|
216384
216388
|
}
|
|
216385
216389
|
var defaultOptions = {
|
|
216386
216390
|
caseSensitiveMatch: true,
|
|
216387
|
-
cwd: process.cwd(),
|
|
216388
216391
|
debug: !!process.env.TINYGLOBBY_DEBUG,
|
|
216389
216392
|
expandDirectories: true,
|
|
216390
216393
|
followSymbolicLinks: true,
|
|
216391
216394
|
onlyFiles: true
|
|
216392
216395
|
};
|
|
216393
216396
|
function getOptions(options) {
|
|
216394
|
-
const opts = {
|
|
216395
|
-
|
|
216396
|
-
|
|
216397
|
-
};
|
|
216398
|
-
opts.cwd = (opts.cwd instanceof URL ? (0, url.fileURLToPath)(opts.cwd) : (0, path.resolve)(opts.cwd)).replace(BACKSLASHES, "/");
|
|
216397
|
+
const opts = Object.assign({}, options);
|
|
216398
|
+
for (const key in defaultOptions) if (opts[key] === void 0) Object.assign(opts, { [key]: defaultOptions[key] });
|
|
216399
|
+
opts.cwd = (opts.cwd instanceof URL ? (0, url.fileURLToPath)(opts.cwd) : (0, path.resolve)(opts.cwd || process.cwd())).replace(BACKSLASHES, "/");
|
|
216399
216400
|
opts.ignore = ensureStringArray(opts.ignore);
|
|
216400
216401
|
opts.fs && (opts.fs = {
|
|
216401
216402
|
readdir: opts.fs.readdir || fs.readdir,
|
|
@@ -220650,7 +220651,7 @@ var require_ts_morph = __commonJS({
|
|
|
220650
220651
|
const nameNode = node.getNameNode();
|
|
220651
220652
|
if (nameNode == null)
|
|
220652
220653
|
return false;
|
|
220653
|
-
if (
|
|
220654
|
+
if (Node3.isArrayBindingPattern(nameNode) || Node3.isObjectBindingPattern(nameNode))
|
|
220654
220655
|
return nameNode.getElements().some((element) => nodeHasName(element, name));
|
|
220655
220656
|
const nodeName = node.getName != null ? node.getName() : nameNode.getText();
|
|
220656
220657
|
return nodeName === name;
|
|
@@ -221080,7 +221081,7 @@ var require_ts_morph = __commonJS({
|
|
|
221080
221081
|
}
|
|
221081
221082
|
function checkNodeIsAmbient(node) {
|
|
221082
221083
|
const isThisAmbient = (node.getCombinedModifierFlags() & common.ts.ModifierFlags.Ambient) === common.ts.ModifierFlags.Ambient;
|
|
221083
|
-
return isThisAmbient ||
|
|
221084
|
+
return isThisAmbient || Node3.isInterfaceDeclaration(node) || Node3.isTypeAliasDeclaration(node);
|
|
221084
221085
|
}
|
|
221085
221086
|
function isStringKind(kind) {
|
|
221086
221087
|
switch (kind) {
|
|
@@ -221481,15 +221482,15 @@ var require_ts_morph = __commonJS({
|
|
|
221481
221482
|
#getSourceFileForLiteral(literal) {
|
|
221482
221483
|
const parent = literal.getParentOrThrow();
|
|
221483
221484
|
const grandParent = parent.getParent();
|
|
221484
|
-
if (
|
|
221485
|
+
if (Node3.isImportDeclaration(parent) || Node3.isExportDeclaration(parent))
|
|
221485
221486
|
return parent.getModuleSpecifierSourceFile();
|
|
221486
|
-
else if (grandParent != null &&
|
|
221487
|
+
else if (grandParent != null && Node3.isImportEqualsDeclaration(grandParent))
|
|
221487
221488
|
return grandParent.getExternalModuleReferenceSourceFile();
|
|
221488
|
-
else if (grandParent != null &&
|
|
221489
|
+
else if (grandParent != null && Node3.isImportTypeNode(grandParent)) {
|
|
221489
221490
|
const importTypeSymbol = grandParent.getSymbol();
|
|
221490
221491
|
if (importTypeSymbol != null)
|
|
221491
221492
|
return ModuleUtils.getReferencedSourceFileFromSymbol(importTypeSymbol);
|
|
221492
|
-
} else if (
|
|
221493
|
+
} else if (Node3.isCallExpression(parent)) {
|
|
221493
221494
|
const literalSymbol = literal.getSymbol();
|
|
221494
221495
|
if (literalSymbol != null)
|
|
221495
221496
|
return ModuleUtils.getReferencedSourceFileFromSymbol(literalSymbol);
|
|
@@ -221581,16 +221582,16 @@ var require_ts_morph = __commonJS({
|
|
|
221581
221582
|
FormattingKind2[FormattingKind2["None"] = 3] = "None";
|
|
221582
221583
|
})(FormattingKind || (FormattingKind = {}));
|
|
221583
221584
|
function getClassMemberFormatting(parent, member) {
|
|
221584
|
-
if (
|
|
221585
|
+
if (Node3.isAmbientable(parent) && parent.isAmbient())
|
|
221585
221586
|
return FormattingKind.Newline;
|
|
221586
221587
|
if (hasBody$1(member))
|
|
221587
221588
|
return FormattingKind.Blankline;
|
|
221588
221589
|
return FormattingKind.Newline;
|
|
221589
221590
|
}
|
|
221590
221591
|
function hasBody$1(node) {
|
|
221591
|
-
if (
|
|
221592
|
+
if (Node3.isBodyable(node) && node.getBody() != null)
|
|
221592
221593
|
return true;
|
|
221593
|
-
if (
|
|
221594
|
+
if (Node3.isBodied(node))
|
|
221594
221595
|
return true;
|
|
221595
221596
|
return false;
|
|
221596
221597
|
}
|
|
@@ -221612,11 +221613,11 @@ var require_ts_morph = __commonJS({
|
|
|
221612
221613
|
return FormattingKind.Newline;
|
|
221613
221614
|
}
|
|
221614
221615
|
function hasBody(node) {
|
|
221615
|
-
if (
|
|
221616
|
+
if (Node3.isBodyable(node) && node.hasBody())
|
|
221616
221617
|
return true;
|
|
221617
|
-
if (
|
|
221618
|
+
if (Node3.isBodied(node))
|
|
221618
221619
|
return true;
|
|
221619
|
-
return
|
|
221620
|
+
return Node3.isInterfaceDeclaration(node) || Node3.isClassDeclaration(node) || Node3.isEnumDeclaration(node);
|
|
221620
221621
|
}
|
|
221621
221622
|
function getStatementedNodeChildFormatting(parent, member) {
|
|
221622
221623
|
if (hasBody(member))
|
|
@@ -221627,9 +221628,9 @@ var require_ts_morph = __commonJS({
|
|
|
221627
221628
|
return FormattingKind.Newline;
|
|
221628
221629
|
}
|
|
221629
221630
|
function getGeneralFormatting(parent, child) {
|
|
221630
|
-
if (
|
|
221631
|
+
if (Node3.isClassDeclaration(parent))
|
|
221631
221632
|
return getClassMemberFormatting(parent, child);
|
|
221632
|
-
if (
|
|
221633
|
+
if (Node3.isInterfaceDeclaration(parent))
|
|
221633
221634
|
return getInterfaceMemberFormatting();
|
|
221634
221635
|
return getStatementedNodeChildFormatting(parent, child);
|
|
221635
221636
|
}
|
|
@@ -221803,9 +221804,9 @@ var require_ts_morph = __commonJS({
|
|
|
221803
221804
|
function getInsertPosFromIndex(index, syntaxList, children) {
|
|
221804
221805
|
if (index === 0) {
|
|
221805
221806
|
const parent = syntaxList.getParentOrThrow();
|
|
221806
|
-
if (
|
|
221807
|
+
if (Node3.isSourceFile(parent))
|
|
221807
221808
|
return 0;
|
|
221808
|
-
else if (
|
|
221809
|
+
else if (Node3.isCaseClause(parent) || Node3.isDefaultClause(parent)) {
|
|
221809
221810
|
const colonToken = parent.getFirstChildByKindOrThrow(common.SyntaxKind.ColonToken);
|
|
221810
221811
|
return colonToken.getEnd();
|
|
221811
221812
|
}
|
|
@@ -221822,9 +221823,9 @@ var require_ts_morph = __commonJS({
|
|
|
221822
221823
|
function getEndPosFromIndex(index, parent, children, fullText) {
|
|
221823
221824
|
let endPos;
|
|
221824
221825
|
if (index === children.length) {
|
|
221825
|
-
if (
|
|
221826
|
+
if (Node3.isSourceFile(parent))
|
|
221826
221827
|
endPos = parent.getEnd();
|
|
221827
|
-
else if (
|
|
221828
|
+
else if (Node3.isCaseClause(parent) || Node3.isDefaultClause(parent))
|
|
221828
221829
|
endPos = parent.getEnd();
|
|
221829
221830
|
else {
|
|
221830
221831
|
const parentContainer = getParentContainerOrThrow(parent);
|
|
@@ -221840,14 +221841,14 @@ var require_ts_morph = __commonJS({
|
|
|
221840
221841
|
return getPosAtStartOfLineOrNonWhitespace(fullText, endPos);
|
|
221841
221842
|
}
|
|
221842
221843
|
function getParentContainerOrThrow(parent) {
|
|
221843
|
-
if (
|
|
221844
|
+
if (Node3.isModuleDeclaration(parent)) {
|
|
221844
221845
|
const innerBody = parent._getInnerBody();
|
|
221845
221846
|
if (innerBody == null)
|
|
221846
221847
|
throw new common.errors.InvalidOperationError("This operation requires the module to have a body.");
|
|
221847
221848
|
return innerBody;
|
|
221848
|
-
} else if (
|
|
221849
|
+
} else if (Node3.isBodied(parent))
|
|
221849
221850
|
return parent.getBody();
|
|
221850
|
-
else if (
|
|
221851
|
+
else if (Node3.isBodyable(parent))
|
|
221851
221852
|
return parent.getBodyOrThrow();
|
|
221852
221853
|
else
|
|
221853
221854
|
return parent;
|
|
@@ -221894,7 +221895,7 @@ var require_ts_morph = __commonJS({
|
|
|
221894
221895
|
const result = [];
|
|
221895
221896
|
for (let i = 0; i < newLength; i++) {
|
|
221896
221897
|
const currentChild = newChildren[index + i];
|
|
221897
|
-
if (allowCommentNodes || !
|
|
221898
|
+
if (allowCommentNodes || !Node3.isCommentNode(currentChild))
|
|
221898
221899
|
result.push(currentChild);
|
|
221899
221900
|
}
|
|
221900
221901
|
return result;
|
|
@@ -222347,7 +222348,7 @@ var require_ts_morph = __commonJS({
|
|
|
222347
222348
|
this.#handler = handler;
|
|
222348
222349
|
}
|
|
222349
222350
|
handleNode(currentNode, newNode, newSourceFile) {
|
|
222350
|
-
if (!
|
|
222351
|
+
if (!Node3.isSourceFile(currentNode))
|
|
222351
222352
|
throw new common.errors.InvalidOperationError(`Can only use a TryOrForgetNodeHandler with a source file.`);
|
|
222352
222353
|
try {
|
|
222353
222354
|
this.#handler.handleNode(currentNode, newNode, newSourceFile);
|
|
@@ -222503,7 +222504,7 @@ var require_ts_morph = __commonJS({
|
|
|
222503
222504
|
const lowerIndex = Math.min(newIndex, oldIndex);
|
|
222504
222505
|
const upperIndex = Math.max(newIndex, oldIndex);
|
|
222505
222506
|
const childrenInNewOrder = getChildrenInNewOrder();
|
|
222506
|
-
const isParentSourceFile =
|
|
222507
|
+
const isParentSourceFile = Node3.isSourceFile(parent.getParentOrThrow());
|
|
222507
222508
|
let finalText = "";
|
|
222508
222509
|
fillPrefixText();
|
|
222509
222510
|
fillTextForIndex(lowerIndex);
|
|
@@ -222830,14 +222831,14 @@ var require_ts_morph = __commonJS({
|
|
|
222830
222831
|
const bodyNode = getBodyNodeOrThrow();
|
|
222831
222832
|
return [bodyNode.getStart() + 1, bodyNode.getEnd() - 1];
|
|
222832
222833
|
function getBodyNodeOrThrow() {
|
|
222833
|
-
if (
|
|
222834
|
+
if (Node3.isModuleDeclaration(node)) {
|
|
222834
222835
|
const bodyNode2 = node._getInnerBody();
|
|
222835
222836
|
if (bodyNode2 == null)
|
|
222836
222837
|
throw new common.errors.InvalidOperationError("This operation requires the module to have a body.");
|
|
222837
222838
|
return bodyNode2;
|
|
222838
|
-
} else if (
|
|
222839
|
+
} else if (Node3.isBodied(node))
|
|
222839
222840
|
return node.getBody();
|
|
222840
|
-
else if (
|
|
222841
|
+
else if (Node3.isBodyable(node))
|
|
222841
222842
|
return node.getBodyOrThrow();
|
|
222842
222843
|
else
|
|
222843
222844
|
common.errors.throwNotImplementedForSyntaxKindError(node.getKind(), node);
|
|
@@ -223012,14 +223013,14 @@ Path: ` + sourceFile.getFilePath() + "\nText: " + JSON.stringify(textManipulator
|
|
|
223012
223013
|
}
|
|
223013
223014
|
function getPreviousNonCommentNode() {
|
|
223014
223015
|
for (let i = insertIndex - 1; i >= 0; i--) {
|
|
223015
|
-
if (!
|
|
223016
|
+
if (!Node3.isCommentNode(currentNodes[i]))
|
|
223016
223017
|
return currentNodes[i];
|
|
223017
223018
|
}
|
|
223018
223019
|
return void 0;
|
|
223019
223020
|
}
|
|
223020
223021
|
function getNextNonCommentNode() {
|
|
223021
223022
|
for (let i = insertIndex; i < currentNodes.length; i++) {
|
|
223022
|
-
if (!
|
|
223023
|
+
if (!Node3.isCommentNode(currentNodes[i]))
|
|
223023
223024
|
return currentNodes[i];
|
|
223024
223025
|
}
|
|
223025
223026
|
return void 0;
|
|
@@ -223071,7 +223072,7 @@ Path: ` + sourceFile.getFilePath() + "\nText: " + JSON.stringify(textManipulator
|
|
|
223071
223072
|
function getChild(child) {
|
|
223072
223073
|
if (child == null)
|
|
223073
223074
|
return child;
|
|
223074
|
-
else if (
|
|
223075
|
+
else if (Node3.isOverloadable(child))
|
|
223075
223076
|
return child.getImplementation() || child;
|
|
223076
223077
|
else
|
|
223077
223078
|
return child;
|
|
@@ -223102,7 +223103,7 @@ Path: ` + sourceFile.getFilePath() + "\nText: " + JSON.stringify(textManipulator
|
|
|
223102
223103
|
let count = 0;
|
|
223103
223104
|
for (let i = index - 1; i >= 0; i--) {
|
|
223104
223105
|
const node = startChildren[i];
|
|
223105
|
-
if (
|
|
223106
|
+
if (Node3.isCommentNode(node)) {
|
|
223106
223107
|
commentCount++;
|
|
223107
223108
|
if (node.getText().startsWith("/**"))
|
|
223108
223109
|
count = commentCount;
|
|
@@ -223172,12 +223173,12 @@ Path: ` + sourceFile.getFilePath() + "\nText: " + JSON.stringify(textManipulator
|
|
|
223172
223173
|
}));
|
|
223173
223174
|
}
|
|
223174
223175
|
function removeClassMember(classMember) {
|
|
223175
|
-
if (
|
|
223176
|
+
if (Node3.isOverloadable(classMember)) {
|
|
223176
223177
|
if (classMember.isImplementation())
|
|
223177
223178
|
removeClassMembers([...classMember.getOverloads(), classMember]);
|
|
223178
223179
|
else {
|
|
223179
223180
|
const parent = classMember.getParentOrThrow();
|
|
223180
|
-
if (
|
|
223181
|
+
if (Node3.isAmbientable(parent) && parent.isAmbient())
|
|
223181
223182
|
removeClassMembers([classMember]);
|
|
223182
223183
|
else
|
|
223183
223184
|
removeChildren({ children: [classMember], removeFollowingSpaces: true, removeFollowingNewLines: true });
|
|
@@ -223498,7 +223499,7 @@ Path: ` + sourceFile.getFilePath() + "\nText: " + JSON.stringify(textManipulator
|
|
|
223498
223499
|
return this.compilerObject.kind;
|
|
223499
223500
|
}
|
|
223500
223501
|
};
|
|
223501
|
-
var
|
|
223502
|
+
var Node3 = class _Node {
|
|
223502
223503
|
#compilerNode;
|
|
223503
223504
|
#forgottenText;
|
|
223504
223505
|
#childStringRanges;
|
|
@@ -226197,7 +226198,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
226197
226198
|
return condition == null ? void 0 : ((c) => condition(thisNode._getNodeFromCompilerNode(c)));
|
|
226198
226199
|
}
|
|
226199
226200
|
function insertWhiteSpaceTextAtPos(node, insertPos, textOrWriterFunction, methodName) {
|
|
226200
|
-
const parent =
|
|
226201
|
+
const parent = Node3.isSourceFile(node) ? node.getChildSyntaxListOrThrow() : node.getParentSyntaxList() || node.getParentOrThrow();
|
|
226201
226202
|
const newText = getTextFromStringOrWriter(node._getWriterWithQueuedIndentation(), textOrWriterFunction);
|
|
226202
226203
|
if (!/^[\s\r\n]*$/.test(newText))
|
|
226203
226204
|
throw new common.errors.InvalidOperationError(`Cannot insert non-whitespace into ${methodName}.`);
|
|
@@ -226240,7 +226241,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
226240
226241
|
Scope["Protected"] = "protected";
|
|
226241
226242
|
Scope["Private"] = "private";
|
|
226242
226243
|
})(exports.Scope || (exports.Scope = {}));
|
|
226243
|
-
var SyntaxList = class extends
|
|
226244
|
+
var SyntaxList = class extends Node3 {
|
|
226244
226245
|
addChildText(textOrWriterFunction) {
|
|
226245
226246
|
return this.insertChildText(this.getChildCount(), textOrWriterFunction);
|
|
226246
226247
|
}
|
|
@@ -226259,12 +226260,12 @@ Node text: ${this.#forgottenText}`;
|
|
|
226259
226260
|
else
|
|
226260
226261
|
insertText = " " + insertText;
|
|
226261
226262
|
} else {
|
|
226262
|
-
if (index === 0 &&
|
|
226263
|
+
if (index === 0 && Node3.isSourceFile(parent)) {
|
|
226263
226264
|
if (!insertText.endsWith("\n"))
|
|
226264
226265
|
insertText += newLineKind;
|
|
226265
226266
|
} else {
|
|
226266
226267
|
insertText = newLineKind + insertText;
|
|
226267
|
-
if (!
|
|
226268
|
+
if (!Node3.isSourceFile(parent) && index === initialChildCount && insertText.endsWith("\n"))
|
|
226268
226269
|
insertText = insertText.replace(/\r?\n$/, "");
|
|
226269
226270
|
}
|
|
226270
226271
|
}
|
|
@@ -226513,7 +226514,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
226513
226514
|
if (value === hasExclamationToken)
|
|
226514
226515
|
return this;
|
|
226515
226516
|
if (value) {
|
|
226516
|
-
if (
|
|
226517
|
+
if (Node3.isQuestionTokenable(this))
|
|
226517
226518
|
this.setHasQuestionToken(false);
|
|
226518
226519
|
const colonNode = this.getFirstChildByKind(common.SyntaxKind.ColonToken);
|
|
226519
226520
|
if (colonNode == null)
|
|
@@ -226547,11 +226548,11 @@ Node text: ${this.#forgottenText}`;
|
|
|
226547
226548
|
return this.getExportKeyword() != null;
|
|
226548
226549
|
}
|
|
226549
226550
|
getExportKeyword() {
|
|
226550
|
-
if (
|
|
226551
|
+
if (Node3.isVariableDeclaration(this)) {
|
|
226551
226552
|
const variableStatement = this.getVariableStatement();
|
|
226552
226553
|
return variableStatement?.getExportKeyword();
|
|
226553
226554
|
}
|
|
226554
|
-
if (!
|
|
226555
|
+
if (!Node3.isModifierable(this))
|
|
226555
226556
|
return throwForNotModifierableNode();
|
|
226556
226557
|
return this.getFirstModifierByKind(common.SyntaxKind.ExportKeyword);
|
|
226557
226558
|
}
|
|
@@ -226562,11 +226563,11 @@ Node text: ${this.#forgottenText}`;
|
|
|
226562
226563
|
return this.getDefaultKeyword() != null;
|
|
226563
226564
|
}
|
|
226564
226565
|
getDefaultKeyword() {
|
|
226565
|
-
if (
|
|
226566
|
+
if (Node3.isVariableDeclaration(this)) {
|
|
226566
226567
|
const variableStatement = this.getVariableStatement();
|
|
226567
226568
|
return variableStatement?.getDefaultKeyword();
|
|
226568
226569
|
}
|
|
226569
|
-
if (!
|
|
226570
|
+
if (!Node3.isModifierable(this))
|
|
226570
226571
|
return throwForNotModifierableNode();
|
|
226571
226572
|
return this.getFirstModifierByKind(common.SyntaxKind.DefaultKeyword);
|
|
226572
226573
|
}
|
|
@@ -226622,7 +226623,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
226622
226623
|
setIsDefaultExport(value) {
|
|
226623
226624
|
if (value === this.isDefaultExport())
|
|
226624
226625
|
return this;
|
|
226625
|
-
if (value && !
|
|
226626
|
+
if (value && !Node3.isSourceFile(this.getParentOrThrow()))
|
|
226626
226627
|
throw new common.errors.InvalidOperationError("The parent must be a source file in order to set this node as a default export.");
|
|
226627
226628
|
const sourceFile = this.getSourceFile();
|
|
226628
226629
|
const fileDefaultExportSymbol = sourceFile.getDefaultExportSymbol();
|
|
@@ -226630,7 +226631,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
226630
226631
|
sourceFile.removeDefaultExport(fileDefaultExportSymbol);
|
|
226631
226632
|
if (!value)
|
|
226632
226633
|
return this;
|
|
226633
|
-
if (
|
|
226634
|
+
if (Node3.hasName(this) && shouldWriteAsSeparateStatement.call(this)) {
|
|
226634
226635
|
const parentSyntaxList = this.getFirstAncestorByKindOrThrow(common.SyntaxKind.SyntaxList);
|
|
226635
226636
|
const name = this.getName();
|
|
226636
226637
|
parentSyntaxList.insertChildText(this.getChildIndex() + 1, (writer) => {
|
|
@@ -226642,15 +226643,15 @@ Node text: ${this.#forgottenText}`;
|
|
|
226642
226643
|
}
|
|
226643
226644
|
return this;
|
|
226644
226645
|
function shouldWriteAsSeparateStatement() {
|
|
226645
|
-
if (
|
|
226646
|
+
if (Node3.isEnumDeclaration(this) || Node3.isModuleDeclaration(this) || Node3.isTypeAliasDeclaration(this))
|
|
226646
226647
|
return true;
|
|
226647
|
-
if (
|
|
226648
|
+
if (Node3.isAmbientable(this) && this.isAmbient())
|
|
226648
226649
|
return true;
|
|
226649
226650
|
return false;
|
|
226650
226651
|
}
|
|
226651
226652
|
}
|
|
226652
226653
|
setIsExported(value) {
|
|
226653
|
-
if (
|
|
226654
|
+
if (Node3.isSourceFile(this.getParentOrThrow()))
|
|
226654
226655
|
this.toggleModifier("default", false);
|
|
226655
226656
|
this.toggleModifier("export", value);
|
|
226656
226657
|
return this;
|
|
@@ -230106,8 +230107,8 @@ Node text: ${this.#forgottenText}`;
|
|
|
230106
230107
|
this._standardWrite(writer, info, () => {
|
|
230107
230108
|
this._context.structurePrinterFactory.forImportDeclaration().printTexts(writer, structures);
|
|
230108
230109
|
}, {
|
|
230109
|
-
previousNewLine: (previousMember) =>
|
|
230110
|
-
nextNewLine: (nextMember) =>
|
|
230110
|
+
previousNewLine: (previousMember) => Node3.isImportDeclaration(previousMember) || isComment(previousMember.compilerNode),
|
|
230111
|
+
nextNewLine: (nextMember) => Node3.isImportDeclaration(nextMember)
|
|
230111
230112
|
});
|
|
230112
230113
|
}
|
|
230113
230114
|
});
|
|
@@ -230125,7 +230126,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
230125
230126
|
return common.errors.throwIfNullOrUndefined(this.getImportDeclaration(conditionOrModuleSpecifier), message ?? "Expected to find an import with the provided condition.", this);
|
|
230126
230127
|
}
|
|
230127
230128
|
getImportDeclarations() {
|
|
230128
|
-
return this.getStatements().filter(
|
|
230129
|
+
return this.getStatements().filter(Node3.isImportDeclaration);
|
|
230129
230130
|
}
|
|
230130
230131
|
addExportDeclaration(structure) {
|
|
230131
230132
|
return this.addExportDeclarations([structure])[0];
|
|
@@ -230145,8 +230146,8 @@ Node text: ${this.#forgottenText}`;
|
|
|
230145
230146
|
this._standardWrite(writer, info, () => {
|
|
230146
230147
|
this._context.structurePrinterFactory.forExportDeclaration().printTexts(writer, structures);
|
|
230147
230148
|
}, {
|
|
230148
|
-
previousNewLine: (previousMember) =>
|
|
230149
|
-
nextNewLine: (nextMember) =>
|
|
230149
|
+
previousNewLine: (previousMember) => Node3.isExportDeclaration(previousMember) || isComment(previousMember.compilerNode),
|
|
230150
|
+
nextNewLine: (nextMember) => Node3.isExportDeclaration(nextMember)
|
|
230150
230151
|
});
|
|
230151
230152
|
}
|
|
230152
230153
|
});
|
|
@@ -230164,7 +230165,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
230164
230165
|
return common.errors.throwIfNullOrUndefined(this.getExportDeclaration(conditionOrModuleSpecifier), message ?? "Expected to find an export declaration with the provided condition.", this);
|
|
230165
230166
|
}
|
|
230166
230167
|
getExportDeclarations() {
|
|
230167
|
-
return this.getStatements().filter(
|
|
230168
|
+
return this.getStatements().filter(Node3.isExportDeclaration);
|
|
230168
230169
|
}
|
|
230169
230170
|
addExportAssignment(structure) {
|
|
230170
230171
|
return this.addExportAssignments([structure])[0];
|
|
@@ -230184,8 +230185,8 @@ Node text: ${this.#forgottenText}`;
|
|
|
230184
230185
|
this._standardWrite(writer, info, () => {
|
|
230185
230186
|
this._context.structurePrinterFactory.forExportAssignment().printTexts(writer, structures);
|
|
230186
230187
|
}, {
|
|
230187
|
-
previousNewLine: (previousMember) =>
|
|
230188
|
-
nextNewLine: (nextMember) =>
|
|
230188
|
+
previousNewLine: (previousMember) => Node3.isExportAssignment(previousMember) || isComment(previousMember.compilerNode),
|
|
230189
|
+
nextNewLine: (nextMember) => Node3.isExportAssignment(nextMember)
|
|
230189
230190
|
});
|
|
230190
230191
|
}
|
|
230191
230192
|
});
|
|
@@ -230197,7 +230198,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
230197
230198
|
return common.errors.throwIfNullOrUndefined(this.getExportAssignment(condition), message ?? "Expected to find an export assignment with the provided condition.", this);
|
|
230198
230199
|
}
|
|
230199
230200
|
getExportAssignments() {
|
|
230200
|
-
return this.getStatements().filter(
|
|
230201
|
+
return this.getStatements().filter(Node3.isExportAssignment);
|
|
230201
230202
|
}
|
|
230202
230203
|
getDefaultExportSymbol() {
|
|
230203
230204
|
const sourceFileSymbol = this.getSymbol();
|
|
@@ -230228,23 +230229,23 @@ Node text: ${this.#forgottenText}`;
|
|
|
230228
230229
|
}
|
|
230229
230230
|
return result;
|
|
230230
230231
|
function* getDeclarationHandlingImportsAndExports(declaration) {
|
|
230231
|
-
if (
|
|
230232
|
+
if (Node3.isExportSpecifier(declaration)) {
|
|
230232
230233
|
for (const d of declaration.getLocalTargetDeclarations())
|
|
230233
230234
|
yield* getDeclarationHandlingImportsAndExports(d);
|
|
230234
|
-
} else if (
|
|
230235
|
+
} else if (Node3.isExportAssignment(declaration)) {
|
|
230235
230236
|
const expression = declaration.getExpression();
|
|
230236
230237
|
if (expression == null || expression.getKind() !== common.SyntaxKind.Identifier) {
|
|
230237
230238
|
yield expression;
|
|
230238
230239
|
return;
|
|
230239
230240
|
}
|
|
230240
230241
|
yield* getDeclarationsForSymbol(expression.getSymbol());
|
|
230241
|
-
} else if (
|
|
230242
|
+
} else if (Node3.isImportSpecifier(declaration)) {
|
|
230242
230243
|
const identifier = declaration.getNameNode();
|
|
230243
230244
|
const symbol = identifier.getSymbol();
|
|
230244
230245
|
if (symbol == null)
|
|
230245
230246
|
return;
|
|
230246
230247
|
yield* getDeclarationsForSymbol(symbol.getAliasedSymbol() || symbol);
|
|
230247
|
-
} else if (
|
|
230248
|
+
} else if (Node3.isImportClause(declaration)) {
|
|
230248
230249
|
const identifier = declaration.getDefaultImport();
|
|
230249
230250
|
if (identifier == null)
|
|
230250
230251
|
return;
|
|
@@ -230252,7 +230253,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
230252
230253
|
if (symbol == null)
|
|
230253
230254
|
return;
|
|
230254
230255
|
yield* getDeclarationsForSymbol(symbol.getAliasedSymbol() || symbol);
|
|
230255
|
-
} else if (
|
|
230256
|
+
} else if (Node3.isNamespaceImport(declaration) || Node3.isNamespaceExport(declaration)) {
|
|
230256
230257
|
const symbol = declaration.getNameNode().getSymbol();
|
|
230257
230258
|
if (symbol == null)
|
|
230258
230259
|
return;
|
|
@@ -230275,7 +230276,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
230275
230276
|
const declaration = defaultExportSymbol.getDeclarations()[0];
|
|
230276
230277
|
if (declaration.compilerNode.kind === common.SyntaxKind.ExportAssignment)
|
|
230277
230278
|
removeChildrenWithFormatting({ children: [declaration], getSiblingFormatting: () => FormattingKind.Newline });
|
|
230278
|
-
else if (
|
|
230279
|
+
else if (Node3.isModifierable(declaration)) {
|
|
230279
230280
|
declaration.toggleModifier("default", false);
|
|
230280
230281
|
declaration.toggleModifier("export", false);
|
|
230281
230282
|
}
|
|
@@ -230315,12 +230316,12 @@ Node text: ${this.#forgottenText}`;
|
|
|
230315
230316
|
};
|
|
230316
230317
|
}
|
|
230317
230318
|
function getNodeForReferences(node) {
|
|
230318
|
-
if (
|
|
230319
|
+
if (Node3.isIdentifier(node) || Node3.isStringLiteral(node))
|
|
230319
230320
|
return node;
|
|
230320
230321
|
const nameNode = node.getNodeProperty("name");
|
|
230321
230322
|
if (nameNode != null)
|
|
230322
230323
|
return nameNode;
|
|
230323
|
-
if (
|
|
230324
|
+
if (Node3.isExportable(node))
|
|
230324
230325
|
return node.getDefaultKeyword() || node;
|
|
230325
230326
|
return node;
|
|
230326
230327
|
}
|
|
@@ -230330,12 +230331,12 @@ Node text: ${this.#forgottenText}`;
|
|
|
230330
230331
|
renameNode(getNodeToRename(this), newName, options);
|
|
230331
230332
|
return this;
|
|
230332
230333
|
function getNodeToRename(thisNode) {
|
|
230333
|
-
if (
|
|
230334
|
+
if (Node3.isIdentifier(thisNode) || Node3.isPrivateIdentifier(thisNode) || Node3.isStringLiteral(thisNode))
|
|
230334
230335
|
return thisNode;
|
|
230335
230336
|
else if (thisNode.getNameNode != null) {
|
|
230336
230337
|
const node = thisNode.getNameNode();
|
|
230337
230338
|
common.errors.throwIfNullOrUndefined(node, "Expected to find a name node when renaming.");
|
|
230338
|
-
if (
|
|
230339
|
+
if (Node3.isArrayBindingPattern(node) || Node3.isObjectBindingPattern(node))
|
|
230339
230340
|
throw new common.errors.NotImplementedError(`Not implemented renameable scenario for ${node.getKindName()}.`);
|
|
230340
230341
|
return node;
|
|
230341
230342
|
} else {
|
|
@@ -230417,7 +230418,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
230417
230418
|
};
|
|
230418
230419
|
}
|
|
230419
230420
|
function addNameNode(node, newName) {
|
|
230420
|
-
if (
|
|
230421
|
+
if (Node3.isClassDeclaration(node) || Node3.isClassExpression(node)) {
|
|
230421
230422
|
const classKeyword = node.getFirstChildByKindOrThrow(common.SyntaxKind.ClassKeyword);
|
|
230422
230423
|
insertIntoParentTextRange({
|
|
230423
230424
|
insertPos: classKeyword.getEnd(),
|
|
@@ -230539,7 +230540,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
230539
230540
|
if (value === hasQuestionDotToken)
|
|
230540
230541
|
return this;
|
|
230541
230542
|
if (value) {
|
|
230542
|
-
if (
|
|
230543
|
+
if (Node3.isPropertyAccessExpression(this))
|
|
230543
230544
|
this.getFirstChildByKindOrThrow(common.SyntaxKind.DotToken).replaceWithText("?.");
|
|
230544
230545
|
else {
|
|
230545
230546
|
insertIntoParentTextRange({
|
|
@@ -230549,16 +230550,16 @@ Node text: ${this.#forgottenText}`;
|
|
|
230549
230550
|
});
|
|
230550
230551
|
}
|
|
230551
230552
|
} else {
|
|
230552
|
-
if (
|
|
230553
|
+
if (Node3.isPropertyAccessExpression(this))
|
|
230553
230554
|
questionDotTokenNode.replaceWithText(".");
|
|
230554
230555
|
else
|
|
230555
230556
|
removeChildren({ children: [questionDotTokenNode] });
|
|
230556
230557
|
}
|
|
230557
230558
|
return this;
|
|
230558
230559
|
function getInsertPos2() {
|
|
230559
|
-
if (
|
|
230560
|
+
if (Node3.isCallExpression(this))
|
|
230560
230561
|
return this.getFirstChildByKindOrThrow(common.SyntaxKind.OpenParenToken).getStart();
|
|
230561
|
-
if (
|
|
230562
|
+
if (Node3.isElementAccessExpression(this))
|
|
230562
230563
|
return this.getFirstChildByKindOrThrow(common.SyntaxKind.OpenBracketToken).getStart();
|
|
230563
230564
|
common.errors.throwNotImplementedForSyntaxKindError(this.compilerNode.kind);
|
|
230564
230565
|
}
|
|
@@ -230593,7 +230594,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
230593
230594
|
if (value === hasQuestionToken)
|
|
230594
230595
|
return this;
|
|
230595
230596
|
if (value) {
|
|
230596
|
-
if (
|
|
230597
|
+
if (Node3.isExclamationTokenable(this))
|
|
230597
230598
|
this.setHasExclamationToken(false);
|
|
230598
230599
|
insertIntoParentTextRange({
|
|
230599
230600
|
insertPos: getInsertPos2.call(this),
|
|
@@ -230605,7 +230606,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
230605
230606
|
}
|
|
230606
230607
|
return this;
|
|
230607
230608
|
function getInsertPos2() {
|
|
230608
|
-
if (
|
|
230609
|
+
if (Node3.hasName(this))
|
|
230609
230610
|
return this.getNameNode().getEnd();
|
|
230610
230611
|
const colonNode = this.getFirstChildByKind(common.SyntaxKind.ColonToken);
|
|
230611
230612
|
if (colonNode != null)
|
|
@@ -230726,7 +230727,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
230726
230727
|
const scope = getScopeForNode(this);
|
|
230727
230728
|
if (scope != null)
|
|
230728
230729
|
return scope;
|
|
230729
|
-
if (
|
|
230730
|
+
if (Node3.isParameterDeclaration(this) && this.isReadonly())
|
|
230730
230731
|
return exports.Scope.Public;
|
|
230731
230732
|
return void 0;
|
|
230732
230733
|
}
|
|
@@ -230873,14 +230874,14 @@ Node text: ${this.#forgottenText}`;
|
|
|
230873
230874
|
}
|
|
230874
230875
|
function getValidRange(thisNode) {
|
|
230875
230876
|
const rangeNode = getRangeNode();
|
|
230876
|
-
const openBrace =
|
|
230877
|
+
const openBrace = Node3.isSourceFile(rangeNode) ? void 0 : rangeNode.getPreviousSiblingIfKind(common.SyntaxKind.OpenBraceToken);
|
|
230877
230878
|
const closeBrace = openBrace == null ? void 0 : rangeNode.getNextSiblingIfKind(common.SyntaxKind.CloseBraceToken);
|
|
230878
230879
|
if (openBrace != null && closeBrace != null)
|
|
230879
230880
|
return [openBrace.getEnd(), closeBrace.getStart()];
|
|
230880
230881
|
else
|
|
230881
230882
|
return [rangeNode.getPos(), rangeNode.getEnd()];
|
|
230882
230883
|
function getRangeNode() {
|
|
230883
|
-
if (
|
|
230884
|
+
if (Node3.isSourceFile(thisNode))
|
|
230884
230885
|
return thisNode;
|
|
230885
230886
|
return thisNode.getChildSyntaxListOrThrow();
|
|
230886
230887
|
}
|
|
@@ -230907,8 +230908,8 @@ Node text: ${this.#forgottenText}`;
|
|
|
230907
230908
|
const typeArguments = this.getTypeArguments();
|
|
230908
230909
|
index = verifyAndGetIndex(index, typeArguments.length);
|
|
230909
230910
|
if (typeArguments.length === 0) {
|
|
230910
|
-
const expression =
|
|
230911
|
-
const identifier =
|
|
230911
|
+
const expression = Node3.hasExpression(this) ? this.getExpression() : void 0;
|
|
230912
|
+
const identifier = Node3.isPropertyAccessExpression(expression) ? expression.getLastChildByKindOrThrow(common.SyntaxKind.Identifier) : this.getFirstChildByKindOrThrow(common.SyntaxKind.Identifier);
|
|
230912
230913
|
insertIntoParentTextRange({
|
|
230913
230914
|
insertPos: identifier.getEnd(),
|
|
230914
230915
|
parent: this,
|
|
@@ -231395,7 +231396,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
231395
231396
|
const namedNode = node;
|
|
231396
231397
|
if (namedNode.getNameNode != null)
|
|
231397
231398
|
return namedNode.getNameNode().getEnd();
|
|
231398
|
-
else if (
|
|
231399
|
+
else if (Node3.isCallSignatureDeclaration(node) || Node3.isFunctionTypeNode(node))
|
|
231399
231400
|
return node.getFirstChildByKindOrThrow(common.SyntaxKind.OpenParenToken).getStart();
|
|
231400
231401
|
else
|
|
231401
231402
|
throw new common.errors.NotImplementedError(`Not implemented scenario inserting type parameters for node with kind ${node.getKindName()}.`);
|
|
@@ -231407,13 +231408,13 @@ Node text: ${this.#forgottenText}`;
|
|
|
231407
231408
|
}
|
|
231408
231409
|
};
|
|
231409
231410
|
}
|
|
231410
|
-
var ArrayBindingPattern = class extends
|
|
231411
|
+
var ArrayBindingPattern = class extends Node3 {
|
|
231411
231412
|
getElements() {
|
|
231412
231413
|
return this.compilerNode.elements.map((e) => this._getNodeFromCompilerNode(e));
|
|
231413
231414
|
}
|
|
231414
231415
|
};
|
|
231415
231416
|
var createBase$F = (ctor) => DotDotDotTokenableNode(InitializerExpressionableNode(BindingNamedNode(ctor)));
|
|
231416
|
-
var BindingElementBase = createBase$F(
|
|
231417
|
+
var BindingElementBase = createBase$F(Node3);
|
|
231417
231418
|
var BindingElement = class extends BindingElementBase {
|
|
231418
231419
|
getPropertyNameNodeOrThrow(message) {
|
|
231419
231420
|
return common.errors.throwIfNullOrUndefined(this.getPropertyNameNode(), message ?? "Expected to find a property name node.", this);
|
|
@@ -231422,7 +231423,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
231422
231423
|
return this._getNodeFromCompilerNodeIfExists(this.compilerNode.propertyName);
|
|
231423
231424
|
}
|
|
231424
231425
|
};
|
|
231425
|
-
var ObjectBindingPattern = class extends
|
|
231426
|
+
var ObjectBindingPattern = class extends Node3 {
|
|
231426
231427
|
getElements() {
|
|
231427
231428
|
return this.compilerNode.elements.map((e) => this._getNodeFromCompilerNode(e));
|
|
231428
231429
|
}
|
|
@@ -231455,7 +231456,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
231455
231456
|
}
|
|
231456
231457
|
};
|
|
231457
231458
|
}
|
|
231458
|
-
var Expression = class extends
|
|
231459
|
+
var Expression = class extends Node3 {
|
|
231459
231460
|
getContextualType() {
|
|
231460
231461
|
return this._context.typeChecker.getContextualType(this);
|
|
231461
231462
|
}
|
|
@@ -231683,7 +231684,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
231683
231684
|
var NonNullExpressionBase = ExpressionedNode(LeftHandSideExpression);
|
|
231684
231685
|
var NonNullExpression = class extends NonNullExpressionBase {
|
|
231685
231686
|
};
|
|
231686
|
-
var ObjectLiteralElement = class extends
|
|
231687
|
+
var ObjectLiteralElement = class extends Node3 {
|
|
231687
231688
|
remove() {
|
|
231688
231689
|
removeCommaSeparatedChild(this);
|
|
231689
231690
|
}
|
|
@@ -232027,7 +232028,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
232027
232028
|
var YieldExpressionBase = ExpressionableNode(GeneratorableNode(Expression));
|
|
232028
232029
|
var YieldExpression = class extends YieldExpressionBase {
|
|
232029
232030
|
};
|
|
232030
|
-
var StatementBase = ChildOrderableNode(
|
|
232031
|
+
var StatementBase = ChildOrderableNode(Node3);
|
|
232031
232032
|
var Statement = class extends StatementBase {
|
|
232032
232033
|
remove() {
|
|
232033
232034
|
removeStatementedNodeChild(this);
|
|
@@ -232068,7 +232069,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
232068
232069
|
return getChildSyntaxList.call(this).insertChildText(index, writerFunction);
|
|
232069
232070
|
function getChildSyntaxList() {
|
|
232070
232071
|
const childSyntaxList = this.getChildSyntaxListOrThrow();
|
|
232071
|
-
if (
|
|
232072
|
+
if (Node3.isCaseClause(this) || Node3.isDefaultClause(this)) {
|
|
232072
232073
|
const block = childSyntaxList.getFirstChildIfKind(common.SyntaxKind.Block);
|
|
232073
232074
|
if (block != null)
|
|
232074
232075
|
return block.getChildSyntaxListOrThrow();
|
|
@@ -232108,7 +232109,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
232108
232109
|
});
|
|
232109
232110
|
}
|
|
232110
232111
|
getClasses() {
|
|
232111
|
-
return this.getStatements().filter(
|
|
232112
|
+
return this.getStatements().filter(Node3.isClassDeclaration);
|
|
232112
232113
|
}
|
|
232113
232114
|
getClass(nameOrFindFunction) {
|
|
232114
232115
|
return getNodeByNameOrFindFunction(this.getClasses(), nameOrFindFunction);
|
|
@@ -232138,7 +232139,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
232138
232139
|
});
|
|
232139
232140
|
}
|
|
232140
232141
|
getEnums() {
|
|
232141
|
-
return this.getStatements().filter(
|
|
232142
|
+
return this.getStatements().filter(Node3.isEnumDeclaration);
|
|
232142
232143
|
}
|
|
232143
232144
|
getEnum(nameOrFindFunction) {
|
|
232144
232145
|
return getNodeByNameOrFindFunction(this.getEnums(), nameOrFindFunction);
|
|
@@ -232166,14 +232167,14 @@ Node text: ${this.#forgottenText}`;
|
|
|
232166
232167
|
isAmbient: isNodeAmbientOrInAmbientContext(this)
|
|
232167
232168
|
}).printTexts(writer, structures);
|
|
232168
232169
|
}, {
|
|
232169
|
-
previousNewLine: (previousMember) => structures[0].hasDeclareKeyword === true &&
|
|
232170
|
-
nextNewLine: (nextMember) => structures[structures.length - 1].hasDeclareKeyword === true &&
|
|
232170
|
+
previousNewLine: (previousMember) => structures[0].hasDeclareKeyword === true && Node3.isFunctionDeclaration(previousMember) && previousMember.getBody() == null,
|
|
232171
|
+
nextNewLine: (nextMember) => structures[structures.length - 1].hasDeclareKeyword === true && Node3.isFunctionDeclaration(nextMember) && nextMember.getBody() == null
|
|
232171
232172
|
});
|
|
232172
232173
|
}
|
|
232173
232174
|
});
|
|
232174
232175
|
}
|
|
232175
232176
|
getFunctions() {
|
|
232176
|
-
return this.getStatements().filter(
|
|
232177
|
+
return this.getStatements().filter(Node3.isFunctionDeclaration).filter((f) => f.isAmbient() || f.isImplementation());
|
|
232177
232178
|
}
|
|
232178
232179
|
getFunction(nameOrFindFunction) {
|
|
232179
232180
|
return getNodeByNameOrFindFunction(this.getFunctions(), nameOrFindFunction);
|
|
@@ -232203,7 +232204,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
232203
232204
|
});
|
|
232204
232205
|
}
|
|
232205
232206
|
getInterfaces() {
|
|
232206
|
-
return this.getStatements().filter(
|
|
232207
|
+
return this.getStatements().filter(Node3.isInterfaceDeclaration);
|
|
232207
232208
|
}
|
|
232208
232209
|
getInterface(nameOrFindFunction) {
|
|
232209
232210
|
return getNodeByNameOrFindFunction(this.getInterfaces(), nameOrFindFunction);
|
|
@@ -232233,7 +232234,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
232233
232234
|
});
|
|
232234
232235
|
}
|
|
232235
232236
|
getModules() {
|
|
232236
|
-
return this.getStatements().filter(
|
|
232237
|
+
return this.getStatements().filter(Node3.isModuleDeclaration);
|
|
232237
232238
|
}
|
|
232238
232239
|
getModule(nameOrFindFunction) {
|
|
232239
232240
|
return getNodeByNameOrFindFunction(this.getModules(), nameOrFindFunction);
|
|
@@ -232259,14 +232260,14 @@ Node text: ${this.#forgottenText}`;
|
|
|
232259
232260
|
this._standardWrite(writer, info, () => {
|
|
232260
232261
|
this._context.structurePrinterFactory.forTypeAliasDeclaration().printTexts(writer, structures);
|
|
232261
232262
|
}, {
|
|
232262
|
-
previousNewLine: (previousMember) =>
|
|
232263
|
-
nextNewLine: (nextMember) =>
|
|
232263
|
+
previousNewLine: (previousMember) => Node3.isTypeAliasDeclaration(previousMember),
|
|
232264
|
+
nextNewLine: (nextMember) => Node3.isTypeAliasDeclaration(nextMember)
|
|
232264
232265
|
});
|
|
232265
232266
|
}
|
|
232266
232267
|
});
|
|
232267
232268
|
}
|
|
232268
232269
|
getTypeAliases() {
|
|
232269
|
-
return this.getStatements().filter(
|
|
232270
|
+
return this.getStatements().filter(Node3.isTypeAliasDeclaration);
|
|
232270
232271
|
}
|
|
232271
232272
|
getTypeAlias(nameOrFindFunction) {
|
|
232272
232273
|
return getNodeByNameOrFindFunction(this.getTypeAliases(), nameOrFindFunction);
|
|
@@ -232275,7 +232276,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
232275
232276
|
return common.errors.throwIfNullOrUndefined(this.getTypeAlias(nameOrFindFunction), () => getNotFoundErrorMessageForNameOrFindFunction("type alias", nameOrFindFunction));
|
|
232276
232277
|
}
|
|
232277
232278
|
getVariableStatements() {
|
|
232278
|
-
return this.getStatements().filter(
|
|
232279
|
+
return this.getStatements().filter(Node3.isVariableStatement);
|
|
232279
232280
|
}
|
|
232280
232281
|
getVariableStatement(nameOrFindFunction) {
|
|
232281
232282
|
return this.getVariableStatements().find(getFindFunction());
|
|
@@ -232306,8 +232307,8 @@ Node text: ${this.#forgottenText}`;
|
|
|
232306
232307
|
this._standardWrite(writer, info, () => {
|
|
232307
232308
|
this._context.structurePrinterFactory.forVariableStatement().printTexts(writer, structures);
|
|
232308
232309
|
}, {
|
|
232309
|
-
previousNewLine: (previousMember) =>
|
|
232310
|
-
nextNewLine: (nextMember) =>
|
|
232310
|
+
previousNewLine: (previousMember) => Node3.isVariableStatement(previousMember),
|
|
232311
|
+
nextNewLine: (nextMember) => Node3.isVariableStatement(nextMember)
|
|
232311
232312
|
});
|
|
232312
232313
|
}
|
|
232313
232314
|
});
|
|
@@ -232326,11 +232327,11 @@ Node text: ${this.#forgottenText}`;
|
|
|
232326
232327
|
}
|
|
232327
232328
|
getStructure() {
|
|
232328
232329
|
const structure = {};
|
|
232329
|
-
if (
|
|
232330
|
+
if (Node3.isBodyable(this) && !this.hasBody())
|
|
232330
232331
|
structure.statements = void 0;
|
|
232331
232332
|
else {
|
|
232332
232333
|
structure.statements = this.getStatements().map((s) => {
|
|
232333
|
-
if (
|
|
232334
|
+
if (Node3._hasStructure(s))
|
|
232334
232335
|
return s.getStructure();
|
|
232335
232336
|
return s.getText({ trimLeadingIndentation: true });
|
|
232336
232337
|
});
|
|
@@ -232338,7 +232339,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
232338
232339
|
return callBaseGetStructure(Base.prototype, this, structure);
|
|
232339
232340
|
}
|
|
232340
232341
|
set(structure) {
|
|
232341
|
-
if (
|
|
232342
|
+
if (Node3.isBodyable(this) && structure.statements == null && structure.hasOwnProperty(common.nameof(structure, "statements")))
|
|
232342
232343
|
this.removeBody();
|
|
232343
232344
|
else if (structure.statements != null) {
|
|
232344
232345
|
const statementCount = this._getCompilerStatementsWithComments().length;
|
|
@@ -232359,17 +232360,17 @@ Node text: ${this.#forgottenText}`;
|
|
|
232359
232360
|
}
|
|
232360
232361
|
}
|
|
232361
232362
|
_getCompilerStatementsContainer() {
|
|
232362
|
-
if (
|
|
232363
|
+
if (Node3.isSourceFile(this) || Node3.isCaseClause(this) || Node3.isDefaultClause(this))
|
|
232363
232364
|
return this.compilerNode;
|
|
232364
|
-
else if (
|
|
232365
|
+
else if (Node3.isModuleDeclaration(this)) {
|
|
232365
232366
|
const body = this._getInnerBody();
|
|
232366
232367
|
if (body == null)
|
|
232367
232368
|
return void 0;
|
|
232368
232369
|
else
|
|
232369
232370
|
return body.compilerNode;
|
|
232370
|
-
} else if (
|
|
232371
|
+
} else if (Node3.isBodyable(this) || Node3.isBodied(this))
|
|
232371
232372
|
return this.getBody()?.compilerNode;
|
|
232372
|
-
else if (
|
|
232373
|
+
else if (Node3.isBlock(this) || Node3.isModuleBlock(this))
|
|
232373
232374
|
return this.compilerNode;
|
|
232374
232375
|
else
|
|
232375
232376
|
throw new common.errors.NotImplementedError(`Could not find the statements for node kind: ${this.getKindName()}, text: ${this.getText()}`);
|
|
@@ -232386,7 +232387,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
232386
232387
|
});
|
|
232387
232388
|
}
|
|
232388
232389
|
_standardWrite(writer, info, writeStructures, opts = {}) {
|
|
232389
|
-
if (info.previousMember != null && (opts.previousNewLine == null || !opts.previousNewLine(info.previousMember)) && !
|
|
232390
|
+
if (info.previousMember != null && (opts.previousNewLine == null || !opts.previousNewLine(info.previousMember)) && !Node3.isCommentNode(info.previousMember)) {
|
|
232390
232391
|
writer.blankLine();
|
|
232391
232392
|
} else if (!info.isStartOfFile) {
|
|
232392
232393
|
writer.newLineIfLastNot();
|
|
@@ -232400,7 +232401,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
232400
232401
|
};
|
|
232401
232402
|
}
|
|
232402
232403
|
function addBodyIfNotExists(node) {
|
|
232403
|
-
if (
|
|
232404
|
+
if (Node3.isBodyable(node) && !node.hasBody())
|
|
232404
232405
|
node.addBody();
|
|
232405
232406
|
}
|
|
232406
232407
|
var createBase$v = (ctor) => TextInsertableNode(StatementedNode(ctor));
|
|
@@ -232415,7 +232416,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
232415
232416
|
return common.errors.throwIfNullOrUndefined(this.getLabel(), message ?? "Expected to find a label.", this);
|
|
232416
232417
|
}
|
|
232417
232418
|
};
|
|
232418
|
-
var CaseBlockBase = TextInsertableNode(
|
|
232419
|
+
var CaseBlockBase = TextInsertableNode(Node3);
|
|
232419
232420
|
var CaseBlock = class extends CaseBlockBase {
|
|
232420
232421
|
getClauses() {
|
|
232421
232422
|
const clauses = this.compilerNode.clauses || [];
|
|
@@ -232433,13 +232434,13 @@ Node text: ${this.#forgottenText}`;
|
|
|
232433
232434
|
}
|
|
232434
232435
|
};
|
|
232435
232436
|
var createBase$u = (ctor) => JSDocableNode(ExpressionedNode(TextInsertableNode(StatementedNode(ctor))));
|
|
232436
|
-
var CaseClauseBase = createBase$u(
|
|
232437
|
+
var CaseClauseBase = createBase$u(Node3);
|
|
232437
232438
|
var CaseClause = class extends CaseClauseBase {
|
|
232438
232439
|
remove() {
|
|
232439
232440
|
removeClausedNodeChild(this);
|
|
232440
232441
|
}
|
|
232441
232442
|
};
|
|
232442
|
-
var CatchClauseBase =
|
|
232443
|
+
var CatchClauseBase = Node3;
|
|
232443
232444
|
var CatchClause = class extends CatchClauseBase {
|
|
232444
232445
|
getBlock() {
|
|
232445
232446
|
return this._getNodeFromCompilerNode(this.compilerNode.block);
|
|
@@ -232465,7 +232466,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
232465
232466
|
var DebuggerStatement = class extends DebuggerStatementBase {
|
|
232466
232467
|
};
|
|
232467
232468
|
var createBase$t = (ctor) => TextInsertableNode(StatementedNode(ctor));
|
|
232468
|
-
var DefaultClauseBase = createBase$t(
|
|
232469
|
+
var DefaultClauseBase = createBase$t(Node3);
|
|
232469
232470
|
var DefaultClause = class extends DefaultClauseBase {
|
|
232470
232471
|
remove() {
|
|
232471
232472
|
removeClausedNodeChild(this);
|
|
@@ -232528,7 +232529,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
232528
232529
|
}
|
|
232529
232530
|
remove() {
|
|
232530
232531
|
const nodes = [];
|
|
232531
|
-
if (
|
|
232532
|
+
if (Node3.isIfStatement(this.getParentOrThrow()))
|
|
232532
232533
|
nodes.push(this.getPreviousSiblingIfKindOrThrow(common.SyntaxKind.ElseKeyword));
|
|
232533
232534
|
nodes.push(this);
|
|
232534
232535
|
removeStatementedNodeChildren(nodes);
|
|
@@ -232642,7 +232643,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
232642
232643
|
}
|
|
232643
232644
|
getNamespaceExport() {
|
|
232644
232645
|
const exportClause = this.getNodeProperty("exportClause");
|
|
232645
|
-
return exportClause != null &&
|
|
232646
|
+
return exportClause != null && Node3.isNamespaceExport(exportClause) ? exportClause : void 0;
|
|
232646
232647
|
}
|
|
232647
232648
|
getNamespaceExportOrThrow(message) {
|
|
232648
232649
|
return common.errors.throwIfNullOrUndefined(this.getNamespaceExport(), message ?? "Expected to find a namespace export.", this);
|
|
@@ -232660,7 +232661,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
232660
232661
|
textLength: 1
|
|
232661
232662
|
}
|
|
232662
232663
|
});
|
|
232663
|
-
} else if (
|
|
232664
|
+
} else if (Node3.isNamespaceExport(exportClause))
|
|
232664
232665
|
exportClause.getNameNode().replaceWithText(name);
|
|
232665
232666
|
else {
|
|
232666
232667
|
insertIntoParentTextRange({
|
|
@@ -232698,7 +232699,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
232698
232699
|
const moduleSpecifier = this._getNodeFromCompilerNodeIfExists(this.compilerNode.moduleSpecifier);
|
|
232699
232700
|
if (moduleSpecifier == null)
|
|
232700
232701
|
return void 0;
|
|
232701
|
-
if (!
|
|
232702
|
+
if (!Node3.isStringLiteral(moduleSpecifier))
|
|
232702
232703
|
throw new common.errors.InvalidOperationError("Expected the module specifier to be a string literal.");
|
|
232703
232704
|
return moduleSpecifier;
|
|
232704
232705
|
}
|
|
@@ -232717,7 +232718,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
232717
232718
|
if (symbol == null)
|
|
232718
232719
|
return void 0;
|
|
232719
232720
|
const declaration = symbol.getDeclarations()[0];
|
|
232720
|
-
return declaration != null &&
|
|
232721
|
+
return declaration != null && Node3.isSourceFile(declaration) ? declaration : void 0;
|
|
232721
232722
|
}
|
|
232722
232723
|
isModuleSpecifierRelative() {
|
|
232723
232724
|
const moduleSpecifierValue = this.getModuleSpecifierValue();
|
|
@@ -232898,7 +232899,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
232898
232899
|
}
|
|
232899
232900
|
});
|
|
232900
232901
|
}
|
|
232901
|
-
var ExportSpecifierBase =
|
|
232902
|
+
var ExportSpecifierBase = Node3;
|
|
232902
232903
|
var ExportSpecifier = class extends ExportSpecifierBase {
|
|
232903
232904
|
setName(name) {
|
|
232904
232905
|
const nameNode = this.getNameNode();
|
|
@@ -233031,7 +233032,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
233031
233032
|
}
|
|
233032
233033
|
getStructure() {
|
|
233033
233034
|
const alias = this.getAliasNode();
|
|
233034
|
-
return callBaseGetStructure(
|
|
233035
|
+
return callBaseGetStructure(Node3.prototype, this, {
|
|
233035
233036
|
kind: exports.StructureKind.ExportSpecifier,
|
|
233036
233037
|
alias: alias ? alias.getText() : void 0,
|
|
233037
233038
|
name: this.getNameNode().getText(),
|
|
@@ -233039,14 +233040,14 @@ Node text: ${this.#forgottenText}`;
|
|
|
233039
233040
|
});
|
|
233040
233041
|
}
|
|
233041
233042
|
};
|
|
233042
|
-
var ExternalModuleReferenceBase = ExpressionableNode(
|
|
233043
|
+
var ExternalModuleReferenceBase = ExpressionableNode(Node3);
|
|
233043
233044
|
var ExternalModuleReference = class extends ExternalModuleReferenceBase {
|
|
233044
233045
|
getReferencedSourceFileOrThrow(message) {
|
|
233045
233046
|
return common.errors.throwIfNullOrUndefined(this.getReferencedSourceFile(), message ?? "Expected to find the referenced source file.", this);
|
|
233046
233047
|
}
|
|
233047
233048
|
isRelative() {
|
|
233048
233049
|
const expression = this.getExpression();
|
|
233049
|
-
if (expression == null || !
|
|
233050
|
+
if (expression == null || !Node3.isStringLiteral(expression))
|
|
233050
233051
|
return false;
|
|
233051
233052
|
return ModuleUtils.isModuleSpecifierRelative(expression.getLiteralText());
|
|
233052
233053
|
}
|
|
@@ -233060,7 +233061,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
233060
233061
|
return ModuleUtils.getReferencedSourceFileFromSymbol(symbol);
|
|
233061
233062
|
}
|
|
233062
233063
|
};
|
|
233063
|
-
var ImportAttributeBase = ImportAttributeNamedNode(
|
|
233064
|
+
var ImportAttributeBase = ImportAttributeNamedNode(Node3);
|
|
233064
233065
|
var ImportAttribute = class extends ImportAttributeBase {
|
|
233065
233066
|
getValue() {
|
|
233066
233067
|
return this._getNodeFromCompilerNode(this.compilerNode.value);
|
|
@@ -233078,7 +233079,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
233078
233079
|
});
|
|
233079
233080
|
}
|
|
233080
233081
|
};
|
|
233081
|
-
var ImportAttributesBase =
|
|
233082
|
+
var ImportAttributesBase = Node3;
|
|
233082
233083
|
var ImportAttributes = class extends ImportAttributesBase {
|
|
233083
233084
|
setElements(elements) {
|
|
233084
233085
|
this.replaceWithText((writer) => {
|
|
@@ -233098,7 +233099,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
233098
233099
|
});
|
|
233099
233100
|
}
|
|
233100
233101
|
};
|
|
233101
|
-
var ImportClauseBase =
|
|
233102
|
+
var ImportClauseBase = Node3;
|
|
233102
233103
|
var ImportClause = class extends ImportClauseBase {
|
|
233103
233104
|
getPhaseModifier() {
|
|
233104
233105
|
return this.compilerNode.phaseModifier;
|
|
@@ -233164,13 +233165,13 @@ Node text: ${this.#forgottenText}`;
|
|
|
233164
233165
|
}
|
|
233165
233166
|
getNamespaceImport() {
|
|
233166
233167
|
const namedBindings = this.getNamedBindings();
|
|
233167
|
-
if (namedBindings == null || !
|
|
233168
|
+
if (namedBindings == null || !Node3.isNamespaceImport(namedBindings))
|
|
233168
233169
|
return void 0;
|
|
233169
233170
|
return namedBindings.getNameNode();
|
|
233170
233171
|
}
|
|
233171
233172
|
getNamedImports() {
|
|
233172
233173
|
const namedBindings = this.getNamedBindings();
|
|
233173
|
-
if (namedBindings == null || !
|
|
233174
|
+
if (namedBindings == null || !Node3.isNamedImports(namedBindings))
|
|
233174
233175
|
return [];
|
|
233175
233176
|
return namedBindings.getElements();
|
|
233176
233177
|
}
|
|
@@ -233215,7 +233216,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
233215
233216
|
}
|
|
233216
233217
|
getModuleSpecifier() {
|
|
233217
233218
|
const moduleSpecifier = this._getNodeFromCompilerNode(this.compilerNode.moduleSpecifier);
|
|
233218
|
-
if (!
|
|
233219
|
+
if (!Node3.isStringLiteral(moduleSpecifier))
|
|
233219
233220
|
throw new common.errors.InvalidOperationError("Expected the module specifier to be a string literal.");
|
|
233220
233221
|
return moduleSpecifier;
|
|
233221
233222
|
}
|
|
@@ -233578,14 +233579,14 @@ Node text: ${this.#forgottenText}`;
|
|
|
233578
233579
|
}
|
|
233579
233580
|
isExternalModuleReferenceRelative() {
|
|
233580
233581
|
const moduleReference = this.getModuleReference();
|
|
233581
|
-
if (!
|
|
233582
|
+
if (!Node3.isExternalModuleReference(moduleReference))
|
|
233582
233583
|
return false;
|
|
233583
233584
|
return moduleReference.isRelative();
|
|
233584
233585
|
}
|
|
233585
233586
|
setExternalModuleReference(textOrSourceFile) {
|
|
233586
233587
|
const text = typeof textOrSourceFile === "string" ? textOrSourceFile : this._sourceFile.getRelativePathAsModuleSpecifierTo(textOrSourceFile);
|
|
233587
233588
|
const moduleReference = this.getModuleReference();
|
|
233588
|
-
if (
|
|
233589
|
+
if (Node3.isExternalModuleReference(moduleReference) && moduleReference.getExpression() != null)
|
|
233589
233590
|
moduleReference.getExpressionOrThrow().replaceWithText((writer) => writer.quote(text));
|
|
233590
233591
|
else
|
|
233591
233592
|
moduleReference.replaceWithText((writer) => writer.write("require(").quote(text).write(")"));
|
|
@@ -233596,12 +233597,12 @@ Node text: ${this.#forgottenText}`;
|
|
|
233596
233597
|
}
|
|
233597
233598
|
getExternalModuleReferenceSourceFile() {
|
|
233598
233599
|
const moduleReference = this.getModuleReference();
|
|
233599
|
-
if (!
|
|
233600
|
+
if (!Node3.isExternalModuleReference(moduleReference))
|
|
233600
233601
|
return void 0;
|
|
233601
233602
|
return moduleReference.getReferencedSourceFile();
|
|
233602
233603
|
}
|
|
233603
233604
|
};
|
|
233604
|
-
var ImportSpecifierBase =
|
|
233605
|
+
var ImportSpecifierBase = Node3;
|
|
233605
233606
|
var ImportSpecifier = class extends ImportSpecifierBase {
|
|
233606
233607
|
setName(name) {
|
|
233607
233608
|
const nameNode = this.getNameNode();
|
|
@@ -233740,7 +233741,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
233740
233741
|
}
|
|
233741
233742
|
getParentModule() {
|
|
233742
233743
|
let parent = this.getParentOrThrow();
|
|
233743
|
-
if (!
|
|
233744
|
+
if (!Node3.isModuleBlock(parent))
|
|
233744
233745
|
return void 0;
|
|
233745
233746
|
while (parent.getParentOrThrow().getKind() === common.SyntaxKind.ModuleDeclaration)
|
|
233746
233747
|
parent = parent.getParentOrThrow();
|
|
@@ -233799,7 +233800,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
233799
233800
|
}
|
|
233800
233801
|
getNameNodes() {
|
|
233801
233802
|
const name = this.getNameNode();
|
|
233802
|
-
if (
|
|
233803
|
+
if (Node3.isStringLiteral(name))
|
|
233803
233804
|
return name;
|
|
233804
233805
|
else {
|
|
233805
233806
|
const nodes = [];
|
|
@@ -233871,7 +233872,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
233871
233872
|
}
|
|
233872
233873
|
_getInnerBody() {
|
|
233873
233874
|
let node = this.getBody();
|
|
233874
|
-
while (node != null &&
|
|
233875
|
+
while (node != null && Node3.isBodyable(node) && node.compilerNode.statements == null)
|
|
233875
233876
|
node = node.getBody();
|
|
233876
233877
|
return node;
|
|
233877
233878
|
}
|
|
@@ -233886,19 +233887,19 @@ Node text: ${this.#forgottenText}`;
|
|
|
233886
233887
|
if (!namespaceDec.hasDeclareKeyword())
|
|
233887
233888
|
namespaceDec.setHasDeclareKeyword(true);
|
|
233888
233889
|
}
|
|
233889
|
-
var NamedExportsBase =
|
|
233890
|
+
var NamedExportsBase = Node3;
|
|
233890
233891
|
var NamedExports = class extends NamedExportsBase {
|
|
233891
233892
|
getElements() {
|
|
233892
233893
|
return this.compilerNode.elements.map((e) => this._getNodeFromCompilerNode(e));
|
|
233893
233894
|
}
|
|
233894
233895
|
};
|
|
233895
|
-
var NamedImportsBase =
|
|
233896
|
+
var NamedImportsBase = Node3;
|
|
233896
233897
|
var NamedImports = class extends NamedImportsBase {
|
|
233897
233898
|
getElements() {
|
|
233898
233899
|
return this.compilerNode.elements.map((e) => this._getNodeFromCompilerNode(e));
|
|
233899
233900
|
}
|
|
233900
233901
|
};
|
|
233901
|
-
var NamespaceExportBase = RenameableNode(
|
|
233902
|
+
var NamespaceExportBase = RenameableNode(Node3);
|
|
233902
233903
|
var NamespaceExport = class extends NamespaceExportBase {
|
|
233903
233904
|
setName(name) {
|
|
233904
233905
|
const nameNode = this.getNameNode();
|
|
@@ -233921,7 +233922,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
233921
233922
|
return this._getNodeFromCompilerNode(this.compilerNode.name);
|
|
233922
233923
|
}
|
|
233923
233924
|
};
|
|
233924
|
-
var NamespaceImportBase = RenameableNode(
|
|
233925
|
+
var NamespaceImportBase = RenameableNode(Node3);
|
|
233925
233926
|
var NamespaceImport = class extends NamespaceImportBase {
|
|
233926
233927
|
setName(name) {
|
|
233927
233928
|
const nameNode = this.getNameNode();
|
|
@@ -233951,7 +233952,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
233951
233952
|
FileSystemRefreshResult[FileSystemRefreshResult["Updated"] = 1] = "Updated";
|
|
233952
233953
|
FileSystemRefreshResult[FileSystemRefreshResult["Deleted"] = 2] = "Deleted";
|
|
233953
233954
|
})(exports.FileSystemRefreshResult || (exports.FileSystemRefreshResult = {}));
|
|
233954
|
-
var SourceFileBase = ModuledNode(TextInsertableNode(StatementedNode(
|
|
233955
|
+
var SourceFileBase = ModuledNode(TextInsertableNode(StatementedNode(Node3)));
|
|
233955
233956
|
var SourceFile = (() => {
|
|
233956
233957
|
let _classSuper = SourceFileBase;
|
|
233957
233958
|
let _instanceExtraInitializers = [];
|
|
@@ -234456,7 +234457,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
234456
234457
|
function getReferencingNodeFromStringLiteral(literal) {
|
|
234457
234458
|
const parent = literal.getParentOrThrow();
|
|
234458
234459
|
const grandParent = parent.getParent();
|
|
234459
|
-
if (grandParent != null &&
|
|
234460
|
+
if (grandParent != null && Node3.isImportEqualsDeclaration(grandParent))
|
|
234460
234461
|
return grandParent;
|
|
234461
234462
|
else
|
|
234462
234463
|
return parent;
|
|
@@ -234669,7 +234670,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
234669
234670
|
var FunctionExpression = class extends FunctionExpressionBase {
|
|
234670
234671
|
};
|
|
234671
234672
|
var createBase$m = (ctor) => OverrideableNode(QuestionTokenableNode(DecoratableNode(ScopeableNode(ReadonlyableNode(ModifierableNode(DotDotDotTokenableNode(TypedNode(InitializerExpressionableNode(BindingNamedNode(ctor))))))))));
|
|
234672
|
-
var ParameterDeclarationBase = createBase$m(
|
|
234673
|
+
var ParameterDeclarationBase = createBase$m(Node3);
|
|
234673
234674
|
var ParameterDeclaration = class extends ParameterDeclarationBase {
|
|
234674
234675
|
isRestParameter() {
|
|
234675
234676
|
return this.compilerNode.dotDotDotToken != null;
|
|
@@ -234732,7 +234733,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
234732
234733
|
if (isParameterWithoutParens())
|
|
234733
234734
|
addParens();
|
|
234734
234735
|
function isParameterWithoutParens() {
|
|
234735
|
-
return
|
|
234736
|
+
return Node3.isArrowFunction(parent) && parent.compilerNode.parameters.length === 1 && parameter.getParentSyntaxListOrThrow().getPreviousSiblingIfKind(common.SyntaxKind.OpenParenToken) == null;
|
|
234736
234737
|
}
|
|
234737
234738
|
function addParens() {
|
|
234738
234739
|
const paramText = parameter.getText();
|
|
@@ -234749,14 +234750,14 @@ Node text: ${this.#forgottenText}`;
|
|
|
234749
234750
|
});
|
|
234750
234751
|
}
|
|
234751
234752
|
}
|
|
234752
|
-
var ClassElement = class extends
|
|
234753
|
+
var ClassElement = class extends Node3 {
|
|
234753
234754
|
remove() {
|
|
234754
234755
|
const parent = this.getParentOrThrow();
|
|
234755
|
-
if (
|
|
234756
|
+
if (Node3.isClassDeclaration(parent) || Node3.isClassExpression(parent))
|
|
234756
234757
|
removeClassMember(this);
|
|
234757
|
-
else if (
|
|
234758
|
+
else if (Node3.isObjectLiteralExpression(parent))
|
|
234758
234759
|
removeCommaSeparatedChild(this);
|
|
234759
|
-
else if (
|
|
234760
|
+
else if (Node3.isInterfaceDeclaration(parent))
|
|
234760
234761
|
removeInterfaceMember(this);
|
|
234761
234762
|
else
|
|
234762
234763
|
common.errors.throwNotImplementedForSyntaxKindError(parent.getKind());
|
|
@@ -234898,7 +234899,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
234898
234899
|
index,
|
|
234899
234900
|
parent: this,
|
|
234900
234901
|
write: (writer, info) => {
|
|
234901
|
-
const previousMemberHasBody = !isAmbient && info.previousMember != null &&
|
|
234902
|
+
const previousMemberHasBody = !isAmbient && info.previousMember != null && Node3.isBodyable(info.previousMember) && info.previousMember.hasBody();
|
|
234902
234903
|
const firstStructureHasBody = !isAmbient && members instanceof Array && structureHasBody(members[0]);
|
|
234903
234904
|
if (previousMemberHasBody || info.previousMember != null && firstStructureHasBody)
|
|
234904
234905
|
writer.blankLineIfLastNot();
|
|
@@ -234909,7 +234910,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
234909
234910
|
memberPrinter.printTexts(memberWriter, members);
|
|
234910
234911
|
writer.write(memberWriter.toString());
|
|
234911
234912
|
const lastStructureHasBody = !isAmbient && members instanceof Array && structureHasBody(members[members.length - 1]);
|
|
234912
|
-
const nextMemberHasBody = !isAmbient && info.nextMember != null &&
|
|
234913
|
+
const nextMemberHasBody = !isAmbient && info.nextMember != null && Node3.isBodyable(info.nextMember) && info.nextMember.hasBody();
|
|
234913
234914
|
if (info.nextMember != null && lastStructureHasBody || nextMemberHasBody)
|
|
234914
234915
|
writer.blankLineIfLastNot();
|
|
234915
234916
|
else
|
|
@@ -234939,7 +234940,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
234939
234940
|
structures,
|
|
234940
234941
|
expectedKind: common.SyntaxKind.Constructor,
|
|
234941
234942
|
write: (writer, info) => {
|
|
234942
|
-
if (!isAmbient && info.previousMember != null && !
|
|
234943
|
+
if (!isAmbient && info.previousMember != null && !Node3.isCommentNode(info.previousMember))
|
|
234943
234944
|
writer.blankLineIfLastNot();
|
|
234944
234945
|
else
|
|
234945
234946
|
writer.newLineIfLastNot();
|
|
@@ -234952,7 +234953,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
234952
234953
|
});
|
|
234953
234954
|
}
|
|
234954
234955
|
getConstructors() {
|
|
234955
|
-
return this.getMembers().filter((m) =>
|
|
234956
|
+
return this.getMembers().filter((m) => Node3.isConstructorDeclaration(m));
|
|
234956
234957
|
}
|
|
234957
234958
|
addStaticBlock(structure = {}) {
|
|
234958
234959
|
return this.insertStaticBlock(getEndIndexFromArray(this.getMembersWithComments()), structure);
|
|
@@ -234970,7 +234971,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
234970
234971
|
structures,
|
|
234971
234972
|
expectedKind: common.SyntaxKind.ClassStaticBlockDeclaration,
|
|
234972
234973
|
write: (writer, info) => {
|
|
234973
|
-
if (!isAmbient && info.previousMember != null && !
|
|
234974
|
+
if (!isAmbient && info.previousMember != null && !Node3.isCommentNode(info.previousMember))
|
|
234974
234975
|
writer.blankLineIfLastNot();
|
|
234975
234976
|
else
|
|
234976
234977
|
writer.newLineIfLastNot();
|
|
@@ -234983,7 +234984,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
234983
234984
|
});
|
|
234984
234985
|
}
|
|
234985
234986
|
getStaticBlocks() {
|
|
234986
|
-
return this.getMembers().filter((m) =>
|
|
234987
|
+
return this.getMembers().filter((m) => Node3.isClassStaticBlockDeclaration(m));
|
|
234987
234988
|
}
|
|
234988
234989
|
addGetAccessor(structure) {
|
|
234989
234990
|
return this.addGetAccessors([structure])[0];
|
|
@@ -235000,7 +235001,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
235000
235001
|
structures,
|
|
235001
235002
|
expectedKind: common.SyntaxKind.GetAccessor,
|
|
235002
235003
|
write: (writer, info) => {
|
|
235003
|
-
if (info.previousMember != null && !
|
|
235004
|
+
if (info.previousMember != null && !Node3.isCommentNode(info.previousMember))
|
|
235004
235005
|
writer.blankLineIfLastNot();
|
|
235005
235006
|
else
|
|
235006
235007
|
writer.newLineIfLastNot();
|
|
@@ -235029,7 +235030,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
235029
235030
|
structures,
|
|
235030
235031
|
expectedKind: common.SyntaxKind.SetAccessor,
|
|
235031
235032
|
write: (writer, info) => {
|
|
235032
|
-
if (info.previousMember != null && !
|
|
235033
|
+
if (info.previousMember != null && !Node3.isCommentNode(info.previousMember))
|
|
235033
235034
|
writer.blankLineIfLastNot();
|
|
235034
235035
|
else
|
|
235035
235036
|
writer.newLineIfLastNot();
|
|
@@ -235058,12 +235059,12 @@ Node text: ${this.#forgottenText}`;
|
|
|
235058
235059
|
structures,
|
|
235059
235060
|
expectedKind: common.SyntaxKind.PropertyDeclaration,
|
|
235060
235061
|
write: (writer, info) => {
|
|
235061
|
-
if (info.previousMember != null &&
|
|
235062
|
+
if (info.previousMember != null && Node3.hasBody(info.previousMember))
|
|
235062
235063
|
writer.blankLineIfLastNot();
|
|
235063
235064
|
else
|
|
235064
235065
|
writer.newLineIfLastNot();
|
|
235065
235066
|
this._context.structurePrinterFactory.forPropertyDeclaration().printTexts(writer, structures);
|
|
235066
|
-
if (info.nextMember != null &&
|
|
235067
|
+
if (info.nextMember != null && Node3.hasBody(info.nextMember))
|
|
235067
235068
|
writer.blankLineIfLastNot();
|
|
235068
235069
|
else
|
|
235069
235070
|
writer.newLineIfLastNot();
|
|
@@ -235085,7 +235086,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
235085
235086
|
return insertChildren(this, {
|
|
235086
235087
|
index,
|
|
235087
235088
|
write: (writer, info) => {
|
|
235088
|
-
if (!isAmbient && info.previousMember != null && !
|
|
235089
|
+
if (!isAmbient && info.previousMember != null && !Node3.isCommentNode(info.previousMember))
|
|
235089
235090
|
writer.blankLineIfLastNot();
|
|
235090
235091
|
else
|
|
235091
235092
|
writer.newLineIfLastNot();
|
|
@@ -235124,7 +235125,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
235124
235125
|
return common.errors.throwIfNullOrUndefined(this.getProperty(nameOrFindFunction), () => getNotFoundErrorMessageForNameOrFindFunction("class property declaration", nameOrFindFunction));
|
|
235125
235126
|
}
|
|
235126
235127
|
getProperties() {
|
|
235127
|
-
return this.getMembers().filter((m) =>
|
|
235128
|
+
return this.getMembers().filter((m) => Node3.isPropertyDeclaration(m));
|
|
235128
235129
|
}
|
|
235129
235130
|
getGetAccessor(nameOrFindFunction) {
|
|
235130
235131
|
return getNodeByNameOrFindFunction(this.getGetAccessors(), nameOrFindFunction);
|
|
@@ -235133,7 +235134,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
235133
235134
|
return common.errors.throwIfNullOrUndefined(this.getGetAccessor(nameOrFindFunction), () => getNotFoundErrorMessageForNameOrFindFunction("class getAccessor declaration", nameOrFindFunction));
|
|
235134
235135
|
}
|
|
235135
235136
|
getGetAccessors() {
|
|
235136
|
-
return this.getMembers().filter((m) =>
|
|
235137
|
+
return this.getMembers().filter((m) => Node3.isGetAccessorDeclaration(m));
|
|
235137
235138
|
}
|
|
235138
235139
|
getSetAccessor(nameOrFindFunction) {
|
|
235139
235140
|
return getNodeByNameOrFindFunction(this.getSetAccessors(), nameOrFindFunction);
|
|
@@ -235142,7 +235143,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
235142
235143
|
return common.errors.throwIfNullOrUndefined(this.getSetAccessor(nameOrFindFunction), () => getNotFoundErrorMessageForNameOrFindFunction("class setAccessor declaration", nameOrFindFunction));
|
|
235143
235144
|
}
|
|
235144
235145
|
getSetAccessors() {
|
|
235145
|
-
return this.getMembers().filter((m) =>
|
|
235146
|
+
return this.getMembers().filter((m) => Node3.isSetAccessorDeclaration(m));
|
|
235146
235147
|
}
|
|
235147
235148
|
getMethod(nameOrFindFunction) {
|
|
235148
235149
|
return getNodeByNameOrFindFunction(this.getMethods(), nameOrFindFunction);
|
|
@@ -235151,7 +235152,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
235151
235152
|
return common.errors.throwIfNullOrUndefined(this.getMethod(nameOrFindFunction), () => getNotFoundErrorMessageForNameOrFindFunction("class method declaration", nameOrFindFunction));
|
|
235152
235153
|
}
|
|
235153
235154
|
getMethods() {
|
|
235154
|
-
return this.getMembers().filter((m) =>
|
|
235155
|
+
return this.getMembers().filter((m) => Node3.isMethodDeclaration(m));
|
|
235155
235156
|
}
|
|
235156
235157
|
getInstanceMethod(nameOrFindFunction) {
|
|
235157
235158
|
return getNodeByNameOrFindFunction(this.getInstanceMethods(), nameOrFindFunction);
|
|
@@ -235179,9 +235180,9 @@ Node text: ${this.#forgottenText}`;
|
|
|
235179
235180
|
}
|
|
235180
235181
|
getInstanceMembers() {
|
|
235181
235182
|
return this.getMembersWithParameterProperties().filter((m) => {
|
|
235182
|
-
if (
|
|
235183
|
+
if (Node3.isConstructorDeclaration(m))
|
|
235183
235184
|
return false;
|
|
235184
|
-
return
|
|
235185
|
+
return Node3.isParameterDeclaration(m) || !m.isStatic();
|
|
235185
235186
|
});
|
|
235186
235187
|
}
|
|
235187
235188
|
getStaticMember(nameOrFindFunction) {
|
|
@@ -235192,14 +235193,14 @@ Node text: ${this.#forgottenText}`;
|
|
|
235192
235193
|
}
|
|
235193
235194
|
getStaticMembers() {
|
|
235194
235195
|
return this.getMembers().filter((m) => {
|
|
235195
|
-
if (
|
|
235196
|
+
if (Node3.isConstructorDeclaration(m))
|
|
235196
235197
|
return false;
|
|
235197
|
-
return !
|
|
235198
|
+
return !Node3.isParameterDeclaration(m) && m.isStatic();
|
|
235198
235199
|
});
|
|
235199
235200
|
}
|
|
235200
235201
|
getMembersWithParameterProperties() {
|
|
235201
235202
|
const members = this.getMembers();
|
|
235202
|
-
const implementationCtors = members.filter((c) =>
|
|
235203
|
+
const implementationCtors = members.filter((c) => Node3.isConstructorDeclaration(c) && c.isImplementation());
|
|
235203
235204
|
for (const ctor of implementationCtors) {
|
|
235204
235205
|
let insertIndex = members.indexOf(ctor) + 1;
|
|
235205
235206
|
for (const param of ctor.getParameters()) {
|
|
@@ -235217,7 +235218,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
235217
235218
|
getMembersWithComments() {
|
|
235218
235219
|
const compilerNode = this.compilerNode;
|
|
235219
235220
|
const members = ExtendedParser.getContainerArray(compilerNode, this.getSourceFile().compilerNode);
|
|
235220
|
-
return getAllMembers(this, members).filter((m) => isSupportedClassMember(m) ||
|
|
235221
|
+
return getAllMembers(this, members).filter((m) => isSupportedClassMember(m) || Node3.isCommentClassElement(m));
|
|
235221
235222
|
}
|
|
235222
235223
|
getMember(nameOrFindFunction) {
|
|
235223
235224
|
return getNodeByNameOrFindFunction(this.getMembers(), nameOrFindFunction);
|
|
@@ -235255,9 +235256,9 @@ Node text: ${this.#forgottenText}`;
|
|
|
235255
235256
|
const isAmbient = isNodeAmbientOrInAmbientContext(classDec);
|
|
235256
235257
|
const members = compilerMembers.map((m) => classDec._getNodeFromCompilerNode(m));
|
|
235257
235258
|
return isAmbient ? members : members.filter((m) => {
|
|
235258
|
-
if (!(
|
|
235259
|
+
if (!(Node3.isConstructorDeclaration(m) || Node3.isMethodDeclaration(m)))
|
|
235259
235260
|
return true;
|
|
235260
|
-
if (
|
|
235261
|
+
if (Node3.isMethodDeclaration(m) && m.isAbstract())
|
|
235261
235262
|
return true;
|
|
235262
235263
|
return m.isImplementation();
|
|
235263
235264
|
});
|
|
@@ -235283,10 +235284,10 @@ Node text: ${this.#forgottenText}`;
|
|
|
235283
235284
|
return classes;
|
|
235284
235285
|
}
|
|
235285
235286
|
function isClassPropertyType(m) {
|
|
235286
|
-
return
|
|
235287
|
+
return Node3.isPropertyDeclaration(m) || Node3.isSetAccessorDeclaration(m) || Node3.isGetAccessorDeclaration(m) || Node3.isParameterDeclaration(m);
|
|
235287
235288
|
}
|
|
235288
235289
|
function isSupportedClassMember(m) {
|
|
235289
|
-
return
|
|
235290
|
+
return Node3.isMethodDeclaration(m) || Node3.isPropertyDeclaration(m) || Node3.isGetAccessorDeclaration(m) || Node3.isSetAccessorDeclaration(m) || Node3.isConstructorDeclaration(m) || Node3.isClassStaticBlockDeclaration(m);
|
|
235290
235291
|
}
|
|
235291
235292
|
function insertChildren(classDeclaration, opts) {
|
|
235292
235293
|
return insertIntoBracesOrSourceFileWithGetChildren({
|
|
@@ -235354,7 +235355,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
235354
235355
|
typeParameters: this.getTypeParameters().map((p) => p.getStructure()),
|
|
235355
235356
|
properties: [
|
|
235356
235357
|
...parameterProperties.map((p) => {
|
|
235357
|
-
const jsDocComment = p.getParentOrThrow().getJsDocs().map((j) => j.getTags()).flat().filter(
|
|
235358
|
+
const jsDocComment = p.getParentOrThrow().getJsDocs().map((j) => j.getTags()).flat().filter(Node3.isJSDocParameterTag).filter((t) => t.getTagName() === "param" && t.getName() === p.getName() && t.getComment() != null).map((t) => t.getCommentText().trim())[0];
|
|
235358
235359
|
return {
|
|
235359
235360
|
kind: exports.StructureKind.PropertySignature,
|
|
235360
235361
|
docs: jsDocComment == null ? [] : [{ kind: exports.StructureKind.JSDoc, description: jsDocComment }],
|
|
@@ -235429,7 +235430,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
235429
235430
|
name: getAndSet[0].getName(),
|
|
235430
235431
|
type: getAndSet[0].getType().getText(getAndSet[0]),
|
|
235431
235432
|
hasQuestionToken: false,
|
|
235432
|
-
isReadonly: getAndSet.every(
|
|
235433
|
+
isReadonly: getAndSet.every(Node3.isGetAccessorDeclaration)
|
|
235433
235434
|
};
|
|
235434
235435
|
}
|
|
235435
235436
|
function getExtractedInterfaceMethodStructure(method) {
|
|
@@ -235546,7 +235547,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
235546
235547
|
const thisName = this.getName();
|
|
235547
235548
|
const isStatic = this.isStatic();
|
|
235548
235549
|
return this.getParentOrThrow().forEachChild((sibling) => {
|
|
235549
|
-
if (
|
|
235550
|
+
if (Node3.isSetAccessorDeclaration(sibling) && sibling.getName() === thisName && sibling.isStatic() === isStatic)
|
|
235550
235551
|
return sibling;
|
|
235551
235552
|
return void 0;
|
|
235552
235553
|
});
|
|
@@ -235603,7 +235604,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
235603
235604
|
const thisName = this.getName();
|
|
235604
235605
|
const isStatic = this.isStatic();
|
|
235605
235606
|
return this.getParentOrThrow().forEachChild((sibling) => {
|
|
235606
|
-
if (
|
|
235607
|
+
if (Node3.isGetAccessorDeclaration(sibling) && sibling.getName() === thisName && sibling.isStatic() === isStatic)
|
|
235607
235608
|
return sibling;
|
|
235608
235609
|
return void 0;
|
|
235609
235610
|
});
|
|
@@ -235617,7 +235618,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
235617
235618
|
});
|
|
235618
235619
|
}
|
|
235619
235620
|
};
|
|
235620
|
-
var DecoratorBase = LeftHandSideExpressionedNode(
|
|
235621
|
+
var DecoratorBase = LeftHandSideExpressionedNode(Node3);
|
|
235621
235622
|
var Decorator = class extends DecoratorBase {
|
|
235622
235623
|
getName() {
|
|
235623
235624
|
return this.getNameNode().getText();
|
|
@@ -235630,13 +235631,13 @@ Node text: ${this.#forgottenText}`;
|
|
|
235630
235631
|
return getIdentifierFromName(this._getInnerExpression());
|
|
235631
235632
|
function getIdentifierFromName(expression) {
|
|
235632
235633
|
const identifier = getNameFromExpression(expression);
|
|
235633
|
-
if (!
|
|
235634
|
+
if (!Node3.isIdentifier(identifier)) {
|
|
235634
235635
|
throw new common.errors.NotImplementedError(`Expected the decorator expression '${identifier.getText()}' to be an identifier. Please deal directly with 'getExpression()' on the decorator to handle more complex scenarios.`);
|
|
235635
235636
|
}
|
|
235636
235637
|
return identifier;
|
|
235637
235638
|
}
|
|
235638
235639
|
function getNameFromExpression(expression) {
|
|
235639
|
-
if (
|
|
235640
|
+
if (Node3.isPropertyAccessExpression(expression))
|
|
235640
235641
|
return expression.getNameNode();
|
|
235641
235642
|
return expression;
|
|
235642
235643
|
}
|
|
@@ -235648,7 +235649,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
235648
235649
|
return this.compilerNode.expression.getText(sourceFile.compilerNode);
|
|
235649
235650
|
}
|
|
235650
235651
|
isDecoratorFactory() {
|
|
235651
|
-
return
|
|
235652
|
+
return Node3.isCallExpression(this._getInnerExpression());
|
|
235652
235653
|
}
|
|
235653
235654
|
setIsDecoratorFactory(isDecoratorFactory) {
|
|
235654
235655
|
if (this.isDecoratorFactory() === isDecoratorFactory)
|
|
@@ -235690,7 +235691,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
235690
235691
|
}
|
|
235691
235692
|
getCallExpression() {
|
|
235692
235693
|
const expression = this._getInnerExpression();
|
|
235693
|
-
return
|
|
235694
|
+
return Node3.isCallExpression(expression) ? expression : void 0;
|
|
235694
235695
|
}
|
|
235695
235696
|
getArguments() {
|
|
235696
235697
|
return this.getCallExpression()?.getArguments() ?? [];
|
|
@@ -235754,7 +235755,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
235754
235755
|
}
|
|
235755
235756
|
_getInnerExpression() {
|
|
235756
235757
|
let expr = this.getExpression();
|
|
235757
|
-
while (
|
|
235758
|
+
while (Node3.isParenthesizedExpression(expr))
|
|
235758
235759
|
expr = expr.getExpression();
|
|
235759
235760
|
return expr;
|
|
235760
235761
|
}
|
|
@@ -235843,7 +235844,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
235843
235844
|
return -1;
|
|
235844
235845
|
}
|
|
235845
235846
|
}
|
|
235846
|
-
var JSDocBase =
|
|
235847
|
+
var JSDocBase = Node3;
|
|
235847
235848
|
var JSDoc = class extends JSDocBase {
|
|
235848
235849
|
isMultiLine() {
|
|
235849
235850
|
return this.getText().includes("\n");
|
|
@@ -235984,7 +235985,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
235984
235985
|
});
|
|
235985
235986
|
}
|
|
235986
235987
|
};
|
|
235987
|
-
var TypeNode = class extends
|
|
235988
|
+
var TypeNode = class extends Node3 {
|
|
235988
235989
|
};
|
|
235989
235990
|
var NodeWithTypeArgumentsBase = TypeArgumentedNode(TypeNode);
|
|
235990
235991
|
var NodeWithTypeArguments = class extends NodeWithTypeArgumentsBase {
|
|
@@ -236023,9 +236024,9 @@ Node text: ${this.#forgottenText}`;
|
|
|
236023
236024
|
var ImportTypeNode = class extends NodeWithTypeArguments {
|
|
236024
236025
|
setArgument(text) {
|
|
236025
236026
|
const arg = this.getArgument();
|
|
236026
|
-
if (
|
|
236027
|
+
if (Node3.isLiteralTypeNode(arg)) {
|
|
236027
236028
|
const literal = arg.getLiteral();
|
|
236028
|
-
if (
|
|
236029
|
+
if (Node3.isStringLiteral(literal)) {
|
|
236029
236030
|
literal.setLiteralValue(text);
|
|
236030
236031
|
return this;
|
|
236031
236032
|
}
|
|
@@ -236204,7 +236205,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
236204
236205
|
TypeParameterVariance[TypeParameterVariance["InOut"] = 3] = "InOut";
|
|
236205
236206
|
})(exports.TypeParameterVariance || (exports.TypeParameterVariance = {}));
|
|
236206
236207
|
var createBase$c = (ctor) => ModifierableNode(NamedNode(ctor));
|
|
236207
|
-
var TypeParameterDeclarationBase = createBase$c(
|
|
236208
|
+
var TypeParameterDeclarationBase = createBase$c(Node3);
|
|
236208
236209
|
var TypeParameterDeclaration = class extends TypeParameterDeclarationBase {
|
|
236209
236210
|
isConst() {
|
|
236210
236211
|
return this.hasModifier(common.SyntaxKind.ConstKeyword);
|
|
@@ -236374,7 +236375,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
236374
236375
|
};
|
|
236375
236376
|
var JSDocAllType = class extends JSDocType {
|
|
236376
236377
|
};
|
|
236377
|
-
var JSDocTagBase =
|
|
236378
|
+
var JSDocTagBase = Node3;
|
|
236378
236379
|
var JSDocTag = class extends JSDocTagBase {
|
|
236379
236380
|
getTagName() {
|
|
236380
236381
|
return this.getTagNameNode().getText();
|
|
@@ -236500,20 +236501,20 @@ Node text: ${this.#forgottenText}`;
|
|
|
236500
236501
|
};
|
|
236501
236502
|
var JSDocImportTag = class extends JSDocTag {
|
|
236502
236503
|
};
|
|
236503
|
-
var JSDocLink = class extends
|
|
236504
|
+
var JSDocLink = class extends Node3 {
|
|
236504
236505
|
};
|
|
236505
|
-
var JSDocLinkCode = class extends
|
|
236506
|
+
var JSDocLinkCode = class extends Node3 {
|
|
236506
236507
|
};
|
|
236507
|
-
var JSDocLinkPlain = class extends
|
|
236508
|
+
var JSDocLinkPlain = class extends Node3 {
|
|
236508
236509
|
};
|
|
236509
|
-
var JSDocMemberName = class extends
|
|
236510
|
+
var JSDocMemberName = class extends Node3 {
|
|
236510
236511
|
};
|
|
236511
236512
|
var JSDocNamepathType = class extends JSDocType {
|
|
236512
236513
|
getTypeNode() {
|
|
236513
236514
|
return this._getNodeFromCompilerNode(this.compilerNode.type);
|
|
236514
236515
|
}
|
|
236515
236516
|
};
|
|
236516
|
-
var JSDocNameReference = class extends
|
|
236517
|
+
var JSDocNameReference = class extends Node3 {
|
|
236517
236518
|
getName() {
|
|
236518
236519
|
return this._getNodeFromCompilerNode(this.compilerNode.name);
|
|
236519
236520
|
}
|
|
@@ -236596,7 +236597,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
236596
236597
|
return common.errors.throwIfNullOrUndefined(this.getConstraint(), message ?? "Expected to find the JS doc template tag's constraint.", this);
|
|
236597
236598
|
}
|
|
236598
236599
|
};
|
|
236599
|
-
var JSDocText = class extends
|
|
236600
|
+
var JSDocText = class extends Node3 {
|
|
236600
236601
|
};
|
|
236601
236602
|
var JSDocThisTagBase = JSDocTypeExpressionableTag(JSDocTag);
|
|
236602
236603
|
var JSDocThisTag = class extends JSDocThisTagBase {
|
|
@@ -236636,7 +236637,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
236636
236637
|
return this._getNodeFromCompilerNode(this.compilerNode.type);
|
|
236637
236638
|
}
|
|
236638
236639
|
};
|
|
236639
|
-
var CommentEnumMember = class extends
|
|
236640
|
+
var CommentEnumMember = class extends Node3 {
|
|
236640
236641
|
remove() {
|
|
236641
236642
|
removeChildrenWithFormatting({
|
|
236642
236643
|
children: [this],
|
|
@@ -236720,7 +236721,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
236720
236721
|
}
|
|
236721
236722
|
};
|
|
236722
236723
|
var createBase$a = (ctor) => JSDocableNode(InitializerExpressionableNode(PropertyNamedNode(ctor)));
|
|
236723
|
-
var EnumMemberBase = createBase$a(
|
|
236724
|
+
var EnumMemberBase = createBase$a(Node3);
|
|
236724
236725
|
var EnumMember = class extends EnumMemberBase {
|
|
236725
236726
|
getValue() {
|
|
236726
236727
|
return this._context.typeChecker.getConstantValue(this);
|
|
@@ -236761,7 +236762,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
236761
236762
|
});
|
|
236762
236763
|
}
|
|
236763
236764
|
};
|
|
236764
|
-
var HeritageClause = class extends
|
|
236765
|
+
var HeritageClause = class extends Node3 {
|
|
236765
236766
|
getTypeNodes() {
|
|
236766
236767
|
return this.compilerNode.types?.map((t) => this._getNodeFromCompilerNode(t)) ?? [];
|
|
236767
236768
|
}
|
|
@@ -236786,7 +236787,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
236786
236787
|
}
|
|
236787
236788
|
}
|
|
236788
236789
|
};
|
|
236789
|
-
var TypeElement = class extends
|
|
236790
|
+
var TypeElement = class extends Node3 {
|
|
236790
236791
|
remove() {
|
|
236791
236792
|
removeInterfaceMember(this);
|
|
236792
236793
|
}
|
|
@@ -236999,7 +237000,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
236999
237000
|
}
|
|
237000
237001
|
};
|
|
237001
237002
|
}
|
|
237002
|
-
var ComputedPropertyNameBase = ExpressionedNode(
|
|
237003
|
+
var ComputedPropertyNameBase = ExpressionedNode(Node3);
|
|
237003
237004
|
var ComputedPropertyName = class extends ComputedPropertyNameBase {
|
|
237004
237005
|
};
|
|
237005
237006
|
var IdentifierBase = CommonIdentifierBase(ReferenceFindableNode(RenameableNode(PrimaryExpression)));
|
|
@@ -237008,10 +237009,10 @@ Node text: ${this.#forgottenText}`;
|
|
|
237008
237009
|
return this._context.languageService.getImplementations(this);
|
|
237009
237010
|
}
|
|
237010
237011
|
};
|
|
237011
|
-
var PrivateIdentifierBase = CommonIdentifierBase(ReferenceFindableNode(RenameableNode(
|
|
237012
|
+
var PrivateIdentifierBase = CommonIdentifierBase(ReferenceFindableNode(RenameableNode(Node3)));
|
|
237012
237013
|
var PrivateIdentifier = class extends PrivateIdentifierBase {
|
|
237013
237014
|
};
|
|
237014
|
-
var QualifiedName = class extends
|
|
237015
|
+
var QualifiedName = class extends Node3 {
|
|
237015
237016
|
getLeft() {
|
|
237016
237017
|
return this._getNodeFromCompilerNode(this.compilerNode.left);
|
|
237017
237018
|
}
|
|
@@ -237019,7 +237020,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
237019
237020
|
return this._getNodeFromCompilerNode(this.compilerNode.right);
|
|
237020
237021
|
}
|
|
237021
237022
|
};
|
|
237022
|
-
var JsxAttributeBase =
|
|
237023
|
+
var JsxAttributeBase = Node3;
|
|
237023
237024
|
var JsxAttribute = class extends JsxAttributeBase {
|
|
237024
237025
|
getNameNode() {
|
|
237025
237026
|
return this._getNodeFromCompilerNode(this.compilerNode.name);
|
|
@@ -237096,7 +237097,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
237096
237097
|
}
|
|
237097
237098
|
};
|
|
237098
237099
|
var createBase$3 = (ctor) => JsxTagNamedNode(ctor);
|
|
237099
|
-
var JsxClosingElementBase = createBase$3(
|
|
237100
|
+
var JsxClosingElementBase = createBase$3(Node3);
|
|
237100
237101
|
var JsxClosingElement = class extends JsxClosingElementBase {
|
|
237101
237102
|
};
|
|
237102
237103
|
var JsxClosingFragment = class extends Expression {
|
|
@@ -237185,7 +237186,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
237185
237186
|
return this._getNodeFromCompilerNode(this.compilerNode.closingFragment);
|
|
237186
237187
|
}
|
|
237187
237188
|
};
|
|
237188
|
-
var JsxNamespacedNameBase =
|
|
237189
|
+
var JsxNamespacedNameBase = Node3;
|
|
237189
237190
|
var JsxNamespacedName = class extends JsxNamespacedNameBase {
|
|
237190
237191
|
getNamespaceNode() {
|
|
237191
237192
|
return this._getNodeFromCompilerNode(this.compilerNode.namespace);
|
|
@@ -237224,7 +237225,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
237224
237225
|
});
|
|
237225
237226
|
}
|
|
237226
237227
|
};
|
|
237227
|
-
var JsxSpreadAttributeBase = ExpressionedNode(
|
|
237228
|
+
var JsxSpreadAttributeBase = ExpressionedNode(Node3);
|
|
237228
237229
|
var JsxSpreadAttribute = class extends JsxSpreadAttributeBase {
|
|
237229
237230
|
remove() {
|
|
237230
237231
|
removeChildren({
|
|
@@ -237246,7 +237247,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
237246
237247
|
});
|
|
237247
237248
|
}
|
|
237248
237249
|
};
|
|
237249
|
-
var JsxTextBase = LiteralLikeNode(
|
|
237250
|
+
var JsxTextBase = LiteralLikeNode(Node3);
|
|
237250
237251
|
var JsxText = class extends JsxTextBase {
|
|
237251
237252
|
containsOnlyTriviaWhiteSpaces() {
|
|
237252
237253
|
const oldCompilerNode = this.compilerNode;
|
|
@@ -237435,23 +237436,23 @@ Node text: ${this.#forgottenText}`;
|
|
|
237435
237436
|
return parent.getChildAtIndex(childIndex);
|
|
237436
237437
|
}
|
|
237437
237438
|
};
|
|
237438
|
-
var TemplateHeadBase = LiteralLikeNode(
|
|
237439
|
+
var TemplateHeadBase = LiteralLikeNode(Node3);
|
|
237439
237440
|
var TemplateHead = class extends TemplateHeadBase {
|
|
237440
237441
|
};
|
|
237441
|
-
var TemplateMiddleBase = LiteralLikeNode(
|
|
237442
|
+
var TemplateMiddleBase = LiteralLikeNode(Node3);
|
|
237442
237443
|
var TemplateMiddle = class extends TemplateMiddleBase {
|
|
237443
237444
|
};
|
|
237444
|
-
var TemplateSpanBase = ExpressionedNode(
|
|
237445
|
+
var TemplateSpanBase = ExpressionedNode(Node3);
|
|
237445
237446
|
var TemplateSpan = class extends TemplateSpanBase {
|
|
237446
237447
|
getLiteral() {
|
|
237447
237448
|
return this._getNodeFromCompilerNode(this.compilerNode.literal);
|
|
237448
237449
|
}
|
|
237449
237450
|
};
|
|
237450
|
-
var TemplateTailBase = LiteralLikeNode(
|
|
237451
|
+
var TemplateTailBase = LiteralLikeNode(Node3);
|
|
237451
237452
|
var TemplateTail = class extends TemplateTailBase {
|
|
237452
237453
|
};
|
|
237453
237454
|
var createBase = (ctor) => ExportGetableNode(ExclamationTokenableNode(TypedNode(InitializerExpressionableNode(BindingNamedNode(ctor)))));
|
|
237454
|
-
var VariableDeclarationBase = createBase(
|
|
237455
|
+
var VariableDeclarationBase = createBase(Node3);
|
|
237455
237456
|
var VariableDeclaration = class extends VariableDeclarationBase {
|
|
237456
237457
|
remove() {
|
|
237457
237458
|
const parent = this.getParentOrThrow();
|
|
@@ -237489,7 +237490,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
237489
237490
|
}
|
|
237490
237491
|
getVariableStatement() {
|
|
237491
237492
|
const grandParent = this.getParentOrThrow().getParentOrThrow();
|
|
237492
|
-
return
|
|
237493
|
+
return Node3.isVariableStatement(grandParent) ? grandParent : void 0;
|
|
237493
237494
|
}
|
|
237494
237495
|
set(structure) {
|
|
237495
237496
|
callBaseSet(VariableDeclarationBase.prototype, this, structure);
|
|
@@ -237501,7 +237502,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
237501
237502
|
});
|
|
237502
237503
|
}
|
|
237503
237504
|
};
|
|
237504
|
-
var VariableDeclarationListBase = ModifierableNode(
|
|
237505
|
+
var VariableDeclarationListBase = ModifierableNode(Node3);
|
|
237505
237506
|
var VariableDeclarationList = class extends VariableDeclarationListBase {
|
|
237506
237507
|
getDeclarations() {
|
|
237507
237508
|
return this.compilerNode.declarations.map((d) => this._getNodeFromCompilerNode(d));
|
|
@@ -238962,7 +238963,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
238962
238963
|
if (symbol == null)
|
|
238963
238964
|
return false;
|
|
238964
238965
|
const valueDeclaration = symbol.getValueDeclaration();
|
|
238965
|
-
return valueDeclaration != null &&
|
|
238966
|
+
return valueDeclaration != null && Node3.isEnumDeclaration(valueDeclaration);
|
|
238966
238967
|
}
|
|
238967
238968
|
isInterface() {
|
|
238968
238969
|
return this.#hasObjectFlag(common.ObjectFlags.Interface);
|
|
@@ -239047,7 +239048,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
239047
239048
|
const declaration = symbol.getDeclarations()[0];
|
|
239048
239049
|
if (declaration == null)
|
|
239049
239050
|
return void 0;
|
|
239050
|
-
if (!
|
|
239051
|
+
if (!Node3.isTypeParameterDeclaration(declaration))
|
|
239051
239052
|
return void 0;
|
|
239052
239053
|
return declaration;
|
|
239053
239054
|
}
|
|
@@ -240031,13 +240032,13 @@ Node text: ${this.#forgottenText}`;
|
|
|
240031
240032
|
[common.SyntaxKind.WhileStatement]: WhileStatement,
|
|
240032
240033
|
[common.SyntaxKind.WithStatement]: WithStatement,
|
|
240033
240034
|
[common.SyntaxKind.YieldExpression]: YieldExpression,
|
|
240034
|
-
[common.SyntaxKind.SemicolonToken]:
|
|
240035
|
+
[common.SyntaxKind.SemicolonToken]: Node3,
|
|
240035
240036
|
[common.SyntaxKind.AnyKeyword]: Expression,
|
|
240036
240037
|
[common.SyntaxKind.BooleanKeyword]: Expression,
|
|
240037
240038
|
[common.SyntaxKind.FalseKeyword]: FalseLiteral,
|
|
240038
240039
|
[common.SyntaxKind.ImportKeyword]: ImportExpression,
|
|
240039
|
-
[common.SyntaxKind.InferKeyword]:
|
|
240040
|
-
[common.SyntaxKind.NeverKeyword]:
|
|
240040
|
+
[common.SyntaxKind.InferKeyword]: Node3,
|
|
240041
|
+
[common.SyntaxKind.NeverKeyword]: Node3,
|
|
240041
240042
|
[common.SyntaxKind.NullKeyword]: NullLiteral,
|
|
240042
240043
|
[common.SyntaxKind.NumberKeyword]: Expression,
|
|
240043
240044
|
[common.SyntaxKind.ObjectKeyword]: Expression,
|
|
@@ -240201,7 +240202,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
240201
240202
|
return new CommentEnumMember(this.#context, compilerNode, sourceFile);
|
|
240202
240203
|
return common.errors.throwNotImplementedForNeverValueError(compilerNode);
|
|
240203
240204
|
}
|
|
240204
|
-
const ctor = kindToWrapperMappings[compilerNode.kind] ||
|
|
240205
|
+
const ctor = kindToWrapperMappings[compilerNode.kind] || Node3;
|
|
240205
240206
|
return new ctor(this.#context, compilerNode, sourceFile);
|
|
240206
240207
|
}
|
|
240207
240208
|
function isCommentNode(node) {
|
|
@@ -240332,8 +240333,8 @@ Node text: ${this.#forgottenText}`;
|
|
|
240332
240333
|
return this.#jsDocTagInfoCache.getOrCreate(jsDocTagInfo, () => new JSDocTagInfo(jsDocTagInfo));
|
|
240333
240334
|
}
|
|
240334
240335
|
replaceCompilerNode(oldNode, newNode) {
|
|
240335
|
-
const nodeToReplace = oldNode instanceof
|
|
240336
|
-
const node = oldNode instanceof
|
|
240336
|
+
const nodeToReplace = oldNode instanceof Node3 ? oldNode.compilerNode : oldNode;
|
|
240337
|
+
const node = oldNode instanceof Node3 ? oldNode : this.#nodeCache.get(oldNode);
|
|
240337
240338
|
if (nodeToReplace.kind === common.SyntaxKind.SourceFile && nodeToReplace.fileName !== newNode.fileName) {
|
|
240338
240339
|
const sourceFile = node;
|
|
240339
240340
|
this.#removeCompilerNodeFromCache(nodeToReplace);
|
|
@@ -240378,12 +240379,12 @@ Node text: ${this.#forgottenText}`;
|
|
|
240378
240379
|
for (const node of nodes)
|
|
240379
240380
|
this.#nodeCache.rememberNode(node);
|
|
240380
240381
|
});
|
|
240381
|
-
if (
|
|
240382
|
+
if (Node3.isNode(result))
|
|
240382
240383
|
this.#nodeCache.rememberNode(result);
|
|
240383
240384
|
if (isPromise(result)) {
|
|
240384
240385
|
wasPromise = true;
|
|
240385
240386
|
return result.then((value) => {
|
|
240386
|
-
if (
|
|
240387
|
+
if (Node3.isNode(value))
|
|
240387
240388
|
this.#nodeCache.rememberNode(value);
|
|
240388
240389
|
this.#nodeCache.forgetLastPoint();
|
|
240389
240390
|
return value;
|
|
@@ -241511,7 +241512,7 @@ Node text: ${this.#forgottenText}`;
|
|
|
241511
241512
|
exports.NewExpressionBase = NewExpressionBase;
|
|
241512
241513
|
exports.NoSubstitutionTemplateLiteral = NoSubstitutionTemplateLiteral;
|
|
241513
241514
|
exports.NoSubstitutionTemplateLiteralBase = NoSubstitutionTemplateLiteralBase;
|
|
241514
|
-
exports.Node =
|
|
241515
|
+
exports.Node = Node3;
|
|
241515
241516
|
exports.NodeWithTypeArguments = NodeWithTypeArguments;
|
|
241516
241517
|
exports.NodeWithTypeArgumentsBase = NodeWithTypeArgumentsBase;
|
|
241517
241518
|
exports.NonNullExpression = NonNullExpression;
|
|
@@ -241697,244 +241698,274 @@ Node text: ${this.#forgottenText}`;
|
|
|
241697
241698
|
});
|
|
241698
241699
|
|
|
241699
241700
|
// ../codemod/src/index.ts
|
|
241700
|
-
var import_ts_morph = __toESM(require_ts_morph(), 1);
|
|
241701
241701
|
import { fileURLToPath } from "url";
|
|
241702
|
+
|
|
241703
|
+
// ../codemod/src/cli/usage.ts
|
|
241704
|
+
import { readFileSync } from "fs";
|
|
241705
|
+
var usage = readFileSync(new URL("./usage.md", import.meta.url), "utf8");
|
|
241706
|
+
function printUsage() {
|
|
241707
|
+
console.error(usage);
|
|
241708
|
+
}
|
|
241709
|
+
|
|
241710
|
+
// ../codemod/src/cli/build-project.ts
|
|
241711
|
+
var import_ts_morph = __toESM(require_ts_morph(), 1);
|
|
241712
|
+
function buildProject(glob, tsconfig) {
|
|
241713
|
+
const project = tsconfig ? new import_ts_morph.Project({ tsConfigFilePath: tsconfig }) : new import_ts_morph.Project({ skipAddingFilesFromTsConfig: true });
|
|
241714
|
+
if (!tsconfig) project.addSourceFilesAtPaths(glob);
|
|
241715
|
+
return project;
|
|
241716
|
+
}
|
|
241717
|
+
|
|
241718
|
+
// ../codemod/src/cli/create-command.ts
|
|
241719
|
+
function createCommand(command) {
|
|
241720
|
+
return (argv) => {
|
|
241721
|
+
const options = command.parse(argv);
|
|
241722
|
+
if (options.help) {
|
|
241723
|
+
printUsage();
|
|
241724
|
+
process.exit(0);
|
|
241725
|
+
}
|
|
241726
|
+
const project = buildProject(options.files, options.tsconfig);
|
|
241727
|
+
const result = command.execute(project, options);
|
|
241728
|
+
if (!options.isDryRun) {
|
|
241729
|
+
project.saveSync();
|
|
241730
|
+
}
|
|
241731
|
+
console.log(result.message);
|
|
241732
|
+
};
|
|
241733
|
+
}
|
|
241734
|
+
|
|
241735
|
+
// ../codemod/src/cli/parse-options.ts
|
|
241702
241736
|
import { parseArgs } from "util";
|
|
241737
|
+
|
|
241738
|
+
// ../codemod/src/cli/constants.ts
|
|
241739
|
+
var DEFAULT_FROM = "createPolymorphicComponent";
|
|
241740
|
+
var DEFAULT_TO = "createContractComponent";
|
|
241741
|
+
var TS_ONLY_GLOB = "**/*.{ts,tsx}";
|
|
241742
|
+
var ALL_SOURCE_GLOB = "**/*.{ts,tsx,cts,mts,js,jsx,cjs,mjs}";
|
|
241743
|
+
|
|
241744
|
+
// ../codemod/src/cli/options.ts
|
|
241745
|
+
var sharedOptions = {
|
|
241746
|
+
"dry-run": { type: "boolean", default: false },
|
|
241747
|
+
verbose: { type: "boolean", default: false },
|
|
241748
|
+
help: { type: "boolean", default: false }
|
|
241749
|
+
};
|
|
241750
|
+
var renameOptions = {
|
|
241751
|
+
from: { type: "string", default: DEFAULT_FROM },
|
|
241752
|
+
to: { type: "string", default: DEFAULT_TO }
|
|
241753
|
+
};
|
|
241754
|
+
var tsconfigOption = {
|
|
241755
|
+
tsconfig: { type: "string" }
|
|
241756
|
+
};
|
|
241757
|
+
|
|
241758
|
+
// ../codemod/src/cli/parse-options.ts
|
|
241759
|
+
function parseOptions(argv, options) {
|
|
241760
|
+
return parseArgs({ args: argv, options, strict: true }).values;
|
|
241761
|
+
}
|
|
241762
|
+
function buildCommandOptions(values) {
|
|
241763
|
+
return {
|
|
241764
|
+
files: values.files,
|
|
241765
|
+
// exactOptionalPropertyTypes: string | undefined is not assignable to tsconfig?: string
|
|
241766
|
+
...values.tsconfig !== void 0 && { tsconfig: values.tsconfig },
|
|
241767
|
+
isDryRun: values["dry-run"],
|
|
241768
|
+
isVerbose: values.verbose,
|
|
241769
|
+
help: values.help
|
|
241770
|
+
};
|
|
241771
|
+
}
|
|
241772
|
+
function parseBaseOptions(argv, defaultGlob) {
|
|
241773
|
+
const values = parseOptions(argv, {
|
|
241774
|
+
files: { type: "string", default: defaultGlob },
|
|
241775
|
+
...sharedOptions
|
|
241776
|
+
});
|
|
241777
|
+
return buildCommandOptions(values);
|
|
241778
|
+
}
|
|
241779
|
+
function parseRenameLikeOptions(argv, defaultGlob) {
|
|
241780
|
+
const values = parseOptions(argv, {
|
|
241781
|
+
...renameOptions,
|
|
241782
|
+
files: { type: "string", default: defaultGlob },
|
|
241783
|
+
...tsconfigOption,
|
|
241784
|
+
...sharedOptions
|
|
241785
|
+
});
|
|
241786
|
+
return { ...buildCommandOptions(values), from: values.from, to: values.to };
|
|
241787
|
+
}
|
|
241788
|
+
var parseMigrateOptions = (argv) => parseRenameLikeOptions(argv, ALL_SOURCE_GLOB);
|
|
241789
|
+
var parseRenameOptions = (argv) => parseRenameLikeOptions(argv, TS_ONLY_GLOB);
|
|
241790
|
+
var parseMigratePathsOptions = (argv) => parseBaseOptions(argv, ALL_SOURCE_GLOB);
|
|
241791
|
+
|
|
241792
|
+
// ../codemod/src/utils.ts
|
|
241793
|
+
function dryRunSuffix(isDryRun) {
|
|
241794
|
+
return isDryRun ? " (dry run \u2014 no files written)" : "";
|
|
241795
|
+
}
|
|
241796
|
+
|
|
241797
|
+
// ../codemod/src/transforms/migrate-paths.ts
|
|
241798
|
+
var import_ts_morph2 = __toESM(require_ts_morph(), 1);
|
|
241799
|
+
|
|
241800
|
+
// ../codemod/src/transforms/constants.ts
|
|
241703
241801
|
var SPECIAL_CASES = {
|
|
241704
241802
|
"@praxis-kit/eslint-plugin": "praxis-kit/eslint"
|
|
241705
241803
|
};
|
|
241804
|
+
var PRAXIS_PACKAGE = /^(?:@praxis-kit|praxis-kit)\//;
|
|
241805
|
+
|
|
241806
|
+
// ../codemod/src/transforms/resolve-replacement.ts
|
|
241706
241807
|
function resolveReplacement(specifier) {
|
|
241707
241808
|
if (!specifier.startsWith("@praxis-kit/")) return void 0;
|
|
241708
241809
|
return SPECIAL_CASES[specifier] ?? specifier.replace("@praxis-kit/", "praxis-kit/");
|
|
241709
241810
|
}
|
|
241710
|
-
var PRAXIS_PACKAGE = /^(?:@praxis-kit|praxis-kit)\//;
|
|
241711
|
-
function printUsage() {
|
|
241712
|
-
console.error(
|
|
241713
|
-
`
|
|
241714
|
-
Usage: praxis-codemod <command> [options]
|
|
241715
|
-
|
|
241716
|
-
Commands:
|
|
241717
|
-
migrate Rewrite import paths and rename the factory function in one pass (recommended)
|
|
241718
|
-
rename Rename a factory function across your codebase (ESM named imports only)
|
|
241719
|
-
migrate-paths Rewrite @praxis-kit/* import paths to praxis-kit/*
|
|
241720
|
-
|
|
241721
|
-
Notes:
|
|
241722
|
-
- Namespace imports (import * as X from '@praxis-kit/react') are not renamed.
|
|
241723
|
-
Migrate those manually after running the codemod.
|
|
241724
|
-
- CJS destructuring (const { fn } = require(...)) is not renamed.
|
|
241725
|
-
- Re-exports (export { fn } from '...') are renamed by the rename command.
|
|
241726
241811
|
|
|
241727
|
-
|
|
241728
|
-
|
|
241729
|
-
|
|
241730
|
-
|
|
241731
|
-
|
|
241732
|
-
|
|
241733
|
-
--files <glob> Glob pattern for files to transform
|
|
241734
|
-
(default for rename: **/*.{ts,tsx})
|
|
241735
|
-
(default for migrate / migrate-paths: **/*.{ts,tsx,cts,mts,js,jsx,cjs,mjs})
|
|
241812
|
+
// ../codemod/src/transforms/utils.ts
|
|
241813
|
+
function logRewrite(isVerbose, isDryRun, message) {
|
|
241814
|
+
if (!isVerbose) return;
|
|
241815
|
+
const prefix = isDryRun ? "[dry-run] " : "";
|
|
241816
|
+
console.log(prefix + message);
|
|
241817
|
+
}
|
|
241736
241818
|
|
|
241737
|
-
|
|
241738
|
-
|
|
241739
|
-
|
|
241740
|
-
|
|
241741
|
-
|
|
241819
|
+
// ../codemod/src/transforms/migrate-paths.ts
|
|
241820
|
+
function rewriteModuleSpecifier(decl, options, filePath) {
|
|
241821
|
+
const specifier = decl.getModuleSpecifierValue();
|
|
241822
|
+
if (specifier === void 0) return 0;
|
|
241823
|
+
const replacement = resolveReplacement(specifier);
|
|
241824
|
+
if (!replacement) return 0;
|
|
241825
|
+
if (!options.isDryRun) decl.setModuleSpecifier(replacement);
|
|
241826
|
+
logRewrite(options.isVerbose, options.isDryRun, `${filePath}: '${specifier}' \u2192 '${replacement}'`);
|
|
241827
|
+
return 1;
|
|
241828
|
+
}
|
|
241829
|
+
function rewriteCallExpression(call, options, filePath) {
|
|
241830
|
+
const expr = call.getExpression();
|
|
241831
|
+
const isRequire = import_ts_morph2.Node.isIdentifier(expr) && expr.getText() === "require";
|
|
241832
|
+
const isDynamic = expr.getKind() === import_ts_morph2.SyntaxKind.ImportKeyword;
|
|
241833
|
+
if (!isRequire && !isDynamic) return 0;
|
|
241834
|
+
const args = call.getArguments();
|
|
241835
|
+
if (args.length !== 1) return 0;
|
|
241836
|
+
const arg = args[0];
|
|
241837
|
+
if (!import_ts_morph2.Node.isStringLiteral(arg)) return 0;
|
|
241838
|
+
const specifier = arg.getLiteralValue();
|
|
241839
|
+
const replacement = resolveReplacement(specifier);
|
|
241840
|
+
if (!replacement) return 0;
|
|
241841
|
+
if (!options.isDryRun) arg.setLiteralValue(replacement);
|
|
241842
|
+
const callKind = isRequire ? "require" : "import";
|
|
241843
|
+
logRewrite(
|
|
241844
|
+
options.isVerbose,
|
|
241845
|
+
options.isDryRun,
|
|
241846
|
+
`${filePath}: ${callKind}('${specifier}') \u2192 ${callKind}('${replacement}')`
|
|
241742
241847
|
);
|
|
241848
|
+
return 1;
|
|
241743
241849
|
}
|
|
241744
241850
|
function migratePathsInProject(project, options) {
|
|
241745
|
-
const { isDryRun, isVerbose } = options;
|
|
241746
241851
|
let totalRewrites = 0;
|
|
241747
241852
|
let filesModified = 0;
|
|
241748
241853
|
for (const sourceFile of project.getSourceFiles()) {
|
|
241749
241854
|
let fileRewrites = 0;
|
|
241750
|
-
const prefix = isDryRun ? "[dry-run] " : "";
|
|
241751
241855
|
const filePath = sourceFile.getFilePath();
|
|
241752
241856
|
for (const decl of [
|
|
241753
241857
|
...sourceFile.getImportDeclarations(),
|
|
241754
241858
|
...sourceFile.getExportDeclarations()
|
|
241755
241859
|
]) {
|
|
241756
|
-
|
|
241757
|
-
if (specifier === void 0) continue;
|
|
241758
|
-
const replacement = resolveReplacement(specifier);
|
|
241759
|
-
if (!replacement) continue;
|
|
241760
|
-
if (!isDryRun) decl.setModuleSpecifier(replacement);
|
|
241761
|
-
fileRewrites++;
|
|
241762
|
-
if (isVerbose) console.log(`${prefix}${filePath}: '${specifier}' \u2192 '${replacement}'`);
|
|
241860
|
+
fileRewrites += rewriteModuleSpecifier(decl, options, filePath);
|
|
241763
241861
|
}
|
|
241764
|
-
for (const call of sourceFile.getDescendantsOfKind(
|
|
241765
|
-
|
|
241766
|
-
const isRequire = import_ts_morph.Node.isIdentifier(expr) && expr.getText() === "require";
|
|
241767
|
-
const isDynamic = expr.getKind() === import_ts_morph.SyntaxKind.ImportKeyword;
|
|
241768
|
-
if (!isRequire && !isDynamic) continue;
|
|
241769
|
-
const args = call.getArguments();
|
|
241770
|
-
if (args.length !== 1) continue;
|
|
241771
|
-
const arg = args[0];
|
|
241772
|
-
if (!import_ts_morph.Node.isStringLiteral(arg)) continue;
|
|
241773
|
-
const specifier = arg.getLiteralValue();
|
|
241774
|
-
const replacement = resolveReplacement(specifier);
|
|
241775
|
-
if (!replacement) continue;
|
|
241776
|
-
if (!isDryRun) arg.setLiteralValue(replacement);
|
|
241777
|
-
fileRewrites++;
|
|
241778
|
-
const callKind = isRequire ? "require" : "import";
|
|
241779
|
-
if (isVerbose)
|
|
241780
|
-
console.log(
|
|
241781
|
-
`${prefix}${filePath}: ${callKind}('${specifier}') \u2192 ${callKind}('${replacement}')`
|
|
241782
|
-
);
|
|
241862
|
+
for (const call of sourceFile.getDescendantsOfKind(import_ts_morph2.SyntaxKind.CallExpression)) {
|
|
241863
|
+
fileRewrites += rewriteCallExpression(call, options, filePath);
|
|
241783
241864
|
}
|
|
241784
241865
|
if (fileRewrites > 0) {
|
|
241785
241866
|
totalRewrites += fileRewrites;
|
|
241786
241867
|
filesModified++;
|
|
241787
241868
|
}
|
|
241788
241869
|
}
|
|
241789
|
-
return {
|
|
241870
|
+
return {
|
|
241871
|
+
totalRewrites,
|
|
241872
|
+
filesModified,
|
|
241873
|
+
message: `Done: ${totalRewrites} path rewrite(s) across ${filesModified} file(s)${dryRunSuffix(options.isDryRun)}.`
|
|
241874
|
+
};
|
|
241790
241875
|
}
|
|
241876
|
+
|
|
241877
|
+
// ../codemod/src/transforms/rename.ts
|
|
241878
|
+
var import_ts_morph3 = __toESM(require_ts_morph(), 1);
|
|
241791
241879
|
function renameInProject(project, options) {
|
|
241792
|
-
const {
|
|
241880
|
+
const { from, to, isDryRun, isVerbose } = options;
|
|
241793
241881
|
let totalRenames = 0;
|
|
241794
241882
|
let filesModified = 0;
|
|
241795
241883
|
for (const sourceFile of project.getSourceFiles()) {
|
|
241796
|
-
const
|
|
241797
|
-
const
|
|
241798
|
-
const
|
|
241884
|
+
const imports = sourceFile.getImportDeclarations().filter((d) => PRAXIS_PACKAGE.test(d.getModuleSpecifierValue() ?? ""));
|
|
241885
|
+
const exports = sourceFile.getExportDeclarations().filter((d) => PRAXIS_PACKAGE.test(d.getModuleSpecifierValue() ?? ""));
|
|
241886
|
+
const matchingImports = imports.flatMap((d) => d.getNamedImports()).filter((i) => i.getName() === from);
|
|
241887
|
+
const matchingExports = exports.flatMap((d) => d.getNamedExports()).filter((e) => e.getName() === from);
|
|
241888
|
+
const count = matchingImports.length + matchingExports.length;
|
|
241799
241889
|
if (count === 0) continue;
|
|
241800
|
-
|
|
241801
|
-
console.log(`${isDryRun ? "[dry-run] " : ""}${sourceFile.getFilePath()}: ${count} rename(s)`);
|
|
241890
|
+
logRewrite(isVerbose, isDryRun, `${sourceFile.getFilePath()}: ${count} rename(s)`);
|
|
241802
241891
|
if (!isDryRun) {
|
|
241803
|
-
for (const
|
|
241804
|
-
const nameNode =
|
|
241805
|
-
if (!
|
|
241806
|
-
if (
|
|
241807
|
-
|
|
241808
|
-
|
|
241809
|
-
|
|
241810
|
-
|
|
241811
|
-
|
|
241812
|
-
|
|
241813
|
-
|
|
241814
|
-
if (!import_ts_morph.Node.isIdentifier(nameNode)) continue;
|
|
241815
|
-
if (namedExport.getAliasNode() !== void 0) {
|
|
241816
|
-
nameNode.replaceWithText(toName);
|
|
241817
|
-
} else {
|
|
241818
|
-
nameNode.rename(toName);
|
|
241819
|
-
}
|
|
241892
|
+
for (const i of matchingImports) {
|
|
241893
|
+
const nameNode = i.getNameNode();
|
|
241894
|
+
if (!import_ts_morph3.Node.isIdentifier(nameNode)) continue;
|
|
241895
|
+
if (i.getAliasNode() !== void 0) nameNode.replaceWithText(to);
|
|
241896
|
+
else nameNode.rename(to);
|
|
241897
|
+
}
|
|
241898
|
+
for (const e of matchingExports) {
|
|
241899
|
+
const nameNode = e.getNameNode();
|
|
241900
|
+
if (!import_ts_morph3.Node.isIdentifier(nameNode)) continue;
|
|
241901
|
+
if (e.getAliasNode() !== void 0) nameNode.replaceWithText(to);
|
|
241902
|
+
else nameNode.rename(to);
|
|
241820
241903
|
}
|
|
241821
241904
|
}
|
|
241822
241905
|
totalRenames += count;
|
|
241823
241906
|
filesModified++;
|
|
241824
241907
|
}
|
|
241825
|
-
return {
|
|
241908
|
+
return {
|
|
241909
|
+
totalRenames,
|
|
241910
|
+
filesModified,
|
|
241911
|
+
message: `Done: ${totalRenames} rename(s) across ${filesModified} file(s)${dryRunSuffix(isDryRun)}.`
|
|
241912
|
+
};
|
|
241826
241913
|
}
|
|
241827
|
-
|
|
241828
|
-
|
|
241829
|
-
|
|
241830
|
-
|
|
241831
|
-
|
|
241832
|
-
|
|
241833
|
-
|
|
241834
|
-
|
|
241835
|
-
|
|
241836
|
-
|
|
241837
|
-
|
|
241838
|
-
files: { type: "string", default: "**/*.{ts,tsx,cts,mts,js,jsx,cjs,mjs}" },
|
|
241839
|
-
tsconfig: { type: "string" },
|
|
241840
|
-
"dry-run": { type: "boolean", default: false },
|
|
241841
|
-
verbose: { type: "boolean", default: false },
|
|
241842
|
-
help: { type: "boolean", default: false }
|
|
241843
|
-
},
|
|
241844
|
-
strict: true
|
|
241845
|
-
});
|
|
241846
|
-
if (values.help) {
|
|
241847
|
-
printUsage();
|
|
241848
|
-
process.exit(0);
|
|
241849
|
-
}
|
|
241850
|
-
const opts = { isDryRun: values["dry-run"], isVerbose: values.verbose };
|
|
241851
|
-
const project = buildProject(values.files, values.tsconfig);
|
|
241852
|
-
const renames = renameInProject(project, { fromName: values.from, toName: values.to, ...opts });
|
|
241853
|
-
const paths = migratePathsInProject(project, opts);
|
|
241854
|
-
if (!opts.isDryRun) project.saveSync();
|
|
241855
|
-
const dryRunNote = opts.isDryRun ? " (dry run \u2014 no files written)" : "";
|
|
241856
|
-
console.log(
|
|
241857
|
-
`
|
|
241858
|
-
Done: ${renames.totalRenames} rename(s) across ${renames.filesModified} file(s), ${paths.totalRewrites} path rewrite(s) across ${paths.filesModified} file(s)${dryRunNote}.`
|
|
241859
|
-
);
|
|
241860
|
-
}
|
|
241861
|
-
function runRename(argv) {
|
|
241862
|
-
const { values } = parseArgs({
|
|
241863
|
-
args: argv,
|
|
241864
|
-
options: {
|
|
241865
|
-
from: { type: "string", default: "createPolymorphicComponent" },
|
|
241866
|
-
to: { type: "string", default: "createContractComponent" },
|
|
241867
|
-
files: { type: "string", default: "**/*.{ts,tsx}" },
|
|
241868
|
-
tsconfig: { type: "string" },
|
|
241869
|
-
"dry-run": { type: "boolean", default: false },
|
|
241870
|
-
verbose: { type: "boolean", default: false },
|
|
241871
|
-
help: { type: "boolean", default: false }
|
|
241872
|
-
},
|
|
241873
|
-
strict: true
|
|
241874
|
-
});
|
|
241875
|
-
if (values.help) {
|
|
241876
|
-
printUsage();
|
|
241877
|
-
process.exit(0);
|
|
241878
|
-
}
|
|
241879
|
-
const opts = { isDryRun: values["dry-run"], isVerbose: values.verbose };
|
|
241880
|
-
const project = buildProject(values.files, values.tsconfig);
|
|
241881
|
-
const { totalRenames, filesModified } = renameInProject(project, {
|
|
241882
|
-
fromName: values.from,
|
|
241883
|
-
toName: values.to,
|
|
241884
|
-
...opts
|
|
241885
|
-
});
|
|
241886
|
-
if (!opts.isDryRun) project.saveSync();
|
|
241887
|
-
const dryRunNote = opts.isDryRun ? " (dry run \u2014 no files written)" : "";
|
|
241888
|
-
console.log(`
|
|
241889
|
-
Done: ${totalRenames} rename(s) across ${filesModified} file(s)${dryRunNote}.`);
|
|
241890
|
-
}
|
|
241891
|
-
function runMigratePaths(argv) {
|
|
241892
|
-
const { values } = parseArgs({
|
|
241893
|
-
args: argv,
|
|
241894
|
-
options: {
|
|
241895
|
-
files: { type: "string", default: "**/*.{ts,tsx,cts,mts,js,jsx,cjs,mjs}" },
|
|
241896
|
-
"dry-run": { type: "boolean", default: false },
|
|
241897
|
-
verbose: { type: "boolean", default: false },
|
|
241898
|
-
help: { type: "boolean", default: false }
|
|
241899
|
-
},
|
|
241900
|
-
strict: true
|
|
241901
|
-
});
|
|
241902
|
-
if (values.help) {
|
|
241903
|
-
printUsage();
|
|
241904
|
-
process.exit(0);
|
|
241905
|
-
}
|
|
241906
|
-
const opts = { isDryRun: values["dry-run"], isVerbose: values.verbose };
|
|
241907
|
-
const project = buildProject(values.files);
|
|
241908
|
-
const { totalRewrites, filesModified } = migratePathsInProject(project, opts);
|
|
241909
|
-
if (!opts.isDryRun) project.saveSync();
|
|
241910
|
-
const dryRunNote = opts.isDryRun ? " (dry run \u2014 no files written)" : "";
|
|
241911
|
-
console.log(
|
|
241912
|
-
`
|
|
241913
|
-
Done: ${totalRewrites} path rewrite(s) across ${filesModified} file(s)${dryRunNote}.`
|
|
241914
|
-
);
|
|
241914
|
+
|
|
241915
|
+
// ../codemod/src/transforms/migrate.ts
|
|
241916
|
+
function migrate(project, options) {
|
|
241917
|
+
const renames = renameInProject(project, options);
|
|
241918
|
+
const paths = migratePathsInProject(project, options);
|
|
241919
|
+
return {
|
|
241920
|
+
renames,
|
|
241921
|
+
paths,
|
|
241922
|
+
filesModified: renames.filesModified + paths.filesModified,
|
|
241923
|
+
message: `Done: ${renames.totalRenames} rename(s) across ${renames.filesModified} file(s), ${paths.totalRewrites} path rewrite(s) across ${paths.filesModified} file(s)${dryRunSuffix(options.isDryRun)}.`
|
|
241924
|
+
};
|
|
241915
241925
|
}
|
|
241926
|
+
|
|
241927
|
+
// ../codemod/src/commands/migrate.ts
|
|
241928
|
+
var runMigrate = createCommand({
|
|
241929
|
+
parse: parseMigrateOptions,
|
|
241930
|
+
execute: migrate
|
|
241931
|
+
});
|
|
241932
|
+
|
|
241933
|
+
// ../codemod/src/commands/migrate-paths.ts
|
|
241934
|
+
var runMigratePaths = createCommand({
|
|
241935
|
+
parse: parseMigratePathsOptions,
|
|
241936
|
+
execute: migratePathsInProject
|
|
241937
|
+
});
|
|
241938
|
+
|
|
241939
|
+
// ../codemod/src/commands/rename.ts
|
|
241940
|
+
var runRename = createCommand({
|
|
241941
|
+
parse: parseRenameOptions,
|
|
241942
|
+
execute: renameInProject
|
|
241943
|
+
});
|
|
241944
|
+
|
|
241945
|
+
// ../codemod/src/index.ts
|
|
241916
241946
|
function main() {
|
|
241917
241947
|
const [, , command, ...rest] = process.argv;
|
|
241918
241948
|
if (!command || command === "--help" || command === "-h") {
|
|
241919
241949
|
printUsage();
|
|
241920
241950
|
process.exit(0);
|
|
241921
241951
|
}
|
|
241922
|
-
|
|
241923
|
-
|
|
241924
|
-
|
|
241925
|
-
|
|
241952
|
+
switch (command) {
|
|
241953
|
+
case "migrate":
|
|
241954
|
+
return runMigrate(rest);
|
|
241955
|
+
case "rename":
|
|
241956
|
+
return runRename(rest);
|
|
241957
|
+
case "migrate-paths":
|
|
241958
|
+
return runMigratePaths(rest);
|
|
241959
|
+
default:
|
|
241960
|
+
console.error(`Unknown command: ${command}
|
|
241926
241961
|
`);
|
|
241927
|
-
|
|
241928
|
-
|
|
241962
|
+
printUsage();
|
|
241963
|
+
process.exit(1);
|
|
241964
|
+
}
|
|
241929
241965
|
}
|
|
241930
241966
|
if (process.argv[1] === fileURLToPath(import.meta.url)) {
|
|
241931
241967
|
main();
|
|
241932
241968
|
}
|
|
241933
|
-
export {
|
|
241934
|
-
migratePathsInProject,
|
|
241935
|
-
renameInProject,
|
|
241936
|
-
resolveReplacement
|
|
241937
|
-
};
|
|
241938
241969
|
/*! Bundled license information:
|
|
241939
241970
|
|
|
241940
241971
|
@ts-morph/common/dist/typescript.js:
|