micromatch.js (140583B)
1 exports["micromatch"] = 2 /******/ (function(modules) { // webpackBootstrap 3 /******/ // The module cache 4 /******/ var installedModules = {}; 5 /******/ 6 /******/ // The require function 7 /******/ function __webpack_require__(moduleId) { 8 /******/ 9 /******/ // Check if module is in cache 10 /******/ if(installedModules[moduleId]) { 11 /******/ return installedModules[moduleId].exports; 12 /******/ } 13 /******/ // Create a new module (and put it into the cache) 14 /******/ var module = installedModules[moduleId] = { 15 /******/ i: moduleId, 16 /******/ l: false, 17 /******/ exports: {} 18 /******/ }; 19 /******/ 20 /******/ // Execute the module function 21 /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 22 /******/ 23 /******/ // Flag the module as loaded 24 /******/ module.l = true; 25 /******/ 26 /******/ // Return the exports of the module 27 /******/ return module.exports; 28 /******/ } 29 /******/ 30 /******/ 31 /******/ // expose the modules object (__webpack_modules__) 32 /******/ __webpack_require__.m = modules; 33 /******/ 34 /******/ // expose the module cache 35 /******/ __webpack_require__.c = installedModules; 36 /******/ 37 /******/ // define getter function for harmony exports 38 /******/ __webpack_require__.d = function(exports, name, getter) { 39 /******/ if(!__webpack_require__.o(exports, name)) { 40 /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 41 /******/ } 42 /******/ }; 43 /******/ 44 /******/ // define __esModule on exports 45 /******/ __webpack_require__.r = function(exports) { 46 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 47 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 48 /******/ } 49 /******/ Object.defineProperty(exports, '__esModule', { value: true }); 50 /******/ }; 51 /******/ 52 /******/ // create a fake namespace object 53 /******/ // mode & 1: value is a module id, require it 54 /******/ // mode & 2: merge all properties of value into the ns 55 /******/ // mode & 4: return value when already ns object 56 /******/ // mode & 8|1: behave like require 57 /******/ __webpack_require__.t = function(value, mode) { 58 /******/ if(mode & 1) value = __webpack_require__(value); 59 /******/ if(mode & 8) return value; 60 /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 61 /******/ var ns = Object.create(null); 62 /******/ __webpack_require__.r(ns); 63 /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 64 /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 65 /******/ return ns; 66 /******/ }; 67 /******/ 68 /******/ // getDefaultExport function for compatibility with non-harmony modules 69 /******/ __webpack_require__.n = function(module) { 70 /******/ var getter = module && module.__esModule ? 71 /******/ function getDefault() { return module['default']; } : 72 /******/ function getModuleExports() { return module; }; 73 /******/ __webpack_require__.d(getter, 'a', getter); 74 /******/ return getter; 75 /******/ }; 76 /******/ 77 /******/ // Object.prototype.hasOwnProperty.call 78 /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 79 /******/ 80 /******/ // __webpack_public_path__ 81 /******/ __webpack_require__.p = ""; 82 /******/ 83 /******/ 84 /******/ // Load entry module and return exports 85 /******/ return __webpack_require__(__webpack_require__.s = 8); 86 /******/ }) 87 /************************************************************************/ 88 /******/ ([ 89 /* 0 */ 90 /***/ (function(module, exports, __webpack_require__) { 91 92 "use strict"; 93 /* WEBPACK VAR INJECTION */(function(process) { 94 95 const path = __webpack_require__(5); 96 const win32 = process.platform === 'win32'; 97 const { 98 REGEX_BACKSLASH, 99 REGEX_REMOVE_BACKSLASH, 100 REGEX_SPECIAL_CHARS, 101 REGEX_SPECIAL_CHARS_GLOBAL 102 } = __webpack_require__(1); 103 104 exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val); 105 exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str); 106 exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str); 107 exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1'); 108 exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/'); 109 110 exports.removeBackslashes = str => { 111 return str.replace(REGEX_REMOVE_BACKSLASH, match => { 112 return match === '\\' ? '' : match; 113 }); 114 }; 115 116 exports.supportsLookbehinds = () => { 117 const segs = process.version.slice(1).split('.').map(Number); 118 if (segs.length === 3 && segs[0] >= 9 || (segs[0] === 8 && segs[1] >= 10)) { 119 return true; 120 } 121 return false; 122 }; 123 124 exports.isWindows = options => { 125 if (options && typeof options.windows === 'boolean') { 126 return options.windows; 127 } 128 return win32 === true || path.sep === '\\'; 129 }; 130 131 exports.escapeLast = (input, char, lastIdx) => { 132 const idx = input.lastIndexOf(char, lastIdx); 133 if (idx === -1) return input; 134 if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1); 135 return `${input.slice(0, idx)}\\${input.slice(idx)}`; 136 }; 137 138 exports.removePrefix = (input, state = {}) => { 139 let output = input; 140 if (output.startsWith('./')) { 141 output = output.slice(2); 142 state.prefix = './'; 143 } 144 return output; 145 }; 146 147 exports.wrapOutput = (input, state = {}, options = {}) => { 148 const prepend = options.contains ? '' : '^'; 149 const append = options.contains ? '' : '$'; 150 151 let output = `${prepend}(?:${input})${append}`; 152 if (state.negated === true) { 153 output = `(?:^(?!${output}).*$)`; 154 } 155 return output; 156 }; 157 158 /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(2))) 159 160 /***/ }), 161 /* 1 */ 162 /***/ (function(module, exports, __webpack_require__) { 163 164 "use strict"; 165 166 167 const path = __webpack_require__(5); 168 const WIN_SLASH = '\\\\/'; 169 const WIN_NO_SLASH = `[^${WIN_SLASH}]`; 170 171 /** 172 * Posix glob regex 173 */ 174 175 const DOT_LITERAL = '\\.'; 176 const PLUS_LITERAL = '\\+'; 177 const QMARK_LITERAL = '\\?'; 178 const SLASH_LITERAL = '\\/'; 179 const ONE_CHAR = '(?=.)'; 180 const QMARK = '[^/]'; 181 const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`; 182 const START_ANCHOR = `(?:^|${SLASH_LITERAL})`; 183 const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`; 184 const NO_DOT = `(?!${DOT_LITERAL})`; 185 const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`; 186 const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`; 187 const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`; 188 const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`; 189 const STAR = `${QMARK}*?`; 190 191 const POSIX_CHARS = { 192 DOT_LITERAL, 193 PLUS_LITERAL, 194 QMARK_LITERAL, 195 SLASH_LITERAL, 196 ONE_CHAR, 197 QMARK, 198 END_ANCHOR, 199 DOTS_SLASH, 200 NO_DOT, 201 NO_DOTS, 202 NO_DOT_SLASH, 203 NO_DOTS_SLASH, 204 QMARK_NO_DOT, 205 STAR, 206 START_ANCHOR 207 }; 208 209 /** 210 * Windows glob regex 211 */ 212 213 const WINDOWS_CHARS = { 214 ...POSIX_CHARS, 215 216 SLASH_LITERAL: `[${WIN_SLASH}]`, 217 QMARK: WIN_NO_SLASH, 218 STAR: `${WIN_NO_SLASH}*?`, 219 DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`, 220 NO_DOT: `(?!${DOT_LITERAL})`, 221 NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, 222 NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`, 223 NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, 224 QMARK_NO_DOT: `[^.${WIN_SLASH}]`, 225 START_ANCHOR: `(?:^|[${WIN_SLASH}])`, 226 END_ANCHOR: `(?:[${WIN_SLASH}]|$)` 227 }; 228 229 /** 230 * POSIX Bracket Regex 231 */ 232 233 const POSIX_REGEX_SOURCE = { 234 alnum: 'a-zA-Z0-9', 235 alpha: 'a-zA-Z', 236 ascii: '\\x00-\\x7F', 237 blank: ' \\t', 238 cntrl: '\\x00-\\x1F\\x7F', 239 digit: '0-9', 240 graph: '\\x21-\\x7E', 241 lower: 'a-z', 242 print: '\\x20-\\x7E ', 243 punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~', 244 space: ' \\t\\r\\n\\v\\f', 245 upper: 'A-Z', 246 word: 'A-Za-z0-9_', 247 xdigit: 'A-Fa-f0-9' 248 }; 249 250 module.exports = { 251 MAX_LENGTH: 1024 * 64, 252 POSIX_REGEX_SOURCE, 253 254 // regular expressions 255 REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g, 256 REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/, 257 REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/, 258 REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g, 259 REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g, 260 REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g, 261 262 // Replace globs with equivalent patterns to reduce parsing time. 263 REPLACEMENTS: { 264 '***': '*', 265 '**/**': '**', 266 '**/**/**': '**' 267 }, 268 269 // Digits 270 CHAR_0: 48, /* 0 */ 271 CHAR_9: 57, /* 9 */ 272 273 // Alphabet chars. 274 CHAR_UPPERCASE_A: 65, /* A */ 275 CHAR_LOWERCASE_A: 97, /* a */ 276 CHAR_UPPERCASE_Z: 90, /* Z */ 277 CHAR_LOWERCASE_Z: 122, /* z */ 278 279 CHAR_LEFT_PARENTHESES: 40, /* ( */ 280 CHAR_RIGHT_PARENTHESES: 41, /* ) */ 281 282 CHAR_ASTERISK: 42, /* * */ 283 284 // Non-alphabetic chars. 285 CHAR_AMPERSAND: 38, /* & */ 286 CHAR_AT: 64, /* @ */ 287 CHAR_BACKWARD_SLASH: 92, /* \ */ 288 CHAR_CARRIAGE_RETURN: 13, /* \r */ 289 CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */ 290 CHAR_COLON: 58, /* : */ 291 CHAR_COMMA: 44, /* , */ 292 CHAR_DOT: 46, /* . */ 293 CHAR_DOUBLE_QUOTE: 34, /* " */ 294 CHAR_EQUAL: 61, /* = */ 295 CHAR_EXCLAMATION_MARK: 33, /* ! */ 296 CHAR_FORM_FEED: 12, /* \f */ 297 CHAR_FORWARD_SLASH: 47, /* / */ 298 CHAR_GRAVE_ACCENT: 96, /* ` */ 299 CHAR_HASH: 35, /* # */ 300 CHAR_HYPHEN_MINUS: 45, /* - */ 301 CHAR_LEFT_ANGLE_BRACKET: 60, /* < */ 302 CHAR_LEFT_CURLY_BRACE: 123, /* { */ 303 CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */ 304 CHAR_LINE_FEED: 10, /* \n */ 305 CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */ 306 CHAR_PERCENT: 37, /* % */ 307 CHAR_PLUS: 43, /* + */ 308 CHAR_QUESTION_MARK: 63, /* ? */ 309 CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */ 310 CHAR_RIGHT_CURLY_BRACE: 125, /* } */ 311 CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */ 312 CHAR_SEMICOLON: 59, /* ; */ 313 CHAR_SINGLE_QUOTE: 39, /* ' */ 314 CHAR_SPACE: 32, /* */ 315 CHAR_TAB: 9, /* \t */ 316 CHAR_UNDERSCORE: 95, /* _ */ 317 CHAR_VERTICAL_LINE: 124, /* | */ 318 CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */ 319 320 SEP: path.sep, 321 322 /** 323 * Create EXTGLOB_CHARS 324 */ 325 326 extglobChars(chars) { 327 return { 328 '!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` }, 329 '?': { type: 'qmark', open: '(?:', close: ')?' }, 330 '+': { type: 'plus', open: '(?:', close: ')+' }, 331 '*': { type: 'star', open: '(?:', close: ')*' }, 332 '@': { type: 'at', open: '(?:', close: ')' } 333 }; 334 }, 335 336 /** 337 * Create GLOB_CHARS 338 */ 339 340 globChars(win32) { 341 return win32 === true ? WINDOWS_CHARS : POSIX_CHARS; 342 } 343 }; 344 345 346 /***/ }), 347 /* 2 */ 348 /***/ (function(module, exports) { 349 350 // shim for using process in browser 351 var process = module.exports = {}; 352 353 // cached from whatever global is present so that test runners that stub it 354 // don't break things. But we need to wrap it in a try catch in case it is 355 // wrapped in strict mode code which doesn't define any globals. It's inside a 356 // function because try/catches deoptimize in certain engines. 357 358 var cachedSetTimeout; 359 var cachedClearTimeout; 360 361 function defaultSetTimout() { 362 throw new Error('setTimeout has not been defined'); 363 } 364 function defaultClearTimeout () { 365 throw new Error('clearTimeout has not been defined'); 366 } 367 (function () { 368 try { 369 if (typeof setTimeout === 'function') { 370 cachedSetTimeout = setTimeout; 371 } else { 372 cachedSetTimeout = defaultSetTimout; 373 } 374 } catch (e) { 375 cachedSetTimeout = defaultSetTimout; 376 } 377 try { 378 if (typeof clearTimeout === 'function') { 379 cachedClearTimeout = clearTimeout; 380 } else { 381 cachedClearTimeout = defaultClearTimeout; 382 } 383 } catch (e) { 384 cachedClearTimeout = defaultClearTimeout; 385 } 386 } ()) 387 function runTimeout(fun) { 388 if (cachedSetTimeout === setTimeout) { 389 //normal enviroments in sane situations 390 return setTimeout(fun, 0); 391 } 392 // if setTimeout wasn't available but was latter defined 393 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { 394 cachedSetTimeout = setTimeout; 395 return setTimeout(fun, 0); 396 } 397 try { 398 // when when somebody has screwed with setTimeout but no I.E. maddness 399 return cachedSetTimeout(fun, 0); 400 } catch(e){ 401 try { 402 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally 403 return cachedSetTimeout.call(null, fun, 0); 404 } catch(e){ 405 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error 406 return cachedSetTimeout.call(this, fun, 0); 407 } 408 } 409 410 411 } 412 function runClearTimeout(marker) { 413 if (cachedClearTimeout === clearTimeout) { 414 //normal enviroments in sane situations 415 return clearTimeout(marker); 416 } 417 // if clearTimeout wasn't available but was latter defined 418 if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { 419 cachedClearTimeout = clearTimeout; 420 return clearTimeout(marker); 421 } 422 try { 423 // when when somebody has screwed with setTimeout but no I.E. maddness 424 return cachedClearTimeout(marker); 425 } catch (e){ 426 try { 427 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally 428 return cachedClearTimeout.call(null, marker); 429 } catch (e){ 430 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. 431 // Some versions of I.E. have different rules for clearTimeout vs setTimeout 432 return cachedClearTimeout.call(this, marker); 433 } 434 } 435 436 437 438 } 439 var queue = []; 440 var draining = false; 441 var currentQueue; 442 var queueIndex = -1; 443 444 function cleanUpNextTick() { 445 if (!draining || !currentQueue) { 446 return; 447 } 448 draining = false; 449 if (currentQueue.length) { 450 queue = currentQueue.concat(queue); 451 } else { 452 queueIndex = -1; 453 } 454 if (queue.length) { 455 drainQueue(); 456 } 457 } 458 459 function drainQueue() { 460 if (draining) { 461 return; 462 } 463 var timeout = runTimeout(cleanUpNextTick); 464 draining = true; 465 466 var len = queue.length; 467 while(len) { 468 currentQueue = queue; 469 queue = []; 470 while (++queueIndex < len) { 471 if (currentQueue) { 472 currentQueue[queueIndex].run(); 473 } 474 } 475 queueIndex = -1; 476 len = queue.length; 477 } 478 currentQueue = null; 479 draining = false; 480 runClearTimeout(timeout); 481 } 482 483 process.nextTick = function (fun) { 484 var args = new Array(arguments.length - 1); 485 if (arguments.length > 1) { 486 for (var i = 1; i < arguments.length; i++) { 487 args[i - 1] = arguments[i]; 488 } 489 } 490 queue.push(new Item(fun, args)); 491 if (queue.length === 1 && !draining) { 492 runTimeout(drainQueue); 493 } 494 }; 495 496 // v8 likes predictible objects 497 function Item(fun, array) { 498 this.fun = fun; 499 this.array = array; 500 } 501 Item.prototype.run = function () { 502 this.fun.apply(null, this.array); 503 }; 504 process.title = 'browser'; 505 process.browser = true; 506 process.env = {}; 507 process.argv = []; 508 process.version = ''; // empty string to avoid regexp issues 509 process.versions = {}; 510 511 function noop() {} 512 513 process.on = noop; 514 process.addListener = noop; 515 process.once = noop; 516 process.off = noop; 517 process.removeListener = noop; 518 process.removeAllListeners = noop; 519 process.emit = noop; 520 process.prependListener = noop; 521 process.prependOnceListener = noop; 522 523 process.listeners = function (name) { return [] } 524 525 process.binding = function (name) { 526 throw new Error('process.binding is not supported'); 527 }; 528 529 process.cwd = function () { return '/' }; 530 process.chdir = function (dir) { 531 throw new Error('process.chdir is not supported'); 532 }; 533 process.umask = function() { return 0; }; 534 535 536 /***/ }), 537 /* 3 */ 538 /***/ (function(module, exports, __webpack_require__) { 539 540 "use strict"; 541 542 543 const utils = __webpack_require__(4); 544 545 module.exports = (ast, options = {}) => { 546 let stringify = (node, parent = {}) => { 547 let invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent); 548 let invalidNode = node.invalid === true && options.escapeInvalid === true; 549 let output = ''; 550 551 if (node.value) { 552 if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) { 553 return '\\' + node.value; 554 } 555 return node.value; 556 } 557 558 if (node.value) { 559 return node.value; 560 } 561 562 if (node.nodes) { 563 for (let child of node.nodes) { 564 output += stringify(child); 565 } 566 } 567 return output; 568 }; 569 570 return stringify(ast); 571 }; 572 573 574 575 /***/ }), 576 /* 4 */ 577 /***/ (function(module, exports, __webpack_require__) { 578 579 "use strict"; 580 581 582 exports.isInteger = num => { 583 if (typeof num === 'number') { 584 return Number.isInteger(num); 585 } 586 if (typeof num === 'string' && num.trim() !== '') { 587 return Number.isInteger(Number(num)); 588 } 589 return false; 590 }; 591 592 /** 593 * Find a node of the given type 594 */ 595 596 exports.find = (node, type) => node.nodes.find(node => node.type === type); 597 598 /** 599 * Find a node of the given type 600 */ 601 602 exports.exceedsLimit = (min, max, step = 1, limit) => { 603 if (limit === false) return false; 604 if (!exports.isInteger(min) || !exports.isInteger(max)) return false; 605 return ((Number(max) - Number(min)) / Number(step)) >= limit; 606 }; 607 608 /** 609 * Escape the given node with '\\' before node.value 610 */ 611 612 exports.escapeNode = (block, n = 0, type) => { 613 let node = block.nodes[n]; 614 if (!node) return; 615 616 if ((type && node.type === type) || node.type === 'open' || node.type === 'close') { 617 if (node.escaped !== true) { 618 node.value = '\\' + node.value; 619 node.escaped = true; 620 } 621 } 622 }; 623 624 /** 625 * Returns true if the given brace node should be enclosed in literal braces 626 */ 627 628 exports.encloseBrace = node => { 629 if (node.type !== 'brace') return false; 630 if ((node.commas >> 0 + node.ranges >> 0) === 0) { 631 node.invalid = true; 632 return true; 633 } 634 return false; 635 }; 636 637 /** 638 * Returns true if a brace node is invalid. 639 */ 640 641 exports.isInvalidBrace = block => { 642 if (block.type !== 'brace') return false; 643 if (block.invalid === true || block.dollar) return true; 644 if ((block.commas >> 0 + block.ranges >> 0) === 0) { 645 block.invalid = true; 646 return true; 647 } 648 if (block.open !== true || block.close !== true) { 649 block.invalid = true; 650 return true; 651 } 652 return false; 653 }; 654 655 /** 656 * Returns true if a node is an open or close node 657 */ 658 659 exports.isOpenOrClose = node => { 660 if (node.type === 'open' || node.type === 'close') { 661 return true; 662 } 663 return node.open === true || node.close === true; 664 }; 665 666 /** 667 * Reduce an array of text nodes. 668 */ 669 670 exports.reduce = nodes => nodes.reduce((acc, node) => { 671 if (node.type === 'text') acc.push(node.value); 672 if (node.type === 'range') node.type = 'text'; 673 return acc; 674 }, []); 675 676 /** 677 * Flatten an array 678 */ 679 680 exports.flatten = (...args) => { 681 const result = []; 682 const flat = arr => { 683 for (let i = 0; i < arr.length; i++) { 684 let ele = arr[i]; 685 Array.isArray(ele) ? flat(ele, result) : ele !== void 0 && result.push(ele); 686 } 687 return result; 688 }; 689 flat(args); 690 return result; 691 }; 692 693 694 /***/ }), 695 /* 5 */ 696 /***/ (function(module, exports, __webpack_require__) { 697 698 /* WEBPACK VAR INJECTION */(function(process) {// .dirname, .basename, and .extname methods are extracted from Node.js v8.11.1, 699 // backported and transplited with Babel, with backwards-compat fixes 700 701 // Copyright Joyent, Inc. and other Node contributors. 702 // 703 // Permission is hereby granted, free of charge, to any person obtaining a 704 // copy of this software and associated documentation files (the 705 // "Software"), to deal in the Software without restriction, including 706 // without limitation the rights to use, copy, modify, merge, publish, 707 // distribute, sublicense, and/or sell copies of the Software, and to permit 708 // persons to whom the Software is furnished to do so, subject to the 709 // following conditions: 710 // 711 // The above copyright notice and this permission notice shall be included 712 // in all copies or substantial portions of the Software. 713 // 714 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 715 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 716 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 717 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 718 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 719 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 720 // USE OR OTHER DEALINGS IN THE SOFTWARE. 721 722 // resolves . and .. elements in a path array with directory names there 723 // must be no slashes, empty elements, or device names (c:\) in the array 724 // (so also no leading and trailing slashes - it does not distinguish 725 // relative and absolute paths) 726 function normalizeArray(parts, allowAboveRoot) { 727 // if the path tries to go above the root, `up` ends up > 0 728 var up = 0; 729 for (var i = parts.length - 1; i >= 0; i--) { 730 var last = parts[i]; 731 if (last === '.') { 732 parts.splice(i, 1); 733 } else if (last === '..') { 734 parts.splice(i, 1); 735 up++; 736 } else if (up) { 737 parts.splice(i, 1); 738 up--; 739 } 740 } 741 742 // if the path is allowed to go above the root, restore leading ..s 743 if (allowAboveRoot) { 744 for (; up--; up) { 745 parts.unshift('..'); 746 } 747 } 748 749 return parts; 750 } 751 752 // path.resolve([from ...], to) 753 // posix version 754 exports.resolve = function() { 755 var resolvedPath = '', 756 resolvedAbsolute = false; 757 758 for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { 759 var path = (i >= 0) ? arguments[i] : process.cwd(); 760 761 // Skip empty and invalid entries 762 if (typeof path !== 'string') { 763 throw new TypeError('Arguments to path.resolve must be strings'); 764 } else if (!path) { 765 continue; 766 } 767 768 resolvedPath = path + '/' + resolvedPath; 769 resolvedAbsolute = path.charAt(0) === '/'; 770 } 771 772 // At this point the path should be resolved to a full absolute path, but 773 // handle relative paths to be safe (might happen when process.cwd() fails) 774 775 // Normalize the path 776 resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) { 777 return !!p; 778 }), !resolvedAbsolute).join('/'); 779 780 return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.'; 781 }; 782 783 // path.normalize(path) 784 // posix version 785 exports.normalize = function(path) { 786 var isAbsolute = exports.isAbsolute(path), 787 trailingSlash = substr(path, -1) === '/'; 788 789 // Normalize the path 790 path = normalizeArray(filter(path.split('/'), function(p) { 791 return !!p; 792 }), !isAbsolute).join('/'); 793 794 if (!path && !isAbsolute) { 795 path = '.'; 796 } 797 if (path && trailingSlash) { 798 path += '/'; 799 } 800 801 return (isAbsolute ? '/' : '') + path; 802 }; 803 804 // posix version 805 exports.isAbsolute = function(path) { 806 return path.charAt(0) === '/'; 807 }; 808 809 // posix version 810 exports.join = function() { 811 var paths = Array.prototype.slice.call(arguments, 0); 812 return exports.normalize(filter(paths, function(p, index) { 813 if (typeof p !== 'string') { 814 throw new TypeError('Arguments to path.join must be strings'); 815 } 816 return p; 817 }).join('/')); 818 }; 819 820 821 // path.relative(from, to) 822 // posix version 823 exports.relative = function(from, to) { 824 from = exports.resolve(from).substr(1); 825 to = exports.resolve(to).substr(1); 826 827 function trim(arr) { 828 var start = 0; 829 for (; start < arr.length; start++) { 830 if (arr[start] !== '') break; 831 } 832 833 var end = arr.length - 1; 834 for (; end >= 0; end--) { 835 if (arr[end] !== '') break; 836 } 837 838 if (start > end) return []; 839 return arr.slice(start, end - start + 1); 840 } 841 842 var fromParts = trim(from.split('/')); 843 var toParts = trim(to.split('/')); 844 845 var length = Math.min(fromParts.length, toParts.length); 846 var samePartsLength = length; 847 for (var i = 0; i < length; i++) { 848 if (fromParts[i] !== toParts[i]) { 849 samePartsLength = i; 850 break; 851 } 852 } 853 854 var outputParts = []; 855 for (var i = samePartsLength; i < fromParts.length; i++) { 856 outputParts.push('..'); 857 } 858 859 outputParts = outputParts.concat(toParts.slice(samePartsLength)); 860 861 return outputParts.join('/'); 862 }; 863 864 exports.sep = '/'; 865 exports.delimiter = ':'; 866 867 exports.dirname = function (path) { 868 if (typeof path !== 'string') path = path + ''; 869 if (path.length === 0) return '.'; 870 var code = path.charCodeAt(0); 871 var hasRoot = code === 47 /*/*/; 872 var end = -1; 873 var matchedSlash = true; 874 for (var i = path.length - 1; i >= 1; --i) { 875 code = path.charCodeAt(i); 876 if (code === 47 /*/*/) { 877 if (!matchedSlash) { 878 end = i; 879 break; 880 } 881 } else { 882 // We saw the first non-path separator 883 matchedSlash = false; 884 } 885 } 886 887 if (end === -1) return hasRoot ? '/' : '.'; 888 if (hasRoot && end === 1) { 889 // return '//'; 890 // Backwards-compat fix: 891 return '/'; 892 } 893 return path.slice(0, end); 894 }; 895 896 function basename(path) { 897 if (typeof path !== 'string') path = path + ''; 898 899 var start = 0; 900 var end = -1; 901 var matchedSlash = true; 902 var i; 903 904 for (i = path.length - 1; i >= 0; --i) { 905 if (path.charCodeAt(i) === 47 /*/*/) { 906 // If we reached a path separator that was not part of a set of path 907 // separators at the end of the string, stop now 908 if (!matchedSlash) { 909 start = i + 1; 910 break; 911 } 912 } else if (end === -1) { 913 // We saw the first non-path separator, mark this as the end of our 914 // path component 915 matchedSlash = false; 916 end = i + 1; 917 } 918 } 919 920 if (end === -1) return ''; 921 return path.slice(start, end); 922 } 923 924 // Uses a mixed approach for backwards-compatibility, as ext behavior changed 925 // in new Node.js versions, so only basename() above is backported here 926 exports.basename = function (path, ext) { 927 var f = basename(path); 928 if (ext && f.substr(-1 * ext.length) === ext) { 929 f = f.substr(0, f.length - ext.length); 930 } 931 return f; 932 }; 933 934 exports.extname = function (path) { 935 if (typeof path !== 'string') path = path + ''; 936 var startDot = -1; 937 var startPart = 0; 938 var end = -1; 939 var matchedSlash = true; 940 // Track the state of characters (if any) we see before our first dot and 941 // after any path separator we find 942 var preDotState = 0; 943 for (var i = path.length - 1; i >= 0; --i) { 944 var code = path.charCodeAt(i); 945 if (code === 47 /*/*/) { 946 // If we reached a path separator that was not part of a set of path 947 // separators at the end of the string, stop now 948 if (!matchedSlash) { 949 startPart = i + 1; 950 break; 951 } 952 continue; 953 } 954 if (end === -1) { 955 // We saw the first non-path separator, mark this as the end of our 956 // extension 957 matchedSlash = false; 958 end = i + 1; 959 } 960 if (code === 46 /*.*/) { 961 // If this is our first dot, mark it as the start of our extension 962 if (startDot === -1) 963 startDot = i; 964 else if (preDotState !== 1) 965 preDotState = 1; 966 } else if (startDot !== -1) { 967 // We saw a non-dot and non-path separator before our dot, so we should 968 // have a good chance at having a non-empty extension 969 preDotState = -1; 970 } 971 } 972 973 if (startDot === -1 || end === -1 || 974 // We saw a non-dot character immediately before the dot 975 preDotState === 0 || 976 // The (right-most) trimmed path component is exactly '..' 977 preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) { 978 return ''; 979 } 980 return path.slice(startDot, end); 981 }; 982 983 function filter (xs, f) { 984 if (xs.filter) return xs.filter(f); 985 var res = []; 986 for (var i = 0; i < xs.length; i++) { 987 if (f(xs[i], i, xs)) res.push(xs[i]); 988 } 989 return res; 990 } 991 992 // String.prototype.substr - negative index don't work in IE8 993 var substr = 'ab'.substr(-1) === 'b' 994 ? function (str, start, len) { return str.substr(start, len) } 995 : function (str, start, len) { 996 if (start < 0) start = str.length + start; 997 return str.substr(start, len); 998 } 999 ; 1000 1001 /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(2))) 1002 1003 /***/ }), 1004 /* 6 */ 1005 /***/ (function(module, exports, __webpack_require__) { 1006 1007 /* WEBPACK VAR INJECTION */(function(process) {// Copyright Joyent, Inc. and other Node contributors. 1008 // 1009 // Permission is hereby granted, free of charge, to any person obtaining a 1010 // copy of this software and associated documentation files (the 1011 // "Software"), to deal in the Software without restriction, including 1012 // without limitation the rights to use, copy, modify, merge, publish, 1013 // distribute, sublicense, and/or sell copies of the Software, and to permit 1014 // persons to whom the Software is furnished to do so, subject to the 1015 // following conditions: 1016 // 1017 // The above copyright notice and this permission notice shall be included 1018 // in all copies or substantial portions of the Software. 1019 // 1020 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 1021 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 1022 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 1023 // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 1024 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 1025 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 1026 // USE OR OTHER DEALINGS IN THE SOFTWARE. 1027 1028 var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || 1029 function getOwnPropertyDescriptors(obj) { 1030 var keys = Object.keys(obj); 1031 var descriptors = {}; 1032 for (var i = 0; i < keys.length; i++) { 1033 descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]); 1034 } 1035 return descriptors; 1036 }; 1037 1038 var formatRegExp = /%[sdj%]/g; 1039 exports.format = function(f) { 1040 if (!isString(f)) { 1041 var objects = []; 1042 for (var i = 0; i < arguments.length; i++) { 1043 objects.push(inspect(arguments[i])); 1044 } 1045 return objects.join(' '); 1046 } 1047 1048 var i = 1; 1049 var args = arguments; 1050 var len = args.length; 1051 var str = String(f).replace(formatRegExp, function(x) { 1052 if (x === '%%') return '%'; 1053 if (i >= len) return x; 1054 switch (x) { 1055 case '%s': return String(args[i++]); 1056 case '%d': return Number(args[i++]); 1057 case '%j': 1058 try { 1059 return JSON.stringify(args[i++]); 1060 } catch (_) { 1061 return '[Circular]'; 1062 } 1063 default: 1064 return x; 1065 } 1066 }); 1067 for (var x = args[i]; i < len; x = args[++i]) { 1068 if (isNull(x) || !isObject(x)) { 1069 str += ' ' + x; 1070 } else { 1071 str += ' ' + inspect(x); 1072 } 1073 } 1074 return str; 1075 }; 1076 1077 1078 // Mark that a method should not be used. 1079 // Returns a modified function which warns once by default. 1080 // If --no-deprecation is set, then it is a no-op. 1081 exports.deprecate = function(fn, msg) { 1082 if (typeof process !== 'undefined' && process.noDeprecation === true) { 1083 return fn; 1084 } 1085 1086 // Allow for deprecating things in the process of starting up. 1087 if (typeof process === 'undefined') { 1088 return function() { 1089 return exports.deprecate(fn, msg).apply(this, arguments); 1090 }; 1091 } 1092 1093 var warned = false; 1094 function deprecated() { 1095 if (!warned) { 1096 if (process.throwDeprecation) { 1097 throw new Error(msg); 1098 } else if (process.traceDeprecation) { 1099 console.trace(msg); 1100 } else { 1101 console.error(msg); 1102 } 1103 warned = true; 1104 } 1105 return fn.apply(this, arguments); 1106 } 1107 1108 return deprecated; 1109 }; 1110 1111 1112 var debugs = {}; 1113 var debugEnviron; 1114 exports.debuglog = function(set) { 1115 if (isUndefined(debugEnviron)) 1116 debugEnviron = process.env.NODE_DEBUG || ''; 1117 set = set.toUpperCase(); 1118 if (!debugs[set]) { 1119 if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { 1120 var pid = process.pid; 1121 debugs[set] = function() { 1122 var msg = exports.format.apply(exports, arguments); 1123 console.error('%s %d: %s', set, pid, msg); 1124 }; 1125 } else { 1126 debugs[set] = function() {}; 1127 } 1128 } 1129 return debugs[set]; 1130 }; 1131 1132 1133 /** 1134 * Echos the value of a value. Trys to print the value out 1135 * in the best way possible given the different types. 1136 * 1137 * @param {Object} obj The object to print out. 1138 * @param {Object} opts Optional options object that alters the output. 1139 */ 1140 /* legacy: obj, showHidden, depth, colors*/ 1141 function inspect(obj, opts) { 1142 // default options 1143 var ctx = { 1144 seen: [], 1145 stylize: stylizeNoColor 1146 }; 1147 // legacy... 1148 if (arguments.length >= 3) ctx.depth = arguments[2]; 1149 if (arguments.length >= 4) ctx.colors = arguments[3]; 1150 if (isBoolean(opts)) { 1151 // legacy... 1152 ctx.showHidden = opts; 1153 } else if (opts) { 1154 // got an "options" object 1155 exports._extend(ctx, opts); 1156 } 1157 // set default options 1158 if (isUndefined(ctx.showHidden)) ctx.showHidden = false; 1159 if (isUndefined(ctx.depth)) ctx.depth = 2; 1160 if (isUndefined(ctx.colors)) ctx.colors = false; 1161 if (isUndefined(ctx.customInspect)) ctx.customInspect = true; 1162 if (ctx.colors) ctx.stylize = stylizeWithColor; 1163 return formatValue(ctx, obj, ctx.depth); 1164 } 1165 exports.inspect = inspect; 1166 1167 1168 // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics 1169 inspect.colors = { 1170 'bold' : [1, 22], 1171 'italic' : [3, 23], 1172 'underline' : [4, 24], 1173 'inverse' : [7, 27], 1174 'white' : [37, 39], 1175 'grey' : [90, 39], 1176 'black' : [30, 39], 1177 'blue' : [34, 39], 1178 'cyan' : [36, 39], 1179 'green' : [32, 39], 1180 'magenta' : [35, 39], 1181 'red' : [31, 39], 1182 'yellow' : [33, 39] 1183 }; 1184 1185 // Don't use 'blue' not visible on cmd.exe 1186 inspect.styles = { 1187 'special': 'cyan', 1188 'number': 'yellow', 1189 'boolean': 'yellow', 1190 'undefined': 'grey', 1191 'null': 'bold', 1192 'string': 'green', 1193 'date': 'magenta', 1194 // "name": intentionally not styling 1195 'regexp': 'red' 1196 }; 1197 1198 1199 function stylizeWithColor(str, styleType) { 1200 var style = inspect.styles[styleType]; 1201 1202 if (style) { 1203 return '\u001b[' + inspect.colors[style][0] + 'm' + str + 1204 '\u001b[' + inspect.colors[style][1] + 'm'; 1205 } else { 1206 return str; 1207 } 1208 } 1209 1210 1211 function stylizeNoColor(str, styleType) { 1212 return str; 1213 } 1214 1215 1216 function arrayToHash(array) { 1217 var hash = {}; 1218 1219 array.forEach(function(val, idx) { 1220 hash[val] = true; 1221 }); 1222 1223 return hash; 1224 } 1225 1226 1227 function formatValue(ctx, value, recurseTimes) { 1228 // Provide a hook for user-specified inspect functions. 1229 // Check that value is an object with an inspect function on it 1230 if (ctx.customInspect && 1231 value && 1232 isFunction(value.inspect) && 1233 // Filter out the util module, it's inspect function is special 1234 value.inspect !== exports.inspect && 1235 // Also filter out any prototype objects using the circular check. 1236 !(value.constructor && value.constructor.prototype === value)) { 1237 var ret = value.inspect(recurseTimes, ctx); 1238 if (!isString(ret)) { 1239 ret = formatValue(ctx, ret, recurseTimes); 1240 } 1241 return ret; 1242 } 1243 1244 // Primitive types cannot have properties 1245 var primitive = formatPrimitive(ctx, value); 1246 if (primitive) { 1247 return primitive; 1248 } 1249 1250 // Look up the keys of the object. 1251 var keys = Object.keys(value); 1252 var visibleKeys = arrayToHash(keys); 1253 1254 if (ctx.showHidden) { 1255 keys = Object.getOwnPropertyNames(value); 1256 } 1257 1258 // IE doesn't make error fields non-enumerable 1259 // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx 1260 if (isError(value) 1261 && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { 1262 return formatError(value); 1263 } 1264 1265 // Some type of object without properties can be shortcutted. 1266 if (keys.length === 0) { 1267 if (isFunction(value)) { 1268 var name = value.name ? ': ' + value.name : ''; 1269 return ctx.stylize('[Function' + name + ']', 'special'); 1270 } 1271 if (isRegExp(value)) { 1272 return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); 1273 } 1274 if (isDate(value)) { 1275 return ctx.stylize(Date.prototype.toString.call(value), 'date'); 1276 } 1277 if (isError(value)) { 1278 return formatError(value); 1279 } 1280 } 1281 1282 var base = '', array = false, braces = ['{', '}']; 1283 1284 // Make Array say that they are Array 1285 if (isArray(value)) { 1286 array = true; 1287 braces = ['[', ']']; 1288 } 1289 1290 // Make functions say that they are functions 1291 if (isFunction(value)) { 1292 var n = value.name ? ': ' + value.name : ''; 1293 base = ' [Function' + n + ']'; 1294 } 1295 1296 // Make RegExps say that they are RegExps 1297 if (isRegExp(value)) { 1298 base = ' ' + RegExp.prototype.toString.call(value); 1299 } 1300 1301 // Make dates with properties first say the date 1302 if (isDate(value)) { 1303 base = ' ' + Date.prototype.toUTCString.call(value); 1304 } 1305 1306 // Make error with message first say the error 1307 if (isError(value)) { 1308 base = ' ' + formatError(value); 1309 } 1310 1311 if (keys.length === 0 && (!array || value.length == 0)) { 1312 return braces[0] + base + braces[1]; 1313 } 1314 1315 if (recurseTimes < 0) { 1316 if (isRegExp(value)) { 1317 return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); 1318 } else { 1319 return ctx.stylize('[Object]', 'special'); 1320 } 1321 } 1322 1323 ctx.seen.push(value); 1324 1325 var output; 1326 if (array) { 1327 output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); 1328 } else { 1329 output = keys.map(function(key) { 1330 return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); 1331 }); 1332 } 1333 1334 ctx.seen.pop(); 1335 1336 return reduceToSingleString(output, base, braces); 1337 } 1338 1339 1340 function formatPrimitive(ctx, value) { 1341 if (isUndefined(value)) 1342 return ctx.stylize('undefined', 'undefined'); 1343 if (isString(value)) { 1344 var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') 1345 .replace(/'/g, "\\'") 1346 .replace(/\\"/g, '"') + '\''; 1347 return ctx.stylize(simple, 'string'); 1348 } 1349 if (isNumber(value)) 1350 return ctx.stylize('' + value, 'number'); 1351 if (isBoolean(value)) 1352 return ctx.stylize('' + value, 'boolean'); 1353 // For some reason typeof null is "object", so special case here. 1354 if (isNull(value)) 1355 return ctx.stylize('null', 'null'); 1356 } 1357 1358 1359 function formatError(value) { 1360 return '[' + Error.prototype.toString.call(value) + ']'; 1361 } 1362 1363 1364 function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { 1365 var output = []; 1366 for (var i = 0, l = value.length; i < l; ++i) { 1367 if (hasOwnProperty(value, String(i))) { 1368 output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, 1369 String(i), true)); 1370 } else { 1371 output.push(''); 1372 } 1373 } 1374 keys.forEach(function(key) { 1375 if (!key.match(/^\d+$/)) { 1376 output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, 1377 key, true)); 1378 } 1379 }); 1380 return output; 1381 } 1382 1383 1384 function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { 1385 var name, str, desc; 1386 desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; 1387 if (desc.get) { 1388 if (desc.set) { 1389 str = ctx.stylize('[Getter/Setter]', 'special'); 1390 } else { 1391 str = ctx.stylize('[Getter]', 'special'); 1392 } 1393 } else { 1394 if (desc.set) { 1395 str = ctx.stylize('[Setter]', 'special'); 1396 } 1397 } 1398 if (!hasOwnProperty(visibleKeys, key)) { 1399 name = '[' + key + ']'; 1400 } 1401 if (!str) { 1402 if (ctx.seen.indexOf(desc.value) < 0) { 1403 if (isNull(recurseTimes)) { 1404 str = formatValue(ctx, desc.value, null); 1405 } else { 1406 str = formatValue(ctx, desc.value, recurseTimes - 1); 1407 } 1408 if (str.indexOf('\n') > -1) { 1409 if (array) { 1410 str = str.split('\n').map(function(line) { 1411 return ' ' + line; 1412 }).join('\n').substr(2); 1413 } else { 1414 str = '\n' + str.split('\n').map(function(line) { 1415 return ' ' + line; 1416 }).join('\n'); 1417 } 1418 } 1419 } else { 1420 str = ctx.stylize('[Circular]', 'special'); 1421 } 1422 } 1423 if (isUndefined(name)) { 1424 if (array && key.match(/^\d+$/)) { 1425 return str; 1426 } 1427 name = JSON.stringify('' + key); 1428 if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { 1429 name = name.substr(1, name.length - 2); 1430 name = ctx.stylize(name, 'name'); 1431 } else { 1432 name = name.replace(/'/g, "\\'") 1433 .replace(/\\"/g, '"') 1434 .replace(/(^"|"$)/g, "'"); 1435 name = ctx.stylize(name, 'string'); 1436 } 1437 } 1438 1439 return name + ': ' + str; 1440 } 1441 1442 1443 function reduceToSingleString(output, base, braces) { 1444 var numLinesEst = 0; 1445 var length = output.reduce(function(prev, cur) { 1446 numLinesEst++; 1447 if (cur.indexOf('\n') >= 0) numLinesEst++; 1448 return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; 1449 }, 0); 1450 1451 if (length > 60) { 1452 return braces[0] + 1453 (base === '' ? '' : base + '\n ') + 1454 ' ' + 1455 output.join(',\n ') + 1456 ' ' + 1457 braces[1]; 1458 } 1459 1460 return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; 1461 } 1462 1463 1464 // NOTE: These type checking functions intentionally don't use `instanceof` 1465 // because it is fragile and can be easily faked with `Object.create()`. 1466 function isArray(ar) { 1467 return Array.isArray(ar); 1468 } 1469 exports.isArray = isArray; 1470 1471 function isBoolean(arg) { 1472 return typeof arg === 'boolean'; 1473 } 1474 exports.isBoolean = isBoolean; 1475 1476 function isNull(arg) { 1477 return arg === null; 1478 } 1479 exports.isNull = isNull; 1480 1481 function isNullOrUndefined(arg) { 1482 return arg == null; 1483 } 1484 exports.isNullOrUndefined = isNullOrUndefined; 1485 1486 function isNumber(arg) { 1487 return typeof arg === 'number'; 1488 } 1489 exports.isNumber = isNumber; 1490 1491 function isString(arg) { 1492 return typeof arg === 'string'; 1493 } 1494 exports.isString = isString; 1495 1496 function isSymbol(arg) { 1497 return typeof arg === 'symbol'; 1498 } 1499 exports.isSymbol = isSymbol; 1500 1501 function isUndefined(arg) { 1502 return arg === void 0; 1503 } 1504 exports.isUndefined = isUndefined; 1505 1506 function isRegExp(re) { 1507 return isObject(re) && objectToString(re) === '[object RegExp]'; 1508 } 1509 exports.isRegExp = isRegExp; 1510 1511 function isObject(arg) { 1512 return typeof arg === 'object' && arg !== null; 1513 } 1514 exports.isObject = isObject; 1515 1516 function isDate(d) { 1517 return isObject(d) && objectToString(d) === '[object Date]'; 1518 } 1519 exports.isDate = isDate; 1520 1521 function isError(e) { 1522 return isObject(e) && 1523 (objectToString(e) === '[object Error]' || e instanceof Error); 1524 } 1525 exports.isError = isError; 1526 1527 function isFunction(arg) { 1528 return typeof arg === 'function'; 1529 } 1530 exports.isFunction = isFunction; 1531 1532 function isPrimitive(arg) { 1533 return arg === null || 1534 typeof arg === 'boolean' || 1535 typeof arg === 'number' || 1536 typeof arg === 'string' || 1537 typeof arg === 'symbol' || // ES6 symbol 1538 typeof arg === 'undefined'; 1539 } 1540 exports.isPrimitive = isPrimitive; 1541 1542 exports.isBuffer = __webpack_require__(9); 1543 1544 function objectToString(o) { 1545 return Object.prototype.toString.call(o); 1546 } 1547 1548 1549 function pad(n) { 1550 return n < 10 ? '0' + n.toString(10) : n.toString(10); 1551 } 1552 1553 1554 var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 1555 'Oct', 'Nov', 'Dec']; 1556 1557 // 26 Feb 16:19:34 1558 function timestamp() { 1559 var d = new Date(); 1560 var time = [pad(d.getHours()), 1561 pad(d.getMinutes()), 1562 pad(d.getSeconds())].join(':'); 1563 return [d.getDate(), months[d.getMonth()], time].join(' '); 1564 } 1565 1566 1567 // log is just a thin wrapper to console.log that prepends a timestamp 1568 exports.log = function() { 1569 console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); 1570 }; 1571 1572 1573 /** 1574 * Inherit the prototype methods from one constructor into another. 1575 * 1576 * The Function.prototype.inherits from lang.js rewritten as a standalone 1577 * function (not on Function.prototype). NOTE: If this file is to be loaded 1578 * during bootstrapping this function needs to be rewritten using some native 1579 * functions as prototype setup using normal JavaScript does not work as 1580 * expected during bootstrapping (see mirror.js in r114903). 1581 * 1582 * @param {function} ctor Constructor function which needs to inherit the 1583 * prototype. 1584 * @param {function} superCtor Constructor function to inherit prototype from. 1585 */ 1586 exports.inherits = __webpack_require__(10); 1587 1588 exports._extend = function(origin, add) { 1589 // Don't do anything if add isn't an object 1590 if (!add || !isObject(add)) return origin; 1591 1592 var keys = Object.keys(add); 1593 var i = keys.length; 1594 while (i--) { 1595 origin[keys[i]] = add[keys[i]]; 1596 } 1597 return origin; 1598 }; 1599 1600 function hasOwnProperty(obj, prop) { 1601 return Object.prototype.hasOwnProperty.call(obj, prop); 1602 } 1603 1604 var kCustomPromisifiedSymbol = typeof Symbol !== 'undefined' ? Symbol('util.promisify.custom') : undefined; 1605 1606 exports.promisify = function promisify(original) { 1607 if (typeof original !== 'function') 1608 throw new TypeError('The "original" argument must be of type Function'); 1609 1610 if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) { 1611 var fn = original[kCustomPromisifiedSymbol]; 1612 if (typeof fn !== 'function') { 1613 throw new TypeError('The "util.promisify.custom" argument must be of type Function'); 1614 } 1615 Object.defineProperty(fn, kCustomPromisifiedSymbol, { 1616 value: fn, enumerable: false, writable: false, configurable: true 1617 }); 1618 return fn; 1619 } 1620 1621 function fn() { 1622 var promiseResolve, promiseReject; 1623 var promise = new Promise(function (resolve, reject) { 1624 promiseResolve = resolve; 1625 promiseReject = reject; 1626 }); 1627 1628 var args = []; 1629 for (var i = 0; i < arguments.length; i++) { 1630 args.push(arguments[i]); 1631 } 1632 args.push(function (err, value) { 1633 if (err) { 1634 promiseReject(err); 1635 } else { 1636 promiseResolve(value); 1637 } 1638 }); 1639 1640 try { 1641 original.apply(this, args); 1642 } catch (err) { 1643 promiseReject(err); 1644 } 1645 1646 return promise; 1647 } 1648 1649 Object.setPrototypeOf(fn, Object.getPrototypeOf(original)); 1650 1651 if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, { 1652 value: fn, enumerable: false, writable: false, configurable: true 1653 }); 1654 return Object.defineProperties( 1655 fn, 1656 getOwnPropertyDescriptors(original) 1657 ); 1658 } 1659 1660 exports.promisify.custom = kCustomPromisifiedSymbol 1661 1662 function callbackifyOnRejected(reason, cb) { 1663 // `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M). 1664 // Because `null` is a special error value in callbacks which means "no error 1665 // occurred", we error-wrap so the callback consumer can distinguish between 1666 // "the promise rejected with null" or "the promise fulfilled with undefined". 1667 if (!reason) { 1668 var newReason = new Error('Promise was rejected with a falsy value'); 1669 newReason.reason = reason; 1670 reason = newReason; 1671 } 1672 return cb(reason); 1673 } 1674 1675 function callbackify(original) { 1676 if (typeof original !== 'function') { 1677 throw new TypeError('The "original" argument must be of type Function'); 1678 } 1679 1680 // We DO NOT return the promise as it gives the user a false sense that 1681 // the promise is actually somehow related to the callback's execution 1682 // and that the callback throwing will reject the promise. 1683 function callbackified() { 1684 var args = []; 1685 for (var i = 0; i < arguments.length; i++) { 1686 args.push(arguments[i]); 1687 } 1688 1689 var maybeCb = args.pop(); 1690 if (typeof maybeCb !== 'function') { 1691 throw new TypeError('The last argument must be of type Function'); 1692 } 1693 var self = this; 1694 var cb = function() { 1695 return maybeCb.apply(self, arguments); 1696 }; 1697 // In true node style we process the callback on `nextTick` with all the 1698 // implications (stack, `uncaughtException`, `async_hooks`) 1699 original.apply(this, args) 1700 .then(function(ret) { process.nextTick(cb, null, ret) }, 1701 function(rej) { process.nextTick(callbackifyOnRejected, rej, cb) }); 1702 } 1703 1704 Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original)); 1705 Object.defineProperties(callbackified, 1706 getOwnPropertyDescriptors(original)); 1707 return callbackified; 1708 } 1709 exports.callbackify = callbackify; 1710 1711 /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(2))) 1712 1713 /***/ }), 1714 /* 7 */ 1715 /***/ (function(module, exports, __webpack_require__) { 1716 1717 "use strict"; 1718 /*! 1719 * fill-range <https://github.com/jonschlinkert/fill-range> 1720 * 1721 * Copyright (c) 2014-present, Jon Schlinkert. 1722 * Licensed under the MIT License. 1723 */ 1724 1725 1726 1727 const util = __webpack_require__(6); 1728 const toRegexRange = __webpack_require__(13); 1729 1730 const isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val); 1731 1732 const transform = toNumber => { 1733 return value => toNumber === true ? Number(value) : String(value); 1734 }; 1735 1736 const isValidValue = value => { 1737 return typeof value === 'number' || (typeof value === 'string' && value !== ''); 1738 }; 1739 1740 const isNumber = num => Number.isInteger(+num); 1741 1742 const zeros = input => { 1743 let value = `${input}`; 1744 let index = -1; 1745 if (value[0] === '-') value = value.slice(1); 1746 if (value === '0') return false; 1747 while (value[++index] === '0'); 1748 return index > 0; 1749 }; 1750 1751 const stringify = (start, end, options) => { 1752 if (typeof start === 'string' || typeof end === 'string') { 1753 return true; 1754 } 1755 return options.stringify === true; 1756 }; 1757 1758 const pad = (input, maxLength, toNumber) => { 1759 if (maxLength > 0) { 1760 let dash = input[0] === '-' ? '-' : ''; 1761 if (dash) input = input.slice(1); 1762 input = (dash + input.padStart(dash ? maxLength - 1 : maxLength, '0')); 1763 } 1764 if (toNumber === false) { 1765 return String(input); 1766 } 1767 return input; 1768 }; 1769 1770 const toMaxLen = (input, maxLength) => { 1771 let negative = input[0] === '-' ? '-' : ''; 1772 if (negative) { 1773 input = input.slice(1); 1774 maxLength--; 1775 } 1776 while (input.length < maxLength) input = '0' + input; 1777 return negative ? ('-' + input) : input; 1778 }; 1779 1780 const toSequence = (parts, options) => { 1781 parts.negatives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0); 1782 parts.positives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0); 1783 1784 let prefix = options.capture ? '' : '?:'; 1785 let positives = ''; 1786 let negatives = ''; 1787 let result; 1788 1789 if (parts.positives.length) { 1790 positives = parts.positives.join('|'); 1791 } 1792 1793 if (parts.negatives.length) { 1794 negatives = `-(${prefix}${parts.negatives.join('|')})`; 1795 } 1796 1797 if (positives && negatives) { 1798 result = `${positives}|${negatives}`; 1799 } else { 1800 result = positives || negatives; 1801 } 1802 1803 if (options.wrap) { 1804 return `(${prefix}${result})`; 1805 } 1806 1807 return result; 1808 }; 1809 1810 const toRange = (a, b, isNumbers, options) => { 1811 if (isNumbers) { 1812 return toRegexRange(a, b, { wrap: false, ...options }); 1813 } 1814 1815 let start = String.fromCharCode(a); 1816 if (a === b) return start; 1817 1818 let stop = String.fromCharCode(b); 1819 return `[${start}-${stop}]`; 1820 }; 1821 1822 const toRegex = (start, end, options) => { 1823 if (Array.isArray(start)) { 1824 let wrap = options.wrap === true; 1825 let prefix = options.capture ? '' : '?:'; 1826 return wrap ? `(${prefix}${start.join('|')})` : start.join('|'); 1827 } 1828 return toRegexRange(start, end, options); 1829 }; 1830 1831 const rangeError = (...args) => { 1832 return new RangeError('Invalid range arguments: ' + util.inspect(...args)); 1833 }; 1834 1835 const invalidRange = (start, end, options) => { 1836 if (options.strictRanges === true) throw rangeError([start, end]); 1837 return []; 1838 }; 1839 1840 const invalidStep = (step, options) => { 1841 if (options.strictRanges === true) { 1842 throw new TypeError(`Expected step "${step}" to be a number`); 1843 } 1844 return []; 1845 }; 1846 1847 const fillNumbers = (start, end, step = 1, options = {}) => { 1848 let a = Number(start); 1849 let b = Number(end); 1850 1851 if (!Number.isInteger(a) || !Number.isInteger(b)) { 1852 if (options.strictRanges === true) throw rangeError([start, end]); 1853 return []; 1854 } 1855 1856 // fix negative zero 1857 if (a === 0) a = 0; 1858 if (b === 0) b = 0; 1859 1860 let descending = a > b; 1861 let startString = String(start); 1862 let endString = String(end); 1863 let stepString = String(step); 1864 step = Math.max(Math.abs(step), 1); 1865 1866 let padded = zeros(startString) || zeros(endString) || zeros(stepString); 1867 let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0; 1868 let toNumber = padded === false && stringify(start, end, options) === false; 1869 let format = options.transform || transform(toNumber); 1870 1871 if (options.toRegex && step === 1) { 1872 return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options); 1873 } 1874 1875 let parts = { negatives: [], positives: [] }; 1876 let push = num => parts[num < 0 ? 'negatives' : 'positives'].push(Math.abs(num)); 1877 let range = []; 1878 let index = 0; 1879 1880 while (descending ? a >= b : a <= b) { 1881 if (options.toRegex === true && step > 1) { 1882 push(a); 1883 } else { 1884 range.push(pad(format(a, index), maxLen, toNumber)); 1885 } 1886 a = descending ? a - step : a + step; 1887 index++; 1888 } 1889 1890 if (options.toRegex === true) { 1891 return step > 1 1892 ? toSequence(parts, options) 1893 : toRegex(range, null, { wrap: false, ...options }); 1894 } 1895 1896 return range; 1897 }; 1898 1899 const fillLetters = (start, end, step = 1, options = {}) => { 1900 if ((!isNumber(start) && start.length > 1) || (!isNumber(end) && end.length > 1)) { 1901 return invalidRange(start, end, options); 1902 } 1903 1904 1905 let format = options.transform || (val => String.fromCharCode(val)); 1906 let a = `${start}`.charCodeAt(0); 1907 let b = `${end}`.charCodeAt(0); 1908 1909 let descending = a > b; 1910 let min = Math.min(a, b); 1911 let max = Math.max(a, b); 1912 1913 if (options.toRegex && step === 1) { 1914 return toRange(min, max, false, options); 1915 } 1916 1917 let range = []; 1918 let index = 0; 1919 1920 while (descending ? a >= b : a <= b) { 1921 range.push(format(a, index)); 1922 a = descending ? a - step : a + step; 1923 index++; 1924 } 1925 1926 if (options.toRegex === true) { 1927 return toRegex(range, null, { wrap: false, options }); 1928 } 1929 1930 return range; 1931 }; 1932 1933 const fill = (start, end, step, options = {}) => { 1934 if (end == null && isValidValue(start)) { 1935 return [start]; 1936 } 1937 1938 if (!isValidValue(start) || !isValidValue(end)) { 1939 return invalidRange(start, end, options); 1940 } 1941 1942 if (typeof step === 'function') { 1943 return fill(start, end, 1, { transform: step }); 1944 } 1945 1946 if (isObject(step)) { 1947 return fill(start, end, 0, step); 1948 } 1949 1950 let opts = { ...options }; 1951 if (opts.capture === true) opts.wrap = true; 1952 step = step || opts.step || 1; 1953 1954 if (!isNumber(step)) { 1955 if (step != null && !isObject(step)) return invalidStep(step, opts); 1956 return fill(start, end, 1, step); 1957 } 1958 1959 if (isNumber(start) && isNumber(end)) { 1960 return fillNumbers(start, end, step, opts); 1961 } 1962 1963 return fillLetters(start, end, Math.max(Math.abs(step), 1), opts); 1964 }; 1965 1966 module.exports = fill; 1967 1968 1969 /***/ }), 1970 /* 8 */ 1971 /***/ (function(module, exports, __webpack_require__) { 1972 1973 "use strict"; 1974 1975 1976 const util = __webpack_require__(6); 1977 const braces = __webpack_require__(11); 1978 const picomatch = __webpack_require__(18); 1979 const utils = __webpack_require__(0); 1980 const isEmptyString = val => val === '' || val === './'; 1981 1982 /** 1983 * Returns an array of strings that match one or more glob patterns. 1984 * 1985 * ```js 1986 * const mm = require('micromatch'); 1987 * // mm(list, patterns[, options]); 1988 * 1989 * console.log(mm(['a.js', 'a.txt'], ['*.js'])); 1990 * //=> [ 'a.js' ] 1991 * ``` 1992 * @param {String|Array<string>} `list` List of strings to match. 1993 * @param {String|Array<string>} `patterns` One or more glob patterns to use for matching. 1994 * @param {Object} `options` See available [options](#options) 1995 * @return {Array} Returns an array of matches 1996 * @summary false 1997 * @api public 1998 */ 1999 2000 const micromatch = (list, patterns, options) => { 2001 patterns = [].concat(patterns); 2002 list = [].concat(list); 2003 2004 let omit = new Set(); 2005 let keep = new Set(); 2006 let items = new Set(); 2007 let negatives = 0; 2008 2009 let onResult = state => { 2010 items.add(state.output); 2011 if (options && options.onResult) { 2012 options.onResult(state); 2013 } 2014 }; 2015 2016 for (let i = 0; i < patterns.length; i++) { 2017 let isMatch = picomatch(String(patterns[i]), { ...options, onResult }, true); 2018 let negated = isMatch.state.negated || isMatch.state.negatedExtglob; 2019 if (negated) negatives++; 2020 2021 for (let item of list) { 2022 let matched = isMatch(item, true); 2023 2024 let match = negated ? !matched.isMatch : matched.isMatch; 2025 if (!match) continue; 2026 2027 if (negated) { 2028 omit.add(matched.output); 2029 } else { 2030 omit.delete(matched.output); 2031 keep.add(matched.output); 2032 } 2033 } 2034 } 2035 2036 let result = negatives === patterns.length ? [...items] : [...keep]; 2037 let matches = result.filter(item => !omit.has(item)); 2038 2039 if (options && matches.length === 0) { 2040 if (options.failglob === true) { 2041 throw new Error(`No matches found for "${patterns.join(', ')}"`); 2042 } 2043 2044 if (options.nonull === true || options.nullglob === true) { 2045 return options.unescape ? patterns.map(p => p.replace(/\\/g, '')) : patterns; 2046 } 2047 } 2048 2049 return matches; 2050 }; 2051 2052 /** 2053 * Backwards compatibility 2054 */ 2055 2056 micromatch.match = micromatch; 2057 2058 /** 2059 * Returns a matcher function from the given glob `pattern` and `options`. 2060 * The returned function takes a string to match as its only argument and returns 2061 * true if the string is a match. 2062 * 2063 * ```js 2064 * const mm = require('micromatch'); 2065 * // mm.matcher(pattern[, options]); 2066 * 2067 * const isMatch = mm.matcher('*.!(*a)'); 2068 * console.log(isMatch('a.a')); //=> false 2069 * console.log(isMatch('a.b')); //=> true 2070 * ``` 2071 * @param {String} `pattern` Glob pattern 2072 * @param {Object} `options` 2073 * @return {Function} Returns a matcher function. 2074 * @api public 2075 */ 2076 2077 micromatch.matcher = (pattern, options) => picomatch(pattern, options); 2078 2079 /** 2080 * Returns true if **any** of the given glob `patterns` match the specified `string`. 2081 * 2082 * ```js 2083 * const mm = require('micromatch'); 2084 * // mm.isMatch(string, patterns[, options]); 2085 * 2086 * console.log(mm.isMatch('a.a', ['b.*', '*.a'])); //=> true 2087 * console.log(mm.isMatch('a.a', 'b.*')); //=> false 2088 * ``` 2089 * @param {String} `str` The string to test. 2090 * @param {String|Array} `patterns` One or more glob patterns to use for matching. 2091 * @param {Object} `[options]` See available [options](#options). 2092 * @return {Boolean} Returns true if any patterns match `str` 2093 * @api public 2094 */ 2095 2096 micromatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str); 2097 2098 /** 2099 * Backwards compatibility 2100 */ 2101 2102 micromatch.any = micromatch.isMatch; 2103 2104 /** 2105 * Returns a list of strings that _**do not match any**_ of the given `patterns`. 2106 * 2107 * ```js 2108 * const mm = require('micromatch'); 2109 * // mm.not(list, patterns[, options]); 2110 * 2111 * console.log(mm.not(['a.a', 'b.b', 'c.c'], '*.a')); 2112 * //=> ['b.b', 'c.c'] 2113 * ``` 2114 * @param {Array} `list` Array of strings to match. 2115 * @param {String|Array} `patterns` One or more glob pattern to use for matching. 2116 * @param {Object} `options` See available [options](#options) for changing how matches are performed 2117 * @return {Array} Returns an array of strings that **do not match** the given patterns. 2118 * @api public 2119 */ 2120 2121 micromatch.not = (list, patterns, options = {}) => { 2122 patterns = [].concat(patterns).map(String); 2123 let result = new Set(); 2124 let items = []; 2125 2126 let onResult = state => { 2127 if (options.onResult) options.onResult(state); 2128 items.push(state.output); 2129 }; 2130 2131 let matches = new Set(micromatch(list, patterns, { ...options, onResult })); 2132 2133 for (let item of items) { 2134 if (!matches.has(item)) { 2135 result.add(item); 2136 } 2137 } 2138 return [...result]; 2139 }; 2140 2141 /** 2142 * Returns true if the given `string` contains the given pattern. Similar 2143 * to [.isMatch](#isMatch) but the pattern can match any part of the string. 2144 * 2145 * ```js 2146 * var mm = require('micromatch'); 2147 * // mm.contains(string, pattern[, options]); 2148 * 2149 * console.log(mm.contains('aa/bb/cc', '*b')); 2150 * //=> true 2151 * console.log(mm.contains('aa/bb/cc', '*d')); 2152 * //=> false 2153 * ``` 2154 * @param {String} `str` The string to match. 2155 * @param {String|Array} `patterns` Glob pattern to use for matching. 2156 * @param {Object} `options` See available [options](#options) for changing how matches are performed 2157 * @return {Boolean} Returns true if any of the patterns matches any part of `str`. 2158 * @api public 2159 */ 2160 2161 micromatch.contains = (str, pattern, options) => { 2162 if (typeof str !== 'string') { 2163 throw new TypeError(`Expected a string: "${util.inspect(str)}"`); 2164 } 2165 2166 if (Array.isArray(pattern)) { 2167 return pattern.some(p => micromatch.contains(str, p, options)); 2168 } 2169 2170 if (typeof pattern === 'string') { 2171 if (isEmptyString(str) || isEmptyString(pattern)) { 2172 return false; 2173 } 2174 2175 if (str.includes(pattern) || (str.startsWith('./') && str.slice(2).includes(pattern))) { 2176 return true; 2177 } 2178 } 2179 2180 return micromatch.isMatch(str, pattern, { ...options, contains: true }); 2181 }; 2182 2183 /** 2184 * Filter the keys of the given object with the given `glob` pattern 2185 * and `options`. Does not attempt to match nested keys. If you need this feature, 2186 * use [glob-object][] instead. 2187 * 2188 * ```js 2189 * const mm = require('micromatch'); 2190 * // mm.matchKeys(object, patterns[, options]); 2191 * 2192 * const obj = { aa: 'a', ab: 'b', ac: 'c' }; 2193 * console.log(mm.matchKeys(obj, '*b')); 2194 * //=> { ab: 'b' } 2195 * ``` 2196 * @param {Object} `object` The object with keys to filter. 2197 * @param {String|Array} `patterns` One or more glob patterns to use for matching. 2198 * @param {Object} `options` See available [options](#options) for changing how matches are performed 2199 * @return {Object} Returns an object with only keys that match the given patterns. 2200 * @api public 2201 */ 2202 2203 micromatch.matchKeys = (obj, patterns, options) => { 2204 if (!utils.isObject(obj)) { 2205 throw new TypeError('Expected the first argument to be an object'); 2206 } 2207 let keys = micromatch(Object.keys(obj), patterns, options); 2208 let res = {}; 2209 for (let key of keys) res[key] = obj[key]; 2210 return res; 2211 }; 2212 2213 /** 2214 * Returns true if some of the strings in the given `list` match any of the given glob `patterns`. 2215 * 2216 * ```js 2217 * const mm = require('micromatch'); 2218 * // mm.some(list, patterns[, options]); 2219 * 2220 * console.log(mm.some(['foo.js', 'bar.js'], ['*.js', '!foo.js'])); 2221 * // true 2222 * console.log(mm.some(['foo.js'], ['*.js', '!foo.js'])); 2223 * // false 2224 * ``` 2225 * @param {String|Array} `list` The string or array of strings to test. Returns as soon as the first match is found. 2226 * @param {String|Array} `patterns` One or more glob patterns to use for matching. 2227 * @param {Object} `options` See available [options](#options) for changing how matches are performed 2228 * @return {Boolean} Returns true if any `patterns` matches any of the strings in `list` 2229 * @api public 2230 */ 2231 2232 micromatch.some = (list, patterns, options) => { 2233 let items = [].concat(list); 2234 2235 for (let pattern of [].concat(patterns)) { 2236 let isMatch = picomatch(String(pattern), options); 2237 if (items.some(item => isMatch(item))) { 2238 return true; 2239 } 2240 } 2241 return false; 2242 }; 2243 2244 /** 2245 * Returns true if every string in the given `list` matches 2246 * any of the given glob `patterns`. 2247 * 2248 * ```js 2249 * const mm = require('micromatch'); 2250 * // mm.every(list, patterns[, options]); 2251 * 2252 * console.log(mm.every('foo.js', ['foo.js'])); 2253 * // true 2254 * console.log(mm.every(['foo.js', 'bar.js'], ['*.js'])); 2255 * // true 2256 * console.log(mm.every(['foo.js', 'bar.js'], ['*.js', '!foo.js'])); 2257 * // false 2258 * console.log(mm.every(['foo.js'], ['*.js', '!foo.js'])); 2259 * // false 2260 * ``` 2261 * @param {String|Array} `list` The string or array of strings to test. 2262 * @param {String|Array} `patterns` One or more glob patterns to use for matching. 2263 * @param {Object} `options` See available [options](#options) for changing how matches are performed 2264 * @return {Boolean} Returns true if all `patterns` matches all of the strings in `list` 2265 * @api public 2266 */ 2267 2268 micromatch.every = (list, patterns, options) => { 2269 let items = [].concat(list); 2270 2271 for (let pattern of [].concat(patterns)) { 2272 let isMatch = picomatch(String(pattern), options); 2273 if (!items.every(item => isMatch(item))) { 2274 return false; 2275 } 2276 } 2277 return true; 2278 }; 2279 2280 /** 2281 * Returns true if **all** of the given `patterns` match 2282 * the specified string. 2283 * 2284 * ```js 2285 * const mm = require('micromatch'); 2286 * // mm.all(string, patterns[, options]); 2287 * 2288 * console.log(mm.all('foo.js', ['foo.js'])); 2289 * // true 2290 * 2291 * console.log(mm.all('foo.js', ['*.js', '!foo.js'])); 2292 * // false 2293 * 2294 * console.log(mm.all('foo.js', ['*.js', 'foo.js'])); 2295 * // true 2296 * 2297 * console.log(mm.all('foo.js', ['*.js', 'f*', '*o*', '*o.js'])); 2298 * // true 2299 * ``` 2300 * @param {String|Array} `str` The string to test. 2301 * @param {String|Array} `patterns` One or more glob patterns to use for matching. 2302 * @param {Object} `options` See available [options](#options) for changing how matches are performed 2303 * @return {Boolean} Returns true if any patterns match `str` 2304 * @api public 2305 */ 2306 2307 micromatch.all = (str, patterns, options) => { 2308 if (typeof str !== 'string') { 2309 throw new TypeError(`Expected a string: "${util.inspect(str)}"`); 2310 } 2311 2312 return [].concat(patterns).every(p => picomatch(p, options)(str)); 2313 }; 2314 2315 /** 2316 * Returns an array of matches captured by `pattern` in `string, or `null` if the pattern did not match. 2317 * 2318 * ```js 2319 * const mm = require('micromatch'); 2320 * // mm.capture(pattern, string[, options]); 2321 * 2322 * console.log(mm.capture('test/*.js', 'test/foo.js')); 2323 * //=> ['foo'] 2324 * console.log(mm.capture('test/*.js', 'foo/bar.css')); 2325 * //=> null 2326 * ``` 2327 * @param {String} `glob` Glob pattern to use for matching. 2328 * @param {String} `input` String to match 2329 * @param {Object} `options` See available [options](#options) for changing how matches are performed 2330 * @return {Array|null} Returns an array of captures if the input matches the glob pattern, otherwise `null`. 2331 * @api public 2332 */ 2333 2334 micromatch.capture = (glob, input, options) => { 2335 let posix = utils.isWindows(options); 2336 let regex = picomatch.makeRe(String(glob), { ...options, capture: true }); 2337 let match = regex.exec(posix ? utils.toPosixSlashes(input) : input); 2338 2339 if (match) { 2340 return match.slice(1).map(v => v === void 0 ? '' : v); 2341 } 2342 }; 2343 2344 /** 2345 * Create a regular expression from the given glob `pattern`. 2346 * 2347 * ```js 2348 * const mm = require('micromatch'); 2349 * // mm.makeRe(pattern[, options]); 2350 * 2351 * console.log(mm.makeRe('*.js')); 2352 * //=> /^(?:(\.[\\\/])?(?!\.)(?=.)[^\/]*?\.js)$/ 2353 * ``` 2354 * @param {String} `pattern` A glob pattern to convert to regex. 2355 * @param {Object} `options` 2356 * @return {RegExp} Returns a regex created from the given pattern. 2357 * @api public 2358 */ 2359 2360 micromatch.makeRe = (...args) => picomatch.makeRe(...args); 2361 2362 /** 2363 * Scan a glob pattern to separate the pattern into segments. Used 2364 * by the [split](#split) method. 2365 * 2366 * ```js 2367 * const mm = require('micromatch'); 2368 * const state = mm.scan(pattern[, options]); 2369 * ``` 2370 * @param {String} `pattern` 2371 * @param {Object} `options` 2372 * @return {Object} Returns an object with 2373 * @api public 2374 */ 2375 2376 micromatch.scan = (...args) => picomatch.scan(...args); 2377 2378 /** 2379 * Parse a glob pattern to create the source string for a regular 2380 * expression. 2381 * 2382 * ```js 2383 * const mm = require('micromatch'); 2384 * const state = mm.parse(pattern[, options]); 2385 * ``` 2386 * @param {String} `glob` 2387 * @param {Object} `options` 2388 * @return {Object} Returns an object with useful properties and output to be used as regex source string. 2389 * @api public 2390 */ 2391 2392 micromatch.parse = (patterns, options) => { 2393 let res = []; 2394 for (let pattern of [].concat(patterns || [])) { 2395 for (let str of braces(String(pattern), options)) { 2396 res.push(picomatch.parse(str, options)); 2397 } 2398 } 2399 return res; 2400 }; 2401 2402 /** 2403 * Process the given brace `pattern`. 2404 * 2405 * ```js 2406 * const { braces } = require('micromatch'); 2407 * console.log(braces('foo/{a,b,c}/bar')); 2408 * //=> [ 'foo/(a|b|c)/bar' ] 2409 * 2410 * console.log(braces('foo/{a,b,c}/bar', { expand: true })); 2411 * //=> [ 'foo/a/bar', 'foo/b/bar', 'foo/c/bar' ] 2412 * ``` 2413 * @param {String} `pattern` String with brace pattern to process. 2414 * @param {Object} `options` Any [options](#options) to change how expansion is performed. See the [braces][] library for all available options. 2415 * @return {Array} 2416 * @api public 2417 */ 2418 2419 micromatch.braces = (pattern, options) => { 2420 if (typeof pattern !== 'string') throw new TypeError('Expected a string'); 2421 if ((options && options.nobrace === true) || !/\{.*\}/.test(pattern)) { 2422 return [pattern]; 2423 } 2424 return braces(pattern, options); 2425 }; 2426 2427 /** 2428 * Expand braces 2429 */ 2430 2431 micromatch.braceExpand = (pattern, options) => { 2432 if (typeof pattern !== 'string') throw new TypeError('Expected a string'); 2433 return micromatch.braces(pattern, { ...options, expand: true }); 2434 }; 2435 2436 /** 2437 * Expose micromatch 2438 */ 2439 2440 module.exports = micromatch; 2441 2442 2443 /***/ }), 2444 /* 9 */ 2445 /***/ (function(module, exports) { 2446 2447 module.exports = function isBuffer(arg) { 2448 return arg && typeof arg === 'object' 2449 && typeof arg.copy === 'function' 2450 && typeof arg.fill === 'function' 2451 && typeof arg.readUInt8 === 'function'; 2452 } 2453 2454 /***/ }), 2455 /* 10 */ 2456 /***/ (function(module, exports) { 2457 2458 if (typeof Object.create === 'function') { 2459 // implementation from standard node.js 'util' module 2460 module.exports = function inherits(ctor, superCtor) { 2461 ctor.super_ = superCtor 2462 ctor.prototype = Object.create(superCtor.prototype, { 2463 constructor: { 2464 value: ctor, 2465 enumerable: false, 2466 writable: true, 2467 configurable: true 2468 } 2469 }); 2470 }; 2471 } else { 2472 // old school shim for old browsers 2473 module.exports = function inherits(ctor, superCtor) { 2474 ctor.super_ = superCtor 2475 var TempCtor = function () {} 2476 TempCtor.prototype = superCtor.prototype 2477 ctor.prototype = new TempCtor() 2478 ctor.prototype.constructor = ctor 2479 } 2480 } 2481 2482 2483 /***/ }), 2484 /* 11 */ 2485 /***/ (function(module, exports, __webpack_require__) { 2486 2487 "use strict"; 2488 2489 2490 const stringify = __webpack_require__(3); 2491 const compile = __webpack_require__(12); 2492 const expand = __webpack_require__(15); 2493 const parse = __webpack_require__(16); 2494 2495 /** 2496 * Expand the given pattern or create a regex-compatible string. 2497 * 2498 * ```js 2499 * const braces = require('braces'); 2500 * console.log(braces('{a,b,c}', { compile: true })); //=> ['(a|b|c)'] 2501 * console.log(braces('{a,b,c}')); //=> ['a', 'b', 'c'] 2502 * ``` 2503 * @param {String} `str` 2504 * @param {Object} `options` 2505 * @return {String} 2506 * @api public 2507 */ 2508 2509 const braces = (input, options = {}) => { 2510 let output = []; 2511 2512 if (Array.isArray(input)) { 2513 for (let pattern of input) { 2514 let result = braces.create(pattern, options); 2515 if (Array.isArray(result)) { 2516 output.push(...result); 2517 } else { 2518 output.push(result); 2519 } 2520 } 2521 } else { 2522 output = [].concat(braces.create(input, options)); 2523 } 2524 2525 if (options && options.expand === true && options.nodupes === true) { 2526 output = [...new Set(output)]; 2527 } 2528 return output; 2529 }; 2530 2531 /** 2532 * Parse the given `str` with the given `options`. 2533 * 2534 * ```js 2535 * // braces.parse(pattern, [, options]); 2536 * const ast = braces.parse('a/{b,c}/d'); 2537 * console.log(ast); 2538 * ``` 2539 * @param {String} pattern Brace pattern to parse 2540 * @param {Object} options 2541 * @return {Object} Returns an AST 2542 * @api public 2543 */ 2544 2545 braces.parse = (input, options = {}) => parse(input, options); 2546 2547 /** 2548 * Creates a braces string from an AST, or an AST node. 2549 * 2550 * ```js 2551 * const braces = require('braces'); 2552 * let ast = braces.parse('foo/{a,b}/bar'); 2553 * console.log(stringify(ast.nodes[2])); //=> '{a,b}' 2554 * ``` 2555 * @param {String} `input` Brace pattern or AST. 2556 * @param {Object} `options` 2557 * @return {Array} Returns an array of expanded values. 2558 * @api public 2559 */ 2560 2561 braces.stringify = (input, options = {}) => { 2562 if (typeof input === 'string') { 2563 return stringify(braces.parse(input, options), options); 2564 } 2565 return stringify(input, options); 2566 }; 2567 2568 /** 2569 * Compiles a brace pattern into a regex-compatible, optimized string. 2570 * This method is called by the main [braces](#braces) function by default. 2571 * 2572 * ```js 2573 * const braces = require('braces'); 2574 * console.log(braces.compile('a/{b,c}/d')); 2575 * //=> ['a/(b|c)/d'] 2576 * ``` 2577 * @param {String} `input` Brace pattern or AST. 2578 * @param {Object} `options` 2579 * @return {Array} Returns an array of expanded values. 2580 * @api public 2581 */ 2582 2583 braces.compile = (input, options = {}) => { 2584 if (typeof input === 'string') { 2585 input = braces.parse(input, options); 2586 } 2587 return compile(input, options); 2588 }; 2589 2590 /** 2591 * Expands a brace pattern into an array. This method is called by the 2592 * main [braces](#braces) function when `options.expand` is true. Before 2593 * using this method it's recommended that you read the [performance notes](#performance)) 2594 * and advantages of using [.compile](#compile) instead. 2595 * 2596 * ```js 2597 * const braces = require('braces'); 2598 * console.log(braces.expand('a/{b,c}/d')); 2599 * //=> ['a/b/d', 'a/c/d']; 2600 * ``` 2601 * @param {String} `pattern` Brace pattern 2602 * @param {Object} `options` 2603 * @return {Array} Returns an array of expanded values. 2604 * @api public 2605 */ 2606 2607 braces.expand = (input, options = {}) => { 2608 if (typeof input === 'string') { 2609 input = braces.parse(input, options); 2610 } 2611 2612 let result = expand(input, options); 2613 2614 // filter out empty strings if specified 2615 if (options.noempty === true) { 2616 result = result.filter(Boolean); 2617 } 2618 2619 // filter out duplicates if specified 2620 if (options.nodupes === true) { 2621 result = [...new Set(result)]; 2622 } 2623 2624 return result; 2625 }; 2626 2627 /** 2628 * Processes a brace pattern and returns either an expanded array 2629 * (if `options.expand` is true), a highly optimized regex-compatible string. 2630 * This method is called by the main [braces](#braces) function. 2631 * 2632 * ```js 2633 * const braces = require('braces'); 2634 * console.log(braces.create('user-{200..300}/project-{a,b,c}-{1..10}')) 2635 * //=> 'user-(20[0-9]|2[1-9][0-9]|300)/project-(a|b|c)-([1-9]|10)' 2636 * ``` 2637 * @param {String} `pattern` Brace pattern 2638 * @param {Object} `options` 2639 * @return {Array} Returns an array of expanded values. 2640 * @api public 2641 */ 2642 2643 braces.create = (input, options = {}) => { 2644 if (input === '' || input.length < 3) { 2645 return [input]; 2646 } 2647 2648 return options.expand !== true 2649 ? braces.compile(input, options) 2650 : braces.expand(input, options); 2651 }; 2652 2653 /** 2654 * Expose "braces" 2655 */ 2656 2657 module.exports = braces; 2658 2659 2660 /***/ }), 2661 /* 12 */ 2662 /***/ (function(module, exports, __webpack_require__) { 2663 2664 "use strict"; 2665 2666 2667 const fill = __webpack_require__(7); 2668 const utils = __webpack_require__(4); 2669 2670 const compile = (ast, options = {}) => { 2671 let walk = (node, parent = {}) => { 2672 let invalidBlock = utils.isInvalidBrace(parent); 2673 let invalidNode = node.invalid === true && options.escapeInvalid === true; 2674 let invalid = invalidBlock === true || invalidNode === true; 2675 let prefix = options.escapeInvalid === true ? '\\' : ''; 2676 let output = ''; 2677 2678 if (node.isOpen === true) { 2679 return prefix + node.value; 2680 } 2681 if (node.isClose === true) { 2682 return prefix + node.value; 2683 } 2684 2685 if (node.type === 'open') { 2686 return invalid ? (prefix + node.value) : '('; 2687 } 2688 2689 if (node.type === 'close') { 2690 return invalid ? (prefix + node.value) : ')'; 2691 } 2692 2693 if (node.type === 'comma') { 2694 return node.prev.type === 'comma' ? '' : (invalid ? node.value : '|'); 2695 } 2696 2697 if (node.value) { 2698 return node.value; 2699 } 2700 2701 if (node.nodes && node.ranges > 0) { 2702 let args = utils.reduce(node.nodes); 2703 let range = fill(...args, { ...options, wrap: false, toRegex: true }); 2704 2705 if (range.length !== 0) { 2706 return args.length > 1 && range.length > 1 ? `(${range})` : range; 2707 } 2708 } 2709 2710 if (node.nodes) { 2711 for (let child of node.nodes) { 2712 output += walk(child, node); 2713 } 2714 } 2715 return output; 2716 }; 2717 2718 return walk(ast); 2719 }; 2720 2721 module.exports = compile; 2722 2723 2724 /***/ }), 2725 /* 13 */ 2726 /***/ (function(module, exports, __webpack_require__) { 2727 2728 "use strict"; 2729 /*! 2730 * to-regex-range <https://github.com/micromatch/to-regex-range> 2731 * 2732 * Copyright (c) 2015-present, Jon Schlinkert. 2733 * Released under the MIT License. 2734 */ 2735 2736 2737 2738 const isNumber = __webpack_require__(14); 2739 2740 const toRegexRange = (min, max, options) => { 2741 if (isNumber(min) === false) { 2742 throw new TypeError('toRegexRange: expected the first argument to be a number'); 2743 } 2744 2745 if (max === void 0 || min === max) { 2746 return String(min); 2747 } 2748 2749 if (isNumber(max) === false) { 2750 throw new TypeError('toRegexRange: expected the second argument to be a number.'); 2751 } 2752 2753 let opts = { relaxZeros: true, ...options }; 2754 if (typeof opts.strictZeros === 'boolean') { 2755 opts.relaxZeros = opts.strictZeros === false; 2756 } 2757 2758 let relax = String(opts.relaxZeros); 2759 let shorthand = String(opts.shorthand); 2760 let capture = String(opts.capture); 2761 let wrap = String(opts.wrap); 2762 let cacheKey = min + ':' + max + '=' + relax + shorthand + capture + wrap; 2763 2764 if (toRegexRange.cache.hasOwnProperty(cacheKey)) { 2765 return toRegexRange.cache[cacheKey].result; 2766 } 2767 2768 let a = Math.min(min, max); 2769 let b = Math.max(min, max); 2770 2771 if (Math.abs(a - b) === 1) { 2772 let result = min + '|' + max; 2773 if (opts.capture) { 2774 return `(${result})`; 2775 } 2776 if (opts.wrap === false) { 2777 return result; 2778 } 2779 return `(?:${result})`; 2780 } 2781 2782 let isPadded = hasPadding(min) || hasPadding(max); 2783 let state = { min, max, a, b }; 2784 let positives = []; 2785 let negatives = []; 2786 2787 if (isPadded) { 2788 state.isPadded = isPadded; 2789 state.maxLen = String(state.max).length; 2790 } 2791 2792 if (a < 0) { 2793 let newMin = b < 0 ? Math.abs(b) : 1; 2794 negatives = splitToPatterns(newMin, Math.abs(a), state, opts); 2795 a = state.a = 0; 2796 } 2797 2798 if (b >= 0) { 2799 positives = splitToPatterns(a, b, state, opts); 2800 } 2801 2802 state.negatives = negatives; 2803 state.positives = positives; 2804 state.result = collatePatterns(negatives, positives, opts); 2805 2806 if (opts.capture === true) { 2807 state.result = `(${state.result})`; 2808 } else if (opts.wrap !== false && (positives.length + negatives.length) > 1) { 2809 state.result = `(?:${state.result})`; 2810 } 2811 2812 toRegexRange.cache[cacheKey] = state; 2813 return state.result; 2814 }; 2815 2816 function collatePatterns(neg, pos, options) { 2817 let onlyNegative = filterPatterns(neg, pos, '-', false, options) || []; 2818 let onlyPositive = filterPatterns(pos, neg, '', false, options) || []; 2819 let intersected = filterPatterns(neg, pos, '-?', true, options) || []; 2820 let subpatterns = onlyNegative.concat(intersected).concat(onlyPositive); 2821 return subpatterns.join('|'); 2822 } 2823 2824 function splitToRanges(min, max) { 2825 let nines = 1; 2826 let zeros = 1; 2827 2828 let stop = countNines(min, nines); 2829 let stops = new Set([max]); 2830 2831 while (min <= stop && stop <= max) { 2832 stops.add(stop); 2833 nines += 1; 2834 stop = countNines(min, nines); 2835 } 2836 2837 stop = countZeros(max + 1, zeros) - 1; 2838 2839 while (min < stop && stop <= max) { 2840 stops.add(stop); 2841 zeros += 1; 2842 stop = countZeros(max + 1, zeros) - 1; 2843 } 2844 2845 stops = [...stops]; 2846 stops.sort(compare); 2847 return stops; 2848 } 2849 2850 /** 2851 * Convert a range to a regex pattern 2852 * @param {Number} `start` 2853 * @param {Number} `stop` 2854 * @return {String} 2855 */ 2856 2857 function rangeToPattern(start, stop, options) { 2858 if (start === stop) { 2859 return { pattern: start, count: [], digits: 0 }; 2860 } 2861 2862 let zipped = zip(start, stop); 2863 let digits = zipped.length; 2864 let pattern = ''; 2865 let count = 0; 2866 2867 for (let i = 0; i < digits; i++) { 2868 let [startDigit, stopDigit] = zipped[i]; 2869 2870 if (startDigit === stopDigit) { 2871 pattern += startDigit; 2872 2873 } else if (startDigit !== '0' || stopDigit !== '9') { 2874 pattern += toCharacterClass(startDigit, stopDigit, options); 2875 2876 } else { 2877 count++; 2878 } 2879 } 2880 2881 if (count) { 2882 pattern += options.shorthand === true ? '\\d' : '[0-9]'; 2883 } 2884 2885 return { pattern, count: [count], digits }; 2886 } 2887 2888 function splitToPatterns(min, max, tok, options) { 2889 let ranges = splitToRanges(min, max); 2890 let tokens = []; 2891 let start = min; 2892 let prev; 2893 2894 for (let i = 0; i < ranges.length; i++) { 2895 let max = ranges[i]; 2896 let obj = rangeToPattern(String(start), String(max), options); 2897 let zeros = ''; 2898 2899 if (!tok.isPadded && prev && prev.pattern === obj.pattern) { 2900 if (prev.count.length > 1) { 2901 prev.count.pop(); 2902 } 2903 2904 prev.count.push(obj.count[0]); 2905 prev.string = prev.pattern + toQuantifier(prev.count); 2906 start = max + 1; 2907 continue; 2908 } 2909 2910 if (tok.isPadded) { 2911 zeros = padZeros(max, tok, options); 2912 } 2913 2914 obj.string = zeros + obj.pattern + toQuantifier(obj.count); 2915 tokens.push(obj); 2916 start = max + 1; 2917 prev = obj; 2918 } 2919 2920 return tokens; 2921 } 2922 2923 function filterPatterns(arr, comparison, prefix, intersection, options) { 2924 let result = []; 2925 2926 for (let ele of arr) { 2927 let { string } = ele; 2928 2929 // only push if _both_ are negative... 2930 if (!intersection && !contains(comparison, 'string', string)) { 2931 result.push(prefix + string); 2932 } 2933 2934 // or _both_ are positive 2935 if (intersection && contains(comparison, 'string', string)) { 2936 result.push(prefix + string); 2937 } 2938 } 2939 return result; 2940 } 2941 2942 /** 2943 * Zip strings 2944 */ 2945 2946 function zip(a, b) { 2947 let arr = []; 2948 for (let i = 0; i < a.length; i++) arr.push([a[i], b[i]]); 2949 return arr; 2950 } 2951 2952 function compare(a, b) { 2953 return a > b ? 1 : b > a ? -1 : 0; 2954 } 2955 2956 function contains(arr, key, val) { 2957 return arr.some(ele => ele[key] === val); 2958 } 2959 2960 function countNines(min, len) { 2961 return Number(String(min).slice(0, -len) + '9'.repeat(len)); 2962 } 2963 2964 function countZeros(integer, zeros) { 2965 return integer - (integer % Math.pow(10, zeros)); 2966 } 2967 2968 function toQuantifier(digits) { 2969 let [start = 0, stop = ''] = digits; 2970 if (stop || start > 1) { 2971 return `{${start + (stop ? ',' + stop : '')}}`; 2972 } 2973 return ''; 2974 } 2975 2976 function toCharacterClass(a, b, options) { 2977 return `[${a}${(b - a === 1) ? '' : '-'}${b}]`; 2978 } 2979 2980 function hasPadding(str) { 2981 return /^-?(0+)\d/.test(str); 2982 } 2983 2984 function padZeros(value, tok, options) { 2985 if (!tok.isPadded) { 2986 return value; 2987 } 2988 2989 let diff = Math.abs(tok.maxLen - String(value).length); 2990 let relax = options.relaxZeros !== false; 2991 2992 switch (diff) { 2993 case 0: 2994 return ''; 2995 case 1: 2996 return relax ? '0?' : '0'; 2997 case 2: 2998 return relax ? '0{0,2}' : '00'; 2999 default: { 3000 return relax ? `0{0,${diff}}` : `0{${diff}}`; 3001 } 3002 } 3003 } 3004 3005 /** 3006 * Cache 3007 */ 3008 3009 toRegexRange.cache = {}; 3010 toRegexRange.clearCache = () => (toRegexRange.cache = {}); 3011 3012 /** 3013 * Expose `toRegexRange` 3014 */ 3015 3016 module.exports = toRegexRange; 3017 3018 3019 /***/ }), 3020 /* 14 */ 3021 /***/ (function(module, exports, __webpack_require__) { 3022 3023 "use strict"; 3024 /*! 3025 * is-number <https://github.com/jonschlinkert/is-number> 3026 * 3027 * Copyright (c) 2014-present, Jon Schlinkert. 3028 * Released under the MIT License. 3029 */ 3030 3031 3032 3033 module.exports = function(num) { 3034 if (typeof num === 'number') { 3035 return num - num === 0; 3036 } 3037 if (typeof num === 'string' && num.trim() !== '') { 3038 return Number.isFinite ? Number.isFinite(+num) : isFinite(+num); 3039 } 3040 return false; 3041 }; 3042 3043 3044 /***/ }), 3045 /* 15 */ 3046 /***/ (function(module, exports, __webpack_require__) { 3047 3048 "use strict"; 3049 3050 3051 const fill = __webpack_require__(7); 3052 const stringify = __webpack_require__(3); 3053 const utils = __webpack_require__(4); 3054 3055 const append = (queue = '', stash = '', enclose = false) => { 3056 let result = []; 3057 3058 queue = [].concat(queue); 3059 stash = [].concat(stash); 3060 3061 if (!stash.length) return queue; 3062 if (!queue.length) { 3063 return enclose ? utils.flatten(stash).map(ele => `{${ele}}`) : stash; 3064 } 3065 3066 for (let item of queue) { 3067 if (Array.isArray(item)) { 3068 for (let value of item) { 3069 result.push(append(value, stash, enclose)); 3070 } 3071 } else { 3072 for (let ele of stash) { 3073 if (enclose === true && typeof ele === 'string') ele = `{${ele}}`; 3074 result.push(Array.isArray(ele) ? append(item, ele, enclose) : (item + ele)); 3075 } 3076 } 3077 } 3078 return utils.flatten(result); 3079 }; 3080 3081 const expand = (ast, options = {}) => { 3082 let rangeLimit = options.rangeLimit === void 0 ? 1000 : options.rangeLimit; 3083 3084 let walk = (node, parent = {}) => { 3085 node.queue = []; 3086 3087 let p = parent; 3088 let q = parent.queue; 3089 3090 while (p.type !== 'brace' && p.type !== 'root' && p.parent) { 3091 p = p.parent; 3092 q = p.queue; 3093 } 3094 3095 if (node.invalid || node.dollar) { 3096 q.push(append(q.pop(), stringify(node, options))); 3097 return; 3098 } 3099 3100 if (node.type === 'brace' && node.invalid !== true && node.nodes.length === 2) { 3101 q.push(append(q.pop(), ['{}'])); 3102 return; 3103 } 3104 3105 if (node.nodes && node.ranges > 0) { 3106 let args = utils.reduce(node.nodes); 3107 3108 if (utils.exceedsLimit(...args, options.step, rangeLimit)) { 3109 throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.'); 3110 } 3111 3112 let range = fill(...args, options); 3113 if (range.length === 0) { 3114 range = stringify(node, options); 3115 } 3116 3117 q.push(append(q.pop(), range)); 3118 node.nodes = []; 3119 return; 3120 } 3121 3122 let enclose = utils.encloseBrace(node); 3123 let queue = node.queue; 3124 let block = node; 3125 3126 while (block.type !== 'brace' && block.type !== 'root' && block.parent) { 3127 block = block.parent; 3128 queue = block.queue; 3129 } 3130 3131 for (let i = 0; i < node.nodes.length; i++) { 3132 let child = node.nodes[i]; 3133 3134 if (child.type === 'comma' && node.type === 'brace') { 3135 if (i === 1) queue.push(''); 3136 queue.push(''); 3137 continue; 3138 } 3139 3140 if (child.type === 'close') { 3141 q.push(append(q.pop(), queue, enclose)); 3142 continue; 3143 } 3144 3145 if (child.value && child.type !== 'open') { 3146 queue.push(append(queue.pop(), child.value)); 3147 continue; 3148 } 3149 3150 if (child.nodes) { 3151 walk(child, node); 3152 } 3153 } 3154 3155 return queue; 3156 }; 3157 3158 return utils.flatten(walk(ast)); 3159 }; 3160 3161 module.exports = expand; 3162 3163 3164 /***/ }), 3165 /* 16 */ 3166 /***/ (function(module, exports, __webpack_require__) { 3167 3168 "use strict"; 3169 3170 3171 const stringify = __webpack_require__(3); 3172 3173 /** 3174 * Constants 3175 */ 3176 3177 const { 3178 MAX_LENGTH, 3179 CHAR_BACKSLASH, /* \ */ 3180 CHAR_BACKTICK, /* ` */ 3181 CHAR_COMMA, /* , */ 3182 CHAR_DOT, /* . */ 3183 CHAR_LEFT_PARENTHESES, /* ( */ 3184 CHAR_RIGHT_PARENTHESES, /* ) */ 3185 CHAR_LEFT_CURLY_BRACE, /* { */ 3186 CHAR_RIGHT_CURLY_BRACE, /* } */ 3187 CHAR_LEFT_SQUARE_BRACKET, /* [ */ 3188 CHAR_RIGHT_SQUARE_BRACKET, /* ] */ 3189 CHAR_DOUBLE_QUOTE, /* " */ 3190 CHAR_SINGLE_QUOTE, /* ' */ 3191 CHAR_NO_BREAK_SPACE, 3192 CHAR_ZERO_WIDTH_NOBREAK_SPACE 3193 } = __webpack_require__(17); 3194 3195 /** 3196 * parse 3197 */ 3198 3199 const parse = (input, options = {}) => { 3200 if (typeof input !== 'string') { 3201 throw new TypeError('Expected a string'); 3202 } 3203 3204 let opts = options || {}; 3205 let max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; 3206 if (input.length > max) { 3207 throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`); 3208 } 3209 3210 let ast = { type: 'root', input, nodes: [] }; 3211 let stack = [ast]; 3212 let block = ast; 3213 let prev = ast; 3214 let brackets = 0; 3215 let length = input.length; 3216 let index = 0; 3217 let depth = 0; 3218 let value; 3219 let memo = {}; 3220 3221 /** 3222 * Helpers 3223 */ 3224 3225 const advance = () => input[index++]; 3226 const push = node => { 3227 if (node.type === 'text' && prev.type === 'dot') { 3228 prev.type = 'text'; 3229 } 3230 3231 if (prev && prev.type === 'text' && node.type === 'text') { 3232 prev.value += node.value; 3233 return; 3234 } 3235 3236 block.nodes.push(node); 3237 node.parent = block; 3238 node.prev = prev; 3239 prev = node; 3240 return node; 3241 }; 3242 3243 push({ type: 'bos' }); 3244 3245 while (index < length) { 3246 block = stack[stack.length - 1]; 3247 value = advance(); 3248 3249 /** 3250 * Invalid chars 3251 */ 3252 3253 if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) { 3254 continue; 3255 } 3256 3257 /** 3258 * Escaped chars 3259 */ 3260 3261 if (value === CHAR_BACKSLASH) { 3262 push({ type: 'text', value: (options.keepEscaping ? value : '') + advance() }); 3263 continue; 3264 } 3265 3266 /** 3267 * Right square bracket (literal): ']' 3268 */ 3269 3270 if (value === CHAR_RIGHT_SQUARE_BRACKET) { 3271 push({ type: 'text', value: '\\' + value }); 3272 continue; 3273 } 3274 3275 /** 3276 * Left square bracket: '[' 3277 */ 3278 3279 if (value === CHAR_LEFT_SQUARE_BRACKET) { 3280 brackets++; 3281 3282 let closed = true; 3283 let next; 3284 3285 while (index < length && (next = advance())) { 3286 value += next; 3287 3288 if (next === CHAR_LEFT_SQUARE_BRACKET) { 3289 brackets++; 3290 continue; 3291 } 3292 3293 if (next === CHAR_BACKSLASH) { 3294 value += advance(); 3295 continue; 3296 } 3297 3298 if (next === CHAR_RIGHT_SQUARE_BRACKET) { 3299 brackets--; 3300 3301 if (brackets === 0) { 3302 break; 3303 } 3304 } 3305 } 3306 3307 push({ type: 'text', value }); 3308 continue; 3309 } 3310 3311 /** 3312 * Parentheses 3313 */ 3314 3315 if (value === CHAR_LEFT_PARENTHESES) { 3316 block = push({ type: 'paren', nodes: [] }); 3317 stack.push(block); 3318 push({ type: 'text', value }); 3319 continue; 3320 } 3321 3322 if (value === CHAR_RIGHT_PARENTHESES) { 3323 if (block.type !== 'paren') { 3324 push({ type: 'text', value }); 3325 continue; 3326 } 3327 block = stack.pop(); 3328 push({ type: 'text', value }); 3329 block = stack[stack.length - 1]; 3330 continue; 3331 } 3332 3333 /** 3334 * Quotes: '|"|` 3335 */ 3336 3337 if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) { 3338 let open = value; 3339 let next; 3340 3341 if (options.keepQuotes !== true) { 3342 value = ''; 3343 } 3344 3345 while (index < length && (next = advance())) { 3346 if (next === CHAR_BACKSLASH) { 3347 value += next + advance(); 3348 continue; 3349 } 3350 3351 if (next === open) { 3352 if (options.keepQuotes === true) value += next; 3353 break; 3354 } 3355 3356 value += next; 3357 } 3358 3359 push({ type: 'text', value }); 3360 continue; 3361 } 3362 3363 /** 3364 * Left curly brace: '{' 3365 */ 3366 3367 if (value === CHAR_LEFT_CURLY_BRACE) { 3368 depth++; 3369 3370 let dollar = prev.value && prev.value.slice(-1) === '$' || block.dollar === true; 3371 let brace = { 3372 type: 'brace', 3373 open: true, 3374 close: false, 3375 dollar, 3376 depth, 3377 commas: 0, 3378 ranges: 0, 3379 nodes: [] 3380 }; 3381 3382 block = push(brace); 3383 stack.push(block); 3384 push({ type: 'open', value }); 3385 continue; 3386 } 3387 3388 /** 3389 * Right curly brace: '}' 3390 */ 3391 3392 if (value === CHAR_RIGHT_CURLY_BRACE) { 3393 if (block.type !== 'brace') { 3394 push({ type: 'text', value }); 3395 continue; 3396 } 3397 3398 let type = 'close'; 3399 block = stack.pop(); 3400 block.close = true; 3401 3402 push({ type, value }); 3403 depth--; 3404 3405 block = stack[stack.length - 1]; 3406 continue; 3407 } 3408 3409 /** 3410 * Comma: ',' 3411 */ 3412 3413 if (value === CHAR_COMMA && depth > 0) { 3414 if (block.ranges > 0) { 3415 block.ranges = 0; 3416 let open = block.nodes.shift(); 3417 block.nodes = [open, { type: 'text', value: stringify(block) }]; 3418 } 3419 3420 push({ type: 'comma', value }); 3421 block.commas++; 3422 continue; 3423 } 3424 3425 /** 3426 * Dot: '.' 3427 */ 3428 3429 if (value === CHAR_DOT && depth > 0 && block.commas === 0) { 3430 let siblings = block.nodes; 3431 3432 if (depth === 0 || siblings.length === 0) { 3433 push({ type: 'text', value }); 3434 continue; 3435 } 3436 3437 if (prev.type === 'dot') { 3438 block.range = []; 3439 prev.value += value; 3440 prev.type = 'range'; 3441 3442 if (block.nodes.length !== 3 && block.nodes.length !== 5) { 3443 block.invalid = true; 3444 block.ranges = 0; 3445 prev.type = 'text'; 3446 continue; 3447 } 3448 3449 block.ranges++; 3450 block.args = []; 3451 continue; 3452 } 3453 3454 if (prev.type === 'range') { 3455 siblings.pop(); 3456 3457 let before = siblings[siblings.length - 1]; 3458 before.value += prev.value + value; 3459 prev = before; 3460 block.ranges--; 3461 continue; 3462 } 3463 3464 push({ type: 'dot', value }); 3465 continue; 3466 } 3467 3468 /** 3469 * Text 3470 */ 3471 3472 push({ type: 'text', value }); 3473 } 3474 3475 // Mark imbalanced braces and brackets as invalid 3476 do { 3477 block = stack.pop(); 3478 3479 if (block.type !== 'root') { 3480 block.nodes.forEach(node => { 3481 if (!node.nodes) { 3482 if (node.type === 'open') node.isOpen = true; 3483 if (node.type === 'close') node.isClose = true; 3484 if (!node.nodes) node.type = 'text'; 3485 node.invalid = true; 3486 } 3487 }); 3488 3489 // get the location of the block on parent.nodes (block's siblings) 3490 let parent = stack[stack.length - 1]; 3491 let index = parent.nodes.indexOf(block); 3492 // replace the (invalid) block with it's nodes 3493 parent.nodes.splice(index, 1, ...block.nodes); 3494 } 3495 } while (stack.length > 0); 3496 3497 push({ type: 'eos' }); 3498 return ast; 3499 }; 3500 3501 module.exports = parse; 3502 3503 3504 /***/ }), 3505 /* 17 */ 3506 /***/ (function(module, exports, __webpack_require__) { 3507 3508 "use strict"; 3509 3510 3511 module.exports = { 3512 MAX_LENGTH: 1024 * 64, 3513 3514 // Digits 3515 CHAR_0: '0', /* 0 */ 3516 CHAR_9: '9', /* 9 */ 3517 3518 // Alphabet chars. 3519 CHAR_UPPERCASE_A: 'A', /* A */ 3520 CHAR_LOWERCASE_A: 'a', /* a */ 3521 CHAR_UPPERCASE_Z: 'Z', /* Z */ 3522 CHAR_LOWERCASE_Z: 'z', /* z */ 3523 3524 CHAR_LEFT_PARENTHESES: '(', /* ( */ 3525 CHAR_RIGHT_PARENTHESES: ')', /* ) */ 3526 3527 CHAR_ASTERISK: '*', /* * */ 3528 3529 // Non-alphabetic chars. 3530 CHAR_AMPERSAND: '&', /* & */ 3531 CHAR_AT: '@', /* @ */ 3532 CHAR_BACKSLASH: '\\', /* \ */ 3533 CHAR_BACKTICK: '`', /* ` */ 3534 CHAR_CARRIAGE_RETURN: '\r', /* \r */ 3535 CHAR_CIRCUMFLEX_ACCENT: '^', /* ^ */ 3536 CHAR_COLON: ':', /* : */ 3537 CHAR_COMMA: ',', /* , */ 3538 CHAR_DOLLAR: '$', /* . */ 3539 CHAR_DOT: '.', /* . */ 3540 CHAR_DOUBLE_QUOTE: '"', /* " */ 3541 CHAR_EQUAL: '=', /* = */ 3542 CHAR_EXCLAMATION_MARK: '!', /* ! */ 3543 CHAR_FORM_FEED: '\f', /* \f */ 3544 CHAR_FORWARD_SLASH: '/', /* / */ 3545 CHAR_HASH: '#', /* # */ 3546 CHAR_HYPHEN_MINUS: '-', /* - */ 3547 CHAR_LEFT_ANGLE_BRACKET: '<', /* < */ 3548 CHAR_LEFT_CURLY_BRACE: '{', /* { */ 3549 CHAR_LEFT_SQUARE_BRACKET: '[', /* [ */ 3550 CHAR_LINE_FEED: '\n', /* \n */ 3551 CHAR_NO_BREAK_SPACE: '\u00A0', /* \u00A0 */ 3552 CHAR_PERCENT: '%', /* % */ 3553 CHAR_PLUS: '+', /* + */ 3554 CHAR_QUESTION_MARK: '?', /* ? */ 3555 CHAR_RIGHT_ANGLE_BRACKET: '>', /* > */ 3556 CHAR_RIGHT_CURLY_BRACE: '}', /* } */ 3557 CHAR_RIGHT_SQUARE_BRACKET: ']', /* ] */ 3558 CHAR_SEMICOLON: ';', /* ; */ 3559 CHAR_SINGLE_QUOTE: '\'', /* ' */ 3560 CHAR_SPACE: ' ', /* */ 3561 CHAR_TAB: '\t', /* \t */ 3562 CHAR_UNDERSCORE: '_', /* _ */ 3563 CHAR_VERTICAL_LINE: '|', /* | */ 3564 CHAR_ZERO_WIDTH_NOBREAK_SPACE: '\uFEFF' /* \uFEFF */ 3565 }; 3566 3567 3568 /***/ }), 3569 /* 18 */ 3570 /***/ (function(module, exports, __webpack_require__) { 3571 3572 "use strict"; 3573 3574 3575 module.exports = __webpack_require__(19); 3576 3577 3578 /***/ }), 3579 /* 19 */ 3580 /***/ (function(module, exports, __webpack_require__) { 3581 3582 "use strict"; 3583 3584 3585 const path = __webpack_require__(5); 3586 const scan = __webpack_require__(20); 3587 const parse = __webpack_require__(21); 3588 const utils = __webpack_require__(0); 3589 const constants = __webpack_require__(1); 3590 const isObject = val => val && typeof val === 'object' && !Array.isArray(val); 3591 3592 /** 3593 * Creates a matcher function from one or more glob patterns. The 3594 * returned function takes a string to match as its first argument, 3595 * and returns true if the string is a match. The returned matcher 3596 * function also takes a boolean as the second argument that, when true, 3597 * returns an object with additional information. 3598 * 3599 * ```js 3600 * const picomatch = require('picomatch'); 3601 * // picomatch(glob[, options]); 3602 * 3603 * const isMatch = picomatch('*.!(*a)'); 3604 * console.log(isMatch('a.a')); //=> false 3605 * console.log(isMatch('a.b')); //=> true 3606 * ``` 3607 * @name picomatch 3608 * @param {String|Array} `globs` One or more glob patterns. 3609 * @param {Object=} `options` 3610 * @return {Function=} Returns a matcher function. 3611 * @api public 3612 */ 3613 3614 const picomatch = (glob, options, returnState = false) => { 3615 if (Array.isArray(glob)) { 3616 const fns = glob.map(input => picomatch(input, options, returnState)); 3617 const arrayMatcher = str => { 3618 for (const isMatch of fns) { 3619 const state = isMatch(str); 3620 if (state) return state; 3621 } 3622 return false; 3623 }; 3624 return arrayMatcher; 3625 } 3626 3627 const isState = isObject(glob) && glob.tokens && glob.input; 3628 3629 if (glob === '' || (typeof glob !== 'string' && !isState)) { 3630 throw new TypeError('Expected pattern to be a non-empty string'); 3631 } 3632 3633 const opts = options || {}; 3634 const posix = utils.isWindows(options); 3635 const regex = isState 3636 ? picomatch.compileRe(glob, options) 3637 : picomatch.makeRe(glob, options, false, true); 3638 3639 const state = regex.state; 3640 delete regex.state; 3641 3642 let isIgnored = () => false; 3643 if (opts.ignore) { 3644 const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null }; 3645 isIgnored = picomatch(opts.ignore, ignoreOpts, returnState); 3646 } 3647 3648 const matcher = (input, returnObject = false) => { 3649 const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix }); 3650 const result = { glob, state, regex, posix, input, output, match, isMatch }; 3651 3652 if (typeof opts.onResult === 'function') { 3653 opts.onResult(result); 3654 } 3655 3656 if (isMatch === false) { 3657 result.isMatch = false; 3658 return returnObject ? result : false; 3659 } 3660 3661 if (isIgnored(input)) { 3662 if (typeof opts.onIgnore === 'function') { 3663 opts.onIgnore(result); 3664 } 3665 result.isMatch = false; 3666 return returnObject ? result : false; 3667 } 3668 3669 if (typeof opts.onMatch === 'function') { 3670 opts.onMatch(result); 3671 } 3672 return returnObject ? result : true; 3673 }; 3674 3675 if (returnState) { 3676 matcher.state = state; 3677 } 3678 3679 return matcher; 3680 }; 3681 3682 /** 3683 * Test `input` with the given `regex`. This is used by the main 3684 * `picomatch()` function to test the input string. 3685 * 3686 * ```js 3687 * const picomatch = require('picomatch'); 3688 * // picomatch.test(input, regex[, options]); 3689 * 3690 * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/)); 3691 * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' } 3692 * ``` 3693 * @param {String} `input` String to test. 3694 * @param {RegExp} `regex` 3695 * @return {Object} Returns an object with matching info. 3696 * @api public 3697 */ 3698 3699 picomatch.test = (input, regex, options, { glob, posix } = {}) => { 3700 if (typeof input !== 'string') { 3701 throw new TypeError('Expected input to be a string'); 3702 } 3703 3704 if (input === '') { 3705 return { isMatch: false, output: '' }; 3706 } 3707 3708 const opts = options || {}; 3709 const format = opts.format || (posix ? utils.toPosixSlashes : null); 3710 let match = input === glob; 3711 let output = (match && format) ? format(input) : input; 3712 3713 if (match === false) { 3714 output = format ? format(input) : input; 3715 match = output === glob; 3716 } 3717 3718 if (match === false || opts.capture === true) { 3719 if (opts.matchBase === true || opts.basename === true) { 3720 match = picomatch.matchBase(input, regex, options, posix); 3721 } else { 3722 match = regex.exec(output); 3723 } 3724 } 3725 3726 return { isMatch: Boolean(match), match, output }; 3727 }; 3728 3729 /** 3730 * Match the basename of a filepath. 3731 * 3732 * ```js 3733 * const picomatch = require('picomatch'); 3734 * // picomatch.matchBase(input, glob[, options]); 3735 * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true 3736 * ``` 3737 * @param {String} `input` String to test. 3738 * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe). 3739 * @return {Boolean} 3740 * @api public 3741 */ 3742 3743 picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => { 3744 const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options); 3745 return regex.test(path.basename(input)); 3746 }; 3747 3748 /** 3749 * Returns true if **any** of the given glob `patterns` match the specified `string`. 3750 * 3751 * ```js 3752 * const picomatch = require('picomatch'); 3753 * // picomatch.isMatch(string, patterns[, options]); 3754 * 3755 * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true 3756 * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false 3757 * ``` 3758 * @param {String|Array} str The string to test. 3759 * @param {String|Array} patterns One or more glob patterns to use for matching. 3760 * @param {Object} [options] See available [options](#options). 3761 * @return {Boolean} Returns true if any patterns match `str` 3762 * @api public 3763 */ 3764 3765 picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str); 3766 3767 /** 3768 * Parse a glob pattern to create the source string for a regular 3769 * expression. 3770 * 3771 * ```js 3772 * const picomatch = require('picomatch'); 3773 * const result = picomatch.parse(pattern[, options]); 3774 * ``` 3775 * @param {String} `pattern` 3776 * @param {Object} `options` 3777 * @return {Object} Returns an object with useful properties and output to be used as a regex source string. 3778 * @api public 3779 */ 3780 3781 picomatch.parse = (pattern, options) => { 3782 if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options)); 3783 return parse(pattern, { ...options, fastpaths: false }); 3784 }; 3785 3786 /** 3787 * Scan a glob pattern to separate the pattern into segments. 3788 * 3789 * ```js 3790 * const picomatch = require('picomatch'); 3791 * // picomatch.scan(input[, options]); 3792 * 3793 * const result = picomatch.scan('!./foo/*.js'); 3794 * console.log(result); 3795 * { prefix: '!./', 3796 * input: '!./foo/*.js', 3797 * start: 3, 3798 * base: 'foo', 3799 * glob: '*.js', 3800 * isBrace: false, 3801 * isBracket: false, 3802 * isGlob: true, 3803 * isExtglob: false, 3804 * isGlobstar: false, 3805 * negated: true } 3806 * ``` 3807 * @param {String} `input` Glob pattern to scan. 3808 * @param {Object} `options` 3809 * @return {Object} Returns an object with 3810 * @api public 3811 */ 3812 3813 picomatch.scan = (input, options) => scan(input, options); 3814 3815 /** 3816 * Compile a regular expression from the `state` object returned by the 3817 * [parse()](#parse) method. 3818 * 3819 * @param {Object} `state` 3820 * @param {Object} `options` 3821 * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser. 3822 * @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging. 3823 * @return {RegExp} 3824 * @api public 3825 */ 3826 3827 picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => { 3828 if (returnOutput === true) { 3829 return state.output; 3830 } 3831 3832 const opts = options || {}; 3833 const prepend = opts.contains ? '' : '^'; 3834 const append = opts.contains ? '' : '$'; 3835 3836 let source = `${prepend}(?:${state.output})${append}`; 3837 if (state && state.negated === true) { 3838 source = `^(?!${source}).*$`; 3839 } 3840 3841 const regex = picomatch.toRegex(source, options); 3842 if (returnState === true) { 3843 regex.state = state; 3844 } 3845 3846 return regex; 3847 }; 3848 3849 /** 3850 * Create a regular expression from a parsed glob pattern. 3851 * 3852 * ```js 3853 * const picomatch = require('picomatch'); 3854 * const state = picomatch.parse('*.js'); 3855 * // picomatch.compileRe(state[, options]); 3856 * 3857 * console.log(picomatch.compileRe(state)); 3858 * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ 3859 * ``` 3860 * @param {String} `state` The object returned from the `.parse` method. 3861 * @param {Object} `options` 3862 * @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. 3863 * @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression. 3864 * @return {RegExp} Returns a regex created from the given pattern. 3865 * @api public 3866 */ 3867 3868 picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => { 3869 if (!input || typeof input !== 'string') { 3870 throw new TypeError('Expected a non-empty string'); 3871 } 3872 3873 let parsed = { negated: false, fastpaths: true }; 3874 3875 if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) { 3876 parsed.output = parse.fastpaths(input, options); 3877 } 3878 3879 if (!parsed.output) { 3880 parsed = parse(input, options); 3881 } 3882 3883 return picomatch.compileRe(parsed, options, returnOutput, returnState); 3884 }; 3885 3886 /** 3887 * Create a regular expression from the given regex source string. 3888 * 3889 * ```js 3890 * const picomatch = require('picomatch'); 3891 * // picomatch.toRegex(source[, options]); 3892 * 3893 * const { output } = picomatch.parse('*.js'); 3894 * console.log(picomatch.toRegex(output)); 3895 * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ 3896 * ``` 3897 * @param {String} `source` Regular expression source string. 3898 * @param {Object} `options` 3899 * @return {RegExp} 3900 * @api public 3901 */ 3902 3903 picomatch.toRegex = (source, options) => { 3904 try { 3905 const opts = options || {}; 3906 return new RegExp(source, opts.flags || (opts.nocase ? 'i' : '')); 3907 } catch (err) { 3908 if (options && options.debug === true) throw err; 3909 return /$^/; 3910 } 3911 }; 3912 3913 /** 3914 * Picomatch constants. 3915 * @return {Object} 3916 */ 3917 3918 picomatch.constants = constants; 3919 3920 /** 3921 * Expose "picomatch" 3922 */ 3923 3924 module.exports = picomatch; 3925 3926 3927 /***/ }), 3928 /* 20 */ 3929 /***/ (function(module, exports, __webpack_require__) { 3930 3931 "use strict"; 3932 3933 3934 const utils = __webpack_require__(0); 3935 const { 3936 CHAR_ASTERISK, /* * */ 3937 CHAR_AT, /* @ */ 3938 CHAR_BACKWARD_SLASH, /* \ */ 3939 CHAR_COMMA, /* , */ 3940 CHAR_DOT, /* . */ 3941 CHAR_EXCLAMATION_MARK, /* ! */ 3942 CHAR_FORWARD_SLASH, /* / */ 3943 CHAR_LEFT_CURLY_BRACE, /* { */ 3944 CHAR_LEFT_PARENTHESES, /* ( */ 3945 CHAR_LEFT_SQUARE_BRACKET, /* [ */ 3946 CHAR_PLUS, /* + */ 3947 CHAR_QUESTION_MARK, /* ? */ 3948 CHAR_RIGHT_CURLY_BRACE, /* } */ 3949 CHAR_RIGHT_PARENTHESES, /* ) */ 3950 CHAR_RIGHT_SQUARE_BRACKET /* ] */ 3951 } = __webpack_require__(1); 3952 3953 const isPathSeparator = code => { 3954 return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH; 3955 }; 3956 3957 const depth = token => { 3958 if (token.isPrefix !== true) { 3959 token.depth = token.isGlobstar ? Infinity : 1; 3960 } 3961 }; 3962 3963 /** 3964 * Quickly scans a glob pattern and returns an object with a handful of 3965 * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists), 3966 * `glob` (the actual pattern), `negated` (true if the path starts with `!` but not 3967 * with `!(`) and `negatedExtglob` (true if the path starts with `!(`). 3968 * 3969 * ```js 3970 * const pm = require('picomatch'); 3971 * console.log(pm.scan('foo/bar/*.js')); 3972 * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' } 3973 * ``` 3974 * @param {String} `str` 3975 * @param {Object} `options` 3976 * @return {Object} Returns an object with tokens and regex source string. 3977 * @api public 3978 */ 3979 3980 const scan = (input, options) => { 3981 const opts = options || {}; 3982 3983 const length = input.length - 1; 3984 const scanToEnd = opts.parts === true || opts.scanToEnd === true; 3985 const slashes = []; 3986 const tokens = []; 3987 const parts = []; 3988 3989 let str = input; 3990 let index = -1; 3991 let start = 0; 3992 let lastIndex = 0; 3993 let isBrace = false; 3994 let isBracket = false; 3995 let isGlob = false; 3996 let isExtglob = false; 3997 let isGlobstar = false; 3998 let braceEscaped = false; 3999 let backslashes = false; 4000 let negated = false; 4001 let negatedExtglob = false; 4002 let finished = false; 4003 let braces = 0; 4004 let prev; 4005 let code; 4006 let token = { value: '', depth: 0, isGlob: false }; 4007 4008 const eos = () => index >= length; 4009 const peek = () => str.charCodeAt(index + 1); 4010 const advance = () => { 4011 prev = code; 4012 return str.charCodeAt(++index); 4013 }; 4014 4015 while (index < length) { 4016 code = advance(); 4017 let next; 4018 4019 if (code === CHAR_BACKWARD_SLASH) { 4020 backslashes = token.backslashes = true; 4021 code = advance(); 4022 4023 if (code === CHAR_LEFT_CURLY_BRACE) { 4024 braceEscaped = true; 4025 } 4026 continue; 4027 } 4028 4029 if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) { 4030 braces++; 4031 4032 while (eos() !== true && (code = advance())) { 4033 if (code === CHAR_BACKWARD_SLASH) { 4034 backslashes = token.backslashes = true; 4035 advance(); 4036 continue; 4037 } 4038 4039 if (code === CHAR_LEFT_CURLY_BRACE) { 4040 braces++; 4041 continue; 4042 } 4043 4044 if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) { 4045 isBrace = token.isBrace = true; 4046 isGlob = token.isGlob = true; 4047 finished = true; 4048 4049 if (scanToEnd === true) { 4050 continue; 4051 } 4052 4053 break; 4054 } 4055 4056 if (braceEscaped !== true && code === CHAR_COMMA) { 4057 isBrace = token.isBrace = true; 4058 isGlob = token.isGlob = true; 4059 finished = true; 4060 4061 if (scanToEnd === true) { 4062 continue; 4063 } 4064 4065 break; 4066 } 4067 4068 if (code === CHAR_RIGHT_CURLY_BRACE) { 4069 braces--; 4070 4071 if (braces === 0) { 4072 braceEscaped = false; 4073 isBrace = token.isBrace = true; 4074 finished = true; 4075 break; 4076 } 4077 } 4078 } 4079 4080 if (scanToEnd === true) { 4081 continue; 4082 } 4083 4084 break; 4085 } 4086 4087 if (code === CHAR_FORWARD_SLASH) { 4088 slashes.push(index); 4089 tokens.push(token); 4090 token = { value: '', depth: 0, isGlob: false }; 4091 4092 if (finished === true) continue; 4093 if (prev === CHAR_DOT && index === (start + 1)) { 4094 start += 2; 4095 continue; 4096 } 4097 4098 lastIndex = index + 1; 4099 continue; 4100 } 4101 4102 if (opts.noext !== true) { 4103 const isExtglobChar = code === CHAR_PLUS 4104 || code === CHAR_AT 4105 || code === CHAR_ASTERISK 4106 || code === CHAR_QUESTION_MARK 4107 || code === CHAR_EXCLAMATION_MARK; 4108 4109 if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) { 4110 isGlob = token.isGlob = true; 4111 isExtglob = token.isExtglob = true; 4112 finished = true; 4113 if (code === CHAR_EXCLAMATION_MARK && index === start) { 4114 negatedExtglob = true; 4115 } 4116 4117 if (scanToEnd === true) { 4118 while (eos() !== true && (code = advance())) { 4119 if (code === CHAR_BACKWARD_SLASH) { 4120 backslashes = token.backslashes = true; 4121 code = advance(); 4122 continue; 4123 } 4124 4125 if (code === CHAR_RIGHT_PARENTHESES) { 4126 isGlob = token.isGlob = true; 4127 finished = true; 4128 break; 4129 } 4130 } 4131 continue; 4132 } 4133 break; 4134 } 4135 } 4136 4137 if (code === CHAR_ASTERISK) { 4138 if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true; 4139 isGlob = token.isGlob = true; 4140 finished = true; 4141 4142 if (scanToEnd === true) { 4143 continue; 4144 } 4145 break; 4146 } 4147 4148 if (code === CHAR_QUESTION_MARK) { 4149 isGlob = token.isGlob = true; 4150 finished = true; 4151 4152 if (scanToEnd === true) { 4153 continue; 4154 } 4155 break; 4156 } 4157 4158 if (code === CHAR_LEFT_SQUARE_BRACKET) { 4159 while (eos() !== true && (next = advance())) { 4160 if (next === CHAR_BACKWARD_SLASH) { 4161 backslashes = token.backslashes = true; 4162 advance(); 4163 continue; 4164 } 4165 4166 if (next === CHAR_RIGHT_SQUARE_BRACKET) { 4167 isBracket = token.isBracket = true; 4168 isGlob = token.isGlob = true; 4169 finished = true; 4170 break; 4171 } 4172 } 4173 4174 if (scanToEnd === true) { 4175 continue; 4176 } 4177 4178 break; 4179 } 4180 4181 if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) { 4182 negated = token.negated = true; 4183 start++; 4184 continue; 4185 } 4186 4187 if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) { 4188 isGlob = token.isGlob = true; 4189 4190 if (scanToEnd === true) { 4191 while (eos() !== true && (code = advance())) { 4192 if (code === CHAR_LEFT_PARENTHESES) { 4193 backslashes = token.backslashes = true; 4194 code = advance(); 4195 continue; 4196 } 4197 4198 if (code === CHAR_RIGHT_PARENTHESES) { 4199 finished = true; 4200 break; 4201 } 4202 } 4203 continue; 4204 } 4205 break; 4206 } 4207 4208 if (isGlob === true) { 4209 finished = true; 4210 4211 if (scanToEnd === true) { 4212 continue; 4213 } 4214 4215 break; 4216 } 4217 } 4218 4219 if (opts.noext === true) { 4220 isExtglob = false; 4221 isGlob = false; 4222 } 4223 4224 let base = str; 4225 let prefix = ''; 4226 let glob = ''; 4227 4228 if (start > 0) { 4229 prefix = str.slice(0, start); 4230 str = str.slice(start); 4231 lastIndex -= start; 4232 } 4233 4234 if (base && isGlob === true && lastIndex > 0) { 4235 base = str.slice(0, lastIndex); 4236 glob = str.slice(lastIndex); 4237 } else if (isGlob === true) { 4238 base = ''; 4239 glob = str; 4240 } else { 4241 base = str; 4242 } 4243 4244 if (base && base !== '' && base !== '/' && base !== str) { 4245 if (isPathSeparator(base.charCodeAt(base.length - 1))) { 4246 base = base.slice(0, -1); 4247 } 4248 } 4249 4250 if (opts.unescape === true) { 4251 if (glob) glob = utils.removeBackslashes(glob); 4252 4253 if (base && backslashes === true) { 4254 base = utils.removeBackslashes(base); 4255 } 4256 } 4257 4258 const state = { 4259 prefix, 4260 input, 4261 start, 4262 base, 4263 glob, 4264 isBrace, 4265 isBracket, 4266 isGlob, 4267 isExtglob, 4268 isGlobstar, 4269 negated, 4270 negatedExtglob 4271 }; 4272 4273 if (opts.tokens === true) { 4274 state.maxDepth = 0; 4275 if (!isPathSeparator(code)) { 4276 tokens.push(token); 4277 } 4278 state.tokens = tokens; 4279 } 4280 4281 if (opts.parts === true || opts.tokens === true) { 4282 let prevIndex; 4283 4284 for (let idx = 0; idx < slashes.length; idx++) { 4285 const n = prevIndex ? prevIndex + 1 : start; 4286 const i = slashes[idx]; 4287 const value = input.slice(n, i); 4288 if (opts.tokens) { 4289 if (idx === 0 && start !== 0) { 4290 tokens[idx].isPrefix = true; 4291 tokens[idx].value = prefix; 4292 } else { 4293 tokens[idx].value = value; 4294 } 4295 depth(tokens[idx]); 4296 state.maxDepth += tokens[idx].depth; 4297 } 4298 if (idx !== 0 || value !== '') { 4299 parts.push(value); 4300 } 4301 prevIndex = i; 4302 } 4303 4304 if (prevIndex && prevIndex + 1 < input.length) { 4305 const value = input.slice(prevIndex + 1); 4306 parts.push(value); 4307 4308 if (opts.tokens) { 4309 tokens[tokens.length - 1].value = value; 4310 depth(tokens[tokens.length - 1]); 4311 state.maxDepth += tokens[tokens.length - 1].depth; 4312 } 4313 } 4314 4315 state.slashes = slashes; 4316 state.parts = parts; 4317 } 4318 4319 return state; 4320 }; 4321 4322 module.exports = scan; 4323 4324 4325 /***/ }), 4326 /* 21 */ 4327 /***/ (function(module, exports, __webpack_require__) { 4328 4329 "use strict"; 4330 4331 4332 const constants = __webpack_require__(1); 4333 const utils = __webpack_require__(0); 4334 4335 /** 4336 * Constants 4337 */ 4338 4339 const { 4340 MAX_LENGTH, 4341 POSIX_REGEX_SOURCE, 4342 REGEX_NON_SPECIAL_CHARS, 4343 REGEX_SPECIAL_CHARS_BACKREF, 4344 REPLACEMENTS 4345 } = constants; 4346 4347 /** 4348 * Helpers 4349 */ 4350 4351 const expandRange = (args, options) => { 4352 if (typeof options.expandRange === 'function') { 4353 return options.expandRange(...args, options); 4354 } 4355 4356 args.sort(); 4357 const value = `[${args.join('-')}]`; 4358 4359 try { 4360 /* eslint-disable-next-line no-new */ 4361 new RegExp(value); 4362 } catch (ex) { 4363 return args.map(v => utils.escapeRegex(v)).join('..'); 4364 } 4365 4366 return value; 4367 }; 4368 4369 /** 4370 * Create the message for a syntax error 4371 */ 4372 4373 const syntaxError = (type, char) => { 4374 return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`; 4375 }; 4376 4377 /** 4378 * Parse the given input string. 4379 * @param {String} input 4380 * @param {Object} options 4381 * @return {Object} 4382 */ 4383 4384 const parse = (input, options) => { 4385 if (typeof input !== 'string') { 4386 throw new TypeError('Expected a string'); 4387 } 4388 4389 input = REPLACEMENTS[input] || input; 4390 4391 const opts = { ...options }; 4392 const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; 4393 4394 let len = input.length; 4395 if (len > max) { 4396 throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); 4397 } 4398 4399 const bos = { type: 'bos', value: '', output: opts.prepend || '' }; 4400 const tokens = [bos]; 4401 4402 const capture = opts.capture ? '' : '?:'; 4403 const win32 = utils.isWindows(options); 4404 4405 // create constants based on platform, for windows or posix 4406 const PLATFORM_CHARS = constants.globChars(win32); 4407 const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS); 4408 4409 const { 4410 DOT_LITERAL, 4411 PLUS_LITERAL, 4412 SLASH_LITERAL, 4413 ONE_CHAR, 4414 DOTS_SLASH, 4415 NO_DOT, 4416 NO_DOT_SLASH, 4417 NO_DOTS_SLASH, 4418 QMARK, 4419 QMARK_NO_DOT, 4420 STAR, 4421 START_ANCHOR 4422 } = PLATFORM_CHARS; 4423 4424 const globstar = opts => { 4425 return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; 4426 }; 4427 4428 const nodot = opts.dot ? '' : NO_DOT; 4429 const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT; 4430 let star = opts.bash === true ? globstar(opts) : STAR; 4431 4432 if (opts.capture) { 4433 star = `(${star})`; 4434 } 4435 4436 // minimatch options support 4437 if (typeof opts.noext === 'boolean') { 4438 opts.noextglob = opts.noext; 4439 } 4440 4441 const state = { 4442 input, 4443 index: -1, 4444 start: 0, 4445 dot: opts.dot === true, 4446 consumed: '', 4447 output: '', 4448 prefix: '', 4449 backtrack: false, 4450 negated: false, 4451 brackets: 0, 4452 braces: 0, 4453 parens: 0, 4454 quotes: 0, 4455 globstar: false, 4456 tokens 4457 }; 4458 4459 input = utils.removePrefix(input, state); 4460 len = input.length; 4461 4462 const extglobs = []; 4463 const braces = []; 4464 const stack = []; 4465 let prev = bos; 4466 let value; 4467 4468 /** 4469 * Tokenizing helpers 4470 */ 4471 4472 const eos = () => state.index === len - 1; 4473 const peek = state.peek = (n = 1) => input[state.index + n]; 4474 const advance = state.advance = () => input[++state.index] || ''; 4475 const remaining = () => input.slice(state.index + 1); 4476 const consume = (value = '', num = 0) => { 4477 state.consumed += value; 4478 state.index += num; 4479 }; 4480 4481 const append = token => { 4482 state.output += token.output != null ? token.output : token.value; 4483 consume(token.value); 4484 }; 4485 4486 const negate = () => { 4487 let count = 1; 4488 4489 while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) { 4490 advance(); 4491 state.start++; 4492 count++; 4493 } 4494 4495 if (count % 2 === 0) { 4496 return false; 4497 } 4498 4499 state.negated = true; 4500 state.start++; 4501 return true; 4502 }; 4503 4504 const increment = type => { 4505 state[type]++; 4506 stack.push(type); 4507 }; 4508 4509 const decrement = type => { 4510 state[type]--; 4511 stack.pop(); 4512 }; 4513 4514 /** 4515 * Push tokens onto the tokens array. This helper speeds up 4516 * tokenizing by 1) helping us avoid backtracking as much as possible, 4517 * and 2) helping us avoid creating extra tokens when consecutive 4518 * characters are plain text. This improves performance and simplifies 4519 * lookbehinds. 4520 */ 4521 4522 const push = tok => { 4523 if (prev.type === 'globstar') { 4524 const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace'); 4525 const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren')); 4526 4527 if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) { 4528 state.output = state.output.slice(0, -prev.output.length); 4529 prev.type = 'star'; 4530 prev.value = '*'; 4531 prev.output = star; 4532 state.output += prev.output; 4533 } 4534 } 4535 4536 if (extglobs.length && tok.type !== 'paren') { 4537 extglobs[extglobs.length - 1].inner += tok.value; 4538 } 4539 4540 if (tok.value || tok.output) append(tok); 4541 if (prev && prev.type === 'text' && tok.type === 'text') { 4542 prev.value += tok.value; 4543 prev.output = (prev.output || '') + tok.value; 4544 return; 4545 } 4546 4547 tok.prev = prev; 4548 tokens.push(tok); 4549 prev = tok; 4550 }; 4551 4552 const extglobOpen = (type, value) => { 4553 const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' }; 4554 4555 token.prev = prev; 4556 token.parens = state.parens; 4557 token.output = state.output; 4558 const output = (opts.capture ? '(' : '') + token.open; 4559 4560 increment('parens'); 4561 push({ type, value, output: state.output ? '' : ONE_CHAR }); 4562 push({ type: 'paren', extglob: true, value: advance(), output }); 4563 extglobs.push(token); 4564 }; 4565 4566 const extglobClose = token => { 4567 let output = token.close + (opts.capture ? ')' : ''); 4568 let rest; 4569 4570 if (token.type === 'negate') { 4571 let extglobStar = star; 4572 4573 if (token.inner && token.inner.length > 1 && token.inner.includes('/')) { 4574 extglobStar = globstar(opts); 4575 } 4576 4577 if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) { 4578 output = token.close = `)$))${extglobStar}`; 4579 } 4580 4581 if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) { 4582 // Any non-magical string (`.ts`) or even nested expression (`.{ts,tsx}`) can follow after the closing parenthesis. 4583 // In this case, we need to parse the string and use it in the output of the original pattern. 4584 // Suitable patterns: `/!(*.d).ts`, `/!(*.d).{ts,tsx}`, `**/!(*-dbg).@(js)`. 4585 // 4586 // Disabling the `fastpaths` option due to a problem with parsing strings as `.ts` in the pattern like `**/!(*.d).ts`. 4587 const expression = parse(rest, { ...options, fastpaths: false }).output; 4588 4589 output = token.close = `)${expression})${extglobStar})`; 4590 } 4591 4592 if (token.prev.type === 'bos') { 4593 state.negatedExtglob = true; 4594 } 4595 } 4596 4597 push({ type: 'paren', extglob: true, value, output }); 4598 decrement('parens'); 4599 }; 4600 4601 /** 4602 * Fast paths 4603 */ 4604 4605 if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) { 4606 let backslashes = false; 4607 4608 let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => { 4609 if (first === '\\') { 4610 backslashes = true; 4611 return m; 4612 } 4613 4614 if (first === '?') { 4615 if (esc) { 4616 return esc + first + (rest ? QMARK.repeat(rest.length) : ''); 4617 } 4618 if (index === 0) { 4619 return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : ''); 4620 } 4621 return QMARK.repeat(chars.length); 4622 } 4623 4624 if (first === '.') { 4625 return DOT_LITERAL.repeat(chars.length); 4626 } 4627 4628 if (first === '*') { 4629 if (esc) { 4630 return esc + first + (rest ? star : ''); 4631 } 4632 return star; 4633 } 4634 return esc ? m : `\\${m}`; 4635 }); 4636 4637 if (backslashes === true) { 4638 if (opts.unescape === true) { 4639 output = output.replace(/\\/g, ''); 4640 } else { 4641 output = output.replace(/\\+/g, m => { 4642 return m.length % 2 === 0 ? '\\\\' : (m ? '\\' : ''); 4643 }); 4644 } 4645 } 4646 4647 if (output === input && opts.contains === true) { 4648 state.output = input; 4649 return state; 4650 } 4651 4652 state.output = utils.wrapOutput(output, state, options); 4653 return state; 4654 } 4655 4656 /** 4657 * Tokenize input until we reach end-of-string 4658 */ 4659 4660 while (!eos()) { 4661 value = advance(); 4662 4663 if (value === '\u0000') { 4664 continue; 4665 } 4666 4667 /** 4668 * Escaped characters 4669 */ 4670 4671 if (value === '\\') { 4672 const next = peek(); 4673 4674 if (next === '/' && opts.bash !== true) { 4675 continue; 4676 } 4677 4678 if (next === '.' || next === ';') { 4679 continue; 4680 } 4681 4682 if (!next) { 4683 value += '\\'; 4684 push({ type: 'text', value }); 4685 continue; 4686 } 4687 4688 // collapse slashes to reduce potential for exploits 4689 const match = /^\\+/.exec(remaining()); 4690 let slashes = 0; 4691 4692 if (match && match[0].length > 2) { 4693 slashes = match[0].length; 4694 state.index += slashes; 4695 if (slashes % 2 !== 0) { 4696 value += '\\'; 4697 } 4698 } 4699 4700 if (opts.unescape === true) { 4701 value = advance(); 4702 } else { 4703 value += advance(); 4704 } 4705 4706 if (state.brackets === 0) { 4707 push({ type: 'text', value }); 4708 continue; 4709 } 4710 } 4711 4712 /** 4713 * If we're inside a regex character class, continue 4714 * until we reach the closing bracket. 4715 */ 4716 4717 if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) { 4718 if (opts.posix !== false && value === ':') { 4719 const inner = prev.value.slice(1); 4720 if (inner.includes('[')) { 4721 prev.posix = true; 4722 4723 if (inner.includes(':')) { 4724 const idx = prev.value.lastIndexOf('['); 4725 const pre = prev.value.slice(0, idx); 4726 const rest = prev.value.slice(idx + 2); 4727 const posix = POSIX_REGEX_SOURCE[rest]; 4728 if (posix) { 4729 prev.value = pre + posix; 4730 state.backtrack = true; 4731 advance(); 4732 4733 if (!bos.output && tokens.indexOf(prev) === 1) { 4734 bos.output = ONE_CHAR; 4735 } 4736 continue; 4737 } 4738 } 4739 } 4740 } 4741 4742 if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) { 4743 value = `\\${value}`; 4744 } 4745 4746 if (value === ']' && (prev.value === '[' || prev.value === '[^')) { 4747 value = `\\${value}`; 4748 } 4749 4750 if (opts.posix === true && value === '!' && prev.value === '[') { 4751 value = '^'; 4752 } 4753 4754 prev.value += value; 4755 append({ value }); 4756 continue; 4757 } 4758 4759 /** 4760 * If we're inside a quoted string, continue 4761 * until we reach the closing double quote. 4762 */ 4763 4764 if (state.quotes === 1 && value !== '"') { 4765 value = utils.escapeRegex(value); 4766 prev.value += value; 4767 append({ value }); 4768 continue; 4769 } 4770 4771 /** 4772 * Double quotes 4773 */ 4774 4775 if (value === '"') { 4776 state.quotes = state.quotes === 1 ? 0 : 1; 4777 if (opts.keepQuotes === true) { 4778 push({ type: 'text', value }); 4779 } 4780 continue; 4781 } 4782 4783 /** 4784 * Parentheses 4785 */ 4786 4787 if (value === '(') { 4788 increment('parens'); 4789 push({ type: 'paren', value }); 4790 continue; 4791 } 4792 4793 if (value === ')') { 4794 if (state.parens === 0 && opts.strictBrackets === true) { 4795 throw new SyntaxError(syntaxError('opening', '(')); 4796 } 4797 4798 const extglob = extglobs[extglobs.length - 1]; 4799 if (extglob && state.parens === extglob.parens + 1) { 4800 extglobClose(extglobs.pop()); 4801 continue; 4802 } 4803 4804 push({ type: 'paren', value, output: state.parens ? ')' : '\\)' }); 4805 decrement('parens'); 4806 continue; 4807 } 4808 4809 /** 4810 * Square brackets 4811 */ 4812 4813 if (value === '[') { 4814 if (opts.nobracket === true || !remaining().includes(']')) { 4815 if (opts.nobracket !== true && opts.strictBrackets === true) { 4816 throw new SyntaxError(syntaxError('closing', ']')); 4817 } 4818 4819 value = `\\${value}`; 4820 } else { 4821 increment('brackets'); 4822 } 4823 4824 push({ type: 'bracket', value }); 4825 continue; 4826 } 4827 4828 if (value === ']') { 4829 if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) { 4830 push({ type: 'text', value, output: `\\${value}` }); 4831 continue; 4832 } 4833 4834 if (state.brackets === 0) { 4835 if (opts.strictBrackets === true) { 4836 throw new SyntaxError(syntaxError('opening', '[')); 4837 } 4838 4839 push({ type: 'text', value, output: `\\${value}` }); 4840 continue; 4841 } 4842 4843 decrement('brackets'); 4844 4845 const prevValue = prev.value.slice(1); 4846 if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) { 4847 value = `/${value}`; 4848 } 4849 4850 prev.value += value; 4851 append({ value }); 4852 4853 // when literal brackets are explicitly disabled 4854 // assume we should match with a regex character class 4855 if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) { 4856 continue; 4857 } 4858 4859 const escaped = utils.escapeRegex(prev.value); 4860 state.output = state.output.slice(0, -prev.value.length); 4861 4862 // when literal brackets are explicitly enabled 4863 // assume we should escape the brackets to match literal characters 4864 if (opts.literalBrackets === true) { 4865 state.output += escaped; 4866 prev.value = escaped; 4867 continue; 4868 } 4869 4870 // when the user specifies nothing, try to match both 4871 prev.value = `(${capture}${escaped}|${prev.value})`; 4872 state.output += prev.value; 4873 continue; 4874 } 4875 4876 /** 4877 * Braces 4878 */ 4879 4880 if (value === '{' && opts.nobrace !== true) { 4881 increment('braces'); 4882 4883 const open = { 4884 type: 'brace', 4885 value, 4886 output: '(', 4887 outputIndex: state.output.length, 4888 tokensIndex: state.tokens.length 4889 }; 4890 4891 braces.push(open); 4892 push(open); 4893 continue; 4894 } 4895 4896 if (value === '}') { 4897 const brace = braces[braces.length - 1]; 4898 4899 if (opts.nobrace === true || !brace) { 4900 push({ type: 'text', value, output: value }); 4901 continue; 4902 } 4903 4904 let output = ')'; 4905 4906 if (brace.dots === true) { 4907 const arr = tokens.slice(); 4908 const range = []; 4909 4910 for (let i = arr.length - 1; i >= 0; i--) { 4911 tokens.pop(); 4912 if (arr[i].type === 'brace') { 4913 break; 4914 } 4915 if (arr[i].type !== 'dots') { 4916 range.unshift(arr[i].value); 4917 } 4918 } 4919 4920 output = expandRange(range, opts); 4921 state.backtrack = true; 4922 } 4923 4924 if (brace.comma !== true && brace.dots !== true) { 4925 const out = state.output.slice(0, brace.outputIndex); 4926 const toks = state.tokens.slice(brace.tokensIndex); 4927 brace.value = brace.output = '\\{'; 4928 value = output = '\\}'; 4929 state.output = out; 4930 for (const t of toks) { 4931 state.output += (t.output || t.value); 4932 } 4933 } 4934 4935 push({ type: 'brace', value, output }); 4936 decrement('braces'); 4937 braces.pop(); 4938 continue; 4939 } 4940 4941 /** 4942 * Pipes 4943 */ 4944 4945 if (value === '|') { 4946 if (extglobs.length > 0) { 4947 extglobs[extglobs.length - 1].conditions++; 4948 } 4949 push({ type: 'text', value }); 4950 continue; 4951 } 4952 4953 /** 4954 * Commas 4955 */ 4956 4957 if (value === ',') { 4958 let output = value; 4959 4960 const brace = braces[braces.length - 1]; 4961 if (brace && stack[stack.length - 1] === 'braces') { 4962 brace.comma = true; 4963 output = '|'; 4964 } 4965 4966 push({ type: 'comma', value, output }); 4967 continue; 4968 } 4969 4970 /** 4971 * Slashes 4972 */ 4973 4974 if (value === '/') { 4975 // if the beginning of the glob is "./", advance the start 4976 // to the current index, and don't add the "./" characters 4977 // to the state. This greatly simplifies lookbehinds when 4978 // checking for BOS characters like "!" and "." (not "./") 4979 if (prev.type === 'dot' && state.index === state.start + 1) { 4980 state.start = state.index + 1; 4981 state.consumed = ''; 4982 state.output = ''; 4983 tokens.pop(); 4984 prev = bos; // reset "prev" to the first token 4985 continue; 4986 } 4987 4988 push({ type: 'slash', value, output: SLASH_LITERAL }); 4989 continue; 4990 } 4991 4992 /** 4993 * Dots 4994 */ 4995 4996 if (value === '.') { 4997 if (state.braces > 0 && prev.type === 'dot') { 4998 if (prev.value === '.') prev.output = DOT_LITERAL; 4999 const brace = braces[braces.length - 1]; 5000 prev.type = 'dots'; 5001 prev.output += value; 5002 prev.value += value; 5003 brace.dots = true; 5004 continue; 5005 } 5006 5007 if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') { 5008 push({ type: 'text', value, output: DOT_LITERAL }); 5009 continue; 5010 } 5011 5012 push({ type: 'dot', value, output: DOT_LITERAL }); 5013 continue; 5014 } 5015 5016 /** 5017 * Question marks 5018 */ 5019 5020 if (value === '?') { 5021 const isGroup = prev && prev.value === '('; 5022 if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { 5023 extglobOpen('qmark', value); 5024 continue; 5025 } 5026 5027 if (prev && prev.type === 'paren') { 5028 const next = peek(); 5029 let output = value; 5030 5031 if (next === '<' && !utils.supportsLookbehinds()) { 5032 throw new Error('Node.js v10 or higher is required for regex lookbehinds'); 5033 } 5034 5035 if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) { 5036 output = `\\${value}`; 5037 } 5038 5039 push({ type: 'text', value, output }); 5040 continue; 5041 } 5042 5043 if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) { 5044 push({ type: 'qmark', value, output: QMARK_NO_DOT }); 5045 continue; 5046 } 5047 5048 push({ type: 'qmark', value, output: QMARK }); 5049 continue; 5050 } 5051 5052 /** 5053 * Exclamation 5054 */ 5055 5056 if (value === '!') { 5057 if (opts.noextglob !== true && peek() === '(') { 5058 if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) { 5059 extglobOpen('negate', value); 5060 continue; 5061 } 5062 } 5063 5064 if (opts.nonegate !== true && state.index === 0) { 5065 negate(); 5066 continue; 5067 } 5068 } 5069 5070 /** 5071 * Plus 5072 */ 5073 5074 if (value === '+') { 5075 if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { 5076 extglobOpen('plus', value); 5077 continue; 5078 } 5079 5080 if ((prev && prev.value === '(') || opts.regex === false) { 5081 push({ type: 'plus', value, output: PLUS_LITERAL }); 5082 continue; 5083 } 5084 5085 if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) { 5086 push({ type: 'plus', value }); 5087 continue; 5088 } 5089 5090 push({ type: 'plus', value: PLUS_LITERAL }); 5091 continue; 5092 } 5093 5094 /** 5095 * Plain text 5096 */ 5097 5098 if (value === '@') { 5099 if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { 5100 push({ type: 'at', extglob: true, value, output: '' }); 5101 continue; 5102 } 5103 5104 push({ type: 'text', value }); 5105 continue; 5106 } 5107 5108 /** 5109 * Plain text 5110 */ 5111 5112 if (value !== '*') { 5113 if (value === '$' || value === '^') { 5114 value = `\\${value}`; 5115 } 5116 5117 const match = REGEX_NON_SPECIAL_CHARS.exec(remaining()); 5118 if (match) { 5119 value += match[0]; 5120 state.index += match[0].length; 5121 } 5122 5123 push({ type: 'text', value }); 5124 continue; 5125 } 5126 5127 /** 5128 * Stars 5129 */ 5130 5131 if (prev && (prev.type === 'globstar' || prev.star === true)) { 5132 prev.type = 'star'; 5133 prev.star = true; 5134 prev.value += value; 5135 prev.output = star; 5136 state.backtrack = true; 5137 state.globstar = true; 5138 consume(value); 5139 continue; 5140 } 5141 5142 let rest = remaining(); 5143 if (opts.noextglob !== true && /^\([^?]/.test(rest)) { 5144 extglobOpen('star', value); 5145 continue; 5146 } 5147 5148 if (prev.type === 'star') { 5149 if (opts.noglobstar === true) { 5150 consume(value); 5151 continue; 5152 } 5153 5154 const prior = prev.prev; 5155 const before = prior.prev; 5156 const isStart = prior.type === 'slash' || prior.type === 'bos'; 5157 const afterStar = before && (before.type === 'star' || before.type === 'globstar'); 5158 5159 if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) { 5160 push({ type: 'star', value, output: '' }); 5161 continue; 5162 } 5163 5164 const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace'); 5165 const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren'); 5166 if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) { 5167 push({ type: 'star', value, output: '' }); 5168 continue; 5169 } 5170 5171 // strip consecutive `/**/` 5172 while (rest.slice(0, 3) === '/**') { 5173 const after = input[state.index + 4]; 5174 if (after && after !== '/') { 5175 break; 5176 } 5177 rest = rest.slice(3); 5178 consume('/**', 3); 5179 } 5180 5181 if (prior.type === 'bos' && eos()) { 5182 prev.type = 'globstar'; 5183 prev.value += value; 5184 prev.output = globstar(opts); 5185 state.output = prev.output; 5186 state.globstar = true; 5187 consume(value); 5188 continue; 5189 } 5190 5191 if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) { 5192 state.output = state.output.slice(0, -(prior.output + prev.output).length); 5193 prior.output = `(?:${prior.output}`; 5194 5195 prev.type = 'globstar'; 5196 prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)'); 5197 prev.value += value; 5198 state.globstar = true; 5199 state.output += prior.output + prev.output; 5200 consume(value); 5201 continue; 5202 } 5203 5204 if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') { 5205 const end = rest[1] !== void 0 ? '|$' : ''; 5206 5207 state.output = state.output.slice(0, -(prior.output + prev.output).length); 5208 prior.output = `(?:${prior.output}`; 5209 5210 prev.type = 'globstar'; 5211 prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`; 5212 prev.value += value; 5213 5214 state.output += prior.output + prev.output; 5215 state.globstar = true; 5216 5217 consume(value + advance()); 5218 5219 push({ type: 'slash', value: '/', output: '' }); 5220 continue; 5221 } 5222 5223 if (prior.type === 'bos' && rest[0] === '/') { 5224 prev.type = 'globstar'; 5225 prev.value += value; 5226 prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`; 5227 state.output = prev.output; 5228 state.globstar = true; 5229 consume(value + advance()); 5230 push({ type: 'slash', value: '/', output: '' }); 5231 continue; 5232 } 5233 5234 // remove single star from output 5235 state.output = state.output.slice(0, -prev.output.length); 5236 5237 // reset previous token to globstar 5238 prev.type = 'globstar'; 5239 prev.output = globstar(opts); 5240 prev.value += value; 5241 5242 // reset output with globstar 5243 state.output += prev.output; 5244 state.globstar = true; 5245 consume(value); 5246 continue; 5247 } 5248 5249 const token = { type: 'star', value, output: star }; 5250 5251 if (opts.bash === true) { 5252 token.output = '.*?'; 5253 if (prev.type === 'bos' || prev.type === 'slash') { 5254 token.output = nodot + token.output; 5255 } 5256 push(token); 5257 continue; 5258 } 5259 5260 if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) { 5261 token.output = value; 5262 push(token); 5263 continue; 5264 } 5265 5266 if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') { 5267 if (prev.type === 'dot') { 5268 state.output += NO_DOT_SLASH; 5269 prev.output += NO_DOT_SLASH; 5270 5271 } else if (opts.dot === true) { 5272 state.output += NO_DOTS_SLASH; 5273 prev.output += NO_DOTS_SLASH; 5274 5275 } else { 5276 state.output += nodot; 5277 prev.output += nodot; 5278 } 5279 5280 if (peek() !== '*') { 5281 state.output += ONE_CHAR; 5282 prev.output += ONE_CHAR; 5283 } 5284 } 5285 5286 push(token); 5287 } 5288 5289 while (state.brackets > 0) { 5290 if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']')); 5291 state.output = utils.escapeLast(state.output, '['); 5292 decrement('brackets'); 5293 } 5294 5295 while (state.parens > 0) { 5296 if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')')); 5297 state.output = utils.escapeLast(state.output, '('); 5298 decrement('parens'); 5299 } 5300 5301 while (state.braces > 0) { 5302 if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}')); 5303 state.output = utils.escapeLast(state.output, '{'); 5304 decrement('braces'); 5305 } 5306 5307 if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) { 5308 push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` }); 5309 } 5310 5311 // rebuild the output if we had to backtrack at any point 5312 if (state.backtrack === true) { 5313 state.output = ''; 5314 5315 for (const token of state.tokens) { 5316 state.output += token.output != null ? token.output : token.value; 5317 5318 if (token.suffix) { 5319 state.output += token.suffix; 5320 } 5321 } 5322 } 5323 5324 return state; 5325 }; 5326 5327 /** 5328 * Fast paths for creating regular expressions for common glob patterns. 5329 * This can significantly speed up processing and has very little downside 5330 * impact when none of the fast paths match. 5331 */ 5332 5333 parse.fastpaths = (input, options) => { 5334 const opts = { ...options }; 5335 const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; 5336 const len = input.length; 5337 if (len > max) { 5338 throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); 5339 } 5340 5341 input = REPLACEMENTS[input] || input; 5342 const win32 = utils.isWindows(options); 5343 5344 // create constants based on platform, for windows or posix 5345 const { 5346 DOT_LITERAL, 5347 SLASH_LITERAL, 5348 ONE_CHAR, 5349 DOTS_SLASH, 5350 NO_DOT, 5351 NO_DOTS, 5352 NO_DOTS_SLASH, 5353 STAR, 5354 START_ANCHOR 5355 } = constants.globChars(win32); 5356 5357 const nodot = opts.dot ? NO_DOTS : NO_DOT; 5358 const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT; 5359 const capture = opts.capture ? '' : '?:'; 5360 const state = { negated: false, prefix: '' }; 5361 let star = opts.bash === true ? '.*?' : STAR; 5362 5363 if (opts.capture) { 5364 star = `(${star})`; 5365 } 5366 5367 const globstar = opts => { 5368 if (opts.noglobstar === true) return star; 5369 return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; 5370 }; 5371 5372 const create = str => { 5373 switch (str) { 5374 case '*': 5375 return `${nodot}${ONE_CHAR}${star}`; 5376 5377 case '.*': 5378 return `${DOT_LITERAL}${ONE_CHAR}${star}`; 5379 5380 case '*.*': 5381 return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; 5382 5383 case '*/*': 5384 return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`; 5385 5386 case '**': 5387 return nodot + globstar(opts); 5388 5389 case '**/*': 5390 return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`; 5391 5392 case '**/*.*': 5393 return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; 5394 5395 case '**/.*': 5396 return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`; 5397 5398 default: { 5399 const match = /^(.*?)\.(\w+)$/.exec(str); 5400 if (!match) return; 5401 5402 const source = create(match[1]); 5403 if (!source) return; 5404 5405 return source + DOT_LITERAL + match[2]; 5406 } 5407 } 5408 }; 5409 5410 const output = utils.removePrefix(input, state); 5411 let source = create(output); 5412 5413 if (source && opts.strictSlashes !== true) { 5414 source += `${SLASH_LITERAL}?`; 5415 } 5416 5417 return source; 5418 }; 5419 5420 module.exports = parse; 5421 5422 5423 /***/ }) 5424 /******/ ]);