Repository navigation
feat: memo resolved config - #95
Merged
Merged
Conversation
The memo key hashed the config file and its imports, but not the values they give. A config that reads DEPLOY to pick its $site.url kept the pages of the last build when only the environment changed, so a staging build could ship production pages. The key now also hashes $site, $build, $images, and $data, with object keys sorted so an order that changes between builds does not render every page.
JSON writes a Map or a Set as {}, so a data module that changed
the entries of one kept the pages of the last build. Their entries
are now part of the key. The docs also say that a helper function
that reads the environment when a page calls it stays unseen.
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
The memo key hashed the config file and the local files that it imports, but not the values that they give. A config that reads an environment variable, such as
$site.urlfromDEPLOY, kept the pages of the last build when only the environment changed. Thus a staging build after a production build shipped production pages, unless it ran with--fresh. A data module that reads the environment or the network had the same problem.memo.key()also hashes the resolved$site,$build,$images, and$data.MapandSetare part of the hash, since JSON writes them as{}.$utilshelper that reads the environment when a page calls it, stays unseen.Performance
bun run bench incremental,mainagainst this branch, in both orders:The spread of
mainalone covers each difference: no change. The bench site has little$data. With 1.1 MB of$data, the sorted hash takes 9 ms for each build (plainJSON.stringifytakes 0.9 ms; a hand-written serializer was no faster).Test plan
main)Mapor aSetof a data module renders every pagebun run build,bun test,bunx tsc -p .,bunx tsc -p build