MCPcopy Index your code
hub / github.com/bytecodealliance/jco

github.com/bytecodealliance/jco @js-component-bindgen-v2.0.10

Chat with this repo
repository ↗ · DeepWiki ↗ · release js-component-bindgen-v2.0.10 ↗ · + Follow
3,018 symbols 6,721 edges 548 files 362 documented · 12% 1 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

jco

<strong>JavaScript tooling for <a href="https://github.com/WebAssembly/component-model">WebAssembly Components</a></strong>

A Bytecode Alliance project

<a href="https://github.com/bytecodealliance/jco/actions?query=workflow%3ACI"><img src="https://github.com/bytecodealliance/jco/workflows/CI/badge.svg" alt="build status" /></a>

Contributing | Chat on Zulip

Overview

Jco (jco) provides a Javascript-native toolchain for working with WebAssembly Components.

Jco aims to be a convenient multi-tool for the JS WebAssembly ecosystem.

With Jco (and related projects in this repository), you can:

  • Build WebAssembly components from Javascript/Typescript with the help of componentize-js
  • "Transpile" WebAssembly components into ES modules that can run in environments like NodeJS and the browser, combining platform-native WebAssembly core support with the advanced features of WebAssembly Components
  • Run WebAssembly components whether single-shot applications or web servers (similar to wasmtime run/wasmtime serve)
  • Reuse WebAssembly component workflows (e.g. building components, transpiling, etc) from your own JS projects
  • Utilize wasm-tools as a library from JS

Organization

As Jco aims to do many things, it contains many subprojects that are organized in this repository:

Subproject Language Directory Description
jco Javascript packages/jco The jco CLI
jco-transpile Javascript packages/jco-transpile WebAssembly Component Transpilation functionaltiy
jco-std Javascript packages/jco-std A "standard library" for Jco which provides integrations for popular JS frameworks/paradigms
preview2-shim Javascript packages/preview2-shim Library that provides a mapping of WASI Preview 2 for NodeJS and Browsers
preview3-shim Javascript packages/preview3-shim Library that provides a mapping of WASI Preview 3 for NodeJS
js-component-bindgen Rust crates/js-component-bindgen Enables jco transpile and other features, reusing the Rust WebAssembly ecosystem
js-component-bindgen-component Rust crates/js-component-bindgen-component WebAssembly component that (when transpiled) makes js-component-bindgen available in JS jco
wasm-tools-component Rust crates/wasm-tools-component WebAssembly component containing pieces of wasm-tools used by jco

Quickstart

Jco can be used as either a library import or as a CLI via the jco command.

To install it, use pnpm:

pnpm install @bytecodealliance/jco

[!NOTE] If you're using jco to build components, you should also install componentize-js, which is dynamically imported:

console pnpm install @bytecodealliance/componentize-js

Building an example component

For instructions on how to build an example component, see the Component model section on Javascript.

To see examples of common patterns, check out the example components folder (examples/components).

Learn more

For a deeper guide on the intricacies of Jco, read the Jco Book.

Installation quirks

Supported NodeJS test matrix

jco and jco-transpile are tested against the current stable version (even numbered release) of NodeJS and two versions before that one (e.g. if the current NodeJS version is 26.x, 24.x and 22.x are covered under CI)

Node 18.x

If installing on Node 18.x with a version of @bytecodealliance/componentize-js 0.18.3 or above, you may need to install oxc-parser manually.

For example, on linux this would mean the following:

pnpm install oxc-parser --ignore-engines
pnpm install @oxc-parser/binding-linux-x64-gnu --ignore-engines

It may be necessary to replace @oxc-parser/binding-linux-x64-gnu with whatever platform is appropriate.

[!NOTE] If you are using pnpm instaed of pnpm, similar installation issues may occur when using an npm version older than 11.3.0, due to npm bugs related to optional dependencies

License

This project is licensed under the Apache 2.0 license with the LLVM exception. See LICENSE for more details.

Contributing

See the Contributing chapter of the Jco book.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.

Extension points exported contracts — how you extend this code

ManagesIntrinsics (Interface)
Objects that can control the printing/setup of intrinsics (normally in some final codegen output) [3 implementers]
crates/js-component-bindgen/src/lib.rs
SandboxConfig (Interface)
* Sandbox configuration options for WASIShim
packages/preview2-shim/types/instantiation.d.ts
SizeStrOptions (Interface)
Options for `sizeStr()`
packages/jco-transpile/src/common.ts
AppAdapterOpts (Interface)
Options for building a `AppAdapter`
packages/jco-std/src/wasi/0.2.x/hono.ts
Instant (Interface)
(no doc)
packages/preview3-shim/types/interfaces/wasi-clocks-system-clock.d.ts
ResolveExt (Interface)
(no doc) [1 implementers]
crates/js-component-bindgen/src/ts_bindgen.rs
WASIShimConfig (Interface)
* Configuration options for WASIShim
packages/preview2-shim/types/instantiation.d.ts
WriteFileOpts (Interface)
Options for `writeFiles()` utility function
packages/jco-transpile/src/common.ts

Core symbols most depended-on inside this repo

push_str
called by 341
crates/js-component-bindgen/src/source.rs
push
called by 157
crates/js-component-bindgen/src/files.rs
name
called by 131
crates/js-component-bindgen/src/intrinsics/mod.rs
name
called by 124
crates/js-component-bindgen/src/intrinsics/p3/async_task.rs
iter
called by 103
crates/js-component-bindgen/src/files.rs
name
called by 98
crates/js-component-bindgen/src/intrinsics/lower.rs
from
called by 97
packages/preview3-shim/src/nodejs/http/error.ts
push
called by 85
packages/preview3-shim/src/nodejs/workers/http-worker.ts

Shape

Function 1,048
Method 938
Interface 522
Class 471
Enum 39

Languages

TypeScript79%
Rust19%
Python1%
C++1%

Modules by API surface

packages/preview2-shim/src/nodejs/http.ts100 symbols
packages/preview2-shim/src/browser/http.ts85 symbols
packages/preview2-shim/src/nodejs/sockets.ts83 symbols
packages/preview2-shim/types/interfaces/wasi-http-types.d.ts80 symbols
packages/jco-std/src/wasi/0.2.6/generated/types/interfaces/wasi-http-types.d.ts80 symbols
packages/jco-std/src/wasi/0.2.3/generated/types/interfaces/wasi-http-types.d.ts80 symbols
examples/components/http-server-hono/generated/types/interfaces/wasi-http-types.d.ts80 symbols
examples/components/http-server-hono-with-bindings/generated/types/interfaces/wasi-http-types.d.ts80 symbols
crates/js-component-bindgen/src/transpile_bindgen.rs76 symbols
packages/preview3-shim/types/interfaces/wasi-http-types.d.ts71 symbols
packages/preview3-shim/types/interfaces/wasi-filesystem-types.d.ts56 symbols
packages/preview2-shim/src/io/worker-io.ts52 symbols

Used by 1 indexed graphs manifest dependencies, hub-wide

For agents

$ claude mcp add jco \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact