hyperframes 0.7.13 → 0.7.14
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 +609 -510
- package/dist/skills/hyperframes/SKILL.md +1 -1
- package/dist/skills/hyperframes-cli/SKILL.md +1 -1
- package/dist/studio/assets/{index-9HfU4WBf.js → index-BXG-pbr_.js} +2 -2
- package/dist/studio/assets/{index-BMBWKCJX.js → index-CkrVt5DX.js} +1 -1
- package/dist/studio/assets/{index-CmULNmgb.js → index-DYgkaIlV.js} +1 -1
- package/dist/studio/index.html +1 -1
- package/package.json +3 -2
package/dist/cli.js
CHANGED
|
@@ -50,7 +50,7 @@ var VERSION;
|
|
|
50
50
|
var init_version = __esm({
|
|
51
51
|
"src/version.ts"() {
|
|
52
52
|
"use strict";
|
|
53
|
-
VERSION = true ? "0.7.
|
|
53
|
+
VERSION = true ? "0.7.14" : "0.0.0-dev";
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
|
|
@@ -4671,10 +4671,10 @@ function compareDocumentPosition(nodeA, nodeB) {
|
|
|
4671
4671
|
function uniqueSort(nodes) {
|
|
4672
4672
|
nodes = nodes.filter((node, i2, arr) => !arr.includes(node, i2 + 1));
|
|
4673
4673
|
nodes.sort((a, b2) => {
|
|
4674
|
-
const
|
|
4675
|
-
if (
|
|
4674
|
+
const relative17 = compareDocumentPosition(a, b2);
|
|
4675
|
+
if (relative17 & DocumentPosition.PRECEDING) {
|
|
4676
4676
|
return -1;
|
|
4677
|
-
} else if (
|
|
4677
|
+
} else if (relative17 & DocumentPosition.FOLLOWING) {
|
|
4678
4678
|
return 1;
|
|
4679
4679
|
}
|
|
4680
4680
|
return 0;
|
|
@@ -21281,8 +21281,8 @@ var init_cssSelector = __esm({
|
|
|
21281
21281
|
});
|
|
21282
21282
|
|
|
21283
21283
|
// ../../node_modules/.bun/@jridgewell+sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
|
|
21284
|
-
function encodeInteger(builder, num,
|
|
21285
|
-
let delta = num -
|
|
21284
|
+
function encodeInteger(builder, num, relative17) {
|
|
21285
|
+
let delta = num - relative17;
|
|
21286
21286
|
delta = delta < 0 ? -delta << 1 | 1 : delta << 1;
|
|
21287
21287
|
do {
|
|
21288
21288
|
let clamped = delta & 31;
|
|
@@ -46429,6 +46429,7 @@ __export(skillsManifest_exports, {
|
|
|
46429
46429
|
checkSkills: () => checkSkills,
|
|
46430
46430
|
diffSkills: () => diffSkills,
|
|
46431
46431
|
hashSkillBundle: () => hashSkillBundle,
|
|
46432
|
+
hyperframesSkillNames: () => hyperframesSkillNames,
|
|
46432
46433
|
skillsAttributedToSource: () => skillsAttributedToSource
|
|
46433
46434
|
});
|
|
46434
46435
|
import { execFile } from "child_process";
|
|
@@ -46525,8 +46526,8 @@ function locateInstall(skillNames, opts = {}) {
|
|
|
46525
46526
|
} : null;
|
|
46526
46527
|
}
|
|
46527
46528
|
const roots = [
|
|
46528
|
-
...discoverSkillRoots(opts.
|
|
46529
|
-
...discoverSkillRoots(opts.
|
|
46529
|
+
...discoverSkillRoots(opts.home ?? homedir6(), "global"),
|
|
46530
|
+
...discoverSkillRoots(opts.cwd ?? process.cwd(), "project")
|
|
46530
46531
|
];
|
|
46531
46532
|
for (const root of roots) {
|
|
46532
46533
|
if (skillNames.some((n2) => existsSync21(join20(root.dir, n2, "SKILL.md")))) return root;
|
|
@@ -46590,6 +46591,10 @@ function readSkillLock(path2) {
|
|
|
46590
46591
|
return null;
|
|
46591
46592
|
}
|
|
46592
46593
|
}
|
|
46594
|
+
function hyperframesSkillNames(opts) {
|
|
46595
|
+
const lockPath = lockPathForScope(opts.scope, { cwd: opts.cwd, home: opts.home });
|
|
46596
|
+
return skillsAttributedToSource(readSkillLock(lockPath), DEFAULT_REPO_SLUG);
|
|
46597
|
+
}
|
|
46593
46598
|
function detectRemoved(root, latest, opts) {
|
|
46594
46599
|
const lock = readSkillLock(lockPathForScope(root.scope, opts));
|
|
46595
46600
|
const removed = skillsAttributedToSource(lock, latest.source).filter((name) => !(name in latest.skills)).sort().map((name) => ({ name, status: "removed" }));
|
|
@@ -46716,83 +46721,152 @@ var init_skillsManifest = __esm({
|
|
|
46716
46721
|
}
|
|
46717
46722
|
});
|
|
46718
46723
|
|
|
46719
|
-
// src/utils/
|
|
46720
|
-
|
|
46721
|
-
|
|
46722
|
-
|
|
46723
|
-
|
|
46724
|
-
|
|
46725
|
-
|
|
46726
|
-
|
|
46727
|
-
|
|
46728
|
-
}
|
|
46729
|
-
|
|
46730
|
-
|
|
46731
|
-
|
|
46732
|
-
|
|
46733
|
-
|
|
46734
|
-
|
|
46735
|
-
|
|
46736
|
-
|
|
46737
|
-
}
|
|
46738
|
-
|
|
46724
|
+
// src/utils/agentDirs.generated.ts
|
|
46725
|
+
var AGENT_GLOBAL_DIRS;
|
|
46726
|
+
var init_agentDirs_generated = __esm({
|
|
46727
|
+
"src/utils/agentDirs.generated.ts"() {
|
|
46728
|
+
"use strict";
|
|
46729
|
+
AGENT_GLOBAL_DIRS = [
|
|
46730
|
+
{ agent: "aider-desk", base: "home", sub: ".aider-desk/skills" },
|
|
46731
|
+
{ agent: "amp", base: "configHome", sub: "agents/skills" },
|
|
46732
|
+
{ agent: "antigravity", base: "home", sub: ".gemini/antigravity/skills" },
|
|
46733
|
+
{ agent: "antigravity-cli", base: "home", sub: ".gemini/antigravity-cli/skills" },
|
|
46734
|
+
{ agent: "astrbot", base: "home", sub: ".astrbot/data/skills" },
|
|
46735
|
+
{ agent: "autohand-code", base: "autohandHome", sub: "skills" },
|
|
46736
|
+
{ agent: "augment", base: "home", sub: ".augment/skills" },
|
|
46737
|
+
{ agent: "bob", base: "home", sub: ".bob/skills" },
|
|
46738
|
+
{ agent: "claude-code", base: "claudeHome", sub: "skills" },
|
|
46739
|
+
{ agent: "openclaw", base: "home", sub: ".openclaw/skills" },
|
|
46740
|
+
{ agent: "cline", base: "home", sub: ".agents/skills" },
|
|
46741
|
+
{ agent: "codearts-agent", base: "home", sub: ".codeartsdoer/skills" },
|
|
46742
|
+
{ agent: "codebuddy", base: "home", sub: ".codebuddy/skills" },
|
|
46743
|
+
{ agent: "codemaker", base: "home", sub: ".codemaker/skills" },
|
|
46744
|
+
{ agent: "codestudio", base: "home", sub: ".codestudio/skills" },
|
|
46745
|
+
{ agent: "codex", base: "codexHome", sub: "skills" },
|
|
46746
|
+
{ agent: "command-code", base: "home", sub: ".commandcode/skills" },
|
|
46747
|
+
{ agent: "continue", base: "home", sub: ".continue/skills" },
|
|
46748
|
+
{ agent: "cortex", base: "home", sub: ".snowflake/cortex/skills" },
|
|
46749
|
+
{ agent: "crush", base: "home", sub: ".config/crush/skills" },
|
|
46750
|
+
{ agent: "cursor", base: "home", sub: ".cursor/skills" },
|
|
46751
|
+
{ agent: "deepagents", base: "home", sub: ".deepagents/agent/skills" },
|
|
46752
|
+
{ agent: "devin", base: "configHome", sub: "devin/skills" },
|
|
46753
|
+
{ agent: "dexto", base: "home", sub: ".agents/skills" },
|
|
46754
|
+
{ agent: "droid", base: "home", sub: ".factory/skills" },
|
|
46755
|
+
{ agent: "firebender", base: "home", sub: ".firebender/skills" },
|
|
46756
|
+
{ agent: "forgecode", base: "home", sub: ".forge/skills" },
|
|
46757
|
+
{ agent: "gemini-cli", base: "home", sub: ".gemini/skills" },
|
|
46758
|
+
{ agent: "github-copilot", base: "home", sub: ".copilot/skills" },
|
|
46759
|
+
{ agent: "goose", base: "configHome", sub: "goose/skills" },
|
|
46760
|
+
{ agent: "hermes-agent", base: "hermesHome", sub: "skills" },
|
|
46761
|
+
{ agent: "inference-sh", base: "home", sub: ".inferencesh/skills" },
|
|
46762
|
+
{ agent: "jazz", base: "home", sub: ".jazz/skills" },
|
|
46763
|
+
{ agent: "junie", base: "home", sub: ".junie/skills" },
|
|
46764
|
+
{ agent: "iflow-cli", base: "home", sub: ".iflow/skills" },
|
|
46765
|
+
{ agent: "kilo", base: "home", sub: ".kilocode/skills" },
|
|
46766
|
+
{ agent: "kimi-code-cli", base: "home", sub: ".agents/skills" },
|
|
46767
|
+
{ agent: "kiro-cli", base: "home", sub: ".kiro/skills" },
|
|
46768
|
+
{ agent: "kode", base: "home", sub: ".kode/skills" },
|
|
46769
|
+
{ agent: "lingma", base: "home", sub: ".lingma/skills" },
|
|
46770
|
+
{ agent: "loaf", base: "home", sub: ".agents/skills" },
|
|
46771
|
+
{ agent: "mcpjam", base: "home", sub: ".mcpjam/skills" },
|
|
46772
|
+
{ agent: "mistral-vibe", base: "vibeHome", sub: "skills" },
|
|
46773
|
+
{ agent: "moxby", base: "home", sub: ".moxby/skills" },
|
|
46774
|
+
{ agent: "mux", base: "home", sub: ".mux/skills" },
|
|
46775
|
+
{ agent: "opencode", base: "configHome", sub: "opencode/skills" },
|
|
46776
|
+
{ agent: "openhands", base: "home", sub: ".openhands/skills" },
|
|
46777
|
+
{ agent: "ona", base: "home", sub: ".ona/skills" },
|
|
46778
|
+
{ agent: "pi", base: "home", sub: ".pi/agent/skills" },
|
|
46779
|
+
{ agent: "qoder", base: "home", sub: ".qoder/skills" },
|
|
46780
|
+
{ agent: "qoder-cn", base: "home", sub: ".qoder-cn/skills" },
|
|
46781
|
+
{ agent: "qwen-code", base: "home", sub: ".qwen/skills" },
|
|
46782
|
+
{ agent: "replit", base: "configHome", sub: "agents/skills" },
|
|
46783
|
+
{ agent: "reasonix", base: "home", sub: ".reasonix/skills" },
|
|
46784
|
+
{ agent: "rovodev", base: "home", sub: ".rovodev/skills" },
|
|
46785
|
+
{ agent: "roo", base: "home", sub: ".roo/skills" },
|
|
46786
|
+
{ agent: "tabnine-cli", base: "home", sub: ".tabnine/agent/skills" },
|
|
46787
|
+
{ agent: "terramind", base: "home", sub: ".terramind/skills" },
|
|
46788
|
+
{ agent: "tinycloud", base: "home", sub: ".tinycloud/skills" },
|
|
46789
|
+
{ agent: "trae", base: "home", sub: ".trae/skills" },
|
|
46790
|
+
{ agent: "trae-cn", base: "home", sub: ".trae-cn/skills" },
|
|
46791
|
+
{ agent: "warp", base: "home", sub: ".agents/skills" },
|
|
46792
|
+
{ agent: "windsurf", base: "home", sub: ".codeium/windsurf/skills" },
|
|
46793
|
+
{ agent: "zed", base: "home", sub: ".agents/skills" },
|
|
46794
|
+
{ agent: "zencoder", base: "home", sub: ".zencoder/skills" },
|
|
46795
|
+
{ agent: "zenflow", base: "home", sub: ".zencoder/skills" },
|
|
46796
|
+
{ agent: "neovate", base: "home", sub: ".neovate/skills" },
|
|
46797
|
+
{ agent: "pochi", base: "home", sub: ".pochi/skills" },
|
|
46798
|
+
{ agent: "adal", base: "home", sub: ".adal/skills" },
|
|
46799
|
+
{ agent: "universal", base: "configHome", sub: "agents/skills" }
|
|
46800
|
+
];
|
|
46739
46801
|
}
|
|
46740
|
-
|
|
46741
|
-
|
|
46742
|
-
|
|
46743
|
-
|
|
46802
|
+
});
|
|
46803
|
+
|
|
46804
|
+
// src/utils/skillsMirror.ts
|
|
46805
|
+
import { cpSync, existsSync as existsSync22, mkdirSync as mkdirSync12, readdirSync as readdirSync9, rmSync as rmSync4, symlinkSync } from "fs";
|
|
46806
|
+
import { homedir as homedir7 } from "os";
|
|
46807
|
+
import { dirname as dirname9, isAbsolute as isAbsolute7, join as join21, relative as relative5 } from "path";
|
|
46808
|
+
function resolveBases(home, env) {
|
|
46809
|
+
const xdg = env["XDG_CONFIG_HOME"]?.trim();
|
|
46810
|
+
return {
|
|
46811
|
+
home,
|
|
46812
|
+
configHome: xdg && isAbsolute7(xdg) ? xdg : join21(home, ".config"),
|
|
46813
|
+
codexHome: env["CODEX_HOME"]?.trim() || join21(home, ".codex"),
|
|
46814
|
+
claudeHome: env["CLAUDE_CONFIG_DIR"]?.trim() || join21(home, ".claude"),
|
|
46815
|
+
vibeHome: env["VIBE_HOME"]?.trim() || join21(home, ".vibe"),
|
|
46816
|
+
hermesHome: env["HERMES_HOME"]?.trim() || join21(home, ".hermes"),
|
|
46817
|
+
autohandHome: env["AUTOHAND_HOME"]?.trim() || join21(home, ".autohand")
|
|
46818
|
+
};
|
|
46744
46819
|
}
|
|
46745
|
-
function
|
|
46746
|
-
|
|
46747
|
-
|
|
46748
|
-
|
|
46749
|
-
}
|
|
46750
|
-
return keysForDirs(dirs);
|
|
46820
|
+
function listSkillDirs(store) {
|
|
46821
|
+
return readdirSync9(store, { withFileTypes: true }).filter(
|
|
46822
|
+
(e3) => (e3.isDirectory() || e3.isSymbolicLink()) && existsSync22(join21(store, e3.name, "SKILL.md"))
|
|
46823
|
+
).map((e3) => e3.name);
|
|
46751
46824
|
}
|
|
46752
|
-
function
|
|
46753
|
-
|
|
46754
|
-
|
|
46755
|
-
|
|
46825
|
+
function linkOrCopy(sourceSkill, targetSkill, platform10) {
|
|
46826
|
+
rmSync4(targetSkill, { recursive: true, force: true });
|
|
46827
|
+
if (platform10 === "win32") {
|
|
46828
|
+
cpSync(sourceSkill, targetSkill, { recursive: true });
|
|
46829
|
+
} else {
|
|
46830
|
+
symlinkSync(relative5(dirname9(targetSkill), sourceSkill), targetSkill);
|
|
46756
46831
|
}
|
|
46757
|
-
return keysForDirs(dirs);
|
|
46758
46832
|
}
|
|
46759
|
-
function
|
|
46760
|
-
|
|
46761
|
-
|
|
46762
|
-
|
|
46763
|
-
|
|
46764
|
-
if (input2.env["CLAUDECODE"]) {
|
|
46765
|
-
return { agents: ["claude-code"], reason: "running under Claude Code" };
|
|
46833
|
+
function mirrorInto(targetDir, source, skills, platform10) {
|
|
46834
|
+
try {
|
|
46835
|
+
mkdirSync12(targetDir, { recursive: true });
|
|
46836
|
+
} catch {
|
|
46837
|
+
return false;
|
|
46766
46838
|
}
|
|
46767
|
-
const
|
|
46768
|
-
|
|
46769
|
-
|
|
46839
|
+
for (const skill of skills) {
|
|
46840
|
+
try {
|
|
46841
|
+
linkOrCopy(join21(source, skill), join21(targetDir, skill), platform10);
|
|
46842
|
+
} catch {
|
|
46843
|
+
}
|
|
46770
46844
|
}
|
|
46771
|
-
return
|
|
46845
|
+
return true;
|
|
46772
46846
|
}
|
|
46773
|
-
function
|
|
46774
|
-
|
|
46847
|
+
function mirrorGlobalSkills(opts) {
|
|
46848
|
+
const home = opts.home ?? homedir7();
|
|
46849
|
+
const platform10 = opts.platform ?? process.platform;
|
|
46850
|
+
const bases = resolveBases(home, opts.env ?? process.env);
|
|
46851
|
+
const source = join21(bases.claudeHome, "skills");
|
|
46852
|
+
const universalStore = join21(home, ".agents", "skills");
|
|
46853
|
+
if (!existsSync22(source)) return { source: null, mirrored: [] };
|
|
46854
|
+
const allowed = new Set(opts.skills);
|
|
46855
|
+
const skills = listSkillDirs(source).filter((name) => allowed.has(name));
|
|
46856
|
+
if (skills.length === 0) return { source, mirrored: [] };
|
|
46857
|
+
const mirrored = [];
|
|
46858
|
+
for (const { agent, base: base2, sub } of AGENT_GLOBAL_DIRS) {
|
|
46859
|
+
const targetDir = join21(bases[base2], ...sub.split("/").filter(Boolean));
|
|
46860
|
+
if (targetDir === source || targetDir === universalStore) continue;
|
|
46861
|
+
if (!existsSync22(dirname9(targetDir))) continue;
|
|
46862
|
+
if (mirrorInto(targetDir, source, skills, platform10)) mirrored.push({ agent, dir: targetDir });
|
|
46863
|
+
}
|
|
46864
|
+
return { source, mirrored };
|
|
46775
46865
|
}
|
|
46776
|
-
var
|
|
46777
|
-
|
|
46778
|
-
"src/utils/skillsTargets.ts"() {
|
|
46866
|
+
var init_skillsMirror = __esm({
|
|
46867
|
+
"src/utils/skillsMirror.ts"() {
|
|
46779
46868
|
"use strict";
|
|
46780
|
-
|
|
46781
|
-
".claude": "claude-code",
|
|
46782
|
-
".agents": "universal",
|
|
46783
|
-
".hermes": "hermes-agent",
|
|
46784
|
-
".factory": "droid",
|
|
46785
|
-
".kiro": "kiro-cli"
|
|
46786
|
-
};
|
|
46787
|
-
DETECTABLE = [
|
|
46788
|
-
{ bin: "claude", dir: ".claude" },
|
|
46789
|
-
{ bin: "hermes", dir: ".hermes" },
|
|
46790
|
-
{ bin: "droid", dir: ".factory" },
|
|
46791
|
-
{ bin: "cursor", dir: ".agents" },
|
|
46792
|
-
{ bin: "codex", dir: ".agents" },
|
|
46793
|
-
{ bin: "opencode", dir: ".agents" },
|
|
46794
|
-
{ bin: "gemini", dir: ".agents" }
|
|
46795
|
-
];
|
|
46869
|
+
init_agentDirs_generated();
|
|
46796
46870
|
}
|
|
46797
46871
|
});
|
|
46798
46872
|
|
|
@@ -46818,15 +46892,25 @@ function spawnNpx(args, opts = {}) {
|
|
|
46818
46892
|
return new Promise((resolve59, reject) => {
|
|
46819
46893
|
const child = spawn7(npx.command, npx.args, {
|
|
46820
46894
|
stdio: "inherit",
|
|
46821
|
-
|
|
46895
|
+
// We install with --full-depth (a full `git clone` of the repo, the only
|
|
46896
|
+
// path that bypasses the laggy skills.sh blob — see GLOBAL_INSTALL_ARGS),
|
|
46897
|
+
// which is heavier than the blob fetch, so allow more headroom.
|
|
46898
|
+
timeout: 3e5,
|
|
46822
46899
|
cwd: opts.cwd,
|
|
46823
|
-
|
|
46824
|
-
|
|
46825
|
-
|
|
46826
|
-
|
|
46827
|
-
|
|
46828
|
-
|
|
46829
|
-
|
|
46900
|
+
env: {
|
|
46901
|
+
...process.env,
|
|
46902
|
+
// GH #316 — the upstream `skills` CLI shells out to `git clone`. When
|
|
46903
|
+
// Git's clone-hook protection is active (default in 2.45.1, reverted in
|
|
46904
|
+
// 2.45.2, still present on many corporate/CI setups), a globally
|
|
46905
|
+
// registered `git lfs install` post-checkout hook aborts the clone. The
|
|
46906
|
+
// args reaching this function are hardcoded (no user input), so opting
|
|
46907
|
+
// out is safe.
|
|
46908
|
+
GIT_CLONE_PROTECTION_ACTIVE: "0",
|
|
46909
|
+
// Skills are text; the repo's LFS objects are unrelated binary assets.
|
|
46910
|
+
// Skip the smudge so --full-depth doesn't drag down (or fail on) large
|
|
46911
|
+
// LFS blobs the install doesn't need.
|
|
46912
|
+
GIT_LFS_SKIP_SMUDGE: "1"
|
|
46913
|
+
}
|
|
46830
46914
|
});
|
|
46831
46915
|
child.on("close", (code, signal) => {
|
|
46832
46916
|
if (code === 0) resolve59();
|
|
@@ -46837,18 +46921,7 @@ function spawnNpx(args, opts = {}) {
|
|
|
46837
46921
|
});
|
|
46838
46922
|
}
|
|
46839
46923
|
function runSkillsAdd(source, opts = {}) {
|
|
46840
|
-
|
|
46841
|
-
if (!extraArgs) {
|
|
46842
|
-
const targets = resolveAgentTargets({
|
|
46843
|
-
cwd: opts.cwd ?? process.cwd(),
|
|
46844
|
-
env: process.env,
|
|
46845
|
-
pathStr: process.env["PATH"] ?? "",
|
|
46846
|
-
platform: process.platform
|
|
46847
|
-
});
|
|
46848
|
-
console.log(c.dim(`Installing to: ${targets.agents.join(", ")} \u2014 ${targets.reason}`));
|
|
46849
|
-
extraArgs = buildSkillsAddArgs(targets.agents);
|
|
46850
|
-
}
|
|
46851
|
-
return spawnNpx(["skills", "add", source, ...extraArgs, "--copy"], opts);
|
|
46924
|
+
return spawnNpx(["skills", "add", source, ...opts.extraArgs ?? GLOBAL_INSTALL_ARGS], opts);
|
|
46852
46925
|
}
|
|
46853
46926
|
function runSkillsRemove(names, opts) {
|
|
46854
46927
|
const safe = names.filter((n2) => PLAIN_SKILL_NAME.test(n2));
|
|
@@ -46859,6 +46932,20 @@ function runSkillsRemove(names, opts) {
|
|
|
46859
46932
|
if (!safe.length) return Promise.resolve();
|
|
46860
46933
|
return spawnNpx(["skills", "remove", ...safe, ...opts.global ? ["-g"] : [], "--yes"]);
|
|
46861
46934
|
}
|
|
46935
|
+
function mirrorToInstalledAgents() {
|
|
46936
|
+
try {
|
|
46937
|
+
const names = hyperframesSkillNames({ scope: "global" });
|
|
46938
|
+
if (names.length === 0) return;
|
|
46939
|
+
const { mirrored } = mirrorGlobalSkills({ skills: names });
|
|
46940
|
+
const n2 = mirrored.length;
|
|
46941
|
+
if (n2 > 0) {
|
|
46942
|
+
console.log(
|
|
46943
|
+
c.dim(`Linked skills into ${n2} other agent ${n2 === 1 ? "directory" : "directories"}.`)
|
|
46944
|
+
);
|
|
46945
|
+
}
|
|
46946
|
+
} catch {
|
|
46947
|
+
}
|
|
46948
|
+
}
|
|
46862
46949
|
async function installAllSkills(opts = {}) {
|
|
46863
46950
|
if (!hasNpx()) {
|
|
46864
46951
|
const msg = "npx not found. Install Node.js and retry.";
|
|
@@ -46877,6 +46964,7 @@ async function installAllSkills(opts = {}) {
|
|
|
46877
46964
|
console.log(c.dim(`${source.name} skills skipped`));
|
|
46878
46965
|
}
|
|
46879
46966
|
}
|
|
46967
|
+
mirrorToInstalledAgents();
|
|
46880
46968
|
}
|
|
46881
46969
|
function printSkillSection(result, status, title, mark, color) {
|
|
46882
46970
|
const items = result.skills.filter((s2) => s2.status === status);
|
|
@@ -46929,7 +47017,7 @@ function renderCheck(result) {
|
|
|
46929
47017
|
}
|
|
46930
47018
|
console.log();
|
|
46931
47019
|
}
|
|
46932
|
-
var examples, PLAIN_SKILL_NAME, SOURCES, checkCommand, updateCommand, skills_default;
|
|
47020
|
+
var examples, GLOBAL_INSTALL_ARGS, PLAIN_SKILL_NAME, SOURCES, checkCommand, updateCommand, skills_default;
|
|
46933
47021
|
var init_skills = __esm({
|
|
46934
47022
|
"src/commands/skills.ts"() {
|
|
46935
47023
|
"use strict";
|
|
@@ -46939,13 +47027,24 @@ var init_skills = __esm({
|
|
|
46939
47027
|
init_npxCommand();
|
|
46940
47028
|
init_updateCheck();
|
|
46941
47029
|
init_skillsManifest();
|
|
46942
|
-
|
|
47030
|
+
init_skillsMirror();
|
|
46943
47031
|
examples = [
|
|
46944
47032
|
["Install all HyperFrames skills", "hyperframes skills"],
|
|
46945
47033
|
["Check whether installed skills are up to date", "hyperframes skills check"],
|
|
46946
47034
|
["Check, machine-readable (for agents / CI)", "hyperframes skills check --json"],
|
|
46947
47035
|
["Update all skills to the latest (installs any missing)", "hyperframes skills update"]
|
|
46948
47036
|
];
|
|
47037
|
+
GLOBAL_INSTALL_ARGS = [
|
|
47038
|
+
"--skill",
|
|
47039
|
+
"*",
|
|
47040
|
+
"--global",
|
|
47041
|
+
"--agent",
|
|
47042
|
+
"claude-code",
|
|
47043
|
+
"universal",
|
|
47044
|
+
"--copy",
|
|
47045
|
+
"--full-depth",
|
|
47046
|
+
"--yes"
|
|
47047
|
+
];
|
|
46949
47048
|
PLAIN_SKILL_NAME = /^[a-z0-9][a-z0-9._-]*$/i;
|
|
46950
47049
|
SOURCES = [{ name: "HyperFrames", url: "https://github.com/heygen-com/hyperframes" }];
|
|
46951
47050
|
checkCommand = defineCommand({
|
|
@@ -47036,7 +47135,7 @@ __export(transcribe_exports, {
|
|
|
47036
47135
|
transcribe: () => transcribe
|
|
47037
47136
|
});
|
|
47038
47137
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
47039
|
-
import { existsSync as existsSync23, readFileSync as readFileSync15, mkdirSync as
|
|
47138
|
+
import { existsSync as existsSync23, readFileSync as readFileSync15, mkdirSync as mkdirSync13, unlinkSync as unlinkSync2 } from "fs";
|
|
47040
47139
|
import { join as join22, extname as extname6 } from "path";
|
|
47041
47140
|
import { tmpdir } from "os";
|
|
47042
47141
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
@@ -47209,7 +47308,7 @@ async function transcribe(inputPath, outputDir, options) {
|
|
|
47209
47308
|
}
|
|
47210
47309
|
options?.onProgress?.("Transcribing...");
|
|
47211
47310
|
const outputBase = join22(outputDir, "transcript");
|
|
47212
|
-
|
|
47311
|
+
mkdirSync13(outputDir, { recursive: true });
|
|
47213
47312
|
const whisperArgs = [
|
|
47214
47313
|
"--model",
|
|
47215
47314
|
effectiveModelPath,
|
|
@@ -47331,8 +47430,8 @@ var init_lint = __esm({
|
|
|
47331
47430
|
});
|
|
47332
47431
|
|
|
47333
47432
|
// src/utils/lintProject.ts
|
|
47334
|
-
import { existsSync as existsSync24, readFileSync as readFileSync16, readdirSync as
|
|
47335
|
-
import { dirname as
|
|
47433
|
+
import { existsSync as existsSync24, readFileSync as readFileSync16, readdirSync as readdirSync10 } from "fs";
|
|
47434
|
+
import { dirname as dirname10, extname as extname7, isAbsolute as isAbsolute8, join as join23, posix as posix3, relative as relative6, resolve as resolve13 } from "path";
|
|
47336
47435
|
function readHtmlAttr(tag, name) {
|
|
47337
47436
|
const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
47338
47437
|
const match = tag.match(new RegExp(`\\b${escaped}\\s*=\\s*(?:"([^"]*)"|'([^']*)')`, "i"));
|
|
@@ -47351,7 +47450,7 @@ function collectExternalStyles(projectDir, html, compSrcPath) {
|
|
|
47351
47450
|
if (!rel.split(/\s+/).some((part) => part.toLowerCase() === "stylesheet")) continue;
|
|
47352
47451
|
const href = tag.match(/\bhref\s*=\s*["']([^"']+)["']/i)?.[1] ?? "";
|
|
47353
47452
|
if (!isLocalStylesheetHref(href)) continue;
|
|
47354
|
-
const rootRelative = compSrcPath ? join23(
|
|
47453
|
+
const rootRelative = compSrcPath ? join23(dirname10(compSrcPath), href) : href;
|
|
47355
47454
|
const stylesheet = resolveExistingLocalAsset(projectDir, rootRelative);
|
|
47356
47455
|
if (!stylesheet) continue;
|
|
47357
47456
|
styles.push({ href, content: readFileSync16(stylesheet.resolved, "utf-8") });
|
|
@@ -47373,7 +47472,7 @@ function collectCssSources(projectDir, html, compSrcPath) {
|
|
|
47373
47472
|
if (!rel.split(/\s+/).some((part) => part.toLowerCase() === "stylesheet")) continue;
|
|
47374
47473
|
const href = readHtmlAttr(tag, "href") ?? "";
|
|
47375
47474
|
if (!isLocalStylesheetHref(href)) continue;
|
|
47376
|
-
const rootRelativePath = compSrcPath ? join23(
|
|
47475
|
+
const rootRelativePath = compSrcPath ? join23(dirname10(compSrcPath), href) : href;
|
|
47377
47476
|
const stylesheet = resolveExistingLocalAsset(projectDir, rootRelativePath);
|
|
47378
47477
|
if (!stylesheet) continue;
|
|
47379
47478
|
sources.push({
|
|
@@ -47399,8 +47498,8 @@ function cleanAssetUrl(url) {
|
|
|
47399
47498
|
}
|
|
47400
47499
|
function isWithinProjectRoot(projectDir, candidate) {
|
|
47401
47500
|
const projectRoot = resolve13(projectDir);
|
|
47402
|
-
const relativePath =
|
|
47403
|
-
return relativePath === "" || !relativePath.startsWith("..") && !
|
|
47501
|
+
const relativePath = relative6(projectRoot, candidate);
|
|
47502
|
+
return relativePath === "" || !relativePath.startsWith("..") && !isAbsolute8(relativePath);
|
|
47404
47503
|
}
|
|
47405
47504
|
function addCandidate(candidates, candidate) {
|
|
47406
47505
|
if (!candidates.includes(candidate)) candidates.push(candidate);
|
|
@@ -47428,12 +47527,12 @@ function resolveExistingLocalAsset(projectDir, url) {
|
|
|
47428
47527
|
const projectRoot = resolve13(projectDir);
|
|
47429
47528
|
const resolved = resolveLocalAssetCandidates(projectRoot, url).find(existsSync24);
|
|
47430
47529
|
if (!resolved) return null;
|
|
47431
|
-
return { resolved, rootRelativePath:
|
|
47530
|
+
return { resolved, rootRelativePath: relative6(projectRoot, resolved) };
|
|
47432
47531
|
}
|
|
47433
47532
|
function resolveCssAssetCandidates(projectDir, url, htmlCompSrcPath, cssRootRelativePath) {
|
|
47434
47533
|
if (url.startsWith("/")) return resolveLocalAssetCandidates(projectDir, url);
|
|
47435
47534
|
if (cssRootRelativePath) {
|
|
47436
|
-
return resolveLocalAssetCandidates(projectDir, join23(
|
|
47535
|
+
return resolveLocalAssetCandidates(projectDir, join23(dirname10(cssRootRelativePath), url));
|
|
47437
47536
|
}
|
|
47438
47537
|
if (htmlCompSrcPath) {
|
|
47439
47538
|
return resolveLocalAssetCandidates(projectDir, rewriteAssetPath(htmlCompSrcPath, url));
|
|
@@ -47459,7 +47558,7 @@ async function lintProject(project) {
|
|
|
47459
47558
|
if (existsSync24(compositionsDir)) {
|
|
47460
47559
|
const collectHtmlFiles = (dir, rel) => {
|
|
47461
47560
|
const out = [];
|
|
47462
|
-
for (const entry of
|
|
47561
|
+
for (const entry of readdirSync10(dir, { withFileTypes: true })) {
|
|
47463
47562
|
const relPath = rel ? `${rel}/${entry.name}` : entry.name;
|
|
47464
47563
|
if (entry.isDirectory()) out.push(...collectHtmlFiles(join23(dir, entry.name), relPath));
|
|
47465
47564
|
else if (entry.isFile() && entry.name.endsWith(".html")) out.push(relPath);
|
|
@@ -47513,7 +47612,7 @@ function lintProjectAudioFiles(projectDir, htmlSources) {
|
|
|
47513
47612
|
const findings = [];
|
|
47514
47613
|
let audioFiles;
|
|
47515
47614
|
try {
|
|
47516
|
-
audioFiles =
|
|
47615
|
+
audioFiles = readdirSync10(projectDir).filter(
|
|
47517
47616
|
(f3) => AUDIO_EXTENSIONS2.has(extname7(f3).toLowerCase())
|
|
47518
47617
|
);
|
|
47519
47618
|
} catch {
|
|
@@ -47641,7 +47740,7 @@ function lintTextureMaskAssetNotFound(projectDir, htmlSources) {
|
|
|
47641
47740
|
function lintMultipleRootCompositions(projectDir) {
|
|
47642
47741
|
const findings = [];
|
|
47643
47742
|
try {
|
|
47644
|
-
const rootHtmlFiles =
|
|
47743
|
+
const rootHtmlFiles = readdirSync10(projectDir).filter((f3) => f3.endsWith(".html"));
|
|
47645
47744
|
const rootCompositions = [];
|
|
47646
47745
|
for (const file of rootHtmlFiles) {
|
|
47647
47746
|
if (file === "caption-skin.html") continue;
|
|
@@ -48145,7 +48244,7 @@ var init_format = __esm({
|
|
|
48145
48244
|
});
|
|
48146
48245
|
|
|
48147
48246
|
// src/utils/project.ts
|
|
48148
|
-
import { existsSync as existsSync25, statSync as
|
|
48247
|
+
import { existsSync as existsSync25, statSync as statSync7 } from "fs";
|
|
48149
48248
|
import { resolve as resolve15, basename as basename2 } from "path";
|
|
48150
48249
|
function resolveProjectOrThrow(dirArg) {
|
|
48151
48250
|
const trimmed = dirArg?.trim();
|
|
@@ -48159,7 +48258,7 @@ function resolveProjectOrThrow(dirArg) {
|
|
|
48159
48258
|
const dir = resolve15(dirArg ?? ".");
|
|
48160
48259
|
const name = basename2(dir);
|
|
48161
48260
|
const indexPath = resolve15(dir, "index.html");
|
|
48162
|
-
if (!existsSync25(dir) || !
|
|
48261
|
+
if (!existsSync25(dir) || !statSync7(dir).isDirectory()) {
|
|
48163
48262
|
throw new InvalidProjectError("Not a directory: " + dir);
|
|
48164
48263
|
}
|
|
48165
48264
|
if (!existsSync25(indexPath)) {
|
|
@@ -48267,7 +48366,7 @@ var init_fileWatcher = __esm({
|
|
|
48267
48366
|
// src/server/runtimeSource.ts
|
|
48268
48367
|
import { createHash as createHash4 } from "crypto";
|
|
48269
48368
|
import { existsSync as existsSync26, readFileSync as readFileSync17 } from "fs";
|
|
48270
|
-
import { resolve as resolve16, dirname as
|
|
48369
|
+
import { resolve as resolve16, dirname as dirname11 } from "path";
|
|
48271
48370
|
async function loadRuntimeSource() {
|
|
48272
48371
|
return await buildFromSource2() ?? await getInlinedRuntime() ?? readPrebuiltArtifact();
|
|
48273
48372
|
}
|
|
@@ -48327,7 +48426,7 @@ function readFromNodeModules() {
|
|
|
48327
48426
|
const result = readFromDir(resolve16(dir, sub));
|
|
48328
48427
|
if (result) return result;
|
|
48329
48428
|
}
|
|
48330
|
-
const parent =
|
|
48429
|
+
const parent = dirname11(dir);
|
|
48331
48430
|
if (parent === dir) break;
|
|
48332
48431
|
dir = parent;
|
|
48333
48432
|
}
|
|
@@ -48494,7 +48593,7 @@ var init_studioRenderTelemetry = __esm({
|
|
|
48494
48593
|
|
|
48495
48594
|
// ../core/src/studio-api/helpers/safePath.ts
|
|
48496
48595
|
import { join as join24 } from "path";
|
|
48497
|
-
import { readdirSync as
|
|
48596
|
+
import { readdirSync as readdirSync11 } from "fs";
|
|
48498
48597
|
function shouldIgnoreDir(rel) {
|
|
48499
48598
|
return rel === ".hyperframes/backup";
|
|
48500
48599
|
}
|
|
@@ -48504,7 +48603,7 @@ function isInHiddenOrVendorDir(relPath) {
|
|
|
48504
48603
|
}
|
|
48505
48604
|
function walkDir(dir, prefix = "") {
|
|
48506
48605
|
const files = [];
|
|
48507
|
-
for (const entry of
|
|
48606
|
+
for (const entry of readdirSync11(dir, { withFileTypes: true })) {
|
|
48508
48607
|
const rel = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
48509
48608
|
if (IGNORE_DIRS.has(entry.name) || shouldIgnoreDir(rel)) continue;
|
|
48510
48609
|
if (entry.isDirectory()) {
|
|
@@ -48928,7 +49027,7 @@ var init_mime2 = __esm({
|
|
|
48928
49027
|
|
|
48929
49028
|
// ../core/src/studio-api/helpers/waveform.ts
|
|
48930
49029
|
import { spawn as spawn9 } from "child_process";
|
|
48931
|
-
import { existsSync as existsSync28, writeFileSync as writeFileSync10, mkdirSync as
|
|
49030
|
+
import { existsSync as existsSync28, writeFileSync as writeFileSync10, mkdirSync as mkdirSync14 } from "fs";
|
|
48932
49031
|
import { join as join26, resolve as resolve17 } from "path";
|
|
48933
49032
|
function buildWaveformCacheKey(assetPath) {
|
|
48934
49033
|
return `${WAVEFORM_CACHE_VERSION}_${assetPath.replace(/[/\\]/g, "_")}.json`;
|
|
@@ -49000,7 +49099,7 @@ async function generateWaveformCache(projectDir, assetPath) {
|
|
|
49000
49099
|
const cachePath2 = join26(cacheDir, buildWaveformCacheKey(assetPath));
|
|
49001
49100
|
if (existsSync28(cachePath2)) return;
|
|
49002
49101
|
const peaks = await decodeAudioPeaks(audioPath);
|
|
49003
|
-
|
|
49102
|
+
mkdirSync14(cacheDir, { recursive: true });
|
|
49004
49103
|
writeFileSync10(cachePath2, JSON.stringify(peaks));
|
|
49005
49104
|
}
|
|
49006
49105
|
var SAMPLE_RATE, PEAK_COUNT, WAVEFORM_CACHE_VERSION;
|
|
@@ -49015,7 +49114,7 @@ var init_waveform = __esm({
|
|
|
49015
49114
|
|
|
49016
49115
|
// ../core/src/studio-api/helpers/mediaValidation.ts
|
|
49017
49116
|
import { spawnSync } from "child_process";
|
|
49018
|
-
import { mkdtempSync, rmSync as
|
|
49117
|
+
import { mkdtempSync, rmSync as rmSync5, writeFileSync as writeFileSync11 } from "fs";
|
|
49019
49118
|
import { tmpdir as tmpdir2 } from "os";
|
|
49020
49119
|
import { basename as basename3, join as join27 } from "path";
|
|
49021
49120
|
function validateUploadedMedia(filePath, runner = spawnSync) {
|
|
@@ -49062,7 +49161,7 @@ function validateUploadedMediaBuffer(fileName, buffer, runner = spawnSync) {
|
|
|
49062
49161
|
writeFileSync11(tempPath, buffer);
|
|
49063
49162
|
return validateUploadedMedia(tempPath, runner);
|
|
49064
49163
|
} finally {
|
|
49065
|
-
|
|
49164
|
+
rmSync5(tempDir, { recursive: true, force: true });
|
|
49066
49165
|
}
|
|
49067
49166
|
}
|
|
49068
49167
|
var VIDEO_EXT, AUDIO_EXT;
|
|
@@ -49075,9 +49174,9 @@ var init_mediaValidation = __esm({
|
|
|
49075
49174
|
});
|
|
49076
49175
|
|
|
49077
49176
|
// ../core/src/studio-api/helpers/backupJournal.ts
|
|
49078
|
-
import { mkdirSync as
|
|
49177
|
+
import { mkdirSync as mkdirSync15, readdirSync as readdirSync12, readFileSync as readFileSync19, unlinkSync as unlinkSync3, writeFileSync as writeFileSync12 } from "fs";
|
|
49079
49178
|
import { Buffer as Buffer2 } from "buffer";
|
|
49080
|
-
import { join as join28, relative as
|
|
49179
|
+
import { join as join28, relative as relative7 } from "path";
|
|
49081
49180
|
function backupKeyForPath(path2) {
|
|
49082
49181
|
return Buffer2.from(path2, "utf-8").toString("base64url");
|
|
49083
49182
|
}
|
|
@@ -49086,7 +49185,7 @@ function timestampPrefix() {
|
|
|
49086
49185
|
}
|
|
49087
49186
|
function backupPathForResponse(projectDir, backupPath) {
|
|
49088
49187
|
if (!backupPath) return null;
|
|
49089
|
-
const rel =
|
|
49188
|
+
const rel = relative7(projectDir, backupPath);
|
|
49090
49189
|
if (!rel || rel.startsWith("..")) return null;
|
|
49091
49190
|
return rel.split("\\").join("/");
|
|
49092
49191
|
}
|
|
@@ -49094,9 +49193,9 @@ function snapshotBeforeWrite(projectDir, absPath, options = {}) {
|
|
|
49094
49193
|
if (!isSafePath(projectDir, absPath)) return { backupPath: null };
|
|
49095
49194
|
try {
|
|
49096
49195
|
const content = readFileSync19(absPath);
|
|
49097
|
-
const relativePath =
|
|
49196
|
+
const relativePath = relative7(projectDir, absPath);
|
|
49098
49197
|
const backupDir = join28(projectDir, ".hyperframes", "backup");
|
|
49099
|
-
|
|
49198
|
+
mkdirSync15(backupDir, { recursive: true });
|
|
49100
49199
|
const backupKey = backupKeyForPath(relativePath);
|
|
49101
49200
|
const backupPath = nextBackupPath(backupDir, backupKey);
|
|
49102
49201
|
writeFileSync12(backupPath, content);
|
|
@@ -49130,7 +49229,7 @@ function pruneBackups(backupDir, backupKey, keepPerFile) {
|
|
|
49130
49229
|
const keep = Math.max(1, Math.floor(keepPerFile));
|
|
49131
49230
|
const suffix = `-${backupKey}`;
|
|
49132
49231
|
const numberedSuffix = new RegExp(`-${backupKey}-\\d+$`);
|
|
49133
|
-
const matches2 =
|
|
49232
|
+
const matches2 = readdirSync12(backupDir).filter((name) => name.endsWith(suffix) || numberedSuffix.test(name)).map((name) => join28(backupDir, name)).sort((a, b2) => {
|
|
49134
49233
|
return b2.localeCompare(a);
|
|
49135
49234
|
});
|
|
49136
49235
|
for (const file of matches2.slice(keep)) {
|
|
@@ -57454,7 +57553,7 @@ var require_util2 = __commonJS({
|
|
|
57454
57553
|
}
|
|
57455
57554
|
path2 = url.path;
|
|
57456
57555
|
}
|
|
57457
|
-
var
|
|
57556
|
+
var isAbsolute16 = exports.isAbsolute(path2);
|
|
57458
57557
|
var parts = path2.split(/\/+/);
|
|
57459
57558
|
for (var part, up = 0, i2 = parts.length - 1; i2 >= 0; i2--) {
|
|
57460
57559
|
part = parts[i2];
|
|
@@ -57474,7 +57573,7 @@ var require_util2 = __commonJS({
|
|
|
57474
57573
|
}
|
|
57475
57574
|
path2 = parts.join("/");
|
|
57476
57575
|
if (path2 === "") {
|
|
57477
|
-
path2 =
|
|
57576
|
+
path2 = isAbsolute16 ? "/" : ".";
|
|
57478
57577
|
}
|
|
57479
57578
|
if (url) {
|
|
57480
57579
|
url.path = path2;
|
|
@@ -57519,7 +57618,7 @@ var require_util2 = __commonJS({
|
|
|
57519
57618
|
exports.isAbsolute = function(aPath) {
|
|
57520
57619
|
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
|
|
57521
57620
|
};
|
|
57522
|
-
function
|
|
57621
|
+
function relative17(aRoot, aPath) {
|
|
57523
57622
|
if (aRoot === "") {
|
|
57524
57623
|
aRoot = ".";
|
|
57525
57624
|
}
|
|
@@ -57538,7 +57637,7 @@ var require_util2 = __commonJS({
|
|
|
57538
57637
|
}
|
|
57539
57638
|
return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
|
|
57540
57639
|
}
|
|
57541
|
-
exports.relative =
|
|
57640
|
+
exports.relative = relative17;
|
|
57542
57641
|
var supportsNullProto = (function() {
|
|
57543
57642
|
var obj = /* @__PURE__ */ Object.create(null);
|
|
57544
57643
|
return !("__proto__" in obj);
|
|
@@ -86668,14 +86767,14 @@ import {
|
|
|
86668
86767
|
existsSync as existsSync29,
|
|
86669
86768
|
readFileSync as readFileSync20,
|
|
86670
86769
|
writeFileSync as writeFileSync13,
|
|
86671
|
-
mkdirSync as
|
|
86770
|
+
mkdirSync as mkdirSync16,
|
|
86672
86771
|
unlinkSync as unlinkSync4,
|
|
86673
|
-
rmSync as
|
|
86674
|
-
statSync as
|
|
86772
|
+
rmSync as rmSync6,
|
|
86773
|
+
statSync as statSync8,
|
|
86675
86774
|
renameSync as renameSync3,
|
|
86676
|
-
readdirSync as
|
|
86775
|
+
readdirSync as readdirSync13
|
|
86677
86776
|
} from "fs";
|
|
86678
|
-
import { resolve as resolve18, dirname as
|
|
86777
|
+
import { resolve as resolve18, dirname as dirname12, join as join29 } from "path";
|
|
86679
86778
|
function isAcornGsapWriterEnabled() {
|
|
86680
86779
|
const val = process.env["STUDIO_SDK_CUTOVER_ENABLED"];
|
|
86681
86780
|
return val === "true" || val === "1";
|
|
@@ -86741,8 +86840,8 @@ async function parseMutationBody(c3) {
|
|
|
86741
86840
|
return { target: body.target, body };
|
|
86742
86841
|
}
|
|
86743
86842
|
function ensureDir(filePath) {
|
|
86744
|
-
const dir =
|
|
86745
|
-
if (!existsSync29(dir))
|
|
86843
|
+
const dir = dirname12(filePath);
|
|
86844
|
+
if (!existsSync29(dir)) mkdirSync16(dir, { recursive: true });
|
|
86746
86845
|
}
|
|
86747
86846
|
function generateCopyPath(projectDir, originalPath) {
|
|
86748
86847
|
const ext = originalPath.includes(".") ? "." + originalPath.split(".").pop() : "";
|
|
@@ -86759,7 +86858,7 @@ function generateCopyPath(projectDir, originalPath) {
|
|
|
86759
86858
|
}
|
|
86760
86859
|
function walkFiles(dir, filter2) {
|
|
86761
86860
|
const results = [];
|
|
86762
|
-
for (const entry of
|
|
86861
|
+
for (const entry of readdirSync13(dir, { withFileTypes: true })) {
|
|
86763
86862
|
const full2 = join29(dir, entry.name);
|
|
86764
86863
|
if (entry.isDirectory()) {
|
|
86765
86864
|
if (entry.name === "node_modules" || entry.name === ".thumbnails" || entry.name === "renders")
|
|
@@ -87519,11 +87618,11 @@ function registerFileRoutes(api, adapter2) {
|
|
|
87519
87618
|
api.delete("/projects/:id/files/*", async (c3) => {
|
|
87520
87619
|
const res = await resolveProjectFile(c3, adapter2, { mustExist: true });
|
|
87521
87620
|
if ("error" in res) return res.error;
|
|
87522
|
-
const stat3 =
|
|
87621
|
+
const stat3 = statSync8(res.absPath);
|
|
87523
87622
|
const backup = snapshotBeforeWrite(res.project.dir, res.absPath);
|
|
87524
87623
|
if (backup.error) console.warn(`Failed to create backup for ${res.filePath}: ${backup.error}`);
|
|
87525
87624
|
if (stat3.isDirectory()) {
|
|
87526
|
-
|
|
87625
|
+
rmSync6(res.absPath, { recursive: true });
|
|
87527
87626
|
} else {
|
|
87528
87627
|
unlinkSync4(res.absPath);
|
|
87529
87628
|
}
|
|
@@ -87697,7 +87796,7 @@ function registerFileRoutes(api, adapter2) {
|
|
|
87697
87796
|
const subDir = c3.req.query("dir") ?? "";
|
|
87698
87797
|
const targetDir = subDir ? resolveWithinProject(project.dir, subDir) : project.dir;
|
|
87699
87798
|
if (!targetDir) return c3.json({ error: "forbidden" }, 403);
|
|
87700
|
-
if (subDir && !existsSync29(targetDir))
|
|
87799
|
+
if (subDir && !existsSync29(targetDir)) mkdirSync16(targetDir, { recursive: true });
|
|
87701
87800
|
const formData = await c3.req.formData();
|
|
87702
87801
|
const result = await processUploadedFiles(formData, targetDir, project.dir);
|
|
87703
87802
|
return c3.json(
|
|
@@ -88020,11 +88119,11 @@ var init_subComposition = __esm({
|
|
|
88020
88119
|
|
|
88021
88120
|
// ../core/src/studio-api/helpers/projectSignature.ts
|
|
88022
88121
|
import { createHash as createHash5 } from "crypto";
|
|
88023
|
-
import { lstatSync, readFileSync as readFileSync22, readdirSync as
|
|
88024
|
-
import { extname as extname8, isAbsolute as
|
|
88122
|
+
import { lstatSync, readFileSync as readFileSync22, readdirSync as readdirSync14 } from "fs";
|
|
88123
|
+
import { extname as extname8, isAbsolute as isAbsolute9, relative as relative8, resolve as resolve19 } from "path";
|
|
88025
88124
|
function isPathWithin(parentDir, childPath) {
|
|
88026
|
-
const childRelativePath =
|
|
88027
|
-
return childRelativePath === "" || !childRelativePath.startsWith("..") && !
|
|
88125
|
+
const childRelativePath = relative8(parentDir, childPath);
|
|
88126
|
+
return childRelativePath === "" || !childRelativePath.startsWith("..") && !isAbsolute9(childRelativePath);
|
|
88028
88127
|
}
|
|
88029
88128
|
function isTextContentEligible(file, size) {
|
|
88030
88129
|
return SIGNATURE_TEXT_EXTENSIONS.has(extname8(file).toLowerCase()) && size <= MAX_SIGNATURE_TEXT_BYTES;
|
|
@@ -88032,7 +88131,7 @@ function isTextContentEligible(file, size) {
|
|
|
88032
88131
|
function collectProjectSignatureFiles(projectDir, dir, files) {
|
|
88033
88132
|
let entries2;
|
|
88034
88133
|
try {
|
|
88035
|
-
entries2 =
|
|
88134
|
+
entries2 = readdirSync14(dir).sort();
|
|
88036
88135
|
} catch {
|
|
88037
88136
|
return;
|
|
88038
88137
|
}
|
|
@@ -88083,7 +88182,7 @@ function collectProjectSignatureManifestFiles(projectDir, files) {
|
|
|
88083
88182
|
function createProjectFingerprint(projectDir, files) {
|
|
88084
88183
|
const hash2 = createHash5("sha256");
|
|
88085
88184
|
for (const entry of files) {
|
|
88086
|
-
hash2.update(
|
|
88185
|
+
hash2.update(relative8(projectDir, entry.file));
|
|
88087
88186
|
hash2.update("\0");
|
|
88088
88187
|
hash2.update(String(entry.size));
|
|
88089
88188
|
hash2.update("\0");
|
|
@@ -88105,7 +88204,7 @@ function createProjectSignature(projectDir) {
|
|
|
88105
88204
|
if (cached2?.fingerprint === fingerprint) return cached2.signature;
|
|
88106
88205
|
const hash2 = createHash5("sha256");
|
|
88107
88206
|
for (const entry of files) {
|
|
88108
|
-
const relativePath =
|
|
88207
|
+
const relativePath = relative8(normalizedProjectDir, entry.file);
|
|
88109
88208
|
hash2.update(relativePath);
|
|
88110
88209
|
hash2.update("\0");
|
|
88111
88210
|
hash2.update(String(entry.size));
|
|
@@ -88382,7 +88481,7 @@ var init_hfIdPersist = __esm({
|
|
|
88382
88481
|
});
|
|
88383
88482
|
|
|
88384
88483
|
// ../core/src/studio-api/routes/preview.ts
|
|
88385
|
-
import { existsSync as existsSync31, readFileSync as readFileSync24, statSync as
|
|
88484
|
+
import { existsSync as existsSync31, readFileSync as readFileSync24, statSync as statSync9 } from "fs";
|
|
88386
88485
|
import { join as join31 } from "path";
|
|
88387
88486
|
function resolveProjectSignature(adapter2, projectDir) {
|
|
88388
88487
|
return adapter2.getProjectSignature?.(projectDir) ?? createProjectSignature(projectDir);
|
|
@@ -88585,7 +88684,7 @@ ${runtimeTag}`;
|
|
|
88585
88684
|
c3.req.path.replace(`/projects/${project.id}/preview/comp/`, "").split("?")[0] ?? ""
|
|
88586
88685
|
);
|
|
88587
88686
|
const compFile = resolveWithinProject(project.dir, compPath);
|
|
88588
|
-
if (!compFile || !existsSync31(compFile) || !
|
|
88687
|
+
if (!compFile || !existsSync31(compFile) || !statSync9(compFile).isFile()) {
|
|
88589
88688
|
return c3.text("not found", 404);
|
|
88590
88689
|
}
|
|
88591
88690
|
const etag = `"comp:${compPath}:${signature}"`;
|
|
@@ -88613,7 +88712,7 @@ ${runtimeTag}`;
|
|
|
88613
88712
|
if (!file) {
|
|
88614
88713
|
return c3.text("not found", 404);
|
|
88615
88714
|
}
|
|
88616
|
-
const stat3 = existsSync31(file) ?
|
|
88715
|
+
const stat3 = existsSync31(file) ? statSync9(file) : null;
|
|
88617
88716
|
if (!stat3?.isFile()) {
|
|
88618
88717
|
return c3.text("not found", 404);
|
|
88619
88718
|
}
|
|
@@ -88736,7 +88835,7 @@ var init_lint2 = __esm({
|
|
|
88736
88835
|
|
|
88737
88836
|
// ../core/src/studio-api/routes/render.ts
|
|
88738
88837
|
import { streamSSE } from "hono/streaming";
|
|
88739
|
-
import { existsSync as existsSync32, readFileSync as readFileSync26, mkdirSync as
|
|
88838
|
+
import { existsSync as existsSync32, readFileSync as readFileSync26, mkdirSync as mkdirSync17, unlinkSync as unlinkSync5, readdirSync as readdirSync15, statSync as statSync10 } from "fs";
|
|
88740
88839
|
import { join as join33 } from "path";
|
|
88741
88840
|
function registerRenderRoutes(api, adapter2) {
|
|
88742
88841
|
const renderJobs = /* @__PURE__ */ new Map();
|
|
@@ -88787,7 +88886,7 @@ function registerRenderRoutes(api, adapter2) {
|
|
|
88787
88886
|
const timePart = now.toTimeString().slice(0, 8).replace(/:/g, "-");
|
|
88788
88887
|
const jobId = `${project.id}_${datePart}_${timePart}`;
|
|
88789
88888
|
const rendersDir = adapter2.rendersDir(project);
|
|
88790
|
-
if (!existsSync32(rendersDir))
|
|
88889
|
+
if (!existsSync32(rendersDir)) mkdirSync17(rendersDir, { recursive: true });
|
|
88791
88890
|
const ext = FORMAT_EXT3[format] ?? ".mp4";
|
|
88792
88891
|
const outputPath = join33(rendersDir, `${jobId}${ext}`);
|
|
88793
88892
|
const jobState = adapter2.startRender({
|
|
@@ -88912,9 +89011,9 @@ function registerRenderRoutes(api, adapter2) {
|
|
|
88912
89011
|
if (!project) return c3.json({ error: "not found" }, 404);
|
|
88913
89012
|
const rendersDir = adapter2.rendersDir(project);
|
|
88914
89013
|
if (!existsSync32(rendersDir)) return c3.json({ renders: [] });
|
|
88915
|
-
const files =
|
|
89014
|
+
const files = readdirSync15(rendersDir).filter((f3) => f3.endsWith(".mp4") || f3.endsWith(".webm") || f3.endsWith(".mov")).map((f3) => {
|
|
88916
89015
|
const fp = join33(rendersDir, f3);
|
|
88917
|
-
const stat3 =
|
|
89016
|
+
const stat3 = statSync10(fp);
|
|
88918
89017
|
const rid = f3.replace(/\.(mp4|webm|mov)$/, "");
|
|
88919
89018
|
const metaPath = join33(rendersDir, `${rid}.meta.json`);
|
|
88920
89019
|
let status = "complete";
|
|
@@ -89545,7 +89644,7 @@ var init_manualEditsRenderScript = __esm({
|
|
|
89545
89644
|
});
|
|
89546
89645
|
|
|
89547
89646
|
// ../core/src/studio-api/routes/thumbnail.ts
|
|
89548
|
-
import { existsSync as existsSync33, readFileSync as readFileSync27, writeFileSync as writeFileSync15, mkdirSync as
|
|
89647
|
+
import { existsSync as existsSync33, readFileSync as readFileSync27, writeFileSync as writeFileSync15, mkdirSync as mkdirSync18, statSync as statSync11 } from "fs";
|
|
89549
89648
|
import { join as join34 } from "path";
|
|
89550
89649
|
import { createHash as createHash6 } from "crypto";
|
|
89551
89650
|
function registerThumbnailRoutes(api, adapter2) {
|
|
@@ -89577,7 +89676,7 @@ function registerThumbnailRoutes(api, adapter2) {
|
|
|
89577
89676
|
if (!vpWidth) {
|
|
89578
89677
|
const htmlFile = join34(project.dir, compPath);
|
|
89579
89678
|
if (existsSync33(htmlFile)) {
|
|
89580
|
-
sourceMtime = Math.round(
|
|
89679
|
+
sourceMtime = Math.round(statSync11(htmlFile).mtimeMs);
|
|
89581
89680
|
const html = readFileSync27(htmlFile, "utf-8");
|
|
89582
89681
|
const wMatch = html.match(/data-width=["'](\d+)["']/);
|
|
89583
89682
|
const hMatch = html.match(/data-height=["'](\d+)["']/);
|
|
@@ -89590,14 +89689,14 @@ function registerThumbnailRoutes(api, adapter2) {
|
|
|
89590
89689
|
if (existsSync33(manualEditsFile)) {
|
|
89591
89690
|
const manualEditsContent = readFileSync27(manualEditsFile, "utf-8");
|
|
89592
89691
|
manualEditsKey = `_${createHash6("sha1").update(manualEditsContent).digest("hex").slice(0, 16)}`;
|
|
89593
|
-
sourceMtime = Math.max(sourceMtime, Math.round(
|
|
89692
|
+
sourceMtime = Math.max(sourceMtime, Math.round(statSync11(manualEditsFile).mtimeMs));
|
|
89594
89693
|
}
|
|
89595
89694
|
const motionFile = join34(project.dir, STUDIO_MOTION_PATH);
|
|
89596
89695
|
let motionKey = "";
|
|
89597
89696
|
if (existsSync33(motionFile)) {
|
|
89598
89697
|
const motionContent = readFileSync27(motionFile, "utf-8");
|
|
89599
89698
|
motionKey = `_${createHash6("sha1").update(motionContent).digest("hex").slice(0, 16)}`;
|
|
89600
|
-
sourceMtime = Math.max(sourceMtime, Math.round(
|
|
89699
|
+
sourceMtime = Math.max(sourceMtime, Math.round(statSync11(motionFile).mtimeMs));
|
|
89601
89700
|
}
|
|
89602
89701
|
const previewUrl = compPath === "index.html" ? `http://${c3.req.header("host")}/api/projects/${project.id}/preview` : `http://${c3.req.header("host")}/api/projects/${project.id}/preview/comp/${compPath}`;
|
|
89603
89702
|
const cacheDir = join34(project.dir, ".thumbnails");
|
|
@@ -89628,7 +89727,7 @@ function registerThumbnailRoutes(api, adapter2) {
|
|
|
89628
89727
|
500
|
|
89629
89728
|
);
|
|
89630
89729
|
}
|
|
89631
|
-
if (!existsSync33(cacheDir))
|
|
89730
|
+
if (!existsSync33(cacheDir)) mkdirSync18(cacheDir, { recursive: true });
|
|
89632
89731
|
writeFileSync15(cachePath2, buffer);
|
|
89633
89732
|
return new Response(new Uint8Array(buffer), {
|
|
89634
89733
|
headers: { "Content-Type": contentType, "Cache-Control": "public, max-age=60" }
|
|
@@ -89650,7 +89749,7 @@ var init_thumbnail = __esm({
|
|
|
89650
89749
|
});
|
|
89651
89750
|
|
|
89652
89751
|
// ../core/src/studio-api/routes/waveform.ts
|
|
89653
|
-
import { existsSync as existsSync34, readFileSync as readFileSync28, writeFileSync as writeFileSync16, mkdirSync as
|
|
89752
|
+
import { existsSync as existsSync34, readFileSync as readFileSync28, writeFileSync as writeFileSync16, mkdirSync as mkdirSync19 } from "fs";
|
|
89654
89753
|
import { join as join35 } from "path";
|
|
89655
89754
|
function registerWaveformRoutes(api, adapter2) {
|
|
89656
89755
|
api.get("/projects/:id/waveform/*", async (c3) => {
|
|
@@ -89677,7 +89776,7 @@ function registerWaveformRoutes(api, adapter2) {
|
|
|
89677
89776
|
return c3.json({ error: "failed to decode audio" }, 500);
|
|
89678
89777
|
}
|
|
89679
89778
|
try {
|
|
89680
|
-
|
|
89779
|
+
mkdirSync19(cacheDir, { recursive: true });
|
|
89681
89780
|
writeFileSync16(cachePath2, JSON.stringify(peaks));
|
|
89682
89781
|
} catch {
|
|
89683
89782
|
}
|
|
@@ -89693,8 +89792,8 @@ var init_waveform2 = __esm({
|
|
|
89693
89792
|
|
|
89694
89793
|
// ../core/src/fonts/systemFontLocator.ts
|
|
89695
89794
|
import { execFileSync as execFileSync5 } from "child_process";
|
|
89696
|
-
import { existsSync as existsSync35, lstatSync as lstatSync2, readdirSync as
|
|
89697
|
-
import { homedir as
|
|
89795
|
+
import { existsSync as existsSync35, lstatSync as lstatSync2, readdirSync as readdirSync16, realpathSync as realpathSync2 } from "fs";
|
|
89796
|
+
import { homedir as homedir8, platform as platform5 } from "os";
|
|
89698
89797
|
import { join as join36, resolve as resolve20 } from "path";
|
|
89699
89798
|
function getAllowedFontDirs() {
|
|
89700
89799
|
if (allowedDirsCache) return allowedDirsCache;
|
|
@@ -89754,7 +89853,7 @@ function isRegularWeight(fileName) {
|
|
|
89754
89853
|
return !lower2.includes("bold") && !lower2.includes("italic") && !lower2.includes("light");
|
|
89755
89854
|
}
|
|
89756
89855
|
function fontDirectories() {
|
|
89757
|
-
const home =
|
|
89856
|
+
const home = homedir8();
|
|
89758
89857
|
if (platform5() === "darwin") {
|
|
89759
89858
|
return [
|
|
89760
89859
|
join36(home, "Library", "Fonts"),
|
|
@@ -89767,7 +89866,7 @@ function fontDirectories() {
|
|
|
89767
89866
|
return [
|
|
89768
89867
|
join36(process.env.WINDIR || "C:\\Windows", "Fonts"),
|
|
89769
89868
|
join36(
|
|
89770
|
-
process.env.LOCALAPPDATA || join36(
|
|
89869
|
+
process.env.LOCALAPPDATA || join36(homedir8(), "AppData", "Local"),
|
|
89771
89870
|
"Microsoft",
|
|
89772
89871
|
"Windows",
|
|
89773
89872
|
"Fonts"
|
|
@@ -89785,7 +89884,7 @@ function collectFontFileEntries(dir, depth = 0) {
|
|
|
89785
89884
|
if (!existsSync35(dir) || depth > 2) return [];
|
|
89786
89885
|
const entries2 = [];
|
|
89787
89886
|
try {
|
|
89788
|
-
for (const entry of
|
|
89887
|
+
for (const entry of readdirSync16(dir, { withFileTypes: true })) {
|
|
89789
89888
|
const fullPath = join36(dir, entry.name);
|
|
89790
89889
|
if (entry.isDirectory()) {
|
|
89791
89890
|
entries2.push(...collectFontFileEntries(fullPath, depth + 1));
|
|
@@ -90282,9 +90381,9 @@ __export(manager_exports2, {
|
|
|
90282
90381
|
isLinuxArm: () => isLinuxArm
|
|
90283
90382
|
});
|
|
90284
90383
|
import { execSync as execSync5, spawnSync as spawnSync2 } from "child_process";
|
|
90285
|
-
import { existsSync as existsSync36, readdirSync as
|
|
90384
|
+
import { existsSync as existsSync36, readdirSync as readdirSync17, rmSync as rmSync7 } from "fs";
|
|
90286
90385
|
import { basename as basename4 } from "path";
|
|
90287
|
-
import { homedir as
|
|
90386
|
+
import { homedir as homedir9 } from "os";
|
|
90288
90387
|
import { join as join37 } from "path";
|
|
90289
90388
|
async function loadPuppeteerBrowsers() {
|
|
90290
90389
|
try {
|
|
@@ -90368,7 +90467,7 @@ function findFromPuppeteerCache() {
|
|
|
90368
90467
|
if (!existsSync36(PUPPETEER_CACHE_DIR)) return void 0;
|
|
90369
90468
|
let versions;
|
|
90370
90469
|
try {
|
|
90371
|
-
versions = [...
|
|
90470
|
+
versions = [...readdirSync17(PUPPETEER_CACHE_DIR)].sort(compareVersionDirsDescending);
|
|
90372
90471
|
} catch {
|
|
90373
90472
|
return void 0;
|
|
90374
90473
|
}
|
|
@@ -90531,7 +90630,7 @@ function clearBrowser() {
|
|
|
90531
90630
|
if (!existsSync36(CACHE_DIR2)) {
|
|
90532
90631
|
return false;
|
|
90533
90632
|
}
|
|
90534
|
-
|
|
90633
|
+
rmSync7(CACHE_DIR2, { recursive: true, force: true });
|
|
90535
90634
|
return true;
|
|
90536
90635
|
}
|
|
90537
90636
|
function isLinuxArm() {
|
|
@@ -90542,8 +90641,8 @@ var init_manager2 = __esm({
|
|
|
90542
90641
|
"src/browser/manager.ts"() {
|
|
90543
90642
|
"use strict";
|
|
90544
90643
|
CHROME_VERSION = "131.0.6778.85";
|
|
90545
|
-
CACHE_DIR2 = join37(
|
|
90546
|
-
PUPPETEER_CACHE_DIR = join37(
|
|
90644
|
+
CACHE_DIR2 = join37(homedir9(), ".cache", "hyperframes", "chrome");
|
|
90645
|
+
PUPPETEER_CACHE_DIR = join37(homedir9(), ".cache", "puppeteer", "chrome-headless-shell");
|
|
90547
90646
|
SYSTEM_CHROME_PATHS = process.platform === "darwin" ? ["/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"] : [
|
|
90548
90647
|
"/usr/bin/google-chrome",
|
|
90549
90648
|
"/usr/bin/google-chrome-stable",
|
|
@@ -93813,8 +93912,8 @@ __export(deterministicFonts_exports, {
|
|
|
93813
93912
|
parseFontFamilyValue: () => parseFontFamilyValue
|
|
93814
93913
|
});
|
|
93815
93914
|
import { createHash as createHash7 } from "crypto";
|
|
93816
|
-
import { existsSync as existsSync37, mkdirSync as
|
|
93817
|
-
import { homedir as
|
|
93915
|
+
import { existsSync as existsSync37, mkdirSync as mkdirSync20, readFileSync as readFileSync29, writeFileSync as writeFileSync17 } from "fs";
|
|
93916
|
+
import { homedir as homedir10, tmpdir as tmpdir3 } from "os";
|
|
93818
93917
|
import { join as join38 } from "path";
|
|
93819
93918
|
function parseFontFamilyValue(value) {
|
|
93820
93919
|
return value.split(",").map((piece) => piece.trim().replace(/^['"]/, "").replace(/['"]$/, "").trim()).filter((piece) => piece.length > 0);
|
|
@@ -93973,7 +94072,7 @@ function warnUnresolvedFonts(unresolved) {
|
|
|
93973
94072
|
);
|
|
93974
94073
|
}
|
|
93975
94074
|
function resolveFontCacheRoot() {
|
|
93976
|
-
return process.env.HYPERFRAMES_FONT_CACHE_DIR ?? (process.env.AWS_LAMBDA_FUNCTION_NAME ? join38(tmpdir3(), "hyperframes", "fonts") : join38(
|
|
94075
|
+
return process.env.HYPERFRAMES_FONT_CACHE_DIR ?? (process.env.AWS_LAMBDA_FUNCTION_NAME ? join38(tmpdir3(), "hyperframes", "fonts") : join38(homedir10(), ".cache", "hyperframes", "fonts"));
|
|
93977
94076
|
}
|
|
93978
94077
|
function fontSlug(familyName) {
|
|
93979
94078
|
return familyName.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
@@ -93981,7 +94080,7 @@ function fontSlug(familyName) {
|
|
|
93981
94080
|
function fontCacheDir(slug) {
|
|
93982
94081
|
const dir = join38(GOOGLE_FONTS_CACHE_DIR, slug);
|
|
93983
94082
|
if (!existsSync37(dir)) {
|
|
93984
|
-
|
|
94083
|
+
mkdirSync20(dir, { recursive: true });
|
|
93985
94084
|
}
|
|
93986
94085
|
return dir;
|
|
93987
94086
|
}
|
|
@@ -94268,13 +94367,13 @@ import { spawn as spawn10 } from "child_process";
|
|
|
94268
94367
|
import {
|
|
94269
94368
|
copyFileSync as copyFileSync2,
|
|
94270
94369
|
existsSync as existsSync38,
|
|
94271
|
-
mkdirSync as
|
|
94370
|
+
mkdirSync as mkdirSync21,
|
|
94272
94371
|
readFileSync as readFileSync30,
|
|
94273
94372
|
renameSync as renameSync4,
|
|
94274
|
-
rmSync as
|
|
94275
|
-
statSync as
|
|
94373
|
+
rmSync as rmSync8,
|
|
94374
|
+
statSync as statSync12
|
|
94276
94375
|
} from "fs";
|
|
94277
|
-
import { dirname as
|
|
94376
|
+
import { dirname as dirname13, isAbsolute as isAbsolute10, join as join39, resolve as resolve21 } from "path";
|
|
94278
94377
|
function splitUrlSuffix2(src) {
|
|
94279
94378
|
const queryIdx = src.indexOf("?");
|
|
94280
94379
|
const hashIdx = src.indexOf("#");
|
|
@@ -94311,14 +94410,14 @@ function resolveGifSourcePath(src, options) {
|
|
|
94311
94410
|
if (isHttpUrl(trimmed)) return null;
|
|
94312
94411
|
const projectRelative = basePath.startsWith("/") ? basePath.slice(1) : basePath;
|
|
94313
94412
|
const candidates = [
|
|
94314
|
-
|
|
94413
|
+
isAbsolute10(basePath) ? basePath : resolve21(options.projectDir, projectRelative),
|
|
94315
94414
|
resolve21(options.downloadDir, normalizedBase)
|
|
94316
94415
|
];
|
|
94317
94416
|
return candidates.find((candidate) => existsSync38(candidate)) ?? null;
|
|
94318
94417
|
}
|
|
94319
94418
|
function isUsableFile(path2) {
|
|
94320
94419
|
try {
|
|
94321
|
-
const stat3 =
|
|
94420
|
+
const stat3 = statSync12(path2);
|
|
94322
94421
|
return stat3.isFile() && stat3.size > 0;
|
|
94323
94422
|
} catch {
|
|
94324
94423
|
return false;
|
|
@@ -94434,11 +94533,11 @@ async function runAnimatedGifTranscode(request) {
|
|
|
94434
94533
|
});
|
|
94435
94534
|
}
|
|
94436
94535
|
async function ensurePreparedWebm(input2) {
|
|
94437
|
-
if (!existsSync38(
|
|
94438
|
-
|
|
94536
|
+
if (!existsSync38(dirname13(input2.cachePath))) {
|
|
94537
|
+
mkdirSync21(dirname13(input2.cachePath), { recursive: true });
|
|
94439
94538
|
}
|
|
94440
|
-
if (!existsSync38(
|
|
94441
|
-
|
|
94539
|
+
if (!existsSync38(dirname13(input2.outputPath))) {
|
|
94540
|
+
mkdirSync21(dirname13(input2.outputPath), { recursive: true });
|
|
94442
94541
|
}
|
|
94443
94542
|
if (!isUsableFile(input2.cachePath)) {
|
|
94444
94543
|
const tmpPath = `${input2.cachePath}.tmp-${process.pid}-${Date.now()}`;
|
|
@@ -94462,10 +94561,10 @@ async function ensurePreparedWebm(input2) {
|
|
|
94462
94561
|
if (!isUsableFile(input2.cachePath)) {
|
|
94463
94562
|
renameSync4(tmpPath, input2.cachePath);
|
|
94464
94563
|
} else {
|
|
94465
|
-
|
|
94564
|
+
rmSync8(tmpPath, { force: true });
|
|
94466
94565
|
}
|
|
94467
94566
|
} catch (error) {
|
|
94468
|
-
|
|
94567
|
+
rmSync8(tmpPath, { force: true });
|
|
94469
94568
|
throw error;
|
|
94470
94569
|
}
|
|
94471
94570
|
}
|
|
@@ -94593,7 +94692,7 @@ var init_animatedGifPrep = __esm({
|
|
|
94593
94692
|
// ../producer/src/services/hyperframeRuntimeLoader.ts
|
|
94594
94693
|
import { createHash as createHash9 } from "crypto";
|
|
94595
94694
|
import { existsSync as existsSync39, readFileSync as readFileSync31 } from "fs";
|
|
94596
|
-
import { dirname as
|
|
94695
|
+
import { dirname as dirname14, resolve as resolve22 } from "path";
|
|
94597
94696
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
94598
94697
|
function resolveHyperframeManifestPath() {
|
|
94599
94698
|
if (process.env.PRODUCER_HYPERFRAME_MANIFEST_PATH) {
|
|
@@ -94629,7 +94728,7 @@ function resolveVerifiedHyperframeRuntime() {
|
|
|
94629
94728
|
`[HyperframeRuntimeLoader] Invalid manifest at ${manifestPath}; missing iife artifact or sha256.`
|
|
94630
94729
|
);
|
|
94631
94730
|
}
|
|
94632
|
-
const runtimePath = resolve22(
|
|
94731
|
+
const runtimePath = resolve22(dirname14(manifestPath), runtimeFileName);
|
|
94633
94732
|
if (!existsSync39(runtimePath)) {
|
|
94634
94733
|
throw new Error(`[HyperframeRuntimeLoader] Missing runtime artifact at ${runtimePath}.`);
|
|
94635
94734
|
}
|
|
@@ -94652,7 +94751,7 @@ var PRODUCER_DIR, SIBLING_MANIFEST_PATH, MODULE_RELATIVE_MANIFEST_PATH, CWD_RELA
|
|
|
94652
94751
|
var init_hyperframeRuntimeLoader = __esm({
|
|
94653
94752
|
"../producer/src/services/hyperframeRuntimeLoader.ts"() {
|
|
94654
94753
|
"use strict";
|
|
94655
|
-
PRODUCER_DIR =
|
|
94754
|
+
PRODUCER_DIR = dirname14(fileURLToPath2(import.meta.url));
|
|
94656
94755
|
SIBLING_MANIFEST_PATH = resolve22(PRODUCER_DIR, "hyperframe.manifest.json");
|
|
94657
94756
|
MODULE_RELATIVE_MANIFEST_PATH = resolve22(
|
|
94658
94757
|
PRODUCER_DIR,
|
|
@@ -94684,7 +94783,7 @@ var init_hf_early_stub_inline = __esm({
|
|
|
94684
94783
|
// ../producer/src/services/fileServer.ts
|
|
94685
94784
|
import { Hono as Hono3 } from "hono";
|
|
94686
94785
|
import { serve as serve2 } from "@hono/node-server";
|
|
94687
|
-
import { existsSync as existsSync40, realpathSync as realpathSync3, statSync as
|
|
94786
|
+
import { existsSync as existsSync40, realpathSync as realpathSync3, statSync as statSync13, createReadStream } from "fs";
|
|
94688
94787
|
import { readFile as readFile2 } from "fs/promises";
|
|
94689
94788
|
import { Readable as Readable2 } from "stream";
|
|
94690
94789
|
import { join as join40, extname as extname9, resolve as resolve23, sep as sep5 } from "path";
|
|
@@ -95032,13 +95131,13 @@ function createFileServer2(options) {
|
|
|
95032
95131
|
let filePath = null;
|
|
95033
95132
|
if (compiledDir) {
|
|
95034
95133
|
const candidate = join40(compiledDir, relativePath);
|
|
95035
|
-
if (existsSync40(candidate) && isPathInside2(candidate, compiledDir) &&
|
|
95134
|
+
if (existsSync40(candidate) && isPathInside2(candidate, compiledDir) && statSync13(candidate).isFile()) {
|
|
95036
95135
|
filePath = candidate;
|
|
95037
95136
|
}
|
|
95038
95137
|
}
|
|
95039
95138
|
if (!filePath) {
|
|
95040
95139
|
const candidate = join40(projectDir, relativePath);
|
|
95041
|
-
if (existsSync40(candidate) && isPathInside2(candidate, projectDir) &&
|
|
95140
|
+
if (existsSync40(candidate) && isPathInside2(candidate, projectDir) && statSync13(candidate).isFile()) {
|
|
95042
95141
|
filePath = candidate;
|
|
95043
95142
|
}
|
|
95044
95143
|
}
|
|
@@ -95060,7 +95159,7 @@ function createFileServer2(options) {
|
|
|
95060
95159
|
html = isIndex ? injectScriptsIntoHtml(html, headScripts, bodyScripts, stripEmbeddedRuntime) : html;
|
|
95061
95160
|
return c3.text(html, 200, { "Content-Type": contentType });
|
|
95062
95161
|
}
|
|
95063
|
-
const stat3 =
|
|
95162
|
+
const stat3 = statSync13(filePath);
|
|
95064
95163
|
const totalSize2 = stat3.size;
|
|
95065
95164
|
const rangeHeader = c3.req.header("range");
|
|
95066
95165
|
const rangeRequest = parseRangeHeader(rangeHeader, totalSize2);
|
|
@@ -95312,8 +95411,8 @@ var init_paths = __esm({
|
|
|
95312
95411
|
});
|
|
95313
95412
|
|
|
95314
95413
|
// ../producer/src/services/render/shared.ts
|
|
95315
|
-
import { copyFileSync as copyFileSync3, cpSync, existsSync as existsSync41, mkdirSync as
|
|
95316
|
-
import { basename as basename6, dirname as
|
|
95414
|
+
import { copyFileSync as copyFileSync3, cpSync as cpSync2, existsSync as existsSync41, mkdirSync as mkdirSync22, symlinkSync as symlinkSync2, writeFileSync as writeFileSync18 } from "fs";
|
|
95415
|
+
import { basename as basename6, dirname as dirname15, isAbsolute as isAbsolute11, join as join42, relative as relative9, resolve as resolve24 } from "path";
|
|
95317
95416
|
function writeFileExclusiveSync(path2, data2) {
|
|
95318
95417
|
try {
|
|
95319
95418
|
writeFileSync18(path2, data2, { flag: "wx", mode: 384 });
|
|
@@ -95360,11 +95459,11 @@ function resolveDeviceScaleFactor(input2) {
|
|
|
95360
95459
|
}
|
|
95361
95460
|
function writeCompiledArtifacts(compiled, workDir, includeSummary) {
|
|
95362
95461
|
const compileDir = join42(workDir, "compiled");
|
|
95363
|
-
|
|
95462
|
+
mkdirSync22(compileDir, { recursive: true });
|
|
95364
95463
|
writeFileSync18(join42(compileDir, "index.html"), compiled.html, "utf-8");
|
|
95365
95464
|
for (const [srcPath, html] of compiled.subCompositions) {
|
|
95366
95465
|
const outPath = join42(compileDir, srcPath);
|
|
95367
|
-
|
|
95466
|
+
mkdirSync22(dirname15(outPath), { recursive: true });
|
|
95368
95467
|
writeFileSync18(outPath, html, "utf-8");
|
|
95369
95468
|
}
|
|
95370
95469
|
for (const [relativePath, absolutePath] of compiled.externalAssets) {
|
|
@@ -95373,7 +95472,7 @@ function writeCompiledArtifacts(compiled, workDir, includeSummary) {
|
|
|
95373
95472
|
console.warn(`[Render] Skipping external asset with unsafe path: ${relativePath}`);
|
|
95374
95473
|
continue;
|
|
95375
95474
|
}
|
|
95376
|
-
|
|
95475
|
+
mkdirSync22(dirname15(outPath), { recursive: true });
|
|
95377
95476
|
copyFileSync3(absolutePath, outPath);
|
|
95378
95477
|
}
|
|
95379
95478
|
if (includeSummary) {
|
|
@@ -95491,16 +95590,16 @@ var init_shared = __esm({
|
|
|
95491
95590
|
materializePathModule = {
|
|
95492
95591
|
resolve: resolve24,
|
|
95493
95592
|
join: join42,
|
|
95494
|
-
dirname:
|
|
95593
|
+
dirname: dirname15,
|
|
95495
95594
|
basename: basename6,
|
|
95496
|
-
relative:
|
|
95497
|
-
isAbsolute:
|
|
95595
|
+
relative: relative9,
|
|
95596
|
+
isAbsolute: isAbsolute11
|
|
95498
95597
|
};
|
|
95499
95598
|
materializeFileSystem = {
|
|
95500
95599
|
existsSync: existsSync41,
|
|
95501
|
-
mkdirSync:
|
|
95502
|
-
symlinkSync,
|
|
95503
|
-
cpSync
|
|
95600
|
+
mkdirSync: mkdirSync22,
|
|
95601
|
+
symlinkSync: symlinkSync2,
|
|
95602
|
+
cpSync: cpSync2
|
|
95504
95603
|
};
|
|
95505
95604
|
}
|
|
95506
95605
|
});
|
|
@@ -95530,7 +95629,7 @@ var init_errorMessage = __esm({
|
|
|
95530
95629
|
});
|
|
95531
95630
|
|
|
95532
95631
|
// ../producer/src/services/render/cleanup.ts
|
|
95533
|
-
import { rmSync as
|
|
95632
|
+
import { rmSync as rmSync9 } from "fs";
|
|
95534
95633
|
import { freemem as freemem4 } from "os";
|
|
95535
95634
|
async function safeCleanup(label2, fn, log2 = defaultLogger) {
|
|
95536
95635
|
try {
|
|
@@ -95560,7 +95659,7 @@ async function cleanupRenderResources(input2) {
|
|
|
95560
95659
|
if (!debug) {
|
|
95561
95660
|
await safeCleanup(
|
|
95562
95661
|
`remove workDir (${label2})`,
|
|
95563
|
-
() =>
|
|
95662
|
+
() => rmSync9(workDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 }),
|
|
95564
95663
|
log2
|
|
95565
95664
|
);
|
|
95566
95665
|
}
|
|
@@ -96383,8 +96482,8 @@ var init_ffprobe2 = __esm({
|
|
|
96383
96482
|
});
|
|
96384
96483
|
|
|
96385
96484
|
// ../producer/src/services/htmlCompiler.ts
|
|
96386
|
-
import { readFileSync as readFileSync32, existsSync as existsSync42, mkdirSync as
|
|
96387
|
-
import { join as join44, dirname as
|
|
96485
|
+
import { readFileSync as readFileSync32, existsSync as existsSync42, mkdirSync as mkdirSync23 } from "fs";
|
|
96486
|
+
import { join as join44, dirname as dirname16, resolve as resolve25, basename as basename7 } from "path";
|
|
96388
96487
|
function dedupeElementsById(elements) {
|
|
96389
96488
|
const deduped = /* @__PURE__ */ new Map();
|
|
96390
96489
|
for (const element of elements) {
|
|
@@ -96451,7 +96550,7 @@ function detectShaderTransitionUsage(html) {
|
|
|
96451
96550
|
async function resolveMediaDuration(src, mediaStart, baseDir, downloadDir, tagName19) {
|
|
96452
96551
|
let filePath = src;
|
|
96453
96552
|
if (isHttpUrl(src)) {
|
|
96454
|
-
if (!existsSync42(downloadDir))
|
|
96553
|
+
if (!existsSync42(downloadDir)) mkdirSync23(downloadDir, { recursive: true });
|
|
96455
96554
|
try {
|
|
96456
96555
|
filePath = await downloadToTemp(src, downloadDir);
|
|
96457
96556
|
} catch {
|
|
@@ -96556,7 +96655,7 @@ async function parseSubCompositions(html, projectDir, downloadDir, parentOffset
|
|
|
96556
96655
|
workItems.map(async (item) => {
|
|
96557
96656
|
const { html: compiledSub } = await compileHtmlFile(
|
|
96558
96657
|
item.rawSubHtml,
|
|
96559
|
-
|
|
96658
|
+
dirname16(item.filePath),
|
|
96560
96659
|
downloadDir
|
|
96561
96660
|
);
|
|
96562
96661
|
const nested = await parseSubCompositions(
|
|
@@ -96936,7 +97035,7 @@ function collectExternalAssets(html, projectDir) {
|
|
|
96936
97035
|
}
|
|
96937
97036
|
async function downloadAndRewriteUrls(urlSet, html, remoteDir, warnLabel, logLabel, extraRewrite) {
|
|
96938
97037
|
if (urlSet.size === 0) return { html, remoteMediaAssets: /* @__PURE__ */ new Map() };
|
|
96939
|
-
if (!existsSync42(remoteDir))
|
|
97038
|
+
if (!existsSync42(remoteDir)) mkdirSync23(remoteDir, { recursive: true });
|
|
96940
97039
|
const urlToLocal = /* @__PURE__ */ new Map();
|
|
96941
97040
|
await Promise.all(
|
|
96942
97041
|
[...urlSet].map(async (url) => {
|
|
@@ -98037,7 +98136,7 @@ var init_probeStage = __esm({
|
|
|
98037
98136
|
|
|
98038
98137
|
// ../producer/src/services/render/stages/extractVideosStage.ts
|
|
98039
98138
|
import { existsSync as existsSync43 } from "fs";
|
|
98040
|
-
import { isAbsolute as
|
|
98139
|
+
import { isAbsolute as isAbsolute12, join as join47 } from "path";
|
|
98041
98140
|
async function runExtractVideosStage(input2) {
|
|
98042
98141
|
const {
|
|
98043
98142
|
projectDir,
|
|
@@ -98061,7 +98160,7 @@ async function runExtractVideosStage(input2) {
|
|
|
98061
98160
|
log2?.info("Probing video color spaces...", { videoCount: composition.videos.length });
|
|
98062
98161
|
await Promise.all(
|
|
98063
98162
|
composition.videos.map(async (v2) => {
|
|
98064
|
-
const videoPath =
|
|
98163
|
+
const videoPath = isAbsolute12(v2.src) ? v2.src : resolveProjectRelativeSrc(v2.src, projectDir, compiledDir);
|
|
98065
98164
|
if (!existsSync43(videoPath)) return;
|
|
98066
98165
|
const meta = await extractMediaMetadata(videoPath);
|
|
98067
98166
|
if (isHdrColorSpace(meta.colorSpace)) {
|
|
@@ -98770,7 +98869,7 @@ var init_hdrCompositor = __esm({
|
|
|
98770
98869
|
});
|
|
98771
98870
|
|
|
98772
98871
|
// ../producer/src/services/render/stages/captureHdrFrameShared.ts
|
|
98773
|
-
import { rmSync as
|
|
98872
|
+
import { rmSync as rmSync10 } from "fs";
|
|
98774
98873
|
function shouldUseHybridLayeredPath(args) {
|
|
98775
98874
|
if (args.hasHdrContent) return false;
|
|
98776
98875
|
if (args.workerCount <= 1) return false;
|
|
@@ -98994,7 +99093,7 @@ function cleanupEndedHdrVideos(args) {
|
|
|
98994
99093
|
if (frameSource) {
|
|
98995
99094
|
closeHdrVideoFrameSource(frameSource, log2);
|
|
98996
99095
|
try {
|
|
98997
|
-
|
|
99096
|
+
rmSync10(frameSource.dir, { recursive: true, force: true });
|
|
98998
99097
|
} catch (err) {
|
|
98999
99098
|
log2.warn("Failed to clean up HDR raw frame directory", {
|
|
99000
99099
|
videoId,
|
|
@@ -99267,7 +99366,7 @@ import {
|
|
|
99267
99366
|
closeSync as closeSync3,
|
|
99268
99367
|
constants as constants2,
|
|
99269
99368
|
fstatSync as fstatSync2,
|
|
99270
|
-
mkdirSync as
|
|
99369
|
+
mkdirSync as mkdirSync24,
|
|
99271
99370
|
mkdtempSync as mkdtempSync2,
|
|
99272
99371
|
openSync as openSync2,
|
|
99273
99372
|
readFileSync as readFileSync33
|
|
@@ -99359,7 +99458,7 @@ async function extractHdrVideoFrames(args) {
|
|
|
99359
99458
|
for (const [videoId, srcPath] of prep.hdrVideoSrcPaths) {
|
|
99360
99459
|
const video = composition.videos.find((v2) => v2.id === videoId);
|
|
99361
99460
|
if (!video) continue;
|
|
99362
|
-
|
|
99461
|
+
mkdirSync24(framesDir, { recursive: true });
|
|
99363
99462
|
const frameDir = mkdtempSync2(join50(framesDir, `hdr_${tempDirSafePrefix(videoId)}-`));
|
|
99364
99463
|
const duration = video.end - video.start;
|
|
99365
99464
|
const dims = prep.hdrExtractionDims.get(videoId) ?? { width, height };
|
|
@@ -99642,7 +99741,7 @@ var init_captureHdrSequentialLoop = __esm({
|
|
|
99642
99741
|
// ../producer/src/services/shaderTransitionWorkerPool.ts
|
|
99643
99742
|
import { Worker } from "worker_threads";
|
|
99644
99743
|
import { fileURLToPath as fileURLToPath4, pathToFileURL } from "url";
|
|
99645
|
-
import { dirname as
|
|
99744
|
+
import { dirname as dirname17, join as join52 } from "path";
|
|
99646
99745
|
import { createRequire } from "module";
|
|
99647
99746
|
import { existsSync as existsSync44 } from "fs";
|
|
99648
99747
|
import { cpus as cpus3 } from "os";
|
|
@@ -99655,7 +99754,7 @@ function resolveWorkerEntry(explicit) {
|
|
|
99655
99754
|
const isTs = override.endsWith(".ts");
|
|
99656
99755
|
return { path: override, isTs };
|
|
99657
99756
|
}
|
|
99658
|
-
const moduleDir =
|
|
99757
|
+
const moduleDir = dirname17(fileURLToPath4(import.meta.url));
|
|
99659
99758
|
const jsPath = join52(moduleDir, "shaderTransitionWorker.js");
|
|
99660
99759
|
if (existsSync44(jsPath)) return { path: jsPath, isTs: false };
|
|
99661
99760
|
const tsPath = join52(moduleDir, "shaderTransitionWorker.ts");
|
|
@@ -100078,7 +100177,7 @@ var init_captureHdrHybridLoop = __esm({
|
|
|
100078
100177
|
});
|
|
100079
100178
|
|
|
100080
100179
|
// ../producer/src/services/render/stages/captureHdrStage.ts
|
|
100081
|
-
import { existsSync as existsSync45, mkdirSync as
|
|
100180
|
+
import { existsSync as existsSync45, mkdirSync as mkdirSync25 } from "fs";
|
|
100082
100181
|
import { join as join54 } from "path";
|
|
100083
100182
|
async function runCaptureHdrStage(input2) {
|
|
100084
100183
|
const {
|
|
@@ -100240,7 +100339,7 @@ async function runCaptureHdrStage(input2) {
|
|
|
100240
100339
|
const debugDumpEnabled = process.env.KEEP_TEMP === "1";
|
|
100241
100340
|
const debugDumpDir = debugDumpEnabled ? join54(framesDir, "debug-composite") : null;
|
|
100242
100341
|
if (debugDumpDir && !existsSync45(debugDumpDir)) {
|
|
100243
|
-
|
|
100342
|
+
mkdirSync25(debugDumpDir, { recursive: true });
|
|
100244
100343
|
}
|
|
100245
100344
|
const compositeTransfer = resolveCompositeTransfer(hasHdrContent, effectiveHdr);
|
|
100246
100345
|
const hdrTargetTransfer = compositeTransfer === "srgb" ? void 0 : compositeTransfer;
|
|
@@ -100441,8 +100540,8 @@ var init_gifEncodeArgs = __esm({
|
|
|
100441
100540
|
});
|
|
100442
100541
|
|
|
100443
100542
|
// ../producer/src/services/render/stages/encodeStage.ts
|
|
100444
|
-
import { copyFileSync as copyFileSync4, existsSync as existsSync46, mkdirSync as
|
|
100445
|
-
import { dirname as
|
|
100543
|
+
import { copyFileSync as copyFileSync4, existsSync as existsSync46, mkdirSync as mkdirSync26, readdirSync as readdirSync18, rmSync as rmSync11, statSync as statSync14 } from "fs";
|
|
100544
|
+
import { dirname as dirname18, join as join56 } from "path";
|
|
100446
100545
|
function resolveGifLoop(loop) {
|
|
100447
100546
|
const resolved = loop ?? 0;
|
|
100448
100547
|
if (!Number.isInteger(resolved) || resolved < 0 || resolved > 65535) {
|
|
@@ -100452,7 +100551,7 @@ function resolveGifLoop(loop) {
|
|
|
100452
100551
|
}
|
|
100453
100552
|
async function encodeGifFromDir(framesDir, framePattern, outputPath, input2) {
|
|
100454
100553
|
const startTime = Date.now();
|
|
100455
|
-
const files =
|
|
100554
|
+
const files = readdirSync18(framesDir).filter((file) => file.match(/\.(jpg|jpeg|png)$/i));
|
|
100456
100555
|
const frameCount = files.length;
|
|
100457
100556
|
if (frameCount === 0) {
|
|
100458
100557
|
return {
|
|
@@ -100501,7 +100600,7 @@ async function encodeGifFromDir(framesDir, framePattern, outputPath, input2) {
|
|
|
100501
100600
|
error: formatFfmpegError(gifResult.exitCode, gifResult.stderr)
|
|
100502
100601
|
};
|
|
100503
100602
|
}
|
|
100504
|
-
const fileSize = existsSync46(outputPath) ?
|
|
100603
|
+
const fileSize = existsSync46(outputPath) ? statSync14(outputPath).size : 0;
|
|
100505
100604
|
return {
|
|
100506
100605
|
success: true,
|
|
100507
100606
|
outputPath,
|
|
@@ -100510,7 +100609,7 @@ async function encodeGifFromDir(framesDir, framePattern, outputPath, input2) {
|
|
|
100510
100609
|
fileSize
|
|
100511
100610
|
};
|
|
100512
100611
|
} finally {
|
|
100513
|
-
|
|
100612
|
+
rmSync11(input2.palettePath, { force: true });
|
|
100514
100613
|
}
|
|
100515
100614
|
}
|
|
100516
100615
|
async function runEncodeStage(input2) {
|
|
@@ -100539,8 +100638,8 @@ async function runEncodeStage(input2) {
|
|
|
100539
100638
|
const stage5Start = Date.now();
|
|
100540
100639
|
if (isPngSequence) {
|
|
100541
100640
|
updateJobStatus(job, "encoding", "Writing PNG sequence", 75, onProgress);
|
|
100542
|
-
if (!existsSync46(outputPath))
|
|
100543
|
-
const captured =
|
|
100641
|
+
if (!existsSync46(outputPath)) mkdirSync26(outputPath, { recursive: true });
|
|
100642
|
+
const captured = readdirSync18(framesDir).filter((name) => name.endsWith(".png")).sort();
|
|
100544
100643
|
if (captured.length === 0) {
|
|
100545
100644
|
throw new Error(
|
|
100546
100645
|
`[Render] png-sequence output requested but no PNGs were captured to ${framesDir}`
|
|
@@ -100567,7 +100666,7 @@ async function runEncodeStage(input2) {
|
|
|
100567
100666
|
const encodeResult2 = await encodeGifFromDir(framesDir, framePattern2, outputPath, {
|
|
100568
100667
|
fps: job.config.fps,
|
|
100569
100668
|
loop,
|
|
100570
|
-
palettePath: join56(
|
|
100669
|
+
palettePath: join56(dirname18(videoOnlyPath), "gif-palette.png"),
|
|
100571
100670
|
signal: abortSignal,
|
|
100572
100671
|
timeout: engineCfg.ffmpegEncodeTimeout
|
|
100573
100672
|
});
|
|
@@ -100683,17 +100782,17 @@ var init_assembleStage = __esm({
|
|
|
100683
100782
|
// ../producer/src/services/renderOrchestrator.ts
|
|
100684
100783
|
import {
|
|
100685
100784
|
existsSync as existsSync47,
|
|
100686
|
-
mkdirSync as
|
|
100785
|
+
mkdirSync as mkdirSync27,
|
|
100687
100786
|
mkdtempSync as mkdtempSync3,
|
|
100688
100787
|
readFileSync as readFileSync34,
|
|
100689
|
-
readdirSync as
|
|
100690
|
-
rmSync as
|
|
100691
|
-
statSync as
|
|
100788
|
+
readdirSync as readdirSync19,
|
|
100789
|
+
rmSync as rmSync12,
|
|
100790
|
+
statSync as statSync15,
|
|
100692
100791
|
writeFileSync as writeFileSync19,
|
|
100693
100792
|
copyFileSync as copyFileSync5,
|
|
100694
100793
|
appendFileSync
|
|
100695
100794
|
} from "fs";
|
|
100696
|
-
import { join as join57, dirname as
|
|
100795
|
+
import { join as join57, dirname as dirname19, resolve as resolve26 } from "path";
|
|
100697
100796
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
100698
100797
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
100699
100798
|
function sampleDirectoryBytes(dir) {
|
|
@@ -100704,14 +100803,14 @@ function sampleDirectoryBytes(dir) {
|
|
|
100704
100803
|
if (!current2) continue;
|
|
100705
100804
|
let entries2 = [];
|
|
100706
100805
|
try {
|
|
100707
|
-
entries2 =
|
|
100806
|
+
entries2 = readdirSync19(current2);
|
|
100708
100807
|
} catch {
|
|
100709
100808
|
continue;
|
|
100710
100809
|
}
|
|
100711
100810
|
for (const name of entries2) {
|
|
100712
100811
|
const full2 = join57(current2, name);
|
|
100713
100812
|
try {
|
|
100714
|
-
const st3 =
|
|
100813
|
+
const st3 = statSync15(full2);
|
|
100715
100814
|
if (st3.isDirectory()) {
|
|
100716
100815
|
stack.push(full2);
|
|
100717
100816
|
} else if (st3.isFile()) {
|
|
@@ -101028,11 +101127,11 @@ function extractStandaloneEntryFromIndex(indexHtml, entryFile) {
|
|
|
101028
101127
|
return document2.toString();
|
|
101029
101128
|
}
|
|
101030
101129
|
async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSignal) {
|
|
101031
|
-
const moduleDir =
|
|
101130
|
+
const moduleDir = dirname19(fileURLToPath5(import.meta.url));
|
|
101032
101131
|
const producerRoot = process.env.PRODUCER_RENDERS_DIR ? resolve26(process.env.PRODUCER_RENDERS_DIR, "..") : resolve26(moduleDir, "../..");
|
|
101033
101132
|
const debugDir = join57(producerRoot, ".debug");
|
|
101034
|
-
const outputDir =
|
|
101035
|
-
if (!existsSync47(outputDir))
|
|
101133
|
+
const outputDir = dirname19(outputPath);
|
|
101134
|
+
if (!existsSync47(outputDir)) mkdirSync27(outputDir, { recursive: true });
|
|
101036
101135
|
const workDir = job.config.debug ? join57(debugDir, job.id) : mkdtempSync3(join57(outputDir, `work-${job.id}-`));
|
|
101037
101136
|
const pipelineStart = Date.now();
|
|
101038
101137
|
const log2 = job.config.logger ?? defaultLogger;
|
|
@@ -101086,7 +101185,7 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
|
|
|
101086
101185
|
job.startedAt = /* @__PURE__ */ new Date();
|
|
101087
101186
|
assertNotAborted();
|
|
101088
101187
|
assertConfiguredFfmpegBinariesExist();
|
|
101089
|
-
if (!existsSync47(workDir))
|
|
101188
|
+
if (!existsSync47(workDir)) mkdirSync27(workDir, { recursive: true });
|
|
101090
101189
|
if (job.config.debug) {
|
|
101091
101190
|
const logPath = join57(workDir, "render.log");
|
|
101092
101191
|
restoreLogger = installDebugLogger(logPath, log2);
|
|
@@ -101330,7 +101429,7 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
|
|
|
101330
101429
|
throw new Error("File server failed to initialize before frame capture");
|
|
101331
101430
|
}
|
|
101332
101431
|
const framesDir = join57(workDir, "captured-frames");
|
|
101333
|
-
if (!existsSync47(framesDir))
|
|
101432
|
+
if (!existsSync47(framesDir)) mkdirSync27(framesDir, { recursive: true });
|
|
101334
101433
|
const captureOptions = {
|
|
101335
101434
|
width,
|
|
101336
101435
|
height,
|
|
@@ -101759,7 +101858,7 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
|
|
|
101759
101858
|
await safeCleanup(
|
|
101760
101859
|
"remove workDir",
|
|
101761
101860
|
() => {
|
|
101762
|
-
|
|
101861
|
+
rmSync12(workDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
|
101763
101862
|
},
|
|
101764
101863
|
log2
|
|
101765
101864
|
);
|
|
@@ -101900,7 +101999,7 @@ var init_config3 = __esm({
|
|
|
101900
101999
|
});
|
|
101901
102000
|
|
|
101902
102001
|
// ../producer/src/services/hyperframeLint.ts
|
|
101903
|
-
import { existsSync as existsSync48, readFileSync as readFileSync35, statSync as
|
|
102002
|
+
import { existsSync as existsSync48, readFileSync as readFileSync35, statSync as statSync16 } from "fs";
|
|
101904
102003
|
import { resolve as resolve27, join as join58 } from "path";
|
|
101905
102004
|
function isStringRecord(value) {
|
|
101906
102005
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
@@ -101929,7 +102028,7 @@ function pickEntryFile(files, preferredEntryFile) {
|
|
|
101929
102028
|
}
|
|
101930
102029
|
function readProjectEntryFile(projectDir, preferredEntryFile) {
|
|
101931
102030
|
const absProjectDir = resolve27(projectDir);
|
|
101932
|
-
if (!existsSync48(absProjectDir) || !
|
|
102031
|
+
if (!existsSync48(absProjectDir) || !statSync16(absProjectDir).isDirectory()) {
|
|
101933
102032
|
return { error: `Project directory not found: ${absProjectDir}` };
|
|
101934
102033
|
}
|
|
101935
102034
|
const entryCandidates = [preferredEntryFile, "index.html", "src/index.html"].filter(
|
|
@@ -101940,7 +102039,7 @@ function readProjectEntryFile(projectDir, preferredEntryFile) {
|
|
|
101940
102039
|
if (!absoluteEntryPath.startsWith(absProjectDir)) {
|
|
101941
102040
|
return { error: `Entry file must stay inside project directory: ${entryFile}` };
|
|
101942
102041
|
}
|
|
101943
|
-
if (existsSync48(absoluteEntryPath) &&
|
|
102042
|
+
if (existsSync48(absoluteEntryPath) && statSync16(absoluteEntryPath).isFile()) {
|
|
101944
102043
|
return {
|
|
101945
102044
|
entryFile,
|
|
101946
102045
|
html: readFileSync35(absoluteEntryPath, "utf-8"),
|
|
@@ -101998,7 +102097,7 @@ var init_hyperframeLint = __esm({
|
|
|
101998
102097
|
// ../producer/src/services/healthWorker.ts
|
|
101999
102098
|
import { Worker as Worker2 } from "worker_threads";
|
|
102000
102099
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
102001
|
-
import { dirname as
|
|
102100
|
+
import { dirname as dirname20, join as join59 } from "path";
|
|
102002
102101
|
import { existsSync as existsSync49 } from "fs";
|
|
102003
102102
|
async function startHealthWorker(options = {}) {
|
|
102004
102103
|
const log2 = options.logger ?? defaultLogger2();
|
|
@@ -102072,7 +102171,7 @@ function defaultLogger2() {
|
|
|
102072
102171
|
};
|
|
102073
102172
|
}
|
|
102074
102173
|
function resolveWorkerEntry2() {
|
|
102075
|
-
const here =
|
|
102174
|
+
const here = dirname20(fileURLToPath6(import.meta.url));
|
|
102076
102175
|
const candidates = [join59(here, "healthWorkerThread.js"), join59(here, "healthWorkerThread.ts")];
|
|
102077
102176
|
for (const candidate of candidates) {
|
|
102078
102177
|
if (existsSync49(candidate)) return candidate;
|
|
@@ -102131,14 +102230,14 @@ var init_semaphore = __esm({
|
|
|
102131
102230
|
// ../producer/src/server.ts
|
|
102132
102231
|
import {
|
|
102133
102232
|
existsSync as existsSync50,
|
|
102134
|
-
mkdirSync as
|
|
102135
|
-
statSync as
|
|
102233
|
+
mkdirSync as mkdirSync28,
|
|
102234
|
+
statSync as statSync17,
|
|
102136
102235
|
mkdtempSync as mkdtempSync4,
|
|
102137
102236
|
writeFileSync as writeFileSync20,
|
|
102138
|
-
rmSync as
|
|
102237
|
+
rmSync as rmSync13,
|
|
102139
102238
|
createReadStream as createReadStream2
|
|
102140
102239
|
} from "fs";
|
|
102141
|
-
import { resolve as resolve28, dirname as
|
|
102240
|
+
import { resolve as resolve28, dirname as dirname21, join as join60 } from "path";
|
|
102142
102241
|
import { tmpdir as tmpdir4 } from "os";
|
|
102143
102242
|
import { parseArgs as parseArgs2 } from "util";
|
|
102144
102243
|
import crypto2 from "crypto";
|
|
@@ -102198,8 +102297,8 @@ function buildRenderJobConfig(input2, log2) {
|
|
|
102198
102297
|
function resolvePreparedRenderOutput(prepared, rendersDir, log2) {
|
|
102199
102298
|
const { input: input2, cleanupProjectDir } = prepared;
|
|
102200
102299
|
const absoluteOutputPath = resolveOutputPath(input2.projectDir, input2.outputPath, rendersDir, log2);
|
|
102201
|
-
const outputDir =
|
|
102202
|
-
if (!existsSync50(outputDir))
|
|
102300
|
+
const outputDir = dirname21(absoluteOutputPath);
|
|
102301
|
+
if (!existsSync50(outputDir)) mkdirSync28(outputDir, { recursive: true });
|
|
102203
102302
|
return { input: input2, cleanupProjectDir, absoluteOutputPath };
|
|
102204
102303
|
}
|
|
102205
102304
|
function validateRenderOverrides(body) {
|
|
@@ -102229,7 +102328,7 @@ async function prepareRenderBody(body) {
|
|
|
102229
102328
|
const projectDir = typeof body.projectDir === "string" ? body.projectDir : void 0;
|
|
102230
102329
|
if (projectDir) {
|
|
102231
102330
|
const absProjectDir = resolve28(projectDir);
|
|
102232
|
-
if (!existsSync50(absProjectDir) || !
|
|
102331
|
+
if (!existsSync50(absProjectDir) || !statSync17(absProjectDir).isDirectory()) {
|
|
102233
102332
|
return { error: `Project directory not found: ${absProjectDir}` };
|
|
102234
102333
|
}
|
|
102235
102334
|
const entry = options.entryFile || "index.html";
|
|
@@ -102310,7 +102409,7 @@ function createArtifactStore(ttlMs) {
|
|
|
102310
102409
|
function cleanupTempDir(dir, log2) {
|
|
102311
102410
|
if (!dir) return;
|
|
102312
102411
|
try {
|
|
102313
|
-
|
|
102412
|
+
rmSync13(dir, { recursive: true, force: true });
|
|
102314
102413
|
} catch (error) {
|
|
102315
102414
|
log2.warn("Failed to cleanup temp project dir", {
|
|
102316
102415
|
cleanupProjectDir: dir,
|
|
@@ -102396,7 +102495,7 @@ function createRenderHandlers(options = {}) {
|
|
|
102396
102495
|
log2.info(`render progress ${pct}%`, { requestId, stage: j3.currentStage, message });
|
|
102397
102496
|
}
|
|
102398
102497
|
});
|
|
102399
|
-
const fileSize = existsSync50(absoluteOutputPath) ?
|
|
102498
|
+
const fileSize = existsSync50(absoluteOutputPath) ? statSync17(absoluteOutputPath).size : 0;
|
|
102400
102499
|
const durationMs = Date.now() - t0;
|
|
102401
102500
|
const outputToken = store.register(absoluteOutputPath);
|
|
102402
102501
|
const outputUrl = `${outputUrlPrefix}/${outputToken}`;
|
|
@@ -102512,7 +102611,7 @@ function createRenderHandlers(options = {}) {
|
|
|
102512
102611
|
},
|
|
102513
102612
|
abortController.signal
|
|
102514
102613
|
);
|
|
102515
|
-
const fileSize = existsSync50(absoluteOutputPath) ?
|
|
102614
|
+
const fileSize = existsSync50(absoluteOutputPath) ? statSync17(absoluteOutputPath).size : 0;
|
|
102516
102615
|
const outputToken = store.register(absoluteOutputPath);
|
|
102517
102616
|
const outputUrl = `${outputUrlPrefix}/${outputToken}`;
|
|
102518
102617
|
log2.info("render-stream completed", { requestId, fileSize, perf: job.perfSummary ?? null });
|
|
@@ -102575,7 +102674,7 @@ function createRenderHandlers(options = {}) {
|
|
|
102575
102674
|
store.delete(token);
|
|
102576
102675
|
return c3.json({ success: false, error: "Output artifact file missing" }, 404);
|
|
102577
102676
|
}
|
|
102578
|
-
const stats =
|
|
102677
|
+
const stats = statSync17(artifact.path);
|
|
102579
102678
|
return new Response(createReadStream2(artifact.path), {
|
|
102580
102679
|
headers: {
|
|
102581
102680
|
"content-type": "video/mp4",
|
|
@@ -102739,8 +102838,8 @@ var init_planHash = __esm({
|
|
|
102739
102838
|
});
|
|
102740
102839
|
|
|
102741
102840
|
// ../producer/src/services/render/stages/freezePlan.ts
|
|
102742
|
-
import { existsSync as existsSync51, mkdirSync as
|
|
102743
|
-
import { join as join61, relative as
|
|
102841
|
+
import { existsSync as existsSync51, mkdirSync as mkdirSync29, readFileSync as readFileSync36, readdirSync as readdirSync20, writeFileSync as writeFileSync21 } from "fs";
|
|
102842
|
+
import { join as join61, relative as relative10, resolve as resolve29 } from "path";
|
|
102744
102843
|
function stripUndefined(value) {
|
|
102745
102844
|
if (Array.isArray(value)) return value.map(stripUndefined);
|
|
102746
102845
|
if (value !== null && typeof value === "object") {
|
|
@@ -102759,14 +102858,14 @@ function listPlanFiles(planDir) {
|
|
|
102759
102858
|
const results = [];
|
|
102760
102859
|
const rootResolved = resolve29(planDir);
|
|
102761
102860
|
function walk(dir) {
|
|
102762
|
-
const entries2 =
|
|
102861
|
+
const entries2 = readdirSync20(dir, { withFileTypes: true });
|
|
102763
102862
|
for (const entry of entries2) {
|
|
102764
102863
|
const full2 = join61(dir, entry.name);
|
|
102765
102864
|
if (entry.isDirectory()) {
|
|
102766
102865
|
walk(full2);
|
|
102767
102866
|
} else if (entry.isFile()) {
|
|
102768
102867
|
results.push({
|
|
102769
|
-
planRelativePath:
|
|
102868
|
+
planRelativePath: relative10(rootResolved, full2).split(/[\\/]+/).join("/"),
|
|
102770
102869
|
absolutePath: full2
|
|
102771
102870
|
});
|
|
102772
102871
|
}
|
|
@@ -102835,7 +102934,7 @@ async function freezePlan(input2) {
|
|
|
102835
102934
|
throw new Error(`[freezePlan] planDir does not exist: ${planDir}`);
|
|
102836
102935
|
}
|
|
102837
102936
|
const metaDir = join61(planDir, "meta");
|
|
102838
|
-
if (!existsSync51(metaDir))
|
|
102937
|
+
if (!existsSync51(metaDir)) mkdirSync29(metaDir, { recursive: true });
|
|
102839
102938
|
writeFileSync21(
|
|
102840
102939
|
join61(metaDir, "composition.json"),
|
|
102841
102940
|
`${JSON.stringify(composition, null, 2)}
|
|
@@ -102989,7 +103088,7 @@ var init_runtimeEnvSnapshot = __esm({
|
|
|
102989
103088
|
|
|
102990
103089
|
// ../producer/src/services/distributed/shared.ts
|
|
102991
103090
|
import { execFile as execFileCallback } from "child_process";
|
|
102992
|
-
import { dirname as
|
|
103091
|
+
import { dirname as dirname22, join as join62 } from "path";
|
|
102993
103092
|
import { existsSync as existsSync52, readFileSync as readFileSync37 } from "fs";
|
|
102994
103093
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
102995
103094
|
import { promisify as promisify3 } from "util";
|
|
@@ -103025,7 +103124,7 @@ function buildSyntheticRenderJob(input2) {
|
|
|
103025
103124
|
}
|
|
103026
103125
|
function readProducerVersion() {
|
|
103027
103126
|
if (cachedProducerVersion !== null) return cachedProducerVersion;
|
|
103028
|
-
const startDir =
|
|
103127
|
+
const startDir = dirname22(fileURLToPath7(import.meta.url));
|
|
103029
103128
|
let current2 = startDir;
|
|
103030
103129
|
for (let i2 = 0; i2 < 10; i2++) {
|
|
103031
103130
|
const candidate = join62(current2, "package.json");
|
|
@@ -103039,7 +103138,7 @@ function readProducerVersion() {
|
|
|
103039
103138
|
} catch {
|
|
103040
103139
|
}
|
|
103041
103140
|
}
|
|
103042
|
-
const parent =
|
|
103141
|
+
const parent = dirname22(current2);
|
|
103043
103142
|
if (parent === current2) break;
|
|
103044
103143
|
current2 = parent;
|
|
103045
103144
|
}
|
|
@@ -103061,16 +103160,16 @@ var init_shared2 = __esm({
|
|
|
103061
103160
|
|
|
103062
103161
|
// ../producer/src/services/distributed/plan.ts
|
|
103063
103162
|
import {
|
|
103064
|
-
cpSync as
|
|
103163
|
+
cpSync as cpSync3,
|
|
103065
103164
|
existsSync as existsSync53,
|
|
103066
|
-
mkdirSync as
|
|
103067
|
-
readdirSync as
|
|
103165
|
+
mkdirSync as mkdirSync30,
|
|
103166
|
+
readdirSync as readdirSync21,
|
|
103068
103167
|
renameSync as renameSync5,
|
|
103069
|
-
rmSync as
|
|
103070
|
-
statSync as
|
|
103168
|
+
rmSync as rmSync14,
|
|
103169
|
+
statSync as statSync18,
|
|
103071
103170
|
writeFileSync as writeFileSync22
|
|
103072
103171
|
} from "fs";
|
|
103073
|
-
import { join as join63, relative as
|
|
103172
|
+
import { join as join63, relative as relative11, sep as sep6 } from "path";
|
|
103074
103173
|
function formatBytes2(bytes) {
|
|
103075
103174
|
if (bytes < 1024) return `${bytes} B`;
|
|
103076
103175
|
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KiB`;
|
|
@@ -103090,7 +103189,7 @@ function measurePlanDirBytes(planDir) {
|
|
|
103090
103189
|
function walk(dir) {
|
|
103091
103190
|
let entries2;
|
|
103092
103191
|
try {
|
|
103093
|
-
entries2 =
|
|
103192
|
+
entries2 = readdirSync21(dir, { withFileTypes: true });
|
|
103094
103193
|
} catch {
|
|
103095
103194
|
return;
|
|
103096
103195
|
}
|
|
@@ -103100,7 +103199,7 @@ function measurePlanDirBytes(planDir) {
|
|
|
103100
103199
|
walk(full2);
|
|
103101
103200
|
} else if (entry.isFile()) {
|
|
103102
103201
|
try {
|
|
103103
|
-
total +=
|
|
103202
|
+
total += statSync18(full2).size;
|
|
103104
103203
|
} catch {
|
|
103105
103204
|
}
|
|
103106
103205
|
}
|
|
@@ -103234,7 +103333,7 @@ async function plan(projectDir, config, planDir) {
|
|
|
103234
103333
|
useGpu: false,
|
|
103235
103334
|
browserGpuMode: "software"
|
|
103236
103335
|
});
|
|
103237
|
-
if (!existsSync53(planDir))
|
|
103336
|
+
if (!existsSync53(planDir)) mkdirSync30(planDir, { recursive: true });
|
|
103238
103337
|
const log2 = config.logger ?? defaultLogger;
|
|
103239
103338
|
const abortSignal = config.abortSignal;
|
|
103240
103339
|
const assertNotAborted = () => {
|
|
@@ -103268,14 +103367,14 @@ async function plan(projectDir, config, planDir) {
|
|
|
103268
103367
|
throw new Error(`[plan] entry file not found: ${htmlPath}`);
|
|
103269
103368
|
}
|
|
103270
103369
|
const workDir = join63(planDir, ".plan-work");
|
|
103271
|
-
if (!existsSync53(workDir))
|
|
103370
|
+
if (!existsSync53(workDir)) mkdirSync30(workDir, { recursive: true });
|
|
103272
103371
|
const compiledDir = join63(workDir, "compiled");
|
|
103273
|
-
|
|
103274
|
-
|
|
103372
|
+
mkdirSync30(compiledDir, { recursive: true });
|
|
103373
|
+
cpSync3(projectDir, compiledDir, {
|
|
103275
103374
|
recursive: true,
|
|
103276
103375
|
dereference: true,
|
|
103277
103376
|
filter: (src) => {
|
|
103278
|
-
const rel =
|
|
103377
|
+
const rel = relative11(projectDir, src);
|
|
103279
103378
|
if (rel === "" || rel.startsWith("..")) return true;
|
|
103280
103379
|
const firstSegment = rel.split(sep6, 1)[0];
|
|
103281
103380
|
return firstSegment === void 0 || !PLAN_PROJECT_DIR_SKIP_SEGMENTS.has(firstSegment);
|
|
@@ -103365,13 +103464,13 @@ async function plan(projectDir, config, planDir) {
|
|
|
103365
103464
|
});
|
|
103366
103465
|
const stagedVideoFrames = join63(compiledDir, "__hyperframes_video_frames");
|
|
103367
103466
|
const videoFramesDst = join63(planDir, "video-frames");
|
|
103368
|
-
if (existsSync53(videoFramesDst))
|
|
103467
|
+
if (existsSync53(videoFramesDst)) rmSync14(videoFramesDst, { recursive: true, force: true });
|
|
103369
103468
|
if (existsSync53(stagedVideoFrames)) {
|
|
103370
103469
|
renameSync5(stagedVideoFrames, videoFramesDst);
|
|
103371
103470
|
} else {
|
|
103372
|
-
|
|
103471
|
+
mkdirSync30(videoFramesDst, { recursive: true });
|
|
103373
103472
|
}
|
|
103374
|
-
if (existsSync53(finalCompiledDir))
|
|
103473
|
+
if (existsSync53(finalCompiledDir)) rmSync14(finalCompiledDir, { recursive: true, force: true });
|
|
103375
103474
|
renameSync5(compiledDir, finalCompiledDir);
|
|
103376
103475
|
const planVideosJson = {
|
|
103377
103476
|
videos: composition.videos,
|
|
@@ -103384,7 +103483,7 @@ async function plan(projectDir, config, planDir) {
|
|
|
103384
103483
|
metadata: ext.metadata
|
|
103385
103484
|
}))
|
|
103386
103485
|
};
|
|
103387
|
-
|
|
103486
|
+
mkdirSync30(join63(planDir, "meta"), { recursive: true });
|
|
103388
103487
|
writeFileSync22(
|
|
103389
103488
|
join63(planDir, PLAN_VIDEOS_META_RELATIVE_PATH),
|
|
103390
103489
|
JSON.stringify(planVideosJson, null, 2),
|
|
@@ -103433,7 +103532,7 @@ async function plan(projectDir, config, planDir) {
|
|
|
103433
103532
|
format: config.format
|
|
103434
103533
|
};
|
|
103435
103534
|
try {
|
|
103436
|
-
|
|
103535
|
+
rmSync14(workDir, { recursive: true, force: true });
|
|
103437
103536
|
} catch (err) {
|
|
103438
103537
|
log2.warn("[plan] failed to remove temp work dir", {
|
|
103439
103538
|
workDir,
|
|
@@ -103534,7 +103633,7 @@ var init_plan = __esm({
|
|
|
103534
103633
|
|
|
103535
103634
|
// ../producer/src/services/distributed/renderChunk.ts
|
|
103536
103635
|
import { randomBytes as randomBytes2 } from "crypto";
|
|
103537
|
-
import { existsSync as existsSync54, mkdirSync as
|
|
103636
|
+
import { existsSync as existsSync54, mkdirSync as mkdirSync31, readFileSync as readFileSync38, readdirSync as readdirSync22, rmSync as rmSync15, writeFileSync as writeFileSync23 } from "fs";
|
|
103538
103637
|
import { extname as extname10, join as join64 } from "path";
|
|
103539
103638
|
function rebuildExtractedFramesFromPlanDir(planDir, videos) {
|
|
103540
103639
|
const result = [];
|
|
@@ -103546,7 +103645,7 @@ function rebuildExtractedFramesFromPlanDir(planDir, videos) {
|
|
|
103546
103645
|
);
|
|
103547
103646
|
}
|
|
103548
103647
|
const ext = (extname10(v2.framePattern) || ".jpg").toLowerCase();
|
|
103549
|
-
const frames =
|
|
103648
|
+
const frames = readdirSync22(outputDir).filter((name) => name.toLowerCase().endsWith(ext)).sort();
|
|
103550
103649
|
const framePaths = /* @__PURE__ */ new Map();
|
|
103551
103650
|
for (let i2 = 0; i2 < frames.length; i2++) {
|
|
103552
103651
|
const frameName = frames[i2];
|
|
@@ -103574,7 +103673,7 @@ function rebuildExtractedFramesFromPlanDir(planDir, videos) {
|
|
|
103574
103673
|
}
|
|
103575
103674
|
function hashChunkOutput(outputPath, kind) {
|
|
103576
103675
|
if (kind === "file") return sha256Hex(readFileSync38(outputPath));
|
|
103577
|
-
const entries2 =
|
|
103676
|
+
const entries2 = readdirSync22(outputPath).filter((name) => /\.(png|jpg|jpeg)$/i.test(name)).sort();
|
|
103578
103677
|
const lines = entries2.map(
|
|
103579
103678
|
(name) => `${name}\0${sha256Hex(readFileSync38(join64(outputPath, name)))}`
|
|
103580
103679
|
);
|
|
@@ -103696,9 +103795,9 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath) {
|
|
|
103696
103795
|
)
|
|
103697
103796
|
) : null;
|
|
103698
103797
|
const workDir = `${outputChunkPath}.work.${process.pid}.${randomBytes2(4).toString("hex")}`;
|
|
103699
|
-
|
|
103798
|
+
mkdirSync31(workDir, { recursive: true });
|
|
103700
103799
|
const framesDir = join64(workDir, "captured-frames");
|
|
103701
|
-
|
|
103800
|
+
mkdirSync31(framesDir, { recursive: true });
|
|
103702
103801
|
const fileServer = await createFileServer2({
|
|
103703
103802
|
projectDir: compiledDir,
|
|
103704
103803
|
compiledDir,
|
|
@@ -103777,10 +103876,10 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath) {
|
|
|
103777
103876
|
const effectiveBitrate = encoder.crf != null ? void 0 : encoder.bitrate;
|
|
103778
103877
|
const videoOnlyPath = outputChunkPath;
|
|
103779
103878
|
if (isPngSequence) {
|
|
103780
|
-
if (!existsSync54(outputChunkPath))
|
|
103879
|
+
if (!existsSync54(outputChunkPath)) mkdirSync31(outputChunkPath, { recursive: true });
|
|
103781
103880
|
} else {
|
|
103782
103881
|
const outDir = join64(outputChunkPath, "..");
|
|
103783
|
-
if (!existsSync54(outDir))
|
|
103882
|
+
if (!existsSync54(outDir)) mkdirSync31(outDir, { recursive: true });
|
|
103784
103883
|
}
|
|
103785
103884
|
const encodeStarted = Date.now();
|
|
103786
103885
|
await runEncodeStage({
|
|
@@ -103857,7 +103956,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath) {
|
|
|
103857
103956
|
writeFileSync23(perfPath, `${JSON.stringify(perfPayload2, null, 2)}
|
|
103858
103957
|
`, "utf-8");
|
|
103859
103958
|
try {
|
|
103860
|
-
|
|
103959
|
+
rmSync15(workDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
|
103861
103960
|
} catch (err) {
|
|
103862
103961
|
log2.warn("[renderChunk] failed to remove work dir", {
|
|
103863
103962
|
workDir,
|
|
@@ -103915,7 +104014,7 @@ var init_renderChunk = __esm({
|
|
|
103915
104014
|
|
|
103916
104015
|
// ../producer/src/services/render/audioPadTrim.ts
|
|
103917
104016
|
import { spawn as spawn11 } from "child_process";
|
|
103918
|
-
import { rmSync as
|
|
104017
|
+
import { rmSync as rmSync16 } from "fs";
|
|
103919
104018
|
import { pathToFileURL as pathToFileURL2 } from "url";
|
|
103920
104019
|
function buildPadTrimAudioPlan(audioPath, outputPath, sourceDurationSeconds, targetDurationSeconds, audioInfo = {}) {
|
|
103921
104020
|
const delta = targetDurationSeconds - sourceDurationSeconds;
|
|
@@ -104064,7 +104163,7 @@ async function padOrTrimAudioToVideoFrameCount(input2) {
|
|
|
104064
104163
|
error: `audioPadTrim: failed to materialize ${plan2.operation}: ${err instanceof Error ? err.message : String(err)}`
|
|
104065
104164
|
};
|
|
104066
104165
|
} finally {
|
|
104067
|
-
for (const path2 of plan2.cleanupPaths)
|
|
104166
|
+
for (const path2 of plan2.cleanupPaths) rmSync16(path2, { force: true });
|
|
104068
104167
|
}
|
|
104069
104168
|
return {
|
|
104070
104169
|
success: true,
|
|
@@ -104216,16 +104315,16 @@ var init_audioPadTrim = __esm({
|
|
|
104216
104315
|
|
|
104217
104316
|
// ../producer/src/services/distributed/assemble.ts
|
|
104218
104317
|
import {
|
|
104219
|
-
cpSync as
|
|
104318
|
+
cpSync as cpSync4,
|
|
104220
104319
|
existsSync as existsSync55,
|
|
104221
|
-
mkdirSync as
|
|
104320
|
+
mkdirSync as mkdirSync32,
|
|
104222
104321
|
readFileSync as readFileSync39,
|
|
104223
|
-
readdirSync as
|
|
104224
|
-
rmSync as
|
|
104225
|
-
statSync as
|
|
104322
|
+
readdirSync as readdirSync23,
|
|
104323
|
+
rmSync as rmSync17,
|
|
104324
|
+
statSync as statSync19,
|
|
104226
104325
|
writeFileSync as writeFileSync24
|
|
104227
104326
|
} from "fs";
|
|
104228
|
-
import { dirname as
|
|
104327
|
+
import { dirname as dirname23, join as join65 } from "path";
|
|
104229
104328
|
async function assemble(planDir, chunkPaths, audioPath, outputPath, options) {
|
|
104230
104329
|
const start = Date.now();
|
|
104231
104330
|
const log2 = options?.logger ?? defaultLogger;
|
|
@@ -104254,12 +104353,12 @@ async function assemble(planDir, chunkPaths, audioPath, outputPath, options) {
|
|
|
104254
104353
|
if (plan2.dimensions.format === "png-sequence") {
|
|
104255
104354
|
return mergePngFrameDirs(chunkPaths, outputPath, plan2.totalFrames, audioPath, start);
|
|
104256
104355
|
}
|
|
104257
|
-
if (!existsSync55(
|
|
104258
|
-
|
|
104356
|
+
if (!existsSync55(dirname23(outputPath))) {
|
|
104357
|
+
mkdirSync32(dirname23(outputPath), { recursive: true });
|
|
104259
104358
|
}
|
|
104260
104359
|
const workDir = `${outputPath}.assemble-work`;
|
|
104261
|
-
if (existsSync55(workDir))
|
|
104262
|
-
|
|
104360
|
+
if (existsSync55(workDir)) rmSync17(workDir, { recursive: true, force: true });
|
|
104361
|
+
mkdirSync32(workDir, { recursive: true });
|
|
104263
104362
|
try {
|
|
104264
104363
|
const concatOutputPath = join65(workDir, `concat.${plan2.dimensions.format}`);
|
|
104265
104364
|
const fpsArg = fpsToFfmpegArg({
|
|
@@ -104396,7 +104495,7 @@ async function assemble(planDir, chunkPaths, audioPath, outputPath, options) {
|
|
|
104396
104495
|
}
|
|
104397
104496
|
} finally {
|
|
104398
104497
|
try {
|
|
104399
|
-
|
|
104498
|
+
rmSync17(workDir, { recursive: true, force: true });
|
|
104400
104499
|
} catch (err) {
|
|
104401
104500
|
log2.warn("[assemble] failed to remove work dir", {
|
|
104402
104501
|
workDir,
|
|
@@ -104404,7 +104503,7 @@ async function assemble(planDir, chunkPaths, audioPath, outputPath, options) {
|
|
|
104404
104503
|
});
|
|
104405
104504
|
}
|
|
104406
104505
|
}
|
|
104407
|
-
const fileSize = existsSync55(outputPath) ?
|
|
104506
|
+
const fileSize = existsSync55(outputPath) ? statSync19(outputPath).size : 0;
|
|
104408
104507
|
return {
|
|
104409
104508
|
outputPath,
|
|
104410
104509
|
durationMs: Date.now() - start,
|
|
@@ -104413,22 +104512,22 @@ async function assemble(planDir, chunkPaths, audioPath, outputPath, options) {
|
|
|
104413
104512
|
};
|
|
104414
104513
|
}
|
|
104415
104514
|
function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, startTimeMs) {
|
|
104416
|
-
if (existsSync55(outputPath))
|
|
104417
|
-
|
|
104515
|
+
if (existsSync55(outputPath)) rmSync17(outputPath, { recursive: true, force: true });
|
|
104516
|
+
mkdirSync32(outputPath, { recursive: true });
|
|
104418
104517
|
let globalIdx = 0;
|
|
104419
104518
|
for (const chunkDir of chunkPaths) {
|
|
104420
|
-
if (!
|
|
104519
|
+
if (!statSync19(chunkDir).isDirectory()) {
|
|
104421
104520
|
throw new Error(
|
|
104422
104521
|
`[assemble] png-sequence chunk must be a directory: ${chunkDir} (got a file)`
|
|
104423
104522
|
);
|
|
104424
104523
|
}
|
|
104425
|
-
const frames =
|
|
104524
|
+
const frames = readdirSync23(chunkDir).filter((name) => name.endsWith(".png")).sort();
|
|
104426
104525
|
if (frames.length === 0) {
|
|
104427
104526
|
throw new Error(`[assemble] png-sequence chunk has no frames: ${chunkDir}`);
|
|
104428
104527
|
}
|
|
104429
104528
|
for (const frame of frames) {
|
|
104430
104529
|
const dst = join65(outputPath, formatExportFrameName(globalIdx, "png"));
|
|
104431
|
-
|
|
104530
|
+
cpSync4(join65(chunkDir, frame), dst);
|
|
104432
104531
|
globalIdx += 1;
|
|
104433
104532
|
}
|
|
104434
104533
|
}
|
|
@@ -104439,12 +104538,12 @@ function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, start
|
|
|
104439
104538
|
}
|
|
104440
104539
|
if (audioPath !== null && existsSync55(audioPath)) {
|
|
104441
104540
|
const sidecar = join65(outputPath, "audio.aac");
|
|
104442
|
-
|
|
104541
|
+
cpSync4(audioPath, sidecar);
|
|
104443
104542
|
}
|
|
104444
104543
|
let fileSize = 0;
|
|
104445
|
-
for (const name of
|
|
104544
|
+
for (const name of readdirSync23(outputPath)) {
|
|
104446
104545
|
try {
|
|
104447
|
-
fileSize +=
|
|
104546
|
+
fileSize += statSync19(join65(outputPath, name)).size;
|
|
104448
104547
|
} catch {
|
|
104449
104548
|
}
|
|
104450
104549
|
}
|
|
@@ -104475,9 +104574,9 @@ var init_renderConfigValidation = __esm({
|
|
|
104475
104574
|
});
|
|
104476
104575
|
|
|
104477
104576
|
// ../producer/src/services/distributed/projectHash.ts
|
|
104478
|
-
import { readdirSync as
|
|
104577
|
+
import { readdirSync as readdirSync24, readFileSync as readFileSync40 } from "fs";
|
|
104479
104578
|
import { createHash as createHash12 } from "crypto";
|
|
104480
|
-
import { join as join66, relative as
|
|
104579
|
+
import { join as join66, relative as relative12 } from "path";
|
|
104481
104580
|
var init_projectHash = __esm({
|
|
104482
104581
|
"../producer/src/services/distributed/projectHash.ts"() {
|
|
104483
104582
|
"use strict";
|
|
@@ -104558,7 +104657,7 @@ __export(studioServer_exports, {
|
|
|
104558
104657
|
});
|
|
104559
104658
|
import { Hono as Hono5 } from "hono";
|
|
104560
104659
|
import { streamSSE as streamSSE3 } from "hono/streaming";
|
|
104561
|
-
import { existsSync as existsSync56, readFileSync as readFileSync41, writeFileSync as writeFileSync25, statSync as
|
|
104660
|
+
import { existsSync as existsSync56, readFileSync as readFileSync41, writeFileSync as writeFileSync25, statSync as statSync20 } from "fs";
|
|
104562
104661
|
import { resolve as resolve30, join as join67, basename as basename8 } from "path";
|
|
104563
104662
|
function resolveDistDir() {
|
|
104564
104663
|
return resolveStudioBundle().dir;
|
|
@@ -105011,7 +105110,7 @@ function createStudioServer(options) {
|
|
|
105011
105110
|
});
|
|
105012
105111
|
const serveStudioStaticFile = (c3) => {
|
|
105013
105112
|
const filePath = resolve30(studioDir, c3.req.path.slice(1));
|
|
105014
|
-
if (!existsSync56(filePath) || !
|
|
105113
|
+
if (!existsSync56(filePath) || !statSync20(filePath).isFile()) return c3.text("not found", 404);
|
|
105015
105114
|
const content = readFileSync41(filePath);
|
|
105016
105115
|
return new Response(content, {
|
|
105017
105116
|
headers: { "Content-Type": getMimeType(filePath), "Cache-Control": "no-store" }
|
|
@@ -105121,17 +105220,17 @@ __export(preview_exports, {
|
|
|
105121
105220
|
examples: () => examples2
|
|
105122
105221
|
});
|
|
105123
105222
|
import { spawn as spawn12 } from "child_process";
|
|
105124
|
-
import { existsSync as existsSync57, lstatSync as lstatSync3, symlinkSync as
|
|
105125
|
-
import { resolve as resolve31, dirname as
|
|
105223
|
+
import { existsSync as existsSync57, lstatSync as lstatSync3, symlinkSync as symlinkSync3, unlinkSync as unlinkSync6, readlinkSync, mkdirSync as mkdirSync33 } from "fs";
|
|
105224
|
+
import { resolve as resolve31, dirname as dirname24, basename as basename9, join as join68 } from "path";
|
|
105126
105225
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
105127
105226
|
import { createRequire as createRequire2 } from "module";
|
|
105128
105227
|
async function runDevMode(dir, options) {
|
|
105129
105228
|
const thisFile = fileURLToPath8(import.meta.url);
|
|
105130
|
-
const repoRoot2 = resolve31(
|
|
105229
|
+
const repoRoot2 = resolve31(dirname24(thisFile), "..", "..", "..", "..");
|
|
105131
105230
|
const projectsDir = join68(repoRoot2, "packages", "studio", "data", "projects");
|
|
105132
105231
|
const pName = options?.projectName ?? basename9(dir);
|
|
105133
105232
|
const symlinkPath = join68(projectsDir, pName);
|
|
105134
|
-
|
|
105233
|
+
mkdirSync33(projectsDir, { recursive: true });
|
|
105135
105234
|
let createdSymlink = false;
|
|
105136
105235
|
if (dir !== symlinkPath) {
|
|
105137
105236
|
if (existsSync57(symlinkPath)) {
|
|
@@ -105147,7 +105246,7 @@ async function runDevMode(dir, options) {
|
|
|
105147
105246
|
}
|
|
105148
105247
|
}
|
|
105149
105248
|
if (!existsSync57(symlinkPath)) {
|
|
105150
|
-
|
|
105249
|
+
symlinkSync3(dir, symlinkPath, "dir");
|
|
105151
105250
|
createdSymlink = true;
|
|
105152
105251
|
}
|
|
105153
105252
|
}
|
|
@@ -105218,11 +105317,11 @@ function hasLocalStudio(dir) {
|
|
|
105218
105317
|
}
|
|
105219
105318
|
async function runLocalStudioMode(dir, options) {
|
|
105220
105319
|
const req = createRequire2(join68(dir, "package.json"));
|
|
105221
|
-
const studioPkgPath =
|
|
105320
|
+
const studioPkgPath = dirname24(req.resolve("@hyperframes/studio/package.json"));
|
|
105222
105321
|
const pName = options?.projectName ?? basename9(dir);
|
|
105223
105322
|
const projectsDir = join68(studioPkgPath, "data", "projects");
|
|
105224
105323
|
const symlinkPath = join68(projectsDir, pName);
|
|
105225
|
-
|
|
105324
|
+
mkdirSync33(projectsDir, { recursive: true });
|
|
105226
105325
|
let createdSymlink = false;
|
|
105227
105326
|
if (dir !== symlinkPath) {
|
|
105228
105327
|
if (existsSync57(symlinkPath) && lstatSync3(symlinkPath).isSymbolicLink()) {
|
|
@@ -105231,7 +105330,7 @@ async function runLocalStudioMode(dir, options) {
|
|
|
105231
105330
|
}
|
|
105232
105331
|
}
|
|
105233
105332
|
if (!existsSync57(symlinkPath)) {
|
|
105234
|
-
|
|
105333
|
+
symlinkSync3(dir, symlinkPath, "dir");
|
|
105235
105334
|
createdSymlink = true;
|
|
105236
105335
|
}
|
|
105237
105336
|
}
|
|
@@ -105602,14 +105701,14 @@ __export(init_exports, {
|
|
|
105602
105701
|
});
|
|
105603
105702
|
import {
|
|
105604
105703
|
existsSync as existsSync58,
|
|
105605
|
-
mkdirSync as
|
|
105704
|
+
mkdirSync as mkdirSync34,
|
|
105606
105705
|
copyFileSync as copyFileSync6,
|
|
105607
|
-
cpSync as
|
|
105706
|
+
cpSync as cpSync5,
|
|
105608
105707
|
writeFileSync as writeFileSync26,
|
|
105609
105708
|
readFileSync as readFileSync42,
|
|
105610
|
-
readdirSync as
|
|
105709
|
+
readdirSync as readdirSync25
|
|
105611
105710
|
} from "fs";
|
|
105612
|
-
import { resolve as resolve32, basename as basename10, join as join69, dirname as
|
|
105711
|
+
import { resolve as resolve32, basename as basename10, join as join69, dirname as dirname25 } from "path";
|
|
105613
105712
|
import { fileURLToPath as fileURLToPath9 } from "url";
|
|
105614
105713
|
import { execFileSync as execFileSync6, spawn as spawn13 } from "child_process";
|
|
105615
105714
|
function probeVideo(filePath) {
|
|
@@ -105685,13 +105784,13 @@ function transcodeToMp4(inputPath, outputPath) {
|
|
|
105685
105784
|
});
|
|
105686
105785
|
}
|
|
105687
105786
|
function resolveAssetDir(devSegments, builtSegments) {
|
|
105688
|
-
const base2 =
|
|
105787
|
+
const base2 = dirname25(fileURLToPath9(import.meta.url));
|
|
105689
105788
|
const devPath = resolve32(base2, ...devSegments);
|
|
105690
105789
|
const builtPath = resolve32(base2, ...builtSegments);
|
|
105691
105790
|
return existsSync58(devPath) ? devPath : builtPath;
|
|
105692
105791
|
}
|
|
105693
105792
|
function getStaticTemplateDir(templateId) {
|
|
105694
|
-
const base2 =
|
|
105793
|
+
const base2 = dirname25(fileURLToPath9(import.meta.url));
|
|
105695
105794
|
const devPath = resolve32(base2, "..", "templates", templateId);
|
|
105696
105795
|
if (existsSync58(devPath)) return devPath;
|
|
105697
105796
|
const registryPath = resolve32(base2, "..", "..", "..", "..", "registry", "examples", templateId);
|
|
@@ -105742,7 +105841,7 @@ function listHtmlFiles(dir) {
|
|
|
105742
105841
|
const files = [];
|
|
105743
105842
|
const ignoredDirs = /* @__PURE__ */ new Set([".git", "dist", "node_modules"]);
|
|
105744
105843
|
function walk(currentDir) {
|
|
105745
|
-
for (const entry of
|
|
105844
|
+
for (const entry of readdirSync25(currentDir, { withFileTypes: true })) {
|
|
105746
105845
|
const entryPath = join69(currentDir, entry.name);
|
|
105747
105846
|
if (entry.isDirectory()) {
|
|
105748
105847
|
if (!ignoredDirs.has(entry.name)) walk(entryPath);
|
|
@@ -105788,7 +105887,7 @@ function writeTailwindSupport(destDir) {
|
|
|
105788
105887
|
}
|
|
105789
105888
|
}
|
|
105790
105889
|
function patchVideoSrc(dir, videoFilename, durationSeconds) {
|
|
105791
|
-
const htmlFiles =
|
|
105890
|
+
const htmlFiles = readdirSync25(dir, { withFileTypes: true, recursive: true }).filter((e3) => e3.isFile() && e3.name.endsWith(".html")).map((e3) => join69(e3.parentPath, e3.name));
|
|
105792
105891
|
for (const file of htmlFiles) {
|
|
105793
105892
|
let content = readFileSync42(file, "utf-8");
|
|
105794
105893
|
if (videoFilename) {
|
|
@@ -105941,10 +106040,10 @@ function applyResolutionPreset(destDir, resolution) {
|
|
|
105941
106040
|
}
|
|
105942
106041
|
}
|
|
105943
106042
|
async function scaffoldProject(destDir, name, templateId, localVideoName, durationSeconds, tailwind = false, resolution) {
|
|
105944
|
-
|
|
106043
|
+
mkdirSync34(destDir, { recursive: true });
|
|
105945
106044
|
const templateDir = getStaticTemplateDir(templateId);
|
|
105946
106045
|
if (existsSync58(join69(templateDir, "index.html"))) {
|
|
105947
|
-
|
|
106046
|
+
cpSync5(templateDir, destDir, { recursive: true });
|
|
105948
106047
|
} else {
|
|
105949
106048
|
await fetchRemoteTemplate(templateId, destDir);
|
|
105950
106049
|
}
|
|
@@ -105971,7 +106070,7 @@ async function scaffoldProject(destDir, name, templateId, localVideoName, durati
|
|
|
105971
106070
|
writeDefaultPackageJson(destDir, name);
|
|
105972
106071
|
const sharedDir = getSharedTemplateDir();
|
|
105973
106072
|
if (existsSync58(sharedDir)) {
|
|
105974
|
-
for (const entry of
|
|
106073
|
+
for (const entry of readdirSync25(sharedDir, { withFileTypes: true })) {
|
|
105975
106074
|
const src = join69(sharedDir, entry.name);
|
|
105976
106075
|
const dest = resolve32(destDir, entry.name);
|
|
105977
106076
|
if (entry.isFile() || entry.isSymbolicLink()) {
|
|
@@ -106148,7 +106247,7 @@ var init_init = __esm({
|
|
|
106148
106247
|
const templateId2 = exampleFlag ?? "blank";
|
|
106149
106248
|
const name2 = args.name ?? "my-video";
|
|
106150
106249
|
const destDir2 = resolve32(name2);
|
|
106151
|
-
if (existsSync58(destDir2) &&
|
|
106250
|
+
if (existsSync58(destDir2) && readdirSync25(destDir2).length > 0) {
|
|
106152
106251
|
console.error(c.error(`Directory already exists and is not empty: ${name2}`));
|
|
106153
106252
|
process.exit(1);
|
|
106154
106253
|
}
|
|
@@ -106166,7 +106265,7 @@ var init_init = __esm({
|
|
|
106166
106265
|
console.error(c.error(`Audio file not found: ${audioFlag}`));
|
|
106167
106266
|
process.exit(1);
|
|
106168
106267
|
}
|
|
106169
|
-
|
|
106268
|
+
mkdirSync34(destDir2, { recursive: true });
|
|
106170
106269
|
let localVideoName2;
|
|
106171
106270
|
let videoDuration2;
|
|
106172
106271
|
let sourceFilePath2;
|
|
@@ -106228,7 +106327,7 @@ var init_init = __esm({
|
|
|
106228
106327
|
await patchTranscript(destDir2, transcriptFile2);
|
|
106229
106328
|
}
|
|
106230
106329
|
console.log(c.success(`Created ${c.accent(name2 + "/")}`));
|
|
106231
|
-
for (const f3 of
|
|
106330
|
+
for (const f3 of readdirSync25(destDir2).filter((f4) => !f4.startsWith("."))) {
|
|
106232
106331
|
console.log(` ${c.accent(f3)}`);
|
|
106233
106332
|
}
|
|
106234
106333
|
if (!skipSkills) {
|
|
@@ -106288,7 +106387,7 @@ var init_init = __esm({
|
|
|
106288
106387
|
name = nameResult;
|
|
106289
106388
|
}
|
|
106290
106389
|
const destDir = resolve32(name);
|
|
106291
|
-
if (existsSync58(destDir) &&
|
|
106390
|
+
if (existsSync58(destDir) && readdirSync25(destDir).length > 0) {
|
|
106292
106391
|
const overwrite = await ue({
|
|
106293
106392
|
message: `Directory ${c.accent(name)} already exists and is not empty. Overwrite?`,
|
|
106294
106393
|
initialValue: false
|
|
@@ -106308,7 +106407,7 @@ var init_init = __esm({
|
|
|
106308
106407
|
me("Setup cancelled.");
|
|
106309
106408
|
process.exit(1);
|
|
106310
106409
|
}
|
|
106311
|
-
|
|
106410
|
+
mkdirSync34(destDir, { recursive: true });
|
|
106312
106411
|
sourceFilePath = videoPath;
|
|
106313
106412
|
const result = await handleVideoFile(videoPath, destDir, true);
|
|
106314
106413
|
localVideoName = result.localVideoName;
|
|
@@ -106320,7 +106419,7 @@ var init_init = __esm({
|
|
|
106320
106419
|
me("Setup cancelled.");
|
|
106321
106420
|
process.exit(1);
|
|
106322
106421
|
}
|
|
106323
|
-
|
|
106422
|
+
mkdirSync34(destDir, { recursive: true });
|
|
106324
106423
|
sourceFilePath = audioPath;
|
|
106325
106424
|
copyFileSync6(audioPath, resolve32(destDir, basename10(audioPath)));
|
|
106326
106425
|
R2.info(`Audio copied to ${c.accent(basename10(audioPath))}`);
|
|
@@ -106419,7 +106518,7 @@ ${c.dim("Use --example blank for offline use.")}`
|
|
|
106419
106518
|
if (existsSync58(transcriptFile)) {
|
|
106420
106519
|
await patchTranscript(destDir, transcriptFile);
|
|
106421
106520
|
}
|
|
106422
|
-
const files =
|
|
106521
|
+
const files = readdirSync25(destDir);
|
|
106423
106522
|
Se(files.map((f3) => c.accent(f3)).join("\n"), c.success(`Created ${name}/`));
|
|
106424
106523
|
if (!skipSkills) {
|
|
106425
106524
|
await ensureSkillsCurrent(destDir);
|
|
@@ -106492,7 +106591,7 @@ __export(add_exports, {
|
|
|
106492
106591
|
runAdd: () => runAdd
|
|
106493
106592
|
});
|
|
106494
106593
|
import { existsSync as existsSync59 } from "fs";
|
|
106495
|
-
import { resolve as resolve33, relative as
|
|
106594
|
+
import { resolve as resolve33, relative as relative13 } from "path";
|
|
106496
106595
|
function remapTarget(item, originalTarget, paths) {
|
|
106497
106596
|
if (item.type === "hyperframes:block") {
|
|
106498
106597
|
const blocksDir = paths.blocks.replace(/\/+$/, "");
|
|
@@ -106659,7 +106758,7 @@ var init_add = __esm({
|
|
|
106659
106758
|
console.log("");
|
|
106660
106759
|
console.log(`${c.success("\u2713")} Added ${c.accent(result.name)} (${result.type})`);
|
|
106661
106760
|
for (const file of result.written) {
|
|
106662
|
-
console.log(` ${c.dim(
|
|
106761
|
+
console.log(` ${c.dim(relative13(projectDir, file))}`);
|
|
106663
106762
|
}
|
|
106664
106763
|
if (result.snippet) {
|
|
106665
106764
|
console.log("");
|
|
@@ -106873,10 +106972,10 @@ var init_catalog = __esm({
|
|
|
106873
106972
|
|
|
106874
106973
|
// src/utils/compositionServer.ts
|
|
106875
106974
|
import { existsSync as existsSync60 } from "fs";
|
|
106876
|
-
import { resolve as resolve35, dirname as
|
|
106975
|
+
import { resolve as resolve35, dirname as dirname26 } from "path";
|
|
106877
106976
|
import { fileURLToPath as fileURLToPath10 } from "url";
|
|
106878
106977
|
function helperDir() {
|
|
106879
|
-
return
|
|
106978
|
+
return dirname26(fileURLToPath10(import.meta.url));
|
|
106880
106979
|
}
|
|
106881
106980
|
function resolveRuntimePath2() {
|
|
106882
106981
|
const d2 = helperDir();
|
|
@@ -107464,8 +107563,8 @@ var init_present = __esm({
|
|
|
107464
107563
|
});
|
|
107465
107564
|
|
|
107466
107565
|
// src/utils/publishProject.ts
|
|
107467
|
-
import { basename as basename11, dirname as
|
|
107468
|
-
import { existsSync as existsSync63, readdirSync as
|
|
107566
|
+
import { basename as basename11, dirname as dirname27, join as join70, posix as posix4, relative as relative14, resolve as resolve38 } from "path";
|
|
107567
|
+
import { existsSync as existsSync63, readdirSync as readdirSync26, readFileSync as readFileSync45, statSync as statSync21 } from "fs";
|
|
107469
107568
|
import AdmZip from "adm-zip";
|
|
107470
107569
|
function isRecord3(value) {
|
|
107471
107570
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -107563,23 +107662,23 @@ function shouldIgnoreSegment(segment) {
|
|
|
107563
107662
|
return segment.startsWith(".") || IGNORED_DIRS.has(segment) || IGNORED_FILES.has(segment);
|
|
107564
107663
|
}
|
|
107565
107664
|
function collectProjectFiles(rootDir, currentDir, paths) {
|
|
107566
|
-
for (const entry of
|
|
107665
|
+
for (const entry of readdirSync26(currentDir, { withFileTypes: true })) {
|
|
107567
107666
|
if (shouldIgnoreSegment(entry.name)) continue;
|
|
107568
107667
|
const absolutePath = join70(currentDir, entry.name);
|
|
107569
|
-
const relativePath =
|
|
107668
|
+
const relativePath = relative14(rootDir, absolutePath).replaceAll("\\", "/");
|
|
107570
107669
|
if (!relativePath) continue;
|
|
107571
107670
|
if (entry.isDirectory()) {
|
|
107572
107671
|
collectProjectFiles(rootDir, absolutePath, paths);
|
|
107573
107672
|
continue;
|
|
107574
107673
|
}
|
|
107575
|
-
if (!
|
|
107674
|
+
if (!statSync21(absolutePath).isFile()) continue;
|
|
107576
107675
|
paths.push(relativePath);
|
|
107577
107676
|
}
|
|
107578
107677
|
}
|
|
107579
107678
|
function addExternalAsset(ctx, absPath) {
|
|
107580
107679
|
const existing = ctx.externalMap.get(absPath);
|
|
107581
107680
|
if (existing) return existing;
|
|
107582
|
-
const rel =
|
|
107681
|
+
const rel = relative14(ctx.absProjectDir, absPath).replaceAll("\\", "/");
|
|
107583
107682
|
const stripped = rel.replace(/^(?:\.\.\/)+/, "");
|
|
107584
107683
|
let archivePath = `${EXT_ASSETS_PREFIX}/${stripped}`;
|
|
107585
107684
|
if (ctx.usedArchivePaths.has(archivePath)) {
|
|
@@ -107599,7 +107698,7 @@ function tryResolveExternal(ctx, rawPath, referrerAbsDir) {
|
|
|
107599
107698
|
const absPath = resolve38(referrerAbsDir, rawPath);
|
|
107600
107699
|
if (isPathInside(absPath, ctx.absProjectDir)) return null;
|
|
107601
107700
|
try {
|
|
107602
|
-
if (!existsSync63(absPath) || !
|
|
107701
|
+
if (!existsSync63(absPath) || !statSync21(absPath).isFile()) return null;
|
|
107603
107702
|
} catch {
|
|
107604
107703
|
return null;
|
|
107605
107704
|
}
|
|
@@ -107652,7 +107751,7 @@ function rewriteStyleBlocks(ctx, document2, referrerAbsDir, entryPath) {
|
|
|
107652
107751
|
return modified;
|
|
107653
107752
|
}
|
|
107654
107753
|
function localizeHtmlEntry(ctx, entryPath, content) {
|
|
107655
|
-
const referrerAbsDir = resolve38(ctx.absProjectDir,
|
|
107754
|
+
const referrerAbsDir = resolve38(ctx.absProjectDir, dirname27(entryPath));
|
|
107656
107755
|
const { document: document2 } = parseHTML(content.toString("utf-8"));
|
|
107657
107756
|
const attrsChanged = rewriteHtmlAttributes(ctx, document2, referrerAbsDir, entryPath);
|
|
107658
107757
|
const stylesChanged = rewriteStyleBlocks(ctx, document2, referrerAbsDir, entryPath);
|
|
@@ -107661,7 +107760,7 @@ function localizeHtmlEntry(ctx, entryPath, content) {
|
|
|
107661
107760
|
}
|
|
107662
107761
|
}
|
|
107663
107762
|
function localizeCssEntry(ctx, entryPath, content) {
|
|
107664
|
-
const referrerAbsDir = resolve38(ctx.absProjectDir,
|
|
107763
|
+
const referrerAbsDir = resolve38(ctx.absProjectDir, dirname27(entryPath));
|
|
107665
107764
|
const css = content.toString("utf-8");
|
|
107666
107765
|
if (!css.includes("url(")) return;
|
|
107667
107766
|
const result = rewriteCssUrls(ctx, css, referrerAbsDir, entryPath);
|
|
@@ -108620,8 +108719,8 @@ __export(batchRender_exports, {
|
|
|
108620
108719
|
resolveOutputTemplate: () => resolveOutputTemplate,
|
|
108621
108720
|
runBatchRender: () => runBatchRender
|
|
108622
108721
|
});
|
|
108623
|
-
import { mkdirSync as
|
|
108624
|
-
import { dirname as
|
|
108722
|
+
import { mkdirSync as mkdirSync35, readFileSync as readFileSync47, writeFileSync as writeFileSync27 } from "fs";
|
|
108723
|
+
import { dirname as dirname28, join as join72, resolve as resolve42, sep as sep8 } from "path";
|
|
108625
108724
|
function isRecord4(value) {
|
|
108626
108725
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
108627
108726
|
}
|
|
@@ -108686,11 +108785,11 @@ function isSameOrChildPath(path2, parent) {
|
|
|
108686
108785
|
function commonOutputDirectory(outputPaths) {
|
|
108687
108786
|
const firstPath = outputPaths[0];
|
|
108688
108787
|
if (!firstPath) return resolve42("renders");
|
|
108689
|
-
let common =
|
|
108788
|
+
let common = dirname28(firstPath);
|
|
108690
108789
|
for (const outputPath of outputPaths.slice(1)) {
|
|
108691
|
-
const dir =
|
|
108790
|
+
const dir = dirname28(outputPath);
|
|
108692
108791
|
while (!isSameOrChildPath(dir, common)) {
|
|
108693
|
-
const parent =
|
|
108792
|
+
const parent = dirname28(common);
|
|
108694
108793
|
if (parent === common) return common;
|
|
108695
108794
|
common = parent;
|
|
108696
108795
|
}
|
|
@@ -108808,7 +108907,7 @@ function summarizeManifest(manifest) {
|
|
|
108808
108907
|
}
|
|
108809
108908
|
function writeManifest(manifest) {
|
|
108810
108909
|
summarizeManifest(manifest);
|
|
108811
|
-
|
|
108910
|
+
mkdirSync35(dirname28(manifest.manifestPath), { recursive: true });
|
|
108812
108911
|
writeFileSync27(manifest.manifestPath, JSON.stringify(manifest, null, 2) + "\n", "utf8");
|
|
108813
108912
|
}
|
|
108814
108913
|
function emitJsonEvent(event, json) {
|
|
@@ -108833,7 +108932,7 @@ async function renderBatchRow(row, manifest, options) {
|
|
|
108833
108932
|
console.log(c.dim(`Batch row ${row.index}: ${row.outputPath}`));
|
|
108834
108933
|
}
|
|
108835
108934
|
try {
|
|
108836
|
-
|
|
108935
|
+
mkdirSync35(dirname28(row.outputPath), { recursive: true });
|
|
108837
108936
|
const result = await options.renderOne(row);
|
|
108838
108937
|
manifestRow.status = "completed";
|
|
108839
108938
|
manifestRow.durationMs = result.durationMs ?? null;
|
|
@@ -108972,9 +109071,9 @@ __export(render_exports, {
|
|
|
108972
109071
|
renderLocal: () => renderLocal,
|
|
108973
109072
|
resolveBrowserGpuForCli: () => resolveBrowserGpuForCli
|
|
108974
109073
|
});
|
|
108975
|
-
import { mkdirSync as
|
|
109074
|
+
import { mkdirSync as mkdirSync36, readdirSync as readdirSync27, readFileSync as readFileSync48, statSync as statSync22, writeFileSync as writeFileSync28, rmSync as rmSync18 } from "fs";
|
|
108976
109075
|
import { cpus as cpus4, freemem as freemem5, tmpdir as tmpdir5 } from "os";
|
|
108977
|
-
import { resolve as resolve43, dirname as
|
|
109076
|
+
import { resolve as resolve43, dirname as dirname29, join as join73, basename as basename13 } from "path";
|
|
108978
109077
|
import { execFileSync as execFileSync8, spawn as spawn14 } from "child_process";
|
|
108979
109078
|
function formatFpsParseError(input2, reason) {
|
|
108980
109079
|
switch (reason) {
|
|
@@ -109011,7 +109110,7 @@ function resolveDockerfilePath() {
|
|
|
109011
109110
|
const devPath = resolve43(__dirname, "..", "src", "docker", "Dockerfile.render");
|
|
109012
109111
|
for (const p2 of [builtPath, devPath]) {
|
|
109013
109112
|
try {
|
|
109014
|
-
|
|
109113
|
+
statSync22(p2);
|
|
109015
109114
|
return p2;
|
|
109016
109115
|
} catch {
|
|
109017
109116
|
continue;
|
|
@@ -109040,7 +109139,7 @@ function ensureDockerImage(version2, platform10, quiet) {
|
|
|
109040
109139
|
if (!quiet) console.log(c.dim(` Building Docker image: ${tag} (${platform10})...`));
|
|
109041
109140
|
const dockerfilePath = resolveDockerfilePath();
|
|
109042
109141
|
const tmpDir = join73(tmpdir5(), `hyperframes-docker-${Date.now()}`);
|
|
109043
|
-
|
|
109142
|
+
mkdirSync36(tmpDir, { recursive: true });
|
|
109044
109143
|
writeFileSync28(join73(tmpDir, "Dockerfile"), readFileSync48(dockerfilePath));
|
|
109045
109144
|
const targetArch = platform10 === "linux/arm64" ? "arm64" : "amd64";
|
|
109046
109145
|
try {
|
|
@@ -109064,7 +109163,7 @@ function ensureDockerImage(version2, platform10, quiet) {
|
|
|
109064
109163
|
const message = error instanceof Error ? error.message : String(error);
|
|
109065
109164
|
throw new Error(`Failed to build Docker image: ${message}`);
|
|
109066
109165
|
} finally {
|
|
109067
|
-
|
|
109166
|
+
rmSync18(tmpDir, { recursive: true, force: true });
|
|
109068
109167
|
}
|
|
109069
109168
|
if (!quiet) console.log(c.dim(` Docker image: ${tag} (built)`));
|
|
109070
109169
|
return tag;
|
|
@@ -109108,7 +109207,7 @@ async function renderDocker(projectDir, outputPath, options) {
|
|
|
109108
109207
|
);
|
|
109109
109208
|
process.exit(1);
|
|
109110
109209
|
}
|
|
109111
|
-
const outputDir =
|
|
109210
|
+
const outputDir = dirname29(outputPath);
|
|
109112
109211
|
const outputFilename = basename13(outputPath);
|
|
109113
109212
|
const dockerArgs = buildDockerRunArgs({
|
|
109114
109213
|
imageTag,
|
|
@@ -109426,13 +109525,13 @@ function printRenderComplete(outputPath, elapsedMs, quiet) {
|
|
|
109426
109525
|
if (quiet) return;
|
|
109427
109526
|
let fileSize = "unknown";
|
|
109428
109527
|
try {
|
|
109429
|
-
const stat3 =
|
|
109528
|
+
const stat3 = statSync22(outputPath);
|
|
109430
109529
|
if (stat3.isDirectory()) {
|
|
109431
109530
|
let total = 0;
|
|
109432
|
-
for (const entry of
|
|
109531
|
+
for (const entry of readdirSync27(outputPath, { withFileTypes: true })) {
|
|
109433
109532
|
if (!entry.isFile()) continue;
|
|
109434
109533
|
try {
|
|
109435
|
-
total +=
|
|
109534
|
+
total += statSync22(join73(outputPath, entry.name)).size;
|
|
109436
109535
|
} catch {
|
|
109437
109536
|
}
|
|
109438
109537
|
}
|
|
@@ -109846,7 +109945,7 @@ var init_render2 = __esm({
|
|
|
109846
109945
|
const timePart = now.toTimeString().slice(0, 8).replace(/:/g, "-");
|
|
109847
109946
|
const batchOutputTemplate = args.output ? args.output : join73(rendersDir, `${project.name}_${datePart}_${timePart}_{index}${ext}`);
|
|
109848
109947
|
const outputPath = args.output ? resolve43(args.output) : join73(rendersDir, `${project.name}_${datePart}_${timePart}${ext}`);
|
|
109849
|
-
if (!batchPath)
|
|
109948
|
+
if (!batchPath) mkdirSync36(dirname29(outputPath), { recursive: true });
|
|
109850
109949
|
const useDocker = args.docker ?? false;
|
|
109851
109950
|
const useGpu = args.gpu ?? false;
|
|
109852
109951
|
const browserGpuArg = args["browser-gpu"];
|
|
@@ -109904,7 +110003,7 @@ var init_render2 = __esm({
|
|
|
109904
110003
|
console.log(c.warn(" GIF output is capped at 30fps. Use --fps 15 for smaller files."));
|
|
109905
110004
|
}
|
|
109906
110005
|
const pageNavigationTimeoutMs = resolveBrowserTimeoutMsArg(args["browser-timeout"]);
|
|
109907
|
-
const entryFile = resolveCompositionEntryArg(args.composition, project.dir,
|
|
110006
|
+
const entryFile = resolveCompositionEntryArg(args.composition, project.dir, statSync22);
|
|
109908
110007
|
let batchModule;
|
|
109909
110008
|
let preparedBatch;
|
|
109910
110009
|
if (batchPath) {
|
|
@@ -110297,10 +110396,10 @@ var init_beats = __esm({
|
|
|
110297
110396
|
// src/beats/headlessAnalyzer.ts
|
|
110298
110397
|
import { existsSync as existsSync66, readFileSync as readFileSync49 } from "fs";
|
|
110299
110398
|
import { createRequire as createRequire3 } from "module";
|
|
110300
|
-
import { dirname as
|
|
110399
|
+
import { dirname as dirname30, join as join74 } from "path";
|
|
110301
110400
|
import { fileURLToPath as fileURLToPath11 } from "url";
|
|
110302
110401
|
function findPrebuiltBundle() {
|
|
110303
|
-
const here =
|
|
110402
|
+
const here = dirname30(fileURLToPath11(import.meta.url));
|
|
110304
110403
|
const candidates = [
|
|
110305
110404
|
join74(here, "beat-analyzer.global.js"),
|
|
110306
110405
|
// dist root (tsup-bundled cli)
|
|
@@ -110315,7 +110414,7 @@ function findPrebuiltBundle() {
|
|
|
110315
110414
|
}
|
|
110316
110415
|
async function buildFromCoreSource() {
|
|
110317
110416
|
const esbuild = await import("esbuild");
|
|
110318
|
-
const coreRoot =
|
|
110417
|
+
const coreRoot = dirname30(require2.resolve("@hyperframes/core/package.json"));
|
|
110319
110418
|
const entry = join74(coreRoot, "src/beats/beatDetection.ts");
|
|
110320
110419
|
const result = await esbuild.build({
|
|
110321
110420
|
stdin: {
|
|
@@ -110416,8 +110515,8 @@ __export(beats_exports, {
|
|
|
110416
110515
|
default: () => beats_default,
|
|
110417
110516
|
examples: () => examples11
|
|
110418
110517
|
});
|
|
110419
|
-
import { existsSync as existsSync67, readFileSync as readFileSync50, mkdirSync as
|
|
110420
|
-
import { resolve as resolve44, join as join75, dirname as
|
|
110518
|
+
import { existsSync as existsSync67, readFileSync as readFileSync50, mkdirSync as mkdirSync37, writeFileSync as writeFileSync29 } from "fs";
|
|
110519
|
+
import { resolve as resolve44, join as join75, dirname as dirname31 } from "path";
|
|
110421
110520
|
function fail(message) {
|
|
110422
110521
|
console.error(c.error(message));
|
|
110423
110522
|
process.exit(1);
|
|
@@ -110488,7 +110587,7 @@ var init_beats2 = __esm({
|
|
|
110488
110587
|
fail(`No beats detected in ${rel} \u2014 nothing written. (Track may be silent/ambient.)`);
|
|
110489
110588
|
}
|
|
110490
110589
|
const outPath = join75(project.dir, "beats", `${rel}.json`);
|
|
110491
|
-
|
|
110590
|
+
mkdirSync37(dirname31(outPath), { recursive: true });
|
|
110492
110591
|
writeFileSync29(outPath, serializeBeats(result.beatTimes, result.beatStrengths, rel));
|
|
110493
110592
|
report(`beats/${rel}.json`, result, Boolean(args.json));
|
|
110494
110593
|
}
|
|
@@ -110503,7 +110602,7 @@ __export(staticProjectServer_exports, {
|
|
|
110503
110602
|
});
|
|
110504
110603
|
import { createServer } from "http";
|
|
110505
110604
|
import { existsSync as existsSync68, readFileSync as readFileSync51 } from "fs";
|
|
110506
|
-
import { isAbsolute as
|
|
110605
|
+
import { isAbsolute as isAbsolute13, relative as relative15, resolve as resolve45 } from "path";
|
|
110507
110606
|
async function serveStaticProjectHtml(projectDir, html, bindErrorMessage = "Failed to bind local HTTP server") {
|
|
110508
110607
|
const server = createServer((req, res) => {
|
|
110509
110608
|
const url = req.url ?? "/";
|
|
@@ -110513,8 +110612,8 @@ async function serveStaticProjectHtml(projectDir, html, bindErrorMessage = "Fail
|
|
|
110513
110612
|
return;
|
|
110514
110613
|
}
|
|
110515
110614
|
const filePath = resolve45(projectDir, decodeURIComponent(url).replace(/^\//, ""));
|
|
110516
|
-
const rel =
|
|
110517
|
-
if (rel.startsWith("..") ||
|
|
110615
|
+
const rel = relative15(projectDir, filePath);
|
|
110616
|
+
if (rel.startsWith("..") || isAbsolute13(rel)) {
|
|
110518
110617
|
res.writeHead(403);
|
|
110519
110618
|
res.end();
|
|
110520
110619
|
return;
|
|
@@ -110913,7 +111012,7 @@ var init_motionAudit = __esm({
|
|
|
110913
111012
|
});
|
|
110914
111013
|
|
|
110915
111014
|
// src/utils/motionSpec.ts
|
|
110916
|
-
import { existsSync as existsSync69, readFileSync as readFileSync52, readdirSync as
|
|
111015
|
+
import { existsSync as existsSync69, readFileSync as readFileSync52, readdirSync as readdirSync28 } from "fs";
|
|
110917
111016
|
import { basename as basename14, join as join76 } from "path";
|
|
110918
111017
|
function isObject2(value) {
|
|
110919
111018
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -110957,7 +111056,7 @@ function parseMotionSpec(raw) {
|
|
|
110957
111056
|
}
|
|
110958
111057
|
function findMotionSpec(projectDir) {
|
|
110959
111058
|
if (!existsSync69(projectDir)) return null;
|
|
110960
|
-
const entries2 =
|
|
111059
|
+
const entries2 = readdirSync28(projectDir);
|
|
110961
111060
|
const sidecars = entries2.filter((name) => name.endsWith(".motion.json")).sort();
|
|
110962
111061
|
if (!sidecars[0]) return null;
|
|
110963
111062
|
if (sidecars.length === 1) return join76(projectDir, sidecars[0]);
|
|
@@ -111027,7 +111126,7 @@ __export(layout_exports, {
|
|
|
111027
111126
|
examples: () => examples12
|
|
111028
111127
|
});
|
|
111029
111128
|
import { existsSync as existsSync70, readFileSync as readFileSync53 } from "fs";
|
|
111030
|
-
import { dirname as
|
|
111129
|
+
import { dirname as dirname32, join as join77 } from "path";
|
|
111031
111130
|
import { fileURLToPath as fileURLToPath12 } from "url";
|
|
111032
111131
|
function buildMotionSampleTimes(duration) {
|
|
111033
111132
|
if (!Number.isFinite(duration) || duration <= 0) return [];
|
|
@@ -111500,7 +111599,7 @@ var init_layout2 = __esm({
|
|
|
111500
111599
|
init_motionAudit();
|
|
111501
111600
|
init_motionSpec();
|
|
111502
111601
|
__filename = fileURLToPath12(import.meta.url);
|
|
111503
|
-
__dirname2 =
|
|
111602
|
+
__dirname2 = dirname32(__filename);
|
|
111504
111603
|
SEEK_SETTLE_MS = 120;
|
|
111505
111604
|
INSPECT_SCHEMA_VERSION = 1;
|
|
111506
111605
|
MOTION_FPS = 20;
|
|
@@ -111559,16 +111658,16 @@ __export(info_exports, {
|
|
|
111559
111658
|
default: () => info_default,
|
|
111560
111659
|
examples: () => examples14
|
|
111561
111660
|
});
|
|
111562
|
-
import { readFileSync as readFileSync54, readdirSync as
|
|
111661
|
+
import { readFileSync as readFileSync54, readdirSync as readdirSync29, statSync as statSync23 } from "fs";
|
|
111563
111662
|
import { join as join78 } from "path";
|
|
111564
111663
|
function totalSize(dir) {
|
|
111565
111664
|
let total = 0;
|
|
111566
|
-
for (const entry of
|
|
111665
|
+
for (const entry of readdirSync29(dir, { withFileTypes: true })) {
|
|
111567
111666
|
const path2 = join78(dir, entry.name);
|
|
111568
111667
|
if (entry.isDirectory()) {
|
|
111569
111668
|
total += totalSize(path2);
|
|
111570
111669
|
} else {
|
|
111571
|
-
total +=
|
|
111670
|
+
total += statSync23(path2).size;
|
|
111572
111671
|
}
|
|
111573
111672
|
}
|
|
111574
111673
|
return total;
|
|
@@ -111655,7 +111754,7 @@ __export(compositions_exports, {
|
|
|
111655
111754
|
parseSubComposition: () => parseSubComposition
|
|
111656
111755
|
});
|
|
111657
111756
|
import { existsSync as existsSync71, readFileSync as readFileSync55 } from "fs";
|
|
111658
|
-
import { resolve as resolve46, dirname as
|
|
111757
|
+
import { resolve as resolve46, dirname as dirname33 } from "path";
|
|
111659
111758
|
function countRenderableDescendants(root) {
|
|
111660
111759
|
return Array.from(root.querySelectorAll("*")).filter(
|
|
111661
111760
|
(el) => !NON_RENDERED_TAGS2.has(el.tagName.toLowerCase())
|
|
@@ -111794,7 +111893,7 @@ var init_compositions = __esm({
|
|
|
111794
111893
|
const project = resolveProject(args.dir);
|
|
111795
111894
|
const html = readFileSync55(project.indexPath, "utf-8");
|
|
111796
111895
|
ensureDOMParser();
|
|
111797
|
-
const compositions = parseCompositions(html,
|
|
111896
|
+
const compositions = parseCompositions(html, dirname33(project.indexPath));
|
|
111798
111897
|
if (compositions.length === 0) {
|
|
111799
111898
|
console.log(`${c.success("\u25C7")} ${c.accent(project.name)} \u2014 no compositions found`);
|
|
111800
111899
|
return;
|
|
@@ -111830,7 +111929,7 @@ __export(benchmark_exports, {
|
|
|
111830
111929
|
default: () => benchmark_default,
|
|
111831
111930
|
examples: () => examples16
|
|
111832
111931
|
});
|
|
111833
|
-
import { existsSync as existsSync72, statSync as
|
|
111932
|
+
import { existsSync as existsSync72, statSync as statSync24 } from "fs";
|
|
111834
111933
|
import { resolve as resolve47, join as join79 } from "path";
|
|
111835
111934
|
var examples16, FPS_30, FPS_60, DEFAULT_CONFIGS, benchmark_default;
|
|
111836
111935
|
var init_benchmark = __esm({
|
|
@@ -111924,7 +112023,7 @@ var init_benchmark = __esm({
|
|
|
111924
112023
|
const elapsedMs = Date.now() - startTime;
|
|
111925
112024
|
let fileSize = null;
|
|
111926
112025
|
if (existsSync72(outputPath)) {
|
|
111927
|
-
const stat3 =
|
|
112026
|
+
const stat3 = statSync24(outputPath);
|
|
111928
112027
|
fileSize = stat3.size;
|
|
111929
112028
|
}
|
|
111930
112029
|
runs.push({ elapsedMs, fileSize });
|
|
@@ -112181,8 +112280,8 @@ __export(manager_exports3, {
|
|
|
112181
112280
|
modelPath: () => modelPath,
|
|
112182
112281
|
selectProviders: () => selectProviders
|
|
112183
112282
|
});
|
|
112184
|
-
import { existsSync as existsSync73, mkdirSync as
|
|
112185
|
-
import { homedir as
|
|
112283
|
+
import { existsSync as existsSync73, mkdirSync as mkdirSync38 } from "fs";
|
|
112284
|
+
import { homedir as homedir11, platform as platform8, arch } from "os";
|
|
112186
112285
|
import { join as join80 } from "path";
|
|
112187
112286
|
function isDevice(value) {
|
|
112188
112287
|
return typeof value === "string" && DEVICES.includes(value);
|
|
@@ -112228,7 +112327,7 @@ function modelPath(model = DEFAULT_MODEL2) {
|
|
|
112228
112327
|
async function ensureModel2(model = DEFAULT_MODEL2, options) {
|
|
112229
112328
|
const dest = modelPath(model);
|
|
112230
112329
|
if (existsSync73(dest)) return dest;
|
|
112231
|
-
|
|
112330
|
+
mkdirSync38(MODELS_DIR2, { recursive: true });
|
|
112232
112331
|
options?.onProgress?.(`Downloading ${model} weights (~168 MB)...`);
|
|
112233
112332
|
await downloadFile(MODEL_URLS[model], dest);
|
|
112234
112333
|
if (!existsSync73(dest)) {
|
|
@@ -112241,7 +112340,7 @@ var init_manager3 = __esm({
|
|
|
112241
112340
|
"src/background-removal/manager.ts"() {
|
|
112242
112341
|
"use strict";
|
|
112243
112342
|
init_download();
|
|
112244
|
-
MODELS_DIR2 = join80(
|
|
112343
|
+
MODELS_DIR2 = join80(homedir11(), ".cache", "hyperframes", "background-removal", "models");
|
|
112245
112344
|
DEFAULT_MODEL2 = "u2net_human_seg";
|
|
112246
112345
|
MODEL_URLS = {
|
|
112247
112346
|
u2net_human_seg: "https://github.com/danielgatis/rembg/releases/download/v0.0.0/u2net_human_seg.onnx"
|
|
@@ -112952,7 +113051,7 @@ __export(transcribe_exports2, {
|
|
|
112952
113051
|
examples: () => examples19
|
|
112953
113052
|
});
|
|
112954
113053
|
import { existsSync as existsSync75, writeFileSync as writeFileSync30 } from "fs";
|
|
112955
|
-
import { resolve as resolve49, join as join81, extname as extname12, dirname as
|
|
113054
|
+
import { resolve as resolve49, join as join81, extname as extname12, dirname as dirname34 } from "path";
|
|
112956
113055
|
function failWith(message, json) {
|
|
112957
113056
|
trackCommandFailure("transcribe", message);
|
|
112958
113057
|
if (json) {
|
|
@@ -113152,7 +113251,7 @@ var init_transcribe2 = __esm({
|
|
|
113152
113251
|
console.error(c.error(message));
|
|
113153
113252
|
process.exit(1);
|
|
113154
113253
|
}
|
|
113155
|
-
const dir = resolve49(args.dir ??
|
|
113254
|
+
const dir = resolve49(args.dir ?? dirname34(inputPath));
|
|
113156
113255
|
const ext = extname12(inputPath).toLowerCase();
|
|
113157
113256
|
const isImport = ext === ".json" || ext === ".srt" || ext === ".vtt";
|
|
113158
113257
|
const to = parseExportFormat(args.to, args.json);
|
|
@@ -113180,8 +113279,8 @@ var init_transcribe2 = __esm({
|
|
|
113180
113279
|
});
|
|
113181
113280
|
|
|
113182
113281
|
// src/tts/manager.ts
|
|
113183
|
-
import { existsSync as existsSync76, mkdirSync as
|
|
113184
|
-
import { homedir as
|
|
113282
|
+
import { existsSync as existsSync76, mkdirSync as mkdirSync39 } from "fs";
|
|
113283
|
+
import { homedir as homedir12 } from "os";
|
|
113185
113284
|
import { join as join82 } from "path";
|
|
113186
113285
|
function inferLangFromVoiceId(voiceId) {
|
|
113187
113286
|
const first = voiceId.charAt(0).toLowerCase();
|
|
@@ -113199,7 +113298,7 @@ async function ensureModel3(model = DEFAULT_MODEL3, options) {
|
|
|
113199
113298
|
`Unknown TTS model: ${model}. Available: ${Object.keys(MODEL_URLS2).join(", ")}`
|
|
113200
113299
|
);
|
|
113201
113300
|
}
|
|
113202
|
-
|
|
113301
|
+
mkdirSync39(MODELS_DIR3, { recursive: true });
|
|
113203
113302
|
options?.onProgress?.(`Downloading TTS model ${model} (~311 MB)...`);
|
|
113204
113303
|
await downloadFile(url, modelPath2);
|
|
113205
113304
|
if (!existsSync76(modelPath2)) {
|
|
@@ -113210,7 +113309,7 @@ async function ensureModel3(model = DEFAULT_MODEL3, options) {
|
|
|
113210
113309
|
async function ensureVoices(options) {
|
|
113211
113310
|
const voicesPath = join82(VOICES_DIR, "voices-v1.0.bin");
|
|
113212
113311
|
if (existsSync76(voicesPath)) return voicesPath;
|
|
113213
|
-
|
|
113312
|
+
mkdirSync39(VOICES_DIR, { recursive: true });
|
|
113214
113313
|
options?.onProgress?.("Downloading voice data (~27 MB)...");
|
|
113215
113314
|
await downloadFile(VOICES_URL, voicesPath);
|
|
113216
113315
|
if (!existsSync76(voicesPath)) {
|
|
@@ -113223,7 +113322,7 @@ var init_manager4 = __esm({
|
|
|
113223
113322
|
"src/tts/manager.ts"() {
|
|
113224
113323
|
"use strict";
|
|
113225
113324
|
init_download();
|
|
113226
|
-
CACHE_DIR3 = join82(
|
|
113325
|
+
CACHE_DIR3 = join82(homedir12(), ".cache", "hyperframes", "tts");
|
|
113227
113326
|
MODELS_DIR3 = join82(CACHE_DIR3, "models");
|
|
113228
113327
|
VOICES_DIR = join82(CACHE_DIR3, "voices");
|
|
113229
113328
|
DEFAULT_MODEL3 = "kokoro-v1.0";
|
|
@@ -113342,16 +113441,16 @@ __export(synthesize_exports, {
|
|
|
113342
113441
|
synthesize: () => synthesize
|
|
113343
113442
|
});
|
|
113344
113443
|
import { execFileSync as execFileSync10 } from "child_process";
|
|
113345
|
-
import { existsSync as existsSync77, writeFileSync as writeFileSync31, mkdirSync as
|
|
113346
|
-
import { join as join83, dirname as
|
|
113347
|
-
import { homedir as
|
|
113444
|
+
import { existsSync as existsSync77, writeFileSync as writeFileSync31, mkdirSync as mkdirSync40, readdirSync as readdirSync30, unlinkSync as unlinkSync7 } from "fs";
|
|
113445
|
+
import { join as join83, dirname as dirname35, basename as basename15 } from "path";
|
|
113446
|
+
import { homedir as homedir13 } from "os";
|
|
113348
113447
|
function ensureSynthScript() {
|
|
113349
113448
|
if (!existsSync77(SCRIPT_PATH)) {
|
|
113350
|
-
|
|
113449
|
+
mkdirSync40(SCRIPT_DIR, { recursive: true });
|
|
113351
113450
|
writeFileSync31(SCRIPT_PATH, SYNTH_SCRIPT);
|
|
113352
113451
|
const currentName = basename15(SCRIPT_PATH);
|
|
113353
113452
|
try {
|
|
113354
|
-
for (const entry of
|
|
113453
|
+
for (const entry of readdirSync30(SCRIPT_DIR)) {
|
|
113355
113454
|
if (entry !== currentName && /^synth(-v\d+)?\.py$/.test(entry)) {
|
|
113356
113455
|
try {
|
|
113357
113456
|
unlinkSync7(join83(SCRIPT_DIR, entry));
|
|
@@ -113388,7 +113487,7 @@ async function synthesize(text, outputPath, options) {
|
|
|
113388
113487
|
ensureVoices({ onProgress: options?.onProgress })
|
|
113389
113488
|
]);
|
|
113390
113489
|
const scriptPath = ensureSynthScript();
|
|
113391
|
-
|
|
113490
|
+
mkdirSync40(dirname35(outputPath), { recursive: true });
|
|
113392
113491
|
options?.onProgress?.(`Generating speech with voice ${voice} (${lang})...`);
|
|
113393
113492
|
try {
|
|
113394
113493
|
const stdout2 = execFileSync10(
|
|
@@ -113465,7 +113564,7 @@ print(json.dumps({
|
|
|
113465
113564
|
"langApplied": bool(lang and supports_lang),
|
|
113466
113565
|
}))
|
|
113467
113566
|
`;
|
|
113468
|
-
SCRIPT_DIR = join83(
|
|
113567
|
+
SCRIPT_DIR = join83(homedir13(), ".cache", "hyperframes", "tts");
|
|
113469
113568
|
SCRIPT_PATH = join83(SCRIPT_DIR, "synth-v2.py");
|
|
113470
113569
|
}
|
|
113471
113570
|
});
|
|
@@ -113680,11 +113779,11 @@ __export(docs_exports, {
|
|
|
113680
113779
|
examples: () => examples21
|
|
113681
113780
|
});
|
|
113682
113781
|
import { readFileSync as readFileSync57, existsSync as existsSync79 } from "fs";
|
|
113683
|
-
import { resolve as resolve51, dirname as
|
|
113782
|
+
import { resolve as resolve51, dirname as dirname36, join as join84 } from "path";
|
|
113684
113783
|
import { fileURLToPath as fileURLToPath13 } from "url";
|
|
113685
113784
|
function docsDir() {
|
|
113686
113785
|
const thisFile = fileURLToPath13(import.meta.url);
|
|
113687
|
-
const dir =
|
|
113786
|
+
const dir = dirname36(thisFile);
|
|
113688
113787
|
const devPath = resolve51(dir, "..", "docs");
|
|
113689
113788
|
const builtPath = resolve51(dir, "docs");
|
|
113690
113789
|
return existsSync79(devPath) ? devPath : builtPath;
|
|
@@ -114457,7 +114556,7 @@ __export(validate_exports, {
|
|
|
114457
114556
|
shouldIgnoreRequestFailure: () => shouldIgnoreRequestFailure
|
|
114458
114557
|
});
|
|
114459
114558
|
import { existsSync as existsSync80, readFileSync as readFileSync58 } from "fs";
|
|
114460
|
-
import { join as join85, dirname as
|
|
114559
|
+
import { join as join85, dirname as dirname37 } from "path";
|
|
114461
114560
|
import { fileURLToPath as fileURLToPath14 } from "url";
|
|
114462
114561
|
function shouldIgnoreRequestFailure(url, errorText, resourceType) {
|
|
114463
114562
|
if (errorText !== "net::ERR_ABORTED") return false;
|
|
@@ -114708,7 +114807,7 @@ var init_validate = __esm({
|
|
|
114708
114807
|
init_colors();
|
|
114709
114808
|
init_updateCheck();
|
|
114710
114809
|
__filename2 = fileURLToPath14(import.meta.url);
|
|
114711
|
-
__dirname3 =
|
|
114810
|
+
__dirname3 = dirname37(__filename2);
|
|
114712
114811
|
CONTRAST_SAMPLES = 5;
|
|
114713
114812
|
SEEK_SETTLE_MS2 = 150;
|
|
114714
114813
|
MEDIA_EXTENSIONS = /\.(aac|flac|m4a|mov|mp3|mp4|oga|ogg|wav|webm)$/i;
|
|
@@ -114769,8 +114868,8 @@ __export(contactSheet_exports, {
|
|
|
114769
114868
|
createSvgContactSheet: () => createSvgContactSheet
|
|
114770
114869
|
});
|
|
114771
114870
|
import sharp from "sharp";
|
|
114772
|
-
import { readdirSync as
|
|
114773
|
-
import { join as join86, extname as extname14, basename as basename16, dirname as
|
|
114871
|
+
import { readdirSync as readdirSync31, readFileSync as readFileSync59, writeFileSync as writeFileSync32, unlinkSync as unlinkSync8, existsSync as existsSync81 } from "fs";
|
|
114872
|
+
import { join as join86, extname as extname14, basename as basename16, dirname as dirname38 } from "path";
|
|
114774
114873
|
async function createContactSheet(imagePaths, outputPath, opts = {}) {
|
|
114775
114874
|
const {
|
|
114776
114875
|
cols = 3,
|
|
@@ -114850,7 +114949,7 @@ async function createContactSheetPages(imagePaths, outputBasePath, opts = {}, la
|
|
|
114850
114949
|
}
|
|
114851
114950
|
async function createScrollContactSheet(screenshotsDir, outputPath) {
|
|
114852
114951
|
if (!existsSync81(screenshotsDir)) return [];
|
|
114853
|
-
const scrollFiles =
|
|
114952
|
+
const scrollFiles = readdirSync31(screenshotsDir).filter((f3) => f3.startsWith("scroll-") && f3.endsWith(".png")).sort();
|
|
114854
114953
|
if (scrollFiles.length === 0) return [];
|
|
114855
114954
|
const paths = scrollFiles.map((f3) => join86(screenshotsDir, f3));
|
|
114856
114955
|
const labels = scrollFiles.map((f3) => {
|
|
@@ -114867,7 +114966,7 @@ async function createScrollContactSheet(screenshotsDir, outputPath) {
|
|
|
114867
114966
|
}
|
|
114868
114967
|
async function createSnapshotContactSheet(snapshotsDir, outputPath) {
|
|
114869
114968
|
if (!existsSync81(snapshotsDir)) return [];
|
|
114870
|
-
const snapshotFiles =
|
|
114969
|
+
const snapshotFiles = readdirSync31(snapshotsDir).filter((f3) => f3.startsWith("frame-") && f3.endsWith(".png")).sort();
|
|
114871
114970
|
if (snapshotFiles.length === 0) return [];
|
|
114872
114971
|
const paths = snapshotFiles.map((f3) => join86(snapshotsDir, f3));
|
|
114873
114972
|
const labels = snapshotFiles.map((f3) => {
|
|
@@ -114885,7 +114984,7 @@ async function createSnapshotContactSheet(snapshotsDir, outputPath) {
|
|
|
114885
114984
|
async function createAssetContactSheet(assetsDir, outputPath) {
|
|
114886
114985
|
if (!existsSync81(assetsDir)) return [];
|
|
114887
114986
|
const imageExts = /* @__PURE__ */ new Set([".png", ".jpg", ".jpeg", ".webp"]);
|
|
114888
|
-
const assetFiles =
|
|
114987
|
+
const assetFiles = readdirSync31(assetsDir).filter((f3) => imageExts.has(extname14(f3).toLowerCase()) && !f3.includes("contact-sheet")).sort();
|
|
114889
114988
|
if (assetFiles.length === 0) return [];
|
|
114890
114989
|
const paths = assetFiles.map((f3) => join86(assetsDir, f3));
|
|
114891
114990
|
return createContactSheetPages(paths, outputPath, {
|
|
@@ -114903,7 +115002,7 @@ async function createSvgContactSheet(svgsDir, outputPath, assetsRootDir) {
|
|
|
114903
115002
|
const seen = /* @__PURE__ */ new Set();
|
|
114904
115003
|
const svgPaths = [];
|
|
114905
115004
|
for (const dir of dirsToScan) {
|
|
114906
|
-
for (const f3 of
|
|
115005
|
+
for (const f3 of readdirSync31(dir).filter((f4) => f4.endsWith(".svg")).sort()) {
|
|
114907
115006
|
if (!seen.has(f3)) {
|
|
114908
115007
|
seen.add(f3);
|
|
114909
115008
|
svgPaths.push(join86(dir, f3));
|
|
@@ -114913,7 +115012,7 @@ async function createSvgContactSheet(svgsDir, outputPath, assetsRootDir) {
|
|
|
114913
115012
|
if (svgPaths.length === 0) return [];
|
|
114914
115013
|
const svgFileNames = svgPaths.map((p2) => p2.split("/").pop());
|
|
114915
115014
|
const thumbSize = 200;
|
|
114916
|
-
const tmpDir =
|
|
115015
|
+
const tmpDir = dirname38(outputPath);
|
|
114917
115016
|
const tmpPaths = [];
|
|
114918
115017
|
const labels = [];
|
|
114919
115018
|
for (let i2 = 0; i2 < svgPaths.length; i2++) {
|
|
@@ -121120,7 +121219,7 @@ var require_node_domexception = __commonJS({
|
|
|
121120
121219
|
});
|
|
121121
121220
|
|
|
121122
121221
|
// ../../node_modules/.bun/fetch-blob@3.2.0/node_modules/fetch-blob/from.js
|
|
121123
|
-
import { statSync as
|
|
121222
|
+
import { statSync as statSync25, createReadStream as createReadStream3, promises as fs2 } from "fs";
|
|
121124
121223
|
import { basename as basename17 } from "path";
|
|
121125
121224
|
var import_node_domexception, stat, blobFromSync, blobFrom, fileFrom, fileFromSync, fromBlob, fromFile, BlobDataItem;
|
|
121126
121225
|
var init_from = __esm({
|
|
@@ -121130,10 +121229,10 @@ var init_from = __esm({
|
|
|
121130
121229
|
init_file();
|
|
121131
121230
|
init_fetch_blob();
|
|
121132
121231
|
({ stat } = fs2);
|
|
121133
|
-
blobFromSync = (path2, type) => fromBlob(
|
|
121232
|
+
blobFromSync = (path2, type) => fromBlob(statSync25(path2), path2, type);
|
|
121134
121233
|
blobFrom = (path2, type) => stat(path2).then((stat3) => fromBlob(stat3, path2, type));
|
|
121135
121234
|
fileFrom = (path2, type) => stat(path2).then((stat3) => fromFile(stat3, path2, type));
|
|
121136
|
-
fileFromSync = (path2, type) => fromFile(
|
|
121235
|
+
fileFromSync = (path2, type) => fromFile(statSync25(path2), path2, type);
|
|
121137
121236
|
fromBlob = (stat3, path2, type = "") => new fetch_blob_default([new BlobDataItem({
|
|
121138
121237
|
path: path2,
|
|
121139
121238
|
size: stat3.size,
|
|
@@ -146276,10 +146375,10 @@ function iterBinaryChunks(iterator) {
|
|
|
146276
146375
|
}
|
|
146277
146376
|
});
|
|
146278
146377
|
}
|
|
146279
|
-
function partition(str,
|
|
146280
|
-
const index = str.indexOf(
|
|
146378
|
+
function partition(str, delimiter) {
|
|
146379
|
+
const index = str.indexOf(delimiter);
|
|
146281
146380
|
if (index !== -1) {
|
|
146282
|
-
return [str.substring(0, index),
|
|
146381
|
+
return [str.substring(0, index), delimiter, str.substring(index + delimiter.length)];
|
|
146283
146382
|
}
|
|
146284
146383
|
return [str, "", ""];
|
|
146285
146384
|
}
|
|
@@ -150080,11 +150179,11 @@ var init_node4 = __esm({
|
|
|
150080
150179
|
while (true) {
|
|
150081
150180
|
delimiterIndex = -1;
|
|
150082
150181
|
delimiterLength = 0;
|
|
150083
|
-
for (const
|
|
150084
|
-
const index = buffer.indexOf(
|
|
150182
|
+
for (const delimiter of delimiters) {
|
|
150183
|
+
const index = buffer.indexOf(delimiter);
|
|
150085
150184
|
if (index !== -1 && (delimiterIndex === -1 || index < delimiterIndex)) {
|
|
150086
150185
|
delimiterIndex = index;
|
|
150087
|
-
delimiterLength =
|
|
150186
|
+
delimiterLength = delimiter.length;
|
|
150088
150187
|
}
|
|
150089
150188
|
}
|
|
150090
150189
|
if (delimiterIndex === -1) {
|
|
@@ -154698,9 +154797,9 @@ __export(snapshot_exports, {
|
|
|
154698
154797
|
examples: () => examples26
|
|
154699
154798
|
});
|
|
154700
154799
|
import { spawn as spawn16 } from "child_process";
|
|
154701
|
-
import { existsSync as existsSync82, mkdtempSync as mkdtempSync5, readFileSync as readFileSync60, mkdirSync as
|
|
154800
|
+
import { existsSync as existsSync82, mkdtempSync as mkdtempSync5, readFileSync as readFileSync60, mkdirSync as mkdirSync41, rmSync as rmSync19, writeFileSync as writeFileSync33 } from "fs";
|
|
154702
154801
|
import { tmpdir as tmpdir6 } from "os";
|
|
154703
|
-
import { resolve as resolve52, join as join87, relative as
|
|
154802
|
+
import { resolve as resolve52, join as join87, relative as relative16, isAbsolute as isAbsolute14 } from "path";
|
|
154704
154803
|
async function extractVideoFrameToBuffer(videoPath, timeSeconds, useVp9AlphaDecoder = false) {
|
|
154705
154804
|
const tmp = mkdtempSync5(join87(tmpdir6(), "hf-snapshot-frame-"));
|
|
154706
154805
|
const outPath = join87(tmp, "frame.png");
|
|
@@ -154749,7 +154848,7 @@ async function extractVideoFrameToBuffer(videoPath, timeSeconds, useVp9AlphaDeco
|
|
|
154749
154848
|
return readFileSync60(outPath);
|
|
154750
154849
|
} finally {
|
|
154751
154850
|
try {
|
|
154752
|
-
|
|
154851
|
+
rmSync19(tmp, { recursive: true, force: true });
|
|
154753
154852
|
} catch {
|
|
154754
154853
|
}
|
|
154755
154854
|
}
|
|
@@ -154845,12 +154944,12 @@ async function captureSnapshots(projectDir, opts) {
|
|
|
154845
154944
|
}
|
|
154846
154945
|
const positions = opts.at?.length ? opts.at : numFrames === 1 ? [duration / 2] : Array.from({ length: numFrames }, (_, i2) => i2 / (numFrames - 1) * duration);
|
|
154847
154946
|
const snapshotDir = join87(projectDir, "snapshots");
|
|
154848
|
-
|
|
154947
|
+
mkdirSync41(snapshotDir, { recursive: true });
|
|
154849
154948
|
try {
|
|
154850
|
-
const { readdirSync:
|
|
154851
|
-
for (const file of
|
|
154949
|
+
const { readdirSync: readdirSync37 } = await import("fs");
|
|
154950
|
+
for (const file of readdirSync37(snapshotDir)) {
|
|
154852
154951
|
if (/\.(png|jpg|jpeg)$/i.test(file)) {
|
|
154853
|
-
|
|
154952
|
+
rmSync19(join87(snapshotDir, file), { force: true });
|
|
154854
154953
|
}
|
|
154855
154954
|
}
|
|
154856
154955
|
} catch {
|
|
@@ -154930,8 +155029,8 @@ async function captureSnapshots(projectDir, opts) {
|
|
|
154930
155029
|
const url = new URL(v2.src);
|
|
154931
155030
|
const decodedPath = decodeURIComponent(url.pathname).replace(/^\//, "");
|
|
154932
155031
|
const candidate = resolve52(projectDir, decodedPath);
|
|
154933
|
-
const rel =
|
|
154934
|
-
if (!rel.startsWith("..") && !
|
|
155032
|
+
const rel = relative16(projectDir, candidate);
|
|
155033
|
+
if (!rel.startsWith("..") && !isAbsolute14(rel) && existsSync82(candidate)) {
|
|
154935
155034
|
filePath = candidate;
|
|
154936
155035
|
}
|
|
154937
155036
|
} catch {
|
|
@@ -155141,7 +155240,7 @@ ${c.error("\u2717")} Snapshot failed: ${msg}`);
|
|
|
155141
155240
|
});
|
|
155142
155241
|
|
|
155143
155242
|
// src/capture/assetDownloader.ts
|
|
155144
|
-
import { writeFileSync as writeFileSync34, mkdirSync as
|
|
155243
|
+
import { writeFileSync as writeFileSync34, mkdirSync as mkdirSync42 } from "fs";
|
|
155145
155244
|
import { join as join88, extname as extname15 } from "path";
|
|
155146
155245
|
import { createHash as createHash13 } from "crypto";
|
|
155147
155246
|
function svgContentHashSlug(svgSource, isLogo) {
|
|
@@ -155150,10 +155249,10 @@ function svgContentHashSlug(svgSource, isLogo) {
|
|
|
155150
155249
|
}
|
|
155151
155250
|
async function downloadAssets(tokens, outputDir, catalogedAssets, faviconLinks) {
|
|
155152
155251
|
const assetsDir = join88(outputDir, "assets");
|
|
155153
|
-
|
|
155252
|
+
mkdirSync42(assetsDir, { recursive: true });
|
|
155154
155253
|
const assets = [];
|
|
155155
155254
|
const downloadedUrls = /* @__PURE__ */ new Set();
|
|
155156
|
-
|
|
155255
|
+
mkdirSync42(join88(outputDir, "assets", "svgs"), { recursive: true });
|
|
155157
155256
|
const usedSvgNames = /* @__PURE__ */ new Set();
|
|
155158
155257
|
for (let i2 = 0; i2 < tokens.svgs.length && i2 < 30; i2++) {
|
|
155159
155258
|
const svg = tokens.svgs[i2];
|
|
@@ -155284,7 +155383,7 @@ function normalizeUrl(u) {
|
|
|
155284
155383
|
}
|
|
155285
155384
|
async function downloadAndRewriteFonts(css, outputDir) {
|
|
155286
155385
|
const assetsDir = join88(outputDir, "assets", "fonts");
|
|
155287
|
-
|
|
155386
|
+
mkdirSync42(assetsDir, { recursive: true });
|
|
155288
155387
|
const fontUrlRegex = /url\(['"]?(https?:\/\/[^'")\s]+\.(?:woff2?|ttf|otf)[^'")\s]*?)['"]?\)/g;
|
|
155289
155388
|
const fontUrls = /* @__PURE__ */ new Set();
|
|
155290
155389
|
let match;
|
|
@@ -155477,7 +155576,7 @@ __export(video_exports, {
|
|
|
155477
155576
|
runVideoMode: () => runVideoMode,
|
|
155478
155577
|
safeFilename: () => safeFilename
|
|
155479
155578
|
});
|
|
155480
|
-
import { createWriteStream as createWriteStream4, existsSync as existsSync83, mkdirSync as
|
|
155579
|
+
import { createWriteStream as createWriteStream4, existsSync as existsSync83, mkdirSync as mkdirSync43, readFileSync as readFileSync61, unlinkSync as unlinkSync9 } from "fs";
|
|
155481
155580
|
import { resolve as resolve53, join as join89, basename as basename19 } from "path";
|
|
155482
155581
|
async function streamToFile(url, destPath) {
|
|
155483
155582
|
const r2 = await safeFetch(url, {
|
|
@@ -155653,7 +155752,7 @@ async function runVideoMode(args) {
|
|
|
155653
155752
|
return;
|
|
155654
155753
|
}
|
|
155655
155754
|
const outDir = isW2hLayout ? join89(projectDir, "capture", "assets", "videos") : join89(projectDir, "assets", "videos");
|
|
155656
|
-
|
|
155755
|
+
mkdirSync43(outDir, { recursive: true });
|
|
155657
155756
|
const fname = safeFilename(entry.filename || basename19(entry.url));
|
|
155658
155757
|
const outPath = join89(outDir, fname);
|
|
155659
155758
|
const relPath = isW2hLayout ? `capture/assets/videos/${fname}` : `assets/videos/${fname}`;
|
|
@@ -156683,7 +156782,7 @@ var init_designStyleExtractor = __esm({
|
|
|
156683
156782
|
});
|
|
156684
156783
|
|
|
156685
156784
|
// src/capture/fontMetadataExtractor.ts
|
|
156686
|
-
import { readdirSync as
|
|
156785
|
+
import { readdirSync as readdirSync32, readFileSync as readFileSync62, writeFileSync as writeFileSync35, existsSync as existsSync84 } from "fs";
|
|
156687
156786
|
import { join as join90 } from "path";
|
|
156688
156787
|
import * as fontkit from "fontkit";
|
|
156689
156788
|
function isFontCollection(value) {
|
|
@@ -156693,7 +156792,7 @@ function extractFontMetadata(fontsDir, outputPath) {
|
|
|
156693
156792
|
const files = [];
|
|
156694
156793
|
const unidentified = [];
|
|
156695
156794
|
if (existsSync84(fontsDir)) {
|
|
156696
|
-
const fontFiles =
|
|
156795
|
+
const fontFiles = readdirSync32(fontsDir).filter((f3) => /\.(woff2?|ttf|otf)$/i.test(f3));
|
|
156697
156796
|
for (const filename of fontFiles) {
|
|
156698
156797
|
const fullPath = join90(fontsDir, filename);
|
|
156699
156798
|
const meta = readSingleFont(fullPath, filename);
|
|
@@ -156989,7 +157088,7 @@ var init_animationCataloger = __esm({
|
|
|
156989
157088
|
});
|
|
156990
157089
|
|
|
156991
157090
|
// src/capture/mediaCapture.ts
|
|
156992
|
-
import { mkdirSync as
|
|
157091
|
+
import { mkdirSync as mkdirSync44, writeFileSync as writeFileSync36, readdirSync as readdirSync33, readFileSync as readFileSync63, statSync as statSync26 } from "fs";
|
|
156993
157092
|
import { join as join91, extname as extname16 } from "path";
|
|
156994
157093
|
async function saveLottieAnimations(discoveredLotties, lottieDir) {
|
|
156995
157094
|
let savedCount = 0;
|
|
@@ -157051,15 +157150,15 @@ async function saveLottieAnimations(discoveredLotties, lottieDir) {
|
|
|
157051
157150
|
async function renderLottiePreviews(chromeBrowser, lottieDir, outputDir) {
|
|
157052
157151
|
const manifest = [];
|
|
157053
157152
|
const previewDir = join91(lottieDir, "previews");
|
|
157054
|
-
|
|
157055
|
-
for (const file of
|
|
157153
|
+
mkdirSync44(previewDir, { recursive: true });
|
|
157154
|
+
for (const file of readdirSync33(lottieDir)) {
|
|
157056
157155
|
if (!file.endsWith(".json")) continue;
|
|
157057
157156
|
try {
|
|
157058
157157
|
const raw = JSON.parse(readFileSync63(join91(lottieDir, file), "utf-8"));
|
|
157059
157158
|
const fr = raw.fr || 30;
|
|
157060
157159
|
const dur = ((raw.op || 0) - (raw.ip || 0)) / fr;
|
|
157061
157160
|
const previewName = file.replace(".json", "-preview.png");
|
|
157062
|
-
const fileSize =
|
|
157161
|
+
const fileSize = statSync26(join91(lottieDir, file)).size;
|
|
157063
157162
|
if (fileSize > 2e6) continue;
|
|
157064
157163
|
let previewPage;
|
|
157065
157164
|
try {
|
|
@@ -157215,9 +157314,9 @@ async function captureVideoManifest(page, outputDir, progress, opts) {
|
|
|
157215
157314
|
const merged = [...byKey.values()];
|
|
157216
157315
|
if (merged.length === 0) return;
|
|
157217
157316
|
const videoManifestDir = join91(outputDir, "assets", "videos");
|
|
157218
|
-
|
|
157317
|
+
mkdirSync44(videoManifestDir, { recursive: true });
|
|
157219
157318
|
const previewDir = join91(videoManifestDir, "previews");
|
|
157220
|
-
|
|
157319
|
+
mkdirSync44(previewDir, { recursive: true });
|
|
157221
157320
|
const videoManifest = [];
|
|
157222
157321
|
const dlStart = Date.now();
|
|
157223
157322
|
for (let vi = 0; vi < merged.length && vi < 20; vi++) {
|
|
@@ -157331,7 +157430,7 @@ var init_mediaCapture = __esm({
|
|
|
157331
157430
|
});
|
|
157332
157431
|
|
|
157333
157432
|
// src/capture/contentExtractor.ts
|
|
157334
|
-
import { existsSync as existsSync85, readdirSync as
|
|
157433
|
+
import { existsSync as existsSync85, readdirSync as readdirSync34, statSync as statSync27, readFileSync as readFileSync64 } from "fs";
|
|
157335
157434
|
import { basename as basename20, join as join92 } from "path";
|
|
157336
157435
|
async function detectLibraries(page, capturedShaders) {
|
|
157337
157436
|
let detectedLibraries = [];
|
|
@@ -157499,7 +157598,7 @@ async function captionImagesWithGemini(outputDir, progress, warnings) {
|
|
|
157499
157598
|
return response.text?.trim() || "";
|
|
157500
157599
|
};
|
|
157501
157600
|
}
|
|
157502
|
-
const imageFiles =
|
|
157601
|
+
const imageFiles = readdirSync34(join92(outputDir, "assets")).filter(
|
|
157503
157602
|
(f3) => /\.(png|jpg|jpeg|webp|gif)$/i.test(f3)
|
|
157504
157603
|
);
|
|
157505
157604
|
const BATCH_SIZE = 20;
|
|
@@ -157508,7 +157607,7 @@ async function captionImagesWithGemini(outputDir, progress, warnings) {
|
|
|
157508
157607
|
const results = await Promise.allSettled(
|
|
157509
157608
|
batch.map(async (file) => {
|
|
157510
157609
|
const filePath = join92(outputDir, "assets", file);
|
|
157511
|
-
const stat3 =
|
|
157610
|
+
const stat3 = statSync27(filePath);
|
|
157512
157611
|
if (stat3.size > 4e6) return { file, caption: "" };
|
|
157513
157612
|
const buffer = readFileSync64(filePath);
|
|
157514
157613
|
const base64 = buffer.toString("base64");
|
|
@@ -157542,12 +157641,12 @@ async function captionImagesWithGemini(outputDir, progress, warnings) {
|
|
|
157542
157641
|
);
|
|
157543
157642
|
const svgFiles = [];
|
|
157544
157643
|
const assetsDir = join92(outputDir, "assets");
|
|
157545
|
-
for (const f3 of
|
|
157644
|
+
for (const f3 of readdirSync34(assetsDir)) {
|
|
157546
157645
|
if (/\.svg$/i.test(f3)) svgFiles.push({ file: f3, relPath: f3 });
|
|
157547
157646
|
}
|
|
157548
157647
|
const svgsSubdir = join92(assetsDir, "svgs");
|
|
157549
157648
|
if (existsSync85(svgsSubdir)) {
|
|
157550
|
-
for (const f3 of
|
|
157649
|
+
for (const f3 of readdirSync34(svgsSubdir)) {
|
|
157551
157650
|
if (/\.svg$/i.test(f3)) svgFiles.push({ file: f3, relPath: `svgs/${f3}` });
|
|
157552
157651
|
}
|
|
157553
157652
|
}
|
|
@@ -157629,10 +157728,10 @@ function generateAssetDescriptions(outputDir, tokens, catalogedAssets, geminiCap
|
|
|
157629
157728
|
const fontLines = [];
|
|
157630
157729
|
const assetsPath = join92(outputDir, "assets");
|
|
157631
157730
|
try {
|
|
157632
|
-
for (const file of
|
|
157731
|
+
for (const file of readdirSync34(assetsPath)) {
|
|
157633
157732
|
if (file === "svgs" || file === "fonts" || file === "lottie" || file === "videos") continue;
|
|
157634
157733
|
const filePath = join92(assetsPath, file);
|
|
157635
|
-
const stat3 =
|
|
157734
|
+
const stat3 = statSync27(filePath);
|
|
157636
157735
|
if (!stat3.isFile()) continue;
|
|
157637
157736
|
const sizeKb = Math.round(stat3.size / 1024);
|
|
157638
157737
|
const catalogMatch = catalogedAssets.find(
|
|
@@ -157661,7 +157760,7 @@ function generateAssetDescriptions(outputDir, tokens, catalogedAssets, geminiCap
|
|
|
157661
157760
|
}
|
|
157662
157761
|
try {
|
|
157663
157762
|
const svgsPath = join92(assetsPath, "svgs");
|
|
157664
|
-
for (const file of
|
|
157763
|
+
for (const file of readdirSync34(svgsPath)) {
|
|
157665
157764
|
if (!file.endsWith(".svg")) continue;
|
|
157666
157765
|
const svgMatch = tokens.svgs.find(
|
|
157667
157766
|
(s2) => s2.label && file.includes(
|
|
@@ -157680,7 +157779,7 @@ function generateAssetDescriptions(outputDir, tokens, catalogedAssets, geminiCap
|
|
|
157680
157779
|
}
|
|
157681
157780
|
try {
|
|
157682
157781
|
const fontsPath = join92(assetsPath, "fonts");
|
|
157683
|
-
for (const file of
|
|
157782
|
+
for (const file of readdirSync34(fontsPath)) {
|
|
157684
157783
|
fontLines.push(`fonts/${file} \u2014 font file`);
|
|
157685
157784
|
}
|
|
157686
157785
|
} catch {
|
|
@@ -157713,7 +157812,7 @@ var agentPromptGenerator_exports = {};
|
|
|
157713
157812
|
__export(agentPromptGenerator_exports, {
|
|
157714
157813
|
generateAgentPrompt: () => generateAgentPrompt
|
|
157715
157814
|
});
|
|
157716
|
-
import { writeFileSync as writeFileSync37, readdirSync as
|
|
157815
|
+
import { writeFileSync as writeFileSync37, readdirSync as readdirSync35, existsSync as existsSync86 } from "fs";
|
|
157717
157816
|
import { join as join93 } from "path";
|
|
157718
157817
|
function inferColorRole(hex) {
|
|
157719
157818
|
const r2 = parseInt(hex.slice(1, 3), 16) / 255;
|
|
@@ -157749,7 +157848,7 @@ function buildPrompt(outputDir, url, tokens, hasScreenshot, hasLottie, hasShader
|
|
|
157749
157848
|
const baseName = baseFile.replace(/\.jpg$/, "");
|
|
157750
157849
|
const escapedBase = baseName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
157751
157850
|
const paginatedRe = new RegExp(`^${escapedBase}(?:-(\\d+))?\\.jpg$`);
|
|
157752
|
-
const all =
|
|
157851
|
+
const all = readdirSync35(fullDir).filter((f3) => paginatedRe.test(f3)).map((f3) => ({ name: f3, page: parseInt(f3.match(paginatedRe)?.[1] ?? "0", 10) })).sort((a, b2) => a.page - b2.page).map((entry) => entry.name);
|
|
157753
157852
|
if (all.length === 0) return [];
|
|
157754
157853
|
if (all.length === 1) {
|
|
157755
157854
|
return [`| \`${dir}/${all[0]}\` | ${label2} |`];
|
|
@@ -157913,11 +158012,11 @@ var screenshotCapture_exports = {};
|
|
|
157913
158012
|
__export(screenshotCapture_exports, {
|
|
157914
158013
|
captureScrollScreenshots: () => captureScrollScreenshots
|
|
157915
158014
|
});
|
|
157916
|
-
import { writeFileSync as writeFileSync39, mkdirSync as
|
|
158015
|
+
import { writeFileSync as writeFileSync39, mkdirSync as mkdirSync45 } from "fs";
|
|
157917
158016
|
import { join as join95 } from "path";
|
|
157918
158017
|
async function captureScrollScreenshots(page, outputDir) {
|
|
157919
158018
|
const screenshotsDir = join95(outputDir, "screenshots");
|
|
157920
|
-
|
|
158019
|
+
mkdirSync45(screenshotsDir, { recursive: true });
|
|
157921
158020
|
const MAX_SCREENSHOTS = 20;
|
|
157922
158021
|
const filePaths = [];
|
|
157923
158022
|
try {
|
|
@@ -158357,7 +158456,7 @@ var capture_exports = {};
|
|
|
158357
158456
|
__export(capture_exports, {
|
|
158358
158457
|
captureWebsite: () => captureWebsite
|
|
158359
158458
|
});
|
|
158360
|
-
import { mkdirSync as
|
|
158459
|
+
import { mkdirSync as mkdirSync46, writeFileSync as writeFileSync40, existsSync as existsSync88 } from "fs";
|
|
158361
158460
|
import { join as join96 } from "path";
|
|
158362
158461
|
async function captureWebsite(opts, onProgress) {
|
|
158363
158462
|
const {
|
|
@@ -158375,9 +158474,9 @@ async function captureWebsite(opts, onProgress) {
|
|
|
158375
158474
|
onProgress?.(stage, detail);
|
|
158376
158475
|
};
|
|
158377
158476
|
loadEnvFile(outputDir);
|
|
158378
|
-
|
|
158379
|
-
|
|
158380
|
-
|
|
158477
|
+
mkdirSync46(join96(outputDir, "extracted"), { recursive: true });
|
|
158478
|
+
mkdirSync46(join96(outputDir, "screenshots"), { recursive: true });
|
|
158479
|
+
mkdirSync46(join96(outputDir, "assets"), { recursive: true });
|
|
158381
158480
|
progress("browser", "Launching headless Chrome...");
|
|
158382
158481
|
const { ensureBrowser: ensureBrowser2 } = await Promise.resolve().then(() => (init_manager2(), manager_exports2));
|
|
158383
158482
|
const browser = await ensureBrowser2();
|
|
@@ -158538,7 +158637,7 @@ async function captureWebsite(opts, onProgress) {
|
|
|
158538
158637
|
}
|
|
158539
158638
|
if (discoveredLotties.length > 0) {
|
|
158540
158639
|
const lottieDir = join96(outputDir, "assets", "lottie");
|
|
158541
|
-
|
|
158640
|
+
mkdirSync46(lottieDir, { recursive: true });
|
|
158542
158641
|
const savedCount = await saveLottieAnimations(discoveredLotties, lottieDir);
|
|
158543
158642
|
if (savedCount > 0) {
|
|
158544
158643
|
await renderLottiePreviews(chromeBrowser, lottieDir, outputDir);
|
|
@@ -159041,8 +159140,8 @@ var init_capture2 = __esm({
|
|
|
159041
159140
|
} catch (err) {
|
|
159042
159141
|
const errMsg = err instanceof Error ? err.message : String(err);
|
|
159043
159142
|
try {
|
|
159044
|
-
const { mkdirSync:
|
|
159045
|
-
|
|
159143
|
+
const { mkdirSync: mkdirSync51, writeFileSync: writeFileSync43 } = await import("fs");
|
|
159144
|
+
mkdirSync51(outputDir, { recursive: true });
|
|
159046
159145
|
const isTimeout = /timeout|timed out/i.test(errMsg);
|
|
159047
159146
|
const reason = isTimeout ? "Page navigation timed out \u2014 the site may be blocking headless browsers or requires authentication." : `Capture failed: ${errMsg}`;
|
|
159048
159147
|
writeFileSync43(
|
|
@@ -159088,14 +159187,14 @@ __export(state_exports, {
|
|
|
159088
159187
|
stateFilePath: () => stateFilePath,
|
|
159089
159188
|
writeStackOutputs: () => writeStackOutputs
|
|
159090
159189
|
});
|
|
159091
|
-
import { existsSync as existsSync89, mkdirSync as
|
|
159092
|
-
import { dirname as
|
|
159190
|
+
import { existsSync as existsSync89, mkdirSync as mkdirSync47, readdirSync as readdirSync36, readFileSync as readFileSync66, rmSync as rmSync20, writeFileSync as writeFileSync41 } from "fs";
|
|
159191
|
+
import { dirname as dirname39, join as join97 } from "path";
|
|
159093
159192
|
function stateFilePath(stackName = DEFAULT_STACK_NAME, cwd = process.cwd()) {
|
|
159094
159193
|
return join97(cwd, STATE_DIR_NAME, `${STATE_FILE_PREFIX}${stackName}.json`);
|
|
159095
159194
|
}
|
|
159096
159195
|
function writeStackOutputs(outputs, cwd = process.cwd()) {
|
|
159097
159196
|
const path2 = stateFilePath(outputs.stackName, cwd);
|
|
159098
|
-
|
|
159197
|
+
mkdirSync47(dirname39(path2), { recursive: true });
|
|
159099
159198
|
writeFileSync41(path2, JSON.stringify(outputs, null, 2) + "\n");
|
|
159100
159199
|
return path2;
|
|
159101
159200
|
}
|
|
@@ -159110,12 +159209,12 @@ function readStackOutputs(stackName = DEFAULT_STACK_NAME, cwd = process.cwd()) {
|
|
|
159110
159209
|
}
|
|
159111
159210
|
function deleteStackOutputs(stackName = DEFAULT_STACK_NAME, cwd = process.cwd()) {
|
|
159112
159211
|
const path2 = stateFilePath(stackName, cwd);
|
|
159113
|
-
if (existsSync89(path2))
|
|
159212
|
+
if (existsSync89(path2)) rmSync20(path2);
|
|
159114
159213
|
}
|
|
159115
159214
|
function listStackNames(cwd = process.cwd()) {
|
|
159116
159215
|
const dir = join97(cwd, STATE_DIR_NAME);
|
|
159117
159216
|
if (!existsSync89(dir)) return [];
|
|
159118
|
-
return
|
|
159217
|
+
return readdirSync36(dir).filter((f3) => f3.startsWith(STATE_FILE_PREFIX) && f3.endsWith(".json")).map((f3) => f3.slice(STATE_FILE_PREFIX.length, -".json".length));
|
|
159119
159218
|
}
|
|
159120
159219
|
function requireStack(stackName, cwd = process.cwd()) {
|
|
159121
159220
|
const stack = readStackOutputs(stackName, cwd);
|
|
@@ -159262,19 +159361,19 @@ var init_sam = __esm({
|
|
|
159262
159361
|
|
|
159263
159362
|
// src/commands/lambda/repoRoot.ts
|
|
159264
159363
|
import { existsSync as existsSync91 } from "fs";
|
|
159265
|
-
import { dirname as
|
|
159364
|
+
import { dirname as dirname40, resolve as resolve56 } from "path";
|
|
159266
159365
|
import { fileURLToPath as fileURLToPath15 } from "url";
|
|
159267
159366
|
function repoRoot() {
|
|
159268
159367
|
const override = process.env.HYPERFRAMES_REPO_ROOT;
|
|
159269
159368
|
if (override && existsSync91(resolve56(override, "packages", "aws-lambda", "package.json"))) {
|
|
159270
159369
|
return override;
|
|
159271
159370
|
}
|
|
159272
|
-
let dir =
|
|
159371
|
+
let dir = dirname40(fileURLToPath15(import.meta.url));
|
|
159273
159372
|
for (let depth = 0; depth < 12; depth++) {
|
|
159274
159373
|
if (existsSync91(resolve56(dir, "packages", "aws-lambda", "package.json"))) {
|
|
159275
159374
|
return dir;
|
|
159276
159375
|
}
|
|
159277
|
-
const parent =
|
|
159376
|
+
const parent = dirname40(dir);
|
|
159278
159377
|
if (parent === dir) break;
|
|
159279
159378
|
dir = parent;
|
|
159280
159379
|
}
|
|
@@ -160649,17 +160748,17 @@ __export(cloudrun_exports, {
|
|
|
160649
160748
|
});
|
|
160650
160749
|
import { spawnSync as spawnSync6 } from "child_process";
|
|
160651
160750
|
import { createRequire as createRequire4 } from "module";
|
|
160652
|
-
import { existsSync as existsSync95, mkdirSync as
|
|
160653
|
-
import { homedir as
|
|
160654
|
-
import { dirname as
|
|
160751
|
+
import { existsSync as existsSync95, mkdirSync as mkdirSync48, readFileSync as readFileSync70, writeFileSync as writeFileSync42 } from "fs";
|
|
160752
|
+
import { homedir as homedir14 } from "os";
|
|
160753
|
+
import { dirname as dirname41, join as join103, resolve as resolve58 } from "path";
|
|
160655
160754
|
function stateDir() {
|
|
160656
|
-
return join103(
|
|
160755
|
+
return join103(homedir14(), ".hyperframes");
|
|
160657
160756
|
}
|
|
160658
160757
|
function statePath() {
|
|
160659
160758
|
return join103(stateDir(), "cloudrun-state.json");
|
|
160660
160759
|
}
|
|
160661
160760
|
function writeState(state) {
|
|
160662
|
-
|
|
160761
|
+
mkdirSync48(stateDir(), { recursive: true });
|
|
160663
160762
|
writeFileSync42(statePath(), JSON.stringify(state, null, 2));
|
|
160664
160763
|
}
|
|
160665
160764
|
function readState(args) {
|
|
@@ -160690,7 +160789,7 @@ function stripUndefined2(o) {
|
|
|
160690
160789
|
function terraformDir() {
|
|
160691
160790
|
const require3 = createRequire4(import.meta.url);
|
|
160692
160791
|
const pkgJson = require3.resolve("@hyperframes/gcp-cloud-run/package.json");
|
|
160693
|
-
return join103(
|
|
160792
|
+
return join103(dirname41(pkgJson), "terraform");
|
|
160694
160793
|
}
|
|
160695
160794
|
function run(cmd, cmdArgs, opts = {}) {
|
|
160696
160795
|
const res = spawnSync6(cmd, cmdArgs, { stdio: "inherit", cwd: opts.cwd });
|
|
@@ -160822,7 +160921,7 @@ function findRepoRoot(tfDir) {
|
|
|
160822
160921
|
}
|
|
160823
160922
|
function writeCloudBuildConfig(image) {
|
|
160824
160923
|
const cfgPath = join103(stateDir(), "cloudrun-cloudbuild.yaml");
|
|
160825
|
-
|
|
160924
|
+
mkdirSync48(stateDir(), { recursive: true });
|
|
160826
160925
|
writeFileSync42(
|
|
160827
160926
|
cfgPath,
|
|
160828
160927
|
[
|
|
@@ -161451,8 +161550,8 @@ var init_poll = __esm({
|
|
|
161451
161550
|
});
|
|
161452
161551
|
|
|
161453
161552
|
// src/cloud/download.ts
|
|
161454
|
-
import { createWriteStream as createWriteStream5, mkdirSync as
|
|
161455
|
-
import { dirname as
|
|
161553
|
+
import { createWriteStream as createWriteStream5, mkdirSync as mkdirSync49, unlinkSync as unlinkSync10 } from "fs";
|
|
161554
|
+
import { dirname as dirname42 } from "path";
|
|
161456
161555
|
async function downloadToFile(url, destPath, options = {}) {
|
|
161457
161556
|
const fetchImpl = options.fetchImpl ?? fetch;
|
|
161458
161557
|
const res = await fetchImpl(url, { signal: options.signal });
|
|
@@ -161462,7 +161561,7 @@ async function downloadToFile(url, destPath, options = {}) {
|
|
|
161462
161561
|
if (!res.body) {
|
|
161463
161562
|
throw new Error(`Failed to download ${url}: empty response body`);
|
|
161464
161563
|
}
|
|
161465
|
-
|
|
161564
|
+
mkdirSync49(dirname42(destPath), { recursive: true });
|
|
161466
161565
|
const totalHeader = res.headers.get("content-length");
|
|
161467
161566
|
const total = totalHeader ? Number.parseInt(totalHeader, 10) : void 0;
|
|
161468
161567
|
const totalOpt = total !== void 0 && Number.isFinite(total) ? total : void 0;
|
|
@@ -162091,12 +162190,12 @@ var init_browser2 = __esm({
|
|
|
162091
162190
|
});
|
|
162092
162191
|
|
|
162093
162192
|
// src/auth/paths.ts
|
|
162094
|
-
import { homedir as
|
|
162193
|
+
import { homedir as homedir15 } from "os";
|
|
162095
162194
|
import { join as join104 } from "path";
|
|
162096
162195
|
function configDir() {
|
|
162097
162196
|
const override = process.env["HEYGEN_CONFIG_DIR"];
|
|
162098
162197
|
if (override && override.length > 0) return override;
|
|
162099
|
-
return join104(
|
|
162198
|
+
return join104(homedir15(), ".heygen");
|
|
162100
162199
|
}
|
|
162101
162200
|
function credentialPath() {
|
|
162102
162201
|
return join104(configDir(), CREDENTIAL_FILENAME);
|
|
@@ -162111,7 +162210,7 @@ var init_paths2 = __esm({
|
|
|
162111
162210
|
|
|
162112
162211
|
// src/auth/store.ts
|
|
162113
162212
|
import { promises as fs4 } from "fs";
|
|
162114
|
-
import { dirname as
|
|
162213
|
+
import { dirname as dirname43 } from "path";
|
|
162115
162214
|
async function readStore(path2 = credentialPath()) {
|
|
162116
162215
|
let raw;
|
|
162117
162216
|
try {
|
|
@@ -162133,7 +162232,7 @@ async function readStore(path2 = credentialPath()) {
|
|
|
162133
162232
|
throw ErrInvalidStore("file is not JSON and does not look like a plain API key");
|
|
162134
162233
|
}
|
|
162135
162234
|
async function writeStore(credentials, path2 = credentialPath()) {
|
|
162136
|
-
await ensureDir2(
|
|
162235
|
+
await ensureDir2(dirname43(path2));
|
|
162137
162236
|
const body = JSON.stringify(serializeCredentials(credentials), null, 2);
|
|
162138
162237
|
const tmp = `${path2}.${process.pid}.${Date.now()}.tmp`;
|
|
162139
162238
|
await fs4.writeFile(tmp, `${body}
|
|
@@ -162890,7 +162989,7 @@ __export(render_exports3, {
|
|
|
162890
162989
|
resolveAspectRatioForSubmit: () => resolveAspectRatioForSubmit,
|
|
162891
162990
|
validateResolutionFormatCombo: () => validateResolutionFormatCombo
|
|
162892
162991
|
});
|
|
162893
|
-
import { isAbsolute as
|
|
162992
|
+
import { isAbsolute as isAbsolute15, resolve as resolvePath4 } from "path";
|
|
162894
162993
|
import { existsSync as existsSync96 } from "fs";
|
|
162895
162994
|
function parsePollIntervalMs(raw) {
|
|
162896
162995
|
const n2 = parseNumericFlag(raw, { flag: "--poll-interval", min: 1 });
|
|
@@ -163132,7 +163231,7 @@ function handleFailedRender(detail, asJson) {
|
|
|
163132
163231
|
}
|
|
163133
163232
|
function resolveOutputPath2(output, renderId, format) {
|
|
163134
163233
|
if (output) {
|
|
163135
|
-
return
|
|
163234
|
+
return isAbsolute15(output) ? output : resolvePath4(process.cwd(), output);
|
|
163136
163235
|
}
|
|
163137
163236
|
const ext = FORMAT_EXT2[format] ?? `.${format}`;
|
|
163138
163237
|
return resolvePath4(process.cwd(), "renders", `${renderId}${ext}`);
|
|
@@ -164613,8 +164712,8 @@ __export(autoUpdate_exports, {
|
|
|
164613
164712
|
scheduleBackgroundInstall: () => scheduleBackgroundInstall
|
|
164614
164713
|
});
|
|
164615
164714
|
import { spawn as spawn17 } from "child_process";
|
|
164616
|
-
import { appendFileSync as appendFileSync2, mkdirSync as
|
|
164617
|
-
import { homedir as
|
|
164715
|
+
import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync50, openSync as openSync3 } from "fs";
|
|
164716
|
+
import { homedir as homedir16 } from "os";
|
|
164618
164717
|
import { join as join105 } from "path";
|
|
164619
164718
|
import { compareVersions as compareVersions3 } from "compare-versions";
|
|
164620
164719
|
function isAutoInstallDisabled() {
|
|
@@ -164630,14 +164729,14 @@ function majorOf(version2) {
|
|
|
164630
164729
|
}
|
|
164631
164730
|
function log(line) {
|
|
164632
164731
|
try {
|
|
164633
|
-
|
|
164732
|
+
mkdirSync50(CONFIG_DIR2, { recursive: true, mode: 448 });
|
|
164634
164733
|
appendFileSync2(LOG_FILE, `${(/* @__PURE__ */ new Date()).toISOString()} ${line}
|
|
164635
164734
|
`, { mode: 384 });
|
|
164636
164735
|
} catch {
|
|
164637
164736
|
}
|
|
164638
164737
|
}
|
|
164639
164738
|
function launchDetachedInstall(installCommand, version2) {
|
|
164640
|
-
|
|
164739
|
+
mkdirSync50(CONFIG_DIR2, { recursive: true, mode: 448 });
|
|
164641
164740
|
const configFile = join105(CONFIG_DIR2, "config.json");
|
|
164642
164741
|
const nodeScript = `
|
|
164643
164742
|
const { exec } = require("node:child_process");
|
|
@@ -164757,7 +164856,7 @@ var init_autoUpdate = __esm({
|
|
|
164757
164856
|
init_config();
|
|
164758
164857
|
init_env();
|
|
164759
164858
|
init_installerDetection();
|
|
164760
|
-
CONFIG_DIR2 = join105(
|
|
164859
|
+
CONFIG_DIR2 = join105(homedir16(), ".hyperframes");
|
|
164761
164860
|
LOG_FILE = join105(CONFIG_DIR2, "auto-update.log");
|
|
164762
164861
|
PENDING_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
164763
164862
|
}
|
|
@@ -165001,7 +165100,7 @@ var init_help = __esm({
|
|
|
165001
165100
|
// src/cli.ts
|
|
165002
165101
|
init_version();
|
|
165003
165102
|
init_dist();
|
|
165004
|
-
import { dirname as
|
|
165103
|
+
import { dirname as dirname44, join as join106 } from "path";
|
|
165005
165104
|
import { fileURLToPath as fileURLToPath16 } from "url";
|
|
165006
165105
|
import { existsSync as existsSync97 } from "fs";
|
|
165007
165106
|
|
|
@@ -165045,7 +165144,7 @@ for (const stream of [process.stdout, process.stderr]) {
|
|
|
165045
165144
|
});
|
|
165046
165145
|
}
|
|
165047
165146
|
(() => {
|
|
165048
|
-
const here =
|
|
165147
|
+
const here = dirname44(fileURLToPath16(import.meta.url));
|
|
165049
165148
|
const shader = join106(here, "shaderTransitionWorker.js");
|
|
165050
165149
|
if (!process.env.HF_SHADER_WORKER_ENTRY && existsSync97(shader)) {
|
|
165051
165150
|
process.env.HF_SHADER_WORKER_ENTRY = shader;
|