hyperframes 0.7.12 → 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 +631 -515
- package/dist/skills/hyperframes/SKILL.md +1 -1
- package/dist/skills/hyperframes-cli/SKILL.md +1 -1
- package/dist/studio/assets/{index-D3CdlGSD.js → index-BXG-pbr_.js} +2 -2
- package/dist/studio/assets/{index-6Gsr598X.js → index-CkrVt5DX.js} +1 -1
- package/dist/studio/assets/{index-C8PxbQ6Q.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;
|
|
@@ -25406,7 +25406,23 @@ function findLeakedTextInHead(rawSource) {
|
|
|
25406
25406
|
}
|
|
25407
25407
|
return null;
|
|
25408
25408
|
}
|
|
25409
|
-
|
|
25409
|
+
function findLeakedTextBetweenHeadAndBody(rawSource) {
|
|
25410
|
+
const boundaryMatches = [...rawSource.matchAll(AFTER_HEAD_BEFORE_BODY_PATTERN)];
|
|
25411
|
+
for (const match of boundaryMatches) {
|
|
25412
|
+
const leakedText = findLeakedTextInHeadContent(match[1] ?? "");
|
|
25413
|
+
if (leakedText) return leakedText;
|
|
25414
|
+
}
|
|
25415
|
+
return null;
|
|
25416
|
+
}
|
|
25417
|
+
function findLeakedTextBeforeCompositionRoot(source, rootTag) {
|
|
25418
|
+
if (!rootTag || rootTag.name === "body") return null;
|
|
25419
|
+
const bodyOpenMatch = /<body\b[^>]*>/i.exec(source);
|
|
25420
|
+
const prefixStart = bodyOpenMatch ? bodyOpenMatch.index + bodyOpenMatch[0].length : 0;
|
|
25421
|
+
const prefixEnd = rootTag.index;
|
|
25422
|
+
if (prefixEnd <= prefixStart) return null;
|
|
25423
|
+
return findLeakedTextInHeadContent(source.slice(prefixStart, prefixEnd));
|
|
25424
|
+
}
|
|
25425
|
+
var HEAD_BLOCKS_TO_IGNORE_PATTERN, HTML_TAG_PATTERN, HEAD_CONTENT_PATTERN, AFTER_HEAD_BEFORE_BODY_PATTERN, STRAY_HEAD_CLOSE_PATTERN, MARKDOWN_CODE_FENCE_PATTERN, ORPHAN_CSS_AT_RULE_PATTERN, ORPHAN_CSS_RULE_PATTERN, coreRules;
|
|
25410
25426
|
var init_core = __esm({
|
|
25411
25427
|
"../core/src/lint/rules/core.ts"() {
|
|
25412
25428
|
"use strict";
|
|
@@ -25414,6 +25430,7 @@ var init_core = __esm({
|
|
|
25414
25430
|
HEAD_BLOCKS_TO_IGNORE_PATTERN = /<(?:style|script|template|title|noscript)\b[^>]*>[\s\S]*?<\/(?:style|script|template|title|noscript)(?:\s[^>]*)?>/gi;
|
|
25415
25431
|
HTML_TAG_PATTERN = /<[^>]+>/g;
|
|
25416
25432
|
HEAD_CONTENT_PATTERN = /<head\b[^>]*>([\s\S]*?)(?:<\/head>|<body\b|$)/gi;
|
|
25433
|
+
AFTER_HEAD_BEFORE_BODY_PATTERN = /<\/head(?:\s[^>]*)?>([\s\S]*?)(?=<body\b|$)/gi;
|
|
25417
25434
|
STRAY_HEAD_CLOSE_PATTERN = /<\/(?:style|script)(?:\s[^>]*)?>/i;
|
|
25418
25435
|
MARKDOWN_CODE_FENCE_PATTERN = /```[^\r\n`]*(?:\r?\n|$)[\s\S]*?```/i;
|
|
25419
25436
|
ORPHAN_CSS_AT_RULE_PATTERN = /(?:^|\s)@(?:container|font-face|keyframes|layer|media|page|property|scope|supports)[^{<]*\{[\s\S]*?:[\s\S]*?\}/i;
|
|
@@ -25445,15 +25462,15 @@ var init_core = __esm({
|
|
|
25445
25462
|
return findings;
|
|
25446
25463
|
},
|
|
25447
25464
|
// head_leaked_text
|
|
25448
|
-
({ source }) => {
|
|
25449
|
-
const snippet = findLeakedTextInHead(source);
|
|
25465
|
+
({ source, rootTag }) => {
|
|
25466
|
+
const snippet = findLeakedTextInHead(source) ?? findLeakedTextBetweenHeadAndBody(source) ?? findLeakedTextBeforeCompositionRoot(source, rootTag);
|
|
25450
25467
|
if (!snippet) return [];
|
|
25451
25468
|
return [
|
|
25452
25469
|
{
|
|
25453
25470
|
code: "head_leaked_text",
|
|
25454
25471
|
severity: "error",
|
|
25455
|
-
message: "Detected leaked code or CSS text
|
|
25456
|
-
fixHint: "Move CSS into a single `<style>...</style>` block and remove stray close tags, markdown fences, or code text from `<head
|
|
25472
|
+
message: "Detected leaked code or CSS text around the document `<head>` or before the composition root. Browsers render this as visible text in the video.",
|
|
25473
|
+
fixHint: "Move CSS into a single `<style>...</style>` block and remove stray close tags, markdown fences, or code text from `<head>`, the `</head>`/`<body>` boundary, or the pre-root body prefix.",
|
|
25457
25474
|
snippet: truncateSnippet(snippet)
|
|
25458
25475
|
}
|
|
25459
25476
|
];
|
|
@@ -46412,6 +46429,7 @@ __export(skillsManifest_exports, {
|
|
|
46412
46429
|
checkSkills: () => checkSkills,
|
|
46413
46430
|
diffSkills: () => diffSkills,
|
|
46414
46431
|
hashSkillBundle: () => hashSkillBundle,
|
|
46432
|
+
hyperframesSkillNames: () => hyperframesSkillNames,
|
|
46415
46433
|
skillsAttributedToSource: () => skillsAttributedToSource
|
|
46416
46434
|
});
|
|
46417
46435
|
import { execFile } from "child_process";
|
|
@@ -46508,8 +46526,8 @@ function locateInstall(skillNames, opts = {}) {
|
|
|
46508
46526
|
} : null;
|
|
46509
46527
|
}
|
|
46510
46528
|
const roots = [
|
|
46511
|
-
...discoverSkillRoots(opts.
|
|
46512
|
-
...discoverSkillRoots(opts.
|
|
46529
|
+
...discoverSkillRoots(opts.home ?? homedir6(), "global"),
|
|
46530
|
+
...discoverSkillRoots(opts.cwd ?? process.cwd(), "project")
|
|
46513
46531
|
];
|
|
46514
46532
|
for (const root of roots) {
|
|
46515
46533
|
if (skillNames.some((n2) => existsSync21(join20(root.dir, n2, "SKILL.md")))) return root;
|
|
@@ -46573,6 +46591,10 @@ function readSkillLock(path2) {
|
|
|
46573
46591
|
return null;
|
|
46574
46592
|
}
|
|
46575
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
|
+
}
|
|
46576
46598
|
function detectRemoved(root, latest, opts) {
|
|
46577
46599
|
const lock = readSkillLock(lockPathForScope(root.scope, opts));
|
|
46578
46600
|
const removed = skillsAttributedToSource(lock, latest.source).filter((name) => !(name in latest.skills)).sort().map((name) => ({ name, status: "removed" }));
|
|
@@ -46699,83 +46721,152 @@ var init_skillsManifest = __esm({
|
|
|
46699
46721
|
}
|
|
46700
46722
|
});
|
|
46701
46723
|
|
|
46702
|
-
// src/utils/
|
|
46703
|
-
|
|
46704
|
-
|
|
46705
|
-
|
|
46706
|
-
|
|
46707
|
-
|
|
46708
|
-
|
|
46709
|
-
|
|
46710
|
-
|
|
46711
|
-
}
|
|
46712
|
-
|
|
46713
|
-
|
|
46714
|
-
|
|
46715
|
-
|
|
46716
|
-
|
|
46717
|
-
|
|
46718
|
-
|
|
46719
|
-
|
|
46720
|
-
}
|
|
46721
|
-
|
|
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
|
+
];
|
|
46722
46801
|
}
|
|
46723
|
-
|
|
46724
|
-
|
|
46725
|
-
|
|
46726
|
-
|
|
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
|
+
};
|
|
46727
46819
|
}
|
|
46728
|
-
function
|
|
46729
|
-
|
|
46730
|
-
|
|
46731
|
-
|
|
46732
|
-
}
|
|
46733
|
-
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);
|
|
46734
46824
|
}
|
|
46735
|
-
function
|
|
46736
|
-
|
|
46737
|
-
|
|
46738
|
-
|
|
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);
|
|
46739
46831
|
}
|
|
46740
|
-
return keysForDirs(dirs);
|
|
46741
46832
|
}
|
|
46742
|
-
function
|
|
46743
|
-
|
|
46744
|
-
|
|
46745
|
-
|
|
46746
|
-
|
|
46747
|
-
if (input2.env["CLAUDECODE"]) {
|
|
46748
|
-
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;
|
|
46749
46838
|
}
|
|
46750
|
-
const
|
|
46751
|
-
|
|
46752
|
-
|
|
46839
|
+
for (const skill of skills) {
|
|
46840
|
+
try {
|
|
46841
|
+
linkOrCopy(join21(source, skill), join21(targetDir, skill), platform10);
|
|
46842
|
+
} catch {
|
|
46843
|
+
}
|
|
46753
46844
|
}
|
|
46754
|
-
return
|
|
46845
|
+
return true;
|
|
46755
46846
|
}
|
|
46756
|
-
function
|
|
46757
|
-
|
|
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 };
|
|
46758
46865
|
}
|
|
46759
|
-
var
|
|
46760
|
-
|
|
46761
|
-
"src/utils/skillsTargets.ts"() {
|
|
46866
|
+
var init_skillsMirror = __esm({
|
|
46867
|
+
"src/utils/skillsMirror.ts"() {
|
|
46762
46868
|
"use strict";
|
|
46763
|
-
|
|
46764
|
-
".claude": "claude-code",
|
|
46765
|
-
".agents": "universal",
|
|
46766
|
-
".hermes": "hermes-agent",
|
|
46767
|
-
".factory": "droid",
|
|
46768
|
-
".kiro": "kiro-cli"
|
|
46769
|
-
};
|
|
46770
|
-
DETECTABLE = [
|
|
46771
|
-
{ bin: "claude", dir: ".claude" },
|
|
46772
|
-
{ bin: "hermes", dir: ".hermes" },
|
|
46773
|
-
{ bin: "droid", dir: ".factory" },
|
|
46774
|
-
{ bin: "cursor", dir: ".agents" },
|
|
46775
|
-
{ bin: "codex", dir: ".agents" },
|
|
46776
|
-
{ bin: "opencode", dir: ".agents" },
|
|
46777
|
-
{ bin: "gemini", dir: ".agents" }
|
|
46778
|
-
];
|
|
46869
|
+
init_agentDirs_generated();
|
|
46779
46870
|
}
|
|
46780
46871
|
});
|
|
46781
46872
|
|
|
@@ -46801,15 +46892,25 @@ function spawnNpx(args, opts = {}) {
|
|
|
46801
46892
|
return new Promise((resolve59, reject) => {
|
|
46802
46893
|
const child = spawn7(npx.command, npx.args, {
|
|
46803
46894
|
stdio: "inherit",
|
|
46804
|
-
|
|
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,
|
|
46805
46899
|
cwd: opts.cwd,
|
|
46806
|
-
|
|
46807
|
-
|
|
46808
|
-
|
|
46809
|
-
|
|
46810
|
-
|
|
46811
|
-
|
|
46812
|
-
|
|
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
|
+
}
|
|
46813
46914
|
});
|
|
46814
46915
|
child.on("close", (code, signal) => {
|
|
46815
46916
|
if (code === 0) resolve59();
|
|
@@ -46820,18 +46921,7 @@ function spawnNpx(args, opts = {}) {
|
|
|
46820
46921
|
});
|
|
46821
46922
|
}
|
|
46822
46923
|
function runSkillsAdd(source, opts = {}) {
|
|
46823
|
-
|
|
46824
|
-
if (!extraArgs) {
|
|
46825
|
-
const targets = resolveAgentTargets({
|
|
46826
|
-
cwd: opts.cwd ?? process.cwd(),
|
|
46827
|
-
env: process.env,
|
|
46828
|
-
pathStr: process.env["PATH"] ?? "",
|
|
46829
|
-
platform: process.platform
|
|
46830
|
-
});
|
|
46831
|
-
console.log(c.dim(`Installing to: ${targets.agents.join(", ")} \u2014 ${targets.reason}`));
|
|
46832
|
-
extraArgs = buildSkillsAddArgs(targets.agents);
|
|
46833
|
-
}
|
|
46834
|
-
return spawnNpx(["skills", "add", source, ...extraArgs, "--copy"], opts);
|
|
46924
|
+
return spawnNpx(["skills", "add", source, ...opts.extraArgs ?? GLOBAL_INSTALL_ARGS], opts);
|
|
46835
46925
|
}
|
|
46836
46926
|
function runSkillsRemove(names, opts) {
|
|
46837
46927
|
const safe = names.filter((n2) => PLAIN_SKILL_NAME.test(n2));
|
|
@@ -46842,6 +46932,20 @@ function runSkillsRemove(names, opts) {
|
|
|
46842
46932
|
if (!safe.length) return Promise.resolve();
|
|
46843
46933
|
return spawnNpx(["skills", "remove", ...safe, ...opts.global ? ["-g"] : [], "--yes"]);
|
|
46844
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
|
+
}
|
|
46845
46949
|
async function installAllSkills(opts = {}) {
|
|
46846
46950
|
if (!hasNpx()) {
|
|
46847
46951
|
const msg = "npx not found. Install Node.js and retry.";
|
|
@@ -46860,6 +46964,7 @@ async function installAllSkills(opts = {}) {
|
|
|
46860
46964
|
console.log(c.dim(`${source.name} skills skipped`));
|
|
46861
46965
|
}
|
|
46862
46966
|
}
|
|
46967
|
+
mirrorToInstalledAgents();
|
|
46863
46968
|
}
|
|
46864
46969
|
function printSkillSection(result, status, title, mark, color) {
|
|
46865
46970
|
const items = result.skills.filter((s2) => s2.status === status);
|
|
@@ -46912,7 +47017,7 @@ function renderCheck(result) {
|
|
|
46912
47017
|
}
|
|
46913
47018
|
console.log();
|
|
46914
47019
|
}
|
|
46915
|
-
var examples, PLAIN_SKILL_NAME, SOURCES, checkCommand, updateCommand, skills_default;
|
|
47020
|
+
var examples, GLOBAL_INSTALL_ARGS, PLAIN_SKILL_NAME, SOURCES, checkCommand, updateCommand, skills_default;
|
|
46916
47021
|
var init_skills = __esm({
|
|
46917
47022
|
"src/commands/skills.ts"() {
|
|
46918
47023
|
"use strict";
|
|
@@ -46922,13 +47027,24 @@ var init_skills = __esm({
|
|
|
46922
47027
|
init_npxCommand();
|
|
46923
47028
|
init_updateCheck();
|
|
46924
47029
|
init_skillsManifest();
|
|
46925
|
-
|
|
47030
|
+
init_skillsMirror();
|
|
46926
47031
|
examples = [
|
|
46927
47032
|
["Install all HyperFrames skills", "hyperframes skills"],
|
|
46928
47033
|
["Check whether installed skills are up to date", "hyperframes skills check"],
|
|
46929
47034
|
["Check, machine-readable (for agents / CI)", "hyperframes skills check --json"],
|
|
46930
47035
|
["Update all skills to the latest (installs any missing)", "hyperframes skills update"]
|
|
46931
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
|
+
];
|
|
46932
47048
|
PLAIN_SKILL_NAME = /^[a-z0-9][a-z0-9._-]*$/i;
|
|
46933
47049
|
SOURCES = [{ name: "HyperFrames", url: "https://github.com/heygen-com/hyperframes" }];
|
|
46934
47050
|
checkCommand = defineCommand({
|
|
@@ -47019,7 +47135,7 @@ __export(transcribe_exports, {
|
|
|
47019
47135
|
transcribe: () => transcribe
|
|
47020
47136
|
});
|
|
47021
47137
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
47022
|
-
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";
|
|
47023
47139
|
import { join as join22, extname as extname6 } from "path";
|
|
47024
47140
|
import { tmpdir } from "os";
|
|
47025
47141
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
@@ -47192,7 +47308,7 @@ async function transcribe(inputPath, outputDir, options) {
|
|
|
47192
47308
|
}
|
|
47193
47309
|
options?.onProgress?.("Transcribing...");
|
|
47194
47310
|
const outputBase = join22(outputDir, "transcript");
|
|
47195
|
-
|
|
47311
|
+
mkdirSync13(outputDir, { recursive: true });
|
|
47196
47312
|
const whisperArgs = [
|
|
47197
47313
|
"--model",
|
|
47198
47314
|
effectiveModelPath,
|
|
@@ -47314,8 +47430,8 @@ var init_lint = __esm({
|
|
|
47314
47430
|
});
|
|
47315
47431
|
|
|
47316
47432
|
// src/utils/lintProject.ts
|
|
47317
|
-
import { existsSync as existsSync24, readFileSync as readFileSync16, readdirSync as
|
|
47318
|
-
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";
|
|
47319
47435
|
function readHtmlAttr(tag, name) {
|
|
47320
47436
|
const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
47321
47437
|
const match = tag.match(new RegExp(`\\b${escaped}\\s*=\\s*(?:"([^"]*)"|'([^']*)')`, "i"));
|
|
@@ -47334,7 +47450,7 @@ function collectExternalStyles(projectDir, html, compSrcPath) {
|
|
|
47334
47450
|
if (!rel.split(/\s+/).some((part) => part.toLowerCase() === "stylesheet")) continue;
|
|
47335
47451
|
const href = tag.match(/\bhref\s*=\s*["']([^"']+)["']/i)?.[1] ?? "";
|
|
47336
47452
|
if (!isLocalStylesheetHref(href)) continue;
|
|
47337
|
-
const rootRelative = compSrcPath ? join23(
|
|
47453
|
+
const rootRelative = compSrcPath ? join23(dirname10(compSrcPath), href) : href;
|
|
47338
47454
|
const stylesheet = resolveExistingLocalAsset(projectDir, rootRelative);
|
|
47339
47455
|
if (!stylesheet) continue;
|
|
47340
47456
|
styles.push({ href, content: readFileSync16(stylesheet.resolved, "utf-8") });
|
|
@@ -47356,7 +47472,7 @@ function collectCssSources(projectDir, html, compSrcPath) {
|
|
|
47356
47472
|
if (!rel.split(/\s+/).some((part) => part.toLowerCase() === "stylesheet")) continue;
|
|
47357
47473
|
const href = readHtmlAttr(tag, "href") ?? "";
|
|
47358
47474
|
if (!isLocalStylesheetHref(href)) continue;
|
|
47359
|
-
const rootRelativePath = compSrcPath ? join23(
|
|
47475
|
+
const rootRelativePath = compSrcPath ? join23(dirname10(compSrcPath), href) : href;
|
|
47360
47476
|
const stylesheet = resolveExistingLocalAsset(projectDir, rootRelativePath);
|
|
47361
47477
|
if (!stylesheet) continue;
|
|
47362
47478
|
sources.push({
|
|
@@ -47382,8 +47498,8 @@ function cleanAssetUrl(url) {
|
|
|
47382
47498
|
}
|
|
47383
47499
|
function isWithinProjectRoot(projectDir, candidate) {
|
|
47384
47500
|
const projectRoot = resolve13(projectDir);
|
|
47385
|
-
const relativePath =
|
|
47386
|
-
return relativePath === "" || !relativePath.startsWith("..") && !
|
|
47501
|
+
const relativePath = relative6(projectRoot, candidate);
|
|
47502
|
+
return relativePath === "" || !relativePath.startsWith("..") && !isAbsolute8(relativePath);
|
|
47387
47503
|
}
|
|
47388
47504
|
function addCandidate(candidates, candidate) {
|
|
47389
47505
|
if (!candidates.includes(candidate)) candidates.push(candidate);
|
|
@@ -47411,12 +47527,12 @@ function resolveExistingLocalAsset(projectDir, url) {
|
|
|
47411
47527
|
const projectRoot = resolve13(projectDir);
|
|
47412
47528
|
const resolved = resolveLocalAssetCandidates(projectRoot, url).find(existsSync24);
|
|
47413
47529
|
if (!resolved) return null;
|
|
47414
|
-
return { resolved, rootRelativePath:
|
|
47530
|
+
return { resolved, rootRelativePath: relative6(projectRoot, resolved) };
|
|
47415
47531
|
}
|
|
47416
47532
|
function resolveCssAssetCandidates(projectDir, url, htmlCompSrcPath, cssRootRelativePath) {
|
|
47417
47533
|
if (url.startsWith("/")) return resolveLocalAssetCandidates(projectDir, url);
|
|
47418
47534
|
if (cssRootRelativePath) {
|
|
47419
|
-
return resolveLocalAssetCandidates(projectDir, join23(
|
|
47535
|
+
return resolveLocalAssetCandidates(projectDir, join23(dirname10(cssRootRelativePath), url));
|
|
47420
47536
|
}
|
|
47421
47537
|
if (htmlCompSrcPath) {
|
|
47422
47538
|
return resolveLocalAssetCandidates(projectDir, rewriteAssetPath(htmlCompSrcPath, url));
|
|
@@ -47442,7 +47558,7 @@ async function lintProject(project) {
|
|
|
47442
47558
|
if (existsSync24(compositionsDir)) {
|
|
47443
47559
|
const collectHtmlFiles = (dir, rel) => {
|
|
47444
47560
|
const out = [];
|
|
47445
|
-
for (const entry of
|
|
47561
|
+
for (const entry of readdirSync10(dir, { withFileTypes: true })) {
|
|
47446
47562
|
const relPath = rel ? `${rel}/${entry.name}` : entry.name;
|
|
47447
47563
|
if (entry.isDirectory()) out.push(...collectHtmlFiles(join23(dir, entry.name), relPath));
|
|
47448
47564
|
else if (entry.isFile() && entry.name.endsWith(".html")) out.push(relPath);
|
|
@@ -47496,7 +47612,7 @@ function lintProjectAudioFiles(projectDir, htmlSources) {
|
|
|
47496
47612
|
const findings = [];
|
|
47497
47613
|
let audioFiles;
|
|
47498
47614
|
try {
|
|
47499
|
-
audioFiles =
|
|
47615
|
+
audioFiles = readdirSync10(projectDir).filter(
|
|
47500
47616
|
(f3) => AUDIO_EXTENSIONS2.has(extname7(f3).toLowerCase())
|
|
47501
47617
|
);
|
|
47502
47618
|
} catch {
|
|
@@ -47624,7 +47740,7 @@ function lintTextureMaskAssetNotFound(projectDir, htmlSources) {
|
|
|
47624
47740
|
function lintMultipleRootCompositions(projectDir) {
|
|
47625
47741
|
const findings = [];
|
|
47626
47742
|
try {
|
|
47627
|
-
const rootHtmlFiles =
|
|
47743
|
+
const rootHtmlFiles = readdirSync10(projectDir).filter((f3) => f3.endsWith(".html"));
|
|
47628
47744
|
const rootCompositions = [];
|
|
47629
47745
|
for (const file of rootHtmlFiles) {
|
|
47630
47746
|
if (file === "caption-skin.html") continue;
|
|
@@ -48128,7 +48244,7 @@ var init_format = __esm({
|
|
|
48128
48244
|
});
|
|
48129
48245
|
|
|
48130
48246
|
// src/utils/project.ts
|
|
48131
|
-
import { existsSync as existsSync25, statSync as
|
|
48247
|
+
import { existsSync as existsSync25, statSync as statSync7 } from "fs";
|
|
48132
48248
|
import { resolve as resolve15, basename as basename2 } from "path";
|
|
48133
48249
|
function resolveProjectOrThrow(dirArg) {
|
|
48134
48250
|
const trimmed = dirArg?.trim();
|
|
@@ -48142,7 +48258,7 @@ function resolveProjectOrThrow(dirArg) {
|
|
|
48142
48258
|
const dir = resolve15(dirArg ?? ".");
|
|
48143
48259
|
const name = basename2(dir);
|
|
48144
48260
|
const indexPath = resolve15(dir, "index.html");
|
|
48145
|
-
if (!existsSync25(dir) || !
|
|
48261
|
+
if (!existsSync25(dir) || !statSync7(dir).isDirectory()) {
|
|
48146
48262
|
throw new InvalidProjectError("Not a directory: " + dir);
|
|
48147
48263
|
}
|
|
48148
48264
|
if (!existsSync25(indexPath)) {
|
|
@@ -48250,7 +48366,7 @@ var init_fileWatcher = __esm({
|
|
|
48250
48366
|
// src/server/runtimeSource.ts
|
|
48251
48367
|
import { createHash as createHash4 } from "crypto";
|
|
48252
48368
|
import { existsSync as existsSync26, readFileSync as readFileSync17 } from "fs";
|
|
48253
|
-
import { resolve as resolve16, dirname as
|
|
48369
|
+
import { resolve as resolve16, dirname as dirname11 } from "path";
|
|
48254
48370
|
async function loadRuntimeSource() {
|
|
48255
48371
|
return await buildFromSource2() ?? await getInlinedRuntime() ?? readPrebuiltArtifact();
|
|
48256
48372
|
}
|
|
@@ -48310,7 +48426,7 @@ function readFromNodeModules() {
|
|
|
48310
48426
|
const result = readFromDir(resolve16(dir, sub));
|
|
48311
48427
|
if (result) return result;
|
|
48312
48428
|
}
|
|
48313
|
-
const parent =
|
|
48429
|
+
const parent = dirname11(dir);
|
|
48314
48430
|
if (parent === dir) break;
|
|
48315
48431
|
dir = parent;
|
|
48316
48432
|
}
|
|
@@ -48477,7 +48593,7 @@ var init_studioRenderTelemetry = __esm({
|
|
|
48477
48593
|
|
|
48478
48594
|
// ../core/src/studio-api/helpers/safePath.ts
|
|
48479
48595
|
import { join as join24 } from "path";
|
|
48480
|
-
import { readdirSync as
|
|
48596
|
+
import { readdirSync as readdirSync11 } from "fs";
|
|
48481
48597
|
function shouldIgnoreDir(rel) {
|
|
48482
48598
|
return rel === ".hyperframes/backup";
|
|
48483
48599
|
}
|
|
@@ -48487,7 +48603,7 @@ function isInHiddenOrVendorDir(relPath) {
|
|
|
48487
48603
|
}
|
|
48488
48604
|
function walkDir(dir, prefix = "") {
|
|
48489
48605
|
const files = [];
|
|
48490
|
-
for (const entry of
|
|
48606
|
+
for (const entry of readdirSync11(dir, { withFileTypes: true })) {
|
|
48491
48607
|
const rel = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
48492
48608
|
if (IGNORE_DIRS.has(entry.name) || shouldIgnoreDir(rel)) continue;
|
|
48493
48609
|
if (entry.isDirectory()) {
|
|
@@ -48911,7 +49027,7 @@ var init_mime2 = __esm({
|
|
|
48911
49027
|
|
|
48912
49028
|
// ../core/src/studio-api/helpers/waveform.ts
|
|
48913
49029
|
import { spawn as spawn9 } from "child_process";
|
|
48914
|
-
import { existsSync as existsSync28, writeFileSync as writeFileSync10, mkdirSync as
|
|
49030
|
+
import { existsSync as existsSync28, writeFileSync as writeFileSync10, mkdirSync as mkdirSync14 } from "fs";
|
|
48915
49031
|
import { join as join26, resolve as resolve17 } from "path";
|
|
48916
49032
|
function buildWaveformCacheKey(assetPath) {
|
|
48917
49033
|
return `${WAVEFORM_CACHE_VERSION}_${assetPath.replace(/[/\\]/g, "_")}.json`;
|
|
@@ -48983,7 +49099,7 @@ async function generateWaveformCache(projectDir, assetPath) {
|
|
|
48983
49099
|
const cachePath2 = join26(cacheDir, buildWaveformCacheKey(assetPath));
|
|
48984
49100
|
if (existsSync28(cachePath2)) return;
|
|
48985
49101
|
const peaks = await decodeAudioPeaks(audioPath);
|
|
48986
|
-
|
|
49102
|
+
mkdirSync14(cacheDir, { recursive: true });
|
|
48987
49103
|
writeFileSync10(cachePath2, JSON.stringify(peaks));
|
|
48988
49104
|
}
|
|
48989
49105
|
var SAMPLE_RATE, PEAK_COUNT, WAVEFORM_CACHE_VERSION;
|
|
@@ -48998,7 +49114,7 @@ var init_waveform = __esm({
|
|
|
48998
49114
|
|
|
48999
49115
|
// ../core/src/studio-api/helpers/mediaValidation.ts
|
|
49000
49116
|
import { spawnSync } from "child_process";
|
|
49001
|
-
import { mkdtempSync, rmSync as
|
|
49117
|
+
import { mkdtempSync, rmSync as rmSync5, writeFileSync as writeFileSync11 } from "fs";
|
|
49002
49118
|
import { tmpdir as tmpdir2 } from "os";
|
|
49003
49119
|
import { basename as basename3, join as join27 } from "path";
|
|
49004
49120
|
function validateUploadedMedia(filePath, runner = spawnSync) {
|
|
@@ -49045,7 +49161,7 @@ function validateUploadedMediaBuffer(fileName, buffer, runner = spawnSync) {
|
|
|
49045
49161
|
writeFileSync11(tempPath, buffer);
|
|
49046
49162
|
return validateUploadedMedia(tempPath, runner);
|
|
49047
49163
|
} finally {
|
|
49048
|
-
|
|
49164
|
+
rmSync5(tempDir, { recursive: true, force: true });
|
|
49049
49165
|
}
|
|
49050
49166
|
}
|
|
49051
49167
|
var VIDEO_EXT, AUDIO_EXT;
|
|
@@ -49058,9 +49174,9 @@ var init_mediaValidation = __esm({
|
|
|
49058
49174
|
});
|
|
49059
49175
|
|
|
49060
49176
|
// ../core/src/studio-api/helpers/backupJournal.ts
|
|
49061
|
-
import { mkdirSync as
|
|
49177
|
+
import { mkdirSync as mkdirSync15, readdirSync as readdirSync12, readFileSync as readFileSync19, unlinkSync as unlinkSync3, writeFileSync as writeFileSync12 } from "fs";
|
|
49062
49178
|
import { Buffer as Buffer2 } from "buffer";
|
|
49063
|
-
import { join as join28, relative as
|
|
49179
|
+
import { join as join28, relative as relative7 } from "path";
|
|
49064
49180
|
function backupKeyForPath(path2) {
|
|
49065
49181
|
return Buffer2.from(path2, "utf-8").toString("base64url");
|
|
49066
49182
|
}
|
|
@@ -49069,7 +49185,7 @@ function timestampPrefix() {
|
|
|
49069
49185
|
}
|
|
49070
49186
|
function backupPathForResponse(projectDir, backupPath) {
|
|
49071
49187
|
if (!backupPath) return null;
|
|
49072
|
-
const rel =
|
|
49188
|
+
const rel = relative7(projectDir, backupPath);
|
|
49073
49189
|
if (!rel || rel.startsWith("..")) return null;
|
|
49074
49190
|
return rel.split("\\").join("/");
|
|
49075
49191
|
}
|
|
@@ -49077,9 +49193,9 @@ function snapshotBeforeWrite(projectDir, absPath, options = {}) {
|
|
|
49077
49193
|
if (!isSafePath(projectDir, absPath)) return { backupPath: null };
|
|
49078
49194
|
try {
|
|
49079
49195
|
const content = readFileSync19(absPath);
|
|
49080
|
-
const relativePath =
|
|
49196
|
+
const relativePath = relative7(projectDir, absPath);
|
|
49081
49197
|
const backupDir = join28(projectDir, ".hyperframes", "backup");
|
|
49082
|
-
|
|
49198
|
+
mkdirSync15(backupDir, { recursive: true });
|
|
49083
49199
|
const backupKey = backupKeyForPath(relativePath);
|
|
49084
49200
|
const backupPath = nextBackupPath(backupDir, backupKey);
|
|
49085
49201
|
writeFileSync12(backupPath, content);
|
|
@@ -49113,7 +49229,7 @@ function pruneBackups(backupDir, backupKey, keepPerFile) {
|
|
|
49113
49229
|
const keep = Math.max(1, Math.floor(keepPerFile));
|
|
49114
49230
|
const suffix = `-${backupKey}`;
|
|
49115
49231
|
const numberedSuffix = new RegExp(`-${backupKey}-\\d+$`);
|
|
49116
|
-
const matches2 =
|
|
49232
|
+
const matches2 = readdirSync12(backupDir).filter((name) => name.endsWith(suffix) || numberedSuffix.test(name)).map((name) => join28(backupDir, name)).sort((a, b2) => {
|
|
49117
49233
|
return b2.localeCompare(a);
|
|
49118
49234
|
});
|
|
49119
49235
|
for (const file of matches2.slice(keep)) {
|
|
@@ -57437,7 +57553,7 @@ var require_util2 = __commonJS({
|
|
|
57437
57553
|
}
|
|
57438
57554
|
path2 = url.path;
|
|
57439
57555
|
}
|
|
57440
|
-
var
|
|
57556
|
+
var isAbsolute16 = exports.isAbsolute(path2);
|
|
57441
57557
|
var parts = path2.split(/\/+/);
|
|
57442
57558
|
for (var part, up = 0, i2 = parts.length - 1; i2 >= 0; i2--) {
|
|
57443
57559
|
part = parts[i2];
|
|
@@ -57457,7 +57573,7 @@ var require_util2 = __commonJS({
|
|
|
57457
57573
|
}
|
|
57458
57574
|
path2 = parts.join("/");
|
|
57459
57575
|
if (path2 === "") {
|
|
57460
|
-
path2 =
|
|
57576
|
+
path2 = isAbsolute16 ? "/" : ".";
|
|
57461
57577
|
}
|
|
57462
57578
|
if (url) {
|
|
57463
57579
|
url.path = path2;
|
|
@@ -57502,7 +57618,7 @@ var require_util2 = __commonJS({
|
|
|
57502
57618
|
exports.isAbsolute = function(aPath) {
|
|
57503
57619
|
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
|
|
57504
57620
|
};
|
|
57505
|
-
function
|
|
57621
|
+
function relative17(aRoot, aPath) {
|
|
57506
57622
|
if (aRoot === "") {
|
|
57507
57623
|
aRoot = ".";
|
|
57508
57624
|
}
|
|
@@ -57521,7 +57637,7 @@ var require_util2 = __commonJS({
|
|
|
57521
57637
|
}
|
|
57522
57638
|
return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
|
|
57523
57639
|
}
|
|
57524
|
-
exports.relative =
|
|
57640
|
+
exports.relative = relative17;
|
|
57525
57641
|
var supportsNullProto = (function() {
|
|
57526
57642
|
var obj = /* @__PURE__ */ Object.create(null);
|
|
57527
57643
|
return !("__proto__" in obj);
|
|
@@ -86651,14 +86767,14 @@ import {
|
|
|
86651
86767
|
existsSync as existsSync29,
|
|
86652
86768
|
readFileSync as readFileSync20,
|
|
86653
86769
|
writeFileSync as writeFileSync13,
|
|
86654
|
-
mkdirSync as
|
|
86770
|
+
mkdirSync as mkdirSync16,
|
|
86655
86771
|
unlinkSync as unlinkSync4,
|
|
86656
|
-
rmSync as
|
|
86657
|
-
statSync as
|
|
86772
|
+
rmSync as rmSync6,
|
|
86773
|
+
statSync as statSync8,
|
|
86658
86774
|
renameSync as renameSync3,
|
|
86659
|
-
readdirSync as
|
|
86775
|
+
readdirSync as readdirSync13
|
|
86660
86776
|
} from "fs";
|
|
86661
|
-
import { resolve as resolve18, dirname as
|
|
86777
|
+
import { resolve as resolve18, dirname as dirname12, join as join29 } from "path";
|
|
86662
86778
|
function isAcornGsapWriterEnabled() {
|
|
86663
86779
|
const val = process.env["STUDIO_SDK_CUTOVER_ENABLED"];
|
|
86664
86780
|
return val === "true" || val === "1";
|
|
@@ -86724,8 +86840,8 @@ async function parseMutationBody(c3) {
|
|
|
86724
86840
|
return { target: body.target, body };
|
|
86725
86841
|
}
|
|
86726
86842
|
function ensureDir(filePath) {
|
|
86727
|
-
const dir =
|
|
86728
|
-
if (!existsSync29(dir))
|
|
86843
|
+
const dir = dirname12(filePath);
|
|
86844
|
+
if (!existsSync29(dir)) mkdirSync16(dir, { recursive: true });
|
|
86729
86845
|
}
|
|
86730
86846
|
function generateCopyPath(projectDir, originalPath) {
|
|
86731
86847
|
const ext = originalPath.includes(".") ? "." + originalPath.split(".").pop() : "";
|
|
@@ -86742,7 +86858,7 @@ function generateCopyPath(projectDir, originalPath) {
|
|
|
86742
86858
|
}
|
|
86743
86859
|
function walkFiles(dir, filter2) {
|
|
86744
86860
|
const results = [];
|
|
86745
|
-
for (const entry of
|
|
86861
|
+
for (const entry of readdirSync13(dir, { withFileTypes: true })) {
|
|
86746
86862
|
const full2 = join29(dir, entry.name);
|
|
86747
86863
|
if (entry.isDirectory()) {
|
|
86748
86864
|
if (entry.name === "node_modules" || entry.name === ".thumbnails" || entry.name === "renders")
|
|
@@ -87502,11 +87618,11 @@ function registerFileRoutes(api, adapter2) {
|
|
|
87502
87618
|
api.delete("/projects/:id/files/*", async (c3) => {
|
|
87503
87619
|
const res = await resolveProjectFile(c3, adapter2, { mustExist: true });
|
|
87504
87620
|
if ("error" in res) return res.error;
|
|
87505
|
-
const stat3 =
|
|
87621
|
+
const stat3 = statSync8(res.absPath);
|
|
87506
87622
|
const backup = snapshotBeforeWrite(res.project.dir, res.absPath);
|
|
87507
87623
|
if (backup.error) console.warn(`Failed to create backup for ${res.filePath}: ${backup.error}`);
|
|
87508
87624
|
if (stat3.isDirectory()) {
|
|
87509
|
-
|
|
87625
|
+
rmSync6(res.absPath, { recursive: true });
|
|
87510
87626
|
} else {
|
|
87511
87627
|
unlinkSync4(res.absPath);
|
|
87512
87628
|
}
|
|
@@ -87680,7 +87796,7 @@ function registerFileRoutes(api, adapter2) {
|
|
|
87680
87796
|
const subDir = c3.req.query("dir") ?? "";
|
|
87681
87797
|
const targetDir = subDir ? resolveWithinProject(project.dir, subDir) : project.dir;
|
|
87682
87798
|
if (!targetDir) return c3.json({ error: "forbidden" }, 403);
|
|
87683
|
-
if (subDir && !existsSync29(targetDir))
|
|
87799
|
+
if (subDir && !existsSync29(targetDir)) mkdirSync16(targetDir, { recursive: true });
|
|
87684
87800
|
const formData = await c3.req.formData();
|
|
87685
87801
|
const result = await processUploadedFiles(formData, targetDir, project.dir);
|
|
87686
87802
|
return c3.json(
|
|
@@ -88003,11 +88119,11 @@ var init_subComposition = __esm({
|
|
|
88003
88119
|
|
|
88004
88120
|
// ../core/src/studio-api/helpers/projectSignature.ts
|
|
88005
88121
|
import { createHash as createHash5 } from "crypto";
|
|
88006
|
-
import { lstatSync, readFileSync as readFileSync22, readdirSync as
|
|
88007
|
-
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";
|
|
88008
88124
|
function isPathWithin(parentDir, childPath) {
|
|
88009
|
-
const childRelativePath =
|
|
88010
|
-
return childRelativePath === "" || !childRelativePath.startsWith("..") && !
|
|
88125
|
+
const childRelativePath = relative8(parentDir, childPath);
|
|
88126
|
+
return childRelativePath === "" || !childRelativePath.startsWith("..") && !isAbsolute9(childRelativePath);
|
|
88011
88127
|
}
|
|
88012
88128
|
function isTextContentEligible(file, size) {
|
|
88013
88129
|
return SIGNATURE_TEXT_EXTENSIONS.has(extname8(file).toLowerCase()) && size <= MAX_SIGNATURE_TEXT_BYTES;
|
|
@@ -88015,7 +88131,7 @@ function isTextContentEligible(file, size) {
|
|
|
88015
88131
|
function collectProjectSignatureFiles(projectDir, dir, files) {
|
|
88016
88132
|
let entries2;
|
|
88017
88133
|
try {
|
|
88018
|
-
entries2 =
|
|
88134
|
+
entries2 = readdirSync14(dir).sort();
|
|
88019
88135
|
} catch {
|
|
88020
88136
|
return;
|
|
88021
88137
|
}
|
|
@@ -88066,7 +88182,7 @@ function collectProjectSignatureManifestFiles(projectDir, files) {
|
|
|
88066
88182
|
function createProjectFingerprint(projectDir, files) {
|
|
88067
88183
|
const hash2 = createHash5("sha256");
|
|
88068
88184
|
for (const entry of files) {
|
|
88069
|
-
hash2.update(
|
|
88185
|
+
hash2.update(relative8(projectDir, entry.file));
|
|
88070
88186
|
hash2.update("\0");
|
|
88071
88187
|
hash2.update(String(entry.size));
|
|
88072
88188
|
hash2.update("\0");
|
|
@@ -88088,7 +88204,7 @@ function createProjectSignature(projectDir) {
|
|
|
88088
88204
|
if (cached2?.fingerprint === fingerprint) return cached2.signature;
|
|
88089
88205
|
const hash2 = createHash5("sha256");
|
|
88090
88206
|
for (const entry of files) {
|
|
88091
|
-
const relativePath =
|
|
88207
|
+
const relativePath = relative8(normalizedProjectDir, entry.file);
|
|
88092
88208
|
hash2.update(relativePath);
|
|
88093
88209
|
hash2.update("\0");
|
|
88094
88210
|
hash2.update(String(entry.size));
|
|
@@ -88365,7 +88481,7 @@ var init_hfIdPersist = __esm({
|
|
|
88365
88481
|
});
|
|
88366
88482
|
|
|
88367
88483
|
// ../core/src/studio-api/routes/preview.ts
|
|
88368
|
-
import { existsSync as existsSync31, readFileSync as readFileSync24, statSync as
|
|
88484
|
+
import { existsSync as existsSync31, readFileSync as readFileSync24, statSync as statSync9 } from "fs";
|
|
88369
88485
|
import { join as join31 } from "path";
|
|
88370
88486
|
function resolveProjectSignature(adapter2, projectDir) {
|
|
88371
88487
|
return adapter2.getProjectSignature?.(projectDir) ?? createProjectSignature(projectDir);
|
|
@@ -88568,7 +88684,7 @@ ${runtimeTag}`;
|
|
|
88568
88684
|
c3.req.path.replace(`/projects/${project.id}/preview/comp/`, "").split("?")[0] ?? ""
|
|
88569
88685
|
);
|
|
88570
88686
|
const compFile = resolveWithinProject(project.dir, compPath);
|
|
88571
|
-
if (!compFile || !existsSync31(compFile) || !
|
|
88687
|
+
if (!compFile || !existsSync31(compFile) || !statSync9(compFile).isFile()) {
|
|
88572
88688
|
return c3.text("not found", 404);
|
|
88573
88689
|
}
|
|
88574
88690
|
const etag = `"comp:${compPath}:${signature}"`;
|
|
@@ -88596,7 +88712,7 @@ ${runtimeTag}`;
|
|
|
88596
88712
|
if (!file) {
|
|
88597
88713
|
return c3.text("not found", 404);
|
|
88598
88714
|
}
|
|
88599
|
-
const stat3 = existsSync31(file) ?
|
|
88715
|
+
const stat3 = existsSync31(file) ? statSync9(file) : null;
|
|
88600
88716
|
if (!stat3?.isFile()) {
|
|
88601
88717
|
return c3.text("not found", 404);
|
|
88602
88718
|
}
|
|
@@ -88719,7 +88835,7 @@ var init_lint2 = __esm({
|
|
|
88719
88835
|
|
|
88720
88836
|
// ../core/src/studio-api/routes/render.ts
|
|
88721
88837
|
import { streamSSE } from "hono/streaming";
|
|
88722
|
-
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";
|
|
88723
88839
|
import { join as join33 } from "path";
|
|
88724
88840
|
function registerRenderRoutes(api, adapter2) {
|
|
88725
88841
|
const renderJobs = /* @__PURE__ */ new Map();
|
|
@@ -88770,7 +88886,7 @@ function registerRenderRoutes(api, adapter2) {
|
|
|
88770
88886
|
const timePart = now.toTimeString().slice(0, 8).replace(/:/g, "-");
|
|
88771
88887
|
const jobId = `${project.id}_${datePart}_${timePart}`;
|
|
88772
88888
|
const rendersDir = adapter2.rendersDir(project);
|
|
88773
|
-
if (!existsSync32(rendersDir))
|
|
88889
|
+
if (!existsSync32(rendersDir)) mkdirSync17(rendersDir, { recursive: true });
|
|
88774
88890
|
const ext = FORMAT_EXT3[format] ?? ".mp4";
|
|
88775
88891
|
const outputPath = join33(rendersDir, `${jobId}${ext}`);
|
|
88776
88892
|
const jobState = adapter2.startRender({
|
|
@@ -88895,9 +89011,9 @@ function registerRenderRoutes(api, adapter2) {
|
|
|
88895
89011
|
if (!project) return c3.json({ error: "not found" }, 404);
|
|
88896
89012
|
const rendersDir = adapter2.rendersDir(project);
|
|
88897
89013
|
if (!existsSync32(rendersDir)) return c3.json({ renders: [] });
|
|
88898
|
-
const files =
|
|
89014
|
+
const files = readdirSync15(rendersDir).filter((f3) => f3.endsWith(".mp4") || f3.endsWith(".webm") || f3.endsWith(".mov")).map((f3) => {
|
|
88899
89015
|
const fp = join33(rendersDir, f3);
|
|
88900
|
-
const stat3 =
|
|
89016
|
+
const stat3 = statSync10(fp);
|
|
88901
89017
|
const rid = f3.replace(/\.(mp4|webm|mov)$/, "");
|
|
88902
89018
|
const metaPath = join33(rendersDir, `${rid}.meta.json`);
|
|
88903
89019
|
let status = "complete";
|
|
@@ -89528,7 +89644,7 @@ var init_manualEditsRenderScript = __esm({
|
|
|
89528
89644
|
});
|
|
89529
89645
|
|
|
89530
89646
|
// ../core/src/studio-api/routes/thumbnail.ts
|
|
89531
|
-
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";
|
|
89532
89648
|
import { join as join34 } from "path";
|
|
89533
89649
|
import { createHash as createHash6 } from "crypto";
|
|
89534
89650
|
function registerThumbnailRoutes(api, adapter2) {
|
|
@@ -89560,7 +89676,7 @@ function registerThumbnailRoutes(api, adapter2) {
|
|
|
89560
89676
|
if (!vpWidth) {
|
|
89561
89677
|
const htmlFile = join34(project.dir, compPath);
|
|
89562
89678
|
if (existsSync33(htmlFile)) {
|
|
89563
|
-
sourceMtime = Math.round(
|
|
89679
|
+
sourceMtime = Math.round(statSync11(htmlFile).mtimeMs);
|
|
89564
89680
|
const html = readFileSync27(htmlFile, "utf-8");
|
|
89565
89681
|
const wMatch = html.match(/data-width=["'](\d+)["']/);
|
|
89566
89682
|
const hMatch = html.match(/data-height=["'](\d+)["']/);
|
|
@@ -89573,14 +89689,14 @@ function registerThumbnailRoutes(api, adapter2) {
|
|
|
89573
89689
|
if (existsSync33(manualEditsFile)) {
|
|
89574
89690
|
const manualEditsContent = readFileSync27(manualEditsFile, "utf-8");
|
|
89575
89691
|
manualEditsKey = `_${createHash6("sha1").update(manualEditsContent).digest("hex").slice(0, 16)}`;
|
|
89576
|
-
sourceMtime = Math.max(sourceMtime, Math.round(
|
|
89692
|
+
sourceMtime = Math.max(sourceMtime, Math.round(statSync11(manualEditsFile).mtimeMs));
|
|
89577
89693
|
}
|
|
89578
89694
|
const motionFile = join34(project.dir, STUDIO_MOTION_PATH);
|
|
89579
89695
|
let motionKey = "";
|
|
89580
89696
|
if (existsSync33(motionFile)) {
|
|
89581
89697
|
const motionContent = readFileSync27(motionFile, "utf-8");
|
|
89582
89698
|
motionKey = `_${createHash6("sha1").update(motionContent).digest("hex").slice(0, 16)}`;
|
|
89583
|
-
sourceMtime = Math.max(sourceMtime, Math.round(
|
|
89699
|
+
sourceMtime = Math.max(sourceMtime, Math.round(statSync11(motionFile).mtimeMs));
|
|
89584
89700
|
}
|
|
89585
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}`;
|
|
89586
89702
|
const cacheDir = join34(project.dir, ".thumbnails");
|
|
@@ -89611,7 +89727,7 @@ function registerThumbnailRoutes(api, adapter2) {
|
|
|
89611
89727
|
500
|
|
89612
89728
|
);
|
|
89613
89729
|
}
|
|
89614
|
-
if (!existsSync33(cacheDir))
|
|
89730
|
+
if (!existsSync33(cacheDir)) mkdirSync18(cacheDir, { recursive: true });
|
|
89615
89731
|
writeFileSync15(cachePath2, buffer);
|
|
89616
89732
|
return new Response(new Uint8Array(buffer), {
|
|
89617
89733
|
headers: { "Content-Type": contentType, "Cache-Control": "public, max-age=60" }
|
|
@@ -89633,7 +89749,7 @@ var init_thumbnail = __esm({
|
|
|
89633
89749
|
});
|
|
89634
89750
|
|
|
89635
89751
|
// ../core/src/studio-api/routes/waveform.ts
|
|
89636
|
-
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";
|
|
89637
89753
|
import { join as join35 } from "path";
|
|
89638
89754
|
function registerWaveformRoutes(api, adapter2) {
|
|
89639
89755
|
api.get("/projects/:id/waveform/*", async (c3) => {
|
|
@@ -89660,7 +89776,7 @@ function registerWaveformRoutes(api, adapter2) {
|
|
|
89660
89776
|
return c3.json({ error: "failed to decode audio" }, 500);
|
|
89661
89777
|
}
|
|
89662
89778
|
try {
|
|
89663
|
-
|
|
89779
|
+
mkdirSync19(cacheDir, { recursive: true });
|
|
89664
89780
|
writeFileSync16(cachePath2, JSON.stringify(peaks));
|
|
89665
89781
|
} catch {
|
|
89666
89782
|
}
|
|
@@ -89676,8 +89792,8 @@ var init_waveform2 = __esm({
|
|
|
89676
89792
|
|
|
89677
89793
|
// ../core/src/fonts/systemFontLocator.ts
|
|
89678
89794
|
import { execFileSync as execFileSync5 } from "child_process";
|
|
89679
|
-
import { existsSync as existsSync35, lstatSync as lstatSync2, readdirSync as
|
|
89680
|
-
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";
|
|
89681
89797
|
import { join as join36, resolve as resolve20 } from "path";
|
|
89682
89798
|
function getAllowedFontDirs() {
|
|
89683
89799
|
if (allowedDirsCache) return allowedDirsCache;
|
|
@@ -89737,7 +89853,7 @@ function isRegularWeight(fileName) {
|
|
|
89737
89853
|
return !lower2.includes("bold") && !lower2.includes("italic") && !lower2.includes("light");
|
|
89738
89854
|
}
|
|
89739
89855
|
function fontDirectories() {
|
|
89740
|
-
const home =
|
|
89856
|
+
const home = homedir8();
|
|
89741
89857
|
if (platform5() === "darwin") {
|
|
89742
89858
|
return [
|
|
89743
89859
|
join36(home, "Library", "Fonts"),
|
|
@@ -89750,7 +89866,7 @@ function fontDirectories() {
|
|
|
89750
89866
|
return [
|
|
89751
89867
|
join36(process.env.WINDIR || "C:\\Windows", "Fonts"),
|
|
89752
89868
|
join36(
|
|
89753
|
-
process.env.LOCALAPPDATA || join36(
|
|
89869
|
+
process.env.LOCALAPPDATA || join36(homedir8(), "AppData", "Local"),
|
|
89754
89870
|
"Microsoft",
|
|
89755
89871
|
"Windows",
|
|
89756
89872
|
"Fonts"
|
|
@@ -89768,7 +89884,7 @@ function collectFontFileEntries(dir, depth = 0) {
|
|
|
89768
89884
|
if (!existsSync35(dir) || depth > 2) return [];
|
|
89769
89885
|
const entries2 = [];
|
|
89770
89886
|
try {
|
|
89771
|
-
for (const entry of
|
|
89887
|
+
for (const entry of readdirSync16(dir, { withFileTypes: true })) {
|
|
89772
89888
|
const fullPath = join36(dir, entry.name);
|
|
89773
89889
|
if (entry.isDirectory()) {
|
|
89774
89890
|
entries2.push(...collectFontFileEntries(fullPath, depth + 1));
|
|
@@ -90265,9 +90381,9 @@ __export(manager_exports2, {
|
|
|
90265
90381
|
isLinuxArm: () => isLinuxArm
|
|
90266
90382
|
});
|
|
90267
90383
|
import { execSync as execSync5, spawnSync as spawnSync2 } from "child_process";
|
|
90268
|
-
import { existsSync as existsSync36, readdirSync as
|
|
90384
|
+
import { existsSync as existsSync36, readdirSync as readdirSync17, rmSync as rmSync7 } from "fs";
|
|
90269
90385
|
import { basename as basename4 } from "path";
|
|
90270
|
-
import { homedir as
|
|
90386
|
+
import { homedir as homedir9 } from "os";
|
|
90271
90387
|
import { join as join37 } from "path";
|
|
90272
90388
|
async function loadPuppeteerBrowsers() {
|
|
90273
90389
|
try {
|
|
@@ -90351,7 +90467,7 @@ function findFromPuppeteerCache() {
|
|
|
90351
90467
|
if (!existsSync36(PUPPETEER_CACHE_DIR)) return void 0;
|
|
90352
90468
|
let versions;
|
|
90353
90469
|
try {
|
|
90354
|
-
versions = [...
|
|
90470
|
+
versions = [...readdirSync17(PUPPETEER_CACHE_DIR)].sort(compareVersionDirsDescending);
|
|
90355
90471
|
} catch {
|
|
90356
90472
|
return void 0;
|
|
90357
90473
|
}
|
|
@@ -90514,7 +90630,7 @@ function clearBrowser() {
|
|
|
90514
90630
|
if (!existsSync36(CACHE_DIR2)) {
|
|
90515
90631
|
return false;
|
|
90516
90632
|
}
|
|
90517
|
-
|
|
90633
|
+
rmSync7(CACHE_DIR2, { recursive: true, force: true });
|
|
90518
90634
|
return true;
|
|
90519
90635
|
}
|
|
90520
90636
|
function isLinuxArm() {
|
|
@@ -90525,8 +90641,8 @@ var init_manager2 = __esm({
|
|
|
90525
90641
|
"src/browser/manager.ts"() {
|
|
90526
90642
|
"use strict";
|
|
90527
90643
|
CHROME_VERSION = "131.0.6778.85";
|
|
90528
|
-
CACHE_DIR2 = join37(
|
|
90529
|
-
PUPPETEER_CACHE_DIR = join37(
|
|
90644
|
+
CACHE_DIR2 = join37(homedir9(), ".cache", "hyperframes", "chrome");
|
|
90645
|
+
PUPPETEER_CACHE_DIR = join37(homedir9(), ".cache", "puppeteer", "chrome-headless-shell");
|
|
90530
90646
|
SYSTEM_CHROME_PATHS = process.platform === "darwin" ? ["/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"] : [
|
|
90531
90647
|
"/usr/bin/google-chrome",
|
|
90532
90648
|
"/usr/bin/google-chrome-stable",
|
|
@@ -93796,8 +93912,8 @@ __export(deterministicFonts_exports, {
|
|
|
93796
93912
|
parseFontFamilyValue: () => parseFontFamilyValue
|
|
93797
93913
|
});
|
|
93798
93914
|
import { createHash as createHash7 } from "crypto";
|
|
93799
|
-
import { existsSync as existsSync37, mkdirSync as
|
|
93800
|
-
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";
|
|
93801
93917
|
import { join as join38 } from "path";
|
|
93802
93918
|
function parseFontFamilyValue(value) {
|
|
93803
93919
|
return value.split(",").map((piece) => piece.trim().replace(/^['"]/, "").replace(/['"]$/, "").trim()).filter((piece) => piece.length > 0);
|
|
@@ -93956,7 +94072,7 @@ function warnUnresolvedFonts(unresolved) {
|
|
|
93956
94072
|
);
|
|
93957
94073
|
}
|
|
93958
94074
|
function resolveFontCacheRoot() {
|
|
93959
|
-
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"));
|
|
93960
94076
|
}
|
|
93961
94077
|
function fontSlug(familyName) {
|
|
93962
94078
|
return familyName.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
@@ -93964,7 +94080,7 @@ function fontSlug(familyName) {
|
|
|
93964
94080
|
function fontCacheDir(slug) {
|
|
93965
94081
|
const dir = join38(GOOGLE_FONTS_CACHE_DIR, slug);
|
|
93966
94082
|
if (!existsSync37(dir)) {
|
|
93967
|
-
|
|
94083
|
+
mkdirSync20(dir, { recursive: true });
|
|
93968
94084
|
}
|
|
93969
94085
|
return dir;
|
|
93970
94086
|
}
|
|
@@ -94251,13 +94367,13 @@ import { spawn as spawn10 } from "child_process";
|
|
|
94251
94367
|
import {
|
|
94252
94368
|
copyFileSync as copyFileSync2,
|
|
94253
94369
|
existsSync as existsSync38,
|
|
94254
|
-
mkdirSync as
|
|
94370
|
+
mkdirSync as mkdirSync21,
|
|
94255
94371
|
readFileSync as readFileSync30,
|
|
94256
94372
|
renameSync as renameSync4,
|
|
94257
|
-
rmSync as
|
|
94258
|
-
statSync as
|
|
94373
|
+
rmSync as rmSync8,
|
|
94374
|
+
statSync as statSync12
|
|
94259
94375
|
} from "fs";
|
|
94260
|
-
import { dirname as
|
|
94376
|
+
import { dirname as dirname13, isAbsolute as isAbsolute10, join as join39, resolve as resolve21 } from "path";
|
|
94261
94377
|
function splitUrlSuffix2(src) {
|
|
94262
94378
|
const queryIdx = src.indexOf("?");
|
|
94263
94379
|
const hashIdx = src.indexOf("#");
|
|
@@ -94294,14 +94410,14 @@ function resolveGifSourcePath(src, options) {
|
|
|
94294
94410
|
if (isHttpUrl(trimmed)) return null;
|
|
94295
94411
|
const projectRelative = basePath.startsWith("/") ? basePath.slice(1) : basePath;
|
|
94296
94412
|
const candidates = [
|
|
94297
|
-
|
|
94413
|
+
isAbsolute10(basePath) ? basePath : resolve21(options.projectDir, projectRelative),
|
|
94298
94414
|
resolve21(options.downloadDir, normalizedBase)
|
|
94299
94415
|
];
|
|
94300
94416
|
return candidates.find((candidate) => existsSync38(candidate)) ?? null;
|
|
94301
94417
|
}
|
|
94302
94418
|
function isUsableFile(path2) {
|
|
94303
94419
|
try {
|
|
94304
|
-
const stat3 =
|
|
94420
|
+
const stat3 = statSync12(path2);
|
|
94305
94421
|
return stat3.isFile() && stat3.size > 0;
|
|
94306
94422
|
} catch {
|
|
94307
94423
|
return false;
|
|
@@ -94417,11 +94533,11 @@ async function runAnimatedGifTranscode(request) {
|
|
|
94417
94533
|
});
|
|
94418
94534
|
}
|
|
94419
94535
|
async function ensurePreparedWebm(input2) {
|
|
94420
|
-
if (!existsSync38(
|
|
94421
|
-
|
|
94536
|
+
if (!existsSync38(dirname13(input2.cachePath))) {
|
|
94537
|
+
mkdirSync21(dirname13(input2.cachePath), { recursive: true });
|
|
94422
94538
|
}
|
|
94423
|
-
if (!existsSync38(
|
|
94424
|
-
|
|
94539
|
+
if (!existsSync38(dirname13(input2.outputPath))) {
|
|
94540
|
+
mkdirSync21(dirname13(input2.outputPath), { recursive: true });
|
|
94425
94541
|
}
|
|
94426
94542
|
if (!isUsableFile(input2.cachePath)) {
|
|
94427
94543
|
const tmpPath = `${input2.cachePath}.tmp-${process.pid}-${Date.now()}`;
|
|
@@ -94445,10 +94561,10 @@ async function ensurePreparedWebm(input2) {
|
|
|
94445
94561
|
if (!isUsableFile(input2.cachePath)) {
|
|
94446
94562
|
renameSync4(tmpPath, input2.cachePath);
|
|
94447
94563
|
} else {
|
|
94448
|
-
|
|
94564
|
+
rmSync8(tmpPath, { force: true });
|
|
94449
94565
|
}
|
|
94450
94566
|
} catch (error) {
|
|
94451
|
-
|
|
94567
|
+
rmSync8(tmpPath, { force: true });
|
|
94452
94568
|
throw error;
|
|
94453
94569
|
}
|
|
94454
94570
|
}
|
|
@@ -94576,7 +94692,7 @@ var init_animatedGifPrep = __esm({
|
|
|
94576
94692
|
// ../producer/src/services/hyperframeRuntimeLoader.ts
|
|
94577
94693
|
import { createHash as createHash9 } from "crypto";
|
|
94578
94694
|
import { existsSync as existsSync39, readFileSync as readFileSync31 } from "fs";
|
|
94579
|
-
import { dirname as
|
|
94695
|
+
import { dirname as dirname14, resolve as resolve22 } from "path";
|
|
94580
94696
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
94581
94697
|
function resolveHyperframeManifestPath() {
|
|
94582
94698
|
if (process.env.PRODUCER_HYPERFRAME_MANIFEST_PATH) {
|
|
@@ -94612,7 +94728,7 @@ function resolveVerifiedHyperframeRuntime() {
|
|
|
94612
94728
|
`[HyperframeRuntimeLoader] Invalid manifest at ${manifestPath}; missing iife artifact or sha256.`
|
|
94613
94729
|
);
|
|
94614
94730
|
}
|
|
94615
|
-
const runtimePath = resolve22(
|
|
94731
|
+
const runtimePath = resolve22(dirname14(manifestPath), runtimeFileName);
|
|
94616
94732
|
if (!existsSync39(runtimePath)) {
|
|
94617
94733
|
throw new Error(`[HyperframeRuntimeLoader] Missing runtime artifact at ${runtimePath}.`);
|
|
94618
94734
|
}
|
|
@@ -94635,7 +94751,7 @@ var PRODUCER_DIR, SIBLING_MANIFEST_PATH, MODULE_RELATIVE_MANIFEST_PATH, CWD_RELA
|
|
|
94635
94751
|
var init_hyperframeRuntimeLoader = __esm({
|
|
94636
94752
|
"../producer/src/services/hyperframeRuntimeLoader.ts"() {
|
|
94637
94753
|
"use strict";
|
|
94638
|
-
PRODUCER_DIR =
|
|
94754
|
+
PRODUCER_DIR = dirname14(fileURLToPath2(import.meta.url));
|
|
94639
94755
|
SIBLING_MANIFEST_PATH = resolve22(PRODUCER_DIR, "hyperframe.manifest.json");
|
|
94640
94756
|
MODULE_RELATIVE_MANIFEST_PATH = resolve22(
|
|
94641
94757
|
PRODUCER_DIR,
|
|
@@ -94667,7 +94783,7 @@ var init_hf_early_stub_inline = __esm({
|
|
|
94667
94783
|
// ../producer/src/services/fileServer.ts
|
|
94668
94784
|
import { Hono as Hono3 } from "hono";
|
|
94669
94785
|
import { serve as serve2 } from "@hono/node-server";
|
|
94670
|
-
import { existsSync as existsSync40, realpathSync as realpathSync3, statSync as
|
|
94786
|
+
import { existsSync as existsSync40, realpathSync as realpathSync3, statSync as statSync13, createReadStream } from "fs";
|
|
94671
94787
|
import { readFile as readFile2 } from "fs/promises";
|
|
94672
94788
|
import { Readable as Readable2 } from "stream";
|
|
94673
94789
|
import { join as join40, extname as extname9, resolve as resolve23, sep as sep5 } from "path";
|
|
@@ -95015,13 +95131,13 @@ function createFileServer2(options) {
|
|
|
95015
95131
|
let filePath = null;
|
|
95016
95132
|
if (compiledDir) {
|
|
95017
95133
|
const candidate = join40(compiledDir, relativePath);
|
|
95018
|
-
if (existsSync40(candidate) && isPathInside2(candidate, compiledDir) &&
|
|
95134
|
+
if (existsSync40(candidate) && isPathInside2(candidate, compiledDir) && statSync13(candidate).isFile()) {
|
|
95019
95135
|
filePath = candidate;
|
|
95020
95136
|
}
|
|
95021
95137
|
}
|
|
95022
95138
|
if (!filePath) {
|
|
95023
95139
|
const candidate = join40(projectDir, relativePath);
|
|
95024
|
-
if (existsSync40(candidate) && isPathInside2(candidate, projectDir) &&
|
|
95140
|
+
if (existsSync40(candidate) && isPathInside2(candidate, projectDir) && statSync13(candidate).isFile()) {
|
|
95025
95141
|
filePath = candidate;
|
|
95026
95142
|
}
|
|
95027
95143
|
}
|
|
@@ -95043,7 +95159,7 @@ function createFileServer2(options) {
|
|
|
95043
95159
|
html = isIndex ? injectScriptsIntoHtml(html, headScripts, bodyScripts, stripEmbeddedRuntime) : html;
|
|
95044
95160
|
return c3.text(html, 200, { "Content-Type": contentType });
|
|
95045
95161
|
}
|
|
95046
|
-
const stat3 =
|
|
95162
|
+
const stat3 = statSync13(filePath);
|
|
95047
95163
|
const totalSize2 = stat3.size;
|
|
95048
95164
|
const rangeHeader = c3.req.header("range");
|
|
95049
95165
|
const rangeRequest = parseRangeHeader(rangeHeader, totalSize2);
|
|
@@ -95295,8 +95411,8 @@ var init_paths = __esm({
|
|
|
95295
95411
|
});
|
|
95296
95412
|
|
|
95297
95413
|
// ../producer/src/services/render/shared.ts
|
|
95298
|
-
import { copyFileSync as copyFileSync3, cpSync, existsSync as existsSync41, mkdirSync as
|
|
95299
|
-
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";
|
|
95300
95416
|
function writeFileExclusiveSync(path2, data2) {
|
|
95301
95417
|
try {
|
|
95302
95418
|
writeFileSync18(path2, data2, { flag: "wx", mode: 384 });
|
|
@@ -95343,11 +95459,11 @@ function resolveDeviceScaleFactor(input2) {
|
|
|
95343
95459
|
}
|
|
95344
95460
|
function writeCompiledArtifacts(compiled, workDir, includeSummary) {
|
|
95345
95461
|
const compileDir = join42(workDir, "compiled");
|
|
95346
|
-
|
|
95462
|
+
mkdirSync22(compileDir, { recursive: true });
|
|
95347
95463
|
writeFileSync18(join42(compileDir, "index.html"), compiled.html, "utf-8");
|
|
95348
95464
|
for (const [srcPath, html] of compiled.subCompositions) {
|
|
95349
95465
|
const outPath = join42(compileDir, srcPath);
|
|
95350
|
-
|
|
95466
|
+
mkdirSync22(dirname15(outPath), { recursive: true });
|
|
95351
95467
|
writeFileSync18(outPath, html, "utf-8");
|
|
95352
95468
|
}
|
|
95353
95469
|
for (const [relativePath, absolutePath] of compiled.externalAssets) {
|
|
@@ -95356,7 +95472,7 @@ function writeCompiledArtifacts(compiled, workDir, includeSummary) {
|
|
|
95356
95472
|
console.warn(`[Render] Skipping external asset with unsafe path: ${relativePath}`);
|
|
95357
95473
|
continue;
|
|
95358
95474
|
}
|
|
95359
|
-
|
|
95475
|
+
mkdirSync22(dirname15(outPath), { recursive: true });
|
|
95360
95476
|
copyFileSync3(absolutePath, outPath);
|
|
95361
95477
|
}
|
|
95362
95478
|
if (includeSummary) {
|
|
@@ -95474,16 +95590,16 @@ var init_shared = __esm({
|
|
|
95474
95590
|
materializePathModule = {
|
|
95475
95591
|
resolve: resolve24,
|
|
95476
95592
|
join: join42,
|
|
95477
|
-
dirname:
|
|
95593
|
+
dirname: dirname15,
|
|
95478
95594
|
basename: basename6,
|
|
95479
|
-
relative:
|
|
95480
|
-
isAbsolute:
|
|
95595
|
+
relative: relative9,
|
|
95596
|
+
isAbsolute: isAbsolute11
|
|
95481
95597
|
};
|
|
95482
95598
|
materializeFileSystem = {
|
|
95483
95599
|
existsSync: existsSync41,
|
|
95484
|
-
mkdirSync:
|
|
95485
|
-
symlinkSync,
|
|
95486
|
-
cpSync
|
|
95600
|
+
mkdirSync: mkdirSync22,
|
|
95601
|
+
symlinkSync: symlinkSync2,
|
|
95602
|
+
cpSync: cpSync2
|
|
95487
95603
|
};
|
|
95488
95604
|
}
|
|
95489
95605
|
});
|
|
@@ -95513,7 +95629,7 @@ var init_errorMessage = __esm({
|
|
|
95513
95629
|
});
|
|
95514
95630
|
|
|
95515
95631
|
// ../producer/src/services/render/cleanup.ts
|
|
95516
|
-
import { rmSync as
|
|
95632
|
+
import { rmSync as rmSync9 } from "fs";
|
|
95517
95633
|
import { freemem as freemem4 } from "os";
|
|
95518
95634
|
async function safeCleanup(label2, fn, log2 = defaultLogger) {
|
|
95519
95635
|
try {
|
|
@@ -95543,7 +95659,7 @@ async function cleanupRenderResources(input2) {
|
|
|
95543
95659
|
if (!debug) {
|
|
95544
95660
|
await safeCleanup(
|
|
95545
95661
|
`remove workDir (${label2})`,
|
|
95546
|
-
() =>
|
|
95662
|
+
() => rmSync9(workDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 }),
|
|
95547
95663
|
log2
|
|
95548
95664
|
);
|
|
95549
95665
|
}
|
|
@@ -96366,8 +96482,8 @@ var init_ffprobe2 = __esm({
|
|
|
96366
96482
|
});
|
|
96367
96483
|
|
|
96368
96484
|
// ../producer/src/services/htmlCompiler.ts
|
|
96369
|
-
import { readFileSync as readFileSync32, existsSync as existsSync42, mkdirSync as
|
|
96370
|
-
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";
|
|
96371
96487
|
function dedupeElementsById(elements) {
|
|
96372
96488
|
const deduped = /* @__PURE__ */ new Map();
|
|
96373
96489
|
for (const element of elements) {
|
|
@@ -96434,7 +96550,7 @@ function detectShaderTransitionUsage(html) {
|
|
|
96434
96550
|
async function resolveMediaDuration(src, mediaStart, baseDir, downloadDir, tagName19) {
|
|
96435
96551
|
let filePath = src;
|
|
96436
96552
|
if (isHttpUrl(src)) {
|
|
96437
|
-
if (!existsSync42(downloadDir))
|
|
96553
|
+
if (!existsSync42(downloadDir)) mkdirSync23(downloadDir, { recursive: true });
|
|
96438
96554
|
try {
|
|
96439
96555
|
filePath = await downloadToTemp(src, downloadDir);
|
|
96440
96556
|
} catch {
|
|
@@ -96539,7 +96655,7 @@ async function parseSubCompositions(html, projectDir, downloadDir, parentOffset
|
|
|
96539
96655
|
workItems.map(async (item) => {
|
|
96540
96656
|
const { html: compiledSub } = await compileHtmlFile(
|
|
96541
96657
|
item.rawSubHtml,
|
|
96542
|
-
|
|
96658
|
+
dirname16(item.filePath),
|
|
96543
96659
|
downloadDir
|
|
96544
96660
|
);
|
|
96545
96661
|
const nested = await parseSubCompositions(
|
|
@@ -96919,7 +97035,7 @@ function collectExternalAssets(html, projectDir) {
|
|
|
96919
97035
|
}
|
|
96920
97036
|
async function downloadAndRewriteUrls(urlSet, html, remoteDir, warnLabel, logLabel, extraRewrite) {
|
|
96921
97037
|
if (urlSet.size === 0) return { html, remoteMediaAssets: /* @__PURE__ */ new Map() };
|
|
96922
|
-
if (!existsSync42(remoteDir))
|
|
97038
|
+
if (!existsSync42(remoteDir)) mkdirSync23(remoteDir, { recursive: true });
|
|
96923
97039
|
const urlToLocal = /* @__PURE__ */ new Map();
|
|
96924
97040
|
await Promise.all(
|
|
96925
97041
|
[...urlSet].map(async (url) => {
|
|
@@ -98020,7 +98136,7 @@ var init_probeStage = __esm({
|
|
|
98020
98136
|
|
|
98021
98137
|
// ../producer/src/services/render/stages/extractVideosStage.ts
|
|
98022
98138
|
import { existsSync as existsSync43 } from "fs";
|
|
98023
|
-
import { isAbsolute as
|
|
98139
|
+
import { isAbsolute as isAbsolute12, join as join47 } from "path";
|
|
98024
98140
|
async function runExtractVideosStage(input2) {
|
|
98025
98141
|
const {
|
|
98026
98142
|
projectDir,
|
|
@@ -98044,7 +98160,7 @@ async function runExtractVideosStage(input2) {
|
|
|
98044
98160
|
log2?.info("Probing video color spaces...", { videoCount: composition.videos.length });
|
|
98045
98161
|
await Promise.all(
|
|
98046
98162
|
composition.videos.map(async (v2) => {
|
|
98047
|
-
const videoPath =
|
|
98163
|
+
const videoPath = isAbsolute12(v2.src) ? v2.src : resolveProjectRelativeSrc(v2.src, projectDir, compiledDir);
|
|
98048
98164
|
if (!existsSync43(videoPath)) return;
|
|
98049
98165
|
const meta = await extractMediaMetadata(videoPath);
|
|
98050
98166
|
if (isHdrColorSpace(meta.colorSpace)) {
|
|
@@ -98753,7 +98869,7 @@ var init_hdrCompositor = __esm({
|
|
|
98753
98869
|
});
|
|
98754
98870
|
|
|
98755
98871
|
// ../producer/src/services/render/stages/captureHdrFrameShared.ts
|
|
98756
|
-
import { rmSync as
|
|
98872
|
+
import { rmSync as rmSync10 } from "fs";
|
|
98757
98873
|
function shouldUseHybridLayeredPath(args) {
|
|
98758
98874
|
if (args.hasHdrContent) return false;
|
|
98759
98875
|
if (args.workerCount <= 1) return false;
|
|
@@ -98977,7 +99093,7 @@ function cleanupEndedHdrVideos(args) {
|
|
|
98977
99093
|
if (frameSource) {
|
|
98978
99094
|
closeHdrVideoFrameSource(frameSource, log2);
|
|
98979
99095
|
try {
|
|
98980
|
-
|
|
99096
|
+
rmSync10(frameSource.dir, { recursive: true, force: true });
|
|
98981
99097
|
} catch (err) {
|
|
98982
99098
|
log2.warn("Failed to clean up HDR raw frame directory", {
|
|
98983
99099
|
videoId,
|
|
@@ -99250,7 +99366,7 @@ import {
|
|
|
99250
99366
|
closeSync as closeSync3,
|
|
99251
99367
|
constants as constants2,
|
|
99252
99368
|
fstatSync as fstatSync2,
|
|
99253
|
-
mkdirSync as
|
|
99369
|
+
mkdirSync as mkdirSync24,
|
|
99254
99370
|
mkdtempSync as mkdtempSync2,
|
|
99255
99371
|
openSync as openSync2,
|
|
99256
99372
|
readFileSync as readFileSync33
|
|
@@ -99342,7 +99458,7 @@ async function extractHdrVideoFrames(args) {
|
|
|
99342
99458
|
for (const [videoId, srcPath] of prep.hdrVideoSrcPaths) {
|
|
99343
99459
|
const video = composition.videos.find((v2) => v2.id === videoId);
|
|
99344
99460
|
if (!video) continue;
|
|
99345
|
-
|
|
99461
|
+
mkdirSync24(framesDir, { recursive: true });
|
|
99346
99462
|
const frameDir = mkdtempSync2(join50(framesDir, `hdr_${tempDirSafePrefix(videoId)}-`));
|
|
99347
99463
|
const duration = video.end - video.start;
|
|
99348
99464
|
const dims = prep.hdrExtractionDims.get(videoId) ?? { width, height };
|
|
@@ -99625,7 +99741,7 @@ var init_captureHdrSequentialLoop = __esm({
|
|
|
99625
99741
|
// ../producer/src/services/shaderTransitionWorkerPool.ts
|
|
99626
99742
|
import { Worker } from "worker_threads";
|
|
99627
99743
|
import { fileURLToPath as fileURLToPath4, pathToFileURL } from "url";
|
|
99628
|
-
import { dirname as
|
|
99744
|
+
import { dirname as dirname17, join as join52 } from "path";
|
|
99629
99745
|
import { createRequire } from "module";
|
|
99630
99746
|
import { existsSync as existsSync44 } from "fs";
|
|
99631
99747
|
import { cpus as cpus3 } from "os";
|
|
@@ -99638,7 +99754,7 @@ function resolveWorkerEntry(explicit) {
|
|
|
99638
99754
|
const isTs = override.endsWith(".ts");
|
|
99639
99755
|
return { path: override, isTs };
|
|
99640
99756
|
}
|
|
99641
|
-
const moduleDir =
|
|
99757
|
+
const moduleDir = dirname17(fileURLToPath4(import.meta.url));
|
|
99642
99758
|
const jsPath = join52(moduleDir, "shaderTransitionWorker.js");
|
|
99643
99759
|
if (existsSync44(jsPath)) return { path: jsPath, isTs: false };
|
|
99644
99760
|
const tsPath = join52(moduleDir, "shaderTransitionWorker.ts");
|
|
@@ -100061,7 +100177,7 @@ var init_captureHdrHybridLoop = __esm({
|
|
|
100061
100177
|
});
|
|
100062
100178
|
|
|
100063
100179
|
// ../producer/src/services/render/stages/captureHdrStage.ts
|
|
100064
|
-
import { existsSync as existsSync45, mkdirSync as
|
|
100180
|
+
import { existsSync as existsSync45, mkdirSync as mkdirSync25 } from "fs";
|
|
100065
100181
|
import { join as join54 } from "path";
|
|
100066
100182
|
async function runCaptureHdrStage(input2) {
|
|
100067
100183
|
const {
|
|
@@ -100223,7 +100339,7 @@ async function runCaptureHdrStage(input2) {
|
|
|
100223
100339
|
const debugDumpEnabled = process.env.KEEP_TEMP === "1";
|
|
100224
100340
|
const debugDumpDir = debugDumpEnabled ? join54(framesDir, "debug-composite") : null;
|
|
100225
100341
|
if (debugDumpDir && !existsSync45(debugDumpDir)) {
|
|
100226
|
-
|
|
100342
|
+
mkdirSync25(debugDumpDir, { recursive: true });
|
|
100227
100343
|
}
|
|
100228
100344
|
const compositeTransfer = resolveCompositeTransfer(hasHdrContent, effectiveHdr);
|
|
100229
100345
|
const hdrTargetTransfer = compositeTransfer === "srgb" ? void 0 : compositeTransfer;
|
|
@@ -100424,8 +100540,8 @@ var init_gifEncodeArgs = __esm({
|
|
|
100424
100540
|
});
|
|
100425
100541
|
|
|
100426
100542
|
// ../producer/src/services/render/stages/encodeStage.ts
|
|
100427
|
-
import { copyFileSync as copyFileSync4, existsSync as existsSync46, mkdirSync as
|
|
100428
|
-
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";
|
|
100429
100545
|
function resolveGifLoop(loop) {
|
|
100430
100546
|
const resolved = loop ?? 0;
|
|
100431
100547
|
if (!Number.isInteger(resolved) || resolved < 0 || resolved > 65535) {
|
|
@@ -100435,7 +100551,7 @@ function resolveGifLoop(loop) {
|
|
|
100435
100551
|
}
|
|
100436
100552
|
async function encodeGifFromDir(framesDir, framePattern, outputPath, input2) {
|
|
100437
100553
|
const startTime = Date.now();
|
|
100438
|
-
const files =
|
|
100554
|
+
const files = readdirSync18(framesDir).filter((file) => file.match(/\.(jpg|jpeg|png)$/i));
|
|
100439
100555
|
const frameCount = files.length;
|
|
100440
100556
|
if (frameCount === 0) {
|
|
100441
100557
|
return {
|
|
@@ -100484,7 +100600,7 @@ async function encodeGifFromDir(framesDir, framePattern, outputPath, input2) {
|
|
|
100484
100600
|
error: formatFfmpegError(gifResult.exitCode, gifResult.stderr)
|
|
100485
100601
|
};
|
|
100486
100602
|
}
|
|
100487
|
-
const fileSize = existsSync46(outputPath) ?
|
|
100603
|
+
const fileSize = existsSync46(outputPath) ? statSync14(outputPath).size : 0;
|
|
100488
100604
|
return {
|
|
100489
100605
|
success: true,
|
|
100490
100606
|
outputPath,
|
|
@@ -100493,7 +100609,7 @@ async function encodeGifFromDir(framesDir, framePattern, outputPath, input2) {
|
|
|
100493
100609
|
fileSize
|
|
100494
100610
|
};
|
|
100495
100611
|
} finally {
|
|
100496
|
-
|
|
100612
|
+
rmSync11(input2.palettePath, { force: true });
|
|
100497
100613
|
}
|
|
100498
100614
|
}
|
|
100499
100615
|
async function runEncodeStage(input2) {
|
|
@@ -100522,8 +100638,8 @@ async function runEncodeStage(input2) {
|
|
|
100522
100638
|
const stage5Start = Date.now();
|
|
100523
100639
|
if (isPngSequence) {
|
|
100524
100640
|
updateJobStatus(job, "encoding", "Writing PNG sequence", 75, onProgress);
|
|
100525
|
-
if (!existsSync46(outputPath))
|
|
100526
|
-
const captured =
|
|
100641
|
+
if (!existsSync46(outputPath)) mkdirSync26(outputPath, { recursive: true });
|
|
100642
|
+
const captured = readdirSync18(framesDir).filter((name) => name.endsWith(".png")).sort();
|
|
100527
100643
|
if (captured.length === 0) {
|
|
100528
100644
|
throw new Error(
|
|
100529
100645
|
`[Render] png-sequence output requested but no PNGs were captured to ${framesDir}`
|
|
@@ -100550,7 +100666,7 @@ async function runEncodeStage(input2) {
|
|
|
100550
100666
|
const encodeResult2 = await encodeGifFromDir(framesDir, framePattern2, outputPath, {
|
|
100551
100667
|
fps: job.config.fps,
|
|
100552
100668
|
loop,
|
|
100553
|
-
palettePath: join56(
|
|
100669
|
+
palettePath: join56(dirname18(videoOnlyPath), "gif-palette.png"),
|
|
100554
100670
|
signal: abortSignal,
|
|
100555
100671
|
timeout: engineCfg.ffmpegEncodeTimeout
|
|
100556
100672
|
});
|
|
@@ -100666,17 +100782,17 @@ var init_assembleStage = __esm({
|
|
|
100666
100782
|
// ../producer/src/services/renderOrchestrator.ts
|
|
100667
100783
|
import {
|
|
100668
100784
|
existsSync as existsSync47,
|
|
100669
|
-
mkdirSync as
|
|
100785
|
+
mkdirSync as mkdirSync27,
|
|
100670
100786
|
mkdtempSync as mkdtempSync3,
|
|
100671
100787
|
readFileSync as readFileSync34,
|
|
100672
|
-
readdirSync as
|
|
100673
|
-
rmSync as
|
|
100674
|
-
statSync as
|
|
100788
|
+
readdirSync as readdirSync19,
|
|
100789
|
+
rmSync as rmSync12,
|
|
100790
|
+
statSync as statSync15,
|
|
100675
100791
|
writeFileSync as writeFileSync19,
|
|
100676
100792
|
copyFileSync as copyFileSync5,
|
|
100677
100793
|
appendFileSync
|
|
100678
100794
|
} from "fs";
|
|
100679
|
-
import { join as join57, dirname as
|
|
100795
|
+
import { join as join57, dirname as dirname19, resolve as resolve26 } from "path";
|
|
100680
100796
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
100681
100797
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
100682
100798
|
function sampleDirectoryBytes(dir) {
|
|
@@ -100687,14 +100803,14 @@ function sampleDirectoryBytes(dir) {
|
|
|
100687
100803
|
if (!current2) continue;
|
|
100688
100804
|
let entries2 = [];
|
|
100689
100805
|
try {
|
|
100690
|
-
entries2 =
|
|
100806
|
+
entries2 = readdirSync19(current2);
|
|
100691
100807
|
} catch {
|
|
100692
100808
|
continue;
|
|
100693
100809
|
}
|
|
100694
100810
|
for (const name of entries2) {
|
|
100695
100811
|
const full2 = join57(current2, name);
|
|
100696
100812
|
try {
|
|
100697
|
-
const st3 =
|
|
100813
|
+
const st3 = statSync15(full2);
|
|
100698
100814
|
if (st3.isDirectory()) {
|
|
100699
100815
|
stack.push(full2);
|
|
100700
100816
|
} else if (st3.isFile()) {
|
|
@@ -101011,11 +101127,11 @@ function extractStandaloneEntryFromIndex(indexHtml, entryFile) {
|
|
|
101011
101127
|
return document2.toString();
|
|
101012
101128
|
}
|
|
101013
101129
|
async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSignal) {
|
|
101014
|
-
const moduleDir =
|
|
101130
|
+
const moduleDir = dirname19(fileURLToPath5(import.meta.url));
|
|
101015
101131
|
const producerRoot = process.env.PRODUCER_RENDERS_DIR ? resolve26(process.env.PRODUCER_RENDERS_DIR, "..") : resolve26(moduleDir, "../..");
|
|
101016
101132
|
const debugDir = join57(producerRoot, ".debug");
|
|
101017
|
-
const outputDir =
|
|
101018
|
-
if (!existsSync47(outputDir))
|
|
101133
|
+
const outputDir = dirname19(outputPath);
|
|
101134
|
+
if (!existsSync47(outputDir)) mkdirSync27(outputDir, { recursive: true });
|
|
101019
101135
|
const workDir = job.config.debug ? join57(debugDir, job.id) : mkdtempSync3(join57(outputDir, `work-${job.id}-`));
|
|
101020
101136
|
const pipelineStart = Date.now();
|
|
101021
101137
|
const log2 = job.config.logger ?? defaultLogger;
|
|
@@ -101069,7 +101185,7 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
|
|
|
101069
101185
|
job.startedAt = /* @__PURE__ */ new Date();
|
|
101070
101186
|
assertNotAborted();
|
|
101071
101187
|
assertConfiguredFfmpegBinariesExist();
|
|
101072
|
-
if (!existsSync47(workDir))
|
|
101188
|
+
if (!existsSync47(workDir)) mkdirSync27(workDir, { recursive: true });
|
|
101073
101189
|
if (job.config.debug) {
|
|
101074
101190
|
const logPath = join57(workDir, "render.log");
|
|
101075
101191
|
restoreLogger = installDebugLogger(logPath, log2);
|
|
@@ -101313,7 +101429,7 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
|
|
|
101313
101429
|
throw new Error("File server failed to initialize before frame capture");
|
|
101314
101430
|
}
|
|
101315
101431
|
const framesDir = join57(workDir, "captured-frames");
|
|
101316
|
-
if (!existsSync47(framesDir))
|
|
101432
|
+
if (!existsSync47(framesDir)) mkdirSync27(framesDir, { recursive: true });
|
|
101317
101433
|
const captureOptions = {
|
|
101318
101434
|
width,
|
|
101319
101435
|
height,
|
|
@@ -101742,7 +101858,7 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
|
|
|
101742
101858
|
await safeCleanup(
|
|
101743
101859
|
"remove workDir",
|
|
101744
101860
|
() => {
|
|
101745
|
-
|
|
101861
|
+
rmSync12(workDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
|
101746
101862
|
},
|
|
101747
101863
|
log2
|
|
101748
101864
|
);
|
|
@@ -101883,7 +101999,7 @@ var init_config3 = __esm({
|
|
|
101883
101999
|
});
|
|
101884
102000
|
|
|
101885
102001
|
// ../producer/src/services/hyperframeLint.ts
|
|
101886
|
-
import { existsSync as existsSync48, readFileSync as readFileSync35, statSync as
|
|
102002
|
+
import { existsSync as existsSync48, readFileSync as readFileSync35, statSync as statSync16 } from "fs";
|
|
101887
102003
|
import { resolve as resolve27, join as join58 } from "path";
|
|
101888
102004
|
function isStringRecord(value) {
|
|
101889
102005
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
@@ -101912,7 +102028,7 @@ function pickEntryFile(files, preferredEntryFile) {
|
|
|
101912
102028
|
}
|
|
101913
102029
|
function readProjectEntryFile(projectDir, preferredEntryFile) {
|
|
101914
102030
|
const absProjectDir = resolve27(projectDir);
|
|
101915
|
-
if (!existsSync48(absProjectDir) || !
|
|
102031
|
+
if (!existsSync48(absProjectDir) || !statSync16(absProjectDir).isDirectory()) {
|
|
101916
102032
|
return { error: `Project directory not found: ${absProjectDir}` };
|
|
101917
102033
|
}
|
|
101918
102034
|
const entryCandidates = [preferredEntryFile, "index.html", "src/index.html"].filter(
|
|
@@ -101923,7 +102039,7 @@ function readProjectEntryFile(projectDir, preferredEntryFile) {
|
|
|
101923
102039
|
if (!absoluteEntryPath.startsWith(absProjectDir)) {
|
|
101924
102040
|
return { error: `Entry file must stay inside project directory: ${entryFile}` };
|
|
101925
102041
|
}
|
|
101926
|
-
if (existsSync48(absoluteEntryPath) &&
|
|
102042
|
+
if (existsSync48(absoluteEntryPath) && statSync16(absoluteEntryPath).isFile()) {
|
|
101927
102043
|
return {
|
|
101928
102044
|
entryFile,
|
|
101929
102045
|
html: readFileSync35(absoluteEntryPath, "utf-8"),
|
|
@@ -101981,7 +102097,7 @@ var init_hyperframeLint = __esm({
|
|
|
101981
102097
|
// ../producer/src/services/healthWorker.ts
|
|
101982
102098
|
import { Worker as Worker2 } from "worker_threads";
|
|
101983
102099
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
101984
|
-
import { dirname as
|
|
102100
|
+
import { dirname as dirname20, join as join59 } from "path";
|
|
101985
102101
|
import { existsSync as existsSync49 } from "fs";
|
|
101986
102102
|
async function startHealthWorker(options = {}) {
|
|
101987
102103
|
const log2 = options.logger ?? defaultLogger2();
|
|
@@ -102055,7 +102171,7 @@ function defaultLogger2() {
|
|
|
102055
102171
|
};
|
|
102056
102172
|
}
|
|
102057
102173
|
function resolveWorkerEntry2() {
|
|
102058
|
-
const here =
|
|
102174
|
+
const here = dirname20(fileURLToPath6(import.meta.url));
|
|
102059
102175
|
const candidates = [join59(here, "healthWorkerThread.js"), join59(here, "healthWorkerThread.ts")];
|
|
102060
102176
|
for (const candidate of candidates) {
|
|
102061
102177
|
if (existsSync49(candidate)) return candidate;
|
|
@@ -102114,14 +102230,14 @@ var init_semaphore = __esm({
|
|
|
102114
102230
|
// ../producer/src/server.ts
|
|
102115
102231
|
import {
|
|
102116
102232
|
existsSync as existsSync50,
|
|
102117
|
-
mkdirSync as
|
|
102118
|
-
statSync as
|
|
102233
|
+
mkdirSync as mkdirSync28,
|
|
102234
|
+
statSync as statSync17,
|
|
102119
102235
|
mkdtempSync as mkdtempSync4,
|
|
102120
102236
|
writeFileSync as writeFileSync20,
|
|
102121
|
-
rmSync as
|
|
102237
|
+
rmSync as rmSync13,
|
|
102122
102238
|
createReadStream as createReadStream2
|
|
102123
102239
|
} from "fs";
|
|
102124
|
-
import { resolve as resolve28, dirname as
|
|
102240
|
+
import { resolve as resolve28, dirname as dirname21, join as join60 } from "path";
|
|
102125
102241
|
import { tmpdir as tmpdir4 } from "os";
|
|
102126
102242
|
import { parseArgs as parseArgs2 } from "util";
|
|
102127
102243
|
import crypto2 from "crypto";
|
|
@@ -102181,8 +102297,8 @@ function buildRenderJobConfig(input2, log2) {
|
|
|
102181
102297
|
function resolvePreparedRenderOutput(prepared, rendersDir, log2) {
|
|
102182
102298
|
const { input: input2, cleanupProjectDir } = prepared;
|
|
102183
102299
|
const absoluteOutputPath = resolveOutputPath(input2.projectDir, input2.outputPath, rendersDir, log2);
|
|
102184
|
-
const outputDir =
|
|
102185
|
-
if (!existsSync50(outputDir))
|
|
102300
|
+
const outputDir = dirname21(absoluteOutputPath);
|
|
102301
|
+
if (!existsSync50(outputDir)) mkdirSync28(outputDir, { recursive: true });
|
|
102186
102302
|
return { input: input2, cleanupProjectDir, absoluteOutputPath };
|
|
102187
102303
|
}
|
|
102188
102304
|
function validateRenderOverrides(body) {
|
|
@@ -102212,7 +102328,7 @@ async function prepareRenderBody(body) {
|
|
|
102212
102328
|
const projectDir = typeof body.projectDir === "string" ? body.projectDir : void 0;
|
|
102213
102329
|
if (projectDir) {
|
|
102214
102330
|
const absProjectDir = resolve28(projectDir);
|
|
102215
|
-
if (!existsSync50(absProjectDir) || !
|
|
102331
|
+
if (!existsSync50(absProjectDir) || !statSync17(absProjectDir).isDirectory()) {
|
|
102216
102332
|
return { error: `Project directory not found: ${absProjectDir}` };
|
|
102217
102333
|
}
|
|
102218
102334
|
const entry = options.entryFile || "index.html";
|
|
@@ -102293,7 +102409,7 @@ function createArtifactStore(ttlMs) {
|
|
|
102293
102409
|
function cleanupTempDir(dir, log2) {
|
|
102294
102410
|
if (!dir) return;
|
|
102295
102411
|
try {
|
|
102296
|
-
|
|
102412
|
+
rmSync13(dir, { recursive: true, force: true });
|
|
102297
102413
|
} catch (error) {
|
|
102298
102414
|
log2.warn("Failed to cleanup temp project dir", {
|
|
102299
102415
|
cleanupProjectDir: dir,
|
|
@@ -102379,7 +102495,7 @@ function createRenderHandlers(options = {}) {
|
|
|
102379
102495
|
log2.info(`render progress ${pct}%`, { requestId, stage: j3.currentStage, message });
|
|
102380
102496
|
}
|
|
102381
102497
|
});
|
|
102382
|
-
const fileSize = existsSync50(absoluteOutputPath) ?
|
|
102498
|
+
const fileSize = existsSync50(absoluteOutputPath) ? statSync17(absoluteOutputPath).size : 0;
|
|
102383
102499
|
const durationMs = Date.now() - t0;
|
|
102384
102500
|
const outputToken = store.register(absoluteOutputPath);
|
|
102385
102501
|
const outputUrl = `${outputUrlPrefix}/${outputToken}`;
|
|
@@ -102495,7 +102611,7 @@ function createRenderHandlers(options = {}) {
|
|
|
102495
102611
|
},
|
|
102496
102612
|
abortController.signal
|
|
102497
102613
|
);
|
|
102498
|
-
const fileSize = existsSync50(absoluteOutputPath) ?
|
|
102614
|
+
const fileSize = existsSync50(absoluteOutputPath) ? statSync17(absoluteOutputPath).size : 0;
|
|
102499
102615
|
const outputToken = store.register(absoluteOutputPath);
|
|
102500
102616
|
const outputUrl = `${outputUrlPrefix}/${outputToken}`;
|
|
102501
102617
|
log2.info("render-stream completed", { requestId, fileSize, perf: job.perfSummary ?? null });
|
|
@@ -102558,7 +102674,7 @@ function createRenderHandlers(options = {}) {
|
|
|
102558
102674
|
store.delete(token);
|
|
102559
102675
|
return c3.json({ success: false, error: "Output artifact file missing" }, 404);
|
|
102560
102676
|
}
|
|
102561
|
-
const stats =
|
|
102677
|
+
const stats = statSync17(artifact.path);
|
|
102562
102678
|
return new Response(createReadStream2(artifact.path), {
|
|
102563
102679
|
headers: {
|
|
102564
102680
|
"content-type": "video/mp4",
|
|
@@ -102722,8 +102838,8 @@ var init_planHash = __esm({
|
|
|
102722
102838
|
});
|
|
102723
102839
|
|
|
102724
102840
|
// ../producer/src/services/render/stages/freezePlan.ts
|
|
102725
|
-
import { existsSync as existsSync51, mkdirSync as
|
|
102726
|
-
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";
|
|
102727
102843
|
function stripUndefined(value) {
|
|
102728
102844
|
if (Array.isArray(value)) return value.map(stripUndefined);
|
|
102729
102845
|
if (value !== null && typeof value === "object") {
|
|
@@ -102742,14 +102858,14 @@ function listPlanFiles(planDir) {
|
|
|
102742
102858
|
const results = [];
|
|
102743
102859
|
const rootResolved = resolve29(planDir);
|
|
102744
102860
|
function walk(dir) {
|
|
102745
|
-
const entries2 =
|
|
102861
|
+
const entries2 = readdirSync20(dir, { withFileTypes: true });
|
|
102746
102862
|
for (const entry of entries2) {
|
|
102747
102863
|
const full2 = join61(dir, entry.name);
|
|
102748
102864
|
if (entry.isDirectory()) {
|
|
102749
102865
|
walk(full2);
|
|
102750
102866
|
} else if (entry.isFile()) {
|
|
102751
102867
|
results.push({
|
|
102752
|
-
planRelativePath:
|
|
102868
|
+
planRelativePath: relative10(rootResolved, full2).split(/[\\/]+/).join("/"),
|
|
102753
102869
|
absolutePath: full2
|
|
102754
102870
|
});
|
|
102755
102871
|
}
|
|
@@ -102818,7 +102934,7 @@ async function freezePlan(input2) {
|
|
|
102818
102934
|
throw new Error(`[freezePlan] planDir does not exist: ${planDir}`);
|
|
102819
102935
|
}
|
|
102820
102936
|
const metaDir = join61(planDir, "meta");
|
|
102821
|
-
if (!existsSync51(metaDir))
|
|
102937
|
+
if (!existsSync51(metaDir)) mkdirSync29(metaDir, { recursive: true });
|
|
102822
102938
|
writeFileSync21(
|
|
102823
102939
|
join61(metaDir, "composition.json"),
|
|
102824
102940
|
`${JSON.stringify(composition, null, 2)}
|
|
@@ -102972,7 +103088,7 @@ var init_runtimeEnvSnapshot = __esm({
|
|
|
102972
103088
|
|
|
102973
103089
|
// ../producer/src/services/distributed/shared.ts
|
|
102974
103090
|
import { execFile as execFileCallback } from "child_process";
|
|
102975
|
-
import { dirname as
|
|
103091
|
+
import { dirname as dirname22, join as join62 } from "path";
|
|
102976
103092
|
import { existsSync as existsSync52, readFileSync as readFileSync37 } from "fs";
|
|
102977
103093
|
import { fileURLToPath as fileURLToPath7 } from "url";
|
|
102978
103094
|
import { promisify as promisify3 } from "util";
|
|
@@ -103008,7 +103124,7 @@ function buildSyntheticRenderJob(input2) {
|
|
|
103008
103124
|
}
|
|
103009
103125
|
function readProducerVersion() {
|
|
103010
103126
|
if (cachedProducerVersion !== null) return cachedProducerVersion;
|
|
103011
|
-
const startDir =
|
|
103127
|
+
const startDir = dirname22(fileURLToPath7(import.meta.url));
|
|
103012
103128
|
let current2 = startDir;
|
|
103013
103129
|
for (let i2 = 0; i2 < 10; i2++) {
|
|
103014
103130
|
const candidate = join62(current2, "package.json");
|
|
@@ -103022,7 +103138,7 @@ function readProducerVersion() {
|
|
|
103022
103138
|
} catch {
|
|
103023
103139
|
}
|
|
103024
103140
|
}
|
|
103025
|
-
const parent =
|
|
103141
|
+
const parent = dirname22(current2);
|
|
103026
103142
|
if (parent === current2) break;
|
|
103027
103143
|
current2 = parent;
|
|
103028
103144
|
}
|
|
@@ -103044,16 +103160,16 @@ var init_shared2 = __esm({
|
|
|
103044
103160
|
|
|
103045
103161
|
// ../producer/src/services/distributed/plan.ts
|
|
103046
103162
|
import {
|
|
103047
|
-
cpSync as
|
|
103163
|
+
cpSync as cpSync3,
|
|
103048
103164
|
existsSync as existsSync53,
|
|
103049
|
-
mkdirSync as
|
|
103050
|
-
readdirSync as
|
|
103165
|
+
mkdirSync as mkdirSync30,
|
|
103166
|
+
readdirSync as readdirSync21,
|
|
103051
103167
|
renameSync as renameSync5,
|
|
103052
|
-
rmSync as
|
|
103053
|
-
statSync as
|
|
103168
|
+
rmSync as rmSync14,
|
|
103169
|
+
statSync as statSync18,
|
|
103054
103170
|
writeFileSync as writeFileSync22
|
|
103055
103171
|
} from "fs";
|
|
103056
|
-
import { join as join63, relative as
|
|
103172
|
+
import { join as join63, relative as relative11, sep as sep6 } from "path";
|
|
103057
103173
|
function formatBytes2(bytes) {
|
|
103058
103174
|
if (bytes < 1024) return `${bytes} B`;
|
|
103059
103175
|
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KiB`;
|
|
@@ -103073,7 +103189,7 @@ function measurePlanDirBytes(planDir) {
|
|
|
103073
103189
|
function walk(dir) {
|
|
103074
103190
|
let entries2;
|
|
103075
103191
|
try {
|
|
103076
|
-
entries2 =
|
|
103192
|
+
entries2 = readdirSync21(dir, { withFileTypes: true });
|
|
103077
103193
|
} catch {
|
|
103078
103194
|
return;
|
|
103079
103195
|
}
|
|
@@ -103083,7 +103199,7 @@ function measurePlanDirBytes(planDir) {
|
|
|
103083
103199
|
walk(full2);
|
|
103084
103200
|
} else if (entry.isFile()) {
|
|
103085
103201
|
try {
|
|
103086
|
-
total +=
|
|
103202
|
+
total += statSync18(full2).size;
|
|
103087
103203
|
} catch {
|
|
103088
103204
|
}
|
|
103089
103205
|
}
|
|
@@ -103217,7 +103333,7 @@ async function plan(projectDir, config, planDir) {
|
|
|
103217
103333
|
useGpu: false,
|
|
103218
103334
|
browserGpuMode: "software"
|
|
103219
103335
|
});
|
|
103220
|
-
if (!existsSync53(planDir))
|
|
103336
|
+
if (!existsSync53(planDir)) mkdirSync30(planDir, { recursive: true });
|
|
103221
103337
|
const log2 = config.logger ?? defaultLogger;
|
|
103222
103338
|
const abortSignal = config.abortSignal;
|
|
103223
103339
|
const assertNotAborted = () => {
|
|
@@ -103251,14 +103367,14 @@ async function plan(projectDir, config, planDir) {
|
|
|
103251
103367
|
throw new Error(`[plan] entry file not found: ${htmlPath}`);
|
|
103252
103368
|
}
|
|
103253
103369
|
const workDir = join63(planDir, ".plan-work");
|
|
103254
|
-
if (!existsSync53(workDir))
|
|
103370
|
+
if (!existsSync53(workDir)) mkdirSync30(workDir, { recursive: true });
|
|
103255
103371
|
const compiledDir = join63(workDir, "compiled");
|
|
103256
|
-
|
|
103257
|
-
|
|
103372
|
+
mkdirSync30(compiledDir, { recursive: true });
|
|
103373
|
+
cpSync3(projectDir, compiledDir, {
|
|
103258
103374
|
recursive: true,
|
|
103259
103375
|
dereference: true,
|
|
103260
103376
|
filter: (src) => {
|
|
103261
|
-
const rel =
|
|
103377
|
+
const rel = relative11(projectDir, src);
|
|
103262
103378
|
if (rel === "" || rel.startsWith("..")) return true;
|
|
103263
103379
|
const firstSegment = rel.split(sep6, 1)[0];
|
|
103264
103380
|
return firstSegment === void 0 || !PLAN_PROJECT_DIR_SKIP_SEGMENTS.has(firstSegment);
|
|
@@ -103348,13 +103464,13 @@ async function plan(projectDir, config, planDir) {
|
|
|
103348
103464
|
});
|
|
103349
103465
|
const stagedVideoFrames = join63(compiledDir, "__hyperframes_video_frames");
|
|
103350
103466
|
const videoFramesDst = join63(planDir, "video-frames");
|
|
103351
|
-
if (existsSync53(videoFramesDst))
|
|
103467
|
+
if (existsSync53(videoFramesDst)) rmSync14(videoFramesDst, { recursive: true, force: true });
|
|
103352
103468
|
if (existsSync53(stagedVideoFrames)) {
|
|
103353
103469
|
renameSync5(stagedVideoFrames, videoFramesDst);
|
|
103354
103470
|
} else {
|
|
103355
|
-
|
|
103471
|
+
mkdirSync30(videoFramesDst, { recursive: true });
|
|
103356
103472
|
}
|
|
103357
|
-
if (existsSync53(finalCompiledDir))
|
|
103473
|
+
if (existsSync53(finalCompiledDir)) rmSync14(finalCompiledDir, { recursive: true, force: true });
|
|
103358
103474
|
renameSync5(compiledDir, finalCompiledDir);
|
|
103359
103475
|
const planVideosJson = {
|
|
103360
103476
|
videos: composition.videos,
|
|
@@ -103367,7 +103483,7 @@ async function plan(projectDir, config, planDir) {
|
|
|
103367
103483
|
metadata: ext.metadata
|
|
103368
103484
|
}))
|
|
103369
103485
|
};
|
|
103370
|
-
|
|
103486
|
+
mkdirSync30(join63(planDir, "meta"), { recursive: true });
|
|
103371
103487
|
writeFileSync22(
|
|
103372
103488
|
join63(planDir, PLAN_VIDEOS_META_RELATIVE_PATH),
|
|
103373
103489
|
JSON.stringify(planVideosJson, null, 2),
|
|
@@ -103416,7 +103532,7 @@ async function plan(projectDir, config, planDir) {
|
|
|
103416
103532
|
format: config.format
|
|
103417
103533
|
};
|
|
103418
103534
|
try {
|
|
103419
|
-
|
|
103535
|
+
rmSync14(workDir, { recursive: true, force: true });
|
|
103420
103536
|
} catch (err) {
|
|
103421
103537
|
log2.warn("[plan] failed to remove temp work dir", {
|
|
103422
103538
|
workDir,
|
|
@@ -103517,7 +103633,7 @@ var init_plan = __esm({
|
|
|
103517
103633
|
|
|
103518
103634
|
// ../producer/src/services/distributed/renderChunk.ts
|
|
103519
103635
|
import { randomBytes as randomBytes2 } from "crypto";
|
|
103520
|
-
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";
|
|
103521
103637
|
import { extname as extname10, join as join64 } from "path";
|
|
103522
103638
|
function rebuildExtractedFramesFromPlanDir(planDir, videos) {
|
|
103523
103639
|
const result = [];
|
|
@@ -103529,7 +103645,7 @@ function rebuildExtractedFramesFromPlanDir(planDir, videos) {
|
|
|
103529
103645
|
);
|
|
103530
103646
|
}
|
|
103531
103647
|
const ext = (extname10(v2.framePattern) || ".jpg").toLowerCase();
|
|
103532
|
-
const frames =
|
|
103648
|
+
const frames = readdirSync22(outputDir).filter((name) => name.toLowerCase().endsWith(ext)).sort();
|
|
103533
103649
|
const framePaths = /* @__PURE__ */ new Map();
|
|
103534
103650
|
for (let i2 = 0; i2 < frames.length; i2++) {
|
|
103535
103651
|
const frameName = frames[i2];
|
|
@@ -103557,7 +103673,7 @@ function rebuildExtractedFramesFromPlanDir(planDir, videos) {
|
|
|
103557
103673
|
}
|
|
103558
103674
|
function hashChunkOutput(outputPath, kind) {
|
|
103559
103675
|
if (kind === "file") return sha256Hex(readFileSync38(outputPath));
|
|
103560
|
-
const entries2 =
|
|
103676
|
+
const entries2 = readdirSync22(outputPath).filter((name) => /\.(png|jpg|jpeg)$/i.test(name)).sort();
|
|
103561
103677
|
const lines = entries2.map(
|
|
103562
103678
|
(name) => `${name}\0${sha256Hex(readFileSync38(join64(outputPath, name)))}`
|
|
103563
103679
|
);
|
|
@@ -103679,9 +103795,9 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath) {
|
|
|
103679
103795
|
)
|
|
103680
103796
|
) : null;
|
|
103681
103797
|
const workDir = `${outputChunkPath}.work.${process.pid}.${randomBytes2(4).toString("hex")}`;
|
|
103682
|
-
|
|
103798
|
+
mkdirSync31(workDir, { recursive: true });
|
|
103683
103799
|
const framesDir = join64(workDir, "captured-frames");
|
|
103684
|
-
|
|
103800
|
+
mkdirSync31(framesDir, { recursive: true });
|
|
103685
103801
|
const fileServer = await createFileServer2({
|
|
103686
103802
|
projectDir: compiledDir,
|
|
103687
103803
|
compiledDir,
|
|
@@ -103760,10 +103876,10 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath) {
|
|
|
103760
103876
|
const effectiveBitrate = encoder.crf != null ? void 0 : encoder.bitrate;
|
|
103761
103877
|
const videoOnlyPath = outputChunkPath;
|
|
103762
103878
|
if (isPngSequence) {
|
|
103763
|
-
if (!existsSync54(outputChunkPath))
|
|
103879
|
+
if (!existsSync54(outputChunkPath)) mkdirSync31(outputChunkPath, { recursive: true });
|
|
103764
103880
|
} else {
|
|
103765
103881
|
const outDir = join64(outputChunkPath, "..");
|
|
103766
|
-
if (!existsSync54(outDir))
|
|
103882
|
+
if (!existsSync54(outDir)) mkdirSync31(outDir, { recursive: true });
|
|
103767
103883
|
}
|
|
103768
103884
|
const encodeStarted = Date.now();
|
|
103769
103885
|
await runEncodeStage({
|
|
@@ -103840,7 +103956,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath) {
|
|
|
103840
103956
|
writeFileSync23(perfPath, `${JSON.stringify(perfPayload2, null, 2)}
|
|
103841
103957
|
`, "utf-8");
|
|
103842
103958
|
try {
|
|
103843
|
-
|
|
103959
|
+
rmSync15(workDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
|
103844
103960
|
} catch (err) {
|
|
103845
103961
|
log2.warn("[renderChunk] failed to remove work dir", {
|
|
103846
103962
|
workDir,
|
|
@@ -103898,7 +104014,7 @@ var init_renderChunk = __esm({
|
|
|
103898
104014
|
|
|
103899
104015
|
// ../producer/src/services/render/audioPadTrim.ts
|
|
103900
104016
|
import { spawn as spawn11 } from "child_process";
|
|
103901
|
-
import { rmSync as
|
|
104017
|
+
import { rmSync as rmSync16 } from "fs";
|
|
103902
104018
|
import { pathToFileURL as pathToFileURL2 } from "url";
|
|
103903
104019
|
function buildPadTrimAudioPlan(audioPath, outputPath, sourceDurationSeconds, targetDurationSeconds, audioInfo = {}) {
|
|
103904
104020
|
const delta = targetDurationSeconds - sourceDurationSeconds;
|
|
@@ -104047,7 +104163,7 @@ async function padOrTrimAudioToVideoFrameCount(input2) {
|
|
|
104047
104163
|
error: `audioPadTrim: failed to materialize ${plan2.operation}: ${err instanceof Error ? err.message : String(err)}`
|
|
104048
104164
|
};
|
|
104049
104165
|
} finally {
|
|
104050
|
-
for (const path2 of plan2.cleanupPaths)
|
|
104166
|
+
for (const path2 of plan2.cleanupPaths) rmSync16(path2, { force: true });
|
|
104051
104167
|
}
|
|
104052
104168
|
return {
|
|
104053
104169
|
success: true,
|
|
@@ -104199,16 +104315,16 @@ var init_audioPadTrim = __esm({
|
|
|
104199
104315
|
|
|
104200
104316
|
// ../producer/src/services/distributed/assemble.ts
|
|
104201
104317
|
import {
|
|
104202
|
-
cpSync as
|
|
104318
|
+
cpSync as cpSync4,
|
|
104203
104319
|
existsSync as existsSync55,
|
|
104204
|
-
mkdirSync as
|
|
104320
|
+
mkdirSync as mkdirSync32,
|
|
104205
104321
|
readFileSync as readFileSync39,
|
|
104206
|
-
readdirSync as
|
|
104207
|
-
rmSync as
|
|
104208
|
-
statSync as
|
|
104322
|
+
readdirSync as readdirSync23,
|
|
104323
|
+
rmSync as rmSync17,
|
|
104324
|
+
statSync as statSync19,
|
|
104209
104325
|
writeFileSync as writeFileSync24
|
|
104210
104326
|
} from "fs";
|
|
104211
|
-
import { dirname as
|
|
104327
|
+
import { dirname as dirname23, join as join65 } from "path";
|
|
104212
104328
|
async function assemble(planDir, chunkPaths, audioPath, outputPath, options) {
|
|
104213
104329
|
const start = Date.now();
|
|
104214
104330
|
const log2 = options?.logger ?? defaultLogger;
|
|
@@ -104237,12 +104353,12 @@ async function assemble(planDir, chunkPaths, audioPath, outputPath, options) {
|
|
|
104237
104353
|
if (plan2.dimensions.format === "png-sequence") {
|
|
104238
104354
|
return mergePngFrameDirs(chunkPaths, outputPath, plan2.totalFrames, audioPath, start);
|
|
104239
104355
|
}
|
|
104240
|
-
if (!existsSync55(
|
|
104241
|
-
|
|
104356
|
+
if (!existsSync55(dirname23(outputPath))) {
|
|
104357
|
+
mkdirSync32(dirname23(outputPath), { recursive: true });
|
|
104242
104358
|
}
|
|
104243
104359
|
const workDir = `${outputPath}.assemble-work`;
|
|
104244
|
-
if (existsSync55(workDir))
|
|
104245
|
-
|
|
104360
|
+
if (existsSync55(workDir)) rmSync17(workDir, { recursive: true, force: true });
|
|
104361
|
+
mkdirSync32(workDir, { recursive: true });
|
|
104246
104362
|
try {
|
|
104247
104363
|
const concatOutputPath = join65(workDir, `concat.${plan2.dimensions.format}`);
|
|
104248
104364
|
const fpsArg = fpsToFfmpegArg({
|
|
@@ -104379,7 +104495,7 @@ async function assemble(planDir, chunkPaths, audioPath, outputPath, options) {
|
|
|
104379
104495
|
}
|
|
104380
104496
|
} finally {
|
|
104381
104497
|
try {
|
|
104382
|
-
|
|
104498
|
+
rmSync17(workDir, { recursive: true, force: true });
|
|
104383
104499
|
} catch (err) {
|
|
104384
104500
|
log2.warn("[assemble] failed to remove work dir", {
|
|
104385
104501
|
workDir,
|
|
@@ -104387,7 +104503,7 @@ async function assemble(planDir, chunkPaths, audioPath, outputPath, options) {
|
|
|
104387
104503
|
});
|
|
104388
104504
|
}
|
|
104389
104505
|
}
|
|
104390
|
-
const fileSize = existsSync55(outputPath) ?
|
|
104506
|
+
const fileSize = existsSync55(outputPath) ? statSync19(outputPath).size : 0;
|
|
104391
104507
|
return {
|
|
104392
104508
|
outputPath,
|
|
104393
104509
|
durationMs: Date.now() - start,
|
|
@@ -104396,22 +104512,22 @@ async function assemble(planDir, chunkPaths, audioPath, outputPath, options) {
|
|
|
104396
104512
|
};
|
|
104397
104513
|
}
|
|
104398
104514
|
function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, startTimeMs) {
|
|
104399
|
-
if (existsSync55(outputPath))
|
|
104400
|
-
|
|
104515
|
+
if (existsSync55(outputPath)) rmSync17(outputPath, { recursive: true, force: true });
|
|
104516
|
+
mkdirSync32(outputPath, { recursive: true });
|
|
104401
104517
|
let globalIdx = 0;
|
|
104402
104518
|
for (const chunkDir of chunkPaths) {
|
|
104403
|
-
if (!
|
|
104519
|
+
if (!statSync19(chunkDir).isDirectory()) {
|
|
104404
104520
|
throw new Error(
|
|
104405
104521
|
`[assemble] png-sequence chunk must be a directory: ${chunkDir} (got a file)`
|
|
104406
104522
|
);
|
|
104407
104523
|
}
|
|
104408
|
-
const frames =
|
|
104524
|
+
const frames = readdirSync23(chunkDir).filter((name) => name.endsWith(".png")).sort();
|
|
104409
104525
|
if (frames.length === 0) {
|
|
104410
104526
|
throw new Error(`[assemble] png-sequence chunk has no frames: ${chunkDir}`);
|
|
104411
104527
|
}
|
|
104412
104528
|
for (const frame of frames) {
|
|
104413
104529
|
const dst = join65(outputPath, formatExportFrameName(globalIdx, "png"));
|
|
104414
|
-
|
|
104530
|
+
cpSync4(join65(chunkDir, frame), dst);
|
|
104415
104531
|
globalIdx += 1;
|
|
104416
104532
|
}
|
|
104417
104533
|
}
|
|
@@ -104422,12 +104538,12 @@ function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, start
|
|
|
104422
104538
|
}
|
|
104423
104539
|
if (audioPath !== null && existsSync55(audioPath)) {
|
|
104424
104540
|
const sidecar = join65(outputPath, "audio.aac");
|
|
104425
|
-
|
|
104541
|
+
cpSync4(audioPath, sidecar);
|
|
104426
104542
|
}
|
|
104427
104543
|
let fileSize = 0;
|
|
104428
|
-
for (const name of
|
|
104544
|
+
for (const name of readdirSync23(outputPath)) {
|
|
104429
104545
|
try {
|
|
104430
|
-
fileSize +=
|
|
104546
|
+
fileSize += statSync19(join65(outputPath, name)).size;
|
|
104431
104547
|
} catch {
|
|
104432
104548
|
}
|
|
104433
104549
|
}
|
|
@@ -104458,9 +104574,9 @@ var init_renderConfigValidation = __esm({
|
|
|
104458
104574
|
});
|
|
104459
104575
|
|
|
104460
104576
|
// ../producer/src/services/distributed/projectHash.ts
|
|
104461
|
-
import { readdirSync as
|
|
104577
|
+
import { readdirSync as readdirSync24, readFileSync as readFileSync40 } from "fs";
|
|
104462
104578
|
import { createHash as createHash12 } from "crypto";
|
|
104463
|
-
import { join as join66, relative as
|
|
104579
|
+
import { join as join66, relative as relative12 } from "path";
|
|
104464
104580
|
var init_projectHash = __esm({
|
|
104465
104581
|
"../producer/src/services/distributed/projectHash.ts"() {
|
|
104466
104582
|
"use strict";
|
|
@@ -104541,7 +104657,7 @@ __export(studioServer_exports, {
|
|
|
104541
104657
|
});
|
|
104542
104658
|
import { Hono as Hono5 } from "hono";
|
|
104543
104659
|
import { streamSSE as streamSSE3 } from "hono/streaming";
|
|
104544
|
-
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";
|
|
104545
104661
|
import { resolve as resolve30, join as join67, basename as basename8 } from "path";
|
|
104546
104662
|
function resolveDistDir() {
|
|
104547
104663
|
return resolveStudioBundle().dir;
|
|
@@ -104994,7 +105110,7 @@ function createStudioServer(options) {
|
|
|
104994
105110
|
});
|
|
104995
105111
|
const serveStudioStaticFile = (c3) => {
|
|
104996
105112
|
const filePath = resolve30(studioDir, c3.req.path.slice(1));
|
|
104997
|
-
if (!existsSync56(filePath) || !
|
|
105113
|
+
if (!existsSync56(filePath) || !statSync20(filePath).isFile()) return c3.text("not found", 404);
|
|
104998
105114
|
const content = readFileSync41(filePath);
|
|
104999
105115
|
return new Response(content, {
|
|
105000
105116
|
headers: { "Content-Type": getMimeType(filePath), "Cache-Control": "no-store" }
|
|
@@ -105104,17 +105220,17 @@ __export(preview_exports, {
|
|
|
105104
105220
|
examples: () => examples2
|
|
105105
105221
|
});
|
|
105106
105222
|
import { spawn as spawn12 } from "child_process";
|
|
105107
|
-
import { existsSync as existsSync57, lstatSync as lstatSync3, symlinkSync as
|
|
105108
|
-
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";
|
|
105109
105225
|
import { fileURLToPath as fileURLToPath8 } from "url";
|
|
105110
105226
|
import { createRequire as createRequire2 } from "module";
|
|
105111
105227
|
async function runDevMode(dir, options) {
|
|
105112
105228
|
const thisFile = fileURLToPath8(import.meta.url);
|
|
105113
|
-
const repoRoot2 = resolve31(
|
|
105229
|
+
const repoRoot2 = resolve31(dirname24(thisFile), "..", "..", "..", "..");
|
|
105114
105230
|
const projectsDir = join68(repoRoot2, "packages", "studio", "data", "projects");
|
|
105115
105231
|
const pName = options?.projectName ?? basename9(dir);
|
|
105116
105232
|
const symlinkPath = join68(projectsDir, pName);
|
|
105117
|
-
|
|
105233
|
+
mkdirSync33(projectsDir, { recursive: true });
|
|
105118
105234
|
let createdSymlink = false;
|
|
105119
105235
|
if (dir !== symlinkPath) {
|
|
105120
105236
|
if (existsSync57(symlinkPath)) {
|
|
@@ -105130,7 +105246,7 @@ async function runDevMode(dir, options) {
|
|
|
105130
105246
|
}
|
|
105131
105247
|
}
|
|
105132
105248
|
if (!existsSync57(symlinkPath)) {
|
|
105133
|
-
|
|
105249
|
+
symlinkSync3(dir, symlinkPath, "dir");
|
|
105134
105250
|
createdSymlink = true;
|
|
105135
105251
|
}
|
|
105136
105252
|
}
|
|
@@ -105201,11 +105317,11 @@ function hasLocalStudio(dir) {
|
|
|
105201
105317
|
}
|
|
105202
105318
|
async function runLocalStudioMode(dir, options) {
|
|
105203
105319
|
const req = createRequire2(join68(dir, "package.json"));
|
|
105204
|
-
const studioPkgPath =
|
|
105320
|
+
const studioPkgPath = dirname24(req.resolve("@hyperframes/studio/package.json"));
|
|
105205
105321
|
const pName = options?.projectName ?? basename9(dir);
|
|
105206
105322
|
const projectsDir = join68(studioPkgPath, "data", "projects");
|
|
105207
105323
|
const symlinkPath = join68(projectsDir, pName);
|
|
105208
|
-
|
|
105324
|
+
mkdirSync33(projectsDir, { recursive: true });
|
|
105209
105325
|
let createdSymlink = false;
|
|
105210
105326
|
if (dir !== symlinkPath) {
|
|
105211
105327
|
if (existsSync57(symlinkPath) && lstatSync3(symlinkPath).isSymbolicLink()) {
|
|
@@ -105214,7 +105330,7 @@ async function runLocalStudioMode(dir, options) {
|
|
|
105214
105330
|
}
|
|
105215
105331
|
}
|
|
105216
105332
|
if (!existsSync57(symlinkPath)) {
|
|
105217
|
-
|
|
105333
|
+
symlinkSync3(dir, symlinkPath, "dir");
|
|
105218
105334
|
createdSymlink = true;
|
|
105219
105335
|
}
|
|
105220
105336
|
}
|
|
@@ -105585,14 +105701,14 @@ __export(init_exports, {
|
|
|
105585
105701
|
});
|
|
105586
105702
|
import {
|
|
105587
105703
|
existsSync as existsSync58,
|
|
105588
|
-
mkdirSync as
|
|
105704
|
+
mkdirSync as mkdirSync34,
|
|
105589
105705
|
copyFileSync as copyFileSync6,
|
|
105590
|
-
cpSync as
|
|
105706
|
+
cpSync as cpSync5,
|
|
105591
105707
|
writeFileSync as writeFileSync26,
|
|
105592
105708
|
readFileSync as readFileSync42,
|
|
105593
|
-
readdirSync as
|
|
105709
|
+
readdirSync as readdirSync25
|
|
105594
105710
|
} from "fs";
|
|
105595
|
-
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";
|
|
105596
105712
|
import { fileURLToPath as fileURLToPath9 } from "url";
|
|
105597
105713
|
import { execFileSync as execFileSync6, spawn as spawn13 } from "child_process";
|
|
105598
105714
|
function probeVideo(filePath) {
|
|
@@ -105668,13 +105784,13 @@ function transcodeToMp4(inputPath, outputPath) {
|
|
|
105668
105784
|
});
|
|
105669
105785
|
}
|
|
105670
105786
|
function resolveAssetDir(devSegments, builtSegments) {
|
|
105671
|
-
const base2 =
|
|
105787
|
+
const base2 = dirname25(fileURLToPath9(import.meta.url));
|
|
105672
105788
|
const devPath = resolve32(base2, ...devSegments);
|
|
105673
105789
|
const builtPath = resolve32(base2, ...builtSegments);
|
|
105674
105790
|
return existsSync58(devPath) ? devPath : builtPath;
|
|
105675
105791
|
}
|
|
105676
105792
|
function getStaticTemplateDir(templateId) {
|
|
105677
|
-
const base2 =
|
|
105793
|
+
const base2 = dirname25(fileURLToPath9(import.meta.url));
|
|
105678
105794
|
const devPath = resolve32(base2, "..", "templates", templateId);
|
|
105679
105795
|
if (existsSync58(devPath)) return devPath;
|
|
105680
105796
|
const registryPath = resolve32(base2, "..", "..", "..", "..", "registry", "examples", templateId);
|
|
@@ -105725,7 +105841,7 @@ function listHtmlFiles(dir) {
|
|
|
105725
105841
|
const files = [];
|
|
105726
105842
|
const ignoredDirs = /* @__PURE__ */ new Set([".git", "dist", "node_modules"]);
|
|
105727
105843
|
function walk(currentDir) {
|
|
105728
|
-
for (const entry of
|
|
105844
|
+
for (const entry of readdirSync25(currentDir, { withFileTypes: true })) {
|
|
105729
105845
|
const entryPath = join69(currentDir, entry.name);
|
|
105730
105846
|
if (entry.isDirectory()) {
|
|
105731
105847
|
if (!ignoredDirs.has(entry.name)) walk(entryPath);
|
|
@@ -105771,7 +105887,7 @@ function writeTailwindSupport(destDir) {
|
|
|
105771
105887
|
}
|
|
105772
105888
|
}
|
|
105773
105889
|
function patchVideoSrc(dir, videoFilename, durationSeconds) {
|
|
105774
|
-
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));
|
|
105775
105891
|
for (const file of htmlFiles) {
|
|
105776
105892
|
let content = readFileSync42(file, "utf-8");
|
|
105777
105893
|
if (videoFilename) {
|
|
@@ -105924,10 +106040,10 @@ function applyResolutionPreset(destDir, resolution) {
|
|
|
105924
106040
|
}
|
|
105925
106041
|
}
|
|
105926
106042
|
async function scaffoldProject(destDir, name, templateId, localVideoName, durationSeconds, tailwind = false, resolution) {
|
|
105927
|
-
|
|
106043
|
+
mkdirSync34(destDir, { recursive: true });
|
|
105928
106044
|
const templateDir = getStaticTemplateDir(templateId);
|
|
105929
106045
|
if (existsSync58(join69(templateDir, "index.html"))) {
|
|
105930
|
-
|
|
106046
|
+
cpSync5(templateDir, destDir, { recursive: true });
|
|
105931
106047
|
} else {
|
|
105932
106048
|
await fetchRemoteTemplate(templateId, destDir);
|
|
105933
106049
|
}
|
|
@@ -105954,7 +106070,7 @@ async function scaffoldProject(destDir, name, templateId, localVideoName, durati
|
|
|
105954
106070
|
writeDefaultPackageJson(destDir, name);
|
|
105955
106071
|
const sharedDir = getSharedTemplateDir();
|
|
105956
106072
|
if (existsSync58(sharedDir)) {
|
|
105957
|
-
for (const entry of
|
|
106073
|
+
for (const entry of readdirSync25(sharedDir, { withFileTypes: true })) {
|
|
105958
106074
|
const src = join69(sharedDir, entry.name);
|
|
105959
106075
|
const dest = resolve32(destDir, entry.name);
|
|
105960
106076
|
if (entry.isFile() || entry.isSymbolicLink()) {
|
|
@@ -106131,7 +106247,7 @@ var init_init = __esm({
|
|
|
106131
106247
|
const templateId2 = exampleFlag ?? "blank";
|
|
106132
106248
|
const name2 = args.name ?? "my-video";
|
|
106133
106249
|
const destDir2 = resolve32(name2);
|
|
106134
|
-
if (existsSync58(destDir2) &&
|
|
106250
|
+
if (existsSync58(destDir2) && readdirSync25(destDir2).length > 0) {
|
|
106135
106251
|
console.error(c.error(`Directory already exists and is not empty: ${name2}`));
|
|
106136
106252
|
process.exit(1);
|
|
106137
106253
|
}
|
|
@@ -106149,7 +106265,7 @@ var init_init = __esm({
|
|
|
106149
106265
|
console.error(c.error(`Audio file not found: ${audioFlag}`));
|
|
106150
106266
|
process.exit(1);
|
|
106151
106267
|
}
|
|
106152
|
-
|
|
106268
|
+
mkdirSync34(destDir2, { recursive: true });
|
|
106153
106269
|
let localVideoName2;
|
|
106154
106270
|
let videoDuration2;
|
|
106155
106271
|
let sourceFilePath2;
|
|
@@ -106211,7 +106327,7 @@ var init_init = __esm({
|
|
|
106211
106327
|
await patchTranscript(destDir2, transcriptFile2);
|
|
106212
106328
|
}
|
|
106213
106329
|
console.log(c.success(`Created ${c.accent(name2 + "/")}`));
|
|
106214
|
-
for (const f3 of
|
|
106330
|
+
for (const f3 of readdirSync25(destDir2).filter((f4) => !f4.startsWith("."))) {
|
|
106215
106331
|
console.log(` ${c.accent(f3)}`);
|
|
106216
106332
|
}
|
|
106217
106333
|
if (!skipSkills) {
|
|
@@ -106271,7 +106387,7 @@ var init_init = __esm({
|
|
|
106271
106387
|
name = nameResult;
|
|
106272
106388
|
}
|
|
106273
106389
|
const destDir = resolve32(name);
|
|
106274
|
-
if (existsSync58(destDir) &&
|
|
106390
|
+
if (existsSync58(destDir) && readdirSync25(destDir).length > 0) {
|
|
106275
106391
|
const overwrite = await ue({
|
|
106276
106392
|
message: `Directory ${c.accent(name)} already exists and is not empty. Overwrite?`,
|
|
106277
106393
|
initialValue: false
|
|
@@ -106291,7 +106407,7 @@ var init_init = __esm({
|
|
|
106291
106407
|
me("Setup cancelled.");
|
|
106292
106408
|
process.exit(1);
|
|
106293
106409
|
}
|
|
106294
|
-
|
|
106410
|
+
mkdirSync34(destDir, { recursive: true });
|
|
106295
106411
|
sourceFilePath = videoPath;
|
|
106296
106412
|
const result = await handleVideoFile(videoPath, destDir, true);
|
|
106297
106413
|
localVideoName = result.localVideoName;
|
|
@@ -106303,7 +106419,7 @@ var init_init = __esm({
|
|
|
106303
106419
|
me("Setup cancelled.");
|
|
106304
106420
|
process.exit(1);
|
|
106305
106421
|
}
|
|
106306
|
-
|
|
106422
|
+
mkdirSync34(destDir, { recursive: true });
|
|
106307
106423
|
sourceFilePath = audioPath;
|
|
106308
106424
|
copyFileSync6(audioPath, resolve32(destDir, basename10(audioPath)));
|
|
106309
106425
|
R2.info(`Audio copied to ${c.accent(basename10(audioPath))}`);
|
|
@@ -106402,7 +106518,7 @@ ${c.dim("Use --example blank for offline use.")}`
|
|
|
106402
106518
|
if (existsSync58(transcriptFile)) {
|
|
106403
106519
|
await patchTranscript(destDir, transcriptFile);
|
|
106404
106520
|
}
|
|
106405
|
-
const files =
|
|
106521
|
+
const files = readdirSync25(destDir);
|
|
106406
106522
|
Se(files.map((f3) => c.accent(f3)).join("\n"), c.success(`Created ${name}/`));
|
|
106407
106523
|
if (!skipSkills) {
|
|
106408
106524
|
await ensureSkillsCurrent(destDir);
|
|
@@ -106475,7 +106591,7 @@ __export(add_exports, {
|
|
|
106475
106591
|
runAdd: () => runAdd
|
|
106476
106592
|
});
|
|
106477
106593
|
import { existsSync as existsSync59 } from "fs";
|
|
106478
|
-
import { resolve as resolve33, relative as
|
|
106594
|
+
import { resolve as resolve33, relative as relative13 } from "path";
|
|
106479
106595
|
function remapTarget(item, originalTarget, paths) {
|
|
106480
106596
|
if (item.type === "hyperframes:block") {
|
|
106481
106597
|
const blocksDir = paths.blocks.replace(/\/+$/, "");
|
|
@@ -106642,7 +106758,7 @@ var init_add = __esm({
|
|
|
106642
106758
|
console.log("");
|
|
106643
106759
|
console.log(`${c.success("\u2713")} Added ${c.accent(result.name)} (${result.type})`);
|
|
106644
106760
|
for (const file of result.written) {
|
|
106645
|
-
console.log(` ${c.dim(
|
|
106761
|
+
console.log(` ${c.dim(relative13(projectDir, file))}`);
|
|
106646
106762
|
}
|
|
106647
106763
|
if (result.snippet) {
|
|
106648
106764
|
console.log("");
|
|
@@ -106856,10 +106972,10 @@ var init_catalog = __esm({
|
|
|
106856
106972
|
|
|
106857
106973
|
// src/utils/compositionServer.ts
|
|
106858
106974
|
import { existsSync as existsSync60 } from "fs";
|
|
106859
|
-
import { resolve as resolve35, dirname as
|
|
106975
|
+
import { resolve as resolve35, dirname as dirname26 } from "path";
|
|
106860
106976
|
import { fileURLToPath as fileURLToPath10 } from "url";
|
|
106861
106977
|
function helperDir() {
|
|
106862
|
-
return
|
|
106978
|
+
return dirname26(fileURLToPath10(import.meta.url));
|
|
106863
106979
|
}
|
|
106864
106980
|
function resolveRuntimePath2() {
|
|
106865
106981
|
const d2 = helperDir();
|
|
@@ -107447,8 +107563,8 @@ var init_present = __esm({
|
|
|
107447
107563
|
});
|
|
107448
107564
|
|
|
107449
107565
|
// src/utils/publishProject.ts
|
|
107450
|
-
import { basename as basename11, dirname as
|
|
107451
|
-
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";
|
|
107452
107568
|
import AdmZip from "adm-zip";
|
|
107453
107569
|
function isRecord3(value) {
|
|
107454
107570
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -107546,23 +107662,23 @@ function shouldIgnoreSegment(segment) {
|
|
|
107546
107662
|
return segment.startsWith(".") || IGNORED_DIRS.has(segment) || IGNORED_FILES.has(segment);
|
|
107547
107663
|
}
|
|
107548
107664
|
function collectProjectFiles(rootDir, currentDir, paths) {
|
|
107549
|
-
for (const entry of
|
|
107665
|
+
for (const entry of readdirSync26(currentDir, { withFileTypes: true })) {
|
|
107550
107666
|
if (shouldIgnoreSegment(entry.name)) continue;
|
|
107551
107667
|
const absolutePath = join70(currentDir, entry.name);
|
|
107552
|
-
const relativePath =
|
|
107668
|
+
const relativePath = relative14(rootDir, absolutePath).replaceAll("\\", "/");
|
|
107553
107669
|
if (!relativePath) continue;
|
|
107554
107670
|
if (entry.isDirectory()) {
|
|
107555
107671
|
collectProjectFiles(rootDir, absolutePath, paths);
|
|
107556
107672
|
continue;
|
|
107557
107673
|
}
|
|
107558
|
-
if (!
|
|
107674
|
+
if (!statSync21(absolutePath).isFile()) continue;
|
|
107559
107675
|
paths.push(relativePath);
|
|
107560
107676
|
}
|
|
107561
107677
|
}
|
|
107562
107678
|
function addExternalAsset(ctx, absPath) {
|
|
107563
107679
|
const existing = ctx.externalMap.get(absPath);
|
|
107564
107680
|
if (existing) return existing;
|
|
107565
|
-
const rel =
|
|
107681
|
+
const rel = relative14(ctx.absProjectDir, absPath).replaceAll("\\", "/");
|
|
107566
107682
|
const stripped = rel.replace(/^(?:\.\.\/)+/, "");
|
|
107567
107683
|
let archivePath = `${EXT_ASSETS_PREFIX}/${stripped}`;
|
|
107568
107684
|
if (ctx.usedArchivePaths.has(archivePath)) {
|
|
@@ -107582,7 +107698,7 @@ function tryResolveExternal(ctx, rawPath, referrerAbsDir) {
|
|
|
107582
107698
|
const absPath = resolve38(referrerAbsDir, rawPath);
|
|
107583
107699
|
if (isPathInside(absPath, ctx.absProjectDir)) return null;
|
|
107584
107700
|
try {
|
|
107585
|
-
if (!existsSync63(absPath) || !
|
|
107701
|
+
if (!existsSync63(absPath) || !statSync21(absPath).isFile()) return null;
|
|
107586
107702
|
} catch {
|
|
107587
107703
|
return null;
|
|
107588
107704
|
}
|
|
@@ -107635,7 +107751,7 @@ function rewriteStyleBlocks(ctx, document2, referrerAbsDir, entryPath) {
|
|
|
107635
107751
|
return modified;
|
|
107636
107752
|
}
|
|
107637
107753
|
function localizeHtmlEntry(ctx, entryPath, content) {
|
|
107638
|
-
const referrerAbsDir = resolve38(ctx.absProjectDir,
|
|
107754
|
+
const referrerAbsDir = resolve38(ctx.absProjectDir, dirname27(entryPath));
|
|
107639
107755
|
const { document: document2 } = parseHTML(content.toString("utf-8"));
|
|
107640
107756
|
const attrsChanged = rewriteHtmlAttributes(ctx, document2, referrerAbsDir, entryPath);
|
|
107641
107757
|
const stylesChanged = rewriteStyleBlocks(ctx, document2, referrerAbsDir, entryPath);
|
|
@@ -107644,7 +107760,7 @@ function localizeHtmlEntry(ctx, entryPath, content) {
|
|
|
107644
107760
|
}
|
|
107645
107761
|
}
|
|
107646
107762
|
function localizeCssEntry(ctx, entryPath, content) {
|
|
107647
|
-
const referrerAbsDir = resolve38(ctx.absProjectDir,
|
|
107763
|
+
const referrerAbsDir = resolve38(ctx.absProjectDir, dirname27(entryPath));
|
|
107648
107764
|
const css = content.toString("utf-8");
|
|
107649
107765
|
if (!css.includes("url(")) return;
|
|
107650
107766
|
const result = rewriteCssUrls(ctx, css, referrerAbsDir, entryPath);
|
|
@@ -108603,8 +108719,8 @@ __export(batchRender_exports, {
|
|
|
108603
108719
|
resolveOutputTemplate: () => resolveOutputTemplate,
|
|
108604
108720
|
runBatchRender: () => runBatchRender
|
|
108605
108721
|
});
|
|
108606
|
-
import { mkdirSync as
|
|
108607
|
-
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";
|
|
108608
108724
|
function isRecord4(value) {
|
|
108609
108725
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
108610
108726
|
}
|
|
@@ -108669,11 +108785,11 @@ function isSameOrChildPath(path2, parent) {
|
|
|
108669
108785
|
function commonOutputDirectory(outputPaths) {
|
|
108670
108786
|
const firstPath = outputPaths[0];
|
|
108671
108787
|
if (!firstPath) return resolve42("renders");
|
|
108672
|
-
let common =
|
|
108788
|
+
let common = dirname28(firstPath);
|
|
108673
108789
|
for (const outputPath of outputPaths.slice(1)) {
|
|
108674
|
-
const dir =
|
|
108790
|
+
const dir = dirname28(outputPath);
|
|
108675
108791
|
while (!isSameOrChildPath(dir, common)) {
|
|
108676
|
-
const parent =
|
|
108792
|
+
const parent = dirname28(common);
|
|
108677
108793
|
if (parent === common) return common;
|
|
108678
108794
|
common = parent;
|
|
108679
108795
|
}
|
|
@@ -108791,7 +108907,7 @@ function summarizeManifest(manifest) {
|
|
|
108791
108907
|
}
|
|
108792
108908
|
function writeManifest(manifest) {
|
|
108793
108909
|
summarizeManifest(manifest);
|
|
108794
|
-
|
|
108910
|
+
mkdirSync35(dirname28(manifest.manifestPath), { recursive: true });
|
|
108795
108911
|
writeFileSync27(manifest.manifestPath, JSON.stringify(manifest, null, 2) + "\n", "utf8");
|
|
108796
108912
|
}
|
|
108797
108913
|
function emitJsonEvent(event, json) {
|
|
@@ -108816,7 +108932,7 @@ async function renderBatchRow(row, manifest, options) {
|
|
|
108816
108932
|
console.log(c.dim(`Batch row ${row.index}: ${row.outputPath}`));
|
|
108817
108933
|
}
|
|
108818
108934
|
try {
|
|
108819
|
-
|
|
108935
|
+
mkdirSync35(dirname28(row.outputPath), { recursive: true });
|
|
108820
108936
|
const result = await options.renderOne(row);
|
|
108821
108937
|
manifestRow.status = "completed";
|
|
108822
108938
|
manifestRow.durationMs = result.durationMs ?? null;
|
|
@@ -108955,9 +109071,9 @@ __export(render_exports, {
|
|
|
108955
109071
|
renderLocal: () => renderLocal,
|
|
108956
109072
|
resolveBrowserGpuForCli: () => resolveBrowserGpuForCli
|
|
108957
109073
|
});
|
|
108958
|
-
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";
|
|
108959
109075
|
import { cpus as cpus4, freemem as freemem5, tmpdir as tmpdir5 } from "os";
|
|
108960
|
-
import { resolve as resolve43, dirname as
|
|
109076
|
+
import { resolve as resolve43, dirname as dirname29, join as join73, basename as basename13 } from "path";
|
|
108961
109077
|
import { execFileSync as execFileSync8, spawn as spawn14 } from "child_process";
|
|
108962
109078
|
function formatFpsParseError(input2, reason) {
|
|
108963
109079
|
switch (reason) {
|
|
@@ -108994,7 +109110,7 @@ function resolveDockerfilePath() {
|
|
|
108994
109110
|
const devPath = resolve43(__dirname, "..", "src", "docker", "Dockerfile.render");
|
|
108995
109111
|
for (const p2 of [builtPath, devPath]) {
|
|
108996
109112
|
try {
|
|
108997
|
-
|
|
109113
|
+
statSync22(p2);
|
|
108998
109114
|
return p2;
|
|
108999
109115
|
} catch {
|
|
109000
109116
|
continue;
|
|
@@ -109023,7 +109139,7 @@ function ensureDockerImage(version2, platform10, quiet) {
|
|
|
109023
109139
|
if (!quiet) console.log(c.dim(` Building Docker image: ${tag} (${platform10})...`));
|
|
109024
109140
|
const dockerfilePath = resolveDockerfilePath();
|
|
109025
109141
|
const tmpDir = join73(tmpdir5(), `hyperframes-docker-${Date.now()}`);
|
|
109026
|
-
|
|
109142
|
+
mkdirSync36(tmpDir, { recursive: true });
|
|
109027
109143
|
writeFileSync28(join73(tmpDir, "Dockerfile"), readFileSync48(dockerfilePath));
|
|
109028
109144
|
const targetArch = platform10 === "linux/arm64" ? "arm64" : "amd64";
|
|
109029
109145
|
try {
|
|
@@ -109047,7 +109163,7 @@ function ensureDockerImage(version2, platform10, quiet) {
|
|
|
109047
109163
|
const message = error instanceof Error ? error.message : String(error);
|
|
109048
109164
|
throw new Error(`Failed to build Docker image: ${message}`);
|
|
109049
109165
|
} finally {
|
|
109050
|
-
|
|
109166
|
+
rmSync18(tmpDir, { recursive: true, force: true });
|
|
109051
109167
|
}
|
|
109052
109168
|
if (!quiet) console.log(c.dim(` Docker image: ${tag} (built)`));
|
|
109053
109169
|
return tag;
|
|
@@ -109091,7 +109207,7 @@ async function renderDocker(projectDir, outputPath, options) {
|
|
|
109091
109207
|
);
|
|
109092
109208
|
process.exit(1);
|
|
109093
109209
|
}
|
|
109094
|
-
const outputDir =
|
|
109210
|
+
const outputDir = dirname29(outputPath);
|
|
109095
109211
|
const outputFilename = basename13(outputPath);
|
|
109096
109212
|
const dockerArgs = buildDockerRunArgs({
|
|
109097
109213
|
imageTag,
|
|
@@ -109409,13 +109525,13 @@ function printRenderComplete(outputPath, elapsedMs, quiet) {
|
|
|
109409
109525
|
if (quiet) return;
|
|
109410
109526
|
let fileSize = "unknown";
|
|
109411
109527
|
try {
|
|
109412
|
-
const stat3 =
|
|
109528
|
+
const stat3 = statSync22(outputPath);
|
|
109413
109529
|
if (stat3.isDirectory()) {
|
|
109414
109530
|
let total = 0;
|
|
109415
|
-
for (const entry of
|
|
109531
|
+
for (const entry of readdirSync27(outputPath, { withFileTypes: true })) {
|
|
109416
109532
|
if (!entry.isFile()) continue;
|
|
109417
109533
|
try {
|
|
109418
|
-
total +=
|
|
109534
|
+
total += statSync22(join73(outputPath, entry.name)).size;
|
|
109419
109535
|
} catch {
|
|
109420
109536
|
}
|
|
109421
109537
|
}
|
|
@@ -109829,7 +109945,7 @@ var init_render2 = __esm({
|
|
|
109829
109945
|
const timePart = now.toTimeString().slice(0, 8).replace(/:/g, "-");
|
|
109830
109946
|
const batchOutputTemplate = args.output ? args.output : join73(rendersDir, `${project.name}_${datePart}_${timePart}_{index}${ext}`);
|
|
109831
109947
|
const outputPath = args.output ? resolve43(args.output) : join73(rendersDir, `${project.name}_${datePart}_${timePart}${ext}`);
|
|
109832
|
-
if (!batchPath)
|
|
109948
|
+
if (!batchPath) mkdirSync36(dirname29(outputPath), { recursive: true });
|
|
109833
109949
|
const useDocker = args.docker ?? false;
|
|
109834
109950
|
const useGpu = args.gpu ?? false;
|
|
109835
109951
|
const browserGpuArg = args["browser-gpu"];
|
|
@@ -109887,7 +110003,7 @@ var init_render2 = __esm({
|
|
|
109887
110003
|
console.log(c.warn(" GIF output is capped at 30fps. Use --fps 15 for smaller files."));
|
|
109888
110004
|
}
|
|
109889
110005
|
const pageNavigationTimeoutMs = resolveBrowserTimeoutMsArg(args["browser-timeout"]);
|
|
109890
|
-
const entryFile = resolveCompositionEntryArg(args.composition, project.dir,
|
|
110006
|
+
const entryFile = resolveCompositionEntryArg(args.composition, project.dir, statSync22);
|
|
109891
110007
|
let batchModule;
|
|
109892
110008
|
let preparedBatch;
|
|
109893
110009
|
if (batchPath) {
|
|
@@ -110280,10 +110396,10 @@ var init_beats = __esm({
|
|
|
110280
110396
|
// src/beats/headlessAnalyzer.ts
|
|
110281
110397
|
import { existsSync as existsSync66, readFileSync as readFileSync49 } from "fs";
|
|
110282
110398
|
import { createRequire as createRequire3 } from "module";
|
|
110283
|
-
import { dirname as
|
|
110399
|
+
import { dirname as dirname30, join as join74 } from "path";
|
|
110284
110400
|
import { fileURLToPath as fileURLToPath11 } from "url";
|
|
110285
110401
|
function findPrebuiltBundle() {
|
|
110286
|
-
const here =
|
|
110402
|
+
const here = dirname30(fileURLToPath11(import.meta.url));
|
|
110287
110403
|
const candidates = [
|
|
110288
110404
|
join74(here, "beat-analyzer.global.js"),
|
|
110289
110405
|
// dist root (tsup-bundled cli)
|
|
@@ -110298,7 +110414,7 @@ function findPrebuiltBundle() {
|
|
|
110298
110414
|
}
|
|
110299
110415
|
async function buildFromCoreSource() {
|
|
110300
110416
|
const esbuild = await import("esbuild");
|
|
110301
|
-
const coreRoot =
|
|
110417
|
+
const coreRoot = dirname30(require2.resolve("@hyperframes/core/package.json"));
|
|
110302
110418
|
const entry = join74(coreRoot, "src/beats/beatDetection.ts");
|
|
110303
110419
|
const result = await esbuild.build({
|
|
110304
110420
|
stdin: {
|
|
@@ -110399,8 +110515,8 @@ __export(beats_exports, {
|
|
|
110399
110515
|
default: () => beats_default,
|
|
110400
110516
|
examples: () => examples11
|
|
110401
110517
|
});
|
|
110402
|
-
import { existsSync as existsSync67, readFileSync as readFileSync50, mkdirSync as
|
|
110403
|
-
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";
|
|
110404
110520
|
function fail(message) {
|
|
110405
110521
|
console.error(c.error(message));
|
|
110406
110522
|
process.exit(1);
|
|
@@ -110471,7 +110587,7 @@ var init_beats2 = __esm({
|
|
|
110471
110587
|
fail(`No beats detected in ${rel} \u2014 nothing written. (Track may be silent/ambient.)`);
|
|
110472
110588
|
}
|
|
110473
110589
|
const outPath = join75(project.dir, "beats", `${rel}.json`);
|
|
110474
|
-
|
|
110590
|
+
mkdirSync37(dirname31(outPath), { recursive: true });
|
|
110475
110591
|
writeFileSync29(outPath, serializeBeats(result.beatTimes, result.beatStrengths, rel));
|
|
110476
110592
|
report(`beats/${rel}.json`, result, Boolean(args.json));
|
|
110477
110593
|
}
|
|
@@ -110486,7 +110602,7 @@ __export(staticProjectServer_exports, {
|
|
|
110486
110602
|
});
|
|
110487
110603
|
import { createServer } from "http";
|
|
110488
110604
|
import { existsSync as existsSync68, readFileSync as readFileSync51 } from "fs";
|
|
110489
|
-
import { isAbsolute as
|
|
110605
|
+
import { isAbsolute as isAbsolute13, relative as relative15, resolve as resolve45 } from "path";
|
|
110490
110606
|
async function serveStaticProjectHtml(projectDir, html, bindErrorMessage = "Failed to bind local HTTP server") {
|
|
110491
110607
|
const server = createServer((req, res) => {
|
|
110492
110608
|
const url = req.url ?? "/";
|
|
@@ -110496,8 +110612,8 @@ async function serveStaticProjectHtml(projectDir, html, bindErrorMessage = "Fail
|
|
|
110496
110612
|
return;
|
|
110497
110613
|
}
|
|
110498
110614
|
const filePath = resolve45(projectDir, decodeURIComponent(url).replace(/^\//, ""));
|
|
110499
|
-
const rel =
|
|
110500
|
-
if (rel.startsWith("..") ||
|
|
110615
|
+
const rel = relative15(projectDir, filePath);
|
|
110616
|
+
if (rel.startsWith("..") || isAbsolute13(rel)) {
|
|
110501
110617
|
res.writeHead(403);
|
|
110502
110618
|
res.end();
|
|
110503
110619
|
return;
|
|
@@ -110896,7 +111012,7 @@ var init_motionAudit = __esm({
|
|
|
110896
111012
|
});
|
|
110897
111013
|
|
|
110898
111014
|
// src/utils/motionSpec.ts
|
|
110899
|
-
import { existsSync as existsSync69, readFileSync as readFileSync52, readdirSync as
|
|
111015
|
+
import { existsSync as existsSync69, readFileSync as readFileSync52, readdirSync as readdirSync28 } from "fs";
|
|
110900
111016
|
import { basename as basename14, join as join76 } from "path";
|
|
110901
111017
|
function isObject2(value) {
|
|
110902
111018
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -110940,7 +111056,7 @@ function parseMotionSpec(raw) {
|
|
|
110940
111056
|
}
|
|
110941
111057
|
function findMotionSpec(projectDir) {
|
|
110942
111058
|
if (!existsSync69(projectDir)) return null;
|
|
110943
|
-
const entries2 =
|
|
111059
|
+
const entries2 = readdirSync28(projectDir);
|
|
110944
111060
|
const sidecars = entries2.filter((name) => name.endsWith(".motion.json")).sort();
|
|
110945
111061
|
if (!sidecars[0]) return null;
|
|
110946
111062
|
if (sidecars.length === 1) return join76(projectDir, sidecars[0]);
|
|
@@ -111010,7 +111126,7 @@ __export(layout_exports, {
|
|
|
111010
111126
|
examples: () => examples12
|
|
111011
111127
|
});
|
|
111012
111128
|
import { existsSync as existsSync70, readFileSync as readFileSync53 } from "fs";
|
|
111013
|
-
import { dirname as
|
|
111129
|
+
import { dirname as dirname32, join as join77 } from "path";
|
|
111014
111130
|
import { fileURLToPath as fileURLToPath12 } from "url";
|
|
111015
111131
|
function buildMotionSampleTimes(duration) {
|
|
111016
111132
|
if (!Number.isFinite(duration) || duration <= 0) return [];
|
|
@@ -111483,7 +111599,7 @@ var init_layout2 = __esm({
|
|
|
111483
111599
|
init_motionAudit();
|
|
111484
111600
|
init_motionSpec();
|
|
111485
111601
|
__filename = fileURLToPath12(import.meta.url);
|
|
111486
|
-
__dirname2 =
|
|
111602
|
+
__dirname2 = dirname32(__filename);
|
|
111487
111603
|
SEEK_SETTLE_MS = 120;
|
|
111488
111604
|
INSPECT_SCHEMA_VERSION = 1;
|
|
111489
111605
|
MOTION_FPS = 20;
|
|
@@ -111542,16 +111658,16 @@ __export(info_exports, {
|
|
|
111542
111658
|
default: () => info_default,
|
|
111543
111659
|
examples: () => examples14
|
|
111544
111660
|
});
|
|
111545
|
-
import { readFileSync as readFileSync54, readdirSync as
|
|
111661
|
+
import { readFileSync as readFileSync54, readdirSync as readdirSync29, statSync as statSync23 } from "fs";
|
|
111546
111662
|
import { join as join78 } from "path";
|
|
111547
111663
|
function totalSize(dir) {
|
|
111548
111664
|
let total = 0;
|
|
111549
|
-
for (const entry of
|
|
111665
|
+
for (const entry of readdirSync29(dir, { withFileTypes: true })) {
|
|
111550
111666
|
const path2 = join78(dir, entry.name);
|
|
111551
111667
|
if (entry.isDirectory()) {
|
|
111552
111668
|
total += totalSize(path2);
|
|
111553
111669
|
} else {
|
|
111554
|
-
total +=
|
|
111670
|
+
total += statSync23(path2).size;
|
|
111555
111671
|
}
|
|
111556
111672
|
}
|
|
111557
111673
|
return total;
|
|
@@ -111638,7 +111754,7 @@ __export(compositions_exports, {
|
|
|
111638
111754
|
parseSubComposition: () => parseSubComposition
|
|
111639
111755
|
});
|
|
111640
111756
|
import { existsSync as existsSync71, readFileSync as readFileSync55 } from "fs";
|
|
111641
|
-
import { resolve as resolve46, dirname as
|
|
111757
|
+
import { resolve as resolve46, dirname as dirname33 } from "path";
|
|
111642
111758
|
function countRenderableDescendants(root) {
|
|
111643
111759
|
return Array.from(root.querySelectorAll("*")).filter(
|
|
111644
111760
|
(el) => !NON_RENDERED_TAGS2.has(el.tagName.toLowerCase())
|
|
@@ -111777,7 +111893,7 @@ var init_compositions = __esm({
|
|
|
111777
111893
|
const project = resolveProject(args.dir);
|
|
111778
111894
|
const html = readFileSync55(project.indexPath, "utf-8");
|
|
111779
111895
|
ensureDOMParser();
|
|
111780
|
-
const compositions = parseCompositions(html,
|
|
111896
|
+
const compositions = parseCompositions(html, dirname33(project.indexPath));
|
|
111781
111897
|
if (compositions.length === 0) {
|
|
111782
111898
|
console.log(`${c.success("\u25C7")} ${c.accent(project.name)} \u2014 no compositions found`);
|
|
111783
111899
|
return;
|
|
@@ -111813,7 +111929,7 @@ __export(benchmark_exports, {
|
|
|
111813
111929
|
default: () => benchmark_default,
|
|
111814
111930
|
examples: () => examples16
|
|
111815
111931
|
});
|
|
111816
|
-
import { existsSync as existsSync72, statSync as
|
|
111932
|
+
import { existsSync as existsSync72, statSync as statSync24 } from "fs";
|
|
111817
111933
|
import { resolve as resolve47, join as join79 } from "path";
|
|
111818
111934
|
var examples16, FPS_30, FPS_60, DEFAULT_CONFIGS, benchmark_default;
|
|
111819
111935
|
var init_benchmark = __esm({
|
|
@@ -111907,7 +112023,7 @@ var init_benchmark = __esm({
|
|
|
111907
112023
|
const elapsedMs = Date.now() - startTime;
|
|
111908
112024
|
let fileSize = null;
|
|
111909
112025
|
if (existsSync72(outputPath)) {
|
|
111910
|
-
const stat3 =
|
|
112026
|
+
const stat3 = statSync24(outputPath);
|
|
111911
112027
|
fileSize = stat3.size;
|
|
111912
112028
|
}
|
|
111913
112029
|
runs.push({ elapsedMs, fileSize });
|
|
@@ -112164,8 +112280,8 @@ __export(manager_exports3, {
|
|
|
112164
112280
|
modelPath: () => modelPath,
|
|
112165
112281
|
selectProviders: () => selectProviders
|
|
112166
112282
|
});
|
|
112167
|
-
import { existsSync as existsSync73, mkdirSync as
|
|
112168
|
-
import { homedir as
|
|
112283
|
+
import { existsSync as existsSync73, mkdirSync as mkdirSync38 } from "fs";
|
|
112284
|
+
import { homedir as homedir11, platform as platform8, arch } from "os";
|
|
112169
112285
|
import { join as join80 } from "path";
|
|
112170
112286
|
function isDevice(value) {
|
|
112171
112287
|
return typeof value === "string" && DEVICES.includes(value);
|
|
@@ -112211,7 +112327,7 @@ function modelPath(model = DEFAULT_MODEL2) {
|
|
|
112211
112327
|
async function ensureModel2(model = DEFAULT_MODEL2, options) {
|
|
112212
112328
|
const dest = modelPath(model);
|
|
112213
112329
|
if (existsSync73(dest)) return dest;
|
|
112214
|
-
|
|
112330
|
+
mkdirSync38(MODELS_DIR2, { recursive: true });
|
|
112215
112331
|
options?.onProgress?.(`Downloading ${model} weights (~168 MB)...`);
|
|
112216
112332
|
await downloadFile(MODEL_URLS[model], dest);
|
|
112217
112333
|
if (!existsSync73(dest)) {
|
|
@@ -112224,7 +112340,7 @@ var init_manager3 = __esm({
|
|
|
112224
112340
|
"src/background-removal/manager.ts"() {
|
|
112225
112341
|
"use strict";
|
|
112226
112342
|
init_download();
|
|
112227
|
-
MODELS_DIR2 = join80(
|
|
112343
|
+
MODELS_DIR2 = join80(homedir11(), ".cache", "hyperframes", "background-removal", "models");
|
|
112228
112344
|
DEFAULT_MODEL2 = "u2net_human_seg";
|
|
112229
112345
|
MODEL_URLS = {
|
|
112230
112346
|
u2net_human_seg: "https://github.com/danielgatis/rembg/releases/download/v0.0.0/u2net_human_seg.onnx"
|
|
@@ -112935,7 +113051,7 @@ __export(transcribe_exports2, {
|
|
|
112935
113051
|
examples: () => examples19
|
|
112936
113052
|
});
|
|
112937
113053
|
import { existsSync as existsSync75, writeFileSync as writeFileSync30 } from "fs";
|
|
112938
|
-
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";
|
|
112939
113055
|
function failWith(message, json) {
|
|
112940
113056
|
trackCommandFailure("transcribe", message);
|
|
112941
113057
|
if (json) {
|
|
@@ -113135,7 +113251,7 @@ var init_transcribe2 = __esm({
|
|
|
113135
113251
|
console.error(c.error(message));
|
|
113136
113252
|
process.exit(1);
|
|
113137
113253
|
}
|
|
113138
|
-
const dir = resolve49(args.dir ??
|
|
113254
|
+
const dir = resolve49(args.dir ?? dirname34(inputPath));
|
|
113139
113255
|
const ext = extname12(inputPath).toLowerCase();
|
|
113140
113256
|
const isImport = ext === ".json" || ext === ".srt" || ext === ".vtt";
|
|
113141
113257
|
const to = parseExportFormat(args.to, args.json);
|
|
@@ -113163,8 +113279,8 @@ var init_transcribe2 = __esm({
|
|
|
113163
113279
|
});
|
|
113164
113280
|
|
|
113165
113281
|
// src/tts/manager.ts
|
|
113166
|
-
import { existsSync as existsSync76, mkdirSync as
|
|
113167
|
-
import { homedir as
|
|
113282
|
+
import { existsSync as existsSync76, mkdirSync as mkdirSync39 } from "fs";
|
|
113283
|
+
import { homedir as homedir12 } from "os";
|
|
113168
113284
|
import { join as join82 } from "path";
|
|
113169
113285
|
function inferLangFromVoiceId(voiceId) {
|
|
113170
113286
|
const first = voiceId.charAt(0).toLowerCase();
|
|
@@ -113182,7 +113298,7 @@ async function ensureModel3(model = DEFAULT_MODEL3, options) {
|
|
|
113182
113298
|
`Unknown TTS model: ${model}. Available: ${Object.keys(MODEL_URLS2).join(", ")}`
|
|
113183
113299
|
);
|
|
113184
113300
|
}
|
|
113185
|
-
|
|
113301
|
+
mkdirSync39(MODELS_DIR3, { recursive: true });
|
|
113186
113302
|
options?.onProgress?.(`Downloading TTS model ${model} (~311 MB)...`);
|
|
113187
113303
|
await downloadFile(url, modelPath2);
|
|
113188
113304
|
if (!existsSync76(modelPath2)) {
|
|
@@ -113193,7 +113309,7 @@ async function ensureModel3(model = DEFAULT_MODEL3, options) {
|
|
|
113193
113309
|
async function ensureVoices(options) {
|
|
113194
113310
|
const voicesPath = join82(VOICES_DIR, "voices-v1.0.bin");
|
|
113195
113311
|
if (existsSync76(voicesPath)) return voicesPath;
|
|
113196
|
-
|
|
113312
|
+
mkdirSync39(VOICES_DIR, { recursive: true });
|
|
113197
113313
|
options?.onProgress?.("Downloading voice data (~27 MB)...");
|
|
113198
113314
|
await downloadFile(VOICES_URL, voicesPath);
|
|
113199
113315
|
if (!existsSync76(voicesPath)) {
|
|
@@ -113206,7 +113322,7 @@ var init_manager4 = __esm({
|
|
|
113206
113322
|
"src/tts/manager.ts"() {
|
|
113207
113323
|
"use strict";
|
|
113208
113324
|
init_download();
|
|
113209
|
-
CACHE_DIR3 = join82(
|
|
113325
|
+
CACHE_DIR3 = join82(homedir12(), ".cache", "hyperframes", "tts");
|
|
113210
113326
|
MODELS_DIR3 = join82(CACHE_DIR3, "models");
|
|
113211
113327
|
VOICES_DIR = join82(CACHE_DIR3, "voices");
|
|
113212
113328
|
DEFAULT_MODEL3 = "kokoro-v1.0";
|
|
@@ -113325,16 +113441,16 @@ __export(synthesize_exports, {
|
|
|
113325
113441
|
synthesize: () => synthesize
|
|
113326
113442
|
});
|
|
113327
113443
|
import { execFileSync as execFileSync10 } from "child_process";
|
|
113328
|
-
import { existsSync as existsSync77, writeFileSync as writeFileSync31, mkdirSync as
|
|
113329
|
-
import { join as join83, dirname as
|
|
113330
|
-
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";
|
|
113331
113447
|
function ensureSynthScript() {
|
|
113332
113448
|
if (!existsSync77(SCRIPT_PATH)) {
|
|
113333
|
-
|
|
113449
|
+
mkdirSync40(SCRIPT_DIR, { recursive: true });
|
|
113334
113450
|
writeFileSync31(SCRIPT_PATH, SYNTH_SCRIPT);
|
|
113335
113451
|
const currentName = basename15(SCRIPT_PATH);
|
|
113336
113452
|
try {
|
|
113337
|
-
for (const entry of
|
|
113453
|
+
for (const entry of readdirSync30(SCRIPT_DIR)) {
|
|
113338
113454
|
if (entry !== currentName && /^synth(-v\d+)?\.py$/.test(entry)) {
|
|
113339
113455
|
try {
|
|
113340
113456
|
unlinkSync7(join83(SCRIPT_DIR, entry));
|
|
@@ -113371,7 +113487,7 @@ async function synthesize(text, outputPath, options) {
|
|
|
113371
113487
|
ensureVoices({ onProgress: options?.onProgress })
|
|
113372
113488
|
]);
|
|
113373
113489
|
const scriptPath = ensureSynthScript();
|
|
113374
|
-
|
|
113490
|
+
mkdirSync40(dirname35(outputPath), { recursive: true });
|
|
113375
113491
|
options?.onProgress?.(`Generating speech with voice ${voice} (${lang})...`);
|
|
113376
113492
|
try {
|
|
113377
113493
|
const stdout2 = execFileSync10(
|
|
@@ -113448,7 +113564,7 @@ print(json.dumps({
|
|
|
113448
113564
|
"langApplied": bool(lang and supports_lang),
|
|
113449
113565
|
}))
|
|
113450
113566
|
`;
|
|
113451
|
-
SCRIPT_DIR = join83(
|
|
113567
|
+
SCRIPT_DIR = join83(homedir13(), ".cache", "hyperframes", "tts");
|
|
113452
113568
|
SCRIPT_PATH = join83(SCRIPT_DIR, "synth-v2.py");
|
|
113453
113569
|
}
|
|
113454
113570
|
});
|
|
@@ -113663,11 +113779,11 @@ __export(docs_exports, {
|
|
|
113663
113779
|
examples: () => examples21
|
|
113664
113780
|
});
|
|
113665
113781
|
import { readFileSync as readFileSync57, existsSync as existsSync79 } from "fs";
|
|
113666
|
-
import { resolve as resolve51, dirname as
|
|
113782
|
+
import { resolve as resolve51, dirname as dirname36, join as join84 } from "path";
|
|
113667
113783
|
import { fileURLToPath as fileURLToPath13 } from "url";
|
|
113668
113784
|
function docsDir() {
|
|
113669
113785
|
const thisFile = fileURLToPath13(import.meta.url);
|
|
113670
|
-
const dir =
|
|
113786
|
+
const dir = dirname36(thisFile);
|
|
113671
113787
|
const devPath = resolve51(dir, "..", "docs");
|
|
113672
113788
|
const builtPath = resolve51(dir, "docs");
|
|
113673
113789
|
return existsSync79(devPath) ? devPath : builtPath;
|
|
@@ -114440,7 +114556,7 @@ __export(validate_exports, {
|
|
|
114440
114556
|
shouldIgnoreRequestFailure: () => shouldIgnoreRequestFailure
|
|
114441
114557
|
});
|
|
114442
114558
|
import { existsSync as existsSync80, readFileSync as readFileSync58 } from "fs";
|
|
114443
|
-
import { join as join85, dirname as
|
|
114559
|
+
import { join as join85, dirname as dirname37 } from "path";
|
|
114444
114560
|
import { fileURLToPath as fileURLToPath14 } from "url";
|
|
114445
114561
|
function shouldIgnoreRequestFailure(url, errorText, resourceType) {
|
|
114446
114562
|
if (errorText !== "net::ERR_ABORTED") return false;
|
|
@@ -114691,7 +114807,7 @@ var init_validate = __esm({
|
|
|
114691
114807
|
init_colors();
|
|
114692
114808
|
init_updateCheck();
|
|
114693
114809
|
__filename2 = fileURLToPath14(import.meta.url);
|
|
114694
|
-
__dirname3 =
|
|
114810
|
+
__dirname3 = dirname37(__filename2);
|
|
114695
114811
|
CONTRAST_SAMPLES = 5;
|
|
114696
114812
|
SEEK_SETTLE_MS2 = 150;
|
|
114697
114813
|
MEDIA_EXTENSIONS = /\.(aac|flac|m4a|mov|mp3|mp4|oga|ogg|wav|webm)$/i;
|
|
@@ -114752,8 +114868,8 @@ __export(contactSheet_exports, {
|
|
|
114752
114868
|
createSvgContactSheet: () => createSvgContactSheet
|
|
114753
114869
|
});
|
|
114754
114870
|
import sharp from "sharp";
|
|
114755
|
-
import { readdirSync as
|
|
114756
|
-
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";
|
|
114757
114873
|
async function createContactSheet(imagePaths, outputPath, opts = {}) {
|
|
114758
114874
|
const {
|
|
114759
114875
|
cols = 3,
|
|
@@ -114833,7 +114949,7 @@ async function createContactSheetPages(imagePaths, outputBasePath, opts = {}, la
|
|
|
114833
114949
|
}
|
|
114834
114950
|
async function createScrollContactSheet(screenshotsDir, outputPath) {
|
|
114835
114951
|
if (!existsSync81(screenshotsDir)) return [];
|
|
114836
|
-
const scrollFiles =
|
|
114952
|
+
const scrollFiles = readdirSync31(screenshotsDir).filter((f3) => f3.startsWith("scroll-") && f3.endsWith(".png")).sort();
|
|
114837
114953
|
if (scrollFiles.length === 0) return [];
|
|
114838
114954
|
const paths = scrollFiles.map((f3) => join86(screenshotsDir, f3));
|
|
114839
114955
|
const labels = scrollFiles.map((f3) => {
|
|
@@ -114850,7 +114966,7 @@ async function createScrollContactSheet(screenshotsDir, outputPath) {
|
|
|
114850
114966
|
}
|
|
114851
114967
|
async function createSnapshotContactSheet(snapshotsDir, outputPath) {
|
|
114852
114968
|
if (!existsSync81(snapshotsDir)) return [];
|
|
114853
|
-
const snapshotFiles =
|
|
114969
|
+
const snapshotFiles = readdirSync31(snapshotsDir).filter((f3) => f3.startsWith("frame-") && f3.endsWith(".png")).sort();
|
|
114854
114970
|
if (snapshotFiles.length === 0) return [];
|
|
114855
114971
|
const paths = snapshotFiles.map((f3) => join86(snapshotsDir, f3));
|
|
114856
114972
|
const labels = snapshotFiles.map((f3) => {
|
|
@@ -114868,7 +114984,7 @@ async function createSnapshotContactSheet(snapshotsDir, outputPath) {
|
|
|
114868
114984
|
async function createAssetContactSheet(assetsDir, outputPath) {
|
|
114869
114985
|
if (!existsSync81(assetsDir)) return [];
|
|
114870
114986
|
const imageExts = /* @__PURE__ */ new Set([".png", ".jpg", ".jpeg", ".webp"]);
|
|
114871
|
-
const assetFiles =
|
|
114987
|
+
const assetFiles = readdirSync31(assetsDir).filter((f3) => imageExts.has(extname14(f3).toLowerCase()) && !f3.includes("contact-sheet")).sort();
|
|
114872
114988
|
if (assetFiles.length === 0) return [];
|
|
114873
114989
|
const paths = assetFiles.map((f3) => join86(assetsDir, f3));
|
|
114874
114990
|
return createContactSheetPages(paths, outputPath, {
|
|
@@ -114886,7 +115002,7 @@ async function createSvgContactSheet(svgsDir, outputPath, assetsRootDir) {
|
|
|
114886
115002
|
const seen = /* @__PURE__ */ new Set();
|
|
114887
115003
|
const svgPaths = [];
|
|
114888
115004
|
for (const dir of dirsToScan) {
|
|
114889
|
-
for (const f3 of
|
|
115005
|
+
for (const f3 of readdirSync31(dir).filter((f4) => f4.endsWith(".svg")).sort()) {
|
|
114890
115006
|
if (!seen.has(f3)) {
|
|
114891
115007
|
seen.add(f3);
|
|
114892
115008
|
svgPaths.push(join86(dir, f3));
|
|
@@ -114896,7 +115012,7 @@ async function createSvgContactSheet(svgsDir, outputPath, assetsRootDir) {
|
|
|
114896
115012
|
if (svgPaths.length === 0) return [];
|
|
114897
115013
|
const svgFileNames = svgPaths.map((p2) => p2.split("/").pop());
|
|
114898
115014
|
const thumbSize = 200;
|
|
114899
|
-
const tmpDir =
|
|
115015
|
+
const tmpDir = dirname38(outputPath);
|
|
114900
115016
|
const tmpPaths = [];
|
|
114901
115017
|
const labels = [];
|
|
114902
115018
|
for (let i2 = 0; i2 < svgPaths.length; i2++) {
|
|
@@ -121103,7 +121219,7 @@ var require_node_domexception = __commonJS({
|
|
|
121103
121219
|
});
|
|
121104
121220
|
|
|
121105
121221
|
// ../../node_modules/.bun/fetch-blob@3.2.0/node_modules/fetch-blob/from.js
|
|
121106
|
-
import { statSync as
|
|
121222
|
+
import { statSync as statSync25, createReadStream as createReadStream3, promises as fs2 } from "fs";
|
|
121107
121223
|
import { basename as basename17 } from "path";
|
|
121108
121224
|
var import_node_domexception, stat, blobFromSync, blobFrom, fileFrom, fileFromSync, fromBlob, fromFile, BlobDataItem;
|
|
121109
121225
|
var init_from = __esm({
|
|
@@ -121113,10 +121229,10 @@ var init_from = __esm({
|
|
|
121113
121229
|
init_file();
|
|
121114
121230
|
init_fetch_blob();
|
|
121115
121231
|
({ stat } = fs2);
|
|
121116
|
-
blobFromSync = (path2, type) => fromBlob(
|
|
121232
|
+
blobFromSync = (path2, type) => fromBlob(statSync25(path2), path2, type);
|
|
121117
121233
|
blobFrom = (path2, type) => stat(path2).then((stat3) => fromBlob(stat3, path2, type));
|
|
121118
121234
|
fileFrom = (path2, type) => stat(path2).then((stat3) => fromFile(stat3, path2, type));
|
|
121119
|
-
fileFromSync = (path2, type) => fromFile(
|
|
121235
|
+
fileFromSync = (path2, type) => fromFile(statSync25(path2), path2, type);
|
|
121120
121236
|
fromBlob = (stat3, path2, type = "") => new fetch_blob_default([new BlobDataItem({
|
|
121121
121237
|
path: path2,
|
|
121122
121238
|
size: stat3.size,
|
|
@@ -146259,10 +146375,10 @@ function iterBinaryChunks(iterator) {
|
|
|
146259
146375
|
}
|
|
146260
146376
|
});
|
|
146261
146377
|
}
|
|
146262
|
-
function partition(str,
|
|
146263
|
-
const index = str.indexOf(
|
|
146378
|
+
function partition(str, delimiter) {
|
|
146379
|
+
const index = str.indexOf(delimiter);
|
|
146264
146380
|
if (index !== -1) {
|
|
146265
|
-
return [str.substring(0, index),
|
|
146381
|
+
return [str.substring(0, index), delimiter, str.substring(index + delimiter.length)];
|
|
146266
146382
|
}
|
|
146267
146383
|
return [str, "", ""];
|
|
146268
146384
|
}
|
|
@@ -150063,11 +150179,11 @@ var init_node4 = __esm({
|
|
|
150063
150179
|
while (true) {
|
|
150064
150180
|
delimiterIndex = -1;
|
|
150065
150181
|
delimiterLength = 0;
|
|
150066
|
-
for (const
|
|
150067
|
-
const index = buffer.indexOf(
|
|
150182
|
+
for (const delimiter of delimiters) {
|
|
150183
|
+
const index = buffer.indexOf(delimiter);
|
|
150068
150184
|
if (index !== -1 && (delimiterIndex === -1 || index < delimiterIndex)) {
|
|
150069
150185
|
delimiterIndex = index;
|
|
150070
|
-
delimiterLength =
|
|
150186
|
+
delimiterLength = delimiter.length;
|
|
150071
150187
|
}
|
|
150072
150188
|
}
|
|
150073
150189
|
if (delimiterIndex === -1) {
|
|
@@ -154681,9 +154797,9 @@ __export(snapshot_exports, {
|
|
|
154681
154797
|
examples: () => examples26
|
|
154682
154798
|
});
|
|
154683
154799
|
import { spawn as spawn16 } from "child_process";
|
|
154684
|
-
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";
|
|
154685
154801
|
import { tmpdir as tmpdir6 } from "os";
|
|
154686
|
-
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";
|
|
154687
154803
|
async function extractVideoFrameToBuffer(videoPath, timeSeconds, useVp9AlphaDecoder = false) {
|
|
154688
154804
|
const tmp = mkdtempSync5(join87(tmpdir6(), "hf-snapshot-frame-"));
|
|
154689
154805
|
const outPath = join87(tmp, "frame.png");
|
|
@@ -154732,7 +154848,7 @@ async function extractVideoFrameToBuffer(videoPath, timeSeconds, useVp9AlphaDeco
|
|
|
154732
154848
|
return readFileSync60(outPath);
|
|
154733
154849
|
} finally {
|
|
154734
154850
|
try {
|
|
154735
|
-
|
|
154851
|
+
rmSync19(tmp, { recursive: true, force: true });
|
|
154736
154852
|
} catch {
|
|
154737
154853
|
}
|
|
154738
154854
|
}
|
|
@@ -154828,12 +154944,12 @@ async function captureSnapshots(projectDir, opts) {
|
|
|
154828
154944
|
}
|
|
154829
154945
|
const positions = opts.at?.length ? opts.at : numFrames === 1 ? [duration / 2] : Array.from({ length: numFrames }, (_, i2) => i2 / (numFrames - 1) * duration);
|
|
154830
154946
|
const snapshotDir = join87(projectDir, "snapshots");
|
|
154831
|
-
|
|
154947
|
+
mkdirSync41(snapshotDir, { recursive: true });
|
|
154832
154948
|
try {
|
|
154833
|
-
const { readdirSync:
|
|
154834
|
-
for (const file of
|
|
154949
|
+
const { readdirSync: readdirSync37 } = await import("fs");
|
|
154950
|
+
for (const file of readdirSync37(snapshotDir)) {
|
|
154835
154951
|
if (/\.(png|jpg|jpeg)$/i.test(file)) {
|
|
154836
|
-
|
|
154952
|
+
rmSync19(join87(snapshotDir, file), { force: true });
|
|
154837
154953
|
}
|
|
154838
154954
|
}
|
|
154839
154955
|
} catch {
|
|
@@ -154913,8 +155029,8 @@ async function captureSnapshots(projectDir, opts) {
|
|
|
154913
155029
|
const url = new URL(v2.src);
|
|
154914
155030
|
const decodedPath = decodeURIComponent(url.pathname).replace(/^\//, "");
|
|
154915
155031
|
const candidate = resolve52(projectDir, decodedPath);
|
|
154916
|
-
const rel =
|
|
154917
|
-
if (!rel.startsWith("..") && !
|
|
155032
|
+
const rel = relative16(projectDir, candidate);
|
|
155033
|
+
if (!rel.startsWith("..") && !isAbsolute14(rel) && existsSync82(candidate)) {
|
|
154918
155034
|
filePath = candidate;
|
|
154919
155035
|
}
|
|
154920
155036
|
} catch {
|
|
@@ -155124,7 +155240,7 @@ ${c.error("\u2717")} Snapshot failed: ${msg}`);
|
|
|
155124
155240
|
});
|
|
155125
155241
|
|
|
155126
155242
|
// src/capture/assetDownloader.ts
|
|
155127
|
-
import { writeFileSync as writeFileSync34, mkdirSync as
|
|
155243
|
+
import { writeFileSync as writeFileSync34, mkdirSync as mkdirSync42 } from "fs";
|
|
155128
155244
|
import { join as join88, extname as extname15 } from "path";
|
|
155129
155245
|
import { createHash as createHash13 } from "crypto";
|
|
155130
155246
|
function svgContentHashSlug(svgSource, isLogo) {
|
|
@@ -155133,10 +155249,10 @@ function svgContentHashSlug(svgSource, isLogo) {
|
|
|
155133
155249
|
}
|
|
155134
155250
|
async function downloadAssets(tokens, outputDir, catalogedAssets, faviconLinks) {
|
|
155135
155251
|
const assetsDir = join88(outputDir, "assets");
|
|
155136
|
-
|
|
155252
|
+
mkdirSync42(assetsDir, { recursive: true });
|
|
155137
155253
|
const assets = [];
|
|
155138
155254
|
const downloadedUrls = /* @__PURE__ */ new Set();
|
|
155139
|
-
|
|
155255
|
+
mkdirSync42(join88(outputDir, "assets", "svgs"), { recursive: true });
|
|
155140
155256
|
const usedSvgNames = /* @__PURE__ */ new Set();
|
|
155141
155257
|
for (let i2 = 0; i2 < tokens.svgs.length && i2 < 30; i2++) {
|
|
155142
155258
|
const svg = tokens.svgs[i2];
|
|
@@ -155267,7 +155383,7 @@ function normalizeUrl(u) {
|
|
|
155267
155383
|
}
|
|
155268
155384
|
async function downloadAndRewriteFonts(css, outputDir) {
|
|
155269
155385
|
const assetsDir = join88(outputDir, "assets", "fonts");
|
|
155270
|
-
|
|
155386
|
+
mkdirSync42(assetsDir, { recursive: true });
|
|
155271
155387
|
const fontUrlRegex = /url\(['"]?(https?:\/\/[^'")\s]+\.(?:woff2?|ttf|otf)[^'")\s]*?)['"]?\)/g;
|
|
155272
155388
|
const fontUrls = /* @__PURE__ */ new Set();
|
|
155273
155389
|
let match;
|
|
@@ -155460,7 +155576,7 @@ __export(video_exports, {
|
|
|
155460
155576
|
runVideoMode: () => runVideoMode,
|
|
155461
155577
|
safeFilename: () => safeFilename
|
|
155462
155578
|
});
|
|
155463
|
-
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";
|
|
155464
155580
|
import { resolve as resolve53, join as join89, basename as basename19 } from "path";
|
|
155465
155581
|
async function streamToFile(url, destPath) {
|
|
155466
155582
|
const r2 = await safeFetch(url, {
|
|
@@ -155636,7 +155752,7 @@ async function runVideoMode(args) {
|
|
|
155636
155752
|
return;
|
|
155637
155753
|
}
|
|
155638
155754
|
const outDir = isW2hLayout ? join89(projectDir, "capture", "assets", "videos") : join89(projectDir, "assets", "videos");
|
|
155639
|
-
|
|
155755
|
+
mkdirSync43(outDir, { recursive: true });
|
|
155640
155756
|
const fname = safeFilename(entry.filename || basename19(entry.url));
|
|
155641
155757
|
const outPath = join89(outDir, fname);
|
|
155642
155758
|
const relPath = isW2hLayout ? `capture/assets/videos/${fname}` : `assets/videos/${fname}`;
|
|
@@ -156666,7 +156782,7 @@ var init_designStyleExtractor = __esm({
|
|
|
156666
156782
|
});
|
|
156667
156783
|
|
|
156668
156784
|
// src/capture/fontMetadataExtractor.ts
|
|
156669
|
-
import { readdirSync as
|
|
156785
|
+
import { readdirSync as readdirSync32, readFileSync as readFileSync62, writeFileSync as writeFileSync35, existsSync as existsSync84 } from "fs";
|
|
156670
156786
|
import { join as join90 } from "path";
|
|
156671
156787
|
import * as fontkit from "fontkit";
|
|
156672
156788
|
function isFontCollection(value) {
|
|
@@ -156676,7 +156792,7 @@ function extractFontMetadata(fontsDir, outputPath) {
|
|
|
156676
156792
|
const files = [];
|
|
156677
156793
|
const unidentified = [];
|
|
156678
156794
|
if (existsSync84(fontsDir)) {
|
|
156679
|
-
const fontFiles =
|
|
156795
|
+
const fontFiles = readdirSync32(fontsDir).filter((f3) => /\.(woff2?|ttf|otf)$/i.test(f3));
|
|
156680
156796
|
for (const filename of fontFiles) {
|
|
156681
156797
|
const fullPath = join90(fontsDir, filename);
|
|
156682
156798
|
const meta = readSingleFont(fullPath, filename);
|
|
@@ -156972,7 +157088,7 @@ var init_animationCataloger = __esm({
|
|
|
156972
157088
|
});
|
|
156973
157089
|
|
|
156974
157090
|
// src/capture/mediaCapture.ts
|
|
156975
|
-
import { mkdirSync as
|
|
157091
|
+
import { mkdirSync as mkdirSync44, writeFileSync as writeFileSync36, readdirSync as readdirSync33, readFileSync as readFileSync63, statSync as statSync26 } from "fs";
|
|
156976
157092
|
import { join as join91, extname as extname16 } from "path";
|
|
156977
157093
|
async function saveLottieAnimations(discoveredLotties, lottieDir) {
|
|
156978
157094
|
let savedCount = 0;
|
|
@@ -157034,15 +157150,15 @@ async function saveLottieAnimations(discoveredLotties, lottieDir) {
|
|
|
157034
157150
|
async function renderLottiePreviews(chromeBrowser, lottieDir, outputDir) {
|
|
157035
157151
|
const manifest = [];
|
|
157036
157152
|
const previewDir = join91(lottieDir, "previews");
|
|
157037
|
-
|
|
157038
|
-
for (const file of
|
|
157153
|
+
mkdirSync44(previewDir, { recursive: true });
|
|
157154
|
+
for (const file of readdirSync33(lottieDir)) {
|
|
157039
157155
|
if (!file.endsWith(".json")) continue;
|
|
157040
157156
|
try {
|
|
157041
157157
|
const raw = JSON.parse(readFileSync63(join91(lottieDir, file), "utf-8"));
|
|
157042
157158
|
const fr = raw.fr || 30;
|
|
157043
157159
|
const dur = ((raw.op || 0) - (raw.ip || 0)) / fr;
|
|
157044
157160
|
const previewName = file.replace(".json", "-preview.png");
|
|
157045
|
-
const fileSize =
|
|
157161
|
+
const fileSize = statSync26(join91(lottieDir, file)).size;
|
|
157046
157162
|
if (fileSize > 2e6) continue;
|
|
157047
157163
|
let previewPage;
|
|
157048
157164
|
try {
|
|
@@ -157198,9 +157314,9 @@ async function captureVideoManifest(page, outputDir, progress, opts) {
|
|
|
157198
157314
|
const merged = [...byKey.values()];
|
|
157199
157315
|
if (merged.length === 0) return;
|
|
157200
157316
|
const videoManifestDir = join91(outputDir, "assets", "videos");
|
|
157201
|
-
|
|
157317
|
+
mkdirSync44(videoManifestDir, { recursive: true });
|
|
157202
157318
|
const previewDir = join91(videoManifestDir, "previews");
|
|
157203
|
-
|
|
157319
|
+
mkdirSync44(previewDir, { recursive: true });
|
|
157204
157320
|
const videoManifest = [];
|
|
157205
157321
|
const dlStart = Date.now();
|
|
157206
157322
|
for (let vi = 0; vi < merged.length && vi < 20; vi++) {
|
|
@@ -157314,7 +157430,7 @@ var init_mediaCapture = __esm({
|
|
|
157314
157430
|
});
|
|
157315
157431
|
|
|
157316
157432
|
// src/capture/contentExtractor.ts
|
|
157317
|
-
import { existsSync as existsSync85, readdirSync as
|
|
157433
|
+
import { existsSync as existsSync85, readdirSync as readdirSync34, statSync as statSync27, readFileSync as readFileSync64 } from "fs";
|
|
157318
157434
|
import { basename as basename20, join as join92 } from "path";
|
|
157319
157435
|
async function detectLibraries(page, capturedShaders) {
|
|
157320
157436
|
let detectedLibraries = [];
|
|
@@ -157482,7 +157598,7 @@ async function captionImagesWithGemini(outputDir, progress, warnings) {
|
|
|
157482
157598
|
return response.text?.trim() || "";
|
|
157483
157599
|
};
|
|
157484
157600
|
}
|
|
157485
|
-
const imageFiles =
|
|
157601
|
+
const imageFiles = readdirSync34(join92(outputDir, "assets")).filter(
|
|
157486
157602
|
(f3) => /\.(png|jpg|jpeg|webp|gif)$/i.test(f3)
|
|
157487
157603
|
);
|
|
157488
157604
|
const BATCH_SIZE = 20;
|
|
@@ -157491,7 +157607,7 @@ async function captionImagesWithGemini(outputDir, progress, warnings) {
|
|
|
157491
157607
|
const results = await Promise.allSettled(
|
|
157492
157608
|
batch.map(async (file) => {
|
|
157493
157609
|
const filePath = join92(outputDir, "assets", file);
|
|
157494
|
-
const stat3 =
|
|
157610
|
+
const stat3 = statSync27(filePath);
|
|
157495
157611
|
if (stat3.size > 4e6) return { file, caption: "" };
|
|
157496
157612
|
const buffer = readFileSync64(filePath);
|
|
157497
157613
|
const base64 = buffer.toString("base64");
|
|
@@ -157525,12 +157641,12 @@ async function captionImagesWithGemini(outputDir, progress, warnings) {
|
|
|
157525
157641
|
);
|
|
157526
157642
|
const svgFiles = [];
|
|
157527
157643
|
const assetsDir = join92(outputDir, "assets");
|
|
157528
|
-
for (const f3 of
|
|
157644
|
+
for (const f3 of readdirSync34(assetsDir)) {
|
|
157529
157645
|
if (/\.svg$/i.test(f3)) svgFiles.push({ file: f3, relPath: f3 });
|
|
157530
157646
|
}
|
|
157531
157647
|
const svgsSubdir = join92(assetsDir, "svgs");
|
|
157532
157648
|
if (existsSync85(svgsSubdir)) {
|
|
157533
|
-
for (const f3 of
|
|
157649
|
+
for (const f3 of readdirSync34(svgsSubdir)) {
|
|
157534
157650
|
if (/\.svg$/i.test(f3)) svgFiles.push({ file: f3, relPath: `svgs/${f3}` });
|
|
157535
157651
|
}
|
|
157536
157652
|
}
|
|
@@ -157612,10 +157728,10 @@ function generateAssetDescriptions(outputDir, tokens, catalogedAssets, geminiCap
|
|
|
157612
157728
|
const fontLines = [];
|
|
157613
157729
|
const assetsPath = join92(outputDir, "assets");
|
|
157614
157730
|
try {
|
|
157615
|
-
for (const file of
|
|
157731
|
+
for (const file of readdirSync34(assetsPath)) {
|
|
157616
157732
|
if (file === "svgs" || file === "fonts" || file === "lottie" || file === "videos") continue;
|
|
157617
157733
|
const filePath = join92(assetsPath, file);
|
|
157618
|
-
const stat3 =
|
|
157734
|
+
const stat3 = statSync27(filePath);
|
|
157619
157735
|
if (!stat3.isFile()) continue;
|
|
157620
157736
|
const sizeKb = Math.round(stat3.size / 1024);
|
|
157621
157737
|
const catalogMatch = catalogedAssets.find(
|
|
@@ -157644,7 +157760,7 @@ function generateAssetDescriptions(outputDir, tokens, catalogedAssets, geminiCap
|
|
|
157644
157760
|
}
|
|
157645
157761
|
try {
|
|
157646
157762
|
const svgsPath = join92(assetsPath, "svgs");
|
|
157647
|
-
for (const file of
|
|
157763
|
+
for (const file of readdirSync34(svgsPath)) {
|
|
157648
157764
|
if (!file.endsWith(".svg")) continue;
|
|
157649
157765
|
const svgMatch = tokens.svgs.find(
|
|
157650
157766
|
(s2) => s2.label && file.includes(
|
|
@@ -157663,7 +157779,7 @@ function generateAssetDescriptions(outputDir, tokens, catalogedAssets, geminiCap
|
|
|
157663
157779
|
}
|
|
157664
157780
|
try {
|
|
157665
157781
|
const fontsPath = join92(assetsPath, "fonts");
|
|
157666
|
-
for (const file of
|
|
157782
|
+
for (const file of readdirSync34(fontsPath)) {
|
|
157667
157783
|
fontLines.push(`fonts/${file} \u2014 font file`);
|
|
157668
157784
|
}
|
|
157669
157785
|
} catch {
|
|
@@ -157696,7 +157812,7 @@ var agentPromptGenerator_exports = {};
|
|
|
157696
157812
|
__export(agentPromptGenerator_exports, {
|
|
157697
157813
|
generateAgentPrompt: () => generateAgentPrompt
|
|
157698
157814
|
});
|
|
157699
|
-
import { writeFileSync as writeFileSync37, readdirSync as
|
|
157815
|
+
import { writeFileSync as writeFileSync37, readdirSync as readdirSync35, existsSync as existsSync86 } from "fs";
|
|
157700
157816
|
import { join as join93 } from "path";
|
|
157701
157817
|
function inferColorRole(hex) {
|
|
157702
157818
|
const r2 = parseInt(hex.slice(1, 3), 16) / 255;
|
|
@@ -157732,7 +157848,7 @@ function buildPrompt(outputDir, url, tokens, hasScreenshot, hasLottie, hasShader
|
|
|
157732
157848
|
const baseName = baseFile.replace(/\.jpg$/, "");
|
|
157733
157849
|
const escapedBase = baseName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
157734
157850
|
const paginatedRe = new RegExp(`^${escapedBase}(?:-(\\d+))?\\.jpg$`);
|
|
157735
|
-
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);
|
|
157736
157852
|
if (all.length === 0) return [];
|
|
157737
157853
|
if (all.length === 1) {
|
|
157738
157854
|
return [`| \`${dir}/${all[0]}\` | ${label2} |`];
|
|
@@ -157896,11 +158012,11 @@ var screenshotCapture_exports = {};
|
|
|
157896
158012
|
__export(screenshotCapture_exports, {
|
|
157897
158013
|
captureScrollScreenshots: () => captureScrollScreenshots
|
|
157898
158014
|
});
|
|
157899
|
-
import { writeFileSync as writeFileSync39, mkdirSync as
|
|
158015
|
+
import { writeFileSync as writeFileSync39, mkdirSync as mkdirSync45 } from "fs";
|
|
157900
158016
|
import { join as join95 } from "path";
|
|
157901
158017
|
async function captureScrollScreenshots(page, outputDir) {
|
|
157902
158018
|
const screenshotsDir = join95(outputDir, "screenshots");
|
|
157903
|
-
|
|
158019
|
+
mkdirSync45(screenshotsDir, { recursive: true });
|
|
157904
158020
|
const MAX_SCREENSHOTS = 20;
|
|
157905
158021
|
const filePaths = [];
|
|
157906
158022
|
try {
|
|
@@ -158340,7 +158456,7 @@ var capture_exports = {};
|
|
|
158340
158456
|
__export(capture_exports, {
|
|
158341
158457
|
captureWebsite: () => captureWebsite
|
|
158342
158458
|
});
|
|
158343
|
-
import { mkdirSync as
|
|
158459
|
+
import { mkdirSync as mkdirSync46, writeFileSync as writeFileSync40, existsSync as existsSync88 } from "fs";
|
|
158344
158460
|
import { join as join96 } from "path";
|
|
158345
158461
|
async function captureWebsite(opts, onProgress) {
|
|
158346
158462
|
const {
|
|
@@ -158358,9 +158474,9 @@ async function captureWebsite(opts, onProgress) {
|
|
|
158358
158474
|
onProgress?.(stage, detail);
|
|
158359
158475
|
};
|
|
158360
158476
|
loadEnvFile(outputDir);
|
|
158361
|
-
|
|
158362
|
-
|
|
158363
|
-
|
|
158477
|
+
mkdirSync46(join96(outputDir, "extracted"), { recursive: true });
|
|
158478
|
+
mkdirSync46(join96(outputDir, "screenshots"), { recursive: true });
|
|
158479
|
+
mkdirSync46(join96(outputDir, "assets"), { recursive: true });
|
|
158364
158480
|
progress("browser", "Launching headless Chrome...");
|
|
158365
158481
|
const { ensureBrowser: ensureBrowser2 } = await Promise.resolve().then(() => (init_manager2(), manager_exports2));
|
|
158366
158482
|
const browser = await ensureBrowser2();
|
|
@@ -158521,7 +158637,7 @@ async function captureWebsite(opts, onProgress) {
|
|
|
158521
158637
|
}
|
|
158522
158638
|
if (discoveredLotties.length > 0) {
|
|
158523
158639
|
const lottieDir = join96(outputDir, "assets", "lottie");
|
|
158524
|
-
|
|
158640
|
+
mkdirSync46(lottieDir, { recursive: true });
|
|
158525
158641
|
const savedCount = await saveLottieAnimations(discoveredLotties, lottieDir);
|
|
158526
158642
|
if (savedCount > 0) {
|
|
158527
158643
|
await renderLottiePreviews(chromeBrowser, lottieDir, outputDir);
|
|
@@ -159024,8 +159140,8 @@ var init_capture2 = __esm({
|
|
|
159024
159140
|
} catch (err) {
|
|
159025
159141
|
const errMsg = err instanceof Error ? err.message : String(err);
|
|
159026
159142
|
try {
|
|
159027
|
-
const { mkdirSync:
|
|
159028
|
-
|
|
159143
|
+
const { mkdirSync: mkdirSync51, writeFileSync: writeFileSync43 } = await import("fs");
|
|
159144
|
+
mkdirSync51(outputDir, { recursive: true });
|
|
159029
159145
|
const isTimeout = /timeout|timed out/i.test(errMsg);
|
|
159030
159146
|
const reason = isTimeout ? "Page navigation timed out \u2014 the site may be blocking headless browsers or requires authentication." : `Capture failed: ${errMsg}`;
|
|
159031
159147
|
writeFileSync43(
|
|
@@ -159071,14 +159187,14 @@ __export(state_exports, {
|
|
|
159071
159187
|
stateFilePath: () => stateFilePath,
|
|
159072
159188
|
writeStackOutputs: () => writeStackOutputs
|
|
159073
159189
|
});
|
|
159074
|
-
import { existsSync as existsSync89, mkdirSync as
|
|
159075
|
-
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";
|
|
159076
159192
|
function stateFilePath(stackName = DEFAULT_STACK_NAME, cwd = process.cwd()) {
|
|
159077
159193
|
return join97(cwd, STATE_DIR_NAME, `${STATE_FILE_PREFIX}${stackName}.json`);
|
|
159078
159194
|
}
|
|
159079
159195
|
function writeStackOutputs(outputs, cwd = process.cwd()) {
|
|
159080
159196
|
const path2 = stateFilePath(outputs.stackName, cwd);
|
|
159081
|
-
|
|
159197
|
+
mkdirSync47(dirname39(path2), { recursive: true });
|
|
159082
159198
|
writeFileSync41(path2, JSON.stringify(outputs, null, 2) + "\n");
|
|
159083
159199
|
return path2;
|
|
159084
159200
|
}
|
|
@@ -159093,12 +159209,12 @@ function readStackOutputs(stackName = DEFAULT_STACK_NAME, cwd = process.cwd()) {
|
|
|
159093
159209
|
}
|
|
159094
159210
|
function deleteStackOutputs(stackName = DEFAULT_STACK_NAME, cwd = process.cwd()) {
|
|
159095
159211
|
const path2 = stateFilePath(stackName, cwd);
|
|
159096
|
-
if (existsSync89(path2))
|
|
159212
|
+
if (existsSync89(path2)) rmSync20(path2);
|
|
159097
159213
|
}
|
|
159098
159214
|
function listStackNames(cwd = process.cwd()) {
|
|
159099
159215
|
const dir = join97(cwd, STATE_DIR_NAME);
|
|
159100
159216
|
if (!existsSync89(dir)) return [];
|
|
159101
|
-
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));
|
|
159102
159218
|
}
|
|
159103
159219
|
function requireStack(stackName, cwd = process.cwd()) {
|
|
159104
159220
|
const stack = readStackOutputs(stackName, cwd);
|
|
@@ -159245,19 +159361,19 @@ var init_sam = __esm({
|
|
|
159245
159361
|
|
|
159246
159362
|
// src/commands/lambda/repoRoot.ts
|
|
159247
159363
|
import { existsSync as existsSync91 } from "fs";
|
|
159248
|
-
import { dirname as
|
|
159364
|
+
import { dirname as dirname40, resolve as resolve56 } from "path";
|
|
159249
159365
|
import { fileURLToPath as fileURLToPath15 } from "url";
|
|
159250
159366
|
function repoRoot() {
|
|
159251
159367
|
const override = process.env.HYPERFRAMES_REPO_ROOT;
|
|
159252
159368
|
if (override && existsSync91(resolve56(override, "packages", "aws-lambda", "package.json"))) {
|
|
159253
159369
|
return override;
|
|
159254
159370
|
}
|
|
159255
|
-
let dir =
|
|
159371
|
+
let dir = dirname40(fileURLToPath15(import.meta.url));
|
|
159256
159372
|
for (let depth = 0; depth < 12; depth++) {
|
|
159257
159373
|
if (existsSync91(resolve56(dir, "packages", "aws-lambda", "package.json"))) {
|
|
159258
159374
|
return dir;
|
|
159259
159375
|
}
|
|
159260
|
-
const parent =
|
|
159376
|
+
const parent = dirname40(dir);
|
|
159261
159377
|
if (parent === dir) break;
|
|
159262
159378
|
dir = parent;
|
|
159263
159379
|
}
|
|
@@ -160632,17 +160748,17 @@ __export(cloudrun_exports, {
|
|
|
160632
160748
|
});
|
|
160633
160749
|
import { spawnSync as spawnSync6 } from "child_process";
|
|
160634
160750
|
import { createRequire as createRequire4 } from "module";
|
|
160635
|
-
import { existsSync as existsSync95, mkdirSync as
|
|
160636
|
-
import { homedir as
|
|
160637
|
-
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";
|
|
160638
160754
|
function stateDir() {
|
|
160639
|
-
return join103(
|
|
160755
|
+
return join103(homedir14(), ".hyperframes");
|
|
160640
160756
|
}
|
|
160641
160757
|
function statePath() {
|
|
160642
160758
|
return join103(stateDir(), "cloudrun-state.json");
|
|
160643
160759
|
}
|
|
160644
160760
|
function writeState(state) {
|
|
160645
|
-
|
|
160761
|
+
mkdirSync48(stateDir(), { recursive: true });
|
|
160646
160762
|
writeFileSync42(statePath(), JSON.stringify(state, null, 2));
|
|
160647
160763
|
}
|
|
160648
160764
|
function readState(args) {
|
|
@@ -160673,7 +160789,7 @@ function stripUndefined2(o) {
|
|
|
160673
160789
|
function terraformDir() {
|
|
160674
160790
|
const require3 = createRequire4(import.meta.url);
|
|
160675
160791
|
const pkgJson = require3.resolve("@hyperframes/gcp-cloud-run/package.json");
|
|
160676
|
-
return join103(
|
|
160792
|
+
return join103(dirname41(pkgJson), "terraform");
|
|
160677
160793
|
}
|
|
160678
160794
|
function run(cmd, cmdArgs, opts = {}) {
|
|
160679
160795
|
const res = spawnSync6(cmd, cmdArgs, { stdio: "inherit", cwd: opts.cwd });
|
|
@@ -160805,7 +160921,7 @@ function findRepoRoot(tfDir) {
|
|
|
160805
160921
|
}
|
|
160806
160922
|
function writeCloudBuildConfig(image) {
|
|
160807
160923
|
const cfgPath = join103(stateDir(), "cloudrun-cloudbuild.yaml");
|
|
160808
|
-
|
|
160924
|
+
mkdirSync48(stateDir(), { recursive: true });
|
|
160809
160925
|
writeFileSync42(
|
|
160810
160926
|
cfgPath,
|
|
160811
160927
|
[
|
|
@@ -161434,8 +161550,8 @@ var init_poll = __esm({
|
|
|
161434
161550
|
});
|
|
161435
161551
|
|
|
161436
161552
|
// src/cloud/download.ts
|
|
161437
|
-
import { createWriteStream as createWriteStream5, mkdirSync as
|
|
161438
|
-
import { dirname as
|
|
161553
|
+
import { createWriteStream as createWriteStream5, mkdirSync as mkdirSync49, unlinkSync as unlinkSync10 } from "fs";
|
|
161554
|
+
import { dirname as dirname42 } from "path";
|
|
161439
161555
|
async function downloadToFile(url, destPath, options = {}) {
|
|
161440
161556
|
const fetchImpl = options.fetchImpl ?? fetch;
|
|
161441
161557
|
const res = await fetchImpl(url, { signal: options.signal });
|
|
@@ -161445,7 +161561,7 @@ async function downloadToFile(url, destPath, options = {}) {
|
|
|
161445
161561
|
if (!res.body) {
|
|
161446
161562
|
throw new Error(`Failed to download ${url}: empty response body`);
|
|
161447
161563
|
}
|
|
161448
|
-
|
|
161564
|
+
mkdirSync49(dirname42(destPath), { recursive: true });
|
|
161449
161565
|
const totalHeader = res.headers.get("content-length");
|
|
161450
161566
|
const total = totalHeader ? Number.parseInt(totalHeader, 10) : void 0;
|
|
161451
161567
|
const totalOpt = total !== void 0 && Number.isFinite(total) ? total : void 0;
|
|
@@ -162074,12 +162190,12 @@ var init_browser2 = __esm({
|
|
|
162074
162190
|
});
|
|
162075
162191
|
|
|
162076
162192
|
// src/auth/paths.ts
|
|
162077
|
-
import { homedir as
|
|
162193
|
+
import { homedir as homedir15 } from "os";
|
|
162078
162194
|
import { join as join104 } from "path";
|
|
162079
162195
|
function configDir() {
|
|
162080
162196
|
const override = process.env["HEYGEN_CONFIG_DIR"];
|
|
162081
162197
|
if (override && override.length > 0) return override;
|
|
162082
|
-
return join104(
|
|
162198
|
+
return join104(homedir15(), ".heygen");
|
|
162083
162199
|
}
|
|
162084
162200
|
function credentialPath() {
|
|
162085
162201
|
return join104(configDir(), CREDENTIAL_FILENAME);
|
|
@@ -162094,7 +162210,7 @@ var init_paths2 = __esm({
|
|
|
162094
162210
|
|
|
162095
162211
|
// src/auth/store.ts
|
|
162096
162212
|
import { promises as fs4 } from "fs";
|
|
162097
|
-
import { dirname as
|
|
162213
|
+
import { dirname as dirname43 } from "path";
|
|
162098
162214
|
async function readStore(path2 = credentialPath()) {
|
|
162099
162215
|
let raw;
|
|
162100
162216
|
try {
|
|
@@ -162116,7 +162232,7 @@ async function readStore(path2 = credentialPath()) {
|
|
|
162116
162232
|
throw ErrInvalidStore("file is not JSON and does not look like a plain API key");
|
|
162117
162233
|
}
|
|
162118
162234
|
async function writeStore(credentials, path2 = credentialPath()) {
|
|
162119
|
-
await ensureDir2(
|
|
162235
|
+
await ensureDir2(dirname43(path2));
|
|
162120
162236
|
const body = JSON.stringify(serializeCredentials(credentials), null, 2);
|
|
162121
162237
|
const tmp = `${path2}.${process.pid}.${Date.now()}.tmp`;
|
|
162122
162238
|
await fs4.writeFile(tmp, `${body}
|
|
@@ -162873,7 +162989,7 @@ __export(render_exports3, {
|
|
|
162873
162989
|
resolveAspectRatioForSubmit: () => resolveAspectRatioForSubmit,
|
|
162874
162990
|
validateResolutionFormatCombo: () => validateResolutionFormatCombo
|
|
162875
162991
|
});
|
|
162876
|
-
import { isAbsolute as
|
|
162992
|
+
import { isAbsolute as isAbsolute15, resolve as resolvePath4 } from "path";
|
|
162877
162993
|
import { existsSync as existsSync96 } from "fs";
|
|
162878
162994
|
function parsePollIntervalMs(raw) {
|
|
162879
162995
|
const n2 = parseNumericFlag(raw, { flag: "--poll-interval", min: 1 });
|
|
@@ -163115,7 +163231,7 @@ function handleFailedRender(detail, asJson) {
|
|
|
163115
163231
|
}
|
|
163116
163232
|
function resolveOutputPath2(output, renderId, format) {
|
|
163117
163233
|
if (output) {
|
|
163118
|
-
return
|
|
163234
|
+
return isAbsolute15(output) ? output : resolvePath4(process.cwd(), output);
|
|
163119
163235
|
}
|
|
163120
163236
|
const ext = FORMAT_EXT2[format] ?? `.${format}`;
|
|
163121
163237
|
return resolvePath4(process.cwd(), "renders", `${renderId}${ext}`);
|
|
@@ -164596,8 +164712,8 @@ __export(autoUpdate_exports, {
|
|
|
164596
164712
|
scheduleBackgroundInstall: () => scheduleBackgroundInstall
|
|
164597
164713
|
});
|
|
164598
164714
|
import { spawn as spawn17 } from "child_process";
|
|
164599
|
-
import { appendFileSync as appendFileSync2, mkdirSync as
|
|
164600
|
-
import { homedir as
|
|
164715
|
+
import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync50, openSync as openSync3 } from "fs";
|
|
164716
|
+
import { homedir as homedir16 } from "os";
|
|
164601
164717
|
import { join as join105 } from "path";
|
|
164602
164718
|
import { compareVersions as compareVersions3 } from "compare-versions";
|
|
164603
164719
|
function isAutoInstallDisabled() {
|
|
@@ -164613,14 +164729,14 @@ function majorOf(version2) {
|
|
|
164613
164729
|
}
|
|
164614
164730
|
function log(line) {
|
|
164615
164731
|
try {
|
|
164616
|
-
|
|
164732
|
+
mkdirSync50(CONFIG_DIR2, { recursive: true, mode: 448 });
|
|
164617
164733
|
appendFileSync2(LOG_FILE, `${(/* @__PURE__ */ new Date()).toISOString()} ${line}
|
|
164618
164734
|
`, { mode: 384 });
|
|
164619
164735
|
} catch {
|
|
164620
164736
|
}
|
|
164621
164737
|
}
|
|
164622
164738
|
function launchDetachedInstall(installCommand, version2) {
|
|
164623
|
-
|
|
164739
|
+
mkdirSync50(CONFIG_DIR2, { recursive: true, mode: 448 });
|
|
164624
164740
|
const configFile = join105(CONFIG_DIR2, "config.json");
|
|
164625
164741
|
const nodeScript = `
|
|
164626
164742
|
const { exec } = require("node:child_process");
|
|
@@ -164740,7 +164856,7 @@ var init_autoUpdate = __esm({
|
|
|
164740
164856
|
init_config();
|
|
164741
164857
|
init_env();
|
|
164742
164858
|
init_installerDetection();
|
|
164743
|
-
CONFIG_DIR2 = join105(
|
|
164859
|
+
CONFIG_DIR2 = join105(homedir16(), ".hyperframes");
|
|
164744
164860
|
LOG_FILE = join105(CONFIG_DIR2, "auto-update.log");
|
|
164745
164861
|
PENDING_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
164746
164862
|
}
|
|
@@ -164984,7 +165100,7 @@ var init_help = __esm({
|
|
|
164984
165100
|
// src/cli.ts
|
|
164985
165101
|
init_version();
|
|
164986
165102
|
init_dist();
|
|
164987
|
-
import { dirname as
|
|
165103
|
+
import { dirname as dirname44, join as join106 } from "path";
|
|
164988
165104
|
import { fileURLToPath as fileURLToPath16 } from "url";
|
|
164989
165105
|
import { existsSync as existsSync97 } from "fs";
|
|
164990
165106
|
|
|
@@ -165028,7 +165144,7 @@ for (const stream of [process.stdout, process.stderr]) {
|
|
|
165028
165144
|
});
|
|
165029
165145
|
}
|
|
165030
165146
|
(() => {
|
|
165031
|
-
const here =
|
|
165147
|
+
const here = dirname44(fileURLToPath16(import.meta.url));
|
|
165032
165148
|
const shader = join106(here, "shaderTransitionWorker.js");
|
|
165033
165149
|
if (!process.env.HF_SHADER_WORKER_ENTRY && existsSync97(shader)) {
|
|
165034
165150
|
process.env.HF_SHADER_WORKER_ENTRY = shader;
|