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.
Files changed (76) hide show
  1. package/dist/{_shared-DqbKCAew.d.mts → _shared-BPovvJW8.d.mts} +1 -1
  2. package/dist/adapters/build.d.mts +11 -2
  3. package/dist/adapters/build.mjs +46 -9
  4. package/dist/adapters/cac.d.mts +1 -1
  5. package/dist/adapters/cac.mjs +1 -1
  6. package/dist/adapters/dev.d.mts +4 -4
  7. package/dist/adapters/dev.mjs +1 -1
  8. package/dist/adapters/embedded.d.mts +1 -1
  9. package/dist/adapters/embedded.mjs +2 -1
  10. package/dist/adapters/initiate.d.mts +3 -3
  11. package/dist/adapters/initiate.mjs +1 -1
  12. package/dist/adapters/mcp.d.mts +1 -1
  13. package/dist/adapters/mcp.mjs +1 -1
  14. package/dist/cli/main.mjs +2 -2
  15. package/dist/client/index.d.mts +5 -5
  16. package/dist/client/index.mjs +2 -2
  17. package/dist/{context-CXhjygJU.mjs → context-BUJGvlje.mjs} +1 -1
  18. package/dist/{context-dqyXS6o3.d.mts → context-CO7eZHJy.d.mts} +1 -1
  19. package/dist/{context-Bdkakk8S.mjs → context-CQW0lSw8.mjs} +40 -20
  20. package/dist/{devframe-BlLEZR-x.d.mts → context-_i51nYOs.d.mts} +1033 -970
  21. package/dist/{dev-C8VHtuPP.mjs → dev-lpIvwagf.mjs} +10 -9
  22. package/dist/{diagnostics-Di8ytitn.mjs → diagnostics-BXWW3VK-.mjs} +3 -3
  23. package/dist/hash-DdPnc4k3.mjs +360 -0
  24. package/dist/{host-agent-BDdcOXhG.mjs → host-agent-B84av916.mjs} +1 -1
  25. package/dist/{http-BbHCU5Zs.mjs → http-BKiqHcXX.mjs} +6 -5
  26. package/dist/{index-BKFT9-jA.d.mts → index-CEvd-YXD.d.mts} +2 -2
  27. package/dist/{index-tdrk1bzV.d.mts → index-DOg4S5wk.d.mts} +1 -1
  28. package/dist/index.d.mts +6 -6
  29. package/dist/{instance-registry-CHunhMi5.mjs → instance-registry-BjlMQbFB.mjs} +1 -1
  30. package/dist/{instance-shell-DbDoozNM.mjs → instance-shell-B-uevnK-.mjs} +4 -4
  31. package/dist/{instance-shell-0iw-cQ5V.d.mts → instance-shell-BHvBIGP4.d.mts} +3 -3
  32. package/dist/internal/index.d.mts +8 -8
  33. package/dist/internal/index.mjs +5 -5
  34. package/dist/node/auth.d.mts +2 -2
  35. package/dist/node/hub-internals.d.mts +2 -2
  36. package/dist/node/hub-internals.mjs +1 -1
  37. package/dist/node/index.d.mts +12 -3
  38. package/dist/node/index.mjs +2 -2
  39. package/dist/recipes/common-rpc-functions.d.mts +13 -3
  40. package/dist/recipes/common-rpc-functions.mjs +10 -0
  41. package/dist/recipes/interactive-auth.d.mts +2 -2
  42. package/dist/recipes/interactive-auth.mjs +1 -1
  43. package/dist/{remote-assets-DRfY2RjX.mjs → remote-assets-DezQmPQU.mjs} +13 -3
  44. package/dist/rpc/dump.d.mts +1 -1
  45. package/dist/rpc/dump.mjs +1 -1
  46. package/dist/rpc/index.d.mts +2 -2
  47. package/dist/rpc/index.mjs +1 -1
  48. package/dist/rpc/transports/sse-client.d.mts +1 -1
  49. package/dist/rpc/transports/sse-server.d.mts +2 -2
  50. package/dist/rpc/transports/ws-bun.d.mts +2 -2
  51. package/dist/rpc/transports/ws-client.d.mts +1 -1
  52. package/dist/rpc/transports/ws-deno.d.mts +26 -0
  53. package/dist/rpc/transports/ws-deno.mjs +30 -0
  54. package/dist/rpc/transports/ws-server.d.mts +1 -1
  55. package/dist/{rpc-core-CR8o34O9.d.mts → rpc-core-CDZoGYiD.d.mts} +3 -3
  56. package/dist/{rpc-core-Dru9uoM0.mjs → rpc-core-DlHd276T.mjs} +3 -10
  57. package/dist/{shared-state-fRRbRUtD.mjs → shared-state-DoXutg_U.mjs} +1 -1
  58. package/dist/{sse-client-CFBOIaUi.d.mts → sse-client-CdGD_B8_.d.mts} +1 -1
  59. package/dist/{static-BPZ1_OPA.mjs → static-DV_qUSRS.mjs} +1 -1
  60. package/dist/{storage-D4a99Ung.mjs → storage-BXNVhKyR.mjs} +1 -1
  61. package/dist/types/index.d.mts +5 -5
  62. package/dist/{types-Djq7CBXh.d.mts → types-BBLeGfpt.d.mts} +1 -1
  63. package/dist/utils/events.d.mts +1 -1
  64. package/dist/utils/hash.mjs +1 -1
  65. package/dist/utils/remote-assets.d.mts +7 -1
  66. package/dist/utils/remote-assets.mjs +1 -1
  67. package/dist/utils/shared-state.d.mts +1 -1
  68. package/dist/utils/shared-state.mjs +1 -1
  69. package/dist/utils/streaming-channel.d.mts +1 -1
  70. package/dist/validation-YrZH6atx.mjs +311 -0
  71. package/dist/{ws-client-DhjNyQo3.d.mts → ws-client-Bo2t6hES.d.mts} +1 -1
  72. package/dist/{ws-server-D1d3QM9f.d.mts → ws-server-DLtEoLdR.d.mts} +1 -1
  73. package/package.json +4 -3
  74. package/skills/devframe/SKILL.md +1 -1
  75. package/dist/hash-KtDZYXDN.mjs +0 -266
  76. package/dist/validation-CpXFB6Dz.mjs +0 -266
