File tree 1 file changed +27
-4
lines changed
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';
78
78
import { writeFile } from ' node:fs/promises' ;
79
79
80
80
const { 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}` );
83
85
}
86
+
84
87
` , `
85
88
package local:hello;
89
+ interface logger {
90
+ log: func(msg: string);
91
+ }
86
92
world hello {
87
- export hello: func(name: string) -> string;
93
+ import logger;
94
+ export say-hello: func(name: string);
88
95
}
89
96
` );
90
97
91
98
await writeFile (' test.component.wasm' , component);
92
99
```
93
100
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.
95
118
96
119
## Features
97
120
You can’t perform that action at this time.
0 commit comments