devframe 0.7.4 → 0.7.5
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.mjs +1 -1
- package/dist/adapters/cac.mjs +1 -1
- package/dist/adapters/cli.mjs +1 -1
- package/dist/adapters/dev.mjs +1 -1
- package/dist/adapters/mcp.mjs +1 -1
- package/dist/{build-server-vGNtqlOd.mjs → build-server-D5-9okV6.mjs} +1 -1
- package/dist/{cac-CZk1y4rm.mjs → cac-Dr-qCdgQ.mjs} +1 -1
- package/dist/{dev-CicFHIt8.mjs → dev-D6Hcv4v8.mjs} +4 -4
- package/dist/helpers/vite.mjs +1 -1
- package/dist/{host-h3-DBzbpjXk.mjs → host-h3-A8CXZoS5.mjs} +12 -3
- package/dist/{http-DHckZCYZ.mjs → http-Fxm-0_V7.mjs} +1 -1
- package/dist/node/index.d.mts +5 -30
- package/dist/node/index.mjs +2 -2
- package/dist/utils/serve-static.d.mts +4 -6
- package/dist/utils/serve-static.mjs +8 -14
- package/package.json +2 -2
package/dist/adapters/build.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { n as colors } from "../diagnostics-reporter-CsIG85Q5.mjs";
|
|
|
3
3
|
import { DEVFRAME_CONNECTION_META_FILENAME, DEVFRAME_RPC_DUMP_DIRNAME, DEVFRAME_RPC_DUMP_MANIFEST_FILENAME } from "../constants.mjs";
|
|
4
4
|
import { n as strictJsonStringify } from "../serialization-DpLXCy13.mjs";
|
|
5
5
|
import { n as structuredCloneStringify } from "../structured-clone-XpHLZ8nr.mjs";
|
|
6
|
-
import { n as createHostContext, t as createH3DevframeHost } from "../host-h3-
|
|
6
|
+
import { n as createHostContext, t as createH3DevframeHost } from "../host-h3-A8CXZoS5.mjs";
|
|
7
7
|
import { n as resolveBasePath } from "../_shared-bWRzeSa0.mjs";
|
|
8
8
|
import { existsSync } from "node:fs";
|
|
9
9
|
import { dirname, resolve } from "pathe";
|
package/dist/adapters/cac.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as defineCliFlags, r as parseCliFlags, t as createCac } from "../cac-
|
|
1
|
+
import { n as defineCliFlags, r as parseCliFlags, t as createCac } from "../cac-Dr-qCdgQ.mjs";
|
|
2
2
|
export { createCac, defineCliFlags, parseCliFlags };
|
package/dist/adapters/cli.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as defineCliFlags, r as parseCliFlags, t as createCac } from "../cac-
|
|
1
|
+
import { n as defineCliFlags, r as parseCliFlags, t as createCac } from "../cac-Dr-qCdgQ.mjs";
|
|
2
2
|
//#region src/adapters/cli.ts
|
|
3
3
|
/** @deprecated Use `createCac` from `devframe/adapters/cac` instead. */
|
|
4
4
|
const createCli = createCac;
|
package/dist/adapters/dev.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as resolveDevServerPort, t as createDevServer } from "../dev-
|
|
1
|
+
import { n as resolveDevServerPort, t as createDevServer } from "../dev-D6Hcv4v8.mjs";
|
|
2
2
|
export { createDevServer, resolveDevServerPort };
|
package/dist/adapters/mcp.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as createMcpServer } from "../build-server-
|
|
1
|
+
import { n as createMcpServer } from "../build-server-D5-9okV6.mjs";
|
|
2
2
|
export { createMcpServer };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as diagnostics } from "./storage-E9KrCsLr.mjs";
|
|
2
|
-
import { n as createHostContext } from "./host-h3-
|
|
2
|
+
import { n as createHostContext } from "./host-h3-A8CXZoS5.mjs";
|
|
3
3
|
import { join } from "pathe";
|
|
4
4
|
import process from "node:process";
|
|
5
5
|
import { homedir } from "node:os";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as colors } from "./diagnostics-reporter-CsIG85Q5.mjs";
|
|
2
2
|
import { createBuild } from "./adapters/build.mjs";
|
|
3
|
-
import { n as resolveDevServerPort, t as createDevServer } from "./dev-
|
|
3
|
+
import { n as resolveDevServerPort, t as createDevServer } from "./dev-D6Hcv4v8.mjs";
|
|
4
4
|
import process from "node:process";
|
|
5
5
|
import cac from "cac";
|
|
6
6
|
import { safeParse } from "valibot";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DEVFRAME_CONNECTION_META_FILENAME } from "./constants.mjs";
|
|
2
2
|
import { a as diagnostics } from "./storage-E9KrCsLr.mjs";
|
|
3
|
-
import { n as createHostContext, t as createH3DevframeHost } from "./host-h3-
|
|
3
|
+
import { n as createHostContext, t as createH3DevframeHost } from "./host-h3-A8CXZoS5.mjs";
|
|
4
4
|
import { i as normalizeHttpServerUrl, t as startHttpAndWs } from "./server-DvrOR1LG.mjs";
|
|
5
5
|
import { n as resolveBasePath, t as normalizeBasePath } from "./_shared-bWRzeSa0.mjs";
|
|
6
6
|
import { t as open } from "./open-Deb5xmIT.mjs";
|
|
@@ -11,7 +11,7 @@ import process$1 from "node:process";
|
|
|
11
11
|
import { networkInterfaces } from "node:os";
|
|
12
12
|
import { H3 } from "h3";
|
|
13
13
|
import { createServer } from "node:net";
|
|
14
|
-
import { joinURL, withBase
|
|
14
|
+
import { joinURL, withBase, withLeadingSlash, withoutLeadingSlash } from "ufo";
|
|
15
15
|
//#region ../../node_modules/.pnpm/get-port-please@3.2.0/node_modules/get-port-please/dist/index.mjs
|
|
16
16
|
const unsafePorts = /* @__PURE__ */ new Set([
|
|
17
17
|
1,
|
|
@@ -294,7 +294,7 @@ async function createDevServer(def, options = {}) {
|
|
|
294
294
|
const mcpPath = joinURL(basePath, mcpRoute);
|
|
295
295
|
let mountMcpHttp;
|
|
296
296
|
try {
|
|
297
|
-
({mountMcpHttp} = await import("./http-
|
|
297
|
+
({mountMcpHttp} = await import("./http-Fxm-0_V7.mjs"));
|
|
298
298
|
} catch (error) {
|
|
299
299
|
const reason = error instanceof Error ? error.message : String(error);
|
|
300
300
|
throw diagnostics.DF0017({
|
|
@@ -393,7 +393,7 @@ async function maybeOpenBrowser(def, flags, origin, override) {
|
|
|
393
393
|
const cliOpen = def.cli?.open;
|
|
394
394
|
const resolved = override ?? flagsOpen ?? cliOpen;
|
|
395
395
|
if (resolved === void 0 || resolved === false) return;
|
|
396
|
-
const target = typeof resolved === "string" ? withBase
|
|
396
|
+
const target = typeof resolved === "string" ? withBase(resolved, origin) : origin;
|
|
397
397
|
try {
|
|
398
398
|
await open(target);
|
|
399
399
|
} catch {}
|
package/dist/helpers/vite.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { DEVFRAME_CONNECTION_META_FILENAME, DEVFRAME_WS_ROUTE } from "../constan
|
|
|
2
2
|
import { a as diagnostics } from "../storage-E9KrCsLr.mjs";
|
|
3
3
|
import { n as resolveBasePath, t as normalizeBasePath } from "../_shared-bWRzeSa0.mjs";
|
|
4
4
|
import { serveStaticNodeMiddleware } from "../utils/serve-static.mjs";
|
|
5
|
-
import { n as resolveDevServerPort, t as createDevServer } from "../dev-
|
|
5
|
+
import { n as resolveDevServerPort, t as createDevServer } from "../dev-D6Hcv4v8.mjs";
|
|
6
6
|
import { resolve } from "pathe";
|
|
7
7
|
//#region src/helpers/vite.ts
|
|
8
8
|
/**
|
|
@@ -1144,7 +1144,16 @@ function createRpcStreamingServerHost(rpc) {
|
|
|
1144
1144
|
//#endregion
|
|
1145
1145
|
//#region src/node/host-functions.ts
|
|
1146
1146
|
const debugBroadcast = createDebug("devframe:rpc:broadcast");
|
|
1147
|
-
|
|
1147
|
+
/**
|
|
1148
|
+
* Concrete implementation backing `ctx.rpc`. Internal: consumers should
|
|
1149
|
+
* depend on the structural {@link RpcFunctionsHost} type, never this class.
|
|
1150
|
+
* Its `@internal` members (`_rpcGroup`, `_asyncStorage`,
|
|
1151
|
+
* `_emitSessionDisconnected`) are wired by `startHttpAndWs` and must not
|
|
1152
|
+
* widen the public surface.
|
|
1153
|
+
*
|
|
1154
|
+
* @internal
|
|
1155
|
+
*/
|
|
1156
|
+
var RpcFunctionsHostImpl = class extends RpcFunctionsCollectorBase {
|
|
1148
1157
|
/**
|
|
1149
1158
|
* @internal
|
|
1150
1159
|
*/
|
|
@@ -1449,7 +1458,7 @@ async function createHostContext(options) {
|
|
|
1449
1458
|
services: void 0,
|
|
1450
1459
|
scope: void 0
|
|
1451
1460
|
};
|
|
1452
|
-
const rpcHost = new
|
|
1461
|
+
const rpcHost = new RpcFunctionsHostImpl(context);
|
|
1453
1462
|
const viewsHost = new DevframeViewHost(context);
|
|
1454
1463
|
const diagnosticsHost = new DevframeDiagnosticsHost(context, [diagnostics$1, diagnostics]);
|
|
1455
1464
|
context.rpc = rpcHost;
|
|
@@ -1494,4 +1503,4 @@ function createH3DevframeHost(options) {
|
|
|
1494
1503
|
};
|
|
1495
1504
|
}
|
|
1496
1505
|
//#endregion
|
|
1497
|
-
export { DevframeViewHost as a,
|
|
1506
|
+
export { DevframeViewHost as a, createRpcSharedStateServerHost as c, createNodeSettings as i, DevframeDiagnosticsHost as l, createHostContext as n, DevframeServicesHostImpl as o, createScopedNodeContext as r, createRpcStreamingServerHost as s, createH3DevframeHost as t, DevframeAgentHost as u };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isAllowedOrigin } from "./rpc/transports/ws-server.mjs";
|
|
2
|
-
import { t as buildMcpServerFromContext } from "./build-server-
|
|
2
|
+
import { t as buildMcpServerFromContext } from "./build-server-D5-9okV6.mjs";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
import { defineHandler } from "h3";
|
|
5
5
|
import { isInitializeRequest } from "@modelcontextprotocol/sdk/types.js";
|
package/dist/node/index.d.mts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { C as DevframeServicesHost, Ct as AgentResourceInput, Dt as DevframeAgentHostEvents, Et as DevframeAgentHost$1, G as RpcFunctionsHost
|
|
1
|
+
import { C as DevframeServicesHost, Ct as AgentResourceInput, Dt as DevframeAgentHostEvents, Et as DevframeAgentHost$1, G as RpcFunctionsHost, H as DevframeDiagnosticsLogger, I as DevframeViewHost$1, L as DevframeHost, O as DevframeSettings, Ot as EventEmitter, S as DevframeServiceOf, St as AgentResourceContent, T as DevframeScopedNodeContext, Tt as AgentToolInput, V as DevframeDiagnosticsHost$1, X as RpcStreamingHost, b as DevframeNodeContext, bt as AgentManifest, mt as SharedState, q as RpcSharedStateHost, wt as AgentTool, x as DevframeServiceId, xt as AgentResource, yt as AgentHandle } from "../devframe-WHtcqYlZ.mjs";
|
|
2
2
|
import { v as RpcFunctionDefinitionAny } from "../types-CrzNxXKq.mjs";
|
|
3
|
-
import
|
|
4
|
-
import { t as DevframeNodeRpcSessionMeta } from "../ws-server-9-wn7MNQ.mjs";
|
|
3
|
+
import "../index-DgsLFhZg.mjs";
|
|
5
4
|
import { n as StartedServer, r as startHttpAndWs, t as StartHttpAndWsOptions } from "../server-BRxA2OAh.mjs";
|
|
6
5
|
import { BirpcGroup } from "birpc";
|
|
7
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
8
6
|
//#region src/node/context.d.ts
|
|
9
7
|
interface CreateHostContextOptions {
|
|
10
8
|
cwd: string;
|
|
@@ -72,29 +70,6 @@ declare class DevframeDiagnosticsHost implements DevframeDiagnosticsHost$1 {
|
|
|
72
70
|
register(diagnostics: Record<string, unknown>): void;
|
|
73
71
|
}
|
|
74
72
|
//#endregion
|
|
75
|
-
//#region src/node/host-functions.d.ts
|
|
76
|
-
declare class RpcFunctionsHost extends RpcFunctionsCollectorBase<DevframeRpcServerFunctions, DevframeNodeContext> implements RpcFunctionsHost$1 {
|
|
77
|
-
/**
|
|
78
|
-
* @internal
|
|
79
|
-
*/
|
|
80
|
-
_rpcGroup: BirpcGroup<DevframeRpcClientFunctions, DevframeRpcServerFunctions, false>;
|
|
81
|
-
_asyncStorage: AsyncLocalStorage<DevframeNodeRpcSession>;
|
|
82
|
-
constructor(context: DevframeNodeContext);
|
|
83
|
-
sharedState: RpcSharedStateHost;
|
|
84
|
-
streaming: RpcStreamingHost;
|
|
85
|
-
/**
|
|
86
|
-
* Adapters call this from their WS `onDisconnected` hook so downstream
|
|
87
|
-
* hosts (streaming, …) can free per-session state. Public-ish because
|
|
88
|
-
* tests / custom adapters may want to mirror it.
|
|
89
|
-
*
|
|
90
|
-
* @internal
|
|
91
|
-
*/
|
|
92
|
-
_emitSessionDisconnected(meta: DevframeNodeRpcSessionMeta): void;
|
|
93
|
-
invokeLocal<T extends keyof DevframeRpcServerFunctions, Args extends Parameters<DevframeRpcServerFunctions[T]>>(method: T, ...args: Args): Promise<Awaited<ReturnType<DevframeRpcServerFunctions[T]>>>;
|
|
94
|
-
broadcast<T extends keyof DevframeRpcClientFunctions, Args extends Parameters<DevframeRpcClientFunctions[T]>>(options: RpcBroadcastOptions<T, Args>): Promise<void>;
|
|
95
|
-
getCurrentRpcSession(): DevframeNodeRpcSession | undefined;
|
|
96
|
-
}
|
|
97
|
-
//#endregion
|
|
98
73
|
//#region src/node/host-h3.d.ts
|
|
99
74
|
interface CreateH3DevframeHostOptions {
|
|
100
75
|
/** The h3 app instance — registered once the CLI adapter lands. */
|
|
@@ -161,7 +136,7 @@ declare class DevframeViewHost implements DevframeViewHost$1 {
|
|
|
161
136
|
}
|
|
162
137
|
//#endregion
|
|
163
138
|
//#region src/node/rpc-shared-state.d.ts
|
|
164
|
-
declare function createRpcSharedStateServerHost(rpc: RpcFunctionsHost
|
|
139
|
+
declare function createRpcSharedStateServerHost(rpc: RpcFunctionsHost): RpcSharedStateHost;
|
|
165
140
|
//#endregion
|
|
166
141
|
//#region src/node/rpc-streaming.d.ts
|
|
167
142
|
/**
|
|
@@ -170,7 +145,7 @@ declare function createRpcSharedStateServerHost(rpc: RpcFunctionsHost$1): RpcSha
|
|
|
170
145
|
* RPC methods (`subscribe` / `unsubscribe` / `cancel`) once, then per-channel
|
|
171
146
|
* state lives in a `Map<channelName, ChannelState>`.
|
|
172
147
|
*/
|
|
173
|
-
declare function createRpcStreamingServerHost(rpc: RpcFunctionsHost
|
|
148
|
+
declare function createRpcStreamingServerHost(rpc: RpcFunctionsHost): RpcStreamingHost;
|
|
174
149
|
//#endregion
|
|
175
150
|
//#region src/node/scope.d.ts
|
|
176
151
|
/**
|
|
@@ -205,4 +180,4 @@ declare function toDialableHost(host: string): string;
|
|
|
205
180
|
declare function formatHostForUrl(host: string): string;
|
|
206
181
|
declare function normalizeHttpServerUrl(host: string, port: number | string): string;
|
|
207
182
|
//#endregion
|
|
208
|
-
export { CreateH3DevframeHostOptions, CreateHostContextOptions, CreateStorageOptions, DevframeAgentHost, DevframeDiagnosticsHost, DevframeServicesHostImpl, DevframeViewHost, RpcFunctionsHost, StartHttpAndWsOptions, StartedServer, createH3DevframeHost, createHostContext, createNodeSettings, createRpcSharedStateServerHost, createRpcStreamingServerHost, createScopedNodeContext, createStorage, formatHostForUrl, isObject, normalizeHttpServerUrl, startHttpAndWs, toDialableHost };
|
|
183
|
+
export { CreateH3DevframeHostOptions, CreateHostContextOptions, CreateStorageOptions, DevframeAgentHost, DevframeDiagnosticsHost, DevframeServicesHostImpl, DevframeViewHost, type RpcFunctionsHost, StartHttpAndWsOptions, StartedServer, createH3DevframeHost, createHostContext, createNodeSettings, createRpcSharedStateServerHost, createRpcStreamingServerHost, createScopedNodeContext, createStorage, formatHostForUrl, isObject, normalizeHttpServerUrl, startHttpAndWs, toDialableHost };
|
package/dist/node/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { t as createStorage } from "../storage-E9KrCsLr.mjs";
|
|
2
|
-
import { a as DevframeViewHost, c as
|
|
2
|
+
import { a as DevframeViewHost, c as createRpcSharedStateServerHost, i as createNodeSettings, l as DevframeDiagnosticsHost, n as createHostContext, o as DevframeServicesHostImpl, r as createScopedNodeContext, s as createRpcStreamingServerHost, t as createH3DevframeHost, u as DevframeAgentHost } from "../host-h3-A8CXZoS5.mjs";
|
|
3
3
|
import { a as toDialableHost, i as normalizeHttpServerUrl, n as formatHostForUrl, r as isObject, t as startHttpAndWs } from "../server-DvrOR1LG.mjs";
|
|
4
|
-
export { DevframeAgentHost, DevframeDiagnosticsHost, DevframeServicesHostImpl, DevframeViewHost,
|
|
4
|
+
export { DevframeAgentHost, DevframeDiagnosticsHost, DevframeServicesHostImpl, DevframeViewHost, createH3DevframeHost, createHostContext, createNodeSettings, createRpcSharedStateServerHost, createRpcStreamingServerHost, createScopedNodeContext, createStorage, formatHostForUrl, isObject, normalizeHttpServerUrl, startHttpAndWs, toDialableHost };
|
|
@@ -18,13 +18,11 @@ interface ServeStaticOptions {
|
|
|
18
18
|
*/
|
|
19
19
|
declare function serveStaticHandler(dir: string, options?: ServeStaticOptions): EventHandler;
|
|
20
20
|
/**
|
|
21
|
-
* Mount {@link serveStaticHandler} on an h3 app at `base
|
|
22
|
-
* route pattern and prefix-stripping required by h3 v2.
|
|
21
|
+
* Mount {@link serveStaticHandler} on an h3 app at `base`.
|
|
23
22
|
*
|
|
24
|
-
* h3
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* file resolver sees paths relative to `dir` — this helper bundles both.
|
|
23
|
+
* h3's sub-app mount provides segment-boundary matching and strips `base`
|
|
24
|
+
* from `event.url.pathname`, so the file resolver sees paths relative to
|
|
25
|
+
* `dir`.
|
|
28
26
|
*/
|
|
29
27
|
declare function mountStaticHandler(app: H3, base: string, dir: string, options?: ServeStaticOptions): void;
|
|
30
28
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createReadStream } from "node:fs";
|
|
2
2
|
import { extname, join, normalize, resolve, sep } from "pathe";
|
|
3
|
-
import {
|
|
3
|
+
import { H3, defineHandler } from "h3";
|
|
4
4
|
import { stat } from "node:fs/promises";
|
|
5
5
|
import { Readable } from "node:stream";
|
|
6
6
|
import { lookup } from "mrmime";
|
|
@@ -103,22 +103,16 @@ function serveStaticHandler(dir, options) {
|
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
105
|
/**
|
|
106
|
-
* Mount {@link serveStaticHandler} on an h3 app at `base
|
|
107
|
-
* route pattern and prefix-stripping required by h3 v2.
|
|
106
|
+
* Mount {@link serveStaticHandler} on an h3 app at `base`.
|
|
108
107
|
*
|
|
109
|
-
* h3
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
* file resolver sees paths relative to `dir` — this helper bundles both.
|
|
108
|
+
* h3's sub-app mount provides segment-boundary matching and strips `base`
|
|
109
|
+
* from `event.url.pathname`, so the file resolver sees paths relative to
|
|
110
|
+
* `dir`.
|
|
113
111
|
*/
|
|
114
112
|
function mountStaticHandler(app, base, dir, options) {
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
app.use("/**", handler);
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
app.use(`${trimmed}/**`, withBase(trimmed, handler));
|
|
113
|
+
const staticApp = new H3();
|
|
114
|
+
staticApp.use(serveStaticHandler(dir, options));
|
|
115
|
+
app.mount(base.replace(/\/$/, ""), staticApp);
|
|
122
116
|
}
|
|
123
117
|
/**
|
|
124
118
|
* Connect/Express-style Node middleware variant of {@link serveStaticHandler}.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "devframe",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.5",
|
|
5
5
|
"description": "Framework for building generic devframes",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"perfect-debounce": "^2.1.0",
|
|
101
101
|
"structured-clone-es": "^2.0.0",
|
|
102
102
|
"tinyglobby": "^0.2.17",
|
|
103
|
-
"tsdown": "^0.22.
|
|
103
|
+
"tsdown": "^0.22.8",
|
|
104
104
|
"ua-parser-modern": "^0.1.1",
|
|
105
105
|
"whenexpr": "^0.1.2",
|
|
106
106
|
"ws": "^8.21.1"
|