@jsenv/terminal-recorder 1.0.2 → 1.0.3

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.2",
3
+ "version": "1.0.3",
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.2",
36
- "@playwright/browser-chromium": "1.40.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.40.1",
39
+ "playwright": "1.45.0",
40
40
  "strip-ansi": "7.1.0",
41
+ "string-width": "7.2.0",
41
42
  "webm-to-mp4": "1.0.0"
42
43
  },
43
44
  "devDependencies": {
@@ -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) => {
@@ -231,9 +232,11 @@ export const parseAnsi = (ansi) => {
231
232
  const chunk = bundle("text", word);
232
233
  result.chunks.push(chunk);
233
234
 
234
- x += word.length;
235
- nAnsi += word.length;
236
- nPlain += word.length;
235
+ const width = stringWidth(word);
236
+
237
+ x += width;
238
+ nAnsi += width;
239
+ nPlain += width;
237
240
  continue;
238
241
  }
239
242
  // ANSI Escape characters
@@ -4,14 +4,14 @@ import { createSvgRootNode } from "./xml_generator.js";
4
4
 
5
5
  const colorsDefault = {
6
6
  black: "#000000",
7
- red: "#B22222",
8
- green: "#32CD32",
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: "#A9A9A9",
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: "#A9A9A9",
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 = "#abb2bf",
56
+ foregroundColor = "#cccccc",
57
57
  colors = colorsDefault,
58
58
 
59
59
  // by default: fixed width of 640 + fluid height