@@ -1,4 +1,4 @@
1
- import { d as ConnectionMeta, l as McpRouteOptions, n as DevframeDefinition, r as DevframeDeploymentKind } from "./devframe-BlLEZR-x.mjs";
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 { n as DevframeDefinition } from "../devframe-BlLEZR-x.mjs";
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 };
@@ -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-BPZ1_OPA.mjs";
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-Di8ytitn.mjs";
7
- import { t as createHostContext } from "../context-Bdkakk8S.mjs";
8
- import { t as resolveStaticAssetsSource } from "../remote-assets-DRfY2RjX.mjs";
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.packageName });
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 };
@@ -1,4 +1,4 @@
1
- import { Ft as CliFlagsSchema, It as InferCliFlags, Lt as defineCliFlags, Rt as parseCliFlags, n as DevframeDefinition } from "../devframe-BlLEZR-x.mjs";
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
@@ -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-C8VHtuPP.mjs";
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
@@ -1,8 +1,8 @@
1
- import { _ as DevframeNodeRpcSession, c as DevframeWsOptions, l as McpRouteOptions, n as DevframeDefinition, s as DevframeSseOptions, u as DevframeAuthHandler } from "../devframe-BlLEZR-x.mjs";
2
- import { d as DevframeRpcConnection, n as WsOriginRegistry, u as DevframeNodeRpcSessionMeta } from "../ws-server-D1d3QM9f.mjs";
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-0iw-cQ5V.mjs";
5
- import { a as resolveMcpConnectionMeta, i as resolveDevServerPort, t as ResolveDevServerPortOptions } from "../_shared-DqbKCAew.mjs";
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 {
@@ -1,3 +1,3 @@
1
1
  import { i as resolveMcpConnectionMeta, r as resolveDevServerPort } from "../_shared-BM3PdYli.mjs";
2
- import { t as createDevServer } from "../dev-C8VHtuPP.mjs";
2
+ import { t as createDevServer } from "../dev-lpIvwagf.mjs";
3
3
  export { createDevServer, resolveDevServerPort, resolveMcpConnectionMeta };
@@ -1,4 +1,4 @@
1
- import { g as DevframeNodeContext, n as DevframeDefinition } from "../devframe-BlLEZR-x.mjs";
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.packageName });
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 { $ as DevframeStorageScope, _ as DevframeNodeRpcSession, c as DevframeWsOptions, d as ConnectionMeta, g as DevframeNodeContext, l as McpRouteOptions, n as DevframeDefinition, s as DevframeSseOptions, u as DevframeAuthHandler } from "../devframe-BlLEZR-x.mjs";
2
- import { d as DevframeRpcConnection, n as WsOriginRegistry, u as DevframeNodeRpcSessionMeta } from "../ws-server-D1d3QM9f.mjs";
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-0iw-cQ5V.mjs";
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-C8VHtuPP.mjs";
1
+ import { n as getInstanceInternals, r as initDevframe } from "../dev-lpIvwagf.mjs";
2
2
  export { getInstanceInternals, initDevframe };
