-
Notifications
You must be signed in to change notification settings - Fork 169
feat(task): add cache fingerprint ignore patterns #214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
fengmk2
merged 4 commits into
main
from
10-09-feat_task_support_cache_fingerprint_ignore_patterns
Oct 13, 2025
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
491 changes: 491 additions & 0 deletions
491
crates/vite_task/docs/rfc-cache-fingerprint-ignore-patterns.md
Large diffs are not rendered by default.
Oops, something went wrong.
55 changes: 55 additions & 0 deletions
55
crates/vite_task/fixtures/fingerprint-ignore-test/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| # Fingerprint Ignore Test Fixture | ||
|
|
||
| This fixture demonstrates the `fingerprintIgnores` feature for cache fingerprint calculation. | ||
|
|
||
| ## Task Configuration | ||
|
|
||
| The `create-files` task in `vite-task.json` uses the following ignore patterns: | ||
|
|
||
| ```json | ||
| { | ||
| "fingerprintIgnores": [ | ||
| "node_modules/**/*", | ||
| "!node_modules/**/package.json", | ||
| "dist/**/*" | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| ## Behavior | ||
|
|
||
| With these ignore patterns: | ||
|
|
||
| 1. **`node_modules/**/*`** - Ignores all files under `node_modules/` | ||
| 2. **`!node_modules/**/package.json`** - BUT keeps `package.json` files (negation pattern) | ||
| 3. **`dist/**/*`** - Ignores all files under `dist/` | ||
|
|
||
| ### Cache Behavior | ||
|
|
||
| - ✅ Cache **WILL BE INVALIDATED** when `node_modules/pkg-a/package.json` changes | ||
| - ❌ Cache **WILL NOT BE INVALIDATED** when `node_modules/pkg-a/index.js` changes | ||
| - ❌ Cache **WILL NOT BE INVALIDATED** when `dist/bundle.js` changes | ||
|
|
||
| This allows caching package installation tasks where only dependency manifests (package.json) matter for cache validation, not the actual implementation files. | ||
|
|
||
| ## Example Usage | ||
|
|
||
| ```bash | ||
| # First run - task executes | ||
| vite run create-files | ||
|
|
||
| # Second run - cache hit (all files tracked in fingerprint remain the same) | ||
| vite run create-files | ||
|
|
||
| # Modify node_modules/pkg-a/index.js | ||
| echo 'modified' > node_modules/pkg-a/index.js | ||
|
|
||
| # Third run - still cache hit (index.js is ignored) | ||
| vite run create-files | ||
|
|
||
| # Modify node_modules/pkg-a/package.json | ||
| echo '{"name":"pkg-a","version":"2.0.0"}' > node_modules/pkg-a/package.json | ||
|
|
||
| # Fourth run - cache miss (package.json is NOT ignored due to negation pattern) | ||
| vite run create-files | ||
| ``` |
4 changes: 4 additions & 0 deletions
4
crates/vite_task/fixtures/fingerprint-ignore-test/package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "name": "@test/fingerprint-ignore", | ||
| "version": "1.0.0" | ||
| } |
13 changes: 13 additions & 0 deletions
13
crates/vite_task/fixtures/fingerprint-ignore-test/vite-task.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| { | ||
| "tasks": { | ||
| "create-files": { | ||
| "command": "mkdir -p node_modules/pkg-a && echo '{\"name\":\"pkg-a\"}' > node_modules/pkg-a/package.json && echo 'content' > node_modules/pkg-a/index.js && mkdir -p dist && echo 'output' > dist/bundle.js", | ||
| "cacheable": true, | ||
| "fingerprintIgnores": [ | ||
| "node_modules/**/*", | ||
| "!node_modules/**/package.json", | ||
| "dist/**/*" | ||
| ] | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.