Initial commit: New MoreminiMore website with fresh design
This commit is contained in:
23
node_modules/fast-wrap-ansi/LICENSE
generated
vendored
Normal file
23
node_modules/fast-wrap-ansi/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2025 James Garbutt
|
||||
|
||||
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.
|
||||
26
node_modules/fast-wrap-ansi/README.md
generated
vendored
Normal file
26
node_modules/fast-wrap-ansi/README.md
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
# fast-wrap-ansi
|
||||
|
||||
Wordwrap a string, taking ANSI escape codes into account.
|
||||
|
||||
A fast, light fork of the `wrap-ansi` package.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
npm i -S fast-wrap-ansi
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```ts
|
||||
import {wrapAnsi} from 'fast-wrap-ansi';
|
||||
|
||||
const str = 'This is a string with some \x1b[31mANSI\x1b[39m codes.';
|
||||
const wrapped = wrapAnsi(str, 20);
|
||||
console.log(wrapped);
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
6
node_modules/fast-wrap-ansi/lib/main.d.ts
generated
vendored
Normal file
6
node_modules/fast-wrap-ansi/lib/main.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export interface Options {
|
||||
trim?: boolean;
|
||||
wordWrap?: boolean;
|
||||
hard?: boolean;
|
||||
}
|
||||
export declare function wrapAnsi(string: string, columns: number, options?: Options): string;
|
||||
216
node_modules/fast-wrap-ansi/lib/main.js
generated
vendored
Normal file
216
node_modules/fast-wrap-ansi/lib/main.js
generated
vendored
Normal file
@@ -0,0 +1,216 @@
|
||||
import stringWidth from 'fast-string-width';
|
||||
const ESC = '\x1B';
|
||||
const CSI = '\x9B';
|
||||
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 GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, 'y');
|
||||
const getClosingCode = (openingCode) => {
|
||||
if (openingCode >= 30 && openingCode <= 37)
|
||||
return 39;
|
||||
if (openingCode >= 90 && openingCode <= 97)
|
||||
return 39;
|
||||
if (openingCode >= 40 && openingCode <= 47)
|
||||
return 49;
|
||||
if (openingCode >= 100 && openingCode <= 107)
|
||||
return 49;
|
||||
if (openingCode === 1 || openingCode === 2)
|
||||
return 22;
|
||||
if (openingCode === 3)
|
||||
return 23;
|
||||
if (openingCode === 4)
|
||||
return 24;
|
||||
if (openingCode === 7)
|
||||
return 27;
|
||||
if (openingCode === 8)
|
||||
return 28;
|
||||
if (openingCode === 9)
|
||||
return 29;
|
||||
if (openingCode === 0)
|
||||
return 0;
|
||||
return undefined;
|
||||
};
|
||||
const wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
||||
const wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
|
||||
const wrapWord = (rows, word, columns) => {
|
||||
const characters = word[Symbol.iterator]();
|
||||
let isInsideEscape = false;
|
||||
let isInsideLinkEscape = false;
|
||||
let lastRow = rows.at(-1);
|
||||
let visible = lastRow === undefined ? 0 : stringWidth(lastRow);
|
||||
let currentCharacter = characters.next();
|
||||
let nextCharacter = characters.next();
|
||||
let rawCharacterIndex = 0;
|
||||
while (!currentCharacter.done) {
|
||||
const character = currentCharacter.value;
|
||||
const characterLength = stringWidth(character);
|
||||
if (visible + characterLength <= columns) {
|
||||
rows[rows.length - 1] += character;
|
||||
}
|
||||
else {
|
||||
rows.push(character);
|
||||
visible = 0;
|
||||
}
|
||||
if (character === ESC || character === CSI) {
|
||||
isInsideEscape = true;
|
||||
isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
|
||||
}
|
||||
if (isInsideEscape) {
|
||||
if (isInsideLinkEscape) {
|
||||
if (character === ANSI_ESCAPE_BELL) {
|
||||
isInsideEscape = false;
|
||||
isInsideLinkEscape = false;
|
||||
}
|
||||
}
|
||||
else if (character === ANSI_SGR_TERMINATOR) {
|
||||
isInsideEscape = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
visible += characterLength;
|
||||
if (visible === columns && !nextCharacter.done) {
|
||||
rows.push('');
|
||||
visible = 0;
|
||||
}
|
||||
}
|
||||
currentCharacter = nextCharacter;
|
||||
nextCharacter = characters.next();
|
||||
rawCharacterIndex += character.length;
|
||||
}
|
||||
lastRow = rows.at(-1);
|
||||
if (!visible && lastRow !== undefined && lastRow.length && rows.length > 1) {
|
||||
rows[rows.length - 2] += rows.pop();
|
||||
}
|
||||
};
|
||||
const stringVisibleTrimSpacesRight = (string) => {
|
||||
const words = string.split(' ');
|
||||
let last = words.length;
|
||||
while (last) {
|
||||
if (stringWidth(words[last - 1])) {
|
||||
break;
|
||||
}
|
||||
last--;
|
||||
}
|
||||
if (last === words.length) {
|
||||
return string;
|
||||
}
|
||||
return words.slice(0, last).join(' ') + words.slice(last).join('');
|
||||
};
|
||||
const exec = (string, columns, options = {}) => {
|
||||
if (options.trim !== false && string.trim() === '') {
|
||||
return '';
|
||||
}
|
||||
let returnValue = '';
|
||||
let escapeCode;
|
||||
let escapeUrl;
|
||||
const words = string.split(' ');
|
||||
let rows = [''];
|
||||
let rowLength = 0;
|
||||
for (let index = 0; index < words.length; index++) {
|
||||
const word = words[index];
|
||||
if (options.trim !== false) {
|
||||
const row = rows.at(-1) ?? '';
|
||||
const trimmed = row.trimStart();
|
||||
if (row.length !== trimmed.length) {
|
||||
rows[rows.length - 1] = trimmed;
|
||||
rowLength = stringWidth(trimmed);
|
||||
}
|
||||
}
|
||||
if (index !== 0) {
|
||||
if (rowLength >= columns &&
|
||||
(options.wordWrap === false || options.trim === false)) {
|
||||
rows.push('');
|
||||
rowLength = 0;
|
||||
}
|
||||
if (rowLength || options.trim === false) {
|
||||
rows[rows.length - 1] += ' ';
|
||||
rowLength++;
|
||||
}
|
||||
}
|
||||
const wordLength = stringWidth(word);
|
||||
if (options.hard && wordLength > columns) {
|
||||
const remainingColumns = columns - rowLength;
|
||||
const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
|
||||
const breaksStartingNextLine = Math.floor((wordLength - 1) / columns);
|
||||
if (breaksStartingNextLine < breaksStartingThisLine) {
|
||||
rows.push('');
|
||||
}
|
||||
wrapWord(rows, word, columns);
|
||||
rowLength = stringWidth(rows.at(-1) ?? '');
|
||||
continue;
|
||||
}
|
||||
if (rowLength + wordLength > columns && rowLength && wordLength) {
|
||||
if (options.wordWrap === false && rowLength < columns) {
|
||||
wrapWord(rows, word, columns);
|
||||
rowLength = stringWidth(rows.at(-1) ?? '');
|
||||
continue;
|
||||
}
|
||||
rows.push('');
|
||||
rowLength = 0;
|
||||
}
|
||||
if (rowLength + wordLength > columns && options.wordWrap === false) {
|
||||
wrapWord(rows, word, columns);
|
||||
rowLength = stringWidth(rows.at(-1) ?? '');
|
||||
continue;
|
||||
}
|
||||
rows[rows.length - 1] += word;
|
||||
rowLength += wordLength;
|
||||
}
|
||||
if (options.trim !== false) {
|
||||
rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
|
||||
}
|
||||
const preString = rows.join('\n');
|
||||
let inSurrogate = false;
|
||||
for (let i = 0; i < preString.length; i++) {
|
||||
const character = preString[i];
|
||||
returnValue += character;
|
||||
if (!inSurrogate) {
|
||||
inSurrogate = character >= '\ud800' && character <= '\udbff';
|
||||
}
|
||||
else {
|
||||
continue;
|
||||
}
|
||||
if (character === ESC || character === CSI) {
|
||||
GROUP_REGEX.lastIndex = i + 1;
|
||||
const groupsResult = GROUP_REGEX.exec(preString);
|
||||
const groups = groupsResult?.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;
|
||||
}
|
||||
}
|
||||
if (preString[i + 1] === '\n') {
|
||||
if (escapeUrl) {
|
||||
returnValue += wrapAnsiHyperlink('');
|
||||
}
|
||||
const closingCode = escapeCode ? getClosingCode(escapeCode) : undefined;
|
||||
if (escapeCode && closingCode) {
|
||||
returnValue += wrapAnsiCode(closingCode);
|
||||
}
|
||||
}
|
||||
else if (character === '\n') {
|
||||
if (escapeCode && getClosingCode(escapeCode)) {
|
||||
returnValue += wrapAnsiCode(escapeCode);
|
||||
}
|
||||
if (escapeUrl) {
|
||||
returnValue += wrapAnsiHyperlink(escapeUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
return returnValue;
|
||||
};
|
||||
const CRLF_OR_LF = /\r?\n/;
|
||||
export function wrapAnsi(string, columns, options) {
|
||||
return String(string)
|
||||
.normalize()
|
||||
.split(CRLF_OR_LF)
|
||||
.map((line) => exec(line, columns, options))
|
||||
.join('\n');
|
||||
}
|
||||
//# sourceMappingURL=main.js.map
|
||||
1
node_modules/fast-wrap-ansi/lib/main.js.map
generated
vendored
Normal file
1
node_modules/fast-wrap-ansi/lib/main.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
51
node_modules/fast-wrap-ansi/package.json
generated
vendored
Normal file
51
node_modules/fast-wrap-ansi/package.json
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"name": "fast-wrap-ansi",
|
||||
"version": "0.1.6",
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"description": "A tiny and fast text wrap library which takes ANSI escapes into account.",
|
||||
"keywords": [
|
||||
"wrap",
|
||||
"ansi",
|
||||
"term",
|
||||
"colors"
|
||||
],
|
||||
"homepage": "https://github.com/43081j/fast-wrap-ansi#readme",
|
||||
"bugs": {
|
||||
"url": "https://github.com/43081j/fast-wrap-ansi/issues"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/43081j/fast-wrap-ansi.git"
|
||||
},
|
||||
"license": "MIT",
|
||||
"author": "James Garbutt (https://github.com/43081j)",
|
||||
"type": "module",
|
||||
"main": "lib/main.js",
|
||||
"scripts": {
|
||||
"format": "prettier --write src test",
|
||||
"lint": "npm run lint:js && npm run lint:format && npm run lint:types",
|
||||
"lint:js": "eslint src test",
|
||||
"lint:format": "prettier --check src test",
|
||||
"lint:types": "npx tsc --noEmit -p tsconfig.test.json",
|
||||
"build": "tsc",
|
||||
"test": "vitest run"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.32.0",
|
||||
"@types/node": "^24.2.0",
|
||||
"eslint": "^9.32.0",
|
||||
"fast-wrap-ansi-prod": "npm:fast-wrap-ansi@*",
|
||||
"picocolors": "^1.1.1",
|
||||
"prettier": "^3.6.2",
|
||||
"tinybench": "^5.0.1",
|
||||
"typescript": "^5.8.3",
|
||||
"typescript-eslint": "^8.38.0",
|
||||
"vitest": "^3.2.4",
|
||||
"wrap-ansi": "^9.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"fast-string-width": "^1.1.0"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user