mirror of
https://github.com/SillyTavern/transformers.js.git
synced 2026-10-15 18:12:06 +00:00
[PR #1] [MERGED] Replace sharp dependency with jimp 1.6.0 #2
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
SillyTavern/transformers.js#2
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/SillyTavern/transformers.js/pull/1
Author: @Copilot
Created: 3/13/2026
Status: ✅ Merged
Merged: 3/15/2026
Merged by: @Cohee1207
Base:
main← Head:copilot/replace-sharp-with-jimp📝 Commits (3)
bb4e49cInitial plan550597fReplace sharp dependency with jimp 1.6.068f29bfAddress code review comments with clarifying comments📊 Changes
8 files changed (+680 additions, -369 deletions)
View changed files
📝
packages/transformers/docs/source/tutorials/next-ai-sdk.md(+1 -1)📝
packages/transformers/docs/source/tutorials/next.md(+2 -2)📝
packages/transformers/package.json(+1 -1)📝
packages/transformers/scripts/build/constants.mjs(+2 -2)📝
packages/transformers/scripts/build/plugins/ignoreModulesPlugin.mjs(+4 -1)📝
packages/transformers/src/utils/image.js(+67 -84)📝
pnpm-lock.yaml(+603 -277)📝
pnpm-workspace.yaml(+0 -1)📄 Description
Replaces the native
sharpimage processing library withjimp@1.6.0, a pure JavaScript alternative that requires no native compilation.src/utils/image.jsimport sharp→import { Jimp, ResizeStrategy } from 'jimp'loadImageFunctionreturns RGBA (4 channels, same as browser path); callers.convert()back to original channel countfromBlob:Jimp.fromBuffer()replacessharp(buffer)resize:img.resize({w, h, mode})withResizeStrategyenum replaces.affine()/.resize(). Lanczos falls back to bicubic (jimp has no lanczos kernel).pad: composite onto a new largerJimpinstance replaces.extend()crop/center_crop:img.crop()replaces.extract(); padding cases usecomposite()+crop()save:img.write(path)replaces.toFile(path)toSharp()→toJimp(): converts to RGBA via.clone().rgba()thenJimp.fromBitmap()Build config
constants.mjs:sharp→jimpinNODE_EXTERNAL_MODULESandWEB_IGNORE_MODULESignoreModulesPlugin.mjs: stub exportsJimpandResizeStrategynamed exports for web buildsDocs & workspace
serverComponentsExternalPackagesupdatedpnpm-workspace.yaml: removedsharpfromonlyBuiltDependencies💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.