antfu-collective / ni

💡 Use the right package manager
MIT License
6.25k stars 208 forks source link

chore: reduce bundle size #220

Closed userquin closed 1 month ago

userquin commented 1 month ago

Description

This PR includes:

Right now ni build is failing. ni tgz file from 107KB to 77KB

We should remove agent.ts module, not being used. (agent module re-exporting pm detector stuff)

Linked Issues

Additional context

userquin commented 1 month ago

@benmccann suggests picocolors (cjs only), the size is a little smaller than yoctocolors (esm only).

ryoppippi commented 1 month ago

Created a pr using picocolors

ryoppippi commented 1 month ago

@userquin I think yoctocolors is better because yoctocolors is tree-shakable while picocolors is not

userquin commented 1 month ago

don't merge yet, I'm going to include yoctocolors and cleanup

userquin commented 1 month ago

There is no difference using picocolors or yoctocolors (tgz file):

imagen on left picocolors, on right yoctocolors

ryoppippi commented 1 month ago

@userquin Thanks

userquin commented 1 month ago

I'm going to use tinyrainbow, we're using it in Vitest

(Upps: 263 bytes bigger using tinyrainbow)

43081j commented 1 month ago

You should stick to picocolors imo and open issues upstream if you think there's a limitation

It has been adopted by most other large projects (and more to come). Think it is better to align than take yet another rehash of the same algorithm/implementation

pico is also the fastest