UNPKG

prettier

Version:

Prettier is an opinionated code formatter

1,387 lines (1,369 loc) 770 kB
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 __esm = (fn, res) => function __init() { return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res; }; 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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), 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/diff/lib/diff/base.js var require_base = __commonJS({ "node_modules/diff/lib/diff/base.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = Diff; function Diff() { } Diff.prototype = { /*istanbul ignore start*/ /*istanbul ignore end*/ diff: function diff(oldString, newString) { var _options$timeout; var options8 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; var callback = options8.callback; if (typeof options8 === "function") { callback = options8; options8 = {}; } this.options = options8; var self = this; function done(value) { if (callback) { setTimeout(function() { callback(void 0, value); }, 0); return true; } else { return value; } } oldString = this.castInput(oldString); newString = this.castInput(newString); oldString = this.removeEmpty(this.tokenize(oldString)); newString = this.removeEmpty(this.tokenize(newString)); var newLen = newString.length, oldLen = oldString.length; var editLength = 1; var maxEditLength = newLen + oldLen; if (options8.maxEditLength) { maxEditLength = Math.min(maxEditLength, options8.maxEditLength); } var maxExecutionTime = ( /*istanbul ignore start*/ (_options$timeout = /*istanbul ignore end*/ options8.timeout) !== null && _options$timeout !== void 0 ? _options$timeout : Infinity ); var abortAfterTimestamp = Date.now() + maxExecutionTime; var bestPath = [{ oldPos: -1, lastComponent: void 0 }]; var newPos = this.extractCommon(bestPath[0], newString, oldString, 0); if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) { return done([{ value: this.join(newString), count: newString.length }]); } var minDiagonalToConsider = -Infinity, maxDiagonalToConsider = Infinity; function execEditLength() { for (var diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) { var basePath = ( /*istanbul ignore start*/ void 0 ); var removePath = bestPath[diagonalPath - 1], addPath = bestPath[diagonalPath + 1]; if (removePath) { bestPath[diagonalPath - 1] = void 0; } var canAdd = false; if (addPath) { var addPathNewPos = addPath.oldPos - diagonalPath; canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen; } var canRemove = removePath && removePath.oldPos + 1 < oldLen; if (!canAdd && !canRemove) { bestPath[diagonalPath] = void 0; continue; } if (!canRemove || canAdd && removePath.oldPos + 1 < addPath.oldPos) { basePath = self.addToPath(addPath, true, void 0, 0); } else { basePath = self.addToPath(removePath, void 0, true, 1); } newPos = self.extractCommon(basePath, newString, oldString, diagonalPath); if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) { return done(buildValues(self, basePath.lastComponent, newString, oldString, self.useLongestToken)); } else { bestPath[diagonalPath] = basePath; if (basePath.oldPos + 1 >= oldLen) { maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1); } if (newPos + 1 >= newLen) { minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1); } } } editLength++; } if (callback) { (function exec() { setTimeout(function() { if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) { return callback(); } if (!execEditLength()) { exec(); } }, 0); })(); } else { while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) { var ret = execEditLength(); if (ret) { return ret; } } } }, /*istanbul ignore start*/ /*istanbul ignore end*/ addToPath: function addToPath(path13, added, removed, oldPosInc) { var last = path13.lastComponent; if (last && last.added === added && last.removed === removed) { return { oldPos: path13.oldPos + oldPosInc, lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent } }; } else { return { oldPos: path13.oldPos + oldPosInc, lastComponent: { count: 1, added, removed, previousComponent: last } }; } }, /*istanbul ignore start*/ /*istanbul ignore end*/ extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) { var newLen = newString.length, oldLen = oldString.length, oldPos = basePath.oldPos, newPos = oldPos - diagonalPath, commonCount = 0; while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) { newPos++; oldPos++; commonCount++; } if (commonCount) { basePath.lastComponent = { count: commonCount, previousComponent: basePath.lastComponent }; } basePath.oldPos = oldPos; return newPos; }, /*istanbul ignore start*/ /*istanbul ignore end*/ equals: function equals(left, right) { if (this.options.comparator) { return this.options.comparator(left, right); } else { return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase(); } }, /*istanbul ignore start*/ /*istanbul ignore end*/ removeEmpty: function removeEmpty(array2) { var ret = []; for (var i = 0; i < array2.length; i++) { if (array2[i]) { ret.push(array2[i]); } } return ret; }, /*istanbul ignore start*/ /*istanbul ignore end*/ castInput: function castInput(value) { return value; }, /*istanbul ignore start*/ /*istanbul ignore end*/ tokenize: function tokenize(value) { return value.split(""); }, /*istanbul ignore start*/ /*istanbul ignore end*/ join: function join2(chars) { return chars.join(""); } }; function buildValues(diff, lastComponent, newString, oldString, useLongestToken) { var components = []; var nextComponent; while (lastComponent) { components.push(lastComponent); nextComponent = lastComponent.previousComponent; delete lastComponent.previousComponent; lastComponent = nextComponent; } components.reverse(); var componentPos = 0, componentLen = components.length, newPos = 0, oldPos = 0; for (; componentPos < componentLen; componentPos++) { var component = components[componentPos]; if (!component.removed) { if (!component.added && useLongestToken) { var value = newString.slice(newPos, newPos + component.count); value = value.map(function(value2, i) { var oldValue = oldString[oldPos + i]; return oldValue.length > value2.length ? oldValue : value2; }); component.value = diff.join(value); } else { component.value = diff.join(newString.slice(newPos, newPos + component.count)); } newPos += component.count; if (!component.added) { oldPos += component.count; } } else { component.value = diff.join(oldString.slice(oldPos, oldPos + component.count)); oldPos += component.count; if (componentPos && components[componentPos - 1].added) { var tmp = components[componentPos - 1]; components[componentPos - 1] = components[componentPos]; components[componentPos] = tmp; } } } var finalComponent = components[componentLen - 1]; if (componentLen > 1 && typeof finalComponent.value === "string" && (finalComponent.added || finalComponent.removed) && diff.equals("", finalComponent.value)) { components[componentLen - 2].value += finalComponent.value; components.pop(); } return components; } } }); // node_modules/diff/lib/util/params.js var require_params = __commonJS({ "node_modules/diff/lib/util/params.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.generateOptions = generateOptions; function generateOptions(options8, defaults) { if (typeof options8 === "function") { defaults.callback = options8; } else if (options8) { for (var name in options8) { if (options8.hasOwnProperty(name)) { defaults[name] = options8[name]; } } } return defaults; } } }); // node_modules/diff/lib/diff/line.js var require_line = __commonJS({ "node_modules/diff/lib/diff/line.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.diffLines = diffLines; exports.diffTrimmedLines = diffTrimmedLines; exports.lineDiff = void 0; var _base = _interopRequireDefault(require_base()); var _params = require_params(); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } var lineDiff = new /*istanbul ignore start*/ _base[ /*istanbul ignore start*/ "default" /*istanbul ignore end*/ ](); exports.lineDiff = lineDiff; lineDiff.tokenize = function(value) { if (this.options.stripTrailingCr) { value = value.replace(/\r\n/g, "\n"); } var retLines = [], linesAndNewlines = value.split(/(\n|\r\n)/); if (!linesAndNewlines[linesAndNewlines.length - 1]) { linesAndNewlines.pop(); } for (var i = 0; i < linesAndNewlines.length; i++) { var line3 = linesAndNewlines[i]; if (i % 2 && !this.options.newlineIsToken) { retLines[retLines.length - 1] += line3; } else { if (this.options.ignoreWhitespace) { line3 = line3.trim(); } retLines.push(line3); } } return retLines; }; function diffLines(oldStr, newStr, callback) { return lineDiff.diff(oldStr, newStr, callback); } function diffTrimmedLines(oldStr, newStr, callback) { var options8 = ( /*istanbul ignore start*/ (0, /*istanbul ignore end*/ /*istanbul ignore start*/ _params.generateOptions)(callback, { ignoreWhitespace: true }) ); return lineDiff.diff(oldStr, newStr, options8); } } }); // node_modules/diff/lib/patch/create.js var require_create = __commonJS({ "node_modules/diff/lib/patch/create.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.structuredPatch = structuredPatch; exports.formatPatch = formatPatch; exports.createTwoFilesPatch = createTwoFilesPatch2; exports.createPatch = createPatch; var _line = require_line(); function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options8) { if (!options8) { options8 = {}; } if (typeof options8.context === "undefined") { options8.context = 4; } var diff = ( /*istanbul ignore start*/ (0, /*istanbul ignore end*/ /*istanbul ignore start*/ _line.diffLines)(oldStr, newStr, options8) ); if (!diff) { return; } diff.push({ value: "", lines: [] }); function contextLines(lines) { return lines.map(function(entry) { return " " + entry; }); } var hunks = []; var oldRangeStart = 0, newRangeStart = 0, curRange = [], oldLine = 1, newLine = 1; var _loop = function _loop2(i2) { var current = diff[i2], lines = current.lines || current.value.replace(/\n$/, "").split("\n"); current.lines = lines; if (current.added || current.removed) { var _curRange; if (!oldRangeStart) { var prev = diff[i2 - 1]; oldRangeStart = oldLine; newRangeStart = newLine; if (prev) { curRange = options8.context > 0 ? contextLines(prev.lines.slice(-options8.context)) : []; oldRangeStart -= curRange.length; newRangeStart -= curRange.length; } } (_curRange = /*istanbul ignore end*/ curRange).push.apply( /*istanbul ignore start*/ _curRange, /*istanbul ignore start*/ _toConsumableArray( /*istanbul ignore end*/ lines.map(function(entry) { return (current.added ? "+" : "-") + entry; }) ) ); if (current.added) { newLine += lines.length; } else { oldLine += lines.length; } } else { if (oldRangeStart) { if (lines.length <= options8.context * 2 && i2 < diff.length - 2) { var _curRange2; (_curRange2 = /*istanbul ignore end*/ curRange).push.apply( /*istanbul ignore start*/ _curRange2, /*istanbul ignore start*/ _toConsumableArray( /*istanbul ignore end*/ contextLines(lines) ) ); } else { var _curRange3; var contextSize = Math.min(lines.length, options8.context); (_curRange3 = /*istanbul ignore end*/ curRange).push.apply( /*istanbul ignore start*/ _curRange3, /*istanbul ignore start*/ _toConsumableArray( /*istanbul ignore end*/ contextLines(lines.slice(0, contextSize)) ) ); var hunk = { oldStart: oldRangeStart, oldLines: oldLine - oldRangeStart + contextSize, newStart: newRangeStart, newLines: newLine - newRangeStart + contextSize, lines: curRange }; if (i2 >= diff.length - 2 && lines.length <= options8.context) { var oldEOFNewline = /\n$/.test(oldStr); var newEOFNewline = /\n$/.test(newStr); var noNlBeforeAdds = lines.length == 0 && curRange.length > hunk.oldLines; if (!oldEOFNewline && noNlBeforeAdds && oldStr.length > 0) { curRange.splice(hunk.oldLines, 0, "\\ No newline at end of file"); } if (!oldEOFNewline && !noNlBeforeAdds || !newEOFNewline) { curRange.push("\\ No newline at end of file"); } } hunks.push(hunk); oldRangeStart = 0; newRangeStart = 0; curRange = []; } } oldLine += lines.length; newLine += lines.length; } }; for (var i = 0; i < diff.length; i++) { _loop( /*istanbul ignore end*/ i ); } return { oldFileName, newFileName, oldHeader, newHeader, hunks }; } function formatPatch(diff) { if (Array.isArray(diff)) { return diff.map(formatPatch).join("\n"); } var ret = []; if (diff.oldFileName == diff.newFileName) { ret.push("Index: " + diff.oldFileName); } ret.push("==================================================================="); ret.push("--- " + diff.oldFileName + (typeof diff.oldHeader === "undefined" ? "" : " " + diff.oldHeader)); ret.push("+++ " + diff.newFileName + (typeof diff.newHeader === "undefined" ? "" : " " + diff.newHeader)); for (var i = 0; i < diff.hunks.length; i++) { var hunk = diff.hunks[i]; if (hunk.oldLines === 0) { hunk.oldStart -= 1; } if (hunk.newLines === 0) { hunk.newStart -= 1; } ret.push("@@ -" + hunk.oldStart + "," + hunk.oldLines + " +" + hunk.newStart + "," + hunk.newLines + " @@"); ret.push.apply(ret, hunk.lines); } return ret.join("\n") + "\n"; } function createTwoFilesPatch2(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options8) { return formatPatch(structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options8)); } function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options8) { return createTwoFilesPatch2(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options8); } } }); // 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 stringify = (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 += 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) { "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 diff = Math.abs(tok.maxLen - String(value).length); let relax = options8.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) { "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 stringify = (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 && stringify(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 });