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): bake mounts outside the hub base as deploy-root siblings
Relax buildHub's resolveOutPath so a mount base outside the hub base
resolves to outDir's parent (the deploy root) by its absolute path,
with the hub subtree still at outDir. This lets buildHub bake a context
whose devframe SPAs and assets are served as top-level siblings of the
hub base (Vite DevTools' layout) rather than children of it.
Closes#353
Copy file name to clipboardExpand all lines: docs/content/1.guide/18.hub-initiate.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -113,6 +113,8 @@ await buildHub({
113
113
})
114
114
```
115
115
116
+
A mount served outside the hub base writes to `outDir`'s parent (the deploy root) by its absolute path, so a host can keep the hub at `/__devtools/` while its devframe SPAs and assets stay top-level siblings (`/__inspect/`, `/__devtools-assets/`) rather than children of the hub base. `outDir` holds the hub subtree, its parent holds the whole deploy root, and either directory serves as-is.
117
+
116
118
Browser-side tools keep working in full: a page script still loads into the host page and talks to its panel over the [in-page channel](/guide/in-page-channel) (the a11y inspector scans a production app exactly as it does in dev). Reads resolve from the baked dump (`static`/`snapshot` RPCs, shared-state snapshots); live writes (messages, command execution) have no server, so the browser clients degrade to local no-ops, and a panel's dock-activation deep links ride a same-origin `BroadcastChannel` instead of the RPC relay.
117
119
118
120
A devframe whose value is inherently live declares `capabilities.build: false` and silently stays out of the build entirely - no dock, no SPA copy, no RPCs in the dump. The built-in terminals, code-server, and assets devframes declare it, so a hub mounting every built-in bakes only the tools that mean something statically. See the [buildHub options](/references/hub-api#buildhub-options) reference, and [`examples/a11y-messages-playground`](https://github.com/devframes/devframe/tree/main/examples/a11y-messages-playground) for a Vite host whose `vite build` output ships the hub.
title: 'DF8006: Static Build Mount Escapes the Hub Base'
3
-
description: 'A static hub build can only write mounts under its own base: "{urlBase}" escapes "{base}".'
2
+
title: 'DF8006: Static Build Mount Base Is Not Absolute'
3
+
description: 'A static hub build writes each mount either under its base ("{base}") or as an absolute-path sibling of it, but "{urlBase}" is neither.'
4
4
---
5
5
6
6
## Message
7
7
8
-
> A static hub build can only write mounts under its own base: "`{urlBase}`" escapes "`{base}`"
8
+
> A static hub build writes each mount either under its base ("`{base}`") or as an absolute-path sibling of it, but "`{urlBase}`" is neither
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
+
`buildHub` maps a mount under the hub `base` into its `outDir` (the hub subtree), and any other mount to the deploy root (`outDir`'s parent) by its absolute path, so a devframe SPA or asset dir served as a sibling of the hub base still lands beside it. A mount base that is neither under the hub base nor an absolute path has no on-disk location in the output.
13
13
14
14
## Example
15
15
16
16
```ts
17
17
awaitbuildHub({
18
18
outDir: 'dist/__devframes',
19
19
async configure(ctx) {
20
-
// ✗ Bad: `/tools/x/` is not under the `/__devframes/` hub base
// ✓ Good: under the hub base, written into `outDir`
21
+
awaitctx.install(a, { base: '/__devframes/a/' })
22
+
// ✓ Good: an absolute sibling, written to the deploy root beside the hub
23
+
awaitctx.install(b, { base: '/tools/b/' })
24
+
// ✗ Bad: a relative base resolves against neither
25
+
awaitctx.install(c, { base: 'tools/c/' })
22
26
},
23
27
})
24
28
```
25
29
26
30
## Fix
27
31
28
-
- Drop the `base` override so the devframe mounts at `<hub base><id>/`, or point it somewhere under the hub base.
29
-
- Or move the hub `base` up (e.g. `base: '/'`) so it contains every mount.
32
+
Give the mount an absolute base (starting with `/`): a base under the hub base writes into `outDir`, and any other absolute base writes to the deploy root by its path.
30
33
31
34
## Source
32
35
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.
36
+
-[`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 a mount base that is not absolute.
Copy file name to clipboardExpand all lines: docs/content/8.references/6.hub-api.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -90,7 +90,7 @@ The options of `buildHub()` from `@devframes/hub/build`: [Static builds](/guide/
90
90
91
91
| Option | Purpose |
92
92
|---|---|
93
-
|`outDir`| Output directory for the hub subtree; corresponds to `base` at serve time (build `base: '/__devframes/'` into `dist/__devframes`). |
93
+
|`outDir`| Output directory for the hub subtree; corresponds to `base` at serve time (build `base: '/__devframes/'` into `dist/__devframes`). A mount served outside the hub base (a devframe SPA or asset dir kept as a sibling of it) is written to this directory's parent (the deploy root) by its absolute path. |
94
94
|`base`| Mount base baked into every absolute URL the build emits. Default `/__devframes/`. |
95
95
|`context`| An already-mounted `DevframeHubContext` to bake instead of `devframes` (the build counterpart of `initHub({ context })`); reads `ctx.frames` and `ctx.views.buildStaticDirs`. Mutually exclusive with `devframes`. |
96
96
|`clean`| Remove `outDir` before writing. Default `true`; set `false` to bake beside an app's own build output. |
fix: 'A hub exposes one aggregate MCP endpoint over every mounted devframe, so per-devframe `mcp` settings are ignored. Drop `mcp: false` from `initHub` (the `\'auto\'` default mounts the aggregate route once agent tools exist) to surface this devframe\'s tools, or drop `mcp` from the devframe to silence this warning.',
36
36
},
37
37
DF8006: {
38
-
why: (p: {urlBase: string,base: string})=>`A static hub build can only write mounts under its own base: "${p.urlBase}" escapes "${p.base}".`,
39
-
fix: 'buildHub maps each mount base to a directory under its `outDir`, so every mount must live under the hub base. Drop the `basePath` override (or the `ctx.install` base) that points outside it, or move the hub `base` up so it contains the mount.',
38
+
why: (p: {urlBase: string,base: string})=>`A static hub build writes each mount either under its base ("${p.base}") or as an absolute-path sibling of it, but "${p.urlBase}" is neither.`,
39
+
fix: 'buildHub maps a mount under the hub base into its `outDir`, and any other mount to the deploy root (`outDir`\'s parent) by its absolute path. Give the mount an absolute base (starting with `/`) so it resolves to one of those.',
40
40
},
41
41
DF8100: {
42
42
why: (p: {id: string})=>`Dock with id "${p.id}" is already registered`,
0 commit comments