Move AWS deps to optional peer dependencies#280
Open
fern-support wants to merge 4 commits intomainfrom
Open
Conversation
- Remove BedrockClient/SagemakerClient exports from main entry point - Create src/aws.ts as new subpath entry point for all AWS clients - Replace static AWS imports with lazy loading in aws-utils.ts so missing peer deps don't break non-AWS users at import time - Add src/aws.ts to .fernignore - Document new AWS usage pattern in README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Reduces install size from ~47MB to ~17MB (64% reduction) by making AWS SDK packages optional peer dependencies. Users who need Bedrock/SageMaker support install them explicitly. Also removes unused @aws-sdk/client-sagemaker dependency and updates test imports to use the new cohere-ai/aws subpath. Closes #250 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Without an exports field, TypeScript's moduleResolution: "nodenext" cannot resolve the cohere-ai/aws subpath import. Adds minimal exports for "." and "./aws" entry points. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Please: |
andrewbcohere
approved these changes
Mar 24, 2026
Comment on lines
24
to
26
| "form-data": "^4.0.4", | ||
| "form-data-encoder": "^4.1.0", | ||
| "formdata-node": "^6.0.3" |
There was a problem hiding this comment.
According to mariusa some of these can be removed?
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.
Summary
@aws-sdk/credential-providers,@aws-crypto/sha256-js,@smithy/protocol-http,@smithy/signature-v4) fromdependenciesto optionalpeerDependencies@aws-sdk/client-sagemakerdependencycohere-ai/awssubpath entry point for AWS clients (Bedrock, SageMaker)cohere-aientry pointaws-utils.tsso missing AWS deps don't crash non-AWS users at import timeInstall size reduction: ~47MB → ~17MB (64% smaller)
Closes #250
Migration
Users of AWS clients need to update their imports:
And explicitly install the AWS peer dependencies:
Test plan
require('cohere-ai')works without AWS deps installedrequire('cohere-ai/aws')exports all AWS clients🤖 Generated with Claude Code
Note
Medium Risk
Introduces a breaking import-path change for AWS clients and changes dependency resolution/loading behavior, which could surface runtime/module-resolution issues if packaging or peer deps are misconfigured.
Overview
Moves AWS signing/runtime dependencies out of main
dependenciesinto optionalpeerDependencies, and drops unused@aws-sdk/client-sagemakerto reduce install weight.Introduces a dedicated
cohere-ai/awssubpath export (src/aws.ts+package.jsonexports) and removes Bedrock/SageMaker client exports from the root entrypoint, updating tests and README usage accordingly.Updates
aws-utils.tsto lazilyrequire()AWS modules and throw a clear install hint only when AWS functionality is invoked, so importingcohere-aidoesn’t crash when AWS deps aren’t installed.Written by Cursor Bugbot for commit 999bb21. This will update automatically on new commits. Configure here.