You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(hub): expose bakeHubStatic to bake an already-mounted context
Extract buildHub's post-mount baker into a public bakeHubStatic(ctx, opts)
so a host that assembles and mounts its own hub context (Vite DevTools'
kit-augmented context, devframes mounted from Vite plugins) reuses the
exact baker instead of reimplementing it and drifting out of sync.
- bakeHubStatic bakes an already-mounted DevframeHubContext; buildHub is now
createHubContext + mountDevframes + bakeHubStatic.
- Enumerate mounted frames via ctx.frames (HubMountedFrame), populated in
prepareDevframe, so an externally-mounted context can emit __index.json
and per-frame __connection.json.
- Materialize statics from ctx.views.buildStaticDirs (each entry now carries
its resolveFrom); route page scripts through views.hostStatic so they land
there too.
- Add a clean opt-out so the baker can write beside an app's own build output.
It then serves only hub-level endpoints and transport; serve each mounted devframe's meta from `hub.connectionMeta()` yourself.
129
+
130
+
The same context works for a static build: `bakeHubStatic(ctx, { outDir, base })` from `@devframes/hub/build` bakes an already-mounted context (`buildHub` is `createHubContext` + `mountDevframes` + `bakeHubStatic`). It reads `ctx.views.buildStaticDirs` for the statics to copy and `ctx.frames` for the frames to advertise, so a host that mounted its own context reuses the exact baker rather than reimplementing it. Pass `clean: false` to bake beside an app's own build output.
Copy file name to clipboardExpand all lines: docs/content/6.errors/DF8006.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ description: 'A static hub build can only write mounts under its own base: "{url
9
9
10
10
## Cause
11
11
12
-
`buildHub` maps every mounted URL base to a directory under its `outDir` (which corresponds to the hub `base` at serve time), so a mount whose base lies outside the hub base has no on-disk location in the output. This happens when a devframe is installed with an explicit base outside the hub base, e.g. `ctx.install(devframe, { base: '/elsewhere/' })` from `configure`.
12
+
`bakeHubStatic` (which `buildHub` runs) maps every mounted URL base to a directory under its `outDir` (which corresponds to the hub `base` at serve time), so a mount whose base lies outside the hub base has no on-disk location in the output. This happens when a devframe is installed with an explicit base outside the hub base, e.g. `ctx.install(devframe, { base: '/elsewhere/' })` from `configure`.
13
13
14
14
## Example
15
15
@@ -30,4 +30,4 @@ await buildHub({
30
30
31
31
## Source
32
32
33
-
-[`packages/hub/src/node/build.ts`](https://github.com/devframes/devframe/blob/main/packages/hub/src/node/build.ts): `buildHub()`'s mount-to-disk mapping throws this for any mount base outside the hub base.
33
+
-[`packages/hub/src/node/bake.ts`](https://github.com/devframes/devframe/blob/main/packages/hub/src/node/bake.ts): `bakeHubStatic()`'s mount-to-disk mapping throws this for any mount base outside the hub base.
`bakeHubStatic(ctx, options)` from `@devframes/hub/build` is the second half of `buildHub`: it bakes an already-mounted `DevframeHubContext` a caller assembled itself (`createHubContext` + `ctx.install`, or a framework kit's own context), reading `ctx.views.buildStaticDirs` for the statics to copy and `ctx.frames` for the frames to advertise. `buildHub` is `createHubContext` + `mountDevframes` + `bakeHubStatic`. Options: `outDir`, `base`, `ui`, `renderers`, `name`, `version`, `pretty`, and `clean`, same contracts as their `buildHub` counterparts.
101
+
97
102
## Client runtime options
98
103
99
104
The options of `createDevframeClientRuntime()`: [The client runtime](/guide/client-context#the-client-runtime).
0 commit comments