aws-xray-sdk-fetch: move tsd from dependencies to devDependencies

Open Beginner friendly
#759 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
70/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Domain
tooling

Research direction

Open sdk_contrib/fetch/package.json and inspect the dependency sections and the test and test-d scripts. Move tsd to the development-only section, then run npm test and npm run test-d and verify a production install no longer includes tsd or its TypeScript tooling.

Written by the indexing model from the issue text.

Description

Summary

sdk_contrib/fetch/package.json declares tsd as a runtime dependency, but tsd is only used to run TypeScript declaration tests via the test and test-d scripts. It is never require()d by any file in lib/.

Impact

tsd@0.28.x transitively pulls in @tsd/typescript (~52 MB) plus a top-level hoisted typescript (~24 MB). Every consumer who runs npm install --production or yarn install --production ships ~80 MB of unused TypeScript compiler binaries with their application.

For AWS Lambda users specifically, this is more than an inconvenience — it can push deployments past Lambda's 250 MB unzipped layer/function limit. We hit this directly.

After installing only aws-xray-sdk-fetch@3.12.0 and its declared dependencies:

node_modules/tsd          1.3 MB
node_modules/@tsd        55   MB   (← @tsd/typescript)
node_modules/typescript  24   MB   (← hoisted via tsd → typescript)
Verification that tsd is unused at runtime

lib/fetch_p.js only requires:

const AWSXRay = require('aws-xray-sdk-core');
require('./subsegment_fetch');

grep -r "tsd" lib/ returns nothing.

Proposed fix

Move tsd from dependencies to devDependencies in sdk_contrib/fetch/package.json:

-  "dependencies": {
-    "tsd": "^0.28.1"
-  }
+  "devDependencies": {
+    ...,
+    "tsd": "^0.28.1"
+  }

tsd is invoked only via npm test and npm run test-d, both of which run in dev contexts where devDependencies are present.

Happy to open a PR if useful.

Dominant language
JavaScript
Stars
280
Forks
157
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from aws/aws-xray-sdk-node

All issues in aws/aws-xray-sdk-node

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.