Skip to content

Commit

Permalink
Generate Typescript documentation from wit files (#1157)
Browse files Browse the repository at this point in the history
This PR uses the `jco types` command to generate Typescript definitions
for the wasm crates instead of `jco transpile`. The reason is that `jco
transpile` generates ts definitions by decoding WASM component binaries,
whereas `jco types` parses .wit files directly and uses that
information. This means that the `Resolve` instance created during
`types` has access to the type documentation info, and the one created
during `transpile` does not.

I've modified `infra check npm` with a new step which calls `jco types`
and handles the resulting .d.ts files. When calling `jco transpile`
we're now passing the option `--no-typescript` to avoid generating
conflicting typescript outputs.

These changes depend on NomicFoundation/jco#1,
which augments the `types` command to accept the same configuration file
that we pass to `transpile`. Without this, the codegen in `types` will
not be able to generate Typescript enums for Rust enums, or any other
customization that we want.
  • Loading branch information
mjoerussell authored Dec 2, 2024
1 parent accac90 commit 8cac89b
Show file tree
Hide file tree
Showing 41 changed files with 905 additions and 786 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8cac89b

Please sign in to comment.