@zenbujs/core 0.0.4 → 0.0.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.
Files changed (88) hide show
  1. package/dist/{advice-config-BLXjqjGN.mjs → advice-config-QYB2qEd_.mjs} +12 -2
  2. package/dist/advice.mjs +1 -1
  3. package/dist/{base-window-D8CpxMU3.mjs → base-window-BbFRRhKP.mjs} +9 -4
  4. package/dist/{build-electron-C3Beey84.mjs → build-electron-CNJ0dLND.mjs} +1 -1
  5. package/dist/{build-source-BvC4bPqH.mjs → build-source-C2puqEVr.mjs} +2 -2
  6. package/dist/chunk-DsiFFCwN.mjs +16 -0
  7. package/dist/cli/bin.mjs +7 -7
  8. package/dist/cli/build.d.mts +1 -1
  9. package/dist/cli/build.mjs +2 -2
  10. package/dist/cli/resolve-config.mjs +3 -2
  11. package/dist/{cli-F0B4dvSg.mjs → cli-C3R1LBMY.mjs} +4 -4
  12. package/dist/{config-BlRXeUXx.mjs → config-DXRCDUxG.mjs} +1 -1
  13. package/dist/config.d.mts +3 -2
  14. package/dist/config.mjs +4 -3
  15. package/dist/{db-Cd5ETuPG.mjs → db-xjvahRFJ.mjs} +2 -2
  16. package/dist/db.d.mts +1 -1
  17. package/dist/db.mjs +2 -2
  18. package/dist/env-bootstrap.d.mts +1 -1
  19. package/dist/env-bootstrap.mjs +52 -1
  20. package/dist/index.d.mts +5 -5
  21. package/dist/index.mjs +4 -4
  22. package/dist/{link-BJmsKgPa.mjs → link-c0_aLWQ3.mjs} +1 -1
  23. package/dist/{load-config-BG2tPIfF.mjs → load-config-xMf2wxH8.mjs} +18 -3
  24. package/dist/loaders/zenbu.d.mts +1 -0
  25. package/dist/loaders/zenbu.mjs +7 -87
  26. package/dist/{monorepo-DCruz9Jx.mjs → monorepo-3avKJwzJ.mjs} +3 -0
  27. package/dist/node-loader.mjs +1 -1
  28. package/dist/{publish-source-34Hn9zb0.mjs → publish-source-Dill72NS.mjs} +2 -2
  29. package/dist/react.d.mts +3 -3
  30. package/dist/react.mjs +2 -2
  31. package/dist/{registry-CioEYLI5.d.mts → registry-eX6e2oql.d.mts} +1 -1
  32. package/dist/registry.d.mts +1 -1
  33. package/dist/{reloader-DJoCB0bC.mjs → reloader-DzEO8kJr.mjs} +6 -4
  34. package/dist/{renderer-host-ztaSIOGx.mjs → renderer-host-Cau9JK0v.mjs} +30 -18
  35. package/dist/{rpc-CsgWnlZx.mjs → rpc-JfGv-Wuw.mjs} +7 -5
  36. package/dist/rpc.d.mts +1 -1
  37. package/dist/rpc.mjs +1 -1
  38. package/dist/{runtime-CsiDppGF.d.mts → runtime-pCeVzj--.d.mts} +37 -5
  39. package/dist/runtime.d.mts +2 -2
  40. package/dist/runtime.mjs +522 -2
  41. package/dist/{schema-DvT61x2_.d.mts → schema-Dl85YjXW.d.mts} +1 -1
  42. package/dist/schema.d.mts +1 -1
  43. package/dist/schema.mjs +27 -1
  44. package/dist/{server-DB3Eki_G.mjs → server-y3PPbh3l.mjs} +5 -3
  45. package/dist/services/default.mjs +10 -10
  46. package/dist/services/index.d.mts +8 -4
  47. package/dist/services/index.mjs +6 -6
  48. package/dist/setup-gate.d.mts +1 -1
  49. package/dist/setup-gate.mjs +248 -1
  50. package/dist/{transform-DJH3vN4b.mjs → transform-CmFYPmt8.mjs} +1 -1
  51. package/dist/{transforms-EVd5Fgyk.d.mts → transforms-CuTODvDx.d.mts} +10 -1
  52. package/dist/{transport-BMSzG2-F.mjs → transport-F2hv_OEm.mjs} +1 -1
  53. package/dist/{vite-plugins-t4MlFcz3.mjs → vite-plugins-Do7liKi_.mjs} +3 -3
  54. package/dist/vite.mjs +1 -1
  55. package/dist/{window-DUvMTons.mjs → window-o2NGUsIb.mjs} +10 -7
  56. package/dist/{write-9dRFczGJ.mjs → write-DgIRjo23.mjs} +1 -1
  57. package/package.json +4 -4
  58. package/dist/advice-config-D6K_a7e9.mjs +0 -2
  59. package/dist/base-window-OXg2KSyP.mjs +0 -2
  60. package/dist/chunk-Dm34NbLt.mjs +0 -6
  61. package/dist/config-Ch1FreWU.mjs +0 -2
  62. package/dist/db-Bz_CDIWg.mjs +0 -2
  63. package/dist/env-bootstrap-rj7I-59x.mjs +0 -53
  64. package/dist/http-B36qtsm0.mjs +0 -2
  65. package/dist/load-config-CQG4297M.mjs +0 -2
  66. package/dist/reloader-FeHKV2jd.mjs +0 -2
  67. package/dist/renderer-host-BQpS0ZM2.mjs +0 -2
  68. package/dist/rpc-D_s7-WZe.mjs +0 -2
  69. package/dist/runtime-C95iyVn6.mjs +0 -461
  70. package/dist/schema-dGK6qkfR.mjs +0 -28
  71. package/dist/server-CgzQOPSW.mjs +0 -2
  72. package/dist/setup-gate-D8XfYY52.mjs +0 -140
  73. package/dist/view-registry-2zePxTEg.mjs +0 -2
  74. package/dist/window-S3TlTXlK.mjs +0 -2
  75. /package/dist/{build-config-BwnnfrN-.mjs → build-config-C3a-o3_B.mjs} +0 -0
  76. /package/dist/{dev-DLutFPyo.mjs → dev-Dazhu66l.mjs} +0 -0
  77. /package/dist/{env-bootstrap-uCKbw2q8.d.mts → env-bootstrap-DW2hVhSO.d.mts} +0 -0
  78. /package/dist/{index-CE0iPntP.d.mts → index-C-ALz_SH.d.mts} +0 -0
  79. /package/dist/{index-CKKoxA9V.d.mts → index-ClXLQ1fw.d.mts} +0 -0
  80. /package/dist/{index-UK58xuoR.d.mts → index-M_lSNBrq.d.mts} +0 -0
  81. /package/dist/{log-CyKv8hQg.mjs → log-6rzaCV0I.mjs} +0 -0
  82. /package/dist/{mirror-sync-EiWvdzTJ.mjs → mirror-sync-PDzxhf1w.mjs} +0 -0
  83. /package/dist/{node-CvZnTx53.mjs → node-_8xShqxr.mjs} +0 -0
  84. /package/dist/{schema-CIg4GzHQ.mjs → schema-Ca7SxXgS.mjs} +0 -0
  85. /package/dist/{setup-gate-D62nX5lk.d.mts → setup-gate-Dcy8gGPJ.d.mts} +0 -0
  86. /package/dist/{src-pELM4_iH.mjs → src-Cven45mq.mjs} +0 -0
  87. /package/dist/{trace-DCB7qFzT.mjs → trace-BaVg0rnY.mjs} +0 -0
  88. /package/dist/{transforms-DVoy8dCu.mjs → transforms-htxfTwsY.mjs} +0 -0
