Deprecated Babel preset for stage 0 plugins that provides migration guidelines to explicit plugin configurations
80
Transforms an existing Babel-format AST of an ES module without reparsing the source. Rewrites logging, promotes an anonymous default export into a named handler, and returns generated code (and an optional source map) derived from the provided tree. When inserting or reusing logging helpers, default to a module specifier of "reporter" unless overridden.
const msg = "hi"; console.log(msg); export default () => msg;, the emitted code uses reporter.log(msg) instead of console.log(msg) while leaving other statements intact, adding a single default import for the reporter module when none exists. @testexport const handler = <original default export> and export default handler; while preserving the original function body. @testimport reporter from "reporter";, the transformed code reuses the existing import and still rewrites log calls without adding a second import. @testincludeSourceMap: true and filename: "example.js" plus the AST described above, returns a non-null map whose file is "example.js" and whose mappings align with the transformed output length. @test@generates
export interface TransformResult {
code: string;
map?: object | null;
}
export interface TransformOptions {
filename?: string;
reporterModule?: string;
includeSourceMap?: boolean;
}
export async function transformPreparsedModule(
ast: object,
sourceCode?: string,
options?: TransformOptions
): Promise<TransformResult>;Runs a plugin pipeline against an existing AST and emits code and source maps without reparsing the input.
Install with Tessl CLI
npx tessl i tessl/npm-babel--preset-stage-0docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10