vlt
Version:
The vlt CLI
1,475 lines (1,451 loc) • 414 kB
JavaScript
var global = globalThis;
import {Buffer} from "node:buffer";
import {setTimeout,clearTimeout,setImmediate,clearImmediate,setInterval,clearInterval} from "node:timers";
import {createRequire as _vlt_createRequire} from "node:module";
var require = _vlt_createRequire(import.meta.filename);
import {
init
} from "./chunk-6RYZ5N3C.js";
import {
Monorepo,
PackageJson,
platformCheck
} from "./chunk-GTAUGWLW.js";
import {
Spec,
Spec2,
asDepID,
baseDepID,
defaultGitHostArchives,
defaultGitHosts,
defaultJsrRegistries,
defaultRegistries,
defaultRegistry,
defaultScopeRegistries,
getId,
graphRun,
hydrate,
hydrate2,
hydrateTuple,
isPackageNameConfused,
joinDepIDTuple,
splitDepID
} from "./chunk-U5J4TCIV.js";
import {
rimraf
} from "./chunk-KPA4XNCN.js";
import {
loadPackageJson
} from "./chunk-VYJVN3B6.js";
import {
LRUCache,
minimatch,
promiseSpawn
} from "./chunk-B4MAUXR2.js";
import {
graphStep
} from "./chunk-O57KIW5U.js";
import {
Version,
asError,
asManifest,
asNormalizedManifest,
assertRecordStringString,
compare,
dependencyTypes,
eq,
expandNormalizedManifestSymbols,
fastSplit,
gt,
gte,
intersects,
isObject,
isRecordStringString,
longDependencyTypes,
lt,
lte,
major,
minor,
neq,
normalizeManifest,
parse,
parseRange,
patch,
satisfies,
shortDependencyTypes
} from "./chunk-JBBINXAZ.js";
import {
load,
walkUp
} from "./chunk-QOAKZNUG.js";
import {
XDG
} from "./chunk-BA67AKYJ.js";
import {
error,
typeError
} from "./chunk-KVH5ECIG.js";
import {
__commonJS,
__require,
__toESM
} from "./chunk-AECDW3EJ.js";
// ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js
var require_windows = __commonJS({
"../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js"(exports, module) {
module.exports = isexe;
isexe.sync = sync;
var fs2 = __require("node:fs");
function checkPathExt(path2, options) {
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
if (!pathext) {
return true;
}
pathext = pathext.split(";");
if (pathext.indexOf("") !== -1) {
return true;
}
for (var i = 0; i < pathext.length; i++) {
var p = pathext[i].toLowerCase();
if (p && path2.substr(-p.length).toLowerCase() === p) {
return true;
}
}
return false;
}
function checkStat(stat3, path2, options) {
if (!stat3.isSymbolicLink() && !stat3.isFile()) {
return false;
}
return checkPathExt(path2, options);
}
function isexe(path2, options, cb) {
fs2.stat(path2, function(er, stat3) {
cb(er, er ? false : checkStat(stat3, path2, options));
});
}
function sync(path2, options) {
return checkStat(fs2.statSync(path2), path2, options);
}
}
});
// ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js
var require_mode = __commonJS({
"../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js"(exports, module) {
module.exports = isexe;
isexe.sync = sync;
var fs2 = __require("node:fs");
function isexe(path2, options, cb) {
fs2.stat(path2, function(er, stat3) {
cb(er, er ? false : checkStat(stat3, options));
});
}
function sync(path2, options) {
return checkStat(fs2.statSync(path2), options);
}
function checkStat(stat3, options) {
return stat3.isFile() && checkMode(stat3, options);
}
function checkMode(stat3, options) {
var mod = stat3.mode;
var uid = stat3.uid;
var gid = stat3.gid;
var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
var u = parseInt("100", 8);
var g = parseInt("010", 8);
var o = parseInt("001", 8);
var ug = u | g;
var ret = mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
return ret;
}
}
});
// ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
var require_isexe = __commonJS({
"../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports, module) {
var fs2 = __require("node:fs");
var core;
if (process.platform === "win32" || global.TESTING_WINDOWS) {
core = require_windows();
} else {
core = require_mode();
}
module.exports = isexe;
isexe.sync = sync;
function isexe(path2, options, cb) {
if (typeof options === "function") {
cb = options;
options = {};
}
if (!cb) {
if (typeof Promise !== "function") {
throw new TypeError("callback not provided");
}
return new Promise(function(resolve8, reject) {
isexe(path2, options || {}, function(er, is2) {
if (er) {
reject(er);
} else {
resolve8(is2);
}
});
});
}
core(path2, options || {}, function(er, is2) {
if (er) {
if (er.code === "EACCES" || options && options.ignoreErrors) {
er = null;
is2 = false;
}
}
cb(er, is2);
});
}
function sync(path2, options) {
try {
return core.sync(path2, options || {});
} catch (er) {
if (options && options.ignoreErrors || er.code === "EACCES") {
return false;
} else {
throw er;
}
}
}
}
});
// ../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js
var require_which = __commonJS({
"../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js"(exports, module) {
var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
var path2 = __require("node:path");
var COLON = isWindows ? ";" : ":";
var isexe = require_isexe();
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
var getPathInfo = (cmd, opt) => {
const colon = opt.colon || COLON;
const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [
// windows always checks the cwd first
...isWindows ? [process.cwd()] : [],
...(opt.path || process.env.PATH || /* istanbul ignore next: very unusual */
"").split(colon)
];
const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
const pathExt = isWindows ? pathExtExe.split(colon) : [""];
if (isWindows) {
if (cmd.indexOf(".") !== -1 && pathExt[0] !== "")
pathExt.unshift("");
}
return {
pathEnv,
pathExt,
pathExtExe
};
};
var which = (cmd, opt, cb) => {
if (typeof opt === "function") {
cb = opt;
opt = {};
}
if (!opt)
opt = {};
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
const found = [];
const step = (i) => new Promise((resolve8, reject) => {
if (i === pathEnv.length)
return opt.all && found.length ? resolve8(found) : reject(getNotFoundError(cmd));
const ppRaw = pathEnv[i];
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
const pCmd = path2.join(pathPart, cmd);
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
resolve8(subStep(p, i, 0));
});
const subStep = (p, i, ii) => new Promise((resolve8, reject) => {
if (ii === pathExt.length)
return resolve8(step(i + 1));
const ext = pathExt[ii];
isexe(p + ext, { pathExt: pathExtExe }, (er, is2) => {
if (!er && is2) {
if (opt.all)
found.push(p + ext);
else
return resolve8(p + ext);
}
return resolve8(subStep(p, i, ii + 1));
});
});
return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
};
var whichSync = (cmd, opt) => {
opt = opt || {};
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
const found = [];
for (let i = 0; i < pathEnv.length; i++) {
const ppRaw = pathEnv[i];
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
const pCmd = path2.join(pathPart, cmd);
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
for (let j = 0; j < pathExt.length; j++) {
const cur = p + pathExt[j];
try {
const is2 = isexe.sync(cur, { pathExt: pathExtExe });
if (is2) {
if (opt.all)
found.push(cur);
else
return cur;
}
} catch (ex) {
}
}
}
if (opt.all && found.length)
return found;
if (opt.nothrow)
return null;
throw getNotFoundError(cmd);
};
module.exports = which;
which.sync = whichSync;
}
});
// ../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js
var require_path_key = __commonJS({
"../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js"(exports, module) {
"use strict";
var pathKey = (options = {}) => {
const environment = options.env || process.env;
const platform = options.platform || process.platform;
if (platform !== "win32") {
return "PATH";
}
return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
};
module.exports = pathKey;
module.exports.default = pathKey;
}
});
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
var require_resolveCommand = __commonJS({
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module) {
"use strict";
var path2 = __require("node:path");
var which = require_which();
var getPathKey = require_path_key();
function resolveCommandAttempt(parsed, withoutPathExt) {
const env2 = parsed.options.env || process.env;
const cwd = process.cwd();
const hasCustomCwd = parsed.options.cwd != null;
const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
if (shouldSwitchCwd) {
try {
process.chdir(parsed.options.cwd);
} catch (err) {
}
}
let resolved;
try {
resolved = which.sync(parsed.command, {
path: env2[getPathKey({ env: env2 })],
pathExt: withoutPathExt ? path2.delimiter : void 0
});
} catch (e) {
} finally {
if (shouldSwitchCwd) {
process.chdir(cwd);
}
}
if (resolved) {
resolved = path2.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
}
return resolved;
}
function resolveCommand(parsed) {
return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
}
module.exports = resolveCommand;
}
});
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js
var require_escape = __commonJS({
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js"(exports, module) {
"use strict";
var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
function escapeCommand(arg) {
arg = arg.replace(metaCharsRegExp, "^$1");
return arg;
}
function escapeArgument(arg, doubleEscapeMetaChars) {
arg = `${arg}`;
arg = arg.replace(/(?=(\\+?)?)\1"/g, '$1$1\\"');
arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
arg = `"${arg}"`;
arg = arg.replace(metaCharsRegExp, "^$1");
if (doubleEscapeMetaChars) {
arg = arg.replace(metaCharsRegExp, "^$1");
}
return arg;
}
module.exports.command = escapeCommand;
module.exports.argument = escapeArgument;
}
});
// ../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js
var require_shebang_regex = __commonJS({
"../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js"(exports, module) {
"use strict";
module.exports = /^#!(.*)/;
}
});
// ../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js
var require_shebang_command = __commonJS({
"../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js"(exports, module) {
"use strict";
var shebangRegex = require_shebang_regex();
module.exports = (string = "") => {
const match = string.match(shebangRegex);
if (!match) {
return null;
}
const [path2, argument] = match[0].replace(/#! ?/, "").split(" ");
const binary = path2.split("/").pop();
if (binary === "env") {
return argument;
}
return argument ? `${binary} ${argument}` : binary;
};
}
});
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
var require_readShebang = __commonJS({
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js"(exports, module) {
"use strict";
var fs2 = __require("node:fs");
var shebangCommand = require_shebang_command();
function readShebang(command) {
const size = 150;
const buffer = Buffer.alloc(size);
let fd;
try {
fd = fs2.openSync(command, "r");
fs2.readSync(fd, buffer, 0, size, 0);
fs2.closeSync(fd);
} catch (e) {
}
return shebangCommand(buffer.toString());
}
module.exports = readShebang;
}
});
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
var require_parse = __commonJS({
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js"(exports, module) {
"use strict";
var path2 = __require("node:path");
var resolveCommand = require_resolveCommand();
var escape = require_escape();
var readShebang = require_readShebang();
var isWin = process.platform === "win32";
var isExecutableRegExp = /\.(?:com|exe)$/i;
var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
function detectShebang(parsed) {
parsed.file = resolveCommand(parsed);
const shebang = parsed.file && readShebang(parsed.file);
if (shebang) {
parsed.args.unshift(parsed.file);
parsed.command = shebang;
return resolveCommand(parsed);
}
return parsed.file;
}
function parseNonShell(parsed) {
if (!isWin) {
return parsed;
}
const commandFile = detectShebang(parsed);
const needsShell = !isExecutableRegExp.test(commandFile);
if (parsed.options.forceShell || needsShell) {
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
parsed.command = path2.normalize(parsed.command);
parsed.command = escape.command(parsed.command);
parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
const shellCommand = [parsed.command].concat(parsed.args).join(" ");
parsed.args = ["/d", "/s", "/c", `"${shellCommand}"`];
parsed.command = process.env.comspec || "cmd.exe";
parsed.options.windowsVerbatimArguments = true;
}
return parsed;
}
function parse3(command, args, options) {
if (args && !Array.isArray(args)) {
options = args;
args = null;
}
args = args ? args.slice(0) : [];
options = Object.assign({}, options);
const parsed = {
command,
args,
options,
file: void 0,
original: {
command,
args
}
};
return options.shell ? parsed : parseNonShell(parsed);
}
module.exports = parse3;
}
});
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js
var require_enoent = __commonJS({
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js"(exports, module) {
"use strict";
var isWin = process.platform === "win32";
function notFoundError(original, syscall) {
return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
code: "ENOENT",
errno: "ENOENT",
syscall: `${syscall} ${original.command}`,
path: original.command,
spawnargs: original.args
});
}
function hookChildProcess(cp, parsed) {
if (!isWin) {
return;
}
const originalEmit = cp.emit;
cp.emit = function(name, arg1) {
if (name === "exit") {
const err = verifyENOENT(arg1, parsed);
if (err) {
return originalEmit.call(cp, "error", err);
}
}
return originalEmit.apply(cp, arguments);
};
}
function verifyENOENT(status, parsed) {
if (isWin && status === 1 && !parsed.file) {
return notFoundError(parsed.original, "spawn");
}
return null;
}
function verifyENOENTSync(status, parsed) {
if (isWin && status === 1 && !parsed.file) {
return notFoundError(parsed.original, "spawnSync");
}
return null;
}
module.exports = {
hookChildProcess,
verifyENOENT,
verifyENOENTSync,
notFoundError
};
}
});
// ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js
var require_cross_spawn = __commonJS({
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js"(exports, module) {
"use strict";
var cp = __require("node:child_process");
var parse3 = require_parse();
var enoent = require_enoent();
function spawn4(command, args, options) {
const parsed = parse3(command, args, options);
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
enoent.hookChildProcess(spawned, parsed);
return spawned;
}
function spawnSync(command, args, options) {
const parsed = parse3(command, args, options);
const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
return result;
}
module.exports = spawn4;
module.exports.spawn = spawn4;
module.exports.sync = spawnSync;
module.exports._parse = parse3;
module.exports._enoent = enoent;
}
});
// ../../node_modules/.pnpm/postcss-selector-parser@7.1.0/node_modules/postcss-selector-parser/dist/util/unesc.js
var require_unesc = __commonJS({
"../../node_modules/.pnpm/postcss-selector-parser@7.1.0/node_modules/postcss-selector-parser/dist/util/unesc.js"(exports, module) {
"use strict";
exports.__esModule = true;
exports["default"] = unesc;
function gobbleHex(str) {
var lower = str.toLowerCase();
var hex = "";
var spaceTerminated = false;
for (var i = 0; i < 6 && lower[i] !== void 0; i++) {
var code = lower.charCodeAt(i);
var valid = code >= 97 && code <= 102 || code >= 48 && code <= 57;
spaceTerminated = code === 32;
if (!valid) {
break;
}
hex += lower[i];
}
if (hex.length === 0) {
return void 0;
}
var codePoint = parseInt(hex, 16);
var isSurrogate = codePoint >= 55296 && codePoint <= 57343;
if (isSurrogate || codePoint === 0 || codePoint > 1114111) {
return ["\uFFFD", hex.length + (spaceTerminated ? 1 : 0)];
}
return [String.fromCodePoint(codePoint), hex.length + (spaceTerminated ? 1 : 0)];
}
var CONTAINS_ESCAPE = /\\/;
function unesc(str) {
var needToProcess = CONTAINS_ESCAPE.test(str);
if (!needToProcess) {
return str;
}
var ret = "";
for (var i = 0; i < str.length; i++) {
if (str[i] === "\\") {
var gobbled = gobbleHex(str.slice(i + 1, i + 7));
if (gobbled !== void 0) {
ret += gobbled[0];
i += gobbled[1];
continue;
}
if (str[i + 1] === "\\") {
ret += "\\";
i++;
continue;
}
if (str.length === i + 1) {
ret += str[i];
}
continue;
}
ret += str[i];
}
return ret;
}
module.exports = exports.default;
}
});
// ../../node_modules/.pnpm/postcss-selector-parser@7.1.0/node_modules/postcss-selector-parser/dist/util/getProp.js
var require_getProp = __commonJS({
"../../node_modules/.pnpm/postcss-selector-parser@7.1.0/node_modules/postcss-selector-parser/dist/util/getProp.js"(exports, module) {
"use strict";
exports.__esModule = true;
exports["default"] = getProp;
function getProp(obj) {
for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
props[_key - 1] = arguments[_key];
}
while (props.length > 0) {
var prop = props.shift();
if (!obj[prop]) {
return void 0;
}
obj = obj[prop];
}
return obj;
}
module.exports = exports.default;
}
});
// ../../node_modules/.pnpm/postcss-selector-parser@7.1.0/node_modules/postcss-selector-parser/dist/util/ensureObject.js
var require_ensureObject = __commonJS({
"../../node_modules/.pnpm/postcss-selector-parser@7.1.0/node_modules/postcss-selector-parser/dist/util/ensureObject.js"(exports, module) {
"use strict";
exports.__esModule = true;
exports["default"] = ensureObject;
function ensureObject(obj) {
for (var _len = arguments.length, props = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
props[_key - 1] = arguments[_key];
}
while (props.length > 0) {
var prop = props.shift();
if (!obj[prop]) {
obj[prop] = {};
}
obj = obj[prop];
}
}
module.exports = exports.default;
}
});
// ../../node_modules/.pnpm/postcss-selector-parser@7.1.0/node_modules/postcss-selector-parser/dist/util/stripComments.js
var require_stripComments = __commonJS({
"../../node_modules/.pnpm/postcss-selector-parser@7.1.0/node_modules/postcss-selector-parser/dist/util/stripComments.js"(exports, module) {
"use strict";
exports.__esModule = true;
exports["default"] = stripComments;
function stripComments(str) {
var s = "";
var commentStart = str.indexOf("/*");
var lastEnd = 0;
while (commentStart >= 0) {
s = s + str.slice(lastEnd, commentStart);
var commentEnd = str.indexOf("*/", commentStart + 2);
if (commentEnd < 0) {
return s;
}
lastEnd = commentEnd + 2;
commentStart = str.indexOf("/*", lastEnd);
}
s = s + str.slice(lastEnd);
return s;
}
module.exports = exports.default;
}
});
// ../../node_modules/.pnpm/postcss-selector-parser@7.1.0/node_modules/postcss-selector-parser/dist/util/index.js
var require_util = __commonJS({
"../../node_modules/.pnpm/postcss-selector-parser@7.1.0/node_modules/postcss-selector-parser/dist/util/index.js"(exports) {
"use strict";
exports.__esModule = true;
exports.unesc = exports.stripComments = exports.getProp = exports.ensureObject = void 0;
var _unesc = _interopRequireDefault(require_unesc());
exports.unesc = _unesc["default"];
var _getProp = _interopRequireDefault(require_getProp());
exports.getProp = _getProp["default"];
var _ensureObject = _interopRequireDefault(require_ensureObject());
exports.ensureObject = _ensureObject["default"];
var _stripComments = _interopRequireDefault(require_stripComments());
exports.stripComments = _stripComments["default"];
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { "default": obj };
}
}
});
// ../../node_modules/.pnpm/postcss-selector-parser@7.1.0/node_modules/postcss-selector-parser/dist/selectors/node.js
var require_node = __commonJS({
"../../node_modules/.pnpm/postcss-selector-parser@7.1.0/node_modules/postcss-selector-parser/dist/selectors/node.js"(exports, module) {
"use strict";
exports.__esModule = true;
exports["default"] = void 0;
var _util = require_util();
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", { writable: false });
return Constructor;
}
var cloneNode = function cloneNode2(obj, parent) {
if (typeof obj !== "object" || obj === null) {
return obj;
}
var cloned = new obj.constructor();
for (var i in obj) {
if (!obj.hasOwnProperty(i)) {
continue;
}
var value = obj[i];
var type2 = typeof value;
if (i === "parent" && type2 === "object") {
if (parent) {
cloned[i] = parent;
}
} else if (value instanceof Array) {
cloned[i] = value.map(function(j) {
return cloneNode2(j, cloned);
});
} else {
cloned[i] = cloneNode2(value, cloned);
}
}
return cloned;
};
var Node2 = /* @__PURE__ */ (function() {
function Node3(opts) {
if (opts === void 0) {
opts = {};
}
Object.assign(this, opts);
this.spaces = this.spaces || {};
this.spaces.before = this.spaces.before || "";
this.spaces.after = this.spaces.after || "";
}
var _proto = Node3.prototype;
_proto.remove = function remove() {
if (this.parent) {
this.parent.removeChild(this);
}
this.parent = void 0;
return this;
};
_proto.replaceWith = function replaceWith() {
if (this.parent) {
for (var index in arguments) {
this.parent.insertBefore(this, arguments[index]);
}
this.remove();
}
return this;
};
_proto.next = function next() {
return this.parent.at(this.parent.index(this) + 1);
};
_proto.prev = function prev() {
return this.parent.at(this.parent.index(this) - 1);
};
_proto.clone = function clone(overrides) {
if (overrides === void 0) {
overrides = {};
}
var cloned = cloneNode(this);
for (var name in overrides) {
cloned[name] = overrides[name];
}
return cloned;
};
_proto.appendToPropertyAndEscape = function appendToPropertyAndEscape(name, value, valueEscaped) {
if (!this.raws) {
this.raws = {};
}
var originalValue = this[name];
var originalEscaped = this.raws[name];
this[name] = originalValue + value;
if (originalEscaped || valueEscaped !== value) {
this.raws[name] = (originalEscaped || originalValue) + valueEscaped;
} else {
delete this.raws[name];
}
};
_proto.setPropertyAndEscape = function setPropertyAndEscape(name, value, valueEscaped) {
if (!this.raws) {
this.raws = {};
}
this[name] = value;
this.raws[name] = valueEscaped;
};
_proto.setPropertyWithoutEscape = function setPropertyWithoutEscape(name, value) {
this[name] = value;
if (this.raws) {
delete this.raws[name];
}
};
_proto.isAtPosition = function isAtPosition(line, column) {
if (this.source && this.source.start && this.source.end) {
if (this.source.start.line > line) {
return false;
}
if (this.source.end.line < line) {
return false;
}
if (this.source.start.line === line && this.source.start.column > column) {
return false;
}
if (this.source.end.line === line && this.source.end.column < column) {
return false;
}
return true;
}
return void 0;
};
_proto.stringifyProperty = function stringifyProperty(name) {
return this.raws && this.raws[name] || this[name];
};
_proto.valueToString = function valueToString() {
return String(this.stringifyProperty("value"));
};
_proto.toString = function toString() {
return [this.rawSpaceBefore, this.valueToString(), this.rawSpaceAfter].join("");
};
_createClass(Node3, [{
key: "rawSpaceBefore",
get: function get() {
var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.before;
if (rawSpace === void 0) {
rawSpace = this.spaces && this.spaces.before;
}
return rawSpace || "";
},
set: function set(raw) {
(0, _util.ensureObject)(this, "raws", "spaces");
this.raws.spaces.before = raw;
}
}, {
key: "rawSpaceAfter",
get: function get() {
var rawSpace = this.raws && this.raws.spaces && this.raws.spaces.after;
if (rawSpace === void 0) {
rawSpace = this.spaces.after;
}
return rawSpace || "";
},
set: function set(raw) {
(0, _util.ensureObject)(this, "raws", "spaces");
this.raws.spaces.after = raw;
}
}]);
return Node3;
})();
exports["default"] = Node2;
module.exports = exports.default;
}
});
// ../../node_modules/.pnpm/postcss-selector-parser@7.1.0/node_modules/postcss-selector-parser/dist/selectors/types.js
var require_types = __commonJS({
"../../node_modules/.pnpm/postcss-selector-parser@7.1.0/node_modules/postcss-selector-parser/dist/selectors/types.js"(exports) {
"use strict";
exports.__esModule = true;
exports.UNIVERSAL = exports.TAG = exports.STRING = exports.SELECTOR = exports.ROOT = exports.PSEUDO = exports.NESTING = exports.ID = exports.COMMENT = exports.COMBINATOR = exports.CLASS = exports.ATTRIBUTE = void 0;
var TAG = "tag";
exports.TAG = TAG;
var STRING = "string";
exports.STRING = STRING;
var SELECTOR = "selector";
exports.SELECTOR = SELECTOR;
var ROOT = "root";
exports.ROOT = ROOT;
var PSEUDO = "pseudo";
exports.PSEUDO = PSEUDO;
var NESTING = "nesting";
exports.NESTING = NESTING;
var ID = "id";
exports.ID = ID;
var COMMENT = "comment";
exports.COMMENT = COMMENT;
var COMBINATOR = "combinator";
exports.COMBINATOR = COMBINATOR;
var CLASS = "class";
exports.CLASS = CLASS;
var ATTRIBUTE = "attribute";
exports.ATTRIBUTE = ATTRIBUTE;
var UNIVERSAL = "universal";
exports.UNIVERSAL = UNIVERSAL;
}
});
// ../../node_modules/.pnpm/postcss-selector-parser@7.1.0/node_modules/postcss-selector-parser/dist/selectors/container.js
var require_container = __commonJS({
"../../node_modules/.pnpm/postcss-selector-parser@7.1.0/node_modules/postcss-selector-parser/dist/selectors/container.js"(exports, module) {
"use strict";
exports.__esModule = true;
exports["default"] = void 0;
var _node = _interopRequireDefault(require_node());
var types = _interopRequireWildcard(require_types());
function _getRequireWildcardCache(nodeInterop) {
if (typeof WeakMap !== "function") return null;
var cacheBabelInterop = /* @__PURE__ */ new WeakMap();
var cacheNodeInterop = /* @__PURE__ */ new WeakMap();
return (_getRequireWildcardCache = function _getRequireWildcardCache2(nodeInterop2) {
return nodeInterop2 ? cacheNodeInterop : cacheBabelInterop;
})(nodeInterop);
}
function _interopRequireWildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return { "default": obj };
}
var cache = _getRequireWildcardCache(nodeInterop);
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for (var key in obj) {
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj["default"] = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { "default": obj };
}
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
if (it) return (it = it.call(o)).next.bind(it);
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
if (it) o = it;
var i = 0;
return function() {
if (i >= o.length) return { done: true };
return { done: false, value: o[i++] };
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) {
arr2[i] = arr[i];
}
return arr2;
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", { writable: false });
return Constructor;
}
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
_setPrototypeOf(subClass, superClass);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) {
o2.__proto__ = p2;
return o2;
};
return _setPrototypeOf(o, p);
}
var Container = /* @__PURE__ */ (function(_Node) {
_inheritsLoose(Container2, _Node);
function Container2(opts) {
var _this;
_this = _Node.call(this, opts) || this;
if (!_this.nodes) {
_this.nodes = [];
}
return _this;
}
var _proto = Container2.prototype;
_proto.append = function append(selector) {
selector.parent = this;
this.nodes.push(selector);
return this;
};
_proto.prepend = function prepend(selector) {
selector.parent = this;
this.nodes.unshift(selector);
for (var id2 in this.indexes) {
this.indexes[id2]++;
}
return this;
};
_proto.at = function at(index) {
return this.nodes[index];
};
_proto.index = function index(child) {
if (typeof child === "number") {
return child;
}
return this.nodes.indexOf(child);
};
_proto.removeChild = function removeChild(child) {
child = this.index(child);
this.at(child).parent = void 0;
this.nodes.splice(child, 1);
var index;
for (var id2 in this.indexes) {
index = this.indexes[id2];
if (index >= child) {
this.indexes[id2] = index - 1;
}
}
return this;
};
_proto.removeAll = function removeAll() {
for (var _iterator = _createForOfIteratorHelperLoose(this.nodes), _step; !(_step = _iterator()).done; ) {
var node = _step.value;
node.parent = void 0;
}
this.nodes = [];
return this;
};
_proto.empty = function empty2() {
return this.removeAll();
};
_proto.insertAfter = function insertAfter(oldNode, newNode) {
var _this$nodes;
newNode.parent = this;
var oldIndex = this.index(oldNode);
var resetNode = [];
for (var i = 2; i < arguments.length; i++) {
resetNode.push(arguments[i]);
}
(_this$nodes = this.nodes).splice.apply(_this$nodes, [oldIndex + 1, 0, newNode].concat(resetNode));
newNode.parent = this;
var index;
for (var id2 in this.indexes) {
index = this.indexes[id2];
if (oldIndex < index) {
this.indexes[id2] = index + arguments.length - 1;
}
}
return this;
};
_proto.insertBefore = function insertBefore(oldNode, newNode) {
var _this$nodes2;
newNode.parent = this;
var oldIndex = this.index(oldNode);
var resetNode = [];
for (var i = 2; i < arguments.length; i++) {
resetNode.push(arguments[i]);
}
(_this$nodes2 = this.nodes).splice.apply(_this$nodes2, [oldIndex, 0, newNode].concat(resetNode));
newNode.parent = this;
var index;
for (var id2 in this.indexes) {
index = this.indexes[id2];
if (index >= oldIndex) {
this.indexes[id2] = index + arguments.length - 1;
}
}
return this;
};
_proto._findChildAtPosition = function _findChildAtPosition(line, col) {
var found = void 0;
this.each(function(node) {
if (node.atPosition) {
var foundChild = node.atPosition(line, col);
if (foundChild) {
found = foundChild;
return false;
}
} else if (node.isAtPosition(line, col)) {
found = node;
return false;
}
});
return found;
};
_proto.atPosition = function atPosition(line, col) {
if (this.isAtPosition(line, col)) {
return this._findChildAtPosition(line, col) || this;
} else {
return void 0;
}
};
_proto._inferEndPosition = function _inferEndPosition() {
if (this.last && this.last.source && this.last.source.end) {
this.source = this.source || {};
this.source.end = this.source.end || {};
Object.assign(this.source.end, this.last.source.end);
}
};
_proto.each = function each(callback) {
if (!this.lastEach) {
this.lastEach = 0;
}
if (!this.indexes) {
this.indexes = {};
}
this.lastEach++;
var id2 = this.lastEach;
this.indexes[id2] = 0;
if (!this.length) {
return void 0;
}
var index, result;
while (this.indexes[id2] < this.length) {
index = this.indexes[id2];
result = callback(this.at(index), index);
if (result === false) {
break;
}
this.indexes[id2] += 1;
}
delete this.indexes[id2];
if (result === false) {
return false;
}
};
_proto.walk = function walk2(callback) {
return this.each(function(node, i) {
var result = callback(node, i);
if (result !== false && node.length) {
result = node.walk(callback);
}
if (result === false) {
return false;
}
});
};
_proto.walkAttributes = function walkAttributes(callback) {
var _this2 = this;
return this.walk(function(selector) {
if (selector.type === types.ATTRIBUTE) {
return callback.call(_this2, selector);
}
});
};
_proto.walkClasses = function walkClasses(callback) {
var _this3 = this;
return this.walk(function(selector) {
if (selector.type === types.CLASS) {
return callback.call(_this3, selector);
}
});
};
_proto.walkCombinators = function walkCombinators(callback) {
var _this4 = this;
return this.walk(function(selector) {
if (selector.type === types.COMBINATOR) {
return callback.call(_this4, selector);
}
});
};
_proto.walkComments = function walkComments(callback) {
var _this5 = this;
return this.walk(function(selector) {
if (selector.type === types.COMMENT) {
return callback.call(_this5, selector);
}
});
};
_proto.walkIds = function walkIds(callback) {
var _this6 = this;
return this.walk(function(selector) {
if (selector.type === types.ID) {
return callback.call(_this6, selector);
}
});
};
_proto.walkNesting = function walkNesting(callback) {
var _this7 = this;
return this.walk(function(selector) {
if (selector.type === types.NESTING) {
return callback.call(_this7, selector);
}
});
};
_proto.walkPseudos = function walkPseudos(callback) {
var _this8 = this;
return this.walk(function(selector) {
if (selector.type === types.PSEUDO) {
return callback.call(_this8, selector);
}
});
};
_proto.walkTags = function walkTags(callback) {
var _this9 = this;
return this.walk(function(selector) {
if (selector.type === types.TAG) {
return callback.call(_this9, selector);
}
});
};
_proto.walkUniversals = function walkUniversals(callback) {
var _this10 = this;
return this.walk(function(selector) {
if (selector.type === types.UNIVERSAL) {
return callback.call(_this10, selector);
}
});
};
_proto.split = function split(callback) {
var _this11 = this;
var current = [];
return this.reduce(function(memo, node, index) {
var split2 = callback.call(_this11, node);
current.push(node);
if (split2) {
memo.push(current);
current = [];
} else if (index === _this11.length - 1) {
memo.push(current);
}
return memo;
}, []);
};
_proto.map = function map(callback) {
return this.nodes.map(callback);
};
_proto.reduce = function reduce(callback, memo) {
return this.nodes.reduce(callback, memo);
};
_proto.every = function every(callback) {
return this.nodes.every(callback);
};
_proto.some = function some(callback) {
return this.nodes.some(callback);
};
_proto.filter = function filter(callback) {
return this.nodes.filter(callback);
};
_proto.sort = function sort(callback) {
return this.nodes.sort(callback);
};
_proto.toString = function toString() {
return this.map(String).join("");
};
_createClass(Container2, [{
key: "first",
get: function get() {
return this.at(0);
}
}, {
key: "last",
get: function get() {
return this.at(this.length - 1);
}
}, {
key: "length",
get: function get() {
return this.nodes.length;
}
}]);
return Container2;
})(_node["default"]);
exports["default"] = Container;
module.exports = exports.default;
}
});
// ../../node_modules/.pnpm/postcss-selector-parser@7.1.0/node_modules/postcss-selector-parser/dist/selectors/root.js
var require_root = __commonJS({
"../../node_modules/.pnpm/postcss-selector-parser@7.1.0/node_modules/postcss-selector-parser/dist/selectors/root.js"(exports, module) {
"use strict";
exports.__esModule = true;
exports["default"] = void 0;
var _container = _interopRequireDefault(require_container());
var _types = require_types();
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { "default": obj };
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", { writable: false });
return Constructor;
}
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
_setPrototypeOf(subClass, superClass);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) {
o2.__proto__ = p2;
return o2;
};
return _setPrototypeOf(o, p);
}
var Root = /* @__PURE__ */ (function(_Container) {
_inheritsLoose(Root2, _Container);
function Root2(opts) {
var _this;
_this = _Container.call(this, opts) || this;
_this.type = _types.ROOT;
return _this;
}
var _proto = Root2.prototype;
_proto.toString = function toString() {
var str = this.reduce(function(memo, selector) {
memo.push(String(selector));
return memo;
}, []).join(",");
return this.trailingComma ? str + "," : str;
};
_proto.error = function error2(message, options) {
if (this._error) {
return this._error(message, options);
} else {
return new Error(message);
}
};
_createClass(Root2, [{
key: "errorGenerator",
set: function set(handler) {
this._error = handler;
}
}]);
return Root2;
})(_container["default"]);
exports["default"] = Root;
module.exports = exports.default;
}
});
// ../../node_modules/.pnpm/postcss-selector-parser@7.1.0/node_modules/postcss-selector-parser/dist/selectors/selector.js
var require_selector = __commonJS({
"../../node_modules/.pnpm/postcss-selector-parser@7.1.0/node_modules/postcss-selector-parser/dist/selectors/selector.js"(exports, module) {
"use strict";
exports.__esModule = true;
exports["default"] = void 0;
var _container = _interopRequireDefault(require_container());
var _types = require_types();
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { "default": obj };
}
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
_setPrototypeOf(subClass, superClass);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) {
o2.__proto__ = p2;
return o2;
};
return _setPrototypeOf(o, p);
}
var Selector = /* @__PURE__ */ (function(_Container) {
_inheritsLoose(Selector2, _Container);
function Selector2(opts) {
var _this;
_this = _Container.call(this, opts) || this;
_this.type = _types.SELECTOR;
return _this;
}
return Selector2;
})(_container["default"]);
exports["default"] = Selector;
module.exports = exports.default;
}
});
// ../../node_modules/.pnpm/cssesc@3.0.0/node_modules/cssesc/cssesc.js
var require_cssesc = __commonJS({
"../../node_modules/.pnpm/cssesc@3.0.0/node_modules/cssesc/cssesc.js"(exports, module) {
"use strict";
var object = {};
var hasOwnProperty = object.hasOwnProperty;
var merge = function merge2(options, defaults) {
if (!options) {
return defaults;
}
var result = {};
for (var key in defaults) {
resul