refactor: extract @hyperframes/studio-server from core (#1757)

* refactor: extract @hyperframes/studio-server package from core

Moves all studio-api routes, helpers, and Hono server wiring from
packages/core/src/studio-api/ into a new standalone packages/studio-server
package (@hyperframes/studio-server).

Core keeps thin re-export stubs at @hyperframes/core/studio-api and the
subpath helpers (screenshot-clip, draft-markers, etc.) for backward
compatibility. Consumer imports (cli studioServer, vite adapter/config,
producer htmlCompiler, studio manualEditsTypes) are updated to import from
@hyperframes/studio-server directly.

Also exports rewriteInlineStyleAssetUrls from @hyperframes/core root (was
in compiler/rewriteSubCompPaths.ts but not re-exported), required by
@hyperframes/studio-server/helpers/subComposition.

Removes postcss-selector-parser from @hyperframes/core dependencies (moved
to @hyperframes/studio-server which owns the routes that used it).

Depends on @hyperframes/parsers (PR #1755).

* fix(ci): add parsers+studio-server to Dockerfile and build before preview tests

* fix(ci): build @hyperframes/studio-server before Test and studio load smoke

Studio's vite.config.ts imports @hyperframes/studio-server, which resolves
via its "node" export condition to built dist. The Test and studio-load-smoke
jobs only built parsers + core, so esbuild's config load failed to resolve the
package entry. Build studio-server too.

* fix(studio): repoint sdkCutoverParity test import to studio-server

sourceMutation moved from core's studio-api to @hyperframes/studio-server;
the test still imported the deleted core path. This was masked while studio's
vite.config failed to load (couldn't resolve studio-server); now that the
config loads, the test runs and the stale import surfaced.
This commit is contained in:
Miguel Ángel
2026-06-27 01:24:01 -04:00
committed by GitHub
parent 98d0bdd73c
commit 7a4853dfe6
74 changed files with 2177 additions and 1149 deletions
+1
View File
@@ -58,6 +58,7 @@
"@hyperframes/parsers": "workspace:*",
"@hyperframes/player": "workspace:*",
"@hyperframes/sdk": "workspace:*",
"@hyperframes/studio-server": "workspace:*",
"@phosphor-icons/react": "^2.1.10",
"bpm-detective": "^2.0.5",
"dompurify": "^3.2.4",
@@ -5,7 +5,7 @@ export {
STUDIO_WIDTH_PROP,
STUDIO_HEIGHT_PROP,
STUDIO_MANUAL_EDIT_GESTURE_ATTR,
} from "@hyperframes/core/studio-api/draft-markers";
} from "@hyperframes/studio-server/draft-markers";
export const STUDIO_ROTATION_PROP = "--hf-studio-rotation";
/* ── Internal DOM attribute names ─────────────────────────────────── */
@@ -1,6 +1,6 @@
import { describe, expect, it } from "vitest";
import { openComposition } from "@hyperframes/sdk";
import { patchElementInHtml } from "../../../core/src/studio-api/helpers/sourceMutation.js";
import { patchElementInHtml } from "../../../studio-server/src/helpers/sourceMutation.js";
import type { PatchOperation } from "./sourcePatcher";
import { patchOpsToSdkEditOps } from "./sdkOpMapping";
+2 -2
View File
@@ -15,9 +15,9 @@ import {
type ResolvedProject,
type RenderJobState,
type StudioApiAdapter,
} from "@hyperframes/core/studio-api";
createProjectSignature,
} from "@hyperframes/studio-server";
import type { RegistryItem } from "@hyperframes/core/registry";
import { createProjectSignature } from "../core/src/studio-api/helpers/projectSignature";
import { createRetryingModuleLoader, ensureProducerDist } from "./vite.producer";
import { createStudioDevRenderBodyScripts } from "./vite.studioMotion";
import { generateThumbnail, findSystemChrome } from "./vite.browser";
+2 -2
View File
@@ -65,7 +65,7 @@ function devProjectApi(): Plugin {
let _api: { fetch: (req: Request) => Promise<Response> } | null = null;
const getApi = async () => {
if (!_api) {
const mod = await server.ssrLoadModule("@hyperframes/core/studio-api");
const mod = await server.ssrLoadModule("@hyperframes/studio-server");
const adapter = createViteAdapter(dataDir, server);
_api = mod.createStudioApi(adapter);
}
@@ -188,7 +188,7 @@ export default defineConfig({
},
ssr: {
// recast / @babel/parser are CommonJS and call `require("fs")`. They are
// reachable only server-side via the Node-only `@hyperframes/core/gsap-parser`
// reachable only server-side via the Node-only `@hyperframes/parsers/gsap-parser`
// subpath (studio-api GSAP mutations + the linter), which the dev server loads
// through Vite SSR. Externalizing them makes SSR load the native Node modules
// instead of esbuild-transforming the `require` into a shim that throws