Skip to content

Commit 425e3ae

Browse files
wan9chicodex
andcommitted
Revert "feat: add dependsOn package dependency selection (#467)"
This reverts commit 6296ffa. Co-authored-by: GPT-5 Codex <codex@openai.com>
1 parent da8cab0 commit 425e3ae

47 files changed

Lines changed: 54 additions & 977 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Changelog
22

3-
- **Added** Object-form `dependsOn` entries can now run a task in direct workspace dependency packages selected by package.json fields, e.g. `{ "task": "build", "from": ["dependencies", "devDependencies"] }`.
43
- **Added** First-party support for caching `vite build` with zero cache config, giving Vite projects correct cache hits out of the box ([vitejs/vite#22453](https://github.com/vitejs/vite/pull/22453)).
54
- **Added** [`@voidzero-dev/vite-task-client`](https://npmx.dev/package/@voidzero-dev/vite-task-client), allowing tools to report cache information to Vite Task at runtime so users do not need to configure it manually ([#441](https://github.com/voidzero-dev/vite-task/pull/441), [#454](https://github.com/voidzero-dev/vite-task/pull/454), [#449](https://github.com/voidzero-dev/vite-task/pull/449), [#450](https://github.com/voidzero-dev/vite-task/pull/450), [#458](https://github.com/voidzero-dev/vite-task/pull/458), [#431](https://github.com/voidzero-dev/vite-task/pull/431), [#459](https://github.com/voidzero-dev/vite-task/pull/459), [#472](https://github.com/voidzero-dev/vite-task/pull/472)).
65
- **Changed** Cached tasks now restore automatically tracked output files by default; use `output: []` to disable restoration ([#460](https://github.com/voidzero-dev/vite-task/pull/460), [#461](https://github.com/voidzero-dev/vite-task/pull/461)).

crates/vite_task/docs/boolean-flags.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This document describes how boolean flags work in `vp` commands.
99
- `--recursive` / `-r` — Run task in all packages in the workspace
1010
- `--transitive` / `-t` — Run task in the current package and its transitive dependencies
1111
- `--workspace-root` / `-w` — Run task in the workspace root package
12-
- `--ignore-depends-on` — Skip `dependsOn` dependencies
12+
- `--ignore-depends-on` — Skip explicit `dependsOn` dependencies
1313
- `--verbose` / `-v` — Show full detailed summary after execution
1414
- `--cache` / `--no-cache` — Force caching on or off for all tasks and scripts
1515

@@ -39,7 +39,7 @@ vp run build -t
3939
# Run in workspace root
4040
vp run build -w
4141

42-
# Skip dependsOn dependencies
42+
# Skip explicit dependsOn edges
4343
vp run build --ignore-depends-on
4444

4545
# Verbose output

crates/vite_task/docs/task-query.md

Lines changed: 10 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,16 @@ How `vp run` decides which tasks to run and in what order.
77
When `vp` starts, it builds two data structures from the workspace:
88

99
1. **Package graph** — which packages depend on which. Built from `package.json` dependency fields.
10-
2. **Task graph** — which tasks exist and their string-form `dependsOn` relationships. Built from `vite.config.*` and `package.json` scripts.
10+
2. **Task graph** — which tasks exist and their explicit `dependsOn` relationships. Built from `vite-task.json` and `package.json` scripts.
1111

1212
Both are built once and reused for every query, including nested `vp run` calls inside task scripts.
1313

1414
### What goes into the task graph
1515

16-
The task graph contains a node for every task in every package. String-form
17-
`dependsOn` declarations become edges in this graph:
16+
The task graph contains a node for every task in every package, and edges only for explicit `dependsOn` declarations:
1817

1918
```jsonc
20-
// packages/app/vite.config.*
19+
// packages/app/vite-task.json
2120
{
2221
"tasks": {
2322
"build": {
@@ -38,8 +37,6 @@ Task graph:
3837
```
3938

4039
Package dependency ordering (app depends on lib) is NOT stored as edges in the task graph. Why not is explained below.
41-
Object-form `dependsOn` entries are also not stored as global task graph edges;
42-
they are kept on the declaring task and expanded for each query.
4340

4441
## What happens when you run a query
4542

@@ -77,7 +74,7 @@ Given the package subgraph and a task name, we build the execution plan:
7774
1. Find which selected packages have the requested task.
7875
2. For packages that don't have it, reconnect their predecessors to their successors (skip-intermediate, explained below).
7976
3. Map the remaining package nodes to task nodes — this gives us topological ordering.
80-
4. Expand `dependsOn` from these tasks (may pull in tasks from outside the selected packages).
77+
4. Follow explicit `dependsOn` edges outward from these tasks (may pull in tasks from outside the selected packages).
8178

8279
The result is the execution plan: which tasks to run and in what order.
8380

@@ -172,14 +169,12 @@ The package subgraph is already a lightweight `DiGraphMap<PackageNodeIndex, ()>`
172169

173170
So we clone the `DiGraphMap` once and mutate the clone. We iterate the original (stable node order) while modifying the clone.
174171

175-
## `dependsOn` expansion
172+
## Explicit dependency expansion
176173

177-
After mapping the package subgraph to tasks, we expand `dependsOn` entries.
178-
String-form entries follow task graph edges and can pull in tasks from packages
179-
outside the selected set.
174+
After mapping the package subgraph to tasks, we follow explicit `dependsOn` edges from the task graph. This can pull in tasks from packages outside the selected set.
180175

181176
```jsonc
182-
// packages/app/vite.config.*
177+
// packages/app/vite-task.json
183178
{
184179
"tasks": {
185180
"build": {
@@ -193,33 +188,7 @@ If you run `vp run --filter app build`, the package subgraph contains only `app`
193188

194189
This is intentional — `dependsOn` is an explicit declaration that a task can't run without its dependency. Ignoring it would break the build. (Users can skip this with `--ignore-depends-on`.)
195190

196-
Object-form entries select direct package dependencies from the declaring task:
197-
198-
```jsonc
199-
// packages/app/vite.config.*
200-
{
201-
"tasks": {
202-
"test": {
203-
"command": "vitest run",
204-
"dependsOn": [{ "task": "build", "from": ["dependencies", "devDependencies"] }],
205-
},
206-
},
207-
}
208-
```
209-
210-
For `app#test`, this runs `build` in direct workspace dependency packages selected
211-
by the listed package.json fields. If a selected package lacks `build`, expansion
212-
walks through its matching dependency edges until it finds the nearest packages
213-
with `build`; it stops at packages that already have `build`. Supported fields
214-
are `dependencies`, `devDependencies`, and `peerDependencies`.
215-
216-
Recursive expansion comes from dependency tasks declaring their own `dependsOn`
217-
entries. For example, if `ui#build` also has `{ "task": "build", "from": "dependencies" }`,
218-
then `tokens#build` is selected while expanding `ui#build`.
219-
220-
The expansion follows `dependsOn` entries, not every topological edge.
221-
Topological ordering comes from the package subgraph — it's already baked into
222-
the task execution graph by Stage 2.
191+
The expansion only follows explicit edges, not topological ones. Topological ordering comes from the package subgraph — it's already baked into the task execution graph by Stage 2.
223192

224193
## Nested `vp run`
225194

@@ -244,7 +213,7 @@ The nested query produces its own execution subgraph, which gets embedded inside
244213
```
245214
Startup (once):
246215
workspace files ──> package graph ──> task graph
247-
(dependencies) (tasks + string dependsOn edges)
216+
(dependencies) (tasks + dependsOn edges)
248217
249218
Per query:
250219
CLI flags ──> PackageQuery
@@ -256,7 +225,7 @@ Per query:
256225
task graph ────> task execution graph
257226
(map packages to tasks,
258227
skip-intermediate reconnection,
259-
dependsOn expansion)
228+
explicit dep expansion)
260229
261230
262231
execution plan

crates/vite_task_graph/run-config.ts

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@ auto: boolean, };
88

99
export type Command = string | Array<string>;
1010

11-
export type DependencyType = "dependencies" | "devDependencies" | "peerDependencies";
12-
13-
export type DependsOnEntry = string | UserPackageDependency;
14-
15-
export type DependsOnFrom = DependencyType | Array<DependencyType>;
16-
1711
export type GlobWithBase = {
1812
/**
1913
* The glob pattern (positive or negative starting with `!`)
@@ -36,13 +30,9 @@ command: Command,
3630
*/
3731
cwd?: string,
3832
/**
39-
* Dependencies of this task.
40-
*
41-
* String entries keep same-package / `package-name#task-name` behavior.
42-
* Object entries run a task name in direct workspace dependency
43-
* packages selected by package.json dependency fields.
33+
* Dependencies of this task. Use `package-name#task-name` to refer to tasks in other packages.
4434
*/
45-
dependsOn?: Array<DependsOnEntry>, } & ({
35+
dependsOn?: Array<string>, } & ({
4636
/**
4737
* Whether to cache the task
4838
*/
@@ -105,16 +95,6 @@ scripts?: boolean,
10595
*/
10696
tasks?: boolean, };
10797

108-
export type UserPackageDependency = {
109-
/**
110-
* Task name to run in dependency packages.
111-
*/
112-
task: string,
113-
/**
114-
* Package.json dependency field or fields to use when selecting direct dependency packages.
115-
*/
116-
from: DependsOnFrom, };
117-
11898
export type RunConfig = {
11999
/**
120100
* Root-level cache configuration.

crates/vite_task_graph/src/config/mod.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ use rustc_hash::FxHashSet;
77
use serde::Serialize;
88
pub use user::{
99
AutoTracking, Command, EnabledCacheConfig, GlobWithBase, InputBase, ResolvedGlobalCacheConfig,
10-
UserCacheConfig, UserDependencyType, UserDependsOnEntry, UserDependsOnFrom,
11-
UserGlobalCacheConfig, UserInputEntry, UserInputsConfig, UserOutputEntry,
12-
UserPackageDependency, UserRunConfig, UserTaskConfig, UserTaskDefinition,
10+
UserCacheConfig, UserGlobalCacheConfig, UserInputEntry, UserInputsConfig, UserOutputEntry,
11+
UserRunConfig, UserTaskConfig, UserTaskDefinition,
1312
};
1413
use vite_path::AbsolutePath;
1514
use vite_str::Str;
@@ -26,8 +25,7 @@ use crate::config::user::UserTaskOptions;
2625
/// For example, `cwd` is resolved to absolute ones (no external factor can change it),
2726
/// but `command` is not parsed into program and args yet because environment variables in it may need to be expanded.
2827
///
29-
/// `depends_on` is not included here because string-form entries are represented by task graph
30-
/// edges, and package dependency entries are stored separately on the indexed task graph.
28+
/// `depends_on` is not included here because it's represented by the edges of the task graph.
3129
#[derive(Debug, Serialize)]
3230
pub struct ResolvedTaskConfig {
3331
/// The command or commands to run for this task.

0 commit comments

Comments
 (0)