@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.
- package/dist/{advice-config-BLXjqjGN.mjs → advice-config-QYB2qEd_.mjs} +12 -2
- package/dist/advice.mjs +1 -1
- package/dist/{base-window-D8CpxMU3.mjs → base-window-BbFRRhKP.mjs} +9 -4
- package/dist/{build-electron-C3Beey84.mjs → build-electron-CNJ0dLND.mjs} +1 -1
- package/dist/{build-source-BvC4bPqH.mjs → build-source-C2puqEVr.mjs} +2 -2
- package/dist/chunk-DsiFFCwN.mjs +16 -0
- package/dist/cli/bin.mjs +7 -7
- package/dist/cli/build.d.mts +1 -1
- package/dist/cli/build.mjs +2 -2
- package/dist/cli/resolve-config.mjs +3 -2
- package/dist/{cli-F0B4dvSg.mjs → cli-C3R1LBMY.mjs} +4 -4
- package/dist/{config-BlRXeUXx.mjs → config-DXRCDUxG.mjs} +1 -1
- package/dist/config.d.mts +3 -2
- package/dist/config.mjs +4 -3
- package/dist/{db-Cd5ETuPG.mjs → db-xjvahRFJ.mjs} +2 -2
- package/dist/db.d.mts +1 -1
- package/dist/db.mjs +2 -2
- package/dist/env-bootstrap.d.mts +1 -1
- package/dist/env-bootstrap.mjs +52 -1
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +4 -4
- package/dist/{link-BJmsKgPa.mjs → link-c0_aLWQ3.mjs} +1 -1
- package/dist/{load-config-BG2tPIfF.mjs → load-config-xMf2wxH8.mjs} +18 -3
- package/dist/loaders/zenbu.d.mts +1 -0
- package/dist/loaders/zenbu.mjs +7 -87
- package/dist/{monorepo-DCruz9Jx.mjs → monorepo-3avKJwzJ.mjs} +3 -0
- package/dist/node-loader.mjs +1 -1
- package/dist/{publish-source-34Hn9zb0.mjs → publish-source-Dill72NS.mjs} +2 -2
- package/dist/react.d.mts +3 -3
- package/dist/react.mjs +2 -2
- package/dist/{registry-CioEYLI5.d.mts → registry-eX6e2oql.d.mts} +1 -1
- package/dist/registry.d.mts +1 -1
- package/dist/{reloader-DJoCB0bC.mjs → reloader-DzEO8kJr.mjs} +6 -4
- package/dist/{renderer-host-ztaSIOGx.mjs → renderer-host-Cau9JK0v.mjs} +30 -18
- package/dist/{rpc-CsgWnlZx.mjs → rpc-JfGv-Wuw.mjs} +7 -5
- package/dist/rpc.d.mts +1 -1
- package/dist/rpc.mjs +1 -1
- package/dist/{runtime-CsiDppGF.d.mts → runtime-pCeVzj--.d.mts} +37 -5
- package/dist/runtime.d.mts +2 -2
- package/dist/runtime.mjs +522 -2
- package/dist/{schema-DvT61x2_.d.mts → schema-Dl85YjXW.d.mts} +1 -1
- package/dist/schema.d.mts +1 -1
- package/dist/schema.mjs +27 -1
- package/dist/{server-DB3Eki_G.mjs → server-y3PPbh3l.mjs} +5 -3
- package/dist/services/default.mjs +10 -10
- package/dist/services/index.d.mts +8 -4
- package/dist/services/index.mjs +6 -6
- package/dist/setup-gate.d.mts +1 -1
- package/dist/setup-gate.mjs +248 -1
- package/dist/{transform-DJH3vN4b.mjs → transform-CmFYPmt8.mjs} +1 -1
- package/dist/{transforms-EVd5Fgyk.d.mts → transforms-CuTODvDx.d.mts} +10 -1
- package/dist/{transport-BMSzG2-F.mjs → transport-F2hv_OEm.mjs} +1 -1
- package/dist/{vite-plugins-t4MlFcz3.mjs → vite-plugins-Do7liKi_.mjs} +3 -3
- package/dist/vite.mjs +1 -1
- package/dist/{window-DUvMTons.mjs → window-o2NGUsIb.mjs} +10 -7
- package/dist/{write-9dRFczGJ.mjs → write-DgIRjo23.mjs} +1 -1
- package/package.json +4 -4
- package/dist/advice-config-D6K_a7e9.mjs +0 -2
- package/dist/base-window-OXg2KSyP.mjs +0 -2
- package/dist/chunk-Dm34NbLt.mjs +0 -6
- package/dist/config-Ch1FreWU.mjs +0 -2
- package/dist/db-Bz_CDIWg.mjs +0 -2
- package/dist/env-bootstrap-rj7I-59x.mjs +0 -53
- package/dist/http-B36qtsm0.mjs +0 -2
- package/dist/load-config-CQG4297M.mjs +0 -2
- package/dist/reloader-FeHKV2jd.mjs +0 -2
- package/dist/renderer-host-BQpS0ZM2.mjs +0 -2
- package/dist/rpc-D_s7-WZe.mjs +0 -2
- package/dist/runtime-C95iyVn6.mjs +0 -461
- package/dist/schema-dGK6qkfR.mjs +0 -28
- package/dist/server-CgzQOPSW.mjs +0 -2
- package/dist/setup-gate-D8XfYY52.mjs +0 -140
- package/dist/view-registry-2zePxTEg.mjs +0 -2
- package/dist/window-S3TlTXlK.mjs +0 -2
- /package/dist/{build-config-BwnnfrN-.mjs → build-config-C3a-o3_B.mjs} +0 -0
- /package/dist/{dev-DLutFPyo.mjs → dev-Dazhu66l.mjs} +0 -0
- /package/dist/{env-bootstrap-uCKbw2q8.d.mts → env-bootstrap-DW2hVhSO.d.mts} +0 -0
- /package/dist/{index-CE0iPntP.d.mts → index-C-ALz_SH.d.mts} +0 -0
- /package/dist/{index-CKKoxA9V.d.mts → index-ClXLQ1fw.d.mts} +0 -0
- /package/dist/{index-UK58xuoR.d.mts → index-M_lSNBrq.d.mts} +0 -0
- /package/dist/{log-CyKv8hQg.mjs → log-6rzaCV0I.mjs} +0 -0
- /package/dist/{mirror-sync-EiWvdzTJ.mjs → mirror-sync-PDzxhf1w.mjs} +0 -0
- /package/dist/{node-CvZnTx53.mjs → node-_8xShqxr.mjs} +0 -0
- /package/dist/{schema-CIg4GzHQ.mjs → schema-Ca7SxXgS.mjs} +0 -0
- /package/dist/{setup-gate-D62nX5lk.d.mts → setup-gate-Dcy8gGPJ.d.mts} +0 -0
- /package/dist/{src-pELM4_iH.mjs → src-Cven45mq.mjs} +0 -0
- /package/dist/{trace-DCB7qFzT.mjs → trace-BaVg0rnY.mjs} +0 -0
- /package/dist/{transforms-DVoy8dCu.mjs → transforms-htxfTwsY.mjs} +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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 {
|
|
166
|
+
export { INTERNAL_DIR as i, reloader_exports as n, DB_CONFIG_JSON as r, ReloaderService as t };
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { t as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { t as
|
|
9
|
-
import {
|
|
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-
|
|
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
|
|
1333
|
-
*
|
|
1334
|
-
*
|
|
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
|
|
1341
|
-
if (!
|
|
1342
|
-
|
|
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 {
|
|
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 {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
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-
|
|
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-
|
|
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
|
|
143
|
-
*
|
|
144
|
-
* `
|
|
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(
|
|
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 {
|
|
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 };
|
package/dist/runtime.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
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 };
|