@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,2 +1,249 @@
1
- import { t as setupGate } from "./setup-gate-D8XfYY52.mjs";
1
+ import { bootstrapEnv } from "./env-bootstrap.mjs";
2
+ import { createRequire, register } from "node:module";
3
+ import fs from "node:fs";
4
+ import os from "node:os";
5
+ import path from "node:path";
6
+ import { pathToFileURL } from "node:url";
7
+ import { register as register$1 } from "tsx/esm/api";
8
+ //#region src/setup-gate.ts
9
+ function registerLoader(specifier, opts) {
10
+ return register(specifier, void 0, opts);
11
+ }
12
+ const verbose = process.env.ZENBU_VERBOSE === "1";
13
+ function isPluginModule(value) {
14
+ return typeof value === "object" && value !== null && typeof value.default === "function";
15
+ }
16
+ function isPluginController(value) {
17
+ return typeof value === "object" && value !== null && typeof value.main === "function";
18
+ }
19
+ function envMs(name) {
20
+ const raw = process.env[name];
21
+ if (!raw) return null;
22
+ const value = Number(raw);
23
+ return Number.isFinite(value) && value >= 0 ? value : null;
24
+ }
25
+ function projectArg() {
26
+ const arg = process.argv.find((item) => item.startsWith("--project="));
27
+ return arg ? path.resolve(arg.slice(10)) : null;
28
+ }
29
+ function appDirName(name) {
30
+ return name.replace(/^@/, "").replace(/[\\/]/g, "__");
31
+ }
32
+ function readPackageJson(packageDir) {
33
+ const pkgPath = path.join(packageDir, "package.json");
34
+ return JSON.parse(fs.readFileSync(pkgPath, "utf8"));
35
+ }
36
+ function findProjectRoot(projectDir) {
37
+ let dir = path.resolve(projectDir);
38
+ while (dir !== path.dirname(dir)) {
39
+ if (fs.existsSync(path.join(dir, "package.json"))) return dir;
40
+ dir = path.dirname(dir);
41
+ }
42
+ return path.resolve(projectDir);
43
+ }
44
+ function resolveConfigPath(projectRoot) {
45
+ const candidates = [
46
+ "zenbu.config.ts",
47
+ "zenbu.config.mts",
48
+ "zenbu.config.js",
49
+ "zenbu.config.mjs"
50
+ ];
51
+ for (const name of candidates) {
52
+ const candidate = path.join(projectRoot, name);
53
+ if (fs.existsSync(candidate)) return candidate;
54
+ }
55
+ throw new Error(`No zenbu config found at ${projectRoot}. Expected one of: ${candidates.join(", ")}`);
56
+ }
57
+ function findTsconfig(projectRoot) {
58
+ const candidate = path.join(projectRoot, "tsconfig.json");
59
+ return fs.existsSync(candidate) ? candidate : false;
60
+ }
61
+ function loadElectronApp() {
62
+ const electron = createRequire(import.meta.url)("electron");
63
+ if (!electron.app) throw new Error("Electron app API is unavailable; setup-gate must run inside Electron");
64
+ return electron.app;
65
+ }
66
+ async function closeRegisteredWatchers() {
67
+ await (await import("@zenbujs/hmr/pause")).closeAllWatchers?.();
68
+ }
69
+ /**
70
+ * Extract the splash's intended background color from a
71
+ * `<meta name="zenbu-bg" content="#xxx">` tag. Used as the BaseWindow's
72
+ * `backgroundColor` so the OS doesn't paint a single white frame before
73
+ * the WebContentsView's pixels reach the screen. Convention only —
74
+ * defaults to `#F4F4F4` when unset.
75
+ */
76
+ function readSplashBgColor(splashPath) {
77
+ try {
78
+ const match = fs.readFileSync(splashPath, "utf8").match(/<meta\s+name=["']zenbu-bg["']\s+content=["']([^"']+)["']/i);
79
+ if (match?.[1]) return match[1];
80
+ } catch {}
81
+ return "#F4F4F4";
82
+ }
83
+ /**
84
+ * Spawn the splash window before any plugin service evaluates. The window
85
+ * is created HIDDEN, the splash HTML is loaded into a `WebContentsView`,
86
+ * we wait for `loadFile` to resolve (= did-finish-load), then `win.show()`
87
+ * — by the time the OS composites the window, the splash pixels are already
88
+ * there. No white-frame flash.
89
+ *
90
+ * `BaseWindowService.evaluate()` adopts this window from
91
+ * `globalThis.__zenbu_boot_windows__` instead of creating a new one, so
92
+ * `WindowService.openView` can swap the splash content view for the
93
+ * Vite-served renderer in-place when the renderer is ready.
94
+ */
95
+ async function spawnSplashWindow() {
96
+ const slot = globalThis;
97
+ const splashPath = slot.__zenbu_main_resolved_config__?.payload?.splashPath;
98
+ if (!splashPath || !fs.existsSync(splashPath)) {
99
+ if (verbose) console.log("[setup-gate] no splash.html resolved; skipping splash window");
100
+ return;
101
+ }
102
+ const electron = await import("electron");
103
+ const backgroundColor = readSplashBgColor(splashPath);
104
+ const win = new electron.BaseWindow({
105
+ width: 1100,
106
+ height: 750,
107
+ show: false,
108
+ titleBarStyle: "hidden",
109
+ trafficLightPosition: {
110
+ x: 14,
111
+ y: 10
112
+ },
113
+ backgroundColor
114
+ });
115
+ const splashView = new electron.WebContentsView({ webPreferences: { paintWhenInitiallyHidden: true } });
116
+ win.contentView.addChildView(splashView);
117
+ const bounds = win.getContentBounds();
118
+ splashView.setBounds({
119
+ x: 0,
120
+ y: 0,
121
+ width: bounds.width,
122
+ height: bounds.height
123
+ });
124
+ await Promise.race([splashView.webContents.loadFile(splashPath).catch(() => {}), new Promise((resolve) => setTimeout(resolve, 1500))]);
125
+ win.show();
126
+ const boot = {
127
+ windowId: "main",
128
+ win
129
+ };
130
+ slot.__zenbu_boot_windows__ = [...slot.__zenbu_boot_windows__ ?? [], boot];
131
+ if (verbose) console.log("[setup-gate] splash window shown with", splashPath, "bg=", backgroundColor);
132
+ }
133
+ async function registerLoaders(tsconfig, projectRoot) {
134
+ register$1({ tsconfig });
135
+ const { loadConfig } = await import("./load-config-xMf2wxH8.mjs").then((n) => n.n);
136
+ const { resolved, pluginSourceFiles } = await loadConfig(projectRoot);
137
+ const loaderData = {
138
+ payload: {
139
+ plugins: resolved.plugins.map((p) => ({
140
+ name: p.name,
141
+ dir: p.dir,
142
+ services: p.services,
143
+ schemaPath: p.schemaPath,
144
+ migrationsPath: p.migrationsPath,
145
+ preloadPath: p.preloadPath,
146
+ eventsPath: p.eventsPath,
147
+ icons: p.icons
148
+ })),
149
+ appEntrypoint: resolved.uiEntrypointPath,
150
+ splashPath: resolved.splashPath
151
+ },
152
+ pluginSourceFiles
153
+ };
154
+ globalThis.__zenbu_main_resolved_config__ = loaderData;
155
+ registerLoader(import.meta.resolve("@zenbujs/core/loaders/zenbu"), { data: loaderData });
156
+ process.env.ZENBU_ADVICE_ROOT = projectRoot;
157
+ await import("./node-_8xShqxr.mjs");
158
+ const dynohot = await import(pathToFileURL(createRequire(import.meta.url).resolve("@zenbujs/hmr/register")).href);
159
+ if (typeof dynohot.register === "function") dynohot.register({ ignore: /[/\\](?:node_modules|dist)[/\\]/ });
160
+ }
161
+ async function setupGate() {
162
+ const app = loadElectronApp();
163
+ await app.whenReady();
164
+ bootstrapEnv();
165
+ let shuttingDown = false;
166
+ const shutdown = async (exitCode = 0) => {
167
+ if (shuttingDown) return;
168
+ shuttingDown = true;
169
+ try {
170
+ await globalThis.__zenbu_service_runtime__?.shutdown();
171
+ } catch (err) {
172
+ console.error("[setup-gate] shutdown failed:", err);
173
+ }
174
+ try {
175
+ await closeRegisteredWatchers();
176
+ } catch (err) {
177
+ console.error("[setup-gate] closeAllWatchers failed:", err);
178
+ }
179
+ process.exit(exitCode);
180
+ };
181
+ app.on("before-quit", (event) => {
182
+ event.preventDefault();
183
+ shutdown(0);
184
+ });
185
+ process.on("SIGINT", () => void shutdown(0));
186
+ process.on("SIGTERM", () => void shutdown(0));
187
+ const autoQuitReadyMs = envMs("ZENBU_AUTO_QUIT_AFTER_READY_MS");
188
+ if (autoQuitReadyMs != null) {
189
+ if (verbose) console.log("[setup-gate] auto-quit after ready scheduled:", autoQuitReadyMs);
190
+ setTimeout(() => app.quit(), autoQuitReadyMs).unref();
191
+ }
192
+ const bundledAppPath = app.getAppPath();
193
+ const appName = readPackageJson(bundledAppPath).name ?? path.basename(bundledAppPath);
194
+ const resolvedProjectDir = projectArg() ?? path.join(process.env.ZENBU_APPS_DIR ?? path.join(os.homedir(), ".zenbu", "apps"), appDirName(appName));
195
+ if (!fs.existsSync(resolvedProjectDir)) throw new Error(`setup-gate: project directory ${resolvedProjectDir} does not exist. In a shipped .app, the launcher provisions this dir before invoking setup-gate. In dev, point at an existing project with --project=.`);
196
+ const projectRoot = findProjectRoot(resolvedProjectDir);
197
+ const configPath = resolveConfigPath(projectRoot);
198
+ const tsconfig = findTsconfig(projectRoot);
199
+ process.chdir(projectRoot);
200
+ process.env.ZENBU_CONFIG_PATH = configPath;
201
+ if (!process.argv.some((arg) => arg.startsWith("--project="))) process.argv.push(`--project=${resolvedProjectDir}`);
202
+ if (verbose) {
203
+ console.log("[setup-gate] project:", resolvedProjectDir);
204
+ console.log("[setup-gate] config:", configPath);
205
+ }
206
+ await registerLoaders(tsconfig, projectRoot);
207
+ if (shuttingDown) return;
208
+ try {
209
+ await spawnSplashWindow();
210
+ } catch (err) {
211
+ if (shuttingDown) return;
212
+ throw err;
213
+ }
214
+ if (shuttingDown) return;
215
+ try {
216
+ const { defaultServices } = await import("./services/default.mjs");
217
+ await defaultServices();
218
+ } catch (err) {
219
+ if (shuttingDown) return;
220
+ throw err;
221
+ }
222
+ if (shuttingDown) return;
223
+ const url = `zenbu:plugins?config=${encodeURIComponent(configPath)}`;
224
+ let mod;
225
+ try {
226
+ mod = await import(url, { with: { hot: "import" } });
227
+ } catch (err) {
228
+ if (shuttingDown) return;
229
+ throw err;
230
+ }
231
+ if (shuttingDown) return;
232
+ if (isPluginModule(mod)) {
233
+ const controller = mod.default();
234
+ if (isPluginController(controller)) await controller.main();
235
+ }
236
+ if (shuttingDown) return;
237
+ await globalThis.__zenbu_service_runtime__?.whenIdle();
238
+ const autoQuitMs = envMs("ZENBU_AUTO_QUIT_AFTER_IDLE_MS");
239
+ if (autoQuitMs != null) {
240
+ if (verbose) console.log("[setup-gate] auto-quit scheduled:", autoQuitMs);
241
+ setTimeout(() => app.quit(), autoQuitMs).unref();
242
+ }
243
+ }
244
+ setupGate().catch((error) => {
245
+ console.error(error);
246
+ process.exit(1);
247
+ });
248
+ //#endregion
2
249
  export { setupGate };
@@ -1,4 +1,4 @@
1
- import { n as __require, t as __commonJSMin } from "./chunk-Dm34NbLt.mjs";
1
+ import { r as __require, t as __commonJSMin } from "./chunk-DsiFFCwN.mjs";
2
2
  //#region ../../node_modules/.pnpm/@babel+types@7.29.0/node_modules/@babel/types/lib/utils/shallowEqual.js
3
3
  var require_shallowEqual = /* @__PURE__ */ __commonJSMin(((exports) => {
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -108,8 +108,17 @@ interface ResolvedConfig {
108
108
  projectDir: string;
109
109
  /** Absolute path to the database directory. */
110
110
  dbPath: string;
111
- /** Absolute path to the boot-window HTML. */
111
+ /**
112
+ * Absolute path to the renderer's entrypoint directory. Vite's `root`
113
+ * resolves here; `index.html` inside it is served through Vite.
114
+ */
112
115
  uiEntrypointPath: string;
116
+ /**
117
+ * Absolute path to `splash.html` inside the entrypoint directory. Loaded
118
+ * raw (no Vite) into a transient BrowserView during the brief window
119
+ * between Electron `whenReady` and the renderer's first paint.
120
+ */
121
+ splashPath: string;
113
122
  plugins: ResolvedPlugin[];
114
123
  /** Resolved build config; defaults filled in even when user omits. */
115
124
  build: ResolvedBuildConfig;
@@ -1,4 +1,4 @@
1
- import { t as traceKyju } from "./trace-DCB7qFzT.mjs";
1
+ import { t as traceKyju } from "./trace-BaVg0rnY.mjs";
2
2
  import * as Effect from "effect/Effect";
3
3
  import * as Ref from "effect/Ref";
4
4
  import * as Context from "effect/Context";
@@ -1,6 +1,6 @@
1
- import { a as getPlugins } from "./runtime-C95iyVn6.mjs";
2
- import { n as require_lib, t as zenbuAdviceTransform$1 } from "./transform-DJH3vN4b.mjs";
3
- import { a as getContentScripts, i as getAllScopes, r as getAllContentScriptPaths, t as getAdvice } from "./advice-config-BLXjqjGN.mjs";
1
+ import { getPlugins } from "./runtime.mjs";
2
+ import { n as require_lib, t as zenbuAdviceTransform$1 } from "./transform-CmFYPmt8.mjs";
3
+ import { a as getAllScopes, i as getAllContentScriptPaths, n as getAdvice, o as getContentScripts } from "./advice-config-QYB2qEd_.mjs";
4
4
  import path from "node:path";
5
5
  import { fileURLToPath } from "node:url";
6
6
  //#region ../advice/src/vite.ts
package/dist/vite.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { a as zenbuVitePlugins, i as zenbuFrameworkResolve, n as resolveAdviceRuntime, r as zenbuAdviceTransform, t as advicePreludePlugin } from "./vite-plugins-t4MlFcz3.mjs";
1
+ import { a as zenbuVitePlugins, i as zenbuFrameworkResolve, n as resolveAdviceRuntime, r as zenbuAdviceTransform, t as advicePreludePlugin } from "./vite-plugins-Do7liKi_.mjs";
2
2
  export { advicePreludePlugin, resolveAdviceRuntime, zenbuAdviceTransform, zenbuFrameworkResolve, zenbuVitePlugins };
@@ -1,11 +1,13 @@
1
- import { d as serviceWithDeps, u as runtime } from "./runtime-C95iyVn6.mjs";
2
- import { t as createLogger } from "./log-CyKv8hQg.mjs";
3
- import { n as ViewRegistryService, o as HttpService, t as RendererHostService } from "./renderer-host-ztaSIOGx.mjs";
4
- import { t as BaseWindowService } from "./base-window-D8CpxMU3.mjs";
1
+ import { n as __exportAll } from "./chunk-DsiFFCwN.mjs";
2
+ import { runtime, serviceWithDeps } from "./runtime.mjs";
3
+ import { t as createLogger } from "./log-6rzaCV0I.mjs";
4
+ import { r as ViewRegistryService, s as HttpService, t as RendererHostService } from "./renderer-host-Cau9JK0v.mjs";
5
+ import { t as BaseWindowService } from "./base-window-BbFRRhKP.mjs";
5
6
  import { URLSearchParams } from "node:url";
6
7
  import { WebContentsView, clipboard, dialog, shell } from "electron";
7
8
  import electronContextMenu from "electron-context-menu";
8
9
  //#region src/services/window.ts
10
+ var window_exports = /* @__PURE__ */ __exportAll({ WindowService: () => WindowService });
9
11
  const log = createLogger("window");
10
12
  function queryString(query) {
11
13
  if (!query) return "";
@@ -62,9 +64,10 @@ var WindowService = class extends serviceWithDeps({
62
64
  const view = new WebContentsView({ webPreferences: {
63
65
  nodeIntegration: false,
64
66
  contextIsolation: true,
65
- sandbox: true
67
+ sandbox: true,
68
+ ...args.view?.webPreferences
66
69
  } });
67
- view.setBackgroundColor("#F4F4F4");
70
+ view.setBackgroundColor(args.view?.backgroundColor ?? "#F4F4F4");
68
71
  win.contentView.addChildView(view);
69
72
  const disposeContextMenu = electronContextMenu({
70
73
  window: view,
@@ -153,4 +156,4 @@ var WindowService = class extends serviceWithDeps({
153
156
  };
154
157
  runtime.register(WindowService, import.meta);
155
158
  //#endregion
156
- export { WindowService as t };
159
+ export { window_exports as n, WindowService as t };
@@ -1,4 +1,4 @@
1
- import { n as traceKyjuSync, t as traceKyju } from "./trace-DCB7qFzT.mjs";
1
+ import { n as traceKyjuSync, t as traceKyju } from "./trace-BaVg0rnY.mjs";
2
2
  import * as NFS from "node:fs";
3
3
  import * as OS from "node:os";
4
4
  import * as Path from "node:path";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenbujs/core",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -102,7 +102,7 @@
102
102
  "vite": "^6.0.0",
103
103
  "ws": "^8.18.0",
104
104
  "zod": "^4.3.6",
105
- "@zenbujs/hmr": "0.0.1"
105
+ "@zenbujs/hmr": "0.0.2"
106
106
  },
107
107
  "devDependencies": {
108
108
  "@types/node": "^22.0.0",
@@ -111,9 +111,9 @@
111
111
  "electron": "^42.0.0",
112
112
  "tsdown": "^0.21.10",
113
113
  "typescript": "^5.4.5",
114
- "@zenbu/advice": "0.0.0",
114
+ "@zenbu/zenrpc": "0.0.0",
115
115
  "@zenbu/kyju": "0.0.0",
116
- "@zenbu/zenrpc": "0.0.0"
116
+ "@zenbu/advice": "0.0.0"
117
117
  },
118
118
  "scripts": {
119
119
  "build": "node --max-old-space-size=8192 ./node_modules/tsdown/dist/run.mjs",
@@ -1,2 +0,0 @@
1
- import "./advice-config-BLXjqjGN.mjs";
2
- export {};
@@ -1,2 +0,0 @@
1
- import "./base-window-D8CpxMU3.mjs";
2
- export {};
@@ -1,6 +0,0 @@
1
- import { createRequire } from "node:module";
2
- //#region \0rolldown/runtime.js
3
- var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
4
- var __require = /* @__PURE__ */ createRequire(import.meta.url);
5
- //#endregion
6
- export { __require as n, __commonJSMin as t };
@@ -1,2 +0,0 @@
1
- import { n as loadConfig, t as findConfigFile } from "./config-BlRXeUXx.mjs";
2
- export { findConfigFile, loadConfig };
@@ -1,2 +0,0 @@
1
- import "./renderer-host-ztaSIOGx.mjs";
2
- export {};
@@ -1,53 +0,0 @@
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
53
- export { bootstrapEnv as t };
@@ -1,2 +0,0 @@
1
- import "./renderer-host-ztaSIOGx.mjs";
2
- export {};
@@ -1,2 +0,0 @@
1
- import { n as loadConfig } from "./load-config-BG2tPIfF.mjs";
2
- export { loadConfig };
@@ -1,2 +0,0 @@
1
- import "./reloader-DJoCB0bC.mjs";
2
- export {};
@@ -1,2 +0,0 @@
1
- import "./renderer-host-ztaSIOGx.mjs";
2
- export {};
@@ -1,2 +0,0 @@
1
- import "./rpc-CsgWnlZx.mjs";
2
- export {};