Babel plugin to instrument React components with custom transforms
59
Evaluation — 59%
↑ 1.47xAgent success when using this tile
Build a helper that runs a Babel transform to instrument React-style class components while filtering out classes without render methods. Rely on the provided dependency to perform detection and wrapping rather than reimplementing component parsing logic.
@generates
export interface TransformOptions {
/** Extra superclass patterns to consider when detecting class components */
superClasses?: string[];
/** Optional file name to use in generated metadata */
filename?: string;
}
/**
* Transforms source code by applying the configured component-wrapping plugin.
* Returns both the compiled code and component metadata emitted by the transform.
*/
export function transformWithClassGate(
source: string,
options?: TransformOptions
): { code: string; metadata: Record<string, { displayName?: string; isInFunction: boolean }> };Provides the component-detection and wrapping transform used 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