-
Notifications
You must be signed in to change notification settings - Fork 22
Remove sharp, jsdom, node-canvas #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR removes dependencies on sharp, jsdom, and node-canvas by replacing them with custom implementations to reduce the dependency footprint and improve cross-platform compatibility.
- Replaces sharp image processing with a custom WebP encoder compiled to WASM
- Replaces jsdom and node-canvas with minimal stubs for browser APIs
- Updates build configuration to exclude the removed dependencies
Reviewed Changes
Copilot reviewed 10 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/writers/write-sog.ts | Replaces sharp WebP encoding with custom WebpEncoder and adds file writing utility |
| src/utils/webp.ts | Implements new WebpEncoder class using WASM-compiled libwebp |
| src/process.ts | Renames process function to processDataTable to avoid naming conflicts |
| src/index.ts | Updates imports to use renamed processDataTable function |
| src/gpu/gpu-device.ts | Replaces jsdom with minimal stubs for window, document, and canvas APIs |
| rollup.config.mjs | Removes sharp and jsdom from external dependencies |
| package.json | Removes canvas, jsdom, and sharp dependencies; adds lib/ to files |
| lib/webp_encode.mjs | Adds WASM-compiled WebP encoder module |
| lib/webp_encode.c | Adds C source code for WebP encoding functions |
| lib/BUILD.md | Adds build instructions for the WebP WASM module |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool indeed!
This PR:
This results in no functionality change, but means we have a smaller dependency footprint resulting in (hopefully) fewer issues across the various platforms.
Also might help with bundling to binary.