devframe 0.9.1 → 0.9.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/{_shared-DqbKCAew.d.mts → _shared-BPovvJW8.d.mts} +1 -1
- package/dist/adapters/build.d.mts +11 -2
- package/dist/adapters/build.mjs +46 -9
- package/dist/adapters/cac.d.mts +1 -1
- package/dist/adapters/cac.mjs +1 -1
- package/dist/adapters/dev.d.mts +4 -4
- package/dist/adapters/dev.mjs +1 -1
- package/dist/adapters/embedded.d.mts +1 -1
- package/dist/adapters/embedded.mjs +2 -1
- package/dist/adapters/initiate.d.mts +3 -3
- package/dist/adapters/initiate.mjs +1 -1
- package/dist/adapters/mcp.d.mts +1 -1
- package/dist/adapters/mcp.mjs +1 -1
- package/dist/cli/main.mjs +2 -2
- package/dist/client/index.d.mts +5 -5
- package/dist/client/index.mjs +2 -2
- package/dist/{context-CXhjygJU.mjs → context-BUJGvlje.mjs} +1 -1
- package/dist/{context-dqyXS6o3.d.mts → context-CO7eZHJy.d.mts} +1 -1
- package/dist/{context-Bdkakk8S.mjs → context-CQW0lSw8.mjs} +40 -20
- package/dist/{devframe-BlLEZR-x.d.mts → context-_i51nYOs.d.mts} +1033 -970
- package/dist/{dev-C8VHtuPP.mjs → dev-lpIvwagf.mjs} +10 -9
- package/dist/{diagnostics-Di8ytitn.mjs → diagnostics-BXWW3VK-.mjs} +3 -3
- package/dist/hash-DdPnc4k3.mjs +360 -0
- package/dist/{host-agent-BDdcOXhG.mjs → host-agent-B84av916.mjs} +1 -1
- package/dist/{http-BbHCU5Zs.mjs → http-BKiqHcXX.mjs} +6 -5
- package/dist/{index-BKFT9-jA.d.mts → index-CEvd-YXD.d.mts} +2 -2
- package/dist/{index-tdrk1bzV.d.mts → index-DOg4S5wk.d.mts} +1 -1
- package/dist/index.d.mts +6 -6
- package/dist/{instance-registry-CHunhMi5.mjs → instance-registry-BjlMQbFB.mjs} +1 -1
- package/dist/{instance-shell-DbDoozNM.mjs → instance-shell-B-uevnK-.mjs} +4 -4
- package/dist/{instance-shell-0iw-cQ5V.d.mts → instance-shell-BHvBIGP4.d.mts} +3 -3
- package/dist/internal/index.d.mts +8 -8
- package/dist/internal/index.mjs +5 -5
- package/dist/node/auth.d.mts +2 -2
- package/dist/node/hub-internals.d.mts +2 -2
- package/dist/node/hub-internals.mjs +1 -1
- package/dist/node/index.d.mts +12 -3
- package/dist/node/index.mjs +2 -2
- package/dist/recipes/common-rpc-functions.d.mts +13 -3
- package/dist/recipes/common-rpc-functions.mjs +10 -0
- package/dist/recipes/interactive-auth.d.mts +2 -2
- package/dist/recipes/interactive-auth.mjs +1 -1
- package/dist/{remote-assets-DRfY2RjX.mjs → remote-assets-DezQmPQU.mjs} +13 -3
- package/dist/rpc/dump.d.mts +1 -1
- package/dist/rpc/dump.mjs +1 -1
- package/dist/rpc/index.d.mts +2 -2
- package/dist/rpc/index.mjs +1 -1
- package/dist/rpc/transports/sse-client.d.mts +1 -1
- package/dist/rpc/transports/sse-server.d.mts +2 -2
- package/dist/rpc/transports/ws-bun.d.mts +2 -2
- package/dist/rpc/transports/ws-client.d.mts +1 -1
- package/dist/rpc/transports/ws-deno.d.mts +26 -0
- package/dist/rpc/transports/ws-deno.mjs +30 -0
- package/dist/rpc/transports/ws-server.d.mts +1 -1
- package/dist/{rpc-core-CR8o34O9.d.mts → rpc-core-CDZoGYiD.d.mts} +3 -3
- package/dist/{rpc-core-Dru9uoM0.mjs → rpc-core-DlHd276T.mjs} +3 -10
- package/dist/{shared-state-fRRbRUtD.mjs → shared-state-DoXutg_U.mjs} +1 -1
- package/dist/{sse-client-CFBOIaUi.d.mts → sse-client-CdGD_B8_.d.mts} +1 -1
- package/dist/{static-BPZ1_OPA.mjs → static-DV_qUSRS.mjs} +1 -1
- package/dist/{storage-D4a99Ung.mjs → storage-BXNVhKyR.mjs} +1 -1
- package/dist/types/index.d.mts +5 -5
- package/dist/{types-Djq7CBXh.d.mts → types-BBLeGfpt.d.mts} +1 -1
- package/dist/utils/events.d.mts +1 -1
- package/dist/utils/hash.mjs +1 -1
- package/dist/utils/remote-assets.d.mts +7 -1
- package/dist/utils/remote-assets.mjs +1 -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/validation-YrZH6atx.mjs +311 -0
- package/dist/{ws-client-DhjNyQo3.d.mts → ws-client-Bo2t6hES.d.mts} +1 -1
- package/dist/{ws-server-D1d3QM9f.d.mts → ws-server-DLtEoLdR.d.mts} +1 -1
- package/package.json +4 -3
- package/skills/devframe/SKILL.md +1 -1
- package/dist/hash-KtDZYXDN.mjs +0 -266
- package/dist/validation-CpXFB6Dz.mjs +0 -266
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { F as DevframeDefinition, G as McpRouteOptions, I as DevframeDeploymentKind, t as ConnectionMeta } from "./context-_i51nYOs.mjs";
|
|
2
2
|
//#region src/adapters/_shared.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Resolve the mount base path for a devframe's SPA. Hosted adapters
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { F as DevframeDefinition, V as DevframeSnapshotRpcEntry, o as DevframeNodeContext } from "../context-_i51nYOs.mjs";
|
|
2
2
|
import { o as StaticAssetsSource } from "../remote-assets-Bg4gCUZ_.mjs";
|
|
3
3
|
//#region src/adapters/build.d.ts
|
|
4
4
|
interface CreateBuildOptions {
|
|
@@ -37,5 +37,14 @@ interface CreateBuildOptions {
|
|
|
37
37
|
* `/devframe/`, or any base, no rewriting required.
|
|
38
38
|
*/
|
|
39
39
|
declare function createBuild(d: DevframeDefinition, options?: CreateBuildOptions): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Attach a `dump` to each {@link DevframeRpcOptions.snapshot} target so the
|
|
42
|
+
* static collector bakes it, even though the (service-owned) definition
|
|
43
|
+
* declares no dump of its own. A bare method id becomes `snapshot: true`
|
|
44
|
+
* (bakes the no-arg call); `{ method, inputs }` bakes one record per resolved
|
|
45
|
+
* argument-tuple by running the target's own handler, with the first tuple's
|
|
46
|
+
* output as the fallback.
|
|
47
|
+
*/
|
|
48
|
+
declare function applySnapshotRpc(ctx: DevframeNodeContext, entries: readonly DevframeSnapshotRpcEntry[] | undefined): void;
|
|
40
49
|
//#endregion
|
|
41
|
-
export { CreateBuildOptions, createBuild };
|
|
50
|
+
export { CreateBuildOptions, applySnapshotRpc, createBuild };
|
package/dist/adapters/build.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { s as colors } from "../nostics-CzECRXpE.mjs";
|
|
2
2
|
import { n as strictJsonStringify } from "../serialization-BGzEwAdr.mjs";
|
|
3
3
|
import { DEVFRAME_CONNECTION_META_FILENAME, DEVFRAME_RPC_DUMP_DIRNAME, DEVFRAME_RPC_DUMP_MANIFEST_FILENAME } from "../constants.mjs";
|
|
4
|
-
import { t as collectStaticRpcDump } from "../static-
|
|
4
|
+
import { t as collectStaticRpcDump } from "../static-DV_qUSRS.mjs";
|
|
5
5
|
import { n as structuredCloneStringify } from "../structured-clone-CbAV5rFI.mjs";
|
|
6
|
-
import { t as diagnostics } from "../diagnostics-
|
|
7
|
-
import { t as createHostContext } from "../context-
|
|
8
|
-
import { t as resolveStaticAssetsSource } from "../remote-assets-
|
|
6
|
+
import { t as diagnostics } from "../diagnostics-BXWW3VK-.mjs";
|
|
7
|
+
import { t as createHostContext } from "../context-CQW0lSw8.mjs";
|
|
8
|
+
import { t as resolveStaticAssetsSource } from "../remote-assets-DezQmPQU.mjs";
|
|
9
9
|
import { t as createH3DevframeHost } from "../host-h3-fRbF9yor.mjs";
|
|
10
10
|
import process from "node:process";
|
|
11
11
|
import { dirname, resolve } from "pathe";
|
|
@@ -34,7 +34,7 @@ async function createBuild(d, options = {}) {
|
|
|
34
34
|
origin: "http://localhost",
|
|
35
35
|
appName: d.id
|
|
36
36
|
});
|
|
37
|
-
const resolved = resolveStaticAssetsSource(distSource, host.getStorageDir("project"));
|
|
37
|
+
const resolved = resolveStaticAssetsSource(distSource, host.getStorageDir("project"), d.importMetaUrl);
|
|
38
38
|
if (typeof resolved === "string") {
|
|
39
39
|
console.log(colors.cyan`[devframe] copying SPA from ${resolved} -> ${outDir}`);
|
|
40
40
|
await fs$1.cp(resolved, outDir, { recursive: true });
|
|
@@ -45,11 +45,13 @@ async function createBuild(d, options = {}) {
|
|
|
45
45
|
const ctx = await createHostContext({
|
|
46
46
|
cwd: process.cwd(),
|
|
47
47
|
mode: "build",
|
|
48
|
-
host
|
|
48
|
+
host,
|
|
49
|
+
importMetaUrl: d.importMetaUrl
|
|
49
50
|
});
|
|
50
|
-
for (const input of d.services ?? []) ctx.services.install(input, { resolveFrom: d.
|
|
51
|
-
await d.setup(ctx);
|
|
51
|
+
for (const input of d.services ?? []) ctx.services.install(input, { resolveFrom: d.importMetaUrl });
|
|
52
52
|
await ctx.services.ready();
|
|
53
|
+
await d.setup(ctx);
|
|
54
|
+
applySnapshotRpc(ctx, d.rpc?.snapshot);
|
|
53
55
|
await fs$1.mkdir(resolve(outDir, DEVFRAME_RPC_DUMP_DIRNAME), { recursive: true });
|
|
54
56
|
const jsonSerializableMethods = [];
|
|
55
57
|
for (const def of ctx.rpc.definitions.values()) if (def.jsonSerializable === true) jsonSerializableMethods.push(def.name);
|
|
@@ -69,5 +71,40 @@ async function createBuild(d, options = {}) {
|
|
|
69
71
|
await fs$1.writeFile(resolve(outDir, DEVFRAME_RPC_DUMP_MANIFEST_FILENAME), JSON.stringify(dump.manifest, null, 2), "utf-8");
|
|
70
72
|
console.log(colors.green`[devframe] built "${d.id}" -> ${outDir}`);
|
|
71
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Attach a `dump` to each {@link DevframeRpcOptions.snapshot} target so the
|
|
76
|
+
* static collector bakes it, even though the (service-owned) definition
|
|
77
|
+
* declares no dump of its own. A bare method id becomes `snapshot: true`
|
|
78
|
+
* (bakes the no-arg call); `{ method, inputs }` bakes one record per resolved
|
|
79
|
+
* argument-tuple by running the target's own handler, with the first tuple's
|
|
80
|
+
* output as the fallback.
|
|
81
|
+
*/
|
|
82
|
+
function applySnapshotRpc(ctx, entries) {
|
|
83
|
+
for (const entry of entries ?? []) {
|
|
84
|
+
const method = typeof entry === "string" ? entry : entry.method;
|
|
85
|
+
const def = ctx.rpc.definitions.get(method);
|
|
86
|
+
if (!def) {
|
|
87
|
+
diagnostics.DF0072({ method });
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
if (typeof entry === "string") {
|
|
91
|
+
def.snapshot = true;
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
const inputsSpec = entry.inputs;
|
|
95
|
+
def.dump = async (dumpCtx, handler) => {
|
|
96
|
+
const tuples = typeof inputsSpec === "function" ? await inputsSpec(dumpCtx) : inputsSpec;
|
|
97
|
+
const records = [];
|
|
98
|
+
for (const input of tuples) records.push({
|
|
99
|
+
inputs: [...input],
|
|
100
|
+
output: await handler(...input)
|
|
101
|
+
});
|
|
102
|
+
return {
|
|
103
|
+
records,
|
|
104
|
+
fallback: records[0]?.output
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
}
|
|
72
109
|
//#endregion
|
|
73
|
-
export { createBuild };
|
|
110
|
+
export { applySnapshotRpc, createBuild };
|
package/dist/adapters/cac.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Dt as parseCliFlags, Et as defineCliFlags, F as DevframeDefinition, Tt as InferCliFlags, wt as CliFlagsSchema } from "../context-_i51nYOs.mjs";
|
|
2
2
|
import { CAC } from "cac";
|
|
3
3
|
import { H3 } from "h3";
|
|
4
4
|
//#region src/adapters/cac.d.ts
|
package/dist/adapters/cac.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { s as colors } from "../nostics-CzECRXpE.mjs";
|
|
2
2
|
import { r as resolveDevServerPort } from "../_shared-BM3PdYli.mjs";
|
|
3
3
|
import { createBuild } from "./build.mjs";
|
|
4
|
-
import { t as createDevServer } from "../dev-
|
|
4
|
+
import { t as createDevServer } from "../dev-lpIvwagf.mjs";
|
|
5
5
|
import process from "node:process";
|
|
6
6
|
import cac$1 from "cac";
|
|
7
7
|
//#region src/adapters/flags.ts
|
package/dist/adapters/dev.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { d as DevframeRpcConnection, n as WsOriginRegistry, u as DevframeNodeRpcSessionMeta } from "../ws-server-DLtEoLdR.mjs";
|
|
2
|
+
import { Ct as DevframeAuthHandler, F as DevframeDefinition, G as McpRouteOptions, U as DevframeSseOptions, W as DevframeWsOptions, s as DevframeNodeRpcSession } from "../context-_i51nYOs.mjs";
|
|
3
3
|
import { o as StaticAssetsSource } from "../remote-assets-Bg4gCUZ_.mjs";
|
|
4
|
-
import { c as StartedServer } from "../instance-shell-
|
|
5
|
-
import { a as resolveMcpConnectionMeta, i as resolveDevServerPort, t as ResolveDevServerPortOptions } from "../_shared-
|
|
4
|
+
import { c as StartedServer } from "../instance-shell-BHvBIGP4.mjs";
|
|
5
|
+
import { a as resolveMcpConnectionMeta, i as resolveDevServerPort, t as ResolveDevServerPortOptions } from "../_shared-BPovvJW8.mjs";
|
|
6
6
|
import { H3 } from "h3";
|
|
7
7
|
//#region src/adapters/dev.d.ts
|
|
8
8
|
interface CreateDevServerOptions {
|
package/dist/adapters/dev.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { i as resolveMcpConnectionMeta, r as resolveDevServerPort } from "../_shared-BM3PdYli.mjs";
|
|
2
|
-
import { t as createDevServer } from "../dev-
|
|
2
|
+
import { t as createDevServer } from "../dev-lpIvwagf.mjs";
|
|
3
3
|
export { createDevServer, resolveDevServerPort, resolveMcpConnectionMeta };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { F as DevframeDefinition, o as DevframeNodeContext } from "../context-_i51nYOs.mjs";
|
|
2
2
|
//#region src/adapters/embedded.d.ts
|
|
3
3
|
interface CreateEmbeddedOptions {
|
|
4
4
|
/** Target context the devframe is registered into. Required. */
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
* effective default follows the hosted rule of `def.basePath ?? '/__<id>/'`.
|
|
10
10
|
*/
|
|
11
11
|
async function createEmbedded(d, options) {
|
|
12
|
-
for (const input of d.services ?? []) options.ctx.services.install(input, { resolveFrom: d.
|
|
12
|
+
for (const input of d.services ?? []) options.ctx.services.install(input, { resolveFrom: d.importMetaUrl });
|
|
13
|
+
await options.ctx.services.ready();
|
|
13
14
|
await d.setup(options.ctx);
|
|
14
15
|
}
|
|
15
16
|
//#endregion
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { d as DevframeRpcConnection, n as WsOriginRegistry, u as DevframeNodeRpcSessionMeta } from "../ws-server-DLtEoLdR.mjs";
|
|
2
|
+
import { Ct as DevframeAuthHandler, F as DevframeDefinition, G as McpRouteOptions, U as DevframeSseOptions, W as DevframeWsOptions, bt as DevframeStorageScope, o as DevframeNodeContext, s as DevframeNodeRpcSession, t as ConnectionMeta } from "../context-_i51nYOs.mjs";
|
|
3
3
|
import { o as StaticAssetsSource } from "../remote-assets-Bg4gCUZ_.mjs";
|
|
4
|
-
import { c as StartedServer, f as DevframeInstanceRecord } from "../instance-shell-
|
|
4
|
+
import { c as StartedServer, f as DevframeInstanceRecord } from "../instance-shell-BHvBIGP4.mjs";
|
|
5
5
|
import { Buffer } from "node:buffer";
|
|
6
6
|
import { IncomingMessage, Server, ServerResponse } from "node:http";
|
|
7
7
|
import { Duplex } from "node:stream";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as getInstanceInternals, r as initDevframe } from "../dev-
|
|
1
|
+
import { n as getInstanceInternals, r as initDevframe } from "../dev-lpIvwagf.mjs";
|
|
2
2
|
export { getInstanceInternals, initDevframe };
|
package/dist/adapters/mcp.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { F as DevframeDefinition, o as DevframeNodeContext } from "../context-_i51nYOs.mjs";
|
|
2
2
|
import { H3 } from "h3";
|
|
3
3
|
import "@modelcontextprotocol/server";
|
|
4
4
|
//#region src/adapters/mcp/build-server.d.ts
|
package/dist/adapters/mcp.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as createMcpServer, n as mountMcpHttp, r as createMcpFetchHandler } from "../http-
|
|
1
|
+
import { i as createMcpServer, n as mountMcpHttp, r as createMcpFetchHandler } from "../http-BKiqHcXX.mjs";
|
|
2
2
|
export { createMcpFetchHandler, createMcpServer, mountMcpHttp };
|
package/dist/cli/main.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as Diagnostic } from "../nostics-CzECRXpE.mjs";
|
|
2
|
-
import { t as diagnostics } from "../diagnostics-
|
|
3
|
-
import { n as listLiveDevframeInstances, r as probeDevframeOrigin } from "../instance-registry-
|
|
2
|
+
import { t as diagnostics } from "../diagnostics-BXWW3VK-.mjs";
|
|
3
|
+
import { n as listLiveDevframeInstances, r as probeDevframeOrigin } from "../instance-registry-BjlMQbFB.mjs";
|
|
4
4
|
import { t as toAgentToolName } from "../agent-tool-name-EgfoFO8C.mjs";
|
|
5
5
|
import process from "node:process";
|
|
6
6
|
import { joinURL } from "ufo";
|
package/dist/client/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { t as SseRpcChannelOptions } from "../sse-client-
|
|
5
|
-
import { t as WsRpcChannelOptions } from "../ws-client-
|
|
1
|
+
import { f as RpcCacheManager, p as RpcCacheOptions } from "../index-DOg4S5wk.mjs";
|
|
2
|
+
import { _ as RpcFunctionDefinition, w as RpcFunctionsCollector } from "../types-BBLeGfpt.mjs";
|
|
3
|
+
import { Q as DevframeServiceScopeOf, X as DevframeServiceMeta, _t as DevframeRpcServerFunctions, b as StreamSink, d as RpcSharedStateHost, dt as ScopedRpcFn, ft as ScopedServerFunctions, gt as DevframeRpcClientFunctions, k as SharedState, mt as SettingsForNamespace, nt as DevframeServicesState, ot as DevframeSettings, pt as ScopedSharedStates, t as ConnectionMeta, u as RpcSharedStateGetOptions, y as StreamReader, zt as EventEmitter } from "../context-_i51nYOs.mjs";
|
|
4
|
+
import { t as SseRpcChannelOptions } from "../sse-client-CdGD_B8_.mjs";
|
|
5
|
+
import { t as WsRpcChannelOptions } from "../ws-client-Bo2t6hES.mjs";
|
|
6
6
|
import { BirpcOptions, BirpcReturn } from "birpc";
|
|
7
7
|
//#region src/client/connection.d.ts
|
|
8
8
|
interface DevframeConnection {
|
package/dist/client/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as hash } from "../hash-
|
|
1
|
+
import { t as hash } from "../hash-DdPnc4k3.mjs";
|
|
2
2
|
import { colors } from "../utils/colors.mjs";
|
|
3
3
|
import { createEventEmitter } from "../utils/events.mjs";
|
|
4
|
-
import { t as createSharedState } from "../shared-state-
|
|
4
|
+
import { t as createSharedState } from "../shared-state-DoXutg_U.mjs";
|
|
5
5
|
import { i as structuredCloneStringify, n as structuredCloneParse, t as structuredCloneDeserialize } from "../structured-clone-CgtQ61SA.mjs";
|
|
6
6
|
import { createStreamReader, createStreamSink } from "../utils/streaming-channel.mjs";
|
|
7
7
|
import { defineDiagnostics } from "nostics";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as randomToken } from "./crypto-token-XCqTSMg9.mjs";
|
|
2
|
-
import { t as createStorage } from "./storage-
|
|
2
|
+
import { t as createStorage } from "./storage-BXNVhKyR.mjs";
|
|
3
3
|
import { n as revokeAuthToken, t as revokeActiveConnectionsForToken } from "./revoke-3Q6aDKWk.mjs";
|
|
4
4
|
import { join } from "pathe";
|
|
5
5
|
//#region src/node/hub-internals/context.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { k as SharedState, o as DevframeNodeContext } from "./context-_i51nYOs.mjs";
|
|
2
2
|
//#region src/node/hub-internals/context.d.ts
|
|
3
3
|
interface InternalAnonymousAuthStorage {
|
|
4
4
|
trusted: Record<string, {
|
|
@@ -4,10 +4,10 @@ import { RpcFunctionsCollectorBase } from "./rpc/index.mjs";
|
|
|
4
4
|
import { defineRpcFunction } from "./index.mjs";
|
|
5
5
|
import { t as DEVFRAME_EVENTS } from "./events-DKfSmoTj.mjs";
|
|
6
6
|
import { DEVFRAME_SERVICES_STATE_KEY } from "./constants.mjs";
|
|
7
|
-
import { t as diagnostics$1 } from "./diagnostics-
|
|
8
|
-
import { r as createEventEmitter, t as DevframeAgentHost } from "./host-agent-
|
|
9
|
-
import { n as createDebug, t as resolveStaticAssetsSource } from "./remote-assets-
|
|
10
|
-
import { t as createStorage } from "./storage-
|
|
7
|
+
import { t as diagnostics$1 } from "./diagnostics-BXWW3VK-.mjs";
|
|
8
|
+
import { r as createEventEmitter, t as DevframeAgentHost } from "./host-agent-B84av916.mjs";
|
|
9
|
+
import { n as createDebug, t as resolveStaticAssetsSource } from "./remote-assets-DezQmPQU.mjs";
|
|
10
|
+
import { t as createStorage } from "./storage-BXNVhKyR.mjs";
|
|
11
11
|
import { createRequire } from "node:module";
|
|
12
12
|
import { createSharedState } from "devframe/utils/shared-state";
|
|
13
13
|
import process from "node:process";
|
|
@@ -776,10 +776,10 @@ function toRequireBase(resolveFrom) {
|
|
|
776
776
|
}
|
|
777
777
|
/**
|
|
778
778
|
* Normalize an `install()` `resolveFrom` into a resolution base. Paths and
|
|
779
|
-
* file URLs pass through
|
|
780
|
-
*
|
|
781
|
-
*
|
|
782
|
-
*
|
|
779
|
+
* file URLs pass through (the common case: the declaring plugin's
|
|
780
|
+
* `importMetaUrl`, so a service it declares resolves against the plugin's own
|
|
781
|
+
* dependencies); a bare npm package name resolves to that package's location
|
|
782
|
+
* from `cwd`. An unresolvable package name reads as no base (the caller's
|
|
783
783
|
* workspace fallbacks apply).
|
|
784
784
|
*/
|
|
785
785
|
function expandResolveFrom(resolveFrom, cwd) {
|
|
@@ -809,7 +809,12 @@ async function importServicePackage(pkg, resolveFroms) {
|
|
|
809
809
|
lastError = error;
|
|
810
810
|
continue;
|
|
811
811
|
}
|
|
812
|
-
return await import(
|
|
812
|
+
return await import(
|
|
813
|
+
/* webpackIgnore: true */
|
|
814
|
+
/* @vite-ignore */
|
|
815
|
+
/* turbopackIgnore: true */
|
|
816
|
+
pathToFileURL(resolved).href
|
|
817
|
+
);
|
|
813
818
|
}
|
|
814
819
|
throw lastError;
|
|
815
820
|
}
|
|
@@ -880,14 +885,27 @@ function satisfiesVersionRange(version, range) {
|
|
|
880
885
|
if (alternatives.length === 0) return true;
|
|
881
886
|
return alternatives.some((alternative) => alternative.split(/\s+/).every((comparator) => satisfiesComparator(parsed, comparator)));
|
|
882
887
|
}
|
|
888
|
+
function isPlainObject(value) {
|
|
889
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
890
|
+
}
|
|
891
|
+
/** Deep-merge two values with the service option-set rules (see below). */
|
|
892
|
+
function deepMergeTwo(a, b) {
|
|
893
|
+
if (Array.isArray(a) && Array.isArray(b)) return [.../* @__PURE__ */ new Set([...a, ...b])];
|
|
894
|
+
if (isPlainObject(a) && isPlainObject(b)) {
|
|
895
|
+
const out = { ...a };
|
|
896
|
+
for (const key of Object.keys(b)) out[key] = key in a ? deepMergeTwo(a[key], b[key]) : b[key];
|
|
897
|
+
return out;
|
|
898
|
+
}
|
|
899
|
+
return b;
|
|
900
|
+
}
|
|
883
901
|
/**
|
|
884
902
|
* Default option-set merge when a service declares no `mergeOptions`:
|
|
885
|
-
*
|
|
886
|
-
*
|
|
903
|
+
* deep-merge in declaration order — objects recurse, arrays union-dedupe,
|
|
904
|
+
* scalars take the later value. Covers the built-in services (`roots` /
|
|
905
|
+
* `langs` union, `themes` per-key last-wins) without a custom hook.
|
|
887
906
|
*/
|
|
888
|
-
function
|
|
889
|
-
|
|
890
|
-
return Object.assign({}, ...sets);
|
|
907
|
+
function deepMergeOptionSets(sets) {
|
|
908
|
+
return sets.reduce((merged, set) => deepMergeTwo(merged, set));
|
|
891
909
|
}
|
|
892
910
|
//#endregion
|
|
893
911
|
//#region src/node/host-services.ts
|
|
@@ -1068,7 +1086,7 @@ var DevframeServicesHostImpl = class {
|
|
|
1068
1086
|
});
|
|
1069
1087
|
}
|
|
1070
1088
|
const sets = entries.map((entry) => entry.input.options).filter((options) => options !== void 0);
|
|
1071
|
-
const options = def.mergeOptions ? def.mergeOptions(sets) : sets.length > 0 ?
|
|
1089
|
+
const options = def.mergeOptions ? def.mergeOptions(sets) : sets.length > 0 ? deepMergeOptionSets(sets) : void 0;
|
|
1072
1090
|
if (!this.context) throw diagnostics$1.DF0070({
|
|
1073
1091
|
package: pkg,
|
|
1074
1092
|
reason: "this services host has no node context to install into"
|
|
@@ -1101,15 +1119,17 @@ var DevframeServicesHostImpl = class {
|
|
|
1101
1119
|
//#region src/node/host-views.ts
|
|
1102
1120
|
var DevframeViewHost = class {
|
|
1103
1121
|
context;
|
|
1122
|
+
importMetaUrl;
|
|
1104
1123
|
/**
|
|
1105
1124
|
* @internal
|
|
1106
1125
|
*/
|
|
1107
1126
|
buildStaticDirs = [];
|
|
1108
|
-
constructor(context) {
|
|
1127
|
+
constructor(context, importMetaUrl) {
|
|
1109
1128
|
this.context = context;
|
|
1129
|
+
this.importMetaUrl = importMetaUrl;
|
|
1110
1130
|
}
|
|
1111
|
-
hostStatic(baseUrl, source) {
|
|
1112
|
-
const resolved = resolveStaticAssetsSource(source, this.context.host.getStorageDir("project"));
|
|
1131
|
+
hostStatic(baseUrl, source, defaultResolveFrom = this.importMetaUrl) {
|
|
1132
|
+
const resolved = resolveStaticAssetsSource(source, this.context.host.getStorageDir("project"), defaultResolveFrom);
|
|
1113
1133
|
if (typeof resolved === "string" && !existsSync(resolved)) throw diagnostics$1.DF0008({ distDir: resolved });
|
|
1114
1134
|
this.buildStaticDirs.push({
|
|
1115
1135
|
baseUrl,
|
|
@@ -1301,7 +1321,7 @@ function createScopedNodeContext(context, namespace) {
|
|
|
1301
1321
|
* `commands` when mounted into Vite DevTools.
|
|
1302
1322
|
*/
|
|
1303
1323
|
async function createHostContext(options) {
|
|
1304
|
-
const { cwd, workspaceRoot = cwd, mode, host, builtinRpcDeclarations = [] } = options;
|
|
1324
|
+
const { cwd, workspaceRoot = cwd, mode, host, importMetaUrl, builtinRpcDeclarations = [] } = options;
|
|
1305
1325
|
const context = {
|
|
1306
1326
|
cwd,
|
|
1307
1327
|
workspaceRoot,
|
|
@@ -1316,7 +1336,7 @@ async function createHostContext(options) {
|
|
|
1316
1336
|
scope: void 0
|
|
1317
1337
|
};
|
|
1318
1338
|
const rpcHost = new RpcFunctionsHostImpl(context);
|
|
1319
|
-
const viewsHost = new DevframeViewHost(context);
|
|
1339
|
+
const viewsHost = new DevframeViewHost(context, importMetaUrl);
|
|
1320
1340
|
const diagnosticsHost = new DevframeDiagnosticsHost(context, [diagnostics$1, diagnostics]);
|
|
1321
1341
|
context.rpc = rpcHost;
|
|
1322
1342
|
context.views = viewsHost;
|