-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Description
Currently, the Mindee Node.js SDK requires heavy native dependencies (sharp
, node-poppler
, pdf.js-extract
) for PDF and image compression. These are installed by default, even if the consuming project does not use any compression features. This increases install time, package size, and causes compatibility issues on some environments (especially with native bindings).
Expected Behavior
• The SDK should not require sharp
, node-poppler
, or pdf.js-extract
unless the compression features are explicitly used.
• Ideally, compression should be implemented as an optional plugin, peer dependency, or loaded dynamically.
• If compression is not available, the SDK should gracefully fallback (no-op or informative error).
Proposed Solution
• Refactor the SDK so that:
▫ Compression logic is isolated in a separate file/module.
▫ Dependencies (sharp
, node-poppler
, pdf.js-extract
) are either optional peer dependencies or moved to a plugin.
▫ The main SDK package can be installed and used without these dependencies.
▫ If a user tries to call compression without the deps, throw a clear error or do nothing.
Benefits
• Faster installation and smaller package size for most users.
• Fewer native dependency issues.
• Easier integration in environments where native modules are problematic (e.g., serverless, Docker, Windows).