@bytecodealliance/jco 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -19,10 +19,11 @@
19
19
  Features include:
20
20
 
21
21
  * "Transpiling" Wasm Component binaries into ES modules that can run in any JS environment.
22
- * Optimization helpers for Components via Binaryen
22
+ * Optimization helpers for Components via Binaryen.
23
23
  * Component builds of [Wasm Tools](https://github.com/bytecodealliance/wasm-tools) helpers, available for use as a library or CLI commands for use in native JS environments.
24
+ * "Componentize" for WebAssembly Components from JavaScript sources and a WIT world
24
25
 
25
- For creating components, see the [Cargo Component](https://github.com/bytecodealliance/cargo-Component) project for Rust and [Wit Bindgen](https://github.com/bytecodealliance/wit-bindgen) for various guest bindgen helpers.
26
+ For creating components in other languages, see the [Cargo Component](https://github.com/bytecodealliance/cargo-Component) project for Rust and [Wit Bindgen](https://github.com/bytecodealliance/wit-bindgen) for various guest bindgen helpers.
26
27
 
27
28
  > **Note**: This is an experimental project, no guarantees are provided for stability or support and breaking changes may be made in future.
28
29
 
@@ -38,9 +39,49 @@ jco can be used as either a library or as a CLI via the `jco` CLI command.
38
39
 
39
40
  See the [example workflow](EXAMPLE.md) page for a full usage example.
40
41
 
41
- ## API
42
+ ## CLI
43
+
44
+ ```shell
45
+ Usage: jco <command> [options]
46
+
47
+ jco - WebAssembly JS Component Tools
48
+ JS Component Transpilation Bindgen & Wasm Tools for JS
49
+
50
+ Options:
51
+ -V, --version output the version number
52
+ -h, --help display help for command
53
+
54
+ Commands:
55
+ componentize [options] <js-source> Create a component from a JavaScript module
56
+ transpile [options] <component-path> Transpile a WebAssembly Component to JS + core Wasm for JavaScript execution
57
+ opt [options] <component-file> optimizes a Wasm component, including running wasm-opt Binaryen optimizations
58
+ wit [options] <component-path> extract the WIT from a WebAssembly Component [wasm-tools component wit]
59
+ print [options] <input> print the WebAssembly WAT text for a binary file [wasm-tools print]
60
+ metadata-show [options] [module] extract the producer metadata for a Wasm binary [wasm-tools metadata show]
61
+ metadata-add [options] [module] add producer metadata for a Wasm binary [wasm-tools metadata add]
62
+ parse [options] <input> parses the Wasm text format into a binary file [wasm-tools parse]
63
+ new [options] <core-module> create a WebAssembly component adapted from a component core Wasm [wasm-tools component new]
64
+ embed [options] [core-module] embed the component typing section into a core Wasm module [wasm-tools component embed]
65
+ help [command] display help for command
66
+ ```
67
+
68
+ ### Componentize
69
+
70
+ To componentize a JS file run:
71
+
72
+ ```
73
+ jco componentize app.js --world world.wit -o component.wasm
74
+ ```
42
75
 
43
- The below is an outline of the available API functions, see [api.d.ts](api.d.ts) file for the exact options.
76
+ Creates a component from a JS module implementing a WIT world definition, via a Spidermonkey engine embedding.
77
+
78
+ Currently requires an explicit install of the componentize-js engine via `npm install @bytecodealliance/componentize-js`.
79
+
80
+ See [ComponentizeJS](https://github.com/bytecodealliance/componentize-js) for more details on this process.
81
+
82
+ > Additional engines may be supported in future via an `--engine` field or otherwise.
83
+
84
+ ## API
44
85
 
45
86
  #### `transpile(component: Uint8Array, opts?): Promise<{ files: Record<string, Uint8Array> }>`
46
87
 
@@ -92,31 +133,6 @@ Parse a compoment WAT to output a Component binary.
92
133
 
93
134
  Add new producer metadata to a component or core Wasm binary.
94
135
 
95
- ## CLI
96
-
97
- ```shell
98
- Usage: jco <command> [options]
99
-
100
- jco - WebAssembly JS Component Tools
101
- JS Component Transpilation Bindgen & Wasm Tools for JS
102
-
103
- Options:
104
- -V, --version output the version number
105
- -h, --help display help for command
106
-
107
- Commands:
108
- transpile [options] <component-path> Transpile a WebAssembly Component to JS + core Wasm for JavaScript execution
109
- opt [options] <component-file> optimizes a Wasm component, including running wasm-opt Binaryen optimizations
110
- wit [options] <component-path> extract the WIT from a WebAssembly Component [wasm-tools component wit]
111
- print [options] <input> print the WebAssembly WAT text for a binary file [wasm-tools print]
112
- metadata-show [options] [module] extract the producer metadata for a Wasm binary [wasm-tools metadata show]
113
- metadata-add [options] [module] add producer metadata for a Wasm binary [wasm-tools metadata add]
114
- parse [options] <input> parses the Wasm text format into a binary file [wasm-tools parse]
115
- new [options] <core-module> create a WebAssembly component adapted from a component core Wasm [wasm-tools component new]
116
- embed [options] [core-module] embed the component typing section into a core Wasm module [wasm-tools component embed]
117
- help [command] display help for command
118
- ```
119
-
120
136
  ## Contributing
121
137
 
122
138
  Development is based on a standard `npm install && npm run build && npm run test` workflow.