rdev-node 1.0.0 → 1.0.1

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/index.d.ts CHANGED
@@ -15,7 +15,7 @@ export declare const enum ButtonType {
15
15
  Left = 'Left',
16
16
  Right = 'Right',
17
17
  Middle = 'Middle',
18
- Unknown = 'Unknown',
18
+ Unknown = 'Unknown'
19
19
  }
20
20
 
21
21
  /** Display size information */
@@ -31,12 +31,15 @@ export declare const enum EventTypeValue {
31
31
  MouseMove = 'MouseMove',
32
32
  ButtonPress = 'ButtonPress',
33
33
  ButtonRelease = 'ButtonRelease',
34
- Wheel = 'Wheel',
34
+ Wheel = 'Wheel'
35
35
  }
36
36
 
37
37
  /** Get the size of the main display */
38
38
  export declare function getDisplaySize(): DisplaySize
39
39
 
40
+ /** Initialize the rdev simulation system. Call this once before using simulate_event. */
41
+ export declare function initSimulation(): void
42
+
40
43
  /** Represents an input event */
41
44
  export interface InputEvent {
42
45
  /** The type of event */
@@ -59,6 +62,9 @@ export interface InputEvent {
59
62
  time: number
60
63
  }
61
64
 
65
+ /** Checks if a KeyCode is a modifier key */
66
+ export declare function isModifierKey(keyCode: KeyCode): boolean
67
+
62
68
  /** Represents keyboard keys */
63
69
  export declare const enum KeyCode {
64
70
  Alt = 'Alt',
@@ -166,7 +172,7 @@ export declare const enum KeyCode {
166
172
  Kp9 = 'Kp9',
167
173
  KpDelete = 'KpDelete',
168
174
  Function = 'Function',
169
- Unknown = 'Unknown',
175
+ Unknown = 'Unknown'
170
176
  }
171
177
 
172
178
  /** Represents a key press event */
@@ -185,12 +191,26 @@ export interface MouseMoveEvent {
185
191
  y: number
186
192
  }
187
193
 
194
+ /** Represents normalized modifier keys for shortcut handling */
195
+ export declare const enum NormalizedModifier {
196
+ Ctrl = 'Ctrl',
197
+ Shift = 'Shift',
198
+ Alt = 'Alt',
199
+ Meta = 'Meta'
200
+ }
201
+
202
+ /** Normalizes a KeyCode to its modifier name if it's a modifier key */
203
+ export declare function normalizeKeyName(keyCode: KeyCode): string
204
+
188
205
  /** Simulate an input event */
189
206
  export declare function simulateEvent(event: InputEvent): void
190
207
 
191
208
  /** Start listening for input events */
192
209
  export declare function startListener(callback: (arg: InputEvent) => InputEvent): void
193
210
 
211
+ /** Converts a string key representation to its KeyCode */
212
+ export declare function stringKeyToKeycode(key: string): KeyCode | null
213
+
194
214
  /** Represents a wheel event */
195
215
  export interface WheelEvent {
196
216
  deltaX: number
package/index.js CHANGED
@@ -63,7 +63,7 @@ const isMuslFromChildProcess = () => {
63
63
  function requireNative() {
64
64
  if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
65
65
  try {
66
- return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH)
66
+ return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
67
67
  } catch (err) {
68
68
  loadErrors.push(err)
69
69
  }
@@ -75,16 +75,10 @@ function requireNative() {
75
75
  loadErrors.push(e)
76
76
  }
77
77
  try {
78
- const binding = require('node-rdev-android-arm64')
79
- const bindingPackageVersion = require('node-rdev-android-arm64/package.json').version
80
- if (
81
- bindingPackageVersion !== '1.0.0' &&
82
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
83
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
84
- ) {
85
- throw new Error(
86
- `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
87
- )
78
+ const binding = require('rdev-node-android-arm64')
79
+ const bindingPackageVersion = require('rdev-node-android-arm64/package.json').version
80
+ if (bindingPackageVersion !== '1.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
81
+ throw new Error(`Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
88
82
  }
89
83
  return binding
90
84
  } catch (e) {
@@ -97,16 +91,10 @@ function requireNative() {
97
91
  loadErrors.push(e)
98
92
  }
99
93
  try {
100
- const binding = require('node-rdev-android-arm-eabi')
101
- const bindingPackageVersion = require('node-rdev-android-arm-eabi/package.json').version
102
- if (
103
- bindingPackageVersion !== '1.0.0' &&
104
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
105
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
106
- ) {
107
- throw new Error(
108
- `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
109
- )
94
+ const binding = require('rdev-node-android-arm-eabi')
95
+ const bindingPackageVersion = require('rdev-node-android-arm-eabi/package.json').version
96
+ if (bindingPackageVersion !== '1.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
97
+ throw new Error(`Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
110
98
  }
111
99
  return binding
112
100
  } catch (e) {
@@ -117,53 +105,38 @@ function requireNative() {
117
105
  }
118
106
  } else if (process.platform === 'win32') {
119
107
  if (process.arch === 'x64') {
120
- if (
121
- process.config?.variables?.shlib_suffix === 'dll.a' ||
122
- process.config?.variables?.node_target_type === 'shared_library'
123
- ) {
108
+ if (process.config?.variables?.shlib_suffix === 'dll.a' || process.config?.variables?.node_target_type === 'shared_library') {
124
109
  try {
125
- return require('./node-rdev.win32-x64-gnu.node')
126
- } catch (e) {
127
- loadErrors.push(e)
128
- }
129
- try {
130
- const binding = require('node-rdev-win32-x64-gnu')
131
- const bindingPackageVersion = require('node-rdev-win32-x64-gnu/package.json').version
132
- if (
133
- bindingPackageVersion !== '1.0.0' &&
134
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
135
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
136
- ) {
137
- throw new Error(
138
- `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
139
- )
140
- }
141
- return binding
142
- } catch (e) {
143
- loadErrors.push(e)
110
+ return require('./node-rdev.win32-x64-gnu.node')
111
+ } catch (e) {
112
+ loadErrors.push(e)
113
+ }
114
+ try {
115
+ const binding = require('rdev-node-win32-x64-gnu')
116
+ const bindingPackageVersion = require('rdev-node-win32-x64-gnu/package.json').version
117
+ if (bindingPackageVersion !== '1.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
118
+ throw new Error(`Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
144
119
  }
120
+ return binding
121
+ } catch (e) {
122
+ loadErrors.push(e)
123
+ }
145
124
  } else {
146
125
  try {
147
- return require('./node-rdev.win32-x64-msvc.node')
148
- } catch (e) {
149
- loadErrors.push(e)
150
- }
151
- try {
152
- const binding = require('node-rdev-win32-x64-msvc')
153
- const bindingPackageVersion = require('node-rdev-win32-x64-msvc/package.json').version
154
- if (
155
- bindingPackageVersion !== '1.0.0' &&
156
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
157
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
158
- ) {
159
- throw new Error(
160
- `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
161
- )
162
- }
163
- return binding
164
- } catch (e) {
165
- loadErrors.push(e)
126
+ return require('./node-rdev.win32-x64-msvc.node')
127
+ } catch (e) {
128
+ loadErrors.push(e)
129
+ }
130
+ try {
131
+ const binding = require('rdev-node-win32-x64-msvc')
132
+ const bindingPackageVersion = require('rdev-node-win32-x64-msvc/package.json').version
133
+ if (bindingPackageVersion !== '1.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
134
+ throw new Error(`Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
166
135
  }
136
+ return binding
137
+ } catch (e) {
138
+ loadErrors.push(e)
139
+ }
167
140
  }
168
141
  } else if (process.arch === 'ia32') {
169
142
  try {
@@ -172,16 +145,10 @@ function requireNative() {
172
145
  loadErrors.push(e)
173
146
  }
174
147
  try {
175
- const binding = require('node-rdev-win32-ia32-msvc')
176
- const bindingPackageVersion = require('node-rdev-win32-ia32-msvc/package.json').version
177
- if (
178
- bindingPackageVersion !== '1.0.0' &&
179
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
180
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
181
- ) {
182
- throw new Error(
183
- `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
184
- )
148
+ const binding = require('rdev-node-win32-ia32-msvc')
149
+ const bindingPackageVersion = require('rdev-node-win32-ia32-msvc/package.json').version
150
+ if (bindingPackageVersion !== '1.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
151
+ throw new Error(`Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
185
152
  }
186
153
  return binding
187
154
  } catch (e) {
@@ -194,16 +161,10 @@ function requireNative() {
194
161
  loadErrors.push(e)
195
162
  }
196
163
  try {
197
- const binding = require('node-rdev-win32-arm64-msvc')
198
- const bindingPackageVersion = require('node-rdev-win32-arm64-msvc/package.json').version
199
- if (
200
- bindingPackageVersion !== '1.0.0' &&
201
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
202
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
203
- ) {
204
- throw new Error(
205
- `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
206
- )
164
+ const binding = require('rdev-node-win32-arm64-msvc')
165
+ const bindingPackageVersion = require('rdev-node-win32-arm64-msvc/package.json').version
166
+ if (bindingPackageVersion !== '1.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
167
+ throw new Error(`Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
207
168
  }
208
169
  return binding
209
170
  } catch (e) {
@@ -219,16 +180,10 @@ function requireNative() {
219
180
  loadErrors.push(e)
220
181
  }
221
182
  try {
222
- const binding = require('node-rdev-darwin-universal')
223
- const bindingPackageVersion = require('node-rdev-darwin-universal/package.json').version
224
- if (
225
- bindingPackageVersion !== '1.0.0' &&
226
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
227
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
228
- ) {
229
- throw new Error(
230
- `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
231
- )
183
+ const binding = require('rdev-node-darwin-universal')
184
+ const bindingPackageVersion = require('rdev-node-darwin-universal/package.json').version
185
+ if (bindingPackageVersion !== '1.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
186
+ throw new Error(`Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
232
187
  }
233
188
  return binding
234
189
  } catch (e) {
@@ -241,16 +196,10 @@ function requireNative() {
241
196
  loadErrors.push(e)
242
197
  }
243
198
  try {
244
- const binding = require('node-rdev-darwin-x64')
245
- const bindingPackageVersion = require('node-rdev-darwin-x64/package.json').version
246
- if (
247
- bindingPackageVersion !== '1.0.0' &&
248
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
249
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
250
- ) {
251
- throw new Error(
252
- `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
253
- )
199
+ const binding = require('rdev-node-darwin-x64')
200
+ const bindingPackageVersion = require('rdev-node-darwin-x64/package.json').version
201
+ if (bindingPackageVersion !== '1.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
202
+ throw new Error(`Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
254
203
  }
255
204
  return binding
256
205
  } catch (e) {
@@ -263,16 +212,10 @@ function requireNative() {
263
212
  loadErrors.push(e)
264
213
  }
265
214
  try {
266
- const binding = require('node-rdev-darwin-arm64')
267
- const bindingPackageVersion = require('node-rdev-darwin-arm64/package.json').version
268
- if (
269
- bindingPackageVersion !== '1.0.0' &&
270
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
271
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
272
- ) {
273
- throw new Error(
274
- `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
275
- )
215
+ const binding = require('rdev-node-darwin-arm64')
216
+ const bindingPackageVersion = require('rdev-node-darwin-arm64/package.json').version
217
+ if (bindingPackageVersion !== '1.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
218
+ throw new Error(`Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
276
219
  }
277
220
  return binding
278
221
  } catch (e) {
@@ -289,16 +232,10 @@ function requireNative() {
289
232
  loadErrors.push(e)
290
233
  }
291
234
  try {
292
- const binding = require('node-rdev-freebsd-x64')
293
- const bindingPackageVersion = require('node-rdev-freebsd-x64/package.json').version
294
- if (
295
- bindingPackageVersion !== '1.0.0' &&
296
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
297
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
298
- ) {
299
- throw new Error(
300
- `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
301
- )
235
+ const binding = require('rdev-node-freebsd-x64')
236
+ const bindingPackageVersion = require('rdev-node-freebsd-x64/package.json').version
237
+ if (bindingPackageVersion !== '1.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
238
+ throw new Error(`Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
302
239
  }
303
240
  return binding
304
241
  } catch (e) {
@@ -311,16 +248,10 @@ function requireNative() {
311
248
  loadErrors.push(e)
312
249
  }
313
250
  try {
314
- const binding = require('node-rdev-freebsd-arm64')
315
- const bindingPackageVersion = require('node-rdev-freebsd-arm64/package.json').version
316
- if (
317
- bindingPackageVersion !== '1.0.0' &&
318
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
319
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
320
- ) {
321
- throw new Error(
322
- `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
323
- )
251
+ const binding = require('rdev-node-freebsd-arm64')
252
+ const bindingPackageVersion = require('rdev-node-freebsd-arm64/package.json').version
253
+ if (bindingPackageVersion !== '1.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
254
+ throw new Error(`Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
324
255
  }
325
256
  return binding
326
257
  } catch (e) {
@@ -338,16 +269,10 @@ function requireNative() {
338
269
  loadErrors.push(e)
339
270
  }
340
271
  try {
341
- const binding = require('node-rdev-linux-x64-musl')
342
- const bindingPackageVersion = require('node-rdev-linux-x64-musl/package.json').version
343
- if (
344
- bindingPackageVersion !== '1.0.0' &&
345
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
346
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
347
- ) {
348
- throw new Error(
349
- `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
350
- )
272
+ const binding = require('rdev-node-linux-x64-musl')
273
+ const bindingPackageVersion = require('rdev-node-linux-x64-musl/package.json').version
274
+ if (bindingPackageVersion !== '1.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
275
+ throw new Error(`Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
351
276
  }
352
277
  return binding
353
278
  } catch (e) {
@@ -360,16 +285,10 @@ function requireNative() {
360
285
  loadErrors.push(e)
361
286
  }
362
287
  try {
363
- const binding = require('node-rdev-linux-x64-gnu')
364
- const bindingPackageVersion = require('node-rdev-linux-x64-gnu/package.json').version
365
- if (
366
- bindingPackageVersion !== '1.0.0' &&
367
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
368
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
369
- ) {
370
- throw new Error(
371
- `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
372
- )
288
+ const binding = require('rdev-node-linux-x64-gnu')
289
+ const bindingPackageVersion = require('rdev-node-linux-x64-gnu/package.json').version
290
+ if (bindingPackageVersion !== '1.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
291
+ throw new Error(`Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
373
292
  }
374
293
  return binding
375
294
  } catch (e) {
@@ -384,16 +303,10 @@ function requireNative() {
384
303
  loadErrors.push(e)
385
304
  }
386
305
  try {
387
- const binding = require('node-rdev-linux-arm64-musl')
388
- const bindingPackageVersion = require('node-rdev-linux-arm64-musl/package.json').version
389
- if (
390
- bindingPackageVersion !== '1.0.0' &&
391
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
392
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
393
- ) {
394
- throw new Error(
395
- `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
396
- )
306
+ const binding = require('rdev-node-linux-arm64-musl')
307
+ const bindingPackageVersion = require('rdev-node-linux-arm64-musl/package.json').version
308
+ if (bindingPackageVersion !== '1.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
309
+ throw new Error(`Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
397
310
  }
398
311
  return binding
399
312
  } catch (e) {
@@ -406,16 +319,10 @@ function requireNative() {
406
319
  loadErrors.push(e)
407
320
  }
408
321
  try {
409
- const binding = require('node-rdev-linux-arm64-gnu')
410
- const bindingPackageVersion = require('node-rdev-linux-arm64-gnu/package.json').version
411
- if (
412
- bindingPackageVersion !== '1.0.0' &&
413
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
414
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
415
- ) {
416
- throw new Error(
417
- `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
418
- )
322
+ const binding = require('rdev-node-linux-arm64-gnu')
323
+ const bindingPackageVersion = require('rdev-node-linux-arm64-gnu/package.json').version
324
+ if (bindingPackageVersion !== '1.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
325
+ throw new Error(`Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
419
326
  }
420
327
  return binding
421
328
  } catch (e) {
@@ -430,16 +337,10 @@ function requireNative() {
430
337
  loadErrors.push(e)
431
338
  }
432
339
  try {
433
- const binding = require('node-rdev-linux-arm-musleabihf')
434
- const bindingPackageVersion = require('node-rdev-linux-arm-musleabihf/package.json').version
435
- if (
436
- bindingPackageVersion !== '1.0.0' &&
437
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
438
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
439
- ) {
440
- throw new Error(
441
- `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
442
- )
340
+ const binding = require('rdev-node-linux-arm-musleabihf')
341
+ const bindingPackageVersion = require('rdev-node-linux-arm-musleabihf/package.json').version
342
+ if (bindingPackageVersion !== '1.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
343
+ throw new Error(`Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
443
344
  }
444
345
  return binding
445
346
  } catch (e) {
@@ -452,16 +353,10 @@ function requireNative() {
452
353
  loadErrors.push(e)
453
354
  }
454
355
  try {
455
- const binding = require('node-rdev-linux-arm-gnueabihf')
456
- const bindingPackageVersion = require('node-rdev-linux-arm-gnueabihf/package.json').version
457
- if (
458
- bindingPackageVersion !== '1.0.0' &&
459
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
460
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
461
- ) {
462
- throw new Error(
463
- `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
464
- )
356
+ const binding = require('rdev-node-linux-arm-gnueabihf')
357
+ const bindingPackageVersion = require('rdev-node-linux-arm-gnueabihf/package.json').version
358
+ if (bindingPackageVersion !== '1.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
359
+ throw new Error(`Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
465
360
  }
466
361
  return binding
467
362
  } catch (e) {
@@ -476,16 +371,10 @@ function requireNative() {
476
371
  loadErrors.push(e)
477
372
  }
478
373
  try {
479
- const binding = require('node-rdev-linux-loong64-musl')
480
- const bindingPackageVersion = require('node-rdev-linux-loong64-musl/package.json').version
481
- if (
482
- bindingPackageVersion !== '1.0.0' &&
483
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
484
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
485
- ) {
486
- throw new Error(
487
- `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
488
- )
374
+ const binding = require('rdev-node-linux-loong64-musl')
375
+ const bindingPackageVersion = require('rdev-node-linux-loong64-musl/package.json').version
376
+ if (bindingPackageVersion !== '1.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
377
+ throw new Error(`Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
489
378
  }
490
379
  return binding
491
380
  } catch (e) {
@@ -498,16 +387,10 @@ function requireNative() {
498
387
  loadErrors.push(e)
499
388
  }
500
389
  try {
501
- const binding = require('node-rdev-linux-loong64-gnu')
502
- const bindingPackageVersion = require('node-rdev-linux-loong64-gnu/package.json').version
503
- if (
504
- bindingPackageVersion !== '1.0.0' &&
505
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
506
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
507
- ) {
508
- throw new Error(
509
- `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
510
- )
390
+ const binding = require('rdev-node-linux-loong64-gnu')
391
+ const bindingPackageVersion = require('rdev-node-linux-loong64-gnu/package.json').version
392
+ if (bindingPackageVersion !== '1.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
393
+ throw new Error(`Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
511
394
  }
512
395
  return binding
513
396
  } catch (e) {
@@ -522,16 +405,10 @@ function requireNative() {
522
405
  loadErrors.push(e)
523
406
  }
524
407
  try {
525
- const binding = require('node-rdev-linux-riscv64-musl')
526
- const bindingPackageVersion = require('node-rdev-linux-riscv64-musl/package.json').version
527
- if (
528
- bindingPackageVersion !== '1.0.0' &&
529
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
530
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
531
- ) {
532
- throw new Error(
533
- `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
534
- )
408
+ const binding = require('rdev-node-linux-riscv64-musl')
409
+ const bindingPackageVersion = require('rdev-node-linux-riscv64-musl/package.json').version
410
+ if (bindingPackageVersion !== '1.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
411
+ throw new Error(`Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
535
412
  }
536
413
  return binding
537
414
  } catch (e) {
@@ -544,16 +421,10 @@ function requireNative() {
544
421
  loadErrors.push(e)
545
422
  }
546
423
  try {
547
- const binding = require('node-rdev-linux-riscv64-gnu')
548
- const bindingPackageVersion = require('node-rdev-linux-riscv64-gnu/package.json').version
549
- if (
550
- bindingPackageVersion !== '1.0.0' &&
551
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
552
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
553
- ) {
554
- throw new Error(
555
- `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
556
- )
424
+ const binding = require('rdev-node-linux-riscv64-gnu')
425
+ const bindingPackageVersion = require('rdev-node-linux-riscv64-gnu/package.json').version
426
+ if (bindingPackageVersion !== '1.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
427
+ throw new Error(`Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
557
428
  }
558
429
  return binding
559
430
  } catch (e) {
@@ -567,16 +438,10 @@ function requireNative() {
567
438
  loadErrors.push(e)
568
439
  }
569
440
  try {
570
- const binding = require('node-rdev-linux-ppc64-gnu')
571
- const bindingPackageVersion = require('node-rdev-linux-ppc64-gnu/package.json').version
572
- if (
573
- bindingPackageVersion !== '1.0.0' &&
574
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
575
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
576
- ) {
577
- throw new Error(
578
- `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
579
- )
441
+ const binding = require('rdev-node-linux-ppc64-gnu')
442
+ const bindingPackageVersion = require('rdev-node-linux-ppc64-gnu/package.json').version
443
+ if (bindingPackageVersion !== '1.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
444
+ throw new Error(`Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
580
445
  }
581
446
  return binding
582
447
  } catch (e) {
@@ -589,16 +454,10 @@ function requireNative() {
589
454
  loadErrors.push(e)
590
455
  }
591
456
  try {
592
- const binding = require('node-rdev-linux-s390x-gnu')
593
- const bindingPackageVersion = require('node-rdev-linux-s390x-gnu/package.json').version
594
- if (
595
- bindingPackageVersion !== '1.0.0' &&
596
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
597
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
598
- ) {
599
- throw new Error(
600
- `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
601
- )
457
+ const binding = require('rdev-node-linux-s390x-gnu')
458
+ const bindingPackageVersion = require('rdev-node-linux-s390x-gnu/package.json').version
459
+ if (bindingPackageVersion !== '1.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
460
+ throw new Error(`Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
602
461
  }
603
462
  return binding
604
463
  } catch (e) {
@@ -615,16 +474,10 @@ function requireNative() {
615
474
  loadErrors.push(e)
616
475
  }
617
476
  try {
618
- const binding = require('node-rdev-openharmony-arm64')
619
- const bindingPackageVersion = require('node-rdev-openharmony-arm64/package.json').version
620
- if (
621
- bindingPackageVersion !== '1.0.0' &&
622
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
623
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
624
- ) {
625
- throw new Error(
626
- `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
627
- )
477
+ const binding = require('rdev-node-openharmony-arm64')
478
+ const bindingPackageVersion = require('rdev-node-openharmony-arm64/package.json').version
479
+ if (bindingPackageVersion !== '1.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
480
+ throw new Error(`Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
628
481
  }
629
482
  return binding
630
483
  } catch (e) {
@@ -637,16 +490,10 @@ function requireNative() {
637
490
  loadErrors.push(e)
638
491
  }
639
492
  try {
640
- const binding = require('node-rdev-openharmony-x64')
641
- const bindingPackageVersion = require('node-rdev-openharmony-x64/package.json').version
642
- if (
643
- bindingPackageVersion !== '1.0.0' &&
644
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
645
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
646
- ) {
647
- throw new Error(
648
- `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
649
- )
493
+ const binding = require('rdev-node-openharmony-x64')
494
+ const bindingPackageVersion = require('rdev-node-openharmony-x64/package.json').version
495
+ if (bindingPackageVersion !== '1.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
496
+ throw new Error(`Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
650
497
  }
651
498
  return binding
652
499
  } catch (e) {
@@ -659,16 +506,10 @@ function requireNative() {
659
506
  loadErrors.push(e)
660
507
  }
661
508
  try {
662
- const binding = require('node-rdev-openharmony-arm')
663
- const bindingPackageVersion = require('node-rdev-openharmony-arm/package.json').version
664
- if (
665
- bindingPackageVersion !== '1.0.0' &&
666
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
667
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0'
668
- ) {
669
- throw new Error(
670
- `Native binding package version mismatch, expected 1.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
671
- )
509
+ const binding = require('rdev-node-openharmony-arm')
510
+ const bindingPackageVersion = require('rdev-node-openharmony-arm/package.json').version
511
+ if (bindingPackageVersion !== '1.0.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
512
+ throw new Error(`Native binding package version mismatch, expected 1.0.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
672
513
  }
673
514
  return binding
674
515
  } catch (e) {
@@ -697,7 +538,7 @@ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
697
538
  }
698
539
  if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
699
540
  try {
700
- wasiBinding = require('node-rdev-wasm32-wasi')
541
+ wasiBinding = require('rdev-node-wasm32-wasi')
701
542
  nativeBinding = wasiBinding
702
543
  } catch (err) {
703
544
  if (process.env.NAPI_RS_FORCE_WASI) {
@@ -738,6 +579,11 @@ module.exports = nativeBinding
738
579
  module.exports.ButtonType = nativeBinding.ButtonType
739
580
  module.exports.EventTypeValue = nativeBinding.EventTypeValue
740
581
  module.exports.getDisplaySize = nativeBinding.getDisplaySize
582
+ module.exports.initSimulation = nativeBinding.initSimulation
583
+ module.exports.isModifierKey = nativeBinding.isModifierKey
741
584
  module.exports.KeyCode = nativeBinding.KeyCode
585
+ module.exports.NormalizedModifier = nativeBinding.NormalizedModifier
586
+ module.exports.normalizeKeyName = nativeBinding.normalizeKeyName
742
587
  module.exports.simulateEvent = nativeBinding.simulateEvent
743
588
  module.exports.startListener = nativeBinding.startListener
589
+ module.exports.stringKeyToKeycode = nativeBinding.stringKeyToKeycode
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rdev-node",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "node version of rdev",
5
5
  "main": "index.js",
6
6
  "repository": "https://github.com/nglmercer/rdev-node",
@@ -45,48 +45,30 @@
45
45
  },
46
46
  "scripts": {
47
47
  "artifacts": "napi artifacts",
48
- "build": "napi build --platform --release --pipe \"prettier -w\"",
49
- "build:debug": "napi build --platform --pipe \"prettier -w\"",
50
- "format": "run-p format:prettier format:rs format:toml",
51
- "format:prettier": "prettier . -w",
52
- "format:toml": "taplo format",
53
- "format:rs": "cargo fmt",
54
- "lint": "eslint .",
55
- "test": "bun test",
56
- "test:node": "node --test tests/node-test.cjs",
57
- "test:binding": "node --test tests/binding.test.cjs",
48
+ "build": "napi build --platform --release --pipe \"biome format --write\"",
49
+ "build:debug": "napi build --platform --pipe \"biome format --write\"",
50
+ "format": "biome format --write . && cargo fmt && taplo format",
51
+ "lint": "biome check --write .",
52
+ "test": "node --test tests/complete.test.cjs",
53
+ "test:all": "node --test tests/*.test.cjs",
58
54
  "version": "napi version"
59
55
  },
60
56
  "devDependencies": {
57
+ "@biomejs/biome": "1.9.4",
61
58
  "@napi-rs/cli": "^3.5.1",
62
- "@typescript-eslint/eslint-plugin": "^8.18.0",
63
- "@typescript-eslint/parser": "^8.18.0",
64
59
  "@types/bun": "^1.1.5",
65
60
  "@types/node": "^22.10.5",
66
- "chalk": "^5.4.1",
67
- "eslint": "^9.17.0",
68
- "eslint-config-prettier": "^9.1.0",
69
- "eslint-plugin-import": "^2.31.0",
70
- "eslint-plugin-prettier": "^5.2.1",
71
- "prettier": "^3.4.2",
72
61
  "typescript": "^5.7.2"
73
62
  },
74
63
  "lint-staged": {
75
64
  "*.@(js|ts|tsx)": [
76
- "eslint --fix"
65
+ "biome check --write"
77
66
  ],
78
67
  "*.@(js|ts|tsx|yml|yaml|md|json)": [
79
- "prettier --write"
68
+ "biome format --write"
80
69
  ],
81
70
  "*.toml": [
82
71
  "taplo format"
83
72
  ]
84
- },
85
- "prettier": {
86
- "printWidth": 120,
87
- "semi": false,
88
- "trailingComma": "all",
89
- "singleQuote": true,
90
- "arrowParens": "always"
91
73
  }
92
- }
74
+ }