Added custom log name

This commit is contained in:
2019-11-22 09:43:37 +00:00
parent c4b856da62
commit 646700c73f
699 changed files with 5186 additions and 4259 deletions

226
node_modules/wrap-ansi/index.js generated vendored
View File

@ -1,42 +1,68 @@
'use strict';
const stringWidth = require('string-width');
const stripAnsi = require('strip-ansi');
const ansiStyles = require('ansi-styles');
var stringWidth = require('string-width');
var stripAnsi = require('strip-ansi');
const ESCAPES = new Set([
'\u001B',
'\u009B'
]);
var ESCAPES = [
'\u001b',
'\u009b'
];
const END_CODE = 39;
var END_CODE = 39;
const wrapAnsi = code => `${ESCAPES.values().next().value}[${code}m`;
var ESCAPE_CODES = {
0: 0,
1: 22,
2: 22,
3: 23,
4: 24,
7: 27,
8: 28,
9: 29,
30: 39,
31: 39,
32: 39,
33: 39,
34: 39,
35: 39,
36: 39,
37: 39,
90: 39,
40: 49,
41: 49,
42: 49,
43: 49,
44: 49,
45: 49,
46: 49,
47: 49
};
// Calculate the length of words split on ' ', ignoring
// the extra characters added by ansi escape codes
const wordLengths = string => string.split(' ').map(character => stringWidth(character));
function wrapAnsi(code) {
return ESCAPES[0] + '[' + code + 'm';
}
// Wrap a long word across multiple rows
// Ansi escape codes do not count towards length
const wrapWord = (rows, word, columns) => {
const characters = [...word];
// calculate the length of words split on ' ', ignoring
// the extra characters added by ansi escape codes.
function wordLengths(str) {
return str.split(' ').map(function (s) {
return stringWidth(s);
});
}
let insideEscape = false;
let visible = stringWidth(stripAnsi(rows[rows.length - 1]));
// wrap a long word across multiple rows.
// ansi escape codes do not count towards length.
function wrapWord(rows, word, cols) {
var insideEscape = false;
var visible = stripAnsi(rows[rows.length - 1]).length;
for (const [index, character] of characters.entries()) {
const characterLength = stringWidth(character);
for (var i = 0; i < word.length; i++) {
var x = word[i];
if (visible + characterLength <= columns) {
rows[rows.length - 1] += character;
} else {
rows.push(character);
visible = 0;
}
rows[rows.length - 1] += x;
if (ESCAPES.has(character)) {
if (ESCAPES.indexOf(x) !== -1) {
insideEscape = true;
} else if (insideEscape && character === 'm') {
} else if (insideEscape && x === 'm') {
insideEscape = false;
continue;
}
@ -45,144 +71,98 @@ const wrapWord = (rows, word, columns) => {
continue;
}
visible += characterLength;
visible++;
if (visible === columns && index < characters.length - 1) {
if (visible >= cols && i < word.length - 1) {
rows.push('');
visible = 0;
}
}
// It's possible that the last row we copy over is only
// ansi escape characters, handle this edge-case
// it's possible that the last row we copy over is only
// ansi escape characters, handle this edge-case.
if (!visible && rows[rows.length - 1].length > 0 && rows.length > 1) {
rows[rows.length - 2] += rows.pop();
}
};
}
// Trims spaces from a string ignoring invisible sequences
const stringVisibleTrimSpacesRight = str => {
const words = str.split(' ');
let last = words.length;
while (last > 0) {
if (stringWidth(words[last - 1]) > 0) {
break;
}
last--;
}
if (last === words.length) {
return str;
}
return words.slice(0, last).join(' ') + words.slice(last).join('');
};
// The wrap-ansi module can be invoked
// in either 'hard' or 'soft' wrap mode
// the wrap-ansi module can be invoked
// in either 'hard' or 'soft' wrap mode.
//
// 'hard' will never allow a string to take up more
// than columns characters
// than cols characters.
//
// 'soft' allows long words to expand past the column length
const exec = (string, columns, options = {}) => {
if (options.trim !== false && string.trim() === '') {
return '';
}
// 'soft' allows long words to expand past the column length.
function exec(str, cols, opts) {
var options = opts || {};
let pre = '';
let ret = '';
let escapeCode;
var pre = '';
var ret = '';
var escapeCode;
const lengths = wordLengths(string);
let rows = [''];
var lengths = wordLengths(str);
var words = str.split(' ');
var rows = [''];
for (const [index, word] of string.split(' ').entries()) {
if (options.trim !== false) {
rows[rows.length - 1] = rows[rows.length - 1].trimLeft();
for (var i = 0, word; (word = words[i]) !== undefined; i++) {
var rowLength = stringWidth(rows[rows.length - 1]);
if (rowLength) {
rows[rows.length - 1] += ' ';
rowLength++;
}
let rowLength = stringWidth(rows[rows.length - 1]);
if (index !== 0) {
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
// If we start with a new word but the current row length equals the length of the columns, add a new row
rows.push('');
rowLength = 0;
}
if (rowLength > 0 || options.trim === false) {
rows[rows.length - 1] += ' ';
rowLength++;
}
}
// In 'hard' wrap mode, the length of a line is
// never allowed to extend past 'columns'
if (options.hard && lengths[index] > columns) {
const remainingColumns = (columns - rowLength);
const breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns);
const breaksStartingNextLine = Math.floor((lengths[index] - 1) / columns);
if (breaksStartingNextLine < breaksStartingThisLine) {
// in 'hard' wrap mode, the length of a line is
// never allowed to extend past 'cols'.
if (lengths[i] > cols && options.hard) {
if (rowLength) {
rows.push('');
}
wrapWord(rows, word, columns);
wrapWord(rows, word, cols);
continue;
}
if (rowLength + lengths[index] > columns && rowLength > 0 && lengths[index] > 0) {
if (options.wordWrap === false && rowLength < columns) {
wrapWord(rows, word, columns);
if (rowLength + lengths[i] > cols && rowLength > 0) {
if (options.wordWrap === false && rowLength < cols) {
wrapWord(rows, word, cols);
continue;
}
rows.push('');
}
if (rowLength + lengths[index] > columns && options.wordWrap === false) {
wrapWord(rows, word, columns);
continue;
}
rows[rows.length - 1] += word;
}
if (options.trim !== false) {
rows = rows.map(stringVisibleTrimSpacesRight);
}
pre = rows.map(function (r) {
return r.trim();
}).join('\n');
pre = rows.join('\n');
for (var j = 0; j < pre.length; j++) {
var y = pre[j];
for (const [index, character] of [...pre].entries()) {
ret += character;
ret += y;
if (ESCAPES.has(character)) {
const code = parseFloat(/\d[^m]*/.exec(pre.slice(index, index + 4)));
if (ESCAPES.indexOf(y) !== -1) {
var code = parseFloat(/[0-9][^m]*/.exec(pre.slice(j, j + 4)));
escapeCode = code === END_CODE ? null : code;
}
const code = ansiStyles.codes.get(Number(escapeCode));
if (escapeCode && code) {
if (pre[index + 1] === '\n') {
ret += wrapAnsi(code);
} else if (character === '\n') {
if (escapeCode && ESCAPE_CODES[escapeCode]) {
if (pre[j + 1] === '\n') {
ret += wrapAnsi(ESCAPE_CODES[escapeCode]);
} else if (y === '\n') {
ret += wrapAnsi(escapeCode);
}
}
}
return ret;
};
}
// For each newline, invoke the method separately
module.exports = (string, columns, options) => {
return String(string)
.normalize()
.split('\n')
.map(line => exec(line, columns, options))
.join('\n');
// for each line break, invoke the method separately.
module.exports = function (str, cols, opts) {
return String(str).split('\n').map(function (substr) {
return exec(substr, cols, opts);
}).join('\n');
};

20
node_modules/wrap-ansi/license generated vendored
View File

@ -1,9 +1,21 @@
MIT License
The MIT License (MIT)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

65
node_modules/wrap-ansi/package.json generated vendored
View File

@ -1,27 +1,27 @@
{
"_from": "wrap-ansi@^5.1.0",
"_id": "wrap-ansi@5.1.0",
"_from": "wrap-ansi@^2.0.0",
"_id": "wrap-ansi@2.1.0",
"_inBundle": false,
"_integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==",
"_integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=",
"_location": "/wrap-ansi",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "wrap-ansi@^5.1.0",
"raw": "wrap-ansi@^2.0.0",
"name": "wrap-ansi",
"escapedName": "wrap-ansi",
"rawSpec": "^5.1.0",
"rawSpec": "^2.0.0",
"saveSpec": null,
"fetchSpec": "^5.1.0"
"fetchSpec": "^2.0.0"
},
"_requiredBy": [
"/cliui"
],
"_resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz",
"_shasum": "1fd1f67235d5b6d0fee781056001bfb694c03b09",
"_spec": "wrap-ansi@^5.1.0",
"_where": "/home/sergiu/linx-simulator2/node_modules/cliui",
"_resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz",
"_shasum": "d8fc3d284dd05794fe84973caecdd1cf824fdd85",
"_spec": "wrap-ansi@^2.0.0",
"_where": "/home/safemobile/LINX/linx-simulator2/node_modules/cliui",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
@ -32,22 +32,22 @@
},
"bundleDependencies": false,
"dependencies": {
"ansi-styles": "^3.2.0",
"string-width": "^3.0.0",
"strip-ansi": "^5.0.0"
"string-width": "^1.0.1",
"strip-ansi": "^3.0.1"
},
"deprecated": false,
"description": "Wordwrap a string with ANSI escape codes",
"devDependencies": {
"ava": "^1.2.1",
"chalk": "^2.4.2",
"coveralls": "^3.0.3",
"has-ansi": "^3.0.0",
"nyc": "^13.3.0",
"xo": "^0.24.0"
"ava": "^0.16.0",
"chalk": "^1.1.0",
"coveralls": "^2.11.4",
"has-ansi": "^2.0.0",
"nyc": "^6.2.1",
"strip-ansi": "^3.0.0",
"xo": "*"
},
"engines": {
"node": ">=6"
"node": ">=0.10.0"
},
"files": [
"index.js"
@ -81,13 +81,36 @@
"text"
],
"license": "MIT",
"maintainers": [
{
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
{
"name": "Joshua Appelman",
"email": "jappelman@xebia.com",
"url": "jbnicolai.com"
},
{
"name": "JD Ballard",
"email": "i.am.qix@gmail.com",
"url": "github.com/qix-"
},
{
"name": "Benjamin Coe",
"email": "ben@npmjs.com",
"url": "github.com/bcoe"
}
],
"name": "wrap-ansi",
"repository": {
"type": "git",
"url": "git+https://github.com/chalk/wrap-ansi.git"
},
"scripts": {
"coveralls": "nyc report --reporter=text-lcov | coveralls",
"test": "xo && nyc ava"
},
"version": "5.1.0"
"version": "2.1.0"
}

41
node_modules/wrap-ansi/readme.md generated vendored
View File

@ -1,12 +1,12 @@
# wrap-ansi [![Build Status](https://travis-ci.org/chalk/wrap-ansi.svg?branch=master)](https://travis-ci.org/chalk/wrap-ansi) [![Coverage Status](https://coveralls.io/repos/github/chalk/wrap-ansi/badge.svg?branch=master)](https://coveralls.io/github/chalk/wrap-ansi?branch=master)
> Wordwrap a string with [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles)
> Wordwrap a string with [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles)
## Install
```
$ npm install wrap-ansi
$ npm install --save wrap-ansi
```
@ -24,20 +24,6 @@ console.log(wrapAnsi(input, 20));
<img width="331" src="screenshot.png">
---
<div align="center">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-wrap_ansi?utm_source=npm-wrap-ansi&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
</b>
<br>
<sub>
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
</sub>
</div>
---
## API
@ -59,8 +45,6 @@ Number of columns to wrap the text to.
#### options
Type: `Object`
##### hard
Type: `boolean`<br>
@ -75,13 +59,6 @@ Default: `true`
By default, an attempt is made to split words at spaces, ensuring that they don't extend past the configured columns. If wordWrap is `false`, each column will instead be completely filled splitting words as necessary.
##### trim
Type: `boolean`<br>
Default: `true`
Whitespace on all lines is removed by default. Set this option to `false` if you don't want to trim.
## Related
@ -91,18 +68,6 @@ Whitespace on all lines is removed by default. Set this option to `false` if you
- [jsesc](https://github.com/mathiasbynens/jsesc) - Generate ASCII-only output from Unicode strings. Useful for creating test fixtures.
## Maintainers
- [Sindre Sorhus](https://github.com/sindresorhus)
- [Josh Junon](https://github.com/qix-)
- [Benjamin Coe](https://github.com/bcoe)
## Security
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
## License
MIT
MIT © [Sindre Sorhus](https://sindresorhus.com)