@zenbujs/core 0.0.14 → 0.0.15

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/launcher.mjs CHANGED
@@ -18284,10 +18284,42 @@ function electronTargetVersion(appsDir) {
18284
18284
  return "42.0.0";
18285
18285
  }
18286
18286
  }
18287
- function buildInstallEnv(appsDir) {
18287
+ /**
18288
+ * Build the env used to spawn `pnpm install` (and friends) on first
18289
+ * launch. The bundled toolchain (`<resourcesPath>/toolchain/`) holds
18290
+ * `node` and `bun` binaries; we prepend that dir to PATH so dependency
18291
+ * install hooks with `#!/usr/bin/env node` shebangs (`@parcel/watcher`,
18292
+ * `dugite`, etc.) resolve to the bundled node regardless of how the
18293
+ * .app was launched.
18294
+ *
18295
+ * GUI launches (Finder, Raycast, Spotlight, `open <app>`) inherit a
18296
+ * stripped PATH like `/usr/bin:/bin:/usr/sbin:/sbin`, so without this
18297
+ * prepend the lifecycle scripts crash with `node: command not found`.
18298
+ * We also baseline-merge the standard system bin dirs in case the
18299
+ * inherited PATH lacks them entirely.
18300
+ */
18301
+ function buildInstallEnv(appsDir, resourcesPath) {
18288
18302
  const target = electronTargetVersion(appsDir);
18303
+ const sep = process.platform === "win32" ? ";" : ":";
18304
+ const baselinePath = process.env.PATH ?? process.env.Path ?? "";
18305
+ const toolchainDir = resourcesPath ? path.join(resourcesPath, "toolchain") : null;
18306
+ const systemDirs = process.platform === "win32" ? [] : [
18307
+ "/usr/local/bin",
18308
+ "/usr/bin",
18309
+ "/bin",
18310
+ "/usr/sbin",
18311
+ "/sbin"
18312
+ ];
18313
+ const segments = [];
18314
+ if (toolchainDir) segments.push(toolchainDir);
18315
+ if (baselinePath) segments.push(...baselinePath.split(sep));
18316
+ segments.push(...systemDirs);
18317
+ const seen = /* @__PURE__ */ new Set();
18318
+ const PATH = segments.filter((s) => s && !seen.has(s) && seen.add(s)).join(sep);
18289
18319
  return {
18290
18320
  ...process.env,
18321
+ PATH,
18322
+ Path: PATH,
18291
18323
  CI: "true",
18292
18324
  HOME: path.join(appsDir, ".zenbu", ".node-gyp"),
18293
18325
  npm_config_runtime: "electron",
@@ -18398,7 +18430,7 @@ function spawnInstall(args) {
18398
18430
  }
18399
18431
  async function runInstall(opts) {
18400
18432
  const { appsDir, resourcesPath, pm, reporter = null, signal } = opts;
18401
- const env = buildInstallEnv(appsDir);
18433
+ const env = buildInstallEnv(appsDir, resourcesPath);
18402
18434
  const entry = bundledPmEntry(pm, resourcesPath);
18403
18435
  switch (pm.type) {
18404
18436
  case "pnpm": {
@@ -13,7 +13,7 @@ async function defaultServices() {
13
13
  await import("../renderer-host-Cw38dSDe.mjs").then((n) => n.i);
14
14
  await import("../window-DgB70qeZ.mjs").then((n) => n.n);
15
15
  await import("../runtime-DYUONc3S.mjs").then((n) => n.h);
16
- await import("../updater-Bs1Jtem6.mjs").then((n) => n.n);
16
+ await import("../updater-C6mWMmb5.mjs").then((n) => n.n);
17
17
  }
18
18
  //#endregion
19
19
  export { defaultServices };
@@ -4,5 +4,5 @@ import { a as DbService, r as ViewRegistryService, s as HttpService, t as Render
4
4
  import { n as MAIN_WINDOW_ID, t as BaseWindowService } from "../base-window-4P-fVvC_.mjs";
5
5
  import { t as RpcService } from "../rpc-Dg9zwZ33.mjs";
6
6
  import { t as WindowService } from "../window-DgB70qeZ.mjs";
7
- import { t as UpdaterService } from "../updater-Bs1Jtem6.mjs";
7
+ import { t as UpdaterService } from "../updater-C6mWMmb5.mjs";
8
8
  export { BaseWindowService, DbService, HttpService, MAIN_WINDOW_ID, ReloaderService, RendererHostService, RpcService, ServerService, UpdaterService, ViewRegistryService, WindowService };
@@ -94,10 +94,42 @@ function electronTargetVersion(appsDir) {
94
94
  return "42.0.0";
95
95
  }
96
96
  }
97
- function buildInstallEnv(appsDir) {
97
+ /**
98
+ * Build the env used to spawn `pnpm install` (and friends) on first
99
+ * launch. The bundled toolchain (`<resourcesPath>/toolchain/`) holds
100
+ * `node` and `bun` binaries; we prepend that dir to PATH so dependency
101
+ * install hooks with `#!/usr/bin/env node` shebangs (`@parcel/watcher`,
102
+ * `dugite`, etc.) resolve to the bundled node regardless of how the
103
+ * .app was launched.
104
+ *
105
+ * GUI launches (Finder, Raycast, Spotlight, `open <app>`) inherit a
106
+ * stripped PATH like `/usr/bin:/bin:/usr/sbin:/sbin`, so without this
107
+ * prepend the lifecycle scripts crash with `node: command not found`.
108
+ * We also baseline-merge the standard system bin dirs in case the
109
+ * inherited PATH lacks them entirely.
110
+ */
111
+ function buildInstallEnv(appsDir, resourcesPath) {
98
112
  const target = electronTargetVersion(appsDir);
113
+ const sep = process.platform === "win32" ? ";" : ":";
114
+ const baselinePath = process.env.PATH ?? process.env.Path ?? "";
115
+ const toolchainDir = resourcesPath ? path.join(resourcesPath, "toolchain") : null;
116
+ const systemDirs = process.platform === "win32" ? [] : [
117
+ "/usr/local/bin",
118
+ "/usr/bin",
119
+ "/bin",
120
+ "/usr/sbin",
121
+ "/sbin"
122
+ ];
123
+ const segments = [];
124
+ if (toolchainDir) segments.push(toolchainDir);
125
+ if (baselinePath) segments.push(...baselinePath.split(sep));
126
+ segments.push(...systemDirs);
127
+ const seen = /* @__PURE__ */ new Set();
128
+ const PATH = segments.filter((s) => s && !seen.has(s) && seen.add(s)).join(sep);
99
129
  return {
100
130
  ...process.env,
131
+ PATH,
132
+ Path: PATH,
101
133
  CI: "true",
102
134
  HOME: path.join(appsDir, ".zenbu", ".node-gyp"),
103
135
  npm_config_runtime: "electron",
@@ -208,7 +240,7 @@ function spawnInstall(args) {
208
240
  }
209
241
  async function runInstall(opts) {
210
242
  const { appsDir, resourcesPath, pm, reporter = null, signal } = opts;
211
- const env = buildInstallEnv(appsDir);
243
+ const env = buildInstallEnv(appsDir, resourcesPath);
212
244
  const entry = bundledPmEntry(pm, resourcesPath);
213
245
  switch (pm.type) {
214
246
  case "pnpm": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenbujs/core",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -123,9 +123,9 @@
123
123
  "typescript": "^5.4.5",
124
124
  "vitest": "^3.2.4",
125
125
  "zod": "^4",
126
- "@zenbu/kyju": "0.0.0",
127
126
  "@zenbu/advice": "0.0.0",
128
- "@zenbu/zenrpc": "0.0.0"
127
+ "@zenbu/zenrpc": "0.0.0",
128
+ "@zenbu/kyju": "0.0.0"
129
129
  },
130
130
  "scripts": {
131
131
  "build": "node --max-old-space-size=8192 ./node_modules/tsdown/dist/run.mjs",