Skip to content

Commit 8a10b6d

Browse files
committed
feat(core): replace SystemJS runner with transformed ESM runner
1 parent 2136bb4 commit 8a10b6d

20 files changed

Lines changed: 4204 additions & 912 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Build ESM runner transform
2+
description: Build the SWC WASM plugin used by the transformed ESM runner
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Install WASI target
8+
shell: bash
9+
run: rustup target add wasm32-wasip1
10+
11+
- name: Build WASM plugin
12+
shell: bash
13+
run: >-
14+
cargo build
15+
--manifest-path packages/core/swc-plugins/esm-runner-transform/Cargo.toml
16+
--locked
17+
--release
18+
--target wasm32-wasip1
19+
20+
- name: Copy WASM plugin
21+
shell: bash
22+
run: >-
23+
cp
24+
packages/core/swc-plugins/esm-runner-transform/target/wasm32-wasip1/release/rsbuild_swc_esm_runner_transform.wasm
25+
packages/core/static/swc-esm-runner-transform.wasm

.github/workflows/lint.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ jobs:
2929
node-version: 24.18.1
3030
package-manager-cache: false
3131

32+
- name: Build ESM runner transform
33+
uses: ./.github/actions/build-esm-runner-transform
34+
3235
- name: Install Pnpm
3336
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
3437
with:

.github/workflows/preview.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ jobs:
2525
fetch-depth: 1
2626
ref: ${{ github.event.inputs.branch }}
2727

28+
- name: Build ESM runner transform
29+
uses: ./.github/actions/build-esm-runner-transform
30+
2831
- name: Setup Node.js
2932
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
3033
with:

.github/workflows/release.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ jobs:
6868
fetch-depth: 1
6969
ref: ${{ github.event.inputs.branch }}
7070

71+
- name: Build ESM runner transform
72+
uses: ./.github/actions/build-esm-runner-transform
73+
7174
- name: Setup Node.js
7275
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
7376
with:

.github/workflows/test.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ jobs:
5151
node-version: 24.18.1
5252
package-manager-cache: false
5353

54+
- name: Build ESM runner transform
55+
if: steps.changes.outputs.changed == 'true'
56+
uses: ./.github/actions/build-esm-runner-transform
57+
5458
- name: Install Pnpm
5559
if: steps.changes.outputs.changed == 'true'
5660
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
@@ -99,6 +103,10 @@ jobs:
99103
node-version: 24.18.1
100104
package-manager-cache: false
101105

106+
- name: Build ESM runner transform
107+
if: steps.changes.outputs.changed == 'true'
108+
uses: ./.github/actions/build-esm-runner-transform
109+
102110
- name: Install Pnpm
103111
if: steps.changes.outputs.changed == 'true'
104112
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10

packages/core/src/server/runner/basic.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const getSubPath = (p: string) => {
3434

3535
export interface IBasicRunnerOptions {
3636
name: string;
37+
bundleFiles?: ReadonlyMap<string, string>;
3738
isBundleOutput: (modulePath: string) => boolean;
3839
readFileSync: (path: string) => string;
3940
dist: string;

packages/core/src/server/runner/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import { color, require } from '../../helpers';
55
import { CommonJsRunner } from './cjs';
66
import { EsmRunner } from './esm';
7-
import { SystemJsRunner } from './systemJs';
7+
import { TransformedEsmRunner } from './transformedEsm';
88
import type { Runner, RunnerFactory, RunnerFactoryOptions } from './type';
99

1010
class BasicRunnerFactory implements RunnerFactory {
@@ -42,7 +42,7 @@ class BasicRunnerFactory implements RunnerFactory {
4242
return new EsmRunner(runnerOptions);
4343
}
4444

45-
return new SystemJsRunner(runnerOptions);
45+
return new TransformedEsmRunner(runnerOptions);
4646
}
4747
}
4848

0 commit comments

Comments
 (0)