Socket
Socket
Sign inDemoInstall

@bytecodealliance/jco

Package Overview
Dependencies
Maintainers
0
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bytecodealliance/jco - npm Package Compare versions

Comparing version 1.3.1 to 1.4.0

2

obj/js-component-bindgen-component.d.ts

@@ -81,3 +81,3 @@ export type Files = [string, Uint8Array][];

import { WasiCliTerminalStdout } from './interfaces/wasi-cli-terminal-stdout.js';
import { WasiClocksWallClock } from './interfaces/wasi-clocks-wall-clock.js';
declare const WasiClocksWallClock: {};
import { WasiFilesystemPreopens } from './interfaces/wasi-filesystem-preopens.js';

@@ -84,0 +84,0 @@ import { WasiFilesystemTypes } from './interfaces/wasi-filesystem-types.js';

@@ -11,3 +11,3 @@ import { WasiCliEnvironment } from './interfaces/wasi-cli-environment.js';

import { WasiCliTerminalStdout } from './interfaces/wasi-cli-terminal-stdout.js';
import { WasiClocksWallClock } from './interfaces/wasi-clocks-wall-clock.js';
declare const WasiClocksWallClock: {};
import { WasiFilesystemPreopens } from './interfaces/wasi-filesystem-preopens.js';

@@ -14,0 +14,0 @@ import { WasiFilesystemTypes } from './interfaces/wasi-filesystem-types.js';

