CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/npm-babel--preset-stage-0

tessl install tessl/npm-babel--preset-stage-0@7.8.0

Deprecated Babel preset for stage 0 plugins that provides migration guidelines to explicit plugin configurations

Agent Success

Agent success rate when using this tile

80%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.21x

Baseline

Agent success rate without this tile

66%

task.mdevals/scenario-3/

Source Transform Runner

A minimal interface for compiling JavaScript and TypeScript source text and files through the dependency's compiler entry points to deliver transformed code, source maps, and metadata for downstream tooling.

Capabilities

Inline compilation

  • Given source const greet = (name?: string) => name ?? "hi"; and options using @babel/preset-env (targeting Node 14) plus @babel/preset-typescript with sourceMaps: "inline" and filename: "virtual.ts", returns code with type syntax stripped, nullish coalescing rewritten for the target, and an inline source map comment that references virtual.ts. @test
  • When sourceMaps is truthy, the returned object contains the generated code, parsed source map data, and compiler metadata. @test

File compilation

  • Compiling fixtures/sample.ts with the same presets/plugins applies the transforms, resolves cwd and filename into the source map paths, and yields code that mirrors the inline behavior. @test
  • Files outside the allowed extensions set (.js, .jsx, .ts, .tsx) are rejected with a clear error. @test

Callback mode

  • A callback-driven file compile entry point accepts an error-first callback; compiler failures surface the underlying message, and successful callbacks receive the same shape as the async result. @test

Implementation

@generates

API

export interface CompileOptions {
  presets?: Array<string | [string, Record<string, unknown>]>;
  plugins?: Array<string | [string, Record<string, unknown>]>;
  sourceMaps?: boolean | "inline";
  cwd?: string;
  filename?: string;
  extensions?: string[];
}

export interface CompileOutput {
  code: string;
  map?: object | null;
  metadata?: Record<string, unknown>;
}

export function compileString(source: string, options?: CompileOptions): Promise<CompileOutput>;

export function compileFile(filePath: string, options?: CompileOptions): Promise<CompileOutput>;

export function compileFileSync(filePath: string, options?: CompileOptions): CompileOutput;

export function compileFileWithCallback(
  filePath: string,
  options: CompileOptions | undefined,
  callback: (error: Error | null, result?: CompileOutput) => void
): void;

Dependencies { .dependencies }

@babel/core { .dependency }

Exposes the compiler entry points used to transform source strings and files, returning code, source maps, and metadata.

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/@babel/preset-stage-0@7.8.x
tile.json