From 8e83627c13ee64a0e482579f5a4bb39a599486a3 Mon Sep 17 00:00:00 2001 From: Anna Bocharova Date: Thu, 3 Oct 2024 23:25:37 +0000 Subject: [PATCH 1/2] Replacing strip-ansi with stripVTControlCharacters() from node:util. --- index.js | 4 ++-- package.json | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 8a24115..daa005a 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,4 @@ -import stripAnsi from 'strip-ansi'; +import {stripVTControlCharacters} from 'node:util'; import {eastAsianWidth} from 'get-east-asian-width'; import emojiRegex from 'emoji-regex'; @@ -17,7 +17,7 @@ export default function stringWidth(string, options = {}) { } = options; if (!countAnsiEscapeCodes) { - string = stripAnsi(string); + string = stripVTControlCharacters(string); } if (string.length === 0) { diff --git a/package.json b/package.json index cafec04..8852c96 100644 --- a/package.json +++ b/package.json @@ -53,8 +53,7 @@ ], "dependencies": { "emoji-regex": "^10.3.0", - "get-east-asian-width": "^1.0.0", - "strip-ansi": "^7.1.0" + "get-east-asian-width": "^1.0.0" }, "devDependencies": { "ava": "^5.3.1", From 0461f175c845b24ce492d7e2fce06b1d24e90d4f Mon Sep 17 00:00:00 2001 From: Anna Bocharova Date: Thu, 3 Oct 2024 23:28:16 +0000 Subject: [PATCH 2/2] Add test for Node.js v22. --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 346585c..6e98150 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,6 +10,7 @@ jobs: fail-fast: false matrix: node-version: + - 22 - 20 - 18 steps: