From 3270908307bf4127ec796c5967b39bd2935941cb Mon Sep 17 00:00:00 2001 From: Terence Cho Date: Fri, 15 May 2026 00:54:17 -0700 Subject: [PATCH 1/2] fix(core): move lottieReadiness out of src/runtime so it ships in dist MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "./runtime/lottie-readiness" subpath export claimed to point at ./dist/runtime/adapters/lottieReadiness.js, but the published 0.6.6 and 0.6.7 tarballs never contained that file. Reason: packages/core/tsconfig.json excludes "src/runtime" (those files run in a browser context and are bundled separately into the IIFE artifact), so tsc never emitted the compiled output. Consumers that import the subpath — most notably @hyperframes/studio's Player.tsx — fail to resolve the module and the build breaks at the consumer site. lottieReadiness.ts is a pure helper: takes `unknown`, returns `boolean`, no DOM or `window` access. It doesn't belong under src/runtime/ in the first place — that's why 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" so existing consumers (studio) don't need a code change; only the exports map's underlying file path moves to ./dist/lottieReadiness.{js,d.ts}. - 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 new dist path Verified: full core test suite passes (862/862), dist now contains lottieReadiness.{js,d.ts}, studio typechecks against the moved file. Co-Authored-By: Claude Opus 4.7 (1M context) --- packages/core/package.json | 8 ++++---- .../src/{runtime/adapters => }/lottieReadiness.test.ts | 0 .../core/src/{runtime/adapters => }/lottieReadiness.ts | 0 packages/core/src/runtime/adapters/lottie.ts | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) rename packages/core/src/{runtime/adapters => }/lottieReadiness.test.ts (100%) rename packages/core/src/{runtime/adapters => }/lottieReadiness.ts (100%) diff --git a/packages/core/package.json b/packages/core/package.json index 300251328..fe07d3849 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -31,8 +31,8 @@ }, "./runtime": "./dist/hyperframe.runtime.iife.js", "./runtime/lottie-readiness": { - "import": "./src/runtime/adapters/lottieReadiness.ts", - "types": "./src/runtime/adapters/lottieReadiness.ts" + "import": "./src/lottieReadiness.ts", + "types": "./src/lottieReadiness.ts" }, "./studio-api": { "import": "./src/studio-api/index.ts", @@ -78,8 +78,8 @@ }, "./runtime": "./dist/hyperframe.runtime.iife.js", "./runtime/lottie-readiness": { - "import": "./dist/runtime/adapters/lottieReadiness.js", - "types": "./dist/runtime/adapters/lottieReadiness.d.ts" + "import": "./dist/lottieReadiness.js", + "types": "./dist/lottieReadiness.d.ts" }, "./studio-api": { "import": "./dist/studio-api/index.js", diff --git a/packages/core/src/runtime/adapters/lottieReadiness.test.ts b/packages/core/src/lottieReadiness.test.ts similarity index 100% rename from packages/core/src/runtime/adapters/lottieReadiness.test.ts rename to packages/core/src/lottieReadiness.test.ts diff --git a/packages/core/src/runtime/adapters/lottieReadiness.ts b/packages/core/src/lottieReadiness.ts similarity index 100% rename from packages/core/src/runtime/adapters/lottieReadiness.ts rename to packages/core/src/lottieReadiness.ts diff --git a/packages/core/src/runtime/adapters/lottie.ts b/packages/core/src/runtime/adapters/lottie.ts index 74da88a16..88dc35c52 100644 --- a/packages/core/src/runtime/adapters/lottie.ts +++ b/packages/core/src/runtime/adapters/lottie.ts @@ -1,6 +1,6 @@ import type { RuntimeDeterministicAdapter } from "../types"; import { swallow } from "../diagnostics"; -export { isLottieAnimationLoaded } from "./lottieReadiness"; +export { isLottieAnimationLoaded } from "../../lottieReadiness"; /** * Lottie adapter for HyperFrames From 4426ffa659b98474a850bf15a85340ca483b225d Mon Sep 17 00:00:00 2001 From: Terence Cho Date: Fri, 15 May 2026 20:36:29 -0700 Subject: [PATCH 2/2] fix(studio): guard import.meta.env for non-Vite consumers 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`. Guard the read so the module is loadable everywhere; outside Vite, every flag falls back to its declared default, preserving Vite behavior. Co-Authored-By: Claude Sonnet 4.6 --- .../src/components/editor/manualEditingAvailability.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/studio/src/components/editor/manualEditingAvailability.ts b/packages/studio/src/components/editor/manualEditingAvailability.ts index 5fd276639..345ca8f41 100644 --- a/packages/studio/src/components/editor/manualEditingAvailability.ts +++ b/packages/studio/src/components/editor/manualEditingAvailability.ts @@ -27,7 +27,12 @@ export function resolveStudioBooleanEnvFlag( return fallback; } -const env = import.meta.env as StudioFeatureFlagEnv; +// `import.meta.env` is a Vite-only extension. In non-Vite ESM hosts +// (Next.js / Turbopack, Node, jest in some configs) it's undefined, +// and downstream `env[name]` reads would crash. Fall back to `{}` so +// every flag resolves to its declared default outside Vite. Direct +// property access keeps Vite's compile-time transform happy. +const env = (import.meta.env ?? {}) as StudioFeatureFlagEnv; export const STUDIO_PREVIEW_MANUAL_EDITING_ENABLED = resolveStudioBooleanEnvFlag( env,