@parcel/utils
Version:
Blazing fast, zero configuration web application bundler
1,279 lines (1,244 loc) • 1.54 MB
JavaScript
var $houHs$path = require("path");
var $houHs$stream = require("stream");
var $houHs$parcelsourcemap = require("@parcel/source-map");
var $houHs$parcellogger = require("@parcel/logger");
var $houHs$crypto = require("crypto");
var $houHs$os = require("os");
var $houHs$util = require("util");
var $houHs$events = require("events");
var $houHs$fs = require("fs");
var $houHs$parcelcodeframe = require("@parcel/codeframe");
var $houHs$parcelmarkdownansi = require("@parcel/markdown-ansi");
var $houHs$chalk = require("chalk");
var $houHs$tty = require("tty");
var $houHs$assert = require("assert");
var $houHs$parceldiagnostic = require("@parcel/diagnostic");
var $houHs$url = require("url");
var $houHs$child_process = require("child_process");
var $houHs$buffer = require("buffer");
var $houHs$parcelrust = require("@parcel/rust");
var $houHs$http = require("http");
var $houHs$https = require("https");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
var $parcel$global = globalThis;
function $parcel$interopDefault(a) {
return a && a.__esModule ? a.default : a;
}
var $parcel$modules = {};
var $parcel$inits = {};
var parcelRequire = $parcel$global["parcelRequire0b48"];
if (parcelRequire == null) {
parcelRequire = function(id) {
if (id in $parcel$modules) {
return $parcel$modules[id].exports;
}
if (id in $parcel$inits) {
var init = $parcel$inits[id];
delete $parcel$inits[id];
var module = {id: id, exports: {}};
$parcel$modules[id] = module;
init.call(module.exports, module, module.exports);
return module.exports;
}
var err = new Error("Cannot find module '" + id + "'");
err.code = 'MODULE_NOT_FOUND';
throw err;
};
parcelRequire.register = function register(id, init) {
$parcel$inits[id] = init;
};
$parcel$global["parcelRequire0b48"] = parcelRequire;
}
var parcelRegister = parcelRequire.register;
parcelRegister("ctKnW", function(module, exports) {
/**
* Node.js module for Forge.
*
* @author Dave Longley
*
* Copyright 2011-2016 Digital Bazaar, Inc.
*/ module.exports = {
// default options
options: {
usePureJavaScript: false
}
};
});
parcelRegister("iuae3", function(module, exports) {
/**
* Node.js module for Forge message digests.
*
* @author Dave Longley
*
* Copyright 2011-2017 Digital Bazaar, Inc.
*/
var $ctKnW = parcelRequire("ctKnW");
module.exports = $ctKnW.md = $ctKnW.md || {};
$ctKnW.md.algorithms = $ctKnW.md.algorithms || {};
});
parcelRegister("6TnoJ", function(module, exports) {
'use strict';
var $5H8Dk = parcelRequire("5H8Dk");
var $ahJIq = parcelRequire("ahJIq");
var $7UcG9 = parcelRequire("7UcG9");
var $4DgJ9 = parcelRequire("4DgJ9");
const $504a0778da8270dd$var$isObject = (val)=>val && typeof val === 'object' && !Array.isArray(val);
/**
* Creates a matcher function from one or more glob patterns. The
* returned function takes a string to match as its first argument,
* and returns true if the string is a match. The returned matcher
* function also takes a boolean as the second argument that, when true,
* returns an object with additional information.
*
* ```js
* const picomatch = require('picomatch');
* // picomatch(glob[, options]);
*
* const isMatch = picomatch('*.!(*a)');
* console.log(isMatch('a.a')); //=> false
* console.log(isMatch('a.b')); //=> true
* ```
* @name picomatch
* @param {String|Array} `globs` One or more glob patterns.
* @param {Object=} `options`
* @return {Function=} Returns a matcher function.
* @api public
*/ const $504a0778da8270dd$var$picomatch = (glob, options, returnState = false)=>{
if (Array.isArray(glob)) {
const fns = glob.map((input)=>$504a0778da8270dd$var$picomatch(input, options, returnState));
const arrayMatcher = (str)=>{
for (const isMatch of fns){
const state = isMatch(str);
if (state) return state;
}
return false;
};
return arrayMatcher;
}
const isState = $504a0778da8270dd$var$isObject(glob) && glob.tokens && glob.input;
if (glob === '' || typeof glob !== 'string' && !isState) throw new TypeError('Expected pattern to be a non-empty string');
const opts = options || {};
const posix = $7UcG9.isWindows(options);
const regex = isState ? $504a0778da8270dd$var$picomatch.compileRe(glob, options) : $504a0778da8270dd$var$picomatch.makeRe(glob, options, false, true);
const state = regex.state;
delete regex.state;
let isIgnored = ()=>false;
if (opts.ignore) {
const ignoreOpts = {
...options,
ignore: null,
onMatch: null,
onResult: null
};
isIgnored = $504a0778da8270dd$var$picomatch(opts.ignore, ignoreOpts, returnState);
}
const matcher = (input, returnObject = false)=>{
const { isMatch: isMatch, match: match, output: output } = $504a0778da8270dd$var$picomatch.test(input, regex, options, {
glob: glob,
posix: posix
});
const result = {
glob: glob,
state: state,
regex: regex,
posix: posix,
input: input,
output: output,
match: match,
isMatch: isMatch
};
if (typeof opts.onResult === 'function') opts.onResult(result);
if (isMatch === false) {
result.isMatch = false;
return returnObject ? result : false;
}
if (isIgnored(input)) {
if (typeof opts.onIgnore === 'function') opts.onIgnore(result);
result.isMatch = false;
return returnObject ? result : false;
}
if (typeof opts.onMatch === 'function') opts.onMatch(result);
return returnObject ? result : true;
};
if (returnState) matcher.state = state;
return matcher;
};
/**
* Test `input` with the given `regex`. This is used by the main
* `picomatch()` function to test the input string.
*
* ```js
* const picomatch = require('picomatch');
* // picomatch.test(input, regex[, options]);
*
* console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
* // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
* ```
* @param {String} `input` String to test.
* @param {RegExp} `regex`
* @return {Object} Returns an object with matching info.
* @api public
*/ $504a0778da8270dd$var$picomatch.test = (input, regex, options, { glob: glob, posix: posix } = {})=>{
if (typeof input !== 'string') throw new TypeError('Expected input to be a string');
if (input === '') return {
isMatch: false,
output: ''
};
const opts = options || {};
const format = opts.format || (posix ? $7UcG9.toPosixSlashes : null);
let match = input === glob;
let output = match && format ? format(input) : input;
if (match === false) {
output = format ? format(input) : input;
match = output === glob;
}
if (match === false || opts.capture === true) {
if (opts.matchBase === true || opts.basename === true) match = $504a0778da8270dd$var$picomatch.matchBase(input, regex, options, posix);
else match = regex.exec(output);
}
return {
isMatch: Boolean(match),
match: match,
output: output
};
};
/**
* Match the basename of a filepath.
*
* ```js
* const picomatch = require('picomatch');
* // picomatch.matchBase(input, glob[, options]);
* console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
* ```
* @param {String} `input` String to test.
* @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
* @return {Boolean}
* @api public
*/ $504a0778da8270dd$var$picomatch.matchBase = (input, glob, options, posix = $7UcG9.isWindows(options))=>{
const regex = glob instanceof RegExp ? glob : $504a0778da8270dd$var$picomatch.makeRe(glob, options);
return regex.test($houHs$path.basename(input));
};
/**
* Returns true if **any** of the given glob `patterns` match the specified `string`.
*
* ```js
* const picomatch = require('picomatch');
* // picomatch.isMatch(string, patterns[, options]);
*
* console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
* console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
* ```
* @param {String|Array} str The string to test.
* @param {String|Array} patterns One or more glob patterns to use for matching.
* @param {Object} [options] See available [options](#options).
* @return {Boolean} Returns true if any patterns match `str`
* @api public
*/ $504a0778da8270dd$var$picomatch.isMatch = (str, patterns, options)=>$504a0778da8270dd$var$picomatch(patterns, options)(str);
/**
* Parse a glob pattern to create the source string for a regular
* expression.
*
* ```js
* const picomatch = require('picomatch');
* const result = picomatch.parse(pattern[, options]);
* ```
* @param {String} `pattern`
* @param {Object} `options`
* @return {Object} Returns an object with useful properties and output to be used as a regex source string.
* @api public
*/ $504a0778da8270dd$var$picomatch.parse = (pattern, options)=>{
if (Array.isArray(pattern)) return pattern.map((p)=>$504a0778da8270dd$var$picomatch.parse(p, options));
return $ahJIq(pattern, {
...options,
fastpaths: false
});
};
/**
* Scan a glob pattern to separate the pattern into segments.
*
* ```js
* const picomatch = require('picomatch');
* // picomatch.scan(input[, options]);
*
* const result = picomatch.scan('!./foo/*.js');
* console.log(result);
* { prefix: '!./',
* input: '!./foo/*.js',
* start: 3,
* base: 'foo',
* glob: '*.js',
* isBrace: false,
* isBracket: false,
* isGlob: true,
* isExtglob: false,
* isGlobstar: false,
* negated: true }
* ```
* @param {String} `input` Glob pattern to scan.
* @param {Object} `options`
* @return {Object} Returns an object with
* @api public
*/ $504a0778da8270dd$var$picomatch.scan = (input, options)=>$5H8Dk(input, options);
/**
* Compile a regular expression from the `state` object returned by the
* [parse()](#parse) method.
*
* @param {Object} `state`
* @param {Object} `options`
* @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
* @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
* @return {RegExp}
* @api public
*/ $504a0778da8270dd$var$picomatch.compileRe = (state, options, returnOutput = false, returnState = false)=>{
if (returnOutput === true) return state.output;
const opts = options || {};
const prepend = opts.contains ? '' : '^';
const append = opts.contains ? '' : '$';
let source = `${prepend}(?:${state.output})${append}`;
if (state && state.negated === true) source = `^(?!${source}).*$`;
const regex = $504a0778da8270dd$var$picomatch.toRegex(source, options);
if (returnState === true) regex.state = state;
return regex;
};
/**
* Create a regular expression from a parsed glob pattern.
*
* ```js
* const picomatch = require('picomatch');
* const state = picomatch.parse('*.js');
* // picomatch.compileRe(state[, options]);
*
* console.log(picomatch.compileRe(state));
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
* ```
* @param {String} `state` The object returned from the `.parse` method.
* @param {Object} `options`
* @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result.
* @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
* @return {RegExp} Returns a regex created from the given pattern.
* @api public
*/ $504a0778da8270dd$var$picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false)=>{
if (!input || typeof input !== 'string') throw new TypeError('Expected a non-empty string');
let parsed = {
negated: false,
fastpaths: true
};
if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) parsed.output = $ahJIq.fastpaths(input, options);
if (!parsed.output) parsed = $ahJIq(input, options);
return $504a0778da8270dd$var$picomatch.compileRe(parsed, options, returnOutput, returnState);
};
/**
* Create a regular expression from the given regex source string.
*
* ```js
* const picomatch = require('picomatch');
* // picomatch.toRegex(source[, options]);
*
* const { output } = picomatch.parse('*.js');
* console.log(picomatch.toRegex(output));
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
* ```
* @param {String} `source` Regular expression source string.
* @param {Object} `options`
* @return {RegExp}
* @api public
*/ $504a0778da8270dd$var$picomatch.toRegex = (source, options)=>{
try {
const opts = options || {};
return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
} catch (err) {
if (options && options.debug === true) throw err;
return /$^/;
}
};
/**
* Picomatch constants.
* @return {Object}
*/ $504a0778da8270dd$var$picomatch.constants = $4DgJ9;
/**
* Expose "picomatch"
*/ module.exports = $504a0778da8270dd$var$picomatch;
});
parcelRegister("5H8Dk", function(module, exports) {
'use strict';
var $7UcG9 = parcelRequire("7UcG9");
var $4DgJ9 = parcelRequire("4DgJ9");
var $4257aa52be6213bf$require$CHAR_ASTERISK = $4DgJ9.CHAR_ASTERISK;
var $4257aa52be6213bf$require$CHAR_AT = $4DgJ9.CHAR_AT;
var $4257aa52be6213bf$require$CHAR_BACKWARD_SLASH = $4DgJ9.CHAR_BACKWARD_SLASH;
var $4257aa52be6213bf$require$CHAR_COMMA = $4DgJ9.CHAR_COMMA;
var $4257aa52be6213bf$require$CHAR_DOT = $4DgJ9.CHAR_DOT;
var $4257aa52be6213bf$require$CHAR_EXCLAMATION_MARK = $4DgJ9.CHAR_EXCLAMATION_MARK;
var $4257aa52be6213bf$require$CHAR_FORWARD_SLASH = $4DgJ9.CHAR_FORWARD_SLASH;
var $4257aa52be6213bf$require$CHAR_LEFT_CURLY_BRACE = $4DgJ9.CHAR_LEFT_CURLY_BRACE;
var $4257aa52be6213bf$require$CHAR_LEFT_PARENTHESES = $4DgJ9.CHAR_LEFT_PARENTHESES;
var $4257aa52be6213bf$require$CHAR_LEFT_SQUARE_BRACKET = $4DgJ9.CHAR_LEFT_SQUARE_BRACKET;
var $4257aa52be6213bf$require$CHAR_PLUS = $4DgJ9.CHAR_PLUS;
var $4257aa52be6213bf$require$CHAR_QUESTION_MARK = $4DgJ9.CHAR_QUESTION_MARK;
var $4257aa52be6213bf$require$CHAR_RIGHT_CURLY_BRACE = $4DgJ9.CHAR_RIGHT_CURLY_BRACE;
var $4257aa52be6213bf$require$CHAR_RIGHT_PARENTHESES = $4DgJ9.CHAR_RIGHT_PARENTHESES;
var $4257aa52be6213bf$require$CHAR_RIGHT_SQUARE_BRACKET = $4DgJ9.CHAR_RIGHT_SQUARE_BRACKET;
const $4257aa52be6213bf$var$isPathSeparator = (code)=>{
return code === $4257aa52be6213bf$require$CHAR_FORWARD_SLASH || code === $4257aa52be6213bf$require$CHAR_BACKWARD_SLASH;
};
const $4257aa52be6213bf$var$depth = (token)=>{
if (token.isPrefix !== true) token.depth = token.isGlobstar ? Infinity : 1;
};
/**
* Quickly scans a glob pattern and returns an object with a handful of
* useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
* `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
* with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
*
* ```js
* const pm = require('picomatch');
* console.log(pm.scan('foo/bar/*.js'));
* { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
* ```
* @param {String} `str`
* @param {Object} `options`
* @return {Object} Returns an object with tokens and regex source string.
* @api public
*/ const $4257aa52be6213bf$var$scan = (input, options)=>{
const opts = options || {};
const length = input.length - 1;
const scanToEnd = opts.parts === true || opts.scanToEnd === true;
const slashes = [];
const tokens = [];
const parts = [];
let str = input;
let index = -1;
let start = 0;
let lastIndex = 0;
let isBrace = false;
let isBracket = false;
let isGlob = false;
let isExtglob = false;
let isGlobstar = false;
let braceEscaped = false;
let backslashes = false;
let negated = false;
let negatedExtglob = false;
let finished = false;
let braces = 0;
let prev;
let code;
let token = {
value: '',
depth: 0,
isGlob: false
};
const eos = ()=>index >= length;
const peek = ()=>str.charCodeAt(index + 1);
const advance = ()=>{
prev = code;
return str.charCodeAt(++index);
};
while(index < length){
code = advance();
let next;
if (code === $4257aa52be6213bf$require$CHAR_BACKWARD_SLASH) {
backslashes = token.backslashes = true;
code = advance();
if (code === $4257aa52be6213bf$require$CHAR_LEFT_CURLY_BRACE) braceEscaped = true;
continue;
}
if (braceEscaped === true || code === $4257aa52be6213bf$require$CHAR_LEFT_CURLY_BRACE) {
braces++;
while(eos() !== true && (code = advance())){
if (code === $4257aa52be6213bf$require$CHAR_BACKWARD_SLASH) {
backslashes = token.backslashes = true;
advance();
continue;
}
if (code === $4257aa52be6213bf$require$CHAR_LEFT_CURLY_BRACE) {
braces++;
continue;
}
if (braceEscaped !== true && code === $4257aa52be6213bf$require$CHAR_DOT && (code = advance()) === $4257aa52be6213bf$require$CHAR_DOT) {
isBrace = token.isBrace = true;
isGlob = token.isGlob = true;
finished = true;
if (scanToEnd === true) continue;
break;
}
if (braceEscaped !== true && code === $4257aa52be6213bf$require$CHAR_COMMA) {
isBrace = token.isBrace = true;
isGlob = token.isGlob = true;
finished = true;
if (scanToEnd === true) continue;
break;
}
if (code === $4257aa52be6213bf$require$CHAR_RIGHT_CURLY_BRACE) {
braces--;
if (braces === 0) {
braceEscaped = false;
isBrace = token.isBrace = true;
finished = true;
break;
}
}
}
if (scanToEnd === true) continue;
break;
}
if (code === $4257aa52be6213bf$require$CHAR_FORWARD_SLASH) {
slashes.push(index);
tokens.push(token);
token = {
value: '',
depth: 0,
isGlob: false
};
if (finished === true) continue;
if (prev === $4257aa52be6213bf$require$CHAR_DOT && index === start + 1) {
start += 2;
continue;
}
lastIndex = index + 1;
continue;
}
if (opts.noext !== true) {
const isExtglobChar = code === $4257aa52be6213bf$require$CHAR_PLUS || code === $4257aa52be6213bf$require$CHAR_AT || code === $4257aa52be6213bf$require$CHAR_ASTERISK || code === $4257aa52be6213bf$require$CHAR_QUESTION_MARK || code === $4257aa52be6213bf$require$CHAR_EXCLAMATION_MARK;
if (isExtglobChar === true && peek() === $4257aa52be6213bf$require$CHAR_LEFT_PARENTHESES) {
isGlob = token.isGlob = true;
isExtglob = token.isExtglob = true;
finished = true;
if (code === $4257aa52be6213bf$require$CHAR_EXCLAMATION_MARK && index === start) negatedExtglob = true;
if (scanToEnd === true) {
while(eos() !== true && (code = advance())){
if (code === $4257aa52be6213bf$require$CHAR_BACKWARD_SLASH) {
backslashes = token.backslashes = true;
code = advance();
continue;
}
if (code === $4257aa52be6213bf$require$CHAR_RIGHT_PARENTHESES) {
isGlob = token.isGlob = true;
finished = true;
break;
}
}
continue;
}
break;
}
}
if (code === $4257aa52be6213bf$require$CHAR_ASTERISK) {
if (prev === $4257aa52be6213bf$require$CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
isGlob = token.isGlob = true;
finished = true;
if (scanToEnd === true) continue;
break;
}
if (code === $4257aa52be6213bf$require$CHAR_QUESTION_MARK) {
isGlob = token.isGlob = true;
finished = true;
if (scanToEnd === true) continue;
break;
}
if (code === $4257aa52be6213bf$require$CHAR_LEFT_SQUARE_BRACKET) {
while(eos() !== true && (next = advance())){
if (next === $4257aa52be6213bf$require$CHAR_BACKWARD_SLASH) {
backslashes = token.backslashes = true;
advance();
continue;
}
if (next === $4257aa52be6213bf$require$CHAR_RIGHT_SQUARE_BRACKET) {
isBracket = token.isBracket = true;
isGlob = token.isGlob = true;
finished = true;
break;
}
}
if (scanToEnd === true) continue;
break;
}
if (opts.nonegate !== true && code === $4257aa52be6213bf$require$CHAR_EXCLAMATION_MARK && index === start) {
negated = token.negated = true;
start++;
continue;
}
if (opts.noparen !== true && code === $4257aa52be6213bf$require$CHAR_LEFT_PARENTHESES) {
isGlob = token.isGlob = true;
if (scanToEnd === true) {
while(eos() !== true && (code = advance())){
if (code === $4257aa52be6213bf$require$CHAR_LEFT_PARENTHESES) {
backslashes = token.backslashes = true;
code = advance();
continue;
}
if (code === $4257aa52be6213bf$require$CHAR_RIGHT_PARENTHESES) {
finished = true;
break;
}
}
continue;
}
break;
}
if (isGlob === true) {
finished = true;
if (scanToEnd === true) continue;
break;
}
}
if (opts.noext === true) {
isExtglob = false;
isGlob = false;
}
let base = str;
let prefix = '';
let glob = '';
if (start > 0) {
prefix = str.slice(0, start);
str = str.slice(start);
lastIndex -= start;
}
if (base && isGlob === true && lastIndex > 0) {
base = str.slice(0, lastIndex);
glob = str.slice(lastIndex);
} else if (isGlob === true) {
base = '';
glob = str;
} else base = str;
if (base && base !== '' && base !== '/' && base !== str) {
if ($4257aa52be6213bf$var$isPathSeparator(base.charCodeAt(base.length - 1))) base = base.slice(0, -1);
}
if (opts.unescape === true) {
if (glob) glob = $7UcG9.removeBackslashes(glob);
if (base && backslashes === true) base = $7UcG9.removeBackslashes(base);
}
const state = {
prefix: prefix,
input: input,
start: start,
base: base,
glob: glob,
isBrace: isBrace,
isBracket: isBracket,
isGlob: isGlob,
isExtglob: isExtglob,
isGlobstar: isGlobstar,
negated: negated,
negatedExtglob: negatedExtglob
};
if (opts.tokens === true) {
state.maxDepth = 0;
if (!$4257aa52be6213bf$var$isPathSeparator(code)) tokens.push(token);
state.tokens = tokens;
}
if (opts.parts === true || opts.tokens === true) {
let prevIndex;
for(let idx = 0; idx < slashes.length; idx++){
const n = prevIndex ? prevIndex + 1 : start;
const i = slashes[idx];
const value = input.slice(n, i);
if (opts.tokens) {
if (idx === 0 && start !== 0) {
tokens[idx].isPrefix = true;
tokens[idx].value = prefix;
} else tokens[idx].value = value;
$4257aa52be6213bf$var$depth(tokens[idx]);
state.maxDepth += tokens[idx].depth;
}
if (idx !== 0 || value !== '') parts.push(value);
prevIndex = i;
}
if (prevIndex && prevIndex + 1 < input.length) {
const value = input.slice(prevIndex + 1);
parts.push(value);
if (opts.tokens) {
tokens[tokens.length - 1].value = value;
$4257aa52be6213bf$var$depth(tokens[tokens.length - 1]);
state.maxDepth += tokens[tokens.length - 1].depth;
}
}
state.slashes = slashes;
state.parts = parts;
}
return state;
};
module.exports = $4257aa52be6213bf$var$scan;
});
parcelRegister("7UcG9", function(module, exports) {
$parcel$export(module.exports, "isObject", () => $5c17991a3182beca$export$a6cdc56e425d0d0a, (v) => $5c17991a3182beca$export$a6cdc56e425d0d0a = v);
$parcel$export(module.exports, "hasRegexChars", () => $5c17991a3182beca$export$6540a013a39bb50d, (v) => $5c17991a3182beca$export$6540a013a39bb50d = v);
$parcel$export(module.exports, "escapeRegex", () => $5c17991a3182beca$export$104ed90cc1a13451, (v) => $5c17991a3182beca$export$104ed90cc1a13451 = v);
$parcel$export(module.exports, "toPosixSlashes", () => $5c17991a3182beca$export$e610e037975797ee, (v) => $5c17991a3182beca$export$e610e037975797ee = v);
$parcel$export(module.exports, "removeBackslashes", () => $5c17991a3182beca$export$f403de0a7ba7a743, (v) => $5c17991a3182beca$export$f403de0a7ba7a743 = v);
$parcel$export(module.exports, "supportsLookbehinds", () => $5c17991a3182beca$export$bcf709e5e3483cdb, (v) => $5c17991a3182beca$export$bcf709e5e3483cdb = v);
$parcel$export(module.exports, "isWindows", () => $5c17991a3182beca$export$f993c945890e93ba, (v) => $5c17991a3182beca$export$f993c945890e93ba = v);
$parcel$export(module.exports, "escapeLast", () => $5c17991a3182beca$export$13d0f4185f159c8, (v) => $5c17991a3182beca$export$13d0f4185f159c8 = v);
$parcel$export(module.exports, "removePrefix", () => $5c17991a3182beca$export$f2888183a34644d4, (v) => $5c17991a3182beca$export$f2888183a34644d4 = v);
$parcel$export(module.exports, "wrapOutput", () => $5c17991a3182beca$export$25bddda26836484b, (v) => $5c17991a3182beca$export$25bddda26836484b = v);
var $5c17991a3182beca$export$a6cdc56e425d0d0a;
var $5c17991a3182beca$export$6540a013a39bb50d;
var $5c17991a3182beca$export$a92319f7ab133839;
var $5c17991a3182beca$export$104ed90cc1a13451;
var $5c17991a3182beca$export$e610e037975797ee;
var $5c17991a3182beca$export$f403de0a7ba7a743;
var $5c17991a3182beca$export$bcf709e5e3483cdb;
var $5c17991a3182beca$export$f993c945890e93ba;
var $5c17991a3182beca$export$13d0f4185f159c8;
var $5c17991a3182beca$export$f2888183a34644d4;
var $5c17991a3182beca$export$25bddda26836484b;
'use strict';
const $5c17991a3182beca$var$win32 = process.platform === 'win32';
var $4DgJ9 = parcelRequire("4DgJ9");
var $5c17991a3182beca$require$REGEX_BACKSLASH = $4DgJ9.REGEX_BACKSLASH;
var $5c17991a3182beca$require$REGEX_REMOVE_BACKSLASH = $4DgJ9.REGEX_REMOVE_BACKSLASH;
var $5c17991a3182beca$require$REGEX_SPECIAL_CHARS = $4DgJ9.REGEX_SPECIAL_CHARS;
var $5c17991a3182beca$require$REGEX_SPECIAL_CHARS_GLOBAL = $4DgJ9.REGEX_SPECIAL_CHARS_GLOBAL;
$5c17991a3182beca$export$a6cdc56e425d0d0a = (val)=>val !== null && typeof val === 'object' && !Array.isArray(val);
$5c17991a3182beca$export$6540a013a39bb50d = (str)=>$5c17991a3182beca$require$REGEX_SPECIAL_CHARS.test(str);
$5c17991a3182beca$export$a92319f7ab133839 = (str)=>str.length === 1 && $5c17991a3182beca$export$6540a013a39bb50d(str);
$5c17991a3182beca$export$104ed90cc1a13451 = (str)=>str.replace($5c17991a3182beca$require$REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
$5c17991a3182beca$export$e610e037975797ee = (str)=>str.replace($5c17991a3182beca$require$REGEX_BACKSLASH, '/');
$5c17991a3182beca$export$f403de0a7ba7a743 = (str)=>{
return str.replace($5c17991a3182beca$require$REGEX_REMOVE_BACKSLASH, (match)=>{
return match === '\\' ? '' : match;
});
};
$5c17991a3182beca$export$bcf709e5e3483cdb = ()=>{
const segs = process.version.slice(1).split('.').map(Number);
if (segs.length === 3 && segs[0] >= 9 || segs[0] === 8 && segs[1] >= 10) return true;
return false;
};
$5c17991a3182beca$export$f993c945890e93ba = (options)=>{
if (options && typeof options.windows === 'boolean') return options.windows;
return $5c17991a3182beca$var$win32 === true || $houHs$path.sep === '\\';
};
$5c17991a3182beca$export$13d0f4185f159c8 = (input, char, lastIdx)=>{
const idx = input.lastIndexOf(char, lastIdx);
if (idx === -1) return input;
if (input[idx - 1] === '\\') return $5c17991a3182beca$export$13d0f4185f159c8(input, char, idx - 1);
return `${input.slice(0, idx)}\\${input.slice(idx)}`;
};
$5c17991a3182beca$export$f2888183a34644d4 = (input, state = {})=>{
let output = input;
if (output.startsWith('./')) {
output = output.slice(2);
state.prefix = './';
}
return output;
};
$5c17991a3182beca$export$25bddda26836484b = (input, state = {}, options = {})=>{
const prepend = options.contains ? '' : '^';
const append = options.contains ? '' : '$';
let output = `${prepend}(?:${input})${append}`;
if (state.negated === true) output = `(?:^(?!${output}).*$)`;
return output;
};
});
parcelRegister("4DgJ9", function(module, exports) {
'use strict';
const $35f7c79f5bc32bd4$var$WIN_SLASH = '\\\\/';
const $35f7c79f5bc32bd4$var$WIN_NO_SLASH = `[^${$35f7c79f5bc32bd4$var$WIN_SLASH}]`;
/**
* Posix glob regex
*/ const $35f7c79f5bc32bd4$var$DOT_LITERAL = '\\.';
const $35f7c79f5bc32bd4$var$PLUS_LITERAL = '\\+';
const $35f7c79f5bc32bd4$var$QMARK_LITERAL = '\\?';
const $35f7c79f5bc32bd4$var$SLASH_LITERAL = '\\/';
const $35f7c79f5bc32bd4$var$ONE_CHAR = '(?=.)';
const $35f7c79f5bc32bd4$var$QMARK = '[^/]';
const $35f7c79f5bc32bd4$var$END_ANCHOR = `(?:${$35f7c79f5bc32bd4$var$SLASH_LITERAL}|$)`;
const $35f7c79f5bc32bd4$var$START_ANCHOR = `(?:^|${$35f7c79f5bc32bd4$var$SLASH_LITERAL})`;
const $35f7c79f5bc32bd4$var$DOTS_SLASH = `${$35f7c79f5bc32bd4$var$DOT_LITERAL}{1,2}${$35f7c79f5bc32bd4$var$END_ANCHOR}`;
const $35f7c79f5bc32bd4$var$NO_DOT = `(?!${$35f7c79f5bc32bd4$var$DOT_LITERAL})`;
const $35f7c79f5bc32bd4$var$NO_DOTS = `(?!${$35f7c79f5bc32bd4$var$START_ANCHOR}${$35f7c79f5bc32bd4$var$DOTS_SLASH})`;
const $35f7c79f5bc32bd4$var$NO_DOT_SLASH = `(?!${$35f7c79f5bc32bd4$var$DOT_LITERAL}{0,1}${$35f7c79f5bc32bd4$var$END_ANCHOR})`;
const $35f7c79f5bc32bd4$var$NO_DOTS_SLASH = `(?!${$35f7c79f5bc32bd4$var$DOTS_SLASH})`;
const $35f7c79f5bc32bd4$var$QMARK_NO_DOT = `[^.${$35f7c79f5bc32bd4$var$SLASH_LITERAL}]`;
const $35f7c79f5bc32bd4$var$STAR = `${$35f7c79f5bc32bd4$var$QMARK}*?`;
const $35f7c79f5bc32bd4$var$POSIX_CHARS = {
DOT_LITERAL: $35f7c79f5bc32bd4$var$DOT_LITERAL,
PLUS_LITERAL: $35f7c79f5bc32bd4$var$PLUS_LITERAL,
QMARK_LITERAL: $35f7c79f5bc32bd4$var$QMARK_LITERAL,
SLASH_LITERAL: $35f7c79f5bc32bd4$var$SLASH_LITERAL,
ONE_CHAR: $35f7c79f5bc32bd4$var$ONE_CHAR,
QMARK: $35f7c79f5bc32bd4$var$QMARK,
END_ANCHOR: $35f7c79f5bc32bd4$var$END_ANCHOR,
DOTS_SLASH: $35f7c79f5bc32bd4$var$DOTS_SLASH,
NO_DOT: $35f7c79f5bc32bd4$var$NO_DOT,
NO_DOTS: $35f7c79f5bc32bd4$var$NO_DOTS,
NO_DOT_SLASH: $35f7c79f5bc32bd4$var$NO_DOT_SLASH,
NO_DOTS_SLASH: $35f7c79f5bc32bd4$var$NO_DOTS_SLASH,
QMARK_NO_DOT: $35f7c79f5bc32bd4$var$QMARK_NO_DOT,
STAR: $35f7c79f5bc32bd4$var$STAR,
START_ANCHOR: $35f7c79f5bc32bd4$var$START_ANCHOR
};
/**
* Windows glob regex
*/ const $35f7c79f5bc32bd4$var$WINDOWS_CHARS = {
...$35f7c79f5bc32bd4$var$POSIX_CHARS,
SLASH_LITERAL: `[${$35f7c79f5bc32bd4$var$WIN_SLASH}]`,
QMARK: $35f7c79f5bc32bd4$var$WIN_NO_SLASH,
STAR: `${$35f7c79f5bc32bd4$var$WIN_NO_SLASH}*?`,
DOTS_SLASH: `${$35f7c79f5bc32bd4$var$DOT_LITERAL}{1,2}(?:[${$35f7c79f5bc32bd4$var$WIN_SLASH}]|$)`,
NO_DOT: `(?!${$35f7c79f5bc32bd4$var$DOT_LITERAL})`,
NO_DOTS: `(?!(?:^|[${$35f7c79f5bc32bd4$var$WIN_SLASH}])${$35f7c79f5bc32bd4$var$DOT_LITERAL}{1,2}(?:[${$35f7c79f5bc32bd4$var$WIN_SLASH}]|$))`,
NO_DOT_SLASH: `(?!${$35f7c79f5bc32bd4$var$DOT_LITERAL}{0,1}(?:[${$35f7c79f5bc32bd4$var$WIN_SLASH}]|$))`,
NO_DOTS_SLASH: `(?!${$35f7c79f5bc32bd4$var$DOT_LITERAL}{1,2}(?:[${$35f7c79f5bc32bd4$var$WIN_SLASH}]|$))`,
QMARK_NO_DOT: `[^.${$35f7c79f5bc32bd4$var$WIN_SLASH}]`,
START_ANCHOR: `(?:^|[${$35f7c79f5bc32bd4$var$WIN_SLASH}])`,
END_ANCHOR: `(?:[${$35f7c79f5bc32bd4$var$WIN_SLASH}]|$)`
};
/**
* POSIX Bracket Regex
*/ const $35f7c79f5bc32bd4$var$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: 65536,
POSIX_REGEX_SOURCE: $35f7c79f5bc32bd4$var$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: $houHs$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 ? $35f7c79f5bc32bd4$var$WINDOWS_CHARS : $35f7c79f5bc32bd4$var$POSIX_CHARS;
}
};
});
parcelRegister("ahJIq", function(module, exports) {
'use strict';
var $4DgJ9 = parcelRequire("4DgJ9");
var $7UcG9 = parcelRequire("7UcG9");
/**
* Constants
*/ const { MAX_LENGTH: $77cef412a5a7e510$var$MAX_LENGTH, POSIX_REGEX_SOURCE: $77cef412a5a7e510$var$POSIX_REGEX_SOURCE, REGEX_NON_SPECIAL_CHARS: $77cef412a5a7e510$var$REGEX_NON_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_BACKREF: $77cef412a5a7e510$var$REGEX_SPECIAL_CHARS_BACKREF, REPLACEMENTS: $77cef412a5a7e510$var$REPLACEMENTS } = $4DgJ9;
/**
* Helpers
*/ const $77cef412a5a7e510$var$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)=>$7UcG9.escapeRegex(v)).join('..');
}
return value;
};
/**
* Create the message for a syntax error
*/ const $77cef412a5a7e510$var$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 $77cef412a5a7e510$var$parse = (input, options)=>{
if (typeof input !== 'string') throw new TypeError('Expected a string');
input = $77cef412a5a7e510$var$REPLACEMENTS[input] || input;
const opts = {
...options
};
const max = typeof opts.maxLength === 'number' ? Math.min($77cef412a5a7e510$var$MAX_LENGTH, opts.maxLength) : $77cef412a5a7e510$var$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 = $7UcG9.isWindows(options);
// create constants based on platform, for windows or posix
const PLATFORM_CHARS = $4DgJ9.globChars(win32);
const EXTGLOB_CHARS = $4DgJ9.extglobChars(PLATFORM_CHARS);
const { DOT_LITERAL: DOT_LITERAL, PLUS_LITERAL: PLUS_LITERAL, SLASH_LITERAL: SLASH_LITERAL, ONE_CHAR: ONE_CHAR, DOTS_SLASH: DOTS_SLASH, NO_DOT: NO_DOT, NO_DOT_SLASH: NO_DOT_SLASH, NO_DOTS_SLASH: NO_DOTS_SLASH, QMARK: QMARK, QMARK_NO_DOT: QMARK_NO_DOT, STAR: STAR, START_ANCHOR: 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: 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: tokens
};
input = $7UcG9.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: type,
value: value,
output: state.output ? '' : ONE_CHAR
});
push({
type: 'paren',
extglob: true,
value: advance(),
output: 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 = $77cef412a5a7e510$var$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: value,
output: output
});
decrement('parens');
};
/**
* Fast paths
*/ if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
let backslashes = false;
let output = input.replace($77cef412a5a7e510$var$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 (backslashes === true) {
if (opts.unescape === true) output = output.replace(/\\/g, '');
else output = output.replace(/\\+/g, (m)=>{
return m.length % 2 === 0 ? '\\\\' : m ? '\\' : '';
});
}
if (output === input && opts.contains === true) {
state.output = input;
return state;
}
state.output = $7UcG9.wrapOutput(output, state, options);
return state;
}
/**
* Tokenize input until we reach end-of-string
*/ while(!eos()){
value = advance();
if (value === '\u0000') continue;
/**
* Escaped characters
*/ if (value === '\\') {
const next = peek();
if (next === '/' && opts.bash !== true) continue;
if (next === '.' || next === ';') continue;
if (!next) {
value += '\\';
push({
type: 'text',
value: value
});
continue;
}
// collapse slashes to reduce potential for exploits
const match = /^\\+/.exec(remaining());
let slashes = 0;
if (match && match[0].length > 2) {
slashes = match[0].length;
state.index += slashes;
if (slashes % 2 !== 0) value += '\\';
}
if (opts.unescape === true) value = advance();
else value += advance();
if (state.brackets === 0) {
push({
type: 'text',
value: value
});
continue;
}
}
/**
* If we're inside a regex character class, continue
* until we reach the closing bracket.
*/ if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) {
if (opts.posix !== false && value === ':') {
const inner = prev.value.slice(1);
if (inner.includes('[')) {
prev.posix = true;
if (inner.includes(':')) {
const idx = prev.value.lastIndexOf('[');
const pre = prev.value.slice(0, idx);
const rest = prev.value.slice(idx + 2);
const posix = $77cef412a5a7e510$var$POSIX_REGEX_SOURCE[rest];
if (posix) {
prev.value = pre + posix;
state.backtrack = true;
advance();
if (!bos.output && tokens.indexOf(prev) === 1) bos.output = ONE_CHAR;
continue;
}
}
}
}
if (value === '[' && peek() !== ':' || value === '-' && peek() === ']') value = `\\${value}`;
if (value === ']' && (prev.value === '[' || prev.value === '[^')) value = `\\${value}`;
if (opts.posix === true && value === '!' && prev.value === '[') value = '^';
prev.value += value;
append({
value: value
});
continue;
}
/**
* If we're inside a quoted string, continue
* until we reach the closing double quote.
*/ if (state.quotes === 1 && value !== '"') {
value = $7UcG9.escapeRegex(value);
prev.value += value;
append({
value: value
});
continue;
}
/**
* Double quotes
*/ if (value === '"') {
state.quotes = state.quotes === 1 ? 0 : 1;
if (opts.keepQuotes === true) push({
type: 'text',
value: value
});
continue;
}
/**
* Parentheses
*/ if (value === '(') {
increment('parens');
push({
type: 'paren',
value: value
});
continue;
}
if (value === ')') {