refactor: extract @hyperframes/studio-server from core#1757
Merged
Conversation
5 tasks
9b0a843 to
019278f
Compare
16bab21 to
9349056
Compare
Collaborator
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
This was referenced Jun 27, 2026
dcce528 to
79649b6
Compare
terencecho
previously approved these changes
Jun 27, 2026
terencecho
left a comment
Contributor
There was a problem hiding this comment.
Clean, well-executed extraction. The circular workspace dep is the most interesting risk on paper, but it's structured safely — happy to ship.
Verified
- Circular dep is safe. Both
studio-server/tsup.config.ts:14and core's tsup pipeline rely on tsup's default-externalize-deps-from-package.json behavior (same pattern as siblingparsers/lint).studio-server/package.json:90declares@hyperframes/corein deps → tsup emits a runtimeimportrather than bundling. The cycle is deep —core/src/index.tsdoesn't import studio-api at top level, andstudio-server/src/index.tsdoesn't directly import@hyperframes/coreat top level either — so ESM lazy module eval breaks it before either side initializes. Bun-dev resolves both tosrc/...but the same depth saves it. - Backwards-compat stubs complete. Core's
package.jsonstill declares./studio-api,./studio-api/screenshot-clip,./studio-api/manual-edits-render-script,./studio-api/studio-motion-render-script,./studio-api/draft-markers,./studio-api/finite-mutation. Each correspondingpackages/core/src/studio-api/helpers/<file>.tsis a 2-lineexport * from "@hyperframes/studio-server/<sub>"stub. Old imports continue to resolve. - No silent route drop.
packages/studio-server/src/createStudioApi.tsregisters 10 routes (projects/storyboard/files/preview/lint/render/thumbnail/waveform/fonts/registry) — identical to master'spackages/core/src/studio-api/createStudioApi.ts. Verified line-by-line. - CLI mount sig preserved.
cli/src/server/studioServer.ts:242-258just swaps the import path (@hyperframes/core/studio-api→@hyperframes/studio-server); thecreateStudioApi(adapter)call shape is unchanged. - Test relocation parity.
preview-regression.yml:86correctly updated tobun run --cwd packages/studio-server test -- src/routes/thumbnail.test.ts. Workflow also builds@hyperframes/studio-serverbefore core (line 80).Dockerfile.test:78,93mirrors this. - Stack-base:
gh pr diff 1757is the studio-server delta only — no parser-package leakage. - Dependency hygiene:
studio-server/package.json:90-96has core + parsers + hono + linkedom + postcss + postcss-selector-parser. Core picks up@hyperframes/studio-serveratpackages/core/package.json:357. CLI / producer / studio all updated.set-version.ts:25+publish.yml:128add studio-server to the version-sync + publish order (parsers → studio-server → core) — correct given the cycle.
Non-blocking polish
- Stale consumer imports on the deprecated path.
cli/src/utils/staticProjectServer.ts:4,cli/src/commands/play.ts:110,studio/src/hooks/gsapScriptCommitHelpers.ts:1,studio/src/hooks/useDomEditCommits.ts,studio/src/hooks/useGsapScriptCommits.ts,studio/src/hooks/useGestureRecording.ts,cli/src/commands/present.tsall still import from@hyperframes/core/studio-api/*. These resolve via the stubs and work, but a bulk-migrate (either in this PR or as a follow-up issue) would lock in the new package name and let the stubs be deleted in a future round. - Build-order asymmetry. Workflow builds
studio-serverbeforecoreeven though core depends on studio-server. tsup's dts generation resolves types via"types": "./src/index.ts"so it works — but a one-line comment in the workflow noting why this order is correct (it's not topological — the"types"condition rescues it) would help the next person who touches it.
— Review by tai (pr-review)
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).
79649b6 to
99ceace
Compare
0eb1a42 to
cdf9c81
Compare
The base branch was changed.
99ceace to
dd33a4a
Compare
… 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.
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.
…io-server # Conflicts: # .fallowrc.jsonc # .github/workflows/preview-regression.yml # .github/workflows/publish.yml # Dockerfile.test # bun.lock # package.json # packages/cli/tsup.config.ts # packages/producer/package.json # scripts/set-version.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Extracts the studio preview server — the
studio-apiHono routes, helpers, and server wiring — out of@hyperframes/core/src/studio-api/into a new@hyperframes/studio-serverpackage.Part of #1749: pulls the HTTP/preview server out of core so an embedder can mount the studio backend without depending on the entire core surface, and so core stops carrying a web server it doesn't need at render time.
Part 3 of 3 — stacks on #1755 (
@hyperframes/parsers). Independent of Part 2 (lint); merge A first, then B and C in either order.What moves
src/studio-api/)This includes the route handlers (
files,thumbnail, mutation endpoints), the source-mutation helpers, and the server bootstrap.Bundle footprint
dist/(unpacked)How
@hyperframes/corechangespackages/core/src/studio-api/index.tsbecomes a@deprecatedre-export stub pointing at the new package, so@hyperframes/core/studio-apiimports keep resolving.The notable wrinkle: this creates an intentional circular workspace dependency.
core re-exports studio-server for back-compat, while studio-server genuinely consumes core's types/compiler. tsup handles it by marking both
@hyperframes/*packages external during each build, so neither bundles the other — the cycle exists only in the module graph, never in the emitted output. core picks up@hyperframes/studio-serveras a dependency; studio-server depends on core + parsers +hono+linkedom+ postcss.Design notes
thumbnail.test.ts) moves with the routes frompackages/coretopackages/studio-server; the preview-regression workflow is updated to point at the new location."bun"export condition before"node"(same convention as the rest of the stack) keeps the dev loop build-free while Node/tsx/Docker resolve builtdist/.Test plan
bun run --filter @hyperframes/studio-server test— 201 tests passbun run --cwd packages/cli test— 1045 tests passbun run build— full monorepo build succeeds (circular dep resolves cleanly)