Skip to content

Commit 5c1d20f

Browse files
authored
Merge branch 'main' into feat/embed-release-version
2 parents 787cb19 + 9b57c4b commit 5c1d20f

File tree

793 files changed

+25644
-9325
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

793 files changed

+25644
-9325
lines changed

.cargo/config.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,17 @@ WORKSPACE_DIR = { value = "rolldown", relative = true }
44

55
[build]
66
rustflags = ["--cfg", "tokio_unstable"] # also update .github/workflows/ci.yml
7+
78
# fix sqlite build error on linux
89
[target.'cfg(target_os = "linux")']
910
rustflags = ["--cfg", "tokio_unstable", "-C", "link-args=-Wl,--warn-unresolved-symbols"]
1011

12+
# Increase stack size on Windows to avoid stack overflow
13+
[target.'cfg(all(windows, target_env = "msvc"))']
14+
rustflags = ["--cfg", "tokio_unstable", "-C", "link-arg=/STACK:8388608"]
15+
[target.'cfg(all(windows, target_env = "gnu"))']
16+
rustflags = ["--cfg", "tokio_unstable", "-C", "link-arg=-Wl,--stack,8388608"]
17+
1118
[unstable]
1219
bindeps = true
1320

.claude/skills/add-ecosystem-ci/SKILL.md

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ gh api repos/OWNER/REPO/commits/BRANCH --jq '.sha'
2525

2626
Fetch the repository's root to check if the main package.json is in a subdirectory (like `web/`, `app/`, `frontend/`).
2727

28-
### 2.2 Auto-detect Commands from GitHub Workflows
28+
### 2.2 Check if Project Already Uses Vite-Plus
29+
30+
Check the project's root `package.json` for `vite-plus` in `dependencies` or `devDependencies`. If the project already uses vite-plus, set `forceFreshMigration: true` in `repo.json`. This tells `patch-project.ts` to set `VITE_PLUS_FORCE_MIGRATE=1` so `vp migrate` forces full dependency rewriting instead of skipping with "already using Vite+".
31+
32+
### 2.3 Auto-detect Commands from GitHub Workflows
2933

3034
Fetch the project's GitHub workflow files to detect available commands:
3135

@@ -43,7 +47,7 @@ Look for common patterns in workflow files:
4347
- Commands like: `lint`, `build`, `test`, `type-check`, `typecheck`, `format`, `format:check`
4448
- Map detected commands to `vp` equivalents: `vp run lint`, `vp run build`, etc.
4549

46-
### 2.3 Ask User to Confirm
50+
### 2.4 Ask User to Confirm
4751

4852
Present the auto-detected configuration and ask user to confirm or modify:
4953

