mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-16 14:27:26 +00:00
- Split FxSection's per-node row into FxNodeRow + FxNodeControls so the CRAP score (31.6, threshold 30) splits across two smaller units instead of moving wholesale with one extraction. - Dedupe the repeated "open the add menu, read its items" block in propertyPanelFxSection.test.tsx into openAddMenuItems(). - Merge build-audio-fx-runtime.ts and build-position-edits-render.ts into one build-inline-artifact.ts, config-selected by CLI arg — the two scripts were a byte-for-byte clone save for names. - Exempt canary.test.ts's rawFnv (a deliberate independent reimplementation used to cross-check canaryBucket, per its own docstring) and the property-panel test files' shared renderInto/mount scaffolding (pre-existing across 9 files, 2 outside this stack) in .fallowrc.jsonc, consistent with this file's existing exemptions for the same class of intentional/pre-existing duplication.
51 lines
1.6 KiB
TypeScript
51 lines
1.6 KiB
TypeScript
/** Build the injectable audio-FX runtime artifact from the canonical runtime. */
|
|
|
|
import { mkdirSync, writeFileSync } from "node:fs";
|
|
import { dirname, resolve } from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
import { buildSync } from "esbuild";
|
|
import { execFileSync } from "node:child_process";
|
|
|
|
const thisDir = dirname(fileURLToPath(import.meta.url));
|
|
const repoRoot = resolve(thisDir, "..");
|
|
const entry = resolve(repoRoot, "stubs/audio-fx-runtime-entry.ts");
|
|
const generatedDir = resolve(repoRoot, "src/generated");
|
|
const outPath = resolve(generatedDir, "audio-fx-runtime-inline.ts");
|
|
|
|
const result = buildSync({
|
|
entryPoints: [entry],
|
|
bundle: true,
|
|
write: false,
|
|
platform: "browser",
|
|
format: "iife",
|
|
target: ["es2020"],
|
|
minify: true,
|
|
legalComments: "none",
|
|
});
|
|
const iife = result.outputFiles[0]?.text ?? "";
|
|
if (!iife) throw new Error("esbuild produced no output for audio-fx-runtime-entry.ts");
|
|
|
|
mkdirSync(generatedDir, { recursive: true });
|
|
writeFileSync(
|
|
outPath,
|
|
[
|
|
"// AUTO-GENERATED by scripts/build-audio-fx-runtime.ts - do not edit",
|
|
`const AUDIO_FX_RUNTIME_IIFE: string = ${JSON.stringify(iife)};`,
|
|
"",
|
|
"/** Returns the pre-built audio-FX runtime IIFE as a string constant. */",
|
|
"export function getAudioFxRuntimeScript(): string {",
|
|
" return AUDIO_FX_RUNTIME_IIFE;",
|
|
"}",
|
|
"",
|
|
].join("\n"),
|
|
"utf8",
|
|
);
|
|
|
|
try {
|
|
execFileSync("bun", ["x", "oxfmt", outPath], { stdio: "ignore" });
|
|
} catch {
|
|
// Formatting is best effort when the generator runs in a minimal environment.
|
|
}
|
|
|
|
console.log(JSON.stringify({ event: "audio_fx_runtime_generated", outPath, bytes: iife.length }));
|