Skip to content

Commit 9a25819

Browse files
43081jmrstork
andauthored
chore: drop strip-ansi (#6583)
Node has this functionality built in now. Co-authored-by: Mateusz Bocian <[email protected]>
1 parent ef1cee8 commit 9a25819

File tree

5 files changed

+7
-9
lines changed

5 files changed

+7
-9
lines changed

package-lock.json

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/build/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@
113113
"safe-json-stringify": "^1.2.0",
114114
"semver": "^7.3.8",
115115
"string-width": "^7.0.0",
116-
"strip-ansi": "^7.0.0",
117116
"supports-color": "^10.0.0",
118117
"terminal-link": "^4.0.0",
119118
"ts-node": "^10.9.1",

packages/build/src/error/colors.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import stripAnsi from 'strip-ansi'
1+
import { stripVTControlCharacters } from 'node:util'
22

33
// Remove ANSI sequences from `error.message`
44
export const removeErrorColors = function (error) {
@@ -8,8 +8,8 @@ export const removeErrorColors = function (error) {
88

99
// Setting error values might fail if they are getters or are non-writable.
1010
try {
11-
error.message = stripAnsi(error.message)
12-
error.stack = stripAnsi(error.stack)
11+
error.message = stripVTControlCharacters(error.message)
12+
error.stack = stripVTControlCharacters(error.stack)
1313
} catch {
1414
// continue
1515
}

packages/build/src/error/parse/clean_stack.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import { stripVTControlCharacters } from 'node:util'
12
import { cwd } from 'process'
23

34
import cleanStack from 'clean-stack'
4-
import stripAnsi from 'strip-ansi'
55

66
// Clean stack traces:
77
// - remove our internal code, e.g. the logic spawning plugins
@@ -27,7 +27,7 @@ export const cleanStacks = function ({ stack, rawStack, debug }) {
2727

2828
const cleanStackLine = function (lines, line) {
2929
const lineA = line.replace(getCwd(), '')
30-
const lineB = stripAnsi(lineA)
30+
const lineB = stripVTControlCharacters(lineA)
3131

3232
if (!STACK_LINE_REGEXP.test(lineB)) {
3333
return `${lines}\n${lineA}`

packages/build/src/status/colors.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import stripAnsi from 'strip-ansi'
1+
import { stripVTControlCharacters } from 'node:util'
22

33
// Remove colors from statuses
44
export const removeStatusesColors = function (statuses) {
@@ -18,6 +18,6 @@ const removeAttrColor = function (status, attribute) {
1818
return {}
1919
}
2020

21-
const valueA = stripAnsi(value)
21+
const valueA = stripVTControlCharacters(value)
2222
return { [attribute]: valueA }
2323
}

0 commit comments

Comments
 (0)