"use strict"; var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/index.ts var src_exports = {}; __export(src_exports, { cloneNode: () => cloneNode, preserveNode: () => preserveNode, setParentNodes: () => setParentNodes }); module.exports = __toCommonJS(src_exports); // src/clone-node/clone-identifier.ts function cloneIdentifier(node, options) { const text = "text" in node ? node.text : options.typescript.unescapeLeadingUnderscores(node.escapedText); return options.factory.createIdentifier(options.hook("text", text, text)); } // src/clone-node/clone-type-alias-declaration.ts function cloneTypeAliasDeclaration(node, options) { return options.factory.createTypeAliasDeclaration( options.hook("modifiers", options.nextNodes(node.modifiers), node.modifiers), options.hook("name", options.nextNode(node.name), node.name), options.hook("typeParameters", options.nextNodes(node.typeParameters), node.typeParameters), options.hook("type", options.nextNode(node.type), node.type) ); } // src/clone-node/clone-token.ts function cloneToken(node, options) { return options.factory.createToken( options.hook("kind", node.kind, node.kind) ); } // src/clone-node/clone-decorator.ts function cloneDecorator(node, options) { return options.factory.createDecorator(options.hook("expression", options.nextNode(node.expression), node.expression)); } // src/clone-node/clone-type-parameter-declaration.ts function cloneTypeParameterDeclaration(node, options) { return options.factory.createTypeParameterDeclaration( options.hook("modifiers", options.nextNodes(node.modifiers), node.modifiers), options.hook("name", options.nextNode(node.name), node.name), options.hook("constraint", options.nextNode(node.constraint), node.constraint), options.hook("default", options.nextNode(node.default), node.default) ); } // src/clone-node/clone-qualified-name.ts function cloneQualifiedName(node, options) { return options.factory.createQualifiedName(options.hook("left", options.nextNode(node.left), node.left), options.hook("right", options.nextNode(node.right), node.right)); } // src/clone-node/clone-computed-property-name.ts function cloneComputedPropertyName(node, options) { return options.factory.createComputedPropertyName(options.hook("expression", options.nextNode(node.expression), node.expression)); } // src/clone-node/clone-call-signature-declaration.ts function cloneCallSignatureDeclaration(node, options) { return options.factory.createCallSignature( options.hook("typeParameters", options.nextNodes(node.typeParameters), node.typeParameters), options.hook("parameters", options.nextNodes(node.parameters), node.parameters), options.hook("type", options.nextNode(node.type), node.type) ); } // src/clone-node/clone-construct-signature-declaration.ts function cloneConstructSignatureDeclaration(node, options) { return options.factory.createConstructSignature( options.hook("typeParameters", options.nextNodes(node.typeParameters), node.typeParameters), options.hook("parameters", options.nextNodes(node.parameters), node.parameters), options.hook("type", options.nextNode(node.type), node.type) ); } // src/clone-node/clone-variable-declaration.ts function cloneVariableDeclaration(node, options) { const clonedVariableDeclaration = options.factory.createVariableDeclaration( options.hook("name", options.nextNode(node.name), node.name), options.hook("exclamationToken", options.nextNode(node.exclamationToken), node.exclamationToken), options.hook("type", options.nextNode(node.type), node.type), options.hook("initializer", options.nextNode(node.initializer), node.initializer) ); if (node.initializer != null && clonedVariableDeclaration.initializer != null && !options.typescript.isParenthesizedExpression(node.initializer) && options.typescript.isParenthesizedExpression(clonedVariableDeclaration.initializer)) { clonedVariableDeclaration.initializer = clonedVariableDeclaration.initializer.expression; } return clonedVariableDeclaration; } // src/clone-node/clone-variable-declaration-list.ts function cloneVariableDeclarationList(node, options) { return options.factory.createVariableDeclarationList( options.hook("declarations", options.nextNodes(node.declarations), node.declarations), options.hook("flags", node.flags, node.flags) ); } // src/clone-node/clone-variable-statement.ts function cloneVariableStatement(node, options) { return options.factory.createVariableStatement( options.hook("modifiers", options.nextNodes(node.modifiers), node.modifiers), options.hook("declarationList", options.nextNode(node.declarationList), node.declarationList) ); } // src/clone-node/util/get-modifier-likes.ts function getModifierLikes(node) { const modifiers = "modifiers" in node && Array.isArray(node.modifiers) ? node.modifiers : []; if ("decorators" in node && Array.isArray(node.decorators)) { return [...node.decorators, ...modifiers]; } else { return modifiers; } } // src/clone-node/clone-parameter-declaration.ts function cloneParameterDeclaration(node, options) { const modifierLikes = getModifierLikes(node); return options.factory.createParameterDeclaration( options.hook("modifiers", options.nextNodes(modifierLikes), modifierLikes), options.hook("dotDotDotToken", options.nextNode(node.dotDotDotToken), node.dotDotDotToken), options.hook("name", options.nextNode(node.name), node.name), options.hook("questionToken", options.nextNode(node.questionToken), node.questionToken), options.hook("type", options.nextNode(node.type), node.type), options.hook("initializer", options.nextNode(node.initializer), node.initializer) ); } // src/clone-node/clone-binding-element.ts function cloneBindingElement(node, options) { return options.factory.createBindingElement( options.hook("dotDotDotToken", options.nextNode(node.dotDotDotToken), node.dotDotDotToken), options.hook("propertyName", options.nextNode(node.propertyName), node.propertyName), options.hook("name", options.nextNode(node.name), node.name), options.hook("initializer", options.nextNode(node.initializer), node.initializer) ); } // src/clone-node/clone-property-signature.ts function clonePropertySignature(node, options) { return options.factory.createPropertySignature( options.hook("modifiers", options.nextNodes(node.modifiers), node.modifiers), options.hook("name", options.nextNode(node.name), node.name), options.hook("questionToken", options.nextNode(node.questionToken), node.questionToken), options.hook("type", options.nextNode(node.type), node.type) ); } // src/clone-node/clone-property-declaration.ts function clonePropertyDeclaration(node, options) { const modifierLikes = getModifierLikes(node); return options.factory.createPropertyDeclaration( options.hook("modifiers", options.nextNodes(modifierLikes), modifierLikes), options.hook("name", options.nextNode(node.name), node.name), node.questionToken != null ? options.hook("questionToken", options.nextNode(node.questionToken), node.questionToken) : options.hook("exclamationToken", options.nextNode(node.exclamationToken), node.exclamationToken), options.hook("type", options.nextNode(node.type), node.type), options.hook("initializer", options.nextNode(node.initializer), node.initializer) ); } // src/clone-node/clone-property-assignment.ts function clonePropertyAssignment(node, options) { const clonedPropertyAssignment = options.factory.createPropertyAssignment( options.hook("name", options.nextNode(node.name), node.name), options.hook("initializer", options.nextNode(node.initializer), node.initializer) ); if (!options.typescript.isParenthesizedExpression(node.initializer) && options.typescript.isParenthesizedExpression(clonedPropertyAssignment.initializer)) { clonedPropertyAssignment.initializer = clonedPropertyAssignment.initializer.expression; } return clonedPropertyAssignment; } // src/clone-node/clone-shorthand-property-assignment.ts function cloneShorthandPropertyAssignment(node, options) { return options.factory.createShorthandPropertyAssignment( options.hook("name", options.nextNode(node.name), node.name), options.hook("objectAssignmentInitializer", options.nextNode(node.objectAssignmentInitializer), node.objectAssignmentInitializer) ); } // src/clone-node/clone-spread-assignment.ts function cloneSpreadAssignment(node, options) { return options.factory.createSpreadAssignment(options.hook("expression", options.nextNode(node.expression), node.expression)); } // src/clone-node/clone-object-binding-pattern.ts function cloneObjectBindingPattern(node, options) { return options.factory.createObjectBindingPattern(options.hook("elements", options.nextNodes(node.elements), node.elements)); } // src/clone-node/clone-array-binding-pattern.ts function cloneArrayBindingPattern(node, options) { return options.factory.createArrayBindingPattern(options.hook("elements", options.nextNodes(node.elements), node.elements)); } // src/clone-node/clone-function-declaration.ts function cloneFunctionDeclaration(node, options) { const modifierLikes = getModifierLikes(node); return options.factory.createFunctionDeclaration( options.hook("modifiers", options.nextNodes(modifierLikes), modifierLikes), options.hook("asteriskToken", options.nextNode(node.asteriskToken), node.asteriskToken), options.hook("name", options.nextNode(node.name), node.name), options.hook("typeParameters", options.nextNodes(node.typeParameters), node.typeParameters), options.hook("parameters", options.nextNodes(node.parameters), node.parameters), options.hook("type", options.nextNode(node.type), node.type), options.hook("body", options.nextNode(node.body), node.body) ); } // src/clone-node/clone-method-signature.ts function cloneMethodSignature(node, options) { return options.factory.createMethodSignature( options.hook("modifiers", options.nextNodes(node.modifiers), node.modifiers), options.hook("name", options.nextNode(node.name), node.name), options.hook("questionToken", options.nextNode(node.questionToken), node.questionToken), options.hook("typeParameters", options.nextNodes(node.typeParameters), node.typeParameters), options.hook("parameters", options.nextNodes(node.parameters), node.parameters), options.hook("type", options.nextNode(node.type), node.type) ); } // src/clone-node/clone-method-declaration.ts function cloneMethodDeclaration(node, options) { const modifierLikes = getModifierLikes(node); return options.factory.createMethodDeclaration( options.hook("modifiers", options.nextNodes(modifierLikes), modifierLikes), options.hook("asteriskToken", options.nextNode(node.asteriskToken), node.asteriskToken), options.hook("name", options.nextNode(node.name), node.name), options.hook("questionToken", options.nextNode(node.questionToken), node.questionToken), options.hook("typeParameters", options.nextNodes(node.typeParameters), node.typeParameters), options.hook("parameters", options.nextNodes(node.parameters), node.parameters), options.hook("type", options.nextNode(node.type), node.type), options.hook("body", options.nextNode(node.body), node.body) ); } // src/clone-node/clone-constructor-declaration.ts function cloneConstructorDeclaration(node, options) { return options.factory.createConstructorDeclaration( options.hook("modifiers", options.nextNodes(node.modifiers), node.modifiers), options.hook("parameters", options.nextNodes(node.parameters), node.parameters), options.hook("body", options.nextNode(node.body), node.body) ); } // src/clone-node/clone-semicolon-class-element.ts function cloneSemicolonClassElement(_node, options) { return options.factory.createSemicolonClassElement(); } // src/clone-node/clone-get-accessor-declaration.ts function cloneGetAccessorDeclaration(node, options) { const modifierLikes = getModifierLikes(node); return options.factory.createGetAccessorDeclaration( options.hook("modifiers", options.nextNodes(modifierLikes), modifierLikes), options.hook("name", options.nextNode(node.name), node.name), options.hook("parameters", options.nextNodes(node.parameters), node.parameters), options.hook("type", options.nextNode(node.type), node.type), options.hook("body", options.nextNode(node.body), node.body) ); } // src/clone-node/clone-set-accessor-declaration.ts function cloneSetAccessorDeclaration(node, options) { const modifierLikes = getModifierLikes(node); return options.factory.createSetAccessorDeclaration( options.hook("modifiers", options.nextNodes(modifierLikes), modifierLikes), options.hook("name", options.nextNode(node.name), node.name), options.hook("parameters", options.nextNodes(node.parameters), node.parameters), options.hook("body", options.nextNode(node.body), node.body) ); } // src/clone-node/clone-index-signature-declaration.ts function cloneIndexSignatureDeclaration(node, options) { return options.factory.createIndexSignature( options.hook("modifiers", options.nextNodes(node.modifiers), node.modifiers), options.hook("parameters", options.nextNodes(node.parameters), node.parameters), options.hook("type", options.nextNode(node.type), node.type) ); } // src/clone-node/util/is-keyword-type-node.ts function isKeywordTypeNode(node, typescript) { switch (node.kind) { case typescript.SyntaxKind.AnyKeyword: case typescript.SyntaxKind.UnknownKeyword: case typescript.SyntaxKind.BigIntKeyword: case typescript.SyntaxKind.ObjectKeyword: case typescript.SyntaxKind.BooleanKeyword: case typescript.SyntaxKind.StringKeyword: case typescript.SyntaxKind.SymbolKeyword: case typescript.SyntaxKind.VoidKeyword: case typescript.SyntaxKind.UndefinedKeyword: case typescript.SyntaxKind.NullKeyword: case typescript.SyntaxKind.NeverKeyword: return true; } return false; } // src/clone-node/clone-keyword-type-node.ts function cloneKeywordTypeNode(node, options) { return options.factory.createKeywordTypeNode(options.hook("kind", node.kind, node.kind)); } // src/clone-node/clone-import-type-node.ts function cloneImportTypeNode(node, options) { return options.factory.createImportTypeNode( options.hook("argument", options.nextNode(node.argument), node.argument), options.hook("attributes", options.nextNode(node.attributes), node.attributes), options.hook("qualifier", options.nextNode(node.qualifier), node.qualifier), options.hook("typeArguments", options.nextNodes(node.typeArguments), node.typeArguments), options.hook("isTypeOf", node.isTypeOf, node.isTypeOf) ); } // src/clone-node/clone-this-type-node.ts function cloneThisTypeNode(_node, options) { return options.factory.createThisTypeNode(); } // src/clone-node/clone-function-type-node.ts function cloneFunctionTypeNode(node, options) { return options.factory.createFunctionTypeNode( options.hook("typeParameters", options.nextNodes(node.typeParameters), node.typeParameters), options.hook("parameters", options.nextNodes(node.parameters), node.parameters), options.hook("type", options.nextNode(node.type), node.type) ); } // src/clone-node/util/is-node-array.ts function isNodeArray(item) { return item != null && Array.isArray(item) && "pos" in item; } // src/clone-node/util/ensure-node-array.ts function ensureNodeArray(item, factory) { if (item == null || isNodeArray(item)) return item; return factory.createNodeArray(item); } // src/clone-node/clone-constructor-type-node.ts function cloneConstructorTypeNode(node, options) { const updatedNode = options.factory.createConstructorTypeNode( options.hook("modifiers", options.nextNodes(node.modifiers), node.modifiers), options.hook("typeParameters", options.nextNodes(node.typeParameters), node.typeParameters), options.hook("parameters", options.nextNodes(node.parameters), node.parameters), options.hook("type", options.nextNode(node.type), node.type) ); updatedNode.modifiers = ensureNodeArray(options.hook("modifiers", options.nextNodes(node.modifiers), node.modifiers), options.factory); return updatedNode; } // src/clone-node/clone-type-reference-node.ts function cloneTypeReferenceNode(node, options) { return options.factory.createTypeReferenceNode( options.hook("typeName", options.nextNode(node.typeName), node.typeName), options.hook("typeArguments", options.nextNodes(node.typeArguments), node.typeArguments) ); } // src/clone-node/clone-type-predicate-node.ts function cloneTypePredicateNode(node, options) { return options.factory.createTypePredicateNode( options.hook("assertsModifier", options.nextNode(node.assertsModifier), node.assertsModifier), options.hook("parameterName", options.nextNode(node.parameterName), node.parameterName), options.hook("type", options.nextNode(node.type), node.type) ); } // src/clone-node/clone-source-file.ts function cloneSourceFile(node, options) { const updatedSourceFile = options.factory.updateSourceFile( node, options.hook("statements", options.nextNodes(node.statements), node.statements), node.isDeclarationFile, node.referencedFiles, node.typeReferenceDirectives, node.hasNoDefaultLib, node.libReferenceDirectives ); updatedSourceFile.pos = -1; updatedSourceFile.end = -1; return updatedSourceFile; } // src/clone-node/clone-type-query-node.ts function cloneTypeQueryNode(node, options) { return options.factory.createTypeQueryNode(options.hook("exprName", options.nextNode(node.exprName), node.exprName)); } // src/clone-node/clone-type-literal-node.ts function cloneTypeLiteralNode(node, options) { return options.factory.createTypeLiteralNode(options.hook("members", options.nextNodes(node.members), node.members)); } // src/clone-node/clone-array-type-node.ts function cloneArrayTypeNode(node, options) { return options.factory.createArrayTypeNode(options.hook("elementType", options.nextNode(node.elementType), node.elementType)); } // src/clone-node/clone-tuple-type-node.ts function cloneTupleTypeNode(node, options) { if ("elementTypes" in node) { const castNode = node; return options.factory.createTupleTypeNode(options.hook("elements", options.nextNodes(castNode.elementTypes), castNode.elementTypes)); } else { return options.factory.createTupleTypeNode(options.hook("elements", options.nextNodes(node.elements), node.elements)); } } // src/clone-node/clone-optional-type-node.ts function cloneOptionalTypeNode(node, options) { return options.factory.createOptionalTypeNode(options.hook("type", options.nextNode(node.type), node.type)); } // src/clone-node/util/is-optional-type-node.ts function isOptionalTypeNode(node, typescript) { if ("isOptionalTypeNode" in typescript) { return typescript.isOptionalTypeNode(node); } return node.kind === typescript.SyntaxKind.OptionalType; } // src/clone-node/clone-rest-type-node.ts function cloneRestTypeNode(node, options) { return options.factory.createRestTypeNode(options.hook("type", options.nextNode(node.type), node.type)); } // src/clone-node/util/is-rest-type-node.ts function isRestTypeNode(node, typescript) { if ("isRestTypeNode" in typescript) { return typescript.isRestTypeNode(node); } return node.kind === typescript.SyntaxKind.RestType; } // src/clone-node/clone-union-type-node.ts function cloneUnionTypeNode(node, options) { return options.factory.createUnionTypeNode(options.hook("types", options.nextNodes(node.types), node.types)); } // src/clone-node/clone-intersection-type-node.ts function cloneIntersectionTypeNode(node, options) { return options.factory.createIntersectionTypeNode(options.hook("types", options.nextNodes(node.types), node.types)); } // src/clone-node/clone-literal-type-node.ts function cloneLiteralTypeNode(node, options) { return options.factory.createLiteralTypeNode(options.hook("literal", options.nextNode(node.literal), node.literal)); } // src/clone-node/clone-string-literal.ts function cloneStringLiteral(node, options) { return options.factory.createStringLiteral(options.hook("text", node.text, node.text)); } // src/clone-node/util/is-boolean-literal.ts function isBooleanLiteral(node, typescript) { switch (node.kind) { case typescript.SyntaxKind.TrueKeyword: case typescript.SyntaxKind.FalseKeyword: return true; default: return false; } } // src/clone-node/clone-boolean-literal.ts function cloneBooleanLiteral(node, options) { if (node.kind === options.typescript.SyntaxKind.TrueKeyword) { return options.factory.createTrue(); } return options.factory.createFalse(); } // src/clone-node/clone-prefix-unary-expression.ts function clonePrefixUnaryExpression(node, options) { return options.factory.createPrefixUnaryExpression(options.hook("operator", node.operator, node.operator), options.hook("operand", options.nextNode(node.operand), node.operand)); } // src/clone-node/clone-regular-expression-literal.ts function cloneRegularExpressionLiteral(node, options) { return options.factory.createRegularExpressionLiteral(options.hook("text", node.text, node.text)); } // src/clone-node/clone-no-substitution-template-literal.ts function cloneNoSubstitutionTemplateLiteral(node, options) { return options.factory.createNoSubstitutionTemplateLiteral(options.hook("text", node.text, node.text), options.hook("rawText", node.rawText, node.text)); } // src/clone-node/clone-numeric-literal.ts function cloneNumericLiteral(node, options) { return options.factory.createNumericLiteral(options.hook("text", node.text, node.text)); } // src/clone-node/clone-big-int-literal.ts function cloneBigIntLiteral(node, options) { return options.factory.createBigIntLiteral(options.hook("text", node.text, node.text)); } // src/clone-node/clone-conditional-type-node.ts function cloneConditionalTypeNode(node, options) { return options.factory.createConditionalTypeNode( options.hook("checkType", options.nextNode(node.checkType), node.checkType), options.hook("extendsType", options.nextNode(node.extendsType), node.extendsType), options.hook("trueType", options.nextNode(node.trueType), node.trueType), options.hook("falseType", options.nextNode(node.falseType), node.falseType) ); } // src/clone-node/clone-infer-type-node.ts function cloneInferTypeNode(node, options) { return options.factory.createInferTypeNode(options.hook("typeParameter", options.nextNode(node.typeParameter), node.typeParameter)); } // src/clone-node/clone-block.ts function cloneBlock(node, options) { return options.factory.createBlock(options.hook("statements", options.nextNodes(node.statements), node.statements)); } // src/clone-node/clone-throw-statement.ts function cloneThrowStatement(node, options) { return options.factory.createThrowStatement(options.hook("expression", options.nextNode(node.expression), node.expression)); } // src/clone-node/clone-new-expression.ts function cloneNewExpression(node, options) { return options.factory.createNewExpression( options.hook("expression", options.nextNode(node.expression), node.expression), options.hook("typeArguments", options.nextNodes(node.typeArguments), node.typeArguments), options.hook("arguments", options.nextNodes(node.arguments), node.arguments) ); } // src/clone-node/clone-call-expression.ts function cloneCallExpression(node, options) { const clonedCallExpression = options.factory.createCallExpression( options.hook("expression", options.nextNode(node.expression), node.expression), options.hook("typeArguments", options.nextNodes(node.typeArguments), node.typeArguments), options.hook("arguments", options.nextNodes(node.arguments), node.arguments) ); for (let i = 0; i < clonedCallExpression.arguments.length; i++) { const argument = clonedCallExpression.arguments[i]; const nodeArgument = node.arguments[i]; if (nodeArgument != null && argument != null && !options.typescript.isParenthesizedExpression(nodeArgument) && options.typescript.isParenthesizedExpression(argument)) { clonedCallExpression.arguments[i] = argument.expression; } } return clonedCallExpression; } // src/clone-node/clone-expression-statement.ts function cloneExpressionStatement(node, options) { return options.factory.createExpressionStatement(options.hook("expression", options.nextNode(node.expression), node.expression)); } // src/clone-node/clone-expression-with-type-arguments.ts function cloneExpressionWithTypeArguments(node, options) { return options.factory.createExpressionWithTypeArguments( options.hook("expression", options.nextNode(node.expression), node.expression), options.hook("typeArguments", options.nextNodes(node.typeArguments), node.typeArguments) ); } // src/clone-node/clone-property-access-expression.ts function clonePropertyAccessExpression(node, options) { return options.factory.createPropertyAccessExpression( options.hook("expression", options.nextNode(node.expression), node.expression), options.hook("name", options.nextNode(node.name), node.name) ); } // src/clone-node/clone-element-access-expression.ts function cloneElementAccessExpression(node, options) { return options.factory.createElementAccessExpression( options.hook("expression", options.nextNode(node.expression), node.expression), options.hook("argumentExpression", options.nextNode(node.argumentExpression), node.argumentExpression) ); } // src/clone-node/clone-array-literal-expression.ts function cloneArrayLiteralExpression(node, options) { return options.factory.createArrayLiteralExpression(options.hook("elements", options.nextNodes(node.elements), node.elements)); } // src/clone-node/clone-object-literal-expression.ts function cloneObjectLiteralExpression(node, options) { return options.factory.createObjectLiteralExpression(options.hook("properties", options.nextNodes(node.properties), node.properties)); } // src/clone-node/clone-template-expression.ts function cloneTemplateExpression(node, options) { return options.factory.createTemplateExpression( options.hook("head", options.nextNode(node.head), node.head), options.hook("templateSpans", options.nextNodes(node.templateSpans), node.templateSpans) ); } // src/clone-node/clone-template-span.ts function cloneTemplateSpan(node, options) { return options.factory.createTemplateSpan( options.hook("expression", options.nextNode(node.expression), node.expression), options.hook("literal", options.nextNode(node.literal), node.literal) ); } // src/clone-node/clone-template-head.ts function cloneTemplateHead(node, options) { return options.factory.createTemplateHead(options.hook("text", node.text, node.text), options.hook("rawText", node.rawText, node.rawText)); } // src/clone-node/clone-template-middle.ts function cloneTemplateMiddle(node, options) { return options.factory.createTemplateMiddle(options.hook("text", node.text, node.text), options.hook("rawText", node.rawText, node.rawText)); } // src/clone-node/clone-template-tail.ts function cloneTemplateTail(node, options) { return options.factory.createTemplateTail(options.hook("text", node.text, node.text), options.hook("rawText", node.rawText, node.rawText)); } // src/clone-node/clone-conditional-expression.ts function cloneConditionalExpression(node, options) { return options.factory.createConditionalExpression( options.hook("condition", options.nextNode(node.condition), node.condition), options.hook("questionToken", options.nextNode(node.questionToken), node.questionToken), options.hook("whenTrue", options.nextNode(node.whenTrue), node.whenTrue), options.hook("colonToken", options.nextNode(node.colonToken), node.colonToken), options.hook("whenFalse", options.nextNode(node.whenFalse), node.whenFalse) ); } // src/clone-node/clone-binary-expression.ts function cloneBinaryExpression(node, options) { return options.factory.createBinaryExpression( options.hook("left", options.nextNode(node.left), node.left), options.hook("operatorToken", options.nextNode(node.operatorToken), node.operatorToken), options.hook("right", options.nextNode(node.right), node.right) ); } // src/clone-node/clone-parenthesized-expression.ts function cloneParenthesizedExpression(node, options) { return options.factory.createParenthesizedExpression(options.hook("expression", options.nextNode(node.expression), node.expression)); } // src/clone-node/clone-parenthesized-type-node.ts function cloneParenthesizedTypeNode(node, options) { return options.factory.createParenthesizedType(options.hook("type", options.nextNode(node.type), node.type)); } // src/clone-node/clone-arrow-function.ts function cloneArrowFunction(node, options) { return options.factory.createArrowFunction( options.hook("modifiers", options.nextNodes(node.modifiers), node.modifiers), options.hook("typeParameters", options.nextNodes(node.typeParameters), node.typeParameters), options.hook("parameters", options.nextNodes(node.parameters), node.parameters), options.hook("type", options.nextNode(node.type), node.type), options.hook("equalsGreaterThanToken", options.nextNode(node.equalsGreaterThanToken), node.equalsGreaterThanToken), options.hook("body", options.nextNode(node.body), node.body) ); } // src/clone-node/clone-class-declaration.ts function cloneClassDeclaration(node, options) { const modifierLikes = getModifierLikes(node); return options.factory.createClassDeclaration( options.hook("modifiers", options.nextNodes(modifierLikes), modifierLikes), options.hook("name", options.nextNode(node.name), node.name), options.hook("typeParameters", options.nextNodes(node.typeParameters), node.typeParameters), options.hook("heritageClauses", options.nextNodes(node.heritageClauses), node.heritageClauses), options.hook("members", options.nextNodes(node.members), node.members) ); } // src/clone-node/clone-class-expression.ts function cloneClassExpression(node, options) { const modifierLikes = getModifierLikes(node); return options.factory.createClassExpression( options.hook("modifiers", options.nextNodes(modifierLikes), modifierLikes), options.hook("name", options.nextNode(node.name), node.name), options.hook("typeParameters", options.nextNodes(node.typeParameters), node.typeParameters), options.hook("heritageClauses", options.nextNodes(node.heritageClauses), node.heritageClauses), options.hook("members", options.nextNodes(node.members), node.members) ); } // src/clone-node/clone-enum-declaration.ts function cloneEnumDeclaration(node, options) { return options.factory.createEnumDeclaration( options.hook("modifiers", options.nextNodes(node.modifiers), node.modifiers), options.hook("name", options.nextNode(node.name), node.name), options.hook("members", options.nextNodes(node.members), node.members) ); } // src/clone-node/clone-interface-declaration.ts function cloneInterfaceDeclaration(node, options) { return options.factory.createInterfaceDeclaration( options.hook("modifiers", options.nextNodes(node.modifiers), node.modifiers), options.hook("name", options.nextNode(node.name), node.name), options.hook("typeParameters", options.nextNodes(node.typeParameters), node.typeParameters), options.hook("heritageClauses", options.nextNodes(node.heritageClauses), node.heritageClauses), options.hook("members", options.nextNodes(node.members), node.members) ); } // src/clone-node/clone-enum-member.ts function cloneEnumMember(node, options) { return options.factory.createEnumMember( options.hook("name", options.nextNode(node.name), node.name), options.hook("initializer", options.nextNode(node.initializer), node.initializer) ); } // src/clone-node/clone-heritage-clause.ts function cloneHeritageClause(node, options) { return options.factory.createHeritageClause(options.hook("token", node.token, node.token), options.hook("types", options.nextNodes(node.types), node.types)); } // src/clone-node/clone-empty-statement.ts function cloneEmptyStatement(_node, options) { return options.factory.createEmptyStatement(); } // src/clone-node/clone-type-operator-node.ts function cloneTypeOperatorNode(node, options) { return options.factory.createTypeOperatorNode(options.hook("operator", node.operator, node.operator), options.hook("type", options.nextNode(node.type), node.type)); } // src/clone-node/clone-indexed-access-type-node.ts function cloneIndexedAccessTypeNode(node, options) { return options.factory.createIndexedAccessTypeNode( options.hook("objectType", options.nextNode(node.objectType), node.objectType), options.hook("indexType", options.nextNode(node.indexType), node.indexType) ); } // src/clone-node/clone-mapped-type-node.ts function cloneMappedTypeNode(node, options) { return options.factory.createMappedTypeNode( options.hook("readonlyToken", options.nextNode(node.readonlyToken), node.readonlyToken), options.hook("typeParameter", options.nextNode(node.typeParameter), node.typeParameter), options.hook("nameType", options.nextNode(node.nameType), node.nameType), options.hook("questionToken", options.nextNode(node.questionToken), node.questionToken), options.hook("type", options.nextNode(node.type), node.type), ensureNodeArray(options.hook("members", options.nextNodes(node.members), node.members), options.factory) ); } // src/clone-node/clone-omitted-expression.ts function cloneOmittedExpression(_node, options) { return options.factory.createOmittedExpression(); } // src/clone-node/clone-partially-omitted-expression.ts function clonePartiallyEmittedExpression(node, options) { return options.factory.createPartiallyEmittedExpression(options.hook("expression", options.nextNode(node.expression), node.expression)); } // src/clone-node/util/is-partially-emitted-expression.ts function isPartiallyEmittedExpression(node, typescript) { if ("isPartiallyEmittedExpression" in typescript) { return typescript.isPartiallyEmittedExpression(node); } return node.kind === typescript.SyntaxKind.PartiallyEmittedExpression; } // src/clone-node/clone-postfix-unary-expression.ts function clonePostfixUnaryExpression(node, options) { return options.factory.createPostfixUnaryExpression( options.hook("operand", options.nextNode(node.operand), node.operand), options.hook("operator", node.operator, node.operator) ); } // src/clone-node/util/is-null-literal.ts function isNullLiteral(node, typescript) { return node.kind === typescript.SyntaxKind.NullKeyword; } // src/clone-node/clone-null-literal.ts function cloneNullLiteral(_node, options) { return options.factory.createNull(); } // src/clone-node/util/is-this-expression.ts function isThisExpression(node, typescript) { return node.kind === typescript.SyntaxKind.ThisKeyword; } // src/clone-node/clone-this-expression.ts function cloneThisExpression(_node, options) { return options.factory.createThis(); } // src/clone-node/clone-return-statement.ts function cloneReturnStatement(node, options) { return options.factory.createReturnStatement(options.hook("expression", options.nextNode(node.expression), node.expression)); } // src/clone-node/util/is-super-expression.ts function isSuperExpression(node, typescript) { return node.kind === typescript.SyntaxKind.SuperKeyword; } // src/clone-node/clone-super-expression.ts function cloneSuperExpression(_node, options) { return options.factory.createSuper(); } // src/clone-node/clone-delete-expression.ts function cloneDeleteExpression(node, options) { return options.factory.createDeleteExpression(options.hook("expression", options.nextNode(node.expression), node.expression)); } // src/clone-node/clone-as-expression.ts function cloneAsExpression(node, options) { return options.factory.createAsExpression( options.hook("expression", options.nextNode(node.expression), node.expression), options.hook("type", options.nextNode(node.type), node.type) ); } // src/clone-node/clone-type-assertion.ts function cloneTypeAssertion(node, options) { return options.factory.createTypeAssertion( options.hook("type", options.nextNode(node.type), node.type), options.hook("expression", options.nextNode(node.expression), node.expression) ); } // src/clone-node/clone-await-expression.ts function cloneAwaitExpression(node, options) { return options.factory.createAwaitExpression(options.hook("expression", options.nextNode(node.expression), node.expression)); } // src/clone-node/clone-yield-expression.ts function cloneYieldExpression(node, options) { return options.factory.createYieldExpression( options.hook("asteriskToken", options.nextNode(node.asteriskToken), node.asteriskToken), options.hook("expression", options.nextNode(node.expression), node.expression) ); } // src/clone-node/clone-for-of-statement.ts function cloneForOfStatement(node, options) { return options.factory.createForOfStatement( options.hook("awaitModifier", options.nextNode(node.awaitModifier), node.awaitModifier), options.hook("initializer", options.nextNode(node.initializer), node.initializer), options.hook("expression", options.nextNode(node.expression), node.expression), options.hook("statement", options.nextNode(node.statement), node.statement) ); } // src/clone-node/clone-for-in-statement.ts function cloneForInStatement(node, options) { return options.factory.createForInStatement( options.hook("initializer", options.nextNode(node.initializer), node.initializer), options.hook("expression", options.nextNode(node.expression), node.expression), options.hook("statement", options.nextNode(node.statement), node.statement) ); } // src/clone-node/clone-for-statement.ts function cloneForStatement(node, options) { return options.factory.createForStatement( options.hook("initializer", options.nextNode(node.initializer), node.initializer), options.hook("condition", options.nextNode(node.condition), node.condition), options.hook("incrementor", options.nextNode(node.incrementor), node.incrementor), options.hook("statement", options.nextNode(node.statement), node.statement) ); } // src/clone-node/clone-while-statement.ts function cloneWhileStatement(node, options) { return options.factory.createWhileStatement( options.hook("expression", options.nextNode(node.expression), node.expression), options.hook("statement", options.nextNode(node.statement), node.statement) ); } // src/clone-node/clone-labeled-statement.ts function cloneLabeledStatement(node, options) { return options.factory.createLabeledStatement( options.hook("label", options.nextNode(node.label), node.label), options.hook("statement", options.nextNode(node.statement), node.statement) ); } // src/clone-node/clone-break-statement.ts function cloneBreakStatement(node, options) { return options.factory.createBreakStatement(options.hook("label", options.nextNode(node.label), node.label)); } // src/clone-node/clone-continue-statement.ts function cloneContinueStatement(node, options) { return options.factory.createContinueStatement(options.hook("label", options.nextNode(node.label), node.label)); } // src/clone-node/clone-if-statement.ts function cloneIfStatement(node, options) { return options.factory.createIfStatement( options.hook("expression", options.nextNode(node.expression), node.expression), options.hook("thenStatement", options.nextNode(node.thenStatement), node.thenStatement), options.hook("elseStatement", options.nextNode(node.elseStatement), node.elseStatement) ); } // src/clone-node/clone-do-statement.ts function cloneDoStatement(node, options) { return options.factory.createDoStatement( options.hook("statement", options.nextNode(node.statement), node.statement), options.hook("expression", options.nextNode(node.expression), node.expression) ); } // src/clone-node/clone-non-null-expression.ts function cloneNonNullExpression(node, options) { return options.factory.createNonNullExpression(options.hook("expression", options.nextNode(node.expression), node.expression)); } // src/clone-node/clone-type-of-expression.ts function cloneTypeOfExpression(node, options) { return options.factory.createTypeOfExpression(options.hook("expression", options.nextNode(node.expression), node.expression)); } // src/clone-node/clone-void-expression.ts function cloneVoidExpression(node, options) { return options.factory.createVoidExpression(options.hook("expression", options.nextNode(node.expression), node.expression)); } // src/clone-node/clone-function-expression.ts function cloneFunctionExpression(node, options) { return options.factory.createFunctionExpression( options.hook("modifiers", options.nextNodes(node.modifiers), node.modifiers), options.hook("asteriskToken", options.nextNode(node.asteriskToken), node.asteriskToken), options.hook("name", options.nextNode(node.name), node.name), options.hook("typeParameters", options.nextNodes(node.typeParameters), node.typeParameters), options.hook("parameters", options.nextNodes(node.parameters), node.parameters), options.hook("type", options.nextNode(node.type), node.type), options.hook("body", options.nextNode(node.body), node.body) ); } // src/clone-node/clone-spread-element.ts function cloneSpreadElement(node, options) { return options.factory.createSpreadElement(options.hook("expression", options.nextNode(node.expression), node.expression)); } // src/clone-node/clone-tagged-template-expression.ts function cloneTaggedTemplateExpression(node, options) { return options.factory.createTaggedTemplateExpression( options.hook("tag", options.nextNode(node.tag), node.tag), options.hook("typeArguments", options.nextNodes(node.typeArguments), node.typeArguments), options.hook("template", options.nextNode(node.template), node.template) ); } // src/clone-node/clone-meta-property.ts function cloneMetaProperty(node, options) { return options.factory.createMetaProperty(options.hook("keywordToken", node.keywordToken, node.keywordToken), options.hook("name", options.nextNode(node.name), node.name)); } // src/clone-node/clone-jsx-element.ts function cloneJsxElement(node, options) { return options.factory.createJsxElement( options.hook("openingElement", options.nextNode(node.openingElement), node.openingElement), options.hook("children", options.nextNodes(node.children), node.children), options.hook("closingElement", options.nextNode(node.closingElement), node.closingElement) ); } // src/clone-node/clone-jsx-attributes.ts function cloneJsxAttributes(node, options) { return options.factory.createJsxAttributes(options.hook("properties", options.nextNodes(node.properties), node.properties)); } // src/clone-node/clone-jsx-opening-element.ts function cloneJsxOpeningElement(node, options) { return options.factory.createJsxOpeningElement( options.hook("tagName", options.nextNode(node.tagName), node.tagName), options.hook("typeArguments", options.nextNodes(node.typeArguments), node.typeArguments), options.hook("attributes", options.nextNode(node.attributes), node.attributes) ); } // src/clone-node/clone-jsx-self-closing-element.ts function cloneJsxSelfClosingElement(node, options) { return options.factory.createJsxSelfClosingElement( options.hook("tagName", options.nextNode(node.tagName), node.tagName), options.hook("typeArguments", options.nextNodes(node.typeArguments), node.typeArguments), options.hook("attributes", options.nextNode(node.attributes), node.attributes) ); } // src/clone-node/clone-jsx-fragment.ts function cloneJsxFragment(node, options) { return options.factory.createJsxFragment( options.hook("openingFragment", options.nextNode(node.openingFragment), node.openingFragment), options.hook("children", options.nextNodes(node.children), node.children), options.hook("closingFragment", options.nextNode(node.closingFragment), node.closingFragment) ); } // src/clone-node/clone-jsx-opening-fragment.ts function cloneJsxOpeningFragment(_node, options) { return options.factory.createJsxOpeningFragment(); } // src/clone-node/clone-jsx-closing-fragment.ts function cloneJsxClosingFragment(_node, options) { return options.factory.createJsxJsxClosingFragment(); } // src/clone-node/clone-jsx-attribute.ts function cloneJsxAttribute(node, options) { return options.factory.createJsxAttribute( options.hook("name", options.nextNode(node.name), node.name), options.hook("initializer", options.nextNode(node.initializer), node.initializer) ); } // src/clone-node/clone-jsx-spread-attribute.ts function cloneJsxSpreadAttribute(node, options) { return options.factory.createJsxSpreadAttribute(options.hook("expression", options.nextNode(node.expression), node.expression)); } // src/clone-node/clone-jsx-closing-element.ts function cloneJsxClosingElement(node, options) { return options.factory.createJsxClosingElement(options.hook("tagName", options.nextNode(node.tagName), node.tagName)); } // src/clone-node/clone-jsx-expression.ts function cloneJsxExpression(node, options) { return options.factory.createJsxExpression( options.hook("dotDotDotToken", options.nextNode(node.dotDotDotToken), node.dotDotDotToken), options.hook("expression", options.nextNode(node.expression), node.expression) ); } // src/clone-node/clone-jsx-text.ts function cloneJsxText(node, options) { return options.factory.createJsxText( options.hook("text", node.text, node.text), options.hook("containsOnlyTriviaWhiteSpaces", node.containsOnlyTriviaWhiteSpaces, node.containsOnlyTriviaWhiteSpaces) ); } // src/clone-node/util/is-not-emitted-statement.ts function isNotEmittedStatement(node, typescript) { if ("isNotEmittedStatement" in typescript) { return typescript.isNotEmittedStatement(node); } return node.kind === typescript.SyntaxKind.NotEmittedStatement; } // src/clone-node/clone-not-emitted-statement.ts function cloneNotEmittedStatement(node, options) { return options.factory.createNotEmittedStatement(node); } // src/clone-node/util/is-comma-list-expression.ts function isCommaListExpression(node, typescript) { if ("isCommaListExpression" in typescript) { return typescript.isCommaListExpression(node); } return node.kind === typescript.SyntaxKind.CommaListExpression; } // src/clone-node/clone-comma-list-expression.ts function cloneCommaListExpression(node, options) { return options.factory.createCommaListExpression(options.hook("elements", options.nextNodes(node.elements), node.elements)); } // src/clone-node/clone-debugger-statement.ts function cloneDebuggerStatement(_node, options) { return options.factory.createDebuggerStatement(); } // src/clone-node/clone-with-statement.ts function cloneWithStatement(node, options) { return options.factory.createWithStatement( options.hook("expression", options.nextNode(node.expression), node.expression), options.hook("statement", options.nextNode(node.statement), node.statement) ); } // src/clone-node/clone-switch-statement.ts function cloneSwitchStatement(node, options) { return options.factory.createSwitchStatement( options.hook("expression", options.nextNode(node.expression), node.expression), options.hook("caseBlock", options.nextNode(node.caseBlock), node.caseBlock) ); } // src/clone-node/clone-case-block.ts function cloneCaseBlock(node, options) { return options.factory.createCaseBlock(options.hook("clauses", options.nextNodes(node.clauses), node.clauses)); } // src/clone-node/clone-case-clause.ts function cloneCaseClause(node, options) { return options.factory.createCaseClause( options.hook("expression", options.nextNode(node.expression), node.expression), options.hook("statements", options.nextNodes(node.statements), node.statements) ); } // src/clone-node/clone-default-clause.ts function cloneDefaultClause(node, options) { return options.factory.createDefaultClause(options.hook("statements", options.nextNodes(node.statements), node.statements)); } // src/clone-node/clone-try-statement.ts function cloneTryStatement(node, options) { return options.factory.createTryStatement( options.hook("tryBlock", options.nextNode(node.tryBlock), node.tryBlock), options.hook("catchClause", options.nextNode(node.catchClause), node.catchClause), options.hook("finallyBlock", options.nextNode(node.finallyBlock), node.finallyBlock) ); } // src/clone-node/clone-catch-clause.ts function cloneCatchClause(node, options) { return options.factory.createCatchClause( options.hook("variableDeclaration", options.nextNode(node.variableDeclaration), node.variableDeclaration), options.hook("block", options.nextNode(node.block), node.block) ); } // src/clone-node/clone-module-declaration.ts function cloneModuleDeclaration(node, options) { return options.factory.createModuleDeclaration( options.hook("modifiers", options.nextNodes(node.modifiers), node.modifiers), options.hook("name", options.nextNode(node.name), node.name), options.hook("body", options.nextNode(node.body), node.body), options.hook("flags", node.flags, node.flags) ); } // src/clone-node/clone-module-block.ts function cloneModuleBlock(node, options) { return options.factory.createModuleBlock(options.hook("statements", options.nextNodes(node.statements), node.statements)); } // src/clone-node/clone-import-declaration.ts function cloneImportDeclaration(node, options) { return options.factory.createImportDeclaration( options.hook("modifiers", options.nextNodes(node.modifiers), node.modifiers), options.hook("importClause", options.nextNode(node.importClause), node.importClause), options.hook("moduleSpecifier", options.nextNode(node.moduleSpecifier), node.moduleSpecifier), options.hook("attributes", options.nextNode(node.attributes), node.attributes) ); } // src/clone-node/clone-import-equals-declaration.ts function cloneImportEqualsDeclaration(node, options) { return options.factory.createImportEqualsDeclaration( options.hook("modifiers", options.nextNodes(node.modifiers), node.modifiers), options.hook("isTypeOnly", node.isTypeOnly, node.isTypeOnly), options.hook("name", options.nextNode(node.name), node.name), options.hook("moduleReference", options.nextNode(node.moduleReference), node.moduleReference) ); } // src/clone-node/clone-import-clause.ts function cloneImportClause(node, options) { return options.factory.createImportClause( options.hook("isTypeOnly", node.isTypeOnly, node.isTypeOnly), options.hook("name", options.nextNode(node.name), node.name), options.hook("namedBindings", options.nextNode(node.namedBindings), node.namedBindings) ); } // src/clone-node/clone-named-imports.ts function cloneNamedImports(node, options) { return options.factory.createNamedImports(options.hook("elements", options.nextNodes(node.elements), node.elements)); } // src/clone-node/clone-namespace-import.ts function cloneNamespaceImport(node, options) { return options.factory.createNamespaceImport(options.hook("name", options.nextNode(node.name), node.name)); } // src/clone-node/clone-import-specifier.ts function cloneImportSpecifier(node, options) { return options.factory.createImportSpecifier( options.hook("isTypeOnly", node.isTypeOnly, node.isTypeOnly), options.hook("propertyName", options.nextNode(node.propertyName), node.propertyName), options.hook("name", options.nextNode(node.name), node.name) ); } // src/clone-node/clone-external-module-reference.ts function cloneExternalModuleReference(node, options) { return options.factory.createExternalModuleReference(options.hook("expression", options.nextNode(node.expression), node.expression)); } // src/clone-node/clone-namespace-export-declaration.ts function cloneNamespaceExportDeclaration(node, options) { return options.factory.createNamespaceExportDeclaration(options.hook("name", options.nextNode(node.name), node.name)); } // src/clone-node/clone-export-declaration.ts function cloneExportDeclaration(node, options) { return options.factory.createExportDeclaration( options.hook("modifiers", options.nextNodes(node.modifiers), node.modifiers), options.hook("isTypeOnly", node.isTypeOnly, node.isTypeOnly), options.hook("exportClause", options.nextNode(node.exportClause), node.exportClause), options.hook("moduleSpecifier", options.nextNode(node.moduleSpecifier), node.moduleSpecifier), options.hook("attributes", options.nextNode(node.attributes), node.attributes) ); } // src/clone-node/clone-named-exports.ts function cloneNamedExports(node, options) { return options.factory.createNamedExports(options.hook("elements", options.nextNodes(node.elements), node.elements)); } // src/clone-node/clone-export-specifier.ts function cloneExportSpecifier(node, options) { return options.factory.createExportSpecifier( options.hook("isTypeOnly", node.isTypeOnly, node.isTypeOnly), options.hook("propertyName", options.nextNode(node.propertyName), node.propertyName), options.hook("name", options.nextNode(node.name), node.name) ); } // src/clone-node/clone-export-assignment.ts function cloneExportAssignment(node, options) { return options.factory.createExportAssignment( options.hook("modifiers", options.nextNodes(node.modifiers), node.modifiers), options.hook("isExportEquals", node.isExportEquals, node.isExportEquals), options.hook("expression", options.nextNode(node.expression), node.expression) ); } // src/clone-node/util/to-internal-options.ts var import_compatfactory = require("compatfactory"); var import_typescript = __toESM(require("typescript"), 1); function toInternalOptions(options) { const typescript = options.typescript ?? import_typescript.default; return { ...options, typescript, factory: (0, import_compatfactory.ensureNodeFactory)(options.factory ?? typescript), setParents: options.setParents ?? false, setOriginalNodes: options.setOriginalNodes ?? false, preserveSymbols: options.preserveSymbols ?? false, preserveComments: options.preserveComments ?? true, commentRanges: /* @__PURE__ */ new Set(), debug: options.debug ?? false, depth: 0, hook: options.hook ?? (() => ({})), finalize: options.finalize ?? (() => void 0) }; } // src/clone-node/util/is-js-doc-comment.ts function isJsDocComment(node, typescript) { if ("isJSDoc" in typescript) { return typescript.isJSDoc(node); } return node.kind === typescript.SyntaxKind.JSDocComment; } // src/clone-node/clone-js-doc-comment.ts function cloneJsDoc(node, options) { const baseNode = options.factory.createJSDocComment( options.hook("comment", node.comment, node.comment), ensureNodeArray(options.hook("tags", options.nextNodes(node.tags), node.tags), options.factory) ); baseNode.flags = options.hook("flags", node.flags |= 8, node.flags |= 8); return baseNode; } // src/clone-node/util/is-js-doc-unknown-tag.ts function isJsDocUnknownTag(node, typescript) { if ("isJSDocUnknownTag" in typescript) { return typescript.isJSDocUnknownTag(node); } return node.kind === typescript.SyntaxKind.JSDocTag; } // src/clone-node/util/is-js-doc-parameter-tag.ts function isJsDocParameterTag(node, typescript) { if ("isJSDocParameterTag" in typescript) { return typescript.isJSDocParameterTag(node); } return node.kind === typescript.SyntaxKind.JSDocParameterTag; } // src/clone-node/clone-js-doc-parameter-tag.ts function cloneJsDocParameterTag(node, options) { const baseNode = options.factory.createJSDocParameterTag( options.hook("tagName", options.nextNode(node.tagName), node.tagName), options.hook("name", options.nextNode(node.name), node.name), options.hook("isBracketed", node.isBracketed, node.isBracketed), options.hook("typeExpression", options.nextNode(node.typeExpression), node.typeExpression), options.hook("isNameFirst", node.isNameFirst, node.isNameFirst), options.hook("comment", node.comment, node.comment) ); baseNode.flags = options.hook("flags", node.flags |= 8, node.flags |= 8); return baseNode; } // src/clone-node/util/is-js-doc-return-tag.ts function isJsDocReturnTag(node, typescript) { if ("isJSDocReturnTag" in typescript) { return typescript.isJSDocReturnTag(node); } return node.kind === typescript.SyntaxKind.JSDocReturnTag; } // src/clone-node/clone-js-doc-return-tag.ts function cloneJsDocReturnTag(node, options) { const baseNode = options.factory.createJSDocReturnTag( options.hook("tagName", options.nextNode(node.tagName), node.tagName), options.hook("typeExpression", options.nextNode(node.typeExpression), node.typeExpression), options.hook("comment", node.comment, node.comment) ); baseNode.flags = options.hook("flags", node.flags |= 8, node.flags |= 8); return baseNode; } // src/clone-node/util/is-js-doc-type-expression.ts function isJsDocTypeExpression(node, typescript) { if ("isJSDocTypeExpression" in typescript) { return typescript.isJSDocTypeExpression(node); } return node.kind === typescript.SyntaxKind.JSDocTypeExpression; } // src/clone-node/clone-js-doc-type-expression.ts function cloneJsDocTypeExpression(node, options) { const baseNode = options.factory.createJSDocTypeExpression(options.hook("type", options.nextNode(node.type), node.type)); baseNode.flags = options.hook("flags", node.flags |= 8, node.flags |= 8); return baseNode; } // src/clone-node/util/is-js-doc-enum-tag.ts function isJsDocEnumTag(node, typescript) { if ("isJSDocEnumTag" in typescript) { return typescript.isJSDocEnumTag(node); } return node.kind === typescript.SyntaxKind.JSDocEnumTag; } // src/clone-node/clone-js-doc-enum-tag.ts function cloneJsDocEnumTag(node, options) { const baseNode = options.factory.createJSDocEnumTag( options.hook("tagName", options.nextNode(node.tagName), node.tagName), options.hook("typeExpression", options.nextNode(node.typeExpression), node.typeExpression), options.hook("comment", node.comment, node.comment) ); baseNode.flags = options.hook("flags", node.flags |= 8, node.flags |= 8); return baseNode; } // src/clone-node/util/is-js-doc-type-tag.ts function isJsDocTypeTag(node, typescript) { if ("isJSDocTypeTag" in typescript) { return typescript.isJSDocTypeTag(node); } return node.kind === typescript.SyntaxKind.JSDocTypeTag; } // src/clone-node/clone-js-doc-type-tag.ts function cloneJsDocTypeTag(node, options) { const baseNode = options.factory.createJSDocTypeTag( options.hook("tagName", options.nextNode(node.tagName), node.tagName), options.hook("typeExpression", options.nextNode(node.typeExpression), node.typeExpression), options.hook("comment", node.comment, node.comment) ); baseNode.flags = options.hook("flags", node.flags |= 8, node.flags |= 8); return baseNode; } // src/clone-node/util/is-js-doc-all-type.ts function isJsDocAllType(node, typescript) { if ("isJSDocAllType" in typescript) { return typescript.isJSDocAllType(node); } return node.kind === typescript.SyntaxKind.JSDocAllType; } // src/clone-node/clone-js-doc-all-type.ts function cloneJsDocAllType(node, options) { const baseNode = options.factory.createJSDocAllType(); baseNode.flags = options.hook("flags", node.flags |= 8, node.flags |= 8); return baseNode; } // src/clone-node/util/is-js-doc-unknown-type.ts function isJsDocUnknownType(node, typescript) { if ("isJSDocUnknownType" in typescript) { return typescript.isJSDocUnknownType(node); } return node.kind === typescript.SyntaxKind.JSDocUnknownType; } // src/clone-node/clone-js-doc-unknown-type.ts function cloneJsDocUnknownType(node, options) { const baseNode = options.factory.createJSDocUnknownType(); baseNode.flags = options.hook("flags", node.flags |= 8, node.flags |= 8); return baseNode; } // src/clone-node/util/is-js-doc-non-nullable-type.ts function isJsDocNonNullableType(node, typescript) { if ("isJSDocNonNullableType" in typescript) { return typescript.isJSDocNonNullableType(node); } return node.kind === typescript.SyntaxKind.JSDocNonNullableType; } // src/clone-node/clone-js-doc-non-nullable-type.ts function cloneJsDocNonNullableType(node, options) { const baseNode = options.factory.createJSDocNonNullableType(options.hook("type", options.nextNode(node.type), node.type)); baseNode.flags = options.hook("flags", node.flags |= 8, node.flags |= 8); return baseNode; } // src/clone-node/util/is-js-doc-nullable-type.ts function isJsDocNullableType(node, typescript) { if ("isJSDocNullableType" in typescript) { return typescript.isJSDocNullableType(node); } return node.kind === typescript.SyntaxKind.JSDocNullableType; } // src/clone-node/clone-js-doc-nullable-type.ts function cloneJsDocNullableType(node, options) { const baseNode = options.factory.createJSDocNullableType(options.hook("type", options.nextNode(node.type), node.type)); baseNode.flags = options.hook("flags", node.flags |= 8, node.flags |= 8); return baseNode; } // src/clone-node/util/is-js-doc-optional-type.ts function isJsDocOptionalType(node, typescript) { if ("isJSDocOptionalType" in typescript) { return typescript.isJSDocOptionalType(node); } return node.kind === typescript.SyntaxKind.JSDocOptionalType; } // src/clone-node/clone-js-doc-optional-type.ts function cloneJsDocOptionalType(node, options) { const baseNode = options.factory.createJSDocOptionalType(options.hook("type", options.nextNode(node.type), node.type)); baseNode.flags = options.hook("flags", node.flags |= 8, node.flags |= 8); return baseNode; } // src/clone-node/util/is-js-doc-function-type.ts function isJsDocFunctionType(node, typescript) { if ("isJSDocFunctionType" in typescript) { return typescript.isJSDocFunctionType(node); } return node.kind === typescript.SyntaxKind.JSDocFunctionType; } // src/clone-node/clone-js-doc-function-type.ts function cloneJsDocFunctionType(node, options) { const baseNode = options.factory.createJSDocFunctionType( options.hook("parameters", options.nextNodes(node.parameters), node.parameters), options.hook("type", node.type, node.type) ); baseNode.flags = options.hook("flags", node.flags |= 8, node.flags |= 8); return baseNode; } // src/clone-node/util/is-js-doc-variadic-type.ts function isJsDocVariadicType(node, typescript) { if ("isJSDocVariadicType" in typescript) { return typescript.isJSDocVariadicType(node); } return node.kind === typescript.SyntaxKind.JSDocVariadicType; } // src/clone-node/clone-js-doc-variadic-type.ts function cloneJsDocVariadicType(node, options) { const baseNode = options.factory.createJSDocVariadicType(options.hook("type", options.nextNode(node.type), node.type)); baseNode.flags = options.hook("flags", node.flags |= 8, node.flags |= 8); return baseNode; } // src/clone-node/util/is-js-doc-namepath-type.ts function isJsDocNamepathType(node, typescript) { if ("isJSDocNamepathType" in typescript) { return typescript.isJSDocNamepathType(node); } return node.kind === typescript.SyntaxKind.JSDocNamepathType; } // src/clone-node/clone-js-doc-namepath-type.ts function cloneJsDocNamepathType(node, options) { const baseNode = options.factory.createJSDocNamepathType(options.hook("type", options.nextNode(node.type), node.type)); baseNode.flags = options.hook("flags", node.flags |= 8, node.flags |= 8); return baseNode; } // src/clone-node/clone-js-doc-unknown-tag.ts function cloneJsDocUnknownTag(node, options) { const baseNode = options.factory.createJSDocUnknownTag( options.hook("tagName", options.nextNode(node.tagName), node.tagName), options.hook("comment", node.comment, node.comment) ); baseNode.flags = options.hook("flags", node.flags |= 8, node.flags |= 8); return baseNode; } // src/clone-node/util/is-js-doc-augments-tag.ts function isJsDocAugmentsTag(node, typescript) { if ("isJSDocAugmentsTag" in typescript) { return typescript.isJSDocAugmentsTag(node); } return node.kind === typescript.SyntaxKind.JSDocAugmentsTag; } // src/clone-node/clone-js-doc-augments-tag.ts function cloneJsDocAugmentsTag(node, options) { const baseNode = options.factory.createJSDocAugmentsTag( options.hook("tagName", options.nextNode(node.tagName), node.tagName), options.hook("class", options.nextNode(node.class), node.class), options.hook("comment", node.comment, node.comment) ); baseNode.flags = options.hook("flags", node.flags |= 8, node.flags |= 8); return baseNode; } // src/clone-node/util/is-js-doc-author-tag.ts function isJsDocAuthorTag(node, typescript) { if ("isJSDocAuthorTag" in typescript) { return typescript.isJSDocAuthorTag(node); } return node.kind === typescript.SyntaxKind.JSDocAuthorTag; } // src/clone-node/clone-js-doc-author-tag.ts function cloneJsDocAuthorTag(node, options) { const baseNode = options.factory.createJSDocAuthorTag( options.hook("tagName", options.nextNode(node.tagName), node.tagName), options.hook("comment", node.comment, node.comment) ); baseNode.flags = options.hook("flags", node.flags |= 8, node.flags |= 8); return baseNode; } // src/clone-node/util/is-js-doc-class-tag.ts function isJsDocClassTag(node, typescript) { if ("isJSDocClassTag" in typescript) { return typescript.isJSDocClassTag(node); } return node.kind === typescript.SyntaxKind.JSDocClassTag; } // src/clone-node/clone-js-doc-class-tag.ts function cloneJsDocClassTag(node, options) { const baseNode = options.factory.createJSDocClassTag( options.hook("tagName", options.nextNode(node.tagName), node.tagName), options.hook("comment", node.comment, node.comment) ); baseNode.flags = options.hook("flags", node.flags |= 8, node.flags |= 8); return baseNode; } // src/clone-node/util/is-js-doc-this-tag.ts function isJsDocThisTag(node, typescript) { if ("isJSDocThisTag" in typescript) { return typescript.isJSDocThisTag(node); } return node.kind === typescript.SyntaxKind.JSDocThisTag; } // src/clone-node/clone-js-doc-this-tag.ts function cloneJsDocThisTag(node, options) { const baseNode = options.factory.createJSDocThisTag( options.hook("tagName", options.nextNode(node.tagName), node.tagName), options.hook("typeExpression", options.nextNode(node.typeExpression), node.typeExpression), options.hook("comment", node.comment, node.comment) ); baseNode.flags = options.hook("flags", node.flags |= 8, node.flags |= 8); return baseNode; } // src/clone-node/util/is-js-doc-template-tag.ts function isJsDocTemplateTag(node, typescript) { if ("isJSDocTemplateTag" in typescript) { return typescript.isJSDocTemplateTag(node); } return node.kind === typescript.SyntaxKind.JSDocTemplateTag; } // src/clone-node/clone-js-doc-template-tag.ts function cloneJsDocTemplateTag(node, options) { const baseNode = options.factory.createJSDocTemplateTag( options.hook("tagName", options.nextNode(node.tagName), node.tagName), options.hook("constraint", options.nextNode(node.constraint), node.constraint), ensureNodeArray(options.hook("typeParameters", options.nextNodes(node.typeParameters), node.typeParameters), options.factory), options.hook("comment", node.comment, node.comment) ); baseNode.flags = options.hook("flags", node.flags |= 8, node.flags |= 8); return baseNode; } // src/clone-node/util/is-js-doc-typedef-tag.ts function isJsDocTypedefTag(node, typescript) { if ("isJSDocTypedefTag" in typescript) { return typescript.isJSDocTypedefTag(node); } return node.kind === typescript.SyntaxKind.JSDocTypedefTag; } // src/clone-node/clone-js-doc-typedef-tag.ts function cloneJsDocTypedefTag(node, options) { const baseNode = options.factory.createJSDocTypedefTag( options.hook("tagName", options.nextNode(node.tagName), node.tagName), options.hook("typeExpression", options.nextNode(node.typeExpression), node.typeExpression), options.hook("fullName", options.nextNode(node.fullName), node.fullName), options.hook("comment", node.comment, node.comment) ); baseNode.flags = options.hook("flags", node.flags |= 8, node.flags |= 8); baseNode.name = options.hook("name", options.nextNode(node.name), node.name); return baseNode; } // src/clone-node/util/is-js-doc-callback-tag.ts function isJsDocCallbackTag(node, typescript) { if ("isJSDocCallbackTag" in typescript) { return typescript.isJSDocCallbackTag(node); } return node.kind === typescript.SyntaxKind.JSDocCallbackTag; } // src/clone-node/clone-js-doc-callback-tag.ts function cloneJsDocCallbackTag(node, options) { const baseNode = options.factory.createJSDocCallbackTag( options.hook("tagName", options.nextNode(node.tagName), node.tagName), options.hook("typeExpression", options.nextNode(node.typeExpression), node.typeExpression), options.hook("fullName", options.nextNode(node.fullName), node.fullName), options.hook("comment", node.comment, node.comment) ); baseNode.flags = options.hook("flags", node.flags |= 8, node.flags |= 8); baseNode.name = options.hook("name", options.nextNode(node.name), node.name); return baseNode; } // src/clone-node/util/is-js-doc-signature.ts function isJsDocSignature(node, typescript) { if ("isJSDocSignature" in typescript) { return typescript.isJSDocSignature(node); } return node.kind === typescript.SyntaxKind.JSDocSignature; } // src/clone-node/clone-js-doc-signature.ts function cloneJsDocSignature(node, options) { const baseNode = options.factory.createJSDocSignature( options.hook("typeParameters", options.nextNodes(node.typeParameters), node.typeParameters), options.hook("parameters", options.nextNodes(node.parameters), node.parameters), options.hook("type", options.nextNode(node.type), node.type) ); baseNode.flags = options.hook("flags", node.flags |= 8, node.flags |= 8); return baseNode; } // src/clone-node/util/is-js-doc-property-tag.ts function isJsDocPropertyTag(node, typescript) { if ("isJSDocPropertyTag" in typescript) { return typescript.isJSDocPropertyTag(node); } return node.kind === typescript.SyntaxKind.JSDocPropertyTag; } // src/clone-node/clone-js-doc-property-tag.ts function cloneJsDocPropertyTag(node, options) { const baseNode = options.factory.createJSDocPropertyTag( options.hook("tagName", options.nextNode(node.tagName), node.tagName), options.hook("name", options.nextNode(node.name), node.name), options.hook("isBracketed", node.isBracketed, node.isBracketed), options.hook("typeExpression", options.nextNode(node.typeExpression), node.typeExpression), options.hook("isNameFirst", node.isNameFirst, node.isNameFirst), options.hook("comment", node.comment, node.comment) ); baseNode.flags = options.hook("flags", node.flags |= 8, node.flags |= 8); return baseNode; } // src/clone-node/util/is-js-doc-type-literal.ts function isJsDocTypeLiteral(node, typescript) { if ("isJSDocTypeLiteral" in typescript) { return typescript.isJSDocTypeLiteral(node); } return node.kind === typescript.SyntaxKind.JSDocTypeLiteral; } // src/clone-node/clone-js-doc-type-literal.ts function cloneJsDocTypeLiteral(node, options) { const baseNode = options.factory.createJSDocTypeLiteral( options.hook("jsDocPropertyTags", options.nextNodes(node.jsDocPropertyTags), node.jsDocPropertyTags), options.hook("isArrayType", node.isArrayType, node.isArrayType) ); baseNode.flags = options.hook("flags", node.flags |= 8, node.flags |= 8); return baseNode; } // src/clone-node/util/set-parents.ts function fixupParentReferences(rootNode, { deep, propertyName, typescript }) { let parent = rootNode; typescript.forEachChild(rootNode, visitNode); function visitNode(n) { if (n[propertyName] !== parent) { n[propertyName] = parent; const saveParent = parent; parent = n; if (deep) { typescript.forEachChild(n, visitNode); } if (n.jsDoc != null) { for (const jsDocComment of n.jsDoc) { jsDocComment[propertyName] = n; parent = jsDocComment; typescript.forEachChild(jsDocComment, visitNode); } } parent = saveParent; } } } function setParents(node, options) { fixupParentReferences(node, options); return node; } // src/clone-node/util/get-original-node.ts function getOriginalNode(node, options) { if (node._original != null) { return getOriginalNode(node._original, options); } return options.typescript.getOriginalNode(node) ?? node; } // src/clone-node/util/preserve-comments.ts function formatCommentRange({ pos, end }) { return `${pos}:${end}`; } function getCommentRanges(node, options) { const comments = []; const originalNode = getOriginalNode(node, options); const sourceFile = originalNode.getSourceFile(); if (sourceFile == null || originalNode.pos === -1 || originalNode.end === -1) return []; const sourceFileText = sourceFile.getFullText(); const pos = originalNode.getFullStart(); const end = originalNode.getEnd(); const leadingCommentRanges = options.typescript.getLeadingCommentRanges(sourceFileText, pos) ?? []; const trailingCommentRanges = options.typescript.getTrailingCommentRanges(sourceFileText, end) ?? []; if (leadingCommentRanges.length < 1) { const fullTextTrimmed = originalNode.getFullText().trim(); if (fullTextTrimmed.startsWith("//") || fullTextTrimmed.startsWith("/*")) { leadingCommentRanges.push(...options.typescript.getTrailingCommentRanges(sourceFileText, pos) ?? []); } } const commentRanges = [ ...leadingCommentRanges.map((range) => ({ ...range, hasTrailingNewLine: Boolean(range.hasTrailingNewLine), isLeading: true })), ...trailingCommentRanges.map((range) => ({ ...range, hasTrailingNewLine: Boolean(range.hasTrailingNewLine), isLeading: false })) ]; for (const commentRange of commentRanges) { if (options.commentRanges.has(formatCommentRange(commentRange))) continue; options.commentRanges.add(formatCommentRange(commentRange)); let text = sourceFile.text.substring(commentRange.pos, commentRange.end); if (!text.startsWith("//") && !text.startsWith("/*")) continue; const isUsingLineCarriages = text.includes("\r\n"); const isJsDoc = text.startsWith("/**"); text = text.split(/\r?\n/).map((line) => line.trim()).map((line) => !isJsDoc || line.startsWith("/**") ? line : ` ${line}`).join(isUsingLineCarriages ? `\r ` : ` `); if (text.startsWith("/**")) { text = text.slice(2, text.length - 2); } else if (text.startsWith("/*")) { text = text.slice(2, text.length - 2); } else { text = text.slice(2); } comments.push({ ...commentRange, text }); } return comments; } function preserveAllComments(node, options) { if (!options.preserveComments) return; preserveCommentsForOriginalNode(node, options); options.typescript.forEachChild(node, (child) => { preserveAllComments(child, options); }); } function preserveCommentsForOriginalNode(node, options) { if (options.typescript.isSourceFile(node)) return; const originalNode = getOriginalNode(node, options); if (node !== originalNode) preserveComments(node, originalNode, options); } function preserveComments(node, oldNode, options) { if (!options.preserveComments) return node; if (node.pos > -1 && node.end >= -1) { return node; } if (node.jsDoc == null && oldNode.jsDoc != null) { node.jsDoc = oldNode.jsDoc; } const comments = getCommentRanges(oldNode, options); if (comments.length > 0) { options.typescript.setSyntheticLeadingComments(node, void 0); options.typescript.setSyntheticTrailingComments(node, void 0); } for (const { isLeading, text, hasTrailingNewLine, kind } of comments) { if (isLeading) { options.typescript.addSyntheticLeadingComment(node, kind, text, hasTrailingNewLine); } else { options.typescript.addSyntheticTrailingComment(node, kind, text, hasTrailingNewLine); } } return node; } // src/clone-node/util/next-options.ts function nextOptions(options) { return { ...options, depth: options.depth + 1 }; } // src/clone-node/util/payload.ts function payload({ depth }) { return { depth }; } // src/clone-node/clone-namespace-export.ts function cloneNamespaceExport(node, options) { return options.factory.createNamespaceExport(options.hook("name", options.nextNode(node.name), node.name)); } // src/clone-node/util/is-js-doc-readonly-tag.ts function isJsDocReadonlyTag(node, typescript) { if ("isJSDocReadonlyTag" in typescript) { return typescript.isJSDocReadonlyTag(node); } return node.kind === typescript.SyntaxKind.JSDocReadonlyTag; } // src/clone-node/clone-js-doc-readonly-tag.ts function cloneJsDocReadonlyTag(node, options) { const baseNode = options.factory.createJSDocReadonlyTag( options.hook("tagName", options.nextNode(node.tagName), node.tagName), options.hook("comment", node.comment, node.comment) ); baseNode.flags = options.hook("flags", node.flags |= 8, node.flags |= 8); return baseNode; } // src/clone-node/util/is-js-doc-see-tag.ts function isJsDocSeeTag(node, typescript) { if ("isJSDocSeeTag" in typescript) { return typescript.isJSDocSeeTag(node); } return node.kind === typescript.SyntaxKind.JSDocSeeTag; } // src/clone-node/clone-js-doc-see-tag.ts function cloneJsDocSeeTag(node, options) { const baseNode = options.factory.createJSDocSeeTag( options.hook("tagName", options.nextNode(node.tagName), node.tagName), // NOTE: do we want to wrap around `node.name`, which is a // `JSDocNameReference`? options.hook("name", node.name, node.name), options.hook("comment", node.comment, node.comment) ); baseNode.flags = options.hook("flags", node.flags |= 8, node.flags |= 8); return baseNode; } // src/clone-node/util/is-js-doc-private-tag.ts function isJsDocPrivateTag(node, typescript) { if ("isJSDocPrivateTag" in typescript) { return typescript.isJSDocPrivateTag(node); } return node.kind === typescript.SyntaxKind.JSDocPrivateTag; } // src/clone-node/clone-js-doc-private-tag.ts function cloneJsDocPrivateTag(node, options) { const baseNode = options.factory.createJSDocPrivateTag( options.hook("tagName", options.nextNode(node.tagName), node.tagName), options.hook("comment", node.comment, node.comment) ); baseNode.flags = options.hook("flags", node.flags |= 8, node.flags |= 8); return baseNode; } // src/clone-node/util/is-js-doc-protected-tag.ts function isJsDocProtectedTag(node, typescript) { if ("isJSDocProtectedTag" in typescript) { return typescript.isJSDocProtectedTag(node); } return node.kind === typescript.SyntaxKind.JSDocProtectedTag; } // src/clone-node/clone-js-doc-protected-tag.ts function cloneJsDocProtectedTag(node, options) { const baseNode = options.factory.createJSDocProtectedTag( options.hook("tagName", options.nextNode(node.tagName), node.tagName), options.hook("comment", node.comment, node.comment) ); baseNode.flags = options.hook("flags", node.flags |= 8, node.flags |= 8); return baseNode; } // src/clone-node/util/is-js-doc-public-tag.ts function isJsDocPublicTag(node, typescript) { if ("isJSDocPublicTag" in typescript) { return typescript.isJSDocPublicTag(node); } return node.kind === typescript.SyntaxKind.JSDocPublicTag; } // src/clone-node/clone-js-doc-public-tag.ts function cloneJsDocPublicTag(node, options) { const baseNode = options.factory.createJSDocPublicTag( options.hook("tagName", options.nextNode(node.tagName), node.tagName), options.hook("comment", node.comment, node.comment) ); baseNode.flags = options.hook("flags", node.flags |= 8, node.flags |= 8); return baseNode; } // src/clone-node/clone-private-identifier.ts function clonePrivateIdentifier(node, options) { return options.factory.createPrivateIdentifier(options.hook("text", node.text, node.text)); } // src/clone-node/util/to-set-parent-nodes-options.ts var import_typescript2 = __toESM(require("typescript"), 1); function toSetParentNodesOptions(options) { return { typescript: options.typescript ?? import_typescript2.default, propertyName: options.propertyName ?? "parent", deep: options.deep ?? true }; } // src/clone-node/util/is-named-tuple-member.ts function isNamedTupleMember(node, typescript) { return typescript.SyntaxKind.NamedTupleMember != null && node.kind === typescript.SyntaxKind.NamedTupleMember; } // src/clone-node/clone-named-tuple-member.ts function cloneNamedTupleMember(node, options) { return options.factory.createNamedTupleMember( options.hook("dotDotDotToken", options.nextNode(node.dotDotDotToken), node.dotDotDotToken), options.hook("name", options.nextNode(node.name), node.name), options.hook("questionToken", options.nextNode(node.questionToken), node.questionToken), options.hook("type", options.nextNode(node.type), node.type) ); } // src/clone-node/util/is-js-doc-deprecated-tag.ts function isJsDocDeprecatedTag(node, typescript) { if ("JSDocDeprecatedTag" in typescript) { return typescript.isJSDocDeprecatedTag(node); } return node.kind === typescript.SyntaxKind.JSDocDeprecatedTag; } // src/clone-node/clone-js-doc-deprecated-tag.ts function cloneJsDocDeprecatedTag(node, options) { const baseNode = options.factory.createJSDocDeprecatedTag( options.hook("tagName", options.nextNode(node.tagName), node.tagName), options.hook("comment", node.comment, node.comment) ); baseNode.flags = options.hook("flags", node.flags |= 8, node.flags |= 8); return baseNode; } // src/clone-node/util/is-template-literal-type-node.ts function isTemplateLiteralTypeNode(node, typescript) { return typescript.SyntaxKind.TemplateLiteralType != null && node.kind === typescript.SyntaxKind.TemplateLiteralType; } // src/clone-node/clone-template-literal-type-node.ts function cloneTemplateLiteralTypeNode(node, options) { return options.factory.createTemplateLiteralType( options.hook("head", options.nextNode(node.head), node.head), options.hook("templateSpans", options.nextNodes(node.templateSpans), node.templateSpans) ); } // src/clone-node/util/is-template-literal-type-span.ts function isTemplateLiteralTypeSpan(node, typescript) { return typescript.SyntaxKind.TemplateLiteralTypeSpan != null && node.kind === typescript.SyntaxKind.TemplateLiteralTypeSpan; } // src/clone-node/clone-template-literal-type-span.ts function cloneTemplateLiteralTypeSpan(node, options) { return options.factory.createTemplateLiteralTypeSpan( options.hook("type", options.nextNode(node.type), node.type), options.hook("literal", options.nextNode(node.literal), node.literal) ); } // src/clone-node/util/is-js-doc-link.ts function isJsDocLink(node, typescript) { if ("isJSDocLink" in typescript) { return typescript.isJSDocLink(node); } return node.kind === typescript.SyntaxKind.JSDocLink; } // src/clone-node/clone-js-doc-link.ts function cloneJsDocLink(node, options) { const baseNode = options.factory.createJSDocLink( options.hook("name", options.nextNode(node.name), node.name), options.hook("text", node.text, node.text) ); baseNode.flags = options.hook("flags", node.flags |= 8, node.flags |= 8); return baseNode; } // src/clone-node/clone-property-access-chain.ts function clonePropertyAccessChain(node, options) { return options.factory.createPropertyAccessChain( options.hook("expression", options.nextNode(node.expression), node.expression), options.hook("questionDotToken", options.nextNode(node.questionDotToken), node.questionDotToken), options.hook("name", options.nextNode(node.name), node.name) ); } // src/clone-node/clone-class-static-block-declaration.ts function cloneClassStaticBlockDeclaration(node, options) { return options.factory.createClassStaticBlockDeclaration(options.hook("body", options.nextNode(node.body), node.body)); } // src/clone-node/util/is-js-doc-link-code.ts function isJsDocLinkCode(node, typescript) { if ("isJSDocLinkCode" in typescript) { return typescript.isJSDocLinkCode(node); } return node.kind === typescript.SyntaxKind.JSDocLinkCode; } // src/clone-node/clone-js-doc-link-code.ts function cloneJsDocLinkCode(node, options) { const baseNode = options.factory.createJSDocLinkCode( options.hook("name", options.nextNode(node.name), node.name), options.hook("text", node.text, node.text) ); baseNode.flags = options.hook("flags", node.flags |= 8, node.flags |= 8); return baseNode; } // src/clone-node/util/is-js-doc-link-plain.ts function isJsDocLinkPlain(node, typescript) { if ("isJSDocLinkPlain" in typescript) { return typescript.isJSDocLinkPlain(node); } return node.kind === typescript.SyntaxKind.JSDocLinkPlain; } // src/clone-node/clone-js-doc-link-plain.ts function cloneJsDocLinkPlain(node, options) { const baseNode = options.factory.createJSDocLinkPlain( options.hook("name", options.nextNode(node.name), node.name), options.hook("text", node.text, node.text) ); baseNode.flags = options.hook("flags", node.flags |= 8, node.flags |= 8); return baseNode; } // src/clone-node/util/is-js-doc-member-name.ts function isJsDocMemberName(node, typescript) { if ("isJSDocMemberName" in typescript) { return typescript.isJSDocMemberName(node); } return node.kind === typescript.SyntaxKind.JSDocMemberName; } // src/clone-node/clone-js-doc-member-name.ts function cloneJsDocMemberName(node, options) { const baseNode = options.factory.createJSDocMemberName( options.hook("left", options.nextNode(node.left), node.left), options.hook("right", options.nextNode(node.right), node.right) ); baseNode.flags = options.hook("flags", node.flags |= 8, node.flags |= 8); return baseNode; } // src/clone-node/clone-assert-clause.ts function cloneAssertClause(node, options) { return options.factory.createAssertClause( ensureNodeArray(options.hook("elements", options.nextNodes(node.elements), node.elements), options.factory), options.hook("multiLine", node.multiLine, node.multiLine) ); } // src/clone-node/clone-assert-entry.ts function cloneAssertEntry(node, options) { return options.factory.createAssertEntry(options.hook("name", options.nextNode(node.name), node.name), options.hook("value", options.nextNode(node.value), node.value)); } // src/clone-node/util/is-import-type-assertion-container.ts function isImportTypeAssertionContainer(node, typescript) { return ( // eslint-disable-next-line @typescript-eslint/naming-convention typescript.SyntaxKind.ImportTypeAssertionContainer != null && node.kind === typescript.SyntaxKind.ImportTypeAssertionContainer ); } // src/clone-node/clone-import-type-assertion-container.ts function cloneImportTypeAssertionContainer(node, options) { return options.factory.createImportTypeAssertionContainer( options.hook("assertClause", options.nextNode(node.assertClause), node.assertClause), options.hook("multiLine", node.multiLine, node.multiLine) ); } // src/clone-node/clone-satisfies-expression.ts function cloneSatisfiesExpression(node, options) { return options.factory.createSatisfiesExpression( options.hook("expression", options.nextNode(node.expression), node.expression), options.hook("type", options.nextNode(node.type), node.type) ); } // src/clone-node/util/is-js-doc-satisfies-tag.ts function isJsDocSatisfiesTag(node, typescript) { if ("isJSDocSatisfiesTag" in typescript) { return typescript.isJSDocSatisfiesTag(node); } return node.kind === typescript.SyntaxKind.JSDocSatisfiesTag; } // src/clone-node/clone-js-doc-satisfies-tag.ts function cloneJsDocSatisfiesTag(node, options) { const baseNode = options.factory.createJSDocSatisfiesTag( options.hook("tagName", options.nextNode(node.tagName), node.tagName), options.hook("typeExpression", options.nextNode(node.typeExpression), node.typeExpression), options.hook("comment", typeof node.comment === "string" ? node.comment : options.nextNodes(node.comment), node.comment) ); baseNode.flags = options.hook("flags", node.flags |= 8, node.flags |= 8); return baseNode; } // src/clone-node/util/is-js-doc-overload-tag.ts function isJsDocOverloadTag(node, typescript) { if ("isJSDocOverloadTag" in typescript) { return typescript.isJSDocOverloadTag(node); } return node.kind === typescript.SyntaxKind.JSDocOverloadTag; } // src/clone-node/clone-js-doc-overload-tag.ts function cloneJsDocOverloadTag(node, options) { const baseNode = options.factory.createJSDocOverloadTag( options.hook("tagName", options.nextNode(node.tagName), node.tagName), options.hook("typeExpression", options.nextNode(node.typeExpression), node.typeExpression), options.hook("comment", typeof node.comment === "string" ? node.comment : options.nextNodes(node.comment), node.comment) ); baseNode.flags = options.hook("flags", node.flags |= 8, node.flags |= 8); return baseNode; } // src/clone-node/clone-js-doc-throws-tag.ts function cloneJsDocThrowsTag(node, options) { const baseNode = options.factory.createJSDocThrowsTag( options.hook("tagName", options.nextNode(node.tagName), node.tagName), options.hook("typeExpression", options.nextNode(node.typeExpression), node.typeExpression), options.hook("comment", typeof node.comment === "string" ? node.comment : options.nextNodes(node.comment), node.comment) ); baseNode.flags = options.hook("flags", node.flags |= 8, node.flags |= 8); return baseNode; } // src/clone-node/util/is-js-doc-throws-tag.ts function isJsDocThrowsTag(node, typescript) { if ("isJSDocThrowsTag" in typescript) { return typescript.isJSDocThrowsTag(node); } return node.kind === typescript.SyntaxKind.JSDocThrowsTag; } // src/clone-node/util/is-jsx-namespaced-name.ts function isJsxNamespacedName(node, typescript) { if ("isJsxNamespacedName" in typescript) { return typescript.isJsxNamespacedName(node); } return node.kind === typescript.SyntaxKind.JsxNamespacedName; } // src/clone-node/clone-jsx-namespaced-name.ts function cloneJsxNamespacedName(node, options) { return options.factory.createJsxNamespacedName( options.hook("namespace", options.nextNode(node.namespace), node.namespace), options.hook("name", options.nextNode(node.name), node.name) ); } // src/clone-node/clone-import-attributes.ts function cloneImportAttributes(node, options) { return options.factory.createImportAttributes( ensureNodeArray(options.hook("elements", options.nextNodes(node.elements), node.elements), options.factory), options.hook("multiLine", node.multiLine, node.multiLine) ); } // src/clone-node/clone-import-attribute.ts function cloneImportAttribute(node, options) { return options.factory.createImportAttribute(options.hook("name", options.nextNode(node.name), node.name), options.hook("value", options.nextNode(node.value), node.value)); } // src/clone-node/util/is-js-doc-import-tag.ts function isJsDocImportTag(node, typescript) { if ("isJSDocImportTag" in typescript) { return typescript.isJSDocImportTag(node); } return node.kind === typescript.SyntaxKind.JSDocImportTag; } // src/clone-node/clone-js-doc-import-tag.ts function cloneJsDocImportTag(node, options) { const baseNode = options.factory.createJSDocImportTag( options.hook("tagName", options.nextNode(node.tagName), node.tagName), options.hook("importClause", options.nextNode(node.importClause), node.importClause), options.hook("moduleSpecifier", options.nextNode(node.moduleSpecifier), node.moduleSpecifier), options.hook("attributes", options.nextNode(node.attributes), node.attributes), options.hook("comment", typeof node.comment === "string" ? node.comment : options.nextNodes(node.comment), node.comment) ); baseNode.flags = options.hook("flags", node.flags |= 8, node.flags |= 8); return baseNode; } // src/clone-node/clone-node.ts function setParentNodes(node, options) { return setParents(node, toSetParentNodesOptions(options)); } function preserveNode(node, oldNode, options = {}) { const internalOptions = toInternalOptions(options); executePreserveNode(node, oldNode, internalOptions); if (node != null) { const parentValue = node._parent ?? node.parent ?? oldNode?._parent ?? oldNode?.parent; if (internalOptions.setParents) { if (parentValue != null) { node.parent = parentValue; } } else { node._parent = parentValue; } } return node; } function cloneNode(node, options = {}) { if (node === void 0) return void 0; const internalOptions = toInternalOptions(options); const clone = nextNode(node, internalOptions); executePreserveNode(clone, node, internalOptions); if (clone != null) { const parentValue = node._parent ?? node.parent ?? clone._parent ?? clone.parent; if (internalOptions.setParents) { clone.parent = parentValue; } else { clone._parent = parentValue; } } return clone; } function nextNode(node, options) { if (node === void 0) return void 0; const hook = options.hook(node, payload(options)) ?? {}; const visitorOptions = { ...options, nextNode: (actualNode) => nextNode(actualNode, nextOptions(options)), nextNodes: (actualNodes) => nextNodes(actualNodes, nextOptions(options)), hook: (key, newValue, oldValue) => { const callback = hook[key]; if (callback != null) { return callback(newValue, oldValue); } else { return newValue; } } }; const clone = executeCloneNode(node, visitorOptions); if (clone === void 0) return void 0; if (node.jsDoc != null) { clone.jsDoc = visitorOptions.hook("jsDoc", visitorOptions.nextNodes(node.jsDoc), node.jsDoc); } setOriginalNodes(clone, node, options); preserveSymbols(clone, node, options); return options.finalize == null ? clone : options.finalize(clone, node, payload(options)) ?? clone; } function executePreserveNode(node, oldNode, options) { if (node == null || oldNode == null || node === oldNode) return void 0; setParents(node, toSetParentNodesOptions({ ...options, propertyName: options.setParents ? "parent" : "_parent" })); preserveAllComments(node, options); preserveComments(node, oldNode, options); setOriginalNodes(node, oldNode, options); preserveSymbols(node, oldNode, options); } function setOriginalNodes(newNode, oldNode, options) { if (newNode === oldNode) return; if (options.setOriginalNodes) { options.typescript.setOriginalNode(newNode, oldNode); newNode._original = newNode.original; } else { newNode._original = oldNode; } } function preserveSymbols(node, otherNode, options) { if (node === otherNode) return node; const otherSymbol = otherNode._symbol ?? otherNode.symbol; if (otherSymbol != null) { node._symbol = otherSymbol; } if (options.preserveSymbols) { node.symbol = node._symbol; } return node; } function nextNodes(nodes, options) { if (nodes === void 0) return void 0; return nodes.map((node) => nextNode(node, options)); } function executeCloneNode(node, options) { if (node == null) return void 0; if (options.typescript.isSourceFile(node)) { return cloneSourceFile(node, options); } else if (options.typescript.isIdentifier(node)) { return cloneIdentifier(node, options); } else if (options.typescript.isPrivateIdentifier?.(node)) { return clonePrivateIdentifier(node, options); } else if (options.typescript.isTypeAliasDeclaration(node)) { return cloneTypeAliasDeclaration(node, options); } else if (options.typescript.isTypeParameterDeclaration(node)) { return cloneTypeParameterDeclaration(node, options); } else if (options.typescript.isDecorator(node)) { return cloneDecorator(node, options); } else if (options.typescript.isQualifiedName(node)) { return cloneQualifiedName(node, options); } else if (options.typescript.isComputedPropertyName(node)) { return cloneComputedPropertyName(node, options); } else if (options.typescript.isCallSignatureDeclaration(node)) { return cloneCallSignatureDeclaration(node, options); } else if (options.typescript.isConstructSignatureDeclaration(node)) { return cloneConstructSignatureDeclaration(node, options); } else if (options.typescript.isVariableDeclaration(node)) { return cloneVariableDeclaration(node, options); } else if (options.typescript.isVariableDeclarationList(node)) { return cloneVariableDeclarationList(node, options); } else if (options.typescript.isVariableStatement(node)) { return cloneVariableStatement(node, options); } else if (options.typescript.isParameter(node)) { return cloneParameterDeclaration(node, options); } else if (options.typescript.isBindingElement(node)) { return cloneBindingElement(node, options); } else if (options.typescript.isPropertySignature(node)) { return clonePropertySignature(node, options); } else if (options.typescript.isPropertyDeclaration(node)) { return clonePropertyDeclaration(node, options); } else if (options.typescript.isPropertyAssignment(node)) { return clonePropertyAssignment(node, options); } else if (options.typescript.isShorthandPropertyAssignment(node)) { return cloneShorthandPropertyAssignment(node, options); } else if (options.typescript.isSpreadAssignment(node)) { return cloneSpreadAssignment(node, options); } else if (options.typescript.isObjectBindingPattern(node)) { return cloneObjectBindingPattern(node, options); } else if (options.typescript.isArrayBindingPattern(node)) { return cloneArrayBindingPattern(node, options); } else if (options.typescript.isFunctionDeclaration(node)) { return cloneFunctionDeclaration(node, options); } else if (options.typescript.isMethodSignature(node)) { return cloneMethodSignature(node, options); } else if (options.typescript.isMethodDeclaration(node)) { return cloneMethodDeclaration(node, options); } else if (options.typescript.isConstructorDeclaration(node)) { return cloneConstructorDeclaration(node, options); } else if (options.typescript.isSemicolonClassElement(node)) { return cloneSemicolonClassElement(node, options); } else if (options.typescript.isGetAccessorDeclaration(node)) { return cloneGetAccessorDeclaration(node, options); } else if (options.typescript.isSetAccessorDeclaration(node)) { return cloneSetAccessorDeclaration(node, options); } else if (options.typescript.isIndexSignatureDeclaration(node)) { return cloneIndexSignatureDeclaration(node, options); } else if (isKeywordTypeNode(node, options.typescript)) { return cloneKeywordTypeNode(node, options); } else if (options.typescript.isImportTypeNode(node)) { return cloneImportTypeNode(node, options); } else if (options.typescript.isThisTypeNode(node)) { return cloneThisTypeNode(node, options); } else if (options.typescript.isFunctionTypeNode(node)) { return cloneFunctionTypeNode(node, options); } else if (options.typescript.isConstructorTypeNode(node)) { return cloneConstructorTypeNode(node, options); } else if (options.typescript.isTypeReferenceNode(node)) { return cloneTypeReferenceNode(node, options); } else if (options.typescript.isTypePredicateNode(node)) { return cloneTypePredicateNode(node, options); } else if (options.typescript.isTypeQueryNode(node)) { return cloneTypeQueryNode(node, options); } else if (options.typescript.isTypeLiteralNode(node)) { return cloneTypeLiteralNode(node, options); } else if (options.typescript.isArrayTypeNode(node)) { return cloneArrayTypeNode(node, options); } else if (options.typescript.isTupleTypeNode(node)) { return cloneTupleTypeNode(node, options); } else if (isOptionalTypeNode(node, options.typescript)) { return cloneOptionalTypeNode(node, options); } else if (isRestTypeNode(node, options.typescript)) { return cloneRestTypeNode(node, options); } else if (options.typescript.isUnionTypeNode(node)) { return cloneUnionTypeNode(node, options); } else if (options.typescript.isIntersectionTypeNode(node)) { return cloneIntersectionTypeNode(node, options); } else if (options.typescript.isConditionalTypeNode(node)) { return cloneConditionalTypeNode(node, options); } else if (options.typescript.isInferTypeNode(node)) { return cloneInferTypeNode(node, options); } else if (options.typescript.isLiteralTypeNode(node)) { return cloneLiteralTypeNode(node, options); } else if (options.typescript.isStringLiteral(node)) { return cloneStringLiteral(node, options); } else if (isBooleanLiteral(node, options.typescript)) { return cloneBooleanLiteral(node, options); } else if (options.typescript.isRegularExpressionLiteral(node)) { return cloneRegularExpressionLiteral(node, options); } else if (options.typescript.isNoSubstitutionTemplateLiteral(node)) { return cloneNoSubstitutionTemplateLiteral(node, options); } else if (options.typescript.isNumericLiteral(node)) { return cloneNumericLiteral(node, options); } else if (options.typescript.isBigIntLiteral?.(node)) { return cloneBigIntLiteral(node, options); } else if (options.typescript.isArrayLiteralExpression(node)) { return cloneArrayLiteralExpression(node, options); } else if (options.typescript.isObjectLiteralExpression(node)) { return cloneObjectLiteralExpression(node, options); } else if (options.typescript.isPrefixUnaryExpression(node)) { return clonePrefixUnaryExpression(node, options); } else if (options.typescript.isBlock(node)) { return cloneBlock(node, options); } else if (options.typescript.isThrowStatement(node)) { return cloneThrowStatement(node, options); } else if (options.typescript.isReturnStatement(node)) { return cloneReturnStatement(node, options); } else if (options.typescript.isSatisfiesExpression?.(node)) { return cloneSatisfiesExpression(node, options); } else if (options.typescript.isNewExpression(node)) { return cloneNewExpression(node, options); } else if (options.typescript.isCallExpression(node)) { return cloneCallExpression(node, options); } else if (options.typescript.isExpressionStatement(node)) { return cloneExpressionStatement(node, options); } else if (options.typescript.isExpressionWithTypeArguments(node)) { return cloneExpressionWithTypeArguments(node, options); } else if (options.typescript.isPropertyAccessChain?.(node)) { return clonePropertyAccessChain(node, options); } else if (options.typescript.isPropertyAccessExpression(node)) { return clonePropertyAccessExpression(node, options); } else if (options.typescript.isElementAccessExpression(node)) { return cloneElementAccessExpression(node, options); } else if (options.typescript.isTemplateExpression(node)) { return cloneTemplateExpression(node, options); } else if (options.typescript.isTemplateSpan(node)) { return cloneTemplateSpan(node, options); } else if (options.typescript.isTemplateHead(node)) { return cloneTemplateHead(node, options); } else if (options.typescript.isTemplateMiddle(node)) { return cloneTemplateMiddle(node, options); } else if (options.typescript.isTemplateTail(node)) { return cloneTemplateTail(node, options); } else if (options.typescript.isConditionalExpression(node)) { return cloneConditionalExpression(node, options); } else if (options.typescript.isBinaryExpression(node)) { return cloneBinaryExpression(node, options); } else if (options.typescript.isParenthesizedExpression(node)) { return cloneParenthesizedExpression(node, options); } else if (options.typescript.isParenthesizedTypeNode(node)) { return cloneParenthesizedTypeNode(node, options); } else if (options.typescript.isArrowFunction(node)) { return cloneArrowFunction(node, options); } else if (options.typescript.isClassDeclaration(node)) { return cloneClassDeclaration(node, options); } else if (options.typescript.isClassExpression(node)) { return cloneClassExpression(node, options); } else if (options.typescript.isEnumDeclaration(node)) { return cloneEnumDeclaration(node, options); } else if (options.typescript.isEnumMember(node)) { return cloneEnumMember(node, options); } else if (options.typescript.isInterfaceDeclaration(node)) { return cloneInterfaceDeclaration(node, options); } else if (options.typescript.isHeritageClause(node)) { return cloneHeritageClause(node, options); } else if (options.typescript.isEmptyStatement(node)) { return cloneEmptyStatement(node, options); } else if (options.typescript.isAsExpression(node)) { return cloneAsExpression(node, options); } else if ("isTypeAssertionExpression" in options.typescript && options.typescript.isTypeAssertionExpression(node) || !("isTypeAssertionExpression" in options.typescript) && "isTypeAssertion" in options.typescript && Boolean(options.typescript.isTypeAssertion(node))) { return cloneTypeAssertion(node, options); } else if (options.typescript.isAwaitExpression(node)) { return cloneAwaitExpression(node, options); } else if (options.typescript.isYieldExpression(node)) { return cloneYieldExpression(node, options); } else if (options.typescript.isForOfStatement(node)) { return cloneForOfStatement(node, options); } else if (options.typescript.isForInStatement(node)) { return cloneForInStatement(node, options); } else if (options.typescript.isForStatement(node)) { return cloneForStatement(node, options); } else if (options.typescript.isWhileStatement(node)) { return cloneWhileStatement(node, options); } else if (options.typescript.isLabeledStatement(node)) { return cloneLabeledStatement(node, options); } else if (options.typescript.isBreakStatement(node)) { return cloneBreakStatement(node, options); } else if (options.typescript.isContinueStatement(node)) { return cloneContinueStatement(node, options); } else if (options.typescript.isIfStatement(node)) { return cloneIfStatement(node, options); } else if (options.typescript.isDoStatement(node)) { return cloneDoStatement(node, options); } else if (options.typescript.isNonNullExpression(node)) { return cloneNonNullExpression(node, options); } else if (options.typescript.isTypeOperatorNode(node)) { return cloneTypeOperatorNode(node, options); } else if (options.typescript.isIndexedAccessTypeNode(node)) { return cloneIndexedAccessTypeNode(node, options); } else if (options.typescript.isMappedTypeNode?.(node)) { return cloneMappedTypeNode(node, options); } else if (options.typescript.isOmittedExpression(node)) { return cloneOmittedExpression(node, options); } else if (isPartiallyEmittedExpression(node, options.typescript)) { return clonePartiallyEmittedExpression(node, options); } else if (options.typescript.isPostfixUnaryExpression(node)) { return clonePostfixUnaryExpression(node, options); } else if (isNullLiteral(node, options.typescript)) { return cloneNullLiteral(node, options); } else if (isThisExpression(node, options.typescript)) { return cloneThisExpression(node, options); } else if (isSuperExpression(node, options.typescript)) { return cloneSuperExpression(node, options); } else if (options.typescript.isDeleteExpression(node)) { return cloneDeleteExpression(node, options); } else if (options.typescript.isTypeOfExpression(node)) { return cloneTypeOfExpression(node, options); } else if (options.typescript.isVoidExpression(node)) { return cloneVoidExpression(node, options); } else if (options.typescript.isFunctionExpression(node)) { return cloneFunctionExpression(node, options); } else if (options.typescript.isSpreadElement(node)) { return cloneSpreadElement(node, options); } else if (options.typescript.isTaggedTemplateExpression(node)) { return cloneTaggedTemplateExpression(node, options); } else if (options.typescript.isMetaProperty(node)) { return cloneMetaProperty(node, options); } else if (options.typescript.isJsxElement(node)) { return cloneJsxElement(node, options); } else if (options.typescript.isJsxAttributes(node)) { return cloneJsxAttributes(node, options); } else if (options.typescript.isJsxOpeningElement(node)) { return cloneJsxOpeningElement(node, options); } else if (options.typescript.isJsxSelfClosingElement(node)) { return cloneJsxSelfClosingElement(node, options); } else if (options.typescript.isJsxFragment(node)) { return cloneJsxFragment(node, options); } else if (options.typescript.isJsxOpeningFragment(node)) { return cloneJsxOpeningFragment(node, options); } else if (options.typescript.isJsxClosingFragment(node)) { return cloneJsxClosingFragment(node, options); } else if (options.typescript.isJsxAttribute(node)) { return cloneJsxAttribute(node, options); } else if (options.typescript.isJsxSpreadAttribute(node)) { return cloneJsxSpreadAttribute(node, options); } else if (options.typescript.isJsxClosingElement(node)) { return cloneJsxClosingElement(node, options); } else if (options.typescript.isJsxExpression(node)) { return cloneJsxExpression(node, options); } else if (options.typescript.isJsxText(node)) { return cloneJsxText(node, options); } else if (isJsxNamespacedName(node, options.typescript)) { return cloneJsxNamespacedName(node, options); } else if (isNotEmittedStatement(node, options.typescript)) { return cloneNotEmittedStatement(node, options); } else if (isCommaListExpression(node, options.typescript)) { return cloneCommaListExpression(node, options); } else if (options.typescript.isDebuggerStatement(node)) { return cloneDebuggerStatement(node, options); } else if (options.typescript.isWithStatement(node)) { return cloneWithStatement(node, options); } else if (options.typescript.isSwitchStatement(node)) { return cloneSwitchStatement(node, options); } else if (options.typescript.isCaseBlock(node)) { return cloneCaseBlock(node, options); } else if (options.typescript.isCaseClause(node)) { return cloneCaseClause(node, options); } else if (options.typescript.isDefaultClause(node)) { return cloneDefaultClause(node, options); } else if (options.typescript.isTryStatement(node)) { return cloneTryStatement(node, options); } else if (options.typescript.isCatchClause(node)) { return cloneCatchClause(node, options); } else if (options.typescript.isModuleDeclaration(node)) { return cloneModuleDeclaration(node, options); } else if (options.typescript.isModuleBlock(node)) { return cloneModuleBlock(node, options); } else if (options.typescript.isImportEqualsDeclaration(node)) { return cloneImportEqualsDeclaration(node, options); } else if (options.typescript.isExternalModuleReference(node)) { return cloneExternalModuleReference(node, options); } else if (options.typescript.isImportDeclaration(node)) { return cloneImportDeclaration(node, options); } else if (options.typescript.isImportClause(node)) { return cloneImportClause(node, options); } else if (options.typescript.isNamedImports(node)) { return cloneNamedImports(node, options); } else if (options.typescript.isNamespaceImport(node)) { return cloneNamespaceImport(node, options); } else if (options.typescript.isImportSpecifier(node)) { return cloneImportSpecifier(node, options); } else if (options.typescript.isNamespaceExportDeclaration(node)) { return cloneNamespaceExportDeclaration(node, options); } else if (options.typescript.isExportDeclaration(node)) { return cloneExportDeclaration(node, options); } else if (options.typescript.isNamedExports(node)) { return cloneNamedExports(node, options); } else if (options.typescript.isNamespaceExport?.(node)) { return cloneNamespaceExport(node, options); } else if (isNamedTupleMember(node, options.typescript)) { return cloneNamedTupleMember(node, options); } else if (options.typescript.isClassStaticBlockDeclaration?.(node)) { return cloneClassStaticBlockDeclaration(node, options); } else if (options.typescript.isImportAttributes?.(node)) { return cloneImportAttributes(node, options); } else if (options.typescript.isImportAttribute?.(node)) { return cloneImportAttribute(node, options); } else if (options.typescript.isAssertClause?.(node)) { return cloneAssertClause(node, options); } else if (options.typescript.isAssertEntry?.(node)) { return cloneAssertEntry(node, options); } else if (isImportTypeAssertionContainer(node, options.typescript)) { return cloneImportTypeAssertionContainer(node, options); } else if (options.typescript.isExportSpecifier(node)) { return cloneExportSpecifier(node, options); } else if (options.typescript.isExportAssignment(node)) { return cloneExportAssignment(node, options); } else if (isJsDocComment(node, options.typescript)) { return cloneJsDoc(node, options); } else if (isJsDocParameterTag(node, options.typescript)) { return cloneJsDocParameterTag(node, options); } else if (isJsDocReturnTag(node, options.typescript)) { return cloneJsDocReturnTag(node, options); } else if (isJsDocTypeExpression(node, options.typescript)) { return cloneJsDocTypeExpression(node, options); } else if (isJsDocEnumTag(node, options.typescript)) { return cloneJsDocEnumTag(node, options); } else if (isJsDocTypeTag(node, options.typescript)) { return cloneJsDocTypeTag(node, options); } else if (isJsDocAllType(node, options.typescript)) { return cloneJsDocAllType(node, options); } else if (isJsDocUnknownType(node, options.typescript)) { return cloneJsDocUnknownType(node, options); } else if (isJsDocNonNullableType(node, options.typescript)) { return cloneJsDocNonNullableType(node, options); } else if (isJsDocNullableType(node, options.typescript)) { return cloneJsDocNullableType(node, options); } else if (isJsDocOptionalType(node, options.typescript)) { return cloneJsDocOptionalType(node, options); } else if (isJsDocFunctionType(node, options.typescript)) { return cloneJsDocFunctionType(node, options); } else if (isJsDocVariadicType(node, options.typescript)) { return cloneJsDocVariadicType(node, options); } else if (isJsDocNamepathType(node, options.typescript)) { return cloneJsDocNamepathType(node, options); } else if (isJsDocUnknownTag(node, options.typescript)) { return cloneJsDocUnknownTag(node, options); } else if (isJsDocAugmentsTag(node, options.typescript)) { return cloneJsDocAugmentsTag(node, options); } else if (isJsDocAuthorTag(node, options.typescript)) { return cloneJsDocAuthorTag(node, options); } else if (isJsDocClassTag(node, options.typescript)) { return cloneJsDocClassTag(node, options); } else if (isJsDocThisTag(node, options.typescript)) { return cloneJsDocThisTag(node, options); } else if (isJsDocTemplateTag(node, options.typescript)) { return cloneJsDocTemplateTag(node, options); } else if (isJsDocTypedefTag(node, options.typescript)) { return cloneJsDocTypedefTag(node, options); } else if (isJsDocDeprecatedTag(node, options.typescript)) { return cloneJsDocDeprecatedTag(node, options); } else if (isJsDocCallbackTag(node, options.typescript)) { return cloneJsDocCallbackTag(node, options); } else if (isJsDocSignature(node, options.typescript)) { return cloneJsDocSignature(node, options); } else if (isJsDocPropertyTag(node, options.typescript)) { return cloneJsDocPropertyTag(node, options); } else if (isJsDocTypeLiteral(node, options.typescript)) { return cloneJsDocTypeLiteral(node, options); } else if (isJsDocReadonlyTag(node, options.typescript)) { return cloneJsDocReadonlyTag(node, options); } else if (isJsDocSeeTag(node, options.typescript)) { return cloneJsDocSeeTag(node, options); } else if (isJsDocLink(node, options.typescript)) { return cloneJsDocLink(node, options); } else if (isJsDocPrivateTag(node, options.typescript)) { return cloneJsDocPrivateTag(node, options); } else if (isJsDocProtectedTag(node, options.typescript)) { return cloneJsDocProtectedTag(node, options); } else if (isJsDocPublicTag(node, options.typescript)) { return cloneJsDocPublicTag(node, options); } else if (isJsDocLinkCode(node, options.typescript)) { return cloneJsDocLinkCode(node, options); } else if (isJsDocLinkPlain(node, options.typescript)) { return cloneJsDocLinkPlain(node, options); } else if (isJsDocMemberName(node, options.typescript)) { return cloneJsDocMemberName(node, options); } else if (isJsDocSatisfiesTag(node, options.typescript)) { return cloneJsDocSatisfiesTag(node, options); } else if (isJsDocImportTag(node, options.typescript)) { return cloneJsDocImportTag(node, options); } else if (isJsDocOverloadTag(node, options.typescript)) { return cloneJsDocOverloadTag(node, options); } else if (isJsDocThrowsTag(node, options.typescript)) { return cloneJsDocThrowsTag(node, options); } else if (options.typescript.isToken(node)) { return cloneToken(node, options); } else if (isTemplateLiteralTypeNode(node, options.typescript)) { return cloneTemplateLiteralTypeNode(node, options); } else if (isTemplateLiteralTypeSpan(node, options.typescript)) { return cloneTemplateLiteralTypeSpan(node, options); } throw new TypeError(`Could not handle Node of kind: '${options.typescript.SyntaxKind[node.kind]}'`); } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { cloneNode, preserveNode, setParentNodes }); //# sourceMappingURL=index.cjs.map