@theagenticguy/microvms 0.8.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +137 -34
- package/index.d.ts +745 -21
- package/index.js +146 -55
- package/microvms.darwin-arm64.node +0 -0
- package/microvms.linux-arm64-gnu.node +0 -0
- package/microvms.linux-x64-gnu.node +0 -0
- package/microvms.win32-x64-msvc.node +0 -0
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
const { readFileSync } = require('fs')
|
|
6
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'
|
|
7
11
|
const loadErrors = []
|
|
8
12
|
|
|
9
13
|
const isMusl = () => {
|
|
@@ -62,7 +66,16 @@ const isMuslFromChildProcess = () => {
|
|
|
62
66
|
function requireNative() {
|
|
63
67
|
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
|
|
64
68
|
try {
|
|
65
|
-
|
|
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
|
|
66
79
|
} catch (err) {
|
|
67
80
|
loadErrors.push(err)
|
|
68
81
|
}
|
|
@@ -76,8 +89,8 @@ function requireNative() {
|
|
|
76
89
|
try {
|
|
77
90
|
const binding = require('@theagenticguy/microvms-android-arm64')
|
|
78
91
|
const bindingPackageVersion = require('@theagenticguy/microvms-android-arm64/package.json').version
|
|
79
|
-
if (bindingPackageVersion !== '0.
|
|
80
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
92
|
+
if (bindingPackageVersion !== '0.10.0' && 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.10.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
81
94
|
}
|
|
82
95
|
return binding
|
|
83
96
|
} catch (e) {
|
|
@@ -92,8 +105,8 @@ function requireNative() {
|
|
|
92
105
|
try {
|
|
93
106
|
const binding = require('@theagenticguy/microvms-android-arm-eabi')
|
|
94
107
|
const bindingPackageVersion = require('@theagenticguy/microvms-android-arm-eabi/package.json').version
|
|
95
|
-
if (bindingPackageVersion !== '0.
|
|
96
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
108
|
+
if (bindingPackageVersion !== '0.10.0' && 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.10.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
97
110
|
}
|
|
98
111
|
return binding
|
|
99
112
|
} catch (e) {
|
|
@@ -113,8 +126,8 @@ function requireNative() {
|
|
|
113
126
|
try {
|
|
114
127
|
const binding = require('@theagenticguy/microvms-win32-x64-gnu')
|
|
115
128
|
const bindingPackageVersion = require('@theagenticguy/microvms-win32-x64-gnu/package.json').version
|
|
116
|
-
if (bindingPackageVersion !== '0.
|
|
117
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
129
|
+
if (bindingPackageVersion !== '0.10.0' && 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.10.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
118
131
|
}
|
|
119
132
|
return binding
|
|
120
133
|
} catch (e) {
|
|
@@ -129,8 +142,8 @@ function requireNative() {
|
|
|
129
142
|
try {
|
|
130
143
|
const binding = require('@theagenticguy/microvms-win32-x64-msvc')
|
|
131
144
|
const bindingPackageVersion = require('@theagenticguy/microvms-win32-x64-msvc/package.json').version
|
|
132
|
-
if (bindingPackageVersion !== '0.
|
|
133
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
145
|
+
if (bindingPackageVersion !== '0.10.0' && 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.10.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
134
147
|
}
|
|
135
148
|
return binding
|
|
136
149
|
} catch (e) {
|
|
@@ -146,8 +159,8 @@ function requireNative() {
|
|
|
146
159
|
try {
|
|
147
160
|
const binding = require('@theagenticguy/microvms-win32-ia32-msvc')
|
|
148
161
|
const bindingPackageVersion = require('@theagenticguy/microvms-win32-ia32-msvc/package.json').version
|
|
149
|
-
if (bindingPackageVersion !== '0.
|
|
150
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
162
|
+
if (bindingPackageVersion !== '0.10.0' && 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.10.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
151
164
|
}
|
|
152
165
|
return binding
|
|
153
166
|
} catch (e) {
|
|
@@ -162,8 +175,8 @@ function requireNative() {
|
|
|
162
175
|
try {
|
|
163
176
|
const binding = require('@theagenticguy/microvms-win32-arm64-msvc')
|
|
164
177
|
const bindingPackageVersion = require('@theagenticguy/microvms-win32-arm64-msvc/package.json').version
|
|
165
|
-
if (bindingPackageVersion !== '0.
|
|
166
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
178
|
+
if (bindingPackageVersion !== '0.10.0' && 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.10.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
167
180
|
}
|
|
168
181
|
return binding
|
|
169
182
|
} catch (e) {
|
|
@@ -181,8 +194,8 @@ function requireNative() {
|
|
|
181
194
|
try {
|
|
182
195
|
const binding = require('@theagenticguy/microvms-darwin-universal')
|
|
183
196
|
const bindingPackageVersion = require('@theagenticguy/microvms-darwin-universal/package.json').version
|
|
184
|
-
if (bindingPackageVersion !== '0.
|
|
185
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
197
|
+
if (bindingPackageVersion !== '0.10.0' && 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.10.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
186
199
|
}
|
|
187
200
|
return binding
|
|
188
201
|
} catch (e) {
|
|
@@ -197,8 +210,8 @@ function requireNative() {
|
|
|
197
210
|
try {
|
|
198
211
|
const binding = require('@theagenticguy/microvms-darwin-x64')
|
|
199
212
|
const bindingPackageVersion = require('@theagenticguy/microvms-darwin-x64/package.json').version
|
|
200
|
-
if (bindingPackageVersion !== '0.
|
|
201
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
213
|
+
if (bindingPackageVersion !== '0.10.0' && 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.10.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
202
215
|
}
|
|
203
216
|
return binding
|
|
204
217
|
} catch (e) {
|
|
@@ -213,8 +226,8 @@ function requireNative() {
|
|
|
213
226
|
try {
|
|
214
227
|
const binding = require('@theagenticguy/microvms-darwin-arm64')
|
|
215
228
|
const bindingPackageVersion = require('@theagenticguy/microvms-darwin-arm64/package.json').version
|
|
216
|
-
if (bindingPackageVersion !== '0.
|
|
217
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
229
|
+
if (bindingPackageVersion !== '0.10.0' && 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.10.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
218
231
|
}
|
|
219
232
|
return binding
|
|
220
233
|
} catch (e) {
|
|
@@ -233,8 +246,8 @@ function requireNative() {
|
|
|
233
246
|
try {
|
|
234
247
|
const binding = require('@theagenticguy/microvms-freebsd-x64')
|
|
235
248
|
const bindingPackageVersion = require('@theagenticguy/microvms-freebsd-x64/package.json').version
|
|
236
|
-
if (bindingPackageVersion !== '0.
|
|
237
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
249
|
+
if (bindingPackageVersion !== '0.10.0' && 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.10.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
238
251
|
}
|
|
239
252
|
return binding
|
|
240
253
|
} catch (e) {
|
|
@@ -249,8 +262,8 @@ function requireNative() {
|
|
|
249
262
|
try {
|
|
250
263
|
const binding = require('@theagenticguy/microvms-freebsd-arm64')
|
|
251
264
|
const bindingPackageVersion = require('@theagenticguy/microvms-freebsd-arm64/package.json').version
|
|
252
|
-
if (bindingPackageVersion !== '0.
|
|
253
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
265
|
+
if (bindingPackageVersion !== '0.10.0' && 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.10.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
254
267
|
}
|
|
255
268
|
return binding
|
|
256
269
|
} catch (e) {
|
|
@@ -270,8 +283,8 @@ function requireNative() {
|
|
|
270
283
|
try {
|
|
271
284
|
const binding = require('@theagenticguy/microvms-linux-x64-musl')
|
|
272
285
|
const bindingPackageVersion = require('@theagenticguy/microvms-linux-x64-musl/package.json').version
|
|
273
|
-
if (bindingPackageVersion !== '0.
|
|
274
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
286
|
+
if (bindingPackageVersion !== '0.10.0' && 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.10.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
275
288
|
}
|
|
276
289
|
return binding
|
|
277
290
|
} catch (e) {
|
|
@@ -286,8 +299,8 @@ function requireNative() {
|
|
|
286
299
|
try {
|
|
287
300
|
const binding = require('@theagenticguy/microvms-linux-x64-gnu')
|
|
288
301
|
const bindingPackageVersion = require('@theagenticguy/microvms-linux-x64-gnu/package.json').version
|
|
289
|
-
if (bindingPackageVersion !== '0.
|
|
290
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
302
|
+
if (bindingPackageVersion !== '0.10.0' && 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.10.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
291
304
|
}
|
|
292
305
|
return binding
|
|
293
306
|
} catch (e) {
|
|
@@ -304,8 +317,8 @@ function requireNative() {
|
|
|
304
317
|
try {
|
|
305
318
|
const binding = require('@theagenticguy/microvms-linux-arm64-musl')
|
|
306
319
|
const bindingPackageVersion = require('@theagenticguy/microvms-linux-arm64-musl/package.json').version
|
|
307
|
-
if (bindingPackageVersion !== '0.
|
|
308
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
320
|
+
if (bindingPackageVersion !== '0.10.0' && 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.10.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
309
322
|
}
|
|
310
323
|
return binding
|
|
311
324
|
} catch (e) {
|
|
@@ -320,8 +333,8 @@ function requireNative() {
|
|
|
320
333
|
try {
|
|
321
334
|
const binding = require('@theagenticguy/microvms-linux-arm64-gnu')
|
|
322
335
|
const bindingPackageVersion = require('@theagenticguy/microvms-linux-arm64-gnu/package.json').version
|
|
323
|
-
if (bindingPackageVersion !== '0.
|
|
324
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
336
|
+
if (bindingPackageVersion !== '0.10.0' && 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.10.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
325
338
|
}
|
|
326
339
|
return binding
|
|
327
340
|
} catch (e) {
|
|
@@ -338,8 +351,8 @@ function requireNative() {
|
|
|
338
351
|
try {
|
|
339
352
|
const binding = require('@theagenticguy/microvms-linux-arm-musleabihf')
|
|
340
353
|
const bindingPackageVersion = require('@theagenticguy/microvms-linux-arm-musleabihf/package.json').version
|
|
341
|
-
if (bindingPackageVersion !== '0.
|
|
342
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
354
|
+
if (bindingPackageVersion !== '0.10.0' && 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.10.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
343
356
|
}
|
|
344
357
|
return binding
|
|
345
358
|
} catch (e) {
|
|
@@ -354,8 +367,8 @@ function requireNative() {
|
|
|
354
367
|
try {
|
|
355
368
|
const binding = require('@theagenticguy/microvms-linux-arm-gnueabihf')
|
|
356
369
|
const bindingPackageVersion = require('@theagenticguy/microvms-linux-arm-gnueabihf/package.json').version
|
|
357
|
-
if (bindingPackageVersion !== '0.
|
|
358
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
370
|
+
if (bindingPackageVersion !== '0.10.0' && 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.10.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
359
372
|
}
|
|
360
373
|
return binding
|
|
361
374
|
} catch (e) {
|
|
@@ -372,8 +385,8 @@ function requireNative() {
|
|
|
372
385
|
try {
|
|
373
386
|
const binding = require('@theagenticguy/microvms-linux-loong64-musl')
|
|
374
387
|
const bindingPackageVersion = require('@theagenticguy/microvms-linux-loong64-musl/package.json').version
|
|
375
|
-
if (bindingPackageVersion !== '0.
|
|
376
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
388
|
+
if (bindingPackageVersion !== '0.10.0' && 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.10.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
377
390
|
}
|
|
378
391
|
return binding
|
|
379
392
|
} catch (e) {
|
|
@@ -388,8 +401,8 @@ function requireNative() {
|
|
|
388
401
|
try {
|
|
389
402
|
const binding = require('@theagenticguy/microvms-linux-loong64-gnu')
|
|
390
403
|
const bindingPackageVersion = require('@theagenticguy/microvms-linux-loong64-gnu/package.json').version
|
|
391
|
-
if (bindingPackageVersion !== '0.
|
|
392
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
404
|
+
if (bindingPackageVersion !== '0.10.0' && 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.10.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
393
406
|
}
|
|
394
407
|
return binding
|
|
395
408
|
} catch (e) {
|
|
@@ -406,8 +419,8 @@ function requireNative() {
|
|
|
406
419
|
try {
|
|
407
420
|
const binding = require('@theagenticguy/microvms-linux-riscv64-musl')
|
|
408
421
|
const bindingPackageVersion = require('@theagenticguy/microvms-linux-riscv64-musl/package.json').version
|
|
409
|
-
if (bindingPackageVersion !== '0.
|
|
410
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
422
|
+
if (bindingPackageVersion !== '0.10.0' && 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.10.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
411
424
|
}
|
|
412
425
|
return binding
|
|
413
426
|
} catch (e) {
|
|
@@ -422,8 +435,8 @@ function requireNative() {
|
|
|
422
435
|
try {
|
|
423
436
|
const binding = require('@theagenticguy/microvms-linux-riscv64-gnu')
|
|
424
437
|
const bindingPackageVersion = require('@theagenticguy/microvms-linux-riscv64-gnu/package.json').version
|
|
425
|
-
if (bindingPackageVersion !== '0.
|
|
426
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
438
|
+
if (bindingPackageVersion !== '0.10.0' && 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.10.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
427
440
|
}
|
|
428
441
|
return binding
|
|
429
442
|
} catch (e) {
|
|
@@ -439,8 +452,8 @@ function requireNative() {
|
|
|
439
452
|
try {
|
|
440
453
|
const binding = require('@theagenticguy/microvms-linux-ppc64-gnu')
|
|
441
454
|
const bindingPackageVersion = require('@theagenticguy/microvms-linux-ppc64-gnu/package.json').version
|
|
442
|
-
if (bindingPackageVersion !== '0.
|
|
443
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
455
|
+
if (bindingPackageVersion !== '0.10.0' && 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.10.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
444
457
|
}
|
|
445
458
|
return binding
|
|
446
459
|
} catch (e) {
|
|
@@ -455,8 +468,8 @@ function requireNative() {
|
|
|
455
468
|
try {
|
|
456
469
|
const binding = require('@theagenticguy/microvms-linux-s390x-gnu')
|
|
457
470
|
const bindingPackageVersion = require('@theagenticguy/microvms-linux-s390x-gnu/package.json').version
|
|
458
|
-
if (bindingPackageVersion !== '0.
|
|
459
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
471
|
+
if (bindingPackageVersion !== '0.10.0' && 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.10.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
460
473
|
}
|
|
461
474
|
return binding
|
|
462
475
|
} catch (e) {
|
|
@@ -475,8 +488,8 @@ function requireNative() {
|
|
|
475
488
|
try {
|
|
476
489
|
const binding = require('@theagenticguy/microvms-openharmony-arm64')
|
|
477
490
|
const bindingPackageVersion = require('@theagenticguy/microvms-openharmony-arm64/package.json').version
|
|
478
|
-
if (bindingPackageVersion !== '0.
|
|
479
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
491
|
+
if (bindingPackageVersion !== '0.10.0' && 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.10.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
480
493
|
}
|
|
481
494
|
return binding
|
|
482
495
|
} catch (e) {
|
|
@@ -491,8 +504,8 @@ function requireNative() {
|
|
|
491
504
|
try {
|
|
492
505
|
const binding = require('@theagenticguy/microvms-openharmony-x64')
|
|
493
506
|
const bindingPackageVersion = require('@theagenticguy/microvms-openharmony-x64/package.json').version
|
|
494
|
-
if (bindingPackageVersion !== '0.
|
|
495
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
507
|
+
if (bindingPackageVersion !== '0.10.0' && 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.10.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
496
509
|
}
|
|
497
510
|
return binding
|
|
498
511
|
} catch (e) {
|
|
@@ -507,8 +520,8 @@ function requireNative() {
|
|
|
507
520
|
try {
|
|
508
521
|
const binding = require('@theagenticguy/microvms-openharmony-arm')
|
|
509
522
|
const bindingPackageVersion = require('@theagenticguy/microvms-openharmony-arm/package.json').version
|
|
510
|
-
if (bindingPackageVersion !== '0.
|
|
511
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
523
|
+
if (bindingPackageVersion !== '0.10.0' && 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.10.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
512
525
|
}
|
|
513
526
|
return binding
|
|
514
527
|
} catch (e) {
|
|
@@ -627,6 +640,7 @@ if (!nativeBinding || forceWasi) {
|
|
|
627
640
|
if (!candidateFailed) {
|
|
628
641
|
wasiBinding = require('./microvms.wasi.cjs')
|
|
629
642
|
nativeBinding = wasiBinding
|
|
643
|
+
__napiLoadedBindingTarget = 'wasm32-wasi'
|
|
630
644
|
wasiBindingLoaded = true
|
|
631
645
|
}
|
|
632
646
|
} catch (err) {
|
|
@@ -647,12 +661,13 @@ if (!nativeBinding || forceWasi) {
|
|
|
647
661
|
if (!candidateFailed) {
|
|
648
662
|
if (process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
649
663
|
const bindingPackageVersion = require('@theagenticguy/microvms-wasm32-wasi/package.json').version
|
|
650
|
-
if (bindingPackageVersion !== '0.
|
|
651
|
-
throw new Error(`WASI binding package version mismatch, expected 0.
|
|
664
|
+
if (bindingPackageVersion !== '0.10.0') {
|
|
665
|
+
throw new Error(`WASI binding package version mismatch, expected 0.10.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
652
666
|
}
|
|
653
667
|
}
|
|
654
668
|
wasiBinding = require('@theagenticguy/microvms-wasm32-wasi')
|
|
655
669
|
nativeBinding = wasiBinding
|
|
670
|
+
__napiLoadedBindingTarget = 'wasm32-wasi'
|
|
656
671
|
wasiBindingLoaded = true
|
|
657
672
|
}
|
|
658
673
|
} catch (err) {
|
|
@@ -698,18 +713,87 @@ if (!nativeBinding) {
|
|
|
698
713
|
throw new Error(`Failed to load native binding`)
|
|
699
714
|
}
|
|
700
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)
|
|
701
780
|
module.exports = nativeBinding
|
|
702
781
|
module.exports.AgentVm = nativeBinding.AgentVm
|
|
703
782
|
module.exports.Amount = nativeBinding.Amount
|
|
704
783
|
module.exports.BearerToken = nativeBinding.BearerToken
|
|
705
784
|
module.exports.BuildHookTimeout = nativeBinding.BuildHookTimeout
|
|
785
|
+
module.exports.ControlPlane = nativeBinding.ControlPlane
|
|
706
786
|
module.exports.CostReport = nativeBinding.CostReport
|
|
787
|
+
module.exports.Detached = nativeBinding.Detached
|
|
707
788
|
module.exports.Duration = nativeBinding.Duration
|
|
708
789
|
module.exports.EstimatedUsd = nativeBinding.EstimatedUsd
|
|
709
790
|
module.exports.ExecHandle = nativeBinding.ExecHandle
|
|
710
791
|
module.exports.ExecProcess = nativeBinding.ExecProcess
|
|
711
792
|
module.exports.ExecStream = nativeBinding.ExecStream
|
|
793
|
+
module.exports.KeepAwake = nativeBinding.KeepAwake
|
|
712
794
|
module.exports.LineItem = nativeBinding.LineItem
|
|
795
|
+
module.exports.NameRecord = nativeBinding.NameRecord
|
|
796
|
+
module.exports.NameRegistry = nativeBinding.NameRegistry
|
|
713
797
|
module.exports.RateTable = nativeBinding.RateTable
|
|
714
798
|
module.exports.Region = nativeBinding.Region
|
|
715
799
|
module.exports.ResidencyComparison = nativeBinding.ResidencyComparison
|
|
@@ -720,18 +804,25 @@ module.exports.SizeClass = nativeBinding.SizeClass
|
|
|
720
804
|
module.exports.Total = nativeBinding.Total
|
|
721
805
|
module.exports.Unpriced = nativeBinding.Unpriced
|
|
722
806
|
module.exports.agentConstants = nativeBinding.agentConstants
|
|
807
|
+
module.exports.baseImageFromDockerfile = nativeBinding.baseImageFromDockerfile
|
|
723
808
|
module.exports.buildUnpricedReason = nativeBinding.buildUnpricedReason
|
|
724
809
|
module.exports.compareResidency = nativeBinding.compareResidency
|
|
725
810
|
module.exports.coreVersion = nativeBinding.coreVersion
|
|
726
811
|
module.exports.costConstants = nativeBinding.costConstants
|
|
727
812
|
module.exports.defaultBaseImage = nativeBinding.defaultBaseImage
|
|
813
|
+
module.exports.egressPostureFor = nativeBinding.egressPostureFor
|
|
728
814
|
module.exports.errorCodes = nativeBinding.errorCodes
|
|
729
815
|
module.exports.estimateRun = nativeBinding.estimateRun
|
|
730
816
|
module.exports.GapPolicy = nativeBinding.GapPolicy
|
|
731
817
|
module.exports.installAgentAccess = nativeBinding.installAgentAccess
|
|
732
818
|
module.exports.installedAgents = nativeBinding.installedAgents
|
|
733
819
|
module.exports.mintBedrockToken = nativeBinding.mintBedrockToken
|
|
820
|
+
module.exports.mintBedrockTokenWithCredentials = nativeBinding.mintBedrockTokenWithCredentials
|
|
821
|
+
module.exports.preflight = nativeBinding.preflight
|
|
734
822
|
module.exports.promptAgent = nativeBinding.promptAgent
|
|
823
|
+
module.exports.provisionAgentd = nativeBinding.provisionAgentd
|
|
824
|
+
module.exports.provisionAgentdReport = nativeBinding.provisionAgentdReport
|
|
735
825
|
module.exports.runReport = nativeBinding.runReport
|
|
736
826
|
module.exports.sessionConstants = nativeBinding.sessionConstants
|
|
737
827
|
module.exports.wireKinds = nativeBinding.wireKinds
|
|
828
|
+
module.exports.wrapDockerfile = nativeBinding.wrapDockerfile
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theagenticguy/microvms",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Node
|
|
3
|
+
"version": "0.10.0",
|
|
4
|
+
"description": "Node.js and TypeScript client for AWS Lambda MicroVMs",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Laith Al-Saadoon",
|
|
7
7
|
"homepage": "https://laithalsaadoon.github.io/microvms-agentd/",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"build": "napi build --manifest-path ../Cargo.toml --package microvms-js --platform --output-dir .",
|
|
46
46
|
"test": "node --test __test__/*.mjs",
|
|
47
47
|
"test:smoke": "node --test __test__/smoke.mjs",
|
|
48
|
-
"test:unit": "node --test __test__/cost.mjs __test__/errors.mjs __test__/exec.mjs __test__/process.mjs __test__/session.mjs"
|
|
48
|
+
"test:unit": "node --test __test__/cost.mjs __test__/errors.mjs __test__/exec.mjs __test__/process.mjs __test__/session.mjs __test__/numbers.mjs"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@napi-rs/cli": "^3.8.2"
|