import { $ as DeclareModuleExports, $i as TSTypeParameter, $n as ObjectExpression, $r as TSBooleanKeyword, $t as IfStatement, A as ClassBody, Aa as UnionTypeAnnotation, Ai as TSNeverKeyword, An as LVal, Ar as RegexLiteral$1, At as ExportSpecifier, B as CompletionStatement, Ba as WithStatement, Bi as TSRestType, Bn as ModuleDeclaration, Br as StaticBlock, Bt as For, C as BooleanLiteralTypeAnnotation, Ca as TypeParameter, Ci as TSLiteralType, Cn as JSXMemberExpression, Cr as PrivateName, Ct as ExistsTypeAnnotation, D as CatchClause, Da as TypeofTypeAnnotation, Di as TSModuleDeclaration, Dn as JSXSpreadAttribute, Dr as QualifiedTypeIdentifier, Dt as ExportDefaultSpecifier, E as CallExpression, Ea as TypeScript, Ei as TSModuleBlock, En as JSXOpeningFragment, Er as Pureish, Et as ExportDefaultDeclaration, F as ClassPrivateMethod, Fa as VariableDeclarator, Fi as TSOptionalType, Fn as MemberExpression, Fr as SequenceExpression, Ft as Flow, G as DecimalLiteral, Gi as TSTupleType, Gn as Noop, Gr as SwitchCase, Gt as Function, H as ConditionalExpression, Ha as index_d_exports$1, Hi as TSStringKeyword, Hn as ModuleSpecifier, Hr as StringLiteralTypeAnnotation, Ht as ForOfStatement, I as ClassPrivateProperty, Ia as Variance, Ii as TSParameterProperty, In as MetaProperty, Ir as SpreadElement, It as FlowBaseAnnotation, J as DeclareExportAllDeclaration, Ji as TSTypeAnnotation, Jn as NullableTypeAnnotation, Jr as TSAnyKeyword, Jt as FunctionParent, K as Declaration, Ki as TSType, Kn as NullLiteral, Kr as SwitchStatement, Kt as FunctionDeclaration, L as ClassProperty, La as VoidTypeAnnotation, Li as TSParenthesizedType, Ln as Method, Lr as SpreadProperty$1, Lt as FlowDeclaration, M as ClassExpression, Ma as UserWhitespacable, Mi as TSNullKeyword, Mn as Literal, Mr as RestProperty$1, Mt as ExpressionStatement, N as ClassImplements, Na as V8IntrinsicIdentifier, Ni as TSNumberKeyword, Nn as LogicalExpression, Nr as ReturnStatement, Nt as ExpressionWrapper, O as Class, Oa as UnaryExpression, Oi as TSNamedTupleMember, On as JSXSpreadChild, Or as RecordExpression, Ot as ExportNamedDeclaration, P as ClassMethod, Pa as VariableDeclaration, Pi as TSObjectKeyword, Pn as Loop, Pr as Scopable, Pt as File, Q as DeclareModule, Qi as TSTypeOperator, Qn as NumericLiteral, Qr as TSBigIntKeyword, Qt as Identifier, R as Comment, Ra as While, Ri as TSPropertySignature, Rn as Miscellaneous, Rr as Standardized, Rt as FlowPredicate, S as BooleanLiteral, Sa as TypeCastExpression, Si as TSIntrinsicKeyword, Sn as JSXIdentifier, Sr as Private, St as EnumSymbolBody, T as BreakStatement, Ta as TypeParameterInstantiation, Ti as TSMethodSignature, Tn as JSXOpeningElement, Tr as Property, Tt as ExportDeclaration, U as ContinueStatement, Ui as TSSymbolKeyword, Un as NewExpression, Ur as StringTypeAnnotation, Ut as ForStatement, V as Conditional, Va as YieldExpression, Vi as TSSatisfiesExpression, Vn as ModuleExpression, Vr as StringLiteral, Vt as ForInStatement, W as DebuggerStatement, Wi as TSThisType, Wn as Node$1, Wr as Super, Wt as ForXStatement, X as DeclareFunction, Xi as TSTypeElement, Xn as NumberLiteralTypeAnnotation, Xr as TSAsExpression, Xt as FunctionTypeParam, Y as DeclareExportDeclaration, Yi as TSTypeAssertion, Yn as NumberLiteral$1, Yr as TSArrayType, Yt as FunctionTypeAnnotation, Z as DeclareInterface, Zi as TSTypeLiteral, Zn as NumberTypeAnnotation, Zr as TSBaseType, Zt as GenericTypeAnnotation, _ as BinaryExpression, _a as TryStatement, _i as TSInferType, _n as JSXClosingFragment, _r as PatternLike, _t as EnumMember, a as Aliases, aa as TSUndefinedKeyword, ai as TSDeclareMethod, an as ImportNamespaceSpecifier, ar as ObjectTypeCallProperty, at as DeprecatedAliases, b as BlockParent, ba as TypeAlias, bi as TSInterfaceDeclaration, bn as JSXExpressionContainer, br as PipelineTopicExpression, bt as EnumStringBody, c as ArrayExpression, ca as TSVoidKeyword, ci as TSEnumMember, cn as InferredPredicate, cr as ObjectTypeProperty, ct as DoExpression, d as ArrowFunctionExpression, da as TemplateLiteral, di as TSExternalModuleReference, dn as InterfaceTypeAnnotation, dr as OptionalCallExpression, dt as EmptyTypeAnnotation, ea as TSTypeParameterDeclaration, ei as TSCallSignatureDeclaration, en as Immutable, er as ObjectMember, et as DeclareOpaqueType, f as AssignmentExpression, fa as Terminatorless, fi as TSFunctionType, fn as InterpreterDirective, fr as OptionalIndexedAccessType, ft as EnumBody, g as Binary, ga as TopicReference, gi as TSIndexedAccessType, gn as JSXClosingElement, gr as Pattern, gt as EnumDefaultedMember, h as BigIntLiteral, ha as ThrowStatement, hi as TSIndexSignature, hn as JSXAttribute, hr as ParenthesizedExpression, ht as EnumDeclaration, i as Accessor, ia as TSTypeReference, ii as TSDeclareFunction, in as ImportDefaultSpecifier, ir as ObjectTypeAnnotation, it as Decorator, j as ClassDeclaration, ja as UpdateExpression, ji as TSNonNullExpression, jn as LabeledStatement, jr as RestElement, jt as Expression, k as ClassAccessorProperty, ka as UnaryLike, ki as TSNamespaceExportDeclaration, kn as JSXText, kr as RegExpLiteral, kt as ExportNamespaceSpecifier, l as ArrayPattern, la as TaggedTemplateExpression, li as TSExportAssignment, ln as InterfaceDeclaration, lr as ObjectTypeSpreadProperty, lt as DoWhileStatement, m as AwaitExpression, ma as ThisTypeAnnotation, mi as TSImportType, mn as JSX, mr as Options$1, mt as EnumBooleanMember, na as TSTypePredicate, ni as TSConstructSignatureDeclaration, nn as ImportAttribute, nr as ObjectPattern, nt as DeclareVariable, o as AnyTypeAnnotation, oa as TSUnionType, oi as TSEntityName, on as ImportSpecifier, or as ObjectTypeIndexer, ot as Directive, p as AssignmentPattern, pa as ThisExpression, pi as TSImportEqualsDeclaration, pn as IntersectionTypeAnnotation, pr as OptionalMemberExpression, pt as EnumBooleanBody, q as DeclareClass, qi as TSTypeAliasDeclaration, qn as NullLiteralTypeAnnotation, qr as SymbolTypeAnnotation, qt as FunctionExpression, r as generate$1, ra as TSTypeQuery, ri as TSConstructorType, rn as ImportDeclaration, rr as ObjectProperty, rt as DeclaredPredicate, s as ArgumentPlaceholder, sa as TSUnknownKeyword, si as TSEnumDeclaration, sn as IndexedAccessType, sr as ObjectTypeInternalSlot, st as DirectiveLiteral, t as GeneratorOptions, ta as TSTypeParameterInstantiation, ti as TSConditionalType, tn as Import, tr as ObjectMethod, tt as DeclareTypeAlias, u as ArrayTypeAnnotation, ua as TemplateElement, ui as TSExpressionWithTypeArguments, un as InterfaceExtends, ur as OpaqueType, ut as EmptyStatement, v as BindExpression, va as TupleExpression, vi as TSInstantiationExpression, vn as JSXElement, vr as PipelineBareFunction, vt as EnumNumberBody, w as BooleanTypeAnnotation, wa as TypeParameterDeclaration, wi as TSMappedType, wn as JSXNamespacedName, wr as Program, wt as ExportAllDeclaration, x as BlockStatement, xa as TypeAnnotation, xi as TSIntersectionType, xn as JSXFragment, xr as Placeholder, xt as EnumStringMember, y as Block, ya as TupleTypeAnnotation, yi as TSInterfaceBody, yn as JSXEmptyExpression, yr as PipelinePrimaryTopicReference, yt as EnumNumberMember, z as CommentTypeShorthand, za as WhileStatement, zi as TSQualifiedName, zn as MixedTypeAnnotation, zr as Statement, zt as FlowType } from "../chunk-wK3zEWUl.js"; import * as recast from "recast"; import { Options as RecastOptions } from "recast"; //#region node_modules/@babel/parser/typings/babel-parser.d.ts declare namespace babel_parser_d_exports { export { DecoratorsPluginOptions, FlowPluginOptions, ParseError, ParseResult$1 as ParseResult, ParserOptions, PluginConfig as ParserPlugin, ParserPluginWithOptions, PipelineOperatorPluginOptions, RecordAndTuplePluginOptions, TypeScriptPluginOptions, parse$1 as parse, parseExpression, tokTypes }; } declare class Position { line: number; column: number; index: number; constructor(line: number, col: number, index: number); } type SyntaxPlugin = "flow" | "typescript" | "jsx" | "pipelineOperator" | "placeholders"; type ParseErrorCode = "BABEL_PARSER_SYNTAX_ERROR" | "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED"; interface ParseErrorSpecification { code: ParseErrorCode; reasonCode: string; syntaxPlugin?: SyntaxPlugin; missingPlugin?: string | string[]; loc: Position; details: ErrorDetails; pos: number; } type ParseError$1 = SyntaxError & ParseErrorSpecification; type BABEL_8_BREAKING = false; type IF_BABEL_7 = false extends BABEL_8_BREAKING ? V : never; type Plugin$1 = "asyncDoExpressions" | IF_BABEL_7<"asyncGenerators"> | IF_BABEL_7<"bigInt"> | IF_BABEL_7<"classPrivateMethods"> | IF_BABEL_7<"classPrivateProperties"> | IF_BABEL_7<"classProperties"> | IF_BABEL_7<"classStaticBlock"> | IF_BABEL_7<"decimal"> | "decorators-legacy" | "deferredImportEvaluation" | "decoratorAutoAccessors" | "destructuringPrivate" | IF_BABEL_7<"deprecatedImportAssert"> | "doExpressions" | IF_BABEL_7<"dynamicImport"> | IF_BABEL_7<"explicitResourceManagement"> | "exportDefaultFrom" | IF_BABEL_7<"exportNamespaceFrom"> | "flow" | "flowComments" | "functionBind" | "functionSent" | "importMeta" | "jsx" | IF_BABEL_7<"jsonStrings"> | IF_BABEL_7<"logicalAssignment"> | IF_BABEL_7<"importAssertions"> | IF_BABEL_7<"importReflection"> | "moduleBlocks" | IF_BABEL_7<"moduleStringNames"> | IF_BABEL_7<"nullishCoalescingOperator"> | IF_BABEL_7<"numericSeparator"> | IF_BABEL_7<"objectRestSpread"> | IF_BABEL_7<"optionalCatchBinding"> | IF_BABEL_7<"optionalChaining"> | "partialApplication" | "placeholders" | IF_BABEL_7<"privateIn"> | IF_BABEL_7<"regexpUnicodeSets"> | "sourcePhaseImports" | "throwExpressions" | IF_BABEL_7<"topLevelAwait"> | "v8intrinsic" | ParserPluginWithOptions[0]; type ParserPluginWithOptions = ["decorators", DecoratorsPluginOptions] | ["discardBinding", { syntaxType: "void"; }] | ["estree", { classFeatures?: boolean; }] | IF_BABEL_7<["importAttributes", { deprecatedAssertSyntax: boolean; }]> | IF_BABEL_7<["moduleAttributes", { version: "may-2020"; }]> | ["optionalChainingAssign", { version: "2023-07"; }] | ["pipelineOperator", PipelineOperatorPluginOptions] | ["recordAndTuple", RecordAndTuplePluginOptions] | ["flow", FlowPluginOptions] | ["typescript", TypeScriptPluginOptions]; type PluginConfig = Plugin$1 | ParserPluginWithOptions; interface DecoratorsPluginOptions { decoratorsBeforeExport?: boolean; allowCallParenthesized?: boolean; } interface PipelineOperatorPluginOptions { proposal: BABEL_8_BREAKING extends false ? "minimal" | "fsharp" | "hack" | "smart" : "fsharp" | "hack"; topicToken?: "%" | "#" | "@@" | "^^" | "^"; } interface RecordAndTuplePluginOptions { syntaxType: "bar" | "hash"; } type FlowPluginOptions = BABEL_8_BREAKING extends true ? { all?: boolean; enums?: boolean; } : { all?: boolean; }; interface TypeScriptPluginOptions { dts?: boolean; disallowAmbiguousJSXLike?: boolean; } type Plugin = PluginConfig; type SourceType = "script" | "commonjs" | "module" | "unambiguous"; interface Options { /** * By default, import and export declarations can only appear at a program's top level. * Setting this option to true allows them anywhere where a statement is allowed. */ allowImportExportEverywhere?: boolean; /** * By default, await use is not allowed outside of an async function. * Set this to true to accept such code. */ allowAwaitOutsideFunction?: boolean; /** * By default, a return statement at the top level raises an error. * Set this to true to accept such code. */ allowReturnOutsideFunction?: boolean; /** * By default, new.target use is not allowed outside of a function or class. * Set this to true to accept such code. */ allowNewTargetOutsideFunction?: boolean; /** * By default, super calls are not allowed outside of a method. * Set this to true to accept such code. */ allowSuperOutsideMethod?: boolean; /** * By default, exported identifiers must refer to a declared variable. * Set this to true to allow export statements to reference undeclared variables. */ allowUndeclaredExports?: boolean; /** * By default, yield use is not allowed outside of a generator function. * Set this to true to accept such code. */ allowYieldOutsideFunction?: boolean; /** * By default, Babel parser JavaScript code according to Annex B syntax. * Set this to `false` to disable such behavior. */ annexB?: boolean; /** * By default, Babel attaches comments to adjacent AST nodes. * When this option is set to false, comments are not attached. * It can provide up to 30% performance improvement when the input code has many comments. * @babel/eslint-parser will set it for you. * It is not recommended to use attachComment: false with Babel transform, * as doing so removes all the comments in output code, and renders annotations such as * /* istanbul ignore next *\/ nonfunctional. */ attachComment?: boolean; /** * By default, Babel always throws an error when it finds some invalid code. * When this option is set to true, it will store the parsing error and * try to continue parsing the invalid input file. */ errorRecovery?: boolean; /** * Indicate the mode the code should be parsed in. * Can be one of "script", "commonjs", "module", or "unambiguous". Defaults to "script". * "unambiguous" will make @babel/parser attempt to guess, based on the presence * of ES6 import or export statements. * Files with ES6 imports and exports are considered "module" and are otherwise "script". * * Use "commonjs" to parse code that is intended to be run in a CommonJS environment such as Node.js. */ sourceType?: SourceType; /** * Correlate output AST nodes with their source filename. * Useful when generating code and source maps from the ASTs of multiple input files. */ sourceFilename?: string; /** * By default, all source indexes start from 0. * You can provide a start index to alternatively start with. * Useful for integration with other source tools. */ startIndex?: number; /** * By default, the first line of code parsed is treated as line 1. * You can provide a line number to alternatively start with. * Useful for integration with other source tools. */ startLine?: number; /** * By default, the parsed code is treated as if it starts from line 1, column 0. * You can provide a column number to alternatively start with. * Useful for integration with other source tools. */ startColumn?: number; /** * Array containing the plugins that you want to enable. */ plugins?: Plugin[]; /** * Should the parser work in strict mode. * Defaults to true if sourceType === 'module'. Otherwise, false. */ strictMode?: boolean; /** * Adds a ranges property to each node: [node.start, node.end] */ ranges?: boolean; /** * Adds all parsed tokens to a tokens property on the File node. */ tokens?: boolean; /** * By default, the parser adds information about parentheses by setting * `extra.parenthesized` to `true` as needed. * When this option is `true` the parser creates `ParenthesizedExpression` * AST nodes instead of using the `extra` property. */ createParenthesizedExpressions?: boolean; /** * The default is false in Babel 7 and true in Babel 8 * Set this to true to parse it as an `ImportExpression` node. * Otherwise `import(foo)` is parsed as `CallExpression(Import, [Identifier(foo)])`. */ createImportExpressions?: boolean; } type ParserOptions = Partial; type ParseError = ParseError$1; type ParseResult$1 = Result & { comments: File["comments"]; errors: null | ParseError[]; tokens?: File["tokens"]; }; /** * Parse the provided code as an entire ECMAScript program. */ declare function parse$1(input: string, options?: ParserOptions): ParseResult$1; declare function parseExpression(input: string, options?: ParserOptions): ParseResult$1; declare const tokTypes: { // todo(flow->ts) real token type [name: string]: any; }; //#endregion //#region node_modules/@types/babel__template/index.d.ts interface TemplateBuilderOptions extends ParserOptions { /** * A set of placeholder names to automatically accept. * Items in this list do not need to match `placeholderPattern`. * * This option cannot be used when using `%%foo%%` style placeholders. */ placeholderWhitelist?: Set | null | undefined; /** * A pattern to search for when looking for `Identifier` and `StringLiteral` * nodes that should be considered as placeholders. * * `false` will disable placeholder searching placeholders, leaving only * the `placeholderWhitelist` value to find replacements. * * This option cannot be used when using `%%foo%%` style placeholders. * * @default /^[_$A-Z0-9]+$/ */ placeholderPattern?: RegExp | false | null | undefined; /** * Set this to `true` to preserve comments from the template string * into the resulting AST, or `false` to automatically discard comments. * * @default false */ preserveComments?: boolean | null | undefined; /** * Set to `true` to use `%%foo%%` style placeholders, `false` to use legacy placeholders * described by `placeholderPattern` or `placeholderWhitelist`. * * When it is not set, it behaves as `true` if there are syntactic placeholders, otherwise as `false`. * * @since 7.4.0 */ syntacticPlaceholders?: boolean | null | undefined; } interface TemplateBuilder { /** * Build a new builder, merging the given options with the previous ones. */ (opts: TemplateBuilderOptions): TemplateBuilder; /** * Building from a string produces an AST builder function by default. */ (code: string, opts?: TemplateBuilderOptions): (arg?: PublicReplacements) => T; /** * Building from a template literal produces an AST builder function by default. */ (tpl: TemplateStringsArray, ...args: unknown[]): (arg?: PublicReplacements) => T; /** * Allow users to explicitly create templates that produce ASTs, * skipping the need for an intermediate function. * * Does not allow `%%foo%%` style placeholders. */ ast: { (tpl: string, opts?: TemplateBuilderOptions): T; (tpl: TemplateStringsArray, ...args: unknown[]): T; }; } type PublicReplacements = { [index: string]: unknown; } | unknown[]; declare const smart: TemplateBuilder; declare const statement: TemplateBuilder; declare const statements: TemplateBuilder; declare const expression: TemplateBuilder; declare const program: TemplateBuilder; type DefaultTemplateBuilder = typeof smart & { smart: typeof smart; statement: typeof statement; statements: typeof statements; expression: typeof expression; program: typeof program; ast: typeof smart.ast; }; declare const templateBuilder: DefaultTemplateBuilder; //#endregion //#region node_modules/@types/babel__traverse/index.d.ts declare const traverse$1: { (parent: Node$1, opts: TraverseOptions, scope: Scope | undefined, state: S, parentPath?: NodePath): void; (parent: Node$1, opts?: TraverseOptions, scope?: Scope, state?: any, parentPath?: NodePath): void; visitors: typeof visitors; verify: typeof visitors.verify; explode: typeof visitors.explode; cheap: (node: Node$1, enter: (node: Node$1) => void) => void; node: (node: Node$1, opts: TraverseOptions, scope?: Scope, state?: any, path?: NodePath, skipKeys?: Record) => void; clearNode: (node: Node$1, opts?: Options$1) => void; removeProperties: (tree: Node$1, opts?: Options$1) => Node$1; hasType: (tree: Node$1, type: Node$1["type"], denylistTypes?: string[]) => boolean; cache: typeof cache; }; declare namespace visitors { /** * `explode()` will take a `Visitor` object with all of the various shorthands * that we support, and validates & normalizes it into a common format, ready * to be used in traversal. * * The various shorthands are: * - `Identifier() { ... }` -> `Identifier: { enter() { ... } }` * - `"Identifier|NumericLiteral": { ... }` -> `Identifier: { ... }, NumericLiteral: { ... }` * - Aliases in `@babel/types`: e.g. `Property: { ... }` -> `ObjectProperty: { ... }, ClassProperty: { ... }` * * Other normalizations are: * - Visitors of virtual types are wrapped, so that they are only visited when their dynamic check passes * - `enter` and `exit` functions are wrapped in arrays, to ease merging of visitors */ function explode(visitor: Visitor): { [Type in Exclude["type"]]?: VisitNodeObject> }; function verify(visitor: Visitor): void; function merge(visitors: Array>): Visitor; function merge(visitors: Visitor[], states?: any[], wrapper?: (stateKey: any, visitorKey: keyof Visitor, func: VisitNodeFunction) => VisitNodeFunction | null): Visitor; } declare namespace cache { let path: WeakMap>; let scope: WeakMap; function clear(): void; function clearPath(): void; function clearScope(): void; } type TraverseOptions = { scope?: Scope; noScope?: boolean; denylist?: NodeType[]; /** @deprecated will be removed in Babel 8 */ blacklist?: NodeType[]; shouldSkip?: (node: NodePath) => boolean; } & Visitor; declare class Scope { /** * This searches the current "scope" and collects all references/bindings * within. */ constructor(path: NodePath, parentScope?: Scope); uid: number; path: NodePath; block: Node$1; labels: Map>; parentBlock: Node$1; parent: Scope; hub: HubInterface; bindings: { [name: string]: Binding; }; references: { [name: string]: true; }; globals: { [name: string]: Identifier | JSXIdentifier; }; uids: { [name: string]: boolean; }; data: Record; crawling: boolean; static globals: string[]; /** Variables available in current context. */ static contextVariables: string[]; /** Traverse node with current scope and path. */ traverse(node: Node$1 | Node$1[], opts: TraverseOptions, state: S): void; traverse(node: Node$1 | Node$1[], opts?: TraverseOptions, state?: any): void; /** Generate a unique identifier and add it to the current scope. */ generateDeclaredUidIdentifier(name?: string): Identifier; /** Generate a unique identifier. */ generateUidIdentifier(name?: string): Identifier; /** Generate a unique `_id1` binding. */ generateUid(name?: string): string; /** Generate a unique identifier based on a node. */ generateUidIdentifierBasedOnNode(parent: Node$1, defaultName?: string): Identifier; /** * Determine whether evaluating the specific input `node` is a consequenceless reference. ie. * evaluating it wont result in potentially arbitrary code from being ran. The following are * whitelisted and determined not to cause side effects: * * - `this` expressions * - `super` expressions * - Bound identifiers */ isStatic(node: Node$1): boolean; /** Possibly generate a memoised identifier if it is not static and has consequences. */ maybeGenerateMemoised(node: Node$1, dontPush?: boolean): Identifier; checkBlockScopedCollisions(local: Binding, kind: BindingKind, name: string, id: object): void; rename(oldName: string, newName?: string, block?: Node$1): void; dump(): void; toArray(node: Node$1, i?: number | boolean, arrayLikeIsIterable?: boolean): ArrayExpression | CallExpression | Identifier; hasLabel(name: string): boolean; getLabel(name: string): NodePath | undefined; registerLabel(path: NodePath): void; registerDeclaration(path: NodePath): void; buildUndefinedNode(): UnaryExpression; registerConstantViolation(path: NodePath): void; registerBinding(kind: BindingKind, path: NodePath, bindingPath?: NodePath): void; addGlobal(node: Identifier | JSXIdentifier): void; hasUid(name: string): boolean; hasGlobal(name: string): boolean; hasReference(name: string): boolean; isPure(node: Node$1, constantsOnly?: boolean): boolean; /** * Set some arbitrary data on the current scope. */ setData(key: string, val: any): any; /** * Recursively walk up scope tree looking for the data `key`. */ getData(key: string): any; /** * Recursively walk up scope tree looking for the data `key` and if it exists, * remove it. */ removeData(key: string): void; crawl(): void; push(opts: { id: LVal; init?: Expression; unique?: boolean; _blockHoist?: number | undefined; kind?: "var" | "let" | "const"; }): void; /** Walk up to the top of the scope tree and get the `Program`. */ getProgramParent(): Scope; /** Walk up the scope tree until we hit either a Function or return null. */ getFunctionParent(): Scope | null; /** * Walk up the scope tree until we hit either a BlockStatement/Loop/Program/Function/Switch or reach the * very top and hit Program. */ getBlockParent(): Scope; /** * Walk up from a pattern scope (function param initializer) until we hit a non-pattern scope, * then returns its block parent * @returns An ancestry scope whose path is a block parent */ getPatternParent(): Scope; /** Walks the scope tree and gathers **all** bindings. */ getAllBindings(): Record; /** Walks the scope tree and gathers all declarations of `kind`. */ getAllBindingsOfKind(...kinds: string[]): Record; bindingIdentifierEquals(name: string, node: Node$1): boolean; getBinding(name: string): Binding | undefined; getOwnBinding(name: string): Binding | undefined; getBindingIdentifier(name: string): Identifier; getOwnBindingIdentifier(name: string): Identifier; hasOwnBinding(name: string): boolean; hasBinding(name: string, optsOrNoGlobals?: boolean | { noGlobals?: boolean; noUids?: boolean; }): boolean; parentHasBinding(name: string, opts?: { noGlobals?: boolean; noUids?: boolean; }): boolean; /** Move a binding of `name` to another `scope`. */ moveBindingTo(name: string, scope: Scope): void; removeOwnBinding(name: string): void; removeBinding(name: string): void; } type BindingKind = "var" | "let" | "const" | "module" | "hoisted" | "param" | "local" | "unknown"; /** * This class is responsible for a binding inside of a scope. * * It tracks the following: * * * Node path. * * Amount of times referenced by other nodes. * * Paths to nodes that reassign or modify this binding. * * The kind of binding. (Is it a parameter, declaration etc) */ declare class Binding { constructor(opts: { identifier: Identifier; scope: Scope; path: NodePath; kind: BindingKind; }); identifier: Identifier; scope: Scope; path: NodePath; kind: BindingKind; referenced: boolean; references: number; referencePaths: NodePath[]; constant: boolean; constantViolations: NodePath[]; hasDeoptedValue: boolean; hasValue: boolean; value: any; deopValue(): void; setValue(value: any): void; clearValue(): void; /** Register a constant violation with the provided `path`. */ reassign(path: NodePath): void; /** Increment the amount of references to this binding. */ reference(path: NodePath): void; /** Decrement the amount of references to this binding. */ dereference(): void; } type Visitor = VisitNodeObject & { [N in Node$1 as N["type"]]?: VisitNode } & { [K in keyof Aliases]?: VisitNode } & { [K in keyof VirtualTypeAliases]?: VisitNode } & { // Babel supports `NodeTypesWithoutComment | NodeTypesWithoutComment | ... ` but it is // too complex for TS. So we type it as a general visitor only if the key contains `|` // this is good enough for non-visitor traverse options e.g. `noScope` [k: `${string}|${string}`]: VisitNode; }; type VisitNode = VisitNodeFunction | VisitNodeObject; type VisitNodeFunction = (this: S, path: NodePath

