storybook
Version:
Storybook: Develop, document, and test UI components in isolation
2,297 lines • 128 kB
TypeScript
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<ErrorDetails> {
code: ParseErrorCode;
reasonCode: string;
syntaxPlugin?: SyntaxPlugin;
missingPlugin?: string | string[];
loc: Position;
details: ErrorDetails;
pos: number;
}
type ParseError$1<ErrorDetails> = SyntaxError & ParseErrorSpecification<ErrorDetails>;
type BABEL_8_BREAKING = false;
type IF_BABEL_7<V> = 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<Options>;
type ParseError = ParseError$1<object>;
type ParseResult$1<Result extends File | Expression = File> = 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<File>;
declare function parseExpression(input: string, options?: ParserOptions): ParseResult$1<Expression>;
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<string> | 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<T> {
/**
* Build a new builder, merging the given options with the previous ones.
*/
(opts: TemplateBuilderOptions): TemplateBuilder<T>;
/**
* 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<Statement | Statement[]>;
declare const statement: TemplateBuilder<Statement>;
declare const statements: TemplateBuilder<Statement[]>;
declare const expression: TemplateBuilder<Expression>;
declare const program: TemplateBuilder<Program>;
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: {
<S>(parent: Node$1, opts: TraverseOptions<S>, 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<string, boolean>) => 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<S = unknown>(visitor: Visitor<S>): { [Type in Exclude<Node$1, DeprecatedAliases>["type"]]?: VisitNodeObject<S, Extract<Node$1, {
type: Type;
}>> };
function verify(visitor: Visitor): void;
function merge<State>(visitors: Array<Visitor<State>>): Visitor<State>;
function merge(visitors: Visitor[], states?: any[], wrapper?: (stateKey: any, visitorKey: keyof Visitor, func: VisitNodeFunction<unknown, Node$1>) => VisitNodeFunction<unknown, Node$1> | null): Visitor;
}
declare namespace cache {
let path: WeakMap<Node$1, Map<Node$1, NodePath>>;
let scope: WeakMap<Node$1, Scope>;
function clear(): void;
function clearPath(): void;
function clearScope(): void;
}
type TraverseOptions<S = Node$1> = {
scope?: Scope;
noScope?: boolean;
denylist?: NodeType[]; /** @deprecated will be removed in Babel 8 */
blacklist?: NodeType[];
shouldSkip?: (node: NodePath) => boolean;
} & Visitor<S>;
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<string, NodePath<LabeledStatement>>;
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<string | symbol, unknown>;
crawling: boolean;
static globals: string[];
/** Variables available in current context. */
static contextVariables: string[];
/** Traverse node with current scope and path. */
traverse<S>(node: Node$1 | Node$1[], opts: TraverseOptions<S>, 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<LabeledStatement> | undefined;
registerLabel(path: NodePath<LabeledStatement>): 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<string, Binding>;
/** Walks the scope tree and gathers all declarations of `kind`. */
getAllBindingsOfKind(...kinds: string[]): Record<string, Binding>;
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<S = unknown> = VisitNodeObject<S, Node$1> & { [N in Node$1 as N["type"]]?: VisitNode<S, N extends {
type: N["type"];
} ? N : never> } & { [K in keyof Aliases]?: VisitNode<S, Aliases[K]> } & { [K in keyof VirtualTypeAliases]?: VisitNode<S, VirtualTypeAliases[K]> } & {
// 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<S, Node$1>;
};
type VisitNode<S, P extends Node$1> = VisitNodeFunction<S, P> | VisitNodeObject<S, P>;
type VisitNodeFunction<S, P extends Node$1> = (this: S, path: NodePath<P>, state: S) => void;
type NodeType = Node$1["type"] | keyof Aliases;
interface VisitNodeObject<S, P extends Node$1> {
enter?: VisitNodeFunction<S, P>;
exit?: VisitNodeFunction<S, P>;
}
type NodeKeyOfArrays<T extends Node$1> = { [P in keyof T]-?: T[P] extends Array<Node$1 | null | undefined> ? P : never }[keyof T];
type NodePaths<T extends Node$1 | readonly Node$1[]> = T extends readonly Node$1[] ? { -readonly [K in keyof T]: NodePath<Extract<T[K], Node$1>> } : T extends Node$1 ? [NodePath<T>] : never;
type NodeListType<N, K extends keyof N> = N[K] extends Array<infer P> ? (P extends Node$1 ? P : never) : never;
type NodesInsertionParam<T extends Node$1> = T | readonly T[] | [T, ...T[]];
declare class NodePath<T = Node$1> {
constructor(hub: HubInterface, parent: Node$1);
parent: Node$1;
hub: Hub;
data: Record<string | symbol, unknown>;
context: TraversalContext;
scope: Scope;
contexts: TraversalContext[];
state: any;
opts: any; // exploded TraverseOptions
skipKeys: Record<string, boolean> | 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<C extends Node$1, K extends keyof C>(opts: {
hub?: HubInterface;
parentPath: NodePath | null;
parent: Node$1;
container: C;
key: K;
}): NodePath<C[K]>;
static get<C extends Node$1, L extends NodeKeyOfArrays<C>>(opts: {
hub?: HubInterface;
parentPath: NodePath | null;
parent: Node$1;
container: C;
listKey: L;
key: number;
}): C[L] extends Array<Node$1 | null | undefined> ? NodePath<C[L][number]> : never;
getScope(scope: Scope): Scope;
setData(key: string | symbol, val: any): any;
getData(key: string | symbol, def?: any): any;
hasNode(): this is NodePath<Exclude<T, null | undefined>>;
buildCodeFrameError(msg: string, Error?: ErrorConstructor): Error;
traverse<T>(visitor: TraverseOptions<T>, 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<Function> | null;
/** Walk up the tree until we hit a parent node path in a list. */
getStatementParent(): NodePath<Statement> | 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 extends Node$1 | readonly Node$1[] | [Node$1, ...Node$1[]]>(nodes: Nodes): NodePaths<Nodes>;
/**
* 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<R extends Node$1>(replacementPath: R | NodePath<R>): [NodePath<R>];
replaceWith<R extends NodePath>(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<Expression | Statement>;
replaceInline<Nodes extends Node$1 | readonly Node$1[] | [Node$1, ...Node$1[]]>(nodes: Nodes): NodePaths<Nodes>; // #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<Exclude<Function, Method | ArrowFunctionExpression> | CallExpression>;
ensureBlock(this: NodePath<Loop | WithStatement | Function | LabeledStatement | CatchClause>): asserts this is NodePath<T & {
body: BlockStatement;
}>; // #endregion
// #region ------------------------- modification -------------------------
/** Insert the provided nodes before the current one. */
insertBefore<Nodes extends NodesInsertionParam<Node$1>>(nodes: Nodes): NodePaths<Nodes>;
/**
* 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 extends NodesInsertionParam<Node$1>>(nodes: Nodes): NodePaths<Nodes>;
/** 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<T extends Node$1, K extends NodeKeyOfArrays<T>, Nodes extends NodesInsertionParam<NodeListType<T, K>>>(this: NodePath<T>, listKey: K, nodes: Nodes): NodePaths<Nodes>;
/**
* 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<T extends Node$1, K extends NodeKeyOfArrays<T>, Nodes extends NodesInsertionParam<NodeListType<T, K>>>(this: NodePath<T>, listKey: K, nodes: Nodes): NodePaths<Nodes>;
/** 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<K extends keyof T>(key: K, context?: boolean | TraversalContext): NodePathResult<T[K]>;
get(key: string, context?: boolean | TraversalContext): NodePath | NodePath[];
getBindingIdentifiers(duplicates: true): Record<string, Identifier[]>;
getBindingIdentifiers(duplicates?: false): Record<string, Identifier>;
getBindingIdentifiers(duplicates?: boolean): Record<string, Identifier | Identifier[]>;
getOuterBindingIdentifiers(duplicates: true): Record<string, Identifier[]>;
getOuterBindingIdentifiers(duplicates?: false): Record<string, Identifier>;
getOuterBindingIdentifiers(duplicates?: boolean): Record<string, Identifier | Identifier[]>;
getBindingIdentifierPaths(duplicates: true, outerOnly?: boolean): Record<string, Array<NodePath<Identifier>>>;
getBindingIdentifierPaths(duplicates?: false, outerOnly?: boolean): Record<string, NodePath<Identifier>>;
getBindingIdentifierPaths(duplicates?: boolean, outerOnly?: boolean): Record<string, NodePath<Identifier> | Array<NodePath<Identifier>>>;
getOuterBindingIdentifierPaths(duplicates: true): Record<string, Array<NodePath<Identifier>>>;
getOuterBindingIdentifierPaths(duplicates?: false): Record<string, NodePath<Identifier>>;
getOuterBindingIdentifierPaths(duplicates?: boolean, outerOnly?: boolean): Record<string, NodePath<Identifier> | Array<NodePath<Identifier>>>; // #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<Accessor>;
isAnyTypeAnnotation(opts?: object): this is NodePath<AnyTypeAnnotation>;
isArgumentPlaceholder(opts?: object): this is NodePath<ArgumentPlaceholder>;
isArrayExpression(opts?: object): this is NodePath<ArrayExpression>;
isArrayPattern(opts?: object): this is NodePath<ArrayPattern>;
isArrayTypeAnnotation(opts?: object): this is NodePath<ArrayTypeAnnotation>;
isArrowFunctionExpression(opts?: object): this is NodePath<ArrowFunctionExpression>;
isAssignmentExpression(opts?: object): this is NodePath<AssignmentExpression>;
isAssignmentPattern(opts?: object): this is NodePath<AssignmentPattern>;
isAwaitExpression(opts?: object): this is NodePath<AwaitExpression>;
isBigIntLiteral(opts?: object): this is NodePath<BigIntLiteral>;
isBinary(opts?: object): this is NodePath<Binary>;
isBinaryExpression(opts?: object): this is NodePath<BinaryExpression>;
isBindExpression(opts?: object): this is NodePath<BindExpression>;
isBlock(opts?: object): this is NodePath<Block>;
isBlockParent(opts?: object): this is NodePath<BlockParent>;
isBlockStatement(opts?: object): this is NodePath<BlockStatement>;
isBooleanLiteral(opts?: object): this is NodePath<BooleanLiteral>;
isBooleanLiteralTypeAnnotation(opts?: object): this is NodePath<BooleanLiteralTypeAnnotation>;
isBooleanTypeAnnotation(opts?: object): this is NodePath<BooleanTypeAnnotation>;
isBreakStatement(opts?: object): this is NodePath<BreakStatement>;
isCallExpression(opts?: object): this is NodePath<CallExpression>;
isCatchClause(opts?: object): this is NodePath<CatchClause>;
isClass(opts?: object): this is NodePath<Class>;
isClassAccessorProperty(opts?: object): this is NodePath<ClassAccessorProperty>;
isClassBody(opts?: object): this is NodePath<ClassBody>;
isClassDeclaration(opts?: object): this is NodePath<ClassDeclaration>;
isClassExpression(opts?: object): this is NodePath<ClassExpression>;
isClassImplements(opts?: object): this is NodePath<ClassImplements>;
isClassMethod(opts?: object): this is NodePath<ClassMethod>;
isClassPrivateMethod(opts?: object): this is NodePath<ClassPrivateMethod>;
isClassPrivateProperty(opts?: object): this is NodePath<ClassPrivateProperty>;
isClassProperty(opts?: object): this is NodePath<ClassProperty>;
isCompletionStatement(opts?: object): this is NodePath<CompletionStatement>;
isConditional(opts?: object): this is NodePath<Conditional>;
isConditionalExpression(opts?: object): this is NodePath<ConditionalExpression>;
isContinueStatement(opts?: object): this is NodePath<ContinueStatement>;
isDebuggerStatement(opts?: object): this is NodePath<DebuggerStatement>;
isDecimalLiteral(opts?: object): this is NodePath<DecimalLiteral>;
isDeclaration(opts?: object): this is NodePath<Declaration>;
isDeclareClass(opts?: object): this is NodePath<DeclareClass>;
isDeclareExportAllDeclaration(opts?: object): this is NodePath<DeclareExportAllDeclaration>;
isDeclareExportDeclaration(opts?: object): this is NodePath<DeclareExportDeclaration>;
isDeclareFunction(opts?: object): this is NodePath<DeclareFunction>;
isDeclareInterface(opts?: object): this is NodePath<DeclareInterface>;
isDeclareModule(opts?: object): this is NodePath<DeclareModule>;
isDeclareModuleExports(opts?: object): this is NodePath<DeclareModuleExports>;
isDeclareOpaqueType(opts?: object): this is NodePath<DeclareOpaqueType>;
isDeclareTypeAlias(opts?: object): this is NodePath<DeclareTypeAlias>;
isDeclareVariable(opts?: object): this is NodePath<DeclareVariable>;
isDeclaredPredicate(opts?: object): this is NodePath<DeclaredPredicate>;
isDecorator(opts?: object): this is NodePath<Decorator>;
isDirective(opts?: object): this is NodePath<Directive>;
isDirectiveLiteral(opts?: object): this is NodePath<DirectiveLiteral>;
isDoExpression(opts?: object): this is NodePath<DoExpression>;
isDoWhileStatement(opts?: object): this is NodePath<DoWhileStatement>;
isEmptyStatement(opts?: object): this is NodePath<EmptyStatement>;
isEmptyTypeAnnotation(opts?: object): this is NodePath<EmptyTypeAnnotation>;
isEnumBody(opts?: object): this is NodePath<EnumBody>;
isEnumBooleanBody(opts?: object): this is NodePath<EnumBooleanBody>;
isEnumBooleanMember(opts?: object): this is NodePath<EnumBooleanMember>;
isEnumDeclaration(opts?: object): this is NodePath<EnumDeclaration>;
isEnumDefaultedMember(opts?: object): this is NodePath<EnumDefaultedMember>;
isEnumMember(opts?: object): this is NodePath<EnumMember>;
isEnumNumberBody(opts?: object): this is NodePath<EnumNumberBody>;
isEnumNumberMember(opts?: object): this is NodePath<EnumNumberMember>;
isEnumStringBody(opts?: object): this is NodePath<EnumStringBody>;
isEnumStringMember(opts?: object): this is NodePath<EnumStringMember>;
isEnumSymbolBody(opts?: object): this is NodePath<EnumSymbolBody>;
isExistsTypeAnnotation(opts?: object): this is NodePath<ExistsTypeAnnotation>;
isExportAllDeclaration(opts?: object): this is NodePath<ExportAllDeclaration>;
isExportDeclaration(opts?: object): this is NodePath<ExportDeclaration>;
isExportDefaultDeclaration(opts?: object): this is NodePath<ExportDefaultDeclaration>;
isExportDefaultSpecifier(opts?: object): this is NodePath<ExportDefaultSpecifier>;
isExportNamedDeclaration(opts?: object): this is NodePath<ExportNamedDeclaration>;
isExportNamespaceSpecifier(opts?: object): this is NodePath<ExportNamespaceSpecifier>;
isExportSpecifier(opts?: object): this is NodePath<ExportSpecifier>;
isExpression(opts?: object): this is NodePath<Expression>;
isExpressionStatement(opts?: object): this is NodePath<ExpressionStatement>;
isExpressionWrapper(opts?: object): this is NodePath<ExpressionWrapper>;
isFile(opts?: object): this is NodePath<File>;
isFlow(opts?: object): this is NodePath<Flow>;
isFlowBaseAnnotation(opts?: object): this is NodePath<FlowBaseAnnotation>;
isFlowDeclaration(opts?: object): this is NodePath<FlowDeclaration>;
isFlowPredicate(opts?: object): this is NodePath<FlowPredicate>;
isFlowType(opts?: object): this is NodePath<FlowType>;
isFor(opts?: object): this is NodePath<For>;
isForInStatement(opts?: object): this is NodePath<ForInStatement>;
isForOfStatement(opts?: object): this is NodePath<ForOfStatement>;
isForStatement(opts?: object): this is NodePath<ForStatement>;
isForXStatement(opts?: object): this is NodePath<ForXStatement>;
isFunction(opts?: object): this is NodePath<Function>;
isFunctionDeclaration(opts?: object): this is NodePath<FunctionDeclaration>;
isFunctionExpression(opts?: object): this is NodePath<FunctionExpression>;
isFunctionParent(opts?: object): this is NodePath<FunctionParent>;
isFunctionTypeAnnotation(opts?: object): this is NodePath<FunctionTypeAnnotation>;
isFunctionTypeParam(opts?: object): this is NodePath<FunctionTypeParam>;
isGenericTypeAnnotation(opts?: object): this is NodePath<GenericTypeAnnotation>;
isIdentifier(opts?: object): this is NodePath<Identifier>;
isIfStatement(opts?: object): this is NodePath<IfStatement>;
isImmutable(opts?: object): this is NodePath<Immutable>;
isImport(opts?: object): this is NodePath<Import>;
isImportAttribute(opts?: object): this is NodePath<ImportAttribute>;
isImportDeclaration(opts?: object): this is NodePath<ImportDeclaration>;
isImportDefaultSpecifier(opts?: object): this is NodePath<ImportDefaultSpecifier>;
isImportNamespaceSpecifier(opts?: object): this is NodePath<ImportNamespaceSpecifier>;
isImportSpecifier(opts?: object): this is NodePath<ImportSpecifier>;
isIndexedAccessType(opts?: object): this is NodePath<IndexedAccessType>;
isInferredPredicate(opts?: object): this is NodePath<InferredPredicate>;
isInterfaceDeclaration(opts?: object): this is NodePath<InterfaceDeclaration>;
isInterfaceExtends(opts?: object): this is NodePath<InterfaceExtends>;
isInterfaceTypeAnnotation(opts?: object): this is NodePath<InterfaceTypeAnnotation>;
isInterpreterDirective(opts?: object): this is NodePath<InterpreterDirective>;
isIntersectionTypeAnnotation(opts?: object): this is NodePath<IntersectionTypeAnnotation>;
isJSX(opts?: object): this is NodePath<JSX>;
isJSXAttribute(opts?: object): this is NodePath<JSXAttribute>;
isJSXClosingElement(opts?: object): this is NodePath<JSXClosingElement>;
isJSXClosingFragment(opts?: object): this is NodePath<JSXClosingFragment>;
isJSXElement(opts?: object): this is NodePath<JSXElement>;
isJSXEmptyExpression(opts?: object): this is NodePath<JSXEmptyExpression>;
isJSXExpressionContainer(opts?: object): this is NodePath<JSXExpressionContainer>;
isJSXFragment(opts?: object): this is NodePath<JSXFragment>;
isJSXIdentifier(opts?: object): this is NodePath<JSXIdentifier>;
isJSXMemberExpression(opts?: object): this is NodePath<JSXMemberExpression>;
isJSXNamespacedName(opts?: object): this is NodePath<JSXNamespacedName>;
isJSXOpeningElement(opts?: object): this is NodePath<JSXOpeningElement>;
isJSXOpeningFragment(opts?: object): this is NodePath<JSXOpeningFragment>;
isJSXSpreadAttribute(opts?: object): this is NodePath<JSXSpreadAttribute>;
isJSXSpreadChild(opts?: object): this is NodePath<JSXSpreadChild>;
isJSXText(opts?: object): this is NodePath<JSXText>;
isLVal(opts?: object): this is NodePath<LVal>;
isLabeledStatement(opts?: object): this is NodePath<LabeledStatement>;
isLiteral(opts?: object): this is NodePath<Literal>;
isLogicalExpression(opts?: object): this is NodePath<LogicalExpression>;
isLoop(opts?: object): this is NodePath<Loop>;
isMemberExpression(opts?: object): this is NodePath<MemberExpression>;
isMetaProperty(opts?: object): this is NodePath<MetaProperty>;
isMethod(opts?: object): this is NodePath<Method>;
isMiscellaneous(opts?: object): this is NodePath<Miscellaneous>;
isMixedTypeAnnotation(opts?: object): this is NodePath<MixedTypeAnnotation>;
isModuleDeclaration(opts?: object): this is NodePath<ModuleDeclaration>;
isModuleExpression(opts?: object): this is NodePath<ModuleExpression>;
isModuleSpecifier(opts?: object): this is NodePath<ModuleSpecifier>;
isNewExpression(opts?: object): this is NodePath<NewExpression>;
isNoop(opts?: object): this is NodePath<Noop>;
isNullLiteral(opts?: object): this is NodePath<NullLiteral>;
isNullLiteralTypeAnnotation(opts?: object): this is NodePath<NullLiteralTypeAnnotation>;
isNullableTypeAnnotation(opts?: object): this is NodePath<NullableTypeAnnotation>;
/** @deprecated Use `isNumericLiteral` */
isNumberLiteral(opts?: object): this is NodePath<NumberLiteral$1>;
isNumberLiteralTypeAnnotation(opts?: object): this is NodePath<NumberLiteralTypeAnnotation>;
isNumberTypeAnnotation(opts?: object): this is NodePath<NumberTypeAnnotation>;
isNumericLiteral(opts?: object): this is NodePath<NumericLiteral>;
isObjectExpression(opts?: object): this is NodePath<ObjectExpression>;
isObjectMember(opts?: object): this is NodePath<ObjectMember>;
isObjectMethod(opts?: object): this is NodePath<ObjectMethod>;
isObjectPattern(opts?: object): this is NodePath<ObjectPattern>;
isObjectProperty(opts?: object): this is NodePath<ObjectProperty>;
isObjectTypeAnnotation(opts?: object): this is NodePath<ObjectTypeAnnotation>;
isObjectTypeCallProperty(opts?: object): this is NodePath<ObjectTypeCallProperty>;
isObjectTypeIndexer(opts?: object): this is NodePath<ObjectTypeIndexer>;
isObjectTypeInternalSlot(opts?: object): this is NodePath<ObjectTypeInternalSlot>;
isObjectTypeProperty(opts?: object): this is NodePath<ObjectTypeProperty>;
isObjectTypeSpreadProperty(opts?: object): this is NodePath<ObjectTypeSpreadProperty>;
isOpaqueType(opts?: object): this is NodePath<OpaqueType>;
isOptionalCallExpression(opts?: object): this is NodePath<OptionalCallExpression>;
isOptionalIndexedAccessType(opts?: object): this is NodePath<OptionalIndexedAccessType>;
isOptionalMemberExpression(opts?: object): this is NodePath<OptionalMemberExpression>;
isParenthesizedExpression(opts?: object): this is NodePath<ParenthesizedExpression>;
isPattern(opts?: object): this is NodePath<Pattern>;
isPatternLike(opts?: object): this is NodePath<PatternLike>;
isPipelineBareFunction(opts?: object): this is NodePath<PipelineBareFunction>;
isPipelinePrimaryTopicReference(opts?: object): this is NodePath<PipelinePrimaryTopicReference>;
isPipelineTopicExpression(opts?: object): this is NodePath<PipelineTopicExpression>;
isPlaceholder(opts?: object): this is NodePath<Placeholder>;
isPrivate(opts?: object): this is NodePath<Private>;
isPrivateName(opts?: object): this is NodePath<PrivateName>;
isProgram(opts?: object): this is NodePath<Program>;
isProperty(opts?: object): this is NodePath<Property>;
isPureish(opts?: object): this is NodePath<Pureish>;
isQualifiedTypeIdentifier(opts?: object): this is NodePath<QualifiedTypeIdentifier>;
isRecordExpression(opts?: object): this is NodePath<RecordExpression>;
isRegExpLiteral(opts?: object): this is NodePath<RegExpLiteral>;
/** @deprecated Use `isRegExpLiteral` */
isRegexLiteral(opts?: object): this is NodePath<RegexLiteral$1>;
isRestElement(opts?: object): this is NodePath<RestElement>;
/** @deprecated Use `isRestElement` */
isRestProperty(opts?: object): this is NodePath<RestProperty$1>;
isReturnStatement(opts?: object): this is NodePath<ReturnStatement>;
isScopable(opts?: object): this is NodePath<Scopable>;
isSequenceExpression(opts?: object): this is NodePath<SequenceExpression>;
isSpreadElement(opts?: object): this is NodePath<SpreadElement>;
/** @deprecated Use `isSpreadElement` */
isSpreadProperty(opts?: object): this is NodePath<SpreadProperty$1>;
isStandardized(opts?: object): this is NodePath<Standardized>;
isStatement(opts?: object): this is NodePath<Statement>;
isStaticBlock(opts?: object): this is NodePath<StaticBlock>;
isStringLiteral(opts?: object): this is NodePath<StringLiteral>;
isStringLiteralTypeAnnotation(opts?: object): this is NodePath<StringLiteralTypeAnnotation>;
isStringTypeAnnotation(opts?: object): this is NodePath<StringTypeAnnotation>;
isSuper(opts?: object): this is NodePath<Super>;
isSwitchCase(opts?: object): this is NodePath<SwitchCase>;
isSwitchStatement(opts?: object): this is NodePath<SwitchStatement>;
isSymbolTypeAnnotation(opts?: object): this is NodePath<SymbolTypeAnnotation>;
isTSAnyKeyword(opts?: object): this is NodePath<TSAnyKeyword>;
isTSArrayType(opts?: object): this is NodePath<TSArrayType>;
isTSAsExpression(opts?: object): this is NodePath<TSAsExpression>;
isTSBaseType(opts?: object): this is NodePath<TSBaseType>;
isTSBigIntKeyword(opts?: object): this is NodePath<TSBigIntKeyword>;
isTSBooleanKeyword(opts?: object): this is NodePath<TSBooleanKeyword>;
isTSCallSignatureDeclaration(opts?: object): this is NodePath<TSCallSignatureDeclaration>;
isTSConditionalType(opts?: object): this is NodePath<TSConditionalType>;
isTSConstructSignatureDeclaration(opts?: object): this is NodePath<TSConstructSignatureDeclaration>;
isTSConstructorType(opts?: object): this is NodePath<TSConstructorType>;
isTSDeclareFunction(opts?: object): this is NodePath<TSDeclareFunction>;
isTSDeclareMethod(opts?: object): this is NodePath<TSDeclareMethod>;
isTSEntityName(opts?: object): this is NodePath<TSEntityName>;
isTSEnumDeclaration(opts?: object): this is NodePath<TSEnumDeclaration>;
isTSEnumMember(opts?: object): this is NodePath<TSEnumMember>;
isTSExportAssignment(opts?: object): this is NodePath<TSExportAssignment>;
isTSExpressionWithTypeArguments(opts?: object): this is NodePath<TSExpressionWithTypeArguments>;
isTSExternalModuleReference(opts?: object): this is NodePath<TSExternalModuleReference>;
isTSFunctionType(opts?: object): this is NodePath<TSFunctionType>;
isTSImportEqualsDeclaration(opts?: object): this is NodePath<TSImportEqualsDeclaration>;
isTSImportType(opts?: object): this is NodePath<TSImportType>;
isTSIndexSignature(opts?: object): this is NodePath<TSIndexSignature>;
isTSIndexedAccessType(opts?: object): this is NodePath<TSIndexedAccessType>;
isTSInferType(opts?: object): this is NodePath<TSInferType>;
isTSInstantiationExpression(opts?: object): this is NodePath<TSInstantiationExpression>;
isTSInterfaceBody(opts?: object): this is NodePath<TSInterfaceBody>;
isTSInterfaceDeclaration(opts?: object): this is NodePath<TSInterfaceDeclaration>;
isTSIntersectionType(opts?: object): this is NodePath<TSIntersectionType>;
isTSIntrinsicKeyword(opts?: object): this is NodePath<TSIntrinsicKeyword>;
isTSLiteralType(opts?: object): this is NodePath<TSLiteralType>;
isTSMappedType(opts?: object): this is NodePath<TSMappedType>;
isTSMethodSignature(opts?: object): this is NodePath<TSMethodSignature>;
isTSModuleBlock(opts?: object): this is NodePath<TSModuleBlock>;
isTSModuleDeclaration(opts?: object): this is NodePath<TSModuleDeclaration>;
isTSNamedTupleMember(opts?: object): this is NodePath<TSNamedTupleMember>;
isTSNamespaceExportDeclaration(opts?: object): this is NodePath<TSNamespaceExportDeclaration>;
isTSNeverKeyword(opts?: object): this is NodePath<TSNeverKeyword>;
isTSNonNullExpression(opts?: object): this is NodePath<TSNonNullExpression>;
isTSNullKeyword(opts?: object): this is NodePath<TSNullKeyword>;
isTSNumberKeyword(opts?: object): this is NodePath<TSNumberKeyword>;
isTSObjectKeyword(opts?: object): this is NodePath<TSObjectKeyword>;
isTSOptionalType(opts?: object): this is NodePath<TSOptionalType>;
isTSParameterProperty(opts?: object): this is NodePath<TSParameterProperty>;
isTSParenthesizedType(opts?: object): this is NodePath<TSParenthesizedType>;
isTSPropertySignature(opts?: object): this is NodePath<TSPropertySignature>;
isTSQualifiedName(opts?: object): this is NodePath<TSQualifiedName>;
isTSRestType(opts?: object): this is NodePath<TSRestType>;
isTSSatisfiesExpression(opts?: object): this is NodePath<TSSatisfiesExpression>;
isTSStringKeyword(opts?: object): this is NodePath<TSStringKeyword>;
isTSSymbolKeyword(opts?: object): this is NodePath<TSSymbolKeyword>;
isTSThisType(opts?: object): this is NodePath<TSThisType>;
isTSTupleType(opts?: object): this is NodePath<TSTupleType>;
isTSType(opts?: object): this is NodePath<TSType>;
isTSTypeAliasDeclaration(opts?: object): this is NodePath<TSTypeAliasDeclaration>;
isTSTypeAnnotation(opts?: object): this is NodePath<TSTypeAnnotation>;
isTSTypeAssertion(opts?: object): this is NodePath<TSTypeAssertion>;
isTSTypeElement(opts?: object): this is NodePath<TSTypeElement>;
isTSTypeLiteral(opts?: object): this is NodePath<TSTypeLiteral>;
isTSTypeOperator(opts?: object): this is NodePath<TSTypeOperator>;
isTSTypeParameter(opts?: object): this is NodePath<TSTypeParameter>;
isTSTypeParameterDeclaration(opts?: object): this is NodePath<TSTypeParameterDeclaration>;
isTSTypeParameterInstantiation(opts?: object): this is NodePath<TSTypeParameterInstantiation>;
isTSTypePredicate(opts?: object): this is NodePath<TSTypePredicate>;
isTSTypeQuery(opts?: object): this is NodePath<TSTypeQuery>;
isTSTypeReference(opts?: object): this is NodePath<TSTypeReference>;
isTSUndefinedKeyword(opts?: object): this is NodePath<TSUndefinedKeyword>;
isTSUnionType(opts?: object): this is NodePath<TSUnionType>;
isTSUnknownKeyword(opts?: object): this is NodePath<TSUnknownKeyword>;
isTSVoidKeyword(opts?: object): this is NodePath<TSVoidKeyword>;
isTaggedTemplateExpression(opts?: object): this is NodePath<TaggedTemplateExpression>;
isTemplateElement(opts?: object): this is NodePath<TemplateElement>;
isTemplateLiteral(opts?: object): this is NodePath<TemplateLiteral>;
isTerminatorless(opts?: object): this is NodePath<Terminatorless>;
isThisExpression(opts?: object): this is NodePath<ThisExpression>;
isThisTypeAnnotation(opts?: object): this is NodePath<ThisTypeAnnotation>;
isThrowStatement(opts?: object): this is NodePath<ThrowStatement>;
isTopicReference(opts?: object): this is NodePath<TopicReference>;
isTryStatement(opts?: object): this is NodePath<TryStatement>;
isTupleExpression(opts?: object): this is NodePath<TupleExpression>;
isTupleTypeAnnotation(opts?: object): this is NodePath<TupleTypeAnnotation>;
isTypeAlias(opts?: object): this is NodePath<TypeAlias>;
isTypeAnnotation(opts?: object): this is NodePath<TypeAnnotation>;
isTypeCastExpression(opts?: object): this is NodePath<TypeCastExpression>;
isTypeParameter(opts?: object): this is NodePath<TypeParameter>;
isTypeParameterDeclaration(opts?: object): this is NodePath<TypeParameterDeclaration>;
isTypeParameterInstantiation(opts?: object): this is NodePath<TypeParameterInstantiation>;
isTypeScript(opts?: object): this is NodePath<TypeScript>;
isTypeofTypeAnnotation(opts?: object): this is NodePath<TypeofTypeAnnotation>;
isUnaryExpression(opts?: object): this is NodePath<UnaryExpression>;
isUnaryLike(opts?: object): this is NodePath<UnaryLike>;
isUnionTypeAnnotation(opts?: object): this is NodePath<UnionTypeAnnotation>;
isUpdateExpression(opts?: object): this is NodePath<UpdateExpression>;
isUserWhitespacable(opts?: object): this is NodePath<UserWhitespacable>;
isV8IntrinsicIdentifier(opts?: object): this is NodePath<V8IntrinsicIdentifier>;
isVariableDeclaration(opts?: object): this is NodePath<VariableDeclaration>;
isVariableDeclarator(opts?: object): this is NodePath<VariableDeclarator>;
isVariance(opts?: object): this is NodePath<Variance>;
isVoidTypeAnnotation(opts?: object): this is NodePath<VoidTypeAnnotation>;
isWhile(opts?: object): this is NodePath<While>;
isWhileStatement(opts?: object): this is NodePath<WhileStatement>;
isWithStatement(opts?: object): this is NodePath<WithStatement>;
isYieldExpression(opts?: object): this is NodePath<YieldExpression>;
isBindingIdentifier(opts?: object): this is NodePath<VirtualTypeAliases["BindingIdentifier"]>;
isBlockScoped(opts?: object): this is NodePath<FunctionDeclaration | ClassDeclaration | VariableDeclaration>;
/** @deprecated */
isExistentialTypeParam(opts?: object): this is NodePath<VirtualTypeAliases["ExistentialTypeParam"]>;
isForAwaitStatement(opts?: object): this is NodePath<VirtualTypeAliases["ForAwaitStatement"]>;
isGenerated(opts?: object): boolean;
/** @deprecated */
isNumericLiteralTypeAnnotation(opts?: object): void;
isPure(opts?: object): boolean;
isReferenced(opts?: object): boolean;
isReferencedIdentifier(opts?: object): this is NodePath<VirtualTypeAliases["ReferencedIdentifier"]>;
isReferencedMemberExpression(opts?: object): this is NodePath<VirtualTypeAliases["ReferencedMemberExpression"]>;
isScope(opts?: object): this is NodePath<VirtualTypeAliases["Scope"]>;
isUser(opts?: object): boolean;
isVar(opts?: object): this is NodePath<VirtualTypeAliases["Var"]>; // #endregion
// #region ------------------------- assertXXX -------------------------
assertAccessor(opts?: object): asserts this is NodePath<Accessor>;
assertAnyTypeAnnotation(opts?: object): asserts this is NodePath<AnyTypeAnnotation>;
assertArgumentPlaceholder(opts?: object): asserts this is NodePath<ArgumentPlaceholder>;
assertArrayExpression(opts?: object): asserts this is NodePath<ArrayExpression>;
assertArrayPattern(opts?: object): asserts this is NodePath<ArrayPattern>;
assertArrayTypeAnnotation(opts?: object): asserts this is NodePath<ArrayTypeAnnotation>;
assertArrowFunctionExpression(opts?: object): asserts this is NodePath<ArrowFunctionExpression>;
assertAssignmentExpression(opts?: object): asserts this is NodePath<AssignmentExpression>;
assertAssignmentPattern(opts?: object): asserts this is NodePath<AssignmentPattern>;
assertAwaitExpression(opts?: object): asserts this is NodePath<AwaitExpression>;
assertBigIntLiteral(opts?: object): asserts this is NodePath<BigIntLiteral>;
assertBinary(opts?: object): asserts this is NodePath<Binary>;
assertBinaryExpression(opts?: object): asserts this is NodePath<BinaryExpression>;
assertBindExpression(opts?: object): asserts this is NodePath<BindExpression>;
assertBlock(opts?: object): asserts this is NodePath<Block>;
assertBlockParent(opts?: object): asserts this is NodePath<BlockParent>;
assertBlockStatement(opts?: object): asserts this is NodePath<BlockStatement>;
assertBooleanLiteral(opts?: object): asserts this is NodePath<BooleanLiteral>;
assertBooleanLiteralTypeAnnotation(opts?: object): asserts this is NodePath<BooleanLiteralTypeAnnotation>;
assertBooleanTypeAnnotation(opts?: object): asserts this is NodePath<BooleanTypeAnnotation>;
assertBreakStatement(opts?: object): asserts this is NodePath<BreakStatement>;
assertCallExpression(opts?: object): asserts this is NodePath<CallExpression>;
assertCatchClause(opts?: object): asserts this is NodePath<CatchClause>;
assertClass(opts?: object): asserts this is NodePath<Class>;
assertClassAccessorProperty(opts?: object): asserts this is NodePath<ClassAccessorProperty>;
assertClassBody(opts?: object): asserts this is NodePath<ClassBody>;
assertClassDeclaration(opts?: object): asserts this is NodePath<ClassDeclaration>;
assertClassExpression(opts?: object): asserts this is NodePath<ClassExpression>;
assertClassImplements(opts?: object): asserts this is NodePath<ClassImplements>;
assertClassMethod(opts?: object): asserts this is NodePath<ClassMethod>;
assertClassPrivateMethod(opts?: object): asserts this is NodePath<ClassPrivateMethod>;
assertClassPrivateProperty(opts?: object): asserts this is NodePath<ClassPrivateProperty>;
assertClassProperty(opts?: object): asserts this is NodePath<ClassProperty>;
assertCompletionStatement(opts?: object): asserts this is NodePath<CompletionStatement>;
assertConditional(opts?: object): asserts this is NodePath<Conditional>;
assertConditionalExpression(opts?: object): asserts this is NodePath<ConditionalExpression>;
assertContinueStatement(opts?: object): asserts this is NodePath<ContinueStatement>;
assertDebuggerStatement(opts?: object): asserts this is NodePath<DebuggerStatement>;
assertDecimalLiteral(opts?: object): asserts this is NodePath<DecimalLiteral>;
assertDeclaration(opts?: object): asserts this is NodePath<Declaration>;
assertDeclareClass(opts?: object): asserts this is NodePath<DeclareClass>;
assertDeclareExportAllDeclaration(opts?: object): asserts this is NodePath<DeclareExportAllDeclaration>;
assertDeclareExportDeclaration(opts?: object): asserts this is NodePath<DeclareExportDeclaration>;
assertDeclareFunction(opts?: object): asserts this is NodePath<DeclareFunction>;
assertDeclareInterface(opts?: object): asserts this is NodePath<DeclareInterface>;
assertDeclareModule(opts?: object): asserts this is NodePath<DeclareModule>;
assertDeclareModuleExports(opts?: object): asserts this is NodePath<DeclareModuleExports>;
assertDeclareOpaqueType(opts?: object): asserts this is NodePath<DeclareOpaqueType>;
assertDeclareTypeAlias(opts?: object): asserts this is NodePath<DeclareTypeAlias>;
assertDeclareVariable(opts?: object): asserts this is NodePath<DeclareVariable>;
assertDeclaredPredicate(opts?: object): asserts this is NodePath<DeclaredPredicate>;
assertDecorator(opts?: object): asserts this is NodePath<Decorator>;
assertDirective(opts?: object): asserts this is NodePath<Directive>;
assertDirectiveLiteral(opts?: object): asserts this is NodePath<DirectiveLiteral>;
assertDoExpression(opts?: object): asserts this is NodePath<DoExpression>;
assertDoWhileStatement(opts?: object): asserts this is NodePath<DoWhileStatement>;
assertEmptyStatement(opts?: object): asserts this is NodePath<EmptyStatement>;
assertEmptyTypeAnnotation(opts?: object): asserts this is NodePath<EmptyTypeAnnotation>;
assertEnumBody(opts?: object): asserts this is NodePath<EnumBody>;
assertEnumBooleanBody(opts?: object): asserts this is NodePath<EnumBooleanBody>;
assertEnumBooleanMember(opts?: object): asserts this is NodePath<EnumBooleanMember>;
assertEnumDeclaration(opts?: object): asserts this is NodePath<EnumDeclaration>;
assertEnumDefaultedMember(opts?: object): asserts this is NodePath<EnumDefaultedMember>;
assertEnumMember(opts?: object): asserts this is NodePath<EnumMember>;
assertEnumNumberBody(opts?: object): asserts this is NodePath<EnumNumberBody>;
assertEnumNumberMember(opts?: object): asserts this is NodePath<EnumNumberMember>;
assertEnumStringBody(opts?: object): asserts this is NodePath<EnumStringBody>;
assertEnumStringMember(opts?: object): asserts this is NodePath<EnumStringMember>;
assertEnumSymbolBody(opts?: object): asserts this is NodePath<EnumSymbolBody>;
assertExistsTypeAnnotation(opts?: object): asserts this is NodePath<ExistsTypeAnnotation>;
assertExportAllDeclaration(opts?: object): asserts this is NodePath<ExportAllDeclaration>;
assertExportDeclaration(opts?: object): asserts this is NodePath<ExportDeclaration>;
assertExportDefaultDeclaration(opts?: object): asserts this is NodePath<ExportDefaultDeclaration>;
assertExportDefaultSpecifier(opts?: object): asserts this is NodePath<ExportDefaultSpecifier>;
assertExportNamedDeclaration(opts?: object): asserts this is NodePath<ExportNamedDeclaration>;
assertExportNamespaceSpecifier(opts?: object): asserts this is NodePath<ExportNamespaceSpecifier>;
assertExportSpecifier(opts?: object): asserts this is NodePath<ExportSpecifier>;
assertExpression(opts?: object): asserts this is NodePath<Expression>;
assertExpressionStatement(opts?: object): asserts this is NodePath<ExpressionStatement>;
assertExpressionWrapper(opts?: object): asserts this is NodePath<ExpressionWrapper>;
assertFile(opts?: object): asserts this is NodePath<File>;
assertFlow(opts?: object): asserts this is NodePath<Flow>;
assertFlowBaseAnnotation(opts?: object): asserts this is NodePath<FlowBaseAnnotation>;
assertFlowDeclaration(opts?: object): asserts this is NodePath<FlowDeclaration>;
assertFlowPredicate(opts?: object): asserts this is NodePath<FlowPredicate>;
assertFlowType(opts?: object): asserts this is NodePath<FlowType>;
assertFor(opts?: object): asserts this is NodePath<For>;
assertForInStatement(opts?: object): asserts this is NodePath<ForInStatement>;
assertForOfStatement(opts?: object): asserts this is NodePath<ForOfStatement>;
assertForStatement(opts?: object): asserts this is NodePath<ForStatement>;
assertForXStatement(opts?: object): asserts this is NodePath<ForXStatement>;
assertFunction(opts?: object): asserts this is NodePath<Function>;
assertFunctionDeclaration(opts?: object): asserts this is NodePath<FunctionDeclaration>;
assertFunctionExpression(opts?: object): asserts this is NodePath<FunctionExpression>;
assertFunctionParent(opts?: object): asserts this is NodePath<FunctionParent>;
assertFunctionTypeAnnotation(opts?: object): asserts this is NodePath<FunctionTypeAnnotation>;
assertFunctionTypeParam(opts?: object): asserts this is NodePath<FunctionTypeParam>;
assertGenericTypeAnnotation(opts?: object): asserts this is NodePath<GenericTypeAnnotation>;
assertIdentifier(opts?: object): asserts this is NodePath<Identifier>;
assertIfStatement(opts?: object): asserts this is NodePath<IfStatement>;
assertImmutable(opts?: object): asserts this is NodePath<Immutable>;
assertImport(opts?: object): asserts this is NodePath<Import>;
assertImportAttribute(opts?: object): asserts this is NodePath<ImportAttribute>;
assertImportDeclaration(opts?: object): asserts this is NodePath<ImportDeclaration>;
assertImportDefaultSpecifier(opts?: object): asserts this is NodePath<ImportDefaultSpecifier>;
assertImportNamespaceSpecifier(opts?: object): asserts this is NodePath<ImportNamespaceSpecifier>;
assertImportSpecifier(opts?: object): asserts this is NodePath<ImportSpecifier>;
assertIndexedAccessType(opts?: object): asserts this is NodePath<IndexedAccessType>;
assertInferredPredicate(opts?: object): asserts this is NodePath<InferredPredicate>;
assertInterfaceDeclaration(opts?: object): asserts this is NodePath<InterfaceDeclaration>;
assertInterfaceExtends(opts?: object): asserts this is NodePath<InterfaceExtends>;
assertInterfaceTypeAnnotation(opts?: object): asserts this is NodePath<InterfaceTypeAnnotation>;
assertInterpreterDirective(opts?: object): asserts this is NodePath<InterpreterDirective>;
assertIntersectionTypeAnnotation(opts?: object): asserts this is NodePath<IntersectionTypeAnnotation>;
assertJSX(opts?: object): asserts this is NodePath<JSX>;
assertJSXAttribute(opts?: object): asserts this is NodePath<JSXAttribute>;
assertJSXClosingElement(opts?: object): asserts this is NodePath<JSXClosingElement>;
assertJSXClosingFragment(opts?: object): asserts this is NodePath<JSXClosingFragment>;
assertJSXElement(opts?: object): asserts this is NodePath<JSXElement>;
assertJSXEmptyExpression(opts?: object): asserts this is NodePath<JSXEmptyExpression>;
assertJSXExpressionContainer(opts?: object): asserts this is NodePath<JSXExpressionContainer>;
assertJSXFragment(opts?: object): asserts this is NodePath<JSXFragment>;
assertJSXIdentifier(opts?: object): asserts this is NodePath<JSXIdentifier>;
assertJSXMemberExpression(opts?: object): asserts this is NodePath<JSXMemberExpression>;
assertJSXNamespacedName(opts?: object): asserts this is NodePath<JSXNamespacedName>;
assertJSXOpeningElement(opts?: object): asserts this is NodePath<JSXOpeningElement>;
assertJSXOpeningFragment(opts?: object): asserts this is NodePath<JSXOpeningFragment>;
assertJSXSpreadAttribute(opts?: object): asserts this is NodePath<JSXSpreadAttribute>;
assertJSXSpreadChild(opts?: object): asserts this is NodePath<JSXSpreadChild>;
assertJSXText(opts?: object): asserts this is NodePath<JSXText>;
assertLVal(opts?: object): asserts this is NodePath<LVal>;
assertLabeledStatement(opts?: object): asserts this is NodePath<LabeledStatement>;
assertLiteral(opts?: object): asserts this is NodePath<Literal>;
assertLogicalExpression(opts?: object): asserts this is NodePath<LogicalExpression>;
assertLoop(opts?: object): asserts this is NodePath<Loop>;
assertMemberExpression(opts?: object): asserts this is NodePath<MemberExpression>;
assertMetaProperty(opts?: object): asserts this is NodePath<MetaProperty>;
assertMethod(opts?: object): asserts this is NodePath<Method>;
assertMiscellaneous(opts?: object): asserts this is NodePath<Miscellaneous>;
assertMixedTypeAnnotation(opts?: object): asserts this is NodePath<MixedTypeAnnotation>;
assertModuleDeclaration(opts?: object): asserts this is NodePath<ModuleDeclaration>;
assertModuleExpression(opts?: object): asserts this is NodePath<ModuleExpression>;
assertModuleSpecifier(opts?: object): asserts this is NodePath<ModuleSpecifier>;
assertNewExpression(opts?: object): asserts this is NodePath<NewExpression>;
assertNoop(opts?: object): asserts this is NodePath<Noop>;
assertNullLiteral(opts?: object): asserts this is NodePath<NullLiteral>;
assertNullLiteralTypeAnnotation(opts?: object): asserts this is NodePath<NullLiteralTypeAnnotation>;
assertNullableTypeAnnotation(opts?: object): asserts this is NodePath<NullableTypeAnnotation>;
/** @deprecated Use `assertNumericLiteral` */
assertNumberLiteral(opts?: object): asserts this is NodePath<NumberLiteral$1>;
assertNumberLiteralTypeAnnotation(opts?: object): asserts this is NodePath<NumberLiteralTypeAnnotation>;
assertNumberTypeAnnotation(opts?: object): asserts this is NodePath<NumberTypeAnnotation>;
assertNumericLiteral(opts?: object): asserts this is NodePath<NumericLiteral>;
assertObjectExpression(opts?: object): asserts this is NodePath<ObjectExpression>;
assertObjectMember(opts?: object): asserts this is NodePath<ObjectMember>;
assertObjectMethod(opts?: object): asserts this is NodePath<ObjectMethod>;
assertObjectPattern(opts?: object): asserts this is NodePath<ObjectPattern>;
assertObjectProperty(opts?: object): asserts this is NodePath<ObjectProperty>;
assertObjectTypeAnnotation(opts?: object): asserts this is NodePath<ObjectTypeAnnotation>;
assertObjectTypeCallProperty(opts?: object): asserts this is NodePath<ObjectTypeCallProperty>;
assertObjectTypeIndexer(opts?: object): asserts this is NodePath<ObjectTypeIndexer>;
assertObjectTypeInternalSlot(opts?: object): asserts this is NodePath<ObjectTypeInternalSlot>;
assertObjectTypeProperty(opts?: object): asserts this is NodePath<ObjectTypeProperty>;
assertObjectTypeSpreadProperty(opts?: object): asserts this is NodePath<ObjectTypeSpreadProperty>;
assertOpaqueType(opts?: object): asserts this is NodePath<OpaqueType>;
assertOptionalCallExpression(opts?: object): asserts this is NodePath<OptionalCallExpression>;
assertOptionalIndexedAccessType(opts?: object): asserts this is NodePath<OptionalIndexedAccessType>;
assertOptionalMemberExpression(opts?: object): asserts this is NodePath<OptionalMemberExpression>;
assertParenthesizedExpression(opts?: object): asserts this is NodePath<ParenthesizedExpression>;
assertPattern(opts?: object): asserts this is NodePath<Pattern>;
assertPatternLike(opts?: object): asserts this is NodePath<PatternLike>;
assertPipelineBareFunction(opts?: object): asserts this is NodePath<PipelineBareFunction>;
assertPipelinePrimaryTopicReference(opts?: object): asserts this is NodePath<PipelinePrimaryTopicReference>;
assertPipelineTopicExpression(opts?: object): asserts this is NodePath<PipelineTopicExpression>;
assertPlaceholder(opts?: object): asserts this is NodePath<Placeholder>;
assertPrivate(opts?: object): asserts this is NodePath<Private>;
assertPrivateName(opts?: object): asserts this is NodePath<PrivateName>;
assertProgram(opts?: object): asserts this is NodePath<Program>;
assertProperty(opts?: object): asserts this is NodePath<Property>;
assertPureish(opts?: object): asserts this is NodePath<Pureish>;
assertQualifiedTypeIdentifier(opts?: object): asserts this is NodePath<QualifiedTypeIdentifier>;
assertRecordExpression(opts?: object): asserts this is NodePath<RecordExpression>;
assertRegExpLiteral(opts?: object): asserts this is NodePath<RegExpLiteral>;
/** @deprecated Use `assertRegExpLiteral` */
assertRegexLiteral(opts?: object): asserts this is NodePath<RegexLiteral$1>;
assertRestElement(opts?: object): asserts this is NodePath<RestElement>;
/** @deprecated Use `assertRestElement` */
assertRestProperty(opts?: object): asserts this is NodePath<RestProperty$1>;
assertReturnStatement(opts?: object): asserts this is NodePath<ReturnStatement>;
assertScopable(opts?: object): asserts this is NodePath<Scopable>;
assertSequenceExpression(opts?: object): asserts this is NodePath<SequenceExpression>;
assertSpreadElement(opts?: object): asserts this is NodePath<SpreadElement>;
/** @deprecated Use `assertSpreadElement` */
assertSpreadProperty(opts?: object): asserts this is NodePath<SpreadProperty$1>;
assertStandardized(opts?: object): asserts this is NodePath<Standardized>;
assertStatement(opts?: object): asserts this is NodePath<Statement>;
assertStaticBlock(opts?: object): asserts this is NodePath<StaticBlock>;
assertStringLiteral(opts?: object): asserts this is NodePath<StringLiteral>;
assertStringLiteralTypeAnnotation(opts?: object): asserts this is NodePath<StringLiteralTypeAnnotation>;
assertStringTypeAnnotation(opts?: object): asserts this is NodePath<StringTypeAnnotation>;
assertSuper(opts?: object): asserts this is NodePath<Super>;
assertSwitchCase(opts?: object): asserts this is NodePath<SwitchCase>;
assertSwitchStatement(opts?: object): asserts this is NodePath<SwitchStatement>;
assertSymbolTypeAnnotation(opts?: object): asserts this is NodePath<SymbolTypeAnnotation>;
assertTSAnyKeyword(opts?: object): asserts this is NodePath<TSAnyKeyword>;
assertTSArrayType(opts?: object): asserts this is NodePath<TSArrayType>;
assertTSAsExpression(opts?: object): asserts this is NodePath<TSAsExpression>;
assertTSBaseType(opts?: object): asserts this is NodePath<TSBaseType>;
assertTSBigIntKeyword(opts?: object): asserts this is NodePath<TSBigIntKeyword>;
assertTSBooleanKeyword(opts?: object): asserts this is NodePath<TSBooleanKeyword>;
assertTSCallSignatureDeclaration(opts?: object): asserts this is NodePath<TSCallSignatureDeclaration>;
assertTSConditionalType(opts?: object): asserts this is NodePath<TSConditionalType>;
assertTSConstructSignatureDeclaration(opts?: object): asserts this is NodePath<TSConstructSignatureDeclaration>;
assertTSConstructorType(opts?: object): asserts this is NodePath<TSConstructorType>;
assertTSDeclareFunction(opts?: object): asserts this is NodePath<TSDeclareFunction>;
assertTSDeclareMethod(opts?: object): asserts this is NodePath<TSDeclareMethod>;
assertTSEntityName(opts?: object): asserts this is NodePath<TSEntityName>;
assertTSEnumDeclaration(opts?: object): asserts this is NodePath<TSEnumDeclaration>;
assertTSEnumMember(opts?: object): asserts this is NodePath<TSEnumMember>;
assertTSExportAssignment(opts?: object): asserts this is NodePath<TSExportAssignment>;
assertTSExpressionWithTypeArguments(opts?: object): asserts this is NodePath<TSExpressionWithTypeArguments>;
assertTSExternalModuleReference(opts?: object): asserts this is NodePath<TSExternalModuleReference>;
assertTSFunctionType(opts?: object): asserts this is NodePath<TSFunctionType>;
assertTSImportEqualsDeclaration(opts?: object): asserts this is NodePath<TSImportEqualsDeclaration>;
assertTSImportType(opts?: object): asserts this is NodePath<TSImportType>;
assertTSIndexSignature(opts?: object): asserts this is NodePath<TSIndexSignature>;
assertTSIndexedAccessType(opts?: object): asserts this is NodePath<TSIndexedAccessType>;
assertTSInferType(opts?: object): asserts this is NodePath<TSInferType>;
assertTSInstantiationExpression(opts?: object): asserts this is NodePath<TSInstantiationExpression>;
assertTSInterfaceBody(opts?: object): asserts this is NodePath<TSInterfaceBody>;
assertTSInterfaceDeclaration(opts?: object): asserts this is NodePath<TSInterfaceDeclaration>;
assertTSIntersectionType(opts?: object): asserts this is NodePath<TSIntersectionType>;
assertTSIntrinsicKeyword(opts?: object): asserts this is NodePath<TSIntrinsicKeyword>;
assertTSLiteralType(opts?: object): asserts this is NodePath<TSLiteralType>;
assertTSMappedType(opts?: object): asserts this is NodePath<TSMappedType>;
assertTSMethodSignature(opts?: object): asserts this is NodePath<TSMethodSignature>;
assertTSModuleBlock(opts?: object): asserts this is NodePath<TSModuleBlock>;
assertTSModuleDeclaration(opts?: object): asserts this is NodePath<TSModuleDeclaration>;
assertTSNamedTupleMember(opts?: object): asserts this is NodePath<TSNamedTupleMember>;
assertTSNamespaceExportDeclaration(opts?: object): asserts this is NodePath<TSNamespaceExportDeclaration>;
assertTSNeverKeyword(opts?: object): asserts this is NodePath<TSNeverKeyword>;
assertTSNonNullExpression(opts?: object): asserts this is NodePath<TSNonNullExpression>;
assertTSNullKeyword(opts?: object): asserts this is NodePath<TSNullKeyword>;
assertTSNumberKeyword(opts?: object): asserts this is NodePath<TSNumberKeyword>;
assertTSObjectKeyword(opts?: object): asserts this is NodePath<TSObjectKeyword>;
assertTSOptionalType(opts?: object): asserts this is NodePath<TSOptionalType>;
assertTSParameterProperty(opts?: object): asserts this is NodePath<TSParameterProperty>;
assertTSParenthesizedType(opts?: object): asserts this is NodePath<TSParenthesizedType>;
assertTSPropertySignature(opts?: object): asserts this is NodePath<TSPropertySignature>;
assertTSQualifiedName(opts?: object): asserts this is NodePath<TSQualifiedName>;
assertTSRestType(opts?: object): asserts this is NodePath<TSRestType>;
assertTSSatisfiesExpression(opts?: object): asserts this is NodePath<TSSatisfiesExpression>;
assertTSStringKeyword(opts?: object): asserts this is NodePath<TSStringKeyword>;
assertTSSymbolKeyword(opts?: object): asserts this is NodePath<TSSymbolKeyword>;
assertTSThisType(opts?: object): asserts this is NodePath<TSThisType>;
assertTSTupleType(opts?: object): asserts this is NodePath<TSTupleType>;
assertTSType(opts?: object): asserts this is NodePath<TSType>;
assertTSTypeAliasDeclaration(opts?: object): asserts this is NodePath<TSTypeAliasDeclaration>;
assertTSTypeAnnotation(opts?: object): asserts this is NodePath<TSTypeAnnotation>;
assertTSTypeAssertion(opts?: object): asserts this is NodePath<TSTypeAssertion>;
assertTSTypeElement(opts?: object): asserts this is NodePath<TSTypeElement>;
assertTSTypeLiteral(opts?: object): asserts this is NodePath<TSTypeLiteral>;
assertTSTypeOperator(opts?: object): asserts this is NodePath<TSTypeOperator>;
assertTSTypeParameter(opts?: object): asserts this is NodePath<TSTypeParameter>;
assertTSTypeParameterDeclaration(opts?: object): asserts this is NodePath<TSTypeParameterDeclaration>;
assertTSTypeParameterInstantiation(opts?: object): asserts this is NodePath<TSTypeParameterInstantiation>;
assertTSTypePredicate(opts?: object): asserts this is NodePath<TSTypePredicate>;
assertTSTypeQuery(opts?: object): asserts this is NodePath<TSTypeQuery>;
assertTSTypeReference(opts?: object): asserts this is NodePath<TSTypeReference>;
assertTSUndefinedKeyword(opts?: object): asserts this is NodePath<TSUndefinedKeyword>;
assertTSUnionType(opts?: object): asserts this is NodePath<TSUnionType>;
assertTSUnknownKeyword(opts?: object): asserts this is NodePath<TSUnknownKeyword>;
assertTSVoidKeyword(opts?: object): asserts this is NodePath<TSVoidKeyword>;
assertTaggedTemplateExpression(opts?: object): asserts this is NodePath<TaggedTemplateExpression>;
assertTemplateElement(opts?: object): asserts this is NodePath<TemplateElement>;
assertTemplateLiteral(opts?: object): asserts this is NodePath<TemplateLiteral>;
assertTerminatorless(opts?: object): asserts this is NodePath<Terminatorless>;
assertThisExpression(opts?: object): asserts this is NodePath<ThisExpression>;
assertThisTypeAnnotation(opts?: object): asserts this is NodePath<ThisTypeAnnotation>;
assertThrowStatement(opts?: object): asserts this is NodePath<ThrowStatement>;
assertTopicReference(opts?: object): asserts this is NodePath<TopicReference>;
assertTryStatement(opts?: object): asserts this is NodePath<TryStatement>;
assertTupleExpression(opts?: object): asserts this is NodePath<TupleExpression>;
assertTupleTypeAnnotation(opts?: object): asserts this is NodePath<TupleTypeAnnotation>;
assertTypeAlias(opts?: object): asserts this is NodePath<TypeAlias>;
assertTypeAnnotation(opts?: object): asserts this is NodePath<TypeAnnotation>;
assertTypeCastExpression(opts?: object): asserts this is NodePath<TypeCastExpression>;
assertTypeParameter(opts?: object): asserts this is NodePath<TypeParameter>;
assertTypeParameterDeclaration(opts?: object): asserts this is NodePath<TypeParameterDeclaration>;
assertTypeParameterInstantiation(opts?: object): asserts this is NodePath<TypeParameterInstantiation>;
assertTypeScript(opts?: object): asserts this is NodePath<TypeScript>;
assertTypeofTypeAnnotation(opts?: object): asserts this is NodePath<TypeofTypeAnnotation>;
assertUnaryExpression(opts?: object): asserts this is NodePath<UnaryExpression>;
assertUnaryLike(opts?: object): asserts this is NodePath<UnaryLike>;
assertUnionTypeAnnotation(opts?: object): asserts this is NodePath<UnionTypeAnnotation>;
assertUpdateExpression(opts?: object): asserts this is NodePath<UpdateExpression>;
assertUserWhitespacable(opts?: object): asserts this is NodePath<UserWhitespacable>;
assertV8IntrinsicIdentifier(opts?: object): asserts this is NodePath<V8IntrinsicIdentifier>;
assertVariableDeclaration(opts?: object): asserts this is NodePath<VariableDeclaration>;
assertVariableDeclarator(opts?: object): asserts this is NodePath<VariableDeclarator>;
assertVariance(opts?: object): asserts this is NodePath<Variance>;
assertVoidTypeAnnotation(opts?: object): asserts this is NodePath<VoidTypeAnnotation>;
assertWhile(opts?: object): asserts this is NodePath<While>;
assertWhileStatement(opts?: object): asserts this is NodePath<WhileStatement>;
assertWithStatement(opts?: object): asserts this is NodePath<WithStatement>;
assertYieldExpression(opts?: object): asserts this is NodePath<YieldExpression>; // #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<S = unknown> {
parentPath: NodePath;
scope: Scope;
state: S;
opts: TraverseOptions;
}
type NodePathResult<T> = (Extract<T, Node$1 | null | undefined> extends never ? never : NodePath<Extract<T, Node$1 | null | undefined>>) | (T extends Array<Node$1 | null | undefined> ? Array<NodePath<T[number]>> : 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<typeof parse$1>;
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<string, "current"> | "current" | true;
safari?: Omit<string, "tp"> | "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<BabelFileResult | null>;
/**
* 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<BabelFileResult | null>;
/**
* 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<BabelFileResult | null>;
// 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<S = PluginPass> {
name?: string | undefined;
manipulateOptions?(opts: any, parserOpts: any): void;
pre?(this: S, file: BabelFile): void;
visitor: Visitor<S>;
post?(this: S, file: BabelFile): void;
inherits?: any;
}
interface BabelFile {
ast: File;
opts: TransformOptions;
hub: Hub;
metadata: object;
path: NodePath<Program>;
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<ParseResult | null>;
/**
* 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<ConfigItem>` - See below.
* * `presets: Array<ConfigItem>` - 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<PartialConfig> | null;
declare function loadPartialConfigAsync(options?: TransformOptions): Promise<Readonly<PartialConfig> | 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<any> | 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<T extends SimpleCacheKey>(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
// <T extends SimpleCacheKey>(callback: CacheCallback<T>): 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<T extends SimpleCacheKey>(callback: SimpleCacheCallback<T>): 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<T extends SimpleCacheKey>(callback: SimpleCacheCallback<T>): 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 extends SimpleCacheKey> = () => 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.
<T extends SimpleCacheKey>(envCallback: (envName: NonNullable<TransformOptions["envName"]>) => 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<Expression>;
//#endregion
//#region code/core/.dts-emit/code/core/src/babel/expression-resolver.d.ts
/** Recursively unwraps TypeScript type annotation expressions (as X, satisfies X, <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 };