hyperframes 0.6.37 → 0.6.39
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
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.6.
|
|
57
|
+
VERSION = true ? "0.6.39" : "0.0.0-dev";
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
|
|
@@ -13232,6 +13232,103 @@ var init_portUtils = __esm({
|
|
|
13232
13232
|
}
|
|
13233
13233
|
});
|
|
13234
13234
|
|
|
13235
|
+
// src/utils/orphanCleanup.ts
|
|
13236
|
+
import { execSync } from "child_process";
|
|
13237
|
+
function killOrphanedProcesses() {
|
|
13238
|
+
if (process.platform === "win32") return 0;
|
|
13239
|
+
let killed = 0;
|
|
13240
|
+
for (const name of ["chrome-headless-shell", "chrome_headless_shell"]) {
|
|
13241
|
+
killed += killOrphansByName(name);
|
|
13242
|
+
}
|
|
13243
|
+
killed += killOrphansByName("puppeteer_dev_chrome_profile");
|
|
13244
|
+
return killed;
|
|
13245
|
+
}
|
|
13246
|
+
function killProcessTree(pid, signal = "SIGTERM") {
|
|
13247
|
+
if (process.platform === "win32") return;
|
|
13248
|
+
const descendants = getDescendants(pid);
|
|
13249
|
+
const allPids = [...descendants.reverse(), pid];
|
|
13250
|
+
for (const p2 of allPids) {
|
|
13251
|
+
try {
|
|
13252
|
+
process.kill(p2, signal);
|
|
13253
|
+
} catch {
|
|
13254
|
+
}
|
|
13255
|
+
}
|
|
13256
|
+
if (signal !== "SIGKILL") {
|
|
13257
|
+
setTimeout(() => {
|
|
13258
|
+
for (const p2 of allPids) {
|
|
13259
|
+
try {
|
|
13260
|
+
process.kill(p2, "SIGKILL");
|
|
13261
|
+
} catch {
|
|
13262
|
+
}
|
|
13263
|
+
}
|
|
13264
|
+
}, 500).unref();
|
|
13265
|
+
}
|
|
13266
|
+
}
|
|
13267
|
+
function getDescendants(pid) {
|
|
13268
|
+
let children;
|
|
13269
|
+
try {
|
|
13270
|
+
const raw = execSync(`pgrep -P ${pid}`, { encoding: "utf-8", timeout: 2e3 }).trim();
|
|
13271
|
+
if (!raw) return [];
|
|
13272
|
+
children = raw.split("\n").map((s2) => parseInt(s2, 10)).filter((n) => !isNaN(n) && n > 0);
|
|
13273
|
+
} catch {
|
|
13274
|
+
return [];
|
|
13275
|
+
}
|
|
13276
|
+
const all = [];
|
|
13277
|
+
for (const child of children) {
|
|
13278
|
+
all.push(child);
|
|
13279
|
+
all.push(...getDescendants(child));
|
|
13280
|
+
}
|
|
13281
|
+
return all;
|
|
13282
|
+
}
|
|
13283
|
+
function killOrphansByName(processName) {
|
|
13284
|
+
const uid = getUid();
|
|
13285
|
+
const userFlag = uid !== null ? `-u ${uid} ` : "";
|
|
13286
|
+
let pids;
|
|
13287
|
+
try {
|
|
13288
|
+
const raw = execSync(`pgrep ${userFlag}-f ${processName}`, {
|
|
13289
|
+
encoding: "utf-8",
|
|
13290
|
+
timeout: 3e3
|
|
13291
|
+
}).trim();
|
|
13292
|
+
if (!raw) return 0;
|
|
13293
|
+
pids = raw.split("\n").map((s2) => parseInt(s2, 10)).filter((n) => !isNaN(n) && n > 0);
|
|
13294
|
+
} catch {
|
|
13295
|
+
return 0;
|
|
13296
|
+
}
|
|
13297
|
+
let killed = 0;
|
|
13298
|
+
for (const pid of pids) {
|
|
13299
|
+
if (!isOrphan(pid)) continue;
|
|
13300
|
+
killProcessTree(pid);
|
|
13301
|
+
killed++;
|
|
13302
|
+
}
|
|
13303
|
+
return killed;
|
|
13304
|
+
}
|
|
13305
|
+
function getUid() {
|
|
13306
|
+
if (_cachedUid !== void 0) return _cachedUid;
|
|
13307
|
+
try {
|
|
13308
|
+
_cachedUid = execSync("id -u", { encoding: "utf-8", timeout: 1e3 }).trim();
|
|
13309
|
+
} catch {
|
|
13310
|
+
_cachedUid = null;
|
|
13311
|
+
}
|
|
13312
|
+
return _cachedUid;
|
|
13313
|
+
}
|
|
13314
|
+
function isOrphan(pid) {
|
|
13315
|
+
try {
|
|
13316
|
+
const ppid = execSync(`ps -p ${pid} -o ppid=`, {
|
|
13317
|
+
encoding: "utf-8",
|
|
13318
|
+
timeout: 2e3
|
|
13319
|
+
}).trim();
|
|
13320
|
+
return ppid === "1";
|
|
13321
|
+
} catch {
|
|
13322
|
+
return false;
|
|
13323
|
+
}
|
|
13324
|
+
}
|
|
13325
|
+
var _cachedUid;
|
|
13326
|
+
var init_orphanCleanup = __esm({
|
|
13327
|
+
"src/utils/orphanCleanup.ts"() {
|
|
13328
|
+
"use strict";
|
|
13329
|
+
}
|
|
13330
|
+
});
|
|
13331
|
+
|
|
13235
13332
|
// src/server/fileWatcher.ts
|
|
13236
13333
|
import { watch } from "fs";
|
|
13237
13334
|
function shouldWatchProjectFile(filename) {
|
|
@@ -29018,7 +29115,7 @@ __export(manager_exports2, {
|
|
|
29018
29115
|
findBrowser: () => findBrowser,
|
|
29019
29116
|
isLinuxArm: () => isLinuxArm
|
|
29020
29117
|
});
|
|
29021
|
-
import { execSync, spawnSync as spawnSync2 } from "child_process";
|
|
29118
|
+
import { execSync as execSync2, spawnSync as spawnSync2 } from "child_process";
|
|
29022
29119
|
import { existsSync as existsSync18, readdirSync as readdirSync8, rmSync as rmSync4 } from "fs";
|
|
29023
29120
|
import { basename as basename2 } from "path";
|
|
29024
29121
|
import { homedir as homedir5 } from "os";
|
|
@@ -29027,7 +29124,7 @@ import { Browser, detectBrowserPlatform, getInstalledBrowsers, install } from "@
|
|
|
29027
29124
|
function whichBinary2(name) {
|
|
29028
29125
|
try {
|
|
29029
29126
|
const cmd = process.platform === "win32" ? `where ${name}` : `which ${name}`;
|
|
29030
|
-
const output =
|
|
29127
|
+
const output = execSync2(cmd, {
|
|
29031
29128
|
encoding: "utf-8",
|
|
29032
29129
|
stdio: ["pipe", "pipe", "pipe"],
|
|
29033
29130
|
timeout: 5e3
|
|
@@ -30646,6 +30743,43 @@ var init_frameCapture = __esm({
|
|
|
30646
30743
|
}
|
|
30647
30744
|
});
|
|
30648
30745
|
|
|
30746
|
+
// ../engine/src/utils/processTracker.ts
|
|
30747
|
+
function trackChildProcess(proc) {
|
|
30748
|
+
tracked.add(proc);
|
|
30749
|
+
const remove2 = () => tracked.delete(proc);
|
|
30750
|
+
proc.once("exit", remove2);
|
|
30751
|
+
proc.once("error", remove2);
|
|
30752
|
+
}
|
|
30753
|
+
function killTrackedProcesses() {
|
|
30754
|
+
const alive = [];
|
|
30755
|
+
for (const proc of tracked) {
|
|
30756
|
+
if (!proc.killed) {
|
|
30757
|
+
try {
|
|
30758
|
+
proc.kill("SIGTERM");
|
|
30759
|
+
alive.push(proc);
|
|
30760
|
+
} catch {
|
|
30761
|
+
}
|
|
30762
|
+
}
|
|
30763
|
+
}
|
|
30764
|
+
tracked.clear();
|
|
30765
|
+
if (alive.length === 0) return;
|
|
30766
|
+
setTimeout(() => {
|
|
30767
|
+
for (const proc of alive) {
|
|
30768
|
+
try {
|
|
30769
|
+
proc.kill("SIGKILL");
|
|
30770
|
+
} catch {
|
|
30771
|
+
}
|
|
30772
|
+
}
|
|
30773
|
+
}, 500).unref();
|
|
30774
|
+
}
|
|
30775
|
+
var tracked;
|
|
30776
|
+
var init_processTracker = __esm({
|
|
30777
|
+
"../engine/src/utils/processTracker.ts"() {
|
|
30778
|
+
"use strict";
|
|
30779
|
+
tracked = /* @__PURE__ */ new Set();
|
|
30780
|
+
}
|
|
30781
|
+
});
|
|
30782
|
+
|
|
30649
30783
|
// ../engine/src/utils/gpuEncoder.ts
|
|
30650
30784
|
import { spawn as spawn4 } from "child_process";
|
|
30651
30785
|
async function detectGpuEncoder() {
|
|
@@ -30787,6 +30921,7 @@ async function runFfmpeg(args, opts) {
|
|
|
30787
30921
|
const onStderr = opts?.onStderr;
|
|
30788
30922
|
return new Promise((resolve46) => {
|
|
30789
30923
|
const ffmpeg = spawn5("ffmpeg", args);
|
|
30924
|
+
trackChildProcess(ffmpeg);
|
|
30790
30925
|
let stderr = "";
|
|
30791
30926
|
const onAbort = () => {
|
|
30792
30927
|
ffmpeg.kill("SIGTERM");
|
|
@@ -30834,6 +30969,7 @@ var DEFAULT_TIMEOUT, DEFAULT_STDERR_TAIL_LINES;
|
|
|
30834
30969
|
var init_runFfmpeg = __esm({
|
|
30835
30970
|
"../engine/src/utils/runFfmpeg.ts"() {
|
|
30836
30971
|
"use strict";
|
|
30972
|
+
init_processTracker();
|
|
30837
30973
|
DEFAULT_TIMEOUT = 3e5;
|
|
30838
30974
|
DEFAULT_STDERR_TAIL_LINES = 15;
|
|
30839
30975
|
}
|
|
@@ -31075,6 +31211,7 @@ async function encodeFramesFromDir(framesDir, framePattern, outputPath, options,
|
|
|
31075
31211
|
const args = buildEncoderArgs(options, inputArgs, outputPath, gpuEncoder);
|
|
31076
31212
|
return new Promise((resolve46) => {
|
|
31077
31213
|
const ffmpeg = spawn6("ffmpeg", args);
|
|
31214
|
+
trackChildProcess(ffmpeg);
|
|
31078
31215
|
let stderr = "";
|
|
31079
31216
|
const onAbort = () => {
|
|
31080
31217
|
ffmpeg.kill("SIGTERM");
|
|
@@ -31185,6 +31322,7 @@ async function encodeFramesChunkedConcat(framesDir, framePattern, outputPath, op
|
|
|
31185
31322
|
const args = buildEncoderArgs(options, inputArgs, chunkPath, gpuEncoder);
|
|
31186
31323
|
const chunkResult = await new Promise((resolve46) => {
|
|
31187
31324
|
const ffmpeg = spawn6("ffmpeg", args);
|
|
31325
|
+
trackChildProcess(ffmpeg);
|
|
31188
31326
|
let stderr = "";
|
|
31189
31327
|
ffmpeg.stderr.on("data", (d2) => {
|
|
31190
31328
|
stderr += d2.toString();
|
|
@@ -31226,6 +31364,7 @@ async function encodeFramesChunkedConcat(framesDir, framePattern, outputPath, op
|
|
|
31226
31364
|
];
|
|
31227
31365
|
const concatResult = await new Promise((resolve46) => {
|
|
31228
31366
|
const ffmpeg = spawn6("ffmpeg", concatArgs);
|
|
31367
|
+
trackChildProcess(ffmpeg);
|
|
31229
31368
|
let stderr = "";
|
|
31230
31369
|
ffmpeg.stderr.on("data", (d2) => {
|
|
31231
31370
|
stderr += d2.toString();
|
|
@@ -31257,7 +31396,7 @@ async function encodeFramesChunkedConcat(framesDir, framePattern, outputPath, op
|
|
|
31257
31396
|
fileSize
|
|
31258
31397
|
};
|
|
31259
31398
|
}
|
|
31260
|
-
async function muxVideoWithAudio(videoPath, audioPath, outputPath, signal, config) {
|
|
31399
|
+
async function muxVideoWithAudio(videoPath, audioPath, outputPath, signal, config, fps) {
|
|
31261
31400
|
const outputDir = dirname7(outputPath);
|
|
31262
31401
|
if (!existsSync21(outputDir)) mkdirSync11(outputDir, { recursive: true });
|
|
31263
31402
|
const isWebm = outputPath.endsWith(".webm");
|
|
@@ -31271,6 +31410,9 @@ async function muxVideoWithAudio(videoPath, audioPath, outputPath, signal, confi
|
|
|
31271
31410
|
args.push("-c:a", "aac", "-b:a", "192k", "-movflags", "+faststart");
|
|
31272
31411
|
}
|
|
31273
31412
|
args.push("-avoid_negative_ts", "make_zero");
|
|
31413
|
+
if (fps !== void 0) {
|
|
31414
|
+
args.push("-r", fpsToFfmpegArg(fps));
|
|
31415
|
+
}
|
|
31274
31416
|
args.push("-shortest", "-y", outputPath);
|
|
31275
31417
|
const processTimeout = config?.ffmpegProcessTimeout ?? DEFAULT_CONFIG2.ffmpegProcessTimeout;
|
|
31276
31418
|
const result = await runFfmpeg(args, { signal, timeout: processTimeout });
|
|
@@ -31289,12 +31431,16 @@ async function muxVideoWithAudio(videoPath, audioPath, outputPath, signal, confi
|
|
|
31289
31431
|
error: !result.success ? formatFfmpegError(result.exitCode, result.stderr) : void 0
|
|
31290
31432
|
};
|
|
31291
31433
|
}
|
|
31292
|
-
async function applyFaststart(inputPath, outputPath, signal, config) {
|
|
31434
|
+
async function applyFaststart(inputPath, outputPath, signal, config, fps) {
|
|
31293
31435
|
if (outputPath.endsWith(".webm") || outputPath.endsWith(".mov")) {
|
|
31294
31436
|
if (inputPath !== outputPath) copyFileSync(inputPath, outputPath);
|
|
31295
31437
|
return { success: true, outputPath, durationMs: 0 };
|
|
31296
31438
|
}
|
|
31297
|
-
const args = ["-i", inputPath, "-c", "copy", "-movflags", "+faststart"
|
|
31439
|
+
const args = ["-i", inputPath, "-c", "copy", "-movflags", "+faststart"];
|
|
31440
|
+
if (fps !== void 0) {
|
|
31441
|
+
args.push("-r", fpsToFfmpegArg(fps));
|
|
31442
|
+
}
|
|
31443
|
+
args.push("-y", outputPath);
|
|
31298
31444
|
const processTimeout = config?.ffmpegProcessTimeout ?? DEFAULT_CONFIG2.ffmpegProcessTimeout;
|
|
31299
31445
|
const result = await runFfmpeg(args, { signal, timeout: processTimeout });
|
|
31300
31446
|
if (signal?.aborted) {
|
|
@@ -31316,6 +31462,7 @@ var ENCODER_PRESETS;
|
|
|
31316
31462
|
var init_chunkEncoder = __esm({
|
|
31317
31463
|
"../engine/src/services/chunkEncoder.ts"() {
|
|
31318
31464
|
"use strict";
|
|
31465
|
+
init_processTracker();
|
|
31319
31466
|
init_config2();
|
|
31320
31467
|
init_gpuEncoder();
|
|
31321
31468
|
init_hdr();
|
|
@@ -31544,6 +31691,7 @@ async function spawnStreamingEncoder(outputPath, options, signal, config) {
|
|
|
31544
31691
|
const ffmpeg = spawn7("ffmpeg", args, {
|
|
31545
31692
|
stdio: ["pipe", "pipe", "pipe"]
|
|
31546
31693
|
});
|
|
31694
|
+
trackChildProcess(ffmpeg);
|
|
31547
31695
|
let exitStatus = "running";
|
|
31548
31696
|
let stderr = "";
|
|
31549
31697
|
let exitCode = null;
|
|
@@ -31640,6 +31788,7 @@ Process error: ${err.message}`;
|
|
|
31640
31788
|
var init_streamingEncoder = __esm({
|
|
31641
31789
|
"../engine/src/services/streamingEncoder.ts"() {
|
|
31642
31790
|
"use strict";
|
|
31791
|
+
init_processTracker();
|
|
31643
31792
|
init_gpuEncoder();
|
|
31644
31793
|
init_runFfmpeg();
|
|
31645
31794
|
init_hdr();
|
|
@@ -33660,6 +33809,7 @@ async function extractVideoFramesRange(videoPath, videoId, startTime, duration,
|
|
|
33660
33809
|
args.push("-y", outputPattern);
|
|
33661
33810
|
return new Promise((resolve46, reject) => {
|
|
33662
33811
|
const ffmpeg = spawn9("ffmpeg", args);
|
|
33812
|
+
trackChildProcess(ffmpeg);
|
|
33663
33813
|
let stderr = "";
|
|
33664
33814
|
const onAbort = () => {
|
|
33665
33815
|
ffmpeg.kill("SIGTERM");
|
|
@@ -34122,6 +34272,7 @@ var init_videoFrameExtractor = __esm({
|
|
|
34122
34272
|
"../engine/src/services/videoFrameExtractor.ts"() {
|
|
34123
34273
|
"use strict";
|
|
34124
34274
|
init_esm10();
|
|
34275
|
+
init_processTracker();
|
|
34125
34276
|
init_ffprobe();
|
|
34126
34277
|
init_hdr();
|
|
34127
34278
|
init_urlDownloader();
|
|
@@ -36858,6 +37009,7 @@ __export(src_exports2, {
|
|
|
36858
37009
|
injectVideoFramesBatch: () => injectVideoFramesBatch,
|
|
36859
37010
|
isHdrColorSpace: () => isHdrColorSpace,
|
|
36860
37011
|
isHttpUrl: () => isHttpUrl,
|
|
37012
|
+
killTrackedProcesses: () => killTrackedProcesses,
|
|
36861
37013
|
launchHdrBrowser: () => launchHdrBrowser,
|
|
36862
37014
|
linearToHdr: () => linearToHdr,
|
|
36863
37015
|
mergeWorkerFrames: () => mergeWorkerFrames,
|
|
@@ -36888,6 +37040,7 @@ __export(src_exports2, {
|
|
|
36888
37040
|
showVideoElements: () => showVideoElements,
|
|
36889
37041
|
spawnStreamingEncoder: () => spawnStreamingEncoder,
|
|
36890
37042
|
syncVideoFrameVisibility: () => syncVideoFrameVisibility,
|
|
37043
|
+
trackChildProcess: () => trackChildProcess,
|
|
36891
37044
|
uploadAndReadbackHdrFrame: () => uploadAndReadbackHdrFrame
|
|
36892
37045
|
});
|
|
36893
37046
|
var init_src2 = __esm({
|
|
@@ -36910,6 +37063,7 @@ var init_src2 = __esm({
|
|
|
36910
37063
|
init_ffprobe();
|
|
36911
37064
|
init_urlDownloader();
|
|
36912
37065
|
init_runFfmpeg();
|
|
37066
|
+
init_processTracker();
|
|
36913
37067
|
init_alphaBlit();
|
|
36914
37068
|
init_layerCompositor();
|
|
36915
37069
|
init_shaderTransitions();
|
|
@@ -41854,14 +42008,22 @@ async function runAssembleStage(input) {
|
|
|
41854
42008
|
videoOnlyPath,
|
|
41855
42009
|
audioOutputPath,
|
|
41856
42010
|
outputPath,
|
|
41857
|
-
abortSignal
|
|
42011
|
+
abortSignal,
|
|
42012
|
+
void 0,
|
|
42013
|
+
job.config.fps
|
|
41858
42014
|
);
|
|
41859
42015
|
assertNotAborted();
|
|
41860
42016
|
if (!muxResult.success) {
|
|
41861
42017
|
throw new Error(`Audio muxing failed: ${muxResult.error}`);
|
|
41862
42018
|
}
|
|
41863
42019
|
} else {
|
|
41864
|
-
const faststartResult = await applyFaststart(
|
|
42020
|
+
const faststartResult = await applyFaststart(
|
|
42021
|
+
videoOnlyPath,
|
|
42022
|
+
outputPath,
|
|
42023
|
+
abortSignal,
|
|
42024
|
+
void 0,
|
|
42025
|
+
job.config.fps
|
|
42026
|
+
);
|
|
41865
42027
|
assertNotAborted();
|
|
41866
42028
|
if (!faststartResult.success) {
|
|
41867
42029
|
throw new Error(`Faststart failed: ${faststartResult.error}`);
|
|
@@ -45202,7 +45364,13 @@ async function assemble(planDir, chunkPaths, audioPath, outputPath, options) {
|
|
|
45202
45364
|
writeFileSync23(concatListPath, `${concatBody}
|
|
45203
45365
|
`, "utf-8");
|
|
45204
45366
|
const concatOutputPath = join56(workDir, `concat.${plan2.dimensions.format}`);
|
|
45367
|
+
const fpsArg = fpsToFfmpegArg({
|
|
45368
|
+
num: plan2.dimensions.fpsNum,
|
|
45369
|
+
den: plan2.dimensions.fpsDen
|
|
45370
|
+
});
|
|
45205
45371
|
const concatArgs = [
|
|
45372
|
+
"-r",
|
|
45373
|
+
fpsArg,
|
|
45206
45374
|
"-f",
|
|
45207
45375
|
"concat",
|
|
45208
45376
|
"-safe",
|
|
@@ -45244,13 +45412,24 @@ async function assemble(planDir, chunkPaths, audioPath, outputPath, options) {
|
|
|
45244
45412
|
concatOutputPath,
|
|
45245
45413
|
audioForMux,
|
|
45246
45414
|
muxOutputPath,
|
|
45247
|
-
abortSignal
|
|
45415
|
+
abortSignal,
|
|
45416
|
+
void 0,
|
|
45417
|
+
{ num: plan2.dimensions.fpsNum, den: plan2.dimensions.fpsDen }
|
|
45248
45418
|
);
|
|
45249
45419
|
if (!muxResult.success) {
|
|
45250
45420
|
throw new Error(`[assemble] audio mux failed: ${muxResult.error}`);
|
|
45251
45421
|
}
|
|
45252
45422
|
}
|
|
45253
|
-
const faststartResult = await applyFaststart(
|
|
45423
|
+
const faststartResult = await applyFaststart(
|
|
45424
|
+
muxOutputPath,
|
|
45425
|
+
outputPath,
|
|
45426
|
+
abortSignal,
|
|
45427
|
+
void 0,
|
|
45428
|
+
{
|
|
45429
|
+
num: plan2.dimensions.fpsNum,
|
|
45430
|
+
den: plan2.dimensions.fpsDen
|
|
45431
|
+
}
|
|
45432
|
+
);
|
|
45254
45433
|
if (!faststartResult.success) {
|
|
45255
45434
|
throw new Error(`[assemble] faststart failed: ${faststartResult.error}`);
|
|
45256
45435
|
}
|
|
@@ -45319,6 +45498,7 @@ var init_assemble = __esm({
|
|
|
45319
45498
|
"../producer/src/services/distributed/assemble.ts"() {
|
|
45320
45499
|
"use strict";
|
|
45321
45500
|
init_src2();
|
|
45501
|
+
init_src();
|
|
45322
45502
|
init_logger();
|
|
45323
45503
|
init_audioPadTrim();
|
|
45324
45504
|
}
|
|
@@ -45385,6 +45565,7 @@ var init_src3 = __esm({
|
|
|
45385
45565
|
// src/server/studioServer.ts
|
|
45386
45566
|
var studioServer_exports = {};
|
|
45387
45567
|
__export(studioServer_exports, {
|
|
45568
|
+
closeThumbnailBrowser: () => closeThumbnailBrowser,
|
|
45388
45569
|
createStudioServer: () => createStudioServer,
|
|
45389
45570
|
resolveStudioBundle: () => resolveStudioBundle
|
|
45390
45571
|
});
|
|
@@ -45480,16 +45661,6 @@ async function getThumbnailBrowser() {
|
|
|
45480
45661
|
_thumbnailBrowser = null;
|
|
45481
45662
|
_thumbnailBrowserInitializing = null;
|
|
45482
45663
|
});
|
|
45483
|
-
const onExit = async () => {
|
|
45484
|
-
const { releaseBrowser: releaseBrowser2 } = await Promise.resolve().then(() => (init_src2(), src_exports2));
|
|
45485
|
-
if (_thumbnailBrowser) {
|
|
45486
|
-
await releaseBrowser2(_thumbnailBrowser).catch(() => {
|
|
45487
|
-
});
|
|
45488
|
-
_thumbnailBrowser = null;
|
|
45489
|
-
}
|
|
45490
|
-
};
|
|
45491
|
-
process.once("SIGTERM", () => void onExit());
|
|
45492
|
-
process.once("SIGINT", () => void onExit());
|
|
45493
45664
|
return _thumbnailBrowser;
|
|
45494
45665
|
} catch (err) {
|
|
45495
45666
|
console.warn(
|
|
@@ -45502,6 +45673,15 @@ async function getThumbnailBrowser() {
|
|
|
45502
45673
|
})();
|
|
45503
45674
|
return _thumbnailBrowserInitializing;
|
|
45504
45675
|
}
|
|
45676
|
+
async function closeThumbnailBrowser() {
|
|
45677
|
+
if (!_thumbnailBrowser) return;
|
|
45678
|
+
const browser = _thumbnailBrowser;
|
|
45679
|
+
_thumbnailBrowser = null;
|
|
45680
|
+
_thumbnailBrowserInitializing = null;
|
|
45681
|
+
const { releaseBrowser: releaseBrowser2 } = await Promise.resolve().then(() => (init_src2(), src_exports2));
|
|
45682
|
+
await releaseBrowser2(browser).catch(() => {
|
|
45683
|
+
});
|
|
45684
|
+
}
|
|
45505
45685
|
function createStudioServer(options) {
|
|
45506
45686
|
const { projectDir, projectName } = options;
|
|
45507
45687
|
const projectId = projectName || basename5(projectDir);
|
|
@@ -45949,6 +46129,11 @@ async function runDevMode(dir, options) {
|
|
|
45949
46129
|
}
|
|
45950
46130
|
});
|
|
45951
46131
|
}
|
|
46132
|
+
const shutdown = () => {
|
|
46133
|
+
if (child.pid) killProcessTree(child.pid);
|
|
46134
|
+
};
|
|
46135
|
+
process.once("SIGINT", shutdown);
|
|
46136
|
+
process.once("SIGTERM", shutdown);
|
|
45952
46137
|
return new Promise((resolve46) => {
|
|
45953
46138
|
child.on("close", () => resolve46());
|
|
45954
46139
|
});
|
|
@@ -46024,6 +46209,11 @@ async function runLocalStudioMode(dir, options) {
|
|
|
46024
46209
|
}
|
|
46025
46210
|
});
|
|
46026
46211
|
}
|
|
46212
|
+
const shutdown = () => {
|
|
46213
|
+
if (child.pid) killProcessTree(child.pid);
|
|
46214
|
+
};
|
|
46215
|
+
process.once("SIGINT", shutdown);
|
|
46216
|
+
process.once("SIGTERM", shutdown);
|
|
46027
46217
|
return new Promise((resolve46) => {
|
|
46028
46218
|
child.on("close", () => resolve46());
|
|
46029
46219
|
});
|
|
@@ -46118,11 +46308,29 @@ async function runEmbeddedMode(dir, startPort, options) {
|
|
|
46118
46308
|
rl?.close();
|
|
46119
46309
|
console.log();
|
|
46120
46310
|
console.log(` ${c2.dim("Shutting down studio...")}`);
|
|
46121
|
-
|
|
46122
|
-
|
|
46311
|
+
setTimeout(() => process.exit(0), 3e3).unref();
|
|
46312
|
+
const cleanup = async () => {
|
|
46313
|
+
const { closeThumbnailBrowser: closeThumbnailBrowser2 } = await Promise.resolve().then(() => (init_studioServer(), studioServer_exports));
|
|
46314
|
+
const { drainBrowserPool: drainBrowserPool2, killTrackedProcesses: killTrackedProcesses2 } = await Promise.resolve().then(() => (init_src2(), src_exports2));
|
|
46315
|
+
killTrackedProcesses2();
|
|
46316
|
+
await closeThumbnailBrowser2().catch(() => {
|
|
46317
|
+
});
|
|
46318
|
+
await drainBrowserPool2().catch(() => {
|
|
46319
|
+
});
|
|
46320
|
+
};
|
|
46321
|
+
cleanup().catch(() => {
|
|
46322
|
+
}).finally(() => {
|
|
46323
|
+
result.server.close(() => resolveRun());
|
|
46324
|
+
});
|
|
46123
46325
|
};
|
|
46124
46326
|
process.once("SIGINT", shutdown);
|
|
46125
46327
|
process.once("SIGTERM", shutdown);
|
|
46328
|
+
Promise.resolve().then(() => (init_src2(), src_exports2)).then(({ killTrackedProcesses: killTrackedProcesses2 }) => {
|
|
46329
|
+
process.once("exit", () => {
|
|
46330
|
+
if (!shuttingDown) killTrackedProcesses2();
|
|
46331
|
+
});
|
|
46332
|
+
}).catch(() => {
|
|
46333
|
+
});
|
|
46126
46334
|
});
|
|
46127
46335
|
}
|
|
46128
46336
|
var examples, preview_default;
|
|
@@ -46137,6 +46345,7 @@ var init_preview2 = __esm({
|
|
|
46137
46345
|
init_lintProject();
|
|
46138
46346
|
init_lintFormat();
|
|
46139
46347
|
init_portUtils();
|
|
46348
|
+
init_orphanCleanup();
|
|
46140
46349
|
examples = [
|
|
46141
46350
|
["Preview the current project", "hyperframes preview"],
|
|
46142
46351
|
["Preview a specific project directory", "hyperframes preview ./my-video"],
|
|
@@ -46215,6 +46424,12 @@ var init_preview2 = __esm({
|
|
|
46215
46424
|
`);
|
|
46216
46425
|
return;
|
|
46217
46426
|
}
|
|
46427
|
+
const orphansKilled = killOrphanedProcesses();
|
|
46428
|
+
if (orphansKilled > 0) {
|
|
46429
|
+
console.log(
|
|
46430
|
+
` ${c2.dim(`Cleaned up ${orphansKilled} orphaned process${orphansKilled === 1 ? "" : "es"} from a previous session.`)}`
|
|
46431
|
+
);
|
|
46432
|
+
}
|
|
46218
46433
|
const rawArg = args.dir;
|
|
46219
46434
|
const dir = resolve25(rawArg ?? ".");
|
|
46220
46435
|
const isImplicitCwd = !rawArg || rawArg === "." || rawArg === "./";
|
|
@@ -48337,11 +48552,11 @@ __export(ffmpeg_exports, {
|
|
|
48337
48552
|
findFFmpeg: () => findFFmpeg,
|
|
48338
48553
|
getFFmpegInstallHint: () => getFFmpegInstallHint
|
|
48339
48554
|
});
|
|
48340
|
-
import { execSync as
|
|
48555
|
+
import { execSync as execSync3 } from "child_process";
|
|
48341
48556
|
function findFFmpeg() {
|
|
48342
48557
|
try {
|
|
48343
48558
|
const cmd = process.platform === "win32" ? "where ffmpeg" : "which ffmpeg";
|
|
48344
|
-
const output =
|
|
48559
|
+
const output = execSync3(cmd, {
|
|
48345
48560
|
encoding: "utf-8",
|
|
48346
48561
|
stdio: ["pipe", "pipe", "pipe"],
|
|
48347
48562
|
timeout: 5e3
|
|
@@ -51959,13 +52174,13 @@ __export(doctor_exports, {
|
|
|
51959
52174
|
examples: () => examples19,
|
|
51960
52175
|
redactHome: () => redactHome
|
|
51961
52176
|
});
|
|
51962
|
-
import { execSync as
|
|
52177
|
+
import { execSync as execSync4 } from "child_process";
|
|
51963
52178
|
import { freemem as freemem5, platform as platform8 } from "os";
|
|
51964
52179
|
function checkFFmpeg() {
|
|
51965
52180
|
const path2 = findFFmpeg();
|
|
51966
52181
|
if (path2) {
|
|
51967
52182
|
try {
|
|
51968
|
-
const version =
|
|
52183
|
+
const version = execSync4("ffmpeg -version", { encoding: "utf-8", timeout: 5e3 }).split("\n")[0] ?? "";
|
|
51969
52184
|
return { ok: true, detail: version.trim() };
|
|
51970
52185
|
} catch {
|
|
51971
52186
|
return { ok: true, detail: path2 };
|
|
@@ -51979,7 +52194,7 @@ function checkFFmpeg() {
|
|
|
51979
52194
|
}
|
|
51980
52195
|
function checkFFprobe() {
|
|
51981
52196
|
try {
|
|
51982
|
-
const version =
|
|
52197
|
+
const version = execSync4("ffprobe -version", { encoding: "utf-8", timeout: 5e3 }).split("\n")[0] ?? "";
|
|
51983
52198
|
return { ok: true, detail: version.trim() };
|
|
51984
52199
|
} catch {
|
|
51985
52200
|
return {
|
|
@@ -52002,7 +52217,7 @@ async function checkChrome() {
|
|
|
52002
52217
|
}
|
|
52003
52218
|
function checkDocker() {
|
|
52004
52219
|
try {
|
|
52005
|
-
const version =
|
|
52220
|
+
const version = execSync4("docker --version", { encoding: "utf-8", timeout: 5e3 }).trim();
|
|
52006
52221
|
return { ok: true, detail: version };
|
|
52007
52222
|
} catch {
|
|
52008
52223
|
return {
|
|
@@ -52014,7 +52229,7 @@ function checkDocker() {
|
|
|
52014
52229
|
}
|
|
52015
52230
|
function checkDockerRunning() {
|
|
52016
52231
|
try {
|
|
52017
|
-
|
|
52232
|
+
execSync4("docker info", { stdio: "pipe", timeout: 5e3 });
|
|
52018
52233
|
return { ok: true, detail: "Running" };
|
|
52019
52234
|
} catch {
|
|
52020
52235
|
return {
|