@devframes/next 0.9.0-beta.3 → 0.9.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hub-client.mjs +1 -2
- package/dist/hub.mjs +4 -7
- package/dist/index.mjs +1 -1
- package/dist/{dev-spa.d.mts → single.d.mts} +2 -2
- package/dist/{dev-spa.mjs → single.mjs} +2 -2
- package/package.json +12 -13
package/dist/hub-client.mjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useEffect, useState } from "react";
|
|
3
3
|
import { createDevframeClientHost } from "@devframes/hub/client";
|
|
4
|
+
import { DEVFRAMES_HUB_BASE } from "@devframes/hub/constants";
|
|
4
5
|
//#region src/hub-client.tsx
|
|
5
|
-
/** Default hub mount base — mirrors `@devframes/hub`'s `DEVFRAMES_HUB_BASE`. */
|
|
6
|
-
const DEVFRAMES_HUB_BASE = "/__devframes/";
|
|
7
6
|
/**
|
|
8
7
|
* Boot the devframes-hub **client runtime** inside a React (Next.js) page —
|
|
9
8
|
* the browser half of {@link import('./hub').nextDevframeHub}. Connects RPC to
|
package/dist/hub.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DEVFRAMES_HUB_BASE,
|
|
2
|
-
import {
|
|
1
|
+
import { DEVFRAMES_HUB_BASE, normalizeHubBase } from "@devframes/hub/constants";
|
|
2
|
+
import { initHub } from "@devframes/hub/initiate";
|
|
3
3
|
import { DEVFRAME_CONNECTION_META_FILENAME } from "devframe/constants";
|
|
4
4
|
import { serveStaticHandler } from "devframe/utils/serve-static";
|
|
5
5
|
import { H3 } from "h3";
|
|
@@ -92,7 +92,7 @@ function createDevframeNextHost(options) {
|
|
|
92
92
|
* instead of leaking a side-car per reload.
|
|
93
93
|
*/
|
|
94
94
|
async function createNextDevframeHub(options = {}) {
|
|
95
|
-
const base =
|
|
95
|
+
const base = normalizeHubBase(options.base ?? DEVFRAMES_HUB_BASE);
|
|
96
96
|
const ui = options.ui === false ? void 0 : options.ui ?? await loadDefaultUi();
|
|
97
97
|
return initHub({
|
|
98
98
|
base,
|
|
@@ -137,7 +137,7 @@ function hubRegistry() {
|
|
|
137
137
|
* ```
|
|
138
138
|
*/
|
|
139
139
|
function nextDevframeHub(options = {}) {
|
|
140
|
-
const base =
|
|
140
|
+
const base = normalizeHubBase(options.base ?? DEVFRAMES_HUB_BASE);
|
|
141
141
|
const ready = () => {
|
|
142
142
|
const registry = hubRegistry();
|
|
143
143
|
let instance = registry.get(base);
|
|
@@ -178,8 +178,5 @@ async function loadDefaultUi() {
|
|
|
178
178
|
"@devframes/hub-ui"
|
|
179
179
|
)).createUi();
|
|
180
180
|
}
|
|
181
|
-
function normalizeBase(base) {
|
|
182
|
-
return cleanDoubleSlashes(withTrailingSlash(withLeadingSlash(base)));
|
|
183
|
-
}
|
|
184
181
|
//#endregion
|
|
185
182
|
export { createDevframeNextHost, createNextDevframeHub, nextDevframeHub };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
//#region src/index.ts
|
|
2
|
-
throw new Error("[@devframes/next] has no root export. Import from a scoped subpath instead:\n • \"@devframes/next/
|
|
2
|
+
throw new Error("[@devframes/next] has no root export. Import from a scoped subpath instead:\n • \"@devframes/next/single\" (+ \"/single/client\") — host one devframe's SPA\n • \"@devframes/next/hub\" (+ \"/hub/client\") — mount a devframes-hub\n");
|
|
3
3
|
//#endregion
|
|
4
4
|
export {};
|
|
@@ -21,7 +21,7 @@ interface DevframeNextConfig {
|
|
|
21
21
|
* connect. Serving the base path verbatim keeps relative resolution intact.
|
|
22
22
|
*
|
|
23
23
|
* ```js [next.config.mjs]
|
|
24
|
-
* import { withDevframe } from '@devframes/next/
|
|
24
|
+
* import { withDevframe } from '@devframes/next/single'
|
|
25
25
|
*
|
|
26
26
|
* export default withDevframe({
|
|
27
27
|
* // ...your own Next config
|
|
@@ -93,7 +93,7 @@ interface DevframeNextHandler {
|
|
|
93
93
|
*
|
|
94
94
|
* ```ts [app/%5F_my-tool/[[...path]]/route.ts]
|
|
95
95
|
* import myDevframe from '@/devframe'
|
|
96
|
-
* import { createDevframeNextHandler } from '@devframes/next/
|
|
96
|
+
* import { createDevframeNextHandler } from '@devframes/next/single'
|
|
97
97
|
*
|
|
98
98
|
* export const runtime = 'nodejs'
|
|
99
99
|
* export const dynamic = 'force-dynamic'
|
|
@@ -14,7 +14,7 @@ import { initDevframe } from "devframe/initiate";
|
|
|
14
14
|
* connect. Serving the base path verbatim keeps relative resolution intact.
|
|
15
15
|
*
|
|
16
16
|
* ```js [next.config.mjs]
|
|
17
|
-
* import { withDevframe } from '@devframes/next/
|
|
17
|
+
* import { withDevframe } from '@devframes/next/single'
|
|
18
18
|
*
|
|
19
19
|
* export default withDevframe({
|
|
20
20
|
* // ...your own Next config
|
|
@@ -59,7 +59,7 @@ function defaultGetStorageDir(scope) {
|
|
|
59
59
|
*
|
|
60
60
|
* ```ts [app/%5F_my-tool/[[...path]]/route.ts]
|
|
61
61
|
* import myDevframe from '@/devframe'
|
|
62
|
-
* import { createDevframeNextHandler } from '@devframes/next/
|
|
62
|
+
* import { createDevframeNextHandler } from '@devframes/next/single'
|
|
63
63
|
*
|
|
64
64
|
* export const runtime = 'nodejs'
|
|
65
65
|
* export const dynamic = 'force-dynamic'
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devframes/next",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.9.0-beta.
|
|
4
|
+
"version": "0.9.0-beta.7",
|
|
5
5
|
"description": "Next.js host integration that serves mounted devframes from an App Router route.",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
"types": "./dist/index.d.mts",
|
|
25
25
|
"default": "./dist/index.mjs"
|
|
26
26
|
},
|
|
27
|
-
"./
|
|
28
|
-
"types": "./dist/
|
|
29
|
-
"default": "./dist/
|
|
27
|
+
"./single": {
|
|
28
|
+
"types": "./dist/single.d.mts",
|
|
29
|
+
"default": "./dist/single.mjs"
|
|
30
30
|
},
|
|
31
|
-
"./
|
|
31
|
+
"./single/client": {
|
|
32
32
|
"types": "./dist/client.d.mts",
|
|
33
33
|
"default": "./dist/client.mjs"
|
|
34
34
|
},
|
|
@@ -49,9 +49,9 @@
|
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"next": "^14.0.0 || ^15.0.0 || ^16.0.0",
|
|
51
51
|
"react": "^18.0.0 || ^19.0.0",
|
|
52
|
-
"@devframes/hub": "0.9.0-beta.
|
|
53
|
-
"@devframes/hub-ui": "0.9.0-beta.
|
|
54
|
-
"devframe": "0.9.0-beta.
|
|
52
|
+
"@devframes/hub": "0.9.0-beta.7",
|
|
53
|
+
"@devframes/hub-ui": "0.9.0-beta.7",
|
|
54
|
+
"devframe": "0.9.0-beta.7"
|
|
55
55
|
},
|
|
56
56
|
"peerDependenciesMeta": {
|
|
57
57
|
"@devframes/hub": {
|
|
@@ -68,17 +68,16 @@
|
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"h3": "^2.0.1-rc.26"
|
|
72
|
-
"ufo": "^1.6.4"
|
|
71
|
+
"h3": "^2.0.1-rc.26"
|
|
73
72
|
},
|
|
74
73
|
"devDependencies": {
|
|
75
74
|
"@types/node": "^26.2.0",
|
|
76
75
|
"@types/react": "^19.2.18",
|
|
77
76
|
"react": "^19.2.8",
|
|
78
77
|
"tsdown": "^0.22.14",
|
|
79
|
-
"@devframes/hub": "0.9.0-beta.
|
|
80
|
-
"
|
|
81
|
-
"
|
|
78
|
+
"@devframes/hub": "0.9.0-beta.7",
|
|
79
|
+
"@devframes/hub-ui": "0.9.0-beta.7",
|
|
80
|
+
"devframe": "0.9.0-beta.7"
|
|
82
81
|
},
|
|
83
82
|
"scripts": {
|
|
84
83
|
"build": "tsdown",
|