flow like the river

This commit is contained in:
root 2025-11-07 00:06:12 +01:00
commit 013fe673f3
42435 changed files with 5764238 additions and 0 deletions

15
BACK_BACK/node_modules/ansi-to-html/.editorconfig generated vendored Executable file
View file

@ -0,0 +1,15 @@
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.json]
indent_size = 2
[*.yml]
indent_size = 2

2
BACK_BACK/node_modules/ansi-to-html/.eslintignore generated vendored Executable file
View file

@ -0,0 +1,2 @@
lib
coverage

22
BACK_BACK/node_modules/ansi-to-html/LICENSE-MIT.txt generated vendored Executable file
View file

@ -0,0 +1,22 @@
Copyright (c) 2012 Rob Burns
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 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.

121
BACK_BACK/node_modules/ansi-to-html/README.md generated vendored Executable file
View file

@ -0,0 +1,121 @@
## Ansi to Html
[![rburns](https://circleci.com/gh/rburns/ansi-to-html.svg?style=svg)](https://circleci.com/gh/rburns/ansi-to-html)
[![](https://img.shields.io/npm/v/ansi-to-html.svg)](https://www.npmjs.com/package/ansi-to-html)
![](https://img.shields.io/npm/dm/ansi-to-html.svg)
This was originally a port of the ansi to html converter from
[bcat](https://github.com/rtomayko/bcat/blob/master/lib/bcat/ansi.rb) to
JavaScript. It has since undergone quite a lot of modification.
It has a few additions:
* The API has been altered to accept options in the constructor, and input in `toHtml()`.
* ANSI codes for setting the foreground or background color to default are handled
* the 'erase in line' escape code (`\x1b[K`) is dropped from the output.
## Installation
```bash
npm install ansi-to-html
```
## Usage
```javascript
var Convert = require('ansi-to-html');
var convert = new Convert();
console.log(convert.toHtml('\x1b[30mblack\x1b[37mwhite'));
/*
prints:
<span style="color:#000">black<span style="color:#AAA">white</span></span>
*/
```
## Command line usage
When using ansi-to-html from the command line the stream option is set to `true`.
Other options can be provided. See `ansi-to-html -h` for more detail.
### Process a file
```bash
ansi-to-html the_filename
```
### From STDIN
```bash
git log | ansi-to-html
```
## Options
Options can be be passed to the constructor to customize behaviour.
**fg** `<CSS color values>`. The default foreground color used when reset color codes are encountered.
**bg** `<CSS color values>`. The default background color used when reset color codes are encountered.
**newline** `true` or `false`. Convert newline characters to `<br/>`.
**escapeXML** `true` or `false`. Generate HTML/XML entities.
**stream** `true` or `false`. Save style state across invocations of `toHtml()`.
**colors** `Object`/`Array` (with values 0 - 255 containing CSS color values). Can override specific colors or the entire ANSI palette
### Default options
```json5
{
fg: '#FFF',
bg: '#000',
newline: false,
escapeXML: false,
stream: false
}
```
## Development
Once you have the git repository cloned, install the dependencies:
```bash
cd ansi-to-html
npm install
```
#### Lint
```bash
npm run lint
```
#### Build
```bash
npm run build
```
- Builds the `/src` files by running `babel`.
- Saves the built files in `/lib` output directory.
- Recommended to run `babel` in Watch mode - will re-build the project each time the files are changed.
```bash
npm run build:watch
```
#### Test
```bash
npm test
```
- Note: Runs the tests against the built files (in the `/lib` directory).
- You also run the tests in watch mode (will rerun tests when files are changed).
- Recommended to run the build in watch mode as well to re-build the project before the tests are run.
```bash
npm run test:watch
```

3
BACK_BACK/node_modules/ansi-to-html/bin/ansi-to-html generated vendored Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env node
'use strict';
require('../lib/cli.js');

23
BACK_BACK/node_modules/ansi-to-html/lib/ansi_to_html.d.ts generated vendored Executable file
View file

@ -0,0 +1,23 @@
declare module 'ansi-to-html' {
interface ConverterOptions {
/** The default foreground color used when reset color codes are encountered. */
fg?: string
/** The default background color used when reset color codes are encountered. */
bg?: string
/** Convert newline characters to `<br/>`. */
newline?: boolean
/** Generate HTML/XML entities. */
escapeXML?: boolean
/** Save style state across invocations of `toHtml()`. */
stream?: boolean
/** Can override specific colors or the entire ANSI palette. */
colors?: string[] | {[code: number]: string}
}
class Convert {
constructor(options?: ConverterOptions)
toHtml(data: string): string
}
export = Convert
}

616
BACK_BACK/node_modules/ansi-to-html/lib/ansi_to_html.js generated vendored Executable file
View file

@ -0,0 +1,616 @@
'use strict';
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _createForOfIteratorHelper(o) { if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) { var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var it, normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
var entities = require('entities');
var defaults = {
fg: '#FFF',
bg: '#000',
newline: false,
escapeXML: false,
stream: false,
colors: getDefaultColors()
};
function getDefaultColors() {
var colors = {
0: '#000',
1: '#A00',
2: '#0A0',
3: '#A50',
4: '#00A',
5: '#A0A',
6: '#0AA',
7: '#AAA',
8: '#555',
9: '#F55',
10: '#5F5',
11: '#FF5',
12: '#55F',
13: '#F5F',
14: '#5FF',
15: '#FFF'
};
range(0, 5).forEach(function (red) {
range(0, 5).forEach(function (green) {
range(0, 5).forEach(function (blue) {
return setStyleColor(red, green, blue, colors);
});
});
});
range(0, 23).forEach(function (gray) {
var c = gray + 232;
var l = toHexString(gray * 10 + 8);
colors[c] = '#' + l + l + l;
});
return colors;
}
/**
* @param {number} red
* @param {number} green
* @param {number} blue
* @param {object} colors
*/
function setStyleColor(red, green, blue, colors) {
var c = 16 + red * 36 + green * 6 + blue;
var r = red > 0 ? red * 40 + 55 : 0;
var g = green > 0 ? green * 40 + 55 : 0;
var b = blue > 0 ? blue * 40 + 55 : 0;
colors[c] = toColorHexString([r, g, b]);
}
/**
* Converts from a number like 15 to a hex string like 'F'
* @param {number} num
* @returns {string}
*/
function toHexString(num) {
var str = num.toString(16);
while (str.length < 2) {
str = '0' + str;
}
return str;
}
/**
* Converts from an array of numbers like [15, 15, 15] to a hex string like 'FFF'
* @param {[red, green, blue]} ref
* @returns {string}
*/
function toColorHexString(ref) {
var results = [];
var _iterator = _createForOfIteratorHelper(ref),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var r = _step.value;
results.push(toHexString(r));
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
return '#' + results.join('');
}
/**
* @param {Array} stack
* @param {string} token
* @param {*} data
* @param {object} options
*/
function generateOutput(stack, token, data, options) {
var result;
if (token === 'text') {
result = pushText(data, options);
} else if (token === 'display') {
result = handleDisplay(stack, data, options);
} else if (token === 'xterm256') {
result = pushForegroundColor(stack, options.colors[data]);
} else if (token === 'rgb') {
result = handleRgb(stack, data);
}
return result;
}
/**
* @param {Array} stack
* @param {string} data
* @returns {*}
*/
function handleRgb(stack, data) {
data = data.substring(2).slice(0, -1);
var operation = +data.substr(0, 2);
var color = data.substring(5).split(';');
var rgb = color.map(function (value) {
return ('0' + Number(value).toString(16)).substr(-2);
}).join('');
return pushStyle(stack, (operation === 38 ? 'color:#' : 'background-color:#') + rgb);
}
/**
* @param {Array} stack
* @param {number} code
* @param {object} options
* @returns {*}
*/
function handleDisplay(stack, code, options) {
code = parseInt(code, 10);
var codeMap = {
'-1': function _() {
return '<br/>';
},
0: function _() {
return stack.length && resetStyles(stack);
},
1: function _() {
return pushTag(stack, 'b');
},
3: function _() {
return pushTag(stack, 'i');
},
4: function _() {
return pushTag(stack, 'u');
},
8: function _() {
return pushStyle(stack, 'display:none');
},
9: function _() {
return pushTag(stack, 'strike');
},
22: function _() {
return pushStyle(stack, 'font-weight:normal;text-decoration:none;font-style:normal');
},
23: function _() {
return closeTag(stack, 'i');
},
24: function _() {
return closeTag(stack, 'u');
},
39: function _() {
return pushForegroundColor(stack, options.fg);
},
49: function _() {
return pushBackgroundColor(stack, options.bg);
},
53: function _() {
return pushStyle(stack, 'text-decoration:overline');
}
};
var result;
if (codeMap[code]) {
result = codeMap[code]();
} else if (4 < code && code < 7) {
result = pushTag(stack, 'blink');
} else if (29 < code && code < 38) {
result = pushForegroundColor(stack, options.colors[code - 30]);
} else if (39 < code && code < 48) {
result = pushBackgroundColor(stack, options.colors[code - 40]);
} else if (89 < code && code < 98) {
result = pushForegroundColor(stack, options.colors[8 + (code - 90)]);
} else if (99 < code && code < 108) {
result = pushBackgroundColor(stack, options.colors[8 + (code - 100)]);
}
return result;
}
/**
* Clear all the styles
* @returns {string}
*/
function resetStyles(stack) {
var stackClone = stack.slice(0);
stack.length = 0;
return stackClone.reverse().map(function (tag) {
return '</' + tag + '>';
}).join('');
}
/**
* Creates an array of numbers ranging from low to high
* @param {number} low
* @param {number} high
* @returns {Array}
* @example range(3, 7); // creates [3, 4, 5, 6, 7]
*/
function range(low, high) {
var results = [];
for (var j = low; j <= high; j++) {
results.push(j);
}
return results;
}
/**
* Returns a new function that is true if value is NOT the same category
* @param {string} category
* @returns {function}
*/
function notCategory(category) {
return function (e) {
return (category === null || e.category !== category) && category !== 'all';
};
}
/**
* Converts a code into an ansi token type
* @param {number} code
* @returns {string}
*/
function categoryForCode(code) {
code = parseInt(code, 10);
var result = null;
if (code === 0) {
result = 'all';
} else if (code === 1) {
result = 'bold';
} else if (2 < code && code < 5) {
result = 'underline';
} else if (4 < code && code < 7) {
result = 'blink';
} else if (code === 8) {
result = 'hide';
} else if (code === 9) {
result = 'strike';
} else if (29 < code && code < 38 || code === 39 || 89 < code && code < 98) {
result = 'foreground-color';
} else if (39 < code && code < 48 || code === 49 || 99 < code && code < 108) {
result = 'background-color';
}
return result;
}
/**
* @param {string} text
* @param {object} options
* @returns {string}
*/
function pushText(text, options) {
if (options.escapeXML) {
return entities.encodeXML(text);
}
return text;
}
/**
* @param {Array} stack
* @param {string} tag
* @param {string} [style='']
* @returns {string}
*/
function pushTag(stack, tag, style) {
if (!style) {
style = '';
}
stack.push(tag);
return "<".concat(tag).concat(style ? " style=\"".concat(style, "\"") : '', ">");
}
/**
* @param {Array} stack
* @param {string} style
* @returns {string}
*/
function pushStyle(stack, style) {
return pushTag(stack, 'span', style);
}
function pushForegroundColor(stack, color) {
return pushTag(stack, 'span', 'color:' + color);
}
function pushBackgroundColor(stack, color) {
return pushTag(stack, 'span', 'background-color:' + color);
}
/**
* @param {Array} stack
* @param {string} style
* @returns {string}
*/
function closeTag(stack, style) {
var last;
if (stack.slice(-1)[0] === style) {
last = stack.pop();
}
if (last) {
return '</' + style + '>';
}
}
/**
* @param {string} text
* @param {object} options
* @param {function} callback
* @returns {Array}
*/
function tokenize(text, options, callback) {
var ansiMatch = false;
var ansiHandler = 3;
function remove() {
return '';
}
function removeXterm256(m, g1) {
callback('xterm256', g1);
return '';
}
function newline(m) {
if (options.newline) {
callback('display', -1);
} else {
callback('text', m);
}
return '';
}
function ansiMess(m, g1) {
ansiMatch = true;
if (g1.trim().length === 0) {
g1 = '0';
}
g1 = g1.trimRight(';').split(';');
var _iterator2 = _createForOfIteratorHelper(g1),
_step2;
try {
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
var g = _step2.value;
callback('display', g);
}
} catch (err) {
_iterator2.e(err);
} finally {
_iterator2.f();
}
return '';
}
function realText(m) {
callback('text', m);
return '';
}
function rgb(m) {
callback('rgb', m);
return '';
}
/* eslint no-control-regex:0 */
var tokens = [{
pattern: /^\x08+/,
sub: remove
}, {
pattern: /^\x1b\[[012]?K/,
sub: remove
}, {
pattern: /^\x1b\[\(B/,
sub: remove
}, {
pattern: /^\x1b\[[34]8;2;\d+;\d+;\d+m/,
sub: rgb
}, {
pattern: /^\x1b\[38;5;(\d+)m/,
sub: removeXterm256
}, {
pattern: /^\n/,
sub: newline
}, {
pattern: /^\r+\n/,
sub: newline
}, {
pattern: /^\x1b\[((?:\d{1,3};?)+|)m/,
sub: ansiMess
}, {
// CSI n J
// ED - Erase in Display Clears part of the screen.
// If n is 0 (or missing), clear from cursor to end of screen.
// If n is 1, clear from cursor to beginning of the screen.
// If n is 2, clear entire screen (and moves cursor to upper left on DOS ANSI.SYS).
// If n is 3, clear entire screen and delete all lines saved in the scrollback buffer
// (this feature was added for xterm and is supported by other terminal applications).
pattern: /^\x1b\[\d?J/,
sub: remove
}, {
// CSI n ; m f
// HVP - Horizontal Vertical Position Same as CUP
pattern: /^\x1b\[\d{0,3};\d{0,3}f/,
sub: remove
}, {
// catch-all for CSI sequences?
pattern: /^\x1b\[?[\d;]{0,3}/,
sub: remove
}, {
/**
* extracts real text - not containing:
* - `\x1b' - ESC - escape (Ascii 27)
* - '\x08' - BS - backspace (Ascii 8)
* - `\n` - Newline - linefeed (LF) (ascii 10)
* - `\r` - Windows Carriage Return (CR)
*/
pattern: /^(([^\x1b\x08\r\n])+)/,
sub: realText
}];
function process(handler, i) {
if (i > ansiHandler && ansiMatch) {
return;
}
ansiMatch = false;
text = text.replace(handler.pattern, handler.sub);
}
var results1 = [];
var _text = text,
length = _text.length;
outer: while (length > 0) {
for (var i = 0, o = 0, len = tokens.length; o < len; i = ++o) {
var handler = tokens[i];
process(handler, i);
if (text.length !== length) {
// We matched a token and removed it from the text. We need to
// start matching *all* tokens against the new text.
length = text.length;
continue outer;
}
}
if (text.length === length) {
break;
}
results1.push(0);
length = text.length;
}
return results1;
}
/**
* If streaming, then the stack is "sticky"
*
* @param {Array} stickyStack
* @param {string} token
* @param {*} data
* @returns {Array}
*/
function updateStickyStack(stickyStack, token, data) {
if (token !== 'text') {
stickyStack = stickyStack.filter(notCategory(categoryForCode(data)));
stickyStack.push({
token: token,
data: data,
category: categoryForCode(data)
});
}
return stickyStack;
}
var Filter = /*#__PURE__*/function () {
/**
* @param {object} options
* @param {string=} options.fg The default foreground color used when reset color codes are encountered.
* @param {string=} options.bg The default background color used when reset color codes are encountered.
* @param {boolean=} options.newline Convert newline characters to `<br/>`.
* @param {boolean=} options.escapeXML Generate HTML/XML entities.
* @param {boolean=} options.stream Save style state across invocations of `toHtml()`.
* @param {(string[] | {[code: number]: string})=} options.colors Can override specific colors or the entire ANSI palette.
*/
function Filter(options) {
_classCallCheck(this, Filter);
options = options || {};
if (options.colors) {
options.colors = Object.assign({}, defaults.colors, options.colors);
}
this.options = Object.assign({}, defaults, options);
this.stack = [];
this.stickyStack = [];
}
/**
* @param {string | string[]} input
* @returns {string}
*/
_createClass(Filter, [{
key: "toHtml",
value: function toHtml(input) {
var _this = this;
input = typeof input === 'string' ? [input] : input;
var stack = this.stack,
options = this.options;
var buf = [];
this.stickyStack.forEach(function (element) {
var output = generateOutput(stack, element.token, element.data, options);
if (output) {
buf.push(output);
}
});
tokenize(input.join(''), options, function (token, data) {
var output = generateOutput(stack, token, data, options);
if (output) {
buf.push(output);
}
if (options.stream) {
_this.stickyStack = updateStickyStack(_this.stickyStack, token, data);
}
});
if (stack.length) {
buf.push(resetStyles(stack));
}
return buf.join('');
}
}]);
return Filter;
}();
module.exports = Filter;
//# sourceMappingURL=ansi_to_html.js.map

File diff suppressed because one or more lines are too long

78
BACK_BACK/node_modules/ansi-to-html/lib/cli.js generated vendored Executable file
View file

@ -0,0 +1,78 @@
'use strict';
/* eslint no-console:0 */
var help = "\nusage: ansi-to-html [options] [file]\n\nfile: The file to display or stdin\n\noptions:\n\n -f, --fg The background color used for resets (#000)\n -b, --bg The foreground color used for resets (#FFF)\n -n, --newline Convert newline characters to <br/> (false)\n -x, --escapeXML Generate XML entities (false)\n -v, --version Print version\n -h, --help Print help\n";
var args = {
stream: true
};
var file = null,
skip = false;
var argv = process.argv.slice(2);
for (var i = 0, len = argv.length; i < len; ++i) {
if (skip) {
skip = false;
continue;
}
switch (argv[i]) {
case '-n':
case '--newline':
args.newline = true;
break;
case '-x':
case '--escapeXML':
args.escapeXML = true;
break;
case '-f':
case '--fg':
args.fg = argv[i + 1];
skip = true;
break;
case '-b':
case '--bg':
args.bg = argv[i + 1];
skip = true;
break;
case '-v':
case '--version':
console.log(require(__dirname + '/../package.json').version);
process.exit(0); // istanbul ignore next
break;
case '-h':
case '--help':
console.log(help);
process.exit(0); // istanbul ignore next
break;
default:
file = argv[i];
}
}
var convert = new (require('./ansi_to_html.js'))(args);
var htmlStream = function htmlStream(stream) {
return stream.on('data', function (chunk) {
return process.stdout.write(convert.toHtml(chunk));
});
};
if (file) {
var stream = require('fs').createReadStream(file, {
encoding: 'utf8'
});
htmlStream(stream);
} else {
process.stdin.setEncoding('utf8');
htmlStream(process.stdin);
}
//# sourceMappingURL=cli.js.map

1
BACK_BACK/node_modules/ansi-to-html/lib/cli.js.map generated vendored Executable file
View file

@ -0,0 +1 @@
{"version":3,"sources":["../src/cli.js"],"names":["help","args","stream","file","skip","argv","process","slice","i","len","length","newline","escapeXML","fg","bg","console","log","require","__dirname","version","exit","convert","htmlStream","on","chunk","stdout","write","toHtml","createReadStream","encoding","stdin","setEncoding"],"mappings":"AAAA;AACA;;AACA,IAAMA,IAAI,ibAAV;AAeA,IAAMC,IAAI,GAAG;AACTC,EAAAA,MAAM,EAAE;AADC,CAAb;AAGA,IAAIC,IAAI,GAAG,IAAX;AAAA,IACIC,IAAI,GAAG,KADX;AAGA,IAAMC,IAAI,GAAGC,OAAO,CAACD,IAAR,CAAaE,KAAb,CAAmB,CAAnB,CAAb;;AACA,KACI,IAAIC,CAAC,GAAG,CAAR,EAAWC,GAAG,GAAGJ,IAAI,CAACK,MAD1B,EAEIF,CAAC,GAAGC,GAFR,EAGI,EAAED,CAHN,EAIE;AACE,MAAIJ,IAAJ,EAAU;AACNA,IAAAA,IAAI,GAAG,KAAP;AACA;AACH;;AACD,UAAQC,IAAI,CAACG,CAAD,CAAZ;AACI,SAAK,IAAL;AACA,SAAK,WAAL;AACIP,MAAAA,IAAI,CAACU,OAAL,GAAe,IAAf;AACA;;AACJ,SAAK,IAAL;AACA,SAAK,aAAL;AACIV,MAAAA,IAAI,CAACW,SAAL,GAAiB,IAAjB;AACA;;AACJ,SAAK,IAAL;AACA,SAAK,MAAL;AACIX,MAAAA,IAAI,CAACY,EAAL,GAAUR,IAAI,CAACG,CAAC,GAAG,CAAL,CAAd;AACAJ,MAAAA,IAAI,GAAG,IAAP;AACA;;AACJ,SAAK,IAAL;AACA,SAAK,MAAL;AACIH,MAAAA,IAAI,CAACa,EAAL,GAAUT,IAAI,CAACG,CAAC,GAAG,CAAL,CAAd;AACAJ,MAAAA,IAAI,GAAG,IAAP;AACA;;AACJ,SAAK,IAAL;AACA,SAAK,WAAL;AACIW,MAAAA,OAAO,CAACC,GAAR,CAAYC,OAAO,CAACC,SAAS,GAAG,kBAAb,CAAP,CAAwCC,OAApD;AACAb,MAAAA,OAAO,CAACc,IAAR,CAAa,CAAb,EAFJ,CAGI;;AACA;;AACJ,SAAK,IAAL;AACA,SAAK,QAAL;AACIL,MAAAA,OAAO,CAACC,GAAR,CAAYhB,IAAZ;AACAM,MAAAA,OAAO,CAACc,IAAR,CAAa,CAAb,EAFJ,CAGI;;AACA;;AACJ;AACIjB,MAAAA,IAAI,GAAGE,IAAI,CAACG,CAAD,CAAX;AAhCR;AAkCH;;AAED,IAAMa,OAAO,GAAG,KAAKJ,OAAO,CAAC,mBAAD,CAAZ,EAAmChB,IAAnC,CAAhB;;AAEA,IAAMqB,UAAU,GAAG,SAAbA,UAAa,CAAUpB,MAAV,EAAkB;AACjC,SAAOA,MAAM,CAACqB,EAAP,CAAU,MAAV,EAAkB,UAAUC,KAAV,EAAiB;AACtC,WAAOlB,OAAO,CAACmB,MAAR,CAAeC,KAAf,CAAqBL,OAAO,CAACM,MAAR,CAAeH,KAAf,CAArB,CAAP;AACH,GAFM,CAAP;AAGH,CAJD;;AAMA,IAAIrB,IAAJ,EAAU;AACN,MAAMD,MAAM,GAAGe,OAAO,CAAC,IAAD,CAAP,CAAcW,gBAAd,CAA+BzB,IAA/B,EAAqC;AAAC0B,IAAAA,QAAQ,EAAE;AAAX,GAArC,CAAf;;AACAP,EAAAA,UAAU,CAACpB,MAAD,CAAV;AACH,CAHD,MAGO;AACHI,EAAAA,OAAO,CAACwB,KAAR,CAAcC,WAAd,CAA0B,MAA1B;AACAT,EAAAA,UAAU,CAAChB,OAAO,CAACwB,KAAT,CAAV;AACH","sourcesContent":["'use strict';\n/* eslint no-console:0 */\nconst help = `\nusage: ansi-to-html [options] [file]\n\nfile: The file to display or stdin\n\noptions:\n\n -f, --fg The background color used for resets (#000)\n -b, --bg The foreground color used for resets (#FFF)\n -n, --newline Convert newline characters to <br/> (false)\n -x, --escapeXML Generate XML entities (false)\n -v, --version Print version\n -h, --help Print help\n`;\n\nconst args = {\n stream: true\n};\nlet file = null,\n skip = false;\n\nconst argv = process.argv.slice(2);\nfor (\n let i = 0, len = argv.length;\n i < len;\n ++i\n) {\n if (skip) {\n skip = false;\n continue;\n }\n switch (argv[i]) {\n case '-n':\n case '--newline':\n args.newline = true;\n break;\n case '-x':\n case '--escapeXML':\n args.escapeXML = true;\n break;\n case '-f':\n case '--fg':\n args.fg = argv[i + 1];\n skip = true;\n break;\n case '-b':\n case '--bg':\n args.bg = argv[i + 1];\n skip = true;\n break;\n case '-v':\n case '--version':\n console.log(require(__dirname + '/../package.json').version);\n process.exit(0);\n // istanbul ignore next\n break;\n case '-h':\n case '--help':\n console.log(help);\n process.exit(0);\n // istanbul ignore next\n break;\n default:\n file = argv[i];\n }\n}\n\nconst convert = new (require('./ansi_to_html.js'))(args);\n\nconst htmlStream = function (stream) {\n return stream.on('data', function (chunk) {\n return process.stdout.write(convert.toHtml(chunk));\n });\n};\n\nif (file) {\n const stream = require('fs').createReadStream(file, {encoding: 'utf8'});\n htmlStream(stream);\n} else {\n process.stdin.setEncoding('utf8');\n htmlStream(process.stdin);\n}\n"],"file":"cli.js"}

106
BACK_BACK/node_modules/ansi-to-html/package.json generated vendored Executable file
View file

@ -0,0 +1,106 @@
{
"name": "ansi-to-html",
"version": "0.6.15",
"description": "Convert ansi escaped text streams to html.",
"main": "lib/ansi_to_html.js",
"engines": {
"node": ">=8.0.0"
},
"scripts": {
"build": "babel src --source-maps --copy-files --out-dir lib",
"build:watch": "babel src --source-maps --out-dir lib --watch",
"lint": "eslint .",
"test": "nyc mocha --reporter tap",
"test:watch": "mocha --reporter tap --watch ./test ./"
},
"nyc": {
"reporter": [
"text",
"html"
]
},
"repository": {
"type": "git",
"url": "https://github.com/rburns/ansi-to-html.git"
},
"homepage": "https://github.com/rburns/ansi-to-html",
"bugs": {
"url": "https://github.com/rburns/ansi-to-html/issues"
},
"keywords": [
"ansi",
"html"
],
"author": {
"name": "Rob Burns",
"email": "rburns@paiges.net",
"url": "http://rburns.paiges.net/"
},
"contributors": [
{
"name": "Dane Stuckel",
"email": "dane.stuckel@gmail.com"
},
{
"name": "Michael",
"email": "michael@riesd.com"
},
{
"name": "Thorsten Kohnhorst",
"email": "monsterkodi@gmx.net"
},
{
"name": "Yoram Grahame",
"email": "yoz@yoz.com"
},
{
"name": "Patrick Steele-Idem",
"email": "pnidem@gmail.com"
},
{
"name": "Paul Grime",
"email": "gitgrimbo@gmail.com"
},
{
"name": "NeeEoo",
"url": "https://github.com/NeeEoo"
},
{
"name": "Brett Zamir",
"url": "https://github.com/brettz9"
},
{
"name": "Piotr Monwid-Olechnowicz",
"url": "https://github.com/hasparus"
},
{
"name": "Lior Chervinsky",
"url": "https://github.com/lior-chervinsky"
},
{
"name": "Maple Miao",
"url": "https://github.com/mapleeit"
}
],
"license": "MIT",
"devDependencies": {
"@babel/cli": "^7.8.4",
"@babel/core": "^7.9.0",
"@babel/preset-env": "^7.9.5",
"chai": "~4.2.0",
"eslint": "^6.8.0",
"mocha": "^7.1.1",
"nyc": "^15.0.1"
},
"dependencies": {
"entities": "^2.0.0"
},
"bin": {
"ansi-to-html": "./bin/ansi-to-html"
},
"babel": {
"presets": [
"@babel/env"
]
}
}

442
BACK_BACK/node_modules/ansi-to-html/test/ansi_to_html.js generated vendored Executable file
View file

@ -0,0 +1,442 @@
'use strict';
const {expect} = require('chai');
const Filter = require('../lib/ansi_to_html.js');
function test(text, result, done, opts) {
if (!opts) {
opts = {};
}
const f = new Filter(opts);
function filtered(memo, t) {
return memo + f.toHtml(t);
}
text = typeof text.reduce === 'function' ? text : [text];
expect(text.reduce(filtered, '')).to.equal(result);
return done();
}
describe('ansi to html', function () {
describe('constructed with no options', function () {
it('doesn\'t modify the input string', function (done) {
const text = 'some text';
const result = 'some text';
return test(text, result, done);
});
it('returns plain text when given plain text with linefeed', function (done) {
const text = 'test\ntest\n';
const result = 'test\ntest\n';
return test(text, result, done);
});
it('returns plain text when given plain text with CR & LF', function (done) {
const text = 'testCRLF\r\ntest';
const result = 'testCRLF\r\ntest';
return test(text, result, done);
});
it('returns plain text when given plain text with multi CR', function (done) {
const text = 'testCRLF\r\r\r\ntest';
const result = 'testCRLF\r\r\r\ntest';
return test(text, result, done);
});
it('renders foreground colors', function (done) {
const text = 'colors: \x1b[30mblack\x1b[37mwhite';
const result = 'colors: <span style="color:#000">black<span style="color:#AAA">white</span></span>';
return test(text, result, done);
});
it('renders light foreground colors', function (done) {
const text = 'colors: \x1b[90mblack\x1b[97mwhite';
const result = 'colors: <span style="color:#555">black<span style="color:#FFF">white</span></span>';
return test(text, result, done);
});
it('renders background colors', function (done) {
const text = 'colors: \x1b[40mblack\x1b[47mwhite';
const result = 'colors: <span style="background-color:#000">black<span style="background-color:#AAA">white</span></span>';
return test(text, result, done);
});
it('renders light background colors', function (done) {
const text = 'colors: \x1b[100mblack\x1b[107mwhite';
const result = 'colors: <span style="background-color:#555">black<span style="background-color:#FFF">white</span></span>';
return test(text, result, done);
});
it('renders strikethrough', function (done) {
const text = 'strike: \x1b[9mthat';
const result = 'strike: <strike>that</strike>';
return test(text, result, done);
});
it('renders blink', function (done) {
const text = 'blink: \x1b[5mwhat';
const result = 'blink: <blink>what</blink>';
return test(text, result, done);
});
it('renders underline', function (done) {
const text = 'underline: \x1b[4mstuff';
const result = 'underline: <u>stuff</u>';
return test(text, result, done);
});
it('renders bold', function (done) {
const text = 'bold: \x1b[1mstuff';
const result = 'bold: <b>stuff</b>';
return test(text, result, done);
});
it('renders italic', function (done) {
const text = 'italic: \x1b[3mstuff';
const result = 'italic: <i>stuff</i>';
return test(text, result, done);
});
it('handles resets', function (done) {
const text = '\x1b[1mthis is bold\x1b[0m, but this isn\'t';
const result = '<b>this is bold</b>, but this isn\'t';
return test(text, result, done);
});
it('handles multiple resets', function (done) {
const text = 'normal, \x1b[1mbold, \x1b[4munderline, \x1b[31mred\x1b[0m, normal';
const result = 'normal, <b>bold, <u>underline, <span style="color:' + '#A00">red</span></u></b>, normal';
return test(text, result, done);
});
it('handles resets with implicit 0', function (done) {
const text = '\x1b[1mthis is bold\x1b[m, but this isn\'t';
const result = '<b>this is bold</b>, but this isn\'t';
return test(text, result, done);
});
it('renders multi-attribute sequences', function (done) {
const text = 'normal, \x1b[1;4;31mbold, underline, and red\x1b[0m, normal';
const result = 'normal, <b><u><span style="color:#A00">bold, underline,' + ' and red</span></u></b>, normal';
return test(text, result, done);
});
it('renders multi-attribute sequences with a semi-colon', function (done) {
const text = 'normal, \x1b[1;4;31;mbold, underline, and red\x1b[0m, normal';
const result = 'normal, <b><u><span style="color:#A00">bold, underline, and red</span></u></b>, normal';
return test(text, result, done);
});
it('eats malformed sequences', function (done) {
const text = '\x1b[25oops forgot the \'m\'';
const result = 'oops forgot the \'m\'';
return test(text, result, done);
});
it('renders xterm 256 sequences', function (done) {
const text = '\x1b[38;5;196mhello';
const result = '<span style="color:#ff0000">hello</span>';
return test(text, result, done);
});
it('renders foreground rgb sequences', function (done) {
const text = '\x1b[38;2;210;60;114mhello';
const result = '<span style="color:#d23c72">hello</span>';
return test(text, result, done);
});
it('renders background rgb sequences', function (done) {
const text = '\x1b[48;2;155;42;45mhello';
const result = '<span style="background-color:#9b2a2d">hello</span>';
return test(text, result, done);
});
it('handles resetting to default foreground color', function (done) {
const text = '\x1b[30mblack\x1b[39mdefault';
const result = '<span style="color:#000">black<span style="color:#FFF">default</span></span>';
return test(text, result, done);
});
it('handles resetting to default background color', function (done) {
const text = '\x1b[100mblack\x1b[49mdefault';
const result = '<span style="background-color:#555">black<span style="background-color:#000">default</span></span>';
return test(text, result, done);
});
it('is able to disable underline', function (done) {
const text = 'underline: \x1b[4mstuff\x1b[24mthings';
const result = 'underline: <u>stuff</u>things';
return test(text, result, done);
});
it('is able to skip disabling underline', function (done) {
const text = 'not underline: stuff\x1b[24mthings';
const result = 'not underline: stuffthings';
return test(text, result, done);
});
it('renders two escape sequences in sequence', function (done) {
const text = 'months remaining\x1b[1;31mtimes\x1b[m\x1b[1;32mmultiplied by\x1b[m $10';
const result = 'months remaining<b><span style="color:#A00">times</span></b><b><span style="color:#0A0">multiplied by</span></b> $10';
return test(text, result, done);
});
it('drops EL code with no parameter', function (done) {
const text = '\x1b[Khello';
const result = 'hello';
return test(text, result, done);
});
it('drops EL code with 0 parameter', function (done) {
const text = '\x1b[0Khello';
const result = 'hello';
return test(text, result, done);
});
it('drops EL code with 0 parameter after new line character', function (done) {
const text = 'HELLO\n\x1b[0K\u001b[33;1mWORLD\u001b[0m\n';
const result = 'HELLO\n<span style="color:#A50"><b>WORLD</b></span>\n';
return test(text, result, done);
});
it('drops EL code with 1 parameter', function (done) {
const text = '\x1b[1Khello';
const result = 'hello';
return test(text, result, done);
});
it('drops EL code with 2 parameter', function (done) {
const text = '\x1b[2Khello';
const result = 'hello';
return test(text, result, done);
});
it('drops ED code with 0 parameter', function (done) {
const text = '\x1b[Jhello';
const result = 'hello';
return test(text, result, done);
});
it('drops ED code with 1 parameter', function (done) {
const text = '\x1b[1Jhello';
const result = 'hello';
return test(text, result, done);
});
it('drops HVP code with 0 parameter', function (done) {
const text = '\x1b[;fhello';
const result = 'hello';
return test(text, result, done);
});
it('drops HVP code with 1 parameter', function (done) {
const text = '\x1b[123;fhello';
const result = 'hello';
return test(text, result, done);
});
it('drops HVP code with 2 parameter', function (done) {
const text = '\x1b[123;456fhello';
const result = 'hello';
return test(text, result, done);
});
it('drops setusg0 sequence', function (done) {
const text = '\x1b[(Bhello';
const result = 'hello';
return test(text, result, done);
});
it('renders un-italic code appropriately', function (done) {
const text = '\x1b[3mHello\x1b[23m World';
const result = '<i>Hello</i> World';
return test(text, result, done);
});
it('skips rendering un-italic code appropriately', function (done) {
const text = 'Hello\x1b[23m World';
const result = 'Hello World';
return test(text, result, done);
});
it('renders overline', function (done) {
const text = '\x1b[53mHello World';
const result = '<span style="text-decoration:overline">Hello World</span>';
return test(text, result, done);
});
it('renders normal text', function (done) {
const text = '\x1b[22mnormal text';
const result = '<span style="font-weight:normal;text-decoration:none;font-style:normal">normal text</span>';
return test(text, result, done);
});
});
describe('with escapeXML option enabled', function () {
it('escapes XML entities', function (done) {
const text = 'normal, \x1b[1;4;31;mbold, <underline>, and red\x1b[0m, normal';
const result = 'normal, <b><u><span style="color:#A00">bold, &lt;underline&gt;, and red</span></u></b>, normal';
return test(text, result, done, {escapeXML: true});
});
});
describe('with newline option enabled', function () {
it('renders line breaks', function (done) {
const text = 'test\ntest\n';
const result = 'test<br/>test<br/>';
return test(text, result, done, {newline: true});
});
it('renders windows styled line breaks (CR+LF)', function (done) {
const text = 'testCRLF\r\ntestLF';
const result = 'testCRLF<br/>testLF';
return test(text, result, done, {newline: true});
});
it('renders windows styled line breaks (multi CR+LF)', function (done) {
const text = 'testCRLF\r\r\r\ntestLF';
const result = 'testCRLF<br/>testLF';
return test(text, result, done, {newline: true});
});
it('renders multiple line breaks', function (done) {
const text = 'test\n\ntest\n';
const result = 'test<br/><br/>test<br/>';
return test(text, result, done, {newline: true});
});
});
describe('with stream option enabled', function () {
it('persists styles between toHtml() invocations', function (done) {
const text = ['\x1b[31mred', 'also red'];
const result = '<span style="color:#A00">red</span><span style="color:#A00">also red</span>';
return test(text, result, done, {stream: true});
});
it('persists styles between more than two toHtml() invocations', function (done) {
const text = ['\x1b[31mred', 'also red', 'and red'];
const result = '<span style="color:#A00">red</span><span style="color:#A00">also red</span><span style="color:#A00">and red</span>';
return test(text, result, done, {stream: true});
});
it('does not persist styles beyond their usefulness', function (done) {
const text = ['\x1b[31mred', 'also red', '\x1b[30mblack', 'and black'];
const result = '<span style="color:#A00">red</span><span style="color:#A00">also red</span><span style="color:#A00"><span style="color:#000">black</span></span><span style="color:#000">and black</span>';
return test(text, result, done, {stream: true});
});
it('removes one state when encountering a reset', function (done) {
const text = ['\x1b[1mthis is bold\x1b[0m, but this isn\'t', ' nor is this'];
const result = '<b>this is bold</b>, but this isn\'t nor is this';
return test(text, result, done, {stream: true});
});
it('removes multiple state when encountering a reset', function (done) {
const text = ['\x1b[1mthis \x1b[9mis bold\x1b[0m, but this isn\'t', ' nor is this'];
const result = '<b>this <strike>is bold</strike></b>, but this isn\'t nor is this';
return test(text, result, done, {stream: true});
});
});
describe('with custom colors enabled', function () {
it('renders basic colors', function (done) {
const text = ['\x1b[31mblue', 'not blue'];
const result = '<span style="color:#00A">blue</span>not blue';
return test(text, result, done, {colors: {1: '#00A'}});
});
it('renders basic colors with streaming', function (done) {
const text = ['\x1b[31mblue', 'also blue'];
const result = '<span style="color:#00A">blue</span><span style="color:#00A">also blue</span>';
return test(text, result, done, {stream: true, colors: {1: '#00A'}});
});
it('renders custom colors and default colors', function (done) {
const text = ['\x1b[31mblue', 'not blue', '\x1b[94mlight blue', 'not colored'];
const result = '<span style="color:#00A">blue</span>not blue<span style="color:#55F">light blue</span>not colored';
return test(text, result, done, {colors: {1: '#00A'}});
});
it('renders custom colors and default colors together', function (done) {
const text = ['\x1b[31mblue', 'not blue', '\x1b[94mlight blue', 'not colored'];
const result = '<span style="color:#00A">blue</span>not blue<span style="color:#55F">light blue</span>not colored';
return test(text, result, done, {colors: {1: '#00A'}});
});
it('renders custom 8/ 16 colors', function (done) {
// code - 90 + 8 = color
// so 94 - 90 + 8 = 12
const text = ['\x1b[94mlighter blue'];
const result = '<span style="color:#33F">lighter blue</span>';
return test(text, result, done, {colors: {12: '#33F'}});
});
it('renders custom 256 colors', function (done) {
// code - 90 + 8 = color
// so 94 - 90 + 8 = 12
const text = ['\x1b[38;5;125mdark red', 'then \x1b[38;5;126msome other color'];
const result = '<span style="color:#af005f">dark red</span>then <span style="color:#af225f">some other color</span>';
return test(text, result, done, {colors: {126: '#af225f'}});
});
});
});

110
BACK_BACK/node_modules/ansi-to-html/test/cli.js generated vendored Executable file
View file

@ -0,0 +1,110 @@
'use strict';
const childProcess = require('child_process');
const {EOL} = require('os');
const {expect} = require('chai');
function getColorCmd(cmd, args, {shortFlags} = {}) {
const flags = Object.entries(args || {}).reduce((s, [flag, value]) => {
return s + `${shortFlags ? '-' : '--'}${flag} ${value} `;
}, '');
const cmds = {
darwin: `CLICOLOR_FORCE="1" ${cmd} | node lib/cli ${flags}`,
linux: `CLICOLOR="1" ${cmd} | node lib/cli ${flags}`,
// for win32 compatibility, make sure there is no space between the cmd and the pipe
win32: `${cmd}| node lib/cli ${flags}`
};
return cmds[process.platform];
}
function echo(str) {
if (process.platform === 'win32') {
return `echo ${str}`;
}
return `echo "${str}"`;
}
function runCLI (cmd, args) {
return new Promise((resolve, reject) => {
childProcess.exec(cmd, {
...args,
timeout: 10000
}, (err, stdout, stderr) => {
if (err) {
return reject(err);
}
if (stderr) {
return reject(stderr);
}
resolve(stdout);
});
});
}
function runColorCLI (data, args, opts) {
return runCLI(getColorCmd(data, args, opts));
}
describe('cli', function () {
it('converts colors', async function () {
const data = echo('what\u001b[0;31m what?');
const result = `what<span style="color:#A00"> what?${EOL}</span>`;
const stdout = await runColorCLI(data);
expect(stdout).to.equal(result);
});
it('works with flags', async function () {
const data = echo('test\ntest\n');
// Has an additional line break relative to programmatic, due to `echo`
const result = 'test<br/>test<br/><br/>';
const stdout = await runColorCLI(data, {newline: ''});
expect(stdout).to.equal(result);
});
it('works with multiple flags', async function () {
const data = echo('test\n<test\n');
// Has an additional line break relative to programmatic, due to `echo`
const result = 'test<br/>&lt;test<br/><br/>';
let stdout = await runColorCLI(
data, {
newline: '', escapeXML: '', fg: '"#FAF"', bg: '"#0F0"'
}
);
expect(stdout).to.equal(result);
stdout = await runColorCLI(
data, {
n: '', x: '', f: '"#FAF"', b: '"#0F0"'
},
{shortFlags: true}
);
expect(stdout).to.equal(result);
});
it('prints version', async function () {
const result = '0.6.14\n';
let stdout = await runCLI('node lib/cli --version');
expect(stdout).to.equal(result);
stdout = await runCLI('node lib/cli -v');
expect(stdout).to.equal(result);
});
it('prints help', async function () {
const result = 'ansi-to-html [options] [file]';
let stdout = await runCLI('node lib/cli --help');
expect(stdout).to.contain(result);
stdout = await runCLI('node lib/cli -h');
expect(stdout).to.contain(result);
});
it('works with a file', async function () {
// Has an additional line break relative to programmatic, due to `echo`
const result = 'test\ntest\n';
const stdout = await runCLI('node lib/cli test/fixtures/data.txt');
expect(stdout).to.equal(result);
});
});

2
BACK_BACK/node_modules/ansi-to-html/test/fixtures/data.txt generated vendored Executable file
View file

@ -0,0 +1,2 @@
test
test