feat: init
This commit is contained in:
63
node_modules/@isaacs/cliui/LICENSE.md
generated
vendored
Normal file
63
node_modules/@isaacs/cliui/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
Several modules are vendored under `./src`, which are used and
|
||||
distributed according to their respective licenses, each provided
|
||||
in the same directory as the code.
|
||||
|
||||
Everything else is released under the following license.
|
||||
|
||||
----
|
||||
|
||||
# Blue Oak Model License
|
||||
|
||||
Version 1.0.0
|
||||
|
||||
## Purpose
|
||||
|
||||
This license gives everyone as much permission to work with
|
||||
this software as possible, while protecting contributors
|
||||
from liability.
|
||||
|
||||
## Acceptance
|
||||
|
||||
In order to receive this license, you must agree to its
|
||||
rules. The rules of this license are both obligations
|
||||
under that agreement and conditions to your license.
|
||||
You must not do anything with this software that triggers
|
||||
a rule that you cannot or will not follow.
|
||||
|
||||
## Copyright
|
||||
|
||||
Each contributor licenses you to do everything with this
|
||||
software that would otherwise infringe that contributor's
|
||||
copyright in it.
|
||||
|
||||
## Notices
|
||||
|
||||
You must ensure that everyone who gets a copy of
|
||||
any part of this software from you, with or without
|
||||
changes, also gets the text of this license or a link to
|
||||
<https://blueoakcouncil.org/license/1.0.0>.
|
||||
|
||||
## Excuse
|
||||
|
||||
If anyone notifies you in writing that you have not
|
||||
complied with [Notices](#notices), you can keep your
|
||||
license by taking all practical steps to comply within 30
|
||||
days after the notice. If you do not do so, your license
|
||||
ends immediately.
|
||||
|
||||
## Patent
|
||||
|
||||
Each contributor licenses you to do everything with this
|
||||
software that would otherwise infringe any patent claims
|
||||
they can license or become able to license.
|
||||
|
||||
## Reliability
|
||||
|
||||
No contributor can revoke this license.
|
||||
|
||||
## No Liability
|
||||
|
||||
**_As far as the law allows, this software comes as is,
|
||||
without any warranty or condition, and no contributor
|
||||
will be liable to anyone for any damages related to this
|
||||
software or this license, under any kind of legal claim._**
|
||||
151
node_modules/@isaacs/cliui/README.md
generated
vendored
Normal file
151
node_modules/@isaacs/cliui/README.md
generated
vendored
Normal file
@@ -0,0 +1,151 @@
|
||||
# @isaacs/cliui
|
||||
|
||||
Fork of [cliui](http://npm.im/cliui). Fully CommonJS/ESM
|
||||
hybridized, with all dependencies vendored and optimized for
|
||||
minimal bundle size without sacrificing functionality.
|
||||
|
||||
easily create complex multi-column command-line-interfaces.
|
||||
|
||||
## Changes in v9
|
||||
|
||||
The default export is no longer exported. So, intead of `import
|
||||
cliui from '@isaacs/cliui'`, you'll do `import { cliui } from
|
||||
'@isaacs/cliui'`. This is done in order to minimize typescript
|
||||
oddness between the CommonJS and ESM versions.
|
||||
|
||||
A minified export is provided at `@isaacs/cliui/min`. If you are
|
||||
concerned about bundle size, that's the thing to use.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
import { cliui } from '@isaacs/cliui'
|
||||
// or: const { cliui } = require('cliui')
|
||||
const ui = cliui()
|
||||
|
||||
ui.div('Usage: $0 [command] [options]')
|
||||
|
||||
ui.div({
|
||||
text: 'Options:',
|
||||
padding: [2, 0, 1, 0],
|
||||
})
|
||||
|
||||
ui.div(
|
||||
{
|
||||
text: '-f, --file',
|
||||
width: 20,
|
||||
padding: [0, 4, 0, 4],
|
||||
},
|
||||
{
|
||||
text:
|
||||
'the file to load.' +
|
||||
chalk.green('(if this description is long it wraps).'),
|
||||
width: 20,
|
||||
},
|
||||
{
|
||||
text: chalk.red('[required]'),
|
||||
align: 'right',
|
||||
},
|
||||
)
|
||||
|
||||
console.log(ui.toString())
|
||||
```
|
||||
|
||||
## Deno/ESM Support
|
||||
|
||||
Load the minified version from unpkg.
|
||||
|
||||
```typescript
|
||||
import { cliui } from 'https://unpkg.com/@isaacs/cliui/dist/esm/index.min.js'
|
||||
|
||||
const ui = cliui({})
|
||||
|
||||
ui.div('Usage: $0 [command] [options]')
|
||||
|
||||
ui.div({
|
||||
text: 'Options:',
|
||||
padding: [2, 0, 1, 0],
|
||||
})
|
||||
|
||||
ui.div({
|
||||
text: '-f, --file',
|
||||
width: 20,
|
||||
padding: [0, 4, 0, 4],
|
||||
})
|
||||
|
||||
console.log(ui.toString())
|
||||
```
|
||||
|
||||
<img width="500" src="screenshot.png">
|
||||
|
||||
## Layout DSL
|
||||
|
||||
cliui exposes a simple layout DSL:
|
||||
|
||||
If you create a single `ui.div`, passing a string rather than an
|
||||
object:
|
||||
|
||||
- `\n`: characters will be interpreted as new rows.
|
||||
- `\t`: characters will be interpreted as new columns.
|
||||
- `\s`: characters will be interpreted as padding.
|
||||
|
||||
**as an example...**
|
||||
|
||||
```js
|
||||
var ui = require('./')({
|
||||
width: 60,
|
||||
})
|
||||
|
||||
ui.div(
|
||||
'Usage: node ./bin/foo.js\n' +
|
||||
' <regex>\t provide a regex\n' +
|
||||
' <glob>\t provide a glob\t [required]',
|
||||
)
|
||||
|
||||
console.log(ui.toString())
|
||||
```
|
||||
|
||||
**will output:**
|
||||
|
||||
```shell
|
||||
Usage: node ./bin/foo.js
|
||||
<regex> provide a regex
|
||||
<glob> provide a glob [required]
|
||||
```
|
||||
|
||||
## Methods
|
||||
|
||||
```js
|
||||
cliui = require('@isaacs/cliui')
|
||||
```
|
||||
|
||||
### cliui({width: integer})
|
||||
|
||||
Specify the maximum width of the UI being generated.
|
||||
If no width is provided, cliui will try to get the current window's width and use it, and if that doesn't work, width will be set to `80`.
|
||||
|
||||
### cliui({wrap: boolean})
|
||||
|
||||
Enable or disable the wrapping of text in a column.
|
||||
|
||||
### cliui.div(column, column, column)
|
||||
|
||||
Create a row with any number of columns, a column
|
||||
can either be a string, or an object with the following
|
||||
options:
|
||||
|
||||
- **text:** some text to place in the column.
|
||||
- **width:** the width of a column.
|
||||
- **align:** alignment, `right` or `center`.
|
||||
- **padding:** `[top, right, bottom, left]`.
|
||||
- **border:** should a border be placed around the div?
|
||||
|
||||
### cliui.span(column, column, column)
|
||||
|
||||
Similar to `div`, except the next row will be appended without
|
||||
a new line being created.
|
||||
|
||||
### cliui.resetOutput()
|
||||
|
||||
Resets the UI elements of the current cliui instance, maintaining the values
|
||||
set for `width` and `wrap`.
|
||||
4
node_modules/@isaacs/cliui/dist/commonjs/ansi-regex/index.d.ts
generated
vendored
Normal file
4
node_modules/@isaacs/cliui/dist/commonjs/ansi-regex/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export declare const ansiRegex: ({ onlyFirst }?: {
|
||||
onlyFirst?: boolean | undefined;
|
||||
}) => RegExp;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/@isaacs/cliui/dist/commonjs/ansi-regex/index.d.ts.map
generated
vendored
Normal file
1
node_modules/@isaacs/cliui/dist/commonjs/ansi-regex/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ansi-regex/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS,GAAI;;CAA0B,WAcnD,CAAC"}
|
||||
16
node_modules/@isaacs/cliui/dist/commonjs/ansi-regex/index.js
generated
vendored
Normal file
16
node_modules/@isaacs/cliui/dist/commonjs/ansi-regex/index.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
// TODO! cut this down? do we need the onlyFirst option?
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ansiRegex = void 0;
|
||||
const ansiRegex = ({ onlyFirst = false } = {}) => {
|
||||
// Valid string terminator sequences are BEL, ESC\, and 0x9c
|
||||
const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
|
||||
// OSC sequences only: ESC ] ... ST (non-greedy until the first ST)
|
||||
const osc = `(?:\\u001B\\][\\s\\S]*?${ST})`;
|
||||
// CSI and related: ESC/C1, optional intermediates, optional params (supports ; and :) then final byte
|
||||
const csi = "[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";
|
||||
const pattern = `${osc}|${csi}`;
|
||||
return new RegExp(pattern, onlyFirst ? undefined : "g");
|
||||
};
|
||||
exports.ansiRegex = ansiRegex;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@isaacs/cliui/dist/commonjs/ansi-regex/index.js.map
generated
vendored
Normal file
1
node_modules/@isaacs/cliui/dist/commonjs/ansi-regex/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ansi-regex/index.ts"],"names":[],"mappings":";AAAA,wDAAwD;;;AAEjD,MAAM,SAAS,GAAG,CAAC,EAAE,SAAS,GAAG,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE;IACtD,4DAA4D;IAC5D,MAAM,EAAE,GAAG,oCAAoC,CAAC;IAEhD,mEAAmE;IACnE,MAAM,GAAG,GAAG,0BAA0B,EAAE,GAAG,CAAC;IAE5C,sGAAsG;IACtG,MAAM,GAAG,GACP,oFAAoF,CAAC;IAEvF,MAAM,OAAO,GAAG,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC;IAEhC,OAAO,IAAI,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAC1D,CAAC,CAAC;AAdW,QAAA,SAAS,aAcpB","sourcesContent":["// TODO! cut this down? do we need the onlyFirst option?\n\nexport const ansiRegex = ({ onlyFirst = false } = {}) => {\n // Valid string terminator sequences are BEL, ESC\\, and 0x9c\n const ST = \"(?:\\\\u0007|\\\\u001B\\\\u005C|\\\\u009C)\";\n\n // OSC sequences only: ESC ] ... ST (non-greedy until the first ST)\n const osc = `(?:\\\\u001B\\\\][\\\\s\\\\S]*?${ST})`;\n\n // CSI and related: ESC/C1, optional intermediates, optional params (supports ; and :) then final byte\n const csi =\n \"[\\\\u001B\\\\u009B][[\\\\]()#;?]*(?:\\\\d{1,4}(?:[;:]\\\\d{0,4})*)?[\\\\dA-PR-TZcf-nq-uy=><~]\";\n\n const pattern = `${osc}|${csi}`;\n\n return new RegExp(pattern, onlyFirst ? undefined : \"g\");\n};\n"]}
|
||||
34
node_modules/@isaacs/cliui/dist/commonjs/ansi-styles/index.d.ts
generated
vendored
Normal file
34
node_modules/@isaacs/cliui/dist/commonjs/ansi-styles/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
export declare const modifierNames: string[];
|
||||
export declare const foregroundColorNames: string[];
|
||||
export declare const backgroundColorNames: string[];
|
||||
export declare const colorNames: string[];
|
||||
export declare const codes: Map<number, number>;
|
||||
export declare const ansiStyles: {
|
||||
[x: string]: unknown;
|
||||
codes: Map<number, number>;
|
||||
modifier: {
|
||||
[k: string]: {
|
||||
open: string;
|
||||
close: string;
|
||||
};
|
||||
};
|
||||
color: {
|
||||
close: string;
|
||||
ansi: (code: number) => string;
|
||||
ansi256: (code: number) => string;
|
||||
ansi16m: (red: number, green: number, blue: number) => string;
|
||||
};
|
||||
bgColor: {
|
||||
close: string;
|
||||
ansi: (code: number) => string;
|
||||
ansi256: (code: number) => string;
|
||||
ansi16m: (red: number, green: number, blue: number) => string;
|
||||
};
|
||||
rgbToAnsi256(red: number, green: number, blue: number): number;
|
||||
hexToRgb(hex: number): [number, number, number];
|
||||
hexToAnsi256(hex: number): number;
|
||||
ansi256ToAnsi(code: number): number;
|
||||
rgbToAnsi(red: number, green: number, blue: number): number;
|
||||
hexToAnsi(hex: number): number;
|
||||
};
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/@isaacs/cliui/dist/commonjs/ansi-styles/index.d.ts.map
generated
vendored
Normal file
1
node_modules/@isaacs/cliui/dist/commonjs/ansi-styles/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ansi-styles/index.ts"],"names":[],"mappings":"AA2DA,eAAO,MAAM,aAAa,UAA+B,CAAC;AAC1D,eAAO,MAAM,oBAAoB,UAA4B,CAAC;AAC9D,eAAO,MAAM,oBAAoB,UAA8B,CAAC;AAChE,eAAO,MAAM,UAAU,UAAqD,CAAC;AAK7E,eAAO,MAAM,KAAK,qBAA4B,CAAC;AAe/C,eAAO,MAAM,UAAU;;;;;;;;;;;qBAQN,MAAM;wBACH,MAAM;uBACP,MAAM,SAAS,MAAM,QAAQ,MAAM;;;;qBAOrC,MAAM;wBACH,MAAM;uBACP,MAAM,SAAS,MAAM,QAAQ,MAAM;;sBAIlC,MAAM,SAAS,MAAM,QAAQ,MAAM;kBAiBvC,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;sBAuB7B,MAAM;wBAGJ,MAAM;mBA2CX,MAAM,SAAS,MAAM,QAAQ,MAAM;mBAGnC,MAAM;CAGnB,CAAC"}
|
||||
170
node_modules/@isaacs/cliui/dist/commonjs/ansi-styles/index.js
generated
vendored
Normal file
170
node_modules/@isaacs/cliui/dist/commonjs/ansi-styles/index.js
generated
vendored
Normal file
@@ -0,0 +1,170 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ansiStyles = exports.codes = exports.colorNames = exports.backgroundColorNames = exports.foregroundColorNames = exports.modifierNames = void 0;
|
||||
const styles = {
|
||||
modifier: {
|
||||
reset: [0, 0],
|
||||
// 21 isn't widely supported and 22 does the same thing
|
||||
bold: [1, 22],
|
||||
dim: [2, 22],
|
||||
italic: [3, 23],
|
||||
underline: [4, 24],
|
||||
overline: [53, 55],
|
||||
inverse: [7, 27],
|
||||
hidden: [8, 28],
|
||||
strikethrough: [9, 29],
|
||||
},
|
||||
color: {
|
||||
black: [30, 39],
|
||||
red: [31, 39],
|
||||
green: [32, 39],
|
||||
yellow: [33, 39],
|
||||
blue: [34, 39],
|
||||
magenta: [35, 39],
|
||||
cyan: [36, 39],
|
||||
white: [37, 39],
|
||||
// Bright color
|
||||
blackBright: [90, 39],
|
||||
gray: [90, 39], // Alias of `blackBright`
|
||||
grey: [90, 39], // Alias of `blackBright`
|
||||
redBright: [91, 39],
|
||||
greenBright: [92, 39],
|
||||
yellowBright: [93, 39],
|
||||
blueBright: [94, 39],
|
||||
magentaBright: [95, 39],
|
||||
cyanBright: [96, 39],
|
||||
whiteBright: [97, 39],
|
||||
},
|
||||
bgColor: {
|
||||
bgBlack: [40, 49],
|
||||
bgRed: [41, 49],
|
||||
bgGreen: [42, 49],
|
||||
bgYellow: [43, 49],
|
||||
bgBlue: [44, 49],
|
||||
bgMagenta: [45, 49],
|
||||
bgCyan: [46, 49],
|
||||
bgWhite: [47, 49],
|
||||
// Bright color
|
||||
bgBlackBright: [100, 49],
|
||||
bgGray: [100, 49], // Alias of `bgBlackBright`
|
||||
bgGrey: [100, 49], // Alias of `bgBlackBright`
|
||||
bgRedBright: [101, 49],
|
||||
bgGreenBright: [102, 49],
|
||||
bgYellowBright: [103, 49],
|
||||
bgBlueBright: [104, 49],
|
||||
bgMagentaBright: [105, 49],
|
||||
bgCyanBright: [106, 49],
|
||||
bgWhiteBright: [107, 49],
|
||||
},
|
||||
};
|
||||
exports.modifierNames = Object.keys(styles.modifier);
|
||||
exports.foregroundColorNames = Object.keys(styles.color);
|
||||
exports.backgroundColorNames = Object.keys(styles.bgColor);
|
||||
exports.colorNames = [...exports.foregroundColorNames, ...exports.backgroundColorNames];
|
||||
class AnsiStyles {
|
||||
}
|
||||
exports.codes = new Map();
|
||||
const ingest = (set) => Object.fromEntries(Object.entries(set).map(([key, [open, close]]) => {
|
||||
exports.codes.set(open, close);
|
||||
return [
|
||||
key,
|
||||
(AnsiStyles.prototype[key] = {
|
||||
open: `\u001B[${open}m`,
|
||||
close: `\u001B[${close}m`,
|
||||
}),
|
||||
];
|
||||
}));
|
||||
exports.ansiStyles = new (class extends AnsiStyles {
|
||||
codes = exports.codes;
|
||||
modifier = ingest(styles.modifier);
|
||||
color = {
|
||||
...ingest(styles.color),
|
||||
close: "\x1B[39m",
|
||||
ansi: (code) => `\u001B[${code}m`,
|
||||
ansi256: (code) => `\u001B[${38};5;${code}m`,
|
||||
ansi16m: (red, green, blue) => `\u001B[${38};2;${red};${green};${blue}m`,
|
||||
};
|
||||
bgColor = {
|
||||
...ingest(styles.bgColor),
|
||||
close: "\u001B[49m",
|
||||
ansi: (code) => `\u001B[${code + 10}m`,
|
||||
ansi256: (code) => `\u001B[${48};5;${code}m`,
|
||||
ansi16m: (red, green, blue) => `\u001B[${48};2;${red};${green};${blue}m`,
|
||||
};
|
||||
rgbToAnsi256(red, green, blue) {
|
||||
// We use the extended greyscale palette here, with the exception of
|
||||
// black and white. normal palette only has 4 greyscale shades.
|
||||
if (red === green && green === blue) {
|
||||
if (red < 8)
|
||||
return 16;
|
||||
if (red > 248)
|
||||
return 231;
|
||||
return Math.round(((red - 8) / 247) * 24) + 232;
|
||||
}
|
||||
return (16 +
|
||||
36 * Math.round((red / 255) * 5) +
|
||||
6 * Math.round((green / 255) * 5) +
|
||||
Math.round((blue / 255) * 5));
|
||||
}
|
||||
hexToRgb(hex) {
|
||||
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
||||
if (!matches) {
|
||||
return [0, 0, 0];
|
||||
}
|
||||
let [colorString] = matches;
|
||||
if (colorString.length === 3) {
|
||||
colorString = [...colorString]
|
||||
.map((character) => character + character)
|
||||
.join("");
|
||||
}
|
||||
const integer = Number.parseInt(colorString, 16);
|
||||
return [
|
||||
(integer >> 16) & 0xff,
|
||||
(integer >> 8) & 0xff,
|
||||
integer & 0xff,
|
||||
];
|
||||
}
|
||||
hexToAnsi256(hex) {
|
||||
return this.rgbToAnsi256(...this.hexToRgb(hex));
|
||||
}
|
||||
ansi256ToAnsi(code) {
|
||||
if (code < 8) {
|
||||
return 30 + code;
|
||||
}
|
||||
if (code < 16) {
|
||||
return 90 + (code - 8);
|
||||
}
|
||||
let red;
|
||||
let green;
|
||||
let blue;
|
||||
if (code >= 232) {
|
||||
red = ((code - 232) * 10 + 8) / 255;
|
||||
green = red;
|
||||
blue = red;
|
||||
}
|
||||
else {
|
||||
code -= 16;
|
||||
const remainder = code % 36;
|
||||
red = Math.floor(code / 36) / 5;
|
||||
green = Math.floor(remainder / 6) / 5;
|
||||
blue = (remainder % 6) / 5;
|
||||
}
|
||||
const value = Math.max(red, green, blue) * 2;
|
||||
if (value === 0) {
|
||||
return 30;
|
||||
}
|
||||
let result = 30 +
|
||||
((Math.round(blue) << 2) | (Math.round(green) << 1) | Math.round(red));
|
||||
if (value === 2) {
|
||||
result += 60;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
rgbToAnsi(red, green, blue) {
|
||||
return this.ansi256ToAnsi(this.rgbToAnsi256(red, green, blue));
|
||||
}
|
||||
hexToAnsi(hex) {
|
||||
return this.ansi256ToAnsi(this.hexToAnsi256(hex));
|
||||
}
|
||||
})();
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@isaacs/cliui/dist/commonjs/ansi-styles/index.js.map
generated
vendored
Normal file
1
node_modules/@isaacs/cliui/dist/commonjs/ansi-styles/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
6
node_modules/@isaacs/cliui/dist/commonjs/eastasianwidth/index.d.ts
generated
vendored
Normal file
6
node_modules/@isaacs/cliui/dist/commonjs/eastasianwidth/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export declare const eastAsianWidth: (character: string) => "F" | "H" | "W" | "Na" | "A" | "N";
|
||||
export declare const characterLength: (character: string) => 2 | 1;
|
||||
export declare const stringToArray: (str: string) => RegExpMatchArray | [];
|
||||
export declare const length: (str: string) => number;
|
||||
export declare const slice: (text: string, start: number, end: number) => string;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/@isaacs/cliui/dist/commonjs/eastasianwidth/index.d.ts.map
generated
vendored
Normal file
1
node_modules/@isaacs/cliui/dist/commonjs/eastasianwidth/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/eastasianwidth/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,GAAI,WAAW,MAAM,uCAqQ/C,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,WAAW,MAAM,UAOhD,CAAC;AAGF,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM,0BAExC,CAAC;AAEF,eAAO,MAAM,MAAM,GAAI,KAAK,MAAM,WAOjC,CAAC;AAEF,eAAO,MAAM,KAAK,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,EAAE,KAAK,MAAM,WAyB7D,CAAC"}
|
||||
307
node_modules/@isaacs/cliui/dist/commonjs/eastasianwidth/index.js
generated
vendored
Normal file
307
node_modules/@isaacs/cliui/dist/commonjs/eastasianwidth/index.js
generated
vendored
Normal file
@@ -0,0 +1,307 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.slice = exports.length = exports.stringToArray = exports.characterLength = exports.eastAsianWidth = void 0;
|
||||
const eastAsianWidth = (character) => {
|
||||
var x = character.charCodeAt(0);
|
||||
var y = character.length == 2 ? character.charCodeAt(1) : 0;
|
||||
var codePoint = x;
|
||||
if (0xd800 <= x && x <= 0xdbff && 0xdc00 <= y && y <= 0xdfff) {
|
||||
x &= 0x3ff;
|
||||
y &= 0x3ff;
|
||||
codePoint = (x << 10) | y;
|
||||
codePoint += 0x10000;
|
||||
}
|
||||
if (0x3000 == codePoint ||
|
||||
(0xff01 <= codePoint && codePoint <= 0xff60) ||
|
||||
(0xffe0 <= codePoint && codePoint <= 0xffe6)) {
|
||||
return "F";
|
||||
}
|
||||
if (0x20a9 == codePoint ||
|
||||
(0xff61 <= codePoint && codePoint <= 0xffbe) ||
|
||||
(0xffc2 <= codePoint && codePoint <= 0xffc7) ||
|
||||
(0xffca <= codePoint && codePoint <= 0xffcf) ||
|
||||
(0xffd2 <= codePoint && codePoint <= 0xffd7) ||
|
||||
(0xffda <= codePoint && codePoint <= 0xffdc) ||
|
||||
(0xffe8 <= codePoint && codePoint <= 0xffee)) {
|
||||
return "H";
|
||||
}
|
||||
if ((0x1100 <= codePoint && codePoint <= 0x115f) ||
|
||||
(0x11a3 <= codePoint && codePoint <= 0x11a7) ||
|
||||
(0x11fa <= codePoint && codePoint <= 0x11ff) ||
|
||||
(0x2329 <= codePoint && codePoint <= 0x232a) ||
|
||||
(0x2e80 <= codePoint && codePoint <= 0x2e99) ||
|
||||
(0x2e9b <= codePoint && codePoint <= 0x2ef3) ||
|
||||
(0x2f00 <= codePoint && codePoint <= 0x2fd5) ||
|
||||
(0x2ff0 <= codePoint && codePoint <= 0x2ffb) ||
|
||||
(0x3001 <= codePoint && codePoint <= 0x303e) ||
|
||||
(0x3041 <= codePoint && codePoint <= 0x3096) ||
|
||||
(0x3099 <= codePoint && codePoint <= 0x30ff) ||
|
||||
(0x3105 <= codePoint && codePoint <= 0x312d) ||
|
||||
(0x3131 <= codePoint && codePoint <= 0x318e) ||
|
||||
(0x3190 <= codePoint && codePoint <= 0x31ba) ||
|
||||
(0x31c0 <= codePoint && codePoint <= 0x31e3) ||
|
||||
(0x31f0 <= codePoint && codePoint <= 0x321e) ||
|
||||
(0x3220 <= codePoint && codePoint <= 0x3247) ||
|
||||
(0x3250 <= codePoint && codePoint <= 0x32fe) ||
|
||||
(0x3300 <= codePoint && codePoint <= 0x4dbf) ||
|
||||
(0x4e00 <= codePoint && codePoint <= 0xa48c) ||
|
||||
(0xa490 <= codePoint && codePoint <= 0xa4c6) ||
|
||||
(0xa960 <= codePoint && codePoint <= 0xa97c) ||
|
||||
(0xac00 <= codePoint && codePoint <= 0xd7a3) ||
|
||||
(0xd7b0 <= codePoint && codePoint <= 0xd7c6) ||
|
||||
(0xd7cb <= codePoint && codePoint <= 0xd7fb) ||
|
||||
(0xf900 <= codePoint && codePoint <= 0xfaff) ||
|
||||
(0xfe10 <= codePoint && codePoint <= 0xfe19) ||
|
||||
(0xfe30 <= codePoint && codePoint <= 0xfe52) ||
|
||||
(0xfe54 <= codePoint && codePoint <= 0xfe66) ||
|
||||
(0xfe68 <= codePoint && codePoint <= 0xfe6b) ||
|
||||
(0x1b000 <= codePoint && codePoint <= 0x1b001) ||
|
||||
(0x1f200 <= codePoint && codePoint <= 0x1f202) ||
|
||||
(0x1f210 <= codePoint && codePoint <= 0x1f23a) ||
|
||||
(0x1f240 <= codePoint && codePoint <= 0x1f248) ||
|
||||
(0x1f250 <= codePoint && codePoint <= 0x1f251) ||
|
||||
(0x20000 <= codePoint && codePoint <= 0x2f73f) ||
|
||||
(0x2b740 <= codePoint && codePoint <= 0x2fffd) ||
|
||||
(0x30000 <= codePoint && codePoint <= 0x3fffd)) {
|
||||
return "W";
|
||||
}
|
||||
if ((0x0020 <= codePoint && codePoint <= 0x007e) ||
|
||||
(0x00a2 <= codePoint && codePoint <= 0x00a3) ||
|
||||
(0x00a5 <= codePoint && codePoint <= 0x00a6) ||
|
||||
0x00ac == codePoint ||
|
||||
0x00af == codePoint ||
|
||||
(0x27e6 <= codePoint && codePoint <= 0x27ed) ||
|
||||
(0x2985 <= codePoint && codePoint <= 0x2986)) {
|
||||
return "Na";
|
||||
}
|
||||
if (0x00a1 == codePoint ||
|
||||
0x00a4 == codePoint ||
|
||||
(0x00a7 <= codePoint && codePoint <= 0x00a8) ||
|
||||
0x00aa == codePoint ||
|
||||
(0x00ad <= codePoint && codePoint <= 0x00ae) ||
|
||||
(0x00b0 <= codePoint && codePoint <= 0x00b4) ||
|
||||
(0x00b6 <= codePoint && codePoint <= 0x00ba) ||
|
||||
(0x00bc <= codePoint && codePoint <= 0x00bf) ||
|
||||
0x00c6 == codePoint ||
|
||||
0x00d0 == codePoint ||
|
||||
(0x00d7 <= codePoint && codePoint <= 0x00d8) ||
|
||||
(0x00de <= codePoint && codePoint <= 0x00e1) ||
|
||||
0x00e6 == codePoint ||
|
||||
(0x00e8 <= codePoint && codePoint <= 0x00ea) ||
|
||||
(0x00ec <= codePoint && codePoint <= 0x00ed) ||
|
||||
0x00f0 == codePoint ||
|
||||
(0x00f2 <= codePoint && codePoint <= 0x00f3) ||
|
||||
(0x00f7 <= codePoint && codePoint <= 0x00fa) ||
|
||||
0x00fc == codePoint ||
|
||||
0x00fe == codePoint ||
|
||||
0x0101 == codePoint ||
|
||||
0x0111 == codePoint ||
|
||||
0x0113 == codePoint ||
|
||||
0x011b == codePoint ||
|
||||
(0x0126 <= codePoint && codePoint <= 0x0127) ||
|
||||
0x012b == codePoint ||
|
||||
(0x0131 <= codePoint && codePoint <= 0x0133) ||
|
||||
0x0138 == codePoint ||
|
||||
(0x013f <= codePoint && codePoint <= 0x0142) ||
|
||||
0x0144 == codePoint ||
|
||||
(0x0148 <= codePoint && codePoint <= 0x014b) ||
|
||||
0x014d == codePoint ||
|
||||
(0x0152 <= codePoint && codePoint <= 0x0153) ||
|
||||
(0x0166 <= codePoint && codePoint <= 0x0167) ||
|
||||
0x016b == codePoint ||
|
||||
0x01ce == codePoint ||
|
||||
0x01d0 == codePoint ||
|
||||
0x01d2 == codePoint ||
|
||||
0x01d4 == codePoint ||
|
||||
0x01d6 == codePoint ||
|
||||
0x01d8 == codePoint ||
|
||||
0x01da == codePoint ||
|
||||
0x01dc == codePoint ||
|
||||
0x0251 == codePoint ||
|
||||
0x0261 == codePoint ||
|
||||
0x02c4 == codePoint ||
|
||||
0x02c7 == codePoint ||
|
||||
(0x02c9 <= codePoint && codePoint <= 0x02cb) ||
|
||||
0x02cd == codePoint ||
|
||||
0x02d0 == codePoint ||
|
||||
(0x02d8 <= codePoint && codePoint <= 0x02db) ||
|
||||
0x02dd == codePoint ||
|
||||
0x02df == codePoint ||
|
||||
(0x0300 <= codePoint && codePoint <= 0x036f) ||
|
||||
(0x0391 <= codePoint && codePoint <= 0x03a1) ||
|
||||
(0x03a3 <= codePoint && codePoint <= 0x03a9) ||
|
||||
(0x03b1 <= codePoint && codePoint <= 0x03c1) ||
|
||||
(0x03c3 <= codePoint && codePoint <= 0x03c9) ||
|
||||
0x0401 == codePoint ||
|
||||
(0x0410 <= codePoint && codePoint <= 0x044f) ||
|
||||
0x0451 == codePoint ||
|
||||
0x2010 == codePoint ||
|
||||
(0x2013 <= codePoint && codePoint <= 0x2016) ||
|
||||
(0x2018 <= codePoint && codePoint <= 0x2019) ||
|
||||
(0x201c <= codePoint && codePoint <= 0x201d) ||
|
||||
(0x2020 <= codePoint && codePoint <= 0x2022) ||
|
||||
(0x2024 <= codePoint && codePoint <= 0x2027) ||
|
||||
0x2030 == codePoint ||
|
||||
(0x2032 <= codePoint && codePoint <= 0x2033) ||
|
||||
0x2035 == codePoint ||
|
||||
0x203b == codePoint ||
|
||||
0x203e == codePoint ||
|
||||
0x2074 == codePoint ||
|
||||
0x207f == codePoint ||
|
||||
(0x2081 <= codePoint && codePoint <= 0x2084) ||
|
||||
0x20ac == codePoint ||
|
||||
0x2103 == codePoint ||
|
||||
0x2105 == codePoint ||
|
||||
0x2109 == codePoint ||
|
||||
0x2113 == codePoint ||
|
||||
0x2116 == codePoint ||
|
||||
(0x2121 <= codePoint && codePoint <= 0x2122) ||
|
||||
0x2126 == codePoint ||
|
||||
0x212b == codePoint ||
|
||||
(0x2153 <= codePoint && codePoint <= 0x2154) ||
|
||||
(0x215b <= codePoint && codePoint <= 0x215e) ||
|
||||
(0x2160 <= codePoint && codePoint <= 0x216b) ||
|
||||
(0x2170 <= codePoint && codePoint <= 0x2179) ||
|
||||
0x2189 == codePoint ||
|
||||
(0x2190 <= codePoint && codePoint <= 0x2199) ||
|
||||
(0x21b8 <= codePoint && codePoint <= 0x21b9) ||
|
||||
0x21d2 == codePoint ||
|
||||
0x21d4 == codePoint ||
|
||||
0x21e7 == codePoint ||
|
||||
0x2200 == codePoint ||
|
||||
(0x2202 <= codePoint && codePoint <= 0x2203) ||
|
||||
(0x2207 <= codePoint && codePoint <= 0x2208) ||
|
||||
0x220b == codePoint ||
|
||||
0x220f == codePoint ||
|
||||
0x2211 == codePoint ||
|
||||
0x2215 == codePoint ||
|
||||
0x221a == codePoint ||
|
||||
(0x221d <= codePoint && codePoint <= 0x2220) ||
|
||||
0x2223 == codePoint ||
|
||||
0x2225 == codePoint ||
|
||||
(0x2227 <= codePoint && codePoint <= 0x222c) ||
|
||||
0x222e == codePoint ||
|
||||
(0x2234 <= codePoint && codePoint <= 0x2237) ||
|
||||
(0x223c <= codePoint && codePoint <= 0x223d) ||
|
||||
0x2248 == codePoint ||
|
||||
0x224c == codePoint ||
|
||||
0x2252 == codePoint ||
|
||||
(0x2260 <= codePoint && codePoint <= 0x2261) ||
|
||||
(0x2264 <= codePoint && codePoint <= 0x2267) ||
|
||||
(0x226a <= codePoint && codePoint <= 0x226b) ||
|
||||
(0x226e <= codePoint && codePoint <= 0x226f) ||
|
||||
(0x2282 <= codePoint && codePoint <= 0x2283) ||
|
||||
(0x2286 <= codePoint && codePoint <= 0x2287) ||
|
||||
0x2295 == codePoint ||
|
||||
0x2299 == codePoint ||
|
||||
0x22a5 == codePoint ||
|
||||
0x22bf == codePoint ||
|
||||
0x2312 == codePoint ||
|
||||
(0x2460 <= codePoint && codePoint <= 0x24e9) ||
|
||||
(0x24eb <= codePoint && codePoint <= 0x254b) ||
|
||||
(0x2550 <= codePoint && codePoint <= 0x2573) ||
|
||||
(0x2580 <= codePoint && codePoint <= 0x258f) ||
|
||||
(0x2592 <= codePoint && codePoint <= 0x2595) ||
|
||||
(0x25a0 <= codePoint && codePoint <= 0x25a1) ||
|
||||
(0x25a3 <= codePoint && codePoint <= 0x25a9) ||
|
||||
(0x25b2 <= codePoint && codePoint <= 0x25b3) ||
|
||||
(0x25b6 <= codePoint && codePoint <= 0x25b7) ||
|
||||
(0x25bc <= codePoint && codePoint <= 0x25bd) ||
|
||||
(0x25c0 <= codePoint && codePoint <= 0x25c1) ||
|
||||
(0x25c6 <= codePoint && codePoint <= 0x25c8) ||
|
||||
0x25cb == codePoint ||
|
||||
(0x25ce <= codePoint && codePoint <= 0x25d1) ||
|
||||
(0x25e2 <= codePoint && codePoint <= 0x25e5) ||
|
||||
0x25ef == codePoint ||
|
||||
(0x2605 <= codePoint && codePoint <= 0x2606) ||
|
||||
0x2609 == codePoint ||
|
||||
(0x260e <= codePoint && codePoint <= 0x260f) ||
|
||||
(0x2614 <= codePoint && codePoint <= 0x2615) ||
|
||||
0x261c == codePoint ||
|
||||
0x261e == codePoint ||
|
||||
0x2640 == codePoint ||
|
||||
0x2642 == codePoint ||
|
||||
(0x2660 <= codePoint && codePoint <= 0x2661) ||
|
||||
(0x2663 <= codePoint && codePoint <= 0x2665) ||
|
||||
(0x2667 <= codePoint && codePoint <= 0x266a) ||
|
||||
(0x266c <= codePoint && codePoint <= 0x266d) ||
|
||||
0x266f == codePoint ||
|
||||
(0x269e <= codePoint && codePoint <= 0x269f) ||
|
||||
(0x26be <= codePoint && codePoint <= 0x26bf) ||
|
||||
(0x26c4 <= codePoint && codePoint <= 0x26cd) ||
|
||||
(0x26cf <= codePoint && codePoint <= 0x26e1) ||
|
||||
0x26e3 == codePoint ||
|
||||
(0x26e8 <= codePoint && codePoint <= 0x26ff) ||
|
||||
0x273d == codePoint ||
|
||||
0x2757 == codePoint ||
|
||||
(0x2776 <= codePoint && codePoint <= 0x277f) ||
|
||||
(0x2b55 <= codePoint && codePoint <= 0x2b59) ||
|
||||
(0x3248 <= codePoint && codePoint <= 0x324f) ||
|
||||
(0xe000 <= codePoint && codePoint <= 0xf8ff) ||
|
||||
(0xfe00 <= codePoint && codePoint <= 0xfe0f) ||
|
||||
0xfffd == codePoint ||
|
||||
(0x1f100 <= codePoint && codePoint <= 0x1f10a) ||
|
||||
(0x1f110 <= codePoint && codePoint <= 0x1f12d) ||
|
||||
(0x1f130 <= codePoint && codePoint <= 0x1f169) ||
|
||||
(0x1f170 <= codePoint && codePoint <= 0x1f19a) ||
|
||||
(0xe0100 <= codePoint && codePoint <= 0xe01ef) ||
|
||||
(0xf0000 <= codePoint && codePoint <= 0xffffd) ||
|
||||
(0x100000 <= codePoint && codePoint <= 0x10fffd)) {
|
||||
return "A";
|
||||
}
|
||||
return "N";
|
||||
};
|
||||
exports.eastAsianWidth = eastAsianWidth;
|
||||
const characterLength = (character) => {
|
||||
var code = (0, exports.eastAsianWidth)(character);
|
||||
if (code == "F" || code == "W" || code == "A") {
|
||||
return 2;
|
||||
}
|
||||
else {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
exports.characterLength = characterLength;
|
||||
// Split a string considering surrogate-pairs.
|
||||
const stringToArray = (str) => {
|
||||
return str.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
|
||||
};
|
||||
exports.stringToArray = stringToArray;
|
||||
const length = (str) => {
|
||||
var characters = (0, exports.stringToArray)(str);
|
||||
var len = 0;
|
||||
for (const char of characters) {
|
||||
len = len + (0, exports.characterLength)(char);
|
||||
}
|
||||
return len;
|
||||
};
|
||||
exports.length = length;
|
||||
const slice = (text, start, end) => {
|
||||
const textLen = (0, exports.length)(text);
|
||||
start = start ? start : 0;
|
||||
end = end ? end : 1;
|
||||
if (start < 0) {
|
||||
start = textLen + start;
|
||||
}
|
||||
if (end < 0) {
|
||||
end = textLen + end;
|
||||
}
|
||||
var result = "";
|
||||
var eawLen = 0;
|
||||
var chars = (0, exports.stringToArray)(text);
|
||||
for (const char of chars) {
|
||||
var charLen = (0, exports.length)(char);
|
||||
if (eawLen >= start - (charLen == 2 ? 1 : 0)) {
|
||||
if (eawLen + charLen <= end) {
|
||||
result += char;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
eawLen += charLen;
|
||||
}
|
||||
return result;
|
||||
};
|
||||
exports.slice = slice;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@isaacs/cliui/dist/commonjs/eastasianwidth/index.js.map
generated
vendored
Normal file
1
node_modules/@isaacs/cliui/dist/commonjs/eastasianwidth/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
2
node_modules/@isaacs/cliui/dist/commonjs/emoji-regex/index.d.ts
generated
vendored
Normal file
2
node_modules/@isaacs/cliui/dist/commonjs/emoji-regex/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export declare const emojiRegex: () => RegExp;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/@isaacs/cliui/dist/commonjs/emoji-regex/index.d.ts.map
generated
vendored
Normal file
1
node_modules/@isaacs/cliui/dist/commonjs/emoji-regex/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/emoji-regex/index.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,UAAU,cAC2we,CAAC"}
|
||||
7
node_modules/@isaacs/cliui/dist/commonjs/emoji-regex/index.js
generated
vendored
Normal file
7
node_modules/@isaacs/cliui/dist/commonjs/emoji-regex/index.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/@isaacs/cliui/dist/commonjs/emoji-regex/index.js.map
generated
vendored
Normal file
1
node_modules/@isaacs/cliui/dist/commonjs/emoji-regex/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
41
node_modules/@isaacs/cliui/dist/commonjs/index.d.ts
generated
vendored
Normal file
41
node_modules/@isaacs/cliui/dist/commonjs/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
export type UIOptions = {
|
||||
width: number;
|
||||
wrap?: boolean;
|
||||
rows?: string[];
|
||||
};
|
||||
export type Column = {
|
||||
text: string;
|
||||
width?: number;
|
||||
align?: 'right' | 'left' | 'center';
|
||||
padding?: number[];
|
||||
border?: boolean;
|
||||
};
|
||||
export type ColumnArray = Column[] & {
|
||||
span?: boolean;
|
||||
};
|
||||
export type Line = {
|
||||
hidden?: boolean;
|
||||
text: string;
|
||||
span?: boolean;
|
||||
};
|
||||
export declare class UI {
|
||||
width: number;
|
||||
wrap: boolean;
|
||||
rows: ColumnArray[];
|
||||
constructor(opts: UIOptions);
|
||||
span(...args: ColumnArray): void;
|
||||
resetOutput(): void;
|
||||
div(...args: (Column | string)[]): ColumnArray;
|
||||
shouldApplyLayoutDSL(...args: (Column | string)[]): boolean;
|
||||
applyLayoutDSL(str: string): ColumnArray;
|
||||
colFromString(text: string): Column;
|
||||
measurePadding(str: string): number[];
|
||||
toString(): string;
|
||||
rowToString(row: ColumnArray, lines: Line[]): Line[];
|
||||
renderInline(source: string, previousLine: Line): string;
|
||||
rasterize(row: ColumnArray): string[][];
|
||||
negatePadding(col: Column): number;
|
||||
columnWidths(row: ColumnArray): number[];
|
||||
}
|
||||
export declare const cliui: (opts?: Partial<UIOptions>) => UI;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/@isaacs/cliui/dist/commonjs/index.d.ts.map
generated
vendored
Normal file
1
node_modules/@isaacs/cliui/dist/commonjs/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAgBA,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,MAAM,GAAG;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAA;IACnC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,WAAW,GAAG,MAAM,EAAE,GAAG;IACnC,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAED,MAAM,MAAM,IAAI,GAAG;IACjB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAED,qBAAa,EAAE;IACb,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,OAAO,CAAA;IACb,IAAI,EAAE,WAAW,EAAE,CAAA;gBAEP,IAAI,EAAE,SAAS;IAQ3B,IAAI,CAAC,GAAG,IAAI,EAAE,WAAW;IAKzB,WAAW;IAIX,GAAG,CAAC,GAAG,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,GAAG,WAAW;IA2B9C,oBAAoB,CAAC,GAAG,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,GAAG,OAAO;IAQ3D,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW;IA6CxC,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAOnC,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE;IAUrC,QAAQ,IAAI,MAAM;IAelB,WAAW,CAAC,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE;IAgE3C,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI;IAgC/C,SAAS,CAAC,GAAG,EAAE,WAAW;IAqD1B,aAAa,CAAC,GAAG,EAAE,MAAM;IAezB,YAAY,CAAC,GAAG,EAAE,WAAW;CAqC9B;AA2CD,eAAO,MAAM,KAAK,GAAI,OAAM,OAAO,CAAC,SAAS,CAAM,OAM/C,CAAA"}
|
||||
322
node_modules/@isaacs/cliui/dist/commonjs/index.js
generated
vendored
Normal file
322
node_modules/@isaacs/cliui/dist/commonjs/index.js
generated
vendored
Normal file
@@ -0,0 +1,322 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.cliui = exports.UI = void 0;
|
||||
const index_js_1 = require("./string-width/index.js");
|
||||
const index_js_2 = require("./strip-ansi/index.js");
|
||||
const index_js_3 = require("./wrap-ansi/index.js");
|
||||
const align = {
|
||||
right: (str, width) => `${' '.repeat(Math.max(0, width - (0, index_js_1.stringWidth)(str)))}${str}`,
|
||||
center: (str, width) => `${' '.repeat(Math.max(0, width - (0, index_js_1.stringWidth)(str)) >> 1)}${str}`,
|
||||
};
|
||||
const top = 0;
|
||||
const right = 1;
|
||||
const bottom = 2;
|
||||
const left = 3;
|
||||
class UI {
|
||||
width;
|
||||
wrap;
|
||||
rows;
|
||||
constructor(opts) {
|
||||
this.width = opts.width;
|
||||
/* c8 ignore start */
|
||||
this.wrap = opts.wrap ?? true;
|
||||
/* c8 ignore stop */
|
||||
this.rows = [];
|
||||
}
|
||||
span(...args) {
|
||||
const cols = this.div(...args);
|
||||
cols.span = true;
|
||||
}
|
||||
resetOutput() {
|
||||
this.rows = [];
|
||||
}
|
||||
div(...args) {
|
||||
if (args.length === 0) {
|
||||
this.div('');
|
||||
}
|
||||
if (this.wrap &&
|
||||
this.shouldApplyLayoutDSL(...args) &&
|
||||
typeof args[0] === 'string') {
|
||||
return this.applyLayoutDSL(args[0]);
|
||||
}
|
||||
const cols = Object.assign(args.map(arg => {
|
||||
if (typeof arg === 'string') {
|
||||
return this.colFromString(arg);
|
||||
}
|
||||
return arg;
|
||||
}), { span: false });
|
||||
this.rows.push(cols);
|
||||
return cols;
|
||||
}
|
||||
shouldApplyLayoutDSL(...args) {
|
||||
return (args.length === 1 &&
|
||||
typeof args[0] === 'string' &&
|
||||
/[\t\n]/.test(args[0]));
|
||||
}
|
||||
applyLayoutDSL(str) {
|
||||
const rows = str.split('\n').map(row => row.split('\t'));
|
||||
let leftColumnWidth = 0;
|
||||
// simple heuristic for layout, make sure the
|
||||
// second column lines up along the left-hand.
|
||||
// don't allow the first column to take up more
|
||||
// than 50% of the screen.
|
||||
rows.forEach(columns => {
|
||||
if (columns.length > 1 &&
|
||||
(0, index_js_1.stringWidth)(String(columns[0])) > leftColumnWidth) {
|
||||
leftColumnWidth = Math.min(Math.floor(this.width * 0.5), (0, index_js_1.stringWidth)(String(columns[0])));
|
||||
}
|
||||
});
|
||||
// generate a table:
|
||||
// replacing ' ' with padding calculations.
|
||||
// using the algorithmically generated width.
|
||||
rows.forEach(columns => {
|
||||
this.div(...columns.map((r, i) => {
|
||||
return {
|
||||
text: r.trim(),
|
||||
padding: this.measurePadding(r),
|
||||
width: i === 0 && columns.length > 1 ? leftColumnWidth : undefined,
|
||||
};
|
||||
}));
|
||||
});
|
||||
const row = this.rows[this.rows.length - 1];
|
||||
/* c8 ignore start */
|
||||
if (!row) {
|
||||
throw new Error('no rows found');
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
return row;
|
||||
}
|
||||
colFromString(text) {
|
||||
return {
|
||||
text,
|
||||
padding: this.measurePadding(text),
|
||||
};
|
||||
}
|
||||
measurePadding(str) {
|
||||
// measure padding without ansi escape codes
|
||||
const noAnsi = (0, index_js_2.stripAnsi)(str);
|
||||
const [right = '', left = ''] = [
|
||||
noAnsi.match(/\s*$/)?.[0],
|
||||
noAnsi.match(/^\s*/)?.[0],
|
||||
];
|
||||
return [0, right.length, 0, left.length];
|
||||
}
|
||||
toString() {
|
||||
const lines = [];
|
||||
this.rows.forEach(row => {
|
||||
this.rowToString(row, lines);
|
||||
});
|
||||
// don't display any lines with the
|
||||
// hidden flag set.
|
||||
return lines
|
||||
.filter(line => !line.hidden)
|
||||
.map(line => line.text)
|
||||
.join('\n');
|
||||
}
|
||||
rowToString(row, lines) {
|
||||
this.rasterize(row).forEach((rrow, r) => {
|
||||
let str = '';
|
||||
rrow.forEach((col, c) => {
|
||||
const column = row[c];
|
||||
const { width } = column; // the width with padding.
|
||||
const wrapWidth = this.negatePadding(column); // the width without padding.
|
||||
let ts = col; // temporary string used during alignment/padding.
|
||||
if (wrapWidth > (0, index_js_1.stringWidth)(col)) {
|
||||
ts += ' '.repeat(wrapWidth - (0, index_js_1.stringWidth)(col));
|
||||
}
|
||||
// align the string within its column.
|
||||
if (column.align && column.align !== 'left' && this.wrap) {
|
||||
const fn = align[column.align];
|
||||
ts = fn(ts.trim(), wrapWidth);
|
||||
if ((0, index_js_1.stringWidth)(ts) < wrapWidth) {
|
||||
/* c8 ignore start */
|
||||
const w = width || 0;
|
||||
/* c8 ignore stop */
|
||||
ts += ' '.repeat(w - (0, index_js_1.stringWidth)(ts) - 1);
|
||||
}
|
||||
}
|
||||
// apply border and padding to string.
|
||||
const padding = column.padding || [0, 0, 0, 0];
|
||||
if (padding[left]) {
|
||||
str += ' '.repeat(padding[left]);
|
||||
}
|
||||
str += addBorder(column, ts, '| ');
|
||||
str += ts;
|
||||
str += addBorder(column, ts, ' |');
|
||||
if (padding[right]) {
|
||||
str += ' '.repeat(padding[right]);
|
||||
}
|
||||
// if prior row is span, try to render the
|
||||
// current row on the prior line.
|
||||
if (r === 0 && lines.length > 0) {
|
||||
const lastLine = lines[lines.length - 1];
|
||||
/* c8 ignore start */
|
||||
if (!lastLine) {
|
||||
throw new Error('last line not found');
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
str = this.renderInline(str, lastLine);
|
||||
}
|
||||
});
|
||||
// remove trailing whitespace.
|
||||
lines.push({
|
||||
text: str.replace(/ +$/, ''),
|
||||
span: row.span,
|
||||
});
|
||||
});
|
||||
return lines;
|
||||
}
|
||||
// if the full 'source' can render in
|
||||
// the target line, do so.
|
||||
renderInline(source, previousLine) {
|
||||
const match = source.match(/^ */);
|
||||
/* c8 ignore start */
|
||||
const leadingWhitespace = match ? match[0].length : 0;
|
||||
/* c8 ignore stop */
|
||||
const target = previousLine.text;
|
||||
const targetTextWidth = (0, index_js_1.stringWidth)(target.trimEnd());
|
||||
if (!previousLine.span) {
|
||||
return source;
|
||||
}
|
||||
// if we're not applying wrapping logic,
|
||||
// just always append to the span.
|
||||
if (!this.wrap) {
|
||||
previousLine.hidden = true;
|
||||
return target + source;
|
||||
}
|
||||
if (leadingWhitespace < targetTextWidth) {
|
||||
return source;
|
||||
}
|
||||
previousLine.hidden = true;
|
||||
return (target.trimEnd() +
|
||||
' '.repeat(leadingWhitespace - targetTextWidth) +
|
||||
source.trimStart());
|
||||
}
|
||||
rasterize(row) {
|
||||
const rrows = [];
|
||||
const widths = this.columnWidths(row);
|
||||
let wrapped;
|
||||
// word wrap all columns, and create
|
||||
// a data-structure that is easy to rasterize.
|
||||
row.forEach((col, c) => {
|
||||
// leave room for left and right padding.
|
||||
col.width = widths[c];
|
||||
if (this.wrap) {
|
||||
wrapped = (0, index_js_3.wrap)(col.text, this.negatePadding(col), {
|
||||
hard: true,
|
||||
}).split('\n');
|
||||
}
|
||||
else {
|
||||
wrapped = col.text.split('\n');
|
||||
}
|
||||
if (col.border) {
|
||||
wrapped.unshift('.' + '-'.repeat(this.negatePadding(col) + 2) + '.');
|
||||
wrapped.push("'" + '-'.repeat(this.negatePadding(col) + 2) + "'");
|
||||
}
|
||||
// add top and bottom padding.
|
||||
if (col.padding) {
|
||||
wrapped.unshift(...new Array(col.padding[top] || 0).fill(''));
|
||||
wrapped.push(...new Array(col.padding[bottom] || 0).fill(''));
|
||||
}
|
||||
wrapped.forEach((str, r) => {
|
||||
if (!rrows[r]) {
|
||||
rrows.push([]);
|
||||
}
|
||||
/* c8 ignore start */
|
||||
const rrow = rrows[r] ?? [];
|
||||
/* c8 ignore stop */
|
||||
for (let i = 0; i < c; i++) {
|
||||
if (rrow[i] === undefined) {
|
||||
rrow.push('');
|
||||
}
|
||||
}
|
||||
rrow.push(str);
|
||||
});
|
||||
});
|
||||
return rrows;
|
||||
}
|
||||
negatePadding(col) {
|
||||
/* c8 ignore start */
|
||||
let wrapWidth = col.width || 0;
|
||||
/* c8 ignore stop */
|
||||
if (col.padding) {
|
||||
wrapWidth -= (col.padding[left] || 0) + (col.padding[right] || 0);
|
||||
}
|
||||
if (col.border) {
|
||||
wrapWidth -= 4;
|
||||
}
|
||||
return wrapWidth;
|
||||
}
|
||||
columnWidths(row) {
|
||||
if (!this.wrap) {
|
||||
return row.map(col => {
|
||||
return col.width || (0, index_js_1.stringWidth)(col.text);
|
||||
});
|
||||
}
|
||||
let unset = row.length;
|
||||
let remainingWidth = this.width;
|
||||
// column widths can be set in config.
|
||||
const widths = row.map(col => {
|
||||
if (col.width) {
|
||||
unset--;
|
||||
remainingWidth -= col.width;
|
||||
return col.width;
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
// any unset widths should be calculated.
|
||||
/* c8 ignore start */
|
||||
const unsetWidth = unset ? Math.floor(remainingWidth / unset) : 0;
|
||||
/* c8 ignore stop */
|
||||
return widths.map((w, i) => {
|
||||
if (w === undefined) {
|
||||
/* c8 ignore start */
|
||||
const col = row[i] ?? { text: '', padding: [] };
|
||||
/* c8 ignore stop */
|
||||
return Math.max(unsetWidth, _minWidth(col));
|
||||
}
|
||||
return w;
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.UI = UI;
|
||||
const addBorder = (col, ts, style) => {
|
||||
if (col.border) {
|
||||
if (/[.']-+[.']/.test(ts)) {
|
||||
return '';
|
||||
}
|
||||
if (ts.trim().length !== 0) {
|
||||
return style;
|
||||
}
|
||||
return ' ';
|
||||
}
|
||||
return '';
|
||||
};
|
||||
// calculates the minimum width of
|
||||
// a column, based on padding preferences.
|
||||
const _minWidth = (col) => {
|
||||
const padding = col.padding || [];
|
||||
const minWidth = 1 + (padding[left] || 0) + (padding[right] || 0);
|
||||
if (col.border) {
|
||||
return minWidth + 4;
|
||||
}
|
||||
return minWidth;
|
||||
};
|
||||
const getWindowWidth = () => {
|
||||
/* c8 ignore start */
|
||||
if (typeof process === 'object' &&
|
||||
process.stdout &&
|
||||
process.stdout.columns) {
|
||||
return process.stdout.columns;
|
||||
}
|
||||
return 80;
|
||||
};
|
||||
/* c8 ignore stop */
|
||||
const cliui = (opts = {}) => new UI({
|
||||
/* c8 ignore start */
|
||||
width: opts?.width || getWindowWidth(),
|
||||
wrap: opts?.wrap,
|
||||
/* c8 ignore stop */
|
||||
});
|
||||
exports.cliui = cliui;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@isaacs/cliui/dist/commonjs/index.js.map
generated
vendored
Normal file
1
node_modules/@isaacs/cliui/dist/commonjs/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
12
node_modules/@isaacs/cliui/dist/commonjs/index.min.js
generated
vendored
Normal file
12
node_modules/@isaacs/cliui/dist/commonjs/index.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
7
node_modules/@isaacs/cliui/dist/commonjs/index.min.js.map
generated
vendored
Normal file
7
node_modules/@isaacs/cliui/dist/commonjs/index.min.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
node_modules/@isaacs/cliui/dist/commonjs/package.json
generated
vendored
Normal file
3
node_modules/@isaacs/cliui/dist/commonjs/package.json
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"type": "commonjs"
|
||||
}
|
||||
5
node_modules/@isaacs/cliui/dist/commonjs/string-width/index.d.ts
generated
vendored
Normal file
5
node_modules/@isaacs/cliui/dist/commonjs/string-width/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export type Options = {
|
||||
ambiguousIsNarrow?: boolean;
|
||||
};
|
||||
export declare function stringWidth(str: string, options?: Options): number;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/@isaacs/cliui/dist/commonjs/string-width/index.d.ts.map
generated
vendored
Normal file
1
node_modules/@isaacs/cliui/dist/commonjs/string-width/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/string-width/index.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,OAAO,GAAG;IACpB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEF,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,OAAY,UAqD7D"}
|
||||
49
node_modules/@isaacs/cliui/dist/commonjs/string-width/index.js
generated
vendored
Normal file
49
node_modules/@isaacs/cliui/dist/commonjs/string-width/index.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.stringWidth = stringWidth;
|
||||
const index_js_1 = require("../strip-ansi/index.js");
|
||||
const index_js_2 = require("../eastasianwidth/index.js");
|
||||
const index_js_3 = require("../emoji-regex/index.js");
|
||||
function stringWidth(str, options = {}) {
|
||||
if (typeof str !== "string" || str.length === 0) {
|
||||
return 0;
|
||||
}
|
||||
options = {
|
||||
ambiguousIsNarrow: true,
|
||||
...options,
|
||||
};
|
||||
str = (0, index_js_1.stripAnsi)(str);
|
||||
if (str.length === 0) {
|
||||
return 0;
|
||||
}
|
||||
str = str.replace((0, index_js_3.emojiRegex)(), " ");
|
||||
const ambiguousCharacterWidth = options.ambiguousIsNarrow ? 1 : 2;
|
||||
let width = 0;
|
||||
for (const character of str) {
|
||||
const codePoint = character.codePointAt(0);
|
||||
// Ignore control characters
|
||||
if (!codePoint ||
|
||||
codePoint <= 0x1f ||
|
||||
(codePoint >= 0x7f && codePoint <= 0x9f)) {
|
||||
continue;
|
||||
}
|
||||
// Ignore combining characters
|
||||
if (codePoint >= 0x300 && codePoint <= 0x36f) {
|
||||
continue;
|
||||
}
|
||||
const code = (0, index_js_2.eastAsianWidth)(character);
|
||||
switch (code) {
|
||||
case "F":
|
||||
case "W":
|
||||
width += 2;
|
||||
break;
|
||||
case "A":
|
||||
width += ambiguousCharacterWidth;
|
||||
break;
|
||||
default:
|
||||
width += 1;
|
||||
}
|
||||
}
|
||||
return width;
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@isaacs/cliui/dist/commonjs/string-width/index.js.map
generated
vendored
Normal file
1
node_modules/@isaacs/cliui/dist/commonjs/string-width/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/string-width/index.ts"],"names":[],"mappings":";;AAQA,kCAqDC;AA7DD,qDAAmD;AACnD,yDAA4D;AAC5D,sDAAqD;AAMrD,SAAgB,WAAW,CAAC,GAAW,EAAE,UAAmB,EAAE;IAC5D,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAChD,OAAO,CAAC,CAAC;IACX,CAAC;IAED,OAAO,GAAG;QACR,iBAAiB,EAAE,IAAI;QACvB,GAAG,OAAO;KACX,CAAC;IAEF,GAAG,GAAG,IAAA,oBAAS,EAAC,GAAG,CAAC,CAAC;IAErB,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO,CAAC,CAAC;IACX,CAAC;IAED,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,IAAA,qBAAU,GAAE,EAAE,IAAI,CAAC,CAAC;IAEtC,MAAM,uBAAuB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAClE,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,KAAK,MAAM,SAAS,IAAI,GAAG,EAAE,CAAC;QAC5B,MAAM,SAAS,GAAG,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QAE3C,4BAA4B;QAC5B,IACE,CAAC,SAAS;YACV,SAAS,IAAI,IAAI;YACjB,CAAC,SAAS,IAAI,IAAI,IAAI,SAAS,IAAI,IAAI,CAAC,EACxC,CAAC;YACD,SAAS;QACX,CAAC;QAED,8BAA8B;QAC9B,IAAI,SAAS,IAAI,KAAK,IAAI,SAAS,IAAI,KAAK,EAAE,CAAC;YAC7C,SAAS;QACX,CAAC;QAED,MAAM,IAAI,GAAG,IAAA,yBAAc,EAAC,SAAS,CAAC,CAAC;QACvC,QAAQ,IAAI,EAAE,CAAC;YACb,KAAK,GAAG,CAAC;YACT,KAAK,GAAG;gBACN,KAAK,IAAI,CAAC,CAAC;gBACX,MAAM;YACR,KAAK,GAAG;gBACN,KAAK,IAAI,uBAAuB,CAAC;gBACjC,MAAM;YACR;gBACE,KAAK,IAAI,CAAC,CAAC;QACf,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { stripAnsi } from \"../strip-ansi/index.js\";\nimport { eastAsianWidth } from \"../eastasianwidth/index.js\";\nimport { emojiRegex } from \"../emoji-regex/index.js\";\n\nexport type Options = {\n ambiguousIsNarrow?: boolean;\n};\n\nexport function stringWidth(str: string, options: Options = {}) {\n if (typeof str !== \"string\" || str.length === 0) {\n return 0;\n }\n\n options = {\n ambiguousIsNarrow: true,\n ...options,\n };\n\n str = stripAnsi(str);\n\n if (str.length === 0) {\n return 0;\n }\n\n str = str.replace(emojiRegex(), \" \");\n\n const ambiguousCharacterWidth = options.ambiguousIsNarrow ? 1 : 2;\n let width = 0;\n\n for (const character of str) {\n const codePoint = character.codePointAt(0);\n\n // Ignore control characters\n if (\n !codePoint ||\n codePoint <= 0x1f ||\n (codePoint >= 0x7f && codePoint <= 0x9f)\n ) {\n continue;\n }\n\n // Ignore combining characters\n if (codePoint >= 0x300 && codePoint <= 0x36f) {\n continue;\n }\n\n const code = eastAsianWidth(character);\n switch (code) {\n case \"F\":\n case \"W\":\n width += 2;\n break;\n case \"A\":\n width += ambiguousCharacterWidth;\n break;\n default:\n width += 1;\n }\n }\n\n return width;\n}\n"]}
|
||||
2
node_modules/@isaacs/cliui/dist/commonjs/strip-ansi/index.d.ts
generated
vendored
Normal file
2
node_modules/@isaacs/cliui/dist/commonjs/strip-ansi/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export declare const stripAnsi: (str: string) => string;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/@isaacs/cliui/dist/commonjs/strip-ansi/index.d.ts.map
generated
vendored
Normal file
1
node_modules/@isaacs/cliui/dist/commonjs/strip-ansi/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/strip-ansi/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS,GAAI,KAAK,MAAM,WAA2B,CAAC"}
|
||||
8
node_modules/@isaacs/cliui/dist/commonjs/strip-ansi/index.js
generated
vendored
Normal file
8
node_modules/@isaacs/cliui/dist/commonjs/strip-ansi/index.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.stripAnsi = void 0;
|
||||
const index_js_1 = require("../ansi-regex/index.js");
|
||||
const regex = (0, index_js_1.ansiRegex)();
|
||||
const stripAnsi = (str) => str.replace(regex, "");
|
||||
exports.stripAnsi = stripAnsi;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@isaacs/cliui/dist/commonjs/strip-ansi/index.js.map
generated
vendored
Normal file
1
node_modules/@isaacs/cliui/dist/commonjs/strip-ansi/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/strip-ansi/index.ts"],"names":[],"mappings":";;;AAAA,qDAAmD;AACnD,MAAM,KAAK,GAAG,IAAA,oBAAS,GAAE,CAAC;AACnB,MAAM,SAAS,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AAApD,QAAA,SAAS,aAA2C","sourcesContent":["import { ansiRegex } from \"../ansi-regex/index.js\";\nconst regex = ansiRegex();\nexport const stripAnsi = (str: string) => str.replace(regex, \"\");\n"]}
|
||||
7
node_modules/@isaacs/cliui/dist/commonjs/wrap-ansi/index.d.ts
generated
vendored
Normal file
7
node_modules/@isaacs/cliui/dist/commonjs/wrap-ansi/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
export type Options = {
|
||||
trim?: boolean;
|
||||
wordWrap?: boolean;
|
||||
hard?: boolean;
|
||||
};
|
||||
export declare const wrap: (str: string, columns: number, options: Options) => string;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/@isaacs/cliui/dist/commonjs/wrap-ansi/index.d.ts.map
generated
vendored
Normal file
1
node_modules/@isaacs/cliui/dist/commonjs/wrap-ansi/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/wrap-ansi/index.ts"],"names":[],"mappings":"AAuGA,MAAM,MAAM,OAAO,GAAG;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAuH7E,eAAO,MAAM,IAAI,GAAI,KAAK,MAAM,EAAE,SAAS,MAAM,EAAE,SAAS,OAAO,WAMpD,CAAC"}
|
||||
176
node_modules/@isaacs/cliui/dist/commonjs/wrap-ansi/index.js
generated
vendored
Normal file
176
node_modules/@isaacs/cliui/dist/commonjs/wrap-ansi/index.js
generated
vendored
Normal file
@@ -0,0 +1,176 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.wrap = void 0;
|
||||
const index_js_1 = require("../string-width/index.js");
|
||||
const index_js_2 = require("../strip-ansi/index.js");
|
||||
const index_js_3 = require("../ansi-styles/index.js");
|
||||
const ESCAPES = new Set(["\u001B", "\u009B"]);
|
||||
const END_CODE = 39;
|
||||
const ANSI_ESCAPE_BELL = "\u0007";
|
||||
const ANSI_CSI = "[";
|
||||
const ANSI_OSC = "]";
|
||||
const ANSI_SGR_TERMINATOR = "m";
|
||||
const ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
||||
const wrapAnsiCode = (code) => `${ESCAPES.values().next().value}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
||||
const wrapAnsiHyperlink = (uri) => `${ESCAPES.values().next().value}${ANSI_ESCAPE_LINK}${uri}${ANSI_ESCAPE_BELL}`;
|
||||
// Calculate the length of words split on ' ', ignoring
|
||||
// the extra characters added by ansi escape codes
|
||||
const wordLengths = (str) => str.split(" ").map((character) => (0, index_js_1.stringWidth)(character));
|
||||
// Wrap a long word across multiple rows
|
||||
// Ansi escape codes do not count towards length
|
||||
const wrapWord = (rows, word, columns) => {
|
||||
const characters = [...word];
|
||||
let isInsideEscape = false;
|
||||
let isInsideLinkEscape = false;
|
||||
let visible = (0, index_js_1.stringWidth)((0, index_js_2.stripAnsi)(String(rows[rows.length - 1])));
|
||||
for (const [index, character] of characters.entries()) {
|
||||
const characterLength = (0, index_js_1.stringWidth)(character);
|
||||
if (visible + characterLength <= columns) {
|
||||
rows[rows.length - 1] += character;
|
||||
}
|
||||
else {
|
||||
rows.push(character);
|
||||
visible = 0;
|
||||
}
|
||||
if (ESCAPES.has(character)) {
|
||||
isInsideEscape = true;
|
||||
isInsideLinkEscape = characters
|
||||
.slice(index + 1)
|
||||
.join("")
|
||||
.startsWith(ANSI_ESCAPE_LINK);
|
||||
}
|
||||
if (isInsideEscape) {
|
||||
if (isInsideLinkEscape) {
|
||||
if (character === ANSI_ESCAPE_BELL) {
|
||||
isInsideEscape = false;
|
||||
isInsideLinkEscape = false;
|
||||
}
|
||||
}
|
||||
else if (character === ANSI_SGR_TERMINATOR) {
|
||||
isInsideEscape = false;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
visible += characterLength;
|
||||
if (visible === columns && index < characters.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 && String(rows[rows.length - 1]).length > 0 && rows.length > 1) {
|
||||
rows[rows.length - 2] = String(rows[rows.length - 1]) + 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 ((0, index_js_1.stringWidth)(String(words[last - 1])) > 0) {
|
||||
break;
|
||||
}
|
||||
last--;
|
||||
}
|
||||
if (last === words.length) {
|
||||
return str;
|
||||
}
|
||||
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
||||
};
|
||||
const exec = (str, columns, options = {}) => {
|
||||
if (options.trim !== false && str.trim() === "") {
|
||||
return "";
|
||||
}
|
||||
let returnValue = "";
|
||||
let escapeCode;
|
||||
let escapeUrl;
|
||||
const lengths = wordLengths(str);
|
||||
let rows = [""];
|
||||
for (const [index, word] of str.split(" ").entries()) {
|
||||
if (options.trim !== false) {
|
||||
rows[rows.length - 1] = String(rows[rows.length - 1]).trimStart();
|
||||
}
|
||||
let rowLength = (0, index_js_1.stringWidth)(String(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'
|
||||
const len = Number(lengths[index]);
|
||||
if (options.hard && len > columns) {
|
||||
const remainingColumns = columns - rowLength;
|
||||
const breaksStartingThisLine = 1 + Math.floor((len - remainingColumns - 1) / columns);
|
||||
const breaksStartingNextLine = Math.floor((len - 1) / columns);
|
||||
if (breaksStartingNextLine < breaksStartingThisLine) {
|
||||
rows.push("");
|
||||
}
|
||||
wrapWord(rows, word, columns);
|
||||
continue;
|
||||
}
|
||||
if (rowLength + len > columns && rowLength > 0 && len > 0) {
|
||||
if (options.wordWrap === false && rowLength < columns) {
|
||||
wrapWord(rows, word, columns);
|
||||
continue;
|
||||
}
|
||||
rows.push("");
|
||||
}
|
||||
if (rowLength + len > columns && options.wordWrap === false) {
|
||||
wrapWord(rows, word, columns);
|
||||
continue;
|
||||
}
|
||||
rows[rows.length - 1] += word;
|
||||
}
|
||||
if (options.trim !== false) {
|
||||
rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
|
||||
}
|
||||
const pre = [...rows.join("\n")];
|
||||
for (const [index, character] of pre.entries()) {
|
||||
returnValue += character;
|
||||
if (ESCAPES.has(character)) {
|
||||
const { groups } = (new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`).exec(pre.slice(index).join("")) || { groups: {} });
|
||||
if (groups.code !== undefined) {
|
||||
const code = Number.parseFloat(groups.code);
|
||||
escapeCode = code === END_CODE ? undefined : code;
|
||||
}
|
||||
else if (groups.uri !== undefined) {
|
||||
escapeUrl = groups.uri.length === 0 ? undefined : groups.uri;
|
||||
}
|
||||
}
|
||||
const code = index_js_3.ansiStyles.codes.get(Number(escapeCode));
|
||||
if (pre[index + 1] === "\n") {
|
||||
if (escapeUrl) {
|
||||
returnValue += wrapAnsiHyperlink("");
|
||||
}
|
||||
if (escapeCode && code) {
|
||||
returnValue += wrapAnsiCode(code);
|
||||
}
|
||||
}
|
||||
else if (character === "\n") {
|
||||
if (escapeCode && code) {
|
||||
returnValue += wrapAnsiCode(escapeCode);
|
||||
}
|
||||
if (escapeUrl) {
|
||||
returnValue += wrapAnsiHyperlink(escapeUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
return returnValue;
|
||||
};
|
||||
// For each newline, invoke the method separately
|
||||
const wrap = (str, columns, options) => String(str)
|
||||
.normalize()
|
||||
.replace(/\r\n/g, "\n")
|
||||
.split("\n")
|
||||
.map((line) => exec(line, columns, options))
|
||||
.join("\n");
|
||||
exports.wrap = wrap;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@isaacs/cliui/dist/commonjs/wrap-ansi/index.js.map
generated
vendored
Normal file
1
node_modules/@isaacs/cliui/dist/commonjs/wrap-ansi/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
4
node_modules/@isaacs/cliui/dist/esm/ansi-regex/index.d.ts
generated
vendored
Normal file
4
node_modules/@isaacs/cliui/dist/esm/ansi-regex/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export declare const ansiRegex: ({ onlyFirst }?: {
|
||||
onlyFirst?: boolean | undefined;
|
||||
}) => RegExp;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/@isaacs/cliui/dist/esm/ansi-regex/index.d.ts.map
generated
vendored
Normal file
1
node_modules/@isaacs/cliui/dist/esm/ansi-regex/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ansi-regex/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS,GAAI;;CAA0B,WAcnD,CAAC"}
|
||||
12
node_modules/@isaacs/cliui/dist/esm/ansi-regex/index.js
generated
vendored
Normal file
12
node_modules/@isaacs/cliui/dist/esm/ansi-regex/index.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
// TODO! cut this down? do we need the onlyFirst option?
|
||||
export const ansiRegex = ({ onlyFirst = false } = {}) => {
|
||||
// Valid string terminator sequences are BEL, ESC\, and 0x9c
|
||||
const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
|
||||
// OSC sequences only: ESC ] ... ST (non-greedy until the first ST)
|
||||
const osc = `(?:\\u001B\\][\\s\\S]*?${ST})`;
|
||||
// CSI and related: ESC/C1, optional intermediates, optional params (supports ; and :) then final byte
|
||||
const csi = "[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";
|
||||
const pattern = `${osc}|${csi}`;
|
||||
return new RegExp(pattern, onlyFirst ? undefined : "g");
|
||||
};
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@isaacs/cliui/dist/esm/ansi-regex/index.js.map
generated
vendored
Normal file
1
node_modules/@isaacs/cliui/dist/esm/ansi-regex/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ansi-regex/index.ts"],"names":[],"mappings":"AAAA,wDAAwD;AAExD,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EAAE,SAAS,GAAG,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE;IACtD,4DAA4D;IAC5D,MAAM,EAAE,GAAG,oCAAoC,CAAC;IAEhD,mEAAmE;IACnE,MAAM,GAAG,GAAG,0BAA0B,EAAE,GAAG,CAAC;IAE5C,sGAAsG;IACtG,MAAM,GAAG,GACP,oFAAoF,CAAC;IAEvF,MAAM,OAAO,GAAG,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC;IAEhC,OAAO,IAAI,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAC1D,CAAC,CAAC","sourcesContent":["// TODO! cut this down? do we need the onlyFirst option?\n\nexport const ansiRegex = ({ onlyFirst = false } = {}) => {\n // Valid string terminator sequences are BEL, ESC\\, and 0x9c\n const ST = \"(?:\\\\u0007|\\\\u001B\\\\u005C|\\\\u009C)\";\n\n // OSC sequences only: ESC ] ... ST (non-greedy until the first ST)\n const osc = `(?:\\\\u001B\\\\][\\\\s\\\\S]*?${ST})`;\n\n // CSI and related: ESC/C1, optional intermediates, optional params (supports ; and :) then final byte\n const csi =\n \"[\\\\u001B\\\\u009B][[\\\\]()#;?]*(?:\\\\d{1,4}(?:[;:]\\\\d{0,4})*)?[\\\\dA-PR-TZcf-nq-uy=><~]\";\n\n const pattern = `${osc}|${csi}`;\n\n return new RegExp(pattern, onlyFirst ? undefined : \"g\");\n};\n"]}
|
||||
34
node_modules/@isaacs/cliui/dist/esm/ansi-styles/index.d.ts
generated
vendored
Normal file
34
node_modules/@isaacs/cliui/dist/esm/ansi-styles/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
export declare const modifierNames: string[];
|
||||
export declare const foregroundColorNames: string[];
|
||||
export declare const backgroundColorNames: string[];
|
||||
export declare const colorNames: string[];
|
||||
export declare const codes: Map<number, number>;
|
||||
export declare const ansiStyles: {
|
||||
[x: string]: unknown;
|
||||
codes: Map<number, number>;
|
||||
modifier: {
|
||||
[k: string]: {
|
||||
open: string;
|
||||
close: string;
|
||||
};
|
||||
};
|
||||
color: {
|
||||
close: string;
|
||||
ansi: (code: number) => string;
|
||||
ansi256: (code: number) => string;
|
||||
ansi16m: (red: number, green: number, blue: number) => string;
|
||||
};
|
||||
bgColor: {
|
||||
close: string;
|
||||
ansi: (code: number) => string;
|
||||
ansi256: (code: number) => string;
|
||||
ansi16m: (red: number, green: number, blue: number) => string;
|
||||
};
|
||||
rgbToAnsi256(red: number, green: number, blue: number): number;
|
||||
hexToRgb(hex: number): [number, number, number];
|
||||
hexToAnsi256(hex: number): number;
|
||||
ansi256ToAnsi(code: number): number;
|
||||
rgbToAnsi(red: number, green: number, blue: number): number;
|
||||
hexToAnsi(hex: number): number;
|
||||
};
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/@isaacs/cliui/dist/esm/ansi-styles/index.d.ts.map
generated
vendored
Normal file
1
node_modules/@isaacs/cliui/dist/esm/ansi-styles/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ansi-styles/index.ts"],"names":[],"mappings":"AA2DA,eAAO,MAAM,aAAa,UAA+B,CAAC;AAC1D,eAAO,MAAM,oBAAoB,UAA4B,CAAC;AAC9D,eAAO,MAAM,oBAAoB,UAA8B,CAAC;AAChE,eAAO,MAAM,UAAU,UAAqD,CAAC;AAK7E,eAAO,MAAM,KAAK,qBAA4B,CAAC;AAe/C,eAAO,MAAM,UAAU;;;;;;;;;;;qBAQN,MAAM;wBACH,MAAM;uBACP,MAAM,SAAS,MAAM,QAAQ,MAAM;;;;qBAOrC,MAAM;wBACH,MAAM;uBACP,MAAM,SAAS,MAAM,QAAQ,MAAM;;sBAIlC,MAAM,SAAS,MAAM,QAAQ,MAAM;kBAiBvC,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;sBAuB7B,MAAM;wBAGJ,MAAM;mBA2CX,MAAM,SAAS,MAAM,QAAQ,MAAM;mBAGnC,MAAM;CAGnB,CAAC"}
|
||||
167
node_modules/@isaacs/cliui/dist/esm/ansi-styles/index.js
generated
vendored
Normal file
167
node_modules/@isaacs/cliui/dist/esm/ansi-styles/index.js
generated
vendored
Normal file
@@ -0,0 +1,167 @@
|
||||
const styles = {
|
||||
modifier: {
|
||||
reset: [0, 0],
|
||||
// 21 isn't widely supported and 22 does the same thing
|
||||
bold: [1, 22],
|
||||
dim: [2, 22],
|
||||
italic: [3, 23],
|
||||
underline: [4, 24],
|
||||
overline: [53, 55],
|
||||
inverse: [7, 27],
|
||||
hidden: [8, 28],
|
||||
strikethrough: [9, 29],
|
||||
},
|
||||
color: {
|
||||
black: [30, 39],
|
||||
red: [31, 39],
|
||||
green: [32, 39],
|
||||
yellow: [33, 39],
|
||||
blue: [34, 39],
|
||||
magenta: [35, 39],
|
||||
cyan: [36, 39],
|
||||
white: [37, 39],
|
||||
// Bright color
|
||||
blackBright: [90, 39],
|
||||
gray: [90, 39], // Alias of `blackBright`
|
||||
grey: [90, 39], // Alias of `blackBright`
|
||||
redBright: [91, 39],
|
||||
greenBright: [92, 39],
|
||||
yellowBright: [93, 39],
|
||||
blueBright: [94, 39],
|
||||
magentaBright: [95, 39],
|
||||
cyanBright: [96, 39],
|
||||
whiteBright: [97, 39],
|
||||
},
|
||||
bgColor: {
|
||||
bgBlack: [40, 49],
|
||||
bgRed: [41, 49],
|
||||
bgGreen: [42, 49],
|
||||
bgYellow: [43, 49],
|
||||
bgBlue: [44, 49],
|
||||
bgMagenta: [45, 49],
|
||||
bgCyan: [46, 49],
|
||||
bgWhite: [47, 49],
|
||||
// Bright color
|
||||
bgBlackBright: [100, 49],
|
||||
bgGray: [100, 49], // Alias of `bgBlackBright`
|
||||
bgGrey: [100, 49], // Alias of `bgBlackBright`
|
||||
bgRedBright: [101, 49],
|
||||
bgGreenBright: [102, 49],
|
||||
bgYellowBright: [103, 49],
|
||||
bgBlueBright: [104, 49],
|
||||
bgMagentaBright: [105, 49],
|
||||
bgCyanBright: [106, 49],
|
||||
bgWhiteBright: [107, 49],
|
||||
},
|
||||
};
|
||||
export const modifierNames = Object.keys(styles.modifier);
|
||||
export const foregroundColorNames = Object.keys(styles.color);
|
||||
export const backgroundColorNames = Object.keys(styles.bgColor);
|
||||
export const colorNames = [...foregroundColorNames, ...backgroundColorNames];
|
||||
class AnsiStyles {
|
||||
}
|
||||
export const codes = new Map();
|
||||
const ingest = (set) => Object.fromEntries(Object.entries(set).map(([key, [open, close]]) => {
|
||||
codes.set(open, close);
|
||||
return [
|
||||
key,
|
||||
(AnsiStyles.prototype[key] = {
|
||||
open: `\u001B[${open}m`,
|
||||
close: `\u001B[${close}m`,
|
||||
}),
|
||||
];
|
||||
}));
|
||||
export const ansiStyles = new (class extends AnsiStyles {
|
||||
codes = codes;
|
||||
modifier = ingest(styles.modifier);
|
||||
color = {
|
||||
...ingest(styles.color),
|
||||
close: "\x1B[39m",
|
||||
ansi: (code) => `\u001B[${code}m`,
|
||||
ansi256: (code) => `\u001B[${38};5;${code}m`,
|
||||
ansi16m: (red, green, blue) => `\u001B[${38};2;${red};${green};${blue}m`,
|
||||
};
|
||||
bgColor = {
|
||||
...ingest(styles.bgColor),
|
||||
close: "\u001B[49m",
|
||||
ansi: (code) => `\u001B[${code + 10}m`,
|
||||
ansi256: (code) => `\u001B[${48};5;${code}m`,
|
||||
ansi16m: (red, green, blue) => `\u001B[${48};2;${red};${green};${blue}m`,
|
||||
};
|
||||
rgbToAnsi256(red, green, blue) {
|
||||
// We use the extended greyscale palette here, with the exception of
|
||||
// black and white. normal palette only has 4 greyscale shades.
|
||||
if (red === green && green === blue) {
|
||||
if (red < 8)
|
||||
return 16;
|
||||
if (red > 248)
|
||||
return 231;
|
||||
return Math.round(((red - 8) / 247) * 24) + 232;
|
||||
}
|
||||
return (16 +
|
||||
36 * Math.round((red / 255) * 5) +
|
||||
6 * Math.round((green / 255) * 5) +
|
||||
Math.round((blue / 255) * 5));
|
||||
}
|
||||
hexToRgb(hex) {
|
||||
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
||||
if (!matches) {
|
||||
return [0, 0, 0];
|
||||
}
|
||||
let [colorString] = matches;
|
||||
if (colorString.length === 3) {
|
||||
colorString = [...colorString]
|
||||
.map((character) => character + character)
|
||||
.join("");
|
||||
}
|
||||
const integer = Number.parseInt(colorString, 16);
|
||||
return [
|
||||
(integer >> 16) & 0xff,
|
||||
(integer >> 8) & 0xff,
|
||||
integer & 0xff,
|
||||
];
|
||||
}
|
||||
hexToAnsi256(hex) {
|
||||
return this.rgbToAnsi256(...this.hexToRgb(hex));
|
||||
}
|
||||
ansi256ToAnsi(code) {
|
||||
if (code < 8) {
|
||||
return 30 + code;
|
||||
}
|
||||
if (code < 16) {
|
||||
return 90 + (code - 8);
|
||||
}
|
||||
let red;
|
||||
let green;
|
||||
let blue;
|
||||
if (code >= 232) {
|
||||
red = ((code - 232) * 10 + 8) / 255;
|
||||
green = red;
|
||||
blue = red;
|
||||
}
|
||||
else {
|
||||
code -= 16;
|
||||
const remainder = code % 36;
|
||||
red = Math.floor(code / 36) / 5;
|
||||
green = Math.floor(remainder / 6) / 5;
|
||||
blue = (remainder % 6) / 5;
|
||||
}
|
||||
const value = Math.max(red, green, blue) * 2;
|
||||
if (value === 0) {
|
||||
return 30;
|
||||
}
|
||||
let result = 30 +
|
||||
((Math.round(blue) << 2) | (Math.round(green) << 1) | Math.round(red));
|
||||
if (value === 2) {
|
||||
result += 60;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
rgbToAnsi(red, green, blue) {
|
||||
return this.ansi256ToAnsi(this.rgbToAnsi256(red, green, blue));
|
||||
}
|
||||
hexToAnsi(hex) {
|
||||
return this.ansi256ToAnsi(this.hexToAnsi256(hex));
|
||||
}
|
||||
})();
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@isaacs/cliui/dist/esm/ansi-styles/index.js.map
generated
vendored
Normal file
1
node_modules/@isaacs/cliui/dist/esm/ansi-styles/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
6
node_modules/@isaacs/cliui/dist/esm/eastasianwidth/index.d.ts
generated
vendored
Normal file
6
node_modules/@isaacs/cliui/dist/esm/eastasianwidth/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export declare const eastAsianWidth: (character: string) => "F" | "H" | "W" | "Na" | "A" | "N";
|
||||
export declare const characterLength: (character: string) => 2 | 1;
|
||||
export declare const stringToArray: (str: string) => RegExpMatchArray | [];
|
||||
export declare const length: (str: string) => number;
|
||||
export declare const slice: (text: string, start: number, end: number) => string;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/@isaacs/cliui/dist/esm/eastasianwidth/index.d.ts.map
generated
vendored
Normal file
1
node_modules/@isaacs/cliui/dist/esm/eastasianwidth/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/eastasianwidth/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,GAAI,WAAW,MAAM,uCAqQ/C,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,WAAW,MAAM,UAOhD,CAAC;AAGF,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM,0BAExC,CAAC;AAEF,eAAO,MAAM,MAAM,GAAI,KAAK,MAAM,WAOjC,CAAC;AAEF,eAAO,MAAM,KAAK,GAAI,MAAM,MAAM,EAAE,OAAO,MAAM,EAAE,KAAK,MAAM,WAyB7D,CAAC"}
|
||||
299
node_modules/@isaacs/cliui/dist/esm/eastasianwidth/index.js
generated
vendored
Normal file
299
node_modules/@isaacs/cliui/dist/esm/eastasianwidth/index.js
generated
vendored
Normal file
@@ -0,0 +1,299 @@
|
||||
export const eastAsianWidth = (character) => {
|
||||
var x = character.charCodeAt(0);
|
||||
var y = character.length == 2 ? character.charCodeAt(1) : 0;
|
||||
var codePoint = x;
|
||||
if (0xd800 <= x && x <= 0xdbff && 0xdc00 <= y && y <= 0xdfff) {
|
||||
x &= 0x3ff;
|
||||
y &= 0x3ff;
|
||||
codePoint = (x << 10) | y;
|
||||
codePoint += 0x10000;
|
||||
}
|
||||
if (0x3000 == codePoint ||
|
||||
(0xff01 <= codePoint && codePoint <= 0xff60) ||
|
||||
(0xffe0 <= codePoint && codePoint <= 0xffe6)) {
|
||||
return "F";
|
||||
}
|
||||
if (0x20a9 == codePoint ||
|
||||
(0xff61 <= codePoint && codePoint <= 0xffbe) ||
|
||||
(0xffc2 <= codePoint && codePoint <= 0xffc7) ||
|
||||
(0xffca <= codePoint && codePoint <= 0xffcf) ||
|
||||
(0xffd2 <= codePoint && codePoint <= 0xffd7) ||
|
||||
(0xffda <= codePoint && codePoint <= 0xffdc) ||
|
||||
(0xffe8 <= codePoint && codePoint <= 0xffee)) {
|
||||
return "H";
|
||||
}
|
||||
if ((0x1100 <= codePoint && codePoint <= 0x115f) ||
|
||||
(0x11a3 <= codePoint && codePoint <= 0x11a7) ||
|
||||
(0x11fa <= codePoint && codePoint <= 0x11ff) ||
|
||||
(0x2329 <= codePoint && codePoint <= 0x232a) ||
|
||||
(0x2e80 <= codePoint && codePoint <= 0x2e99) ||
|
||||
(0x2e9b <= codePoint && codePoint <= 0x2ef3) ||
|
||||
(0x2f00 <= codePoint && codePoint <= 0x2fd5) ||
|
||||
(0x2ff0 <= codePoint && codePoint <= 0x2ffb) ||
|
||||
(0x3001 <= codePoint && codePoint <= 0x303e) ||
|
||||
(0x3041 <= codePoint && codePoint <= 0x3096) ||
|
||||
(0x3099 <= codePoint && codePoint <= 0x30ff) ||
|
||||
(0x3105 <= codePoint && codePoint <= 0x312d) ||
|
||||
(0x3131 <= codePoint && codePoint <= 0x318e) ||
|
||||
(0x3190 <= codePoint && codePoint <= 0x31ba) ||
|
||||
(0x31c0 <= codePoint && codePoint <= 0x31e3) ||
|
||||
(0x31f0 <= codePoint && codePoint <= 0x321e) ||
|
||||
(0x3220 <= codePoint && codePoint <= 0x3247) ||
|
||||
(0x3250 <= codePoint && codePoint <= 0x32fe) ||
|
||||
(0x3300 <= codePoint && codePoint <= 0x4dbf) ||
|
||||
(0x4e00 <= codePoint && codePoint <= 0xa48c) ||
|
||||
(0xa490 <= codePoint && codePoint <= 0xa4c6) ||
|
||||
(0xa960 <= codePoint && codePoint <= 0xa97c) ||
|
||||
(0xac00 <= codePoint && codePoint <= 0xd7a3) ||
|
||||
(0xd7b0 <= codePoint && codePoint <= 0xd7c6) ||
|
||||
(0xd7cb <= codePoint && codePoint <= 0xd7fb) ||
|
||||
(0xf900 <= codePoint && codePoint <= 0xfaff) ||
|
||||
(0xfe10 <= codePoint && codePoint <= 0xfe19) ||
|
||||
(0xfe30 <= codePoint && codePoint <= 0xfe52) ||
|
||||
(0xfe54 <= codePoint && codePoint <= 0xfe66) ||
|
||||
(0xfe68 <= codePoint && codePoint <= 0xfe6b) ||
|
||||
(0x1b000 <= codePoint && codePoint <= 0x1b001) ||
|
||||
(0x1f200 <= codePoint && codePoint <= 0x1f202) ||
|
||||
(0x1f210 <= codePoint && codePoint <= 0x1f23a) ||
|
||||
(0x1f240 <= codePoint && codePoint <= 0x1f248) ||
|
||||
(0x1f250 <= codePoint && codePoint <= 0x1f251) ||
|
||||
(0x20000 <= codePoint && codePoint <= 0x2f73f) ||
|
||||
(0x2b740 <= codePoint && codePoint <= 0x2fffd) ||
|
||||
(0x30000 <= codePoint && codePoint <= 0x3fffd)) {
|
||||
return "W";
|
||||
}
|
||||
if ((0x0020 <= codePoint && codePoint <= 0x007e) ||
|
||||
(0x00a2 <= codePoint && codePoint <= 0x00a3) ||
|
||||
(0x00a5 <= codePoint && codePoint <= 0x00a6) ||
|
||||
0x00ac == codePoint ||
|
||||
0x00af == codePoint ||
|
||||
(0x27e6 <= codePoint && codePoint <= 0x27ed) ||
|
||||
(0x2985 <= codePoint && codePoint <= 0x2986)) {
|
||||
return "Na";
|
||||
}
|
||||
if (0x00a1 == codePoint ||
|
||||
0x00a4 == codePoint ||
|
||||
(0x00a7 <= codePoint && codePoint <= 0x00a8) ||
|
||||
0x00aa == codePoint ||
|
||||
(0x00ad <= codePoint && codePoint <= 0x00ae) ||
|
||||
(0x00b0 <= codePoint && codePoint <= 0x00b4) ||
|
||||
(0x00b6 <= codePoint && codePoint <= 0x00ba) ||
|
||||
(0x00bc <= codePoint && codePoint <= 0x00bf) ||
|
||||
0x00c6 == codePoint ||
|
||||
0x00d0 == codePoint ||
|
||||
(0x00d7 <= codePoint && codePoint <= 0x00d8) ||
|
||||
(0x00de <= codePoint && codePoint <= 0x00e1) ||
|
||||
0x00e6 == codePoint ||
|
||||
(0x00e8 <= codePoint && codePoint <= 0x00ea) ||
|
||||
(0x00ec <= codePoint && codePoint <= 0x00ed) ||
|
||||
0x00f0 == codePoint ||
|
||||
(0x00f2 <= codePoint && codePoint <= 0x00f3) ||
|
||||
(0x00f7 <= codePoint && codePoint <= 0x00fa) ||
|
||||
0x00fc == codePoint ||
|
||||
0x00fe == codePoint ||
|
||||
0x0101 == codePoint ||
|
||||
0x0111 == codePoint ||
|
||||
0x0113 == codePoint ||
|
||||
0x011b == codePoint ||
|
||||
(0x0126 <= codePoint && codePoint <= 0x0127) ||
|
||||
0x012b == codePoint ||
|
||||
(0x0131 <= codePoint && codePoint <= 0x0133) ||
|
||||
0x0138 == codePoint ||
|
||||
(0x013f <= codePoint && codePoint <= 0x0142) ||
|
||||
0x0144 == codePoint ||
|
||||
(0x0148 <= codePoint && codePoint <= 0x014b) ||
|
||||
0x014d == codePoint ||
|
||||
(0x0152 <= codePoint && codePoint <= 0x0153) ||
|
||||
(0x0166 <= codePoint && codePoint <= 0x0167) ||
|
||||
0x016b == codePoint ||
|
||||
0x01ce == codePoint ||
|
||||
0x01d0 == codePoint ||
|
||||
0x01d2 == codePoint ||
|
||||
0x01d4 == codePoint ||
|
||||
0x01d6 == codePoint ||
|
||||
0x01d8 == codePoint ||
|
||||
0x01da == codePoint ||
|
||||
0x01dc == codePoint ||
|
||||
0x0251 == codePoint ||
|
||||
0x0261 == codePoint ||
|
||||
0x02c4 == codePoint ||
|
||||
0x02c7 == codePoint ||
|
||||
(0x02c9 <= codePoint && codePoint <= 0x02cb) ||
|
||||
0x02cd == codePoint ||
|
||||
0x02d0 == codePoint ||
|
||||
(0x02d8 <= codePoint && codePoint <= 0x02db) ||
|
||||
0x02dd == codePoint ||
|
||||
0x02df == codePoint ||
|
||||
(0x0300 <= codePoint && codePoint <= 0x036f) ||
|
||||
(0x0391 <= codePoint && codePoint <= 0x03a1) ||
|
||||
(0x03a3 <= codePoint && codePoint <= 0x03a9) ||
|
||||
(0x03b1 <= codePoint && codePoint <= 0x03c1) ||
|
||||
(0x03c3 <= codePoint && codePoint <= 0x03c9) ||
|
||||
0x0401 == codePoint ||
|
||||
(0x0410 <= codePoint && codePoint <= 0x044f) ||
|
||||
0x0451 == codePoint ||
|
||||
0x2010 == codePoint ||
|
||||
(0x2013 <= codePoint && codePoint <= 0x2016) ||
|
||||
(0x2018 <= codePoint && codePoint <= 0x2019) ||
|
||||
(0x201c <= codePoint && codePoint <= 0x201d) ||
|
||||
(0x2020 <= codePoint && codePoint <= 0x2022) ||
|
||||
(0x2024 <= codePoint && codePoint <= 0x2027) ||
|
||||
0x2030 == codePoint ||
|
||||
(0x2032 <= codePoint && codePoint <= 0x2033) ||
|
||||
0x2035 == codePoint ||
|
||||
0x203b == codePoint ||
|
||||
0x203e == codePoint ||
|
||||
0x2074 == codePoint ||
|
||||
0x207f == codePoint ||
|
||||
(0x2081 <= codePoint && codePoint <= 0x2084) ||
|
||||
0x20ac == codePoint ||
|
||||
0x2103 == codePoint ||
|
||||
0x2105 == codePoint ||
|
||||
0x2109 == codePoint ||
|
||||
0x2113 == codePoint ||
|
||||
0x2116 == codePoint ||
|
||||
(0x2121 <= codePoint && codePoint <= 0x2122) ||
|
||||
0x2126 == codePoint ||
|
||||
0x212b == codePoint ||
|
||||
(0x2153 <= codePoint && codePoint <= 0x2154) ||
|
||||
(0x215b <= codePoint && codePoint <= 0x215e) ||
|
||||
(0x2160 <= codePoint && codePoint <= 0x216b) ||
|
||||
(0x2170 <= codePoint && codePoint <= 0x2179) ||
|
||||
0x2189 == codePoint ||
|
||||
(0x2190 <= codePoint && codePoint <= 0x2199) ||
|
||||
(0x21b8 <= codePoint && codePoint <= 0x21b9) ||
|
||||
0x21d2 == codePoint ||
|
||||
0x21d4 == codePoint ||
|
||||
0x21e7 == codePoint ||
|
||||
0x2200 == codePoint ||
|
||||
(0x2202 <= codePoint && codePoint <= 0x2203) ||
|
||||
(0x2207 <= codePoint && codePoint <= 0x2208) ||
|
||||
0x220b == codePoint ||
|
||||
0x220f == codePoint ||
|
||||
0x2211 == codePoint ||
|
||||
0x2215 == codePoint ||
|
||||
0x221a == codePoint ||
|
||||
(0x221d <= codePoint && codePoint <= 0x2220) ||
|
||||
0x2223 == codePoint ||
|
||||
0x2225 == codePoint ||
|
||||
(0x2227 <= codePoint && codePoint <= 0x222c) ||
|
||||
0x222e == codePoint ||
|
||||
(0x2234 <= codePoint && codePoint <= 0x2237) ||
|
||||
(0x223c <= codePoint && codePoint <= 0x223d) ||
|
||||
0x2248 == codePoint ||
|
||||
0x224c == codePoint ||
|
||||
0x2252 == codePoint ||
|
||||
(0x2260 <= codePoint && codePoint <= 0x2261) ||
|
||||
(0x2264 <= codePoint && codePoint <= 0x2267) ||
|
||||
(0x226a <= codePoint && codePoint <= 0x226b) ||
|
||||
(0x226e <= codePoint && codePoint <= 0x226f) ||
|
||||
(0x2282 <= codePoint && codePoint <= 0x2283) ||
|
||||
(0x2286 <= codePoint && codePoint <= 0x2287) ||
|
||||
0x2295 == codePoint ||
|
||||
0x2299 == codePoint ||
|
||||
0x22a5 == codePoint ||
|
||||
0x22bf == codePoint ||
|
||||
0x2312 == codePoint ||
|
||||
(0x2460 <= codePoint && codePoint <= 0x24e9) ||
|
||||
(0x24eb <= codePoint && codePoint <= 0x254b) ||
|
||||
(0x2550 <= codePoint && codePoint <= 0x2573) ||
|
||||
(0x2580 <= codePoint && codePoint <= 0x258f) ||
|
||||
(0x2592 <= codePoint && codePoint <= 0x2595) ||
|
||||
(0x25a0 <= codePoint && codePoint <= 0x25a1) ||
|
||||
(0x25a3 <= codePoint && codePoint <= 0x25a9) ||
|
||||
(0x25b2 <= codePoint && codePoint <= 0x25b3) ||
|
||||
(0x25b6 <= codePoint && codePoint <= 0x25b7) ||
|
||||
(0x25bc <= codePoint && codePoint <= 0x25bd) ||
|
||||
(0x25c0 <= codePoint && codePoint <= 0x25c1) ||
|
||||
(0x25c6 <= codePoint && codePoint <= 0x25c8) ||
|
||||
0x25cb == codePoint ||
|
||||
(0x25ce <= codePoint && codePoint <= 0x25d1) ||
|
||||
(0x25e2 <= codePoint && codePoint <= 0x25e5) ||
|
||||
0x25ef == codePoint ||
|
||||
(0x2605 <= codePoint && codePoint <= 0x2606) ||
|
||||
0x2609 == codePoint ||
|
||||
(0x260e <= codePoint && codePoint <= 0x260f) ||
|
||||
(0x2614 <= codePoint && codePoint <= 0x2615) ||
|
||||
0x261c == codePoint ||
|
||||
0x261e == codePoint ||
|
||||
0x2640 == codePoint ||
|
||||
0x2642 == codePoint ||
|
||||
(0x2660 <= codePoint && codePoint <= 0x2661) ||
|
||||
(0x2663 <= codePoint && codePoint <= 0x2665) ||
|
||||
(0x2667 <= codePoint && codePoint <= 0x266a) ||
|
||||
(0x266c <= codePoint && codePoint <= 0x266d) ||
|
||||
0x266f == codePoint ||
|
||||
(0x269e <= codePoint && codePoint <= 0x269f) ||
|
||||
(0x26be <= codePoint && codePoint <= 0x26bf) ||
|
||||
(0x26c4 <= codePoint && codePoint <= 0x26cd) ||
|
||||
(0x26cf <= codePoint && codePoint <= 0x26e1) ||
|
||||
0x26e3 == codePoint ||
|
||||
(0x26e8 <= codePoint && codePoint <= 0x26ff) ||
|
||||
0x273d == codePoint ||
|
||||
0x2757 == codePoint ||
|
||||
(0x2776 <= codePoint && codePoint <= 0x277f) ||
|
||||
(0x2b55 <= codePoint && codePoint <= 0x2b59) ||
|
||||
(0x3248 <= codePoint && codePoint <= 0x324f) ||
|
||||
(0xe000 <= codePoint && codePoint <= 0xf8ff) ||
|
||||
(0xfe00 <= codePoint && codePoint <= 0xfe0f) ||
|
||||
0xfffd == codePoint ||
|
||||
(0x1f100 <= codePoint && codePoint <= 0x1f10a) ||
|
||||
(0x1f110 <= codePoint && codePoint <= 0x1f12d) ||
|
||||
(0x1f130 <= codePoint && codePoint <= 0x1f169) ||
|
||||
(0x1f170 <= codePoint && codePoint <= 0x1f19a) ||
|
||||
(0xe0100 <= codePoint && codePoint <= 0xe01ef) ||
|
||||
(0xf0000 <= codePoint && codePoint <= 0xffffd) ||
|
||||
(0x100000 <= codePoint && codePoint <= 0x10fffd)) {
|
||||
return "A";
|
||||
}
|
||||
return "N";
|
||||
};
|
||||
export const characterLength = (character) => {
|
||||
var code = eastAsianWidth(character);
|
||||
if (code == "F" || code == "W" || code == "A") {
|
||||
return 2;
|
||||
}
|
||||
else {
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
// Split a string considering surrogate-pairs.
|
||||
export const stringToArray = (str) => {
|
||||
return str.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
|
||||
};
|
||||
export const length = (str) => {
|
||||
var characters = stringToArray(str);
|
||||
var len = 0;
|
||||
for (const char of characters) {
|
||||
len = len + characterLength(char);
|
||||
}
|
||||
return len;
|
||||
};
|
||||
export const slice = (text, start, end) => {
|
||||
const textLen = length(text);
|
||||
start = start ? start : 0;
|
||||
end = end ? end : 1;
|
||||
if (start < 0) {
|
||||
start = textLen + start;
|
||||
}
|
||||
if (end < 0) {
|
||||
end = textLen + end;
|
||||
}
|
||||
var result = "";
|
||||
var eawLen = 0;
|
||||
var chars = stringToArray(text);
|
||||
for (const char of chars) {
|
||||
var charLen = length(char);
|
||||
if (eawLen >= start - (charLen == 2 ? 1 : 0)) {
|
||||
if (eawLen + charLen <= end) {
|
||||
result += char;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
eawLen += charLen;
|
||||
}
|
||||
return result;
|
||||
};
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@isaacs/cliui/dist/esm/eastasianwidth/index.js.map
generated
vendored
Normal file
1
node_modules/@isaacs/cliui/dist/esm/eastasianwidth/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
2
node_modules/@isaacs/cliui/dist/esm/emoji-regex/index.d.ts
generated
vendored
Normal file
2
node_modules/@isaacs/cliui/dist/esm/emoji-regex/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export declare const emojiRegex: () => RegExp;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/@isaacs/cliui/dist/esm/emoji-regex/index.d.ts.map
generated
vendored
Normal file
1
node_modules/@isaacs/cliui/dist/esm/emoji-regex/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/emoji-regex/index.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,UAAU,cAC2we,CAAC"}
|
||||
3
node_modules/@isaacs/cliui/dist/esm/emoji-regex/index.js
generated
vendored
Normal file
3
node_modules/@isaacs/cliui/dist/esm/emoji-regex/index.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/@isaacs/cliui/dist/esm/emoji-regex/index.js.map
generated
vendored
Normal file
1
node_modules/@isaacs/cliui/dist/esm/emoji-regex/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
41
node_modules/@isaacs/cliui/dist/esm/index.d.ts
generated
vendored
Normal file
41
node_modules/@isaacs/cliui/dist/esm/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
export type UIOptions = {
|
||||
width: number;
|
||||
wrap?: boolean;
|
||||
rows?: string[];
|
||||
};
|
||||
export type Column = {
|
||||
text: string;
|
||||
width?: number;
|
||||
align?: 'right' | 'left' | 'center';
|
||||
padding?: number[];
|
||||
border?: boolean;
|
||||
};
|
||||
export type ColumnArray = Column[] & {
|
||||
span?: boolean;
|
||||
};
|
||||
export type Line = {
|
||||
hidden?: boolean;
|
||||
text: string;
|
||||
span?: boolean;
|
||||
};
|
||||
export declare class UI {
|
||||
width: number;
|
||||
wrap: boolean;
|
||||
rows: ColumnArray[];
|
||||
constructor(opts: UIOptions);
|
||||
span(...args: ColumnArray): void;
|
||||
resetOutput(): void;
|
||||
div(...args: (Column | string)[]): ColumnArray;
|
||||
shouldApplyLayoutDSL(...args: (Column | string)[]): boolean;
|
||||
applyLayoutDSL(str: string): ColumnArray;
|
||||
colFromString(text: string): Column;
|
||||
measurePadding(str: string): number[];
|
||||
toString(): string;
|
||||
rowToString(row: ColumnArray, lines: Line[]): Line[];
|
||||
renderInline(source: string, previousLine: Line): string;
|
||||
rasterize(row: ColumnArray): string[][];
|
||||
negatePadding(col: Column): number;
|
||||
columnWidths(row: ColumnArray): number[];
|
||||
}
|
||||
export declare const cliui: (opts?: Partial<UIOptions>) => UI;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/@isaacs/cliui/dist/esm/index.d.ts.map
generated
vendored
Normal file
1
node_modules/@isaacs/cliui/dist/esm/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAgBA,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,MAAM,GAAG;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAA;IACnC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,WAAW,GAAG,MAAM,EAAE,GAAG;IACnC,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAED,MAAM,MAAM,IAAI,GAAG;IACjB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAED,qBAAa,EAAE;IACb,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,OAAO,CAAA;IACb,IAAI,EAAE,WAAW,EAAE,CAAA;gBAEP,IAAI,EAAE,SAAS;IAQ3B,IAAI,CAAC,GAAG,IAAI,EAAE,WAAW;IAKzB,WAAW;IAIX,GAAG,CAAC,GAAG,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,GAAG,WAAW;IA2B9C,oBAAoB,CAAC,GAAG,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,GAAG,OAAO;IAQ3D,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW;IA6CxC,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAOnC,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE;IAUrC,QAAQ,IAAI,MAAM;IAelB,WAAW,CAAC,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE;IAgE3C,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI;IAgC/C,SAAS,CAAC,GAAG,EAAE,WAAW;IAqD1B,aAAa,CAAC,GAAG,EAAE,MAAM;IAezB,YAAY,CAAC,GAAG,EAAE,WAAW;CAqC9B;AA2CD,eAAO,MAAM,KAAK,GAAI,OAAM,OAAO,CAAC,SAAS,CAAM,OAM/C,CAAA"}
|
||||
317
node_modules/@isaacs/cliui/dist/esm/index.js
generated
vendored
Normal file
317
node_modules/@isaacs/cliui/dist/esm/index.js
generated
vendored
Normal file
@@ -0,0 +1,317 @@
|
||||
import { stringWidth } from './string-width/index.js';
|
||||
import { stripAnsi } from './strip-ansi/index.js';
|
||||
import { wrap } from './wrap-ansi/index.js';
|
||||
const align = {
|
||||
right: (str, width) => `${' '.repeat(Math.max(0, width - stringWidth(str)))}${str}`,
|
||||
center: (str, width) => `${' '.repeat(Math.max(0, width - stringWidth(str)) >> 1)}${str}`,
|
||||
};
|
||||
const top = 0;
|
||||
const right = 1;
|
||||
const bottom = 2;
|
||||
const left = 3;
|
||||
export class UI {
|
||||
width;
|
||||
wrap;
|
||||
rows;
|
||||
constructor(opts) {
|
||||
this.width = opts.width;
|
||||
/* c8 ignore start */
|
||||
this.wrap = opts.wrap ?? true;
|
||||
/* c8 ignore stop */
|
||||
this.rows = [];
|
||||
}
|
||||
span(...args) {
|
||||
const cols = this.div(...args);
|
||||
cols.span = true;
|
||||
}
|
||||
resetOutput() {
|
||||
this.rows = [];
|
||||
}
|
||||
div(...args) {
|
||||
if (args.length === 0) {
|
||||
this.div('');
|
||||
}
|
||||
if (this.wrap &&
|
||||
this.shouldApplyLayoutDSL(...args) &&
|
||||
typeof args[0] === 'string') {
|
||||
return this.applyLayoutDSL(args[0]);
|
||||
}
|
||||
const cols = Object.assign(args.map(arg => {
|
||||
if (typeof arg === 'string') {
|
||||
return this.colFromString(arg);
|
||||
}
|
||||
return arg;
|
||||
}), { span: false });
|
||||
this.rows.push(cols);
|
||||
return cols;
|
||||
}
|
||||
shouldApplyLayoutDSL(...args) {
|
||||
return (args.length === 1 &&
|
||||
typeof args[0] === 'string' &&
|
||||
/[\t\n]/.test(args[0]));
|
||||
}
|
||||
applyLayoutDSL(str) {
|
||||
const rows = str.split('\n').map(row => row.split('\t'));
|
||||
let leftColumnWidth = 0;
|
||||
// simple heuristic for layout, make sure the
|
||||
// second column lines up along the left-hand.
|
||||
// don't allow the first column to take up more
|
||||
// than 50% of the screen.
|
||||
rows.forEach(columns => {
|
||||
if (columns.length > 1 &&
|
||||
stringWidth(String(columns[0])) > leftColumnWidth) {
|
||||
leftColumnWidth = Math.min(Math.floor(this.width * 0.5), stringWidth(String(columns[0])));
|
||||
}
|
||||
});
|
||||
// generate a table:
|
||||
// replacing ' ' with padding calculations.
|
||||
// using the algorithmically generated width.
|
||||
rows.forEach(columns => {
|
||||
this.div(...columns.map((r, i) => {
|
||||
return {
|
||||
text: r.trim(),
|
||||
padding: this.measurePadding(r),
|
||||
width: i === 0 && columns.length > 1 ? leftColumnWidth : undefined,
|
||||
};
|
||||
}));
|
||||
});
|
||||
const row = this.rows[this.rows.length - 1];
|
||||
/* c8 ignore start */
|
||||
if (!row) {
|
||||
throw new Error('no rows found');
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
return row;
|
||||
}
|
||||
colFromString(text) {
|
||||
return {
|
||||
text,
|
||||
padding: this.measurePadding(text),
|
||||
};
|
||||
}
|
||||
measurePadding(str) {
|
||||
// measure padding without ansi escape codes
|
||||
const noAnsi = stripAnsi(str);
|
||||
const [right = '', left = ''] = [
|
||||
noAnsi.match(/\s*$/)?.[0],
|
||||
noAnsi.match(/^\s*/)?.[0],
|
||||
];
|
||||
return [0, right.length, 0, left.length];
|
||||
}
|
||||
toString() {
|
||||
const lines = [];
|
||||
this.rows.forEach(row => {
|
||||
this.rowToString(row, lines);
|
||||
});
|
||||
// don't display any lines with the
|
||||
// hidden flag set.
|
||||
return lines
|
||||
.filter(line => !line.hidden)
|
||||
.map(line => line.text)
|
||||
.join('\n');
|
||||
}
|
||||
rowToString(row, lines) {
|
||||
this.rasterize(row).forEach((rrow, r) => {
|
||||
let str = '';
|
||||
rrow.forEach((col, c) => {
|
||||
const column = row[c];
|
||||
const { width } = column; // the width with padding.
|
||||
const wrapWidth = this.negatePadding(column); // the width without padding.
|
||||
let ts = col; // temporary string used during alignment/padding.
|
||||
if (wrapWidth > stringWidth(col)) {
|
||||
ts += ' '.repeat(wrapWidth - stringWidth(col));
|
||||
}
|
||||
// align the string within its column.
|
||||
if (column.align && column.align !== 'left' && this.wrap) {
|
||||
const fn = align[column.align];
|
||||
ts = fn(ts.trim(), wrapWidth);
|
||||
if (stringWidth(ts) < wrapWidth) {
|
||||
/* c8 ignore start */
|
||||
const w = width || 0;
|
||||
/* c8 ignore stop */
|
||||
ts += ' '.repeat(w - stringWidth(ts) - 1);
|
||||
}
|
||||
}
|
||||
// apply border and padding to string.
|
||||
const padding = column.padding || [0, 0, 0, 0];
|
||||
if (padding[left]) {
|
||||
str += ' '.repeat(padding[left]);
|
||||
}
|
||||
str += addBorder(column, ts, '| ');
|
||||
str += ts;
|
||||
str += addBorder(column, ts, ' |');
|
||||
if (padding[right]) {
|
||||
str += ' '.repeat(padding[right]);
|
||||
}
|
||||
// if prior row is span, try to render the
|
||||
// current row on the prior line.
|
||||
if (r === 0 && lines.length > 0) {
|
||||
const lastLine = lines[lines.length - 1];
|
||||
/* c8 ignore start */
|
||||
if (!lastLine) {
|
||||
throw new Error('last line not found');
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
str = this.renderInline(str, lastLine);
|
||||
}
|
||||
});
|
||||
// remove trailing whitespace.
|
||||
lines.push({
|
||||
text: str.replace(/ +$/, ''),
|
||||
span: row.span,
|
||||
});
|
||||
});
|
||||
return lines;
|
||||
}
|
||||
// if the full 'source' can render in
|
||||
// the target line, do so.
|
||||
renderInline(source, previousLine) {
|
||||
const match = source.match(/^ */);
|
||||
/* c8 ignore start */
|
||||
const leadingWhitespace = match ? match[0].length : 0;
|
||||
/* c8 ignore stop */
|
||||
const target = previousLine.text;
|
||||
const targetTextWidth = stringWidth(target.trimEnd());
|
||||
if (!previousLine.span) {
|
||||
return source;
|
||||
}
|
||||
// if we're not applying wrapping logic,
|
||||
// just always append to the span.
|
||||
if (!this.wrap) {
|
||||
previousLine.hidden = true;
|
||||
return target + source;
|
||||
}
|
||||
if (leadingWhitespace < targetTextWidth) {
|
||||
return source;
|
||||
}
|
||||
previousLine.hidden = true;
|
||||
return (target.trimEnd() +
|
||||
' '.repeat(leadingWhitespace - targetTextWidth) +
|
||||
source.trimStart());
|
||||
}
|
||||
rasterize(row) {
|
||||
const rrows = [];
|
||||
const widths = this.columnWidths(row);
|
||||
let wrapped;
|
||||
// word wrap all columns, and create
|
||||
// a data-structure that is easy to rasterize.
|
||||
row.forEach((col, c) => {
|
||||
// leave room for left and right padding.
|
||||
col.width = widths[c];
|
||||
if (this.wrap) {
|
||||
wrapped = wrap(col.text, this.negatePadding(col), {
|
||||
hard: true,
|
||||
}).split('\n');
|
||||
}
|
||||
else {
|
||||
wrapped = col.text.split('\n');
|
||||
}
|
||||
if (col.border) {
|
||||
wrapped.unshift('.' + '-'.repeat(this.negatePadding(col) + 2) + '.');
|
||||
wrapped.push("'" + '-'.repeat(this.negatePadding(col) + 2) + "'");
|
||||
}
|
||||
// add top and bottom padding.
|
||||
if (col.padding) {
|
||||
wrapped.unshift(...new Array(col.padding[top] || 0).fill(''));
|
||||
wrapped.push(...new Array(col.padding[bottom] || 0).fill(''));
|
||||
}
|
||||
wrapped.forEach((str, r) => {
|
||||
if (!rrows[r]) {
|
||||
rrows.push([]);
|
||||
}
|
||||
/* c8 ignore start */
|
||||
const rrow = rrows[r] ?? [];
|
||||
/* c8 ignore stop */
|
||||
for (let i = 0; i < c; i++) {
|
||||
if (rrow[i] === undefined) {
|
||||
rrow.push('');
|
||||
}
|
||||
}
|
||||
rrow.push(str);
|
||||
});
|
||||
});
|
||||
return rrows;
|
||||
}
|
||||
negatePadding(col) {
|
||||
/* c8 ignore start */
|
||||
let wrapWidth = col.width || 0;
|
||||
/* c8 ignore stop */
|
||||
if (col.padding) {
|
||||
wrapWidth -= (col.padding[left] || 0) + (col.padding[right] || 0);
|
||||
}
|
||||
if (col.border) {
|
||||
wrapWidth -= 4;
|
||||
}
|
||||
return wrapWidth;
|
||||
}
|
||||
columnWidths(row) {
|
||||
if (!this.wrap) {
|
||||
return row.map(col => {
|
||||
return col.width || stringWidth(col.text);
|
||||
});
|
||||
}
|
||||
let unset = row.length;
|
||||
let remainingWidth = this.width;
|
||||
// column widths can be set in config.
|
||||
const widths = row.map(col => {
|
||||
if (col.width) {
|
||||
unset--;
|
||||
remainingWidth -= col.width;
|
||||
return col.width;
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
// any unset widths should be calculated.
|
||||
/* c8 ignore start */
|
||||
const unsetWidth = unset ? Math.floor(remainingWidth / unset) : 0;
|
||||
/* c8 ignore stop */
|
||||
return widths.map((w, i) => {
|
||||
if (w === undefined) {
|
||||
/* c8 ignore start */
|
||||
const col = row[i] ?? { text: '', padding: [] };
|
||||
/* c8 ignore stop */
|
||||
return Math.max(unsetWidth, _minWidth(col));
|
||||
}
|
||||
return w;
|
||||
});
|
||||
}
|
||||
}
|
||||
const addBorder = (col, ts, style) => {
|
||||
if (col.border) {
|
||||
if (/[.']-+[.']/.test(ts)) {
|
||||
return '';
|
||||
}
|
||||
if (ts.trim().length !== 0) {
|
||||
return style;
|
||||
}
|
||||
return ' ';
|
||||
}
|
||||
return '';
|
||||
};
|
||||
// calculates the minimum width of
|
||||
// a column, based on padding preferences.
|
||||
const _minWidth = (col) => {
|
||||
const padding = col.padding || [];
|
||||
const minWidth = 1 + (padding[left] || 0) + (padding[right] || 0);
|
||||
if (col.border) {
|
||||
return minWidth + 4;
|
||||
}
|
||||
return minWidth;
|
||||
};
|
||||
const getWindowWidth = () => {
|
||||
/* c8 ignore start */
|
||||
if (typeof process === 'object' &&
|
||||
process.stdout &&
|
||||
process.stdout.columns) {
|
||||
return process.stdout.columns;
|
||||
}
|
||||
return 80;
|
||||
};
|
||||
/* c8 ignore stop */
|
||||
export const cliui = (opts = {}) => new UI({
|
||||
/* c8 ignore start */
|
||||
width: opts?.width || getWindowWidth(),
|
||||
wrap: opts?.wrap,
|
||||
/* c8 ignore stop */
|
||||
});
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@isaacs/cliui/dist/esm/index.js.map
generated
vendored
Normal file
1
node_modules/@isaacs/cliui/dist/esm/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
12
node_modules/@isaacs/cliui/dist/esm/index.min.js
generated
vendored
Normal file
12
node_modules/@isaacs/cliui/dist/esm/index.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
7
node_modules/@isaacs/cliui/dist/esm/index.min.js.map
generated
vendored
Normal file
7
node_modules/@isaacs/cliui/dist/esm/index.min.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
node_modules/@isaacs/cliui/dist/esm/package.json
generated
vendored
Normal file
3
node_modules/@isaacs/cliui/dist/esm/package.json
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"type": "module"
|
||||
}
|
||||
5
node_modules/@isaacs/cliui/dist/esm/string-width/index.d.ts
generated
vendored
Normal file
5
node_modules/@isaacs/cliui/dist/esm/string-width/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export type Options = {
|
||||
ambiguousIsNarrow?: boolean;
|
||||
};
|
||||
export declare function stringWidth(str: string, options?: Options): number;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/@isaacs/cliui/dist/esm/string-width/index.d.ts.map
generated
vendored
Normal file
1
node_modules/@isaacs/cliui/dist/esm/string-width/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/string-width/index.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,OAAO,GAAG;IACpB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEF,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,OAAY,UAqD7D"}
|
||||
46
node_modules/@isaacs/cliui/dist/esm/string-width/index.js
generated
vendored
Normal file
46
node_modules/@isaacs/cliui/dist/esm/string-width/index.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
import { stripAnsi } from "../strip-ansi/index.js";
|
||||
import { eastAsianWidth } from "../eastasianwidth/index.js";
|
||||
import { emojiRegex } from "../emoji-regex/index.js";
|
||||
export function stringWidth(str, options = {}) {
|
||||
if (typeof str !== "string" || str.length === 0) {
|
||||
return 0;
|
||||
}
|
||||
options = {
|
||||
ambiguousIsNarrow: true,
|
||||
...options,
|
||||
};
|
||||
str = stripAnsi(str);
|
||||
if (str.length === 0) {
|
||||
return 0;
|
||||
}
|
||||
str = str.replace(emojiRegex(), " ");
|
||||
const ambiguousCharacterWidth = options.ambiguousIsNarrow ? 1 : 2;
|
||||
let width = 0;
|
||||
for (const character of str) {
|
||||
const codePoint = character.codePointAt(0);
|
||||
// Ignore control characters
|
||||
if (!codePoint ||
|
||||
codePoint <= 0x1f ||
|
||||
(codePoint >= 0x7f && codePoint <= 0x9f)) {
|
||||
continue;
|
||||
}
|
||||
// Ignore combining characters
|
||||
if (codePoint >= 0x300 && codePoint <= 0x36f) {
|
||||
continue;
|
||||
}
|
||||
const code = eastAsianWidth(character);
|
||||
switch (code) {
|
||||
case "F":
|
||||
case "W":
|
||||
width += 2;
|
||||
break;
|
||||
case "A":
|
||||
width += ambiguousCharacterWidth;
|
||||
break;
|
||||
default:
|
||||
width += 1;
|
||||
}
|
||||
}
|
||||
return width;
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@isaacs/cliui/dist/esm/string-width/index.js.map
generated
vendored
Normal file
1
node_modules/@isaacs/cliui/dist/esm/string-width/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/string-width/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAMrD,MAAM,UAAU,WAAW,CAAC,GAAW,EAAE,UAAmB,EAAE;IAC5D,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAChD,OAAO,CAAC,CAAC;IACX,CAAC;IAED,OAAO,GAAG;QACR,iBAAiB,EAAE,IAAI;QACvB,GAAG,OAAO;KACX,CAAC;IAEF,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;IAErB,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO,CAAC,CAAC;IACX,CAAC;IAED,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,IAAI,CAAC,CAAC;IAEtC,MAAM,uBAAuB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAClE,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,KAAK,MAAM,SAAS,IAAI,GAAG,EAAE,CAAC;QAC5B,MAAM,SAAS,GAAG,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QAE3C,4BAA4B;QAC5B,IACE,CAAC,SAAS;YACV,SAAS,IAAI,IAAI;YACjB,CAAC,SAAS,IAAI,IAAI,IAAI,SAAS,IAAI,IAAI,CAAC,EACxC,CAAC;YACD,SAAS;QACX,CAAC;QAED,8BAA8B;QAC9B,IAAI,SAAS,IAAI,KAAK,IAAI,SAAS,IAAI,KAAK,EAAE,CAAC;YAC7C,SAAS;QACX,CAAC;QAED,MAAM,IAAI,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC;QACvC,QAAQ,IAAI,EAAE,CAAC;YACb,KAAK,GAAG,CAAC;YACT,KAAK,GAAG;gBACN,KAAK,IAAI,CAAC,CAAC;gBACX,MAAM;YACR,KAAK,GAAG;gBACN,KAAK,IAAI,uBAAuB,CAAC;gBACjC,MAAM;YACR;gBACE,KAAK,IAAI,CAAC,CAAC;QACf,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { stripAnsi } from \"../strip-ansi/index.js\";\nimport { eastAsianWidth } from \"../eastasianwidth/index.js\";\nimport { emojiRegex } from \"../emoji-regex/index.js\";\n\nexport type Options = {\n ambiguousIsNarrow?: boolean;\n};\n\nexport function stringWidth(str: string, options: Options = {}) {\n if (typeof str !== \"string\" || str.length === 0) {\n return 0;\n }\n\n options = {\n ambiguousIsNarrow: true,\n ...options,\n };\n\n str = stripAnsi(str);\n\n if (str.length === 0) {\n return 0;\n }\n\n str = str.replace(emojiRegex(), \" \");\n\n const ambiguousCharacterWidth = options.ambiguousIsNarrow ? 1 : 2;\n let width = 0;\n\n for (const character of str) {\n const codePoint = character.codePointAt(0);\n\n // Ignore control characters\n if (\n !codePoint ||\n codePoint <= 0x1f ||\n (codePoint >= 0x7f && codePoint <= 0x9f)\n ) {\n continue;\n }\n\n // Ignore combining characters\n if (codePoint >= 0x300 && codePoint <= 0x36f) {\n continue;\n }\n\n const code = eastAsianWidth(character);\n switch (code) {\n case \"F\":\n case \"W\":\n width += 2;\n break;\n case \"A\":\n width += ambiguousCharacterWidth;\n break;\n default:\n width += 1;\n }\n }\n\n return width;\n}\n"]}
|
||||
2
node_modules/@isaacs/cliui/dist/esm/strip-ansi/index.d.ts
generated
vendored
Normal file
2
node_modules/@isaacs/cliui/dist/esm/strip-ansi/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export declare const stripAnsi: (str: string) => string;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/@isaacs/cliui/dist/esm/strip-ansi/index.d.ts.map
generated
vendored
Normal file
1
node_modules/@isaacs/cliui/dist/esm/strip-ansi/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/strip-ansi/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS,GAAI,KAAK,MAAM,WAA2B,CAAC"}
|
||||
4
node_modules/@isaacs/cliui/dist/esm/strip-ansi/index.js
generated
vendored
Normal file
4
node_modules/@isaacs/cliui/dist/esm/strip-ansi/index.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import { ansiRegex } from "../ansi-regex/index.js";
|
||||
const regex = ansiRegex();
|
||||
export const stripAnsi = (str) => str.replace(regex, "");
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@isaacs/cliui/dist/esm/strip-ansi/index.js.map
generated
vendored
Normal file
1
node_modules/@isaacs/cliui/dist/esm/strip-ansi/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/strip-ansi/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,MAAM,KAAK,GAAG,SAAS,EAAE,CAAC;AAC1B,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC","sourcesContent":["import { ansiRegex } from \"../ansi-regex/index.js\";\nconst regex = ansiRegex();\nexport const stripAnsi = (str: string) => str.replace(regex, \"\");\n"]}
|
||||
7
node_modules/@isaacs/cliui/dist/esm/wrap-ansi/index.d.ts
generated
vendored
Normal file
7
node_modules/@isaacs/cliui/dist/esm/wrap-ansi/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
export type Options = {
|
||||
trim?: boolean;
|
||||
wordWrap?: boolean;
|
||||
hard?: boolean;
|
||||
};
|
||||
export declare const wrap: (str: string, columns: number, options: Options) => string;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/@isaacs/cliui/dist/esm/wrap-ansi/index.d.ts.map
generated
vendored
Normal file
1
node_modules/@isaacs/cliui/dist/esm/wrap-ansi/index.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/wrap-ansi/index.ts"],"names":[],"mappings":"AAuGA,MAAM,MAAM,OAAO,GAAG;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAuH7E,eAAO,MAAM,IAAI,GAAI,KAAK,MAAM,EAAE,SAAS,MAAM,EAAE,SAAS,OAAO,WAMpD,CAAC"}
|
||||
172
node_modules/@isaacs/cliui/dist/esm/wrap-ansi/index.js
generated
vendored
Normal file
172
node_modules/@isaacs/cliui/dist/esm/wrap-ansi/index.js
generated
vendored
Normal file
@@ -0,0 +1,172 @@
|
||||
import { stringWidth } from "../string-width/index.js";
|
||||
import { stripAnsi } from "../strip-ansi/index.js";
|
||||
import { ansiStyles } from "../ansi-styles/index.js";
|
||||
const ESCAPES = new Set(["\u001B", "\u009B"]);
|
||||
const END_CODE = 39;
|
||||
const ANSI_ESCAPE_BELL = "\u0007";
|
||||
const ANSI_CSI = "[";
|
||||
const ANSI_OSC = "]";
|
||||
const ANSI_SGR_TERMINATOR = "m";
|
||||
const ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
||||
const wrapAnsiCode = (code) => `${ESCAPES.values().next().value}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
||||
const wrapAnsiHyperlink = (uri) => `${ESCAPES.values().next().value}${ANSI_ESCAPE_LINK}${uri}${ANSI_ESCAPE_BELL}`;
|
||||
// Calculate the length of words split on ' ', ignoring
|
||||
// the extra characters added by ansi escape codes
|
||||
const wordLengths = (str) => str.split(" ").map((character) => stringWidth(character));
|
||||
// Wrap a long word across multiple rows
|
||||
// Ansi escape codes do not count towards length
|
||||
const wrapWord = (rows, word, columns) => {
|
||||
const characters = [...word];
|
||||
let isInsideEscape = false;
|
||||
let isInsideLinkEscape = false;
|
||||
let visible = stringWidth(stripAnsi(String(rows[rows.length - 1])));
|
||||
for (const [index, character] of characters.entries()) {
|
||||
const characterLength = stringWidth(character);
|
||||
if (visible + characterLength <= columns) {
|
||||
rows[rows.length - 1] += character;
|
||||
}
|
||||
else {
|
||||
rows.push(character);
|
||||
visible = 0;
|
||||
}
|
||||
if (ESCAPES.has(character)) {
|
||||
isInsideEscape = true;
|
||||
isInsideLinkEscape = characters
|
||||
.slice(index + 1)
|
||||
.join("")
|
||||
.startsWith(ANSI_ESCAPE_LINK);
|
||||
}
|
||||
if (isInsideEscape) {
|
||||
if (isInsideLinkEscape) {
|
||||
if (character === ANSI_ESCAPE_BELL) {
|
||||
isInsideEscape = false;
|
||||
isInsideLinkEscape = false;
|
||||
}
|
||||
}
|
||||
else if (character === ANSI_SGR_TERMINATOR) {
|
||||
isInsideEscape = false;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
visible += characterLength;
|
||||
if (visible === columns && index < characters.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 && String(rows[rows.length - 1]).length > 0 && rows.length > 1) {
|
||||
rows[rows.length - 2] = String(rows[rows.length - 1]) + 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(String(words[last - 1])) > 0) {
|
||||
break;
|
||||
}
|
||||
last--;
|
||||
}
|
||||
if (last === words.length) {
|
||||
return str;
|
||||
}
|
||||
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
||||
};
|
||||
const exec = (str, columns, options = {}) => {
|
||||
if (options.trim !== false && str.trim() === "") {
|
||||
return "";
|
||||
}
|
||||
let returnValue = "";
|
||||
let escapeCode;
|
||||
let escapeUrl;
|
||||
const lengths = wordLengths(str);
|
||||
let rows = [""];
|
||||
for (const [index, word] of str.split(" ").entries()) {
|
||||
if (options.trim !== false) {
|
||||
rows[rows.length - 1] = String(rows[rows.length - 1]).trimStart();
|
||||
}
|
||||
let rowLength = stringWidth(String(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'
|
||||
const len = Number(lengths[index]);
|
||||
if (options.hard && len > columns) {
|
||||
const remainingColumns = columns - rowLength;
|
||||
const breaksStartingThisLine = 1 + Math.floor((len - remainingColumns - 1) / columns);
|
||||
const breaksStartingNextLine = Math.floor((len - 1) / columns);
|
||||
if (breaksStartingNextLine < breaksStartingThisLine) {
|
||||
rows.push("");
|
||||
}
|
||||
wrapWord(rows, word, columns);
|
||||
continue;
|
||||
}
|
||||
if (rowLength + len > columns && rowLength > 0 && len > 0) {
|
||||
if (options.wordWrap === false && rowLength < columns) {
|
||||
wrapWord(rows, word, columns);
|
||||
continue;
|
||||
}
|
||||
rows.push("");
|
||||
}
|
||||
if (rowLength + len > columns && options.wordWrap === false) {
|
||||
wrapWord(rows, word, columns);
|
||||
continue;
|
||||
}
|
||||
rows[rows.length - 1] += word;
|
||||
}
|
||||
if (options.trim !== false) {
|
||||
rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
|
||||
}
|
||||
const pre = [...rows.join("\n")];
|
||||
for (const [index, character] of pre.entries()) {
|
||||
returnValue += character;
|
||||
if (ESCAPES.has(character)) {
|
||||
const { groups } = (new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`).exec(pre.slice(index).join("")) || { groups: {} });
|
||||
if (groups.code !== undefined) {
|
||||
const code = Number.parseFloat(groups.code);
|
||||
escapeCode = code === END_CODE ? undefined : code;
|
||||
}
|
||||
else if (groups.uri !== undefined) {
|
||||
escapeUrl = groups.uri.length === 0 ? undefined : groups.uri;
|
||||
}
|
||||
}
|
||||
const code = ansiStyles.codes.get(Number(escapeCode));
|
||||
if (pre[index + 1] === "\n") {
|
||||
if (escapeUrl) {
|
||||
returnValue += wrapAnsiHyperlink("");
|
||||
}
|
||||
if (escapeCode && code) {
|
||||
returnValue += wrapAnsiCode(code);
|
||||
}
|
||||
}
|
||||
else if (character === "\n") {
|
||||
if (escapeCode && code) {
|
||||
returnValue += wrapAnsiCode(escapeCode);
|
||||
}
|
||||
if (escapeUrl) {
|
||||
returnValue += wrapAnsiHyperlink(escapeUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
return returnValue;
|
||||
};
|
||||
// For each newline, invoke the method separately
|
||||
export const wrap = (str, columns, options) => String(str)
|
||||
.normalize()
|
||||
.replace(/\r\n/g, "\n")
|
||||
.split("\n")
|
||||
.map((line) => exec(line, columns, options))
|
||||
.join("\n");
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@isaacs/cliui/dist/esm/wrap-ansi/index.js.map
generated
vendored
Normal file
1
node_modules/@isaacs/cliui/dist/esm/wrap-ansi/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
163
node_modules/@isaacs/cliui/package.json
generated
vendored
Normal file
163
node_modules/@isaacs/cliui/package.json
generated
vendored
Normal file
@@ -0,0 +1,163 @@
|
||||
{
|
||||
"name": "@isaacs/cliui",
|
||||
"version": "9.0.0",
|
||||
"description": "easily create complex multi-column command-line-interfaces",
|
||||
"type": "module",
|
||||
"main": "./dist/commonjs/index.js",
|
||||
"module": "./dist/esm/index.js",
|
||||
"types": "./dist/commonjs/index.d.ts",
|
||||
"exports": {
|
||||
"./package.json": "./package.json",
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/esm/index.d.ts",
|
||||
"default": "./dist/esm/index.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/commonjs/index.d.ts",
|
||||
"default": "./dist/commonjs/index.js"
|
||||
}
|
||||
},
|
||||
"./ansi-regex": {
|
||||
"import": {
|
||||
"types": "./dist/esm/ansi-regex/index.d.ts",
|
||||
"default": "./dist/esm/ansi-regex/index.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/commonjs/ansi-regex/index.d.ts",
|
||||
"default": "./dist/commonjs/ansi-regex/index.js"
|
||||
}
|
||||
},
|
||||
"./ansi-styles": {
|
||||
"import": {
|
||||
"types": "./dist/esm/ansi-styles/index.d.ts",
|
||||
"default": "./dist/esm/ansi-styles/index.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/commonjs/ansi-styles/index.d.ts",
|
||||
"default": "./dist/commonjs/ansi-styles/index.js"
|
||||
}
|
||||
},
|
||||
"./eastasianwidth": {
|
||||
"import": {
|
||||
"types": "./dist/esm/eastasianwidth/index.d.ts",
|
||||
"default": "./dist/esm/eastasianwidth/index.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/commonjs/eastasianwidth/index.d.ts",
|
||||
"default": "./dist/commonjs/eastasianwidth/index.js"
|
||||
}
|
||||
},
|
||||
"./emoji-regex": {
|
||||
"import": {
|
||||
"types": "./dist/esm/emoji-regex/index.d.ts",
|
||||
"default": "./dist/esm/emoji-regex/index.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/commonjs/emoji-regex/index.d.ts",
|
||||
"default": "./dist/commonjs/emoji-regex/index.js"
|
||||
}
|
||||
},
|
||||
"./string-width": {
|
||||
"import": {
|
||||
"types": "./dist/esm/string-width/index.d.ts",
|
||||
"default": "./dist/esm/string-width/index.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/commonjs/string-width/index.d.ts",
|
||||
"default": "./dist/commonjs/string-width/index.js"
|
||||
}
|
||||
},
|
||||
"./strip-ansi": {
|
||||
"import": {
|
||||
"types": "./dist/esm/strip-ansi/index.d.ts",
|
||||
"default": "./dist/esm/strip-ansi/index.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/commonjs/strip-ansi/index.d.ts",
|
||||
"default": "./dist/commonjs/strip-ansi/index.js"
|
||||
}
|
||||
},
|
||||
"./wrap-ansi": {
|
||||
"import": {
|
||||
"types": "./dist/esm/wrap-ansi/index.d.ts",
|
||||
"default": "./dist/esm/wrap-ansi/index.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/commonjs/wrap-ansi/index.d.ts",
|
||||
"default": "./dist/commonjs/wrap-ansi/index.js"
|
||||
}
|
||||
},
|
||||
"./min": {
|
||||
"import": {
|
||||
"types": "./dist/esm/index.d.ts",
|
||||
"default": "./dist/esm/index.min.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/commonjs/index.d.ts",
|
||||
"default": "./dist/commonjs/index.min.js"
|
||||
}
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"preversion": "npm test",
|
||||
"postversion": "npm publish",
|
||||
"prepublishOnly": "git push origin --follow-tags",
|
||||
"prepare": "tshy && bash build.sh",
|
||||
"pretest": "npm run prepare",
|
||||
"presnap": "npm run prepare",
|
||||
"test": "tap",
|
||||
"snap": "tap",
|
||||
"format": "prettier --write . --log-level warn",
|
||||
"typedoc": "typedoc"
|
||||
},
|
||||
"repository": "git+ssh://git@github.com:isaacs/cliui",
|
||||
"keywords": [
|
||||
"cli",
|
||||
"command-line",
|
||||
"layout",
|
||||
"design",
|
||||
"console",
|
||||
"wrap",
|
||||
"table"
|
||||
],
|
||||
"license": "BlueOak-1.0.0",
|
||||
"devDependencies": {
|
||||
"@types/node": "^25.2.1",
|
||||
"esbuild": "^0.27.2",
|
||||
"prettier": "^3.8.1",
|
||||
"tap": "^21.5.0",
|
||||
"tshy": "^3.1.0",
|
||||
"typedoc": "^0.28.16"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"tshy": {
|
||||
"selfLink": false,
|
||||
"exports": {
|
||||
"./package.json": "./package.json",
|
||||
".": "./src/index.ts",
|
||||
"./ansi-regex": "./src/ansi-regex/index.ts",
|
||||
"./ansi-styles": "./src/ansi-styles/index.ts",
|
||||
"./eastasianwidth": "./src/eastasianwidth/index.ts",
|
||||
"./emoji-regex": "./src/emoji-regex/index.ts",
|
||||
"./string-width": "./src/string-width/index.ts",
|
||||
"./strip-ansi": "./src/strip-ansi/index.ts",
|
||||
"./wrap-ansi": "./src/wrap-ansi/index.ts",
|
||||
"./min": {
|
||||
"import": {
|
||||
"types": "./dist/esm/index.d.ts",
|
||||
"default": "./dist/esm/index.min.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/commonjs/index.d.ts",
|
||||
"default": "./dist/commonjs/index.min.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user