{
"name": "@bytecodealliance/jco",
"version": "1.3.1",
"version": "1.4.0",
"description": "JavaScript tooling for working with WebAssembly Components",

@@ -10,4 +10,10 @@ "author": "Guy Bedford",

"exports": {
"browser": "./src/browser.js",
"default": "./src/api.js"
".": {
"browser": "./src/browser.js",
"default": "./src/api.js"
},
"./component": {
"types": "./obj/js-component-bindgen-component.d.ts",
"default": "./src/browser.js"
}
},

@@ -22,4 +28,4 @@ "imports": {

"dependencies": {
"@bytecodealliance/preview2-shim": "^0.16.3",
"binaryen": "^116.0.0",
"@bytecodealliance/preview2-shim": "^0.16.4",
"binaryen": "^118.0.0",
"chalk-template": "^1",

@@ -33,9 +39,11 @@ "commander": "^12",

"@bytecodealliance/componentize-js": "^0.9.0",
"@types/node": "^18.11.17",
"@typescript-eslint/eslint-plugin": "^5.41.0",
"@typescript-eslint/parser": "^5.41.0",
"eslint": "^8.30.0",
"mocha": "^10.2.0",
"@types/node": "^20.14.12",
"@typescript-eslint/eslint-plugin": "^7.17.0",
"@typescript-eslint/parser": "^7.17.0",
"eslint": "^8.56.0",
"mime": "^4.0.4",
"mocha": "^10.7.0",
"puppeteer": "^22.14.0",
"terser": "^5.16.1",
"typescript": "^5.3.3"
"typescript": "^5.5.4"
},

@@ -42,0 +50,0 @@ "repository": {

@@ -45,3 +45,3 @@ <div align="center">

See the [example workflow](docs/src/example.md) page for a full usage example.
See the [Example Workflow](https://bytecodealliance.github.io/jco/example.html) page for a full usage example.

@@ -81,38 +81,4 @@ ## CLI

To transpile a component into JS:
See the [Transpiling Docs](https://bytecodealliance.github.io/jco/transpiling.html) for more background and info.
```
jco transpile component.wasm -o out-dir
```
The resultant file can be imported providing the bindings of the component as if it were imported directly:
app.js
```
import { fn } from './out-dir/component.js';
fn();
```
Imports can be remapped using the `--map` flag, or to provide imports as an argument use the `--instantiation` option.
Components relying on WASI bindings will contain external WASI imports, which are automatically updated
to the `@bytecodealliance/preview2-shim` package. This package can be installed from npm separately for
runtime usage. This shim layer supports both Node.js and browsers.
Options include:
* `--name`: Give a custom name for the component JS file in `out-dir/[name].js`
* `--minify`: Minify the component JS
* `--optimize`: Runs the internal core Wasm files through Binaryen for optimization. Optimization options can be passed with a `-- <binaryen options>` flag separator.
* `--tla-compat`: Instead of relying on top-level-await, requires an `$init` promise to be imported and awaited first.
* `--js`: Converts core Wasm files to JavaScript for environments that don't even support core Wasm.
* `--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.
* `--no-wasi-shim`: Disable the WASI shim mapping to `@bytecodealliance/preview2-shim`.
* `--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`.
* `--no-nodejs-compat`: Disables Node.js compat in the output to load core Wasm with FS methods.
* `--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`).
* `--valid-lifting-optimization`: Internal validations are removed assuming that core Wasm binaries are valid components, providing a minor output size saving.
* `--tracing`: Emit tracing calls for all function entry and exits.
* `--no-namespaced-exports`: Removes exports of the type `test as "test:flavorful/test"` which are not compatible with typescript
#### Bindgen Crate

@@ -196,3 +162,3 @@

See the [Contributing](docs/src/contributing.md) chapter of the Jco book.
See the [Contributing](https://bytecodealliance.github.io/jco/contributing.html) chapter of the Jco book.

@@ -199,0 +165,0 @@ # License

@@ -1,3 +0,4 @@

export function transpile(...args: any[]): Promise<any>;
export function generate(...args: any[]): Promise<any>;
export function generateTypes(...args: any[]): Promise<any>;
export { generate as transpile };
//# sourceMappingURL=browser.d.ts.map

@@ -1,6 +0,6 @@

import { $init, generate, generateTypes as _generateTypes } from '../obj/js-component-bindgen-component.js';
import { $init, generate as _generate, generateTypes as _generateTypes } from '../obj/js-component-bindgen-component.js';
export async function transpile () {
export async function generate () {
await $init;
return generate.apply(this, arguments);
return _generate.apply(this, arguments);
}

@@ -12,1 +12,4 @@

}
// for backwards compat
export { generate as transpile }

@@ -29,3 +29,3 @@ export function types(witPath: any, opts: any): Promise<void>;

* instantiation?: 'async' | 'sync',
* importBindings?: 'js' | 'optimized', 'hybrid', 'direct-optimized',
* importBindings?: 'js' | 'optimized' | 'hybrid' | 'direct-optimized',
* map?: Record<string, string>,

@@ -43,2 +43,3 @@ * validLiftingOptimization?: bool,

* multiMemory?: bool,
* experimentalIdlImports?: bool,
* optArgs?: string[],

@@ -51,5 +52,3 @@ * }} opts

instantiation?: "async" | "sync";
importBindings?: "js" | "optimized";
"hybrid": any;
"direct-optimized": any;
importBindings?: "js" | "optimized" | "hybrid" | "direct-optimized";
map?: Record<string, string>;

@@ -67,2 +66,3 @@ validLiftingOptimization?: bool;

multiMemory?: bool;
experimentalIdlImports?: bool;
optArgs?: string[];

@@ -69,0 +69,0 @@ }): Promise<{

@@ -122,3 +122,3 @@ import { $init, generate, generateTypes } from '../../obj/js-component-bindgen-component.js';

* instantiation?: 'async' | 'sync',
* importBindings?: 'js' | 'optimized', 'hybrid', 'direct-optimized',
* importBindings?: 'js' | 'optimized' | 'hybrid' | 'direct-optimized',
* map?: Record<string, string>,

@@ -136,2 +136,3 @@ * validLiftingOptimization?: bool,

* multiMemory?: bool,
* experimentalIdlImports?: bool,
* optArgs?: string[],

@@ -188,2 +189,3 @@ * }} opts

multiMemory: opts.multiMemory === true,
idlImports: opts.experimentalIdlImports === true,
});

@@ -190,0 +192,0 @@

@@ -14,3 +14,3 @@ #!/usr/bin/env node

.usage('<command> [options]')
.version('1.3.1');
.version('1.4.0');

@@ -27,3 +27,3 @@ function myParseInt(value) {

.option('-n, --world-name <name>', 'WIT world to build')
.addOption(new Option('-d, --disable <feature...>', 'disable WASI features').choices(['stdio', 'random', 'clocks']))
.addOption(new Option('-d, --disable <feature...>', 'disable WASI features').choices(['stdio', 'random', 'clocks', 'http']))
.option('--preview2-adapter <adapter>', 'provide a custom preview2 adapter path')

@@ -30,0 +30,0 @@ .requiredOption('-o, --out <out>', 'output component file')

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc