MCPcopy Create free account
hub / github.com/GCWing/BitFun / transformIndexHtml

Function transformIndexHtml

src/web-ui/vite.config.version-plugin.ts:12–30  ·  view source on GitHub ↗
(html)

Source from the content-addressed store, hash-verified

10 return {
11 name: 'version-injection',
12 transformIndexHtml(html) {
13 try {
14 // Read the generated version info injection script
15 const injectionScriptPath = path.resolve(__dirname, 'src/generated/version-injection.html');
16
17 if (fs.existsSync(injectionScriptPath)) {
18 const injectionScript = fs.readFileSync(injectionScriptPath, 'utf-8');
19
20 // Inject the version info script before </head>
21 return html.replace('</head>', `${injectionScript}\n</head>`);
22 }
23
24 console.warn('[version-injection] Version injection script not found, skipping injection');
25 return html;
26 } catch (error) {
27 console.error('[version-injection] Failed to inject version info:', error);
28 return html;
29 }
30 }
31 };
32}
33

Callers

nothing calls this directly

Calls 4

warnMethod · 0.80
replaceMethod · 0.65
resolveMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected