From b189c36878117d3d7dffd8e1e07408f07f8377c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=A2=85=EA=B2=BD?= Date: Wed, 24 Jun 2026 10:59:58 +0900 Subject: [PATCH 1/3] fix(pm): allow cache flags without separator --- crates/vite_pm_cli/src/cli.rs | 13 ++++++++++++- .../snap-tests-global/command-cache-bun/snap.txt | 2 +- .../snap-tests-global/command-cache-npm10/snap.txt | 2 ++ .../command-cache-npm10/steps.json | 6 +++++- .../snap-tests-global/command-cache-pnpm10/snap.txt | 2 +- .../snap-tests-global/command-cache-pnpm11/snap.txt | 5 +++-- .../command-cache-pnpm11/steps.json | 6 +++++- .../snap-tests-global/command-cache-yarn4/snap.txt | 2 ++ .../command-cache-yarn4/steps.json | 6 +++++- 9 files changed, 36 insertions(+), 8 deletions(-) diff --git a/crates/vite_pm_cli/src/cli.rs b/crates/vite_pm_cli/src/cli.rs index 2e2c94ee86..872fe726d7 100644 --- a/crates/vite_pm_cli/src/cli.rs +++ b/crates/vite_pm_cli/src/cli.rs @@ -781,7 +781,7 @@ pub enum PmCommands { subcommand: String, /// Additional arguments - #[arg(last = true, allow_hyphen_values = true)] + #[arg(allow_hyphen_values = true, trailing_var_arg = true)] pass_through_args: Option>, }, @@ -1416,6 +1416,17 @@ mod tests { assert_eq!(pass_through_args, Some(vec!["--workspace-root".to_string()])); } + #[test] + fn cache_clean_accepts_flags_without_separator() { + let command = parse_pm_command(&["vp", "pm", "cache", "clean", "--force"]) + .expect("cache pass-through flags should parse"); + + let PackageManagerCommand::Pm(PmCommands::Cache { pass_through_args, .. }) = command else { + panic!("expected Cache variant"); + }; + assert_eq!(pass_through_args, Some(vec!["--force".to_string()])); + } + #[test] fn stage_publish_parses() { let command = parse_pm_command(&["vp", "pm", "stage", "publish", "--tag", "next"]) diff --git a/packages/cli/snap-tests-global/command-cache-bun/snap.txt b/packages/cli/snap-tests-global/command-cache-bun/snap.txt index 6c74bd2757..c32141ba6c 100644 --- a/packages/cli/snap-tests-global/command-cache-bun/snap.txt +++ b/packages/cli/snap-tests-global/command-cache-bun/snap.txt @@ -1,5 +1,5 @@ > vp pm cache --help # should show help -Usage: vp pm cache [-- ...] +Usage: vp pm cache [PASS_THROUGH_ARGS]... Manage package cache diff --git a/packages/cli/snap-tests-global/command-cache-npm10/snap.txt b/packages/cli/snap-tests-global/command-cache-npm10/snap.txt index 2391920ce8..c936022da3 100644 --- a/packages/cli/snap-tests-global/command-cache-npm10/snap.txt +++ b/packages/cli/snap-tests-global/command-cache-npm10/snap.txt @@ -3,3 +3,5 @@ > vp pm cache path # should show cache path (alias for dir, uses npm config get cache) /.npm + +> vp pm cache clean --force # should support pass-through flags without separator \ No newline at end of file diff --git a/packages/cli/snap-tests-global/command-cache-npm10/steps.json b/packages/cli/snap-tests-global/command-cache-npm10/steps.json index 1addd45b74..4b6fb1a09c 100644 --- a/packages/cli/snap-tests-global/command-cache-npm10/steps.json +++ b/packages/cli/snap-tests-global/command-cache-npm10/steps.json @@ -2,6 +2,10 @@ "ignoredPlatforms": ["win32"], "commands": [ "vp pm cache dir # should show cache directory (uses npm config get cache)", - "vp pm cache path # should show cache path (alias for dir, uses npm config get cache)" + "vp pm cache path # should show cache path (alias for dir, uses npm config get cache)", + { + "command": "vp pm cache clean --force # should support pass-through flags without separator", + "ignoreOutput": true + } ] } diff --git a/packages/cli/snap-tests-global/command-cache-pnpm10/snap.txt b/packages/cli/snap-tests-global/command-cache-pnpm10/snap.txt index 046e134dbe..2bddb46168 100644 --- a/packages/cli/snap-tests-global/command-cache-pnpm10/snap.txt +++ b/packages/cli/snap-tests-global/command-cache-pnpm10/snap.txt @@ -1,5 +1,5 @@ > vp pm cache --help # should show help -Usage: vp pm cache [-- ...] +Usage: vp pm cache [PASS_THROUGH_ARGS]... Manage package cache diff --git a/packages/cli/snap-tests-global/command-cache-pnpm11/snap.txt b/packages/cli/snap-tests-global/command-cache-pnpm11/snap.txt index 046e134dbe..751730bec0 100644 --- a/packages/cli/snap-tests-global/command-cache-pnpm11/snap.txt +++ b/packages/cli/snap-tests-global/command-cache-pnpm11/snap.txt @@ -1,5 +1,5 @@ > vp pm cache --help # should show help -Usage: vp pm cache [-- ...] +Usage: vp pm cache [PASS_THROUGH_ARGS]... Manage package cache @@ -14,4 +14,5 @@ Documentation: https://viteplus.dev/guide/install > vp pm cache dir > /dev/null # should show cache directory (uses pnpm store path) -> vp pm cache path > /dev/null # should show cache path (alias for dir, uses pnpm store path) \ No newline at end of file +> vp pm cache path > /dev/null # should show cache path (alias for dir, uses pnpm store path) +> vp pm cache clean --force # should support pass-through flags without separator \ No newline at end of file diff --git a/packages/cli/snap-tests-global/command-cache-pnpm11/steps.json b/packages/cli/snap-tests-global/command-cache-pnpm11/steps.json index 23198b09c4..35ae7287e9 100644 --- a/packages/cli/snap-tests-global/command-cache-pnpm11/steps.json +++ b/packages/cli/snap-tests-global/command-cache-pnpm11/steps.json @@ -2,6 +2,10 @@ "commands": [ "vp pm cache --help # should show help", "vp pm cache dir > /dev/null # should show cache directory (uses pnpm store path)", - "vp pm cache path > /dev/null # should show cache path (alias for dir, uses pnpm store path)" + "vp pm cache path > /dev/null # should show cache path (alias for dir, uses pnpm store path)", + { + "command": "vp pm cache clean --force # should support pass-through flags without separator", + "ignoreOutput": true + } ] } diff --git a/packages/cli/snap-tests-global/command-cache-yarn4/snap.txt b/packages/cli/snap-tests-global/command-cache-yarn4/snap.txt index 35109064ee..9a3593c459 100644 --- a/packages/cli/snap-tests-global/command-cache-yarn4/snap.txt +++ b/packages/cli/snap-tests-global/command-cache-yarn4/snap.txt @@ -3,3 +3,5 @@ > vp pm cache path # should show cache path (alias for dir, uses yarn config get cacheFolder) /.yarn/berry/cache + +> vp pm cache clean --all # should support pass-through flags without separator \ No newline at end of file diff --git a/packages/cli/snap-tests-global/command-cache-yarn4/steps.json b/packages/cli/snap-tests-global/command-cache-yarn4/steps.json index 6443f72dda..d3ae71a6d9 100644 --- a/packages/cli/snap-tests-global/command-cache-yarn4/steps.json +++ b/packages/cli/snap-tests-global/command-cache-yarn4/steps.json @@ -2,6 +2,10 @@ "ignoredPlatforms": ["win32", "darwin"], "commands": [ "vp pm cache dir # should show cache directory (uses yarn config get cacheFolder)", - "vp pm cache path # should show cache path (alias for dir, uses yarn config get cacheFolder)" + "vp pm cache path # should show cache path (alias for dir, uses yarn config get cacheFolder)", + { + "command": "vp pm cache clean --all # should support pass-through flags without separator", + "ignoreOutput": true + } ] } From 83f866f33383082242bcd33d4f73d575f9abae6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=A2=85=EA=B2=BD?= Date: Wed, 24 Jun 2026 13:14:35 +0900 Subject: [PATCH 2/3] test(pm): remove npm cache clean snap --- packages/cli/snap-tests-global/command-cache-npm10/snap.txt | 2 -- .../cli/snap-tests-global/command-cache-npm10/steps.json | 6 +----- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/packages/cli/snap-tests-global/command-cache-npm10/snap.txt b/packages/cli/snap-tests-global/command-cache-npm10/snap.txt index c936022da3..2391920ce8 100644 --- a/packages/cli/snap-tests-global/command-cache-npm10/snap.txt +++ b/packages/cli/snap-tests-global/command-cache-npm10/snap.txt @@ -3,5 +3,3 @@ > vp pm cache path # should show cache path (alias for dir, uses npm config get cache) /.npm - -> vp pm cache clean --force # should support pass-through flags without separator \ No newline at end of file diff --git a/packages/cli/snap-tests-global/command-cache-npm10/steps.json b/packages/cli/snap-tests-global/command-cache-npm10/steps.json index 4b6fb1a09c..1addd45b74 100644 --- a/packages/cli/snap-tests-global/command-cache-npm10/steps.json +++ b/packages/cli/snap-tests-global/command-cache-npm10/steps.json @@ -2,10 +2,6 @@ "ignoredPlatforms": ["win32"], "commands": [ "vp pm cache dir # should show cache directory (uses npm config get cache)", - "vp pm cache path # should show cache path (alias for dir, uses npm config get cache)", - { - "command": "vp pm cache clean --force # should support pass-through flags without separator", - "ignoreOutput": true - } + "vp pm cache path # should show cache path (alias for dir, uses npm config get cache)" ] } From e04850e94e991877fc399bc45d2dd33ed1552e77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=A2=85=EA=B2=BD?= Date: Wed, 24 Jun 2026 13:38:08 +0900 Subject: [PATCH 3/3] test(pm): remove cache clean snap commands --- .../cli/snap-tests-global/command-cache-pnpm11/snap.txt | 3 +-- .../cli/snap-tests-global/command-cache-pnpm11/steps.json | 6 +----- packages/cli/snap-tests-global/command-cache-yarn4/snap.txt | 2 -- .../cli/snap-tests-global/command-cache-yarn4/steps.json | 6 +----- 4 files changed, 3 insertions(+), 14 deletions(-) diff --git a/packages/cli/snap-tests-global/command-cache-pnpm11/snap.txt b/packages/cli/snap-tests-global/command-cache-pnpm11/snap.txt index 751730bec0..2bddb46168 100644 --- a/packages/cli/snap-tests-global/command-cache-pnpm11/snap.txt +++ b/packages/cli/snap-tests-global/command-cache-pnpm11/snap.txt @@ -14,5 +14,4 @@ Documentation: https://viteplus.dev/guide/install > vp pm cache dir > /dev/null # should show cache directory (uses pnpm store path) -> vp pm cache path > /dev/null # should show cache path (alias for dir, uses pnpm store path) -> vp pm cache clean --force # should support pass-through flags without separator \ No newline at end of file +> vp pm cache path > /dev/null # should show cache path (alias for dir, uses pnpm store path) \ No newline at end of file diff --git a/packages/cli/snap-tests-global/command-cache-pnpm11/steps.json b/packages/cli/snap-tests-global/command-cache-pnpm11/steps.json index 35ae7287e9..23198b09c4 100644 --- a/packages/cli/snap-tests-global/command-cache-pnpm11/steps.json +++ b/packages/cli/snap-tests-global/command-cache-pnpm11/steps.json @@ -2,10 +2,6 @@ "commands": [ "vp pm cache --help # should show help", "vp pm cache dir > /dev/null # should show cache directory (uses pnpm store path)", - "vp pm cache path > /dev/null # should show cache path (alias for dir, uses pnpm store path)", - { - "command": "vp pm cache clean --force # should support pass-through flags without separator", - "ignoreOutput": true - } + "vp pm cache path > /dev/null # should show cache path (alias for dir, uses pnpm store path)" ] } diff --git a/packages/cli/snap-tests-global/command-cache-yarn4/snap.txt b/packages/cli/snap-tests-global/command-cache-yarn4/snap.txt index 9a3593c459..35109064ee 100644 --- a/packages/cli/snap-tests-global/command-cache-yarn4/snap.txt +++ b/packages/cli/snap-tests-global/command-cache-yarn4/snap.txt @@ -3,5 +3,3 @@ > vp pm cache path # should show cache path (alias for dir, uses yarn config get cacheFolder) /.yarn/berry/cache - -> vp pm cache clean --all # should support pass-through flags without separator \ No newline at end of file diff --git a/packages/cli/snap-tests-global/command-cache-yarn4/steps.json b/packages/cli/snap-tests-global/command-cache-yarn4/steps.json index d3ae71a6d9..6443f72dda 100644 --- a/packages/cli/snap-tests-global/command-cache-yarn4/steps.json +++ b/packages/cli/snap-tests-global/command-cache-yarn4/steps.json @@ -2,10 +2,6 @@ "ignoredPlatforms": ["win32", "darwin"], "commands": [ "vp pm cache dir # should show cache directory (uses yarn config get cacheFolder)", - "vp pm cache path # should show cache path (alias for dir, uses yarn config get cacheFolder)", - { - "command": "vp pm cache clean --all # should support pass-through flags without separator", - "ignoreOutput": true - } + "vp pm cache path # should show cache path (alias for dir, uses yarn config get cacheFolder)" ] }