@@ -62,7 +66,8 @@ Present the auto-detected configuration and ask user to confirm or modify:
6266
"repository": "https://github.com/owner/repo.git",
6367
"branch": "main",
6468
"hash": "full-commit-sha",
65-
"directory": "web" // only if subdirectory is needed
69+
"directory": "web", // only if subdirectory is needed
70+
"forceFreshMigration": true // only if project already uses vite-plus
6671
}
6772
}
6873
```
@@ -79,12 +84,42 @@ Present the auto-detected configuration and ask user to confirm or modify:
7984
8085
## Step 4: Verify
8186
82-
Test the clone locally:
87+
### 4.1 Build fresh tgz packages
88+
89+
Always rebuild tgz packages from latest source to avoid using stale cached versions:
90+
91+
```bash
92+
# Rebuild the global CLI first (includes Rust binary + NAPI binding)
93+
pnpm bootstrap-cli
94+
95+
# Pack fresh tgz files into tmp/tgz/
96+
rm -rf tmp/tgz && mkdir -p tmp/tgz
97+
cd packages/core && pnpm pack --pack-destination ../../tmp/tgz && cd ../..
98+
cd packages/test && pnpm pack --pack-destination ../../tmp/tgz && cd ../..
99+
cd packages/cli && pnpm pack --pack-destination ../../tmp/tgz && cd ../..
100+
ls -la tmp/tgz
101+
```
102+
103+
### 4.2 Clone and test locally
83104

84105
```bash
85106
node ecosystem-ci/clone.ts project-name
86107
```
87108

109+
### 4.3 Patch and run commands
110+
111+
```bash
112+
# Run from the ecosystem-ci temp directory
113+
cd $(node -e "const os=require('os'); console.log(os.tmpdir() + '/vite-plus-ecosystem-ci')")
114+
115+
# Migrate the project (uses tgz files from tmp/tgz/)
116+
node /path/to/vite-plus/ecosystem-ci/patch-project.ts project-name
117+
118+
# Run the configured commands
119+
cd project-name
120+
vp run build
121+
```
122+
88123
3. **Add OS exclusion to `.github/workflows/e2e-test.yml`** (if not running on both):
89124

90125
For ubuntu-only:
@@ -110,4 +145,5 @@ node ecosystem-ci/clone.ts project-name
110145
- The `directory` field is optional - only add it if the package.json is not in the project root
111146
- If `directory` is specified in repo.json, it must also be specified in the workflow matrix
112147
- `patch-project.ts` automatically handles running `vp migrate` in the correct directory
148+
- `forceFreshMigration` is required for projects that already have `vite-plus` in their package.json — it sets `VITE_PLUS_FORCE_MIGRATE=1` so `vp migrate` forces full dependency rewriting instead of skipping
113149
- OS exclusions are added to the existing `exclude` section in the workflow matrix
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
---
2+
name: bump-vite-task
3+
description: Bump vite-task git dependency to the latest main commit. Use when you need to update the vite-task crates (fspy, vite_glob, vite_path, vite_str, vite_task, vite_workspace) in vite-plus.
4+
allowed-tools: Read, Grep, Glob, Edit, Bash, Agent, WebFetch
5+
---
6+
7+
# Bump vite-task to Latest Main
8+
9+
Update the vite-task git dependency in `Cargo.toml` to the latest commit on the vite-task main branch, fix any breaking changes, and create a PR.
10+
11+
## Steps
12+
13+
### 1. Get current and target commits
14+
15+
- Read `Cargo.toml` and find the current `rev = "..."` for any vite-task git dependency (e.g., `vite_task`, `vite_path`, `fspy`, `vite_glob`, `vite_str`, `vite_workspace`). They all share the same revision.
16+
- Get the latest commit hash on vite-task's main branch:
17+
```bash
18+
git ls-remote https://github.com/voidzero-dev/vite-task.git refs/heads/main
19+
```
20+
21+
### 2. Update Cargo.toml
22+
23+
- Replace **all** occurrences of the old commit hash with the new one in `Cargo.toml`. There are 6 crate entries that reference the same vite-task revision: `fspy`, `vite_glob`, `vite_path`, `vite_str`, `vite_task`, `vite_workspace`.
24+
25+
### 3. Ensure upstream dependencies are cloned
26+
27+
- `cargo check` requires the `./rolldown` and `./vite` directories to exist (many workspace path dependencies point to `./rolldown/crates/...`).
28+
- Locally, clone them using the commit hashes from `packages/tools/.upstream-versions.json`.
29+
- CI handles this automatically via the `.github/actions/clone` action.
30+
31+
### 4. Verify compilation
32+
33+
- Run `cargo check` to ensure the new vite-task compiles without errors.
34+
- If there are compilation errors, these are **breaking changes** from vite-task. Fix them in the vite-plus codebase (the consuming side), not in vite-task.
35+
- Common breaking changes include: renamed functions/methods, changed function signatures, new required fields in structs, removed public APIs.
36+
37+
### 5. Run tests
38+
39+
- Run `cargo test -p vite_command -p vite_error -p vite_install -p vite_js_runtime -p vite_migration -p vite_shared -p vite_static_config -p vite-plus-cli -p vite_global_cli` to run the vite-plus crate tests.
40+
- Note: Some tests require network access (e.g., `vite_install::package_manager` tests, `vite_global_cli::commands::env` tests). These may fail in sandboxed environments. Verify they also fail on the main branch before dismissing them.
41+
- Note: `cargo test -p vite_task` will NOT work because vite_task is a git dependency, not a workspace member.
42+
43+
### 6. Update snap tests
44+
45+
vite-task changes often affect CLI output, which means snap tests need updating. Common output changes:
46+
47+
- **Status icons**: e.g., cache hit/miss indicators may change
48+
- **New CLI options**: e.g., new flags added to `vp run` that show up in help output
49+
- **Cache behavior messages**: e.g., new summary lines about cache status
50+
- **Task output formatting**: e.g., step numbering, separator lines
51+
52+
To update snap tests:
53+
54+
1. Push your changes and let CI run the snap tests.
55+
2. CI will show the diff in the E2E test logs if snap tests fail.
56+
3. Extract the diff from CI logs and apply it locally.
57+
4. Check all three platforms (Linux, Mac, Windows) since they may have slightly different snap test coverage.
58+
5. Watch for trailing newline issues - ensure snap files end consistently.
59+
60+
Snap test files are at `packages/cli/snap-tests/*/snap.txt` and `packages/cli/snap-tests-global/*/snap.txt`.
61+
62+
### 7. Review changelog and update docs
63+
64+
- Fetch the vite-task `CHANGELOG.md` diff between old and new commits to see what changed:
65+
```
66+
https://raw.githubusercontent.com/voidzero-dev/vite-task/<new-hash>/CHANGELOG.md
67+
```
68+
- Review each changelog entry and determine if it affects user-facing behavior: new CLI options, changed defaults, new config fields, removed features, etc.
69+
- The changelog contains links to the corresponding vite-task PRs. For complex changes, check the PR description and code diff (especially any docs changes in the PR) to understand the full scope of the change.
70+
- If user-facing changes are found, update the relevant docs in `docs/` (e.g., `docs/guide/`, `docs/config/`).
71+
- Common doc updates include:
72+
- **New CLI flags/options**: Update the relevant config doc (e.g., `docs/config/run.md`, `docs/config/build.md`)
73+
- **New features or commands**: Add or update the relevant guide page (e.g., `docs/guide/cache.md`)
74+
- **Changed defaults or behavior**: Update any docs that describe the old behavior
75+
- **Removed/deprecated options**: Remove or mark as deprecated in the relevant docs
76+
- If no user-facing changes are found, skip this step.
77+
78+
### 8. Create the PR
79+
80+
- Commit message: `chore: bump vite-task to <short-hash>`
81+
- PR title: `chore: bump vite-task to <short-hash>`
82+
- PR body: Link to vite-task CHANGELOG.md diff between old and new commits:
83+
```
84+
https://github.com/voidzero-dev/vite-task/compare/<old-hash>...<new-hash>#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4ed
85+
```
86+
87+
### 9. Verify CI
88+
89+
Wait for CI and ensure the `done` check passes. Key checks to monitor:
90+
91+
- **Lint**: Clippy and format checks
92+
- **Test** (Linux, Mac, Windows): Rust unit tests
93+
- **CLI E2E test** (Linux, Mac, Windows): Snap tests - most likely to fail on a vite-task bump
94+
- **Run task**: Task runner integration tests
95+
- **Cargo Deny**: License/advisory checks (may have pre-existing failures unrelated to bump)
96+
97+
The only **required** status check for merging is `done`, which aggregates the other checks (excluding Cargo Deny).
98+
99+
## Notes
100+
101+
- Building the full CLI locally (`pnpm bootstrap-cli`) requires the rolldown Node.js package to be built first, which is complex. Prefer relying on CI for snap test generation.
102+
- `Cargo.lock` is automatically updated by cargo when you change the revision in `Cargo.toml`.

.devcontainer/devcontainer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
}
2727
}
2828
}
29-
}
29+
},
30+
"postCreateCommand": "curl -fsSL https://vite.plus | bash"
3031
// Use 'mounts' to make the cargo cache persistent in a Docker Volume.
3132
// "mounts": [
3233
// {

.github/actions/build-upstream/action.yml

Lines changed: 56 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,13 @@ runs:
2525
id: cache-key
2626
shell: bash
2727
run: |
28-
echo "key=napi-binding-v3-${{ inputs.target }}-${{ env.RELEASE_BUILD }}-${{ env.DEBUG }}-${{ env.VERSION }}-${{ env.NPM_TAG }}-${{ hashFiles('packages/tools/.upstream-versions.json', 'Cargo.lock', 'crates/**/*.rs', 'crates/*/Cargo.toml', 'packages/cli/binding/**/*.rs', 'packages/cli/binding/Cargo.toml', 'Cargo.toml', '.cargo/config.toml', 'packages/cli/package.json', 'packages/cli/build.ts') }}" >> $GITHUB_OUTPUT
28+
echo "key=napi-binding-v3-${{ inputs.target }}-${{ env.RELEASE_BUILD }}-${{ env.DEBUG }}-${{ env.VERSION }}-${{ env.NPM_TAG }}-${{ hashFiles('packages/tools/.upstream-versions.json', 'Cargo.lock', 'crates/**/*.rs', 'crates/*/Cargo.toml', 'packages/cli/binding/**/*.rs', 'packages/cli/binding/Cargo.toml', 'Cargo.toml', '.cargo/config.toml', 'packages/cli/package.json', 'packages/cli/build.ts', 'packages/cli/tsdown.config.ts') }}" >> $GITHUB_OUTPUT
29+
30+
# Resolve the Rust target directory (CARGO_TARGET_DIR from setup-rust, or default "target")
31+
- name: Resolve Rust target directory
32+
id: rust-target
33+
shell: bash
34+
run: echo "dir=${CARGO_TARGET_DIR:-target}" >> $GITHUB_OUTPUT
2935

3036
# Cache NAPI bindings and Rust CLI binary (the slow parts, especially on Windows)
3137
- name: Restore NAPI binding cache
@@ -38,16 +44,17 @@ runs:
3844
packages/cli/binding/index.d.ts
3945
packages/cli/binding/index.cjs
4046
packages/cli/binding/index.d.cts
41-
target/${{ inputs.target }}/release/vp
42-
target/${{ inputs.target }}/release/vp.exe
43-
target/${{ inputs.target }}/release/vp-shim.exe
47+
${{ steps.rust-target.outputs.dir }}/${{ inputs.target }}/release/vp
48+
${{ steps.rust-target.outputs.dir }}/${{ inputs.target }}/release/vp.exe
49+
${{ steps.rust-target.outputs.dir }}/${{ inputs.target }}/release/vp-shim.exe
50+
${{ steps.rust-target.outputs.dir }}/${{ inputs.target }}/release/vp-setup.exe
4451
key: ${{ steps.cache-key.outputs.key }}
4552

46-
# Apply Vite+ branding patches to rolldown-vite source (CI checks out
47-
# upstream rolldown-vite which doesn't have branding patches)
48-
- name: Brand rolldown-vite
53+
# Apply Vite+ branding patches to vite source (CI checks out
54+
# upstream vite which doesn't have branding patches)
55+
- name: Brand vite
4956
shell: bash
50-
run: pnpm exec tool brand-rolldown-vite
57+
run: pnpm exec tool brand-vite
5158

5259
# Build upstream TypeScript packages first (don't depend on native bindings)
5360
- name: Build upstream TypeScript packages
@@ -59,25 +66,44 @@ runs:
5966
pnpm --filter "@voidzero-dev/*" build
6067
pnpm --filter vite-plus build-ts
6168
69+
# Install zig + cargo-zigbuild for musl cross-compilation (napi-cross only supports gnu)
70+
- name: Add musl Rust target
71+
if: steps.cache-restore.outputs.cache-hit != 'true' && contains(inputs.target, 'musl')
72+
shell: bash
73+
run: rustup target add ${{ inputs.target }}
74+
75+
- name: Setup zig (musl)
76+
if: steps.cache-restore.outputs.cache-hit != 'true' && contains(inputs.target, 'musl')
77+
uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2.2.1
78+
with:
79+
version: 0.15.2
80+
81+
- name: Install cargo-zigbuild (musl)
82+
if: steps.cache-restore.outputs.cache-hit != 'true' && contains(inputs.target, 'musl')
83+
uses: taiki-e/install-action@f916cfac5d8efd040e250d0cd6b967616504b3a4 # v2.68.32
84+
with:
85+
tool: cargo-zigbuild
86+
6287
# NAPI builds - only run on cache miss (slow, especially on Windows)
6388
# Must run before vite-plus TypeScript builds which depend on the bindings
64-
- name: Build NAPI bindings (x86_64-linux)
89+
- name: Build NAPI bindings (Linux gnu)
6590
shell: bash
66-
if: steps.cache-restore.outputs.cache-hit != 'true' && inputs.target == 'x86_64-unknown-linux-gnu'
91+
if: steps.cache-restore.outputs.cache-hit != 'true' && contains(inputs.target, 'linux') && !contains(inputs.target, 'musl')
6792
run: |
6893
pnpm --filter=vite-plus build-native --target ${{ inputs.target }} --use-napi-cross
6994
env:
7095
TARGET_CC: clang
96+
TARGET_CFLAGS: ${{ contains(inputs.target, 'aarch64') && '-D_BSD_SOURCE' || '' }}
7197
DEBUG: napi:*
7298

73-
- name: Build NAPI bindings (aarch64-linux)
99+
- name: Build NAPI bindings (Linux musl)
74100
shell: bash
75-
if: steps.cache-restore.outputs.cache-hit != 'true' && inputs.target == 'aarch64-unknown-linux-gnu'
101+
if: steps.cache-restore.outputs.cache-hit != 'true' && contains(inputs.target, 'musl')
76102
run: |
77-
pnpm --filter=vite-plus build-native --target ${{ inputs.target }} --use-napi-cross
103+
pnpm --filter=vite-plus build-native --target ${{ inputs.target }} -x
78104
env:
79105
TARGET_CC: clang
80-
TARGET_CFLAGS: '-D_BSD_SOURCE'
106+
TARGET_CFLAGS: ${{ contains(inputs.target, 'aarch64') && '-D_BSD_SOURCE' || '' }}
81107
DEBUG: napi:*
82108

83109
- name: Build NAPI bindings (non-Linux targets)
@@ -88,23 +114,24 @@ runs:
88114
env:
89115
DEBUG: napi:*
90116

91-
- name: Build Rust CLI binary (x86_64-linux)
92-
if: steps.cache-restore.outputs.cache-hit != 'true' && inputs.target == 'x86_64-unknown-linux-gnu'
117+
- name: Build Rust CLI binary (Linux gnu)
118+
if: steps.cache-restore.outputs.cache-hit != 'true' && contains(inputs.target, 'linux') && !contains(inputs.target, 'musl')
93119
shell: bash
94120
run: |
95121
pnpm exec napi build --use-napi-cross --target ${{ inputs.target }} --release -p vite_global_cli
96122
env:
97123
TARGET_CC: clang
124+
TARGET_CFLAGS: ${{ contains(inputs.target, 'aarch64') && '-D_BSD_SOURCE' || '' }}
98125
DEBUG: napi:*
99126

100-
- name: Build Rust CLI binary (aarch64-linux)
101-
if: steps.cache-restore.outputs.cache-hit != 'true' && inputs.target == 'aarch64-unknown-linux-gnu'
127+
- name: Build Rust CLI binary (Linux musl)
128+
if: steps.cache-restore.outputs.cache-hit != 'true' && contains(inputs.target, 'musl')
102129
shell: bash
103130
run: |
104-
pnpm exec napi build --use-napi-cross --target ${{ inputs.target }} --release -p vite_global_cli
131+
pnpm exec napi build -x --target ${{ inputs.target }} --release -p vite_global_cli
105132
env:
106133
TARGET_CC: clang
107-
TARGET_CFLAGS: '-D_BSD_SOURCE'
134+
TARGET_CFLAGS: ${{ contains(inputs.target, 'aarch64') && '-D_BSD_SOURCE' || '' }}
108135
DEBUG: napi:*
109136

110137
- name: Build Rust CLI binary (non-Linux targets)
@@ -117,6 +144,11 @@ runs:
117144
shell: bash
118145
run: cargo build --release --target ${{ inputs.target }} -p vite_trampoline
119146

147+
- name: Build installer binary (Windows only)
148+
if: steps.cache-restore.outputs.cache-hit != 'true' && contains(inputs.target, 'windows')
149+
shell: bash
150+
run: cargo build --release --target ${{ inputs.target }} -p vite_installer
151+
120152
- name: Save NAPI binding cache
121153
if: steps.cache-restore.outputs.cache-hit != 'true'
122154
uses: actions/cache/save@94b89442628ad1d101e352b7ee38f30e1bef108e # v5
@@ -127,9 +159,10 @@ runs:
127159
packages/cli/binding/index.d.ts
128160
packages/cli/binding/index.cjs
129161
packages/cli/binding/index.d.cts
130-
target/${{ inputs.target }}/release/vp
131-
target/${{ inputs.target }}/release/vp.exe
132-
target/${{ inputs.target }}/release/vp-shim.exe
162+
${{ steps.rust-target.outputs.dir }}/${{ inputs.target }}/release/vp
163+
${{ steps.rust-target.outputs.dir }}/${{ inputs.target }}/release/vp.exe
164+
${{ steps.rust-target.outputs.dir }}/${{ inputs.target }}/release/vp-shim.exe
165+
${{ steps.rust-target.outputs.dir }}/${{ inputs.target }}/release/vp-setup.exe
133166
key: ${{ steps.cache-key.outputs.key }}
134167

135168
# Build vite-plus TypeScript after native bindings are ready

.github/actions/clone/action.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ outputs:
1515
runs:
1616
using: 'composite'
1717
steps:
18-
- name: Output rolldown and rolldown-vite hash
18+
- name: Output rolldown and vite hash
1919
shell: bash
2020
id: upstream-versions
2121
run: |
2222
node -e "console.log('ROLLDOWN_HASH=' + require('./packages/tools/.upstream-versions.json').rolldown.hash)" >> $GITHUB_OUTPUT
23-
node -e "console.log('ROLLDOWN_VITE_HASH=' + require('./packages/tools/.upstream-versions.json')['rolldown-vite'].hash)" >> $GITHUB_OUTPUT
23+
node -e "console.log('ROLLDOWN_VITE_HASH=' + require('./packages/tools/.upstream-versions.json')['vite'].hash)" >> $GITHUB_OUTPUT
2424
2525
- name: Output ecosystem ci project hash
2626
shell: bash
@@ -31,16 +31,16 @@ runs:
3131
node -e "console.log('ECOSYSTEM_CI_PROJECT_REPOSITORY=' + require('./ecosystem-ci/repo.json')['${{ inputs.ecosystem-ci-project }}'].repository.replace('https://github.com/', '').replace('.git', ''))" >> $GITHUB_OUTPUT
3232
echo "ECOSYSTEM_CI_PROJECT_PATH=${{ runner.temp }}/vite-plus-ecosystem-ci/${{ inputs.ecosystem-ci-project }}" >> $GITHUB_OUTPUT
3333
34-
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
34+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3535
with:
3636
repository: rolldown/rolldown
3737
path: rolldown
3838
ref: ${{ steps.upstream-versions.outputs.ROLLDOWN_HASH }}
3939

40-
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
40+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4141
with:
4242
repository: vitejs/vite
43-
path: rolldown-vite
43+
path: vite
4444
ref: ${{ steps.upstream-versions.outputs.ROLLDOWN_VITE_HASH }}
4545

4646
# Disable autocrlf to preserve LF line endings on Windows

0 commit comments

Comments
 (0)