hyperframes 0.4.44 → 0.4.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +427 -308
- package/dist/skills/hyperframes/SKILL.md +2 -3
- package/dist/skills/hyperframes/patterns.md +73 -0
- package/dist/skills/hyperframes/references/transcript-guide.md +1 -45
- package/dist/skills/hyperframes-cli/SKILL.md +3 -31
- package/dist/templates/_shared/CLAUDE.md +2 -1
- package/package.json +1 -1
- package/dist/skills/hyperframes/references/tts.md +0 -75
package/dist/cli.js
CHANGED
|
@@ -54,7 +54,7 @@ var VERSION;
|
|
|
54
54
|
var init_version = __esm({
|
|
55
55
|
"src/version.ts"() {
|
|
56
56
|
"use strict";
|
|
57
|
-
VERSION = true ? "0.4.
|
|
57
|
+
VERSION = true ? "0.4.45" : "0.0.0-dev";
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
|
|
@@ -10549,7 +10549,7 @@ import { get as httpsGet } from "https";
|
|
|
10549
10549
|
import { pipeline } from "stream/promises";
|
|
10550
10550
|
function downloadFile(url, dest) {
|
|
10551
10551
|
const tmp = `${dest}.tmp`;
|
|
10552
|
-
return new Promise((
|
|
10552
|
+
return new Promise((resolve41, reject) => {
|
|
10553
10553
|
const follow = (u) => {
|
|
10554
10554
|
httpsGet(u, (res) => {
|
|
10555
10555
|
if (res.statusCode === 301 || res.statusCode === 302) {
|
|
@@ -10566,7 +10566,7 @@ function downloadFile(url, dest) {
|
|
|
10566
10566
|
const file = createWriteStream(tmp);
|
|
10567
10567
|
pipeline(res, file).then(() => {
|
|
10568
10568
|
renameSync(tmp, dest);
|
|
10569
|
-
|
|
10569
|
+
resolve41();
|
|
10570
10570
|
}).catch((err) => {
|
|
10571
10571
|
try {
|
|
10572
10572
|
unlinkSync(tmp);
|
|
@@ -11291,7 +11291,7 @@ function hasNpx() {
|
|
|
11291
11291
|
}
|
|
11292
11292
|
}
|
|
11293
11293
|
function runSkillsAdd(repo) {
|
|
11294
|
-
return new Promise((
|
|
11294
|
+
return new Promise((resolve41, reject) => {
|
|
11295
11295
|
const child = spawn("npx", ["skills", "add", repo, "--all"], {
|
|
11296
11296
|
stdio: "inherit",
|
|
11297
11297
|
timeout: 12e4,
|
|
@@ -11305,7 +11305,7 @@ function runSkillsAdd(repo) {
|
|
|
11305
11305
|
env: { ...process.env, GIT_CLONE_PROTECTION_ACTIVE: "0" }
|
|
11306
11306
|
});
|
|
11307
11307
|
child.on("close", (code, signal) => {
|
|
11308
|
-
if (code === 0)
|
|
11308
|
+
if (code === 0) resolve41();
|
|
11309
11309
|
else if (signal === "SIGINT" || code === 130) process.exit(0);
|
|
11310
11310
|
else reject(new Error(`npx skills add exited with code ${code}`));
|
|
11311
11311
|
});
|
|
@@ -12092,7 +12092,7 @@ function computePeaks(floats, count) {
|
|
|
12092
12092
|
return peaks.map((p) => p / maxPeak);
|
|
12093
12093
|
}
|
|
12094
12094
|
function decodeAudioPeaks(audioPath) {
|
|
12095
|
-
return new Promise((
|
|
12095
|
+
return new Promise((resolve41, reject) => {
|
|
12096
12096
|
const proc = spawn2(
|
|
12097
12097
|
"ffmpeg",
|
|
12098
12098
|
[
|
|
@@ -12125,7 +12125,7 @@ function decodeAudioPeaks(audioPath) {
|
|
|
12125
12125
|
return;
|
|
12126
12126
|
}
|
|
12127
12127
|
const ab = buf.buffer.slice(buf.byteOffset, buf.byteOffset + numSamples * 4);
|
|
12128
|
-
|
|
12128
|
+
resolve41(computePeaks(new Float32Array(ab), PEAK_COUNT));
|
|
12129
12129
|
});
|
|
12130
12130
|
proc.on("error", reject);
|
|
12131
12131
|
});
|
|
@@ -16065,8 +16065,8 @@ var init_custom_element_registry = __esm({
|
|
|
16065
16065
|
} : (element) => element.localName === localName;
|
|
16066
16066
|
registry.set(localName, { Class, check });
|
|
16067
16067
|
if (waiting.has(localName)) {
|
|
16068
|
-
for (const
|
|
16069
|
-
|
|
16068
|
+
for (const resolve41 of waiting.get(localName))
|
|
16069
|
+
resolve41(Class);
|
|
16070
16070
|
waiting.delete(localName);
|
|
16071
16071
|
}
|
|
16072
16072
|
ownerDocument.querySelectorAll(
|
|
@@ -16106,13 +16106,13 @@ var init_custom_element_registry = __esm({
|
|
|
16106
16106
|
*/
|
|
16107
16107
|
whenDefined(localName) {
|
|
16108
16108
|
const { registry, waiting } = this;
|
|
16109
|
-
return new Promise((
|
|
16109
|
+
return new Promise((resolve41) => {
|
|
16110
16110
|
if (registry.has(localName))
|
|
16111
|
-
|
|
16111
|
+
resolve41(registry.get(localName).Class);
|
|
16112
16112
|
else {
|
|
16113
16113
|
if (!waiting.has(localName))
|
|
16114
16114
|
waiting.set(localName, []);
|
|
16115
|
-
waiting.get(localName).push(
|
|
16115
|
+
waiting.get(localName).push(resolve41);
|
|
16116
16116
|
}
|
|
16117
16117
|
});
|
|
16118
16118
|
}
|
|
@@ -21818,12 +21818,12 @@ var require_CSSValueExpression = __commonJS({
|
|
|
21818
21818
|
return false;
|
|
21819
21819
|
}
|
|
21820
21820
|
};
|
|
21821
|
-
CSSOM.CSSValueExpression.prototype._parseJSString = function(token, idx,
|
|
21822
|
-
var endIdx = this._findMatchedIdx(token, idx,
|
|
21821
|
+
CSSOM.CSSValueExpression.prototype._parseJSString = function(token, idx, sep5) {
|
|
21822
|
+
var endIdx = this._findMatchedIdx(token, idx, sep5), text;
|
|
21823
21823
|
if (endIdx === -1) {
|
|
21824
21824
|
return false;
|
|
21825
21825
|
} else {
|
|
21826
|
-
text = token.substring(idx, endIdx +
|
|
21826
|
+
text = token.substring(idx, endIdx + sep5.length);
|
|
21827
21827
|
return {
|
|
21828
21828
|
idx: endIdx,
|
|
21829
21829
|
text
|
|
@@ -21863,15 +21863,15 @@ var require_CSSValueExpression = __commonJS({
|
|
|
21863
21863
|
if (!isLegal) {
|
|
21864
21864
|
return false;
|
|
21865
21865
|
} else {
|
|
21866
|
-
var
|
|
21867
|
-
return this._parseJSString(token, idx,
|
|
21866
|
+
var sep5 = "/";
|
|
21867
|
+
return this._parseJSString(token, idx, sep5);
|
|
21868
21868
|
}
|
|
21869
21869
|
};
|
|
21870
|
-
CSSOM.CSSValueExpression.prototype._findMatchedIdx = function(token, idx,
|
|
21870
|
+
CSSOM.CSSValueExpression.prototype._findMatchedIdx = function(token, idx, sep5) {
|
|
21871
21871
|
var startIdx = idx, endIdx;
|
|
21872
21872
|
var NOT_FOUND = -1;
|
|
21873
21873
|
while (true) {
|
|
21874
|
-
endIdx = token.indexOf(
|
|
21874
|
+
endIdx = token.indexOf(sep5, startIdx + 1);
|
|
21875
21875
|
if (endIdx === -1) {
|
|
21876
21876
|
endIdx = NOT_FOUND;
|
|
21877
21877
|
break;
|
|
@@ -26487,10 +26487,10 @@ async function waitForCloseWithTimeout(promise) {
|
|
|
26487
26487
|
() => void 0,
|
|
26488
26488
|
() => void 0
|
|
26489
26489
|
),
|
|
26490
|
-
new Promise((
|
|
26490
|
+
new Promise((resolve41) => {
|
|
26491
26491
|
timer = setTimeout(() => {
|
|
26492
26492
|
timedOut = true;
|
|
26493
|
-
|
|
26493
|
+
resolve41();
|
|
26494
26494
|
}, CAPTURE_SESSION_CLOSE_TIMEOUT_MS);
|
|
26495
26495
|
})
|
|
26496
26496
|
]);
|
|
@@ -26579,7 +26579,7 @@ async function pollPageExpression(page, expression, timeoutMs, intervalMs = 100)
|
|
|
26579
26579
|
while (Date.now() < deadline) {
|
|
26580
26580
|
const ready = Boolean(await page.evaluate(expression));
|
|
26581
26581
|
if (ready) return true;
|
|
26582
|
-
await new Promise((
|
|
26582
|
+
await new Promise((resolve41) => setTimeout(resolve41, intervalMs));
|
|
26583
26583
|
}
|
|
26584
26584
|
return Boolean(await page.evaluate(expression));
|
|
26585
26585
|
}
|
|
@@ -26613,7 +26613,7 @@ async function waitForOptionalTailwindReady(page, timeoutMs) {
|
|
|
26613
26613
|
page.evaluate(
|
|
26614
26614
|
`Promise.resolve(window.__tailwindReady).then(() => true, () => false)`
|
|
26615
26615
|
),
|
|
26616
|
-
new Promise((
|
|
26616
|
+
new Promise((resolve41) => setTimeout(() => resolve41(false), timeoutMs))
|
|
26617
26617
|
]);
|
|
26618
26618
|
if (!ready) {
|
|
26619
26619
|
throw new Error(
|
|
@@ -26668,12 +26668,12 @@ async function initializeSession(session) {
|
|
|
26668
26668
|
const skipIdsLiteral = JSON.stringify(session.options.skipReadinessVideoIds ?? []);
|
|
26669
26669
|
const videosReady = await pollPageExpression(
|
|
26670
26670
|
page,
|
|
26671
|
-
`(() => { const skip = new Set(${skipIdsLiteral}); const vids = Array.from(document.querySelectorAll("video")).filter(v => !skip.has(v.id)); return vids.length === 0 || vids.every(v => v.readyState >=
|
|
26671
|
+
`(() => { const skip = new Set(${skipIdsLiteral}); const vids = Array.from(document.querySelectorAll("video")).filter(v => !skip.has(v.id)); return vids.length === 0 || vids.every(v => v.readyState >= 2); })()`,
|
|
26672
26672
|
pageReadyTimeout2
|
|
26673
26673
|
);
|
|
26674
26674
|
if (!videosReady) {
|
|
26675
26675
|
throw new Error(
|
|
26676
|
-
`[FrameCapture] video
|
|
26676
|
+
`[FrameCapture] video first frame not decoded after ${pageReadyTimeout2}ms. Video elements must reach readyState >= 2 (HAVE_CURRENT_DATA) before capture starts.`
|
|
26677
26677
|
);
|
|
26678
26678
|
}
|
|
26679
26679
|
await page.evaluate(`document.fonts?.ready`);
|
|
@@ -26737,7 +26737,7 @@ async function initializeSession(session) {
|
|
|
26737
26737
|
const videoDeadline = Date.now() + (session.config?.playerReadyTimeout ?? DEFAULT_CONFIG2.playerReadyTimeout);
|
|
26738
26738
|
while (Date.now() < videoDeadline) {
|
|
26739
26739
|
const videosReady = await page.evaluate(
|
|
26740
|
-
`(() => { const skip = new Set(${beginframeSkipIdsLiteral}); const vids = Array.from(document.querySelectorAll("video")).filter(v => !skip.has(v.id)); return vids.length === 0 || vids.every(v => v.readyState >=
|
|
26740
|
+
`(() => { const skip = new Set(${beginframeSkipIdsLiteral}); const vids = Array.from(document.querySelectorAll("video")).filter(v => !skip.has(v.id)); return vids.length === 0 || vids.every(v => v.readyState >= 2); })()`
|
|
26741
26741
|
);
|
|
26742
26742
|
if (videosReady) break;
|
|
26743
26743
|
await new Promise((r2) => setTimeout(r2, 100));
|
|
@@ -26931,7 +26931,7 @@ var init_frameCapture = __esm({
|
|
|
26931
26931
|
// ../engine/src/utils/gpuEncoder.ts
|
|
26932
26932
|
import { spawn as spawn3 } from "child_process";
|
|
26933
26933
|
async function detectGpuEncoder() {
|
|
26934
|
-
return new Promise((
|
|
26934
|
+
return new Promise((resolve41) => {
|
|
26935
26935
|
const ffmpeg = spawn3("ffmpeg", ["-encoders"], {
|
|
26936
26936
|
stdio: ["pipe", "pipe", "pipe"]
|
|
26937
26937
|
});
|
|
@@ -26940,13 +26940,13 @@ async function detectGpuEncoder() {
|
|
|
26940
26940
|
stdout2 += data.toString();
|
|
26941
26941
|
});
|
|
26942
26942
|
ffmpeg.on("close", () => {
|
|
26943
|
-
if (stdout2.includes("h264_nvenc"))
|
|
26944
|
-
else if (stdout2.includes("h264_videotoolbox"))
|
|
26945
|
-
else if (stdout2.includes("h264_vaapi"))
|
|
26946
|
-
else if (stdout2.includes("h264_qsv"))
|
|
26947
|
-
else
|
|
26943
|
+
if (stdout2.includes("h264_nvenc")) resolve41("nvenc");
|
|
26944
|
+
else if (stdout2.includes("h264_videotoolbox")) resolve41("videotoolbox");
|
|
26945
|
+
else if (stdout2.includes("h264_vaapi")) resolve41("vaapi");
|
|
26946
|
+
else if (stdout2.includes("h264_qsv")) resolve41("qsv");
|
|
26947
|
+
else resolve41(null);
|
|
26948
26948
|
});
|
|
26949
|
-
ffmpeg.on("error", () =>
|
|
26949
|
+
ffmpeg.on("error", () => resolve41(null));
|
|
26950
26950
|
});
|
|
26951
26951
|
}
|
|
26952
26952
|
async function getCachedGpuEncoder() {
|
|
@@ -27067,7 +27067,7 @@ async function runFfmpeg(args, opts) {
|
|
|
27067
27067
|
const signal = opts?.signal;
|
|
27068
27068
|
const timeout = opts?.timeout ?? DEFAULT_TIMEOUT;
|
|
27069
27069
|
const onStderr = opts?.onStderr;
|
|
27070
|
-
return new Promise((
|
|
27070
|
+
return new Promise((resolve41) => {
|
|
27071
27071
|
const ffmpeg = spawn4("ffmpeg", args);
|
|
27072
27072
|
let stderr = "";
|
|
27073
27073
|
const onAbort = () => {
|
|
@@ -27093,7 +27093,7 @@ async function runFfmpeg(args, opts) {
|
|
|
27093
27093
|
ffmpeg.on("close", (code) => {
|
|
27094
27094
|
clearTimeout(timer);
|
|
27095
27095
|
if (signal) signal.removeEventListener("abort", onAbort);
|
|
27096
|
-
|
|
27096
|
+
resolve41({
|
|
27097
27097
|
success: !signal?.aborted && code === 0,
|
|
27098
27098
|
exitCode: code,
|
|
27099
27099
|
stderr,
|
|
@@ -27103,7 +27103,7 @@ async function runFfmpeg(args, opts) {
|
|
|
27103
27103
|
ffmpeg.on("error", (err) => {
|
|
27104
27104
|
clearTimeout(timer);
|
|
27105
27105
|
if (signal) signal.removeEventListener("abort", onAbort);
|
|
27106
|
-
|
|
27106
|
+
resolve41({
|
|
27107
27107
|
success: false,
|
|
27108
27108
|
exitCode: null,
|
|
27109
27109
|
stderr: err.message,
|
|
@@ -27202,11 +27202,20 @@ function buildEncoderArgs(options, inputArgs, outputPath, gpuEncoder = null) {
|
|
|
27202
27202
|
else args.push("-global_quality", String(quality));
|
|
27203
27203
|
break;
|
|
27204
27204
|
}
|
|
27205
|
+
if (codec === "h264" && (gpuEncoder === "nvenc" || gpuEncoder === "qsv" || gpuEncoder === "vaapi")) {
|
|
27206
|
+
args.push("-bf", "0");
|
|
27207
|
+
if (gpuEncoder === "qsv") {
|
|
27208
|
+
args.push("-b_strategy", "0");
|
|
27209
|
+
}
|
|
27210
|
+
}
|
|
27205
27211
|
} else {
|
|
27206
27212
|
const encoderName = codec === "h264" ? "libx264" : "libx265";
|
|
27207
27213
|
args.push("-c:v", encoderName, "-preset", preset);
|
|
27208
27214
|
if (bitrate) args.push("-b:v", bitrate);
|
|
27209
27215
|
else args.push("-crf", String(quality));
|
|
27216
|
+
if (codec === "h264") {
|
|
27217
|
+
args.push("-bf", "0");
|
|
27218
|
+
}
|
|
27210
27219
|
const xParamsFlag = codec === "h264" ? "-x264-params" : "-x265-params";
|
|
27211
27220
|
const colorParams = codec === "h265" && options.hdr ? getHdrEncoderColorParams(options.hdr.transfer).x265ColorParams : "colorprim=bt709:transfer=bt709:colormatrix=bt709";
|
|
27212
27221
|
if (preset === "ultrafast") {
|
|
@@ -27269,6 +27278,7 @@ function buildEncoderArgs(options, inputArgs, outputPath, gpuEncoder = null) {
|
|
|
27269
27278
|
if (gpuEncoder !== "vaapi") {
|
|
27270
27279
|
args.push("-pix_fmt", pixelFormat);
|
|
27271
27280
|
}
|
|
27281
|
+
args.push("-avoid_negative_ts", "make_zero");
|
|
27272
27282
|
args.push("-y", outputPath);
|
|
27273
27283
|
return args;
|
|
27274
27284
|
}
|
|
@@ -27295,7 +27305,7 @@ async function encodeFramesFromDir(framesDir, framePattern, outputPath, options,
|
|
|
27295
27305
|
const inputPath = join22(framesDir, framePattern);
|
|
27296
27306
|
const inputArgs = ["-framerate", String(options.fps), "-i", inputPath];
|
|
27297
27307
|
const args = buildEncoderArgs(options, inputArgs, outputPath, gpuEncoder);
|
|
27298
|
-
return new Promise((
|
|
27308
|
+
return new Promise((resolve41) => {
|
|
27299
27309
|
const ffmpeg = spawn5("ffmpeg", args);
|
|
27300
27310
|
let stderr = "";
|
|
27301
27311
|
const onAbort = () => {
|
|
@@ -27320,7 +27330,7 @@ async function encodeFramesFromDir(framesDir, framePattern, outputPath, options,
|
|
|
27320
27330
|
if (signal) signal.removeEventListener("abort", onAbort);
|
|
27321
27331
|
const durationMs = Date.now() - startTime;
|
|
27322
27332
|
if (signal?.aborted) {
|
|
27323
|
-
|
|
27333
|
+
resolve41({
|
|
27324
27334
|
success: false,
|
|
27325
27335
|
outputPath,
|
|
27326
27336
|
durationMs,
|
|
@@ -27331,7 +27341,7 @@ async function encodeFramesFromDir(framesDir, framePattern, outputPath, options,
|
|
|
27331
27341
|
return;
|
|
27332
27342
|
}
|
|
27333
27343
|
if (code !== 0) {
|
|
27334
|
-
|
|
27344
|
+
resolve41({
|
|
27335
27345
|
success: false,
|
|
27336
27346
|
outputPath,
|
|
27337
27347
|
durationMs,
|
|
@@ -27342,12 +27352,12 @@ async function encodeFramesFromDir(framesDir, framePattern, outputPath, options,
|
|
|
27342
27352
|
return;
|
|
27343
27353
|
}
|
|
27344
27354
|
const fileSize = existsSync19(outputPath) ? statSync4(outputPath).size : 0;
|
|
27345
|
-
|
|
27355
|
+
resolve41({ success: true, outputPath, durationMs, framesEncoded: frameCount, fileSize });
|
|
27346
27356
|
});
|
|
27347
27357
|
ffmpeg.on("error", (err) => {
|
|
27348
27358
|
clearTimeout(timer);
|
|
27349
27359
|
if (signal) signal.removeEventListener("abort", onAbort);
|
|
27350
|
-
|
|
27360
|
+
resolve41({
|
|
27351
27361
|
success: false,
|
|
27352
27362
|
outputPath,
|
|
27353
27363
|
durationMs: Date.now() - startTime,
|
|
@@ -27405,18 +27415,18 @@ async function encodeFramesChunkedConcat(framesDir, framePattern, outputPath, op
|
|
|
27405
27415
|
let gpuEncoder = null;
|
|
27406
27416
|
if (options.useGpu) gpuEncoder = await getCachedGpuEncoder();
|
|
27407
27417
|
const args = buildEncoderArgs(options, inputArgs, chunkPath, gpuEncoder);
|
|
27408
|
-
const chunkResult = await new Promise((
|
|
27418
|
+
const chunkResult = await new Promise((resolve41) => {
|
|
27409
27419
|
const ffmpeg = spawn5("ffmpeg", args);
|
|
27410
27420
|
let stderr = "";
|
|
27411
27421
|
ffmpeg.stderr.on("data", (d) => {
|
|
27412
27422
|
stderr += d.toString();
|
|
27413
27423
|
});
|
|
27414
27424
|
ffmpeg.on("close", (code) => {
|
|
27415
|
-
if (code === 0)
|
|
27416
|
-
else
|
|
27425
|
+
if (code === 0) resolve41({ success: true });
|
|
27426
|
+
else resolve41({ success: false, error: `Chunk ${i2} encode failed: ${stderr.slice(-400)}` });
|
|
27417
27427
|
});
|
|
27418
27428
|
ffmpeg.on("error", (err) => {
|
|
27419
|
-
|
|
27429
|
+
resolve41({ success: false, error: `Chunk ${i2} encode error: ${err.message}` });
|
|
27420
27430
|
});
|
|
27421
27431
|
});
|
|
27422
27432
|
if (!chunkResult.success) {
|
|
@@ -27446,18 +27456,18 @@ async function encodeFramesChunkedConcat(framesDir, framePattern, outputPath, op
|
|
|
27446
27456
|
"-y",
|
|
27447
27457
|
outputPath
|
|
27448
27458
|
];
|
|
27449
|
-
const concatResult = await new Promise((
|
|
27459
|
+
const concatResult = await new Promise((resolve41) => {
|
|
27450
27460
|
const ffmpeg = spawn5("ffmpeg", concatArgs);
|
|
27451
27461
|
let stderr = "";
|
|
27452
27462
|
ffmpeg.stderr.on("data", (d) => {
|
|
27453
27463
|
stderr += d.toString();
|
|
27454
27464
|
});
|
|
27455
27465
|
ffmpeg.on("close", (code) => {
|
|
27456
|
-
if (code === 0)
|
|
27457
|
-
else
|
|
27466
|
+
if (code === 0) resolve41({ success: true });
|
|
27467
|
+
else resolve41({ success: false, error: `Chunk concat failed: ${stderr.slice(-400)}` });
|
|
27458
27468
|
});
|
|
27459
27469
|
ffmpeg.on("error", (err) => {
|
|
27460
|
-
|
|
27470
|
+
resolve41({ success: false, error: `Chunk concat error: ${err.message}` });
|
|
27461
27471
|
});
|
|
27462
27472
|
});
|
|
27463
27473
|
if (!concatResult.success) {
|
|
@@ -27492,6 +27502,7 @@ async function muxVideoWithAudio(videoPath, audioPath, outputPath, signal, confi
|
|
|
27492
27502
|
} else {
|
|
27493
27503
|
args.push("-c:a", "aac", "-b:a", "192k", "-movflags", "+faststart");
|
|
27494
27504
|
}
|
|
27505
|
+
args.push("-avoid_negative_ts", "make_zero");
|
|
27495
27506
|
args.push("-shortest", "-y", outputPath);
|
|
27496
27507
|
const processTimeout = config?.ffmpegProcessTimeout ?? DEFAULT_CONFIG2.ffmpegProcessTimeout;
|
|
27497
27508
|
const result = await runFfmpeg(args, { signal, timeout: processTimeout });
|
|
@@ -27557,37 +27568,37 @@ import { dirname as dirname8 } from "path";
|
|
|
27557
27568
|
function createFrameReorderBuffer(startFrame, endFrame) {
|
|
27558
27569
|
let cursor = startFrame;
|
|
27559
27570
|
const pending = /* @__PURE__ */ new Map();
|
|
27560
|
-
const enqueueAt = (frame,
|
|
27571
|
+
const enqueueAt = (frame, resolve41) => {
|
|
27561
27572
|
const list = pending.get(frame);
|
|
27562
27573
|
if (list === void 0) {
|
|
27563
|
-
pending.set(frame, [
|
|
27574
|
+
pending.set(frame, [resolve41]);
|
|
27564
27575
|
} else {
|
|
27565
|
-
list.push(
|
|
27576
|
+
list.push(resolve41);
|
|
27566
27577
|
}
|
|
27567
27578
|
};
|
|
27568
27579
|
const flushAt = (frame) => {
|
|
27569
27580
|
const list = pending.get(frame);
|
|
27570
27581
|
if (list === void 0) return;
|
|
27571
27582
|
pending.delete(frame);
|
|
27572
|
-
for (const
|
|
27583
|
+
for (const resolve41 of list) resolve41();
|
|
27573
27584
|
};
|
|
27574
|
-
const waitForFrame = (frame) => new Promise((
|
|
27585
|
+
const waitForFrame = (frame) => new Promise((resolve41) => {
|
|
27575
27586
|
if (frame === cursor) {
|
|
27576
|
-
|
|
27587
|
+
resolve41();
|
|
27577
27588
|
return;
|
|
27578
27589
|
}
|
|
27579
|
-
enqueueAt(frame,
|
|
27590
|
+
enqueueAt(frame, resolve41);
|
|
27580
27591
|
});
|
|
27581
27592
|
const advanceTo = (frame) => {
|
|
27582
27593
|
cursor = frame;
|
|
27583
27594
|
flushAt(frame);
|
|
27584
27595
|
};
|
|
27585
|
-
const waitForAllDone = () => new Promise((
|
|
27596
|
+
const waitForAllDone = () => new Promise((resolve41) => {
|
|
27586
27597
|
if (cursor >= endFrame) {
|
|
27587
|
-
|
|
27598
|
+
resolve41();
|
|
27588
27599
|
return;
|
|
27589
27600
|
}
|
|
27590
|
-
enqueueAt(endFrame,
|
|
27601
|
+
enqueueAt(endFrame, resolve41);
|
|
27591
27602
|
});
|
|
27592
27603
|
return { waitForFrame, advanceTo, waitForAllDone };
|
|
27593
27604
|
}
|
|
@@ -27663,11 +27674,20 @@ function buildStreamingArgs(options, outputPath, gpuEncoder = null) {
|
|
|
27663
27674
|
else args.push("-global_quality", String(quality));
|
|
27664
27675
|
break;
|
|
27665
27676
|
}
|
|
27677
|
+
if (codec === "h264" && (gpuEncoder === "nvenc" || gpuEncoder === "qsv" || gpuEncoder === "vaapi")) {
|
|
27678
|
+
args.push("-bf", "0");
|
|
27679
|
+
if (gpuEncoder === "qsv") {
|
|
27680
|
+
args.push("-b_strategy", "0");
|
|
27681
|
+
}
|
|
27682
|
+
}
|
|
27666
27683
|
} else {
|
|
27667
27684
|
const encoderName = codec === "h264" ? "libx264" : "libx265";
|
|
27668
27685
|
args.push("-c:v", encoderName, "-preset", preset);
|
|
27669
27686
|
if (bitrate) args.push("-b:v", bitrate);
|
|
27670
27687
|
else args.push("-crf", String(quality));
|
|
27688
|
+
if (codec === "h264") {
|
|
27689
|
+
args.push("-bf", "0");
|
|
27690
|
+
}
|
|
27671
27691
|
const xParamsFlag = codec === "h264" ? "-x264-params" : "-x265-params";
|
|
27672
27692
|
const colorParams = options.rawInputFormat && options.hdr ? getHdrEncoderColorParams(options.hdr.transfer).x265ColorParams : "colorprim=bt709:transfer=bt709:colormatrix=bt709";
|
|
27673
27693
|
if (preset === "ultrafast") {
|
|
@@ -27730,6 +27750,7 @@ function buildStreamingArgs(options, outputPath, gpuEncoder = null) {
|
|
|
27730
27750
|
if (gpuEncoder !== "vaapi") {
|
|
27731
27751
|
args.push("-pix_fmt", pixelFormat);
|
|
27732
27752
|
}
|
|
27753
|
+
args.push("-avoid_negative_ts", "make_zero");
|
|
27733
27754
|
args.push("-y", outputPath);
|
|
27734
27755
|
return args;
|
|
27735
27756
|
}
|
|
@@ -27749,7 +27770,7 @@ async function spawnStreamingEncoder(outputPath, options, signal, config) {
|
|
|
27749
27770
|
let stderr = "";
|
|
27750
27771
|
let exitCode = null;
|
|
27751
27772
|
let exitPromiseResolve = null;
|
|
27752
|
-
const exitPromise = new Promise((
|
|
27773
|
+
const exitPromise = new Promise((resolve41) => exitPromiseResolve = resolve41);
|
|
27753
27774
|
ffmpeg.stderr?.on("data", (data) => {
|
|
27754
27775
|
stderr += data.toString();
|
|
27755
27776
|
});
|
|
@@ -27795,8 +27816,8 @@ Process error: ${err.message}`;
|
|
|
27795
27816
|
if (signal) signal.removeEventListener("abort", onAbort);
|
|
27796
27817
|
const stdin = ffmpeg.stdin;
|
|
27797
27818
|
if (stdin && !stdin.destroyed) {
|
|
27798
|
-
await new Promise((
|
|
27799
|
-
stdin.end(() =>
|
|
27819
|
+
await new Promise((resolve41) => {
|
|
27820
|
+
stdin.end(() => resolve41());
|
|
27800
27821
|
});
|
|
27801
27822
|
}
|
|
27802
27823
|
await exitPromise;
|
|
@@ -27839,7 +27860,7 @@ import { spawn as spawn7 } from "child_process";
|
|
|
27839
27860
|
import { readFileSync as readFileSync17 } from "fs";
|
|
27840
27861
|
import { extname as extname4 } from "path";
|
|
27841
27862
|
function runFfprobe(args) {
|
|
27842
|
-
return new Promise((
|
|
27863
|
+
return new Promise((resolve41, reject) => {
|
|
27843
27864
|
const proc = spawn7("ffprobe", args);
|
|
27844
27865
|
let stdout2 = "";
|
|
27845
27866
|
let stderr = "";
|
|
@@ -27853,7 +27874,7 @@ function runFfprobe(args) {
|
|
|
27853
27874
|
if (code !== 0) {
|
|
27854
27875
|
reject(new Error(`[FFmpeg] ffprobe exited with code ${code}: ${stderr}`));
|
|
27855
27876
|
} else {
|
|
27856
|
-
|
|
27877
|
+
resolve41(stdout2);
|
|
27857
27878
|
}
|
|
27858
27879
|
});
|
|
27859
27880
|
proc.on("error", (err) => {
|
|
@@ -27935,6 +27956,14 @@ function extractStillImageMetadata(filePath) {
|
|
|
27935
27956
|
return null;
|
|
27936
27957
|
}
|
|
27937
27958
|
}
|
|
27959
|
+
function readTagCI(tags, name) {
|
|
27960
|
+
if (!tags) return "";
|
|
27961
|
+
const target = name.toLowerCase();
|
|
27962
|
+
for (const [key2, value] of Object.entries(tags)) {
|
|
27963
|
+
if (key2.toLowerCase() === target && typeof value === "string") return value;
|
|
27964
|
+
}
|
|
27965
|
+
return "";
|
|
27966
|
+
}
|
|
27938
27967
|
function parseFrameRate(frameRateStr) {
|
|
27939
27968
|
if (!frameRateStr) return 0;
|
|
27940
27969
|
const parts = frameRateStr.split("/");
|
|
@@ -27992,7 +28021,7 @@ async function extractMediaMetadata(filePath) {
|
|
|
27992
28021
|
const ffprobeColorSpace = colorTransfer || colorPrimaries || colorSpaceVal ? { colorTransfer, colorPrimaries, colorSpace: colorSpaceVal } : null;
|
|
27993
28022
|
const colorSpace = ffprobeColorSpace ?? stillImageMeta?.colorSpace ?? null;
|
|
27994
28023
|
const pixelFormat = videoStream.pix_fmt || "";
|
|
27995
|
-
const alphaMode = videoStream.tags
|
|
28024
|
+
const alphaMode = readTagCI(videoStream.tags, "alpha_mode");
|
|
27996
28025
|
const hasAlpha = /(^|[^a-z])yuva|rgba|argb|bgra|gbrap|gray[a-z0-9]*a/i.test(pixelFormat) || alphaMode === "1";
|
|
27997
28026
|
return {
|
|
27998
28027
|
durationSeconds: output?.format.duration ? parseFloat(output.format.duration) : 0,
|
|
@@ -29392,7 +29421,7 @@ var init_extractionCache = __esm({
|
|
|
29392
29421
|
// ../engine/src/services/videoFrameExtractor.ts
|
|
29393
29422
|
import { spawn as spawn8 } from "child_process";
|
|
29394
29423
|
import { existsSync as existsSync24, mkdirSync as mkdirSync15, readdirSync as readdirSync9, rmSync as rmSync5 } from "fs";
|
|
29395
|
-
import { isAbsolute as isAbsolute3, join as join26 } from "path";
|
|
29424
|
+
import { isAbsolute as isAbsolute3, join as join26, posix as posix2, resolve as resolve13, sep as sep3 } from "path";
|
|
29396
29425
|
function parseVideoElements(html) {
|
|
29397
29426
|
const videos = [];
|
|
29398
29427
|
const { document: document2 } = parseHTML(unwrapTemplate(html));
|
|
@@ -29474,8 +29503,8 @@ async function extractVideoFramesRange(videoPath, videoId, startTime, duration,
|
|
|
29474
29503
|
if (isHdr && isMacOS) {
|
|
29475
29504
|
args.push("-hwaccel", "videotoolbox");
|
|
29476
29505
|
}
|
|
29477
|
-
if (metadata.
|
|
29478
|
-
args.push("-c:v",
|
|
29506
|
+
if (codecMayHaveAlpha(metadata.videoCodec)) {
|
|
29507
|
+
args.push("-c:v", decoderForCodec(metadata.videoCodec));
|
|
29479
29508
|
}
|
|
29480
29509
|
args.push("-ss", String(startTime), "-i", videoPath, "-t", String(duration));
|
|
29481
29510
|
const vfFilters = [];
|
|
@@ -29487,7 +29516,7 @@ async function extractVideoFramesRange(videoPath, videoId, startTime, duration,
|
|
|
29487
29516
|
args.push("-q:v", format === "jpg" ? String(Math.ceil((100 - quality) / 3)) : "0");
|
|
29488
29517
|
if (format === "png") args.push("-compression_level", "6");
|
|
29489
29518
|
args.push("-y", outputPattern);
|
|
29490
|
-
return new Promise((
|
|
29519
|
+
return new Promise((resolve41, reject) => {
|
|
29491
29520
|
const ffmpeg = spawn8("ffmpeg", args);
|
|
29492
29521
|
let stderr = "";
|
|
29493
29522
|
const onAbort = () => {
|
|
@@ -29522,7 +29551,7 @@ async function extractVideoFramesRange(videoPath, videoId, startTime, duration,
|
|
|
29522
29551
|
files.forEach((file, index) => {
|
|
29523
29552
|
framePaths.set(index, join26(videoOutputDir, file));
|
|
29524
29553
|
});
|
|
29525
|
-
|
|
29554
|
+
resolve41({
|
|
29526
29555
|
videoId,
|
|
29527
29556
|
srcPath: videoPath,
|
|
29528
29557
|
outputDir: videoOutputDir,
|
|
@@ -29588,9 +29617,19 @@ function resolveSegmentDuration(requested, mediaStart, metadata) {
|
|
|
29588
29617
|
const sourceRemaining = metadata.durationSeconds - mediaStart;
|
|
29589
29618
|
return sourceRemaining > 0 ? sourceRemaining : metadata.durationSeconds;
|
|
29590
29619
|
}
|
|
29620
|
+
function codecMayHaveAlpha(codec) {
|
|
29621
|
+
return ALPHA_CAPABLE_CODECS.has((codec ?? "").toLowerCase());
|
|
29622
|
+
}
|
|
29623
|
+
function decoderForCodec(codec) {
|
|
29624
|
+
const c2 = (codec ?? "").toLowerCase();
|
|
29625
|
+
if (c2 === "vp9") return "libvpx-vp9";
|
|
29626
|
+
if (c2 === "vp8") return "libvpx";
|
|
29627
|
+
return c2;
|
|
29628
|
+
}
|
|
29591
29629
|
function resolveFrameFormat(metadata, requested) {
|
|
29592
29630
|
if (requested) return requested;
|
|
29593
|
-
|
|
29631
|
+
if (metadata.hasAlpha || codecMayHaveAlpha(metadata.videoCodec)) return "png";
|
|
29632
|
+
return "jpg";
|
|
29594
29633
|
}
|
|
29595
29634
|
async function convertVfrToCfr(inputPath, outputPath, targetFps, startTime, duration, signal, config) {
|
|
29596
29635
|
const timeout = config?.ffmpegProcessTimeout ?? DEFAULT_CONFIG2.ffmpegProcessTimeout;
|
|
@@ -29623,6 +29662,24 @@ async function convertVfrToCfr(inputPath, outputPath, targetFps, startTime, dura
|
|
|
29623
29662
|
);
|
|
29624
29663
|
}
|
|
29625
29664
|
}
|
|
29665
|
+
function resolveProjectRelativeSrc(src, baseDir, compiledDir) {
|
|
29666
|
+
const fromCompiled = compiledDir ? join26(compiledDir, src) : null;
|
|
29667
|
+
const fromBase = join26(baseDir, src);
|
|
29668
|
+
const candidates = [];
|
|
29669
|
+
if (fromCompiled) candidates.push(fromCompiled);
|
|
29670
|
+
candidates.push(fromBase);
|
|
29671
|
+
const baseAbs = resolve13(baseDir);
|
|
29672
|
+
const fromBaseAbs = resolve13(fromBase);
|
|
29673
|
+
if (!fromBaseAbs.startsWith(baseAbs + sep3) && fromBaseAbs !== baseAbs) {
|
|
29674
|
+
const normalized = posix2.normalize(src.replace(/\\/g, "/"));
|
|
29675
|
+
const stripped = normalized.replace(/^(\.\.\/)+/, "");
|
|
29676
|
+
if (stripped && stripped !== src && !stripped.startsWith("..")) {
|
|
29677
|
+
if (compiledDir) candidates.push(join26(compiledDir, stripped));
|
|
29678
|
+
candidates.push(join26(baseDir, stripped));
|
|
29679
|
+
}
|
|
29680
|
+
}
|
|
29681
|
+
return candidates.find(existsSync24) ?? fromBase;
|
|
29682
|
+
}
|
|
29626
29683
|
async function extractAllVideoFrames(videos, baseDir, options, signal, config, compiledDir) {
|
|
29627
29684
|
const startTime = Date.now();
|
|
29628
29685
|
const extracted = [];
|
|
@@ -29642,13 +29699,13 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
|
|
|
29642
29699
|
};
|
|
29643
29700
|
const phase1Start = Date.now();
|
|
29644
29701
|
const resolvedVideos = [];
|
|
29702
|
+
const warnedSrcs = /* @__PURE__ */ new Set();
|
|
29645
29703
|
for (const video of videos) {
|
|
29646
29704
|
if (signal?.aborted) break;
|
|
29647
29705
|
try {
|
|
29648
29706
|
let videoPath = video.src;
|
|
29649
29707
|
if (!isAbsolute3(videoPath) && !isHttpUrl(videoPath)) {
|
|
29650
|
-
|
|
29651
|
-
videoPath = fromCompiled && existsSync24(fromCompiled) ? fromCompiled : join26(baseDir, videoPath);
|
|
29708
|
+
videoPath = resolveProjectRelativeSrc(video.src, baseDir, compiledDir);
|
|
29652
29709
|
}
|
|
29653
29710
|
if (isHttpUrl(videoPath)) {
|
|
29654
29711
|
const downloadDir = join26(options.outputDir, "_downloads");
|
|
@@ -29656,6 +29713,13 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
|
|
|
29656
29713
|
videoPath = await downloadToTemp(videoPath, downloadDir);
|
|
29657
29714
|
}
|
|
29658
29715
|
if (!existsSync24(videoPath)) {
|
|
29716
|
+
if (!warnedSrcs.has(video.src)) {
|
|
29717
|
+
warnedSrcs.add(video.src);
|
|
29718
|
+
process.stderr.write(
|
|
29719
|
+
`[hyperframes:render] WARNING: video src="${video.src}" could not be resolved on disk (looked for ${videoPath}). The rendered output will show this video's first frame for the entire clip duration. If your <video> lives inside a sub-composition, prefer project-root-relative paths (e.g. src="assets/foo.mp4") over "../assets/foo.mp4".
|
|
29720
|
+
`
|
|
29721
|
+
);
|
|
29722
|
+
}
|
|
29659
29723
|
errors.push({ videoId: video.id, error: `Video file not found: ${videoPath}` });
|
|
29660
29724
|
continue;
|
|
29661
29725
|
}
|
|
@@ -29909,7 +29973,7 @@ function createFrameLookupTable(videos, extracted) {
|
|
|
29909
29973
|
}
|
|
29910
29974
|
return table;
|
|
29911
29975
|
}
|
|
29912
|
-
var FrameLookupTable;
|
|
29976
|
+
var ALPHA_CAPABLE_CODECS, FrameLookupTable;
|
|
29913
29977
|
var init_videoFrameExtractor = __esm({
|
|
29914
29978
|
"../engine/src/services/videoFrameExtractor.ts"() {
|
|
29915
29979
|
"use strict";
|
|
@@ -29921,6 +29985,7 @@ var init_videoFrameExtractor = __esm({
|
|
|
29921
29985
|
init_config2();
|
|
29922
29986
|
init_htmlTemplate();
|
|
29923
29987
|
init_extractionCache();
|
|
29988
|
+
ALPHA_CAPABLE_CODECS = /* @__PURE__ */ new Set(["vp9", "vp8", "prores"]);
|
|
29924
29989
|
FrameLookupTable = class {
|
|
29925
29990
|
videos = /* @__PURE__ */ new Map();
|
|
29926
29991
|
orderedVideos = [];
|
|
@@ -30583,8 +30648,7 @@ async function processCompositionAudio(elements, baseDir, workDir, outputPath, t
|
|
|
30583
30648
|
try {
|
|
30584
30649
|
let srcPath = element.src;
|
|
30585
30650
|
if (!isAbsolute4(srcPath) && !isHttpUrl(srcPath)) {
|
|
30586
|
-
|
|
30587
|
-
srcPath = fromCompiled && existsSync25(fromCompiled) ? fromCompiled : join27(baseDir, srcPath);
|
|
30651
|
+
srcPath = resolveProjectRelativeSrc(element.src, baseDir, compiledDir);
|
|
30588
30652
|
}
|
|
30589
30653
|
if (isHttpUrl(srcPath)) {
|
|
30590
30654
|
try {
|
|
@@ -30673,6 +30737,7 @@ var init_audioMixer = __esm({
|
|
|
30673
30737
|
init_config2();
|
|
30674
30738
|
init_runFfmpeg();
|
|
30675
30739
|
init_htmlTemplate();
|
|
30740
|
+
init_videoFrameExtractor();
|
|
30676
30741
|
}
|
|
30677
30742
|
});
|
|
30678
30743
|
|
|
@@ -30907,11 +30972,11 @@ function createFileServer(options) {
|
|
|
30907
30972
|
headers: { "Content-Type": contentType }
|
|
30908
30973
|
});
|
|
30909
30974
|
});
|
|
30910
|
-
return new Promise((
|
|
30975
|
+
return new Promise((resolve41) => {
|
|
30911
30976
|
const server = serve({ fetch: app.fetch, port }, (info) => {
|
|
30912
30977
|
const actualPort = info.port;
|
|
30913
30978
|
const url = `http://localhost:${actualPort}`;
|
|
30914
|
-
|
|
30979
|
+
resolve41({
|
|
30915
30980
|
url,
|
|
30916
30981
|
port: actualPort,
|
|
30917
30982
|
close: () => server.close()
|
|
@@ -32495,6 +32560,7 @@ __export(src_exports2, {
|
|
|
32495
32560
|
resampleRgb48leObjectFit: () => resampleRgb48leObjectFit,
|
|
32496
32561
|
resolveConfig: () => resolveConfig,
|
|
32497
32562
|
resolveHeadlessShellPath: () => resolveHeadlessShellPath,
|
|
32563
|
+
resolveProjectRelativeSrc: () => resolveProjectRelativeSrc,
|
|
32498
32564
|
roundedRectAlpha: () => roundedRectAlpha,
|
|
32499
32565
|
runFfmpeg: () => runFfmpeg,
|
|
32500
32566
|
sampleRgb48le: () => sampleRgb48le,
|
|
@@ -32534,7 +32600,7 @@ var init_src2 = __esm({
|
|
|
32534
32600
|
// ../producer/src/services/hyperframeRuntimeLoader.ts
|
|
32535
32601
|
import { createHash as createHash3 } from "crypto";
|
|
32536
32602
|
import { existsSync as existsSync29, readFileSync as readFileSync20 } from "fs";
|
|
32537
|
-
import { dirname as dirname10, resolve as
|
|
32603
|
+
import { dirname as dirname10, resolve as resolve14 } from "path";
|
|
32538
32604
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
32539
32605
|
function resolveHyperframeManifestPath() {
|
|
32540
32606
|
if (process.env.PRODUCER_HYPERFRAME_MANIFEST_PATH) {
|
|
@@ -32570,7 +32636,7 @@ function resolveVerifiedHyperframeRuntime() {
|
|
|
32570
32636
|
`[HyperframeRuntimeLoader] Invalid manifest at ${manifestPath}; missing iife artifact or sha256.`
|
|
32571
32637
|
);
|
|
32572
32638
|
}
|
|
32573
|
-
const runtimePath =
|
|
32639
|
+
const runtimePath = resolve14(dirname10(manifestPath), runtimeFileName);
|
|
32574
32640
|
if (!existsSync29(runtimePath)) {
|
|
32575
32641
|
throw new Error(`[HyperframeRuntimeLoader] Missing runtime artifact at ${runtimePath}.`);
|
|
32576
32642
|
}
|
|
@@ -32594,18 +32660,18 @@ var init_hyperframeRuntimeLoader = __esm({
|
|
|
32594
32660
|
"../producer/src/services/hyperframeRuntimeLoader.ts"() {
|
|
32595
32661
|
"use strict";
|
|
32596
32662
|
PRODUCER_DIR = dirname10(fileURLToPath2(import.meta.url));
|
|
32597
|
-
SIBLING_MANIFEST_PATH =
|
|
32598
|
-
MODULE_RELATIVE_MANIFEST_PATH =
|
|
32663
|
+
SIBLING_MANIFEST_PATH = resolve14(PRODUCER_DIR, "hyperframe.manifest.json");
|
|
32664
|
+
MODULE_RELATIVE_MANIFEST_PATH = resolve14(
|
|
32599
32665
|
PRODUCER_DIR,
|
|
32600
32666
|
"../../../core/dist/hyperframe.manifest.json"
|
|
32601
32667
|
);
|
|
32602
32668
|
CWD_RELATIVE_MANIFEST_PATHS = [
|
|
32603
32669
|
// When bundled to a single file (dist/public-server.js), the manifest
|
|
32604
32670
|
// is copied as a sibling by build.mjs
|
|
32605
|
-
|
|
32606
|
-
|
|
32607
|
-
|
|
32608
|
-
|
|
32671
|
+
resolve14(PRODUCER_DIR, "hyperframe.manifest.json"),
|
|
32672
|
+
resolve14(process.cwd(), "packages/core/dist/hyperframe.manifest.json"),
|
|
32673
|
+
resolve14(process.cwd(), "../core/dist/hyperframe.manifest.json"),
|
|
32674
|
+
resolve14(process.cwd(), "core/dist/hyperframe.manifest.json")
|
|
32609
32675
|
];
|
|
32610
32676
|
}
|
|
32611
32677
|
});
|
|
@@ -32614,11 +32680,11 @@ var init_hyperframeRuntimeLoader = __esm({
|
|
|
32614
32680
|
import { Hono as Hono3 } from "hono";
|
|
32615
32681
|
import { serve as serve2 } from "@hono/node-server";
|
|
32616
32682
|
import { readFileSync as readFileSync21, existsSync as existsSync30, realpathSync, statSync as statSync8 } from "fs";
|
|
32617
|
-
import { join as join31, extname as extname7, resolve as
|
|
32683
|
+
import { join as join31, extname as extname7, resolve as resolve15, sep as sep4 } from "path";
|
|
32618
32684
|
function isPathInside(child, parent, options = {}) {
|
|
32619
32685
|
const { resolveSymlinks = false, pathModule } = options;
|
|
32620
|
-
const resolveFn = pathModule?.resolve ??
|
|
32621
|
-
const separator = pathModule?.sep ??
|
|
32686
|
+
const resolveFn = pathModule?.resolve ?? resolve15;
|
|
32687
|
+
const separator = pathModule?.sep ?? sep4;
|
|
32622
32688
|
const resolvedChild = resolveFn(child);
|
|
32623
32689
|
const resolvedParent = resolveFn(parent);
|
|
32624
32690
|
const normalizedChild = resolveSymlinks && existsSync30(resolvedChild) ? realpathSync.native(resolvedChild) : resolvedChild;
|
|
@@ -32680,10 +32746,10 @@ function createFileServer2(options) {
|
|
|
32680
32746
|
headers: { "Content-Type": contentType }
|
|
32681
32747
|
});
|
|
32682
32748
|
});
|
|
32683
|
-
return new Promise((
|
|
32749
|
+
return new Promise((resolve41) => {
|
|
32684
32750
|
const connections = /* @__PURE__ */ new Set();
|
|
32685
32751
|
const server = serve2({ fetch: app.fetch, port }, (info) => {
|
|
32686
|
-
|
|
32752
|
+
resolve41({
|
|
32687
32753
|
url: `http://localhost:${info.port}`,
|
|
32688
32754
|
port: info.port,
|
|
32689
32755
|
close: () => {
|
|
@@ -33469,7 +33535,7 @@ var init_deterministicFonts = __esm({
|
|
|
33469
33535
|
|
|
33470
33536
|
// ../producer/src/services/htmlCompiler.ts
|
|
33471
33537
|
import { readFileSync as readFileSync23, existsSync as existsSync32, mkdirSync as mkdirSync19 } from "fs";
|
|
33472
|
-
import { join as join34, dirname as dirname11, resolve as
|
|
33538
|
+
import { join as join34, dirname as dirname11, resolve as resolve16 } from "path";
|
|
33473
33539
|
function dedupeElementsById(elements) {
|
|
33474
33540
|
const deduped = /* @__PURE__ */ new Map();
|
|
33475
33541
|
for (const element of elements) {
|
|
@@ -33613,7 +33679,7 @@ async function parseSubCompositions(html, projectDir, downloadDir, parentOffset
|
|
|
33613
33679
|
const elEnd = elEndRaw ? parseFloat(elEndRaw) : Infinity;
|
|
33614
33680
|
const absoluteStart = parentOffset + elStart;
|
|
33615
33681
|
const absoluteEnd = Math.min(parentEnd, isFinite(elEnd) ? parentOffset + elEnd : Infinity);
|
|
33616
|
-
const filePath =
|
|
33682
|
+
const filePath = resolve16(projectDir, srcPath);
|
|
33617
33683
|
if (visited.has(filePath)) {
|
|
33618
33684
|
continue;
|
|
33619
33685
|
}
|
|
@@ -33805,7 +33871,7 @@ function inlineSubCompositions(html, subCompositions, projectDir) {
|
|
|
33805
33871
|
if (!srcPath) continue;
|
|
33806
33872
|
let compHtml = subCompositions.get(srcPath) || null;
|
|
33807
33873
|
if (!compHtml) {
|
|
33808
|
-
const filePath =
|
|
33874
|
+
const filePath = resolve16(projectDir, srcPath);
|
|
33809
33875
|
if (existsSync32(filePath)) {
|
|
33810
33876
|
compHtml = readFileSync23(filePath, "utf-8");
|
|
33811
33877
|
}
|
|
@@ -33996,7 +34062,7 @@ ${safeText}
|
|
|
33996
34062
|
return wrappedFragment ? document2.body.innerHTML || "" : document2.toString();
|
|
33997
34063
|
}
|
|
33998
34064
|
function collectExternalAssets(html, projectDir) {
|
|
33999
|
-
const absProjectDir =
|
|
34065
|
+
const absProjectDir = resolve16(projectDir);
|
|
34000
34066
|
const externalAssets = /* @__PURE__ */ new Map();
|
|
34001
34067
|
const CSS_URL_RE2 = /\burl\(\s*(["']?)([^)"']+)\1\s*\)/g;
|
|
34002
34068
|
function processPath(rawPath) {
|
|
@@ -34004,7 +34070,7 @@ function collectExternalAssets(html, projectDir) {
|
|
|
34004
34070
|
if (!trimmed || trimmed.startsWith("/") || trimmed.startsWith("http://") || trimmed.startsWith("https://") || trimmed.startsWith("//") || trimmed.startsWith("data:") || trimmed.startsWith("#")) {
|
|
34005
34071
|
return null;
|
|
34006
34072
|
}
|
|
34007
|
-
const absPath =
|
|
34073
|
+
const absPath = resolve16(absProjectDir, trimmed);
|
|
34008
34074
|
if (isPathInside2(absPath, absProjectDir)) {
|
|
34009
34075
|
return null;
|
|
34010
34076
|
}
|
|
@@ -34086,7 +34152,7 @@ async function compileForRender(projectDir, htmlPath, downloadDir) {
|
|
|
34086
34152
|
const images = dedupeElementsById([...mainImages, ...subImages]);
|
|
34087
34153
|
for (const video of videos) {
|
|
34088
34154
|
if (isHttpUrl(video.src)) continue;
|
|
34089
|
-
const videoPath =
|
|
34155
|
+
const videoPath = resolve16(projectDir, video.src);
|
|
34090
34156
|
const reencode = `ffmpeg -i "${video.src}" -c:v libx264 -r 30 -g 30 -keyint_min 30 -movflags +faststart -c:a copy output.mp4`;
|
|
34091
34157
|
Promise.all([analyzeKeyframeIntervals(videoPath), extractMediaMetadata(videoPath)]).then(([analysis, metadata]) => {
|
|
34092
34158
|
if (analysis.isProblematic) {
|
|
@@ -34373,7 +34439,7 @@ import {
|
|
|
34373
34439
|
appendFileSync,
|
|
34374
34440
|
symlinkSync
|
|
34375
34441
|
} from "fs";
|
|
34376
|
-
import { join as join35, dirname as dirname12, resolve as
|
|
34442
|
+
import { join as join35, dirname as dirname12, resolve as resolve17, relative as relative2, isAbsolute as isAbsolute5, basename as basename3 } from "path";
|
|
34377
34443
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
34378
34444
|
import { freemem as freemem2 } from "os";
|
|
34379
34445
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
@@ -34571,7 +34637,7 @@ function writeCompiledArtifacts(compiled, workDir, includeSummary) {
|
|
|
34571
34637
|
writeFileSync15(outPath, html, "utf-8");
|
|
34572
34638
|
}
|
|
34573
34639
|
for (const [relativePath, absolutePath] of compiled.externalAssets) {
|
|
34574
|
-
const outPath =
|
|
34640
|
+
const outPath = resolve17(join35(compileDir, relativePath));
|
|
34575
34641
|
if (!isPathInside2(outPath, compileDir)) {
|
|
34576
34642
|
console.warn(`[Render] Skipping external asset with unsafe path: ${relativePath}`);
|
|
34577
34643
|
continue;
|
|
@@ -34606,9 +34672,9 @@ function writeCompiledArtifacts(compiled, workDir, includeSummary) {
|
|
|
34606
34672
|
}
|
|
34607
34673
|
}
|
|
34608
34674
|
function createCompiledFrameSrcResolver(compiledDir) {
|
|
34609
|
-
const compiledRoot =
|
|
34675
|
+
const compiledRoot = resolve17(compiledDir);
|
|
34610
34676
|
return (framePath) => {
|
|
34611
|
-
const resolvedFramePath =
|
|
34677
|
+
const resolvedFramePath = resolve17(framePath);
|
|
34612
34678
|
if (!isPathInside2(resolvedFramePath, compiledRoot)) return null;
|
|
34613
34679
|
const relativePath = relative2(compiledRoot, resolvedFramePath);
|
|
34614
34680
|
if (!relativePath || relativePath.startsWith("..") || isAbsolute5(relativePath)) {
|
|
@@ -35382,7 +35448,7 @@ function extractStandaloneEntryFromIndex(indexHtml, entryFile) {
|
|
|
35382
35448
|
}
|
|
35383
35449
|
async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSignal) {
|
|
35384
35450
|
const moduleDir = dirname12(fileURLToPath3(import.meta.url));
|
|
35385
|
-
const producerRoot = process.env.PRODUCER_RENDERS_DIR ?
|
|
35451
|
+
const producerRoot = process.env.PRODUCER_RENDERS_DIR ? resolve17(process.env.PRODUCER_RENDERS_DIR, "..") : resolve17(moduleDir, "../..");
|
|
35386
35452
|
const debugDir = join35(producerRoot, ".debug");
|
|
35387
35453
|
const workDir = job.config.debug ? join35(debugDir, job.id) : join35(dirname12(outputPath), `work-${job.id}`);
|
|
35388
35454
|
const pipelineStart = Date.now();
|
|
@@ -35709,11 +35775,7 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
|
|
|
35709
35775
|
if (job.config.hdrMode !== "force-sdr" && composition.videos.length > 0) {
|
|
35710
35776
|
await Promise.all(
|
|
35711
35777
|
composition.videos.map(async (v) => {
|
|
35712
|
-
|
|
35713
|
-
if (!videoPath.startsWith("/")) {
|
|
35714
|
-
const fromCompiled = existsSync33(join35(compiledDir, videoPath)) ? join35(compiledDir, videoPath) : join35(projectDir, videoPath);
|
|
35715
|
-
videoPath = fromCompiled;
|
|
35716
|
-
}
|
|
35778
|
+
const videoPath = isAbsolute5(v.src) ? v.src : resolveProjectRelativeSrc(v.src, projectDir, compiledDir);
|
|
35717
35779
|
if (!existsSync33(videoPath)) return;
|
|
35718
35780
|
const meta = await extractMediaMetadata(videoPath);
|
|
35719
35781
|
if (isHdrColorSpace(meta.colorSpace)) {
|
|
@@ -37021,7 +37083,7 @@ var init_renderOrchestrator = __esm({
|
|
|
37021
37083
|
};
|
|
37022
37084
|
BROWSER_MEDIA_EPSILON = 1e-4;
|
|
37023
37085
|
materializePathModule = {
|
|
37024
|
-
resolve:
|
|
37086
|
+
resolve: resolve17,
|
|
37025
37087
|
join: join35,
|
|
37026
37088
|
dirname: dirname12,
|
|
37027
37089
|
basename: basename3,
|
|
@@ -37065,7 +37127,7 @@ var init_config3 = __esm({
|
|
|
37065
37127
|
|
|
37066
37128
|
// ../producer/src/services/hyperframeLint.ts
|
|
37067
37129
|
import { existsSync as existsSync34, readFileSync as readFileSync25, statSync as statSync10 } from "fs";
|
|
37068
|
-
import { resolve as
|
|
37130
|
+
import { resolve as resolve18, join as join36 } from "path";
|
|
37069
37131
|
function isStringRecord(value) {
|
|
37070
37132
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
37071
37133
|
return false;
|
|
@@ -37092,7 +37154,7 @@ function pickEntryFile(files, preferredEntryFile) {
|
|
|
37092
37154
|
return null;
|
|
37093
37155
|
}
|
|
37094
37156
|
function readProjectEntryFile(projectDir, preferredEntryFile) {
|
|
37095
|
-
const absProjectDir =
|
|
37157
|
+
const absProjectDir = resolve18(projectDir);
|
|
37096
37158
|
if (!existsSync34(absProjectDir) || !statSync10(absProjectDir).isDirectory()) {
|
|
37097
37159
|
return { error: `Project directory not found: ${absProjectDir}` };
|
|
37098
37160
|
}
|
|
@@ -37100,7 +37162,7 @@ function readProjectEntryFile(projectDir, preferredEntryFile) {
|
|
|
37100
37162
|
(value) => typeof value === "string" && value.trim().length > 0
|
|
37101
37163
|
);
|
|
37102
37164
|
for (const entryFile of entryCandidates) {
|
|
37103
|
-
const absoluteEntryPath =
|
|
37165
|
+
const absoluteEntryPath = resolve18(absProjectDir, entryFile);
|
|
37104
37166
|
if (!absoluteEntryPath.startsWith(absProjectDir)) {
|
|
37105
37167
|
return { error: `Entry file must stay inside project directory: ${entryFile}` };
|
|
37106
37168
|
}
|
|
@@ -37175,10 +37237,10 @@ var init_semaphore = __esm({
|
|
|
37175
37237
|
this.active++;
|
|
37176
37238
|
return () => this.release();
|
|
37177
37239
|
}
|
|
37178
|
-
return new Promise((
|
|
37240
|
+
return new Promise((resolve41) => {
|
|
37179
37241
|
this.queue.push(() => {
|
|
37180
37242
|
this.active++;
|
|
37181
|
-
|
|
37243
|
+
resolve41(() => this.release());
|
|
37182
37244
|
});
|
|
37183
37245
|
});
|
|
37184
37246
|
}
|
|
@@ -37209,7 +37271,7 @@ import {
|
|
|
37209
37271
|
rmSync as rmSync8,
|
|
37210
37272
|
createReadStream
|
|
37211
37273
|
} from "fs";
|
|
37212
|
-
import { resolve as
|
|
37274
|
+
import { resolve as resolve19, dirname as dirname13, join as join37 } from "path";
|
|
37213
37275
|
import { tmpdir as tmpdir3 } from "os";
|
|
37214
37276
|
import { parseArgs as parseArgs2 } from "util";
|
|
37215
37277
|
import crypto2 from "crypto";
|
|
@@ -37231,12 +37293,12 @@ async function prepareRenderBody(body) {
|
|
|
37231
37293
|
const options = parseRenderOptions(body);
|
|
37232
37294
|
const projectDir = typeof body.projectDir === "string" ? body.projectDir : void 0;
|
|
37233
37295
|
if (projectDir) {
|
|
37234
|
-
const absProjectDir =
|
|
37296
|
+
const absProjectDir = resolve19(projectDir);
|
|
37235
37297
|
if (!existsSync35(absProjectDir) || !statSync11(absProjectDir).isDirectory()) {
|
|
37236
37298
|
return { error: `Project directory not found: ${absProjectDir}` };
|
|
37237
37299
|
}
|
|
37238
37300
|
const entry = options.entryFile || "index.html";
|
|
37239
|
-
if (!existsSync35(
|
|
37301
|
+
if (!existsSync35(resolve19(absProjectDir, entry))) {
|
|
37240
37302
|
return { error: `Entry file "${entry}" not found in project directory: ${absProjectDir}` };
|
|
37241
37303
|
}
|
|
37242
37304
|
return { prepared: { input: { projectDir: absProjectDir, ...options } } };
|
|
@@ -37277,7 +37339,7 @@ function resolveOutputPath(projectDir, outputCandidate, rendersDir, log2) {
|
|
|
37277
37339
|
try {
|
|
37278
37340
|
return resolveRenderPaths(projectDir, outputCandidate, rendersDir).absoluteOutputPath;
|
|
37279
37341
|
} catch (error) {
|
|
37280
|
-
const fallbackPath =
|
|
37342
|
+
const fallbackPath = resolve19(rendersDir, `producer-fallback-${Date.now()}.mp4`);
|
|
37281
37343
|
log2.warn("Failed to resolve output path, using fallback", {
|
|
37282
37344
|
fallback: fallbackPath,
|
|
37283
37345
|
error: error instanceof Error ? error.message : String(error)
|
|
@@ -37665,7 +37727,7 @@ var init_server = __esm({
|
|
|
37665
37727
|
init_paths();
|
|
37666
37728
|
init_logger();
|
|
37667
37729
|
init_semaphore();
|
|
37668
|
-
entryScript = process.argv[1] ?
|
|
37730
|
+
entryScript = process.argv[1] ? resolve19(process.argv[1]) : "";
|
|
37669
37731
|
isPublicServerEntry = entryScript.endsWith("/public-server.js") || entryScript.endsWith("/src/server.ts");
|
|
37670
37732
|
if (isPublicServerEntry) {
|
|
37671
37733
|
const { values } = parseArgs2({
|
|
@@ -37739,18 +37801,18 @@ __export(studioServer_exports, {
|
|
|
37739
37801
|
import { Hono as Hono5 } from "hono";
|
|
37740
37802
|
import { streamSSE as streamSSE3 } from "hono/streaming";
|
|
37741
37803
|
import { existsSync as existsSync36, readFileSync as readFileSync26, writeFileSync as writeFileSync17, statSync as statSync12 } from "fs";
|
|
37742
|
-
import { resolve as
|
|
37804
|
+
import { resolve as resolve20, join as join38, basename as basename4 } from "path";
|
|
37743
37805
|
function resolveDistDir() {
|
|
37744
37806
|
return resolveStudioBundle().dir;
|
|
37745
37807
|
}
|
|
37746
37808
|
function resolveStudioBundle() {
|
|
37747
|
-
const builtPath =
|
|
37748
|
-
const builtIndex =
|
|
37809
|
+
const builtPath = resolve20(__dirname, "studio");
|
|
37810
|
+
const builtIndex = resolve20(builtPath, "index.html");
|
|
37749
37811
|
if (existsSync36(builtIndex)) {
|
|
37750
37812
|
return { dir: builtPath, indexPath: builtIndex, available: true, checkedPaths: [builtIndex] };
|
|
37751
37813
|
}
|
|
37752
|
-
const devPath =
|
|
37753
|
-
const devIndex =
|
|
37814
|
+
const devPath = resolve20(__dirname, "..", "..", "..", "studio", "dist");
|
|
37815
|
+
const devIndex = resolve20(devPath, "index.html");
|
|
37754
37816
|
if (existsSync36(devIndex)) {
|
|
37755
37817
|
return {
|
|
37756
37818
|
dir: devPath,
|
|
@@ -37767,11 +37829,11 @@ function resolveStudioBundle() {
|
|
|
37767
37829
|
};
|
|
37768
37830
|
}
|
|
37769
37831
|
function resolveRuntimePath() {
|
|
37770
|
-
const builtPath =
|
|
37832
|
+
const builtPath = resolve20(__dirname, "hyperframe-runtime.js");
|
|
37771
37833
|
if (existsSync36(builtPath)) return builtPath;
|
|
37772
|
-
const iifePath =
|
|
37834
|
+
const iifePath = resolve20(__dirname, "hyperframe.runtime.iife.js");
|
|
37773
37835
|
if (existsSync36(iifePath)) return iifePath;
|
|
37774
|
-
const devPath =
|
|
37836
|
+
const devPath = resolve20(
|
|
37775
37837
|
__dirname,
|
|
37776
37838
|
"..",
|
|
37777
37839
|
"..",
|
|
@@ -37981,7 +38043,7 @@ function createStudioServer(options) {
|
|
|
37981
38043
|
return api.fetch(forwardReq);
|
|
37982
38044
|
});
|
|
37983
38045
|
const serveStudioStaticFile = (c2) => {
|
|
37984
|
-
const filePath =
|
|
38046
|
+
const filePath = resolve20(studioDir, c2.req.path.slice(1));
|
|
37985
38047
|
if (!existsSync36(filePath) || !statSync12(filePath).isFile()) return c2.text("not found", 404);
|
|
37986
38048
|
const content = readFileSync26(filePath);
|
|
37987
38049
|
return new Response(content, {
|
|
@@ -37991,7 +38053,7 @@ function createStudioServer(options) {
|
|
|
37991
38053
|
app.get("/assets/*", serveStudioStaticFile);
|
|
37992
38054
|
app.get("/icons/*", serveStudioStaticFile);
|
|
37993
38055
|
app.get("*", (c2) => {
|
|
37994
|
-
const indexPath =
|
|
38056
|
+
const indexPath = resolve20(studioDir, "index.html");
|
|
37995
38057
|
if (!existsSync36(indexPath)) {
|
|
37996
38058
|
return c2.html(
|
|
37997
38059
|
`<!doctype html>
|
|
@@ -38074,12 +38136,12 @@ __export(preview_exports, {
|
|
|
38074
38136
|
});
|
|
38075
38137
|
import { spawn as spawn9 } from "child_process";
|
|
38076
38138
|
import { existsSync as existsSync37, lstatSync, symlinkSync as symlinkSync2, unlinkSync as unlinkSync5, readlinkSync, mkdirSync as mkdirSync22 } from "fs";
|
|
38077
|
-
import { resolve as
|
|
38139
|
+
import { resolve as resolve21, dirname as dirname14, basename as basename5, join as join39 } from "path";
|
|
38078
38140
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
38079
38141
|
import { createRequire } from "module";
|
|
38080
38142
|
async function runDevMode(dir, projectName) {
|
|
38081
38143
|
const thisFile = fileURLToPath4(import.meta.url);
|
|
38082
|
-
const repoRoot =
|
|
38144
|
+
const repoRoot = resolve21(dirname14(thisFile), "..", "..", "..", "..");
|
|
38083
38145
|
const projectsDir = join39(repoRoot, "packages", "studio", "data", "projects");
|
|
38084
38146
|
const pName = projectName ?? basename5(dir);
|
|
38085
38147
|
const symlinkPath = join39(projectsDir, pName);
|
|
@@ -38091,7 +38153,7 @@ async function runDevMode(dir, projectName) {
|
|
|
38091
38153
|
const stat3 = lstatSync(symlinkPath);
|
|
38092
38154
|
if (stat3.isSymbolicLink()) {
|
|
38093
38155
|
const target = readlinkSync(symlinkPath);
|
|
38094
|
-
if (
|
|
38156
|
+
if (resolve21(target) !== resolve21(dir)) {
|
|
38095
38157
|
unlinkSync5(symlinkPath);
|
|
38096
38158
|
}
|
|
38097
38159
|
}
|
|
@@ -38145,8 +38207,8 @@ async function runDevMode(dir, projectName) {
|
|
|
38145
38207
|
}
|
|
38146
38208
|
});
|
|
38147
38209
|
}
|
|
38148
|
-
return new Promise((
|
|
38149
|
-
child.on("close", () =>
|
|
38210
|
+
return new Promise((resolve41) => {
|
|
38211
|
+
child.on("close", () => resolve41());
|
|
38150
38212
|
});
|
|
38151
38213
|
}
|
|
38152
38214
|
function hasLocalStudio(dir) {
|
|
@@ -38168,7 +38230,7 @@ async function runLocalStudioMode(dir, projectName) {
|
|
|
38168
38230
|
let createdSymlink = false;
|
|
38169
38231
|
if (dir !== symlinkPath) {
|
|
38170
38232
|
if (existsSync37(symlinkPath) && lstatSync(symlinkPath).isSymbolicLink()) {
|
|
38171
|
-
if (
|
|
38233
|
+
if (resolve21(readlinkSync(symlinkPath)) !== resolve21(dir)) {
|
|
38172
38234
|
unlinkSync5(symlinkPath);
|
|
38173
38235
|
}
|
|
38174
38236
|
}
|
|
@@ -38216,8 +38278,8 @@ async function runLocalStudioMode(dir, projectName) {
|
|
|
38216
38278
|
}
|
|
38217
38279
|
});
|
|
38218
38280
|
}
|
|
38219
|
-
return new Promise((
|
|
38220
|
-
child.on("close", () =>
|
|
38281
|
+
return new Promise((resolve41) => {
|
|
38282
|
+
child.on("close", () => resolve41());
|
|
38221
38283
|
});
|
|
38222
38284
|
}
|
|
38223
38285
|
async function runEmbeddedMode(dir, startPort, projectName, forceNew = false) {
|
|
@@ -38384,7 +38446,7 @@ var init_preview2 = __esm({
|
|
|
38384
38446
|
return;
|
|
38385
38447
|
}
|
|
38386
38448
|
const rawArg = args.dir;
|
|
38387
|
-
const dir =
|
|
38449
|
+
const dir = resolve21(rawArg ?? ".");
|
|
38388
38450
|
const isImplicitCwd = !rawArg || rawArg === "." || rawArg === "./";
|
|
38389
38451
|
const projectName = isImplicitCwd ? basename5(process.env.PWD ?? dir) : basename5(dir);
|
|
38390
38452
|
const indexPath = join39(dir, "index.html");
|
|
@@ -38426,7 +38488,7 @@ import {
|
|
|
38426
38488
|
readFileSync as readFileSync27,
|
|
38427
38489
|
readdirSync as readdirSync13
|
|
38428
38490
|
} from "fs";
|
|
38429
|
-
import { resolve as
|
|
38491
|
+
import { resolve as resolve22, basename as basename6, join as join40, dirname as dirname15 } from "path";
|
|
38430
38492
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
38431
38493
|
import { execFileSync as execFileSync4, spawn as spawn10 } from "child_process";
|
|
38432
38494
|
function probeVideo(filePath) {
|
|
@@ -38496,8 +38558,8 @@ function transcodeToMp4(inputPath, outputPath) {
|
|
|
38496
38558
|
}
|
|
38497
38559
|
function resolveAssetDir(devSegments, builtSegments) {
|
|
38498
38560
|
const base = dirname15(fileURLToPath5(import.meta.url));
|
|
38499
|
-
const devPath =
|
|
38500
|
-
const builtPath =
|
|
38561
|
+
const devPath = resolve22(base, ...devSegments);
|
|
38562
|
+
const builtPath = resolve22(base, ...builtSegments);
|
|
38501
38563
|
return existsSync38(devPath) ? devPath : builtPath;
|
|
38502
38564
|
}
|
|
38503
38565
|
function getStaticTemplateDir(templateId) {
|
|
@@ -38525,7 +38587,7 @@ function buildPackageScripts() {
|
|
|
38525
38587
|
};
|
|
38526
38588
|
}
|
|
38527
38589
|
function writeDefaultPackageJson(destDir, projectName) {
|
|
38528
|
-
const packageJsonPath =
|
|
38590
|
+
const packageJsonPath = resolve22(destDir, "package.json");
|
|
38529
38591
|
if (existsSync38(packageJsonPath)) return;
|
|
38530
38592
|
writeFileSync18(
|
|
38531
38593
|
packageJsonPath,
|
|
@@ -38668,7 +38730,7 @@ async function handleVideoFile(videoPath, destDir, interactive) {
|
|
|
38668
38730
|
}
|
|
38669
38731
|
if (shouldTranscode) {
|
|
38670
38732
|
const mp4Name = localVideoName.replace(/\.[^.]+$/, ".mp4");
|
|
38671
|
-
const mp4Path =
|
|
38733
|
+
const mp4Path = resolve22(destDir, mp4Name);
|
|
38672
38734
|
const spin = be();
|
|
38673
38735
|
spin.start("Transcoding to H.264 MP4...");
|
|
38674
38736
|
const ok = await transcodeToMp4(videoPath, mp4Path);
|
|
@@ -38677,10 +38739,10 @@ async function handleVideoFile(videoPath, destDir, interactive) {
|
|
|
38677
38739
|
localVideoName = mp4Name;
|
|
38678
38740
|
} else {
|
|
38679
38741
|
spin.stop(c.warn("Transcode failed \u2014 copying original file"));
|
|
38680
|
-
copyFileSync3(videoPath,
|
|
38742
|
+
copyFileSync3(videoPath, resolve22(destDir, localVideoName));
|
|
38681
38743
|
}
|
|
38682
38744
|
} else {
|
|
38683
|
-
copyFileSync3(videoPath,
|
|
38745
|
+
copyFileSync3(videoPath, resolve22(destDir, localVideoName));
|
|
38684
38746
|
}
|
|
38685
38747
|
} else {
|
|
38686
38748
|
if (interactive) {
|
|
@@ -38690,10 +38752,10 @@ async function handleVideoFile(videoPath, destDir, interactive) {
|
|
|
38690
38752
|
console.log(c.warn("ffmpeg not installed \u2014 cannot transcode. Copying original."));
|
|
38691
38753
|
console.log(c.dim("Install: ") + c.accent("brew install ffmpeg"));
|
|
38692
38754
|
}
|
|
38693
|
-
copyFileSync3(videoPath,
|
|
38755
|
+
copyFileSync3(videoPath, resolve22(destDir, localVideoName));
|
|
38694
38756
|
}
|
|
38695
38757
|
} else {
|
|
38696
|
-
copyFileSync3(videoPath,
|
|
38758
|
+
copyFileSync3(videoPath, resolve22(destDir, localVideoName));
|
|
38697
38759
|
}
|
|
38698
38760
|
return { meta, localVideoName };
|
|
38699
38761
|
}
|
|
@@ -38708,7 +38770,7 @@ async function scaffoldProject(destDir, name, templateId, localVideoName, durati
|
|
|
38708
38770
|
patchVideoSrc(destDir, localVideoName, durationSeconds);
|
|
38709
38771
|
if (tailwind) writeTailwindSupport(destDir);
|
|
38710
38772
|
writeFileSync18(
|
|
38711
|
-
|
|
38773
|
+
resolve22(destDir, "meta.json"),
|
|
38712
38774
|
JSON.stringify(
|
|
38713
38775
|
{
|
|
38714
38776
|
id: name,
|
|
@@ -38720,7 +38782,7 @@ async function scaffoldProject(destDir, name, templateId, localVideoName, durati
|
|
|
38720
38782
|
),
|
|
38721
38783
|
"utf-8"
|
|
38722
38784
|
);
|
|
38723
|
-
if (!existsSync38(
|
|
38785
|
+
if (!existsSync38(resolve22(destDir, "hyperframes.json"))) {
|
|
38724
38786
|
const { writeProjectConfig: writeProjectConfig2, DEFAULT_PROJECT_CONFIG: DEFAULT_PROJECT_CONFIG2 } = await Promise.resolve().then(() => (init_projectConfig(), projectConfig_exports));
|
|
38725
38787
|
writeProjectConfig2(destDir, DEFAULT_PROJECT_CONFIG2);
|
|
38726
38788
|
}
|
|
@@ -38729,7 +38791,7 @@ async function scaffoldProject(destDir, name, templateId, localVideoName, durati
|
|
|
38729
38791
|
if (existsSync38(sharedDir)) {
|
|
38730
38792
|
for (const entry of readdirSync13(sharedDir, { withFileTypes: true })) {
|
|
38731
38793
|
const src = join40(sharedDir, entry.name);
|
|
38732
|
-
const dest =
|
|
38794
|
+
const dest = resolve22(destDir, entry.name);
|
|
38733
38795
|
if (entry.isFile() || entry.isSymbolicLink()) {
|
|
38734
38796
|
copyFileSync3(src, dest);
|
|
38735
38797
|
}
|
|
@@ -38851,7 +38913,7 @@ var init_init = __esm({
|
|
|
38851
38913
|
if (!interactive) {
|
|
38852
38914
|
const templateId2 = exampleFlag ?? "blank";
|
|
38853
38915
|
const name2 = args.name ?? "my-video";
|
|
38854
|
-
const destDir2 =
|
|
38916
|
+
const destDir2 = resolve22(name2);
|
|
38855
38917
|
if (existsSync38(destDir2) && readdirSync13(destDir2).length > 0) {
|
|
38856
38918
|
console.error(c.error(`Directory already exists and is not empty: ${name2}`));
|
|
38857
38919
|
process.exit(1);
|
|
@@ -38865,7 +38927,7 @@ var init_init = __esm({
|
|
|
38865
38927
|
process.exit(1);
|
|
38866
38928
|
}
|
|
38867
38929
|
if (videoFlag) {
|
|
38868
|
-
const videoPath =
|
|
38930
|
+
const videoPath = resolve22(videoFlag);
|
|
38869
38931
|
if (!existsSync38(videoPath)) {
|
|
38870
38932
|
console.error(c.error(`Video file not found: ${videoFlag}`));
|
|
38871
38933
|
process.exit(1);
|
|
@@ -38879,13 +38941,13 @@ var init_init = __esm({
|
|
|
38879
38941
|
);
|
|
38880
38942
|
}
|
|
38881
38943
|
if (audioFlag) {
|
|
38882
|
-
const audioPath =
|
|
38944
|
+
const audioPath = resolve22(audioFlag);
|
|
38883
38945
|
if (!existsSync38(audioPath)) {
|
|
38884
38946
|
console.error(c.error(`Audio file not found: ${audioFlag}`));
|
|
38885
38947
|
process.exit(1);
|
|
38886
38948
|
}
|
|
38887
38949
|
sourceFilePath2 = audioPath;
|
|
38888
|
-
copyFileSync3(audioPath,
|
|
38950
|
+
copyFileSync3(audioPath, resolve22(destDir2, basename6(audioPath)));
|
|
38889
38951
|
console.log(`Audio: ${basename6(audioPath)}`);
|
|
38890
38952
|
}
|
|
38891
38953
|
if (sourceFilePath2 && !skipTranscribe) {
|
|
@@ -38926,7 +38988,7 @@ var init_init = __esm({
|
|
|
38926
38988
|
process.exit(1);
|
|
38927
38989
|
}
|
|
38928
38990
|
trackInitTemplate(templateId2, { tailwind });
|
|
38929
|
-
const transcriptFile2 =
|
|
38991
|
+
const transcriptFile2 = resolve22(destDir2, "transcript.json");
|
|
38930
38992
|
if (existsSync38(transcriptFile2)) {
|
|
38931
38993
|
await patchTranscript(destDir2, transcriptFile2);
|
|
38932
38994
|
}
|
|
@@ -38981,7 +39043,7 @@ var init_init = __esm({
|
|
|
38981
39043
|
}
|
|
38982
39044
|
name = nameResult;
|
|
38983
39045
|
}
|
|
38984
|
-
const destDir =
|
|
39046
|
+
const destDir = resolve22(name);
|
|
38985
39047
|
if (existsSync38(destDir) && readdirSync13(destDir).length > 0) {
|
|
38986
39048
|
const overwrite = await Rt({
|
|
38987
39049
|
message: `Directory ${c.accent(name)} already exists and is not empty. Overwrite?`,
|
|
@@ -38996,7 +39058,7 @@ var init_init = __esm({
|
|
|
38996
39058
|
let sourceFilePath;
|
|
38997
39059
|
let videoDuration;
|
|
38998
39060
|
if (videoFlag) {
|
|
38999
|
-
const videoPath =
|
|
39061
|
+
const videoPath = resolve22(videoFlag);
|
|
39000
39062
|
if (!existsSync38(videoPath)) {
|
|
39001
39063
|
R2.error(`File not found: ${videoFlag}`);
|
|
39002
39064
|
Nt("Setup cancelled.");
|
|
@@ -39008,7 +39070,7 @@ var init_init = __esm({
|
|
|
39008
39070
|
localVideoName = result.localVideoName;
|
|
39009
39071
|
videoDuration = result.meta.durationSeconds;
|
|
39010
39072
|
} else if (audioFlag) {
|
|
39011
|
-
const audioPath =
|
|
39073
|
+
const audioPath = resolve22(audioFlag);
|
|
39012
39074
|
if (!existsSync38(audioPath)) {
|
|
39013
39075
|
R2.error(`File not found: ${audioFlag}`);
|
|
39014
39076
|
Nt("Setup cancelled.");
|
|
@@ -39016,7 +39078,7 @@ var init_init = __esm({
|
|
|
39016
39078
|
}
|
|
39017
39079
|
mkdirSync23(destDir, { recursive: true });
|
|
39018
39080
|
sourceFilePath = audioPath;
|
|
39019
|
-
copyFileSync3(audioPath,
|
|
39081
|
+
copyFileSync3(audioPath, resolve22(destDir, basename6(audioPath)));
|
|
39020
39082
|
R2.info(`Audio copied to ${c.accent(basename6(audioPath))}`);
|
|
39021
39083
|
}
|
|
39022
39084
|
if (sourceFilePath) {
|
|
@@ -39101,7 +39163,7 @@ ${c.dim("Use --example blank for offline use.")}`
|
|
|
39101
39163
|
process.exit(1);
|
|
39102
39164
|
}
|
|
39103
39165
|
trackInitTemplate(templateId, { tailwind });
|
|
39104
|
-
const transcriptFile =
|
|
39166
|
+
const transcriptFile = resolve22(destDir, "transcript.json");
|
|
39105
39167
|
if (existsSync38(transcriptFile)) {
|
|
39106
39168
|
await patchTranscript(destDir, transcriptFile);
|
|
39107
39169
|
}
|
|
@@ -39189,7 +39251,7 @@ __export(add_exports, {
|
|
|
39189
39251
|
runAdd: () => runAdd
|
|
39190
39252
|
});
|
|
39191
39253
|
import { existsSync as existsSync39 } from "fs";
|
|
39192
|
-
import { resolve as
|
|
39254
|
+
import { resolve as resolve23, relative as relative3 } from "path";
|
|
39193
39255
|
function remapTarget(item, originalTarget, paths) {
|
|
39194
39256
|
if (item.type === "hyperframes:block") {
|
|
39195
39257
|
const blocksDir = paths.blocks.replace(/\/+$/, "");
|
|
@@ -39212,10 +39274,10 @@ function buildSnippet(item, relativeTarget) {
|
|
|
39212
39274
|
return "";
|
|
39213
39275
|
}
|
|
39214
39276
|
async function runAdd(opts) {
|
|
39215
|
-
const projectDir =
|
|
39277
|
+
const projectDir = resolve23(opts.projectDir);
|
|
39216
39278
|
let config = loadProjectConfig(projectDir);
|
|
39217
39279
|
const hasConfig = existsSync39(projectConfigPath(projectDir));
|
|
39218
|
-
if (!hasConfig && existsSync39(
|
|
39280
|
+
if (!hasConfig && existsSync39(resolve23(projectDir, "index.html"))) {
|
|
39219
39281
|
writeProjectConfig(projectDir, DEFAULT_PROJECT_CONFIG);
|
|
39220
39282
|
config = DEFAULT_PROJECT_CONFIG;
|
|
39221
39283
|
}
|
|
@@ -39311,7 +39373,7 @@ var init_add = __esm({
|
|
|
39311
39373
|
}
|
|
39312
39374
|
},
|
|
39313
39375
|
async run({ args }) {
|
|
39314
|
-
const projectDir =
|
|
39376
|
+
const projectDir = resolve23(args.dir ?? process.cwd());
|
|
39315
39377
|
const json = args.json === true;
|
|
39316
39378
|
const skipClipboard = args["no-clipboard"] === true;
|
|
39317
39379
|
const hasConfigBefore = existsSync39(projectConfigPath(projectDir));
|
|
@@ -39359,7 +39421,7 @@ __export(catalog_exports, {
|
|
|
39359
39421
|
default: () => catalog_default,
|
|
39360
39422
|
examples: () => examples4
|
|
39361
39423
|
});
|
|
39362
|
-
import { resolve as
|
|
39424
|
+
import { resolve as resolve24 } from "path";
|
|
39363
39425
|
var examples4, catalog_default;
|
|
39364
39426
|
var init_catalog = __esm({
|
|
39365
39427
|
"src/commands/catalog.ts"() {
|
|
@@ -39403,7 +39465,7 @@ var init_catalog = __esm({
|
|
|
39403
39465
|
async run({ args }) {
|
|
39404
39466
|
const json = args.json === true;
|
|
39405
39467
|
const interactive = args["human-friendly"] === true;
|
|
39406
|
-
const dir =
|
|
39468
|
+
const dir = resolve24(process.cwd());
|
|
39407
39469
|
const config = loadProjectConfig(dir) ?? DEFAULT_PROJECT_CONFIG;
|
|
39408
39470
|
let typeFilter;
|
|
39409
39471
|
if (args.type === "block") typeFilter = "hyperframes:block";
|
|
@@ -39528,11 +39590,11 @@ var init_format = __esm({
|
|
|
39528
39590
|
|
|
39529
39591
|
// src/utils/project.ts
|
|
39530
39592
|
import { existsSync as existsSync40, statSync as statSync13 } from "fs";
|
|
39531
|
-
import { resolve as
|
|
39593
|
+
import { resolve as resolve25, basename as basename7 } from "path";
|
|
39532
39594
|
function resolveProject(dirArg) {
|
|
39533
|
-
const dir =
|
|
39595
|
+
const dir = resolve25(dirArg ?? ".");
|
|
39534
39596
|
const name = basename7(dir);
|
|
39535
|
-
const indexPath =
|
|
39597
|
+
const indexPath = resolve25(dir, "index.html");
|
|
39536
39598
|
if (!existsSync40(dir) || !statSync13(dir).isDirectory()) {
|
|
39537
39599
|
errorBox("Not a directory: " + dir);
|
|
39538
39600
|
process.exit(1);
|
|
@@ -39561,7 +39623,7 @@ __export(play_exports, {
|
|
|
39561
39623
|
examples: () => examples5
|
|
39562
39624
|
});
|
|
39563
39625
|
import { existsSync as existsSync41, readFileSync as readFileSync28 } from "fs";
|
|
39564
|
-
import { resolve as
|
|
39626
|
+
import { resolve as resolve26, dirname as dirname16 } from "path";
|
|
39565
39627
|
function commandDir() {
|
|
39566
39628
|
return dirname16(new URL(import.meta.url).pathname);
|
|
39567
39629
|
}
|
|
@@ -39569,10 +39631,10 @@ function resolveRuntimePath2() {
|
|
|
39569
39631
|
const d = commandDir();
|
|
39570
39632
|
const candidates = [
|
|
39571
39633
|
// Bundled with CLI dist
|
|
39572
|
-
|
|
39573
|
-
|
|
39634
|
+
resolve26(d, "hyperframe-runtime.js"),
|
|
39635
|
+
resolve26(d, "..", "hyperframe-runtime.js"),
|
|
39574
39636
|
// Monorepo dev: commands/ → src/ → cli/ → packages/ then into core/dist/
|
|
39575
|
-
|
|
39637
|
+
resolve26(d, "..", "..", "..", "core", "dist", "hyperframe.runtime.iife.js")
|
|
39576
39638
|
];
|
|
39577
39639
|
for (const p of candidates) {
|
|
39578
39640
|
if (existsSync41(p)) return p;
|
|
@@ -39583,10 +39645,10 @@ function resolvePlayerPath() {
|
|
|
39583
39645
|
const d = commandDir();
|
|
39584
39646
|
const candidates = [
|
|
39585
39647
|
// Monorepo dev: commands/ → src/ → cli/ → packages/ then into player/dist/
|
|
39586
|
-
|
|
39648
|
+
resolve26(d, "..", "..", "..", "player", "dist", "hyperframes-player.global.js"),
|
|
39587
39649
|
// Bundled with CLI dist
|
|
39588
|
-
|
|
39589
|
-
|
|
39650
|
+
resolve26(d, "hyperframes-player.global.js"),
|
|
39651
|
+
resolve26(d, "..", "hyperframes-player.global.js")
|
|
39590
39652
|
];
|
|
39591
39653
|
for (const p of candidates) {
|
|
39592
39654
|
if (existsSync41(p)) return p;
|
|
@@ -39689,7 +39751,7 @@ var init_play = __esm({
|
|
|
39689
39751
|
});
|
|
39690
39752
|
app.get("/composition/*", async (ctx) => {
|
|
39691
39753
|
const reqPath = ctx.req.path.replace("/composition/", "");
|
|
39692
|
-
const filePath =
|
|
39754
|
+
const filePath = resolve26(project.dir, reqPath);
|
|
39693
39755
|
if (!filePath.startsWith(project.dir)) return ctx.text("Forbidden", 403);
|
|
39694
39756
|
if (!existsSync41(filePath)) return ctx.text("Not found", 404);
|
|
39695
39757
|
const content = readFileSync28(filePath, "utf-8");
|
|
@@ -39993,7 +40055,7 @@ __export(publish_exports, {
|
|
|
39993
40055
|
default: () => publish_default,
|
|
39994
40056
|
examples: () => examples6
|
|
39995
40057
|
});
|
|
39996
|
-
import { basename as basename9, resolve as
|
|
40058
|
+
import { basename as basename9, resolve as resolve27 } from "path";
|
|
39997
40059
|
import { existsSync as existsSync42 } from "fs";
|
|
39998
40060
|
import { join as join42 } from "path";
|
|
39999
40061
|
var examples6, publish_default;
|
|
@@ -40027,7 +40089,7 @@ var init_publish = __esm({
|
|
|
40027
40089
|
},
|
|
40028
40090
|
async run({ args }) {
|
|
40029
40091
|
const rawArg = args.dir;
|
|
40030
|
-
const dir =
|
|
40092
|
+
const dir = resolve27(rawArg ?? ".");
|
|
40031
40093
|
const isImplicitCwd = !rawArg || rawArg === "." || rawArg === "./";
|
|
40032
40094
|
const projectName = isImplicitCwd ? basename9(process.env["PWD"] ?? dir) : basename9(dir);
|
|
40033
40095
|
const indexPath = join42(dir, "index.html");
|
|
@@ -40224,9 +40286,9 @@ __export(render_exports, {
|
|
|
40224
40286
|
});
|
|
40225
40287
|
import { mkdirSync as mkdirSync24, readFileSync as readFileSync30, statSync as statSync15, writeFileSync as writeFileSync19, rmSync as rmSync9 } from "fs";
|
|
40226
40288
|
import { cpus as cpus3, freemem as freemem3, tmpdir as tmpdir4 } from "os";
|
|
40227
|
-
import { resolve as
|
|
40289
|
+
import { resolve as resolve28, dirname as dirname17, join as join43, basename as basename10 } from "path";
|
|
40228
40290
|
import { execFileSync as execFileSync5, spawn as spawn11 } from "child_process";
|
|
40229
|
-
function parseVariablesArg(inline, filePath, readFile = (p) => readFileSync30(
|
|
40291
|
+
function parseVariablesArg(inline, filePath, readFile = (p) => readFileSync30(resolve28(p), "utf8")) {
|
|
40230
40292
|
if (inline != null && filePath != null) {
|
|
40231
40293
|
return { ok: false, error: { kind: "conflict" } };
|
|
40232
40294
|
}
|
|
@@ -40324,8 +40386,8 @@ function dockerImageTag(version) {
|
|
|
40324
40386
|
return `${DOCKER_IMAGE_PREFIX}:${version}`;
|
|
40325
40387
|
}
|
|
40326
40388
|
function resolveDockerfilePath() {
|
|
40327
|
-
const builtPath =
|
|
40328
|
-
const devPath =
|
|
40389
|
+
const builtPath = resolve28(__dirname, "docker", "Dockerfile.render");
|
|
40390
|
+
const devPath = resolve28(__dirname, "..", "src", "docker", "Dockerfile.render");
|
|
40329
40391
|
for (const p of [builtPath, devPath]) {
|
|
40330
40392
|
try {
|
|
40331
40393
|
statSync15(p);
|
|
@@ -40402,8 +40464,8 @@ async function renderDocker(projectDir, outputPath, options) {
|
|
|
40402
40464
|
const outputFilename = basename10(outputPath);
|
|
40403
40465
|
const dockerArgs = buildDockerRunArgs({
|
|
40404
40466
|
imageTag,
|
|
40405
|
-
projectDir:
|
|
40406
|
-
outputDir:
|
|
40467
|
+
projectDir: resolve28(projectDir),
|
|
40468
|
+
outputDir: resolve28(outputDir),
|
|
40407
40469
|
outputFilename,
|
|
40408
40470
|
options: {
|
|
40409
40471
|
fps: options.fps,
|
|
@@ -40745,12 +40807,12 @@ var init_render2 = __esm({
|
|
|
40745
40807
|
}
|
|
40746
40808
|
process.env.PRODUCER_MAX_CONCURRENT_RENDERS = String(parsed);
|
|
40747
40809
|
}
|
|
40748
|
-
const rendersDir =
|
|
40810
|
+
const rendersDir = resolve28("renders");
|
|
40749
40811
|
const ext = FORMAT_EXT[format] ?? ".mp4";
|
|
40750
40812
|
const now = /* @__PURE__ */ new Date();
|
|
40751
40813
|
const datePart = now.toISOString().slice(0, 10);
|
|
40752
40814
|
const timePart = now.toTimeString().slice(0, 8).replace(/:/g, "-");
|
|
40753
|
-
const outputPath = args.output ?
|
|
40815
|
+
const outputPath = args.output ? resolve28(args.output) : join43(rendersDir, `${project.name}_${datePart}_${timePart}${ext}`);
|
|
40754
40816
|
mkdirSync24(dirname17(outputPath), { recursive: true });
|
|
40755
40817
|
const useDocker = args.docker ?? false;
|
|
40756
40818
|
const useGpu = args.gpu ?? false;
|
|
@@ -41134,7 +41196,7 @@ var init_lint3 = __esm({
|
|
|
41134
41196
|
// src/utils/staticProjectServer.ts
|
|
41135
41197
|
import { createServer } from "http";
|
|
41136
41198
|
import { existsSync as existsSync43, readFileSync as readFileSync31 } from "fs";
|
|
41137
|
-
import { isAbsolute as isAbsolute6, relative as relative5, resolve as
|
|
41199
|
+
import { isAbsolute as isAbsolute6, relative as relative5, resolve as resolve29 } from "path";
|
|
41138
41200
|
async function serveStaticProjectHtml(projectDir, html, bindErrorMessage = "Failed to bind local HTTP server") {
|
|
41139
41201
|
const server = createServer((req, res) => {
|
|
41140
41202
|
const url = req.url ?? "/";
|
|
@@ -41143,7 +41205,7 @@ async function serveStaticProjectHtml(projectDir, html, bindErrorMessage = "Fail
|
|
|
41143
41205
|
res.end(html);
|
|
41144
41206
|
return;
|
|
41145
41207
|
}
|
|
41146
|
-
const filePath =
|
|
41208
|
+
const filePath = resolve29(projectDir, decodeURIComponent(url).replace(/^\//, ""));
|
|
41147
41209
|
const rel = relative5(projectDir, filePath);
|
|
41148
41210
|
if (rel.startsWith("..") || isAbsolute6(rel)) {
|
|
41149
41211
|
res.writeHead(403);
|
|
@@ -41329,7 +41391,7 @@ __export(layout_exports, {
|
|
|
41329
41391
|
examples: () => examples9
|
|
41330
41392
|
});
|
|
41331
41393
|
import { existsSync as existsSync44, readFileSync as readFileSync32 } from "fs";
|
|
41332
|
-
import { dirname as dirname18, join as join44, resolve as
|
|
41394
|
+
import { dirname as dirname18, join as join44, resolve as resolve30 } from "path";
|
|
41333
41395
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
41334
41396
|
async function getCompositionDuration2(page) {
|
|
41335
41397
|
return page.evaluate(() => {
|
|
@@ -41381,7 +41443,7 @@ async function seekTo(page, time) {
|
|
|
41381
41443
|
if (!fonts?.ready) return Promise.resolve();
|
|
41382
41444
|
return Promise.race([
|
|
41383
41445
|
fonts.ready.then(() => void 0),
|
|
41384
|
-
new Promise((
|
|
41446
|
+
new Promise((resolve41) => setTimeout(resolve41, 500))
|
|
41385
41447
|
]);
|
|
41386
41448
|
}).catch(() => {
|
|
41387
41449
|
});
|
|
@@ -41390,7 +41452,7 @@ async function seekTo(page, time) {
|
|
|
41390
41452
|
async function bundleProjectHtml(projectDir) {
|
|
41391
41453
|
const { bundleToSingleHtml: bundleToSingleHtml2 } = await Promise.resolve().then(() => (init_compiler(), compiler_exports));
|
|
41392
41454
|
let html = await bundleToSingleHtml2(projectDir);
|
|
41393
|
-
const runtimePath =
|
|
41455
|
+
const runtimePath = resolve30(
|
|
41394
41456
|
__dirname2,
|
|
41395
41457
|
"..",
|
|
41396
41458
|
"..",
|
|
@@ -41458,7 +41520,7 @@ async function runLayoutAudit(projectDir, opts) {
|
|
|
41458
41520
|
if (!fonts?.ready) return Promise.resolve();
|
|
41459
41521
|
return Promise.race([
|
|
41460
41522
|
fonts.ready.then(() => void 0),
|
|
41461
|
-
new Promise((
|
|
41523
|
+
new Promise((resolve41) => setTimeout(resolve41, 750))
|
|
41462
41524
|
]);
|
|
41463
41525
|
}).catch(() => {
|
|
41464
41526
|
});
|
|
@@ -41800,7 +41862,7 @@ __export(compositions_exports, {
|
|
|
41800
41862
|
parseSubComposition: () => parseSubComposition
|
|
41801
41863
|
});
|
|
41802
41864
|
import { existsSync as existsSync45, readFileSync as readFileSync34 } from "fs";
|
|
41803
|
-
import { resolve as
|
|
41865
|
+
import { resolve as resolve31, dirname as dirname19 } from "path";
|
|
41804
41866
|
function countRenderableDescendants(root) {
|
|
41805
41867
|
return Array.from(root.querySelectorAll("*")).filter(
|
|
41806
41868
|
(el) => !NON_RENDERED_TAGS.has(el.tagName.toLowerCase())
|
|
@@ -41832,7 +41894,7 @@ function parseCompositions(html, baseDir) {
|
|
|
41832
41894
|
const height = parseInt(div.getAttribute("data-height") ?? "1080", 10);
|
|
41833
41895
|
const compositionSrc = div.getAttribute("data-composition-src");
|
|
41834
41896
|
if (compositionSrc) {
|
|
41835
|
-
const subPath =
|
|
41897
|
+
const subPath = resolve31(baseDir, compositionSrc);
|
|
41836
41898
|
if (existsSync45(subPath)) {
|
|
41837
41899
|
const subHtml = readFileSync34(subPath, "utf-8");
|
|
41838
41900
|
const subInfo = parseSubComposition(subHtml, id, width, height);
|
|
@@ -41976,7 +42038,7 @@ __export(benchmark_exports, {
|
|
|
41976
42038
|
examples: () => examples13
|
|
41977
42039
|
});
|
|
41978
42040
|
import { existsSync as existsSync46, statSync as statSync17 } from "fs";
|
|
41979
|
-
import { resolve as
|
|
42041
|
+
import { resolve as resolve32, join as join46 } from "path";
|
|
41980
42042
|
var examples13, DEFAULT_CONFIGS, benchmark_default;
|
|
41981
42043
|
var init_benchmark = __esm({
|
|
41982
42044
|
"src/commands/benchmark.ts"() {
|
|
@@ -42018,7 +42080,7 @@ var init_benchmark = __esm({
|
|
|
42018
42080
|
process.exit(1);
|
|
42019
42081
|
}
|
|
42020
42082
|
const jsonOutput = args.json ?? false;
|
|
42021
|
-
const benchDir =
|
|
42083
|
+
const benchDir = resolve32("renders", ".benchmark");
|
|
42022
42084
|
let producer = null;
|
|
42023
42085
|
try {
|
|
42024
42086
|
producer = await loadProducer();
|
|
@@ -42444,7 +42506,7 @@ async function postprocess(sharp, output, rgb2, width, height, maskBuf, rgbaBuf)
|
|
|
42444
42506
|
}
|
|
42445
42507
|
const fullMask = await sharp(maskBuf, {
|
|
42446
42508
|
raw: { width: INPUT_SIZE, height: INPUT_SIZE, channels: 1 }
|
|
42447
|
-
}).resize(width, height, { kernel: "lanczos3", fit: "fill" }).raw().toBuffer();
|
|
42509
|
+
}).resize(width, height, { kernel: "lanczos3", fit: "fill" }).toColourspace("b-w").raw().toBuffer();
|
|
42448
42510
|
for (let i2 = 0; i2 < width * height; i2++) {
|
|
42449
42511
|
rgbaBuf[i2 * 4] = rgb2[i2 * 3];
|
|
42450
42512
|
rgbaBuf[i2 * 4 + 1] = rgb2[i2 * 3 + 1];
|
|
@@ -42468,9 +42530,13 @@ var init_inference = __esm({
|
|
|
42468
42530
|
// src/background-removal/pipeline.ts
|
|
42469
42531
|
var pipeline_exports = {};
|
|
42470
42532
|
__export(pipeline_exports, {
|
|
42533
|
+
DEFAULT_QUALITY: () => DEFAULT_QUALITY,
|
|
42534
|
+
QUALITIES: () => QUALITIES,
|
|
42535
|
+
QUALITY_CRF: () => QUALITY_CRF,
|
|
42471
42536
|
buildEncoderArgs: () => buildEncoderArgs2,
|
|
42472
42537
|
inferInputKind: () => inferInputKind,
|
|
42473
42538
|
inferOutputFormat: () => inferOutputFormat,
|
|
42539
|
+
isQuality: () => isQuality,
|
|
42474
42540
|
render: () => render2,
|
|
42475
42541
|
waitForExit: () => waitForExit
|
|
42476
42542
|
});
|
|
@@ -42504,7 +42570,7 @@ async function probeMedia(inputPath) {
|
|
|
42504
42570
|
const frameCount = meta.durationSeconds ? Math.round(meta.durationSeconds * fps) : 0;
|
|
42505
42571
|
return { width: meta.width, height: meta.height, fps, frameCount };
|
|
42506
42572
|
}
|
|
42507
|
-
function buildEncoderArgs2(format, width, height, fps, outputPath) {
|
|
42573
|
+
function buildEncoderArgs2(format, width, height, fps, outputPath, quality = DEFAULT_QUALITY) {
|
|
42508
42574
|
const base = [
|
|
42509
42575
|
"-y",
|
|
42510
42576
|
"-f",
|
|
@@ -42526,7 +42592,7 @@ function buildEncoderArgs2(format, width, height, fps, outputPath) {
|
|
|
42526
42592
|
"-b:v",
|
|
42527
42593
|
"0",
|
|
42528
42594
|
"-crf",
|
|
42529
|
-
|
|
42595
|
+
String(QUALITY_CRF[quality]),
|
|
42530
42596
|
"-deadline",
|
|
42531
42597
|
"good",
|
|
42532
42598
|
"-row-mt",
|
|
@@ -42535,6 +42601,19 @@ function buildEncoderArgs2(format, width, height, fps, outputPath) {
|
|
|
42535
42601
|
"0",
|
|
42536
42602
|
"-pix_fmt",
|
|
42537
42603
|
"yuva420p",
|
|
42604
|
+
// Tag the output as BT.709 limited range so browsers use the same
|
|
42605
|
+
// YUV→RGB matrix the source video was encoded with. Without these tags
|
|
42606
|
+
// ffmpeg's default RGB→YUV conversion is BT.601, which causes a visible
|
|
42607
|
+
// color shift (red/skin tones in particular) when the matted overlay is
|
|
42608
|
+
// composited over the original mp4.
|
|
42609
|
+
"-colorspace",
|
|
42610
|
+
"bt709",
|
|
42611
|
+
"-color_primaries",
|
|
42612
|
+
"bt709",
|
|
42613
|
+
"-color_trc",
|
|
42614
|
+
"bt709",
|
|
42615
|
+
"-color_range",
|
|
42616
|
+
"tv",
|
|
42538
42617
|
"-metadata:s:v:0",
|
|
42539
42618
|
"alpha_mode=1",
|
|
42540
42619
|
"-an",
|
|
@@ -42628,9 +42707,20 @@ async function runPipeline(options, session, media, format) {
|
|
|
42628
42707
|
decoderStderr += d.toString();
|
|
42629
42708
|
});
|
|
42630
42709
|
const decoderExit = waitForExit(decoder, "ffmpeg decoder", () => decoderStderr);
|
|
42631
|
-
const encoder = spawn12(
|
|
42632
|
-
|
|
42633
|
-
|
|
42710
|
+
const encoder = spawn12(
|
|
42711
|
+
"ffmpeg",
|
|
42712
|
+
buildEncoderArgs2(
|
|
42713
|
+
format,
|
|
42714
|
+
width,
|
|
42715
|
+
height,
|
|
42716
|
+
fps || 30,
|
|
42717
|
+
outputPath,
|
|
42718
|
+
options.quality ?? DEFAULT_QUALITY
|
|
42719
|
+
),
|
|
42720
|
+
{
|
|
42721
|
+
stdio: ["pipe", "ignore", "pipe"]
|
|
42722
|
+
}
|
|
42723
|
+
);
|
|
42634
42724
|
let encoderStderr = "";
|
|
42635
42725
|
encoder.stderr?.on("data", (d) => {
|
|
42636
42726
|
encoderStderr += d.toString();
|
|
@@ -42652,7 +42742,7 @@ async function runPipeline(options, session, media, format) {
|
|
|
42652
42742
|
recentSlot = (recentSlot + 1) % RECENT_WINDOW;
|
|
42653
42743
|
if (recentCount < RECENT_WINDOW) recentCount++;
|
|
42654
42744
|
if (!encoder.stdin.write(rgba)) {
|
|
42655
|
-
await new Promise((
|
|
42745
|
+
await new Promise((resolve41) => encoder.stdin.once("drain", () => resolve41()));
|
|
42656
42746
|
}
|
|
42657
42747
|
processed++;
|
|
42658
42748
|
options.onProgress?.({
|
|
@@ -42678,11 +42768,11 @@ ${decoderStderr.slice(-400)}`
|
|
|
42678
42768
|
return processed;
|
|
42679
42769
|
}
|
|
42680
42770
|
function waitForExit(proc, label2, getStderr) {
|
|
42681
|
-
return new Promise((
|
|
42771
|
+
return new Promise((resolve41, reject) => {
|
|
42682
42772
|
proc.on("error", reject);
|
|
42683
42773
|
proc.on("exit", (code, signal) => {
|
|
42684
42774
|
if (code === 0 && !signal) {
|
|
42685
|
-
|
|
42775
|
+
resolve41();
|
|
42686
42776
|
return;
|
|
42687
42777
|
}
|
|
42688
42778
|
const cause = signal ? `killed by ${signal}` : `exited with code ${code}`;
|
|
@@ -42690,12 +42780,20 @@ function waitForExit(proc, label2, getStderr) {
|
|
|
42690
42780
|
});
|
|
42691
42781
|
});
|
|
42692
42782
|
}
|
|
42693
|
-
var VIDEO_EXTENSIONS2, IMAGE_EXTENSIONS, RECENT_WINDOW;
|
|
42783
|
+
var QUALITY_CRF, QUALITIES, DEFAULT_QUALITY, isQuality, VIDEO_EXTENSIONS2, IMAGE_EXTENSIONS, RECENT_WINDOW;
|
|
42694
42784
|
var init_pipeline = __esm({
|
|
42695
42785
|
"src/background-removal/pipeline.ts"() {
|
|
42696
42786
|
"use strict";
|
|
42697
42787
|
init_manager();
|
|
42698
42788
|
init_inference();
|
|
42789
|
+
QUALITY_CRF = {
|
|
42790
|
+
fast: 30,
|
|
42791
|
+
balanced: 18,
|
|
42792
|
+
best: 12
|
|
42793
|
+
};
|
|
42794
|
+
QUALITIES = Object.keys(QUALITY_CRF);
|
|
42795
|
+
DEFAULT_QUALITY = "balanced";
|
|
42796
|
+
isQuality = (v) => typeof v === "string" && QUALITIES.includes(v);
|
|
42699
42797
|
VIDEO_EXTENSIONS2 = /* @__PURE__ */ new Set([".mp4", ".mov", ".webm", ".mkv", ".avi"]);
|
|
42700
42798
|
IMAGE_EXTENSIONS = /* @__PURE__ */ new Set([".jpg", ".jpeg", ".png", ".webp"]);
|
|
42701
42799
|
RECENT_WINDOW = 30;
|
|
@@ -42708,7 +42806,7 @@ __export(remove_background_exports, {
|
|
|
42708
42806
|
default: () => remove_background_default,
|
|
42709
42807
|
examples: () => examples15
|
|
42710
42808
|
});
|
|
42711
|
-
import { resolve as
|
|
42809
|
+
import { resolve as resolve33 } from "path";
|
|
42712
42810
|
import { existsSync as existsSync48 } from "fs";
|
|
42713
42811
|
async function showInfo(json) {
|
|
42714
42812
|
const { selectProviders: selectProviders2, listAvailableProviders: listAvailableProviders2, DEFAULT_MODEL: DEFAULT_MODEL4, MODEL_MEMORY_MB: MODEL_MEMORY_MB2, modelPath: modelPath2 } = await Promise.resolve().then(() => (init_manager3(), manager_exports3));
|
|
@@ -42748,6 +42846,7 @@ var init_remove_background = __esm({
|
|
|
42748
42846
|
init_dist3();
|
|
42749
42847
|
init_colors();
|
|
42750
42848
|
init_manager3();
|
|
42849
|
+
init_pipeline();
|
|
42751
42850
|
examples15 = [
|
|
42752
42851
|
[
|
|
42753
42852
|
"Remove background from a video, output transparent VP9 WebM (default)",
|
|
@@ -42765,6 +42864,14 @@ var init_remove_background = __esm({
|
|
|
42765
42864
|
"Force CPU (skip CoreML/CUDA)",
|
|
42766
42865
|
"hyperframes remove-background avatar.mp4 -o transparent.webm --device cpu"
|
|
42767
42866
|
],
|
|
42867
|
+
[
|
|
42868
|
+
"Smaller file at the cost of color match (text-behind-subject won't blend as cleanly)",
|
|
42869
|
+
"hyperframes remove-background avatar.mp4 -o transparent.webm --quality fast"
|
|
42870
|
+
],
|
|
42871
|
+
[
|
|
42872
|
+
"Visually-lossless WebM (master / re-encode source)",
|
|
42873
|
+
"hyperframes remove-background avatar.mp4 -o transparent.webm --quality best"
|
|
42874
|
+
],
|
|
42768
42875
|
["Show detected providers without rendering", "hyperframes remove-background --info"]
|
|
42769
42876
|
];
|
|
42770
42877
|
remove_background_default = defineCommand({
|
|
@@ -42788,6 +42895,11 @@ var init_remove_background = __esm({
|
|
|
42788
42895
|
description: `Execution provider: ${DEVICES.join(", ")}`,
|
|
42789
42896
|
default: "auto"
|
|
42790
42897
|
},
|
|
42898
|
+
quality: {
|
|
42899
|
+
type: "string",
|
|
42900
|
+
description: `Encoder quality preset for .webm output: ${QUALITIES.join(", ")} (default: ${DEFAULT_QUALITY}). Higher quality = closer color match when overlaying on the source mp4, larger file. Ignored for .mov / .png.`,
|
|
42901
|
+
default: DEFAULT_QUALITY
|
|
42902
|
+
},
|
|
42791
42903
|
info: {
|
|
42792
42904
|
type: "boolean",
|
|
42793
42905
|
description: "Print detected execution providers and exit (no render)",
|
|
@@ -42821,8 +42933,14 @@ var init_remove_background = __esm({
|
|
|
42821
42933
|
);
|
|
42822
42934
|
process.exit(1);
|
|
42823
42935
|
}
|
|
42824
|
-
|
|
42825
|
-
|
|
42936
|
+
if (!isQuality(args.quality)) {
|
|
42937
|
+
console.error(
|
|
42938
|
+
c.error(`Invalid --quality '${String(args.quality)}'. Use: ${QUALITIES.join(", ")}.`)
|
|
42939
|
+
);
|
|
42940
|
+
process.exit(1);
|
|
42941
|
+
}
|
|
42942
|
+
const inputPath = resolve33(args.input);
|
|
42943
|
+
const outputPath = resolve33(args.output);
|
|
42826
42944
|
const { render: render3 } = await Promise.resolve().then(() => (init_pipeline(), pipeline_exports));
|
|
42827
42945
|
const spin = args.json ? null : be();
|
|
42828
42946
|
spin?.start("Preparing background-removal pipeline...");
|
|
@@ -42831,6 +42949,7 @@ var init_remove_background = __esm({
|
|
|
42831
42949
|
inputPath,
|
|
42832
42950
|
outputPath,
|
|
42833
42951
|
device: args.device,
|
|
42952
|
+
quality: args.quality,
|
|
42834
42953
|
onProgress: (event) => {
|
|
42835
42954
|
if (event.kind === "info") {
|
|
42836
42955
|
spin?.message(event.message);
|
|
@@ -42887,7 +43006,7 @@ __export(transcribe_exports2, {
|
|
|
42887
43006
|
examples: () => examples16
|
|
42888
43007
|
});
|
|
42889
43008
|
import { existsSync as existsSync49, writeFileSync as writeFileSync20 } from "fs";
|
|
42890
|
-
import { resolve as
|
|
43009
|
+
import { resolve as resolve34, join as join48, extname as extname9 } from "path";
|
|
42891
43010
|
async function importTranscript(inputPath, dir, json) {
|
|
42892
43011
|
const { loadTranscript: loadTranscript2, patchCaptionHtml: patchCaptionHtml2 } = await Promise.resolve().then(() => (init_normalize(), normalize_exports));
|
|
42893
43012
|
const { words, format } = loadTranscript2(inputPath);
|
|
@@ -43011,12 +43130,12 @@ var init_transcribe2 = __esm({
|
|
|
43011
43130
|
}
|
|
43012
43131
|
},
|
|
43013
43132
|
async run({ args }) {
|
|
43014
|
-
const inputPath =
|
|
43133
|
+
const inputPath = resolve34(args.input);
|
|
43015
43134
|
if (!existsSync49(inputPath)) {
|
|
43016
43135
|
console.error(c.error(`File not found: ${args.input}`));
|
|
43017
43136
|
process.exit(1);
|
|
43018
43137
|
}
|
|
43019
|
-
const dir =
|
|
43138
|
+
const dir = resolve34(args.dir ?? ".");
|
|
43020
43139
|
const ext = extname9(inputPath).toLowerCase();
|
|
43021
43140
|
const isImport = ext === ".json" || ext === ".srt" || ext === ".vtt";
|
|
43022
43141
|
if (isImport) {
|
|
@@ -43306,7 +43425,7 @@ __export(tts_exports, {
|
|
|
43306
43425
|
examples: () => examples17
|
|
43307
43426
|
});
|
|
43308
43427
|
import { existsSync as existsSync52, readFileSync as readFileSync35 } from "fs";
|
|
43309
|
-
import { resolve as
|
|
43428
|
+
import { resolve as resolve35, extname as extname10 } from "path";
|
|
43310
43429
|
function listVoices(json) {
|
|
43311
43430
|
const rows = BUNDLED_VOICES.map((v) => ({ ...v, defaultLang: inferLangFromVoiceId(v.id) }));
|
|
43312
43431
|
if (json) {
|
|
@@ -43414,7 +43533,7 @@ var init_tts = __esm({
|
|
|
43414
43533
|
process.exit(1);
|
|
43415
43534
|
}
|
|
43416
43535
|
let text;
|
|
43417
|
-
const maybeFile =
|
|
43536
|
+
const maybeFile = resolve35(args.input);
|
|
43418
43537
|
if (existsSync52(maybeFile) && extname10(maybeFile).toLowerCase() === ".txt") {
|
|
43419
43538
|
text = readFileSync35(maybeFile, "utf-8").trim();
|
|
43420
43539
|
if (!text) {
|
|
@@ -43428,7 +43547,7 @@ var init_tts = __esm({
|
|
|
43428
43547
|
console.error(c.error("No text provided."));
|
|
43429
43548
|
process.exit(1);
|
|
43430
43549
|
}
|
|
43431
|
-
const output =
|
|
43550
|
+
const output = resolve35(args.output ?? "speech.wav");
|
|
43432
43551
|
const voice = args.voice ?? DEFAULT_VOICE;
|
|
43433
43552
|
const speed = args.speed ? parseFloat(args.speed) : 1;
|
|
43434
43553
|
if (isNaN(speed) || speed <= 0 || speed > 3) {
|
|
@@ -43509,13 +43628,13 @@ __export(docs_exports, {
|
|
|
43509
43628
|
examples: () => examples18
|
|
43510
43629
|
});
|
|
43511
43630
|
import { readFileSync as readFileSync36, existsSync as existsSync53 } from "fs";
|
|
43512
|
-
import { resolve as
|
|
43631
|
+
import { resolve as resolve36, dirname as dirname21, join as join51 } from "path";
|
|
43513
43632
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
43514
43633
|
function docsDir() {
|
|
43515
43634
|
const thisFile = fileURLToPath7(import.meta.url);
|
|
43516
43635
|
const dir = dirname21(thisFile);
|
|
43517
|
-
const devPath =
|
|
43518
|
-
const builtPath =
|
|
43636
|
+
const devPath = resolve36(dir, "..", "docs");
|
|
43637
|
+
const builtPath = resolve36(dir, "docs");
|
|
43519
43638
|
return existsSync53(devPath) ? devPath : builtPath;
|
|
43520
43639
|
}
|
|
43521
43640
|
function formatInlineCode(line) {
|
|
@@ -44062,7 +44181,7 @@ __export(validate_exports, {
|
|
|
44062
44181
|
shouldIgnoreRequestFailure: () => shouldIgnoreRequestFailure
|
|
44063
44182
|
});
|
|
44064
44183
|
import { existsSync as existsSync54, readFileSync as readFileSync37 } from "fs";
|
|
44065
|
-
import { resolve as
|
|
44184
|
+
import { resolve as resolve37, join as join52, dirname as dirname22 } from "path";
|
|
44066
44185
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
44067
44186
|
function shouldIgnoreRequestFailure(url, errorText) {
|
|
44068
44187
|
if (errorText !== "net::ERR_ABORTED") return false;
|
|
@@ -44126,7 +44245,7 @@ async function validateInBrowser(projectDir, opts) {
|
|
|
44126
44245
|
const { bundleToSingleHtml: bundleToSingleHtml2 } = await Promise.resolve().then(() => (init_compiler(), compiler_exports));
|
|
44127
44246
|
const { ensureBrowser: ensureBrowser2 } = await Promise.resolve().then(() => (init_manager2(), manager_exports2));
|
|
44128
44247
|
let html = await bundleToSingleHtml2(projectDir);
|
|
44129
|
-
const runtimePath =
|
|
44248
|
+
const runtimePath = resolve37(
|
|
44130
44249
|
__dirname3,
|
|
44131
44250
|
"..",
|
|
44132
44251
|
"..",
|
|
@@ -44350,7 +44469,7 @@ __export(snapshot_exports, {
|
|
|
44350
44469
|
import { spawn as spawn13 } from "child_process";
|
|
44351
44470
|
import { existsSync as existsSync55, mkdtempSync as mkdtempSync3, readFileSync as readFileSync38, mkdirSync as mkdirSync28, rmSync as rmSync10 } from "fs";
|
|
44352
44471
|
import { tmpdir as tmpdir5 } from "os";
|
|
44353
|
-
import { resolve as
|
|
44472
|
+
import { resolve as resolve38, join as join53, relative as relative6, isAbsolute as isAbsolute7 } from "path";
|
|
44354
44473
|
async function extractVideoFrameToBuffer(videoPath, timeSeconds, useVp9AlphaDecoder = false) {
|
|
44355
44474
|
const tmp = mkdtempSync3(join53(tmpdir5(), "hf-snapshot-frame-"));
|
|
44356
44475
|
const outPath = join53(tmp, "frame.png");
|
|
@@ -44547,7 +44666,7 @@ async function captureSnapshots(projectDir, opts) {
|
|
|
44547
44666
|
try {
|
|
44548
44667
|
const url = new URL(v.src);
|
|
44549
44668
|
const decodedPath = decodeURIComponent(url.pathname).replace(/^\//, "");
|
|
44550
|
-
const candidate =
|
|
44669
|
+
const candidate = resolve38(projectDir, decodedPath);
|
|
44551
44670
|
const rel = relative6(projectDir, candidate);
|
|
44552
44671
|
if (!rel.startsWith("..") && !isAbsolute7(rel) && existsSync55(candidate)) {
|
|
44553
44672
|
filePath = candidate;
|
|
@@ -45043,7 +45162,7 @@ async function extractHtml(page, opts = {}) {
|
|
|
45043
45162
|
(_match, pre, urls, post) => {
|
|
45044
45163
|
const fixed = urls.replace(/&/g, "&").replace(
|
|
45045
45164
|
/(^|,\s*)(\/[^\s,]+)/g,
|
|
45046
|
-
(_m,
|
|
45165
|
+
(_m, sep5, path2) => sep5 + pageOrigin + path2
|
|
45047
45166
|
);
|
|
45048
45167
|
return pre + fixed + post;
|
|
45049
45168
|
}
|
|
@@ -46140,7 +46259,7 @@ var require_p_retry = __commonJS({
|
|
|
46140
46259
|
return error;
|
|
46141
46260
|
};
|
|
46142
46261
|
var isNetworkError = (errorMessage) => networkErrorMsgs.includes(errorMessage);
|
|
46143
|
-
var pRetry2 = (input, options) => new Promise((
|
|
46262
|
+
var pRetry2 = (input, options) => new Promise((resolve41, reject) => {
|
|
46144
46263
|
options = {
|
|
46145
46264
|
onFailedAttempt: () => {
|
|
46146
46265
|
},
|
|
@@ -46150,7 +46269,7 @@ var require_p_retry = __commonJS({
|
|
|
46150
46269
|
const operation = retry.operation(options);
|
|
46151
46270
|
operation.attempt(async (attemptNumber) => {
|
|
46152
46271
|
try {
|
|
46153
|
-
|
|
46272
|
+
resolve41(await input(attemptNumber));
|
|
46154
46273
|
} catch (error) {
|
|
46155
46274
|
if (!(error instanceof Error)) {
|
|
46156
46275
|
reject(new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`));
|
|
@@ -46686,8 +46805,8 @@ var require_retry3 = __commonJS({
|
|
|
46686
46805
|
}
|
|
46687
46806
|
const delay = getNextRetryDelay(config);
|
|
46688
46807
|
err.config.retryConfig.currentRetryAttempt += 1;
|
|
46689
|
-
const backoff = config.retryBackoff ? config.retryBackoff(err, delay) : new Promise((
|
|
46690
|
-
setTimeout(
|
|
46808
|
+
const backoff = config.retryBackoff ? config.retryBackoff(err, delay) : new Promise((resolve41) => {
|
|
46809
|
+
setTimeout(resolve41, delay);
|
|
46691
46810
|
});
|
|
46692
46811
|
if (config.onRetryAttempt) {
|
|
46693
46812
|
await config.onRetryAttempt(err);
|
|
@@ -47595,8 +47714,8 @@ var require_helpers = __commonJS({
|
|
|
47595
47714
|
function req(url, opts = {}) {
|
|
47596
47715
|
const href = typeof url === "string" ? url : url.href;
|
|
47597
47716
|
const req2 = (href.startsWith("https:") ? https2 : http4).request(url, opts);
|
|
47598
|
-
const promise = new Promise((
|
|
47599
|
-
req2.once("response",
|
|
47717
|
+
const promise = new Promise((resolve41, reject) => {
|
|
47718
|
+
req2.once("response", resolve41).once("error", reject).end();
|
|
47600
47719
|
});
|
|
47601
47720
|
req2.then = promise.then.bind(promise);
|
|
47602
47721
|
return req2;
|
|
@@ -47773,7 +47892,7 @@ var require_parse_proxy_response = __commonJS({
|
|
|
47773
47892
|
var debug_1 = __importDefault(require_src2());
|
|
47774
47893
|
var debug = (0, debug_1.default)("https-proxy-agent:parse-proxy-response");
|
|
47775
47894
|
function parseProxyResponse(socket) {
|
|
47776
|
-
return new Promise((
|
|
47895
|
+
return new Promise((resolve41, reject) => {
|
|
47777
47896
|
let buffersLength = 0;
|
|
47778
47897
|
const buffers = [];
|
|
47779
47898
|
function read() {
|
|
@@ -47839,7 +47958,7 @@ var require_parse_proxy_response = __commonJS({
|
|
|
47839
47958
|
}
|
|
47840
47959
|
debug("got proxy server response: %o %o", firstLine, headers);
|
|
47841
47960
|
cleanup();
|
|
47842
|
-
|
|
47961
|
+
resolve41({
|
|
47843
47962
|
connect: {
|
|
47844
47963
|
statusCode,
|
|
47845
47964
|
statusText,
|
|
@@ -48083,7 +48202,7 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
48083
48202
|
return new originalPromise(executor);
|
|
48084
48203
|
}
|
|
48085
48204
|
function promiseResolvedWith(value) {
|
|
48086
|
-
return newPromise((
|
|
48205
|
+
return newPromise((resolve41) => resolve41(value));
|
|
48087
48206
|
}
|
|
48088
48207
|
function promiseRejectedWith(reason) {
|
|
48089
48208
|
return originalPromiseReject(reason);
|
|
@@ -48253,8 +48372,8 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
48253
48372
|
return new TypeError("Cannot " + name + " a stream using a released reader");
|
|
48254
48373
|
}
|
|
48255
48374
|
function defaultReaderClosedPromiseInitialize(reader) {
|
|
48256
|
-
reader._closedPromise = newPromise((
|
|
48257
|
-
reader._closedPromise_resolve =
|
|
48375
|
+
reader._closedPromise = newPromise((resolve41, reject) => {
|
|
48376
|
+
reader._closedPromise_resolve = resolve41;
|
|
48258
48377
|
reader._closedPromise_reject = reject;
|
|
48259
48378
|
});
|
|
48260
48379
|
}
|
|
@@ -48428,8 +48547,8 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
48428
48547
|
}
|
|
48429
48548
|
let resolvePromise;
|
|
48430
48549
|
let rejectPromise;
|
|
48431
|
-
const promise = newPromise((
|
|
48432
|
-
resolvePromise =
|
|
48550
|
+
const promise = newPromise((resolve41, reject) => {
|
|
48551
|
+
resolvePromise = resolve41;
|
|
48433
48552
|
rejectPromise = reject;
|
|
48434
48553
|
});
|
|
48435
48554
|
const readRequest = {
|
|
@@ -48534,8 +48653,8 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
48534
48653
|
const reader = this._reader;
|
|
48535
48654
|
let resolvePromise;
|
|
48536
48655
|
let rejectPromise;
|
|
48537
|
-
const promise = newPromise((
|
|
48538
|
-
resolvePromise =
|
|
48656
|
+
const promise = newPromise((resolve41, reject) => {
|
|
48657
|
+
resolvePromise = resolve41;
|
|
48539
48658
|
rejectPromise = reject;
|
|
48540
48659
|
});
|
|
48541
48660
|
const readRequest = {
|
|
@@ -49554,8 +49673,8 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
49554
49673
|
}
|
|
49555
49674
|
let resolvePromise;
|
|
49556
49675
|
let rejectPromise;
|
|
49557
|
-
const promise = newPromise((
|
|
49558
|
-
resolvePromise =
|
|
49676
|
+
const promise = newPromise((resolve41, reject) => {
|
|
49677
|
+
resolvePromise = resolve41;
|
|
49559
49678
|
rejectPromise = reject;
|
|
49560
49679
|
});
|
|
49561
49680
|
const readIntoRequest = {
|
|
@@ -49867,10 +49986,10 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
49867
49986
|
wasAlreadyErroring = true;
|
|
49868
49987
|
reason = void 0;
|
|
49869
49988
|
}
|
|
49870
|
-
const promise = newPromise((
|
|
49989
|
+
const promise = newPromise((resolve41, reject) => {
|
|
49871
49990
|
stream._pendingAbortRequest = {
|
|
49872
49991
|
_promise: void 0,
|
|
49873
|
-
_resolve:
|
|
49992
|
+
_resolve: resolve41,
|
|
49874
49993
|
_reject: reject,
|
|
49875
49994
|
_reason: reason,
|
|
49876
49995
|
_wasAlreadyErroring: wasAlreadyErroring
|
|
@@ -49887,9 +50006,9 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
49887
50006
|
if (state === "closed" || state === "errored") {
|
|
49888
50007
|
return promiseRejectedWith(new TypeError(`The stream (in ${state} state) is not in the writable state and cannot be closed`));
|
|
49889
50008
|
}
|
|
49890
|
-
const promise = newPromise((
|
|
50009
|
+
const promise = newPromise((resolve41, reject) => {
|
|
49891
50010
|
const closeRequest = {
|
|
49892
|
-
_resolve:
|
|
50011
|
+
_resolve: resolve41,
|
|
49893
50012
|
_reject: reject
|
|
49894
50013
|
};
|
|
49895
50014
|
stream._closeRequest = closeRequest;
|
|
@@ -49902,9 +50021,9 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
49902
50021
|
return promise;
|
|
49903
50022
|
}
|
|
49904
50023
|
function WritableStreamAddWriteRequest(stream) {
|
|
49905
|
-
const promise = newPromise((
|
|
50024
|
+
const promise = newPromise((resolve41, reject) => {
|
|
49906
50025
|
const writeRequest = {
|
|
49907
|
-
_resolve:
|
|
50026
|
+
_resolve: resolve41,
|
|
49908
50027
|
_reject: reject
|
|
49909
50028
|
};
|
|
49910
50029
|
stream._writeRequests.push(writeRequest);
|
|
@@ -50520,8 +50639,8 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
50520
50639
|
return new TypeError("Cannot " + name + " a stream using a released writer");
|
|
50521
50640
|
}
|
|
50522
50641
|
function defaultWriterClosedPromiseInitialize(writer) {
|
|
50523
|
-
writer._closedPromise = newPromise((
|
|
50524
|
-
writer._closedPromise_resolve =
|
|
50642
|
+
writer._closedPromise = newPromise((resolve41, reject) => {
|
|
50643
|
+
writer._closedPromise_resolve = resolve41;
|
|
50525
50644
|
writer._closedPromise_reject = reject;
|
|
50526
50645
|
writer._closedPromiseState = "pending";
|
|
50527
50646
|
});
|
|
@@ -50557,8 +50676,8 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
50557
50676
|
writer._closedPromiseState = "resolved";
|
|
50558
50677
|
}
|
|
50559
50678
|
function defaultWriterReadyPromiseInitialize(writer) {
|
|
50560
|
-
writer._readyPromise = newPromise((
|
|
50561
|
-
writer._readyPromise_resolve =
|
|
50679
|
+
writer._readyPromise = newPromise((resolve41, reject) => {
|
|
50680
|
+
writer._readyPromise_resolve = resolve41;
|
|
50562
50681
|
writer._readyPromise_reject = reject;
|
|
50563
50682
|
});
|
|
50564
50683
|
writer._readyPromiseState = "pending";
|
|
@@ -50645,7 +50764,7 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
50645
50764
|
source._disturbed = true;
|
|
50646
50765
|
let shuttingDown = false;
|
|
50647
50766
|
let currentWrite = promiseResolvedWith(void 0);
|
|
50648
|
-
return newPromise((
|
|
50767
|
+
return newPromise((resolve41, reject) => {
|
|
50649
50768
|
let abortAlgorithm;
|
|
50650
50769
|
if (signal !== void 0) {
|
|
50651
50770
|
abortAlgorithm = () => {
|
|
@@ -50790,7 +50909,7 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
50790
50909
|
if (isError) {
|
|
50791
50910
|
reject(error);
|
|
50792
50911
|
} else {
|
|
50793
|
-
|
|
50912
|
+
resolve41(void 0);
|
|
50794
50913
|
}
|
|
50795
50914
|
return null;
|
|
50796
50915
|
}
|
|
@@ -51071,8 +51190,8 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
51071
51190
|
let branch1;
|
|
51072
51191
|
let branch2;
|
|
51073
51192
|
let resolveCancelPromise;
|
|
51074
|
-
const cancelPromise = newPromise((
|
|
51075
|
-
resolveCancelPromise =
|
|
51193
|
+
const cancelPromise = newPromise((resolve41) => {
|
|
51194
|
+
resolveCancelPromise = resolve41;
|
|
51076
51195
|
});
|
|
51077
51196
|
function pullAlgorithm() {
|
|
51078
51197
|
if (reading) {
|
|
@@ -51163,8 +51282,8 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
51163
51282
|
let branch1;
|
|
51164
51283
|
let branch2;
|
|
51165
51284
|
let resolveCancelPromise;
|
|
51166
|
-
const cancelPromise = newPromise((
|
|
51167
|
-
resolveCancelPromise =
|
|
51285
|
+
const cancelPromise = newPromise((resolve41) => {
|
|
51286
|
+
resolveCancelPromise = resolve41;
|
|
51168
51287
|
});
|
|
51169
51288
|
function forwardReaderError(thisReader) {
|
|
51170
51289
|
uponRejection(thisReader._closedPromise, (r2) => {
|
|
@@ -51944,8 +52063,8 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
51944
52063
|
const writableHighWaterMark = ExtractHighWaterMark(writableStrategy, 1);
|
|
51945
52064
|
const writableSizeAlgorithm = ExtractSizeAlgorithm(writableStrategy);
|
|
51946
52065
|
let startPromise_resolve;
|
|
51947
|
-
const startPromise = newPromise((
|
|
51948
|
-
startPromise_resolve =
|
|
52066
|
+
const startPromise = newPromise((resolve41) => {
|
|
52067
|
+
startPromise_resolve = resolve41;
|
|
51949
52068
|
});
|
|
51950
52069
|
InitializeTransformStream(this, startPromise, writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark, readableSizeAlgorithm);
|
|
51951
52070
|
SetUpTransformStreamDefaultControllerFromTransformer(this, transformer);
|
|
@@ -52038,8 +52157,8 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
52038
52157
|
if (stream._backpressureChangePromise !== void 0) {
|
|
52039
52158
|
stream._backpressureChangePromise_resolve();
|
|
52040
52159
|
}
|
|
52041
|
-
stream._backpressureChangePromise = newPromise((
|
|
52042
|
-
stream._backpressureChangePromise_resolve =
|
|
52160
|
+
stream._backpressureChangePromise = newPromise((resolve41) => {
|
|
52161
|
+
stream._backpressureChangePromise_resolve = resolve41;
|
|
52043
52162
|
});
|
|
52044
52163
|
stream._backpressure = backpressure;
|
|
52045
52164
|
}
|
|
@@ -52207,8 +52326,8 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
52207
52326
|
return controller._finishPromise;
|
|
52208
52327
|
}
|
|
52209
52328
|
const readable = stream._readable;
|
|
52210
|
-
controller._finishPromise = newPromise((
|
|
52211
|
-
controller._finishPromise_resolve =
|
|
52329
|
+
controller._finishPromise = newPromise((resolve41, reject) => {
|
|
52330
|
+
controller._finishPromise_resolve = resolve41;
|
|
52212
52331
|
controller._finishPromise_reject = reject;
|
|
52213
52332
|
});
|
|
52214
52333
|
const cancelPromise = controller._cancelAlgorithm(reason);
|
|
@@ -52234,8 +52353,8 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
52234
52353
|
return controller._finishPromise;
|
|
52235
52354
|
}
|
|
52236
52355
|
const readable = stream._readable;
|
|
52237
|
-
controller._finishPromise = newPromise((
|
|
52238
|
-
controller._finishPromise_resolve =
|
|
52356
|
+
controller._finishPromise = newPromise((resolve41, reject) => {
|
|
52357
|
+
controller._finishPromise_resolve = resolve41;
|
|
52239
52358
|
controller._finishPromise_reject = reject;
|
|
52240
52359
|
});
|
|
52241
52360
|
const flushPromise = controller._flushAlgorithm();
|
|
@@ -52265,8 +52384,8 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
52265
52384
|
return controller._finishPromise;
|
|
52266
52385
|
}
|
|
52267
52386
|
const writable = stream._writable;
|
|
52268
|
-
controller._finishPromise = newPromise((
|
|
52269
|
-
controller._finishPromise_resolve =
|
|
52387
|
+
controller._finishPromise = newPromise((resolve41, reject) => {
|
|
52388
|
+
controller._finishPromise_resolve = resolve41;
|
|
52270
52389
|
controller._finishPromise_reject = reject;
|
|
52271
52390
|
});
|
|
52272
52391
|
const cancelPromise = controller._cancelAlgorithm(reason);
|
|
@@ -54235,7 +54354,7 @@ import zlib from "zlib";
|
|
|
54235
54354
|
import Stream2, { PassThrough as PassThrough2, pipeline as pump } from "stream";
|
|
54236
54355
|
import { Buffer as Buffer3 } from "buffer";
|
|
54237
54356
|
async function fetch3(url, options_) {
|
|
54238
|
-
return new Promise((
|
|
54357
|
+
return new Promise((resolve41, reject) => {
|
|
54239
54358
|
const request = new Request2(url, options_);
|
|
54240
54359
|
const { parsedURL, options } = getNodeRequestOptions(request);
|
|
54241
54360
|
if (!supportedSchemas.has(parsedURL.protocol)) {
|
|
@@ -54244,7 +54363,7 @@ async function fetch3(url, options_) {
|
|
|
54244
54363
|
if (parsedURL.protocol === "data:") {
|
|
54245
54364
|
const data = dist_default(request.url);
|
|
54246
54365
|
const response2 = new Response2(data, { headers: { "Content-Type": data.typeFull } });
|
|
54247
|
-
|
|
54366
|
+
resolve41(response2);
|
|
54248
54367
|
return;
|
|
54249
54368
|
}
|
|
54250
54369
|
const send = (parsedURL.protocol === "https:" ? https : http3).request;
|
|
@@ -54366,7 +54485,7 @@ async function fetch3(url, options_) {
|
|
|
54366
54485
|
if (responseReferrerPolicy) {
|
|
54367
54486
|
requestOptions.referrerPolicy = responseReferrerPolicy;
|
|
54368
54487
|
}
|
|
54369
|
-
|
|
54488
|
+
resolve41(fetch3(new Request2(locationURL, requestOptions)));
|
|
54370
54489
|
finalize();
|
|
54371
54490
|
return;
|
|
54372
54491
|
}
|
|
@@ -54399,7 +54518,7 @@ async function fetch3(url, options_) {
|
|
|
54399
54518
|
const codings = headers.get("Content-Encoding");
|
|
54400
54519
|
if (!request.compress || request.method === "HEAD" || codings === null || response_.statusCode === 204 || response_.statusCode === 304) {
|
|
54401
54520
|
response = new Response2(body, responseOptions);
|
|
54402
|
-
|
|
54521
|
+
resolve41(response);
|
|
54403
54522
|
return;
|
|
54404
54523
|
}
|
|
54405
54524
|
const zlibOptions = {
|
|
@@ -54413,7 +54532,7 @@ async function fetch3(url, options_) {
|
|
|
54413
54532
|
}
|
|
54414
54533
|
});
|
|
54415
54534
|
response = new Response2(body, responseOptions);
|
|
54416
|
-
|
|
54535
|
+
resolve41(response);
|
|
54417
54536
|
return;
|
|
54418
54537
|
}
|
|
54419
54538
|
if (codings === "deflate" || codings === "x-deflate") {
|
|
@@ -54437,12 +54556,12 @@ async function fetch3(url, options_) {
|
|
|
54437
54556
|
});
|
|
54438
54557
|
}
|
|
54439
54558
|
response = new Response2(body, responseOptions);
|
|
54440
|
-
|
|
54559
|
+
resolve41(response);
|
|
54441
54560
|
});
|
|
54442
54561
|
raw.once("end", () => {
|
|
54443
54562
|
if (!response) {
|
|
54444
54563
|
response = new Response2(body, responseOptions);
|
|
54445
|
-
|
|
54564
|
+
resolve41(response);
|
|
54446
54565
|
}
|
|
54447
54566
|
});
|
|
54448
54567
|
return;
|
|
@@ -54454,11 +54573,11 @@ async function fetch3(url, options_) {
|
|
|
54454
54573
|
}
|
|
54455
54574
|
});
|
|
54456
54575
|
response = new Response2(body, responseOptions);
|
|
54457
|
-
|
|
54576
|
+
resolve41(response);
|
|
54458
54577
|
return;
|
|
54459
54578
|
}
|
|
54460
54579
|
response = new Response2(body, responseOptions);
|
|
54461
|
-
|
|
54580
|
+
resolve41(response);
|
|
54462
54581
|
});
|
|
54463
54582
|
writeToStream(request_, request).catch(reject);
|
|
54464
54583
|
});
|
|
@@ -60540,7 +60659,7 @@ var require_jwtaccess = __commonJS({
|
|
|
60540
60659
|
}
|
|
60541
60660
|
}
|
|
60542
60661
|
fromStreamAsync(inputStream) {
|
|
60543
|
-
return new Promise((
|
|
60662
|
+
return new Promise((resolve41, reject) => {
|
|
60544
60663
|
if (!inputStream) {
|
|
60545
60664
|
reject(new Error("Must pass in a stream containing the service account auth settings."));
|
|
60546
60665
|
}
|
|
@@ -60549,7 +60668,7 @@ var require_jwtaccess = __commonJS({
|
|
|
60549
60668
|
try {
|
|
60550
60669
|
const data = JSON.parse(s2);
|
|
60551
60670
|
this.fromJSON(data);
|
|
60552
|
-
|
|
60671
|
+
resolve41();
|
|
60553
60672
|
} catch (err) {
|
|
60554
60673
|
reject(err);
|
|
60555
60674
|
}
|
|
@@ -60788,7 +60907,7 @@ var require_jwtclient = __commonJS({
|
|
|
60788
60907
|
}
|
|
60789
60908
|
}
|
|
60790
60909
|
fromStreamAsync(inputStream) {
|
|
60791
|
-
return new Promise((
|
|
60910
|
+
return new Promise((resolve41, reject) => {
|
|
60792
60911
|
if (!inputStream) {
|
|
60793
60912
|
throw new Error("Must pass in a stream containing the service account auth settings.");
|
|
60794
60913
|
}
|
|
@@ -60797,7 +60916,7 @@ var require_jwtclient = __commonJS({
|
|
|
60797
60916
|
try {
|
|
60798
60917
|
const data = JSON.parse(s2);
|
|
60799
60918
|
this.fromJSON(data);
|
|
60800
|
-
|
|
60919
|
+
resolve41();
|
|
60801
60920
|
} catch (e2) {
|
|
60802
60921
|
reject(e2);
|
|
60803
60922
|
}
|
|
@@ -60930,7 +61049,7 @@ var require_refreshclient = __commonJS({
|
|
|
60930
61049
|
}
|
|
60931
61050
|
}
|
|
60932
61051
|
async fromStreamAsync(inputStream) {
|
|
60933
|
-
return new Promise((
|
|
61052
|
+
return new Promise((resolve41, reject) => {
|
|
60934
61053
|
if (!inputStream) {
|
|
60935
61054
|
return reject(new Error("Must pass in a stream containing the user refresh token."));
|
|
60936
61055
|
}
|
|
@@ -60939,7 +61058,7 @@ var require_refreshclient = __commonJS({
|
|
|
60939
61058
|
try {
|
|
60940
61059
|
const data = JSON.parse(s2);
|
|
60941
61060
|
this.fromJSON(data);
|
|
60942
|
-
return
|
|
61061
|
+
return resolve41();
|
|
60943
61062
|
} catch (err) {
|
|
60944
61063
|
return reject(err);
|
|
60945
61064
|
}
|
|
@@ -62772,7 +62891,7 @@ var require_pluggable_auth_handler = __commonJS({
|
|
|
62772
62891
|
* @return A promise that resolves with the executable response.
|
|
62773
62892
|
*/
|
|
62774
62893
|
retrieveResponseFromExecutable(envMap) {
|
|
62775
|
-
return new Promise((
|
|
62894
|
+
return new Promise((resolve41, reject) => {
|
|
62776
62895
|
const child = childProcess.spawn(this.commandComponents[0], this.commandComponents.slice(1), {
|
|
62777
62896
|
env: { ...process.env, ...Object.fromEntries(envMap) }
|
|
62778
62897
|
});
|
|
@@ -62794,7 +62913,7 @@ var require_pluggable_auth_handler = __commonJS({
|
|
|
62794
62913
|
try {
|
|
62795
62914
|
const responseJson = JSON.parse(output);
|
|
62796
62915
|
const response = new executable_response_1.ExecutableResponse(responseJson);
|
|
62797
|
-
return
|
|
62916
|
+
return resolve41(response);
|
|
62798
62917
|
} catch (error) {
|
|
62799
62918
|
if (error instanceof executable_response_1.ExecutableResponseError) {
|
|
62800
62919
|
return reject(error);
|
|
@@ -63697,7 +63816,7 @@ var require_googleauth = __commonJS({
|
|
|
63697
63816
|
}
|
|
63698
63817
|
}
|
|
63699
63818
|
fromStreamAsync(inputStream, options) {
|
|
63700
|
-
return new Promise((
|
|
63819
|
+
return new Promise((resolve41, reject) => {
|
|
63701
63820
|
if (!inputStream) {
|
|
63702
63821
|
throw new Error("Must pass in a stream containing the Google auth settings.");
|
|
63703
63822
|
}
|
|
@@ -63707,7 +63826,7 @@ var require_googleauth = __commonJS({
|
|
|
63707
63826
|
try {
|
|
63708
63827
|
const data = JSON.parse(chunks.join(""));
|
|
63709
63828
|
const r2 = this._cacheClientFromJSON(data, options);
|
|
63710
|
-
return
|
|
63829
|
+
return resolve41(r2);
|
|
63711
63830
|
} catch (err) {
|
|
63712
63831
|
if (!this.keyFilename)
|
|
63713
63832
|
throw err;
|
|
@@ -63717,7 +63836,7 @@ var require_googleauth = __commonJS({
|
|
|
63717
63836
|
});
|
|
63718
63837
|
this.cachedCredential = client;
|
|
63719
63838
|
this.setGapicJWTValues(client);
|
|
63720
|
-
return
|
|
63839
|
+
return resolve41(client);
|
|
63721
63840
|
}
|
|
63722
63841
|
} catch (err) {
|
|
63723
63842
|
return reject(err);
|
|
@@ -63753,17 +63872,17 @@ var require_googleauth = __commonJS({
|
|
|
63753
63872
|
* Run the Google Cloud SDK command that prints the default project ID
|
|
63754
63873
|
*/
|
|
63755
63874
|
async getDefaultServiceProjectId() {
|
|
63756
|
-
return new Promise((
|
|
63875
|
+
return new Promise((resolve41) => {
|
|
63757
63876
|
(0, child_process_1.exec)("gcloud config config-helper --format json", (err, stdout2) => {
|
|
63758
63877
|
if (!err && stdout2) {
|
|
63759
63878
|
try {
|
|
63760
63879
|
const projectId = JSON.parse(stdout2).configuration.properties.core.project;
|
|
63761
|
-
|
|
63880
|
+
resolve41(projectId);
|
|
63762
63881
|
return;
|
|
63763
63882
|
} catch (e2) {
|
|
63764
63883
|
}
|
|
63765
63884
|
}
|
|
63766
|
-
|
|
63885
|
+
resolve41(null);
|
|
63767
63886
|
});
|
|
63768
63887
|
});
|
|
63769
63888
|
}
|
|
@@ -71535,14 +71654,14 @@ function __asyncValues(o) {
|
|
|
71535
71654
|
}, i2);
|
|
71536
71655
|
function verb(n) {
|
|
71537
71656
|
i2[n] = o[n] && function(v) {
|
|
71538
|
-
return new Promise(function(
|
|
71539
|
-
v = o[n](v), settle(
|
|
71657
|
+
return new Promise(function(resolve41, reject) {
|
|
71658
|
+
v = o[n](v), settle(resolve41, reject, v.done, v.value);
|
|
71540
71659
|
});
|
|
71541
71660
|
};
|
|
71542
71661
|
}
|
|
71543
|
-
function settle(
|
|
71662
|
+
function settle(resolve41, reject, d, v) {
|
|
71544
71663
|
Promise.resolve(v).then(function(v2) {
|
|
71545
|
-
|
|
71664
|
+
resolve41({ value: v2, done: d });
|
|
71546
71665
|
}, reject);
|
|
71547
71666
|
}
|
|
71548
71667
|
}
|
|
@@ -82045,8 +82164,8 @@ var init_node4 = __esm({
|
|
|
82045
82164
|
const url = `${websocketBaseUrl}/ws/google.ai.generativelanguage.${apiVersion}.GenerativeService.BidiGenerateMusic?key=${apiKey}`;
|
|
82046
82165
|
let onopenResolve = () => {
|
|
82047
82166
|
};
|
|
82048
|
-
const onopenPromise = new Promise((
|
|
82049
|
-
onopenResolve =
|
|
82167
|
+
const onopenPromise = new Promise((resolve41) => {
|
|
82168
|
+
onopenResolve = resolve41;
|
|
82050
82169
|
});
|
|
82051
82170
|
const callbacks = params.callbacks;
|
|
82052
82171
|
const onopenAwaitedCallback = function() {
|
|
@@ -82252,8 +82371,8 @@ var init_node4 = __esm({
|
|
|
82252
82371
|
}
|
|
82253
82372
|
let onopenResolve = () => {
|
|
82254
82373
|
};
|
|
82255
|
-
const onopenPromise = new Promise((
|
|
82256
|
-
onopenResolve =
|
|
82374
|
+
const onopenPromise = new Promise((resolve41) => {
|
|
82375
|
+
onopenResolve = resolve41;
|
|
82257
82376
|
});
|
|
82258
82377
|
const callbacks = params.callbacks;
|
|
82259
82378
|
const onopenAwaitedCallback = function() {
|
|
@@ -84562,7 +84681,7 @@ var init_node4 = __esm({
|
|
|
84562
84681
|
return void 0;
|
|
84563
84682
|
}
|
|
84564
84683
|
};
|
|
84565
|
-
sleep$1 = (ms) => new Promise((
|
|
84684
|
+
sleep$1 = (ms) => new Promise((resolve41) => setTimeout(resolve41, ms));
|
|
84566
84685
|
FallbackEncoder = ({ headers, body }) => {
|
|
84567
84686
|
return {
|
|
84568
84687
|
bodyHeaders: {
|
|
@@ -85071,8 +85190,8 @@ ${underline2}`);
|
|
|
85071
85190
|
};
|
|
85072
85191
|
APIPromise = class _APIPromise extends Promise {
|
|
85073
85192
|
constructor(client, responsePromise, parseResponse = defaultParseResponse) {
|
|
85074
|
-
super((
|
|
85075
|
-
|
|
85193
|
+
super((resolve41) => {
|
|
85194
|
+
resolve41(null);
|
|
85076
85195
|
});
|
|
85077
85196
|
this.responsePromise = responsePromise;
|
|
85078
85197
|
this.parseResponse = parseResponse;
|
|
@@ -86633,12 +86752,12 @@ var init_agentPromptGenerator = __esm({
|
|
|
86633
86752
|
|
|
86634
86753
|
// src/capture/scaffolding.ts
|
|
86635
86754
|
import { existsSync as existsSync56, writeFileSync as writeFileSync25, readFileSync as readFileSync41 } from "fs";
|
|
86636
|
-
import { join as join58, resolve as
|
|
86755
|
+
import { join as join58, resolve as resolve39 } from "path";
|
|
86637
86756
|
function loadEnvFile(startDir) {
|
|
86638
86757
|
try {
|
|
86639
|
-
let dir =
|
|
86758
|
+
let dir = resolve39(startDir);
|
|
86640
86759
|
for (let i2 = 0; i2 < 5; i2++) {
|
|
86641
|
-
const envPath =
|
|
86760
|
+
const envPath = resolve39(dir, ".env");
|
|
86642
86761
|
try {
|
|
86643
86762
|
const envContent = readFileSync41(envPath, "utf-8");
|
|
86644
86763
|
for (const line of envContent.split("\n")) {
|
|
@@ -86652,7 +86771,7 @@ function loadEnvFile(startDir) {
|
|
|
86652
86771
|
}
|
|
86653
86772
|
break;
|
|
86654
86773
|
} catch {
|
|
86655
|
-
dir =
|
|
86774
|
+
dir = resolve39(dir, "..");
|
|
86656
86775
|
}
|
|
86657
86776
|
}
|
|
86658
86777
|
} catch {
|
|
@@ -87419,7 +87538,7 @@ __export(capture_exports2, {
|
|
|
87419
87538
|
default: () => capture_default,
|
|
87420
87539
|
examples: () => examples23
|
|
87421
87540
|
});
|
|
87422
|
-
import { resolve as
|
|
87541
|
+
import { resolve as resolve40 } from "path";
|
|
87423
87542
|
var examples23, capture_default;
|
|
87424
87543
|
var init_capture2 = __esm({
|
|
87425
87544
|
"src/commands/capture.ts"() {
|
|
@@ -87478,7 +87597,7 @@ var init_capture2 = __esm({
|
|
|
87478
87597
|
const hostname = new URL(url).hostname.replace(/^www\./, "");
|
|
87479
87598
|
outputName = `captures/${hostname.replace(/\./g, "-")}`;
|
|
87480
87599
|
}
|
|
87481
|
-
const outputDir =
|
|
87600
|
+
const outputDir = resolve40(outputName);
|
|
87482
87601
|
const isJson = args.json;
|
|
87483
87602
|
if (!isJson) {
|
|
87484
87603
|
const { c: c2 } = await Promise.resolve().then(() => (init_colors(), colors_exports));
|
|
@@ -87626,7 +87745,7 @@ var init_telemetry2 = __esm({
|
|
|
87626
87745
|
|
|
87627
87746
|
// src/utils/installerDetection.ts
|
|
87628
87747
|
import { realpathSync as realpathSync2 } from "fs";
|
|
87629
|
-
import { posix as
|
|
87748
|
+
import { posix as posix3 } from "path";
|
|
87630
87749
|
function resolveEntry() {
|
|
87631
87750
|
const entry = process.argv[1];
|
|
87632
87751
|
if (!entry) return null;
|
|
@@ -87645,7 +87764,7 @@ function isWorkspaceLink(realEntry) {
|
|
|
87645
87764
|
}
|
|
87646
87765
|
function isEphemeralExec(realEntry) {
|
|
87647
87766
|
const normalized = normalizePath(realEntry);
|
|
87648
|
-
return normalized.includes("/_npx/") || normalized.includes("/.npm/_npx/") ||
|
|
87767
|
+
return normalized.includes("/_npx/") || normalized.includes("/.npm/_npx/") || posix3.basename(posix3.dirname(normalized)).startsWith("bunx-");
|
|
87649
87768
|
}
|
|
87650
87769
|
function isHomebrewInstall(realEntry) {
|
|
87651
87770
|
return normalizePath(realEntry).includes("/Cellar/hyperframes/");
|