Babel plugin to instrument React components with custom transforms
A utility that compiles a React source string with configured transforms and reports how those transforms were initialized per file.
isInFunction set to true for a component declared inside a factory function while top-level components remain false. @test['react'] and locals ['module'], the recorded initialization shows those dependencies supplied in order as concrete values, not unresolved identifiers. @test@generates
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[] };Wraps detected components and initializes configured transforms per file.
Compiles source strings while applying the transform plugin.
tessl i tessl/npm-babel-plugin-react-transform@3.0.0evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9