PitchHut
Log in / Sign up
jco
20 views
Empower JavaScript with the flexibility of WebAssembly Components.
Pitch

JCO is a native JavaScript toolchain designed for seamless integration with WebAssembly Components. With features like transpiling Wasm binaries to ES modules and support for WASI, it enhances your JS environment with powerful functionalities. Whether you need CLI commands or optimization tools, JCO simplifies the development of WebAssembly-based applications.

Description

Overview

Jco is a powerful JavaScript toolchain designed for seamless integration with WebAssembly Components. This innovative framework empowers developers to utilize WebAssembly's capabilities right within their JavaScript environments, expanding the potential for high-performance web applications.

Key Features

  • Transpile WebAssembly Components: Effortlessly convert Wasm Component binaries into ES modules, enabling them to run in any JavaScript environment.
  • WASI Preview2 Support: Experiment with the latest capabilities in Node.js and browsers for enhanced functionality.
  • Component Builds with Wasm Tools: Access helpful libraries or CLI commands through Wasm Tools, along with optimization support via Binaryen.
  • Run and Serve Commands: Utilize jco commands similar to Wasmtime for executing JavaScript implementations of Command and HTTP Proxy worlds.
  • Component Creation: Leverage the componentize command to simplify the process of creating components written in JavaScript, utilizing ComponentizeJS.

For building components in other languages, visit the Cargo Component for Rust and Wit Bindgen for varying guest bindgen helpers.

Example Usage

Explore various usage scenarios to see how to effectively implement Jco in your projects. Check the Example Workflow for detailed guidance.

Command Line Interface (CLI)

Jco features a comprehensive CLI for managing WebAssembly components with ease:

Usage: jco <command> [options]

jco - WebAssembly JS Component Tools
      JS Component Transpilation Bindgen & Wasm Tools for JS

Options:
  -V, --version                         output the version number
  -h, --help                            display help for command

Commands:
  componentize [options] <js-source>    Create a component from a JavaScript module
  transpile [options] <component-path>  Transpile a WebAssembly Component to JS + core Wasm
  types [options] <wit-path>            Generate types for the given WIT
  run [options] <command> [args...]     Run a WASI Command component
  serve [options] <server> [args...]    Serve a WASI HTTP component
  ...                                   More commands available

To learn more about specific command options, simply use jco <cmd> --help.

Advanced Functionality

  • Transpile with Documentation: For in-depth documentation on transpiling, visit the Transpiling Docs.
  • Bindgen Integration: Integrate Rust transpilation using the js-component-bindgen library found on crates.io.

Componentization with Jco

Effortlessly componentize a JavaScript file using:

jco componentize app.js --wit wit -n world-name -o component.wasm

This command creates a component from your JavaScript module, adhering to a specified WIT world definition, facilitated through a Spidermonkey engine embedding.

API References

Get started with the powerful API:

  • transpile(component: Uint8Array, opts?): Converts a Component to JavaScript.
  • opt(component: Uint8Array, opts?): Optimizes a Component using Binaryen's Wasm-opt.
  • Additional APIs for metadata extraction, parsing, and component creation.

Community and Contributions

Join the vibrant community contributing to Jco. For guidelines on participating, explore the Contributing section of the Jco documentation.