feat: refactor code for nodejs and workers that allows for faster proces#2
Merged
rajatkumar merged 8 commits intomainfrom Jun 9, 2025
Merged
feat: refactor code for nodejs and workers that allows for faster proces#2rajatkumar merged 8 commits intomainfrom
rajatkumar merged 8 commits intomainfrom
Conversation
Contributor
rajatkumar
commented
Jun 9, 2025
- Added CLI improvements using the commander library
- Enhanced pixel matching functionality with new options
- Added support for worker-based processing for large images
- Improved anti-aliasing detection and handling
- Added new benchmarking capabilities
- Added worker-based processing for large images
- Improved pixel comparison algorithms
- Enhanced color difference calculations
Releases: @sitepager/pixel-match@0.2.0 [skip ci]
There was a problem hiding this comment.
Pull Request Overview
This PR refactors and enhances the pixel-level image comparison library by introducing worker-based processing, CLI improvements via the commander library, and improved build configurations to support multiple targets (browser and Node.js).
- Updated tsup build configuration for separate browser, Node.js, and CLI targets
- Refactored worker implementations and consolidated test suites for both small and large images
- Revised documentation, benchmarks, and package exports for clearer usage in both environments
Reviewed Changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tsup.config.ts | Updated build targets; commented out CLI shebang for potential cross-platform concerns |
| test/* | Refactored and consolidated test utilities and removed legacy test file |
| src/worker.ts & src/node/* | Added and updated worker implementations for parallel image processing |
| src/browser/index.ts | Refactored browser entry with updated options handling |
| package.json | Modified exports and dependency versions; added commander |
| bench/* | Updated benchmark scripts to use shared utilities and new exports |
| README.md | Revised CLI usage, examples, and documentation for browser vs Node.js patterns |
| CHANGELOG.md | Updated version and change log details |
Comments suppressed due to low confidence (2)
package.json:14
- [nitpick] The type definitions for the browser and Node.js builds use different file extensions ('.d.ts' vs '.d.mts'); please verify that this is intentional so that consumers receive the correct type declarations.
"types": "./dist/browser/index.d.ts",
README.md:165
- [nitpick] Consider adding an import statement for 'createWriteStream' (e.g., import { createWriteStream } from 'fs') in the Node.js usage example to ensure the snippet is self-contained.
output.pack().pipe(createWriteStream('diff.png'));
| skipNodeModulesBundle: true, | ||
| banner: { | ||
| js: '#! /usr/bin/env node', | ||
| // js: '#! /usr/bin/env node', |
There was a problem hiding this comment.
The shebang for the CLI binary is commented out; if this was unintentional, please ensure the CLI script remains executable in Unix environments. Otherwise, document the alternative approach that replaces this behavior.
Suggested change
| // js: '#! /usr/bin/env node', | |
| js: '#! /usr/bin/env node', |
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.