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
It then serves only hub-level endpoints and transport; serve each mounted devframe's meta from `hub.connectionMeta()` yourself.
129
+
130
+
The same `context` option works for a static build: `buildHub({ context: ctx, outDir })` bakes an already-mounted context instead of a `devframes` list, reading `ctx.frames` and `ctx.views.buildStaticDirs` for what to emit, so a host that mounted its own context reuses `buildHub` 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/DF8002.md
+5-4Lines changed: 5 additions & 4 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: 'DF8002: Both devframes and context Passed to initHub'
3
-
description: 'initHub received both devframes and context; the two assembly modes are mutually exclusive.'
2
+
title: 'DF8002: Both devframes and context Passed to initHub/buildHub'
3
+
description: 'initHub/buildHub received both devframes and context; the two assembly modes are mutually exclusive.'
4
4
---
5
5
6
6
## Message
7
7
8
-
> initHub received both `devframes` and `context`; the two assembly modes are mutually exclusive.
8
+
> `initHub`/`buildHub` received both `devframes` and `context`; the two assembly modes are mutually exclusive.
9
9
10
10
## Cause
11
11
12
-
`initHub` assembles a hub two ways: **declaratively** (`devframes: [...]`, where the instance creates the hub context and mounts each devframe under `<base><id>/`), or **from a pre-built context** (`context: ctx`, where your host framework already mounted the devframes and the instance serves only the hub-level endpoints and transport). A `devframes` list cannot be mounted into a context the instance doesn't own, so passing both contradicts.
12
+
`initHub`(and `buildHub`) assembles a hub two ways: **declaratively** (`devframes: [...]`, where it creates the hub context and mounts each devframe under `<base><id>/`), or **from a pre-built context** (`context: ctx`, where your host framework already mounted the devframes). A `devframes` list cannot be mounted into a context it doesn't own, so passing both contradicts.
13
13
14
14
## Example
15
15
@@ -33,3 +33,4 @@ Pick one mode. Use `configure(ctx)` on the declarative mode when you need post-m
33
33
## Source
34
34
35
35
-[`packages/hub/src/node/initiate.ts`](https://github.com/devframes/devframe/blob/main/packages/hub/src/node/initiate.ts): `initHub` throws this during initialization when both options are present.
36
+
-[`packages/hub/src/node/build.ts`](https://github.com/devframes/devframe/blob/main/packages/hub/src/node/build.ts): `buildHub` throws this when both options are present.
Copy file name to clipboardExpand all lines: docs/content/8.references/6.hub-api.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
@@ -92,6 +92,8 @@ The options of `buildHub()` from `@devframes/hub/build`: [Static builds](/guide/
92
92
|---|---|
93
93
|`outDir`| Output directory for the hub subtree; corresponds to `base` at serve time (build `base: '/__devframes/'` into `dist/__devframes`). |
94
94
|`base`| Mount base baked into every absolute URL the build emits. Default `/__devframes/`. |
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
+
|`clean`| Remove `outDir` before writing. Default `true`; set `false` to bake beside an app's own build output. |
0 commit comments