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

Function detectionGlobalPlugin

packages/vite/src/detectionGlobalPlugin.ts:9–38  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7 * @public
8 */
9export function detectionGlobalPlugin(): Plugin {
10 let resolvedConfig: ResolvedConfig;
11 return {
12 name: 'vite-plugin-alphatab-global',
13
14 configResolved(config) {
15 resolvedConfig = config as ResolvedConfig;
16 },
17
18 shouldTransformCachedModule({ code }) {
19 return code.includes(marker);
20 },
21
22 async transform(code, id) {
23 if (!code.includes(marker)) {
24 return;
25 }
26
27 const s = new MagicString(code);
28 s.replaceAll(marker, JSON.stringify(true));
29 return {
30 code: s.toString(),
31 map:
32 resolvedConfig.command === 'build' && resolvedConfig.build.sourcemap
33 ? s.generateMap({ hires: 'boundary', source: id })
34 : null
35 };
36 }
37 };
38}

Callers 1

alphaTabFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected