feat(audio): implement phase 3c master protection

This commit is contained in:
2026-09-05 20:45:47 -07:00
parent 249328e595
commit 90fcbbe467
21 changed files with 6732 additions and 71 deletions
+7 -1
View File
@@ -12,6 +12,7 @@ const sourceFiles = Object.freeze([
'src/runtime/types.js',
'src/runtime/values.js',
'src/runtime/audio-contract.js',
'src/runtime/audio-protection.js',
'src/runtime/audio-automation.js',
'src/runtime/audio-graph.js',
'src/runtime/audio-controls.js',
@@ -36,10 +37,15 @@ function bundleModule(source, path) {
return `\n/* ${path} */\n${withoutExports.trim()}\n`;
}
export function bundleRuntime(includeApp = true) {
return sourceFiles.filter(path => includeApp || path !== 'src/runtime/app.js')
.map(path => bundleModule(normalized(path), path)).join('');
}
export function buildStandalone(outputPath = resolve(repositoryRoot, 'XZBT.html')) {
const template = normalized('src/XZBT.template.html');
const styles = normalized('src/styles.css').trim();
const script = `'use strict';\n(() => {\n${sourceFiles.map((path) => bundleModule(normalized(path), path)).join('')}\n})();`;
const script = `'use strict';\n(() => {\n${bundleRuntime()}\n})();`;
if (!template.includes('/*__XZBT_STYLES__*/') || !template.includes('/*__XZBT_SCRIPT__*/')) {
throw new Error('Standalone template is missing a build placeholder.');
}