@gjsify/node-gi 0.26.1 → 0.27.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 +57 -12
- package/cairo.d.ts +121 -121
- package/cairo.js +425 -426
- package/gettext.d.ts +24 -24
- package/gettext.js +42 -42
- package/gi.d.ts +170 -122
- package/gi.js +1449 -1460
- package/globals.d.ts +28 -28
- package/globals.js +103 -97
- package/gtk-runtime.js +9 -5
- package/index.d.ts +133 -152
- package/index.js +82 -100
- package/native-paths.js +104 -0
- package/overrides/_signals.js +108 -111
- package/overrides/byte-array.js +135 -135
- package/overrides/gio-dbus.js +681 -658
- package/overrides/mainloop.js +27 -27
- package/overrides/package.js +128 -128
- package/package.json +5 -2
- package/prebuilds/darwin-arm64/node_gi.node +0 -0
- package/prebuilds/darwin-x64/node_gi.node +0 -0
- package/prebuilds/win32-x64/node_gi.node +0 -0
- package/scripts/install.mjs +238 -0
- package/scripts/win-gi-gyp-flags.mjs +2 -11
- package/system.d.ts +13 -13
- package/system.js +35 -35
|
@@ -108,8 +108,7 @@ if (mode === '--includes') {
|
|
|
108
108
|
// Last resort: locate ffi.h anywhere under the tree and add its dir.
|
|
109
109
|
if (!dirs.some((d) => existsSync(join(d, 'ffi.h')))) {
|
|
110
110
|
const ffiDir =
|
|
111
|
-
findHeaderDir(join(prefix, 'include'), 'ffi.h') ??
|
|
112
|
-
findHeaderDir(join(prefix, 'lib'), 'ffi.h');
|
|
111
|
+
findHeaderDir(join(prefix, 'include'), 'ffi.h') ?? findHeaderDir(join(prefix, 'lib'), 'ffi.h');
|
|
113
112
|
if (ffiDir) dirs.push(ffiDir);
|
|
114
113
|
}
|
|
115
114
|
}
|
|
@@ -127,15 +126,7 @@ if (mode === '--includes') {
|
|
|
127
126
|
// cairo the native cairo foreign-struct binding (src/cairo.cc)
|
|
128
127
|
// Pango/GdkPixbuf/Graphene are NOT linked — the conformance programs load their
|
|
129
128
|
// typelibs at RUNTIME (girepository dlopens the DLL by soname), not at link time.
|
|
130
|
-
const DIRECT_LIBS = [
|
|
131
|
-
'girepository-2.0',
|
|
132
|
-
'gio-2.0',
|
|
133
|
-
'gobject-2.0',
|
|
134
|
-
'gmodule-2.0',
|
|
135
|
-
'glib-2.0',
|
|
136
|
-
'ffi',
|
|
137
|
-
'cairo',
|
|
138
|
-
];
|
|
129
|
+
const DIRECT_LIBS = ['girepository-2.0', 'gio-2.0', 'gobject-2.0', 'gmodule-2.0', 'glib-2.0', 'ffi', 'cairo'];
|
|
139
130
|
// Locate the import-lib dir: GTK_PREFIX/lib, else pkg-config's -L.
|
|
140
131
|
const searchDirs = [];
|
|
141
132
|
if (process.env.GTK_PREFIX) searchDirs.push(join(process.env.GTK_PREFIX, 'lib'));
|
package/system.d.ts
CHANGED
|
@@ -30,19 +30,19 @@ export function dumpMemoryInfo(): void;
|
|
|
30
30
|
|
|
31
31
|
/** The GJS `System` module object (`import System from 'system'`). */
|
|
32
32
|
export interface SystemModule {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
33
|
+
exit(code?: number): void;
|
|
34
|
+
gc(): void;
|
|
35
|
+
version: number;
|
|
36
|
+
readonly programArgs: string[];
|
|
37
|
+
readonly programInvocationName: string;
|
|
38
|
+
readonly programPath: string | null;
|
|
39
|
+
addressOf(): string;
|
|
40
|
+
addressOfGObject(): string;
|
|
41
|
+
refcount(): number;
|
|
42
|
+
breakpoint(): void;
|
|
43
|
+
clearDateCaches(): void;
|
|
44
|
+
dumpHeap(): void;
|
|
45
|
+
dumpMemoryInfo(): void;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
declare const System: SystemModule;
|
package/system.js
CHANGED
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
// module is loaded from `@gjsify/node-gi/globals`, before any bundle body (and
|
|
36
36
|
// therefore before any register side effect) runs.
|
|
37
37
|
const runtimeProcess = (() => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
const hostProcess = typeof process !== 'undefined' ? process : undefined;
|
|
39
|
+
try {
|
|
40
|
+
const builtin = hostProcess?.getBuiltinModule?.('node:process');
|
|
41
|
+
if (builtin && typeof builtin.exit === 'function') return builtin;
|
|
42
|
+
} catch {
|
|
43
|
+
// getBuiltinModule missing or refusing the specifier — use the captured one.
|
|
44
|
+
}
|
|
45
|
+
return hostProcess;
|
|
46
46
|
})();
|
|
47
47
|
|
|
48
48
|
const runtimeExit = typeof runtimeProcess?.exit === 'function' ? runtimeProcess.exit.bind(runtimeProcess) : undefined;
|
|
@@ -50,17 +50,17 @@ const runtimeExit = typeof runtimeProcess?.exit === 'function' ? runtimeProcess.
|
|
|
50
50
|
// `programArgs` mirrors GJS's ARGV: the script arguments, excluding the
|
|
51
51
|
// interpreter (argv[0]) and the script path (argv[1]).
|
|
52
52
|
function readProgramArgs() {
|
|
53
|
-
|
|
53
|
+
return Array.isArray(runtimeProcess?.argv) ? runtimeProcess.argv.slice(2) : [];
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
// `programInvocationName` / `programPath` track the running script — Node's
|
|
57
57
|
// `process.argv[1]`.
|
|
58
58
|
function readProgramInvocationName() {
|
|
59
|
-
|
|
59
|
+
return runtimeProcess?.argv?.[1] || '';
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
function readProgramPath() {
|
|
63
|
-
|
|
63
|
+
return runtimeProcess?.argv?.[1] || null;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
/**
|
|
@@ -74,12 +74,12 @@ function readProgramPath() {
|
|
|
74
74
|
* `conformance/programs/system-exit-lifetime.conf.mjs`).
|
|
75
75
|
*/
|
|
76
76
|
export function exit(code) {
|
|
77
|
-
|
|
77
|
+
if (runtimeExit !== undefined) runtimeExit(code ?? 0);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
/** Trigger a garbage collection if the host exposed `globalThis.gc` (`--expose-gc`). */
|
|
81
81
|
export function gc() {
|
|
82
|
-
|
|
82
|
+
if (typeof globalThis.gc === 'function') globalThis.gc();
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
/** The SpiderMonkey/mozjs version number — no equivalent on Node, reported as 0. */
|
|
@@ -96,17 +96,17 @@ export const programPath = readProgramPath();
|
|
|
96
96
|
|
|
97
97
|
/** Return the address of a JS object as a string. No Node equivalent — stub. */
|
|
98
98
|
export function addressOf() {
|
|
99
|
-
|
|
99
|
+
return '0x0';
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
/** Return the address of a GObject as a string. No Node equivalent — stub. */
|
|
103
103
|
export function addressOfGObject() {
|
|
104
|
-
|
|
104
|
+
return '0x0';
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
/** Return the refcount of a GObject. No Node equivalent — stub. */
|
|
108
108
|
export function refcount() {
|
|
109
|
-
|
|
109
|
+
return 0;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
/** Trigger a debugger breakpoint. No-op on Node. */
|
|
@@ -128,25 +128,25 @@ export function dumpMemoryInfo() {}
|
|
|
128
128
|
* track the running script.
|
|
129
129
|
*/
|
|
130
130
|
const System = {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
131
|
+
exit,
|
|
132
|
+
gc,
|
|
133
|
+
version,
|
|
134
|
+
addressOf,
|
|
135
|
+
addressOfGObject,
|
|
136
|
+
refcount,
|
|
137
|
+
breakpoint,
|
|
138
|
+
clearDateCaches,
|
|
139
|
+
dumpHeap,
|
|
140
|
+
dumpMemoryInfo,
|
|
141
|
+
get programArgs() {
|
|
142
|
+
return readProgramArgs();
|
|
143
|
+
},
|
|
144
|
+
get programInvocationName() {
|
|
145
|
+
return readProgramInvocationName();
|
|
146
|
+
},
|
|
147
|
+
get programPath() {
|
|
148
|
+
return readProgramPath();
|
|
149
|
+
},
|
|
150
150
|
};
|
|
151
151
|
|
|
152
152
|
export default System;
|