mirror of
https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools.git
synced 2026-02-04 14:00:49 +00:00
nhj
more
This commit is contained in:
99
unified-ai-platform/node_modules/cli-truncate/index.js
generated
vendored
Normal file
99
unified-ai-platform/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
unified-ai-platform/node_modules/cli-truncate/license
generated
vendored
Normal file
9
unified-ai-platform/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.
|
||||
10
unified-ai-platform/node_modules/cli-truncate/node_modules/ansi-regex/index.js
generated
vendored
Normal file
10
unified-ai-platform/node_modules/cli-truncate/node_modules/ansi-regex/index.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
export default function ansiRegex({onlyFirst = false} = {}) {
|
||||
// Valid string terminator sequences are BEL, ESC\, and 0x9c
|
||||
const ST = '(?:\\u0007|\\u001B\\u005C|\\u009C)';
|
||||
const pattern = [
|
||||
`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`,
|
||||
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))',
|
||||
].join('|');
|
||||
|
||||
return new RegExp(pattern, onlyFirst ? undefined : 'g');
|
||||
}
|
||||
9
unified-ai-platform/node_modules/cli-truncate/node_modules/ansi-regex/license
generated
vendored
Normal file
9
unified-ai-platform/node_modules/cli-truncate/node_modules/ansi-regex/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.
|
||||
61
unified-ai-platform/node_modules/cli-truncate/node_modules/ansi-regex/package.json
generated
vendored
Normal file
61
unified-ai-platform/node_modules/cli-truncate/node_modules/ansi-regex/package.json
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"name": "ansi-regex",
|
||||
"version": "6.1.0",
|
||||
"description": "Regular expression for matching ANSI escape codes",
|
||||
"license": "MIT",
|
||||
"repository": "chalk/ansi-regex",
|
||||
"funding": "https://github.com/chalk/ansi-regex?sponsor=1",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": "./index.js",
|
||||
"types": "./index.d.ts",
|
||||
"sideEffects": false,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd",
|
||||
"view-supported": "node fixtures/view-codes.js"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"ansi",
|
||||
"styles",
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"string",
|
||||
"tty",
|
||||
"escape",
|
||||
"formatting",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"command-line",
|
||||
"text",
|
||||
"regex",
|
||||
"regexp",
|
||||
"re",
|
||||
"match",
|
||||
"test",
|
||||
"find",
|
||||
"pattern"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ansi-escapes": "^5.0.0",
|
||||
"ava": "^3.15.0",
|
||||
"tsd": "^0.21.0",
|
||||
"xo": "^0.54.2"
|
||||
}
|
||||
}
|
||||
60
unified-ai-platform/node_modules/cli-truncate/node_modules/ansi-regex/readme.md
generated
vendored
Normal file
60
unified-ai-platform/node_modules/cli-truncate/node_modules/ansi-regex/readme.md
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
# ansi-regex
|
||||
|
||||
> Regular expression for matching [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code)
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
npm install ansi-regex
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
import ansiRegex from 'ansi-regex';
|
||||
|
||||
ansiRegex().test('\u001B[4mcake\u001B[0m');
|
||||
//=> true
|
||||
|
||||
ansiRegex().test('cake');
|
||||
//=> false
|
||||
|
||||
'\u001B[4mcake\u001B[0m'.match(ansiRegex());
|
||||
//=> ['\u001B[4m', '\u001B[0m']
|
||||
|
||||
'\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true}));
|
||||
//=> ['\u001B[4m']
|
||||
|
||||
'\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex());
|
||||
//=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007']
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### ansiRegex(options?)
|
||||
|
||||
Returns a regex for matching ANSI escape codes.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### onlyFirst
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `false` *(Matches any ANSI escape codes in a string)*
|
||||
|
||||
Match only the first ANSI escape.
|
||||
|
||||
## FAQ
|
||||
|
||||
### Why do you test for codes not in the ECMA 48 standard?
|
||||
|
||||
Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. We test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them.
|
||||
|
||||
On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out.
|
||||
|
||||
## Maintainers
|
||||
|
||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||
- [Josh Junon](https://github.com/qix-)
|
||||
107
unified-ai-platform/node_modules/cli-truncate/node_modules/emoji-regex/README.md
generated
vendored
Normal file
107
unified-ai-platform/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.
|
||||
4
unified-ai-platform/node_modules/cli-truncate/node_modules/emoji-regex/index.js
generated
vendored
Normal file
4
unified-ai-platform/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
3
unified-ai-platform/node_modules/cli-truncate/node_modules/emoji-regex/index.mjs
generated
vendored
Normal file
3
unified-ai-platform/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
unified-ai-platform/node_modules/cli-truncate/node_modules/emoji-regex/package.json
generated
vendored
Normal file
45
unified-ai-platform/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"
|
||||
}
|
||||
}
|
||||
82
unified-ai-platform/node_modules/cli-truncate/node_modules/string-width/index.js
generated
vendored
Normal file
82
unified-ai-platform/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
unified-ai-platform/node_modules/cli-truncate/node_modules/string-width/license
generated
vendored
Normal file
9
unified-ai-platform/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
unified-ai-platform/node_modules/cli-truncate/node_modules/string-width/package.json
generated
vendored
Normal file
64
unified-ai-platform/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
unified-ai-platform/node_modules/cli-truncate/node_modules/string-width/readme.md
generated
vendored
Normal file
66
unified-ai-platform/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
|
||||
14
unified-ai-platform/node_modules/cli-truncate/node_modules/strip-ansi/index.js
generated
vendored
Normal file
14
unified-ai-platform/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
unified-ai-platform/node_modules/cli-truncate/node_modules/strip-ansi/license
generated
vendored
Normal file
9
unified-ai-platform/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
unified-ai-platform/node_modules/cli-truncate/node_modules/strip-ansi/package.json
generated
vendored
Normal file
57
unified-ai-platform/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
unified-ai-platform/node_modules/cli-truncate/node_modules/strip-ansi/readme.md
generated
vendored
Normal file
41
unified-ai-platform/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
unified-ai-platform/node_modules/cli-truncate/package.json
generated
vendored
Normal file
51
unified-ai-platform/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
unified-ai-platform/node_modules/cli-truncate/readme.md
generated
vendored
Normal file
150
unified-ai-platform/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
|
||||
Reference in New Issue
Block a user