@@ -1,4 +1,4 @@
1
- import { g as DevframeNodeContext, n as DevframeDefinition } from "../devframe-BlLEZR-x.mjs";
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
@@ -1,2 +1,2 @@
1
- import { i as createMcpServer, n as mountMcpHttp, r as createMcpFetchHandler } from "../http-BbHCU5Zs.mjs";
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-Di8ytitn.mjs";
3
- import { n as listLiveDevframeInstances, r as probeDevframeOrigin } from "../instance-registry-CHunhMi5.mjs";
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";
@@ -1,8 +1,8 @@
1
- import { E as DevframeRpcServerFunctions, H as DevframeSettings, J as ScopedServerFunctions, M as DevframeServiceMeta, Mt as EventEmitter, P as DevframeServiceScopeOf, R as DevframeServicesState, T as DevframeRpcClientFunctions, X as SettingsForNamespace, Y as ScopedSharedStates, b as RpcSharedStateGetOptions, d as ConnectionMeta, gt as SharedState, ot as StreamReader, q as ScopedRpcFn, st as StreamSink, x as RpcSharedStateHost } from "../devframe-BlLEZR-x.mjs";
2
- import { f as RpcCacheManager, p as RpcCacheOptions } from "../index-tdrk1bzV.mjs";
3
- import { _ as RpcFunctionDefinition, w as RpcFunctionsCollector } from "../types-Djq7CBXh.mjs";
4
- import { t as SseRpcChannelOptions } from "../sse-client-CFBOIaUi.mjs";
5
- import { t as WsRpcChannelOptions } from "../ws-client-DhjNyQo3.mjs";
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 {
@@ -1,7 +1,7 @@
1
- import { t as hash } from "../hash-KtDZYXDN.mjs";
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-fRRbRUtD.mjs";
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-D4a99Ung.mjs";
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 { g as DevframeNodeContext, gt as SharedState } from "./devframe-BlLEZR-x.mjs";
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-Di8ytitn.mjs";
8
- import { r as createEventEmitter, t as DevframeAgentHost } from "./host-agent-BDdcOXhG.mjs";
9
- import { n as createDebug, t as resolveStaticAssetsSource } from "./remote-assets-DRfY2RjX.mjs";
10
- import { t as createStorage } from "./storage-D4a99Ung.mjs";
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; a bare npm package name (the common case: the
780
- * declaring plugin's `packageName`) resolves to that package's location from
781
- * `cwd`, so a service it declares resolves against the plugin's own
782
- * dependencies. An unresolvable package name reads as no base (the caller's
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(pathToFileURL(resolved).href);
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
- * shallow-merge plain objects in declaration order (later sets win); any
886
- * non-object set collapses the merge to "last one wins".
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 shallowMergeOptionSets(sets) {
889
- if (sets.some((set) => typeof set !== "object" || set === null || Array.isArray(set))) return sets[sets.length - 1];
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 ? shallowMergeOptionSets(sets) : void 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;