diff --git a/README.md b/README.md index b276184c..59e826bf 100644 --- a/README.md +++ b/README.md @@ -119,10 +119,14 @@ AOT compilation can also be configured with the following options: [weval]: https://github.com/bytecodealliance/weval -### Custom `weval` binary +### Custom `weval` binary for AOT To use a custom (pre-downloaded) [`weval`][weval] binary, set the `wevalBin` option to the path to your desired weval binary. +### Custom `wizer` binary when AOT is disabled + +To use a custom (pre-downloaded) [`wizer`](https://github.com/bytecodealliance/wizer) binary, set the `wizerBin` option to the path to your desired wizer binary. + ### Async Support To support asynchronous operations, all functions may optionally be written as sync or async functions, even though they will always be turned into sync component functions. diff --git a/src/componentize.js b/src/componentize.js index 3ff39d88..55e34575 100644 --- a/src/componentize.js +++ b/src/componentize.js @@ -292,8 +292,14 @@ export async function componentize(opts, } ); } else { + let wizerBin; + if (opts.wizerBin) { + wizerBin = opts.wizerBin; + } else { + wizerBin = wizer; + } wizerProcess = spawnSync( - wizer, + wizerBin, [ '--allow-wasi', '--init-func', diff --git a/types.d.ts b/types.d.ts index f43af3b3..52ba644e 100644 --- a/types.d.ts +++ b/types.d.ts @@ -27,6 +27,10 @@ interface ComponentizeOptions { * Use a pre-existing path to the `weval` binary, if present */ wevalBin?: string, + /** + * Use a pre-existing path to the `wizer` binary, if present + */ + wizerBin?: string, /** * Path to custom Preview2 Adapter */