@@ -1,6 +1,7 @@
1
- import { t as Service, u as runtime } from "./runtime-C95iyVn6.mjs";
2
- import { t as createLogger } from "./log-CyKv8hQg.mjs";
3
- import { a as zenbuVitePlugins } from "./vite-plugins-t4MlFcz3.mjs";
1
+ import { n as __exportAll } from "./chunk-DsiFFCwN.mjs";
2
+ import { Service, runtime } from "./runtime.mjs";
3
+ import { t as createLogger } from "./log-6rzaCV0I.mjs";
4
+ import { a as zenbuVitePlugins } from "./vite-plugins-Do7liKi_.mjs";
4
5
  import os from "node:os";
5
6
  import path, { resolve } from "node:path";
6
7
  import { createHash } from "node:crypto";
@@ -15,6 +16,7 @@ const DB_CONFIG_JSON = path.join(INTERNAL_DIR, "db.json");
15
16
  path.join(INTERNAL_DIR, "plugin-setup-state.json");
16
17
  //#endregion
17
18
  //#region src/services/reloader.ts
19
+ var reloader_exports = /* @__PURE__ */ __exportAll({ ReloaderService: () => ReloaderService });
18
20
  const log = createLogger("reloader");
19
21
  function safeCacheSegment(value) {
20
22
  return value.replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 64) || "renderer";
