@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,7 +1,17 @@
1
- import { a as getPlugins, u as runtime } from "./runtime-C95iyVn6.mjs";
1
+ import { n as __exportAll } from "./chunk-DsiFFCwN.mjs";
2
+ import { getPlugins, runtime } from "./runtime.mjs";
2
3
  import path from "node:path";
3
4
  import { fileURLToPath } from "node:url";
4
5
  //#region src/services/advice-config.ts
6
+ var advice_config_exports = /* @__PURE__ */ __exportAll({
7
+ getAdvice: () => getAdvice,
8
+ getAllAdviceScopes: () => getAllAdviceScopes,
9
+ getAllContentScriptPaths: () => getAllContentScriptPaths,
10
+ getAllScopes: () => getAllScopes,
11
+ getContentScripts: () => getContentScripts,
12
+ registerAdvice: () => registerAdvice,
13
+ registerContentScript: () => registerContentScript
14
+ });
5
15
  /**
6
16
  * Find the plugin whose `dir` contains the file at `metaUrl`. The runtime
7
17
  * plugin registry (populated by the loader-emitted barrel) is the source
@@ -140,4 +150,4 @@ function getAllScopes() {
140
150
  return [...scopes];
141
151
  }
142
152
  //#endregion
143
- export { getContentScripts as a, getAllScopes as i, getAllAdviceScopes as n, registerAdvice as o, getAllContentScriptPaths as r, registerContentScript as s, getAdvice as t };
153
+ export { getAllScopes as a, registerContentScript as c, getAllContentScriptPaths as i, getAdvice as n, getContentScripts as o, getAllAdviceScopes as r, registerAdvice as s, advice_config_exports as t };
package/dist/advice.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { a as getContentScripts, i as getAllScopes, n as getAllAdviceScopes, o as registerAdvice, r as getAllContentScriptPaths, s as registerContentScript, t as getAdvice } from "./advice-config-BLXjqjGN.mjs";
1
+ import { a as getAllScopes, c as registerContentScript, i as getAllContentScriptPaths, n as getAdvice, o as getContentScripts, r as getAllAdviceScopes, s as registerAdvice } from "./advice-config-QYB2qEd_.mjs";
2
2
  export { getAdvice, getAllAdviceScopes, getAllContentScriptPaths, getAllScopes, getContentScripts, registerAdvice, registerContentScript };
@@ -1,9 +1,14 @@
1
- import { t as Service, u as runtime } from "./runtime-C95iyVn6.mjs";
2
- import { t as createLogger } from "./log-CyKv8hQg.mjs";
3
- import { r as DbService } from "./renderer-host-ztaSIOGx.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 DbService } from "./renderer-host-Cau9JK0v.mjs";
4
5
  import { nanoid } from "nanoid";
5
6
  import { BaseWindow } from "electron";
6
7
  //#region src/services/base-window.ts
8
+ var base_window_exports = /* @__PURE__ */ __exportAll({
9
+ BaseWindowService: () => BaseWindowService,
10
+ MAIN_WINDOW_ID: () => MAIN_WINDOW_ID
11
+ });
7
12
  const log = createLogger("base-window");
8
13
  const MAIN_WINDOW_ID = "main";
