Sign In

rolldown

Package Overview
Dependencies
Maintainers
4
Versions
636
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rolldown - npm Package Compare versions

Comparing version
1.2.0
to
1.2.1
+116
dist/experimental-default-runtime.mjs
// @ts-check
/** @import { DevRuntime } from './runtime-extra-dev-common.js' */
/** @type {typeof DevRuntime} */
// @ts-expect-error -- there's no way to declare a variable by JSDoc
var BaseDevRuntime = DevRuntime;
class ModuleHotContext {
/**
* @type {{ deps: [string], fn: (moduleExports: Record<string, any>[]) => void }[]}
*/
acceptCallbacks = [];
/**
* @param {string} moduleId
* @param {InstanceType<BaseDevRuntime>} devRuntime
*/
constructor(moduleId, devRuntime) {
this.moduleId = moduleId;
this.devRuntime = devRuntime;
}
/**
* @overload
* @param {(mod: Record<string, any>) => void} cb
* @returns {void}
*/
/**
* @param {...any} args
* @returns {void}
*/
accept(...args) {
if (args.length === 1) {
const [cb] = /** @type {[(mod: Record<string, any>) => void]} */ (args);
const acceptingPath = this.moduleId;
this.acceptCallbacks.push({
deps: [acceptingPath],
fn: cb,
});
} else if (args.length === 0) {}
else {
throw new Error('Invalid arguments for `import.meta.hot.accept`');
}
}
invalidate() {
socket.send(JSON.stringify({
type: 'hmr:invalidate',
moduleId: this.moduleId,
}));
}
}
class DefaultDevRuntime extends BaseDevRuntime {
/**
* @type {Map<string, ModuleHotContext>}
*/
moduleHotContexts = new Map();
/**
* @override
* @param {string} moduleId
*/
createModuleHotContext(moduleId) {
const hotContext = new ModuleHotContext(moduleId, this);
this.moduleHotContexts.set(moduleId, hotContext);
return hotContext;
}
}
/** @param {string} url */
function loadScript(url) {
var script = document.createElement('script');
script.src = url;
script.type = 'module';
script.onerror = function() {
console.error('Failed to load script: ' + url);
};
document.body.appendChild(script);
}
console.debug('HMR runtime loaded', '$ADDR');
// Generate client ID immediately at runtime initialization
// This ensures the client ID is available before any lazy imports
const clientId = crypto.randomUUID();
const addr = new URL('ws://$ADDR');
addr.searchParams.set('clientId', clientId);
const socket = new WebSocket(addr);
(/** @type {any} */ (globalThis)).__rolldown_runtime__ ??=
new DefaultDevRuntime(clientId);
/** @param {MessageEvent} event */
socket.onmessage = function(event) {
const data = JSON.parse(event.data);
console.debug('Received message:', data);
if (data.type === 'connected') {
// Server acknowledged the connection
console.debug('[hmr]: Connection established with server');
} else if (data.type === 'hmr:update') {
if (typeof process === 'object') {
import(data.path);
console.debug(`[hmr]: Importing HMR patch: ${data.path}`);
} else {
console.debug(`[hmr]: Loading HMR patch: ${data.path}`);
loadScript(data.url);
}
} else if (data.type === 'hmr:reload') {
console.log('[hmr]: Full reload required, reloading page');
if (typeof location !== 'undefined') {
location.reload();
} else {
console.log('[hmr]: location is undefined, cannot reload page');
}
}
};
export var __create = Object.create;
export var __defProp = Object.defineProperty;
export var __name = (target, value) => __defProp(target, 'name', { value, configurable: true });
export var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
export var __getOwnPropNames = Object.getOwnPropertyNames;
export var __getProtoOf = Object.getPrototypeOf;
export var __hasOwnProp = Object.prototype.hasOwnProperty;
export var __esm = (fn, res, err) =>
function () {
if (err) throw err[0];
try {
return (fn && (res = (0, fn[__getOwnPropNames(fn)[0]])((fn = 0))), res);
} catch (e) {
throw ((err = [e]), e);
}
};
export var __esmMin = (fn, res, err) => () => {
if (err) throw err[0];
try {
return (fn && (res = fn((fn = 0))), res);
} catch (e) {
throw ((err = [e]), e);
}
};
export var __commonJS = (cb, mod) =>
function () {
return (
mod || ((0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), cb = null), mod.exports
);
};
export var __commonJSMin = (cb, mod) => () => (
mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports
);
export var __exportAll = (all, no_symbols) => {
let target = {};
for (var name in all) {
__defProp(target, name, { get: all[name], enumerable: true });
}
if (!no_symbols) {
__defProp(target, Symbol.toStringTag, { value: 'Module' });
}
return target;
};
export var __copyProps = (to, from, except, desc) => {
if ((from && typeof from === 'object') || typeof from === 'function') {
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
key = keys[i];
if (!__hasOwnProp.call(to, key) && key !== except) {
__defProp(to, key, {
get: ((k) => from[k]).bind(null, key),
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable,
});
}
}
}
return to;
};
export var __reExport = (target, mod, secondTarget) => (
__copyProps(target, mod, 'default'), secondTarget && __copyProps(secondTarget, mod, 'default')
);
export var __toESM = (mod, isNodeMode, target) => (
(target = mod != null ? __create(__getProtoOf(mod)) : {}),
__copyProps(
// `__esModule` alone is not enough: the module must own a `default` (#10360).
isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, 'default')
? __defProp(target, 'default', { value: mod, enumerable: true })
: target,
mod,
)
);
export var __toCommonJS = (mod) =>
__hasOwnProp.call(mod, 'module.exports')
? mod['module.exports']
: __copyProps(__defProp({}, '__esModule', { value: true }), mod);
export var __toBinaryNode = (base64) => new Uint8Array(Buffer.from(base64, 'base64'));
export var __toBinary = /* @__PURE__ */ (() => {
var table = new Uint8Array(128);
for (var i = 0; i < 64; i++) {
table[i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i * 4 - 205] = i;
}
return (base64) => {
var n = base64.length,
bytes = new Uint8Array((((n - (base64[n - 1] == '=') - (base64[n - 2] == '=')) * 3) / 4) | 0);
for (var i = 0, j = 0; i < n; ) {
var c0 = table[base64.charCodeAt(i++)],
c1 = table[base64.charCodeAt(i++)];
var c2 = table[base64.charCodeAt(i++)],
c3 = table[base64.charCodeAt(i++)];
bytes[j++] = (c0 << 2) | (c1 >> 4);
bytes[j++] = (c1 << 4) | (c2 >> 2);
bytes[j++] = (c2 << 6) | c3;
}
return bytes;
};
})();
/**
* Compiler-emitted module-graph delta — pure topology (static + dynamic edges).
* `ids[0, localCount)` are the modules this payload carries; `ids[localCount, …)` are foreign edge targets.
* `edges[i]` / `dynamicEdges[i]` are the static / dynamic-`import()` out-edges of `ids[i]`.
* @typedef {{ ids: string[], localCount: number, edges: number[][], dynamicEdges?: number[][] }} ModuleGraphDelta
* @typedef {{ createModuleHotContext(moduleId: string): any, onModuleCacheRemoval(moduleId: string): void }} DevRuntimeHooks
*/
export class MissingFactoryError {
/**
* @param {string} id
*/
constructor(id: string);
id: string;
}
export class DevRuntime {
/**
* @param {string} clientId
*/
constructor(clientId: string);
/**
* Client ID generated at runtime initialization, used for lazy compilation requests.
* @type {string}
*/
clientId: string;
/**
* Static import edges from `registerGraph` — entries persist across `removeModuleCache`
* and change only by replacement from a newer payload (last write wins).
* @type {Map<string, { edges: string[] }>}
*/
staticImports: Map<string, {
edges: string[];
}>;
/**
* Reverse index over the static imports.
* @type {Map<string, Set<string>>}
*/
importers: Map<string, Set<string>>;
/**
* Dynamic `import()` edges from `registerGraph`, keyed by importer — mirror of
* `staticImports` for the dynamic reverse index.
* @type {Map<string, { edges: string[] }>}
*/
dynamicImports: Map<string, {
edges: string[];
}>;
/**
* Reverse index over the dynamic imports.
* @type {Map<string, Set<string>>}
*/
dynamicImporters: Map<string, Set<string>>;
/**
* The module cache. Membership means "this module's side effects ran in this tab" —
* registration is emitted ahead of every module body, and nothing un-registers on
* unwind, so a factory that throws mid-body stays registered. A `Map` rather than a
* plain object: HMR eviction deletes entries, and a `delete` on an object drops V8
* into dictionary mode, taxing every later lookup on the hottest read path.
* @type {Map<string, Module>}
*/
moduleCache: Map<string, Module>;
/**
* Re-runnable factories from HMR patches and lazy chunks. The initial bundle stays
* scope-hoisted and contributes none.
* @type {Map<string, { kind: 'esm' | 'cjs', fn: (id: string) => void }>}
*/
factories: Map<string, {
kind: "esm" | "cjs";
fn: (id: string) => void;
}>;
/**
* Installed by the dev client at boot. The runtime is a store + executor and makes
* no HMR decisions; accepting, disposing, and reloading live behind these hooks.
* @type {DevRuntimeHooks | null}
*/
hooks: DevRuntimeHooks | null;
/**
* @param {ModuleGraphDelta} delta
*/
registerGraph(delta: ModuleGraphDelta): void;
/**
* @param {string} id
* @param {'esm' | 'cjs'} kind
* @param {(id: string) => void} fn
*/
registerFactory(id: string, kind: "esm" | "cjs", fn: (id: string) => void): void;
/**
* @param {string} id
* @param {{ exports: any }} exportsHolder
*/
registerModule(id: string, exportsHolder: {
exports: any;
}): void;
/**
* @param {string} id
* @returns {string[]}
*/
getImporters(id: string): string[];
/**
* @param {string} id
*/
isExecuted(id: string): any;
/**
* @param {string} id
*/
hasFactory(id: string): any;
/**
* Module-cache delete only — static imports and factories persist. Removal is what
* re-arms a cache-gated factory for `initModule`.
* @param {string} id
*/
removeModuleCache(id: string): void;
/**
* The one re-execution gate: registered → return the live exports; otherwise run the
* mapped factory (which registers itself first, then runs the body).
* @param {string} id
*/
initModule(id: string): any;
/**
* @param {string} id
*/
loadExports(id: string): any;
/**
* @param {string} moduleId
*/
createModuleHotContext(moduleId: string): any;
/** @internal */
__toESM: any;
/** @internal */
__toCommonJS: any;
/** @internal */
__exportAll: any;
/**
* @param {boolean} [isNodeMode]
* @returns {(mod: any) => any}
* @internal
*/
__toDynamicImportESM: (isNodeMode?: boolean) => (mod: any) => any;
/** @internal */
__reExport: any;
}
/**
* Compiler-emitted module-graph delta — pure topology (static + dynamic edges).
* `ids[0, localCount)` are the modules this payload carries; `ids[localCount, …)` are foreign edge targets.
* `edges[i]` / `dynamicEdges[i]` are the static / dynamic-`import()` out-edges of `ids[i]`.
*/
export type ModuleGraphDelta = {
ids: string[];
localCount: number;
edges: number[][];
dynamicEdges?: number[][];
};
/**
* Compiler-emitted module-graph delta — pure topology (static + dynamic edges).
* `ids[0, localCount)` are the modules this payload carries; `ids[localCount, …)` are foreign edge targets.
* `edges[i]` / `dynamicEdges[i]` are the static / dynamic-`import()` out-edges of `ids[i]`.
*/
export type DevRuntimeHooks = {
createModuleHotContext(moduleId: string): any;
onModuleCacheRemoval(moduleId: string): void;
};
declare class Module {
/**
* @param {string} id
*/
constructor(id: string);
/**
* @type {{ exports: any }}
*/
exportsHolder: {
exports: any;
};
/**
* @type {string}
*/
id: string;
get exports(): any;
}
export {};
import { __exportAll, __reExport, __toCommonJS, __toESM } from './experimental-runtime-base.mjs';
// @ts-check
class Module {
/**
* @type {{ exports: any }}
*/
exportsHolder = { exports: null };
/**
* @type {string}
*/
id;
/**
* @param {string} id
*/
constructor(id) {
this.id = id;
}
get exports() {
return this.exportsHolder.exports;
}
}
/**
* Compiler-emitted module-graph delta — pure topology (static + dynamic edges).
* `ids[0, localCount)` are the modules this payload carries; `ids[localCount, …)` are foreign edge targets.
* `edges[i]` / `dynamicEdges[i]` are the static / dynamic-`import()` out-edges of `ids[i]`.
* @typedef {{ ids: string[], localCount: number, edges: number[][], dynamicEdges?: number[][] }} ModuleGraphDelta
* @typedef {{ createModuleHotContext(moduleId: string): any, onModuleCacheRemoval(moduleId: string): void }} DevRuntimeHooks
*/
export class MissingFactoryError extends Error {
/**
* @param {string} id
*/
constructor(id) {
super(`No factory registered for module ${id}`);
this.id = id;
}
}
export class DevRuntime {
/**
* Client ID generated at runtime initialization, used for lazy compilation requests.
* @type {string}
*/
clientId;
/**
* @param {string} clientId
*/
constructor(clientId) {
this.clientId = clientId;
}
/**
* Static import edges from `registerGraph` — entries persist across `removeModuleCache`
* and change only by replacement from a newer payload (last write wins).
* @type {Map<string, { edges: string[] }>}
*/
staticImports = new Map();
/**
* Reverse index over the static imports.
* @type {Map<string, Set<string>>}
*/
importers = new Map();
/**
* Dynamic `import()` edges from `registerGraph`, keyed by importer — mirror of
* `staticImports` for the dynamic reverse index.
* @type {Map<string, { edges: string[] }>}
*/
dynamicImports = new Map();
/**
* Reverse index over the dynamic imports.
* @type {Map<string, Set<string>>}
*/
dynamicImporters = new Map();
/**
* The module cache. Membership means "this module's side effects ran in this tab" —
* registration is emitted ahead of every module body, and nothing un-registers on
* unwind, so a factory that throws mid-body stays registered. A `Map` rather than a
* plain object: HMR eviction deletes entries, and a `delete` on an object drops V8
* into dictionary mode, taxing every later lookup on the hottest read path.
* @type {Map<string, Module>}
*/
moduleCache = new Map();
/**
* Re-runnable factories from HMR patches and lazy chunks. The initial bundle stays
* scope-hoisted and contributes none.
* @type {Map<string, { kind: 'esm' | 'cjs', fn: (id: string) => void }>}
*/
factories = new Map();
/**
* Installed by the dev client at boot. The runtime is a store + executor and makes
* no HMR decisions; accepting, disposing, and reloading live behind these hooks.
* @type {DevRuntimeHooks | null}
*/
hooks = null;
/**
* @param {ModuleGraphDelta} delta
*/
registerGraph(delta) {
for (let i = 0; i < delta.localCount; i++) {
const id = delta.ids[i];
const edges = delta.edges[i].map((j) => delta.ids[j]);
for (const target of this.staticImports.get(id)?.edges ?? []) {
this.importers.get(target)?.delete(id);
}
for (const target of edges) {
let importerSet = this.importers.get(target);
if (!importerSet) {
importerSet = new Set();
this.importers.set(target, importerSet);
}
importerSet.add(id);
}
this.staticImports.set(id, { edges });
// Dynamic `import()` edges are maintained in a parallel reverse index with the same
// last-write-wins bookkeeping; `getImporters` unions the two.
const dynamicEdges = (delta.dynamicEdges?.[i] ?? []).map((j) => delta.ids[j]);
for (const target of this.dynamicImports.get(id)?.edges ?? []) {
this.dynamicImporters.get(target)?.delete(id);
}
for (const target of dynamicEdges) {
let importerSet = this.dynamicImporters.get(target);
if (!importerSet) {
importerSet = new Set();
this.dynamicImporters.set(target, importerSet);
}
importerSet.add(id);
}
this.dynamicImports.set(id, { edges: dynamicEdges });
}
}
/**
* @param {string} id
* @param {'esm' | 'cjs'} kind
* @param {(id: string) => void} fn
*/
registerFactory(id, kind, fn) {
this.factories.set(id, { kind, fn });
}
/**
* @param {string} id
* @param {{ exports: any }} exportsHolder
*/
registerModule(id, exportsHolder) {
const module = new Module(id);
module.exportsHolder = exportsHolder;
this.moduleCache.set(id, module);
}
/**
* @param {string} id
* @returns {string[]}
*/
getImporters(id) {
// Static ∪ dynamic importers — the boundary walk treats both kinds the same (parity
// with Vite `node.importers` / webpack `module.parents`). Deduped so a module that
// imports `id` both statically and via `import()` appears once.
const dynamic = this.dynamicImporters.get(id);
if (!dynamic || dynamic.size === 0) {
return [...(this.importers.get(id) ?? [])];
}
return [...new Set([...(this.importers.get(id) ?? []), ...dynamic])];
}
/**
* @param {string} id
*/
isExecuted(id) {
return this.moduleCache.has(id);
}
/**
* @param {string} id
*/
hasFactory(id) {
return this.factories.has(id);
}
/**
* Module-cache delete only — static imports and factories persist. Removal is what
* re-arms a cache-gated factory for `initModule`.
* @param {string} id
*/
removeModuleCache(id) {
this.moduleCache.delete(id);
this.hooks?.onModuleCacheRemoval(id);
}
/**
* The one re-execution gate: registered → return the live exports; otherwise run the
* mapped factory (which registers itself first, then runs the body).
* @param {string} id
*/
initModule(id) {
if (this.moduleCache.has(id)) {
return this.loadExports(id);
}
const factory = this.factories.get(id);
if (!factory) {
throw new MissingFactoryError(id);
}
factory.fn(id);
return this.loadExports(id);
}
/**
* @param {string} id
*/
loadExports(id) {
const module = this.moduleCache.get(id);
if (module) {
return module.exportsHolder.exports;
} else {
console.warn(`Module ${id} not found`);
return {};
}
}
/**
* @param {string} moduleId
*/
createModuleHotContext(moduleId) {
if (this.hooks) {
return this.hooks.createModuleHotContext(moduleId);
}
throw new Error('createModuleHotContext requires installed hooks or an override');
}
/** @internal */
// @ts-expect-error The variable will be injected at build time.
__toESM = __toESM;
/** @internal */
// @ts-expect-error The variable will be injected at build time.
__toCommonJS = __toCommonJS;
/** @internal */
// @ts-expect-error The variable will be injected at build time.
__exportAll = __exportAll;
/**
* @param {boolean} [isNodeMode]
* @returns {(mod: any) => any}
* @internal
*/
// @ts-expect-error The variable will be injected at build time.
__toDynamicImportESM = (isNodeMode) => (mod) => __toESM(mod.default, isNodeMode);
/** @internal */
// @ts-expect-error The variable will be injected at build time.
__reExport = __reExport;
}
import { createRequire } from "node:module";
//#region \0rolldown/runtime.js
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 __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
key = keys[i];
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
get: ((k) => from[k]).bind(null, key),
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
});
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
value: mod,
enumerable: true
}) : target, mod));
var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
//#endregion
//#region src/webcontainer-fallback.cjs
var require_webcontainer_fallback = /* @__PURE__ */ __commonJSMin(((exports, module) => {
const fs = __require("node:fs");
const childProcess = __require("node:child_process");
const version = JSON.parse(fs.readFileSync(__require.resolve("rolldown/package.json"), "utf-8")).version;
const baseDir = `/tmp/rolldown-${version}`;
const bindingEntry = `${baseDir}/node_modules/@rolldown/binding-wasm32-wasi/rolldown-binding.wasi.cjs`;
if (!fs.existsSync(bindingEntry)) {
const bindingPkg = `@rolldown/binding-wasm32-wasi@${version}`;
fs.rmSync(baseDir, {
recursive: true,
force: true
});
fs.mkdirSync(baseDir, { recursive: true });
console.log(`[rolldown] Downloading ${bindingPkg} on WebContainer...`);
childProcess.execFileSync("pnpm", ["i", bindingPkg], {
cwd: baseDir,
stdio: "inherit"
});
}
module.exports = __require(bindingEntry);
}));
//#endregion
//#region src/binding.cjs
var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
const { readFileSync } = __require("fs");
let nativeBinding = null;
const loadErrors = [];
const isMusl = () => {
let musl = false;
if (process.platform === "linux") {
musl = isMuslFromFilesystem();
if (musl === null) musl = isMuslFromReport();
if (musl === null) musl = isMuslFromChildProcess();
}
return musl;
};
const isFileMusl = (f) => f.includes("libc.musl-") || f.includes("ld-musl-");
const isMuslFromFilesystem = () => {
try {
return readFileSync("/usr/bin/ldd", "utf-8").includes("musl");
} catch {
return null;
}
};
const isMuslFromReport = () => {
let report = null;
if (process.report && typeof process.report.getReport === "function") {
process.report.excludeNetwork = true;
report = process.report.getReport();
}
if (!report) return null;
if (report.header && report.header.glibcVersionRuntime) return false;
if (Array.isArray(report.sharedObjects)) {
if (report.sharedObjects.some(isFileMusl)) return true;
}
return false;
};
const isMuslFromChildProcess = () => {
try {
return __require("child_process").execSync("ldd --version", { encoding: "utf8" }).includes("musl");
} catch (e) {
return false;
}
};
function requireNative() {
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) try {
return __require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
} catch (err) {
loadErrors.push(err);
}
else if (process.platform === "android") if (process.arch === "arm64") {
try {
return __require("./rolldown-binding.android-arm64.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-android-arm64");
const bindingPackageVersion = __require("@rolldown/binding-android-arm64/package.json").version;
if (bindingPackageVersion !== "1.2.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else if (process.arch === "arm") {
try {
return __require("./rolldown-binding.android-arm-eabi.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-android-arm-eabi");
const bindingPackageVersion = __require("@rolldown/binding-android-arm-eabi/package.json").version;
if (bindingPackageVersion !== "1.2.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Android ${process.arch}`));
else if (process.platform === "win32") if (process.arch === "x64") if (process.config && process.config.variables && process.config.variables.shlib_suffix === "dll.a" || process.config && process.config.variables && process.config.variables.node_target_type === "shared_library") {
try {
return __require("./rolldown-binding.win32-x64-gnu.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-win32-x64-gnu");
const bindingPackageVersion = __require("@rolldown/binding-win32-x64-gnu/package.json").version;
if (bindingPackageVersion !== "1.2.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else {
try {
return __require("./rolldown-binding.win32-x64-msvc.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-win32-x64-msvc");
const bindingPackageVersion = __require("@rolldown/binding-win32-x64-msvc/package.json").version;
if (bindingPackageVersion !== "1.2.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
}
else if (process.arch === "ia32") {
try {
return __require("./rolldown-binding.win32-ia32-msvc.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-win32-ia32-msvc");
const bindingPackageVersion = __require("@rolldown/binding-win32-ia32-msvc/package.json").version;
if (bindingPackageVersion !== "1.2.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else if (process.arch === "arm64") {
try {
return __require("./rolldown-binding.win32-arm64-msvc.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-win32-arm64-msvc");
const bindingPackageVersion = __require("@rolldown/binding-win32-arm64-msvc/package.json").version;
if (bindingPackageVersion !== "1.2.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Windows: ${process.arch}`));
else if (process.platform === "darwin") {
try {
return __require("./rolldown-binding.darwin-universal.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-darwin-universal");
const bindingPackageVersion = __require("@rolldown/binding-darwin-universal/package.json").version;
if (bindingPackageVersion !== "1.2.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
if (process.arch === "x64") {
try {
return __require("./rolldown-binding.darwin-x64.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-darwin-x64");
const bindingPackageVersion = __require("@rolldown/binding-darwin-x64/package.json").version;
if (bindingPackageVersion !== "1.2.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else if (process.arch === "arm64") {
try {
return __require("./rolldown-binding.darwin-arm64.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-darwin-arm64");
const bindingPackageVersion = __require("@rolldown/binding-darwin-arm64/package.json").version;
if (bindingPackageVersion !== "1.2.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on macOS: ${process.arch}`));
} else if (process.platform === "freebsd") if (process.arch === "x64") {
try {
return __require("./rolldown-binding.freebsd-x64.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-freebsd-x64");
const bindingPackageVersion = __require("@rolldown/binding-freebsd-x64/package.json").version;
if (bindingPackageVersion !== "1.2.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else if (process.arch === "arm64") {
try {
return __require("./rolldown-binding.freebsd-arm64.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-freebsd-arm64");
const bindingPackageVersion = __require("@rolldown/binding-freebsd-arm64/package.json").version;
if (bindingPackageVersion !== "1.2.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on FreeBSD: ${process.arch}`));
else if (process.platform === "linux") if (process.arch === "x64") if (isMusl()) {
try {
return __require("./rolldown-binding.linux-x64-musl.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-linux-x64-musl");
const bindingPackageVersion = __require("@rolldown/binding-linux-x64-musl/package.json").version;
if (bindingPackageVersion !== "1.2.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else {
try {
return __require("../rolldown-binding.linux-x64-gnu.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-linux-x64-gnu");
const bindingPackageVersion = __require("@rolldown/binding-linux-x64-gnu/package.json").version;
if (bindingPackageVersion !== "1.2.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
}
else if (process.arch === "arm64") if (isMusl()) {
try {
return __require("./rolldown-binding.linux-arm64-musl.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-linux-arm64-musl");
const bindingPackageVersion = __require("@rolldown/binding-linux-arm64-musl/package.json").version;
if (bindingPackageVersion !== "1.2.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else {
try {
return __require("./rolldown-binding.linux-arm64-gnu.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-linux-arm64-gnu");
const bindingPackageVersion = __require("@rolldown/binding-linux-arm64-gnu/package.json").version;
if (bindingPackageVersion !== "1.2.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
}
else if (process.arch === "arm") if (isMusl()) {
try {
return __require("./rolldown-binding.linux-arm-musleabihf.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-linux-arm-musleabihf");
const bindingPackageVersion = __require("@rolldown/binding-linux-arm-musleabihf/package.json").version;
if (bindingPackageVersion !== "1.2.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else {
try {
return __require("./rolldown-binding.linux-arm-gnueabihf.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-linux-arm-gnueabihf");
const bindingPackageVersion = __require("@rolldown/binding-linux-arm-gnueabihf/package.json").version;
if (bindingPackageVersion !== "1.2.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
}
else if (process.arch === "loong64") if (isMusl()) {
try {
return __require("./rolldown-binding.linux-loong64-musl.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-linux-loong64-musl");
const bindingPackageVersion = __require("@rolldown/binding-linux-loong64-musl/package.json").version;
if (bindingPackageVersion !== "1.2.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else {
try {
return __require("./rolldown-binding.linux-loong64-gnu.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-linux-loong64-gnu");
const bindingPackageVersion = __require("@rolldown/binding-linux-loong64-gnu/package.json").version;
if (bindingPackageVersion !== "1.2.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
}
else if (process.arch === "riscv64") if (isMusl()) {
try {
return __require("./rolldown-binding.linux-riscv64-musl.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-linux-riscv64-musl");
const bindingPackageVersion = __require("@rolldown/binding-linux-riscv64-musl/package.json").version;
if (bindingPackageVersion !== "1.2.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else {
try {
return __require("./rolldown-binding.linux-riscv64-gnu.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-linux-riscv64-gnu");
const bindingPackageVersion = __require("@rolldown/binding-linux-riscv64-gnu/package.json").version;
if (bindingPackageVersion !== "1.2.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
}
else if (process.arch === "ppc64") {
try {
return __require("./rolldown-binding.linux-ppc64-gnu.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-linux-ppc64-gnu");
const bindingPackageVersion = __require("@rolldown/binding-linux-ppc64-gnu/package.json").version;
if (bindingPackageVersion !== "1.2.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else if (process.arch === "s390x") {
try {
return __require("./rolldown-binding.linux-s390x-gnu.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-linux-s390x-gnu");
const bindingPackageVersion = __require("@rolldown/binding-linux-s390x-gnu/package.json").version;
if (bindingPackageVersion !== "1.2.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Linux: ${process.arch}`));
else if (process.platform === "openharmony") if (process.arch === "arm64") {
try {
return __require("./rolldown-binding.openharmony-arm64.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-openharmony-arm64");
const bindingPackageVersion = __require("@rolldown/binding-openharmony-arm64/package.json").version;
if (bindingPackageVersion !== "1.2.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else if (process.arch === "x64") {
try {
return __require("./rolldown-binding.openharmony-x64.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-openharmony-x64");
const bindingPackageVersion = __require("@rolldown/binding-openharmony-x64/package.json").version;
if (bindingPackageVersion !== "1.2.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else if (process.arch === "arm") {
try {
return __require("./rolldown-binding.openharmony-arm.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-openharmony-arm");
const bindingPackageVersion = __require("@rolldown/binding-openharmony-arm/package.json").version;
if (bindingPackageVersion !== "1.2.1" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`));
else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`));
}
function createLoadErrorChain(errors) {
return errors.reduce((previous, current) => {
let message;
try {
message = current && typeof current.message === "string" ? current.message : String(current);
} catch {
message = "Unknown error";
}
const error = new Error(message);
error.cause = previous;
return error;
}, null);
}
const __napiWasiFlavors = ["wasm32-wasi"];
const __napiWasiFlavor = process.env.NAPI_RS_WASI_FLAVOR;
const __napiWasiFlavorRequested = typeof __napiWasiFlavor === "string" && __napiWasiFlavor.length > 0;
if (__napiWasiFlavorRequested && __napiWasiFlavors.indexOf(__napiWasiFlavor) === -1) throw new Error("Unsupported WASI flavor \"" + __napiWasiFlavor + "\". Available flavors: " + __napiWasiFlavors.join(", "));
const forceWasiError = process.env.NAPI_RS_FORCE_WASI === "error";
const forceWasi = process.env.NAPI_RS_FORCE_WASI === "true" || forceWasiError || __napiWasiFlavorRequested;
if (!forceWasi) nativeBinding = requireNative();
if (!nativeBinding || forceWasi) {
let wasiBinding = null;
let wasiBindingLoaded = false;
const wasiBindingErrors = [];
const __napiWasiResolveCandidate = (specifier, isPackage, localArtifacts) => {
try {
__require.resolve(specifier);
} catch (resolveError) {
if (!resolveError || resolveError.code !== "MODULE_NOT_FOUND") throw resolveError;
if (isPackage) {
try {
__require.resolve(specifier + "/package.json");
} catch (packageError) {
if (packageError && packageError.code === "MODULE_NOT_FOUND") return resolveError;
throw resolveError;
}
throw resolveError;
}
return resolveError;
}
if (localArtifacts) {
let artifactError = null;
for (let i = 0; i < localArtifacts.length; i++) try {
__require.resolve(localArtifacts[i]);
return null;
} catch (resolveError) {
if (!resolveError || resolveError.code !== "MODULE_NOT_FOUND") throw resolveError;
artifactError = resolveError;
}
return artifactError;
}
return null;
};
if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor === "wasm32-wasi")) {
let candidateError = null;
let candidateFailed = false;
try {
candidateError = __napiWasiResolveCandidate("./rolldown-binding.wasi.cjs", false, ["./rolldown-binding.wasm32-wasi.debug.wasm", "./rolldown-binding.wasm32-wasi.wasm"]);
candidateFailed = candidateError !== null;
if (!candidateFailed) {
wasiBinding = __require("../rolldown-binding.wasi.cjs");
nativeBinding = wasiBinding;
wasiBindingLoaded = true;
}
} catch (err) {
candidateError = err;
candidateFailed = true;
}
if (candidateFailed) {
wasiBindingErrors.push(candidateError);
loadErrors.push(candidateError);
}
}
if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor === "wasm32-wasi")) {
let candidateError = null;
let candidateFailed = false;
try {
candidateError = __napiWasiResolveCandidate("@rolldown/binding-wasm32-wasi", true, void 0);
candidateFailed = candidateError !== null;
if (!candidateFailed) {
if (process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
const bindingPackageVersion = __require("@rolldown/binding-wasm32-wasi/package.json").version;
if (bindingPackageVersion !== "1.2.1") throw new Error(`WASI binding package version mismatch, expected 1.2.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
}
wasiBinding = __require("@rolldown/binding-wasm32-wasi");
nativeBinding = wasiBinding;
wasiBindingLoaded = true;
}
} catch (err) {
candidateError = err;
candidateFailed = true;
}
if (candidateFailed) {
wasiBindingErrors.push(candidateError);
loadErrors.push(candidateError);
}
}
if (!wasiBindingLoaded && forceWasi && !forceWasiError && !__napiWasiFlavorRequested) nativeBinding = requireNative();
if ((forceWasiError || __napiWasiFlavorRequested) && !wasiBindingLoaded) {
const error = /* @__PURE__ */ new Error(__napiWasiFlavorRequested ? "WASI binding for flavor \"" + __napiWasiFlavor + "\" not found" : "WASI binding not found and NAPI_RS_FORCE_WASI is set to error");
error.cause = createLoadErrorChain(wasiBindingErrors);
throw error;
}
}
if (!nativeBinding && globalThis.process?.versions?.["webcontainer"]) try {
nativeBinding = require_webcontainer_fallback();
} catch (err) {
loadErrors.push(err);
}
if (!nativeBinding) {
if (loadErrors.length > 0) {
const error = /* @__PURE__ */ new Error("Cannot find native binding. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.");
error.cause = createLoadErrorChain(loadErrors);
throw error;
}
throw new Error(`Failed to load native binding`);
}
module.exports = nativeBinding;
module.exports.LegalCommentsMode = nativeBinding.LegalCommentsMode;
module.exports.minify = nativeBinding.minify;
module.exports.minifySync = nativeBinding.minifySync;
module.exports.Severity = nativeBinding.Severity;
module.exports.ParseResult = nativeBinding.ParseResult;
module.exports.ExportExportNameKind = nativeBinding.ExportExportNameKind;
module.exports.ExportImportNameKind = nativeBinding.ExportImportNameKind;
module.exports.ExportLocalNameKind = nativeBinding.ExportLocalNameKind;
module.exports.ImportNameKind = nativeBinding.ImportNameKind;
module.exports.parse = nativeBinding.parse;
module.exports.parseSync = nativeBinding.parseSync;
module.exports.rawTransferSupported = nativeBinding.rawTransferSupported;
module.exports.ResolverFactory = nativeBinding.ResolverFactory;
module.exports.EnforceExtension = nativeBinding.EnforceExtension;
module.exports.ModuleType = nativeBinding.ModuleType;
module.exports.sync = nativeBinding.sync;
module.exports.HelperMode = nativeBinding.HelperMode;
module.exports.isolatedDeclaration = nativeBinding.isolatedDeclaration;
module.exports.isolatedDeclarationSync = nativeBinding.isolatedDeclarationSync;
module.exports.moduleRunnerTransform = nativeBinding.moduleRunnerTransform;
module.exports.moduleRunnerTransformSync = nativeBinding.moduleRunnerTransformSync;
module.exports.transform = nativeBinding.transform;
module.exports.transformSync = nativeBinding.transformSync;
module.exports.BindingBundleEndEventData = nativeBinding.BindingBundleEndEventData;
module.exports.BindingBundleErrorEventData = nativeBinding.BindingBundleErrorEventData;
module.exports.BindingBundler = nativeBinding.BindingBundler;
module.exports.BindingCallableBuiltinPlugin = nativeBinding.BindingCallableBuiltinPlugin;
module.exports.BindingChunkingContext = nativeBinding.BindingChunkingContext;
module.exports.BindingDecodedMap = nativeBinding.BindingDecodedMap;
module.exports.BindingDevEngine = nativeBinding.BindingDevEngine;
module.exports.BindingLoadPluginContext = nativeBinding.BindingLoadPluginContext;
module.exports.BindingMagicString = nativeBinding.BindingMagicString;
module.exports.BindingModuleInfo = nativeBinding.BindingModuleInfo;
module.exports.BindingNormalizedOptions = nativeBinding.BindingNormalizedOptions;
module.exports.BindingOutputAsset = nativeBinding.BindingOutputAsset;
module.exports.BindingOutputChunk = nativeBinding.BindingOutputChunk;
module.exports.BindingPluginContext = nativeBinding.BindingPluginContext;
module.exports.BindingRenderedChunk = nativeBinding.BindingRenderedChunk;
module.exports.BindingRenderedChunkMeta = nativeBinding.BindingRenderedChunkMeta;
module.exports.BindingRenderedModule = nativeBinding.BindingRenderedModule;
module.exports.BindingSourceMap = nativeBinding.BindingSourceMap;
module.exports.BindingTransformPluginContext = nativeBinding.BindingTransformPluginContext;
module.exports.BindingWatcher = nativeBinding.BindingWatcher;
module.exports.BindingWatcherBundler = nativeBinding.BindingWatcherBundler;
module.exports.BindingWatcherChangeData = nativeBinding.BindingWatcherChangeData;
module.exports.BindingWatcherEvent = nativeBinding.BindingWatcherEvent;
module.exports.ParallelJsPluginRegistry = nativeBinding.ParallelJsPluginRegistry;
module.exports.TraceSubscriberGuard = nativeBinding.TraceSubscriberGuard;
module.exports.TsconfigCache = nativeBinding.TsconfigCache;
module.exports.BindingAttachDebugInfo = nativeBinding.BindingAttachDebugInfo;
module.exports.BindingBuiltinPluginName = nativeBinding.BindingBuiltinPluginName;
module.exports.BindingChunkModuleOrderBy = nativeBinding.BindingChunkModuleOrderBy;
module.exports.BindingErrorStage = nativeBinding.BindingErrorStage;
module.exports.BindingLogLevel = nativeBinding.BindingLogLevel;
module.exports.BindingPluginOrder = nativeBinding.BindingPluginOrder;
module.exports.BindingPropertyReadSideEffects = nativeBinding.BindingPropertyReadSideEffects;
module.exports.BindingPropertyWriteSideEffects = nativeBinding.BindingPropertyWriteSideEffects;
module.exports.BindingRebuildStrategy = nativeBinding.BindingRebuildStrategy;
module.exports.collapseSourcemaps = nativeBinding.collapseSourcemaps;
module.exports.enhancedTransform = nativeBinding.enhancedTransform;
module.exports.enhancedTransformSync = nativeBinding.enhancedTransformSync;
module.exports.FilterTokenKind = nativeBinding.FilterTokenKind;
module.exports.initTraceSubscriber = nativeBinding.initTraceSubscriber;
module.exports.registerPlugins = nativeBinding.registerPlugins;
module.exports.resolveTsconfig = nativeBinding.resolveTsconfig;
module.exports.shutdownAsyncRuntime = nativeBinding.shutdownAsyncRuntime;
module.exports.startAsyncRuntime = nativeBinding.startAsyncRuntime;
}));
//#endregion
export { __toESM as n, require_binding as t };

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

import { C as BindingViteJsonPluginConfig, D as BindingViteReporterPluginConfig, E as BindingViteReactRefreshWrapperPluginConfig, O as BindingViteResolvePluginConfig, S as BindingViteImportGlobPluginConfig, T as BindingViteModulePreloadPolyfillPluginConfig, b as BindingViteBuildImportAnalysisPluginConfig, l as BindingIsolatedDeclarationPluginConfig, s as BindingEsmExternalRequirePluginConfig, x as BindingViteDynamicImportVarsPluginConfig } from "./binding-CVtkJvyl.mjs";
import { Gt as StringOrRegExp, I as BuiltinPlugin } from "./define-config-DSMNXceb.mjs";
//#region src/builtin-plugin/constructors.d.ts
declare function viteModulePreloadPolyfillPlugin(config?: BindingViteModulePreloadPolyfillPluginConfig): BuiltinPlugin;
type DynamicImportVarsPluginConfig = Omit<BindingViteDynamicImportVarsPluginConfig, "include" | "exclude"> & {
include?: StringOrRegExp | StringOrRegExp[];
exclude?: StringOrRegExp | StringOrRegExp[];
};
declare function viteDynamicImportVarsPlugin(config?: DynamicImportVarsPluginConfig): BuiltinPlugin;
declare function viteImportGlobPlugin(config?: BindingViteImportGlobPluginConfig): BuiltinPlugin;
declare function viteReporterPlugin(config: BindingViteReporterPluginConfig): BuiltinPlugin;
declare function viteLoadFallbackPlugin(): BuiltinPlugin;
declare function viteJsonPlugin(config: BindingViteJsonPluginConfig): BuiltinPlugin;
declare function viteBuildImportAnalysisPlugin(config: BindingViteBuildImportAnalysisPluginConfig): BuiltinPlugin;
declare function viteResolvePlugin(config: Omit<BindingViteResolvePluginConfig, "yarnPnp">): BuiltinPlugin;
declare function isolatedDeclarationPlugin(config?: BindingIsolatedDeclarationPluginConfig): BuiltinPlugin;
declare function viteWebWorkerPostPlugin(): BuiltinPlugin;
/**
* A plugin that converts CommonJS require() calls for external dependencies into ESM import statements.
*
* @see https://rolldown.rs/builtin-plugins/esm-external-require
* @category Builtin Plugins
*/
declare function esmExternalRequirePlugin(config?: BindingEsmExternalRequirePluginConfig): BuiltinPlugin;
type ViteReactRefreshWrapperPluginConfig = Omit<BindingViteReactRefreshWrapperPluginConfig, "include" | "exclude"> & {
include?: StringOrRegExp | StringOrRegExp[];
exclude?: StringOrRegExp | StringOrRegExp[];
};
/**
* This plugin should not be used for Rolldown.
*/
declare function oxcRuntimePlugin(): BuiltinPlugin;
declare function viteReactRefreshWrapperPlugin(config: ViteReactRefreshWrapperPluginConfig): BuiltinPlugin;
//#endregion
export { viteDynamicImportVarsPlugin as a, viteLoadFallbackPlugin as c, viteReporterPlugin as d, viteResolvePlugin as f, viteBuildImportAnalysisPlugin as i, viteModulePreloadPolyfillPlugin as l, isolatedDeclarationPlugin as n, viteImportGlobPlugin as o, viteWebWorkerPostPlugin as p, oxcRuntimePlugin as r, viteJsonPlugin as s, esmExternalRequirePlugin as t, viteReactRefreshWrapperPlugin as u };
import { a as makeBuiltinPluginCallable, n as BuiltinPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-BVNGzRe4.mjs";
//#region src/builtin-plugin/constructors.ts
function viteModulePreloadPolyfillPlugin(config) {
return new BuiltinPlugin("builtin:vite-module-preload-polyfill", config);
}
function viteDynamicImportVarsPlugin(config) {
if (config) {
config.include = normalizedStringOrRegex(config.include);
config.exclude = normalizedStringOrRegex(config.exclude);
}
return new BuiltinPlugin("builtin:vite-dynamic-import-vars", config);
}
function viteImportGlobPlugin(config) {
return new BuiltinPlugin("builtin:vite-import-glob", config);
}
function viteReporterPlugin(config) {
return new BuiltinPlugin("builtin:vite-reporter", config);
}
function viteLoadFallbackPlugin() {
return new BuiltinPlugin("builtin:vite-load-fallback");
}
function viteJsonPlugin(config) {
const builtinPlugin = new BuiltinPlugin("builtin:vite-json", config);
return makeBuiltinPluginCallable(builtinPlugin);
}
function viteBuildImportAnalysisPlugin(config) {
return new BuiltinPlugin("builtin:vite-build-import-analysis", config);
}
function viteResolvePlugin(config) {
const builtinPlugin = new BuiltinPlugin("builtin:vite-resolve", {
...config,
yarnPnp: typeof process === "object" && !!process.versions?.pnp
});
return makeBuiltinPluginCallable(builtinPlugin);
}
function isolatedDeclarationPlugin(config) {
return new BuiltinPlugin("builtin:isolated-declaration", config);
}
function viteWebWorkerPostPlugin() {
return new BuiltinPlugin("builtin:vite-web-worker-post");
}
/**
* A plugin that converts CommonJS require() calls for external dependencies into ESM import statements.
*
* @see https://rolldown.rs/builtin-plugins/esm-external-require
* @category Builtin Plugins
*/
function esmExternalRequirePlugin(config) {
const plugin = new BuiltinPlugin("builtin:esm-external-require", config);
plugin.enforce = "pre";
return plugin;
}
/**
* This plugin should not be used for Rolldown.
*/
function oxcRuntimePlugin() {
const builtinPlugin = new BuiltinPlugin("builtin:oxc-runtime");
return makeBuiltinPluginCallable(builtinPlugin);
}
function viteReactRefreshWrapperPlugin(config) {
if (config) {
config.include = normalizedStringOrRegex(config.include);
config.exclude = normalizedStringOrRegex(config.exclude);
}
const builtinPlugin = new BuiltinPlugin("builtin:vite-react-refresh-wrapper", config);
return makeBuiltinPluginCallable(builtinPlugin);
}
//#endregion
export { viteDynamicImportVarsPlugin as a, viteLoadFallbackPlugin as c, viteReporterPlugin as d, viteResolvePlugin as f, viteBuildImportAnalysisPlugin as i, viteModulePreloadPolyfillPlugin as l, isolatedDeclarationPlugin as n, viteImportGlobPlugin as o, viteWebWorkerPostPlugin as p, oxcRuntimePlugin as r, viteJsonPlugin as s, esmExternalRequirePlugin as t, viteReactRefreshWrapperPlugin as u };

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

import { t as require_binding } from "./binding-Cv62mM1i.mjs";
//#region src/types/sourcemap.ts
function bindingifySourcemap(map) {
if (map == null) return;
return { inner: typeof map === "string" ? map : {
file: map.file ?? void 0,
mappings: map.mappings,
sourceRoot: "sourceRoot" in map ? map.sourceRoot ?? void 0 : void 0,
sources: map.sources?.map((s) => s ?? void 0),
sourcesContent: map.sourcesContent?.map((s) => s ?? void 0),
names: map.names,
x_google_ignoreList: map.x_google_ignoreList,
debugId: "debugId" in map ? map.debugId : void 0
} };
}
require_binding();
function unwrapBindingResult(container) {
if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) throw aggregateBindingErrorsIntoJsError(container.errors);
return container;
}
function normalizeBindingResult(container) {
if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) return aggregateBindingErrorsIntoJsError(container.errors);
return container;
}
function normalizeBindingError(e) {
return e.type === "JsError" ? e.field0 : Object.assign(/* @__PURE__ */ new Error(), {
code: e.field0.kind,
kind: e.field0.kind,
message: e.field0.message,
id: e.field0.id,
exporter: e.field0.exporter,
loc: e.field0.loc,
pos: e.field0.pos,
stack: void 0
});
}
function aggregateBindingErrorsIntoJsError(rawErrors) {
const errors = rawErrors.map(normalizeBindingError);
let summary = `Build failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
for (let i = 0; i < errors.length; i++) {
summary += "\n";
if (i >= 5) {
summary += "...";
break;
}
summary += getErrorMessage(errors[i]);
}
const wrapper = new Error(summary);
Object.defineProperty(wrapper, "errors", {
configurable: true,
enumerable: true,
get: () => errors,
set: (value) => Object.defineProperty(wrapper, "errors", {
configurable: true,
enumerable: true,
value
})
});
return wrapper;
}
function getErrorMessage(e) {
if (Object.hasOwn(e, "kind")) return e.message;
let s = "";
if (e.plugin) s += `[plugin ${e.plugin}]`;
const id = e.id ?? e.loc?.file;
if (id) {
s += " " + id;
if (e.loc) s += `:${e.loc.line}:${e.loc.column}`;
}
if (s) s += "\n";
const message = `${e.name ?? "Error"}: ${e.message}`;
s += message;
if (e.frame) s = joinNewLine(s, e.frame);
if (e.stack) s = joinNewLine(s, e.stack.replace(message, ""));
if (e.cause) {
s = joinNewLine(s, "Caused by:");
s = joinNewLine(s, getErrorMessage(e.cause).split("\n").map((line) => " " + line).join("\n"));
}
return s;
}
function joinNewLine(s1, s2) {
return s1.replace(/\n+$/, "") + "\n" + s2.replace(/^\n+/, "");
}
//#endregion
export { bindingifySourcemap as a, unwrapBindingResult as i, normalizeBindingError as n, normalizeBindingResult as r, aggregateBindingErrorsIntoJsError as t };
import { t as rolldown } from "./rolldown-DP_p9pd3.mjs";
import fs from "node:fs";
import path from "node:path";
import { readdir } from "node:fs/promises";
import { pathToFileURL } from "node:url";
import { cwd } from "node:process";
//#region src/utils/load-config.ts
async function bundleTsConfig(configFile, isEsm) {
const dirnameVarName = "injected_original_dirname";
const filenameVarName = "injected_original_filename";
const importMetaUrlVarName = "injected_original_import_meta_url";
const bundle = await rolldown({
input: configFile,
platform: "node",
resolve: { mainFields: ["main"] },
transform: { define: {
__dirname: dirnameVarName,
__filename: filenameVarName,
"import.meta.url": importMetaUrlVarName,
"import.meta.dirname": dirnameVarName,
"import.meta.filename": filenameVarName
} },
treeshake: false,
external: [/^[\w@][^:]/],
plugins: [{
name: "inject-file-scope-variables",
transform: {
filter: { id: /\.[cm]?[jt]s$/ },
async handler(code, id) {
return {
code: `const ${dirnameVarName} = ${JSON.stringify(path.dirname(id))};const ${filenameVarName} = ${JSON.stringify(id)};const ${importMetaUrlVarName} = ${JSON.stringify(pathToFileURL(id).href)};` + code,
map: null
};
}
}
}]
});
const outputDir = path.dirname(configFile);
const fileName = (await bundle.write({
dir: outputDir,
format: isEsm ? "esm" : "cjs",
sourcemap: "inline",
entryFileNames: `rolldown.config.[hash]${path.extname(configFile).replace("ts", "js")}`
})).output.find((chunk) => chunk.type === "chunk" && chunk.isEntry).fileName;
return path.join(outputDir, fileName);
}
const SUPPORTED_JS_CONFIG_FORMATS = [
".js",
".mjs",
".cjs"
];
const SUPPORTED_TS_CONFIG_FORMATS = [
".ts",
".mts",
".cts"
];
const SUPPORTED_CONFIG_FORMATS = [...SUPPORTED_JS_CONFIG_FORMATS, ...SUPPORTED_TS_CONFIG_FORMATS];
const DEFAULT_CONFIG_BASE = "rolldown.config";
async function findConfigFileNameInCwd() {
const filesInWorkingDirectory = new Set(await readdir(cwd()));
for (const extension of SUPPORTED_CONFIG_FORMATS) {
const fileName = `${DEFAULT_CONFIG_BASE}${extension}`;
if (filesInWorkingDirectory.has(fileName)) return fileName;
}
throw new Error("No `rolldown.config` configuration file found.");
}
async function loadTsConfig(configFile) {
const file = await bundleTsConfig(configFile, isFilePathESM(configFile));
try {
return (await import(pathToFileURL(file).href)).default;
} finally {
fs.unlink(file, () => {});
}
}
function isFilePathESM(filePath) {
if (/\.m[jt]s$/.test(filePath)) return true;
else if (/\.c[jt]s$/.test(filePath)) return false;
else {
const pkg = findNearestPackageData(path.dirname(filePath));
if (pkg) return pkg.type === "module";
return false;
}
}
function findNearestPackageData(basedir) {
while (basedir) {
const pkgPath = path.join(basedir, "package.json");
if (tryStatSync(pkgPath)?.isFile()) try {
return JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
} catch {}
const nextBasedir = path.dirname(basedir);
if (nextBasedir === basedir) break;
basedir = nextBasedir;
}
return null;
}
function tryStatSync(file) {
try {
return fs.statSync(file, { throwIfNoEntry: false });
} catch {}
}
async function loadNativeConfig(resolvedPath) {
const url = pathToFileURL(resolvedPath).href;
const { freshImport } = await import("./dist-DKbukT1H.mjs");
const freshImported = freshImport(url);
if (freshImported) {
const { result } = await freshImported;
return result.default;
}
return (await import(url + "?t=" + Date.now())).default;
}
/**
* Load config from a file in a way that Rolldown does.
*
* @param configPath The path to the config file. If empty, it will look for `rolldown.config` with supported extensions in the current working directory.
* @param options Loading options. `configLoader` selects `'bundle'` (default) or `'native'`.
* @returns The loaded config export
*
* @category Config
*/
async function loadConfig(configPath, options = {}) {
const configLoader = options.configLoader ?? "bundle";
const ext = path.extname(configPath = configPath || await findConfigFileNameInCwd());
try {
if (configLoader === "native") return await loadNativeConfig(path.resolve(configPath));
if (SUPPORTED_JS_CONFIG_FORMATS.includes(ext) || process.env.NODE_OPTIONS?.includes("--import=tsx") && SUPPORTED_TS_CONFIG_FORMATS.includes(ext)) return (await import(pathToFileURL(configPath).href)).default;
else if (SUPPORTED_TS_CONFIG_FORMATS.includes(ext)) return await loadTsConfig(path.resolve(configPath));
else throw new Error(`Unsupported config format. Expected: \`${SUPPORTED_CONFIG_FORMATS.join(",")}\` but got \`${ext}\``);
} catch (err) {
if (configLoader === "native") {
const tsHint = SUPPORTED_TS_CONFIG_FORMATS.includes(ext) && !process.features.typescript ? " This runtime does not natively support TypeScript config files." : "";
throw new Error(`Failed to load the config file "${configPath}" using the "native" config loader.${tsHint} Try "--configLoader bundle", or register a loader such as "--import tsx".`, { cause: err });
}
throw new Error("Error happened while loading config.", { cause: err });
}
}
//#endregion
export { loadConfig as t };
//#region src/utils/code-frame.ts
function spaces(index) {
let result = "";
while (index--) result += " ";
return result;
}
function tabsToSpaces(value) {
return value.replace(/^\t+/, (match) => match.split(" ").join(" "));
}
const LINE_TRUNCATE_LENGTH = 120;
const MIN_CHARACTERS_SHOWN_AFTER_LOCATION = 10;
const ELLIPSIS = "...";
function getCodeFrame(source, line, column) {
let lines = source.split("\n");
if (line > lines.length) return "";
const maxLineLength = Math.max(tabsToSpaces(lines[line - 1].slice(0, column)).length + MIN_CHARACTERS_SHOWN_AFTER_LOCATION + 3, LINE_TRUNCATE_LENGTH);
const frameStart = Math.max(0, line - 3);
let frameEnd = Math.min(line + 2, lines.length);
lines = lines.slice(frameStart, frameEnd);
while (!/\S/.test(lines[lines.length - 1])) {
lines.pop();
frameEnd -= 1;
}
const digits = String(frameEnd).length;
return lines.map((sourceLine, index) => {
const isErrorLine = frameStart + index + 1 === line;
let lineNumber = String(index + frameStart + 1);
while (lineNumber.length < digits) lineNumber = ` ${lineNumber}`;
let displayedLine = tabsToSpaces(sourceLine);
if (displayedLine.length > maxLineLength) displayedLine = `${displayedLine.slice(0, maxLineLength - 3)}${ELLIPSIS}`;
if (isErrorLine) {
const indicator = spaces(digits + 2 + tabsToSpaces(sourceLine.slice(0, column)).length) + "^";
return `${lineNumber}: ${displayedLine}\n${indicator}`;
}
return `${lineNumber}: ${displayedLine}`;
}).join("\n");
}
//#endregion
//#region src/log/locate-character/index.js
/** @typedef {import('./types').Location} Location */
/**
* @param {import('./types').Range} range
* @param {number} index
*/
function rangeContains(range, index) {
return range.start <= index && index < range.end;
}
/**
* @param {string} source
* @param {import('./types').Options} [options]
*/
function getLocator(source, options = {}) {
const { offsetLine = 0, offsetColumn = 0 } = options;
let start = 0;
const ranges = source.split("\n").map((line, i) => {
const end = start + line.length + 1;
/** @type {import('./types').Range} */
const range = {
start,
end,
line: i
};
start = end;
return range;
});
let i = 0;
/**
* @param {string | number} search
* @param {number} [index]
* @returns {Location | undefined}
*/
function locator(search, index) {
if (typeof search === "string") search = source.indexOf(search, index ?? 0);
if (search === -1) return void 0;
let range = ranges[i];
const d = search >= range.end ? 1 : -1;
while (range) {
if (rangeContains(range, search)) return {
line: offsetLine + range.line,
column: offsetColumn + search - range.start,
character: search
};
i += d;
range = ranges[i];
}
}
return locator;
}
/**
* @param {string} source
* @param {string | number} search
* @param {import('./types').Options} [options]
* @returns {Location | undefined}
*/
function locate(source, search, options) {
return getLocator(source, options)(search, options && options.startIndex);
}
//#endregion
//#region src/log/logs.ts
const INVALID_LOG_POSITION = "INVALID_LOG_POSITION";
const PLUGIN_ERROR = "PLUGIN_ERROR";
const INPUT_HOOK_IN_OUTPUT_PLUGIN = "INPUT_HOOK_IN_OUTPUT_PLUGIN";
const CYCLE_LOADING = "CYCLE_LOADING";
const MULTIPLE_WATCHER_OPTION = "MULTIPLE_WATCHER_OPTION";
const PARSE_ERROR = "PARSE_ERROR";
const VALIDATION_ERROR = "VALIDATION_ERROR";
function logParseError(message, id, pos) {
return {
code: PARSE_ERROR,
id,
message,
pos
};
}
function logFailedValidation(message) {
return {
code: VALIDATION_ERROR,
message
};
}
function logInvalidLogPosition(pluginName) {
return {
code: INVALID_LOG_POSITION,
message: `Plugin "${pluginName}" tried to add a file position to a log or warning. This is only supported in the "transform" hook at the moment and will be ignored.`
};
}
function logInputHookInOutputPlugin(pluginName, hookName) {
return {
code: INPUT_HOOK_IN_OUTPUT_PLUGIN,
message: `The "${hookName}" hook used by the output plugin ${pluginName} is a build time hook and will not be run for that plugin. Either this plugin cannot be used as an output plugin, or it should have an option to configure it as an output plugin.`
};
}
function logCycleLoading(pluginName, moduleId) {
return {
code: CYCLE_LOADING,
message: `Found the module "${moduleId}" cycle loading at ${pluginName} plugin, it maybe blocking fetching modules.`
};
}
function logMultipleWatcherOption() {
return {
code: MULTIPLE_WATCHER_OPTION,
message: `Found multiple watcher options at watch options, using first one to start watcher.`
};
}
function logPluginError(error, plugin, { hook, id } = {}) {
try {
const code = error.code;
if (!error.pluginCode && code != null && (typeof code !== "string" || !code.startsWith("PLUGIN_"))) error.pluginCode = code;
error.code = PLUGIN_ERROR;
error.plugin = plugin;
if (hook) error.hook = hook;
if (id) error.id = id;
} catch (_) {} finally {
return error;
}
}
function error(base) {
if (!(base instanceof Error)) {
base = Object.assign(new Error(base.message), base);
Object.defineProperty(base, "name", {
value: "RolldownError",
writable: true
});
}
throw base;
}
function augmentCodeLocation(properties, pos, source, id) {
if (typeof pos === "object") {
const { line, column } = pos;
properties.loc = {
column,
file: id,
line
};
} else {
properties.pos = pos;
const location = locate(source, pos, { offsetLine: 1 });
if (!location) return;
const { line, column } = location;
properties.loc = {
column,
file: id,
line
};
}
if (properties.frame === void 0) {
const { line, column } = properties.loc;
properties.frame = getCodeFrame(source, line, column);
}
}
//#endregion
export { logInputHookInOutputPlugin as a, logParseError as c, getCodeFrame as d, logFailedValidation as i, logPluginError as l, error as n, logInvalidLogPosition as o, logCycleLoading as r, logMultipleWatcherOption as s, augmentCodeLocation as t, locate as u };
//#region src/utils/misc.ts
function arraify(value) {
return Array.isArray(value) ? value : [value];
}
function isPromiseLike(value) {
return value && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
}
function unimplemented(info) {
if (info) throw new Error(`unimplemented: ${info}`);
throw new Error("unimplemented");
}
function unreachable(info) {
if (info) throw new Error(`unreachable: ${info}`);
throw new Error("unreachable");
}
function unsupported(info) {
throw new Error(`UNSUPPORTED: ${info}`);
}
function noop(..._args) {}
const ABSOLUTE_PATH_REGEX = /^(?:\/|(?:[A-Za-z]:)?[/\\|])/;
/**
* Whether `name` is a path fragment — an absolute or relative path. Emitted file
* names, `[name]` substitutions and file-name patterns can be neither.
*/
function isPathFragment(name) {
return name[0] === "/" || name[0] === "." && (name[1] === "/" || name[1] === ".") || ABSOLUTE_PATH_REGEX.test(name);
}
//#endregion
export { unimplemented as a, noop as i, isPathFragment as n, unreachable as o, isPromiseLike as r, unsupported as s, arraify as t };
import { n as __toESM, t as require_binding } from "./binding-Cv62mM1i.mjs";
import { l as logPluginError, n as error } from "./logs-DmYCAKcW.mjs";
//#region src/builtin-plugin/utils.ts
var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
var BuiltinPlugin = class {
name;
_options;
/** Vite-specific option to control plugin ordering */
enforce;
constructor(name, _options) {
this.name = name;
this._options = _options;
}
};
function makeBuiltinPluginCallable(plugin) {
let callablePlugin = new import_binding.BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
const wrappedPlugin = plugin;
for (const key in callablePlugin) {
const wrappedHook = async function(...args) {
try {
return await callablePlugin[key](...args);
} catch (e) {
if (e instanceof Error && !e.stack?.includes("at ")) Error.captureStackTrace(e, wrappedPlugin[key]);
return error(logPluginError(e, plugin.name, {
hook: key,
id: key === "transform" ? args[2] : void 0
}));
}
};
const order = callablePlugin.getOrder(key);
if (order == void 0) wrappedPlugin[key] = wrappedHook;
else wrappedPlugin[key] = {
handler: wrappedHook,
order
};
}
return wrappedPlugin;
}
function bindingifyBuiltInPlugin(plugin) {
return {
__name: plugin.name,
options: plugin._options
};
}
function bindingifyManifestPlugin(plugin, pluginContextData) {
const { isOutputOptionsForLegacyChunks, ...options } = plugin._options;
return {
__name: plugin.name,
options: {
...options,
isLegacy: isOutputOptionsForLegacyChunks ? (opts) => {
return isOutputOptionsForLegacyChunks(pluginContextData.getOutputOptions(opts));
} : void 0
}
};
}
//#endregion
//#region src/utils/normalize-string-or-regex.ts
function normalizedStringOrRegex(pattern) {
if (!pattern) return;
if (!isReadonlyArray(pattern)) return [pattern];
return pattern;
}
function isReadonlyArray(input) {
return Array.isArray(input);
}
//#endregion
export { makeBuiltinPluginCallable as a, bindingifyManifestPlugin as i, BuiltinPlugin as n, bindingifyBuiltInPlugin as r, normalizedStringOrRegex as t };
import { n as __toESM, t as require_binding } from "./binding-Cv62mM1i.mjs";
//#region ../../node_modules/.pnpm/oxc-parser@0.142.0/node_modules/oxc-parser/src-js/wrap.js
var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
function wrap(result) {
let program, module, comments, errors;
return {
get program() {
if (!program) program = jsonParseAst(result.program);
return program;
},
get module() {
if (!module) module = result.module;
return module;
},
get comments() {
if (!comments) comments = result.comments;
return comments;
},
get errors() {
if (!errors) errors = result.errors;
return errors;
}
};
}
function jsonParseAst(programJson) {
const { node: program, fixes } = JSON.parse(programJson);
for (const fixPath of fixes) applyFix(program, fixPath);
return program;
}
function applyFix(program, fixPath) {
let node = program;
for (const key of fixPath) node = node[key];
if (node.bigint) node.value = BigInt(node.bigint);
else try {
node.value = RegExp(node.regex.pattern, node.regex.flags);
} catch {}
}
//#endregion
//#region src/utils/parse.ts
/**
* Parse JS/TS source asynchronously on a separate thread.
*
* Note that not all of the workload can happen on a separate thread.
* Parsing on Rust side does happen in a separate thread, but deserialization of the AST to JS objects
* has to happen on current thread. This synchronous deserialization work typically outweighs
* the asynchronous parsing by a factor of between 3 and 20.
*
* i.e. the majority of the workload cannot be parallelized by using this method.
*
* Generally {@linkcode parseSync} is preferable to use as it does not have the overhead of spawning a thread.
* If you need to parallelize parsing multiple files, it is recommended to use worker threads.
*
* @category Utilities
*/
async function parse(filename, sourceText, options) {
return wrap(await (0, import_binding.parse)(filename, sourceText, options));
}
/**
* Parse JS/TS source synchronously on current thread.
*
* This is generally preferable over {@linkcode parse} (async) as it does not have the overhead
* of spawning a thread, and the majority of the workload cannot be parallelized anyway
* (see {@linkcode parse} documentation for details).
*
* If you need to parallelize parsing multiple files, it is recommended to use worker threads
* with {@linkcode parseSync} rather than using {@linkcode parse}.
*
* @category Utilities
*/
function parseSync(filename, sourceText, options) {
return wrap((0, import_binding.parseSync)(filename, sourceText, options));
}
//#endregion
export { parseSync as n, parse as t };
import g$1, { stdin, stdout } from "node:process";
import { WriteStream } from "node:tty";
import f from "node:readline";
//#region ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/chunks/prompt.mjs
function getDefaultExportFromCjs(x) {
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
}
var src;
var hasRequiredSrc;
function requireSrc() {
if (hasRequiredSrc) return src;
hasRequiredSrc = 1;
const ESC = "\x1B";
const CSI = `${ESC}[`;
const beep = "\x07";
const cursor = {
to(x, y) {
if (!y) return `${CSI}${x + 1}G`;
return `${CSI}${y + 1};${x + 1}H`;
},
move(x, y) {
let ret = "";
if (x < 0) ret += `${CSI}${-x}D`;
else if (x > 0) ret += `${CSI}${x}C`;
if (y < 0) ret += `${CSI}${-y}A`;
else if (y > 0) ret += `${CSI}${y}B`;
return ret;
},
up: (count = 1) => `${CSI}${count}A`,
down: (count = 1) => `${CSI}${count}B`,
forward: (count = 1) => `${CSI}${count}C`,
backward: (count = 1) => `${CSI}${count}D`,
nextLine: (count = 1) => `${CSI}E`.repeat(count),
prevLine: (count = 1) => `${CSI}F`.repeat(count),
left: `${CSI}G`,
hide: `${CSI}?25l`,
show: `${CSI}?25h`,
save: `${ESC}7`,
restore: `${ESC}8`
};
src = {
cursor,
scroll: {
up: (count = 1) => `${CSI}S`.repeat(count),
down: (count = 1) => `${CSI}T`.repeat(count)
},
erase: {
screen: `${CSI}2J`,
up: (count = 1) => `${CSI}1J`.repeat(count),
down: (count = 1) => `${CSI}J`.repeat(count),
line: `${CSI}2K`,
lineEnd: `${CSI}K`,
lineStart: `${CSI}1K`,
lines(count) {
let clear = "";
for (let i = 0; i < count; i++) clear += this.line + (i < count - 1 ? cursor.up() : "");
if (count) clear += cursor.left;
return clear;
}
},
beep
};
return src;
}
var srcExports = requireSrc();
var picocolors = { exports: {} };
var hasRequiredPicocolors;
function requirePicocolors() {
if (hasRequiredPicocolors) return picocolors.exports;
hasRequiredPicocolors = 1;
let p = process || {}, argv = p.argv || [], env = p.env || {};
let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
let formatter = (open, close, replace = open) => (input) => {
let string = "" + input, index = string.indexOf(close, open.length);
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
};
let replaceClose = (string, close, replace, index) => {
let result = "", cursor = 0;
do {
result += string.substring(cursor, index) + replace;
cursor = index + close.length;
index = string.indexOf(close, cursor);
} while (~index);
return result + string.substring(cursor);
};
let createColors = (enabled = isColorSupported) => {
let f = enabled ? formatter : () => String;
return {
isColorSupported: enabled,
reset: f("\x1B[0m", "\x1B[0m"),
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
italic: f("\x1B[3m", "\x1B[23m"),
underline: f("\x1B[4m", "\x1B[24m"),
inverse: f("\x1B[7m", "\x1B[27m"),
hidden: f("\x1B[8m", "\x1B[28m"),
strikethrough: f("\x1B[9m", "\x1B[29m"),
black: f("\x1B[30m", "\x1B[39m"),
red: f("\x1B[31m", "\x1B[39m"),
green: f("\x1B[32m", "\x1B[39m"),
yellow: f("\x1B[33m", "\x1B[39m"),
blue: f("\x1B[34m", "\x1B[39m"),
magenta: f("\x1B[35m", "\x1B[39m"),
cyan: f("\x1B[36m", "\x1B[39m"),
white: f("\x1B[37m", "\x1B[39m"),
gray: f("\x1B[90m", "\x1B[39m"),
bgBlack: f("\x1B[40m", "\x1B[49m"),
bgRed: f("\x1B[41m", "\x1B[49m"),
bgGreen: f("\x1B[42m", "\x1B[49m"),
bgYellow: f("\x1B[43m", "\x1B[49m"),
bgBlue: f("\x1B[44m", "\x1B[49m"),
bgMagenta: f("\x1B[45m", "\x1B[49m"),
bgCyan: f("\x1B[46m", "\x1B[49m"),
bgWhite: f("\x1B[47m", "\x1B[49m"),
blackBright: f("\x1B[90m", "\x1B[39m"),
redBright: f("\x1B[91m", "\x1B[39m"),
greenBright: f("\x1B[92m", "\x1B[39m"),
yellowBright: f("\x1B[93m", "\x1B[39m"),
blueBright: f("\x1B[94m", "\x1B[39m"),
magentaBright: f("\x1B[95m", "\x1B[39m"),
cyanBright: f("\x1B[96m", "\x1B[39m"),
whiteBright: f("\x1B[97m", "\x1B[39m"),
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
bgRedBright: f("\x1B[101m", "\x1B[49m"),
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
};
};
picocolors.exports = createColors();
picocolors.exports.createColors = createColors;
return picocolors.exports;
}
const e = /*@__PURE__*/ getDefaultExportFromCjs(/* @__PURE__ */ requirePicocolors());
function J({ onlyFirst: t = false } = {}) {
const F = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
return new RegExp(F, t ? void 0 : "g");
}
const Q = J();
function T$1(t) {
if (typeof t != "string") throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);
return t.replace(Q, "");
}
function O(t) {
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
}
var P$1 = { exports: {} };
(function(t) {
var u = {};
t.exports = u, u.eastAsianWidth = function(e) {
var s = e.charCodeAt(0), i = e.length == 2 ? e.charCodeAt(1) : 0, D = s;
return 55296 <= s && s <= 56319 && 56320 <= i && i <= 57343 && (s &= 1023, i &= 1023, D = s << 10 | i, D += 65536), D == 12288 || 65281 <= D && D <= 65376 || 65504 <= D && D <= 65510 ? "F" : D == 8361 || 65377 <= D && D <= 65470 || 65474 <= D && D <= 65479 || 65482 <= D && D <= 65487 || 65490 <= D && D <= 65495 || 65498 <= D && D <= 65500 || 65512 <= D && D <= 65518 ? "H" : 4352 <= D && D <= 4447 || 4515 <= D && D <= 4519 || 4602 <= D && D <= 4607 || 9001 <= D && D <= 9002 || 11904 <= D && D <= 11929 || 11931 <= D && D <= 12019 || 12032 <= D && D <= 12245 || 12272 <= D && D <= 12283 || 12289 <= D && D <= 12350 || 12353 <= D && D <= 12438 || 12441 <= D && D <= 12543 || 12549 <= D && D <= 12589 || 12593 <= D && D <= 12686 || 12688 <= D && D <= 12730 || 12736 <= D && D <= 12771 || 12784 <= D && D <= 12830 || 12832 <= D && D <= 12871 || 12880 <= D && D <= 13054 || 13056 <= D && D <= 19903 || 19968 <= D && D <= 42124 || 42128 <= D && D <= 42182 || 43360 <= D && D <= 43388 || 44032 <= D && D <= 55203 || 55216 <= D && D <= 55238 || 55243 <= D && D <= 55291 || 63744 <= D && D <= 64255 || 65040 <= D && D <= 65049 || 65072 <= D && D <= 65106 || 65108 <= D && D <= 65126 || 65128 <= D && D <= 65131 || 110592 <= D && D <= 110593 || 127488 <= D && D <= 127490 || 127504 <= D && D <= 127546 || 127552 <= D && D <= 127560 || 127568 <= D && D <= 127569 || 131072 <= D && D <= 194367 || 177984 <= D && D <= 196605 || 196608 <= D && D <= 262141 ? "W" : 32 <= D && D <= 126 || 162 <= D && D <= 163 || 165 <= D && D <= 166 || D == 172 || D == 175 || 10214 <= D && D <= 10221 || 10629 <= D && D <= 10630 ? "Na" : D == 161 || D == 164 || 167 <= D && D <= 168 || D == 170 || 173 <= D && D <= 174 || 176 <= D && D <= 180 || 182 <= D && D <= 186 || 188 <= D && D <= 191 || D == 198 || D == 208 || 215 <= D && D <= 216 || 222 <= D && D <= 225 || D == 230 || 232 <= D && D <= 234 || 236 <= D && D <= 237 || D == 240 || 242 <= D && D <= 243 || 247 <= D && D <= 250 || D == 252 || D == 254 || D == 257 || D == 273 || D == 275 || D == 283 || 294 <= D && D <= 295 || D == 299 || 305 <= D && D <= 307 || D == 312 || 319 <= D && D <= 322 || D == 324 || 328 <= D && D <= 331 || D == 333 || 338 <= D && D <= 339 || 358 <= D && D <= 359 || D == 363 || D == 462 || D == 464 || D == 466 || D == 468 || D == 470 || D == 472 || D == 474 || D == 476 || D == 593 || D == 609 || D == 708 || D == 711 || 713 <= D && D <= 715 || D == 717 || D == 720 || 728 <= D && D <= 731 || D == 733 || D == 735 || 768 <= D && D <= 879 || 913 <= D && D <= 929 || 931 <= D && D <= 937 || 945 <= D && D <= 961 || 963 <= D && D <= 969 || D == 1025 || 1040 <= D && D <= 1103 || D == 1105 || D == 8208 || 8211 <= D && D <= 8214 || 8216 <= D && D <= 8217 || 8220 <= D && D <= 8221 || 8224 <= D && D <= 8226 || 8228 <= D && D <= 8231 || D == 8240 || 8242 <= D && D <= 8243 || D == 8245 || D == 8251 || D == 8254 || D == 8308 || D == 8319 || 8321 <= D && D <= 8324 || D == 8364 || D == 8451 || D == 8453 || D == 8457 || D == 8467 || D == 8470 || 8481 <= D && D <= 8482 || D == 8486 || D == 8491 || 8531 <= D && D <= 8532 || 8539 <= D && D <= 8542 || 8544 <= D && D <= 8555 || 8560 <= D && D <= 8569 || D == 8585 || 8592 <= D && D <= 8601 || 8632 <= D && D <= 8633 || D == 8658 || D == 8660 || D == 8679 || D == 8704 || 8706 <= D && D <= 8707 || 8711 <= D && D <= 8712 || D == 8715 || D == 8719 || D == 8721 || D == 8725 || D == 8730 || 8733 <= D && D <= 8736 || D == 8739 || D == 8741 || 8743 <= D && D <= 8748 || D == 8750 || 8756 <= D && D <= 8759 || 8764 <= D && D <= 8765 || D == 8776 || D == 8780 || D == 8786 || 8800 <= D && D <= 8801 || 8804 <= D && D <= 8807 || 8810 <= D && D <= 8811 || 8814 <= D && D <= 8815 || 8834 <= D && D <= 8835 || 8838 <= D && D <= 8839 || D == 8853 || D == 8857 || D == 8869 || D == 8895 || D == 8978 || 9312 <= D && D <= 9449 || 9451 <= D && D <= 9547 || 9552 <= D && D <= 9587 || 9600 <= D && D <= 9615 || 9618 <= D && D <= 9621 || 9632 <= D && D <= 9633 || 9635 <= D && D <= 9641 || 9650 <= D && D <= 9651 || 9654 <= D && D <= 9655 || 9660 <= D && D <= 9661 || 9664 <= D && D <= 9665 || 9670 <= D && D <= 9672 || D == 9675 || 9678 <= D && D <= 9681 || 9698 <= D && D <= 9701 || D == 9711 || 9733 <= D && D <= 9734 || D == 9737 || 9742 <= D && D <= 9743 || 9748 <= D && D <= 9749 || D == 9756 || D == 9758 || D == 9792 || D == 9794 || 9824 <= D && D <= 9825 || 9827 <= D && D <= 9829 || 9831 <= D && D <= 9834 || 9836 <= D && D <= 9837 || D == 9839 || 9886 <= D && D <= 9887 || 9918 <= D && D <= 9919 || 9924 <= D && D <= 9933 || 9935 <= D && D <= 9953 || D == 9955 || 9960 <= D && D <= 9983 || D == 10045 || D == 10071 || 10102 <= D && D <= 10111 || 11093 <= D && D <= 11097 || 12872 <= D && D <= 12879 || 57344 <= D && D <= 63743 || 65024 <= D && D <= 65039 || D == 65533 || 127232 <= D && D <= 127242 || 127248 <= D && D <= 127277 || 127280 <= D && D <= 127337 || 127344 <= D && D <= 127386 || 917760 <= D && D <= 917999 || 983040 <= D && D <= 1048573 || 1048576 <= D && D <= 1114109 ? "A" : "N";
}, u.characterLength = function(e) {
var s = this.eastAsianWidth(e);
return s == "F" || s == "W" || s == "A" ? 2 : 1;
};
function F(e) {
return e.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
}
u.length = function(e) {
for (var s = F(e), i = 0, D = 0; D < s.length; D++) i = i + this.characterLength(s[D]);
return i;
}, u.slice = function(e, s, i) {
textLen = u.length(e), s = s || 0, i = i || 1, s < 0 && (s = textLen + s), i < 0 && (i = textLen + i);
for (var D = "", C = 0, o = F(e), E = 0; E < o.length; E++) {
var a = o[E], n = u.length(a);
if (C >= s - (n == 2 ? 1 : 0)) if (C + n <= i) D += a;
else break;
C += n;
}
return D;
};
})(P$1);
var X = P$1.exports;
const DD = O(X);
var uD = function() {
return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
};
const FD = O(uD);
function A$1(t, u = {}) {
if (typeof t != "string" || t.length === 0 || (u = {
ambiguousIsNarrow: true,
...u
}, t = T$1(t), t.length === 0)) return 0;
t = t.replace(FD(), " ");
const F = u.ambiguousIsNarrow ? 1 : 2;
let e = 0;
for (const s of t) {
const i = s.codePointAt(0);
if (i <= 31 || i >= 127 && i <= 159 || i >= 768 && i <= 879) continue;
switch (DD.eastAsianWidth(s)) {
case "F":
case "W":
e += 2;
break;
case "A":
e += F;
break;
default: e += 1;
}
}
return e;
}
const m = 10;
const L$1 = (t = 0) => (u) => `\x1B[${u + t}m`;
const N = (t = 0) => (u) => `\x1B[${38 + t};5;${u}m`;
const I = (t = 0) => (u, F, e) => `\x1B[${38 + t};2;${u};${F};${e}m`;
const r = {
modifier: {
reset: [0, 0],
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],
blackBright: [90, 39],
gray: [90, 39],
grey: [90, 39],
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],
bgBlackBright: [100, 49],
bgGray: [100, 49],
bgGrey: [100, 49],
bgRedBright: [101, 49],
bgGreenBright: [102, 49],
bgYellowBright: [103, 49],
bgBlueBright: [104, 49],
bgMagentaBright: [105, 49],
bgCyanBright: [106, 49],
bgWhiteBright: [107, 49]
}
};
Object.keys(r.modifier);
const tD = Object.keys(r.color);
const eD = Object.keys(r.bgColor);
[...tD, ...eD];
function sD() {
const t = /* @__PURE__ */ new Map();
for (const [u, F] of Object.entries(r)) {
for (const [e, s] of Object.entries(F)) r[e] = {
open: `\x1B[${s[0]}m`,
close: `\x1B[${s[1]}m`
}, F[e] = r[e], t.set(s[0], s[1]);
Object.defineProperty(r, u, {
value: F,
enumerable: false
});
}
return Object.defineProperty(r, "codes", {
value: t,
enumerable: false
}), r.color.close = "\x1B[39m", r.bgColor.close = "\x1B[49m", r.color.ansi = L$1(), r.color.ansi256 = N(), r.color.ansi16m = I(), r.bgColor.ansi = L$1(m), r.bgColor.ansi256 = N(m), r.bgColor.ansi16m = I(m), Object.defineProperties(r, {
rgbToAnsi256: {
value: (u, F, e) => u === F && F === e ? u < 8 ? 16 : u > 248 ? 231 : Math.round((u - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(u / 255 * 5) + 6 * Math.round(F / 255 * 5) + Math.round(e / 255 * 5),
enumerable: false
},
hexToRgb: {
value: (u) => {
const F = /[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));
if (!F) return [
0,
0,
0
];
let [e] = F;
e.length === 3 && (e = [...e].map((i) => i + i).join(""));
const s = Number.parseInt(e, 16);
return [
s >> 16 & 255,
s >> 8 & 255,
s & 255
];
},
enumerable: false
},
hexToAnsi256: {
value: (u) => r.rgbToAnsi256(...r.hexToRgb(u)),
enumerable: false
},
ansi256ToAnsi: {
value: (u) => {
if (u < 8) return 30 + u;
if (u < 16) return 90 + (u - 8);
let F, e, s;
if (u >= 232) F = ((u - 232) * 10 + 8) / 255, e = F, s = F;
else {
u -= 16;
const C = u % 36;
F = Math.floor(u / 36) / 5, e = Math.floor(C / 6) / 5, s = C % 6 / 5;
}
const i = Math.max(F, e, s) * 2;
if (i === 0) return 30;
let D = 30 + (Math.round(s) << 2 | Math.round(e) << 1 | Math.round(F));
return i === 2 && (D += 60), D;
},
enumerable: false
},
rgbToAnsi: {
value: (u, F, e) => r.ansi256ToAnsi(r.rgbToAnsi256(u, F, e)),
enumerable: false
},
hexToAnsi: {
value: (u) => r.ansi256ToAnsi(r.hexToAnsi256(u)),
enumerable: false
}
}), r;
}
const iD = sD();
const v = /* @__PURE__ */ new Set(["\x1B", "›"]);
const CD = 39;
const w$1 = "\x07";
const W$1 = "[";
const rD = "]";
const R = "m";
const y = `${rD}8;;`;
const V$1 = (t) => `${v.values().next().value}${W$1}${t}${R}`;
const z = (t) => `${v.values().next().value}${y}${t}${w$1}`;
const ED = (t) => t.split(" ").map((u) => A$1(u));
const _ = (t, u, F) => {
const e = [...u];
let s = false, i = false, D = A$1(T$1(t[t.length - 1]));
for (const [C, o] of e.entries()) {
const E = A$1(o);
if (D + E <= F ? t[t.length - 1] += o : (t.push(o), D = 0), v.has(o) && (s = true, i = e.slice(C + 1).join("").startsWith(y)), s) {
i ? o === w$1 && (s = false, i = false) : o === R && (s = false);
continue;
}
D += E, D === F && C < e.length - 1 && (t.push(""), D = 0);
}
!D && t[t.length - 1].length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
};
const nD = (t) => {
const u = t.split(" ");
let F = u.length;
for (; F > 0 && !(A$1(u[F - 1]) > 0);) F--;
return F === u.length ? t : u.slice(0, F).join(" ") + u.slice(F).join("");
};
const oD = (t, u, F = {}) => {
if (F.trim !== false && t.trim() === "") return "";
let e = "", s, i;
const D = ED(t);
let C = [""];
for (const [E, a] of t.split(" ").entries()) {
F.trim !== false && (C[C.length - 1] = C[C.length - 1].trimStart());
let n = A$1(C[C.length - 1]);
if (E !== 0 && (n >= u && (F.wordWrap === false || F.trim === false) && (C.push(""), n = 0), (n > 0 || F.trim === false) && (C[C.length - 1] += " ", n++)), F.hard && D[E] > u) {
const B = u - n, p = 1 + Math.floor((D[E] - B - 1) / u);
Math.floor((D[E] - 1) / u) < p && C.push(""), _(C, a, u);
continue;
}
if (n + D[E] > u && n > 0 && D[E] > 0) {
if (F.wordWrap === false && n < u) {
_(C, a, u);
continue;
}
C.push("");
}
if (n + D[E] > u && F.wordWrap === false) {
_(C, a, u);
continue;
}
C[C.length - 1] += a;
}
F.trim !== false && (C = C.map((E) => nD(E)));
const o = [...C.join(`
`)];
for (const [E, a] of o.entries()) {
if (e += a, v.has(a)) {
const { groups: B } = new RegExp(`(?:\\${W$1}(?<code>\\d+)m|\\${y}(?<uri>.*)${w$1})`).exec(o.slice(E).join("")) || { groups: {} };
if (B.code !== void 0) {
const p = Number.parseFloat(B.code);
s = p === CD ? void 0 : p;
} else B.uri !== void 0 && (i = B.uri.length === 0 ? void 0 : B.uri);
}
const n = iD.codes.get(Number(s));
o[E + 1] === `
` ? (i && (e += z("")), s && n && (e += V$1(n))) : a === `
` && (s && n && (e += V$1(s)), i && (e += z(i)));
}
return e;
};
function G(t, u, F) {
return String(t).normalize().replace(/\r\n/g, `
`).split(`
`).map((e) => oD(e, u, F)).join(`
`);
}
const c = {
actions: /* @__PURE__ */ new Set([
"up",
"down",
"left",
"right",
"space",
"enter",
"cancel"
]),
aliases: /* @__PURE__ */ new Map([
["k", "up"],
["j", "down"],
["h", "left"],
["l", "right"],
["", "cancel"],
["escape", "cancel"]
])
};
function k$1(t, u) {
if (typeof t == "string") return c.aliases.get(t) === u;
for (const F of t) if (F !== void 0 && k$1(F, u)) return true;
return false;
}
function lD(t, u) {
if (t === u) return;
const F = t.split(`
`), e = u.split(`
`), s = [];
for (let i = 0; i < Math.max(F.length, e.length); i++) F[i] !== e[i] && s.push(i);
return s;
}
globalThis.process.platform.startsWith("win");
const S = Symbol("clack:cancel");
function d$1(t, u) {
const F = t;
F.isTTY && F.setRawMode(u);
}
var AD = Object.defineProperty;
var pD = (t, u, F) => u in t ? AD(t, u, {
enumerable: true,
configurable: true,
writable: true,
value: F
}) : t[u] = F;
var h = (t, u, F) => (pD(t, typeof u != "symbol" ? u + "" : u, F), F);
var x = class {
constructor(u, F = true) {
h(this, "input"), h(this, "output"), h(this, "_abortSignal"), h(this, "rl"), h(this, "opts"), h(this, "_render"), h(this, "_track", false), h(this, "_prevFrame", ""), h(this, "_subscribers", /* @__PURE__ */ new Map()), h(this, "_cursor", 0), h(this, "state", "initial"), h(this, "error", ""), h(this, "value");
const { input: e = stdin, output: s = stdout, render: i, signal: D, ...C } = u;
this.opts = C, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = i.bind(this), this._track = F, this._abortSignal = D, this.input = e, this.output = s;
}
unsubscribe() {
this._subscribers.clear();
}
setSubscriber(u, F) {
const e = this._subscribers.get(u) ?? [];
e.push(F), this._subscribers.set(u, e);
}
on(u, F) {
this.setSubscriber(u, { cb: F });
}
once(u, F) {
this.setSubscriber(u, {
cb: F,
once: true
});
}
emit(u, ...F) {
const e = this._subscribers.get(u) ?? [], s = [];
for (const i of e) i.cb(...F), i.once && s.push(() => e.splice(e.indexOf(i), 1));
for (const i of s) i();
}
prompt() {
return new Promise((u, F) => {
if (this._abortSignal) {
if (this._abortSignal.aborted) return this.state = "cancel", this.close(), u(S);
this._abortSignal.addEventListener("abort", () => {
this.state = "cancel", this.close();
}, { once: true });
}
const e = new WriteStream(0);
e._write = (s, i, D) => {
this._track && (this.value = this.rl?.line.replace(/\t/g, ""), this._cursor = this.rl?.cursor ?? 0, this.emit("value", this.value)), D();
}, this.input.pipe(e), this.rl = f.createInterface({
input: this.input,
output: e,
tabSize: 2,
prompt: "",
escapeCodeTimeout: 50
}), f.emitKeypressEvents(this.input, this.rl), this.rl.prompt(), this.opts.initialValue !== void 0 && this._track && this.rl.write(this.opts.initialValue), this.input.on("keypress", this.onKeypress), d$1(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
this.output.write(srcExports.cursor.show), this.output.off("resize", this.render), d$1(this.input, false), u(this.value);
}), this.once("cancel", () => {
this.output.write(srcExports.cursor.show), this.output.off("resize", this.render), d$1(this.input, false), u(S);
});
});
}
onKeypress(u, F) {
if (this.state === "error" && (this.state = "active"), F?.name && (!this._track && c.aliases.has(F.name) && this.emit("cursor", c.aliases.get(F.name)), c.actions.has(F.name) && this.emit("cursor", F.name)), u && (u.toLowerCase() === "y" || u.toLowerCase() === "n") && this.emit("confirm", u.toLowerCase() === "y"), u === " " && this.opts.placeholder && (this.value || (this.rl?.write(this.opts.placeholder), this.emit("value", this.opts.placeholder))), u && this.emit("key", u.toLowerCase()), F?.name === "return") {
if (this.opts.validate) {
const e = this.opts.validate(this.value);
e && (this.error = e instanceof Error ? e.message : e, this.state = "error", this.rl?.write(this.value));
}
this.state !== "error" && (this.state = "submit");
}
k$1([
u,
F?.name,
F?.sequence
], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
}
close() {
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
`), d$1(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
}
restoreCursor() {
const u = G(this._prevFrame, process.stdout.columns, { hard: true }).split(`
`).length - 1;
this.output.write(srcExports.cursor.move(-999, u * -1));
}
render() {
const u = G(this._render(this) ?? "", process.stdout.columns, { hard: true });
if (u !== this._prevFrame) {
if (this.state === "initial") this.output.write(srcExports.cursor.hide);
else {
const F = lD(this._prevFrame, u);
if (this.restoreCursor(), F && F?.length === 1) {
const e = F[0];
this.output.write(srcExports.cursor.move(0, e)), this.output.write(srcExports.erase.lines(1));
const s = u.split(`
`);
this.output.write(s[e]), this._prevFrame = u, this.output.write(srcExports.cursor.move(0, s.length - e - 1));
return;
}
if (F && F?.length > 1) {
const e = F[0];
this.output.write(srcExports.cursor.move(0, e)), this.output.write(srcExports.erase.down());
const s = u.split(`
`).slice(e);
this.output.write(s.join(`
`)), this._prevFrame = u;
return;
}
this.output.write(srcExports.erase.down());
}
this.output.write(u), this.state === "initial" && (this.state = "active"), this._prevFrame = u;
}
}
};
var fD = class extends x {
get cursor() {
return this.value ? 0 : 1;
}
get _value() {
return this.cursor === 0;
}
constructor(u) {
super(u, false), this.value = !!u.initialValue, this.on("value", () => {
this.value = this._value;
}), this.on("confirm", (F) => {
this.output.write(srcExports.cursor.move(0, -1)), this.value = F, this.state = "submit", this.close();
}), this.on("cursor", () => {
this.value = !this.value;
});
}
};
var bD = Object.defineProperty;
var mD = (t, u, F) => u in t ? bD(t, u, {
enumerable: true,
configurable: true,
writable: true,
value: F
}) : t[u] = F;
var Y = (t, u, F) => (mD(t, typeof u != "symbol" ? u + "" : u, F), F);
let wD = class extends x {
constructor(u) {
super(u, false), Y(this, "options"), Y(this, "cursor", 0), this.options = u.options, this.value = [...u.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: F }) => F === u.cursorAt), 0), this.on("key", (F) => {
F === "a" && this.toggleAll();
}), this.on("cursor", (F) => {
switch (F) {
case "left":
case "up":
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
break;
case "down":
case "right":
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
break;
case "space": this.toggleValue();
}
});
}
get _value() {
return this.options[this.cursor].value;
}
toggleAll() {
const u = this.value.length === this.options.length;
this.value = u ? [] : this.options.map((F) => F.value);
}
toggleValue() {
const u = this.value.includes(this._value);
this.value = u ? this.value.filter((F) => F !== this._value) : [...this.value, this._value];
}
};
var SD = Object.defineProperty;
var $D = (t, u, F) => u in t ? SD(t, u, {
enumerable: true,
configurable: true,
writable: true,
value: F
}) : t[u] = F;
var q = (t, u, F) => ($D(t, typeof u != "symbol" ? u + "" : u, F), F);
var jD = class extends x {
constructor(u) {
super(u, false), q(this, "options"), q(this, "cursor", 0), this.options = u.options, this.cursor = this.options.findIndex(({ value: F }) => F === u.initialValue), this.cursor === -1 && (this.cursor = 0), this.changeValue(), this.on("cursor", (F) => {
switch (F) {
case "left":
case "up":
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
break;
case "down":
case "right": this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
}
this.changeValue();
});
}
get _value() {
return this.options[this.cursor];
}
changeValue() {
this.value = this._value.value;
}
};
var PD = class extends x {
get valueWithCursor() {
if (this.state === "submit") return this.value;
if (this.cursor >= this.value.length) return `${this.value}\u2588`;
const u = this.value.slice(0, this.cursor), [F, ...e$1] = this.value.slice(this.cursor);
return `${u}${e.inverse(F)}${e$1.join("")}`;
}
get cursor() {
return this._cursor;
}
constructor(u) {
super(u), this.on("finalize", () => {
this.value || (this.value = u.defaultValue);
});
}
};
function ce() {
return g$1.platform !== "win32" ? g$1.env.TERM !== "linux" : !!g$1.env.CI || !!g$1.env.WT_SESSION || !!g$1.env.TERMINUS_SUBLIME || g$1.env.ConEmuTask === "{cmd::Cmder}" || g$1.env.TERM_PROGRAM === "Terminus-Sublime" || g$1.env.TERM_PROGRAM === "vscode" || g$1.env.TERM === "xterm-256color" || g$1.env.TERM === "alacritty" || g$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
}
const V = ce();
const u = (t, n) => V ? t : n;
const le = u("❯", ">");
const L = u("■", "x");
const W = u("▲", "x");
const C = u("✔", "√");
const o = u("");
const d = u("");
const k = u("●", ">");
const P = u("○", " ");
const A = u("◻", "[•]");
const T = u("◼", "[+]");
const F = u("◻", "[ ]");
const w = (t) => {
switch (t) {
case "initial":
case "active": return e.cyan(le);
case "cancel": return e.red(L);
case "error": return e.yellow(W);
case "submit": return e.green(C);
}
};
const B = (t) => {
const { cursor: n, options: s, style: r } = t, i = t.maxItems ?? Number.POSITIVE_INFINITY, a = Math.max(process.stdout.rows - 4, 0), c = Math.min(a, Math.max(i, 5));
let l = 0;
n >= l + c - 3 ? l = Math.max(Math.min(n - c + 3, s.length - c), 0) : n < l + 2 && (l = Math.max(n - 2, 0));
const $ = c < s.length && l > 0, p = c < s.length && l + c < s.length;
return s.slice(l, l + c).map((M, v, x) => {
const j = v === 0 && $, E = v === x.length - 1 && p;
return j || E ? e.dim("...") : r(M, v + l === n);
});
};
const he = (t) => new PD({
validate: t.validate,
placeholder: t.placeholder,
defaultValue: t.defaultValue,
initialValue: t.initialValue,
render() {
const n = `${e.gray(o)}
${w(this.state)} ${t.message}
`, s = t.placeholder ? e.inverse(t.placeholder[0]) + e.dim(t.placeholder.slice(1)) : e.inverse(e.hidden("_")), r = this.value ? this.valueWithCursor : s;
switch (this.state) {
case "error": return `${n.trim()}
${e.yellow(o)} ${r}
${e.yellow(d)} ${e.yellow(this.error)}
`;
case "submit": return `${n}${e.gray(o)} ${e.dim(this.value || t.placeholder)}`;
case "cancel": return `${n}${e.gray(o)} ${e.strikethrough(e.dim(this.value ?? ""))}${this.value?.trim() ? `
${e.gray(o)}` : ""}`;
default: return `${n}${e.cyan(o)} ${r}
${e.cyan(d)}
`;
}
}
}).prompt();
const ye = (t) => {
const n = t.active ?? "Yes", s = t.inactive ?? "No";
return new fD({
active: n,
inactive: s,
initialValue: t.initialValue ?? true,
render() {
const r = `${e.gray(o)}
${w(this.state)} ${t.message}
`, i = this.value ? n : s;
switch (this.state) {
case "submit": return `${r}${e.gray(o)} ${e.dim(i)}`;
case "cancel": return `${r}${e.gray(o)} ${e.strikethrough(e.dim(i))}
${e.gray(o)}`;
default: return `${r}${e.cyan(o)} ${this.value ? `${e.green(k)} ${n}` : `${e.dim(P)} ${e.dim(n)}`} ${e.dim("/")} ${this.value ? `${e.dim(P)} ${e.dim(s)}` : `${e.green(k)} ${s}`}
${e.cyan(d)}
`;
}
}
}).prompt();
};
const ve = (t) => {
const n = (s, r) => {
const i = s.label ?? String(s.value);
switch (r) {
case "selected": return `${e.dim(i)}`;
case "active": return `${e.green(k)} ${i} ${s.hint ? e.dim(`(${s.hint})`) : ""}`;
case "cancelled": return `${e.strikethrough(e.dim(i))}`;
default: return `${e.dim(P)} ${e.dim(i)}`;
}
};
return new jD({
options: t.options,
initialValue: t.initialValue,
render() {
const s = `${e.gray(o)}
${w(this.state)} ${t.message}
`;
switch (this.state) {
case "submit": return `${s}${e.gray(o)} ${n(this.options[this.cursor], "selected")}`;
case "cancel": return `${s}${e.gray(o)} ${n(this.options[this.cursor], "cancelled")}
${e.gray(o)}`;
default: return `${s}${e.cyan(o)} ${B({
cursor: this.cursor,
options: this.options,
maxItems: t.maxItems,
style: (r, i) => n(r, i ? "active" : "inactive")
}).join(`
${e.cyan(o)} `)}
${e.cyan(d)}
`;
}
}
}).prompt();
};
const fe = (t) => {
const n = (s, r) => {
const i = s.label ?? String(s.value);
return r === "active" ? `${e.cyan(A)} ${i} ${s.hint ? e.dim(`(${s.hint})`) : ""}` : r === "selected" ? `${e.green(T)} ${e.dim(i)}` : r === "cancelled" ? `${e.strikethrough(e.dim(i))}` : r === "active-selected" ? `${e.green(T)} ${i} ${s.hint ? e.dim(`(${s.hint})`) : ""}` : r === "submitted" ? `${e.dim(i)}` : `${e.dim(F)} ${e.dim(i)}`;
};
return new wD({
options: t.options,
initialValues: t.initialValues,
required: t.required ?? true,
cursorAt: t.cursorAt,
validate(s) {
if (this.required && s.length === 0) return `Please select at least one option.
${e.reset(e.dim(`Press ${e.gray(e.bgWhite(e.inverse(" space ")))} to select, ${e.gray(e.bgWhite(e.inverse(" enter ")))} to submit`))}`;
},
render() {
const s = `${e.gray(o)}
${w(this.state)} ${t.message}
`, r = (i, a) => {
const c = this.value.includes(i.value);
return a && c ? n(i, "active-selected") : c ? n(i, "selected") : n(i, a ? "active" : "inactive");
};
switch (this.state) {
case "submit": return `${s}${e.gray(o)} ${this.options.filter(({ value: i }) => this.value.includes(i)).map((i) => n(i, "submitted")).join(e.dim(", ")) || e.dim("none")}`;
case "cancel": {
const i = this.options.filter(({ value: a }) => this.value.includes(a)).map((a) => n(a, "cancelled")).join(e.dim(", "));
return `${s}${e.gray(o)} ${i.trim() ? `${i}
${e.gray(o)}` : ""}`;
}
case "error": {
const i = this.error.split(`
`).map((a, c) => c === 0 ? `${e.yellow(d)} ${e.yellow(a)}` : ` ${a}`).join(`
`);
return `${s + e.yellow(o)} ${B({
options: this.options,
cursor: this.cursor,
maxItems: t.maxItems,
style: r
}).join(`
${e.yellow(o)} `)}
${i}
`;
}
default: return `${s}${e.cyan(o)} ${B({
options: this.options,
cursor: this.cursor,
maxItems: t.maxItems,
style: r
}).join(`
${e.cyan(o)} `)}
${e.cyan(d)}
`;
}
}
}).prompt();
};
`${e.gray(o)}`;
const kCancel = Symbol.for("cancel");
async function prompt(message, opts = {}) {
const handleCancel = (value) => {
if (typeof value !== "symbol" || value.toString() !== "Symbol(clack:cancel)") return value;
switch (opts.cancel) {
case "reject": {
const error = /* @__PURE__ */ new Error("Prompt cancelled.");
error.name = "ConsolaPromptCancelledError";
if (Error.captureStackTrace) Error.captureStackTrace(error, prompt);
throw error;
}
case "undefined": return;
case "null": return null;
case "symbol": return kCancel;
default:
case "default": return opts.default ?? opts.initial;
}
};
if (!opts.type || opts.type === "text") return await he({
message,
defaultValue: opts.default,
placeholder: opts.placeholder,
initialValue: opts.initial
}).then(handleCancel);
if (opts.type === "confirm") return await ye({
message,
initialValue: opts.initial
}).then(handleCancel);
if (opts.type === "select") return await ve({
message,
options: opts.options.map((o) => typeof o === "string" ? {
value: o,
label: o
} : o),
initialValue: opts.initial
}).then(handleCancel);
if (opts.type === "multiselect") return await fe({
message,
options: opts.options.map((o) => typeof o === "string" ? {
value: o,
label: o
} : o),
required: opts.required,
initialValues: opts.initial
}).then(handleCancel);
throw new Error(`Unknown prompt type: ${opts.type}`);
}
//#endregion
export { prompt };
import { n as __toESM, t as require_binding } from "./binding-Cv62mM1i.mjs";
import { a as bindingifySourcemap, n as normalizeBindingError } from "./error-BgfXq0Tb.mjs";
//#region src/utils/minify.ts
var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
/**
* Minify asynchronously.
*
* Note: This function can be slower than {@linkcode minifySync} due to the overhead of spawning a thread.
*
* @category Utilities
* @experimental
*/
async function minify(filename, sourceText, options) {
const inputMap = bindingifySourcemap(options?.inputMap);
const result = await (0, import_binding.minify)(filename, sourceText, options);
if (result.map && inputMap) result.map = {
version: 3,
...(0, import_binding.collapseSourcemaps)([inputMap, bindingifySourcemap(result.map)])
};
return result;
}
/**
* Minify synchronously.
*
* @category Utilities
* @experimental
*/
function minifySync(filename, sourceText, options) {
const inputMap = bindingifySourcemap(options?.inputMap);
const result = (0, import_binding.minifySync)(filename, sourceText, options);
if (result.map && inputMap) result.map = {
version: 3,
...(0, import_binding.collapseSourcemaps)([inputMap, bindingifySourcemap(result.map)])
};
return result;
}
//#endregion
//#region src/utils/transform.ts
const yarnPnp$1 = typeof process === "object" && !!process.versions?.pnp;
function normalizeBindingWarning(warning) {
if (warning.type === "JsError") return warning.field0;
return {
code: warning.field0.kind,
message: warning.field0.message,
id: warning.field0.id,
exporter: warning.field0.exporter,
loc: warning.field0.loc,
pos: warning.field0.pos
};
}
/**
* Transpile a JavaScript or TypeScript into a target ECMAScript version, asynchronously.
*
* Note: This function can be slower than `transformSync` due to the overhead of spawning a thread.
*
* @param filename The name of the file being transformed. If this is a
* relative path, consider setting the {@linkcode TransformOptions#cwd} option.
* @param sourceText The source code to transform.
* @param options The transform options including tsconfig and inputMap. See {@linkcode TransformOptions} for more information.
* @param cache Optional tsconfig cache for reusing resolved tsconfig across multiple transforms.
* Only used when `options.tsconfig` is `true`.
*
* @returns a promise that resolves to an object containing the transformed code,
* source maps, and any errors that occurred during parsing or transformation.
*
* @category Utilities
* @experimental
*/
async function transform(filename, sourceText, options, cache) {
const result = await (0, import_binding.enhancedTransform)(filename, sourceText, options, cache, yarnPnp$1);
return {
...result,
errors: result.errors.map(normalizeBindingError),
warnings: result.warnings.map(normalizeBindingWarning)
};
}
/**
* Transpile a JavaScript or TypeScript into a target ECMAScript version.
*
* @param filename The name of the file being transformed. If this is a
* relative path, consider setting the {@linkcode TransformOptions#cwd} option.
* @param sourceText The source code to transform.
* @param options The transform options including tsconfig and inputMap. See {@linkcode TransformOptions} for more information.
* @param cache Optional tsconfig cache for reusing resolved tsconfig across multiple transforms.
* Only used when `options.tsconfig` is `true`.
*
* @returns an object containing the transformed code, source maps, and any errors
* that occurred during parsing or transformation.
*
* @category Utilities
* @experimental
*/
function transformSync(filename, sourceText, options, cache) {
const result = (0, import_binding.enhancedTransformSync)(filename, sourceText, options, cache, yarnPnp$1);
return {
...result,
errors: result.errors.map(normalizeBindingError),
warnings: result.warnings.map(normalizeBindingWarning)
};
}
//#endregion
//#region src/utils/resolve-tsconfig.ts
const yarnPnp = typeof process === "object" && !!process.versions?.pnp;
/**
* Cache for tsconfig resolution to avoid redundant file system operations.
*
* The cache stores resolved tsconfig configurations keyed by their file paths.
* When transforming multiple files in the same project, tsconfig lookups are
* deduplicated, improving performance.
*
* @category Utilities
* @experimental
*/
var TsconfigCache = class extends import_binding.TsconfigCache {
constructor() {
super(yarnPnp);
}
};
/** @hidden This is only expected to be used by Vite */
function resolveTsconfig(filename, cache) {
return (0, import_binding.resolveTsconfig)(filename, cache, yarnPnp);
}
//#endregion
export { minify as a, transformSync as i, resolveTsconfig as n, minifySync as o, transform as r, TsconfigCache as t };
import { n as __toESM, t as require_binding } from "./binding-Cv62mM1i.mjs";
import { c as __decorate, d as PlainObjectLike, o as transformToRollupOutput, u as lazyProp } from "./bindingify-input-options-EnUlEF0T.mjs";
import { l as PluginDriver, s as validateOption, t as createBundlerOptions } from "./create-bundler-option-4QtiLLuz.mjs";
import { i as unwrapBindingResult } from "./error-BgfXq0Tb.mjs";
//#region src/types/rolldown-output-impl.ts
var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
var RolldownOutputImpl = class extends PlainObjectLike {
bindingOutputs;
constructor(bindingOutputs) {
super();
this.bindingOutputs = bindingOutputs;
}
get output() {
return transformToRollupOutput(this.bindingOutputs).output;
}
__rolldown_external_memory_handle__(keepDataAlive) {
const results = this.output.map((item) => item.__rolldown_external_memory_handle__(keepDataAlive));
if (!results.every((r) => r.freed)) {
const reasons = results.filter((r) => !r.freed).map((r) => r.reason).filter(Boolean);
return {
freed: false,
reason: `Failed to free ${reasons.length} item(s): ${reasons.join("; ")}`
};
}
return { freed: true };
}
};
__decorate([lazyProp], RolldownOutputImpl.prototype, "output", null);
//#endregion
//#region src/api/rolldown/rolldown-build.ts
Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
/**
* The bundle object returned by {@linkcode rolldown} function.
*
* @category Programmatic APIs
*/
var RolldownBuild = class {
#inputOptions;
#bundler;
#stopWorkers;
#asyncRuntimeReleased = false;
/** @hidden should not be used directly */
constructor(inputOptions) {
this.#inputOptions = inputOptions;
this.#bundler = new import_binding.BindingBundler();
(0, import_binding.startAsyncRuntime)();
}
/**
* Whether the bundle has been closed.
*
* If the bundle is closed, calling other methods will throw an error.
*/
get closed() {
return this.#bundler.closed;
}
/**
* Generate bundles in-memory.
*
* If you directly want to write bundles to disk, use the {@linkcode write} method instead.
*
* @param outputOptions The output options.
* @returns The generated bundle.
* @throws {@linkcode BundleError} When an error occurs during the build.
*/
async generate(outputOptions = {}) {
return this.#build(false, outputOptions);
}
/**
* Generate and write bundles to disk.
*
* If you want to generate bundles in-memory, use the {@linkcode generate} method instead.
*
* @param outputOptions The output options.
* @returns The generated bundle.
* @throws {@linkcode BundleError} When an error occurs during the build.
*/
async write(outputOptions = {}) {
return this.#build(true, outputOptions);
}
/**
* Close the bundle and free resources.
*
* This method should be called even if the {@linkcode generate} method
* or the {@linkcode write} method threw an error. It should be called
* even if neither of the methods are called.
*
* This method is called automatically when using `using` syntax.
*
* @example
* ```js
* import { rolldown } from 'rolldown';
*
* {
* using bundle = await rolldown({ input: 'src/main.js' });
* const output = await bundle.generate({ format: 'esm' });
* console.log(output);
* // bundle.close() is called automatically here
* }
* ```
*/
async close() {
const shouldRelease = !this.#asyncRuntimeReleased;
this.#asyncRuntimeReleased = true;
try {
await this.#stopWorkers?.();
await this.#bundler.close();
this.#stopWorkers = void 0;
} finally {
if (shouldRelease) (0, import_binding.shutdownAsyncRuntime)();
}
}
/** @hidden documented in close method */
async [Symbol.asyncDispose]() {
await this.close();
}
/**
* @experimental
* @hidden not ready for public usage yet
*/
get watchFiles() {
return Promise.resolve(this.#bundler.getWatchFiles());
}
async #build(isWrite, outputOptions) {
validateOption("output", outputOptions);
await this.#stopWorkers?.();
const option = await createBundlerOptions(this.#inputOptions, outputOptions, false);
try {
this.#stopWorkers = option.stopWorkers;
let output;
if (isWrite) output = await this.#bundler.write(option.bundlerOptions);
else output = await this.#bundler.generate(option.bundlerOptions);
return new RolldownOutputImpl(unwrapBindingResult(output));
} catch (e) {
await option.stopWorkers?.();
throw e;
}
}
};
//#endregion
//#region src/api/rolldown/index.ts
/**
* The API compatible with Rollup's `rollup` function.
*
* Unlike Rollup, the module graph is not built until the methods of the bundle object are called.
*
* @param input The input options object.
* @returns A Promise that resolves to a bundle object.
*
* @example
* ```js
* import { rolldown } from 'rolldown';
*
* let bundle, failed = false;
* try {
* bundle = await rolldown({
* input: 'src/main.js',
* });
* await bundle.write({
* format: 'esm',
* });
* } catch (e) {
* console.error(e);
* failed = true;
* }
* if (bundle) {
* await bundle.close();
* }
* process.exitCode = failed ? 1 : 0;
* ```
*
* @category Programmatic APIs
*/
const rolldown = async (input) => {
validateOption("input", input);
return new RolldownBuild(await PluginDriver.callOptionsHook(input));
};
//#endregion
export { rolldown as t };
import { a as RolldownLog } from "./logging-xuHO4mAy.mjs";
import { F as MinifyOptions$1, G as TsconfigCache$1, I as MinifyResult$1, R as ParseResult$1, U as SourceMap, a as BindingEnhancedTransformOptions, o as BindingEnhancedTransformResult, y as BindingTsconfigResult, z as ParserOptions$1 } from "./binding-CVtkJvyl.mjs";
//#region src/utils/resolve-tsconfig.d.ts
/**
* Cache for tsconfig resolution to avoid redundant file system operations.
*
* The cache stores resolved tsconfig configurations keyed by their file paths.
* When transforming multiple files in the same project, tsconfig lookups are
* deduplicated, improving performance.
*
* @category Utilities
* @experimental
*/
declare class TsconfigCache extends TsconfigCache$1 {
constructor();
}
/** @hidden This is only expected to be used by Vite */
declare function resolveTsconfig(filename: string, cache?: TsconfigCache | null): BindingTsconfigResult | null;
//#endregion
//#region src/utils/parse.d.ts
/**
* Result of parsing a code
*
* @category Utilities
*/
interface ParseResult extends ParseResult$1 {}
/**
* Options for parsing a code
*
* @category Utilities
*/
interface ParserOptions extends ParserOptions$1 {}
/**
* Parse JS/TS source asynchronously on a separate thread.
*
* Note that not all of the workload can happen on a separate thread.
* Parsing on Rust side does happen in a separate thread, but deserialization of the AST to JS objects
* has to happen on current thread. This synchronous deserialization work typically outweighs
* the asynchronous parsing by a factor of between 3 and 20.
*
* i.e. the majority of the workload cannot be parallelized by using this method.
*
* Generally {@linkcode parseSync} is preferable to use as it does not have the overhead of spawning a thread.
* If you need to parallelize parsing multiple files, it is recommended to use worker threads.
*
* @category Utilities
*/
declare function parse(filename: string, sourceText: string, options?: ParserOptions | null): Promise<ParseResult>;
/**
* Parse JS/TS source synchronously on current thread.
*
* This is generally preferable over {@linkcode parse} (async) as it does not have the overhead
* of spawning a thread, and the majority of the workload cannot be parallelized anyway
* (see {@linkcode parse} documentation for details).
*
* If you need to parallelize parsing multiple files, it is recommended to use worker threads
* with {@linkcode parseSync} rather than using {@linkcode parse}.
*
* @category Utilities
*/
declare function parseSync(filename: string, sourceText: string, options?: ParserOptions | null): ParseResult;
//#endregion
//#region src/utils/minify.d.ts
/**
* Options for minification.
*
* @category Utilities
*/
interface MinifyOptions extends MinifyOptions$1 {
inputMap?: SourceMap;
}
/**
* The result of minification.
*
* @category Utilities
*/
interface MinifyResult extends MinifyResult$1 {}
/**
* Minify asynchronously.
*
* Note: This function can be slower than {@linkcode minifySync} due to the overhead of spawning a thread.
*
* @category Utilities
* @experimental
*/
declare function minify(filename: string, sourceText: string, options?: MinifyOptions | null): Promise<MinifyResult>;
/**
* Minify synchronously.
*
* @category Utilities
* @experimental
*/
declare function minifySync(filename: string, sourceText: string, options?: MinifyOptions | null): MinifyResult;
//#endregion
//#region src/utils/transform.d.ts
/**
* Options for transforming a code.
*
* @category Utilities
*/
interface TransformOptions extends BindingEnhancedTransformOptions {}
/**
* Result of transforming a code.
*
* @category Utilities
*/
type TransformResult = Omit<BindingEnhancedTransformResult, "errors" | "warnings"> & {
errors: Error[];
warnings: RolldownLog[];
};
/**
* Transpile a JavaScript or TypeScript into a target ECMAScript version, asynchronously.
*
* Note: This function can be slower than `transformSync` due to the overhead of spawning a thread.
*
* @param filename The name of the file being transformed. If this is a
* relative path, consider setting the {@linkcode TransformOptions#cwd} option.
* @param sourceText The source code to transform.
* @param options The transform options including tsconfig and inputMap. See {@linkcode TransformOptions} for more information.
* @param cache Optional tsconfig cache for reusing resolved tsconfig across multiple transforms.
* Only used when `options.tsconfig` is `true`.
*
* @returns a promise that resolves to an object containing the transformed code,
* source maps, and any errors that occurred during parsing or transformation.
*
* @category Utilities
* @experimental
*/
declare function transform(filename: string, sourceText: string, options?: TransformOptions | null, cache?: TsconfigCache | null): Promise<TransformResult>;
/**
* Transpile a JavaScript or TypeScript into a target ECMAScript version.
*
* @param filename The name of the file being transformed. If this is a
* relative path, consider setting the {@linkcode TransformOptions#cwd} option.
* @param sourceText The source code to transform.
* @param options The transform options including tsconfig and inputMap. See {@linkcode TransformOptions} for more information.
* @param cache Optional tsconfig cache for reusing resolved tsconfig across multiple transforms.
* Only used when `options.tsconfig` is `true`.
*
* @returns an object containing the transformed code, source maps, and any errors
* that occurred during parsing or transformation.
*
* @category Utilities
* @experimental
*/
declare function transformSync(filename: string, sourceText: string, options?: TransformOptions | null, cache?: TsconfigCache | null): TransformResult;
//#endregion
export { MinifyOptions as a, minifySync as c, parse as d, parseSync as f, transformSync as i, ParseResult as l, resolveTsconfig as m, TransformResult as n, MinifyResult as o, TsconfigCache as p, transform as r, minify as s, TransformOptions as t, ParserOptions as u };
import { n as __toESM, t as require_binding } from "./binding-Cv62mM1i.mjs";
import { s as logMultipleWatcherOption } from "./logs-DmYCAKcW.mjs";
import { y as LOG_LEVEL_WARN } from "./bindingify-input-options-EnUlEF0T.mjs";
import { t as arraify } from "./misc-DOSKtd97.mjs";
import { l as PluginDriver, t as createBundlerOptions } from "./create-bundler-option-4QtiLLuz.mjs";
import { t as aggregateBindingErrorsIntoJsError } from "./error-BgfXq0Tb.mjs";
//#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
/**
* This is not the set of all possible signals.
*
* It IS, however, the set of all signals that trigger
* an exit on either Linux or BSD systems. Linux is a
* superset of the signal names supported on BSD, and
* the unknown signals just fail to register, so we can
* catch that easily enough.
*
* Windows signals are a different set, since there are
* signals that terminate Windows processes, but don't
* terminate (or don't even exist) on Posix systems.
*
* Don't bother with SIGKILL. It's uncatchable, which
* means that we can't fire any callbacks anyway.
*
* If a user does happen to register a handler on a non-
* fatal signal like SIGWINCH or something, and then
* exit, it'll end up firing `process.emit('exit')`, so
* the handler will be fired anyway.
*
* SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
* artificially, inherently leave the process in a
* state from which it is not safe to try and enter JS
* listeners.
*/
const signals = [];
signals.push("SIGHUP", "SIGINT", "SIGTERM");
if (process.platform !== "win32") signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
if (process.platform === "linux") signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
//#endregion
//#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
const processOk = (process) => !!process && typeof process === "object" && typeof process.removeListener === "function" && typeof process.emit === "function" && typeof process.reallyExit === "function" && typeof process.listeners === "function" && typeof process.kill === "function" && typeof process.pid === "number" && typeof process.on === "function";
const kExitEmitter = Symbol.for("signal-exit emitter");
const global = globalThis;
const ObjectDefineProperty = Object.defineProperty.bind(Object);
var Emitter = class {
emitted = {
afterExit: false,
exit: false
};
listeners = {
afterExit: [],
exit: []
};
count = 0;
id = Math.random();
constructor() {
if (global[kExitEmitter]) return global[kExitEmitter];
ObjectDefineProperty(global, kExitEmitter, {
value: this,
writable: false,
enumerable: false,
configurable: false
});
}
on(ev, fn) {
this.listeners[ev].push(fn);
}
removeListener(ev, fn) {
const list = this.listeners[ev];
const i = list.indexOf(fn);
/* c8 ignore start */
if (i === -1) return;
/* c8 ignore stop */
if (i === 0 && list.length === 1) list.length = 0;
else list.splice(i, 1);
}
emit(ev, code, signal) {
if (this.emitted[ev]) return false;
this.emitted[ev] = true;
let ret = false;
for (const fn of this.listeners[ev]) ret = fn(code, signal) === true || ret;
if (ev === "exit") ret = this.emit("afterExit", code, signal) || ret;
return ret;
}
};
var SignalExitBase = class {};
const signalExitWrap = (handler) => {
return {
onExit(cb, opts) {
return handler.onExit(cb, opts);
},
load() {
return handler.load();
},
unload() {
return handler.unload();
}
};
};
var SignalExitFallback = class extends SignalExitBase {
onExit() {
return () => {};
}
load() {}
unload() {}
};
var SignalExit = class extends SignalExitBase {
/* c8 ignore start */
#hupSig = process$1.platform === "win32" ? "SIGINT" : "SIGHUP";
/* c8 ignore stop */
#emitter = new Emitter();
#process;
#originalProcessEmit;
#originalProcessReallyExit;
#sigListeners = {};
#loaded = false;
constructor(process) {
super();
this.#process = process;
this.#sigListeners = {};
for (const sig of signals) this.#sigListeners[sig] = () => {
const listeners = this.#process.listeners(sig);
let { count } = this.#emitter;
/* c8 ignore start */
const p = process;
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") count += p.__signal_exit_emitter__.count;
/* c8 ignore stop */
if (listeners.length === count) {
this.unload();
const ret = this.#emitter.emit("exit", null, sig);
/* c8 ignore start */
const s = sig === "SIGHUP" ? this.#hupSig : sig;
if (!ret) process.kill(process.pid, s);
}
};
this.#originalProcessReallyExit = process.reallyExit;
this.#originalProcessEmit = process.emit;
}
onExit(cb, opts) {
/* c8 ignore start */
if (!processOk(this.#process)) return () => {};
/* c8 ignore stop */
if (this.#loaded === false) this.load();
const ev = opts?.alwaysLast ? "afterExit" : "exit";
this.#emitter.on(ev, cb);
return () => {
this.#emitter.removeListener(ev, cb);
if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) this.unload();
};
}
load() {
if (this.#loaded) return;
this.#loaded = true;
this.#emitter.count += 1;
for (const sig of signals) try {
const fn = this.#sigListeners[sig];
if (fn) this.#process.on(sig, fn);
} catch (_) {}
this.#process.emit = (ev, ...a) => {
return this.#processEmit(ev, ...a);
};
this.#process.reallyExit = (code) => {
return this.#processReallyExit(code);
};
}
unload() {
if (!this.#loaded) return;
this.#loaded = false;
signals.forEach((sig) => {
const listener = this.#sigListeners[sig];
/* c8 ignore start */
if (!listener) throw new Error("Listener not defined for signal: " + sig);
/* c8 ignore stop */
try {
this.#process.removeListener(sig, listener);
} catch (_) {}
/* c8 ignore stop */
});
this.#process.emit = this.#originalProcessEmit;
this.#process.reallyExit = this.#originalProcessReallyExit;
this.#emitter.count -= 1;
}
#processReallyExit(code) {
/* c8 ignore start */
if (!processOk(this.#process)) return 0;
this.#process.exitCode = code || 0;
/* c8 ignore stop */
this.#emitter.emit("exit", this.#process.exitCode, null);
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
}
#processEmit(ev, ...args) {
const og = this.#originalProcessEmit;
if (ev === "exit" && processOk(this.#process)) {
if (typeof args[0] === "number") this.#process.exitCode = args[0];
/* c8 ignore start */
const ret = og.call(this.#process, ev, ...args);
/* c8 ignore start */
this.#emitter.emit("exit", this.#process.exitCode, null);
/* c8 ignore stop */
return ret;
} else return og.call(this.#process, ev, ...args);
}
};
const process$1 = globalThis.process;
const { onExit: onExit$1, load, unload } = signalExitWrap(processOk(process$1) ? new SignalExit(process$1) : new SignalExitFallback());
//#endregion
//#region src/utils/signal-exit.ts
function onExit(...args) {
if (typeof process === "object" && process.versions.webcontainer) {
process.on("exit", (code) => {
args[0](code, null);
});
return;
}
onExit$1(...args);
}
//#endregion
//#region src/api/watch/watch-emitter.ts
var WatcherEmitter = class {
listeners = /* @__PURE__ */ new Map();
on(event, listener) {
const listeners = this.listeners.get(event);
if (listeners) listeners.push(listener);
else this.listeners.set(event, [listener]);
return this;
}
off(event, listener) {
const listeners = this.listeners.get(event);
if (listeners) {
const index = listeners.indexOf(listener);
if (index !== -1) listeners.splice(index, 1);
}
return this;
}
clear(event) {
this.listeners.delete(event);
}
/** Async emit — sequential dispatch so side effects from earlier handlers
* (e.g. `event.result.close()` triggering `closeBundle`) are visible to later handlers. */
async emit(event, ...args) {
const handlers = this.listeners.get(event);
if (handlers?.length) for (const h of handlers) await h(...args);
}
async close() {}
};
//#endregion
//#region src/api/watch/watcher.ts
var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
function createEventCallback(emitter) {
return async (event) => {
switch (event.eventKind()) {
case "event": {
const code = event.bundleEventKind();
if (code === "BUNDLE_END") {
const { duration, output, result } = event.bundleEndData();
await emitter.emit("event", {
code: "BUNDLE_END",
duration,
output: [output],
result
});
} else if (code === "ERROR") {
const data = event.bundleErrorData();
await emitter.emit("event", {
code: "ERROR",
error: aggregateBindingErrorsIntoJsError(data.error),
result: data.result
});
} else await emitter.emit("event", { code });
break;
}
case "change": {
const { path, kind } = event.watchChangeData();
await emitter.emit("change", path, { event: kind });
break;
}
case "restart":
await emitter.emit("restart");
break;
case "close": await emitter.emit("close");
}
};
}
var Watcher = class {
closed;
inner;
emitter;
stopWorkers;
constructor(emitter, inner, stopWorkers) {
this.closed = false;
this.inner = inner;
this.emitter = emitter;
(0, import_binding.startAsyncRuntime)();
const originClose = emitter.close.bind(emitter);
emitter.close = async () => {
await this.close();
originClose();
};
this.stopWorkers = stopWorkers;
process.nextTick(() => this.run());
}
async close() {
if (this.closed) return;
this.closed = true;
try {
for (const stop of this.stopWorkers) await stop?.();
await this.inner.close();
} finally {
(0, import_binding.shutdownAsyncRuntime)();
}
}
async run() {
await this.inner.run();
this.inner.waitForClose();
}
};
async function createWatcher(emitter, input) {
const options = arraify(input);
const bundlerOptions = await Promise.all(options.map((option) => arraify(option.output || {}).map(async (output) => {
const inputOptions = await PluginDriver.callOptionsHook(option, true);
return createBundlerOptions(inputOptions, output, true);
})).flat());
warnMultiplePollingOptions(bundlerOptions);
const callback = createEventCallback(emitter);
new Watcher(emitter, new import_binding.BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), callback), bundlerOptions.map((option) => option.stopWorkers));
}
function warnMultiplePollingOptions(bundlerOptions) {
let found = false;
for (const option of bundlerOptions) {
const watch = option.inputOptions.watch;
const watcher = watch && typeof watch === "object" ? watch.watcher ?? watch.notify : void 0;
if (watcher && (watcher.usePolling != null || watcher.pollInterval != null)) {
if (found) {
option.onLog(LOG_LEVEL_WARN, logMultipleWatcherOption());
return;
}
found = true;
}
}
}
//#endregion
//#region src/api/watch/index.ts
/**
* The API compatible with Rollup's `watch` function.
*
* This function will rebuild the bundle when it detects that the individual modules have changed on disk.
*
* Note that when using this function, it is your responsibility to call `event.result.close()` in response to the `BUNDLE_END` event to avoid resource leaks.
*
* @param input The watch options object or the list of them.
* @returns A watcher object.
*
* @example
* ```js
* import { watch } from 'rolldown';
*
* const watcher = watch({ /* ... *\/ });
* watcher.on('event', (event) => {
* if (event.code === 'BUNDLE_END') {
* console.log(event.duration);
* event.result.close();
* }
* });
*
* // Stop watching
* watcher.close();
* ```
*
* @experimental
* @category Programmatic APIs
*/
function watch(input) {
const emitter = new WatcherEmitter();
createWatcher(emitter, input);
return emitter;
}
//#endregion
export { onExit as n, watch as t };

Sorry, the diff of this file is not supported yet

+9
-10

@@ -1,7 +0,7 @@

import { n as onExit, t as watch } from "./shared/watch-WnrlHRS0.mjs";
import { S as version, x as description } from "./shared/bindingify-input-options-_ppP73I9.mjs";
import { t as arraify } from "./shared/misc-CoQm4NHO.mjs";
import { a as getInputCliKeys, i as getCliSchemaInfo, l as styleText, o as getOutputCliKeys, r as logger, s as validateCliOptions } from "./shared/rolldown-build-CdF8HAHX.mjs";
import { t as rolldown } from "./shared/rolldown-951h_1lf.mjs";
import { t as loadConfig } from "./shared/load-config-C6UyiS41.mjs";
import { n as onExit, t as watch } from "./shared/watch-Cwq-cFUy.mjs";
import { C as version, S as description } from "./shared/bindingify-input-options-EnUlEF0T.mjs";
import { t as arraify } from "./shared/misc-DOSKtd97.mjs";
import { a as getOutputCliKeys, c as styleText, i as getInputCliKeys, n as logger, o as validateCliOptions, r as getCliSchemaInfo } from "./shared/create-bundler-option-4QtiLLuz.mjs";
import { t as rolldown } from "./shared/rolldown-DP_p9pd3.mjs";
import { t as loadConfig } from "./shared/load-config-DsMzOVzu.mjs";
import path from "node:path";

@@ -865,3 +865,3 @@ import g$1 from "node:process";

//#endregion
//#region \0@oxc-project+runtime@0.140.0/helpers/esm/usingCtx.js
//#region \0@oxc-project+runtime@0.142.0/helpers/esm/usingCtx.js
function _usingCtx() {

@@ -951,3 +951,4 @@ var r = "function" == typeof SuppressedError ? SuppressedError : function(r, e) {

logger.error("No output generated");
process.exit(1);
process.exitCode = 1;
return;
}

@@ -1005,4 +1006,2 @@ for (const file of outputs) {

logger.error(event.error);
break;
default: break;
}

@@ -1009,0 +1008,0 @@ });

@@ -1,2 +0,2 @@

import { L as VERSION, r as defineConfig, t as ConfigExport } from "./shared/define-config-B-IDOhDz.mjs";
import { R as VERSION, r as defineConfig, t as ConfigExport } from "./shared/define-config-DSMNXceb.mjs";
//#region src/utils/load-config.d.ts

@@ -3,0 +3,0 @@ type ConfigLoader = "bundle" | "native";

@@ -1,4 +0,4 @@

import { b as VERSION } from "./shared/bindingify-input-options-_ppP73I9.mjs";
import { x as VERSION } from "./shared/bindingify-input-options-EnUlEF0T.mjs";
import { t as defineConfig } from "./shared/define-config-Demdg3_4.mjs";
import { t as loadConfig } from "./shared/load-config-C6UyiS41.mjs";
import { t as loadConfig } from "./shared/load-config-DsMzOVzu.mjs";
export { VERSION, defineConfig, loadConfig };

@@ -1,5 +0,5 @@

import { H as ResolverFactory, J as moduleRunnerTransform, K as isolatedDeclaration, L as NapiResolveOptions, M as IsolatedDeclarationsOptions, N as IsolatedDeclarationsResult, V as ResolveResult, _ as BindingTsconfigCompilerOptions, i as BindingClientHmrUpdate, k as BindingViteTransformPluginConfig, n as BindingBundleAnalyzerPluginConfig, p as BindingRebuildStrategy, q as isolatedDeclarationSync, r as BindingBundleState, u as BindingLazyChunkOutput, v as BindingTsconfigRawOptions, w as BindingViteManifestPluginConfig } from "./shared/binding-Dbbi0RbO.mjs";
import { Bt as OutputOptions, F as BuiltinPlugin, Q as defineParallelPlugin, Wt as StringOrRegExp, Yt as RolldownOutput, Zt as freeExternalMemory, l as InputOptions, lt as NormalizedOutputOptions } from "./shared/define-config-B-IDOhDz.mjs";
import { a as MinifyOptions$1, c as minifySync$1, d as parse$1, f as parseSync$1, i as transformSync$1, l as ParseResult$1, m as resolveTsconfig, n as TransformResult$1, o as MinifyResult$1, p as TsconfigCache$1, r as transform$1, s as minify$1, t as TransformOptions$1, u as ParserOptions$1 } from "./shared/transform-Cs2bUDRH.mjs";
import { a as viteDynamicImportVarsPlugin, c as viteLoadFallbackPlugin, d as viteReporterPlugin, f as viteResolvePlugin, i as viteBuildImportAnalysisPlugin, l as viteModulePreloadPolyfillPlugin, n as isolatedDeclarationPlugin, o as viteImportGlobPlugin, p as viteWebWorkerPostPlugin, r as oxcRuntimePlugin, s as viteJsonPlugin, u as viteReactRefreshWrapperPlugin } from "./shared/constructors-CSWbNgBZ.mjs";
import { H as ResolverFactory, J as moduleRunnerTransform, K as isolatedDeclaration, L as NapiResolveOptions, M as IsolatedDeclarationsOptions, N as IsolatedDeclarationsResult, V as ResolveResult, _ as BindingTsconfigCompilerOptions, i as BindingClientHmrUpdate, k as BindingViteTransformPluginConfig, n as BindingBundleAnalyzerPluginConfig, p as BindingRebuildStrategy, q as isolatedDeclarationSync, r as BindingBundleState, u as BindingLazyChunkOutput, v as BindingTsconfigRawOptions, w as BindingViteManifestPluginConfig } from "./shared/binding-CVtkJvyl.mjs";
import { $ as defineParallelPlugin, Gt as StringOrRegExp, I as BuiltinPlugin, Qt as freeExternalMemory, Vt as OutputOptions, Xt as RolldownOutput, l as InputOptions, ut as NormalizedOutputOptions } from "./shared/define-config-DSMNXceb.mjs";
import { a as MinifyOptions$1, c as minifySync$1, d as parse$1, f as parseSync$1, i as transformSync$1, l as ParseResult$1, m as resolveTsconfig, n as TransformResult$1, o as MinifyResult$1, p as TsconfigCache$1, r as transform$1, s as minify$1, t as TransformOptions$1, u as ParserOptions$1 } from "./shared/transform-WmU_cI8e.mjs";
import { a as viteDynamicImportVarsPlugin, c as viteLoadFallbackPlugin, d as viteReporterPlugin, f as viteResolvePlugin, i as viteBuildImportAnalysisPlugin, l as viteModulePreloadPolyfillPlugin, n as isolatedDeclarationPlugin, o as viteImportGlobPlugin, p as viteWebWorkerPostPlugin, r as oxcRuntimePlugin, s as viteJsonPlugin, u as viteReactRefreshWrapperPlugin } from "./shared/constructors-ALilxAii.mjs";
//#region src/api/dev/dev-options.d.ts

@@ -14,2 +14,8 @@ type DevOnHmrUpdates = (result: Error | {

/**
* If `false`, no file system watcher is started, so file changes are never
* picked up and no rebuild or HMR update is triggered on their own.
* @default true
*/
enabled?: boolean;
/**
* If `true`, files are not written to disk.

@@ -16,0 +22,0 @@ * @default false

@@ -1,9 +0,9 @@

import { n as __toESM, t as require_binding } from "./shared/binding-Dby9rwGk.mjs";
import { n as BuiltinPlugin, t as normalizedStringOrRegex } from "./shared/normalize-string-or-regex-SiXbePVH.mjs";
import { o as transformToRollupOutput } from "./shared/bindingify-input-options-_ppP73I9.mjs";
import { c as validateOption, n as createBundlerOptions, t as RolldownBuild, u as PluginDriver } from "./shared/rolldown-build-CdF8HAHX.mjs";
import { i as unwrapBindingResult, r as normalizeBindingResult } from "./shared/error-DFGNOCle.mjs";
import { n as parseSync$1, t as parse$1 } from "./shared/parse-BFj5G_7i.mjs";
import { a as viteDynamicImportVarsPlugin, c as viteLoadFallbackPlugin, d as viteReporterPlugin, f as viteResolvePlugin, i as viteBuildImportAnalysisPlugin, l as viteModulePreloadPolyfillPlugin, n as isolatedDeclarationPlugin, o as viteImportGlobPlugin, p as viteWebWorkerPostPlugin, r as oxcRuntimePlugin, s as viteJsonPlugin, u as viteReactRefreshWrapperPlugin } from "./shared/constructors-CuGa75s-.mjs";
import { a as minify$1, i as transformSync$1, n as resolveTsconfig, o as minifySync$1, r as transform$1, t as TsconfigCache$1 } from "./shared/resolve-tsconfig-2TXRF_zr.mjs";
import { n as __toESM, t as require_binding } from "./shared/binding-Cv62mM1i.mjs";
import { n as BuiltinPlugin, t as normalizedStringOrRegex } from "./shared/normalize-string-or-regex-BVNGzRe4.mjs";
import { o as transformToRollupOutput } from "./shared/bindingify-input-options-EnUlEF0T.mjs";
import { l as PluginDriver, s as validateOption, t as createBundlerOptions } from "./shared/create-bundler-option-4QtiLLuz.mjs";
import { i as unwrapBindingResult, r as normalizeBindingResult } from "./shared/error-BgfXq0Tb.mjs";
import { n as parseSync$1, t as parse$1 } from "./shared/parse-DQIYJwT4.mjs";
import { a as viteDynamicImportVarsPlugin, c as viteLoadFallbackPlugin, d as viteReporterPlugin, f as viteResolvePlugin, i as viteBuildImportAnalysisPlugin, l as viteModulePreloadPolyfillPlugin, n as isolatedDeclarationPlugin, o as viteImportGlobPlugin, p as viteWebWorkerPostPlugin, r as oxcRuntimePlugin, s as viteJsonPlugin, u as viteReactRefreshWrapperPlugin } from "./shared/constructors-CuqzPFxJ.mjs";
import { a as minify$1, i as transformSync$1, n as resolveTsconfig, o as minifySync$1, r as transform$1, t as TsconfigCache$1 } from "./shared/resolve-tsconfig-CQndqeLj.mjs";
import { pathToFileURL } from "node:url";

@@ -15,2 +15,3 @@ //#region src/api/dev/dev-engine.ts

#cachedBuildFinishPromise = null;
#asyncRuntimeReleased = false;
static async create(inputOptions, outputOptions = {}, devOptions = {}) {

@@ -50,2 +51,3 @@ inputOptions = await PluginDriver.callOptionsHook(inputOptions);

watch: devOptions.watch && {
enabled: devOptions.watch.enabled,
skipWrite: devOptions.watch.skipWrite,

@@ -63,2 +65,3 @@ usePolling: devOptions.watch.usePolling,

const inner = new import_binding.BindingDevEngine(options.bundlerOptions, bindingDevOptions);
(0, import_binding.startAsyncRuntime)();
return new DevEngine(inner);

@@ -107,3 +110,9 @@ }

async close() {
await this.#inner.close();
const shouldRelease = !this.#asyncRuntimeReleased;
this.#asyncRuntimeReleased = true;
try {
await this.#inner.close();
} finally {
if (shouldRelease) (0, import_binding.shutdownAsyncRuntime)();
}
}

@@ -189,14 +198,21 @@ /**

validateOption("output", rawOutputOptions);
const ret = await createBundlerOptions(await PluginDriver.callOptionsHook(rawInputOptions), rawOutputOptions, false);
const inputOptions = await PluginDriver.callOptionsHook(rawInputOptions);
const ret = await createBundlerOptions(inputOptions, rawOutputOptions, false);
const bundler = new import_binding.BindingBundler();
if (RolldownBuild.asyncRuntimeShutdown) (0, import_binding.startAsyncRuntime)();
(0, import_binding.startAsyncRuntime)();
let cleanedUp = false;
async function cleanup() {
await bundler.close();
await ret.stopWorkers?.();
(0, import_binding.shutdownAsyncRuntime)();
RolldownBuild.asyncRuntimeShutdown = true;
if (cleanedUp) return;
cleanedUp = true;
try {
await bundler.close();
await ret.stopWorkers?.();
} finally {
(0, import_binding.shutdownAsyncRuntime)();
}
}
let cleanupPromise = Promise.resolve();
try {
unwrapBindingResult(await bundler.scan(ret.bundlerOptions));
const result = await bundler.scan(ret.bundlerOptions);
unwrapBindingResult(result);
} catch (err) {

@@ -203,0 +219,0 @@ await cleanup();

@@ -1,2 +0,2 @@

import { P as withFilter } from "./shared/define-config-B-IDOhDz.mjs";
import { F as withFilter } from "./shared/define-config-DSMNXceb.mjs";
//#region ../../node_modules/.pnpm/@rolldown+pluginutils@1.0.1/node_modules/@rolldown/pluginutils/dist/filter/index.d.mts

@@ -3,0 +3,0 @@ //#region src/filter/composable-filters.d.ts

@@ -1,2 +0,2 @@

import { n as isPromiseLike, t as arraify } from "./shared/misc-CoQm4NHO.mjs";
import { r as isPromiseLike, t as arraify } from "./shared/misc-DOSKtd97.mjs";
//#region ../../node_modules/.pnpm/@rolldown+pluginutils@1.0.1/node_modules/@rolldown/pluginutils/dist/filter-B_mD-HGz.mjs

@@ -338,4 +338,2 @@ const postfixRE = /[?#].*$/;

};
break;
default: break;
}

@@ -342,0 +340,0 @@ });

import { a as RolldownLog, i as RolldownError, n as LogLevelOption, o as RolldownLogWithString, r as LogOrStringHandler, t as LogLevel } from "./shared/logging-xuHO4mAy.mjs";
import { B as PreRenderedChunk } from "./shared/binding-Dbbi0RbO.mjs";
import { $ as MinimalPluginContext, $t as SourcemapIgnoreListOption, A as RolldownPlugin, At as ChunkingContext, B as SourceMapInput, Bt as OutputOptions, C as ParallelPluginHooks, Ct as BuildOptions, D as ResolveIdExtraOptions, Dt as AdvancedChunksOptions, E as PluginMeta, Et as AdvancedChunksGroup, Ft as GeneratedCodeOptions, G as EmittedChunk, Gt as OutputAsset, H as TreeshakingOptions, I as RUNTIME_MODULE_ID, It as GeneratedCodePreset, J as GetModuleInfo, Jt as RenderedModule, K as EmittedFile, Kt as OutputChunk, L as VERSION, Lt as GlobalsFunction, M as SourceDescription, Mt as CodeSplittingNameFunction, N as TransformResult, Nt as CodeSplittingOptions, O as ResolveIdResult, Ot as BuiltinModuleTag, Pt as CommentsOptions, Qt as ModuleInfo, R as BundleError, Rt as MinifyOptions, S as ObjectHook, St as RolldownBuild, T as Plugin, Tt as AddonFunction, U as TransformPluginContext, Ut as PartialNull, V as OutputBundle, Vt as PreRenderedAsset, W as EmittedAsset, X as PluginContextResolveOptions, Xt as SourceMap, Y as PluginContext, Yt as RolldownOutput, Z as DefineParallelPluginResult, _ as HookFilterExtension, _t as RolldownWatcher, a as ChunkOptimizationOptions, at as RolldownDirectoryEntry, b as ModuleOptions, bt as WatchOptions, c as InputOption, ct as InternalModuleFormat, d as OptimizationOptions, dt as TransformOptions, et as PluginContextMeta, f as WatcherFileWatcherOptions, ft as ChecksOptions, g as FunctionPluginHooks, gt as watch, h as CustomPluginOptions, ht as RolldownMagicString, i as RolldownOptions, it as BufferEncoding, j as RolldownPluginOption, jt as CodeSplittingGroup, k as ResolvedId, kt as ChunkFileNamesFunction, l as InputOptions, lt as NormalizedOutputOptions, m as AsyncPluginHooks, mt as WarningHandlerWithDefault, n as RolldownOptionsFunction, nt as HookFilter, o as ExternalOption, ot as RolldownFileStats, p as WatcherOptions, pt as LoggingFunction, q as EmittedPrebuiltChunk, qt as RenderedChunk, r as defineConfig, rt as ModuleTypeFilter, s as ExternalOptionFunction, st as RolldownFsModule, t as ConfigExport, tt as GeneralHookFilter, u as ModuleTypes, ut as NormalizedInputOptions, v as ImportKind, vt as RolldownWatcherEvent, w as PartialResolvedId, wt as build, x as ModuleType, xt as rolldown, y as LoadResult, yt as RolldownWatcherWatcherEventMap, z as ExistingRawSourceMap, zt as ModuleFormat } from "./shared/define-config-B-IDOhDz.mjs";
export { type AddonFunction, type AdvancedChunksGroup, type AdvancedChunksOptions, type AsyncPluginHooks, type BufferEncoding, type BuildOptions, type BuiltinModuleTag, type BundleError, type ChecksOptions, type ChunkFileNamesFunction, type ChunkOptimizationOptions, type ChunkingContext, type CodeSplittingGroup, type CodeSplittingNameFunction, type CodeSplittingOptions, type CommentsOptions, type ConfigExport, type CustomPluginOptions, type DefineParallelPluginResult, type EmittedAsset, type EmittedChunk, type EmittedFile, type EmittedPrebuiltChunk, type ExistingRawSourceMap, type ExternalOption, type ExternalOptionFunction, type FunctionPluginHooks, type GeneralHookFilter, type GeneratedCodeOptions, type GeneratedCodePreset, type GetModuleInfo, type GlobalsFunction, type HookFilter, type HookFilterExtension, type ImportKind, type InputOption, type InputOptions, type InternalModuleFormat, type LoadResult, type LogLevel, type LogLevelOption, type LogOrStringHandler, type LoggingFunction, type MinifyOptions, type MinimalPluginContext, type ModuleFormat, type ModuleInfo, type ModuleOptions, type ModuleType, type ModuleTypeFilter, type ModuleTypes, type NormalizedInputOptions, type NormalizedOutputOptions, type ObjectHook, type OptimizationOptions, type OutputAsset, type OutputBundle, type OutputChunk, type OutputOptions, type ParallelPluginHooks, type PartialNull, type PartialResolvedId, type Plugin, type PluginContext, type PluginContextMeta, type PluginContextResolveOptions, type PluginMeta, type PreRenderedAsset, type PreRenderedChunk, RUNTIME_MODULE_ID, type RenderedChunk, type RenderedModule, type ResolveIdExtraOptions, type ResolveIdResult, type ResolvedId, type RolldownBuild, type RolldownDirectoryEntry, type RolldownError, type RolldownError as RollupError, type RolldownFileStats, type RolldownFsModule, type RolldownLog, type RolldownLog as RollupLog, type RolldownLogWithString, type RolldownLogWithString as RollupLogWithString, RolldownMagicString, type RolldownOptions, type RolldownOptionsFunction, type RolldownOutput, type RolldownPlugin, type RolldownPluginOption, type RolldownWatcher, type RolldownWatcherEvent, type RolldownWatcherWatcherEventMap, type SourceDescription, type SourceMap, type SourceMapInput, type SourcemapIgnoreListOption, type TransformOptions, type TransformPluginContext, type TransformResult, type TreeshakingOptions, VERSION, type WarningHandlerWithDefault, type WatchOptions, type WatcherFileWatcherOptions, type WatcherOptions, build, defineConfig, rolldown, watch };
import { B as PreRenderedChunk } from "./shared/binding-CVtkJvyl.mjs";
import { $t as ModuleInfo, A as ResolvedId, At as ChunkFileNamesFunction, B as ExistingRawSourceMap, Bt as ModuleFormat, C as ParallelPluginHooks, Ct as RolldownBuild, D as ResolveFileUrlArgs, Dt as AdvancedChunksGroup, E as PluginMeta, Et as AddonFunction, Ft as CommentsOptions, G as EmittedAsset, H as OutputBundle, Ht as PreRenderedAsset, It as GeneratedCodeOptions, J as EmittedPrebuiltChunk, Jt as RenderedChunk, K as EmittedChunk, Kt as OutputAsset, L as RUNTIME_MODULE_ID, Lt as GeneratedCodePreset, M as RolldownPluginOption, Mt as CodeSplittingGroup, N as SourceDescription, Nt as CodeSplittingNameFunction, O as ResolveIdExtraOptions, Ot as AdvancedChunksOptions, P as TransformResult, Pt as CodeSplittingOptions, Q as DefineParallelPluginResult, R as VERSION, Rt as GlobalsFunction, S as ObjectHook, St as rolldown, T as Plugin, Tt as build, U as TreeshakingOptions, V as SourceMapInput, Vt as OutputOptions, W as TransformPluginContext, Wt as PartialNull, X as PluginContext, Xt as RolldownOutput, Y as GetModuleInfo, Yt as RenderedModule, Z as PluginContextResolveOptions, Zt as SourceMap, _ as HookFilterExtension, _t as watch, a as ChunkOptimizationOptions, at as BufferEncoding, b as ModuleOptions, bt as RolldownWatcherWatcherEventMap, c as InputOption, ct as RolldownFsModule, d as OptimizationOptions, dt as NormalizedInputOptions, en as SourcemapIgnoreListOption, et as MinimalPluginContext, f as WatcherFileWatcherOptions, ft as TransformOptions, g as FunctionPluginHooks, gt as RolldownMagicString, h as CustomPluginOptions, ht as WarningHandlerWithDefault, i as RolldownOptions, it as ModuleTypeFilter, j as RolldownPlugin, jt as ChunkingContext, k as ResolveIdResult, kt as BuiltinModuleTag, l as InputOptions, lt as InternalModuleFormat, m as AsyncPluginHooks, mt as LoggingFunction, n as RolldownOptionsFunction, nt as GeneralHookFilter, o as ExternalOption, ot as RolldownDirectoryEntry, p as WatcherOptions, pt as ChecksOptions, q as EmittedFile, qt as OutputChunk, r as defineConfig, rt as HookFilter, s as ExternalOptionFunction, st as RolldownFileStats, t as ConfigExport, tt as PluginContextMeta, u as ModuleTypes, ut as NormalizedOutputOptions, v as ImportKind, vt as RolldownWatcher, w as PartialResolvedId, wt as BuildOptions, x as ModuleType, xt as WatchOptions, y as LoadResult, yt as RolldownWatcherEvent, z as BundleError, zt as MinifyOptions } from "./shared/define-config-DSMNXceb.mjs";
export { type AddonFunction, type AdvancedChunksGroup, type AdvancedChunksOptions, type AsyncPluginHooks, type BufferEncoding, type BuildOptions, type BuiltinModuleTag, type BundleError, type ChecksOptions, type ChunkFileNamesFunction, type ChunkOptimizationOptions, type ChunkingContext, type CodeSplittingGroup, type CodeSplittingNameFunction, type CodeSplittingOptions, type CommentsOptions, type ConfigExport, type CustomPluginOptions, type DefineParallelPluginResult, type EmittedAsset, type EmittedChunk, type EmittedFile, type EmittedPrebuiltChunk, type ExistingRawSourceMap, type ExternalOption, type ExternalOptionFunction, type FunctionPluginHooks, type GeneralHookFilter, type GeneratedCodeOptions, type GeneratedCodePreset, type GetModuleInfo, type GlobalsFunction, type HookFilter, type HookFilterExtension, type ImportKind, type InputOption, type InputOptions, type InternalModuleFormat, type LoadResult, type LogLevel, type LogLevelOption, type LogOrStringHandler, type LoggingFunction, type MinifyOptions, type MinimalPluginContext, type ModuleFormat, type ModuleInfo, type ModuleOptions, type ModuleType, type ModuleTypeFilter, type ModuleTypes, type NormalizedInputOptions, type NormalizedOutputOptions, type ObjectHook, type OptimizationOptions, type OutputAsset, type OutputBundle, type OutputChunk, type OutputOptions, type ParallelPluginHooks, type PartialNull, type PartialResolvedId, type Plugin, type PluginContext, type PluginContextMeta, type PluginContextResolveOptions, type PluginMeta, type PreRenderedAsset, type PreRenderedChunk, RUNTIME_MODULE_ID, type RenderedChunk, type RenderedModule, type ResolveFileUrlArgs, type ResolveIdExtraOptions, type ResolveIdResult, type ResolvedId, type RolldownBuild, type RolldownDirectoryEntry, type RolldownError, type RolldownError as RollupError, type RolldownFileStats, type RolldownFsModule, type RolldownLog, type RolldownLog as RollupLog, type RolldownLogWithString, type RolldownLogWithString as RollupLogWithString, RolldownMagicString, type RolldownOptions, type RolldownOptionsFunction, type RolldownOutput, type RolldownPlugin, type RolldownPluginOption, type RolldownWatcher, type RolldownWatcherEvent, type RolldownWatcherWatcherEventMap, type SourceDescription, type SourceMap, type SourceMapInput, type SourcemapIgnoreListOption, type TransformOptions, type TransformPluginContext, type TransformResult, type TreeshakingOptions, VERSION, type WarningHandlerWithDefault, type WatchOptions, type WatcherFileWatcherOptions, type WatcherOptions, build, defineConfig, rolldown, watch };

@@ -1,5 +0,5 @@

import { n as __toESM, t as require_binding } from "./shared/binding-Dby9rwGk.mjs";
import { n as onExit, t as watch } from "./shared/watch-WnrlHRS0.mjs";
import { b as VERSION, r as RolldownMagicString } from "./shared/bindingify-input-options-_ppP73I9.mjs";
import { t as rolldown } from "./shared/rolldown-951h_1lf.mjs";
import { n as __toESM, t as require_binding } from "./shared/binding-Cv62mM1i.mjs";
import { n as onExit, t as watch } from "./shared/watch-Cwq-cFUy.mjs";
import { r as RolldownMagicString, x as VERSION } from "./shared/bindingify-input-options-EnUlEF0T.mjs";
import { t as rolldown } from "./shared/rolldown-DP_p9pd3.mjs";
import { t as defineConfig } from "./shared/define-config-Demdg3_4.mjs";

@@ -6,0 +6,0 @@ import { isMainThread } from "node:worker_threads";

@@ -1,3 +0,3 @@

import { n as __toESM, t as require_binding } from "./shared/binding-Dby9rwGk.mjs";
import { i as PluginContextData, n as bindingifyPlugin } from "./shared/bindingify-input-options-_ppP73I9.mjs";
import { n as __toESM, t as require_binding } from "./shared/binding-Cv62mM1i.mjs";
import { i as PluginContextData, n as bindingifyPlugin } from "./shared/bindingify-input-options-EnUlEF0T.mjs";
import { parentPort, workerData } from "node:worker_threads";

@@ -4,0 +4,0 @@ //#region src/parallel-plugin-worker.ts

@@ -1,2 +0,2 @@

import { Ht as MaybePromise, T as Plugin } from "./shared/define-config-B-IDOhDz.mjs";
import { T as Plugin, Ut as MaybePromise } from "./shared/define-config-DSMNXceb.mjs";
//#region src/plugin/parallel-plugin-implementation.d.ts

@@ -3,0 +3,0 @@ type ParallelPluginImplementation = Plugin;

@@ -1,2 +0,2 @@

import { R as ParseResult$1, z as ParserOptions$1 } from "./shared/binding-Dbbi0RbO.mjs";
import { R as ParseResult$1, z as ParserOptions$1 } from "./shared/binding-CVtkJvyl.mjs";
import { Program } from "@oxc-project/types";

@@ -3,0 +3,0 @@ //#region src/parse-ast-index.d.ts

@@ -1,3 +0,3 @@

import { l as locate, n as error, s as logParseError, t as augmentCodeLocation, u as getCodeFrame } from "./shared/logs-ZGEh6uhb.mjs";
import { n as parseSync, t as parse } from "./shared/parse-BFj5G_7i.mjs";
import { c as logParseError, d as getCodeFrame, n as error, t as augmentCodeLocation, u as locate } from "./shared/logs-DmYCAKcW.mjs";
import { n as parseSync, t as parse } from "./shared/parse-DQIYJwT4.mjs";
//#region src/parse-ast-index.ts

@@ -4,0 +4,0 @@ function wrap(result, filename, sourceText) {

@@ -1,4 +0,4 @@

import { h as BindingReplacePluginConfig } from "./shared/binding-Dbbi0RbO.mjs";
import { F as BuiltinPlugin } from "./shared/define-config-B-IDOhDz.mjs";
import { t as esmExternalRequirePlugin } from "./shared/constructors-CSWbNgBZ.mjs";
import { h as BindingReplacePluginConfig } from "./shared/binding-CVtkJvyl.mjs";
import { I as BuiltinPlugin } from "./shared/define-config-DSMNXceb.mjs";
import { t as esmExternalRequirePlugin } from "./shared/constructors-ALilxAii.mjs";
//#region src/builtin-plugin/replace-plugin.d.ts

@@ -5,0 +5,0 @@ /**

@@ -1,3 +0,3 @@

import { a as makeBuiltinPluginCallable, n as BuiltinPlugin } from "./shared/normalize-string-or-regex-SiXbePVH.mjs";
import { t as esmExternalRequirePlugin } from "./shared/constructors-CuGa75s-.mjs";
import { a as makeBuiltinPluginCallable, n as BuiltinPlugin } from "./shared/normalize-string-or-regex-BVNGzRe4.mjs";
import { t as esmExternalRequirePlugin } from "./shared/constructors-CuqzPFxJ.mjs";
//#region src/builtin-plugin/replace-plugin.ts

@@ -4,0 +4,0 @@ /**

@@ -1,6 +0,6 @@

import { _ as BindingTsconfigCompilerOptions, v as BindingTsconfigRawOptions } from "./shared/binding-Dbbi0RbO.mjs";
import { a as MinifyOptions, c as minifySync, d as parse, f as parseSync, i as transformSync, l as ParseResult, n as TransformResult, o as MinifyResult, p as TsconfigCache, r as transform, s as minify, t as TransformOptions, u as ParserOptions } from "./shared/transform-Cs2bUDRH.mjs";
import { _ as BindingTsconfigCompilerOptions, v as BindingTsconfigRawOptions } from "./shared/binding-CVtkJvyl.mjs";
import { a as MinifyOptions, c as minifySync, d as parse, f as parseSync, i as transformSync, l as ParseResult, n as TransformResult, o as MinifyResult, p as TsconfigCache, r as transform, s as minify, t as TransformOptions, u as ParserOptions } from "./shared/transform-WmU_cI8e.mjs";
import * as ESTree from "@oxc-project/types";
import { Program } from "@oxc-project/types";
//#region ../../node_modules/.pnpm/oxc-parser@0.140.0/node_modules/oxc-parser/src-js/generated/visit/visitor.d.ts
//#region ../../node_modules/.pnpm/oxc-parser@0.142.0/node_modules/oxc-parser/src-js/generated/visit/visitor.d.ts
interface VisitorObject$1 {

@@ -7,0 +7,0 @@ DebuggerStatement?: (node: ESTree.DebuggerStatement) => void;

{
"name": "rolldown",
"version": "1.2.0",
"version": "1.2.1",
"description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.",

@@ -27,2 +27,4 @@ "keywords": [

"dist",
"LICENSE",
"THIRD-PARTY-LICENSE",
"!dist/*.node"

@@ -35,2 +37,3 @@ ],

"imports": {
"#default-runtime": "./dist/experimental-default-runtime.mjs",
"#parallel-plugin-worker": "./dist/parallel-plugin-worker.mjs"

@@ -45,2 +48,6 @@ },

},
"./experimental/runtime": {
"types": "./dist/experimental-runtime.d.ts",
"default": "./dist/experimental-runtime.mjs"
},
"./filter": "./dist/filter-index.mjs",

@@ -59,11 +66,11 @@ "./getLogFilter": "./dist/get-log-filter.mjs",

"dependencies": {
"@oxc-project/types": "=0.140.0",
"@oxc-project/types": "=0.142.0",
"@rolldown/pluginutils": "^1.0.0"
},
"devDependencies": {
"@napi-rs/cli": "^3.7.3",
"@napi-rs/wasm-runtime": "^1.1.6",
"@emnapi/core": "2.0.0-alpha.3",
"@emnapi/runtime": "2.0.0-alpha.3",
"@napi-rs/cli": "^3.8.0",
"@napi-rs/wasm-runtime": "^1.2.0",
"@oxc-node/cli": "^0.1.0",
"@rollup/plugin-json": "^6.1.0",
"buble": "^0.20.0",
"cac": "^7.0.0",

@@ -74,3 +81,3 @@ "consola": "^3.4.2",

"glob": "^13.0.0",
"oxc-parser": "=0.140.0",
"oxc-parser": "=0.142.0",
"pathe": "^2.0.3",

@@ -81,6 +88,6 @@ "remeda": "^2.34.1",

"signal-exit": "4.1.0",
"source-map": "0.7.6",
"source-map": "0.8.0",
"typescript": "^6.0.0",
"valibot": "1.4.2",
"rolldown": "1.2.0"
"rolldown": "1.2.1"
},

@@ -121,17 +128,17 @@ "napi": {

"optionalDependencies": {
"@rolldown/binding-darwin-x64": "1.2.0",
"@rolldown/binding-win32-x64-msvc": "1.2.0",
"@rolldown/binding-linux-x64-gnu": "1.2.0",
"@rolldown/binding-linux-x64-musl": "1.2.0",
"@rolldown/binding-freebsd-x64": "1.2.0",
"@rolldown/binding-linux-arm-gnueabihf": "1.2.0",
"@rolldown/binding-linux-arm64-gnu": "1.2.0",
"@rolldown/binding-darwin-arm64": "1.2.0",
"@rolldown/binding-linux-arm64-musl": "1.2.0",
"@rolldown/binding-openharmony-arm64": "1.2.0",
"@rolldown/binding-win32-arm64-msvc": "1.2.0",
"@rolldown/binding-android-arm64": "1.2.0",
"@rolldown/binding-wasm32-wasi": "1.2.0",
"@rolldown/binding-linux-s390x-gnu": "1.2.0",
"@rolldown/binding-linux-ppc64-gnu": "1.2.0"
"@rolldown/binding-darwin-x64": "1.2.1",
"@rolldown/binding-win32-x64-msvc": "1.2.1",
"@rolldown/binding-linux-x64-gnu": "1.2.1",
"@rolldown/binding-linux-x64-musl": "1.2.1",
"@rolldown/binding-freebsd-x64": "1.2.1",
"@rolldown/binding-linux-arm-gnueabihf": "1.2.1",
"@rolldown/binding-linux-arm64-gnu": "1.2.1",
"@rolldown/binding-darwin-arm64": "1.2.1",
"@rolldown/binding-linux-arm64-musl": "1.2.1",
"@rolldown/binding-openharmony-arm64": "1.2.1",
"@rolldown/binding-win32-arm64-msvc": "1.2.1",
"@rolldown/binding-android-arm64": "1.2.1",
"@rolldown/binding-wasm32-wasi": "1.2.1",
"@rolldown/binding-linux-s390x-gnu": "1.2.1",
"@rolldown/binding-linux-ppc64-gnu": "1.2.1"
},

@@ -138,0 +145,0 @@ "scripts": {

Sorry, the diff of this file is too big to display

import { createRequire } from "node:module";
//#region \0rolldown/runtime.js
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 __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
key = keys[i];
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
get: ((k) => from[k]).bind(null, key),
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
});
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
value: mod,
enumerable: true
}) : target, mod));
var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
//#endregion
//#region src/webcontainer-fallback.cjs
var require_webcontainer_fallback = /* @__PURE__ */ __commonJSMin(((exports, module) => {
const fs = __require("node:fs");
const childProcess = __require("node:child_process");
const version = JSON.parse(fs.readFileSync(__require.resolve("rolldown/package.json"), "utf-8")).version;
const baseDir = `/tmp/rolldown-${version}`;
const bindingEntry = `${baseDir}/node_modules/@rolldown/binding-wasm32-wasi/rolldown-binding.wasi.cjs`;
if (!fs.existsSync(bindingEntry)) {
const bindingPkg = `@rolldown/binding-wasm32-wasi@${version}`;
fs.rmSync(baseDir, {
recursive: true,
force: true
});
fs.mkdirSync(baseDir, { recursive: true });
console.log(`[rolldown] Downloading ${bindingPkg} on WebContainer...`);
childProcess.execFileSync("pnpm", ["i", bindingPkg], {
cwd: baseDir,
stdio: "inherit"
});
}
module.exports = __require(bindingEntry);
}));
//#endregion
//#region src/binding.cjs
var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
const { readFileSync } = __require("fs");
let nativeBinding = null;
const loadErrors = [];
const isMusl = () => {
let musl = false;
if (process.platform === "linux") {
musl = isMuslFromFilesystem();
if (musl === null) musl = isMuslFromReport();
if (musl === null) musl = isMuslFromChildProcess();
}
return musl;
};
const isFileMusl = (f) => f.includes("libc.musl-") || f.includes("ld-musl-");
const isMuslFromFilesystem = () => {
try {
return readFileSync("/usr/bin/ldd", "utf-8").includes("musl");
} catch {
return null;
}
};
const isMuslFromReport = () => {
let report = null;
if (process.report && typeof process.report.getReport === "function") {
process.report.excludeNetwork = true;
report = process.report.getReport();
}
if (!report) return null;
if (report.header && report.header.glibcVersionRuntime) return false;
if (Array.isArray(report.sharedObjects)) {
if (report.sharedObjects.some(isFileMusl)) return true;
}
return false;
};
const isMuslFromChildProcess = () => {
try {
return __require("child_process").execSync("ldd --version", { encoding: "utf8" }).includes("musl");
} catch (e) {
return false;
}
};
function requireNative() {
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) try {
return __require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
} catch (err) {
loadErrors.push(err);
}
else if (process.platform === "android") if (process.arch === "arm64") {
try {
return __require("./rolldown-binding.android-arm64.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-android-arm64");
const bindingPackageVersion = __require("@rolldown/binding-android-arm64/package.json").version;
if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else if (process.arch === "arm") {
try {
return __require("./rolldown-binding.android-arm-eabi.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-android-arm-eabi");
const bindingPackageVersion = __require("@rolldown/binding-android-arm-eabi/package.json").version;
if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Android ${process.arch}`));
else if (process.platform === "win32") if (process.arch === "x64") if (process.config && process.config.variables && process.config.variables.shlib_suffix === "dll.a" || process.config && process.config.variables && process.config.variables.node_target_type === "shared_library") {
try {
return __require("./rolldown-binding.win32-x64-gnu.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-win32-x64-gnu");
const bindingPackageVersion = __require("@rolldown/binding-win32-x64-gnu/package.json").version;
if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else {
try {
return __require("./rolldown-binding.win32-x64-msvc.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-win32-x64-msvc");
const bindingPackageVersion = __require("@rolldown/binding-win32-x64-msvc/package.json").version;
if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
}
else if (process.arch === "ia32") {
try {
return __require("./rolldown-binding.win32-ia32-msvc.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-win32-ia32-msvc");
const bindingPackageVersion = __require("@rolldown/binding-win32-ia32-msvc/package.json").version;
if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else if (process.arch === "arm64") {
try {
return __require("./rolldown-binding.win32-arm64-msvc.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-win32-arm64-msvc");
const bindingPackageVersion = __require("@rolldown/binding-win32-arm64-msvc/package.json").version;
if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Windows: ${process.arch}`));
else if (process.platform === "darwin") {
try {
return __require("./rolldown-binding.darwin-universal.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-darwin-universal");
const bindingPackageVersion = __require("@rolldown/binding-darwin-universal/package.json").version;
if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
if (process.arch === "x64") {
try {
return __require("./rolldown-binding.darwin-x64.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-darwin-x64");
const bindingPackageVersion = __require("@rolldown/binding-darwin-x64/package.json").version;
if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else if (process.arch === "arm64") {
try {
return __require("./rolldown-binding.darwin-arm64.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-darwin-arm64");
const bindingPackageVersion = __require("@rolldown/binding-darwin-arm64/package.json").version;
if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on macOS: ${process.arch}`));
} else if (process.platform === "freebsd") if (process.arch === "x64") {
try {
return __require("./rolldown-binding.freebsd-x64.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-freebsd-x64");
const bindingPackageVersion = __require("@rolldown/binding-freebsd-x64/package.json").version;
if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else if (process.arch === "arm64") {
try {
return __require("./rolldown-binding.freebsd-arm64.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-freebsd-arm64");
const bindingPackageVersion = __require("@rolldown/binding-freebsd-arm64/package.json").version;
if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on FreeBSD: ${process.arch}`));
else if (process.platform === "linux") if (process.arch === "x64") if (isMusl()) {
try {
return __require("./rolldown-binding.linux-x64-musl.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-linux-x64-musl");
const bindingPackageVersion = __require("@rolldown/binding-linux-x64-musl/package.json").version;
if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else {
try {
return __require("../rolldown-binding.linux-x64-gnu.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-linux-x64-gnu");
const bindingPackageVersion = __require("@rolldown/binding-linux-x64-gnu/package.json").version;
if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
}
else if (process.arch === "arm64") if (isMusl()) {
try {
return __require("./rolldown-binding.linux-arm64-musl.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-linux-arm64-musl");
const bindingPackageVersion = __require("@rolldown/binding-linux-arm64-musl/package.json").version;
if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else {
try {
return __require("./rolldown-binding.linux-arm64-gnu.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-linux-arm64-gnu");
const bindingPackageVersion = __require("@rolldown/binding-linux-arm64-gnu/package.json").version;
if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
}
else if (process.arch === "arm") if (isMusl()) {
try {
return __require("./rolldown-binding.linux-arm-musleabihf.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-linux-arm-musleabihf");
const bindingPackageVersion = __require("@rolldown/binding-linux-arm-musleabihf/package.json").version;
if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else {
try {
return __require("./rolldown-binding.linux-arm-gnueabihf.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-linux-arm-gnueabihf");
const bindingPackageVersion = __require("@rolldown/binding-linux-arm-gnueabihf/package.json").version;
if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
}
else if (process.arch === "loong64") if (isMusl()) {
try {
return __require("./rolldown-binding.linux-loong64-musl.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-linux-loong64-musl");
const bindingPackageVersion = __require("@rolldown/binding-linux-loong64-musl/package.json").version;
if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else {
try {
return __require("./rolldown-binding.linux-loong64-gnu.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-linux-loong64-gnu");
const bindingPackageVersion = __require("@rolldown/binding-linux-loong64-gnu/package.json").version;
if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
}
else if (process.arch === "riscv64") if (isMusl()) {
try {
return __require("./rolldown-binding.linux-riscv64-musl.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-linux-riscv64-musl");
const bindingPackageVersion = __require("@rolldown/binding-linux-riscv64-musl/package.json").version;
if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else {
try {
return __require("./rolldown-binding.linux-riscv64-gnu.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-linux-riscv64-gnu");
const bindingPackageVersion = __require("@rolldown/binding-linux-riscv64-gnu/package.json").version;
if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
}
else if (process.arch === "ppc64") {
try {
return __require("./rolldown-binding.linux-ppc64-gnu.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-linux-ppc64-gnu");
const bindingPackageVersion = __require("@rolldown/binding-linux-ppc64-gnu/package.json").version;
if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else if (process.arch === "s390x") {
try {
return __require("./rolldown-binding.linux-s390x-gnu.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-linux-s390x-gnu");
const bindingPackageVersion = __require("@rolldown/binding-linux-s390x-gnu/package.json").version;
if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Linux: ${process.arch}`));
else if (process.platform === "openharmony") if (process.arch === "arm64") {
try {
return __require("./rolldown-binding.openharmony-arm64.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-openharmony-arm64");
const bindingPackageVersion = __require("@rolldown/binding-openharmony-arm64/package.json").version;
if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else if (process.arch === "x64") {
try {
return __require("./rolldown-binding.openharmony-x64.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-openharmony-x64");
const bindingPackageVersion = __require("@rolldown/binding-openharmony-x64/package.json").version;
if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else if (process.arch === "arm") {
try {
return __require("./rolldown-binding.openharmony-arm.node");
} catch (e) {
loadErrors.push(e);
}
try {
const binding = __require("@rolldown/binding-openharmony-arm");
const bindingPackageVersion = __require("@rolldown/binding-openharmony-arm/package.json").version;
if (bindingPackageVersion !== "1.2.0" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.2.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
return binding;
} catch (e) {
loadErrors.push(e);
}
} else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`));
else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`));
}
nativeBinding = requireNative();
const forceWasi = process.env.NAPI_RS_FORCE_WASI === "true" || process.env.NAPI_RS_FORCE_WASI === "error";
if (!nativeBinding || forceWasi) {
let wasiBinding = null;
let wasiBindingError = null;
try {
wasiBinding = __require("../rolldown-binding.wasi.cjs");
nativeBinding = wasiBinding;
} catch (err) {
if (forceWasi) wasiBindingError = err;
}
if (!nativeBinding || forceWasi) try {
wasiBinding = __require("@rolldown/binding-wasm32-wasi");
nativeBinding = wasiBinding;
} catch (err) {
if (forceWasi) {
if (!wasiBindingError) wasiBindingError = err;
else wasiBindingError.cause = err;
loadErrors.push(err);
}
}
if (process.env.NAPI_RS_FORCE_WASI === "error" && !wasiBinding) {
const error = /* @__PURE__ */ new Error("WASI binding not found and NAPI_RS_FORCE_WASI is set to error");
error.cause = wasiBindingError;
throw error;
}
}
if (!nativeBinding && globalThis.process?.versions?.["webcontainer"]) try {
nativeBinding = require_webcontainer_fallback();
} catch (err) {
loadErrors.push(err);
}
if (!nativeBinding) {
if (loadErrors.length > 0) {
const error = /* @__PURE__ */ new Error("Cannot find native binding. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.");
error.cause = loadErrors.reduce((err, cur) => {
cur.cause = err;
return cur;
});
throw error;
}
throw new Error(`Failed to load native binding`);
}
module.exports = nativeBinding;
module.exports.LegalCommentsMode = nativeBinding.LegalCommentsMode;
module.exports.minify = nativeBinding.minify;
module.exports.minifySync = nativeBinding.minifySync;
module.exports.Severity = nativeBinding.Severity;
module.exports.ParseResult = nativeBinding.ParseResult;
module.exports.ExportExportNameKind = nativeBinding.ExportExportNameKind;
module.exports.ExportImportNameKind = nativeBinding.ExportImportNameKind;
module.exports.ExportLocalNameKind = nativeBinding.ExportLocalNameKind;
module.exports.ImportNameKind = nativeBinding.ImportNameKind;
module.exports.parse = nativeBinding.parse;
module.exports.parseSync = nativeBinding.parseSync;
module.exports.rawTransferSupported = nativeBinding.rawTransferSupported;
module.exports.ResolverFactory = nativeBinding.ResolverFactory;
module.exports.EnforceExtension = nativeBinding.EnforceExtension;
module.exports.ModuleType = nativeBinding.ModuleType;
module.exports.sync = nativeBinding.sync;
module.exports.HelperMode = nativeBinding.HelperMode;
module.exports.isolatedDeclaration = nativeBinding.isolatedDeclaration;
module.exports.isolatedDeclarationSync = nativeBinding.isolatedDeclarationSync;
module.exports.moduleRunnerTransform = nativeBinding.moduleRunnerTransform;
module.exports.moduleRunnerTransformSync = nativeBinding.moduleRunnerTransformSync;
module.exports.transform = nativeBinding.transform;
module.exports.transformSync = nativeBinding.transformSync;
module.exports.BindingBundleEndEventData = nativeBinding.BindingBundleEndEventData;
module.exports.BindingBundleErrorEventData = nativeBinding.BindingBundleErrorEventData;
module.exports.BindingBundler = nativeBinding.BindingBundler;
module.exports.BindingCallableBuiltinPlugin = nativeBinding.BindingCallableBuiltinPlugin;
module.exports.BindingChunkingContext = nativeBinding.BindingChunkingContext;
module.exports.BindingDecodedMap = nativeBinding.BindingDecodedMap;
module.exports.BindingDevEngine = nativeBinding.BindingDevEngine;
module.exports.BindingLoadPluginContext = nativeBinding.BindingLoadPluginContext;
module.exports.BindingMagicString = nativeBinding.BindingMagicString;
module.exports.BindingModuleInfo = nativeBinding.BindingModuleInfo;
module.exports.BindingNormalizedOptions = nativeBinding.BindingNormalizedOptions;
module.exports.BindingOutputAsset = nativeBinding.BindingOutputAsset;
module.exports.BindingOutputChunk = nativeBinding.BindingOutputChunk;
module.exports.BindingPluginContext = nativeBinding.BindingPluginContext;
module.exports.BindingRenderedChunk = nativeBinding.BindingRenderedChunk;
module.exports.BindingRenderedChunkMeta = nativeBinding.BindingRenderedChunkMeta;
module.exports.BindingRenderedModule = nativeBinding.BindingRenderedModule;
module.exports.BindingSourceMap = nativeBinding.BindingSourceMap;
module.exports.BindingTransformPluginContext = nativeBinding.BindingTransformPluginContext;
module.exports.BindingWatcher = nativeBinding.BindingWatcher;
module.exports.BindingWatcherBundler = nativeBinding.BindingWatcherBundler;
module.exports.BindingWatcherChangeData = nativeBinding.BindingWatcherChangeData;
module.exports.BindingWatcherEvent = nativeBinding.BindingWatcherEvent;
module.exports.ParallelJsPluginRegistry = nativeBinding.ParallelJsPluginRegistry;
module.exports.TraceSubscriberGuard = nativeBinding.TraceSubscriberGuard;
module.exports.TsconfigCache = nativeBinding.TsconfigCache;
module.exports.BindingAttachDebugInfo = nativeBinding.BindingAttachDebugInfo;
module.exports.BindingBuiltinPluginName = nativeBinding.BindingBuiltinPluginName;
module.exports.BindingChunkModuleOrderBy = nativeBinding.BindingChunkModuleOrderBy;
module.exports.BindingErrorStage = nativeBinding.BindingErrorStage;
module.exports.BindingLogLevel = nativeBinding.BindingLogLevel;
module.exports.BindingPluginOrder = nativeBinding.BindingPluginOrder;
module.exports.BindingPropertyReadSideEffects = nativeBinding.BindingPropertyReadSideEffects;
module.exports.BindingPropertyWriteSideEffects = nativeBinding.BindingPropertyWriteSideEffects;
module.exports.BindingRebuildStrategy = nativeBinding.BindingRebuildStrategy;
module.exports.collapseSourcemaps = nativeBinding.collapseSourcemaps;
module.exports.enhancedTransform = nativeBinding.enhancedTransform;
module.exports.enhancedTransformSync = nativeBinding.enhancedTransformSync;
module.exports.FilterTokenKind = nativeBinding.FilterTokenKind;
module.exports.initTraceSubscriber = nativeBinding.initTraceSubscriber;
module.exports.registerPlugins = nativeBinding.registerPlugins;
module.exports.resolveTsconfig = nativeBinding.resolveTsconfig;
module.exports.shutdownAsyncRuntime = nativeBinding.shutdownAsyncRuntime;
module.exports.startAsyncRuntime = nativeBinding.startAsyncRuntime;
}));
//#endregion
export { __toESM as n, require_binding as t };

Sorry, the diff of this file is too big to display

import { C as BindingViteJsonPluginConfig, D as BindingViteReporterPluginConfig, E as BindingViteReactRefreshWrapperPluginConfig, O as BindingViteResolvePluginConfig, S as BindingViteImportGlobPluginConfig, T as BindingViteModulePreloadPolyfillPluginConfig, b as BindingViteBuildImportAnalysisPluginConfig, l as BindingIsolatedDeclarationPluginConfig, s as BindingEsmExternalRequirePluginConfig, x as BindingViteDynamicImportVarsPluginConfig } from "./binding-Dbbi0RbO.mjs";
import { F as BuiltinPlugin, Wt as StringOrRegExp } from "./define-config-B-IDOhDz.mjs";
//#region src/builtin-plugin/constructors.d.ts
declare function viteModulePreloadPolyfillPlugin(config?: BindingViteModulePreloadPolyfillPluginConfig): BuiltinPlugin;
type DynamicImportVarsPluginConfig = Omit<BindingViteDynamicImportVarsPluginConfig, "include" | "exclude"> & {
include?: StringOrRegExp | StringOrRegExp[];
exclude?: StringOrRegExp | StringOrRegExp[];
};
declare function viteDynamicImportVarsPlugin(config?: DynamicImportVarsPluginConfig): BuiltinPlugin;
declare function viteImportGlobPlugin(config?: BindingViteImportGlobPluginConfig): BuiltinPlugin;
declare function viteReporterPlugin(config: BindingViteReporterPluginConfig): BuiltinPlugin;
declare function viteLoadFallbackPlugin(): BuiltinPlugin;
declare function viteJsonPlugin(config: BindingViteJsonPluginConfig): BuiltinPlugin;
declare function viteBuildImportAnalysisPlugin(config: BindingViteBuildImportAnalysisPluginConfig): BuiltinPlugin;
declare function viteResolvePlugin(config: Omit<BindingViteResolvePluginConfig, "yarnPnp">): BuiltinPlugin;
declare function isolatedDeclarationPlugin(config?: BindingIsolatedDeclarationPluginConfig): BuiltinPlugin;
declare function viteWebWorkerPostPlugin(): BuiltinPlugin;
/**
* A plugin that converts CommonJS require() calls for external dependencies into ESM import statements.
*
* @see https://rolldown.rs/builtin-plugins/esm-external-require
* @category Builtin Plugins
*/
declare function esmExternalRequirePlugin(config?: BindingEsmExternalRequirePluginConfig): BuiltinPlugin;
type ViteReactRefreshWrapperPluginConfig = Omit<BindingViteReactRefreshWrapperPluginConfig, "include" | "exclude"> & {
include?: StringOrRegExp | StringOrRegExp[];
exclude?: StringOrRegExp | StringOrRegExp[];
};
/**
* This plugin should not be used for Rolldown.
*/
declare function oxcRuntimePlugin(): BuiltinPlugin;
declare function viteReactRefreshWrapperPlugin(config: ViteReactRefreshWrapperPluginConfig): BuiltinPlugin;
//#endregion
export { viteDynamicImportVarsPlugin as a, viteLoadFallbackPlugin as c, viteReporterPlugin as d, viteResolvePlugin as f, viteBuildImportAnalysisPlugin as i, viteModulePreloadPolyfillPlugin as l, isolatedDeclarationPlugin as n, viteImportGlobPlugin as o, viteWebWorkerPostPlugin as p, oxcRuntimePlugin as r, viteJsonPlugin as s, esmExternalRequirePlugin as t, viteReactRefreshWrapperPlugin as u };
import { a as makeBuiltinPluginCallable, n as BuiltinPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-SiXbePVH.mjs";
//#region src/builtin-plugin/constructors.ts
function viteModulePreloadPolyfillPlugin(config) {
return new BuiltinPlugin("builtin:vite-module-preload-polyfill", config);
}
function viteDynamicImportVarsPlugin(config) {
if (config) {
config.include = normalizedStringOrRegex(config.include);
config.exclude = normalizedStringOrRegex(config.exclude);
}
return new BuiltinPlugin("builtin:vite-dynamic-import-vars", config);
}
function viteImportGlobPlugin(config) {
return new BuiltinPlugin("builtin:vite-import-glob", config);
}
function viteReporterPlugin(config) {
return new BuiltinPlugin("builtin:vite-reporter", config);
}
function viteLoadFallbackPlugin() {
return new BuiltinPlugin("builtin:vite-load-fallback");
}
function viteJsonPlugin(config) {
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:vite-json", config));
}
function viteBuildImportAnalysisPlugin(config) {
return new BuiltinPlugin("builtin:vite-build-import-analysis", config);
}
function viteResolvePlugin(config) {
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:vite-resolve", {
...config,
yarnPnp: typeof process === "object" && !!process.versions?.pnp
}));
}
function isolatedDeclarationPlugin(config) {
return new BuiltinPlugin("builtin:isolated-declaration", config);
}
function viteWebWorkerPostPlugin() {
return new BuiltinPlugin("builtin:vite-web-worker-post");
}
/**
* A plugin that converts CommonJS require() calls for external dependencies into ESM import statements.
*
* @see https://rolldown.rs/builtin-plugins/esm-external-require
* @category Builtin Plugins
*/
function esmExternalRequirePlugin(config) {
const plugin = new BuiltinPlugin("builtin:esm-external-require", config);
plugin.enforce = "pre";
return plugin;
}
/**
* This plugin should not be used for Rolldown.
*/
function oxcRuntimePlugin() {
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:oxc-runtime"));
}
function viteReactRefreshWrapperPlugin(config) {
if (config) {
config.include = normalizedStringOrRegex(config.include);
config.exclude = normalizedStringOrRegex(config.exclude);
}
return makeBuiltinPluginCallable(new BuiltinPlugin("builtin:vite-react-refresh-wrapper", config));
}
//#endregion
export { viteDynamicImportVarsPlugin as a, viteLoadFallbackPlugin as c, viteReporterPlugin as d, viteResolvePlugin as f, viteBuildImportAnalysisPlugin as i, viteModulePreloadPolyfillPlugin as l, isolatedDeclarationPlugin as n, viteImportGlobPlugin as o, viteWebWorkerPostPlugin as p, oxcRuntimePlugin as r, viteJsonPlugin as s, esmExternalRequirePlugin as t, viteReactRefreshWrapperPlugin as u };

Sorry, the diff of this file is too big to display

import { t as require_binding } from "./binding-Dby9rwGk.mjs";
//#region src/types/sourcemap.ts
function bindingifySourcemap(map) {
if (map == null) return;
return { inner: typeof map === "string" ? map : {
file: map.file ?? void 0,
mappings: map.mappings,
sourceRoot: "sourceRoot" in map ? map.sourceRoot ?? void 0 : void 0,
sources: map.sources?.map((s) => s ?? void 0),
sourcesContent: map.sourcesContent?.map((s) => s ?? void 0),
names: map.names,
x_google_ignoreList: map.x_google_ignoreList,
debugId: "debugId" in map ? map.debugId : void 0
} };
}
require_binding();
function unwrapBindingResult(container) {
if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) throw aggregateBindingErrorsIntoJsError(container.errors);
return container;
}
function normalizeBindingResult(container) {
if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) return aggregateBindingErrorsIntoJsError(container.errors);
return container;
}
function normalizeBindingError(e) {
return e.type === "JsError" ? e.field0 : Object.assign(/* @__PURE__ */ new Error(), {
code: e.field0.kind,
kind: e.field0.kind,
message: e.field0.message,
id: e.field0.id,
exporter: e.field0.exporter,
loc: e.field0.loc,
pos: e.field0.pos,
stack: void 0
});
}
function aggregateBindingErrorsIntoJsError(rawErrors) {
const errors = rawErrors.map(normalizeBindingError);
let summary = `Build failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
for (let i = 0; i < errors.length; i++) {
summary += "\n";
if (i >= 5) {
summary += "...";
break;
}
summary += getErrorMessage(errors[i]);
}
const wrapper = new Error(summary);
Object.defineProperty(wrapper, "errors", {
configurable: true,
enumerable: true,
get: () => errors,
set: (value) => Object.defineProperty(wrapper, "errors", {
configurable: true,
enumerable: true,
value
})
});
return wrapper;
}
function getErrorMessage(e) {
if (Object.hasOwn(e, "kind")) return e.message;
let s = "";
if (e.plugin) s += `[plugin ${e.plugin}]`;
const id = e.id ?? e.loc?.file;
if (id) {
s += " " + id;
if (e.loc) s += `:${e.loc.line}:${e.loc.column}`;
}
if (s) s += "\n";
const message = `${e.name ?? "Error"}: ${e.message}`;
s += message;
if (e.frame) s = joinNewLine(s, e.frame);
if (e.stack) s = joinNewLine(s, e.stack.replace(message, ""));
if (e.cause) {
s = joinNewLine(s, "Caused by:");
s = joinNewLine(s, getErrorMessage(e.cause).split("\n").map((line) => " " + line).join("\n"));
}
return s;
}
function joinNewLine(s1, s2) {
return s1.replace(/\n+$/, "") + "\n" + s2.replace(/^\n+/, "");
}
//#endregion
export { bindingifySourcemap as a, unwrapBindingResult as i, normalizeBindingError as n, normalizeBindingResult as r, aggregateBindingErrorsIntoJsError as t };
import { t as rolldown } from "./rolldown-951h_1lf.mjs";
import fs from "node:fs";
import path from "node:path";
import { readdir } from "node:fs/promises";
import { cwd } from "node:process";
import { pathToFileURL } from "node:url";
//#region src/utils/load-config.ts
async function bundleTsConfig(configFile, isEsm) {
const dirnameVarName = "injected_original_dirname";
const filenameVarName = "injected_original_filename";
const importMetaUrlVarName = "injected_original_import_meta_url";
const bundle = await rolldown({
input: configFile,
platform: "node",
resolve: { mainFields: ["main"] },
transform: { define: {
__dirname: dirnameVarName,
__filename: filenameVarName,
"import.meta.url": importMetaUrlVarName,
"import.meta.dirname": dirnameVarName,
"import.meta.filename": filenameVarName
} },
treeshake: false,
external: [/^[\w@][^:]/],
plugins: [{
name: "inject-file-scope-variables",
transform: {
filter: { id: /\.[cm]?[jt]s$/ },
async handler(code, id) {
return {
code: `const ${dirnameVarName} = ${JSON.stringify(path.dirname(id))};const ${filenameVarName} = ${JSON.stringify(id)};const ${importMetaUrlVarName} = ${JSON.stringify(pathToFileURL(id).href)};` + code,
map: null
};
}
}
}]
});
const outputDir = path.dirname(configFile);
const fileName = (await bundle.write({
dir: outputDir,
format: isEsm ? "esm" : "cjs",
sourcemap: "inline",
entryFileNames: `rolldown.config.[hash]${path.extname(configFile).replace("ts", "js")}`
})).output.find((chunk) => chunk.type === "chunk" && chunk.isEntry).fileName;
return path.join(outputDir, fileName);
}
const SUPPORTED_JS_CONFIG_FORMATS = [
".js",
".mjs",
".cjs"
];
const SUPPORTED_TS_CONFIG_FORMATS = [
".ts",
".mts",
".cts"
];
const SUPPORTED_CONFIG_FORMATS = [...SUPPORTED_JS_CONFIG_FORMATS, ...SUPPORTED_TS_CONFIG_FORMATS];
const DEFAULT_CONFIG_BASE = "rolldown.config";
async function findConfigFileNameInCwd() {
const filesInWorkingDirectory = new Set(await readdir(cwd()));
for (const extension of SUPPORTED_CONFIG_FORMATS) {
const fileName = `${DEFAULT_CONFIG_BASE}${extension}`;
if (filesInWorkingDirectory.has(fileName)) return fileName;
}
throw new Error("No `rolldown.config` configuration file found.");
}
async function loadTsConfig(configFile) {
const file = await bundleTsConfig(configFile, isFilePathESM(configFile));
try {
return (await import(pathToFileURL(file).href)).default;
} finally {
fs.unlink(file, () => {});
}
}
function isFilePathESM(filePath) {
if (/\.m[jt]s$/.test(filePath)) return true;
else if (/\.c[jt]s$/.test(filePath)) return false;
else {
const pkg = findNearestPackageData(path.dirname(filePath));
if (pkg) return pkg.type === "module";
return false;
}
}
function findNearestPackageData(basedir) {
while (basedir) {
const pkgPath = path.join(basedir, "package.json");
if (tryStatSync(pkgPath)?.isFile()) try {
return JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
} catch {}
const nextBasedir = path.dirname(basedir);
if (nextBasedir === basedir) break;
basedir = nextBasedir;
}
return null;
}
function tryStatSync(file) {
try {
return fs.statSync(file, { throwIfNoEntry: false });
} catch {}
}
async function loadNativeConfig(resolvedPath) {
const url = pathToFileURL(resolvedPath).href;
const { freshImport } = await import("./dist-DKbukT1H.mjs");
const freshImported = freshImport(url);
if (freshImported) {
const { result } = await freshImported;
return result.default;
}
return (await import(url + "?t=" + Date.now())).default;
}
/**
* Load config from a file in a way that Rolldown does.
*
* @param configPath The path to the config file. If empty, it will look for `rolldown.config` with supported extensions in the current working directory.
* @param options Loading options. `configLoader` selects `'bundle'` (default) or `'native'`.
* @returns The loaded config export
*
* @category Config
*/
async function loadConfig(configPath, options = {}) {
const configLoader = options.configLoader ?? "bundle";
const ext = path.extname(configPath = configPath || await findConfigFileNameInCwd());
try {
if (configLoader === "native") return await loadNativeConfig(path.resolve(configPath));
if (SUPPORTED_JS_CONFIG_FORMATS.includes(ext) || process.env.NODE_OPTIONS?.includes("--import=tsx") && SUPPORTED_TS_CONFIG_FORMATS.includes(ext)) return (await import(pathToFileURL(configPath).href)).default;
else if (SUPPORTED_TS_CONFIG_FORMATS.includes(ext)) return await loadTsConfig(path.resolve(configPath));
else throw new Error(`Unsupported config format. Expected: \`${SUPPORTED_CONFIG_FORMATS.join(",")}\` but got \`${ext}\``);
} catch (err) {
if (configLoader === "native") {
const tsHint = SUPPORTED_TS_CONFIG_FORMATS.includes(ext) && !process.features.typescript ? " This runtime does not natively support TypeScript config files." : "";
throw new Error(`Failed to load the config file "${configPath}" using the "native" config loader.${tsHint} Try "--configLoader bundle", or register a loader such as "--import tsx".`, { cause: err });
}
throw new Error("Error happened while loading config.", { cause: err });
}
}
//#endregion
export { loadConfig as t };
//#region src/utils/code-frame.ts
function spaces(index) {
let result = "";
while (index--) result += " ";
return result;
}
function tabsToSpaces(value) {
return value.replace(/^\t+/, (match) => match.split(" ").join(" "));
}
const LINE_TRUNCATE_LENGTH = 120;
const MIN_CHARACTERS_SHOWN_AFTER_LOCATION = 10;
const ELLIPSIS = "...";
function getCodeFrame(source, line, column) {
let lines = source.split("\n");
if (line > lines.length) return "";
const maxLineLength = Math.max(tabsToSpaces(lines[line - 1].slice(0, column)).length + MIN_CHARACTERS_SHOWN_AFTER_LOCATION + 3, LINE_TRUNCATE_LENGTH);
const frameStart = Math.max(0, line - 3);
let frameEnd = Math.min(line + 2, lines.length);
lines = lines.slice(frameStart, frameEnd);
while (!/\S/.test(lines[lines.length - 1])) {
lines.pop();
frameEnd -= 1;
}
const digits = String(frameEnd).length;
return lines.map((sourceLine, index) => {
const isErrorLine = frameStart + index + 1 === line;
let lineNumber = String(index + frameStart + 1);
while (lineNumber.length < digits) lineNumber = ` ${lineNumber}`;
let displayedLine = tabsToSpaces(sourceLine);
if (displayedLine.length > maxLineLength) displayedLine = `${displayedLine.slice(0, maxLineLength - 3)}${ELLIPSIS}`;
if (isErrorLine) {
const indicator = spaces(digits + 2 + tabsToSpaces(sourceLine.slice(0, column)).length) + "^";
return `${lineNumber}: ${displayedLine}\n${indicator}`;
}
return `${lineNumber}: ${displayedLine}`;
}).join("\n");
}
//#endregion
//#region src/log/locate-character/index.js
/** @typedef {import('./types').Location} Location */
/**
* @param {import('./types').Range} range
* @param {number} index
*/
function rangeContains(range, index) {
return range.start <= index && index < range.end;
}
/**
* @param {string} source
* @param {import('./types').Options} [options]
*/
function getLocator(source, options = {}) {
const { offsetLine = 0, offsetColumn = 0 } = options;
let start = 0;
const ranges = source.split("\n").map((line, i) => {
const end = start + line.length + 1;
/** @type {import('./types').Range} */
const range = {
start,
end,
line: i
};
start = end;
return range;
});
let i = 0;
/**
* @param {string | number} search
* @param {number} [index]
* @returns {Location | undefined}
*/
function locator(search, index) {
if (typeof search === "string") search = source.indexOf(search, index ?? 0);
if (search === -1) return void 0;
let range = ranges[i];
const d = search >= range.end ? 1 : -1;
while (range) {
if (rangeContains(range, search)) return {
line: offsetLine + range.line,
column: offsetColumn + search - range.start,
character: search
};
i += d;
range = ranges[i];
}
}
return locator;
}
/**
* @param {string} source
* @param {string | number} search
* @param {import('./types').Options} [options]
* @returns {Location | undefined}
*/
function locate(source, search, options) {
return getLocator(source, options)(search, options && options.startIndex);
}
//#endregion
//#region src/log/logs.ts
const INVALID_LOG_POSITION = "INVALID_LOG_POSITION";
const PLUGIN_ERROR = "PLUGIN_ERROR";
const INPUT_HOOK_IN_OUTPUT_PLUGIN = "INPUT_HOOK_IN_OUTPUT_PLUGIN";
const CYCLE_LOADING = "CYCLE_LOADING";
const MULTIPLE_WATCHER_OPTION = "MULTIPLE_WATCHER_OPTION";
const PARSE_ERROR = "PARSE_ERROR";
function logParseError(message, id, pos) {
return {
code: PARSE_ERROR,
id,
message,
pos
};
}
function logInvalidLogPosition(pluginName) {
return {
code: INVALID_LOG_POSITION,
message: `Plugin "${pluginName}" tried to add a file position to a log or warning. This is only supported in the "transform" hook at the moment and will be ignored.`
};
}
function logInputHookInOutputPlugin(pluginName, hookName) {
return {
code: INPUT_HOOK_IN_OUTPUT_PLUGIN,
message: `The "${hookName}" hook used by the output plugin ${pluginName} is a build time hook and will not be run for that plugin. Either this plugin cannot be used as an output plugin, or it should have an option to configure it as an output plugin.`
};
}
function logCycleLoading(pluginName, moduleId) {
return {
code: CYCLE_LOADING,
message: `Found the module "${moduleId}" cycle loading at ${pluginName} plugin, it maybe blocking fetching modules.`
};
}
function logMultipleWatcherOption() {
return {
code: MULTIPLE_WATCHER_OPTION,
message: `Found multiple watcher options at watch options, using first one to start watcher.`
};
}
function logPluginError(error, plugin, { hook, id } = {}) {
try {
const code = error.code;
if (!error.pluginCode && code != null && (typeof code !== "string" || !code.startsWith("PLUGIN_"))) error.pluginCode = code;
error.code = PLUGIN_ERROR;
error.plugin = plugin;
if (hook) error.hook = hook;
if (id) error.id = id;
} catch (_) {} finally {
return error;
}
}
function error(base) {
if (!(base instanceof Error)) {
base = Object.assign(new Error(base.message), base);
Object.defineProperty(base, "name", {
value: "RolldownError",
writable: true
});
}
throw base;
}
function augmentCodeLocation(properties, pos, source, id) {
if (typeof pos === "object") {
const { line, column } = pos;
properties.loc = {
column,
file: id,
line
};
} else {
properties.pos = pos;
const location = locate(source, pos, { offsetLine: 1 });
if (!location) return;
const { line, column } = location;
properties.loc = {
column,
file: id,
line
};
}
if (properties.frame === void 0) {
const { line, column } = properties.loc;
properties.frame = getCodeFrame(source, line, column);
}
}
//#endregion
export { logInvalidLogPosition as a, logPluginError as c, logInputHookInOutputPlugin as i, locate as l, error as n, logMultipleWatcherOption as o, logCycleLoading as r, logParseError as s, augmentCodeLocation as t, getCodeFrame as u };
//#region src/utils/misc.ts
function arraify(value) {
return Array.isArray(value) ? value : [value];
}
function isPromiseLike(value) {
return value && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
}
function unimplemented(info) {
if (info) throw new Error(`unimplemented: ${info}`);
throw new Error("unimplemented");
}
function unreachable(info) {
if (info) throw new Error(`unreachable: ${info}`);
throw new Error("unreachable");
}
function unsupported(info) {
throw new Error(`UNSUPPORTED: ${info}`);
}
function noop(..._args) {}
//#endregion
export { unreachable as a, unimplemented as i, isPromiseLike as n, unsupported as o, noop as r, arraify as t };
import { n as __toESM, t as require_binding } from "./binding-Dby9rwGk.mjs";
import { c as logPluginError, n as error } from "./logs-ZGEh6uhb.mjs";
//#region src/builtin-plugin/utils.ts
var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
var BuiltinPlugin = class {
name;
_options;
/** Vite-specific option to control plugin ordering */
enforce;
constructor(name, _options) {
this.name = name;
this._options = _options;
}
};
function makeBuiltinPluginCallable(plugin) {
let callablePlugin = new import_binding.BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
const wrappedPlugin = plugin;
for (const key in callablePlugin) {
const wrappedHook = async function(...args) {
try {
return await callablePlugin[key](...args);
} catch (e) {
if (e instanceof Error && !e.stack?.includes("at ")) Error.captureStackTrace(e, wrappedPlugin[key]);
return error(logPluginError(e, plugin.name, {
hook: key,
id: key === "transform" ? args[2] : void 0
}));
}
};
const order = callablePlugin.getOrder(key);
if (order == void 0) wrappedPlugin[key] = wrappedHook;
else wrappedPlugin[key] = {
handler: wrappedHook,
order
};
}
return wrappedPlugin;
}
function bindingifyBuiltInPlugin(plugin) {
return {
__name: plugin.name,
options: plugin._options
};
}
function bindingifyManifestPlugin(plugin, pluginContextData) {
const { isOutputOptionsForLegacyChunks, ...options } = plugin._options;
return {
__name: plugin.name,
options: {
...options,
isLegacy: isOutputOptionsForLegacyChunks ? (opts) => {
return isOutputOptionsForLegacyChunks(pluginContextData.getOutputOptions(opts));
} : void 0
}
};
}
//#endregion
//#region src/utils/normalize-string-or-regex.ts
function normalizedStringOrRegex(pattern) {
if (!pattern) return;
if (!isReadonlyArray(pattern)) return [pattern];
return pattern;
}
function isReadonlyArray(input) {
return Array.isArray(input);
}
//#endregion
export { makeBuiltinPluginCallable as a, bindingifyManifestPlugin as i, BuiltinPlugin as n, bindingifyBuiltInPlugin as r, normalizedStringOrRegex as t };
import { n as __toESM, t as require_binding } from "./binding-Dby9rwGk.mjs";
//#region ../../node_modules/.pnpm/oxc-parser@0.140.0/node_modules/oxc-parser/src-js/wrap.js
var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
function wrap(result) {
let program, module, comments, errors;
return {
get program() {
if (!program) program = jsonParseAst(result.program);
return program;
},
get module() {
if (!module) module = result.module;
return module;
},
get comments() {
if (!comments) comments = result.comments;
return comments;
},
get errors() {
if (!errors) errors = result.errors;
return errors;
}
};
}
function jsonParseAst(programJson) {
const { node: program, fixes } = JSON.parse(programJson);
for (const fixPath of fixes) applyFix(program, fixPath);
return program;
}
function applyFix(program, fixPath) {
let node = program;
for (const key of fixPath) node = node[key];
if (node.bigint) node.value = BigInt(node.bigint);
else try {
node.value = RegExp(node.regex.pattern, node.regex.flags);
} catch {}
}
//#endregion
//#region src/utils/parse.ts
/**
* Parse JS/TS source asynchronously on a separate thread.
*
* Note that not all of the workload can happen on a separate thread.
* Parsing on Rust side does happen in a separate thread, but deserialization of the AST to JS objects
* has to happen on current thread. This synchronous deserialization work typically outweighs
* the asynchronous parsing by a factor of between 3 and 20.
*
* i.e. the majority of the workload cannot be parallelized by using this method.
*
* Generally {@linkcode parseSync} is preferable to use as it does not have the overhead of spawning a thread.
* If you need to parallelize parsing multiple files, it is recommended to use worker threads.
*
* @category Utilities
*/
async function parse(filename, sourceText, options) {
return wrap(await (0, import_binding.parse)(filename, sourceText, options));
}
/**
* Parse JS/TS source synchronously on current thread.
*
* This is generally preferable over {@linkcode parse} (async) as it does not have the overhead
* of spawning a thread, and the majority of the workload cannot be parallelized anyway
* (see {@linkcode parse} documentation for details).
*
* If you need to parallelize parsing multiple files, it is recommended to use worker threads
* with {@linkcode parseSync} rather than using {@linkcode parse}.
*
* @category Utilities
*/
function parseSync(filename, sourceText, options) {
return wrap((0, import_binding.parseSync)(filename, sourceText, options));
}
//#endregion
export { parseSync as n, parse as t };
import g$1, { stdin, stdout } from "node:process";
import { WriteStream } from "node:tty";
import f from "node:readline";
//#region ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/chunks/prompt.mjs
function getDefaultExportFromCjs(x) {
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
}
var src;
var hasRequiredSrc;
function requireSrc() {
if (hasRequiredSrc) return src;
hasRequiredSrc = 1;
const ESC = "\x1B";
const CSI = `${ESC}[`;
const beep = "\x07";
const cursor = {
to(x, y) {
if (!y) return `${CSI}${x + 1}G`;
return `${CSI}${y + 1};${x + 1}H`;
},
move(x, y) {
let ret = "";
if (x < 0) ret += `${CSI}${-x}D`;
else if (x > 0) ret += `${CSI}${x}C`;
if (y < 0) ret += `${CSI}${-y}A`;
else if (y > 0) ret += `${CSI}${y}B`;
return ret;
},
up: (count = 1) => `${CSI}${count}A`,
down: (count = 1) => `${CSI}${count}B`,
forward: (count = 1) => `${CSI}${count}C`,
backward: (count = 1) => `${CSI}${count}D`,
nextLine: (count = 1) => `${CSI}E`.repeat(count),
prevLine: (count = 1) => `${CSI}F`.repeat(count),
left: `${CSI}G`,
hide: `${CSI}?25l`,
show: `${CSI}?25h`,
save: `${ESC}7`,
restore: `${ESC}8`
};
src = {
cursor,
scroll: {
up: (count = 1) => `${CSI}S`.repeat(count),
down: (count = 1) => `${CSI}T`.repeat(count)
},
erase: {
screen: `${CSI}2J`,
up: (count = 1) => `${CSI}1J`.repeat(count),
down: (count = 1) => `${CSI}J`.repeat(count),
line: `${CSI}2K`,
lineEnd: `${CSI}K`,
lineStart: `${CSI}1K`,
lines(count) {
let clear = "";
for (let i = 0; i < count; i++) clear += this.line + (i < count - 1 ? cursor.up() : "");
if (count) clear += cursor.left;
return clear;
}
},
beep
};
return src;
}
var srcExports = requireSrc();
var picocolors = { exports: {} };
var hasRequiredPicocolors;
function requirePicocolors() {
if (hasRequiredPicocolors) return picocolors.exports;
hasRequiredPicocolors = 1;
let p = process || {}, argv = p.argv || [], env = p.env || {};
let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
let formatter = (open, close, replace = open) => (input) => {
let string = "" + input, index = string.indexOf(close, open.length);
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
};
let replaceClose = (string, close, replace, index) => {
let result = "", cursor = 0;
do {
result += string.substring(cursor, index) + replace;
cursor = index + close.length;
index = string.indexOf(close, cursor);
} while (~index);
return result + string.substring(cursor);
};
let createColors = (enabled = isColorSupported) => {
let f = enabled ? formatter : () => String;
return {
isColorSupported: enabled,
reset: f("\x1B[0m", "\x1B[0m"),
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
italic: f("\x1B[3m", "\x1B[23m"),
underline: f("\x1B[4m", "\x1B[24m"),
inverse: f("\x1B[7m", "\x1B[27m"),
hidden: f("\x1B[8m", "\x1B[28m"),
strikethrough: f("\x1B[9m", "\x1B[29m"),
black: f("\x1B[30m", "\x1B[39m"),
red: f("\x1B[31m", "\x1B[39m"),
green: f("\x1B[32m", "\x1B[39m"),
yellow: f("\x1B[33m", "\x1B[39m"),
blue: f("\x1B[34m", "\x1B[39m"),
magenta: f("\x1B[35m", "\x1B[39m"),
cyan: f("\x1B[36m", "\x1B[39m"),
white: f("\x1B[37m", "\x1B[39m"),
gray: f("\x1B[90m", "\x1B[39m"),
bgBlack: f("\x1B[40m", "\x1B[49m"),
bgRed: f("\x1B[41m", "\x1B[49m"),
bgGreen: f("\x1B[42m", "\x1B[49m"),
bgYellow: f("\x1B[43m", "\x1B[49m"),
bgBlue: f("\x1B[44m", "\x1B[49m"),
bgMagenta: f("\x1B[45m", "\x1B[49m"),
bgCyan: f("\x1B[46m", "\x1B[49m"),
bgWhite: f("\x1B[47m", "\x1B[49m"),
blackBright: f("\x1B[90m", "\x1B[39m"),
redBright: f("\x1B[91m", "\x1B[39m"),
greenBright: f("\x1B[92m", "\x1B[39m"),
yellowBright: f("\x1B[93m", "\x1B[39m"),
blueBright: f("\x1B[94m", "\x1B[39m"),
magentaBright: f("\x1B[95m", "\x1B[39m"),
cyanBright: f("\x1B[96m", "\x1B[39m"),
whiteBright: f("\x1B[97m", "\x1B[39m"),
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
bgRedBright: f("\x1B[101m", "\x1B[49m"),
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
};
};
picocolors.exports = createColors();
picocolors.exports.createColors = createColors;
return picocolors.exports;
}
const e = /*@__PURE__*/ getDefaultExportFromCjs(/* @__PURE__ */ requirePicocolors());
function J({ onlyFirst: t = false } = {}) {
const F = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
return new RegExp(F, t ? void 0 : "g");
}
const Q = J();
function T$1(t) {
if (typeof t != "string") throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);
return t.replace(Q, "");
}
function O(t) {
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
}
var P$1 = { exports: {} };
(function(t) {
var u = {};
t.exports = u, u.eastAsianWidth = function(e) {
var s = e.charCodeAt(0), i = e.length == 2 ? e.charCodeAt(1) : 0, D = s;
return 55296 <= s && s <= 56319 && 56320 <= i && i <= 57343 && (s &= 1023, i &= 1023, D = s << 10 | i, D += 65536), D == 12288 || 65281 <= D && D <= 65376 || 65504 <= D && D <= 65510 ? "F" : D == 8361 || 65377 <= D && D <= 65470 || 65474 <= D && D <= 65479 || 65482 <= D && D <= 65487 || 65490 <= D && D <= 65495 || 65498 <= D && D <= 65500 || 65512 <= D && D <= 65518 ? "H" : 4352 <= D && D <= 4447 || 4515 <= D && D <= 4519 || 4602 <= D && D <= 4607 || 9001 <= D && D <= 9002 || 11904 <= D && D <= 11929 || 11931 <= D && D <= 12019 || 12032 <= D && D <= 12245 || 12272 <= D && D <= 12283 || 12289 <= D && D <= 12350 || 12353 <= D && D <= 12438 || 12441 <= D && D <= 12543 || 12549 <= D && D <= 12589 || 12593 <= D && D <= 12686 || 12688 <= D && D <= 12730 || 12736 <= D && D <= 12771 || 12784 <= D && D <= 12830 || 12832 <= D && D <= 12871 || 12880 <= D && D <= 13054 || 13056 <= D && D <= 19903 || 19968 <= D && D <= 42124 || 42128 <= D && D <= 42182 || 43360 <= D && D <= 43388 || 44032 <= D && D <= 55203 || 55216 <= D && D <= 55238 || 55243 <= D && D <= 55291 || 63744 <= D && D <= 64255 || 65040 <= D && D <= 65049 || 65072 <= D && D <= 65106 || 65108 <= D && D <= 65126 || 65128 <= D && D <= 65131 || 110592 <= D && D <= 110593 || 127488 <= D && D <= 127490 || 127504 <= D && D <= 127546 || 127552 <= D && D <= 127560 || 127568 <= D && D <= 127569 || 131072 <= D && D <= 194367 || 177984 <= D && D <= 196605 || 196608 <= D && D <= 262141 ? "W" : 32 <= D && D <= 126 || 162 <= D && D <= 163 || 165 <= D && D <= 166 || D == 172 || D == 175 || 10214 <= D && D <= 10221 || 10629 <= D && D <= 10630 ? "Na" : D == 161 || D == 164 || 167 <= D && D <= 168 || D == 170 || 173 <= D && D <= 174 || 176 <= D && D <= 180 || 182 <= D && D <= 186 || 188 <= D && D <= 191 || D == 198 || D == 208 || 215 <= D && D <= 216 || 222 <= D && D <= 225 || D == 230 || 232 <= D && D <= 234 || 236 <= D && D <= 237 || D == 240 || 242 <= D && D <= 243 || 247 <= D && D <= 250 || D == 252 || D == 254 || D == 257 || D == 273 || D == 275 || D == 283 || 294 <= D && D <= 295 || D == 299 || 305 <= D && D <= 307 || D == 312 || 319 <= D && D <= 322 || D == 324 || 328 <= D && D <= 331 || D == 333 || 338 <= D && D <= 339 || 358 <= D && D <= 359 || D == 363 || D == 462 || D == 464 || D == 466 || D == 468 || D == 470 || D == 472 || D == 474 || D == 476 || D == 593 || D == 609 || D == 708 || D == 711 || 713 <= D && D <= 715 || D == 717 || D == 720 || 728 <= D && D <= 731 || D == 733 || D == 735 || 768 <= D && D <= 879 || 913 <= D && D <= 929 || 931 <= D && D <= 937 || 945 <= D && D <= 961 || 963 <= D && D <= 969 || D == 1025 || 1040 <= D && D <= 1103 || D == 1105 || D == 8208 || 8211 <= D && D <= 8214 || 8216 <= D && D <= 8217 || 8220 <= D && D <= 8221 || 8224 <= D && D <= 8226 || 8228 <= D && D <= 8231 || D == 8240 || 8242 <= D && D <= 8243 || D == 8245 || D == 8251 || D == 8254 || D == 8308 || D == 8319 || 8321 <= D && D <= 8324 || D == 8364 || D == 8451 || D == 8453 || D == 8457 || D == 8467 || D == 8470 || 8481 <= D && D <= 8482 || D == 8486 || D == 8491 || 8531 <= D && D <= 8532 || 8539 <= D && D <= 8542 || 8544 <= D && D <= 8555 || 8560 <= D && D <= 8569 || D == 8585 || 8592 <= D && D <= 8601 || 8632 <= D && D <= 8633 || D == 8658 || D == 8660 || D == 8679 || D == 8704 || 8706 <= D && D <= 8707 || 8711 <= D && D <= 8712 || D == 8715 || D == 8719 || D == 8721 || D == 8725 || D == 8730 || 8733 <= D && D <= 8736 || D == 8739 || D == 8741 || 8743 <= D && D <= 8748 || D == 8750 || 8756 <= D && D <= 8759 || 8764 <= D && D <= 8765 || D == 8776 || D == 8780 || D == 8786 || 8800 <= D && D <= 8801 || 8804 <= D && D <= 8807 || 8810 <= D && D <= 8811 || 8814 <= D && D <= 8815 || 8834 <= D && D <= 8835 || 8838 <= D && D <= 8839 || D == 8853 || D == 8857 || D == 8869 || D == 8895 || D == 8978 || 9312 <= D && D <= 9449 || 9451 <= D && D <= 9547 || 9552 <= D && D <= 9587 || 9600 <= D && D <= 9615 || 9618 <= D && D <= 9621 || 9632 <= D && D <= 9633 || 9635 <= D && D <= 9641 || 9650 <= D && D <= 9651 || 9654 <= D && D <= 9655 || 9660 <= D && D <= 9661 || 9664 <= D && D <= 9665 || 9670 <= D && D <= 9672 || D == 9675 || 9678 <= D && D <= 9681 || 9698 <= D && D <= 9701 || D == 9711 || 9733 <= D && D <= 9734 || D == 9737 || 9742 <= D && D <= 9743 || 9748 <= D && D <= 9749 || D == 9756 || D == 9758 || D == 9792 || D == 9794 || 9824 <= D && D <= 9825 || 9827 <= D && D <= 9829 || 9831 <= D && D <= 9834 || 9836 <= D && D <= 9837 || D == 9839 || 9886 <= D && D <= 9887 || 9918 <= D && D <= 9919 || 9924 <= D && D <= 9933 || 9935 <= D && D <= 9953 || D == 9955 || 9960 <= D && D <= 9983 || D == 10045 || D == 10071 || 10102 <= D && D <= 10111 || 11093 <= D && D <= 11097 || 12872 <= D && D <= 12879 || 57344 <= D && D <= 63743 || 65024 <= D && D <= 65039 || D == 65533 || 127232 <= D && D <= 127242 || 127248 <= D && D <= 127277 || 127280 <= D && D <= 127337 || 127344 <= D && D <= 127386 || 917760 <= D && D <= 917999 || 983040 <= D && D <= 1048573 || 1048576 <= D && D <= 1114109 ? "A" : "N";
}, u.characterLength = function(e) {
var s = this.eastAsianWidth(e);
return s == "F" || s == "W" || s == "A" ? 2 : 1;
};
function F(e) {
return e.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
}
u.length = function(e) {
for (var s = F(e), i = 0, D = 0; D < s.length; D++) i = i + this.characterLength(s[D]);
return i;
}, u.slice = function(e, s, i) {
textLen = u.length(e), s = s || 0, i = i || 1, s < 0 && (s = textLen + s), i < 0 && (i = textLen + i);
for (var D = "", C = 0, o = F(e), E = 0; E < o.length; E++) {
var a = o[E], n = u.length(a);
if (C >= s - (n == 2 ? 1 : 0)) if (C + n <= i) D += a;
else break;
C += n;
}
return D;
};
})(P$1);
var X = P$1.exports;
const DD = O(X);
var uD = function() {
return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
};
const FD = O(uD);
function A$1(t, u = {}) {
if (typeof t != "string" || t.length === 0 || (u = {
ambiguousIsNarrow: true,
...u
}, t = T$1(t), t.length === 0)) return 0;
t = t.replace(FD(), " ");
const F = u.ambiguousIsNarrow ? 1 : 2;
let e = 0;
for (const s of t) {
const i = s.codePointAt(0);
if (i <= 31 || i >= 127 && i <= 159 || i >= 768 && i <= 879) continue;
switch (DD.eastAsianWidth(s)) {
case "F":
case "W":
e += 2;
break;
case "A":
e += F;
break;
default: e += 1;
}
}
return e;
}
const m = 10;
const L$1 = (t = 0) => (u) => `\x1B[${u + t}m`;
const N = (t = 0) => (u) => `\x1B[${38 + t};5;${u}m`;
const I = (t = 0) => (u, F, e) => `\x1B[${38 + t};2;${u};${F};${e}m`;
const r = {
modifier: {
reset: [0, 0],
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],
blackBright: [90, 39],
gray: [90, 39],
grey: [90, 39],
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],
bgBlackBright: [100, 49],
bgGray: [100, 49],
bgGrey: [100, 49],
bgRedBright: [101, 49],
bgGreenBright: [102, 49],
bgYellowBright: [103, 49],
bgBlueBright: [104, 49],
bgMagentaBright: [105, 49],
bgCyanBright: [106, 49],
bgWhiteBright: [107, 49]
}
};
Object.keys(r.modifier);
const tD = Object.keys(r.color);
const eD = Object.keys(r.bgColor);
[...tD, ...eD];
function sD() {
const t = /* @__PURE__ */ new Map();
for (const [u, F] of Object.entries(r)) {
for (const [e, s] of Object.entries(F)) r[e] = {
open: `\x1B[${s[0]}m`,
close: `\x1B[${s[1]}m`
}, F[e] = r[e], t.set(s[0], s[1]);
Object.defineProperty(r, u, {
value: F,
enumerable: false
});
}
return Object.defineProperty(r, "codes", {
value: t,
enumerable: false
}), r.color.close = "\x1B[39m", r.bgColor.close = "\x1B[49m", r.color.ansi = L$1(), r.color.ansi256 = N(), r.color.ansi16m = I(), r.bgColor.ansi = L$1(m), r.bgColor.ansi256 = N(m), r.bgColor.ansi16m = I(m), Object.defineProperties(r, {
rgbToAnsi256: {
value: (u, F, e) => u === F && F === e ? u < 8 ? 16 : u > 248 ? 231 : Math.round((u - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(u / 255 * 5) + 6 * Math.round(F / 255 * 5) + Math.round(e / 255 * 5),
enumerable: false
},
hexToRgb: {
value: (u) => {
const F = /[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));
if (!F) return [
0,
0,
0
];
let [e] = F;
e.length === 3 && (e = [...e].map((i) => i + i).join(""));
const s = Number.parseInt(e, 16);
return [
s >> 16 & 255,
s >> 8 & 255,
s & 255
];
},
enumerable: false
},
hexToAnsi256: {
value: (u) => r.rgbToAnsi256(...r.hexToRgb(u)),
enumerable: false
},
ansi256ToAnsi: {
value: (u) => {
if (u < 8) return 30 + u;
if (u < 16) return 90 + (u - 8);
let F, e, s;
if (u >= 232) F = ((u - 232) * 10 + 8) / 255, e = F, s = F;
else {
u -= 16;
const C = u % 36;
F = Math.floor(u / 36) / 5, e = Math.floor(C / 6) / 5, s = C % 6 / 5;
}
const i = Math.max(F, e, s) * 2;
if (i === 0) return 30;
let D = 30 + (Math.round(s) << 2 | Math.round(e) << 1 | Math.round(F));
return i === 2 && (D += 60), D;
},
enumerable: false
},
rgbToAnsi: {
value: (u, F, e) => r.ansi256ToAnsi(r.rgbToAnsi256(u, F, e)),
enumerable: false
},
hexToAnsi: {
value: (u) => r.ansi256ToAnsi(r.hexToAnsi256(u)),
enumerable: false
}
}), r;
}
const iD = sD();
const v = /* @__PURE__ */ new Set(["\x1B", "›"]);
const CD = 39;
const w$1 = "\x07";
const W$1 = "[";
const rD = "]";
const R = "m";
const y = `${rD}8;;`;
const V$1 = (t) => `${v.values().next().value}${W$1}${t}${R}`;
const z = (t) => `${v.values().next().value}${y}${t}${w$1}`;
const ED = (t) => t.split(" ").map((u) => A$1(u));
const _ = (t, u, F) => {
const e = [...u];
let s = false, i = false, D = A$1(T$1(t[t.length - 1]));
for (const [C, o] of e.entries()) {
const E = A$1(o);
if (D + E <= F ? t[t.length - 1] += o : (t.push(o), D = 0), v.has(o) && (s = true, i = e.slice(C + 1).join("").startsWith(y)), s) {
i ? o === w$1 && (s = false, i = false) : o === R && (s = false);
continue;
}
D += E, D === F && C < e.length - 1 && (t.push(""), D = 0);
}
!D && t[t.length - 1].length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
};
const nD = (t) => {
const u = t.split(" ");
let F = u.length;
for (; F > 0 && !(A$1(u[F - 1]) > 0);) F--;
return F === u.length ? t : u.slice(0, F).join(" ") + u.slice(F).join("");
};
const oD = (t, u, F = {}) => {
if (F.trim !== false && t.trim() === "") return "";
let e = "", s, i;
const D = ED(t);
let C = [""];
for (const [E, a] of t.split(" ").entries()) {
F.trim !== false && (C[C.length - 1] = C[C.length - 1].trimStart());
let n = A$1(C[C.length - 1]);
if (E !== 0 && (n >= u && (F.wordWrap === false || F.trim === false) && (C.push(""), n = 0), (n > 0 || F.trim === false) && (C[C.length - 1] += " ", n++)), F.hard && D[E] > u) {
const B = u - n, p = 1 + Math.floor((D[E] - B - 1) / u);
Math.floor((D[E] - 1) / u) < p && C.push(""), _(C, a, u);
continue;
}
if (n + D[E] > u && n > 0 && D[E] > 0) {
if (F.wordWrap === false && n < u) {
_(C, a, u);
continue;
}
C.push("");
}
if (n + D[E] > u && F.wordWrap === false) {
_(C, a, u);
continue;
}
C[C.length - 1] += a;
}
F.trim !== false && (C = C.map((E) => nD(E)));
const o = [...C.join(`
`)];
for (const [E, a] of o.entries()) {
if (e += a, v.has(a)) {
const { groups: B } = new RegExp(`(?:\\${W$1}(?<code>\\d+)m|\\${y}(?<uri>.*)${w$1})`).exec(o.slice(E).join("")) || { groups: {} };
if (B.code !== void 0) {
const p = Number.parseFloat(B.code);
s = p === CD ? void 0 : p;
} else B.uri !== void 0 && (i = B.uri.length === 0 ? void 0 : B.uri);
}
const n = iD.codes.get(Number(s));
o[E + 1] === `
` ? (i && (e += z("")), s && n && (e += V$1(n))) : a === `
` && (s && n && (e += V$1(s)), i && (e += z(i)));
}
return e;
};
function G(t, u, F) {
return String(t).normalize().replace(/\r\n/g, `
`).split(`
`).map((e) => oD(e, u, F)).join(`
`);
}
const c = {
actions: /* @__PURE__ */ new Set([
"up",
"down",
"left",
"right",
"space",
"enter",
"cancel"
]),
aliases: /* @__PURE__ */ new Map([
["k", "up"],
["j", "down"],
["h", "left"],
["l", "right"],
["", "cancel"],
["escape", "cancel"]
])
};
function k$1(t, u) {
if (typeof t == "string") return c.aliases.get(t) === u;
for (const F of t) if (F !== void 0 && k$1(F, u)) return true;
return false;
}
function lD(t, u) {
if (t === u) return;
const F = t.split(`
`), e = u.split(`
`), s = [];
for (let i = 0; i < Math.max(F.length, e.length); i++) F[i] !== e[i] && s.push(i);
return s;
}
globalThis.process.platform.startsWith("win");
const S = Symbol("clack:cancel");
function d$1(t, u) {
const F = t;
F.isTTY && F.setRawMode(u);
}
var AD = Object.defineProperty;
var pD = (t, u, F) => u in t ? AD(t, u, {
enumerable: true,
configurable: true,
writable: true,
value: F
}) : t[u] = F;
var h = (t, u, F) => (pD(t, typeof u != "symbol" ? u + "" : u, F), F);
var x = class {
constructor(u, F = true) {
h(this, "input"), h(this, "output"), h(this, "_abortSignal"), h(this, "rl"), h(this, "opts"), h(this, "_render"), h(this, "_track", false), h(this, "_prevFrame", ""), h(this, "_subscribers", /* @__PURE__ */ new Map()), h(this, "_cursor", 0), h(this, "state", "initial"), h(this, "error", ""), h(this, "value");
const { input: e = stdin, output: s = stdout, render: i, signal: D, ...C } = u;
this.opts = C, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = i.bind(this), this._track = F, this._abortSignal = D, this.input = e, this.output = s;
}
unsubscribe() {
this._subscribers.clear();
}
setSubscriber(u, F) {
const e = this._subscribers.get(u) ?? [];
e.push(F), this._subscribers.set(u, e);
}
on(u, F) {
this.setSubscriber(u, { cb: F });
}
once(u, F) {
this.setSubscriber(u, {
cb: F,
once: true
});
}
emit(u, ...F) {
const e = this._subscribers.get(u) ?? [], s = [];
for (const i of e) i.cb(...F), i.once && s.push(() => e.splice(e.indexOf(i), 1));
for (const i of s) i();
}
prompt() {
return new Promise((u, F) => {
if (this._abortSignal) {
if (this._abortSignal.aborted) return this.state = "cancel", this.close(), u(S);
this._abortSignal.addEventListener("abort", () => {
this.state = "cancel", this.close();
}, { once: true });
}
const e = new WriteStream(0);
e._write = (s, i, D) => {
this._track && (this.value = this.rl?.line.replace(/\t/g, ""), this._cursor = this.rl?.cursor ?? 0, this.emit("value", this.value)), D();
}, this.input.pipe(e), this.rl = f.createInterface({
input: this.input,
output: e,
tabSize: 2,
prompt: "",
escapeCodeTimeout: 50
}), f.emitKeypressEvents(this.input, this.rl), this.rl.prompt(), this.opts.initialValue !== void 0 && this._track && this.rl.write(this.opts.initialValue), this.input.on("keypress", this.onKeypress), d$1(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
this.output.write(srcExports.cursor.show), this.output.off("resize", this.render), d$1(this.input, false), u(this.value);
}), this.once("cancel", () => {
this.output.write(srcExports.cursor.show), this.output.off("resize", this.render), d$1(this.input, false), u(S);
});
});
}
onKeypress(u, F) {
if (this.state === "error" && (this.state = "active"), F?.name && (!this._track && c.aliases.has(F.name) && this.emit("cursor", c.aliases.get(F.name)), c.actions.has(F.name) && this.emit("cursor", F.name)), u && (u.toLowerCase() === "y" || u.toLowerCase() === "n") && this.emit("confirm", u.toLowerCase() === "y"), u === " " && this.opts.placeholder && (this.value || (this.rl?.write(this.opts.placeholder), this.emit("value", this.opts.placeholder))), u && this.emit("key", u.toLowerCase()), F?.name === "return") {
if (this.opts.validate) {
const e = this.opts.validate(this.value);
e && (this.error = e instanceof Error ? e.message : e, this.state = "error", this.rl?.write(this.value));
}
this.state !== "error" && (this.state = "submit");
}
k$1([
u,
F?.name,
F?.sequence
], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
}
close() {
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
`), d$1(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
}
restoreCursor() {
const u = G(this._prevFrame, process.stdout.columns, { hard: true }).split(`
`).length - 1;
this.output.write(srcExports.cursor.move(-999, u * -1));
}
render() {
const u = G(this._render(this) ?? "", process.stdout.columns, { hard: true });
if (u !== this._prevFrame) {
if (this.state === "initial") this.output.write(srcExports.cursor.hide);
else {
const F = lD(this._prevFrame, u);
if (this.restoreCursor(), F && F?.length === 1) {
const e = F[0];
this.output.write(srcExports.cursor.move(0, e)), this.output.write(srcExports.erase.lines(1));
const s = u.split(`
`);
this.output.write(s[e]), this._prevFrame = u, this.output.write(srcExports.cursor.move(0, s.length - e - 1));
return;
}
if (F && F?.length > 1) {
const e = F[0];
this.output.write(srcExports.cursor.move(0, e)), this.output.write(srcExports.erase.down());
const s = u.split(`
`).slice(e);
this.output.write(s.join(`
`)), this._prevFrame = u;
return;
}
this.output.write(srcExports.erase.down());
}
this.output.write(u), this.state === "initial" && (this.state = "active"), this._prevFrame = u;
}
}
};
var fD = class extends x {
get cursor() {
return this.value ? 0 : 1;
}
get _value() {
return this.cursor === 0;
}
constructor(u) {
super(u, false), this.value = !!u.initialValue, this.on("value", () => {
this.value = this._value;
}), this.on("confirm", (F) => {
this.output.write(srcExports.cursor.move(0, -1)), this.value = F, this.state = "submit", this.close();
}), this.on("cursor", () => {
this.value = !this.value;
});
}
};
var bD = Object.defineProperty;
var mD = (t, u, F) => u in t ? bD(t, u, {
enumerable: true,
configurable: true,
writable: true,
value: F
}) : t[u] = F;
var Y = (t, u, F) => (mD(t, typeof u != "symbol" ? u + "" : u, F), F);
let wD = class extends x {
constructor(u) {
super(u, false), Y(this, "options"), Y(this, "cursor", 0), this.options = u.options, this.value = [...u.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: F }) => F === u.cursorAt), 0), this.on("key", (F) => {
F === "a" && this.toggleAll();
}), this.on("cursor", (F) => {
switch (F) {
case "left":
case "up":
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
break;
case "down":
case "right":
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
break;
case "space":
this.toggleValue();
break;
}
});
}
get _value() {
return this.options[this.cursor].value;
}
toggleAll() {
const u = this.value.length === this.options.length;
this.value = u ? [] : this.options.map((F) => F.value);
}
toggleValue() {
const u = this.value.includes(this._value);
this.value = u ? this.value.filter((F) => F !== this._value) : [...this.value, this._value];
}
};
var SD = Object.defineProperty;
var $D = (t, u, F) => u in t ? SD(t, u, {
enumerable: true,
configurable: true,
writable: true,
value: F
}) : t[u] = F;
var q = (t, u, F) => ($D(t, typeof u != "symbol" ? u + "" : u, F), F);
var jD = class extends x {
constructor(u) {
super(u, false), q(this, "options"), q(this, "cursor", 0), this.options = u.options, this.cursor = this.options.findIndex(({ value: F }) => F === u.initialValue), this.cursor === -1 && (this.cursor = 0), this.changeValue(), this.on("cursor", (F) => {
switch (F) {
case "left":
case "up":
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
break;
case "down":
case "right":
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
break;
}
this.changeValue();
});
}
get _value() {
return this.options[this.cursor];
}
changeValue() {
this.value = this._value.value;
}
};
var PD = class extends x {
get valueWithCursor() {
if (this.state === "submit") return this.value;
if (this.cursor >= this.value.length) return `${this.value}\u2588`;
const u = this.value.slice(0, this.cursor), [F, ...e$1] = this.value.slice(this.cursor);
return `${u}${e.inverse(F)}${e$1.join("")}`;
}
get cursor() {
return this._cursor;
}
constructor(u) {
super(u), this.on("finalize", () => {
this.value || (this.value = u.defaultValue);
});
}
};
function ce() {
return g$1.platform !== "win32" ? g$1.env.TERM !== "linux" : !!g$1.env.CI || !!g$1.env.WT_SESSION || !!g$1.env.TERMINUS_SUBLIME || g$1.env.ConEmuTask === "{cmd::Cmder}" || g$1.env.TERM_PROGRAM === "Terminus-Sublime" || g$1.env.TERM_PROGRAM === "vscode" || g$1.env.TERM === "xterm-256color" || g$1.env.TERM === "alacritty" || g$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
}
const V = ce();
const u = (t, n) => V ? t : n;
const le = u("❯", ">");
const L = u("■", "x");
const W = u("▲", "x");
const C = u("✔", "√");
const o = u("");
const d = u("");
const k = u("●", ">");
const P = u("○", " ");
const A = u("◻", "[•]");
const T = u("◼", "[+]");
const F = u("◻", "[ ]");
const w = (t) => {
switch (t) {
case "initial":
case "active": return e.cyan(le);
case "cancel": return e.red(L);
case "error": return e.yellow(W);
case "submit": return e.green(C);
}
};
const B = (t) => {
const { cursor: n, options: s, style: r } = t, i = t.maxItems ?? Number.POSITIVE_INFINITY, a = Math.max(process.stdout.rows - 4, 0), c = Math.min(a, Math.max(i, 5));
let l = 0;
n >= l + c - 3 ? l = Math.max(Math.min(n - c + 3, s.length - c), 0) : n < l + 2 && (l = Math.max(n - 2, 0));
const $ = c < s.length && l > 0, p = c < s.length && l + c < s.length;
return s.slice(l, l + c).map((M, v, x) => {
const j = v === 0 && $, E = v === x.length - 1 && p;
return j || E ? e.dim("...") : r(M, v + l === n);
});
};
const he = (t) => new PD({
validate: t.validate,
placeholder: t.placeholder,
defaultValue: t.defaultValue,
initialValue: t.initialValue,
render() {
const n = `${e.gray(o)}
${w(this.state)} ${t.message}
`, s = t.placeholder ? e.inverse(t.placeholder[0]) + e.dim(t.placeholder.slice(1)) : e.inverse(e.hidden("_")), r = this.value ? this.valueWithCursor : s;
switch (this.state) {
case "error": return `${n.trim()}
${e.yellow(o)} ${r}
${e.yellow(d)} ${e.yellow(this.error)}
`;
case "submit": return `${n}${e.gray(o)} ${e.dim(this.value || t.placeholder)}`;
case "cancel": return `${n}${e.gray(o)} ${e.strikethrough(e.dim(this.value ?? ""))}${this.value?.trim() ? `
${e.gray(o)}` : ""}`;
default: return `${n}${e.cyan(o)} ${r}
${e.cyan(d)}
`;
}
}
}).prompt();
const ye = (t) => {
const n = t.active ?? "Yes", s = t.inactive ?? "No";
return new fD({
active: n,
inactive: s,
initialValue: t.initialValue ?? true,
render() {
const r = `${e.gray(o)}
${w(this.state)} ${t.message}
`, i = this.value ? n : s;
switch (this.state) {
case "submit": return `${r}${e.gray(o)} ${e.dim(i)}`;
case "cancel": return `${r}${e.gray(o)} ${e.strikethrough(e.dim(i))}
${e.gray(o)}`;
default: return `${r}${e.cyan(o)} ${this.value ? `${e.green(k)} ${n}` : `${e.dim(P)} ${e.dim(n)}`} ${e.dim("/")} ${this.value ? `${e.dim(P)} ${e.dim(s)}` : `${e.green(k)} ${s}`}
${e.cyan(d)}
`;
}
}
}).prompt();
};
const ve = (t) => {
const n = (s, r) => {
const i = s.label ?? String(s.value);
switch (r) {
case "selected": return `${e.dim(i)}`;
case "active": return `${e.green(k)} ${i} ${s.hint ? e.dim(`(${s.hint})`) : ""}`;
case "cancelled": return `${e.strikethrough(e.dim(i))}`;
default: return `${e.dim(P)} ${e.dim(i)}`;
}
};
return new jD({
options: t.options,
initialValue: t.initialValue,
render() {
const s = `${e.gray(o)}
${w(this.state)} ${t.message}
`;
switch (this.state) {
case "submit": return `${s}${e.gray(o)} ${n(this.options[this.cursor], "selected")}`;
case "cancel": return `${s}${e.gray(o)} ${n(this.options[this.cursor], "cancelled")}
${e.gray(o)}`;
default: return `${s}${e.cyan(o)} ${B({
cursor: this.cursor,
options: this.options,
maxItems: t.maxItems,
style: (r, i) => n(r, i ? "active" : "inactive")
}).join(`
${e.cyan(o)} `)}
${e.cyan(d)}
`;
}
}
}).prompt();
};
const fe = (t) => {
const n = (s, r) => {
const i = s.label ?? String(s.value);
return r === "active" ? `${e.cyan(A)} ${i} ${s.hint ? e.dim(`(${s.hint})`) : ""}` : r === "selected" ? `${e.green(T)} ${e.dim(i)}` : r === "cancelled" ? `${e.strikethrough(e.dim(i))}` : r === "active-selected" ? `${e.green(T)} ${i} ${s.hint ? e.dim(`(${s.hint})`) : ""}` : r === "submitted" ? `${e.dim(i)}` : `${e.dim(F)} ${e.dim(i)}`;
};
return new wD({
options: t.options,
initialValues: t.initialValues,
required: t.required ?? true,
cursorAt: t.cursorAt,
validate(s) {
if (this.required && s.length === 0) return `Please select at least one option.
${e.reset(e.dim(`Press ${e.gray(e.bgWhite(e.inverse(" space ")))} to select, ${e.gray(e.bgWhite(e.inverse(" enter ")))} to submit`))}`;
},
render() {
const s = `${e.gray(o)}
${w(this.state)} ${t.message}
`, r = (i, a) => {
const c = this.value.includes(i.value);
return a && c ? n(i, "active-selected") : c ? n(i, "selected") : n(i, a ? "active" : "inactive");
};
switch (this.state) {
case "submit": return `${s}${e.gray(o)} ${this.options.filter(({ value: i }) => this.value.includes(i)).map((i) => n(i, "submitted")).join(e.dim(", ")) || e.dim("none")}`;
case "cancel": {
const i = this.options.filter(({ value: a }) => this.value.includes(a)).map((a) => n(a, "cancelled")).join(e.dim(", "));
return `${s}${e.gray(o)} ${i.trim() ? `${i}
${e.gray(o)}` : ""}`;
}
case "error": {
const i = this.error.split(`
`).map((a, c) => c === 0 ? `${e.yellow(d)} ${e.yellow(a)}` : ` ${a}`).join(`
`);
return `${s + e.yellow(o)} ${B({
options: this.options,
cursor: this.cursor,
maxItems: t.maxItems,
style: r
}).join(`
${e.yellow(o)} `)}
${i}
`;
}
default: return `${s}${e.cyan(o)} ${B({
options: this.options,
cursor: this.cursor,
maxItems: t.maxItems,
style: r
}).join(`
${e.cyan(o)} `)}
${e.cyan(d)}
`;
}
}
}).prompt();
};
`${e.gray(o)}`;
const kCancel = Symbol.for("cancel");
async function prompt(message, opts = {}) {
const handleCancel = (value) => {
if (typeof value !== "symbol" || value.toString() !== "Symbol(clack:cancel)") return value;
switch (opts.cancel) {
case "reject": {
const error = /* @__PURE__ */ new Error("Prompt cancelled.");
error.name = "ConsolaPromptCancelledError";
if (Error.captureStackTrace) Error.captureStackTrace(error, prompt);
throw error;
}
case "undefined": return;
case "null": return null;
case "symbol": return kCancel;
default:
case "default": return opts.default ?? opts.initial;
}
};
if (!opts.type || opts.type === "text") return await he({
message,
defaultValue: opts.default,
placeholder: opts.placeholder,
initialValue: opts.initial
}).then(handleCancel);
if (opts.type === "confirm") return await ye({
message,
initialValue: opts.initial
}).then(handleCancel);
if (opts.type === "select") return await ve({
message,
options: opts.options.map((o) => typeof o === "string" ? {
value: o,
label: o
} : o),
initialValue: opts.initial
}).then(handleCancel);
if (opts.type === "multiselect") return await fe({
message,
options: opts.options.map((o) => typeof o === "string" ? {
value: o,
label: o
} : o),
required: opts.required,
initialValues: opts.initial
}).then(handleCancel);
throw new Error(`Unknown prompt type: ${opts.type}`);
}
//#endregion
export { prompt };
import { n as __toESM, t as require_binding } from "./binding-Dby9rwGk.mjs";
import { a as bindingifySourcemap, n as normalizeBindingError } from "./error-DFGNOCle.mjs";
//#region src/utils/minify.ts
var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
/**
* Minify asynchronously.
*
* Note: This function can be slower than {@linkcode minifySync} due to the overhead of spawning a thread.
*
* @category Utilities
* @experimental
*/
async function minify(filename, sourceText, options) {
const inputMap = bindingifySourcemap(options?.inputMap);
const result = await (0, import_binding.minify)(filename, sourceText, options);
if (result.map && inputMap) result.map = {
version: 3,
...(0, import_binding.collapseSourcemaps)([inputMap, bindingifySourcemap(result.map)])
};
return result;
}
/**
* Minify synchronously.
*
* @category Utilities
* @experimental
*/
function minifySync(filename, sourceText, options) {
const inputMap = bindingifySourcemap(options?.inputMap);
const result = (0, import_binding.minifySync)(filename, sourceText, options);
if (result.map && inputMap) result.map = {
version: 3,
...(0, import_binding.collapseSourcemaps)([inputMap, bindingifySourcemap(result.map)])
};
return result;
}
//#endregion
//#region src/utils/transform.ts
const yarnPnp$1 = typeof process === "object" && !!process.versions?.pnp;
function normalizeBindingWarning(warning) {
if (warning.type === "JsError") return warning.field0;
return {
code: warning.field0.kind,
message: warning.field0.message,
id: warning.field0.id,
exporter: warning.field0.exporter,
loc: warning.field0.loc,
pos: warning.field0.pos
};
}
/**
* Transpile a JavaScript or TypeScript into a target ECMAScript version, asynchronously.
*
* Note: This function can be slower than `transformSync` due to the overhead of spawning a thread.
*
* @param filename The name of the file being transformed. If this is a
* relative path, consider setting the {@linkcode TransformOptions#cwd} option.
* @param sourceText The source code to transform.
* @param options The transform options including tsconfig and inputMap. See {@linkcode TransformOptions} for more information.
* @param cache Optional tsconfig cache for reusing resolved tsconfig across multiple transforms.
* Only used when `options.tsconfig` is `true`.
*
* @returns a promise that resolves to an object containing the transformed code,
* source maps, and any errors that occurred during parsing or transformation.
*
* @category Utilities
* @experimental
*/
async function transform(filename, sourceText, options, cache) {
const result = await (0, import_binding.enhancedTransform)(filename, sourceText, options, cache, yarnPnp$1);
return {
...result,
errors: result.errors.map(normalizeBindingError),
warnings: result.warnings.map(normalizeBindingWarning)
};
}
/**
* Transpile a JavaScript or TypeScript into a target ECMAScript version.
*
* @param filename The name of the file being transformed. If this is a
* relative path, consider setting the {@linkcode TransformOptions#cwd} option.
* @param sourceText The source code to transform.
* @param options The transform options including tsconfig and inputMap. See {@linkcode TransformOptions} for more information.
* @param cache Optional tsconfig cache for reusing resolved tsconfig across multiple transforms.
* Only used when `options.tsconfig` is `true`.
*
* @returns an object containing the transformed code, source maps, and any errors
* that occurred during parsing or transformation.
*
* @category Utilities
* @experimental
*/
function transformSync(filename, sourceText, options, cache) {
const result = (0, import_binding.enhancedTransformSync)(filename, sourceText, options, cache, yarnPnp$1);
return {
...result,
errors: result.errors.map(normalizeBindingError),
warnings: result.warnings.map(normalizeBindingWarning)
};
}
//#endregion
//#region src/utils/resolve-tsconfig.ts
const yarnPnp = typeof process === "object" && !!process.versions?.pnp;
/**
* Cache for tsconfig resolution to avoid redundant file system operations.
*
* The cache stores resolved tsconfig configurations keyed by their file paths.
* When transforming multiple files in the same project, tsconfig lookups are
* deduplicated, improving performance.
*
* @category Utilities
* @experimental
*/
var TsconfigCache = class extends import_binding.TsconfigCache {
constructor() {
super(yarnPnp);
}
};
/** @hidden This is only expected to be used by Vite */
function resolveTsconfig(filename, cache) {
return (0, import_binding.resolveTsconfig)(filename, cache, yarnPnp);
}
//#endregion
export { minify as a, transformSync as i, resolveTsconfig as n, minifySync as o, transform as r, TsconfigCache as t };
import { c as validateOption, t as RolldownBuild, u as PluginDriver } from "./rolldown-build-CdF8HAHX.mjs";
//#region src/api/rolldown/index.ts
/**
* The API compatible with Rollup's `rollup` function.
*
* Unlike Rollup, the module graph is not built until the methods of the bundle object are called.
*
* @param input The input options object.
* @returns A Promise that resolves to a bundle object.
*
* @example
* ```js
* import { rolldown } from 'rolldown';
*
* let bundle, failed = false;
* try {
* bundle = await rolldown({
* input: 'src/main.js',
* });
* await bundle.write({
* format: 'esm',
* });
* } catch (e) {
* console.error(e);
* failed = true;
* }
* if (bundle) {
* await bundle.close();
* }
* process.exitCode = failed ? 1 : 0;
* ```
*
* @category Programmatic APIs
*/
const rolldown = async (input) => {
validateOption("input", input);
return new RolldownBuild(await PluginDriver.callOptionsHook(input));
};
//#endregion
export { rolldown as t };

Sorry, the diff of this file is too big to display

import { a as RolldownLog } from "./logging-xuHO4mAy.mjs";
import { F as MinifyOptions$1, G as TsconfigCache$1, I as MinifyResult$1, R as ParseResult$1, U as SourceMap, a as BindingEnhancedTransformOptions, o as BindingEnhancedTransformResult, y as BindingTsconfigResult, z as ParserOptions$1 } from "./binding-Dbbi0RbO.mjs";
//#region src/utils/resolve-tsconfig.d.ts
/**
* Cache for tsconfig resolution to avoid redundant file system operations.
*
* The cache stores resolved tsconfig configurations keyed by their file paths.
* When transforming multiple files in the same project, tsconfig lookups are
* deduplicated, improving performance.
*
* @category Utilities
* @experimental
*/
declare class TsconfigCache extends TsconfigCache$1 {
constructor();
}
/** @hidden This is only expected to be used by Vite */
declare function resolveTsconfig(filename: string, cache?: TsconfigCache | null): BindingTsconfigResult | null;
//#endregion
//#region src/utils/parse.d.ts
/**
* Result of parsing a code
*
* @category Utilities
*/
interface ParseResult extends ParseResult$1 {}
/**
* Options for parsing a code
*
* @category Utilities
*/
interface ParserOptions extends ParserOptions$1 {}
/**
* Parse JS/TS source asynchronously on a separate thread.
*
* Note that not all of the workload can happen on a separate thread.
* Parsing on Rust side does happen in a separate thread, but deserialization of the AST to JS objects
* has to happen on current thread. This synchronous deserialization work typically outweighs
* the asynchronous parsing by a factor of between 3 and 20.
*
* i.e. the majority of the workload cannot be parallelized by using this method.
*
* Generally {@linkcode parseSync} is preferable to use as it does not have the overhead of spawning a thread.
* If you need to parallelize parsing multiple files, it is recommended to use worker threads.
*
* @category Utilities
*/
declare function parse(filename: string, sourceText: string, options?: ParserOptions | null): Promise<ParseResult>;
/**
* Parse JS/TS source synchronously on current thread.
*
* This is generally preferable over {@linkcode parse} (async) as it does not have the overhead
* of spawning a thread, and the majority of the workload cannot be parallelized anyway
* (see {@linkcode parse} documentation for details).
*
* If you need to parallelize parsing multiple files, it is recommended to use worker threads
* with {@linkcode parseSync} rather than using {@linkcode parse}.
*
* @category Utilities
*/
declare function parseSync(filename: string, sourceText: string, options?: ParserOptions | null): ParseResult;
//#endregion
//#region src/utils/minify.d.ts
/**
* Options for minification.
*
* @category Utilities
*/
interface MinifyOptions extends MinifyOptions$1 {
inputMap?: SourceMap;
}
/**
* The result of minification.
*
* @category Utilities
*/
interface MinifyResult extends MinifyResult$1 {}
/**
* Minify asynchronously.
*
* Note: This function can be slower than {@linkcode minifySync} due to the overhead of spawning a thread.
*
* @category Utilities
* @experimental
*/
declare function minify(filename: string, sourceText: string, options?: MinifyOptions | null): Promise<MinifyResult>;
/**
* Minify synchronously.
*
* @category Utilities
* @experimental
*/
declare function minifySync(filename: string, sourceText: string, options?: MinifyOptions | null): MinifyResult;
//#endregion
//#region src/utils/transform.d.ts
/**
* Options for transforming a code.
*
* @category Utilities
*/
interface TransformOptions extends BindingEnhancedTransformOptions {}
/**
* Result of transforming a code.
*
* @category Utilities
*/
type TransformResult = Omit<BindingEnhancedTransformResult, "errors" | "warnings"> & {
errors: Error[];
warnings: RolldownLog[];
};
/**
* Transpile a JavaScript or TypeScript into a target ECMAScript version, asynchronously.
*
* Note: This function can be slower than `transformSync` due to the overhead of spawning a thread.
*
* @param filename The name of the file being transformed. If this is a
* relative path, consider setting the {@linkcode TransformOptions#cwd} option.
* @param sourceText The source code to transform.
* @param options The transform options including tsconfig and inputMap. See {@linkcode TransformOptions} for more information.
* @param cache Optional tsconfig cache for reusing resolved tsconfig across multiple transforms.
* Only used when `options.tsconfig` is `true`.
*
* @returns a promise that resolves to an object containing the transformed code,
* source maps, and any errors that occurred during parsing or transformation.
*
* @category Utilities
* @experimental
*/
declare function transform(filename: string, sourceText: string, options?: TransformOptions | null, cache?: TsconfigCache | null): Promise<TransformResult>;
/**
* Transpile a JavaScript or TypeScript into a target ECMAScript version.
*
* @param filename The name of the file being transformed. If this is a
* relative path, consider setting the {@linkcode TransformOptions#cwd} option.
* @param sourceText The source code to transform.
* @param options The transform options including tsconfig and inputMap. See {@linkcode TransformOptions} for more information.
* @param cache Optional tsconfig cache for reusing resolved tsconfig across multiple transforms.
* Only used when `options.tsconfig` is `true`.
*
* @returns an object containing the transformed code, source maps, and any errors
* that occurred during parsing or transformation.
*
* @category Utilities
* @experimental
*/
declare function transformSync(filename: string, sourceText: string, options?: TransformOptions | null, cache?: TsconfigCache | null): TransformResult;
//#endregion
export { MinifyOptions as a, minifySync as c, parse as d, parseSync as f, transformSync as i, ParseResult as l, resolveTsconfig as m, TransformResult as n, MinifyResult as o, TsconfigCache as p, transform as r, minify as s, TransformOptions as t, ParserOptions as u };
import { n as __toESM, t as require_binding } from "./binding-Dby9rwGk.mjs";
import { o as logMultipleWatcherOption } from "./logs-ZGEh6uhb.mjs";
import { v as LOG_LEVEL_WARN } from "./bindingify-input-options-_ppP73I9.mjs";
import { t as arraify } from "./misc-CoQm4NHO.mjs";
import { n as createBundlerOptions, u as PluginDriver } from "./rolldown-build-CdF8HAHX.mjs";
import { t as aggregateBindingErrorsIntoJsError } from "./error-DFGNOCle.mjs";
//#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
/**
* This is not the set of all possible signals.
*
* It IS, however, the set of all signals that trigger
* an exit on either Linux or BSD systems. Linux is a
* superset of the signal names supported on BSD, and
* the unknown signals just fail to register, so we can
* catch that easily enough.
*
* Windows signals are a different set, since there are
* signals that terminate Windows processes, but don't
* terminate (or don't even exist) on Posix systems.
*
* Don't bother with SIGKILL. It's uncatchable, which
* means that we can't fire any callbacks anyway.
*
* If a user does happen to register a handler on a non-
* fatal signal like SIGWINCH or something, and then
* exit, it'll end up firing `process.emit('exit')`, so
* the handler will be fired anyway.
*
* SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
* artificially, inherently leave the process in a
* state from which it is not safe to try and enter JS
* listeners.
*/
const signals = [];
signals.push("SIGHUP", "SIGINT", "SIGTERM");
if (process.platform !== "win32") signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
if (process.platform === "linux") signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
//#endregion
//#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
const processOk = (process) => !!process && typeof process === "object" && typeof process.removeListener === "function" && typeof process.emit === "function" && typeof process.reallyExit === "function" && typeof process.listeners === "function" && typeof process.kill === "function" && typeof process.pid === "number" && typeof process.on === "function";
const kExitEmitter = Symbol.for("signal-exit emitter");
const global = globalThis;
const ObjectDefineProperty = Object.defineProperty.bind(Object);
var Emitter = class {
emitted = {
afterExit: false,
exit: false
};
listeners = {
afterExit: [],
exit: []
};
count = 0;
id = Math.random();
constructor() {
if (global[kExitEmitter]) return global[kExitEmitter];
ObjectDefineProperty(global, kExitEmitter, {
value: this,
writable: false,
enumerable: false,
configurable: false
});
}
on(ev, fn) {
this.listeners[ev].push(fn);
}
removeListener(ev, fn) {
const list = this.listeners[ev];
const i = list.indexOf(fn);
/* c8 ignore start */
if (i === -1) return;
/* c8 ignore stop */
if (i === 0 && list.length === 1) list.length = 0;
else list.splice(i, 1);
}
emit(ev, code, signal) {
if (this.emitted[ev]) return false;
this.emitted[ev] = true;
let ret = false;
for (const fn of this.listeners[ev]) ret = fn(code, signal) === true || ret;
if (ev === "exit") ret = this.emit("afterExit", code, signal) || ret;
return ret;
}
};
var SignalExitBase = class {};
const signalExitWrap = (handler) => {
return {
onExit(cb, opts) {
return handler.onExit(cb, opts);
},
load() {
return handler.load();
},
unload() {
return handler.unload();
}
};
};
var SignalExitFallback = class extends SignalExitBase {
onExit() {
return () => {};
}
load() {}
unload() {}
};
var SignalExit = class extends SignalExitBase {
/* c8 ignore start */
#hupSig = process$1.platform === "win32" ? "SIGINT" : "SIGHUP";
/* c8 ignore stop */
#emitter = new Emitter();
#process;
#originalProcessEmit;
#originalProcessReallyExit;
#sigListeners = {};
#loaded = false;
constructor(process) {
super();
this.#process = process;
this.#sigListeners = {};
for (const sig of signals) this.#sigListeners[sig] = () => {
const listeners = this.#process.listeners(sig);
let { count } = this.#emitter;
/* c8 ignore start */
const p = process;
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") count += p.__signal_exit_emitter__.count;
/* c8 ignore stop */
if (listeners.length === count) {
this.unload();
const ret = this.#emitter.emit("exit", null, sig);
/* c8 ignore start */
const s = sig === "SIGHUP" ? this.#hupSig : sig;
if (!ret) process.kill(process.pid, s);
}
};
this.#originalProcessReallyExit = process.reallyExit;
this.#originalProcessEmit = process.emit;
}
onExit(cb, opts) {
/* c8 ignore start */
if (!processOk(this.#process)) return () => {};
/* c8 ignore stop */
if (this.#loaded === false) this.load();
const ev = opts?.alwaysLast ? "afterExit" : "exit";
this.#emitter.on(ev, cb);
return () => {
this.#emitter.removeListener(ev, cb);
if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) this.unload();
};
}
load() {
if (this.#loaded) return;
this.#loaded = true;
this.#emitter.count += 1;
for (const sig of signals) try {
const fn = this.#sigListeners[sig];
if (fn) this.#process.on(sig, fn);
} catch (_) {}
this.#process.emit = (ev, ...a) => {
return this.#processEmit(ev, ...a);
};
this.#process.reallyExit = (code) => {
return this.#processReallyExit(code);
};
}
unload() {
if (!this.#loaded) return;
this.#loaded = false;
signals.forEach((sig) => {
const listener = this.#sigListeners[sig];
/* c8 ignore start */
if (!listener) throw new Error("Listener not defined for signal: " + sig);
/* c8 ignore stop */
try {
this.#process.removeListener(sig, listener);
} catch (_) {}
/* c8 ignore stop */
});
this.#process.emit = this.#originalProcessEmit;
this.#process.reallyExit = this.#originalProcessReallyExit;
this.#emitter.count -= 1;
}
#processReallyExit(code) {
/* c8 ignore start */
if (!processOk(this.#process)) return 0;
this.#process.exitCode = code || 0;
/* c8 ignore stop */
this.#emitter.emit("exit", this.#process.exitCode, null);
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
}
#processEmit(ev, ...args) {
const og = this.#originalProcessEmit;
if (ev === "exit" && processOk(this.#process)) {
if (typeof args[0] === "number") this.#process.exitCode = args[0];
/* c8 ignore start */
const ret = og.call(this.#process, ev, ...args);
/* c8 ignore start */
this.#emitter.emit("exit", this.#process.exitCode, null);
/* c8 ignore stop */
return ret;
} else return og.call(this.#process, ev, ...args);
}
};
const process$1 = globalThis.process;
const { onExit: onExit$1, load, unload } = signalExitWrap(processOk(process$1) ? new SignalExit(process$1) : new SignalExitFallback());
//#endregion
//#region src/utils/signal-exit.ts
function onExit(...args) {
if (typeof process === "object" && process.versions.webcontainer) {
process.on("exit", (code) => {
args[0](code, null);
});
return;
}
onExit$1(...args);
}
//#endregion
//#region src/api/watch/watch-emitter.ts
var WatcherEmitter = class {
listeners = /* @__PURE__ */ new Map();
on(event, listener) {
const listeners = this.listeners.get(event);
if (listeners) listeners.push(listener);
else this.listeners.set(event, [listener]);
return this;
}
off(event, listener) {
const listeners = this.listeners.get(event);
if (listeners) {
const index = listeners.indexOf(listener);
if (index !== -1) listeners.splice(index, 1);
}
return this;
}
clear(event) {
this.listeners.delete(event);
}
/** Async emit — sequential dispatch so side effects from earlier handlers
* (e.g. `event.result.close()` triggering `closeBundle`) are visible to later handlers. */
async emit(event, ...args) {
const handlers = this.listeners.get(event);
if (handlers?.length) for (const h of handlers) await h(...args);
}
async close() {}
};
//#endregion
//#region src/api/watch/watcher.ts
var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
function createEventCallback(emitter) {
return async (event) => {
switch (event.eventKind()) {
case "event": {
const code = event.bundleEventKind();
if (code === "BUNDLE_END") {
const { duration, output, result } = event.bundleEndData();
await emitter.emit("event", {
code: "BUNDLE_END",
duration,
output: [output],
result
});
} else if (code === "ERROR") {
const data = event.bundleErrorData();
await emitter.emit("event", {
code: "ERROR",
error: aggregateBindingErrorsIntoJsError(data.error),
result: data.result
});
} else await emitter.emit("event", { code });
break;
}
case "change": {
const { path, kind } = event.watchChangeData();
await emitter.emit("change", path, { event: kind });
break;
}
case "restart":
await emitter.emit("restart");
break;
case "close":
await emitter.emit("close");
break;
}
};
}
var Watcher = class {
closed;
inner;
emitter;
stopWorkers;
constructor(emitter, inner, stopWorkers) {
this.closed = false;
this.inner = inner;
this.emitter = emitter;
const originClose = emitter.close.bind(emitter);
emitter.close = async () => {
await this.close();
originClose();
};
this.stopWorkers = stopWorkers;
process.nextTick(() => this.run());
}
async close() {
if (this.closed) return;
this.closed = true;
for (const stop of this.stopWorkers) await stop?.();
await this.inner.close();
(0, import_binding.shutdownAsyncRuntime)();
}
async run() {
await this.inner.run();
this.inner.waitForClose();
}
};
async function createWatcher(emitter, input) {
const options = arraify(input);
const bundlerOptions = await Promise.all(options.map((option) => arraify(option.output || {}).map(async (output) => {
return createBundlerOptions(await PluginDriver.callOptionsHook(option, true), output, true);
})).flat());
warnMultiplePollingOptions(bundlerOptions);
const callback = createEventCallback(emitter);
new Watcher(emitter, new import_binding.BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), callback), bundlerOptions.map((option) => option.stopWorkers));
}
function warnMultiplePollingOptions(bundlerOptions) {
let found = false;
for (const option of bundlerOptions) {
const watch = option.inputOptions.watch;
const watcher = watch && typeof watch === "object" ? watch.watcher ?? watch.notify : void 0;
if (watcher && (watcher.usePolling != null || watcher.pollInterval != null)) {
if (found) {
option.onLog(LOG_LEVEL_WARN, logMultipleWatcherOption());
return;
}
found = true;
}
}
}
//#endregion
//#region src/api/watch/index.ts
/**
* The API compatible with Rollup's `watch` function.
*
* This function will rebuild the bundle when it detects that the individual modules have changed on disk.
*
* Note that when using this function, it is your responsibility to call `event.result.close()` in response to the `BUNDLE_END` event to avoid resource leaks.
*
* @param input The watch options object or the list of them.
* @returns A watcher object.
*
* @example
* ```js
* import { watch } from 'rolldown';
*
* const watcher = watch({ /* ... *\/ });
* watcher.on('event', (event) => {
* if (event.code === 'BUNDLE_END') {
* console.log(event.duration);
* event.result.close();
* }
* });
*
* // Stop watching
* watcher.close();
* ```
*
* @experimental
* @category Programmatic APIs
*/
function watch(input) {
const emitter = new WatcherEmitter();
createWatcher(emitter, input);
return emitter;
}
//#endregion
export { onExit as n, watch as t };

Sorry, the diff of this file is too big to display