@types/babel__template

  • Version 7.4.4
  • Published
  • 6.41 kB
  • 2 dependencies
  • MIT license

Install

npm i @types/babel__template
yarn add @types/babel__template
pnpm add @types/babel__template

Overview

TypeScript definitions for @babel/template

Index

Variables

variable expression

const expression: TemplateBuilder<Expression>;

    variable program

    const program: TemplateBuilder<Program>;

      variable smart

      const smart: TemplateBuilder<any>;

        variable statement

        const statement: TemplateBuilder<Statement>;

          variable statements

          const statements: TemplateBuilder<Statement[]>;

            variable templateBuilder

            const templateBuilder: TemplateBuilder<any> & {
            smart: TemplateBuilder<any>;
            statement: TemplateBuilder<Statement>;
            statements: TemplateBuilder<Statement[]>;
            expression: TemplateBuilder<Expression>;
            program: TemplateBuilder<Program>;
            ast: {
            (tpl: string, opts?: TemplateBuilderOptions): any;
            (tpl: TemplateStringsArray, ...args: unknown[]): any;
            };
            };

              Interfaces

              interface TemplateBuilder

              interface TemplateBuilder<T> {}

                property ast

                ast: {
                (tpl: string, opts?: TemplateBuilderOptions): T;
                (tpl: TemplateStringsArray, ...args: unknown[]): T;
                };
                • Allow users to explicitly create templates that produce ASTs, skipping the need for an intermediate function.

                  Does not allow %%foo%% style placeholders.

                call signature

                (opts: TemplateBuilderOptions): TemplateBuilder<T>;
                • Build a new builder, merging the given options with the previous ones.

                call signature

                (code: string, opts?: TemplateBuilderOptions): (arg?: PublicReplacements) => T;
                • Building from a string produces an AST builder function by default.

                call signature

                (tpl: TemplateStringsArray, ...args: unknown[]): (arg?: PublicReplacements) => T;
                • Building from a template literal produces an AST builder function by default.

                interface TemplateBuilderOptions

                interface TemplateBuilderOptions extends ParserOptions {}

                  property placeholderPattern

                  placeholderPattern?: RegExp | false | 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.

                    /^[_$A-Z0-9]+$/

                  property placeholderWhitelist

                  placeholderWhitelist?: Set<string> | null | undefined;
                  • 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.

                  property preserveComments

                  preserveComments?: boolean | null | undefined;
                  • Set this to true to preserve comments from the template string into the resulting AST, or false to automatically discard comments.

                    false

                  property syntacticPlaceholders

                  syntacticPlaceholders?: 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.

                    7.4.0

                  Type Aliases

                  type PublicReplacements

                  type PublicReplacements = { [index: string]: unknown } | unknown[];

                    Package Files (1)

                    Dependencies (2)

                    Dev Dependencies (0)

                    No dev dependencies.

                    Peer Dependencies (0)

                    No peer dependencies.

                    Badge

                    To add a badge like this onejsDocs.io badgeto 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/@types/babel__template.

                    • Markdown
                      [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/babel__template)
                    • HTML
                      <a href="https://www.jsdocs.io/package/@types/babel__template"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>