@@ -161,4 +163,4 @@ var ReloaderService = class extends Service {
161
163
  };
162
164
  runtime.register(ReloaderService, import.meta);
163
165
  //#endregion
164
- export { DB_CONFIG_JSON as n, INTERNAL_DIR as r, ReloaderService as t };
166
+ export { INTERNAL_DIR as i, reloader_exports as n, DB_CONFIG_JSON as r, ReloaderService as t };
@@ -1,12 +1,13 @@
1
- import { a as getPlugins, r as getAppEntrypoint, t as Service, u as runtime } from "./runtime-C95iyVn6.mjs";
2
- import { o as getZodDefault } from "./schema-CIg4GzHQ.mjs";
3
- import { t as schema } from "./schema-dGK6qkfR.mjs";
4
- import { t as createLogger } from "./log-CyKv8hQg.mjs";
5
- import { t as ServerService } from "./server-DB3Eki_G.mjs";
6
- import { n as DB_CONFIG_JSON, r as INTERNAL_DIR, t as ReloaderService } from "./reloader-DJoCB0bC.mjs";
7
- import { a as createBlob, c as makeErrorAck, g as layer$1, h as writeJsonFile, i as cleanupStaleTmpFiles, l as paths, m as validateSession, n as makeRootCache, o as createCollection, p as sendAck, r as broadcastDbUpdate, s as makeAck, t as handleWrite, u as readCollectionItemRange, v as FileSystem } from "./write-9dRFczGJ.mjs";
8
- import { t as traceKyju } from "./trace-DCB7qFzT.mjs";
9
- import { a as createClient, i as dbStringify, n as createRouter, o as createEffectClient, r as dbParse, s as createReplica } from "./transport-BMSzG2-F.mjs";
1
+ import { n as __exportAll } from "./chunk-DsiFFCwN.mjs";
2
+ import { Service, getAppEntrypoint, getPlugins, runtime } from "./runtime.mjs";
3
+ import { o as getZodDefault } from "./schema-Ca7SxXgS.mjs";
4
+ import { schema } from "./schema.mjs";
5
+ import { t as createLogger } from "./log-6rzaCV0I.mjs";
6
+ import { t as ServerService } from "./server-y3PPbh3l.mjs";
7
+ import { i as INTERNAL_DIR, r as DB_CONFIG_JSON, t as ReloaderService } from "./reloader-DzEO8kJr.mjs";
8
+ import { a as createBlob, c as makeErrorAck, g as layer$1, h as writeJsonFile, i as cleanupStaleTmpFiles, l as paths, m as validateSession, n as makeRootCache, o as createCollection, p as sendAck, r as broadcastDbUpdate, s as makeAck, t as handleWrite, u as readCollectionItemRange, v as FileSystem } from "./write-DgIRjo23.mjs";
9
+ import { t as traceKyju } from "./trace-BaVg0rnY.mjs";
10
+ import { a as createClient, i as dbStringify, n as createRouter, o as createEffectClient, r as dbParse, s as createReplica } from "./transport-F2hv_OEm.mjs";
10
11
  import fs from "node:fs";
11
12
  import os from "node:os";
12
13
  import path from "node:path";
@@ -798,6 +799,7 @@ async function resolveDbPath(argv, app) {
798
799
  }
