@zenbujs/core 0.0.9 → 0.0.13
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-BiYhyeTz.d.mts +41 -0
- package/dist/advice.d.mts +2 -36
- package/dist/advice.mjs +2 -2
- package/dist/{base-window-BxBZ2md_.mjs → base-window-4P-fVvC_.mjs} +37 -26
- package/dist/{build-config-Dzg2frpk.d.mts → build-config-GF0XzR_Y.d.mts} +42 -18
- package/dist/{build-config-pWdmLnrk.mjs → build-config-HMMqpXI1.mjs} +0 -8
- package/dist/{build-electron-Dsbb1EMl.mjs → build-electron-Di_FE62r.mjs} +10 -6
- package/dist/{build-source-d1J3shV8.mjs → build-source-BIaWpaxE.mjs} +2 -2
- package/dist/cli/bin.mjs +7 -7
- package/dist/cli/build.d.mts +1 -1
- package/dist/cli/build.mjs +1 -1
- package/dist/cli/resolve-config.mjs +6 -1
- package/dist/{cli-kL6mPgBE.mjs → cli-5jFDJWM4.mjs} +4 -4
- package/dist/config.d.mts +3 -3
- package/dist/config.mjs +2 -2
- package/dist/{db-Bc292RYo.mjs → db-MkOccvBS.mjs} +2 -2
- package/dist/db.d.mts +3 -2
- package/dist/db.mjs +2 -10
- package/dist/{dev-B2emj0HZ.mjs → dev-BSDyzO4j.mjs} +3 -9
- package/dist/env-bootstrap.d.mts +1 -1
- package/dist/events.d.mts +0 -9
- package/dist/{host-version-BIrF8tX7.mjs → host-version-Cog_odmD.mjs} +4 -3
- package/dist/{index-CVF768Xs.d.mts → index-C0mXKol5.d.mts} +188 -143
- package/dist/{index-DeDxePAa.d.mts → index-FaexRVl_.d.mts} +13 -1
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +2 -2
- package/dist/launcher.mjs +64 -6
- package/dist/link-Bt3LB_NW.mjs +586 -0
- package/dist/{load-config-C4Oe2qZO.mjs → load-config-C2XloBaQ.mjs} +68 -5
- package/dist/node-loader.mjs +1 -1
- package/dist/{publish-source-Dq2c0iOw.mjs → publish-source-v93eB9kA.mjs} +6 -2
- package/dist/react.d.mts +6 -6
- package/dist/react.mjs +4 -4
- package/dist/registry-generated.d.mts +19 -14
- package/dist/registry-saQDMUhT.d.mts +13 -0
- package/dist/registry.d.mts +1 -1
- package/dist/{reloader-B22UiNA2.mjs → reloader-CFzxYa67.mjs} +3 -3
- package/dist/{renderer-host-DD16MXhI.mjs → renderer-host-Cw38dSDe.mjs} +35 -24
- package/dist/{rpc-C4_NQmpT.mjs → rpc-Dg9zwZ33.mjs} +4 -4
- package/dist/rpc.d.mts +1 -1
- package/dist/rpc.mjs +1 -1
- package/dist/runtime-DYUONc3S.mjs +861 -0
- package/dist/{runtime-BQWntcOb.d.mts → runtime-fnPDZFYM.d.mts} +100 -3
- package/dist/runtime.d.mts +2 -2
- package/dist/runtime.mjs +2 -578
- package/dist/{schema-CjrMVk36.d.mts → schema-brYpUjYO.d.mts} +13 -25
- package/dist/schema.d.mts +2 -2
- package/dist/schema.mjs +9 -2
- package/dist/{server-CZLMF8Dj.mjs → server-BJ2ZC2z2.mjs} +2 -2
- package/dist/services/default.d.mts +1 -5
- package/dist/services/default.mjs +12 -16
- package/dist/services/index.d.mts +1 -1
- package/dist/services/index.mjs +7 -7
- package/dist/setup-gate.d.mts +1 -1
- package/dist/setup-gate.mjs +20 -12
- package/dist/{transport-F2hv_OEm.mjs → transport-Bqlv9pmJ.mjs} +1 -1
- package/dist/updater-Bs1Jtem6.mjs +480 -0
- package/dist/{vite-plugins-tt6KAtyE.mjs → vite-plugins-Df-cfldF.mjs} +2 -49
- package/dist/vite.d.mts +0 -5
- package/dist/vite.mjs +1 -1
- package/dist/{window-YFKvAM0l.mjs → window-DgB70qeZ.mjs} +113 -22
- package/dist/{write-DgIRjo23.mjs → write-7IfKa_nq.mjs} +1 -1
- package/dist/zenbu-bg-parse-CIyPkJOY.mjs +46 -0
- package/package.json +6 -5
- package/dist/advice-config-DXSIo0sg.mjs +0 -154
- package/dist/link-glX89NV5.mjs +0 -673
- package/dist/registry-CMp8FYgS.d.mts +0 -47
- package/dist/updater-BtB_Ki1r.mjs +0 -1011
- /package/dist/{config-BK78JDRI.mjs → config-DfciRzDu.mjs} +0 -0
- /package/dist/{env-bootstrap-rTs8KR3-.d.mts → env-bootstrap-UBug-4Kw.d.mts} +0 -0
- /package/dist/{index-C-ALz_SH.d.mts → index-CSMHYi3u.d.mts} +0 -0
- /package/dist/{index-ClXLQ1fw.d.mts → index-DJOHDG5e.d.mts} +0 -0
- /package/dist/{log-6rzaCV0I.mjs → log-BkRqDwwB.mjs} +0 -0
- /package/dist/{mirror-sync-pYU6f3-c.mjs → mirror-sync-snqh9kEp.mjs} +0 -0
- /package/dist/{monorepo-Dct-kkbQ.mjs → monorepo-CBzK3l2i.mjs} +0 -0
- /package/dist/{node-BhfLKYCi.mjs → node-BuHlEsE4.mjs} +0 -0
- /package/dist/{schema-Ca7SxXgS.mjs → schema-C6k0SroY.mjs} +0 -0
- /package/dist/{setup-gate-BQq0QgZH.d.mts → setup-gate-DkysEZQO.d.mts} +0 -0
- /package/dist/{src-Cven45mq.mjs → src-BpZAt9zL.mjs} +0 -0
- /package/dist/{trace-BaVg0rnY.mjs → trace-BVcQSD59.mjs} +0 -0
- /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
|
-
|
|
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 {
|
|
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 };
|
package/dist/runtime.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as
|
|
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 };
|