Skip to content

feat(js): add wRPC codec package and use it in the web example#1345

Merged
rvolosatovs merged 1 commit into
mainfrom
feat/js
Jun 30, 2026
Merged

feat(js): add wRPC codec package and use it in the web example#1345
rvolosatovs merged 1 commit into
mainfrom
feat/js

Conversation

@rvolosatovs

Copy link
Copy Markdown
Member

Add js/ (@bytecodealliance/wrpc), a dependency-free, transport-agnostic JavaScript codec for the wRPC wire format, mirroring wrpc-transport's value.rs and default framing:

  • t/types build the structural WIT type tree;
  • value encodes/decodes component-model values (a jco-compatible mapping);
  • wit parses inlined WIT text back into the type tree;
  • frame builds an invocation's request bytes and decodes its results.

The ESM source runs directly in the browser and is publishable to npm; it ships a hand-written .d.ts, JSDoc, node --test round-trip tests and a tsc typecheck.

Use the codec in the wasi:keyvalue web example: the UI imports it from /wrpc (served via ServeDir) and drops the hand-rolled byte encoding, removing the 127-byte request/response size limits. The example keeps its own WebTransport stream handling.

Assisted-by: claude:claude-opus-4-8

@rvolosatovs rvolosatovs marked this pull request as ready for review June 22, 2026 19:10
@rvolosatovs rvolosatovs force-pushed the feat/js branch 3 times, most recently from eb1d81f to 99f3122 Compare June 30, 2026 13:26
@rvolosatovs rvolosatovs enabled auto-merge June 30, 2026 13:34
@rvolosatovs rvolosatovs disabled auto-merge June 30, 2026 13:34
Add `js/` (`@bytecodealliance/wrpc`), a dependency-free, transport-agnostic
JavaScript codec for the wRPC wire format, mirroring `wrpc-transport`'s
`value.rs` and default framing:

- `t`/`types` build the structural WIT type tree;
- `value` encodes/decodes component-model values (a jco-compatible mapping);
- `wit` parses inlined WIT text back into the type tree;
- `frame` builds an invocation's request bytes and decodes its results.

The ESM source runs directly in the browser and is publishable to npm; it
ships a hand-written `.d.ts`, JSDoc, `node --test` round-trip tests and a
`tsc` typecheck.

Use the codec in the `wasi:keyvalue` web example: the UI imports it from
`/wrpc` (served via `ServeDir`) and drops the hand-rolled byte encoding,
removing the 127-byte request/response size limits.

Assisted-by: claude:claude-opus-4-8
@rvolosatovs rvolosatovs enabled auto-merge June 30, 2026 14:07
@rvolosatovs rvolosatovs added this pull request to the merge queue Jun 30, 2026
Merged via the queue into main with commit 032b105 Jun 30, 2026
38 checks passed
@rvolosatovs rvolosatovs deleted the feat/js branch June 30, 2026 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant