mirror of
https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools.git
synced 2026-02-03 21:40:53 +00:00
nhj
more
This commit is contained in:
21
unified-ai-platform/node_modules/picomatch/LICENSE
generated
vendored
Normal file
21
unified-ai-platform/node_modules/picomatch/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017-present, Jon Schlinkert.
|
||||
|
||||
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.
|
||||
3
unified-ai-platform/node_modules/picomatch/index.js
generated
vendored
Normal file
3
unified-ai-platform/node_modules/picomatch/index.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./lib/picomatch');
|
||||
179
unified-ai-platform/node_modules/picomatch/lib/constants.js
generated
vendored
Normal file
179
unified-ai-platform/node_modules/picomatch/lib/constants.js
generated
vendored
Normal file
@@ -0,0 +1,179 @@
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const WIN_SLASH = '\\\\/';
|
||||
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
||||
|
||||
/**
|
||||
* Posix glob regex
|
||||
*/
|
||||
|
||||
const DOT_LITERAL = '\\.';
|
||||
const PLUS_LITERAL = '\\+';
|
||||
const QMARK_LITERAL = '\\?';
|
||||
const SLASH_LITERAL = '\\/';
|
||||
const ONE_CHAR = '(?=.)';
|
||||
const QMARK = '[^/]';
|
||||
const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
|
||||
const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
|
||||
const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
|
||||
const NO_DOT = `(?!${DOT_LITERAL})`;
|
||||
const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
|
||||
const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
|
||||
const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
|
||||
const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
|
||||
const STAR = `${QMARK}*?`;
|
||||
|
||||
const POSIX_CHARS = {
|
||||
DOT_LITERAL,
|
||||
PLUS_LITERAL,
|
||||
QMARK_LITERAL,
|
||||
SLASH_LITERAL,
|
||||
ONE_CHAR,
|
||||
QMARK,
|
||||
END_ANCHOR,
|
||||
DOTS_SLASH,
|
||||
NO_DOT,
|
||||
NO_DOTS,
|
||||
NO_DOT_SLASH,
|
||||
NO_DOTS_SLASH,
|
||||
QMARK_NO_DOT,
|
||||
STAR,
|
||||
START_ANCHOR
|
||||
};
|
||||
|
||||
/**
|
||||
* Windows glob regex
|
||||
*/
|
||||
|
||||
const WINDOWS_CHARS = {
|
||||
...POSIX_CHARS,
|
||||
|
||||
SLASH_LITERAL: `[${WIN_SLASH}]`,
|
||||
QMARK: WIN_NO_SLASH,
|
||||
STAR: `${WIN_NO_SLASH}*?`,
|
||||
DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
|
||||
NO_DOT: `(?!${DOT_LITERAL})`,
|
||||
NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
||||
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
|
||||
NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
||||
QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
|
||||
START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
|
||||
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
|
||||
};
|
||||
|
||||
/**
|
||||
* POSIX Bracket Regex
|
||||
*/
|
||||
|
||||
const POSIX_REGEX_SOURCE = {
|
||||
alnum: 'a-zA-Z0-9',
|
||||
alpha: 'a-zA-Z',
|
||||
ascii: '\\x00-\\x7F',
|
||||
blank: ' \\t',
|
||||
cntrl: '\\x00-\\x1F\\x7F',
|
||||
digit: '0-9',
|
||||
graph: '\\x21-\\x7E',
|
||||
lower: 'a-z',
|
||||
print: '\\x20-\\x7E ',
|
||||
punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
|
||||
space: ' \\t\\r\\n\\v\\f',
|
||||
upper: 'A-Z',
|
||||
word: 'A-Za-z0-9_',
|
||||
xdigit: 'A-Fa-f0-9'
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
MAX_LENGTH: 1024 * 64,
|
||||
POSIX_REGEX_SOURCE,
|
||||
|
||||
// regular expressions
|
||||
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
||||
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
||||
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
||||
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
||||
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
||||
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
||||
|
||||
// Replace globs with equivalent patterns to reduce parsing time.
|
||||
REPLACEMENTS: {
|
||||
'***': '*',
|
||||
'**/**': '**',
|
||||
'**/**/**': '**'
|
||||
},
|
||||
|
||||
// Digits
|
||||
CHAR_0: 48, /* 0 */
|
||||
CHAR_9: 57, /* 9 */
|
||||
|
||||
// Alphabet chars.
|
||||
CHAR_UPPERCASE_A: 65, /* A */
|
||||
CHAR_LOWERCASE_A: 97, /* a */
|
||||
CHAR_UPPERCASE_Z: 90, /* Z */
|
||||
CHAR_LOWERCASE_Z: 122, /* z */
|
||||
|
||||
CHAR_LEFT_PARENTHESES: 40, /* ( */
|
||||
CHAR_RIGHT_PARENTHESES: 41, /* ) */
|
||||
|
||||
CHAR_ASTERISK: 42, /* * */
|
||||
|
||||
// Non-alphabetic chars.
|
||||
CHAR_AMPERSAND: 38, /* & */
|
||||
CHAR_AT: 64, /* @ */
|
||||
CHAR_BACKWARD_SLASH: 92, /* \ */
|
||||
CHAR_CARRIAGE_RETURN: 13, /* \r */
|
||||
CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */
|
||||
CHAR_COLON: 58, /* : */
|
||||
CHAR_COMMA: 44, /* , */
|
||||
CHAR_DOT: 46, /* . */
|
||||
CHAR_DOUBLE_QUOTE: 34, /* " */
|
||||
CHAR_EQUAL: 61, /* = */
|
||||
CHAR_EXCLAMATION_MARK: 33, /* ! */
|
||||
CHAR_FORM_FEED: 12, /* \f */
|
||||
CHAR_FORWARD_SLASH: 47, /* / */
|
||||
CHAR_GRAVE_ACCENT: 96, /* ` */
|
||||
CHAR_HASH: 35, /* # */
|
||||
CHAR_HYPHEN_MINUS: 45, /* - */
|
||||
CHAR_LEFT_ANGLE_BRACKET: 60, /* < */
|
||||
CHAR_LEFT_CURLY_BRACE: 123, /* { */
|
||||
CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */
|
||||
CHAR_LINE_FEED: 10, /* \n */
|
||||
CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */
|
||||
CHAR_PERCENT: 37, /* % */
|
||||
CHAR_PLUS: 43, /* + */
|
||||
CHAR_QUESTION_MARK: 63, /* ? */
|
||||
CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */
|
||||
CHAR_RIGHT_CURLY_BRACE: 125, /* } */
|
||||
CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */
|
||||
CHAR_SEMICOLON: 59, /* ; */
|
||||
CHAR_SINGLE_QUOTE: 39, /* ' */
|
||||
CHAR_SPACE: 32, /* */
|
||||
CHAR_TAB: 9, /* \t */
|
||||
CHAR_UNDERSCORE: 95, /* _ */
|
||||
CHAR_VERTICAL_LINE: 124, /* | */
|
||||
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */
|
||||
|
||||
SEP: path.sep,
|
||||
|
||||
/**
|
||||
* Create EXTGLOB_CHARS
|
||||
*/
|
||||
|
||||
extglobChars(chars) {
|
||||
return {
|
||||
'!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` },
|
||||
'?': { type: 'qmark', open: '(?:', close: ')?' },
|
||||
'+': { type: 'plus', open: '(?:', close: ')+' },
|
||||
'*': { type: 'star', open: '(?:', close: ')*' },
|
||||
'@': { type: 'at', open: '(?:', close: ')' }
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Create GLOB_CHARS
|
||||
*/
|
||||
|
||||
globChars(win32) {
|
||||
return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
|
||||
}
|
||||
};
|
||||
308
unified-ai-platform/node_modules/picomatch/lib/parse.js
generated
vendored
Normal file
308
unified-ai-platform/node_modules/picomatch/lib/parse.js
generated
vendored
Normal file
@@ -0,0 +1,308 @@
|
||||
'use strict';
|
||||
|
||||
const constants = require('./constants');
|
||||
const utils = require('./utils');
|
||||
|
||||
/**
|
||||
* Constants
|
||||
*/
|
||||
|
||||
const {
|
||||
MAX_LENGTH,
|
||||
POSIX_REGEX_SOURCE,
|
||||
REGEX_NON_SPECIAL_CHARS,
|
||||
REGEX_SPECIAL_CHARS_BACKREF,
|
||||
REPLACEMENTS
|
||||
} = constants;
|
||||
|
||||
/**
|
||||
* Helpers
|
||||
*/
|
||||
|
||||
const expandRange = (args, options) => {
|
||||
if (typeof options.expandRange === 'function') {
|
||||
return options.expandRange(...args, options);
|
||||
}
|
||||
|
||||
args.sort();
|
||||
const value = `[${args.join('-')}]`;
|
||||
|
||||
try {
|
||||
/* eslint-disable-next-line no-new */
|
||||
new RegExp(value);
|
||||
} catch (ex) {
|
||||
return args.map(v => utils.escapeRegex(v)).join('..');
|
||||
}
|
||||
|
||||
return value;
|
||||
};
|
||||
|
||||
/**
|
||||
* Create the message for a syntax error
|
||||
*/
|
||||
|
||||
const syntaxError = (type, char) => {
|
||||
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse the given input string.
|
||||
* @param {String} input
|
||||
* @param {Object} options
|
||||
* @return {Object}
|
||||
*/
|
||||
|
||||
const parse = (input, options) => {
|
||||
if (typeof input !== 'string') {
|
||||
throw new TypeError('Expected a string');
|
||||
}
|
||||
|
||||
input = REPLACEMENTS[input] || input;
|
||||
|
||||
const opts = { ...options };
|
||||
const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
||||
|
||||
let len = input.length;
|
||||
if (len > max) {
|
||||
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
||||
}
|
||||
|
||||
const bos = { type: 'bos', value: '', output: opts.prepend || '' };
|
||||
const tokens = [bos];
|
||||
|
||||
const capture = opts.capture ? '' : '?:';
|
||||
const win32 = utils.isWindows(options);
|
||||
|
||||
// create constants based on platform, for windows or posix
|
||||
const PLATFORM_CHARS = constants.globChars(win32);
|
||||
const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
|
||||
|
||||
const {
|
||||
DOT_LITERAL,
|
||||
PLUS_LITERAL,
|
||||
SLASH_LITERAL,
|
||||
ONE_CHAR,
|
||||
DOTS_SLASH,
|
||||
NO_DOT,
|
||||
NO_DOT_SLASH,
|
||||
NO_DOTS_SLASH,
|
||||
QMARK,
|
||||
QMARK_NO_DOT,
|
||||
STAR,
|
||||
START_ANCHOR
|
||||
} = PLATFORM_CHARS;
|
||||
|
||||
const globstar = opts => {
|
||||
return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
||||
};
|
||||
|
||||
const nodot = opts.dot ? '' : NO_DOT;
|
||||
const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
|
||||
let star = opts.bash === true ? globstar(opts) : STAR;
|
||||
|
||||
if (opts.capture) {
|
||||
star = `(${star})`;
|
||||
}
|
||||
|
||||
// minimatch options support
|
||||
if (typeof opts.noext === 'boolean') {
|
||||
opts.noextglob = opts.noext;
|
||||
}
|
||||
|
||||
const state = {
|
||||
input,
|
||||
index: -1,
|
||||
start: 0,
|
||||
dot: opts.dot === true,
|
||||
consumed: '',
|
||||
output: '',
|
||||
prefix: '',
|
||||
backtrack: false,
|
||||
negated: false,
|
||||
brackets: 0,
|
||||
braces: 0,
|
||||
parens: 0,
|
||||
quotes: 0,
|
||||
globstar: false,
|
||||
tokens
|
||||
};
|
||||
|
||||
input = utils.removePrefix(input, state);
|
||||
len = input.length;
|
||||
|
||||
const extglobs = [];
|
||||
const braces = [];
|
||||
const stack = [];
|
||||
let prev = bos;
|
||||
let value;
|
||||
|
||||
/**
|
||||
* Tokenizing helpers
|
||||
*/
|
||||
|
||||
const eos = () => state.index === len - 1;
|
||||
const peek = state.peek = (n = 1) => input[state.index + n];
|
||||
const advance = state.advance = () => input[++state.index] || '';
|
||||
const remaining = () => input.slice(state.index + 1);
|
||||
const consume = (value = '', num = 0) => {
|
||||
state.consumed += value;
|
||||
state.index += num;
|
||||
};
|
||||
|
||||
const append = token => {
|
||||
state.output += token.output != null ? token.output : token.value;
|
||||
consume(token.value);
|
||||
};
|
||||
|
||||
const negate = () => {
|
||||
let count = 1;
|
||||
|
||||
while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) {
|
||||
advance();
|
||||
state.start++;
|
||||
count++;
|
||||
}
|
||||
|
||||
if (count % 2 === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
state.negated = true;
|
||||
state.start++;
|
||||
return true;
|
||||
};
|
||||
|
||||
const increment = type => {
|
||||
state[type]++;
|
||||
stack.push(type);
|
||||
};
|
||||
|
||||
const decrement = type => {
|
||||
state[type]--;
|
||||
stack.pop();
|
||||
};
|
||||
|
||||
/**
|
||||
* Push tokens onto the tokens array. This helper speeds up
|
||||
* tokenizing by 1) helping us avoid backtracking as much as possible,
|
||||
* and 2) helping us avoid creating extra tokens when consecutive
|
||||
* characters are plain text. This improves performance and simplifies
|
||||
* lookbehinds.
|
||||
*/
|
||||
|
||||
const push = tok => {
|
||||
if (prev.type === 'globstar') {
|
||||
const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace');
|
||||
const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren'));
|
||||
|
||||
if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) {
|
||||
state.output = state.output.slice(0, -prev.output.length);
|
||||
prev.type = 'star';
|
||||
prev.value = '*';
|
||||
prev.output = star;
|
||||
state.output += prev.output;
|
||||
}
|
||||
}
|
||||
|
||||
if (extglobs.length && tok.type !== 'paren') {
|
||||
extglobs[extglobs.length - 1].inner += tok.value;
|
||||
}
|
||||
|
||||
if (tok.value || tok.output) append(tok);
|
||||
if (prev && prev.type === 'text' && tok.type === 'text') {
|
||||
prev.value += tok.value;
|
||||
prev.output = (prev.output || '') + tok.value;
|
||||
return;
|
||||
}
|
||||
|
||||
tok.prev = prev;
|
||||
tokens.push(tok);
|
||||
prev = tok;
|
||||
};
|
||||
|
||||
const extglobOpen = (type, value) => {
|
||||
const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' };
|
||||
|
||||
token.prev = prev;
|
||||
token.parens = state.parens;
|
||||
token.output = state.output;
|
||||
const output = (opts.capture ? '(' : '') + token.open;
|
||||
|
||||
increment('parens');
|
||||
push({ type, value, output: state.output ? '' : ONE_CHAR });
|
||||
push({ type: 'paren', extglob: true, value: advance(), output });
|
||||
extglobs.push(token);
|
||||
};
|
||||
|
||||
const extglobClose = token => {
|
||||
let output = token.close + (opts.capture ? ')' : '');
|
||||
let rest;
|
||||
|
||||
if (token.type === 'negate') {
|
||||
let extglobStar = star;
|
||||
|
||||
if (token.inner && token.inner.length > 1 && token.inner.includes('/')) {
|
||||
extglobStar = globstar(opts);
|
||||
}
|
||||
|
||||
if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
|
||||
output = token.close = `)$))${extglobStar}`;
|
||||
}
|
||||
|
||||
if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
|
||||
// Any non-magical string (`.ts`) or even nested expression (`.{ts,tsx}`) can follow after the closing parenthesis.
|
||||
// In this case, we need to parse the string and use it in the output of the original pattern.
|
||||
// Suitable patterns: `/!(*.d).ts`, `/!(*.d).{ts,tsx}`, `**/!(*-dbg).@(js)`.
|
||||
//
|
||||
// Disabling the `fastpaths` option due to a problem with parsing strings as `.ts` in the pattern like `**/!(*.d).ts`.
|
||||
const expression = parse(rest, { ...options, fastpaths: false }).output;
|
||||
|
||||
output = token.close = `)${expression})${extglobStar})`;
|
||||
}
|
||||
|
||||
if (token.prev.type === 'bos') {
|
||||
state.negatedExtglob = true;
|
||||
}
|
||||
}
|
||||
|
||||
push({ type: 'paren', extglob: true, value, output });
|
||||
decrement('parens');
|
||||
};
|
||||
|
||||
/**
|
||||
* Fast paths
|
||||
*/
|
||||
|
||||
if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
|
||||
let backslashes = false;
|
||||
|
||||
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
|
||||
if (first === '\\') {
|
||||
backslashes = true;
|
||||
return m;
|
||||
}
|
||||
|
||||
if (first === '?') {
|
||||
if (esc) {
|
||||
return esc + first + (rest ? QMARK.repeat(rest.length) : '');
|
||||
}
|
||||
if (index === 0) {
|
||||
return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : '');
|
||||
}
|
||||
return QMARK.repeat(chars.length);
|
||||
}
|
||||
|
||||
if (first === '.') {
|
||||
return DOT_LITERAL.repeat(chars.length);
|
||||
}
|
||||
|
||||
if (first === '*') {
|
||||
if (esc) {
|
||||
return esc + first + (rest ? star : '');
|
||||
}
|
||||
return star;
|
||||
}
|
||||
return esc ? m : `\\${m}`;
|
||||
});
|
||||
|
||||
if
|
||||
Reference in New Issue
Block a user