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

File-Scoped React Transform Harness

A utility that compiles a React source string with configured transforms and reports how those transforms were initialized per file.

Capabilities

Initializes transforms once per file

  • Processing a source that defines two top-level class components reports exactly one initialization record per configured transform, covering both components rather than separate per-component initializations. @test

Provides component metadata to transforms

  • Initialization records include a components map whose values expose display names for each detected component and isInFunction set to true for a component declared inside a factory function while top-level components remain false. @test

Injects configured imports and locals

  • When a transform is configured with imports ['react'] and locals ['module'], the recorded initialization shows those dependencies supplied in order as concrete values, not unresolved identifiers. @test

Uses provided filename

  • The filename in each initialization record matches the filename passed into the harness, including directory segments, so transforms can trace the source file. @test

Implementation

@generates

API

export interface TransformConfig {
  transform: string;
  imports?: string[];
  locals?: string[];
}

export interface InitializationRecord {
  transformId: string;
  filename: string;
  components: { [id: string]: { displayName?: string; isInFunction?: boolean } };
  imports: any[];
  locals: any[];
}

export function instrumentSource(options: {
  source: string;
  filename: string;
  transforms: TransformConfig[];
}): { code: string; initialization: InitializationRecord[] };

Dependencies { .dependencies }

babel-plugin-react-transform { .dependency }

Wraps detected components and initializes configured transforms per file.

@babel/core { .dependency }

Compiles source strings while applying the transform plugin.

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

tile.json