@nkp/ansi
ANSI escape codes for styling strings in the terminal.
You probably want the higher-level chalk module for styling your strings.
Fork of ansi-styles
that supports both ESM and CommonJS.
Table of contents
Exports
@nkp/ansi
exports both CommonJS and ES modules.
Fork
@nkp/ansi
is a fork of ansi-styles
that exports both ESM and CommonJS.
In 2021 Sindre Sorhus, prolific creator and maintainer of many popular npm packages
, including some with over 150 million weekly monthly downloads, pushed a new major version of many of his packages removing CommonJS support and making them "pure ESM". This was a major breaking change. Sindre's universally popular packages were now incompatible with a large parts of the NodeJS ecosystem.
Sindre's packages could have been kept backwards compatible by producing both ESM and CJS exports, however Sindre believed he could push the NodeJS community to adopt ESM sooner by introducing breaking changes.
Personally, I plan to (migrate to Pure ESM instead of provide backwards compatibility) as I think it’s better to rip off the bandaid and push the ecosystem forward.
For many, the breaking change's haven't gone over well. Many project's now find themselves spending hours, days or even weeks trying to placate these pure EMS packages only to find too many incompatibilities and revert back.
Hence this fork. @nkp/ansi
is intended to be an functionally equivalent clone of styles-ansi
but with both ESM and CJS exports.
Installation
npm
npm install @nkp/ansi
yarn
yarn add @nkp/ansi
pnpm
pnpm add @nkp/ansi
Publishing
To a release a new version:
- Update the version number in package.json
- Push the new version to the
master
branch on GitHub - Create a
new release
on GitHub for the latest version
This will trigger a GitHub action that tests and publishes the npm package.