aws-xray-sdk-fetch: move tsd from dependencies to devDependencies
- Dominant language
- JavaScript
- Stars
- 280
- Forks
- 157
- PR merge metrics
- No merged PRs in 30d
Description
### Summary
`sdk_contrib/fetch/package.json` declares [`tsd`](https://github.com/SamVerschueren/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:
```js
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`:
```diff
- "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.
Contributor guide
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.
Assessment
- Tech stack
- javascript, typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 70/100