Repository navigation
Include package.json name, main, type, exports and imports in the fingerprint - #1546
Merged
Merged
Conversation
…gerprint These fields change how Node.js resolves and loads a package, so editing them can change what a script produces even though no input file changed. The analyzer reads them from the package.json file and the fingerprint now includes them, so such edits make the script stale and miss the cache. Closes google#1315
- Add types, typings, and typesVersions. - Minor code cleanup. - Add test timeouts.
aomarks
approved these changes
Nov 4, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #1315
Changing the
exportsof a package (or itstype,main,importsorname) can change what a build produces, but Wireit didn't notice: no input file changed, so the script was skipped as fresh or restored from cache, which hid the broken build described in the issue. The only workarounds were listing the wholepackage.jsonas an input, which invalidates on every unrelated edit, or extracting fields into separate files.Following @aomarks's suggestion in the issue, the fingerprint now automatically includes the behavior-affecting fields from the Node.js package.json field definitions:
name,main,type,exportsandimports. As discussed there, the list is not configurable.How it works
PackageJsonreads the values of those fields once, when the file is analyzed.packageJsonFields.Fingerprint.computeadds them to the fingerprint data, so they are also part of the local and GitHub Actions cache keys. Because dependency fingerprints cascade, scripts that depend on the package's scripts run again too.Other fields, such as
descriptionorversion, are still ignored, so editing them doesn't cause re-runs. Since the fingerprint has a new field, each script runs once more (or misses the cache once) after upgrading.Example
{ "name": "my-lib", "exports": {".": "./lib/index.js"}, "scripts": {"build": "wireit"}, "wireit": { "build": { "command": "tsc", "files": ["src/**/*.ts"], "output": ["lib/**"] } } }Editing
exportsnow makesbuildstale, and scripts that depend onbuildrun again as well.Tests and docs
freshness.test.ts: changing each of the five fields makes the script stale, and changing another field (description) keeps it fresh.