Files
url_tracker_tool/node_modules/@prisma/fetch-engine/dist/chunk-QLWYUM7O.js
Andrei 58f8093689 Rebrand from 'Redirect Intelligence v2' to 'URL Tracker Tool V2' throughout UI
- Updated all component headers and documentation
- Changed navbar and footer branding
- Updated homepage hero badge
- Modified page title in index.html
- Simplified footer text to 'Built with ❤️'
- Consistent V2 capitalization across all references
2025-08-19 19:12:23 +00:00

8154 lines
281 KiB
JavaScript

"use strict";
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 __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var chunk_QLWYUM7O_exports = {};
__export(chunk_QLWYUM7O_exports, {
downloadZip: () => downloadZip,
require_is_stream: () => require_is_stream,
require_temp_dir: () => require_temp_dir
});
module.exports = __toCommonJS(chunk_QLWYUM7O_exports);
var import_chunk_VTJS2JJN = require("./chunk-VTJS2JJN.js");
var import_chunk_RGVHWUUH = require("./chunk-RGVHWUUH.js");
var import_chunk_FQ2BOR66 = require("./chunk-FQ2BOR66.js");
var import_chunk_KDPLGCY6 = require("./chunk-KDPLGCY6.js");
var import_chunk_AH6QHEOA = require("./chunk-AH6QHEOA.js");
var import_debug = __toESM(require("@prisma/debug"));
var import_fs = __toESM(require("fs"));
var import_http = __toESM(require("http"));
var import_https = __toESM(require("https"));
var import_zlib = __toESM(require("zlib"));
var import_stream = __toESM(require("stream"));
var import_buffer = require("buffer");
var import_stream2 = __toESM(require("stream"));
var import_util = require("util");
var import_buffer2 = require("buffer");
var import_util2 = require("util");
var import_http2 = __toESM(require("http"));
var import_url = require("url");
var import_util3 = require("util");
var import_net = require("net");
var import_path = __toESM(require("path"));
var import_util4 = require("util");
var import_zlib2 = __toESM(require("zlib"));
var require_is_stream = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/is-stream@2.0.1/node_modules/is-stream/index.js"(exports, module2) {
"use strict";
var isStream = (stream) => stream !== null && typeof stream === "object" && typeof stream.pipe === "function";
isStream.writable = (stream) => isStream(stream) && stream.writable !== false && typeof stream._write === "function" && typeof stream._writableState === "object";
isStream.readable = (stream) => isStream(stream) && stream.readable !== false && typeof stream._read === "function" && typeof stream._readableState === "object";
isStream.duplex = (stream) => isStream.writable(stream) && isStream.readable(stream);
isStream.transform = (stream) => isStream.duplex(stream) && typeof stream._transform === "function";
module2.exports = isStream;
}
});
var require_hasha = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/hasha@5.2.2/node_modules/hasha/index.js"(exports, module2) {
"use strict";
var fs2 = (0, import_chunk_AH6QHEOA.__require)("fs");
var path2 = (0, import_chunk_AH6QHEOA.__require)("path");
var crypto = (0, import_chunk_AH6QHEOA.__require)("crypto");
var isStream = require_is_stream();
var { Worker } = (() => {
try {
return (0, import_chunk_AH6QHEOA.__require)("worker_threads");
} catch (_) {
return {};
}
})();
var worker;
var taskIdCounter = 0;
var tasks = /* @__PURE__ */ new Map();
var recreateWorkerError = (sourceError) => {
const error = new Error(sourceError.message);
for (const [key, value] of Object.entries(sourceError)) {
if (key !== "message") {
error[key] = value;
}
}
return error;
};
var createWorker = () => {
worker = new Worker(path2.join(__dirname, "thread.js"));
worker.on("message", (message) => {
const task = tasks.get(message.id);
tasks.delete(message.id);
if (tasks.size === 0) {
worker.unref();
}
if (message.error === void 0) {
task.resolve(message.value);
} else {
task.reject(recreateWorkerError(message.error));
}
});
worker.on("error", (error) => {
throw error;
});
};
var taskWorker = (method, args, transferList) => new Promise((resolve, reject) => {
const id = taskIdCounter++;
tasks.set(id, { resolve, reject });
if (worker === void 0) {
createWorker();
}
worker.ref();
worker.postMessage({ id, method, args }, transferList);
});
var hasha2 = (input, options = {}) => {
let outputEncoding = options.encoding || "hex";
if (outputEncoding === "buffer") {
outputEncoding = void 0;
}
const hash = crypto.createHash(options.algorithm || "sha512");
const update = (buffer) => {
const inputEncoding = typeof buffer === "string" ? "utf8" : void 0;
hash.update(buffer, inputEncoding);
};
if (Array.isArray(input)) {
input.forEach(update);
} else {
update(input);
}
return hash.digest(outputEncoding);
};
hasha2.stream = (options = {}) => {
let outputEncoding = options.encoding || "hex";
if (outputEncoding === "buffer") {
outputEncoding = void 0;
}
const stream = crypto.createHash(options.algorithm || "sha512");
stream.setEncoding(outputEncoding);
return stream;
};
hasha2.fromStream = async (stream, options = {}) => {
if (!isStream(stream)) {
throw new TypeError("Expected a stream");
}
return new Promise((resolve, reject) => {
stream.on("error", reject).pipe(hasha2.stream(options)).on("error", reject).on("finish", function() {
resolve(this.read());
});
});
};
if (Worker === void 0) {
hasha2.fromFile = async (filePath, options) => hasha2.fromStream(fs2.createReadStream(filePath), options);
hasha2.async = async (input, options) => hasha2(input, options);
} else {
hasha2.fromFile = async (filePath, { algorithm = "sha512", encoding = "hex" } = {}) => {
const hash = await taskWorker("hashFile", [algorithm, filePath]);
if (encoding === "buffer") {
return Buffer.from(hash);
}
return Buffer.from(hash).toString(encoding);
};
hasha2.async = async (input, { algorithm = "sha512", encoding = "hex" } = {}) => {
if (encoding === "buffer") {
encoding = void 0;
}
const hash = await taskWorker("hash", [algorithm, input]);
if (encoding === void 0) {
return Buffer.from(hash);
}
return Buffer.from(hash).toString(encoding);
};
}
hasha2.fromFileSync = (filePath, options) => hasha2(fs2.readFileSync(filePath), options);
module2.exports = hasha2;
}
});
var require_retry_operation = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js"(exports, module2) {
"use strict";
function RetryOperation(timeouts, options) {
if (typeof options === "boolean") {
options = { forever: options };
}
this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
this._timeouts = timeouts;
this._options = options || {};
this._maxRetryTime = options && options.maxRetryTime || Infinity;
this._fn = null;
this._errors = [];
this._attempts = 1;
this._operationTimeout = null;
this._operationTimeoutCb = null;
this._timeout = null;
this._operationStart = null;
this._timer = null;
if (this._options.forever) {
this._cachedTimeouts = this._timeouts.slice(0);
}
}
module2.exports = RetryOperation;
RetryOperation.prototype.reset = function() {
this._attempts = 1;
this._timeouts = this._originalTimeouts.slice(0);
};
RetryOperation.prototype.stop = function() {
if (this._timeout) {
clearTimeout(this._timeout);
}
if (this._timer) {
clearTimeout(this._timer);
}
this._timeouts = [];
this._cachedTimeouts = null;
};
RetryOperation.prototype.retry = function(err) {
if (this._timeout) {
clearTimeout(this._timeout);
}
if (!err) {
return false;
}
var currentTime = (/* @__PURE__ */ new Date()).getTime();
if (err && currentTime - this._operationStart >= this._maxRetryTime) {
this._errors.push(err);
this._errors.unshift(new Error("RetryOperation timeout occurred"));
return false;
}
this._errors.push(err);
var timeout = this._timeouts.shift();
if (timeout === void 0) {
if (this._cachedTimeouts) {
this._errors.splice(0, this._errors.length - 1);
timeout = this._cachedTimeouts.slice(-1);
} else {
return false;
}
}
var self = this;
this._timer = setTimeout(function() {
self._attempts++;
if (self._operationTimeoutCb) {
self._timeout = setTimeout(function() {
self._operationTimeoutCb(self._attempts);
}, self._operationTimeout);
if (self._options.unref) {
self._timeout.unref();
}
}
self._fn(self._attempts);
}, timeout);
if (this._options.unref) {
this._timer.unref();
}
return true;
};
RetryOperation.prototype.attempt = function(fn, timeoutOps) {
this._fn = fn;
if (timeoutOps) {
if (timeoutOps.timeout) {
this._operationTimeout = timeoutOps.timeout;
}
if (timeoutOps.cb) {
this._operationTimeoutCb = timeoutOps.cb;
}
}
var self = this;
if (this._operationTimeoutCb) {
this._timeout = setTimeout(function() {
self._operationTimeoutCb();
}, self._operationTimeout);
}
this._operationStart = (/* @__PURE__ */ new Date()).getTime();
this._fn(this._attempts);
};
RetryOperation.prototype.try = function(fn) {
console.log("Using RetryOperation.try() is deprecated");
this.attempt(fn);
};
RetryOperation.prototype.start = function(fn) {
console.log("Using RetryOperation.start() is deprecated");
this.attempt(fn);
};
RetryOperation.prototype.start = RetryOperation.prototype.try;
RetryOperation.prototype.errors = function() {
return this._errors;
};
RetryOperation.prototype.attempts = function() {
return this._attempts;
};
RetryOperation.prototype.mainError = function() {
if (this._errors.length === 0) {
return null;
}
var counts = {};
var mainError = null;
var mainErrorCount = 0;
for (var i = 0; i < this._errors.length; i++) {
var error = this._errors[i];
var message = error.message;
var count = (counts[message] || 0) + 1;
counts[message] = count;
if (count >= mainErrorCount) {
mainError = error;
mainErrorCount = count;
}
}
return mainError;
};
}
});
var require_retry = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js"(exports) {
"use strict";
var RetryOperation = require_retry_operation();
exports.operation = function(options) {
var timeouts = exports.timeouts(options);
return new RetryOperation(timeouts, {
forever: options && (options.forever || options.retries === Infinity),
unref: options && options.unref,
maxRetryTime: options && options.maxRetryTime
});
};
exports.timeouts = function(options) {
if (options instanceof Array) {
return [].concat(options);
}
var opts = {
retries: 10,
factor: 2,
minTimeout: 1 * 1e3,
maxTimeout: Infinity,
randomize: false
};
for (var key in options) {
opts[key] = options[key];
}
if (opts.minTimeout > opts.maxTimeout) {
throw new Error("minTimeout is greater than maxTimeout");
}
var timeouts = [];
for (var i = 0; i < opts.retries; i++) {
timeouts.push(this.createTimeout(i, opts));
}
if (options && options.forever && !timeouts.length) {
timeouts.push(this.createTimeout(i, opts));
}
timeouts.sort(function(a, b) {
return a - b;
});
return timeouts;
};
exports.createTimeout = function(attempt, opts) {
var random = opts.randomize ? Math.random() + 1 : 1;
var timeout = Math.round(random * Math.max(opts.minTimeout, 1) * Math.pow(opts.factor, attempt));
timeout = Math.min(timeout, opts.maxTimeout);
return timeout;
};
exports.wrap = function(obj, options, methods) {
if (options instanceof Array) {
methods = options;
options = null;
}
if (!methods) {
methods = [];
for (var key in obj) {
if (typeof obj[key] === "function") {
methods.push(key);
}
}
}
for (var i = 0; i < methods.length; i++) {
var method = methods[i];
var original = obj[method];
obj[method] = function retryWrapper(original2) {
var op = exports.operation(options);
var args = Array.prototype.slice.call(arguments, 1);
var callback = args.pop();
args.push(function(err) {
if (op.retry(err)) {
return;
}
if (err) {
arguments[0] = op.mainError();
}
callback.apply(this, arguments);
});
op.attempt(function() {
original2.apply(obj, args);
});
}.bind(obj, original);
obj[method].options = options;
}
};
}
});
var require_retry2 = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js"(exports, module2) {
"use strict";
module2.exports = require_retry();
}
});
var require_p_retry = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/p-retry@4.6.2/node_modules/p-retry/index.js"(exports, module2) {
"use strict";
var retry2 = require_retry2();
var networkErrorMsgs = [
"Failed to fetch",
// Chrome
"NetworkError when attempting to fetch resource.",
// Firefox
"The Internet connection appears to be offline.",
// Safari
"Network request failed"
// `cross-fetch`
];
var AbortError2 = class extends Error {
constructor(message) {
super();
if (message instanceof Error) {
this.originalError = message;
({ message } = message);
} else {
this.originalError = new Error(message);
this.originalError.stack = this.stack;
}
this.name = "AbortError";
this.message = message;
}
};
var decorateErrorWithCounts = (error, attemptNumber, options) => {
const retriesLeft = options.retries - (attemptNumber - 1);
error.attemptNumber = attemptNumber;
error.retriesLeft = retriesLeft;
return error;
};
var isNetworkError = (errorMessage) => networkErrorMsgs.includes(errorMessage);
var pRetry = (input, options) => new Promise((resolve, reject) => {
options = {
onFailedAttempt: () => {
},
retries: 10,
...options
};
const operation = retry2.operation(options);
operation.attempt(async (attemptNumber) => {
try {
resolve(await input(attemptNumber));
} catch (error) {
if (!(error instanceof Error)) {
reject(new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`));
return;
}
if (error instanceof AbortError2) {
operation.stop();
reject(error.originalError);
} else if (error instanceof TypeError && !isNetworkError(error.message)) {
operation.stop();
reject(error);
} else {
decorateErrorWithCounts(error, attemptNumber, options);
try {
await options.onFailedAttempt(error);
} catch (error2) {
reject(error2);
return;
}
if (!operation.retry(error)) {
reject(operation.mainError());
}
}
}
});
});
module2.exports = pRetry;
module2.exports.default = pRetry;
module2.exports.AbortError = AbortError2;
}
});
var require_crypto_random_string = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/crypto-random-string@2.0.0/node_modules/crypto-random-string/index.js"(exports, module2) {
"use strict";
var crypto = (0, import_chunk_AH6QHEOA.__require)("crypto");
module2.exports = (length) => {
if (!Number.isFinite(length)) {
throw new TypeError("Expected a finite number");
}
return crypto.randomBytes(Math.ceil(length / 2)).toString("hex").slice(0, length);
};
}
});
var require_unique_string = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/unique-string@2.0.0/node_modules/unique-string/index.js"(exports, module2) {
"use strict";
var cryptoRandomString = require_crypto_random_string();
module2.exports = () => cryptoRandomString(32);
}
});
var require_temp_dir = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/temp-dir@2.0.0/node_modules/temp-dir/index.js"(exports, module2) {
"use strict";
var fs2 = (0, import_chunk_AH6QHEOA.__require)("fs");
var os = (0, import_chunk_AH6QHEOA.__require)("os");
var tempDirectorySymbol = Symbol.for("__RESOLVED_TEMP_DIRECTORY__");
if (!global[tempDirectorySymbol]) {
Object.defineProperty(global, tempDirectorySymbol, {
value: fs2.realpathSync(os.tmpdir())
});
}
module2.exports = global[tempDirectorySymbol];
}
});
var require_array_union = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/array-union@2.1.0/node_modules/array-union/index.js"(exports, module2) {
"use strict";
module2.exports = (...arguments_) => {
return [...new Set([].concat(...arguments_))];
};
}
});
var require_merge2 = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/merge2@1.4.1/node_modules/merge2/index.js"(exports, module2) {
"use strict";
var Stream3 = (0, import_chunk_AH6QHEOA.__require)("stream");
var PassThrough3 = Stream3.PassThrough;
var slice = Array.prototype.slice;
module2.exports = merge2;
function merge2() {
const streamsQueue = [];
const args = slice.call(arguments);
let merging = false;
let options = args[args.length - 1];
if (options && !Array.isArray(options) && options.pipe == null) {
args.pop();
} else {
options = {};
}
const doEnd = options.end !== false;
const doPipeError = options.pipeError === true;
if (options.objectMode == null) {
options.objectMode = true;
}
if (options.highWaterMark == null) {
options.highWaterMark = 64 * 1024;
}
const mergedStream = PassThrough3(options);
function addStream() {
for (let i = 0, len = arguments.length; i < len; i++) {
streamsQueue.push(pauseStreams(arguments[i], options));
}
mergeStream();
return this;
}
function mergeStream() {
if (merging) {
return;
}
merging = true;
let streams = streamsQueue.shift();
if (!streams) {
process.nextTick(endStream);
return;
}
if (!Array.isArray(streams)) {
streams = [streams];
}
let pipesCount = streams.length + 1;
function next() {
if (--pipesCount > 0) {
return;
}
merging = false;
mergeStream();
}
function pipe(stream) {
function onend() {
stream.removeListener("merge2UnpipeEnd", onend);
stream.removeListener("end", onend);
if (doPipeError) {
stream.removeListener("error", onerror);
}
next();
}
function onerror(err) {
mergedStream.emit("error", err);
}
if (stream._readableState.endEmitted) {
return next();
}
stream.on("merge2UnpipeEnd", onend);
stream.on("end", onend);
if (doPipeError) {
stream.on("error", onerror);
}
stream.pipe(mergedStream, { end: false });
stream.resume();
}
for (let i = 0; i < streams.length; i++) {
pipe(streams[i]);
}
next();
}
function endStream() {
merging = false;
mergedStream.emit("queueDrain");
if (doEnd) {
mergedStream.end();
}
}
mergedStream.setMaxListeners(0);
mergedStream.add = addStream;
mergedStream.on("unpipe", function(stream) {
stream.emit("merge2UnpipeEnd");
});
if (args.length) {
addStream.apply(null, args);
}
return mergedStream;
}
function pauseStreams(streams, options) {
if (!Array.isArray(streams)) {
if (!streams._readableState && streams.pipe) {
streams = streams.pipe(PassThrough3(options));
}
if (!streams._readableState || !streams.pause || !streams.pipe) {
throw new Error("Only readable stream can be merged.");
}
streams.pause();
} else {
for (let i = 0, len = streams.length; i < len; i++) {
streams[i] = pauseStreams(streams[i], options);
}
}
return streams;
}
}
});
var require_array = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/fast-glob@3.3.2/node_modules/fast-glob/out/utils/array.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.splitWhen = exports.flatten = void 0;
function flatten(items) {
return items.reduce((collection, item) => [].concat(collection, item), []);
}
exports.flatten = flatten;
function splitWhen(items, predicate) {
const result = [[]];
let groupIndex = 0;
for (const item of items) {
if (predicate(item)) {
groupIndex++;
result[groupIndex] = [];
} else {
result[groupIndex].push(item);
}
}
return result;
}
exports.splitWhen = splitWhen;
}
});
var require_errno = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/fast-glob@3.3.2/node_modules/fast-glob/out/utils/errno.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isEnoentCodeError = void 0;
function isEnoentCodeError(error) {
return error.code === "ENOENT";
}
exports.isEnoentCodeError = isEnoentCodeError;
}
});
var require_fs = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/fast-glob@3.3.2/node_modules/fast-glob/out/utils/fs.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createDirentFromStats = void 0;
var DirentFromStats = class {
constructor(name, stats) {
this.name = name;
this.isBlockDevice = stats.isBlockDevice.bind(stats);
this.isCharacterDevice = stats.isCharacterDevice.bind(stats);
this.isDirectory = stats.isDirectory.bind(stats);
this.isFIFO = stats.isFIFO.bind(stats);
this.isFile = stats.isFile.bind(stats);
this.isSocket = stats.isSocket.bind(stats);
this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
}
};
function createDirentFromStats(name, stats) {
return new DirentFromStats(name, stats);
}
exports.createDirentFromStats = createDirentFromStats;
}
});
var require_path = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/fast-glob@3.3.2/node_modules/fast-glob/out/utils/path.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.convertPosixPathToPattern = exports.convertWindowsPathToPattern = exports.convertPathToPattern = exports.escapePosixPath = exports.escapeWindowsPath = exports.escape = exports.removeLeadingDotSegment = exports.makeAbsolute = exports.unixify = void 0;
var os = (0, import_chunk_AH6QHEOA.__require)("os");
var path2 = (0, import_chunk_AH6QHEOA.__require)("path");
var IS_WINDOWS_PLATFORM = os.platform() === "win32";
var LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2;
var POSIX_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g;
var WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()[\]{}]|^!|[!+@](?=\())/g;
var DOS_DEVICE_PATH_RE = /^\\\\([.?])/;
var WINDOWS_BACKSLASHES_RE = /\\(?![!()+@[\]{}])/g;
function unixify(filepath) {
return filepath.replace(/\\/g, "/");
}
exports.unixify = unixify;
function makeAbsolute(cwd, filepath) {
return path2.resolve(cwd, filepath);
}
exports.makeAbsolute = makeAbsolute;
function removeLeadingDotSegment(entry) {
if (entry.charAt(0) === ".") {
const secondCharactery = entry.charAt(1);
if (secondCharactery === "/" || secondCharactery === "\\") {
return entry.slice(LEADING_DOT_SEGMENT_CHARACTERS_COUNT);
}
}
return entry;
}
exports.removeLeadingDotSegment = removeLeadingDotSegment;
exports.escape = IS_WINDOWS_PLATFORM ? escapeWindowsPath : escapePosixPath;
function escapeWindowsPath(pattern) {
return pattern.replace(WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE, "\\$2");
}
exports.escapeWindowsPath = escapeWindowsPath;
function escapePosixPath(pattern) {
return pattern.replace(POSIX_UNESCAPED_GLOB_SYMBOLS_RE, "\\$2");
}
exports.escapePosixPath = escapePosixPath;
exports.convertPathToPattern = IS_WINDOWS_PLATFORM ? convertWindowsPathToPattern : convertPosixPathToPattern;
function convertWindowsPathToPattern(filepath) {
return escapeWindowsPath(filepath).replace(DOS_DEVICE_PATH_RE, "//$1").replace(WINDOWS_BACKSLASHES_RE, "/");
}
exports.convertWindowsPathToPattern = convertWindowsPathToPattern;
function convertPosixPathToPattern(filepath) {
return escapePosixPath(filepath);
}
exports.convertPosixPathToPattern = convertPosixPathToPattern;
}
});
var require_is_extglob = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/is-extglob@2.1.1/node_modules/is-extglob/index.js"(exports, module2) {
"use strict";
module2.exports = function isExtglob(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;
};
}
});
var require_is_glob = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/is-glob@4.0.3/node_modules/is-glob/index.js"(exports, module2) {
"use strict";
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;
};
module2.exports = function isGlob(str, options) {
if (typeof str !== "string" || str === "") {
return false;
}
if (isExtglob(str)) {
return true;
}
var check = strictCheck;
if (options && options.strict === false) {
check = relaxedCheck;
}
return check(str);
};
}
});
var require_glob_parent = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/glob-parent@5.1.2/node_modules/glob-parent/index.js"(exports, module2) {
"use strict";
var isGlob = require_is_glob();
var pathPosixDirname = (0, import_chunk_AH6QHEOA.__require)("path").posix.dirname;
var isWin32 = (0, import_chunk_AH6QHEOA.__require)("os").platform() === "win32";
var slash = "/";
var backslash = /\\/g;
var enclosure = /[\{\[].*[\}\]]$/;
var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/;
var escaped = /\\([\!\*\?\|\[\]\(\)\{\}])/g;
module2.exports = function globParent(str, opts) {
var options = Object.assign({ flipBackslashes: true }, opts);
if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) {
str = str.replace(backslash, slash);
}
if (enclosure.test(str)) {
str += slash;
}
str += "a";
do {
str = pathPosixDirname(str);
} while (isGlob(str) || globby.test(str));
return str.replace(escaped, "$1");
};
}
});
var require_utils = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/braces@3.0.2/node_modules/braces/lib/utils.js"(exports) {
"use strict";
exports.isInteger = (num) => {
if (typeof num === "number") {
return Number.isInteger(num);
}
if (typeof num === "string" && num.trim() !== "") {
return Number.isInteger(Number(num));
}
return false;
};
exports.find = (node, type) => node.nodes.find((node2) => node2.type === type);
exports.exceedsLimit = (min, max, step = 1, limit) => {
if (limit === false) return false;
if (!exports.isInteger(min) || !exports.isInteger(max)) return false;
return (Number(max) - Number(min)) / Number(step) >= limit;
};
exports.escapeNode = (block, n = 0, type) => {
let node = block.nodes[n];
if (!node) return;
if (type && node.type === type || node.type === "open" || node.type === "close") {
if (node.escaped !== true) {
node.value = "\\" + node.value;
node.escaped = true;
}
}
};
exports.encloseBrace = (node) => {
if (node.type !== "brace") return false;
if (node.commas >> 0 + node.ranges >> 0 === 0) {
node.invalid = true;
return true;
}
return false;
};
exports.isInvalidBrace = (block) => {
if (block.type !== "brace") return false;
if (block.invalid === true || block.dollar) return true;
if (block.commas >> 0 + block.ranges >> 0 === 0) {
block.invalid = true;
return true;
}
if (block.open !== true || block.close !== true) {
block.invalid = true;
return true;
}
return false;
};
exports.isOpenOrClose = (node) => {
if (node.type === "open" || node.type === "close") {
return true;
}
return node.open === true || node.close === true;
};
exports.reduce = (nodes) => nodes.reduce((acc, node) => {
if (node.type === "text") acc.push(node.value);
if (node.type === "range") node.type = "text";
return acc;
}, []);
exports.flatten = (...args) => {
const result = [];
const flat = (arr) => {
for (let i = 0; i < arr.length; i++) {
let ele = arr[i];
Array.isArray(ele) ? flat(ele, result) : ele !== void 0 && result.push(ele);
}
return result;
};
flat(args);
return result;
};
}
});
var require_stringify = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/braces@3.0.2/node_modules/braces/lib/stringify.js"(exports, module2) {
"use strict";
var utils = require_utils();
module2.exports = (ast, options = {}) => {
let stringify = (node, parent = {}) => {
let invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent);
let invalidNode = node.invalid === true && options.escapeInvalid === true;
let output = "";
if (node.value) {
if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) {
return "\\" + node.value;
}
return node.value;
}
if (node.value) {
return node.value;
}
if (node.nodes) {
for (let child of node.nodes) {
output += stringify(child);
}
}
return output;
};
return stringify(ast);
};
}
});
var require_is_number = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/is-number@7.0.0/node_modules/is-number/index.js"(exports, module2) {
"use strict";
module2.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;
};
}
});
var require_to_regex_range = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/to-regex-range@5.0.1/node_modules/to-regex-range/index.js"(exports, module2) {
"use strict";
var isNumber = require_is_number();
var toRegexRange = (min, max, options) => {
if (isNumber(min) === false) {
throw new TypeError("toRegexRange: expected the first argument to be a number");
}
if (max === void 0 || min === max) {
return String(min);
}
if (isNumber(max) === false) {
throw new TypeError("toRegexRange: expected the second argument to be a number.");
}
let opts = { relaxZeros: true, ...options };
if (typeof opts.strictZeros === "boolean") {
opts.relaxZeros = opts.strictZeros === false;
}
let relax = String(opts.relaxZeros);
let shorthand = String(opts.shorthand);
let capture = String(opts.capture);
let wrap = String(opts.wrap);
let cacheKey = min + ":" + max + "=" + relax + shorthand + capture + wrap;
if (toRegexRange.cache.hasOwnProperty(cacheKey)) {
return toRegexRange.cache[cacheKey].result;
}
let a = Math.min(min, max);
let b = Math.max(min, max);
if (Math.abs(a - b) === 1) {
let result = min + "|" + max;
if (opts.capture) {
return `(${result})`;
}
if (opts.wrap === false) {
return result;
}
return `(?:${result})`;
}
let isPadded = hasPadding(min) || hasPadding(max);
let state = { min, max, a, b };
let positives = [];
let negatives = [];
if (isPadded) {
state.isPadded = isPadded;
state.maxLen = String(state.max).length;
}
if (a < 0) {
let newMin = b < 0 ? Math.abs(b) : 1;
negatives = splitToPatterns(newMin, Math.abs(a), state, opts);
a = state.a = 0;
}
if (b >= 0) {
positives = splitToPatterns(a, b, state, opts);
}
state.negatives = negatives;
state.positives = positives;
state.result = collatePatterns(negatives, positives, opts);
if (opts.capture === true) {
state.result = `(${state.result})`;
} else if (opts.wrap !== false && positives.length + negatives.length > 1) {
state.result = `(?:${state.result})`;
}
toRegexRange.cache[cacheKey] = state;
return state.result;
};
function collatePatterns(neg, pos, options) {
let onlyNegative = filterPatterns(neg, pos, "-", false, options) || [];
let onlyPositive = filterPatterns(pos, neg, "", false, options) || [];
let intersected = filterPatterns(neg, pos, "-?", true, options) || [];
let subpatterns = onlyNegative.concat(intersected).concat(onlyPositive);
return subpatterns.join("|");
}
function splitToRanges(min, max) {
let nines = 1;
let zeros = 1;
let stop = countNines(min, nines);
let stops = /* @__PURE__ */ new Set([max]);
while (min <= stop && stop <= max) {
stops.add(stop);
nines += 1;
stop = countNines(min, nines);
}
stop = countZeros(max + 1, zeros) - 1;
while (min < stop && stop <= max) {
stops.add(stop);
zeros += 1;
stop = countZeros(max + 1, zeros) - 1;
}
stops = [...stops];
stops.sort(compare);
return stops;
}
function rangeToPattern(start, stop, options) {
if (start === stop) {
return { pattern: start, count: [], digits: 0 };
}
let zipped = zip(start, stop);
let digits = zipped.length;
let pattern = "";
let count = 0;
for (let i = 0; i < digits; i++) {
let [startDigit, stopDigit] = zipped[i];
if (startDigit === stopDigit) {
pattern += startDigit;
} else if (startDigit !== "0" || stopDigit !== "9") {
pattern += toCharacterClass(startDigit, stopDigit, options);
} else {
count++;
}
}
if (count) {
pattern += options.shorthand === true ? "\\d" : "[0-9]";
}
return { pattern, count: [count], digits };
}
function splitToPatterns(min, max, tok, options) {
let ranges = splitToRanges(min, max);
let tokens = [];
let start = min;
let prev;
for (let i = 0; i < ranges.length; i++) {
let max2 = ranges[i];
let obj = rangeToPattern(String(start), String(max2), options);
let zeros = "";
if (!tok.isPadded && prev && prev.pattern === obj.pattern) {
if (prev.count.length > 1) {
prev.count.pop();
}
prev.count.push(obj.count[0]);
prev.string = prev.pattern + toQuantifier(prev.count);
start = max2 + 1;
continue;
}
if (tok.isPadded) {
zeros = padZeros(max2, tok, options);
}
obj.string = zeros + obj.pattern + toQuantifier(obj.count);
tokens.push(obj);
start = max2 + 1;
prev = obj;
}
return tokens;
}
function filterPatterns(arr, comparison, prefix, intersection, options) {
let result = [];
for (let ele of arr) {
let { string } = ele;
if (!intersection && !contains(comparison, "string", string)) {
result.push(prefix + string);
}
if (intersection && contains(comparison, "string", string)) {
result.push(prefix + string);
}
}
return result;
}
function zip(a, b) {
let arr = [];
for (let i = 0; i < a.length; i++) arr.push([a[i], b[i]]);
return arr;
}
function compare(a, b) {
return a > b ? 1 : b > a ? -1 : 0;
}
function contains(arr, key, val) {
return arr.some((ele) => ele[key] === val);
}
function countNines(min, len) {
return Number(String(min).slice(0, -len) + "9".repeat(len));
}
function countZeros(integer, zeros) {
return integer - integer % Math.pow(10, zeros);
}
function toQuantifier(digits) {
let [start = 0, stop = ""] = digits;
if (stop || start > 1) {
return `{${start + (stop ? "," + stop : "")}}`;
}
return "";
}
function toCharacterClass(a, b, options) {
return `[${a}${b - a === 1 ? "" : "-"}${b}]`;
}
function hasPadding(str) {
return /^-?(0+)\d/.test(str);
}
function padZeros(value, tok, options) {
if (!tok.isPadded) {
return value;
}
let diff = Math.abs(tok.maxLen - String(value).length);
let relax = options.relaxZeros !== false;
switch (diff) {
case 0:
return "";
case 1:
return relax ? "0?" : "0";
case 2:
return relax ? "0{0,2}" : "00";
default: {
return relax ? `0{0,${diff}}` : `0{${diff}}`;
}
}
}
toRegexRange.cache = {};
toRegexRange.clearCache = () => toRegexRange.cache = {};
module2.exports = toRegexRange;
}
});
var require_fill_range = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/fill-range@7.1.1/node_modules/fill-range/index.js"(exports, module2) {
"use strict";
var util = (0, import_chunk_AH6QHEOA.__require)("util");
var toRegexRange = require_to_regex_range();
var isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
var transform = (toNumber) => {
return (value) => toNumber === true ? Number(value) : String(value);
};
var isValidValue = (value) => {
return typeof value === "number" || typeof value === "string" && value !== "";
};
var isNumber = (num) => Number.isInteger(+num);
var zeros = (input) => {
let value = `${input}`;
let index = -1;
if (value[0] === "-") value = value.slice(1);
if (value === "0") return false;
while (value[++index] === "0") ;
return index > 0;
};
var stringify = (start, end, options) => {
if (typeof start === "string" || typeof end === "string") {
return true;
}
return options.stringify === true;
};
var pad = (input, maxLength, toNumber) => {
if (maxLength > 0) {
let dash = input[0] === "-" ? "-" : "";
if (dash) input = input.slice(1);
input = dash + input.padStart(dash ? maxLength - 1 : maxLength, "0");
}
if (toNumber === false) {
return String(input);
}
return input;
};
var toMaxLen = (input, maxLength) => {
let negative = input[0] === "-" ? "-" : "";
if (negative) {
input = input.slice(1);
maxLength--;
}
while (input.length < maxLength) input = "0" + input;
return negative ? "-" + input : input;
};
var toSequence = (parts, options, 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.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.wrap) {
return `(${prefix}${result})`;
}
return result;
};
var toRange = (a, b, isNumbers, options) => {
if (isNumbers) {
return toRegexRange(a, b, { wrap: false, ...options });
}
let start = String.fromCharCode(a);
if (a === b) return start;
let stop = String.fromCharCode(b);
return `[${start}-${stop}]`;
};
var toRegex = (start, end, options) => {
if (Array.isArray(start)) {
let wrap = options.wrap === true;
let prefix = options.capture ? "" : "?:";
return wrap ? `(${prefix}${start.join("|")})` : start.join("|");
}
return toRegexRange(start, end, options);
};
var rangeError = (...args) => {
return new RangeError("Invalid range arguments: " + util.inspect(...args));
};
var invalidRange = (start, end, options) => {
if (options.strictRanges === true) throw rangeError([start, end]);
return [];
};
var invalidStep = (step, options) => {
if (options.strictRanges === true) {
throw new TypeError(`Expected step "${step}" to be a number`);
}
return [];
};
var fillNumbers = (start, end, step = 1, options = {}) => {
let a = Number(start);
let b = Number(end);
if (!Number.isInteger(a) || !Number.isInteger(b)) {
if (options.strictRanges === true) throw rangeError([start, end]);
return [];
}
if (a === 0) a = 0;
if (b === 0) b = 0;
let descending = a > b;
let startString = String(start);
let endString = String(end);
let stepString = String(step);
step = Math.max(Math.abs(step), 1);
let padded = zeros(startString) || zeros(endString) || zeros(stepString);
let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0;
let toNumber = padded === false && stringify(start, end, options) === false;
let format = options.transform || transform(toNumber);
if (options.toRegex && step === 1) {
return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options);
}
let parts = { negatives: [], positives: [] };
let push = (num) => parts[num < 0 ? "negatives" : "positives"].push(Math.abs(num));
let range = [];
let index = 0;
while (descending ? a >= b : a <= b) {
if (options.toRegex === true && step > 1) {
push(a);
} else {
range.push(pad(format(a, index), maxLen, toNumber));
}
a = descending ? a - step : a + step;
index++;
}
if (options.toRegex === true) {
return step > 1 ? toSequence(parts, options, maxLen) : toRegex(range, null, { wrap: false, ...options });
}
return range;
};
var fillLetters = (start, end, step = 1, options = {}) => {
if (!isNumber(start) && start.length > 1 || !isNumber(end) && end.length > 1) {
return invalidRange(start, end, options);
}
let format = options.transform || ((val) => String.fromCharCode(val));
let a = `${start}`.charCodeAt(0);
let b = `${end}`.charCodeAt(0);
let descending = a > b;
let min = Math.min(a, b);
let max = Math.max(a, b);
if (options.toRegex && step === 1) {
return toRange(min, max, false, options);
}
let range = [];
let index = 0;
while (descending ? a >= b : a <= b) {
range.push(format(a, index));
a = descending ? a - step : a + step;
index++;
}
if (options.toRegex === true) {
return toRegex(range, null, { wrap: false, options });
}
return range;
};
var fill = (start, end, step, options = {}) => {
if (end == null && isValidValue(start)) {
return [start];
}
if (!isValidValue(start) || !isValidValue(end)) {
return invalidRange(start, end, options);
}
if (typeof step === "function") {
return fill(start, end, 1, { transform: step });
}
if (isObject(step)) {
return fill(start, end, 0, step);
}
let opts = { ...options };
if (opts.capture === true) opts.wrap = true;
step = step || opts.step || 1;
if (!isNumber(step)) {
if (step != null && !isObject(step)) return invalidStep(step, opts);
return fill(start, end, 1, step);
}
if (isNumber(start) && isNumber(end)) {
return fillNumbers(start, end, step, opts);
}
return fillLetters(start, end, Math.max(Math.abs(step), 1), opts);
};
module2.exports = fill;
}
});
var require_compile = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/braces@3.0.2/node_modules/braces/lib/compile.js"(exports, module2) {
"use strict";
var fill = require_fill_range();
var utils = require_utils();
var compile = (ast, options = {}) => {
let walk = (node, parent = {}) => {
let invalidBlock = utils.isInvalidBrace(parent);
let invalidNode = node.invalid === true && options.escapeInvalid === true;
let invalid = invalidBlock === true || invalidNode === true;
let prefix = options.escapeInvalid === true ? "\\" : "";
let output = "";
if (node.isOpen === true) {
return prefix + node.value;
}
if (node.isClose === true) {
return prefix + node.value;
}
if (node.type === "open") {
return invalid ? prefix + node.value : "(";
}
if (node.type === "close") {
return invalid ? prefix + node.value : ")";
}
if (node.type === "comma") {
return node.prev.type === "comma" ? "" : invalid ? node.value : "|";
}
if (node.value) {
return node.value;
}
if (node.nodes && node.ranges > 0) {
let args = utils.reduce(node.nodes);
let range = fill(...args, { ...options, wrap: false, toRegex: true });
if (range.length !== 0) {
return args.length > 1 && range.length > 1 ? `(${range})` : range;
}
}
if (node.nodes) {
for (let child of node.nodes) {
output += walk(child, node);
}
}
return output;
};
return walk(ast);
};
module2.exports = compile;
}
});
var require_expand = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/braces@3.0.2/node_modules/braces/lib/expand.js"(exports, module2) {
"use strict";
var fill = require_fill_range();
var stringify = require_stringify();
var utils = require_utils();
var append = (queue = "", stash = "", enclose = false) => {
let result = [];
queue = [].concat(queue);
stash = [].concat(stash);
if (!stash.length) return queue;
if (!queue.length) {
return enclose ? utils.flatten(stash).map((ele) => `{${ele}}`) : stash;
}
for (let item of queue) {
if (Array.isArray(item)) {
for (let value of item) {
result.push(append(value, stash, enclose));
}
} else {
for (let ele of stash) {
if (enclose === true && typeof ele === "string") ele = `{${ele}}`;
result.push(Array.isArray(ele) ? append(item, ele, enclose) : item + ele);
}
}
}
return utils.flatten(result);
};
var expand = (ast, options = {}) => {
let rangeLimit = options.rangeLimit === void 0 ? 1e3 : options.rangeLimit;
let walk = (node, parent = {}) => {
node.queue = [];
let p = parent;
let q = parent.queue;
while (p.type !== "brace" && p.type !== "root" && p.parent) {
p = p.parent;
q = p.queue;
}
if (node.invalid || node.dollar) {
q.push(append(q.pop(), stringify(node, options)));
return;
}
if (node.type === "brace" && node.invalid !== true && node.nodes.length === 2) {
q.push(append(q.pop(), ["{}"]));
return;
}
if (node.nodes && node.ranges > 0) {
let args = utils.reduce(node.nodes);
if (utils.exceedsLimit(...args, options.step, rangeLimit)) {
throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");
}
let range = fill(...args, options);
if (range.length === 0) {
range = stringify(node, options);
}
q.push(append(q.pop(), range));
node.nodes = [];
return;
}
let enclose = utils.encloseBrace(node);
let queue = node.queue;
let block = node;
while (block.type !== "brace" && block.type !== "root" && block.parent) {
block = block.parent;
queue = block.queue;
}
for (let i = 0; i < node.nodes.length; i++) {
let child = node.nodes[i];
if (child.type === "comma" && node.type === "brace") {
if (i === 1) queue.push("");
queue.push("");
continue;
}
if (child.type === "close") {
q.push(append(q.pop(), queue, enclose));
continue;
}
if (child.value && child.type !== "open") {
queue.push(append(queue.pop(), child.value));
continue;
}
if (child.nodes) {
walk(child, node);
}
}
return queue;
};
return utils.flatten(walk(ast));
};
module2.exports = expand;
}
});
var require_constants = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/braces@3.0.2/node_modules/braces/lib/constants.js"(exports, module2) {
"use strict";
module2.exports = {
MAX_LENGTH: 1024 * 64,
// Digits
CHAR_0: "0",
/* 0 */
CHAR_9: "9",
/* 9 */
// Alphabet chars.
CHAR_UPPERCASE_A: "A",
/* A */
CHAR_LOWERCASE_A: "a",
/* a */
CHAR_UPPERCASE_Z: "Z",
/* Z */
CHAR_LOWERCASE_Z: "z",
/* z */
CHAR_LEFT_PARENTHESES: "(",
/* ( */
CHAR_RIGHT_PARENTHESES: ")",
/* ) */
CHAR_ASTERISK: "*",
/* * */
// Non-alphabetic chars.
CHAR_AMPERSAND: "&",
/* & */
CHAR_AT: "@",
/* @ */
CHAR_BACKSLASH: "\\",
/* \ */
CHAR_BACKTICK: "`",
/* ` */
CHAR_CARRIAGE_RETURN: "\r",
/* \r */
CHAR_CIRCUMFLEX_ACCENT: "^",
/* ^ */
CHAR_COLON: ":",
/* : */
CHAR_COMMA: ",",
/* , */
CHAR_DOLLAR: "$",
/* . */
CHAR_DOT: ".",
/* . */
CHAR_DOUBLE_QUOTE: '"',
/* " */
CHAR_EQUAL: "=",
/* = */
CHAR_EXCLAMATION_MARK: "!",
/* ! */
CHAR_FORM_FEED: "\f",
/* \f */
CHAR_FORWARD_SLASH: "/",
/* / */
CHAR_HASH: "#",
/* # */
CHAR_HYPHEN_MINUS: "-",
/* - */
CHAR_LEFT_ANGLE_BRACKET: "<",
/* < */
CHAR_LEFT_CURLY_BRACE: "{",
/* { */
CHAR_LEFT_SQUARE_BRACKET: "[",
/* [ */
CHAR_LINE_FEED: "\n",
/* \n */
CHAR_NO_BREAK_SPACE: "\xA0",
/* \u00A0 */
CHAR_PERCENT: "%",
/* % */
CHAR_PLUS: "+",
/* + */
CHAR_QUESTION_MARK: "?",
/* ? */
CHAR_RIGHT_ANGLE_BRACKET: ">",
/* > */
CHAR_RIGHT_CURLY_BRACE: "}",
/* } */
CHAR_RIGHT_SQUARE_BRACKET: "]",
/* ] */
CHAR_SEMICOLON: ";",
/* ; */
CHAR_SINGLE_QUOTE: "'",
/* ' */
CHAR_SPACE: " ",
/* */
CHAR_TAB: " ",
/* \t */
CHAR_UNDERSCORE: "_",
/* _ */
CHAR_VERTICAL_LINE: "|",
/* | */
CHAR_ZERO_WIDTH_NOBREAK_SPACE: "\uFEFF"
/* \uFEFF */
};
}
});
var require_parse = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/braces@3.0.2/node_modules/braces/lib/parse.js"(exports, module2) {
"use strict";
var stringify = require_stringify();
var {
MAX_LENGTH,
CHAR_BACKSLASH,
/* \ */
CHAR_BACKTICK,
/* ` */
CHAR_COMMA,
/* , */
CHAR_DOT,
/* . */
CHAR_LEFT_PARENTHESES,
/* ( */
CHAR_RIGHT_PARENTHESES,
/* ) */
CHAR_LEFT_CURLY_BRACE,
/* { */
CHAR_RIGHT_CURLY_BRACE,
/* } */
CHAR_LEFT_SQUARE_BRACKET,
/* [ */
CHAR_RIGHT_SQUARE_BRACKET,
/* ] */
CHAR_DOUBLE_QUOTE,
/* " */
CHAR_SINGLE_QUOTE,
/* ' */
CHAR_NO_BREAK_SPACE,
CHAR_ZERO_WIDTH_NOBREAK_SPACE
} = require_constants();
var parse = (input, options = {}) => {
if (typeof input !== "string") {
throw new TypeError("Expected a string");
}
let opts = options || {};
let max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
if (input.length > max) {
throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`);
}
let ast = { type: "root", input, nodes: [] };
let stack = [ast];
let block = ast;
let prev = ast;
let brackets = 0;
let length = input.length;
let index = 0;
let depth = 0;
let value;
let memo = {};
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();
if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) {
continue;
}
if (value === CHAR_BACKSLASH) {
push({ type: "text", value: (options.keepEscaping ? value : "") + advance() });
continue;
}
if (value === CHAR_RIGHT_SQUARE_BRACKET) {
push({ type: "text", value: "\\" + value });
continue;
}
if (value === CHAR_LEFT_SQUARE_BRACKET) {
brackets++;
let closed = true;
let next;
while (index < length && (next = advance())) {
value += next;
if (next === CHAR_LEFT_SQUARE_BRACKET) {
brackets++;
continue;
}
if (next === CHAR_BACKSLASH) {
value += advance();
continue;
}
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
brackets--;
if (brackets === 0) {
break;
}
}
}
push({ type: "text", value });
continue;
}
if (value === CHAR_LEFT_PARENTHESES) {
block = push({ type: "paren", nodes: [] });
stack.push(block);
push({ type: "text", value });
continue;
}
if (value === CHAR_RIGHT_PARENTHESES) {
if (block.type !== "paren") {
push({ type: "text", value });
continue;
}
block = stack.pop();
push({ type: "text", value });
block = stack[stack.length - 1];
continue;
}
if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
let open = value;
let next;
if (options.keepQuotes !== true) {
value = "";
}
while (index < length && (next = advance())) {
if (next === CHAR_BACKSLASH) {
value += next + advance();
continue;
}
if (next === open) {
if (options.keepQuotes === true) value += next;
break;
}
value += next;
}
push({ type: "text", value });
continue;
}
if (value === CHAR_LEFT_CURLY_BRACE) {
depth++;
let dollar = prev.value && prev.value.slice(-1) === "$" || block.dollar === true;
let brace = {
type: "brace",
open: true,
close: false,
dollar,
depth,
commas: 0,
ranges: 0,
nodes: []
};
block = push(brace);
stack.push(block);
push({ type: "open", value });
continue;
}
if (value === CHAR_RIGHT_CURLY_BRACE) {
if (block.type !== "brace") {
push({ type: "text", value });
continue;
}
let type = "close";
block = stack.pop();
block.close = true;
push({ type, value });
depth--;
block = stack[stack.length - 1];
continue;
}
if (value === CHAR_COMMA && depth > 0) {
if (block.ranges > 0) {
block.ranges = 0;
let open = block.nodes.shift();
block.nodes = [open, { type: "text", value: stringify(block) }];
}
push({ type: "comma", value });
block.commas++;
continue;
}
if (value === CHAR_DOT && depth > 0 && block.commas === 0) {
let siblings = block.nodes;
if (depth === 0 || siblings.length === 0) {
push({ type: "text", value });
continue;
}
if (prev.type === "dot") {
block.range = [];
prev.value += value;
prev.type = "range";
if (block.nodes.length !== 3 && block.nodes.length !== 5) {
block.invalid = true;
block.ranges = 0;
prev.type = "text";
continue;
}
block.ranges++;
block.args = [];
continue;
}
if (prev.type === "range") {
siblings.pop();
let before = siblings[siblings.length - 1];
before.value += prev.value + value;
prev = before;
block.ranges--;
continue;
}
push({ type: "dot", value });
continue;
}
push({ type: "text", value });
}
do {
block = stack.pop();
if (block.type !== "root") {
block.nodes.forEach((node) => {
if (!node.nodes) {
if (node.type === "open") node.isOpen = true;
if (node.type === "close") node.isClose = true;
if (!node.nodes) node.type = "text";
node.invalid = true;
}
});
let parent = stack[stack.length - 1];
let index2 = parent.nodes.indexOf(block);
parent.nodes.splice(index2, 1, ...block.nodes);
}
} while (stack.length > 0);
push({ type: "eos" });
return ast;
};
module2.exports = parse;
}
});
var require_braces = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/braces@3.0.2/node_modules/braces/index.js"(exports, module2) {
"use strict";
var stringify = require_stringify();
var compile = require_compile();
var expand = require_expand();
var parse = require_parse();
var braces = (input, options = {}) => {
let output = [];
if (Array.isArray(input)) {
for (let pattern of input) {
let result = braces.create(pattern, options);
if (Array.isArray(result)) {
output.push(...result);
} else {
output.push(result);
}
}
} else {
output = [].concat(braces.create(input, options));
}
if (options && options.expand === true && options.nodupes === true) {
output = [...new Set(output)];
}
return output;
};
braces.parse = (input, options = {}) => parse(input, options);
braces.stringify = (input, options = {}) => {
if (typeof input === "string") {
return stringify(braces.parse(input, options), options);
}
return stringify(input, options);
};
braces.compile = (input, options = {}) => {
if (typeof input === "string") {
input = braces.parse(input, options);
}
return compile(input, options);
};
braces.expand = (input, options = {}) => {
if (typeof input === "string") {
input = braces.parse(input, options);
}
let result = expand(input, options);
if (options.noempty === true) {
result = result.filter(Boolean);
}
if (options.nodupes === true) {
result = [...new Set(result)];
}
return result;
};
braces.create = (input, options = {}) => {
if (input === "" || input.length < 3) {
return [input];
}
return options.expand !== true ? braces.compile(input, options) : braces.expand(input, options);
};
module2.exports = braces;
}
});
var require_constants2 = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/constants.js"(exports, module2) {
"use strict";
var path2 = (0, import_chunk_AH6QHEOA.__require)("path");
var WIN_SLASH = "\\\\/";
var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
var DOT_LITERAL = "\\.";
var PLUS_LITERAL = "\\+";
var QMARK_LITERAL = "\\?";
var SLASH_LITERAL = "\\/";
var ONE_CHAR = "(?=.)";
var QMARK = "[^/]";
var END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
var START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
var DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
var NO_DOT = `(?!${DOT_LITERAL})`;
var NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
var NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
var NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
var QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
var STAR = `${QMARK}*?`;
var POSIX_CHARS = {
DOT_LITERAL,
PLUS_LITERAL,
QMARK_LITERAL,
SLASH_LITERAL,
ONE_CHAR,
QMARK,
END_ANCHOR,
DOTS_SLASH,
NO_DOT,
NO_DOTS,
NO_DOT_SLASH,
NO_DOTS_SLASH,
QMARK_NO_DOT,
STAR,
START_ANCHOR
};
var WINDOWS_CHARS = {
...POSIX_CHARS,
SLASH_LITERAL: `[${WIN_SLASH}]`,
QMARK: WIN_NO_SLASH,
STAR: `${WIN_NO_SLASH}*?`,
DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
NO_DOT: `(?!${DOT_LITERAL})`,
NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
};
var POSIX_REGEX_SOURCE = {
alnum: "a-zA-Z0-9",
alpha: "a-zA-Z",
ascii: "\\x00-\\x7F",
blank: " \\t",
cntrl: "\\x00-\\x1F\\x7F",
digit: "0-9",
graph: "\\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"
};
module2.exports = {
MAX_LENGTH: 1024 * 64,
POSIX_REGEX_SOURCE,
// regular expressions
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,
// Replace globs with equivalent patterns to reduce parsing time.
REPLACEMENTS: {
"***": "*",
"**/**": "**",
"**/**/**": "**"
},
// Digits
CHAR_0: 48,
/* 0 */
CHAR_9: 57,
/* 9 */
// Alphabet chars.
CHAR_UPPERCASE_A: 65,
/* A */
CHAR_LOWERCASE_A: 97,
/* a */
CHAR_UPPERCASE_Z: 90,
/* Z */
CHAR_LOWERCASE_Z: 122,
/* z */
CHAR_LEFT_PARENTHESES: 40,
/* ( */
CHAR_RIGHT_PARENTHESES: 41,
/* ) */
CHAR_ASTERISK: 42,
/* * */
// Non-alphabetic chars.
CHAR_AMPERSAND: 38,
/* & */
CHAR_AT: 64,
/* @ */
CHAR_BACKWARD_SLASH: 92,
/* \ */
CHAR_CARRIAGE_RETURN: 13,
/* \r */
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,
/* \f */
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,
/* \n */
CHAR_NO_BREAK_SPACE: 160,
/* \u00A0 */
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,
/* \t */
CHAR_UNDERSCORE: 95,
/* _ */
CHAR_VERTICAL_LINE: 124,
/* | */
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
/* \uFEFF */
SEP: path2.sep,
/**
* Create EXTGLOB_CHARS
*/
extglobChars(chars) {
return {
"!": { type: "negate", open: "(?:(?!(?:", close: `))${chars.STAR})` },
"?": { type: "qmark", open: "(?:", close: ")?" },
"+": { type: "plus", open: "(?:", close: ")+" },
"*": { type: "star", open: "(?:", close: ")*" },
"@": { type: "at", open: "(?:", close: ")" }
};
},
/**
* Create GLOB_CHARS
*/
globChars(win32) {
return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
}
};
}
});
var require_utils2 = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/utils.js"(exports) {
"use strict";
var path2 = (0, import_chunk_AH6QHEOA.__require)("path");
var win32 = process.platform === "win32";
var {
REGEX_BACKSLASH,
REGEX_REMOVE_BACKSLASH,
REGEX_SPECIAL_CHARS,
REGEX_SPECIAL_CHARS_GLOBAL
} = require_constants2();
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) => {
if (options && typeof options.windows === "boolean") {
return options.windows;
}
return win32 === true || path2.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 = {}) => {
const prepend = options.contains ? "" : "^";
const append = options.contains ? "" : "$";
let output = `${prepend}(?:${input})${append}`;
if (state.negated === true) {
output = `(?:^(?!${output}).*$)`;
}
return output;
};
}
});
var require_scan = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/scan.js"(exports, module2) {
"use strict";
var utils = require_utils2();
var {
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_constants2();
var isPathSeparator = (code) => {
return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
};
var depth = (token) => {
if (token.isPrefix !== true) {
token.depth = token.isGlobstar ? Infinity : 1;
}
};
var scan = (input, options) => {
const opts = options || {};
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 = false;
let isExtglob = false;
let isGlobstar = false;
let braceEscaped = false;
let backslashes = false;
let negated = false;
let negatedExtglob = false;
let finished = false;
let braces = 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++;
while (eos() !== true && (code = advance())) {
if (code === CHAR_BACKWARD_SLASH) {
backslashes = token.backslashes = true;
advance();
continue;
}
if (code === CHAR_LEFT_CURLY_BRACE) {
braces++;
continue;
}
if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
isBrace = token.isBrace = true;
isGlob = token.isGlob = true;
finished = true;
if (scanToEnd === true) {
continue;
}
break;
}
if (braceEscaped !== true && code === CHAR_COMMA) {
isBrace = token.isBrace = true;
isGlob = token.isGlob = true;
finished = true;
if (scanToEnd === true) {
continue;
}
break;
}
if (code === CHAR_RIGHT_CURLY_BRACE) {
braces--;
if (braces === 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) {
const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
isGlob = token.isGlob = true;
isExtglob = 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 = token.isGlob = true;
finished = true;
break;
}
}
continue;
}
break;
}
}
if (code === CHAR_ASTERISK) {
if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
isGlob = token.isGlob = true;
finished = true;
if (scanToEnd === true) {
continue;
}
break;
}
if (code === CHAR_QUESTION_MARK) {
isGlob = 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 = 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 = 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 === true) {
finished = true;
if (scanToEnd === true) {
continue;
}
break;
}
}
if (opts.noext === true) {
isExtglob = false;
isGlob = 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 === true && lastIndex > 0) {
base = str.slice(0, lastIndex);
glob = str.slice(lastIndex);
} else if (isGlob === 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.removeBackslashes(glob);
if (base && backslashes === true) {
base = utils.removeBackslashes(base);
}
}
const state = {
prefix,
input,
start,
base,
glob,
isBrace,
isBracket,
isGlob,
isExtglob,
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;
};
module2.exports = scan;
}
});
var require_parse2 = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/parse.js"(exports, module2) {
"use strict";
var constants = require_constants2();
var utils = require_utils2();
var {
MAX_LENGTH,
POSIX_REGEX_SOURCE,
REGEX_NON_SPECIAL_CHARS,
REGEX_SPECIAL_CHARS_BACKREF,
REPLACEMENTS
} = constants;
var expandRange = (args, options) => {
if (typeof options.expandRange === "function") {
return options.expandRange(...args, options);
}
args.sort();
const value = `[${args.join("-")}]`;
try {
new RegExp(value);
} catch (ex) {
return args.map((v) => utils.escapeRegex(v)).join("..");
}
return value;
};
var syntaxError = (type, char) => {
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
};
var parse = (input, options) => {
if (typeof input !== "string") {
throw new TypeError("Expected a string");
}
input = REPLACEMENTS[input] || input;
const opts = { ...options };
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 = utils.isWindows(options);
const PLATFORM_CHARS = constants.globChars(win32);
const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
const {
DOT_LITERAL,
PLUS_LITERAL,
SLASH_LITERAL,
ONE_CHAR,
DOTS_SLASH,
NO_DOT,
NO_DOT_SLASH,
NO_DOTS_SLASH,
QMARK,
QMARK_NO_DOT,
STAR,
START_ANCHOR
} = PLATFORM_CHARS;
const globstar = (opts2) => {
return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
};
const nodot = opts.dot ? "" : NO_DOT;
const qmarkNoDot = opts.dot ? QMARK : 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.removePrefix(input, state);
len = input.length;
const extglobs = [];
const braces = [];
const stack = [];
let prev = bos;
let value;
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 = (value2 = "", num = 0) => {
state.consumed += value2;
state.index += num;
};
const append = (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();
};
const push = (tok) => {
if (prev.type === "globstar") {
const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
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(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, value2) => {
const token = { ...EXTGLOB_CHARS[value2], 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: value2, output: state.output ? "" : ONE_CHAR });
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)) {
const expression = parse(rest, { ...options, fastpaths: false }).output;
output = token.close = `)${expression})${extglobStar})`;
}
if (token.prev.type === "bos") {
state.negatedExtglob = true;
}
}
push({ type: "paren", extglob: true, value, output });
decrement("parens");
};
if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
let backslashes = false;
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
if (first === "\\") {
backslashes = true;
return m;
}
if (first === "?") {
if (esc) {
return esc + first + (rest ? QMARK.repeat(rest.length) : "");
}
if (index === 0) {
return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : "");
}
return QMARK.repeat(chars.length);
}
if (first === ".") {
return DOT_LITERAL.repeat(chars.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.wrapOutput(output, state, options);
return state;
}
while (!eos()) {
value = advance();
if (value === "\0") {
continue;
}
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 (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 rest2 = prev.value.slice(idx + 2);
const posix = POSIX_REGEX_SOURCE[rest2];
if (posix) {
prev.value = pre + posix;
state.backtrack = true;
advance();
if (!bos.output && tokens.indexOf(prev) === 1) {
bos.output = ONE_CHAR;
}
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({ value });
continue;
}
if (state.quotes === 1 && value !== '"') {
value = utils.escapeRegex(value);
prev.value += value;
append({ value });
continue;
}
if (value === '"') {
state.quotes = state.quotes === 1 ? 0 : 1;
if (opts.keepQuotes === true) {
push({ type: "text", value });
}
continue;
}
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;
}
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({ value });
if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
continue;
}
const escaped = utils.escapeRegex(prev.value);
state.output = state.output.slice(0, -prev.value.length);
if (opts.literalBrackets === true) {
state.output += escaped;
prev.value = escaped;
continue;
}
prev.value = `(${capture}${escaped}|${prev.value})`;
state.output += prev.value;
continue;
}
if (value === "{" && opts.nobrace !== true) {
increment("braces");
const open = {
type: "brace",
value,
output: "(",
outputIndex: state.output.length,
tokensIndex: state.tokens.length
};
braces.push(open);
push(open);
continue;
}
if (value === "}") {
const brace = braces[braces.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.pop();
continue;
}
if (value === "|") {
if (extglobs.length > 0) {
extglobs[extglobs.length - 1].conditions++;
}
push({ type: "text", value });
continue;
}
if (value === ",") {
let output = value;
const brace = braces[braces.length - 1];
if (brace && stack[stack.length - 1] === "braces") {
brace.comma = true;
output = "|";
}
push({ type: "comma", value, output });
continue;
}
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 });
continue;
}
if (value === ".") {
if (state.braces > 0 && prev.type === "dot") {
if (prev.value === ".") prev.output = DOT_LITERAL;
const brace = braces[braces.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 });
continue;
}
push({ type: "dot", value, output: DOT_LITERAL });
continue;
}
if (value === "?") {
const isGroup = prev && prev.value === "(";
if (!isGroup && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
extglobOpen("qmark", value);
continue;
}
if (prev && prev.type === "paren") {
const next = peek();
let output = value;
if (next === "<" && !utils.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 });
continue;
}
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;
}
}
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 });
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 });
continue;
}
if (value === "@") {
if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
push({ type: "at", extglob: true, value, output: "" });
continue;
}
push({ type: "text", value });
continue;
}
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;
}
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 = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
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}|${SLASH_LITERAL}${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}|${globstar(opts)}${SLASH_LITERAL})`;
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;
prev.output += ONE_CHAR;
}
}
push(token);
}
while (state.brackets > 0) {
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "]"));
state.output = utils.escapeLast(state.output, "[");
decrement("brackets");
}
while (state.parens > 0) {
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", ")"));
state.output = utils.escapeLast(state.output, "(");
decrement("parens");
}
while (state.braces > 0) {
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError("closing", "}"));
state.output = utils.escapeLast(state.output, "{");
decrement("braces");
}
if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) {
push({ type: "maybe_slash", value: "", output: `${SLASH_LITERAL}?` });
}
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;
};
parse.fastpaths = (input, options) => {
const opts = { ...options };
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 = utils.isWindows(options);
const {
DOT_LITERAL,
SLASH_LITERAL,
ONE_CHAR,
DOTS_SLASH,
NO_DOT,
NO_DOTS,
NO_DOTS_SLASH,
STAR,
START_ANCHOR
} = constants.globChars(win32);
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 = (opts2) => {
if (opts2.noglobstar === true) return star;
return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
};
const create = (str) => {
switch (str) {
case "*":
return `${nodot}${ONE_CHAR}${star}`;
case ".*":
return `${DOT_LITERAL}${ONE_CHAR}${star}`;
case "*.*":
return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
case "*/*":
return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
case "**":
return nodot + globstar(opts);
case "**/*":
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
case "**/*.*":
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
case "**/.*":
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
default: {
const match = /^(.*?)\.(\w+)$/.exec(str);
if (!match) return;
const source2 = create(match[1]);
if (!source2) return;
return source2 + DOT_LITERAL + match[2];
}
}
};
const output = utils.removePrefix(input, state);
let source = create(output);
if (source && opts.strictSlashes !== true) {
source += `${SLASH_LITERAL}?`;
}
return source;
};
module2.exports = parse;
}
});
var require_picomatch = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/picomatch.js"(exports, module2) {
"use strict";
var path2 = (0, import_chunk_AH6QHEOA.__require)("path");
var scan = require_scan();
var parse = require_parse2();
var utils = require_utils2();
var constants = require_constants2();
var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
var picomatch = (glob, options, returnState = false) => {
if (Array.isArray(glob)) {
const fns = glob.map((input) => picomatch(input, options, returnState));
const arrayMatcher = (str) => {
for (const isMatch of fns) {
const state2 = isMatch(str);
if (state2) return state2;
}
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 || {};
const posix = utils.isWindows(options);
const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
const state = regex.state;
delete regex.state;
let isIgnored = () => false;
if (opts.ignore) {
const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
}
const matcher = (input, returnObject = false) => {
const { isMatch, match, output } = picomatch.test(input, regex, options, { 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;
};
picomatch.test = (input, regex, options, { glob, posix } = {}) => {
if (typeof input !== "string") {
throw new TypeError("Expected input to be a string");
}
if (input === "") {
return { isMatch: false, output: "" };
}
const opts = options || {};
const format = opts.format || (posix ? utils.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.matchBase(input, regex, options, posix);
} else {
match = regex.exec(output);
}
}
return { isMatch: Boolean(match), match, output };
};
picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
return regex.test(path2.basename(input));
};
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
picomatch.parse = (pattern, options) => {
if (Array.isArray(pattern)) return pattern.map((p) => picomatch.parse(p, options));
return parse(pattern, { ...options, fastpaths: false });
};
picomatch.scan = (input, options) => scan(input, options);
picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
if (returnOutput === true) {
return state.output;
}
const opts = options || {};
const prepend = opts.contains ? "" : "^";
const append = opts.contains ? "" : "$";
let source = `${prepend}(?:${state.output})${append}`;
if (state && state.negated === true) {
source = `^(?!${source}).*$`;
}
const regex = picomatch.toRegex(source, options);
if (returnState === true) {
regex.state = state;
}
return regex;
};
picomatch.makeRe = (input, options = {}, 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.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
parsed.output = parse.fastpaths(input, options);
}
if (!parsed.output) {
parsed = parse(input, options);
}
return picomatch.compileRe(parsed, options, returnOutput, returnState);
};
picomatch.toRegex = (source, options) => {
try {
const opts = options || {};
return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
} catch (err) {
if (options && options.debug === true) throw err;
return /$^/;
}
};
picomatch.constants = constants;
module2.exports = picomatch;
}
});
var require_picomatch2 = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/index.js"(exports, module2) {
"use strict";
module2.exports = require_picomatch();
}
});
var require_micromatch = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/micromatch@4.0.5/node_modules/micromatch/index.js"(exports, module2) {
"use strict";
var util = (0, import_chunk_AH6QHEOA.__require)("util");
var braces = require_braces();
var picomatch = require_picomatch2();
var utils = require_utils2();
var isEmptyString = (val) => val === "" || val === "./";
var micromatch = (list, patterns, options) => {
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 && options.onResult) {
options.onResult(state);
}
};
for (let i = 0; i < patterns.length; i++) {
let isMatch = picomatch(String(patterns[i]), { ...options, onResult }, true);
let negated = isMatch.state.negated || isMatch.state.negatedExtglob;
if (negated) negatives++;
for (let item of list) {
let matched = isMatch(item, true);
let match = negated ? !matched.isMatch : matched.isMatch;
if (!match) continue;
if (negated) {
omit.add(matched.output);
} else {
omit.delete(matched.output);
keep.add(matched.output);
}
}
}
let result = negatives === patterns.length ? [...items] : [...keep];
let matches = result.filter((item) => !omit.has(item));
if (options && matches.length === 0) {
if (options.failglob === true) {
throw new Error(`No matches found for "${patterns.join(", ")}"`);
}
if (options.nonull === true || options.nullglob === true) {
return options.unescape ? patterns.map((p) => p.replace(/\\/g, "")) : patterns;
}
}
return matches;
};
micromatch.match = micromatch;
micromatch.matcher = (pattern, options) => picomatch(pattern, options);
micromatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
micromatch.any = micromatch.isMatch;
micromatch.not = (list, patterns, options = {}) => {
patterns = [].concat(patterns).map(String);
let result = /* @__PURE__ */ new Set();
let items = [];
let onResult = (state) => {
if (options.onResult) options.onResult(state);
items.push(state.output);
};
let matches = new Set(micromatch(list, patterns, { ...options, onResult }));
for (let item of items) {
if (!matches.has(item)) {
result.add(item);
}
}
return [...result];
};
micromatch.contains = (str, pattern, options) => {
if (typeof str !== "string") {
throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
}
if (Array.isArray(pattern)) {
return pattern.some((p) => micromatch.contains(str, p, options));
}
if (typeof pattern === "string") {
if (isEmptyString(str) || isEmptyString(pattern)) {
return false;
}
if (str.includes(pattern) || str.startsWith("./") && str.slice(2).includes(pattern)) {
return true;
}
}
return micromatch.isMatch(str, pattern, { ...options, contains: true });
};
micromatch.matchKeys = (obj, patterns, options) => {
if (!utils.isObject(obj)) {
throw new TypeError("Expected the first argument to be an object");
}
let keys = micromatch(Object.keys(obj), patterns, options);
let res = {};
for (let key of keys) res[key] = obj[key];
return res;
};
micromatch.some = (list, patterns, options) => {
let items = [].concat(list);
for (let pattern of [].concat(patterns)) {
let isMatch = picomatch(String(pattern), options);
if (items.some((item) => isMatch(item))) {
return true;
}
}
return false;
};
micromatch.every = (list, patterns, options) => {
let items = [].concat(list);
for (let pattern of [].concat(patterns)) {
let isMatch = picomatch(String(pattern), options);
if (!items.every((item) => isMatch(item))) {
return false;
}
}
return true;
};
micromatch.all = (str, patterns, options) => {
if (typeof str !== "string") {
throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
}
return [].concat(patterns).every((p) => picomatch(p, options)(str));
};
micromatch.capture = (glob, input, options) => {
let posix = utils.isWindows(options);
let regex = picomatch.makeRe(String(glob), { ...options, capture: true });
let match = regex.exec(posix ? utils.toPosixSlashes(input) : input);
if (match) {
return match.slice(1).map((v) => v === void 0 ? "" : v);
}
};
micromatch.makeRe = (...args) => picomatch.makeRe(...args);
micromatch.scan = (...args) => picomatch.scan(...args);
micromatch.parse = (patterns, options) => {
let res = [];
for (let pattern of [].concat(patterns || [])) {
for (let str of braces(String(pattern), options)) {
res.push(picomatch.parse(str, options));
}
}
return res;
};
micromatch.braces = (pattern, options) => {
if (typeof pattern !== "string") throw new TypeError("Expected a string");
if (options && options.nobrace === true || !/\{.*\}/.test(pattern)) {
return [pattern];
}
return braces(pattern, options);
};
micromatch.braceExpand = (pattern, options) => {
if (typeof pattern !== "string") throw new TypeError("Expected a string");
return micromatch.braces(pattern, { ...options, expand: true });
};
module2.exports = micromatch;
}
});
var require_pattern = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/fast-glob@3.3.2/node_modules/fast-glob/out/utils/pattern.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.removeDuplicateSlashes = exports.matchAny = exports.convertPatternsToRe = exports.makeRe = exports.getPatternParts = exports.expandBraceExpansion = exports.expandPatternsWithBraceExpansion = exports.isAffectDepthOfReadingPattern = exports.endsWithSlashGlobStar = exports.hasGlobStar = exports.getBaseDirectory = exports.isPatternRelatedToParentDirectory = exports.getPatternsOutsideCurrentDirectory = exports.getPatternsInsideCurrentDirectory = exports.getPositivePatterns = exports.getNegativePatterns = exports.isPositivePattern = exports.isNegativePattern = exports.convertToNegativePattern = exports.convertToPositivePattern = exports.isDynamicPattern = exports.isStaticPattern = void 0;
var path2 = (0, import_chunk_AH6QHEOA.__require)("path");
var globParent = require_glob_parent();
var micromatch = require_micromatch();
var GLOBSTAR = "**";
var ESCAPE_SYMBOL = "\\";
var COMMON_GLOB_SYMBOLS_RE = /[*?]|^!/;
var REGEX_CHARACTER_CLASS_SYMBOLS_RE = /\[[^[]*]/;
var REGEX_GROUP_SYMBOLS_RE = /(?:^|[^!*+?@])\([^(]*\|[^|]*\)/;
var GLOB_EXTENSION_SYMBOLS_RE = /[!*+?@]\([^(]*\)/;
var BRACE_EXPANSION_SEPARATORS_RE = /,|\.\./;
var DOUBLE_SLASH_RE = /(?!^)\/{2,}/g;
function isStaticPattern(pattern, options = {}) {
return !isDynamicPattern(pattern, options);
}
exports.isStaticPattern = isStaticPattern;
function isDynamicPattern(pattern, options = {}) {
if (pattern === "") {
return false;
}
if (options.caseSensitiveMatch === false || pattern.includes(ESCAPE_SYMBOL)) {
return true;
}
if (COMMON_GLOB_SYMBOLS_RE.test(pattern) || REGEX_CHARACTER_CLASS_SYMBOLS_RE.test(pattern) || REGEX_GROUP_SYMBOLS_RE.test(pattern)) {
return true;
}
if (options.extglob !== false && GLOB_EXTENSION_SYMBOLS_RE.test(pattern)) {
return true;
}
if (options.braceExpansion !== false && hasBraceExpansion(pattern)) {
return true;
}
return false;
}
exports.isDynamicPattern = isDynamicPattern;
function hasBraceExpansion(pattern) {
const openingBraceIndex = pattern.indexOf("{");
if (openingBraceIndex === -1) {
return false;
}
const closingBraceIndex = pattern.indexOf("}", openingBraceIndex + 1);
if (closingBraceIndex === -1) {
return false;
}
const braceContent = pattern.slice(openingBraceIndex, closingBraceIndex);
return BRACE_EXPANSION_SEPARATORS_RE.test(braceContent);
}
function convertToPositivePattern(pattern) {
return isNegativePattern(pattern) ? pattern.slice(1) : pattern;
}
exports.convertToPositivePattern = convertToPositivePattern;
function convertToNegativePattern(pattern) {
return "!" + pattern;
}
exports.convertToNegativePattern = convertToNegativePattern;
function isNegativePattern(pattern) {
return pattern.startsWith("!") && pattern[1] !== "(";
}
exports.isNegativePattern = isNegativePattern;
function isPositivePattern(pattern) {
return !isNegativePattern(pattern);
}
exports.isPositivePattern = isPositivePattern;
function getNegativePatterns(patterns) {
return patterns.filter(isNegativePattern);
}
exports.getNegativePatterns = getNegativePatterns;
function getPositivePatterns(patterns) {
return patterns.filter(isPositivePattern);
}
exports.getPositivePatterns = getPositivePatterns;
function getPatternsInsideCurrentDirectory(patterns) {
return patterns.filter((pattern) => !isPatternRelatedToParentDirectory(pattern));
}
exports.getPatternsInsideCurrentDirectory = getPatternsInsideCurrentDirectory;
function getPatternsOutsideCurrentDirectory(patterns) {
return patterns.filter(isPatternRelatedToParentDirectory);
}
exports.getPatternsOutsideCurrentDirectory = getPatternsOutsideCurrentDirectory;
function isPatternRelatedToParentDirectory(pattern) {
return pattern.startsWith("..") || pattern.startsWith("./..");
}
exports.isPatternRelatedToParentDirectory = isPatternRelatedToParentDirectory;
function getBaseDirectory(pattern) {
return globParent(pattern, { flipBackslashes: false });
}
exports.getBaseDirectory = getBaseDirectory;
function hasGlobStar(pattern) {
return pattern.includes(GLOBSTAR);
}
exports.hasGlobStar = hasGlobStar;
function endsWithSlashGlobStar(pattern) {
return pattern.endsWith("/" + GLOBSTAR);
}
exports.endsWithSlashGlobStar = endsWithSlashGlobStar;
function isAffectDepthOfReadingPattern(pattern) {
const basename = path2.basename(pattern);
return endsWithSlashGlobStar(pattern) || isStaticPattern(basename);
}
exports.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
function expandPatternsWithBraceExpansion(patterns) {
return patterns.reduce((collection, pattern) => {
return collection.concat(expandBraceExpansion(pattern));
}, []);
}
exports.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion;
function expandBraceExpansion(pattern) {
const patterns = micromatch.braces(pattern, { expand: true, nodupes: true, keepEscaping: true });
patterns.sort((a, b) => a.length - b.length);
return patterns.filter((pattern2) => pattern2 !== "");
}
exports.expandBraceExpansion = expandBraceExpansion;
function getPatternParts(pattern, options) {
let { parts } = micromatch.scan(pattern, Object.assign(Object.assign({}, options), { parts: true }));
if (parts.length === 0) {
parts = [pattern];
}
if (parts[0].startsWith("/")) {
parts[0] = parts[0].slice(1);
parts.unshift("");
}
return parts;
}
exports.getPatternParts = getPatternParts;
function makeRe(pattern, options) {
return micromatch.makeRe(pattern, options);
}
exports.makeRe = makeRe;
function convertPatternsToRe(patterns, options) {
return patterns.map((pattern) => makeRe(pattern, options));
}
exports.convertPatternsToRe = convertPatternsToRe;
function matchAny(entry, patternsRe) {
return patternsRe.some((patternRe) => patternRe.test(entry));
}
exports.matchAny = matchAny;
function removeDuplicateSlashes(pattern) {
return pattern.replace(DOUBLE_SLASH_RE, "/");
}
exports.removeDuplicateSlashes = removeDuplicateSlashes;
}
});
var require_stream = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/fast-glob@3.3.2/node_modules/fast-glob/out/utils/stream.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.merge = void 0;
var merge2 = require_merge2();
function merge(streams) {
const mergedStream = merge2(streams);
streams.forEach((stream) => {
stream.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) => stream.emit("close"));
}
}
});
var require_string = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/fast-glob@3.3.2/node_modules/fast-glob/out/utils/string.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isEmpty = exports.isString = void 0;
function isString(input) {
return typeof input === "string";
}
exports.isString = isString;
function isEmpty(input) {
return input === "";
}
exports.isEmpty = isEmpty;
}
});
var require_utils3 = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/fast-glob@3.3.2/node_modules/fast-glob/out/utils/index.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.string = exports.stream = exports.pattern = exports.path = exports.fs = exports.errno = exports.array = void 0;
var array = require_array();
exports.array = array;
var errno = require_errno();
exports.errno = errno;
var fs2 = require_fs();
exports.fs = fs2;
var path2 = require_path();
exports.path = path2;
var pattern = require_pattern();
exports.pattern = pattern;
var stream = require_stream();
exports.stream = stream;
var string = require_string();
exports.string = string;
}
});
var require_tasks = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/fast-glob@3.3.2/node_modules/fast-glob/out/managers/tasks.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.convertPatternGroupToTask = exports.convertPatternGroupsToTasks = exports.groupPatternsByBaseDirectory = exports.getNegativePatternsAsPositive = exports.getPositivePatterns = exports.convertPatternsToTasks = exports.generate = void 0;
var utils = require_utils3();
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) => utils.pattern.isStaticPattern(pattern, settings));
const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern, settings));
const staticTasks = convertPatternsToTasks(
staticPatterns,
negativePatterns,
/* dynamic */
false
);
const dynamicTasks = convertPatternsToTasks(
dynamicPatterns,
negativePatterns,
/* dynamic */
true
);
return staticTasks.concat(dynamicTasks);
}
exports.generate = generate;
function processPatterns(input, settings) {
let patterns = input;
if (settings.braceExpansion) {
patterns = utils.pattern.expandPatternsWithBraceExpansion(patterns);
}
if (settings.baseNameMatch) {
patterns = patterns.map((pattern) => pattern.includes("/") ? pattern : `**/${pattern}`);
}
return patterns.map((pattern) => utils.pattern.removeDuplicateSlashes(pattern));
}
function convertPatternsToTasks(positive, negative, dynamic) {
const tasks = [];
const patternsOutsideCurrentDirectory = utils.pattern.getPatternsOutsideCurrentDirectory(positive);
const patternsInsideCurrentDirectory = utils.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.pattern.getPositivePatterns(patterns);
}
exports.getPositivePatterns = getPositivePatterns;
function getNegativePatternsAsPositive(patterns, ignore) {
const negative = utils.pattern.getNegativePatterns(patterns).concat(ignore);
const positive = negative.map(utils.pattern.convertToPositivePattern);
return positive;
}
exports.getNegativePatternsAsPositive = getNegativePatternsAsPositive;
function groupPatternsByBaseDirectory(patterns) {
const group = {};
return patterns.reduce((collection, pattern) => {
const base = utils.pattern.getBaseDirectory(pattern);
if (base in collection) {
collection[base].push(pattern);
} else {
collection[base] = [pattern];
}
return collection;
}, group);
}
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.pattern.convertToNegativePattern))
};
}
exports.convertPatternGroupToTask = convertPatternGroupToTask;
}
});
var require_async = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/providers/async.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.read = void 0;
function read(path2, settings, callback) {
settings.fs.lstat(path2, (lstatError, lstat) => {
if (lstatError !== null) {
callFailureCallback(callback, lstatError);
return;
}
if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
callSuccessCallback(callback, lstat);
return;
}
settings.fs.stat(path2, (statError, stat) => {
if (statError !== null) {
if (settings.throwErrorOnBrokenSymbolicLink) {
callFailureCallback(callback, statError);
return;
}
callSuccessCallback(callback, lstat);
return;
}
if (settings.markSymbolicLink) {
stat.isSymbolicLink = () => true;
}
callSuccessCallback(callback, stat);
});
});
}
exports.read = read;
function callFailureCallback(callback, error) {
callback(error);
}
function callSuccessCallback(callback, result) {
callback(null, result);
}
}
});
var require_sync = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/providers/sync.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.read = void 0;
function read(path2, settings) {
const lstat = settings.fs.lstatSync(path2);
if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
return lstat;
}
try {
const stat = settings.fs.statSync(path2);
if (settings.markSymbolicLink) {
stat.isSymbolicLink = () => true;
}
return stat;
} catch (error) {
if (!settings.throwErrorOnBrokenSymbolicLink) {
return lstat;
}
throw error;
}
}
exports.read = read;
}
});
var require_fs2 = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/adapters/fs.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
var fs2 = (0, import_chunk_AH6QHEOA.__require)("fs");
exports.FILE_SYSTEM_ADAPTER = {
lstat: fs2.lstat,
stat: fs2.stat,
lstatSync: fs2.lstatSync,
statSync: fs2.statSync
};
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;
}
});
var require_settings = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/settings.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var fs2 = require_fs2();
var Settings = class {
constructor(_options = {}) {
this._options = _options;
this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
this.fs = fs2.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;
}
});
var require_out = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/index.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.statSync = exports.stat = exports.Settings = void 0;
var async = require_async();
var sync = require_sync();
var settings_1 = require_settings();
exports.Settings = settings_1.default;
function stat(path2, optionsOrSettingsOrCallback, callback) {
if (typeof optionsOrSettingsOrCallback === "function") {
async.read(path2, getSettings(), optionsOrSettingsOrCallback);
return;
}
async.read(path2, getSettings(optionsOrSettingsOrCallback), callback);
}
exports.stat = stat;
function statSync(path2, optionsOrSettings) {
const settings = getSettings(optionsOrSettings);
return sync.read(path2, settings);
}
exports.statSync = statSync;
function getSettings(settingsOrOptions = {}) {
if (settingsOrOptions instanceof settings_1.default) {
return settingsOrOptions;
}
return new settings_1.default(settingsOrOptions);
}
}
});
var require_queue_microtask = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/queue-microtask@1.2.3/node_modules/queue-microtask/index.js"(exports, module2) {
"use strict";
var promise;
module2.exports = typeof queueMicrotask === "function" ? queueMicrotask.bind(typeof window !== "undefined" ? window : global) : (cb) => (promise || (promise = Promise.resolve())).then(cb).catch((err) => setTimeout(() => {
throw err;
}, 0));
}
});
var require_run_parallel = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/run-parallel@1.2.0/node_modules/run-parallel/index.js"(exports, module2) {
"use strict";
module2.exports = runParallel;
var queueMicrotask2 = require_queue_microtask();
function runParallel(tasks, cb) {
let results, pending, keys;
let isSync = true;
if (Array.isArray(tasks)) {
results = [];
pending = tasks.length;
} else {
keys = Object.keys(tasks);
results = {};
pending = keys.length;
}
function done(err) {
function end() {
if (cb) cb(err, results);
cb = null;
}
if (isSync) queueMicrotask2(end);
else end();
}
function each(i, err, result) {
results[i] = result;
if (--pending === 0 || err) {
done(err);
}
}
if (!pending) {
done(null);
} else if (keys) {
keys.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;
}
}
});
var require_constants3 = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/constants.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = void 0;
var 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}`);
}
var MAJOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[0], 10);
var MINOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[1], 10);
var SUPPORTED_MAJOR_VERSION = 10;
var SUPPORTED_MINOR_VERSION = 10;
var IS_MATCHED_BY_MAJOR = MAJOR_VERSION > SUPPORTED_MAJOR_VERSION;
var IS_MATCHED_BY_MAJOR_AND_MINOR = MAJOR_VERSION === SUPPORTED_MAJOR_VERSION && MINOR_VERSION >= SUPPORTED_MINOR_VERSION;
exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_BY_MAJOR_AND_MINOR;
}
});
var require_fs3 = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/utils/fs.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createDirentFromStats = void 0;
var DirentFromStats = class {
constructor(name, stats) {
this.name = name;
this.isBlockDevice = stats.isBlockDevice.bind(stats);
this.isCharacterDevice = stats.isCharacterDevice.bind(stats);
this.isDirectory = stats.isDirectory.bind(stats);
this.isFIFO = stats.isFIFO.bind(stats);
this.isFile = stats.isFile.bind(stats);
this.isSocket = stats.isSocket.bind(stats);
this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
}
};
function createDirentFromStats(name, stats) {
return new DirentFromStats(name, stats);
}
exports.createDirentFromStats = createDirentFromStats;
}
});
var require_utils4 = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/utils/index.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.fs = void 0;
var fs2 = require_fs3();
exports.fs = fs2;
}
});
var require_common = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/providers/common.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.joinPathSegments = void 0;
function joinPathSegments(a, b, separator) {
if (a.endsWith(separator)) {
return a + b;
}
return a + separator + b;
}
exports.joinPathSegments = joinPathSegments;
}
});
var require_async2 = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/providers/async.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.readdir = exports.readdirWithFileTypes = exports.read = void 0;
var fsStat = require_out();
var rpl = require_run_parallel();
var constants_1 = require_constants3();
var utils = require_utils4();
var common = require_common();
function read(directory, settings, callback) {
if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
readdirWithFileTypes(directory, settings, callback);
return;
}
readdir(directory, settings, callback);
}
exports.read = read;
function readdirWithFileTypes(directory, settings, callback) {
settings.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => {
if (readdirError !== null) {
callFailureCallback(callback, readdirError);
return;
}
const entries = dirents.map((dirent) => ({
dirent,
name: dirent.name,
path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
}));
if (!settings.followSymbolicLinks) {
callSuccessCallback(callback, entries);
return;
}
const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings));
rpl(tasks, (rplError, rplEntries) => {
if (rplError !== null) {
callFailureCallback(callback, rplError);
return;
}
callSuccessCallback(callback, rplEntries);
});
});
}
exports.readdirWithFileTypes = readdirWithFileTypes;
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.fs.createDirentFromStats(entry.name, stats);
done(null, entry);
});
};
}
function readdir(directory, settings, callback) {
settings.fs.readdir(directory, (readdirError, names) => {
if (readdirError !== null) {
callFailureCallback(callback, readdirError);
return;
}
const tasks = names.map((name) => {
const path2 = common.joinPathSegments(directory, name, settings.pathSegmentSeparator);
return (done) => {
fsStat.stat(path2, settings.fsStatSettings, (error, stats) => {
if (error !== null) {
done(error);
return;
}
const entry = {
name,
path: path2,
dirent: utils.fs.createDirentFromStats(name, stats)
};
if (settings.stats) {
entry.stats = stats;
}
done(null, entry);
});
};
});
rpl(tasks, (rplError, entries) => {
if (rplError !== null) {
callFailureCallback(callback, rplError);
return;
}
callSuccessCallback(callback, entries);
});
});
}
exports.readdir = readdir;
function callFailureCallback(callback, error) {
callback(error);
}
function callSuccessCallback(callback, result) {
callback(null, result);
}
}
});
var require_sync2 = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/providers/sync.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.readdir = exports.readdirWithFileTypes = exports.read = void 0;
var fsStat = require_out();
var constants_1 = require_constants3();
var utils = require_utils4();
var common = require_common();
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) {
const dirents = settings.fs.readdirSync(directory, { withFileTypes: true });
return dirents.map((dirent) => {
const entry = {
dirent,
name: dirent.name,
path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
};
if (entry.dirent.isSymbolicLink() && settings.followSymbolicLinks) {
try {
const stats = settings.fs.statSync(entry.path);
entry.dirent = utils.fs.createDirentFromStats(entry.name, stats);
} catch (error) {
if (settings.throwErrorOnBrokenSymbolicLink) {
throw error;
}
}
}
return entry;
});
}
exports.readdirWithFileTypes = readdirWithFileTypes;
function readdir(directory, settings) {
const names = settings.fs.readdirSync(directory);
return names.map((name) => {
const entryPath = common.joinPathSegments(directory, name, settings.pathSegmentSeparator);
const stats = fsStat.statSync(entryPath, settings.fsStatSettings);
const entry = {
name,
path: entryPath,
dirent: utils.fs.createDirentFromStats(name, stats)
};
if (settings.stats) {
entry.stats = stats;
}
return entry;
});
}
exports.readdir = readdir;
}
});
var require_fs4 = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/adapters/fs.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
var fs2 = (0, import_chunk_AH6QHEOA.__require)("fs");
exports.FILE_SYSTEM_ADAPTER = {
lstat: fs2.lstat,
stat: fs2.stat,
lstatSync: fs2.lstatSync,
statSync: fs2.statSync,
readdir: fs2.readdir,
readdirSync: fs2.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;
}
});
var require_settings2 = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/settings.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var path2 = (0, import_chunk_AH6QHEOA.__require)("path");
var fsStat = require_out();
var fs2 = require_fs4();
var Settings = class {
constructor(_options = {}) {
this._options = _options;
this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
this.fs = fs2.createFileSystemAdapter(this._options.fs);
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path2.sep);
this.stats = this._getValue(this._options.stats, false);
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
this.fsStatSettings = new fsStat.Settings({
followSymbolicLink: this.followSymbolicLinks,
fs: this.fs,
throwErrorOnBrokenSymbolicLink: this.throwErrorOnBrokenSymbolicLink
});
}
_getValue(option, value) {
return option !== null && option !== void 0 ? option : value;
}
};
exports.default = Settings;
}
});
var require_out2 = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/index.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Settings = exports.scandirSync = exports.scandir = void 0;
var async = require_async2();
var sync = require_sync2();
var settings_1 = require_settings2();
exports.Settings = settings_1.default;
function scandir(path2, optionsOrSettingsOrCallback, callback) {
if (typeof optionsOrSettingsOrCallback === "function") {
async.read(path2, getSettings(), optionsOrSettingsOrCallback);
return;
}
async.read(path2, getSettings(optionsOrSettingsOrCallback), callback);
}
exports.scandir = scandir;
function scandirSync(path2, optionsOrSettings) {
const settings = getSettings(optionsOrSettings);
return sync.read(path2, settings);
}
exports.scandirSync = scandirSync;
function getSettings(settingsOrOptions = {}) {
if (settingsOrOptions instanceof settings_1.default) {
return settingsOrOptions;
}
return new settings_1.default(settingsOrOptions);
}
}
});
var require_reusify = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/reusify@1.0.4/node_modules/reusify/reusify.js"(exports, module2) {
"use strict";
function reusify(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
};
}
module2.exports = reusify;
}
});
var require_queue = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/fastq@1.15.0/node_modules/fastq/queue.js"(exports, module2) {
"use strict";
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 greater than 1");
}
var cache = reusify(Task);
var queueHead = null;
var queueTail = null;
var _running = 0;
var errorHandler = null;
var self = {
push,
drain: noop,
saturated: noop,
pause,
paused: false,
concurrency,
running,
resume,
idle,
length,
getQueue,
unshift,
empty: noop,
kill,
killAndDrain,
error
};
return self;
function running() {
return _running;
}
function pause() {
self.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.paused) return;
self.paused = false;
for (var i = 0; i < self.concurrency; i++) {
_running++;
release();
}
}
function idle() {
return _running === 0 && self.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 === self.concurrency || self.paused) {
if (queueTail) {
queueTail.next = current;
queueTail = current;
} else {
queueHead = current;
queueTail = current;
self.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;
if (_running === self.concurrency || self.paused) {
if (queueHead) {
current.next = queueHead;
queueHead = current;
} else {
queueHead = current;
queueTail = current;
self.saturated();
}
} else {
_running++;
worker.call(context, current.value, current.worked);
}
}
function release(holder) {
if (holder) {
cache.release(holder);
}
var next = queueHead;
if (next) {
if (!self.paused) {
if (queueTail === queueHead) {
queueTail = null;
}
queueHead = next.next;
next.next = null;
worker.call(context, next.value, next.worked);
if (queueTail === null) {
self.empty();
}
} else {
_running--;
}
} else if (--_running === 0) {
self.drain();
}
}
function kill() {
queueHead = null;
queueTail = null;
self.drain = noop;
}
function killAndDrain() {
queueHead = null;
queueTail = null;
self.drain();
self.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 = this;
this.worked = function worked(err, result) {
var callback = self.callback;
var errorHandler = self.errorHandler;
var val = self.value;
self.value = null;
self.callback = noop;
if (self.errorHandler) {
errorHandler(err, val);
}
callback.call(self.context, err, result);
self.release(self);
};
}
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, reject) {
pushCb(value, function(err, result) {
if (err) {
reject(err);
return;
}
resolve(result);
});
});
p.catch(noop);
return p;
}
function unshift(value) {
var p = new Promise(function(resolve, reject) {
unshiftCb(value, function(err, result) {
if (err) {
reject(err);
return;
}
resolve(result);
});
});
p.catch(noop);
return p;
}
function drained() {
if (queue.idle()) {
return new Promise(function(resolve) {
resolve();
});
}
var previousDrain = queue.drain;
var p = new Promise(function(resolve) {
queue.drain = function() {
previousDrain();
resolve();
};
});
return p;
}
}
module2.exports = fastqueue;
module2.exports.promise = queueAsPromised;
}
});
var require_common2 = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/readers/common.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.joinPathSegments = exports.replacePathSegmentSeparator = exports.isAppliedFilter = exports.isFatalError = void 0;
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;
}
if (a.endsWith(separator)) {
return a + b;
}
return a + separator + b;
}
exports.joinPathSegments = joinPathSegments;
}
});
var require_reader = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/readers/reader.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var common = require_common2();
var Reader = class {
constructor(_root, _settings) {
this._root = _root;
this._settings = _settings;
this._root = common.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator);
}
};
exports.default = Reader;
}
});
var require_async3 = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/readers/async.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var events_1 = (0, import_chunk_AH6QHEOA.__require)("events");
var fsScandir = require_out2();
var fastq = require_queue();
var common = require_common2();
var reader_1 = require_reader();
var AsyncReader = class extends reader_1.default {
constructor(_root, _settings) {
super(_root, _settings);
this._settings = _settings;
this._scandir = fsScandir.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.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.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
}
if (common.isAppliedFilter(this._settings.entryFilter, entry)) {
this._emitEntry(entry);
}
if (entry.dirent.isDirectory() && common.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;
}
});
var require_async4 = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/providers/async.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var async_1 = require_async3();
var AsyncProvider = class {
constructor(_root, _settings) {
this._root = _root;
this._settings = _settings;
this._reader = new async_1.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);
}
}
});
var require_stream2 = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/providers/stream.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var stream_1 = (0, import_chunk_AH6QHEOA.__require)("stream");
var async_1 = require_async3();
var StreamProvider = class {
constructor(_root, _settings) {
this._root = _root;
this._settings = _settings;
this._reader = new async_1.default(this._root, this._settings);
this._stream = new stream_1.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;
}
});
var require_sync3 = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/readers/sync.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var fsScandir = require_out2();
var common = require_common2();
var reader_1 = require_reader();
var SyncReader = class extends reader_1.default {
constructor() {
super(...arguments);
this._scandir = fsScandir.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;
}
});
var require_sync4 = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/providers/sync.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var sync_1 = require_sync3();
var SyncProvider = class {
constructor(_root, _settings) {
this._root = _root;
this._settings = _settings;
this._reader = new sync_1.default(this._root, this._settings);
}
read() {
return this._reader.read();
}
};
exports.default = SyncProvider;
}
});
var require_settings3 = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/settings.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var path2 = (0, import_chunk_AH6QHEOA.__require)("path");
var fsScandir = require_out2();
var Settings = 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, path2.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;
}
});
var require_out3 = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/index.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Settings = exports.walkStream = exports.walkSync = exports.walk = void 0;
var async_1 = require_async4();
var stream_1 = require_stream2();
var sync_1 = require_sync4();
var settings_1 = require_settings3();
exports.Settings = settings_1.default;
function walk(directory, optionsOrSettingsOrCallback, callback) {
if (typeof optionsOrSettingsOrCallback === "function") {
new async_1.default(directory, getSettings()).read(optionsOrSettingsOrCallback);
return;
}
new async_1.default(directory, getSettings(optionsOrSettingsOrCallback)).read(callback);
}
exports.walk = walk;
function walkSync(directory, optionsOrSettings) {
const settings = getSettings(optionsOrSettings);
const provider = new sync_1.default(directory, settings);
return provider.read();
}
exports.walkSync = walkSync;
function walkStream(directory, optionsOrSettings) {
const settings = getSettings(optionsOrSettings);
const provider = new stream_1.default(directory, settings);
return provider.read();
}
exports.walkStream = walkStream;
function getSettings(settingsOrOptions = {}) {
if (settingsOrOptions instanceof settings_1.default) {
return settingsOrOptions;
}
return new settings_1.default(settingsOrOptions);
}
}
});
var require_reader2 = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/fast-glob@3.3.2/node_modules/fast-glob/out/readers/reader.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var path2 = (0, import_chunk_AH6QHEOA.__require)("path");
var fsStat = require_out();
var utils = require_utils3();
var Reader = class {
constructor(_settings) {
this._settings = _settings;
this._fsStatSettings = new fsStat.Settings({
followSymbolicLink: this._settings.followSymbolicLinks,
fs: this._settings.fs,
throwErrorOnBrokenSymbolicLink: this._settings.followSymbolicLinks
});
}
_getFullEntryPath(filepath) {
return path2.resolve(this._settings.cwd, filepath);
}
_makeEntry(stats, pattern) {
const entry = {
name: pattern,
path: pattern,
dirent: utils.fs.createDirentFromStats(pattern, stats)
};
if (this._settings.stats) {
entry.stats = stats;
}
return entry;
}
_isFatalError(error) {
return !utils.errno.isEnoentCodeError(error) && !this._settings.suppressErrors;
}
};
exports.default = Reader;
}
});
var require_stream3 = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/fast-glob@3.3.2/node_modules/fast-glob/out/readers/stream.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var stream_1 = (0, import_chunk_AH6QHEOA.__require)("stream");
var fsStat = require_out();
var fsWalk = require_out3();
var reader_1 = require_reader2();
var ReaderStream = class extends reader_1.default {
constructor() {
super(...arguments);
this._walkStream = fsWalk.walkStream;
this._stat = fsStat.stat;
}
dynamic(root, options) {
return this._walkStream(root, options);
}
static(patterns, options) {
const filepaths = patterns.map(this._getFullEntryPath, this);
const stream = new stream_1.PassThrough({ objectMode: true });
stream._write = (index, _enc, done) => {
return this._getEntry(filepaths[index], patterns[index], options).then((entry) => {
if (entry !== null && options.entryFilter(entry)) {
stream.push(entry);
}
if (index === filepaths.length - 1) {
stream.end();
}
done();
}).catch(done);
};
for (let i = 0; i < filepaths.length; i++) {
stream.write(i);
}
return stream;
}
_getEntry(filepath, pattern, options) {
return this._getStat(filepath).then((stats) => this._makeEntry(stats, pattern)).catch((error) => {
if (options.errorFilter(error)) {
return null;
}
throw error;
});
}
_getStat(filepath) {
return new Promise((resolve, reject) => {
this._stat(filepath, this._fsStatSettings, (error, stats) => {
return error === null ? resolve(stats) : reject(error);
});
});
}
};
exports.default = ReaderStream;
}
});
var require_async5 = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/fast-glob@3.3.2/node_modules/fast-glob/out/readers/async.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var fsWalk = require_out3();
var reader_1 = require_reader2();
var stream_1 = require_stream3();
var ReaderAsync = class extends reader_1.default {
constructor() {
super(...arguments);
this._walkAsync = fsWalk.walk;
this._readerStream = new stream_1.default(this._settings);
}
dynamic(root, options) {
return new Promise((resolve, reject) => {
this._walkAsync(root, options, (error, entries) => {
if (error === null) {
resolve(entries);
} else {
reject(error);
}
});
});
}
async static(patterns, options) {
const entries = [];
const stream = this._readerStream.static(patterns, options);
return new Promise((resolve, reject) => {
stream.once("error", reject);
stream.on("data", (entry) => entries.push(entry));
stream.once("end", () => resolve(entries));
});
}
};
exports.default = ReaderAsync;
}
});
var require_matcher = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/fast-glob@3.3.2/node_modules/fast-glob/out/providers/matchers/matcher.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var utils = require_utils3();
var Matcher = class {
constructor(_patterns, _settings, _micromatchOptions) {
this._patterns = _patterns;
this._settings = _settings;
this._micromatchOptions = _micromatchOptions;
this._storage = [];
this._fillStorage();
}
_fillStorage() {
for (const pattern of this._patterns) {
const segments = this._getPatternSegments(pattern);
const sections = this._splitSegmentsIntoSections(segments);
this._storage.push({
complete: sections.length <= 1,
pattern,
segments,
sections
});
}
}
_getPatternSegments(pattern) {
const parts = utils.pattern.getPatternParts(pattern, this._micromatchOptions);
return parts.map((part) => {
const dynamic = utils.pattern.isDynamicPattern(part, this._settings);
if (!dynamic) {
return {
dynamic: false,
pattern: part
};
}
return {
dynamic: true,
pattern: part,
patternRe: utils.pattern.makeRe(part, this._micromatchOptions)
};
});
}
_splitSegmentsIntoSections(segments) {
return utils.array.splitWhen(segments, (segment) => segment.dynamic && utils.pattern.hasGlobStar(segment.pattern));
}
};
exports.default = Matcher;
}
});
var require_partial = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/fast-glob@3.3.2/node_modules/fast-glob/out/providers/matchers/partial.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var 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 of patterns) {
const section = pattern.sections[0];
if (!pattern.complete && levels > section.length) {
return true;
}
const match = parts.every((part, index) => {
const segment = pattern.segments[index];
if (segment.dynamic && segment.patternRe.test(part)) {
return true;
}
if (!segment.dynamic && segment.pattern === part) {
return true;
}
return false;
});
if (match) {
return true;
}
}
return false;
}
};
exports.default = PartialMatcher;
}
});
var require_deep = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/fast-glob@3.3.2/node_modules/fast-glob/out/providers/filters/deep.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var utils = require_utils3();
var 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.pattern.isAffectDepthOfReadingPattern);
return utils.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.path.removeLeadingDotSegment(entry.path);
if (this._isSkippedByPositivePatterns(filepath, matcher)) {
return false;
}
return this._isSkippedByNegativePatterns(filepath, negativeRe);
}
_isSkippedByDeep(basePath, entryPath) {
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;
}
const basePathDepth = basePath.split("/").length;
return entryPathDepth - basePathDepth;
}
_isSkippedSymbolicLink(entry) {
return !this._settings.followSymbolicLinks && entry.dirent.isSymbolicLink();
}
_isSkippedByPositivePatterns(entryPath, matcher) {
return !this._settings.baseNameMatch && !matcher.match(entryPath);
}
_isSkippedByNegativePatterns(entryPath, patternsRe) {
return !utils.pattern.matchAny(entryPath, patternsRe);
}
};
exports.default = DeepFilter;
}
});
var require_entry = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/fast-glob@3.3.2/node_modules/fast-glob/out/providers/filters/entry.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var utils = require_utils3();
var EntryFilter = class {
constructor(_settings, _micromatchOptions) {
this._settings = _settings;
this._micromatchOptions = _micromatchOptions;
this.index = /* @__PURE__ */ new Map();
}
getFilter(positive, negative) {
const positiveRe = utils.pattern.convertPatternsToRe(positive, this._micromatchOptions);
const negativeRe = utils.pattern.convertPatternsToRe(negative, Object.assign(Object.assign({}, this._micromatchOptions), { dot: true }));
return (entry) => this._filter(entry, positiveRe, negativeRe);
}
_filter(entry, positiveRe, negativeRe) {
const filepath = utils.path.removeLeadingDotSegment(entry.path);
if (this._settings.unique && this._isDuplicateEntry(filepath)) {
return false;
}
if (this._onlyFileFilter(entry) || this._onlyDirectoryFilter(entry)) {
return false;
}
if (this._isSkippedByAbsoluteNegativePatterns(filepath, negativeRe)) {
return false;
}
const isDirectory = entry.dirent.isDirectory();
const isMatched = this._isMatchToPatterns(filepath, positiveRe, isDirectory) && !this._isMatchToPatterns(filepath, negativeRe, 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();
}
_isSkippedByAbsoluteNegativePatterns(entryPath, patternsRe) {
if (!this._settings.absolute) {
return false;
}
const fullpath = utils.path.makeAbsolute(this._settings.cwd, entryPath);
return utils.pattern.matchAny(fullpath, patternsRe);
}
_isMatchToPatterns(filepath, patternsRe, isDirectory) {
const isMatched = utils.pattern.matchAny(filepath, patternsRe);
if (!isMatched && isDirectory) {
return utils.pattern.matchAny(filepath + "/", patternsRe);
}
return isMatched;
}
};
exports.default = EntryFilter;
}
});
var require_error = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/fast-glob@3.3.2/node_modules/fast-glob/out/providers/filters/error.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var utils = require_utils3();
var ErrorFilter = class {
constructor(_settings) {
this._settings = _settings;
}
getFilter() {
return (error) => this._isNonFatalError(error);
}
_isNonFatalError(error) {
return utils.errno.isEnoentCodeError(error) || this._settings.suppressErrors;
}
};
exports.default = ErrorFilter;
}
});
var require_entry2 = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/fast-glob@3.3.2/node_modules/fast-glob/out/providers/transformers/entry.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var utils = require_utils3();
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.path.makeAbsolute(this._settings.cwd, filepath);
filepath = utils.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;
}
});
var require_provider = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/fast-glob@3.3.2/node_modules/fast-glob/out/providers/provider.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var path2 = (0, import_chunk_AH6QHEOA.__require)("path");
var deep_1 = require_deep();
var entry_1 = require_entry();
var error_1 = require_error();
var entry_2 = require_entry2();
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 path2.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;
}
});
var require_async6 = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/fast-glob@3.3.2/node_modules/fast-glob/out/providers/async.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var async_1 = require_async5();
var provider_1 = require_provider();
var ProviderAsync = class extends provider_1.default {
constructor() {
super(...arguments);
this._reader = new async_1.default(this._settings);
}
async read(task) {
const root = this._getRootDirectory(task);
const options = this._getReaderOptions(task);
const entries = await this.api(root, task, options);
return entries.map((entry) => options.transform(entry));
}
api(root, task, options) {
if (task.dynamic) {
return this._reader.dynamic(root, options);
}
return this._reader.static(task.patterns, options);
}
};
exports.default = ProviderAsync;
}
});
var require_stream4 = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/fast-glob@3.3.2/node_modules/fast-glob/out/providers/stream.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var stream_1 = (0, import_chunk_AH6QHEOA.__require)("stream");
var stream_2 = require_stream3();
var provider_1 = require_provider();
var ProviderStream = class extends provider_1.default {
constructor() {
super(...arguments);
this._reader = new stream_2.default(this._settings);
}
read(task) {
const root = this._getRootDirectory(task);
const options = this._getReaderOptions(task);
const source = this.api(root, task, options);
const destination = new stream_1.Readable({ objectMode: true, read: () => {
} });
source.once("error", (error) => destination.emit("error", error)).on("data", (entry) => destination.emit("data", options.transform(entry))).once("end", () => destination.emit("end"));
destination.once("close", () => source.destroy());
return destination;
}
api(root, task, options) {
if (task.dynamic) {
return this._reader.dynamic(root, options);
}
return this._reader.static(task.patterns, options);
}
};
exports.default = ProviderStream;
}
});
var require_sync5 = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/fast-glob@3.3.2/node_modules/fast-glob/out/readers/sync.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var fsStat = require_out();
var fsWalk = require_out3();
var reader_1 = require_reader2();
var ReaderSync = class extends reader_1.default {
constructor() {
super(...arguments);
this._walkSync = fsWalk.walkSync;
this._statSync = fsStat.statSync;
}
dynamic(root, options) {
return this._walkSync(root, options);
}
static(patterns, options) {
const entries = [];
for (const pattern of patterns) {
const filepath = this._getFullEntryPath(pattern);
const entry = this._getEntry(filepath, pattern, options);
if (entry === null || !options.entryFilter(entry)) {
continue;
}
entries.push(entry);
}
return entries;
}
_getEntry(filepath, pattern, options) {
try {
const stats = this._getStat(filepath);
return this._makeEntry(stats, pattern);
} catch (error) {
if (options.errorFilter(error)) {
return null;
}
throw error;
}
}
_getStat(filepath) {
return this._statSync(filepath, this._fsStatSettings);
}
};
exports.default = ReaderSync;
}
});
var require_sync6 = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/fast-glob@3.3.2/node_modules/fast-glob/out/providers/sync.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var sync_1 = require_sync5();
var provider_1 = require_provider();
var ProviderSync = class extends provider_1.default {
constructor() {
super(...arguments);
this._reader = new sync_1.default(this._settings);
}
read(task) {
const root = this._getRootDirectory(task);
const options = this._getReaderOptions(task);
const entries = this.api(root, task, options);
return entries.map(options.transform);
}
api(root, task, options) {
if (task.dynamic) {
return this._reader.dynamic(root, options);
}
return this._reader.static(task.patterns, options);
}
};
exports.default = ProviderSync;
}
});
var require_settings4 = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/fast-glob@3.3.2/node_modules/fast-glob/out/settings.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
var fs2 = (0, import_chunk_AH6QHEOA.__require)("fs");
var os = (0, import_chunk_AH6QHEOA.__require)("os");
var CPU_COUNT = Math.max(os.cpus().length, 1);
exports.DEFAULT_FILE_SYSTEM_ADAPTER = {
lstat: fs2.lstat,
lstatSync: fs2.lstatSync,
stat: fs2.stat,
statSync: fs2.statSync,
readdir: fs2.readdir,
readdirSync: fs2.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 = {}) {
return Object.assign(Object.assign({}, exports.DEFAULT_FILE_SYSTEM_ADAPTER), methods);
}
};
exports.default = Settings;
}
});
var require_out4 = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/fast-glob@3.3.2/node_modules/fast-glob/out/index.js"(exports, module2) {
"use strict";
var taskManager = require_tasks();
var async_1 = require_async6();
var stream_1 = require_stream4();
var sync_1 = require_sync6();
var settings_1 = require_settings4();
var utils = require_utils3();
async function FastGlob(source, options) {
assertPatternsInput(source);
const works = getWorks(source, async_1.default, options);
const result = await Promise.all(works);
return utils.array.flatten(result);
}
(function(FastGlob2) {
FastGlob2.glob = FastGlob2;
FastGlob2.globSync = sync;
FastGlob2.globStream = stream;
FastGlob2.async = FastGlob2;
function sync(source, options) {
assertPatternsInput(source);
const works = getWorks(source, sync_1.default, options);
return utils.array.flatten(works);
}
FastGlob2.sync = sync;
function stream(source, options) {
assertPatternsInput(source);
const works = getWorks(source, stream_1.default, options);
return utils.stream.merge(works);
}
FastGlob2.stream = stream;
function generateTasks(source, options) {
assertPatternsInput(source);
const patterns = [].concat(source);
const settings = new settings_1.default(options);
return taskManager.generate(patterns, settings);
}
FastGlob2.generateTasks = generateTasks;
function isDynamicPattern(source, options) {
assertPatternsInput(source);
const settings = new settings_1.default(options);
return utils.pattern.isDynamicPattern(source, settings);
}
FastGlob2.isDynamicPattern = isDynamicPattern;
function escapePath(source) {
assertPatternsInput(source);
return utils.path.escape(source);
}
FastGlob2.escapePath = escapePath;
function convertPathToPattern(source) {
assertPatternsInput(source);
return utils.path.convertPathToPattern(source);
}
FastGlob2.convertPathToPattern = convertPathToPattern;
let posix;
(function(posix2) {
function escapePath2(source) {
assertPatternsInput(source);
return utils.path.escapePosixPath(source);
}
posix2.escapePath = escapePath2;
function convertPathToPattern2(source) {
assertPatternsInput(source);
return utils.path.convertPosixPathToPattern(source);
}
posix2.convertPathToPattern = convertPathToPattern2;
})(posix = FastGlob2.posix || (FastGlob2.posix = {}));
let win32;
(function(win322) {
function escapePath2(source) {
assertPatternsInput(source);
return utils.path.escapeWindowsPath(source);
}
win322.escapePath = escapePath2;
function convertPathToPattern2(source) {
assertPatternsInput(source);
return utils.path.convertWindowsPathToPattern(source);
}
win322.convertPathToPattern = convertPathToPattern2;
})(win32 = FastGlob2.win32 || (FastGlob2.win32 = {}));
})(FastGlob || (FastGlob = {}));
function getWorks(source, _Provider, options) {
const patterns = [].concat(source);
const settings = new settings_1.default(options);
const tasks = taskManager.generate(patterns, settings);
const provider = new _Provider(settings);
return tasks.map(provider.read, provider);
}
function assertPatternsInput(input) {
const source = [].concat(input);
const isValidSource = source.every((item) => utils.string.isString(item) && !utils.string.isEmpty(item));
if (!isValidSource) {
throw new TypeError("Patterns must be a string (non empty) or an array of strings");
}
}
module2.exports = FastGlob;
}
});
var require_path_type = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/path-type@4.0.0/node_modules/path-type/index.js"(exports) {
"use strict";
var { promisify: promisify3 } = (0, import_chunk_AH6QHEOA.__require)("util");
var fs2 = (0, import_chunk_AH6QHEOA.__require)("fs");
async function isType(fsStatType, statsMethodName, filePath) {
if (typeof filePath !== "string") {
throw new TypeError(`Expected a string, got ${typeof filePath}`);
}
try {
const stats = await promisify3(fs2[fsStatType])(filePath);
return stats[statsMethodName]();
} catch (error) {
if (error.code === "ENOENT") {
return false;
}
throw error;
}
}
function isTypeSync(fsStatType, statsMethodName, filePath) {
if (typeof filePath !== "string") {
throw new TypeError(`Expected a string, got ${typeof filePath}`);
}
try {
return fs2[fsStatType](filePath)[statsMethodName]();
} catch (error) {
if (error.code === "ENOENT") {
return false;
}
throw error;
}
}
exports.isFile = isType.bind(null, "stat", "isFile");
exports.isDirectory = isType.bind(null, "stat", "isDirectory");
exports.isSymlink = isType.bind(null, "lstat", "isSymbolicLink");
exports.isFileSync = isTypeSync.bind(null, "statSync", "isFile");
exports.isDirectorySync = isTypeSync.bind(null, "statSync", "isDirectory");
exports.isSymlinkSync = isTypeSync.bind(null, "lstatSync", "isSymbolicLink");
}
});
var require_dir_glob = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/dir-glob@3.0.1/node_modules/dir-glob/index.js"(exports, module2) {
"use strict";
var path2 = (0, import_chunk_AH6QHEOA.__require)("path");
var pathType = require_path_type();
var getExtensions = (extensions) => extensions.length > 1 ? `{${extensions.join(",")}}` : extensions[0];
var getPath = (filepath, cwd) => {
const pth = filepath[0] === "!" ? filepath.slice(1) : filepath;
return path2.isAbsolute(pth) ? pth : path2.join(cwd, pth);
};
var addExtensions = (file, extensions) => {
if (path2.extname(file)) {
return `**/${file}`;
}
return `**/${file}.${getExtensions(extensions)}`;
};
var getGlob = (directory, options) => {
if (options.files && !Array.isArray(options.files)) {
throw new TypeError(`Expected \`files\` to be of type \`Array\` but received type \`${typeof options.files}\``);
}
if (options.extensions && !Array.isArray(options.extensions)) {
throw new TypeError(`Expected \`extensions\` to be of type \`Array\` but received type \`${typeof options.extensions}\``);
}
if (options.files && options.extensions) {
return options.files.map((x) => path2.posix.join(directory, addExtensions(x, options.extensions)));
}
if (options.files) {
return options.files.map((x) => path2.posix.join(directory, `**/${x}`));
}
if (options.extensions) {
return [path2.posix.join(directory, `**/*.${getExtensions(options.extensions)}`)];
}
return [path2.posix.join(directory, "**")];
};
module2.exports = async (input, options) => {
options = {
cwd: process.cwd(),
...options
};
if (typeof options.cwd !== "string") {
throw new TypeError(`Expected \`cwd\` to be of type \`string\` but received type \`${typeof options.cwd}\``);
}
const globs = await Promise.all([].concat(input).map(async (x) => {
const isDirectory = await pathType.isDirectory(getPath(x, options.cwd));
return isDirectory ? getGlob(x, options) : x;
}));
return [].concat.apply([], globs);
};
module2.exports.sync = (input, options) => {
options = {
cwd: process.cwd(),
...options
};
if (typeof options.cwd !== "string") {
throw new TypeError(`Expected \`cwd\` to be of type \`string\` but received type \`${typeof options.cwd}\``);
}
const globs = [].concat(input).map((x) => pathType.isDirectorySync(getPath(x, options.cwd)) ? getGlob(x, options) : x);
return [].concat.apply([], globs);
};
}
});
var require_ignore = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/ignore@5.2.4/node_modules/ignore/index.js"(exports, module2) {
"use strict";
function makeArray(subject) {
return Array.isArray(subject) ? subject : [subject];
}
var EMPTY = "";
var SPACE = " ";
var ESCAPE = "\\";
var REGEX_TEST_BLANK_LINE = /^\s+$/;
var REGEX_INVALID_TRAILING_BACKSLASH = /(?:[^\\]|^)\\$/;
var REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/;
var REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/;
var REGEX_SPLITALL_CRLF = /\r?\n/g;
var REGEX_TEST_INVALID_PATH = /^\.*\/|^\.+$/;
var SLASH = "/";
var TMP_KEY_IGNORE = "node-ignore";
if (typeof Symbol !== "undefined") {
TMP_KEY_IGNORE = Symbol.for("node-ignore");
}
var KEY_IGNORE = TMP_KEY_IGNORE;
var define = (object, key, value) => Object.defineProperty(object, key, { value });
var REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g;
var RETURN_FALSE = () => false;
var sanitizeRange = (range) => range.replace(
REGEX_REGEXP_RANGE,
(match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0) ? match : EMPTY
);
var cleanRangeBackSlash = (slashes) => {
const { length } = slashes;
return slashes.slice(0, length - length % 2);
};
var REPLACERS = [
// > Trailing spaces are ignored unless they are quoted with backslash ("\")
[
// (a\ ) -> (a )
// (a ) -> (a)
// (a \ ) -> (a )
/\\?\s+$/,
(match) => match.indexOf("\\") === 0 ? SPACE : EMPTY
],
// replace (\ ) with ' '
[
/\\\s/g,
() => SPACE
],
// Escape metacharacters
// which is written down by users but means special for regular expressions.
// > There are 12 characters with special meanings:
// > - the backslash \,
// > - the caret ^,
// > - the dollar sign $,
// > - the period or dot .,
// > - the vertical bar or pipe symbol |,
// > - the question mark ?,
// > - the asterisk or star *,
// > - the plus sign +,
// > - the opening parenthesis (,
// > - the closing parenthesis ),
// > - and the opening square bracket [,
// > - the opening curly brace {,
// > These special characters are often called "metacharacters".
[
/[\\$.|*+(){^]/g,
(match) => `\\${match}`
],
[
// > a question mark (?) matches a single character
/(?!\\)\?/g,
() => "[^/]"
],
// leading slash
[
// > A leading slash matches the beginning of the pathname.
// > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".
// A leading slash matches the beginning of the pathname
/^\//,
() => "^"
],
// replace special metacharacter slash after the leading slash
[
/\//g,
() => "\\/"
],
[
// > A leading "**" followed by a slash means match in all directories.
// > For example, "**/foo" matches file or directory "foo" anywhere,
// > the same as pattern "foo".
// > "**/foo/bar" matches file or directory "bar" anywhere that is directly
// > under directory "foo".
// Notice that the '*'s have been replaced as '\\*'
/^\^*\\\*\\\*\\\//,
// '**/foo' <-> 'foo'
() => "^(?:.*\\/)?"
],
// starting
[
// there will be no leading '/'
// (which has been replaced by section "leading slash")
// If starts with '**', adding a '^' to the regular expression also works
/^(?=[^^])/,
function startingReplacer() {
return !/\/(?!$)/.test(this) ? "(?:^|\\/)" : "^";
}
],
// two globstars
[
// Use lookahead assertions so that we could match more than one `'/**'`
/\\\/\\\*\\\*(?=\\\/|$)/g,
// Zero, one or several directories
// should not use '*', or it will be replaced by the next replacer
// Check if it is not the last `'/**'`
(_, index, str) => index + 6 < str.length ? "(?:\\/[^\\/]+)*" : "\\/.+"
],
// normal intermediate wildcards
[
// Never replace escaped '*'
// ignore rule '\*' will match the path '*'
// 'abc.*/' -> go
// 'abc.*' -> skip this rule,
// coz trailing single wildcard will be handed by [trailing wildcard]
/(^|[^\\]+)(\\\*)+(?=.+)/g,
// '*.js' matches '.js'
// '*.js' doesn't match 'abc'
(_, p1, p2) => {
const unescaped = p2.replace(/\\\*/g, "[^\\/]*");
return p1 + unescaped;
}
],
[
// unescape, revert step 3 except for back slash
// For example, if a user escape a '\\*',
// after step 3, the result will be '\\\\\\*'
/\\\\\\(?=[$.|*+(){^])/g,
() => ESCAPE
],
[
// '\\\\' -> '\\'
/\\\\/g,
() => ESCAPE
],
[
// > The range notation, e.g. [a-zA-Z],
// > can be used to match one of the characters in a range.
// `\` is escaped by step 3
/(\\)?\[([^\]/]*?)(\\*)($|\])/g,
(match, leadEscape, range, endEscape, close) => leadEscape === ESCAPE ? `\\[${range}${cleanRangeBackSlash(endEscape)}${close}` : close === "]" ? endEscape.length % 2 === 0 ? `[${sanitizeRange(range)}${endEscape}]` : "[]" : "[]"
],
// ending
[
// 'js' will not match 'js.'
// 'ab' will not match 'abc'
/(?:[^*])$/,
// WTF!
// https://git-scm.com/docs/gitignore
// changes in [2.22.1](https://git-scm.com/docs/gitignore/2.22.1)
// which re-fixes #24, #38
// > If there is a separator at the end of the pattern then the pattern
// > will only match directories, otherwise the pattern can match both
// > files and directories.
// 'js*' will not match 'a.js'
// 'js/' will not match 'a.js'
// 'js' will match 'a.js' and 'a.js/'
(match) => /\/$/.test(match) ? `${match}$` : `${match}(?=$|\\/$)`
],
// trailing wildcard
[
/(\^|\\\/)?\\\*$/,
(_, p1) => {
const prefix = p1 ? `${p1}[^/]+` : "[^/]*";
return `${prefix}(?=$|\\/$)`;
}
]
];
var regexCache = /* @__PURE__ */ Object.create(null);
var makeRegex = (pattern, ignoreCase) => {
let source = regexCache[pattern];
if (!source) {
source = REPLACERS.reduce(
(prev, current) => prev.replace(current[0], current[1].bind(pattern)),
pattern
);
regexCache[pattern] = source;
}
return ignoreCase ? new RegExp(source, "i") : new RegExp(source);
};
var isString = (subject) => typeof subject === "string";
var checkPattern = (pattern) => pattern && isString(pattern) && !REGEX_TEST_BLANK_LINE.test(pattern) && !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern) && pattern.indexOf("#") !== 0;
var splitPattern = (pattern) => pattern.split(REGEX_SPLITALL_CRLF);
var IgnoreRule = class {
constructor(origin, pattern, negative, regex) {
this.origin = origin;
this.pattern = pattern;
this.negative = negative;
this.regex = regex;
}
};
var createRule = (pattern, ignoreCase) => {
const origin = pattern;
let negative = false;
if (pattern.indexOf("!") === 0) {
negative = true;
pattern = pattern.substr(1);
}
pattern = pattern.replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, "!").replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, "#");
const regex = makeRegex(pattern, ignoreCase);
return new IgnoreRule(
origin,
pattern,
negative,
regex
);
};
var throwError = (message, Ctor) => {
throw new Ctor(message);
};
var checkPath = (path2, originalPath, doThrow) => {
if (!isString(path2)) {
return doThrow(
`path must be a string, but got \`${originalPath}\``,
TypeError
);
}
if (!path2) {
return doThrow(`path must not be empty`, TypeError);
}
if (checkPath.isNotRelative(path2)) {
const r = "`path.relative()`d";
return doThrow(
`path should be a ${r} string, but got "${originalPath}"`,
RangeError
);
}
return true;
};
var isNotRelative = (path2) => REGEX_TEST_INVALID_PATH.test(path2);
checkPath.isNotRelative = isNotRelative;
checkPath.convert = (p) => p;
var Ignore = class {
constructor({
ignorecase = true,
ignoreCase = ignorecase,
allowRelativePaths = false
} = {}) {
define(this, KEY_IGNORE, true);
this._rules = [];
this._ignoreCase = ignoreCase;
this._allowRelativePaths = allowRelativePaths;
this._initCache();
}
_initCache() {
this._ignoreCache = /* @__PURE__ */ Object.create(null);
this._testCache = /* @__PURE__ */ Object.create(null);
}
_addPattern(pattern) {
if (pattern && pattern[KEY_IGNORE]) {
this._rules = this._rules.concat(pattern._rules);
this._added = true;
return;
}
if (checkPattern(pattern)) {
const rule = createRule(pattern, this._ignoreCase);
this._added = true;
this._rules.push(rule);
}
}
// @param {Array<string> | string | Ignore} pattern
add(pattern) {
this._added = false;
makeArray(
isString(pattern) ? splitPattern(pattern) : pattern
).forEach(this._addPattern, this);
if (this._added) {
this._initCache();
}
return this;
}
// legacy
addPattern(pattern) {
return this.add(pattern);
}
// | ignored : unignored
// negative | 0:0 | 0:1 | 1:0 | 1:1
// -------- | ------- | ------- | ------- | --------
// 0 | TEST | TEST | SKIP | X
// 1 | TESTIF | SKIP | TEST | X
// - SKIP: always skip
// - TEST: always test
// - TESTIF: only test if checkUnignored
// - X: that never happen
// @param {boolean} whether should check if the path is unignored,
// setting `checkUnignored` to `false` could reduce additional
// path matching.
// @returns {TestResult} true if a file is ignored
_testOne(path2, checkUnignored) {
let ignored = false;
let unignored = false;
this._rules.forEach((rule) => {
const { negative } = rule;
if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
return;
}
const matched = rule.regex.test(path2);
if (matched) {
ignored = !negative;
unignored = negative;
}
});
return {
ignored,
unignored
};
}
// @returns {TestResult}
_test(originalPath, cache, checkUnignored, slices) {
const path2 = originalPath && checkPath.convert(originalPath);
checkPath(
path2,
originalPath,
this._allowRelativePaths ? RETURN_FALSE : throwError
);
return this._t(path2, cache, checkUnignored, slices);
}
_t(path2, cache, checkUnignored, slices) {
if (path2 in cache) {
return cache[path2];
}
if (!slices) {
slices = path2.split(SLASH);
}
slices.pop();
if (!slices.length) {
return cache[path2] = this._testOne(path2, checkUnignored);
}
const parent = this._t(
slices.join(SLASH) + SLASH,
cache,
checkUnignored,
slices
);
return cache[path2] = parent.ignored ? parent : this._testOne(path2, checkUnignored);
}
ignores(path2) {
return this._test(path2, this._ignoreCache, false).ignored;
}
createFilter() {
return (path2) => !this.ignores(path2);
}
filter(paths) {
return makeArray(paths).filter(this.createFilter());
}
// @returns {TestResult}
test(path2) {
return this._test(path2, this._testCache, true);
}
};
var factory = (options) => new Ignore(options);
var isPathValid = (path2) => checkPath(path2 && checkPath.convert(path2), path2, RETURN_FALSE);
factory.isPathValid = isPathValid;
factory.default = factory;
module2.exports = factory;
if (
// Detect `process` so that it can run in browsers.
typeof process !== "undefined" && (process.env && process.env.IGNORE_TEST_WIN32 || process.platform === "win32")
) {
const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
checkPath.convert = makePosix;
const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
checkPath.isNotRelative = (path2) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path2) || isNotRelative(path2);
}
}
});
var require_slash = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/slash@3.0.0/node_modules/slash/index.js"(exports, module2) {
"use strict";
module2.exports = (path2) => {
const isExtendedLengthPath = /^\\\\\?\\/.test(path2);
const hasNonAscii = /[^\u0000-\u0080]+/.test(path2);
if (isExtendedLengthPath || hasNonAscii) {
return path2;
}
return path2.replace(/\\/g, "/");
};
}
});
var require_gitignore = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/globby@11.1.0/node_modules/globby/gitignore.js"(exports, module2) {
"use strict";
var { promisify: promisify3 } = (0, import_chunk_AH6QHEOA.__require)("util");
var fs2 = (0, import_chunk_AH6QHEOA.__require)("fs");
var path2 = (0, import_chunk_AH6QHEOA.__require)("path");
var fastGlob = require_out4();
var gitIgnore = require_ignore();
var slash = require_slash();
var DEFAULT_IGNORE = [
"**/node_modules/**",
"**/flow-typed/**",
"**/coverage/**",
"**/.git"
];
var readFileP = promisify3(fs2.readFile);
var mapGitIgnorePatternTo = (base) => (ignore) => {
if (ignore.startsWith("!")) {
return "!" + path2.posix.join(base, ignore.slice(1));
}
return path2.posix.join(base, ignore);
};
var parseGitIgnore = (content, options) => {
const base = slash(path2.relative(options.cwd, path2.dirname(options.fileName)));
return content.split(/\r?\n/).filter(Boolean).filter((line) => !line.startsWith("#")).map(mapGitIgnorePatternTo(base));
};
var reduceIgnore = (files) => {
const ignores = gitIgnore();
for (const file of files) {
ignores.add(parseGitIgnore(file.content, {
cwd: file.cwd,
fileName: file.filePath
}));
}
return ignores;
};
var ensureAbsolutePathForCwd = (cwd, p) => {
cwd = slash(cwd);
if (path2.isAbsolute(p)) {
if (slash(p).startsWith(cwd)) {
return p;
}
throw new Error(`Path ${p} is not in cwd ${cwd}`);
}
return path2.join(cwd, p);
};
var getIsIgnoredPredecate = (ignores, cwd) => {
return (p) => ignores.ignores(slash(path2.relative(cwd, ensureAbsolutePathForCwd(cwd, p.path || p))));
};
var getFile = async (file, cwd) => {
const filePath = path2.join(cwd, file);
const content = await readFileP(filePath, "utf8");
return {
cwd,
filePath,
content
};
};
var getFileSync = (file, cwd) => {
const filePath = path2.join(cwd, file);
const content = fs2.readFileSync(filePath, "utf8");
return {
cwd,
filePath,
content
};
};
var normalizeOptions = ({
ignore = [],
cwd = slash(process.cwd())
} = {}) => {
return { ignore, cwd };
};
module2.exports = async (options) => {
options = normalizeOptions(options);
const paths = await fastGlob("**/.gitignore", {
ignore: DEFAULT_IGNORE.concat(options.ignore),
cwd: options.cwd
});
const files = await Promise.all(paths.map((file) => getFile(file, options.cwd)));
const ignores = reduceIgnore(files);
return getIsIgnoredPredecate(ignores, options.cwd);
};
module2.exports.sync = (options) => {
options = normalizeOptions(options);
const paths = fastGlob.sync("**/.gitignore", {
ignore: DEFAULT_IGNORE.concat(options.ignore),
cwd: options.cwd
});
const files = paths.map((file) => getFileSync(file, options.cwd));
const ignores = reduceIgnore(files);
return getIsIgnoredPredecate(ignores, options.cwd);
};
}
});
var require_stream_utils = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/globby@11.1.0/node_modules/globby/stream-utils.js"(exports, module2) {
"use strict";
var { Transform } = (0, import_chunk_AH6QHEOA.__require)("stream");
var ObjectTransform = class extends Transform {
constructor() {
super({
objectMode: true
});
}
};
var FilterStream = class extends ObjectTransform {
constructor(filter) {
super();
this._filter = filter;
}
_transform(data, encoding, callback) {
if (this._filter(data)) {
this.push(data);
}
callback();
}
};
var UniqueStream = class extends ObjectTransform {
constructor() {
super();
this._pushed = /* @__PURE__ */ new Set();
}
_transform(data, encoding, callback) {
if (!this._pushed.has(data)) {
this.push(data);
this._pushed.add(data);
}
callback();
}
};
module2.exports = {
FilterStream,
UniqueStream
};
}
});
var require_globby = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/globby@11.1.0/node_modules/globby/index.js"(exports, module2) {
"use strict";
var fs2 = (0, import_chunk_AH6QHEOA.__require)("fs");
var arrayUnion = require_array_union();
var merge2 = require_merge2();
var fastGlob = require_out4();
var dirGlob = require_dir_glob();
var gitignore = require_gitignore();
var { FilterStream, UniqueStream } = require_stream_utils();
var DEFAULT_FILTER = () => false;
var isNegative = (pattern) => pattern[0] === "!";
var assertPatternsInput = (patterns) => {
if (!patterns.every((pattern) => typeof pattern === "string")) {
throw new TypeError("Patterns must be a string or an array of strings");
}
};
var checkCwdOption = (options = {}) => {
if (!options.cwd) {
return;
}
let stat;
try {
stat = fs2.statSync(options.cwd);
} catch {
return;
}
if (!stat.isDirectory()) {
throw new Error("The `cwd` option must be a path to a directory");
}
};
var getPathString = (p) => p.stats instanceof fs2.Stats ? p.path : p;
var generateGlobTasks = (patterns, taskOptions) => {
patterns = arrayUnion([].concat(patterns));
assertPatternsInput(patterns);
checkCwdOption(taskOptions);
const globTasks = [];
taskOptions = {
ignore: [],
expandDirectories: true,
...taskOptions
};
for (const [index, pattern] of patterns.entries()) {
if (isNegative(pattern)) {
continue;
}
const ignore = patterns.slice(index).filter((pattern2) => isNegative(pattern2)).map((pattern2) => pattern2.slice(1));
const options = {
...taskOptions,
ignore: taskOptions.ignore.concat(ignore)
};
globTasks.push({ pattern, options });
}
return globTasks;
};
var globDirs = (task, fn) => {
let options = {};
if (task.options.cwd) {
options.cwd = task.options.cwd;
}
if (Array.isArray(task.options.expandDirectories)) {
options = {
...options,
files: task.options.expandDirectories
};
} else if (typeof task.options.expandDirectories === "object") {
options = {
...options,
...task.options.expandDirectories
};
}
return fn(task.pattern, options);
};
var getPattern = (task, fn) => task.options.expandDirectories ? globDirs(task, fn) : [task.pattern];
var getFilterSync = (options) => {
return options && options.gitignore ? gitignore.sync({ cwd: options.cwd, ignore: options.ignore }) : DEFAULT_FILTER;
};
var globToTask = (task) => (glob) => {
const { options } = task;
if (options.ignore && Array.isArray(options.ignore) && options.expandDirectories) {
options.ignore = dirGlob.sync(options.ignore);
}
return {
pattern: glob,
options
};
};
module2.exports = async (patterns, options) => {
const globTasks = generateGlobTasks(patterns, options);
const getFilter = async () => {
return options && options.gitignore ? gitignore({ cwd: options.cwd, ignore: options.ignore }) : DEFAULT_FILTER;
};
const getTasks = async () => {
const tasks2 = await Promise.all(globTasks.map(async (task) => {
const globs = await getPattern(task, dirGlob);
return Promise.all(globs.map(globToTask(task)));
}));
return arrayUnion(...tasks2);
};
const [filter, tasks] = await Promise.all([getFilter(), getTasks()]);
const paths = await Promise.all(tasks.map((task) => fastGlob(task.pattern, task.options)));
return arrayUnion(...paths).filter((path_) => !filter(getPathString(path_)));
};
module2.exports.sync = (patterns, options) => {
const globTasks = generateGlobTasks(patterns, options);
const tasks = [];
for (const task of globTasks) {
const newTask = getPattern(task, dirGlob.sync).map(globToTask(task));
tasks.push(...newTask);
}
const filter = getFilterSync(options);
let matches = [];
for (const task of tasks) {
matches = arrayUnion(matches, fastGlob.sync(task.pattern, task.options));
}
return matches.filter((path_) => !filter(path_));
};
module2.exports.stream = (patterns, options) => {
const globTasks = generateGlobTasks(patterns, options);
const tasks = [];
for (const task of globTasks) {
const newTask = getPattern(task, dirGlob.sync).map(globToTask(task));
tasks.push(...newTask);
}
const filter = getFilterSync(options);
const filterStream = new FilterStream((p) => !filter(p));
const uniqueStream = new UniqueStream();
return merge2(tasks.map((task) => fastGlob.stream(task.pattern, task.options))).pipe(filterStream).pipe(uniqueStream);
};
module2.exports.generateGlobTasks = generateGlobTasks;
module2.exports.hasMagic = (patterns, options) => [].concat(patterns).some((pattern) => fastGlob.isDynamicPattern(pattern, options));
module2.exports.gitignore = gitignore;
}
});
var require_is_path_cwd = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/is-path-cwd@2.2.0/node_modules/is-path-cwd/index.js"(exports, module2) {
"use strict";
var path2 = (0, import_chunk_AH6QHEOA.__require)("path");
module2.exports = (path_) => {
let cwd = process.cwd();
path_ = path2.resolve(path_);
if (process.platform === "win32") {
cwd = cwd.toLowerCase();
path_ = path_.toLowerCase();
}
return path_ === cwd;
};
}
});
var require_is_path_inside = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/is-path-inside@3.0.3/node_modules/is-path-inside/index.js"(exports, module2) {
"use strict";
var path2 = (0, import_chunk_AH6QHEOA.__require)("path");
module2.exports = (childPath, parentPath) => {
const relation = path2.relative(parentPath, childPath);
return Boolean(
relation && relation !== ".." && !relation.startsWith(`..${path2.sep}`) && relation !== path2.resolve(childPath)
);
};
}
});
var require_del = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/del@6.1.1/node_modules/del/index.js"(exports, module2) {
"use strict";
var { promisify: promisify3 } = (0, import_chunk_AH6QHEOA.__require)("util");
var path2 = (0, import_chunk_AH6QHEOA.__require)("path");
var globby = require_globby();
var isGlob = require_is_glob();
var slash = require_slash();
var gracefulFs = (0, import_chunk_FQ2BOR66.require_graceful_fs)();
var isPathCwd = require_is_path_cwd();
var isPathInside = require_is_path_inside();
var rimraf2 = (0, import_chunk_RGVHWUUH.require_rimraf)();
var pMap = (0, import_chunk_RGVHWUUH.require_p_map)();
var rimrafP = promisify3(rimraf2);
var rimrafOptions = {
glob: false,
unlink: gracefulFs.unlink,
unlinkSync: gracefulFs.unlinkSync,
chmod: gracefulFs.chmod,
chmodSync: gracefulFs.chmodSync,
stat: gracefulFs.stat,
statSync: gracefulFs.statSync,
lstat: gracefulFs.lstat,
lstatSync: gracefulFs.lstatSync,
rmdir: gracefulFs.rmdir,
rmdirSync: gracefulFs.rmdirSync,
readdir: gracefulFs.readdir,
readdirSync: gracefulFs.readdirSync
};
function safeCheck(file, cwd) {
if (isPathCwd(file)) {
throw new Error("Cannot delete the current working directory. Can be overridden with the `force` option.");
}
if (!isPathInside(file, cwd)) {
throw new Error("Cannot delete files/directories outside the current working directory. Can be overridden with the `force` option.");
}
}
function normalizePatterns(patterns) {
patterns = Array.isArray(patterns) ? patterns : [patterns];
patterns = patterns.map((pattern) => {
if (process.platform === "win32" && isGlob(pattern) === false) {
return slash(pattern);
}
return pattern;
});
return patterns;
}
module2.exports = async (patterns, { force, dryRun, cwd = process.cwd(), onProgress = () => {
}, ...options } = {}) => {
options = {
expandDirectories: false,
onlyFiles: false,
followSymbolicLinks: false,
cwd,
...options
};
patterns = normalizePatterns(patterns);
const files = (await globby(patterns, options)).sort((a, b) => b.localeCompare(a));
if (files.length === 0) {
onProgress({
totalCount: 0,
deletedCount: 0,
percent: 1
});
}
let deletedCount = 0;
const mapper = async (file) => {
file = path2.resolve(cwd, file);
if (!force) {
safeCheck(file, cwd);
}
if (!dryRun) {
await rimrafP(file, rimrafOptions);
}
deletedCount += 1;
onProgress({
totalCount: files.length,
deletedCount,
percent: deletedCount / files.length
});
return file;
};
const removedFiles = await pMap(files, mapper, options);
removedFiles.sort((a, b) => a.localeCompare(b));
return removedFiles;
};
module2.exports.sync = (patterns, { force, dryRun, cwd = process.cwd(), ...options } = {}) => {
options = {
expandDirectories: false,
onlyFiles: false,
followSymbolicLinks: false,
cwd,
...options
};
patterns = normalizePatterns(patterns);
const files = globby.sync(patterns, options).sort((a, b) => b.localeCompare(a));
const removedFiles = files.map((file) => {
file = path2.resolve(cwd, file);
if (!force) {
safeCheck(file, cwd);
}
if (!dryRun) {
rimraf2.sync(file, rimrafOptions);
}
return file;
});
removedFiles.sort((a, b) => a.localeCompare(b));
return removedFiles;
};
}
});
var require_tempy = (0, import_chunk_AH6QHEOA.__commonJS)({
"../../node_modules/.pnpm/tempy@1.0.1/node_modules/tempy/index.js"(exports, module2) {
"use strict";
var fs2 = (0, import_chunk_AH6QHEOA.__require)("fs");
var path2 = (0, import_chunk_AH6QHEOA.__require)("path");
var uniqueString = require_unique_string();
var tempDir = require_temp_dir();
var isStream = require_is_stream();
var del2 = require_del();
var stream = (0, import_chunk_AH6QHEOA.__require)("stream");
var { promisify: promisify3 } = (0, import_chunk_AH6QHEOA.__require)("util");
var pipeline2 = promisify3(stream.pipeline);
var { writeFile } = fs2.promises;
var getPath = (prefix = "") => path2.join(tempDir, prefix + uniqueString());
var writeStream = async (filePath, data) => pipeline2(data, fs2.createWriteStream(filePath));
var createTask = (tempyFunction, { extraArguments = 0 } = {}) => async (...arguments_) => {
const [callback, options] = arguments_.slice(extraArguments);
const result = await tempyFunction(...arguments_.slice(0, extraArguments), options);
try {
return await callback(result);
} finally {
await del2(result, { force: true });
}
};
module2.exports.file = (options) => {
options = {
...options
};
if (options.name) {
if (options.extension !== void 0 && options.extension !== null) {
throw new Error("The `name` and `extension` options are mutually exclusive");
}
return path2.join(module2.exports.directory(), options.name);
}
return getPath() + (options.extension === void 0 || options.extension === null ? "" : "." + options.extension.replace(/^\./, ""));
};
module2.exports.file.task = createTask(module2.exports.file);
module2.exports.directory = ({ prefix = "" } = {}) => {
const directory = getPath(prefix);
fs2.mkdirSync(directory);
return directory;
};
module2.exports.directory.task = createTask(module2.exports.directory);
module2.exports.write = async (data, options) => {
const filename = module2.exports.file(options);
const write = isStream(data) ? writeStream : writeFile;
await write(filename, data);
return filename;
};
module2.exports.write.task = createTask(module2.exports.write, { extraArguments: 1 });
module2.exports.writeSync = (data, options) => {
const filename = module2.exports.file(options);
fs2.writeFileSync(filename, data);
return filename;
};
Object.defineProperty(module2.exports, "root", {
get() {
return tempDir;
}
});
}
});
var import_hasha = (0, import_chunk_AH6QHEOA.__toESM)(require_hasha());
function dataUriToBuffer(uri) {
if (!/^data:/i.test(uri)) {
throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")');
}
uri = uri.replace(/\r?\n/g, "");
const firstComma = uri.indexOf(",");
if (firstComma === -1 || firstComma <= 4) {
throw new TypeError("malformed data: URI");
}
const meta = uri.substring(5, firstComma).split(";");
let charset = "";
let base64 = false;
const type = meta[0] || "text/plain";
let typeFull = type;
for (let i = 1; i < meta.length; i++) {
if (meta[i] === "base64") {
base64 = true;
} else if (meta[i]) {
typeFull += `;${meta[i]}`;
if (meta[i].indexOf("charset=") === 0) {
charset = meta[i].substring(8);
}
}
}
if (!meta[0] && !charset.length) {
typeFull += ";charset=US-ASCII";
charset = "US-ASCII";
}
const encoding = base64 ? "base64" : "ascii";
const data = unescape(uri.substring(firstComma + 1));
const buffer = Buffer.from(data, encoding);
buffer.type = type;
buffer.typeFull = typeFull;
buffer.charset = charset;
return buffer;
}
var dist_default = dataUriToBuffer;
var FetchBaseError = class extends Error {
constructor(message, type) {
super(message);
Error.captureStackTrace(this, this.constructor);
this.type = type;
}
get name() {
return this.constructor.name;
}
get [Symbol.toStringTag]() {
return this.constructor.name;
}
};
var FetchError = class extends FetchBaseError {
/**
* @param {string} message - Error message for human
* @param {string} [type] - Error type for machine
* @param {SystemError} [systemError] - For Node.js system error
*/
constructor(message, type, systemError) {
super(message, type);
if (systemError) {
this.code = this.errno = systemError.code;
this.erroredSysCall = systemError.syscall;
}
}
};
var NAME = Symbol.toStringTag;
var isURLSearchParameters = (object) => {
return typeof object === "object" && typeof object.append === "function" && typeof object.delete === "function" && typeof object.get === "function" && typeof object.getAll === "function" && typeof object.has === "function" && typeof object.set === "function" && typeof object.sort === "function" && object[NAME] === "URLSearchParams";
};
var isBlob = (object) => {
return object && typeof object === "object" && typeof object.arrayBuffer === "function" && typeof object.type === "string" && typeof object.stream === "function" && typeof object.constructor === "function" && /^(Blob|File)$/.test(object[NAME]);
};
var isAbortSignal = (object) => {
return typeof object === "object" && (object[NAME] === "AbortSignal" || object[NAME] === "EventTarget");
};
var isDomainOrSubdomain = (destination, original) => {
const orig = new URL(original).hostname;
const dest = new URL(destination).hostname;
return orig === dest || orig.endsWith(`.${dest}`);
};
var isSameProtocol = (destination, original) => {
const orig = new URL(original).protocol;
const dest = new URL(destination).protocol;
return orig === dest;
};
var pipeline = (0, import_util.promisify)(import_stream2.default.pipeline);
var INTERNALS = Symbol("Body internals");
var Body = class {
constructor(body, {
size = 0
} = {}) {
let boundary = null;
if (body === null) {
body = null;
} else if (isURLSearchParameters(body)) {
body = import_buffer2.Buffer.from(body.toString());
} else if (isBlob(body)) {
} else if (import_buffer2.Buffer.isBuffer(body)) {
} else if (import_util.types.isAnyArrayBuffer(body)) {
body = import_buffer2.Buffer.from(body);
} else if (ArrayBuffer.isView(body)) {
body = import_buffer2.Buffer.from(body.buffer, body.byteOffset, body.byteLength);
} else if (body instanceof import_stream2.default) {
} else if (body instanceof import_chunk_VTJS2JJN.FormData) {
body = (0, import_chunk_VTJS2JJN.formDataToBlob)(body);
boundary = body.type.split("=")[1];
} else {
body = import_buffer2.Buffer.from(String(body));
}
let stream = body;
if (import_buffer2.Buffer.isBuffer(body)) {
stream = import_stream2.default.Readable.from(body);
} else if (isBlob(body)) {
stream = import_stream2.default.Readable.from(body.stream());
}
this[INTERNALS] = {
body,
stream,
boundary,
disturbed: false,
error: null
};
this.size = size;
if (body instanceof import_stream2.default) {
body.on("error", (error_) => {
const error = error_ instanceof FetchBaseError ? error_ : new FetchError(`Invalid response body while trying to fetch ${this.url}: ${error_.message}`, "system", error_);
this[INTERNALS].error = error;
});
}
}
get body() {
return this[INTERNALS].stream;
}
get bodyUsed() {
return this[INTERNALS].disturbed;
}
/**
* Decode response as ArrayBuffer
*
* @return Promise
*/
async arrayBuffer() {
const { buffer, byteOffset, byteLength } = await consumeBody(this);
return buffer.slice(byteOffset, byteOffset + byteLength);
}
async formData() {
const ct = this.headers.get("content-type");
if (ct.startsWith("application/x-www-form-urlencoded")) {
const formData = new import_chunk_VTJS2JJN.FormData();
const parameters = new URLSearchParams(await this.text());
for (const [name, value] of parameters) {
formData.append(name, value);
}
return formData;
}
const { toFormData } = await import("./multipart-parser-47FFAP42.js");
return toFormData(this.body, ct);
}
/**
* Return raw response as Blob
*
* @return Promise
*/
async blob() {
const ct = this.headers && this.headers.get("content-type") || this[INTERNALS].body && this[INTERNALS].body.type || "";
const buf = await this.arrayBuffer();
return new import_chunk_VTJS2JJN.fetch_blob_default([buf], {
type: ct
});
}
/**
* Decode response as json
*
* @return Promise
*/
async json() {
const text = await this.text();
return JSON.parse(text);
}
/**
* Decode response as text
*
* @return Promise
*/
async text() {
const buffer = await consumeBody(this);
return new TextDecoder().decode(buffer);
}
/**
* Decode response as buffer (non-spec api)
*
* @return Promise
*/
buffer() {
return consumeBody(this);
}
};
Body.prototype.buffer = (0, import_util.deprecate)(Body.prototype.buffer, "Please use 'response.arrayBuffer()' instead of 'response.buffer()'", "node-fetch#buffer");
Object.defineProperties(Body.prototype, {
body: { enumerable: true },
bodyUsed: { enumerable: true },
arrayBuffer: { enumerable: true },
blob: { enumerable: true },
json: { enumerable: true },
text: { enumerable: true },
data: { get: (0, import_util.deprecate)(
() => {
},
"data doesn't exist, use json(), text(), arrayBuffer(), or body instead",
"https://github.com/node-fetch/node-fetch/issues/1000 (response)"
) }
});
async function consumeBody(data) {
if (data[INTERNALS].disturbed) {
throw new TypeError(`body used already for: ${data.url}`);
}
data[INTERNALS].disturbed = true;
if (data[INTERNALS].error) {
throw data[INTERNALS].error;
}
const { body } = data;
if (body === null) {
return import_buffer2.Buffer.alloc(0);
}
if (!(body instanceof import_stream2.default)) {
return import_buffer2.Buffer.alloc(0);
}
const accum = [];
let accumBytes = 0;
try {
for await (const chunk of body) {
if (data.size > 0 && accumBytes + chunk.length > data.size) {
const error = new FetchError(`content size at ${data.url} over limit: ${data.size}`, "max-size");
body.destroy(error);
throw error;
}
accumBytes += chunk.length;
accum.push(chunk);
}
} catch (error) {
const error_ = error instanceof FetchBaseError ? error : new FetchError(`Invalid response body while trying to fetch ${data.url}: ${error.message}`, "system", error);
throw error_;
}
if (body.readableEnded === true || body._readableState.ended === true) {
try {
if (accum.every((c) => typeof c === "string")) {
return import_buffer2.Buffer.from(accum.join(""));
}
return import_buffer2.Buffer.concat(accum, accumBytes);
} catch (error) {
throw new FetchError(`Could not create Buffer from response body for ${data.url}: ${error.message}`, "system", error);
}
} else {
throw new FetchError(`Premature close of server response while trying to fetch ${data.url}`);
}
}
var clone = (instance, highWaterMark) => {
let p1;
let p2;
let { body } = instance[INTERNALS];
if (instance.bodyUsed) {
throw new Error("cannot clone body after it is used");
}
if (body instanceof import_stream2.default && typeof body.getBoundary !== "function") {
p1 = new import_stream2.PassThrough({ highWaterMark });
p2 = new import_stream2.PassThrough({ highWaterMark });
body.pipe(p1);
body.pipe(p2);
instance[INTERNALS].stream = p1;
body = p2;
}
return body;
};
var getNonSpecFormDataBoundary = (0, import_util.deprecate)(
(body) => body.getBoundary(),
"form-data doesn't follow the spec and requires special treatment. Use alternative package",
"https://github.com/node-fetch/node-fetch/issues/1167"
);
var extractContentType = (body, request) => {
if (body === null) {
return null;
}
if (typeof body === "string") {
return "text/plain;charset=UTF-8";
}
if (isURLSearchParameters(body)) {
return "application/x-www-form-urlencoded;charset=UTF-8";
}
if (isBlob(body)) {
return body.type || null;
}
if (import_buffer2.Buffer.isBuffer(body) || import_util.types.isAnyArrayBuffer(body) || ArrayBuffer.isView(body)) {
return null;
}
if (body instanceof import_chunk_VTJS2JJN.FormData) {
return `multipart/form-data; boundary=${request[INTERNALS].boundary}`;
}
if (body && typeof body.getBoundary === "function") {
return `multipart/form-data;boundary=${getNonSpecFormDataBoundary(body)}`;
}
if (body instanceof import_stream2.default) {
return null;
}
return "text/plain;charset=UTF-8";
};
var getTotalBytes = (request) => {
const { body } = request[INTERNALS];
if (body === null) {
return 0;
}
if (isBlob(body)) {
return body.size;
}
if (import_buffer2.Buffer.isBuffer(body)) {
return body.length;
}
if (body && typeof body.getLengthSync === "function") {
return body.hasKnownLength && body.hasKnownLength() ? body.getLengthSync() : null;
}
return null;
};
var writeToStream = async (dest, { body }) => {
if (body === null) {
dest.end();
} else {
await pipeline(body, dest);
}
};
var validateHeaderName = typeof import_http2.default.validateHeaderName === "function" ? import_http2.default.validateHeaderName : (name) => {
if (!/^[\^`\-\w!#$%&'*+.|~]+$/.test(name)) {
const error = new TypeError(`Header name must be a valid HTTP token [${name}]`);
Object.defineProperty(error, "code", { value: "ERR_INVALID_HTTP_TOKEN" });
throw error;
}
};
var validateHeaderValue = typeof import_http2.default.validateHeaderValue === "function" ? import_http2.default.validateHeaderValue : (name, value) => {
if (/[^\t\u0020-\u007E\u0080-\u00FF]/.test(value)) {
const error = new TypeError(`Invalid character in header content ["${name}"]`);
Object.defineProperty(error, "code", { value: "ERR_INVALID_CHAR" });
throw error;
}
};
var Headers = class _Headers extends URLSearchParams {
/**
* Headers class
*
* @constructor
* @param {HeadersInit} [init] - Response headers
*/
constructor(init) {
let result = [];
if (init instanceof _Headers) {
const raw = init.raw();
for (const [name, values] of Object.entries(raw)) {
result.push(...values.map((value) => [name, value]));
}
} else if (init == null) {
} else if (typeof init === "object" && !import_util2.types.isBoxedPrimitive(init)) {
const method = init[Symbol.iterator];
if (method == null) {
result.push(...Object.entries(init));
} else {
if (typeof method !== "function") {
throw new TypeError("Header pairs must be iterable");
}
result = [...init].map((pair) => {
if (typeof pair !== "object" || import_util2.types.isBoxedPrimitive(pair)) {
throw new TypeError("Each header pair must be an iterable object");
}
return [...pair];
}).map((pair) => {
if (pair.length !== 2) {
throw new TypeError("Each header pair must be a name/value tuple");
}
return [...pair];
});
}
} else {
throw new TypeError("Failed to construct 'Headers': The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)");
}
result = result.length > 0 ? result.map(([name, value]) => {
validateHeaderName(name);
validateHeaderValue(name, String(value));
return [String(name).toLowerCase(), String(value)];
}) : void 0;
super(result);
return new Proxy(this, {
get(target, p, receiver) {
switch (p) {
case "append":
case "set":
return (name, value) => {
validateHeaderName(name);
validateHeaderValue(name, String(value));
return URLSearchParams.prototype[p].call(
target,
String(name).toLowerCase(),
String(value)
);
};
case "delete":
case "has":
case "getAll":
return (name) => {
validateHeaderName(name);
return URLSearchParams.prototype[p].call(
target,
String(name).toLowerCase()
);
};
case "keys":
return () => {
target.sort();
return new Set(URLSearchParams.prototype.keys.call(target)).keys();
};
default:
return Reflect.get(target, p, receiver);
}
}
});
}
get [Symbol.toStringTag]() {
return this.constructor.name;
}
toString() {
return Object.prototype.toString.call(this);
}
get(name) {
const values = this.getAll(name);
if (values.length === 0) {
return null;
}
let value = values.join(", ");
if (/^content-encoding$/i.test(name)) {
value = value.toLowerCase();
}
return value;
}
forEach(callback, thisArg = void 0) {
for (const name of this.keys()) {
Reflect.apply(callback, thisArg, [this.get(name), name, this]);
}
}
*values() {
for (const name of this.keys()) {
yield this.get(name);
}
}
/**
* @type {() => IterableIterator<[string, string]>}
*/
*entries() {
for (const name of this.keys()) {
yield [name, this.get(name)];
}
}
[Symbol.iterator]() {
return this.entries();
}
/**
* Node-fetch non-spec method
* returning all headers and their values as array
* @returns {Record<string, string[]>}
*/
raw() {
return [...this.keys()].reduce((result, key) => {
result[key] = this.getAll(key);
return result;
}, {});
}
/**
* For better console.log(headers) and also to convert Headers into Node.js Request compatible format
*/
[Symbol.for("nodejs.util.inspect.custom")]() {
return [...this.keys()].reduce((result, key) => {
const values = this.getAll(key);
if (key === "host") {
result[key] = values[0];
} else {
result[key] = values.length > 1 ? values : values[0];
}
return result;
}, {});
}
};
Object.defineProperties(
Headers.prototype,
["get", "entries", "forEach", "values"].reduce((result, property) => {
result[property] = { enumerable: true };
return result;
}, {})
);
function fromRawHeaders(headers = []) {
return new Headers(
headers.reduce((result, value, index, array) => {
if (index % 2 === 0) {
result.push(array.slice(index, index + 2));
}
return result;
}, []).filter(([name, value]) => {
try {
validateHeaderName(name);
validateHeaderValue(name, String(value));
return true;
} catch {
return false;
}
})
);
}
var redirectStatus = /* @__PURE__ */ new Set([301, 302, 303, 307, 308]);
var isRedirect = (code) => {
return redirectStatus.has(code);
};
var INTERNALS2 = Symbol("Response internals");
var Response = class _Response extends Body {
constructor(body = null, options = {}) {
super(body, options);
const status = options.status != null ? options.status : 200;
const headers = new Headers(options.headers);
if (body !== null && !headers.has("Content-Type")) {
const contentType = extractContentType(body, this);
if (contentType) {
headers.append("Content-Type", contentType);
}
}
this[INTERNALS2] = {
type: "default",
url: options.url,
status,
statusText: options.statusText || "",
headers,
counter: options.counter,
highWaterMark: options.highWaterMark
};
}
get type() {
return this[INTERNALS2].type;
}
get url() {
return this[INTERNALS2].url || "";
}
get status() {
return this[INTERNALS2].status;
}
/**
* Convenience property representing if the request ended normally
*/
get ok() {
return this[INTERNALS2].status >= 200 && this[INTERNALS2].status < 300;
}
get redirected() {
return this[INTERNALS2].counter > 0;
}
get statusText() {
return this[INTERNALS2].statusText;
}
get headers() {
return this[INTERNALS2].headers;
}
get highWaterMark() {
return this[INTERNALS2].highWaterMark;
}
/**
* Clone this response
*
* @return Response
*/
clone() {
return new _Response(clone(this, this.highWaterMark), {
type: this.type,
url: this.url,
status: this.status,
statusText: this.statusText,
headers: this.headers,
ok: this.ok,
redirected: this.redirected,
size: this.size,
highWaterMark: this.highWaterMark
});
}
/**
* @param {string} url The URL that the new response is to originate from.
* @param {number} status An optional status code for the response (e.g., 302.)
* @returns {Response} A Response object.
*/
static redirect(url, status = 302) {
if (!isRedirect(status)) {
throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');
}
return new _Response(null, {
headers: {
location: new URL(url).toString()
},
status
});
}
static error() {
const response = new _Response(null, { status: 0, statusText: "" });
response[INTERNALS2].type = "error";
return response;
}
static json(data = void 0, init = {}) {
const body = JSON.stringify(data);
if (body === void 0) {
throw new TypeError("data is not JSON serializable");
}
const headers = new Headers(init && init.headers);
if (!headers.has("content-type")) {
headers.set("content-type", "application/json");
}
return new _Response(body, {
...init,
headers
});
}
get [Symbol.toStringTag]() {
return "Response";
}
};
Object.defineProperties(Response.prototype, {
type: { enumerable: true },
url: { enumerable: true },
status: { enumerable: true },
ok: { enumerable: true },
redirected: { enumerable: true },
statusText: { enumerable: true },
headers: { enumerable: true },
clone: { enumerable: true }
});
var getSearch = (parsedURL) => {
if (parsedURL.search) {
return parsedURL.search;
}
const lastOffset = parsedURL.href.length - 1;
const hash = parsedURL.hash || (parsedURL.href[lastOffset] === "#" ? "#" : "");
return parsedURL.href[lastOffset - hash.length] === "?" ? "?" : "";
};
function stripURLForUseAsAReferrer(url, originOnly = false) {
if (url == null) {
return "no-referrer";
}
url = new URL(url);
if (/^(about|blob|data):$/.test(url.protocol)) {
return "no-referrer";
}
url.username = "";
url.password = "";
url.hash = "";
if (originOnly) {
url.pathname = "";
url.search = "";
}
return url;
}
var ReferrerPolicy = /* @__PURE__ */ new Set([
"",
"no-referrer",
"no-referrer-when-downgrade",
"same-origin",
"origin",
"strict-origin",
"origin-when-cross-origin",
"strict-origin-when-cross-origin",
"unsafe-url"
]);
var DEFAULT_REFERRER_POLICY = "strict-origin-when-cross-origin";
function validateReferrerPolicy(referrerPolicy) {
if (!ReferrerPolicy.has(referrerPolicy)) {
throw new TypeError(`Invalid referrerPolicy: ${referrerPolicy}`);
}
return referrerPolicy;
}
function isOriginPotentiallyTrustworthy(url) {
if (/^(http|ws)s:$/.test(url.protocol)) {
return true;
}
const hostIp = url.host.replace(/(^\[)|(]$)/g, "");
const hostIPVersion = (0, import_net.isIP)(hostIp);
if (hostIPVersion === 4 && /^127\./.test(hostIp)) {
return true;
}
if (hostIPVersion === 6 && /^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(hostIp)) {
return true;
}
if (url.host === "localhost" || url.host.endsWith(".localhost")) {
return false;
}
if (url.protocol === "file:") {
return true;
}
return false;
}
function isUrlPotentiallyTrustworthy(url) {
if (/^about:(blank|srcdoc)$/.test(url)) {
return true;
}
if (url.protocol === "data:") {
return true;
}
if (/^(blob|filesystem):$/.test(url.protocol)) {
return true;
}
return isOriginPotentiallyTrustworthy(url);
}
function determineRequestsReferrer(request, { referrerURLCallback, referrerOriginCallback } = {}) {
if (request.referrer === "no-referrer" || request.referrerPolicy === "") {
return null;
}
const policy = request.referrerPolicy;
if (request.referrer === "about:client") {
return "no-referrer";
}
const referrerSource = request.referrer;
let referrerURL = stripURLForUseAsAReferrer(referrerSource);
let referrerOrigin = stripURLForUseAsAReferrer(referrerSource, true);
if (referrerURL.toString().length > 4096) {
referrerURL = referrerOrigin;
}
if (referrerURLCallback) {
referrerURL = referrerURLCallback(referrerURL);
}
if (referrerOriginCallback) {
referrerOrigin = referrerOriginCallback(referrerOrigin);
}
const currentURL = new URL(request.url);
switch (policy) {
case "no-referrer":
return "no-referrer";
case "origin":
return referrerOrigin;
case "unsafe-url":
return referrerURL;
case "strict-origin":
if (isUrlPotentiallyTrustworthy(referrerURL) && !isUrlPotentiallyTrustworthy(currentURL)) {
return "no-referrer";
}
return referrerOrigin.toString();
case "strict-origin-when-cross-origin":
if (referrerURL.origin === currentURL.origin) {
return referrerURL;
}
if (isUrlPotentiallyTrustworthy(referrerURL) && !isUrlPotentiallyTrustworthy(currentURL)) {
return "no-referrer";
}
return referrerOrigin;
case "same-origin":
if (referrerURL.origin === currentURL.origin) {
return referrerURL;
}
return "no-referrer";
case "origin-when-cross-origin":
if (referrerURL.origin === currentURL.origin) {
return referrerURL;
}
return referrerOrigin;
case "no-referrer-when-downgrade":
if (isUrlPotentiallyTrustworthy(referrerURL) && !isUrlPotentiallyTrustworthy(currentURL)) {
return "no-referrer";
}
return referrerURL;
default:
throw new TypeError(`Invalid referrerPolicy: ${policy}`);
}
}
function parseReferrerPolicyFromHeader(headers) {
const policyTokens = (headers.get("referrer-policy") || "").split(/[,\s]+/);
let policy = "";
for (const token of policyTokens) {
if (token && ReferrerPolicy.has(token)) {
policy = token;
}
}
return policy;
}
var INTERNALS3 = Symbol("Request internals");
var isRequest = (object) => {
return typeof object === "object" && typeof object[INTERNALS3] === "object";
};
var doBadDataWarn = (0, import_util3.deprecate)(
() => {
},
".data is not a valid RequestInit property, use .body instead",
"https://github.com/node-fetch/node-fetch/issues/1000 (request)"
);
var Request = class _Request extends Body {
constructor(input, init = {}) {
let parsedURL;
if (isRequest(input)) {
parsedURL = new URL(input.url);
} else {
parsedURL = new URL(input);
input = {};
}
if (parsedURL.username !== "" || parsedURL.password !== "") {
throw new TypeError(`${parsedURL} is an url with embedded credentials.`);
}
let method = init.method || input.method || "GET";
if (/^(delete|get|head|options|post|put)$/i.test(method)) {
method = method.toUpperCase();
}
if (!isRequest(init) && "data" in init) {
doBadDataWarn();
}
if ((init.body != null || isRequest(input) && input.body !== null) && (method === "GET" || method === "HEAD")) {
throw new TypeError("Request with GET/HEAD method cannot have body");
}
const inputBody = init.body ? init.body : isRequest(input) && input.body !== null ? clone(input) : null;
super(inputBody, {
size: init.size || input.size || 0
});
const headers = new Headers(init.headers || input.headers || {});
if (inputBody !== null && !headers.has("Content-Type")) {
const contentType = extractContentType(inputBody, this);
if (contentType) {
headers.set("Content-Type", contentType);
}
}
let signal = isRequest(input) ? input.signal : null;
if ("signal" in init) {
signal = init.signal;
}
if (signal != null && !isAbortSignal(signal)) {
throw new TypeError("Expected signal to be an instanceof AbortSignal or EventTarget");
}
let referrer = init.referrer == null ? input.referrer : init.referrer;
if (referrer === "") {
referrer = "no-referrer";
} else if (referrer) {
const parsedReferrer = new URL(referrer);
referrer = /^about:(\/\/)?client$/.test(parsedReferrer) ? "client" : parsedReferrer;
} else {
referrer = void 0;
}
this[INTERNALS3] = {
method,
redirect: init.redirect || input.redirect || "follow",
headers,
parsedURL,
signal,
referrer
};
this.follow = init.follow === void 0 ? input.follow === void 0 ? 20 : input.follow : init.follow;
this.compress = init.compress === void 0 ? input.compress === void 0 ? true : input.compress : init.compress;
this.counter = init.counter || input.counter || 0;
this.agent = init.agent || input.agent;
this.highWaterMark = init.highWaterMark || input.highWaterMark || 16384;
this.insecureHTTPParser = init.insecureHTTPParser || input.insecureHTTPParser || false;
this.referrerPolicy = init.referrerPolicy || input.referrerPolicy || "";
}
/** @returns {string} */
get method() {
return this[INTERNALS3].method;
}
/** @returns {string} */
get url() {
return (0, import_url.format)(this[INTERNALS3].parsedURL);
}
/** @returns {Headers} */
get headers() {
return this[INTERNALS3].headers;
}
get redirect() {
return this[INTERNALS3].redirect;
}
/** @returns {AbortSignal} */
get signal() {
return this[INTERNALS3].signal;
}
// https://fetch.spec.whatwg.org/#dom-request-referrer
get referrer() {
if (this[INTERNALS3].referrer === "no-referrer") {
return "";
}
if (this[INTERNALS3].referrer === "client") {
return "about:client";
}
if (this[INTERNALS3].referrer) {
return this[INTERNALS3].referrer.toString();
}
return void 0;
}
get referrerPolicy() {
return this[INTERNALS3].referrerPolicy;
}
set referrerPolicy(referrerPolicy) {
this[INTERNALS3].referrerPolicy = validateReferrerPolicy(referrerPolicy);
}
/**
* Clone this request
*
* @return Request
*/
clone() {
return new _Request(this);
}
get [Symbol.toStringTag]() {
return "Request";
}
};
Object.defineProperties(Request.prototype, {
method: { enumerable: true },
url: { enumerable: true },
headers: { enumerable: true },
redirect: { enumerable: true },
clone: { enumerable: true },
signal: { enumerable: true },
referrer: { enumerable: true },
referrerPolicy: { enumerable: true }
});
var getNodeRequestOptions = (request) => {
const { parsedURL } = request[INTERNALS3];
const headers = new Headers(request[INTERNALS3].headers);
if (!headers.has("Accept")) {
headers.set("Accept", "*/*");
}
let contentLengthValue = null;
if (request.body === null && /^(post|put)$/i.test(request.method)) {
contentLengthValue = "0";
}
if (request.body !== null) {
const totalBytes = getTotalBytes(request);
if (typeof totalBytes === "number" && !Number.isNaN(totalBytes)) {
contentLengthValue = String(totalBytes);
}
}
if (contentLengthValue) {
headers.set("Content-Length", contentLengthValue);
}
if (request.referrerPolicy === "") {
request.referrerPolicy = DEFAULT_REFERRER_POLICY;
}
if (request.referrer && request.referrer !== "no-referrer") {
request[INTERNALS3].referrer = determineRequestsReferrer(request);
} else {
request[INTERNALS3].referrer = "no-referrer";
}
if (request[INTERNALS3].referrer instanceof URL) {
headers.set("Referer", request.referrer);
}
if (!headers.has("User-Agent")) {
headers.set("User-Agent", "node-fetch");
}
if (request.compress && !headers.has("Accept-Encoding")) {
headers.set("Accept-Encoding", "gzip, deflate, br");
}
let { agent } = request;
if (typeof agent === "function") {
agent = agent(parsedURL);
}
const search = getSearch(parsedURL);
const options = {
// Overwrite search to retain trailing ? (issue #776)
path: parsedURL.pathname + search,
// The following options are not expressed in the URL
method: request.method,
headers: headers[Symbol.for("nodejs.util.inspect.custom")](),
insecureHTTPParser: request.insecureHTTPParser,
agent
};
return {
/** @type {URL} */
parsedURL,
options
};
};
var AbortError = class extends FetchBaseError {
constructor(message, type = "aborted") {
super(message, type);
}
};
var supportedSchemas = /* @__PURE__ */ new Set(["data:", "http:", "https:"]);
async function fetch(url, options_) {
return new Promise((resolve, reject) => {
const request = new Request(url, options_);
const { parsedURL, options } = getNodeRequestOptions(request);
if (!supportedSchemas.has(parsedURL.protocol)) {
throw new TypeError(`node-fetch cannot load ${url}. URL scheme "${parsedURL.protocol.replace(/:$/, "")}" is not supported.`);
}
if (parsedURL.protocol === "data:") {
const data = dist_default(request.url);
const response2 = new Response(data, { headers: { "Content-Type": data.typeFull } });
resolve(response2);
return;
}
const send = (parsedURL.protocol === "https:" ? import_https.default : import_http.default).request;
const { signal } = request;
let response = null;
const abort = () => {
const error = new AbortError("The operation was aborted.");
reject(error);
if (request.body && request.body instanceof import_stream.default.Readable) {
request.body.destroy(error);
}
if (!response || !response.body) {
return;
}
response.body.emit("error", error);
};
if (signal && signal.aborted) {
abort();
return;
}
const abortAndFinalize = () => {
abort();
finalize();
};
const request_ = send(parsedURL.toString(), options);
if (signal) {
signal.addEventListener("abort", abortAndFinalize);
}
const finalize = () => {
request_.abort();
if (signal) {
signal.removeEventListener("abort", abortAndFinalize);
}
};
request_.on("error", (error) => {
reject(new FetchError(`request to ${request.url} failed, reason: ${error.message}`, "system", error));
finalize();
});
fixResponseChunkedTransferBadEnding(request_, (error) => {
if (response && response.body) {
response.body.destroy(error);
}
});
if (process.version < "v14") {
request_.on("socket", (s) => {
let endedWithEventsCount;
s.prependListener("end", () => {
endedWithEventsCount = s._eventsCount;
});
s.prependListener("close", (hadError) => {
if (response && endedWithEventsCount < s._eventsCount && !hadError) {
const error = new Error("Premature close");
error.code = "ERR_STREAM_PREMATURE_CLOSE";
response.body.emit("error", error);
}
});
});
}
request_.on("response", (response_) => {
request_.setTimeout(0);
const headers = fromRawHeaders(response_.rawHeaders);
if (isRedirect(response_.statusCode)) {
const location = headers.get("Location");
let locationURL = null;
try {
locationURL = location === null ? null : new URL(location, request.url);
} catch {
if (request.redirect !== "manual") {
reject(new FetchError(`uri requested responds with an invalid redirect URL: ${location}`, "invalid-redirect"));
finalize();
return;
}
}
switch (request.redirect) {
case "error":
reject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, "no-redirect"));
finalize();
return;
case "manual":
break;
case "follow": {
if (locationURL === null) {
break;
}
if (request.counter >= request.follow) {
reject(new FetchError(`maximum redirect reached at: ${request.url}`, "max-redirect"));
finalize();
return;
}
const requestOptions = {
headers: new Headers(request.headers),
follow: request.follow,
counter: request.counter + 1,
agent: request.agent,
compress: request.compress,
method: request.method,
body: clone(request),
signal: request.signal,
size: request.size,
referrer: request.referrer,
referrerPolicy: request.referrerPolicy
};
if (!isDomainOrSubdomain(request.url, locationURL) || !isSameProtocol(request.url, locationURL)) {
for (const name of ["authorization", "www-authenticate", "cookie", "cookie2"]) {
requestOptions.headers.delete(name);
}
}
if (response_.statusCode !== 303 && request.body && options_.body instanceof import_stream.default.Readable) {
reject(new FetchError("Cannot follow redirect with body being a readable stream", "unsupported-redirect"));
finalize();
return;
}
if (response_.statusCode === 303 || (response_.statusCode === 301 || response_.statusCode === 302) && request.method === "POST") {
requestOptions.method = "GET";
requestOptions.body = void 0;
requestOptions.headers.delete("content-length");
}
const responseReferrerPolicy = parseReferrerPolicyFromHeader(headers);
if (responseReferrerPolicy) {
requestOptions.referrerPolicy = responseReferrerPolicy;
}
resolve(fetch(new Request(locationURL, requestOptions)));
finalize();
return;
}
default:
return reject(new TypeError(`Redirect option '${request.redirect}' is not a valid value of RequestRedirect`));
}
}
if (signal) {
response_.once("end", () => {
signal.removeEventListener("abort", abortAndFinalize);
});
}
let body = (0, import_stream.pipeline)(response_, new import_stream.PassThrough(), (error) => {
if (error) {
reject(error);
}
});
if (process.version < "v12.10") {
response_.on("aborted", abortAndFinalize);
}
const responseOptions = {
url: request.url,
status: response_.statusCode,
statusText: response_.statusMessage,
headers,
size: request.size,
counter: request.counter,
highWaterMark: request.highWaterMark
};
const codings = headers.get("Content-Encoding");
if (!request.compress || request.method === "HEAD" || codings === null || response_.statusCode === 204 || response_.statusCode === 304) {
response = new Response(body, responseOptions);
resolve(response);
return;
}
const zlibOptions = {
flush: import_zlib.default.Z_SYNC_FLUSH,
finishFlush: import_zlib.default.Z_SYNC_FLUSH
};
if (codings === "gzip" || codings === "x-gzip") {
body = (0, import_stream.pipeline)(body, import_zlib.default.createGunzip(zlibOptions), (error) => {
if (error) {
reject(error);
}
});
response = new Response(body, responseOptions);
resolve(response);
return;
}
if (codings === "deflate" || codings === "x-deflate") {
const raw = (0, import_stream.pipeline)(response_, new import_stream.PassThrough(), (error) => {
if (error) {
reject(error);
}
});
raw.once("data", (chunk) => {
if ((chunk[0] & 15) === 8) {
body = (0, import_stream.pipeline)(body, import_zlib.default.createInflate(), (error) => {
if (error) {
reject(error);
}
});
} else {
body = (0, import_stream.pipeline)(body, import_zlib.default.createInflateRaw(), (error) => {
if (error) {
reject(error);
}
});
}
response = new Response(body, responseOptions);
resolve(response);
});
raw.once("end", () => {
if (!response) {
response = new Response(body, responseOptions);
resolve(response);
}
});
return;
}
if (codings === "br") {
body = (0, import_stream.pipeline)(body, import_zlib.default.createBrotliDecompress(), (error) => {
if (error) {
reject(error);
}
});
response = new Response(body, responseOptions);
resolve(response);
return;
}
response = new Response(body, responseOptions);
resolve(response);
});
writeToStream(request_, request).catch(reject);
});
}
function fixResponseChunkedTransferBadEnding(request, errorCallback) {
const LAST_CHUNK = import_buffer.Buffer.from("0\r\n\r\n");
let isChunkedTransfer = false;
let properLastChunkReceived = false;
let previousChunk;
request.on("response", (response) => {
const { headers } = response;
isChunkedTransfer = headers["transfer-encoding"] === "chunked" && !headers["content-length"];
});
request.on("socket", (socket) => {
const onSocketClose = () => {
if (isChunkedTransfer && !properLastChunkReceived) {
const error = new Error("Premature close");
error.code = "ERR_STREAM_PREMATURE_CLOSE";
errorCallback(error);
}
};
const onData = (buf) => {
properLastChunkReceived = import_buffer.Buffer.compare(buf.slice(-5), LAST_CHUNK) === 0;
if (!properLastChunkReceived && previousChunk) {
properLastChunkReceived = import_buffer.Buffer.compare(previousChunk.slice(-3), LAST_CHUNK.slice(0, 3)) === 0 && import_buffer.Buffer.compare(buf.slice(-2), LAST_CHUNK.slice(3)) === 0;
}
previousChunk = buf;
};
socket.prependListener("close", onSocketClose);
socket.on("data", onData);
request.on("close", () => {
socket.removeListener("close", onSocketClose);
socket.removeListener("data", onData);
});
});
}
var import_p_retry = (0, import_chunk_AH6QHEOA.__toESM)(require_p_retry());
var import_rimraf = (0, import_chunk_AH6QHEOA.__toESM)((0, import_chunk_RGVHWUUH.require_rimraf)());
var import_tempy = (0, import_chunk_AH6QHEOA.__toESM)(require_tempy());
var debug = (0, import_debug.default)("prisma:fetch-engine:downloadZip");
var del = (0, import_util4.promisify)(import_rimraf.default);
async function fetchChecksum(url) {
try {
const checksumUrl = `${url}.sha256`;
const response = await fetch(checksumUrl, {
agent: (0, import_chunk_KDPLGCY6.getProxyAgent)(url)
});
if (!response.ok) {
let errorMessage = `Failed to fetch sha256 checksum at ${checksumUrl} - ${response.status} ${response.statusText}`;
if (!process.env.PRISMA_ENGINES_CHECKSUM_IGNORE_MISSING) {
errorMessage += `
If you need to ignore this error (e.g. in an offline environment), set the PRISMA_ENGINES_CHECKSUM_IGNORE_MISSING environment variable to a truthy value.
Example: PRISMA_ENGINES_CHECKSUM_IGNORE_MISSING=1`;
}
throw new Error(errorMessage);
}
const body = await response.text();
const [checksum] = body.split(/\s+/);
if (!/^[a-f0-9]{64}$/gi.test(checksum)) {
throw new Error(`Unable to parse checksum from ${checksumUrl} - response body: ${body}`);
}
return checksum;
} catch (error) {
if (process.env.PRISMA_ENGINES_CHECKSUM_IGNORE_MISSING) {
debug(
`fetchChecksum() failed and was ignored as the PRISMA_ENGINES_CHECKSUM_IGNORE_MISSING environment variable is truthy.
Error: ${error}`
);
return null;
}
throw error;
}
}
async function downloadZip(url, target, progressCb) {
const tmpDir = import_tempy.default.directory();
const partial = import_path.default.join(tmpDir, "partial");
const RETRIES_COUNT = 2;
const [zippedSha256, sha256] = await (0, import_p_retry.default)(
async () => {
return await Promise.all([fetchChecksum(url), fetchChecksum(url.slice(0, url.length - 3))]);
},
{
retries: RETRIES_COUNT,
onFailedAttempt: (err) => debug("An error occurred while downloading the checksums files", err)
}
);
const result = await (0, import_p_retry.default)(
async () => {
const response = await fetch(url, {
compress: false,
agent: (0, import_chunk_KDPLGCY6.getProxyAgent)(url)
});
if (!response.ok) {
throw new Error(`Failed to fetch the engine file at ${url} - ${response.status} ${response.statusText}`);
}
const lastModified = response.headers.get("last-modified");
const size = parseFloat(response.headers.get("content-length"));
const ws = import_fs.default.createWriteStream(partial);
return await new Promise(async (resolve, reject) => {
let bytesRead = 0;
if (response.body === null) {
return reject(new Error(`Failed to fetch the engine file at ${url} - response.body is null`));
}
response.body.once("error", reject).on("data", (chunk) => {
bytesRead += chunk.length;
if (size && progressCb) {
progressCb(bytesRead / size);
}
});
const gunzip = import_zlib2.default.createGunzip();
gunzip.on("error", reject);
const zipStream = response.body.pipe(gunzip);
const zippedHashPromise = import_hasha.default.fromStream(response.body, {
algorithm: "sha256"
});
const hashPromise = import_hasha.default.fromStream(zipStream, {
algorithm: "sha256"
});
zipStream.pipe(ws);
ws.on("error", reject).on("close", () => {
resolve({ lastModified, sha256, zippedSha256 });
});
const hash = await hashPromise;
const zippedHash = await zippedHashPromise;
if (zippedSha256 !== null && zippedSha256 !== zippedHash) {
return reject(new Error(`sha256 checksum of ${url} (zipped) should be ${zippedSha256} but is ${zippedHash}`));
}
if (sha256 !== null && sha256 !== hash) {
return reject(new Error(`sha256 checksum of ${url} (unzipped) should be ${sha256} but is ${hash}`));
}
});
},
{
retries: RETRIES_COUNT,
onFailedAttempt: (err) => debug("An error occurred while downloading the engine file", err)
}
);
await (0, import_chunk_FQ2BOR66.overwriteFile)(partial, target);
try {
await del(partial);
await del(tmpDir);
} catch (e) {
debug(e);
}
return result;
}
/*! Bundled license information:
is-extglob/index.js:
(*!
* is-extglob <https://github.com/jonschlinkert/is-extglob>
*
* Copyright (c) 2014-2016, Jon Schlinkert.
* Licensed under the MIT License.
*)
is-glob/index.js:
(*!
* is-glob <https://github.com/jonschlinkert/is-glob>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*)
is-number/index.js:
(*!
* is-number <https://github.com/jonschlinkert/is-number>
*
* Copyright (c) 2014-present, Jon Schlinkert.
* Released under the MIT License.
*)
to-regex-range/index.js:
(*!
* to-regex-range <https://github.com/micromatch/to-regex-range>
*
* Copyright (c) 2015-present, Jon Schlinkert.
* Released under the MIT License.
*)
fill-range/index.js:
(*!
* fill-range <https://github.com/jonschlinkert/fill-range>
*
* Copyright (c) 2014-present, Jon Schlinkert.
* Licensed under the MIT License.
*)
queue-microtask/index.js:
(*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
run-parallel/index.js:
(*! run-parallel. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
*/