@mainsail/evm 0.0.1-evm.45 → 0.0.1-evm.48

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.
Files changed (2) hide show
  1. package/index.js +123 -55
  2. package/package.json +6 -13
package/index.js CHANGED
@@ -3,9 +3,6 @@
3
3
  // @ts-nocheck
4
4
  /* auto-generated by NAPI-RS */
5
5
 
6
- const { createRequire } = require('node:module')
7
- require = createRequire(__filename)
8
-
9
6
  const { readFileSync } = require('node:fs')
10
7
  let nativeBinding = null
11
8
  const loadErrors = []
@@ -66,7 +63,7 @@ const isMuslFromChildProcess = () => {
66
63
  function requireNative() {
67
64
  if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
68
65
  try {
69
- nativeBinding = require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
66
+ return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
70
67
  } catch (err) {
71
68
  loadErrors.push(err)
72
69
  }
@@ -80,8 +77,8 @@ function requireNative() {
80
77
  try {
81
78
  const binding = require('@mainsail/evm-android-arm64')
82
79
  const bindingPackageVersion = require('@mainsail/evm-android-arm64/package.json').version
83
- if (bindingPackageVersion !== '0.0.1-evm.45' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
84
- throw new Error(`Native binding package version mismatch, expected 0.0.1-evm.45 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
80
+ if (bindingPackageVersion !== '0.0.1-evm.48' && 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 0.0.1-evm.48 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
85
82
  }
86
83
  return binding
87
84
  } catch (e) {
@@ -96,8 +93,8 @@ function requireNative() {
96
93
  try {
97
94
  const binding = require('@mainsail/evm-android-arm-eabi')
98
95
  const bindingPackageVersion = require('@mainsail/evm-android-arm-eabi/package.json').version
99
- if (bindingPackageVersion !== '0.0.1-evm.45' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
100
- throw new Error(`Native binding package version mismatch, expected 0.0.1-evm.45 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
96
+ if (bindingPackageVersion !== '0.0.1-evm.48' && 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 0.0.1-evm.48 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
101
98
  }
102
99
  return binding
103
100
  } catch (e) {
@@ -108,7 +105,24 @@ function requireNative() {
108
105
  }
109
106
  } else if (process.platform === 'win32') {
110
107
  if (process.arch === 'x64') {
108
+ if (process.config?.variables?.shlib_suffix === 'dll.a' || process.config?.variables?.node_target_type === 'shared_library') {
109
+ try {
110
+ return require('./evm.win32-x64-gnu.node')
111
+ } catch (e) {
112
+ loadErrors.push(e)
113
+ }
111
114
  try {
115
+ const binding = require('@mainsail/evm-win32-x64-gnu')
116
+ const bindingPackageVersion = require('@mainsail/evm-win32-x64-gnu/package.json').version
117
+ if (bindingPackageVersion !== '0.0.1-evm.48' && 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 0.0.1-evm.48 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
119
+ }
120
+ return binding
121
+ } catch (e) {
122
+ loadErrors.push(e)
123
+ }
124
+ } else {
125
+ try {
112
126
  return require('./evm.win32-x64-msvc.node')
113
127
  } catch (e) {
114
128
  loadErrors.push(e)
@@ -116,13 +130,14 @@ function requireNative() {
116
130
  try {
117
131
  const binding = require('@mainsail/evm-win32-x64-msvc')
118
132
  const bindingPackageVersion = require('@mainsail/evm-win32-x64-msvc/package.json').version
119
- if (bindingPackageVersion !== '0.0.1-evm.45' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
120
- throw new Error(`Native binding package version mismatch, expected 0.0.1-evm.45 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
133
+ if (bindingPackageVersion !== '0.0.1-evm.48' && 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 0.0.1-evm.48 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
121
135
  }
122
136
  return binding
123
137
  } catch (e) {
124
138
  loadErrors.push(e)
125
139
  }
140
+ }
126
141
  } else if (process.arch === 'ia32') {
127
142
  try {
128
143
  return require('./evm.win32-ia32-msvc.node')
@@ -132,8 +147,8 @@ function requireNative() {
132
147
  try {
133
148
  const binding = require('@mainsail/evm-win32-ia32-msvc')
134
149
  const bindingPackageVersion = require('@mainsail/evm-win32-ia32-msvc/package.json').version
135
- if (bindingPackageVersion !== '0.0.1-evm.45' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
136
- throw new Error(`Native binding package version mismatch, expected 0.0.1-evm.45 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
150
+ if (bindingPackageVersion !== '0.0.1-evm.48' && 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.0.1-evm.48 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
137
152
  }
138
153
  return binding
139
154
  } catch (e) {
@@ -148,8 +163,8 @@ function requireNative() {
148
163
  try {
149
164
  const binding = require('@mainsail/evm-win32-arm64-msvc')
150
165
  const bindingPackageVersion = require('@mainsail/evm-win32-arm64-msvc/package.json').version
151
- if (bindingPackageVersion !== '0.0.1-evm.45' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
152
- throw new Error(`Native binding package version mismatch, expected 0.0.1-evm.45 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
166
+ if (bindingPackageVersion !== '0.0.1-evm.48' && 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 0.0.1-evm.48 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
153
168
  }
154
169
  return binding
155
170
  } catch (e) {
@@ -167,8 +182,8 @@ function requireNative() {
167
182
  try {
168
183
  const binding = require('@mainsail/evm-darwin-universal')
169
184
  const bindingPackageVersion = require('@mainsail/evm-darwin-universal/package.json').version
170
- if (bindingPackageVersion !== '0.0.1-evm.45' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
171
- throw new Error(`Native binding package version mismatch, expected 0.0.1-evm.45 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
185
+ if (bindingPackageVersion !== '0.0.1-evm.48' && 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 0.0.1-evm.48 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
172
187
  }
173
188
  return binding
174
189
  } catch (e) {
@@ -183,8 +198,8 @@ function requireNative() {
183
198
  try {
184
199
  const binding = require('@mainsail/evm-darwin-x64')
185
200
  const bindingPackageVersion = require('@mainsail/evm-darwin-x64/package.json').version
186
- if (bindingPackageVersion !== '0.0.1-evm.45' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
187
- throw new Error(`Native binding package version mismatch, expected 0.0.1-evm.45 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
201
+ if (bindingPackageVersion !== '0.0.1-evm.48' && 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 0.0.1-evm.48 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
188
203
  }
189
204
  return binding
190
205
  } catch (e) {
@@ -199,8 +214,8 @@ function requireNative() {
199
214
  try {
200
215
  const binding = require('@mainsail/evm-darwin-arm64')
201
216
  const bindingPackageVersion = require('@mainsail/evm-darwin-arm64/package.json').version
202
- if (bindingPackageVersion !== '0.0.1-evm.45' && 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.0.1-evm.45 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
217
+ if (bindingPackageVersion !== '0.0.1-evm.48' && 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 0.0.1-evm.48 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
204
219
  }
205
220
  return binding
206
221
  } catch (e) {
@@ -219,8 +234,8 @@ function requireNative() {
219
234
  try {
220
235
  const binding = require('@mainsail/evm-freebsd-x64')
221
236
  const bindingPackageVersion = require('@mainsail/evm-freebsd-x64/package.json').version
222
- if (bindingPackageVersion !== '0.0.1-evm.45' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
223
- throw new Error(`Native binding package version mismatch, expected 0.0.1-evm.45 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
237
+ if (bindingPackageVersion !== '0.0.1-evm.48' && 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 0.0.1-evm.48 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
224
239
  }
225
240
  return binding
226
241
  } catch (e) {
@@ -235,8 +250,8 @@ function requireNative() {
235
250
  try {
236
251
  const binding = require('@mainsail/evm-freebsd-arm64')
237
252
  const bindingPackageVersion = require('@mainsail/evm-freebsd-arm64/package.json').version
238
- if (bindingPackageVersion !== '0.0.1-evm.45' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
239
- throw new Error(`Native binding package version mismatch, expected 0.0.1-evm.45 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
253
+ if (bindingPackageVersion !== '0.0.1-evm.48' && 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 0.0.1-evm.48 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
240
255
  }
241
256
  return binding
242
257
  } catch (e) {
@@ -256,8 +271,8 @@ function requireNative() {
256
271
  try {
257
272
  const binding = require('@mainsail/evm-linux-x64-musl')
258
273
  const bindingPackageVersion = require('@mainsail/evm-linux-x64-musl/package.json').version
259
- if (bindingPackageVersion !== '0.0.1-evm.45' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
260
- throw new Error(`Native binding package version mismatch, expected 0.0.1-evm.45 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
274
+ if (bindingPackageVersion !== '0.0.1-evm.48' && 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 0.0.1-evm.48 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
261
276
  }
262
277
  return binding
263
278
  } catch (e) {
@@ -272,8 +287,8 @@ function requireNative() {
272
287
  try {
273
288
  const binding = require('@mainsail/evm-linux-x64-gnu')
274
289
  const bindingPackageVersion = require('@mainsail/evm-linux-x64-gnu/package.json').version
275
- if (bindingPackageVersion !== '0.0.1-evm.45' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
276
- throw new Error(`Native binding package version mismatch, expected 0.0.1-evm.45 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
290
+ if (bindingPackageVersion !== '0.0.1-evm.48' && 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 0.0.1-evm.48 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
277
292
  }
278
293
  return binding
279
294
  } catch (e) {
@@ -290,8 +305,8 @@ function requireNative() {
290
305
  try {
291
306
  const binding = require('@mainsail/evm-linux-arm64-musl')
292
307
  const bindingPackageVersion = require('@mainsail/evm-linux-arm64-musl/package.json').version
293
- if (bindingPackageVersion !== '0.0.1-evm.45' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
294
- throw new Error(`Native binding package version mismatch, expected 0.0.1-evm.45 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
308
+ if (bindingPackageVersion !== '0.0.1-evm.48' && 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 0.0.1-evm.48 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
295
310
  }
296
311
  return binding
297
312
  } catch (e) {
@@ -306,8 +321,8 @@ function requireNative() {
306
321
  try {
307
322
  const binding = require('@mainsail/evm-linux-arm64-gnu')
308
323
  const bindingPackageVersion = require('@mainsail/evm-linux-arm64-gnu/package.json').version
309
- if (bindingPackageVersion !== '0.0.1-evm.45' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
310
- throw new Error(`Native binding package version mismatch, expected 0.0.1-evm.45 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
324
+ if (bindingPackageVersion !== '0.0.1-evm.48' && 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 0.0.1-evm.48 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
311
326
  }
312
327
  return binding
313
328
  } catch (e) {
@@ -324,8 +339,8 @@ function requireNative() {
324
339
  try {
325
340
  const binding = require('@mainsail/evm-linux-arm-musleabihf')
326
341
  const bindingPackageVersion = require('@mainsail/evm-linux-arm-musleabihf/package.json').version
327
- if (bindingPackageVersion !== '0.0.1-evm.45' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
328
- throw new Error(`Native binding package version mismatch, expected 0.0.1-evm.45 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
342
+ if (bindingPackageVersion !== '0.0.1-evm.48' && 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 0.0.1-evm.48 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
329
344
  }
330
345
  return binding
331
346
  } catch (e) {
@@ -340,8 +355,42 @@ function requireNative() {
340
355
  try {
341
356
  const binding = require('@mainsail/evm-linux-arm-gnueabihf')
342
357
  const bindingPackageVersion = require('@mainsail/evm-linux-arm-gnueabihf/package.json').version
343
- if (bindingPackageVersion !== '0.0.1-evm.45' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
344
- throw new Error(`Native binding package version mismatch, expected 0.0.1-evm.45 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
358
+ if (bindingPackageVersion !== '0.0.1-evm.48' && 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 0.0.1-evm.48 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
360
+ }
361
+ return binding
362
+ } catch (e) {
363
+ loadErrors.push(e)
364
+ }
365
+ }
366
+ } else if (process.arch === 'loong64') {
367
+ if (isMusl()) {
368
+ try {
369
+ return require('./evm.linux-loong64-musl.node')
370
+ } catch (e) {
371
+ loadErrors.push(e)
372
+ }
373
+ try {
374
+ const binding = require('@mainsail/evm-linux-loong64-musl')
375
+ const bindingPackageVersion = require('@mainsail/evm-linux-loong64-musl/package.json').version
376
+ if (bindingPackageVersion !== '0.0.1-evm.48' && 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 0.0.1-evm.48 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
378
+ }
379
+ return binding
380
+ } catch (e) {
381
+ loadErrors.push(e)
382
+ }
383
+ } else {
384
+ try {
385
+ return require('./evm.linux-loong64-gnu.node')
386
+ } catch (e) {
387
+ loadErrors.push(e)
388
+ }
389
+ try {
390
+ const binding = require('@mainsail/evm-linux-loong64-gnu')
391
+ const bindingPackageVersion = require('@mainsail/evm-linux-loong64-gnu/package.json').version
392
+ if (bindingPackageVersion !== '0.0.1-evm.48' && 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 0.0.1-evm.48 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
345
394
  }
346
395
  return binding
347
396
  } catch (e) {
@@ -358,8 +407,8 @@ function requireNative() {
358
407
  try {
359
408
  const binding = require('@mainsail/evm-linux-riscv64-musl')
360
409
  const bindingPackageVersion = require('@mainsail/evm-linux-riscv64-musl/package.json').version
361
- if (bindingPackageVersion !== '0.0.1-evm.45' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
362
- throw new Error(`Native binding package version mismatch, expected 0.0.1-evm.45 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
410
+ if (bindingPackageVersion !== '0.0.1-evm.48' && 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 0.0.1-evm.48 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
363
412
  }
364
413
  return binding
365
414
  } catch (e) {
@@ -374,8 +423,8 @@ function requireNative() {
374
423
  try {
375
424
  const binding = require('@mainsail/evm-linux-riscv64-gnu')
376
425
  const bindingPackageVersion = require('@mainsail/evm-linux-riscv64-gnu/package.json').version
377
- if (bindingPackageVersion !== '0.0.1-evm.45' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
378
- throw new Error(`Native binding package version mismatch, expected 0.0.1-evm.45 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
426
+ if (bindingPackageVersion !== '0.0.1-evm.48' && 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 0.0.1-evm.48 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
379
428
  }
380
429
  return binding
381
430
  } catch (e) {
@@ -391,8 +440,8 @@ function requireNative() {
391
440
  try {
392
441
  const binding = require('@mainsail/evm-linux-ppc64-gnu')
393
442
  const bindingPackageVersion = require('@mainsail/evm-linux-ppc64-gnu/package.json').version
394
- if (bindingPackageVersion !== '0.0.1-evm.45' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
395
- throw new Error(`Native binding package version mismatch, expected 0.0.1-evm.45 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
443
+ if (bindingPackageVersion !== '0.0.1-evm.48' && 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.0.1-evm.48 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
396
445
  }
397
446
  return binding
398
447
  } catch (e) {
@@ -407,8 +456,8 @@ function requireNative() {
407
456
  try {
408
457
  const binding = require('@mainsail/evm-linux-s390x-gnu')
409
458
  const bindingPackageVersion = require('@mainsail/evm-linux-s390x-gnu/package.json').version
410
- if (bindingPackageVersion !== '0.0.1-evm.45' && 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 0.0.1-evm.45 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
459
+ if (bindingPackageVersion !== '0.0.1-evm.48' && 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.0.1-evm.48 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
412
461
  }
413
462
  return binding
414
463
  } catch (e) {
@@ -427,8 +476,8 @@ function requireNative() {
427
476
  try {
428
477
  const binding = require('@mainsail/evm-openharmony-arm64')
429
478
  const bindingPackageVersion = require('@mainsail/evm-openharmony-arm64/package.json').version
430
- if (bindingPackageVersion !== '0.0.1-evm.45' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
431
- throw new Error(`Native binding package version mismatch, expected 0.0.1-evm.45 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
479
+ if (bindingPackageVersion !== '0.0.1-evm.48' && 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 0.0.1-evm.48 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
432
481
  }
433
482
  return binding
434
483
  } catch (e) {
@@ -443,8 +492,8 @@ function requireNative() {
443
492
  try {
444
493
  const binding = require('@mainsail/evm-openharmony-x64')
445
494
  const bindingPackageVersion = require('@mainsail/evm-openharmony-x64/package.json').version
446
- if (bindingPackageVersion !== '0.0.1-evm.45' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
447
- throw new Error(`Native binding package version mismatch, expected 0.0.1-evm.45 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
495
+ if (bindingPackageVersion !== '0.0.1-evm.48' && 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 0.0.1-evm.48 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
448
497
  }
449
498
  return binding
450
499
  } catch (e) {
@@ -459,8 +508,8 @@ function requireNative() {
459
508
  try {
460
509
  const binding = require('@mainsail/evm-openharmony-arm')
461
510
  const bindingPackageVersion = require('@mainsail/evm-openharmony-arm/package.json').version
462
- if (bindingPackageVersion !== '0.0.1-evm.45' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
463
- throw new Error(`Native binding package version mismatch, expected 0.0.1-evm.45 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
511
+ if (bindingPackageVersion !== '0.0.1-evm.48' && 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 0.0.1-evm.48 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
464
513
  }
465
514
  return binding
466
515
  } catch (e) {
@@ -477,22 +526,36 @@ function requireNative() {
477
526
  nativeBinding = requireNative()
478
527
 
479
528
  if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
529
+ let wasiBinding = null
530
+ let wasiBindingError = null
480
531
  try {
481
- nativeBinding = require('./evm.wasi.cjs')
532
+ wasiBinding = require('./evm.wasi.cjs')
533
+ nativeBinding = wasiBinding
482
534
  } catch (err) {
483
535
  if (process.env.NAPI_RS_FORCE_WASI) {
484
- loadErrors.push(err)
536
+ wasiBindingError = err
485
537
  }
486
538
  }
487
- if (!nativeBinding) {
539
+ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
488
540
  try {
489
- nativeBinding = require('@mainsail/evm-wasm32-wasi')
541
+ wasiBinding = require('@mainsail/evm-wasm32-wasi')
542
+ nativeBinding = wasiBinding
490
543
  } catch (err) {
491
544
  if (process.env.NAPI_RS_FORCE_WASI) {
545
+ if (!wasiBindingError) {
546
+ wasiBindingError = err
547
+ } else {
548
+ wasiBindingError.cause = err
549
+ }
492
550
  loadErrors.push(err)
493
551
  }
494
552
  }
495
553
  }
554
+ if (process.env.NAPI_RS_FORCE_WASI === 'error' && !wasiBinding) {
555
+ const error = new Error('WASI binding not found and NAPI_RS_FORCE_WASI is set to error')
556
+ error.cause = wasiBindingError
557
+ throw error
558
+ }
496
559
  }
497
560
 
498
561
  if (!nativeBinding) {
@@ -501,7 +564,12 @@ if (!nativeBinding) {
501
564
  `Cannot find native binding. ` +
502
565
  `npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
503
566
  'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
504
- { cause: loadErrors }
567
+ {
568
+ cause: loadErrors.reduce((err, cur) => {
569
+ cur.cause = err
570
+ return cur
571
+ }),
572
+ },
505
573
  )
506
574
  }
507
575
  throw new Error(`Failed to load native binding`)
package/package.json CHANGED
@@ -1,41 +1,34 @@
1
1
  {
2
2
  "name": "@mainsail/evm",
3
- "version": "0.0.1-evm.45",
3
+ "version": "0.0.1-evm.48",
4
4
  "description": "EVM for the Mainsail blockchain",
5
5
  "license": "GPL-3.0-only",
6
6
  "contributors": [],
7
7
  "main": "index.js",
8
8
  "types": "index.d.ts",
9
9
  "devDependencies": {
10
- "@napi-rs/cli": "3.1.5"
10
+ "@napi-rs/cli": "3.6.2"
11
11
  },
12
12
  "engines": {
13
- "node": ">=20.x"
13
+ "node": ">=24"
14
14
  },
15
15
  "napi": {
16
16
  "binaryName": "evm",
17
17
  "targets": [
18
18
  "aarch64-unknown-linux-gnu",
19
- "aarch64-unknown-linux-musl",
20
- "x86_64-unknown-linux-gnu",
21
- "x86_64-unknown-linux-musl"
19
+ "x86_64-unknown-linux-gnu"
22
20
  ]
23
21
  },
24
- "optionalDependencies": {
25
- "@mainsail/evm-linux-arm64-gnu": "0.0.1-evm.45",
26
- "@mainsail/evm-linux-arm64-musl": "0.0.1-evm.45",
27
- "@mainsail/evm-linux-x64-gnu": "0.0.1-evm.45",
28
- "@mainsail/evm-linux-x64-musl": "0.0.1-evm.45"
29
- },
30
22
  "scripts": {
31
23
  "artifacts": "napi artifacts",
32
- "build": "pnpm run clean && pnpm run build-napi",
33
24
  "build-napi": "napi build --platform --output-dir ./ --manifest-path bindings/Cargo.toml --release",
34
25
  "build-napi:debug": "napi build --platform --output-dir ./ --manifest-path bindings/Cargo.toml",
26
+ "build-rs": "pnpm run clean && pnpm run build-napi",
35
27
  "clean": "rm -f index.js && rm -f index.d.ts && rm -f evm.*.node && rm -rf target",
36
28
  "release": "pnpm publish --access public",
37
29
  "test": "cargo test --release",
38
30
  "test:coverage": "mkdir -p coverage && cargo llvm-cov --lcov --output-path coverage/lcov.info --remap-path-prefix",
31
+ "test:coverage:html": "mkdir -p coverage && cargo llvm-cov --html --output-dir coverage/ --remap-path-prefix",
39
32
  "version": "napi version"
40
33
  }
41
34
  }