@zenbujs/core 0.0.9 → 0.0.12

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 (82) hide show
  1. package/dist/advice-config-BiYhyeTz.d.mts +41 -0
  2. package/dist/advice.d.mts +2 -36
  3. package/dist/advice.mjs +2 -2
  4. package/dist/{base-window-BxBZ2md_.mjs → base-window-4P-fVvC_.mjs} +37 -26
  5. package/dist/{build-config-Dzg2frpk.d.mts → build-config-GF0XzR_Y.d.mts} +42 -18
  6. package/dist/{build-config-pWdmLnrk.mjs → build-config-HMMqpXI1.mjs} +0 -8
  7. package/dist/{build-electron-Dsbb1EMl.mjs → build-electron-Di_FE62r.mjs} +10 -6
  8. package/dist/{build-source-d1J3shV8.mjs → build-source-BIaWpaxE.mjs} +2 -2
  9. package/dist/cli/bin.mjs +7 -7
  10. package/dist/cli/build.d.mts +1 -1
  11. package/dist/cli/build.mjs +1 -1
  12. package/dist/cli/resolve-config.mjs +6 -1
  13. package/dist/{cli-kL6mPgBE.mjs → cli-5jFDJWM4.mjs} +4 -4
  14. package/dist/config.d.mts +3 -3
  15. package/dist/config.mjs +2 -2
  16. package/dist/{db-Bc292RYo.mjs → db-MkOccvBS.mjs} +2 -2
  17. package/dist/db.d.mts +3 -2
  18. package/dist/db.mjs +2 -10
  19. package/dist/{dev-B2emj0HZ.mjs → dev-BSDyzO4j.mjs} +3 -9
  20. package/dist/env-bootstrap.d.mts +1 -1
  21. package/dist/events.d.mts +0 -9
  22. package/dist/{host-version-BIrF8tX7.mjs → host-version-Cog_odmD.mjs} +4 -3
  23. package/dist/{index-CVF768Xs.d.mts → index-C0mXKol5.d.mts} +188 -143
  24. package/dist/{index-DeDxePAa.d.mts → index-FaexRVl_.d.mts} +13 -1
  25. package/dist/index.d.mts +4 -4
  26. package/dist/index.mjs +2 -2
  27. package/dist/launcher.mjs +64 -6
  28. package/dist/link-Bt3LB_NW.mjs +586 -0
  29. package/dist/{load-config-C4Oe2qZO.mjs → load-config-C2XloBaQ.mjs} +68 -5
  30. package/dist/node-loader.mjs +1 -1
  31. package/dist/{publish-source-Dq2c0iOw.mjs → publish-source-v93eB9kA.mjs} +6 -2
  32. package/dist/react.d.mts +6 -6
  33. package/dist/react.mjs +4 -4
  34. package/dist/registry-generated.d.mts +19 -14
  35. package/dist/registry-saQDMUhT.d.mts +13 -0
  36. package/dist/registry.d.mts +1 -1
  37. package/dist/{reloader-B22UiNA2.mjs → reloader-CFzxYa67.mjs} +3 -3
  38. package/dist/{renderer-host-DD16MXhI.mjs → renderer-host-Cw38dSDe.mjs} +35 -24
  39. package/dist/{rpc-C4_NQmpT.mjs → rpc-Dg9zwZ33.mjs} +4 -4
  40. package/dist/rpc.d.mts +1 -1
  41. package/dist/rpc.mjs +1 -1
  42. package/dist/runtime-DYUONc3S.mjs +861 -0
  43. package/dist/{runtime-BQWntcOb.d.mts → runtime-fnPDZFYM.d.mts} +100 -3
  44. package/dist/runtime.d.mts +2 -2
  45. package/dist/runtime.mjs +2 -578
  46. package/dist/{schema-CjrMVk36.d.mts → schema-brYpUjYO.d.mts} +13 -25
  47. package/dist/schema.d.mts +2 -2
  48. package/dist/schema.mjs +9 -2
  49. package/dist/{server-CZLMF8Dj.mjs → server-BJ2ZC2z2.mjs} +2 -2
  50. package/dist/services/default.d.mts +1 -5
  51. package/dist/services/default.mjs +12 -16
  52. package/dist/services/index.d.mts +1 -1
  53. package/dist/services/index.mjs +7 -7
  54. package/dist/setup-gate.d.mts +1 -1
  55. package/dist/setup-gate.mjs +20 -12
  56. package/dist/{transport-F2hv_OEm.mjs → transport-Bqlv9pmJ.mjs} +1 -1
  57. package/dist/updater-Bs1Jtem6.mjs +480 -0
  58. package/dist/{vite-plugins-tt6KAtyE.mjs → vite-plugins-Df-cfldF.mjs} +2 -49
  59. package/dist/vite.d.mts +0 -5
  60. package/dist/vite.mjs +1 -1
  61. package/dist/{window-YFKvAM0l.mjs → window-DgB70qeZ.mjs} +113 -22
  62. package/dist/{write-DgIRjo23.mjs → write-7IfKa_nq.mjs} +1 -1
  63. package/dist/zenbu-bg-parse-CIyPkJOY.mjs +46 -0
  64. package/package.json +19 -18
  65. package/LICENSE +0 -11
  66. package/dist/advice-config-DXSIo0sg.mjs +0 -154
  67. package/dist/link-glX89NV5.mjs +0 -673
  68. package/dist/registry-CMp8FYgS.d.mts +0 -47
  69. package/dist/updater-BtB_Ki1r.mjs +0 -1011
  70. /package/dist/{config-BK78JDRI.mjs → config-DfciRzDu.mjs} +0 -0
  71. /package/dist/{env-bootstrap-rTs8KR3-.d.mts → env-bootstrap-UBug-4Kw.d.mts} +0 -0
  72. /package/dist/{index-C-ALz_SH.d.mts → index-CSMHYi3u.d.mts} +0 -0
  73. /package/dist/{index-ClXLQ1fw.d.mts → index-DJOHDG5e.d.mts} +0 -0
  74. /package/dist/{log-6rzaCV0I.mjs → log-BkRqDwwB.mjs} +0 -0
  75. /package/dist/{mirror-sync-pYU6f3-c.mjs → mirror-sync-snqh9kEp.mjs} +0 -0
  76. /package/dist/{monorepo-Dct-kkbQ.mjs → monorepo-CBzK3l2i.mjs} +0 -0
  77. /package/dist/{node-BhfLKYCi.mjs → node-BuHlEsE4.mjs} +0 -0
  78. /package/dist/{schema-Ca7SxXgS.mjs → schema-C6k0SroY.mjs} +0 -0
  79. /package/dist/{setup-gate-BQq0QgZH.d.mts → setup-gate-DkysEZQO.d.mts} +0 -0
  80. /package/dist/{src-Cven45mq.mjs → src-BpZAt9zL.mjs} +0 -0
  81. /package/dist/{trace-BaVg0rnY.mjs → trace-BVcQSD59.mjs} +0 -0
  82. /package/dist/{transform-BzrwkEdf.mjs → transform-czrcGnVV.mjs} +0 -0
