33
44/* auto-generated by NAPI-RS */
55
6- const __nodeFs = require ( 'node:fs' )
6+ const __nodeFs = require ( 'node:fs' )
77const __nodePath = require ( 'node:path' )
88const { WASI : __nodeWASI } = require ( 'node:wasi' )
99const { Worker } = require ( 'node:worker_threads' )
1010
1111const {
1212 instantiateNapiModuleSync : __emnapiInstantiateNapiModuleSync ,
1313 getDefaultContext : __emnapiGetDefaultContext ,
14+ createOnMessage : __wasmCreateOnMessageForFsProxy ,
1415} = require ( '@napi-rs/wasm-runtime' )
1516
17+ const __rootDir = __nodePath . parse ( process . cwd ( ) ) . root
18+
1619const __wasi = new __nodeWASI ( {
1720 version : 'preview1' ,
1821 env : process . env ,
1922 preopens : {
20- '/' : '/'
23+ [ __rootDir ] : __rootDir ,
2124 }
2225} )
2326
2427const __emnapiContext = __emnapiGetDefaultContext ( )
2528
2629const __sharedMemory = new WebAssembly . Memory ( {
27- initial : 1024 ,
28- maximum : 10240 ,
30+ initial : 4000 ,
31+ maximum : 65536 ,
2932 shared : true ,
3033} )
3134
3235let __wasmFilePath = __nodePath . join ( __dirname , 'resolver.wasm32-wasi.wasm' )
36+ const __wasmDebugFilePath = __nodePath . join ( __dirname , 'resolver.wasm32-wasi.debug.wasm' )
3337
34- if ( ! __nodeFs . existsSync ( __wasmFilePath ) ) {
38+ if ( __nodeFs . existsSync ( __wasmDebugFilePath ) ) {
39+ __wasmFilePath = __wasmDebugFilePath
40+ } else if ( ! __nodeFs . existsSync ( __wasmFilePath ) ) {
3541 try {
3642 __wasmFilePath = __nodePath . resolve ( '@oxc-resolver/binding-wasm32-wasi' )
3743 } catch {
@@ -52,10 +58,14 @@ const { instance: __napiInstance, module: __wasiModule, napiModule: __napiModule
5258 } ) ( ) ,
5359 wasi : __wasi ,
5460 onCreateWorker ( ) {
55- return new Worker ( __nodePath . join ( __dirname , 'wasi-worker.mjs' ) , {
61+ const worker = new Worker ( __nodePath . join ( __dirname , 'wasi-worker.mjs' ) , {
5662 env : process . env ,
5763 execArgv : [ '--experimental-wasi-unstable-preview1' ] ,
5864 } )
65+ worker . onmessage = ( { data } ) => {
66+ __wasmCreateOnMessageForFsProxy ( __nodeFs ) ( data )
67+ }
68+ return worker
5969 } ,
6070 overwriteImports ( importObject ) {
6171 importObject . env = {
@@ -79,7 +89,7 @@ function __napi_rs_initialize_modules(__napiInstance) {
7989 __napiInstance . exports [ '__napi_register__ResolveResult_struct_4' ] ?. ( )
8090 __napiInstance . exports [ '__napi_register__sync_5' ] ?. ( )
8191 __napiInstance . exports [ '__napi_register__ResolverFactory_struct_6' ] ?. ( )
82- __napiInstance . exports [ '__napi_register__ResolverFactory_impl_12 ' ] ?. ( )
92+ __napiInstance . exports [ '__napi_register__ResolverFactory_impl_13 ' ] ?. ( )
8393}
8494module . exports . ResolverFactory = __napiModule . exports . ResolverFactory
8595module . exports . EnforceExtension = __napiModule . exports . EnforceExtension
0 commit comments