mirror of
https://github.com/hanzoai/swc.git
synced 2026-10-30 19:42:53 +00:00
**Description:** Adds an independent Rust/WebAssembly binding at `bindings/binding_nodejs_support_wasm`, published as `@swc/nodejs-support-wasm`. The package has its own Rust crate, sources, build scripts, tests, README, Cargo entry, and npm workspace entry. It does not build from `binding_typescript_wasm` and does not add features or exports to the existing `@swc/wasm-typescript` or `@swc/wasm-typescript-esm` packages. The new CommonJS package embeds its wasm binary and exposes these APIs at the top level: - `transform` - `transformSync` - `transformModuleSyntax` - `getFirstExpression` - `isValidSyntax` - `isRecoverableError` It also exports the related `Options`, `TransformOutput`, and `ModuleSyntaxTransformOutput` TypeScript types. The npm publish matrix, wasm CI matrix, release versioning, Cargo lockfile, and pnpm lockfile now reference the standalone `binding_nodejs_support_wasm` crate. Validation performed: - `git submodule update --init --recursive` - `cargo fmt --all -- --check` - `cargo test -p binding_typescript_wasm -p binding_nodejs_support_wasm` - `cargo clippy --all --all-targets -- -D warnings` - `(cd bindings/binding_nodejs_support_wasm && ./scripts/test.sh)` - `(cd bindings/binding_typescript_wasm && ./scripts/test.sh)` - `(cd bindings/binding_core_wasm && ./scripts/test.sh)` - `(cd bindings/binding_minifier_wasm && ./scripts/test.sh)` - `(cd bindings/binding_es_ast_viewer && ./scripts/test.sh)` - `(cd bindings/binding_nodejs_support_wasm/pkg && npm pack --dry-run --json)` - `pnpm install --frozen-lockfile --ignore-scripts` - `go run github.com/rhysd/actionlint/cmd/actionlint@latest .github/workflows/CI.yml .github/workflows/publish-npm-package.yml` **BREAKING CHANGE:** None. The existing TypeScript wasm packages and their public APIs are unchanged. **Related issue (if exists):** - Supports nodejs/node#64034 - Follow-up context from swc-project/swc#11973
38 lines
1.3 KiB
Bash
Executable File
38 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -eu
|
|
|
|
|
|
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
|
|
git pull || true
|
|
pnpm install
|
|
|
|
version="$1"
|
|
swc_core_version="$(cargo tree -i -p swc_core --depth 0 | awk '{print $2}')"
|
|
|
|
echo "Publishing $version with swc_core $swc_core_version"
|
|
|
|
# Update version
|
|
(cd ./packages/core && npm version "$version" --no-git-tag-version --allow-same-version || true)
|
|
(cd ./packages/html && npm version "$version" --no-git-tag-version --allow-same-version || true)
|
|
(cd ./packages/minifier && npm version "$version" --no-git-tag-version --allow-same-version || true)
|
|
(cd ./packages/react-compiler && npm version "$version" --no-git-tag-version --allow-same-version || true)
|
|
cargo set-version $version -p binding_core_wasm -p binding_minifier_wasm -p binding_typescript_wasm -p binding_nodejs_support_wasm -p binding_html_wasm -p binding_es_ast_viewer
|
|
cargo set-version --bump patch -p swc_cli
|
|
|
|
|
|
# Commmit and tag
|
|
git add -A
|
|
git commit -am "chore: Publish \`$version\` with \`swc_core\` \`$swc_core_version\`"
|
|
git tag -a -m "swc_core $swc_core_version" "v$version"
|
|
|
|
|
|
# Update changelog
|
|
pnpm changelog
|
|
git add -A || true
|
|
git commit -m 'chore: Update changelog' || true
|
|
|
|
# Publish packages
|
|
git push [email protected]:swc-project/swc.git
|
|
git push [email protected]:swc-project/swc.git --tags
|