mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-14 21:29:34 +00:00
* feat: initial code port from hyperframes-internal Port all OSS-ready packages from the internal monorepo: - @hyperframes/core — shared types, HTML generation, GSAP utilities, runtime - @hyperframes/cli — CLI for creating, previewing, and rendering compositions - @hyperframes/engine — framework-agnostic rendering engine (BeginFrame + FFmpeg) - @hyperframes/producer — video rendering pipeline (Puppeteer + FFmpeg) - @hyperframes/ui-player — browser-based video player component - @hyperframes/studio — composition editor (React frontend + Hono backend) Includes regression test suite with Docker-based test harness. All HeyGen-internal references, deployment infrastructure, and proprietary assets have been removed. Package names migrated from @app/* to @hyperframes/*. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: scrub internal codenames and stale references from OSS port - Replace static.heygen.ai runtime URLs in test fixtures - Remove internal CDN publish script (publish-hyperframe-runtime.ts) - Replace sandbox-studio, sandbox-interceptor, __magicEditRuntime with neutral names (studio, hyperframe-runtime, __hyperframeRuntime) - Fix stale Vault API / localhost references in docs - Remove broken deprecated_studio link Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: remove remaining internal codenames and stale references - Delete stale producer README.md and PIPELINE.md (referenced nonexistent files) - Replace "Cerberus" codename with "HyperFrames" in test design reviews - Replace magic-edit postMessage identifiers with hf-preview/hf-parent - Rename debug-magic-edit-timeline.ts to debug-timeline.ts - Replace "Motion Cut" with "HyperFrames" in Timeline comments - Fix studio/CLI references to nonexistent archive package (use local data/projects/ dir, stub render proxy) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
90 lines
2.9 KiB
TypeScript
90 lines
2.9 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import { execFileSync } from "node:child_process";
|
|
import fs from "node:fs";
|
|
import path from "node:path";
|
|
import { lintHyperframeHtml } from "../src/lint/hyperframeLinter";
|
|
|
|
const ROOT = path.resolve(path.dirname(new URL(import.meta.url).pathname), "..");
|
|
|
|
function testCleanFixturePasses() {
|
|
const fixturePath = path.join(ROOT, "src/tests/chat-project-9/index.html");
|
|
const html = fs.readFileSync(fixturePath, "utf8");
|
|
const result = lintHyperframeHtml(html, { filePath: fixturePath });
|
|
|
|
assert.equal(result.ok, true, "chat-project-9 should pass without lint errors");
|
|
assert.equal(result.errorCount, 0, "chat-project-9 should have zero lint errors");
|
|
}
|
|
|
|
function testDetectsMissingCompositionHostId() {
|
|
const html = `
|
|
<html>
|
|
<body>
|
|
<div id="root" data-width="1080" data-height="1920">
|
|
<div data-composition-src="compositions/overlays.html"></div>
|
|
</div>
|
|
<script>
|
|
window.__timelines = {};
|
|
const tl = gsap.timeline({ paused: true });
|
|
window.__timelines["root"] = tl;
|
|
</script>
|
|
</body>
|
|
</html>
|
|
`;
|
|
|
|
const result = lintHyperframeHtml(html);
|
|
const codes = result.findings.map((finding) => finding.code);
|
|
|
|
assert.equal(result.ok, false, "missing composition ids should fail lint");
|
|
assert.ok(codes.includes("root_missing_composition_id"));
|
|
assert.ok(codes.includes("host_missing_composition_id"));
|
|
}
|
|
|
|
function testDetectsOverlappingGsapTweens() {
|
|
const html = `
|
|
<html>
|
|
<body>
|
|
<div id="main" data-composition-id="main" data-width="1080" data-height="1920">
|
|
<div id="frame"></div>
|
|
</div>
|
|
<script>
|
|
window.__timelines = {};
|
|
const tl = gsap.timeline({ paused: true });
|
|
tl.to("#frame", { y: 15, duration: 2.5, repeat: 1, yoyo: true }, 1.5);
|
|
tl.to("#frame", { y: 400, duration: 1.2 }, 4.5);
|
|
window.__timelines["main"] = tl;
|
|
</script>
|
|
</body>
|
|
</html>
|
|
`;
|
|
|
|
const result = lintHyperframeHtml(html);
|
|
const overlapFinding = result.findings.find((finding) => finding.code === "overlapping_gsap_tweens");
|
|
|
|
assert.ok(overlapFinding, "expected an overlapping GSAP tween warning");
|
|
assert.equal(overlapFinding?.severity, "warning");
|
|
}
|
|
|
|
function testCliJsonOutput() {
|
|
const fixturePath = path.join(ROOT, "src/tests/chat-project-9/index.html");
|
|
const tsxBin = path.join(ROOT, "node_modules/.bin/tsx");
|
|
const stdout = execFileSync(tsxBin, ["scripts/check-hyperframe-static.ts", "--json", fixturePath], {
|
|
cwd: ROOT,
|
|
encoding: "utf8",
|
|
});
|
|
const payload = JSON.parse(stdout);
|
|
|
|
assert.equal(payload.ok, true);
|
|
assert.equal(typeof payload.errorCount, "number");
|
|
assert.ok(Array.isArray(payload.findings));
|
|
}
|
|
|
|
function main() {
|
|
testCleanFixturePasses();
|
|
testDetectsMissingCompositionHostId();
|
|
testDetectsOverlappingGsapTweens();
|
|
testCliJsonOutput();
|
|
console.log("hyperframe linter tests passed");
|
|
}
|
|
|
|
main();
|