@storm-software/esbuild
Version:
A package containing `esbuild` utilities for building Storm Software libraries and applications
1,204 lines (1,186 loc) • 111 kB
JavaScript
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard2(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce2(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain2(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class2;
var _chunkI7VU53I5cjs = require('./chunk-I7VU53I5.cjs');
var _chunk7DZ3NOLBcjs = require('./chunk-7DZ3NOLB.cjs');
var _chunkJG7MZJV2cjs = require('./chunk-JG7MZJV2.cjs');
// ../../node_modules/.pnpm/tsup@8.4.0_patch_hash=751a554d775c3572381af4e7e5fa22eeda6dd6856012fb1cf521d6806eb2dc74__bbfa3b50d88caa605d59198ec617cf63/node_modules/tsup/dist/chunk-BYH4XDRH.js
var require_chunk_BYH4XDRH = _chunkJG7MZJV2cjs.__commonJS.call(void 0, {
"../../node_modules/.pnpm/tsup@8.4.0_patch_hash=751a554d775c3572381af4e7e5fa22eeda6dd6856012fb1cf521d6806eb2dc74__bbfa3b50d88caa605d59198ec617cf63/node_modules/tsup/dist/chunk-BYH4XDRH.js"(exports) {
"use strict";
_chunkJG7MZJV2cjs.init_cjs_shims.call(void 0, );
Object.defineProperty(exports, "__esModule", { value: true });
var version = "8.4.0";
exports.version = version;
}
});
// ../../node_modules/.pnpm/tsup@8.4.0_patch_hash=751a554d775c3572381af4e7e5fa22eeda6dd6856012fb1cf521d6806eb2dc74__bbfa3b50d88caa605d59198ec617cf63/node_modules/tsup/dist/chunk-TWFEYLU4.js
var require_chunk_TWFEYLU4 = _chunkJG7MZJV2cjs.__commonJS.call(void 0, {
"../../node_modules/.pnpm/tsup@8.4.0_patch_hash=751a554d775c3572381af4e7e5fa22eeda6dd6856012fb1cf521d6806eb2dc74__bbfa3b50d88caa605d59198ec617cf63/node_modules/tsup/dist/chunk-TWFEYLU4.js"(exports) {
"use strict";
_chunkJG7MZJV2cjs.init_cjs_shims.call(void 0, );
Object.defineProperty(exports, "__esModule", { value: true });
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function _optionalChain(ops) {
let lastAccessLHS = void 0;
let value = ops[0];
let i = 1;
while (i < ops.length) {
const op = ops[i];
const fn = ops[i + 1];
i += 2;
if ((op === "optionalAccess" || op === "optionalCall") && value == null) {
return void 0;
}
if (op === "access" || op === "optionalAccess") {
lastAccessLHS = value;
value = fn(value);
} else if (op === "call" || op === "optionalCall") {
value = fn((...args) => value.call(lastAccessLHS, ...args));
lastAccessLHS = void 0;
}
}
return value;
}
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 __require2 = /* @__PURE__ */ ((x) => typeof _chunkJG7MZJV2cjs.__require !== "undefined" ? _chunkJG7MZJV2cjs.__require : typeof Proxy !== "undefined" ? new Proxy(x, {
get: (a, b) => (typeof _chunkJG7MZJV2cjs.__require !== "undefined" ? _chunkJG7MZJV2cjs.__require : a)[b]
}) : x)(function(x) {
if (typeof _chunkJG7MZJV2cjs.__require !== "undefined") return _chunkJG7MZJV2cjs.__require.apply(this, arguments);
throw Error('Dynamic require of "' + x + '" is not supported');
});
var __commonJS2 = (cb, mod) => function __require22() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
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 __toESM2 = (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 _fs = _chunkJG7MZJV2cjs.__require.call(void 0, "fs");
var _fs2 = _interopRequireDefault(_fs);
var _path = _chunkJG7MZJV2cjs.__require.call(void 0, "path");
var _path2 = _interopRequireDefault(_path);
var _resolvefrom = _chunkJG7MZJV2cjs.__require.call(void 0, "resolve-from");
var _resolvefrom2 = _interopRequireDefault(_resolvefrom);
var singleComment = Symbol("singleComment");
var multiComment = Symbol("multiComment");
var stripWithoutWhitespace = () => "";
var stripWithWhitespace = (string, start, end) => string.slice(start, end).replace(/\S/g, " ");
var isEscaped = (jsonString, quotePosition) => {
let index = quotePosition - 1;
let backslashCount = 0;
while (jsonString[index] === "\\") {
index -= 1;
backslashCount += 1;
}
return Boolean(backslashCount % 2);
};
function stripJsonComments(jsonString, { whitespace = true, trailingCommas = false } = {}) {
if (typeof jsonString !== "string") {
throw new TypeError(`Expected argument \`jsonString\` to be a \`string\`, got \`${typeof jsonString}\``);
}
const strip = whitespace ? stripWithWhitespace : stripWithoutWhitespace;
let isInsideString = false;
let isInsideComment = false;
let offset = 0;
let buffer = "";
let result = "";
let commaIndex = -1;
for (let index = 0; index < jsonString.length; index++) {
const currentCharacter = jsonString[index];
const nextCharacter = jsonString[index + 1];
if (!isInsideComment && currentCharacter === '"') {
const escaped = isEscaped(jsonString, index);
if (!escaped) {
isInsideString = !isInsideString;
}
}
if (isInsideString) {
continue;
}
if (!isInsideComment && currentCharacter + nextCharacter === "//") {
buffer += jsonString.slice(offset, index);
offset = index;
isInsideComment = singleComment;
index++;
} else if (isInsideComment === singleComment && currentCharacter + nextCharacter === "\r\n") {
index++;
isInsideComment = false;
buffer += strip(jsonString, offset, index);
offset = index;
continue;
} else if (isInsideComment === singleComment && currentCharacter === "\n") {
isInsideComment = false;
buffer += strip(jsonString, offset, index);
offset = index;
} else if (!isInsideComment && currentCharacter + nextCharacter === "/*") {
buffer += jsonString.slice(offset, index);
offset = index;
isInsideComment = multiComment;
index++;
continue;
} else if (isInsideComment === multiComment && currentCharacter + nextCharacter === "*/") {
index++;
isInsideComment = false;
buffer += strip(jsonString, offset, index + 1);
offset = index + 1;
continue;
} else if (trailingCommas && !isInsideComment) {
if (commaIndex !== -1) {
if (currentCharacter === "}" || currentCharacter === "]") {
buffer += jsonString.slice(offset, index);
result += strip(buffer, 0, 1) + buffer.slice(1);
buffer = "";
offset = index;
commaIndex = -1;
} else if (currentCharacter !== " " && currentCharacter !== " " && currentCharacter !== "\r" && currentCharacter !== "\n") {
buffer += jsonString.slice(offset, index);
offset = index;
commaIndex = -1;
}
} else if (currentCharacter === ",") {
result += buffer + jsonString.slice(offset, index);
buffer = "";
offset = index;
commaIndex = index;
}
}
}
return result + buffer + (isInsideComment ? strip(jsonString.slice(offset)) : jsonString.slice(offset));
}
var _tinyglobby = _chunkJG7MZJV2cjs.__require.call(void 0, "tinyglobby");
function getPostcss() {
return localRequire("postcss");
}
function getApiExtractor() {
return localRequire("@microsoft/api-extractor");
}
function localRequire(moduleName) {
const p = _resolvefrom2.default.silent(process.cwd(), moduleName);
return p && __require2(p);
}
async function removeFiles(patterns, dir) {
const files = await _tinyglobby.glob.call(void 0, patterns, {
cwd: dir,
absolute: true
});
files.forEach((file) => _fs2.default.existsSync(file) && _fs2.default.unlinkSync(file));
}
function debouncePromise(fn, delay, onError) {
let timeout;
let promiseInFly;
let callbackPending;
return function debounced(...args) {
if (promiseInFly) {
callbackPending = () => {
debounced(...args);
callbackPending = void 0;
};
} else {
if (timeout != null) clearTimeout(timeout);
timeout = setTimeout(() => {
timeout = void 0;
promiseInFly = fn(...args).catch(onError).finally(() => {
promiseInFly = void 0;
if (callbackPending) callbackPending();
});
}, delay);
}
};
}
function slash(path2) {
const isExtendedLengthPath = path2.startsWith("\\\\?\\");
if (isExtendedLengthPath) {
return path2;
}
return path2.replace(/\\/g, "/");
}
function truthy(value) {
return Boolean(value);
}
function jsoncParse(data) {
try {
return new Function(`return ${stripJsonComments(data).trim()}`)();
} catch (e2) {
return {};
}
}
function defaultOutExtension({
format,
pkgType
}) {
let jsExtension = ".js";
let dtsExtension = ".d.ts";
const isModule = pkgType === "module";
if (isModule && format === "cjs") {
jsExtension = ".cjs";
dtsExtension = ".d.cts";
}
if (!isModule && format === "esm") {
jsExtension = ".mjs";
dtsExtension = ".d.mts";
}
if (format === "iife") {
jsExtension = ".global.js";
}
return {
js: jsExtension,
dts: dtsExtension
};
}
function ensureTempDeclarationDir(options2) {
const cwd = _optionalChain2([options2, 'access', _40 => _40.workspaceConfig, 'optionalAccess', _41 => _41.workspaceRoot]) || process.cwd();
const dirPath = _path2.default.join(cwd, ".tsup", "declaration");
if (_fs2.default.existsSync(dirPath)) {
return dirPath;
}
_fs2.default.mkdirSync(dirPath, { recursive: true });
const gitIgnorePath = _path2.default.join(cwd, ".tsup", ".gitignore");
writeFileSync(gitIgnorePath, "**/*\n");
return dirPath;
}
var toObjectEntry = (entry) => {
if (typeof entry === "string") {
entry = [entry];
}
if (!Array.isArray(entry)) {
return entry;
}
entry = entry.map((e) => e.replace(/\\/g, "/"));
const ancestor = findLowestCommonAncestor(entry);
return entry.reduce(
(result, item) => {
const key = item.replace(ancestor, "").replace(/^\//, "").replace(/\.[a-z]+$/, "");
return {
...result,
[key]: item
};
},
{}
);
};
var findLowestCommonAncestor = (filepaths) => {
if (filepaths.length <= 1) return "";
const [first, ...rest] = filepaths;
let ancestor = first.split("/");
for (const filepath of rest) {
const directories = filepath.split("/", ancestor.length);
let index = 0;
for (const directory of directories) {
if (directory === ancestor[index]) {
index += 1;
} else {
ancestor = ancestor.slice(0, index);
break;
}
}
ancestor = ancestor.slice(0, index);
}
return ancestor.length <= 1 && ancestor[0] === "" ? `/${ancestor[0]}` : ancestor.join("/");
};
function toAbsolutePath(p, cwd) {
if (_path2.default.isAbsolute(p)) {
return p;
}
return slash(_path2.default.normalize(_path2.default.join(cwd || process.cwd(), p)));
}
function writeFileSync(filePath, content) {
_fs2.default.mkdirSync(_path2.default.dirname(filePath), { recursive: true });
_fs2.default.writeFileSync(filePath, content);
}
function replaceDtsWithJsExtensions(dtsFilePath) {
return dtsFilePath.replace(
/\.d\.(ts|mts|cts)$/,
(_, fileExtension) => {
switch (fileExtension) {
case "ts":
return ".js";
case "mts":
return ".mjs";
case "cts":
return ".cjs";
default:
return "";
}
}
);
}
var convertArrayEntriesToObjectEntries = (arrayOfEntries) => {
const objectEntries = Object.fromEntries(
arrayOfEntries.map(
(entry) => [
_path2.default.posix.join(
...entry.split(_path2.default.posix.sep).slice(1, -1).concat(_path2.default.parse(entry).name)
),
entry
]
)
);
return objectEntries;
};
var resolveEntryPaths = async (entryPaths) => {
const resolvedEntryPaths = typeof entryPaths === "string" || Array.isArray(entryPaths) ? convertArrayEntriesToObjectEntries(await _tinyglobby.glob.call(void 0, entryPaths)) : entryPaths;
return resolvedEntryPaths;
};
var resolveExperimentalDtsConfig = async (options2, tsconfig) => {
const resolvedEntryPaths = await resolveEntryPaths(
_optionalChain([options2, "access", (_2) => _2.experimentalDts, "optionalAccess", (_3) => _3.entry]) || options2.entry
);
const experimentalDtsObjectEntry = Object.keys(resolvedEntryPaths).length === 0 ? Array.isArray(options2.entry) ? convertArrayEntriesToObjectEntries(options2.entry) : options2.entry : resolvedEntryPaths;
const normalizedExperimentalDtsConfig = {
compilerOptions: {
...tsconfig.data.compilerOptions || {},
..._optionalChain([options2, "access", (_4) => _4.experimentalDts, "optionalAccess", (_5) => _5.compilerOptions]) || {}
},
entry: experimentalDtsObjectEntry
};
return normalizedExperimentalDtsConfig;
};
var resolveInitialExperimentalDtsConfig = async (experimentalDts) => {
if (experimentalDts == null) {
return;
}
if (typeof experimentalDts === "boolean")
return experimentalDts ? { entry: {} } : void 0;
if (typeof experimentalDts === "string") {
return {
entry: convertArrayEntriesToObjectEntries(await _tinyglobby.glob.call(void 0, experimentalDts))
};
}
return {
...experimentalDts,
entry: _optionalChain([experimentalDts, "optionalAccess", (_6) => _6.entry]) == null ? {} : await resolveEntryPaths(experimentalDts.entry)
};
};
exports.__require = __require2;
exports.__commonJS = __commonJS2;
exports.__toESM = __toESM2;
exports.getPostcss = getPostcss;
exports.getApiExtractor = getApiExtractor;
exports.localRequire = localRequire;
exports.removeFiles = removeFiles;
exports.debouncePromise = debouncePromise;
exports.slash = slash;
exports.truthy = truthy;
exports.jsoncParse = jsoncParse;
exports.defaultOutExtension = defaultOutExtension;
exports.ensureTempDeclarationDir = ensureTempDeclarationDir;
exports.toObjectEntry = toObjectEntry;
exports.toAbsolutePath = toAbsolutePath;
exports.writeFileSync = writeFileSync;
exports.replaceDtsWithJsExtensions = replaceDtsWithJsExtensions;
exports.resolveExperimentalDtsConfig = resolveExperimentalDtsConfig;
exports.resolveInitialExperimentalDtsConfig = resolveInitialExperimentalDtsConfig;
}
});
// ../../node_modules/.pnpm/tsup@8.4.0_patch_hash=751a554d775c3572381af4e7e5fa22eeda6dd6856012fb1cf521d6806eb2dc74__bbfa3b50d88caa605d59198ec617cf63/node_modules/tsup/dist/chunk-VGC3FXLU.js
var require_chunk_VGC3FXLU = _chunkJG7MZJV2cjs.__commonJS.call(void 0, {
"../../node_modules/.pnpm/tsup@8.4.0_patch_hash=751a554d775c3572381af4e7e5fa22eeda6dd6856012fb1cf521d6806eb2dc74__bbfa3b50d88caa605d59198ec617cf63/node_modules/tsup/dist/chunk-VGC3FXLU.js"(exports) {
"use strict";
_chunkJG7MZJV2cjs.init_cjs_shims.call(void 0, );
Object.defineProperty(exports, "__esModule", { value: true });
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function _optionalChain(ops) {
let lastAccessLHS = void 0;
let value = ops[0];
let i = 1;
while (i < ops.length) {
const op = ops[i];
const fn = ops[i + 1];
i += 2;
if ((op === "optionalAccess" || op === "optionalCall") && value == null) {
return void 0;
}
if (op === "access" || op === "optionalAccess") {
lastAccessLHS = value;
value = fn(value);
} else if (op === "call" || op === "optionalCall") {
value = fn((...args) => value.call(lastAccessLHS, ...args));
lastAccessLHS = void 0;
}
}
return value;
}
var _chunkTWFEYLU4js = require_chunk_TWFEYLU4();
var _fs = _chunkJG7MZJV2cjs.__require.call(void 0, "fs");
var _fs2 = _interopRequireDefault(_fs);
var _path = _chunkJG7MZJV2cjs.__require.call(void 0, "path");
var _path2 = _interopRequireDefault(_path);
var _joycon = _chunkJG7MZJV2cjs.__require.call(void 0, "joycon");
var _joycon2 = _interopRequireDefault(_joycon);
var _bundlerequire = _chunkJG7MZJV2cjs.__require.call(void 0, "bundle-require");
var joycon = new (0, _joycon2.default)();
var loadJson = async (filepath, options2) => {
try {
return _chunkTWFEYLU4js.jsoncParse.call(void 0, await _fs2.default.promises.readFile(filepath, "utf8"));
} catch (error) {
if (error instanceof Error) {
throw new Error(
`Failed to parse ${_path2.default.relative(_optionalChain2([options2, 'access', _42 => _42.workspaceConfig, 'optionalAccess', _43 => _43.workspaceRoot]) || process.cwd(), filepath)}: ${error.message}`
);
} else {
throw error;
}
}
};
var jsonLoader = {
test: /\.json$/,
load(filepath) {
return loadJson(filepath);
}
};
joycon.addLoader(jsonLoader);
async function loadTsupConfig(cwd, configFile) {
const configJoycon = new (0, _joycon2.default)();
const configPath = await configJoycon.resolve({
files: configFile ? [configFile] : [
"tsup.config.ts",
"tsup.config.cts",
"tsup.config.mts",
"tsup.config.js",
"tsup.config.cjs",
"tsup.config.mjs",
"tsup.config.json",
"package.json"
],
cwd,
stopDir: _path2.default.parse(cwd).root,
packageKey: "tsup"
});
if (configPath) {
if (configPath.endsWith(".json")) {
let data = await loadJson(configPath);
if (configPath.endsWith("package.json")) {
data = data.tsup;
}
if (data) {
return { path: configPath, data };
}
return {};
}
const config = await _bundlerequire.bundleRequire.call(void 0, {
filepath: configPath
});
return {
path: configPath,
data: config.mod.tsup || config.mod.default || config.mod
};
}
return {};
}
async function loadPkg(cwd, clearCache = false) {
if (clearCache) {
joycon.clearCache();
}
const { data } = await joycon.load(["package.json"], cwd, _path2.default.dirname(cwd));
return data || {};
}
async function getProductionDeps(cwd, clearCache = false) {
const data = await loadPkg(cwd, clearCache);
const deps = Array.from(
/* @__PURE__ */ new Set([
...Object.keys(data.dependencies || {}),
...Object.keys(data.peerDependencies || {})
])
);
return deps;
}
async function getAllDepsHash(cwd) {
const data = await loadPkg(cwd, true);
return JSON.stringify({
...data.dependencies,
...data.peerDependencies,
...data.devDependencies
});
}
var _util = _chunkJG7MZJV2cjs.__require.call(void 0, "util");
var _util2 = _interopRequireDefault(_util);
var _worker_threads = _chunkJG7MZJV2cjs.__require.call(void 0, "worker_threads");
var _picocolors = _chunkJG7MZJV2cjs.__require.call(void 0, "picocolors");
var _picocolors2 = _interopRequireDefault(_picocolors);
var colorize = (type, data, onlyImportant = false) => {
if (onlyImportant && (type === "info" || type === "success")) return data;
const color = type === "info" ? "blue" : type === "error" ? "red" : type === "warn" ? "yellow" : "green";
return _picocolors2.default[color](data);
};
var makeLabel = (name, input, type) => {
return [
name && `${_picocolors2.default.dim("[")}${name.toUpperCase()}${_picocolors2.default.dim("]")}`,
colorize(type, input.toUpperCase())
].filter(Boolean).join(" ");
};
var silent = false;
function setSilent(isSilent) {
silent = !!isSilent;
}
function getSilent() {
return silent;
}
var createLogger = (name) => {
return {
setName(_name) {
name = _name;
},
success(label, ...args) {
return this.log(label, "success", ...args);
},
info(label, ...args) {
return this.log(label, "info", ...args);
},
error(label, ...args) {
return this.log(label, "error", ...args);
},
warn(label, ...args) {
return this.log(label, "warn", ...args);
},
log(label, type, ...data) {
const args = [
makeLabel(name, label, type),
...data.map((item) => colorize(type, item, true))
];
switch (type) {
case "error": {
if (!_worker_threads.isMainThread) {
_optionalChain([_worker_threads.parentPort, "optionalAccess", (_) => _.postMessage, "call", (_2) => _2({
type: "error",
text: _util2.default.format(...args)
})]);
return;
}
return console.error(...args);
}
default:
if (silent) return;
if (!_worker_threads.isMainThread) {
_optionalChain([_worker_threads.parentPort, "optionalAccess", (_3) => _3.postMessage, "call", (_4) => _4({
type: "log",
text: _util2.default.format(...args)
})]);
return;
}
console.log(...args);
}
}
};
};
var prettyBytes = (bytes) => {
if (bytes === 0) return "0 B";
const unit = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
const exp = Math.floor(Math.log(bytes) / Math.log(1024));
return `${(bytes / 1024 ** exp).toFixed(2)} ${unit[exp]}`;
};
var getLengthOfLongestString = (strings) => {
return strings.reduce((max, str) => {
return Math.max(max, str.length);
}, 0);
};
var padRight = (str, maxLength) => {
return str + " ".repeat(maxLength - str.length);
};
var reportSize = (logger, format, files) => {
const filenames = Object.keys(files);
const maxLength = getLengthOfLongestString(filenames) + 1;
for (const name of filenames) {
logger.success(
format,
`${_picocolors2.default.bold(padRight(name, maxLength))}${_picocolors2.default.green(
prettyBytes(files[name])
)}`
);
}
};
exports.loadTsupConfig = loadTsupConfig;
exports.loadPkg = loadPkg;
exports.getProductionDeps = getProductionDeps;
exports.getAllDepsHash = getAllDepsHash;
exports.setSilent = setSilent;
exports.getSilent = getSilent;
exports.createLogger = createLogger;
exports.reportSize = reportSize;
}
});
// ../../node_modules/.pnpm/tsup@8.4.0_patch_hash=751a554d775c3572381af4e7e5fa22eeda6dd6856012fb1cf521d6806eb2dc74__bbfa3b50d88caa605d59198ec617cf63/node_modules/tsup/dist/chunk-JZ25TPTY.js
var require_chunk_JZ25TPTY = _chunkJG7MZJV2cjs.__commonJS.call(void 0, {
"../../node_modules/.pnpm/tsup@8.4.0_patch_hash=751a554d775c3572381af4e7e5fa22eeda6dd6856012fb1cf521d6806eb2dc74__bbfa3b50d88caa605d59198ec617cf63/node_modules/tsup/dist/chunk-JZ25TPTY.js"(exports) {
"use strict";
_chunkJG7MZJV2cjs.init_cjs_shims.call(void 0, );
Object.defineProperty(exports, "__esModule", { value: true });
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
var _worker_threads = _chunkJG7MZJV2cjs.__require.call(void 0, "worker_threads");
var _picocolors = _chunkJG7MZJV2cjs.__require.call(void 0, "picocolors");
var _picocolors2 = _interopRequireDefault(_picocolors);
var PrettyError = class extends Error {
constructor(message) {
super(message);
this.name = this.constructor.name;
if (typeof Error.captureStackTrace === "function") {
Error.captureStackTrace(this, this.constructor);
} else {
this.stack = new Error(message).stack;
}
}
};
function handleError(error) {
if (error.loc) {
console.error(
_picocolors2.default.bold(
_picocolors2.default.red(
`Error parsing: ${error.loc.file}:${error.loc.line}:${error.loc.column}`
)
)
);
}
if (error.frame) {
console.error(_picocolors2.default.red(error.message));
console.error(_picocolors2.default.dim(error.frame));
} else if (error instanceof PrettyError) {
console.error(_picocolors2.default.red(error.message));
} else {
console.error(_picocolors2.default.red(error.stack));
}
process.exitCode = 1;
if (!_worker_threads.isMainThread && _worker_threads.parentPort) {
_worker_threads.parentPort.postMessage("error");
}
}
exports.PrettyError = PrettyError;
exports.handleError = handleError;
}
});
// ../../node_modules/.pnpm/tsup@8.4.0_patch_hash=751a554d775c3572381af4e7e5fa22eeda6dd6856012fb1cf521d6806eb2dc74__bbfa3b50d88caa605d59198ec617cf63/node_modules/tsup/dist/commonjs-plugin.js
var require_commonjs_plugin = _chunkJG7MZJV2cjs.__commonJS.call(void 0, {
"../../node_modules/.pnpm/tsup@8.4.0_patch_hash=751a554d775c3572381af4e7e5fa22eeda6dd6856012fb1cf521d6806eb2dc74__bbfa3b50d88caa605d59198ec617cf63/node_modules/tsup/dist/commonjs-plugin.js"(exports, module) {
"use strict";
_chunkJG7MZJV2cjs.init_cjs_shims.call(void 0, );
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var index_exports = {};
__export(index_exports, {
commonjs: () => commonjs,
default: () => index_default
});
module.exports = __toCommonJS(index_exports);
var import_fs = _chunkJG7MZJV2cjs.__require.call(void 0, "fs");
function isNewLine(code) {
return code === 10 || code === 13 || code === 8232 || code === 8233;
}
function codePointToString(ch) {
if (ch <= 65535) return String.fromCharCode(ch);
ch -= 65536;
return String.fromCharCode((ch >> 10) + 55296, (ch & 1023) + 56320);
}
var Lexer = (_class2 = class {constructor() { _class2.prototype.__init2.call(this);_class2.prototype.__init3.call(this); }
__init2() {this.input = ""}
__init3() {this.pos = 0}
readString(input, pos) {
if (pos >= input.length) return null;
this.input = input;
this.pos = pos;
const quote = this.input.charCodeAt(pos);
if (!(quote === 34 || quote === 39)) return null;
let out = "";
let chunkStart = ++this.pos;
while (true) {
if (this.pos >= this.input.length) return null;
let ch = this.input.charCodeAt(this.pos);
if (ch === quote) break;
if (ch === 92) {
out += this.input.slice(chunkStart, this.pos);
const escaped = this.readEscapedChar();
if (escaped === null) return null;
out += escaped;
chunkStart = this.pos;
} else {
if (isNewLine(ch)) return null;
++this.pos;
}
}
out += this.input.slice(chunkStart, this.pos++);
return out;
}
readEscapedChar() {
let ch = this.input.charCodeAt(++this.pos);
let code;
++this.pos;
switch (ch) {
case 110:
return "\n";
case 114:
return "\r";
case 120:
code = this.readHexChar(2);
if (code === null) return null;
return String.fromCharCode(code);
case 117:
code = this.readCodePoint();
if (code === null) return null;
return codePointToString(code);
case 116:
return " ";
case 98:
return "\b";
case 118:
return "\v";
case 102:
return "\f";
case 13:
if (this.input.charCodeAt(this.pos) === 10) {
++this.pos;
}
case 10:
return "";
case 56:
case 57:
return null;
default:
if (ch >= 48 && ch <= 55) {
let match = this.input.slice(this.pos - 1, this.pos + 2).match(/^[0-7]+/);
if (match === null) return null;
let octalStr = match[0];
let octal = parseInt(octalStr, 8);
if (octal > 255) {
octalStr = octalStr.slice(0, -1);
octal = parseInt(octalStr, 8);
}
this.pos += octalStr.length - 1;
ch = this.input.charCodeAt(this.pos);
if (octalStr !== "0" || ch === 56 || ch === 57) return null;
return String.fromCharCode(octal);
}
if (isNewLine(ch)) return "";
return String.fromCharCode(ch);
}
}
readInt(radix, len) {
let start = this.pos;
let total = 0;
for (let i = 0; i < len; ++i, ++this.pos) {
let code = this.input.charCodeAt(this.pos);
let val;
if (code >= 97) {
val = code - 97 + 10;
} else if (code >= 65) {
val = code - 65 + 10;
} else if (code >= 48 && code <= 57) {
val = code - 48;
} else {
val = Infinity;
}
if (val >= radix) break;
total = total * radix + val;
}
if (this.pos === start || len != null && this.pos - start !== len) return null;
return total;
}
readHexChar(len) {
return this.readInt(16, len);
}
readCodePoint() {
let ch = this.input.charCodeAt(this.pos);
let code;
if (ch === 123) {
++this.pos;
code = this.readHexChar(this.input.indexOf("}", this.pos) - this.pos);
++this.pos;
if (code && code > 1114111) return null;
} else {
code = this.readHexChar(4);
}
return code;
}
}, _class2);
function orderedUniq(array) {
let ret = [], visited = /* @__PURE__ */ new Set();
for (let val of array) if (!visited.has(val)) visited.add(val), ret.push(val);
return ret;
}
function cachedReduce(array, reducer, s) {
let cache = [s], cacheLen = 1, last = s;
return (len) => {
while (cacheLen <= len) cacheLen = cache.push(last = reducer(last, array[cacheLen - 1]));
return cache[len];
};
}
var reservedWords = "break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public";
var builtin = "arguments Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl";
var forbiddenIdentifiers = new Set(`${reservedWords} ${builtin}`.split(" "));
forbiddenIdentifiers.add("");
var makeLegalIdentifier = function makeLegalIdentifier2(str) {
let identifier = str.replace(/-(\w)/g, (_, letter) => letter.toUpperCase()).replace(/[^$_a-zA-Z0-9]/g, "_");
if (/\d/.test(identifier[0]) || forbiddenIdentifiers.has(identifier)) {
identifier = `_${identifier}`;
}
return identifier || "_";
};
function prepend(code, prefix) {
if (code.startsWith("#!")) {
const i = code.indexOf("\n") + 1;
return code.slice(0, i) + prefix + code.slice(i);
}
return prefix + code;
}
function commonjs({
filter = /\.c?js$/,
transform = false,
transformConfig,
requireReturnsDefault = false,
ignore
} = {}) {
const init_cjs_module_lexer = transform ? Promise.resolve().then(() => _interopRequireWildcard2(require("cjs-module-lexer"))) : void 0;
const use_default_export = typeof requireReturnsDefault === "function" ? requireReturnsDefault : (_path) => requireReturnsDefault;
const is_ignored = typeof ignore === "function" ? ignore : Array.isArray(ignore) ? (path) => ignore.includes(path) : () => false;
return {
name: "commonjs",
setup({ onLoad, esbuild }) {
let esbuild_shim;
const require_esbuild = () => esbuild || (esbuild_shim || (esbuild_shim = _chunkJG7MZJV2cjs.__require.call(void 0, "esbuild")));
const read = import_fs.promises.readFile;
const lexer = new Lexer();
onLoad({ filter }, async (args) => {
let parseCJS;
if (init_cjs_module_lexer) {
const { init, parse } = await init_cjs_module_lexer;
await init();
parseCJS = parse;
}
let contents;
try {
contents = await read(args.path, "utf8");
} catch (e3) {
return null;
}
const willTransform = transform === true || typeof transform === "function" && transform(args.path);
let cjsExports;
if (parseCJS && willTransform) {
let sourcemapIndex = contents.lastIndexOf("//# sourceMappingURL=");
let sourcemap;
if (sourcemapIndex !== -1) {
sourcemap = contents.slice(sourcemapIndex);
let sourcemapEnd = sourcemap.indexOf("\n");
if (sourcemapEnd !== -1 && sourcemap.slice(sourcemapEnd + 1).trimStart().length > 0) {
sourcemap = void 0;
} else {
contents = contents.slice(0, sourcemapIndex);
}
}
cjsExports = parseCJS(contents);
let { behavior, exports: exports2, sideEffects } = typeof willTransform === "object" ? willTransform : {};
_nullishCoalesce2(behavior, () => ( (behavior = _nullishCoalesce2((transformConfig == null ? void 0 : transformConfig.behavior), () => ( "node")))));
exports2 = orderedUniq(cjsExports.exports.concat(_nullishCoalesce2(exports2, () => ( []))));
_nullishCoalesce2(sideEffects, () => ( (sideEffects = _nullishCoalesce2((transformConfig == null ? void 0 : transformConfig.sideEffects), () => ( true)))));
let exportDefault = behavior === "node" ? "export default exports;" : "export default exports.__esModule ? exports.default : exports;";
let exportsMap = exports2.map((e) => [e, makeLegalIdentifier(e)]);
if (exportsMap.some(([e]) => e === "default")) {
if (behavior === "node") {
exportsMap = exportsMap.filter(([e]) => e !== "default");
} else {
exportDefault = "";
}
}
let reexports = cjsExports.reexports.map((e) => `export * from ${JSON.stringify(e)};`).join("");
let transformed;
if (sideEffects === false) {
transformed = [
// make sure we don't manipulate the first line so that sourcemap is fine
reexports + "var mod, exports = /* @__PURE__ */ ((exports, module) => {" + contents,
"return module.exports})((mod = { exports: {} }).exports, mod); " + exportDefault
];
if (exportsMap.length > 0) {
for (const [e, name] of exportsMap) {
transformed.push(`var ${name} = /* @__PURE__ */ (() => exports[${JSON.stringify(e)}])();`);
}
transformed.push(
`export { ${exportsMap.map(([e, name]) => e === name ? e : `${name} as ${JSON.stringify(e)}`).join(", ")} };`
);
}
} else {
transformed = [
reexports + "var exports = {}, module = { exports }; {" + contents,
"}; exports = module.exports; " + exportDefault
];
if (exportsMap.length > 0) {
transformed.push(
`var { ${exportsMap.map(([e, name]) => e === name ? e : `${JSON.stringify(e)}: ${name}`).join(", ")} } = exports;`,
`export { ${exportsMap.map(([e, name]) => e === name ? e : `${name} as ${JSON.stringify(e)}`).join(", ")} };`
);
}
}
contents = transformed.join("\n") + (sourcemap ? "\n" + sourcemap : "");
}
function makeName(path) {
let name = `__import_${makeLegalIdentifier(path)}`;
if (contents.includes(name)) {
let suffix = 2;
while (contents.includes(`${name}${suffix}`)) suffix++;
name = `${name}${suffix}`;
}
return name;
}
let warnings;
try {
({ warnings } = await require_esbuild().transform(contents, { format: "esm", logLevel: "silent" }));
} catch (err) {
({ warnings } = err);
}
let lines = contents.split("\n");
let getOffset = cachedReduce(lines, (a, b) => a + 1 + b.length, 0);
if (warnings && (warnings = warnings.filter((e) => e.text.includes('"require" to "esm"'))).length) {
let edits = [];
let imports = [];
for (const { location } of warnings) {
if (location === null) continue;
const { line, lineText, column, length } = location;
const leftBrace = column + length + 1;
const path = lexer.readString(lineText, leftBrace);
if (path === null || is_ignored(path)) continue;
const rightBrace = lineText.indexOf(")", leftBrace + 2 + path.length) + 1;
let name = makeName(path);
let import_statement;
if (use_default_export(path)) {
import_statement = `import ${name} from ${JSON.stringify(path)};`;
} else {
import_statement = `import * as ${name} from ${JSON.stringify(path)};`;
}
let offset2 = getOffset(line - 1);
edits.push([offset2 + column, offset2 + rightBrace, name]);
imports.push(import_statement);
}
if (imports.length === 0) return null;
imports = orderedUniq(imports);
let offset = 0;
for (const [start, end, name] of edits) {
contents = contents.slice(0, start + offset) + name + contents.slice(end + offset);
offset += name.length - (end - start);
}
contents = prepend(contents, [...imports, cjsExports ? "exports;" : ""].join(""));
return { contents };
}
});
}
};
}
var index_default = commonjs;
}
});
// ../../node_modules/.pnpm/tsup@8.4.0_patch_hash=751a554d775c3572381af4e7e5fa22eeda6dd6856012fb1cf521d6806eb2dc74__bbfa3b50d88caa605d59198ec617cf63/node_modules/tsup/dist/index.js
var require_dist = _chunkJG7MZJV2cjs.__commonJS.call(void 0, {
"../../node_modules/.pnpm/tsup@8.4.0_patch_hash=751a554d775c3572381af4e7e5fa22eeda6dd6856012fb1cf521d6806eb2dc74__bbfa3b50d88caa605d59198ec617cf63/node_modules/tsup/dist/index.js"(exports) {
"use strict";
_chunkJG7MZJV2cjs.init_cjs_shims.call(void 0, );
Object.defineProperty(exports, "__esModule", { value: true });
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
} else {
var newObj = {};
if (obj != null) {
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
return newObj;
}
}
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function _nullishCoalesce(lhs, rhsFn) {
if (lhs != null) {
return lhs;
} else {
return rhsFn();
}
}
function _optionalChain(ops) {
let lastAccessLHS = void 0;
let value = ops[0];
let i = 1;
while (i < ops.length) {
const op = ops[i];
const fn = ops[i + 1];
i += 2;
if ((op === "optionalAccess" || op === "optionalCall") && value == null) {
return void 0;
}
if (op === "access" || op === "optionalAccess") {
lastAccessLHS = value;
value = fn(value);
} else if (op === "call" || op === "optionalCall") {
value = fn((...args) => value.call(lastAccessLHS, ...args));
lastAccessLHS = void 0;
}
}
return value;
}
var _class;
var _chunkBYH4XDRHjs = require_chunk_BYH4XDRH();
var _chunkVGC3FXLUjs = require_chunk_VGC3FXLU();
var _chunkJZ25TPTYjs = require_chunk_JZ25TPTY();
var _chunkTWFEYLU4js = require_chunk_TWFEYLU4();
var _commonjsPluginjs = require_commonjs_plugin();
var _path = _chunkJG7MZJV2cjs.__require.call(void 0, "path");
var _path2 = _interopRequireDefault(_path);
var _fs = _chunkJG7MZJV2cjs.__require.call(void 0, "fs");
var _fs2 = _interopRequireDefault(_fs);
var _worker_threads = _chunkJG7MZJV2cjs.__require.call(void 0, "worker_threads");
var _bundlerequire = _chunkJG7MZJV2cjs.__require.call(void 0, "bundle-require");
var _tinyexec = _chunkJG7MZJV2cjs.__require.call(void 0, "tinyexec");
var _tinyglobby = _chunkJG7MZJV2cjs.__require.call(void 0, "tinyglobby");
var _treekill = _chunkJG7MZJV2cjs.__require.call(void 0, "tree-kill");
var _treekill2 = _interopRequireDefault(_treekill);
var _esbuild = _chunkJG7MZJV2cjs.__require.call(void 0, "esbuild");
var _consola = _chunkJG7MZJV2cjs.__require.call(void 0, "consola");
var _consola2 = _interopRequireDefault(_consola);
var nodeProtocolPlugin = () => {
const nodeProtocol = "node:";
return {
name: "node-protocol-plugin",
setup({ onResolve }) {
onResolve(
{
filter: /^node:/
},
({ path: path12 }) => ({
path: path12.slice(nodeProtocol.length),
external: true
})
);
}
};
};
var NON_NODE_MODULE_RE = /^[A-Z]:[/\\]|^\.{0,2}\/|^\.{1,2}$/;
var externalPlugin = ({
external,
noExternal,
skipNodeModulesBundle,
tsconfigResolvePaths
}) => {
return {
name: `external`,
setup(build2) {
if (skipNodeModulesBundle) {
const resolvePatterns = _bundlerequire.tsconfigPathsToRegExp.call(
void 0,
tsconfigResolvePaths || {}
);
build2.onResolve({ filter: /.*/ }, (args) => {
if (_bundlerequire.match.call(void 0, args.path, resolvePatterns)) {
return;
}
if (_bundlerequire.match.call(void 0, args.path, noExternal)) {
return;
}
if (_bundlerequire.match.call(void 0, args.path, external)) {
return { external: true };
}
if (!NON_NODE_MODULE_RE.test(args.path)) {
return {
path: args.path,
external: true
};
}
});
} else {
build2.onResolve({ filter: /.*/ }, (args) => {
if (_bundlerequire.match.call(void 0, args.path, noExternal)) {
return;
}
if (_bundlerequire.match.call(void 0, args.path, external)) {
return { external: true };
}
});
}
}
};
};
var postcssPlugin = ({
options: options2,
css,
inject,
cssLoader
}) => {
return {
name: "postcss",
setup(build2) {
let configCache;
const getPostcssConfig = async () => {
const loadConfig = _chunkTWFEYLU4js.__require.call(void 0, "postcss-load-config");
if (configCache) {
return configCache;
}
try {
const result = await loadConfig({}, _optionalChain2([options2, 'access', _44 => _44.workspaceConfig, 'optionalAccess', _45 => _45.workspaceRoot]) || process.cwd());
configCache = result;
return result;
} catch (error) {
if (error.message.includes("No PostCSS Config found in")) {
const result = { plugins: [], options: {} };
return result;
}
throw error;
}
};
build2.onResolve({ filter: /^#style-inject$/ }, () => {
return { path: "#style-inject", namespace: "#style-inject" };
});
build2.onLoad(
{ filter: /^#style-inject$/, namespace: "#style-inject" },
() => {
return {
// Taken from https://github.com/egoist/style-inject/blob/master/src/index.js (MIT)
contents: `
export default function styleInject(css, { insertAt } = {}) {
if (!css || typeof document === 'undefined') return
const head = document.head || document.getElementsByTagName('head')[0]
const style = document.createElement('style')
style.type = 'text/css'
if (insertAt === 'top') {
if (head.firstChild) {
head.insertBefore(style, head.firstChild)
} else {
head.appendChild(style)
}
} else {
head.appendChild(style)
}
if (style.styleSheet) {
style.style