pnpm
Version:
1,495 lines (1,474 loc) • 12.7 MB
JavaScript
import { createRequire as _cr } from 'module';const require = _cr(import.meta.url); const __filename = import.meta.filename; const __dirname = import.meta.dirname;var _ew=process.emitWarning;process.emitWarning=function(w,...a){if(String(w).includes('SQLite')&&(a[0]==='ExperimentalWarning'||(a[0]&&a[0].type==='ExperimentalWarning')))return;return _ew.call(process,w,...a)};
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 __require = /* @__PURE__ */ ((x2) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x2, {
get: (a2, b) => (typeof require !== "undefined" ? require : a2)[b]
}) : x2)(function(x2) {
if (typeof require !== "undefined") return require.apply(this, arguments);
throw Error('Dynamic require of "' + x2 + '" is not supported');
});
var __esm = (fn, res, err2) => function __init() {
if (err2) throw err2[0];
try {
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
} catch (e) {
throw err2 = [e], e;
}
};
var __commonJS = (cb, mod2) => function __require3() {
try {
return mod2 || (0, cb[__getOwnPropNames(cb)[0]])((mod2 = { exports: {} }).exports, mod2), mod2.exports;
} catch (e) {
throw mod2 = 0, e;
}
};
var __export = (target2, all) => {
for (var name in all)
__defProp(target2, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from5, except, desc) => {
if (from5 && typeof from5 === "object" || typeof from5 === "function") {
for (let key of __getOwnPropNames(from5))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from5[key], enumerable: !(desc = __getOwnPropDesc(from5, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod2, isNodeMode, target2) => (target2 = mod2 != null ? __create(__getProtoOf(mod2)) : {}, __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 || !mod2 || !mod2.__esModule ? __defProp(target2, "default", { value: mod2, enumerable: true }) : target2,
mod2
));
var __toCommonJS = (mod2) => __copyProps(__defProp({}, "__esModule", { value: true }), mod2);
// ../core/constants/lib/index.js
var WANTED_LOCKFILE, LOCKFILE_MAJOR_VERSION, LOCKFILE_VERSION, MANIFEST_BASE_NAMES, ENGINE_NAME, LAYOUT_VERSION, STORE_VERSION, GLOBAL_LAYOUT_VERSION, GLOBAL_CONFIG_YAML_FILENAME, WORKSPACE_MANIFEST_FILENAME, ABBREVIATED_META_DIR, FULL_META_DIR, FULL_FILTERED_META_DIR;
var init_lib = __esm({
"../core/constants/lib/index.js"() {
"use strict";
WANTED_LOCKFILE = "pnpm-lock.yaml";
LOCKFILE_MAJOR_VERSION = "9";
LOCKFILE_VERSION = `${LOCKFILE_MAJOR_VERSION}.0`;
MANIFEST_BASE_NAMES = ["package.json", "package.json5", "package.yaml"];
ENGINE_NAME = `${process.platform};${process.arch};node${process.version.split(".")[0].substring(1)}`;
LAYOUT_VERSION = 5;
STORE_VERSION = "v11";
GLOBAL_LAYOUT_VERSION = "v11";
GLOBAL_CONFIG_YAML_FILENAME = "config.yaml";
WORKSPACE_MANIFEST_FILENAME = "pnpm-workspace.yaml";
ABBREVIATED_META_DIR = "v11/metadata";
FULL_META_DIR = "v11/metadata-full";
FULL_FILTERED_META_DIR = "v11/metadata-full-filtered";
}
});
// ../core/error/lib/index.js
function redactUrlCredentials(text) {
let result2 = "";
let cursor = 0;
while (cursor < text.length) {
const schemeSep = text.indexOf("://", cursor);
if (schemeSep === -1)
return result2 + text.slice(cursor);
const authorityStart = schemeSep + 3;
result2 += text.slice(cursor, authorityStart);
cursor = authorityStart;
if (schemeSep === 0 || !isSchemeTailChar(text.charCodeAt(schemeSep - 1)))
continue;
let lastAt = -1;
for (let i4 = authorityStart; i4 < text.length; i4++) {
const code = text.charCodeAt(i4);
if (code === 47 || code === 63 || code === 35 || isAsciiWhitespace(code))
break;
if (code === 64)
lastAt = i4;
}
if (lastAt !== -1)
cursor = lastAt + 1;
}
return result2;
}
function isSchemeTailChar(code) {
return code >= 48 && code <= 57 || code >= 65 && code <= 90 || code >= 97 && code <= 122;
}
function isAsciiWhitespace(code) {
return code === 32 || code === 9 || code === 10 || code === 11 || code === 12 || code === 13;
}
function hideAuthInformation(authHeaderValue) {
const [authType, token] = authHeaderValue.split(" ");
if (token == null)
return "[hidden]";
if (token.length < 20) {
return `${authType} [hidden]`;
}
return `${authType} ${token.substring(0, 4)}[hidden]`;
}
var PnpmError, FetchError, LockfileMissingDependencyError;
var init_lib2 = __esm({
"../core/error/lib/index.js"() {
"use strict";
init_lib();
PnpmError = class extends Error {
code;
hint;
attempts;
prefix;
pkgsStack;
constructor(code, message, opts3) {
super(message, { cause: opts3?.cause });
this.code = code.startsWith("ERR_PNPM_") ? code : `ERR_PNPM_${code}`;
this.hint = opts3?.hint;
this.attempts = opts3?.attempts;
}
};
FetchError = class extends PnpmError {
response;
request;
constructor(request, response, hint) {
const _request = {
url: request.url
};
if (request.authHeaderValue) {
_request.authHeaderValue = hideAuthInformation(request.authHeaderValue);
}
const message = `GET ${redactUrlCredentials(request.url)}: ${response.statusText} - ${response.status}`;
if (response.status === 401 || response.status === 403 || response.status === 404) {
hint = hint ? `${hint}
` : "";
if (_request.authHeaderValue) {
hint += `An authorization header was used: ${_request.authHeaderValue}`;
} else {
hint += "No authorization header was set for the request.";
}
}
super(`FETCH_${response.status}`, message, { hint });
this.request = _request;
this.response = response;
}
};
LockfileMissingDependencyError = class extends PnpmError {
constructor(depPath) {
const message = `Broken lockfile: no entry for '${depPath}' in ${WANTED_LOCKFILE}`;
super("LOCKFILE_MISSING_DEPENDENCY", message, {
hint: "This issue is probably caused by a badly resolved merge conflict.\nTo fix the lockfile, run 'pnpm install --no-frozen-lockfile'."
});
}
};
}
});
// ../core/logger/lib/LogBase.js
var init_LogBase = __esm({
"../core/logger/lib/LogBase.js"() {
"use strict";
}
});
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/fast-safe-stringify/2.1.1/71177aa317bf9c10d6ba54feb1e03d154d670845bac275960b4cc587a01d5783/node_modules/fast-safe-stringify/index.js
var require_fast_safe_stringify = __commonJS({
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/fast-safe-stringify/2.1.1/71177aa317bf9c10d6ba54feb1e03d154d670845bac275960b4cc587a01d5783/node_modules/fast-safe-stringify/index.js"(exports2, module2) {
module2.exports = stringify;
stringify.default = stringify;
stringify.stable = deterministicStringify;
stringify.stableStringify = deterministicStringify;
var LIMIT_REPLACE_NODE = "[...]";
var CIRCULAR_REPLACE_NODE = "[Circular]";
var arr = [];
var replacerStack = [];
function defaultOptions4() {
return {
depthLimit: Number.MAX_SAFE_INTEGER,
edgesLimit: Number.MAX_SAFE_INTEGER
};
}
function stringify(obj, replacer2, spacer, options) {
if (typeof options === "undefined") {
options = defaultOptions4();
}
decirc(obj, "", 0, [], void 0, 0, options);
var res;
try {
if (replacerStack.length === 0) {
res = JSON.stringify(obj, replacer2, spacer);
} else {
res = JSON.stringify(obj, replaceGetterValues(replacer2), 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, k2, parent) {
var propertyDescriptor = Object.getOwnPropertyDescriptor(parent, k2);
if (propertyDescriptor.get !== void 0) {
if (propertyDescriptor.configurable) {
Object.defineProperty(parent, k2, { value: replace });
arr.push([parent, k2, val, propertyDescriptor]);
} else {
replacerStack.push([val, k2, replace]);
}
} else {
parent[k2] = replace;
arr.push([parent, k2, val]);
}
}
function decirc(val, k2, edgeIndex, stack, parent, depth, options) {
depth += 1;
var i4;
if (typeof val === "object" && val !== null) {
for (i4 = 0; i4 < stack.length; i4++) {
if (stack[i4] === val) {
setReplace(CIRCULAR_REPLACE_NODE, val, k2, parent);
return;
}
}
if (typeof options.depthLimit !== "undefined" && depth > options.depthLimit) {
setReplace(LIMIT_REPLACE_NODE, val, k2, parent);
return;
}
if (typeof options.edgesLimit !== "undefined" && edgeIndex + 1 > options.edgesLimit) {
setReplace(LIMIT_REPLACE_NODE, val, k2, parent);
return;
}
stack.push(val);
if (Array.isArray(val)) {
for (i4 = 0; i4 < val.length; i4++) {
decirc(val[i4], i4, i4, stack, val, depth, options);
}
} else {
var keys4 = Object.keys(val);
for (i4 = 0; i4 < keys4.length; i4++) {
var key = keys4[i4];
decirc(val[key], key, i4, stack, val, depth, options);
}
}
stack.pop();
}
}
function compareFunction(a2, b) {
if (a2 < b) {
return -1;
}
if (a2 > b) {
return 1;
}
return 0;
}
function deterministicStringify(obj, replacer2, spacer, options) {
if (typeof options === "undefined") {
options = defaultOptions4();
}
var tmp = deterministicDecirc(obj, "", 0, [], void 0, 0, options) || obj;
var res;
try {
if (replacerStack.length === 0) {
res = JSON.stringify(tmp, replacer2, spacer);
} else {
res = JSON.stringify(tmp, replaceGetterValues(replacer2), 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, k2, edgeIndex, stack, parent, depth, options) {
depth += 1;
var i4;
if (typeof val === "object" && val !== null) {
for (i4 = 0; i4 < stack.length; i4++) {
if (stack[i4] === val) {
setReplace(CIRCULAR_REPLACE_NODE, val, k2, parent);
return;
}
}
try {
if (typeof val.toJSON === "function") {
return;
}
} catch (_) {
return;
}
if (typeof options.depthLimit !== "undefined" && depth > options.depthLimit) {
setReplace(LIMIT_REPLACE_NODE, val, k2, parent);
return;
}
if (typeof options.edgesLimit !== "undefined" && edgeIndex + 1 > options.edgesLimit) {
setReplace(LIMIT_REPLACE_NODE, val, k2, parent);
return;
}
stack.push(val);
if (Array.isArray(val)) {
for (i4 = 0; i4 < val.length; i4++) {
deterministicDecirc(val[i4], i4, i4, stack, val, depth, options);
}
} else {
var tmp = {};
var keys4 = Object.keys(val).sort(compareFunction);
for (i4 = 0; i4 < keys4.length; i4++) {
var key = keys4[i4];
deterministicDecirc(val[key], key, i4, stack, val, depth, options);
tmp[key] = val[key];
}
if (typeof parent !== "undefined") {
arr.push([parent, k2, val]);
parent[k2] = tmp;
} else {
return tmp;
}
}
stack.pop();
}
}
function replaceGetterValues(replacer2) {
replacer2 = typeof replacer2 !== "undefined" ? replacer2 : function(k2, v) {
return v;
};
return function(key, val) {
if (replacerStack.length > 0) {
for (var i4 = 0; i4 < replacerStack.length; i4++) {
var part = replacerStack[i4];
if (part[1] === key && part[0] === val) {
val = part[2];
replacerStack.splice(i4, 1);
break;
}
}
}
return replacer2.call(this, key, val);
};
}
}
});
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/individual/3.0.0/82ec8ef054bfaf915092db8496dd7cdf5d8a529ff6202ce432d93772b51b5045/node_modules/individual/index.js
var require_individual = __commonJS({
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/individual/3.0.0/82ec8ef054bfaf915092db8496dd7cdf5d8a529ff6202ce432d93772b51b5045/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;
}
}
});
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/bole/5.0.29/6922e0a3a11b46fb67db71b821bacb20a87db33d8d1fb079a84a148dc6373834/node_modules/bole/format.js
var require_format = __commonJS({
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/bole/5.0.29/6922e0a3a11b46fb67db71b821bacb20a87db33d8d1fb079a84a148dc6373834/node_modules/bole/format.js"(exports2, module2) {
var utilformat = __require("util").format;
function format2(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 = format2;
}
});
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/bole/5.0.29/6922e0a3a11b46fb67db71b821bacb20a87db33d8d1fb079a84a148dc6373834/node_modules/bole/bole.js
var require_bole = __commonJS({
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/bole/5.0.29/6922e0a3a11b46fb67db71b821bacb20a87db33d8d1fb079a84a148dc6373834/node_modules/bole/bole.js"(exports2, module2) {
"use strict";
var _stringify = require_fast_safe_stringify();
var individual = require_individual()("$$bole", { fastTime: false });
var format2 = require_format();
var levels = "debug info warn error".split(" ");
var os17 = __require("os");
var pid = process.pid;
var hasObjMode = false;
var scache = [];
var hostname;
try {
hostname = os17.hostname();
} catch (e) {
hostname = os17.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(err2, out) {
out.err = {
name: err2.name,
message: err2.message,
code: err2.code,
// perhaps
stack: stackToString(err2)
};
}
function requestToOut(req2, out) {
out.req = {
method: req2.method,
url: req2.url,
headers: req2.headers,
remoteAddress: req2.connection.remoteAddress,
remotePort: req2.connection.remotePort
};
}
function objectToOut(obj, out) {
for (const k2 in obj) {
if (Object.prototype.hasOwnProperty.call(obj, k2) && obj[k2] !== void 0) {
out[k2] = obj[k2];
}
}
}
function objectMode(stream2) {
return stream2._writableState && stream2._writableState.objectMode === true;
}
function stringify(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 k2 in obj) {
s += "," + _stringify(k2) + ":" + _stringify(obj[k2]);
}
s += "}";
Number(s);
return s;
}
function extend3(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 k2 in obj) {
newObj[k2] = obj[k2];
}
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 i4 = 0;
const l = outputs.length;
let stringified;
let message;
if (typeof inp === "string" || inp == null) {
if (!(message = format2(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 = format2(a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16))) {
message = void 0;
}
} else {
errorToOut(inp, out);
if (!(message = format2(a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16))) {
message = void 0;
}
}
} else {
if (!(message = format2(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(stringify(level, nameSt, message, out) + "\n"));
return;
}
for (; i4 < l; i4++) {
if (objectMode(outputs[i4])) {
if (objectOut === void 0) {
objectOut = extend3(level, name, message, out);
}
outputs[i4].write(objectOut);
} else {
if (stringified === void 0) {
stringified = Buffer.from(stringify(level, nameSt, message, out) + "\n");
}
outputs[i4].write(stringified);
}
}
};
}
function bole7(name) {
function boleLogger(subname) {
return bole7(name + ":" + subname);
}
function makeLogger(p, level) {
p[level] = levelLogger(level, name);
return p;
}
return levels.reduce(makeLogger, boleLogger);
}
bole7.output = function output(opt) {
let b = false;
if (Array.isArray(opt)) {
opt.forEach(bole7.output);
return bole7;
}
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 bole7;
};
bole7.reset = function reset2() {
for (const level of levels) {
individual[level].splice(0, individual[level].length);
}
individual.fastTime = false;
return bole7;
};
bole7.setFastTime = function setFastTime(b) {
if (!arguments.length) {
individual.fastTime = true;
} else {
individual.fastTime = b;
}
return bole7;
};
module2.exports = bole7;
}
});
// ../core/logger/lib/logger.js
function globalWarn(message) {
globalLogger.warn(message);
}
function globalInfo(message) {
globalLogger.info(message);
}
var import_bole, logger, globalLogger;
var init_logger = __esm({
"../core/logger/lib/logger.js"() {
"use strict";
import_bole = __toESM(require_bole(), 1);
import_bole.default.setFastTime();
logger = (0, import_bole.default)("pnpm");
globalLogger = (0, import_bole.default)("pnpm:global");
}
});
// ../core/logger/lib/LogLevel.js
var init_LogLevel = __esm({
"../core/logger/lib/LogLevel.js"() {
"use strict";
}
});
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/split2/4.2.0/40e414c630ab7f443818aa50ee06a670a46fe60cf81f7f81a46733d76a4ce6ba/node_modules/split2/index.js
var require_split2 = __commonJS({
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/split2/4.2.0/40e414c630ab7f443818aa50ee06a670a46fe60cf81f7f81a46733d76a4ce6ba/node_modules/split2/index.js"(exports2, module2) {
"use strict";
var { Transform: Transform2 } = __require("stream");
var { StringDecoder: StringDecoder4 } = __require("string_decoder");
var kLast = /* @__PURE__ */ Symbol("last");
var kDecoder = /* @__PURE__ */ Symbol("decoder");
function transform3(chunk, enc, cb) {
let list2;
if (this.overflow) {
const buf = this[kDecoder].write(chunk);
list2 = buf.split(this.matcher);
if (list2.length === 1) return cb();
list2.shift();
this.overflow = false;
} else {
this[kLast] += this[kDecoder].write(chunk);
list2 = this[kLast].split(this.matcher);
}
this[kLast] = list2.pop();
for (let i4 = 0; i4 < list2.length; i4++) {
try {
push(this, this.mapper(list2[i4]));
} 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 noop5(incoming) {
return incoming;
}
function split4(matcher, mapper, options) {
matcher = matcher || /\r?\n/;
mapper = mapper || noop5;
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 = noop5;
}
}
options = Object.assign({}, options);
options.autoDestroy = true;
options.transform = transform3;
options.flush = flush;
options.readableObjectMode = true;
const stream2 = new Transform2(options);
stream2[kLast] = "";
stream2[kDecoder] = new StringDecoder4("utf8");
stream2.matcher = matcher;
stream2.mapper = mapper;
stream2.maxLength = options.maxLength;
stream2.skipOverflow = options.skipOverflow || false;
stream2.overflow = false;
stream2._destroy = function(err2, cb) {
this._writableState.errorEmitted = false;
cb(err2);
};
return stream2;
}
module2.exports = split4;
}
});
// ../core/logger/lib/ndjsonParse.js
function parse() {
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, import_split2.default)(parseRow, opts);
}
var import_split2, opts;
var init_ndjsonParse = __esm({
"../core/logger/lib/ndjsonParse.js"() {
"use strict";
import_split2 = __toESM(require_split2(), 1);
opts = { strict: true };
}
});
// ../core/logger/lib/streamParser.js
function createStreamParser() {
const sp = parse();
import_bole2.default.output([
{
level: "debug",
stream: sp
}
]);
return sp;
}
var import_bole2, streamParser;
var init_streamParser = __esm({
"../core/logger/lib/streamParser.js"() {
"use strict";
import_bole2 = __toESM(require_bole(), 1);
init_ndjsonParse();
streamParser = createStreamParser();
}
});
// ../core/logger/lib/writeToConsole.js
function writeToConsole() {
import_bole3.default.output([
{
level: "debug",
stream: process.stdout
}
]);
}
var import_bole3;
var init_writeToConsole = __esm({
"../core/logger/lib/writeToConsole.js"() {
"use strict";
import_bole3 = __toESM(require_bole(), 1);
}
});
// ../core/logger/lib/index.js
var init_lib3 = __esm({
"../core/logger/lib/index.js"() {
"use strict";
init_LogBase();
init_logger();
init_LogLevel();
init_streamParser();
init_writeToConsole();
}
});
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@rushstack/worker-pool/0.7.18/b776d0a306271a7724761fceda79b00a900070db8c0f20fee53ce030fea08964/node_modules/@rushstack/worker-pool/lib-commonjs/WorkerPool.js
var require_WorkerPool = __commonJS({
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@rushstack/worker-pool/0.7.18/b776d0a306271a7724761fceda79b00a900070db8c0f20fee53ce030fea08964/node_modules/@rushstack/worker-pool/lib-commonjs/WorkerPool.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", { value: true });
exports2.WorkerPool = exports2.WORKER_ID_SYMBOL = void 0;
var node_worker_threads_1 = __require("node:worker_threads");
exports2.WORKER_ID_SYMBOL = /* @__PURE__ */ Symbol("workerId");
var WorkerPool2 = class {
constructor(options) {
const { id, maxWorkers, onWorkerDestroyed, prepareWorker, workerData, workerScriptPath, workerResourceLimits } = options;
this.id = id;
this.maxWorkers = maxWorkers;
this._alive = [];
this._error = void 0;
this._finishing = false;
this._idle = [];
this._nextId = 0;
this._onComplete = [];
this._onWorkerDestroyed = onWorkerDestroyed;
this._pending = [];
this._prepare = prepareWorker;
this._workerData = workerData;
this._workerScript = workerScriptPath;
this._workerResourceLimits = workerResourceLimits;
}
/**
* Gets the count of active workers.
*/
getActiveCount() {
return this._alive.length - this._idle.length;
}
/**
* Gets the count of idle workers.
*/
getIdleCount() {
return this._idle.length;
}
/**
* Gets the count of live workers.
*/
getLiveCount() {
return this._alive.length;
}
/**
* Tells the pool to shut down when all workers are done.
* Returns a promise that will be fulfilled if all workers finish successfully, or reject with the first error.
*/
async finishAsync() {
this._finishing = true;
if (this._error) {
throw this._error;
}
if (!this._alive.length) {
return;
}
for (const worker of this._idle.splice(0)) {
worker.postMessage(false);
}
await new Promise((resolve4, reject3) => this._onComplete.push([resolve4, reject3]));
}
/**
* Resets the pool and allows more work
*/
reset() {
this._finishing = false;
this._error = void 0;
}
/**
* Returns a worker to the pool. If the pool is finishing, deallocates the worker.
* @param worker - The worker to free
*/
checkinWorker(worker) {
if (this._error) {
worker.postMessage(false);
return;
}
const next2 = this._pending.shift();
if (next2) {
next2[0](worker);
} else if (this._finishing) {
worker.postMessage(false);
} else {
this._idle.push(worker);
}
}
/**
* Checks out a currently available worker or waits for the next free worker.
* @param allowCreate - If creating new workers is allowed (subject to maxSize)
*/
async checkoutWorkerAsync(allowCreate) {
if (this._error) {
throw this._error;
}
let worker = this._idle.shift();
if (!worker && allowCreate) {
worker = this._createWorker();
}
if (worker) {
return worker;
}
return await new Promise((resolve4, reject3) => {
this._pending.push([resolve4, reject3]);
});
}
/**
* Creates a new worker if allowed by maxSize.
*/
_createWorker() {
if (this._alive.length >= this.maxWorkers) {
return;
}
const worker = new node_worker_threads_1.Worker(this._workerScript, {
eval: false,
workerData: this._workerData,
resourceLimits: this._workerResourceLimits
});
const id = `${this.id}#${++this._nextId}`;
worker[exports2.WORKER_ID_SYMBOL] = id;
this._alive.push(worker);
worker.on("error", (err2) => {
this._onError(err2);
this._destroyWorker(worker);
});
worker.once("exit", (exitCode) => {
if (exitCode !== 0) {
this._onError(new Error(`Worker ${id} exited with code ${exitCode}`));
}
this._destroyWorker(worker);
});
if (this._prepare) {
this._prepare(worker);
}
return worker;
}
/**
* Cleans up a worker
*/
_destroyWorker(worker) {
const aliveIndex = this._alive.indexOf(worker);
if (aliveIndex >= 0) {
this._alive.splice(aliveIndex, 1);
}
const freeIndex = this._idle.indexOf(worker);
if (freeIndex >= 0) {
this._idle.splice(freeIndex, 1);
}
worker.unref();
if (this._onWorkerDestroyed) {
this._onWorkerDestroyed();
}
if (!this._alive.length && !this._error) {
for (const [resolve4] of this._onComplete.splice(0)) {
resolve4();
}
}
}
/**
* Notifies all pending callbacks that an error has occurred and switches this pool into error state.
*/
_onError(error) {
this._error = error;
for (const [, reject3] of this._pending.splice(0)) {
reject3(this._error);
}
for (const [, reject3] of this._onComplete.splice(0)) {
reject3(this._error);
}
}
};
exports2.WorkerPool = WorkerPool2;
}
});
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@rushstack/worker-pool/0.7.18/b776d0a306271a7724761fceda79b00a900070db8c0f20fee53ce030fea08964/node_modules/@rushstack/worker-pool/lib-commonjs/index.js
var require_lib_commonjs = __commonJS({
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@rushstack/worker-pool/0.7.18/b776d0a306271a7724761fceda79b00a900070db8c0f20fee53ce030fea08964/node_modules/@rushstack/worker-pool/lib-commonjs/index.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", { value: true });
exports2.WorkerPool = exports2.WORKER_ID_SYMBOL = void 0;
var WorkerPool_1 = require_WorkerPool();
Object.defineProperty(exports2, "WORKER_ID_SYMBOL", { enumerable: true, get: function() {
return WorkerPool_1.WORKER_ID_SYMBOL;
} });
Object.defineProperty(exports2, "WorkerPool", { enumerable: true, get: function() {
return WorkerPool_1.WorkerPool;
} });
}
});
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/is-windows/1.0.2/8de297753f5a2f0d3154b27e41b774686b53f5e3c186cf9f734f0a5ce4054b2e/node_modules/is-windows/index.js
var require_is_windows = __commonJS({
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/is-windows/1.0.2/8de297753f5a2f0d3154b27e41b774686b53f5e3c186cf9f734f0a5ce4054b2e/node_modules/is-windows/index.js"(exports2, module2) {
(function(factory) {
if (exports2 && typeof exports2 === "object" && typeof module2 !== "undefined") {
module2.exports = factory();
} else if (typeof define === "function" && define.amd) {
define([], factory);
} else if (typeof window !== "undefined") {
window.isWindows = factory();
} else if (typeof global !== "undefined") {
global.isWindows = factory();
} else if (typeof self !== "undefined") {
self.isWindows = factory();
} else {
this.isWindows = factory();
}
})(function() {
"use strict";
return function isWindows15() {
return process && (process.platform === "win32" || /^(msys|cygwin)$/.test(process.env.OSTYPE));
};
});
}
});
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/yocto-queue/1.2.2/348d8ba76aa8900ea8a2afbfce3cd78b8cda7172621258f8b7f12b7e257691be/node_modules/yocto-queue/index.js
var Node, Queue;
var init_yocto_queue = __esm({
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/yocto-queue/1.2.2/348d8ba76aa8900ea8a2afbfce3cd78b8cda7172621258f8b7f12b7e257691be/node_modules/yocto-queue/index.js"() {
Node = class {
value;
next;
constructor(value) {
this.value = value;
}
};
Queue = class {
#head;
#tail;
#size;
constructor() {
this.clear();
}
enqueue(value) {
const node = new Node(value);
if (this.#head) {
this.#tail.next = node;
this.#tail = node;
} else {
this.#head = node;
this.#tail = node;
}
this.#size++;
}
dequeue() {
const current = this.#head;
if (!current) {
return;
}
this.#head = this.#head.next;
this.#size--;
if (!this.#head) {
this.#tail = void 0;
}
return current.value;
}
peek() {
if (!this.#head) {
return;
}
return this.#head.value;
}
clear() {
this.#head = void 0;
this.#tail = void 0;
this.#size = 0;
}
get size() {
return this.#size;
}
*[Symbol.iterator]() {
let current = this.#head;
while (current) {
yield current.value;
current = current.next;
}
}
*drain() {
while (this.#head) {
yield this.dequeue();
}
}
};
}
});
// ../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/p-limit/7.3.0/6ec9feb7819f6cb4bdfcfd8eda73a8272adb6fab475fd25c071d310cdb20840b/node_modules/p-limit/index.js
function pLimit(concurrency) {
let rejectOnClear = false;
if (typeof concurrency === "object") {
({ concurrency, rejectOnClear = false } = concurrency);
}
validateConcurrency(concurrency);
if (typeof rejectOnClear !== "boolean") {
throw new TypeError("Expected `rejectOnClear` to be a boolean");
}
const queue2 = new Queue();
let activeCount = 0;
const resumeNext = () => {
if (activeCount < concurrency && queue2.size > 0) {
activeCount++;
queue2.dequeue().run();
}
};
const next2 = () => {
activeCount--;
resumeNext();
};
const run2 = async (function_, resolve4, arguments_) => {
const result2 = (async () => function_(...arguments_))();
resolve4(result2);
try {
await result2;
} catch {
}
next2();
};
const enqueue = (function_, resolve4, reject3, arguments_) => {
const queueItem = { reject: reject3 };
new Promise((internalResolve) => {
queueItem.run = internalResolve;
queue2.enqueue(queueItem);
}).then(run2.bind(void 0, function_, resolve4, arguments_));
if (activeCount < concurrency) {
resumeNext();
}
};
const generator = (function_, ...arguments_) => new Promise((resolve4, reject3) => {
enqueue(function_, resolve4, reject3, arguments_);
});
Object.defineProperties(generator, {
activeCount: {
get: () => activeCount
},
pendingCount: {
get: () => queue2.size
},
clearQueue: {
value() {
if (!rejectOnClear) {
queue2.clear();
return;
}
const abortError = AbortSignal.abort().reason;
while (queue2.size > 0) {
queue2.dequeue().reject(abortError);
}
}
},
concurrency: {
get: () => concurrency,
set(newConcurrency) {
validateConcurrency(newConcurrency);
concurrency = newConcurrency;
queueMicrotask(() => {
while (activeCount < concurrency && queue2.size > 0) {
resumeNext();
}
});
}
},
map: {
async value(iterable, function_) {
const promises = Array.from(iterable, (value, index2) => this(function_, value, index2));
return Promise.all(promises);
}
}
});
return generator;
}
function validateConcurrency(concurrency) {
if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
}
}
var init_p_limit = __esm({
"../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/p-limit/7.3.0/6ec9feb7819f6cb4bdfcfd8eda73a8272adb6fab475fd25c071d310cdb20840b/node_modules/p-limit/index.js"() {
init_yocto_queue();
}
});
// ../worker/lib/index.js
var lib_exports = {};
__export(lib_exports, {
TarballIntegrityError: () => TarballIntegrityError,
addFilesFromDir: () => addFilesFromDir,
addFilesFromTarball: () => addFilesFromTarball,
calcMaxWorkers: () => calcMaxWorkers,
finishWorkers: () => finishWorkers,
hardLinkDir: () => hardLinkDir,
importPackage: () => importPackage,
initStoreDir: () => initStoreDir,
readPkgFromCafs: () => readPkgFromCafs,
restartWorkerPool: () => restartWorkerPool,
symlinkAllModules: () => symlinkAllModules
});
import { execSync } from "node:child_process";
import os from "node:os";
import path2 from "node:path";
async function restartWorkerPool() {
await finishWorkers();
workerPool = createTarballWorkerPool();
}
async function finishWorkers() {
const finish = global.finishWorkers;
global.finishWorkers = void 0;
await finish?.();
workerPool = void 0;
}
function createTarballWorkerPool() {
const maxWorkers = calcMaxWorkers();
const workerPool2 = new import_worker_pool.WorkerPool({
id: "pnpm",
maxWorkers,
workerScriptPath: path2.join(import.meta.dirname, "worker.js")
});
if (global.finishWorkers) {
const previous = global.finishWorkers;
global.finishWorkers = async () => {
await previous();
await workerPool2.finishAsync();
};
} else {
global.finishWorkers = () => workerPool2.finishAsync();
}
return workerPool2;
}
function calcMaxWorkers() {
if (process.env.PNPM_MAX_WORKERS) {
return parseInt(process.env.PNPM_MAX_WORKERS);
}
if (process.env.PNPM_WORKERS) {
const idleCPUs = Math.abs(parseInt(process.env.PNPM_WORKERS));
return Math.max(2, availableParallelism() - idleCPUs) - 1;
}
return Math.max(1, availableParallelism() - 1);
}
function availableParallelism() {
return os.availableParallelism?.() ?? os.cpus().length;
}
async function addFilesFromDir(opts3) {
if (!workerPool) {
workerPool = createTarballWorkerPool();
}
const localWorker = await workerPool.checkoutWorkerAsync(true);
return new Promise((resolve4, reject3) => {
localWorker.once("message", ({ status, error, value, indexWrites }) => {
workerPool.checkinWorker(localWorker);
if (status === "error") {
reject3(new PnpmError(error.code ?? "GIT_FETCH_FAILED", error.message));
return;
}
if (indexWrites) {
try {
opts3.storeIndex.setRawMany(indexWrites);
} catch (err2) {
reject3(err2);
return;
}
}
resolve4(value);
});
localWorker.postMessage({
type: "add-dir",
storeDir: opts3.storeDir,
dir: opts3.dir,
filesIndexFile: opts3.filesIndexFile,
sideEffectsCacheKey: opts3.sideEffectsCacheKey,
readManifest: opts3.readManifest,
pkg: opts3.pkg,
appendManifest: opts3.appendManifest,
files: opts3.files,
includeNodeModules: opts3.includeNodeModules
});
});
}
async function addFilesFromTarball(opts3) {
if (!workerPool) {
workerPool = createTarballWorkerPool();
}
const localWorker = await workerPool.checkoutWorkerAsync(true);
return new Promise((resolve4, reject3) => {
localWorker.once("message", ({ status, error, value, indexWrites }) => {
workerPool.checkinWorker(localWorker);
if (status === "error") {
if (error.type === "integrity_validation_failed") {
reject3(new TarballIntegrityError({
...error,
url: opts3.url
}));
return;
}
reject3(new PnpmError(error.code ?? "TARBALL_EXTRACT", `Failed to add tarball from "${opts3.url}" to store: ${error.message}`));
return;
}
if (indexWrites) {
try {
opts3.storeIndex.queueWrites(indexWrites);
} catch (err2) {
reject3(err2);
return;
}
}
resolve4(value);
});
localWorker.postMessage({
type: "extract",
buffer: opts3.buffer,
storeDir: opts3.storeDir,
integrity: opts3.integrity,
filesIndexFile: opts3.filesIndexFile,
readManifest: opts3.readManifest,
pkg: opts3.pkg,
appendManifest: opts3.appendManifest,
ignoreFilePattern: opts3.ignoreFilePattern
});
});
}
async function readPkgFromCafs(ctx, filesIndexFile, opts3) {
if (!workerPool) {
workerPool = createTarballWorkerPool();
}
const localWorker = await workerPool.checkoutWorkerAsync(true);
return new Promise((resolve4, reject3) => {
localWorker.once("message", ({ status, error, value, warnings }) => {
workerPool.checkinWorker(localWorker);
if (status === "error") {
reject3(new PnpmError(error.code ?? "READ_FROM_STORE", error.message, { hint: error.hint }));
return;
}
if (warnings) {
for (const warning of warnings) {
globalWarn(warning);
}
}
resolve4(value);
});
localWorker.postMessage({
type: "readPkgFromCafs",
filesIndexFile,
...ctx,
...opts3
});
});
}
async function importPackage(opts3) {
return limitImportingPackage(async () => {
if (!workerPool) {
workerPool = createTarballWorkerPool();
}
const localWorker = await workerPool.checkoutWorkerAsync(true);
return new Promise((resolve4, reject3) => {
localWorker.once("message", ({ status, error, value }) => {
workerPool.checkinWorker(localWorker);
if (status === "error") {
reject3(new PnpmError(error.code ?? "LINKING_FAILED", `[importPackage ${opts3.targetDir}] ${error.message}`));
return;
}
resolve4(value);
});
localWorker.postMessage({
type: "link",
...opts3
});
});
});
}
async function symlinkAllModules(opts3) {
if (!workerPool) {
workerPool = createTarballWorkerPool();
}
const localWorker = await workerPool.checkoutWorkerAsync(true);
return new Promise((resolve4, reject3) => {
localWorker.once("message", ({ status, error, value }) => {
workerPool.checkinWorker(localWorker);
if (status === "error") {
const hint = opts3.deps?.[0]?.modules != null ? createErrorHint(error, opts3.deps[0].modules) : void 0;
reject3(new PnpmError(error.code ?? "SYMLINK_FAILED", `[symlinkAllModules] ${error.message}`, { hint }));
return;
}
resolve4(value);
});
localWorker.postMessage({
type: "symlinkAllModules",
...opts3
});
});
}
function createErrorHint(err2, checkedDir) {
if ("code" in err2 && err2.code === "EISDIR" && (0, import_is_windows.default)()) {
const checkedDrive = `${checkedDir.split(":")[0]}:`;
if (isDriveExFat(checkedDrive)) {
return `The "${checkedDrive}" drive is exFAT, which does not support symlinks. This will cause installation to fail. You can set the node-linker to "hoisted" to avoid this issue.`;
}
}
return void 0;
}
function isDriveExFat(drive) {
if (!/^[a-z]:$/i.test(drive)) {
throw new Error(`${drive} is not a valid disk on Windows`);
}
try {
const output = execSync(`powershell -Command "Get-Volume -DriveLetter ${drive.replace(":", "")} | Select-Object -ExpandProperty FileSystem"`).toString();
const lines = output.trim().split("\n");
const name = lines[0].trim();
return name === "exFAT";
} catch {
return false;
}
}
async function hardLinkDir(src2, destDirs) {
if (!workerPool) {
workerPool = createTarballWorkerPool();
}
const localWorker = await workerPool.checkoutWorkerAsync(true);
await new Promise((resolve4, reject3) => {
localWorker.once("message", ({ status, error }) => {
workerPool.checkinWorker(localWorker);
if (status === "error") {
reject3(new PnpmError(error.code ?? "HARDLINK_FAILED", error.message));
return;
}
resolve4();
});
localWorker.postMessage({
type: "hardLinkDir",
src: src2,
destDirs
});
});
}
async function initStoreDir(storeDir) {
if (!workerPool) {
workerPool = createTarballWorkerPool();
}
const localWorker = await workerPool.checkoutWorkerAsync(true);
return new Promise((resolve4, reject3) => {
localWorker.once("message", ({ status, error }) => {
workerPool.checkinWorker(localWorker);
if (status === "error") {
reject3(new PnpmError(error.code ?? "INIT_CAFS_FAILED", error.message));
return;
}
resolve4();
});
localWorker.postMessage({
type: "init-store",
storeDir
});
});
}
var import_worker_pool, import_is_windows, workerPool, TarballIntegrityError, limitImportin