mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-03 04:38:33 +00:00
## Summary
Two small fixes that together make `@hyperframes/core` + `@hyperframes/studio` consumable from non-Vite hosts (Next.js / Turbopack, Node, etc.).
### 1. `core`: ship the missing `lottieReadiness` module
The `"./runtime/lottie-readiness"` subpath export in `@hyperframes/core` claims to ship at `./dist/runtime/adapters/lottieReadiness.js`, but that file is missing from the published 0.6.6 and 0.6.7 tarballs. Consumers that import the subpath — most notably `@hyperframes/studio`'s `Player.tsx` — fail to resolve the module and break downstream builds.
**Root cause:** `packages/core/tsconfig.json` excludes `src/runtime` (those files run in a browser context and are bundled separately into the IIFE artifact). Since nothing in the included tree imports `lottieReadiness.ts`, tsc never emits a compiled output, and the file silently goes missing from the publish.
**Fix:** `lottieReadiness.ts` is a pure helper — takes `unknown`, returns `boolean`, no DOM/`window` dependencies. It doesn't belong in `src/runtime/` in the first place; the runtime-exclude rule rightly caught it. Move it to `src/lottieReadiness.ts` so the standard library build picks it up.
The subpath export **name** stays `"./runtime/lottie-readiness"` — only the exports map's underlying file path changes — so existing consumers (studio) don't need any code change.
### 2. `studio`: guard `import.meta.env` for non-Vite hosts
`packages/studio/src/components/editor/manualEditingAvailability.ts` unconditionally reads `import.meta.env`. That's a Vite-only extension; in plain ESM hosts (Next.js / Turbopack, Node, jest in some configs) `import.meta` exists but `import.meta.env` is `undefined`. Reading any property off undefined throws at module evaluation time, so the studio fails to load the moment a non-Vite host imports anything from `@hyperframes/studio`.
Guarded the read so the module is loadable everywhere; outside Vite, every flag falls back to its declared default, preserving Vite behavior.
### Changes
**core:**
- `mv src/runtime/adapters/lottieReadiness.{ts,test.ts}` → `src/`
- Update `src/runtime/adapters/lottie.ts` re-export path
- Update `package.json` + `publishConfig.exports` to point at the new dist path (`./dist/lottieReadiness.{js,d.ts}`)
**studio:**
- One-line guard in `manualEditingAvailability.ts:30` with explanatory comment
## Test plan
- [x] `pnpm typecheck` (core, studio) — clean
- [x] `bun run build` (core) — `dist/lottieReadiness.{js,d.ts}` now present
- [x] `bunx vitest run` (core) — 862/862 passing
- [x] `bun run typecheck` (studio) — clean, resolves moved file via subpath export
- [ ] Publish 0.6.8 and verify the tarball contains `dist/lottieReadiness.js`
- [ ] Verify a non-Vite ESM consumer (e.g. a Next.js / Turbopack app) imports `@hyperframes/studio` without `import.meta.env` errors
🤖 Generated with [Claude Code](https://claude.com/claude-code)
162 lines
5.7 KiB
JSON
162 lines
5.7 KiB
JSON
{
|
|
"name": "@hyperframes/core",
|
|
"version": "0.6.9",
|
|
"description": "",
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "https://github.com/heygen-com/hyperframes",
|
|
"directory": "packages/core"
|
|
},
|
|
"files": [
|
|
"dist",
|
|
"docs",
|
|
"schemas",
|
|
"README.md"
|
|
],
|
|
"type": "module",
|
|
"main": "./src/index.ts",
|
|
"types": "./src/index.ts",
|
|
"exports": {
|
|
".": {
|
|
"import": "./src/index.ts",
|
|
"types": "./src/index.ts"
|
|
},
|
|
"./lint": {
|
|
"import": "./src/lint/index.ts",
|
|
"types": "./src/lint/index.ts"
|
|
},
|
|
"./compiler": {
|
|
"import": "./src/compiler/index.ts",
|
|
"types": "./src/compiler/index.ts"
|
|
},
|
|
"./runtime": "./dist/hyperframe.runtime.iife.js",
|
|
"./runtime/lottie-readiness": {
|
|
"import": "./src/lottieReadiness.ts",
|
|
"types": "./src/lottieReadiness.ts"
|
|
},
|
|
"./studio-api": {
|
|
"import": "./src/studio-api/index.ts",
|
|
"types": "./src/studio-api/index.ts"
|
|
},
|
|
"./studio-api/screenshot-clip": {
|
|
"import": "./src/studio-api/helpers/screenshotClip.ts",
|
|
"types": "./src/studio-api/helpers/screenshotClip.ts"
|
|
},
|
|
"./studio-api/manual-edits-render-script": {
|
|
"import": "./src/studio-api/helpers/manualEditsRenderScript.ts",
|
|
"types": "./src/studio-api/helpers/manualEditsRenderScript.ts"
|
|
},
|
|
"./studio-api/studio-motion-render-script": {
|
|
"import": "./src/studio-api/helpers/studioMotionRenderScript.ts",
|
|
"types": "./src/studio-api/helpers/studioMotionRenderScript.ts"
|
|
},
|
|
"./text": {
|
|
"import": "./src/text/index.ts",
|
|
"types": "./src/text/index.ts"
|
|
},
|
|
"./registry": {
|
|
"import": "./src/registry/index.ts",
|
|
"types": "./src/registry/index.ts"
|
|
},
|
|
"./schemas/registry.json": "./schemas/registry.json",
|
|
"./schemas/registry-item.json": "./schemas/registry-item.json"
|
|
},
|
|
"publishConfig": {
|
|
"access": "public",
|
|
"exports": {
|
|
".": {
|
|
"import": "./dist/index.js",
|
|
"types": "./dist/index.d.ts"
|
|
},
|
|
"./lint": {
|
|
"import": "./dist/lint/index.js",
|
|
"types": "./dist/lint/index.d.ts"
|
|
},
|
|
"./compiler": {
|
|
"import": "./dist/compiler/index.js",
|
|
"types": "./dist/compiler/index.d.ts"
|
|
},
|
|
"./runtime": "./dist/hyperframe.runtime.iife.js",
|
|
"./runtime/lottie-readiness": {
|
|
"import": "./dist/lottieReadiness.js",
|
|
"types": "./dist/lottieReadiness.d.ts"
|
|
},
|
|
"./studio-api": {
|
|
"import": "./dist/studio-api/index.js",
|
|
"types": "./dist/studio-api/index.d.ts"
|
|
},
|
|
"./studio-api/screenshot-clip": {
|
|
"import": "./dist/studio-api/helpers/screenshotClip.js",
|
|
"types": "./dist/studio-api/helpers/screenshotClip.d.ts"
|
|
},
|
|
"./studio-api/manual-edits-render-script": {
|
|
"import": "./dist/studio-api/helpers/manualEditsRenderScript.js",
|
|
"types": "./dist/studio-api/helpers/manualEditsRenderScript.d.ts"
|
|
},
|
|
"./studio-api/studio-motion-render-script": {
|
|
"import": "./dist/studio-api/helpers/studioMotionRenderScript.js",
|
|
"types": "./dist/studio-api/helpers/studioMotionRenderScript.d.ts"
|
|
},
|
|
"./text": {
|
|
"import": "./dist/text/index.js",
|
|
"types": "./dist/text/index.d.ts"
|
|
},
|
|
"./registry": {
|
|
"import": "./dist/registry/index.js",
|
|
"types": "./dist/registry/index.d.ts"
|
|
},
|
|
"./schemas/registry.json": "./schemas/registry.json",
|
|
"./schemas/registry-item.json": "./schemas/registry-item.json"
|
|
},
|
|
"main": "./dist/index.js",
|
|
"types": "./dist/index.d.ts"
|
|
},
|
|
"scripts": {
|
|
"build": "bun run build:hyperframes-runtime && tsc",
|
|
"test": "vitest run",
|
|
"test:watch": "vitest",
|
|
"test:coverage": "vitest run --coverage",
|
|
"typecheck": "tsc --noEmit",
|
|
"lint:runtime-preview-guards": "tsx scripts/lint-runtime-preview-guards.ts",
|
|
"build:hyperframes-runtime": "tsx scripts/build-hyperframes-runtime-artifact.ts",
|
|
"build:hyperframes-runtime:modular": "SANDBOX_RUNTIME_VARIANT=modular tsx scripts/build-hyperframes-runtime-artifact.ts",
|
|
"build:hyperframe-runtime": "tsx scripts/build-hyperframes-runtime-artifact.ts",
|
|
"test:hyperframe-runtime-contract": "tsx scripts/test-hyperframe-runtime-contract.ts",
|
|
"test:hyperframe-runtime-behavior": "tsx scripts/test-hyperframe-runtime-behavior.ts",
|
|
"test:hyperframe-runtime-seek": "tsx scripts/test-hyperframe-runtime-seek.ts",
|
|
"test:hyperframe-runtime-duration-guards": "tsx scripts/test-hyperframe-runtime-duration-guards.ts",
|
|
"test:hyperframe-runtime-parity": "tsx scripts/test-hyperframe-runtime-parity.ts",
|
|
"test:hyperframe-runtime-security": "tsx scripts/test-hyperframe-runtime-security.ts",
|
|
"test:hyperframe-linter": "tsx scripts/test-hyperframe-linter.ts",
|
|
"test:hyperframe-runtime-ci": "bun run build:hyperframes-runtime && bun run test:hyperframe-runtime-contract && bun run test:hyperframe-runtime-behavior && bun run test:hyperframe-runtime-seek && bun run test:hyperframe-runtime-duration-guards && bun run test:hyperframe-runtime-parity && bun run test:hyperframe-runtime-security",
|
|
"check:hyperframe-html": "tsx scripts/check-hyperframe-static.ts",
|
|
"debug:timeline": "tsx scripts/debug-timeline.ts",
|
|
"prepublishOnly": "echo skip"
|
|
},
|
|
"dependencies": {
|
|
"@chenglou/pretext": "^0.0.5",
|
|
"postcss": "^8.5.8"
|
|
},
|
|
"devDependencies": {
|
|
"@types/jsdom": "^28.0.0",
|
|
"@types/node": "^25.0.10",
|
|
"@vitest/coverage-v8": "^3.2.4",
|
|
"jsdom": "^29.0.0",
|
|
"tsx": "^4.21.0",
|
|
"typescript": "^5.0.0",
|
|
"vitest": "^3.2.4"
|
|
},
|
|
"peerDependencies": {
|
|
"hono": "^4.0.0"
|
|
},
|
|
"peerDependenciesMeta": {
|
|
"hono": {
|
|
"optional": true
|
|
}
|
|
},
|
|
"optionalDependencies": {
|
|
"esbuild": "^0.25.12",
|
|
"linkedom": "^0.18.12"
|
|
}
|
|
}
|