Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion crates/vite_task/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ fspy = { workspace = true }
futures-util = { workspace = true }
once_cell = { workspace = true }
owo-colors = { workspace = true }
petgraph = { workspace = true }
pty_terminal_test_client = { workspace = true }
rayon = { workspace = true }
rusqlite = { workspace = true, features = ["bundled"] }
rustc-hash = { workspace = true }
serde = { workspace = true, features = ["derive", "rc"] }
serde_json = { workspace = true }
smallvec.workspace = true
thiserror = { workspace = true }
tokio = { workspace = true, features = ["rt-multi-thread", "io-std", "macros", "sync"] }
tracing = { workspace = true }
Expand Down
12 changes: 6 additions & 6 deletions crates/vite_task/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use clap::Parser;
use vite_path::AbsolutePath;
use vite_str::Str;
use vite_task_graph::{TaskSpecifier, query::TaskQueryKind};
use vite_task_plan::plan_request::{PlanOptions, PlanRequest, QueryPlanRequest};
use vite_task_plan::plan_request::{PlanOptions, QueryPlanRequest};

#[derive(Debug, Clone, clap::Subcommand)]
pub enum CacheSubcommand {
Expand Down Expand Up @@ -70,16 +70,16 @@ pub enum CLITaskQueryError {
}

impl RunCommand {
/// Convert to `PlanRequest`, or return an error if invalid.
/// Convert to `QueryPlanRequest`, or return an error if invalid.
///
/// # Errors
///
/// Returns an error if `--recursive` and `--transitive` are both set,
/// or if a package name is specified with `--recursive`.
pub fn into_plan_request(
pub fn into_query_plan_request(
self,
cwd: &Arc<AbsolutePath>,
) -> Result<PlanRequest, CLITaskQueryError> {
) -> Result<QueryPlanRequest, CLITaskQueryError> {
let Self {
task_specifier,
flags: RunFlags { recursive, transitive, ignore_depends_on },
Expand Down Expand Up @@ -110,9 +110,9 @@ impl RunCommand {
include_topological_deps: transitive,
}
};
Ok(PlanRequest::Query(QueryPlanRequest {
Ok(QueryPlanRequest {
query: vite_task_graph::query::TaskQuery { kind: query_kind, include_explicit_deps },
plan_options: PlanOptions { extra_args: additional_args.into() },
}))
})
}
}
2 changes: 0 additions & 2 deletions crates/vite_task/src/session/cache/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ pub fn format_cache_status_inline(cache_status: &CacheStatus) -> Option<Str> {
let message = match reason {
CacheDisabledReason::InProcessExecution => "cache disabled: built-in command",
CacheDisabledReason::NoCacheMetadata => "cache disabled: no cache config",
CacheDisabledReason::CycleDetected => "cache disabled: cycle detected",
};
Some(vite_str::format!("⊘ {message}"))
}
Expand Down Expand Up @@ -278,7 +277,6 @@ pub fn format_cache_status_summary(cache_status: &CacheStatus) -> Str {
let message = match reason {
CacheDisabledReason::InProcessExecution => "Cache disabled for built-in command",
CacheDisabledReason::NoCacheMetadata => "Cache disabled in task configuration",
CacheDisabledReason::CycleDetected => "Cache disabled: cycle detected",
};
vite_str::format!("→ {message}")
}
Expand Down
49 changes: 10 additions & 39 deletions crates/vite_task/src/session/event.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
use std::{process::ExitStatus, time::Duration};

use bstr::BString;
use vite_str::Str;
// Re-export ExecutionItemDisplay from vite_task_plan since it's the canonical definition
pub use vite_task_plan::ExecutionItemDisplay;

use super::cache::CacheMiss;

#[derive(Debug)]
Expand All @@ -17,7 +12,6 @@ pub enum OutputKind {
pub enum CacheDisabledReason {
InProcessExecution,
NoCacheMetadata,
CycleDetected,
}

#[derive(Debug)]
Expand All @@ -34,8 +28,16 @@ pub enum CacheNotUpdatedReason {
pub enum CacheUpdateStatus {
/// Cache was successfully updated with new fingerprint and outputs
Updated,
/// Cache was not updated (with reason)
NotUpdated(CacheNotUpdatedReason),
/// Cache was not updated (with reason).
/// The reason is part of the `LeafExecutionReporter` trait contract — reporters
/// can use it for detailed logging, even if current implementations don't.
NotUpdated(
#[expect(
dead_code,
reason = "part of LeafExecutionReporter trait contract; reporters may use for detailed logging"
)]
CacheNotUpdatedReason,
),
}

#[derive(Debug)]
Expand Down Expand Up @@ -66,34 +68,3 @@ pub fn exit_status_to_code(status: ExitStatus) -> i32 {
status.code().unwrap_or(1)
}
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct ExecutionId(u32);

impl ExecutionId {
pub(crate) const fn zero() -> Self {
Self(0)
}

pub(crate) const fn next(self) -> Self {
Self(self.0.checked_add(1).expect("ExecutionId overflow"))
}
}

#[derive(Debug)]
pub struct ExecutionEvent {
pub execution_id: ExecutionId,
pub kind: ExecutionEventKind,
}

#[derive(Debug)]
#[expect(
clippy::large_enum_variant,
reason = "event variants are consumed once and not stored in collections"
)]
pub enum ExecutionEventKind {
Start { display: Option<ExecutionItemDisplay>, cache_status: CacheStatus },
Output { kind: OutputKind, content: BString },
Error { message: Str },
Finish { status: Option<ExitStatus>, cache_update_status: CacheUpdateStatus },
}
Loading