MCPcopy Create free account
hub / github.com/NativeScript/NativeScript / genCode

Function genCode

packages/vite/hmr/helpers/babel.ts:3–16  ·  view source on GitHub ↗
(node: any, opts?: any)

Source from the content-addressed store, hash-verified

1import * as babelGenerator from '@babel/generator';
2
3export function genCode(node: any, opts?: any): { code: string } {
4 const anyGen: any = babelGenerator as any;
5 const candidates = [anyGen?.default?.default, anyGen?.default, anyGen?.generate, anyGen];
6 for (const cand of candidates) {
7 if (typeof cand === 'function') {
8 try {
9 return cand(node, opts || {});
10 } catch {
11 /* try next */
12 }
13 }
14 }
15 throw new Error('babel-generator unavailable');
16}

Callers 4

extractTemplateRenderFunction · 0.85
configureServerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected