CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/npm-babel-plugin-react-transform

Babel plugin to instrument React components with custom transforms

59%

Overall

Evaluation59%

1.48x

Agent success when using this tile

Overview
Eval results
Files

task.mdevals/scenario-9/

Component Metadata Collector

Create a helper that compiles supplied React-style component source and returns the instrumentation output produced by the dependency plugin, with emphasis on the component metadata map it generates.

Capabilities

Builds metadata map for top-level components

  • Given source containing two top-level class components with render methods, the metadata map contains two entries with displayName values "Header" and "Footer" and both isInFunction flags set to false. @test

Tags components inside functions

  • Given source where a class component is declared inside a factory function, the metadata map contains an entry whose displayName is "Inner" and isInFunction is true. @test

Records anonymous components

  • Given source where a component lacks a display name (for example an anonymous default export), the metadata map still contains an entry for the component and exposes isInFunction false while omitting displayName. @test

Returns instrumented output

  • The compiled output string includes the wrapper scaffolding added by the plugin and can be executed without syntax errors. @test

Implementation

@generates

API

export async function buildComponentMetadata(sourceCode: string): Promise<{
  code: string;
  components: Record<string, { displayName?: string; isInFunction: boolean }>;
}>;

The function compiles the provided React component source using the dependency plugin, returning both the transformed code and the per-component metadata map emitted by the plugin. Preserve the component identifiers as produced by the plugin; each map entry must include an isInFunction boolean and a displayName string when one is available.

Dependencies { .dependencies }

babel-plugin-react-transform { .dependency }

Instruments React-style components and emits per-file component metadata used by registered transforms.

tessl i tessl/npm-babel-plugin-react-transform@3.0.0

tile.json