MCPcopy Create free account
hub / github.com/FormidableLabs/react-live / transform

Function transform

packages/react-live/src/utils/transpile/transform.ts:9–24  ·  view source on GitHub ↗
(opts: Options = {})

Source from the content-addressed store, hash-verified

7};
8
9export default function transform(opts: Options = {}) {
10 const transforms = Array.isArray(opts.transforms)
11 ? opts.transforms.filter(Boolean)
12 : defaultTransforms;
13
14 return (code: string) =>
15 _transform(code, {
16 transforms,
17 // Suppresses React's `__self`/`__source` debug props. They describe a
18 // source file, and there is no file here -- this is code typed into a
19 // live editor, so sucrase emits an empty filename. React ignores both
20 // props, and React 19 treats `__self` as the signature of an outdated
21 // JSX transform and warns about it, so there is nothing to lose.
22 production: true,
23 }).code;
24}

Callers 3

generateElementFunction · 0.85
renderElementAsyncFunction · 0.85
transpile.test.jsxFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected