Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/core-wasm32-wasi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
swc_core: patch
---

feat(node): Publish `@swc/core-wasm32-wasi`, the wasi build of `@swc/core`
13 changes: 12 additions & 1 deletion .github/workflows/publish-npm-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,15 @@ jobs:
else
pnpm build --target aarch64-pc-windows-msvc
fi
- host: ubuntu-latest
target: wasm32-wasip1-threads
# `plugin` (wasmer) cannot run inside a wasm module. Only built for core.
build: |
if [[ ${{ inputs.package }} == "core" ]]; then
pnpm build --target wasm32-wasip1-threads --no-default-features --features swc_v1
else
echo "wasm32-wasip1-threads is only built for @swc/core; skipping"
fi
name: "Build ${{ inputs.package }} - ${{ matrix.settings.target }} - node@20"
runs-on: ${{ matrix.settings.host }}
steps:
Expand Down Expand Up @@ -419,7 +428,9 @@ jobs:
path: |
packages/${{ inputs.package }}/swc*
packages/${{ inputs.package }}/*.node
if-no-files-found: error
packages/${{ inputs.package }}/wasi-worker*
# wasm32-wasip1-threads is only built for core, so other packages have no files there.
if-no-files-found: ${{ matrix.settings.target == 'wasm32-wasip1-threads' && inputs.package != 'core' && 'ignore' || 'error' }}
test-macOS-windows-binding:
name: Test bindings on ${{ matrix.settings.target }} - node@${{ matrix.node }}
needs:
Expand Down
3 changes: 2 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
"aarch64-apple-darwin",
"aarch64-unknown-linux-gnu",
"aarch64-unknown-linux-musl",
"aarch64-pc-windows-msvc"
"aarch64-pc-windows-msvc",
"wasm32-wasip1-threads"
]
},
"publishConfig": {
Expand Down
3 changes: 3 additions & 0 deletions packages/core/scripts/npm/wasm32-wasi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# `@swc/core-wasm32-wasi`

This is the **wasm32-wasip1-threads** binary for `@swc/core`
47 changes: 47 additions & 0 deletions packages/core/scripts/npm/wasm32-wasi/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "@swc/core-wasm32-wasi",
"version": "1.15.46",
"cpu": [
"wasm32"
],
"main": "swc.wasi.cjs",
"browser": "swc.wasi-browser.js",
"files": [
"swc.wasm32-wasi.wasm",
"swc.wasi.cjs",
"swc.wasi-browser.js",
"wasi-worker.mjs",
"wasi-worker-browser.mjs"
],
"description": "Super-fast alternative for babel",
"keywords": [
"swc",
"swcpack",
"babel",
"typescript",
"rust",
"webpack",
"tsc"
],
"author": "강동윤 <kdy1997.dev@gmail.com>",
"homepage": "https://swc.rs",
"license": "Apache-2.0 AND MIT",
"engines": {
"node": "^20.19.0 || >=22.12.0"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public",
"provenance": true
},
"repository": {
"type": "git",
"url": "git+https://github.com/swc-project/swc.git"
},
"bugs": {
"url": "https://github.com/swc-project/swc/issues"
},
"dependencies": {
"@napi-rs/wasm-runtime": "^1.1.6"
}
Comment on lines +44 to +46

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Update the pnpm lockfile for the new workspace

Adding this package under packages/core/scripts/npm/* makes it a workspace importer, and it also introduces @napi-rs/wasm-runtime@^1.1.6, but pnpm-lock.yaml was not updated: the lockfile still lists the existing core npm subpackages and has no packages/core/scripts/npm/wasm32-wasi importer. The release workflow runs pnpm install --frozen-lockfile before building/publishing, so any release tag containing this new package.json will fail during install until the lockfile includes this workspace and dependency resolution.

Useful? React with 👍 / 👎.

}
Loading