, state: S) => void; type NodeType = Node$1["type"] | keyof Aliases; interface VisitNodeObject { enter?: VisitNodeFunction; exit?: VisitNodeFunction; } type NodeKeyOfArrays = { [P in keyof T]-?: T[P] extends Array ? P : never }[keyof T]; type NodePaths = T extends readonly Node$1[] ? { -readonly [K in keyof T]: NodePath> } : T extends Node$1 ? [NodePath] : never; type NodeListType = N[K] extends Array ? (P extends Node$1 ? P : never) : never; type NodesInsertionParam = T | readonly T[] | [T, ...T[]]; declare class NodePath { constructor(hub: HubInterface, parent: Node$1); parent: Node$1; hub: Hub; data: Record; context: TraversalContext; scope: Scope; contexts: TraversalContext[]; state: any; opts: any; // exploded TraverseOptions skipKeys: Record | null; parentPath: T extends Program ? null : NodePath; container: Node$1 | Node$1[] | null; listKey: string | null; key: string | number | null; node: T; type: T extends Node$1 ? T["type"] : T extends null | undefined ? undefined : Node$1["type"] | undefined; shouldSkip: boolean; shouldStop: boolean; removed: boolean; inList: boolean; parentKey: string; typeAnnotation: object; static get(opts: { hub?: HubInterface; parentPath: NodePath | null; parent: Node$1; container: C; key: K; }): NodePath; static get>(opts: { hub?: HubInterface; parentPath: NodePath | null; parent: Node$1; container: C; listKey: L; key: number; }): C[L] extends Array ? NodePath : never; getScope(scope: Scope): Scope; setData(key: string | symbol, val: any): any; getData(key: string | symbol, def?: any): any; hasNode(): this is NodePath>; buildCodeFrameError(msg: string, Error?: ErrorConstructor): Error; traverse(visitor: TraverseOptions, state: T): void; traverse(visitor: TraverseOptions): void; set(key: string, node: any): void; getPathLocation(): string; // Example: https://github.com/babel/babel/blob/63204ae51e020d84a5b246312f5eeb4d981ab952/packages/babel-traverse/src/path/modification.js#L83 debug(buildMessage: () => string): void; // #region ------------------------- ancestry ------------------------- /** * Starting at the parent path of the current `NodePath` and going up the * tree, return the first `NodePath` that causes the provided `callback` * to return a truthy value, or `null` if the `callback` never returns a * truthy value. */ findParent(callback: (path: NodePath) => boolean): NodePath | null; /** * Starting at current `NodePath` and going up the tree, return the first * `NodePath` that causes the provided `callback` to return a truthy value, * or `null` if the `callback` never returns a truthy value. */ find(callback: (path: NodePath) => boolean): NodePath | null; /** Get the parent function of the current path. */ getFunctionParent(): NodePath | null; /** Walk up the tree until we hit a parent node path in a list. */ getStatementParent(): NodePath | null; /** * Get the deepest common ancestor and then from it, get the earliest relationship path * to that ancestor. * * Earliest is defined as being "before" all the other nodes in terms of list container * position and visiting key. */ getEarliestCommonAncestorFrom(paths: NodePath[]): NodePath; /** Get the earliest path in the tree where the provided `paths` intersect. */ getDeepestCommonAncestorFrom(paths: NodePath[], filter?: (deepest: Node$1, i: number, ancestries: NodePath[][]) => NodePath): NodePath; /** * Build an array of node paths containing the entire ancestry of the current node path. * * NOTE: The current node path is included in this. */ getAncestry(): [this, ...NodePath[]]; /** * A helper to find if `this` path is an ancestor of `maybeDescendant` */ isAncestor(maybeDescendant: NodePath): boolean; /** * A helper to find if `this` path is a descendant of `maybeAncestor` */ isDescendant(maybeAncestor: NodePath): boolean; inType(...candidateTypes: string[]): boolean; // #endregion // #region ------------------------- inference ------------------------- /** Infer the type of the current `NodePath`. */ getTypeAnnotation(): FlowType | TSType; isBaseType(baseName: string, soft?: boolean): boolean; couldBeBaseType(name: string): boolean; baseTypeStrictlyMatches(rightArg: NodePath): boolean; isGenericType(genericName: string): boolean; // #endregion // #region ------------------------- replacement ------------------------- /** * Replace a node with an array of multiple. This method performs the following steps: * * - Inherit the comments of first provided node with that of the current node. * - Insert the provided nodes after the current node. * - Remove the current node. */ replaceWithMultiple(nodes: Nodes): NodePaths; /** * Parse a string as an expression and replace the current node with the result. * * NOTE: This is typically not a good idea to use. Building source strings when * transforming ASTs is an antipattern and SHOULD NOT be encouraged. Even if it's * easier to use, your transforms will be extremely brittle. */ replaceWithSourceString(replacement: string): [NodePath]; /** Replace the current node with another. */ replaceWith(replacementPath: R | NodePath): [NodePath]; replaceWith(replacementPath: R): [R]; /** * This method takes an array of statements nodes and then explodes it * into expressions. This method retains completion records which is * extremely important to retain original semantics. */ replaceExpressionWithStatements(nodes: Statement[]): NodePaths; replaceInline(nodes: Nodes): NodePaths; // #endregion // #region ------------------------- evaluation ------------------------- /** * Walk the input `node` and statically evaluate if it's truthy. * * Returning `true` when we're sure that the expression will evaluate to a * truthy value, `false` if we're sure that it will evaluate to a falsy * value and `undefined` if we aren't sure. Because of this please do not * rely on coercion when using this method and check with === if it's false. */ evaluateTruthy(): boolean | undefined; /** * Walk the input `node` and statically evaluate it. * * Returns an object in the form `{ confident, value, deopt }`. `confident` * indicates whether or not we had to drop out of evaluating the expression * because of hitting an unknown node that we couldn't confidently find the * value of, in which case `deopt` is the path of said node. * * Example: * * t.evaluate(parse("5 + 5")) // { confident: true, value: 10 } * t.evaluate(parse("!true")) // { confident: true, value: false } * t.evaluate(parse("foo + foo")) // { confident: false, value: undefined, deopt: NodePath } */ evaluate(): { confident: boolean; value: any; deopt?: NodePath; }; // #endregion // #region ------------------------- introspection ------------------------- /** * Match the current node if it matches the provided `pattern`. * * For example, given the match `React.createClass` it would match the * parsed nodes of `React.createClass` and `React["createClass"]`. */ matchesPattern(pattern: string, allowPartial?: boolean): boolean; /** * Check whether we have the input `key`. If the `key` references an array then we check * if the array has any items, otherwise we just check if it's falsy. */ has(key: string): boolean; // has(key: keyof T): boolean; isStatic(): boolean; /** Alias of `has`. */ is(key: string): boolean; // is(key: keyof T): boolean; /** Opposite of `has`. */ isnt(key: string): boolean; // isnt(key: keyof T): boolean; /** Check whether the path node `key` strict equals `value`. */ equals(key: string, value: any): boolean; // equals(key: keyof T, value: any): boolean; /** * Check the type against our stored internal type of the node. This is handy when a node has * been removed yet we still internally know the type and need it to calculate node replacement. */ isNodeType(type: string): boolean; /** * This checks whether or not we're in one of the following positions: * * for (KEY in right); * for (KEY;;); * * This is because these spots allow VariableDeclarations AND normal expressions so we need * to tell the path replacement that it's ok to replace this with an expression. */ canHaveVariableDeclarationOrExpression(): boolean; /** * This checks whether we are swapping an arrow function's body between an * expression and a block statement (or vice versa). * * This is because arrow functions may implicitly return an expression, which * is the same as containing a block statement. */ canSwapBetweenExpressionAndStatement(replacement: Node$1): boolean; /** Check whether the current path references a completion record */ isCompletionRecord(allowInsideFunction?: boolean): boolean; /** * Check whether or not the current `key` allows either a single statement or block statement * so we can explode it if necessary. */ isStatementOrBlock(): boolean; /** Check if the currently assigned path references the `importName` of `moduleSource`. */ referencesImport(moduleSource: string, importName: string): boolean; /** Get the source code associated with this node. */ getSource(): string; /** Check if the current path will maybe execute before another path */ willIMaybeExecuteBefore(target: NodePath): boolean; resolve(dangerous?: boolean, resolved?: NodePath[]): NodePath; isConstantExpression(): boolean; isInStrictMode(): boolean; // #endregion // #region ------------------------- context ------------------------- call(key: string): boolean; isDenylisted(): boolean; /** @deprecated will be removed in Babel 8 */ isBlacklisted(): boolean; visit(): boolean; skip(): void; skipKey(key: string): void; stop(): void; setScope(): void; setContext(context?: TraversalContext): this; /** * Here we resync the node paths `key` and `container`. If they've changed according * to what we have stored internally then we attempt to resync by crawling and looking * for the new values. */ resync(): void; popContext(): void; pushContext(context: TraversalContext): void; requeue(pathToQueue?: NodePath): void; // #endregion // #region ------------------------- removal ------------------------- remove(): void; // #endregion // #region ------------------------- conversion ------------------------- toComputedKey(): PrivateName | Expression; /** @deprecated Use `arrowFunctionToExpression` */ arrowFunctionToShadowed(): void; /** * Given an arbitrary function, process its content as if it were an arrow function, moving references * to "this", "arguments", "super", and such into the function's parent scope. This method is useful if * you have wrapped some set of items in an IIFE or other function, but want "this", "arguments", and super" * to continue behaving as expected. */ unwrapFunctionEnvironment(): void; /** * Convert a given arrow function into a normal ES5 function expression. */ arrowFunctionToExpression({ allowInsertArrow, allowInsertArrowWithRest, /** @deprecated Use `noNewArrows` instead */specCompliant, noNewArrows }?: { allowInsertArrow?: boolean; allowInsertArrowWithRest?: boolean; specCompliant?: boolean; noNewArrows?: boolean; }): NodePath | CallExpression>; ensureBlock(this: NodePath): asserts this is NodePath; // #endregion // #region ------------------------- modification ------------------------- /** Insert the provided nodes before the current one. */ insertBefore>(nodes: Nodes): NodePaths; /** * Insert the provided nodes after the current one. When inserting nodes after an * expression, ensure that the completion record is correct by pushing the current node. */ insertAfter>(nodes: Nodes): NodePaths; /** Update all sibling node paths after `fromIndex` by `incrementBy`. */ updateSiblingKeys(fromIndex: number, incrementBy: number): void; /** * Insert child nodes at the start of the current node. * @param listKey - The key at which the child nodes are stored (usually body). * @param nodes - the nodes to insert. */ unshiftContainer, Nodes extends NodesInsertionParam>>(this: NodePath, listKey: K, nodes: Nodes): NodePaths; /** * Insert child nodes at the end of the current node. * @param listKey - The key at which the child nodes are stored (usually body). * @param nodes - the nodes to insert. */ pushContainer, Nodes extends NodesInsertionParam>>(this: NodePath, listKey: K, nodes: Nodes): NodePaths; /** Hoist the current node to the highest scope possible and return a UID referencing it. */ hoist(scope: Scope): void; // #endregion // #region ------------------------- family ------------------------- getOpposite(): NodePath | null; getCompletionRecords(): NodePath[]; getSibling(key: string | number): NodePath; getPrevSibling(): NodePath; getNextSibling(): NodePath; getAllPrevSiblings(): NodePath[]; getAllNextSiblings(): NodePath[]; get(key: K, context?: boolean | TraversalContext): NodePathResult; get(key: string, context?: boolean | TraversalContext): NodePath | NodePath[]; getBindingIdentifiers(duplicates: true): Record; getBindingIdentifiers(duplicates?: false): Record; getBindingIdentifiers(duplicates?: boolean): Record; getOuterBindingIdentifiers(duplicates: true): Record; getOuterBindingIdentifiers(duplicates?: false): Record; getOuterBindingIdentifiers(duplicates?: boolean): Record; getBindingIdentifierPaths(duplicates: true, outerOnly?: boolean): Record>>; getBindingIdentifierPaths(duplicates?: false, outerOnly?: boolean): Record>; getBindingIdentifierPaths(duplicates?: boolean, outerOnly?: boolean): Record | Array>>; getOuterBindingIdentifierPaths(duplicates: true): Record>>; getOuterBindingIdentifierPaths(duplicates?: false): Record>; getOuterBindingIdentifierPaths(duplicates?: boolean, outerOnly?: boolean): Record | Array>>; // #endregion // #region ------------------------- comments ------------------------- /** Share comments amongst siblings. */ shareCommentsWithSiblings(): void; addComment(type: CommentTypeShorthand, content: string, line?: boolean): void; /** Give node `comments` of the specified `type`. */ addComments(type: CommentTypeShorthand, comments: Comment[]): void; // #endregion // #region ------------------------- isXXX ------------------------- isAccessor(opts?: object): this is NodePath; isAnyTypeAnnotation(opts?: object): this is NodePath; isArgumentPlaceholder(opts?: object): this is NodePath; isArrayExpression(opts?: object): this is NodePath; isArrayPattern(opts?: object): this is NodePath; isArrayTypeAnnotation(opts?: object): this is NodePath; isArrowFunctionExpression(opts?: object): this is NodePath; isAssignmentExpression(opts?: object): this is NodePath; isAssignmentPattern(opts?: object): this is NodePath; isAwaitExpression(opts?: object): this is NodePath; isBigIntLiteral(opts?: object): this is NodePath; isBinary(opts?: object): this is NodePath; isBinaryExpression(opts?: object): this is NodePath; isBindExpression(opts?: object): this is NodePath; isBlock(opts?: object): this is NodePath; isBlockParent(opts?: object): this is NodePath; isBlockStatement(opts?: object): this is NodePath; isBooleanLiteral(opts?: object): this is NodePath; isBooleanLiteralTypeAnnotation(opts?: object): this is NodePath; isBooleanTypeAnnotation(opts?: object): this is NodePath; isBreakStatement(opts?: object): this is NodePath; isCallExpression(opts?: object): this is NodePath; isCatchClause(opts?: object): this is NodePath; isClass(opts?: object): this is NodePath; isClassAccessorProperty(opts?: object): this is NodePath; isClassBody(opts?: object): this is NodePath; isClassDeclaration(opts?: object): this is NodePath; isClassExpression(opts?: object): this is NodePath; isClassImplements(opts?: object): this is NodePath; isClassMethod(opts?: object): this is NodePath; isClassPrivateMethod(opts?: object): this is NodePath; isClassPrivateProperty(opts?: object): this is NodePath; isClassProperty(opts?: object): this is NodePath; isCompletionStatement(opts?: object): this is NodePath; isConditional(opts?: object): this is NodePath; isConditionalExpression(opts?: object): this is NodePath; isContinueStatement(opts?: object): this is NodePath; isDebuggerStatement(opts?: object): this is NodePath; isDecimalLiteral(opts?: object): this is NodePath; isDeclaration(opts?: object): this is NodePath; isDeclareClass(opts?: object): this is NodePath; isDeclareExportAllDeclaration(opts?: object): this is NodePath; isDeclareExportDeclaration(opts?: object): this is NodePath; isDeclareFunction(opts?: object): this is NodePath; isDeclareInterface(opts?: object): this is NodePath; isDeclareModule(opts?: object): this is NodePath; isDeclareModuleExports(opts?: object): this is NodePath; isDeclareOpaqueType(opts?: object): this is NodePath; isDeclareTypeAlias(opts?: object): this is NodePath; isDeclareVariable(opts?: object): this is NodePath; isDeclaredPredicate(opts?: object): this is NodePath; isDecorator(opts?: object): this is NodePath; isDirective(opts?: object): this is NodePath; isDirectiveLiteral(opts?: object): this is NodePath; isDoExpression(opts?: object): this is NodePath; isDoWhileStatement(opts?: object): this is NodePath; isEmptyStatement(opts?: object): this is NodePath; isEmptyTypeAnnotation(opts?: object): this is NodePath; isEnumBody(opts?: object): this is NodePath; isEnumBooleanBody(opts?: object): this is NodePath; isEnumBooleanMember(opts?: object): this is NodePath; isEnumDeclaration(opts?: object): this is NodePath; isEnumDefaultedMember(opts?: object): this is NodePath; isEnumMember(opts?: object): this is NodePath; isEnumNumberBody(opts?: object): this is NodePath; isEnumNumberMember(opts?: object): this is NodePath; isEnumStringBody(opts?: object): this is NodePath; isEnumStringMember(opts?: object): this is NodePath; isEnumSymbolBody(opts?: object): this is NodePath; isExistsTypeAnnotation(opts?: object): this is NodePath; isExportAllDeclaration(opts?: object): this is NodePath; isExportDeclaration(opts?: object): this is NodePath; isExportDefaultDeclaration(opts?: object): this is NodePath; isExportDefaultSpecifier(opts?: object): this is NodePath; isExportNamedDeclaration(opts?: object): this is NodePath; isExportNamespaceSpecifier(opts?: object): this is NodePath; isExportSpecifier(opts?: object): this is NodePath; isExpression(opts?: object): this is NodePath; isExpressionStatement(opts?: object): this is NodePath; isExpressionWrapper(opts?: object): this is NodePath; isFile(opts?: object): this is NodePath; isFlow(opts?: object): this is NodePath; isFlowBaseAnnotation(opts?: object): this is NodePath; isFlowDeclaration(opts?: object): this is NodePath; isFlowPredicate(opts?: object): this is NodePath; isFlowType(opts?: object): this is NodePath; isFor(opts?: object): this is NodePath; isForInStatement(opts?: object): this is NodePath; isForOfStatement(opts?: object): this is NodePath; isForStatement(opts?: object): this is NodePath; isForXStatement(opts?: object): this is NodePath; isFunction(opts?: object): this is NodePath; isFunctionDeclaration(opts?: object): this is NodePath; isFunctionExpression(opts?: object): this is NodePath; isFunctionParent(opts?: object): this is NodePath; isFunctionTypeAnnotation(opts?: object): this is NodePath; isFunctionTypeParam(opts?: object): this is NodePath; isGenericTypeAnnotation(opts?: object): this is NodePath; isIdentifier(opts?: object): this is NodePath; isIfStatement(opts?: object): this is NodePath; isImmutable(opts?: object): this is NodePath; isImport(opts?: object): this is NodePath; isImportAttribute(opts?: object): this is NodePath; isImportDeclaration(opts?: object): this is NodePath; isImportDefaultSpecifier(opts?: object): this is NodePath; isImportNamespaceSpecifier(opts?: object): this is NodePath; isImportSpecifier(opts?: object): this is NodePath; isIndexedAccessType(opts?: object): this is NodePath; isInferredPredicate(opts?: object): this is NodePath; isInterfaceDeclaration(opts?: object): this is NodePath; isInterfaceExtends(opts?: object): this is NodePath; isInterfaceTypeAnnotation(opts?: object): this is NodePath; isInterpreterDirective(opts?: object): this is NodePath; isIntersectionTypeAnnotation(opts?: object): this is NodePath; isJSX(opts?: object): this is NodePath; isJSXAttribute(opts?: object): this is NodePath; isJSXClosingElement(opts?: object): this is NodePath; isJSXClosingFragment(opts?: object): this is NodePath; isJSXElement(opts?: object): this is NodePath; isJSXEmptyExpression(opts?: object): this is NodePath; isJSXExpressionContainer(opts?: object): this is NodePath; isJSXFragment(opts?: object): this is NodePath; isJSXIdentifier(opts?: object): this is NodePath; isJSXMemberExpression(opts?: object): this is NodePath; isJSXNamespacedName(opts?: object): this is NodePath; isJSXOpeningElement(opts?: object): this is NodePath; isJSXOpeningFragment(opts?: object): this is NodePath; isJSXSpreadAttribute(opts?: object): this is NodePath; isJSXSpreadChild(opts?: object): this is NodePath; isJSXText(opts?: object): this is NodePath; isLVal(opts?: object): this is NodePath; isLabeledStatement(opts?: object): this is NodePath; isLiteral(opts?: object): this is NodePath; isLogicalExpression(opts?: object): this is NodePath; isLoop(opts?: object): this is NodePath; isMemberExpression(opts?: object): this is NodePath; isMetaProperty(opts?: object): this is NodePath; isMethod(opts?: object): this is NodePath; isMiscellaneous(opts?: object): this is NodePath; isMixedTypeAnnotation(opts?: object): this is NodePath; isModuleDeclaration(opts?: object): this is NodePath; isModuleExpression(opts?: object): this is NodePath; isModuleSpecifier(opts?: object): this is NodePath; isNewExpression(opts?: object): this is NodePath; isNoop(opts?: object): this is NodePath; isNullLiteral(opts?: object): this is NodePath; isNullLiteralTypeAnnotation(opts?: object): this is NodePath; isNullableTypeAnnotation(opts?: object): this is NodePath; /** @deprecated Use `isNumericLiteral` */ isNumberLiteral(opts?: object): this is NodePath; isNumberLiteralTypeAnnotation(opts?: object): this is NodePath; isNumberTypeAnnotation(opts?: object): this is NodePath; isNumericLiteral(opts?: object): this is NodePath; isObjectExpression(opts?: object): this is NodePath; isObjectMember(opts?: object): this is NodePath; isObjectMethod(opts?: object): this is NodePath; isObjectPattern(opts?: object): this is NodePath; isObjectProperty(opts?: object): this is NodePath; isObjectTypeAnnotation(opts?: object): this is NodePath; isObjectTypeCallProperty(opts?: object): this is NodePath; isObjectTypeIndexer(opts?: object): this is NodePath; isObjectTypeInternalSlot(opts?: object): this is NodePath; isObjectTypeProperty(opts?: object): this is NodePath; isObjectTypeSpreadProperty(opts?: object): this is NodePath; isOpaqueType(opts?: object): this is NodePath; isOptionalCallExpression(opts?: object): this is NodePath; isOptionalIndexedAccessType(opts?: object): this is NodePath; isOptionalMemberExpression(opts?: object): this is NodePath; isParenthesizedExpression(opts?: object): this is NodePath; isPattern(opts?: object): this is NodePath; isPatternLike(opts?: object): this is NodePath; isPipelineBareFunction(opts?: object): this is NodePath; isPipelinePrimaryTopicReference(opts?: object): this is NodePath; isPipelineTopicExpression(opts?: object): this is NodePath; isPlaceholder(opts?: object): this is NodePath; isPrivate(opts?: object): this is NodePath; isPrivateName(opts?: object): this is NodePath; isProgram(opts?: object): this is NodePath; isProperty(opts?: object): this is NodePath; isPureish(opts?: object): this is NodePath; isQualifiedTypeIdentifier(opts?: object): this is NodePath; isRecordExpression(opts?: object): this is NodePath; isRegExpLiteral(opts?: object): this is NodePath; /** @deprecated Use `isRegExpLiteral` */ isRegexLiteral(opts?: object): this is NodePath; isRestElement(opts?: object): this is NodePath; /** @deprecated Use `isRestElement` */ isRestProperty(opts?: object): this is NodePath; isReturnStatement(opts?: object): this is NodePath; isScopable(opts?: object): this is NodePath; isSequenceExpression(opts?: object): this is NodePath; isSpreadElement(opts?: object): this is NodePath; /** @deprecated Use `isSpreadElement` */ isSpreadProperty(opts?: object): this is NodePath; isStandardized(opts?: object): this is NodePath; isStatement(opts?: object): this is NodePath; isStaticBlock(opts?: object): this is NodePath; isStringLiteral(opts?: object): this is NodePath; isStringLiteralTypeAnnotation(opts?: object): this is NodePath; isStringTypeAnnotation(opts?: object): this is NodePath; isSuper(opts?: object): this is NodePath; isSwitchCase(opts?: object): this is NodePath; isSwitchStatement(opts?: object): this is NodePath; isSymbolTypeAnnotation(opts?: object): this is NodePath; isTSAnyKeyword(opts?: object): this is NodePath; isTSArrayType(opts?: object): this is NodePath; isTSAsExpression(opts?: object): this is NodePath; isTSBaseType(opts?: object): this is NodePath; isTSBigIntKeyword(opts?: object): this is NodePath; isTSBooleanKeyword(opts?: object): this is NodePath; isTSCallSignatureDeclaration(opts?: object): this is NodePath; isTSConditionalType(opts?: object): this is NodePath; isTSConstructSignatureDeclaration(opts?: object): this is NodePath; isTSConstructorType(opts?: object): this is NodePath; isTSDeclareFunction(opts?: object): this is NodePath; isTSDeclareMethod(opts?: object): this is NodePath; isTSEntityName(opts?: object): this is NodePath; isTSEnumDeclaration(opts?: object): this is NodePath; isTSEnumMember(opts?: object): this is NodePath; isTSExportAssignment(opts?: object): this is NodePath; isTSExpressionWithTypeArguments(opts?: object): this is NodePath; isTSExternalModuleReference(opts?: object): this is NodePath; isTSFunctionType(opts?: object): this is NodePath; isTSImportEqualsDeclaration(opts?: object): this is NodePath; isTSImportType(opts?: object): this is NodePath; isTSIndexSignature(opts?: object): this is NodePath; isTSIndexedAccessType(opts?: object): this is NodePath; isTSInferType(opts?: object): this is NodePath; isTSInstantiationExpression(opts?: object): this is NodePath; isTSInterfaceBody(opts?: object): this is NodePath; isTSInterfaceDeclaration(opts?: object): this is NodePath; isTSIntersectionType(opts?: object): this is NodePath; isTSIntrinsicKeyword(opts?: object): this is NodePath; isTSLiteralType(opts?: object): this is NodePath; isTSMappedType(opts?: object): this is NodePath; isTSMethodSignature(opts?: object): this is NodePath; isTSModuleBlock(opts?: object): this is NodePath; isTSModuleDeclaration(opts?: object): this is NodePath; isTSNamedTupleMember(opts?: object): this is NodePath; isTSNamespaceExportDeclaration(opts?: object): this is NodePath; isTSNeverKeyword(opts?: object): this is NodePath; isTSNonNullExpression(opts?: object): this is NodePath; isTSNullKeyword(opts?: object): this is NodePath; isTSNumberKeyword(opts?: object): this is NodePath; isTSObjectKeyword(opts?: object): this is NodePath; isTSOptionalType(opts?: object): this is NodePath; isTSParameterProperty(opts?: object): this is NodePath; isTSParenthesizedType(opts?: object): this is NodePath; isTSPropertySignature(opts?: object): this is NodePath; isTSQualifiedName(opts?: object): this is NodePath; isTSRestType(opts?: object): this is NodePath; isTSSatisfiesExpression(opts?: object): this is NodePath; isTSStringKeyword(opts?: object): this is NodePath; isTSSymbolKeyword(opts?: object): this is NodePath; isTSThisType(opts?: object): this is NodePath; isTSTupleType(opts?: object): this is NodePath; isTSType(opts?: object): this is NodePath; isTSTypeAliasDeclaration(opts?: object): this is NodePath; isTSTypeAnnotation(opts?: object): this is NodePath; isTSTypeAssertion(opts?: object): this is NodePath; isTSTypeElement(opts?: object): this is NodePath; isTSTypeLiteral(opts?: object): this is NodePath; isTSTypeOperator(opts?: object): this is NodePath; isTSTypeParameter(opts?: object): this is NodePath; isTSTypeParameterDeclaration(opts?: object): this is NodePath; isTSTypeParameterInstantiation(opts?: object): this is NodePath; isTSTypePredicate(opts?: object): this is NodePath; isTSTypeQuery(opts?: object): this is NodePath; isTSTypeReference(opts?: object): this is NodePath; isTSUndefinedKeyword(opts?: object): this is NodePath; isTSUnionType(opts?: object): this is NodePath; isTSUnknownKeyword(opts?: object): this is NodePath; isTSVoidKeyword(opts?: object): this is NodePath; isTaggedTemplateExpression(opts?: object): this is NodePath; isTemplateElement(opts?: object): this is NodePath; isTemplateLiteral(opts?: object): this is NodePath; isTerminatorless(opts?: object): this is NodePath; isThisExpression(opts?: object): this is NodePath; isThisTypeAnnotation(opts?: object): this is NodePath; isThrowStatement(opts?: object): this is NodePath; isTopicReference(opts?: object): this is NodePath; isTryStatement(opts?: object): this is NodePath; isTupleExpression(opts?: object): this is NodePath; isTupleTypeAnnotation(opts?: object): this is NodePath; isTypeAlias(opts?: object): this is NodePath; isTypeAnnotation(opts?: object): this is NodePath; isTypeCastExpression(opts?: object): this is NodePath; isTypeParameter(opts?: object): this is NodePath; isTypeParameterDeclaration(opts?: object): this is NodePath; isTypeParameterInstantiation(opts?: object): this is NodePath; isTypeScript(opts?: object): this is NodePath; isTypeofTypeAnnotation(opts?: object): this is NodePath; isUnaryExpression(opts?: object): this is NodePath; isUnaryLike(opts?: object): this is NodePath; isUnionTypeAnnotation(opts?: object): this is NodePath; isUpdateExpression(opts?: object): this is NodePath; isUserWhitespacable(opts?: object): this is NodePath; isV8IntrinsicIdentifier(opts?: object): this is NodePath; isVariableDeclaration(opts?: object): this is NodePath; isVariableDeclarator(opts?: object): this is NodePath; isVariance(opts?: object): this is NodePath; isVoidTypeAnnotation(opts?: object): this is NodePath; isWhile(opts?: object): this is NodePath; isWhileStatement(opts?: object): this is NodePath; isWithStatement(opts?: object): this is NodePath; isYieldExpression(opts?: object): this is NodePath; isBindingIdentifier(opts?: object): this is NodePath; isBlockScoped(opts?: object): this is NodePath; /** @deprecated */ isExistentialTypeParam(opts?: object): this is NodePath; isForAwaitStatement(opts?: object): this is NodePath; isGenerated(opts?: object): boolean; /** @deprecated */ isNumericLiteralTypeAnnotation(opts?: object): void; isPure(opts?: object): boolean; isReferenced(opts?: object): boolean; isReferencedIdentifier(opts?: object): this is NodePath; isReferencedMemberExpression(opts?: object): this is NodePath; isScope(opts?: object): this is NodePath; isUser(opts?: object): boolean; isVar(opts?: object): this is NodePath; // #endregion // #region ------------------------- assertXXX ------------------------- assertAccessor(opts?: object): asserts this is NodePath; assertAnyTypeAnnotation(opts?: object): asserts this is NodePath; assertArgumentPlaceholder(opts?: object): asserts this is NodePath; assertArrayExpression(opts?: object): asserts this is NodePath; assertArrayPattern(opts?: object): asserts this is NodePath; assertArrayTypeAnnotation(opts?: object): asserts this is NodePath; assertArrowFunctionExpression(opts?: object): asserts this is NodePath; assertAssignmentExpression(opts?: object): asserts this is NodePath; assertAssignmentPattern(opts?: object): asserts this is NodePath; assertAwaitExpression(opts?: object): asserts this is NodePath; assertBigIntLiteral(opts?: object): asserts this is NodePath; assertBinary(opts?: object): asserts this is NodePath; assertBinaryExpression(opts?: object): asserts this is NodePath; assertBindExpression(opts?: object): asserts this is NodePath; assertBlock(opts?: object): asserts this is NodePath; assertBlockParent(opts?: object): asserts this is NodePath; assertBlockStatement(opts?: object): asserts this is NodePath; assertBooleanLiteral(opts?: object): asserts this is NodePath; assertBooleanLiteralTypeAnnotation(opts?: object): asserts this is NodePath; assertBooleanTypeAnnotation(opts?: object): asserts this is NodePath; assertBreakStatement(opts?: object): asserts this is NodePath; assertCallExpression(opts?: object): asserts this is NodePath; assertCatchClause(opts?: object): asserts this is NodePath; assertClass(opts?: object): asserts this is NodePath; assertClassAccessorProperty(opts?: object): asserts this is NodePath; assertClassBody(opts?: object): asserts this is NodePath; assertClassDeclaration(opts?: object): asserts this is NodePath; assertClassExpression(opts?: object): asserts this is NodePath; assertClassImplements(opts?: object): asserts this is NodePath; assertClassMethod(opts?: object): asserts this is NodePath; assertClassPrivateMethod(opts?: object): asserts this is NodePath; assertClassPrivateProperty(opts?: object): asserts this is NodePath; assertClassProperty(opts?: object): asserts this is NodePath; assertCompletionStatement(opts?: object): asserts this is NodePath; assertConditional(opts?: object): asserts this is NodePath; assertConditionalExpression(opts?: object): asserts this is NodePath; assertContinueStatement(opts?: object): asserts this is NodePath; assertDebuggerStatement(opts?: object): asserts this is NodePath; assertDecimalLiteral(opts?: object): asserts this is NodePath; assertDeclaration(opts?: object): asserts this is NodePath; assertDeclareClass(opts?: object): asserts this is NodePath; assertDeclareExportAllDeclaration(opts?: object): asserts this is NodePath; assertDeclareExportDeclaration(opts?: object): asserts this is NodePath; assertDeclareFunction(opts?: object): asserts this is NodePath; assertDeclareInterface(opts?: object): asserts this is NodePath; assertDeclareModule(opts?: object): asserts this is NodePath; assertDeclareModuleExports(opts?: object): asserts this is NodePath; assertDeclareOpaqueType(opts?: object): asserts this is NodePath; assertDeclareTypeAlias(opts?: object): asserts this is NodePath; assertDeclareVariable(opts?: object): asserts this is NodePath; assertDeclaredPredicate(opts?: object): asserts this is NodePath; assertDecorator(opts?: object): asserts this is NodePath; assertDirective(opts?: object): asserts this is NodePath; assertDirectiveLiteral(opts?: object): asserts this is NodePath; assertDoExpression(opts?: object): asserts this is NodePath; assertDoWhileStatement(opts?: object): asserts this is NodePath; assertEmptyStatement(opts?: object): asserts this is NodePath; assertEmptyTypeAnnotation(opts?: object): asserts this is NodePath; assertEnumBody(opts?: object): asserts this is NodePath; assertEnumBooleanBody(opts?: object): asserts this is NodePath; assertEnumBooleanMember(opts?: object): asserts this is NodePath; assertEnumDeclaration(opts?: object): asserts this is NodePath; assertEnumDefaultedMember(opts?: object): asserts this is NodePath; assertEnumMember(opts?: object): asserts this is NodePath; assertEnumNumberBody(opts?: object): asserts this is NodePath; assertEnumNumberMember(opts?: object): asserts this is NodePath; assertEnumStringBody(opts?: object): asserts this is NodePath; assertEnumStringMember(opts?: object): asserts this is NodePath; assertEnumSymbolBody(opts?: object): asserts this is NodePath; assertExistsTypeAnnotation(opts?: object): asserts this is NodePath; assertExportAllDeclaration(opts?: object): asserts this is NodePath; assertExportDeclaration(opts?: object): asserts this is NodePath; assertExportDefaultDeclaration(opts?: object): asserts this is NodePath; assertExportDefaultSpecifier(opts?: object): asserts this is NodePath; assertExportNamedDeclaration(opts?: object): asserts this is NodePath; assertExportNamespaceSpecifier(opts?: object): asserts this is NodePath; assertExportSpecifier(opts?: object): asserts this is NodePath; assertExpression(opts?: object): asserts this is NodePath; assertExpressionStatement(opts?: object): asserts this is NodePath; assertExpressionWrapper(opts?: object): asserts this is NodePath; assertFile(opts?: object): asserts this is NodePath; assertFlow(opts?: object): asserts this is NodePath; assertFlowBaseAnnotation(opts?: object): asserts this is NodePath; assertFlowDeclaration(opts?: object): asserts this is NodePath; assertFlowPredicate(opts?: object): asserts this is NodePath; assertFlowType(opts?: object): asserts this is NodePath; assertFor(opts?: object): asserts this is NodePath; assertForInStatement(opts?: object): asserts this is NodePath; assertForOfStatement(opts?: object): asserts this is NodePath; assertForStatement(opts?: object): asserts this is NodePath; assertForXStatement(opts?: object): asserts this is NodePath; assertFunction(opts?: object): asserts this is NodePath; assertFunctionDeclaration(opts?: object): asserts this is NodePath; assertFunctionExpression(opts?: object): asserts this is NodePath; assertFunctionParent(opts?: object): asserts this is NodePath; assertFunctionTypeAnnotation(opts?: object): asserts this is NodePath; assertFunctionTypeParam(opts?: object): asserts this is NodePath; assertGenericTypeAnnotation(opts?: object): asserts this is NodePath; assertIdentifier(opts?: object): asserts this is NodePath; assertIfStatement(opts?: object): asserts this is NodePath; assertImmutable(opts?: object): asserts this is NodePath; assertImport(opts?: object): asserts this is NodePath; assertImportAttribute(opts?: object): asserts this is NodePath; assertImportDeclaration(opts?: object): asserts this is NodePath; assertImportDefaultSpecifier(opts?: object): asserts this is NodePath; assertImportNamespaceSpecifier(opts?: object): asserts this is NodePath; assertImportSpecifier(opts?: object): asserts this is NodePath; assertIndexedAccessType(opts?: object): asserts this is NodePath; assertInferredPredicate(opts?: object): asserts this is NodePath; assertInterfaceDeclaration(opts?: object): asserts this is NodePath; assertInterfaceExtends(opts?: object): asserts this is NodePath; assertInterfaceTypeAnnotation(opts?: object): asserts this is NodePath; assertInterpreterDirective(opts?: object): asserts this is NodePath; assertIntersectionTypeAnnotation(opts?: object): asserts this is NodePath; assertJSX(opts?: object): asserts this is NodePath; assertJSXAttribute(opts?: object): asserts this is NodePath; assertJSXClosingElement(opts?: object): asserts this is NodePath; assertJSXClosingFragment(opts?: object): asserts this is NodePath; assertJSXElement(opts?: object): asserts this is NodePath; assertJSXEmptyExpression(opts?: object): asserts this is NodePath; assertJSXExpressionContainer(opts?: object): asserts this is NodePath; assertJSXFragment(opts?: object): asserts this is NodePath; assertJSXIdentifier(opts?: object): asserts this is NodePath; assertJSXMemberExpression(opts?: object): asserts this is NodePath; assertJSXNamespacedName(opts?: object): asserts this is NodePath; assertJSXOpeningElement(opts?: object): asserts this is NodePath; assertJSXOpeningFragment(opts?: object): asserts this is NodePath; assertJSXSpreadAttribute(opts?: object): asserts this is NodePath; assertJSXSpreadChild(opts?: object): asserts this is NodePath; assertJSXText(opts?: object): asserts this is NodePath; assertLVal(opts?: object): asserts this is NodePath; assertLabeledStatement(opts?: object): asserts this is NodePath; assertLiteral(opts?: object): asserts this is NodePath; assertLogicalExpression(opts?: object): asserts this is NodePath; assertLoop(opts?: object): asserts this is NodePath; assertMemberExpression(opts?: object): asserts this is NodePath; assertMetaProperty(opts?: object): asserts this is NodePath; assertMethod(opts?: object): asserts this is NodePath; assertMiscellaneous(opts?: object): asserts this is NodePath; assertMixedTypeAnnotation(opts?: object): asserts this is NodePath; assertModuleDeclaration(opts?: object): asserts this is NodePath; assertModuleExpression(opts?: object): asserts this is NodePath; assertModuleSpecifier(opts?: object): asserts this is NodePath; assertNewExpression(opts?: object): asserts this is NodePath; assertNoop(opts?: object): asserts this is NodePath; assertNullLiteral(opts?: object): asserts this is NodePath; assertNullLiteralTypeAnnotation(opts?: object): asserts this is NodePath; assertNullableTypeAnnotation(opts?: object): asserts this is NodePath; /** @deprecated Use `assertNumericLiteral` */ assertNumberLiteral(opts?: object): asserts this is NodePath; assertNumberLiteralTypeAnnotation(opts?: object): asserts this is NodePath; assertNumberTypeAnnotation(opts?: object): asserts this is NodePath; assertNumericLiteral(opts?: object): asserts this is NodePath; assertObjectExpression(opts?: object): asserts this is NodePath; assertObjectMember(opts?: object): asserts this is NodePath; assertObjectMethod(opts?: object): asserts this is NodePath; assertObjectPattern(opts?: object): asserts this is NodePath; assertObjectProperty(opts?: object): asserts this is NodePath; assertObjectTypeAnnotation(opts?: object): asserts this is NodePath; assertObjectTypeCallProperty(opts?: object): asserts this is NodePath; assertObjectTypeIndexer(opts?: object): asserts this is NodePath; assertObjectTypeInternalSlot(opts?: object): asserts this is NodePath; assertObjectTypeProperty(opts?: object): asserts this is NodePath; assertObjectTypeSpreadProperty(opts?: object): asserts this is NodePath; assertOpaqueType(opts?: object): asserts this is NodePath; assertOptionalCallExpression(opts?: object): asserts this is NodePath; assertOptionalIndexedAccessType(opts?: object): asserts this is NodePath; assertOptionalMemberExpression(opts?: object): asserts this is NodePath; assertParenthesizedExpression(opts?: object): asserts this is NodePath; assertPattern(opts?: object): asserts this is NodePath; assertPatternLike(opts?: object): asserts this is NodePath; assertPipelineBareFunction(opts?: object): asserts this is NodePath; assertPipelinePrimaryTopicReference(opts?: object): asserts this is NodePath; assertPipelineTopicExpression(opts?: object): asserts this is NodePath; assertPlaceholder(opts?: object): asserts this is NodePath; assertPrivate(opts?: object): asserts this is NodePath; assertPrivateName(opts?: object): asserts this is NodePath; assertProgram(opts?: object): asserts this is NodePath; assertProperty(opts?: object): asserts this is NodePath; assertPureish(opts?: object): asserts this is NodePath; assertQualifiedTypeIdentifier(opts?: object): asserts this is NodePath; assertRecordExpression(opts?: object): asserts this is NodePath; assertRegExpLiteral(opts?: object): asserts this is NodePath; /** @deprecated Use `assertRegExpLiteral` */ assertRegexLiteral(opts?: object): asserts this is NodePath; assertRestElement(opts?: object): asserts this is NodePath; /** @deprecated Use `assertRestElement` */ assertRestProperty(opts?: object): asserts this is NodePath; assertReturnStatement(opts?: object): asserts this is NodePath; assertScopable(opts?: object): asserts this is NodePath; assertSequenceExpression(opts?: object): asserts this is NodePath; assertSpreadElement(opts?: object): asserts this is NodePath; /** @deprecated Use `assertSpreadElement` */ assertSpreadProperty(opts?: object): asserts this is NodePath; assertStandardized(opts?: object): asserts this is NodePath; assertStatement(opts?: object): asserts this is NodePath; assertStaticBlock(opts?: object): asserts this is NodePath; assertStringLiteral(opts?: object): asserts this is NodePath; assertStringLiteralTypeAnnotation(opts?: object): asserts this is NodePath; assertStringTypeAnnotation(opts?: object): asserts this is NodePath; assertSuper(opts?: object): asserts this is NodePath; assertSwitchCase(opts?: object): asserts this is NodePath; assertSwitchStatement(opts?: object): asserts this is NodePath; assertSymbolTypeAnnotation(opts?: object): asserts this is NodePath; assertTSAnyKeyword(opts?: object): asserts this is NodePath; assertTSArrayType(opts?: object): asserts this is NodePath; assertTSAsExpression(opts?: object): asserts this is NodePath; assertTSBaseType(opts?: object): asserts this is NodePath; assertTSBigIntKeyword(opts?: object): asserts this is NodePath; assertTSBooleanKeyword(opts?: object): asserts this is NodePath; assertTSCallSignatureDeclaration(opts?: object): asserts this is NodePath; assertTSConditionalType(opts?: object): asserts this is NodePath; assertTSConstructSignatureDeclaration(opts?: object): asserts this is NodePath; assertTSConstructorType(opts?: object): asserts this is NodePath; assertTSDeclareFunction(opts?: object): asserts this is NodePath; assertTSDeclareMethod(opts?: object): asserts this is NodePath; assertTSEntityName(opts?: object): asserts this is NodePath; assertTSEnumDeclaration(opts?: object): asserts this is NodePath; assertTSEnumMember(opts?: object): asserts this is NodePath; assertTSExportAssignment(opts?: object): asserts this is NodePath; assertTSExpressionWithTypeArguments(opts?: object): asserts this is NodePath; assertTSExternalModuleReference(opts?: object): asserts this is NodePath; assertTSFunctionType(opts?: object): asserts this is NodePath; assertTSImportEqualsDeclaration(opts?: object): asserts this is NodePath; assertTSImportType(opts?: object): asserts this is NodePath; assertTSIndexSignature(opts?: object): asserts this is NodePath; assertTSIndexedAccessType(opts?: object): asserts this is NodePath; assertTSInferType(opts?: object): asserts this is NodePath; assertTSInstantiationExpression(opts?: object): asserts this is NodePath; assertTSInterfaceBody(opts?: object): asserts this is NodePath; assertTSInterfaceDeclaration(opts?: object): asserts this is NodePath; assertTSIntersectionType(opts?: object): asserts this is NodePath; assertTSIntrinsicKeyword(opts?: object): asserts this is NodePath; assertTSLiteralType(opts?: object): asserts this is NodePath; assertTSMappedType(opts?: object): asserts this is NodePath; assertTSMethodSignature(opts?: object): asserts this is NodePath; assertTSModuleBlock(opts?: object): asserts this is NodePath; assertTSModuleDeclaration(opts?: object): asserts this is NodePath; assertTSNamedTupleMember(opts?: object): asserts this is NodePath; assertTSNamespaceExportDeclaration(opts?: object): asserts this is NodePath; assertTSNeverKeyword(opts?: object): asserts this is NodePath; assertTSNonNullExpression(opts?: object): asserts this is NodePath; assertTSNullKeyword(opts?: object): asserts this is NodePath; assertTSNumberKeyword(opts?: object): asserts this is NodePath; assertTSObjectKeyword(opts?: object): asserts this is NodePath; assertTSOptionalType(opts?: object): asserts this is NodePath; assertTSParameterProperty(opts?: object): asserts this is NodePath; assertTSParenthesizedType(opts?: object): asserts this is NodePath; assertTSPropertySignature(opts?: object): asserts this is NodePath; assertTSQualifiedName(opts?: object): asserts this is NodePath; assertTSRestType(opts?: object): asserts this is NodePath; assertTSSatisfiesExpression(opts?: object): asserts this is NodePath; assertTSStringKeyword(opts?: object): asserts this is NodePath; assertTSSymbolKeyword(opts?: object): asserts this is NodePath; assertTSThisType(opts?: object): asserts this is NodePath; assertTSTupleType(opts?: object): asserts this is NodePath; assertTSType(opts?: object): asserts this is NodePath; assertTSTypeAliasDeclaration(opts?: object): asserts this is NodePath; assertTSTypeAnnotation(opts?: object): asserts this is NodePath; assertTSTypeAssertion(opts?: object): asserts this is NodePath; assertTSTypeElement(opts?: object): asserts this is NodePath; assertTSTypeLiteral(opts?: object): asserts this is NodePath; assertTSTypeOperator(opts?: object): asserts this is NodePath; assertTSTypeParameter(opts?: object): asserts this is NodePath; assertTSTypeParameterDeclaration(opts?: object): asserts this is NodePath; assertTSTypeParameterInstantiation(opts?: object): asserts this is NodePath; assertTSTypePredicate(opts?: object): asserts this is NodePath; assertTSTypeQuery(opts?: object): asserts this is NodePath; assertTSTypeReference(opts?: object): asserts this is NodePath; assertTSUndefinedKeyword(opts?: object): asserts this is NodePath; assertTSUnionType(opts?: object): asserts this is NodePath; assertTSUnknownKeyword(opts?: object): asserts this is NodePath; assertTSVoidKeyword(opts?: object): asserts this is NodePath; assertTaggedTemplateExpression(opts?: object): asserts this is NodePath; assertTemplateElement(opts?: object): asserts this is NodePath; assertTemplateLiteral(opts?: object): asserts this is NodePath; assertTerminatorless(opts?: object): asserts this is NodePath; assertThisExpression(opts?: object): asserts this is NodePath; assertThisTypeAnnotation(opts?: object): asserts this is NodePath; assertThrowStatement(opts?: object): asserts this is NodePath; assertTopicReference(opts?: object): asserts this is NodePath; assertTryStatement(opts?: object): asserts this is NodePath; assertTupleExpression(opts?: object): asserts this is NodePath; assertTupleTypeAnnotation(opts?: object): asserts this is NodePath; assertTypeAlias(opts?: object): asserts this is NodePath; assertTypeAnnotation(opts?: object): asserts this is NodePath; assertTypeCastExpression(opts?: object): asserts this is NodePath; assertTypeParameter(opts?: object): asserts this is NodePath; assertTypeParameterDeclaration(opts?: object): asserts this is NodePath; assertTypeParameterInstantiation(opts?: object): asserts this is NodePath; assertTypeScript(opts?: object): asserts this is NodePath; assertTypeofTypeAnnotation(opts?: object): asserts this is NodePath; assertUnaryExpression(opts?: object): asserts this is NodePath; assertUnaryLike(opts?: object): asserts this is NodePath; assertUnionTypeAnnotation(opts?: object): asserts this is NodePath; assertUpdateExpression(opts?: object): asserts this is NodePath; assertUserWhitespacable(opts?: object): asserts this is NodePath; assertV8IntrinsicIdentifier(opts?: object): asserts this is NodePath; assertVariableDeclaration(opts?: object): asserts this is NodePath; assertVariableDeclarator(opts?: object): asserts this is NodePath; assertVariance(opts?: object): asserts this is NodePath; assertVoidTypeAnnotation(opts?: object): asserts this is NodePath; assertWhile(opts?: object): asserts this is NodePath; assertWhileStatement(opts?: object): asserts this is NodePath; assertWithStatement(opts?: object): asserts this is NodePath; assertYieldExpression(opts?: object): asserts this is NodePath; // #endregion } interface HubInterface { getCode(): string | undefined; getScope(): Scope | undefined; addHelper(name: string): any; buildError(node: Node$1, msg: string, Error: ErrorConstructor): Error; } declare class Hub implements HubInterface { constructor(); getCode(): string | undefined; getScope(): Scope | undefined; addHelper(name: string): any; buildError(node: Node$1, msg: string, Error?: ErrorConstructor): Error; } interface TraversalContext { parentPath: NodePath; scope: Scope; state: S; opts: TraverseOptions; } type NodePathResult = (Extract extends never ? never : NodePath>) | (T extends Array ? Array> : never); interface VirtualTypeAliases { BindingIdentifier: Identifier; BlockScoped: Node$1; ExistentialTypeParam: ExistsTypeAnnotation; Flow: Flow | ImportDeclaration | ExportDeclaration | ImportSpecifier; ForAwaitStatement: ForOfStatement; Generated: Node$1; NumericLiteralTypeAnnotation: NumberLiteralTypeAnnotation; Pure: Node$1; Referenced: Node$1; ReferencedIdentifier: Identifier | JSXIdentifier; ReferencedMemberExpression: MemberExpression; RestProperty: RestElement; Scope: Scopable | Pattern; SpreadProperty: RestElement; User: Node$1; Var: VariableDeclaration; } declare namespace index_d_exports { export { BabelFile, BabelFileMetadata, BabelFileModulesMetadata, BabelFileResult, ConfigAPI, ConfigFunction, ConfigItem, CreateConfigItemOptions, DEFAULT_EXTENSIONS, EnvFunction, FileParseCallback, FileResultCallback, GeneratorOptions, MatchPattern, MatchPatternContext, Node, NodePath, ParseResult, ParserOptions, PartialConfig, PluginItem, PluginObj, PluginOptions, PluginPass, PluginTarget, SimpleCacheCallback, SimpleCacheConfigurator, SimpleCacheKey, TransformCaller, TransformOptions, Visitor, createConfigItem, loadOptions, loadPartialConfig, loadPartialConfigAsync, parse, parseAsync, parseSync, resolvePlugin, resolvePreset, templateBuilder as template, transform, transformAsync, transformFile, transformFileAsync, transformFileSync, transformFromAst, transformFromAstAsync, transformFromAstSync, transformSync, traverse$1 as traverse, index_d_exports$1 as types, version }; } type Node = Node$1; type ParseResult = ReturnType; declare const version: string; declare const DEFAULT_EXTENSIONS: [".js", ".jsx", ".es6", ".es", ".mjs"]; /** * Source map standard format as to revision 3 * @see {@link https://sourcemaps.info/spec.html} * @see {@link https://github.com/mozilla/source-map/blob/HEAD/source-map.d.ts} */ interface InputSourceMap { version: number; sources: string[]; names: string[]; sourceRoot?: string | undefined; sourcesContent?: string[] | undefined; mappings: string; file: string; } interface TransformOptions { /** * Specify which assumptions it can make about your code, to better optimize the compilation result. **NOTE**: This replaces the various `loose` options in plugins in favor of * top-level options that can apply to multiple plugins * * @see https://babeljs.io/docs/en/assumptions */ assumptions?: { [name: string]: boolean; } | null | undefined; /** * Include the AST in the returned object * * Default: `false` */ ast?: boolean | null | undefined; /** * Attach a comment after all non-user injected code * * Default: `null` */ auxiliaryCommentAfter?: string | null | undefined; /** * Attach a comment before all non-user injected code * * Default: `null` */ auxiliaryCommentBefore?: string | null | undefined; /** * Specify the "root" folder that defines the location to search for "babel.config.js", and the default folder to allow `.babelrc` files inside of. * * Default: `"."` */ root?: string | null | undefined; /** * This option, combined with the "root" value, defines how Babel chooses its project root. * The different modes define different ways that Babel can process the "root" value to get * the final project root. * * @see https://babeljs.io/docs/en/next/options#rootmode */ rootMode?: "root" | "upward" | "upward-optional" | undefined; /** * The config file to load Babel's config from. Defaults to searching for "babel.config.js" inside the "root" folder. `false` will disable searching for config files. * * Default: `undefined` */ configFile?: string | boolean | null | undefined; /** * Specify whether or not to use .babelrc and * .babelignore files. * * Default: `true` */ babelrc?: boolean | null | undefined; /** * Specify which packages should be search for .babelrc files when they are being compiled. `true` to always search, or a path string or an array of paths to packages to search * inside of. Defaults to only searching the "root" package. * * Default: `(root)` */ babelrcRoots?: boolean | MatchPattern | MatchPattern[] | null | undefined; /** * Toggles whether or not browserslist config sources are used, which includes searching for any browserslist files or referencing the browserslist key inside package.json. * This is useful for projects that use a browserslist config for files that won't be compiled with Babel. * * If a string is specified, it must represent the path of a browserslist configuration file. Relative paths are resolved relative to the configuration file which specifies * this option, or to `cwd` when it's passed as part of the programmatic options. * * Default: `true` */ browserslistConfigFile?: boolean | null | undefined; /** * The Browserslist environment to use. * * Default: `undefined` */ browserslistEnv?: string | null | undefined; /** * By default `babel.transformFromAst` will clone the input AST to avoid mutations. * Specifying `cloneInputAst: false` can improve parsing performance if the input AST is not used elsewhere. * * Default: `true` */ cloneInputAst?: boolean | null | undefined; /** * Defaults to environment variable `BABEL_ENV` if set, or else `NODE_ENV` if set, or else it defaults to `"development"` * * Default: env vars */ envName?: string | undefined; /** * If any of patterns match, the current configuration object is considered inactive and is ignored during config processing. */ exclude?: MatchPattern | MatchPattern[] | undefined; /** * Enable code generation * * Default: `true` */ code?: boolean | null | undefined; /** * Output comments in generated output * * Default: `true` */ comments?: boolean | null | undefined; /** * Do not include superfluous whitespace characters and line terminators. When set to `"auto"` compact is set to `true` on input sizes of >500KB * * Default: `"auto"` */ compact?: boolean | "auto" | null | undefined; /** * The working directory that Babel's programmatic options are loaded relative to. * * Default: `"."` */ cwd?: string | null | undefined; /** * Utilities may pass a caller object to identify themselves to Babel and * pass capability-related flags for use by configs, presets and plugins. * * @see https://babeljs.io/docs/en/next/options#caller */ caller?: TransformCaller | undefined; /** * This is an object of keys that represent different environments. For example, you may have: `{ env: { production: { \/* specific options *\/ } } }` * which will use those options when the `envName` is `production` * * Default: `{}` */ env?: { [index: string]: TransformOptions | null | undefined; } | null | undefined; /** * A path to a `.babelrc` file to extend * * Default: `null` */ extends?: string | null | undefined; /** * Filename for use in errors etc * * Default: `"unknown"` */ filename?: string | null | undefined; /** * Filename relative to `sourceRoot` * * Default: `(filename)` */ filenameRelative?: string | null | undefined; /** * An object containing the options to be passed down to the babel code generator, @babel/generator * * Default: `{}` */ generatorOpts?: GeneratorOptions | null | undefined; /** * Specify a custom callback to generate a module id with. Called as `getModuleId(moduleName)`. If falsy value is returned then the generated module id is used * * Default: `null` */ getModuleId?: ((moduleName: string) => string | null | undefined) | null | undefined; /** * ANSI highlight syntax error code frames * * Default: `true` */ highlightCode?: boolean | null | undefined; /** * Opposite to the `only` option. `ignore` is disregarded if `only` is specified * * Default: `null` */ ignore?: MatchPattern[] | null | undefined; /** * This option is a synonym for "test" */ include?: MatchPattern | MatchPattern[] | undefined; /** * A source map object that the output source map will be based on * * Default: `null` */ inputSourceMap?: InputSourceMap | null | undefined; /** * Should the output be minified (not printing last semicolons in blocks, printing literal string values instead of escaped ones, stripping `()` from `new` when safe) * * Default: `false` */ minified?: boolean | null | undefined; /** * Specify a custom name for module ids * * Default: `null` */ moduleId?: string | null | undefined; /** * If truthy, insert an explicit id for modules. By default, all modules are anonymous. (Not available for `common` modules) * * Default: `false` */ moduleIds?: boolean | null | undefined; /** * Optional prefix for the AMD module formatter that will be prepend to the filename on module definitions * * Default: `(sourceRoot)` */ moduleRoot?: string | null | undefined; /** * A glob, regex, or mixed array of both, matching paths to **only** compile. Can also be an array of arrays containing paths to explicitly match. When attempting to compile * a non-matching file it's returned verbatim * * Default: `null` */ only?: MatchPattern[] | null | undefined; /** * Allows users to provide an array of options that will be merged into the current configuration one at a time. * This feature is best used alongside the "test"/"include"/"exclude" options to provide conditions for which an override should apply */ overrides?: TransformOptions[] | undefined; /** * An object containing the options to be passed down to the babel parser, @babel/parser * * Default: `{}` */ parserOpts?: ParserOptions | null | undefined; /** * List of plugins to load and use * * Default: `[]` */ plugins?: PluginItem[] | null | undefined; /** * List of presets (a set of plugins) to load and use * * Default: `[]` */ presets?: PluginItem[] | null | undefined; /** * Retain line numbers. This will lead to wacky code but is handy for scenarios where you can't use source maps. (**NOTE**: This will not retain the columns) * * Default: `false` */ retainLines?: boolean | null | undefined; /** * An optional callback that controls whether a comment should be output or not. Called as `shouldPrintComment(commentContents)`. **NOTE**: This overrides the `comment` option when used * * Default: `null` */ shouldPrintComment?: ((commentContents: string) => boolean) | null | undefined; /** * Set `sources[0]` on returned source map * * Default: `(filenameRelative)` */ sourceFileName?: string | null | undefined; /** * If truthy, adds a `map` property to returned output. If set to `"inline"`, a comment with a sourceMappingURL directive is added to the bottom of the returned code. If set to `"both"` * then a `map` property is returned as well as a source map comment appended. **This does not emit sourcemap files by itself!** * * Default: `false` */ sourceMaps?: boolean | "inline" | "both" | null | undefined; /** * The root from which all sources are relative * * Default: `(moduleRoot)` */ sourceRoot?: string | null | undefined; /** * Indicate the mode the code should be parsed in. Can be one of "script", "module", or "unambiguous". `"unambiguous"` will make Babel attempt to guess, based on the presence of ES6 * `import` or `export` statements. Files with ES6 `import`s and `export`s are considered `"module"` and are otherwise `"script"`. * * Default: `("module")` */ sourceType?: "script" | "module" | "unambiguous" | null | undefined; /** * If all patterns fail to match, the current configuration object is considered inactive and is ignored during config processing. */ test?: MatchPattern | MatchPattern[] | undefined; /** * Describes the environments you support/target for your project. * This can either be a [browserslist-compatible](https://github.com/ai/browserslist) query (with [caveats](https://babeljs.io/docs/en/babel-preset-env#ineffective-browserslist-queries)) * * Default: `{}` */ targets?: string | string[] | { esmodules?: boolean; node?: Omit | "current" | true; safari?: Omit | "tp"; browsers?: string | string[]; android?: string; chrome?: string; deno?: string; edge?: string; electron?: string; firefox?: string; ie?: string; ios?: string; opera?: string; rhino?: string; samsung?: string; }; /** * An optional callback that can be used to wrap visitor methods. **NOTE**: This is useful for things like introspection, and not really needed for implementing anything. Called as * `wrapPluginVisitorMethod(pluginAlias, visitorType, callback)`. */ wrapPluginVisitorMethod?: ((pluginAlias: string, visitorType: "enter" | "exit", callback: (path: NodePath, state: any) => void) => (path: NodePath, state: any) => void) | null | undefined; } interface TransformCaller { // the only required property name: string; // e.g. set to true by `babel-loader` and false by `babel-jest` supportsStaticESM?: boolean | undefined; supportsDynamicImport?: boolean | undefined; supportsExportNamespaceFrom?: boolean | undefined; supportsTopLevelAwait?: boolean | undefined; // augment this with a "declare module '@babel/core' { ... }" if you need more keys } type FileResultCallback = (err: Error | null, result: BabelFileResult | null) => any; interface MatchPatternContext { envName: string; dirname: string; caller: TransformCaller | undefined; } type MatchPattern = string | RegExp | ((filename: string | undefined, context: MatchPatternContext) => boolean); /** * Transforms the passed in code. Calling a callback with an object with the generated code, source map, and AST. */ declare function transform(code: string, callback: FileResultCallback): void; /** * Transforms the passed in code. Calling a callback with an object with the generated code, source map, and AST. */ declare function transform(code: string, opts: TransformOptions | undefined, callback: FileResultCallback): void; /** * Here for backward-compatibility. Ideally use `transformSync` if you want a synchronous API. */ declare function transform(code: string, opts?: TransformOptions): BabelFileResult | null; /** * Transforms the passed in code. Returning an object with the generated code, source map, and AST. */ declare function transformSync(code: string, opts?: TransformOptions): BabelFileResult | null; /** * Transforms the passed in code. Calling a callback with an object with the generated code, source map, and AST. */ declare function transformAsync(code: string, opts?: TransformOptions): Promise; /** * Asynchronously transforms the entire contents of a file. */ declare function transformFile(filename: string, callback: FileResultCallback): void; /** * Asynchronously transforms the entire contents of a file. */ declare function transformFile(filename: string, opts: TransformOptions | undefined, callback: FileResultCallback): void; /** * Synchronous version of `babel.transformFile`. Returns the transformed contents of the `filename`. */ declare function transformFileSync(filename: string, opts?: TransformOptions): BabelFileResult | null; /** * Asynchronously transforms the entire contents of a file. */ declare function transformFileAsync(filename: string, opts?: TransformOptions): Promise; /** * Given an AST, transform it. */ declare function transformFromAst(ast: Node, code: string | undefined, callback: FileResultCallback): void; /** * Given an AST, transform it. */ declare function transformFromAst(ast: Node, code: string | undefined, opts: TransformOptions | undefined, callback: FileResultCallback): void; /** * Here for backward-compatibility. Ideally use ".transformSync" if you want a synchronous API. */ declare function transformFromAstSync(ast: Node, code?: string, opts?: TransformOptions): BabelFileResult | null; /** * Given an AST, transform it. */ declare function transformFromAstAsync(ast: Node, code?: string, opts?: TransformOptions): Promise; // A babel plugin is a simple function which must return an object matching // the following interface. Babel will throw if it finds unknown properties. // The list of allowed plugin keys is here: // https://github.com/babel/babel/blob/4e50b2d9d9c376cee7a2cbf56553fe5b982ea53c/packages/babel-core/src/config/option-manager.js#L71 interface PluginObj { name?: string | undefined; manipulateOptions?(opts: any, parserOpts: any): void; pre?(this: S, file: BabelFile): void; visitor: Visitor; post?(this: S, file: BabelFile): void; inherits?: any; } interface BabelFile { ast: File; opts: TransformOptions; hub: Hub; metadata: object; path: NodePath; scope: Scope; inputMap: object | null; code: string; } interface PluginPass { file: BabelFile; key: string; opts: object; cwd: string; filename: string | undefined; get(key: unknown): any; set(key: unknown, value: unknown): void; [key: string]: unknown; } interface BabelFileResult { ast?: File | null | undefined; code?: string | null | undefined; ignored?: boolean | undefined; map?: { version: number; sources: string[]; names: string[]; sourceRoot?: string | undefined; sourcesContent?: string[] | undefined; mappings: string; file: string; } | null | undefined; metadata?: BabelFileMetadata | undefined; } interface BabelFileMetadata { usedHelpers: string[]; marked: Array<{ type: string; message: string; loc: object; }>; modules: BabelFileModulesMetadata; } interface BabelFileModulesMetadata { imports: object[]; exports: { exported: object[]; specifiers: object[]; }; } type FileParseCallback = (err: Error | null, result: ParseResult | null) => any; /** * Given some code, parse it using Babel's standard behavior. * Referenced presets and plugins will be loaded such that optional syntax plugins are automatically enabled. */ declare function parse(code: string, callback: FileParseCallback): void; /** * Given some code, parse it using Babel's standard behavior. * Referenced presets and plugins will be loaded such that optional syntax plugins are automatically enabled. */ declare function parse(code: string, options: TransformOptions | undefined, callback: FileParseCallback): void; /** * Given some code, parse it using Babel's standard behavior. * Referenced presets and plugins will be loaded such that optional syntax plugins are automatically enabled. */ declare function parse(code: string, options?: TransformOptions): ParseResult | null; /** * Given some code, parse it using Babel's standard behavior. * Referenced presets and plugins will be loaded such that optional syntax plugins are automatically enabled. */ declare function parseSync(code: string, options?: TransformOptions): ParseResult | null; /** * Given some code, parse it using Babel's standard behavior. * Referenced presets and plugins will be loaded such that optional syntax plugins are automatically enabled. */ declare function parseAsync(code: string, options?: TransformOptions): Promise; /** * Resolve Babel's options fully, resulting in an options object where: * * * opts.plugins is a full list of Plugin instances. * * opts.presets is empty and all presets are flattened into opts. * * It can be safely passed back to Babel. Fields like babelrc have been set to false so that later calls to Babel * will not make a second attempt to load config files. * * Plugin instances aren't meant to be manipulated directly, but often callers will serialize this opts to JSON to * use it as a cache key representing the options Babel has received. Caching on this isn't 100% guaranteed to * invalidate properly, but it is the best we have at the moment. */ declare function loadOptions(options?: TransformOptions): object | null; /** * To allow systems to easily manipulate and validate a user's config, this function resolves the plugins and * presets and proceeds no further. The expectation is that callers will take the config's .options, manipulate it * as then see fit and pass it back to Babel again. * * * `babelrc: string | void` - The path of the `.babelrc` file, if there was one. * * `babelignore: string | void` - The path of the `.babelignore` file, if there was one. * * `options: ValidatedOptions` - The partially resolved options, which can be manipulated and passed back * to Babel again. * * `plugins: Array` - See below. * * `presets: Array` - See below. * * It can be safely passed back to Babel. Fields like `babelrc` have been set to false so that later calls to * Babel will not make a second attempt to load config files. * * `ConfigItem` instances expose properties to introspect the values, but each item should be treated as * immutable. If changes are desired, the item should be removed from the list and replaced with either a normal * Babel config value, or with a replacement item created by `babel.createConfigItem`. See that function for * information about `ConfigItem` fields. */ declare function loadPartialConfig(options?: TransformOptions): Readonly | null; declare function loadPartialConfigAsync(options?: TransformOptions): Promise | null>; interface PartialConfig { options: TransformOptions; babelrc?: string | undefined; babelignore?: string | undefined; config?: string | undefined; hasFilesystemConfig: () => boolean; } interface ConfigItem { /** * The name that the user gave the plugin instance, e.g. `plugins: [ ['env', {}, 'my-env'] ]` */ name?: string | undefined; /** * The resolved value of the plugin. */ value: object | ((...args: any[]) => any); /** * The options object passed to the plugin. */ options?: object | false | undefined; /** * The path that the options are relative to. */ dirname: string; /** * Information about the plugin's file, if Babel knows it. * * */ file?: { /** * The file that the user requested, e.g. `"@babel/env"` */ request: string; /** * The full path of the resolved file, e.g. `"/tmp/node_modules/@babel/preset-env/lib/index.js"` */ resolved: string; } | null | undefined; } type PluginOptions = object | undefined | false; type PluginTarget = string | object | ((...args: any[]) => any); type PluginItem = ConfigItem | PluginObj | PluginTarget | [PluginTarget, PluginOptions] | [PluginTarget, PluginOptions, string | undefined]; declare function resolvePlugin(name: string, dirname: string): string | null; declare function resolvePreset(name: string, dirname: string): string | null; interface CreateConfigItemOptions { dirname?: string | undefined; type?: "preset" | "plugin" | undefined; } /** * Allows build tooling to create and cache config items up front. If this function is called multiple times for a * given plugin, Babel will call the plugin's function itself multiple times. If you have a clear set of expected * plugins and presets to inject, pre-constructing the config items would be recommended. */ declare function createConfigItem(value: PluginTarget | [PluginTarget, PluginOptions] | [PluginTarget, PluginOptions, string | undefined], options?: CreateConfigItemOptions): ConfigItem; // NOTE: the documentation says the ConfigAPI also exposes @babel/core's exports, but it actually doesn't /** * @see https://babeljs.io/docs/en/next/config-files#config-function-api */ interface ConfigAPI { /** * The version string for the Babel version that is loading the config file. * * @see https://babeljs.io/docs/en/next/config-files#apiversion */ version: string; /** * @see https://babeljs.io/docs/en/next/config-files#apicache */ cache: SimpleCacheConfigurator; /** * @see https://babeljs.io/docs/en/next/config-files#apienv */ env: EnvFunction; // undocumented; currently hardcoded to return 'false' // async(): boolean /** * This API is used as a way to access the `caller` data that has been passed to Babel. * Since many instances of Babel may be running in the same process with different `caller` values, * this API is designed to automatically configure `api.cache`, the same way `api.env()` does. * * The `caller` value is available as the first parameter of the callback function. * It is best used with something like this to toggle configuration behavior * based on a specific environment: * * @example * function isBabelRegister(caller?: { name: string }) { * return !!(caller && caller.name === "@babel/register") * } * api.caller(isBabelRegister) * * @see https://babeljs.io/docs/en/next/config-files#apicallercb */ caller(callerCallback: (caller: TransformOptions["caller"]) => T): T; /** * While `api.version` can be useful in general, it's sometimes nice to just declare your version. * This API exposes a simple way to do that with: * * @example * api.assertVersion(7) // major version only * api.assertVersion("^7.2") * * @see https://babeljs.io/docs/en/next/config-files#apiassertversionrange */ assertVersion(versionRange: number | string): boolean; // NOTE: this is an undocumented reexport from "@babel/parser" but it's missing from its types // tokTypes: typeof tokTypes } /** * JS configs are great because they can compute a config on the fly, * but the downside there is that it makes caching harder. * Babel wants to avoid re-executing the config function every time a file is compiled, * because then it would also need to re-execute any plugin and preset functions * referenced in that config. * * To avoid this, Babel expects users of config functions to tell it how to manage caching * within a config file. * * @see https://babeljs.io/docs/en/next/config-files#apicache */ interface SimpleCacheConfigurator { // there is an undocumented call signature that is a shorthand for forever()/never()/using(). // (ever: boolean): void // (callback: CacheCallback): T /** * Permacache the computed config and never call the function again. */ forever(): void; /** * Do not cache this config, and re-execute the function every time. */ never(): void; /** * Any time the using callback returns a value other than the one that was expected, * the overall config function will be called again and a new entry will be added to the cache. * * @example * api.cache.using(() => process.env.NODE_ENV) */ using(callback: SimpleCacheCallback): T; /** * Any time the using callback returns a value other than the one that was expected, * the overall config function will be called again and all entries in the cache will * be replaced with the result. * * @example * api.cache.invalidate(() => process.env.NODE_ENV) */ invalidate(callback: SimpleCacheCallback): T; } // https://github.com/babel/babel/blob/v7.3.3/packages/babel-core/src/config/caching.js#L231 type SimpleCacheKey = string | boolean | number | null | undefined; type SimpleCacheCallback = () => T; /** * Since `NODE_ENV` is a fairly common way to toggle behavior, Babel also includes an API function * meant specifically for that. This API is used as a quick way to check the `"envName"` that Babel * was loaded with, which takes `NODE_ENV` into account if no other overriding environment is set. * * @see https://babeljs.io/docs/en/next/config-files#apienv */ interface EnvFunction { /** * @returns the current `envName` string */ (): string; /** * @returns `true` if the `envName` is `===` any of the given strings */ (envName: string | readonly string[]): boolean; // the official documentation is misleading for this one... // this just passes the callback to `cache.using` but with an additional argument. // it returns its result instead of necessarily returning a boolean. (envCallback: (envName: NonNullable) => T): T; } type ConfigFunction = (api: ConfigAPI) => TransformOptions; //#endregion //#region code/core/.dts-emit/code/core/src/babel/babelParse.d.ts declare const parserOptions: ParserOptions; declare const babelParse: (code: string) => File; interface ASTNode { type: string; } declare const babelPrint: (ast: ASTNode) => string; declare const babelParseExpression: (code: string) => ParseResult$1; //#endregion //#region code/core/.dts-emit/code/core/src/babel/expression-resolver.d.ts /** Recursively unwraps TypeScript type annotation expressions (as X, satisfies X, expr). */ declare const unwrapTSExpression: (expr: Expression | Declaration) => Expression; /** * Resolves an expression through variable references and TypeScript type annotations. Handles: * Identifier (variable lookup), TSAsExpression, TSSatisfiesExpression, TSTypeAssertion. Limits * recursion depth to prevent infinite loops on circular variable references. */ declare const resolveExpression: (expr: Expression | Declaration | null | undefined, ast: File, depth?: number, maxDepth?: number) => Expression | null; //#endregion //#region code/core/.dts-emit/code/core/src/babel/vitest-config-helpers.d.ts type AST = File; /** * Returns true if the identifier `localName` is a local alias for `defineConfig` or `defineProject` * imported from either `vitest/config` or `vite`. */ declare const isImportedDefineConfigLikeIdentifier: (localName: string, ast: AST) => boolean; /** Returns true if a CallExpression is a call to defineConfig or defineProject (or an alias). */ declare const isDefineConfigLike: (node: CallExpression, ast: AST) => boolean; /** * Resolves a `mergeConfig` argument to an ObjectExpression when possible. Handles: * * - Plain object literals: `{ test: {...} }` * - Variable references: `const vitestConfig = {...}; mergeConfig(viteConfig, vitestConfig)` * - Wrapped calls (e.g. `defineConfig({ ... })`): returns the inner ObjectExpression * - TypeScript type annotations: `mergeConfig(...) as ViteUserConfig` */ declare const getConfigObjectFromMergeArg: (arg: Expression, ast: AST) => ObjectExpression | null; /** * Extracts the effective `mergeConfig(...)` call from a declaration, unwrapping: * * - TypeScript type annotations (`as X`, `satisfies X`) * - `defineConfig(mergeConfig(...))` outer wrapper * - Variable references (`export default config` where `config = mergeConfig(...)`) * * Returns null when the declaration is not or does not contain a `mergeConfig` call. */ declare const getEffectiveMergeConfigCall: (decl: Expression | Declaration, ast: AST) => CallExpression | null; /** * Resolves the default export to the actual config ObjectExpression we can merge into. Handles: * * - `export default { ... }` — plain object * - `export default defineConfig({ ... })` — defineConfig with object * - `export default defineProject({ ... })` — defineProject with object * - `export default config` — variable reference to any of the above * - Any of the above wrapped in TypeScript type annotations * * Returns null when a writable ObjectExpression cannot be located. */ declare const getTargetConfigObject: (target: AST, exportDefault: ExportDefaultDeclaration) => ObjectExpression | null; /** * Returns `true` when a Vitest/Vite config file's default export uses a pattern that * `updateConfigFile` (from addon-vitest) can auto-update. * * Supported patterns: * * - `export default { test: {...} }` * - `export default defineConfig({ ... })` / `defineProject({ ... })` * - `export default mergeConfig(viteConfig, { ... })` * - `export default mergeConfig(viteConfig, defineConfig({ ... }))` * - `export default defineConfig(mergeConfig(...))` * - `export default config` (variable referencing any of the above) * - Any of the above wrapped in `as X` or `satisfies X` TypeScript annotations * * Unsupported patterns (returns `false`): * * - Callback-based defineConfig with non-literal/dynamic returns that cannot be safely resolved * - Completely unrecognizable export shapes * - No `export default` declaration at all */ declare const canUpdateVitestConfigFile: (fileContent: string) => boolean; /** * Returns `true` when a Vitest workspace file's default export uses a pattern that * `updateWorkspaceFile` (from addon-vitest) can auto-update. * * Supported patterns: * * - `export default ["project1", "project2"]` * - `export default [{...}, "project"]` * - `export default defineWorkspace(["project1", "project2"])` * * Returns `false` for any other shape (e.g. JSON files should be rejected before parsing, CommonJS * files, unrecognizable exports). */ declare const canUpdateVitestWorkspaceFile: (fileContent: string) => boolean; //#endregion //#region code/core/.dts-emit/code/core/src/babel/index.d.ts declare const traverse: typeof traverse$1; declare const generate: typeof generate$1; declare const BabelFileClass: any; //#endregion export { type BabelFile, BabelFileClass, type GeneratorOptions, type NodePath, type RecastOptions, babelParse, babelParseExpression, babelPrint, canUpdateVitestConfigFile, canUpdateVitestWorkspaceFile, index_d_exports as core, generate, getConfigObjectFromMergeArg, getEffectiveMergeConfigCall, getTargetConfigObject, isDefineConfigLike, isImportedDefineConfigLikeIdentifier, babel_parser_d_exports as parser, parserOptions, recast, resolveExpression, transformSync, traverse, index_d_exports$1 as types, unwrapTSExpression };