Repository navigation
Expand file tree
/
Copy pathjustfile
More file actions
285 lines (214 loc) · 9.21 KB
/
Copy pathjustfile
File metadata and controls
285 lines (214 loc) · 9.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
set windows-shell := ["powershell"]
set shell := ["bash", "-cu"]
alias dt := t-run
alias ued := update-esbuild-diff
alias update-submodule := setup-submodule
_default:
just --list -u
setup:
just setup-vite-plus
vp install
cargo install cargo-binstall
cargo binstall cargo-insta cargo-deny cargo-shear@1.12.4 typos-cli -y
just setup-submodule
just setup-bench
@echo "✅✅✅ Setup complete!"
setup-submodule:
git submodule update --init
setup-bench:
node --import @oxc-node/core/register ./scripts/misc/setup-benchmark-input/index.js
[unix]
setup-vite-plus:
#!/bin/sh
if command -v vp >/dev/null 2>&1; then
echo "vp is already installed, skipping."
exit 0
fi
curl -fsSL https://vite.plus | bash
[windows]
setup-vite-plus:
#!powershell
if (Get-Command vp -ErrorAction SilentlyContinue) {
Write-Host "vp is already installed, skipping."
exit 0
}
irm https://viteplus.dev/install.ps1 | iex
# --- `roll` series commands will run all relevant commands in one go.
# Run all relevant commands.
roll: roll-rust roll-node roll-repo update-esbuild-diff
# Run all relevant commands for Rust.
roll-rust: test-rust lint-rust
# Run all relevant commands for Node.js.
roll-node: test-node lint-node
# Run all relevant commands for the repository.
roll-repo: lint-repo
update-esbuild-diff *args="":
vp run --filter=scripts esbuild-snap-diff {{ args }}
# --- `test` series commands aim to run tests and update snapshots automatically.
test: test-rust test-node update-generated-code
# Update snapshots both for Rust and Node.js tests.
test-update:
just test-rust # Rust tests will update snapshots automatically.
just test-node --update
# Update snapshots for Node.js tests.
test-update-node:
just test-node --update
# Run Rust tests.
test-rust:
cargo test --workspace --exclude rolldown_binding
# Run Node.js tests for Rolldown.
test-node-rolldown *args="": build-rolldown
just t-node-rolldown {{ args }}
# Run Node.js tests for Rolldown without building Rolldown.
# This command is still useful until we have advanced caching util.
test-node-rolldown-only *args="":
just t-node-rolldown {{ args }}
# Run Rollup's test suite to check Rolldown's behaviors.
test-node-rollup *args="": build-rolldown
just t-node-rollup {{ args }}
# Run both Rolldown's tests and Rollup's test suite.
test-node *args="": build-rolldown build-rolldown-test-dev-server
just test-node-rolldown {{ args }}
just test-node-rollup
# Run Rolldown's tests against the WASI binding, mirroring the WASI CI lane. Replaces any native `dist`, so run `just build-rolldown` afterwards.
test-wasi *args="": build-rolldown-wasi build-rolldown-test-dev-server
vp run --filter rolldown-tests test:wasi {{ args }}
test-node-hmr *args: build build-test-dev-server
just test-node-hmr-only {{ args }}
test-node-hmr-only *args:
vp run --filter @rolldown/test-dev-server-tests test {{ args }}
# Run Vite's test suite to check Rolldown's behaviors.
test-vite: # We don't use `test-node-vite` because it's not expected to run in `just test-node`.
vp run --filter vite-tests test
# Build the WASI artifacts and smoke test them inside a WebContainer. Opt-in only, needs network.
test-webcontainer:
vp run --filter browser-tests test:webcontainer
# Install the packed `rolldown` with no binding at all and check that its WebContainer fallback loads the packed WASI binding. Plain Node, no WebContainer.
test-webcontainer-fallback:
vp run --filter browser-tests test:webcontainer-fallback
# Build `@rolldown/browser` and smoke test the packed artifact inside a real browser page.
test-browser:
vp run --filter browser-tests test:browser
# --- `t` series commands provide scenario-specific shortcut commands for testing compared to `test` series commands.
# Run both Rolldown's tests and Rollup's test suite without building Rolldown.
t-node: t-node-rolldown t-node-rollup
# Run Rolldown's tests without building Rolldown.
t-node-rolldown *args="":
vp run --filter rolldown-tests test:main {{ args }}
vp run --filter rolldown-tests test:watcher {{ args }}
# Run Rollup's test suite without building Rolldown.
t-node-rollup *args="":
vp run --filter rollup-tests test {{ args }}
# Run specific rust test without enabling extended tests.
[unix]
t-run *args:
NEEDS_EXTENDED=false cargo run-fixture {{ args }}
[windows]
t-run *args:
$env:NEEDS_EXTENDED="false"; cargo run-fixture {{ args }}
# --- `fix` series commands aim to fix fixable issues.
# Fix formatting issues both for Rust, Node.js and all files in the repository
fix: fix-rust fix-node fix-repo
# Fix formatting, linting and code fixing issues for Rust files.
fix-rust:
cargo fmt --all -- --emit=files
-cargo shear --fix --check-test-targets # omit exit status with `-`
cargo fix --allow-dirty --allow-staged
# Fix linting issues for Node.js files.
fix-node:
vp lint --fix
# Fix formatting issues for all files except Rust files.
fix-repo:
vp fmt
# --- `lint` series commands aim to catch linting and type checking issues.
lint: lint-rust lint-node lint-repo
# Linting formatting, syntax and linting issues for Rust files.
lint-rust: clippy
cargo fmt --all --check
cargo check --workspace --all-features --all-targets --locked
# For the most of the time, code is automatically formatted on save in the editor.
# Also, clippy already cover compiler error.
clippy:
cargo clippy --workspace --all-targets -- --deny warnings
lint-node:
vp check
vp run lint-knip
vp run lint-publint
lint-repo:
typos # Check if the spelling is correct.
cargo ls-lint # Check if the file names are correct.
vp fmt # Check if files are formatted correctly.
# --- `build` series commands aim to provide a easy way to build the project.
# Build rolldown
build: build-rolldown
# Build `@rolldown/debug` located in `packages/debug`.
build-rolldown-debug:
vp run --filter "@rolldown/debug" build
# Only build `rolldown` located in `packages/rolldown` itself without triggering building binding `crates/rolldown_binding`.
build-glue:
vp run --filter rolldown build-js-glue
# Only build `.node` binding located in `packages/rolldown`.
build-rolldown-binding:
vp run --filter rolldown build-binding
# Build `rolldown` located in `packages/rolldown` itself and its `.node` binding.
build-rolldown:
vp run --filter rolldown build-native:debug
# Build `@rolldown/test-dev-server` itself.
build-rolldown-test-dev-server:
vp run --filter @rolldown/test-dev-server build
# Build `rolldown` located in `packages/rolldown` itself and its `.wasm` binding for WASI.
build-rolldown-wasi:
vp run --filter rolldown build-wasi:debug
# Build `rolldown` located in `packages/rolldown` itself and its `.node` binding in release mode.
build-rolldown-release:
vp run --filter rolldown build-native:release
# Same as `build-rolldown-release`, plus the tracking allocator, so benchmarks can record Rust-side memory usage. Costs ~1-2% build time.
build-rolldown-release-tracking:
vp run --filter rolldown build-binding:release --features tracking_allocator
vp run --filter rolldown build-js-glue
# Build `rolldown` located in `packages/rolldown` itself and its `.node` binding in profile mode.
build-rolldown-profile:
vp run --filter rolldown build-native:profile
build-rolldown-memory-profile:
vp run --filter rolldown build-native:memory-profile
# Build `@rolldown/browser` located in `packages/browser` itself and its `.wasm` binding.
build-browser:
vp run --filter "@rolldown/browser" build:debug
# Build `@rolldown/browser` located in `packages/browser` itself and its `.wasm` binding in release mode.
build-browser-release:
vp run --filter "@rolldown/browser" build:release
# Build `@rolldown/test-dev-server` located in `packages/test-dev-server`.
build-test-dev-server:
vp run --filter @rolldown/test-dev-server build
# Set up the Vite checkout at `vite/` (clone vitejs/vite rolldown-canary
# rebased onto main, link the workspace rolldown into it, install + build
# vite). It backs the `@rolldown/test-dev-server` browser tests, and
# `packages/vite-tests` clones the same checkout. Requires
# `just build-rolldown` first.
setup-vite:
vp run --filter @rolldown-internal/scripts setup-vite
# --- `bench` series commands aim to provide a easy way to run benchmarks.
bench-rust:
cargo bench -p bench
bench-node:
vp --filter bench run bench
bench-node-par:
vp --filter bench exec node ./benches/par.js
# --- Misc
bump-packages *args:
node --import @oxc-node/core/register ./scripts/misc/bump-version.js {{ args }}
# Regenerate auto-generated code files from templates (must run after core changes).
# This generates:
# - Runtime helper definitions (crates/rolldown_common/src/generated/runtime_helper.rs)
# - Check options (crates/rolldown_common/src/generated/checks_options.rs + TypeScript equivalents)
# - Hook usage tracking (crates/rolldown_plugin/src/generated/hook_usage.rs + TypeScript equivalent)
# - Event kind switching logic (crates/rolldown_error/src/generated/event_kind_switcher.rs)
update-generated-code:
cargo run --bin generator
# Update the allocation-count snapshot (tasks/track_memory_allocations/allocs.snap).
# Run after changes to `rolldown_sourcemap` if the allocs CI gate fails.
allocs:
cargo allocs
# Run the `rolldown` cli using node.
run *args:
./node_modules/.bin/rolldown {{ args }}