wickra-screener 0.1.6 → 0.1.8
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 +9 -0
- package/index.js +160 -82
- package/package.json +8 -8
- package/wickra-screener.darwin-arm64.node +0 -0
- package/wickra-screener.darwin-x64.node +0 -0
- package/wickra-screener.linux-arm64-gnu.node +0 -0
- package/wickra-screener.linux-x64-gnu.node +0 -0
- package/wickra-screener.win32-arm64-msvc.node +0 -0
- package/wickra-screener.win32-x64-msvc.node +0 -0
package/index.d.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
/* auto-generated by NAPI-RS */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Which binding artifact the generated loader actually loaded: `'native'` for
|
|
6
|
+
* a native addon, otherwise the `platformArchABI` of the WASI flavor. Every
|
|
7
|
+
* flavor napi-rs can build is listed, because `NAPI_RS_NATIVE_LIBRARY_PATH`
|
|
8
|
+
* can point the loader at a WASI artifact this package does not build itself.
|
|
9
|
+
*/
|
|
10
|
+
export declare const __napiBindingTarget: 'native' | 'wasm32-wasi' | 'wasm32-wasip1'
|
|
11
|
+
|
|
3
12
|
/** A screener instance driven by JSON commands. */
|
|
4
13
|
export declare class Screener {
|
|
5
14
|
/** Build a screener from a spec JSON string. */
|
package/index.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
// prettier-ignore
|
|
2
1
|
/* eslint-disable */
|
|
3
2
|
// @ts-nocheck
|
|
4
3
|
/* auto-generated by NAPI-RS */
|
|
5
4
|
|
|
6
5
|
const { readFileSync } = require('fs')
|
|
7
6
|
let nativeBinding = null
|
|
7
|
+
// Which artifact actually loaded. The WASI fallback chain overwrites it with
|
|
8
|
+
// the flavor it resolved; the late native retry below leaves it alone because
|
|
9
|
+
// it only runs while no WASI candidate has been loaded.
|
|
10
|
+
let __napiLoadedBindingTarget = 'native'
|
|
8
11
|
const loadErrors = []
|
|
9
12
|
|
|
10
13
|
const isMusl = () => {
|
|
@@ -63,7 +66,16 @@ const isMuslFromChildProcess = () => {
|
|
|
63
66
|
function requireNative() {
|
|
64
67
|
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
|
|
65
68
|
try {
|
|
66
|
-
|
|
69
|
+
const overrideBinding = require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH)
|
|
70
|
+
// The override may be a generated WASI loader, which already reports its
|
|
71
|
+
// own flavor. Adopt it: `module.exports` aliases this object, so claiming
|
|
72
|
+
// 'native' would both misreport the artifact and overwrite the loader's
|
|
73
|
+
// marker through the alias.
|
|
74
|
+
__napiLoadedBindingTarget =
|
|
75
|
+
overrideBinding && typeof overrideBinding.__napiBindingTarget === 'string'
|
|
76
|
+
? overrideBinding.__napiBindingTarget
|
|
77
|
+
: 'native'
|
|
78
|
+
return overrideBinding
|
|
67
79
|
} catch (err) {
|
|
68
80
|
loadErrors.push(err)
|
|
69
81
|
}
|
|
@@ -77,8 +89,8 @@ function requireNative() {
|
|
|
77
89
|
try {
|
|
78
90
|
const binding = require('wickra-screener-android-arm64')
|
|
79
91
|
const bindingPackageVersion = require('wickra-screener-android-arm64/package.json').version
|
|
80
|
-
if (bindingPackageVersion !== '0.1.
|
|
81
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
92
|
+
if (bindingPackageVersion !== '0.1.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
93
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
82
94
|
}
|
|
83
95
|
return binding
|
|
84
96
|
} catch (e) {
|
|
@@ -93,8 +105,8 @@ function requireNative() {
|
|
|
93
105
|
try {
|
|
94
106
|
const binding = require('wickra-screener-android-arm-eabi')
|
|
95
107
|
const bindingPackageVersion = require('wickra-screener-android-arm-eabi/package.json').version
|
|
96
|
-
if (bindingPackageVersion !== '0.1.
|
|
97
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
108
|
+
if (bindingPackageVersion !== '0.1.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
109
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
98
110
|
}
|
|
99
111
|
return binding
|
|
100
112
|
} catch (e) {
|
|
@@ -107,36 +119,36 @@ function requireNative() {
|
|
|
107
119
|
if (process.arch === 'x64') {
|
|
108
120
|
if ((process.config && process.config.variables && process.config.variables.shlib_suffix === 'dll.a') || (process.config && process.config.variables && process.config.variables.node_target_type === 'shared_library')) {
|
|
109
121
|
try {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
122
|
+
return require('./wickra-screener.win32-x64-gnu.node')
|
|
123
|
+
} catch (e) {
|
|
124
|
+
loadErrors.push(e)
|
|
125
|
+
}
|
|
126
|
+
try {
|
|
127
|
+
const binding = require('wickra-screener-win32-x64-gnu')
|
|
128
|
+
const bindingPackageVersion = require('wickra-screener-win32-x64-gnu/package.json').version
|
|
129
|
+
if (bindingPackageVersion !== '0.1.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
130
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
131
|
+
}
|
|
132
|
+
return binding
|
|
133
|
+
} catch (e) {
|
|
134
|
+
loadErrors.push(e)
|
|
119
135
|
}
|
|
120
|
-
return binding
|
|
121
|
-
} catch (e) {
|
|
122
|
-
loadErrors.push(e)
|
|
123
|
-
}
|
|
124
136
|
} else {
|
|
125
137
|
try {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
138
|
+
return require('./wickra-screener.win32-x64-msvc.node')
|
|
139
|
+
} catch (e) {
|
|
140
|
+
loadErrors.push(e)
|
|
141
|
+
}
|
|
142
|
+
try {
|
|
143
|
+
const binding = require('wickra-screener-win32-x64-msvc')
|
|
144
|
+
const bindingPackageVersion = require('wickra-screener-win32-x64-msvc/package.json').version
|
|
145
|
+
if (bindingPackageVersion !== '0.1.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
146
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
147
|
+
}
|
|
148
|
+
return binding
|
|
149
|
+
} catch (e) {
|
|
150
|
+
loadErrors.push(e)
|
|
135
151
|
}
|
|
136
|
-
return binding
|
|
137
|
-
} catch (e) {
|
|
138
|
-
loadErrors.push(e)
|
|
139
|
-
}
|
|
140
152
|
}
|
|
141
153
|
} else if (process.arch === 'ia32') {
|
|
142
154
|
try {
|
|
@@ -147,8 +159,8 @@ function requireNative() {
|
|
|
147
159
|
try {
|
|
148
160
|
const binding = require('wickra-screener-win32-ia32-msvc')
|
|
149
161
|
const bindingPackageVersion = require('wickra-screener-win32-ia32-msvc/package.json').version
|
|
150
|
-
if (bindingPackageVersion !== '0.1.
|
|
151
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
162
|
+
if (bindingPackageVersion !== '0.1.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
163
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
152
164
|
}
|
|
153
165
|
return binding
|
|
154
166
|
} catch (e) {
|
|
@@ -163,8 +175,8 @@ function requireNative() {
|
|
|
163
175
|
try {
|
|
164
176
|
const binding = require('wickra-screener-win32-arm64-msvc')
|
|
165
177
|
const bindingPackageVersion = require('wickra-screener-win32-arm64-msvc/package.json').version
|
|
166
|
-
if (bindingPackageVersion !== '0.1.
|
|
167
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
178
|
+
if (bindingPackageVersion !== '0.1.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
179
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
168
180
|
}
|
|
169
181
|
return binding
|
|
170
182
|
} catch (e) {
|
|
@@ -182,8 +194,8 @@ function requireNative() {
|
|
|
182
194
|
try {
|
|
183
195
|
const binding = require('wickra-screener-darwin-universal')
|
|
184
196
|
const bindingPackageVersion = require('wickra-screener-darwin-universal/package.json').version
|
|
185
|
-
if (bindingPackageVersion !== '0.1.
|
|
186
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
197
|
+
if (bindingPackageVersion !== '0.1.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
198
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
187
199
|
}
|
|
188
200
|
return binding
|
|
189
201
|
} catch (e) {
|
|
@@ -198,8 +210,8 @@ function requireNative() {
|
|
|
198
210
|
try {
|
|
199
211
|
const binding = require('wickra-screener-darwin-x64')
|
|
200
212
|
const bindingPackageVersion = require('wickra-screener-darwin-x64/package.json').version
|
|
201
|
-
if (bindingPackageVersion !== '0.1.
|
|
202
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
213
|
+
if (bindingPackageVersion !== '0.1.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
214
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
203
215
|
}
|
|
204
216
|
return binding
|
|
205
217
|
} catch (e) {
|
|
@@ -214,8 +226,8 @@ function requireNative() {
|
|
|
214
226
|
try {
|
|
215
227
|
const binding = require('wickra-screener-darwin-arm64')
|
|
216
228
|
const bindingPackageVersion = require('wickra-screener-darwin-arm64/package.json').version
|
|
217
|
-
if (bindingPackageVersion !== '0.1.
|
|
218
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
229
|
+
if (bindingPackageVersion !== '0.1.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
230
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
219
231
|
}
|
|
220
232
|
return binding
|
|
221
233
|
} catch (e) {
|
|
@@ -234,8 +246,8 @@ function requireNative() {
|
|
|
234
246
|
try {
|
|
235
247
|
const binding = require('wickra-screener-freebsd-x64')
|
|
236
248
|
const bindingPackageVersion = require('wickra-screener-freebsd-x64/package.json').version
|
|
237
|
-
if (bindingPackageVersion !== '0.1.
|
|
238
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
249
|
+
if (bindingPackageVersion !== '0.1.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
250
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
239
251
|
}
|
|
240
252
|
return binding
|
|
241
253
|
} catch (e) {
|
|
@@ -250,8 +262,8 @@ function requireNative() {
|
|
|
250
262
|
try {
|
|
251
263
|
const binding = require('wickra-screener-freebsd-arm64')
|
|
252
264
|
const bindingPackageVersion = require('wickra-screener-freebsd-arm64/package.json').version
|
|
253
|
-
if (bindingPackageVersion !== '0.1.
|
|
254
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
265
|
+
if (bindingPackageVersion !== '0.1.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
266
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
255
267
|
}
|
|
256
268
|
return binding
|
|
257
269
|
} catch (e) {
|
|
@@ -271,8 +283,8 @@ function requireNative() {
|
|
|
271
283
|
try {
|
|
272
284
|
const binding = require('wickra-screener-linux-x64-musl')
|
|
273
285
|
const bindingPackageVersion = require('wickra-screener-linux-x64-musl/package.json').version
|
|
274
|
-
if (bindingPackageVersion !== '0.1.
|
|
275
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
286
|
+
if (bindingPackageVersion !== '0.1.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
287
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
276
288
|
}
|
|
277
289
|
return binding
|
|
278
290
|
} catch (e) {
|
|
@@ -287,8 +299,8 @@ function requireNative() {
|
|
|
287
299
|
try {
|
|
288
300
|
const binding = require('wickra-screener-linux-x64-gnu')
|
|
289
301
|
const bindingPackageVersion = require('wickra-screener-linux-x64-gnu/package.json').version
|
|
290
|
-
if (bindingPackageVersion !== '0.1.
|
|
291
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
302
|
+
if (bindingPackageVersion !== '0.1.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
303
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
292
304
|
}
|
|
293
305
|
return binding
|
|
294
306
|
} catch (e) {
|
|
@@ -305,8 +317,8 @@ function requireNative() {
|
|
|
305
317
|
try {
|
|
306
318
|
const binding = require('wickra-screener-linux-arm64-musl')
|
|
307
319
|
const bindingPackageVersion = require('wickra-screener-linux-arm64-musl/package.json').version
|
|
308
|
-
if (bindingPackageVersion !== '0.1.
|
|
309
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
320
|
+
if (bindingPackageVersion !== '0.1.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
321
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
310
322
|
}
|
|
311
323
|
return binding
|
|
312
324
|
} catch (e) {
|
|
@@ -321,8 +333,8 @@ function requireNative() {
|
|
|
321
333
|
try {
|
|
322
334
|
const binding = require('wickra-screener-linux-arm64-gnu')
|
|
323
335
|
const bindingPackageVersion = require('wickra-screener-linux-arm64-gnu/package.json').version
|
|
324
|
-
if (bindingPackageVersion !== '0.1.
|
|
325
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
336
|
+
if (bindingPackageVersion !== '0.1.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
337
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
326
338
|
}
|
|
327
339
|
return binding
|
|
328
340
|
} catch (e) {
|
|
@@ -339,8 +351,8 @@ function requireNative() {
|
|
|
339
351
|
try {
|
|
340
352
|
const binding = require('wickra-screener-linux-arm-musleabihf')
|
|
341
353
|
const bindingPackageVersion = require('wickra-screener-linux-arm-musleabihf/package.json').version
|
|
342
|
-
if (bindingPackageVersion !== '0.1.
|
|
343
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
354
|
+
if (bindingPackageVersion !== '0.1.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
355
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
344
356
|
}
|
|
345
357
|
return binding
|
|
346
358
|
} catch (e) {
|
|
@@ -355,8 +367,8 @@ function requireNative() {
|
|
|
355
367
|
try {
|
|
356
368
|
const binding = require('wickra-screener-linux-arm-gnueabihf')
|
|
357
369
|
const bindingPackageVersion = require('wickra-screener-linux-arm-gnueabihf/package.json').version
|
|
358
|
-
if (bindingPackageVersion !== '0.1.
|
|
359
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
370
|
+
if (bindingPackageVersion !== '0.1.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
371
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
360
372
|
}
|
|
361
373
|
return binding
|
|
362
374
|
} catch (e) {
|
|
@@ -373,8 +385,8 @@ function requireNative() {
|
|
|
373
385
|
try {
|
|
374
386
|
const binding = require('wickra-screener-linux-loong64-musl')
|
|
375
387
|
const bindingPackageVersion = require('wickra-screener-linux-loong64-musl/package.json').version
|
|
376
|
-
if (bindingPackageVersion !== '0.1.
|
|
377
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
388
|
+
if (bindingPackageVersion !== '0.1.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
389
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
378
390
|
}
|
|
379
391
|
return binding
|
|
380
392
|
} catch (e) {
|
|
@@ -389,8 +401,8 @@ function requireNative() {
|
|
|
389
401
|
try {
|
|
390
402
|
const binding = require('wickra-screener-linux-loong64-gnu')
|
|
391
403
|
const bindingPackageVersion = require('wickra-screener-linux-loong64-gnu/package.json').version
|
|
392
|
-
if (bindingPackageVersion !== '0.1.
|
|
393
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
404
|
+
if (bindingPackageVersion !== '0.1.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
405
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
394
406
|
}
|
|
395
407
|
return binding
|
|
396
408
|
} catch (e) {
|
|
@@ -407,8 +419,8 @@ function requireNative() {
|
|
|
407
419
|
try {
|
|
408
420
|
const binding = require('wickra-screener-linux-riscv64-musl')
|
|
409
421
|
const bindingPackageVersion = require('wickra-screener-linux-riscv64-musl/package.json').version
|
|
410
|
-
if (bindingPackageVersion !== '0.1.
|
|
411
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
422
|
+
if (bindingPackageVersion !== '0.1.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
423
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
412
424
|
}
|
|
413
425
|
return binding
|
|
414
426
|
} catch (e) {
|
|
@@ -423,8 +435,8 @@ function requireNative() {
|
|
|
423
435
|
try {
|
|
424
436
|
const binding = require('wickra-screener-linux-riscv64-gnu')
|
|
425
437
|
const bindingPackageVersion = require('wickra-screener-linux-riscv64-gnu/package.json').version
|
|
426
|
-
if (bindingPackageVersion !== '0.1.
|
|
427
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
438
|
+
if (bindingPackageVersion !== '0.1.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
439
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
428
440
|
}
|
|
429
441
|
return binding
|
|
430
442
|
} catch (e) {
|
|
@@ -440,8 +452,8 @@ function requireNative() {
|
|
|
440
452
|
try {
|
|
441
453
|
const binding = require('wickra-screener-linux-ppc64-gnu')
|
|
442
454
|
const bindingPackageVersion = require('wickra-screener-linux-ppc64-gnu/package.json').version
|
|
443
|
-
if (bindingPackageVersion !== '0.1.
|
|
444
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
455
|
+
if (bindingPackageVersion !== '0.1.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
456
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
445
457
|
}
|
|
446
458
|
return binding
|
|
447
459
|
} catch (e) {
|
|
@@ -456,8 +468,8 @@ function requireNative() {
|
|
|
456
468
|
try {
|
|
457
469
|
const binding = require('wickra-screener-linux-s390x-gnu')
|
|
458
470
|
const bindingPackageVersion = require('wickra-screener-linux-s390x-gnu/package.json').version
|
|
459
|
-
if (bindingPackageVersion !== '0.1.
|
|
460
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
471
|
+
if (bindingPackageVersion !== '0.1.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
472
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
461
473
|
}
|
|
462
474
|
return binding
|
|
463
475
|
} catch (e) {
|
|
@@ -476,8 +488,8 @@ function requireNative() {
|
|
|
476
488
|
try {
|
|
477
489
|
const binding = require('wickra-screener-openharmony-arm64')
|
|
478
490
|
const bindingPackageVersion = require('wickra-screener-openharmony-arm64/package.json').version
|
|
479
|
-
if (bindingPackageVersion !== '0.1.
|
|
480
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
491
|
+
if (bindingPackageVersion !== '0.1.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
492
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
481
493
|
}
|
|
482
494
|
return binding
|
|
483
495
|
} catch (e) {
|
|
@@ -492,8 +504,8 @@ function requireNative() {
|
|
|
492
504
|
try {
|
|
493
505
|
const binding = require('wickra-screener-openharmony-x64')
|
|
494
506
|
const bindingPackageVersion = require('wickra-screener-openharmony-x64/package.json').version
|
|
495
|
-
if (bindingPackageVersion !== '0.1.
|
|
496
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
507
|
+
if (bindingPackageVersion !== '0.1.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
508
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
497
509
|
}
|
|
498
510
|
return binding
|
|
499
511
|
} catch (e) {
|
|
@@ -508,8 +520,8 @@ function requireNative() {
|
|
|
508
520
|
try {
|
|
509
521
|
const binding = require('wickra-screener-openharmony-arm')
|
|
510
522
|
const bindingPackageVersion = require('wickra-screener-openharmony-arm/package.json').version
|
|
511
|
-
if (bindingPackageVersion !== '0.1.
|
|
512
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
523
|
+
if (bindingPackageVersion !== '0.1.8' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
524
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
513
525
|
}
|
|
514
526
|
return binding
|
|
515
527
|
} catch (e) {
|
|
@@ -550,7 +562,7 @@ function createLoadErrorChain(errors) {
|
|
|
550
562
|
//
|
|
551
563
|
// NAPI_RS_WASI_FLAVOR selects one exact generated flavor and implies strict
|
|
552
564
|
// WASI loading. It never crosses into another flavor or falls back to native.
|
|
553
|
-
const __napiWasiFlavors = [
|
|
565
|
+
const __napiWasiFlavors = ['wasm32-wasi']
|
|
554
566
|
const __napiWasiFlavor = process.env.NAPI_RS_WASI_FLAVOR
|
|
555
567
|
const __napiWasiFlavorRequested =
|
|
556
568
|
typeof __napiWasiFlavor === 'string' && __napiWasiFlavor.length > 0
|
|
@@ -619,15 +631,16 @@ if (!nativeBinding || forceWasi) {
|
|
|
619
631
|
}
|
|
620
632
|
return null
|
|
621
633
|
}
|
|
622
|
-
if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor ===
|
|
634
|
+
if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor === 'wasm32-wasi')) {
|
|
623
635
|
let candidateError = null
|
|
624
636
|
let candidateFailed = false
|
|
625
637
|
try {
|
|
626
|
-
candidateError = __napiWasiResolveCandidate('./wickra-screener.wasi.cjs', false, [
|
|
638
|
+
candidateError = __napiWasiResolveCandidate('./wickra-screener.wasi.cjs', false, ['./wickra-screener.wasm32-wasi.debug.wasm', './wickra-screener.wasm32-wasi.wasm'])
|
|
627
639
|
candidateFailed = candidateError !== null
|
|
628
640
|
if (!candidateFailed) {
|
|
629
641
|
wasiBinding = require('./wickra-screener.wasi.cjs')
|
|
630
642
|
nativeBinding = wasiBinding
|
|
643
|
+
__napiLoadedBindingTarget = 'wasm32-wasi'
|
|
631
644
|
wasiBindingLoaded = true
|
|
632
645
|
}
|
|
633
646
|
} catch (err) {
|
|
@@ -639,7 +652,7 @@ if (!nativeBinding || forceWasi) {
|
|
|
639
652
|
loadErrors.push(candidateError)
|
|
640
653
|
}
|
|
641
654
|
}
|
|
642
|
-
if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor ===
|
|
655
|
+
if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor === 'wasm32-wasi')) {
|
|
643
656
|
let candidateError = null
|
|
644
657
|
let candidateFailed = false
|
|
645
658
|
try {
|
|
@@ -648,12 +661,13 @@ if (!nativeBinding || forceWasi) {
|
|
|
648
661
|
if (!candidateFailed) {
|
|
649
662
|
if (process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
650
663
|
const bindingPackageVersion = require('wickra-screener-wasm32-wasi/package.json').version
|
|
651
|
-
if (bindingPackageVersion !== '0.1.
|
|
652
|
-
throw new Error(`WASI binding package version mismatch, expected 0.1.
|
|
664
|
+
if (bindingPackageVersion !== '0.1.8') {
|
|
665
|
+
throw new Error(`WASI binding package version mismatch, expected 0.1.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
653
666
|
}
|
|
654
667
|
}
|
|
655
668
|
wasiBinding = require('wickra-screener-wasm32-wasi')
|
|
656
669
|
nativeBinding = wasiBinding
|
|
670
|
+
__napiLoadedBindingTarget = 'wasm32-wasi'
|
|
657
671
|
wasiBindingLoaded = true
|
|
658
672
|
}
|
|
659
673
|
} catch (err) {
|
|
@@ -699,6 +713,70 @@ if (!nativeBinding) {
|
|
|
699
713
|
throw new Error(`Failed to load native binding`)
|
|
700
714
|
}
|
|
701
715
|
|
|
716
|
+
function __napiStampBindingTarget(exportsObject, target) {
|
|
717
|
+
if (
|
|
718
|
+
Object.prototype.hasOwnProperty.call(exportsObject, '__napiBindingTarget')
|
|
719
|
+
) {
|
|
720
|
+
if (exportsObject.__napiBindingTarget === target) {
|
|
721
|
+
// Already ours: the root entry aliases the object it loaded, so a WASI
|
|
722
|
+
// fallback candidate — or a `NAPI_RS_NATIVE_LIBRARY_PATH` override that
|
|
723
|
+
// is a generated loader — arrives already stamped with this same value.
|
|
724
|
+
return target
|
|
725
|
+
}
|
|
726
|
+
const error = new Error(
|
|
727
|
+
'`__napiBindingTarget` is reserved by the generated binding loader, but the loaded binding already exports it. Rename the export, e.g. #[napi(js_name = "...")].',
|
|
728
|
+
)
|
|
729
|
+
error.code = 'ERR_NAPI_BINDING_TARGET_CONFLICT'
|
|
730
|
+
throw error
|
|
731
|
+
}
|
|
732
|
+
if (!Object.isExtensible(exportsObject)) {
|
|
733
|
+
// A `#[napi(module_exports)]` hook may seal or freeze this object
|
|
734
|
+
// (`Object::seal` / `Object::freeze`). Reporting the artifact is metadata,
|
|
735
|
+
// never a reason to fail an otherwise successful load, so the stamp is
|
|
736
|
+
// skipped. What a consumer still sees then follows the entry point: the
|
|
737
|
+
// browser and deferred loaders declare `__napiBindingTarget` at module
|
|
738
|
+
// level and go on reporting it, while the CommonJS entries hand back this
|
|
739
|
+
// very object as `module.exports`, so there the value is absent.
|
|
740
|
+
return target
|
|
741
|
+
}
|
|
742
|
+
try {
|
|
743
|
+
// [[Define]], not [[Set]]: an ordinary assignment walks the prototype
|
|
744
|
+
// chain, so an inherited accessor could swallow the value or throw and
|
|
745
|
+
// fail an otherwise successful load. The descriptor is what a successful
|
|
746
|
+
// assignment would have produced.
|
|
747
|
+
Object.defineProperty(exportsObject, '__napiBindingTarget', {
|
|
748
|
+
configurable: true,
|
|
749
|
+
enumerable: true,
|
|
750
|
+
value: target,
|
|
751
|
+
writable: true,
|
|
752
|
+
})
|
|
753
|
+
} catch {
|
|
754
|
+
// Same rule as the non-extensible skip above: reporting the artifact is
|
|
755
|
+
// metadata, never a reason to fail an otherwise successful load. An exotic
|
|
756
|
+
// object (a Proxy whose defineProperty trap refuses) is skipped, not
|
|
757
|
+
// thrown over.
|
|
758
|
+
}
|
|
759
|
+
// The CommonJS loaders assign this return value so `cjs-module-lexer` — and
|
|
760
|
+
// therefore Node's CJS -> ESM named export detection — can see
|
|
761
|
+
// `__napiBindingTarget` statically.
|
|
762
|
+
return target
|
|
763
|
+
}
|
|
764
|
+
// Stamp before the alias, not after. The guard only reads `nativeBinding`
|
|
765
|
+
// (`hasOwnProperty` plus a comparison), which is safe against any addon
|
|
766
|
+
// accessor; an assignment is not, because a `#[napi(module_exports)]` hook can
|
|
767
|
+
// expose a getter reporting this very value and a setter that throws. So the
|
|
768
|
+
// assignment lands on the loader's own `module.exports`, still the original
|
|
769
|
+
// object here, and the alias below replaces it.
|
|
770
|
+
//
|
|
771
|
+
// The assignment is what keeps the marker a statically visible CommonJS export:
|
|
772
|
+
// `cjs-module-lexer` is Node's CJS -> ESM named export detection, it cannot see
|
|
773
|
+
// a bare call, and the later `module.exports = nativeBinding` does not undo the
|
|
774
|
+
// detection. The assignment itself always succeeds — its target is this
|
|
775
|
+
// loader's own, still extensible `module.exports` — and the alias below then
|
|
776
|
+
// discards the value it wrote. What a consumer reads is whatever the guard put
|
|
777
|
+
// on `nativeBinding`, so on a frozen binding, where the guard skips, the
|
|
778
|
+
// linked import resolves to `undefined`.
|
|
779
|
+
module.exports.__napiBindingTarget = __napiStampBindingTarget(nativeBinding, __napiLoadedBindingTarget)
|
|
702
780
|
module.exports = nativeBinding
|
|
703
781
|
module.exports.Screener = nativeBinding.Screener
|
|
704
782
|
module.exports.version = nativeBinding.version
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wickra-screener",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "The data-driven multi-symbol scan core: build a Screener from a spec, drive it with commands, read back scan reports. Node bindings powered by Rust.",
|
|
5
5
|
"author": "kingchenc <support@wickra.org>",
|
|
6
6
|
"main": "index.js",
|
|
@@ -47,12 +47,12 @@
|
|
|
47
47
|
"node": ">= 22"
|
|
48
48
|
},
|
|
49
49
|
"optionalDependencies": {
|
|
50
|
-
"wickra-screener-
|
|
51
|
-
"wickra-screener-
|
|
52
|
-
"wickra-screener-
|
|
53
|
-
"wickra-screener-
|
|
54
|
-
"wickra-screener-win32-
|
|
55
|
-
"wickra-screener-win32-
|
|
50
|
+
"wickra-screener-darwin-arm64": "0.1.8",
|
|
51
|
+
"wickra-screener-darwin-x64": "0.1.8",
|
|
52
|
+
"wickra-screener-linux-arm64-gnu": "0.1.8",
|
|
53
|
+
"wickra-screener-linux-x64-gnu": "0.1.8",
|
|
54
|
+
"wickra-screener-win32-arm64-msvc": "0.1.8",
|
|
55
|
+
"wickra-screener-win32-x64-msvc": "0.1.8"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"build": "napi build --platform --release",
|
|
@@ -62,6 +62,6 @@
|
|
|
62
62
|
"test": "node --test"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@napi-rs/cli": "^3.
|
|
65
|
+
"@napi-rs/cli": "^3.10.4"
|
|
66
66
|
}
|
|
67
67
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|