@@ -8,15 +8,17 @@ const __nodePath = require('node:path')
8
8
const { WASI : __nodeWASI } = require ( 'node:wasi' )
9
9
const { Worker } = require ( 'node:worker_threads' )
10
10
11
- const { instantiateNapiModuleSync : __emnapiInstantiateNapiModuleSync } = require ( '@emnapi/core' )
12
- const { getDefaultContext : __emnapiGetDefaultContext } = require ( '@emnapi/runtime' )
11
+ const {
12
+ instantiateNapiModuleSync : __emnapiInstantiateNapiModuleSync ,
13
+ getDefaultContext : __emnapiGetDefaultContext ,
14
+ } = require ( '@napi-rs/wasm-runtime' )
13
15
14
16
const __wasi = new __nodeWASI ( {
15
17
version : 'preview1' ,
16
18
env : process . env ,
17
19
preopens : {
18
- '/' : '/' ,
19
- } ,
20
+ '/' : '/'
21
+ }
20
22
} )
21
23
22
24
const __emnapiContext = __emnapiGetDefaultContext ( )
@@ -33,19 +35,13 @@ if (!__nodeFs.existsSync(__wasmFilePath)) {
33
35
try {
34
36
__wasmFilePath = __nodePath . resolve ( '@node-rs/argon2-wasm32-wasi' )
35
37
} catch {
36
- throw new Error (
37
- 'Cannot find argon2.wasm32-wasi.wasm file, and @node-rs/argon2-wasm32-wasi package is not installed.' ,
38
- )
38
+ throw new Error ( 'Cannot find argon2.wasm32-wasi.wasm file, and @node-rs/argon2-wasm32-wasi package is not installed.' )
39
39
}
40
40
}
41
41
42
- const {
43
- instance : __napiInstance ,
44
- module : __wasiModule ,
45
- napiModule : __napiModule ,
46
- } = __emnapiInstantiateNapiModuleSync ( __nodeFs . readFileSync ( __wasmFilePath ) , {
42
+ const { instance : __napiInstance , module : __wasiModule , napiModule : __napiModule } = __emnapiInstantiateNapiModuleSync ( __nodeFs . readFileSync ( __wasmFilePath ) , {
47
43
context : __emnapiContext ,
48
- asyncWorkPoolSize : ( function ( ) {
44
+ asyncWorkPoolSize : ( function ( ) {
49
45
const threadsSizeFromEnv = Number ( process . env . NAPI_RS_ASYNC_WORK_POOL_SIZE ?? process . env . UV_THREADPOOL_SIZE )
50
46
// NaN > 0 is false
51
47
if ( threadsSizeFromEnv > 0 ) {
@@ -72,7 +68,7 @@ const {
72
68
} ,
73
69
beforeInit ( { instance } ) {
74
70
__napi_rs_initialize_modules ( instance )
75
- } ,
71
+ }
76
72
} )
77
73
78
74
function __napi_rs_initialize_modules ( __napiInstance ) {
0 commit comments