Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Karrys <luke@lukekarrys.com>2022-04-21 01:32:32 +0300
committerRuy Adorno <ruyadorno@hotmail.com>2022-04-26 23:27:44 +0300
commit0f2da5dca54862707a00d2254bf4c0b4c2e0be60 (patch)
tree87d9a7e44d739a37d1fffd79c0a30393e64337fb
parent13299eed80db9a05f0b0a063b8936c0148ec3037 (diff)
deps: cli-table3@0.6.2
-rw-r--r--node_modules/@colors/colors/LICENSE (renamed from node_modules/colors/LICENSE)1
-rw-r--r--node_modules/@colors/colors/examples/normal-usage.js (renamed from node_modules/colors/examples/normal-usage.js)1
-rw-r--r--node_modules/@colors/colors/examples/safe-string.js (renamed from node_modules/colors/examples/safe-string.js)1
-rw-r--r--node_modules/@colors/colors/index.d.ts (renamed from node_modules/colors/index.d.ts)4
-rw-r--r--node_modules/@colors/colors/lib/colors.js (renamed from node_modules/colors/lib/colors.js)2
-rw-r--r--node_modules/@colors/colors/lib/custom/trap.js (renamed from node_modules/colors/lib/custom/trap.js)0
-rw-r--r--node_modules/@colors/colors/lib/custom/zalgo.js (renamed from node_modules/colors/lib/custom/zalgo.js)0
-rw-r--r--node_modules/@colors/colors/lib/extendStringPrototype.js (renamed from node_modules/colors/lib/extendStringPrototype.js)0
-rw-r--r--node_modules/@colors/colors/lib/index.js (renamed from node_modules/colors/lib/index.js)0
-rw-r--r--node_modules/@colors/colors/lib/maps/america.js (renamed from node_modules/colors/lib/maps/america.js)0
-rw-r--r--node_modules/@colors/colors/lib/maps/rainbow.js (renamed from node_modules/colors/lib/maps/rainbow.js)0
-rw-r--r--node_modules/@colors/colors/lib/maps/random.js (renamed from node_modules/colors/lib/maps/random.js)0
-rw-r--r--node_modules/@colors/colors/lib/maps/zebra.js (renamed from node_modules/colors/lib/maps/zebra.js)0
-rw-r--r--node_modules/@colors/colors/lib/styles.js (renamed from node_modules/colors/lib/styles.js)0
-rw-r--r--node_modules/@colors/colors/lib/system/has-flag.js (renamed from node_modules/colors/lib/system/has-flag.js)0
-rw-r--r--node_modules/@colors/colors/lib/system/supports-colors.js (renamed from node_modules/colors/lib/system/supports-colors.js)0
-rw-r--r--node_modules/@colors/colors/package.json (renamed from node_modules/colors/package.json)14
-rw-r--r--node_modules/@colors/colors/safe.d.ts (renamed from node_modules/colors/safe.d.ts)0
-rw-r--r--node_modules/@colors/colors/safe.js (renamed from node_modules/colors/safe.js)0
-rw-r--r--node_modules/@colors/colors/themes/generic-logging.js (renamed from node_modules/colors/themes/generic-logging.js)0
-rw-r--r--node_modules/cli-table3/index.d.ts1
-rw-r--r--node_modules/cli-table3/package.json8
-rw-r--r--node_modules/cli-table3/src/cell.js63
-rw-r--r--node_modules/cli-table3/src/debug.js28
-rw-r--r--node_modules/cli-table3/src/layout-manager.js57
-rw-r--r--node_modules/cli-table3/src/table.js33
-rw-r--r--node_modules/cli-table3/src/utils.js38
-rw-r--r--package-lock.json44
-rw-r--r--package.json2
29 files changed, 227 insertions, 70 deletions
diff --git a/node_modules/colors/LICENSE b/node_modules/@colors/colors/LICENSE
index 17880ff02..6b8605619 100644
--- a/node_modules/colors/LICENSE
+++ b/node_modules/@colors/colors/LICENSE
@@ -5,6 +5,7 @@ Original Library
Additional Functionality
- Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
+ - Copyright (c) DABH (https://github.com/DABH)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/node_modules/colors/examples/normal-usage.js b/node_modules/@colors/colors/examples/normal-usage.js
index 822db1cc8..a4bfe7b7b 100644
--- a/node_modules/colors/examples/normal-usage.js
+++ b/node_modules/@colors/colors/examples/normal-usage.js
@@ -29,6 +29,7 @@ console.log('Background color attack!'.black.bgWhite);
console.log('Use random styles on everything!'.random);
console.log('America, Heck Yeah!'.america);
+// eslint-disable-next-line max-len
console.log('Blindingly '.brightCyan + 'bright? '.brightRed + 'Why '.brightYellow + 'not?!'.brightGreen);
console.log('Setting themes is useful');
diff --git a/node_modules/colors/examples/safe-string.js b/node_modules/@colors/colors/examples/safe-string.js
index 5bc0168e3..fc6647457 100644
--- a/node_modules/colors/examples/safe-string.js
+++ b/node_modules/@colors/colors/examples/safe-string.js
@@ -28,6 +28,7 @@ console.log(colors.black.bgWhite('Background color attack!'));
console.log(colors.random('Use random styles on everything!'));
console.log(colors.america('America, Heck Yeah!'));
+// eslint-disable-next-line max-len
console.log(colors.brightCyan('Blindingly ') + colors.brightRed('bright? ') + colors.brightYellow('Why ') + colors.brightGreen('not?!'));
console.log('Setting themes is useful');
diff --git a/node_modules/colors/index.d.ts b/node_modules/@colors/colors/index.d.ts
index baa706865..df3f2e6af 100644
--- a/node_modules/colors/index.d.ts
+++ b/node_modules/@colors/colors/index.d.ts
@@ -1,7 +1,7 @@
-// Type definitions for Colors.js 1.2
+// Type definitions for @colors/colors 1.4+
// Project: https://github.com/Marak/colors.js
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>, Staffan Eketorp <https://github.com/staeke>
-// Definitions: https://github.com/Marak/colors.js
+// Definitions: https://github.com/DABH/colors.js
export interface Color {
(text: string): string;
diff --git a/node_modules/colors/lib/colors.js b/node_modules/@colors/colors/lib/colors.js
index 9c7f1d141..d9fb08762 100644
--- a/node_modules/colors/lib/colors.js
+++ b/node_modules/@colors/colors/lib/colors.js
@@ -65,7 +65,7 @@ var stylize = colors.stylize = function stylize(str, style) {
var styleMap = ansiStyles[style];
// Stylize should work for non-ANSI styles, too
- if(!styleMap && style in colors){
+ if (!styleMap && style in colors) {
// Style maps like trap operate as functions on strings;
// they don't have properties like open or close.
return colors[style](str);
diff --git a/node_modules/colors/lib/custom/trap.js b/node_modules/@colors/colors/lib/custom/trap.js
index fbccf88de..fbccf88de 100644
--- a/node_modules/colors/lib/custom/trap.js
+++ b/node_modules/@colors/colors/lib/custom/trap.js
diff --git a/node_modules/colors/lib/custom/zalgo.js b/node_modules/@colors/colors/lib/custom/zalgo.js
index 0ef2b0119..0ef2b0119 100644
--- a/node_modules/colors/lib/custom/zalgo.js
+++ b/node_modules/@colors/colors/lib/custom/zalgo.js
diff --git a/node_modules/colors/lib/extendStringPrototype.js b/node_modules/@colors/colors/lib/extendStringPrototype.js
index 46fd386a9..46fd386a9 100644
--- a/node_modules/colors/lib/extendStringPrototype.js
+++ b/node_modules/@colors/colors/lib/extendStringPrototype.js
diff --git a/node_modules/colors/lib/index.js b/node_modules/@colors/colors/lib/index.js
index 9df5ab7df..9df5ab7df 100644
--- a/node_modules/colors/lib/index.js
+++ b/node_modules/@colors/colors/lib/index.js
diff --git a/node_modules/colors/lib/maps/america.js b/node_modules/@colors/colors/lib/maps/america.js
index dc9690332..dc9690332 100644
--- a/node_modules/colors/lib/maps/america.js
+++ b/node_modules/@colors/colors/lib/maps/america.js
diff --git a/node_modules/colors/lib/maps/rainbow.js b/node_modules/@colors/colors/lib/maps/rainbow.js
index 2b00ac0ac..2b00ac0ac 100644
--- a/node_modules/colors/lib/maps/rainbow.js
+++ b/node_modules/@colors/colors/lib/maps/rainbow.js
diff --git a/node_modules/colors/lib/maps/random.js b/node_modules/@colors/colors/lib/maps/random.js
index 3d82a39ec..3d82a39ec 100644
--- a/node_modules/colors/lib/maps/random.js
+++ b/node_modules/@colors/colors/lib/maps/random.js
diff --git a/node_modules/colors/lib/maps/zebra.js b/node_modules/@colors/colors/lib/maps/zebra.js
index fa7362354..fa7362354 100644
--- a/node_modules/colors/lib/maps/zebra.js
+++ b/node_modules/@colors/colors/lib/maps/zebra.js
diff --git a/node_modules/colors/lib/styles.js b/node_modules/@colors/colors/lib/styles.js
index 011dafd8c..011dafd8c 100644
--- a/node_modules/colors/lib/styles.js
+++ b/node_modules/@colors/colors/lib/styles.js
diff --git a/node_modules/colors/lib/system/has-flag.js b/node_modules/@colors/colors/lib/system/has-flag.js
index a347dd4d7..a347dd4d7 100644
--- a/node_modules/colors/lib/system/has-flag.js
+++ b/node_modules/@colors/colors/lib/system/has-flag.js
diff --git a/node_modules/colors/lib/system/supports-colors.js b/node_modules/@colors/colors/lib/system/supports-colors.js
index f1f9c8ff3..f1f9c8ff3 100644
--- a/node_modules/colors/lib/system/supports-colors.js
+++ b/node_modules/@colors/colors/lib/system/supports-colors.js
diff --git a/node_modules/colors/package.json b/node_modules/@colors/colors/package.json
index dbd71ba5a..cb87f2095 100644
--- a/node_modules/colors/package.json
+++ b/node_modules/@colors/colors/package.json
@@ -1,16 +1,16 @@
{
- "name": "colors",
+ "name": "@colors/colors",
"description": "get colors in your node.js console",
- "version": "1.4.0",
- "author": "Marak Squires",
+ "version": "1.5.0",
+ "author": "DABH",
"contributors": [
{
"name": "DABH",
"url": "https://github.com/DABH"
}
],
- "homepage": "https://github.com/Marak/colors.js",
- "bugs": "https://github.com/Marak/colors.js/issues",
+ "homepage": "https://github.com/DABH/colors.js",
+ "bugs": "https://github.com/DABH/colors.js/issues",
"keywords": [
"ansi",
"terminal",
@@ -18,12 +18,12 @@
],
"repository": {
"type": "git",
- "url": "http://github.com/Marak/colors.js.git"
+ "url": "http://github.com/DABH/colors.js.git"
},
"license": "MIT",
"scripts": {
"lint": "eslint . --fix",
- "test": "node tests/basic-test.js && node tests/safe-test.js"
+ "test": "export FORCE_COLOR=1 && node tests/basic-test.js && node tests/safe-test.js"
},
"engines": {
"node": ">=0.1.90"
diff --git a/node_modules/colors/safe.d.ts b/node_modules/@colors/colors/safe.d.ts
index 2bafc2798..2bafc2798 100644
--- a/node_modules/colors/safe.d.ts
+++ b/node_modules/@colors/colors/safe.d.ts
diff --git a/node_modules/colors/safe.js b/node_modules/@colors/colors/safe.js
index a013d5424..a013d5424 100644
--- a/node_modules/colors/safe.js
+++ b/node_modules/@colors/colors/safe.js
diff --git a/node_modules/colors/themes/generic-logging.js b/node_modules/@colors/colors/themes/generic-logging.js
index 63adfe4ac..63adfe4ac 100644
--- a/node_modules/colors/themes/generic-logging.js
+++ b/node_modules/@colors/colors/themes/generic-logging.js
diff --git a/node_modules/cli-table3/index.d.ts b/node_modules/cli-table3/index.d.ts
index aa94b7440..16980f848 100644
--- a/node_modules/cli-table3/index.d.ts
+++ b/node_modules/cli-table3/index.d.ts
@@ -27,6 +27,7 @@ declare namespace CliTable3 {
rowAligns: VerticalAlignment[];
head: string[];
wordWrap: boolean;
+ wrapOnWordBoundary: boolean;
}
interface TableInstanceOptions extends TableOptions {
diff --git a/node_modules/cli-table3/package.json b/node_modules/cli-table3/package.json
index 82a4905f6..4e6689621 100644
--- a/node_modules/cli-table3/package.json
+++ b/node_modules/cli-table3/package.json
@@ -1,6 +1,6 @@
{
"name": "cli-table3",
- "version": "0.6.1",
+ "version": "0.6.2",
"description": "Pretty unicode tables for the command line. Based on the original cli-table.",
"main": "index.js",
"types": "index.d.ts",
@@ -16,8 +16,8 @@
"string-width": "^4.2.0"
},
"devDependencies": {
- "ansi-256-colors": "^1.1.0",
"cli-table": "^0.3.1",
+ "eslint": "^6.0.0",
"eslint-config-prettier": "^6.0.0",
"eslint-plugin-prettier": "^3.0.0",
"jest": "^25.2.4",
@@ -26,7 +26,7 @@
"prettier": "2.3.2"
},
"optionalDependencies": {
- "colors": "1.4.0"
+ "@colors/colors": "1.5.0"
},
"scripts": {
"changelog": "lerna-changelog",
@@ -75,7 +75,7 @@
{
"displayName": "test",
"testMatch": [
- "<rootDir>/test/*.js"
+ "<rootDir>/test/**/*.js"
]
},
{
diff --git a/node_modules/cli-table3/src/cell.js b/node_modules/cli-table3/src/cell.js
index b8da994a6..8f507442b 100644
--- a/node_modules/cli-table3/src/cell.js
+++ b/node_modules/cli-table3/src/cell.js
@@ -1,3 +1,4 @@
+const { info, debug } = require('./debug');
const utils = require('./utils');
class Cell {
@@ -30,12 +31,19 @@ class Cell {
if (['boolean', 'number', 'string'].indexOf(typeof content) !== -1) {
this.content = String(content);
} else if (!content) {
- this.content = '';
+ this.content = this.options.href || '';
} else {
throw new Error('Content needs to be a primitive, got: ' + typeof content);
}
this.colSpan = options.colSpan || 1;
this.rowSpan = options.rowSpan || 1;
+ if (this.options.href) {
+ Object.defineProperty(this, 'href', {
+ get() {
+ return this.options.href;
+ },
+ });
+ }
}
mergeTableOptions(tableOptions, cells) {
@@ -57,23 +65,35 @@ class Cell {
this.head = style.head || tableStyle.head;
this.border = style.border || tableStyle.border;
- let fixedWidth = tableOptions.colWidths[this.x];
- if (tableOptions.wordWrap && fixedWidth) {
- fixedWidth -= this.paddingLeft + this.paddingRight;
+ this.fixedWidth = tableOptions.colWidths[this.x];
+ this.lines = this.computeLines(tableOptions);
+
+ this.desiredWidth = utils.strlen(this.content) + this.paddingLeft + this.paddingRight;
+ this.desiredHeight = this.lines.length;
+ }
+
+ computeLines(tableOptions) {
+ if (this.fixedWidth && (tableOptions.wordWrap || tableOptions.textWrap)) {
+ this.fixedWidth -= this.paddingLeft + this.paddingRight;
if (this.colSpan) {
let i = 1;
while (i < this.colSpan) {
- fixedWidth += tableOptions.colWidths[this.x + i];
+ this.fixedWidth += tableOptions.colWidths[this.x + i];
i++;
}
}
- this.lines = utils.colorizeLines(utils.wordWrap(fixedWidth, this.content));
- } else {
- this.lines = utils.colorizeLines(this.content.split('\n'));
+ const { wrapOnWordBoundary = true } = tableOptions;
+ return this.wrapLines(utils.wordWrap(this.fixedWidth, this.content, wrapOnWordBoundary));
}
+ return this.wrapLines(this.content.split('\n'));
+ }
- this.desiredWidth = utils.strlen(this.content) + this.paddingLeft + this.paddingRight;
- this.desiredHeight = this.lines.length;
+ wrapLines(computedLines) {
+ const lines = utils.colorizeLines(computedLines);
+ if (this.href) {
+ return lines.map((line) => utils.hyperlink(this.href, line));
+ }
+ return lines;
}
/**
@@ -110,6 +130,12 @@ class Cell {
draw(lineNum, spanningCell) {
if (lineNum == 'top') return this.drawTop(this.drawRight);
if (lineNum == 'bottom') return this.drawBottom(this.drawRight);
+ let content = utils.truncate(this.content, 10, this.truncate);
+ if (!lineNum) {
+ info(`${this.y}-${this.x}: ${this.rowSpan - lineNum}x${this.colSpan} Cell ${content}`);
+ } else {
+ // debug(`${lineNum}-${this.x}: 1x${this.colSpan} RowSpanCell ${content}`);
+ }
let padLen = Math.max(this.height - this.lines.length, 0);
let padTop;
switch (this.vAlign) {
@@ -186,7 +212,7 @@ class Cell {
wrapWithStyleColors(styleProperty, content) {
if (this[styleProperty] && this[styleProperty].length) {
try {
- let colors = require('colors/safe');
+ let colors = require('@colors/colors/safe');
for (let i = this[styleProperty].length - 1; i >= 0; i--) {
colors = colors[this[styleProperty][i]];
}
@@ -285,7 +311,10 @@ class ColSpanCell {
*/
constructor() {}
- draw() {
+ draw(lineNum) {
+ if (typeof lineNum === 'number') {
+ debug(`${this.y}-${this.x}: 1x1 ColSpanCell`);
+ }
return '';
}
@@ -319,21 +348,26 @@ class RowSpanCell {
if (lineNum == 'bottom') {
return this.originalCell.draw('bottom');
}
+ debug(`${this.y}-${this.x}: 1x${this.colSpan} RowSpanCell for ${this.originalCell.content}`);
return this.originalCell.draw(this.offset + 1 + lineNum);
}
mergeTableOptions() {}
}
+function firstDefined(...args) {
+ return args.filter((v) => v !== undefined && v !== null).shift();
+}
+
// HELPER FUNCTIONS
function setOption(objA, objB, nameB, targetObj) {
let nameA = nameB.split('-');
if (nameA.length > 1) {
nameA[1] = nameA[1].charAt(0).toUpperCase() + nameA[1].substr(1);
nameA = nameA.join('');
- targetObj[nameA] = objA[nameA] || objA[nameB] || objB[nameA] || objB[nameB];
+ targetObj[nameA] = firstDefined(objA[nameA], objA[nameB], objB[nameA], objB[nameB]);
} else {
- targetObj[nameB] = objA[nameB] || objB[nameB];
+ targetObj[nameB] = firstDefined(objA[nameB], objB[nameB]);
}
}
@@ -366,6 +400,7 @@ let CHAR_NAMES = [
'right-mid',
'middle',
];
+
module.exports = Cell;
module.exports.ColSpanCell = ColSpanCell;
module.exports.RowSpanCell = RowSpanCell;
diff --git a/node_modules/cli-table3/src/debug.js b/node_modules/cli-table3/src/debug.js
new file mode 100644
index 000000000..6acfb0303
--- /dev/null
+++ b/node_modules/cli-table3/src/debug.js
@@ -0,0 +1,28 @@
+let messages = [];
+let level = 0;
+
+const debug = (msg, min) => {
+ if (level >= min) {
+ messages.push(msg);
+ }
+};
+
+debug.WARN = 1;
+debug.INFO = 2;
+debug.DEBUG = 3;
+
+debug.reset = () => {
+ messages = [];
+};
+
+debug.setDebugLevel = (v) => {
+ level = v;
+};
+
+debug.warn = (msg) => debug(msg, debug.WARN);
+debug.info = (msg) => debug(msg, debug.INFO);
+debug.debug = (msg) => debug(msg, debug.DEBUG);
+
+debug.debugMessages = () => messages;
+
+module.exports = debug;
diff --git a/node_modules/cli-table3/src/layout-manager.js b/node_modules/cli-table3/src/layout-manager.js
index fe84ef844..393745227 100644
--- a/node_modules/cli-table3/src/layout-manager.js
+++ b/node_modules/cli-table3/src/layout-manager.js
@@ -1,24 +1,35 @@
+const { warn, debug } = require('./debug');
const Cell = require('./cell');
const { ColSpanCell, RowSpanCell } = Cell;
(function () {
+ function next(alloc, col) {
+ if (alloc[col] > 0) {
+ return next(alloc, col + 1);
+ }
+ return col;
+ }
+
function layoutTable(table) {
+ let alloc = {};
table.forEach(function (row, rowIndex) {
- let prevCell = null;
- row.forEach(function (cell, columnIndex) {
+ let col = 0;
+ row.forEach(function (cell) {
cell.y = rowIndex;
- cell.x = prevCell ? prevCell.x + 1 : columnIndex;
- for (let y = rowIndex; y >= 0; y--) {
- let row2 = table[y];
- let xMax = y === rowIndex ? columnIndex : row2.length;
- for (let x = 0; x < xMax; x++) {
- let cell2 = row2[x];
- while (cellsConflict(cell, cell2)) {
- cell.x++;
- }
+ // Avoid erroneous call to next() on first row
+ cell.x = rowIndex ? next(alloc, col) : col;
+ const rowSpan = cell.rowSpan || 1;
+ const colSpan = cell.colSpan || 1;
+ if (rowSpan > 1) {
+ for (let cs = 0; cs < colSpan; cs++) {
+ alloc[cell.x + cs] = rowSpan;
}
- prevCell = cell;
}
+ col = cell.x + colSpan;
+ });
+ Object.keys(alloc).forEach((idx) => {
+ alloc[idx]--;
+ if (alloc[idx] < 1) delete alloc[idx];
});
});
}
@@ -116,6 +127,7 @@ const { ColSpanCell, RowSpanCell } = Cell;
function fillInTable(table) {
let h_max = maxHeight(table);
let w_max = maxWidth(table);
+ debug(`Max rows: ${h_max}; Max cols: ${w_max}`);
for (let y = 0; y < h_max; y++) {
for (let x = 0; x < w_max; x++) {
if (!conflictExists(table, x, y)) {
@@ -130,10 +142,10 @@ const { ColSpanCell, RowSpanCell } = Cell;
opts.rowSpan++;
y2++;
}
-
let cell = new Cell(opts);
cell.x = opts.x;
cell.y = opts.y;
+ warn(`Missing cell at ${cell.y}-${cell.x}.`);
insertCell(cell, table[y]);
}
}
@@ -182,6 +194,7 @@ function makeComputeWidths(colSpan, desiredWidth, x, forcedMin) {
return function (vals, table) {
let result = [];
let spanners = [];
+ let auto = {};
table.forEach(function (row) {
row.forEach(function (cell) {
if ((cell[colSpan] || 1) > 1) {
@@ -205,12 +218,20 @@ function makeComputeWidths(colSpan, desiredWidth, x, forcedMin) {
let col = cell[x];
let existingWidth = result[col];
let editableCols = typeof vals[col] === 'number' ? 0 : 1;
- for (let i = 1; i < span; i++) {
- existingWidth += 1 + result[col + i];
- if (typeof vals[col + i] !== 'number') {
- editableCols++;
+ if (typeof existingWidth === 'number') {
+ for (let i = 1; i < span; i++) {
+ existingWidth += 1 + result[col + i];
+ if (typeof vals[col + i] !== 'number') {
+ editableCols++;
+ }
+ }
+ } else {
+ existingWidth = desiredWidth === 'desiredWidth' ? cell.desiredWidth - 1 : 1;
+ if (!auto[col] || auto[col] < existingWidth) {
+ auto[col] = existingWidth;
}
}
+
if (cell[desiredWidth] > existingWidth) {
let i = 0;
while (editableCols > 0 && cell[desiredWidth] > existingWidth) {
@@ -225,7 +246,7 @@ function makeComputeWidths(colSpan, desiredWidth, x, forcedMin) {
}
}
- Object.assign(vals, result);
+ Object.assign(vals, result, auto);
for (let j = 0; j < vals.length; j++) {
vals[j] = Math.max(forcedMin, vals[j] || 0);
}
diff --git a/node_modules/cli-table3/src/table.js b/node_modules/cli-table3/src/table.js
index 4fb33eccf..eb4a9bda9 100644
--- a/node_modules/cli-table3/src/table.js
+++ b/node_modules/cli-table3/src/table.js
@@ -1,11 +1,38 @@
+const debug = require('./debug');
const utils = require('./utils');
const tableLayout = require('./layout-manager');
class Table extends Array {
- constructor(options) {
+ constructor(opts) {
super();
- this.options = utils.mergeOptions(options);
+ const options = utils.mergeOptions(opts);
+ Object.defineProperty(this, 'options', {
+ value: options,
+ enumerable: options.debug,
+ });
+
+ if (options.debug) {
+ switch (typeof options.debug) {
+ case 'boolean':
+ debug.setDebugLevel(debug.WARN);
+ break;
+ case 'number':
+ debug.setDebugLevel(options.debug);
+ break;
+ case 'string':
+ debug.setDebugLevel(parseInt(options.debug, 10));
+ break;
+ default:
+ debug.setDebugLevel(debug.WARN);
+ debug.warn(`Debug option is expected to be boolean, number, or string. Received a ${typeof options.debug}`);
+ }
+ Object.defineProperty(this, 'messages', {
+ get() {
+ return debug.debugMessages();
+ },
+ });
+ }
}
toString() {
@@ -65,6 +92,8 @@ class Table extends Array {
}
}
+Table.reset = () => debug.reset();
+
function doDraw(row, lineNum, result) {
let line = [];
row.forEach(function (cell) {
diff --git a/node_modules/cli-table3/src/utils.js b/node_modules/cli-table3/src/utils.js
index 1e6254af9..c922c5b9a 100644
--- a/node_modules/cli-table3/src/utils.js
+++ b/node_modules/cli-table3/src/utils.js
@@ -240,6 +240,7 @@ function mergeOptions(options, defaults) {
return ret;
}
+// Wrap on word boundary
function wordWrap(maxLength, input) {
let lines = [];
let split = input.split(/(\s+)/g);
@@ -270,11 +271,32 @@ function wordWrap(maxLength, input) {
return lines;
}
-function multiLineWordWrap(maxLength, input) {
+// Wrap text (ignoring word boundaries)
+function textWrap(maxLength, input) {
+ let lines = [];
+ let line = '';
+ function pushLine(str, ws) {
+ if (line.length && ws) line += ws;
+ line += str;
+ while (line.length > maxLength) {
+ lines.push(line.slice(0, maxLength));
+ line = line.slice(maxLength);
+ }
+ }
+ let split = input.split(/(\s+)/g);
+ for (let i = 0; i < split.length; i += 2) {
+ pushLine(split[i], i && split[i - 1]);
+ }
+ if (line.length) lines.push(line);
+ return lines;
+}
+
+function multiLineWordWrap(maxLength, input, wrapOnWordBoundary = true) {
let output = [];
input = input.split('\n');
+ const handler = wrapOnWordBoundary ? wordWrap : textWrap;
for (let i = 0; i < input.length; i++) {
- output.push.apply(output, wordWrap(maxLength, input[i]));
+ output.push.apply(output, handler(maxLength, input[i]));
}
return output;
}
@@ -291,6 +313,17 @@ function colorizeLines(input) {
return output;
}
+/**
+ * Credit: Matheus Sampaio https://github.com/matheussampaio
+ */
+function hyperlink(url, text) {
+ const OSC = '\u001B]';
+ const BEL = '\u0007';
+ const SEP = ';';
+
+ return [OSC, '8', SEP, SEP, url || text, BEL, text, OSC, '8', SEP, SEP, BEL].join('');
+}
+
module.exports = {
strlen: strlen,
repeat: repeat,
@@ -299,4 +332,5 @@ module.exports = {
mergeOptions: mergeOptions,
wordWrap: multiLineWordWrap,
colorizeLines: colorizeLines,
+ hyperlink,
};
diff --git a/package-lock.json b/package-lock.json
index eebf70478..eccfacccb 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -100,7 +100,7 @@
"chalk": "^4.1.2",
"chownr": "^2.0.0",
"cli-columns": "^4.0.0",
- "cli-table3": "^0.6.1",
+ "cli-table3": "^0.6.2",
"columnify": "^1.6.0",
"fastest-levenshtein": "^1.0.12",
"glob": "^8.0.1",
@@ -565,6 +565,16 @@
"dev": true,
"license": "CC0-1.0"
},
+ "node_modules/@colors/colors": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz",
+ "integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==",
+ "inBundle": true,
+ "optional": true,
+ "engines": {
+ "node": ">=0.1.90"
+ }
+ },
"node_modules/@eslint/eslintrc": {
"version": "1.2.1",
"dev": true,
@@ -1808,9 +1818,10 @@
}
},
"node_modules/cli-table3": {
- "version": "0.6.1",
+ "version": "0.6.2",
+ "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.2.tgz",
+ "integrity": "sha512-QyavHCaIC80cMivimWu4aWHilIpiDpfm3hGmqAmXVL1UsnbLuBSMd21hTX6VY4ZSDSM73ESLeF8TOYId3rBTbw==",
"inBundle": true,
- "license": "MIT",
"dependencies": {
"string-width": "^4.2.0"
},
@@ -1818,7 +1829,7 @@
"node": "10.* || >= 12.*"
},
"optionalDependencies": {
- "colors": "1.4.0"
+ "@colors/colors": "1.5.0"
}
},
"node_modules/cliui": {
@@ -1905,15 +1916,6 @@
"color-support": "bin.js"
}
},
- "node_modules/colors": {
- "version": "1.4.0",
- "inBundle": true,
- "license": "MIT",
- "optional": true,
- "engines": {
- "node": ">=0.1.90"
- }
- },
"node_modules/columnify": {
"version": "1.6.0",
"inBundle": true,
@@ -10513,6 +10515,12 @@
"version": "2.0.0",
"dev": true
},
+ "@colors/colors": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz",
+ "integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==",
+ "optional": true
+ },
"@eslint/eslintrc": {
"version": "1.2.1",
"dev": true,
@@ -11386,9 +11394,11 @@
}
},
"cli-table3": {
- "version": "0.6.1",
+ "version": "0.6.2",
+ "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.2.tgz",
+ "integrity": "sha512-QyavHCaIC80cMivimWu4aWHilIpiDpfm3hGmqAmXVL1UsnbLuBSMd21hTX6VY4ZSDSM73ESLeF8TOYId3rBTbw==",
"requires": {
- "colors": "1.4.0",
+ "@colors/colors": "1.5.0",
"string-width": "^4.2.0"
}
},
@@ -11441,10 +11451,6 @@
"color-support": {
"version": "1.1.3"
},
- "colors": {
- "version": "1.4.0",
- "optional": true
- },
"columnify": {
"version": "1.6.0",
"requires": {
diff --git a/package.json b/package.json
index 07238b3f2..3cc79695b 100644
--- a/package.json
+++ b/package.json
@@ -69,7 +69,7 @@
"chalk": "^4.1.2",
"chownr": "^2.0.0",
"cli-columns": "^4.0.0",
- "cli-table3": "^0.6.1",
+ "cli-table3": "^0.6.2",
"columnify": "^1.6.0",
"fastest-levenshtein": "^1.0.12",
"glob": "^8.0.1",