pnpm
Version:
1,519 lines (1,495 loc) • 7.74 MB
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 __esm = (fn, res) => function __init() {
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
};
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let 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);
// ../node_modules/.pnpm/fast-safe-stringify@2.1.1/node_modules/fast-safe-stringify/index.js
var require_fast_safe_stringify = __commonJS({
"../node_modules/.pnpm/fast-safe-stringify@2.1.1/node_modules/fast-safe-stringify/index.js"(exports2, module2) {
module2.exports = stringify2;
stringify2.default = stringify2;
stringify2.stable = deterministicStringify;
stringify2.stableStringify = deterministicStringify;
var LIMIT_REPLACE_NODE = "[...]";
var CIRCULAR_REPLACE_NODE = "[Circular]";
var arr = [];
var replacerStack = [];
function defaultOptions() {
return {
depthLimit: Number.MAX_SAFE_INTEGER,
edgesLimit: Number.MAX_SAFE_INTEGER
};
}
function stringify2(obj, replacer, spacer, options) {
if (typeof options === "undefined") {
options = defaultOptions();
}
decirc(obj, "", 0, [], void 0, 0, options);
var res;
try {
if (replacerStack.length === 0) {
res = JSON.stringify(obj, replacer, spacer);
} else {
res = JSON.stringify(obj, replaceGetterValues(replacer), spacer);
}
} catch (_) {
return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]");
} finally {
while (arr.length !== 0) {
var part = arr.pop();
if (part.length === 4) {
Object.defineProperty(part[0], part[1], part[3]);
} else {
part[0][part[1]] = part[2];
}
}
}
return res;
}
function setReplace(replace, val, k, parent) {
var propertyDescriptor = Object.getOwnPropertyDescriptor(parent, k);
if (propertyDescriptor.get !== void 0) {
if (propertyDescriptor.configurable) {
Object.defineProperty(parent, k, { value: replace });
arr.push([parent, k, val, propertyDescriptor]);
} else {
replacerStack.push([val, k, replace]);
}
} else {
parent[k] = replace;
arr.push([parent, k, val]);
}
}
function decirc(val, k, edgeIndex, stack, parent, depth, options) {
depth += 1;
var i;
if (typeof val === "object" && val !== null) {
for (i = 0; i < stack.length; i++) {
if (stack[i] === val) {
setReplace(CIRCULAR_REPLACE_NODE, val, k, parent);
return;
}
}
if (typeof options.depthLimit !== "undefined" && depth > options.depthLimit) {
setReplace(LIMIT_REPLACE_NODE, val, k, parent);
return;
}
if (typeof options.edgesLimit !== "undefined" && edgeIndex + 1 > options.edgesLimit) {
setReplace(LIMIT_REPLACE_NODE, val, k, parent);
return;
}
stack.push(val);
if (Array.isArray(val)) {
for (i = 0; i < val.length; i++) {
decirc(val[i], i, i, stack, val, depth, options);
}
} else {
var keys = Object.keys(val);
for (i = 0; i < keys.length; i++) {
var key = keys[i];
decirc(val[key], key, i, stack, val, depth, options);
}
}
stack.pop();
}
}
function compareFunction(a, b) {
if (a < b) {
return -1;
}
if (a > b) {
return 1;
}
return 0;
}
function deterministicStringify(obj, replacer, spacer, options) {
if (typeof options === "undefined") {
options = defaultOptions();
}
var tmp = deterministicDecirc(obj, "", 0, [], void 0, 0, options) || obj;
var res;
try {
if (replacerStack.length === 0) {
res = JSON.stringify(tmp, replacer, spacer);
} else {
res = JSON.stringify(tmp, replaceGetterValues(replacer), spacer);
}
} catch (_) {
return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]");
} finally {
while (arr.length !== 0) {
var part = arr.pop();
if (part.length === 4) {
Object.defineProperty(part[0], part[1], part[3]);
} else {
part[0][part[1]] = part[2];
}
}
}
return res;
}
function deterministicDecirc(val, k, edgeIndex, stack, parent, depth, options) {
depth += 1;
var i;
if (typeof val === "object" && val !== null) {
for (i = 0; i < stack.length; i++) {
if (stack[i] === val) {
setReplace(CIRCULAR_REPLACE_NODE, val, k, parent);
return;
}
}
try {
if (typeof val.toJSON === "function") {
return;
}
} catch (_) {
return;
}
if (typeof options.depthLimit !== "undefined" && depth > options.depthLimit) {
setReplace(LIMIT_REPLACE_NODE, val, k, parent);
return;
}
if (typeof options.edgesLimit !== "undefined" && edgeIndex + 1 > options.edgesLimit) {
setReplace(LIMIT_REPLACE_NODE, val, k, parent);
return;
}
stack.push(val);
if (Array.isArray(val)) {
for (i = 0; i < val.length; i++) {
deterministicDecirc(val[i], i, i, stack, val, depth, options);
}
} else {
var tmp = {};
var keys = Object.keys(val).sort(compareFunction);
for (i = 0; i < keys.length; i++) {
var key = keys[i];
deterministicDecirc(val[key], key, i, stack, val, depth, options);
tmp[key] = val[key];
}
if (typeof parent !== "undefined") {
arr.push([parent, k, val]);
parent[k] = tmp;
} else {
return tmp;
}
}
stack.pop();
}
}
function replaceGetterValues(replacer) {
replacer = typeof replacer !== "undefined" ? replacer : function(k, v) {
return v;
};
return function(key, val) {
if (replacerStack.length > 0) {
for (var i = 0; i < replacerStack.length; i++) {
var part = replacerStack[i];
if (part[1] === key && part[0] === val) {
val = part[2];
replacerStack.splice(i, 1);
break;
}
}
}
return replacer.call(this, key, val);
};
}
}
});
// ../node_modules/.pnpm/individual@3.0.0/node_modules/individual/index.js
var require_individual = __commonJS({
"../node_modules/.pnpm/individual@3.0.0/node_modules/individual/index.js"(exports2, module2) {
"use strict";
var root = typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {};
module2.exports = Individual;
function Individual(key, value) {
if (key in root) {
return root[key];
}
root[key] = value;
return value;
}
}
});
// ../node_modules/.pnpm/bole@5.0.17/node_modules/bole/format.js
var require_format = __commonJS({
"../node_modules/.pnpm/bole@5.0.17/node_modules/bole/format.js"(exports2, module2) {
var utilformat = require("util").format;
function format(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) {
if (a16 !== void 0) {
return utilformat(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16);
}
if (a15 !== void 0) {
return utilformat(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15);
}
if (a14 !== void 0) {
return utilformat(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14);
}
if (a13 !== void 0) {
return utilformat(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13);
}
if (a12 !== void 0) {
return utilformat(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12);
}
if (a11 !== void 0) {
return utilformat(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
}
if (a10 !== void 0) {
return utilformat(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
}
if (a9 !== void 0) {
return utilformat(a1, a2, a3, a4, a5, a6, a7, a8, a9);
}
if (a8 !== void 0) {
return utilformat(a1, a2, a3, a4, a5, a6, a7, a8);
}
if (a7 !== void 0) {
return utilformat(a1, a2, a3, a4, a5, a6, a7);
}
if (a6 !== void 0) {
return utilformat(a1, a2, a3, a4, a5, a6);
}
if (a5 !== void 0) {
return utilformat(a1, a2, a3, a4, a5);
}
if (a4 !== void 0) {
return utilformat(a1, a2, a3, a4);
}
if (a3 !== void 0) {
return utilformat(a1, a2, a3);
}
if (a2 !== void 0) {
return utilformat(a1, a2);
}
return a1;
}
module2.exports = format;
}
});
// ../node_modules/.pnpm/bole@5.0.17/node_modules/bole/bole.js
var require_bole = __commonJS({
"../node_modules/.pnpm/bole@5.0.17/node_modules/bole/bole.js"(exports2, module2) {
"use strict";
var _stringify = require_fast_safe_stringify();
var individual = require_individual()("$$bole", { fastTime: false });
var format = require_format();
var levels = "debug info warn error".split(" ");
var os = require("os");
var pid = process.pid;
var hasObjMode = false;
var scache = [];
var hostname;
try {
hostname = os.hostname();
} catch (e) {
hostname = os.version().indexOf("Windows 7 ") === 0 ? "windows7" : "hostname-unknown";
}
var hostnameSt = _stringify(hostname);
for (const level of levels) {
scache[level] = ',"hostname":' + hostnameSt + ',"pid":' + pid + ',"level":"' + level;
Number(scache[level]);
if (!Array.isArray(individual[level])) {
individual[level] = [];
}
}
function stackToString(e) {
let s = e.stack;
let ce;
if (typeof e.cause === "function" && (ce = e.cause())) {
s += "\nCaused by: " + stackToString(ce);
}
return s;
}
function errorToOut(err, out) {
out.err = {
name: err.name,
message: err.message,
code: err.code,
// perhaps
stack: stackToString(err)
};
}
function requestToOut(req, out) {
out.req = {
method: req.method,
url: req.url,
headers: req.headers,
remoteAddress: req.connection.remoteAddress,
remotePort: req.connection.remotePort
};
}
function objectToOut(obj, out) {
for (const k in obj) {
if (Object.prototype.hasOwnProperty.call(obj, k) && obj[k] !== void 0) {
out[k] = obj[k];
}
}
}
function objectMode(stream) {
return stream._writableState && stream._writableState.objectMode === true;
}
function stringify2(level, name, message, obj) {
let s = '{"time":' + (individual.fastTime ? Date.now() : '"' + (/* @__PURE__ */ new Date()).toISOString() + '"') + scache[level] + '","name":' + name + (message !== void 0 ? ',"message":' + _stringify(message) : "");
for (const k in obj) {
s += "," + _stringify(k) + ":" + _stringify(obj[k]);
}
s += "}";
Number(s);
return s;
}
function extend(level, name, message, obj) {
const newObj = {
time: individual.fastTime ? Date.now() : (/* @__PURE__ */ new Date()).toISOString(),
hostname,
pid,
level,
name
};
if (message !== void 0) {
obj.message = message;
}
for (const k in obj) {
newObj[k] = obj[k];
}
return newObj;
}
function levelLogger(level, name) {
const outputs = individual[level];
const nameSt = _stringify(name);
return function namedLevelLogger(inp, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) {
if (outputs.length === 0) {
return;
}
const out = {};
let objectOut;
let i = 0;
const l = outputs.length;
let stringified;
let message;
if (typeof inp === "string" || inp == null) {
if (!(message = format(inp, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16))) {
message = void 0;
}
} else {
if (inp instanceof Error) {
if (typeof a2 === "object") {
objectToOut(a2, out);
errorToOut(inp, out);
if (!(message = format(a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16))) {
message = void 0;
}
} else {
errorToOut(inp, out);
if (!(message = format(a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16))) {
message = void 0;
}
}
} else {
if (!(message = format(a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16))) {
message = void 0;
}
}
if (typeof inp === "boolean") {
message = String(inp);
} else if (typeof inp === "object" && !(inp instanceof Error)) {
if (inp.method && inp.url && inp.headers && inp.socket) {
requestToOut(inp, out);
} else {
objectToOut(inp, out);
}
}
}
if (l === 1 && !hasObjMode) {
outputs[0].write(Buffer.from(stringify2(level, nameSt, message, out) + "\n"));
return;
}
for (; i < l; i++) {
if (objectMode(outputs[i])) {
if (objectOut === void 0) {
objectOut = extend(level, name, message, out);
}
outputs[i].write(objectOut);
} else {
if (stringified === void 0) {
stringified = Buffer.from(stringify2(level, nameSt, message, out) + "\n");
}
outputs[i].write(stringified);
}
}
};
}
function bole(name) {
function boleLogger(subname) {
return bole(name + ":" + subname);
}
function makeLogger(p, level) {
p[level] = levelLogger(level, name);
return p;
}
return levels.reduce(makeLogger, boleLogger);
}
bole.output = function output(opt) {
let b = false;
if (Array.isArray(opt)) {
opt.forEach(bole.output);
return bole;
}
if (typeof opt.level !== "string") {
throw new TypeError('Must provide a "level" option');
}
for (const level of levels) {
if (!b && level === opt.level) {
b = true;
}
if (b) {
if (opt.stream && objectMode(opt.stream)) {
hasObjMode = true;
}
individual[level].push(opt.stream);
}
}
return bole;
};
bole.reset = function reset() {
for (const level of levels) {
individual[level].splice(0, individual[level].length);
}
individual.fastTime = false;
return bole;
};
bole.setFastTime = function setFastTime(b) {
if (!arguments.length) {
individual.fastTime = true;
} else {
individual.fastTime = b;
}
return bole;
};
module2.exports = bole;
}
});
// ../packages/logger/lib/logger.js
var require_logger = __commonJS({
"../packages/logger/lib/logger.js"(exports2) {
"use strict";
var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports2, "__esModule", { value: true });
exports2.logger = void 0;
exports2.globalWarn = globalWarn;
exports2.globalInfo = globalInfo;
var bole_1 = __importDefault2(require_bole());
bole_1.default.setFastTime();
exports2.logger = (0, bole_1.default)("pnpm");
var globalLogger = (0, bole_1.default)("pnpm:global");
function globalWarn(message) {
globalLogger.warn(message);
}
function globalInfo(message) {
globalLogger.info(message);
}
}
});
// ../node_modules/.pnpm/split2@4.2.0/node_modules/split2/index.js
var require_split2 = __commonJS({
"../node_modules/.pnpm/split2@4.2.0/node_modules/split2/index.js"(exports2, module2) {
"use strict";
var { Transform } = require("stream");
var { StringDecoder } = require("string_decoder");
var kLast = Symbol("last");
var kDecoder = Symbol("decoder");
function transform(chunk, enc, cb) {
let list;
if (this.overflow) {
const buf = this[kDecoder].write(chunk);
list = buf.split(this.matcher);
if (list.length === 1) return cb();
list.shift();
this.overflow = false;
} else {
this[kLast] += this[kDecoder].write(chunk);
list = this[kLast].split(this.matcher);
}
this[kLast] = list.pop();
for (let i = 0; i < list.length; i++) {
try {
push(this, this.mapper(list[i]));
} catch (error) {
return cb(error);
}
}
this.overflow = this[kLast].length > this.maxLength;
if (this.overflow && !this.skipOverflow) {
cb(new Error("maximum buffer reached"));
return;
}
cb();
}
function flush(cb) {
this[kLast] += this[kDecoder].end();
if (this[kLast]) {
try {
push(this, this.mapper(this[kLast]));
} catch (error) {
return cb(error);
}
}
cb();
}
function push(self2, val) {
if (val !== void 0) {
self2.push(val);
}
}
function noop(incoming) {
return incoming;
}
function split(matcher, mapper, options) {
matcher = matcher || /\r?\n/;
mapper = mapper || noop;
options = options || {};
switch (arguments.length) {
case 1:
if (typeof matcher === "function") {
mapper = matcher;
matcher = /\r?\n/;
} else if (typeof matcher === "object" && !(matcher instanceof RegExp) && !matcher[Symbol.split]) {
options = matcher;
matcher = /\r?\n/;
}
break;
case 2:
if (typeof matcher === "function") {
options = mapper;
mapper = matcher;
matcher = /\r?\n/;
} else if (typeof mapper === "object") {
options = mapper;
mapper = noop;
}
}
options = Object.assign({}, options);
options.autoDestroy = true;
options.transform = transform;
options.flush = flush;
options.readableObjectMode = true;
const stream = new Transform(options);
stream[kLast] = "";
stream[kDecoder] = new StringDecoder("utf8");
stream.matcher = matcher;
stream.mapper = mapper;
stream.maxLength = options.maxLength;
stream.skipOverflow = options.skipOverflow || false;
stream.overflow = false;
stream._destroy = function(err, cb) {
this._writableState.errorEmitted = false;
cb(err);
};
return stream;
}
module2.exports = split;
}
});
// ../packages/logger/lib/ndjsonParse.js
var require_ndjsonParse = __commonJS({
"../packages/logger/lib/ndjsonParse.js"(exports2) {
"use strict";
var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports2, "__esModule", { value: true });
exports2.parse = parse2;
var split2_1 = __importDefault2(require_split2());
var opts = { strict: true };
function parse2() {
function parseRow(row) {
try {
if (row)
return JSON.parse(row);
} catch (e) {
if (opts.strict) {
this.emit("error", new Error(`Could not parse row "${row.length > 50 ? `${row.slice(0, 50)}...` : row}"`));
}
}
}
return (0, split2_1.default)(parseRow, opts);
}
}
});
// ../packages/logger/lib/streamParser.js
var require_streamParser = __commonJS({
"../packages/logger/lib/streamParser.js"(exports2) {
"use strict";
var __createBinding3 = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
if (k2 === void 0) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() {
return m[k];
} };
}
Object.defineProperty(o, k2, desc);
} : function(o, m, k, k2) {
if (k2 === void 0) k2 = k;
o[k2] = m[k];
});
var __setModuleDefault3 = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
} : function(o, v) {
o["default"] = v;
});
var __importStar3 = exports2 && exports2.__importStar || function(mod) {
if (mod && mod.__esModule) return mod;
var result2 = {};
if (mod != null) {
for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding3(result2, mod, k);
}
__setModuleDefault3(result2, mod);
return result2;
};
var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports2, "__esModule", { value: true });
exports2.streamParser = void 0;
exports2.createStreamParser = createStreamParser;
var bole_1 = __importDefault2(require_bole());
var ndjson = __importStar3(require_ndjsonParse());
exports2.streamParser = createStreamParser();
function createStreamParser() {
const sp = ndjson.parse();
bole_1.default.output([
{
level: "debug",
stream: sp
}
]);
return sp;
}
}
});
// ../packages/logger/lib/writeToConsole.js
var require_writeToConsole = __commonJS({
"../packages/logger/lib/writeToConsole.js"(exports2) {
"use strict";
var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
Object.defineProperty(exports2, "__esModule", { value: true });
exports2.writeToConsole = writeToConsole;
var bole_1 = __importDefault2(require_bole());
function writeToConsole() {
bole_1.default.output([
{
level: "debug",
stream: process.stdout
}
]);
}
}
});
// ../packages/logger/lib/index.js
var require_lib = __commonJS({
"../packages/logger/lib/index.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", { value: true });
exports2.writeToConsole = exports2.streamParser = exports2.createStreamParser = exports2.globalWarn = exports2.globalInfo = exports2.logger = void 0;
var logger_js_1 = require_logger();
Object.defineProperty(exports2, "logger", { enumerable: true, get: function() {
return logger_js_1.logger;
} });
Object.defineProperty(exports2, "globalInfo", { enumerable: true, get: function() {
return logger_js_1.globalInfo;
} });
Object.defineProperty(exports2, "globalWarn", { enumerable: true, get: function() {
return logger_js_1.globalWarn;
} });
var streamParser_js_1 = require_streamParser();
Object.defineProperty(exports2, "createStreamParser", { enumerable: true, get: function() {
return streamParser_js_1.createStreamParser;
} });
Object.defineProperty(exports2, "streamParser", { enumerable: true, get: function() {
return streamParser_js_1.streamParser;
} });
var writeToConsole_js_1 = require_writeToConsole();
Object.defineProperty(exports2, "writeToConsole", { enumerable: true, get: function() {
return writeToConsole_js_1.writeToConsole;
} });
}
});
// ../node_modules/.pnpm/pidtree@0.6.0/node_modules/pidtree/lib/bin.js
var require_bin = __commonJS({
"../node_modules/.pnpm/pidtree@0.6.0/node_modules/pidtree/lib/bin.js"(exports2, module2) {
"use strict";
var spawn = require("child_process").spawn;
function stripStderr(stderr) {
if (!stderr) return;
stderr = stderr.trim();
var regex = /your \d+x\d+ screen size is bogus\. expect trouble/gi;
stderr = stderr.replace(regex, "");
return stderr.trim();
}
function run(cmd, args, options, done) {
if (typeof options === "function") {
done = options;
options = void 0;
}
var executed = false;
var ch = spawn(cmd, args, options);
var stdout = "";
var stderr = "";
ch.stdout.on("data", function(d) {
stdout += d.toString();
});
ch.stderr.on("data", function(d) {
stderr += d.toString();
});
ch.on("error", function(err) {
if (executed) return;
executed = true;
done(new Error(err));
});
ch.on("close", function(code) {
if (executed) return;
executed = true;
stderr = stripStderr(stderr);
if (stderr) {
return done(new Error(stderr));
}
done(null, stdout, code);
});
}
module2.exports = run;
}
});
// ../node_modules/.pnpm/pidtree@0.6.0/node_modules/pidtree/lib/ps.js
var require_ps = __commonJS({
"../node_modules/.pnpm/pidtree@0.6.0/node_modules/pidtree/lib/ps.js"(exports2, module2) {
"use strict";
var os = require("os");
var bin = require_bin();
function ps(callback) {
var args = ["-A", "-o", "ppid,pid"];
bin("ps", args, function(err, stdout, code) {
if (err) return callback(err);
if (code !== 0) {
return callback(new Error("pidtree ps command exited with code " + code));
}
try {
stdout = stdout.split(os.EOL);
var list = [];
for (var i = 1; i < stdout.length; i++) {
stdout[i] = stdout[i].trim();
if (!stdout[i]) continue;
stdout[i] = stdout[i].split(/\s+/);
stdout[i][0] = parseInt(stdout[i][0], 10);
stdout[i][1] = parseInt(stdout[i][1], 10);
list.push(stdout[i]);
}
callback(null, list);
} catch (error) {
callback(error);
}
});
}
module2.exports = ps;
}
});
// ../node_modules/.pnpm/pidtree@0.6.0/node_modules/pidtree/lib/wmic.js
var require_wmic = __commonJS({
"../node_modules/.pnpm/pidtree@0.6.0/node_modules/pidtree/lib/wmic.js"(exports2, module2) {
"use strict";
var os = require("os");
var bin = require_bin();
function wmic(callback) {
var args = ["PROCESS", "get", "ParentProcessId,ProcessId"];
var options = { windowsHide: true, windowsVerbatimArguments: true };
bin("wmic", args, options, function(err, stdout, code) {
if (err) {
callback(err);
return;
}
if (code !== 0) {
callback(new Error("pidtree wmic command exited with code " + code));
return;
}
try {
stdout = stdout.split(os.EOL);
var list = [];
for (var i = 1; i < stdout.length; i++) {
stdout[i] = stdout[i].trim();
if (!stdout[i]) continue;
stdout[i] = stdout[i].split(/\s+/);
stdout[i][0] = parseInt(stdout[i][0], 10);
stdout[i][1] = parseInt(stdout[i][1], 10);
list.push(stdout[i]);
}
callback(null, list);
} catch (error) {
callback(error);
}
});
}
module2.exports = wmic;
}
});
// ../node_modules/.pnpm/pidtree@0.6.0/node_modules/pidtree/lib/get.js
var require_get = __commonJS({
"../node_modules/.pnpm/pidtree@0.6.0/node_modules/pidtree/lib/get.js"(exports2, module2) {
"use strict";
var os = require("os");
var platformToMethod = {
darwin: "ps",
sunos: "ps",
freebsd: "ps",
netbsd: "ps",
win: "wmic",
linux: "ps",
aix: "ps"
};
var methodToRequireFn = {
ps: () => require_ps(),
wmic: () => require_wmic()
};
var platform = os.platform();
if (platform.startsWith("win")) {
platform = "win";
}
var method = platformToMethod[platform];
function get(callback) {
if (method === void 0) {
callback(
new Error(
os.platform() + " is not supported yet, please open an issue (https://github.com/simonepri/pidtree)"
)
);
}
var list = methodToRequireFn[method]();
list(callback);
}
module2.exports = get;
}
});
// ../node_modules/.pnpm/pidtree@0.6.0/node_modules/pidtree/lib/pidtree.js
var require_pidtree = __commonJS({
"../node_modules/.pnpm/pidtree@0.6.0/node_modules/pidtree/lib/pidtree.js"(exports2, module2) {
"use strict";
var getAll = require_get();
function list(PID, options, callback) {
if (typeof options === "function") {
callback = options;
options = {};
}
if (typeof options !== "object") {
options = {};
}
PID = parseInt(PID, 10);
if (isNaN(PID) || PID < -1) {
callback(new TypeError("The pid provided is invalid"));
return;
}
getAll(function(err, list2) {
if (err) {
callback(err);
return;
}
if (PID === -1) {
for (var i = 0; i < list2.length; i++) {
list2[i] = options.advanced ? { ppid: list2[i][0], pid: list2[i][1] } : list2[i] = list2[i][1];
}
callback(null, list2);
return;
}
var root;
for (var l = 0; l < list2.length; l++) {
if (list2[l][1] === PID) {
root = options.advanced ? { ppid: list2[l][0], pid: PID } : PID;
break;
}
if (list2[l][0] === PID) {
root = options.advanced ? { pid: PID } : PID;
}
}
if (!root) {
callback(new Error("No matching pid found"));
return;
}
var tree = {};
while (list2.length > 0) {
var element = list2.pop();
if (tree[element[0]]) {
tree[element[0]].push(element[1]);
} else {
tree[element[0]] = [element[1]];
}
}
var idx = 0;
var pids = [root];
while (idx < pids.length) {
var curpid = options.advanced ? pids[idx++].pid : pids[idx++];
if (!tree[curpid]) continue;
var length = tree[curpid].length;
for (var j = 0; j < length; j++) {
pids.push(
options.advanced ? { ppid: curpid, pid: tree[curpid][j] } : tree[curpid][j]
);
}
delete tree[curpid];
}
if (!options.root) {
pids.shift();
}
callback(null, pids);
});
}
module2.exports = list;
}
});
// ../node_modules/.pnpm/pidtree@0.6.0/node_modules/pidtree/index.js
var require_pidtree2 = __commonJS({
"../node_modules/.pnpm/pidtree@0.6.0/node_modules/pidtree/index.js"(exports2, module2) {
"use strict";
function pify(fn, arg1, arg2) {
return new Promise(function(resolve, reject) {
fn(arg1, arg2, function(err, data) {
if (err) return reject(err);
resolve(data);
});
});
}
if (!String.prototype.startsWith) {
String.prototype.startsWith = function(suffix) {
return this.substring(0, suffix.length) === suffix;
};
}
var pidtree = require_pidtree();
function list(pid, options, callback) {
if (typeof options === "function") {
callback = options;
options = void 0;
}
if (typeof callback === "function") {
pidtree(pid, options, callback);
return;
}
return pify(pidtree, pid, options);
}
module2.exports = list;
}
});
// ../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/signals.js
var require_signals = __commonJS({
"../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/signals.js"(exports2, module2) {
module2.exports = [
"SIGABRT",
"SIGALRM",
"SIGHUP",
"SIGINT",
"SIGTERM"
];
if (process.platform !== "win32") {
module2.exports.push(
"SIGVTALRM",
"SIGXCPU",
"SIGXFSZ",
"SIGUSR2",
"SIGTRAP",
"SIGSYS",
"SIGQUIT",
"SIGIOT"
// should detect profiler and enable/disable accordingly.
// see #21
// 'SIGPROF'
);
}
if (process.platform === "linux") {
module2.exports.push(
"SIGIO",
"SIGPOLL",
"SIGPWR",
"SIGSTKFLT",
"SIGUNUSED"
);
}
}
});
// ../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js
var require_signal_exit = __commonJS({
"../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js"(exports2, module2) {
var process2 = global.process;
var processOk = function(process3) {
return process3 && typeof process3 === "object" && typeof process3.removeListener === "function" && typeof process3.emit === "function" && typeof process3.reallyExit === "function" && typeof process3.listeners === "function" && typeof process3.kill === "function" && typeof process3.pid === "number" && typeof process3.on === "function";
};
if (!processOk(process2)) {
module2.exports = function() {
return function() {
};
};
} else {
assert = require("assert");
signals = require_signals();
isWin = /^win/i.test(process2.platform);
EE = require("events");
if (typeof EE !== "function") {
EE = EE.EventEmitter;
}
if (process2.__signal_exit_emitter__) {
emitter = process2.__signal_exit_emitter__;
} else {
emitter = process2.__signal_exit_emitter__ = new EE();
emitter.count = 0;
emitter.emitted = {};
}
if (!emitter.infinite) {
emitter.setMaxListeners(Infinity);
emitter.infinite = true;
}
module2.exports = function(cb, opts) {
if (!processOk(global.process)) {
return function() {
};
}
assert.equal(typeof cb, "function", "a callback must be provided for exit handler");
if (loaded === false) {
load();
}
var ev = "exit";
if (opts && opts.alwaysLast) {
ev = "afterexit";
}
var remove = function() {
emitter.removeListener(ev, cb);
if (emitter.listeners("exit").length === 0 && emitter.listeners("afterexit").length === 0) {
unload();
}
};
emitter.on(ev, cb);
return remove;
};
unload = function unload2() {
if (!loaded || !processOk(global.process)) {
return;
}
loaded = false;
signals.forEach(function(sig) {
try {
process2.removeListener(sig, sigListeners[sig]);
} catch (er) {
}
});
process2.emit = originalProcessEmit;
process2.reallyExit = originalProcessReallyExit;
emitter.count -= 1;
};
module2.exports.unload = unload;
emit = function emit2(event, code, signal) {
if (emitter.emitted[event]) {
return;
}
emitter.emitted[event] = true;
emitter.emit(event, code, signal);
};
sigListeners = {};
signals.forEach(function(sig) {
sigListeners[sig] = function listener() {
if (!processOk(global.process)) {
return;
}
var listeners = process2.listeners(sig);
if (listeners.length === emitter.count) {
unload();
emit("exit", null, sig);
emit("afterexit", null, sig);
if (isWin && sig === "SIGHUP") {
sig = "SIGINT";
}
process2.kill(process2.pid, sig);
}
};
});
module2.exports.signals = function() {
return signals;
};
loaded = false;
load = function load2() {
if (loaded || !processOk(global.process)) {
return;
}
loaded = true;
emitter.count += 1;
signals = signals.filter(function(sig) {
try {
process2.on(sig, sigListeners[sig]);
return true;
} catch (er) {
return false;
}
});
process2.emit = processEmit;
process2.reallyExit = processReallyExit;
};
module2.exports.load = load;
originalProcessReallyExit = process2.reallyExit;
processReallyExit = function processReallyExit2(code) {
if (!processOk(global.process)) {
return;
}
process2.exitCode = code || /* istanbul ignore next */
0;
emit("exit", process2.exitCode, null);
emit("afterexit", process2.exitCode, null);
originalProcessReallyExit.call(process2, process2.exitCode);
};
originalProcessEmit = process2.emit;
processEmit = function processEmit2(ev, arg) {
if (ev === "exit" && processOk(global.process)) {
if (arg !== void 0) {
process2.exitCode = arg;
}
var ret2 = originalProcessEmit.apply(this, arguments);
emit("exit", process2.exitCode, null);
emit("afterexit", process2.exitCode, null);
return ret2;
} else {
return originalProcessEmit.apply(this, arguments);
}
};
}
var assert;
var signals;
var isWin;
var EE;
var emitter;
var unload;
var emit;
var sigListeners;
var loaded;
var load;
var originalProcessReallyExit;
var processReallyExit;
var originalProcessEmit;
var processEmit;
}
});
// ../node_modules/.pnpm/array-find-index@1.0.2/node_modules/array-find-index/index.js
var require_array_find_index = __commonJS({
"../node_modules/.pnpm/array-find-index@1.0.2/node_modules/array-find-index/index.js"(exports2, module2) {
"use strict";
module2.exports = function(arr, predicate, ctx) {
if (typeof Array.prototype.findIndex === "function") {
return arr.findIndex(predicate, ctx);
}
if (typeof predicate !== "function") {
throw new TypeError("predicate must be a function");
}
var list = Object(arr);
var len = list.length;
if (len === 0) {
return -1;
}
for (var i = 0; i < len; i++) {
if (predicate.call(ctx, list[i], i, list)) {
return i;
}
}
return -1;
};
}
});
// ../node_modules/.pnpm/currently-unhandled@0.4.1/node_modules/currently-unhandled/core.js
var require_core = __commonJS({
"../node_modules/.pnpm/currently-unhandled@0.4.1/node_modules/currently-unhandled/core.js"(exports2, module2) {
"use strict";
var arrayFindIndex = require_array_find_index();
module2.exports = function() {
var unhandledRejections = [];
function onUnhandledRejection(reason, promise) {
unhandledRejections.push({ reason, promise });
}
function onRejectionHandled(promise) {
var index = arrayFindIndex(unhandledRejections, function(x) {
return x.promise === promise;
});
unhandledRejections.splice(index, 1);
}
function currentlyUnhandled() {
return unhandledRejections.map(function(entry) {
return {
reason: entry.reason,
promise: entry.promise
};
});
}
return {
onUnhandledRejection,
onRejectionHandled,
currentlyUnhandled
};
};
}
});
// ../node_modules/.pnpm/currently-unhandled@0.4.1/node_modules/currently-unhandled/index.js
var require_currently_unhandled = __commonJS({
"../node_modules/.pnpm/currently-unhandled@0.4.1/node_modules/currently-unhandled/index.js"(exports2, module2) {
"use strict";
var core = require_core();
module2.exports = function(p) {
p = p || process;
var c = core();
p.on("unhandledRejection", c.onUnhandledRejection);
p.on("rejectionHandled", c.onRejectionHandled);
return c.currentlyUnhandled;
};
}
});
// ../node_modules/.pnpm/loud-rejection@2.2.0/node_modules/loud-rejection/index.js
var require_loud_rejection = __commonJS({
"../node_modules/.pnpm/loud-rejection@2.2.0/node_modules/loud-rejection/index.js"(exports2, module2) {
"use strict";
var util = require("util");
var onExit = require_signal_exit();
var currentlyUnhandled = require_currently_unhandled();
var installed = false;
var loudRejection = (log = console.error) => {
if (installed) {
return;
}
installed = true;
const listUnhandled = currentlyUnhandled();
onExit(() => {
const unhandledRejections = listUnhandled();
if (unhandledRejections.length > 0) {
for (const unhandledRejection of unhandledRejections) {
let error = unhandledRejection.reason;
if (!(error instanceof Error)) {
error = new Error(`Promise rejected with value: ${util.inspect(error)}`);
}
log(error.stack);
}
process.exitCode = 1;
}
});
};
module2.exports = loudRejection;
module2.exports.default = loudRejection;
}
});
// ../node_modules/.pnpm/graceful-fs@4.2.11_patch_hash=68ebc232025360cb3dcd3081f4067f4e9fc022ab6b6f71a3230e86c7a5b337d1/node_modules/graceful-fs/polyfills.js
var require_polyfills = __commonJS({
"../node_modules/.pnpm/graceful-fs@4.2.11_patch_hash=68ebc232025360cb3dcd3081f4067f4e9fc022ab6b6f71a3230e86c7a5b337d1/node_modules/graceful-fs/polyfills.js"(exports2, module2) {
var constants = require("constants");
var origCwd = process.cwd;
var cwd = null;
var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
process.cwd = function() {
if (!cwd)
cwd = origCwd.call(process);
return cwd;
};
try {
process.cwd();
} catch (er) {
}
if (typeof process.chdir === "function") {
chdir = process.chdir;
process.chdir = function(d) {
cwd = null;
chdir.call(process, d);
};
if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir);
}
var chdir;
module2.exports = patch;
function patch(fs) {
if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
patchLchmod(fs);
}
if (!fs.lutimes) {
patchLutimes(fs);
}
fs.chown = chownFix(fs.chown);
fs.fchown = chownFix(fs.fchown);
fs.lchown = chownFix(fs.lchown);
fs.chmod = chmodFix(fs.chmod);
fs.fchmod = chmodFix(fs.fchmod);
fs.lchmod = chmodFix(fs.lchmod);
fs.chownSync = chownFixSync(fs.chownSync);
fs.fchownSync = chownFixSync(fs.fchownSync);
fs.lchownSync = chownFixSync(fs.lchownSync);
fs.chmodSync = chmodFixSync(fs.chmodSync);
fs.fchmodSync = chmodFixSync(fs.fchmodSync);
fs.lchmodSync = chmodFixSync(fs.lchmodSync);
fs.stat = statFix(fs.stat);
fs.fstat = statFix(fs.fstat);
fs.lstat = statFix(fs.lstat);
fs.statSync = statFixSync(fs.statSync);
fs.fstatSync = statFixSync(fs.fstatSync);
fs.lstatSync = statFixSync(fs.lstatSync);
if (fs.chmod && !fs.lchmod) {
fs.lchmod = function(path2, mode, cb) {
if (cb) process.nextTick(cb);
};
fs.lchmodSync = function() {
};
}
if (fs.chown && !fs.lchown) {
fs.lchown = function(path2, uid, gid, cb) {
if (cb) process.nextTick(cb);
};
fs.lchownSync = function() {
};
}
if (platform === "win32") {
fs.rename = typeof fs.rename !== "function" ? fs.rename : function(fs$rename) {
function rename(from, to, cb) {
var start = Date.now();
var backoff = 0;
fs$rename(from, to, function CB(er) {
if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
setTimeout(function() {
fs.stat(to, function(stater, st) {
if (stater && stater.code === "ENOENT")
fs$rename(from, to, CB);
else
cb(er);
});
}, backoff);
if (backoff < 100)
backoff += 10;
return;
}
if (cb) cb(er);
});
}
if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
return rename;
}(fs.rename);
}
fs.read = typeof fs.read !== "function" ? fs.read : function(fs$read) {
function read(fd, buffer, offset, length, position, callback_) {
var callback;
if (callback_ && typeof callback_ === "function") {
var eagCounter = 0;
callback = function(er, _, __) {
if (er && er.code === "EAGAIN" && eagCounter < 10) {
eagCounter++;
return fs$read.call(fs, fd, buffer, offset, length, position, callback);
}
callback_.apply(this, arguments);
};
}
return fs$read.call(fs, fd, buffer, offset, length, position, callback);
}
if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
return read;
}(fs.read);
fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ function(fs$readSync) {
return function(fd, buffer, offset, length, position) {
var eagCounter = 0;
while (true) {
try {
return fs$readSync.call(fs, fd, buffer, offset, length, position);
} catch (er) {
if (er.code === "EAGAIN" && eagCounter < 10) {
eagCounter++;
continue;
}
throw er;
}
}
};
}(fs.readSync);
function patchLchmod(fs2) {
fs2.lchmod = function(path2, mode, callback) {
fs2.open(
path2,
constants.O_WRONLY | constants.O_SYMLINK,
mode,
function(err, fd) {
if (err) {
if (callback) callback(err);
return;
}
fs2.fchmod(fd, mode, function(err2) {
fs2.close(fd, function(err22) {
if (callback) callback(err2 || err22);
});
});
}
);
};
fs2.lchmodSync = function(path2, mode) {
var fd = fs2.openSync(path2, constants.O_WRONLY | constants.O_SYMLINK, mode);
var threw = true;
var ret2;
try {
ret2 = fs2.fchmodSync(fd, mode);
threw = false;
} finally {
if (threw) {
try {
fs2.closeSync(fd);
} catch (er) {
}
} else {
fs2.closeSync(fd);
}
}
return ret2;
};
}
function patchLutimes(fs2) {
if (constants.hasOwnProperty("O_SYMLINK") && fs2.futimes) {
fs2.lutimes = function(path2, at, mt, cb) {
fs2.open(path2, constants.O_SYMLINK, function(er, fd) {
if (er) {
if (cb) cb(er);
return;
}
fs2.futimes(fd, at, mt, function(er2) {
fs2.close(fd, function(er22) {
if (cb) cb(er2 || er22);
});
});
});
};
fs2.lutimesSync = function(path2, at, mt) {
var fd = fs2.openSync(path2, constants.O_SYMLINK);
var ret2;
var threw = true;
try {
ret2 = fs2.futimesSync(fd, at, mt);
threw = false;
} finally {
if (threw) {
try {