fix: address the code review findings - #16
Merged
Merged
Conversation
- Variant selection: an explicit `select` or `?format=` no longer inherits the implicit width, and the fallback variant of a rule is documented - Dev server addresses variants by the manifest key, so same-named images of different sources no longer serve each other's contents - Variants resolving to one file are produced once, across rules as well - EXIF orientation is applied instead of being dropped, so the variants and the reported dimensions match what a browser renders - Glob matchers normalize the path, so the same rule matches on Windows - The cli rejects unknown options instead of taking them for globs, and stops on an output path collision instead of overwriting silently - `?placeholder` keeps the configured placeholder options - The loader ships declarations without a hard `webpack` dependency, and its development names keep converted siblings apart - An aborted dev request no longer leaks a file descriptor - The preact peer range matches what the source actually needs - Rule matching and deduplication moved into `SrcSetGenerator.generateAll`
Coverage Report for CI Build 32189116961Coverage increased (+0.1%) to 91.609%Details
Uncovered Changes
Coverage Regressions3 previously-covered lines in 2 files lost coverage.
Coverage Stats
💛 - Coveralls |
Draft
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.
Fixes the defects found by a review of the whole project. One commit, no behaviour left undocumented - every fix carries a regression test.
Variant selection - the implicit
selectwas ANDed into an explicit one, so?format=webpsilently exported a jpg. The implicit defaults now apply only when nothing is selected; what the user does not pin is decided by the rule order, which the plugin and loader READMEs now state.Dev server - variants were addressed by their bare file name, so
a/logo.jpgandb/logo.jpgshared one url and served each other's bytes (and the cache thrashed between them). The dev url carries the manifest key now, while the storage stays flat:/@srcset/<key>/logo.jpgmaps to<key>-logo.jpg.Duplicate variants - widths at or above the source width resolved to one file and were encoded, stored and emitted twice, producing a duplicate
srcMapkey and two srcset candidates with onewdescriptor. Deduplication now happens after resolution, keyed by the resolved identity, and a multiplier wins a collision sooriginMultipliersurvives for the selection.EXIF orientation - the pipeline dropped the orientation tag without rotating the pixels, so variants rendered rotated and every derived number was transposed. Sources are auto-oriented and the metadata reports the size a browser renders.
Other fixes - glob matchers normalize the path (rules never matched on Windows); the cli rejects unknown options instead of taking them for globs and stops on an output path collision;
?placeholderkeeps the configured options; the loader's declarations no longer requirewebpackwhile it is an optional peer, and its development names keep converted siblings apart; an aborted dev request no longer leaks a file descriptor; the preact peer range matches what the source needs (verified against the published tarballs: rootCSSPropertieslanded in 10.28).Refactor - rule matching,
fallthroughand deduplication were duplicated in the bundler integration and the cli; they live inSrcSetGenerator.generateAllnow, together withSrcSetRuleitself.🤖 Generated with Claude Code