@hyperframes/core

中文文档
0.8.226发布于 2026/11/01TypeScriptES Module构建来源已验证

Types, parsers, generators, compiler, linter, runtime, and frame adapters for the Hyperframes video framework.

原始使用文档
文档目录8 节
  1. Install
  2. What's inside
  3. Generated composition trust
  4. Frame Adapters
  5. Parsing and generating HTML
  6. Linting
  7. Documentation
  8. Related packages

@hyperframes/core

Types, parsers, generators, compiler, linter, runtime, and frame adapters for the Hyperframes video framework.

Install

npm install @hyperframes/core

Most users don't need to install core directly — the CLI, producer, and studio packages depend on it internally.

What's inside

ModuleDescription
TypesTimelineElement, CompositionSpec, Asset, canvas dimensions, defaults
ParsersparseHtml — extract timeline elements from HTML; parseGsapScript — parse GSAP animations
GeneratorsgenerateHyperframesHtml — produce valid Hyperframes HTML from a composition spec
CompilercompileTimingAttrs — resolve data-start / data-duration into absolute times
LinterlintHyperframeHtml — validate Hyperframes HTML (missing attributes, overlapping tracks, etc.)
RuntimeIIFE script injected into the browser — manages seek, media playback, and the window.__hf protocol
Frame AdaptersPluggable animation drivers (GSAP, Lottie, CSS, or custom)

Generated composition trust

Composition generators require trusted authors for code-bearing inputs. styles and generateHyperframesStyles preserve authored CSS, which can load external resources. animations may contain __raw: values that are emitted as JavaScript; includeScripts: true includes executable timeline code. serializeGsapAnimations also accepts raw preamble, postamble, and a code-bearing timelineVar. Never fill these inputs with untrusted data. Attribute encoding and closing-tag containment are not a sandbox; render untrusted compositions in an appropriately isolated execution environment and never serve them on a privileged origin.

Text content retains the supported inline-formatting sanitizer contract. The clip parser intentionally flattens inner formatting to text, so parse/generate is not a lossless replacement for editing the source HTML.

Frame Adapters

A frame adapter tells the engine how to seek your animation to a specific frame:

import { createGSAPFrameAdapter } from "@hyperframes/core";

const adapter = createGSAPFrameAdapter({
  getTimeline: () => gsap.timeline(),
  compositionId: "my-video",
});

Implement FrameAdapter for custom animation runtimes:

import type { FrameAdapter } from "@hyperframes/core";

const myAdapter: FrameAdapter = {
  id: "my-adapter",
  getDurationFrames: () => 300,
  seekFrame: (frame) => {
    /* seek your animation */
  },
};

Parsing and generating HTML

import { parseHtml, generateHyperframesHtml } from "@hyperframes/core";

const { elements, metadata } = parseHtml(htmlString);
const html = generateHyperframesHtml(spec);

Linting

import { lintHyperframeHtml } from "@hyperframes/core/lint";

const result = lintHyperframeHtml(htmlString);
// result.findings: { severity, message, elementId }[]

Documentation

Full documentation: hyperframes.heygen.com/packages/core

版本与发布记录

@hyperframes/core 共发布 581 个版本,首次发布于 2026/03/23;过去 12 个月发布了 581 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.8.226latest2026/11/012 天前
0.8.2252026/11/012 天前
0.8.2242026/11/012 天前
0.8.2232026/10/313 天前
0.8.2222026/10/313 天前
0.8.2212026/10/304 天前

其他发布通道:alpha → 0.7.67-alpha.0,desktop → 0.8.53-desktop.0,hdr → 0.8.190-hdr.1。

关于 @hyperframes/core 的常见问题

@hyperframes/core 是什么?

用于超帧视频框架的类型、解析器、生成器、编译器、筛选器、运行时和帧适配器。

如何安装 @hyperframes/core?

在项目目录运行 npm install @hyperframes/core,或使用 pnpm add / yarn add / bun add。

@hyperframes/core 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@hyperframes/core 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@hyperframes/core 可以商用吗?

@hyperframes/core 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@hyperframes/core 还在维护吗?

最新版本 0.8.226 发布于 2026/11/01(2 天前);至今共发布 581 个版本,其中过去 12 个月发布了 581 个;首次发布于 2026/03/23。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。