Deployed the page to Github Pages.
This commit is contained in:
parent
1d79754e93
commit
2c89899458
62797 changed files with 6551425 additions and 15279 deletions
116
node_modules/cli-truncate/index.d.ts
generated
vendored
Normal file
116
node_modules/cli-truncate/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,116 @@
|
|||
export type Options = {
|
||||
/**
|
||||
The position to truncate the string.
|
||||
|
||||
@default 'end'
|
||||
*/
|
||||
readonly position?: 'start' | 'middle' | 'end';
|
||||
|
||||
/**
|
||||
Add a space between the text and the ellipsis.
|
||||
|
||||
@default false
|
||||
|
||||
@example
|
||||
```
|
||||
import cliTruncate from 'cli-truncate';
|
||||
|
||||
cliTruncate('unicorns', 5, {position: 'end', space: true});
|
||||
//=> 'uni …'
|
||||
|
||||
cliTruncate('unicorns', 5, {position: 'end', space: false});
|
||||
//=> 'unic…'
|
||||
|
||||
cliTruncate('unicorns', 6, {position: 'start', space: true});
|
||||
//=> '… orns'
|
||||
|
||||
cliTruncate('unicorns', 7, {position: 'middle', space: true});
|
||||
//=> 'uni … s'
|
||||
```
|
||||
*/
|
||||
readonly space?: boolean;
|
||||
|
||||
/**
|
||||
Truncate the string from a whitespace if it is within 3 characters from the actual breaking point.
|
||||
|
||||
@default false
|
||||
|
||||
@example
|
||||
```
|
||||
import cliTruncate from 'cli-truncate';
|
||||
|
||||
cliTruncate('unicorns rainbow dragons', 20, {position: 'start', preferTruncationOnSpace: true});
|
||||
//=> '…rainbow dragons'
|
||||
|
||||
cliTruncate('unicorns rainbow dragons', 20, {position: 'middle', preferTruncationOnSpace: true});
|
||||
//=> 'unicorns…dragons'
|
||||
|
||||
cliTruncate('unicorns rainbow dragons', 6, {position: 'end', preferTruncationOnSpace: true});
|
||||
//=> 'unico…'
|
||||
````
|
||||
*/
|
||||
readonly preferTruncationOnSpace?: boolean;
|
||||
|
||||
/**
|
||||
The character to use at the breaking point.
|
||||
|
||||
@default '…'
|
||||
|
||||
@example
|
||||
```
|
||||
import cliTruncate from 'cli-truncate';
|
||||
|
||||
cliTruncate('unicorns', 5, {position: 'end'});
|
||||
//=> 'unic…'
|
||||
|
||||
cliTruncate('unicorns', 5, {position: 'end', truncationCharacter: '.'});
|
||||
//=> 'unic.'
|
||||
|
||||
cliTruncate('unicorns', 5, {position: 'end', truncationCharacter: ''});
|
||||
//=> 'unico'
|
||||
*/
|
||||
readonly truncationCharacter?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
Truncate a string to a specific width in the terminal.
|
||||
|
||||
@param text - The text to truncate.
|
||||
@param columns - The number of columns to occupy in the terminal.
|
||||
|
||||
@example
|
||||
```
|
||||
import cliTruncate from 'cli-truncate';
|
||||
|
||||
cliTruncate('unicorn', 4);
|
||||
//=> 'uni…'
|
||||
|
||||
// Truncate at different positions
|
||||
cliTruncate('unicorn', 4, {position: 'start'});
|
||||
//=> '…orn'
|
||||
|
||||
cliTruncate('unicorn', 4, {position: 'middle'});
|
||||
//=> 'un…n'
|
||||
|
||||
cliTruncate('\u001B[31municorn\u001B[39m', 4);
|
||||
//=> '\u001B[31muni\u001B[39m…'
|
||||
|
||||
// Truncate Unicode surrogate pairs
|
||||
cliTruncate('uni\uD83C\uDE00corn', 5);
|
||||
//=> 'uni\uD83C\uDE00…'
|
||||
|
||||
// Truncate fullwidth characters
|
||||
cliTruncate('안녕하세요', 3);
|
||||
//=> '안…'
|
||||
|
||||
// Truncate the paragraph to the terminal width
|
||||
const paragraph = 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa.';
|
||||
cliTruncate(paragraph, process.stdout.columns);
|
||||
//=> 'Lorem ipsum dolor sit amet, consectetuer adipiscing…'
|
||||
```
|
||||
*/
|
||||
export default function cliTruncate(
|
||||
text: string,
|
||||
columns: number,
|
||||
options?: Options
|
||||
): string;
|
99
node_modules/cli-truncate/index.js
generated
vendored
Normal file
99
node_modules/cli-truncate/index.js
generated
vendored
Normal file
|
@ -0,0 +1,99 @@
|
|||
import sliceAnsi from 'slice-ansi';
|
||||
import stringWidth from 'string-width';
|
||||
|
||||
function getIndexOfNearestSpace(string, wantedIndex, shouldSearchRight) {
|
||||
if (string.charAt(wantedIndex) === ' ') {
|
||||
return wantedIndex;
|
||||
}
|
||||
|
||||
const direction = shouldSearchRight ? 1 : -1;
|
||||
|
||||
for (let index = 0; index <= 3; index++) {
|
||||
const finalIndex = wantedIndex + (index * direction);
|
||||
if (string.charAt(finalIndex) === ' ') {
|
||||
return finalIndex;
|
||||
}
|
||||
}
|
||||
|
||||
return wantedIndex;
|
||||
}
|
||||
|
||||
export default function cliTruncate(text, columns, options = {}) {
|
||||
const {
|
||||
position = 'end',
|
||||
space = false,
|
||||
preferTruncationOnSpace = false,
|
||||
} = options;
|
||||
|
||||
let {truncationCharacter = '…'} = options;
|
||||
|
||||
if (typeof text !== 'string') {
|
||||
throw new TypeError(`Expected \`input\` to be a string, got ${typeof text}`);
|
||||
}
|
||||
|
||||
if (typeof columns !== 'number') {
|
||||
throw new TypeError(`Expected \`columns\` to be a number, got ${typeof columns}`);
|
||||
}
|
||||
|
||||
if (columns < 1) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (columns === 1) {
|
||||
return truncationCharacter;
|
||||
}
|
||||
|
||||
const length = stringWidth(text);
|
||||
|
||||
if (length <= columns) {
|
||||
return text;
|
||||
}
|
||||
|
||||
if (position === 'start') {
|
||||
if (preferTruncationOnSpace) {
|
||||
const nearestSpace = getIndexOfNearestSpace(text, length - columns + 1, true);
|
||||
return truncationCharacter + sliceAnsi(text, nearestSpace, length).trim();
|
||||
}
|
||||
|
||||
if (space === true) {
|
||||
truncationCharacter += ' ';
|
||||
}
|
||||
|
||||
return truncationCharacter + sliceAnsi(text, length - columns + stringWidth(truncationCharacter), length);
|
||||
}
|
||||
|
||||
if (position === 'middle') {
|
||||
if (space === true) {
|
||||
truncationCharacter = ` ${truncationCharacter} `;
|
||||
}
|
||||
|
||||
const half = Math.floor(columns / 2);
|
||||
|
||||
if (preferTruncationOnSpace) {
|
||||
const spaceNearFirstBreakPoint = getIndexOfNearestSpace(text, half);
|
||||
const spaceNearSecondBreakPoint = getIndexOfNearestSpace(text, length - (columns - half) + 1, true);
|
||||
return sliceAnsi(text, 0, spaceNearFirstBreakPoint) + truncationCharacter + sliceAnsi(text, spaceNearSecondBreakPoint, length).trim();
|
||||
}
|
||||
|
||||
return (
|
||||
sliceAnsi(text, 0, half)
|
||||
+ truncationCharacter
|
||||
+ sliceAnsi(text, length - (columns - half) + stringWidth(truncationCharacter), length)
|
||||
);
|
||||
}
|
||||
|
||||
if (position === 'end') {
|
||||
if (preferTruncationOnSpace) {
|
||||
const nearestSpace = getIndexOfNearestSpace(text, columns - 1);
|
||||
return sliceAnsi(text, 0, nearestSpace) + truncationCharacter;
|
||||
}
|
||||
|
||||
if (space === true) {
|
||||
truncationCharacter = ` ${truncationCharacter}`;
|
||||
}
|
||||
|
||||
return sliceAnsi(text, 0, columns - stringWidth(truncationCharacter)) + truncationCharacter;
|
||||
}
|
||||
|
||||
throw new Error(`Expected \`options.position\` to be either \`start\`, \`middle\` or \`end\`, got ${position}`);
|
||||
}
|
9
node_modules/cli-truncate/license
generated
vendored
Normal file
9
node_modules/cli-truncate/license
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
20
node_modules/cli-truncate/node_modules/emoji-regex/LICENSE-MIT.txt
generated
vendored
Normal file
20
node_modules/cli-truncate/node_modules/emoji-regex/LICENSE-MIT.txt
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
Copyright Mathias Bynens <https://mathiasbynens.be/>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
107
node_modules/cli-truncate/node_modules/emoji-regex/README.md
generated
vendored
Normal file
107
node_modules/cli-truncate/node_modules/emoji-regex/README.md
generated
vendored
Normal file
|
@ -0,0 +1,107 @@
|
|||
# emoji-regex [](https://github.com/mathiasbynens/emoji-regex/actions/workflows/main.yml) [](https://www.npmjs.com/package/emoji-regex)
|
||||
|
||||
_emoji-regex_ offers a regular expression to match all emoji symbols and sequences (including textual representations of emoji) as per the Unicode Standard. It’s based on [_emoji-test-regex-pattern_](https://github.com/mathiasbynens/emoji-test-regex-pattern), which generates (at build time) the regular expression pattern based on the Unicode Standard. As a result, _emoji-regex_ can easily be updated whenever new emoji are added to Unicode.
|
||||
|
||||
Since each version of _emoji-regex_ is tied to the latest Unicode version at the time of release, results are deterministic. This is important for use cases like image replacement, where you want to guarantee that an image asset is available for every possibly matched emoji. If you don’t need a deterministic regex, a lighter-weight, general emoji pattern is available via the [_emoji-regex-xs_](https://github.com/slevithan/emoji-regex-xs) package that follows the same API.
|
||||
|
||||
## Installation
|
||||
|
||||
Via [npm](https://www.npmjs.com/):
|
||||
|
||||
```bash
|
||||
npm install emoji-regex
|
||||
```
|
||||
|
||||
In [Node.js](https://nodejs.org/):
|
||||
|
||||
```js
|
||||
const emojiRegex = require('emoji-regex');
|
||||
// Note: because the regular expression has the global flag set, this module
|
||||
// exports a function that returns the regex rather than exporting the regular
|
||||
// expression itself, to make it impossible to (accidentally) mutate the
|
||||
// original regular expression.
|
||||
|
||||
const text = `
|
||||
\u{231A}: ⌚ default emoji presentation character (Emoji_Presentation)
|
||||
\u{2194}\u{FE0F}: ↔️ default text presentation character rendered as emoji
|
||||
\u{1F469}: 👩 emoji modifier base (Emoji_Modifier_Base)
|
||||
\u{1F469}\u{1F3FF}: 👩🏿 emoji modifier base followed by a modifier
|
||||
`;
|
||||
|
||||
const regex = emojiRegex();
|
||||
for (const match of text.matchAll(regex)) {
|
||||
const emoji = match[0];
|
||||
console.log(`Matched sequence ${ emoji } — code points: ${ [...emoji].length }`);
|
||||
}
|
||||
```
|
||||
|
||||
Console output:
|
||||
|
||||
```
|
||||
Matched sequence ⌚ — code points: 1
|
||||
Matched sequence ⌚ — code points: 1
|
||||
Matched sequence ↔️ — code points: 2
|
||||
Matched sequence ↔️ — code points: 2
|
||||
Matched sequence 👩 — code points: 1
|
||||
Matched sequence 👩 — code points: 1
|
||||
Matched sequence 👩🏿 — code points: 2
|
||||
Matched sequence 👩🏿 — code points: 2
|
||||
```
|
||||
|
||||
## For maintainers
|
||||
|
||||
### How to update emoji-regex after new Unicode Standard releases
|
||||
|
||||
1. [Update _emoji-test-regex-pattern_ as described in its repository](https://github.com/mathiasbynens/emoji-test-regex-pattern#how-to-update-emoji-test-regex-pattern-after-new-uts51-releases).
|
||||
|
||||
1. Bump the _emoji-test-regex-pattern_ dependency to the latest version.
|
||||
|
||||
1. Update the Unicode data dependency in `package.json` by running the following commands:
|
||||
|
||||
```sh
|
||||
# Example: updating from Unicode v13 to Unicode v14.
|
||||
npm uninstall @unicode/unicode-13.0.0
|
||||
npm install @unicode/unicode-14.0.0 --save-dev
|
||||
````
|
||||
|
||||
1. Generate the new output:
|
||||
|
||||
```sh
|
||||
npm run build
|
||||
```
|
||||
|
||||
1. Verify that tests still pass:
|
||||
|
||||
```sh
|
||||
npm test
|
||||
```
|
||||
|
||||
### How to publish a new release
|
||||
|
||||
1. On the `main` branch, bump the emoji-regex version number in `package.json`:
|
||||
|
||||
```sh
|
||||
npm version patch -m 'Release v%s'
|
||||
```
|
||||
|
||||
Instead of `patch`, use `minor` or `major` [as needed](https://semver.org/).
|
||||
|
||||
Note that this produces a Git commit + tag.
|
||||
|
||||
1. Push the release commit and tag:
|
||||
|
||||
```sh
|
||||
git push && git push --tags
|
||||
```
|
||||
|
||||
Our CI then automatically publishes the new release to npm.
|
||||
|
||||
## Author
|
||||
|
||||
| [](https://twitter.com/mathias "Follow @mathias on Twitter") |
|
||||
|---|
|
||||
| [Mathias Bynens](https://mathiasbynens.be/) |
|
||||
|
||||
## License
|
||||
|
||||
_emoji-regex_ is available under the [MIT](https://mths.be/mit) license.
|
3
node_modules/cli-truncate/node_modules/emoji-regex/index.d.ts
generated
vendored
Normal file
3
node_modules/cli-truncate/node_modules/emoji-regex/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
declare module 'emoji-regex' {
|
||||
export default function emojiRegex(): RegExp;
|
||||
}
|
4
node_modules/cli-truncate/node_modules/emoji-regex/index.js
generated
vendored
Normal file
4
node_modules/cli-truncate/node_modules/emoji-regex/index.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
4
node_modules/cli-truncate/node_modules/emoji-regex/index.mjs
generated
vendored
Normal file
4
node_modules/cli-truncate/node_modules/emoji-regex/index.mjs
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
45
node_modules/cli-truncate/node_modules/emoji-regex/package.json
generated
vendored
Normal file
45
node_modules/cli-truncate/node_modules/emoji-regex/package.json
generated
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
"name": "emoji-regex",
|
||||
"version": "10.4.0",
|
||||
"description": "A regular expression to match all Emoji-only symbols as per the Unicode Standard.",
|
||||
"homepage": "https://mths.be/emoji-regex",
|
||||
"main": "index.js",
|
||||
"module": "index.mjs",
|
||||
"types": "index.d.ts",
|
||||
"keywords": [
|
||||
"unicode",
|
||||
"regex",
|
||||
"regexp",
|
||||
"regular expressions",
|
||||
"code points",
|
||||
"symbols",
|
||||
"characters",
|
||||
"emoji"
|
||||
],
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"name": "Mathias Bynens",
|
||||
"url": "https://mathiasbynens.be/"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mathiasbynens/emoji-regex.git"
|
||||
},
|
||||
"bugs": "https://github.com/mathiasbynens/emoji-regex/issues",
|
||||
"files": [
|
||||
"LICENSE-MIT.txt",
|
||||
"index.js",
|
||||
"index.d.ts",
|
||||
"index.mjs"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "node script/build.js",
|
||||
"test": "mocha",
|
||||
"test:watch": "npm run test -- --watch"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@unicode/unicode-16.0.0": "^1.0.0",
|
||||
"emoji-test-regex-pattern": "^2.2.0",
|
||||
"mocha": "^10.7.3"
|
||||
}
|
||||
}
|
39
node_modules/cli-truncate/node_modules/string-width/index.d.ts
generated
vendored
Normal file
39
node_modules/cli-truncate/node_modules/string-width/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
export type Options = {
|
||||
/**
|
||||
Count [ambiguous width characters](https://www.unicode.org/reports/tr11/#Ambiguous) as having narrow width (count of 1) instead of wide width (count of 2).
|
||||
|
||||
@default true
|
||||
|
||||
> Ambiguous characters behave like wide or narrow characters depending on the context (language tag, script identification, associated font, source of data, or explicit markup; all can provide the context). __If the context cannot be established reliably, they should be treated as narrow characters by default.__
|
||||
> - http://www.unicode.org/reports/tr11/
|
||||
*/
|
||||
readonly ambiguousIsNarrow?: boolean;
|
||||
|
||||
/**
|
||||
Whether [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) should be counted.
|
||||
|
||||
@default false
|
||||
*/
|
||||
readonly countAnsiEscapeCodes?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
Get the visual width of a string - the number of columns required to display it.
|
||||
|
||||
Some Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and doesn't affect the width.
|
||||
|
||||
@example
|
||||
```
|
||||
import stringWidth from 'string-width';
|
||||
|
||||
stringWidth('a');
|
||||
//=> 1
|
||||
|
||||
stringWidth('古');
|
||||
//=> 2
|
||||
|
||||
stringWidth('\u001B[1m古\u001B[22m');
|
||||
//=> 2
|
||||
```
|
||||
*/
|
||||
export default function stringWidth(string: string, options?: Options): number;
|
82
node_modules/cli-truncate/node_modules/string-width/index.js
generated
vendored
Normal file
82
node_modules/cli-truncate/node_modules/string-width/index.js
generated
vendored
Normal file
|
@ -0,0 +1,82 @@
|
|||
import stripAnsi from 'strip-ansi';
|
||||
import {eastAsianWidth} from 'get-east-asian-width';
|
||||
import emojiRegex from 'emoji-regex';
|
||||
|
||||
const segmenter = new Intl.Segmenter();
|
||||
|
||||
const defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
|
||||
|
||||
export default function stringWidth(string, options = {}) {
|
||||
if (typeof string !== 'string' || string.length === 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const {
|
||||
ambiguousIsNarrow = true,
|
||||
countAnsiEscapeCodes = false,
|
||||
} = options;
|
||||
|
||||
if (!countAnsiEscapeCodes) {
|
||||
string = stripAnsi(string);
|
||||
}
|
||||
|
||||
if (string.length === 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
let width = 0;
|
||||
const eastAsianWidthOptions = {ambiguousAsWide: !ambiguousIsNarrow};
|
||||
|
||||
for (const {segment: character} of segmenter.segment(string)) {
|
||||
const codePoint = character.codePointAt(0);
|
||||
|
||||
// Ignore control characters
|
||||
if (codePoint <= 0x1F || (codePoint >= 0x7F && codePoint <= 0x9F)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Ignore zero-width characters
|
||||
if (
|
||||
(codePoint >= 0x20_0B && codePoint <= 0x20_0F) // Zero-width space, non-joiner, joiner, left-to-right mark, right-to-left mark
|
||||
|| codePoint === 0xFE_FF // Zero-width no-break space
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Ignore combining characters
|
||||
if (
|
||||
(codePoint >= 0x3_00 && codePoint <= 0x3_6F) // Combining diacritical marks
|
||||
|| (codePoint >= 0x1A_B0 && codePoint <= 0x1A_FF) // Combining diacritical marks extended
|
||||
|| (codePoint >= 0x1D_C0 && codePoint <= 0x1D_FF) // Combining diacritical marks supplement
|
||||
|| (codePoint >= 0x20_D0 && codePoint <= 0x20_FF) // Combining diacritical marks for symbols
|
||||
|| (codePoint >= 0xFE_20 && codePoint <= 0xFE_2F) // Combining half marks
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Ignore surrogate pairs
|
||||
if (codePoint >= 0xD8_00 && codePoint <= 0xDF_FF) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Ignore variation selectors
|
||||
if (codePoint >= 0xFE_00 && codePoint <= 0xFE_0F) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// This covers some of the above cases, but we still keep them for performance reasons.
|
||||
if (defaultIgnorableCodePointRegex.test(character)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// TODO: Use `/\p{RGI_Emoji}/v` when targeting Node.js 20.
|
||||
if (emojiRegex().test(character)) {
|
||||
width += 2;
|
||||
continue;
|
||||
}
|
||||
|
||||
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
||||
}
|
||||
|
||||
return width;
|
||||
}
|
9
node_modules/cli-truncate/node_modules/string-width/license
generated
vendored
Normal file
9
node_modules/cli-truncate/node_modules/string-width/license
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
64
node_modules/cli-truncate/node_modules/string-width/package.json
generated
vendored
Normal file
64
node_modules/cli-truncate/node_modules/string-width/package.json
generated
vendored
Normal file
|
@ -0,0 +1,64 @@
|
|||
{
|
||||
"name": "string-width",
|
||||
"version": "7.2.0",
|
||||
"description": "Get the visual width of a string - the number of columns required to display it",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/string-width",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": {
|
||||
"types": "./index.d.ts",
|
||||
"default": "./index.js"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"string",
|
||||
"character",
|
||||
"unicode",
|
||||
"width",
|
||||
"visual",
|
||||
"column",
|
||||
"columns",
|
||||
"fullwidth",
|
||||
"full-width",
|
||||
"full",
|
||||
"ansi",
|
||||
"escape",
|
||||
"codes",
|
||||
"cli",
|
||||
"command-line",
|
||||
"terminal",
|
||||
"console",
|
||||
"cjk",
|
||||
"chinese",
|
||||
"japanese",
|
||||
"korean",
|
||||
"fixed-width",
|
||||
"east-asian-width"
|
||||
],
|
||||
"dependencies": {
|
||||
"emoji-regex": "^10.3.0",
|
||||
"get-east-asian-width": "^1.0.0",
|
||||
"strip-ansi": "^7.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^5.3.1",
|
||||
"tsd": "^0.29.0",
|
||||
"xo": "^0.56.0"
|
||||
}
|
||||
}
|
66
node_modules/cli-truncate/node_modules/string-width/readme.md
generated
vendored
Normal file
66
node_modules/cli-truncate/node_modules/string-width/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,66 @@
|
|||
# string-width
|
||||
|
||||
> Get the visual width of a string - the number of columns required to display it
|
||||
|
||||
Some Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and doesn't affect the width.
|
||||
|
||||
Useful to be able to measure the actual width of command-line output.
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
npm install string-width
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import stringWidth from 'string-width';
|
||||
|
||||
stringWidth('a');
|
||||
//=> 1
|
||||
|
||||
stringWidth('古');
|
||||
//=> 2
|
||||
|
||||
stringWidth('\u001B[1m古\u001B[22m');
|
||||
//=> 2
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### stringWidth(string, options?)
|
||||
|
||||
#### string
|
||||
|
||||
Type: `string`
|
||||
|
||||
The string to be counted.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### ambiguousIsNarrow
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `true`
|
||||
|
||||
Count [ambiguous width characters](https://www.unicode.org/reports/tr11/#Ambiguous) as having narrow width (count of 1) instead of wide width (count of 2).
|
||||
|
||||
> Ambiguous characters behave like wide or narrow characters depending on the context (language tag, script identification, associated font, source of data, or explicit markup; all can provide the context). **If the context cannot be established reliably, they should be treated as narrow characters by default.**
|
||||
> - http://www.unicode.org/reports/tr11/
|
||||
|
||||
##### countAnsiEscapeCodes
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `false`
|
||||
|
||||
Whether [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) should be counted.
|
||||
|
||||
## Related
|
||||
|
||||
- [string-width-cli](https://github.com/sindresorhus/string-width-cli) - CLI for this module
|
||||
- [string-length](https://github.com/sindresorhus/string-length) - Get the real length of a string
|
||||
- [widest-line](https://github.com/sindresorhus/widest-line) - Get the visual width of the widest line in a string
|
||||
- [get-east-asian-width](https://github.com/sindresorhus/get-east-asian-width) - Determine the East Asian Width of a Unicode character
|
15
node_modules/cli-truncate/node_modules/strip-ansi/index.d.ts
generated
vendored
Normal file
15
node_modules/cli-truncate/node_modules/strip-ansi/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
/**
|
||||
Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string.
|
||||
|
||||
@example
|
||||
```
|
||||
import stripAnsi from 'strip-ansi';
|
||||
|
||||
stripAnsi('\u001B[4mUnicorn\u001B[0m');
|
||||
//=> 'Unicorn'
|
||||
|
||||
stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007');
|
||||
//=> 'Click'
|
||||
```
|
||||
*/
|
||||
export default function stripAnsi(string: string): string;
|
14
node_modules/cli-truncate/node_modules/strip-ansi/index.js
generated
vendored
Normal file
14
node_modules/cli-truncate/node_modules/strip-ansi/index.js
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
import ansiRegex from 'ansi-regex';
|
||||
|
||||
const regex = ansiRegex();
|
||||
|
||||
export default function stripAnsi(string) {
|
||||
if (typeof string !== 'string') {
|
||||
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
||||
}
|
||||
|
||||
// Even though the regex is global, we don't need to reset the `.lastIndex`
|
||||
// because unlike `.exec()` and `.test()`, `.replace()` does it automatically
|
||||
// and doing it manually has a performance penalty.
|
||||
return string.replace(regex, '');
|
||||
}
|
9
node_modules/cli-truncate/node_modules/strip-ansi/license
generated
vendored
Normal file
9
node_modules/cli-truncate/node_modules/strip-ansi/license
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
57
node_modules/cli-truncate/node_modules/strip-ansi/package.json
generated
vendored
Normal file
57
node_modules/cli-truncate/node_modules/strip-ansi/package.json
generated
vendored
Normal file
|
@ -0,0 +1,57 @@
|
|||
{
|
||||
"name": "strip-ansi",
|
||||
"version": "7.1.0",
|
||||
"description": "Strip ANSI escape codes from a string",
|
||||
"license": "MIT",
|
||||
"repository": "chalk/strip-ansi",
|
||||
"funding": "https://github.com/chalk/strip-ansi?sponsor=1",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": "./index.js",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"strip",
|
||||
"trim",
|
||||
"remove",
|
||||
"ansi",
|
||||
"styles",
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"string",
|
||||
"tty",
|
||||
"escape",
|
||||
"formatting",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"log",
|
||||
"logging",
|
||||
"command-line",
|
||||
"text"
|
||||
],
|
||||
"dependencies": {
|
||||
"ansi-regex": "^6.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^3.15.0",
|
||||
"tsd": "^0.17.0",
|
||||
"xo": "^0.44.0"
|
||||
}
|
||||
}
|
41
node_modules/cli-truncate/node_modules/strip-ansi/readme.md
generated
vendored
Normal file
41
node_modules/cli-truncate/node_modules/strip-ansi/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
# strip-ansi
|
||||
|
||||
> Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install strip-ansi
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import stripAnsi from 'strip-ansi';
|
||||
|
||||
stripAnsi('\u001B[4mUnicorn\u001B[0m');
|
||||
//=> 'Unicorn'
|
||||
|
||||
stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007');
|
||||
//=> 'Click'
|
||||
```
|
||||
|
||||
## strip-ansi for enterprise
|
||||
|
||||
Available as part of the Tidelift Subscription.
|
||||
|
||||
The maintainers of strip-ansi and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-strip-ansi?utm_source=npm-strip-ansi&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
|
||||
|
||||
## Related
|
||||
|
||||
- [strip-ansi-cli](https://github.com/chalk/strip-ansi-cli) - CLI for this module
|
||||
- [strip-ansi-stream](https://github.com/chalk/strip-ansi-stream) - Streaming version of this module
|
||||
- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes
|
||||
- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes
|
||||
- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right
|
||||
|
||||
## Maintainers
|
||||
|
||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||
- [Josh Junon](https://github.com/qix-)
|
||||
|
51
node_modules/cli-truncate/package.json
generated
vendored
Normal file
51
node_modules/cli-truncate/package.json
generated
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
"name": "cli-truncate",
|
||||
"version": "4.0.0",
|
||||
"description": "Truncate a string to a specific width in the terminal",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/cli-truncate",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": {
|
||||
"types": "./index.d.ts",
|
||||
"default": "./index.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"truncate",
|
||||
"ellipsis",
|
||||
"text",
|
||||
"limit",
|
||||
"slice",
|
||||
"cli",
|
||||
"terminal",
|
||||
"term",
|
||||
"shell",
|
||||
"width",
|
||||
"ansi",
|
||||
"string"
|
||||
],
|
||||
"dependencies": {
|
||||
"slice-ansi": "^5.0.0",
|
||||
"string-width": "^7.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^5.3.1",
|
||||
"tsd": "^0.29.0",
|
||||
"xo": "^0.56.0"
|
||||
}
|
||||
}
|
150
node_modules/cli-truncate/readme.md
generated
vendored
Normal file
150
node_modules/cli-truncate/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,150 @@
|
|||
# cli-truncate
|
||||
|
||||
> Truncate a string to a specific width in the terminal
|
||||
|
||||
Gracefully handles [ANSI escapes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles). Like a string styled with [`chalk`](https://github.com/chalk/chalk). It also supports Unicode surrogate pairs and fullwidth characters.
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
npm install cli-truncate
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import cliTruncate from 'cli-truncate';
|
||||
|
||||
cliTruncate('unicorn', 4);
|
||||
//=> 'uni…'
|
||||
|
||||
// Truncate at different positions
|
||||
cliTruncate('unicorn', 4, {position: 'start'});
|
||||
//=> '…orn'
|
||||
|
||||
cliTruncate('unicorn', 4, {position: 'middle'});
|
||||
//=> 'un…n'
|
||||
|
||||
cliTruncate('unicorns rainbow dragons', 6, {position: 'end'})
|
||||
//=> 'unico…'
|
||||
|
||||
cliTruncate('\u001B[31municorn\u001B[39m', 4);
|
||||
//=> '\u001B[31muni\u001B[39m…'
|
||||
|
||||
// Truncate Unicode surrogate pairs
|
||||
cliTruncate('uni\uD83C\uDE00corn', 5);
|
||||
//=> 'uni\uD83C\uDE00…'
|
||||
|
||||
// Truncate fullwidth characters
|
||||
cliTruncate('안녕하세요', 3);
|
||||
//=> '안…'
|
||||
|
||||
// Truncate the paragraph to the terminal width
|
||||
const paragraph = 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa.';
|
||||
cliTruncate(paragraph, process.stdout.columns);
|
||||
//=> 'Lorem ipsum dolor sit amet, consectetuer adipiscing…'
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### cliTruncate(text, columns, options?)
|
||||
|
||||
#### text
|
||||
|
||||
Type: `string`
|
||||
|
||||
The text to truncate.
|
||||
|
||||
#### columns
|
||||
|
||||
Type: `number`
|
||||
|
||||
The number of columns to occupy in the terminal.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### position
|
||||
|
||||
Type: `string`\
|
||||
Default: `'end'`\
|
||||
Values: `'start' | 'middle' | 'end'`
|
||||
|
||||
The position to truncate the string.
|
||||
|
||||
##### space
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `false`
|
||||
|
||||
Add a space between the text and the ellipsis.
|
||||
|
||||
```js
|
||||
import cliTruncate from 'cli-truncate';
|
||||
|
||||
cliTruncate('unicorns', 5, {space: false});
|
||||
//=> 'unic…'
|
||||
|
||||
cliTruncate('unicorns', 5, {space: true});
|
||||
//=> 'uni …'
|
||||
|
||||
cliTruncate('unicorns', 6, {position: 'start', space: true});
|
||||
//=> '… orns'
|
||||
|
||||
cliTruncate('unicorns', 7, {position: 'middle', space: true});
|
||||
//=> 'uni … s'
|
||||
```
|
||||
|
||||
##### preferTruncationOnSpace
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `false`
|
||||
|
||||
Truncate the string from a whitespace if it is within 3 characters from the actual breaking point.
|
||||
|
||||
```js
|
||||
import cliTruncate from 'cli-truncate';
|
||||
|
||||
cliTruncate('unicorns rainbow dragons', 20, {position: 'start', preferTruncationOnSpace: true})
|
||||
//=> '…rainbow dragons'
|
||||
|
||||
// without preferTruncationOnSpace
|
||||
cliTruncate('unicorns rainbow dragons', 20, {position: 'start'})
|
||||
//=> '…rns rainbow dragons'
|
||||
|
||||
cliTruncate('unicorns rainbow dragons', 20, {position: 'middle', preferTruncationOnSpace: true})
|
||||
//=> 'unicorns…dragons'
|
||||
|
||||
cliTruncate('unicorns rainbow dragons', 6, {position: 'end', preferTruncationOnSpace: true})
|
||||
//=> 'unico…'
|
||||
|
||||
// preferTruncationOnSpace would have no effect if space isn't found within next 3 indexes
|
||||
cliTruncate('unicorns rainbow dragons', 6, {position: 'middle', preferTruncationOnSpace: true})
|
||||
//=> 'uni…ns'
|
||||
```
|
||||
|
||||
##### truncationCharacter
|
||||
|
||||
Type: `string`\
|
||||
Default: `…`
|
||||
|
||||
The character to use at the breaking point.
|
||||
|
||||
```js
|
||||
import cliTruncate from 'cli-truncate';
|
||||
|
||||
cliTruncate('unicorns', 5, {position: 'end'});
|
||||
//=> 'unic…'
|
||||
|
||||
cliTruncate('unicorns', 5, {position: 'end', truncationCharacter: '.'});
|
||||
//=> 'unic.'
|
||||
|
||||
cliTruncate('unicorns', 5, {position: 'end', truncationCharacter: ''});
|
||||
//=> 'unico'
|
||||
```
|
||||
|
||||
## Related
|
||||
|
||||
- [wrap-ansi](https://github.com/chalk/wrap-ansi) - Wordwrap a string with ANSI escape codes
|
||||
- [slice-ansi](https://github.com/chalk/slice-ansi) - Slice a string with ANSI escape codes
|
Loading…
Add table
Add a link
Reference in a new issue