Huge untreeshakable size increase due to `undici`
Describe the bug
@actions/http-client and all the packages like @actions/core are now shipping huge amounts of more JavaScript due to the inclusion of undici in a way that is not tree-shakable. Importing any simple function from @actions/core results in the bloat.
This has happened in the recent versions only. It seems the way undici is used results
To Reproduce Bundle @actions/http-client using a bundler like Parcel
Expected behavior Make the dependencies tree-shakable and lazy lodable via dynamic imports
Screenshots
Here's the bundling result in setup-cpp:
After updating the version (625 KB minified). Notice all the undici addition:
dist/legacy/setup-cpp.js 625.86 KB 1.23s
├── Code from unknown sourcefiles 84.02 KB 0ms
├── node_modules/undici/lib/llhttp/llhttp-wasm.js 72.23 KB 119ms
├── node_modules/undici/lib/llhttp/llhttp_simd-wasm.js 72.21 KB 119ms
├── node_modules/undici/lib/client.js 25.49 KB 141ms
├── node_modules/@actions/tool-cache/node_modules/semver/semver.js 18.09 KB 149ms
├── node_modules/undici/lib/fetch/index.js 16.29 KB 140ms
├── node_modules/undici/lib/fetch/request.js 9.18 KB 127ms
├── node_modules/@actions/http-client/src/index.ts 9.09 KB 0ms
├── node_modules/undici/lib/fetch/util.js 7.78 KB 114ms
└── node_modules/undici/lib/cache/cache.js 7.2 KB 105ms
└── + 355 more assets
Before updating (237 KB minified)
dist/legacy/setup-cpp.js 237.83 KB 841ms
Related to #1560 https://github.com/actions/toolkit/pull/1561
My bundle is now 1901kB and I only include @octokit/action and @actions/core. I think that there's huge margin for improvement here.