@babel/template
- Version 8.0.0
- Published
- 67 kB
- 3 dependencies
- MIT license
Install
npm i @babel/templateyarn add @babel/templatepnpm add @babel/templateOverview
Generate an AST from a string template.
Index
Variables
Type Aliases
Variables
variable _default
const _default: TemplateBuilder<any> & { smart: typeof smart; statement: typeof statement; statements: typeof statements; expression: typeof expression; program: typeof program;} & { smart: TemplateBuilder<_babel_types.Statement | _babel_types.Statement[]>; statement: TemplateBuilder<_babel_types.Statement>; statements: TemplateBuilder<_babel_types.Statement[]>; expression: TemplateBuilder<_babel_types.Expression>; program: TemplateBuilder<_babel_types.Program>; ast: { (tpl: string, opts?: PublicOpts): | _babel_types.Statement | _babel_types.Statement[]; (tpl: TemplateStringsArray, ...args: unknown[]): | _babel_types.Statement | _babel_types.Statement[]; };};variable expression
const expression: TemplateBuilder<_babel_types.Expression>;variable program
const program: TemplateBuilder<_babel_types.Program>;variable smart
const smart: TemplateBuilder<any>;variable statement
const statement: TemplateBuilder<_babel_types.Statement>;variable statements
const statements: TemplateBuilder<_babel_types.Statement[]>;Type Aliases
type Options
type PublicOpts = { /** * A set of placeholder names to automatically accept, ignoring the given * pattern entirely. * * This option can be used when using %%foo%% style placeholders. */ placeholderAllowlist?: Set<string>; /** * A pattern to search for when looking for Identifier and StringLiteral * nodes that can be replaced. * * 'false' will disable placeholder searching entirely, leaving only the * 'placeholderAllowlist' value to find replacements. * * Defaults to /^[_$A-Z0-9]+$/. * * This option can be used when using %%foo%% style placeholders. */ placeholderPattern?: RegExp | false; /** * 'true' to pass through comments from the template into the resulting AST, * or 'false' to automatically discard comments. Defaults to 'false'. */ preserveComments?: boolean; /** * 'true' to use %%foo%% style placeholders, 'false' to use legacy placeholders * described by placeholderPattern or placeholderAllowlist. * When it is not set, it behaves as 'true' if there are syntactic placeholders, * otherwise as 'false'. */ syntacticPlaceholders?: boolean | null;} & ParserOptions;These are the options that 'babel-template' actually accepts and typechecks when called. All other options are passed through to the parser.
type Replacements
type PublicReplacements = Record<string, unknown> | unknown[];Package Files (1)
Dependencies (3)
Dev Dependencies (0)
No dev dependencies.
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@babel/template.
- Markdown[](https://www.jsdocs.io/package/@babel/template)
- HTML<a href="https://www.jsdocs.io/package/@babel/template"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 2643 ms. - Missing or incorrect documentation? Open an issue for this package.
