You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Motivation
Stacked on #478 (the revert of the query-time implementation).
Object-form `dependsOn` entries — `{ "task": "build", "from": ["dependencies", "devDependencies"] }` — run a task in the direct workspace packages listed under a package.json dependency field. The previous implementation (#467/#469, reverted in #478) expanded these at query time, so the selections never appeared in the global task graph.
This reimplements the feature at **graph-load time**: each object entry is resolved against the package dependency graph and the matching `package#task` selections become ordinary task graph edges (`add_package_dependency_edges`). Because they are now plain edges:
- they appear in the global task graph, and
- they flow through the existing dependency machinery for free — including `--ignore-depends-on`, which drops them at query time like any other `dependsOn` edge.
Only direct dependencies are followed, and an edge is added only when the dependency package actually defines the task. Supported fields are `dependencies`, `devDependencies`, and `peerDependencies`.
## Snapshot coverage
Because the edges now live in the global task graph, the fixture asserts edge construction through the rendered `task_graph.md`: every `from` variant, recursive cross-package chains, and the exclusion of peer-only and missing-task dependencies are all visible there. The only behavior the static graph cannot express — `--ignore-depends-on` removing the materialized edges at query time — is kept as the single per-case plan snapshot. The other four per-case snapshots in the original change were redundant re-assertions of edges already shown in `task_graph.md`, so they were dropped.
## Behavior note vs #467/#469
The reverted query-stage impl also preserved ordering *among* the sibling dependency tasks selected by a single object `dependsOn` (e.g. `ui#build → shared#build` when `app#test` selected both and `ui` depends on `shared`), scoped to that one query's execution graph. The graph-stage model intentionally does not: every edge here is global, and a global `ui#build → shared#build` edge would make a plain `vp run ui#build` also build `shared`, contradicting vp's rule that topological ordering applies only with `-r`/`-t`. Ordering among selected dependencies instead comes from each task declaring its own `dependsOn` (the recursive-expansion path documented in `task-query.md`).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01QowxsN8vDKKbQdaSMdxL67
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,7 @@
1
1
# Changelog
2
2
3
3
-**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)).
4
+
-**Added** Object-form `dependsOn` entries for direct workspace dependencies ([#479](https://github.com/voidzero-dev/vite-task/pull/479)).
4
5
-**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)).
5
6
-**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)).
6
7
-**Changed** Environment values in task cache fingerprints are now stored only as SHA-256 digests, and env-related cache miss details report names without values ([#455](https://github.com/voidzero-dev/vite-task/pull/455)).
If `app` directly depends on `ui` and `shared`, and both packages have `build`,
58
+
the task graph contains:
59
+
60
+
```
61
+
app#test ──dependsOn──> ui#build
62
+
app#test ──dependsOn──> shared#build
63
+
```
64
+
65
+
Dependency packages without the requested task are skipped. Recursive expansion
66
+
comes from dependency tasks declaring their own `dependsOn` entries.
67
+
41
68
## What happens when you run a query
42
69
43
70
Every `vp run` command goes through two stages:
@@ -188,7 +215,7 @@ If you run `vp run --filter app build`, the package subgraph contains only `app`
188
215
189
216
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`.)
190
217
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.
218
+
The expansion follows explicit `dependsOn`edges, including edges materialized from object-form entries. It does not follow topological package edges. Topological ordering comes from the package subgraph — it's already baked into the task execution graph by Stage 2.
0 commit comments