slice-ansi 7.1.0 → 7.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +3 -1
- package/package.json +2 -1
package/index.js
CHANGED
@@ -7,6 +7,8 @@ const ESCAPES = new Set([27, 155]);
|
|
7
7
|
const CODE_POINT_0 = '0'.codePointAt(0);
|
8
8
|
const CODE_POINT_9 = '9'.codePointAt(0);
|
9
9
|
|
10
|
+
const MAX_ANSI_SEQUENCE_LENGTH = 19;
|
11
|
+
|
10
12
|
const endCodesSet = new Set();
|
11
13
|
const endCodesMap = new Map();
|
12
14
|
for (const [start, end] of ansiStyles.codes) {
|
@@ -48,7 +50,7 @@ function findNumberIndex(string) {
|
|
48
50
|
}
|
49
51
|
|
50
52
|
function parseAnsiCode(string, offset) {
|
51
|
-
string = string.slice(offset, offset +
|
53
|
+
string = string.slice(offset, offset + MAX_ANSI_SEQUENCE_LENGTH);
|
52
54
|
const startIndex = findNumberIndex(string);
|
53
55
|
if (startIndex !== -1) {
|
54
56
|
let endIndex = string.indexOf('m', startIndex);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "slice-ansi",
|
3
|
-
"version": "7.1.
|
3
|
+
"version": "7.1.2",
|
4
4
|
"description": "Slice a string with ANSI escape codes",
|
5
5
|
"license": "MIT",
|
6
6
|
"repository": "chalk/slice-ansi",
|
@@ -10,6 +10,7 @@
|
|
10
10
|
"types": "./index.d.ts",
|
11
11
|
"default": "./index.js"
|
12
12
|
},
|
13
|
+
"sideEffects": false,
|
13
14
|
"engines": {
|
14
15
|
"node": ">=18"
|
15
16
|
},
|