A task input for its package's locked dependencies, so a lockfile edit misses only the tasks whose dependencies moved
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 28/100
- Issue-Typ
- Feature
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- rust, yaml
- Bereich
- build-system, tooling
Rechercherichtung
Start with the cache input handling and lockfile parsing paths; the issue does not name source files or tests, so locate those entry points first. Read the existing input documentation and inspect how task fingerprints are built, then trace how workspace lockfile entries represent transitive, peer-qualified, optional, and workspace dependencies. Done means a declared input hashes only the task package's resolved dependency closure and fails when a required lockfile entry is missing.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Written by an AI agent (Claude) on behalf of @jasonkuhrt.
Summary
A cached task cannot say "I depend on my package's installed dependencies" in a way that is both correct and stable. Each setting available today either replays a stale result or misses for a change the task never depended on.
This asks for one more input kind: a hash of the task's own package's resolved dependency closure, read from the lockfile. Turborepo has the same thing as each task's external_deps_hash.
What happens today
Two packages. a depends on is-odd through the catalog, and b depends on left-pad.
# pnpm-workspace.yaml
packages:
- packages/*
catalog:
is-odd: 3.0.1
// packages/a/package.json
{ "name": "a", "type": "module", "dependencies": { "is-odd": "catalog:" } }
// packages/b/package.json
{ "name": "b", "type": "module", "dependencies": { "left-pad": "1.3.0" } }
// packages/a/build.mjs
import isOdd from 'is-odd';
console.log('a built', isOdd(3));
// packages/a/vite.config.ts
import { defineConfig } from 'vite-plus';
export default defineConfig({
run: {
tasks: {
build: { command: 'node build.mjs', cache: { input: INPUT } },
check: { command: 'vp lint build.mjs', cache: { input: [{ auto: true }] } },
},
},
});
Each run below starts from a warm cache, then makes one change and runs vp install (vp 1.3.0, pnpm 10.18.0, macOS):
INPUT |
Change | Result |
|---|---|---|
[{ auto: true }], the default |
vp install --force, which changes nothing |
check: cache miss: 'node_modules/.modules.yaml' modified |
[{ auto: true }, '!node_modules/**'], the docs' example |
catalog is-odd: 3.0.1 → 2.0.0 |
build: cache hit, replaying output built against is-odd 3.0.1 |
the docs' example plus { pattern: 'pnpm-lock.yaml', base: 'workspace' } |
b's left-pad 1.3.0 → 1.2.0 |
build: cache miss: 'pnpm-lock.yaml' modified |
- Default: tracking is exact for a plain script:
buildreplays afterb's bump and misses aftera's. But any command that loads a config reads pnpm's install metadata, so it misses after every reinstall (voidzero-dev/vite-plus#2845). - Excluding
node_modules: this takes dependencies out of the key entirely. A task's fingerprint is its cwd, program, args and envs (SpawnFingerprint), with no dependency component. - Naming the lockfile: this puts dependencies back, but as one file for the whole workspace. Every task that names it misses on every lockfile edit.
In our monorepo (138 packages), build-like tasks use the third setting. Over one week, 2,011 of the 4,673 misses whose reason was pnpm-lock.yaml (43%) were for packages whose resolved dependencies had not changed.
Proposal
A declared input whose content is the task's package's resolved dependency closure. Shape and name are yours to pick; for example:
cache: { input: [{ auto: true }, '!node_modules/**', { dependencies: 'locked' }] }
The closure is what the package's lockfile entry reaches:
- each dependency's specifier and resolved version;
- transitively, every resolved package those reach, including peer-qualified variants and optional dependencies;
- workspace dependencies, followed through their own lockfile entries;
- the catalog, override and patch entries that reach any of them.
With that input, b's bump replays a's build and the catalog bump misses it. A lockfile entry the closure needs but cannot find should fail the run, not silently hash less.
Prior art
- Turborepo adds
external_deps_hashto each task's hash (turborepo-hash). It computes the value from per-package closures (all_transitive_closures) for npm, pnpm, Yarn and Bun lockfiles. - Nx hashes the versions of the external packages a project's source imports, and its
externalDependenciesinput adds the tools a command runs (docs).
How we work around it
We built this outside Vite Task:
- A
pnpm-lock.yamlparser computes each package's closure by the rules above. - A root task writes one hash file per package.
- Each task depends on that root task and declares its own package's hash file as an input.
It works, but every consumer needs an extra dependency edge, and every workspace that wants this has to re-implement the lockfile's semantics. We're happy to share the closure rules, or to open a PR if you want this approach.
- Vorherrschende Sprache
- Rust
- Sterne
- 480
- Forks
- 50
- Ø Merge
- 1 T. 3 Std.
- Gemergte PRs (30 T.)
- 62
Entwicklungsumgebung
Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus voidzero-dev/vite-task
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 58/100
voidzero-dev/vite-task#886 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 45/100
voidzero-dev/vite-task#884 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 72/100
voidzero-dev/vite-task#881 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
voidzero-dev/vite-task#879 ·
Maintainer antworten meist innerhalb von 1 Tag
-
vp run hangs after a failure when a cancelled task's detached descendant holds its IPC connectionOffen
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
voidzero-dev/vite-task#878 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in voidzero-dev/vite-task
Ähnliche Issues
-
bug priority: P3 ready-for-agent
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
shep-pm/shep-kelpie#1332 ·
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
ramensoftware/windhawk#1156 · 2 Kommentare ·
-
units: No `#` in rustdoc headingEvtl. vergeben Ein verknüpfter Pull Request ist offen oder bereits gemergt. Offen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 67/100
rust-bitcoin/rust-bitcoin#7089 · 1 Kommentar · 1 Reaktion ·
Maintainer antworten meist innerhalb von 2 Tagen
-
phase:3
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
pchrysostomou/ananke#183 ·
Maintainer antworten meist innerhalb von 1 Tag
-
area/tools bug session-analysis
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag