Top-gg-Community / node-sdk

An official module for interacting with the Top.gg API
https://topgg.js.org/
132 stars 42 forks source link

deps: replace `raw-body` with native approach #90

Open SuperchupuDev opened 2 months ago

SuperchupuDev commented 2 months ago

raw-body was used in a way that it only converted the request to a Buffer. This PR replaces usage of raw-body with a less complex, native approach, removing not just the 11 dependencies that came with raw-body, but also undici's only subdependency (that was gone after updating undici). As such this PR lowers the amount of transitive dependencies in this package from 13 down to one (1).

I've tested that this approach and the way raw-body was used both give the same output, making this a free ~40% decrease in total bundle size

Code I ran to test https://runkit.com/embed/4hcq12gepy26 ![image](https://github.com/Top-gg-Community/node-sdk/assets/53496941/2f10f863-5433-4ff3-acaf-ad3c660650d5)