Skip to content

Commit 0f2da5d

Browse files
lukekarrysruyadorno
authored andcommitted
1 parent 13299ee commit 0f2da5d

29 files changed

+227
-70
lines changed

node_modules/colors/LICENSE node_modules/@colors/colors/LICENSE

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Original Library
55

66
Additional Functionality
77
- Copyright (c) Sindre Sorhus <[email protected]> (sindresorhus.com)
8+
- Copyright (c) DABH (https://github.com/DABH)
89

910
Permission is hereby granted, free of charge, to any person obtaining a copy
1011
of this software and associated documentation files (the "Software"), to deal

node_modules/colors/examples/normal-usage.js node_modules/@colors/colors/examples/normal-usage.js

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ console.log('Background color attack!'.black.bgWhite);
2929
console.log('Use random styles on everything!'.random);
3030
console.log('America, Heck Yeah!'.america);
3131

32+
// eslint-disable-next-line max-len
3233
console.log('Blindingly '.brightCyan + 'bright? '.brightRed + 'Why '.brightYellow + 'not?!'.brightGreen);
3334

3435
console.log('Setting themes is useful');

node_modules/colors/examples/safe-string.js node_modules/@colors/colors/examples/safe-string.js

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ console.log(colors.black.bgWhite('Background color attack!'));
2828
console.log(colors.random('Use random styles on everything!'));
2929
console.log(colors.america('America, Heck Yeah!'));
3030

31+
// eslint-disable-next-line max-len
3132
console.log(colors.brightCyan('Blindingly ') + colors.brightRed('bright? ') + colors.brightYellow('Why ') + colors.brightGreen('not?!'));
3233

3334
console.log('Setting themes is useful');

node_modules/colors/index.d.ts node_modules/@colors/colors/index.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// Type definitions for Colors.js 1.2
1+
// Type definitions for @colors/colors 1.4+
22
// Project: https://github.com/Marak/colors.js
33
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>, Staffan Eketorp <https://github.com/staeke>
4-
// Definitions: https://github.com/Marak/colors.js
4+
// Definitions: https://github.com/DABH/colors.js
55

66
export interface Color {
77
(text: string): string;

node_modules/colors/lib/colors.js node_modules/@colors/colors/lib/colors.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ var stylize = colors.stylize = function stylize(str, style) {
6565
var styleMap = ansiStyles[style];
6666

6767
// Stylize should work for non-ANSI styles, too
68-
if(!styleMap && style in colors){
68+
if (!styleMap && style in colors) {
6969
// Style maps like trap operate as functions on strings;
7070
// they don't have properties like open or close.
7171
return colors[style](str);
File renamed without changes.
File renamed without changes.

node_modules/colors/package.json node_modules/@colors/colors/package.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
{
2-
"name": "colors",
2+
"name": "@colors/colors",
33
"description": "get colors in your node.js console",
4-
"version": "1.4.0",
5-
"author": "Marak Squires",
4+
"version": "1.5.0",
5+
"author": "DABH",
66
"contributors": [
77
{
88
"name": "DABH",
99
"url": "https://github.com/DABH"
1010
}
1111
],
12-
"homepage": "https://github.com/Marak/colors.js",
13-
"bugs": "https://github.com/Marak/colors.js/issues",
12+
"homepage": "https://github.com/DABH/colors.js",
13+
"bugs": "https://github.com/DABH/colors.js/issues",
1414
"keywords": [
1515
"ansi",
1616
"terminal",
1717
"colors"
1818
],
1919
"repository": {
2020
"type": "git",
21-
"url": "http://github.com/Marak/colors.js.git"
21+
"url": "http://github.com/DABH/colors.js.git"
2222
},
2323
"license": "MIT",
2424
"scripts": {
2525
"lint": "eslint . --fix",
26-
"test": "node tests/basic-test.js && node tests/safe-test.js"
26+
"test": "export FORCE_COLOR=1 && node tests/basic-test.js && node tests/safe-test.js"
2727
},
2828
"engines": {
2929
"node": ">=0.1.90"
File renamed without changes.
File renamed without changes.

node_modules/cli-table3/index.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ declare namespace CliTable3 {
2727
rowAligns: VerticalAlignment[];
2828
head: string[];
2929
wordWrap: boolean;
30+
wrapOnWordBoundary: boolean;
3031
}
3132

3233
interface TableInstanceOptions extends TableOptions {

node_modules/cli-table3/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cli-table3",
3-
"version": "0.6.1",
3+
"version": "0.6.2",
44
"description": "Pretty unicode tables for the command line. Based on the original cli-table.",
55
"main": "index.js",
66
"types": "index.d.ts",
@@ -16,8 +16,8 @@
1616
"string-width": "^4.2.0"
1717
},
1818
"devDependencies": {
19-
"ansi-256-colors": "^1.1.0",
2019
"cli-table": "^0.3.1",
20+
"eslint": "^6.0.0",
2121
"eslint-config-prettier": "^6.0.0",
2222
"eslint-plugin-prettier": "^3.0.0",
2323
"jest": "^25.2.4",
@@ -26,7 +26,7 @@
2626
"prettier": "2.3.2"
2727
},
2828
"optionalDependencies": {
29-
"colors": "1.4.0"
29+
"@colors/colors": "1.5.0"
3030
},
3131
"scripts": {
3232
"changelog": "lerna-changelog",
@@ -75,7 +75,7 @@
7575
{
7676
"displayName": "test",
7777
"testMatch": [
78-
"<rootDir>/test/*.js"
78+
"<rootDir>/test/**/*.js"
7979
]
8080
},
8181
{

node_modules/cli-table3/src/cell.js

+49-14
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
const { info, debug } = require('./debug');
12
const utils = require('./utils');
23

34
class Cell {
@@ -30,12 +31,19 @@ class Cell {
3031
if (['boolean', 'number', 'string'].indexOf(typeof content) !== -1) {
3132
this.content = String(content);
3233
} else if (!content) {
33-
this.content = '';
34+
this.content = this.options.href || '';
3435
} else {
3536
throw new Error('Content needs to be a primitive, got: ' + typeof content);
3637
}
3738
this.colSpan = options.colSpan || 1;
3839
this.rowSpan = options.rowSpan || 1;
40+
if (this.options.href) {
41+
Object.defineProperty(this, 'href', {
42+
get() {
43+
return this.options.href;
44+
},
45+
});
46+
}
3947
}
4048

4149
mergeTableOptions(tableOptions, cells) {
@@ -57,23 +65,35 @@ class Cell {
5765
this.head = style.head || tableStyle.head;
5866
this.border = style.border || tableStyle.border;
5967

60-
let fixedWidth = tableOptions.colWidths[this.x];
61-
if (tableOptions.wordWrap && fixedWidth) {
62-
fixedWidth -= this.paddingLeft + this.paddingRight;
68+
this.fixedWidth = tableOptions.colWidths[this.x];
69+
this.lines = this.computeLines(tableOptions);
70+
71+
this.desiredWidth = utils.strlen(this.content) + this.paddingLeft + this.paddingRight;
72+
this.desiredHeight = this.lines.length;
73+
}
74+
75+
computeLines(tableOptions) {
76+
if (this.fixedWidth && (tableOptions.wordWrap || tableOptions.textWrap)) {
77+
this.fixedWidth -= this.paddingLeft + this.paddingRight;
6378
if (this.colSpan) {
6479
let i = 1;
6580
while (i < this.colSpan) {
66-
fixedWidth += tableOptions.colWidths[this.x + i];
81+
this.fixedWidth += tableOptions.colWidths[this.x + i];
6782
i++;
6883
}
6984
}
70-
this.lines = utils.colorizeLines(utils.wordWrap(fixedWidth, this.content));
71-
} else {
72-
this.lines = utils.colorizeLines(this.content.split('\n'));
85+
const { wrapOnWordBoundary = true } = tableOptions;
86+
return this.wrapLines(utils.wordWrap(this.fixedWidth, this.content, wrapOnWordBoundary));
7387
}
88+
return this.wrapLines(this.content.split('\n'));
89+
}
7490

75-
this.desiredWidth = utils.strlen(this.content) + this.paddingLeft + this.paddingRight;
76-
this.desiredHeight = this.lines.length;
91+
wrapLines(computedLines) {
92+
const lines = utils.colorizeLines(computedLines);
93+
if (this.href) {
94+
return lines.map((line) => utils.hyperlink(this.href, line));
95+
}
96+
return lines;
7797
}
7898

7999
/**
@@ -110,6 +130,12 @@ class Cell {
110130
draw(lineNum, spanningCell) {
111131
if (lineNum == 'top') return this.drawTop(this.drawRight);
112132
if (lineNum == 'bottom') return this.drawBottom(this.drawRight);
133+
let content = utils.truncate(this.content, 10, this.truncate);
134+
if (!lineNum) {
135+
info(`${this.y}-${this.x}: ${this.rowSpan - lineNum}x${this.colSpan} Cell ${content}`);
136+
} else {
137+
// debug(`${lineNum}-${this.x}: 1x${this.colSpan} RowSpanCell ${content}`);
138+
}
113139
let padLen = Math.max(this.height - this.lines.length, 0);
114140
let padTop;
115141
switch (this.vAlign) {
@@ -186,7 +212,7 @@ class Cell {
186212
wrapWithStyleColors(styleProperty, content) {
187213
if (this[styleProperty] && this[styleProperty].length) {
188214
try {
189-
let colors = require('colors/safe');
215+
let colors = require('@colors/colors/safe');
190216
for (let i = this[styleProperty].length - 1; i >= 0; i--) {
191217
colors = colors[this[styleProperty][i]];
192218
}
@@ -285,7 +311,10 @@ class ColSpanCell {
285311
*/
286312
constructor() {}
287313

288-
draw() {
314+
draw(lineNum) {
315+
if (typeof lineNum === 'number') {
316+
debug(`${this.y}-${this.x}: 1x1 ColSpanCell`);
317+
}
289318
return '';
290319
}
291320

@@ -319,21 +348,26 @@ class RowSpanCell {
319348
if (lineNum == 'bottom') {
320349
return this.originalCell.draw('bottom');
321350
}
351+
debug(`${this.y}-${this.x}: 1x${this.colSpan} RowSpanCell for ${this.originalCell.content}`);
322352
return this.originalCell.draw(this.offset + 1 + lineNum);
323353
}
324354

325355
mergeTableOptions() {}
326356
}
327357

358+
function firstDefined(...args) {
359+
return args.filter((v) => v !== undefined && v !== null).shift();
360+
}
361+
328362
// HELPER FUNCTIONS
329363
function setOption(objA, objB, nameB, targetObj) {
330364
let nameA = nameB.split('-');
331365
if (nameA.length > 1) {
332366
nameA[1] = nameA[1].charAt(0).toUpperCase() + nameA[1].substr(1);
333367
nameA = nameA.join('');
334-
targetObj[nameA] = objA[nameA] || objA[nameB] || objB[nameA] || objB[nameB];
368+
targetObj[nameA] = firstDefined(objA[nameA], objA[nameB], objB[nameA], objB[nameB]);
335369
} else {
336-
targetObj[nameB] = objA[nameB] || objB[nameB];
370+
targetObj[nameB] = firstDefined(objA[nameB], objB[nameB]);
337371
}
338372
}
339373

@@ -366,6 +400,7 @@ let CHAR_NAMES = [
366400
'right-mid',
367401
'middle',
368402
];
403+
369404
module.exports = Cell;
370405
module.exports.ColSpanCell = ColSpanCell;
371406
module.exports.RowSpanCell = RowSpanCell;

node_modules/cli-table3/src/debug.js

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
let messages = [];
2+
let level = 0;
3+
4+
const debug = (msg, min) => {
5+
if (level >= min) {
6+
messages.push(msg);
7+
}
8+
};
9+
10+
debug.WARN = 1;
11+
debug.INFO = 2;
12+
debug.DEBUG = 3;
13+
14+
debug.reset = () => {
15+
messages = [];
16+
};
17+
18+
debug.setDebugLevel = (v) => {
19+
level = v;
20+
};
21+
22+
debug.warn = (msg) => debug(msg, debug.WARN);
23+
debug.info = (msg) => debug(msg, debug.INFO);
24+
debug.debug = (msg) => debug(msg, debug.DEBUG);
25+
26+
debug.debugMessages = () => messages;
27+
28+
module.exports = debug;

0 commit comments

Comments
 (0)