MCPcopy Create free account
hub / github.com/CoderLine/alphaTab / handler

Function handler

packages/tooling/src/vite.plugin.transform.ts:34–60  ·  view source on GitHub ↗
(code, id)

Source from the content-addressed store, hash-verified

32 transform: {
33 filter: { id: /\.tsx?$/ },
34 handler(code, id) {
35 if (!code.includes('ElementStyleHelper')) {
36 return null;
37 }
38
39 const program = parseAst(
40 code,
41 { lang: id.endsWith('.tsx') ? 'tsx' : 'ts', sourceType: 'module' },
42 id
43 );
44
45 const ms = new MagicString(code);
46 walk(program, node => {
47 if (node.type === 'BlockStatement' || node.type === 'Program') {
48 rewriteBody((node as BlockStatement | Program).body as Statement[], ms);
49 }
50 });
51
52 if (!ms.hasChanged()) {
53 return null;
54 }
55
56 return {
57 code: ms.toString(),
58 map: ms.generateMap({ hires: 'boundary', source: id })
59 };
60 }
61 }
62 };
63}

Callers 1

onLogFunction · 0.70

Calls 4

walkFunction · 0.85
rewriteBodyFunction · 0.85
includesMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected