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): let buildHub bake statics/frames outside the hub base
Add a `deployBase` option to `buildHub` so a context whose devframe SPAs
and static assets are served as siblings of the hub base (not children of
it) still bakes. `outDir` maps to `deployBase`; the hub's own artifacts
write under `base` within it, and every mount base resolves against the
deploy root by its path below it. Default `deployBase` stays `base`, the
existing single-subtree layout.
Closes#353
Copy file name to clipboardExpand all lines: docs/content/6.errors/DF8006.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,15 @@
1
1
---
2
-
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 Escapes the Deploy Root'
3
+
description: 'A static hub build can only write mounts under its deploy root: "{urlBase}" escapes "{base}".'
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 can only write mounts under its deploy root: "`{urlBase}`" escapes "`{base}`"
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 every mounted URL base to a directory under its `outDir`, so a mount whose base lies outside the deploy root has no on-disk location in the output. The deploy root defaults to the hub `base`; a wider `deployBase` (e.g. `/`) lets devframe SPAs and assets live as siblings of the hub base. This fires when a devframe is installed with an explicit base outside that root, e.g. `ctx.install(devframe, { base: '/elsewhere/' })` from `configure`.
13
13
14
14
## Example
15
15
@@ -26,8 +26,8 @@ await buildHub({
26
26
## Fix
27
27
28
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.
29
+
- Or pass a wider `deployBase`(e.g. `/`) so `outDir` maps to a deploy root that contains every mount, with the hub's own artifacts still written under `base`.
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/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 deploy root.
description: 'The hub base "{base}" is outside the deploy root "{deployBase}", so its artifacts have no place under `outDir`.'
4
+
---
5
+
6
+
## Message
7
+
8
+
> The hub base "`{base}`" is outside the deploy root "`{deployBase}`", so its artifacts have no place under `outDir`
9
+
10
+
## Cause
11
+
12
+
`buildHub` writes the hub's own artifacts (`__connection.json`, `__index.json`, the RPC dump, renderer modules, the UI slot) under `base` inside `outDir`, and `outDir` maps to `deployBase`. If `base` does not live within `deployBase`, there is no directory below `outDir` for those artifacts.
13
+
14
+
## Example
15
+
16
+
```ts
17
+
awaitbuildHub({
18
+
outDir: 'dist',
19
+
base: '/__hub/',
20
+
/** ✗ Bad: `/__hub/` is not under `/elsewhere/` */
21
+
deployBase: '/elsewhere/',
22
+
})
23
+
```
24
+
25
+
## Fix
26
+
27
+
- Move `base` under `deployBase` (the hub base must be a child of the deploy root).
28
+
- Or widen `deployBase` so it contains the hub base (e.g. `deployBase: '/'`).
29
+
30
+
## Source
31
+
32
+
-[`packages/hub/src/node/build.ts`](https://github.com/devframes/devframe/blob/main/packages/hub/src/node/build.ts): `buildHub()` throws this when `base` does not start with the resolved `deployBase`.
Copy file name to clipboardExpand all lines: docs/content/8.references/6.hub-api.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -90,8 +90,9 @@ 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 the build writes into; maps to `deployBase` at serve time (build `base: '/__devframes/'` into `dist/__devframes`, or `deployBase: '/'` into `dist` for a sibling layout). |
94
94
|`base`| Mount base baked into every absolute URL the build emits. Default `/__devframes/`. |
95
+
|`deployBase`| Deploy-root URL that `outDir` maps to, letting devframe SPAs and assets serve as siblings of the hub `base` rather than children. Must contain `base`. Default `base`. |
95
96
|`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
97
|`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 can only write mounts under its deploy root: "${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 deploy root. Drop the `basePath` override (or the `ctx.install` base) that points outside it, or pass a wider `deployBase` (e.g. `/`) so `outDir` maps to a root that contains the mount.',
40
+
},
41
+
DF8007: {
42
+
why: (p: {base: string,deployBase: string})=>`The hub base "${p.base}" is outside the deploy root "${p.deployBase}", so its artifacts have no place under \`outDir\`.`,
43
+
fix: 'The hub base must live within `deployBase` (its artifacts write under `base` inside `outDir`). Move `base` under `deployBase`, or widen `deployBase` so it contains the hub base.',
40
44
},
41
45
DF8100: {
42
46
why: (p: {id: string})=>`Dock with id "${p.id}" is already registered`,
0 commit comments