Babel plugin to instrument React components with custom transforms
59
Evaluation — 59%
↑ 1.47xAgent success when using this tile
Build a helper that takes JavaScript source code containing React-style components and returns transformed code where every detected component is wrapped with a provided transform module. The helper must allow callers to extend component detection to custom factory methods and custom superclasses while keeping the default detection behavior intact.
WidgetBase that defines a render method, the transformed output wraps that class component with the provided transform while preserving its export. @testUI.createWidget({ render() { return <div/>; } }), the transformed output wraps that factory-produced component with the provided transform. @testrender method or an object created by unmatched factory calls remains unchanged after transformation. @test@generates
export interface TransformOptions {
factoryPatterns?: string[];
superclassPatterns?: string[];
transformModule: string;
}
export function transformComponents(
code: string,
options: TransformOptions
): string;Use to wrap React-style components during compilation.
Install with Tessl CLI
npx tessl i tessl/npm-babel-plugin-react-transformevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9