Skip to content

Commit 0331cef

Browse files
authored
feat(pack): add --exe flag and upgrade tsdown to 0.21.0-beta.2 (#646)
## Summary - Upgrade tsdown from `0.20.3` to `0.21.0-beta.2` for experimental Node.js SEA support - Add `--exe` CLI option to `vp pack` for bundling as a standalone Node.js executable - Add RFC document for the full `vp pack` command - Add global snap tests for `--exe` success (Node.js 25.7.0) and error (Node.js < 25.5.0) cases - Fix size replacement regex in snap test utils to handle uppercase units (MB, GB) ## Test plan - [x] `pnpm -F vite-plus snap-test-local command-pack` — help output includes `--exe`, build/cache unchanged - [x] `pnpm -F vite-plus snap-test-global command-pack-exe` — successful exe build with Node.js 25.7.0 - [x] `pnpm -F vite-plus snap-test-global command-pack-exe-error` — clear error on Node.js < 25.5.0 🤖 Generated with [Claude Code](https://claude.com/claude-code)
1 parent 5df3a55 commit 0331cef

18 files changed

Lines changed: 546 additions & 41 deletions

File tree

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "command-pack-exe-error",
3+
"version": "1.0.0",
4+
"type": "module",
5+
"engines": {
6+
"node": "22.22.0"
7+
}
8+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[1]> vp pack src/index.ts --exe
2+
ℹ entry: src/index.ts
3+
ℹ target: node22.22.0
4+
5+
ERROR Error: Node.js version v<semver> does not support `exe` option. Please upgrade to Node.js <semver> or later.
6+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const hello = 'world';
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"ignoredPlatforms": ["win32"],
3+
"env": {
4+
"VITE_DISABLE_AUTO_INSTALL": "1"
5+
},
6+
"commands": ["vp pack src/index.ts --exe"]
7+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default {};
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "command-pack-exe",
3+
"version": "1.0.0",
4+
"type": "module",
5+
"engines": {
6+
"node": "25.7.0"
7+
}
8+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
> vp pack src/index.ts --exe
2+
ℹ entry: src/index.ts
3+
ℹ target: node25.7.0
4+
ℹ `exe` option is experimental and may change in future releases.
5+
ℹ Build start
6+
ℹ dist/index.mjs <variable> kB │ gzip: <variable> kB
7+
ℹ 1 files, total: <variable> kB
8+
✔ Build complete in <variable>ms
9+
ℹ dist/index <variable> MB
10+
✔ Built executable: dist/index (<variable>ms)
11+
12+
> ls dist
13+
index
14+
index.mjs
15+
16+
> ./dist/index
17+
hello from exe
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log('hello from exe');
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"ignoredPlatforms": ["win32"],
3+
"env": {
4+
"VITE_DISABLE_AUTO_INSTALL": "1"
5+
},
6+
"commands": ["vp pack src/index.ts --exe", "ls dist", "./dist/index"],
7+
"after": ["rm -rf dist"]
8+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default {};

0 commit comments

Comments
 (0)