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-10/

Feature-Flagged AST Summary

Build a small module that turns source text into a compact AST summary while conditionally enabling modern syntax support based on feature flags.

Capabilities

Feature-flagged parsing

  • Given const config = settings?.theme ?? "light"; export default config; with features ["optional-chains"], return topLevelTypes as ["VariableDeclaration", "ExportDefaultDeclaration"] and identifiers as ["config", "settings", "theme"], all in source order. @test

JSX support

  • Given const View = () => <section><h1>{title}</h1></section>; with features ["jsx"], include the JSX-bearing statement in topLevelTypes and list identifiers ["View", "title"], preserving first appearance order. @test

TypeScript support

  • Given interface User { id: number } const id: number = 1; with features ["typescript"], ignore type-only declarations in the summary so topLevelTypes is ["VariableDeclaration"] and identifiers is ["id"]. @test

Missing feature errors

  • When parsing code that needs a feature flag (e.g., JSX) but the flag is absent, throw a descriptive error mentioning the missing feature key. @test

Implementation

@generates

API

export type FeatureFlag = "optional-chains" | "jsx" | "typescript";

export interface ParseOptions {
  features?: FeatureFlag[];
  sourceType?: "module" | "script";
}

export interface AstSummary {
  topLevelTypes: string[];
  identifiers: string[];
}

export function buildAstSummary(code: string, options?: ParseOptions): AstSummary;

Identifiers should be reported in the order first encountered during parsing and should exclude any that are only present in type positions.

Dependencies { .dependencies }

@babel/parser { .dependency }

Parses JavaScript/TypeScript source text with configurable plugin flags.

Version

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