diff --git a/Cargo.lock b/Cargo.lock index dbb9b43969..04aae87f08 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2272,7 +2272,7 @@ dependencies = [ [[package]] name = "fspy" version = "0.1.0" -source = "git+https://github.com/voidzero-dev/vite-task.git?rev=417b6aae5fca92b128c586c8ff3421e43911b553#417b6aae5fca92b128c586c8ff3421e43911b553" +source = "git+https://github.com/taskylizard/vite-task.git?rev=e263e2b74c1b926735e2deff9c21768cd8953440#e263e2b74c1b926735e2deff9c21768cd8953440" dependencies = [ "anyhow", "bstr", @@ -2307,7 +2307,7 @@ dependencies = [ [[package]] name = "fspy_detours_sys" version = "0.0.0" -source = "git+https://github.com/voidzero-dev/vite-task.git?rev=417b6aae5fca92b128c586c8ff3421e43911b553#417b6aae5fca92b128c586c8ff3421e43911b553" +source = "git+https://github.com/taskylizard/vite-task.git?rev=e263e2b74c1b926735e2deff9c21768cd8953440#e263e2b74c1b926735e2deff9c21768cd8953440" dependencies = [ "cc", "winapi", @@ -2316,7 +2316,7 @@ dependencies = [ [[package]] name = "fspy_preload_unix" version = "0.0.0" -source = "git+https://github.com/voidzero-dev/vite-task.git?rev=417b6aae5fca92b128c586c8ff3421e43911b553#417b6aae5fca92b128c586c8ff3421e43911b553" +source = "git+https://github.com/taskylizard/vite-task.git?rev=e263e2b74c1b926735e2deff9c21768cd8953440#e263e2b74c1b926735e2deff9c21768cd8953440" dependencies = [ "anyhow", "bstr", @@ -2331,7 +2331,7 @@ dependencies = [ [[package]] name = "fspy_preload_windows" version = "0.1.0" -source = "git+https://github.com/voidzero-dev/vite-task.git?rev=417b6aae5fca92b128c586c8ff3421e43911b553#417b6aae5fca92b128c586c8ff3421e43911b553" +source = "git+https://github.com/taskylizard/vite-task.git?rev=e263e2b74c1b926735e2deff9c21768cd8953440#e263e2b74c1b926735e2deff9c21768cd8953440" dependencies = [ "constcat", "fspy_detours_sys", @@ -2347,7 +2347,7 @@ dependencies = [ [[package]] name = "fspy_seccomp_unotify" version = "0.1.0" -source = "git+https://github.com/voidzero-dev/vite-task.git?rev=417b6aae5fca92b128c586c8ff3421e43911b553#417b6aae5fca92b128c586c8ff3421e43911b553" +source = "git+https://github.com/taskylizard/vite-task.git?rev=e263e2b74c1b926735e2deff9c21768cd8953440#e263e2b74c1b926735e2deff9c21768cd8953440" dependencies = [ "futures-util", "libc", @@ -2364,7 +2364,7 @@ dependencies = [ [[package]] name = "fspy_shared" version = "0.0.0" -source = "git+https://github.com/voidzero-dev/vite-task.git?rev=417b6aae5fca92b128c586c8ff3421e43911b553#417b6aae5fca92b128c586c8ff3421e43911b553" +source = "git+https://github.com/taskylizard/vite-task.git?rev=e263e2b74c1b926735e2deff9c21768cd8953440#e263e2b74c1b926735e2deff9c21768cd8953440" dependencies = [ "bitflags 2.13.0", "bstr", @@ -2383,7 +2383,7 @@ dependencies = [ [[package]] name = "fspy_shared_unix" version = "0.0.0" -source = "git+https://github.com/voidzero-dev/vite-task.git?rev=417b6aae5fca92b128c586c8ff3421e43911b553#417b6aae5fca92b128c586c8ff3421e43911b553" +source = "git+https://github.com/taskylizard/vite-task.git?rev=e263e2b74c1b926735e2deff9c21768cd8953440#e263e2b74c1b926735e2deff9c21768cd8953440" dependencies = [ "anyhow", "base64 0.22.1", @@ -3530,7 +3530,7 @@ dependencies = [ [[package]] name = "materialized_artifact" version = "0.0.0" -source = "git+https://github.com/voidzero-dev/vite-task.git?rev=417b6aae5fca92b128c586c8ff3421e43911b553#417b6aae5fca92b128c586c8ff3421e43911b553" +source = "git+https://github.com/taskylizard/vite-task.git?rev=e263e2b74c1b926735e2deff9c21768cd8953440#e263e2b74c1b926735e2deff9c21768cd8953440" dependencies = [ "tempfile", ] @@ -3538,7 +3538,7 @@ dependencies = [ [[package]] name = "materialized_artifact_build" version = "0.0.0" -source = "git+https://github.com/voidzero-dev/vite-task.git?rev=417b6aae5fca92b128c586c8ff3421e43911b553#417b6aae5fca92b128c586c8ff3421e43911b553" +source = "git+https://github.com/taskylizard/vite-task.git?rev=e263e2b74c1b926735e2deff9c21768cd8953440#e263e2b74c1b926735e2deff9c21768cd8953440" dependencies = [ "xxhash-rust", ] @@ -3771,7 +3771,7 @@ dependencies = [ [[package]] name = "native_str" version = "0.0.0" -source = "git+https://github.com/voidzero-dev/vite-task.git?rev=417b6aae5fca92b128c586c8ff3421e43911b553#417b6aae5fca92b128c586c8ff3421e43911b553" +source = "git+https://github.com/taskylizard/vite-task.git?rev=e263e2b74c1b926735e2deff9c21768cd8953440#e263e2b74c1b926735e2deff9c21768cd8953440" dependencies = [ "bumpalo", "bytemuck", @@ -5509,7 +5509,7 @@ dependencies = [ [[package]] name = "pty_terminal" version = "0.0.0" -source = "git+https://github.com/voidzero-dev/vite-task.git?rev=417b6aae5fca92b128c586c8ff3421e43911b553#417b6aae5fca92b128c586c8ff3421e43911b553" +source = "git+https://github.com/taskylizard/vite-task.git?rev=e263e2b74c1b926735e2deff9c21768cd8953440#e263e2b74c1b926735e2deff9c21768cd8953440" dependencies = [ "anyhow", "portable-pty", @@ -5519,7 +5519,7 @@ dependencies = [ [[package]] name = "pty_terminal_test" version = "0.0.0" -source = "git+https://github.com/voidzero-dev/vite-task.git?rev=417b6aae5fca92b128c586c8ff3421e43911b553#417b6aae5fca92b128c586c8ff3421e43911b553" +source = "git+https://github.com/taskylizard/vite-task.git?rev=e263e2b74c1b926735e2deff9c21768cd8953440#e263e2b74c1b926735e2deff9c21768cd8953440" dependencies = [ "anyhow", "portable-pty", @@ -5530,7 +5530,7 @@ dependencies = [ [[package]] name = "pty_terminal_test_client" version = "0.0.0" -source = "git+https://github.com/voidzero-dev/vite-task.git?rev=417b6aae5fca92b128c586c8ff3421e43911b553#417b6aae5fca92b128c586c8ff3421e43911b553" +source = "git+https://github.com/taskylizard/vite-task.git?rev=e263e2b74c1b926735e2deff9c21768cd8953440#e263e2b74c1b926735e2deff9c21768cd8953440" [[package]] name = "quote" @@ -7413,7 +7413,7 @@ dependencies = [ [[package]] name = "snapshot_test" version = "0.1.0" -source = "git+https://github.com/voidzero-dev/vite-task.git?rev=417b6aae5fca92b128c586c8ff3421e43911b553#417b6aae5fca92b128c586c8ff3421e43911b553" +source = "git+https://github.com/taskylizard/vite-task.git?rev=e263e2b74c1b926735e2deff9c21768cd8953440#e263e2b74c1b926735e2deff9c21768cd8953440" dependencies = [ "serde", "serde_json", @@ -8450,7 +8450,7 @@ dependencies = [ [[package]] name = "vite_glob" version = "0.0.0" -source = "git+https://github.com/voidzero-dev/vite-task.git?rev=417b6aae5fca92b128c586c8ff3421e43911b553#417b6aae5fca92b128c586c8ff3421e43911b553" +source = "git+https://github.com/taskylizard/vite-task.git?rev=e263e2b74c1b926735e2deff9c21768cd8953440#e263e2b74c1b926735e2deff9c21768cd8953440" dependencies = [ "globset", "thiserror 2.0.18", @@ -8498,7 +8498,7 @@ dependencies = [ [[package]] name = "vite_graph_ser" version = "0.1.0" -source = "git+https://github.com/voidzero-dev/vite-task.git?rev=417b6aae5fca92b128c586c8ff3421e43911b553#417b6aae5fca92b128c586c8ff3421e43911b553" +source = "git+https://github.com/taskylizard/vite-task.git?rev=e263e2b74c1b926735e2deff9c21768cd8953440#e263e2b74c1b926735e2deff9c21768cd8953440" dependencies = [ "petgraph 0.8.3", "serde", @@ -8598,7 +8598,7 @@ dependencies = [ [[package]] name = "vite_path" version = "0.1.0" -source = "git+https://github.com/voidzero-dev/vite-task.git?rev=417b6aae5fca92b128c586c8ff3421e43911b553#417b6aae5fca92b128c586c8ff3421e43911b553" +source = "git+https://github.com/taskylizard/vite-task.git?rev=e263e2b74c1b926735e2deff9c21768cd8953440#e263e2b74c1b926735e2deff9c21768cd8953440" dependencies = [ "diff-struct", "os_str_bytes", @@ -8630,7 +8630,7 @@ dependencies = [ [[package]] name = "vite_powershell" version = "0.1.0" -source = "git+https://github.com/voidzero-dev/vite-task.git?rev=417b6aae5fca92b128c586c8ff3421e43911b553#417b6aae5fca92b128c586c8ff3421e43911b553" +source = "git+https://github.com/taskylizard/vite-task.git?rev=e263e2b74c1b926735e2deff9c21768cd8953440#e263e2b74c1b926735e2deff9c21768cd8953440" dependencies = [ "vite_path", "which", @@ -8639,7 +8639,7 @@ dependencies = [ [[package]] name = "vite_select" version = "0.0.0" -source = "git+https://github.com/voidzero-dev/vite-task.git?rev=417b6aae5fca92b128c586c8ff3421e43911b553#417b6aae5fca92b128c586c8ff3421e43911b553" +source = "git+https://github.com/taskylizard/vite-task.git?rev=e263e2b74c1b926735e2deff9c21768cd8953440#e263e2b74c1b926735e2deff9c21768cd8953440" dependencies = [ "anyhow", "crossterm", @@ -8692,7 +8692,7 @@ dependencies = [ [[package]] name = "vite_shell" version = "0.0.0" -source = "git+https://github.com/voidzero-dev/vite-task.git?rev=417b6aae5fca92b128c586c8ff3421e43911b553#417b6aae5fca92b128c586c8ff3421e43911b553" +source = "git+https://github.com/taskylizard/vite-task.git?rev=e263e2b74c1b926735e2deff9c21768cd8953440#e263e2b74c1b926735e2deff9c21768cd8953440" dependencies = [ "brush-parser 0.4.0", "diff-struct", @@ -8719,7 +8719,7 @@ dependencies = [ [[package]] name = "vite_str" version = "0.1.0" -source = "git+https://github.com/voidzero-dev/vite-task.git?rev=417b6aae5fca92b128c586c8ff3421e43911b553#417b6aae5fca92b128c586c8ff3421e43911b553" +source = "git+https://github.com/taskylizard/vite-task.git?rev=e263e2b74c1b926735e2deff9c21768cd8953440#e263e2b74c1b926735e2deff9c21768cd8953440" dependencies = [ "compact_str", "diff-struct", @@ -8730,7 +8730,7 @@ dependencies = [ [[package]] name = "vite_task" version = "0.0.0" -source = "git+https://github.com/voidzero-dev/vite-task.git?rev=417b6aae5fca92b128c586c8ff3421e43911b553#417b6aae5fca92b128c586c8ff3421e43911b553" +source = "git+https://github.com/taskylizard/vite-task.git?rev=e263e2b74c1b926735e2deff9c21768cd8953440#e263e2b74c1b926735e2deff9c21768cd8953440" dependencies = [ "anstream", "anyhow", @@ -8779,7 +8779,7 @@ dependencies = [ [[package]] name = "vite_task_client" version = "0.0.0" -source = "git+https://github.com/voidzero-dev/vite-task.git?rev=417b6aae5fca92b128c586c8ff3421e43911b553#417b6aae5fca92b128c586c8ff3421e43911b553" +source = "git+https://github.com/taskylizard/vite-task.git?rev=e263e2b74c1b926735e2deff9c21768cd8953440#e263e2b74c1b926735e2deff9c21768cd8953440" dependencies = [ "native_str", "rustc-hash", @@ -8792,7 +8792,7 @@ dependencies = [ [[package]] name = "vite_task_client_napi" version = "0.1.0" -source = "git+https://github.com/voidzero-dev/vite-task.git?rev=417b6aae5fca92b128c586c8ff3421e43911b553#417b6aae5fca92b128c586c8ff3421e43911b553" +source = "git+https://github.com/taskylizard/vite-task.git?rev=e263e2b74c1b926735e2deff9c21768cd8953440#e263e2b74c1b926735e2deff9c21768cd8953440" dependencies = [ "napi", "napi-build", @@ -8804,7 +8804,7 @@ dependencies = [ [[package]] name = "vite_task_graph" version = "0.1.0" -source = "git+https://github.com/voidzero-dev/vite-task.git?rev=417b6aae5fca92b128c586c8ff3421e43911b553#417b6aae5fca92b128c586c8ff3421e43911b553" +source = "git+https://github.com/taskylizard/vite-task.git?rev=e263e2b74c1b926735e2deff9c21768cd8953440#e263e2b74c1b926735e2deff9c21768cd8953440" dependencies = [ "anyhow", "async-trait", @@ -8826,7 +8826,7 @@ dependencies = [ [[package]] name = "vite_task_ipc_shared" version = "0.0.0" -source = "git+https://github.com/voidzero-dev/vite-task.git?rev=417b6aae5fca92b128c586c8ff3421e43911b553#417b6aae5fca92b128c586c8ff3421e43911b553" +source = "git+https://github.com/taskylizard/vite-task.git?rev=e263e2b74c1b926735e2deff9c21768cd8953440#e263e2b74c1b926735e2deff9c21768cd8953440" dependencies = [ "native_str", "rustc-hash", @@ -8836,7 +8836,7 @@ dependencies = [ [[package]] name = "vite_task_plan" version = "0.1.0" -source = "git+https://github.com/voidzero-dev/vite-task.git?rev=417b6aae5fca92b128c586c8ff3421e43911b553#417b6aae5fca92b128c586c8ff3421e43911b553" +source = "git+https://github.com/taskylizard/vite-task.git?rev=e263e2b74c1b926735e2deff9c21768cd8953440#e263e2b74c1b926735e2deff9c21768cd8953440" dependencies = [ "anyhow", "async-trait", @@ -8864,7 +8864,7 @@ dependencies = [ [[package]] name = "vite_task_server" version = "0.0.0" -source = "git+https://github.com/voidzero-dev/vite-task.git?rev=417b6aae5fca92b128c586c8ff3421e43911b553#417b6aae5fca92b128c586c8ff3421e43911b553" +source = "git+https://github.com/taskylizard/vite-task.git?rev=e263e2b74c1b926735e2deff9c21768cd8953440#e263e2b74c1b926735e2deff9c21768cd8953440" dependencies = [ "futures", "native_str", @@ -8888,7 +8888,7 @@ version = "0.0.0" [[package]] name = "vite_workspace" version = "0.0.0" -source = "git+https://github.com/voidzero-dev/vite-task.git?rev=417b6aae5fca92b128c586c8ff3421e43911b553#417b6aae5fca92b128c586c8ff3421e43911b553" +source = "git+https://github.com/taskylizard/vite-task.git?rev=e263e2b74c1b926735e2deff9c21768cd8953440#e263e2b74c1b926735e2deff9c21768cd8953440" dependencies = [ "clap", "petgraph 0.8.3", diff --git a/Cargo.toml b/Cargo.toml index 311045f5e8..e5c9941a0e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -193,7 +193,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 = "417b6aae5fca92b128c586c8ff3421e43911b553" } +fspy = { git = "https://github.com/taskylizard/vite-task.git", rev = "e263e2b74c1b926735e2deff9c21768cd8953440" } futures = "0.3.31" futures-util = "0.3.31" glob = "0.3.2" @@ -250,8 +250,8 @@ pretty_assertions = "1.4.1" phf = "0.13.0" prettyplease = "0.2.32" proc-macro2 = "1" -pty_terminal_test = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "417b6aae5fca92b128c586c8ff3421e43911b553" } -pty_terminal_test_client = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "417b6aae5fca92b128c586c8ff3421e43911b553" } +pty_terminal_test = { git = "https://github.com/taskylizard/vite-task.git", rev = "e263e2b74c1b926735e2deff9c21768cd8953440" } +pty_terminal_test_client = { git = "https://github.com/taskylizard/vite-task.git", rev = "e263e2b74c1b926735e2deff9c21768cd8953440" } quote = "1" rayon = "1.10.0" regex = "1.11.1" @@ -274,7 +274,7 @@ sha2 = "0.10.9" shell-escape = "0.1.5" simdutf8 = "0.1.5" smallvec = { version = "1.15.1", features = ["union"] } -snapshot_test = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "417b6aae5fca92b128c586c8ff3421e43911b553" } +snapshot_test = { git = "https://github.com/taskylizard/vite-task.git", rev = "e263e2b74c1b926735e2deff9c21768cd8953440" } string_cache = "0.9.0" sugar_path = { version = "2.0.1", features = ["cached_current_dir"] } supports-color = "3" @@ -305,11 +305,11 @@ 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 = "417b6aae5fca92b128c586c8ff3421e43911b553" } -vite_powershell = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "417b6aae5fca92b128c586c8ff3421e43911b553" } -vite_str = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "417b6aae5fca92b128c586c8ff3421e43911b553" } -vite_task = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "417b6aae5fca92b128c586c8ff3421e43911b553" } -vite_workspace = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "417b6aae5fca92b128c586c8ff3421e43911b553" } +vite_path = { git = "https://github.com/taskylizard/vite-task.git", rev = "e263e2b74c1b926735e2deff9c21768cd8953440" } +vite_powershell = { git = "https://github.com/taskylizard/vite-task.git", rev = "e263e2b74c1b926735e2deff9c21768cd8953440" } +vite_str = { git = "https://github.com/taskylizard/vite-task.git", rev = "e263e2b74c1b926735e2deff9c21768cd8953440" } +vite_task = { git = "https://github.com/taskylizard/vite-task.git", rev = "e263e2b74c1b926735e2deff9c21768cd8953440" } +vite_workspace = { git = "https://github.com/taskylizard/vite-task.git", rev = "e263e2b74c1b926735e2deff9c21768cd8953440" } walkdir = "2.5.0" which = "8.0.0" winreg = "0.56.0" diff --git a/docs/config/run.md b/docs/config/run.md index 4349ae7d75..d66bde0a68 100644 --- a/docs/config/run.md +++ b/docs/config/run.md @@ -169,6 +169,24 @@ tasks: { } ``` +### `replayLogs` + +- **Type:** `boolean` +- **Default:** `true` + +Whether to replay the task's cached stdout/stderr on cache hits. Set this to `false` when you want cache hits to restore output files and report saved time without printing the task's previous logs: + +```ts [vite.config.ts] +tasks: { + build: { + command: 'vp build', + replayLogs: false, + }, +} +``` + +This does not disable caching and does not affect [`output`](#output) restoration. On a cache hit, Vite Task still skips the command and restores cached output files. + ### `env` - **Type:** `string[]` diff --git a/docs/guide/cache.md b/docs/guide/cache.md index 0ef8735f5b..71b2bd6442 100644 --- a/docs/guide/cache.md +++ b/docs/guide/cache.md @@ -12,6 +12,8 @@ When a task runs successfully (exit code 0), its terminal output (stdout/stderr) When all checks match, Vite Task replays the cached terminal output, restores saved output files, and skips the command. +Set [`replayLogs: false`](/config/run#replaylogs) on a task when cache hits should stay quiet. The task still hits the cache, skips execution, and restores cached output files; only cached stdout/stderr replay is suppressed. + When a cache miss occurs, Vite Task tells you exactly why: ``` diff --git a/packages/cli/binding/src/cli/handler.rs b/packages/cli/binding/src/cli/handler.rs index 518305ac1a..1a0dba0e7f 100644 --- a/packages/cli/binding/src/cli/handler.rs +++ b/packages/cli/binding/src/cli/handler.rs @@ -64,6 +64,7 @@ impl CommandHandler for VitePlusCommandHandler { // Check is a composite command (fmt + lint) — run as a subprocess in task scripts Ok(HandledCommand::Synthesized(command.to_synthetic_plan_request( UserCacheConfig::with_config(EnabledCacheConfig { + replay_logs: None, env: Some(Box::new([Str::from("OXLINT_TSGOLINT_PATH")])), untracked_env: None, input: Some(check_cache_inputs()), diff --git a/packages/cli/binding/src/cli/resolver.rs b/packages/cli/binding/src/cli/resolver.rs index 578d525834..6ebd4676fa 100644 --- a/packages/cli/binding/src/cli/resolver.rs +++ b/packages/cli/binding/src/cli/resolver.rs @@ -107,6 +107,7 @@ impl SubcommandResolver { .chain(args.into_iter().map(Str::from)) .collect(), cache_config: UserCacheConfig::with_config(EnabledCacheConfig { + replay_logs: None, env: Some(Box::new([Str::from("OXLINT_TSGOLINT_PATH")])), untracked_env: None, input: None, @@ -143,6 +144,7 @@ impl SubcommandResolver { .chain(args.into_iter().map(Str::from)) .collect(), cache_config: UserCacheConfig::with_config(EnabledCacheConfig { + replay_logs: None, env: None, untracked_env: None, input: None, @@ -172,6 +174,7 @@ impl SubcommandResolver { // vite's `ignoreInput`/`ignoreOutput`/`getEnv`/`getEnvs` refine // the fingerprint at runtime. cache_config: UserCacheConfig::with_config(EnabledCacheConfig { + replay_logs: None, env: None, untracked_env: None, input: None, @@ -198,6 +201,7 @@ impl SubcommandResolver { program: Arc::from(OsStr::new("node")), args: iter::once(Str::from(js_path_str)).chain(vitest_args).collect(), cache_config: UserCacheConfig::with_config(EnabledCacheConfig { + replay_logs: None, env: None, untracked_env: None, input: Some(vec![ @@ -226,6 +230,7 @@ impl SubcommandResolver { .chain(args.into_iter().map(Str::from)) .collect(), cache_config: UserCacheConfig::with_config(EnabledCacheConfig { + replay_logs: None, env: None, untracked_env: None, input: Some(build_pack_cache_inputs()), @@ -284,6 +289,7 @@ impl SubcommandResolver { .chain(args.into_iter().map(Str::from)) .collect(), cache_config: UserCacheConfig::with_config(EnabledCacheConfig { + replay_logs: None, env: None, untracked_env: None, input: None, diff --git a/packages/cli/src/run-config.ts b/packages/cli/src/run-config.ts index cd780fce5b..c8e39c0432 100644 --- a/packages/cli/src/run-config.ts +++ b/packages/cli/src/run-config.ts @@ -50,6 +50,10 @@ dependsOn?: Array, } & ({ * Whether to cache the task */ cache?: true, +/** + * Whether to replay cached stdout/stderr on cache hits. + */ +replayLogs?: boolean, /** * Environment variable names to be fingerprinted and passed to the task. */