9
14
  var BaseWindowService = class extends Service {
@@ -91,4 +96,4 @@ var BaseWindowService = class extends Service {
91
96
  };
92
97
  runtime.register(BaseWindowService, import.meta);
93
98
  //#endregion
94
- export { MAIN_WINDOW_ID as n, BaseWindowService as t };
99
+ export { MAIN_WINDOW_ID as n, base_window_exports as r, BaseWindowService as t };
@@ -1,4 +1,4 @@
1
- import { n as loadConfig } from "./load-config-BG2tPIfF.mjs";
1
+ import { t as loadConfig } from "./load-config-xMf2wxH8.mjs";
2
2
  import { createRequire } from "node:module";
3
3
  import fs from "node:fs";
4
4
  import os from "node:os";
@@ -1,5 +1,5 @@
1
- import { n as loadConfig } from "./load-config-BG2tPIfF.mjs";
2
- import { t as hashDir } from "./mirror-sync-EiWvdzTJ.mjs";
1
+ import { t as loadConfig } from "./load-config-xMf2wxH8.mjs";
2
+ import { t as hashDir } from "./mirror-sync-PDzxhf1w.mjs";
3
3
  import fs from "node:fs";
4
4
  import path from "node:path";
5
5
  import { execFileSync } from "node:child_process";
@@ -0,0 +1,16 @@
1
+ import { createRequire } from "node:module";
2
+ //#region \0rolldown/runtime.js
3
+ var __defProp = Object.defineProperty;
4
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
5
+ var __exportAll = (all, no_symbols) => {
6
+ let target = {};
7
+ for (var name in all) __defProp(target, name, {
8
+ get: all[name],
9
+ enumerable: true
10
+ });
11
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
12
+ return target;
13
+ };
14
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
15
+ //#endregion
16
+ export { __exportAll as n, __require as r, __commonJSMin as t };
package/dist/cli/bin.mjs CHANGED
@@ -41,37 +41,37 @@ async function main() {
41
41
  const rest = argv.slice(1);
42
42
  switch (first) {
43
43
  case "dev": {
44
- const { runDev } = await import("../dev-DLutFPyo.mjs");
44
+ const { runDev } = await import("../dev-Dazhu66l.mjs");
45
45
  await runDev(rest);
46
46
  return;
47
47
  }
48
48
  case "build:source": {
49
- const { runBuildSource } = await import("../build-source-BvC4bPqH.mjs");
49
+ const { runBuildSource } = await import("../build-source-C2puqEVr.mjs");
50
50
  await runBuildSource(rest);
51
51
  return;
52
52
  }
53
53
  case "build:electron": {
54
- const { runBuildElectron } = await import("../build-electron-C3Beey84.mjs");
54
+ const { runBuildElectron } = await import("../build-electron-CNJ0dLND.mjs");
55
55
  await runBuildElectron(rest);
56
56
  return;
57
57
  }
58
58
  case "publish:source": {
59
- const { runPublishSource } = await import("../publish-source-34Hn9zb0.mjs");
59
+ const { runPublishSource } = await import("../publish-source-Dill72NS.mjs");
60
60
  await runPublishSource(rest);
61
61
  return;
62
62
  }
63
63
  case "link": {
64
- const { runLink } = await import("../link-BJmsKgPa.mjs");
64
+ const { runLink } = await import("../link-c0_aLWQ3.mjs");
65
65
  await runLink(rest);
66
66
  return;
67
67
  }
68
68
  case "monorepo": {
69
- const { runMonorepo } = await import("../monorepo-DCruz9Jx.mjs");
69
+ const { runMonorepo } = await import("../monorepo-3avKJwzJ.mjs");
70
70
  await runMonorepo(rest);
71
71
  return;
72
72
  }
73
73
  case "db": {
74
- const { runDb } = await import("../db-Cd5ETuPG.mjs");
74
+ const { runDb } = await import("../db-xjvahRFJ.mjs");
75
75
  await runDb(rest);
76
76
  return;
77
77
  }
@@ -1,2 +1,2 @@
1
- import { _ as resolveBuildConfig, c as ResolvedBuildConfig, d as Transform, f as TransformInput, i as BundleConfig, m as defineBuildConfig, n as stripIfDisabled, o as MirrorConfig, p as TransformOutput, r as BuildConfig, t as dropFiles } from "../transforms-EVd5Fgyk.mjs";
1
+ import { _ as resolveBuildConfig, c as ResolvedBuildConfig, d as Transform, f as TransformInput, i as BundleConfig, m as defineBuildConfig, n as stripIfDisabled, o as MirrorConfig, p as TransformOutput, r as BuildConfig, t as dropFiles } from "../transforms-CuTODvDx.mjs";
2
2
  export { type BuildConfig, type BundleConfig, type MirrorConfig, type ResolvedBuildConfig, type Transform, type TransformInput, type TransformOutput, defineBuildConfig, dropFiles, resolveBuildConfig, stripIfDisabled };
@@ -1,3 +1,3 @@
1
- import { i as resolveBuildConfig, t as defineBuildConfig } from "../build-config-BwnnfrN-.mjs";
2
- import { n as stripIfDisabled, t as dropFiles } from "../transforms-DVoy8dCu.mjs";
1
+ import { i as resolveBuildConfig, t as defineBuildConfig } from "../build-config-C3a-o3_B.mjs";
2
+ import { n as stripIfDisabled, t as dropFiles } from "../transforms-htxfTwsY.mjs";
3
3
  export { defineBuildConfig, dropFiles, resolveBuildConfig, stripIfDisabled };
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { n as loadConfig } from "../load-config-BG2tPIfF.mjs";
2
+ import { t as loadConfig } from "../load-config-xMf2wxH8.mjs";
3
3
  import { register } from "tsx/esm/api";
4
4
  //#region src/cli/resolve-config.ts
5
5
  async function main() {
@@ -21,7 +21,8 @@ async function main() {
21
21
  eventsPath: p.eventsPath,
22
22
  icons: p.icons
23
23
  })),
24
- appEntrypoint: resolved.uiEntrypointPath
24
+ appEntrypoint: resolved.uiEntrypointPath,
25
+ splashPath: resolved.splashPath
25
26
  };
26
27
  process.stdout.write(JSON.stringify({
27
28
  payload,
@@ -1,6 +1,6 @@
1
- import { o as getZodDefault, t as NO_DEFAULT } from "./schema-CIg4GzHQ.mjs";
2
- import { _ as handleErrnoException, d as readJsonFile, f as readJsonlFile, g as layer$7, l as paths, n as makeRootCache, t as handleWrite, v as FileSystem, y as BadArgument } from "./write-9dRFczGJ.mjs";
3
- import { i as loadSchema } from "./config-BlRXeUXx.mjs";
1
+ import { o as getZodDefault, t as NO_DEFAULT } from "./schema-Ca7SxXgS.mjs";
2
+ import { _ as handleErrnoException, d as readJsonFile, f as readJsonlFile, g as layer$7, l as paths, n as makeRootCache, t as handleWrite, v as FileSystem, y as BadArgument } from "./write-DgIRjo23.mjs";
3
+ import { loadSchema } from "./config-DXRCDUxG.mjs";
4
4
  import fs from "node:fs";
5
5
  import * as NodePath from "node:path";
6
6
  import path from "node:path";
@@ -8030,7 +8030,7 @@ async function run(argv) {
8030
8030
  process.exit(args.help ? 0 : 1);
8031
8031
  }
8032
8032
  if (args.command === "generate") {
8033
- const { findConfigFile, loadConfig } = await import("./config-Ch1FreWU.mjs");
8033
+ const { findConfigFile, loadConfig } = await import("./config-DXRCDUxG.mjs");
8034
8034
  const resolved = await loadConfig(args.config ?? findConfigFile(process.cwd()));
8035
8035
  await generateMigration({
8036
8036
  schemaPath: resolved.schemaPath,
@@ -56,4 +56,4 @@ function ensureTsxRegistered() {
56
56
  return tsxRegistered;
57
57
  }
58
58
  //#endregion
59
- export { loadSchema as i, loadConfig as n, loadModule as r, findConfigFile as t };
59
+ export { findConfigFile, loadConfig, loadSchema };
package/dist/config.d.mts CHANGED
@@ -1,2 +1,3 @@
1
- import { a as Config, c as ResolvedBuildConfig, d as Transform, f as TransformInput, g as definePlugin, h as defineConfig, i as BundleConfig, l as ResolvedConfig, m as defineBuildConfig, n as stripIfDisabled, o as MirrorConfig, p as TransformOutput, r as BuildConfig, s as Plugin, t as dropFiles, u as ResolvedPlugin } from "./transforms-EVd5Fgyk.mjs";
2
- export { type BuildConfig, type BundleConfig, type Config, type MirrorConfig, type Plugin, type ResolvedBuildConfig, type ResolvedConfig, type ResolvedPlugin, type Transform, type TransformInput, type TransformOutput, defineBuildConfig, defineConfig, definePlugin, dropFiles, stripIfDisabled };
1
+ import { a as Config, c as ResolvedBuildConfig, d as Transform, f as TransformInput, g as definePlugin, h as defineConfig, i as BundleConfig, l as ResolvedConfig, m as defineBuildConfig, n as stripIfDisabled, o as MirrorConfig, p as TransformOutput, r as BuildConfig, s as Plugin, t as dropFiles, u as ResolvedPlugin } from "./transforms-CuTODvDx.mjs";
2
+ import { _ as subscribeConfig, c as getPlugin, l as getPlugins, n as ConfigSnapshot, o as getAppEntrypoint, r as PluginRecord, s as getConfig, u as getSplashPath } from "./runtime-pCeVzj--.mjs";
3
+ export { type BuildConfig, type BundleConfig, type Config, type ConfigSnapshot, type MirrorConfig, type Plugin, type PluginRecord, type ResolvedBuildConfig, type ResolvedConfig, type ResolvedPlugin, type Transform, type TransformInput, type TransformOutput, defineBuildConfig, defineConfig, definePlugin, dropFiles, getAppEntrypoint, getConfig, getPlugin, getPlugins, getSplashPath, stripIfDisabled, subscribeConfig };
package/dist/config.mjs CHANGED
@@ -1,3 +1,4 @@
1
- import { n as defineConfig, r as definePlugin, t as defineBuildConfig } from "./build-config-BwnnfrN-.mjs";
2
- import { n as stripIfDisabled, t as dropFiles } from "./transforms-DVoy8dCu.mjs";
3
- export { defineBuildConfig, defineConfig, definePlugin, dropFiles, stripIfDisabled };
1
+ import { getAppEntrypoint, getConfig, getPlugin, getPlugins, getSplashPath, subscribeConfig } from "./runtime.mjs";
2
+ import { n as defineConfig, r as definePlugin, t as defineBuildConfig } from "./build-config-C3a-o3_B.mjs";
3
+ import { n as stripIfDisabled, t as dropFiles } from "./transforms-htxfTwsY.mjs";
4
+ export { defineBuildConfig, defineConfig, definePlugin, dropFiles, getAppEntrypoint, getConfig, getPlugin, getPlugins, getSplashPath, stripIfDisabled, subscribeConfig };
@@ -469,7 +469,7 @@ function parseGenerateArgs(argv) {
469
469
  }
470
470
  async function runGenerate(argv) {
471
471
  const flags = parseGenerateArgs(argv);
472
- const { generateMigration } = await import("./cli-F0B4dvSg.mjs");
472
+ const { generateMigration } = await import("./cli-C3R1LBMY.mjs");
473
473
  if (flags.schema || flags.migrationsOut) {
474
474
  if (!flags.schema || !flags.migrationsOut) {
475
475
  console.error("zen db generate: --schema and --migrations must be passed together.");
@@ -495,7 +495,7 @@ async function runGenerate(argv) {
495
495
  console.error(" --schema <path> --migrations <path> directly.");
496
496
  process.exit(1);
497
497
  }
498
- const { loadConfig } = await import("./load-config-CQG4297M.mjs");
498
+ const { loadConfig } = await import("./load-config-xMf2wxH8.mjs").then((n) => n.n);
499
499
  const { resolved } = await loadConfig(projectDir);
500
500
  const cwd = path.resolve(process.cwd());
501
501
  let bestMatch = null;
package/dist/db.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { S as createSchema, _ as InferSchema$1, a as dbStringify, b as blob, f as CollectionRefBrand$1, g as InferRoot$1, i as dbParse, n as connectReplica, o as ClientProxy, p as CollectionRefValue$1, s as CollectionNode$1, v as Schema$1, x as collection, y as SchemaShape$1 } from "./index-UK58xuoR.mjs";
1
+ import { S as createSchema, _ as InferSchema$1, a as dbStringify, b as blob, f as CollectionRefBrand$1, g as InferRoot$1, i as dbParse, n as connectReplica, o as ClientProxy, p as CollectionRefValue$1, s as CollectionNode$1, v as Schema$1, x as collection, y as SchemaShape$1 } from "./index-M_lSNBrq.mjs";
2
2
  import { z as z$1 } from "zod";
3
3
 
4
4
  //#region src/db.d.ts
package/dist/db.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { i as createSchema, n as blob, r as collection } from "./schema-CIg4GzHQ.mjs";
2
- import { i as dbStringify, r as dbParse, t as connectReplica } from "./transport-BMSzG2-F.mjs";
1
+ import { i as createSchema, n as blob, r as collection } from "./schema-Ca7SxXgS.mjs";
2
+ import { i as dbStringify, r as dbParse, t as connectReplica } from "./transport-F2hv_OEm.mjs";
3
3
  import { z as z$1 } from "zod";
4
4
  //#region src/db.ts
5
5
  /**
@@ -1,2 +1,2 @@
1
- import { t as bootstrapEnv } from "./env-bootstrap-uCKbw2q8.mjs";
1
+ import { t as bootstrapEnv } from "./env-bootstrap-DW2hVhSO.mjs";
2
2
  export { bootstrapEnv };
@@ -1,2 +1,53 @@
1
- import { t as bootstrapEnv } from "./env-bootstrap-rj7I-59x.mjs";
1
+ import fs from "node:fs";
2
+ import os from "node:os";
3
+ import path from "node:path";
4
+ //#region src/env-bootstrap.ts
5
+ const internalDir = path.join(os.homedir(), ".zenbu", ".internal");
6
+ const pathsJson = path.join(internalDir, "paths.json");
7
+ function userCacheRoot() {
8
+ if (process.platform === "darwin") return path.join(os.homedir(), "Library", "Caches");
9
+ if (process.platform === "win32") return process.env.LOCALAPPDATA ?? path.join(os.homedir(), "AppData", "Local");
10
+ return process.env.XDG_CACHE_HOME ?? path.join(os.homedir(), ".cache");
11
+ }
12
+ function computePaths() {
13
+ const cacheRoot = path.join(userCacheRoot(), "Zenbu");
14
+ const binDir = path.join(cacheRoot, "bin");
15
+ return {
16
+ cacheRoot,
17
+ binDir,
18
+ bunInstall: path.join(cacheRoot, "bun"),
19
+ bunPath: path.join(binDir, "bun"),
20
+ pnpmHome: path.join(cacheRoot, "pnpm"),
21
+ pnpmPath: path.join(binDir, "pnpm"),
22
+ gitPath: path.join(binDir, "git"),
23
+ writtenAt: Date.now()
24
+ };
25
+ }
26
+ function bootstrapEnv() {
27
+ const paths = computePaths();
28
+ try {
29
+ fs.mkdirSync(paths.binDir, { recursive: true });
30
+ } catch {}
31
+ const toolchainReady = fs.existsSync(paths.bunPath) && fs.existsSync(paths.pnpmPath);
32
+ if (toolchainReady) {
33
+ process.env.BUN_INSTALL ??= paths.bunInstall;
34
+ process.env.PNPM_HOME ??= paths.pnpmHome;
35
+ }
36
+ const pathParts = toolchainReady ? [paths.binDir, process.env.PATH ?? ""] : [process.env.PATH ?? ""];
37
+ const seen = /* @__PURE__ */ new Set();
38
+ process.env.PATH = pathParts.flatMap((part) => part.split(path.delimiter)).filter((part) => {
39
+ if (!part || seen.has(part)) return false;
40
+ seen.add(part);
41
+ return true;
42
+ }).join(path.delimiter);
43
+ try {
44
+ fs.mkdirSync(internalDir, { recursive: true });
45
+ fs.writeFileSync(pathsJson, JSON.stringify(paths, null, 2));
46
+ } catch {}
47
+ return {
48
+ paths,
49
+ needsToolchainDownload: !toolchainReady
50
+ };
51
+ }
52
+ //#endregion
2
53
  export { bootstrapEnv };
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { t as bootstrapEnv } from "./env-bootstrap-uCKbw2q8.mjs";
2
- import { t as setupGate } from "./setup-gate-D62nX5lk.mjs";
3
- import { c as optional, f as runtime, i as ServiceRuntime, p as serviceWithDeps, r as Service, t as CleanupReason } from "./runtime-CsiDppGF.mjs";
4
- import { n as SchemaRoot, o as schema, t as CoreSchema } from "./schema-DvT61x2_.mjs";
5
- import { i as CoreServiceRouter, n as CoreEvents, r as CorePreloads, t as CoreDbSections } from "./registry-CioEYLI5.mjs";
1
+ import { a as ServiceRuntime, d as optional, g as serviceWithDeps, h as runtime, i as Service, t as CleanupReason } from "./runtime-pCeVzj--.mjs";
2
+ import { t as bootstrapEnv } from "./env-bootstrap-DW2hVhSO.mjs";
3
+ import { t as setupGate } from "./setup-gate-Dcy8gGPJ.mjs";
4
+ import { n as SchemaRoot, o as schema, t as CoreSchema } from "./schema-Dl85YjXW.mjs";
5
+ import { i as CoreServiceRouter, n as CoreEvents, r as CorePreloads, t as CoreDbSections } from "./registry-eX6e2oql.mjs";
6
6
  export { CleanupReason, CoreDbSections, CoreEvents, CorePreloads, CoreSchema, SchemaRoot as CoreSchemaRoot, CoreServiceRouter, Service, ServiceRuntime, bootstrapEnv, schema as coreSchema, optional, runtime, serviceWithDeps, setupGate };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { t as bootstrapEnv } from "./env-bootstrap-rj7I-59x.mjs";
2
- import { t as setupGate } from "./setup-gate-D8XfYY52.mjs";
3
- import { d as serviceWithDeps, n as ServiceRuntime, o as optional, t as Service, u as runtime } from "./runtime-C95iyVn6.mjs";
4
- import { t as schema } from "./schema-dGK6qkfR.mjs";
1
+ import { bootstrapEnv } from "./env-bootstrap.mjs";
2
+ import { setupGate } from "./setup-gate.mjs";
3
+ import { Service, ServiceRuntime, optional, runtime, serviceWithDeps } from "./runtime.mjs";
4
+ import { schema } from "./schema.mjs";
5
5
  export { Service, ServiceRuntime, bootstrapEnv, schema as coreSchema, optional, runtime, serviceWithDeps, setupGate };
@@ -1,4 +1,4 @@
1
- import { n as loadConfig } from "./load-config-BG2tPIfF.mjs";
1
+ import { t as loadConfig } from "./load-config-xMf2wxH8.mjs";
2
2
  import fs from "node:fs";
3
3
  import path from "node:path";
4
4
  //#region src/cli/commands/link.ts
@@ -1,9 +1,14 @@
1
- import { i as resolveBuildConfig } from "./build-config-BwnnfrN-.mjs";
1
+ import { n as __exportAll } from "./chunk-DsiFFCwN.mjs";
2
+ import { i as resolveBuildConfig } from "./build-config-C3a-o3_B.mjs";
2
3
  import { createRequire } from "node:module";
3
4
  import fs from "node:fs";
4
5
  import path from "node:path";
5
6
  import { pathToFileURL } from "node:url";
6
7
  //#region src/cli/lib/load-config.ts
8
+ var load_config_exports = /* @__PURE__ */ __exportAll({
9
+ findConfigPath: () => findConfigPath,
10
+ loadConfig: () => loadConfig
11
+ });
7
12
  const localRequire = createRequire(import.meta.url);
8
13
  const CONFIG_NAMES = [
9
14
  "zenbu.config.ts",
@@ -95,11 +100,20 @@ async function loadConfig(projectDir) {
95
100
  const config = await importFresh(configPath);
96
101
  if (!config || typeof config !== "object") throw new Error(`${configPath} default export is not a Config object.`);
97
102
  if (typeof config.db !== "string" || config.db.length === 0) throw new Error(`${configPath}: missing required \`db\` field (path to the database directory).`);
98
- if (typeof config.uiEntrypoint !== "string" || config.uiEntrypoint.length === 0) throw new Error(`${configPath}: missing required \`uiEntrypoint\` field (path to the boot-window HTML file).`);
103
+ if (typeof config.uiEntrypoint !== "string" || config.uiEntrypoint.length === 0) throw new Error(`${configPath}: missing required \`uiEntrypoint\` field (directory holding index.html + splash.html).`);
99
104
  if (!Array.isArray(config.plugins)) throw new Error(`${configPath}: \`plugins\` must be an array.`);
100
105
  const configDir = path.dirname(configPath);
101
106
  const dbPath = path.isAbsolute(config.db) ? config.db : path.resolve(configDir, config.db);
102
107
  const uiEntrypointPath = path.isAbsolute(config.uiEntrypoint) ? config.uiEntrypoint : path.resolve(configDir, config.uiEntrypoint);
108
+ if (!(() => {
109
+ try {
110
+ return fs.statSync(uiEntrypointPath);
111
+ } catch {
112
+ return null;
113
+ }
114
+ })()?.isDirectory()) throw new Error(`${configPath}: uiEntrypoint must point at a directory; got ${config.uiEntrypoint}.`);
115
+ const splashPath = path.join(uiEntrypointPath, "splash.html");
116
+ if (!fs.existsSync(splashPath)) throw new Error(`${configPath}: uiEntrypoint directory ${config.uiEntrypoint} is missing required \`splash.html\`. The splash file is shown raw (no Vite) during the brief window between Electron startup and the app's first paint.`);
103
117
  const plugins = [];
104
118
  const pluginSourceFiles = [];
105
119
  for (const entry of config.plugins) {
@@ -113,6 +127,7 @@ async function loadConfig(projectDir) {
113
127
  projectDir: configDir,
114
128
  dbPath,
115
129
  uiEntrypointPath,
130
+ splashPath,
116
131
  plugins,
117
132
  build: resolveBuildConfig(config.build ?? {
118
133
  source: ".",
@@ -123,4 +138,4 @@ async function loadConfig(projectDir) {
123
138
  };
124
139
  }
125
140
  //#endregion
126
- export { loadConfig as n, findConfigPath as t };
141
+ export { load_config_exports as n, loadConfig as t };
@@ -31,6 +31,7 @@ interface ResolvedPluginRecord {
31
31
  interface RegistryPayload {
32
32
  plugins: ResolvedPluginRecord[];
33
33
  appEntrypoint: string;
34
+ splashPath: string;
34
35
  }
35
36
  declare function resolve(specifier: string, context: LoaderContext, nextResolve: NextResolve): unknown;
36
37
  declare function load(url: string, context: LoaderContext, nextLoad: NextLoad): unknown;
@@ -1,16 +1,9 @@
1
- import { createRequire } from "node:module";
2
1
  import fs from "node:fs";
3
2
  import path from "node:path";
4
3
  import { fileURLToPath, pathToFileURL } from "node:url";
5
4
  import { execFileSync } from "node:child_process";
6
5
  //#region src/loaders/zenbu.ts
7
6
  const verbose = process.env.ZENBU_VERBOSE === "1";
8
- const { subscribe } = createRequire(import.meta.url)("@parcel/watcher");
9
- let registerWatcherClosable = () => {};
10
- try {
11
- const pause = await import("@zenbujs/hmr/pause");
12
- registerWatcherClosable = typeof pause.registerWatcherClosable === "function" ? pause.registerWatcherClosable : registerWatcherClosable;
13
- } catch {}
14
7
  const loaderName = "zenbu-loader";
15
8
  let tracePort = null;
16
9
  const stats = {
@@ -19,20 +12,10 @@ const stats = {
19
12
  loadCount: 0,
20
13
  loadMs: 0
21
14
  };
22
- const barrels = /* @__PURE__ */ new Map();
23
- const dirWatchers = /* @__PURE__ */ new Map();
24
15
  let resolvedPayload = null;
25
16
  let resolvedPluginSourceFiles = [];
26
17
  /**
27
- * Number of times we've materialized the plugin root since boot. The first
28
- * call uses the payload that setup-gate sent through `register()`'s `data`
29
- * channel; every subsequent call shells out to `resolve-config.mjs` to
30
- * re-evaluate `zenbu.config.ts` from scratch (so editing the config file
31
- * actually picks up new plugins / removed plugins / changed paths).
32
- *
33
- * We can't `await import()` from inside the loader (Node's ESM loader hooks
34
- * run in a worker thread and serialize on this same hook, deadlocking).
35
- * `execFileSync` blocks the loader for ~300ms per HMR cycle, which is fine.
18
+ * Number of times we've materialized the plugin root since boot.
36
19
  */
37
20
  let pluginsRootInvocations = 0;
38
21
  function initialize(data) {
@@ -67,54 +50,6 @@ function expandGlob(pattern) {
67
50
  if (!fs.existsSync(dir)) return [];
68
51
  return fs.readdirSync(dir).filter((file) => regex.test(file)).map((file) => path.resolve(dir, file));
69
52
  }
70
- function snapshotDir(dir, regex) {
71
- if (!fs.existsSync(dir)) return /* @__PURE__ */ new Set();
72
- try {
73
- return new Set(fs.readdirSync(dir).filter((file) => regex.test(file)));
74
- } catch {
75
- return /* @__PURE__ */ new Set();
76
- }
77
- }
78
- function handleDirEvent(dir, filename) {
79
- for (const entry of barrels.values()) for (const glob of entry.globs) {
80
- if (glob.dir !== dir) continue;
81
- if (!glob.regex.test(filename)) continue;
82
- const nextSnapshot = snapshotDir(dir, glob.regex);
83
- if (!(nextSnapshot.size !== glob.snapshot.size || [...nextSnapshot].some((file) => !glob.snapshot.has(file)))) continue;
84
- glob.snapshot = nextSnapshot;
85
- try {
86
- entry.hot?.invalidate?.();
87
- if (verbose) console.log(`[zenbu-loader] invalidated barrel (${filename} added/removed in ${dir})`);
88
- } catch (err) {
89
- console.error("[zenbu-loader] invalidate failed:", err);
90
- }
91
- break;
92
- }
93
- }
94
- function ensureDirWatcher(dir) {
95
- if (dirWatchers.has(dir)) return;
96
- if (!fs.existsSync(dir)) return;
97
- let subscription = null;
98
- let closed = false;
99
- subscribe(dir, (err, events) => {
100
- if (err) return;
101
- for (const event of events) {
102
- if (path.dirname(event.path) !== dir) continue;
103
- handleDirEvent(dir, path.basename(event.path));
104
- }
105
- }).then((sub) => {
106
- if (closed) sub.unsubscribe().catch(() => {});
107
- else subscription = sub;
108
- }).catch((err) => {
109
- console.error(`[zenbu-loader] subscribe failed for ${dir}:`, err);
110
- });
111
- const closable = { close: () => {
112
- closed = true;
113
- if (subscription) return subscription.unsubscribe().catch(() => {});
114
- } };
115
- registerWatcherClosable(closable);
116
- dirWatchers.set(dir, closable);
117
- }
118
53
  function buildSource(imports) {
119
54
  return imports.map((specifier) => `import ${JSON.stringify(specifier)}\n`).join("");
120
55
  }
@@ -190,38 +125,30 @@ function buildRegistryModule(payload) {
190
125
  return [
191
126
  "import { replacePlugins, registerAppEntrypoint } from \"@zenbujs/core/runtime\"",
192
127
  `replacePlugins(${JSON.stringify(payload.plugins)})`,
193
- `registerAppEntrypoint(${JSON.stringify(payload.appEntrypoint)})`,
128
+ `registerAppEntrypoint(${JSON.stringify(payload.appEntrypoint)}, ${JSON.stringify(payload.splashPath)})`,
194
129
  "import.meta.hot?.accept()"
195
130
  ].join("\n") + "\n";
196
131
  }
197
132
  /**
198
133
  * Generate a per-plugin barrel: just service-file imports anchored at the
199
134
  * plugin's `dir`. Glob-form entries get expanded via `fs.readdirSync` and
200
- * a parcel-watcher subscription is opened so dynohot invalidates the
201
- * barrel when service files are added/removed under the watched directory.
135
+ * glob directories are registered with `context.hot.watch()` so dynohot
136
+ * reloads the generated barrel when service files are added/removed.
202
137
  */
203
138
  function buildPluginBarrel(plugin) {
204
139
  const imports = [];
205
140
  const watchPaths = new Set([plugin.dir]);
206
- const globs = [];
207
141
  for (const entry of plugin.services) {
208
142
  const resolved = path.isAbsolute(entry) ? entry : path.resolve(plugin.dir, entry);
209
143
  if (resolved.includes("*")) {
210
144
  const dir = path.dirname(resolved);
211
- const regex = globRegex(path.basename(resolved));
212
145
  watchPaths.add(dir);
213
- globs.push({
214
- dir,
215
- regex,
216
- snapshot: snapshotDir(dir, regex)
217
- });
218
146
  for (const file of expandGlob(resolved)) imports.push(pathToFileURL(file).href);
219
147
  } else imports.push(pathToFileURL(resolved).href);
220
148
  }
221
149
  return {
222
150
  source: `${buildSource(imports)}import.meta.hot?.accept()\n`,
223
- watchPaths,
224
- globs
151
+ watchPaths
225
152
  };
226
153
  }
227
154
  const CORE_PACKAGE_ROOT_FOR_LOADER = (() => {
@@ -325,16 +252,9 @@ function loadImpl(url, context, nextLoad) {
325
252
  } catch (err) {
326
253
  throw new Error(`[zenbu-loader] bad plugin payload: ${err.message}`);
327
254
  }
328
- const { source, watchPaths, globs } = buildPluginBarrel(plugin);
255
+ const { source, watchPaths } = buildPluginBarrel(plugin);
329
256
  if (context.hot?.watch) for (const watchPath of watchPaths) context.hot.watch(pathToFileURL(watchPath));
330
- if (context.hot) {
331
- barrels.set(url, {
332
- hot: context.hot,
333
- globs
334
- });
335
- for (const glob of globs) ensureDirWatcher(glob.dir);
336
- }
337
- if (verbose) console.log(`[zenbu-loader] generated barrel for plugin ${plugin.name} (${source.split("\n").filter(Boolean).length} imports, ${watchPaths.size} watches, ${globs.length} globs)`);
257
+ if (verbose) console.log(`[zenbu-loader] generated barrel for plugin ${plugin.name} (${source.split("\n").filter(Boolean).length} imports, ${watchPaths.size} watches)`);
338
258
  return {
339
259
  format: "module",
340
260
  source,
@@ -3,6 +3,9 @@ import os from "node:os";
3
3
  import path from "node:path";
4
4
  import { execFileSync } from "node:child_process";
5
5
  //#region src/cli/commands/monorepo.ts
6
+ /**
7
+ * todo: should only be exposed when an env var is passed
8
+ */
6
9
  const MARKER_FILE = ".zenbu-dev-link";
7
10
  const DEFAULT_MONOREPO = path.join(os.homedir(), ".zenbu", "plugins", "zenbu");
8
11
  function resolveProjectDir() {
@@ -1,4 +1,4 @@
1
- import { n as require_lib, t as zenbuAdviceTransform } from "./transform-DJH3vN4b.mjs";
1
+ import { n as require_lib, t as zenbuAdviceTransform } from "./transform-CmFYPmt8.mjs";
2
2
  import { fileURLToPath } from "node:url";
3
3
  //#region ../advice/src/node-loader.ts
4
4
  var import_lib = require_lib();
@@ -1,5 +1,5 @@
1
- import { n as loadConfig } from "./load-config-BG2tPIfF.mjs";
2
- import { n as init, r as push } from "./mirror-sync-EiWvdzTJ.mjs";
1
+ import { t as loadConfig } from "./load-config-xMf2wxH8.mjs";
2
+ import { n as init, r as push } from "./mirror-sync-PDzxhf1w.mjs";
3
3
  import fs from "node:fs";
4
4
  import path from "node:path";
5
5
  import { execFileSync } from "node:child_process";
package/dist/react.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { f as CollectionRefBrand, h as InferCollectionItem, n as connectReplica, o as ClientProxy, p as CollectionRefValue, u as CollectionState, y as SchemaShape } from "./index-UK58xuoR.mjs";
2
- import { c as ResolvedServiceRouter, l as ZenbuRegister, o as ResolvedDbRoot, s as ResolvedEvents } from "./registry-CioEYLI5.mjs";
3
- import { n as EventProxy, r as RouterProxy } from "./index-CE0iPntP.mjs";
1
+ import { f as CollectionRefBrand, h as InferCollectionItem, n as connectReplica, o as ClientProxy, p as CollectionRefValue, u as CollectionState, y as SchemaShape } from "./index-M_lSNBrq.mjs";
2
+ import { c as ResolvedServiceRouter, l as ZenbuRegister, o as ResolvedDbRoot, s as ResolvedEvents } from "./registry-eX6e2oql.mjs";
3
+ import { n as EventProxy, r as RouterProxy } from "./index-C-ALz_SH.mjs";
4
4
  import * as _$react from "react";
5
5
  import { ReactNode } from "react";
6
6
 
package/dist/react.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { i as dbStringify, r as dbParse, t as connectReplica } from "./transport-BMSzG2-F.mjs";
2
- import { t as connectRpc } from "./src-pELM4_iH.mjs";
1
+ import { i as dbStringify, r as dbParse, t as connectReplica } from "./transport-F2hv_OEm.mjs";
2
+ import { t as connectRpc } from "./src-Cven45mq.mjs";
3
3
  import { createContext, createElement, useCallback, useContext, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
4
4
  //#region ../kyju/src/v2/react/index.ts
5
5
  function createKyjuReact() {
@@ -1,4 +1,4 @@
1
- import { n as SchemaRoot } from "./schema-DvT61x2_.mjs";
1
+ import { n as SchemaRoot } from "./schema-Dl85YjXW.mjs";
2
2
 
3
3
  //#region src/registry.d.ts
4
4
  type CoreEvents = {
@@ -1,2 +1,2 @@
1
- import { a as Events, c as ResolvedServiceRouter, i as CoreServiceRouter, l as ZenbuRegister, n as CoreEvents, o as ResolvedDbRoot, r as CorePreloads, s as ResolvedEvents, t as CoreDbSections } from "./registry-CioEYLI5.mjs";
1
+ import { a as Events, c as ResolvedServiceRouter, i as CoreServiceRouter, l as ZenbuRegister, n as CoreEvents, o as ResolvedDbRoot, r as CorePreloads, s as ResolvedEvents, t as CoreDbSections } from "./registry-eX6e2oql.mjs";
2
2
  export { CoreDbSections, CoreEvents, CorePreloads, CoreServiceRouter, Events, ResolvedDbRoot, ResolvedEvents, ResolvedServiceRouter, ZenbuRegister };