6875 lines
228 KiB
JavaScript
6875 lines
228 KiB
JavaScript
import { createRequire } from "node:module";
|
||
import fs from "node:fs";
|
||
import path, { dirname, resolve } from "node:path";
|
||
import { fileURLToPath } from "node:url";
|
||
import { createViteServerRpc } from "@vue/devtools-core";
|
||
import { getViteRpcServer, setViteServerContext } from "@vue/devtools-kit";
|
||
import sirv from "sirv";
|
||
import { normalizePath } from "vite";
|
||
import Inspect from "vite-plugin-inspect";
|
||
import VueInspector from "vite-plugin-vue-inspector";
|
||
import fsp from "node:fs/promises";
|
||
|
||
//#region rolldown:runtime
|
||
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 __commonJS = (cb, mod) => function() {
|
||
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
||
};
|
||
var __copyProps = (to, from, except, desc) => {
|
||
if (from && typeof from === "object" || typeof from === "function") for (var keys$1 = __getOwnPropNames(from), i = 0, n = keys$1.length, key; i < n; i++) {
|
||
key = keys$1[i];
|
||
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
||
get: ((k) => from[k]).bind(null, key),
|
||
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
||
});
|
||
}
|
||
return to;
|
||
};
|
||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
||
value: mod,
|
||
enumerable: true
|
||
}) : target, mod));
|
||
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/kolorist@1.8.0/node_modules/kolorist/dist/esm/index.mjs
|
||
let enabled = true;
|
||
const globalVar = typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {};
|
||
/**
|
||
* Detect how much colors the current terminal supports
|
||
*/
|
||
let supportLevel = 0;
|
||
if (globalVar.process && globalVar.process.env && globalVar.process.stdout) {
|
||
const { FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM, COLORTERM } = globalVar.process.env;
|
||
if (NODE_DISABLE_COLORS || NO_COLOR || FORCE_COLOR === "0") enabled = false;
|
||
else if (FORCE_COLOR === "1" || FORCE_COLOR === "2" || FORCE_COLOR === "3") enabled = true;
|
||
else if (TERM === "dumb") enabled = false;
|
||
else if ("CI" in globalVar.process.env && [
|
||
"TRAVIS",
|
||
"CIRCLECI",
|
||
"APPVEYOR",
|
||
"GITLAB_CI",
|
||
"GITHUB_ACTIONS",
|
||
"BUILDKITE",
|
||
"DRONE"
|
||
].some((vendor) => vendor in globalVar.process.env)) enabled = true;
|
||
else enabled = process.stdout.isTTY;
|
||
if (enabled) if (process.platform === "win32") supportLevel = 3;
|
||
else if (COLORTERM && (COLORTERM === "truecolor" || COLORTERM === "24bit")) supportLevel = 3;
|
||
else if (TERM && (TERM.endsWith("-256color") || TERM.endsWith("256"))) supportLevel = 2;
|
||
else supportLevel = 1;
|
||
}
|
||
let options = {
|
||
enabled,
|
||
supportLevel
|
||
};
|
||
function kolorist(start, end, level = 1) {
|
||
const open = `\x1b[${start}m`;
|
||
const close = `\x1b[${end}m`;
|
||
const regex = new RegExp(`\\x1b\\[${end}m`, "g");
|
||
return (str) => {
|
||
return options.enabled && options.supportLevel >= level ? open + ("" + str).replace(regex, open) + close : "" + str;
|
||
};
|
||
}
|
||
const reset = kolorist(0, 0);
|
||
const bold = kolorist(1, 22);
|
||
const dim = kolorist(2, 22);
|
||
const italic = kolorist(3, 23);
|
||
const underline = kolorist(4, 24);
|
||
const inverse = kolorist(7, 27);
|
||
const hidden = kolorist(8, 28);
|
||
const strikethrough = kolorist(9, 29);
|
||
const black = kolorist(30, 39);
|
||
const red = kolorist(31, 39);
|
||
const green = kolorist(32, 39);
|
||
const yellow = kolorist(33, 39);
|
||
const blue = kolorist(34, 39);
|
||
const magenta = kolorist(35, 39);
|
||
const cyan = kolorist(36, 39);
|
||
const white = kolorist(97, 39);
|
||
const gray = kolorist(90, 39);
|
||
const lightGray = kolorist(37, 39);
|
||
const lightRed = kolorist(91, 39);
|
||
const lightGreen = kolorist(92, 39);
|
||
const lightYellow = kolorist(93, 39);
|
||
const lightBlue = kolorist(94, 39);
|
||
const lightMagenta = kolorist(95, 39);
|
||
const lightCyan = kolorist(96, 39);
|
||
const bgBlack = kolorist(40, 49);
|
||
const bgRed = kolorist(41, 49);
|
||
const bgGreen = kolorist(42, 49);
|
||
const bgYellow = kolorist(43, 49);
|
||
const bgBlue = kolorist(44, 49);
|
||
const bgMagenta = kolorist(45, 49);
|
||
const bgCyan = kolorist(46, 49);
|
||
const bgWhite = kolorist(107, 49);
|
||
const bgGray = kolorist(100, 49);
|
||
const bgLightRed = kolorist(101, 49);
|
||
const bgLightGreen = kolorist(102, 49);
|
||
const bgLightYellow = kolorist(103, 49);
|
||
const bgLightBlue = kolorist(104, 49);
|
||
const bgLightMagenta = kolorist(105, 49);
|
||
const bgLightCyan = kolorist(106, 49);
|
||
const bgLightGray = kolorist(47, 49);
|
||
|
||
//#endregion
|
||
//#region src/dir.ts
|
||
const DIR_DIST = typeof __dirname !== "undefined" ? __dirname : dirname(fileURLToPath(import.meta.url));
|
||
const DIR_CLIENT = resolve(DIR_DIST, "../client");
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/utils/array.js
|
||
var require_array = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/utils/array.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
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;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/utils/errno.js
|
||
var require_errno = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/utils/errno.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
function isEnoentCodeError(error) {
|
||
return error.code === "ENOENT";
|
||
}
|
||
exports.isEnoentCodeError = isEnoentCodeError;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/utils/fs.js
|
||
var require_fs$3 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/utils/fs.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
var DirentFromStats$1 = 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$1(name, stats) {
|
||
return new DirentFromStats$1(name, stats);
|
||
}
|
||
exports.createDirentFromStats = createDirentFromStats$1;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/utils/path.js
|
||
var require_path = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/utils/path.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const os$1 = __require("os");
|
||
const path$10 = __require("path");
|
||
const IS_WINDOWS_PLATFORM = os$1.platform() === "win32";
|
||
const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2;
|
||
/**
|
||
* All non-escaped special characters.
|
||
* Posix: ()*?[]{|}, !+@ before (, ! at the beginning, \\ before non-special characters.
|
||
* Windows: (){}[], !+@ before (, ! at the beginning.
|
||
*/
|
||
const POSIX_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g;
|
||
const WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()[\]{}]|^!|[!+@](?=\())/g;
|
||
/**
|
||
* The device path (\\.\ or \\?\).
|
||
* https://learn.microsoft.com/en-us/dotnet/standard/io/file-path-formats#dos-device-paths
|
||
*/
|
||
const DOS_DEVICE_PATH_RE = /^\\\\([.?])/;
|
||
/**
|
||
* All backslashes except those escaping special characters.
|
||
* Windows: !()+@{}
|
||
* https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions
|
||
*/
|
||
const WINDOWS_BACKSLASHES_RE = /\\(?![!()+@[\]{}])/g;
|
||
/**
|
||
* Designed to work only with simple paths: `dir\\file`.
|
||
*/
|
||
function unixify(filepath) {
|
||
return filepath.replace(/\\/g, "/");
|
||
}
|
||
exports.unixify = unixify;
|
||
function makeAbsolute(cwd$1, filepath) {
|
||
return path$10.resolve(cwd$1, 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$1) {
|
||
return pattern$1.replace(WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE, "\\$2");
|
||
}
|
||
exports.escapeWindowsPath = escapeWindowsPath;
|
||
function escapePosixPath(pattern$1) {
|
||
return pattern$1.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;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/is-extglob@2.1.1/node_modules/is-extglob/index.js
|
||
var require_is_extglob = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/is-extglob@2.1.1/node_modules/is-extglob/index.js": ((exports, module) => {
|
||
/*!
|
||
* is-extglob <https://github.com/jonschlinkert/is-extglob>
|
||
*
|
||
* Copyright (c) 2014-2016, Jon Schlinkert.
|
||
* Licensed under the MIT License.
|
||
*/
|
||
module.exports = function isExtglob$1(str) {
|
||
if (typeof str !== "string" || str === "") return false;
|
||
var match;
|
||
while (match = /(\\).|([@?!+*]\(.*\))/g.exec(str)) {
|
||
if (match[2]) return true;
|
||
str = str.slice(match.index + match[0].length);
|
||
}
|
||
return false;
|
||
};
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/is-glob@4.0.3/node_modules/is-glob/index.js
|
||
var require_is_glob = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/is-glob@4.0.3/node_modules/is-glob/index.js": ((exports, module) => {
|
||
/*!
|
||
* is-glob <https://github.com/jonschlinkert/is-glob>
|
||
*
|
||
* Copyright (c) 2014-2017, Jon Schlinkert.
|
||
* Released under the MIT License.
|
||
*/
|
||
var isExtglob = require_is_extglob();
|
||
var chars = {
|
||
"{": "}",
|
||
"(": ")",
|
||
"[": "]"
|
||
};
|
||
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 = chars[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 = chars[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$1(str, options$1) {
|
||
if (typeof str !== "string" || str === "") return false;
|
||
if (isExtglob(str)) return true;
|
||
var check = strictCheck;
|
||
if (options$1 && options$1.strict === false) check = relaxedCheck;
|
||
return check(str);
|
||
};
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/glob-parent@5.1.2/node_modules/glob-parent/index.js
|
||
var require_glob_parent = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/glob-parent@5.1.2/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;
|
||
/**
|
||
* @param {string} str
|
||
* @param {Object} opts
|
||
* @param {boolean} [opts.flipBackslashes=true]
|
||
* @returns {string}
|
||
*/
|
||
module.exports = function globParent$1(str, opts) {
|
||
if (Object.assign({ flipBackslashes: true }, opts).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");
|
||
};
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/utils.js
|
||
var require_utils$3 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/braces@3.0.3/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;
|
||
};
|
||
/**
|
||
* Find a node of the given type
|
||
*/
|
||
exports.find = (node, type) => node.nodes.find((node$1) => node$1.type === type);
|
||
/**
|
||
* Find a node of the given 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;
|
||
};
|
||
/**
|
||
* Escape the given node with '\\' before node.value
|
||
*/
|
||
exports.escapeNode = (block, n = 0, type) => {
|
||
const 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;
|
||
}
|
||
}
|
||
};
|
||
/**
|
||
* Returns true if the given brace node should be enclosed in literal braces
|
||
*/
|
||
exports.encloseBrace = (node) => {
|
||
if (node.type !== "brace") return false;
|
||
if (node.commas >> 0 + node.ranges >> 0 === 0) {
|
||
node.invalid = true;
|
||
return true;
|
||
}
|
||
return false;
|
||
};
|
||
/**
|
||
* Returns true if a brace node is invalid.
|
||
*/
|
||
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;
|
||
};
|
||
/**
|
||
* Returns true if a node is an open or close node
|
||
*/
|
||
exports.isOpenOrClose = (node) => {
|
||
if (node.type === "open" || node.type === "close") return true;
|
||
return node.open === true || node.close === true;
|
||
};
|
||
/**
|
||
* Reduce an array of text nodes.
|
||
*/
|
||
exports.reduce = (nodes) => nodes.reduce((acc, node) => {
|
||
if (node.type === "text") acc.push(node.value);
|
||
if (node.type === "range") node.type = "text";
|
||
return acc;
|
||
}, []);
|
||
/**
|
||
* Flatten an array
|
||
*/
|
||
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;
|
||
};
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/stringify.js
|
||
var require_stringify = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/stringify.js": ((exports, module) => {
|
||
const utils$16 = require_utils$3();
|
||
module.exports = (ast, options$1 = {}) => {
|
||
const stringify$4 = (node, parent = {}) => {
|
||
const invalidBlock = options$1.escapeInvalid && utils$16.isInvalidBrace(parent);
|
||
const invalidNode = node.invalid === true && options$1.escapeInvalid === true;
|
||
let output = "";
|
||
if (node.value) {
|
||
if ((invalidBlock || invalidNode) && utils$16.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$4(child);
|
||
return output;
|
||
};
|
||
return stringify$4(ast);
|
||
};
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/is-number@7.0.0/node_modules/is-number/index.js
|
||
var require_is_number = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/is-number@7.0.0/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;
|
||
};
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/to-regex-range@5.0.1/node_modules/to-regex-range/index.js
|
||
var require_to_regex_range = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/to-regex-range@5.0.1/node_modules/to-regex-range/index.js": ((exports, module) => {
|
||
const isNumber$1 = require_is_number();
|
||
const toRegexRange$1 = (min, max, options$1) => {
|
||
if (isNumber$1(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$1(max) === false) throw new TypeError("toRegexRange: expected the second argument to be a number.");
|
||
let opts = {
|
||
relaxZeros: true,
|
||
...options$1
|
||
};
|
||
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$1.cache.hasOwnProperty(cacheKey)) return toRegexRange$1.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) {
|
||
negatives = splitToPatterns(b < 0 ? Math.abs(b) : 1, 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$1.cache[cacheKey] = state;
|
||
return state.result;
|
||
};
|
||
function collatePatterns(neg, pos, options$1) {
|
||
let onlyNegative = filterPatterns(neg, pos, "-", false, options$1) || [];
|
||
let onlyPositive = filterPatterns(pos, neg, "", false, options$1) || [];
|
||
let intersected = filterPatterns(neg, pos, "-?", true, options$1) || [];
|
||
return onlyNegative.concat(intersected).concat(onlyPositive).join("|");
|
||
}
|
||
function splitToRanges(min, max) {
|
||
let nines = 1;
|
||
let zeros$1 = 1;
|
||
let stop = countNines(min, nines);
|
||
let stops = new Set([max]);
|
||
while (min <= stop && stop <= max) {
|
||
stops.add(stop);
|
||
nines += 1;
|
||
stop = countNines(min, nines);
|
||
}
|
||
stop = countZeros(max + 1, zeros$1) - 1;
|
||
while (min < stop && stop <= max) {
|
||
stops.add(stop);
|
||
zeros$1 += 1;
|
||
stop = countZeros(max + 1, zeros$1) - 1;
|
||
}
|
||
stops = [...stops];
|
||
stops.sort(compare);
|
||
return stops;
|
||
}
|
||
/**
|
||
* Convert a range to a regex pattern
|
||
* @param {Number} `start`
|
||
* @param {Number} `stop`
|
||
* @return {String}
|
||
*/
|
||
function rangeToPattern(start, stop, options$1) {
|
||
if (start === stop) return {
|
||
pattern: start,
|
||
count: [],
|
||
digits: 0
|
||
};
|
||
let zipped = zip(start, stop);
|
||
let digits = zipped.length;
|
||
let pattern$1 = "";
|
||
let count = 0;
|
||
for (let i = 0; i < digits; i++) {
|
||
let [startDigit, stopDigit] = zipped[i];
|
||
if (startDigit === stopDigit) pattern$1 += startDigit;
|
||
else if (startDigit !== "0" || stopDigit !== "9") pattern$1 += toCharacterClass(startDigit, stopDigit, options$1);
|
||
else count++;
|
||
}
|
||
if (count) pattern$1 += options$1.shorthand === true ? "\\d" : "[0-9]";
|
||
return {
|
||
pattern: pattern$1,
|
||
count: [count],
|
||
digits
|
||
};
|
||
}
|
||
function splitToPatterns(min, max, tok, options$1) {
|
||
let ranges = splitToRanges(min, max);
|
||
let tokens = [];
|
||
let start = min;
|
||
let prev;
|
||
for (let i = 0; i < ranges.length; i++) {
|
||
let max$1 = ranges[i];
|
||
let obj = rangeToPattern(String(start), String(max$1), options$1);
|
||
let zeros$1 = "";
|
||
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 = max$1 + 1;
|
||
continue;
|
||
}
|
||
if (tok.isPadded) zeros$1 = padZeros(max$1, tok, options$1);
|
||
obj.string = zeros$1 + obj.pattern + toQuantifier(obj.count);
|
||
tokens.push(obj);
|
||
start = max$1 + 1;
|
||
prev = obj;
|
||
}
|
||
return tokens;
|
||
}
|
||
function filterPatterns(arr, comparison, prefix, intersection, options$1) {
|
||
let result = [];
|
||
for (let ele of arr) {
|
||
let { string: string$1 } = ele;
|
||
if (!intersection && !contains(comparison, "string", string$1)) result.push(prefix + string$1);
|
||
if (intersection && contains(comparison, "string", string$1)) result.push(prefix + string$1);
|
||
}
|
||
return result;
|
||
}
|
||
/**
|
||
* Zip strings
|
||
*/
|
||
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$1) {
|
||
return integer - integer % Math.pow(10, zeros$1);
|
||
}
|
||
function toQuantifier(digits) {
|
||
let [start = 0, stop = ""] = digits;
|
||
if (stop || start > 1) return `{${start + (stop ? "," + stop : "")}}`;
|
||
return "";
|
||
}
|
||
function toCharacterClass(a, b, options$1) {
|
||
return `[${a}${b - a === 1 ? "" : "-"}${b}]`;
|
||
}
|
||
function hasPadding(str) {
|
||
return /^-?(0+)\d/.test(str);
|
||
}
|
||
function padZeros(value, tok, options$1) {
|
||
if (!tok.isPadded) return value;
|
||
let diff = Math.abs(tok.maxLen - String(value).length);
|
||
let relax = options$1.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}}`;
|
||
}
|
||
}
|
||
/**
|
||
* Cache
|
||
*/
|
||
toRegexRange$1.cache = {};
|
||
toRegexRange$1.clearCache = () => toRegexRange$1.cache = {};
|
||
/**
|
||
* Expose `toRegexRange`
|
||
*/
|
||
module.exports = toRegexRange$1;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/fill-range@7.1.1/node_modules/fill-range/index.js
|
||
var require_fill_range = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fill-range@7.1.1/node_modules/fill-range/index.js": ((exports, module) => {
|
||
const util$1 = __require("util");
|
||
const toRegexRange = require_to_regex_range();
|
||
const isObject$1 = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
||
const transform = (toNumber) => {
|
||
return (value) => toNumber === true ? Number(value) : String(value);
|
||
};
|
||
const isValidValue = (value) => {
|
||
return typeof value === "number" || typeof value === "string" && value !== "";
|
||
};
|
||
const isNumber = (num) => Number.isInteger(+num);
|
||
const 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;
|
||
};
|
||
const stringify$3 = (start, end, options$1) => {
|
||
if (typeof start === "string" || typeof end === "string") return true;
|
||
return options$1.stringify === true;
|
||
};
|
||
const 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;
|
||
};
|
||
const 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;
|
||
};
|
||
const toSequence = (parts, options$1, 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 = options$1.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 (options$1.wrap) return `(${prefix}${result})`;
|
||
return result;
|
||
};
|
||
const toRange = (a, b, isNumbers, options$1) => {
|
||
if (isNumbers) return toRegexRange(a, b, {
|
||
wrap: false,
|
||
...options$1
|
||
});
|
||
let start = String.fromCharCode(a);
|
||
if (a === b) return start;
|
||
return `[${start}-${String.fromCharCode(b)}]`;
|
||
};
|
||
const toRegex = (start, end, options$1) => {
|
||
if (Array.isArray(start)) {
|
||
let wrap = options$1.wrap === true;
|
||
let prefix = options$1.capture ? "" : "?:";
|
||
return wrap ? `(${prefix}${start.join("|")})` : start.join("|");
|
||
}
|
||
return toRegexRange(start, end, options$1);
|
||
};
|
||
const rangeError = (...args) => {
|
||
return /* @__PURE__ */ new RangeError("Invalid range arguments: " + util$1.inspect(...args));
|
||
};
|
||
const invalidRange = (start, end, options$1) => {
|
||
if (options$1.strictRanges === true) throw rangeError([start, end]);
|
||
return [];
|
||
};
|
||
const invalidStep = (step, options$1) => {
|
||
if (options$1.strictRanges === true) throw new TypeError(`Expected step "${step}" to be a number`);
|
||
return [];
|
||
};
|
||
const fillNumbers = (start, end, step = 1, options$1 = {}) => {
|
||
let a = Number(start);
|
||
let b = Number(end);
|
||
if (!Number.isInteger(a) || !Number.isInteger(b)) {
|
||
if (options$1.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$3(start, end, options$1) === false;
|
||
let format = options$1.transform || transform(toNumber);
|
||
if (options$1.toRegex && step === 1) return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options$1);
|
||
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$1.toRegex === true && step > 1) push(a);
|
||
else range.push(pad(format(a, index), maxLen, toNumber));
|
||
a = descending ? a - step : a + step;
|
||
index++;
|
||
}
|
||
if (options$1.toRegex === true) return step > 1 ? toSequence(parts, options$1, maxLen) : toRegex(range, null, {
|
||
wrap: false,
|
||
...options$1
|
||
});
|
||
return range;
|
||
};
|
||
const fillLetters = (start, end, step = 1, options$1 = {}) => {
|
||
if (!isNumber(start) && start.length > 1 || !isNumber(end) && end.length > 1) return invalidRange(start, end, options$1);
|
||
let format = options$1.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$1.toRegex && step === 1) return toRange(min, max, false, options$1);
|
||
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$1.toRegex === true) return toRegex(range, null, {
|
||
wrap: false,
|
||
options: options$1
|
||
});
|
||
return range;
|
||
};
|
||
const fill$2 = (start, end, step, options$1 = {}) => {
|
||
if (end == null && isValidValue(start)) return [start];
|
||
if (!isValidValue(start) || !isValidValue(end)) return invalidRange(start, end, options$1);
|
||
if (typeof step === "function") return fill$2(start, end, 1, { transform: step });
|
||
if (isObject$1(step)) return fill$2(start, end, 0, step);
|
||
let opts = { ...options$1 };
|
||
if (opts.capture === true) opts.wrap = true;
|
||
step = step || opts.step || 1;
|
||
if (!isNumber(step)) {
|
||
if (step != null && !isObject$1(step)) return invalidStep(step, opts);
|
||
return fill$2(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$2;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/compile.js
|
||
var require_compile = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/compile.js": ((exports, module) => {
|
||
const fill$1 = require_fill_range();
|
||
const utils$15 = require_utils$3();
|
||
const compile$1 = (ast, options$1 = {}) => {
|
||
const walk$1 = (node, parent = {}) => {
|
||
const invalidBlock = utils$15.isInvalidBrace(parent);
|
||
const invalidNode = node.invalid === true && options$1.escapeInvalid === true;
|
||
const invalid = invalidBlock === true || invalidNode === true;
|
||
const prefix = options$1.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$15.reduce(node.nodes);
|
||
const range = fill$1(...args, {
|
||
...options$1,
|
||
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$1(child, node);
|
||
return output;
|
||
};
|
||
return walk$1(ast);
|
||
};
|
||
module.exports = compile$1;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/expand.js
|
||
var require_expand = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/expand.js": ((exports, module) => {
|
||
const fill = require_fill_range();
|
||
const stringify$2 = require_stringify();
|
||
const utils$14 = require_utils$3();
|
||
const append = (queue = "", stash = "", enclose = false) => {
|
||
const result = [];
|
||
queue = [].concat(queue);
|
||
stash = [].concat(stash);
|
||
if (!stash.length) return queue;
|
||
if (!queue.length) return enclose ? utils$14.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$14.flatten(result);
|
||
};
|
||
const expand$1 = (ast, options$1 = {}) => {
|
||
const rangeLimit = options$1.rangeLimit === void 0 ? 1e3 : options$1.rangeLimit;
|
||
const walk$1 = (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$2(node, options$1)));
|
||
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$14.reduce(node.nodes);
|
||
if (utils$14.exceedsLimit(...args, options$1.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$1);
|
||
if (range.length === 0) range = stringify$2(node, options$1);
|
||
q.push(append(q.pop(), range));
|
||
node.nodes = [];
|
||
return;
|
||
}
|
||
const enclose = utils$14.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$1(child, node);
|
||
}
|
||
return queue;
|
||
};
|
||
return utils$14.flatten(walk$1(ast));
|
||
};
|
||
module.exports = expand$1;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/constants.js
|
||
var require_constants$2 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/constants.js": ((exports, module) => {
|
||
module.exports = {
|
||
MAX_LENGTH: 1e4,
|
||
CHAR_0: "0",
|
||
CHAR_9: "9",
|
||
CHAR_UPPERCASE_A: "A",
|
||
CHAR_LOWERCASE_A: "a",
|
||
CHAR_UPPERCASE_Z: "Z",
|
||
CHAR_LOWERCASE_Z: "z",
|
||
CHAR_LEFT_PARENTHESES: "(",
|
||
CHAR_RIGHT_PARENTHESES: ")",
|
||
CHAR_ASTERISK: "*",
|
||
CHAR_AMPERSAND: "&",
|
||
CHAR_AT: "@",
|
||
CHAR_BACKSLASH: "\\",
|
||
CHAR_BACKTICK: "`",
|
||
CHAR_CARRIAGE_RETURN: "\r",
|
||
CHAR_CIRCUMFLEX_ACCENT: "^",
|
||
CHAR_COLON: ":",
|
||
CHAR_COMMA: ",",
|
||
CHAR_DOLLAR: "$",
|
||
CHAR_DOT: ".",
|
||
CHAR_DOUBLE_QUOTE: "\"",
|
||
CHAR_EQUAL: "=",
|
||
CHAR_EXCLAMATION_MARK: "!",
|
||
CHAR_FORM_FEED: "\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",
|
||
CHAR_NO_BREAK_SPACE: "\xA0",
|
||
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: " ",
|
||
CHAR_UNDERSCORE: "_",
|
||
CHAR_VERTICAL_LINE: "|",
|
||
CHAR_ZERO_WIDTH_NOBREAK_SPACE: ""
|
||
};
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/parse.js
|
||
var require_parse$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/lib/parse.js": ((exports, module) => {
|
||
const stringify$1 = require_stringify();
|
||
/**
|
||
* Constants
|
||
*/
|
||
const { MAX_LENGTH: MAX_LENGTH$1, CHAR_BACKSLASH, CHAR_BACKTICK, CHAR_COMMA: CHAR_COMMA$1, CHAR_DOT: CHAR_DOT$1, CHAR_LEFT_PARENTHESES: CHAR_LEFT_PARENTHESES$1, CHAR_RIGHT_PARENTHESES: CHAR_RIGHT_PARENTHESES$1, CHAR_LEFT_CURLY_BRACE: CHAR_LEFT_CURLY_BRACE$1, CHAR_RIGHT_CURLY_BRACE: CHAR_RIGHT_CURLY_BRACE$1, CHAR_LEFT_SQUARE_BRACKET: CHAR_LEFT_SQUARE_BRACKET$1, CHAR_RIGHT_SQUARE_BRACKET: CHAR_RIGHT_SQUARE_BRACKET$1, CHAR_DOUBLE_QUOTE, CHAR_SINGLE_QUOTE, CHAR_NO_BREAK_SPACE, CHAR_ZERO_WIDTH_NOBREAK_SPACE } = require_constants$2();
|
||
/**
|
||
* parse
|
||
*/
|
||
const parse$3 = (input, options$1 = {}) => {
|
||
if (typeof input !== "string") throw new TypeError("Expected a string");
|
||
const opts = options$1 || {};
|
||
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH$1, opts.maxLength) : MAX_LENGTH$1;
|
||
if (input.length > max) throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`);
|
||
const ast = {
|
||
type: "root",
|
||
input,
|
||
nodes: []
|
||
};
|
||
const stack = [ast];
|
||
let block = ast;
|
||
let prev = ast;
|
||
let brackets = 0;
|
||
const length = input.length;
|
||
let index = 0;
|
||
let depth$1 = 0;
|
||
let value;
|
||
/**
|
||
* Helpers
|
||
*/
|
||
const advance = () => input[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();
|
||
/**
|
||
* Invalid chars
|
||
*/
|
||
if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) continue;
|
||
/**
|
||
* Escaped chars
|
||
*/
|
||
if (value === CHAR_BACKSLASH) {
|
||
push({
|
||
type: "text",
|
||
value: (options$1.keepEscaping ? value : "") + advance()
|
||
});
|
||
continue;
|
||
}
|
||
/**
|
||
* Right square bracket (literal): ']'
|
||
*/
|
||
if (value === CHAR_RIGHT_SQUARE_BRACKET$1) {
|
||
push({
|
||
type: "text",
|
||
value: "\\" + value
|
||
});
|
||
continue;
|
||
}
|
||
/**
|
||
* Left square bracket: '['
|
||
*/
|
||
if (value === CHAR_LEFT_SQUARE_BRACKET$1) {
|
||
brackets++;
|
||
let next;
|
||
while (index < length && (next = advance())) {
|
||
value += next;
|
||
if (next === CHAR_LEFT_SQUARE_BRACKET$1) {
|
||
brackets++;
|
||
continue;
|
||
}
|
||
if (next === CHAR_BACKSLASH) {
|
||
value += advance();
|
||
continue;
|
||
}
|
||
if (next === CHAR_RIGHT_SQUARE_BRACKET$1) {
|
||
brackets--;
|
||
if (brackets === 0) break;
|
||
}
|
||
}
|
||
push({
|
||
type: "text",
|
||
value
|
||
});
|
||
continue;
|
||
}
|
||
/**
|
||
* Parentheses
|
||
*/
|
||
if (value === CHAR_LEFT_PARENTHESES$1) {
|
||
block = push({
|
||
type: "paren",
|
||
nodes: []
|
||
});
|
||
stack.push(block);
|
||
push({
|
||
type: "text",
|
||
value
|
||
});
|
||
continue;
|
||
}
|
||
if (value === CHAR_RIGHT_PARENTHESES$1) {
|
||
if (block.type !== "paren") {
|
||
push({
|
||
type: "text",
|
||
value
|
||
});
|
||
continue;
|
||
}
|
||
block = stack.pop();
|
||
push({
|
||
type: "text",
|
||
value
|
||
});
|
||
block = stack[stack.length - 1];
|
||
continue;
|
||
}
|
||
/**
|
||
* Quotes: '|"|`
|
||
*/
|
||
if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
|
||
const open = value;
|
||
let next;
|
||
if (options$1.keepQuotes !== true) value = "";
|
||
while (index < length && (next = advance())) {
|
||
if (next === CHAR_BACKSLASH) {
|
||
value += next + advance();
|
||
continue;
|
||
}
|
||
if (next === open) {
|
||
if (options$1.keepQuotes === true) value += next;
|
||
break;
|
||
}
|
||
value += next;
|
||
}
|
||
push({
|
||
type: "text",
|
||
value
|
||
});
|
||
continue;
|
||
}
|
||
/**
|
||
* Left curly brace: '{'
|
||
*/
|
||
if (value === CHAR_LEFT_CURLY_BRACE$1) {
|
||
depth$1++;
|
||
block = push({
|
||
type: "brace",
|
||
open: true,
|
||
close: false,
|
||
dollar: prev.value && prev.value.slice(-1) === "$" || block.dollar === true,
|
||
depth: depth$1,
|
||
commas: 0,
|
||
ranges: 0,
|
||
nodes: []
|
||
});
|
||
stack.push(block);
|
||
push({
|
||
type: "open",
|
||
value
|
||
});
|
||
continue;
|
||
}
|
||
/**
|
||
* Right curly brace: '}'
|
||
*/
|
||
if (value === CHAR_RIGHT_CURLY_BRACE$1) {
|
||
if (block.type !== "brace") {
|
||
push({
|
||
type: "text",
|
||
value
|
||
});
|
||
continue;
|
||
}
|
||
const type = "close";
|
||
block = stack.pop();
|
||
block.close = true;
|
||
push({
|
||
type,
|
||
value
|
||
});
|
||
depth$1--;
|
||
block = stack[stack.length - 1];
|
||
continue;
|
||
}
|
||
/**
|
||
* Comma: ','
|
||
*/
|
||
if (value === CHAR_COMMA$1 && depth$1 > 0) {
|
||
if (block.ranges > 0) {
|
||
block.ranges = 0;
|
||
block.nodes = [block.nodes.shift(), {
|
||
type: "text",
|
||
value: stringify$1(block)
|
||
}];
|
||
}
|
||
push({
|
||
type: "comma",
|
||
value
|
||
});
|
||
block.commas++;
|
||
continue;
|
||
}
|
||
/**
|
||
* Dot: '.'
|
||
*/
|
||
if (value === CHAR_DOT$1 && depth$1 > 0 && block.commas === 0) {
|
||
const siblings = block.nodes;
|
||
if (depth$1 === 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();
|
||
const before = siblings[siblings.length - 1];
|
||
before.value += prev.value + value;
|
||
prev = before;
|
||
block.ranges--;
|
||
continue;
|
||
}
|
||
push({
|
||
type: "dot",
|
||
value
|
||
});
|
||
continue;
|
||
}
|
||
/**
|
||
* Text
|
||
*/
|
||
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;
|
||
}
|
||
});
|
||
const parent = stack[stack.length - 1];
|
||
const index$1 = parent.nodes.indexOf(block);
|
||
parent.nodes.splice(index$1, 1, ...block.nodes);
|
||
}
|
||
} while (stack.length > 0);
|
||
push({ type: "eos" });
|
||
return ast;
|
||
};
|
||
module.exports = parse$3;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/index.js
|
||
var require_braces = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/braces@3.0.3/node_modules/braces/index.js": ((exports, module) => {
|
||
const stringify = require_stringify();
|
||
const compile = require_compile();
|
||
const expand = require_expand();
|
||
const parse$2 = require_parse$1();
|
||
/**
|
||
* Expand the given pattern or create a regex-compatible string.
|
||
*
|
||
* ```js
|
||
* const braces = require('braces');
|
||
* console.log(braces('{a,b,c}', { compile: true })); //=> ['(a|b|c)']
|
||
* console.log(braces('{a,b,c}')); //=> ['a', 'b', 'c']
|
||
* ```
|
||
* @param {String} `str`
|
||
* @param {Object} `options`
|
||
* @return {String}
|
||
* @api public
|
||
*/
|
||
const braces$1 = (input, options$1 = {}) => {
|
||
let output = [];
|
||
if (Array.isArray(input)) for (const pattern$1 of input) {
|
||
const result = braces$1.create(pattern$1, options$1);
|
||
if (Array.isArray(result)) output.push(...result);
|
||
else output.push(result);
|
||
}
|
||
else output = [].concat(braces$1.create(input, options$1));
|
||
if (options$1 && options$1.expand === true && options$1.nodupes === true) output = [...new Set(output)];
|
||
return output;
|
||
};
|
||
/**
|
||
* Parse the given `str` with the given `options`.
|
||
*
|
||
* ```js
|
||
* // braces.parse(pattern, [, options]);
|
||
* const ast = braces.parse('a/{b,c}/d');
|
||
* console.log(ast);
|
||
* ```
|
||
* @param {String} pattern Brace pattern to parse
|
||
* @param {Object} options
|
||
* @return {Object} Returns an AST
|
||
* @api public
|
||
*/
|
||
braces$1.parse = (input, options$1 = {}) => parse$2(input, options$1);
|
||
/**
|
||
* Creates a braces string from an AST, or an AST node.
|
||
*
|
||
* ```js
|
||
* const braces = require('braces');
|
||
* let ast = braces.parse('foo/{a,b}/bar');
|
||
* console.log(stringify(ast.nodes[2])); //=> '{a,b}'
|
||
* ```
|
||
* @param {String} `input` Brace pattern or AST.
|
||
* @param {Object} `options`
|
||
* @return {Array} Returns an array of expanded values.
|
||
* @api public
|
||
*/
|
||
braces$1.stringify = (input, options$1 = {}) => {
|
||
if (typeof input === "string") return stringify(braces$1.parse(input, options$1), options$1);
|
||
return stringify(input, options$1);
|
||
};
|
||
/**
|
||
* Compiles a brace pattern into a regex-compatible, optimized string.
|
||
* This method is called by the main [braces](#braces) function by default.
|
||
*
|
||
* ```js
|
||
* const braces = require('braces');
|
||
* console.log(braces.compile('a/{b,c}/d'));
|
||
* //=> ['a/(b|c)/d']
|
||
* ```
|
||
* @param {String} `input` Brace pattern or AST.
|
||
* @param {Object} `options`
|
||
* @return {Array} Returns an array of expanded values.
|
||
* @api public
|
||
*/
|
||
braces$1.compile = (input, options$1 = {}) => {
|
||
if (typeof input === "string") input = braces$1.parse(input, options$1);
|
||
return compile(input, options$1);
|
||
};
|
||
/**
|
||
* Expands a brace pattern into an array. This method is called by the
|
||
* main [braces](#braces) function when `options.expand` is true. Before
|
||
* using this method it's recommended that you read the [performance notes](#performance))
|
||
* and advantages of using [.compile](#compile) instead.
|
||
*
|
||
* ```js
|
||
* const braces = require('braces');
|
||
* console.log(braces.expand('a/{b,c}/d'));
|
||
* //=> ['a/b/d', 'a/c/d'];
|
||
* ```
|
||
* @param {String} `pattern` Brace pattern
|
||
* @param {Object} `options`
|
||
* @return {Array} Returns an array of expanded values.
|
||
* @api public
|
||
*/
|
||
braces$1.expand = (input, options$1 = {}) => {
|
||
if (typeof input === "string") input = braces$1.parse(input, options$1);
|
||
let result = expand(input, options$1);
|
||
if (options$1.noempty === true) result = result.filter(Boolean);
|
||
if (options$1.nodupes === true) result = [...new Set(result)];
|
||
return result;
|
||
};
|
||
/**
|
||
* Processes a brace pattern and returns either an expanded array
|
||
* (if `options.expand` is true), a highly optimized regex-compatible string.
|
||
* This method is called by the main [braces](#braces) function.
|
||
*
|
||
* ```js
|
||
* const braces = require('braces');
|
||
* console.log(braces.create('user-{200..300}/project-{a,b,c}-{1..10}'))
|
||
* //=> 'user-(20[0-9]|2[1-9][0-9]|300)/project-(a|b|c)-([1-9]|10)'
|
||
* ```
|
||
* @param {String} `pattern` Brace pattern
|
||
* @param {Object} `options`
|
||
* @return {Array} Returns an array of expanded values.
|
||
* @api public
|
||
*/
|
||
braces$1.create = (input, options$1 = {}) => {
|
||
if (input === "" || input.length < 3) return [input];
|
||
return options$1.expand !== true ? braces$1.compile(input, options$1) : braces$1.expand(input, options$1);
|
||
};
|
||
/**
|
||
* Expose "braces"
|
||
*/
|
||
module.exports = braces$1;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/constants.js
|
||
var require_constants$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/constants.js": ((exports, module) => {
|
||
const path$9 = __require("path");
|
||
const WIN_SLASH = "\\\\/";
|
||
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
||
/**
|
||
* Posix glob regex
|
||
*/
|
||
const DOT_LITERAL = "\\.";
|
||
const PLUS_LITERAL = "\\+";
|
||
const QMARK_LITERAL = "\\?";
|
||
const SLASH_LITERAL = "\\/";
|
||
const ONE_CHAR = "(?=.)";
|
||
const QMARK = "[^/]";
|
||
const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
|
||
const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
|
||
const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
|
||
const POSIX_CHARS = {
|
||
DOT_LITERAL,
|
||
PLUS_LITERAL,
|
||
QMARK_LITERAL,
|
||
SLASH_LITERAL,
|
||
ONE_CHAR,
|
||
QMARK,
|
||
END_ANCHOR,
|
||
DOTS_SLASH,
|
||
NO_DOT: `(?!${DOT_LITERAL})`,
|
||
NO_DOTS: `(?!${START_ANCHOR}${DOTS_SLASH})`,
|
||
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`,
|
||
NO_DOTS_SLASH: `(?!${DOTS_SLASH})`,
|
||
QMARK_NO_DOT: `[^.${SLASH_LITERAL}]`,
|
||
STAR: `${QMARK}*?`,
|
||
START_ANCHOR
|
||
};
|
||
/**
|
||
* Windows glob regex
|
||
*/
|
||
const 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}]|$)`
|
||
};
|
||
/**
|
||
* POSIX Bracket Regex
|
||
*/
|
||
const POSIX_REGEX_SOURCE$1 = {
|
||
alnum: "a-zA-Z0-9",
|
||
alpha: "a-zA-Z",
|
||
ascii: "\\x00-\\x7F",
|
||
blank: " \\t",
|
||
cntrl: "\\x00-\\x1F\\x7F",
|
||
digit: "0-9",
|
||
graph: "\\x21-\\x7E",
|
||
lower: "a-z",
|
||
print: "\\x20-\\x7E ",
|
||
punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
|
||
space: " \\t\\r\\n\\v\\f",
|
||
upper: "A-Z",
|
||
word: "A-Za-z0-9_",
|
||
xdigit: "A-Fa-f0-9"
|
||
};
|
||
module.exports = {
|
||
MAX_LENGTH: 1024 * 64,
|
||
POSIX_REGEX_SOURCE: POSIX_REGEX_SOURCE$1,
|
||
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
||
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
||
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
||
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
||
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
||
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
||
REPLACEMENTS: {
|
||
"***": "*",
|
||
"**/**": "**",
|
||
"**/**/**": "**"
|
||
},
|
||
CHAR_0: 48,
|
||
CHAR_9: 57,
|
||
CHAR_UPPERCASE_A: 65,
|
||
CHAR_LOWERCASE_A: 97,
|
||
CHAR_UPPERCASE_Z: 90,
|
||
CHAR_LOWERCASE_Z: 122,
|
||
CHAR_LEFT_PARENTHESES: 40,
|
||
CHAR_RIGHT_PARENTHESES: 41,
|
||
CHAR_ASTERISK: 42,
|
||
CHAR_AMPERSAND: 38,
|
||
CHAR_AT: 64,
|
||
CHAR_BACKWARD_SLASH: 92,
|
||
CHAR_CARRIAGE_RETURN: 13,
|
||
CHAR_CIRCUMFLEX_ACCENT: 94,
|
||
CHAR_COLON: 58,
|
||
CHAR_COMMA: 44,
|
||
CHAR_DOT: 46,
|
||
CHAR_DOUBLE_QUOTE: 34,
|
||
CHAR_EQUAL: 61,
|
||
CHAR_EXCLAMATION_MARK: 33,
|
||
CHAR_FORM_FEED: 12,
|
||
CHAR_FORWARD_SLASH: 47,
|
||
CHAR_GRAVE_ACCENT: 96,
|
||
CHAR_HASH: 35,
|
||
CHAR_HYPHEN_MINUS: 45,
|
||
CHAR_LEFT_ANGLE_BRACKET: 60,
|
||
CHAR_LEFT_CURLY_BRACE: 123,
|
||
CHAR_LEFT_SQUARE_BRACKET: 91,
|
||
CHAR_LINE_FEED: 10,
|
||
CHAR_NO_BREAK_SPACE: 160,
|
||
CHAR_PERCENT: 37,
|
||
CHAR_PLUS: 43,
|
||
CHAR_QUESTION_MARK: 63,
|
||
CHAR_RIGHT_ANGLE_BRACKET: 62,
|
||
CHAR_RIGHT_CURLY_BRACE: 125,
|
||
CHAR_RIGHT_SQUARE_BRACKET: 93,
|
||
CHAR_SEMICOLON: 59,
|
||
CHAR_SINGLE_QUOTE: 39,
|
||
CHAR_SPACE: 32,
|
||
CHAR_TAB: 9,
|
||
CHAR_UNDERSCORE: 95,
|
||
CHAR_VERTICAL_LINE: 124,
|
||
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
|
||
SEP: path$9.sep,
|
||
extglobChars(chars$1) {
|
||
return {
|
||
"!": {
|
||
type: "negate",
|
||
open: "(?:(?!(?:",
|
||
close: `))${chars$1.STAR})`
|
||
},
|
||
"?": {
|
||
type: "qmark",
|
||
open: "(?:",
|
||
close: ")?"
|
||
},
|
||
"+": {
|
||
type: "plus",
|
||
open: "(?:",
|
||
close: ")+"
|
||
},
|
||
"*": {
|
||
type: "star",
|
||
open: "(?:",
|
||
close: ")*"
|
||
},
|
||
"@": {
|
||
type: "at",
|
||
open: "(?:",
|
||
close: ")"
|
||
}
|
||
};
|
||
},
|
||
globChars(win32$1) {
|
||
return win32$1 === true ? WINDOWS_CHARS : POSIX_CHARS;
|
||
}
|
||
};
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/utils.js
|
||
var require_utils$2 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/utils.js": ((exports) => {
|
||
const path$8 = __require("path");
|
||
const win32 = process.platform === "win32";
|
||
const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants$1();
|
||
exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
||
exports.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
|
||
exports.isRegexChar = (str) => str.length === 1 && exports.hasRegexChars(str);
|
||
exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
|
||
exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
|
||
exports.removeBackslashes = (str) => {
|
||
return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
|
||
return match === "\\" ? "" : match;
|
||
});
|
||
};
|
||
exports.supportsLookbehinds = () => {
|
||
const segs = process.version.slice(1).split(".").map(Number);
|
||
if (segs.length === 3 && segs[0] >= 9 || segs[0] === 8 && segs[1] >= 10) return true;
|
||
return false;
|
||
};
|
||
exports.isWindows = (options$1) => {
|
||
if (options$1 && typeof options$1.windows === "boolean") return options$1.windows;
|
||
return win32 === true || path$8.sep === "\\";
|
||
};
|
||
exports.escapeLast = (input, char, lastIdx) => {
|
||
const idx = input.lastIndexOf(char, lastIdx);
|
||
if (idx === -1) return input;
|
||
if (input[idx - 1] === "\\") return exports.escapeLast(input, char, idx - 1);
|
||
return `${input.slice(0, idx)}\\${input.slice(idx)}`;
|
||
};
|
||
exports.removePrefix = (input, state = {}) => {
|
||
let output = input;
|
||
if (output.startsWith("./")) {
|
||
output = output.slice(2);
|
||
state.prefix = "./";
|
||
}
|
||
return output;
|
||
};
|
||
exports.wrapOutput = (input, state = {}, options$1 = {}) => {
|
||
let output = `${options$1.contains ? "" : "^"}(?:${input})${options$1.contains ? "" : "$"}`;
|
||
if (state.negated === true) output = `(?:^(?!${output}).*$)`;
|
||
return output;
|
||
};
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/scan.js
|
||
var require_scan = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/scan.js": ((exports, module) => {
|
||
const utils$13 = require_utils$2();
|
||
const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = require_constants$1();
|
||
const isPathSeparator = (code) => {
|
||
return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
||
};
|
||
const depth = (token) => {
|
||
if (token.isPrefix !== true) token.depth = token.isGlobstar ? Infinity : 1;
|
||
};
|
||
/**
|
||
* Quickly scans a glob pattern and returns an object with a handful of
|
||
* useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
|
||
* `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
|
||
* with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
|
||
*
|
||
* ```js
|
||
* const pm = require('picomatch');
|
||
* console.log(pm.scan('foo/bar/*.js'));
|
||
* { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
|
||
* ```
|
||
* @param {String} `str`
|
||
* @param {Object} `options`
|
||
* @return {Object} Returns an object with tokens and regex source string.
|
||
* @api public
|
||
*/
|
||
const scan$1 = (input, options$1) => {
|
||
const opts = options$1 || {};
|
||
const length = input.length - 1;
|
||
const scanToEnd = opts.parts === true || opts.scanToEnd === true;
|
||
const slashes = [];
|
||
const tokens = [];
|
||
const parts = [];
|
||
let str = input;
|
||
let index = -1;
|
||
let start = 0;
|
||
let lastIndex = 0;
|
||
let isBrace = false;
|
||
let isBracket = false;
|
||
let isGlob$1 = false;
|
||
let isExtglob$1 = false;
|
||
let isGlobstar = false;
|
||
let braceEscaped = false;
|
||
let backslashes = false;
|
||
let negated = false;
|
||
let negatedExtglob = false;
|
||
let finished = false;
|
||
let braces$2 = 0;
|
||
let prev;
|
||
let code;
|
||
let token = {
|
||
value: "",
|
||
depth: 0,
|
||
isGlob: false
|
||
};
|
||
const eos = () => index >= length;
|
||
const peek = () => str.charCodeAt(index + 1);
|
||
const advance = () => {
|
||
prev = code;
|
||
return str.charCodeAt(++index);
|
||
};
|
||
while (index < length) {
|
||
code = advance();
|
||
let next;
|
||
if (code === CHAR_BACKWARD_SLASH) {
|
||
backslashes = token.backslashes = true;
|
||
code = advance();
|
||
if (code === CHAR_LEFT_CURLY_BRACE) braceEscaped = true;
|
||
continue;
|
||
}
|
||
if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
|
||
braces$2++;
|
||
while (eos() !== true && (code = advance())) {
|
||
if (code === CHAR_BACKWARD_SLASH) {
|
||
backslashes = token.backslashes = true;
|
||
advance();
|
||
continue;
|
||
}
|
||
if (code === CHAR_LEFT_CURLY_BRACE) {
|
||
braces$2++;
|
||
continue;
|
||
}
|
||
if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
|
||
isBrace = token.isBrace = true;
|
||
isGlob$1 = token.isGlob = true;
|
||
finished = true;
|
||
if (scanToEnd === true) continue;
|
||
break;
|
||
}
|
||
if (braceEscaped !== true && code === CHAR_COMMA) {
|
||
isBrace = token.isBrace = true;
|
||
isGlob$1 = token.isGlob = true;
|
||
finished = true;
|
||
if (scanToEnd === true) continue;
|
||
break;
|
||
}
|
||
if (code === CHAR_RIGHT_CURLY_BRACE) {
|
||
braces$2--;
|
||
if (braces$2 === 0) {
|
||
braceEscaped = false;
|
||
isBrace = token.isBrace = true;
|
||
finished = true;
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
if (scanToEnd === true) continue;
|
||
break;
|
||
}
|
||
if (code === CHAR_FORWARD_SLASH) {
|
||
slashes.push(index);
|
||
tokens.push(token);
|
||
token = {
|
||
value: "",
|
||
depth: 0,
|
||
isGlob: false
|
||
};
|
||
if (finished === true) continue;
|
||
if (prev === CHAR_DOT && index === start + 1) {
|
||
start += 2;
|
||
continue;
|
||
}
|
||
lastIndex = index + 1;
|
||
continue;
|
||
}
|
||
if (opts.noext !== true) {
|
||
if ((code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK) === true && peek() === CHAR_LEFT_PARENTHESES) {
|
||
isGlob$1 = token.isGlob = true;
|
||
isExtglob$1 = token.isExtglob = true;
|
||
finished = true;
|
||
if (code === CHAR_EXCLAMATION_MARK && index === start) negatedExtglob = true;
|
||
if (scanToEnd === true) {
|
||
while (eos() !== true && (code = advance())) {
|
||
if (code === CHAR_BACKWARD_SLASH) {
|
||
backslashes = token.backslashes = true;
|
||
code = advance();
|
||
continue;
|
||
}
|
||
if (code === CHAR_RIGHT_PARENTHESES) {
|
||
isGlob$1 = token.isGlob = true;
|
||
finished = true;
|
||
break;
|
||
}
|
||
}
|
||
continue;
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
if (code === CHAR_ASTERISK) {
|
||
if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
|
||
isGlob$1 = token.isGlob = true;
|
||
finished = true;
|
||
if (scanToEnd === true) continue;
|
||
break;
|
||
}
|
||
if (code === CHAR_QUESTION_MARK) {
|
||
isGlob$1 = token.isGlob = true;
|
||
finished = true;
|
||
if (scanToEnd === true) continue;
|
||
break;
|
||
}
|
||
if (code === CHAR_LEFT_SQUARE_BRACKET) {
|
||
while (eos() !== true && (next = advance())) {
|
||
if (next === CHAR_BACKWARD_SLASH) {
|
||
backslashes = token.backslashes = true;
|
||
advance();
|
||
continue;
|
||
}
|
||
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
||
isBracket = token.isBracket = true;
|
||
isGlob$1 = token.isGlob = true;
|
||
finished = true;
|
||
break;
|
||
}
|
||
}
|
||
if (scanToEnd === true) continue;
|
||
break;
|
||
}
|
||
if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
|
||
negated = token.negated = true;
|
||
start++;
|
||
continue;
|
||
}
|
||
if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
|
||
isGlob$1 = token.isGlob = true;
|
||
if (scanToEnd === true) {
|
||
while (eos() !== true && (code = advance())) {
|
||
if (code === CHAR_LEFT_PARENTHESES) {
|
||
backslashes = token.backslashes = true;
|
||
code = advance();
|
||
continue;
|
||
}
|
||
if (code === CHAR_RIGHT_PARENTHESES) {
|
||
finished = true;
|
||
break;
|
||
}
|
||
}
|
||
continue;
|
||
}
|
||
break;
|
||
}
|
||
if (isGlob$1 === true) {
|
||
finished = true;
|
||
if (scanToEnd === true) continue;
|
||
break;
|
||
}
|
||
}
|
||
if (opts.noext === true) {
|
||
isExtglob$1 = false;
|
||
isGlob$1 = false;
|
||
}
|
||
let base = str;
|
||
let prefix = "";
|
||
let glob = "";
|
||
if (start > 0) {
|
||
prefix = str.slice(0, start);
|
||
str = str.slice(start);
|
||
lastIndex -= start;
|
||
}
|
||
if (base && isGlob$1 === true && lastIndex > 0) {
|
||
base = str.slice(0, lastIndex);
|
||
glob = str.slice(lastIndex);
|
||
} else if (isGlob$1 === true) {
|
||
base = "";
|
||
glob = str;
|
||
} else base = str;
|
||
if (base && base !== "" && base !== "/" && base !== str) {
|
||
if (isPathSeparator(base.charCodeAt(base.length - 1))) base = base.slice(0, -1);
|
||
}
|
||
if (opts.unescape === true) {
|
||
if (glob) glob = utils$13.removeBackslashes(glob);
|
||
if (base && backslashes === true) base = utils$13.removeBackslashes(base);
|
||
}
|
||
const state = {
|
||
prefix,
|
||
input,
|
||
start,
|
||
base,
|
||
glob,
|
||
isBrace,
|
||
isBracket,
|
||
isGlob: isGlob$1,
|
||
isExtglob: isExtglob$1,
|
||
isGlobstar,
|
||
negated,
|
||
negatedExtglob
|
||
};
|
||
if (opts.tokens === true) {
|
||
state.maxDepth = 0;
|
||
if (!isPathSeparator(code)) tokens.push(token);
|
||
state.tokens = tokens;
|
||
}
|
||
if (opts.parts === true || opts.tokens === true) {
|
||
let prevIndex;
|
||
for (let idx = 0; idx < slashes.length; idx++) {
|
||
const n = prevIndex ? prevIndex + 1 : start;
|
||
const i = slashes[idx];
|
||
const value = input.slice(n, i);
|
||
if (opts.tokens) {
|
||
if (idx === 0 && start !== 0) {
|
||
tokens[idx].isPrefix = true;
|
||
tokens[idx].value = prefix;
|
||
} else tokens[idx].value = value;
|
||
depth(tokens[idx]);
|
||
state.maxDepth += tokens[idx].depth;
|
||
}
|
||
if (idx !== 0 || value !== "") parts.push(value);
|
||
prevIndex = i;
|
||
}
|
||
if (prevIndex && prevIndex + 1 < input.length) {
|
||
const value = input.slice(prevIndex + 1);
|
||
parts.push(value);
|
||
if (opts.tokens) {
|
||
tokens[tokens.length - 1].value = value;
|
||
depth(tokens[tokens.length - 1]);
|
||
state.maxDepth += tokens[tokens.length - 1].depth;
|
||
}
|
||
}
|
||
state.slashes = slashes;
|
||
state.parts = parts;
|
||
}
|
||
return state;
|
||
};
|
||
module.exports = scan$1;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/parse.js
|
||
var require_parse = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/parse.js": ((exports, module) => {
|
||
const constants$1 = require_constants$1();
|
||
const utils$12 = require_utils$2();
|
||
/**
|
||
* Constants
|
||
*/
|
||
const { MAX_LENGTH, POSIX_REGEX_SOURCE, REGEX_NON_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_BACKREF, REPLACEMENTS } = constants$1;
|
||
/**
|
||
* Helpers
|
||
*/
|
||
const expandRange = (args, options$1) => {
|
||
if (typeof options$1.expandRange === "function") return options$1.expandRange(...args, options$1);
|
||
args.sort();
|
||
const value = `[${args.join("-")}]`;
|
||
try {
|
||
new RegExp(value);
|
||
} catch (ex) {
|
||
return args.map((v) => utils$12.escapeRegex(v)).join("..");
|
||
}
|
||
return value;
|
||
};
|
||
/**
|
||
* Create the message for a syntax error
|
||
*/
|
||
const syntaxError = (type, char) => {
|
||
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
||
};
|
||
/**
|
||
* Parse the given input string.
|
||
* @param {String} input
|
||
* @param {Object} options
|
||
* @return {Object}
|
||
*/
|
||
const parse$1 = (input, options$1) => {
|
||
if (typeof input !== "string") throw new TypeError("Expected a string");
|
||
input = REPLACEMENTS[input] || input;
|
||
const opts = { ...options$1 };
|
||
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
||
let len = input.length;
|
||
if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
||
const bos = {
|
||
type: "bos",
|
||
value: "",
|
||
output: opts.prepend || ""
|
||
};
|
||
const tokens = [bos];
|
||
const capture = opts.capture ? "" : "?:";
|
||
const win32$1 = utils$12.isWindows(options$1);
|
||
const PLATFORM_CHARS = constants$1.globChars(win32$1);
|
||
const EXTGLOB_CHARS = constants$1.extglobChars(PLATFORM_CHARS);
|
||
const { DOT_LITERAL: DOT_LITERAL$1, PLUS_LITERAL: PLUS_LITERAL$1, SLASH_LITERAL: SLASH_LITERAL$1, ONE_CHAR: ONE_CHAR$1, DOTS_SLASH: DOTS_SLASH$1, NO_DOT, NO_DOT_SLASH, NO_DOTS_SLASH, QMARK: QMARK$1, QMARK_NO_DOT, STAR, START_ANCHOR: START_ANCHOR$1 } = PLATFORM_CHARS;
|
||
const globstar = (opts$1) => {
|
||
return `(${capture}(?:(?!${START_ANCHOR$1}${opts$1.dot ? DOTS_SLASH$1 : DOT_LITERAL$1}).)*?)`;
|
||
};
|
||
const nodot = opts.dot ? "" : NO_DOT;
|
||
const qmarkNoDot = opts.dot ? QMARK$1 : QMARK_NO_DOT;
|
||
let star = opts.bash === true ? globstar(opts) : STAR;
|
||
if (opts.capture) star = `(${star})`;
|
||
if (typeof opts.noext === "boolean") opts.noextglob = opts.noext;
|
||
const state = {
|
||
input,
|
||
index: -1,
|
||
start: 0,
|
||
dot: opts.dot === true,
|
||
consumed: "",
|
||
output: "",
|
||
prefix: "",
|
||
backtrack: false,
|
||
negated: false,
|
||
brackets: 0,
|
||
braces: 0,
|
||
parens: 0,
|
||
quotes: 0,
|
||
globstar: false,
|
||
tokens
|
||
};
|
||
input = utils$12.removePrefix(input, state);
|
||
len = input.length;
|
||
const extglobs = [];
|
||
const braces$2 = [];
|
||
const stack = [];
|
||
let prev = bos;
|
||
let value;
|
||
/**
|
||
* Tokenizing helpers
|
||
*/
|
||
const eos = () => state.index === len - 1;
|
||
const peek = state.peek = (n = 1) => input[state.index + n];
|
||
const advance = state.advance = () => input[++state.index] || "";
|
||
const remaining = () => input.slice(state.index + 1);
|
||
const consume = (value$1 = "", num = 0) => {
|
||
state.consumed += value$1;
|
||
state.index += num;
|
||
};
|
||
const append$1 = (token) => {
|
||
state.output += token.output != null ? token.output : token.value;
|
||
consume(token.value);
|
||
};
|
||
const negate = () => {
|
||
let count = 1;
|
||
while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
|
||
advance();
|
||
state.start++;
|
||
count++;
|
||
}
|
||
if (count % 2 === 0) return false;
|
||
state.negated = true;
|
||
state.start++;
|
||
return true;
|
||
};
|
||
const increment = (type) => {
|
||
state[type]++;
|
||
stack.push(type);
|
||
};
|
||
const decrement = (type) => {
|
||
state[type]--;
|
||
stack.pop();
|
||
};
|
||
/**
|
||
* Push tokens onto the tokens array. This helper speeds up
|
||
* tokenizing by 1) helping us avoid backtracking as much as possible,
|
||
* and 2) helping us avoid creating extra tokens when consecutive
|
||
* characters are plain text. This improves performance and simplifies
|
||
* lookbehinds.
|
||
*/
|
||
const push = (tok) => {
|
||
if (prev.type === "globstar") {
|
||
const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
|
||
const isExtglob$1 = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
|
||
if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob$1) {
|
||
state.output = state.output.slice(0, -prev.output.length);
|
||
prev.type = "star";
|
||
prev.value = "*";
|
||
prev.output = star;
|
||
state.output += prev.output;
|
||
}
|
||
}
|
||
if (extglobs.length && tok.type !== "paren") extglobs[extglobs.length - 1].inner += tok.value;
|
||
if (tok.value || tok.output) append$1(tok);
|
||
if (prev && prev.type === "text" && tok.type === "text") {
|
||
prev.value += tok.value;
|
||
prev.output = (prev.output || "") + tok.value;
|
||
return;
|
||
}
|
||
tok.prev = prev;
|
||
tokens.push(tok);
|
||
prev = tok;
|
||
};
|
||
const extglobOpen = (type, value$1) => {
|
||
const token = {
|
||
...EXTGLOB_CHARS[value$1],
|
||
conditions: 1,
|
||
inner: ""
|
||
};
|
||
token.prev = prev;
|
||
token.parens = state.parens;
|
||
token.output = state.output;
|
||
const output = (opts.capture ? "(" : "") + token.open;
|
||
increment("parens");
|
||
push({
|
||
type,
|
||
value: value$1,
|
||
output: state.output ? "" : ONE_CHAR$1
|
||
});
|
||
push({
|
||
type: "paren",
|
||
extglob: true,
|
||
value: advance(),
|
||
output
|
||
});
|
||
extglobs.push(token);
|
||
};
|
||
const extglobClose = (token) => {
|
||
let output = token.close + (opts.capture ? ")" : "");
|
||
let rest;
|
||
if (token.type === "negate") {
|
||
let extglobStar = star;
|
||
if (token.inner && token.inner.length > 1 && token.inner.includes("/")) extglobStar = globstar(opts);
|
||
if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) output = token.close = `)$))${extglobStar}`;
|
||
if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) output = token.close = `)${parse$1(rest, {
|
||
...options$1,
|
||
fastpaths: false
|
||
}).output})${extglobStar})`;
|
||
if (token.prev.type === "bos") state.negatedExtglob = true;
|
||
}
|
||
push({
|
||
type: "paren",
|
||
extglob: true,
|
||
value,
|
||
output
|
||
});
|
||
decrement("parens");
|
||
};
|
||
/**
|
||
* Fast paths
|
||
*/
|
||
if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
|
||
let backslashes = false;
|
||
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars$1, first, rest, index) => {
|
||
if (first === "\\") {
|
||
backslashes = true;
|
||
return m;
|
||
}
|
||
if (first === "?") {
|
||
if (esc) return esc + first + (rest ? QMARK$1.repeat(rest.length) : "");
|
||
if (index === 0) return qmarkNoDot + (rest ? QMARK$1.repeat(rest.length) : "");
|
||
return QMARK$1.repeat(chars$1.length);
|
||
}
|
||
if (first === ".") return DOT_LITERAL$1.repeat(chars$1.length);
|
||
if (first === "*") {
|
||
if (esc) return esc + first + (rest ? star : "");
|
||
return star;
|
||
}
|
||
return esc ? m : `\\${m}`;
|
||
});
|
||
if (backslashes === true) if (opts.unescape === true) output = output.replace(/\\/g, "");
|
||
else output = output.replace(/\\+/g, (m) => {
|
||
return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
|
||
});
|
||
if (output === input && opts.contains === true) {
|
||
state.output = input;
|
||
return state;
|
||
}
|
||
state.output = utils$12.wrapOutput(output, state, options$1);
|
||
return state;
|
||
}
|
||
/**
|
||
* Tokenize input until we reach end-of-string
|
||
*/
|
||
while (!eos()) {
|
||
value = advance();
|
||
if (value === "\0") continue;
|
||
/**
|
||
* Escaped characters
|
||
*/
|
||
if (value === "\\") {
|
||
const next = peek();
|
||
if (next === "/" && opts.bash !== true) continue;
|
||
if (next === "." || next === ";") continue;
|
||
if (!next) {
|
||
value += "\\";
|
||
push({
|
||
type: "text",
|
||
value
|
||
});
|
||
continue;
|
||
}
|
||
const match = /^\\+/.exec(remaining());
|
||
let slashes = 0;
|
||
if (match && match[0].length > 2) {
|
||
slashes = match[0].length;
|
||
state.index += slashes;
|
||
if (slashes % 2 !== 0) value += "\\";
|
||
}
|
||
if (opts.unescape === true) value = advance();
|
||
else value += advance();
|
||
if (state.brackets === 0) {
|
||
push({
|
||
type: "text",
|
||
value
|
||
});
|
||
continue;
|
||
}
|
||
}
|
||
/**
|
||
* If we're inside a regex character class, continue
|
||
* until we reach the closing bracket.
|
||
*/
|
||
if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
|
||
if (opts.posix !== false && value === ":") {
|
||
const inner = prev.value.slice(1);
|
||
if (inner.includes("[")) {
|
||
prev.posix = true;
|
||
if (inner.includes(":")) {
|
||
const idx = prev.value.lastIndexOf("[");
|
||
const pre = prev.value.slice(0, idx);
|
||
const posix = POSIX_REGEX_SOURCE[prev.value.slice(idx + 2)];
|
||
if (posix) {
|
||
prev.value = pre + posix;
|
||
state.backtrack = true;
|
||
advance();
|
||
if (!bos.output && tokens.indexOf(prev) === 1) bos.output = ONE_CHAR$1;
|
||
continue;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") value = `\\${value}`;
|
||
if (value === "]" && (prev.value === "[" || prev.value === "[^")) value = `\\${value}`;
|
||
if (opts.posix === true && value === "!" && prev.value === "[") value = "^";
|
||
prev.value += value;
|
||
append$1({ value });
|
||
continue;
|
||
}
|
||
/**
|
||
* If we're inside a quoted string, continue
|
||
* until we reach the closing double quote.
|
||
*/
|
||
if (state.quotes === 1 && value !== "\"") {
|
||
value = utils$12.escapeRegex(value);
|
||
prev.value += value;
|
||
append$1({ value });
|
||
continue;
|
||
}
|
||
/**
|
||
* Double quotes
|
||
*/
|
||
if (value === "\"") {
|
||
state.quotes = state.quotes === 1 ? 0 : 1;
|
||
if (opts.keepQuotes === true) push({
|
||
type: "text",
|
||
value
|
||
});
|
||
continue;
|
||
}
|
||
/**
|
||
* Parentheses
|
||
*/
|
||
if (value === "(") {
|
||
increment("parens");
|
||
push({
|
||
type: "paren",
|
||
value
|
||
});
|
||
continue;
|
||
}
|
||
if (value === ")") {
|
||
if (state.parens === 0 && opts.strictBrackets === true) throw new SyntaxError(syntaxError("opening", "("));
|
||
const extglob = extglobs[extglobs.length - 1];
|
||
if (extglob && state.parens === extglob.parens + 1) {
|
||
extglobClose(extglobs.pop());
|
||
continue;
|
||
}
|
||
push({
|
||
type: "paren",
|
||
value,
|
||
output: state.parens ? ")" : "\\)"
|
||
});
|
||
decrement("parens");
|
||
continue;
|
||
}
|
||
/**
|
||
* Square brackets
|
||
*/
|
||
if (value === "[") {
|
||
if (opts.nobracket === true || !remaining().includes("]")) {
|
||
if (opts.nobracket !== true && opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
|
||
value = `\\${value}`;
|
||
} else increment("brackets");
|
||
push({
|
||
type: "bracket",
|
||
value
|
||
});
|
||
continue;
|
||
}
|
||
if (value === "]") {
|
||
if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
|
||
push({
|
||
type: "text",
|
||
value,
|
||
output: `\\${value}`
|
||
});
|
||
continue;
|
||
}
|
||
if (state.brackets === 0) {
|
||
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("opening", "["));
|
||
push({
|
||
type: "text",
|
||
value,
|
||
output: `\\${value}`
|
||
});
|
||
continue;
|
||
}
|
||
decrement("brackets");
|
||
const prevValue = prev.value.slice(1);
|
||
if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) value = `/${value}`;
|
||
prev.value += value;
|
||
append$1({ value });
|
||
if (opts.literalBrackets === false || utils$12.hasRegexChars(prevValue)) continue;
|
||
const escaped$1 = utils$12.escapeRegex(prev.value);
|
||
state.output = state.output.slice(0, -prev.value.length);
|
||
if (opts.literalBrackets === true) {
|
||
state.output += escaped$1;
|
||
prev.value = escaped$1;
|
||
continue;
|
||
}
|
||
prev.value = `(${capture}${escaped$1}|${prev.value})`;
|
||
state.output += prev.value;
|
||
continue;
|
||
}
|
||
/**
|
||
* Braces
|
||
*/
|
||
if (value === "{" && opts.nobrace !== true) {
|
||
increment("braces");
|
||
const open = {
|
||
type: "brace",
|
||
value,
|
||
output: "(",
|
||
outputIndex: state.output.length,
|
||
tokensIndex: state.tokens.length
|
||
};
|
||
braces$2.push(open);
|
||
push(open);
|
||
continue;
|
||
}
|
||
if (value === "}") {
|
||
const brace = braces$2[braces$2.length - 1];
|
||
if (opts.nobrace === true || !brace) {
|
||
push({
|
||
type: "text",
|
||
value,
|
||
output: value
|
||
});
|
||
continue;
|
||
}
|
||
let output = ")";
|
||
if (brace.dots === true) {
|
||
const arr = tokens.slice();
|
||
const range = [];
|
||
for (let i = arr.length - 1; i >= 0; i--) {
|
||
tokens.pop();
|
||
if (arr[i].type === "brace") break;
|
||
if (arr[i].type !== "dots") range.unshift(arr[i].value);
|
||
}
|
||
output = expandRange(range, opts);
|
||
state.backtrack = true;
|
||
}
|
||
if (brace.comma !== true && brace.dots !== true) {
|
||
const out = state.output.slice(0, brace.outputIndex);
|
||
const toks = state.tokens.slice(brace.tokensIndex);
|
||
brace.value = brace.output = "\\{";
|
||
value = output = "\\}";
|
||
state.output = out;
|
||
for (const t of toks) state.output += t.output || t.value;
|
||
}
|
||
push({
|
||
type: "brace",
|
||
value,
|
||
output
|
||
});
|
||
decrement("braces");
|
||
braces$2.pop();
|
||
continue;
|
||
}
|
||
/**
|
||
* Pipes
|
||
*/
|
||
if (value === "|") {
|
||
if (extglobs.length > 0) extglobs[extglobs.length - 1].conditions++;
|
||
push({
|
||
type: "text",
|
||
value
|
||
});
|
||
continue;
|
||
}
|
||
/**
|
||
* Commas
|
||
*/
|
||
if (value === ",") {
|
||
let output = value;
|
||
const brace = braces$2[braces$2.length - 1];
|
||
if (brace && stack[stack.length - 1] === "braces") {
|
||
brace.comma = true;
|
||
output = "|";
|
||
}
|
||
push({
|
||
type: "comma",
|
||
value,
|
||
output
|
||
});
|
||
continue;
|
||
}
|
||
/**
|
||
* Slashes
|
||
*/
|
||
if (value === "/") {
|
||
if (prev.type === "dot" && state.index === state.start + 1) {
|
||
state.start = state.index + 1;
|
||
state.consumed = "";
|
||
state.output = "";
|
||
tokens.pop();
|
||
prev = bos;
|
||
continue;
|
||
}
|
||
push({
|
||
type: "slash",
|
||
value,
|
||
output: SLASH_LITERAL$1
|
||
});
|
||
continue;
|
||
}
|
||
/**
|
||
* Dots
|
||
*/
|
||
if (value === ".") {
|
||
if (state.braces > 0 && prev.type === "dot") {
|
||
if (prev.value === ".") prev.output = DOT_LITERAL$1;
|
||
const brace = braces$2[braces$2.length - 1];
|
||
prev.type = "dots";
|
||
prev.output += value;
|
||
prev.value += value;
|
||
brace.dots = true;
|
||
continue;
|
||
}
|
||
if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
|
||
push({
|
||
type: "text",
|
||
value,
|
||
output: DOT_LITERAL$1
|
||
});
|
||
continue;
|
||
}
|
||
push({
|
||
type: "dot",
|
||
value,
|
||
output: DOT_LITERAL$1
|
||
});
|
||
continue;
|
||
}
|
||
/**
|
||
* Question marks
|
||
*/
|
||
if (value === "?") {
|
||
if (!(prev && prev.value === "(") && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
||
extglobOpen("qmark", value);
|
||
continue;
|
||
}
|
||
if (prev && prev.type === "paren") {
|
||
const next = peek();
|
||
let output = value;
|
||
if (next === "<" && !utils$12.supportsLookbehinds()) throw new Error("Node.js v10 or higher is required for regex lookbehinds");
|
||
if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) output = `\\${value}`;
|
||
push({
|
||
type: "text",
|
||
value,
|
||
output
|
||
});
|
||
continue;
|
||
}
|
||
if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
|
||
push({
|
||
type: "qmark",
|
||
value,
|
||
output: QMARK_NO_DOT
|
||
});
|
||
continue;
|
||
}
|
||
push({
|
||
type: "qmark",
|
||
value,
|
||
output: QMARK$1
|
||
});
|
||
continue;
|
||
}
|
||
/**
|
||
* Exclamation
|
||
*/
|
||
if (value === "!") {
|
||
if (opts.noextglob !== true && peek() === "(") {
|
||
if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
|
||
extglobOpen("negate", value);
|
||
continue;
|
||
}
|
||
}
|
||
if (opts.nonegate !== true && state.index === 0) {
|
||
negate();
|
||
continue;
|
||
}
|
||
}
|
||
/**
|
||
* Plus
|
||
*/
|
||
if (value === "+") {
|
||
if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
||
extglobOpen("plus", value);
|
||
continue;
|
||
}
|
||
if (prev && prev.value === "(" || opts.regex === false) {
|
||
push({
|
||
type: "plus",
|
||
value,
|
||
output: PLUS_LITERAL$1
|
||
});
|
||
continue;
|
||
}
|
||
if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
|
||
push({
|
||
type: "plus",
|
||
value
|
||
});
|
||
continue;
|
||
}
|
||
push({
|
||
type: "plus",
|
||
value: PLUS_LITERAL$1
|
||
});
|
||
continue;
|
||
}
|
||
/**
|
||
* Plain text
|
||
*/
|
||
if (value === "@") {
|
||
if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
||
push({
|
||
type: "at",
|
||
extglob: true,
|
||
value,
|
||
output: ""
|
||
});
|
||
continue;
|
||
}
|
||
push({
|
||
type: "text",
|
||
value
|
||
});
|
||
continue;
|
||
}
|
||
/**
|
||
* Plain text
|
||
*/
|
||
if (value !== "*") {
|
||
if (value === "$" || value === "^") value = `\\${value}`;
|
||
const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
|
||
if (match) {
|
||
value += match[0];
|
||
state.index += match[0].length;
|
||
}
|
||
push({
|
||
type: "text",
|
||
value
|
||
});
|
||
continue;
|
||
}
|
||
/**
|
||
* Stars
|
||
*/
|
||
if (prev && (prev.type === "globstar" || prev.star === true)) {
|
||
prev.type = "star";
|
||
prev.star = true;
|
||
prev.value += value;
|
||
prev.output = star;
|
||
state.backtrack = true;
|
||
state.globstar = true;
|
||
consume(value);
|
||
continue;
|
||
}
|
||
let rest = remaining();
|
||
if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
|
||
extglobOpen("star", value);
|
||
continue;
|
||
}
|
||
if (prev.type === "star") {
|
||
if (opts.noglobstar === true) {
|
||
consume(value);
|
||
continue;
|
||
}
|
||
const prior = prev.prev;
|
||
const before = prior.prev;
|
||
const isStart = prior.type === "slash" || prior.type === "bos";
|
||
const afterStar = before && (before.type === "star" || before.type === "globstar");
|
||
if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
|
||
push({
|
||
type: "star",
|
||
value,
|
||
output: ""
|
||
});
|
||
continue;
|
||
}
|
||
const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
|
||
const isExtglob$1 = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
|
||
if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob$1) {
|
||
push({
|
||
type: "star",
|
||
value,
|
||
output: ""
|
||
});
|
||
continue;
|
||
}
|
||
while (rest.slice(0, 3) === "/**") {
|
||
const after = input[state.index + 4];
|
||
if (after && after !== "/") break;
|
||
rest = rest.slice(3);
|
||
consume("/**", 3);
|
||
}
|
||
if (prior.type === "bos" && eos()) {
|
||
prev.type = "globstar";
|
||
prev.value += value;
|
||
prev.output = globstar(opts);
|
||
state.output = prev.output;
|
||
state.globstar = true;
|
||
consume(value);
|
||
continue;
|
||
}
|
||
if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
|
||
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
||
prior.output = `(?:${prior.output}`;
|
||
prev.type = "globstar";
|
||
prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
|
||
prev.value += value;
|
||
state.globstar = true;
|
||
state.output += prior.output + prev.output;
|
||
consume(value);
|
||
continue;
|
||
}
|
||
if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
|
||
const end = rest[1] !== void 0 ? "|$" : "";
|
||
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
||
prior.output = `(?:${prior.output}`;
|
||
prev.type = "globstar";
|
||
prev.output = `${globstar(opts)}${SLASH_LITERAL$1}|${SLASH_LITERAL$1}${end})`;
|
||
prev.value += value;
|
||
state.output += prior.output + prev.output;
|
||
state.globstar = true;
|
||
consume(value + advance());
|
||
push({
|
||
type: "slash",
|
||
value: "/",
|
||
output: ""
|
||
});
|
||
continue;
|
||
}
|
||
if (prior.type === "bos" && rest[0] === "/") {
|
||
prev.type = "globstar";
|
||
prev.value += value;
|
||
prev.output = `(?:^|${SLASH_LITERAL$1}|${globstar(opts)}${SLASH_LITERAL$1})`;
|
||
state.output = prev.output;
|
||
state.globstar = true;
|
||
consume(value + advance());
|
||
push({
|
||
type: "slash",
|
||
value: "/",
|
||
output: ""
|
||
});
|
||
continue;
|
||
}
|
||
state.output = state.output.slice(0, -prev.output.length);
|
||
prev.type = "globstar";
|
||
prev.output = globstar(opts);
|
||
prev.value += value;
|
||
state.output += prev.output;
|
||
state.globstar = true;
|
||
consume(value);
|
||
continue;
|
||
}
|
||
const token = {
|
||
type: "star",
|
||
value,
|
||
output: star
|
||
};
|
||
if (opts.bash === true) {
|
||
token.output = ".*?";
|
||
if (prev.type === "bos" || prev.type === "slash") token.output = nodot + token.output;
|
||
push(token);
|
||
continue;
|
||
}
|
||
if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
|
||
token.output = value;
|
||
push(token);
|
||
continue;
|
||
}
|
||
if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
|
||
if (prev.type === "dot") {
|
||
state.output += NO_DOT_SLASH;
|
||
prev.output += NO_DOT_SLASH;
|
||
} else if (opts.dot === true) {
|
||
state.output += NO_DOTS_SLASH;
|
||
prev.output += NO_DOTS_SLASH;
|
||
} else {
|
||
state.output += nodot;
|
||
prev.output += nodot;
|
||
}
|
||
if (peek() !== "*") {
|
||
state.output += ONE_CHAR$1;
|
||
prev.output += ONE_CHAR$1;
|
||
}
|
||
}
|
||
push(token);
|
||
}
|
||
while (state.brackets > 0) {
|
||
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
|
||
state.output = utils$12.escapeLast(state.output, "[");
|
||
decrement("brackets");
|
||
}
|
||
while (state.parens > 0) {
|
||
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", ")"));
|
||
state.output = utils$12.escapeLast(state.output, "(");
|
||
decrement("parens");
|
||
}
|
||
while (state.braces > 0) {
|
||
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "}"));
|
||
state.output = utils$12.escapeLast(state.output, "{");
|
||
decrement("braces");
|
||
}
|
||
if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) push({
|
||
type: "maybe_slash",
|
||
value: "",
|
||
output: `${SLASH_LITERAL$1}?`
|
||
});
|
||
if (state.backtrack === true) {
|
||
state.output = "";
|
||
for (const token of state.tokens) {
|
||
state.output += token.output != null ? token.output : token.value;
|
||
if (token.suffix) state.output += token.suffix;
|
||
}
|
||
}
|
||
return state;
|
||
};
|
||
/**
|
||
* Fast paths for creating regular expressions for common glob patterns.
|
||
* This can significantly speed up processing and has very little downside
|
||
* impact when none of the fast paths match.
|
||
*/
|
||
parse$1.fastpaths = (input, options$1) => {
|
||
const opts = { ...options$1 };
|
||
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
||
const len = input.length;
|
||
if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
||
input = REPLACEMENTS[input] || input;
|
||
const win32$1 = utils$12.isWindows(options$1);
|
||
const { DOT_LITERAL: DOT_LITERAL$1, SLASH_LITERAL: SLASH_LITERAL$1, ONE_CHAR: ONE_CHAR$1, DOTS_SLASH: DOTS_SLASH$1, NO_DOT, NO_DOTS, NO_DOTS_SLASH, STAR, START_ANCHOR: START_ANCHOR$1 } = constants$1.globChars(win32$1);
|
||
const nodot = opts.dot ? NO_DOTS : NO_DOT;
|
||
const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
|
||
const capture = opts.capture ? "" : "?:";
|
||
const state = {
|
||
negated: false,
|
||
prefix: ""
|
||
};
|
||
let star = opts.bash === true ? ".*?" : STAR;
|
||
if (opts.capture) star = `(${star})`;
|
||
const globstar = (opts$1) => {
|
||
if (opts$1.noglobstar === true) return star;
|
||
return `(${capture}(?:(?!${START_ANCHOR$1}${opts$1.dot ? DOTS_SLASH$1 : DOT_LITERAL$1}).)*?)`;
|
||
};
|
||
const create = (str) => {
|
||
switch (str) {
|
||
case "*": return `${nodot}${ONE_CHAR$1}${star}`;
|
||
case ".*": return `${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
|
||
case "*.*": return `${nodot}${star}${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
|
||
case "*/*": return `${nodot}${star}${SLASH_LITERAL$1}${ONE_CHAR$1}${slashDot}${star}`;
|
||
case "**": return nodot + globstar(opts);
|
||
case "**/*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL$1})?${slashDot}${ONE_CHAR$1}${star}`;
|
||
case "**/*.*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL$1})?${slashDot}${star}${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
|
||
case "**/.*": return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL$1})?${DOT_LITERAL$1}${ONE_CHAR$1}${star}`;
|
||
default: {
|
||
const match = /^(.*?)\.(\w+)$/.exec(str);
|
||
if (!match) return;
|
||
const source$1 = create(match[1]);
|
||
if (!source$1) return;
|
||
return source$1 + DOT_LITERAL$1 + match[2];
|
||
}
|
||
}
|
||
};
|
||
let source = create(utils$12.removePrefix(input, state));
|
||
if (source && opts.strictSlashes !== true) source += `${SLASH_LITERAL$1}?`;
|
||
return source;
|
||
};
|
||
module.exports = parse$1;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/picomatch.js
|
||
var require_picomatch$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/picomatch.js": ((exports, module) => {
|
||
const path$7 = __require("path");
|
||
const scan = require_scan();
|
||
const parse = require_parse();
|
||
const utils$11 = require_utils$2();
|
||
const constants = require_constants$1();
|
||
const isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
|
||
/**
|
||
* Creates a matcher function from one or more glob patterns. The
|
||
* returned function takes a string to match as its first argument,
|
||
* and returns true if the string is a match. The returned matcher
|
||
* function also takes a boolean as the second argument that, when true,
|
||
* returns an object with additional information.
|
||
*
|
||
* ```js
|
||
* const picomatch = require('picomatch');
|
||
* // picomatch(glob[, options]);
|
||
*
|
||
* const isMatch = picomatch('*.!(*a)');
|
||
* console.log(isMatch('a.a')); //=> false
|
||
* console.log(isMatch('a.b')); //=> true
|
||
* ```
|
||
* @name picomatch
|
||
* @param {String|Array} `globs` One or more glob patterns.
|
||
* @param {Object=} `options`
|
||
* @return {Function=} Returns a matcher function.
|
||
* @api public
|
||
*/
|
||
const picomatch$1 = (glob, options$1, returnState = false) => {
|
||
if (Array.isArray(glob)) {
|
||
const fns = glob.map((input) => picomatch$1(input, options$1, returnState));
|
||
const arrayMatcher = (str) => {
|
||
for (const isMatch of fns) {
|
||
const state$1 = isMatch(str);
|
||
if (state$1) return state$1;
|
||
}
|
||
return false;
|
||
};
|
||
return arrayMatcher;
|
||
}
|
||
const isState = isObject(glob) && glob.tokens && glob.input;
|
||
if (glob === "" || typeof glob !== "string" && !isState) throw new TypeError("Expected pattern to be a non-empty string");
|
||
const opts = options$1 || {};
|
||
const posix = utils$11.isWindows(options$1);
|
||
const regex = isState ? picomatch$1.compileRe(glob, options$1) : picomatch$1.makeRe(glob, options$1, false, true);
|
||
const state = regex.state;
|
||
delete regex.state;
|
||
let isIgnored = () => false;
|
||
if (opts.ignore) {
|
||
const ignoreOpts = {
|
||
...options$1,
|
||
ignore: null,
|
||
onMatch: null,
|
||
onResult: null
|
||
};
|
||
isIgnored = picomatch$1(opts.ignore, ignoreOpts, returnState);
|
||
}
|
||
const matcher = (input, returnObject = false) => {
|
||
const { isMatch, match, output } = picomatch$1.test(input, regex, options$1, {
|
||
glob,
|
||
posix
|
||
});
|
||
const result = {
|
||
glob,
|
||
state,
|
||
regex,
|
||
posix,
|
||
input,
|
||
output,
|
||
match,
|
||
isMatch
|
||
};
|
||
if (typeof opts.onResult === "function") opts.onResult(result);
|
||
if (isMatch === false) {
|
||
result.isMatch = false;
|
||
return returnObject ? result : false;
|
||
}
|
||
if (isIgnored(input)) {
|
||
if (typeof opts.onIgnore === "function") opts.onIgnore(result);
|
||
result.isMatch = false;
|
||
return returnObject ? result : false;
|
||
}
|
||
if (typeof opts.onMatch === "function") opts.onMatch(result);
|
||
return returnObject ? result : true;
|
||
};
|
||
if (returnState) matcher.state = state;
|
||
return matcher;
|
||
};
|
||
/**
|
||
* Test `input` with the given `regex`. This is used by the main
|
||
* `picomatch()` function to test the input string.
|
||
*
|
||
* ```js
|
||
* const picomatch = require('picomatch');
|
||
* // picomatch.test(input, regex[, options]);
|
||
*
|
||
* console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
|
||
* // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
|
||
* ```
|
||
* @param {String} `input` String to test.
|
||
* @param {RegExp} `regex`
|
||
* @return {Object} Returns an object with matching info.
|
||
* @api public
|
||
*/
|
||
picomatch$1.test = (input, regex, options$1, { glob, posix } = {}) => {
|
||
if (typeof input !== "string") throw new TypeError("Expected input to be a string");
|
||
if (input === "") return {
|
||
isMatch: false,
|
||
output: ""
|
||
};
|
||
const opts = options$1 || {};
|
||
const format = opts.format || (posix ? utils$11.toPosixSlashes : null);
|
||
let match = input === glob;
|
||
let output = match && format ? format(input) : input;
|
||
if (match === false) {
|
||
output = format ? format(input) : input;
|
||
match = output === glob;
|
||
}
|
||
if (match === false || opts.capture === true) if (opts.matchBase === true || opts.basename === true) match = picomatch$1.matchBase(input, regex, options$1, posix);
|
||
else match = regex.exec(output);
|
||
return {
|
||
isMatch: Boolean(match),
|
||
match,
|
||
output
|
||
};
|
||
};
|
||
/**
|
||
* Match the basename of a filepath.
|
||
*
|
||
* ```js
|
||
* const picomatch = require('picomatch');
|
||
* // picomatch.matchBase(input, glob[, options]);
|
||
* console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
|
||
* ```
|
||
* @param {String} `input` String to test.
|
||
* @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
|
||
* @return {Boolean}
|
||
* @api public
|
||
*/
|
||
picomatch$1.matchBase = (input, glob, options$1, posix = utils$11.isWindows(options$1)) => {
|
||
return (glob instanceof RegExp ? glob : picomatch$1.makeRe(glob, options$1)).test(path$7.basename(input));
|
||
};
|
||
/**
|
||
* Returns true if **any** of the given glob `patterns` match the specified `string`.
|
||
*
|
||
* ```js
|
||
* const picomatch = require('picomatch');
|
||
* // picomatch.isMatch(string, patterns[, options]);
|
||
*
|
||
* console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
|
||
* console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
|
||
* ```
|
||
* @param {String|Array} str The string to test.
|
||
* @param {String|Array} patterns One or more glob patterns to use for matching.
|
||
* @param {Object} [options] See available [options](#options).
|
||
* @return {Boolean} Returns true if any patterns match `str`
|
||
* @api public
|
||
*/
|
||
picomatch$1.isMatch = (str, patterns, options$1) => picomatch$1(patterns, options$1)(str);
|
||
/**
|
||
* Parse a glob pattern to create the source string for a regular
|
||
* expression.
|
||
*
|
||
* ```js
|
||
* const picomatch = require('picomatch');
|
||
* const result = picomatch.parse(pattern[, options]);
|
||
* ```
|
||
* @param {String} `pattern`
|
||
* @param {Object} `options`
|
||
* @return {Object} Returns an object with useful properties and output to be used as a regex source string.
|
||
* @api public
|
||
*/
|
||
picomatch$1.parse = (pattern$1, options$1) => {
|
||
if (Array.isArray(pattern$1)) return pattern$1.map((p) => picomatch$1.parse(p, options$1));
|
||
return parse(pattern$1, {
|
||
...options$1,
|
||
fastpaths: false
|
||
});
|
||
};
|
||
/**
|
||
* Scan a glob pattern to separate the pattern into segments.
|
||
*
|
||
* ```js
|
||
* const picomatch = require('picomatch');
|
||
* // picomatch.scan(input[, options]);
|
||
*
|
||
* const result = picomatch.scan('!./foo/*.js');
|
||
* console.log(result);
|
||
* { prefix: '!./',
|
||
* input: '!./foo/*.js',
|
||
* start: 3,
|
||
* base: 'foo',
|
||
* glob: '*.js',
|
||
* isBrace: false,
|
||
* isBracket: false,
|
||
* isGlob: true,
|
||
* isExtglob: false,
|
||
* isGlobstar: false,
|
||
* negated: true }
|
||
* ```
|
||
* @param {String} `input` Glob pattern to scan.
|
||
* @param {Object} `options`
|
||
* @return {Object} Returns an object with
|
||
* @api public
|
||
*/
|
||
picomatch$1.scan = (input, options$1) => scan(input, options$1);
|
||
/**
|
||
* Compile a regular expression from the `state` object returned by the
|
||
* [parse()](#parse) method.
|
||
*
|
||
* @param {Object} `state`
|
||
* @param {Object} `options`
|
||
* @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
|
||
* @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
|
||
* @return {RegExp}
|
||
* @api public
|
||
*/
|
||
picomatch$1.compileRe = (state, options$1, returnOutput = false, returnState = false) => {
|
||
if (returnOutput === true) return state.output;
|
||
const opts = options$1 || {};
|
||
const prepend = opts.contains ? "" : "^";
|
||
const append$1 = opts.contains ? "" : "$";
|
||
let source = `${prepend}(?:${state.output})${append$1}`;
|
||
if (state && state.negated === true) source = `^(?!${source}).*$`;
|
||
const regex = picomatch$1.toRegex(source, options$1);
|
||
if (returnState === true) regex.state = state;
|
||
return regex;
|
||
};
|
||
/**
|
||
* Create a regular expression from a parsed glob pattern.
|
||
*
|
||
* ```js
|
||
* const picomatch = require('picomatch');
|
||
* const state = picomatch.parse('*.js');
|
||
* // picomatch.compileRe(state[, options]);
|
||
*
|
||
* console.log(picomatch.compileRe(state));
|
||
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
||
* ```
|
||
* @param {String} `state` The object returned from the `.parse` method.
|
||
* @param {Object} `options`
|
||
* @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result.
|
||
* @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
|
||
* @return {RegExp} Returns a regex created from the given pattern.
|
||
* @api public
|
||
*/
|
||
picomatch$1.makeRe = (input, options$1 = {}, returnOutput = false, returnState = false) => {
|
||
if (!input || typeof input !== "string") throw new TypeError("Expected a non-empty string");
|
||
let parsed = {
|
||
negated: false,
|
||
fastpaths: true
|
||
};
|
||
if (options$1.fastpaths !== false && (input[0] === "." || input[0] === "*")) parsed.output = parse.fastpaths(input, options$1);
|
||
if (!parsed.output) parsed = parse(input, options$1);
|
||
return picomatch$1.compileRe(parsed, options$1, returnOutput, returnState);
|
||
};
|
||
/**
|
||
* Create a regular expression from the given regex source string.
|
||
*
|
||
* ```js
|
||
* const picomatch = require('picomatch');
|
||
* // picomatch.toRegex(source[, options]);
|
||
*
|
||
* const { output } = picomatch.parse('*.js');
|
||
* console.log(picomatch.toRegex(output));
|
||
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
||
* ```
|
||
* @param {String} `source` Regular expression source string.
|
||
* @param {Object} `options`
|
||
* @return {RegExp}
|
||
* @api public
|
||
*/
|
||
picomatch$1.toRegex = (source, options$1) => {
|
||
try {
|
||
const opts = options$1 || {};
|
||
return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
|
||
} catch (err) {
|
||
if (options$1 && options$1.debug === true) throw err;
|
||
return /$^/;
|
||
}
|
||
};
|
||
/**
|
||
* Picomatch constants.
|
||
* @return {Object}
|
||
*/
|
||
picomatch$1.constants = constants;
|
||
/**
|
||
* Expose "picomatch"
|
||
*/
|
||
module.exports = picomatch$1;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/index.js
|
||
var require_picomatch = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/index.js": ((exports, module) => {
|
||
module.exports = require_picomatch$1();
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/micromatch@4.0.8/node_modules/micromatch/index.js
|
||
var require_micromatch = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/micromatch@4.0.8/node_modules/micromatch/index.js": ((exports, module) => {
|
||
const util = __require("util");
|
||
const braces = require_braces();
|
||
const picomatch = require_picomatch();
|
||
const utils$10 = require_utils$2();
|
||
const isEmptyString = (v) => v === "" || v === "./";
|
||
const hasBraces = (v) => {
|
||
const index = v.indexOf("{");
|
||
return index > -1 && v.indexOf("}", index) > -1;
|
||
};
|
||
/**
|
||
* Returns an array of strings that match one or more glob patterns.
|
||
*
|
||
* ```js
|
||
* const mm = require('micromatch');
|
||
* // mm(list, patterns[, options]);
|
||
*
|
||
* console.log(mm(['a.js', 'a.txt'], ['*.js']));
|
||
* //=> [ 'a.js' ]
|
||
* ```
|
||
* @param {String|Array<string>} `list` List of strings to match.
|
||
* @param {String|Array<string>} `patterns` One or more glob patterns to use for matching.
|
||
* @param {Object} `options` See available [options](#options)
|
||
* @return {Array} Returns an array of matches
|
||
* @summary false
|
||
* @api public
|
||
*/
|
||
const micromatch$1 = (list, patterns, options$1) => {
|
||
patterns = [].concat(patterns);
|
||
list = [].concat(list);
|
||
let omit = /* @__PURE__ */ new Set();
|
||
let keep = /* @__PURE__ */ new Set();
|
||
let items = /* @__PURE__ */ new Set();
|
||
let negatives = 0;
|
||
let onResult = (state) => {
|
||
items.add(state.output);
|
||
if (options$1 && options$1.onResult) options$1.onResult(state);
|
||
};
|
||
for (let i = 0; i < patterns.length; i++) {
|
||
let isMatch = picomatch(String(patterns[i]), {
|
||
...options$1,
|
||
onResult
|
||
}, true);
|
||
let negated = isMatch.state.negated || isMatch.state.negatedExtglob;
|
||
if (negated) negatives++;
|
||
for (let item of list) {
|
||
let matched = isMatch(item, true);
|
||
if (!(negated ? !matched.isMatch : matched.isMatch)) continue;
|
||
if (negated) omit.add(matched.output);
|
||
else {
|
||
omit.delete(matched.output);
|
||
keep.add(matched.output);
|
||
}
|
||
}
|
||
}
|
||
let matches = (negatives === patterns.length ? [...items] : [...keep]).filter((item) => !omit.has(item));
|
||
if (options$1 && matches.length === 0) {
|
||
if (options$1.failglob === true) throw new Error(`No matches found for "${patterns.join(", ")}"`);
|
||
if (options$1.nonull === true || options$1.nullglob === true) return options$1.unescape ? patterns.map((p) => p.replace(/\\/g, "")) : patterns;
|
||
}
|
||
return matches;
|
||
};
|
||
/**
|
||
* Backwards compatibility
|
||
*/
|
||
micromatch$1.match = micromatch$1;
|
||
/**
|
||
* Returns a matcher function from the given glob `pattern` and `options`.
|
||
* The returned function takes a string to match as its only argument and returns
|
||
* true if the string is a match.
|
||
*
|
||
* ```js
|
||
* const mm = require('micromatch');
|
||
* // mm.matcher(pattern[, options]);
|
||
*
|
||
* const isMatch = mm.matcher('*.!(*a)');
|
||
* console.log(isMatch('a.a')); //=> false
|
||
* console.log(isMatch('a.b')); //=> true
|
||
* ```
|
||
* @param {String} `pattern` Glob pattern
|
||
* @param {Object} `options`
|
||
* @return {Function} Returns a matcher function.
|
||
* @api public
|
||
*/
|
||
micromatch$1.matcher = (pattern$1, options$1) => picomatch(pattern$1, options$1);
|
||
/**
|
||
* Returns true if **any** of the given glob `patterns` match the specified `string`.
|
||
*
|
||
* ```js
|
||
* const mm = require('micromatch');
|
||
* // mm.isMatch(string, patterns[, options]);
|
||
*
|
||
* console.log(mm.isMatch('a.a', ['b.*', '*.a'])); //=> true
|
||
* console.log(mm.isMatch('a.a', 'b.*')); //=> false
|
||
* ```
|
||
* @param {String} `str` The string to test.
|
||
* @param {String|Array} `patterns` One or more glob patterns to use for matching.
|
||
* @param {Object} `[options]` See available [options](#options).
|
||
* @return {Boolean} Returns true if any patterns match `str`
|
||
* @api public
|
||
*/
|
||
micromatch$1.isMatch = (str, patterns, options$1) => picomatch(patterns, options$1)(str);
|
||
/**
|
||
* Backwards compatibility
|
||
*/
|
||
micromatch$1.any = micromatch$1.isMatch;
|
||
/**
|
||
* Returns a list of strings that _**do not match any**_ of the given `patterns`.
|
||
*
|
||
* ```js
|
||
* const mm = require('micromatch');
|
||
* // mm.not(list, patterns[, options]);
|
||
*
|
||
* console.log(mm.not(['a.a', 'b.b', 'c.c'], '*.a'));
|
||
* //=> ['b.b', 'c.c']
|
||
* ```
|
||
* @param {Array} `list` Array of strings to match.
|
||
* @param {String|Array} `patterns` One or more glob pattern to use for matching.
|
||
* @param {Object} `options` See available [options](#options) for changing how matches are performed
|
||
* @return {Array} Returns an array of strings that **do not match** the given patterns.
|
||
* @api public
|
||
*/
|
||
micromatch$1.not = (list, patterns, options$1 = {}) => {
|
||
patterns = [].concat(patterns).map(String);
|
||
let result = /* @__PURE__ */ new Set();
|
||
let items = [];
|
||
let onResult = (state) => {
|
||
if (options$1.onResult) options$1.onResult(state);
|
||
items.push(state.output);
|
||
};
|
||
let matches = new Set(micromatch$1(list, patterns, {
|
||
...options$1,
|
||
onResult
|
||
}));
|
||
for (let item of items) if (!matches.has(item)) result.add(item);
|
||
return [...result];
|
||
};
|
||
/**
|
||
* Returns true if the given `string` contains the given pattern. Similar
|
||
* to [.isMatch](#isMatch) but the pattern can match any part of the string.
|
||
*
|
||
* ```js
|
||
* var mm = require('micromatch');
|
||
* // mm.contains(string, pattern[, options]);
|
||
*
|
||
* console.log(mm.contains('aa/bb/cc', '*b'));
|
||
* //=> true
|
||
* console.log(mm.contains('aa/bb/cc', '*d'));
|
||
* //=> false
|
||
* ```
|
||
* @param {String} `str` The string to match.
|
||
* @param {String|Array} `patterns` Glob pattern to use for matching.
|
||
* @param {Object} `options` See available [options](#options) for changing how matches are performed
|
||
* @return {Boolean} Returns true if any of the patterns matches any part of `str`.
|
||
* @api public
|
||
*/
|
||
micromatch$1.contains = (str, pattern$1, options$1) => {
|
||
if (typeof str !== "string") throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
|
||
if (Array.isArray(pattern$1)) return pattern$1.some((p) => micromatch$1.contains(str, p, options$1));
|
||
if (typeof pattern$1 === "string") {
|
||
if (isEmptyString(str) || isEmptyString(pattern$1)) return false;
|
||
if (str.includes(pattern$1) || str.startsWith("./") && str.slice(2).includes(pattern$1)) return true;
|
||
}
|
||
return micromatch$1.isMatch(str, pattern$1, {
|
||
...options$1,
|
||
contains: true
|
||
});
|
||
};
|
||
/**
|
||
* Filter the keys of the given object with the given `glob` pattern
|
||
* and `options`. Does not attempt to match nested keys. If you need this feature,
|
||
* use [glob-object][] instead.
|
||
*
|
||
* ```js
|
||
* const mm = require('micromatch');
|
||
* // mm.matchKeys(object, patterns[, options]);
|
||
*
|
||
* const obj = { aa: 'a', ab: 'b', ac: 'c' };
|
||
* console.log(mm.matchKeys(obj, '*b'));
|
||
* //=> { ab: 'b' }
|
||
* ```
|
||
* @param {Object} `object` The object with keys to filter.
|
||
* @param {String|Array} `patterns` One or more glob patterns to use for matching.
|
||
* @param {Object} `options` See available [options](#options) for changing how matches are performed
|
||
* @return {Object} Returns an object with only keys that match the given patterns.
|
||
* @api public
|
||
*/
|
||
micromatch$1.matchKeys = (obj, patterns, options$1) => {
|
||
if (!utils$10.isObject(obj)) throw new TypeError("Expected the first argument to be an object");
|
||
let keys$1 = micromatch$1(Object.keys(obj), patterns, options$1);
|
||
let res = {};
|
||
for (let key of keys$1) res[key] = obj[key];
|
||
return res;
|
||
};
|
||
/**
|
||
* Returns true if some of the strings in the given `list` match any of the given glob `patterns`.
|
||
*
|
||
* ```js
|
||
* const mm = require('micromatch');
|
||
* // mm.some(list, patterns[, options]);
|
||
*
|
||
* console.log(mm.some(['foo.js', 'bar.js'], ['*.js', '!foo.js']));
|
||
* // true
|
||
* console.log(mm.some(['foo.js'], ['*.js', '!foo.js']));
|
||
* // false
|
||
* ```
|
||
* @param {String|Array} `list` The string or array of strings to test. Returns as soon as the first match is found.
|
||
* @param {String|Array} `patterns` One or more glob patterns to use for matching.
|
||
* @param {Object} `options` See available [options](#options) for changing how matches are performed
|
||
* @return {Boolean} Returns true if any `patterns` matches any of the strings in `list`
|
||
* @api public
|
||
*/
|
||
micromatch$1.some = (list, patterns, options$1) => {
|
||
let items = [].concat(list);
|
||
for (let pattern$1 of [].concat(patterns)) {
|
||
let isMatch = picomatch(String(pattern$1), options$1);
|
||
if (items.some((item) => isMatch(item))) return true;
|
||
}
|
||
return false;
|
||
};
|
||
/**
|
||
* Returns true if every string in the given `list` matches
|
||
* any of the given glob `patterns`.
|
||
*
|
||
* ```js
|
||
* const mm = require('micromatch');
|
||
* // mm.every(list, patterns[, options]);
|
||
*
|
||
* console.log(mm.every('foo.js', ['foo.js']));
|
||
* // true
|
||
* console.log(mm.every(['foo.js', 'bar.js'], ['*.js']));
|
||
* // true
|
||
* console.log(mm.every(['foo.js', 'bar.js'], ['*.js', '!foo.js']));
|
||
* // false
|
||
* console.log(mm.every(['foo.js'], ['*.js', '!foo.js']));
|
||
* // false
|
||
* ```
|
||
* @param {String|Array} `list` The string or array of strings to test.
|
||
* @param {String|Array} `patterns` One or more glob patterns to use for matching.
|
||
* @param {Object} `options` See available [options](#options) for changing how matches are performed
|
||
* @return {Boolean} Returns true if all `patterns` matches all of the strings in `list`
|
||
* @api public
|
||
*/
|
||
micromatch$1.every = (list, patterns, options$1) => {
|
||
let items = [].concat(list);
|
||
for (let pattern$1 of [].concat(patterns)) {
|
||
let isMatch = picomatch(String(pattern$1), options$1);
|
||
if (!items.every((item) => isMatch(item))) return false;
|
||
}
|
||
return true;
|
||
};
|
||
/**
|
||
* Returns true if **all** of the given `patterns` match
|
||
* the specified string.
|
||
*
|
||
* ```js
|
||
* const mm = require('micromatch');
|
||
* // mm.all(string, patterns[, options]);
|
||
*
|
||
* console.log(mm.all('foo.js', ['foo.js']));
|
||
* // true
|
||
*
|
||
* console.log(mm.all('foo.js', ['*.js', '!foo.js']));
|
||
* // false
|
||
*
|
||
* console.log(mm.all('foo.js', ['*.js', 'foo.js']));
|
||
* // true
|
||
*
|
||
* console.log(mm.all('foo.js', ['*.js', 'f*', '*o*', '*o.js']));
|
||
* // true
|
||
* ```
|
||
* @param {String|Array} `str` The string to test.
|
||
* @param {String|Array} `patterns` One or more glob patterns to use for matching.
|
||
* @param {Object} `options` See available [options](#options) for changing how matches are performed
|
||
* @return {Boolean} Returns true if any patterns match `str`
|
||
* @api public
|
||
*/
|
||
micromatch$1.all = (str, patterns, options$1) => {
|
||
if (typeof str !== "string") throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
|
||
return [].concat(patterns).every((p) => picomatch(p, options$1)(str));
|
||
};
|
||
/**
|
||
* Returns an array of matches captured by `pattern` in `string, or `null` if the pattern did not match.
|
||
*
|
||
* ```js
|
||
* const mm = require('micromatch');
|
||
* // mm.capture(pattern, string[, options]);
|
||
*
|
||
* console.log(mm.capture('test/*.js', 'test/foo.js'));
|
||
* //=> ['foo']
|
||
* console.log(mm.capture('test/*.js', 'foo/bar.css'));
|
||
* //=> null
|
||
* ```
|
||
* @param {String} `glob` Glob pattern to use for matching.
|
||
* @param {String} `input` String to match
|
||
* @param {Object} `options` See available [options](#options) for changing how matches are performed
|
||
* @return {Array|null} Returns an array of captures if the input matches the glob pattern, otherwise `null`.
|
||
* @api public
|
||
*/
|
||
micromatch$1.capture = (glob, input, options$1) => {
|
||
let posix = utils$10.isWindows(options$1);
|
||
let match = picomatch.makeRe(String(glob), {
|
||
...options$1,
|
||
capture: true
|
||
}).exec(posix ? utils$10.toPosixSlashes(input) : input);
|
||
if (match) return match.slice(1).map((v) => v === void 0 ? "" : v);
|
||
};
|
||
/**
|
||
* Create a regular expression from the given glob `pattern`.
|
||
*
|
||
* ```js
|
||
* const mm = require('micromatch');
|
||
* // mm.makeRe(pattern[, options]);
|
||
*
|
||
* console.log(mm.makeRe('*.js'));
|
||
* //=> /^(?:(\.[\\\/])?(?!\.)(?=.)[^\/]*?\.js)$/
|
||
* ```
|
||
* @param {String} `pattern` A glob pattern to convert to regex.
|
||
* @param {Object} `options`
|
||
* @return {RegExp} Returns a regex created from the given pattern.
|
||
* @api public
|
||
*/
|
||
micromatch$1.makeRe = (...args) => picomatch.makeRe(...args);
|
||
/**
|
||
* Scan a glob pattern to separate the pattern into segments. Used
|
||
* by the [split](#split) method.
|
||
*
|
||
* ```js
|
||
* const mm = require('micromatch');
|
||
* const state = mm.scan(pattern[, options]);
|
||
* ```
|
||
* @param {String} `pattern`
|
||
* @param {Object} `options`
|
||
* @return {Object} Returns an object with
|
||
* @api public
|
||
*/
|
||
micromatch$1.scan = (...args) => picomatch.scan(...args);
|
||
/**
|
||
* Parse a glob pattern to create the source string for a regular
|
||
* expression.
|
||
*
|
||
* ```js
|
||
* const mm = require('micromatch');
|
||
* const state = mm.parse(pattern[, options]);
|
||
* ```
|
||
* @param {String} `glob`
|
||
* @param {Object} `options`
|
||
* @return {Object} Returns an object with useful properties and output to be used as regex source string.
|
||
* @api public
|
||
*/
|
||
micromatch$1.parse = (patterns, options$1) => {
|
||
let res = [];
|
||
for (let pattern$1 of [].concat(patterns || [])) for (let str of braces(String(pattern$1), options$1)) res.push(picomatch.parse(str, options$1));
|
||
return res;
|
||
};
|
||
/**
|
||
* Process the given brace `pattern`.
|
||
*
|
||
* ```js
|
||
* const { braces } = require('micromatch');
|
||
* console.log(braces('foo/{a,b,c}/bar'));
|
||
* //=> [ 'foo/(a|b|c)/bar' ]
|
||
*
|
||
* console.log(braces('foo/{a,b,c}/bar', { expand: true }));
|
||
* //=> [ 'foo/a/bar', 'foo/b/bar', 'foo/c/bar' ]
|
||
* ```
|
||
* @param {String} `pattern` String with brace pattern to process.
|
||
* @param {Object} `options` Any [options](#options) to change how expansion is performed. See the [braces][] library for all available options.
|
||
* @return {Array}
|
||
* @api public
|
||
*/
|
||
micromatch$1.braces = (pattern$1, options$1) => {
|
||
if (typeof pattern$1 !== "string") throw new TypeError("Expected a string");
|
||
if (options$1 && options$1.nobrace === true || !hasBraces(pattern$1)) return [pattern$1];
|
||
return braces(pattern$1, options$1);
|
||
};
|
||
/**
|
||
* Expand braces
|
||
*/
|
||
micromatch$1.braceExpand = (pattern$1, options$1) => {
|
||
if (typeof pattern$1 !== "string") throw new TypeError("Expected a string");
|
||
return micromatch$1.braces(pattern$1, {
|
||
...options$1,
|
||
expand: true
|
||
});
|
||
};
|
||
/**
|
||
* Expose micromatch
|
||
*/
|
||
micromatch$1.hasBraces = hasBraces;
|
||
module.exports = micromatch$1;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/utils/pattern.js
|
||
var require_pattern = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/utils/pattern.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const path$6 = __require("path");
|
||
const globParent = require_glob_parent();
|
||
const micromatch = require_micromatch();
|
||
const GLOBSTAR = "**";
|
||
const ESCAPE_SYMBOL = "\\";
|
||
const COMMON_GLOB_SYMBOLS_RE = /[*?]|^!/;
|
||
const REGEX_CHARACTER_CLASS_SYMBOLS_RE = /\[[^[]*]/;
|
||
const REGEX_GROUP_SYMBOLS_RE = /(?:^|[^!*+?@])\([^(]*\|[^|]*\)/;
|
||
const GLOB_EXTENSION_SYMBOLS_RE = /[!*+?@]\([^(]*\)/;
|
||
const BRACE_EXPANSION_SEPARATORS_RE = /,|\.\./;
|
||
/**
|
||
* Matches a sequence of two or more consecutive slashes, excluding the first two slashes at the beginning of the string.
|
||
* The latter is due to the presence of the device path at the beginning of the UNC path.
|
||
*/
|
||
const DOUBLE_SLASH_RE = /(?!^)\/{2,}/g;
|
||
function isStaticPattern(pattern$1, options$1 = {}) {
|
||
return !isDynamicPattern(pattern$1, options$1);
|
||
}
|
||
exports.isStaticPattern = isStaticPattern;
|
||
function isDynamicPattern(pattern$1, options$1 = {}) {
|
||
/**
|
||
* A special case with an empty string is necessary for matching patterns that start with a forward slash.
|
||
* An empty string cannot be a dynamic pattern.
|
||
* For example, the pattern `/lib/*` will be spread into parts: '', 'lib', '*'.
|
||
*/
|
||
if (pattern$1 === "") return false;
|
||
/**
|
||
* When the `caseSensitiveMatch` option is disabled, all patterns must be marked as dynamic, because we cannot check
|
||
* filepath directly (without read directory).
|
||
*/
|
||
if (options$1.caseSensitiveMatch === false || pattern$1.includes(ESCAPE_SYMBOL)) return true;
|
||
if (COMMON_GLOB_SYMBOLS_RE.test(pattern$1) || REGEX_CHARACTER_CLASS_SYMBOLS_RE.test(pattern$1) || REGEX_GROUP_SYMBOLS_RE.test(pattern$1)) return true;
|
||
if (options$1.extglob !== false && GLOB_EXTENSION_SYMBOLS_RE.test(pattern$1)) return true;
|
||
if (options$1.braceExpansion !== false && hasBraceExpansion(pattern$1)) return true;
|
||
return false;
|
||
}
|
||
exports.isDynamicPattern = isDynamicPattern;
|
||
function hasBraceExpansion(pattern$1) {
|
||
const openingBraceIndex = pattern$1.indexOf("{");
|
||
if (openingBraceIndex === -1) return false;
|
||
const closingBraceIndex = pattern$1.indexOf("}", openingBraceIndex + 1);
|
||
if (closingBraceIndex === -1) return false;
|
||
const braceContent = pattern$1.slice(openingBraceIndex, closingBraceIndex);
|
||
return BRACE_EXPANSION_SEPARATORS_RE.test(braceContent);
|
||
}
|
||
function convertToPositivePattern(pattern$1) {
|
||
return isNegativePattern(pattern$1) ? pattern$1.slice(1) : pattern$1;
|
||
}
|
||
exports.convertToPositivePattern = convertToPositivePattern;
|
||
function convertToNegativePattern(pattern$1) {
|
||
return "!" + pattern$1;
|
||
}
|
||
exports.convertToNegativePattern = convertToNegativePattern;
|
||
function isNegativePattern(pattern$1) {
|
||
return pattern$1.startsWith("!") && pattern$1[1] !== "(";
|
||
}
|
||
exports.isNegativePattern = isNegativePattern;
|
||
function isPositivePattern(pattern$1) {
|
||
return !isNegativePattern(pattern$1);
|
||
}
|
||
exports.isPositivePattern = isPositivePattern;
|
||
function getNegativePatterns(patterns) {
|
||
return patterns.filter(isNegativePattern);
|
||
}
|
||
exports.getNegativePatterns = getNegativePatterns;
|
||
function getPositivePatterns$1(patterns) {
|
||
return patterns.filter(isPositivePattern);
|
||
}
|
||
exports.getPositivePatterns = getPositivePatterns$1;
|
||
/**
|
||
* Returns patterns that can be applied inside the current directory.
|
||
*
|
||
* @example
|
||
* // ['./*', '*', 'a/*']
|
||
* getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*'])
|
||
*/
|
||
function getPatternsInsideCurrentDirectory(patterns) {
|
||
return patterns.filter((pattern$1) => !isPatternRelatedToParentDirectory(pattern$1));
|
||
}
|
||
exports.getPatternsInsideCurrentDirectory = getPatternsInsideCurrentDirectory;
|
||
/**
|
||
* Returns patterns to be expanded relative to (outside) the current directory.
|
||
*
|
||
* @example
|
||
* // ['../*', './../*']
|
||
* getPatternsInsideCurrentDirectory(['./*', '*', 'a/*', '../*', './../*'])
|
||
*/
|
||
function getPatternsOutsideCurrentDirectory(patterns) {
|
||
return patterns.filter(isPatternRelatedToParentDirectory);
|
||
}
|
||
exports.getPatternsOutsideCurrentDirectory = getPatternsOutsideCurrentDirectory;
|
||
function isPatternRelatedToParentDirectory(pattern$1) {
|
||
return pattern$1.startsWith("..") || pattern$1.startsWith("./..");
|
||
}
|
||
exports.isPatternRelatedToParentDirectory = isPatternRelatedToParentDirectory;
|
||
function getBaseDirectory(pattern$1) {
|
||
return globParent(pattern$1, { flipBackslashes: false });
|
||
}
|
||
exports.getBaseDirectory = getBaseDirectory;
|
||
function hasGlobStar(pattern$1) {
|
||
return pattern$1.includes(GLOBSTAR);
|
||
}
|
||
exports.hasGlobStar = hasGlobStar;
|
||
function endsWithSlashGlobStar(pattern$1) {
|
||
return pattern$1.endsWith("/" + GLOBSTAR);
|
||
}
|
||
exports.endsWithSlashGlobStar = endsWithSlashGlobStar;
|
||
function isAffectDepthOfReadingPattern(pattern$1) {
|
||
const basename = path$6.basename(pattern$1);
|
||
return endsWithSlashGlobStar(pattern$1) || isStaticPattern(basename);
|
||
}
|
||
exports.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
|
||
function expandPatternsWithBraceExpansion(patterns) {
|
||
return patterns.reduce((collection, pattern$1) => {
|
||
return collection.concat(expandBraceExpansion(pattern$1));
|
||
}, []);
|
||
}
|
||
exports.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion;
|
||
function expandBraceExpansion(pattern$1) {
|
||
const patterns = micromatch.braces(pattern$1, {
|
||
expand: true,
|
||
nodupes: true,
|
||
keepEscaping: true
|
||
});
|
||
/**
|
||
* Sort the patterns by length so that the same depth patterns are processed side by side.
|
||
* `a/{b,}/{c,}/*` – `['a///*', 'a/b//*', 'a//c/*', 'a/b/c/*']`
|
||
*/
|
||
patterns.sort((a, b) => a.length - b.length);
|
||
/**
|
||
* Micromatch can return an empty string in the case of patterns like `{a,}`.
|
||
*/
|
||
return patterns.filter((pattern$2) => pattern$2 !== "");
|
||
}
|
||
exports.expandBraceExpansion = expandBraceExpansion;
|
||
function getPatternParts(pattern$1, options$1) {
|
||
let { parts } = micromatch.scan(pattern$1, Object.assign(Object.assign({}, options$1), { parts: true }));
|
||
/**
|
||
* The scan method returns an empty array in some cases.
|
||
* See micromatch/picomatch#58 for more details.
|
||
*/
|
||
if (parts.length === 0) parts = [pattern$1];
|
||
/**
|
||
* The scan method does not return an empty part for the pattern with a forward slash.
|
||
* This is another part of micromatch/picomatch#58.
|
||
*/
|
||
if (parts[0].startsWith("/")) {
|
||
parts[0] = parts[0].slice(1);
|
||
parts.unshift("");
|
||
}
|
||
return parts;
|
||
}
|
||
exports.getPatternParts = getPatternParts;
|
||
function makeRe(pattern$1, options$1) {
|
||
return micromatch.makeRe(pattern$1, options$1);
|
||
}
|
||
exports.makeRe = makeRe;
|
||
function convertPatternsToRe(patterns, options$1) {
|
||
return patterns.map((pattern$1) => makeRe(pattern$1, options$1));
|
||
}
|
||
exports.convertPatternsToRe = convertPatternsToRe;
|
||
function matchAny(entry, patternsRe) {
|
||
return patternsRe.some((patternRe) => patternRe.test(entry));
|
||
}
|
||
exports.matchAny = matchAny;
|
||
/**
|
||
* This package only works with forward slashes as a path separator.
|
||
* Because of this, we cannot use the standard `path.normalize` method, because on Windows platform it will use of backslashes.
|
||
*/
|
||
function removeDuplicateSlashes(pattern$1) {
|
||
return pattern$1.replace(DOUBLE_SLASH_RE, "/");
|
||
}
|
||
exports.removeDuplicateSlashes = removeDuplicateSlashes;
|
||
function partitionAbsoluteAndRelative(patterns) {
|
||
const absolute = [];
|
||
const relative$1 = [];
|
||
for (const pattern$1 of patterns) if (isAbsolute$1(pattern$1)) absolute.push(pattern$1);
|
||
else relative$1.push(pattern$1);
|
||
return [absolute, relative$1];
|
||
}
|
||
exports.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative;
|
||
function isAbsolute$1(pattern$1) {
|
||
return path$6.isAbsolute(pattern$1);
|
||
}
|
||
exports.isAbsolute = isAbsolute$1;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/merge2@1.4.1/node_modules/merge2/index.js
|
||
var require_merge2 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/merge2@1.4.1/node_modules/merge2/index.js": ((exports, module) => {
|
||
const PassThrough = __require("stream").PassThrough;
|
||
const slice = Array.prototype.slice;
|
||
module.exports = merge2$1;
|
||
function merge2$1() {
|
||
const streamsQueue = [];
|
||
const args = slice.call(arguments);
|
||
let merging = false;
|
||
let options$1 = args[args.length - 1];
|
||
if (options$1 && !Array.isArray(options$1) && options$1.pipe == null) args.pop();
|
||
else options$1 = {};
|
||
const doEnd = options$1.end !== false;
|
||
const doPipeError = options$1.pipeError === true;
|
||
if (options$1.objectMode == null) options$1.objectMode = true;
|
||
if (options$1.highWaterMark == null) options$1.highWaterMark = 64 * 1024;
|
||
const mergedStream = PassThrough(options$1);
|
||
function addStream() {
|
||
for (let i = 0, len = arguments.length; i < len; i++) streamsQueue.push(pauseStreams(arguments[i], options$1));
|
||
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 next() {
|
||
if (--pipesCount > 0) return;
|
||
merging = false;
|
||
mergeStream();
|
||
}
|
||
function pipe(stream$1) {
|
||
function onend() {
|
||
stream$1.removeListener("merge2UnpipeEnd", onend);
|
||
stream$1.removeListener("end", onend);
|
||
if (doPipeError) stream$1.removeListener("error", onerror);
|
||
next();
|
||
}
|
||
function onerror(err) {
|
||
mergedStream.emit("error", err);
|
||
}
|
||
if (stream$1._readableState.endEmitted) return next();
|
||
stream$1.on("merge2UnpipeEnd", onend);
|
||
stream$1.on("end", onend);
|
||
if (doPipeError) stream$1.on("error", onerror);
|
||
stream$1.pipe(mergedStream, { end: false });
|
||
stream$1.resume();
|
||
}
|
||
for (let i = 0; i < streams.length; i++) pipe(streams[i]);
|
||
next();
|
||
}
|
||
function endStream() {
|
||
merging = false;
|
||
mergedStream.emit("queueDrain");
|
||
if (doEnd) mergedStream.end();
|
||
}
|
||
mergedStream.setMaxListeners(0);
|
||
mergedStream.add = addStream;
|
||
mergedStream.on("unpipe", function(stream$1) {
|
||
stream$1.emit("merge2UnpipeEnd");
|
||
});
|
||
if (args.length) addStream.apply(null, args);
|
||
return mergedStream;
|
||
}
|
||
function pauseStreams(streams, options$1) {
|
||
if (!Array.isArray(streams)) {
|
||
if (!streams._readableState && streams.pipe) streams = streams.pipe(PassThrough(options$1));
|
||
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$1);
|
||
return streams;
|
||
}
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/utils/stream.js
|
||
var require_stream$3 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/utils/stream.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const merge2 = require_merge2();
|
||
function merge(streams) {
|
||
const mergedStream = merge2(streams);
|
||
streams.forEach((stream$1) => {
|
||
stream$1.once("error", (error) => mergedStream.emit("error", error));
|
||
});
|
||
mergedStream.once("close", () => propagateCloseEventToSources(streams));
|
||
mergedStream.once("end", () => propagateCloseEventToSources(streams));
|
||
return mergedStream;
|
||
}
|
||
exports.merge = merge;
|
||
function propagateCloseEventToSources(streams) {
|
||
streams.forEach((stream$1) => stream$1.emit("close"));
|
||
}
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/utils/string.js
|
||
var require_string = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/utils/string.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
function isString(input) {
|
||
return typeof input === "string";
|
||
}
|
||
exports.isString = isString;
|
||
function isEmpty(input) {
|
||
return input === "";
|
||
}
|
||
exports.isEmpty = isEmpty;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/utils/index.js
|
||
var require_utils$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/utils/index.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const array = require_array();
|
||
exports.array = array;
|
||
const errno = require_errno();
|
||
exports.errno = errno;
|
||
const fs$7 = require_fs$3();
|
||
exports.fs = fs$7;
|
||
const path$5 = require_path();
|
||
exports.path = path$5;
|
||
const pattern = require_pattern();
|
||
exports.pattern = pattern;
|
||
const stream = require_stream$3();
|
||
exports.stream = stream;
|
||
const string = require_string();
|
||
exports.string = string;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/managers/tasks.js
|
||
var require_tasks = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/managers/tasks.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const utils$9 = require_utils$1();
|
||
function generate(input, settings) {
|
||
const patterns = processPatterns(input, settings);
|
||
const ignore = processPatterns(settings.ignore, settings);
|
||
const positivePatterns = getPositivePatterns(patterns);
|
||
const negativePatterns = getNegativePatternsAsPositive(patterns, ignore);
|
||
const staticPatterns = positivePatterns.filter((pattern$1) => utils$9.pattern.isStaticPattern(pattern$1, settings));
|
||
const dynamicPatterns = positivePatterns.filter((pattern$1) => utils$9.pattern.isDynamicPattern(pattern$1, settings));
|
||
const staticTasks = convertPatternsToTasks(staticPatterns, negativePatterns, false);
|
||
const dynamicTasks = convertPatternsToTasks(dynamicPatterns, negativePatterns, true);
|
||
return staticTasks.concat(dynamicTasks);
|
||
}
|
||
exports.generate = generate;
|
||
function processPatterns(input, settings) {
|
||
let patterns = input;
|
||
/**
|
||
* The original pattern like `{,*,**,a/*}` can lead to problems checking the depth when matching entry
|
||
* and some problems with the micromatch package (see fast-glob issues: #365, #394).
|
||
*
|
||
* To solve this problem, we expand all patterns containing brace expansion. This can lead to a slight slowdown
|
||
* in matching in the case of a large set of patterns after expansion.
|
||
*/
|
||
if (settings.braceExpansion) patterns = utils$9.pattern.expandPatternsWithBraceExpansion(patterns);
|
||
/**
|
||
* If the `baseNameMatch` option is enabled, we must add globstar to patterns, so that they can be used
|
||
* at any nesting level.
|
||
*
|
||
* We do this here, because otherwise we have to complicate the filtering logic. For example, we need to change
|
||
* the pattern in the filter before creating a regular expression. There is no need to change the patterns
|
||
* in the application. Only on the input.
|
||
*/
|
||
if (settings.baseNameMatch) patterns = patterns.map((pattern$1) => pattern$1.includes("/") ? pattern$1 : `**/${pattern$1}`);
|
||
/**
|
||
* This method also removes duplicate slashes that may have been in the pattern or formed as a result of expansion.
|
||
*/
|
||
return patterns.map((pattern$1) => utils$9.pattern.removeDuplicateSlashes(pattern$1));
|
||
}
|
||
/**
|
||
* Returns tasks grouped by basic pattern directories.
|
||
*
|
||
* Patterns that can be found inside (`./`) and outside (`../`) the current directory are handled separately.
|
||
* This is necessary because directory traversal starts at the base directory and goes deeper.
|
||
*/
|
||
function convertPatternsToTasks(positive, negative, dynamic) {
|
||
const tasks = [];
|
||
const patternsOutsideCurrentDirectory = utils$9.pattern.getPatternsOutsideCurrentDirectory(positive);
|
||
const patternsInsideCurrentDirectory = utils$9.pattern.getPatternsInsideCurrentDirectory(positive);
|
||
const outsideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsOutsideCurrentDirectory);
|
||
const insideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsInsideCurrentDirectory);
|
||
tasks.push(...convertPatternGroupsToTasks(outsideCurrentDirectoryGroup, negative, dynamic));
|
||
if ("." in insideCurrentDirectoryGroup) tasks.push(convertPatternGroupToTask(".", patternsInsideCurrentDirectory, negative, dynamic));
|
||
else tasks.push(...convertPatternGroupsToTasks(insideCurrentDirectoryGroup, negative, dynamic));
|
||
return tasks;
|
||
}
|
||
exports.convertPatternsToTasks = convertPatternsToTasks;
|
||
function getPositivePatterns(patterns) {
|
||
return utils$9.pattern.getPositivePatterns(patterns);
|
||
}
|
||
exports.getPositivePatterns = getPositivePatterns;
|
||
function getNegativePatternsAsPositive(patterns, ignore) {
|
||
return utils$9.pattern.getNegativePatterns(patterns).concat(ignore).map(utils$9.pattern.convertToPositivePattern);
|
||
}
|
||
exports.getNegativePatternsAsPositive = getNegativePatternsAsPositive;
|
||
function groupPatternsByBaseDirectory(patterns) {
|
||
return patterns.reduce((collection, pattern$1) => {
|
||
const base = utils$9.pattern.getBaseDirectory(pattern$1);
|
||
if (base in collection) collection[base].push(pattern$1);
|
||
else collection[base] = [pattern$1];
|
||
return collection;
|
||
}, {});
|
||
}
|
||
exports.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory;
|
||
function convertPatternGroupsToTasks(positive, negative, dynamic) {
|
||
return Object.keys(positive).map((base) => {
|
||
return convertPatternGroupToTask(base, positive[base], negative, dynamic);
|
||
});
|
||
}
|
||
exports.convertPatternGroupsToTasks = convertPatternGroupsToTasks;
|
||
function convertPatternGroupToTask(base, positive, negative, dynamic) {
|
||
return {
|
||
dynamic,
|
||
positive,
|
||
negative,
|
||
base,
|
||
patterns: [].concat(positive, negative.map(utils$9.pattern.convertToNegativePattern))
|
||
};
|
||
}
|
||
exports.convertPatternGroupToTask = convertPatternGroupToTask;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/providers/async.js
|
||
var require_async$5 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/providers/async.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
function read$3(path$11, settings, callback) {
|
||
settings.fs.lstat(path$11, (lstatError, lstat) => {
|
||
if (lstatError !== null) {
|
||
callFailureCallback$2(callback, lstatError);
|
||
return;
|
||
}
|
||
if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
|
||
callSuccessCallback$2(callback, lstat);
|
||
return;
|
||
}
|
||
settings.fs.stat(path$11, (statError, stat$1) => {
|
||
if (statError !== null) {
|
||
if (settings.throwErrorOnBrokenSymbolicLink) {
|
||
callFailureCallback$2(callback, statError);
|
||
return;
|
||
}
|
||
callSuccessCallback$2(callback, lstat);
|
||
return;
|
||
}
|
||
if (settings.markSymbolicLink) stat$1.isSymbolicLink = () => true;
|
||
callSuccessCallback$2(callback, stat$1);
|
||
});
|
||
});
|
||
}
|
||
exports.read = read$3;
|
||
function callFailureCallback$2(callback, error) {
|
||
callback(error);
|
||
}
|
||
function callSuccessCallback$2(callback, result) {
|
||
callback(null, result);
|
||
}
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/providers/sync.js
|
||
var require_sync$5 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/providers/sync.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
function read$2(path$11, settings) {
|
||
const lstat = settings.fs.lstatSync(path$11);
|
||
if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) return lstat;
|
||
try {
|
||
const stat$1 = settings.fs.statSync(path$11);
|
||
if (settings.markSymbolicLink) stat$1.isSymbolicLink = () => true;
|
||
return stat$1;
|
||
} catch (error) {
|
||
if (!settings.throwErrorOnBrokenSymbolicLink) return lstat;
|
||
throw error;
|
||
}
|
||
}
|
||
exports.read = read$2;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/adapters/fs.js
|
||
var require_fs$2 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/adapters/fs.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
|
||
const fs$6 = __require("fs");
|
||
exports.FILE_SYSTEM_ADAPTER = {
|
||
lstat: fs$6.lstat,
|
||
stat: fs$6.stat,
|
||
lstatSync: fs$6.lstatSync,
|
||
statSync: fs$6.statSync
|
||
};
|
||
function createFileSystemAdapter$1(fsMethods) {
|
||
if (fsMethods === void 0) return exports.FILE_SYSTEM_ADAPTER;
|
||
return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
|
||
}
|
||
exports.createFileSystemAdapter = createFileSystemAdapter$1;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/settings.js
|
||
var require_settings$3 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/settings.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const fs$5 = require_fs$2();
|
||
var Settings$3 = class {
|
||
constructor(_options = {}) {
|
||
this._options = _options;
|
||
this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
|
||
this.fs = fs$5.createFileSystemAdapter(this._options.fs);
|
||
this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
|
||
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
||
}
|
||
_getValue(option, value) {
|
||
return option !== null && option !== void 0 ? option : value;
|
||
}
|
||
};
|
||
exports.default = Settings$3;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/index.js
|
||
var require_out$3 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/index.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const async$1 = require_async$5();
|
||
const sync$1 = require_sync$5();
|
||
const settings_1$3 = require_settings$3();
|
||
exports.Settings = settings_1$3.default;
|
||
function stat(path$11, optionsOrSettingsOrCallback, callback) {
|
||
if (typeof optionsOrSettingsOrCallback === "function") {
|
||
async$1.read(path$11, getSettings$2(), optionsOrSettingsOrCallback);
|
||
return;
|
||
}
|
||
async$1.read(path$11, getSettings$2(optionsOrSettingsOrCallback), callback);
|
||
}
|
||
exports.stat = stat;
|
||
function statSync(path$11, optionsOrSettings) {
|
||
const settings = getSettings$2(optionsOrSettings);
|
||
return sync$1.read(path$11, settings);
|
||
}
|
||
exports.statSync = statSync;
|
||
function getSettings$2(settingsOrOptions = {}) {
|
||
if (settingsOrOptions instanceof settings_1$3.default) return settingsOrOptions;
|
||
return new settings_1$3.default(settingsOrOptions);
|
||
}
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/queue-microtask@1.2.3/node_modules/queue-microtask/index.js
|
||
var require_queue_microtask = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/queue-microtask@1.2.3/node_modules/queue-microtask/index.js": ((exports, module) => {
|
||
/*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||
let promise;
|
||
module.exports = typeof queueMicrotask === "function" ? queueMicrotask.bind(typeof window !== "undefined" ? window : global) : (cb) => (promise || (promise = Promise.resolve())).then(cb).catch((err) => setTimeout(() => {
|
||
throw err;
|
||
}, 0));
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/run-parallel@1.2.0/node_modules/run-parallel/index.js
|
||
var require_run_parallel = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/run-parallel@1.2.0/node_modules/run-parallel/index.js": ((exports, module) => {
|
||
/*! run-parallel. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||
module.exports = runParallel;
|
||
const queueMicrotask$1 = require_queue_microtask();
|
||
function runParallel(tasks, cb) {
|
||
let results, pending, keys$1;
|
||
let isSync = true;
|
||
if (Array.isArray(tasks)) {
|
||
results = [];
|
||
pending = tasks.length;
|
||
} else {
|
||
keys$1 = Object.keys(tasks);
|
||
results = {};
|
||
pending = keys$1.length;
|
||
}
|
||
function done(err) {
|
||
function end() {
|
||
if (cb) cb(err, results);
|
||
cb = null;
|
||
}
|
||
if (isSync) queueMicrotask$1(end);
|
||
else end();
|
||
}
|
||
function each(i, err, result) {
|
||
results[i] = result;
|
||
if (--pending === 0 || err) done(err);
|
||
}
|
||
if (!pending) done(null);
|
||
else if (keys$1) keys$1.forEach(function(key) {
|
||
tasks[key](function(err, result) {
|
||
each(key, err, result);
|
||
});
|
||
});
|
||
else tasks.forEach(function(task, i) {
|
||
task(function(err, result) {
|
||
each(i, err, result);
|
||
});
|
||
});
|
||
isSync = false;
|
||
}
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/constants.js
|
||
var require_constants = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/constants.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const NODE_PROCESS_VERSION_PARTS = process.versions.node.split(".");
|
||
if (NODE_PROCESS_VERSION_PARTS[0] === void 0 || NODE_PROCESS_VERSION_PARTS[1] === void 0) throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);
|
||
const MAJOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[0], 10);
|
||
const MINOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[1], 10);
|
||
const SUPPORTED_MAJOR_VERSION = 10;
|
||
const SUPPORTED_MINOR_VERSION = 10;
|
||
const IS_MATCHED_BY_MAJOR = MAJOR_VERSION > SUPPORTED_MAJOR_VERSION;
|
||
const IS_MATCHED_BY_MAJOR_AND_MINOR = MAJOR_VERSION === SUPPORTED_MAJOR_VERSION && MINOR_VERSION >= SUPPORTED_MINOR_VERSION;
|
||
/**
|
||
* IS `true` for Node.js 10.10 and greater.
|
||
*/
|
||
exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_BY_MAJOR_AND_MINOR;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/utils/fs.js
|
||
var require_fs$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/utils/fs.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
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;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/utils/index.js
|
||
var require_utils = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/utils/index.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const fs$4 = require_fs$1();
|
||
exports.fs = fs$4;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/providers/common.js
|
||
var require_common$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/providers/common.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
function joinPathSegments$1(a, b, separator) {
|
||
/**
|
||
* The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`).
|
||
*/
|
||
if (a.endsWith(separator)) return a + b;
|
||
return a + separator + b;
|
||
}
|
||
exports.joinPathSegments = joinPathSegments$1;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/providers/async.js
|
||
var require_async$4 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/providers/async.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const fsStat$5 = require_out$3();
|
||
const rpl = require_run_parallel();
|
||
const constants_1$1 = require_constants();
|
||
const utils$8 = require_utils();
|
||
const common$4 = require_common$1();
|
||
function read$1(directory, settings, callback) {
|
||
if (!settings.stats && constants_1$1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
||
readdirWithFileTypes$1(directory, settings, callback);
|
||
return;
|
||
}
|
||
readdir$1(directory, settings, callback);
|
||
}
|
||
exports.read = read$1;
|
||
function readdirWithFileTypes$1(directory, settings, callback) {
|
||
settings.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => {
|
||
if (readdirError !== null) {
|
||
callFailureCallback$1(callback, readdirError);
|
||
return;
|
||
}
|
||
const entries = dirents.map((dirent) => ({
|
||
dirent,
|
||
name: dirent.name,
|
||
path: common$4.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
|
||
}));
|
||
if (!settings.followSymbolicLinks) {
|
||
callSuccessCallback$1(callback, entries);
|
||
return;
|
||
}
|
||
rpl(entries.map((entry) => makeRplTaskEntry(entry, settings)), (rplError, rplEntries) => {
|
||
if (rplError !== null) {
|
||
callFailureCallback$1(callback, rplError);
|
||
return;
|
||
}
|
||
callSuccessCallback$1(callback, rplEntries);
|
||
});
|
||
});
|
||
}
|
||
exports.readdirWithFileTypes = readdirWithFileTypes$1;
|
||
function makeRplTaskEntry(entry, settings) {
|
||
return (done) => {
|
||
if (!entry.dirent.isSymbolicLink()) {
|
||
done(null, entry);
|
||
return;
|
||
}
|
||
settings.fs.stat(entry.path, (statError, stats) => {
|
||
if (statError !== null) {
|
||
if (settings.throwErrorOnBrokenSymbolicLink) {
|
||
done(statError);
|
||
return;
|
||
}
|
||
done(null, entry);
|
||
return;
|
||
}
|
||
entry.dirent = utils$8.fs.createDirentFromStats(entry.name, stats);
|
||
done(null, entry);
|
||
});
|
||
};
|
||
}
|
||
function readdir$1(directory, settings, callback) {
|
||
settings.fs.readdir(directory, (readdirError, names) => {
|
||
if (readdirError !== null) {
|
||
callFailureCallback$1(callback, readdirError);
|
||
return;
|
||
}
|
||
rpl(names.map((name) => {
|
||
const path$11 = common$4.joinPathSegments(directory, name, settings.pathSegmentSeparator);
|
||
return (done) => {
|
||
fsStat$5.stat(path$11, settings.fsStatSettings, (error, stats) => {
|
||
if (error !== null) {
|
||
done(error);
|
||
return;
|
||
}
|
||
const entry = {
|
||
name,
|
||
path: path$11,
|
||
dirent: utils$8.fs.createDirentFromStats(name, stats)
|
||
};
|
||
if (settings.stats) entry.stats = stats;
|
||
done(null, entry);
|
||
});
|
||
};
|
||
}), (rplError, entries) => {
|
||
if (rplError !== null) {
|
||
callFailureCallback$1(callback, rplError);
|
||
return;
|
||
}
|
||
callSuccessCallback$1(callback, entries);
|
||
});
|
||
});
|
||
}
|
||
exports.readdir = readdir$1;
|
||
function callFailureCallback$1(callback, error) {
|
||
callback(error);
|
||
}
|
||
function callSuccessCallback$1(callback, result) {
|
||
callback(null, result);
|
||
}
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/providers/sync.js
|
||
var require_sync$4 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/providers/sync.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const fsStat$4 = require_out$3();
|
||
const constants_1 = require_constants();
|
||
const utils$7 = require_utils();
|
||
const common$3 = require_common$1();
|
||
function read(directory, settings) {
|
||
if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) return readdirWithFileTypes(directory, settings);
|
||
return readdir(directory, settings);
|
||
}
|
||
exports.read = read;
|
||
function readdirWithFileTypes(directory, settings) {
|
||
return settings.fs.readdirSync(directory, { withFileTypes: true }).map((dirent) => {
|
||
const entry = {
|
||
dirent,
|
||
name: dirent.name,
|
||
path: common$3.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
|
||
};
|
||
if (entry.dirent.isSymbolicLink() && settings.followSymbolicLinks) try {
|
||
const stats = settings.fs.statSync(entry.path);
|
||
entry.dirent = utils$7.fs.createDirentFromStats(entry.name, stats);
|
||
} catch (error) {
|
||
if (settings.throwErrorOnBrokenSymbolicLink) throw error;
|
||
}
|
||
return entry;
|
||
});
|
||
}
|
||
exports.readdirWithFileTypes = readdirWithFileTypes;
|
||
function readdir(directory, settings) {
|
||
return settings.fs.readdirSync(directory).map((name) => {
|
||
const entryPath = common$3.joinPathSegments(directory, name, settings.pathSegmentSeparator);
|
||
const stats = fsStat$4.statSync(entryPath, settings.fsStatSettings);
|
||
const entry = {
|
||
name,
|
||
path: entryPath,
|
||
dirent: utils$7.fs.createDirentFromStats(name, stats)
|
||
};
|
||
if (settings.stats) entry.stats = stats;
|
||
return entry;
|
||
});
|
||
}
|
||
exports.readdir = readdir;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/adapters/fs.js
|
||
var require_fs = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/adapters/fs.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
|
||
const fs$3 = __require("fs");
|
||
exports.FILE_SYSTEM_ADAPTER = {
|
||
lstat: fs$3.lstat,
|
||
stat: fs$3.stat,
|
||
lstatSync: fs$3.lstatSync,
|
||
statSync: fs$3.statSync,
|
||
readdir: fs$3.readdir,
|
||
readdirSync: fs$3.readdirSync
|
||
};
|
||
function createFileSystemAdapter(fsMethods) {
|
||
if (fsMethods === void 0) return exports.FILE_SYSTEM_ADAPTER;
|
||
return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
|
||
}
|
||
exports.createFileSystemAdapter = createFileSystemAdapter;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/settings.js
|
||
var require_settings$2 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/settings.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const path$4 = __require("path");
|
||
const fsStat$3 = require_out$3();
|
||
const fs$2 = require_fs();
|
||
var Settings$2 = class {
|
||
constructor(_options = {}) {
|
||
this._options = _options;
|
||
this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
|
||
this.fs = fs$2.createFileSystemAdapter(this._options.fs);
|
||
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$4.sep);
|
||
this.stats = this._getValue(this._options.stats, false);
|
||
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
||
this.fsStatSettings = new fsStat$3.Settings({
|
||
followSymbolicLink: this.followSymbolicLinks,
|
||
fs: this.fs,
|
||
throwErrorOnBrokenSymbolicLink: this.throwErrorOnBrokenSymbolicLink
|
||
});
|
||
}
|
||
_getValue(option, value) {
|
||
return option !== null && option !== void 0 ? option : value;
|
||
}
|
||
};
|
||
exports.default = Settings$2;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/index.js
|
||
var require_out$2 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/index.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const async = require_async$4();
|
||
const sync = require_sync$4();
|
||
const settings_1$2 = require_settings$2();
|
||
exports.Settings = settings_1$2.default;
|
||
function scandir(path$11, optionsOrSettingsOrCallback, callback) {
|
||
if (typeof optionsOrSettingsOrCallback === "function") {
|
||
async.read(path$11, getSettings$1(), optionsOrSettingsOrCallback);
|
||
return;
|
||
}
|
||
async.read(path$11, getSettings$1(optionsOrSettingsOrCallback), callback);
|
||
}
|
||
exports.scandir = scandir;
|
||
function scandirSync(path$11, optionsOrSettings) {
|
||
const settings = getSettings$1(optionsOrSettings);
|
||
return sync.read(path$11, settings);
|
||
}
|
||
exports.scandirSync = scandirSync;
|
||
function getSettings$1(settingsOrOptions = {}) {
|
||
if (settingsOrOptions instanceof settings_1$2.default) return settingsOrOptions;
|
||
return new settings_1$2.default(settingsOrOptions);
|
||
}
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/reusify@1.1.0/node_modules/reusify/reusify.js
|
||
var require_reusify = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/reusify@1.1.0/node_modules/reusify/reusify.js": ((exports, module) => {
|
||
function reusify$1(Constructor) {
|
||
var head = new Constructor();
|
||
var tail = head;
|
||
function get() {
|
||
var current = head;
|
||
if (current.next) head = current.next;
|
||
else {
|
||
head = new Constructor();
|
||
tail = head;
|
||
}
|
||
current.next = null;
|
||
return current;
|
||
}
|
||
function release(obj) {
|
||
tail.next = obj;
|
||
tail = obj;
|
||
}
|
||
return {
|
||
get,
|
||
release
|
||
};
|
||
}
|
||
module.exports = reusify$1;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/fastq@1.19.1/node_modules/fastq/queue.js
|
||
var require_queue = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fastq@1.19.1/node_modules/fastq/queue.js": ((exports, module) => {
|
||
var reusify = require_reusify();
|
||
function fastqueue(context, worker, _concurrency) {
|
||
if (typeof context === "function") {
|
||
_concurrency = worker;
|
||
worker = context;
|
||
context = null;
|
||
}
|
||
if (!(_concurrency >= 1)) throw new Error("fastqueue concurrency must be equal to or greater than 1");
|
||
var cache = reusify(Task);
|
||
var queueHead = null;
|
||
var queueTail = null;
|
||
var _running = 0;
|
||
var errorHandler = null;
|
||
var self$1 = {
|
||
push,
|
||
drain: noop,
|
||
saturated: noop,
|
||
pause,
|
||
paused: false,
|
||
get concurrency() {
|
||
return _concurrency;
|
||
},
|
||
set concurrency(value) {
|
||
if (!(value >= 1)) throw new Error("fastqueue concurrency must be equal to or greater than 1");
|
||
_concurrency = value;
|
||
if (self$1.paused) return;
|
||
for (; queueHead && _running < _concurrency;) {
|
||
_running++;
|
||
release();
|
||
}
|
||
},
|
||
running,
|
||
resume,
|
||
idle,
|
||
length,
|
||
getQueue,
|
||
unshift,
|
||
empty: noop,
|
||
kill,
|
||
killAndDrain,
|
||
error
|
||
};
|
||
return self$1;
|
||
function running() {
|
||
return _running;
|
||
}
|
||
function pause() {
|
||
self$1.paused = true;
|
||
}
|
||
function length() {
|
||
var current = queueHead;
|
||
var counter = 0;
|
||
while (current) {
|
||
current = current.next;
|
||
counter++;
|
||
}
|
||
return counter;
|
||
}
|
||
function getQueue() {
|
||
var current = queueHead;
|
||
var tasks = [];
|
||
while (current) {
|
||
tasks.push(current.value);
|
||
current = current.next;
|
||
}
|
||
return tasks;
|
||
}
|
||
function resume() {
|
||
if (!self$1.paused) return;
|
||
self$1.paused = false;
|
||
if (queueHead === null) {
|
||
_running++;
|
||
release();
|
||
return;
|
||
}
|
||
for (; queueHead && _running < _concurrency;) {
|
||
_running++;
|
||
release();
|
||
}
|
||
}
|
||
function idle() {
|
||
return _running === 0 && self$1.length() === 0;
|
||
}
|
||
function push(value, done) {
|
||
var current = cache.get();
|
||
current.context = context;
|
||
current.release = release;
|
||
current.value = value;
|
||
current.callback = done || noop;
|
||
current.errorHandler = errorHandler;
|
||
if (_running >= _concurrency || self$1.paused) if (queueTail) {
|
||
queueTail.next = current;
|
||
queueTail = current;
|
||
} else {
|
||
queueHead = current;
|
||
queueTail = current;
|
||
self$1.saturated();
|
||
}
|
||
else {
|
||
_running++;
|
||
worker.call(context, current.value, current.worked);
|
||
}
|
||
}
|
||
function unshift(value, done) {
|
||
var current = cache.get();
|
||
current.context = context;
|
||
current.release = release;
|
||
current.value = value;
|
||
current.callback = done || noop;
|
||
current.errorHandler = errorHandler;
|
||
if (_running >= _concurrency || self$1.paused) if (queueHead) {
|
||
current.next = queueHead;
|
||
queueHead = current;
|
||
} else {
|
||
queueHead = current;
|
||
queueTail = current;
|
||
self$1.saturated();
|
||
}
|
||
else {
|
||
_running++;
|
||
worker.call(context, current.value, current.worked);
|
||
}
|
||
}
|
||
function release(holder) {
|
||
if (holder) cache.release(holder);
|
||
var next = queueHead;
|
||
if (next && _running <= _concurrency) if (!self$1.paused) {
|
||
if (queueTail === queueHead) queueTail = null;
|
||
queueHead = next.next;
|
||
next.next = null;
|
||
worker.call(context, next.value, next.worked);
|
||
if (queueTail === null) self$1.empty();
|
||
} else _running--;
|
||
else if (--_running === 0) self$1.drain();
|
||
}
|
||
function kill() {
|
||
queueHead = null;
|
||
queueTail = null;
|
||
self$1.drain = noop;
|
||
}
|
||
function killAndDrain() {
|
||
queueHead = null;
|
||
queueTail = null;
|
||
self$1.drain();
|
||
self$1.drain = noop;
|
||
}
|
||
function error(handler) {
|
||
errorHandler = handler;
|
||
}
|
||
}
|
||
function noop() {}
|
||
function Task() {
|
||
this.value = null;
|
||
this.callback = noop;
|
||
this.next = null;
|
||
this.release = noop;
|
||
this.context = null;
|
||
this.errorHandler = null;
|
||
var self$1 = this;
|
||
this.worked = function worked(err, result) {
|
||
var callback = self$1.callback;
|
||
var errorHandler = self$1.errorHandler;
|
||
var val = self$1.value;
|
||
self$1.value = null;
|
||
self$1.callback = noop;
|
||
if (self$1.errorHandler) errorHandler(err, val);
|
||
callback.call(self$1.context, err, result);
|
||
self$1.release(self$1);
|
||
};
|
||
}
|
||
function queueAsPromised(context, worker, _concurrency) {
|
||
if (typeof context === "function") {
|
||
_concurrency = worker;
|
||
worker = context;
|
||
context = null;
|
||
}
|
||
function asyncWrapper(arg, cb) {
|
||
worker.call(this, arg).then(function(res) {
|
||
cb(null, res);
|
||
}, cb);
|
||
}
|
||
var queue = fastqueue(context, asyncWrapper, _concurrency);
|
||
var pushCb = queue.push;
|
||
var unshiftCb = queue.unshift;
|
||
queue.push = push;
|
||
queue.unshift = unshift;
|
||
queue.drained = drained;
|
||
return queue;
|
||
function push(value) {
|
||
var p = new Promise(function(resolve$2, reject) {
|
||
pushCb(value, function(err, result) {
|
||
if (err) {
|
||
reject(err);
|
||
return;
|
||
}
|
||
resolve$2(result);
|
||
});
|
||
});
|
||
p.catch(noop);
|
||
return p;
|
||
}
|
||
function unshift(value) {
|
||
var p = new Promise(function(resolve$2, reject) {
|
||
unshiftCb(value, function(err, result) {
|
||
if (err) {
|
||
reject(err);
|
||
return;
|
||
}
|
||
resolve$2(result);
|
||
});
|
||
});
|
||
p.catch(noop);
|
||
return p;
|
||
}
|
||
function drained() {
|
||
return new Promise(function(resolve$2) {
|
||
process.nextTick(function() {
|
||
if (queue.idle()) resolve$2();
|
||
else {
|
||
var previousDrain = queue.drain;
|
||
queue.drain = function() {
|
||
if (typeof previousDrain === "function") previousDrain();
|
||
resolve$2();
|
||
queue.drain = previousDrain;
|
||
};
|
||
}
|
||
});
|
||
});
|
||
}
|
||
}
|
||
module.exports = fastqueue;
|
||
module.exports.promise = queueAsPromised;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/readers/common.js
|
||
var require_common = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/readers/common.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
function isFatalError(settings, error) {
|
||
if (settings.errorFilter === null) return true;
|
||
return !settings.errorFilter(error);
|
||
}
|
||
exports.isFatalError = isFatalError;
|
||
function isAppliedFilter(filter, value) {
|
||
return filter === null || filter(value);
|
||
}
|
||
exports.isAppliedFilter = isAppliedFilter;
|
||
function replacePathSegmentSeparator(filepath, separator) {
|
||
return filepath.split(/[/\\]/).join(separator);
|
||
}
|
||
exports.replacePathSegmentSeparator = replacePathSegmentSeparator;
|
||
function joinPathSegments(a, b, separator) {
|
||
if (a === "") return b;
|
||
/**
|
||
* The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`).
|
||
*/
|
||
if (a.endsWith(separator)) return a + b;
|
||
return a + separator + b;
|
||
}
|
||
exports.joinPathSegments = joinPathSegments;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/readers/reader.js
|
||
var require_reader$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/readers/reader.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const common$2 = require_common();
|
||
var Reader$1 = class {
|
||
constructor(_root, _settings) {
|
||
this._root = _root;
|
||
this._settings = _settings;
|
||
this._root = common$2.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator);
|
||
}
|
||
};
|
||
exports.default = Reader$1;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/readers/async.js
|
||
var require_async$3 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/readers/async.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const events_1 = __require("events");
|
||
const fsScandir$2 = require_out$2();
|
||
const fastq = require_queue();
|
||
const common$1 = require_common();
|
||
const reader_1$4 = require_reader$1();
|
||
var AsyncReader = class extends reader_1$4.default {
|
||
constructor(_root, _settings) {
|
||
super(_root, _settings);
|
||
this._settings = _settings;
|
||
this._scandir = fsScandir$2.scandir;
|
||
this._emitter = new events_1.EventEmitter();
|
||
this._queue = fastq(this._worker.bind(this), this._settings.concurrency);
|
||
this._isFatalError = false;
|
||
this._isDestroyed = false;
|
||
this._queue.drain = () => {
|
||
if (!this._isFatalError) this._emitter.emit("end");
|
||
};
|
||
}
|
||
read() {
|
||
this._isFatalError = false;
|
||
this._isDestroyed = false;
|
||
setImmediate(() => {
|
||
this._pushToQueue(this._root, this._settings.basePath);
|
||
});
|
||
return this._emitter;
|
||
}
|
||
get isDestroyed() {
|
||
return this._isDestroyed;
|
||
}
|
||
destroy() {
|
||
if (this._isDestroyed) throw new Error("The reader is already destroyed");
|
||
this._isDestroyed = true;
|
||
this._queue.killAndDrain();
|
||
}
|
||
onEntry(callback) {
|
||
this._emitter.on("entry", callback);
|
||
}
|
||
onError(callback) {
|
||
this._emitter.once("error", callback);
|
||
}
|
||
onEnd(callback) {
|
||
this._emitter.once("end", callback);
|
||
}
|
||
_pushToQueue(directory, base) {
|
||
const queueItem = {
|
||
directory,
|
||
base
|
||
};
|
||
this._queue.push(queueItem, (error) => {
|
||
if (error !== null) this._handleError(error);
|
||
});
|
||
}
|
||
_worker(item, done) {
|
||
this._scandir(item.directory, this._settings.fsScandirSettings, (error, entries) => {
|
||
if (error !== null) {
|
||
done(error, void 0);
|
||
return;
|
||
}
|
||
for (const entry of entries) this._handleEntry(entry, item.base);
|
||
done(null, void 0);
|
||
});
|
||
}
|
||
_handleError(error) {
|
||
if (this._isDestroyed || !common$1.isFatalError(this._settings, error)) return;
|
||
this._isFatalError = true;
|
||
this._isDestroyed = true;
|
||
this._emitter.emit("error", error);
|
||
}
|
||
_handleEntry(entry, base) {
|
||
if (this._isDestroyed || this._isFatalError) return;
|
||
const fullpath = entry.path;
|
||
if (base !== void 0) entry.path = common$1.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
|
||
if (common$1.isAppliedFilter(this._settings.entryFilter, entry)) this._emitEntry(entry);
|
||
if (entry.dirent.isDirectory() && common$1.isAppliedFilter(this._settings.deepFilter, entry)) this._pushToQueue(fullpath, base === void 0 ? void 0 : entry.path);
|
||
}
|
||
_emitEntry(entry) {
|
||
this._emitter.emit("entry", entry);
|
||
}
|
||
};
|
||
exports.default = AsyncReader;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/providers/async.js
|
||
var require_async$2 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/providers/async.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const async_1$4 = require_async$3();
|
||
var AsyncProvider = class {
|
||
constructor(_root, _settings) {
|
||
this._root = _root;
|
||
this._settings = _settings;
|
||
this._reader = new async_1$4.default(this._root, this._settings);
|
||
this._storage = [];
|
||
}
|
||
read(callback) {
|
||
this._reader.onError((error) => {
|
||
callFailureCallback(callback, error);
|
||
});
|
||
this._reader.onEntry((entry) => {
|
||
this._storage.push(entry);
|
||
});
|
||
this._reader.onEnd(() => {
|
||
callSuccessCallback(callback, this._storage);
|
||
});
|
||
this._reader.read();
|
||
}
|
||
};
|
||
exports.default = AsyncProvider;
|
||
function callFailureCallback(callback, error) {
|
||
callback(error);
|
||
}
|
||
function callSuccessCallback(callback, entries) {
|
||
callback(null, entries);
|
||
}
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/providers/stream.js
|
||
var require_stream$2 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/providers/stream.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const stream_1$5 = __require("stream");
|
||
const async_1$3 = require_async$3();
|
||
var StreamProvider = class {
|
||
constructor(_root, _settings) {
|
||
this._root = _root;
|
||
this._settings = _settings;
|
||
this._reader = new async_1$3.default(this._root, this._settings);
|
||
this._stream = new stream_1$5.Readable({
|
||
objectMode: true,
|
||
read: () => {},
|
||
destroy: () => {
|
||
if (!this._reader.isDestroyed) this._reader.destroy();
|
||
}
|
||
});
|
||
}
|
||
read() {
|
||
this._reader.onError((error) => {
|
||
this._stream.emit("error", error);
|
||
});
|
||
this._reader.onEntry((entry) => {
|
||
this._stream.push(entry);
|
||
});
|
||
this._reader.onEnd(() => {
|
||
this._stream.push(null);
|
||
});
|
||
this._reader.read();
|
||
return this._stream;
|
||
}
|
||
};
|
||
exports.default = StreamProvider;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/readers/sync.js
|
||
var require_sync$3 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/readers/sync.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const fsScandir$1 = require_out$2();
|
||
const common = require_common();
|
||
const reader_1$3 = require_reader$1();
|
||
var SyncReader = class extends reader_1$3.default {
|
||
constructor() {
|
||
super(...arguments);
|
||
this._scandir = fsScandir$1.scandirSync;
|
||
this._storage = [];
|
||
this._queue = /* @__PURE__ */ new Set();
|
||
}
|
||
read() {
|
||
this._pushToQueue(this._root, this._settings.basePath);
|
||
this._handleQueue();
|
||
return this._storage;
|
||
}
|
||
_pushToQueue(directory, base) {
|
||
this._queue.add({
|
||
directory,
|
||
base
|
||
});
|
||
}
|
||
_handleQueue() {
|
||
for (const item of this._queue.values()) this._handleDirectory(item.directory, item.base);
|
||
}
|
||
_handleDirectory(directory, base) {
|
||
try {
|
||
const entries = this._scandir(directory, this._settings.fsScandirSettings);
|
||
for (const entry of entries) this._handleEntry(entry, base);
|
||
} catch (error) {
|
||
this._handleError(error);
|
||
}
|
||
}
|
||
_handleError(error) {
|
||
if (!common.isFatalError(this._settings, error)) return;
|
||
throw error;
|
||
}
|
||
_handleEntry(entry, base) {
|
||
const fullpath = entry.path;
|
||
if (base !== void 0) entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
|
||
if (common.isAppliedFilter(this._settings.entryFilter, entry)) this._pushToStorage(entry);
|
||
if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) this._pushToQueue(fullpath, base === void 0 ? void 0 : entry.path);
|
||
}
|
||
_pushToStorage(entry) {
|
||
this._storage.push(entry);
|
||
}
|
||
};
|
||
exports.default = SyncReader;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/providers/sync.js
|
||
var require_sync$2 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/providers/sync.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const sync_1$3 = require_sync$3();
|
||
var SyncProvider = class {
|
||
constructor(_root, _settings) {
|
||
this._root = _root;
|
||
this._settings = _settings;
|
||
this._reader = new sync_1$3.default(this._root, this._settings);
|
||
}
|
||
read() {
|
||
return this._reader.read();
|
||
}
|
||
};
|
||
exports.default = SyncProvider;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/settings.js
|
||
var require_settings$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/settings.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const path$3 = __require("path");
|
||
const fsScandir = require_out$2();
|
||
var Settings$1 = class {
|
||
constructor(_options = {}) {
|
||
this._options = _options;
|
||
this.basePath = this._getValue(this._options.basePath, void 0);
|
||
this.concurrency = this._getValue(this._options.concurrency, Number.POSITIVE_INFINITY);
|
||
this.deepFilter = this._getValue(this._options.deepFilter, null);
|
||
this.entryFilter = this._getValue(this._options.entryFilter, null);
|
||
this.errorFilter = this._getValue(this._options.errorFilter, null);
|
||
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$3.sep);
|
||
this.fsScandirSettings = new fsScandir.Settings({
|
||
followSymbolicLinks: this._options.followSymbolicLinks,
|
||
fs: this._options.fs,
|
||
pathSegmentSeparator: this._options.pathSegmentSeparator,
|
||
stats: this._options.stats,
|
||
throwErrorOnBrokenSymbolicLink: this._options.throwErrorOnBrokenSymbolicLink
|
||
});
|
||
}
|
||
_getValue(option, value) {
|
||
return option !== null && option !== void 0 ? option : value;
|
||
}
|
||
};
|
||
exports.default = Settings$1;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/index.js
|
||
var require_out$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/index.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const async_1$2 = require_async$2();
|
||
const stream_1$4 = require_stream$2();
|
||
const sync_1$2 = require_sync$2();
|
||
const settings_1$1 = require_settings$1();
|
||
exports.Settings = settings_1$1.default;
|
||
function walk(directory, optionsOrSettingsOrCallback, callback) {
|
||
if (typeof optionsOrSettingsOrCallback === "function") {
|
||
new async_1$2.default(directory, getSettings()).read(optionsOrSettingsOrCallback);
|
||
return;
|
||
}
|
||
new async_1$2.default(directory, getSettings(optionsOrSettingsOrCallback)).read(callback);
|
||
}
|
||
exports.walk = walk;
|
||
function walkSync(directory, optionsOrSettings) {
|
||
const settings = getSettings(optionsOrSettings);
|
||
return new sync_1$2.default(directory, settings).read();
|
||
}
|
||
exports.walkSync = walkSync;
|
||
function walkStream(directory, optionsOrSettings) {
|
||
const settings = getSettings(optionsOrSettings);
|
||
return new stream_1$4.default(directory, settings).read();
|
||
}
|
||
exports.walkStream = walkStream;
|
||
function getSettings(settingsOrOptions = {}) {
|
||
if (settingsOrOptions instanceof settings_1$1.default) return settingsOrOptions;
|
||
return new settings_1$1.default(settingsOrOptions);
|
||
}
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/readers/reader.js
|
||
var require_reader = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/readers/reader.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const path$2 = __require("path");
|
||
const fsStat$2 = require_out$3();
|
||
const utils$6 = require_utils$1();
|
||
var Reader = class {
|
||
constructor(_settings) {
|
||
this._settings = _settings;
|
||
this._fsStatSettings = new fsStat$2.Settings({
|
||
followSymbolicLink: this._settings.followSymbolicLinks,
|
||
fs: this._settings.fs,
|
||
throwErrorOnBrokenSymbolicLink: this._settings.followSymbolicLinks
|
||
});
|
||
}
|
||
_getFullEntryPath(filepath) {
|
||
return path$2.resolve(this._settings.cwd, filepath);
|
||
}
|
||
_makeEntry(stats, pattern$1) {
|
||
const entry = {
|
||
name: pattern$1,
|
||
path: pattern$1,
|
||
dirent: utils$6.fs.createDirentFromStats(pattern$1, stats)
|
||
};
|
||
if (this._settings.stats) entry.stats = stats;
|
||
return entry;
|
||
}
|
||
_isFatalError(error) {
|
||
return !utils$6.errno.isEnoentCodeError(error) && !this._settings.suppressErrors;
|
||
}
|
||
};
|
||
exports.default = Reader;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/readers/stream.js
|
||
var require_stream$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/readers/stream.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const stream_1$3 = __require("stream");
|
||
const fsStat$1 = require_out$3();
|
||
const fsWalk$2 = require_out$1();
|
||
const reader_1$2 = require_reader();
|
||
var ReaderStream = class extends reader_1$2.default {
|
||
constructor() {
|
||
super(...arguments);
|
||
this._walkStream = fsWalk$2.walkStream;
|
||
this._stat = fsStat$1.stat;
|
||
}
|
||
dynamic(root, options$1) {
|
||
return this._walkStream(root, options$1);
|
||
}
|
||
static(patterns, options$1) {
|
||
const filepaths = patterns.map(this._getFullEntryPath, this);
|
||
const stream$1 = new stream_1$3.PassThrough({ objectMode: true });
|
||
stream$1._write = (index, _enc, done) => {
|
||
return this._getEntry(filepaths[index], patterns[index], options$1).then((entry) => {
|
||
if (entry !== null && options$1.entryFilter(entry)) stream$1.push(entry);
|
||
if (index === filepaths.length - 1) stream$1.end();
|
||
done();
|
||
}).catch(done);
|
||
};
|
||
for (let i = 0; i < filepaths.length; i++) stream$1.write(i);
|
||
return stream$1;
|
||
}
|
||
_getEntry(filepath, pattern$1, options$1) {
|
||
return this._getStat(filepath).then((stats) => this._makeEntry(stats, pattern$1)).catch((error) => {
|
||
if (options$1.errorFilter(error)) return null;
|
||
throw error;
|
||
});
|
||
}
|
||
_getStat(filepath) {
|
||
return new Promise((resolve$2, reject) => {
|
||
this._stat(filepath, this._fsStatSettings, (error, stats) => {
|
||
return error === null ? resolve$2(stats) : reject(error);
|
||
});
|
||
});
|
||
}
|
||
};
|
||
exports.default = ReaderStream;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/readers/async.js
|
||
var require_async$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/readers/async.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const fsWalk$1 = require_out$1();
|
||
const reader_1$1 = require_reader();
|
||
const stream_1$2 = require_stream$1();
|
||
var ReaderAsync = class extends reader_1$1.default {
|
||
constructor() {
|
||
super(...arguments);
|
||
this._walkAsync = fsWalk$1.walk;
|
||
this._readerStream = new stream_1$2.default(this._settings);
|
||
}
|
||
dynamic(root, options$1) {
|
||
return new Promise((resolve$2, reject) => {
|
||
this._walkAsync(root, options$1, (error, entries) => {
|
||
if (error === null) resolve$2(entries);
|
||
else reject(error);
|
||
});
|
||
});
|
||
}
|
||
async static(patterns, options$1) {
|
||
const entries = [];
|
||
const stream$1 = this._readerStream.static(patterns, options$1);
|
||
return new Promise((resolve$2, reject) => {
|
||
stream$1.once("error", reject);
|
||
stream$1.on("data", (entry) => entries.push(entry));
|
||
stream$1.once("end", () => resolve$2(entries));
|
||
});
|
||
}
|
||
};
|
||
exports.default = ReaderAsync;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/providers/matchers/matcher.js
|
||
var require_matcher = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/providers/matchers/matcher.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const utils$5 = require_utils$1();
|
||
var Matcher = class {
|
||
constructor(_patterns, _settings, _micromatchOptions) {
|
||
this._patterns = _patterns;
|
||
this._settings = _settings;
|
||
this._micromatchOptions = _micromatchOptions;
|
||
this._storage = [];
|
||
this._fillStorage();
|
||
}
|
||
_fillStorage() {
|
||
for (const pattern$1 of this._patterns) {
|
||
const segments = this._getPatternSegments(pattern$1);
|
||
const sections = this._splitSegmentsIntoSections(segments);
|
||
this._storage.push({
|
||
complete: sections.length <= 1,
|
||
pattern: pattern$1,
|
||
segments,
|
||
sections
|
||
});
|
||
}
|
||
}
|
||
_getPatternSegments(pattern$1) {
|
||
return utils$5.pattern.getPatternParts(pattern$1, this._micromatchOptions).map((part) => {
|
||
if (!utils$5.pattern.isDynamicPattern(part, this._settings)) return {
|
||
dynamic: false,
|
||
pattern: part
|
||
};
|
||
return {
|
||
dynamic: true,
|
||
pattern: part,
|
||
patternRe: utils$5.pattern.makeRe(part, this._micromatchOptions)
|
||
};
|
||
});
|
||
}
|
||
_splitSegmentsIntoSections(segments) {
|
||
return utils$5.array.splitWhen(segments, (segment) => segment.dynamic && utils$5.pattern.hasGlobStar(segment.pattern));
|
||
}
|
||
};
|
||
exports.default = Matcher;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/providers/matchers/partial.js
|
||
var require_partial = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/providers/matchers/partial.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const matcher_1 = require_matcher();
|
||
var PartialMatcher = class extends matcher_1.default {
|
||
match(filepath) {
|
||
const parts = filepath.split("/");
|
||
const levels = parts.length;
|
||
const patterns = this._storage.filter((info) => !info.complete || info.segments.length > levels);
|
||
for (const pattern$1 of patterns) {
|
||
const section = pattern$1.sections[0];
|
||
/**
|
||
* In this case, the pattern has a globstar and we must read all directories unconditionally,
|
||
* but only if the level has reached the end of the first group.
|
||
*
|
||
* fixtures/{a,b}/**
|
||
* ^ true/false ^ always true
|
||
*/
|
||
if (!pattern$1.complete && levels > section.length) return true;
|
||
if (parts.every((part, index) => {
|
||
const segment = pattern$1.segments[index];
|
||
if (segment.dynamic && segment.patternRe.test(part)) return true;
|
||
if (!segment.dynamic && segment.pattern === part) return true;
|
||
return false;
|
||
})) return true;
|
||
}
|
||
return false;
|
||
}
|
||
};
|
||
exports.default = PartialMatcher;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/providers/filters/deep.js
|
||
var require_deep = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/providers/filters/deep.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const utils$4 = require_utils$1();
|
||
const partial_1 = require_partial();
|
||
var DeepFilter = class {
|
||
constructor(_settings, _micromatchOptions) {
|
||
this._settings = _settings;
|
||
this._micromatchOptions = _micromatchOptions;
|
||
}
|
||
getFilter(basePath, positive, negative) {
|
||
const matcher = this._getMatcher(positive);
|
||
const negativeRe = this._getNegativePatternsRe(negative);
|
||
return (entry) => this._filter(basePath, entry, matcher, negativeRe);
|
||
}
|
||
_getMatcher(patterns) {
|
||
return new partial_1.default(patterns, this._settings, this._micromatchOptions);
|
||
}
|
||
_getNegativePatternsRe(patterns) {
|
||
const affectDepthOfReadingPatterns = patterns.filter(utils$4.pattern.isAffectDepthOfReadingPattern);
|
||
return utils$4.pattern.convertPatternsToRe(affectDepthOfReadingPatterns, this._micromatchOptions);
|
||
}
|
||
_filter(basePath, entry, matcher, negativeRe) {
|
||
if (this._isSkippedByDeep(basePath, entry.path)) return false;
|
||
if (this._isSkippedSymbolicLink(entry)) return false;
|
||
const filepath = utils$4.path.removeLeadingDotSegment(entry.path);
|
||
if (this._isSkippedByPositivePatterns(filepath, matcher)) return false;
|
||
return this._isSkippedByNegativePatterns(filepath, negativeRe);
|
||
}
|
||
_isSkippedByDeep(basePath, entryPath) {
|
||
/**
|
||
* Avoid unnecessary depth calculations when it doesn't matter.
|
||
*/
|
||
if (this._settings.deep === Infinity) return false;
|
||
return this._getEntryLevel(basePath, entryPath) >= this._settings.deep;
|
||
}
|
||
_getEntryLevel(basePath, entryPath) {
|
||
const entryPathDepth = entryPath.split("/").length;
|
||
if (basePath === "") return entryPathDepth;
|
||
return entryPathDepth - basePath.split("/").length;
|
||
}
|
||
_isSkippedSymbolicLink(entry) {
|
||
return !this._settings.followSymbolicLinks && entry.dirent.isSymbolicLink();
|
||
}
|
||
_isSkippedByPositivePatterns(entryPath, matcher) {
|
||
return !this._settings.baseNameMatch && !matcher.match(entryPath);
|
||
}
|
||
_isSkippedByNegativePatterns(entryPath, patternsRe) {
|
||
return !utils$4.pattern.matchAny(entryPath, patternsRe);
|
||
}
|
||
};
|
||
exports.default = DeepFilter;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/providers/filters/entry.js
|
||
var require_entry$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/providers/filters/entry.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const utils$3 = require_utils$1();
|
||
var EntryFilter = class {
|
||
constructor(_settings, _micromatchOptions) {
|
||
this._settings = _settings;
|
||
this._micromatchOptions = _micromatchOptions;
|
||
this.index = /* @__PURE__ */ new Map();
|
||
}
|
||
getFilter(positive, negative) {
|
||
const [absoluteNegative, relativeNegative] = utils$3.pattern.partitionAbsoluteAndRelative(negative);
|
||
const patterns = {
|
||
positive: { all: utils$3.pattern.convertPatternsToRe(positive, this._micromatchOptions) },
|
||
negative: {
|
||
absolute: utils$3.pattern.convertPatternsToRe(absoluteNegative, Object.assign(Object.assign({}, this._micromatchOptions), { dot: true })),
|
||
relative: utils$3.pattern.convertPatternsToRe(relativeNegative, Object.assign(Object.assign({}, this._micromatchOptions), { dot: true }))
|
||
}
|
||
};
|
||
return (entry) => this._filter(entry, patterns);
|
||
}
|
||
_filter(entry, patterns) {
|
||
const filepath = utils$3.path.removeLeadingDotSegment(entry.path);
|
||
if (this._settings.unique && this._isDuplicateEntry(filepath)) return false;
|
||
if (this._onlyFileFilter(entry) || this._onlyDirectoryFilter(entry)) return false;
|
||
const isMatched = this._isMatchToPatternsSet(filepath, patterns, entry.dirent.isDirectory());
|
||
if (this._settings.unique && isMatched) this._createIndexRecord(filepath);
|
||
return isMatched;
|
||
}
|
||
_isDuplicateEntry(filepath) {
|
||
return this.index.has(filepath);
|
||
}
|
||
_createIndexRecord(filepath) {
|
||
this.index.set(filepath, void 0);
|
||
}
|
||
_onlyFileFilter(entry) {
|
||
return this._settings.onlyFiles && !entry.dirent.isFile();
|
||
}
|
||
_onlyDirectoryFilter(entry) {
|
||
return this._settings.onlyDirectories && !entry.dirent.isDirectory();
|
||
}
|
||
_isMatchToPatternsSet(filepath, patterns, isDirectory) {
|
||
if (!this._isMatchToPatterns(filepath, patterns.positive.all, isDirectory)) return false;
|
||
if (this._isMatchToPatterns(filepath, patterns.negative.relative, isDirectory)) return false;
|
||
if (this._isMatchToAbsoluteNegative(filepath, patterns.negative.absolute, isDirectory)) return false;
|
||
return true;
|
||
}
|
||
_isMatchToAbsoluteNegative(filepath, patternsRe, isDirectory) {
|
||
if (patternsRe.length === 0) return false;
|
||
const fullpath = utils$3.path.makeAbsolute(this._settings.cwd, filepath);
|
||
return this._isMatchToPatterns(fullpath, patternsRe, isDirectory);
|
||
}
|
||
_isMatchToPatterns(filepath, patternsRe, isDirectory) {
|
||
if (patternsRe.length === 0) return false;
|
||
const isMatched = utils$3.pattern.matchAny(filepath, patternsRe);
|
||
if (!isMatched && isDirectory) return utils$3.pattern.matchAny(filepath + "/", patternsRe);
|
||
return isMatched;
|
||
}
|
||
};
|
||
exports.default = EntryFilter;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/providers/filters/error.js
|
||
var require_error = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/providers/filters/error.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const utils$2 = require_utils$1();
|
||
var ErrorFilter = class {
|
||
constructor(_settings) {
|
||
this._settings = _settings;
|
||
}
|
||
getFilter() {
|
||
return (error) => this._isNonFatalError(error);
|
||
}
|
||
_isNonFatalError(error) {
|
||
return utils$2.errno.isEnoentCodeError(error) || this._settings.suppressErrors;
|
||
}
|
||
};
|
||
exports.default = ErrorFilter;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/providers/transformers/entry.js
|
||
var require_entry = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/providers/transformers/entry.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const utils$1 = require_utils$1();
|
||
var EntryTransformer = class {
|
||
constructor(_settings) {
|
||
this._settings = _settings;
|
||
}
|
||
getTransformer() {
|
||
return (entry) => this._transform(entry);
|
||
}
|
||
_transform(entry) {
|
||
let filepath = entry.path;
|
||
if (this._settings.absolute) {
|
||
filepath = utils$1.path.makeAbsolute(this._settings.cwd, filepath);
|
||
filepath = utils$1.path.unixify(filepath);
|
||
}
|
||
if (this._settings.markDirectories && entry.dirent.isDirectory()) filepath += "/";
|
||
if (!this._settings.objectMode) return filepath;
|
||
return Object.assign(Object.assign({}, entry), { path: filepath });
|
||
}
|
||
};
|
||
exports.default = EntryTransformer;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/providers/provider.js
|
||
var require_provider = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/providers/provider.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const path$1 = __require("path");
|
||
const deep_1 = require_deep();
|
||
const entry_1 = require_entry$1();
|
||
const error_1 = require_error();
|
||
const entry_2 = require_entry();
|
||
var Provider = class {
|
||
constructor(_settings) {
|
||
this._settings = _settings;
|
||
this.errorFilter = new error_1.default(this._settings);
|
||
this.entryFilter = new entry_1.default(this._settings, this._getMicromatchOptions());
|
||
this.deepFilter = new deep_1.default(this._settings, this._getMicromatchOptions());
|
||
this.entryTransformer = new entry_2.default(this._settings);
|
||
}
|
||
_getRootDirectory(task) {
|
||
return path$1.resolve(this._settings.cwd, task.base);
|
||
}
|
||
_getReaderOptions(task) {
|
||
const basePath = task.base === "." ? "" : task.base;
|
||
return {
|
||
basePath,
|
||
pathSegmentSeparator: "/",
|
||
concurrency: this._settings.concurrency,
|
||
deepFilter: this.deepFilter.getFilter(basePath, task.positive, task.negative),
|
||
entryFilter: this.entryFilter.getFilter(task.positive, task.negative),
|
||
errorFilter: this.errorFilter.getFilter(),
|
||
followSymbolicLinks: this._settings.followSymbolicLinks,
|
||
fs: this._settings.fs,
|
||
stats: this._settings.stats,
|
||
throwErrorOnBrokenSymbolicLink: this._settings.throwErrorOnBrokenSymbolicLink,
|
||
transform: this.entryTransformer.getTransformer()
|
||
};
|
||
}
|
||
_getMicromatchOptions() {
|
||
return {
|
||
dot: this._settings.dot,
|
||
matchBase: this._settings.baseNameMatch,
|
||
nobrace: !this._settings.braceExpansion,
|
||
nocase: !this._settings.caseSensitiveMatch,
|
||
noext: !this._settings.extglob,
|
||
noglobstar: !this._settings.globstar,
|
||
posix: true,
|
||
strictSlashes: false
|
||
};
|
||
}
|
||
};
|
||
exports.default = Provider;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/providers/async.js
|
||
var require_async = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/providers/async.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const async_1$1 = require_async$1();
|
||
const provider_1$2 = require_provider();
|
||
var ProviderAsync = class extends provider_1$2.default {
|
||
constructor() {
|
||
super(...arguments);
|
||
this._reader = new async_1$1.default(this._settings);
|
||
}
|
||
async read(task) {
|
||
const root = this._getRootDirectory(task);
|
||
const options$1 = this._getReaderOptions(task);
|
||
return (await this.api(root, task, options$1)).map((entry) => options$1.transform(entry));
|
||
}
|
||
api(root, task, options$1) {
|
||
if (task.dynamic) return this._reader.dynamic(root, options$1);
|
||
return this._reader.static(task.patterns, options$1);
|
||
}
|
||
};
|
||
exports.default = ProviderAsync;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/providers/stream.js
|
||
var require_stream = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/providers/stream.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const stream_1$1 = __require("stream");
|
||
const stream_2 = require_stream$1();
|
||
const provider_1$1 = require_provider();
|
||
var ProviderStream = class extends provider_1$1.default {
|
||
constructor() {
|
||
super(...arguments);
|
||
this._reader = new stream_2.default(this._settings);
|
||
}
|
||
read(task) {
|
||
const root = this._getRootDirectory(task);
|
||
const options$1 = this._getReaderOptions(task);
|
||
const source = this.api(root, task, options$1);
|
||
const destination = new stream_1$1.Readable({
|
||
objectMode: true,
|
||
read: () => {}
|
||
});
|
||
source.once("error", (error) => destination.emit("error", error)).on("data", (entry) => destination.emit("data", options$1.transform(entry))).once("end", () => destination.emit("end"));
|
||
destination.once("close", () => source.destroy());
|
||
return destination;
|
||
}
|
||
api(root, task, options$1) {
|
||
if (task.dynamic) return this._reader.dynamic(root, options$1);
|
||
return this._reader.static(task.patterns, options$1);
|
||
}
|
||
};
|
||
exports.default = ProviderStream;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/readers/sync.js
|
||
var require_sync$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/readers/sync.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const fsStat = require_out$3();
|
||
const fsWalk = require_out$1();
|
||
const reader_1 = require_reader();
|
||
var ReaderSync = class extends reader_1.default {
|
||
constructor() {
|
||
super(...arguments);
|
||
this._walkSync = fsWalk.walkSync;
|
||
this._statSync = fsStat.statSync;
|
||
}
|
||
dynamic(root, options$1) {
|
||
return this._walkSync(root, options$1);
|
||
}
|
||
static(patterns, options$1) {
|
||
const entries = [];
|
||
for (const pattern$1 of patterns) {
|
||
const filepath = this._getFullEntryPath(pattern$1);
|
||
const entry = this._getEntry(filepath, pattern$1, options$1);
|
||
if (entry === null || !options$1.entryFilter(entry)) continue;
|
||
entries.push(entry);
|
||
}
|
||
return entries;
|
||
}
|
||
_getEntry(filepath, pattern$1, options$1) {
|
||
try {
|
||
const stats = this._getStat(filepath);
|
||
return this._makeEntry(stats, pattern$1);
|
||
} catch (error) {
|
||
if (options$1.errorFilter(error)) return null;
|
||
throw error;
|
||
}
|
||
}
|
||
_getStat(filepath) {
|
||
return this._statSync(filepath, this._fsStatSettings);
|
||
}
|
||
};
|
||
exports.default = ReaderSync;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/providers/sync.js
|
||
var require_sync = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/providers/sync.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
const sync_1$1 = require_sync$1();
|
||
const provider_1 = require_provider();
|
||
var ProviderSync = class extends provider_1.default {
|
||
constructor() {
|
||
super(...arguments);
|
||
this._reader = new sync_1$1.default(this._settings);
|
||
}
|
||
read(task) {
|
||
const root = this._getRootDirectory(task);
|
||
const options$1 = this._getReaderOptions(task);
|
||
return this.api(root, task, options$1).map(options$1.transform);
|
||
}
|
||
api(root, task, options$1) {
|
||
if (task.dynamic) return this._reader.dynamic(root, options$1);
|
||
return this._reader.static(task.patterns, options$1);
|
||
}
|
||
};
|
||
exports.default = ProviderSync;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/settings.js
|
||
var require_settings = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/settings.js": ((exports) => {
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
|
||
const fs$1 = __require("fs");
|
||
const os = __require("os");
|
||
/**
|
||
* The `os.cpus` method can return zero. We expect the number of cores to be greater than zero.
|
||
* https://github.com/nodejs/node/blob/7faeddf23a98c53896f8b574a6e66589e8fb1eb8/lib/os.js#L106-L107
|
||
*/
|
||
const CPU_COUNT = Math.max(os.cpus().length, 1);
|
||
exports.DEFAULT_FILE_SYSTEM_ADAPTER = {
|
||
lstat: fs$1.lstat,
|
||
lstatSync: fs$1.lstatSync,
|
||
stat: fs$1.stat,
|
||
statSync: fs$1.statSync,
|
||
readdir: fs$1.readdir,
|
||
readdirSync: fs$1.readdirSync
|
||
};
|
||
var Settings = class {
|
||
constructor(_options = {}) {
|
||
this._options = _options;
|
||
this.absolute = this._getValue(this._options.absolute, false);
|
||
this.baseNameMatch = this._getValue(this._options.baseNameMatch, false);
|
||
this.braceExpansion = this._getValue(this._options.braceExpansion, true);
|
||
this.caseSensitiveMatch = this._getValue(this._options.caseSensitiveMatch, true);
|
||
this.concurrency = this._getValue(this._options.concurrency, CPU_COUNT);
|
||
this.cwd = this._getValue(this._options.cwd, process.cwd());
|
||
this.deep = this._getValue(this._options.deep, Infinity);
|
||
this.dot = this._getValue(this._options.dot, false);
|
||
this.extglob = this._getValue(this._options.extglob, true);
|
||
this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, true);
|
||
this.fs = this._getFileSystemMethods(this._options.fs);
|
||
this.globstar = this._getValue(this._options.globstar, true);
|
||
this.ignore = this._getValue(this._options.ignore, []);
|
||
this.markDirectories = this._getValue(this._options.markDirectories, false);
|
||
this.objectMode = this._getValue(this._options.objectMode, false);
|
||
this.onlyDirectories = this._getValue(this._options.onlyDirectories, false);
|
||
this.onlyFiles = this._getValue(this._options.onlyFiles, true);
|
||
this.stats = this._getValue(this._options.stats, false);
|
||
this.suppressErrors = this._getValue(this._options.suppressErrors, false);
|
||
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, false);
|
||
this.unique = this._getValue(this._options.unique, true);
|
||
if (this.onlyDirectories) this.onlyFiles = false;
|
||
if (this.stats) this.objectMode = true;
|
||
this.ignore = [].concat(this.ignore);
|
||
}
|
||
_getValue(option, value) {
|
||
return option === void 0 ? value : option;
|
||
}
|
||
_getFileSystemMethods(methods$1 = {}) {
|
||
return Object.assign(Object.assign({}, exports.DEFAULT_FILE_SYSTEM_ADAPTER), methods$1);
|
||
}
|
||
};
|
||
exports.default = Settings;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/index.js
|
||
var require_out = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/index.js": ((exports, module) => {
|
||
const taskManager = require_tasks();
|
||
const async_1 = require_async();
|
||
const stream_1 = require_stream();
|
||
const sync_1 = require_sync();
|
||
const settings_1 = require_settings();
|
||
const utils = require_utils$1();
|
||
async function FastGlob(source, options$1) {
|
||
assertPatternsInput(source);
|
||
const works = getWorks(source, async_1.default, options$1);
|
||
const result = await Promise.all(works);
|
||
return utils.array.flatten(result);
|
||
}
|
||
(function(FastGlob$1) {
|
||
FastGlob$1.glob = FastGlob$1;
|
||
FastGlob$1.globSync = sync$2;
|
||
FastGlob$1.globStream = stream$1;
|
||
FastGlob$1.async = FastGlob$1;
|
||
function sync$2(source, options$1) {
|
||
assertPatternsInput(source);
|
||
const works = getWorks(source, sync_1.default, options$1);
|
||
return utils.array.flatten(works);
|
||
}
|
||
FastGlob$1.sync = sync$2;
|
||
function stream$1(source, options$1) {
|
||
assertPatternsInput(source);
|
||
const works = getWorks(source, stream_1.default, options$1);
|
||
/**
|
||
* The stream returned by the provider cannot work with an asynchronous iterator.
|
||
* To support asynchronous iterators, regardless of the number of tasks, we always multiplex streams.
|
||
* This affects performance (+25%). I don't see best solution right now.
|
||
*/
|
||
return utils.stream.merge(works);
|
||
}
|
||
FastGlob$1.stream = stream$1;
|
||
function generateTasks(source, options$1) {
|
||
assertPatternsInput(source);
|
||
const patterns = [].concat(source);
|
||
const settings = new settings_1.default(options$1);
|
||
return taskManager.generate(patterns, settings);
|
||
}
|
||
FastGlob$1.generateTasks = generateTasks;
|
||
function isDynamicPattern$1(source, options$1) {
|
||
assertPatternsInput(source);
|
||
const settings = new settings_1.default(options$1);
|
||
return utils.pattern.isDynamicPattern(source, settings);
|
||
}
|
||
FastGlob$1.isDynamicPattern = isDynamicPattern$1;
|
||
function escapePath(source) {
|
||
assertPatternsInput(source);
|
||
return utils.path.escape(source);
|
||
}
|
||
FastGlob$1.escapePath = escapePath;
|
||
function convertPathToPattern(source) {
|
||
assertPatternsInput(source);
|
||
return utils.path.convertPathToPattern(source);
|
||
}
|
||
FastGlob$1.convertPathToPattern = convertPathToPattern;
|
||
(function(posix) {
|
||
function escapePath$1(source) {
|
||
assertPatternsInput(source);
|
||
return utils.path.escapePosixPath(source);
|
||
}
|
||
posix.escapePath = escapePath$1;
|
||
function convertPathToPattern$1(source) {
|
||
assertPatternsInput(source);
|
||
return utils.path.convertPosixPathToPattern(source);
|
||
}
|
||
posix.convertPathToPattern = convertPathToPattern$1;
|
||
})(FastGlob$1.posix || (FastGlob$1.posix = {}));
|
||
(function(win32$1) {
|
||
function escapePath$1(source) {
|
||
assertPatternsInput(source);
|
||
return utils.path.escapeWindowsPath(source);
|
||
}
|
||
win32$1.escapePath = escapePath$1;
|
||
function convertPathToPattern$1(source) {
|
||
assertPatternsInput(source);
|
||
return utils.path.convertWindowsPathToPattern(source);
|
||
}
|
||
win32$1.convertPathToPattern = convertPathToPattern$1;
|
||
})(FastGlob$1.win32 || (FastGlob$1.win32 = {}));
|
||
})(FastGlob || (FastGlob = {}));
|
||
function getWorks(source, _Provider, options$1) {
|
||
const patterns = [].concat(source);
|
||
const settings = new settings_1.default(options$1);
|
||
const tasks = taskManager.generate(patterns, settings);
|
||
const provider = new _Provider(settings);
|
||
return tasks.map(provider.read, provider);
|
||
}
|
||
function assertPatternsInput(input) {
|
||
if (![].concat(input).every((item) => utils.string.isString(item) && !utils.string.isEmpty(item))) throw new TypeError("Patterns must be a string (non empty) or an array of strings");
|
||
}
|
||
module.exports = FastGlob;
|
||
}) });
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/image-meta@0.2.2/node_modules/image-meta/dist/index.mjs
|
||
var import_out = /* @__PURE__ */ __toESM(require_out(), 1);
|
||
const decoder = new TextDecoder();
|
||
const toUTF8String = (input, start = 0, end = input.length) => decoder.decode(input.slice(start, end));
|
||
const toHexString = (input, start = 0, end = input.length) => input.slice(start, end).reduce((memo, i) => memo + ("0" + i.toString(16)).slice(-2), "");
|
||
const readInt16LE = (input, offset = 0) => {
|
||
const val = input[offset] + input[offset + 1] * 2 ** 8;
|
||
return val | (val & 2 ** 15) * 131070;
|
||
};
|
||
const readUInt16BE = (input, offset = 0) => input[offset] * 2 ** 8 + input[offset + 1];
|
||
const readUInt16LE = (input, offset = 0) => input[offset] + input[offset + 1] * 2 ** 8;
|
||
const readUInt24LE = (input, offset = 0) => input[offset] + input[offset + 1] * 2 ** 8 + input[offset + 2] * 2 ** 16;
|
||
const readInt32LE = (input, offset = 0) => input[offset] + input[offset + 1] * 2 ** 8 + input[offset + 2] * 2 ** 16 + (input[offset + 3] << 24);
|
||
const readUInt32BE = (input, offset = 0) => input[offset] * 2 ** 24 + input[offset + 1] * 2 ** 16 + input[offset + 2] * 2 ** 8 + input[offset + 3];
|
||
const readUInt32LE = (input, offset = 0) => input[offset] + input[offset + 1] * 2 ** 8 + input[offset + 2] * 2 ** 16 + input[offset + 3] * 2 ** 24;
|
||
const methods = {
|
||
readUInt16BE,
|
||
readUInt16LE,
|
||
readUInt32BE,
|
||
readUInt32LE
|
||
};
|
||
function readUInt(input, bits, offset, isBigEndian) {
|
||
offset = offset || 0;
|
||
const endian = isBigEndian ? "BE" : "LE";
|
||
return methods["readUInt" + bits + endian](input, offset);
|
||
}
|
||
const BMP = {
|
||
validate: (input) => toUTF8String(input, 0, 2) === "BM",
|
||
calculate: (input) => ({
|
||
height: Math.abs(readInt32LE(input, 22)),
|
||
width: readUInt32LE(input, 18)
|
||
})
|
||
};
|
||
const TYPE_ICON = 1;
|
||
const SIZE_HEADER$1 = 6;
|
||
const SIZE_IMAGE_ENTRY = 16;
|
||
function getSizeFromOffset(input, offset) {
|
||
const value = input[offset];
|
||
return value === 0 ? 256 : value;
|
||
}
|
||
function getImageSize$1(input, imageIndex) {
|
||
const offset = SIZE_HEADER$1 + imageIndex * SIZE_IMAGE_ENTRY;
|
||
return {
|
||
height: getSizeFromOffset(input, offset + 1),
|
||
width: getSizeFromOffset(input, offset)
|
||
};
|
||
}
|
||
const ICO = {
|
||
validate(input) {
|
||
const reserved = readUInt16LE(input, 0);
|
||
const imageCount = readUInt16LE(input, 4);
|
||
if (reserved !== 0 || imageCount === 0) return false;
|
||
return readUInt16LE(input, 2) === TYPE_ICON;
|
||
},
|
||
calculate(input) {
|
||
const nbImages = readUInt16LE(input, 4);
|
||
const imageSize = getImageSize$1(input, 0);
|
||
if (nbImages === 1) return imageSize;
|
||
const imgs = [imageSize];
|
||
for (let imageIndex = 1; imageIndex < nbImages; imageIndex += 1) imgs.push(getImageSize$1(input, imageIndex));
|
||
return {
|
||
height: imageSize.height,
|
||
images: imgs,
|
||
width: imageSize.width
|
||
};
|
||
}
|
||
};
|
||
const TYPE_CURSOR = 2;
|
||
const CUR = {
|
||
validate(input) {
|
||
const reserved = readUInt16LE(input, 0);
|
||
const imageCount = readUInt16LE(input, 4);
|
||
if (reserved !== 0 || imageCount === 0) return false;
|
||
return readUInt16LE(input, 2) === TYPE_CURSOR;
|
||
},
|
||
calculate: (input) => ICO.calculate(input)
|
||
};
|
||
const DDS = {
|
||
validate: (input) => readUInt32LE(input, 0) === 542327876,
|
||
calculate: (input) => ({
|
||
height: readUInt32LE(input, 12),
|
||
width: readUInt32LE(input, 16)
|
||
})
|
||
};
|
||
const gifRegexp = /^GIF8[79]a/;
|
||
const GIF = {
|
||
validate: (input) => gifRegexp.test(toUTF8String(input, 0, 6)),
|
||
calculate: (input) => ({
|
||
height: readUInt16LE(input, 8),
|
||
width: readUInt16LE(input, 6)
|
||
})
|
||
};
|
||
const HEIC = {
|
||
validate: (input) => {
|
||
const ftypBox = findBox$1(input, "ftyp");
|
||
if (!ftypBox) return false;
|
||
const majorBrand = toUTF8String(input, ftypBox.offset + 8, ftypBox.offset + 12);
|
||
return [
|
||
"heic",
|
||
"heix",
|
||
"hevc",
|
||
"hevx",
|
||
"mif1",
|
||
"msf1"
|
||
].includes(majorBrand);
|
||
},
|
||
calculate: (input) => {
|
||
const metaBox = findBox$1(input, "meta");
|
||
if (!metaBox) throw new TypeError("heic: meta box not found");
|
||
const iprpBox = findBox$1(input, "iprp", metaBox.offset + 12, metaBox.offset + metaBox.size);
|
||
if (!iprpBox) throw new TypeError("heic: iprp box not found");
|
||
const ipcoBox = findBox$1(input, "ipco", iprpBox.offset + 8, iprpBox.offset + iprpBox.size);
|
||
if (!ipcoBox) throw new TypeError("heic: ipco box not found");
|
||
const dimensions = findAllBoxes(input, "ispe", ipcoBox.offset + 8, ipcoBox.offset + ipcoBox.size).map((box) => ({
|
||
width: readUInt32BE(input, box.offset + 12),
|
||
height: readUInt32BE(input, box.offset + 16)
|
||
}));
|
||
if (dimensions.length === 0) throw new TypeError("heic: ispe box not found");
|
||
let largestDimension = dimensions[0];
|
||
for (let i = 1; i < dimensions.length; i++) {
|
||
const curr = dimensions[i];
|
||
if (curr.width * curr.height > largestDimension.width * largestDimension.height) largestDimension = curr;
|
||
}
|
||
return largestDimension;
|
||
}
|
||
};
|
||
function findBox$1(input, type, startOffset = 0, endOffset = input.length) {
|
||
let offset = startOffset;
|
||
while (offset < endOffset) {
|
||
const size = readUInt32BE(input, offset);
|
||
if (toUTF8String(input, offset + 4, offset + 8) === type) return {
|
||
offset,
|
||
size
|
||
};
|
||
if (size <= 0 || offset + size > endOffset) break;
|
||
offset += size;
|
||
}
|
||
}
|
||
function findAllBoxes(input, type, startOffset = 0, endOffset = input.length) {
|
||
let offset = startOffset;
|
||
const boxes = [];
|
||
while (offset < endOffset) {
|
||
const size = readUInt32BE(input, offset);
|
||
if (toUTF8String(input, offset + 4, offset + 8) === type) boxes.push({
|
||
offset,
|
||
size
|
||
});
|
||
if (size <= 0 || offset + size > endOffset) break;
|
||
offset += size;
|
||
}
|
||
return boxes;
|
||
}
|
||
const SIZE_HEADER = 8;
|
||
const FILE_LENGTH_OFFSET = 4;
|
||
const ENTRY_LENGTH_OFFSET = 4;
|
||
const ICON_TYPE_SIZE = {
|
||
ICON: 32,
|
||
"ICN#": 32,
|
||
"icm#": 16,
|
||
icm4: 16,
|
||
icm8: 16,
|
||
"ics#": 16,
|
||
ics4: 16,
|
||
ics8: 16,
|
||
is32: 16,
|
||
s8mk: 16,
|
||
icp4: 16,
|
||
icl4: 32,
|
||
icl8: 32,
|
||
il32: 32,
|
||
l8mk: 32,
|
||
icp5: 32,
|
||
ic11: 32,
|
||
ich4: 48,
|
||
ich8: 48,
|
||
ih32: 48,
|
||
h8mk: 48,
|
||
icp6: 64,
|
||
ic12: 32,
|
||
it32: 128,
|
||
t8mk: 128,
|
||
ic07: 128,
|
||
ic08: 256,
|
||
ic13: 256,
|
||
ic09: 512,
|
||
ic14: 512,
|
||
ic10: 1024
|
||
};
|
||
function readImageHeader(input, imageOffset) {
|
||
const imageLengthOffset = imageOffset + ENTRY_LENGTH_OFFSET;
|
||
return [toUTF8String(input, imageOffset, imageLengthOffset), readUInt32BE(input, imageLengthOffset)];
|
||
}
|
||
function getImageSize(type) {
|
||
const size = ICON_TYPE_SIZE[type];
|
||
return {
|
||
width: size,
|
||
height: size,
|
||
type
|
||
};
|
||
}
|
||
const ICNS = {
|
||
validate: (input) => toUTF8String(input, 0, 4) === "icns",
|
||
calculate(input) {
|
||
const inputLength = input.length;
|
||
const fileLength = readUInt32BE(input, FILE_LENGTH_OFFSET);
|
||
let imageOffset = SIZE_HEADER;
|
||
let imageHeader = readImageHeader(input, imageOffset);
|
||
let imageSize = getImageSize(imageHeader[0]);
|
||
imageOffset += imageHeader[1];
|
||
if (imageOffset === fileLength) return imageSize;
|
||
const result = {
|
||
height: imageSize.height,
|
||
images: [imageSize],
|
||
width: imageSize.width
|
||
};
|
||
while (imageOffset < fileLength && imageOffset < inputLength) {
|
||
imageHeader = readImageHeader(input, imageOffset);
|
||
imageSize = getImageSize(imageHeader[0]);
|
||
imageOffset += imageHeader[1];
|
||
result.images.push(imageSize);
|
||
}
|
||
return result;
|
||
}
|
||
};
|
||
const J2C = {
|
||
validate: (input) => toHexString(input, 0, 4) === "ff4fff51",
|
||
calculate: (input) => ({
|
||
height: readUInt32BE(input, 12),
|
||
width: readUInt32BE(input, 8)
|
||
})
|
||
};
|
||
const BoxTypes = {
|
||
ftyp: "66747970",
|
||
jp2h: "6a703268",
|
||
jp__: "6a502020",
|
||
rreq: "72726571"
|
||
};
|
||
const calculateRREQLength = (box) => {
|
||
const unit = box[0];
|
||
let offset = 1 + 2 * unit;
|
||
const flagsLength = readUInt16BE(box, offset) * (2 + unit);
|
||
offset = offset + 2 + flagsLength;
|
||
const featuresLength = readUInt16BE(box, offset) * (16 + unit);
|
||
return offset + 2 + featuresLength;
|
||
};
|
||
const parseIHDR = (box) => {
|
||
return {
|
||
height: readUInt32BE(box, 4),
|
||
width: readUInt32BE(box, 8)
|
||
};
|
||
};
|
||
const JP2 = {
|
||
validate(input) {
|
||
const signature = toHexString(input, 4, 8);
|
||
const signatureLength = readUInt32BE(input, 0);
|
||
if (signature !== BoxTypes.jp__ || signatureLength < 1) return false;
|
||
const ftypeBoxStart = signatureLength + 4;
|
||
const ftypBoxLength = readUInt32BE(input, signatureLength);
|
||
return toHexString(input.slice(ftypeBoxStart, ftypeBoxStart + ftypBoxLength), 0, 4) === BoxTypes.ftyp;
|
||
},
|
||
calculate(input) {
|
||
const signatureLength = readUInt32BE(input, 0);
|
||
const ftypBoxLength = readUInt16BE(input, signatureLength + 2);
|
||
let offset = signatureLength + 4 + ftypBoxLength;
|
||
switch (toHexString(input, offset, offset + 4)) {
|
||
case BoxTypes.rreq:
|
||
offset = offset + 4 + 4 + calculateRREQLength(input.slice(offset + 4));
|
||
return parseIHDR(input.slice(offset + 8, offset + 24));
|
||
case BoxTypes.jp2h: return parseIHDR(input.slice(offset + 8, offset + 24));
|
||
default: throw new TypeError("Unsupported header found: " + toUTF8String(input, offset, offset + 4));
|
||
}
|
||
}
|
||
};
|
||
const EXIF_MARKER = "45786966";
|
||
const APP1_DATA_SIZE_BYTES = 2;
|
||
const EXIF_HEADER_BYTES = 6;
|
||
const TIFF_BYTE_ALIGN_BYTES = 2;
|
||
const BIG_ENDIAN_BYTE_ALIGN = "4d4d";
|
||
const LITTLE_ENDIAN_BYTE_ALIGN = "4949";
|
||
const IDF_ENTRY_BYTES = 12;
|
||
const NUM_DIRECTORY_ENTRIES_BYTES = 2;
|
||
function isEXIF(input) {
|
||
return toHexString(input, 2, 6) === EXIF_MARKER;
|
||
}
|
||
function extractSize(input, index) {
|
||
return {
|
||
height: readUInt16BE(input, index),
|
||
width: readUInt16BE(input, index + 2)
|
||
};
|
||
}
|
||
function extractOrientation(exifBlock, isBigEndian) {
|
||
const offset = EXIF_HEADER_BYTES + 8;
|
||
const idfDirectoryEntries = readUInt(exifBlock, 16, offset, isBigEndian);
|
||
for (let directoryEntryNumber = 0; directoryEntryNumber < idfDirectoryEntries; directoryEntryNumber++) {
|
||
const start = offset + NUM_DIRECTORY_ENTRIES_BYTES + directoryEntryNumber * IDF_ENTRY_BYTES;
|
||
const end = start + IDF_ENTRY_BYTES;
|
||
if (start > exifBlock.length) return;
|
||
const block = exifBlock.slice(start, end);
|
||
if (readUInt(block, 16, 0, isBigEndian) === 274) {
|
||
if (readUInt(block, 16, 2, isBigEndian) !== 3) return;
|
||
if (readUInt(block, 32, 4, isBigEndian) !== 1) return;
|
||
return readUInt(block, 16, 8, isBigEndian);
|
||
}
|
||
}
|
||
}
|
||
function validateExifBlock(input, index) {
|
||
const exifBlock = input.slice(APP1_DATA_SIZE_BYTES, index);
|
||
const byteAlign = toHexString(exifBlock, EXIF_HEADER_BYTES, EXIF_HEADER_BYTES + TIFF_BYTE_ALIGN_BYTES);
|
||
const isBigEndian = byteAlign === BIG_ENDIAN_BYTE_ALIGN;
|
||
if (isBigEndian || byteAlign === LITTLE_ENDIAN_BYTE_ALIGN) return extractOrientation(exifBlock, isBigEndian);
|
||
}
|
||
function validateInput(input, index) {
|
||
if (index > input.length) throw new TypeError("Corrupt JPG, exceeded buffer limits");
|
||
if (input[index] !== 255) throw new TypeError("Invalid JPG, marker table corrupted");
|
||
}
|
||
const JPG = {
|
||
validate: (input) => toHexString(input, 0, 2) === "ffd8",
|
||
calculate(input) {
|
||
input = input.slice(4);
|
||
let orientation;
|
||
let next;
|
||
while (input.length > 0) {
|
||
const i = readUInt16BE(input, 0);
|
||
if (isEXIF(input)) orientation = validateExifBlock(input, i);
|
||
validateInput(input, i);
|
||
next = input[i + 1];
|
||
if (next === 192 || next === 193 || next === 194) {
|
||
const size = extractSize(input, i + 5);
|
||
if (!orientation) return size;
|
||
return {
|
||
height: size.height,
|
||
orientation,
|
||
width: size.width
|
||
};
|
||
}
|
||
input = input.slice(i + 2);
|
||
}
|
||
throw new TypeError("Invalid JPG, no size found");
|
||
}
|
||
};
|
||
const KTX = {
|
||
validate: (input) => toUTF8String(input, 1, 7) === "KTX 11",
|
||
calculate: (input) => ({
|
||
height: readUInt32LE(input, 40),
|
||
width: readUInt32LE(input, 36)
|
||
})
|
||
};
|
||
const pngSignature = "PNG\r\n\n";
|
||
const pngImageHeaderChunkName = "IHDR";
|
||
const pngFriedChunkName = "CgBI";
|
||
const PNG = {
|
||
validate(input) {
|
||
if (pngSignature === toUTF8String(input, 1, 8)) {
|
||
let chunkName = toUTF8String(input, 12, 16);
|
||
if (chunkName === pngFriedChunkName) chunkName = toUTF8String(input, 28, 32);
|
||
if (chunkName !== pngImageHeaderChunkName) throw new TypeError("Invalid PNG");
|
||
return true;
|
||
}
|
||
return false;
|
||
},
|
||
calculate(input) {
|
||
if (toUTF8String(input, 12, 16) === pngFriedChunkName) return {
|
||
height: readUInt32BE(input, 36),
|
||
width: readUInt32BE(input, 32)
|
||
};
|
||
return {
|
||
height: readUInt32BE(input, 20),
|
||
width: readUInt32BE(input, 16)
|
||
};
|
||
}
|
||
};
|
||
const PNMTypes = {
|
||
P1: "pbm/ascii",
|
||
P2: "pgm/ascii",
|
||
P3: "ppm/ascii",
|
||
P4: "pbm",
|
||
P5: "pgm",
|
||
P6: "ppm",
|
||
P7: "pam",
|
||
PF: "pfm"
|
||
};
|
||
const handlers = {
|
||
default: (lines) => {
|
||
let dimensions = [];
|
||
while (lines.length > 0) {
|
||
const line = lines.shift();
|
||
if (line[0] === "#") continue;
|
||
dimensions = line.split(" ");
|
||
break;
|
||
}
|
||
if (dimensions.length === 2) return {
|
||
height: Number.parseInt(dimensions[1], 10),
|
||
width: Number.parseInt(dimensions[0], 10)
|
||
};
|
||
else throw new TypeError("Invalid PNM");
|
||
},
|
||
pam: (lines) => {
|
||
const size = {};
|
||
while (lines.length > 0) {
|
||
const line = lines.shift();
|
||
if (line.length > 16 || (line.codePointAt(0) || 0) > 128) continue;
|
||
const [key, value] = line.split(" ");
|
||
if (key && value) size[key.toLowerCase()] = Number.parseInt(value, 10);
|
||
if (size.height && size.width) break;
|
||
}
|
||
if (size.height && size.width) return {
|
||
height: size.height,
|
||
width: size.width
|
||
};
|
||
else throw new TypeError("Invalid PAM");
|
||
}
|
||
};
|
||
const PNM = {
|
||
validate: (input) => toUTF8String(input, 0, 2) in PNMTypes,
|
||
calculate(input) {
|
||
const type = PNMTypes[toUTF8String(input, 0, 2)];
|
||
const lines = toUTF8String(input, 3).split(/[\n\r]+/);
|
||
return (handlers[type] || handlers.default)(lines);
|
||
}
|
||
};
|
||
const PSD = {
|
||
validate: (input) => toUTF8String(input, 0, 4) === "8BPS",
|
||
calculate: (input) => ({
|
||
height: readUInt32BE(input, 14),
|
||
width: readUInt32BE(input, 18)
|
||
})
|
||
};
|
||
const svgReg = /<svg\s([^"'>]|"[^"]*"|'[^']*')*>/;
|
||
const extractorRegExps = {
|
||
height: /\sheight=(["'])([^%]+?)\1/,
|
||
root: svgReg,
|
||
viewbox: /\sviewbox=(["'])(.+?)\1/i,
|
||
width: /\swidth=(["'])([^%]+?)\1/
|
||
};
|
||
const INCH_CM = 2.54;
|
||
const units = {
|
||
in: 96,
|
||
cm: 96 / INCH_CM,
|
||
em: 16,
|
||
ex: 8,
|
||
m: 96 / INCH_CM * 100,
|
||
mm: 96 / INCH_CM / 10,
|
||
pc: 96 / 72 / 12,
|
||
pt: 96 / 72,
|
||
px: 1
|
||
};
|
||
const unitsReg = /* @__PURE__ */ new RegExp(`^([0-9.]+(?:e\\d+)?)(${Object.keys(units).join("|")})?$`);
|
||
function parseLength(len) {
|
||
const m = unitsReg.exec(len);
|
||
if (!m) return;
|
||
return Math.round(Number(m[1]) * (units[m[2]] || 1));
|
||
}
|
||
function parseViewbox(viewbox) {
|
||
const bounds = viewbox.split(" ");
|
||
return {
|
||
height: parseLength(bounds[3]),
|
||
width: parseLength(bounds[2])
|
||
};
|
||
}
|
||
function parseAttributes(root) {
|
||
const width = root.match(extractorRegExps.width);
|
||
const height = root.match(extractorRegExps.height);
|
||
const viewbox = root.match(extractorRegExps.viewbox);
|
||
return {
|
||
height: height && parseLength(height[2]),
|
||
viewbox: viewbox && parseViewbox(viewbox[2]),
|
||
width: width && parseLength(width[2])
|
||
};
|
||
}
|
||
function calculateByDimensions(attrs) {
|
||
return {
|
||
height: attrs.height,
|
||
width: attrs.width
|
||
};
|
||
}
|
||
function calculateByViewbox(attrs, viewbox) {
|
||
const ratio = viewbox.width / viewbox.height;
|
||
if (attrs.width) return {
|
||
height: Math.floor(attrs.width / ratio),
|
||
width: attrs.width
|
||
};
|
||
if (attrs.height) return {
|
||
height: attrs.height,
|
||
width: Math.floor(attrs.height * ratio)
|
||
};
|
||
return {
|
||
height: viewbox.height,
|
||
width: viewbox.width
|
||
};
|
||
}
|
||
const SVG = {
|
||
validate: (input) => svgReg.test(toUTF8String(input, 0, 1e3)),
|
||
calculate(input) {
|
||
const root = toUTF8String(input).match(extractorRegExps.root);
|
||
if (root) {
|
||
const attrs = parseAttributes(root[0]);
|
||
if (attrs.width && attrs.height) return calculateByDimensions(attrs);
|
||
if (attrs.viewbox) return calculateByViewbox(attrs, attrs.viewbox);
|
||
}
|
||
throw new TypeError("Invalid SVG");
|
||
}
|
||
};
|
||
const TGA = {
|
||
validate(input) {
|
||
return readUInt16LE(input, 0) === 0 && readUInt16LE(input, 4) === 0;
|
||
},
|
||
calculate(input) {
|
||
return {
|
||
height: readUInt16LE(input, 14),
|
||
width: readUInt16LE(input, 12)
|
||
};
|
||
}
|
||
};
|
||
function readIFD(buffer, isBigEndian) {
|
||
const ifdOffset = readUInt(buffer, 32, 4, isBigEndian);
|
||
let bufferSize = 1024;
|
||
const fileSize = buffer.length;
|
||
if (ifdOffset + bufferSize > fileSize) bufferSize = fileSize - ifdOffset - 10;
|
||
return buffer.slice(ifdOffset + 2, ifdOffset + 2 + bufferSize);
|
||
}
|
||
function readValue(buffer, isBigEndian) {
|
||
const low = readUInt(buffer, 16, 8, isBigEndian);
|
||
return (readUInt(buffer, 16, 10, isBigEndian) << 16) + low;
|
||
}
|
||
function nextTag(buffer) {
|
||
if (buffer.length > 24) return buffer.slice(12);
|
||
}
|
||
function extractTags(buffer, isBigEndian) {
|
||
const tags = {};
|
||
let temp = buffer;
|
||
while (temp && temp.length > 0) {
|
||
const code = readUInt(temp, 16, 0, isBigEndian);
|
||
const type = readUInt(temp, 16, 2, isBigEndian);
|
||
const length = readUInt(temp, 32, 4, isBigEndian);
|
||
if (code === 0) break;
|
||
else {
|
||
if (length === 1 && (type === 3 || type === 4)) tags[code] = readValue(temp, isBigEndian);
|
||
temp = nextTag(temp);
|
||
}
|
||
}
|
||
return tags;
|
||
}
|
||
function determineEndianness(input) {
|
||
const signature = toUTF8String(input, 0, 2);
|
||
if (signature === "II") return "LE";
|
||
else if (signature === "MM") return "BE";
|
||
}
|
||
const signatures = /* @__PURE__ */ new Set(["49492a00", "4d4d002a"]);
|
||
const TIFF = {
|
||
validate: (input) => signatures.has(toHexString(input, 0, 4)),
|
||
calculate(input) {
|
||
const isBigEndian = determineEndianness(input) === "BE";
|
||
const tags = extractTags(readIFD(input, isBigEndian), isBigEndian);
|
||
const width = tags[256];
|
||
const height = tags[257];
|
||
if (!width || !height) throw new TypeError("Invalid Tiff. Missing tags");
|
||
return {
|
||
height,
|
||
width
|
||
};
|
||
}
|
||
};
|
||
function calculateExtended(input) {
|
||
return {
|
||
height: 1 + readUInt24LE(input, 7),
|
||
width: 1 + readUInt24LE(input, 4)
|
||
};
|
||
}
|
||
function calculateLossless(input) {
|
||
return {
|
||
height: 1 + ((input[4] & 15) << 10 | input[3] << 2 | (input[2] & 192) >> 6),
|
||
width: 1 + ((input[2] & 63) << 8 | input[1])
|
||
};
|
||
}
|
||
function calculateLossy(input) {
|
||
return {
|
||
height: readInt16LE(input, 8) & 16383,
|
||
width: readInt16LE(input, 6) & 16383
|
||
};
|
||
}
|
||
const WEBP = {
|
||
validate(input) {
|
||
const riffHeader = toUTF8String(input, 0, 4) === "RIFF";
|
||
const webpHeader = toUTF8String(input, 8, 12) === "WEBP";
|
||
const vp8Header = toUTF8String(input, 12, 15) === "VP8";
|
||
return riffHeader && webpHeader && vp8Header;
|
||
},
|
||
calculate(input) {
|
||
const chunkHeader = toUTF8String(input, 12, 16);
|
||
input = input.slice(20, 30);
|
||
if (chunkHeader === "VP8X") {
|
||
const extendedHeader = input[0];
|
||
const validStart = (extendedHeader & 192) === 0;
|
||
const validEnd = (extendedHeader & 1) === 0;
|
||
if (validStart && validEnd) return calculateExtended(input);
|
||
else throw new TypeError("Invalid WebP");
|
||
}
|
||
if (chunkHeader === "VP8 " && input[0] !== 47) return calculateLossy(input);
|
||
const signature = toHexString(input, 3, 6);
|
||
if (chunkHeader === "VP8L" && signature !== "9d012a") return calculateLossless(input);
|
||
throw new TypeError("Invalid WebP");
|
||
}
|
||
};
|
||
const AVIF = {
|
||
validate: (input) => toUTF8String(input, 8, 12) === "avif",
|
||
calculate: (input) => {
|
||
const metaBox = findBox(input, "meta");
|
||
const iprpBox = findBox(input, "iprp", metaBox.offset + 12, metaBox.offset + metaBox.size);
|
||
const ipcoBox = findBox(input, "ipco", iprpBox.offset + 8, iprpBox.offset + iprpBox.size);
|
||
const ispeBox = findBox(input, "ispe", ipcoBox.offset + 8, ipcoBox.offset + ipcoBox.size);
|
||
return {
|
||
width: readUInt32BE(input, ispeBox.offset + 12),
|
||
height: readUInt32BE(input, ispeBox.offset + 16)
|
||
};
|
||
}
|
||
};
|
||
function findBox(input, type, startOffset = 0, endOffset = input.length) {
|
||
for (let offset = startOffset; offset < endOffset;) {
|
||
const size = readUInt32BE(input, offset);
|
||
if (toUTF8String(input, offset + 4, offset + 8) === type) return {
|
||
offset,
|
||
size
|
||
};
|
||
if (size <= 0 || offset + size > endOffset) break;
|
||
offset += size;
|
||
}
|
||
throw new Error(`${type} box not found`);
|
||
}
|
||
const typeHandlers = {
|
||
bmp: BMP,
|
||
cur: CUR,
|
||
dds: DDS,
|
||
gif: GIF,
|
||
heic: HEIC,
|
||
icns: ICNS,
|
||
ico: ICO,
|
||
j2c: J2C,
|
||
jp2: JP2,
|
||
jpg: JPG,
|
||
ktx: KTX,
|
||
png: PNG,
|
||
pnm: PNM,
|
||
psd: PSD,
|
||
svg: SVG,
|
||
tga: TGA,
|
||
tiff: TIFF,
|
||
webp: WEBP,
|
||
avif: AVIF
|
||
};
|
||
const keys = Object.keys(typeHandlers);
|
||
const firstBytes = {
|
||
56: "psd",
|
||
66: "bmp",
|
||
68: "dds",
|
||
71: "gif",
|
||
73: "tiff",
|
||
77: "tiff",
|
||
82: "webp",
|
||
105: "icns",
|
||
137: "png",
|
||
255: "jpg"
|
||
};
|
||
function detector(input) {
|
||
const byte = input[0];
|
||
if (byte in firstBytes) {
|
||
const type = firstBytes[byte];
|
||
if (type && typeHandlers[type].validate(input)) return type;
|
||
}
|
||
return keys.find((key) => typeHandlers[key].validate(input));
|
||
}
|
||
function imageMeta(input) {
|
||
if (!(input instanceof Uint8Array)) throw new TypeError("Input should be a Uint8Array");
|
||
const type = detector(input);
|
||
if (type !== void 0 && type in typeHandlers) {
|
||
const size = typeHandlers[type].calculate(input);
|
||
if (size !== void 0) {
|
||
size.type = type;
|
||
return size;
|
||
}
|
||
}
|
||
throw new TypeError(`Unsupported file type: ${type}`);
|
||
}
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
|
||
const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
||
function normalizeWindowsPath(input = "") {
|
||
if (!input) return input;
|
||
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
||
}
|
||
const _UNC_REGEX = /^[/\\]{2}/;
|
||
const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
||
const _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
|
||
const _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
|
||
const normalize = function(path$11) {
|
||
if (path$11.length === 0) return ".";
|
||
path$11 = normalizeWindowsPath(path$11);
|
||
const isUNCPath = path$11.match(_UNC_REGEX);
|
||
const isPathAbsolute = isAbsolute(path$11);
|
||
const trailingSeparator = path$11[path$11.length - 1] === "/";
|
||
path$11 = normalizeString(path$11, !isPathAbsolute);
|
||
if (path$11.length === 0) {
|
||
if (isPathAbsolute) return "/";
|
||
return trailingSeparator ? "./" : ".";
|
||
}
|
||
if (trailingSeparator) path$11 += "/";
|
||
if (_DRIVE_LETTER_RE.test(path$11)) path$11 += "/";
|
||
if (isUNCPath) {
|
||
if (!isPathAbsolute) return `//./${path$11}`;
|
||
return `//${path$11}`;
|
||
}
|
||
return isPathAbsolute && !isAbsolute(path$11) ? `/${path$11}` : path$11;
|
||
};
|
||
const join = function(...segments) {
|
||
let path$11 = "";
|
||
for (const seg of segments) {
|
||
if (!seg) continue;
|
||
if (path$11.length > 0) {
|
||
const pathTrailing = path$11[path$11.length - 1] === "/";
|
||
const segLeading = seg[0] === "/";
|
||
if (pathTrailing && segLeading) path$11 += seg.slice(1);
|
||
else path$11 += pathTrailing || segLeading ? seg : `/${seg}`;
|
||
} else path$11 += seg;
|
||
}
|
||
return normalize(path$11);
|
||
};
|
||
function cwd() {
|
||
if (typeof process !== "undefined" && typeof process.cwd === "function") return process.cwd().replace(/\\/g, "/");
|
||
return "/";
|
||
}
|
||
const resolve$1 = function(...arguments_) {
|
||
arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
|
||
let resolvedPath = "";
|
||
let resolvedAbsolute = false;
|
||
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
||
const path$11 = index >= 0 ? arguments_[index] : cwd();
|
||
if (!path$11 || path$11.length === 0) continue;
|
||
resolvedPath = `${path$11}/${resolvedPath}`;
|
||
resolvedAbsolute = isAbsolute(path$11);
|
||
}
|
||
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
|
||
if (resolvedAbsolute && !isAbsolute(resolvedPath)) return `/${resolvedPath}`;
|
||
return resolvedPath.length > 0 ? resolvedPath : ".";
|
||
};
|
||
function normalizeString(path$11, allowAboveRoot) {
|
||
let res = "";
|
||
let lastSegmentLength = 0;
|
||
let lastSlash = -1;
|
||
let dots = 0;
|
||
let char = null;
|
||
for (let index = 0; index <= path$11.length; ++index) {
|
||
if (index < path$11.length) char = path$11[index];
|
||
else if (char === "/") break;
|
||
else char = "/";
|
||
if (char === "/") {
|
||
if (lastSlash === index - 1 || dots === 1);
|
||
else if (dots === 2) {
|
||
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
||
if (res.length > 2) {
|
||
const lastSlashIndex = res.lastIndexOf("/");
|
||
if (lastSlashIndex === -1) {
|
||
res = "";
|
||
lastSegmentLength = 0;
|
||
} else {
|
||
res = res.slice(0, lastSlashIndex);
|
||
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
||
}
|
||
lastSlash = index;
|
||
dots = 0;
|
||
continue;
|
||
} else if (res.length > 0) {
|
||
res = "";
|
||
lastSegmentLength = 0;
|
||
lastSlash = index;
|
||
dots = 0;
|
||
continue;
|
||
}
|
||
}
|
||
if (allowAboveRoot) {
|
||
res += res.length > 0 ? "/.." : "..";
|
||
lastSegmentLength = 2;
|
||
}
|
||
} else {
|
||
if (res.length > 0) res += `/${path$11.slice(lastSlash + 1, index)}`;
|
||
else res = path$11.slice(lastSlash + 1, index);
|
||
lastSegmentLength = index - lastSlash - 1;
|
||
}
|
||
lastSlash = index;
|
||
dots = 0;
|
||
} else if (char === "." && dots !== -1) ++dots;
|
||
else dots = -1;
|
||
}
|
||
return res;
|
||
}
|
||
const isAbsolute = function(p) {
|
||
return _IS_ABSOLUTE_RE.test(p);
|
||
};
|
||
const relative = function(from, to) {
|
||
const _from = resolve$1(from).replace(_ROOT_FOLDER_RE, "$1").split("/");
|
||
const _to = resolve$1(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
|
||
if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) return _to.join("/");
|
||
const _fromCopy = [..._from];
|
||
for (const segment of _fromCopy) {
|
||
if (_to[0] !== segment) break;
|
||
_from.shift();
|
||
_to.shift();
|
||
}
|
||
return [..._from.map(() => ".."), ..._to].join("/");
|
||
};
|
||
|
||
//#endregion
|
||
//#region ../../node_modules/.pnpm/perfect-debounce@2.0.0/node_modules/perfect-debounce/dist/index.mjs
|
||
const DEBOUNCE_DEFAULTS = { trailing: true };
|
||
/**
|
||
Debounce functions
|
||
@param fn - Promise-returning/async function to debounce.
|
||
@param wait - Milliseconds to wait before calling `fn`. Default value is 25ms
|
||
@returns A function that delays calling `fn` until after `wait` milliseconds have elapsed since the last time it was called.
|
||
@example
|
||
```
|
||
import { debounce } from 'perfect-debounce';
|
||
const expensiveCall = async input => input;
|
||
const debouncedFn = debounce(expensiveCall, 200);
|
||
for (const number of [1, 2, 3]) {
|
||
console.log(await debouncedFn(number));
|
||
}
|
||
//=> 1
|
||
//=> 2
|
||
//=> 3
|
||
```
|
||
*/
|
||
function debounce(fn, wait = 25, options$1 = {}) {
|
||
options$1 = {
|
||
...DEBOUNCE_DEFAULTS,
|
||
...options$1
|
||
};
|
||
if (!Number.isFinite(wait)) throw new TypeError("Expected `wait` to be a finite number");
|
||
let leadingValue;
|
||
let timeout;
|
||
let resolveList = [];
|
||
let currentPromise;
|
||
let trailingArgs;
|
||
const applyFn = (_this, args) => {
|
||
currentPromise = _applyPromised(fn, _this, args);
|
||
currentPromise.finally(() => {
|
||
currentPromise = null;
|
||
if (options$1.trailing && trailingArgs && !timeout) {
|
||
const promise$1 = applyFn(_this, trailingArgs);
|
||
trailingArgs = null;
|
||
return promise$1;
|
||
}
|
||
});
|
||
return currentPromise;
|
||
};
|
||
const debounced = function(...args) {
|
||
if (options$1.trailing) trailingArgs = args;
|
||
if (currentPromise) return currentPromise;
|
||
return new Promise((resolve$2) => {
|
||
const shouldCallNow = !timeout && options$1.leading;
|
||
clearTimeout(timeout);
|
||
timeout = setTimeout(() => {
|
||
timeout = null;
|
||
const promise$1 = options$1.leading ? leadingValue : applyFn(this, args);
|
||
trailingArgs = null;
|
||
for (const _resolve of resolveList) _resolve(promise$1);
|
||
resolveList = [];
|
||
}, wait);
|
||
if (shouldCallNow) {
|
||
leadingValue = applyFn(this, args);
|
||
resolve$2(leadingValue);
|
||
} else resolveList.push(resolve$2);
|
||
});
|
||
};
|
||
const _clearTimeout = (timer) => {
|
||
if (timer) {
|
||
clearTimeout(timer);
|
||
timeout = null;
|
||
}
|
||
};
|
||
debounced.isPending = () => !!timeout;
|
||
debounced.cancel = () => {
|
||
_clearTimeout(timeout);
|
||
resolveList = [];
|
||
trailingArgs = null;
|
||
};
|
||
debounced.flush = () => {
|
||
_clearTimeout(timeout);
|
||
if (!trailingArgs || currentPromise) return;
|
||
const args = trailingArgs;
|
||
trailingArgs = null;
|
||
return applyFn(this, args);
|
||
};
|
||
return debounced;
|
||
}
|
||
async function _applyPromised(fn, _this, args) {
|
||
return await fn.apply(_this, args);
|
||
}
|
||
|
||
//#endregion
|
||
//#region src/rpc/assets.ts
|
||
function guessType(path$11) {
|
||
if (/\.(?:png|jpe?g|jxl|gif|svg|webp|avif|ico|bmp|tiff?)$/i.test(path$11)) return "image";
|
||
if (/\.(?:mp4|webm|ogv|mov|avi|flv|wmv|mpg|mpeg|mkv|3gp|3g2|ts|mts|m2ts|vob|ogm|ogx|rm|rmvb|asf|amv|divx|m4v|svi|viv|f4v|f4p|f4a|f4b)$/i.test(path$11)) return "video";
|
||
if (/\.(?:mp3|wav|ogg|flac|aac|wma|alac|ape|ac3|dts|tta|opus|amr|aiff|au|mid|midi|ra|rm|wv|weba|dss|spx|vox|tak|dsf|dff|dsd|cda)$/i.test(path$11)) return "audio";
|
||
if (/\.(?:woff2?|eot|ttf|otf|ttc|pfa|pfb|pfm|afm)/i.test(path$11)) return "font";
|
||
if (/\.(?:json[5c]?|te?xt|[mc]?[jt]sx?|md[cx]?|markdown|ya?ml|toml)/i.test(path$11)) return "text";
|
||
if (/\.wasm/i.test(path$11)) return "wasm";
|
||
return "other";
|
||
}
|
||
function getAssetsFunctions(ctx) {
|
||
const { server, config } = ctx;
|
||
const _imageMetaCache = /* @__PURE__ */ new Map();
|
||
let cache = null;
|
||
async function scan$2() {
|
||
const dir = resolve$1(config.root);
|
||
const baseURL = config.base;
|
||
const publicDir = config.publicDir;
|
||
const relativePublicDir = publicDir === "" ? "" : `${relative(dir, publicDir)}/`;
|
||
const files = await (0, import_out.default)([
|
||
"**/*.(png|jpg|jpeg|gif|svg|webp|avif|ico|bmp|tiff)",
|
||
"**/*.(mp4|webm|ogv|mov|avi|flv|wmv|mpg|mpeg|mkv|3gp|3g2|m2ts|vob|ogm|ogx|rm|rmvb|asf|amv|divx|m4v|svi|viv|f4v|f4p|f4a|f4b)",
|
||
"**/*.(mp3|wav|ogg|flac|aac|wma|alac|ape|ac3|dts|tta|opus|amr|aiff|au|mid|midi|ra|rm|wv|weba|dss|spx|vox|tak|dsf|dff|dsd|cda)",
|
||
"**/*.(woff2?|eot|ttf|otf|ttc|pfa|pfb|pfm|afm)",
|
||
"**/*.(json|json5|jsonc|txt|text|tsx|jsx|md|mdx|mdc|markdown|yaml|yml|toml)",
|
||
"**/*.wasm"
|
||
], {
|
||
cwd: dir,
|
||
onlyFiles: true,
|
||
caseSensitiveMatch: false,
|
||
ignore: [
|
||
"**/node_modules/**",
|
||
"**/dist/**",
|
||
"**/package-lock.*",
|
||
"**/pnpm-lock.*",
|
||
"**/pnpm-workspace.*"
|
||
]
|
||
});
|
||
cache = await Promise.all(files.map(async (relativePath) => {
|
||
const filePath = resolve$1(dir, relativePath);
|
||
const stat$1 = await fsp.lstat(filePath);
|
||
const path$11 = relativePath.replace(relativePublicDir, "");
|
||
return {
|
||
path: path$11,
|
||
relativePath,
|
||
publicPath: join(baseURL, path$11),
|
||
filePath,
|
||
type: guessType(relativePath),
|
||
size: stat$1.size,
|
||
mtime: stat$1.mtimeMs
|
||
};
|
||
}));
|
||
return cache;
|
||
}
|
||
async function getAssetImporters(url) {
|
||
const importers = [];
|
||
const module$1 = await server.moduleGraph.getModuleByUrl(url);
|
||
if (module$1) for (const importer of module$1.importers) importers.push({
|
||
url: importer.url,
|
||
id: importer.id
|
||
});
|
||
return importers;
|
||
}
|
||
const debouncedAssetsUpdated = debounce(() => {
|
||
var _ref;
|
||
getViteRpcServer === null || getViteRpcServer === void 0 || (_ref = getViteRpcServer()) === null || _ref === void 0 || (_ref = _ref.broadcast) === null || _ref === void 0 || _ref.emit("assetsUpdated");
|
||
}, 100);
|
||
server.watcher.on("all", (event) => {
|
||
if (event !== "change") debouncedAssetsUpdated();
|
||
});
|
||
return {
|
||
async getStaticAssets() {
|
||
return await scan$2();
|
||
},
|
||
async getAssetImporters(url) {
|
||
return await getAssetImporters(url);
|
||
},
|
||
async getImageMeta(filepath) {
|
||
if (_imageMetaCache.has(filepath)) return _imageMetaCache.get(filepath);
|
||
try {
|
||
const meta = imageMeta(await fsp.readFile(filepath));
|
||
_imageMetaCache.set(filepath, meta);
|
||
return meta;
|
||
} catch (e) {
|
||
_imageMetaCache.set(filepath, void 0);
|
||
console.error(e);
|
||
return;
|
||
}
|
||
},
|
||
async getTextAssetContent(filepath, limit = 300) {
|
||
try {
|
||
return (await fsp.readFile(filepath, "utf-8")).slice(0, limit);
|
||
} catch (e) {
|
||
console.error(e);
|
||
return;
|
||
}
|
||
}
|
||
};
|
||
}
|
||
|
||
//#endregion
|
||
//#region src/rpc/get-config.ts
|
||
function getConfigFunctions(ctx) {
|
||
return { getRoot() {
|
||
return ctx.config.root;
|
||
} };
|
||
}
|
||
|
||
//#endregion
|
||
//#region src/rpc/graph.ts
|
||
function getGraphFunctions(ctx) {
|
||
const { rpc, server } = ctx;
|
||
const debouncedModuleUpdated = debounce(() => {
|
||
var _ref;
|
||
getViteRpcServer === null || getViteRpcServer === void 0 || (_ref = getViteRpcServer()) === null || _ref === void 0 || (_ref = _ref.broadcast) === null || _ref === void 0 || _ref.emit("graphModuleUpdated");
|
||
}, 100);
|
||
server.middlewares.use((_, __, next) => {
|
||
debouncedModuleUpdated();
|
||
next();
|
||
});
|
||
return { async getGraphModules() {
|
||
const meta = await rpc.getMetadata();
|
||
const modules = (meta ? await rpc.getModulesList({
|
||
vite: meta === null || meta === void 0 ? void 0 : meta.instances[0].vite,
|
||
env: meta === null || meta === void 0 ? void 0 : meta.instances[0].environments[0]
|
||
}) : null) || [];
|
||
const filteredModules = modules.filter((m) => {
|
||
return m.id.match(/\.(vue|js|ts|jsx|tsx|html|json)($|\?v=)/);
|
||
});
|
||
return filteredModules.map((i) => {
|
||
function searchForVueDeps(id, seen = /* @__PURE__ */ new Set()) {
|
||
if (seen.has(id)) return [];
|
||
seen.add(id);
|
||
const module$1 = modules.find((m) => m.id === id);
|
||
if (!module$1) return [];
|
||
return module$1.deps.flatMap((i$1) => {
|
||
if (filteredModules.find((m) => m.id === i$1)) return [i$1];
|
||
return searchForVueDeps(i$1, seen);
|
||
});
|
||
}
|
||
return {
|
||
id: i.id,
|
||
deps: searchForVueDeps(i.id)
|
||
};
|
||
});
|
||
} };
|
||
}
|
||
|
||
//#endregion
|
||
//#region src/rpc/index.ts
|
||
function getRpcFunctions(ctx) {
|
||
return {
|
||
heartbeat() {
|
||
return true;
|
||
},
|
||
...getAssetsFunctions(ctx),
|
||
...getConfigFunctions(ctx),
|
||
...getGraphFunctions(ctx)
|
||
};
|
||
}
|
||
|
||
//#endregion
|
||
//#region src/utils.ts
|
||
function removeUrlQuery(url) {
|
||
return url.replace(/\?.*$/, "");
|
||
}
|
||
|
||
//#endregion
|
||
//#region src/vite.ts
|
||
function getVueDevtoolsPath() {
|
||
return normalizePath(path.dirname(fileURLToPath(import.meta.url))).replace(/\/dist$/, "//src");
|
||
}
|
||
const toggleComboKeysMap = {
|
||
option: process.platform === "darwin" ? "Option(⌥)" : "Alt(⌥)",
|
||
meta: "Command(⌘)",
|
||
shift: "Shift(⇧)"
|
||
};
|
||
function normalizeComboKeyPrint(toggleComboKey) {
|
||
return toggleComboKey.split("-").map((key) => toggleComboKeysMap[key] || key[0].toUpperCase() + key.slice(1)).join(dim("+"));
|
||
}
|
||
const devtoolsNextResourceSymbol = "?__vue-devtools-next-resource";
|
||
const defaultOptions = {
|
||
appendTo: "",
|
||
componentInspector: true,
|
||
launchEditor: process.env.LAUNCH_EDITOR ?? "code"
|
||
};
|
||
function mergeOptions(options$1) {
|
||
return Object.assign({}, defaultOptions, options$1);
|
||
}
|
||
function VitePluginVueDevTools(options$1) {
|
||
const vueDevtoolsPath = getVueDevtoolsPath();
|
||
const inspect = Inspect({ silent: true });
|
||
const pluginOptions = mergeOptions(options$1 ?? {});
|
||
let config;
|
||
function configureServer(server) {
|
||
const base = server.config.base || "/";
|
||
server.middlewares.use(`${base}__devtools__`, sirv(DIR_CLIENT, {
|
||
single: true,
|
||
dev: true,
|
||
setHeaders(response) {
|
||
if (config.server.headers == null) return;
|
||
Object.entries(config.server.headers).forEach(([key, value]) => {
|
||
if (value == null) return;
|
||
response.setHeader(key, value);
|
||
});
|
||
}
|
||
}));
|
||
setViteServerContext(server);
|
||
createViteServerRpc(getRpcFunctions({
|
||
rpc: inspect.api.rpc,
|
||
server,
|
||
config
|
||
}));
|
||
const _printUrls = server.printUrls;
|
||
const colorUrl = (url) => cyan(url.replace(/:(\d+)\//, (_, port) => `:${bold(port)}/`));
|
||
server.printUrls = () => {
|
||
const urls = server.resolvedUrls;
|
||
const keys$1 = normalizeComboKeyPrint("option-shift-d");
|
||
_printUrls();
|
||
for (const url of urls.local) {
|
||
const devtoolsUrl = url.endsWith("/") ? `${url}__devtools__/` : `${url}/__devtools__/`;
|
||
console.log(` ${green("➜")} ${bold("Vue DevTools")}: ${green(`Open ${colorUrl(`${devtoolsUrl}`)} as a separate window`)}`);
|
||
}
|
||
console.log(` ${green("➜")} ${bold("Vue DevTools")}: ${green(`Press ${yellow(keys$1)} in App to toggle the Vue DevTools`)}`);
|
||
};
|
||
}
|
||
const devtoolsOptionsImportee = "virtual:vue-devtools-options";
|
||
const resolvedDevtoolsOptions = `\0${devtoolsOptionsImportee}`;
|
||
const plugin = {
|
||
name: "vite-plugin-vue-devtools",
|
||
enforce: "pre",
|
||
apply: "serve",
|
||
configResolved(resolvedConfig) {
|
||
config = resolvedConfig;
|
||
},
|
||
configureServer(server) {
|
||
configureServer(server);
|
||
},
|
||
async resolveId(importee) {
|
||
if (importee === devtoolsOptionsImportee) return resolvedDevtoolsOptions;
|
||
else if (importee.startsWith("virtual:vue-devtools-path:")) return `${importee.replace("virtual:vue-devtools-path:", `${vueDevtoolsPath}/`)}${devtoolsNextResourceSymbol}`;
|
||
},
|
||
async load(id) {
|
||
if (id === resolvedDevtoolsOptions) return `export default ${JSON.stringify({
|
||
base: config.base,
|
||
componentInspector: pluginOptions.componentInspector
|
||
})}`;
|
||
else if (id.endsWith(devtoolsNextResourceSymbol)) {
|
||
const filename = removeUrlQuery(id);
|
||
return await fs.promises.readFile(filename, "utf-8");
|
||
}
|
||
},
|
||
transform(code, id, options$2) {
|
||
if (options$2 === null || options$2 === void 0 ? void 0 : options$2.ssr) return;
|
||
const { appendTo } = pluginOptions;
|
||
const [filename] = id.split("?", 2);
|
||
if (appendTo && (typeof appendTo === "string" && filename.endsWith(appendTo) || appendTo instanceof RegExp && appendTo.test(filename))) code = `import 'virtual:vue-devtools-path:overlay.js';\n${code}`;
|
||
return code;
|
||
},
|
||
transformIndexHtml(html) {
|
||
if (pluginOptions.appendTo) return;
|
||
return {
|
||
html,
|
||
tags: [{
|
||
tag: "script",
|
||
injectTo: "head-prepend",
|
||
attrs: {
|
||
type: "module",
|
||
src: `${config.base || "/"}@id/virtual:vue-devtools-path:overlay.js`
|
||
}
|
||
}, pluginOptions.componentInspector && {
|
||
tag: "script",
|
||
injectTo: "head-prepend",
|
||
launchEditor: pluginOptions.launchEditor,
|
||
attrs: {
|
||
type: "module",
|
||
src: `${config.base || "/"}@id/virtual:vue-inspector-path:load.js`
|
||
}
|
||
}].filter(Boolean)
|
||
};
|
||
},
|
||
async buildEnd() {}
|
||
};
|
||
return [
|
||
inspect,
|
||
pluginOptions.componentInspector && VueInspector({
|
||
toggleComboKey: "",
|
||
toggleButtonVisibility: "never",
|
||
launchEditor: pluginOptions.launchEditor,
|
||
...typeof pluginOptions.componentInspector === "boolean" ? {} : pluginOptions.componentInspector,
|
||
appendTo: pluginOptions.appendTo || "manually"
|
||
}),
|
||
plugin
|
||
].filter(Boolean);
|
||
}
|
||
|
||
//#endregion
|
||
export { VitePluginVueDevTools as default }; |