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
107 changes: 68 additions & 39 deletions Cargo.lock

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,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 = "9ba4cc93379cf2d7a6c7e657285bb8a00e8339dc" }
fspy = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "8db455ef9c2b1c7b33cf70d8ba370c1f2c49d4c9" }
futures = "0.3.31"
futures-util = "0.3.31"
glob = "0.3.2"
Expand Down Expand Up @@ -308,16 +308,16 @@ vp_setup = { path = "crates/vp_setup" }
vp_shared = { path = "crates/vp_shared" }
vp_static_config = { path = "crates/vp_static_config" }
vp_toolchain = { path = "crates/vp_toolchain" }
vt = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "9ba4cc93379cf2d7a6c7e657285bb8a00e8339dc" }
vt_casefold = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "9ba4cc93379cf2d7a6c7e657285bb8a00e8339dc" }
vt_path = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "9ba4cc93379cf2d7a6c7e657285bb8a00e8339dc" }
vt_powershell = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "9ba4cc93379cf2d7a6c7e657285bb8a00e8339dc" }
vt_pty_terminal_test = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "9ba4cc93379cf2d7a6c7e657285bb8a00e8339dc" }
vt_pty_terminal_test_client = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "9ba4cc93379cf2d7a6c7e657285bb8a00e8339dc" }
vt_select = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "9ba4cc93379cf2d7a6c7e657285bb8a00e8339dc" }
vt_snapshot_test = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "9ba4cc93379cf2d7a6c7e657285bb8a00e8339dc" }
vt_str = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "9ba4cc93379cf2d7a6c7e657285bb8a00e8339dc" }
vt_workspace = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "9ba4cc93379cf2d7a6c7e657285bb8a00e8339dc" }
vt = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "8db455ef9c2b1c7b33cf70d8ba370c1f2c49d4c9" }
vt_casefold = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "8db455ef9c2b1c7b33cf70d8ba370c1f2c49d4c9" }
vt_path = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "8db455ef9c2b1c7b33cf70d8ba370c1f2c49d4c9" }
vt_powershell = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "8db455ef9c2b1c7b33cf70d8ba370c1f2c49d4c9" }
vt_pty_terminal_test = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "8db455ef9c2b1c7b33cf70d8ba370c1f2c49d4c9" }
vt_pty_terminal_test_client = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "8db455ef9c2b1c7b33cf70d8ba370c1f2c49d4c9" }
vt_select = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "8db455ef9c2b1c7b33cf70d8ba370c1f2c49d4c9" }
vt_snapshot_test = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "8db455ef9c2b1c7b33cf70d8ba370c1f2c49d4c9" }
vt_str = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "8db455ef9c2b1c7b33cf70d8ba370c1f2c49d4c9" }
vt_workspace = { git = "https://github.com/voidzero-dev/vite-task.git", rev = "8db455ef9c2b1c7b33cf70d8ba370c1f2c49d4c9" }
walkdir = "2.5.0"
webpki-root-certs = "1.0.9"
which = "8.0.6"
Expand Down
1 change: 1 addition & 0 deletions crates/vp_command/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ publish = false
rust-version.workspace = true

[dependencies]
bitflags = { workspace = true }
fspy = { workspace = true }
tokio = { workspace = true }
tokio-util = { workspace = true }
Expand Down
29 changes: 22 additions & 7 deletions crates/vp_command/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use std::{
process::{ExitStatus, Stdio},
};

use fspy::AccessMode;
use bitflags::bitflags;
use tokio::process::Command;
use tokio_util::sync::CancellationToken;
use vp_error::Error;
Expand All @@ -23,6 +23,19 @@ mod ps1_shim;

pub use ps1_shim::rewrite_cmd_to_powershell;

bitflags! {
/// File-system operations observed for one path.
///
/// fspy reports each operation as its own access. This set combines the
/// operations that touched the same workspace-relative path.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct AccessMode: u8 {
const READ = 1;
const WRITE = 1 << 1;
const READ_DIR = 1 << 2;
}
}

/// Result of running a command with fspy tracking.
#[derive(Debug)]
pub struct FspyCommandResult {
Expand Down Expand Up @@ -268,8 +281,13 @@ where
let mut path_accesses = HashMap::<RelativePathBuf, AccessMode>::new();
for access in tracked_accesses.iter() {
tracing::debug!("Path access: {:?}", access);
let relative_path = access
.path
let (ipc_path, mode) = match access {
fspy::PathAccess::Read(path) => (path, AccessMode::READ),
fspy::PathAccess::Write(path) => (path, AccessMode::WRITE),
fspy::PathAccess::ReadWrite(path) => (path, AccessMode::READ | AccessMode::WRITE),
fspy::PathAccess::ReadDir(path) => (path, AccessMode::READ_DIR),
};
let relative_path = ipc_path
.strip_path_prefix(cwd, |strip_result| {
let Ok(stripped_path) = strip_result else {
return None;
Expand All @@ -286,10 +304,7 @@ where
let Some(relative_path) = relative_path else {
continue;
};
path_accesses
.entry(relative_path)
.and_modify(|mode| *mode |= access.mode)
.or_insert(access.mode);
path_accesses.entry(relative_path).and_modify(|existing| *existing |= mode).or_insert(mode);
}

Ok(FspyCommandResult { status: termination.status, path_accesses })
Expand Down
1 change: 0 additions & 1 deletion packages/cli/binding/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ async-trait = { workspace = true }
base64-simd = { workspace = true }
clap = { workspace = true, features = ["derive"] }
cow-utils = { workspace = true }
fspy = { workspace = true }
rustc-hash = { workspace = true }
napi = { workspace = true }
napi-derive = { workspace = true }
Expand Down
3 changes: 1 addition & 2 deletions packages/cli/binding/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use std::{collections::HashMap, path::PathBuf};

use fspy::AccessMode;
use napi::{anyhow, bindgen_prelude::*};
use napi_derive::napi;
use vp_command::run_command_with_fspy;
use vp_command::{AccessMode, run_command_with_fspy};
use vt_path::AbsolutePathBuf;

/// Build documentation links with the same compiled origin as the native CLI.
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/migration/__tests__/oxlint-extends.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ describe('Oxlint JSON extends migration', () => {
});

afterEach(() => {
fs.rmSync(project, { recursive: true, force: true });
// Windows can keep the temp directory locked briefly after Vite loads the config.
fs.rmSync(project, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 });
});

it('resolves nested JSONC paths relative to each declaring file and retains inheritance order', async () => {
Expand Down
Loading