Conversation
Add HashupCache (hashes + deps maps) plus createHashupCache() and collectReachable() helpers. hashup() gains cache?/resolver? options; config mode threads one shared pair through every named entry. Per-call files still reflect only that call's reachable closure. hashFile's cache parameter type changes from Map<string, string[]> to HashupCache — targeted break for direct hashFile callers only. hashup() itself is backward compatible. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
|
📖 Docs preview: https://maastrich.github.io/hashup/branches/pr-18/ |
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.
Summary
HashupOptionsgainscache?: HashupCacheandresolver?: Resolver. Pass them across calls to dedupe work — files imported by multiple named entries are read + hashed exactly once.createHashupCache(),collectReachable(), and theHashupCachetype.result.filescontinues to report only the current call's reachable set (entry + extras + their transitive non-node_modulesimports), walked iteratively via the newdepsmap. Accurate whether the cache is shared or not.Hash stability
Byte-identical to 0.5.0. The
48adf62a…inline snapshot intests/examples.test.tsstill matches — shared cache is a pure dedupe.Breaking
Targeted to direct
hashFilecallers: thecacheparameter type changes fromMap<string, string[]>toHashupCache.hashup()callers are unaffected — the new option is additive. Minor bump (pre-1.0).Test plan
tests/shared-cache.test.ts— cache size invariant (second identical call grows by zero), cross-entry overlap reduces total work, extras stay tracked as roots,collectReachablehandles 50k-deep chains and cycles iterativelytests/examples.test.tsinline snapshot unchangedvp test— 116/116 passingvp checkcleanToaster/index.ts🤖 Generated with Claude Code