Skip to content

Commit 67e8d95

Browse files
authored
handle undefined opts and allow undefined env (#155)
1 parent d4ae59c commit 67e8d95

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

src/componentize.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export async function componentize(jsSource, witWorld, opts) {
3737
opts = witWorld;
3838
witWorld = opts?.witWorld;
3939
}
40+
opts = opts || {};
4041
const {
4142
sourceName = 'source.js',
4243
preview2Adapter = preview1AdapterReactorPath(),
@@ -45,7 +46,7 @@ export async function componentize(jsSource, witWorld, opts) {
4546
disableFeatures = [],
4647
enableFeatures = [],
4748
aotCache = fileURLToPath(new URL(`../lib/starlingmonkey_ics.wevalcache`, import.meta.url))
48-
} = opts || {};
49+
} = opts;
4950

5051
const engine = opts.engine || fileURLToPath(
5152
new URL(opts.enableAot ? `../lib/starlingmonkey_embedding_weval.wasm` : `../lib/starlingmonkey_embedding${DEBUG_BUILD ? '.debug' : ''}.wasm`, import.meta.url));

types.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ interface ComponentizeOptions {
4444
*/
4545
enableFeatures?: [],
4646
/**
47-
* Pass environment variables to the spawned Wizer or Weval Process If set to
48-
* true, all host environment variables are passed. To pass only a subset,
49-
* provide an object with the desired variables.
47+
* Pass environment variables to the spawned Wizer or Weval Process
48+
* If set to true, all host environment variables are passed
49+
* To pass only a subset, provide an object with the desired variables
5050
*/
51-
env: boolean | Record<string, string>,
51+
env?: boolean | Record<string, string>,
5252
}
5353

5454
/**

0 commit comments

Comments
 (0)