Files
heygen-com__hyperframes/packages/cli/package.json
xuanru a108ffa1f2 feat(validate): extract @hyperframes/validate importable runtime validate
The browser-based `validate` (console/network/HTTP + contrast/clip audits, remote-asset
localization, viewport-from-comp) only existed inline in the `validate` CLI command, so
external consumers couldn't reuse it — they reimplement a parallel headless harness that
drifts from render (missing localize → false CORS; hardcoded viewport → false out-of-frame;
hand-maintained runtime parity). Lint doesn't have this problem: it's an importable
`@hyperframes/lint` package.

This lifts the browser core into a new `@hyperframes/validate` package, exporting
`validateHtmlInBrowser(html, opts)`. The CLI `validate` command is behavior-unchanged: it
lints + bundles, resolves Chrome via its own `ensureBrowser()`, and delegates. The package
takes `opts.browserExecutablePath` so the caller owns browser discovery — the package stays
launch-agnostic (no browser/manager), like lint owns rules but not I/O.

New `opts.onPage(page)` runs extra checks on the SAME loaded page before teardown (findings
merged), so a consumer can layer its own gates (e.g. caption-zone / out-of-frame) without a
second browser load.

- contrast-audit.browser.js moves to the package (its only consumer); the CLI build copies it
  into dist and the bundled runtime loads it via the same page.addScriptTag path.
- The small low-level helpers validate needs (static file server, comp-viewport parse,
  linkedom shim, error normalizer) are vendored into the package so it doesn't import from
  @hyperframes/cli (which depends on it); folding both onto a shared low-level package is a
  follow-up. Marked in .fallowrc duplicates.ignore, matching the repo's moved-code convention.
- Pure-function + contrast-script tests move to the package with the code they cover; the CLI
  keeps only extractCompositionErrorsFromLint (a CLI-side lint→error shaping concern).

Verified: package build + typecheck clean, package tests 13/13, CLI tests 1270/1270 (103
files), fallow audit clean on 20 changed files, and an e2e `hyperframes validate` on a real
composition through the package (Chrome launch + contrast audit) returns ok:true.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 06:41:57 +00:00

76 lines
2.2 KiB
JSON

{
"name": "@hyperframes/cli",
"version": "0.7.38",
"description": "HyperFrames CLI — create, preview, and render HTML video compositions",
"repository": {
"type": "git",
"url": "https://github.com/heygen-com/hyperframes",
"directory": "packages/cli"
},
"bin": {
"hyperframes": "./dist/cli.js"
},
"files": [
"dist"
],
"type": "module",
"scripts": {
"test": "vitest run",
"dev": "tsx src/cli.ts",
"build": "bun run build:fonts && tsup && bun run build:runtime && bun run build:beat-analyzer && bun run build:copy",
"build:fonts": "node scripts/build-fonts.mjs",
"build:runtime": "tsx scripts/build-runtime.ts",
"build:beat-analyzer": "node scripts/build-beat-analyzer.mjs",
"build:copy": "node scripts/build-copy.mjs",
"typecheck": "tsc --noEmit",
"gen:skills-manifest": "tsx scripts/gen-skills-manifest.ts",
"gen:agent-dirs": "tsx scripts/sync-agent-dirs.ts"
},
"dependencies": {
"@hono/node-server": "^1.8.0",
"@puppeteer/browsers": "^2.13.0",
"adm-zip": "^0.5.16",
"citty": "^0.2.1",
"compare-versions": "^6.1.1",
"debug": "^4.4.0",
"esbuild": "^0.25.12",
"fontkit": "^2.0.4",
"giget": "^3.2.0",
"hono": "^4.0.0",
"onnxruntime-node": "^1.20.0",
"open": "^10.0.0",
"postcss": "^8.5.8",
"prettier": "^3.8.1",
"puppeteer-core": "^24.39.1",
"sharp": "^0.34.5"
},
"devDependencies": {
"@clack/prompts": "^1.1.0",
"@hyperframes/aws-lambda": "workspace:*",
"@hyperframes/core": "workspace:*",
"@hyperframes/engine": "workspace:*",
"@hyperframes/gcp-cloud-run": "workspace:*",
"@hyperframes/lint": "workspace:*",
"@hyperframes/producer": "workspace:*",
"@hyperframes/studio": "workspace:*",
"@hyperframes/studio-server": "workspace:*",
"@hyperframes/validate": "workspace:*",
"@types/adm-zip": "^0.5.7",
"@types/fontkit": "^2.0.9",
"@types/mime-types": "^3.0.1",
"@types/node": "^25.0.10",
"linkedom": "^0.18.12",
"picocolors": "^1.1.1",
"tsup": "^8.0.0",
"tsx": "^4.0.0",
"typescript": "^5.0.0",
"vitest": "^3.2.4"
},
"optionalDependencies": {
"@google/genai": "^1.50.1"
},
"engines": {
"node": ">=22"
}
}