UNPKG

@techmely/utils

Version:

Collection of helpful JavaScript / TypeScript utils

1,565 lines (1,544 loc) 11.8 MB
import { require_fsevents } from './chunk-RR7I4MHR.mjs'; import { require_path_key, require_merge_stream, require_cross_spawn } from './chunk-UFOKMNUE.mjs'; import { __commonJS, __require, __esm, __toESM, __export, __toCommonJS } from './chunk-NYLAFCGV.mjs'; // ../../node_modules/tsup/dist/chunk-MK5NEXLC.js var require_chunk_MK5NEXLC = __commonJS({ "../../node_modules/tsup/dist/chunk-MK5NEXLC.js"(exports) { Object.defineProperty(exports, "__esModule", { value: true }); var version = "8.0.1"; exports.version = version; } }); // ../../node_modules/array-union/index.js var require_array_union = __commonJS({ "../../node_modules/array-union/index.js"(exports, module) { module.exports = (...arguments_) => { return [...new Set([].concat(...arguments_))]; }; } }); // ../../node_modules/merge2/index.js var require_merge2 = __commonJS({ "../../node_modules/merge2/index.js"(exports, module) { var Stream = __require("stream"); var PassThrough = Stream.PassThrough; var slice = Array.prototype.slice; module.exports = merge2; function merge2() { const streamsQueue = []; const args = slice.call(arguments); let merging = false; let options = args[args.length - 1]; if (options && !Array.isArray(options) && options.pipe == null) { args.pop(); } else { options = {}; } const doEnd = options.end !== false; const doPipeError = options.pipeError === true; if (options.objectMode == null) { options.objectMode = true; } if (options.highWaterMark == null) { options.highWaterMark = 64 * 1024; } const mergedStream = PassThrough(options); function addStream() { for (let i = 0, len = arguments.length; i < len; i++) { streamsQueue.push(pauseStreams(arguments[i], options)); } mergeStream(); return this; } function mergeStream() { if (merging) { return; } merging = true; let streams = streamsQueue.shift(); if (!streams) { process.nextTick(endStream); return; } if (!Array.isArray(streams)) { streams = [streams]; } let pipesCount = streams.length + 1; function next2() { if (--pipesCount > 0) { return; } merging = false; mergeStream(); } function pipe(stream) { function onend() { stream.removeListener("merge2UnpipeEnd", onend); stream.removeListener("end", onend); if (doPipeError) { stream.removeListener("error", onerror); } next2(); } function onerror(err) { mergedStream.emit("error", err); } if (stream._readableState.endEmitted) { return next2(); } stream.on("merge2UnpipeEnd", onend); stream.on("end", onend); if (doPipeError) { stream.on("error", onerror); } stream.pipe(mergedStream, { end: false }); stream.resume(); } for (let i = 0; i < streams.length; i++) { pipe(streams[i]); } next2(); } function endStream() { merging = false; mergedStream.emit("queueDrain"); if (doEnd) { mergedStream.end(); } } mergedStream.setMaxListeners(0); mergedStream.add = addStream; mergedStream.on("unpipe", function(stream) { stream.emit("merge2UnpipeEnd"); }); if (args.length) { addStream.apply(null, args); } return mergedStream; } function pauseStreams(streams, options) { if (!Array.isArray(streams)) { if (!streams._readableState && streams.pipe) { streams = streams.pipe(PassThrough(options)); } if (!streams._readableState || !streams.pause || !streams.pipe) { throw new Error("Only readable stream can be merged."); } streams.pause(); } else { for (let i = 0, len = streams.length; i < len; i++) { streams[i] = pauseStreams(streams[i], options); } } return streams; } } }); // ../../node_modules/fast-glob/out/utils/array.js var require_array = __commonJS({ "../../node_modules/fast-glob/out/utils/array.js"(exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.splitWhen = exports.flatten = void 0; function flatten(items) { return items.reduce((collection, item) => [].concat(collection, item), []); } exports.flatten = flatten; function splitWhen(items, predicate) { const result = [[]]; let groupIndex = 0; for (const item of items) { if (predicate(item)) { groupIndex++; result[groupIndex] = []; } else { result[groupIndex].push(item); } } return result; } exports.splitWhen = splitWhen; } }); // ../../node_modules/fast-glob/out/utils/errno.js var require_errno = __commonJS({ "../../node_modules/fast-glob/out/utils/errno.js"(exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.isEnoentCodeError = void 0; function isEnoentCodeError(error) { return error.code === "ENOENT"; } exports.isEnoentCodeError = isEnoentCodeError; } }); // ../../node_modules/fast-glob/out/utils/fs.js var require_fs = __commonJS({ "../../node_modules/fast-glob/out/utils/fs.js"(exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.createDirentFromStats = void 0; var DirentFromStats = class { constructor(name, stats) { this.name = name; this.isBlockDevice = stats.isBlockDevice.bind(stats); this.isCharacterDevice = stats.isCharacterDevice.bind(stats); this.isDirectory = stats.isDirectory.bind(stats); this.isFIFO = stats.isFIFO.bind(stats); this.isFile = stats.isFile.bind(stats); this.isSocket = stats.isSocket.bind(stats); this.isSymbolicLink = stats.isSymbolicLink.bind(stats); } }; function createDirentFromStats(name, stats) { return new DirentFromStats(name, stats); } exports.createDirentFromStats = createDirentFromStats; } }); // ../../node_modules/fast-glob/out/utils/path.js var require_path = __commonJS({ "../../node_modules/fast-glob/out/utils/path.js"(exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.convertPosixPathToPattern = exports.convertWindowsPathToPattern = exports.convertPathToPattern = exports.escapePosixPath = exports.escapeWindowsPath = exports.escape = exports.removeLeadingDotSegment = exports.makeAbsolute = exports.unixify = void 0; var os = __require("os"); var path = __require("path"); var IS_WINDOWS_PLATFORM = os.platform() === "win32"; var LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; var POSIX_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g; var WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()[\]{}]|^!|[!+@](?=\())/g; var DOS_DEVICE_PATH_RE = /^\\\\([.?])/; var WINDOWS_BACKSLASHES_RE = /\\(?![!()+@[\]{}])/g; function unixify(filepath) { return filepath.replace(/\\/g, "/"); } exports.unixify = unixify; function makeAbsolute(cwd, filepath) { return path.resolve(cwd, filepath); } exports.makeAbsolute = makeAbsolute; function removeLeadingDotSegment(entry) { if (entry.charAt(0) === ".") { const secondCharactery = entry.charAt(1); if (secondCharactery === "/" || secondCharactery === "\\") { return entry.slice(LEADING_DOT_SEGMENT_CHARACTERS_COUNT); } } return entry; } exports.removeLeadingDotSegment = removeLeadingDotSegment; exports.escape = IS_WINDOWS_PLATFORM ? escapeWindowsPath : escapePosixPath; function escapeWindowsPath(pattern) { return pattern.replace(WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE, "\\$2"); } exports.escapeWindowsPath = escapeWindowsPath; function escapePosixPath(pattern) { return pattern.replace(POSIX_UNESCAPED_GLOB_SYMBOLS_RE, "\\$2"); } exports.escapePosixPath = escapePosixPath; exports.convertPathToPattern = IS_WINDOWS_PLATFORM ? convertWindowsPathToPattern : convertPosixPathToPattern; function convertWindowsPathToPattern(filepath) { return escapeWindowsPath(filepath).replace(DOS_DEVICE_PATH_RE, "//$1").replace(WINDOWS_BACKSLASHES_RE, "/"); } exports.convertWindowsPathToPattern = convertWindowsPathToPattern; function convertPosixPathToPattern(filepath) { return escapePosixPath(filepath); } exports.convertPosixPathToPattern = convertPosixPathToPattern; } }); // ../../node_modules/is-extglob/index.js var require_is_extglob = __commonJS({ "../../node_modules/is-extglob/index.js"(exports, module) { module.exports = function isExtglob(str) { if (typeof str !== "string" || str === "") { return false; } var match2; while (match2 = /(\\).|([@?!+*]\(.*\))/g.exec(str)) { if (match2[2]) return true; str = str.slice(match2.index + match2[0].length); } return false; }; } }); // ../../node_modules/is-glob/index.js var require_is_glob = __commonJS({ "../../node_modules/is-glob/index.js"(exports, module) { var isExtglob = require_is_extglob(); var chars2 = { "{": "}", "(": ")", "[": "]" }; var strictCheck = function(str) { if (str[0] === "!") { return true; } var index = 0; var pipeIndex = -2; var closeSquareIndex = -2; var closeCurlyIndex = -2; var closeParenIndex = -2; var backSlashIndex = -2; while (index < str.length) { if (str[index] === "*") { return true; } if (str[index + 1] === "?" && /[\].+)]/.test(str[index])) { return true; } if (closeSquareIndex !== -1 && str[index] === "[" && str[index + 1] !== "]") { if (closeSquareIndex < index) { closeSquareIndex = str.indexOf("]", index); } if (closeSquareIndex > index) { if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) { return true; } backSlashIndex = str.indexOf("\\", index); if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) { return true; } } } if (closeCurlyIndex !== -1 && str[index] === "{" && str[index + 1] !== "}") { closeCurlyIndex = str.indexOf("}", index); if (closeCurlyIndex > index) { backSlashIndex = str.indexOf("\\", index); if (backSlashIndex === -1 || backSlashIndex > closeCurlyIndex) { return true; } } } if (closeParenIndex !== -1 && str[index] === "(" && str[index + 1] === "?" && /[:!=]/.test(str[index + 2]) && str[index + 3] !== ")") { closeParenIndex = str.indexOf(")", index); if (closeParenIndex > index) { backSlashIndex = str.indexOf("\\", index); if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) { return true; } } } if (pipeIndex !== -1 && str[index] === "(" && str[index + 1] !== "|") { if (pipeIndex < index) { pipeIndex = str.indexOf("|", index); } if (pipeIndex !== -1 && str[pipeIndex + 1] !== ")") { closeParenIndex = str.indexOf(")", pipeIndex); if (closeParenIndex > pipeIndex) { backSlashIndex = str.indexOf("\\", pipeIndex); if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) { return true; } } } } if (str[index] === "\\") { var open = str[index + 1]; index += 2; var close = chars2[open]; if (close) { var n = str.indexOf(close, index); if (n !== -1) { index = n + 1; } } if (str[index] === "!") { return true; } } else { index++; } } return false; }; var relaxedCheck = function(str) { if (str[0] === "!") { return true; } var index = 0; while (index < str.length) { if (/[*?{}()[\]]/.test(str[index])) { return true; } if (str[index] === "\\") { var open = str[index + 1]; index += 2; var close = chars2[open]; if (close) { var n = str.indexOf(close, index); if (n !== -1) { index = n + 1; } } if (str[index] === "!") { return true; } } else { index++; } } return false; }; module.exports = function isGlob(str, options) { if (typeof str !== "string" || str === "") { return false; } if (isExtglob(str)) { return true; } var check = strictCheck; if (options && options.strict === false) { check = relaxedCheck; } return check(str); }; } }); // ../../node_modules/glob-parent/index.js var require_glob_parent = __commonJS({ "../../node_modules/glob-parent/index.js"(exports, module) { var isGlob = require_is_glob(); var pathPosixDirname = __require("path").posix.dirname; var isWin32 = __require("os").platform() === "win32"; var slash = "/"; var backslash = /\\/g; var enclosure = /[\{\[].*[\}\]]$/; var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/; var escaped = /\\([\!\*\?\|\[\]\(\)\{\}])/g; module.exports = function globParent(str, opts) { var options = Object.assign({ flipBackslashes: true }, opts); if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) { str = str.replace(backslash, slash); } if (enclosure.test(str)) { str += slash; } str += "a"; do { str = pathPosixDirname(str); } while (isGlob(str) || globby.test(str)); return str.replace(escaped, "$1"); }; } }); // ../../node_modules/braces/lib/utils.js var require_utils = __commonJS({ "../../node_modules/braces/lib/utils.js"(exports) { exports.isInteger = (num) => { if (typeof num === "number") { return Number.isInteger(num); } if (typeof num === "string" && num.trim() !== "") { return Number.isInteger(Number(num)); } return false; }; exports.find = (node, type) => node.nodes.find((node2) => node2.type === type); exports.exceedsLimit = (min, max, step = 1, limit) => { if (limit === false) return false; if (!exports.isInteger(min) || !exports.isInteger(max)) return false; return (Number(max) - Number(min)) / Number(step) >= limit; }; exports.escapeNode = (block, n = 0, type) => { let node = block.nodes[n]; if (!node) return; if (type && node.type === type || node.type === "open" || node.type === "close") { if (node.escaped !== true) { node.value = "\\" + node.value; node.escaped = true; } } }; exports.encloseBrace = (node) => { if (node.type !== "brace") return false; if (node.commas >> 0 + node.ranges >> 0 === 0) { node.invalid = true; return true; } return false; }; exports.isInvalidBrace = (block) => { if (block.type !== "brace") return false; if (block.invalid === true || block.dollar) return true; if (block.commas >> 0 + block.ranges >> 0 === 0) { block.invalid = true; return true; } if (block.open !== true || block.close !== true) { block.invalid = true; return true; } return false; }; exports.isOpenOrClose = (node) => { if (node.type === "open" || node.type === "close") { return true; } return node.open === true || node.close === true; }; exports.reduce = (nodes) => nodes.reduce((acc, node) => { if (node.type === "text") acc.push(node.value); if (node.type === "range") node.type = "text"; return acc; }, []); exports.flatten = (...args) => { const result = []; const flat = (arr) => { for (let i = 0; i < arr.length; i++) { let ele = arr[i]; Array.isArray(ele) ? flat(ele) : ele !== void 0 && result.push(ele); } return result; }; flat(args); return result; }; } }); // ../../node_modules/braces/lib/stringify.js var require_stringify = __commonJS({ "../../node_modules/braces/lib/stringify.js"(exports, module) { var utils = require_utils(); module.exports = (ast, options = {}) => { let stringify = (node, parent = {}) => { let invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent); let invalidNode = node.invalid === true && options.escapeInvalid === true; let output = ""; if (node.value) { if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) { return "\\" + node.value; } return node.value; } if (node.value) { return node.value; } if (node.nodes) { for (let child of node.nodes) { output += stringify(child); } } return output; }; return stringify(ast); }; } }); // ../../node_modules/is-number/index.js var require_is_number = __commonJS({ "../../node_modules/is-number/index.js"(exports, module) { module.exports = function(num) { if (typeof num === "number") { return num - num === 0; } if (typeof num === "string" && num.trim() !== "") { return Number.isFinite ? Number.isFinite(+num) : isFinite(+num); } return false; }; } }); // ../../node_modules/to-regex-range/index.js var require_to_regex_range = __commonJS({ "../../node_modules/to-regex-range/index.js"(exports, module) { var isNumber = require_is_number(); var toRegexRange = (min, max, options) => { if (isNumber(min) === false) { throw new TypeError("toRegexRange: expected the first argument to be a number"); } if (max === void 0 || min === max) { return String(min); } if (isNumber(max) === false) { throw new TypeError("toRegexRange: expected the second argument to be a number."); } let opts = { relaxZeros: true, ...options }; if (typeof opts.strictZeros === "boolean") { opts.relaxZeros = opts.strictZeros === false; } let relax = String(opts.relaxZeros); let shorthand = String(opts.shorthand); let capture = String(opts.capture); let wrap = String(opts.wrap); let cacheKey = min + ":" + max + "=" + relax + shorthand + capture + wrap; if (toRegexRange.cache.hasOwnProperty(cacheKey)) { return toRegexRange.cache[cacheKey].result; } let a = Math.min(min, max); let b = Math.max(min, max); if (Math.abs(a - b) === 1) { let result = min + "|" + max; if (opts.capture) { return `(${result})`; } if (opts.wrap === false) { return result; } return `(?:${result})`; } let isPadded = hasPadding(min) || hasPadding(max); let state2 = { min, max, a, b }; let positives = []; let negatives = []; if (isPadded) { state2.isPadded = isPadded; state2.maxLen = String(state2.max).length; } if (a < 0) { let newMin = b < 0 ? Math.abs(b) : 1; negatives = splitToPatterns(newMin, Math.abs(a), state2, opts); a = state2.a = 0; } if (b >= 0) { positives = splitToPatterns(a, b, state2, opts); } state2.negatives = negatives; state2.positives = positives; state2.result = collatePatterns(negatives, positives); if (opts.capture === true) { state2.result = `(${state2.result})`; } else if (opts.wrap !== false && positives.length + negatives.length > 1) { state2.result = `(?:${state2.result})`; } toRegexRange.cache[cacheKey] = state2; return state2.result; }; function collatePatterns(neg, pos, options) { let onlyNegative = filterPatterns(neg, pos, "-", false) || []; let onlyPositive = filterPatterns(pos, neg, "", false) || []; let intersected = filterPatterns(neg, pos, "-?", true) || []; let subpatterns = onlyNegative.concat(intersected).concat(onlyPositive); return subpatterns.join("|"); } function splitToRanges(min, max) { let nines = 1; let zeros = 1; let stop = countNines(min, nines); let stops = /* @__PURE__ */ new Set([max]); while (min <= stop && stop <= max) { stops.add(stop); nines += 1; stop = countNines(min, nines); } stop = countZeros(max + 1, zeros) - 1; while (min < stop && stop <= max) { stops.add(stop); zeros += 1; stop = countZeros(max + 1, zeros) - 1; } stops = [...stops]; stops.sort(compare); return stops; } function rangeToPattern(start, stop, options) { if (start === stop) { return { pattern: start, count: [], digits: 0 }; } let zipped = zip(start, stop); let digits = zipped.length; let pattern = ""; let count = 0; for (let i = 0; i < digits; i++) { let [startDigit, stopDigit] = zipped[i]; if (startDigit === stopDigit) { pattern += startDigit; } else if (startDigit !== "0" || stopDigit !== "9") { pattern += toCharacterClass(startDigit, stopDigit); } else { count++; } } if (count) { pattern += options.shorthand === true ? "\\d" : "[0-9]"; } return { pattern, count: [count], digits }; } function splitToPatterns(min, max, tok, options) { let ranges = splitToRanges(min, max); let tokens = []; let start = min; let prev; for (let i = 0; i < ranges.length; i++) { let max2 = ranges[i]; let obj = rangeToPattern(String(start), String(max2), options); let zeros = ""; if (!tok.isPadded && prev && prev.pattern === obj.pattern) { if (prev.count.length > 1) { prev.count.pop(); } prev.count.push(obj.count[0]); prev.string = prev.pattern + toQuantifier(prev.count); start = max2 + 1; continue; } if (tok.isPadded) { zeros = padZeros(max2, tok, options); } obj.string = zeros + obj.pattern + toQuantifier(obj.count); tokens.push(obj); start = max2 + 1; prev = obj; } return tokens; } function filterPatterns(arr, comparison, prefix, intersection, options) { let result = []; for (let ele of arr) { let { string } = ele; if (!intersection && !contains(comparison, "string", string)) { result.push(prefix + string); } if (intersection && contains(comparison, "string", string)) { result.push(prefix + string); } } return result; } function zip(a, b) { let arr = []; for (let i = 0; i < a.length; i++) arr.push([a[i], b[i]]); return arr; } function compare(a, b) { return a > b ? 1 : b > a ? -1 : 0; } function contains(arr, key, val) { return arr.some((ele) => ele[key] === val); } function countNines(min, len) { return Number(String(min).slice(0, -len) + "9".repeat(len)); } function countZeros(integer, zeros) { return integer - integer % Math.pow(10, zeros); } function toQuantifier(digits) { let [start = 0, stop = ""] = digits; if (stop || start > 1) { return `{${start + (stop ? "," + stop : "")}}`; } return ""; } function toCharacterClass(a, b, options) { return `[${a}${b - a === 1 ? "" : "-"}${b}]`; } function hasPadding(str) { return /^-?(0+)\d/.test(str); } function padZeros(value, tok, options) { if (!tok.isPadded) { return value; } let diff = Math.abs(tok.maxLen - String(value).length); let relax = options.relaxZeros !== false; switch (diff) { case 0: return ""; case 1: return relax ? "0?" : "0"; case 2: return relax ? "0{0,2}" : "00"; default: { return relax ? `0{0,${diff}}` : `0{${diff}}`; } } } toRegexRange.cache = {}; toRegexRange.clearCache = () => toRegexRange.cache = {}; module.exports = toRegexRange; } }); // ../../node_modules/fill-range/index.js var require_fill_range = __commonJS({ "../../node_modules/fill-range/index.js"(exports, module) { var util = __require("util"); var toRegexRange = require_to_regex_range(); var isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val); var transform2 = (toNumber) => { return (value) => toNumber === true ? Number(value) : String(value); }; var isValidValue = (value) => { return typeof value === "number" || typeof value === "string" && value !== ""; }; var isNumber = (num) => Number.isInteger(+num); var zeros = (input2) => { let value = `${input2}`; let index = -1; if (value[0] === "-") value = value.slice(1); if (value === "0") return false; while (value[++index] === "0") ; return index > 0; }; var stringify = (start, end, options) => { if (typeof start === "string" || typeof end === "string") { return true; } return options.stringify === true; }; var pad = (input2, maxLength, toNumber) => { if (maxLength > 0) { let dash = input2[0] === "-" ? "-" : ""; if (dash) input2 = input2.slice(1); input2 = dash + input2.padStart(dash ? maxLength - 1 : maxLength, "0"); } if (toNumber === false) { return String(input2); } return input2; }; var toMaxLen = (input2, maxLength) => { let negative = input2[0] === "-" ? "-" : ""; if (negative) { input2 = input2.slice(1); maxLength--; } while (input2.length < maxLength) input2 = "0" + input2; return negative ? "-" + input2 : input2; }; var toSequence = (parts, options) => { parts.negatives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0); parts.positives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0); let prefix = options.capture ? "" : "?:"; let positives = ""; let negatives = ""; let result; if (parts.positives.length) { positives = parts.positives.join("|"); } if (parts.negatives.length) { negatives = `-(${prefix}${parts.negatives.join("|")})`; } if (positives && negatives) { result = `${positives}|${negatives}`; } else { result = positives || negatives; } if (options.wrap) { return `(${prefix}${result})`; } return result; }; var toRange = (a, b, isNumbers, options) => { if (isNumbers) { return toRegexRange(a, b, { wrap: false, ...options }); } let start = String.fromCharCode(a); if (a === b) return start; let stop = String.fromCharCode(b); return `[${start}-${stop}]`; }; var toRegex = (start, end, options) => { if (Array.isArray(start)) { let wrap = options.wrap === true; let prefix = options.capture ? "" : "?:"; return wrap ? `(${prefix}${start.join("|")})` : start.join("|"); } return toRegexRange(start, end, options); }; var rangeError = (...args) => { return new RangeError("Invalid range arguments: " + util.inspect(...args)); }; var invalidRange = (start, end, options) => { if (options.strictRanges === true) throw rangeError([start, end]); return []; }; var invalidStep = (step, options) => { if (options.strictRanges === true) { throw new TypeError(`Expected step "${step}" to be a number`); } return []; }; var fillNumbers = (start, end, step = 1, options = {}) => { let a = Number(start); let b = Number(end); if (!Number.isInteger(a) || !Number.isInteger(b)) { if (options.strictRanges === true) throw rangeError([start, end]); return []; } if (a === 0) a = 0; if (b === 0) b = 0; let descending = a > b; let startString = String(start); let endString = String(end); let stepString = String(step); step = Math.max(Math.abs(step), 1); let padded = zeros(startString) || zeros(endString) || zeros(stepString); let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0; let toNumber = padded === false && stringify(start, end, options) === false; let format = options.transform || transform2(toNumber); if (options.toRegex && step === 1) { return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options); } let parts = { negatives: [], positives: [] }; let push = (num) => parts[num < 0 ? "negatives" : "positives"].push(Math.abs(num)); let range = []; let index = 0; while (descending ? a >= b : a <= b) { if (options.toRegex === true && step > 1) { push(a); } else { range.push(pad(format(a, index), maxLen, toNumber)); } a = descending ? a - step : a + step; index++; } if (options.toRegex === true) { return step > 1 ? toSequence(parts, options) : toRegex(range, null, { wrap: false, ...options }); } return range; }; var fillLetters = (start, end, step = 1, options = {}) => { if (!isNumber(start) && start.length > 1 || !isNumber(end) && end.length > 1) { return invalidRange(start, end, options); } let format = options.transform || ((val) => String.fromCharCode(val)); let a = `${start}`.charCodeAt(0); let b = `${end}`.charCodeAt(0); let descending = a > b; let min = Math.min(a, b); let max = Math.max(a, b); if (options.toRegex && step === 1) { return toRange(min, max, false, options); } let range = []; let index = 0; while (descending ? a >= b : a <= b) { range.push(format(a, index)); a = descending ? a - step : a + step; index++; } if (options.toRegex === true) { return toRegex(range, null, { wrap: false, options }); } return range; }; var fill = (start, end, step, options = {}) => { if (end == null && isValidValue(start)) { return [start]; } if (!isValidValue(start) || !isValidValue(end)) { return invalidRange(start, end, options); } if (typeof step === "function") { return fill(start, end, 1, { transform: step }); } if (isObject(step)) { return fill(start, end, 0, step); } let opts = { ...options }; if (opts.capture === true) opts.wrap = true; step = step || opts.step || 1; if (!isNumber(step)) { if (step != null && !isObject(step)) return invalidStep(step, opts); return fill(start, end, 1, step); } if (isNumber(start) && isNumber(end)) { return fillNumbers(start, end, step, opts); } return fillLetters(start, end, Math.max(Math.abs(step), 1), opts); }; module.exports = fill; } }); // ../../node_modules/braces/lib/compile.js var require_compile = __commonJS({ "../../node_modules/braces/lib/compile.js"(exports, module) { var fill = require_fill_range(); var utils = require_utils(); var compile = (ast, options = {}) => { let walk = (node, parent = {}) => { let invalidBlock = utils.isInvalidBrace(parent); let invalidNode = node.invalid === true && options.escapeInvalid === true; let invalid = invalidBlock === true || invalidNode === true; let prefix = options.escapeInvalid === true ? "\\" : ""; let output = ""; if (node.isOpen === true) { return prefix + node.value; } if (node.isClose === true) { return prefix + node.value; } if (node.type === "open") { return invalid ? prefix + node.value : "("; } if (node.type === "close") { return invalid ? prefix + node.value : ")"; } if (node.type === "comma") { return node.prev.type === "comma" ? "" : invalid ? node.value : "|"; } if (node.value) { return node.value; } if (node.nodes && node.ranges > 0) { let args = utils.reduce(node.nodes); let range = fill(...args, { ...options, wrap: false, toRegex: true }); if (range.length !== 0) { return args.length > 1 && range.length > 1 ? `(${range})` : range; } } if (node.nodes) { for (let child of node.nodes) { output += walk(child, node); } } return output; }; return walk(ast); }; module.exports = compile; } }); // ../../node_modules/braces/lib/expand.js var require_expand = __commonJS({ "../../node_modules/braces/lib/expand.js"(exports, module) { var fill = require_fill_range(); var stringify = require_stringify(); var utils = require_utils(); var append = (queue = "", stash = "", enclose = false) => { let result = []; queue = [].concat(queue); stash = [].concat(stash); if (!stash.length) return queue; if (!queue.length) { return enclose ? utils.flatten(stash).map((ele) => `{${ele}}`) : stash; } for (let item of queue) { if (Array.isArray(item)) { for (let value of item) { result.push(append(value, stash, enclose)); } } else { for (let ele of stash) { if (enclose === true && typeof ele === "string") ele = `{${ele}}`; result.push(Array.isArray(ele) ? append(item, ele, enclose) : item + ele); } } } return utils.flatten(result); }; var expand = (ast, options = {}) => { let rangeLimit = options.rangeLimit === void 0 ? 1e3 : options.rangeLimit; let walk = (node, parent = {}) => { node.queue = []; let p = parent; let q = parent.queue; while (p.type !== "brace" && p.type !== "root" && p.parent) { p = p.parent; q = p.queue; } if (node.invalid || node.dollar) { q.push(append(q.pop(), stringify(node, options))); return; } if (node.type === "brace" && node.invalid !== true && node.nodes.length === 2) { q.push(append(q.pop(), ["{}"])); return; } if (node.nodes && node.ranges > 0) { let args = utils.reduce(node.nodes); if (utils.exceedsLimit(...args, options.step, rangeLimit)) { throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit."); } let range = fill(...args, options); if (range.length === 0) { range = stringify(node, options); } q.push(append(q.pop(), range)); node.nodes = []; return; } let enclose = utils.encloseBrace(node); let queue = node.queue; let block = node; while (block.type !== "brace" && block.type !== "root" && block.parent) { block = block.parent; queue = block.queue; } for (let i = 0; i < node.nodes.length; i++) { let child = node.nodes[i]; if (child.type === "comma" && node.type === "brace") { if (i === 1) queue.push(""); queue.push(""); continue; } if (child.type === "close") { q.push(append(q.pop(), queue, enclose)); continue; } if (child.value && child.type !== "open") { queue.push(append(queue.pop(), child.value)); continue; } if (child.nodes) { walk(child, node); } } return queue; }; return utils.flatten(walk(ast)); }; module.exports = expand; } }); // ../../node_modules/braces/lib/constants.js var require_constants = __commonJS({ "../../node_modules/braces/lib/constants.js"(exports, module) { module.exports = { MAX_LENGTH: 1024 * 64, // Digits CHAR_0: "0", /* 0 */ CHAR_9: "9", /* 9 */ // Alphabet chars. CHAR_UPPERCASE_A: "A", /* A */ CHAR_LOWERCASE_A: "a", /* a */ CHAR_UPPERCASE_Z: "Z", /* Z */ CHAR_LOWERCASE_Z: "z", /* z */ CHAR_LEFT_PARENTHESES: "(", /* ( */ CHAR_RIGHT_PARENTHESES: ")", /* ) */ CHAR_ASTERISK: "*", /* * */ // Non-alphabetic chars. CHAR_AMPERSAND: "&", /* & */ CHAR_AT: "@", /* @ */ CHAR_BACKSLASH: "\\", /* \ */ CHAR_BACKTICK: "`", /* ` */ CHAR_CARRIAGE_RETURN: "\r", /* \r */ CHAR_CIRCUMFLEX_ACCENT: "^", /* ^ */ CHAR_COLON: ":", /* : */ CHAR_COMMA: ",", /* , */ CHAR_DOLLAR: "$", /* . */ CHAR_DOT: ".", /* . */ CHAR_DOUBLE_QUOTE: '"', /* " */ CHAR_EQUAL: "=", /* = */ CHAR_EXCLAMATION_MARK: "!", /* ! */ CHAR_FORM_FEED: "\f", /* \f */ CHAR_FORWARD_SLASH: "/", /* / */ CHAR_HASH: "#", /* # */ CHAR_HYPHEN_MINUS: "-", /* - */ CHAR_LEFT_ANGLE_BRACKET: "<", /* < */ CHAR_LEFT_CURLY_BRACE: "{", /* { */ CHAR_LEFT_SQUARE_BRACKET: "[", /* [ */ CHAR_LINE_FEED: "\n", /* \n */ CHAR_NO_BREAK_SPACE: "\xA0", /* \u00A0 */ CHAR_PERCENT: "%", /* % */ CHAR_PLUS: "+", /* + */ CHAR_QUESTION_MARK: "?", /* ? */ CHAR_RIGHT_ANGLE_BRACKET: ">", /* > */ CHAR_RIGHT_CURLY_BRACE: "}", /* } */ CHAR_RIGHT_SQUARE_BRACKET: "]", /* ] */ CHAR_SEMICOLON: ";", /* ; */ CHAR_SINGLE_QUOTE: "'", /* ' */ CHAR_SPACE: " ", /* */ CHAR_TAB: " ", /* \t */ CHAR_UNDERSCORE: "_", /* _ */ CHAR_VERTICAL_LINE: "|", /* | */ CHAR_ZERO_WIDTH_NOBREAK_SPACE: "\uFEFF" /* \uFEFF */ }; } }); // ../../node_modules/braces/lib/parse.js var require_parse = __commonJS({ "../../node_modules/braces/lib/parse.js"(exports, module) { var stringify = require_stringify(); var { MAX_LENGTH, CHAR_BACKSLASH, /* \ */ CHAR_BACKTICK, /* ` */ CHAR_COMMA, /* , */ CHAR_DOT, /* . */ CHAR_LEFT_PARENTHESES, /* ( */ CHAR_RIGHT_PARENTHESES, /* ) */ CHAR_LEFT_CURLY_BRACE, /* { */ CHAR_RIGHT_CURLY_BRACE, /* } */ CHAR_LEFT_SQUARE_BRACKET, /* [ */ CHAR_RIGHT_SQUARE_BRACKET, /* ] */ CHAR_DOUBLE_QUOTE, /* " */ CHAR_SINGLE_QUOTE, /* ' */ CHAR_NO_BREAK_SPACE, CHAR_ZERO_WIDTH_NOBREAK_SPACE } = require_constants(); var parse2 = (input2, options = {}) => { if (typeof input2 !== "string") { throw new TypeError("Expected a string"); } let opts = options || {}; let max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; if (input2.length > max) { throw new SyntaxError(`Input length (${input2.length}), exceeds max characters (${max})`); } let ast = { type: "root", input: input2, nodes: [] }; let stack = [ast]; let block = ast; let prev = ast; let brackets = 0; let length = input2.length; let index = 0; let depth = 0; let value; const advance = () => input2[index++]; const push = (node) => { if (node.type === "text" && prev.type === "dot") { prev.type = "text"; } if (prev && prev.type === "text" && node.type === "text") { prev.value += node.value; return; } block.nodes.push(node); node.parent = block; node.prev = prev; prev = node; return node; }; push({ type: "bos" }); while (index < length) { block = stack[stack.length - 1]; value = advance(); if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) { continue; } if (value === CHAR_BACKSLASH) { push({ type: "text", value: (options.keepEscaping ? value : "") + advance() }); continue; } if (value === CHAR_RIGHT_SQUARE_BRACKET) { push({ type: "text", value: "\\" + value }); continue; } if (value === CHAR_LEFT_SQUARE_BRACKET) { brackets++; let next2; while (index < length && (next2 = advance())) { value += next2; if (next2 === CHAR_LEFT_SQUARE_BRACKET) { brackets++; continue; } if (next2 === CHAR_BACKSLASH) { value += advance(); continue; } if (next2 === CHAR_RIGHT_SQUARE_BRACKET) { brackets--; if (brackets === 0) { break; } } } push({ type: "text", value }); continue; } if (value === CHAR_LEFT_PARENTHESES) { block = push({ type: "paren", nodes: [] }); stack.push(block); push({ type: "text", value }); continue; } if (value === CHAR_RIGHT_PARENTHESES) { if (block.type !== "paren") { push({ type: "text", value }); continue; } block = stack.pop(); push({ type: "text", value }); block = stack[stack.length - 1]; continue; } if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) { let open = value; let next2; if (options.keepQuotes !== true) { value = ""; } while (index < length && (next2 = advance())) { if (next2 === CHAR_BACKSLASH) { value += next2 + advance(); continue; } if (next2 === open) { if (options.keepQuotes === true) value += next2; break; } value += next2; } push({ type: "text", value }); continue; } if (value === CHAR_LEFT_CURLY_BRACE) { depth++; let dollar = prev.value && prev.value.slice(-1) === "$" || block.dollar === true; let brace = { type: "brace", open: true, close: false, dollar, depth, commas: 0, ranges: 0, nodes: [] }; block = push(brace); stack.push(block); push({ type: "open", value }); continue; } if (value === CHAR_RIGHT_CURLY_BRACE) { if (block.type !== "brace") { push({ type: "text", value }); continue; } let type = "close"; block = stack.pop(); block.close = true; push({ type, value }); depth--; block = stack[stack.length - 1]; continue; } if (value === CHAR_COMMA && depth > 0) { if (block.ranges > 0) { block.ranges = 0; let open = block.nodes.shift(); block.nodes = [open, { type: "text", value: stringify(block) }]; } push({ type: "comma", value }); block.commas++; continue; } if (value === CHAR_DOT && depth > 0 && block.commas === 0) { let siblings = block.nodes; if (depth === 0 || siblings.length === 0) { push({ type: "text", value }); continue; } if (prev.type === "dot") { block.range = []; prev.value += value; prev.type = "range"; if (block.nodes.length !== 3 && block.nodes.length !== 5) { block.invalid = true; block.ranges = 0; prev.type = "text"; continue; } block.ranges++; block.args = []; continue; } if (prev.type === "range") { siblings.pop(); let before = siblings[siblings.length - 1]; before.value += prev.value + value; prev = before; block.ranges--; continue; } push({ type: "dot", value }); continue; } push({ type: "text", value }); } do { block = stack.pop(); if (block.type !== "root") { block.nodes.forEach((node) => { if (!node.nodes) { if (node.type === "open") node.isOpen = true; if (node.type === "close") node.isClose = true; if (!node.nodes) node.type = "text"; node.invalid = true; } }); let parent = stack[stack.length - 1]; let index2 = parent.nodes.indexOf(block); parent.nodes.splice(index2, 1, ...block.nodes); } } while (stack.length > 0); push({ type: "eos" }); return ast; }; module.exports = parse2; } }); // ../../node_modules/braces/index.js var require_braces = __commonJS({ "../../node_modules/braces/index.js"(exports, module) { var stringify = require_stringify(); var compile = require_compile(); var expand = require_expand(); var parse2 = require_parse(); var braces = (input2, options = {}) => { let output = []; if (Array.isArray(input2)) { for (let pattern of input2) { let result = braces.create(pattern, options); if (Array.isArray(result)) { output.push(...result); } else { output.push(result); } } } else { output = [].concat(braces.create(input2, options)); } if (options && options.expand === true && options.nodupes === true) { output = [...new Set(output)]; } return output; }; braces.parse = (input2, options = {}) => parse2(input2, options); braces.stringify = (input2, options = {}) => { if (typeof input2 === "string") { return stringify(braces.parse(input2, options), options); } return stringify(input2, options); }; braces.compile = (input2, options = {}) => { if (typeof input2 === "string") { input2 = braces.parse(input2, options); } return compile(input2, options); }; braces.expand = (input2, options = {}) => { if (typeof input2 === "string") { input2 = braces.parse(input2, options); } let result = expand(input2, options); if (options.noempty === true) { result = result.filter(Boolean); } if (options.nodupes === true) { result = [...new Set(result)]; } return result; }; braces.create = (input2, options = {}) => { if (input2 === "" || input2.length < 3) { return [input2]; } return options.expand !== true ? braces.compile(input2, options) : braces.expand(input2, options); }; module.exports = braces; } }); // ../../node_modules/picomatch/lib/constants.js var require_constants2 = __commonJS({ "../../node_modules/picomatch/lib/constants.js"(exports, module) { var path = __require("path"); var WIN_SLASH = "\\\\/"; var WIN_NO_SLASH = `[^${WIN_SLASH}]`; var DOT_LITERAL = "\\."; var PLUS_LITERAL = "\\+"; var QMARK_LITERAL = "\\?"; var SLASH_LITERAL = "\\/"; var ONE_CHAR = "(?=.)"; var QMARK = "[^/]"; var END_ANCHOR = `(?:${SLASH_LITERAL}|$)`; var START_ANCHOR = `(?:^|${SLASH_LITERAL})`; var DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`; var NO_DOT = `(?!${DOT_LITERAL})`; var NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`; var NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`; var NO_DOTS_SLASH = `(?!${DOTS_SLASH})`; var QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`; var STAR = `${QMARK}*?`; var POSIX_CHARS = { DOT_LITERAL, PLUS_LITERAL, QMARK_LITERAL, SLASH_LITERAL, ONE_CHAR, QMARK, END_ANCHOR, DOTS_SLASH, NO_DOT, NO_DOTS, NO_DOT_SLASH, NO_DOTS_SLASH, QMARK_NO_DOT, STAR, START_ANCHOR }; var WINDOWS_CHARS = { ...POSIX_CHARS, SLASH_LITERAL: `[${WIN_SLA