devframe 0.1.21 → 0.2.0
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/README.md +40 -18
- package/dist/{_shared-iZy45oG3.mjs → _shared-BrKv3CYt.mjs} +5 -5
- package/dist/adapters/build.d.mts +5 -5
- package/dist/adapters/build.mjs +13 -12
- package/dist/adapters/cli.d.mts +4 -4
- package/dist/adapters/cli.mjs +5 -5
- package/dist/adapters/dev.d.mts +21 -12
- package/dist/adapters/dev.mjs +1 -1
- package/dist/adapters/embedded.d.mts +5 -5
- package/dist/adapters/embedded.mjs +2 -2
- package/dist/adapters/mcp.d.mts +3 -3
- package/dist/adapters/mcp.mjs +5 -5
- package/dist/chunk-e9Ob2GDo.mjs +26 -0
- package/dist/client/index.d.mts +8 -5
- package/dist/client/index.mjs +12 -12
- package/dist/colors-DS7k8ljB.mjs +123 -0
- package/dist/{context-BJ4r2SmR.mjs → context-BBi2IQDm.mjs} +19 -37
- package/dist/{context-internal-saIAfNVw.d.mts → context-DRa0wGsC.d.mts} +2 -2
- package/dist/{dev-CdAy400a.mjs → dev-CewNNE2R.mjs} +24 -28
- package/dist/{devtool-CNvLs2_Y.d.mts → devframe-R5Ex5K5L.d.mts} +41 -66
- package/dist/{diagnostics-DxPnRoXO.mjs → diagnostics-Cg9ycFIM.mjs} +7 -2
- package/dist/hash-CIBte1yS.mjs +263 -0
- package/dist/helpers/vite.d.mts +65 -0
- package/dist/helpers/vite.mjs +94 -0
- package/dist/{human-id-BLoGo_e5.mjs → human-id-adtUWQLr.mjs} +12 -3
- package/dist/{index-CuLRIMto.d.mts → index-DB2Ie0Or.d.mts} +2 -3
- package/dist/index.d.mts +4 -5
- package/dist/index.mjs +2 -5
- package/dist/launch-editor-CX_n_0SS.mjs +581 -0
- package/dist/node/auth.d.mts +44 -0
- package/dist/node/auth.mjs +55 -0
- package/dist/node/index.d.mts +13 -55
- package/dist/node/index.mjs +6 -62
- package/dist/node/internal.d.mts +16 -0
- package/dist/node/internal.mjs +50 -0
- package/dist/{open-Dede_w9r.mjs → open-B2ah1IKK.mjs} +38 -24
- package/dist/recipes/open-helpers.d.mts +4 -9
- package/dist/recipes/open-helpers.mjs +7 -12
- package/dist/revoke-DIMz1r7-.mjs +35 -0
- package/dist/rpc/index.d.mts +3 -3
- package/dist/rpc/index.mjs +4 -4
- package/dist/rpc/transports/ws-client.d.mts +1 -1
- package/dist/rpc/transports/ws-client.mjs +2 -1
- package/dist/rpc/transports/ws-server.d.mts +1 -1
- package/dist/rpc/transports/ws-server.mjs +2 -1
- package/dist/{rpc-INbWfHoX.mjs → rpc-DAzoVCR0.mjs} +5 -4
- package/dist/{serialization-DwKi05Pn.mjs → serialization-CwO31axa.mjs} +1 -2
- package/dist/{server-CBsxXIH5.mjs → server-DOk4grlJ.mjs} +4 -4
- package/dist/{server-BAqOajx_.d.mts → server-DzKz023G.d.mts} +8 -7
- package/dist/shared-state-q9-1EOSX.mjs +928 -0
- package/dist/{static-dump-D5VH8Iqk.mjs → static-dump-C67bCuse.mjs} +1 -1
- package/dist/{context-internal-Dx_NoSv1.mjs → storage-CNvfBGQ5.mjs} +5 -87
- package/dist/structured-clone-CD2l4fI3.mjs +221 -0
- package/dist/types/index.d.mts +4 -4
- package/dist/types/index.mjs +3 -3
- package/dist/utils/colors.d.mts +28 -0
- package/dist/utils/colors.mjs +2 -0
- package/dist/utils/events.d.mts +1 -1
- package/dist/utils/hash.d.mts +7 -0
- package/dist/utils/hash.mjs +2 -0
- package/dist/utils/human-id.d.mts +6 -8
- package/dist/utils/human-id.mjs +1 -2
- package/dist/utils/launch-editor.d.mts +13 -0
- package/dist/utils/launch-editor.mjs +2 -0
- package/dist/utils/open.d.mts +16 -0
- package/dist/utils/open.mjs +2 -0
- package/dist/utils/serve-static.d.mts +40 -0
- package/dist/utils/serve-static.mjs +173 -0
- package/dist/utils/shared-state.d.mts +1 -1
- package/dist/utils/shared-state.mjs +1 -35
- package/dist/utils/streaming-channel.d.mts +1 -1
- package/dist/utils/structured-clone.d.mts +21 -0
- package/dist/utils/structured-clone.mjs +2 -0
- package/dist/utils/when.d.mts +33 -50
- package/dist/utils/when.mjs +21 -3
- package/dist/{ws-client-CjPuPFbA.d.mts → ws-client-Bavoya6-.d.mts} +1 -1
- package/dist/{ws-server-C7LnhOHi.d.mts → ws-server-DjvlwLuM.d.mts} +1 -1
- package/package.json +38 -18
- package/skills/devframe/SKILL.md +64 -39
- package/skills/devframe/templates/{counter-devtool.ts → counter-devframe.ts} +4 -4
- package/skills/devframe/templates/{spa-devtool.ts → spa-devframe.ts} +5 -5
- package/skills/devframe/templates/vite-client.ts +2 -2
- package/dist/adapters/vite.d.mts +0 -33
- package/dist/adapters/vite.mjs +0 -32
- package/dist/internal/index.d.mts +0 -16
- package/dist/internal/index.mjs +0 -3
- package/dist/utils/state.d.mts +0 -50
- package/dist/utils/state.mjs +0 -26
- package/dist/{define-Bb4zh-Dc.mjs → define-CW9gLnyG.mjs} +0 -0
- package/dist/{host-h3-9jeHcltx.mjs → host-h3-Dz8YnFgu.mjs} +1 -1
- /package/dist/{transports-DSV5_5QM.mjs → transports-BnCs4rj9.mjs} +0 -0
- /package/dist/{types-C5OVe4AC.d.mts → types-4rdUEi2R.d.mts} +0 -0
|
@@ -3,18 +3,18 @@ import { attachWsRpcTransport } from "./rpc/transports/ws-server.mjs";
|
|
|
3
3
|
import { WebSocketServer } from "ws";
|
|
4
4
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
5
5
|
import { createServer } from "node:http";
|
|
6
|
-
import {
|
|
6
|
+
import { H3, toNodeHandler } from "h3";
|
|
7
7
|
//#region src/node/server.ts
|
|
8
8
|
/**
|
|
9
|
-
* Compose an h3 + WebSocket server for a
|
|
9
|
+
* Compose an h3 + WebSocket server for a devframe context. The RPC
|
|
10
10
|
* group is bound to `context.rpc.functions`; the WS endpoint lives on
|
|
11
11
|
* the same port as the HTTP server.
|
|
12
12
|
*/
|
|
13
13
|
async function startHttpAndWs(options) {
|
|
14
14
|
const { context, port } = options;
|
|
15
15
|
const bindHost = options.host ?? "localhost";
|
|
16
|
-
const app = options.app ??
|
|
17
|
-
const httpServer = createServer(
|
|
16
|
+
const app = options.app ?? new H3();
|
|
17
|
+
const httpServer = createServer(toNodeHandler(app));
|
|
18
18
|
const wss = new WebSocketServer({ server: httpServer });
|
|
19
19
|
const rpcHost = context.rpc;
|
|
20
20
|
const asyncStorage = new AsyncLocalStorage();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { U as DevToolsRpcClientFunctions, W as DevToolsRpcServerFunctions, d as DevToolsNodeContext } from "./
|
|
1
|
+
import { U as DevToolsRpcClientFunctions, W as DevToolsRpcServerFunctions, d as DevToolsNodeContext } from "./devframe-R5Ex5K5L.mjs";
|
|
2
2
|
import { BirpcGroup } from "birpc";
|
|
3
3
|
import { WebSocketServer } from "ws";
|
|
4
|
-
import {
|
|
4
|
+
import { H3 } from "h3";
|
|
5
5
|
|
|
6
6
|
//#region src/node/server.d.ts
|
|
7
7
|
interface StartHttpAndWsOptions {
|
|
@@ -10,9 +10,10 @@ interface StartHttpAndWsOptions {
|
|
|
10
10
|
port: number;
|
|
11
11
|
/**
|
|
12
12
|
* Optional h3 app to mount on. When omitted a fresh one is created;
|
|
13
|
-
* when provided, callers can add their own routes (
|
|
13
|
+
* when provided, callers can add their own routes (static handlers,
|
|
14
|
+
* auth middleware, etc.) first.
|
|
14
15
|
*/
|
|
15
|
-
app?:
|
|
16
|
+
app?: H3;
|
|
16
17
|
/**
|
|
17
18
|
* When `false`, the RPC server is started without a trust handshake.
|
|
18
19
|
* Intended for single-user localhost tools where an auth round-trip
|
|
@@ -32,20 +33,20 @@ interface StartHttpAndWsOptions {
|
|
|
32
33
|
onReady?: (info: {
|
|
33
34
|
origin: string;
|
|
34
35
|
port: number;
|
|
35
|
-
app:
|
|
36
|
+
app: H3;
|
|
36
37
|
}) => void | Promise<void>;
|
|
37
38
|
}
|
|
38
39
|
interface StartedServer {
|
|
39
40
|
/** Listening origin, e.g. `http://localhost:9999`. */
|
|
40
41
|
origin: string;
|
|
41
42
|
port: number;
|
|
42
|
-
app:
|
|
43
|
+
app: H3;
|
|
43
44
|
wss: WebSocketServer;
|
|
44
45
|
rpcGroup: BirpcGroup<DevToolsRpcClientFunctions, DevToolsRpcServerFunctions, false>;
|
|
45
46
|
close: () => Promise<void>;
|
|
46
47
|
}
|
|
47
48
|
/**
|
|
48
|
-
* Compose an h3 + WebSocket server for a
|
|
49
|
+
* Compose an h3 + WebSocket server for a devframe context. The RPC
|
|
49
50
|
* group is bound to `context.rpc.functions`; the WS endpoint lives on
|
|
50
51
|
* the same port as the HTTP server.
|
|
51
52
|
*/
|