@gjsify/node-gi 0.53.0 → 0.55.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/binding.gyp CHANGED
@@ -68,6 +68,9 @@
68
68
  # `xcode_settings`, so the flags come from pkg-config via a helper that
69
69
  # emits BARE include dirs + FULL .lib paths (scripts/win-gi-gyp-flags.mjs) —
70
70
  # the exact shapes gyp forwards to cl.exe / link.exe.
71
+ # CRT: node_gi.node links the static CRT, GLib the dynamic one (as on the published
72
+ # win32-x64). Only memory GLib allocates AND frees may cross: never free GLib memory
73
+ # with the addon's CRT, or the addon's with GLib's.
71
74
  "include_dirs": [
72
75
  "<!@(node scripts/win-gi-gyp-flags.mjs --includes)"
73
76
  ],
package/gtk-runtime.d.ts CHANGED
@@ -13,6 +13,8 @@ export function maybeReexecForGtkRuntime(): void;
13
13
  export function maybePrependGtkRuntimeDllPath(): void;
14
14
  /** Windows: wire the env for a full-windowing bundle's runtime data — GSettings schemas, gdk-pixbuf loaders, icon themes, fontconfig (no-op off win32 / for a display-free bundle). */
15
15
  export function maybeWireGtkWindowingEnv(): void;
16
+ /** darwin: point libgda at the bundle's SQLite provider via `GDA_TOP_BUILD_DIR` (only when unset; no-op for a bundle without `lib/libgda-6.0/providers`). */
17
+ export function wireGdaProviders(bundle: { dir: string }): void;
16
18
  /** Activate the bundled GTK runtime for the native engine, if one is present. */
17
19
  export function activateBundledGtkRuntime(native: {
18
20
  prependSearchPath: (p: string) => void;
package/gtk-runtime.js CHANGED
@@ -625,6 +625,26 @@ export function maybeWireGtkWindowingEnv() {
625
625
  if (existsSync(gioModules)) setIfUnset('GIO_MODULE_DIR', gioModules);
626
626
  }
627
627
 
628
+ /**
629
+ * Point libgda at the bundle's database providers (darwin; `@gjsify/sqlite` / `node:sqlite`).
630
+ *
631
+ * libgda loads a provider as a GModule from a directory COMPILED IN as the build prefix —
632
+ * `<keg>/lib/libgda-6.0/providers` — and, with that keg absent, `Gda.Connection.new_from_string
633
+ * ('SQLite', …)` throws `No provider 'SQLite' installed`. With the keg PRESENT it is worse: brew's
634
+ * provider loads against brew's libgda and glib beside the bundle's own. The one override libgda
635
+ * has is `GDA_TOP_BUILD_DIR`, read as `<dir>/providers` at the first provider scan, which is long
636
+ * after this runs. In the JS and not in a launcher for the reason `GJSIFY_GI_LIBRARY_PATH` is:
637
+ * a signed app loses `DYLD_*`, never `process.env`.
638
+ * Set only when unset, so an operator pointing libgda elsewhere wins; a no-op for a bundle
639
+ * that carries no provider dir.
640
+ * @param {{ dir: string }} bundle
641
+ */
642
+ export function wireGdaProviders(bundle) {
643
+ const gdaDir = join(bundle.dir, 'lib', 'libgda-6.0');
644
+ if (!existsSync(join(gdaDir, 'providers'))) return;
645
+ if (!process.env.GDA_TOP_BUILD_DIR) process.env.GDA_TOP_BUILD_DIR = gdaDir;
646
+ }
647
+
628
648
  /** The plugin scanner's leaf name — the bundles ship the same tree on both OSes. */
629
649
  function gstScannerLeaf() {
630
650
  return process.platform === 'win32' ? 'gst-plugin-scanner.exe' : 'gst-plugin-scanner';
@@ -790,6 +810,7 @@ export function activateBundledGtkRuntime(native) {
790
810
  // variable REPLACES rather than extends.
791
811
  process.env.DYLD_FALLBACK_LIBRARY_PATH = composeDyldFallback([bundle.libDir]);
792
812
  }
813
+ wireGdaProviders(bundle);
793
814
  }
794
815
 
795
816
  activated = bundle;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjsify/node-gi",
3
- "version": "0.53.0",
3
+ "version": "0.55.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",
@@ -71,7 +71,8 @@
71
71
  "linux-arm64",
72
72
  "darwin-arm64",
73
73
  "darwin-x64",
74
- "win32-x64"
74
+ "win32-x64",
75
+ "win32-arm64"
75
76
  ],
76
77
  "runtimes": {
77
78
  "gjs": "none",
Binary file
Binary file
Binary file
Binary file
Binary file
package/src/object.cc CHANGED
@@ -641,6 +641,12 @@ Napi::Value ConstructGObject(Napi::Env env, GType gtype, Napi::Object props,
641
641
  // Take a single strong, non-floating ref; the finalizer releases it.
642
642
  if (g_object_is_floating(obj)) {
643
643
  g_object_ref_sink(obj);
644
+ } else if (G_IS_INITIALLY_UNOWNED(obj)) {
645
+ // GtkWindow sinks its own floating ref and keeps it for the toplevel list,
646
+ // so g_object_new returned no ref to us. Adopting GTK's ref let destroy()
647
+ // finalize the window under a live JS handle (#1999). gjs takes the same
648
+ // extra ref (refs/gjs/gi/object.cpp, "GtkWindow does not return a ref").
649
+ g_object_ref(obj);
644
650
  }
645
651
  // Gtk.Widget composite template: instantiate the template tree on this
646
652
  // instance. The canonical GTK call is from instance_init; calling it here —