first commit
This commit is contained in:
40
node_modules/wildcard-match/build/index.d.ts
generated
vendored
Normal file
40
node_modules/wildcard-match/build/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
interface WildcardMatchOptions {
|
||||
/** Separator to be used to split patterns and samples into segments */
|
||||
separator?: string | boolean;
|
||||
/** Flags to pass to the RegExp */
|
||||
flags?: string;
|
||||
}
|
||||
interface isMatch {
|
||||
/**
|
||||
* Tests if a sample string matches the pattern(s)
|
||||
*
|
||||
* ```js
|
||||
* isMatch('foo') //=> true
|
||||
* ```
|
||||
*/
|
||||
(sample: string): boolean;
|
||||
/** Compiled regular expression */
|
||||
regexp: RegExp;
|
||||
/** Original pattern or array of patterns that was used to compile the RegExp */
|
||||
pattern: string | string[];
|
||||
/** Options that were used to compile the RegExp */
|
||||
options: WildcardMatchOptions;
|
||||
}
|
||||
declare function isMatch(regexp: RegExp, sample: string): boolean;
|
||||
/**
|
||||
* Compiles one or more glob patterns into a RegExp and returns an isMatch function.
|
||||
* The isMatch function takes a sample string as its only argument and returns `true`
|
||||
* if the string matches the pattern(s).
|
||||
*
|
||||
* ```js
|
||||
* wildcardMatch('src/*.js')('src/index.js') //=> true
|
||||
* ```
|
||||
*
|
||||
* ```js
|
||||
* const isMatch = wildcardMatch('*.example.com', '.')
|
||||
* isMatch('foo.example.com') //=> true
|
||||
* isMatch('foo.bar.com') //=> false
|
||||
* ```
|
||||
*/
|
||||
declare function wildcardMatch(pattern: string | string[], options?: string | boolean | WildcardMatchOptions): isMatch;
|
||||
export = wildcardMatch;
|
||||
40
node_modules/wildcard-match/build/index.es.d.ts
generated
vendored
Normal file
40
node_modules/wildcard-match/build/index.es.d.ts
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
interface WildcardMatchOptions {
|
||||
/** Separator to be used to split patterns and samples into segments */
|
||||
separator?: string | boolean;
|
||||
/** Flags to pass to the RegExp */
|
||||
flags?: string;
|
||||
}
|
||||
interface isMatch {
|
||||
/**
|
||||
* Tests if a sample string matches the pattern(s)
|
||||
*
|
||||
* ```js
|
||||
* isMatch('foo') //=> true
|
||||
* ```
|
||||
*/
|
||||
(sample: string): boolean;
|
||||
/** Compiled regular expression */
|
||||
regexp: RegExp;
|
||||
/** Original pattern or array of patterns that was used to compile the RegExp */
|
||||
pattern: string | string[];
|
||||
/** Options that were used to compile the RegExp */
|
||||
options: WildcardMatchOptions;
|
||||
}
|
||||
declare function isMatch(regexp: RegExp, sample: string): boolean;
|
||||
/**
|
||||
* Compiles one or more glob patterns into a RegExp and returns an isMatch function.
|
||||
* The isMatch function takes a sample string as its only argument and returns `true`
|
||||
* if the string matches the pattern(s).
|
||||
*
|
||||
* ```js
|
||||
* wildcardMatch('src/*.js')('src/index.js') //=> true
|
||||
* ```
|
||||
*
|
||||
* ```js
|
||||
* const isMatch = wildcardMatch('*.example.com', '.')
|
||||
* isMatch('foo.example.com') //=> true
|
||||
* isMatch('foo.bar.com') //=> false
|
||||
* ```
|
||||
*/
|
||||
declare function wildcardMatch(pattern: string | string[], options?: string | boolean | WildcardMatchOptions): isMatch;
|
||||
export { wildcardMatch as default };
|
||||
169
node_modules/wildcard-match/build/index.es.mjs
generated
vendored
Normal file
169
node_modules/wildcard-match/build/index.es.mjs
generated
vendored
Normal file
@@ -0,0 +1,169 @@
|
||||
/**
|
||||
* Escapes a character if it has a special meaning in regular expressions
|
||||
* and returns the character as is if it doesn't
|
||||
*/
|
||||
function escapeRegExpChar(char) {
|
||||
if (char === '-' ||
|
||||
char === '^' ||
|
||||
char === '$' ||
|
||||
char === '+' ||
|
||||
char === '.' ||
|
||||
char === '(' ||
|
||||
char === ')' ||
|
||||
char === '|' ||
|
||||
char === '[' ||
|
||||
char === ']' ||
|
||||
char === '{' ||
|
||||
char === '}' ||
|
||||
char === '*' ||
|
||||
char === '?' ||
|
||||
char === '\\') {
|
||||
return "\\".concat(char);
|
||||
}
|
||||
else {
|
||||
return char;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Escapes all characters in a given string that have a special meaning in regular expressions
|
||||
*/
|
||||
function escapeRegExpString(str) {
|
||||
var result = '';
|
||||
for (var i = 0; i < str.length; i++) {
|
||||
result += escapeRegExpChar(str[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Transforms one or more glob patterns into a RegExp pattern
|
||||
*/
|
||||
function transform(pattern, separator) {
|
||||
if (separator === void 0) { separator = true; }
|
||||
if (Array.isArray(pattern)) {
|
||||
var regExpPatterns = pattern.map(function (p) { return "^".concat(transform(p, separator), "$"); });
|
||||
return "(?:".concat(regExpPatterns.join('|'), ")");
|
||||
}
|
||||
var separatorSplitter = '';
|
||||
var separatorMatcher = '';
|
||||
var wildcard = '.';
|
||||
if (separator === true) {
|
||||
separatorSplitter = '/';
|
||||
separatorMatcher = '[/\\\\]';
|
||||
wildcard = '[^/\\\\]';
|
||||
}
|
||||
else if (separator) {
|
||||
separatorSplitter = separator;
|
||||
separatorMatcher = escapeRegExpString(separatorSplitter);
|
||||
if (separatorMatcher.length > 1) {
|
||||
separatorMatcher = "(?:".concat(separatorMatcher, ")");
|
||||
wildcard = "((?!".concat(separatorMatcher, ").)");
|
||||
}
|
||||
else {
|
||||
wildcard = "[^".concat(separatorMatcher, "]");
|
||||
}
|
||||
}
|
||||
var requiredSeparator = separator ? "".concat(separatorMatcher, "+?") : '';
|
||||
var optionalSeparator = separator ? "".concat(separatorMatcher, "*?") : '';
|
||||
var segments = separator ? pattern.split(separatorSplitter) : [pattern];
|
||||
var result = '';
|
||||
for (var s = 0; s < segments.length; s++) {
|
||||
var segment = segments[s];
|
||||
var nextSegment = segments[s + 1];
|
||||
var currentSeparator = '';
|
||||
if (!segment && s > 0) {
|
||||
continue;
|
||||
}
|
||||
if (separator) {
|
||||
if (s === segments.length - 1) {
|
||||
currentSeparator = optionalSeparator;
|
||||
}
|
||||
else if (nextSegment !== '**') {
|
||||
currentSeparator = requiredSeparator;
|
||||
}
|
||||
else {
|
||||
currentSeparator = '';
|
||||
}
|
||||
}
|
||||
if (separator && segment === '**') {
|
||||
if (currentSeparator) {
|
||||
result +=
|
||||
s === 0
|
||||
? ''
|
||||
: s === segments.length - 1
|
||||
? "(?:".concat(requiredSeparator, "|$)")
|
||||
: requiredSeparator;
|
||||
result += "(?:".concat(wildcard, "*?").concat(currentSeparator, ")*?");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
for (var c = 0; c < segment.length; c++) {
|
||||
var char = segment[c];
|
||||
if (char === '\\') {
|
||||
if (c < segment.length - 1) {
|
||||
result += escapeRegExpChar(segment[c + 1]);
|
||||
c++;
|
||||
}
|
||||
}
|
||||
else if (char === '?') {
|
||||
result += wildcard;
|
||||
}
|
||||
else if (char === '*') {
|
||||
result += "".concat(wildcard, "*?");
|
||||
}
|
||||
else {
|
||||
result += escapeRegExpChar(char);
|
||||
}
|
||||
}
|
||||
result += currentSeparator;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function isMatch(regexp, sample) {
|
||||
if (typeof sample !== 'string') {
|
||||
throw new TypeError("Sample must be a string, but ".concat(typeof sample, " given"));
|
||||
}
|
||||
return regexp.test(sample);
|
||||
}
|
||||
/**
|
||||
* Compiles one or more glob patterns into a RegExp and returns an isMatch function.
|
||||
* The isMatch function takes a sample string as its only argument and returns `true`
|
||||
* if the string matches the pattern(s).
|
||||
*
|
||||
* ```js
|
||||
* wildcardMatch('src/*.js')('src/index.js') //=> true
|
||||
* ```
|
||||
*
|
||||
* ```js
|
||||
* const isMatch = wildcardMatch('*.example.com', '.')
|
||||
* isMatch('foo.example.com') //=> true
|
||||
* isMatch('foo.bar.com') //=> false
|
||||
* ```
|
||||
*/
|
||||
function wildcardMatch(pattern, options) {
|
||||
if (typeof pattern !== 'string' && !Array.isArray(pattern)) {
|
||||
throw new TypeError("The first argument must be a single pattern string or an array of patterns, but ".concat(typeof pattern, " given"));
|
||||
}
|
||||
if (typeof options === 'string' || typeof options === 'boolean') {
|
||||
options = { separator: options };
|
||||
}
|
||||
if (arguments.length === 2 &&
|
||||
!(typeof options === 'undefined' ||
|
||||
(typeof options === 'object' && options !== null && !Array.isArray(options)))) {
|
||||
throw new TypeError("The second argument must be an options object or a string/boolean separator, but ".concat(typeof options, " given"));
|
||||
}
|
||||
options = options || {};
|
||||
if (options.separator === '\\') {
|
||||
throw new Error('\\ is not a valid separator because it is used for escaping. Try setting the separator to `true` instead');
|
||||
}
|
||||
var regexpPattern = transform(pattern, options.separator);
|
||||
var regexp = new RegExp("^".concat(regexpPattern, "$"), options.flags);
|
||||
var fn = isMatch.bind(null, regexp);
|
||||
fn.options = options;
|
||||
fn.pattern = pattern;
|
||||
fn.regexp = regexp;
|
||||
return fn;
|
||||
}
|
||||
|
||||
export { wildcardMatch as default };
|
||||
//# sourceMappingURL=index.es.mjs.map
|
||||
1
node_modules/wildcard-match/build/index.es.mjs.map
generated
vendored
Normal file
1
node_modules/wildcard-match/build/index.es.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
171
node_modules/wildcard-match/build/index.js
generated
vendored
Normal file
171
node_modules/wildcard-match/build/index.js
generated
vendored
Normal file
@@ -0,0 +1,171 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Escapes a character if it has a special meaning in regular expressions
|
||||
* and returns the character as is if it doesn't
|
||||
*/
|
||||
function escapeRegExpChar(char) {
|
||||
if (char === '-' ||
|
||||
char === '^' ||
|
||||
char === '$' ||
|
||||
char === '+' ||
|
||||
char === '.' ||
|
||||
char === '(' ||
|
||||
char === ')' ||
|
||||
char === '|' ||
|
||||
char === '[' ||
|
||||
char === ']' ||
|
||||
char === '{' ||
|
||||
char === '}' ||
|
||||
char === '*' ||
|
||||
char === '?' ||
|
||||
char === '\\') {
|
||||
return "\\".concat(char);
|
||||
}
|
||||
else {
|
||||
return char;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Escapes all characters in a given string that have a special meaning in regular expressions
|
||||
*/
|
||||
function escapeRegExpString(str) {
|
||||
var result = '';
|
||||
for (var i = 0; i < str.length; i++) {
|
||||
result += escapeRegExpChar(str[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Transforms one or more glob patterns into a RegExp pattern
|
||||
*/
|
||||
function transform(pattern, separator) {
|
||||
if (separator === void 0) { separator = true; }
|
||||
if (Array.isArray(pattern)) {
|
||||
var regExpPatterns = pattern.map(function (p) { return "^".concat(transform(p, separator), "$"); });
|
||||
return "(?:".concat(regExpPatterns.join('|'), ")");
|
||||
}
|
||||
var separatorSplitter = '';
|
||||
var separatorMatcher = '';
|
||||
var wildcard = '.';
|
||||
if (separator === true) {
|
||||
separatorSplitter = '/';
|
||||
separatorMatcher = '[/\\\\]';
|
||||
wildcard = '[^/\\\\]';
|
||||
}
|
||||
else if (separator) {
|
||||
separatorSplitter = separator;
|
||||
separatorMatcher = escapeRegExpString(separatorSplitter);
|
||||
if (separatorMatcher.length > 1) {
|
||||
separatorMatcher = "(?:".concat(separatorMatcher, ")");
|
||||
wildcard = "((?!".concat(separatorMatcher, ").)");
|
||||
}
|
||||
else {
|
||||
wildcard = "[^".concat(separatorMatcher, "]");
|
||||
}
|
||||
}
|
||||
var requiredSeparator = separator ? "".concat(separatorMatcher, "+?") : '';
|
||||
var optionalSeparator = separator ? "".concat(separatorMatcher, "*?") : '';
|
||||
var segments = separator ? pattern.split(separatorSplitter) : [pattern];
|
||||
var result = '';
|
||||
for (var s = 0; s < segments.length; s++) {
|
||||
var segment = segments[s];
|
||||
var nextSegment = segments[s + 1];
|
||||
var currentSeparator = '';
|
||||
if (!segment && s > 0) {
|
||||
continue;
|
||||
}
|
||||
if (separator) {
|
||||
if (s === segments.length - 1) {
|
||||
currentSeparator = optionalSeparator;
|
||||
}
|
||||
else if (nextSegment !== '**') {
|
||||
currentSeparator = requiredSeparator;
|
||||
}
|
||||
else {
|
||||
currentSeparator = '';
|
||||
}
|
||||
}
|
||||
if (separator && segment === '**') {
|
||||
if (currentSeparator) {
|
||||
result +=
|
||||
s === 0
|
||||
? ''
|
||||
: s === segments.length - 1
|
||||
? "(?:".concat(requiredSeparator, "|$)")
|
||||
: requiredSeparator;
|
||||
result += "(?:".concat(wildcard, "*?").concat(currentSeparator, ")*?");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
for (var c = 0; c < segment.length; c++) {
|
||||
var char = segment[c];
|
||||
if (char === '\\') {
|
||||
if (c < segment.length - 1) {
|
||||
result += escapeRegExpChar(segment[c + 1]);
|
||||
c++;
|
||||
}
|
||||
}
|
||||
else if (char === '?') {
|
||||
result += wildcard;
|
||||
}
|
||||
else if (char === '*') {
|
||||
result += "".concat(wildcard, "*?");
|
||||
}
|
||||
else {
|
||||
result += escapeRegExpChar(char);
|
||||
}
|
||||
}
|
||||
result += currentSeparator;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function isMatch(regexp, sample) {
|
||||
if (typeof sample !== 'string') {
|
||||
throw new TypeError("Sample must be a string, but ".concat(typeof sample, " given"));
|
||||
}
|
||||
return regexp.test(sample);
|
||||
}
|
||||
/**
|
||||
* Compiles one or more glob patterns into a RegExp and returns an isMatch function.
|
||||
* The isMatch function takes a sample string as its only argument and returns `true`
|
||||
* if the string matches the pattern(s).
|
||||
*
|
||||
* ```js
|
||||
* wildcardMatch('src/*.js')('src/index.js') //=> true
|
||||
* ```
|
||||
*
|
||||
* ```js
|
||||
* const isMatch = wildcardMatch('*.example.com', '.')
|
||||
* isMatch('foo.example.com') //=> true
|
||||
* isMatch('foo.bar.com') //=> false
|
||||
* ```
|
||||
*/
|
||||
function wildcardMatch(pattern, options) {
|
||||
if (typeof pattern !== 'string' && !Array.isArray(pattern)) {
|
||||
throw new TypeError("The first argument must be a single pattern string or an array of patterns, but ".concat(typeof pattern, " given"));
|
||||
}
|
||||
if (typeof options === 'string' || typeof options === 'boolean') {
|
||||
options = { separator: options };
|
||||
}
|
||||
if (arguments.length === 2 &&
|
||||
!(typeof options === 'undefined' ||
|
||||
(typeof options === 'object' && options !== null && !Array.isArray(options)))) {
|
||||
throw new TypeError("The second argument must be an options object or a string/boolean separator, but ".concat(typeof options, " given"));
|
||||
}
|
||||
options = options || {};
|
||||
if (options.separator === '\\') {
|
||||
throw new Error('\\ is not a valid separator because it is used for escaping. Try setting the separator to `true` instead');
|
||||
}
|
||||
var regexpPattern = transform(pattern, options.separator);
|
||||
var regexp = new RegExp("^".concat(regexpPattern, "$"), options.flags);
|
||||
var fn = isMatch.bind(null, regexp);
|
||||
fn.options = options;
|
||||
fn.pattern = pattern;
|
||||
fn.regexp = regexp;
|
||||
return fn;
|
||||
}
|
||||
|
||||
module.exports = wildcardMatch;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/wildcard-match/build/index.js.map
generated
vendored
Normal file
1
node_modules/wildcard-match/build/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
40
node_modules/wildcard-match/build/index.umd.d.ts
generated
vendored
Normal file
40
node_modules/wildcard-match/build/index.umd.d.ts
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
interface WildcardMatchOptions {
|
||||
/** Separator to be used to split patterns and samples into segments */
|
||||
separator?: string | boolean;
|
||||
/** Flags to pass to the RegExp */
|
||||
flags?: string;
|
||||
}
|
||||
interface isMatch {
|
||||
/**
|
||||
* Tests if a sample string matches the pattern(s)
|
||||
*
|
||||
* ```js
|
||||
* isMatch('foo') //=> true
|
||||
* ```
|
||||
*/
|
||||
(sample: string): boolean;
|
||||
/** Compiled regular expression */
|
||||
regexp: RegExp;
|
||||
/** Original pattern or array of patterns that was used to compile the RegExp */
|
||||
pattern: string | string[];
|
||||
/** Options that were used to compile the RegExp */
|
||||
options: WildcardMatchOptions;
|
||||
}
|
||||
declare function isMatch(regexp: RegExp, sample: string): boolean;
|
||||
/**
|
||||
* Compiles one or more glob patterns into a RegExp and returns an isMatch function.
|
||||
* The isMatch function takes a sample string as its only argument and returns `true`
|
||||
* if the string matches the pattern(s).
|
||||
*
|
||||
* ```js
|
||||
* wildcardMatch('src/*.js')('src/index.js') //=> true
|
||||
* ```
|
||||
*
|
||||
* ```js
|
||||
* const isMatch = wildcardMatch('*.example.com', '.')
|
||||
* isMatch('foo.example.com') //=> true
|
||||
* isMatch('foo.bar.com') //=> false
|
||||
* ```
|
||||
*/
|
||||
declare function wildcardMatch(pattern: string | string[], options?: string | boolean | WildcardMatchOptions): isMatch;
|
||||
export = wildcardMatch;
|
||||
2
node_modules/wildcard-match/build/index.umd.js
generated
vendored
Normal file
2
node_modules/wildcard-match/build/index.umd.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).wcmatch=e()}(this,(function(){"use strict";function t(t){return"-"===t||"^"===t||"$"===t||"+"===t||"."===t||"("===t||")"===t||"|"===t||"["===t||"]"===t||"{"===t||"}"===t||"*"===t||"?"===t||"\\"===t?"\\".concat(t):t}function e(n,r){if(void 0===r&&(r=!0),Array.isArray(n)){var o=n.map((function(t){return"^".concat(e(t,r),"$")}));return"(?:".concat(o.join("|"),")")}var a="",i="",c=".";!0===r?(a="/",i="[/\\\\]",c="[^/\\\\]"):r&&(i=function(e){for(var n="",r=0;r<e.length;r++)n+=t(e[r]);return n}(a=r),i.length>1?(i="(?:".concat(i,")"),c="((?!".concat(i,").)")):c="[^".concat(i,"]"));for(var s=r?"".concat(i,"+?"):"",f=r?"".concat(i,"*?"):"",u=r?n.split(a):[n],p="",g=0;g<u.length;g++){var l=u[g],y=u[g+1],h="";if(l||!(g>0))if(r&&(h=g===u.length-1?f:"**"!==y?s:""),r&&"**"===l)h&&(p+=0===g?"":g===u.length-1?"(?:".concat(s,"|$)"):s,p+="(?:".concat(c,"*?").concat(h,")*?"));else{for(var d=0;d<l.length;d++){var b=l[d];"\\"===b?d<l.length-1&&(p+=t(l[d+1]),d++):p+="?"===b?c:"*"===b?"".concat(c,"*?"):t(b)}p+=h}}return p}function n(t,e){if("string"!=typeof e)throw new TypeError("Sample must be a string, but ".concat(typeof e," given"));return t.test(e)}return function(t,r){if("string"!=typeof t&&!Array.isArray(t))throw new TypeError("The first argument must be a single pattern string or an array of patterns, but ".concat(typeof t," given"));if("string"!=typeof r&&"boolean"!=typeof r||(r={separator:r}),2===arguments.length&&void 0!==r&&("object"!=typeof r||null===r||Array.isArray(r)))throw new TypeError("The second argument must be an options object or a string/boolean separator, but ".concat(typeof r," given"));if("\\"===(r=r||{}).separator)throw new Error("\\ is not a valid separator because it is used for escaping. Try setting the separator to `true` instead");var o=e(t,r.separator),a=new RegExp("^".concat(o,"$"),r.flags),i=n.bind(null,a);return i.options=r,i.pattern=t,i.regexp=a,i}}));
|
||||
//# sourceMappingURL=index.umd.js.map
|
||||
1
node_modules/wildcard-match/build/index.umd.js.map
generated
vendored
Normal file
1
node_modules/wildcard-match/build/index.umd.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user