fix(media-use): the carve bundle exports analyseCarveDynamics, so carve runs again (#7893)

carve.mjs calls analyseCarveDynamics for the bed's carve lanes, but the
generated lib/audio-carve.mjs did not export it, so every real run failed
with "carveApi.analyseCarveDynamics is not a function" after detecting the
tracks. The generator now bundles it, and a test fails when carve.mjs calls
any function the bundle does not export.

Reproduce on main: node skills/media-use/audio/scripts/carve.mjs --comp index.html
in a composition with a music bed and a voice.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
andybpan
2026-11-16 06:42:11 +00:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 4729099148
commit 94e499d8cf
4 changed files with 23 additions and 3 deletions
@@ -16,6 +16,7 @@ const { build } = await import(resolve(here, "../packages/core/node_modules/esbu
const ENTRY = `export {
analyseCarveBands,
analyseCarveDuck,
analyseCarveDynamics,
carveBandsToChain,
carveProfile,
classifyAudioName,
+1 -1
View File
@@ -18,7 +18,7 @@
"files": 13
},
"media-use": {
"hash": "bffe3f288782b86a",
"hash": "fa655ce936dab4a5",
"files": 128
},
"remotion-to-hyperframes": {
+20 -1
View File
@@ -1,7 +1,15 @@
import assert from "node:assert/strict";
import test from "node:test";
import { execFileSync } from "node:child_process";
import { existsSync, mkdirSync, mkdtempSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
import {
existsSync,
mkdirSync,
mkdtempSync,
readFileSync,
rmSync,
symlinkSync,
writeFileSync,
} from "node:fs";
import { tmpdir } from "node:os";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
@@ -241,6 +249,17 @@ test("carve never loads @hyperframes/core from the composition's project", () =>
});
});
test("the bundled core exports every function carve.mjs calls", async () => {
const source = readFileSync(join(SCRIPTS_DIR, "carve.mjs"), "utf-8");
const called = new Set([...source.matchAll(/carveApi\s*\.\s*(\w+)/g)].map((m) => m[1]));
const bundle = await import("./lib/audio-carve.mjs");
assert.ok(called.size > 0);
assert.deepEqual(
[...called].filter((name) => typeof bundle[name] !== "function"),
[],
);
});
test("members is required, so dropping it cannot silently restore the group form", () => {
// The gap this closes: `main()` is the only code that BUILDS `members`, and no
// test runs `main()` (the symlink test stops at the usage error, a real run
File diff suppressed because one or more lines are too long