drizzle-kit
Version:
Drizzle Kit is a CLI migrator tool for Drizzle ORM. It is probably the one and only tool that lets you completely automatically generate SQL migrations and covers ~95% of the common cases like deletions and renames by prompting user input. <https://github
1,461 lines (1,450 loc) • 2.95 MB
JavaScript
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
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 __typeError = (msg) => {
throw TypeError(msg);
};
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __require = /* @__PURE__ */ ((x5) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x5, {
get: (a5, b5) => (typeof require !== "undefined" ? require : a5)[b5]
}) : x5)(function(x5) {
if (typeof require !== "undefined") return require.apply(this, arguments);
throw Error('Dynamic require of "' + x5 + '" is not supported');
});
var __esm = (fn, res) => function __init() {
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
};
var __commonJS = (cb, mod) => function __require2() {
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 __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
var __privateWrapper = (obj, member, setter, getter) => ({
set _(value) {
__privateSet(obj, member, value, setter);
},
get _() {
return __privateGet(obj, member, getter);
}
});
// ../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/vendor/ansi-styles/index.js
function assembleStyles() {
const codes = /* @__PURE__ */ new Map();
for (const [groupName, group] of Object.entries(styles)) {
for (const [styleName, style] of Object.entries(group)) {
styles[styleName] = {
open: `\x1B[${style[0]}m`,
close: `\x1B[${style[1]}m`
};
group[styleName] = styles[styleName];
codes.set(style[0], style[1]);
}
Object.defineProperty(styles, groupName, {
value: group,
enumerable: false
});
}
Object.defineProperty(styles, "codes", {
value: codes,
enumerable: false
});
styles.color.close = "\x1B[39m";
styles.bgColor.close = "\x1B[49m";
styles.color.ansi = wrapAnsi16();
styles.color.ansi256 = wrapAnsi256();
styles.color.ansi16m = wrapAnsi16m();
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
Object.defineProperties(styles, {
rgbToAnsi256: {
value(red, green, blue) {
if (red === green && green === blue) {
if (red < 8) {
return 16;
}
if (red > 248) {
return 231;
}
return Math.round((red - 8) / 247 * 24) + 232;
}
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
},
enumerable: false
},
hexToRgb: {
value(hex) {
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
if (!matches) {
return [0, 0, 0];
}
let [colorString] = matches;
if (colorString.length === 3) {
colorString = [...colorString].map((character) => character + character).join("");
}
const integer = Number.parseInt(colorString, 16);
return [
/* eslint-disable no-bitwise */
integer >> 16 & 255,
integer >> 8 & 255,
integer & 255
/* eslint-enable no-bitwise */
];
},
enumerable: false
},
hexToAnsi256: {
value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
enumerable: false
},
ansi256ToAnsi: {
value(code) {
if (code < 8) {
return 30 + code;
}
if (code < 16) {
return 90 + (code - 8);
}
let red;
let green;
let blue;
if (code >= 232) {
red = ((code - 232) * 10 + 8) / 255;
green = red;
blue = red;
} else {
code -= 16;
const remainder = code % 36;
red = Math.floor(code / 36) / 5;
green = Math.floor(remainder / 6) / 5;
blue = remainder % 6 / 5;
}
const value = Math.max(red, green, blue) * 2;
if (value === 0) {
return 30;
}
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
if (value === 2) {
result += 60;
}
return result;
},
enumerable: false
},
rgbToAnsi: {
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
enumerable: false
},
hexToAnsi: {
value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
enumerable: false
}
});
return styles;
}
var ANSI_BACKGROUND_OFFSET, wrapAnsi16, wrapAnsi256, wrapAnsi16m, styles, modifierNames, foregroundColorNames, backgroundColorNames, colorNames, ansiStyles, ansi_styles_default;
var init_ansi_styles = __esm({
"../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/vendor/ansi-styles/index.js"() {
"use strict";
ANSI_BACKGROUND_OFFSET = 10;
wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
styles = {
modifier: {
reset: [0, 0],
// 21 isn't widely supported and 22 does the same thing
bold: [1, 22],
dim: [2, 22],
italic: [3, 23],
underline: [4, 24],
overline: [53, 55],
inverse: [7, 27],
hidden: [8, 28],
strikethrough: [9, 29]
},
color: {
black: [30, 39],
red: [31, 39],
green: [32, 39],
yellow: [33, 39],
blue: [34, 39],
magenta: [35, 39],
cyan: [36, 39],
white: [37, 39],
// Bright color
blackBright: [90, 39],
gray: [90, 39],
// Alias of `blackBright`
grey: [90, 39],
// Alias of `blackBright`
redBright: [91, 39],
greenBright: [92, 39],
yellowBright: [93, 39],
blueBright: [94, 39],
magentaBright: [95, 39],
cyanBright: [96, 39],
whiteBright: [97, 39]
},
bgColor: {
bgBlack: [40, 49],
bgRed: [41, 49],
bgGreen: [42, 49],
bgYellow: [43, 49],
bgBlue: [44, 49],
bgMagenta: [45, 49],
bgCyan: [46, 49],
bgWhite: [47, 49],
// Bright color
bgBlackBright: [100, 49],
bgGray: [100, 49],
// Alias of `bgBlackBright`
bgGrey: [100, 49],
// Alias of `bgBlackBright`
bgRedBright: [101, 49],
bgGreenBright: [102, 49],
bgYellowBright: [103, 49],
bgBlueBright: [104, 49],
bgMagentaBright: [105, 49],
bgCyanBright: [106, 49],
bgWhiteBright: [107, 49]
}
};
modifierNames = Object.keys(styles.modifier);
foregroundColorNames = Object.keys(styles.color);
backgroundColorNames = Object.keys(styles.bgColor);
colorNames = [...foregroundColorNames, ...backgroundColorNames];
ansiStyles = assembleStyles();
ansi_styles_default = ansiStyles;
}
});
// ../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/vendor/supports-color/index.js
import process2 from "process";
import os from "os";
import tty from "tty";
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process2.argv) {
const prefix2 = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
const position = argv.indexOf(prefix2 + flag);
const terminatorPosition = argv.indexOf("--");
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
}
function envForceColor() {
if ("FORCE_COLOR" in env) {
if (env.FORCE_COLOR === "true") {
return 1;
}
if (env.FORCE_COLOR === "false") {
return 0;
}
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
}
}
function translateLevel(level) {
if (level === 0) {
return false;
}
return {
level,
hasBasic: true,
has256: level >= 2,
has16m: level >= 3
};
}
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
const noFlagForceColor = envForceColor();
if (noFlagForceColor !== void 0) {
flagForceColor = noFlagForceColor;
}
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
if (forceColor === 0) {
return 0;
}
if (sniffFlags) {
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
return 3;
}
if (hasFlag("color=256")) {
return 2;
}
}
if ("TF_BUILD" in env && "AGENT_NAME" in env) {
return 1;
}
if (haveStream && !streamIsTTY && forceColor === void 0) {
return 0;
}
const min = forceColor || 0;
if (env.TERM === "dumb") {
return min;
}
if (process2.platform === "win32") {
const osRelease = os.release().split(".");
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
return Number(osRelease[2]) >= 14931 ? 3 : 2;
}
return 1;
}
if ("CI" in env) {
if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => key in env)) {
return 3;
}
if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
return 1;
}
return min;
}
if ("TEAMCITY_VERSION" in env) {
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
}
if (env.COLORTERM === "truecolor") {
return 3;
}
if (env.TERM === "xterm-kitty") {
return 3;
}
if ("TERM_PROGRAM" in env) {
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
switch (env.TERM_PROGRAM) {
case "iTerm.app": {
return version >= 3 ? 3 : 2;
}
case "Apple_Terminal": {
return 2;
}
}
}
if (/-256(color)?$/i.test(env.TERM)) {
return 2;
}
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
return 1;
}
if ("COLORTERM" in env) {
return 1;
}
return min;
}
function createSupportsColor(stream, options = {}) {
const level = _supportsColor(stream, {
streamIsTTY: stream && stream.isTTY,
...options
});
return translateLevel(level);
}
var env, flagForceColor, supportsColor, supports_color_default;
var init_supports_color = __esm({
"../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/vendor/supports-color/index.js"() {
"use strict";
({ env } = process2);
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
flagForceColor = 0;
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
flagForceColor = 1;
}
supportsColor = {
stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
stderr: createSupportsColor({ isTTY: tty.isatty(2) })
};
supports_color_default = supportsColor;
}
});
// ../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/utilities.js
function stringReplaceAll(string, substring2, replacer) {
let index6 = string.indexOf(substring2);
if (index6 === -1) {
return string;
}
const substringLength = substring2.length;
let endIndex = 0;
let returnValue = "";
do {
returnValue += string.slice(endIndex, index6) + substring2 + replacer;
endIndex = index6 + substringLength;
index6 = string.indexOf(substring2, endIndex);
} while (index6 !== -1);
returnValue += string.slice(endIndex);
return returnValue;
}
function stringEncaseCRLFWithFirstIndex(string, prefix2, postfix, index6) {
let endIndex = 0;
let returnValue = "";
do {
const gotCR = string[index6 - 1] === "\r";
returnValue += string.slice(endIndex, gotCR ? index6 - 1 : index6) + prefix2 + (gotCR ? "\r\n" : "\n") + postfix;
endIndex = index6 + 1;
index6 = string.indexOf("\n", endIndex);
} while (index6 !== -1);
returnValue += string.slice(endIndex);
return returnValue;
}
var init_utilities = __esm({
"../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/utilities.js"() {
"use strict";
}
});
// ../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/index.js
function createChalk(options) {
return chalkFactory(options);
}
var stdoutColor, stderrColor, GENERATOR, STYLER, IS_EMPTY, levelMapping, styles2, applyOptions, chalkFactory, getModelAnsi, usedModels, proto, createStyler, createBuilder, applyStyle, chalk, chalkStderr, source_default;
var init_source = __esm({
"../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/index.js"() {
"use strict";
init_ansi_styles();
init_supports_color();
init_utilities();
({ stdout: stdoutColor, stderr: stderrColor } = supports_color_default);
GENERATOR = Symbol("GENERATOR");
STYLER = Symbol("STYLER");
IS_EMPTY = Symbol("IS_EMPTY");
levelMapping = [
"ansi",
"ansi",
"ansi256",
"ansi16m"
];
styles2 = /* @__PURE__ */ Object.create(null);
applyOptions = (object, options = {}) => {
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
throw new Error("The `level` option should be an integer from 0 to 3");
}
const colorLevel = stdoutColor ? stdoutColor.level : 0;
object.level = options.level === void 0 ? colorLevel : options.level;
};
chalkFactory = (options) => {
const chalk2 = (...strings) => strings.join(" ");
applyOptions(chalk2, options);
Object.setPrototypeOf(chalk2, createChalk.prototype);
return chalk2;
};
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
for (const [styleName, style] of Object.entries(ansi_styles_default)) {
styles2[styleName] = {
get() {
const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
Object.defineProperty(this, styleName, { value: builder });
return builder;
}
};
}
styles2.visible = {
get() {
const builder = createBuilder(this, this[STYLER], true);
Object.defineProperty(this, "visible", { value: builder });
return builder;
}
};
getModelAnsi = (model, level, type, ...arguments_) => {
if (model === "rgb") {
if (level === "ansi16m") {
return ansi_styles_default[type].ansi16m(...arguments_);
}
if (level === "ansi256") {
return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
}
return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
}
if (model === "hex") {
return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
}
return ansi_styles_default[type][model](...arguments_);
};
usedModels = ["rgb", "hex", "ansi256"];
for (const model of usedModels) {
styles2[model] = {
get() {
const { level } = this;
return function(...arguments_) {
const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
return createBuilder(this, styler, this[IS_EMPTY]);
};
}
};
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
styles2[bgModel] = {
get() {
const { level } = this;
return function(...arguments_) {
const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
return createBuilder(this, styler, this[IS_EMPTY]);
};
}
};
}
proto = Object.defineProperties(() => {
}, {
...styles2,
level: {
enumerable: true,
get() {
return this[GENERATOR].level;
},
set(level) {
this[GENERATOR].level = level;
}
}
});
createStyler = (open, close, parent) => {
let openAll;
let closeAll;
if (parent === void 0) {
openAll = open;
closeAll = close;
} else {
openAll = parent.openAll + open;
closeAll = close + parent.closeAll;
}
return {
open,
close,
openAll,
closeAll,
parent
};
};
createBuilder = (self2, _styler, _isEmpty) => {
const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
Object.setPrototypeOf(builder, proto);
builder[GENERATOR] = self2;
builder[STYLER] = _styler;
builder[IS_EMPTY] = _isEmpty;
return builder;
};
applyStyle = (self2, string) => {
if (self2.level <= 0 || !string) {
return self2[IS_EMPTY] ? "" : string;
}
let styler = self2[STYLER];
if (styler === void 0) {
return string;
}
const { openAll, closeAll } = styler;
if (string.includes("\x1B")) {
while (styler !== void 0) {
string = stringReplaceAll(string, styler.close, styler.open);
styler = styler.parent;
}
}
const lfIndex = string.indexOf("\n");
if (lfIndex !== -1) {
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
}
return openAll + string + closeAll;
};
Object.defineProperties(createChalk.prototype, styles2);
chalk = createChalk();
chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
source_default = chalk;
}
});
// ../node_modules/.pnpm/fs.realpath@1.0.0/node_modules/fs.realpath/old.js
var require_old = __commonJS({
"../node_modules/.pnpm/fs.realpath@1.0.0/node_modules/fs.realpath/old.js"(exports) {
"use strict";
var pathModule = __require("path");
var isWindows = process.platform === "win32";
var fs5 = __require("fs");
var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG);
function rethrow() {
var callback;
if (DEBUG) {
var backtrace = new Error();
callback = debugCallback;
} else
callback = missingCallback;
return callback;
function debugCallback(err2) {
if (err2) {
backtrace.message = err2.message;
err2 = backtrace;
missingCallback(err2);
}
}
function missingCallback(err2) {
if (err2) {
if (process.throwDeprecation)
throw err2;
else if (!process.noDeprecation) {
var msg = "fs: missing callback " + (err2.stack || err2.message);
if (process.traceDeprecation)
console.trace(msg);
else
console.error(msg);
}
}
}
}
function maybeCallback(cb) {
return typeof cb === "function" ? cb : rethrow();
}
var normalize = pathModule.normalize;
if (isWindows) {
nextPartRe = /(.*?)(?:[\/\\]+|$)/g;
} else {
nextPartRe = /(.*?)(?:[\/]+|$)/g;
}
var nextPartRe;
if (isWindows) {
splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/;
} else {
splitRootRe = /^[\/]*/;
}
var splitRootRe;
exports.realpathSync = function realpathSync(p5, cache5) {
p5 = pathModule.resolve(p5);
if (cache5 && Object.prototype.hasOwnProperty.call(cache5, p5)) {
return cache5[p5];
}
var original = p5, seenLinks = {}, knownHard = {};
var pos;
var current;
var base;
var previous;
start();
function start() {
var m6 = splitRootRe.exec(p5);
pos = m6[0].length;
current = m6[0];
base = m6[0];
previous = "";
if (isWindows && !knownHard[base]) {
fs5.lstatSync(base);
knownHard[base] = true;
}
}
while (pos < p5.length) {
nextPartRe.lastIndex = pos;
var result = nextPartRe.exec(p5);
previous = current;
current += result[0];
base = previous + result[1];
pos = nextPartRe.lastIndex;
if (knownHard[base] || cache5 && cache5[base] === base) {
continue;
}
var resolvedLink;
if (cache5 && Object.prototype.hasOwnProperty.call(cache5, base)) {
resolvedLink = cache5[base];
} else {
var stat2 = fs5.lstatSync(base);
if (!stat2.isSymbolicLink()) {
knownHard[base] = true;
if (cache5) cache5[base] = base;
continue;
}
var linkTarget = null;
if (!isWindows) {
var id = stat2.dev.toString(32) + ":" + stat2.ino.toString(32);
if (seenLinks.hasOwnProperty(id)) {
linkTarget = seenLinks[id];
}
}
if (linkTarget === null) {
fs5.statSync(base);
linkTarget = fs5.readlinkSync(base);
}
resolvedLink = pathModule.resolve(previous, linkTarget);
if (cache5) cache5[base] = resolvedLink;
if (!isWindows) seenLinks[id] = linkTarget;
}
p5 = pathModule.resolve(resolvedLink, p5.slice(pos));
start();
}
if (cache5) cache5[original] = p5;
return p5;
};
exports.realpath = function realpath(p5, cache5, cb) {
if (typeof cb !== "function") {
cb = maybeCallback(cache5);
cache5 = null;
}
p5 = pathModule.resolve(p5);
if (cache5 && Object.prototype.hasOwnProperty.call(cache5, p5)) {
return process.nextTick(cb.bind(null, null, cache5[p5]));
}
var original = p5, seenLinks = {}, knownHard = {};
var pos;
var current;
var base;
var previous;
start();
function start() {
var m6 = splitRootRe.exec(p5);
pos = m6[0].length;
current = m6[0];
base = m6[0];
previous = "";
if (isWindows && !knownHard[base]) {
fs5.lstat(base, function(err2) {
if (err2) return cb(err2);
knownHard[base] = true;
LOOP();
});
} else {
process.nextTick(LOOP);
}
}
function LOOP() {
if (pos >= p5.length) {
if (cache5) cache5[original] = p5;
return cb(null, p5);
}
nextPartRe.lastIndex = pos;
var result = nextPartRe.exec(p5);
previous = current;
current += result[0];
base = previous + result[1];
pos = nextPartRe.lastIndex;
if (knownHard[base] || cache5 && cache5[base] === base) {
return process.nextTick(LOOP);
}
if (cache5 && Object.prototype.hasOwnProperty.call(cache5, base)) {
return gotResolvedLink(cache5[base]);
}
return fs5.lstat(base, gotStat);
}
function gotStat(err2, stat2) {
if (err2) return cb(err2);
if (!stat2.isSymbolicLink()) {
knownHard[base] = true;
if (cache5) cache5[base] = base;
return process.nextTick(LOOP);
}
if (!isWindows) {
var id = stat2.dev.toString(32) + ":" + stat2.ino.toString(32);
if (seenLinks.hasOwnProperty(id)) {
return gotTarget(null, seenLinks[id], base);
}
}
fs5.stat(base, function(err3) {
if (err3) return cb(err3);
fs5.readlink(base, function(err4, target) {
if (!isWindows) seenLinks[id] = target;
gotTarget(err4, target);
});
});
}
function gotTarget(err2, target, base2) {
if (err2) return cb(err2);
var resolvedLink = pathModule.resolve(previous, target);
if (cache5) cache5[base2] = resolvedLink;
gotResolvedLink(resolvedLink);
}
function gotResolvedLink(resolvedLink) {
p5 = pathModule.resolve(resolvedLink, p5.slice(pos));
start();
}
};
}
});
// ../node_modules/.pnpm/fs.realpath@1.0.0/node_modules/fs.realpath/index.js
var require_fs = __commonJS({
"../node_modules/.pnpm/fs.realpath@1.0.0/node_modules/fs.realpath/index.js"(exports, module) {
"use strict";
module.exports = realpath;
realpath.realpath = realpath;
realpath.sync = realpathSync;
realpath.realpathSync = realpathSync;
realpath.monkeypatch = monkeypatch;
realpath.unmonkeypatch = unmonkeypatch;
var fs5 = __require("fs");
var origRealpath = fs5.realpath;
var origRealpathSync = fs5.realpathSync;
var version = process.version;
var ok = /^v[0-5]\./.test(version);
var old = require_old();
function newError(er) {
return er && er.syscall === "realpath" && (er.code === "ELOOP" || er.code === "ENOMEM" || er.code === "ENAMETOOLONG");
}
function realpath(p5, cache5, cb) {
if (ok) {
return origRealpath(p5, cache5, cb);
}
if (typeof cache5 === "function") {
cb = cache5;
cache5 = null;
}
origRealpath(p5, cache5, function(er, result) {
if (newError(er)) {
old.realpath(p5, cache5, cb);
} else {
cb(er, result);
}
});
}
function realpathSync(p5, cache5) {
if (ok) {
return origRealpathSync(p5, cache5);
}
try {
return origRealpathSync(p5, cache5);
} catch (er) {
if (newError(er)) {
return old.realpathSync(p5, cache5);
} else {
throw er;
}
}
}
function monkeypatch() {
fs5.realpath = realpath;
fs5.realpathSync = realpathSync;
}
function unmonkeypatch() {
fs5.realpath = origRealpath;
fs5.realpathSync = origRealpathSync;
}
}
});
// ../node_modules/.pnpm/minimatch@5.1.6/node_modules/minimatch/lib/path.js
var require_path = __commonJS({
"../node_modules/.pnpm/minimatch@5.1.6/node_modules/minimatch/lib/path.js"(exports, module) {
"use strict";
var isWindows = typeof process === "object" && process && process.platform === "win32";
module.exports = isWindows ? { sep: "\\" } : { sep: "/" };
}
});
// ../node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.js
var require_balanced_match = __commonJS({
"../node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.js"(exports, module) {
"use strict";
module.exports = balanced;
function balanced(a5, b5, str) {
if (a5 instanceof RegExp) a5 = maybeMatch(a5, str);
if (b5 instanceof RegExp) b5 = maybeMatch(b5, str);
var r6 = range(a5, b5, str);
return r6 && {
start: r6[0],
end: r6[1],
pre: str.slice(0, r6[0]),
body: str.slice(r6[0] + a5.length, r6[1]),
post: str.slice(r6[1] + b5.length)
};
}
function maybeMatch(reg, str) {
var m6 = str.match(reg);
return m6 ? m6[0] : null;
}
balanced.range = range;
function range(a5, b5, str) {
var begs, beg, left, right, result;
var ai = str.indexOf(a5);
var bi = str.indexOf(b5, ai + 1);
var i6 = ai;
if (ai >= 0 && bi > 0) {
if (a5 === b5) {
return [ai, bi];
}
begs = [];
left = str.length;
while (i6 >= 0 && !result) {
if (i6 == ai) {
begs.push(i6);
ai = str.indexOf(a5, i6 + 1);
} else if (begs.length == 1) {
result = [begs.pop(), bi];
} else {
beg = begs.pop();
if (beg < left) {
left = beg;
right = bi;
}
bi = str.indexOf(b5, i6 + 1);
}
i6 = ai < bi && ai >= 0 ? ai : bi;
}
if (begs.length) {
result = [left, right];
}
}
return result;
}
}
});
// ../node_modules/.pnpm/brace-expansion@2.0.1/node_modules/brace-expansion/index.js
var require_brace_expansion = __commonJS({
"../node_modules/.pnpm/brace-expansion@2.0.1/node_modules/brace-expansion/index.js"(exports, module) {
"use strict";
var balanced = require_balanced_match();
module.exports = expandTop;
var escSlash = "\0SLASH" + Math.random() + "\0";
var escOpen = "\0OPEN" + Math.random() + "\0";
var escClose = "\0CLOSE" + Math.random() + "\0";
var escComma = "\0COMMA" + Math.random() + "\0";
var escPeriod = "\0PERIOD" + Math.random() + "\0";
function numeric(str) {
return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
}
function escapeBraces(str) {
return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
}
function unescapeBraces(str) {
return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
}
function parseCommaParts(str) {
if (!str)
return [""];
var parts = [];
var m6 = balanced("{", "}", str);
if (!m6)
return str.split(",");
var pre = m6.pre;
var body = m6.body;
var post = m6.post;
var p5 = pre.split(",");
p5[p5.length - 1] += "{" + body + "}";
var postParts = parseCommaParts(post);
if (post.length) {
p5[p5.length - 1] += postParts.shift();
p5.push.apply(p5, postParts);
}
parts.push.apply(parts, p5);
return parts;
}
function expandTop(str) {
if (!str)
return [];
if (str.substr(0, 2) === "{}") {
str = "\\{\\}" + str.substr(2);
}
return expand2(escapeBraces(str), true).map(unescapeBraces);
}
function embrace(str) {
return "{" + str + "}";
}
function isPadded(el) {
return /^-?0\d/.test(el);
}
function lte(i6, y2) {
return i6 <= y2;
}
function gte(i6, y2) {
return i6 >= y2;
}
function expand2(str, isTop) {
var expansions = [];
var m6 = balanced("{", "}", str);
if (!m6) return [str];
var pre = m6.pre;
var post = m6.post.length ? expand2(m6.post, false) : [""];
if (/\$$/.test(m6.pre)) {
for (var k5 = 0; k5 < post.length; k5++) {
var expansion = pre + "{" + m6.body + "}" + post[k5];
expansions.push(expansion);
}
} else {
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m6.body);
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m6.body);
var isSequence = isNumericSequence || isAlphaSequence;
var isOptions = m6.body.indexOf(",") >= 0;
if (!isSequence && !isOptions) {
if (m6.post.match(/,.*\}/)) {
str = m6.pre + "{" + m6.body + escClose + m6.post;
return expand2(str);
}
return [str];
}
var n5;
if (isSequence) {
n5 = m6.body.split(/\.\./);
} else {
n5 = parseCommaParts(m6.body);
if (n5.length === 1) {
n5 = expand2(n5[0], false).map(embrace);
if (n5.length === 1) {
return post.map(function(p5) {
return m6.pre + n5[0] + p5;
});
}
}
}
var N;
if (isSequence) {
var x5 = numeric(n5[0]);
var y2 = numeric(n5[1]);
var width = Math.max(n5[0].length, n5[1].length);
var incr = n5.length == 3 ? Math.abs(numeric(n5[2])) : 1;
var test = lte;
var reverse = y2 < x5;
if (reverse) {
incr *= -1;
test = gte;
}
var pad = n5.some(isPadded);
N = [];
for (var i6 = x5; test(i6, y2); i6 += incr) {
var c5;
if (isAlphaSequence) {
c5 = String.fromCharCode(i6);
if (c5 === "\\")
c5 = "";
} else {
c5 = String(i6);
if (pad) {
var need = width - c5.length;
if (need > 0) {
var z2 = new Array(need + 1).join("0");
if (i6 < 0)
c5 = "-" + z2 + c5.slice(1);
else
c5 = z2 + c5;
}
}
}
N.push(c5);
}
} else {
N = [];
for (var j5 = 0; j5 < n5.length; j5++) {
N.push.apply(N, expand2(n5[j5], false));
}
}
for (var j5 = 0; j5 < N.length; j5++) {
for (var k5 = 0; k5 < post.length; k5++) {
var expansion = pre + N[j5] + post[k5];
if (!isTop || isSequence || expansion)
expansions.push(expansion);
}
}
}
return expansions;
}
}
});
// ../node_modules/.pnpm/minimatch@5.1.6/node_modules/minimatch/minimatch.js
var require_minimatch = __commonJS({
"../node_modules/.pnpm/minimatch@5.1.6/node_modules/minimatch/minimatch.js"(exports, module) {
"use strict";
var minimatch2 = module.exports = (p5, pattern, options = {}) => {
assertValidPattern2(pattern);
if (!options.nocomment && pattern.charAt(0) === "#") {
return false;
}
return new Minimatch2(pattern, options).match(p5);
};
module.exports = minimatch2;
var path3 = require_path();
minimatch2.sep = path3.sep;
var GLOBSTAR2 = Symbol("globstar **");
minimatch2.GLOBSTAR = GLOBSTAR2;
var expand2 = require_brace_expansion();
var plTypes2 = {
"!": { open: "(?:(?!(?:", close: "))[^/]*?)" },
"?": { open: "(?:", close: ")?" },
"+": { open: "(?:", close: ")+" },
"*": { open: "(?:", close: ")*" },
"@": { open: "(?:", close: ")" }
};
var qmark2 = "[^/]";
var star2 = qmark2 + "*?";
var twoStarDot2 = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
var twoStarNoDot2 = "(?:(?!(?:\\/|^)\\.).)*?";
var charSet2 = (s6) => s6.split("").reduce((set, c5) => {
set[c5] = true;
return set;
}, {});
var reSpecials2 = charSet2("().*{}+?[]^$\\!");
var addPatternStartSet2 = charSet2("[.(");
var slashSplit = /\/+/;
minimatch2.filter = (pattern, options = {}) => (p5, i6, list) => minimatch2(p5, pattern, options);
var ext2 = (a5, b5 = {}) => {
const t6 = {};
Object.keys(a5).forEach((k5) => t6[k5] = a5[k5]);
Object.keys(b5).forEach((k5) => t6[k5] = b5[k5]);
return t6;
};
minimatch2.defaults = (def) => {
if (!def || typeof def !== "object" || !Object.keys(def).length) {
return minimatch2;
}
const orig = minimatch2;
const m6 = (p5, pattern, options) => orig(p5, pattern, ext2(def, options));
m6.Minimatch = class Minimatch extends orig.Minimatch {
constructor(pattern, options) {
super(pattern, ext2(def, options));
}
};
m6.Minimatch.defaults = (options) => orig.defaults(ext2(def, options)).Minimatch;
m6.filter = (pattern, options) => orig.filter(pattern, ext2(def, options));
m6.defaults = (options) => orig.defaults(ext2(def, options));
m6.makeRe = (pattern, options) => orig.makeRe(pattern, ext2(def, options));
m6.braceExpand = (pattern, options) => orig.braceExpand(pattern, ext2(def, options));
m6.match = (list, pattern, options) => orig.match(list, pattern, ext2(def, options));
return m6;
};
minimatch2.braceExpand = (pattern, options) => braceExpand2(pattern, options);
var braceExpand2 = (pattern, options = {}) => {
assertValidPattern2(pattern);
if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
return [pattern];
}
return expand2(pattern);
};
var MAX_PATTERN_LENGTH2 = 1024 * 64;
var assertValidPattern2 = (pattern) => {
if (typeof pattern !== "string") {
throw new TypeError("invalid pattern");
}
if (pattern.length > MAX_PATTERN_LENGTH2) {
throw new TypeError("pattern is too long");
}
};
var SUBPARSE = Symbol("subparse");
minimatch2.makeRe = (pattern, options) => new Minimatch2(pattern, options || {}).makeRe();
minimatch2.match = (list, pattern, options = {}) => {
const mm = new Minimatch2(pattern, options);
list = list.filter((f7) => mm.match(f7));
if (mm.options.nonull && !list.length) {
list.push(pattern);
}
return list;
};
var globUnescape2 = (s6) => s6.replace(/\\(.)/g, "$1");
var charUnescape = (s6) => s6.replace(/\\([^-\]])/g, "$1");
var regExpEscape2 = (s6) => s6.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
var braExpEscape = (s6) => s6.replace(/[[\]\\]/g, "\\$&");
var Minimatch2 = class {
constructor(pattern, options) {
assertValidPattern2(pattern);
if (!options) options = {};
this.options = options;
this.set = [];
this.pattern = pattern;
this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
if (this.windowsPathsNoEscape) {
this.pattern = this.pattern.replace(/\\/g, "/");
}
this.regexp = null;
this.negate = false;
this.comment = false;
this.empty = false;
this.partial = !!options.partial;
this.make();
}
debug() {
}
make() {
const pattern = this.pattern;
const options = this.options;
if (!options.nocomment && pattern.charAt(0) === "#") {
this.comment = true;
return;
}
if (!pattern) {
this.empty = true;
return;
}
this.parseNegate();
let set = this.globSet = this.braceExpand();
if (options.debug) this.debug = (...args) => console.error(...args);
this.debug(this.pattern, set);
set = this.globParts = set.map((s6) => s6.split(slashSplit));
this.debug(this.pattern, set);
set = set.map((s6, si, set2) => s6.map(this.parse, this));
this.debug(this.pattern, set);
set = set.filter((s6) => s6.indexOf(false) === -1);
this.debug(this.pattern, set);
this.set = set;
}
parseNegate() {
if (this.options.nonegate) return;
const pattern = this.pattern;
let negate2 = false;
let negateOffset = 0;
for (let i6 = 0; i6 < pattern.length && pattern.charAt(i6) === "!"; i6++) {
negate2 = !negate2;
negateOffset++;
}
if (negateOffset) this.pattern = pattern.slice(negateOffset);
this.negate = negate2;
}
// set partial to true to test if, for example,
// "/a/b" matches the start of "/*/b/*/d"
// Partial means, if you run out of file before you run
// out of pattern, then that's fine, as long as all
// the parts match.
matchOne(file, pattern, partial) {
var options = this.options;
this.debug(
"matchOne",
{ "this": this, file, pattern }
);
this.debug("matchOne", file.length, pattern.length);
for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
this.debug("matchOne loop");
var p5 = pattern[pi];
var f7 = file[fi];
this.debug(pattern, p5, f7);
if (p5 === false) return false;
if (p5 === GLOBSTAR2) {
this.debug("GLOBSTAR", [pattern, p5, f7]);
var fr = fi;
var pr = pi + 1;
if (pr === pl) {
this.debug("** at the end");
for (; fi < fl; fi++) {
if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".") return false;
}
return true;
}
while (fr < fl) {
var swallowee = file[fr];
this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
this.debug("globstar found match!", fr, fl, swallowee);
return true;
} else {
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
this.debug("dot detected!", file, fr, pattern, pr);
break;
}
this.debug("globstar swallow a segment, and continue");
fr++;
}
}
if (partial) {
this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
if (fr === fl) return true;
}
return false;
}
var hit;
if (typeof p5 === "string") {
hit = f7 === p5;
this.debug("string match", p5, f7, hit);
} else {
hit = f7.match(p5);
this.debug("pattern match", p5, f7, hit);
}
if (!hit) return false;
}
if (fi === fl && pi === pl) {
return true;
} else if (fi === fl) {
return partial;
} else if (pi === pl) {
return fi === fl - 1 && file[fi] === "";
}
throw new Error("wtf?");
}
braceExpand() {
return braceExpand2(this.pattern, this.options);
}
parse(pattern, isSub) {
assertValidPattern2(pattern);
const options = this.options;
if (pattern === "**") {
if (!options.noglobstar)
return GLOBSTAR2;
else
pattern = "*";
}
if (pattern === "") return "";
let re = "";
let hasMagic = false;
let escaping = false;
const patternListStack = [];
const negativeLists = [];
let stateChar;
let inClass = false;
let reClassStart = -1;
let classStart = -1;
let cs;
let pl;
let sp;
let dotTravAllowed = pattern.charAt(0) === ".";
let dotFileAllowed = options.dot || dotTravAllowed;
const patternStart = () => dotTravAllowed ? "" : dotFileAllowed ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
const subPatternStart = (p5) => p5.charAt(0) === "." ? "" : options.dot ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
const clearStateChar = () => {
if (stateChar) {
switch (stateChar) {
case "*":
re += star2;
hasMagic = true;
break;
case "?":
re += qmark2;
hasMagic = true;
break;
default:
re += "\\" + stateChar;
break;
}
this.debug("clearStateChar %j %j", stateChar, re);
stateChar = false;
}
};
for (let i6 = 0, c5; i6 < pattern.length && (c5 = pattern.charAt(i6)); i6++) {
this.debug("%s %s %s %j", pattern, i6, re, c5);
if (escaping) {
if (c5 === "/") {
return false;
}
if (reSpecials2[c5]) {
re += "\\";
}
re += c5;
escaping = false;
continue;
}
switch (c5) {
/* istanbul ignore next */
case "/": {
return false;
}
case "\\":
if (inClass && pattern.charAt(i6 + 1) === "-") {
re += c5;
continue;
}
clearStateChar();
escaping = true;
continue;
// the various stateChar values
// for the "extglob" stuff.
case "?":
case "*":
case "+":
case "@":
case "!":
this.debug("%s %s %s %j <-- stateChar", pattern, i6, re, c5);
if (inClass) {
this.debug(" in class");
if (c5 === "!" && i6 === classStart + 1) c5 = "^";
re += c5;
continue;
}
this.debug("call clearStateChar %j", stateChar);
clearStateChar();
stateChar = c5;
if (options.noext) clearStateChar();
continue;
case "(": {
if (inClass) {
re += "(";
continue;
}
if (!stateChar) {
re += "\\(";
continue;
}
const plEntry = {
type: stateChar,
start: i6 - 1,
reStart: re.length,
open: plTypes2[stateChar].open,
close: plTypes2[stateChar].close
};
this.debug(this.pattern, " ", plEntry);
patternListStack.push(plEntry);
re += plEntry.open;
if (plEntry.start === 0 && plEntry.type !== "!") {
dotTravAllowed = true;
re += subPatternStart(pattern.slice(i6 + 1));
}
this.debug("plType %j %j", stateChar, re);
stateChar = false;
continue;
}
case ")": {
const plEntry = patternListStack[patternListStack.length - 1];
if (inClass || !plEntry) {
re += "\\)";
continue;
}
patternListStack.pop();
clearStateChar();
hasMagic = true;
pl = plEntry;
re += pl.close;
if (pl.type === "!") {
negativeLists.push(Object.assign(pl, { reEnd: re.length }));
}
continue;
}
case "|": {
const plEntry = patternListStack[patternListStack.length - 1];
if (inClass || !plEntry) {
re += "\\|";
continue;
}
clearStateChar();
re += "|";
if (plEntry.start === 0 && plEntry.type !== "!") {
dotTravAllowed = true;
re += subPatternStart(pattern.slice(i6 + 1));
}
continue;
}
// these are mostly the same in regexp and glob
case "[":
clearStateChar();
if (inClass) {
re += "\\" + c5;
continue;
}
inClass = true;
classStart = i6;
reClassStart = re.length;
re += c5;
continue;
case "]":
if (i6 === classStart + 1 || !inClass) {
re += "\\" + c5;
continue;
}
cs = pattern.substring(classStart + 1, i6);
try {
RegExp("[" + braExpEscape(charUnescape(cs)) + "]");
re += c5;
} catch (er) {
re = re.substring(0, reClassStart) + "(?:$.)";
}
hasMagic = true;
inClass = false;
continue;
default:
clearStateChar();
if (reSpecials2[c5] && !(c5 === "^" && inClass)) {
re += "\\";
}
re += c5;
break;
}
}
if (inClass) {
cs = pattern.slice(classStart + 1);
sp = this.parse(cs, SUBPARSE);
re = re.substring(0, reClassStart) + "\\[" + sp[0];
hasMagic = hasMagic || sp[1];
}
for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {