Files
frames/packages/core/scripts/test-hyperframe-runtime-contract.ts
zooqueenandHanzo Dev 70b41673a3 frames: rebrand the fork to Hanzo Frames
Forked from HyperFrames (Apache-2.0), full history preserved.

Hosts are mapped explicitly and BEFORE the identifier rename, because
hyperframes.heygen.com is not decoration: 175 of its occurrences are $schema
identifiers that a validator dereferences. A blind rename would have left them
naming a host that never serves them. The schema files are in this repo under
docs/schema, so the mapped host is one we can actually serve -- that is the
condition that makes the rewrite safe, and serving them is a deploy task, not
an edit. docs/schema/hyperframes.json is renamed to frames.json to match the
identifier it is now published under.

api.heygen.com and the CLI auth against heygen.com are left UNRENAMED on
purpose. They are a dependency on HeyGen's SaaS, not a name of ours to take,
and the right move is to remove that integration rather than rebrand it.

LICENSE and CREDITS.md are untouched; NOTICE records the lineage.

Co-authored-by: Hanzo Dev <[email protected]>
2026-07-28 23:42:24 -07:00

47 lines
1.5 KiB
TypeScript

import { readFileSync } from "node:fs";
import { resolve } from "node:path";
import { fileURLToPath } from "node:url";
import { loadHyperframeRuntimeSource } from "../src/inline-scripts/hyperframe";
function assert(condition: unknown, message: string): void {
if (!condition) {
throw new Error(message);
}
}
const runtimeSource = loadHyperframeRuntimeSource();
assert(runtimeSource !== null, "loadHyperframeRuntimeSource() returned null — entry.ts not found");
const requiredSnippets = [
"window.__player",
"window.__playerReady",
"window.__renderReady",
"hf-preview",
"hf-parent",
"renderSeek",
"__frames",
"fitTextFontSize",
];
for (const snippet of requiredSnippets) {
assert(runtimeSource.includes(snippet), `Runtime contract snippet missing: ${snippet}`);
}
const scriptDir = resolve(fileURLToPath(new URL(".", import.meta.url)));
const manifestPath = resolve(scriptDir, "../dist/hyperframe.manifest.json");
try {
const manifestRaw = readFileSync(manifestPath, "utf8");
const manifest = JSON.parse(manifestRaw) as { artifacts?: { iife?: string; esm?: string } };
assert(Boolean(manifest.artifacts?.iife), "Manifest is missing iife artifact");
assert(Boolean(manifest.artifacts?.esm), "Manifest is missing esm artifact");
} catch {
// Build may not have run yet; contract-only checks above still provide signal.
}
console.log(
JSON.stringify({
event: "hyperframe_runtime_contract_verified",
requiredSnippetsChecked: requiredSnippets.length,
}),
);