prettier
Version:
Prettier is an opinionated code formatter
1,491 lines (1,472 loc) • 744 kB
JavaScript
import { createRequire as __prettierCreateRequire } from "module";
import { fileURLToPath as __prettierFileUrlToPath } from "url";
import { dirname as __prettierDirname } from "path";
const require = __prettierCreateRequire(import.meta.url);
const __filename = __prettierFileUrlToPath(import.meta.url);
const __dirname = __prettierDirname(__filename);
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __typeError = (msg) => {
throw TypeError(msg);
};
var __defNormalProp = (obj, key2, value) => key2 in obj ? __defProp(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
}) : x)(function(x) {
if (typeof require !== "undefined") return require.apply(this, arguments);
throw Error('Dynamic require of "' + x + '" is not supported');
});
var __commonJS = (cb, mod) => function __require2() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key2 of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key2) && key2 !== except)
__defProp(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __publicField = (obj, key2, value) => __defNormalProp(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
// node_modules/fast-glob/out/utils/array.js
var require_array = __commonJS({
"node_modules/fast-glob/out/utils/array.js"(exports) {
"use strict";
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) {
"use strict";
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) {
"use strict";
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) {
"use strict";
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 os2 = __require("os");
var path13 = __require("path");
var IS_WINDOWS_PLATFORM = os2.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 path13.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(str2) {
if (typeof str2 !== "string" || str2 === "") {
return false;
}
var match;
while (match = /(\\).|([@?!+*]\(.*\))/g.exec(str2)) {
if (match[2]) return true;
str2 = str2.slice(match.index + match[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 chars = { "{": "}", "(": ")", "[": "]" };
var strictCheck = function(str2) {
if (str2[0] === "!") {
return true;
}
var index = 0;
var pipeIndex = -2;
var closeSquareIndex = -2;
var closeCurlyIndex = -2;
var closeParenIndex = -2;
var backSlashIndex = -2;
while (index < str2.length) {
if (str2[index] === "*") {
return true;
}
if (str2[index + 1] === "?" && /[\].+)]/.test(str2[index])) {
return true;
}
if (closeSquareIndex !== -1 && str2[index] === "[" && str2[index + 1] !== "]") {
if (closeSquareIndex < index) {
closeSquareIndex = str2.indexOf("]", index);
}
if (closeSquareIndex > index) {
if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) {
return true;
}
backSlashIndex = str2.indexOf("\\", index);
if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) {
return true;
}
}
}
if (closeCurlyIndex !== -1 && str2[index] === "{" && str2[index + 1] !== "}") {
closeCurlyIndex = str2.indexOf("}", index);
if (closeCurlyIndex > index) {
backSlashIndex = str2.indexOf("\\", index);
if (backSlashIndex === -1 || backSlashIndex > closeCurlyIndex) {
return true;
}
}
}
if (closeParenIndex !== -1 && str2[index] === "(" && str2[index + 1] === "?" && /[:!=]/.test(str2[index + 2]) && str2[index + 3] !== ")") {
closeParenIndex = str2.indexOf(")", index);
if (closeParenIndex > index) {
backSlashIndex = str2.indexOf("\\", index);
if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) {
return true;
}
}
}
if (pipeIndex !== -1 && str2[index] === "(" && str2[index + 1] !== "|") {
if (pipeIndex < index) {
pipeIndex = str2.indexOf("|", index);
}
if (pipeIndex !== -1 && str2[pipeIndex + 1] !== ")") {
closeParenIndex = str2.indexOf(")", pipeIndex);
if (closeParenIndex > pipeIndex) {
backSlashIndex = str2.indexOf("\\", pipeIndex);
if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) {
return true;
}
}
}
}
if (str2[index] === "\\") {
var open = str2[index + 1];
index += 2;
var close = chars[open];
if (close) {
var n = str2.indexOf(close, index);
if (n !== -1) {
index = n + 1;
}
}
if (str2[index] === "!") {
return true;
}
} else {
index++;
}
}
return false;
};
var relaxedCheck = function(str2) {
if (str2[0] === "!") {
return true;
}
var index = 0;
while (index < str2.length) {
if (/[*?{}()[\]]/.test(str2[index])) {
return true;
}
if (str2[index] === "\\") {
var open = str2[index + 1];
index += 2;
var close = chars[open];
if (close) {
var n = str2.indexOf(close, index);
if (n !== -1) {
index = n + 1;
}
}
if (str2[index] === "!") {
return true;
}
} else {
index++;
}
}
return false;
};
module.exports = function isGlob(str2, options8) {
if (typeof str2 !== "string" || str2 === "") {
return false;
}
if (isExtglob(str2)) {
return true;
}
var check2 = strictCheck;
if (options8 && options8.strict === false) {
check2 = relaxedCheck;
}
return check2(str2);
};
}
});
// node_modules/glob-parent/index.js
var require_glob_parent = __commonJS({
"node_modules/glob-parent/index.js"(exports, module) {
"use strict";
var isGlob = require_is_glob();
var pathPosixDirname = __require("path").posix.dirname;
var isWin32 = __require("os").platform() === "win32";
var slash2 = "/";
var backslash = /\\/g;
var enclosure = /[\{\[].*[\}\]]$/;
var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/;
var escaped = /\\([\!\*\?\|\[\]\(\)\{\}])/g;
module.exports = function globParent(str2, opts) {
var options8 = Object.assign({ flipBackslashes: true }, opts);
if (options8.flipBackslashes && isWin32 && str2.indexOf(slash2) < 0) {
str2 = str2.replace(backslash, slash2);
}
if (enclosure.test(str2)) {
str2 += slash2;
}
str2 += "a";
do {
str2 = pathPosixDirname(str2);
} while (isGlob(str2) || globby.test(str2));
return str2.replace(escaped, "$1");
};
}
});
// node_modules/braces/lib/utils.js
var require_utils = __commonJS({
"node_modules/braces/lib/utils.js"(exports) {
"use strict";
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, type2) => node.nodes.find((node2) => node2.type === type2);
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, type2) => {
const node = block.nodes[n];
if (!node) return;
if (type2 && node.type === type2 || 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++) {
const ele = arr[i];
if (Array.isArray(ele)) {
flat(ele);
continue;
}
if (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) {
"use strict";
var utils = require_utils();
module.exports = (ast, options8 = {}) => {
const stringify2 = (node, parent = {}) => {
const invalidBlock = options8.escapeInvalid && utils.isInvalidBrace(parent);
const invalidNode = node.invalid === true && options8.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 (const child of node.nodes) {
output += stringify2(child);
}
}
return output;
};
return stringify2(ast);
};
}
});
// node_modules/is-number/index.js
var require_is_number = __commonJS({
"node_modules/is-number/index.js"(exports, module) {
"use strict";
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) {
"use strict";
var isNumber = require_is_number();
var toRegexRange = (min, max, options8) => {
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, ...options8 };
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 state = { min, max, a, b };
let positives = [];
let negatives = [];
if (isPadded) {
state.isPadded = isPadded;
state.maxLen = String(state.max).length;
}
if (a < 0) {
let newMin = b < 0 ? Math.abs(b) : 1;
negatives = splitToPatterns(newMin, Math.abs(a), state, opts);
a = state.a = 0;
}
if (b >= 0) {
positives = splitToPatterns(a, b, state, opts);
}
state.negatives = negatives;
state.positives = positives;
state.result = collatePatterns(negatives, positives, opts);
if (opts.capture === true) {
state.result = `(${state.result})`;
} else if (opts.wrap !== false && positives.length + negatives.length > 1) {
state.result = `(?:${state.result})`;
}
toRegexRange.cache[cacheKey] = state;
return state.result;
};
function collatePatterns(neg, pos2, options8) {
let onlyNegative = filterPatterns(neg, pos2, "-", false, options8) || [];
let onlyPositive = filterPatterns(pos2, neg, "", false, options8) || [];
let intersected = filterPatterns(neg, pos2, "-?", true, options8) || [];
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, options8) {
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, options8);
} else {
count++;
}
}
if (count) {
pattern += options8.shorthand === true ? "\\d" : "[0-9]";
}
return { pattern, count: [count], digits };
}
function splitToPatterns(min, max, tok, options8) {
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), options8);
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, options8);
}
obj.string = zeros + obj.pattern + toQuantifier(obj.count);
tokens.push(obj);
start = max2 + 1;
prev = obj;
}
return tokens;
}
function filterPatterns(arr, comparison, prefix, intersection, options8) {
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, key2, val) {
return arr.some((ele) => ele[key2] === 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, options8) {
return `[${a}${b - a === 1 ? "" : "-"}${b}]`;
}
function hasPadding(str2) {
return /^-?(0+)\d/.test(str2);
}
function padZeros(value, tok, options8) {
if (!tok.isPadded) {
return value;
}
let diff2 = Math.abs(tok.maxLen - String(value).length);
let relax = options8.relaxZeros !== false;
switch (diff2) {
case 0:
return "";
case 1:
return relax ? "0?" : "0";
case 2:
return relax ? "0{0,2}" : "00";
default: {
return relax ? `0{0,${diff2}}` : `0{${diff2}}`;
}
}
}
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) {
"use strict";
var util2 = __require("util");
var toRegexRange = require_to_regex_range();
var isObject3 = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
var transform = (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 = (input) => {
let value = `${input}`;
let index = -1;
if (value[0] === "-") value = value.slice(1);
if (value === "0") return false;
while (value[++index] === "0") ;
return index > 0;
};
var stringify2 = (start, end, options8) => {
if (typeof start === "string" || typeof end === "string") {
return true;
}
return options8.stringify === true;
};
var pad = (input, maxLength, toNumber) => {
if (maxLength > 0) {
let dash = input[0] === "-" ? "-" : "";
if (dash) input = input.slice(1);
input = dash + input.padStart(dash ? maxLength - 1 : maxLength, "0");
}
if (toNumber === false) {
return String(input);
}
return input;
};
var toMaxLen = (input, maxLength) => {
let negative = input[0] === "-" ? "-" : "";
if (negative) {
input = input.slice(1);
maxLength--;
}
while (input.length < maxLength) input = "0" + input;
return negative ? "-" + input : input;
};
var toSequence = (parts, options8, maxLen) => {
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 = options8.capture ? "" : "?:";
let positives = "";
let negatives = "";
let result;
if (parts.positives.length) {
positives = parts.positives.map((v) => toMaxLen(String(v), maxLen)).join("|");
}
if (parts.negatives.length) {
negatives = `-(${prefix}${parts.negatives.map((v) => toMaxLen(String(v), maxLen)).join("|")})`;
}
if (positives && negatives) {
result = `${positives}|${negatives}`;
} else {
result = positives || negatives;
}
if (options8.wrap) {
return `(${prefix}${result})`;
}
return result;
};
var toRange = (a, b, isNumbers, options8) => {
if (isNumbers) {
return toRegexRange(a, b, { wrap: false, ...options8 });
}
let start = String.fromCharCode(a);
if (a === b) return start;
let stop = String.fromCharCode(b);
return `[${start}-${stop}]`;
};
var toRegex = (start, end, options8) => {
if (Array.isArray(start)) {
let wrap = options8.wrap === true;
let prefix = options8.capture ? "" : "?:";
return wrap ? `(${prefix}${start.join("|")})` : start.join("|");
}
return toRegexRange(start, end, options8);
};
var rangeError = (...args) => {
return new RangeError("Invalid range arguments: " + util2.inspect(...args));
};
var invalidRange = (start, end, options8) => {
if (options8.strictRanges === true) throw rangeError([start, end]);
return [];
};
var invalidStep = (step, options8) => {
if (options8.strictRanges === true) {
throw new TypeError(`Expected step "${step}" to be a number`);
}
return [];
};
var fillNumbers = (start, end, step = 1, options8 = {}) => {
let a = Number(start);
let b = Number(end);
if (!Number.isInteger(a) || !Number.isInteger(b)) {
if (options8.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 && stringify2(start, end, options8) === false;
let format3 = options8.transform || transform(toNumber);
if (options8.toRegex && step === 1) {
return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options8);
}
let parts = { negatives: [], positives: [] };
let push2 = (num) => parts[num < 0 ? "negatives" : "positives"].push(Math.abs(num));
let range = [];
let index = 0;
while (descending ? a >= b : a <= b) {
if (options8.toRegex === true && step > 1) {
push2(a);
} else {
range.push(pad(format3(a, index), maxLen, toNumber));
}
a = descending ? a - step : a + step;
index++;
}
if (options8.toRegex === true) {
return step > 1 ? toSequence(parts, options8, maxLen) : toRegex(range, null, { wrap: false, ...options8 });
}
return range;
};
var fillLetters = (start, end, step = 1, options8 = {}) => {
if (!isNumber(start) && start.length > 1 || !isNumber(end) && end.length > 1) {
return invalidRange(start, end, options8);
}
let format3 = options8.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 (options8.toRegex && step === 1) {
return toRange(min, max, false, options8);
}
let range = [];
let index = 0;
while (descending ? a >= b : a <= b) {
range.push(format3(a, index));
a = descending ? a - step : a + step;
index++;
}
if (options8.toRegex === true) {
return toRegex(range, null, { wrap: false, options: options8 });
}
return range;
};
var fill = (start, end, step, options8 = {}) => {
if (end == null && isValidValue(start)) {
return [start];
}
if (!isValidValue(start) || !isValidValue(end)) {
return invalidRange(start, end, options8);
}
if (typeof step === "function") {
return fill(start, end, 1, { transform: step });
}
if (isObject3(step)) {
return fill(start, end, 0, step);
}
let opts = { ...options8 };
if (opts.capture === true) opts.wrap = true;
step = step || opts.step || 1;
if (!isNumber(step)) {
if (step != null && !isObject3(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) {
"use strict";
var fill = require_fill_range();
var utils = require_utils();
var compile = (ast, options8 = {}) => {
const walk = (node, parent = {}) => {
const invalidBlock = utils.isInvalidBrace(parent);
const invalidNode = node.invalid === true && options8.escapeInvalid === true;
const invalid = invalidBlock === true || invalidNode === true;
const prefix = options8.escapeInvalid === true ? "\\" : "";
let output = "";
if (node.isOpen === true) {
return prefix + node.value;
}
if (node.isClose === true) {
console.log("node.isClose", prefix, node.value);
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) {
const args = utils.reduce(node.nodes);
const range = fill(...args, { ...options8, wrap: false, toRegex: true, strictZeros: true });
if (range.length !== 0) {
return args.length > 1 && range.length > 1 ? `(${range})` : range;
}
}
if (node.nodes) {
for (const 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) {
"use strict";
var fill = require_fill_range();
var stringify2 = require_stringify();
var utils = require_utils();
var append = (queue = "", stash = "", enclose = false) => {
const 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 (const item of queue) {
if (Array.isArray(item)) {
for (const 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, options8 = {}) => {
const rangeLimit = options8.rangeLimit === void 0 ? 1e3 : options8.rangeLimit;
const 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(), stringify2(node, options8)));
return;
}
if (node.type === "brace" && node.invalid !== true && node.nodes.length === 2) {
q.push(append(q.pop(), ["{}"]));
return;
}
if (node.nodes && node.ranges > 0) {
const args = utils.reduce(node.nodes);
if (utils.exceedsLimit(...args, options8.step, rangeLimit)) {
throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");
}
let range = fill(...args, options8);
if (range.length === 0) {
range = stringify2(node, options8);
}
q.push(append(q.pop(), range));
node.nodes = [];
return;
}
const 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++) {
const 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) {
"use strict";
module.exports = {
MAX_LENGTH: 1e4,
// 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) {
"use strict";
var stringify2 = 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 parse7 = (input, options8 = {}) => {
if (typeof input !== "string") {
throw new TypeError("Expected a string");
}
const opts = options8 || {};
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
if (input.length > max) {
throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`);
}
const ast = { type: "root", input, nodes: [] };
const stack2 = [ast];
let block = ast;
let prev = ast;
let brackets = 0;
const length = input.length;
let index = 0;
let depth = 0;
let value;
const advance = () => input[index++];
const push2 = (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;
};
push2({ type: "bos" });
while (index < length) {
block = stack2[stack2.length - 1];
value = advance();
if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) {
continue;
}
if (value === CHAR_BACKSLASH) {
push2({ type: "text", value: (options8.keepEscaping ? value : "") + advance() });
continue;
}
if (value === CHAR_RIGHT_SQUARE_BRACKET) {
push2({ type: "text", value: "\\" + value });
continue;
}
if (value === CHAR_LEFT_SQUARE_BRACKET) {
brackets++;
let next;
while (index < length && (next = advance())) {
value += next;
if (next === CHAR_LEFT_SQUARE_BRACKET) {
brackets++;
continue;
}
if (next === CHAR_BACKSLASH) {
value += advance();
continue;
}
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
brackets--;
if (brackets === 0) {
break;
}
}
}
push2({ type: "text", value });
continue;
}
if (value === CHAR_LEFT_PARENTHESES) {
block = push2({ type: "paren", nodes: [] });
stack2.push(block);
push2({ type: "text", value });
continue;
}
if (value === CHAR_RIGHT_PARENTHESES) {
if (block.type !== "paren") {
push2({ type: "text", value });
continue;
}
block = stack2.pop();
push2({ type: "text", value });
block = stack2[stack2.length - 1];
continue;
}
if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
const open = value;
let next;
if (options8.keepQuotes !== true) {
value = "";
}
while (index < length && (next = advance())) {
if (next === CHAR_BACKSLASH) {
value += next + advance();
continue;
}
if (next === open) {
if (options8.keepQuotes === true) value += next;
break;
}
value += next;
}
push2({ type: "text", value });
continue;
}
if (value === CHAR_LEFT_CURLY_BRACE) {
depth++;
const dollar = prev.value && prev.value.slice(-1) === "$" || block.dollar === true;
const brace = {
type: "brace",
open: true,
close: false,
dollar,
depth,
commas: 0,
ranges: 0,
nodes: []
};
block = push2(brace);
stack2.push(block);
push2({ type: "open", value });
continue;
}
if (value === CHAR_RIGHT_CURLY_BRACE) {
if (block.type !== "brace") {
push2({ type: "text", value });
continue;
}
const type2 = "close";
block = stack2.pop();
block.close = true;
push2({ type: type2, value });
depth--;
block = stack2[stack2.length - 1];
continue;
}
if (value === CHAR_COMMA && depth > 0) {
if (block.ranges > 0) {
block.ranges = 0;
const open = block.nodes.shift();
block.nodes = [open, { type: "text", value: stringify2(block) }];
}
push2({ type: "comma", value });
block.commas++;
continue;
}
if (value === CHAR_DOT && depth > 0 && block.commas === 0) {
const siblings = block.nodes;
if (depth === 0 || siblings.length === 0) {
push2({ 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();
const before = siblings[siblings.length - 1];
before.value += prev.value + value;
prev = before;
block.ranges--;
continue;
}
push2({ type: "dot", value });
continue;
}
push2({ type: "text", value });
}
do {
block = stack2.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;
}
});
const parent = stack2[stack2.length - 1];
const index2 = parent.nodes.indexOf(block);
parent.nodes.splice(index2, 1, ...block.nodes);
}
} while (stack2.length > 0);
push2({ type: "eos" });
return ast;
};
module.exports = parse7;
}
});
// node_modules/braces/index.js
var require_braces = __commonJS({
"node_modules/braces/index.js"(exports, module) {
"use strict";
var stringify2 = require_stringify();
var compile = require_compile();
var expand = require_expand();
var parse7 = require_parse();
var braces = (input, options8 = {}) => {
let output = [];
if (Array.isArray(input)) {
for (const pattern of input) {
const result = braces.create(pattern, options8);
if (Array.isArray(result)) {
output.push(...result);
} else {
output.push(result);
}
}
} else {
output = [].concat(braces.create(input, options8));
}
if (options8 && options8.expand === true && options8.nodupes === true) {
output = [...new Set(output)];
}
return output;
};
braces.parse = (input, options8 = {}) => parse7(input, options8);
braces.stringify = (input, options8 = {}) => {
if (typeof input === "string") {
return stringify2(braces.parse(input, options8), options8);
}
return stringify2(input, options8);
};
braces.compile = (input, options8 = {}) => {
if (typeof input === "string") {
input = braces.parse(input, options8);
}
return compile(input, options8);
};
braces.expand = (input, options8 = {}) => {
if (typeof input === "string") {
input = braces.parse(input, options8);
}
let result = expand(input, options8);
if (options8.noempty === true) {
result = result.filter(Boolean);
}
if (options8.nodupes === true) {
result = [...new Set(result)];
}
return result;
};
braces.create = (input, options8 = {}) => {
if (input === "" || input.length < 3) {
return [input];
}
return options8.expand !== true ? braces.compile(input, options8) : braces.expand(input, options8);
};
module.exports = braces;
}
});
// node_modules/micromatch/node_modules/picomatch/lib/constants.js
var require_constants2 = __commonJS({
"node_modules/micromatch/node_modules/picomatch/lib/constants.js"(exports, module) {
"use strict";
var path13 = __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_SLASH}]`,
QMARK: WIN_NO_SLASH,
STAR: `${WIN_NO_SLASH}*?`,
DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
NO_DOT: `(?!${DOT_LITERAL})`,
NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
};
var POSIX_REGEX_SOURCE = {
alnum: "a-zA-Z0-9",
alpha: "a-zA-Z",
ascii: "\\x00-\\x7F",
blank: " \\t",
cntrl: "\\x00-\\x1F\\x7F",
digit: "0-9",
graph: