Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
4c11b88
fix(command): route Windows .cmd shims through PowerShell for pm comm…
fengmk2 Apr 29, 2026
bb22c79
refactor(command): extract resolve_program to dedupe ps1-rewrite plum…
fengmk2 Apr 29, 2026
0b3126e
refactor(command): use shared vite_powershell crate for ps1 rewrite
fengmk2 Apr 29, 2026
23a91da
chore(deps): bump vite-task pin to 957278df
fengmk2 Apr 29, 2026
f1ecd6e
style(command): import OsString and drop Arc turbofish in ps1_shim
fengmk2 Apr 29, 2026
2f96d23
fix(command): look up PATH case-insensitively in resolve_program
fengmk2 Apr 29, 2026
733f826
fix(command): restrict .cmd to PowerShell rewrite to vp-managed shims
fengmk2 Apr 29, 2026
c9e5bea
style(ps1_shim): tighten scope-rationale doc and unshadow ps1_str in …
fengmk2 Apr 29, 2026
68df27a
fix(command): also rewrite .cmd shims under any node_modules/.bin
fengmk2 Apr 30, 2026
2b316f8
chore(deps): bump vite-task pin to merged 88bacaa7
fengmk2 Apr 30, 2026
3a41199
refactor(command): drop case-insensitive PATH lookup in resolve_program
fengmk2 Apr 30, 2026
7fb4d5d
style(ps1_shim): drop Arc from rewrite_in_scope signature and trim do…
fengmk2 Apr 30, 2026
825db88
fix(cli): consolidate runCommandSilently and skip stdin pipe to avoid…
fengmk2 Apr 30, 2026
55656ae
fix(command): restore run_command_with_fspy to its pre-branch form
fengmk2 Apr 30, 2026
73ccc44
refactor(cli): move projectDir off ExecutionResult into ExecutionWith…
fengmk2 Apr 30, 2026
7623860
refactor(cli): drop dead re-exports from create/command.ts
fengmk2 Apr 30, 2026
eb3ba7c
ci: TEMP debug instrumentation for new-create-vite-migrates-eslint-pr…
fengmk2 May 7, 2026
c552fa5
ci: TEMP fix debug script — drop set -e, use absolute paths, add Node…
fengmk2 May 7, 2026
87dbc9b
fix(tools): use path.join in snap-test temp dir to fix Windows mixed-…
fengmk2 May 7, 2026
9418b37
fix(tools): switch realpathSync to .native + fix remaining string concat
fengmk2 May 7, 2026
1c2bd19
ci: TEMP test ReFS-vs-NTFS hypothesis — force snap-test TEMP onto Dev…
fengmk2 May 7, 2026
2d3c316
ci(snap-test): route Windows snap-test TEMP onto the Dev Drive (ReFS)
fengmk2 May 7, 2026
4babb4c
ci(snap-test): create TEMP/TMP dir on Dev Drive before tools touch it
fengmk2 May 7, 2026
0190a22
test(snap): set ignoreOutput=true on new-create-vite migration test
fengmk2 May 7, 2026
c12fd14
fix(ps1_shim): decouple node_modules/.bin scope from VP_HOME resolution
fengmk2 May 7, 2026
c2aa8f9
fix(ps1_shim): skip cmd→ps1 rewrite when stdin is not a terminal
fengmk2 May 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -663,9 +663,29 @@ jobs:
with:
drive-size: 12GB
drive-format: ReFS
# Route TEMP/TMP onto the Dev Drive (ReFS) so `tmpdir()` from
# `packages/tools/src/snap-test.ts` lives on a filesystem that
# cleanly resolves pnpm's junction reparse points. NTFS-on-C:
# preserves the junction-target backslashes during resolution,
# which produces mixed `\` / `/` paths that break Node's ESM
# subpath-import walk-up (`#module-sync-enabled` inside
# `@voidzero-dev/vite-plus-core` → `ERR_PACKAGE_IMPORT_NOT_DEFINED`
# during `vp fmt --write` in the
# `new-create-vite-migrates-eslint-prettier` snap test).
env-mapping: |
CARGO_HOME,{{ DEV_DRIVE }}/.cargo
RUSTUP_HOME,{{ DEV_DRIVE }}/.rustup
TEMP,{{ DEV_DRIVE }}/Temp
TMP,{{ DEV_DRIVE }}/Temp

- name: Create TEMP/TMP on Dev Drive
if: runner.os == 'Windows'
# `setup-dev-drive` only mounts the drive; it doesn't create the
# dir we point TEMP/TMP at. Anything that calls `os.tmpdir()` /
# `lstat($TEMP)` before this dir exists fails (e.g. the bootstrap
# CLI installer's `lstat 'E:\Temp'` ENOENT).
shell: bash
run: mkdir -p "$TEMP" "$TMP"

- uses: oxc-project/setup-rust@23f38cfb0c04af97a055f76acee94d5be71c7c82 # v1.0.16
with:
Expand Down
54 changes: 33 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 8 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ dunce = "1.0.5"
fast-glob = "1.0.0"
flate2 = { version = "=1.1.9", features = ["zlib-rs"] }
form_urlencoded = "1.2.1"
fspy = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "d1b8cdae8b6df5eab8b9f1143ceb4fb13933a5ef" }
fspy = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "88bacaa770200ddab151dea252e04ba8cdcc4ade" }
futures = "0.3.31"
futures-util = "0.3.31"
glob = "0.3.2"
Expand Down Expand Up @@ -194,17 +194,18 @@ vfs = "0.13.0"
vite_command = { path = "crates/vite_command" }
vite_error = { path = "crates/vite_error" }
vite_js_runtime = { path = "crates/vite_js_runtime" }
vite_glob = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "d1b8cdae8b6df5eab8b9f1143ceb4fb13933a5ef" }
vite_glob = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "88bacaa770200ddab151dea252e04ba8cdcc4ade" }
vite_install = { path = "crates/vite_install" }
vite_migration = { path = "crates/vite_migration" }
vite_pm_cli = { path = "crates/vite_pm_cli" }
vite_setup = { path = "crates/vite_setup" }
vite_shared = { path = "crates/vite_shared" }
vite_static_config = { path = "crates/vite_static_config" }
vite_path = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "d1b8cdae8b6df5eab8b9f1143ceb4fb13933a5ef" }
vite_str = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "d1b8cdae8b6df5eab8b9f1143ceb4fb13933a5ef" }
vite_task = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "d1b8cdae8b6df5eab8b9f1143ceb4fb13933a5ef" }
vite_workspace = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "d1b8cdae8b6df5eab8b9f1143ceb4fb13933a5ef" }
vite_path = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "88bacaa770200ddab151dea252e04ba8cdcc4ade" }
vite_powershell = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "88bacaa770200ddab151dea252e04ba8cdcc4ade" }
vite_str = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "88bacaa770200ddab151dea252e04ba8cdcc4ade" }
vite_task = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "88bacaa770200ddab151dea252e04ba8cdcc4ade" }
vite_workspace = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "88bacaa770200ddab151dea252e04ba8cdcc4ade" }
walkdir = "2.5.0"
wax = "0.6.0"
which = "8.0.0"
Expand Down Expand Up @@ -315,6 +316,7 @@ string_wizard = { path = "./rolldown/crates/string_wizard", features = ["serde"]
# fspy = { path = "../vite-task/crates/fspy" }
# vite_glob = { path = "../vite-task/crates/vite_glob" }
# vite_path = { path = "../vite-task/crates/vite_path" }
# vite_powershell = { path = "../vite-task/crates/vite_powershell" }
# vite_str = { path = "../vite-task/crates/vite_str" }
# vite_task = { path = "../vite-task/crates/vite_task" }
# vite_workspace = { path = "../vite-task/crates/vite_workspace" }
Expand Down
2 changes: 2 additions & 0 deletions crates/vite_command/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ tokio-util = { workspace = true }
tracing = { workspace = true }
vite_error = { workspace = true }
vite_path = { workspace = true }
vite_powershell = { workspace = true }
vite_shared = { workspace = true }
which = { workspace = true, features = ["tracing"] }

[target.'cfg(not(target_os = "windows"))'.dependencies]
Expand Down
27 changes: 22 additions & 5 deletions crates/vite_command/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use std::os::fd::{BorrowedFd, RawFd};
use std::{
collections::HashMap,
ffi::OsStr,
ffi::{OsStr, OsString},
process::{ExitStatus, Stdio},
};

Expand All @@ -12,6 +12,8 @@ use tokio_util::sync::CancellationToken;
use vite_error::Error;
use vite_path::{AbsolutePath, AbsolutePathBuf, RelativePathBuf};

mod ps1_shim;

/// Result of running a command with fspy tracking.
#[derive(Debug)]
pub struct FspyCommandResult {
Expand Down Expand Up @@ -43,6 +45,22 @@ pub fn resolve_bin(
AbsolutePathBuf::new(path).ok_or_else(|| Error::CannotFindBinaryPath(bin_name.into()))
}

/// Resolve `bin_name` to a path and apply the Windows `.cmd` → PowerShell
/// rewrite. Returns the program to spawn and the arg prefix to prepend
/// before the user args (empty when no rewrite applies).
fn resolve_program(
bin_name: &str,
envs: &HashMap<String, String>,
cwd: &AbsolutePath,
) -> Result<(AbsolutePathBuf, Vec<OsString>), Error> {
let path_env = envs.get("PATH").map(|p| OsStr::new(p.as_str()));
let bin_path = resolve_bin(bin_name, path_env, cwd)?;
Ok(match ps1_shim::rewrite_cmd_to_powershell(&bin_path) {
Some(rewritten) => rewritten,
None => (bin_path, Vec::new()),
})
}

/// Build a `tokio::process::Command` for a pre-resolved binary path.
/// Sets inherited stdio and `fix_stdio_streams` (Unix pre_exec).
/// Callers can further customize (add args, envs, override stdio, etc.).
Expand Down Expand Up @@ -140,10 +158,9 @@ where
S: AsRef<OsStr>,
{
let cwd = cwd.as_ref();
let paths = envs.get("PATH");
let bin_path = resolve_bin(bin_name, paths.map(|p| OsStr::new(p.as_str())), cwd)?;
let mut cmd = build_command(&bin_path, cwd);
cmd.args(args).envs(envs);
let (program, prefix_args) = resolve_program(bin_name, envs, cwd)?;
let mut cmd = build_command(&program, cwd);
cmd.args(&prefix_args).args(args).envs(envs);
Comment thread
fengmk2 marked this conversation as resolved.
let status = cmd.status().await?;
Ok(status)
}
Expand Down
Loading
Loading