@codemod-utils/ast-template
Version:
Utilities for handling *.hbs files as abstract syntax tree
31 lines (30 loc) • 862 B
TypeScript
import { type AST as _AST, type NodeVisitor, print } from 'ember-template-recast';
declare function traverse(): (file: string, visitMethods?: NodeVisitor) => _AST.Template;
/**
* An object that provides `builders`, `print`, and `traverse`.
*
* In a `traverse` call, you can specify how to visit the nodes of
* interest ("visit methods") and how to modify them ("builders").
*
* @example
*
* ```ts
* import { AST } from '@codemod-utils/ast-template';
*
* function transform(file: string): string {
* const traverse = AST.traverse();
*
* const ast = traverse(file, {
* // Use AST.builders to transform the tree
* });
*
* return AST.print(ast);
* }
* ```
*/
export declare const AST: {
builders: import("ember-template-recast/lib/custom-nodes.js").Builders;
print: typeof print;
traverse: typeof traverse;
};
export {};