@bytecodealliance/jco 1.3.1 → 1.4.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 +3 -37
- package/lib/wasi_snapshot_preview1.command.wasm +0 -0
- package/lib/wasi_snapshot_preview1.reactor.wasm +0 -0
- package/obj/js-component-bindgen-component.core.wasm +0 -0
- package/obj/js-component-bindgen-component.core2.wasm +0 -0
- package/obj/js-component-bindgen-component.d.ts +1 -1
- package/obj/js-component-bindgen-component.js +2 -2
- package/obj/wasm-tools.core.wasm +0 -0
- package/obj/wasm-tools.core2.wasm +0 -0
- package/obj/wasm-tools.d.ts +1 -1
- package/obj/wasm-tools.js +2 -2
- package/package.json +19 -11
- package/src/browser.d.ts +2 -1
- package/src/browser.d.ts.map +1 -1
- package/src/browser.js +6 -3
- package/src/cmd/transpile.d.ts +4 -4
- package/src/cmd/transpile.d.ts.map +1 -1
- package/src/cmd/transpile.js +3 -1
- package/src/jco.js +2 -2
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@ Jco can be used as either a library import or as a CLI via the `jco` command.
|
|
|
42
42
|
|
|
43
43
|
## Example
|
|
44
44
|
|
|
45
|
-
See the [
|
|
45
|
+
See the [Example Workflow](https://bytecodealliance.github.io/jco/example.html) page for a full usage example.
|
|
46
46
|
|
|
47
47
|
## CLI
|
|
48
48
|
|
|
@@ -77,41 +77,7 @@ For help with individual command options, use `jco <cmd> --help`.
|
|
|
77
77
|
|
|
78
78
|
### Transpile
|
|
79
79
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
```
|
|
83
|
-
jco transpile component.wasm -o out-dir
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
The resultant file can be imported providing the bindings of the component as if it were imported directly:
|
|
87
|
-
|
|
88
|
-
app.js
|
|
89
|
-
```
|
|
90
|
-
import { fn } from './out-dir/component.js';
|
|
91
|
-
|
|
92
|
-
fn();
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
Imports can be remapped using the `--map` flag, or to provide imports as an argument use the `--instantiation` option.
|
|
96
|
-
|
|
97
|
-
Components relying on WASI bindings will contain external WASI imports, which are automatically updated
|
|
98
|
-
to the `@bytecodealliance/preview2-shim` package. This package can be installed from npm separately for
|
|
99
|
-
runtime usage. This shim layer supports both Node.js and browsers.
|
|
100
|
-
|
|
101
|
-
Options include:
|
|
102
|
-
* `--name`: Give a custom name for the component JS file in `out-dir/[name].js`
|
|
103
|
-
* `--minify`: Minify the component JS
|
|
104
|
-
* `--optimize`: Runs the internal core Wasm files through Binaryen for optimization. Optimization options can be passed with a `-- <binaryen options>` flag separator.
|
|
105
|
-
* `--tla-compat`: Instead of relying on top-level-await, requires an `$init` promise to be imported and awaited first.
|
|
106
|
-
* `--js`: Converts core Wasm files to JavaScript for environments that don't even support core Wasm.
|
|
107
|
-
* `--base64-cutoff=<number>`: Sets the maximum number of bytes for inlining Wasm files into the JS using base64 encoding. Set to zero to disable base64 inlining entirely.
|
|
108
|
-
* `--no-wasi-shim`: Disable the WASI shim mapping to `@bytecodealliance/preview2-shim`.
|
|
109
|
-
* `--map`: Provide custom mappings for world imports. Supports both wildcard mappings (`*` similarly as in the package.json "exports" field) as well as `#` mappings for targetting exported interfaces. For example, the WASI mappings are internally defined with mappings like `--map wasi:filesystem/*=@bytecodealliance/preview2-shim/filesystem#*` to map `import as * filesystem from 'wasi:filesystem/types'` to `import { types } from '@bytecodealliance/preview2-shim/filesystem`.
|
|
110
|
-
* `--no-nodejs-compat`: Disables Node.js compat in the output to load core Wasm with FS methods.
|
|
111
|
-
* `--instantiation [mode]`: Instead of a direct ES module, export an `instantiate` function which can take the imports as an argument instead of implicit imports. The `instantiate` function can be async (with `--instantiation` or `--instantiation async`), or sync (with `--instantiation sync`).
|
|
112
|
-
* `--valid-lifting-optimization`: Internal validations are removed assuming that core Wasm binaries are valid components, providing a minor output size saving.
|
|
113
|
-
* `--tracing`: Emit tracing calls for all function entry and exits.
|
|
114
|
-
* `--no-namespaced-exports`: Removes exports of the type `test as "test:flavorful/test"` which are not compatible with typescript
|
|
80
|
+
See the [Transpiling Docs](https://bytecodealliance.github.io/jco/transpiling.html) for more background and info.
|
|
115
81
|
|
|
116
82
|
#### Bindgen Crate
|
|
117
83
|
|
|
@@ -191,7 +157,7 @@ Add new producer metadata to a component or core Wasm binary.
|
|
|
191
157
|
|
|
192
158
|
## Contributing
|
|
193
159
|
|
|
194
|
-
See the [Contributing](
|
|
160
|
+
See the [Contributing](https://bytecodealliance.github.io/jco/contributing.html) chapter of the Jco book.
|
|
195
161
|
|
|
196
162
|
# License
|
|
197
163
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -78,7 +78,7 @@ import { WasiCliTerminalOutput } from './interfaces/wasi-cli-terminal-output.js'
|
|
|
78
78
|
import { WasiCliTerminalStderr } from './interfaces/wasi-cli-terminal-stderr.js';
|
|
79
79
|
import { WasiCliTerminalStdin } from './interfaces/wasi-cli-terminal-stdin.js';
|
|
80
80
|
import { WasiCliTerminalStdout } from './interfaces/wasi-cli-terminal-stdout.js';
|
|
81
|
-
|
|
81
|
+
declare const WasiClocksWallClock: {};
|
|
82
82
|
import { WasiFilesystemPreopens } from './interfaces/wasi-filesystem-preopens.js';
|
|
83
83
|
import { WasiFilesystemTypes } from './interfaces/wasi-filesystem-types.js';
|
|
84
84
|
import { WasiIoError } from './interfaces/wasi-io-error.js';
|
|
@@ -3974,8 +3974,8 @@ export const $init = (() => {
|
|
|
3974
3974
|
let gen = (function* init () {
|
|
3975
3975
|
const module0 = fetchCompile(new URL('./js-component-bindgen-component.core.wasm', import.meta.url));
|
|
3976
3976
|
const module1 = fetchCompile(new URL('./js-component-bindgen-component.core2.wasm', import.meta.url));
|
|
3977
|
-
const module2 = base64Compile('AGFzbQEAAAABZw5gAn9/AGABfwBgAn9/AX9gA39+fwBgBX9/f39/AGAEf39/fwBgBH9/f38Bf2AHf39/f39/fwBgAn5/AGAJf39/f39+fn9/AX9gBX9/f35/AX9gBX9/f39/AX9gAX8Bf2ADf39/AX8DJiUBAwMAAAAABAcABAAAAwMABQUACAEBAQEGCQoLAgIGAgIMAg0BBAUBcAElJQe7ASYBMAAAATEAAQEyAAIBMwADATQABAE1AAUBNgAGATcABwE4AAgBOQAJAjEwAAoCMTEACwIxMgAMAjEzAA0CMTQADgIxNQAPAjE2ABACMTcAEQIxOAASAjE5ABMCMjAAFAIyMQAVAjIyABYCMjMAFwIyNAAYAjI1ABkCMjYAGgIyNwAbAjI4ABwCMjkAHQIzMAAeAjMxAB8CMzIAIAIzMwAhAjM0ACICMzUAIwIzNgAkCCRpbXBvcnRzAQAK+
|
|
3978
|
-
const module3 = base64Compile('AGFzbQEAAAABaw9gAX8AYAN/fn8AYAJ/fwBgBX9/f39/AGAHf39/f39/fwBgBH9/f38AYAJ+fwBgBH9/f38Bf2AJf39/f39+fn9/AX9gBX9/f35/AX9gBX9/f39/AX9gAn9/AX9gAX8Bf2ADf39/
|
|
3977
|
+
const module2 = base64Compile('AGFzbQEAAAABZw5gAn9/AGABfwBgAn9/AX9gA39+fwBgBX9/f39/AGAEf39/fwBgBH9/f38Bf2AHf39/f39/fwBgAn5/AGAJf39/f39+fn9/AX9gBX9/f35/AX9gBX9/f39/AX9gAX8Bf2ADf39/AX8DJiUBAwMAAAAABAcABAAAAwMABQUACAEBAQEGCQoLAgIGAgIMAg0BBAUBcAElJQe7ASYBMAAAATEAAQEyAAIBMwADATQABAE1AAUBNgAGATcABwE4AAgBOQAJAjEwAAoCMTEACwIxMgAMAjEzAA0CMTQADgIxNQAPAjE2ABACMTcAEQIxOAASAjE5ABMCMjAAFAIyMQAVAjIyABYCMjMAFwIyNAAYAjI1ABkCMjYAGgIyNwAbAjI4ABwCMjkAHQIzMAAeAjMxAB8CMzIAIAIzMwAhAjM0ACICMzUAIwIzNgAkCCRpbXBvcnRzAQAK+QMlCQAgAEEAEQEACw0AIAAgASACQQERAwALDQAgACABIAJBAhEDAAsLACAAIAFBAxEAAAsLACAAIAFBBBEAAAsLACAAIAFBBREAAAsLACAAIAFBBhEAAAsRACAAIAEgAiADIARBBxEEAAsVACAAIAEgAiADIAQgBSAGQQgRBwALCwAgACABQQkRAAALEQAgACABIAIgAyAEQQoRBAALCwAgACABQQsRAAALCwAgACABQQwRAAALDQAgACABIAJBDREDAAsNACAAIAEgAkEOEQMACwsAIAAgAUEPEQAACw8AIAAgASACIANBEBEFAAsPACAAIAEgAiADQRERBQALCwAgACABQRIRAAALCwAgACABQRMRCAALCQAgAEEUEQEACwkAIABBFREBAAsJACAAQRYRAQALCQAgAEEXEQEACw8AIAAgASACIANBGBEGAAsZACAAIAEgAiADIAQgBSAGIAcgCEEZEQkACxEAIAAgASACIAMgBEEaEQoACxEAIAAgASACIAMgBEEbEQsACwsAIAAgAUEcEQIACwsAIAAgAUEdEQIACw8AIAAgASACIANBHhEGAAsLACAAIAFBHxECAAsLACAAIAFBIBECAAsJACAAQSERDAALCwAgACABQSIRAgALDQAgACABIAJBIxENAAsJACAAQSQRAQALAC8JcHJvZHVjZXJzAQxwcm9jZXNzZWQtYnkBDXdpdC1jb21wb25lbnQHMC4yMTIuMA');
|
|
3978
|
+
const module3 = base64Compile('AGFzbQEAAAABaw9gAX8AYAN/fn8AYAJ/fwBgBX9/f39/AGAHf39/f39/fwBgBH9/f38AYAJ+fwBgBH9/f38Bf2AJf39/f39+fn9/AX9gBX9/f35/AX9gBX9/f39/AX9gAn9/AX9gAX8Bf2ADf39/AX9gAX8AAuQBJgABMAAAAAExAAEAATIAAQABMwACAAE0AAIAATUAAgABNgACAAE3AAMAATgABAABOQACAAIxMAADAAIxMQACAAIxMgACAAIxMwABAAIxNAABAAIxNQACAAIxNgAFAAIxNwAFAAIxOAACAAIxOQAGAAIyMAAAAAIyMQAAAAIyMgAAAAIyMwAAAAIyNAAHAAIyNQAIAAIyNgAJAAIyNwAKAAIyOAALAAIyOQALAAIzMAAHAAIzMQALAAIzMgALAAIzMwAMAAIzNAALAAIzNQANAAIzNgAOAAgkaW1wb3J0cwFwASUlCSsBAEEACyUAAQIDBAUGBwgJCgsMDQ4PEBESExQVFhcYGRobHB0eHyAhIiMkAC8JcHJvZHVjZXJzAQxwcm9jZXNzZWQtYnkBDXdpdC1jb21wb25lbnQHMC4yMTIuMAAcBG5hbWUAFRR3aXQtY29tcG9uZW50OmZpeHVwcw');
|
|
3979
3979
|
({ exports: exports0 } = yield instantiateCore(yield module2));
|
|
3980
3980
|
({ exports: exports1 } = yield instantiateCore(yield module0, {
|
|
3981
3981
|
wasi_snapshot_preview1: {
|
package/obj/wasm-tools.core.wasm
CHANGED
|
Binary file
|
|
Binary file
|
package/obj/wasm-tools.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { WasiCliTerminalOutput } from './interfaces/wasi-cli-terminal-output.js'
|
|
|
8
8
|
import { WasiCliTerminalStderr } from './interfaces/wasi-cli-terminal-stderr.js';
|
|
9
9
|
import { WasiCliTerminalStdin } from './interfaces/wasi-cli-terminal-stdin.js';
|
|
10
10
|
import { WasiCliTerminalStdout } from './interfaces/wasi-cli-terminal-stdout.js';
|
|
11
|
-
|
|
11
|
+
declare const WasiClocksWallClock: {};
|
|
12
12
|
import { WasiFilesystemPreopens } from './interfaces/wasi-filesystem-preopens.js';
|
|
13
13
|
import { WasiFilesystemTypes } from './interfaces/wasi-filesystem-types.js';
|
|
14
14
|
import { WasiIoError } from './interfaces/wasi-io-error.js';
|
package/obj/wasm-tools.js
CHANGED
|
@@ -4093,8 +4093,8 @@ export const $init = (() => {
|
|
|
4093
4093
|
let gen = (function* init () {
|
|
4094
4094
|
const module0 = fetchCompile(new URL('./wasm-tools.core.wasm', import.meta.url));
|
|
4095
4095
|
const module1 = fetchCompile(new URL('./wasm-tools.core2.wasm', import.meta.url));
|
|
4096
|
-
const module2 = base64Compile('AGFzbQEAAAABZw5gAn9/AGABfwBgAn9/AX9gA39+fwBgBX9/f39/AGAEf39/fwBgBH9/f38Bf2AHf39/f39/fwBgAn5/AGAJf39/f39+fn9/AX9gBX9/f35/AX9gBX9/f39/AX9gAX8Bf2ADf39/AX8DJiUBAwMAAAAABAcABAAAAwMABQUACAEBAQEGCQoLAgIGAgIMAg0BBAUBcAElJQe7ASYBMAAAATEAAQEyAAIBMwADATQABAE1AAUBNgAGATcABwE4AAgBOQAJAjEwAAoCMTEACwIxMgAMAjEzAA0CMTQADgIxNQAPAjE2ABACMTcAEQIxOAASAjE5ABMCMjAAFAIyMQAVAjIyABYCMjMAFwIyNAAYAjI1ABkCMjYAGgIyNwAbAjI4ABwCMjkAHQIzMAAeAjMxAB8CMzIAIAIzMwAhAjM0ACICMzUAIwIzNgAkCCRpbXBvcnRzAQAK+
|
|
4097
|
-
const module3 = base64Compile('AGFzbQEAAAABZw5gAn9/AGABfwBgAn9/AX9gA39+fwBgBX9/f39/AGAEf39/fwBgBH9/f38Bf2AHf39/f39/fwBgAn5/AGAJf39/f39+fn9/AX9gBX9/f35/AX9gBX9/f39/AX9gAX8Bf2ADf39/
|
|
4096
|
+
const module2 = base64Compile('AGFzbQEAAAABZw5gAn9/AGABfwBgAn9/AX9gA39+fwBgBX9/f39/AGAEf39/fwBgBH9/f38Bf2AHf39/f39/fwBgAn5/AGAJf39/f39+fn9/AX9gBX9/f35/AX9gBX9/f39/AX9gAX8Bf2ADf39/AX8DJiUBAwMAAAAABAcABAAAAwMABQUACAEBAQEGCQoLAgIGAgIMAg0BBAUBcAElJQe7ASYBMAAAATEAAQEyAAIBMwADATQABAE1AAUBNgAGATcABwE4AAgBOQAJAjEwAAoCMTEACwIxMgAMAjEzAA0CMTQADgIxNQAPAjE2ABACMTcAEQIxOAASAjE5ABMCMjAAFAIyMQAVAjIyABYCMjMAFwIyNAAYAjI1ABkCMjYAGgIyNwAbAjI4ABwCMjkAHQIzMAAeAjMxAB8CMzIAIAIzMwAhAjM0ACICMzUAIwIzNgAkCCRpbXBvcnRzAQAK+QMlCQAgAEEAEQEACw0AIAAgASACQQERAwALDQAgACABIAJBAhEDAAsLACAAIAFBAxEAAAsLACAAIAFBBBEAAAsLACAAIAFBBREAAAsLACAAIAFBBhEAAAsRACAAIAEgAiADIARBBxEEAAsVACAAIAEgAiADIAQgBSAGQQgRBwALCwAgACABQQkRAAALEQAgACABIAIgAyAEQQoRBAALCwAgACABQQsRAAALCwAgACABQQwRAAALDQAgACABIAJBDREDAAsNACAAIAEgAkEOEQMACwsAIAAgAUEPEQAACw8AIAAgASACIANBEBEFAAsPACAAIAEgAiADQRERBQALCwAgACABQRIRAAALCwAgACABQRMRCAALCQAgAEEUEQEACwkAIABBFREBAAsJACAAQRYRAQALCQAgAEEXEQEACw8AIAAgASACIANBGBEGAAsZACAAIAEgAiADIAQgBSAGIAcgCEEZEQkACxEAIAAgASACIAMgBEEaEQoACxEAIAAgASACIAMgBEEbEQsACwsAIAAgAUEcEQIACwsAIAAgAUEdEQIACw8AIAAgASACIANBHhEGAAsLACAAIAFBHxECAAsLACAAIAFBIBECAAsJACAAQSERDAALCwAgACABQSIRAgALDQAgACABIAJBIxENAAsJACAAQSQRAQALAC8JcHJvZHVjZXJzAQxwcm9jZXNzZWQtYnkBDXdpdC1jb21wb25lbnQHMC4yMTIuMA');
|
|
4097
|
+
const module3 = base64Compile('AGFzbQEAAAABZw5gAn9/AGABfwBgAn9/AX9gA39+fwBgBX9/f39/AGAEf39/fwBgBH9/f38Bf2AHf39/f39/fwBgAn5/AGAJf39/f39+fn9/AX9gBX9/f35/AX9gBX9/f39/AX9gAX8Bf2ADf39/AX8C5AEmAAEwAAEAATEAAwABMgADAAEzAAAAATQAAAABNQAAAAE2AAAAATcABAABOAAHAAE5AAAAAjEwAAQAAjExAAAAAjEyAAAAAjEzAAMAAjE0AAMAAjE1AAAAAjE2AAUAAjE3AAUAAjE4AAAAAjE5AAgAAjIwAAEAAjIxAAEAAjIyAAEAAjIzAAEAAjI0AAYAAjI1AAkAAjI2AAoAAjI3AAsAAjI4AAIAAjI5AAIAAjMwAAYAAjMxAAIAAjMyAAIAAjMzAAwAAjM0AAIAAjM1AA0AAjM2AAEACCRpbXBvcnRzAXABJSUJKwEAQQALJQABAgMEBQYHCAkKCwwNDg8QERITFBUWFxgZGhscHR4fICEiIyQALwlwcm9kdWNlcnMBDHByb2Nlc3NlZC1ieQENd2l0LWNvbXBvbmVudAcwLjIxMi4w');
|
|
4098
4098
|
({ exports: exports0 } = yield instantiateCore(yield module2));
|
|
4099
4099
|
({ exports: exports1 } = yield instantiateCore(yield module0, {
|
|
4100
4100
|
wasi_snapshot_preview1: {
|
package/package.json
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bytecodealliance/jco",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "JavaScript tooling for working with WebAssembly Components",
|
|
5
5
|
"author": "Guy Bedford",
|
|
6
6
|
"bin": {
|
|
7
7
|
"jco": "src/jco.js"
|
|
8
8
|
},
|
|
9
9
|
"exports": {
|
|
10
|
-
"
|
|
11
|
-
|
|
10
|
+
".": {
|
|
11
|
+
"browser": "./src/browser.js",
|
|
12
|
+
"default": "./src/api.js"
|
|
13
|
+
},
|
|
14
|
+
"./component": {
|
|
15
|
+
"types": "./obj/js-component-bindgen-component.d.ts",
|
|
16
|
+
"default": "./src/browser.js"
|
|
17
|
+
}
|
|
12
18
|
},
|
|
13
19
|
"imports": {
|
|
14
20
|
"#ora": {
|
|
@@ -18,8 +24,8 @@
|
|
|
18
24
|
},
|
|
19
25
|
"type": "module",
|
|
20
26
|
"dependencies": {
|
|
21
|
-
"@bytecodealliance/preview2-shim": "^0.16.
|
|
22
|
-
"binaryen": "^
|
|
27
|
+
"@bytecodealliance/preview2-shim": "^0.16.4",
|
|
28
|
+
"binaryen": "^118.0.0",
|
|
23
29
|
"chalk-template": "^1",
|
|
24
30
|
"commander": "^12",
|
|
25
31
|
"mkdirp": "^3",
|
|
@@ -28,13 +34,15 @@
|
|
|
28
34
|
},
|
|
29
35
|
"devDependencies": {
|
|
30
36
|
"@bytecodealliance/componentize-js": "^0.9.0",
|
|
31
|
-
"@types/node": "^
|
|
32
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
33
|
-
"@typescript-eslint/parser": "^
|
|
34
|
-
"eslint": "^8.
|
|
35
|
-
"
|
|
37
|
+
"@types/node": "^20.14.12",
|
|
38
|
+
"@typescript-eslint/eslint-plugin": "^7.17.0",
|
|
39
|
+
"@typescript-eslint/parser": "^7.17.0",
|
|
40
|
+
"eslint": "^8.56.0",
|
|
41
|
+
"mime": "^4.0.4",
|
|
42
|
+
"mocha": "^10.7.0",
|
|
43
|
+
"puppeteer": "^22.14.0",
|
|
36
44
|
"terser": "^5.16.1",
|
|
37
|
-
"typescript": "^5.
|
|
45
|
+
"typescript": "^5.5.4"
|
|
38
46
|
},
|
|
39
47
|
"repository": {
|
|
40
48
|
"type": "git",
|
package/src/browser.d.ts
CHANGED
package/src/browser.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["browser.js"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["browser.js"],"names":[],"mappings":"AAEA,uDAGC;AAED,4DAGC"}
|
package/src/browser.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { $init, generate, generateTypes as _generateTypes } from '../obj/js-component-bindgen-component.js';
|
|
1
|
+
import { $init, generate as _generate, generateTypes as _generateTypes } from '../obj/js-component-bindgen-component.js';
|
|
2
2
|
|
|
3
|
-
export async function
|
|
3
|
+
export async function generate () {
|
|
4
4
|
await $init;
|
|
5
|
-
return
|
|
5
|
+
return _generate.apply(this, arguments);
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
export async function generateTypes () {
|
|
9
9
|
await $init;
|
|
10
10
|
return _generateTypes.apply(this, arguments);
|
|
11
11
|
}
|
|
12
|
+
|
|
13
|
+
// for backwards compat
|
|
14
|
+
export { generate as transpile }
|
package/src/cmd/transpile.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export function transpile(componentPath: any, opts: any, program: any): Promise<
|
|
|
26
26
|
* @param {{
|
|
27
27
|
* name: string,
|
|
28
28
|
* instantiation?: 'async' | 'sync',
|
|
29
|
-
* importBindings?: 'js' | 'optimized'
|
|
29
|
+
* importBindings?: 'js' | 'optimized' | 'hybrid' | 'direct-optimized',
|
|
30
30
|
* map?: Record<string, string>,
|
|
31
31
|
* validLiftingOptimization?: bool,
|
|
32
32
|
* tracing?: bool,
|
|
@@ -39,6 +39,7 @@ export function transpile(componentPath: any, opts: any, program: any): Promise<
|
|
|
39
39
|
* namespacedExports?: bool,
|
|
40
40
|
* outDir?: string,
|
|
41
41
|
* multiMemory?: bool,
|
|
42
|
+
* experimentalIdlImports?: bool,
|
|
42
43
|
* optArgs?: string[],
|
|
43
44
|
* }} opts
|
|
44
45
|
* @returns {Promise<{ files: { [filename: string]: Uint8Array }, imports: string[], exports: [string, 'function' | 'instance'][] }>}
|
|
@@ -46,9 +47,7 @@ export function transpile(componentPath: any, opts: any, program: any): Promise<
|
|
|
46
47
|
export function transpileComponent(component: Uint8Array, opts?: {
|
|
47
48
|
name: string;
|
|
48
49
|
instantiation?: "async" | "sync";
|
|
49
|
-
importBindings?: "js" | "optimized";
|
|
50
|
-
"hybrid": any;
|
|
51
|
-
"direct-optimized": any;
|
|
50
|
+
importBindings?: "js" | "optimized" | "hybrid" | "direct-optimized";
|
|
52
51
|
map?: Record<string, string>;
|
|
53
52
|
validLiftingOptimization?: bool;
|
|
54
53
|
tracing?: bool;
|
|
@@ -61,6 +60,7 @@ export function transpileComponent(component: Uint8Array, opts?: {
|
|
|
61
60
|
namespacedExports?: bool;
|
|
62
61
|
outDir?: string;
|
|
63
62
|
multiMemory?: bool;
|
|
63
|
+
experimentalIdlImports?: bool;
|
|
64
64
|
optArgs?: string[];
|
|
65
65
|
}): Promise<{
|
|
66
66
|
files: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transpile.d.ts","sourceRoot":"","sources":["transpile.js"],"names":[],"mappings":"AAgBA,8DAGC;AAED;;;;;;;;;;GAUG;AACH,wCAVW,MAAM,QACN;IACV,IAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAiB,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACrC,SAAa,CAAC,EAAE,IAAI,CAAC;IACrB,MAAU,CAAC,EAAE,MAAM,CAAC;CACjB,GACS,OAAO,CAAC;IAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAAA;CAAE,CAAC,CAoBvD;AAkBD,sFAwBC;AAuBD
|
|
1
|
+
{"version":3,"file":"transpile.d.ts","sourceRoot":"","sources":["transpile.js"],"names":[],"mappings":"AAgBA,8DAGC;AAED;;;;;;;;;;GAUG;AACH,wCAVW,MAAM,QACN;IACV,IAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAiB,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACrC,SAAa,CAAC,EAAE,IAAI,CAAC;IACrB,MAAU,CAAC,EAAE,MAAM,CAAC;CACjB,GACS,OAAO,CAAC;IAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAAA;CAAE,CAAC,CAoBvD;AAkBD,sFAwBC;AAuBD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,8CAtBW,UAAU,SACV;IACV,IAAQ,EAAE,MAAM,CAAC;IACjB,aAAiB,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACrC,cAAkB,CAAC,EAAE,IAAI,GAAG,WAAW,GAAG,QAAQ,GAAG,kBAAkB,CAAC;IACxE,GAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,wBAA4B,CAAC,EAAE,IAAI,CAAC;IACpC,OAAW,CAAC,EAAE,IAAI,CAAC;IACnB,YAAgB,CAAC,EAAE,IAAI,CAAC;IACxB,SAAa,CAAC,EAAE,IAAI,CAAC;IACrB,YAAgB,CAAC,EAAE,IAAI,CAAC;IACxB,EAAM,CAAC,EAAE,IAAI,CAAC;IACd,MAAU,CAAC,EAAE,IAAI,CAAC;IAClB,QAAY,CAAC,EAAE,IAAI,CAAC;IACpB,iBAAqB,CAAC,EAAE,IAAI,CAAC;IAC7B,MAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAe,CAAC,EAAE,IAAI,CAAC;IACvB,sBAA0B,CAAC,EAAE,IAAI,CAAC;IAClC,OAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB,GACS,OAAO,CAAC;IAAE,KAAK,EAAE;QAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAAA;KAAE,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAAC,EAAE,CAAA;CAAE,CAAC,CAoSnI"}
|
package/src/cmd/transpile.js
CHANGED
|
@@ -119,7 +119,7 @@ async function wasm2Js (source) {
|
|
|
119
119
|
* @param {{
|
|
120
120
|
* name: string,
|
|
121
121
|
* instantiation?: 'async' | 'sync',
|
|
122
|
-
* importBindings?: 'js' | 'optimized'
|
|
122
|
+
* importBindings?: 'js' | 'optimized' | 'hybrid' | 'direct-optimized',
|
|
123
123
|
* map?: Record<string, string>,
|
|
124
124
|
* validLiftingOptimization?: bool,
|
|
125
125
|
* tracing?: bool,
|
|
@@ -132,6 +132,7 @@ async function wasm2Js (source) {
|
|
|
132
132
|
* namespacedExports?: bool,
|
|
133
133
|
* outDir?: string,
|
|
134
134
|
* multiMemory?: bool,
|
|
135
|
+
* experimentalIdlImports?: bool,
|
|
135
136
|
* optArgs?: string[],
|
|
136
137
|
* }} opts
|
|
137
138
|
* @returns {Promise<{ files: { [filename: string]: Uint8Array }, imports: string[], exports: [string, 'function' | 'instance'][] }>}
|
|
@@ -183,6 +184,7 @@ export async function transpileComponent (component, opts = {}) {
|
|
|
183
184
|
base64Cutoff: opts.js ? 0 : opts.base64Cutoff ?? 5000,
|
|
184
185
|
noNamespacedExports: opts.namespacedExports === false,
|
|
185
186
|
multiMemory: opts.multiMemory === true,
|
|
187
|
+
idlImports: opts.experimentalIdlImports === true,
|
|
186
188
|
});
|
|
187
189
|
|
|
188
190
|
let outDir = (opts.outDir ?? '').replace(/\\/g, '/');
|
package/src/jco.js
CHANGED
|
@@ -11,7 +11,7 @@ program
|
|
|
11
11
|
.name('jco')
|
|
12
12
|
.description(c`{bold jco - WebAssembly JS Component Tools}\n JS Component Transpilation Bindgen & Wasm Tools for JS`)
|
|
13
13
|
.usage('<command> [options]')
|
|
14
|
-
.version('1.
|
|
14
|
+
.version('1.4.0');
|
|
15
15
|
|
|
16
16
|
function myParseInt(value) {
|
|
17
17
|
return parseInt(value, 10);
|
|
@@ -23,7 +23,7 @@ program.command('componentize')
|
|
|
23
23
|
.argument('<js-source>', 'JS source file to build')
|
|
24
24
|
.requiredOption('-w, --wit <path>', 'WIT path to build with')
|
|
25
25
|
.option('-n, --world-name <name>', 'WIT world to build')
|
|
26
|
-
.addOption(new Option('-d, --disable <feature...>', 'disable WASI features').choices(['stdio', 'random', 'clocks']))
|
|
26
|
+
.addOption(new Option('-d, --disable <feature...>', 'disable WASI features').choices(['stdio', 'random', 'clocks', 'http']))
|
|
27
27
|
.option('--preview2-adapter <adapter>', 'provide a custom preview2 adapter path')
|
|
28
28
|
.requiredOption('-o, --out <out>', 'output component file')
|
|
29
29
|
.action(asyncAction(componentize));
|