fix(es/resolver): Merge re-opened TypeScript namespace scopes #22140
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| merge_group: | |
| pull_request: | |
| types: ["opened", "reopened", "synchronize"] | |
| push: | |
| branches: | |
| - main | |
| env: | |
| CI: 1 | |
| # Avoid transient HTTP/2 stream resets when the cargo-test matrix fetches the | |
| # sparse registry index from many GitHub-hosted runners at once. | |
| CARGO_HTTP_MULTIPLEXING: "false" | |
| CARGO_INCREMENTAL: 0 | |
| CARGO_NET_RETRY: 10 | |
| CARGO_TERM_COLOR: "always" | |
| DIFF: 0 | |
| # For faster CI | |
| RUST_LOG: "off" | |
| permissions: {} | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: "${{ github.event_name == 'pull_request' }}" | |
| jobs: | |
| cargo-fmt: | |
| name: Cargo fmt | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| env: | |
| RUST_LOG: "0" | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| with: | |
| persist-credentials: false | |
| # We explicitly do this to cache properly. | |
| - uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4 # stable | |
| with: | |
| toolchain: nightly-2026-04-10 | |
| components: rustfmt | |
| - run: cargo fmt --all -- --check | |
| helper-codegen: | |
| name: Helper codegen | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| with: | |
| persist-credentials: false | |
| - uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4 # stable | |
| with: | |
| toolchain: nightly-2026-04-10 | |
| components: rustfmt | |
| - run: cargo codegen helpers --check | |
| cargo-clippy: | |
| name: Cargo clippy | |
| if: >- | |
| ${{ !contains(github.event.head_commit.message, 'chore: ') }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| with: | |
| persist-credentials: false | |
| submodules: true | |
| - uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4 # stable | |
| with: | |
| toolchain: nightly-2026-04-10 | |
| components: clippy | |
| - run: cargo clippy --all --all-targets -- -D warnings | |
| cargo-deny: | |
| name: Check license of dependencies | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| if: >- | |
| ${{ !contains(github.event.head_commit.message, 'chore: ') }} | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| with: | |
| persist-credentials: false | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4 # stable | |
| - name: Install cargo-deny | |
| uses: taiki-e/install-action@3235f8901fd37ffed0052b276cec25a362fb82e9 # v2.77.7 | |
| with: | |
| tool: cargo-deny@0.18.9 | |
| - name: Check licenses | |
| run: | | |
| cargo deny check | |
| cargo-shear: | |
| name: Cargo shear | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| with: | |
| persist-credentials: false | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4 # stable | |
| - name: Install cargo-shear | |
| uses: taiki-e/install-action@3235f8901fd37ffed0052b276cec25a362fb82e9 # v2.77.7 | |
| with: | |
| tool: cargo-shear@1.3.3 | |
| - name: cargo-shear | |
| run: cargo shear --fix | |
| cargo-check: | |
| name: Check | |
| runs-on: ${{ matrix.os }} | |
| permissions: | |
| contents: read | |
| if: >- | |
| ${{ !contains(github.event.head_commit.message, 'chore: ') }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - ubuntu-latest | |
| - macos-latest | |
| - windows-latest | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| with: | |
| persist-credentials: false | |
| submodules: true | |
| # We explicitly do this to cache properly. | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4 # stable | |
| # MSRV is current stable for ES crates and nightly for other languages. | |
| - uses: ./.github/actions/setup-node | |
| with: | |
| node-version: "20" | |
| # Ensure that all components are compilable. | |
| - name: Run cargo check for all targets | |
| run: cargo check --all --all-targets | |
| test-wasm: | |
| name: Test wasm | |
| if: >- | |
| ${{ !contains(github.event.head_commit.message, 'chore: ') }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| pkg: | |
| - binding_core_wasm | |
| - binding_minifier_wasm | |
| - binding_typescript_wasm | |
| - binding_nodejs_support_wasm | |
| - binding_es_ast_viewer | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| with: | |
| persist-credentials: false | |
| # We explicitly do this to cache properly. | |
| - uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4 # stable | |
| - name: Install wasm-pack | |
| run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh | |
| - uses: ./.github/actions/setup-node | |
| with: | |
| node-version: "20" | |
| - name: Test | |
| run: | | |
| (cd bindings/${{ matrix.pkg }} && ./scripts/test.sh) | |
| list-cargo-tests: | |
| if: >- | |
| ${{ !contains(github.event.head_commit.message, 'chore: ') }} | |
| name: List crates | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| outputs: | |
| settings: ${{ steps.list-tests.outputs.settings }} | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| with: | |
| persist-credentials: false | |
| fetch-depth: 0 | |
| - uses: ./.github/actions/setup-node | |
| - name: Install cargo-mono | |
| uses: taiki-e/install-action@3235f8901fd37ffed0052b276cec25a362fb82e9 # v2.77.7 | |
| with: | |
| tool: cargo-mono@0.6.9 | |
| - name: List crates | |
| id: list-tests | |
| run: echo "settings=$(npx zx ./scripts/github/get-test-matrix.mjs)" >> $GITHUB_OUTPUT | |
| cargo-test: | |
| name: Test - ${{ matrix.settings.crate }} - ${{ matrix.settings.os }} | |
| runs-on: ${{ matrix.settings.os }} | |
| permissions: | |
| contents: read | |
| needs: | |
| - list-cargo-tests | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| settings: ${{fromJson(needs.list-cargo-tests.outputs.settings)}} | |
| steps: | |
| - name: No-op when no changed crates | |
| if: matrix.settings.crate == '__noop__' | |
| run: | | |
| echo "No affected crates detected. Skipping cargo-test matrix run." | |
| - name: Handle line endings | |
| shell: bash | |
| if: runner.os == 'Windows' && matrix.settings.crate != '__noop__' | |
| run: | | |
| git config --system core.autocrlf false | |
| git config --system core.eol lf | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| if: matrix.settings.crate != '__noop__' | |
| with: | |
| persist-credentials: false | |
| submodules: true | |
| # Source map format | |
| - uses: ./.github/actions/setup-node | |
| id: setup-node | |
| if: matrix.settings.crate != '__noop__' | |
| with: | |
| node-version: "20" | |
| install-dependencies: "false" | |
| # We explicitly do this to cache properly. | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4 # stable | |
| if: matrix.settings.crate != '__noop__' | |
| with: | |
| toolchain: nightly-2026-04-10 | |
| target: wasm32-wasip1 | |
| components: rustfmt | |
| - uses: denoland/setup-deno@11b63cf76cfcafb4e43f97b6cad24d8e8438f62d # v1.5.2 | |
| if: matrix.settings.crate != '__noop__' && matrix.settings.crate == 'swc_bundler' | |
| with: | |
| deno-version: v1.x | |
| - name: Install node dependencies | |
| if: matrix.settings.crate != '__noop__' | |
| shell: bash | |
| run: | | |
| corepack enable | |
| pnpm install --frozen-lockfile | |
| # I don't want to think deeply about this | |
| npm install -g jest@27 mocha || \ | |
| npm install -g jest@27 mocha || \ | |
| npm install -g jest@27 mocha || true | |
| - name: Save pnpm cache | |
| uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| if: github.ref == 'refs/heads/main' && matrix.settings.crate != '__noop__' && steps.setup-node.outputs.pnpm-cache-hit != 'true' | |
| with: | |
| path: ${{ steps.setup-node.outputs.pnpm-store-path }} | |
| key: ${{ steps.setup-node.outputs.pnpm-cache-primary-key }} | |
| - name: Configure path (windows) | |
| shell: bash | |
| if: runner.os == 'Windows' && matrix.settings.crate != '__noop__' | |
| run: | | |
| echo "$(npm prefix -g)" >> $GITHUB_PATH | |
| - name: Verify dependencies | |
| if: matrix.settings.crate != '__noop__' | |
| shell: bash | |
| run: | | |
| jest --version && mocha --version | |
| - name: Configure execution cache | |
| if: matrix.settings.crate != '__noop__' | |
| shell: bash | |
| run: | | |
| mkdir -p .swc-exec-cache | |
| echo "SWC_ECMA_TESTING_CACHE_DIR=$(pwd)/.swc-exec-cache" >> $GITHUB_ENV | |
| - name: Restore execution cache | |
| id: restore-execution-cache | |
| uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| if: matrix.settings.crate != '__noop__' && (matrix.settings.crate == 'swc' || startsWith(matrix.settings.crate, 'swc_ecma_transforms_')) | |
| with: | |
| path: | | |
| .swc-exec-cache | |
| key: swc-exec-cache-${{ matrix.settings.crate }}-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Run cargo test | |
| if: matrix.settings.crate != '__noop__' && matrix.settings.crate != 'swc_plugin_backend_tests' && matrix.settings.crate != 'swc_ecma_parser' && matrix.settings.crate != 'swc_ecma_minifier' && matrix.settings.crate != 'swc_core' && matrix.settings.crate != 'swc_ecma_quote' && matrix.settings.crate != 'swc_cli' && matrix.settings.crate != 'binding_core_wasm' && matrix.settings.crate != 'hstr' | |
| run: | | |
| cargo test -p ${{ matrix.settings.crate }} | |
| - name: Run cargo test (core) | |
| if: matrix.settings.crate == 'swc_core' | |
| run: | | |
| rustup target add wasm32-unknown-unknown | |
| cargo test -p swc_core --features ecma_quote --features common --features ecma_utils | |
| - name: Run cargo test (binding_core_wasm) | |
| if: matrix.settings.crate == 'binding_core_wasm' | |
| run: | | |
| cargo test --manifest-path ./bindings/binding_core_wasm/Cargo.toml | |
| - name: Run cargo test (cli) | |
| if: matrix.settings.crate == 'swc_cli' | |
| run: | | |
| cargo test --manifest-path ./bindings/swc_cli/Cargo.toml --features plugin | |
| - name: Run cargo test (plugin) | |
| if: matrix.settings.crate == 'swc_plugin_backend_tests' | |
| run: | | |
| # export CARGO_TARGET_DIR=$(pwd)/target | |
| cargo test -p swc_plugin_backend_tests --release | |
| - name: Run cargo test (hstr) | |
| if: matrix.settings.crate == 'hstr' | |
| run: | | |
| cargo test -p hstr --features serde | |
| - name: Run cargo test (swc_ecma_minifier) | |
| if: matrix.settings.crate == 'swc_ecma_minifier' | |
| run: | | |
| cargo test -p swc_ecma_minifier --features concurrent --features par-core/chili | |
| - name: Run cargo test (swc_ecma_parser) | |
| if: matrix.settings.crate == 'swc_ecma_parser' | |
| run: | | |
| cargo test -p swc_ecma_parser --features verify | |
| - name: Run cargo test (all features) | |
| if: matrix.settings.crate == 'swc_ecma_parser' || matrix.settings.crate == 'swc_ecma_loader' | |
| run: | | |
| cargo test -p ${{ matrix.settings.crate }} --all-features | |
| - name: Run cargo test (transforms with stacker) | |
| if: matrix.settings.crate == 'swc_ecma_transforms' | |
| run: | | |
| cargo test -p ${{ matrix.settings.crate }} --all-features --features swc_ecma_utils/stacker | |
| - name: Run cargo test (concurrent) | |
| if: runner.os == 'Linux' && matrix.settings.crate != '__noop__' && matrix.settings.crate != 'swc_ecma_minifier' | |
| shell: bash | |
| run: | | |
| ./scripts/github/test-concurrent.sh ${{ matrix.settings.crate }} | |
| - name: Install cargo-hack | |
| uses: taiki-e/install-action@3235f8901fd37ffed0052b276cec25a362fb82e9 # v2.77.7 | |
| if: matrix.settings.os == 'ubuntu-latest' && matrix.settings.crate != '__noop__' | |
| with: | |
| tool: cargo-hack@0.5.29 | |
| - name: Check compilation | |
| if: matrix.settings.os == 'ubuntu-latest' && matrix.settings.crate != '__noop__' | |
| run: | | |
| ./scripts/github/run-cargo-hack.sh ${{ matrix.settings.crate }} | |
| - name: Check unknown variant with transforms | |
| if: matrix.settings.crate == 'swc_ecma_transforms' | |
| run: | | |
| env RUSTFLAGS="--cfg swc_ast_unknown" cargo check -p ${{ matrix.settings.crate }} --features typescript,react,proposal,optimization,module,compat | |
| - name: Save execution cache | |
| uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| if: github.ref == 'refs/heads/main' && matrix.settings.crate != '__noop__' && (matrix.settings.crate == 'swc' || startsWith(matrix.settings.crate, 'swc_ecma_transforms_')) && steps.restore-execution-cache.outputs.cache-hit != 'true' | |
| with: | |
| path: | | |
| .swc-exec-cache | |
| key: ${{ steps.restore-execution-cache.outputs.cache-primary-key }} | |
| node-test: | |
| name: Test node bindings - ${{ matrix.os }} | |
| if: >- | |
| ${{ !contains(github.event.head_commit.message, 'chore: ') }} | |
| runs-on: ${{ matrix.os }} | |
| permissions: | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| # - ubuntu-latest | |
| - windows-latest | |
| - macos-latest | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| with: | |
| persist-credentials: false | |
| # We explicitly do this to cache properly. | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4 # stable | |
| - uses: ./.github/actions/setup-node | |
| id: setup-node | |
| with: | |
| node-version: 18 | |
| install-dependencies: "false" | |
| - name: Set platform name | |
| run: | | |
| export NODE_PLATFORM_NAME=$(node -e "console.log(require('os').platform())") | |
| echo "PLATFORM_NAME=$NODE_PLATFORM_NAME" >> $GITHUB_ENV | |
| shell: bash | |
| - name: Install wasm-pack | |
| run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh | |
| - name: Prepare | |
| run: | | |
| rustup target add wasm32-wasip1 | |
| corepack enable | |
| pnpm install --frozen-lockfile | |
| - name: Save pnpm cache | |
| uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| if: github.ref == 'refs/heads/main' && steps.setup-node.outputs.pnpm-cache-hit != 'true' | |
| with: | |
| path: ${{ steps.setup-node.outputs.pnpm-store-path }} | |
| key: ${{ steps.setup-node.outputs.pnpm-cache-primary-key }} | |
| - name: Build | |
| working-directory: packages/core | |
| run: | | |
| pnpm build:dev | |
| - name: Test | |
| working-directory: packages/core | |
| run: | | |
| pnpm test | |
| react-compiler-test: | |
| name: Test react-compiler bindings - ${{ matrix.os }} | |
| if: >- | |
| ${{ !contains(github.event.head_commit.message, 'chore: ') }} | |
| runs-on: ${{ matrix.os }} | |
| permissions: | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| # - ubuntu-latest | |
| - windows-latest | |
| - macos-latest | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| with: | |
| persist-credentials: false | |
| # We explicitly do this to cache properly. | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4 # stable | |
| - uses: ./.github/actions/setup-node | |
| id: setup-node | |
| with: | |
| node-version: 18 | |
| install-dependencies: "false" | |
| - name: Prepare | |
| run: | | |
| corepack enable | |
| pnpm install --frozen-lockfile | |
| - name: Save pnpm cache | |
| uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| if: github.ref == 'refs/heads/main' && steps.setup-node.outputs.pnpm-cache-hit != 'true' | |
| with: | |
| path: ${{ steps.setup-node.outputs.pnpm-store-path }} | |
| key: ${{ steps.setup-node.outputs.pnpm-cache-primary-key }} | |
| - name: Build | |
| working-directory: packages/react-compiler | |
| run: | | |
| pnpm build:dev | |
| - name: Test | |
| working-directory: packages/react-compiler | |
| run: | | |
| pnpm test | |
| integration-test: | |
| name: "Test with @swc/cli" | |
| if: >- | |
| ${{ !contains(github.event.head_commit.message, 'chore: ') }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| with: | |
| persist-credentials: false | |
| - uses: ./.github/actions/setup-node | |
| id: setup-node | |
| with: | |
| node-version: 20 | |
| install-dependencies: "false" | |
| - name: Set platform name | |
| run: | | |
| export NODE_PLATFORM_NAME=$(node -e "console.log(require('os').platform())") | |
| echo "PLATFORM_NAME=$NODE_PLATFORM_NAME" >> $GITHUB_ENV | |
| shell: bash | |
| - name: Install wasm-pack | |
| run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh | |
| - name: Prepare | |
| run: | | |
| rustup target add wasm32-wasip1 | |
| corepack enable | |
| pnpm install --frozen-lockfile | |
| pnpm build:dev | |
| # Avoid no space left on device, copyfile | |
| cargo clean | |
| (cd ./bindings && cargo clean) | |
| npm install -g @swc/cli@0.1.56 | |
| npm link | |
| npm install -g file:$PWD | |
| - name: Save pnpm cache | |
| uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| if: github.ref == 'refs/heads/main' && steps.setup-node.outputs.pnpm-cache-hit != 'true' | |
| with: | |
| path: ${{ steps.setup-node.outputs.pnpm-store-path }} | |
| key: ${{ steps.setup-node.outputs.pnpm-cache-primary-key }} | |
| - name: Print info | |
| run: | | |
| npm list -g | |
| - name: (swc) three.js | |
| run: | | |
| # mkdir -p tests/integration/three-js | |
| # npm install -g qunit failonlyreporter | |
| # Download three.js | |
| # git clone --depth 1 https://github.com/mrdoob/three.js.git -b r117 tests/integration/three-js/repo | |
| # TODO | |
| # swc -C isModule=unknown -C test=\".*.js$\" -C module.type=commonjs --sync tests/integration/three-js/repo/ -d tests/integration/three-js/build/ | |
| # TODO | |
| # (cd tests/integration/three-js/build/test && qunit -r failonlyreporter unit/three.source.unit.js) | |
| # terser: contains with statement in test | |
| # Rome.js: I forgot the cause, but it didn't work. | |
| # jQuery: browser only (window.document is required) | |
| - name: (swc) redux | |
| run: | | |
| # mkdir -p tests/integration/redux | |
| # npm install -g qunit failonlyreporter | |
| # Download | |
| # git clone --depth 1 https://github.com/reduxjs/redux.git -b v4.1.0 tests/integration/redux/repo | |
| # TODO | |
| # swc --sync tests/integration/redux/repo/src/ -d tests/integration/redux/repo/lib/ | |
| # echo "module.exports=require('./index')" > tests/integration/redux/repo/lib/redux.js | |
| # TODO | |
| # swc --sync tests/integration/redux/repo/src/ -d tests/integration/redux/repo/test/ | |
| # TODO | |
| # swc --sync tests/integration/redux/repo/test/ -d tests/integration/redux/repo/test/ | |
| # TODO | |
| # (cd tests/integration/redux/repo && pnpm install) | |
| # TODO | |
| # (cd tests/integration/redux/repo && npx jest '.*.js' --modulePathIgnorePatterns 'typescript') | |
| - name: (swcpack) example react app | |
| run: | | |
| export NODE_OPTIONS="--unhandled-rejections=warn" | |
| (cd crates/swc_node_bundler/tests/integration/react && npm install && npx spack) | |
| done: | |
| needs: | |
| - cargo-fmt | |
| - cargo-clippy | |
| - cargo-deny | |
| - cargo-shear | |
| - cargo-check | |
| - test-wasm | |
| - cargo-test | |
| - node-test | |
| - integration-test | |
| if: >- | |
| ${{ always() && !contains(github.event.head_commit.message, 'chore: ') }} | |
| runs-on: ubuntu-latest | |
| name: Done | |
| steps: | |
| - run: exit 1 | |
| if: ${{ always() && (contains(needs.*.result, 'failure') || contains(needs.*.result, 'skipped') || contains(needs.*.result, 'cancelled')) }} |