@@ -1,4 +1,12 @@
1
+ import { n as ContentScriptSpec, t as AdviceSpec } from "./advice-config-BiYhyeTz.mjs";
2
+
1
3
  //#region src/runtime.d.ts
4
+ /**
5
+ * The synthetic plugin name used for everything that ships inside
6
+ * `@zenbujs/core`. Mirrors the `core` DB section so RPC, events, and the
7
+ * database all use the same top-level namespace.
8
+ */
9
+ declare const CORE_PLUGIN_NAME = "core";
2
10
  type CleanupReason = "reload" | "shutdown";
3
11
  type SetupCleanup = ((reason: CleanupReason) => void | Promise<void>) | void;
4
12
  type SetupFn = () => SetupCleanup;
@@ -7,6 +15,15 @@ interface ServiceSlot {
7
15
  instance: Service | null;
8
16
  ServiceClass: ServiceConstructor;
9
17
  status: "blocked" | "evaluating" | "ready" | "failed";
18
+ /**
19
+ * Absolute directory of the plugin that owns this service file, resolved
20
+ * once at `runtime.register` time from the registering module's
21
+ * `import.meta.url`. `null` for core-package services that are not
22
+ * declared inside any plugin (`@zenbujs/core/services/*`). Read by
23
+ * `Service#advise` / `Service#contentScript` to anchor relative paths
24
+ * without forcing user code to pass `import.meta`.
25
+ */
26
+ pluginDir: string | null;
10
27
  }
