antfu-collective / taze

🥦 A modern cli tool that keeps your deps fresh
MIT License
2.88k stars 85 forks source link

Installation size has been increased by 380% #138

Open SukkaW opened 3 months ago

SukkaW commented 3 months ago

Describe the bug

So taze@0.13.8 has an installation size of 5.06 MiB: https://packagephobia.com/result?p=taze@0.13.8

And now taze@0.16.7 has an installation size of 24.4 MiB: https://packagephobia.com/result?p=taze@0.16.7

Reproduction

https://packagephobia.com/result?p=taze@0.16.7

System Info

System:
    OS: macOS 15.0
    CPU: (12) arm64 Apple M2 Max
    Memory: 3.47 GB / 64.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.5.1 - ~/.local/state/fnm_multishells/62578_1724618462120/bin/node
    npm: 10.8.2 - ~/.local/state/fnm_multishells/62578_1724618462120/bin/npm
    pnpm: 9.9.0 - ~/.local/state/fnm_multishells/62578_1724618462120/bin/pnpm

Used Package Manager

pnpm

Validations

Contributions

SukkaW commented 3 months ago

https://npmgraph.js.org/?q=taze@0.16.7

So acorn is back, through unconfig -> importx -> mlly -> acorn.

I created a PR to drop mlly from unconfig before (https://github.com/antfu-collective/unconfig/pull/27) and now it is back. This increases installation size by 500 KiB.

Also jiti (which bundles a full Babel inside the dist) has an installation size of 1.9 MiB, and has been required by taze through unconfig -> importx -> jiti.

Also esbuild (along with its binary) has also been required through unconfig -> import -> tsx -> esbuild.

antfu commented 3 months ago

What would you suggest? In a way they are "modern" dependencies that you are likely to have installed by some other packages, on the other way, there isn't really "smaller" alternative to solve the problem (see https://github.com/antfu-collective/importx). Until someday that Node.js supports loading TS files natively without cache, we might get rid of the complexity of importx, otherwise I see we still need esbuild/jiti for correctness.

SukkaW commented 3 months ago

What would you suggest?

Previously npm-registry-fetch and npm-package-args were bundled. After they were removed and brought back they became direct dependencies again.

Let's start with re-bundling them first. This should help a lot.

SukkaW commented 3 months ago

As we discussed before, when taze is installed as a devDependency inside projects it would be fine. Since npm i -g doesn't share dependencies, the installation size matters more when using taze as a globally available cli.

SukkaW commented 2 months ago
Google Chrome 2024-09-25 03 19 44

After my two PRs, the installation size of taze has dropped by nearly 50%. IMHO we could still do better.

antfu commented 2 months ago

I'll try to reduce the size of importx later as the JITI v2 release