feat: add unflatten handler - #248
Conversation
|
Thanks for PR dear @nathanchase. Wondering is it worth to wait for sharp feature to be stable first? Do you have some more context why it is in experimental state? |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #248 +/- ##
==========================================
- Coverage 75.00% 74.69% -0.31%
==========================================
Files 8 8
Lines 412 415 +3
Branches 109 109
==========================================
+ Hits 309 310 +1
- Misses 85 87 +2
Partials 18 18 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
I don't have any knowledge of why it's experimental. I just know that I have an immediate use case for it with https://github.com/nuxt/image to make all images with a solid white background become transparent backgrounds. I happened to notice it wasn't wired up to sharp's implementation, so this was just meant as a means of connecting to the |
|
For what it's worth, |
unflatten handler
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds ChangesUnflatten modifier
Estimated code review effort: 1 (Trivial) | ~3 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
pi0
left a comment
There was a problem hiding this comment.
Seems not experimental anymore! Thanks!
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@README.md`:
- Around line 168-169: Update the blur and unflatten rows in the operation
table: add blur’s missing fourth cell and trailing table delimiter, and mark
unflatten as experimental while preserving its existing documentation link and
example path.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 2a2b3351-5d2e-4ca4-a8df-cab5488f822d
📒 Files selected for processing (2)
README.mdsrc/handlers/handlers.ts
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
README.md (1)
192-193: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winAdd the missing comments cells to these table rows.
Lines 192-193 contain only three cells instead of the four declared by the header, so the Markdown table is malformed and may render with shifted columns. Add an empty fourth cell and trailing delimiter to both rows.
Proposed fix
-| width / w | [Docs](https://sharp.pixelplumbing.com/api-resize#resize) | `/width_200/buffalo.png` or `/w_200/buffalo.png` | -| height / h | [Docs](https://sharp.pixelplumbing.com/api-resize#resize) | `/height_200/buffalo.png` or `/h_200/buffalo.png` | +| width / w | [Docs](https://sharp.pixelplumbing.com/api-resize#resize) | `/width_200/buffalo.png` or `/w_200/buffalo.png` | | +| height / h | [Docs](https://sharp.pixelplumbing.com/api-resize#resize) | `/height_200/buffalo.png` or `/h_200/buffalo.png` | |🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@README.md` around lines 192 - 193, Add the missing empty comments cell and trailing table delimiter to both the width / w and height / h rows in the Markdown table, preserving their existing parameter, documentation, and example cells.Source: Linters/SAST tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@README.md`:
- Around line 192-193: Add the missing empty comments cell and trailing table
delimiter to both the width / w and height / h rows in the Markdown table,
preserving their existing parameter, documentation, and example cells.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: abe4c1d3-8f95-46c5-99b2-a1213ecf7d4a
📒 Files selected for processing (2)
README.mdsrc/handlers/handlers.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- src/handlers/handlers.ts
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This pull request introduces a new handler function to the
src/handlers/handlers.tsfile. The new function,unflatten, is experimental and its API may change in the future.New handler function added:
src/handlers/handlers.ts: Added theunflattenhandler, which calls theunflattenmethod on the providedpipe. This feature is marked as experimental.See https://sharp.pixelplumbing.com/api-operation#unflatten for more information.
Summary by CodeRabbit
New Features
unflattenimage-processing operation, including support as a modifier option, to help restore image data that was previously flattened.Documentation