@jsenv/terminal-recorder 1.0.2 → 1.1.0
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/terminal-recorder",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Record terminal output as .svg, .gif, .webm, .mp4",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -32,12 +32,13 @@
|
|
|
32
32
|
"prepublishOnly": "npm run build"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@jsenv/server": "15.2.
|
|
36
|
-
"@playwright/browser-chromium": "1.
|
|
35
|
+
"@jsenv/server": "15.2.3",
|
|
36
|
+
"@playwright/browser-chromium": "1.45.0",
|
|
37
37
|
"ansi-regex": "6.0.1",
|
|
38
38
|
"he": "1.2.0",
|
|
39
|
-
"playwright": "1.
|
|
39
|
+
"playwright": "1.45.0",
|
|
40
40
|
"strip-ansi": "7.1.0",
|
|
41
|
+
"string-width": "5.1.2",
|
|
41
42
|
"webm-to-mp4": "1.0.0"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
package/src/svg/parse_ansi.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// inspired by https://github.com/F1LT3R/parse-ansi/blob/master/index.js
|
|
2
2
|
|
|
3
3
|
import ansiRegex from "ansi-regex";
|
|
4
|
+
import stringWidth from "string-width";
|
|
4
5
|
import stripAnsi from "strip-ansi";
|
|
5
6
|
|
|
6
7
|
export const parseAnsi = (ansi) => {
|
|
@@ -219,7 +220,6 @@ export const parseAnsi = (ansi) => {
|
|
|
219
220
|
if (word === "\n") {
|
|
220
221
|
const chunk = bundle("newline", "\n");
|
|
221
222
|
result.chunks.push(chunk);
|
|
222
|
-
|
|
223
223
|
x = 0;
|
|
224
224
|
y += 1;
|
|
225
225
|
nAnsi += 1;
|
|
@@ -230,10 +230,10 @@ export const parseAnsi = (ansi) => {
|
|
|
230
230
|
if (delimiters.includes(word) === false) {
|
|
231
231
|
const chunk = bundle("text", word);
|
|
232
232
|
result.chunks.push(chunk);
|
|
233
|
-
|
|
234
|
-
x +=
|
|
235
|
-
nAnsi +=
|
|
236
|
-
nPlain +=
|
|
233
|
+
const width = stringWidth(word);
|
|
234
|
+
x += width;
|
|
235
|
+
nAnsi += width;
|
|
236
|
+
nPlain += width;
|
|
237
237
|
continue;
|
|
238
238
|
}
|
|
239
239
|
// ANSI Escape characters
|
|
@@ -251,7 +251,6 @@ export const parseAnsi = (ansi) => {
|
|
|
251
251
|
decorator,
|
|
252
252
|
});
|
|
253
253
|
result.chunks.push(chunk);
|
|
254
|
-
|
|
255
254
|
nAnsi += word.length;
|
|
256
255
|
}
|
|
257
256
|
|
|
@@ -4,14 +4,14 @@ import { createSvgRootNode } from "./xml_generator.js";
|
|
|
4
4
|
|
|
5
5
|
const colorsDefault = {
|
|
6
6
|
black: "#000000",
|
|
7
|
-
red: "#
|
|
8
|
-
green: "#
|
|
7
|
+
red: "#cd5555",
|
|
8
|
+
green: "#11bc79",
|
|
9
9
|
yellow: "#DAA520",
|
|
10
10
|
blue: "#4169E1",
|
|
11
11
|
magenta: "#9932CC",
|
|
12
12
|
cyan: "#008B8B",
|
|
13
13
|
white: "#D3D3D3",
|
|
14
|
-
gray: "#
|
|
14
|
+
gray: "#7f7f7f",
|
|
15
15
|
redBright: "#FF4500",
|
|
16
16
|
greenBright: "#ADFF2F",
|
|
17
17
|
yellowBright: "#FFFF00",
|
|
@@ -27,7 +27,7 @@ const colorsDefault = {
|
|
|
27
27
|
bgMagenta: "#9932CC",
|
|
28
28
|
bgCyan: "#008B8B",
|
|
29
29
|
bgWhite: "#D3D3D3",
|
|
30
|
-
bgGray: "#
|
|
30
|
+
bgGray: "#7f7f7f",
|
|
31
31
|
bgRedBright: "#FF0000",
|
|
32
32
|
bgGreenBright: "#ADFF2F",
|
|
33
33
|
bgYellowBright: "#FFFF00",
|
|
@@ -53,7 +53,7 @@ export const renderTerminalSvg = async (
|
|
|
53
53
|
paddingRight = 10,
|
|
54
54
|
|
|
55
55
|
backgroundColor = "#282c34",
|
|
56
|
-
foregroundColor = "#
|
|
56
|
+
foregroundColor = "#cccccc",
|
|
57
57
|
colors = colorsDefault,
|
|
58
58
|
|
|
59
59
|
// by default: fixed width of 640 + fluid height
|