Skip to content

js: ship the jco-transpile wrapper as a bin; export the shared driver glue - #67

Merged
lann merged 1 commit into
mainfrom
js-consumer-glue
Aug 7, 2026
Merged

js: ship the jco-transpile wrapper as a bin; export the shared driver glue#67
lann merged 1 commit into
mainfrom
js-consumer-glue

Conversation

@lann

@lann lann commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Fixes #58 (umbrella #14, continuation of #5). Three consumer-glue pieces, currently copied per repo with drift:

  • component-test-jco-transpile bin (js/jco-transpile.mjs): the thrice-copied wrapper (webcrypto/websocket/webrtc, 8-line pairwise diffs), superset version — webrtc's no-eager-subtask-return option included, both wiring styles supported (--async-mode+--map and -I async). Resolves @bytecodealliance/jco-transpile from the invoking package's node_modules, so consumers keep pinning their own transpiler (registry 0.5.2 and the lann-fork tarball both work).
  • ./imports export (js/viewer/imports.mjs): bindImports — the websocket/webrtc harness.mjs binding trio generalized: caller's preview2-shim namespaces (absent members skipped), explicit env, SUT imports, upstream Context always bound; bare + versioned key spellings with configurable wasiVersions (components built against wasi 0.2.6 need the exact minor — learned on the tls spike). Browser-safe, no Node APIs.
  • envelope() normalizes the suite name to the lockfile identity (wasm stem, underscores) — the replaceAll("-","_") hack lived in every runner copy; harness-core knowledge now lives in the harness. No-op for existing callers (verify-node's byte-for-byte goldens confirm).

New verify-imports recipe (plain node) added to just all. Full driver-layer unification stays out by design — that's #59.

… glue

Continuation of #5's one-harness consolidation: the case loop moved
upstream, but three consumer-glue pieces stayed copied per repo and
diverged — the jco-transpile CLI wrapper (three copies, existing only
because @bytecodealliance/jco-transpile publishes the library without
its CLI; the webrtc copy's no-eager-subtask-return option folded in),
the wasi/test-context import binding for -I async instantiation, and
the suite.replaceAll("-","_") lockfile-identity reconciliation in
every runner.

- js/jco-transpile.mjs, packaged as the component-test-jco-transpile
  bin; resolves @bytecodealliance/jco-transpile from the invoking
  package so each consumer keeps pinning its own toolchain.
- js/viewer/imports.mjs (exports ./imports): bindImports over the
  caller's preview2-shim namespaces + explicit environment + SUT
  imports, bare and versioned spellings both (wasiVersions covers
  components built against later wasi 0.2 minors).
- envelope() normalizes the suite name to the wasm-stem identity;
  a no-op for the already-normalized names every caller passes.

verify-imports (plain node, in `all`) pins the glue; verify-node's
byte-for-byte goldens pin the envelope no-op.

Fixes #58.
@lann
lann merged commit fc859cc into main Aug 7, 2026
2 checks passed
@lann
lann deleted the js-consumer-glue branch August 7, 2026 04:08
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.

component-test-js: ship the jco-transpile CLI wrapper as a bin; export the shared runner glue (import binding, suite-name reconciliation)

1 participant