mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-24 16:06:34 +00:00
The hyperframeRuntimeLoader uses import.meta.url to resolve hyperframe.manifest.json as a sibling file. When bundled into the CLI via tsup, import.meta.url points to dist/cli.js, so the sibling lookup checks dist/hyperframe.manifest.json — which wasn't being shipped. Copy the manifest and the canonical-named runtime IIFE into dist/ during the build-runtime step so the loader's sibling-path resolution works in published npm packages. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
17 lines
817 B
TypeScript
17 lines
817 B
TypeScript
import { loadHyperframeRuntimeSource } from "@hyperframes/core";
|
|
import { copyFileSync, writeFileSync } from "node:fs";
|
|
import { resolve, dirname } from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
const coreDistDir = resolve(__dirname, "../../core/dist");
|
|
|
|
// Write runtime source (keep legacy name for backward compat)
|
|
const runtimeSource = loadHyperframeRuntimeSource();
|
|
writeFileSync("dist/hyperframe-runtime.js", runtimeSource);
|
|
|
|
// Copy manifest + runtime with canonical names so hyperframeRuntimeLoader's
|
|
// sibling-path resolution works in the bundled CLI (installed via npx).
|
|
copyFileSync(resolve(coreDistDir, "hyperframe.manifest.json"), "dist/hyperframe.manifest.json");
|
|
writeFileSync("dist/hyperframe.runtime.iife.js", runtimeSource);
|