devframe 0.6.0-beta.1 → 0.6.0-beta.3
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/adapters/build.d.mts +1 -1
- package/dist/adapters/build.mjs +2 -2
- package/dist/adapters/cli.d.mts +1 -1
- package/dist/adapters/cli.mjs +1 -1
- package/dist/adapters/dev.d.mts +2 -2
- package/dist/adapters/dev.mjs +1 -1
- package/dist/adapters/embedded.d.mts +1 -1
- package/dist/adapters/mcp.d.mts +1 -1
- package/dist/adapters/mcp.mjs +3 -3
- package/dist/client/index.d.mts +2 -2
- package/dist/client/index.mjs +56 -22
- package/dist/constants.d.mts +24 -1
- package/dist/constants.mjs +26 -1
- package/dist/{context-o-TwncyP.d.mts → context-B_I9fMBc.d.mts} +1 -1
- package/dist/{context-3x_bgBgZ.mjs → context-CKJheEtf.mjs} +2 -2
- package/dist/{dev-CSpLSEVh.mjs → dev-DSxKFn-v.mjs} +4 -4
- package/dist/{devframe-BwfavB78.d.mts → devframe-DgvncQy2.d.mts} +20 -4
- package/dist/{dump-DoXkj4ku.mjs → dump-D09PZb7T.mjs} +14 -4
- package/dist/{hash-DFc5WwhO.mjs → hash-PAfnyu2k.mjs} +1 -1
- package/dist/helpers/vite.d.mts +1 -1
- package/dist/helpers/vite.mjs +2 -2
- package/dist/{host-h3-C5SZlk03.mjs → host-h3-Dsf-Tgwx.mjs} +37 -11
- package/dist/index-B4lNDq5v.d.mts +107 -0
- package/dist/{index-CxaPKDXX.d.mts → index-Dy6GFDRf.d.mts} +1 -0
- package/dist/index.d.mts +3 -3
- package/dist/{launch-editor-CgXBgviI.mjs → launch-editor-DIzaS5EG.mjs} +146 -56
- package/dist/node/auth.d.mts +2 -64
- package/dist/node/auth.mjs +2 -100
- package/dist/node/hub-internals.d.mts +2 -2
- package/dist/node/hub-internals.mjs +1 -1
- package/dist/node/index.d.mts +4 -4
- package/dist/node/index.mjs +3 -3
- package/dist/recipes/interactive-auth.d.mts +53 -0
- package/dist/recipes/interactive-auth.mjs +132 -0
- package/dist/recipes/open-helpers.mjs +2 -2
- package/dist/{revoke-ENfxWkFK.mjs → revoke-BtQDKTp7.mjs} +1 -1
- package/dist/rpc/dump.mjs +1 -1
- package/dist/rpc/index.d.mts +2 -2
- package/dist/rpc/index.mjs +4 -1
- package/dist/rpc/transports/ws-client.mjs +21 -8
- package/dist/rpc/transports/ws-server.d.mts +2 -2
- package/dist/rpc/transports/ws-server.mjs +36 -7
- package/dist/{server-wyY3zh67.mjs → server-BdN41ckC.mjs} +37 -4
- package/dist/server-DXPq8q0K.d.mts +121 -0
- package/dist/{shared-state-D4PPieA0.mjs → shared-state-QtMas0NG.mjs} +34 -4
- package/dist/state-WX3HT5a3.mjs +101 -0
- package/dist/{storage-l2ezeend.mjs → storage-yrUZaiib.mjs} +55 -6
- package/dist/types/index.d.mts +3 -3
- package/dist/utils/crypto-token.mjs +1 -1
- package/dist/utils/events.d.mts +1 -1
- package/dist/utils/hash.mjs +1 -1
- package/dist/utils/launch-editor.mjs +1 -1
- package/dist/utils/open.mjs +1 -1
- package/dist/utils/serve-static.mjs +2 -1
- package/dist/utils/shared-state.d.mts +1 -1
- package/dist/utils/shared-state.mjs +1 -1
- package/dist/utils/streaming-channel.d.mts +1 -1
- package/dist/utils/when.d.mts +1 -1
- package/dist/{ws-server-BVVMDo2n.d.mts → ws-server-Bc2wBHl-.d.mts} +17 -1
- package/package.json +10 -9
- package/dist/server-oju7PTi2.d.mts +0 -82
- package/dist/{open-Dusa2Zzd.mjs → open-Deb5xmIT.mjs} +1 -1
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { it as DevframeRpcServerFunctions, m as DevframeNodeContext, rt as DevframeRpcClientFunctions } from "./devframe-BwfavB78.mjs";
|
|
2
|
-
import { BirpcGroup } from "birpc";
|
|
3
|
-
import { NodeAdapter } from "crossws/adapters/node";
|
|
4
|
-
import { Server } from "node:http";
|
|
5
|
-
import { H3 } from "h3";
|
|
6
|
-
|
|
7
|
-
//#region src/node/server.d.ts
|
|
8
|
-
interface StartHttpAndWsOptions {
|
|
9
|
-
context: DevframeNodeContext;
|
|
10
|
-
host?: string;
|
|
11
|
-
port: number;
|
|
12
|
-
/**
|
|
13
|
-
* Optional h3 app to mount on. When omitted a fresh one is created;
|
|
14
|
-
* when provided, callers can add their own routes (static handlers,
|
|
15
|
-
* auth middleware, etc.) first.
|
|
16
|
-
*/
|
|
17
|
-
app?: H3;
|
|
18
|
-
/**
|
|
19
|
-
* Bind the WS endpoint to a single upgrade route (e.g. `/__devframe_ws`) instead of
|
|
20
|
-
* claiming every upgrade on the port. This lets the socket share a server
|
|
21
|
-
* with other upgrade handlers (Vite HMR, a host framework's own sockets)
|
|
22
|
-
* and is what the SPA's `__connection.json` points at. When omitted, the WS
|
|
23
|
-
* server handles every upgrade on the port (legacy behaviour).
|
|
24
|
-
*/
|
|
25
|
-
path?: string;
|
|
26
|
-
/**
|
|
27
|
-
* Bind the WS endpoint on its own port instead of sharing the HTTP server's.
|
|
28
|
-
* The HTTP/SPA server still listens on `port`; the socket gets a dedicated
|
|
29
|
-
* `ws` server on `wsPort` (same `host`). Use this for the "different port"
|
|
30
|
-
* connection scenario. Ignored when a `server` is supplied.
|
|
31
|
-
*/
|
|
32
|
-
wsPort?: number;
|
|
33
|
-
/**
|
|
34
|
-
* Mount the WS endpoint onto an existing HTTP server, sharing its port,
|
|
35
|
-
* rather than creating and listening on a fresh one. Use this to embed
|
|
36
|
-
* devframe's RPC socket inside a host server (e.g. a Vite dev server) — pair
|
|
37
|
-
* it with `path` so it coexists with the host's routes. The caller owns the
|
|
38
|
-
* server's lifecycle: {@link StartedServer.close} detaches devframe's upgrade
|
|
39
|
-
* listener but leaves the host server running. When set, `host`/`port` are
|
|
40
|
-
* only used to report the resolved origin.
|
|
41
|
-
*/
|
|
42
|
-
server?: Server;
|
|
43
|
-
/**
|
|
44
|
-
* When `false`, the RPC server is started without a trust handshake.
|
|
45
|
-
* Intended for single-user localhost tools where an auth round-trip
|
|
46
|
-
* would only get in the way. The Vite-flavoured auth layer in
|
|
47
|
-
* `@vitejs/devtools` already honors the equivalent
|
|
48
|
-
* `devtools.clientAuth` setting; devframe records the intent here so
|
|
49
|
-
* future auth plumbing can consult it without another API change.
|
|
50
|
-
*
|
|
51
|
-
* Default: `true`.
|
|
52
|
-
*/
|
|
53
|
-
auth?: boolean;
|
|
54
|
-
/**
|
|
55
|
-
* Called once the WS server is bound so callers can mount static
|
|
56
|
-
* handlers whose origin depends on the resolved port, or print their
|
|
57
|
-
* own startup banner. Devframe does not print one itself.
|
|
58
|
-
*/
|
|
59
|
-
onReady?: (info: {
|
|
60
|
-
origin: string;
|
|
61
|
-
port: number;
|
|
62
|
-
app: H3;
|
|
63
|
-
}) => void | Promise<void>;
|
|
64
|
-
}
|
|
65
|
-
interface StartedServer {
|
|
66
|
-
/** Listening origin, e.g. `http://localhost:9999`. */
|
|
67
|
-
origin: string;
|
|
68
|
-
port: number;
|
|
69
|
-
app: H3;
|
|
70
|
-
/** The crossws node adapter driving the RPC socket (connected peers, pub/sub). */
|
|
71
|
-
ws: NodeAdapter;
|
|
72
|
-
rpcGroup: BirpcGroup<DevframeRpcClientFunctions, DevframeRpcServerFunctions, false>;
|
|
73
|
-
close: () => Promise<void>;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Compose an h3 + WebSocket server for a devframe context. The RPC
|
|
77
|
-
* group is bound to `context.rpc.functions`; the WS endpoint lives on
|
|
78
|
-
* the same port as the HTTP server.
|
|
79
|
-
*/
|
|
80
|
-
declare function startHttpAndWs(options: StartHttpAndWsOptions): Promise<StartedServer>;
|
|
81
|
-
//#endregion
|
|
82
|
-
export { StartedServer as n, startHttpAndWs as r, StartHttpAndWsOptions as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { promisify } from "node:util";
|
|
2
2
|
import fs from "node:fs";
|
|
3
|
-
import os from "node:os";
|
|
4
3
|
import process from "node:process";
|
|
4
|
+
import os from "node:os";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
import childProcess, { execFile } from "node:child_process";
|