@gtkx/native 1.2.1 → 1.3.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 +2 -1
- package/index.d.ts +75 -10
- package/index.js +59 -55
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -98,7 +98,7 @@ GTK4 is mature, and GtkBuilder XML can lay out a static interface, but nothing r
|
|
|
98
98
|
- a React reconciler that exposes every GObject as a JSX element,
|
|
99
99
|
- a CLI for scaffolding, development, and production builds,
|
|
100
100
|
- a dev server with Fast Refresh that patches your running UI in place,
|
|
101
|
-
- CSS-in-JS styling and high-level list, grid, and dialog components,
|
|
101
|
+
- CSS-in-JS styling, React Spring animations, and high-level list, grid, and dialog components,
|
|
102
102
|
- a Testing Library-style API for querying and driving your widgets in tests,
|
|
103
103
|
- and a Model Context Protocol (MCP) server that exposes your live app to AI agents.
|
|
104
104
|
|
|
@@ -157,6 +157,7 @@ Explore the [example apps](https://github.com/gtkx-org/gtkx/tree/main/examples):
|
|
|
157
157
|
- [`hello-world`](https://github.com/gtkx-org/gtkx/tree/main/examples/hello-world): the counter above.
|
|
158
158
|
- [`gtk-demo`](https://github.com/gtkx-org/gtkx/tree/main/examples/gtk-demo): a React port of the official GTK4 widget showcase, covering lists, dialogs, gestures, CSS, and OpenGL.
|
|
159
159
|
- [`browser`](https://github.com/gtkx-org/gtkx/tree/main/examples/browser): a WebKitWebView-based web browser.
|
|
160
|
+
- [`animations`](https://github.com/gtkx-org/gtkx/tree/main/examples/animations): a tour of `@gtkx/animated`, React Spring animations driven by the GTK frame clock.
|
|
160
161
|
- [`tutorial`](https://github.com/gtkx-org/gtkx/tree/main/examples/tutorial): the Tasks app the documentation builds.
|
|
161
162
|
|
|
162
163
|
## Status
|
package/index.d.ts
CHANGED
|
@@ -39,6 +39,14 @@ export type ArrayKind = 'array'|
|
|
|
39
39
|
*/
|
|
40
40
|
export declare function bind(sharedLibrary: string, symbolName: string, argDescriptors: Array<Descriptor>, returnDescriptor: Descriptor, fixedArgCount?: number | undefined | null): ExternalObject<CallDescriptor>
|
|
41
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Precompiles the argument and return marshalling of a call to a raw C function pointer into a
|
|
44
|
+
* reusable call descriptor that `call` can invoke. The pointer comes from a native caller that
|
|
45
|
+
* handed a callback into a JavaScript-implemented virtual function or callback, decoded as a
|
|
46
|
+
* bigint address; it must stay valid for as long as the descriptor is called through.
|
|
47
|
+
*/
|
|
48
|
+
export declare function bindFunctionPointer(fnPtr: bigint, argDescriptors: Array<Descriptor>, returnDescriptor: Descriptor, label: string): ExternalObject<CallDescriptor>
|
|
49
|
+
|
|
42
50
|
/**
|
|
43
51
|
* Precompiles a call to the virtual function slot at `byteOffset` of `instanceType`'s class
|
|
44
52
|
* structure, of the `interfaceType` vtable that class carries, or of `interfaceType`'s own default
|
|
@@ -118,7 +126,7 @@ export type Descriptor =
|
|
|
118
126
|
| { kind: 'float32' }
|
|
119
127
|
| { kind: 'float64' }
|
|
120
128
|
| { kind: 'enum', sharedLibrary: string, getTypeFnName: string, isSigned: boolean }
|
|
121
|
-
| { kind: 'flags', sharedLibrary: string, getTypeFnName: string, isSigned: boolean }
|
|
129
|
+
| { kind: 'flags', sharedLibrary: string, getTypeFnName: string, isSigned: boolean, mask?: number }
|
|
122
130
|
| { kind: 'boolean' }
|
|
123
131
|
| { kind: 'string', ownership: Ownership, length?: number }
|
|
124
132
|
| { kind: 'object', ownership: Ownership, isCallScoped?: boolean }
|
|
@@ -127,10 +135,10 @@ export type Descriptor =
|
|
|
127
135
|
| { kind: 'buffer' }
|
|
128
136
|
| { kind: 'boxed', ownership: Ownership, typeName: string, sharedLibrary?: string, getTypeFnName?: string, freeFnName?: string, isCallerAllocated?: boolean, size?: number, isInline?: boolean }
|
|
129
137
|
| { kind: 'struct', ownership: Ownership, size?: number, isCallerAllocated?: boolean, isInline?: boolean }
|
|
130
|
-
| { kind: 'fundamental', ownership: Ownership, sharedLibrary: string, refFnName: string, unrefFnName: string, typeName?: string, isInline?: boolean }
|
|
131
|
-
| { kind: 'array', itemDescriptor: Descriptor, arrayKind: ArrayKind, ownership: Ownership, baseParamIndex?: number, sizeParamIndex?: number, fixedSize?: number, elementSize?: number, isBytes?: boolean }
|
|
138
|
+
| { kind: 'fundamental', ownership: Ownership, sharedLibrary: string, refFnName: string, unrefFnName: string, typeName?: string, isCallerAllocated?: boolean, isInline?: boolean }
|
|
139
|
+
| { kind: 'array', itemDescriptor: Descriptor, arrayKind: ArrayKind, ownership: Ownership, baseParamIndex?: number, sizeParamIndex?: number, fixedSize?: number, elementSize?: number, isBytes?: boolean, isCallerAllocated?: boolean }
|
|
132
140
|
| { kind: 'hashtable', keyDescriptor: Descriptor, valueDescriptor: Descriptor, ownership: Ownership }
|
|
133
|
-
| { kind: 'callback', argDescriptors: Array<Descriptor>, returnDescriptor: Descriptor, hasDestroy?: boolean, destroyKind?: DestroyNotifyKind, hasUserData?: boolean, userDataIndex?: number, scope?: CallbackScope }
|
|
141
|
+
| { kind: 'callback', argDescriptors: Array<Descriptor>, returnDescriptor: Descriptor, hasDestroy?: boolean, destroyKind?: DestroyNotifyKind, hasUserData?: boolean, userDataIndex?: number, canThrow?: boolean, scope?: CallbackScope }
|
|
134
142
|
| { kind: 'ref', innerDescriptor: Descriptor, inout?: boolean }
|
|
135
143
|
|
|
136
144
|
/**
|
|
@@ -142,10 +150,24 @@ export type DestroyNotifyKind = 'destroyNotify'|
|
|
|
142
150
|
'closureNotify';
|
|
143
151
|
|
|
144
152
|
/**
|
|
145
|
-
* Returns the
|
|
146
|
-
*
|
|
153
|
+
* Returns the JavaScript wrapper object previously cached for the handle's fundamental
|
|
154
|
+
* instance, or null when no wrapper is cached.
|
|
155
|
+
*/
|
|
156
|
+
export declare function getFundamentalWrapper(handle: ExternalObject<Handle>): object | null
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Returns the `GType` of the instance `handle` references, or 0 when it carries no type tag.
|
|
160
|
+
* A `GObject` always carries one. A fundamental instance carries one only when the type the
|
|
161
|
+
* binding declares, passed as `declaredType`, is instantiatable.
|
|
147
162
|
*/
|
|
148
|
-
export declare function getType(handle: ExternalObject<Handle
|
|
163
|
+
export declare function getType(handle: ExternalObject<Handle>, declaredType?: bigint | undefined | null): bigint
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Returns a handle over the class struct of `gtype`, taking a class reference that is
|
|
167
|
+
* deliberately never released: the class struct of a statically registered type lives for the
|
|
168
|
+
* rest of the process, so the handle borrows it without owning anything.
|
|
169
|
+
*/
|
|
170
|
+
export declare function getTypeClass(gtype: bigint): ExternalObject<Handle>
|
|
149
171
|
|
|
150
172
|
/**
|
|
151
173
|
* Returns the JavaScript wrapper object previously attached to the handle's `GObject`,
|
|
@@ -170,9 +192,13 @@ export declare function keepAlive(enable: boolean): void
|
|
|
170
192
|
* it by calling `associate` with the instance's handle and the wrapper. A type registered through
|
|
171
193
|
* `registerClass` binds them from its `instance_init`, before `constructed` runs, so a
|
|
172
194
|
* `constructed` override already sees a fully usable wrapper; any other type binds them once
|
|
173
|
-
* construction has returned.
|
|
195
|
+
* construction has returned. An abstract `gtype` is rejected before anything is constructed.
|
|
196
|
+
* When construction hands back an instance that already carries a
|
|
197
|
+
* wrapper — it reached JavaScript and was wrapped before `g_object_new` returned — that existing
|
|
198
|
+
* wrapper is returned instead of binding `wrapper`, so the caller can adopt it; otherwise the
|
|
199
|
+
* call returns `null`.
|
|
174
200
|
*/
|
|
175
|
-
export declare function newObject(gtype: bigint, names: Array<string>, values: ExternalObject<Handle>[], wrapper: object, associate: (handle: ExternalObject<Handle>, wrapper: object) => void):
|
|
201
|
+
export declare function newObject(gtype: bigint, names: Array<string>, values: ExternalObject<Handle>[], wrapper: object, associate: (handle: ExternalObject<Handle>, wrapper: object) => void): object | null
|
|
176
202
|
|
|
177
203
|
/**
|
|
178
204
|
* Ownership transfer mode for a marshalled value: `borrowed` leaves the native side owning it,
|
|
@@ -212,7 +238,10 @@ export interface RegisterClassInterface {
|
|
|
212
238
|
vfuncs: Array<RegisterClassVfunc>
|
|
213
239
|
}
|
|
214
240
|
|
|
215
|
-
/**
|
|
241
|
+
/**
|
|
242
|
+
* Optional configuration for `registerClass`: vfunc overrides, implemented interfaces, properties
|
|
243
|
+
* and signals.
|
|
244
|
+
*/
|
|
216
245
|
export interface RegisterClassOptions {
|
|
217
246
|
/** Virtual function overrides for the class itself. */
|
|
218
247
|
vfuncs?: Array<RegisterClassVfunc>
|
|
@@ -220,6 +249,15 @@ export interface RegisterClassOptions {
|
|
|
220
249
|
interfaces?: Array<RegisterClassInterface>
|
|
221
250
|
/** Properties to install on the class. */
|
|
222
251
|
properties?: Array<RegisterClassProperty>
|
|
252
|
+
/** Signals to create on the class. */
|
|
253
|
+
signals?: Array<RegisterClassSignal>
|
|
254
|
+
/** Registers the type with `G_TYPE_FLAG_ABSTRACT`, so only its subtypes can be instantiated. */
|
|
255
|
+
abstract?: boolean
|
|
256
|
+
/**
|
|
257
|
+
* Name instances of the class carry in CSS, applied through `gtk_widget_class_set_css_name`
|
|
258
|
+
* from inside the type's `class_init`. Requires `parentType` to be a `GtkWidget`.
|
|
259
|
+
*/
|
|
260
|
+
cssName?: string
|
|
223
261
|
}
|
|
224
262
|
|
|
225
263
|
/** A property the registered class installs on its class structure. */
|
|
@@ -230,6 +268,20 @@ export interface RegisterClassProperty {
|
|
|
230
268
|
pspec: ExternalObject<Handle>
|
|
231
269
|
}
|
|
232
270
|
|
|
271
|
+
/** A signal the registered class creates on its type during class initialization. */
|
|
272
|
+
export interface RegisterClassSignal {
|
|
273
|
+
/** Name to create the signal under. Must satisfy `g_signal_is_valid_name`. */
|
|
274
|
+
name: string
|
|
275
|
+
/** `GSignalFlags` bit mask, defaulting to `G_SIGNAL_RUN_FIRST`. */
|
|
276
|
+
flags?: number
|
|
277
|
+
/** `GType` of each argument an emission carries, defaulting to none. */
|
|
278
|
+
paramTypes?: Array<bigint>
|
|
279
|
+
/** `GType` of the value an emission returns, defaulting to `G_TYPE_NONE`. */
|
|
280
|
+
returnType?: bigint
|
|
281
|
+
/** Built-in accumulator combining handler returns: `"first-wins"` or `"true-handled"`. */
|
|
282
|
+
accumulator?: string
|
|
283
|
+
}
|
|
284
|
+
|
|
233
285
|
/**
|
|
234
286
|
* A single virtual function override for a registered class: which slot to patch and how its
|
|
235
287
|
* arguments and return value are marshalled to and from the JavaScript implementation.
|
|
@@ -241,6 +293,11 @@ export interface RegisterClassVfunc {
|
|
|
241
293
|
argDescriptors: Array<Descriptor>
|
|
242
294
|
/** Descriptor for the value the JavaScript implementation returns. */
|
|
243
295
|
returnDescriptor: Descriptor
|
|
296
|
+
/**
|
|
297
|
+
* The slot's C signature ends with a `GError**`, which receives a `GError` built from
|
|
298
|
+
* whatever the JavaScript implementation throws.
|
|
299
|
+
*/
|
|
300
|
+
canThrow?: boolean
|
|
244
301
|
/** The JavaScript function that implements the vfunc. */
|
|
245
302
|
fn: (...args: never[]) => unknown
|
|
246
303
|
}
|
|
@@ -251,6 +308,14 @@ export interface RegisterClassVfunc {
|
|
|
251
308
|
*/
|
|
252
309
|
export declare function resolveType(sharedLibrary: string, getTypeFnName: string): bigint
|
|
253
310
|
|
|
311
|
+
/**
|
|
312
|
+
* Caches the JavaScript `wrapper` object for the handle's fundamental instance, so wrapping the
|
|
313
|
+
* same pointer again yields the same object for as long as the wrapper stays alive. A handle
|
|
314
|
+
* that owns no reference to its instance is left uncached, since its pointer can outlive the
|
|
315
|
+
* instance and later name a different one.
|
|
316
|
+
*/
|
|
317
|
+
export declare function setFundamentalWrapper(handle: ExternalObject<Handle>, wrapper: object): void
|
|
318
|
+
|
|
254
319
|
/**
|
|
255
320
|
* Attaches the JavaScript `wrapper` object to the handle's `GObject` and registers a finalizer
|
|
256
321
|
* that releases it when the wrapper is garbage collected.
|
package/index.js
CHANGED
|
@@ -81,8 +81,8 @@ function requireNative() {
|
|
|
81
81
|
try {
|
|
82
82
|
const binding = require('@gtkx/native-android-arm64')
|
|
83
83
|
const bindingPackageVersion = require('@gtkx/native-android-arm64/package.json').version
|
|
84
|
-
if (bindingPackageVersion !== '1.
|
|
85
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
84
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
85
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
86
86
|
}
|
|
87
87
|
return binding
|
|
88
88
|
} catch (e) {
|
|
@@ -97,8 +97,8 @@ function requireNative() {
|
|
|
97
97
|
try {
|
|
98
98
|
const binding = require('@gtkx/native-android-arm-eabi')
|
|
99
99
|
const bindingPackageVersion = require('@gtkx/native-android-arm-eabi/package.json').version
|
|
100
|
-
if (bindingPackageVersion !== '1.
|
|
101
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
100
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
101
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
102
102
|
}
|
|
103
103
|
return binding
|
|
104
104
|
} catch (e) {
|
|
@@ -118,8 +118,8 @@ function requireNative() {
|
|
|
118
118
|
try {
|
|
119
119
|
const binding = require('@gtkx/native-win32-x64-gnu')
|
|
120
120
|
const bindingPackageVersion = require('@gtkx/native-win32-x64-gnu/package.json').version
|
|
121
|
-
if (bindingPackageVersion !== '1.
|
|
122
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
121
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
122
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
123
123
|
}
|
|
124
124
|
return binding
|
|
125
125
|
} catch (e) {
|
|
@@ -134,8 +134,8 @@ function requireNative() {
|
|
|
134
134
|
try {
|
|
135
135
|
const binding = require('@gtkx/native-win32-x64-msvc')
|
|
136
136
|
const bindingPackageVersion = require('@gtkx/native-win32-x64-msvc/package.json').version
|
|
137
|
-
if (bindingPackageVersion !== '1.
|
|
138
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
137
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
138
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
139
139
|
}
|
|
140
140
|
return binding
|
|
141
141
|
} catch (e) {
|
|
@@ -151,8 +151,8 @@ function requireNative() {
|
|
|
151
151
|
try {
|
|
152
152
|
const binding = require('@gtkx/native-win32-ia32-msvc')
|
|
153
153
|
const bindingPackageVersion = require('@gtkx/native-win32-ia32-msvc/package.json').version
|
|
154
|
-
if (bindingPackageVersion !== '1.
|
|
155
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
154
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
155
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
156
156
|
}
|
|
157
157
|
return binding
|
|
158
158
|
} catch (e) {
|
|
@@ -167,8 +167,8 @@ function requireNative() {
|
|
|
167
167
|
try {
|
|
168
168
|
const binding = require('@gtkx/native-win32-arm64-msvc')
|
|
169
169
|
const bindingPackageVersion = require('@gtkx/native-win32-arm64-msvc/package.json').version
|
|
170
|
-
if (bindingPackageVersion !== '1.
|
|
171
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
170
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
171
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
172
172
|
}
|
|
173
173
|
return binding
|
|
174
174
|
} catch (e) {
|
|
@@ -186,8 +186,8 @@ function requireNative() {
|
|
|
186
186
|
try {
|
|
187
187
|
const binding = require('@gtkx/native-darwin-universal')
|
|
188
188
|
const bindingPackageVersion = require('@gtkx/native-darwin-universal/package.json').version
|
|
189
|
-
if (bindingPackageVersion !== '1.
|
|
190
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
189
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
190
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
191
191
|
}
|
|
192
192
|
return binding
|
|
193
193
|
} catch (e) {
|
|
@@ -202,8 +202,8 @@ function requireNative() {
|
|
|
202
202
|
try {
|
|
203
203
|
const binding = require('@gtkx/native-darwin-x64')
|
|
204
204
|
const bindingPackageVersion = require('@gtkx/native-darwin-x64/package.json').version
|
|
205
|
-
if (bindingPackageVersion !== '1.
|
|
206
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
205
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
206
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
207
207
|
}
|
|
208
208
|
return binding
|
|
209
209
|
} catch (e) {
|
|
@@ -218,8 +218,8 @@ function requireNative() {
|
|
|
218
218
|
try {
|
|
219
219
|
const binding = require('@gtkx/native-darwin-arm64')
|
|
220
220
|
const bindingPackageVersion = require('@gtkx/native-darwin-arm64/package.json').version
|
|
221
|
-
if (bindingPackageVersion !== '1.
|
|
222
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
221
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
222
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
223
223
|
}
|
|
224
224
|
return binding
|
|
225
225
|
} catch (e) {
|
|
@@ -238,8 +238,8 @@ function requireNative() {
|
|
|
238
238
|
try {
|
|
239
239
|
const binding = require('@gtkx/native-freebsd-x64')
|
|
240
240
|
const bindingPackageVersion = require('@gtkx/native-freebsd-x64/package.json').version
|
|
241
|
-
if (bindingPackageVersion !== '1.
|
|
242
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
241
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
242
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
243
243
|
}
|
|
244
244
|
return binding
|
|
245
245
|
} catch (e) {
|
|
@@ -254,8 +254,8 @@ function requireNative() {
|
|
|
254
254
|
try {
|
|
255
255
|
const binding = require('@gtkx/native-freebsd-arm64')
|
|
256
256
|
const bindingPackageVersion = require('@gtkx/native-freebsd-arm64/package.json').version
|
|
257
|
-
if (bindingPackageVersion !== '1.
|
|
258
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
257
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
258
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
259
259
|
}
|
|
260
260
|
return binding
|
|
261
261
|
} catch (e) {
|
|
@@ -275,8 +275,8 @@ function requireNative() {
|
|
|
275
275
|
try {
|
|
276
276
|
const binding = require('@gtkx/native-linux-x64-musl')
|
|
277
277
|
const bindingPackageVersion = require('@gtkx/native-linux-x64-musl/package.json').version
|
|
278
|
-
if (bindingPackageVersion !== '1.
|
|
279
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
278
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
279
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
280
280
|
}
|
|
281
281
|
return binding
|
|
282
282
|
} catch (e) {
|
|
@@ -291,8 +291,8 @@ function requireNative() {
|
|
|
291
291
|
try {
|
|
292
292
|
const binding = require('@gtkx/native-linux-x64-gnu')
|
|
293
293
|
const bindingPackageVersion = require('@gtkx/native-linux-x64-gnu/package.json').version
|
|
294
|
-
if (bindingPackageVersion !== '1.
|
|
295
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
294
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
295
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
296
296
|
}
|
|
297
297
|
return binding
|
|
298
298
|
} catch (e) {
|
|
@@ -309,8 +309,8 @@ function requireNative() {
|
|
|
309
309
|
try {
|
|
310
310
|
const binding = require('@gtkx/native-linux-arm64-musl')
|
|
311
311
|
const bindingPackageVersion = require('@gtkx/native-linux-arm64-musl/package.json').version
|
|
312
|
-
if (bindingPackageVersion !== '1.
|
|
313
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
312
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
313
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
314
314
|
}
|
|
315
315
|
return binding
|
|
316
316
|
} catch (e) {
|
|
@@ -325,8 +325,8 @@ function requireNative() {
|
|
|
325
325
|
try {
|
|
326
326
|
const binding = require('@gtkx/native-linux-arm64-gnu')
|
|
327
327
|
const bindingPackageVersion = require('@gtkx/native-linux-arm64-gnu/package.json').version
|
|
328
|
-
if (bindingPackageVersion !== '1.
|
|
329
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
328
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
329
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
330
330
|
}
|
|
331
331
|
return binding
|
|
332
332
|
} catch (e) {
|
|
@@ -343,8 +343,8 @@ function requireNative() {
|
|
|
343
343
|
try {
|
|
344
344
|
const binding = require('@gtkx/native-linux-arm-musleabihf')
|
|
345
345
|
const bindingPackageVersion = require('@gtkx/native-linux-arm-musleabihf/package.json').version
|
|
346
|
-
if (bindingPackageVersion !== '1.
|
|
347
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
346
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
347
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
348
348
|
}
|
|
349
349
|
return binding
|
|
350
350
|
} catch (e) {
|
|
@@ -359,8 +359,8 @@ function requireNative() {
|
|
|
359
359
|
try {
|
|
360
360
|
const binding = require('@gtkx/native-linux-arm-gnueabihf')
|
|
361
361
|
const bindingPackageVersion = require('@gtkx/native-linux-arm-gnueabihf/package.json').version
|
|
362
|
-
if (bindingPackageVersion !== '1.
|
|
363
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
362
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
363
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
364
364
|
}
|
|
365
365
|
return binding
|
|
366
366
|
} catch (e) {
|
|
@@ -377,8 +377,8 @@ function requireNative() {
|
|
|
377
377
|
try {
|
|
378
378
|
const binding = require('@gtkx/native-linux-loong64-musl')
|
|
379
379
|
const bindingPackageVersion = require('@gtkx/native-linux-loong64-musl/package.json').version
|
|
380
|
-
if (bindingPackageVersion !== '1.
|
|
381
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
380
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
381
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
382
382
|
}
|
|
383
383
|
return binding
|
|
384
384
|
} catch (e) {
|
|
@@ -393,8 +393,8 @@ function requireNative() {
|
|
|
393
393
|
try {
|
|
394
394
|
const binding = require('@gtkx/native-linux-loong64-gnu')
|
|
395
395
|
const bindingPackageVersion = require('@gtkx/native-linux-loong64-gnu/package.json').version
|
|
396
|
-
if (bindingPackageVersion !== '1.
|
|
397
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
396
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
397
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
398
398
|
}
|
|
399
399
|
return binding
|
|
400
400
|
} catch (e) {
|
|
@@ -411,8 +411,8 @@ function requireNative() {
|
|
|
411
411
|
try {
|
|
412
412
|
const binding = require('@gtkx/native-linux-riscv64-musl')
|
|
413
413
|
const bindingPackageVersion = require('@gtkx/native-linux-riscv64-musl/package.json').version
|
|
414
|
-
if (bindingPackageVersion !== '1.
|
|
415
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
414
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
415
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
416
416
|
}
|
|
417
417
|
return binding
|
|
418
418
|
} catch (e) {
|
|
@@ -427,8 +427,8 @@ function requireNative() {
|
|
|
427
427
|
try {
|
|
428
428
|
const binding = require('@gtkx/native-linux-riscv64-gnu')
|
|
429
429
|
const bindingPackageVersion = require('@gtkx/native-linux-riscv64-gnu/package.json').version
|
|
430
|
-
if (bindingPackageVersion !== '1.
|
|
431
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
430
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
431
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
432
432
|
}
|
|
433
433
|
return binding
|
|
434
434
|
} catch (e) {
|
|
@@ -444,8 +444,8 @@ function requireNative() {
|
|
|
444
444
|
try {
|
|
445
445
|
const binding = require('@gtkx/native-linux-ppc64-gnu')
|
|
446
446
|
const bindingPackageVersion = require('@gtkx/native-linux-ppc64-gnu/package.json').version
|
|
447
|
-
if (bindingPackageVersion !== '1.
|
|
448
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
447
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
448
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
449
449
|
}
|
|
450
450
|
return binding
|
|
451
451
|
} catch (e) {
|
|
@@ -460,8 +460,8 @@ function requireNative() {
|
|
|
460
460
|
try {
|
|
461
461
|
const binding = require('@gtkx/native-linux-s390x-gnu')
|
|
462
462
|
const bindingPackageVersion = require('@gtkx/native-linux-s390x-gnu/package.json').version
|
|
463
|
-
if (bindingPackageVersion !== '1.
|
|
464
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
463
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
464
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
465
465
|
}
|
|
466
466
|
return binding
|
|
467
467
|
} catch (e) {
|
|
@@ -480,8 +480,8 @@ function requireNative() {
|
|
|
480
480
|
try {
|
|
481
481
|
const binding = require('@gtkx/native-openharmony-arm64')
|
|
482
482
|
const bindingPackageVersion = require('@gtkx/native-openharmony-arm64/package.json').version
|
|
483
|
-
if (bindingPackageVersion !== '1.
|
|
484
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
483
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
484
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
485
485
|
}
|
|
486
486
|
return binding
|
|
487
487
|
} catch (e) {
|
|
@@ -496,8 +496,8 @@ function requireNative() {
|
|
|
496
496
|
try {
|
|
497
497
|
const binding = require('@gtkx/native-openharmony-x64')
|
|
498
498
|
const bindingPackageVersion = require('@gtkx/native-openharmony-x64/package.json').version
|
|
499
|
-
if (bindingPackageVersion !== '1.
|
|
500
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
499
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
500
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
501
501
|
}
|
|
502
502
|
return binding
|
|
503
503
|
} catch (e) {
|
|
@@ -512,8 +512,8 @@ function requireNative() {
|
|
|
512
512
|
try {
|
|
513
513
|
const binding = require('@gtkx/native-openharmony-arm')
|
|
514
514
|
const bindingPackageVersion = require('@gtkx/native-openharmony-arm/package.json').version
|
|
515
|
-
if (bindingPackageVersion !== '1.
|
|
516
|
-
throw new Error(`Native binding package version mismatch, expected 1.
|
|
515
|
+
if (bindingPackageVersion !== '1.3.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
516
|
+
throw new Error(`Native binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
517
517
|
}
|
|
518
518
|
return binding
|
|
519
519
|
} catch (e) {
|
|
@@ -652,8 +652,8 @@ if (!nativeBinding || forceWasi) {
|
|
|
652
652
|
if (!candidateFailed) {
|
|
653
653
|
if (process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
654
654
|
const bindingPackageVersion = require('@gtkx/native-wasm32-wasi/package.json').version
|
|
655
|
-
if (bindingPackageVersion !== '1.
|
|
656
|
-
throw new Error(`WASI binding package version mismatch, expected 1.
|
|
655
|
+
if (bindingPackageVersion !== '1.3.0') {
|
|
656
|
+
throw new Error(`WASI binding package version mismatch, expected 1.3.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
657
657
|
}
|
|
658
658
|
}
|
|
659
659
|
wasiBinding = require('@gtkx/native-wasm32-wasi')
|
|
@@ -703,16 +703,19 @@ if (!nativeBinding) {
|
|
|
703
703
|
throw new Error(`Failed to load native binding`)
|
|
704
704
|
}
|
|
705
705
|
|
|
706
|
-
const { alloc, ArrayKind, bind, bindVfunc, call, CallbackScope, copy, DestroyNotifyKind, getType, getWrapper, init, keepAlive, newObject, Ownership, quit, read, registerClass, resolveType, setWrapper, write } = nativeBinding
|
|
706
|
+
const { alloc, ArrayKind, bind, bindFunctionPointer, bindVfunc, call, CallbackScope, copy, DestroyNotifyKind, getFundamentalWrapper, getType, getTypeClass, getWrapper, init, keepAlive, newObject, Ownership, quit, read, registerClass, resolveType, setFundamentalWrapper, setWrapper, write } = nativeBinding
|
|
707
707
|
export { alloc }
|
|
708
708
|
export { ArrayKind }
|
|
709
709
|
export { bind }
|
|
710
|
+
export { bindFunctionPointer }
|
|
710
711
|
export { bindVfunc }
|
|
711
712
|
export { call }
|
|
712
713
|
export { CallbackScope }
|
|
713
714
|
export { copy }
|
|
714
715
|
export { DestroyNotifyKind }
|
|
716
|
+
export { getFundamentalWrapper }
|
|
715
717
|
export { getType }
|
|
718
|
+
export { getTypeClass }
|
|
716
719
|
export { getWrapper }
|
|
717
720
|
export { init }
|
|
718
721
|
export { keepAlive }
|
|
@@ -722,5 +725,6 @@ export { quit }
|
|
|
722
725
|
export { read }
|
|
723
726
|
export { registerClass }
|
|
724
727
|
export { resolveType }
|
|
728
|
+
export { setFundamentalWrapper }
|
|
725
729
|
export { setWrapper }
|
|
726
730
|
export { write }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gtkx/native",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Rust addon under GTKX that loads shared libraries, marshals values, and tracks GObject handles",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"gtkx",
|
|
@@ -69,6 +69,9 @@
|
|
|
69
69
|
"{projectRoot}/tests/**/*",
|
|
70
70
|
"{projectRoot}/test-support/**/*",
|
|
71
71
|
"{workspaceRoot}/scripts/run-headless.ts",
|
|
72
|
+
"{workspaceRoot}/scripts/cargo-nightly.ts",
|
|
73
|
+
"{workspaceRoot}/scripts/coverage-target.ts",
|
|
74
|
+
"{workspaceRoot}/scripts/rust-nightly.ts",
|
|
72
75
|
"{workspaceRoot}/packages/utils/src/**/*"
|
|
73
76
|
]
|
|
74
77
|
},
|
|
@@ -177,8 +180,8 @@
|
|
|
177
180
|
"@napi-rs/cli": "^3.8.6"
|
|
178
181
|
},
|
|
179
182
|
"optionalDependencies": {
|
|
180
|
-
"@gtkx/native-linux-arm64-gnu": "1.
|
|
181
|
-
"@gtkx/native-linux-x64-gnu": "1.
|
|
183
|
+
"@gtkx/native-linux-arm64-gnu": "1.3.0",
|
|
184
|
+
"@gtkx/native-linux-x64-gnu": "1.3.0"
|
|
182
185
|
},
|
|
183
186
|
"scripts": {
|
|
184
187
|
"artifacts": "napi artifacts",
|