You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Chalk has got a new version, which is now also dependency-less, lightweight, and fast. cli-color and nanocolors also had updates. In other words, the benchmarks are now very inaccurate :)
A problem one might encounter is that Chalk is now ESM-only, which makes it impossible to use in the current benchmark setup. I've tried a basic bundle using ESBuild, and it works. Here's how:
Clone chalk/chalk
In source/index.js, replace
#ansi-styles with ./vendor/ansi-styles/index.js
#supports-color with ./vendor/supports-color/index.js
Run npx esbuild source/index.js --outfile=dist/chalk.js --bundle --platform=node
Copy dist/chalk.js to picocolors' repo under benchmarks/chalk.js
Inside ./benchmarks, replace across all files
let chalk = require("chalk") with let chalk = require("./chalk").default
I could run the benchmarks on my machine, but it's slower than the one used for README, so I'm not sure if it makes sense for me to send a PR with this data...
P. S. Since many packages still use Chalk v4, I propose adding another line to the benchmarks:
I'd definitely separate chalk v4 and v5 in the benchmark stats. As for ESM/CJS, it may possibly be easier to make a separate environment for running ESM-first benchmarks
I implemented @kytta's workaround for ESM-only packages for chalk 5 and yoctocolors in #61. picocolors was dethroned by yoctocolors in the execution speed, but not in module-loading speed yet :-)
Chalk has got a new version, which is now also dependency-less, lightweight, and fast.
cli-color
andnanocolors
also had updates. In other words, the benchmarks are now very inaccurate :)A problem one might encounter is that Chalk is now ESM-only, which makes it impossible to use in the current benchmark setup. I've tried a basic bundle using ESBuild, and it works. Here's how:
chalk/chalk
source/index.js
, replace#ansi-styles
with./vendor/ansi-styles/index.js
#supports-color
with./vendor/supports-color/index.js
npx esbuild source/index.js --outfile=dist/chalk.js --bundle --platform=node
dist/chalk.js
to picocolors' repo underbenchmarks/chalk.js
./benchmarks
, replace across all fileslet chalk = require("chalk")
withlet chalk = require("./chalk").default
I could run the benchmarks on my machine, but it's slower than the one used for README, so I'm not sure if it makes sense for me to send a PR with this data...
P. S. Since many packages still use Chalk v4, I propose adding another line to the benchmarks:
$ node ./benchmarks/size.js Data from packagephobia.com chalk@4 101 kB chalk@5 41 kB cli-color 984 kB ansi-colors 25 kB kleur 21 kB colorette 17 kB nanocolors 15 kB + picocolors 7 kB
The text was updated successfully, but these errors were encountered: