@@ -8,15 +8,17 @@ const __nodePath = require('node:path')
88const { WASI : __nodeWASI } = require ( 'node:wasi' )
99const { Worker } = require ( 'node:worker_threads' )
1010
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' )
1315
1416const __wasi = new __nodeWASI ( {
1517 version : 'preview1' ,
1618 env : process . env ,
1719 preopens : {
18- '/' : '/' ,
19- } ,
20+ '/' : '/'
21+ }
2022} )
2123
2224const __emnapiContext = __emnapiGetDefaultContext ( )
@@ -33,19 +35,13 @@ if (!__nodeFs.existsSync(__wasmFilePath)) {
3335 try {
3436 __wasmFilePath = __nodePath . resolve ( '@node-rs/argon2-wasm32-wasi' )
3537 } 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.' )
3939 }
4040}
4141
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 ) , {
4743 context : __emnapiContext ,
48- asyncWorkPoolSize : ( function ( ) {
44+ asyncWorkPoolSize : ( function ( ) {
4945 const threadsSizeFromEnv = Number ( process . env . NAPI_RS_ASYNC_WORK_POOL_SIZE ?? process . env . UV_THREADPOOL_SIZE )
5046 // NaN > 0 is false
5147 if ( threadsSizeFromEnv > 0 ) {
@@ -72,7 +68,7 @@ const {
7268 } ,
7369 beforeInit ( { instance } ) {
7470 __napi_rs_initialize_modules ( instance )
75- } ,
71+ }
7672} )
7773
7874function __napi_rs_initialize_modules ( __napiInstance ) {
0 commit comments