mirror of
https://kevinblog.sytes.net/Code/Jibo-Revival-Group/RoboCommander.git
synced 2026-06-15 10:26:04 +00:00
Initial commit
This commit is contained in:
168
node_modules/wrap-ansi/index.js
generated
vendored
Executable file
168
node_modules/wrap-ansi/index.js
generated
vendored
Executable file
@@ -0,0 +1,168 @@
|
||||
'use strict';
|
||||
var stringWidth = require('string-width');
|
||||
var stripAnsi = require('strip-ansi');
|
||||
|
||||
var ESCAPES = [
|
||||
'\u001b',
|
||||
'\u009b'
|
||||
];
|
||||
|
||||
var END_CODE = 39;
|
||||
|
||||
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
|
||||
};
|
||||
|
||||
function wrapAnsi(code) {
|
||||
return ESCAPES[0] + '[' + code + 'm';
|
||||
}
|
||||
|
||||
// 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);
|
||||
});
|
||||
}
|
||||
|
||||
// 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 (var i = 0; i < word.length; i++) {
|
||||
var x = word[i];
|
||||
|
||||
rows[rows.length - 1] += x;
|
||||
|
||||
if (ESCAPES.indexOf(x) !== -1) {
|
||||
insideEscape = true;
|
||||
} else if (insideEscape && x === 'm') {
|
||||
insideEscape = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (insideEscape) {
|
||||
continue;
|
||||
}
|
||||
|
||||
visible++;
|
||||
|
||||
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.
|
||||
if (!visible && rows[rows.length - 1].length > 0 && rows.length > 1) {
|
||||
rows[rows.length - 2] += rows.pop();
|
||||
}
|
||||
}
|
||||
|
||||
// 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 cols characters.
|
||||
//
|
||||
// 'soft' allows long words to expand past the column length.
|
||||
function exec(str, cols, opts) {
|
||||
var options = opts || {};
|
||||
|
||||
var pre = '';
|
||||
var ret = '';
|
||||
var escapeCode;
|
||||
|
||||
var lengths = wordLengths(str);
|
||||
var words = str.split(' ');
|
||||
var rows = [''];
|
||||
|
||||
for (var i = 0, word; (word = words[i]) !== undefined; i++) {
|
||||
var rowLength = stringWidth(rows[rows.length - 1]);
|
||||
|
||||
if (rowLength) {
|
||||
rows[rows.length - 1] += ' ';
|
||||
rowLength++;
|
||||
}
|
||||
|
||||
// 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, cols);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (rowLength + lengths[i] > cols && rowLength > 0) {
|
||||
if (options.wordWrap === false && rowLength < cols) {
|
||||
wrapWord(rows, word, cols);
|
||||
continue;
|
||||
}
|
||||
|
||||
rows.push('');
|
||||
}
|
||||
|
||||
rows[rows.length - 1] += word;
|
||||
}
|
||||
|
||||
pre = rows.map(function (r) {
|
||||
return r.trim();
|
||||
}).join('\n');
|
||||
|
||||
for (var j = 0; j < pre.length; j++) {
|
||||
var y = pre[j];
|
||||
|
||||
ret += y;
|
||||
|
||||
if (ESCAPES.indexOf(y) !== -1) {
|
||||
var code = parseFloat(/[0-9][^m]*/.exec(pre.slice(j, j + 4)));
|
||||
escapeCode = code === END_CODE ? null : code;
|
||||
}
|
||||
|
||||
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 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');
|
||||
};
|
||||
21
node_modules/wrap-ansi/license
generated
vendored
Normal file
21
node_modules/wrap-ansi/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
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:
|
||||
|
||||
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.
|
||||
46
node_modules/wrap-ansi/node_modules/is-fullwidth-code-point/index.js
generated
vendored
Normal file
46
node_modules/wrap-ansi/node_modules/is-fullwidth-code-point/index.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
'use strict';
|
||||
var numberIsNan = require('number-is-nan');
|
||||
|
||||
module.exports = function (x) {
|
||||
if (numberIsNan(x)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// https://github.com/nodejs/io.js/blob/cff7300a578be1b10001f2d967aaedc88aee6402/lib/readline.js#L1369
|
||||
|
||||
// code points are derived from:
|
||||
// http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt
|
||||
if (x >= 0x1100 && (
|
||||
x <= 0x115f || // Hangul Jamo
|
||||
0x2329 === x || // LEFT-POINTING ANGLE BRACKET
|
||||
0x232a === x || // RIGHT-POINTING ANGLE BRACKET
|
||||
// CJK Radicals Supplement .. Enclosed CJK Letters and Months
|
||||
(0x2e80 <= x && x <= 0x3247 && x !== 0x303f) ||
|
||||
// Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
|
||||
0x3250 <= x && x <= 0x4dbf ||
|
||||
// CJK Unified Ideographs .. Yi Radicals
|
||||
0x4e00 <= x && x <= 0xa4c6 ||
|
||||
// Hangul Jamo Extended-A
|
||||
0xa960 <= x && x <= 0xa97c ||
|
||||
// Hangul Syllables
|
||||
0xac00 <= x && x <= 0xd7a3 ||
|
||||
// CJK Compatibility Ideographs
|
||||
0xf900 <= x && x <= 0xfaff ||
|
||||
// Vertical Forms
|
||||
0xfe10 <= x && x <= 0xfe19 ||
|
||||
// CJK Compatibility Forms .. Small Form Variants
|
||||
0xfe30 <= x && x <= 0xfe6b ||
|
||||
// Halfwidth and Fullwidth Forms
|
||||
0xff01 <= x && x <= 0xff60 ||
|
||||
0xffe0 <= x && x <= 0xffe6 ||
|
||||
// Kana Supplement
|
||||
0x1b000 <= x && x <= 0x1b001 ||
|
||||
// Enclosed Ideographic Supplement
|
||||
0x1f200 <= x && x <= 0x1f251 ||
|
||||
// CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
|
||||
0x20000 <= x && x <= 0x3fffd)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
21
node_modules/wrap-ansi/node_modules/is-fullwidth-code-point/license
generated
vendored
Normal file
21
node_modules/wrap-ansi/node_modules/is-fullwidth-code-point/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
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:
|
||||
|
||||
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.
|
||||
25
node_modules/wrap-ansi/node_modules/is-fullwidth-code-point/package.json
generated
vendored
Normal file
25
node_modules/wrap-ansi/node_modules/is-fullwidth-code-point/package.json
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "is-fullwidth-code-point",
|
||||
"version": "1.0.0",
|
||||
"description": "Check if the character represented by a given Unicode code point is fullwidth",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/is-fullwidth-code-point",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"number-is-nan": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "0.0.4",
|
||||
"code-point-at": "^1.0.0"
|
||||
}
|
||||
}
|
||||
37
node_modules/wrap-ansi/node_modules/string-width/index.js
generated
vendored
Normal file
37
node_modules/wrap-ansi/node_modules/string-width/index.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
'use strict';
|
||||
var stripAnsi = require('strip-ansi');
|
||||
var codePointAt = require('code-point-at');
|
||||
var isFullwidthCodePoint = require('is-fullwidth-code-point');
|
||||
|
||||
// https://github.com/nodejs/io.js/blob/cff7300a578be1b10001f2d967aaedc88aee6402/lib/readline.js#L1345
|
||||
module.exports = function (str) {
|
||||
if (typeof str !== 'string' || str.length === 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
var width = 0;
|
||||
|
||||
str = stripAnsi(str);
|
||||
|
||||
for (var i = 0; i < str.length; i++) {
|
||||
var code = codePointAt(str, i);
|
||||
|
||||
// ignore control characters
|
||||
if (code <= 0x1f || (code >= 0x7f && code <= 0x9f)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// surrogates
|
||||
if (code >= 0x10000) {
|
||||
i++;
|
||||
}
|
||||
|
||||
if (isFullwidthCodePoint(code)) {
|
||||
width += 2;
|
||||
} else {
|
||||
width++;
|
||||
}
|
||||
}
|
||||
|
||||
return width;
|
||||
};
|
||||
21
node_modules/wrap-ansi/node_modules/string-width/license
generated
vendored
Normal file
21
node_modules/wrap-ansi/node_modules/string-width/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
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:
|
||||
|
||||
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.
|
||||
27
node_modules/wrap-ansi/node_modules/string-width/package.json
generated
vendored
Normal file
27
node_modules/wrap-ansi/node_modules/string-width/package.json
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"name": "string-width",
|
||||
"version": "1.0.2",
|
||||
"description": "Get the visual width of a string - the number of columns required to display it",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/string-width",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"code-point-at": "^1.0.0",
|
||||
"is-fullwidth-code-point": "^1.0.0",
|
||||
"strip-ansi": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "*"
|
||||
}
|
||||
}
|
||||
37
node_modules/wrap-ansi/package.json
generated
vendored
Normal file
37
node_modules/wrap-ansi/package.json
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"name": "wrap-ansi",
|
||||
"version": "2.1.0",
|
||||
"description": "Wordwrap a string with ANSI escape codes",
|
||||
"license": "MIT",
|
||||
"repository": "chalk/wrap-ansi",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"maintainers": [
|
||||
"Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)",
|
||||
"Joshua Appelman <jappelman@xebia.com> (jbnicolai.com)",
|
||||
"JD Ballard <i.am.qix@gmail.com> (github.com/qix-)",
|
||||
"Benjamin Coe <ben@npmjs.com> (github.com/bcoe)"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"string-width": "^1.0.1",
|
||||
"strip-ansi": "^3.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"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": "*"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user