File tree Expand file tree Collapse file tree 1 file changed +27
-4
lines changed Expand file tree Collapse file tree 1 file changed +27
-4
lines changed Original file line number Diff line number Diff line change @@ -78,20 +78,43 @@ import { componentize } from '@bytecodealliance/componentize-js';
7878import { writeFile } from ' node:fs/promises' ;
7979
8080const { component } = await componentize (`
81- export function hello (name) {
82- return \` Hello \$ {name}\` ;
81+ import { log } from 'local:hello/logger';
82+
83+ export function sayHello (name) {
84+ log(` Hello ${name}` );
8385 }
86+
8487` , `
8588 package local:hello;
89+ interface logger {
90+ log: func(msg: string);
91+ }
8692 world hello {
87- export hello: func(name: string) -> string;
93+ import logger;
94+ export say-hello: func(name: string);
8895 }
8996` );
9097
9198await writeFile (' test.component.wasm' , component);
9299```
93100
94- The component iself can be executed in any component runtime, see the [ example] ( EXAMPLE.md ) for a full workflow.
101+ The component iself can be executed in any component runtime, see the [ example] ( EXAMPLE.md ) for an end to end workflow in Wasmtime.
102+
103+ ### CLI
104+
105+ ComponentizeJS can be used as a CLI from ` jco ` :
106+
107+ ```
108+ npm install -g @bytecodealliance/jco @bytecodealliance/componentize-js
109+ ```
110+
111+ For example:
112+
113+ ``` sh
114+ jco componentize source.js --wit wit -o component.wasm
115+ ```
116+
117+ See ` jco componentize --help ` for more details.
95118
96119## Features
97120
You can’t perform that action at this time.
0 commit comments