Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions src/componentize.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@ export async function componentize(jsSource, witWorld, opts) {
witWorld = opts?.witWorld;
}
opts = opts || {};
const {
let {
sourceName = 'source.js',
preview2Adapter = preview1AdapterReactorPath(),
witPath,
worldName,
disableFeatures = [],
enableFeatures = [],
runtimeArgs,
aotCache = fileURLToPath(
new URL(`../lib/starlingmonkey_ics.wevalcache`, import.meta.url)
),
Expand Down Expand Up @@ -222,6 +223,10 @@ export async function componentize(jsSource, witWorld, opts) {
console.log('--- Wizer Env ---');
console.log(env);
}

let sourcePath = maybeWindowsPath(join(sourceDir, sourceName.slice(0, -3) + '.bindings.js'));
runtimeArgs = runtimeArgs ? `${runtimeArgs} ${sourcePath}` : sourcePath;

if (opts.enableAot) {
// Determine the weval bin path, possibly using a pre-downloaded version
let wevalBin;
Expand All @@ -247,9 +252,7 @@ export async function componentize(jsSource, witWorld, opts) {
{
stdio: [null, stdout, stderr],
env,
input: maybeWindowsPath(
join(sourceDir, sourceName.slice(0, -3) + '.bindings.js')
),
input: runtimeArgs,
shell: true,
encoding: 'utf-8',
}
Expand Down Expand Up @@ -284,9 +287,7 @@ export async function componentize(jsSource, witWorld, opts) {
{
stdio: [null, stdout, stderr],
env,
input: maybeWindowsPath(
join(sourceDir, sourceName.slice(0, -3) + '.bindings.js')
),
input: runtimeArgs,
shell: true,
encoding: 'utf-8',
}
Expand Down
5 changes: 5 additions & 0 deletions types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ interface ComponentizeOptions {
* To pass only a subset, provide an object with the desired variables
*/
env?: boolean | Record<string, string>,
/**
* Runtime arguments to provide to the StarlingMonkey engine initialization
* (see https://github.com/bytecodealliance/StarlingMonkey/blob/main/include/config-parser.h)
*/
runtimeArgs?: string,
}

/**
Expand Down
Loading