@bastani/atomic-natives 0.9.45 → 0.9.46
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/native/atomic_natives.darwin-arm64.node +0 -0
- package/native/atomic_natives.darwin-x64.node +0 -0
- package/native/atomic_natives.linux-arm64-gnu.node +0 -0
- package/native/atomic_natives.linux-arm64-musl.node +0 -0
- package/native/atomic_natives.linux-x64-gnu.node +0 -0
- package/native/atomic_natives.linux-x64-musl.node +0 -0
- package/native/atomic_natives.win32-arm64-msvc.node +0 -0
- package/native/atomic_natives.win32-x64-msvc.node +0 -0
- package/native/index.js +110 -53
- package/package.json +10 -10
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/native/index.js
CHANGED
|
@@ -6,8 +6,13 @@ const { readFileSync } = require('fs')
|
|
|
6
6
|
let nativeBinding = null
|
|
7
7
|
// Which artifact actually loaded. The WASI fallback chain overwrites it with
|
|
8
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.
|
|
9
|
+
// it only runs while no WASI candidate has been loaded. The take-over check
|
|
10
|
+
// after the load-failure block can also set it.
|
|
10
11
|
let __napiLoadedBindingTarget = 'native'
|
|
12
|
+
// What this loader's own `requireNative()` calls returned. The check after
|
|
13
|
+
// the load-failure block compares it with `nativeBinding` to tell a binding
|
|
14
|
+
// this loader loaded from one that code outside it put in its place.
|
|
15
|
+
let __napiRequiredNativeBinding = null
|
|
11
16
|
const loadErrors = []
|
|
12
17
|
|
|
13
18
|
const isMusl = () => {
|
|
@@ -89,8 +94,8 @@ function requireNative() {
|
|
|
89
94
|
try {
|
|
90
95
|
const binding = require('@bastani/atomic-natives-android-arm64')
|
|
91
96
|
const bindingPackageVersion = require('@bastani/atomic-natives-android-arm64/package.json').version
|
|
92
|
-
if (bindingPackageVersion !== '0.9.
|
|
93
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.
|
|
97
|
+
if (bindingPackageVersion !== '0.9.46' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
98
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.46 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
94
99
|
}
|
|
95
100
|
return binding
|
|
96
101
|
} catch (e) {
|
|
@@ -105,8 +110,8 @@ function requireNative() {
|
|
|
105
110
|
try {
|
|
106
111
|
const binding = require('@bastani/atomic-natives-android-arm-eabi')
|
|
107
112
|
const bindingPackageVersion = require('@bastani/atomic-natives-android-arm-eabi/package.json').version
|
|
108
|
-
if (bindingPackageVersion !== '0.9.
|
|
109
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.
|
|
113
|
+
if (bindingPackageVersion !== '0.9.46' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
114
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.46 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
110
115
|
}
|
|
111
116
|
return binding
|
|
112
117
|
} catch (e) {
|
|
@@ -126,8 +131,8 @@ function requireNative() {
|
|
|
126
131
|
try {
|
|
127
132
|
const binding = require('@bastani/atomic-natives-win32-x64-gnu')
|
|
128
133
|
const bindingPackageVersion = require('@bastani/atomic-natives-win32-x64-gnu/package.json').version
|
|
129
|
-
if (bindingPackageVersion !== '0.9.
|
|
130
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.
|
|
134
|
+
if (bindingPackageVersion !== '0.9.46' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
135
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.46 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
131
136
|
}
|
|
132
137
|
return binding
|
|
133
138
|
} catch (e) {
|
|
@@ -142,8 +147,8 @@ function requireNative() {
|
|
|
142
147
|
try {
|
|
143
148
|
const binding = require('@bastani/atomic-natives-win32-x64-msvc')
|
|
144
149
|
const bindingPackageVersion = require('@bastani/atomic-natives-win32-x64-msvc/package.json').version
|
|
145
|
-
if (bindingPackageVersion !== '0.9.
|
|
146
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.
|
|
150
|
+
if (bindingPackageVersion !== '0.9.46' && 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 0.9.46 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
147
152
|
}
|
|
148
153
|
return binding
|
|
149
154
|
} catch (e) {
|
|
@@ -159,8 +164,8 @@ function requireNative() {
|
|
|
159
164
|
try {
|
|
160
165
|
const binding = require('@bastani/atomic-natives-win32-ia32-msvc')
|
|
161
166
|
const bindingPackageVersion = require('@bastani/atomic-natives-win32-ia32-msvc/package.json').version
|
|
162
|
-
if (bindingPackageVersion !== '0.9.
|
|
163
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.
|
|
167
|
+
if (bindingPackageVersion !== '0.9.46' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
168
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.46 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
164
169
|
}
|
|
165
170
|
return binding
|
|
166
171
|
} catch (e) {
|
|
@@ -175,8 +180,8 @@ function requireNative() {
|
|
|
175
180
|
try {
|
|
176
181
|
const binding = require('@bastani/atomic-natives-win32-arm64-msvc')
|
|
177
182
|
const bindingPackageVersion = require('@bastani/atomic-natives-win32-arm64-msvc/package.json').version
|
|
178
|
-
if (bindingPackageVersion !== '0.9.
|
|
179
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.
|
|
183
|
+
if (bindingPackageVersion !== '0.9.46' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
184
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.46 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
180
185
|
}
|
|
181
186
|
return binding
|
|
182
187
|
} catch (e) {
|
|
@@ -194,8 +199,8 @@ function requireNative() {
|
|
|
194
199
|
try {
|
|
195
200
|
const binding = require('@bastani/atomic-natives-darwin-universal')
|
|
196
201
|
const bindingPackageVersion = require('@bastani/atomic-natives-darwin-universal/package.json').version
|
|
197
|
-
if (bindingPackageVersion !== '0.9.
|
|
198
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.
|
|
202
|
+
if (bindingPackageVersion !== '0.9.46' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
203
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.46 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
199
204
|
}
|
|
200
205
|
return binding
|
|
201
206
|
} catch (e) {
|
|
@@ -210,8 +215,8 @@ function requireNative() {
|
|
|
210
215
|
try {
|
|
211
216
|
const binding = require('@bastani/atomic-natives-darwin-x64')
|
|
212
217
|
const bindingPackageVersion = require('@bastani/atomic-natives-darwin-x64/package.json').version
|
|
213
|
-
if (bindingPackageVersion !== '0.9.
|
|
214
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.
|
|
218
|
+
if (bindingPackageVersion !== '0.9.46' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
219
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.46 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
215
220
|
}
|
|
216
221
|
return binding
|
|
217
222
|
} catch (e) {
|
|
@@ -226,8 +231,8 @@ function requireNative() {
|
|
|
226
231
|
try {
|
|
227
232
|
const binding = require('@bastani/atomic-natives-darwin-arm64')
|
|
228
233
|
const bindingPackageVersion = require('@bastani/atomic-natives-darwin-arm64/package.json').version
|
|
229
|
-
if (bindingPackageVersion !== '0.9.
|
|
230
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.
|
|
234
|
+
if (bindingPackageVersion !== '0.9.46' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
235
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.46 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
231
236
|
}
|
|
232
237
|
return binding
|
|
233
238
|
} catch (e) {
|
|
@@ -246,8 +251,8 @@ function requireNative() {
|
|
|
246
251
|
try {
|
|
247
252
|
const binding = require('@bastani/atomic-natives-freebsd-x64')
|
|
248
253
|
const bindingPackageVersion = require('@bastani/atomic-natives-freebsd-x64/package.json').version
|
|
249
|
-
if (bindingPackageVersion !== '0.9.
|
|
250
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.
|
|
254
|
+
if (bindingPackageVersion !== '0.9.46' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
255
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.46 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
251
256
|
}
|
|
252
257
|
return binding
|
|
253
258
|
} catch (e) {
|
|
@@ -262,8 +267,24 @@ function requireNative() {
|
|
|
262
267
|
try {
|
|
263
268
|
const binding = require('@bastani/atomic-natives-freebsd-arm64')
|
|
264
269
|
const bindingPackageVersion = require('@bastani/atomic-natives-freebsd-arm64/package.json').version
|
|
265
|
-
if (bindingPackageVersion !== '0.9.
|
|
266
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.
|
|
270
|
+
if (bindingPackageVersion !== '0.9.46' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
271
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.46 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
272
|
+
}
|
|
273
|
+
return binding
|
|
274
|
+
} catch (e) {
|
|
275
|
+
loadErrors.push(e)
|
|
276
|
+
}
|
|
277
|
+
} else if (process.arch === 'ppc64') {
|
|
278
|
+
try {
|
|
279
|
+
return require('./atomic_natives.freebsd-ppc64.node')
|
|
280
|
+
} catch (e) {
|
|
281
|
+
loadErrors.push(e)
|
|
282
|
+
}
|
|
283
|
+
try {
|
|
284
|
+
const binding = require('@bastani/atomic-natives-freebsd-ppc64')
|
|
285
|
+
const bindingPackageVersion = require('@bastani/atomic-natives-freebsd-ppc64/package.json').version
|
|
286
|
+
if (bindingPackageVersion !== '0.9.46' && 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.9.46 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
267
288
|
}
|
|
268
289
|
return binding
|
|
269
290
|
} catch (e) {
|
|
@@ -283,8 +304,8 @@ function requireNative() {
|
|
|
283
304
|
try {
|
|
284
305
|
const binding = require('@bastani/atomic-natives-linux-x64-musl')
|
|
285
306
|
const bindingPackageVersion = require('@bastani/atomic-natives-linux-x64-musl/package.json').version
|
|
286
|
-
if (bindingPackageVersion !== '0.9.
|
|
287
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.
|
|
307
|
+
if (bindingPackageVersion !== '0.9.46' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
308
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.46 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
288
309
|
}
|
|
289
310
|
return binding
|
|
290
311
|
} catch (e) {
|
|
@@ -299,8 +320,8 @@ function requireNative() {
|
|
|
299
320
|
try {
|
|
300
321
|
const binding = require('@bastani/atomic-natives-linux-x64-gnu')
|
|
301
322
|
const bindingPackageVersion = require('@bastani/atomic-natives-linux-x64-gnu/package.json').version
|
|
302
|
-
if (bindingPackageVersion !== '0.9.
|
|
303
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.
|
|
323
|
+
if (bindingPackageVersion !== '0.9.46' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
324
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.46 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
304
325
|
}
|
|
305
326
|
return binding
|
|
306
327
|
} catch (e) {
|
|
@@ -317,8 +338,8 @@ function requireNative() {
|
|
|
317
338
|
try {
|
|
318
339
|
const binding = require('@bastani/atomic-natives-linux-arm64-musl')
|
|
319
340
|
const bindingPackageVersion = require('@bastani/atomic-natives-linux-arm64-musl/package.json').version
|
|
320
|
-
if (bindingPackageVersion !== '0.9.
|
|
321
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.
|
|
341
|
+
if (bindingPackageVersion !== '0.9.46' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
342
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.46 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
322
343
|
}
|
|
323
344
|
return binding
|
|
324
345
|
} catch (e) {
|
|
@@ -333,8 +354,8 @@ function requireNative() {
|
|
|
333
354
|
try {
|
|
334
355
|
const binding = require('@bastani/atomic-natives-linux-arm64-gnu')
|
|
335
356
|
const bindingPackageVersion = require('@bastani/atomic-natives-linux-arm64-gnu/package.json').version
|
|
336
|
-
if (bindingPackageVersion !== '0.9.
|
|
337
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.
|
|
357
|
+
if (bindingPackageVersion !== '0.9.46' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
358
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.46 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
338
359
|
}
|
|
339
360
|
return binding
|
|
340
361
|
} catch (e) {
|
|
@@ -351,8 +372,8 @@ function requireNative() {
|
|
|
351
372
|
try {
|
|
352
373
|
const binding = require('@bastani/atomic-natives-linux-arm-musleabihf')
|
|
353
374
|
const bindingPackageVersion = require('@bastani/atomic-natives-linux-arm-musleabihf/package.json').version
|
|
354
|
-
if (bindingPackageVersion !== '0.9.
|
|
355
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.
|
|
375
|
+
if (bindingPackageVersion !== '0.9.46' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
376
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.46 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
356
377
|
}
|
|
357
378
|
return binding
|
|
358
379
|
} catch (e) {
|
|
@@ -367,8 +388,8 @@ function requireNative() {
|
|
|
367
388
|
try {
|
|
368
389
|
const binding = require('@bastani/atomic-natives-linux-arm-gnueabihf')
|
|
369
390
|
const bindingPackageVersion = require('@bastani/atomic-natives-linux-arm-gnueabihf/package.json').version
|
|
370
|
-
if (bindingPackageVersion !== '0.9.
|
|
371
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.
|
|
391
|
+
if (bindingPackageVersion !== '0.9.46' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
392
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.46 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
372
393
|
}
|
|
373
394
|
return binding
|
|
374
395
|
} catch (e) {
|
|
@@ -385,8 +406,8 @@ function requireNative() {
|
|
|
385
406
|
try {
|
|
386
407
|
const binding = require('@bastani/atomic-natives-linux-loong64-musl')
|
|
387
408
|
const bindingPackageVersion = require('@bastani/atomic-natives-linux-loong64-musl/package.json').version
|
|
388
|
-
if (bindingPackageVersion !== '0.9.
|
|
389
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.
|
|
409
|
+
if (bindingPackageVersion !== '0.9.46' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
410
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.46 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
390
411
|
}
|
|
391
412
|
return binding
|
|
392
413
|
} catch (e) {
|
|
@@ -401,8 +422,8 @@ function requireNative() {
|
|
|
401
422
|
try {
|
|
402
423
|
const binding = require('@bastani/atomic-natives-linux-loong64-gnu')
|
|
403
424
|
const bindingPackageVersion = require('@bastani/atomic-natives-linux-loong64-gnu/package.json').version
|
|
404
|
-
if (bindingPackageVersion !== '0.9.
|
|
405
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.
|
|
425
|
+
if (bindingPackageVersion !== '0.9.46' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
426
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.46 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
406
427
|
}
|
|
407
428
|
return binding
|
|
408
429
|
} catch (e) {
|
|
@@ -419,8 +440,8 @@ function requireNative() {
|
|
|
419
440
|
try {
|
|
420
441
|
const binding = require('@bastani/atomic-natives-linux-riscv64-musl')
|
|
421
442
|
const bindingPackageVersion = require('@bastani/atomic-natives-linux-riscv64-musl/package.json').version
|
|
422
|
-
if (bindingPackageVersion !== '0.9.
|
|
423
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.
|
|
443
|
+
if (bindingPackageVersion !== '0.9.46' && 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 0.9.46 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
424
445
|
}
|
|
425
446
|
return binding
|
|
426
447
|
} catch (e) {
|
|
@@ -435,8 +456,8 @@ function requireNative() {
|
|
|
435
456
|
try {
|
|
436
457
|
const binding = require('@bastani/atomic-natives-linux-riscv64-gnu')
|
|
437
458
|
const bindingPackageVersion = require('@bastani/atomic-natives-linux-riscv64-gnu/package.json').version
|
|
438
|
-
if (bindingPackageVersion !== '0.9.
|
|
439
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.
|
|
459
|
+
if (bindingPackageVersion !== '0.9.46' && 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 0.9.46 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
440
461
|
}
|
|
441
462
|
return binding
|
|
442
463
|
} catch (e) {
|
|
@@ -452,8 +473,8 @@ function requireNative() {
|
|
|
452
473
|
try {
|
|
453
474
|
const binding = require('@bastani/atomic-natives-linux-ppc64-gnu')
|
|
454
475
|
const bindingPackageVersion = require('@bastani/atomic-natives-linux-ppc64-gnu/package.json').version
|
|
455
|
-
if (bindingPackageVersion !== '0.9.
|
|
456
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.
|
|
476
|
+
if (bindingPackageVersion !== '0.9.46' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
477
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.46 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
457
478
|
}
|
|
458
479
|
return binding
|
|
459
480
|
} catch (e) {
|
|
@@ -468,8 +489,8 @@ function requireNative() {
|
|
|
468
489
|
try {
|
|
469
490
|
const binding = require('@bastani/atomic-natives-linux-s390x-gnu')
|
|
470
491
|
const bindingPackageVersion = require('@bastani/atomic-natives-linux-s390x-gnu/package.json').version
|
|
471
|
-
if (bindingPackageVersion !== '0.9.
|
|
472
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.
|
|
492
|
+
if (bindingPackageVersion !== '0.9.46' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
493
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.46 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
473
494
|
}
|
|
474
495
|
return binding
|
|
475
496
|
} catch (e) {
|
|
@@ -488,8 +509,8 @@ function requireNative() {
|
|
|
488
509
|
try {
|
|
489
510
|
const binding = require('@bastani/atomic-natives-openharmony-arm64')
|
|
490
511
|
const bindingPackageVersion = require('@bastani/atomic-natives-openharmony-arm64/package.json').version
|
|
491
|
-
if (bindingPackageVersion !== '0.9.
|
|
492
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.
|
|
512
|
+
if (bindingPackageVersion !== '0.9.46' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
513
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.46 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
493
514
|
}
|
|
494
515
|
return binding
|
|
495
516
|
} catch (e) {
|
|
@@ -504,8 +525,8 @@ function requireNative() {
|
|
|
504
525
|
try {
|
|
505
526
|
const binding = require('@bastani/atomic-natives-openharmony-x64')
|
|
506
527
|
const bindingPackageVersion = require('@bastani/atomic-natives-openharmony-x64/package.json').version
|
|
507
|
-
if (bindingPackageVersion !== '0.9.
|
|
508
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.
|
|
528
|
+
if (bindingPackageVersion !== '0.9.46' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
529
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.46 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
509
530
|
}
|
|
510
531
|
return binding
|
|
511
532
|
} catch (e) {
|
|
@@ -520,8 +541,8 @@ function requireNative() {
|
|
|
520
541
|
try {
|
|
521
542
|
const binding = require('@bastani/atomic-natives-openharmony-arm')
|
|
522
543
|
const bindingPackageVersion = require('@bastani/atomic-natives-openharmony-arm/package.json').version
|
|
523
|
-
if (bindingPackageVersion !== '0.9.
|
|
524
|
-
throw new Error(`Native binding package version mismatch, expected 0.9.
|
|
544
|
+
if (bindingPackageVersion !== '0.9.46' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
545
|
+
throw new Error(`Native binding package version mismatch, expected 0.9.46 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
525
546
|
}
|
|
526
547
|
return binding
|
|
527
548
|
} catch (e) {
|
|
@@ -585,6 +606,7 @@ const forceWasi =
|
|
|
585
606
|
|
|
586
607
|
if (!forceWasi) {
|
|
587
608
|
nativeBinding = requireNative()
|
|
609
|
+
__napiRequiredNativeBinding = nativeBinding
|
|
588
610
|
}
|
|
589
611
|
|
|
590
612
|
if (!nativeBinding || forceWasi) {
|
|
@@ -686,6 +708,7 @@ if (!nativeBinding || forceWasi) {
|
|
|
686
708
|
!__napiWasiFlavorRequested
|
|
687
709
|
) {
|
|
688
710
|
nativeBinding = requireNative()
|
|
711
|
+
__napiRequiredNativeBinding = nativeBinding
|
|
689
712
|
}
|
|
690
713
|
if ((forceWasiError || __napiWasiFlavorRequested) && !wasiBindingLoaded) {
|
|
691
714
|
const error = new Error(
|
|
@@ -713,6 +736,40 @@ if (!nativeBinding) {
|
|
|
713
736
|
throw new Error(`Failed to load native binding`)
|
|
714
737
|
}
|
|
715
738
|
|
|
739
|
+
// A package can patch its own fallback in front of the load-failure check
|
|
740
|
+
// above, e.g. a WebContainer download through `napi-postinstall/fallback`.
|
|
741
|
+
// That fallback swaps `nativeBinding` for a generated WASI loader, which has
|
|
742
|
+
// already stamped its own flavor, while the target above still says 'native'.
|
|
743
|
+
// Take that flavor over, or the CommonJS stamp throws a conflict and the ESM
|
|
744
|
+
// export reports the wrong artifact. Three limits keep the conflict check:
|
|
745
|
+
// - only a binding this loader did not load itself, so a native addon whose
|
|
746
|
+
// `#[napi(module_exports)]` hook claims the name is still rejected;
|
|
747
|
+
// - only an own data property, read through its descriptor, so no addon
|
|
748
|
+
// getter runs here, and it must read back the same, as the stamp reads it;
|
|
749
|
+
// - only a flavor in `__napiWasiFlavors`, the ones this loader's own WASI
|
|
750
|
+
// chain can report ('wasm32-wasi' for a package without a WASI target).
|
|
751
|
+
// This is metadata and never fails a load: a throwing Proxy trap keeps 'native'.
|
|
752
|
+
if (
|
|
753
|
+
__napiLoadedBindingTarget === 'native' &&
|
|
754
|
+
nativeBinding !== __napiRequiredNativeBinding
|
|
755
|
+
) {
|
|
756
|
+
try {
|
|
757
|
+
const __napiBindingTargetDescriptor = Object.getOwnPropertyDescriptor(
|
|
758
|
+
nativeBinding,
|
|
759
|
+
'__napiBindingTarget',
|
|
760
|
+
)
|
|
761
|
+
if (
|
|
762
|
+
__napiBindingTargetDescriptor &&
|
|
763
|
+
__napiWasiFlavors.indexOf(__napiBindingTargetDescriptor.value) !== -1 &&
|
|
764
|
+
nativeBinding.__napiBindingTarget === __napiBindingTargetDescriptor.value
|
|
765
|
+
) {
|
|
766
|
+
__napiLoadedBindingTarget = __napiBindingTargetDescriptor.value
|
|
767
|
+
}
|
|
768
|
+
} catch {
|
|
769
|
+
// keep 'native'
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
|
|
716
773
|
function __napiStampBindingTarget(exportsObject, target) {
|
|
717
774
|
if (
|
|
718
775
|
Object.prototype.hasOwnProperty.call(exportsObject, '__napiBindingTarget')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/atomic-natives",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.46",
|
|
4
4
|
"description": "Native Rust bindings for Atomic via N-API",
|
|
5
5
|
"homepage": "https://github.com/bastani-inc/atomic",
|
|
6
6
|
"author": "Bastani",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"prepublish:native": "napi prepublish --npm-dir npm --tag-style npm --no-gh-release"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@napi-rs/cli": "3.10.
|
|
31
|
+
"@napi-rs/cli": "3.10.9"
|
|
32
32
|
},
|
|
33
33
|
"engines": {
|
|
34
34
|
"bun": ">=1.4.2",
|
|
@@ -59,13 +59,13 @@
|
|
|
59
59
|
"access": "public"
|
|
60
60
|
},
|
|
61
61
|
"optionalDependencies": {
|
|
62
|
-
"@bastani/atomic-natives-win32-x64-msvc": "0.9.
|
|
63
|
-
"@bastani/atomic-natives-darwin-x64": "0.9.
|
|
64
|
-
"@bastani/atomic-natives-linux-x64-gnu": "0.9.
|
|
65
|
-
"@bastani/atomic-natives-linux-arm64-gnu": "0.9.
|
|
66
|
-
"@bastani/atomic-natives-darwin-arm64": "0.9.
|
|
67
|
-
"@bastani/atomic-natives-win32-arm64-msvc": "0.9.
|
|
68
|
-
"@bastani/atomic-natives-linux-x64-musl": "0.9.
|
|
69
|
-
"@bastani/atomic-natives-linux-arm64-musl": "0.9.
|
|
62
|
+
"@bastani/atomic-natives-win32-x64-msvc": "0.9.46",
|
|
63
|
+
"@bastani/atomic-natives-darwin-x64": "0.9.46",
|
|
64
|
+
"@bastani/atomic-natives-linux-x64-gnu": "0.9.46",
|
|
65
|
+
"@bastani/atomic-natives-linux-arm64-gnu": "0.9.46",
|
|
66
|
+
"@bastani/atomic-natives-darwin-arm64": "0.9.46",
|
|
67
|
+
"@bastani/atomic-natives-win32-arm64-msvc": "0.9.46",
|
|
68
|
+
"@bastani/atomic-natives-linux-x64-musl": "0.9.46",
|
|
69
|
+
"@bastani/atomic-natives-linux-arm64-musl": "0.9.46"
|
|
70
70
|
}
|
|
71
71
|
}
|