Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: jco componentize for latest ComponentizeJS #122

Merged
merged 2 commits into from
Aug 4, 2023
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
2 changes: 1 addition & 1 deletion crates/js-component-bindgen/src/transpile_bindgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ impl Instantiator<'_, '_> {
// To avoid uncaught promise rejection errors, we attach an intermediate
// Promise.all with a rejection handler, if there are multiple promises.
for i in 0..self.component.num_runtime_component_instances {
uwriteln!(self.src.js_init, "const instance_flags{i} = new WebAssembly.Global({{value: \"i32\", mutable: true}}, {})", wasmtime_environ::component::FLAG_MAY_LEAVE | wasmtime_environ::component::FLAG_MAY_ENTER);
uwriteln!(self.src.js_init, "const instanceFlags{i} = new WebAssembly.Global({{ value: \"i32\", mutable: true }}, {});", wasmtime_environ::component::FLAG_MAY_LEAVE | wasmtime_environ::component::FLAG_MAY_ENTER);
}
if self.modules.len() > 1 {
self.src.js_init.push_str("Promise.all([");
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"terser": "^5.16.1"
},
"devDependencies": {
"@bytecodealliance/componentize-js": "^0.1.0",
"@bytecodealliance/componentize-js": "^0.1.1",
"@types/node": "^18.11.17",
"@typescript-eslint/eslint-plugin": "^5.41.0",
"@typescript-eslint/parser": "^5.41.0",
Expand Down
3 changes: 2 additions & 1 deletion src/cmd/componentize.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ export async function componentize (jsSource, opts) {
const source = await readFile(jsSource, 'utf8');
const { component, imports } = await componentizeFn(source, {
witPath: resolve(opts.wit),
worldName: opts.worldName
worldName: opts.worldName,
enableStdout: opts.enableStdout,
});
await writeFile(opts.out, component);
console.log(c`{green OK} Successfully written {bold ${opts.out}} with imports (${imports.join(', ')}).`);
Expand Down
1 change: 1 addition & 0 deletions src/jco.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ program.command('componentize')
.argument('<js-source>', 'JS source file to build')
.requiredOption('-w, --wit <path>', 'WIT path to build with')
.option('-n, --world-name <name>', 'WIT world to build')
.option('--enable-stdout', 'Allow console.log to output to stdout')
.requiredOption('-o, --out <out>', 'output component file')
.action(asyncAction(componentize));

Expand Down
2 changes: 1 addition & 1 deletion test/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export async function cliTest (fixtures) {
}
});

test.skip('Componentize', async () => {
test('Componentize', async () => {
try {
const { stdout, stderr } = await exec(jcoPath,
'componentize',
Expand Down
Loading