storybook
Version:
Storybook: Develop, document, and test UI components in isolation
1,420 lines (1,410 loc) • 752 kB
JavaScript
import CJS_COMPAT_NODE_URL_q99y7iqlbzn from 'node:url';
import CJS_COMPAT_NODE_PATH_q99y7iqlbzn from 'node:path';
import CJS_COMPAT_NODE_MODULE_q99y7iqlbzn from "node:module";
var __filename = CJS_COMPAT_NODE_URL_q99y7iqlbzn.fileURLToPath(import.meta.url);
var __dirname = CJS_COMPAT_NODE_PATH_q99y7iqlbzn.dirname(__filename);
var require = CJS_COMPAT_NODE_MODULE_q99y7iqlbzn.createRequire(import.meta.url);
// ------------------------------------------------------------
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
// ------------------------------------------------------------
import {
require_picomatch
} from "./chunk-HSJOTBKX.js";
import {
versions_default
} from "./chunk-3WGZOSZI.js";
import {
BUN_LOCKFILE,
BUN_LOCKFILE_BINARY,
NPM_LOCKFILE,
PNPM_LOCKFILE,
YARN_LOCKFILE,
execa,
execaCommandSync,
findFilesUp,
getProjectRoot,
normalizeStoryPath,
require_cross_spawn
} from "./chunk-CWTRQZTU.js";
import {
any,
from,
up2 as up
} from "./chunk-ZJVEXDYR.js";
import {
invariant
} from "./chunk-35SLFIQV.js";
import {
importModule,
resolveModulePath,
resolvePackageDir,
safeResolveModule
} from "./chunk-7N53RHGS.js";
import {
join,
parse,
resolve
} from "./chunk-LMQEOO5W.js";
import {
require_prompts
} from "./chunk-KCF2Q4OQ.js";
import {
glob,
globSync
} from "./chunk-2FEHHQWR.js";
import {
slash
} from "./chunk-ALHPYGYU.js";
import {
require_dist
} from "./chunk-IMHUIAVE.js";
import {
require_picocolors
} from "./chunk-KABHBSS3.js";
import {
__commonJS,
__esm,
__export,
__name,
__require,
__toCommonJS,
__toESM
} from "./chunk-MB5KTO7X.js";
// ../node_modules/@yarnpkg/fslib/node_modules/tslib/tslib.es6.js
var tslib_es6_exports = {};
__export(tslib_es6_exports, {
__assign: () => __assign,
__asyncDelegator: () => __asyncDelegator,
__asyncGenerator: () => __asyncGenerator,
__asyncValues: () => __asyncValues,
__await: () => __await,
__awaiter: () => __awaiter,
__classPrivateFieldGet: () => __classPrivateFieldGet,
__classPrivateFieldSet: () => __classPrivateFieldSet,
__createBinding: () => __createBinding,
__decorate: () => __decorate,
__exportStar: () => __exportStar,
__extends: () => __extends,
__generator: () => __generator,
__importDefault: () => __importDefault,
__importStar: () => __importStar,
__makeTemplateObject: () => __makeTemplateObject,
__metadata: () => __metadata,
__param: () => __param,
__read: () => __read,
__rest: () => __rest,
__spread: () => __spread,
__spreadArrays: () => __spreadArrays,
__values: () => __values
});
function __extends(d, b) {
extendStatics(d, b);
function __() {
this.constructor = d;
}
__name(__, "__");
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
function __rest(s, e) {
var t2 = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t2[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t2[p[i]] = s[p[i]];
}
return t2;
}
function __decorate(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
}
function __param(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
}
function __metadata(metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
}
function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) {
return value instanceof P ? value : new P(function(resolve8) {
resolve8(value);
});
}
__name(adopt, "adopt");
return new (P || (P = Promise))(function(resolve8, reject) {
function fulfilled(value) {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
}
__name(fulfilled, "fulfilled");
function rejected(value) {
try {
step(generator["throw"](value));
} catch (e) {
reject(e);
}
}
__name(rejected, "rejected");
function step(result) {
result.done ? resolve8(result.value) : adopt(result.value).then(fulfilled, rejected);
}
__name(step, "step");
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
function __generator(thisArg, body) {
var _ = { label: 0, sent: /* @__PURE__ */ __name(function() {
if (t2[0] & 1) throw t2[1];
return t2[1];
}, "sent"), trys: [], ops: [] }, f, y, t2, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
return this;
}), g;
function verb(n) {
return function(v) {
return step([n, v]);
};
}
__name(verb, "verb");
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t2 = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t2 = y["return"]) && t2.call(y), 0) : y.next) && !(t2 = t2.call(y, op[1])).done) return t2;
if (y = 0, t2) op = [op[0] & 2, t2.value];
switch (op[0]) {
case 0:
case 1:
t2 = op;
break;
case 4:
_.label++;
return { value: op[1], done: false };
case 5:
_.label++;
y = op[1];
op = [0];
continue;
case 7:
op = _.ops.pop();
_.trys.pop();
continue;
default:
if (!(t2 = _.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) {
_ = 0;
continue;
}
if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) {
_.label = op[1];
break;
}
if (op[0] === 6 && _.label < t2[1]) {
_.label = t2[1];
t2 = op;
break;
}
if (t2 && _.label < t2[2]) {
_.label = t2[2];
_.ops.push(op);
break;
}
if (t2[2]) _.ops.pop();
_.trys.pop();
continue;
}
op = body.call(thisArg, _);
} catch (e) {
op = [6, e];
y = 0;
} finally {
f = t2 = 0;
}
if (op[0] & 5) throw op[1];
return { value: op[0] ? op[1] : void 0, done: true };
}
__name(step, "step");
}
function __createBinding(o, m, k, k2) {
if (k2 === void 0) k2 = k;
o[k2] = m[k];
}
function __exportStar(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p];
}
function __values(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: /* @__PURE__ */ __name(function() {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}, "next")
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
function __read(o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
} catch (error) {
e = { error };
} finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
} finally {
if (e) throw e.error;
}
}
return ar;
}
function __spread() {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
}
function __spreadArrays() {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
}
function __await(v) {
return this instanceof __await ? (this.v = v, this) : new __await(v);
}
function __asyncGenerator(thisArg, _arguments, generator) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
return this;
}, i;
function verb(n) {
if (g[n]) i[n] = function(v) {
return new Promise(function(a, b) {
q.push([n, v, a, b]) > 1 || resume(n, v);
});
};
}
__name(verb, "verb");
function resume(n, v) {
try {
step(g[n](v));
} catch (e) {
settle(q[0][3], e);
}
}
__name(resume, "resume");
function step(r) {
r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
}
__name(step, "step");
function fulfill(value) {
resume("next", value);
}
__name(fulfill, "fulfill");
function reject(value) {
resume("throw", value);
}
__name(reject, "reject");
function settle(f, v) {
if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);
}
__name(settle, "settle");
}
function __asyncDelegator(o) {
var i, p;
return i = {}, verb("next"), verb("throw", function(e) {
throw e;
}), verb("return"), i[Symbol.iterator] = function() {
return this;
}, i;
function verb(n, f) {
i[n] = o[n] ? function(v) {
return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v;
} : f;
}
__name(verb, "verb");
}
function __asyncValues(o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
return this;
}, i);
function verb(n) {
i[n] = o[n] && function(v) {
return new Promise(function(resolve8, reject) {
v = o[n](v), settle(resolve8, reject, v.done, v.value);
});
};
}
__name(verb, "verb");
function settle(resolve8, reject, d, v) {
Promise.resolve(v).then(function(v2) {
resolve8({ value: v2, done: d });
}, reject);
}
__name(settle, "settle");
}
function __makeTemplateObject(cooked, raw) {
if (Object.defineProperty) {
Object.defineProperty(cooked, "raw", { value: raw });
} else {
cooked.raw = raw;
}
return cooked;
}
function __importStar(mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) {
for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
}
result.default = mod;
return result;
}
function __importDefault(mod) {
return mod && mod.__esModule ? mod : { default: mod };
}
function __classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
}
return privateMap.get(receiver);
}
function __classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
privateMap.set(receiver, value);
return value;
}
var extendStatics, __assign;
var init_tslib_es6 = __esm({
"../node_modules/@yarnpkg/fslib/node_modules/tslib/tslib.es6.js"() {
extendStatics = /* @__PURE__ */ __name(function(d, b) {
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
d2.__proto__ = b2;
} || function(d2, b2) {
for (var p in b2) if (b2.hasOwnProperty(p)) d2[p] = b2[p];
};
return extendStatics(d, b);
}, "extendStatics");
__name(__extends, "__extends");
__assign = /* @__PURE__ */ __name(function() {
__assign = Object.assign || /* @__PURE__ */ __name(function __assign3(t2) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t2[p] = s[p];
}
return t2;
}, "__assign");
return __assign.apply(this, arguments);
}, "__assign");
__name(__rest, "__rest");
__name(__decorate, "__decorate");
__name(__param, "__param");
__name(__metadata, "__metadata");
__name(__awaiter, "__awaiter");
__name(__generator, "__generator");
__name(__createBinding, "__createBinding");
__name(__exportStar, "__exportStar");
__name(__values, "__values");
__name(__read, "__read");
__name(__spread, "__spread");
__name(__spreadArrays, "__spreadArrays");
__name(__await, "__await");
__name(__asyncGenerator, "__asyncGenerator");
__name(__asyncDelegator, "__asyncDelegator");
__name(__asyncValues, "__asyncValues");
__name(__makeTemplateObject, "__makeTemplateObject");
__name(__importStar, "__importStar");
__name(__importDefault, "__importDefault");
__name(__classPrivateFieldGet, "__classPrivateFieldGet");
__name(__classPrivateFieldSet, "__classPrivateFieldSet");
}
});
// ../node_modules/@yarnpkg/fslib/lib/constants.js
var require_constants = __commonJS({
"../node_modules/@yarnpkg/fslib/lib/constants.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SAFE_TIME = exports.S_IFLNK = exports.S_IFREG = exports.S_IFDIR = exports.S_IFMT = void 0;
exports.S_IFMT = 61440;
exports.S_IFDIR = 16384;
exports.S_IFREG = 32768;
exports.S_IFLNK = 40960;
exports.SAFE_TIME = 456789e3;
}
});
// ../node_modules/@yarnpkg/fslib/lib/statUtils.js
var require_statUtils = __commonJS({
"../node_modules/@yarnpkg/fslib/lib/statUtils.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.areStatsEqual = exports.convertToBigIntStats = exports.clearStats = exports.makeEmptyStats = exports.makeDefaultStats = exports.BigIntStatsEntry = exports.StatEntry = exports.DirEntry = exports.DEFAULT_MODE = void 0;
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
var nodeUtils = tslib_1.__importStar(__require("util"));
var constants_1 = require_constants();
exports.DEFAULT_MODE = constants_1.S_IFREG | 420;
var DirEntry = class {
static {
__name(this, "DirEntry");
}
constructor() {
this.name = ``;
this.mode = 0;
}
isBlockDevice() {
return false;
}
isCharacterDevice() {
return false;
}
isDirectory() {
return (this.mode & constants_1.S_IFMT) === constants_1.S_IFDIR;
}
isFIFO() {
return false;
}
isFile() {
return (this.mode & constants_1.S_IFMT) === constants_1.S_IFREG;
}
isSocket() {
return false;
}
isSymbolicLink() {
return (this.mode & constants_1.S_IFMT) === constants_1.S_IFLNK;
}
};
exports.DirEntry = DirEntry;
var StatEntry = class {
static {
__name(this, "StatEntry");
}
constructor() {
this.uid = 0;
this.gid = 0;
this.size = 0;
this.blksize = 0;
this.atimeMs = 0;
this.mtimeMs = 0;
this.ctimeMs = 0;
this.birthtimeMs = 0;
this.atime = /* @__PURE__ */ new Date(0);
this.mtime = /* @__PURE__ */ new Date(0);
this.ctime = /* @__PURE__ */ new Date(0);
this.birthtime = /* @__PURE__ */ new Date(0);
this.dev = 0;
this.ino = 0;
this.mode = exports.DEFAULT_MODE;
this.nlink = 1;
this.rdev = 0;
this.blocks = 1;
}
isBlockDevice() {
return false;
}
isCharacterDevice() {
return false;
}
isDirectory() {
return (this.mode & constants_1.S_IFMT) === constants_1.S_IFDIR;
}
isFIFO() {
return false;
}
isFile() {
return (this.mode & constants_1.S_IFMT) === constants_1.S_IFREG;
}
isSocket() {
return false;
}
isSymbolicLink() {
return (this.mode & constants_1.S_IFMT) === constants_1.S_IFLNK;
}
};
exports.StatEntry = StatEntry;
var BigIntStatsEntry = class {
static {
__name(this, "BigIntStatsEntry");
}
constructor() {
this.uid = BigInt(0);
this.gid = BigInt(0);
this.size = BigInt(0);
this.blksize = BigInt(0);
this.atimeMs = BigInt(0);
this.mtimeMs = BigInt(0);
this.ctimeMs = BigInt(0);
this.birthtimeMs = BigInt(0);
this.atimeNs = BigInt(0);
this.mtimeNs = BigInt(0);
this.ctimeNs = BigInt(0);
this.birthtimeNs = BigInt(0);
this.atime = /* @__PURE__ */ new Date(0);
this.mtime = /* @__PURE__ */ new Date(0);
this.ctime = /* @__PURE__ */ new Date(0);
this.birthtime = /* @__PURE__ */ new Date(0);
this.dev = BigInt(0);
this.ino = BigInt(0);
this.mode = BigInt(exports.DEFAULT_MODE);
this.nlink = BigInt(1);
this.rdev = BigInt(0);
this.blocks = BigInt(1);
}
isBlockDevice() {
return false;
}
isCharacterDevice() {
return false;
}
isDirectory() {
return (this.mode & BigInt(constants_1.S_IFMT)) === BigInt(constants_1.S_IFDIR);
}
isFIFO() {
return false;
}
isFile() {
return (this.mode & BigInt(constants_1.S_IFMT)) === BigInt(constants_1.S_IFREG);
}
isSocket() {
return false;
}
isSymbolicLink() {
return (this.mode & BigInt(constants_1.S_IFMT)) === BigInt(constants_1.S_IFLNK);
}
};
exports.BigIntStatsEntry = BigIntStatsEntry;
function makeDefaultStats() {
return new StatEntry();
}
__name(makeDefaultStats, "makeDefaultStats");
exports.makeDefaultStats = makeDefaultStats;
function makeEmptyStats() {
return clearStats(makeDefaultStats());
}
__name(makeEmptyStats, "makeEmptyStats");
exports.makeEmptyStats = makeEmptyStats;
function clearStats(stats) {
for (const key in stats) {
if (Object.prototype.hasOwnProperty.call(stats, key)) {
const element = stats[key];
if (typeof element === `number`) {
stats[key] = 0;
} else if (typeof element === `bigint`) {
stats[key] = BigInt(0);
} else if (nodeUtils.types.isDate(element)) {
stats[key] = /* @__PURE__ */ new Date(0);
}
}
}
return stats;
}
__name(clearStats, "clearStats");
exports.clearStats = clearStats;
function convertToBigIntStats(stats) {
const bigintStats = new BigIntStatsEntry();
for (const key in stats) {
if (Object.prototype.hasOwnProperty.call(stats, key)) {
const element = stats[key];
if (typeof element === `number`) {
bigintStats[key] = BigInt(element);
} else if (nodeUtils.types.isDate(element)) {
bigintStats[key] = new Date(element);
}
}
}
bigintStats.atimeNs = bigintStats.atimeMs * BigInt(1e6);
bigintStats.mtimeNs = bigintStats.mtimeMs * BigInt(1e6);
bigintStats.ctimeNs = bigintStats.ctimeMs * BigInt(1e6);
bigintStats.birthtimeNs = bigintStats.birthtimeMs * BigInt(1e6);
return bigintStats;
}
__name(convertToBigIntStats, "convertToBigIntStats");
exports.convertToBigIntStats = convertToBigIntStats;
function areStatsEqual(a, b) {
if (a.atimeMs !== b.atimeMs)
return false;
if (a.birthtimeMs !== b.birthtimeMs)
return false;
if (a.blksize !== b.blksize)
return false;
if (a.blocks !== b.blocks)
return false;
if (a.ctimeMs !== b.ctimeMs)
return false;
if (a.dev !== b.dev)
return false;
if (a.gid !== b.gid)
return false;
if (a.ino !== b.ino)
return false;
if (a.isBlockDevice() !== b.isBlockDevice())
return false;
if (a.isCharacterDevice() !== b.isCharacterDevice())
return false;
if (a.isDirectory() !== b.isDirectory())
return false;
if (a.isFIFO() !== b.isFIFO())
return false;
if (a.isFile() !== b.isFile())
return false;
if (a.isSocket() !== b.isSocket())
return false;
if (a.isSymbolicLink() !== b.isSymbolicLink())
return false;
if (a.mode !== b.mode)
return false;
if (a.mtimeMs !== b.mtimeMs)
return false;
if (a.nlink !== b.nlink)
return false;
if (a.rdev !== b.rdev)
return false;
if (a.size !== b.size)
return false;
if (a.uid !== b.uid)
return false;
const aN = a;
const bN = b;
if (aN.atimeNs !== bN.atimeNs)
return false;
if (aN.mtimeNs !== bN.mtimeNs)
return false;
if (aN.ctimeNs !== bN.ctimeNs)
return false;
if (aN.birthtimeNs !== bN.birthtimeNs)
return false;
return true;
}
__name(areStatsEqual, "areStatsEqual");
exports.areStatsEqual = areStatsEqual;
}
});
// ../node_modules/@yarnpkg/fslib/lib/path.js
var require_path = __commonJS({
"../node_modules/@yarnpkg/fslib/lib/path.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toFilename = exports.convertPath = exports.ppath = exports.npath = exports.Filename = exports.PortablePath = void 0;
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
var path_1 = tslib_1.__importDefault(__require("path"));
var PathType;
(function(PathType2) {
PathType2[PathType2["File"] = 0] = "File";
PathType2[PathType2["Portable"] = 1] = "Portable";
PathType2[PathType2["Native"] = 2] = "Native";
})(PathType || (PathType = {}));
exports.PortablePath = {
root: `/`,
dot: `.`,
parent: `..`
};
exports.Filename = {
nodeModules: `node_modules`,
manifest: `package.json`,
lockfile: `yarn.lock`,
virtual: `__virtual__`,
/**
* @deprecated
*/
pnpJs: `.pnp.js`,
pnpCjs: `.pnp.cjs`,
rc: `.yarnrc.yml`
};
exports.npath = Object.create(path_1.default);
exports.ppath = Object.create(path_1.default.posix);
exports.npath.cwd = () => process.cwd();
exports.ppath.cwd = () => toPortablePath(process.cwd());
exports.ppath.resolve = (...segments) => {
if (segments.length > 0 && exports.ppath.isAbsolute(segments[0])) {
return path_1.default.posix.resolve(...segments);
} else {
return path_1.default.posix.resolve(exports.ppath.cwd(), ...segments);
}
};
var contains = /* @__PURE__ */ __name(function(pathUtils, from2, to) {
from2 = pathUtils.normalize(from2);
to = pathUtils.normalize(to);
if (from2 === to)
return `.`;
if (!from2.endsWith(pathUtils.sep))
from2 = from2 + pathUtils.sep;
if (to.startsWith(from2)) {
return to.slice(from2.length);
} else {
return null;
}
}, "contains");
exports.npath.fromPortablePath = fromPortablePath;
exports.npath.toPortablePath = toPortablePath;
exports.npath.contains = (from2, to) => contains(exports.npath, from2, to);
exports.ppath.contains = (from2, to) => contains(exports.ppath, from2, to);
var WINDOWS_PATH_REGEXP = /^([a-zA-Z]:.*)$/;
var UNC_WINDOWS_PATH_REGEXP = /^\/\/(\.\/)?(.*)$/;
var PORTABLE_PATH_REGEXP = /^\/([a-zA-Z]:.*)$/;
var UNC_PORTABLE_PATH_REGEXP = /^\/unc\/(\.dot\/)?(.*)$/;
function fromPortablePath(p) {
if (process.platform !== `win32`)
return p;
let portablePathMatch, uncPortablePathMatch;
if (portablePathMatch = p.match(PORTABLE_PATH_REGEXP))
p = portablePathMatch[1];
else if (uncPortablePathMatch = p.match(UNC_PORTABLE_PATH_REGEXP))
p = `\\\\${uncPortablePathMatch[1] ? `.\\` : ``}${uncPortablePathMatch[2]}`;
else
return p;
return p.replace(/\//g, `\\`);
}
__name(fromPortablePath, "fromPortablePath");
function toPortablePath(p) {
if (process.platform !== `win32`)
return p;
p = p.replace(/\\/g, `/`);
let windowsPathMatch, uncWindowsPathMatch;
if (windowsPathMatch = p.match(WINDOWS_PATH_REGEXP))
p = `/${windowsPathMatch[1]}`;
else if (uncWindowsPathMatch = p.match(UNC_WINDOWS_PATH_REGEXP))
p = `/unc/${uncWindowsPathMatch[1] ? `.dot/` : ``}${uncWindowsPathMatch[2]}`;
return p;
}
__name(toPortablePath, "toPortablePath");
function convertPath(targetPathUtils, sourcePath) {
return targetPathUtils === exports.npath ? fromPortablePath(sourcePath) : toPortablePath(sourcePath);
}
__name(convertPath, "convertPath");
exports.convertPath = convertPath;
function toFilename(filename) {
if (exports.npath.parse(filename).dir !== `` || exports.ppath.parse(filename).dir !== ``)
throw new Error(`Invalid filename: "${filename}"`);
return filename;
}
__name(toFilename, "toFilename");
exports.toFilename = toFilename;
}
});
// ../node_modules/@yarnpkg/fslib/lib/algorithms/copyPromise.js
var require_copyPromise = __commonJS({
"../node_modules/@yarnpkg/fslib/lib/algorithms/copyPromise.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.copyPromise = exports.LinkStrategy = void 0;
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
var fs_1 = tslib_1.__importDefault(__require("fs"));
var constants2 = tslib_1.__importStar(require_constants());
var path_1 = require_path();
var defaultTime = new Date(constants2.SAFE_TIME * 1e3);
var LinkStrategy;
(function(LinkStrategy2) {
LinkStrategy2["Allow"] = "allow";
LinkStrategy2["ReadOnly"] = "readOnly";
})(LinkStrategy = exports.LinkStrategy || (exports.LinkStrategy = {}));
async function copyPromise(destinationFs, destination, sourceFs, source, opts) {
const normalizedDestination = destinationFs.pathUtils.normalize(destination);
const normalizedSource = sourceFs.pathUtils.normalize(source);
const prelayout = [];
const postlayout = [];
const { atime, mtime } = opts.stableTime ? { atime: defaultTime, mtime: defaultTime } : await sourceFs.lstatPromise(normalizedSource);
await destinationFs.mkdirpPromise(destinationFs.pathUtils.dirname(destination), { utimes: [atime, mtime] });
const updateTime = typeof destinationFs.lutimesPromise === `function` ? destinationFs.lutimesPromise.bind(destinationFs) : destinationFs.utimesPromise.bind(destinationFs);
await copyImpl(prelayout, postlayout, updateTime, destinationFs, normalizedDestination, sourceFs, normalizedSource, { ...opts, didParentExist: true });
for (const operation of prelayout)
await operation();
await Promise.all(postlayout.map((operation) => {
return operation();
}));
}
__name(copyPromise, "copyPromise");
exports.copyPromise = copyPromise;
async function copyImpl(prelayout, postlayout, updateTime, destinationFs, destination, sourceFs, source, opts) {
var _a, _b;
const destinationStat = opts.didParentExist ? await maybeLStat(destinationFs, destination) : null;
const sourceStat = await sourceFs.lstatPromise(source);
const { atime, mtime } = opts.stableTime ? { atime: defaultTime, mtime: defaultTime } : sourceStat;
let updated;
switch (true) {
case sourceStat.isDirectory():
{
updated = await copyFolder(prelayout, postlayout, updateTime, destinationFs, destination, destinationStat, sourceFs, source, sourceStat, opts);
}
break;
case sourceStat.isFile():
{
updated = await copyFile2(prelayout, postlayout, updateTime, destinationFs, destination, destinationStat, sourceFs, source, sourceStat, opts);
}
break;
case sourceStat.isSymbolicLink():
{
updated = await copySymlink(prelayout, postlayout, updateTime, destinationFs, destination, destinationStat, sourceFs, source, sourceStat, opts);
}
break;
default:
{
throw new Error(`Unsupported file type (${sourceStat.mode})`);
}
break;
}
if (updated || ((_a = destinationStat === null || destinationStat === void 0 ? void 0 : destinationStat.mtime) === null || _a === void 0 ? void 0 : _a.getTime()) !== mtime.getTime() || ((_b = destinationStat === null || destinationStat === void 0 ? void 0 : destinationStat.atime) === null || _b === void 0 ? void 0 : _b.getTime()) !== atime.getTime()) {
postlayout.push(() => updateTime(destination, atime, mtime));
updated = true;
}
if (destinationStat === null || (destinationStat.mode & 511) !== (sourceStat.mode & 511)) {
postlayout.push(() => destinationFs.chmodPromise(destination, sourceStat.mode & 511));
updated = true;
}
return updated;
}
__name(copyImpl, "copyImpl");
async function maybeLStat(baseFs, p) {
try {
return await baseFs.lstatPromise(p);
} catch (e) {
return null;
}
}
__name(maybeLStat, "maybeLStat");
async function copyFolder(prelayout, postlayout, updateTime, destinationFs, destination, destinationStat, sourceFs, source, sourceStat, opts) {
if (destinationStat !== null && !destinationStat.isDirectory()) {
if (opts.overwrite) {
prelayout.push(async () => destinationFs.removePromise(destination));
destinationStat = null;
} else {
return false;
}
}
let updated = false;
if (destinationStat === null) {
prelayout.push(async () => {
try {
await destinationFs.mkdirPromise(destination, { mode: sourceStat.mode });
} catch (err) {
if (err.code !== `EEXIST`) {
throw err;
}
}
});
updated = true;
}
const entries = await sourceFs.readdirPromise(source);
const nextOpts = opts.didParentExist && !destinationStat ? { ...opts, didParentExist: false } : opts;
if (opts.stableSort) {
for (const entry of entries.sort()) {
if (await copyImpl(prelayout, postlayout, updateTime, destinationFs, destinationFs.pathUtils.join(destination, entry), sourceFs, sourceFs.pathUtils.join(source, entry), nextOpts)) {
updated = true;
}
}
} else {
const entriesUpdateStatus = await Promise.all(entries.map(async (entry) => {
await copyImpl(prelayout, postlayout, updateTime, destinationFs, destinationFs.pathUtils.join(destination, entry), sourceFs, sourceFs.pathUtils.join(source, entry), nextOpts);
}));
if (entriesUpdateStatus.some((status) => status)) {
updated = true;
}
}
return updated;
}
__name(copyFolder, "copyFolder");
var isCloneSupportedCache = /* @__PURE__ */ new WeakMap();
function makeLinkOperation(opFs, destination, source, sourceStat, linkStrategy) {
return async () => {
await opFs.linkPromise(source, destination);
if (linkStrategy === LinkStrategy.ReadOnly) {
sourceStat.mode &= ~146;
await opFs.chmodPromise(destination, sourceStat.mode);
}
};
}
__name(makeLinkOperation, "makeLinkOperation");
function makeCloneLinkOperation(opFs, destination, source, sourceStat, linkStrategy) {
const isCloneSupported = isCloneSupportedCache.get(opFs);
if (typeof isCloneSupported === `undefined`) {
return async () => {
try {
await opFs.copyFilePromise(source, destination, fs_1.default.constants.COPYFILE_FICLONE_FORCE);
isCloneSupportedCache.set(opFs, true);
} catch (err) {
if (err.code === `ENOSYS` || err.code === `ENOTSUP`) {
isCloneSupportedCache.set(opFs, false);
await makeLinkOperation(opFs, destination, source, sourceStat, linkStrategy)();
} else {
throw err;
}
}
};
} else {
if (isCloneSupported) {
return async () => opFs.copyFilePromise(source, destination, fs_1.default.constants.COPYFILE_FICLONE_FORCE);
} else {
return makeLinkOperation(opFs, destination, source, sourceStat, linkStrategy);
}
}
}
__name(makeCloneLinkOperation, "makeCloneLinkOperation");
async function copyFile2(prelayout, postlayout, updateTime, destinationFs, destination, destinationStat, sourceFs, source, sourceStat, opts) {
var _a;
if (destinationStat !== null) {
if (opts.overwrite) {
prelayout.push(async () => destinationFs.removePromise(destination));
destinationStat = null;
} else {
return false;
}
}
const linkStrategy = (_a = opts.linkStrategy) !== null && _a !== void 0 ? _a : null;
const op = destinationFs === sourceFs ? linkStrategy !== null ? makeCloneLinkOperation(destinationFs, destination, source, sourceStat, linkStrategy) : async () => destinationFs.copyFilePromise(source, destination, fs_1.default.constants.COPYFILE_FICLONE) : linkStrategy !== null ? makeLinkOperation(destinationFs, destination, source, sourceStat, linkStrategy) : async () => destinationFs.writeFilePromise(destination, await sourceFs.readFilePromise(source));
prelayout.push(async () => op());
return true;
}
__name(copyFile2, "copyFile");
async function copySymlink(prelayout, postlayout, updateTime, destinationFs, destination, destinationStat, sourceFs, source, sourceStat, opts) {
if (destinationStat !== null) {
if (opts.overwrite) {
prelayout.push(async () => destinationFs.removePromise(destination));
destinationStat = null;
} else {
return false;
}
}
prelayout.push(async () => {
await destinationFs.symlinkPromise((0, path_1.convertPath)(destinationFs.pathUtils, await sourceFs.readlinkPromise(source)), destination);
});
return true;
}
__name(copySymlink, "copySymlink");
}
});
// ../node_modules/@yarnpkg/fslib/lib/errors.js
var require_errors = __commonJS({
"../node_modules/@yarnpkg/fslib/lib/errors.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LibzipError = exports.ERR_DIR_CLOSED = exports.EOPNOTSUPP = exports.ENOTEMPTY = exports.EROFS = exports.EEXIST = exports.EISDIR = exports.ENOTDIR = exports.ENOENT = exports.EBADF = exports.EINVAL = exports.ENOSYS = exports.EBUSY = void 0;
function makeError(code, message) {
return Object.assign(new Error(`${code}: ${message}`), { code });
}
__name(makeError, "makeError");
function EBUSY(message) {
return makeError(`EBUSY`, message);
}
__name(EBUSY, "EBUSY");
exports.EBUSY = EBUSY;
function ENOSYS(message, reason) {
return makeError(`ENOSYS`, `${message}, ${reason}`);
}
__name(ENOSYS, "ENOSYS");
exports.ENOSYS = ENOSYS;
function EINVAL(reason) {
return makeError(`EINVAL`, `invalid argument, ${reason}`);
}
__name(EINVAL, "EINVAL");
exports.EINVAL = EINVAL;
function EBADF(reason) {
return makeError(`EBADF`, `bad file descriptor, ${reason}`);
}
__name(EBADF, "EBADF");
exports.EBADF = EBADF;
function ENOENT(reason) {
return makeError(`ENOENT`, `no such file or directory, ${reason}`);
}
__name(ENOENT, "ENOENT");
exports.ENOENT = ENOENT;
function ENOTDIR(reason) {
return makeError(`ENOTDIR`, `not a directory, ${reason}`);
}
__name(ENOTDIR, "ENOTDIR");
exports.ENOTDIR = ENOTDIR;
function EISDIR(reason) {
return makeError(`EISDIR`, `illegal operation on a directory, ${reason}`);
}
__name(EISDIR, "EISDIR");
exports.EISDIR = EISDIR;
function EEXIST(reason) {
return makeError(`EEXIST`, `file already exists, ${reason}`);
}
__name(EEXIST, "EEXIST");
exports.EEXIST = EEXIST;
function EROFS(reason) {
return makeError(`EROFS`, `read-only filesystem, ${reason}`);
}
__name(EROFS, "EROFS");
exports.EROFS = EROFS;
function ENOTEMPTY(reason) {
return makeError(`ENOTEMPTY`, `directory not empty, ${reason}`);
}
__name(ENOTEMPTY, "ENOTEMPTY");
exports.ENOTEMPTY = ENOTEMPTY;
function EOPNOTSUPP(reason) {
return makeError(`EOPNOTSUPP`, `operation not supported, ${reason}`);
}
__name(EOPNOTSUPP, "EOPNOTSUPP");
exports.EOPNOTSUPP = EOPNOTSUPP;
function ERR_DIR_CLOSED() {
return makeError(`ERR_DIR_CLOSED`, `Directory handle was closed`);
}
__name(ERR_DIR_CLOSED, "ERR_DIR_CLOSED");
exports.ERR_DIR_CLOSED = ERR_DIR_CLOSED;
var LibzipError = class extends Error {
static {
__name(this, "LibzipError");
}
constructor(message, code) {
super(message);
this.name = `Libzip Error`;
this.code = code;
}
};
exports.LibzipError = LibzipError;
}
});
// ../node_modules/@yarnpkg/fslib/lib/algorithms/opendir.js
var require_opendir = __commonJS({
"../node_modules/@yarnpkg/fslib/lib/algorithms/opendir.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.opendir = exports.CustomDir = void 0;
var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
var errors = tslib_1.__importStar(require_errors());
var CustomDir = class {
static {
__name(this, "CustomDir");
}
constructor(path, nextDirent, opts = {}) {
this.path = path;
this.nextDirent = nextDirent;
this.opts = opts;
this.closed = false;
}
throwIfClosed() {
if (this.closed) {
throw errors.ERR_DIR_CLOSED();
}
}
async *[Symbol.asyncIterator]() {
try {
let dirent;
while ((dirent = await this.read()) !== null) {
yield dirent;
}
} finally {
await this.close();
}
}
read(cb) {
const dirent = this.readSync();
if (typeof cb !== `undefined`)
return cb(null, dirent);
return Promise.resolve(dirent);
}
readSync() {
this.throwIfClosed();
return this.nextDirent();
}
close(cb) {
this.closeSync();
if (typeof cb !== `undefined`)
return cb(null);
return Promise.resolve();
}
closeSync() {
var _a, _b;
this.throwIfClosed();
(_b = (_a = this.opts).onClose) === null || _b === void 0 ? void 0 : _b.call(_a);
this.closed = true;
}
};
exports.CustomDir = CustomDir;
function opendir(fakeFs, path, entries, opts) {
const nextDirent = /* @__PURE__ */ __name(() => {
const filename = entries.shift();
if (typeof filename === `undefined`)
return null;
return Object.assign(fakeFs.statSync(fakeFs.pathUtils.join(path, filename)), {
name: filename
});
}, "nextDirent");
return new CustomDir(path, nextDirent, opts);
}
__name(opendir, "opendir");
exports.opendir = opendir;
}
});
// ../node_modules/@yarnpkg/fslib/lib/FakeFS.js
var require_FakeFS = __commonJS({
"../node_modules/@yarnpkg/fslib/lib/FakeFS.js"(exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.normalizeLineEndings = exports.BasePortableFakeFS = exports.FakeFS = void 0;
var os_1 = __require("os");
var copyPromise_1 = require_copyPromise();
var path_1 = require_path();
var FakeFS = class {
static {
__name(this, "FakeFS");
}
constructor(pathUtils) {
this.pathUtils = pathUtils;
}
async *genTraversePromise(init, { stableSort = false } = {}) {
const stack = [init];
while (stack.length > 0) {
const p = stack.shift();
const entry = await this.lstatPromise(p);
if (entry.isDirectory()) {
const entries = await this.readdirPromise(p);
if (stableSort) {
for (const entry2 of entries.sort()) {
stack.push(this.pathUtils.join(p, entry2));
}
} else {
throw new Error(`Not supported`);
}
} else {
yield p;
}
}
}
async removePromise(p, { recursive = true, maxRetries = 5 } = {}) {
let stat;
try {
stat = await this.lstatPromise(p);
} catch (error) {
if (error.code === `ENOENT`) {
return;
} else {
throw error;
}
}
if (stat.isDirectory()) {
if (recursive) {
const entries = await this.readdirPromise(p);
await Promise.all(entries.map((entry) => {
return this.removePromise(this.pathUtils.resolve(p, entry));
}));
}
for (let t2 = 0; t2 <= maxRetries; t2++) {
try {
await this.rmdirPromise(p);
break;
} catch (error) {
if (error.code !== `EBUSY` && error.code !== `ENOTEMPTY`) {
throw error;
} else if (t2 < maxRetries) {
await new Promise((resolve8) => setTimeout(resolve8, t2 * 100));
}
}
}
} else {
await this.unlinkPromise(p);
}
}
removeSync(p, { recursive = true } = {}) {
let stat;
try {
stat = this.lstatSync(p);
} catch (error) {
if (error.code === `ENOENT`) {
return;
} else {
throw error;
}
}
if (stat.isDirectory()) {
if (recursive)
for (const entry of this.readdirSync(p))
this.removeSync(this.pathUtils.resolve(p, entry));
this.rmdirSync(p);
} else {
this.unlinkSync(p);
}
}
async mkdirpPromise(p, { chmod, utimes } = {}) {
p = this.resolve(p);
if (p === this.pathUtils.dirname(p))
return void 0;
const parts = p.split(this.pathUtils.sep);
let createdDirectory;
for (let u = 2; u <= parts.length; ++u) {
const subPath = parts.slice(0, u).join(this.pathUtils.sep);
if (!this.existsSync(subPath)) {
try {
await this.mkdirPromise(subPath);
} catch (error) {
if (error.code === `EEXIST`) {
continue;
} else {
throw error;
}
}
createdDirectory !== null && createdDirectory !== void 0 ? createdDirectory : createdDirectory = subPath;
if (chmod != null)
await this.chmodPromise(subPath, chmod);
if (utimes != null) {
await this.utimesPromise(subPath, utimes[0], utimes[1]);
} else {
const parentStat = await this.statPromise(this.pathUtils.dirname(subPath));
await this.utimesPromise(subPath, parentStat.atime, parentStat.mtime);
}
}
}
return createdDirectory;
}
mkdirpSync(p, { chmod, utimes } = {}) {
p = this.resolve(p);
if (p === this.pathUtils.dirname(p))
return void 0;
const parts = p.split(this.pathUtils.sep);
let createdDirectory;
for (let u = 2; u <= parts.length; ++u) {
const subPath = parts.slice(0, u).join(this.pathUtils.sep);
if (!this.existsSync(subPath)) {
try {
this.mkdirSync(subPath);
} catch (error) {
if (error.code === `EEXIST`) {
continue;
} else {
throw error;
}
}
createdDirectory !== null && createdDirectory !== void 0 ? createdDirectory : createdDirectory = subPath;
if (chmod != null)
this.chmodSync(subPath, chmod);
if (utimes != null) {
this.utimesSync(subPath, utimes[0], utimes[1]);
} else {
const parentStat = this.statSync(this.pathUtils.dirname(subPath));
this.utimesSync(subPath, parentStat.atime, parentStat.mtime);
}
}
}
return createdDirectory;
}
async copyPromise(destination, source, { baseFs = this, overwrite = true, stableSort = false, stableTime = false, linkStrategy = null } = {}) {
return await (0, copyPromise_1.copyPromise)(this, destination, baseFs, source, { overwrite, stableSort, stableTime, linkStrategy });
}
copySync(destination, source, { baseFs = this, overwrite = true } = {}) {
const stat = baseFs.lstatSync(source);
const exists = this.existsSync(destination);
if (stat.isDirectory()) {
this.mkdirpSync(destination);
const directoryListing = baseFs.readdirSync(source);
for (const entry of directoryListing) {
this.copySync(this.pathUtils.join(destination, entry), baseFs.pathUtils.join(source, entry), { baseFs, overwrite });
}
} else if (stat.isFile()) {
if (!exists || overwrite) {
if (exists)
this.removeSync(destination);
const content = baseFs.readFileSync(source);
this.writeFileSync(destination, content);
}
} else if (stat.isSymbolicLink()) {
if (!exists || overwrite) {
if (exists)
this.removeSync(destination);
const target = baseFs.readlinkSync(source);
this.symlinkSync((0, path_1.convertPath)(this.pathUtils, target), destination);
}
} else {
throw new Error(`Unsupported file type (file: ${source}, mode: 0o${stat.mode.toString(8).padStart(6, `0`)})`);
}
const mode = stat.mode & 511;
this.chmodSync(destination, mode);
}
async changeFilePromise(p, content, opts = {}) {
if (Buffer.isBuffer(content)) {
return this.changeFileBufferPromise(p, content, opts);
} else {
return this.changeFileTextPromise(p, content, opts);
}
}
async changeFileBufferPromise(p, content, { mode } = {}) {
let current = Buffer.alloc(0);
try {
current = await this.readFilePromise(p);
} catch (error) {
}
if (Buffer.compare(current, content) === 0)
return;
await this.writeFilePromise(p, content, { mode });
}
async changeFileTextPromise(p, content, { automaticNewlines, mode } = {}) {
let current = ``;
try {
current = await this.readFilePromise(p, `utf8`);
} catch (error) {
}
const normalizedContent = automaticNewlines ? normalizeLineEndings(current, content) : content;
if (current === normalizedContent)
return;
await this.writeFilePromise(p, normalizedContent, { mode });
}
changeFileSync(p, content, opts = {}) {
if (Buffer.isBuffer(content)) {
return this.changeFileBufferSync(p, content, opts);
} else {
return this.changeFileTextSync(p, content, opts);
}
}
changeFileBufferSync(p, content, { mode } = {}) {
let current = Buffer.alloc(0);
try {
current = this.readFileSync(p);
} catch (error) {
}
if (Buffer.compare(current, content) === 0)
return;
this.writeFileSync(p, content, { mode });
}
changeFileTextSync(p, content, { automaticNewlines = false, mode } = {}) {
let current = ``;
try {
current = this.readFileSync(p, `utf8`);
} catch (error) {
}
const normalizedContent = automaticNewlines ? normalizeLineEndings(current, content) : content;
if (current === normalizedContent)
return;
this.writeFileSync(p, normalizedContent, { mode });
}
async movePromise(fromP, toP) {
try {
await this.renamePromise(fromP, toP);
} catch (error) {
if (error.code === `EXDEV`) {
await this.copyPromise(toP, fromP);
await this.removePromise(fromP);
} else {
throw error;
}
}
}
moveSync(fromP, toP) {
try {
this.renameSync(fromP, toP);
} catch (error) {
if (error.code === `EXDEV`) {
this.copySync(toP, fromP);
this.removeSync(fromP);
} else {
throw error;
}
}
}
async lockPromise(affectedPath, callback) {
const lockPath = `${affectedPath}.flock`;
const interval = 1e3 / 60;
const startTime = Date.now();
let fd = null;
const isAlive = /* @__PURE__ */ __name(async () =>