Skip to content

Add wasip1 npm build target - #4733

Closed
Jake Bailey (jakebailey) wants to merge 2 commits into
mainfrom
jabaile/wasip1
Closed

Add wasip1 npm build target#4733
Jake Bailey (jakebailey) wants to merge 2 commits into
mainfrom
jabaile/wasip1

Conversation

@jakebailey

@jakebailey Jake Bailey (jakebailey) commented Jul 24, 2026

Copy link
Copy Markdown
Member

Fixes microsoft/TypeScript#63858
Fixes microsoft/TypeScript#63862

This does not bundle the lib.d.ts files in the binary, but instead assumes that tsc.wasm will live in the right place, which implies the host has mounted the files. I feel like this is probably fine, but, maybe it's not.

Copilot AI review requested due to automatic review settings July 24, 2026 20:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an official WASI Preview 1 WebAssembly npm build target and avoids unsupported signal handling under WASI.

Changes:

  • Publishes standalone wasip1/wasm platform packages.
  • Produces .wasm binaries with adjacent TypeScript libraries.
  • Replaces signal watchers with cancellable contexts on WASI.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
Herebyfile.mjs Adds WASI packaging, naming, and release support.
cmd/tsgo/main.go Introduces WASI-safe context creation.
cmd/tsgo/lsp.go Uses the WASI-safe context for LSP.
cmd/tsgo/api.go Uses the WASI-safe context for API mode.

Comment thread Herebyfile.mjs
...inputPackageJson,
name: mainNativePreviewPackage.npmPackageName,
optionalDependencies: Object.fromEntries(platforms.map(p => [p.npmPackageName, getVersion()])),
optionalDependencies: Object.fromEntries(platforms.filter(p => p.nodeOs !== "wasip1").map(p => [p.npmPackageName, getVersion()])),

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's basically expected at this stage, unless we make the shim able to load in Node the wasm blob, which, as far as I can tell is unstable. But I need to recheck.

@jakebailey

Copy link
Copy Markdown
Member Author

wasip1 lacks os.Executable, so this breaks, currently.

@jakebailey
Jake Bailey (jakebailey) marked this pull request as draft July 24, 2026 20:15
@jakebailey Jake Bailey (jakebailey) added the Unmigrated PR This PR was open at the time of the repo move back to TypeScript label Aug 14, 2026
@RyanCavanaugh

Copy link
Copy Markdown
Member

Thank you for contributing to the TypeScript native port!

Development has moved from this repository back to the main microsoft/TypeScript repository. GitHub does not have PR transfer functionality, so we're closing this PR here.

If this change is still relevant, please reopen it as a new pull request in microsoft/TypeScript. We'd appreciate your help carrying the contribution over, and we apologize for the extra work.

See microsoft/typescript-go#4918 for more information about the move.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Unmigrated PR This PR was open at the time of the repo move back to TypeScript

Projects

None yet

3 participants