diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ad7023..a05ffa8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # Change log +## 3.3.0 (2024-07-14) + +- feat(BREAKING CHANGE): remove `old` named import DEPRECATED in `v2.0.0` (2023-11-03). + If you update the package from `v1.x` to `v3.3.0` then check your code:\ + ESM + ```diff + - import { red } from 'ansis/colors'; + + import { red } from 'ansis'; + ``` + CJS + ```diff + - const { red } = require('ansis/colors'); + + const { red } = require('ansis'); + ``` +- chore: cleanup/optimize `package.json` for npm package + ## 3.2.1 (2024-07-12) - chore: reduce unpacked size by ~ 1 KB @@ -38,6 +54,8 @@ - test: add more tests - docs: improve readme + + ## 3.0.0 (2024-03-29) - feat: add detection of color spaces support: TrueColor, 256 colors, 16 colors, no color @@ -61,6 +79,22 @@ In the new major version `3.x` are removed unused styles and methods. Drop supports for Node <= `14`. Minimal supported version is `15.0.0` (Released 2020-10-20). In the theory the `v3` can works with Node`12`, but we can't test it. +### Deleted DEPRECATED named import syntax (since `v3.3.0`) + +ESM + +```diff +- import { red } from 'ansis/colors'; ++ import { red } from 'ansis'; +``` + +CJS + +```diff +- const { red } = require('ansis/colors'); ++ const { red } = require('ansis'); +``` + ### Deleted styles The `not widely supported` styles are deleted: diff --git a/README.md b/README.md index 0696194..b83676a 100644 --- a/README.md +++ b/README.md @@ -43,10 +43,15 @@ hex('#E0115F').bold.underline('TrueColor!') - Quick response to issues. - Long term support. -## π Compare & Benchmark +## βοΈ Similar packages -See the [features comparison](#compare) and [benchmarks](#benchmark) of most popular terminal colors libraries:\ -[ansis][ansis], [chalk][chalk], [kleur][kleur], [kolorist][kolorist], [colors.js][colors.js], [colorette][colorette], [picocolors][picocolors], [ansi-colors][ansi-colors], [cli-color][cli-color], [colors-cli][colors-cli]. +Most popular ANSI libraries for Node.js: + +[chalk][chalk], [kleur][kleur], [kolorist][kolorist], [colors.js][colors.js], [colorette][colorette], [picocolors][picocolors], [ansi-colors][ansi-colors], [cli-color][cli-color], [colors-cli][colors-cli] + +- β [Compare features](#compare) + +- π [Benchmarks](#benchmark) @@ -97,8 +102,8 @@ See the [features comparison](#compare) and [benchmarks](#benchmark) of most pop > #### β οΈ Warning > -> The `v3` has the **BREAKING CHANGES** (removed not widely supported styles and deprecated methods).\ -> For details see the [changelog](https://github.com/webdiscus/ansis/blob/master/CHANGELOG.md). +> The `v3` has the **BREAKING CHANGES** (removed not widely supported styles and DEPRECATIONS).\ +> For details see the [changelog](https://github.com/webdiscus/ansis/blob/master/CHANGELOG.md#v3-0-0). ## βQuestion / Feature Request / Bug @@ -696,8 +701,9 @@ npm run compare > The size of distributed code that will be loaded via `require` or `import` into your app. It's not a package size. > > **Named import**\ +> ESM\ > `import { red, green, blue } from 'lib';`\ -> or\ +> CJS\ > `const { red, green, blue } = require('lib');` > > **Naming colors** @@ -744,7 +750,7 @@ npm run demo -## Benchmark +## Benchmarks To measure performance is used [benchmark.js](https://github.com/bestiejs/benchmark.js). @@ -761,7 +767,7 @@ To measure performance is used [benchmark.js](https://github.com/bestiejs/benchm > > The real performance results of `chalk` and `ansis` in this test are very close. -### Run benchmark +### Run benchmarks ```bash git clone https://github.com/webdiscus/ansis.git @@ -945,19 +951,6 @@ c.hex('#FBA')('foo'); `npm run test` will run the unit and integration tests.\ `npm run test:coverage` will run the tests with coverage. -## Also See - -Most popular ANSI libraries for `Node.js`: - -- [colors.js][colors.js] -- [colorette][colorette] -- [picocolors][picocolors] -- [cli-color][cli-color] -- [colors-cli][colors-cli] -- [ansi-colors][ansi-colors] -- [kleur][kleur] -- [chalk][chalk] - ## License [ISC](https://github.com/webdiscus/ansis/blob/master/LICENSE) diff --git a/README.npm.md b/README.npm.md index 6194957..f4b318e 100644 --- a/README.npm.md +++ b/README.npm.md @@ -1,6 +1,6 @@
@@ -14,6 +14,10 @@ Colorize terminal with ANSI colors & styles, smaller and faster alternative to C π [Install and Quick Start](https://github.com/webdiscus/ansis#install) +β [Compare features](https://github.com/webdiscus/ansis#compare) with similar packages + +π [Benchmarks](https://github.com/webdiscus/ansis#benchmark) + π [Read full docs on GitHub](https://github.com/webdiscus/ansis) ## Usage @@ -21,26 +25,20 @@ Colorize terminal with ANSI colors & styles, smaller and faster alternative to C ```js import ansis, { red, green, black, ansi256, hex } from 'ansis'; -ansis.cyan('path/to/file') -green('Succeful!') -red`Error!` -black.bgYellow`Warning!` +ansis.cyan('file') +green('Ok') +red`Error` +black.bgYellow`Warning` ansi256(214)`Orange` -hex('#E0115F').bold.underline('TrueColor') +hex('#E0115F').bold('TrueColor') ``` -## π Compare & Benchmark - -See the [features comparison](https://github.com/webdiscus/ansis#compare) and [benchmarks](https://github.com/webdiscus/ansis#benchmark) of most popular terminal colors libraries:\ -`ansis` `chalk` `kleur` `kolorist` `colors.js` `colorette` `picocolors` `ansi-colors` `cli-color` `colors-cli`. - -## π‘ Highlights +## Highlights ![ANSI demo](https://github.com/webdiscus/ansis/raw/master/docs/img/ansis-demo.png) -- Supports ESM, CommonJS, TypeScript, Bun, Deno, Next.JS -- [Standard API](https://github.com/webdiscus/ansis#base-colors), drop-in replacement for Chalk -- Default and named import: `import ansis, { red, bold, hex } from 'ansis'` +- Supports ESM, CJS, TypeScript, Bun, Deno, Next.JS +- Named import: `import ansis, { red, bold, hex } from 'ansis'` - Chained syntax: `red.bold.underline('text')` - Nested template strings: ``` red`RED ${green`GREEN`} RED` ``` - ANSI styles: `dim` **`bold`** _`italic`_ `underline`