@gjsify/node-gi 0.27.1 → 0.29.0

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/README.md CHANGED
@@ -721,7 +721,10 @@ property get/set through `org.freedesktop.DBus.Properties`, a throwing method
721
721
  returning a DBus error, `emit_signal`, `emit_property_changed` updating a
722
722
  proxy's cached property, and unexport — runs byte-identical to gjs
723
723
  (`dbus/export-scenario.mjs`, cross-checked against `gjs -m` under
724
- `dbus-run-session` by `npm run test:dbus`). Lifetime: the registration ref+sinks
724
+ `dbus-run-session` by `npm run test:dbus`, which passes
725
+ `--config-file=test/session.conf` — a plain `unix:tmpdir=/tmp` bus, because
726
+ dbus-run-session's DEFAULT config cannot start on macOS, where Homebrew's dbus
727
+ listens on launchd). Lifetime: the registration ref+sinks
725
728
  its closures, so the service object lives exactly as long as the registration
726
729
  (surviving GC with no JS references) and becomes collectable after
727
730
  `unexport()` — guarded by the `--expose-gc` leg of the dbus suite. A method
package/gtk-runtime.js CHANGED
@@ -113,8 +113,15 @@ export function maybeReexecForGtkRuntime() {
113
113
  // re-launched with a Node argv — and `createRequire` there is
114
114
  // @gjsify/module's polyfill, which rejects synchronous BUILTIN loads, so even
115
115
  // REACHING the child_process require below would throw during module init.
116
- // Nothing needs the repair anyway: gjs itself resolves these leaves (its
117
- // binary carries the rpath this whole module exists to compensate for).
116
+ // The re-exec is therefore IMPOSSIBLE here, not merely unnecessary — and the
117
+ // gap is real: gjs's own rpath covers the GLIB-family leaves it links against,
118
+ // but MEASURED on the macOS 15.7.8 VM that rpath points at glib's keg ALONE
119
+ // (`…/opt/glib/lib`), so a bare-leaf `libgtk-4.1.dylib` fails under plain gjs
120
+ // exactly as it did under node. Repairing it belongs to whoever LAUNCHES the
121
+ // gjs process, one hop earlier: `buildNativeEnv()` in `@gjsify/cli` puts
122
+ // `systemGiLibraryDirs()` on the child's `DYLD_FALLBACK_LIBRARY_PATH` (its
123
+ // `system-gi.ts` is the pinned mirror of this module's `system-gi.js`). A gjs
124
+ // launched by hand keeps the gap — tracked in `status/open-todos.md`.
118
125
  // Same probe index.js uses for RUNTIME — as with the Bun/Deno pair above, the
119
126
  // check has to live here too because this runs before that const is defined.
120
127
  if (typeof globalThis.imports !== 'undefined' && typeof globalThis.print === 'function') return;
@@ -219,6 +226,15 @@ export function maybeWireGtkWindowingEnv() {
219
226
  };
220
227
  setIfUnset('GSETTINGS_SCHEMA_DIR', schemaDir);
221
228
 
229
+ // MODULE_FILE is the load-bearing one on BOTH platforms — it is the cache, and the
230
+ // cache is what names the modules. MODULEDIR only resolves a RELATIVE module path in
231
+ // that cache, and only where gdk-pixbuf was built relocatable: measured on macOS with
232
+ // Homebrew's gdk-pixbuf 2.44.7, the string `GDK_PIXBUF_MODULEDIR` is not in the dylib
233
+ // at all, so the darwin bundle's cache instead names each module `@loader_path/…`
234
+ // (relative to the image that dlopens it, i.e. the bundle's lib/) and resolves with no
235
+ // env beyond this file. gvsbuild's win32 build IS relocatable, so MODULEDIR is what
236
+ // its bare-leaf cache needs — hence both are set, and neither platform depends on the
237
+ // other's mechanism.
222
238
  const loaderCache = join(bundle.dir, 'lib', 'gdk-pixbuf-2.0', '2.10.0', 'loaders.cache');
223
239
  if (existsSync(loaderCache)) {
224
240
  setIfUnset('GDK_PIXBUF_MODULEDIR', join(bundle.dir, 'lib', 'gdk-pixbuf-2.0', '2.10.0', 'loaders'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/node-gi",
3
- "version": "0.27.1",
3
+ "version": "0.29.0",
4
4
  "description": "GObject-Introspection runtime for Node.js — load gi:// namespaces (GLib/GObject/Gio/…) with GJS-compatible semantics. Vendored + rewritten from node-gtk under MIT.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -88,7 +88,7 @@
88
88
  "test": "NODE_GI_NATIVE=build node --test",
89
89
  "test:node": "NODE_GI_NATIVE=build node --test",
90
90
  "test:gc": "NODE_GI_NATIVE=build node --test --expose-gc",
91
- "test:dbus": "dbus-run-session -- env NODE_GI_NATIVE=build node --test --expose-gc test/dbus.test.mjs test/dbus-async.test.mjs",
91
+ "test:dbus": "dbus-run-session --config-file=test/session.conf -- env NODE_GI_NATIVE=build node --test --expose-gc test/dbus.test.mjs test/dbus-async.test.mjs",
92
92
  "test:bun": "node scripts/cross-runtime.mjs bun",
93
93
  "test:conformance": "node scripts/conformance.mjs",
94
94
  "test:conformance:gjs-napi": "node scripts/conformance.mjs --runtimes=gjs-napi",
Binary file
Binary file
Binary file
Binary file
Binary file
package/system-gi.js CHANGED
@@ -42,6 +42,17 @@
42
42
  // `hostTarget()` beside it and the CLI's `resolvePrebuildDirName()` — so the
43
43
  // darwin branch is unit-testable from a Linux host and the host values are read
44
44
  // only at the outermost call site, as defaults.
45
+ //
46
+ // MIRRORED, DELIBERATELY, in `packages/infra/cli/src/utils/system-gi.ts`. The
47
+ // same loader gap breaks a `gjs` child too (Homebrew's `gjs` has an rpath into
48
+ // GLIB's keg only, so it resolves no other keg's leaves — measured, trace in that
49
+ // file), and `gjsify run/showcase/storybook` must repair it in the env it hands
50
+ // the child. The CLI cannot IMPORT this module: ADR 0005 Decision 2 forbids a
51
+ // Tier-1 package taking a dependency edge on `@gjsify/node-gi`. So the port is
52
+ // pinned by an agreement test — `packages/infra/cli/src/utils/system-gi.spec.ts`
53
+ // imports THIS file by relative path and asserts both implementations return
54
+ // identical arrays for a table of injected inputs. Change one, change both; the
55
+ // eventual lift to a shared package is tracked in `status/open-todos.md`.
45
56
  import { statSync } from 'node:fs';
46
57
  import { createRequire } from 'node:module';
47
58
  import { basename, dirname, join } from 'node:path';