11
28
  type AnyServiceClass = (abstract new (...args: any[]) => Service) & {
12
29
  key: string;
@@ -56,6 +73,40 @@ declare abstract class Service {
56
73
  ctx: ResolveCtx<TDeps>; /** @internal */
57
74
  __setupCleanups: Map<string, (reason: CleanupReason) => void | Promise<void>>;
58
75
  evaluate(): void | Promise<void>;
76
+ /**
77
+ * Register advice (component wrap/replace, function before/after/around)
78
+ * targeting another plugin's exports. The owning plugin's root directory
79
+ * is resolved automatically from this service's slot, so relative
80
+ * `modulePath` values just work.
81
+ *
82
+ * this.setup("wrap-counter", () =>
83
+ * this.advise({
84
+ * view: "app",
85
+ * moduleId: "App.tsx",
86
+ * name: "Counter",
87
+ * type: "around",
88
+ * modulePath: "src/content/wrap-counter.tsx",
89
+ * exportName: "WrapCounter",
90
+ * }),
91
+ * )
92
+ *
93
+ * Returns an unregister function — wrap the call in `this.setup(...)`
94
+ * so cleanup runs on hot reload.
95
+ */
96
+ advise(spec: AdviceSpec): () => void;
97
+ /**
98
+ * Inject a content script into a view. Same plugin-root resolution
99
+ * rules as `advise`.
100
+ *
101
+ * this.setup("inject", () =>
102
+ * this.injectContentScript({
103
+ * view: "*",
104
+ * modulePath: "src/content/toolbar.tsx",
105
+ * }),
106
+ * )
107
+ */
108
+ injectContentScript(spec: ContentScriptSpec): () => void; /** @internal */
109
+ __getPluginDir(method: string): string;
59
110
  setup(key: string, fn: SetupFn): void;
60
111
  /**
61
112
  * Run `fn` and return its result. Historically reported a boot-trace span;
@@ -77,6 +128,41 @@ declare abstract class Service {
77
128
  /** @internal */
78
129
  __setupCleanups: Map<string, (reason: CleanupReason) => void | Promise<void>>;
79
130
  evaluate(): void | Promise<void>;
131
+ /**
132
+ * Register advice (component wrap/replace, function before/after/around)
133
+ * targeting another plugin's exports. The owning plugin's root directory
134
+ * is resolved automatically from this service's slot, so relative
135
+ * `modulePath` values just work.
136
+ *
137
+ * this.setup("wrap-counter", () =>
138
+ * this.advise({
139
+ * view: "app",
140
+ * moduleId: "App.tsx",
141
+ * name: "Counter",
142
+ * type: "around",
143
+ * modulePath: "src/content/wrap-counter.tsx",
144
+ * exportName: "WrapCounter",
145
+ * }),
146
+ * )
147
+ *
148
+ * Returns an unregister function — wrap the call in `this.setup(...)`
149
+ * so cleanup runs on hot reload.
150
+ */
151
+ advise(spec: AdviceSpec): () => void;
152
+ /**
153
+ * Inject a content script into a view. Same plugin-root resolution
154
+ * rules as `advise`.
155
+ *
156
+ * this.setup("inject", () =>
157
+ * this.injectContentScript({
158
+ * view: "*",
159
+ * modulePath: "src/content/toolbar.tsx",
160
+ * }),
161
+ * )
162
+ */
163
+ injectContentScript(spec: ContentScriptSpec): () => void;
164
+ /** @internal */
165
+ __getPluginDir(method: string): string;
80
166
  setup(key: string, fn: SetupFn): void;
81
167
  /**
82
168
  * Run `fn` and return its result. Historically reported a boot-trace span;
@@ -126,7 +212,15 @@ declare class ServiceRuntime {
126
212
  key: string;
127
213
  }, cb: (instance: T | undefined) => void): () => void;
128
214
  private fireSubscribers;
129
- buildRouter(): Record<string, Record<string, (...args: any[]) => any>>;
215
+ /**
216
+ * Build a 3-level router keyed by plugin name → service key → method.
217
+ * Mirrors how the database is sectioned (`root.<plugin>.<field>`) so a
218
+ * service's RPC surface lives under its owning plugin's namespace
219
+ * instead of polluting the top level. Core services bucket under
220
+ * `"core"` because the core package is registered as a synthetic
221
+ * plugin (see `getPluginRegistry`).
222
+ */
223
+ buildRouter(): Record<string, Record<string, Record<string, (...args: any[]) => any>>>;
130
224
  onReconciled(cb: (changedKeys: string[]) => void): () => void;
131
225
  private resolveDepSlot;
132
226
  private injectCtx;
@@ -183,7 +277,10 @@ declare function registerPlugin(record: PluginRecord): void;
183
277
  declare function unregisterPlugin(name: string): void;
184
278
  /**
185
279
  * Replace the entire plugin set in one shot. The loader uses this on every
186
- * barrel regeneration so removed plugins disappear cleanly.
280
+ * barrel regeneration so removed plugins disappear cleanly. The synthetic
281
+ * `core` plugin is always reseeded after the clear so user records cannot
282
+ * accidentally evict it (and a user record named `"core"` is rejected so
283
+ * the namespace stays unambiguous).
187
284
  */
188
285
  declare function replacePlugins(records: PluginRecord[]): void;
189
286
  declare function getPlugins(): PluginRecord[];
@@ -215,4 +312,4 @@ declare function getConfig(): ConfigSnapshot;
215
312
  */
216
313
  declare function subscribeConfig(callback: (snapshot: ConfigSnapshot) => void): () => void;
217
314
  //#endregion
218
- export { unregisterPlugin as _, ServiceConstructor as a, getConfig as c, getSplashPath as d, registerAppEntrypoint as f, subscribeConfig as g, runtime as h, Service as i, getPlugin as l, replacePlugins as m, ConfigSnapshot as n, ServiceRuntime as o, registerPlugin as p, PluginRecord as r, getAppEntrypoint as s, CleanupReason as t, getPlugins as u };
315
+ export { subscribeConfig as _, Service as a, getAppEntrypoint as c, getPlugins as d, getSplashPath as f, runtime as g, replacePlugins as h, PluginRecord as i, getConfig as l, registerPlugin as m, CleanupReason as n, ServiceConstructor as o, registerAppEntrypoint as p, ConfigSnapshot as r, ServiceRuntime as s, CORE_PLUGIN_NAME as t, getPlugin as u, unregisterPlugin as v };
@@ -1,2 +1,2 @@
1
- import { _ as unregisterPlugin, a as ServiceConstructor, c as getConfig, d as getSplashPath, f as registerAppEntrypoint, g as subscribeConfig, h as runtime, i as Service, l as getPlugin, m as replacePlugins, n as ConfigSnapshot, o as ServiceRuntime, p as registerPlugin, r as PluginRecord, s as getAppEntrypoint, t as CleanupReason, u as getPlugins } from "./runtime-BQWntcOb.mjs";
2
- export { CleanupReason, ConfigSnapshot, PluginRecord, Service, ServiceConstructor, ServiceRuntime, getAppEntrypoint, getConfig, getPlugin, getPlugins, getSplashPath, registerAppEntrypoint, registerPlugin, replacePlugins, runtime, subscribeConfig, unregisterPlugin };
1
+ import { _ as subscribeConfig, a as Service, c as getAppEntrypoint, d as getPlugins, f as getSplashPath, g as runtime, h as replacePlugins, i as PluginRecord, l as getConfig, m as registerPlugin, n as CleanupReason, o as ServiceConstructor, p as registerAppEntrypoint, r as ConfigSnapshot, s as ServiceRuntime, t as CORE_PLUGIN_NAME, u as getPlugin, v as unregisterPlugin } from "./runtime-fnPDZFYM.mjs";
2
+ export { CORE_PLUGIN_NAME, CleanupReason, ConfigSnapshot, PluginRecord, Service, ServiceConstructor, ServiceRuntime, getAppEntrypoint, getConfig, getPlugin, getPlugins, getSplashPath, registerAppEntrypoint, registerPlugin, replacePlugins, runtime, subscribeConfig, unregisterPlugin };