799
800
  //#endregion
800
801
  //#region src/services/http.ts
802
+ var http_exports = /* @__PURE__ */ __exportAll({ HttpService: () => HttpService });
801
803
  const log$3 = createLogger("http");
802
804
  var HttpService = class extends Service {
803
805
  static key = "http";
@@ -932,6 +934,11 @@ var HttpService = class extends Service {
932
934
  runtime.register(HttpService, import.meta);
933
935
  //#endregion
934
936
  //#region src/services/db.ts
937
+ var db_exports = /* @__PURE__ */ __exportAll({
938
+ DbService: () => DbService,
939
+ discoverSections: () => discoverSections,
940
+ resolveManifestModulePath: () => resolveManifestModulePath
941
+ });
935
942
  const log$2 = createLogger("db");
936
943
  /**
937
944
  * Walk up from this file's location until we hit the @zenbujs/core
@@ -1007,7 +1014,7 @@ function resolveConfigPath() {
1007
1014
  * loader-emitted barrel before any service evaluates.
1008
1015
  */
1009
1016
  async function loadAppDbField(configPath) {
1010
- const { loadConfig } = await import("./load-config-CQG4297M.mjs");
1017
+ const { loadConfig } = await import("./load-config-xMf2wxH8.mjs").then((n) => n.n);
1011
1018
  const { resolved } = await loadConfig(path.dirname(configPath));
1012
1019
  return resolved.dbPath;
1013
1020
  }
@@ -1227,6 +1234,7 @@ var DbService = class extends Service {
1227
1234
  runtime.register(DbService, import.meta);
1228
1235
  //#endregion
1229
1236
  //#region src/services/view-registry.ts
1237
+ var view_registry_exports = /* @__PURE__ */ __exportAll({ ViewRegistryService: () => ViewRegistryService });
1230
1238
  const log$1 = createLogger("view-registry");
1231
1239
  var ViewRegistryService = class extends Service {
1232
1240
  static key = "view-registry";
@@ -1319,6 +1327,10 @@ var ViewRegistryService = class extends Service {
1319
1327
  runtime.register(ViewRegistryService, import.meta);
1320
1328
  //#endregion
1321
1329
  //#region src/services/renderer-host.ts
1330
+ var renderer_host_exports = /* @__PURE__ */ __exportAll({
1331
+ APP_RENDERER_RELOADER_ID: () => "app",
1332
+ RendererHostService: () => RendererHostService
1333
+ });
1322
1334
  const log = createLogger("renderer-host");
1323
1335
  async function pathExists(filePath) {
1324
1336
  try {
@@ -1329,18 +1341,18 @@ async function pathExists(filePath) {
1329
1341
  }
1330
1342
  }
1331
1343
  /**
1332
- * The app's renderer root is the directory containing the boot-window HTML
1333
- * file (`uiEntrypoint` in `zenbu.config.ts`). Vite's `root` resolves to that
1334
- * directory, and `index.html` is served from there.
1344
+ * The app's renderer root is the `uiEntrypoint` directory in
1345
+ * `zenbu.config.ts`. Vite's `root` resolves to it, and `index.html` inside
1346
+ * it is served through Vite. `splash.html` (sibling) is loaded raw — see
1347
+ * `setup-gate.spawnSplashWindow`.
1335
1348
  *
1336
1349
  * `vite.config.ts` is picked up from the project root if present (sibling
1337
1350
  * of `zenbu.config.ts`).
1338
1351
  */
1339
1352
  async function resolveRendererRoot() {
1340
- const entrypoint = getAppEntrypoint();
1341
- if (!entrypoint) throw new Error("[renderer-host] no `uiEntrypoint` registered. Set `uiEntrypoint` in zenbu.config.ts before starting the app.");
1342
- const rendererRoot = path.dirname(entrypoint);
1343
- if (!await pathExists(rendererRoot)) throw new Error(`[renderer-host] uiEntrypoint references ${entrypoint} but ${rendererRoot} does not exist.`);
1353
+ const rendererRoot = getAppEntrypoint();
1354
+ if (!rendererRoot) throw new Error("[renderer-host] no `uiEntrypoint` registered. Set `uiEntrypoint` in zenbu.config.ts before starting the app.");
1355
+ if (!await pathExists(rendererRoot)) throw new Error(`[renderer-host] uiEntrypoint directory does not exist: ${rendererRoot}.`);
1344
1356
  const configPath = process.env.ZENBU_CONFIG_PATH;
1345
1357
  const projectDir = configPath ? path.dirname(configPath) : rendererRoot;
1346
1358
  const viteConfig = path.join(projectDir, "vite.config.ts");
@@ -1371,4 +1383,4 @@ var RendererHostService = class extends Service {
1371
1383
  };
1372
1384
  runtime.register(RendererHostService, import.meta);
1373
1385
  //#endregion
1374
- export { resolveManifestModulePath as a, discoverSections as i, ViewRegistryService as n, HttpService as o, DbService as r, RendererHostService as t };
1386
+ export { DbService as a, http_exports as c, view_registry_exports as i, renderer_host_exports as n, db_exports as o, ViewRegistryService as r, HttpService as s, RendererHostService as t };
@@ -1,8 +1,10 @@
1
- import { t as Service, u as runtime } from "./runtime-C95iyVn6.mjs";
2
- import { t as createLogger } from "./log-CyKv8hQg.mjs";
3
- import { o as HttpService } from "./renderer-host-ztaSIOGx.mjs";
4
- import { n as createRpcRouter, r as createServer } from "./src-pELM4_iH.mjs";
1
+ import { n as __exportAll } from "./chunk-DsiFFCwN.mjs";
2
+ import { Service, runtime } from "./runtime.mjs";
3
+ import { t as createLogger } from "./log-6rzaCV0I.mjs";
4
+ import { s as HttpService } from "./renderer-host-Cau9JK0v.mjs";
5
+ import { n as createRpcRouter, r as createServer } from "./src-Cven45mq.mjs";
5
6
  //#region src/services/rpc.ts
7
+ var rpc_exports = /* @__PURE__ */ __exportAll({ RpcService: () => RpcService });
6
8
  const log = createLogger("rpc");
7
9
  var RpcService = class extends Service {
8
10
  static key = "rpc";
@@ -68,4 +70,4 @@ var RpcService = class extends Service {
68
70
  };
69
71
  runtime.register(RpcService, import.meta);
70
72
  //#endregion
71
- export { RpcService as t };
73
+ export { rpc_exports as n, RpcService as t };
package/dist/rpc.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { n as EventProxy, r as RouterProxy, t as connectRpc } from "./index-CE0iPntP.mjs";
1
+ import { n as EventProxy, r as RouterProxy, t as connectRpc } from "./index-C-ALz_SH.mjs";
2
2
  export { type EventProxy, type RouterProxy, connectRpc };
package/dist/rpc.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { t as connectRpc } from "./src-pELM4_iH.mjs";
1
+ import { t as connectRpc } from "./src-Cven45mq.mjs";
2
2
  export { connectRpc };
@@ -120,6 +120,19 @@ interface PluginRecord {
120
120
  eventsPath?: string;
121
121
  icons?: Record<string, string>;
122
122
  }
123
+ /**
124
+ * Live snapshot of the resolved Zenbu config. Returned by `getConfig()` and
125
+ * delivered to `subscribeConfig` callbacks. Re-emitted whenever the loader
126
+ * regenerates the plugin barrel — i.e. on every edit to `zenbu.config.ts`
127
+ * or any imported `zenbu.plugin.ts`.
128
+ */
129
+ interface ConfigSnapshot {
130
+ plugins: PluginRecord[];
131
+ /** Absolute path of the renderer entrypoint directory. */
132
+ appEntrypoint: string | null;
133
+ /** Absolute path of `splash.html` inside the entrypoint dir. */
134
+ splashPath: string | null;
135
+ }
123
136
  /**
124
137
  * Register a plugin's resolved manifest. Idempotent — replaces any existing
125
138
  * entry for the same `name`. Called by the loader-emitted barrel; user code
@@ -139,11 +152,30 @@ declare function replacePlugins(records: PluginRecord[]): void;
139
152
  declare function getPlugins(): PluginRecord[];
140
153
  declare function getPlugin(name: string): PluginRecord | undefined;
141
154
  /**
142
- * Set the boot-window HTML path. Called once by the loader-emitted barrel.
143
- * Consumers (`view-registry`, `vite-plugins`) ask for it via
144
- * `getAppEntrypoint()`.
155
+ * Set the renderer entrypoint directory + the absolute path to splash.html
156
+ * inside it. Called once by the loader-emitted barrel. Consumers
157
+ * (`view-registry`, `vite-plugins`, `setup-gate`'s splash window) read
158
+ * via `getAppEntrypoint()` / `getSplashPath()`.
145
159
  */
146
- declare function registerAppEntrypoint(htmlPath: string): void;
160
+ declare function registerAppEntrypoint(rendererDir: string, splashPath: string): void;
147
161
  declare function getAppEntrypoint(): string | null;
162
+ declare function getSplashPath(): string | null;
163
+ /**
164
+ * Snapshot of the current resolved config — plugins + entrypoints. Cheap;
165
+ * just walks the in-memory registry. The returned object is a fresh copy,
166
+ * safe to retain or pass through serialization boundaries.
167
+ */
168
+ declare function getConfig(): ConfigSnapshot;
169
+ /**
170
+ * Subscribe to config changes. The callback fires:
171
+ * - immediately on subscription (with the current snapshot),
172
+ * - after each `replacePlugins(...)` / `registerPlugin(...)` /
173
+ * `registerAppEntrypoint(...)` call — i.e. every time the loader
174
+ * regenerates the plugin barrel after a `zenbu.config.ts` edit.
175
+ *
176
+ * Callback exceptions are logged and swallowed so one buggy subscriber
177
+ * can't break others. The returned function unsubscribes.
178
+ */
179
+ declare function subscribeConfig(callback: (snapshot: ConfigSnapshot) => void): () => void;
148
180
  //#endregion
149
- export { getAppEntrypoint as a, optional as c, replacePlugins as d, runtime as f, ServiceRuntime as i, registerAppEntrypoint as l, unregisterPlugin as m, PluginRecord as n, getPlugin as o, serviceWithDeps as p, Service as r, getPlugins as s, CleanupReason as t, registerPlugin as u };
181
+ export { subscribeConfig as _, ServiceRuntime as a, getPlugin as c, optional as d, registerAppEntrypoint as f, serviceWithDeps as g, runtime as h, Service as i, getPlugins as l, replacePlugins as m, ConfigSnapshot as n, getAppEntrypoint as o, registerPlugin as p, PluginRecord as r, getConfig as s, CleanupReason as t, getSplashPath as u, unregisterPlugin as v };
@@ -1,2 +1,2 @@
1
- import { a as getAppEntrypoint, c as optional, d as replacePlugins, f as runtime, i as ServiceRuntime, l as registerAppEntrypoint, m as unregisterPlugin, n as PluginRecord, o as getPlugin, p as serviceWithDeps, r as Service, s as getPlugins, t as CleanupReason, u as registerPlugin } from "./runtime-CsiDppGF.mjs";
2
- export { CleanupReason, PluginRecord, Service, ServiceRuntime, getAppEntrypoint, getPlugin, getPlugins, optional, registerAppEntrypoint, registerPlugin, replacePlugins, runtime, serviceWithDeps, unregisterPlugin };
1
+ import { _ as subscribeConfig, a as ServiceRuntime, c as getPlugin, d as optional, f as registerAppEntrypoint, g as serviceWithDeps, h as runtime, i as Service, l as getPlugins, m as replacePlugins, n as ConfigSnapshot, o as getAppEntrypoint, p as registerPlugin, r as PluginRecord, s as getConfig, t as CleanupReason, u as getSplashPath, v as unregisterPlugin } from "./runtime-pCeVzj--.mjs";
2
+ export { CleanupReason, ConfigSnapshot, PluginRecord, Service, ServiceRuntime, getAppEntrypoint, getConfig, getPlugin, getPlugins, getSplashPath, optional, registerAppEntrypoint, registerPlugin, replacePlugins, runtime, serviceWithDeps, subscribeConfig, unregisterPlugin };