@gtkx/native 1.6.0 → 2.0.0-beta.10
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 +47 -44
- package/index.d.ts +59 -18
- package/index.js +59 -56
- package/internal.d.ts +1 -0
- package/internal.js +1 -0
- package/main.d.ts +20 -0
- package/main.js +13 -1
- package/package.json +27 -68
- /package/{init.js → bootstrap.js} +0 -0
package/README.md
CHANGED
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
<h1 align="center">GTKX</h1>
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
8
|
-
The React framework for Linux
|
|
9
|
-
Write native
|
|
10
|
-
Real
|
|
8
|
+
The React framework for Linux.<br />
|
|
9
|
+
Write native GNOME applications with React and TypeScript.
|
|
10
|
+
Real Adwaita and GTK4 widgets with standard web tooling.
|
|
11
11
|
</p>
|
|
12
12
|
|
|
13
13
|
<p align="center">
|
|
14
14
|
<a href="https://www.npmjs.com/package/create-gtkx"><img src="https://img.shields.io/npm/v/create-gtkx?color=cb3837&logo=npm&label=create-gtkx" alt="npm version" /></a>
|
|
15
15
|
<a href="https://www.npmjs.com/package/create-gtkx"><img src="https://img.shields.io/npm/dm/create-gtkx?color=cb3837&logo=npm&label=downloads" alt="npm downloads" /></a>
|
|
16
|
-
<img src="https://img.shields.io/badge/node-%E2%89%
|
|
16
|
+
<img src="https://img.shields.io/badge/node-%E2%89%A526.7-339933?logo=node.js&logoColor=white" alt="Node >= 26.7" />
|
|
17
17
|
<a href="https://github.com/gtkx-org/gtkx/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MPL--2.0-blue.svg" alt="License: MPL-2.0" /></a>
|
|
18
18
|
<a href="https://github.com/gtkx-org/gtkx/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/gtkx-org/gtkx/ci.yml?branch=main&logo=github&label=CI" alt="CI status" /></a>
|
|
19
19
|
<img src="https://img.shields.io/badge/TypeScript-strict-3178c6?logo=typescript&logoColor=white" alt="TypeScript" />
|
|
@@ -38,11 +38,12 @@
|
|
|
38
38
|
|
|
39
39
|
## Demo
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
This app starts with an Adwaita application shell, renders native GTK4 widgets inside it, and uses ordinary React hooks and events:
|
|
42
42
|
|
|
43
43
|
```tsx
|
|
44
44
|
import * as Gtk from "@gtkx/gi/gtk";
|
|
45
|
-
import {
|
|
45
|
+
import { AdwApplication, AdwApplicationWindow, AdwHeaderBar, AdwToolbarView } from "@gtkx/jsx/adw";
|
|
46
|
+
import { GtkBox, GtkButton, GtkLabel } from "@gtkx/jsx/gtk";
|
|
46
47
|
import { createRoot, quit } from "@gtkx/react";
|
|
47
48
|
import { useState } from "react";
|
|
48
49
|
|
|
@@ -50,38 +51,40 @@ const Counter = () => {
|
|
|
50
51
|
const [count, setCount] = useState(0);
|
|
51
52
|
|
|
52
53
|
return (
|
|
53
|
-
<
|
|
54
|
+
<AdwApplicationWindow
|
|
54
55
|
title="Hello GTKX"
|
|
55
56
|
defaultWidth={400}
|
|
56
57
|
defaultHeight={300}
|
|
57
58
|
onCloseRequest={quit}
|
|
58
59
|
>
|
|
59
|
-
<
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
60
|
+
<AdwToolbarView topBar={<AdwHeaderBar />}>
|
|
61
|
+
<GtkBox
|
|
62
|
+
orientation={Gtk.Orientation.VERTICAL}
|
|
63
|
+
spacing={20}
|
|
64
|
+
marginTop={40}
|
|
65
|
+
marginBottom={40}
|
|
66
|
+
marginStart={40}
|
|
67
|
+
marginEnd={40}
|
|
68
|
+
valign={Gtk.Align.CENTER}
|
|
69
|
+
halign={Gtk.Align.CENTER}
|
|
70
|
+
>
|
|
71
|
+
<GtkLabel cssClasses={["title-1"]}>Welcome to GTKX!</GtkLabel>
|
|
72
|
+
<GtkLabel cssClasses={["title-2"]}>{`Count: ${String(count)}`}</GtkLabel>
|
|
73
|
+
<GtkButton
|
|
74
|
+
label="Increment"
|
|
75
|
+
onClicked={() => setCount((c) => c + 1)}
|
|
76
|
+
cssClasses={["suggested-action", "pill"]}
|
|
77
|
+
/>
|
|
78
|
+
</GtkBox>
|
|
79
|
+
</AdwToolbarView>
|
|
80
|
+
</AdwApplicationWindow>
|
|
78
81
|
);
|
|
79
82
|
};
|
|
80
83
|
|
|
81
84
|
const App = () => (
|
|
82
|
-
<
|
|
85
|
+
<AdwApplication>
|
|
83
86
|
<Counter />
|
|
84
|
-
</
|
|
87
|
+
</AdwApplication>
|
|
85
88
|
);
|
|
86
89
|
|
|
87
90
|
createRoot().render(<App />);
|
|
@@ -91,9 +94,9 @@ This is the [`hello-world`](https://github.com/gtkx-org/gtkx/tree/main/examples/
|
|
|
91
94
|
|
|
92
95
|
## Why GTKX
|
|
93
96
|
|
|
94
|
-
###
|
|
97
|
+
### Adwaita-first application development
|
|
95
98
|
|
|
96
|
-
|
|
99
|
+
GTKX uses Adwaita as the foundation for applications, windows, navigation, dialogs, and adaptive layouts, with the complete GTK4 toolkit underneath. It adds a declarative React layer and an integrated TypeScript toolchain to the GNOME platform:
|
|
97
100
|
|
|
98
101
|
- a React reconciler that exposes every GObject as a JSX element,
|
|
99
102
|
- a CLI for scaffolding, development, and production builds,
|
|
@@ -102,29 +105,29 @@ GTK4 is mature, and GtkBuilder XML can lay out a static interface, but nothing r
|
|
|
102
105
|
- a Testing Library-style API for querying and driving your widgets in tests,
|
|
103
106
|
- and a Model Context Protocol (MCP) server that exposes your live app to AI agents.
|
|
104
107
|
|
|
105
|
-
###
|
|
108
|
+
### Native GNOME widgets, without a compatibility layer
|
|
106
109
|
|
|
107
|
-
React Native and similar frameworks hide the native toolkit so one API can run everywhere. GTKX
|
|
110
|
+
React Native and similar frameworks hide the native toolkit so one API can run everywhere. GTKX renders real Adwaita and GTK4 widgets and exposes any other GObject-Introspection library on your system. It is GNOME-native and Linux-only by design.
|
|
108
111
|
|
|
109
112
|
### Why Node.js, and why generated bindings
|
|
110
113
|
|
|
111
114
|
GTKX runs on Node.js, which puts native modules, the npm ecosystem, and the tooling built for Node.js APIs within reach. GJS is GNOME's own runtime, built on SpiderMonkey rather than V8; node-gtk runs on Node.js but is lightly maintained, on the older nan/V8 ABI rather than N-API, and still centered on GTK3. The [Why GTKX guide](https://gtkx.dev/guide/why-gtkx) covers what running on Node.js means day to day.
|
|
112
115
|
|
|
113
|
-
GTKX generates the TypeScript types and
|
|
116
|
+
GTKX generates the TypeScript types and native FFI calls from the same GObject-Introspection data, so the types cannot drift from the calls they back. `Adw-1` is the sole default GIR root; its GIR include pulls in `Gtk-4.0`, so codegen covers both complete API surfaces. Neither belongs in a GTKX 2 `libraries` list.
|
|
114
117
|
|
|
115
|
-
At runtime, the native Rust core calls straight into the system
|
|
118
|
+
At runtime, the native Rust core calls straight into the system Adwaita, GTK4, and GLib libraries through libffi, without loading libgirepository at all.
|
|
116
119
|
|
|
117
120
|
## Quick start
|
|
118
121
|
|
|
119
|
-
GTKX is Linux-only and needs Node.js
|
|
122
|
+
GTKX is Linux-only and needs Node.js 26.7 or later. See [Requirements](#requirements).
|
|
120
123
|
|
|
121
124
|
Scaffold a new app with the `create-gtkx` initializer:
|
|
122
125
|
|
|
123
126
|
```sh
|
|
124
|
-
npm create gtkx
|
|
127
|
+
npm create gtkx@beta
|
|
125
128
|
```
|
|
126
129
|
|
|
127
|
-
The same command works with other package managers: `pnpm create gtkx` or `yarn create gtkx`.
|
|
130
|
+
The same command works with other package managers: `pnpm create gtkx@beta` or `yarn create gtkx@beta`.
|
|
128
131
|
|
|
129
132
|
Then run your new app:
|
|
130
133
|
|
|
@@ -145,8 +148,8 @@ The documentation at **[gtkx.dev](https://gtkx.dev)** includes a step-by-step tu
|
|
|
145
148
|
|
|
146
149
|
GTKX is Linux-only. You need:
|
|
147
150
|
|
|
148
|
-
- Linux with the
|
|
149
|
-
- Node.js
|
|
151
|
+
- Linux with the Adwaita (1.8 or later), GTK4 (4.20 or later), and GLib development libraries
|
|
152
|
+
- Node.js 26.7 or later
|
|
150
153
|
|
|
151
154
|
The `@gtkx/native` addon ships prebuilt for x64 and arm64 glibc Linux; other targets need to build it from the GTKX repository, which requires a Rust toolchain.
|
|
152
155
|
|
|
@@ -154,10 +157,10 @@ The `@gtkx/native` addon ships prebuilt for x64 and arm64 glibc Linux; other tar
|
|
|
154
157
|
|
|
155
158
|
Explore the [example apps](https://github.com/gtkx-org/gtkx/tree/main/examples):
|
|
156
159
|
|
|
157
|
-
- [`hello-world`](https://github.com/gtkx-org/gtkx/tree/main/examples/hello-world): the counter above.
|
|
158
|
-
- [`gtk-demo`](https://github.com/gtkx-org/gtkx/tree/main/examples/gtk-demo):
|
|
159
|
-
- [`browser`](https://github.com/gtkx-org/gtkx/tree/main/examples/browser):
|
|
160
|
-
- [`animations`](https://github.com/gtkx-org/gtkx/tree/main/examples/animations):
|
|
160
|
+
- [`hello-world`](https://github.com/gtkx-org/gtkx/tree/main/examples/hello-world): the Adwaita counter above.
|
|
161
|
+
- [`gtk-demo`](https://github.com/gtkx-org/gtkx/tree/main/examples/gtk-demo): the official GTK4 widget showcase in an Adwaita application shell, covering lists, dialogs, gestures, CSS, and OpenGL.
|
|
162
|
+
- [`browser`](https://github.com/gtkx-org/gtkx/tree/main/examples/browser): an Adwaita browser built around `WebKitWebView`.
|
|
163
|
+
- [`animations`](https://github.com/gtkx-org/gtkx/tree/main/examples/animations): an Adwaita showcase for `@gtkx/animated`, with React Spring animations driven by the GTK frame clock.
|
|
161
164
|
- [`navigation`](https://github.com/gtkx-org/gtkx/tree/main/examples/navigation): a tour of `@gtkx/navigation`, React Navigation's stack, tab, and drawer navigators rendered with libadwaita.
|
|
162
165
|
- [`tutorial`](https://github.com/gtkx-org/gtkx/tree/main/examples/tutorial): the Tasks app the documentation builds.
|
|
163
166
|
|
|
@@ -167,7 +170,7 @@ GTKX is stable and ready for production use.
|
|
|
167
170
|
|
|
168
171
|
## Contributing
|
|
169
172
|
|
|
170
|
-
Contributions are welcome. See [CONTRIBUTING.md](https://github.com/gtkx-org/gtkx/blob/main/CONTRIBUTING.md), the [Code of Conduct](https://github.com/gtkx-org/gtkx/blob/main/CODE_OF_CONDUCT.md), and the [security policy](https://github.com/gtkx-org/gtkx/blob/main/SECURITY.md). Building the repo needs Node.js
|
|
173
|
+
Contributions are welcome. See [CONTRIBUTING.md](https://github.com/gtkx-org/gtkx/blob/main/CONTRIBUTING.md), the [Code of Conduct](https://github.com/gtkx-org/gtkx/blob/main/CODE_OF_CONDUCT.md), and the [security policy](https://github.com/gtkx-org/gtkx/blob/main/SECURITY.md). Building the repo needs Node.js 26.7 or later, pnpm, and a Rust toolchain.
|
|
171
174
|
|
|
172
175
|
## License
|
|
173
176
|
|
package/index.d.ts
CHANGED
|
@@ -7,13 +7,26 @@ export declare class ExternalObject<T> {
|
|
|
7
7
|
[K: symbol]: T
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Registers `listener` for every `GLib` log record the process writes, whichever thread logs it,
|
|
12
|
+
* and returns the id `removeLogListener` takes. The public `onLog` wrapper in `main.js` pairs the
|
|
13
|
+
* two into a subscription. Records are queued to the JavaScript thread and delivered
|
|
14
|
+
* asynchronously; a level `GLib` treats as fatal aborts the process before the queued delivery
|
|
15
|
+
* runs, and removing a listener does not cancel records already queued for it.
|
|
16
|
+
*/
|
|
17
|
+
export declare function addLogListener(listener: (level: "error" | "critical" | "warning" | "message" | "info" | "debug", domain: string, message: string) => void): number
|
|
18
|
+
|
|
10
19
|
/**
|
|
11
20
|
* Allocates a zero-filled native memory block of `size` bytes and returns an opaque handle to it.
|
|
12
|
-
*
|
|
13
|
-
*
|
|
21
|
+
* A `gtype` naming a registered boxed type selects `g_boxed_free` as the handle's destructor, so a
|
|
22
|
+
* type whose free function has to run is torn down properly. A `gtype` that is registered but not
|
|
23
|
+
* boxed, such as one from `g_pointer_type_register_static`, has no boxed free function to select,
|
|
24
|
+
* so the handle owns the block as a plain struct and releases it with `g_free`.
|
|
14
25
|
*/
|
|
15
26
|
export declare function alloc(size: number, gtype?: bigint | undefined | null): ExternalObject<Handle>
|
|
16
27
|
|
|
28
|
+
export declare function armParentDeath(expectedParent: number, expectedProcessGroupOwner?: number | undefined | null, expectedProcessGroupOwnerStartTime?: string | undefined | null): boolean
|
|
29
|
+
|
|
17
30
|
/**
|
|
18
31
|
* Container layout used to marshal an array: a plain C `array`, a `glist`, `gslist`, `gptrarray`,
|
|
19
32
|
* `garray`, `gbytearray`, a `sized` buffer, a `fixed`-length buffer, or a `cursor` pointing into
|
|
@@ -115,7 +128,9 @@ export type CallbackScope = 'call'|
|
|
|
115
128
|
|
|
116
129
|
/**
|
|
117
130
|
* Copies `size` bytes from the `src` handle's memory into the `dest` handle's memory, rejecting
|
|
118
|
-
* either handle when it points at nothing rather than reading or writing at address zero.
|
|
131
|
+
* either handle when it points at nothing rather than reading or writing at address zero. A
|
|
132
|
+
* handle that records how many bytes it allocated also rejects a size reaching past them; one
|
|
133
|
+
* over memory C returned records no count, so its bounds are the caller's to respect.
|
|
119
134
|
*/
|
|
120
135
|
export declare function copy(dest: ExternalObject<Handle>, src: ExternalObject<Handle>, size: number): unknown
|
|
121
136
|
|
|
@@ -136,21 +151,30 @@ export type Descriptor =
|
|
|
136
151
|
| { kind: 'biguint64' }
|
|
137
152
|
| { kind: 'float32' }
|
|
138
153
|
| { kind: 'float64' }
|
|
139
|
-
| { kind: 'enum', sharedLibrary: string, getTypeFnName: string, isSigned: boolean
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
+
| { kind: 'enum', sharedLibrary: string, getTypeFnName: string, isSigned: boolean, /**
|
|
155
|
+
* Member values of an enumeration with no registered `GType`, which the GIR is the only
|
|
156
|
+
* source of. `None` leaves the membership check to the `GType`'s `GEnumClass`.
|
|
157
|
+
*/
|
|
158
|
+
members?: Array<number> }
|
|
159
|
+
| { kind: 'flags', sharedLibrary: string, getTypeFnName: string, isSigned: boolean, mask?: number }
|
|
160
|
+
| { kind: 'boolean' }
|
|
161
|
+
| { kind: 'string', ownership: Ownership, length?: number, /**
|
|
162
|
+
* Whether the instance holding the slot owns the string in it, so that a write releases
|
|
163
|
+
* what it displaces. Set only on record fields GIR spells as a non-`const` `char *`.
|
|
164
|
+
*/
|
|
165
|
+
hasOwnedStorage?: boolean }
|
|
166
|
+
| { kind: 'object', ownership: Ownership, isCallScoped?: boolean, /** `GType` name of the declared type, which an argument's instance must be one of. */
|
|
167
|
+
typeName?: string }
|
|
168
|
+
| { kind: 'unichar' }
|
|
169
|
+
| { kind: 'void' }
|
|
170
|
+
| { kind: 'buffer' }
|
|
171
|
+
| { kind: 'boxed', ownership: Ownership, typeName: string, sharedLibrary?: string, getTypeFnName?: string, freeFnName?: string, isCallerAllocated?: boolean, size?: number, isInline?: boolean }
|
|
172
|
+
| { kind: 'struct', ownership: Ownership, size?: number, isCallerAllocated?: boolean, isInline?: boolean, sharedLibrary?: string, copyFnName?: string, freeFnName?: string }
|
|
173
|
+
| { kind: 'fundamental', ownership: Ownership, sharedLibrary: string, refFnName: string, unrefFnName: string, typeName?: string, isCallerAllocated?: boolean, isInline?: boolean }
|
|
174
|
+
| { kind: 'array', itemDescriptor: Descriptor, arrayKind: ArrayKind, ownership: Ownership, baseParamIndex?: number, sizeParamIndex?: number, fixedSize?: number, elementSize?: number, isBytes?: boolean, isCallerAllocated?: boolean, isZeroTerminated?: boolean, preserveNull?: boolean }
|
|
175
|
+
| { kind: 'hashtable', keyDescriptor: Descriptor, valueDescriptor: Descriptor, ownership: Ownership }
|
|
176
|
+
| { kind: 'callback', argDescriptors: Array<Descriptor>, returnDescriptor: Descriptor, hasDestroy?: boolean, destroyKind?: DestroyNotifyKind, hasUserData?: boolean, userDataIndex?: number, canThrow?: boolean, scope?: CallbackScope }
|
|
177
|
+
| { kind: 'ref', innerDescriptor: Descriptor, inout?: boolean }
|
|
154
178
|
|
|
155
179
|
/**
|
|
156
180
|
* Signature of the destroy the callee is handed: `destroyNotify` is a `GDestroyNotify`, taking the
|
|
@@ -324,6 +348,12 @@ export interface RegisterClassVfunc {
|
|
|
324
348
|
fn: (...args: never[]) => unknown
|
|
325
349
|
}
|
|
326
350
|
|
|
351
|
+
/**
|
|
352
|
+
* Removes the listener `addLogListener` returned `id` for; an unknown or already removed id is
|
|
353
|
+
* ignored.
|
|
354
|
+
*/
|
|
355
|
+
export declare function removeLogListener(id: number): void
|
|
356
|
+
|
|
327
357
|
/**
|
|
328
358
|
* Calls the `getTypeFnName` registration function in `sharedLibrary` and returns the resulting
|
|
329
359
|
* `GType`, or 0 when the symbol is absent.
|
|
@@ -344,6 +374,17 @@ export declare function setFundamentalWrapper(handle: ExternalObject<Handle>, wr
|
|
|
344
374
|
*/
|
|
345
375
|
export declare function setWrapper(handle: ExternalObject<Handle>, wrapper: object): void
|
|
346
376
|
|
|
377
|
+
/**
|
|
378
|
+
* Resolves `symbolName` in `sharedLibrary` to the address it is exported at. It is how a binding
|
|
379
|
+
* names a C function it never calls itself, for a callee that stores the pointer — the way
|
|
380
|
+
* `g_closure_set_marshal` takes `g_cclosure_marshal_generic`.
|
|
381
|
+
*
|
|
382
|
+
* # Errors
|
|
383
|
+
*
|
|
384
|
+
* Fails when the library cannot be loaded or does not export the symbol.
|
|
385
|
+
*/
|
|
386
|
+
export declare function symbolAddress(sharedLibrary: string, symbolName: string): bigint
|
|
387
|
+
|
|
347
388
|
/**
|
|
348
389
|
* Encodes `value` with `fieldDescriptor` and writes it into the handle's memory at `offset` bytes,
|
|
349
390
|
* rejecting a handle that points at nothing rather than writing at the bare offset.
|
package/index.js
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
import { createRequire } from 'module'
|
|
7
7
|
const require = createRequire(import.meta.url)
|
|
8
|
-
const __dirname = new URL('.', import.meta.url).pathname
|
|
9
8
|
|
|
10
9
|
const { readFileSync } = require('fs')
|
|
11
10
|
let nativeBinding = null
|
|
@@ -81,8 +80,8 @@ function requireNative() {
|
|
|
81
80
|
try {
|
|
82
81
|
const binding = require('@gtkx/native-android-arm64')
|
|
83
82
|
const bindingPackageVersion = require('@gtkx/native-android-arm64/package.json').version
|
|
84
|
-
if (bindingPackageVersion !== '
|
|
85
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
83
|
+
if (bindingPackageVersion !== '2.0.0-beta.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
84
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-beta.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
86
85
|
}
|
|
87
86
|
return binding
|
|
88
87
|
} catch (e) {
|
|
@@ -97,8 +96,8 @@ function requireNative() {
|
|
|
97
96
|
try {
|
|
98
97
|
const binding = require('@gtkx/native-android-arm-eabi')
|
|
99
98
|
const bindingPackageVersion = require('@gtkx/native-android-arm-eabi/package.json').version
|
|
100
|
-
if (bindingPackageVersion !== '
|
|
101
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
99
|
+
if (bindingPackageVersion !== '2.0.0-beta.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
100
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-beta.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
102
101
|
}
|
|
103
102
|
return binding
|
|
104
103
|
} catch (e) {
|
|
@@ -118,8 +117,8 @@ function requireNative() {
|
|
|
118
117
|
try {
|
|
119
118
|
const binding = require('@gtkx/native-win32-x64-gnu')
|
|
120
119
|
const bindingPackageVersion = require('@gtkx/native-win32-x64-gnu/package.json').version
|
|
121
|
-
if (bindingPackageVersion !== '
|
|
122
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
120
|
+
if (bindingPackageVersion !== '2.0.0-beta.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
121
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-beta.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
123
122
|
}
|
|
124
123
|
return binding
|
|
125
124
|
} catch (e) {
|
|
@@ -134,8 +133,8 @@ function requireNative() {
|
|
|
134
133
|
try {
|
|
135
134
|
const binding = require('@gtkx/native-win32-x64-msvc')
|
|
136
135
|
const bindingPackageVersion = require('@gtkx/native-win32-x64-msvc/package.json').version
|
|
137
|
-
if (bindingPackageVersion !== '
|
|
138
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
136
|
+
if (bindingPackageVersion !== '2.0.0-beta.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
137
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-beta.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
139
138
|
}
|
|
140
139
|
return binding
|
|
141
140
|
} catch (e) {
|
|
@@ -151,8 +150,8 @@ function requireNative() {
|
|
|
151
150
|
try {
|
|
152
151
|
const binding = require('@gtkx/native-win32-ia32-msvc')
|
|
153
152
|
const bindingPackageVersion = require('@gtkx/native-win32-ia32-msvc/package.json').version
|
|
154
|
-
if (bindingPackageVersion !== '
|
|
155
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
153
|
+
if (bindingPackageVersion !== '2.0.0-beta.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
154
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-beta.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
156
155
|
}
|
|
157
156
|
return binding
|
|
158
157
|
} catch (e) {
|
|
@@ -167,8 +166,8 @@ function requireNative() {
|
|
|
167
166
|
try {
|
|
168
167
|
const binding = require('@gtkx/native-win32-arm64-msvc')
|
|
169
168
|
const bindingPackageVersion = require('@gtkx/native-win32-arm64-msvc/package.json').version
|
|
170
|
-
if (bindingPackageVersion !== '
|
|
171
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
169
|
+
if (bindingPackageVersion !== '2.0.0-beta.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
170
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-beta.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
172
171
|
}
|
|
173
172
|
return binding
|
|
174
173
|
} catch (e) {
|
|
@@ -186,8 +185,8 @@ function requireNative() {
|
|
|
186
185
|
try {
|
|
187
186
|
const binding = require('@gtkx/native-darwin-universal')
|
|
188
187
|
const bindingPackageVersion = require('@gtkx/native-darwin-universal/package.json').version
|
|
189
|
-
if (bindingPackageVersion !== '
|
|
190
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
188
|
+
if (bindingPackageVersion !== '2.0.0-beta.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
189
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-beta.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
191
190
|
}
|
|
192
191
|
return binding
|
|
193
192
|
} catch (e) {
|
|
@@ -202,8 +201,8 @@ function requireNative() {
|
|
|
202
201
|
try {
|
|
203
202
|
const binding = require('@gtkx/native-darwin-x64')
|
|
204
203
|
const bindingPackageVersion = require('@gtkx/native-darwin-x64/package.json').version
|
|
205
|
-
if (bindingPackageVersion !== '
|
|
206
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
204
|
+
if (bindingPackageVersion !== '2.0.0-beta.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
205
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-beta.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
207
206
|
}
|
|
208
207
|
return binding
|
|
209
208
|
} catch (e) {
|
|
@@ -218,8 +217,8 @@ function requireNative() {
|
|
|
218
217
|
try {
|
|
219
218
|
const binding = require('@gtkx/native-darwin-arm64')
|
|
220
219
|
const bindingPackageVersion = require('@gtkx/native-darwin-arm64/package.json').version
|
|
221
|
-
if (bindingPackageVersion !== '
|
|
222
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
220
|
+
if (bindingPackageVersion !== '2.0.0-beta.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
221
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-beta.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
223
222
|
}
|
|
224
223
|
return binding
|
|
225
224
|
} catch (e) {
|
|
@@ -238,8 +237,8 @@ function requireNative() {
|
|
|
238
237
|
try {
|
|
239
238
|
const binding = require('@gtkx/native-freebsd-x64')
|
|
240
239
|
const bindingPackageVersion = require('@gtkx/native-freebsd-x64/package.json').version
|
|
241
|
-
if (bindingPackageVersion !== '
|
|
242
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
240
|
+
if (bindingPackageVersion !== '2.0.0-beta.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
241
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-beta.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
243
242
|
}
|
|
244
243
|
return binding
|
|
245
244
|
} catch (e) {
|
|
@@ -254,8 +253,8 @@ function requireNative() {
|
|
|
254
253
|
try {
|
|
255
254
|
const binding = require('@gtkx/native-freebsd-arm64')
|
|
256
255
|
const bindingPackageVersion = require('@gtkx/native-freebsd-arm64/package.json').version
|
|
257
|
-
if (bindingPackageVersion !== '
|
|
258
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
256
|
+
if (bindingPackageVersion !== '2.0.0-beta.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
257
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-beta.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
259
258
|
}
|
|
260
259
|
return binding
|
|
261
260
|
} catch (e) {
|
|
@@ -275,8 +274,8 @@ function requireNative() {
|
|
|
275
274
|
try {
|
|
276
275
|
const binding = require('@gtkx/native-linux-x64-musl')
|
|
277
276
|
const bindingPackageVersion = require('@gtkx/native-linux-x64-musl/package.json').version
|
|
278
|
-
if (bindingPackageVersion !== '
|
|
279
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
277
|
+
if (bindingPackageVersion !== '2.0.0-beta.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
278
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-beta.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
280
279
|
}
|
|
281
280
|
return binding
|
|
282
281
|
} catch (e) {
|
|
@@ -291,8 +290,8 @@ function requireNative() {
|
|
|
291
290
|
try {
|
|
292
291
|
const binding = require('@gtkx/native-linux-x64-gnu')
|
|
293
292
|
const bindingPackageVersion = require('@gtkx/native-linux-x64-gnu/package.json').version
|
|
294
|
-
if (bindingPackageVersion !== '
|
|
295
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
293
|
+
if (bindingPackageVersion !== '2.0.0-beta.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
294
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-beta.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
296
295
|
}
|
|
297
296
|
return binding
|
|
298
297
|
} catch (e) {
|
|
@@ -309,8 +308,8 @@ function requireNative() {
|
|
|
309
308
|
try {
|
|
310
309
|
const binding = require('@gtkx/native-linux-arm64-musl')
|
|
311
310
|
const bindingPackageVersion = require('@gtkx/native-linux-arm64-musl/package.json').version
|
|
312
|
-
if (bindingPackageVersion !== '
|
|
313
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
311
|
+
if (bindingPackageVersion !== '2.0.0-beta.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
312
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-beta.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
314
313
|
}
|
|
315
314
|
return binding
|
|
316
315
|
} catch (e) {
|
|
@@ -325,8 +324,8 @@ function requireNative() {
|
|
|
325
324
|
try {
|
|
326
325
|
const binding = require('@gtkx/native-linux-arm64-gnu')
|
|
327
326
|
const bindingPackageVersion = require('@gtkx/native-linux-arm64-gnu/package.json').version
|
|
328
|
-
if (bindingPackageVersion !== '
|
|
329
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
327
|
+
if (bindingPackageVersion !== '2.0.0-beta.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
328
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-beta.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
330
329
|
}
|
|
331
330
|
return binding
|
|
332
331
|
} catch (e) {
|
|
@@ -343,8 +342,8 @@ function requireNative() {
|
|
|
343
342
|
try {
|
|
344
343
|
const binding = require('@gtkx/native-linux-arm-musleabihf')
|
|
345
344
|
const bindingPackageVersion = require('@gtkx/native-linux-arm-musleabihf/package.json').version
|
|
346
|
-
if (bindingPackageVersion !== '
|
|
347
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
345
|
+
if (bindingPackageVersion !== '2.0.0-beta.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
346
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-beta.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
348
347
|
}
|
|
349
348
|
return binding
|
|
350
349
|
} catch (e) {
|
|
@@ -359,8 +358,8 @@ function requireNative() {
|
|
|
359
358
|
try {
|
|
360
359
|
const binding = require('@gtkx/native-linux-arm-gnueabihf')
|
|
361
360
|
const bindingPackageVersion = require('@gtkx/native-linux-arm-gnueabihf/package.json').version
|
|
362
|
-
if (bindingPackageVersion !== '
|
|
363
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
361
|
+
if (bindingPackageVersion !== '2.0.0-beta.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
362
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-beta.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
364
363
|
}
|
|
365
364
|
return binding
|
|
366
365
|
} catch (e) {
|
|
@@ -377,8 +376,8 @@ function requireNative() {
|
|
|
377
376
|
try {
|
|
378
377
|
const binding = require('@gtkx/native-linux-loong64-musl')
|
|
379
378
|
const bindingPackageVersion = require('@gtkx/native-linux-loong64-musl/package.json').version
|
|
380
|
-
if (bindingPackageVersion !== '
|
|
381
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
379
|
+
if (bindingPackageVersion !== '2.0.0-beta.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
380
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-beta.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
382
381
|
}
|
|
383
382
|
return binding
|
|
384
383
|
} catch (e) {
|
|
@@ -393,8 +392,8 @@ function requireNative() {
|
|
|
393
392
|
try {
|
|
394
393
|
const binding = require('@gtkx/native-linux-loong64-gnu')
|
|
395
394
|
const bindingPackageVersion = require('@gtkx/native-linux-loong64-gnu/package.json').version
|
|
396
|
-
if (bindingPackageVersion !== '
|
|
397
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
395
|
+
if (bindingPackageVersion !== '2.0.0-beta.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
396
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-beta.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
398
397
|
}
|
|
399
398
|
return binding
|
|
400
399
|
} catch (e) {
|
|
@@ -411,8 +410,8 @@ function requireNative() {
|
|
|
411
410
|
try {
|
|
412
411
|
const binding = require('@gtkx/native-linux-riscv64-musl')
|
|
413
412
|
const bindingPackageVersion = require('@gtkx/native-linux-riscv64-musl/package.json').version
|
|
414
|
-
if (bindingPackageVersion !== '
|
|
415
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
413
|
+
if (bindingPackageVersion !== '2.0.0-beta.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
414
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-beta.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
416
415
|
}
|
|
417
416
|
return binding
|
|
418
417
|
} catch (e) {
|
|
@@ -427,8 +426,8 @@ function requireNative() {
|
|
|
427
426
|
try {
|
|
428
427
|
const binding = require('@gtkx/native-linux-riscv64-gnu')
|
|
429
428
|
const bindingPackageVersion = require('@gtkx/native-linux-riscv64-gnu/package.json').version
|
|
430
|
-
if (bindingPackageVersion !== '
|
|
431
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
429
|
+
if (bindingPackageVersion !== '2.0.0-beta.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
430
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-beta.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
432
431
|
}
|
|
433
432
|
return binding
|
|
434
433
|
} catch (e) {
|
|
@@ -444,8 +443,8 @@ function requireNative() {
|
|
|
444
443
|
try {
|
|
445
444
|
const binding = require('@gtkx/native-linux-ppc64-gnu')
|
|
446
445
|
const bindingPackageVersion = require('@gtkx/native-linux-ppc64-gnu/package.json').version
|
|
447
|
-
if (bindingPackageVersion !== '
|
|
448
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
446
|
+
if (bindingPackageVersion !== '2.0.0-beta.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
447
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-beta.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
449
448
|
}
|
|
450
449
|
return binding
|
|
451
450
|
} catch (e) {
|
|
@@ -460,8 +459,8 @@ function requireNative() {
|
|
|
460
459
|
try {
|
|
461
460
|
const binding = require('@gtkx/native-linux-s390x-gnu')
|
|
462
461
|
const bindingPackageVersion = require('@gtkx/native-linux-s390x-gnu/package.json').version
|
|
463
|
-
if (bindingPackageVersion !== '
|
|
464
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
462
|
+
if (bindingPackageVersion !== '2.0.0-beta.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
463
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-beta.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
465
464
|
}
|
|
466
465
|
return binding
|
|
467
466
|
} catch (e) {
|
|
@@ -480,8 +479,8 @@ function requireNative() {
|
|
|
480
479
|
try {
|
|
481
480
|
const binding = require('@gtkx/native-openharmony-arm64')
|
|
482
481
|
const bindingPackageVersion = require('@gtkx/native-openharmony-arm64/package.json').version
|
|
483
|
-
if (bindingPackageVersion !== '
|
|
484
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
482
|
+
if (bindingPackageVersion !== '2.0.0-beta.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
483
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-beta.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
485
484
|
}
|
|
486
485
|
return binding
|
|
487
486
|
} catch (e) {
|
|
@@ -496,8 +495,8 @@ function requireNative() {
|
|
|
496
495
|
try {
|
|
497
496
|
const binding = require('@gtkx/native-openharmony-x64')
|
|
498
497
|
const bindingPackageVersion = require('@gtkx/native-openharmony-x64/package.json').version
|
|
499
|
-
if (bindingPackageVersion !== '
|
|
500
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
498
|
+
if (bindingPackageVersion !== '2.0.0-beta.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
499
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-beta.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
501
500
|
}
|
|
502
501
|
return binding
|
|
503
502
|
} catch (e) {
|
|
@@ -512,8 +511,8 @@ function requireNative() {
|
|
|
512
511
|
try {
|
|
513
512
|
const binding = require('@gtkx/native-openharmony-arm')
|
|
514
513
|
const bindingPackageVersion = require('@gtkx/native-openharmony-arm/package.json').version
|
|
515
|
-
if (bindingPackageVersion !== '
|
|
516
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
514
|
+
if (bindingPackageVersion !== '2.0.0-beta.10' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
515
|
+
throw new Error(`Native binding package version mismatch, expected 2.0.0-beta.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
517
516
|
}
|
|
518
517
|
return binding
|
|
519
518
|
} catch (e) {
|
|
@@ -652,8 +651,8 @@ if (!nativeBinding || forceWasi) {
|
|
|
652
651
|
if (!candidateFailed) {
|
|
653
652
|
if (process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
654
653
|
const bindingPackageVersion = require('@gtkx/native-wasm32-wasi/package.json').version
|
|
655
|
-
if (bindingPackageVersion !== '
|
|
656
|
-
throw new Error(`WASI binding package version mismatch, expected
|
|
654
|
+
if (bindingPackageVersion !== '2.0.0-beta.10') {
|
|
655
|
+
throw new Error(`WASI binding package version mismatch, expected 2.0.0-beta.10 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
657
656
|
}
|
|
658
657
|
}
|
|
659
658
|
wasiBinding = require('@gtkx/native-wasm32-wasi')
|
|
@@ -703,8 +702,10 @@ if (!nativeBinding) {
|
|
|
703
702
|
throw new Error(`Failed to load native binding`)
|
|
704
703
|
}
|
|
705
704
|
|
|
706
|
-
const { alloc, ArrayKind, bind, bindField, bindFunctionPointer, bindVfunc, call, CallbackScope, copy, DestroyNotifyKind, getFundamentalWrapper, getType, getTypeClass, getWrapper, init, keepAlive, newObject, Ownership, quit, read, readField, registerClass, resolveType, setFundamentalWrapper, setWrapper, write, writeField } = nativeBinding
|
|
705
|
+
const { addLogListener, alloc, armParentDeath, ArrayKind, bind, bindField, bindFunctionPointer, bindVfunc, call, CallbackScope, copy, DestroyNotifyKind, getFundamentalWrapper, getType, getTypeClass, getWrapper, init, keepAlive, newObject, Ownership, quit, read, readField, registerClass, removeLogListener, resolveType, setFundamentalWrapper, setWrapper, symbolAddress, write, writeField } = nativeBinding
|
|
706
|
+
export { addLogListener }
|
|
707
707
|
export { alloc }
|
|
708
|
+
export { armParentDeath }
|
|
708
709
|
export { ArrayKind }
|
|
709
710
|
export { bind }
|
|
710
711
|
export { bindField }
|
|
@@ -726,8 +727,10 @@ export { quit }
|
|
|
726
727
|
export { read }
|
|
727
728
|
export { readField }
|
|
728
729
|
export { registerClass }
|
|
730
|
+
export { removeLogListener }
|
|
729
731
|
export { resolveType }
|
|
730
732
|
export { setFundamentalWrapper }
|
|
731
733
|
export { setWrapper }
|
|
734
|
+
export { symbolAddress }
|
|
732
735
|
export { write }
|
|
733
736
|
export { writeField }
|
package/internal.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { armParentDeath } from "./index.js";
|
package/internal.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { armParentDeath } from "./index.js";
|
package/main.d.ts
CHANGED
|
@@ -24,3 +24,23 @@ declare module "./index.js" {
|
|
|
24
24
|
*/
|
|
25
25
|
export type Ref = { value: unknown };
|
|
26
26
|
}
|
|
27
|
+
|
|
28
|
+
type LogLevel = "error" | "critical" | "warning" | "message" | "info" | "debug";
|
|
29
|
+
|
|
30
|
+
type LogListener = (level: LogLevel, domain: string, message: string) => void;
|
|
31
|
+
|
|
32
|
+
type LogSubscription = { unsubscribe(): void };
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Subscribes `listener` to every GLib log record the process writes, whichever thread logs it,
|
|
36
|
+
* and returns the subscription whose `unsubscribe` removes it again. The listener receives the
|
|
37
|
+
* level name, the log domain and the message. Records are queued to the JavaScript thread and
|
|
38
|
+
* delivered asynchronously, so a check that reads what the listener collected has to yield to the
|
|
39
|
+
* event loop once after the logging call. A level GLib treats as fatal, including one made fatal
|
|
40
|
+
* through `logSetAlwaysFatal`, aborts the process before the queued delivery runs, so such a
|
|
41
|
+
* listener never sees it. `unsubscribe` stops further records from being queued but does not cancel
|
|
42
|
+
* the ones already queued, so the listener can still run for those after `unsubscribe` returns.
|
|
43
|
+
*/
|
|
44
|
+
declare function onLog(listener: LogListener): LogSubscription;
|
|
45
|
+
|
|
46
|
+
export { type LogLevel, type LogListener, type LogSubscription, onLog };
|
package/main.js
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
-
import "./
|
|
1
|
+
import "./bootstrap.js";
|
|
2
|
+
import { addLogListener, removeLogListener } from "./index.js";
|
|
3
|
+
|
|
4
|
+
const onLog = (listener) => {
|
|
5
|
+
const id = addLogListener(listener);
|
|
6
|
+
|
|
7
|
+
return {
|
|
8
|
+
unsubscribe: () => {
|
|
9
|
+
removeLogListener(id);
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
};
|
|
2
13
|
|
|
3
14
|
export * from "./index.js";
|
|
15
|
+
export { onLog };
|
package/package.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gtkx/native",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Rust addon for
|
|
3
|
+
"version": "2.0.0-beta.10",
|
|
4
|
+
"description": "Rust FFI addon for the GTKX GNOME stack and GObject libraries.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"gtkx",
|
|
7
7
|
"gtk",
|
|
8
8
|
"gtk4",
|
|
9
|
+
"adwaita",
|
|
10
|
+
"gnome",
|
|
9
11
|
"native",
|
|
10
12
|
"ffi",
|
|
11
13
|
"rust",
|
|
@@ -30,16 +32,22 @@
|
|
|
30
32
|
".": {
|
|
31
33
|
"types": "./main.d.ts",
|
|
32
34
|
"default": "./main.js"
|
|
35
|
+
},
|
|
36
|
+
"./internal": {
|
|
37
|
+
"types": "./internal.d.ts",
|
|
38
|
+
"default": "./internal.js"
|
|
33
39
|
}
|
|
34
40
|
},
|
|
35
41
|
"sideEffects": [
|
|
36
|
-
"./
|
|
42
|
+
"./bootstrap.js",
|
|
37
43
|
"./main.js"
|
|
38
44
|
],
|
|
39
45
|
"files": [
|
|
46
|
+
"bootstrap.js",
|
|
40
47
|
"index.js",
|
|
41
48
|
"index.d.ts",
|
|
42
|
-
"
|
|
49
|
+
"internal.js",
|
|
50
|
+
"internal.d.ts",
|
|
43
51
|
"main.js",
|
|
44
52
|
"main.d.ts"
|
|
45
53
|
],
|
|
@@ -62,17 +70,6 @@
|
|
|
62
70
|
{
|
|
63
71
|
"runtime": "uname -m"
|
|
64
72
|
}
|
|
65
|
-
],
|
|
66
|
-
"crateTests": [
|
|
67
|
-
"crate",
|
|
68
|
-
"sharedGlobals",
|
|
69
|
-
"{projectRoot}/tests/**/*",
|
|
70
|
-
"{projectRoot}/test-support/**/*",
|
|
71
|
-
"{workspaceRoot}/scripts/run-headless.ts",
|
|
72
|
-
"{workspaceRoot}/scripts/cargo-nightly.ts",
|
|
73
|
-
"{workspaceRoot}/scripts/coverage-target.ts",
|
|
74
|
-
"{workspaceRoot}/scripts/rust-nightly.ts",
|
|
75
|
-
"{workspaceRoot}/packages/utils/src/**/*"
|
|
76
73
|
]
|
|
77
74
|
},
|
|
78
75
|
"targets": {
|
|
@@ -94,54 +91,13 @@
|
|
|
94
91
|
"{projectRoot}/native.*.node"
|
|
95
92
|
]
|
|
96
93
|
},
|
|
97
|
-
"test": {
|
|
98
|
-
"dependsOn": [
|
|
99
|
-
"build",
|
|
100
|
-
"test:asan",
|
|
101
|
-
"test:miri"
|
|
102
|
-
],
|
|
103
|
-
"cache": true,
|
|
104
|
-
"inputs": [
|
|
105
|
-
"crateTests"
|
|
106
|
-
],
|
|
107
|
-
"outputs": []
|
|
108
|
-
},
|
|
109
|
-
"test:asan": {
|
|
110
|
-
"dependsOn": [
|
|
111
|
-
"build"
|
|
112
|
-
],
|
|
113
|
-
"cache": true,
|
|
114
|
-
"inputs": [
|
|
115
|
-
"crateTests"
|
|
116
|
-
],
|
|
117
|
-
"outputs": []
|
|
118
|
-
},
|
|
119
|
-
"test:miri": {
|
|
120
|
-
"dependsOn": [
|
|
121
|
-
"build"
|
|
122
|
-
],
|
|
123
|
-
"cache": true,
|
|
124
|
-
"inputs": [
|
|
125
|
-
"crateTests"
|
|
126
|
-
],
|
|
127
|
-
"outputs": []
|
|
128
|
-
},
|
|
129
|
-
"coverage": {
|
|
130
|
-
"dependsOn": [
|
|
131
|
-
"build"
|
|
132
|
-
],
|
|
133
|
-
"cache": true,
|
|
134
|
-
"inputs": [
|
|
135
|
-
"crateTests"
|
|
136
|
-
],
|
|
137
|
-
"outputs": [
|
|
138
|
-
"{projectRoot}/coverage/**"
|
|
139
|
-
]
|
|
140
|
-
},
|
|
141
94
|
"lint:rust": {
|
|
142
95
|
"cache": true,
|
|
143
96
|
"inputs": [
|
|
144
|
-
"
|
|
97
|
+
"crate",
|
|
98
|
+
"{workspaceRoot}/rustfmt.toml",
|
|
99
|
+
"{workspaceRoot}/scripts/cargo-nightly.ts",
|
|
100
|
+
"{workspaceRoot}/scripts/rust-nightly.ts"
|
|
145
101
|
],
|
|
146
102
|
"outputs": []
|
|
147
103
|
},
|
|
@@ -170,28 +126,31 @@
|
|
|
170
126
|
"create-npm-dirs"
|
|
171
127
|
],
|
|
172
128
|
"cache": false
|
|
129
|
+
},
|
|
130
|
+
"test": {
|
|
131
|
+
"dependsOn": [
|
|
132
|
+
"build"
|
|
133
|
+
],
|
|
134
|
+
"cache": true
|
|
173
135
|
}
|
|
174
136
|
}
|
|
175
137
|
},
|
|
176
138
|
"engines": {
|
|
177
|
-
"node": ">=
|
|
139
|
+
"node": ">=26.7.0"
|
|
178
140
|
},
|
|
179
141
|
"devDependencies": {
|
|
180
|
-
"@
|
|
142
|
+
"@gtkx/vitest": "2.0.0-beta.10",
|
|
143
|
+
"@napi-rs/cli": "^3.9.0"
|
|
181
144
|
},
|
|
182
145
|
"optionalDependencies": {
|
|
183
|
-
"@gtkx/native-linux-arm64-gnu": "
|
|
184
|
-
"@gtkx/native-linux-x64-gnu": "
|
|
146
|
+
"@gtkx/native-linux-arm64-gnu": "2.0.0-beta.10",
|
|
147
|
+
"@gtkx/native-linux-x64-gnu": "2.0.0-beta.10"
|
|
185
148
|
},
|
|
186
149
|
"scripts": {
|
|
187
150
|
"artifacts": "napi artifacts",
|
|
188
151
|
"build": "napi build --platform --release --esm --no-dts-cache --no-const-enum",
|
|
189
|
-
"coverage": "mkdir -p coverage && tsx ../../scripts/coverage-target.ts && tsx ../../scripts/run-headless.ts cargo +nightly llvm-cov --lcov --output-path coverage/native.lcov.info --fail-under-lines 70 -- --test-threads=1",
|
|
190
152
|
"create-npm-dirs": "napi create-npm-dirs",
|
|
191
153
|
"lint:rust": "tsx ../../scripts/cargo-nightly.ts fmt --check && cargo clippy --all-targets -- -D warnings",
|
|
192
|
-
"test:asan": "RUSTFLAGS=\"-Zsanitizer=address\" ASAN_OPTIONS=\"detect_leaks=1:abort_on_error=1:detect_stack_use_after_return=1\" tsx ../../scripts/run-headless.ts cargo +nightly test --target x86_64-unknown-linux-gnu -- --test-threads=1",
|
|
193
|
-
"test:miri": "tsx ../../scripts/run-headless.ts cargo +nightly miri test --test integer_codec --test descriptor_into_codec",
|
|
194
|
-
"test": "tsx ../../scripts/run-headless.ts cargo test -- --test-threads=1",
|
|
195
154
|
"release": "tsx ../../scripts/prepublish-native.ts && tsx ../../scripts/release-package.ts"
|
|
196
155
|
}
|
|
197
156
|
}
|
|
File without changes
|