77} from '@napi-rs/wasm-runtime'
88import { createContext as __emnapiCreateContext } from '@emnapi/runtime'
99
10+
11+
1012const __wasi = new __WASI ( {
1113 version : 'preview1' ,
1214} )
@@ -31,7 +33,10 @@ const __sharedMemory = new WebAssembly.Memory({
3133 shared : true ,
3234} )
3335const __asyncWorkPoolSize = 4
34- const __workerPoolSize = Math . max ( 2 , globalThis . navigator ?. hardwareConcurrency ?? 4 )
36+ const __workerPoolSize = Math . max (
37+ 2 ,
38+ globalThis . navigator ?. hardwareConcurrency ?? 4 ,
39+ )
3540
3641let __emnapiContext
3742
@@ -46,15 +51,17 @@ let __emnapiWasmEnvCleanupDrained = false
4651let __emnapiWasmEnvCleanupDrainPromise
4752let __wasiDisposed = false
4853let __wasiDisposePromise
49- let __completeWasiDisposal = function ( ) { }
54+ let __completeWasiDisposal = function ( ) { }
5055// Overridden by loader flavors that have a last-resort reclaim for a rollback
5156// that stopped short of destroying the context. See
5257// `__rollbackWasiInitialization`.
53- let __retainWasiRollbackForRetry = function ( ) { }
58+ let __retainWasiRollbackForRetry = function ( ) { }
5459
5560function __isThenable ( value ) {
5661 return (
57- value !== null && ( typeof value === 'object' || typeof value === 'function' ) && typeof value . then === 'function'
62+ value !== null &&
63+ ( typeof value === 'object' || typeof value === 'function' ) &&
64+ typeof value . then === 'function'
5865 )
5966}
6067
@@ -75,9 +82,15 @@ function __attachCleanupErrors(error, cleanupErrors) {
7582 if ( cleanupErrors . length === 0 ) {
7683 return error
7784 }
78- const cleanupError = __createCleanupError ( cleanupErrors , 'WASI binding cleanup failed' )
85+ const cleanupError = __createCleanupError (
86+ cleanupErrors ,
87+ 'WASI binding cleanup failed' ,
88+ )
7989 try {
80- if ( error && ( typeof error === 'object' || typeof error === 'function' ) ) {
90+ if (
91+ error &&
92+ ( typeof error === 'object' || typeof error === 'function' )
93+ ) {
8194 if ( error . cause === undefined ) {
8295 error . cause = cleanupError
8396 if ( error . cause === cleanupError ) {
@@ -96,7 +109,10 @@ function __attachCleanupErrors(error, cleanupErrors) {
96109 }
97110 }
98111 } catch { }
99- const aggregate = __createCleanupError ( [ error , cleanupError ] , 'WASI binding initialization and cleanup failed' )
112+ const aggregate = __createCleanupError (
113+ [ error , cleanupError ] ,
114+ 'WASI binding initialization and cleanup failed' ,
115+ )
100116 try {
101117 aggregate . cause = error
102118 } catch { }
@@ -207,7 +223,9 @@ function __drainWasmEnvCleanup() {
207223 return
208224 }
209225 }
210- const limit = observable ? __WASM_ENV_CLEANUP_DRAIN_TURNS : __WASM_ENV_CLEANUP_BLIND_DRAIN_TURNS
226+ const limit = observable
227+ ? __WASM_ENV_CLEANUP_DRAIN_TURNS
228+ : __WASM_ENV_CLEANUP_BLIND_DRAIN_TURNS
211229 const drainPromise = ( async ( ) => {
212230 let queued = 0
213231 for ( let turn = 0 ; turn < limit ; turn ++ ) {
@@ -330,7 +348,10 @@ function __terminateWasiWorkers() {
330348
331349 const finish = ( ) => {
332350 if ( cleanupErrors . length > 0 ) {
333- throw __createCleanupError ( cleanupErrors , 'Failed to terminate WASI workers' )
351+ throw __createCleanupError (
352+ cleanupErrors ,
353+ 'Failed to terminate WASI workers' ,
354+ )
334355 }
335356 }
336357 return pending . length > 0 ? Promise . all ( pending ) . then ( finish ) : finish ( )
@@ -536,7 +557,7 @@ let __napiModule
536557try {
537558 __emnapiContext = __emnapiCreateContext ( { autoDestroy : false } )
538559 __emnapiContext . suppressDestroy ( )
539-
560+
540561 ; ( {
541562 instance : __napiInstance ,
542563 module : __wasiModule ,
@@ -553,6 +574,7 @@ try {
553574 } )
554575 __wasiWorkers . add ( worker )
555576
577+
556578 return worker
557579 } ,
558580 overwriteImports ( importObject ) {
0 commit comments