Skip to content

Commit

Permalink
chore(deps): remove to-readable-stream (#6685)
Browse files Browse the repository at this point in the history
The dependency was outdated. The latest version recommends using
`node:streams` `Readable.from()` to produce a nodejs stream.

Co-authored-by: Eduardo Bouças <[email protected]>
Co-authored-by: Lukas Holzer <[email protected]>
  • Loading branch information
3 people authored Jul 1, 2024
1 parent 59f8433 commit a265859
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 20 deletions.
17 changes: 0 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@
"terminal-link": "3.0.0",
"through2-filter": "4.0.0",
"through2-map": "4.0.0",
"to-readable-stream": "3.0.0",
"toml": "3.0.0",
"tomlify-j0.4": "3.0.0",
"ulid": "2.3.0",
Expand Down
4 changes: 2 additions & 2 deletions src/utils/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { readFile } from 'fs/promises'
import http, { ServerResponse } from 'http'
import https from 'https'
import { isIPv6 } from 'net'
import { Readable } from 'node:stream'
import path from 'path'
import process from 'process'
import { Duplex } from 'stream'
Expand All @@ -24,7 +25,6 @@ import { jwtDecode } from 'jwt-decode'
import { locatePath } from 'locate-path'
import { Match } from 'netlify-redirector'
import pFilter from 'p-filter'
import toReadableStream from 'to-readable-stream'
import throttle from 'lodash/throttle.js'

import { BaseCommand } from '../commands/index.js'
Expand Down Expand Up @@ -176,7 +176,7 @@ const proxyToExternalUrl = function ({
pathRewrite: () => destURL,
// hide logging
logLevel: 'warn',
...(Buffer.isBuffer(req.originalBody) && { buffer: toReadableStream(req.originalBody) }),
...(Buffer.isBuffer(req.originalBody) && { buffer: Readable.from(req.originalBody) }),
})
// @ts-expect-error TS(2345) FIXME: Argument of type 'Request' is not assignable to parameter of type 'Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>'.
return handler(req, res, () => {})
Expand Down

1 comment on commit a265859

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📊 Benchmark results

  • Dependency count: 1,212
  • Package size: 313 MB
  • Number of ts-expect-error directives: 976

Please sign in to comment.