rolldown 0.14.0 → 0.15.0-commit.ac58858

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/dist/cjs/cli.cjs +902 -960
  2. package/dist/cjs/experimental-index.cjs +68 -26
  3. package/dist/cjs/index.cjs +6 -8
  4. package/dist/cjs/parallel-plugin-worker.cjs +20 -14
  5. package/dist/cjs/parallel-plugin.cjs +1 -3
  6. package/dist/esm/cli.mjs +855 -915
  7. package/dist/esm/experimental-index.mjs +44 -7
  8. package/dist/esm/index.mjs +2 -4
  9. package/dist/esm/parallel-plugin-worker.mjs +15 -10
  10. package/dist/esm/parallel-plugin.mjs +1 -3
  11. package/dist/shared/{chunk-JoMxl5V2.cjs → chunk-BFvIen8E.cjs} +13 -11
  12. package/dist/shared/{consola.36c0034f-HcmWcfPe.cjs → consola_36c0034f-B7L-radJ.cjs} +249 -295
  13. package/dist/shared/{consola.36c0034f-Xyw7SC_7.mjs → consola_36c0034f-D9ce-831.mjs} +221 -286
  14. package/dist/shared/{prompt-9Ij3R3TG.cjs → prompt-BiXtYIJ2.cjs} +157 -204
  15. package/dist/shared/{prompt-hoPhcrA-.mjs → prompt-DlQ-08lk.mjs} +125 -174
  16. package/dist/shared/src-Bs7g4_us.cjs +2985 -0
  17. package/dist/shared/src-C-NQjnqV.mjs +2851 -0
  18. package/dist/tsconfig.dts.tsbuildinfo +1 -0
  19. package/dist/types/api/build.d.ts +16 -0
  20. package/dist/types/api/experimental.d.ts +7 -0
  21. package/dist/types/api/rolldown/index.d.ts +3 -0
  22. package/dist/types/api/rolldown/rolldown-build.d.ts +12 -0
  23. package/dist/types/api/watch/index.d.ts +3 -0
  24. package/dist/types/{watcher.d.ts → api/watch/watch-emitter.d.ts} +17 -17
  25. package/dist/types/api/watch/watcher.d.ts +13 -0
  26. package/dist/types/binding.d.ts +273 -49
  27. package/dist/types/builtin-plugin/alias-plugin.d.ts +10 -0
  28. package/dist/types/builtin-plugin/constructors.d.ts +16 -0
  29. package/dist/types/builtin-plugin/replace-plugin.d.ts +28 -0
  30. package/dist/types/{options/normalized-ecma-transform-plugin-config.d.ts → builtin-plugin/transform-plugin.d.ts} +2 -1
  31. package/dist/types/builtin-plugin/utils.d.ts +8 -0
  32. package/dist/types/cli/arguments/index.d.ts +5 -3
  33. package/dist/types/cli/arguments/normalize.d.ts +2 -6
  34. package/dist/types/cli/arguments/schema.d.ts +10 -309
  35. package/dist/types/cli/colors.d.ts +11 -1
  36. package/dist/types/cli/utils.d.ts +2 -1
  37. package/dist/types/constants/plugin.d.ts +10 -1
  38. package/dist/types/experimental-index.d.ts +5 -2
  39. package/dist/types/index.d.ts +13 -10
  40. package/dist/types/log/logger.d.ts +2 -16
  41. package/dist/types/log/logging.d.ts +11 -8
  42. package/dist/types/log/logs.d.ts +3 -0
  43. package/dist/types/options/input-options-schema.d.ts +4 -0
  44. package/dist/types/options/input-options.d.ts +89 -430
  45. package/dist/types/options/normalized-input-options.d.ts +17 -11
  46. package/dist/types/options/normalized-output-options.d.ts +60 -21
  47. package/dist/types/options/output-options-schema.d.ts +3 -0
  48. package/dist/types/options/output-options.d.ts +73 -265
  49. package/dist/types/options/watch-options.d.ts +5 -0
  50. package/dist/types/plugin/bindingify-build-hooks.d.ts +9 -11
  51. package/dist/types/plugin/bindingify-hook-filter.d.ts +5 -5
  52. package/dist/types/plugin/bindingify-output-hooks.d.ts +13 -16
  53. package/dist/types/plugin/bindingify-plugin.d.ts +12 -3
  54. package/dist/types/plugin/bindingify-watch-hooks.d.ts +3 -5
  55. package/dist/types/plugin/hook-filter.d.ts +1 -1
  56. package/dist/types/plugin/index.d.ts +21 -18
  57. package/dist/types/plugin/minimal-plugin-context.d.ts +15 -0
  58. package/dist/types/plugin/plugin-context-data.d.ts +4 -4
  59. package/dist/types/plugin/plugin-context.d.ts +9 -4
  60. package/dist/types/plugin/plugin-driver.d.ts +4 -5
  61. package/dist/types/plugin/transform-plugin-context.d.ts +4 -3
  62. package/dist/types/rollup-types.d.ts +1 -1
  63. package/dist/types/rollup.d.ts +4 -0
  64. package/dist/types/treeshake/index.d.ts +0 -12
  65. package/dist/types/treeshake/module-side-effects.d.ts +14 -15
  66. package/dist/types/types/rolldown-output.d.ts +17 -2
  67. package/dist/types/types/utils.d.ts +1 -0
  68. package/dist/types/utils/bindingify-input-options.d.ts +7 -0
  69. package/dist/types/utils/bindingify-output-options.d.ts +3 -0
  70. package/dist/types/utils/create-bundler-option.d.ts +11 -0
  71. package/dist/types/utils/define-config.d.ts +3 -0
  72. package/dist/types/utils/error.d.ts +2 -0
  73. package/dist/types/utils/misc.d.ts +1 -0
  74. package/dist/types/utils/normalize-hook.d.ts +1 -1
  75. package/dist/types/utils/normalize-plugin-option.d.ts +8 -3
  76. package/dist/types/{options/utils.d.ts → utils/normalize-string-or-regex.d.ts} +1 -1
  77. package/dist/types/utils/transform-rendered-chunk.d.ts +4 -0
  78. package/dist/types/utils/transform-rendered-module.d.ts +3 -0
  79. package/dist/types/utils/transform-sourcemap.d.ts +2 -0
  80. package/dist/types/utils/transform-to-rollup-output.d.ts +1 -0
  81. package/dist/types/utils/zod-ext.d.ts +6 -5
  82. package/package.json +31 -23
  83. package/dist/shared/rolldown-binding.wasi.cjs +0 -187
  84. package/dist/shared/src_index-3pqhEViJ.cjs +0 -2785
  85. package/dist/shared/src_index-ywYMd4vB.mjs +0 -2786
  86. package/dist/shared/wasi-worker-browser.mjs +0 -39
  87. package/dist/shared/wasi-worker.mjs +0 -63
  88. package/dist/shared/watcher-worker.js +0 -1
  89. package/dist/types/constants/types.d.ts +0 -1
  90. package/dist/types/options/bindingify-input-options.d.ts +0 -4
  91. package/dist/types/options/bindingify-output-options.d.ts +0 -3
  92. package/dist/types/options/normalized-alias-plugin-config.d.ts +0 -8
  93. package/dist/types/options/watch-option.d.ts +0 -5
  94. package/dist/types/plugin/builtin-plugin.d.ts +0 -81
  95. package/dist/types/rolldown-build.d.ts +0 -10
  96. package/dist/types/rolldown.d.ts +0 -12
  97. package/dist/types/types/rendered-module.d.ts +0 -2
  98. package/dist/types/utils/normalize-input-options.d.ts +0 -3
  99. package/dist/types/utils/normalize-output-options.d.ts +0 -3
  100. package/dist/types/utils/normalize-tree-shake.d.ts +0 -3
  101. /package/dist/types/{utils/type-assert.d.ts → types/assert.d.ts} +0 -0
package/dist/cjs/cli.cjs CHANGED
@@ -1,128 +1,35 @@
1
1
  "use strict";
2
+ const require_chunk = require('../shared/chunk-BFvIen8E.cjs');
3
+ const require_src = require('../shared/src-Bs7g4_us.cjs');
4
+ const require_consola_36c0034f = require('../shared/consola_36c0034f-B7L-radJ.cjs');
5
+ const zod = require_chunk.__toESM(require("zod"));
6
+ const node_path = require_chunk.__toESM(require("node:path"));
7
+ const node_process = require_chunk.__toESM(require("node:process"));
8
+ const node_perf_hooks = require_chunk.__toESM(require("node:perf_hooks"));
9
+ const tty = require_chunk.__toESM(require("tty"));
10
+ const node_url = require_chunk.__toESM(require("node:url"));
11
+ const node_util = require_chunk.__toESM(require("node:util"));
12
+ const node_tty = require_chunk.__toESM(require("node:tty"));
2
13
 
3
- const { __export, __toESM } = require("../shared/chunk-JoMxl5V2.cjs");
4
- const { LogLevelOptionSchema, LogLevelSchema, LogLevelWithErrorSchema, RollupLogSchema, RollupLogWithStringSchema, arraify, description, rolldown, version, watch } = require("../shared/src_index-3pqhEViJ.cjs");
5
- const { createConsola } = require("../shared/consola.36c0034f-HcmWcfPe.cjs");
6
- const { default: nodePath, default: path } = __toESM(require("node:path"));
7
- const { ZodFirstPartyTypeKind, ZodFirstPartyTypeKind: ZodFirstPartyTypeKind$1, ZodFirstPartyTypeKind: ZodFirstPartyTypeKind$2, z, z: z$1, z: z$2, z: z$3 } = __toESM(require("zod"));
8
- const { default: process$1, env } = __toESM(require("node:process"));
9
- const { performance } = __toESM(require("node:perf_hooks"));
10
- const { pathToFileURL } = __toESM(require("node:url"));
11
- const { parseArgs } = __toESM(require("node:util"));
12
- const tty = __toESM(require("node:tty"));
13
-
14
- //#region src/cli/utils.ts
15
- const logger = process.env.ROLLDOWN_TEST ? createTestingLogger() : createConsola({formatOptions: {date: false}});
16
- function createTestingLogger() {
17
- const types = ["silent", "fatal", "error", "warn", "log", "info", "success", "fail", "ready", "start", "box", "debug", "trace", "verbose",];
18
- const ret = Object.create(null);
19
- for (const type of types) {
20
- ret[type] = console.log;
21
- }
22
- return ret;
23
- }
24
- async function ensureConfig(configPath) {
25
- if (!isSupportedFormat(configPath)) {
26
- throw new Error(`Unsupported config format. Expected: \`${SUPPORTED_CONFIG_FORMATS.join(",")}\` but got \`${nodePath.extname(configPath)}\``);
27
- }
28
- const fileUrl = (pathToFileURL(configPath)).toString();
29
- const configExports = await import(fileUrl);
30
- return configExports.default;
31
- }
32
- const SUPPORTED_CONFIG_FORMATS = [".js", ".mjs", ".cjs"];
33
- function isSupportedFormat(configPath) {
34
- const ext = nodePath.extname(configPath);
35
- return SUPPORTED_CONFIG_FORMATS.includes(ext);
36
- }
37
-
38
- //#endregion
39
- //#region ../../node_modules/.pnpm/colorette@2.0.20/node_modules/colorette/index.js
40
- const { env: env$1 = {}, argv: argv = [], platform: platform = "" } = typeof process === "undefined" ? {} : process;
41
- const isDisabled = "NO_COLOR"in env$1 || argv.includes("--no-color");
42
- const isForced = "FORCE_COLOR"in env$1 || argv.includes("--color");
43
- const isWindows = platform === "win32";
44
- const isDumbTerminal = env$1.TERM === "dumb";
45
- const isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env$1.TERM && !isDumbTerminal;
46
- const isCI = "CI"in env$1 && ("GITHUB_ACTIONS"in env$1 || "GITLAB_CI"in env$1 || "CIRCLECI"in env$1);
47
- const isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
48
- const replaceClose = (index, string, close, replace, head = string.substring(0, index) + replace, tail = string.substring(index + close.length), next = tail.indexOf(close)) => head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
49
- const clearBleed = (index, string, open, close, replace) => index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
50
- const filterEmpty = (open, close, replace = open, at = open.length + 1) => (string) => string || !(string === "" || string === undefined) ? clearBleed(("" + string).indexOf(close, at), string, open, close, replace) : "";
51
- const init = (open, close, replace) => filterEmpty(`\x1b[${open}m`, `\x1b[${close}m`, replace);
52
- const colors = {
53
- reset: init(0, 0),
54
- bold: init(1, 22, "\x1B[22m\x1B[1m"),
55
- dim: init(2, 22, "\x1B[22m\x1B[2m"),
56
- italic: init(3, 23),
57
- underline: init(4, 24),
58
- inverse: init(7, 27),
59
- hidden: init(8, 28),
60
- strikethrough: init(9, 29),
61
- black: init(30, 39),
62
- red: init(31, 39),
63
- green: init(32, 39),
64
- yellow: init(33, 39),
65
- blue: init(34, 39),
66
- magenta: init(35, 39),
67
- cyan: init(36, 39),
68
- white: init(37, 39),
69
- gray: init(90, 39),
70
- bgBlack: init(40, 49),
71
- bgRed: init(41, 49),
72
- bgGreen: init(42, 49),
73
- bgYellow: init(43, 49),
74
- bgBlue: init(44, 49),
75
- bgMagenta: init(45, 49),
76
- bgCyan: init(46, 49),
77
- bgWhite: init(47, 49),
78
- blackBright: init(90, 39),
79
- redBright: init(91, 39),
80
- greenBright: init(92, 39),
81
- yellowBright: init(93, 39),
82
- blueBright: init(94, 39),
83
- magentaBright: init(95, 39),
84
- cyanBright: init(96, 39),
85
- whiteBright: init(97, 39),
86
- bgBlackBright: init(100, 49),
87
- bgRedBright: init(101, 49),
88
- bgGreenBright: init(102, 49),
89
- bgYellowBright: init(103, 49),
90
- bgBlueBright: init(104, 49),
91
- bgMagentaBright: init(105, 49),
92
- bgCyanBright: init(106, 49),
93
- bgWhiteBright: init(107, 49)
94
- };
95
- const createColors = ({ useColor: useColor = isColorSupported } = {}) => useColor ? colors : (Object.keys(colors)).reduce((colors$1, key) => ({
96
- ...colors$1,
97
- [key]: String
98
- }), {});
99
- const { reset: reset, bold: bold$1, dim: dim$1, italic: italic, underline: underline$1, inverse: inverse, hidden: hidden, strikethrough: strikethrough, black: black, red: red$1, green: green$1, yellow: yellow$1, blue: blue, magenta: magenta, cyan: cyan$1, white: white, gray: gray$1, bgBlack: bgBlack, bgRed: bgRed, bgGreen: bgGreen, bgYellow: bgYellow, bgBlue: bgBlue, bgMagenta: bgMagenta, bgCyan: bgCyan, bgWhite: bgWhite, blackBright: blackBright, redBright: redBright, greenBright: greenBright, yellowBright: yellowBright, blueBright: blueBright, magentaBright: magentaBright, cyanBright: cyanBright, whiteBright: whiteBright, bgBlackBright: bgBlackBright, bgRedBright: bgRedBright, bgGreenBright: bgGreenBright, bgYellowBright: bgYellowBright, bgBlueBright: bgBlueBright, bgMagentaBright: bgMagentaBright, bgCyanBright: bgCyanBright, bgWhiteBright: bgWhiteBright } = createColors();
100
-
101
- //#endregion
102
- //#region src/cli/colors.ts
103
- var colors_ns = {};
104
- __export(colors_ns, {
105
- bold: () => bold,
106
- cyan: () => cyan,
107
- dim: () => dim,
108
- gray: () => gray,
109
- green: () => green,
110
- red: () => red,
111
- underline: () => underline,
112
- yellow: () => yellow
113
- });
114
- const { bold: bold, cyan: cyan, dim: dim, gray: gray, green: green, red: red, underline: underline, yellow: yellow } = createColors({useColor: env.FORCE_COLOR !== "0" && !env.NO_COLOR});
115
-
116
- //#endregion
117
14
  //#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
118
15
  const signals = [];
119
16
  signals.push("SIGHUP", "SIGINT", "SIGTERM");
120
- if (process.platform !== "win32") {
121
- signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
122
- }
123
- if (process.platform === "linux") {
124
- signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
125
- }
17
+ if (process.platform !== "win32") signals.push(
18
+ "SIGALRM",
19
+ "SIGABRT",
20
+ "SIGVTALRM",
21
+ "SIGXCPU",
22
+ "SIGXFSZ",
23
+ "SIGUSR2",
24
+ "SIGTRAP",
25
+ "SIGSYS",
26
+ "SIGQUIT",
27
+ "SIGIOT"
28
+ // should detect profiler and enable/disable accordingly.
29
+ // see #21
30
+ // 'SIGPROF'
31
+ );
32
+ if (process.platform === "linux") signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
126
33
 
127
34
  //#endregion
128
35
  //#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
@@ -130,7 +37,7 @@ const processOk = (process$3) => !!process$3 && typeof process$3 === "object" &&
130
37
  const kExitEmitter = Symbol.for("signal-exit emitter");
131
38
  const global = globalThis;
132
39
  const ObjectDefineProperty = Object.defineProperty.bind(Object);
133
- class Emitter {
40
+ var Emitter = class {
134
41
  emitted = {
135
42
  afterExit: false,
136
43
  exit: false
@@ -142,9 +49,7 @@ class Emitter {
142
49
  count = 0;
143
50
  id = Math.random();
144
51
  constructor() {
145
- if (global[kExitEmitter]) {
146
- return global[kExitEmitter];
147
- }
52
+ if (global[kExitEmitter]) return global[kExitEmitter];
148
53
  ObjectDefineProperty(global, kExitEmitter, {
149
54
  value: this,
150
55
  writable: false,
@@ -158,31 +63,20 @@ class Emitter {
158
63
  removeListener(ev, fn) {
159
64
  const list = this.listeners[ev];
160
65
  const i = list.indexOf(fn);
161
- if (i === -1) {
162
- return;
163
- }
164
- if (i === 0 && list.length === 1) {
165
- list.length = 0;
166
- } else {
167
- list.splice(i, 1);
168
- }
66
+ if (i === -1) return;
67
+ if (i === 0 && list.length === 1) list.length = 0;
68
+ else list.splice(i, 1);
169
69
  }
170
70
  emit(ev, code, signal) {
171
- if (this.emitted[ev]) {
172
- return false;
173
- }
71
+ if (this.emitted[ev]) return false;
174
72
  this.emitted[ev] = true;
175
73
  let ret = false;
176
- for (const fn of this.listeners[ev]) {
177
- ret = fn(code, signal) === true || ret;
178
- }
179
- if (ev === "exit") {
180
- ret = this.emit("afterExit", code, signal) || ret;
181
- }
74
+ for (const fn of this.listeners[ev]) ret = fn(code, signal) === true || ret;
75
+ if (ev === "exit") ret = this.emit("afterExit", code, signal) || ret;
182
76
  return ret;
183
77
  }
184
- }
185
- class SignalExitBase {}
78
+ };
79
+ var SignalExitBase = class {};
186
80
  const signalExitWrap = (handler) => {
187
81
  return {
188
82
  onExit(cb, opts) {
@@ -196,14 +90,14 @@ const signalExitWrap = (handler) => {
196
90
  }
197
91
  };
198
92
  };
199
- class SignalExitFallback extends SignalExitBase {
93
+ var SignalExitFallback = class extends SignalExitBase {
200
94
  onExit() {
201
95
  return () => {};
202
96
  }
203
97
  load() {}
204
98
  unload() {}
205
- }
206
- class SignalExit extends SignalExitBase {
99
+ };
100
+ var SignalExit = class extends SignalExitBase {
207
101
  #hupSig = process$2.platform === "win32" ? "SIGINT" : "SIGHUP";
208
102
  #emitter = new Emitter();
209
103
  #process;
@@ -215,53 +109,39 @@ class SignalExit extends SignalExitBase {
215
109
  super();
216
110
  this.#process = process$3;
217
111
  this.#sigListeners = {};
218
- for (const sig of signals) {
219
- this.#sigListeners[sig] = () => {
220
- const listeners = this.#process.listeners(sig);
221
- let { count: count } = this.#emitter;
222
- const p = process$3;
223
- if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
224
- count += p.__signal_exit_emitter__.count;
225
- }
226
- if (listeners.length === count) {
227
- this.unload();
228
- const ret = this.#emitter.emit("exit", null, sig);
229
- const s = sig === "SIGHUP" ? this.#hupSig : sig;
230
- if (!ret) process$3.kill(process$3.pid, s);
231
- }
232
- };
233
- }
112
+ for (const sig of signals) this.#sigListeners[sig] = () => {
113
+ const listeners = this.#process.listeners(sig);
114
+ let { count } = this.#emitter;
115
+ const p = process$3;
116
+ if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") count += p.__signal_exit_emitter__.count;
117
+ if (listeners.length === count) {
118
+ this.unload();
119
+ const ret = this.#emitter.emit("exit", null, sig);
120
+ const s = sig === "SIGHUP" ? this.#hupSig : sig;
121
+ if (!ret) process$3.kill(process$3.pid, s);
122
+ }
123
+ };
234
124
  this.#originalProcessReallyExit = process$3.reallyExit;
235
125
  this.#originalProcessEmit = process$3.emit;
236
126
  }
237
127
  onExit(cb, opts) {
238
- if (!processOk(this.#process)) {
239
- return () => {};
240
- }
241
- if (this.#loaded === false) {
242
- this.load();
243
- }
128
+ if (!processOk(this.#process)) return () => {};
129
+ if (this.#loaded === false) this.load();
244
130
  const ev = opts?.alwaysLast ? "afterExit" : "exit";
245
131
  this.#emitter.on(ev, cb);
246
132
  return () => {
247
133
  this.#emitter.removeListener(ev, cb);
248
- if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
249
- this.unload();
250
- }
134
+ if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) this.unload();
251
135
  };
252
136
  }
253
137
  load() {
254
- if (this.#loaded) {
255
- return;
256
- }
138
+ if (this.#loaded) return;
257
139
  this.#loaded = true;
258
140
  this.#emitter.count += 1;
259
- for (const sig of signals) {
260
- try {
261
- const fn = this.#sigListeners[sig];
262
- if (fn) this.#process.on(sig, fn);
263
- } catch (_) {}
264
- }
141
+ for (const sig of signals) try {
142
+ const fn = this.#sigListeners[sig];
143
+ if (fn) this.#process.on(sig, fn);
144
+ } catch (_) {}
265
145
  this.#process.emit = (ev, ...a) => {
266
146
  return this.#processEmit(ev, ...a);
267
147
  };
@@ -270,15 +150,11 @@ class SignalExit extends SignalExitBase {
270
150
  };
271
151
  }
272
152
  unload() {
273
- if (!this.#loaded) {
274
- return;
275
- }
153
+ if (!this.#loaded) return;
276
154
  this.#loaded = false;
277
155
  signals.forEach((sig) => {
278
156
  const listener = this.#sigListeners[sig];
279
- if (!listener) {
280
- throw new Error("Listener not defined for signal: " + sig);
281
- }
157
+ if (!listener) throw new Error("Listener not defined for signal: " + sig);
282
158
  try {
283
159
  this.#process.removeListener(sig, listener);
284
160
  } catch (_) {}
@@ -288,9 +164,7 @@ class SignalExit extends SignalExitBase {
288
164
  this.#emitter.count -= 1;
289
165
  }
290
166
  #processReallyExit(code) {
291
- if (!processOk(this.#process)) {
292
- return 0;
293
- }
167
+ if (!processOk(this.#process)) return 0;
294
168
  this.#process.exitCode = code || 0;
295
169
  this.#emitter.emit("exit", this.#process.exitCode, null);
296
170
  return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
@@ -298,19 +172,141 @@ class SignalExit extends SignalExitBase {
298
172
  #processEmit(ev, ...args) {
299
173
  const og = this.#originalProcessEmit;
300
174
  if (ev === "exit" && processOk(this.#process)) {
301
- if (typeof args[0] === "number") {
302
- this.#process.exitCode = args[0];
303
- }
175
+ if (typeof args[0] === "number") this.#process.exitCode = args[0];
304
176
  const ret = og.call(this.#process, ev, ...args);
305
177
  this.#emitter.emit("exit", this.#process.exitCode, null);
306
178
  return ret;
307
- } else {
308
- return og.call(this.#process, ev, ...args);
309
- }
179
+ } else return og.call(this.#process, ev, ...args);
310
180
  }
311
- }
181
+ };
312
182
  const process$2 = globalThis.process;
313
- const { onExit: onExit, load: load, unload: unload } = signalExitWrap(processOk(process$2) ? new SignalExit(process$2) : new SignalExitFallback());
183
+ const { onExit, load, unload } = signalExitWrap(processOk(process$2) ? new SignalExit(process$2) : new SignalExitFallback());
184
+
185
+ //#endregion
186
+ //#region ../../node_modules/.pnpm/colorette@2.0.20/node_modules/colorette/index.js
187
+ const { env: env$1 = {}, argv = [], platform = "" } = typeof process === "undefined" ? {} : process;
188
+ const isDisabled = "NO_COLOR" in env$1 || argv.includes("--no-color");
189
+ const isForced = "FORCE_COLOR" in env$1 || argv.includes("--color");
190
+ const isWindows = platform === "win32";
191
+ const isDumbTerminal = env$1.TERM === "dumb";
192
+ const isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env$1.TERM && !isDumbTerminal;
193
+ const isCI = "CI" in env$1 && ("GITHUB_ACTIONS" in env$1 || "GITLAB_CI" in env$1 || "CIRCLECI" in env$1);
194
+ const isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
195
+ const replaceClose = (index, string, close, replace, head = string.substring(0, index) + replace, tail = string.substring(index + close.length), next = tail.indexOf(close)) => head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
196
+ const clearBleed = (index, string, open, close, replace) => index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
197
+ const filterEmpty = (open, close, replace = open, at = open.length + 1) => (string) => string || !(string === "" || string === undefined) ? clearBleed(("" + string).indexOf(close, at), string, open, close, replace) : "";
198
+ const init = (open, close, replace) => filterEmpty(`\x1b[${open}m`, `\x1b[${close}m`, replace);
199
+ const colors$1 = {
200
+ reset: init(0, 0),
201
+ bold: init(1, 22, "\x1B[22m\x1B[1m"),
202
+ dim: init(2, 22, "\x1B[22m\x1B[2m"),
203
+ italic: init(3, 23),
204
+ underline: init(4, 24),
205
+ inverse: init(7, 27),
206
+ hidden: init(8, 28),
207
+ strikethrough: init(9, 29),
208
+ black: init(30, 39),
209
+ red: init(31, 39),
210
+ green: init(32, 39),
211
+ yellow: init(33, 39),
212
+ blue: init(34, 39),
213
+ magenta: init(35, 39),
214
+ cyan: init(36, 39),
215
+ white: init(37, 39),
216
+ gray: init(90, 39),
217
+ bgBlack: init(40, 49),
218
+ bgRed: init(41, 49),
219
+ bgGreen: init(42, 49),
220
+ bgYellow: init(43, 49),
221
+ bgBlue: init(44, 49),
222
+ bgMagenta: init(45, 49),
223
+ bgCyan: init(46, 49),
224
+ bgWhite: init(47, 49),
225
+ blackBright: init(90, 39),
226
+ redBright: init(91, 39),
227
+ greenBright: init(92, 39),
228
+ yellowBright: init(93, 39),
229
+ blueBright: init(94, 39),
230
+ magentaBright: init(95, 39),
231
+ cyanBright: init(96, 39),
232
+ whiteBright: init(97, 39),
233
+ bgBlackBright: init(100, 49),
234
+ bgRedBright: init(101, 49),
235
+ bgGreenBright: init(102, 49),
236
+ bgYellowBright: init(103, 49),
237
+ bgBlueBright: init(104, 49),
238
+ bgMagentaBright: init(105, 49),
239
+ bgCyanBright: init(106, 49),
240
+ bgWhiteBright: init(107, 49)
241
+ };
242
+ const createColors = ({ useColor = isColorSupported } = {}) => useColor ? colors$1 : Object.keys(colors$1).reduce((colors$2, key) => ({
243
+ ...colors$2,
244
+ [key]: String
245
+ }), {});
246
+ const { reset, bold: bold$1, dim: dim$1, italic, underline: underline$1, inverse, hidden, strikethrough, black, red: red$1, green: green$1, yellow: yellow$1, blue, magenta, cyan: cyan$1, white, gray: gray$1, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, blackBright, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, bgBlackBright, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright } = createColors();
247
+
248
+ //#endregion
249
+ //#region src/cli/colors.ts
250
+ const { bold, cyan, dim, gray, green, red, underline, yellow } = createColors({ useColor: node_process.env.FORCE_COLOR !== "0" && !node_process.env.NO_COLOR });
251
+ const colors = {
252
+ bold,
253
+ cyan,
254
+ dim,
255
+ gray,
256
+ green,
257
+ red,
258
+ underline,
259
+ yellow
260
+ };
261
+
262
+ //#endregion
263
+ //#region src/cli/utils.ts
264
+ const logger = process.env.ROLLDOWN_TEST ? createTestingLogger() : require_consola_36c0034f.createConsola({ formatOptions: { date: false } });
265
+ function createTestingLogger() {
266
+ const types = [
267
+ "silent",
268
+ "fatal",
269
+ "error",
270
+ "warn",
271
+ "log",
272
+ "info",
273
+ "success",
274
+ "fail",
275
+ "ready",
276
+ "start",
277
+ "box",
278
+ "debug",
279
+ "trace",
280
+ "verbose"
281
+ ];
282
+ const ret = Object.create(null);
283
+ for (const type of types) ret[type] = console.log;
284
+ return ret;
285
+ }
286
+ async function ensureConfig(configPath) {
287
+ const fileUrl = (0, node_url.pathToFileURL)(configPath).toString();
288
+ let configExports;
289
+ try {
290
+ configExports = await import(fileUrl);
291
+ } catch (err) {
292
+ let errorMessage = "Error happened while loading config.";
293
+ if (!isSupportedFormat(configPath)) errorMessage += ` Unsupported config format. Expected: \`${SUPPORTED_CONFIG_FORMATS.join(",")}\` but got \`${node_path.default.extname(configPath)}\``;
294
+ throw new Error(errorMessage, { cause: err });
295
+ }
296
+ return configExports.default;
297
+ }
298
+ const SUPPORTED_CONFIG_FORMATS = [
299
+ ".js",
300
+ ".mjs",
301
+ ".cjs"
302
+ ];
303
+ /**
304
+ * Check whether the configuration file is supported
305
+ */
306
+ function isSupportedFormat(configPath) {
307
+ const ext = node_path.default.extname(configPath);
308
+ return SUPPORTED_CONFIG_FORMATS.includes(ext);
309
+ }
314
310
 
315
311
  //#endregion
316
312
  //#region src/cli/commands/bundle.ts
@@ -320,56 +316,61 @@ async function bundleWithConfig(configPath, cliOptions) {
320
316
  logger.error(`No configuration found at ${config}`);
321
317
  process.exit(1);
322
318
  }
323
- const configList = arraify(config);
324
- for (const config$1 of configList) {
325
- cliOptions.watch ? await watchInner(config$1, cliOptions) : bundleInner(config$1, cliOptions);
326
- }
319
+ const configList = require_src.arraify(config);
320
+ const operation = cliOptions.watch ? watchInner : bundleInner;
321
+ for (const config$1 of configList) await operation(config$1, cliOptions);
327
322
  }
328
323
  async function bundleWithCliOptions(cliOptions) {
329
324
  if (cliOptions.output.dir) {
330
- cliOptions.watch ? await watchInner({}, cliOptions) : await bundleInner({}, cliOptions);
331
- } else if (!cliOptions.watch) {
332
- const build = await rolldown(cliOptions.input);
333
- const { output: output } = await build.generate(cliOptions.output);
334
- if (output.length > 1) {
335
- logger.error("Multiple chunks are not supported to display in stdout");
336
- process.exit(1);
337
- } else if (output.length === 0) {
325
+ const operation = cliOptions.watch ? watchInner : bundleInner;
326
+ await operation({}, cliOptions);
327
+ return;
328
+ }
329
+ if (cliOptions.watch) {
330
+ logger.error("You must specify `output.dir` to use watch mode");
331
+ process.exit(1);
332
+ }
333
+ const build = await require_src.rolldown(cliOptions.input);
334
+ try {
335
+ const { output: outputs } = await build.generate(cliOptions.output);
336
+ if (outputs.length === 0) {
338
337
  logger.error("No output generated");
339
338
  process.exit(1);
340
- } else {
341
- logger.log(output[0].code);
342
339
  }
343
- } else {
344
- logger.error("You must specify `output.dir` to use watch mode");
345
- process.exit(1);
340
+ for (const file of outputs) {
341
+ if (outputs.length > 1) logger.log(`\n${colors.cyan(colors.bold(`|→ ${file.fileName}:`))}\n`);
342
+ logger.log(file.type === "asset" ? file.source : file.code);
343
+ }
344
+ } finally {
345
+ await build.close();
346
346
  }
347
347
  }
348
348
  async function watchInner(options$1, cliOptions) {
349
- const watcher = await watch({
349
+ const watcher = await require_src.watch({
350
350
  ...options$1,
351
351
  ...cliOptions.input
352
352
  });
353
353
  onExit((code) => {
354
- (Promise.resolve(watcher.close())).finally(() => {
354
+ Promise.resolve(watcher.close()).finally(() => {
355
355
  process.exit(typeof code === "number" ? code : 0);
356
356
  });
357
357
  return true;
358
358
  });
359
359
  const changedFile = [];
360
360
  watcher.on("change", (id, event) => {
361
- if (event.event === "update") {
362
- changedFile.push(id);
363
- }
361
+ if (event.event === "update") changedFile.push(id);
364
362
  });
365
363
  watcher.on("event", (event) => {
366
364
  switch (event.code) {
367
365
  case "BUNDLE_START":
368
- logger.log(`Found ${bold((changedFile.map(relativeId)).join(", "))} changed, rebuilding...`);
366
+ if (changedFile.length > 0) logger.log(`Found ${colors.bold(changedFile.map(relativeId).join(", "))} changed, rebuilding...`);
369
367
  changedFile.length = 0;
370
368
  break;
371
369
  case "BUNDLE_END":
372
- logger.success(`Rebuilt ${bold(relativeId(event.output[0]))} in ${bold(ms(event.duration))}.`);
370
+ logger.success(`Rebuilt ${colors.bold(relativeId(event.output[0]))} in ${colors.bold(ms(event.duration))}.`);
371
+ break;
372
+ case "ERROR":
373
+ logger.error(event.error);
373
374
  break;
374
375
  default: break;
375
376
  }
@@ -377,20 +378,24 @@ async function watchInner(options$1, cliOptions) {
377
378
  logger.log(`Waiting for changes...`);
378
379
  }
379
380
  async function bundleInner(options$1, cliOptions) {
380
- const startTime = performance.now();
381
- const build = await rolldown({
381
+ const startTime = node_perf_hooks.performance.now();
382
+ const build = await require_src.rolldown({
382
383
  ...options$1,
383
384
  ...cliOptions.input
384
385
  });
385
- const bundleOutput = await build.write({
386
- ...options$1?.output,
387
- ...cliOptions.output
388
- });
389
- const endTime = performance.now();
390
- printBundleOutputPretty(bundleOutput);
391
- logger.log(``);
392
- const duration = endTime - startTime;
393
- logger.success(`Finished in ${bold(ms(duration))}`);
386
+ try {
387
+ const bundleOutput = await build.write({
388
+ ...options$1?.output,
389
+ ...cliOptions.output
390
+ });
391
+ const endTime = node_perf_hooks.performance.now();
392
+ printBundleOutputPretty(bundleOutput);
393
+ logger.log(``);
394
+ const duration = endTime - startTime;
395
+ logger.success(`Finished in ${colors.bold(ms(duration))}`);
396
+ } finally {
397
+ await build.close();
398
+ }
394
399
  }
395
400
  function printBundleOutputPretty(output) {
396
401
  const outputEntries = collectOutputEntries(output.output);
@@ -408,14 +413,10 @@ function collectOutputLayoutAdjustmentSizes(entries) {
408
413
  let longest = 0;
409
414
  let biggestSize = 0;
410
415
  for (const entry of entries) {
411
- if (entry.fileName.length > longest) {
412
- longest = entry.fileName.length;
413
- }
414
- if (entry.size > biggestSize) {
415
- biggestSize = entry.size;
416
- }
416
+ if (entry.fileName.length > longest) longest = entry.fileName.length;
417
+ if (entry.size > biggestSize) biggestSize = entry.size;
417
418
  }
418
- const sizePad = (displaySize(biggestSize)).length;
419
+ const sizePad = displaySize(biggestSize).length;
419
420
  return {
420
421
  longest,
421
422
  biggestSize,
@@ -427,7 +428,7 @@ const numberFormatter = new Intl.NumberFormat("en", {
427
428
  minimumFractionDigits: 2
428
429
  });
429
430
  function displaySize(bytes) {
430
- return `${numberFormatter.format(bytes / 1000)} kB`;
431
+ return `${numberFormatter.format(bytes / 1e3)} kB`;
431
432
  }
432
433
  const CHUNK_GROUPS = [{
433
434
  type: "asset",
@@ -435,34 +436,30 @@ const CHUNK_GROUPS = [{
435
436
  }, {
436
437
  type: "chunk",
437
438
  color: "cyan"
438
- },];
439
+ }];
439
440
  function printOutputEntries(entries, sizeAdjustment, distPath) {
440
441
  for (const group of CHUNK_GROUPS) {
441
442
  const filtered = entries.filter((e) => e.type === group.type);
442
- if (!filtered.length) {
443
- continue;
444
- }
443
+ if (!filtered.length) continue;
445
444
  for (const entry of filtered.sort((a, z$4) => a.size - z$4.size)) {
446
- let log = dim(withTrailingSlash(distPath));
447
- log += colors_ns[group.color](entry.fileName.padEnd(sizeAdjustment.longest + 2));
448
- log += dim(entry.type);
449
- log += dim(` │ size: ${(displaySize(entry.size)).padStart(sizeAdjustment.sizePad)}`);
445
+ let log = colors.dim(withTrailingSlash(distPath));
446
+ log += colors[group.color](entry.fileName.padEnd(sizeAdjustment.longest + 2));
447
+ log += colors.dim(entry.type);
448
+ log += colors.dim(` │ size: ${displaySize(entry.size).padStart(sizeAdjustment.sizePad)}`);
450
449
  logger.log(log);
451
450
  }
452
451
  }
453
452
  }
454
453
  function withTrailingSlash(path$1) {
455
- if (path$1[path$1.length - 1] !== "/") {
456
- return `${path$1}/`;
457
- }
454
+ if (path$1[path$1.length - 1] !== "/") return `${path$1}/`;
458
455
  return path$1;
459
456
  }
460
457
  function ms(duration) {
461
- return duration < 1000 ? `${duration.toFixed(2)} ms` : `${(duration / 1000).toFixed(2)} s`;
458
+ return duration < 1e3 ? `${duration.toFixed(2)} ms` : `${(duration / 1e3).toFixed(2)} s`;
462
459
  }
463
460
  function relativeId(id) {
464
- if (!path.isAbsolute(id)) return id;
465
- return path.relative(path.resolve(), id);
461
+ if (!node_path.default.isAbsolute(id)) return id;
462
+ return node_path.default.relative(node_path.default.resolve(), id);
466
463
  }
467
464
 
468
465
  //#endregion
@@ -501,16 +498,24 @@ const getDefaultOptions = (options$1) => typeof options$1 === "string" ? {
501
498
  //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.5_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/Refs.js
502
499
  const getRefs = (options$1) => {
503
500
  const _options = getDefaultOptions(options$1);
504
- const currentPath = _options.name !== undefined ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;
501
+ const currentPath = _options.name !== undefined ? [
502
+ ..._options.basePath,
503
+ _options.definitionPath,
504
+ _options.name
505
+ ] : _options.basePath;
505
506
  return {
506
507
  ..._options,
507
- currentPath: currentPath,
508
+ currentPath,
508
509
  propertyPath: undefined,
509
- seen: new Map((Object.entries(_options.definitions)).map(([name, def]) => [def._def, {
510
+ seen: new Map(Object.entries(_options.definitions).map(([name, def]) => [def._def, {
510
511
  def: def._def,
511
- path: [..._options.basePath, _options.definitionPath, name],
512
+ path: [
513
+ ..._options.basePath,
514
+ _options.definitionPath,
515
+ name
516
+ ],
512
517
  jsonSchema: undefined
513
- },]))
518
+ }]))
514
519
  };
515
520
  };
516
521
 
@@ -518,12 +523,10 @@ const getRefs = (options$1) => {
518
523
  //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.5_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/errorMessages.js
519
524
  function addErrorMessage(res, key, errorMessage, refs) {
520
525
  if (!refs?.errorMessages) return;
521
- if (errorMessage) {
522
- res.errorMessage = {
523
- ...res.errorMessage,
524
- [key]: errorMessage
525
- };
526
- }
526
+ if (errorMessage) res.errorMessage = {
527
+ ...res.errorMessage,
528
+ [key]: errorMessage
529
+ };
527
530
  }
528
531
  function setResponseValueAndErrors(res, key, value, errorMessage, refs) {
529
532
  res[key] = value;
@@ -539,19 +542,13 @@ function parseAnyDef() {
539
542
  //#endregion
540
543
  //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.5_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/array.js
541
544
  function parseArrayDef(def, refs) {
542
- const res = {type: "array"};
543
- if (def.type?._def && def.type?._def?.typeName !== ZodFirstPartyTypeKind$2.ZodAny) {
544
- res.items = parseDef(def.type._def, {
545
- ...refs,
546
- currentPath: [...refs.currentPath, "items"]
547
- });
548
- }
549
- if (def.minLength) {
550
- setResponseValueAndErrors(res, "minItems", def.minLength.value, def.minLength.message, refs);
551
- }
552
- if (def.maxLength) {
553
- setResponseValueAndErrors(res, "maxItems", def.maxLength.value, def.maxLength.message, refs);
554
- }
545
+ const res = { type: "array" };
546
+ if (def.type?._def && def.type?._def?.typeName !== zod.ZodFirstPartyTypeKind.ZodAny) res.items = parseDef(def.type._def, {
547
+ ...refs,
548
+ currentPath: [...refs.currentPath, "items"]
549
+ });
550
+ if (def.minLength) setResponseValueAndErrors(res, "minItems", def.minLength.value, def.minLength.message, refs);
551
+ if (def.maxLength) setResponseValueAndErrors(res, "maxItems", def.maxLength.value, def.maxLength.message, refs);
555
552
  if (def.exactLength) {
556
553
  setResponseValueAndErrors(res, "minItems", def.exactLength.value, def.exactLength.message, refs);
557
554
  setResponseValueAndErrors(res, "maxItems", def.exactLength.value, def.exactLength.message, refs);
@@ -567,40 +564,26 @@ function parseBigintDef(def, refs) {
567
564
  format: "int64"
568
565
  };
569
566
  if (!def.checks) return res;
570
- for (const check of def.checks) {
571
- switch (check.kind) {
572
- case "min":
573
- if (refs.target === "jsonSchema7") {
574
- if (check.inclusive) {
575
- setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
576
- } else {
577
- setResponseValueAndErrors(res, "exclusiveMinimum", check.value, check.message, refs);
578
- }
579
- } else {
580
- if (!check.inclusive) {
581
- res.exclusiveMinimum = true;
582
- }
583
- setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
584
- }
585
- break;
586
- case "max":
587
- if (refs.target === "jsonSchema7") {
588
- if (check.inclusive) {
589
- setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
590
- } else {
591
- setResponseValueAndErrors(res, "exclusiveMaximum", check.value, check.message, refs);
592
- }
593
- } else {
594
- if (!check.inclusive) {
595
- res.exclusiveMaximum = true;
596
- }
597
- setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
598
- }
599
- break;
600
- case "multipleOf":
601
- setResponseValueAndErrors(res, "multipleOf", check.value, check.message, refs);
602
- break;
603
- }
567
+ for (const check of def.checks) switch (check.kind) {
568
+ case "min":
569
+ if (refs.target === "jsonSchema7") if (check.inclusive) setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
570
+ else setResponseValueAndErrors(res, "exclusiveMinimum", check.value, check.message, refs);
571
+ else {
572
+ if (!check.inclusive) res.exclusiveMinimum = true;
573
+ setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
574
+ }
575
+ break;
576
+ case "max":
577
+ if (refs.target === "jsonSchema7") if (check.inclusive) setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
578
+ else setResponseValueAndErrors(res, "exclusiveMaximum", check.value, check.message, refs);
579
+ else {
580
+ if (!check.inclusive) res.exclusiveMaximum = true;
581
+ setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
582
+ }
583
+ break;
584
+ case "multipleOf":
585
+ setResponseValueAndErrors(res, "multipleOf", check.value, check.message, refs);
586
+ break;
604
587
  }
605
588
  return res;
606
589
  }
@@ -608,7 +591,7 @@ function parseBigintDef(def, refs) {
608
591
  //#endregion
609
592
  //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.5_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js
610
593
  function parseBooleanDef() {
611
- return {type: "boolean"};
594
+ return { type: "boolean" };
612
595
  }
613
596
 
614
597
  //#endregion
@@ -627,9 +610,7 @@ const parseCatchDef = (def, refs) => {
627
610
  //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.5_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/date.js
628
611
  function parseDateDef(def, refs, overrideDateStrategy) {
629
612
  const strategy = overrideDateStrategy ?? refs.dateStrategy;
630
- if (Array.isArray(strategy)) {
631
- return {anyOf: strategy.map((item, i) => parseDateDef(def, refs, item))};
632
- }
613
+ if (Array.isArray(strategy)) return { anyOf: strategy.map((item, i) => parseDateDef(def, refs, item)) };
633
614
  switch (strategy) {
634
615
  case "string":
635
616
  case "format:date-time": return {
@@ -648,18 +629,14 @@ const integerDateParser = (def, refs) => {
648
629
  type: "integer",
649
630
  format: "unix-time"
650
631
  };
651
- if (refs.target === "openApi3") {
652
- return res;
653
- }
654
- for (const check of def.checks) {
655
- switch (check.kind) {
656
- case "min":
657
- setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
658
- break;
659
- case "max":
660
- setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
661
- break;
662
- }
632
+ if (refs.target === "openApi3") return res;
633
+ for (const check of def.checks) switch (check.kind) {
634
+ case "min":
635
+ setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
636
+ break;
637
+ case "max":
638
+ setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
639
+ break;
663
640
  }
664
641
  return res;
665
642
  };
@@ -691,33 +668,37 @@ function parseEnumDef(def) {
691
668
  //#endregion
692
669
  //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.5_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js
693
670
  const isJsonSchema7AllOfType = (type) => {
694
- if ("type"in type && type.type === "string") return false;
695
- return "allOf"in type;
671
+ if ("type" in type && type.type === "string") return false;
672
+ return "allOf" in type;
696
673
  };
697
674
  function parseIntersectionDef(def, refs) {
698
675
  const allOf = [parseDef(def.left._def, {
699
676
  ...refs,
700
- currentPath: [...refs.currentPath, "allOf", "0"]
677
+ currentPath: [
678
+ ...refs.currentPath,
679
+ "allOf",
680
+ "0"
681
+ ]
701
682
  }), parseDef(def.right._def, {
702
683
  ...refs,
703
- currentPath: [...refs.currentPath, "allOf", "1"]
704
- }),].filter((x) => !!x);
705
- let unevaluatedProperties = refs.target === "jsonSchema2019-09" ? {unevaluatedProperties: false} : undefined;
684
+ currentPath: [
685
+ ...refs.currentPath,
686
+ "allOf",
687
+ "1"
688
+ ]
689
+ })].filter((x) => !!x);
690
+ let unevaluatedProperties = refs.target === "jsonSchema2019-09" ? { unevaluatedProperties: false } : undefined;
706
691
  const mergedAllOf = [];
707
692
  allOf.forEach((schema$1) => {
708
693
  if (isJsonSchema7AllOfType(schema$1)) {
709
694
  mergedAllOf.push(...schema$1.allOf);
710
- if (schema$1.unevaluatedProperties === undefined) {
711
- unevaluatedProperties = undefined;
712
- }
695
+ if (schema$1.unevaluatedProperties === undefined) unevaluatedProperties = undefined;
713
696
  } else {
714
697
  let nestedSchema = schema$1;
715
- if ("additionalProperties"in schema$1 && schema$1.additionalProperties === false) {
716
- const { additionalProperties: additionalProperties,...rest } = schema$1;
698
+ if ("additionalProperties" in schema$1 && schema$1.additionalProperties === false) {
699
+ const { additionalProperties,...rest } = schema$1;
717
700
  nestedSchema = rest;
718
- } else {
719
- unevaluatedProperties = undefined;
720
- }
701
+ } else unevaluatedProperties = undefined;
721
702
  mergedAllOf.push(nestedSchema);
722
703
  }
723
704
  });
@@ -731,15 +712,11 @@ function parseIntersectionDef(def, refs) {
731
712
  //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.5_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js
732
713
  function parseLiteralDef(def, refs) {
733
714
  const parsedType = typeof def.value;
734
- if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") {
735
- return {type: Array.isArray(def.value) ? "array" : "object"};
736
- }
737
- if (refs.target === "openApi3") {
738
- return {
739
- type: parsedType === "bigint" ? "integer" : parsedType,
740
- enum: [def.value]
741
- };
742
- }
715
+ if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") return { type: Array.isArray(def.value) ? "array" : "object" };
716
+ if (refs.target === "openApi3") return {
717
+ type: parsedType === "bigint" ? "integer" : parsedType,
718
+ enum: [def.value]
719
+ };
743
720
  return {
744
721
  type: parsedType === "bigint" ? "integer" : parsedType,
745
722
  const: def.value
@@ -755,9 +732,7 @@ const zodPatterns = {
755
732
  ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
756
733
  email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,
757
734
  emoji: () => {
758
- if (emojiRegex === undefined) {
759
- emojiRegex = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u");
760
- }
735
+ if (emojiRegex === undefined) emojiRegex = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u");
761
736
  return emojiRegex;
762
737
  },
763
738
  uuid: /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,
@@ -767,170 +742,148 @@ const zodPatterns = {
767
742
  nanoid: /^[a-zA-Z0-9_-]{21}$/
768
743
  };
769
744
  function parseStringDef(def, refs) {
770
- const res = {type: "string"};
745
+ const res = { type: "string" };
771
746
  function processPattern(value) {
772
747
  return refs.patternStrategy === "escape" ? escapeNonAlphaNumeric(value) : value;
773
748
  }
774
- if (def.checks) {
775
- for (const check of def.checks) {
776
- switch (check.kind) {
777
- case "min":
778
- setResponseValueAndErrors(res, "minLength", typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value, check.message, refs);
779
- break;
780
- case "max":
781
- setResponseValueAndErrors(res, "maxLength", typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs);
782
- break;
783
- case "email":
784
- switch (refs.emailStrategy) {
785
- case "format:email":
786
- addFormat(res, "email", check.message, refs);
787
- break;
788
- case "format:idn-email":
789
- addFormat(res, "idn-email", check.message, refs);
790
- break;
791
- case "pattern:zod":
792
- addPattern(res, zodPatterns.email, check.message, refs);
793
- break;
794
- }
795
- break;
796
- case "url":
797
- addFormat(res, "uri", check.message, refs);
798
- break;
799
- case "uuid":
800
- addFormat(res, "uuid", check.message, refs);
801
- break;
802
- case "regex":
803
- addPattern(res, check.regex, check.message, refs);
804
- break;
805
- case "cuid":
806
- addPattern(res, zodPatterns.cuid, check.message, refs);
749
+ if (def.checks) for (const check of def.checks) switch (check.kind) {
750
+ case "min":
751
+ setResponseValueAndErrors(res, "minLength", typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value, check.message, refs);
752
+ break;
753
+ case "max":
754
+ setResponseValueAndErrors(res, "maxLength", typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs);
755
+ break;
756
+ case "email":
757
+ switch (refs.emailStrategy) {
758
+ case "format:email":
759
+ addFormat(res, "email", check.message, refs);
807
760
  break;
808
- case "cuid2":
809
- addPattern(res, zodPatterns.cuid2, check.message, refs);
761
+ case "format:idn-email":
762
+ addFormat(res, "idn-email", check.message, refs);
810
763
  break;
811
- case "startsWith":
812
- addPattern(res, RegExp(`^${processPattern(check.value)}`), check.message, refs);
764
+ case "pattern:zod":
765
+ addPattern(res, zodPatterns.email, check.message, refs);
813
766
  break;
814
- case "endsWith":
815
- addPattern(res, RegExp(`${processPattern(check.value)}$`), check.message, refs);
816
- break;
817
- case "datetime":
818
- addFormat(res, "date-time", check.message, refs);
819
- break;
820
- case "date":
821
- addFormat(res, "date", check.message, refs);
822
- break;
823
- case "time":
824
- addFormat(res, "time", check.message, refs);
825
- break;
826
- case "duration":
827
- addFormat(res, "duration", check.message, refs);
828
- break;
829
- case "length":
830
- setResponseValueAndErrors(res, "minLength", typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value, check.message, refs);
831
- setResponseValueAndErrors(res, "maxLength", typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs);
832
- break;
833
- case "includes": {
834
- addPattern(res, RegExp(processPattern(check.value)), check.message, refs);
835
- break;
836
- }
837
- case "ip": {
838
- if (check.version !== "v6") {
839
- addFormat(res, "ipv4", check.message, refs);
840
- }
841
- if (check.version !== "v4") {
842
- addFormat(res, "ipv6", check.message, refs);
843
- }
767
+ }
768
+ break;
769
+ case "url":
770
+ addFormat(res, "uri", check.message, refs);
771
+ break;
772
+ case "uuid":
773
+ addFormat(res, "uuid", check.message, refs);
774
+ break;
775
+ case "regex":
776
+ addPattern(res, check.regex, check.message, refs);
777
+ break;
778
+ case "cuid":
779
+ addPattern(res, zodPatterns.cuid, check.message, refs);
780
+ break;
781
+ case "cuid2":
782
+ addPattern(res, zodPatterns.cuid2, check.message, refs);
783
+ break;
784
+ case "startsWith":
785
+ addPattern(res, RegExp(`^${processPattern(check.value)}`), check.message, refs);
786
+ break;
787
+ case "endsWith":
788
+ addPattern(res, RegExp(`${processPattern(check.value)}$`), check.message, refs);
789
+ break;
790
+ case "datetime":
791
+ addFormat(res, "date-time", check.message, refs);
792
+ break;
793
+ case "date":
794
+ addFormat(res, "date", check.message, refs);
795
+ break;
796
+ case "time":
797
+ addFormat(res, "time", check.message, refs);
798
+ break;
799
+ case "duration":
800
+ addFormat(res, "duration", check.message, refs);
801
+ break;
802
+ case "length":
803
+ setResponseValueAndErrors(res, "minLength", typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value, check.message, refs);
804
+ setResponseValueAndErrors(res, "maxLength", typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs);
805
+ break;
806
+ case "includes": {
807
+ addPattern(res, RegExp(processPattern(check.value)), check.message, refs);
808
+ break;
809
+ }
810
+ case "ip": {
811
+ if (check.version !== "v6") addFormat(res, "ipv4", check.message, refs);
812
+ if (check.version !== "v4") addFormat(res, "ipv6", check.message, refs);
813
+ break;
814
+ }
815
+ case "emoji":
816
+ addPattern(res, zodPatterns.emoji, check.message, refs);
817
+ break;
818
+ case "ulid": {
819
+ addPattern(res, zodPatterns.ulid, check.message, refs);
820
+ break;
821
+ }
822
+ case "base64": {
823
+ switch (refs.base64Strategy) {
824
+ case "format:binary": {
825
+ addFormat(res, "binary", check.message, refs);
844
826
  break;
845
827
  }
846
- case "emoji":
847
- addPattern(res, zodPatterns.emoji, check.message, refs);
848
- break;
849
- case "ulid": {
850
- addPattern(res, zodPatterns.ulid, check.message, refs);
828
+ case "contentEncoding:base64": {
829
+ setResponseValueAndErrors(res, "contentEncoding", "base64", check.message, refs);
851
830
  break;
852
831
  }
853
- case "base64": {
854
- switch (refs.base64Strategy) {
855
- case "format:binary": {
856
- addFormat(res, "binary", check.message, refs);
857
- break;
858
- }
859
- case "contentEncoding:base64": {
860
- setResponseValueAndErrors(res, "contentEncoding", "base64", check.message, refs);
861
- break;
862
- }
863
- case "pattern:zod": {
864
- addPattern(res, zodPatterns.base64, check.message, refs);
865
- break;
866
- }
867
- }
832
+ case "pattern:zod": {
833
+ addPattern(res, zodPatterns.base64, check.message, refs);
868
834
  break;
869
835
  }
870
- case "nanoid": {
871
- addPattern(res, zodPatterns.nanoid, check.message, refs);
872
- }
873
- case "toLowerCase":
874
- case "toUpperCase":
875
- case "trim": break;
876
- default: ((_) => {})(check);
877
836
  }
837
+ break;
878
838
  }
839
+ case "nanoid": addPattern(res, zodPatterns.nanoid, check.message, refs);
840
+ case "toLowerCase":
841
+ case "toUpperCase":
842
+ case "trim": break;
843
+ default: ((_) => {})(check);
879
844
  }
880
845
  return res;
881
846
  }
882
- const escapeNonAlphaNumeric = (value) => ((Array.from(value)).map((c) => /[a-zA-Z0-9]/.test(c) ? c : `\\${c}`)).join("");
847
+ const escapeNonAlphaNumeric = (value) => Array.from(value).map((c) => /[a-zA-Z0-9]/.test(c) ? c : `\\${c}`).join("");
883
848
  const addFormat = (schema$1, value, message, refs) => {
884
849
  if (schema$1.format || schema$1.anyOf?.some((x) => x.format)) {
885
- if (!schema$1.anyOf) {
886
- schema$1.anyOf = [];
887
- }
850
+ if (!schema$1.anyOf) schema$1.anyOf = [];
888
851
  if (schema$1.format) {
889
852
  schema$1.anyOf.push({
890
853
  format: schema$1.format,
891
- ...schema$1.errorMessage && refs.errorMessages && {errorMessage: {format: schema$1.errorMessage.format}}
854
+ ...schema$1.errorMessage && refs.errorMessages && { errorMessage: { format: schema$1.errorMessage.format } }
892
855
  });
893
856
  delete schema$1.format;
894
857
  if (schema$1.errorMessage) {
895
858
  delete schema$1.errorMessage.format;
896
- if ((Object.keys(schema$1.errorMessage)).length === 0) {
897
- delete schema$1.errorMessage;
898
- }
859
+ if (Object.keys(schema$1.errorMessage).length === 0) delete schema$1.errorMessage;
899
860
  }
900
861
  }
901
862
  schema$1.anyOf.push({
902
863
  format: value,
903
- ...message && refs.errorMessages && {errorMessage: {format: message}}
864
+ ...message && refs.errorMessages && { errorMessage: { format: message } }
904
865
  });
905
- } else {
906
- setResponseValueAndErrors(schema$1, "format", value, message, refs);
907
- }
866
+ } else setResponseValueAndErrors(schema$1, "format", value, message, refs);
908
867
  };
909
868
  const addPattern = (schema$1, regex, message, refs) => {
910
869
  if (schema$1.pattern || schema$1.allOf?.some((x) => x.pattern)) {
911
- if (!schema$1.allOf) {
912
- schema$1.allOf = [];
913
- }
870
+ if (!schema$1.allOf) schema$1.allOf = [];
914
871
  if (schema$1.pattern) {
915
872
  schema$1.allOf.push({
916
873
  pattern: schema$1.pattern,
917
- ...schema$1.errorMessage && refs.errorMessages && {errorMessage: {pattern: schema$1.errorMessage.pattern}}
874
+ ...schema$1.errorMessage && refs.errorMessages && { errorMessage: { pattern: schema$1.errorMessage.pattern } }
918
875
  });
919
876
  delete schema$1.pattern;
920
877
  if (schema$1.errorMessage) {
921
878
  delete schema$1.errorMessage.pattern;
922
- if ((Object.keys(schema$1.errorMessage)).length === 0) {
923
- delete schema$1.errorMessage;
924
- }
879
+ if (Object.keys(schema$1.errorMessage).length === 0) delete schema$1.errorMessage;
925
880
  }
926
881
  }
927
882
  schema$1.allOf.push({
928
883
  pattern: processRegExp(regex, refs),
929
- ...message && refs.errorMessages && {errorMessage: {pattern: message}}
884
+ ...message && refs.errorMessages && { errorMessage: { pattern: message } }
930
885
  });
931
- } else {
932
- setResponseValueAndErrors(schema$1, "pattern", processRegExp(regex, refs), message, refs);
933
- }
886
+ } else setResponseValueAndErrors(schema$1, "pattern", processRegExp(regex, refs), message, refs);
934
887
  };
935
888
  const processRegExp = (regexOrFunction, refs) => {
936
889
  const regex = typeof regexOrFunction === "function" ? regexOrFunction() : regexOrFunction;
@@ -961,9 +914,7 @@ const processRegExp = (regexOrFunction, refs) => {
961
914
  } else if (source[i + 1] === "-" && source[i + 2]?.match(/[a-z]/)) {
962
915
  pattern += source[i];
963
916
  inCharRange = true;
964
- } else {
965
- pattern += `${source[i]}${source[i].toUpperCase()}`;
966
- }
917
+ } else pattern += `${source[i]}${source[i].toUpperCase()}`;
967
918
  continue;
968
919
  }
969
920
  } else if (source[i].match(/[a-z]/)) {
@@ -985,13 +936,9 @@ const processRegExp = (regexOrFunction, refs) => {
985
936
  continue;
986
937
  }
987
938
  pattern += source[i];
988
- if (source[i] === "\\") {
989
- isEscaped = true;
990
- } else if (inCharGroup && source[i] === "]") {
991
- inCharGroup = false;
992
- } else if (!inCharGroup && source[i] === "[") {
993
- inCharGroup = true;
994
- }
939
+ if (source[i] === "\\") isEscaped = true;
940
+ else if (inCharGroup && source[i] === "]") inCharGroup = false;
941
+ else if (!inCharGroup && source[i] === "[") inCharGroup = true;
995
942
  }
996
943
  try {
997
944
  const regexTest = new RegExp(pattern);
@@ -1005,20 +952,22 @@ const processRegExp = (regexOrFunction, refs) => {
1005
952
  //#endregion
1006
953
  //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.5_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/record.js
1007
954
  function parseRecordDef(def, refs) {
1008
- if (refs.target === "openApi3" && def.keyType?._def.typeName === ZodFirstPartyTypeKind$1.ZodEnum) {
1009
- return {
1010
- type: "object",
1011
- required: def.keyType._def.values,
1012
- properties: def.keyType._def.values.reduce((acc, key) => ({
1013
- ...acc,
1014
- [key]: parseDef(def.valueType._def, {
1015
- ...refs,
1016
- currentPath: [...refs.currentPath, "properties", key]
1017
- }) ?? {}
1018
- }), {}),
1019
- additionalProperties: false
1020
- };
1021
- }
955
+ if (refs.target === "openApi3" && def.keyType?._def.typeName === zod.ZodFirstPartyTypeKind.ZodEnum) return {
956
+ type: "object",
957
+ required: def.keyType._def.values,
958
+ properties: def.keyType._def.values.reduce((acc, key) => ({
959
+ ...acc,
960
+ [key]: parseDef(def.valueType._def, {
961
+ ...refs,
962
+ currentPath: [
963
+ ...refs.currentPath,
964
+ "properties",
965
+ key
966
+ ]
967
+ }) ?? {}
968
+ }), {}),
969
+ additionalProperties: false
970
+ };
1022
971
  const schema$1 = {
1023
972
  type: "object",
1024
973
  additionalProperties: parseDef(def.valueType._def, {
@@ -1026,22 +975,19 @@ function parseRecordDef(def, refs) {
1026
975
  currentPath: [...refs.currentPath, "additionalProperties"]
1027
976
  }) ?? {}
1028
977
  };
1029
- if (refs.target === "openApi3") {
1030
- return schema$1;
1031
- }
1032
- if (def.keyType?._def.typeName === ZodFirstPartyTypeKind$1.ZodString && def.keyType._def.checks?.length) {
1033
- const { type: type,...keyType } = parseStringDef(def.keyType._def, refs);
978
+ if (refs.target === "openApi3") return schema$1;
979
+ if (def.keyType?._def.typeName === zod.ZodFirstPartyTypeKind.ZodString && def.keyType._def.checks?.length) {
980
+ const { type,...keyType } = parseStringDef(def.keyType._def, refs);
1034
981
  return {
1035
982
  ...schema$1,
1036
983
  propertyNames: keyType
1037
984
  };
1038
- } else if (def.keyType?._def.typeName === ZodFirstPartyTypeKind$1.ZodEnum) {
1039
- return {
1040
- ...schema$1,
1041
- propertyNames: {enum: def.keyType._def.values}
1042
- };
1043
- } else if (def.keyType?._def.typeName === ZodFirstPartyTypeKind$1.ZodBranded && def.keyType._def.type._def.typeName === ZodFirstPartyTypeKind$1.ZodString && def.keyType._def.type._def.checks?.length) {
1044
- const { type: type,...keyType } = parseBrandedDef(def.keyType._def, refs);
985
+ } else if (def.keyType?._def.typeName === zod.ZodFirstPartyTypeKind.ZodEnum) return {
986
+ ...schema$1,
987
+ propertyNames: { enum: def.keyType._def.values }
988
+ };
989
+ else if (def.keyType?._def.typeName === zod.ZodFirstPartyTypeKind.ZodBranded && def.keyType._def.type._def.typeName === zod.ZodFirstPartyTypeKind.ZodString && def.keyType._def.type._def.checks?.length) {
990
+ const { type,...keyType } = parseBrandedDef(def.keyType._def, refs);
1045
991
  return {
1046
992
  ...schema$1,
1047
993
  propertyNames: keyType
@@ -1053,16 +999,24 @@ function parseRecordDef(def, refs) {
1053
999
  //#endregion
1054
1000
  //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.5_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/map.js
1055
1001
  function parseMapDef(def, refs) {
1056
- if (refs.mapStrategy === "record") {
1057
- return parseRecordDef(def, refs);
1058
- }
1002
+ if (refs.mapStrategy === "record") return parseRecordDef(def, refs);
1059
1003
  const keys = parseDef(def.keyType._def, {
1060
1004
  ...refs,
1061
- currentPath: [...refs.currentPath, "items", "items", "0"]
1005
+ currentPath: [
1006
+ ...refs.currentPath,
1007
+ "items",
1008
+ "items",
1009
+ "0"
1010
+ ]
1062
1011
  }) || {};
1063
1012
  const values = parseDef(def.valueType._def, {
1064
1013
  ...refs,
1065
- currentPath: [...refs.currentPath, "items", "items", "1"]
1014
+ currentPath: [
1015
+ ...refs.currentPath,
1016
+ "items",
1017
+ "items",
1018
+ "1"
1019
+ ]
1066
1020
  }) || {};
1067
1021
  return {
1068
1022
  type: "array",
@@ -1080,7 +1034,7 @@ function parseMapDef(def, refs) {
1080
1034
  //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.5_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js
1081
1035
  function parseNativeEnumDef(def) {
1082
1036
  const object = def.values;
1083
- const actualKeys = (Object.keys(def.values)).filter((key) => {
1037
+ const actualKeys = Object.keys(def.values).filter((key) => {
1084
1038
  return typeof object[object[key]] !== "number";
1085
1039
  });
1086
1040
  const actualValues = actualKeys.map((key) => object[key]);
@@ -1094,7 +1048,7 @@ function parseNativeEnumDef(def) {
1094
1048
  //#endregion
1095
1049
  //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.5_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/never.js
1096
1050
  function parseNeverDef() {
1097
- return {not: {}};
1051
+ return { not: {} };
1098
1052
  }
1099
1053
 
1100
1054
  //#endregion
@@ -1103,7 +1057,7 @@ function parseNullDef(refs) {
1103
1057
  return refs.target === "openApi3" ? {
1104
1058
  enum: ["null"],
1105
1059
  nullable: true
1106
- } : {type: "null"};
1060
+ } : { type: "null" };
1107
1061
  }
1108
1062
 
1109
1063
  //#endregion
@@ -1123,7 +1077,7 @@ function parseUnionDef(def, refs) {
1123
1077
  const type = primitiveMappings[x._def.typeName];
1124
1078
  return type && !types$1.includes(type) ? [...types$1, type] : types$1;
1125
1079
  }, []);
1126
- return {type: types.length > 1 ? types : types[0]};
1080
+ return { type: types.length > 1 ? types : types[0] };
1127
1081
  } else if (options$1.every((x) => x._def.typeName === "ZodLiteral" && !x.description)) {
1128
1082
  const types = options$1.reduce((acc, x) => {
1129
1083
  const type = typeof x._def.value;
@@ -1148,40 +1102,46 @@ function parseUnionDef(def, refs) {
1148
1102
  }, [])
1149
1103
  };
1150
1104
  }
1151
- } else if (options$1.every((x) => x._def.typeName === "ZodEnum")) {
1152
- return {
1153
- type: "string",
1154
- enum: options$1.reduce((acc, x) => [...acc, ...x._def.values.filter((x$1) => !acc.includes(x$1)),], [])
1155
- };
1156
- }
1105
+ } else if (options$1.every((x) => x._def.typeName === "ZodEnum")) return {
1106
+ type: "string",
1107
+ enum: options$1.reduce((acc, x) => [...acc, ...x._def.values.filter((x$1) => !acc.includes(x$1))], [])
1108
+ };
1157
1109
  return asAnyOf(def, refs);
1158
1110
  }
1159
1111
  const asAnyOf = (def, refs) => {
1160
- const anyOf = ((def.options instanceof Map ? Array.from(def.options.values()) : def.options).map((x, i) => parseDef(x._def, {
1112
+ const anyOf = (def.options instanceof Map ? Array.from(def.options.values()) : def.options).map((x, i) => parseDef(x._def, {
1161
1113
  ...refs,
1162
- currentPath: [...refs.currentPath, "anyOf", `${i}`]
1163
- }))).filter((x) => !!x && (!refs.strictUnions || typeof x === "object" && (Object.keys(x)).length > 0));
1164
- return anyOf.length ? {anyOf} : undefined;
1114
+ currentPath: [
1115
+ ...refs.currentPath,
1116
+ "anyOf",
1117
+ `${i}`
1118
+ ]
1119
+ })).filter((x) => !!x && (!refs.strictUnions || typeof x === "object" && Object.keys(x).length > 0));
1120
+ return anyOf.length ? { anyOf } : undefined;
1165
1121
  };
1166
1122
 
1167
1123
  //#endregion
1168
1124
  //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.5_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js
1169
1125
  function parseNullableDef(def, refs) {
1170
- if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(def.innerType._def.typeName) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
1171
- if (refs.target === "openApi3") {
1172
- return {
1173
- type: primitiveMappings[def.innerType._def.typeName],
1174
- nullable: true
1175
- };
1176
- }
1177
- return {type: [primitiveMappings[def.innerType._def.typeName], "null",]};
1126
+ if ([
1127
+ "ZodString",
1128
+ "ZodNumber",
1129
+ "ZodBigInt",
1130
+ "ZodBoolean",
1131
+ "ZodNull"
1132
+ ].includes(def.innerType._def.typeName) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
1133
+ if (refs.target === "openApi3") return {
1134
+ type: primitiveMappings[def.innerType._def.typeName],
1135
+ nullable: true
1136
+ };
1137
+ return { type: [primitiveMappings[def.innerType._def.typeName], "null"] };
1178
1138
  }
1179
1139
  if (refs.target === "openApi3") {
1180
1140
  const base$1 = parseDef(def.innerType._def, {
1181
1141
  ...refs,
1182
1142
  currentPath: [...refs.currentPath]
1183
1143
  });
1184
- if (base$1 && "$ref"in base$1) return {
1144
+ if (base$1 && "$ref" in base$1) return {
1185
1145
  allOf: [base$1],
1186
1146
  nullable: true
1187
1147
  };
@@ -1192,54 +1152,44 @@ function parseNullableDef(def, refs) {
1192
1152
  }
1193
1153
  const base = parseDef(def.innerType._def, {
1194
1154
  ...refs,
1195
- currentPath: [...refs.currentPath, "anyOf", "0"]
1155
+ currentPath: [
1156
+ ...refs.currentPath,
1157
+ "anyOf",
1158
+ "0"
1159
+ ]
1196
1160
  });
1197
- return base && {anyOf: [base, {type: "null"}]};
1161
+ return base && { anyOf: [base, { type: "null" }] };
1198
1162
  }
1199
1163
 
1200
1164
  //#endregion
1201
1165
  //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.5_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/number.js
1202
1166
  function parseNumberDef(def, refs) {
1203
- const res = {type: "number"};
1167
+ const res = { type: "number" };
1204
1168
  if (!def.checks) return res;
1205
- for (const check of def.checks) {
1206
- switch (check.kind) {
1207
- case "int":
1208
- res.type = "integer";
1209
- addErrorMessage(res, "type", check.message, refs);
1210
- break;
1211
- case "min":
1212
- if (refs.target === "jsonSchema7") {
1213
- if (check.inclusive) {
1214
- setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
1215
- } else {
1216
- setResponseValueAndErrors(res, "exclusiveMinimum", check.value, check.message, refs);
1217
- }
1218
- } else {
1219
- if (!check.inclusive) {
1220
- res.exclusiveMinimum = true;
1221
- }
1222
- setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
1223
- }
1224
- break;
1225
- case "max":
1226
- if (refs.target === "jsonSchema7") {
1227
- if (check.inclusive) {
1228
- setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
1229
- } else {
1230
- setResponseValueAndErrors(res, "exclusiveMaximum", check.value, check.message, refs);
1231
- }
1232
- } else {
1233
- if (!check.inclusive) {
1234
- res.exclusiveMaximum = true;
1235
- }
1236
- setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
1237
- }
1238
- break;
1239
- case "multipleOf":
1240
- setResponseValueAndErrors(res, "multipleOf", check.value, check.message, refs);
1241
- break;
1242
- }
1169
+ for (const check of def.checks) switch (check.kind) {
1170
+ case "int":
1171
+ res.type = "integer";
1172
+ addErrorMessage(res, "type", check.message, refs);
1173
+ break;
1174
+ case "min":
1175
+ if (refs.target === "jsonSchema7") if (check.inclusive) setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
1176
+ else setResponseValueAndErrors(res, "exclusiveMinimum", check.value, check.message, refs);
1177
+ else {
1178
+ if (!check.inclusive) res.exclusiveMinimum = true;
1179
+ setResponseValueAndErrors(res, "minimum", check.value, check.message, refs);
1180
+ }
1181
+ break;
1182
+ case "max":
1183
+ if (refs.target === "jsonSchema7") if (check.inclusive) setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
1184
+ else setResponseValueAndErrors(res, "exclusiveMaximum", check.value, check.message, refs);
1185
+ else {
1186
+ if (!check.inclusive) res.exclusiveMaximum = true;
1187
+ setResponseValueAndErrors(res, "maximum", check.value, check.message, refs);
1188
+ }
1189
+ break;
1190
+ case "multipleOf":
1191
+ setResponseValueAndErrors(res, "multipleOf", check.value, check.message, refs);
1192
+ break;
1243
1193
  }
1244
1194
  return res;
1245
1195
  }
@@ -1247,27 +1197,32 @@ function parseNumberDef(def, refs) {
1247
1197
  //#endregion
1248
1198
  //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.5_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/object.js
1249
1199
  function decideAdditionalProperties(def, refs) {
1250
- if (refs.removeAdditionalStrategy === "strict") {
1251
- return def.catchall._def.typeName === "ZodNever" ? def.unknownKeys !== "strict" : parseDef(def.catchall._def, {
1252
- ...refs,
1253
- currentPath: [...refs.currentPath, "additionalProperties"]
1254
- }) ?? true;
1255
- } else {
1256
- return def.catchall._def.typeName === "ZodNever" ? def.unknownKeys === "passthrough" : parseDef(def.catchall._def, {
1257
- ...refs,
1258
- currentPath: [...refs.currentPath, "additionalProperties"]
1259
- }) ?? true;
1260
- }
1200
+ if (refs.removeAdditionalStrategy === "strict") return def.catchall._def.typeName === "ZodNever" ? def.unknownKeys !== "strict" : parseDef(def.catchall._def, {
1201
+ ...refs,
1202
+ currentPath: [...refs.currentPath, "additionalProperties"]
1203
+ }) ?? true;
1204
+ else return def.catchall._def.typeName === "ZodNever" ? def.unknownKeys === "passthrough" : parseDef(def.catchall._def, {
1205
+ ...refs,
1206
+ currentPath: [...refs.currentPath, "additionalProperties"]
1207
+ }) ?? true;
1261
1208
  }
1262
1209
  function parseObjectDef(def, refs) {
1263
1210
  const result = {
1264
1211
  type: "object",
1265
- ...(Object.entries(def.shape())).reduce((acc, [propName, propDef]) => {
1212
+ ...Object.entries(def.shape()).reduce((acc, [propName, propDef]) => {
1266
1213
  if (propDef === undefined || propDef._def === undefined) return acc;
1267
1214
  const parsedDef = parseDef(propDef._def, {
1268
1215
  ...refs,
1269
- currentPath: [...refs.currentPath, "properties", propName],
1270
- propertyPath: [...refs.currentPath, "properties", propName]
1216
+ currentPath: [
1217
+ ...refs.currentPath,
1218
+ "properties",
1219
+ propName
1220
+ ],
1221
+ propertyPath: [
1222
+ ...refs.currentPath,
1223
+ "properties",
1224
+ propName
1225
+ ]
1271
1226
  });
1272
1227
  if (parsedDef === undefined) return acc;
1273
1228
  return {
@@ -1290,33 +1245,40 @@ function parseObjectDef(def, refs) {
1290
1245
  //#endregion
1291
1246
  //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.5_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js
1292
1247
  const parseOptionalDef = (def, refs) => {
1293
- if (refs.currentPath.toString() === refs.propertyPath?.toString()) {
1294
- return parseDef(def.innerType._def, refs);
1295
- }
1248
+ if (refs.currentPath.toString() === refs.propertyPath?.toString()) return parseDef(def.innerType._def, refs);
1296
1249
  const innerSchema = parseDef(def.innerType._def, {
1297
1250
  ...refs,
1298
- currentPath: [...refs.currentPath, "anyOf", "1"]
1251
+ currentPath: [
1252
+ ...refs.currentPath,
1253
+ "anyOf",
1254
+ "1"
1255
+ ]
1299
1256
  });
1300
- return innerSchema ? {anyOf: [{not: {}}, innerSchema,]} : {};
1257
+ return innerSchema ? { anyOf: [{ not: {} }, innerSchema] } : {};
1301
1258
  };
1302
1259
 
1303
1260
  //#endregion
1304
1261
  //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.5_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js
1305
1262
  const parsePipelineDef = (def, refs) => {
1306
- if (refs.pipeStrategy === "input") {
1307
- return parseDef(def.in._def, refs);
1308
- } else if (refs.pipeStrategy === "output") {
1309
- return parseDef(def.out._def, refs);
1310
- }
1263
+ if (refs.pipeStrategy === "input") return parseDef(def.in._def, refs);
1264
+ else if (refs.pipeStrategy === "output") return parseDef(def.out._def, refs);
1311
1265
  const a = parseDef(def.in._def, {
1312
1266
  ...refs,
1313
- currentPath: [...refs.currentPath, "allOf", "0"]
1267
+ currentPath: [
1268
+ ...refs.currentPath,
1269
+ "allOf",
1270
+ "0"
1271
+ ]
1314
1272
  });
1315
1273
  const b = parseDef(def.out._def, {
1316
1274
  ...refs,
1317
- currentPath: [...refs.currentPath, "allOf", a ? "1" : "0"]
1275
+ currentPath: [
1276
+ ...refs.currentPath,
1277
+ "allOf",
1278
+ a ? "1" : "0"
1279
+ ]
1318
1280
  });
1319
- return {allOf: [a, b].filter((x) => x !== undefined)};
1281
+ return { allOf: [a, b].filter((x) => x !== undefined) };
1320
1282
  };
1321
1283
 
1322
1284
  //#endregion
@@ -1337,48 +1299,49 @@ function parseSetDef(def, refs) {
1337
1299
  uniqueItems: true,
1338
1300
  items
1339
1301
  };
1340
- if (def.minSize) {
1341
- setResponseValueAndErrors(schema$1, "minItems", def.minSize.value, def.minSize.message, refs);
1342
- }
1343
- if (def.maxSize) {
1344
- setResponseValueAndErrors(schema$1, "maxItems", def.maxSize.value, def.maxSize.message, refs);
1345
- }
1302
+ if (def.minSize) setResponseValueAndErrors(schema$1, "minItems", def.minSize.value, def.minSize.message, refs);
1303
+ if (def.maxSize) setResponseValueAndErrors(schema$1, "maxItems", def.maxSize.value, def.maxSize.message, refs);
1346
1304
  return schema$1;
1347
1305
  }
1348
1306
 
1349
1307
  //#endregion
1350
1308
  //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.5_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js
1351
1309
  function parseTupleDef(def, refs) {
1352
- if (def.rest) {
1353
- return {
1354
- type: "array",
1355
- minItems: def.items.length,
1356
- items: (def.items.map((x, i) => parseDef(x._def, {
1357
- ...refs,
1358
- currentPath: [...refs.currentPath, "items", `${i}`]
1359
- }))).reduce((acc, x) => x === undefined ? acc : [...acc, x], []),
1360
- additionalItems: parseDef(def.rest._def, {
1361
- ...refs,
1362
- currentPath: [...refs.currentPath, "additionalItems"]
1363
- })
1364
- };
1365
- } else {
1366
- return {
1367
- type: "array",
1368
- minItems: def.items.length,
1369
- maxItems: def.items.length,
1370
- items: (def.items.map((x, i) => parseDef(x._def, {
1371
- ...refs,
1372
- currentPath: [...refs.currentPath, "items", `${i}`]
1373
- }))).reduce((acc, x) => x === undefined ? acc : [...acc, x], [])
1374
- };
1375
- }
1310
+ if (def.rest) return {
1311
+ type: "array",
1312
+ minItems: def.items.length,
1313
+ items: def.items.map((x, i) => parseDef(x._def, {
1314
+ ...refs,
1315
+ currentPath: [
1316
+ ...refs.currentPath,
1317
+ "items",
1318
+ `${i}`
1319
+ ]
1320
+ })).reduce((acc, x) => x === undefined ? acc : [...acc, x], []),
1321
+ additionalItems: parseDef(def.rest._def, {
1322
+ ...refs,
1323
+ currentPath: [...refs.currentPath, "additionalItems"]
1324
+ })
1325
+ };
1326
+ else return {
1327
+ type: "array",
1328
+ minItems: def.items.length,
1329
+ maxItems: def.items.length,
1330
+ items: def.items.map((x, i) => parseDef(x._def, {
1331
+ ...refs,
1332
+ currentPath: [
1333
+ ...refs.currentPath,
1334
+ "items",
1335
+ `${i}`
1336
+ ]
1337
+ })).reduce((acc, x) => x === undefined ? acc : [...acc, x], [])
1338
+ };
1376
1339
  }
1377
1340
 
1378
1341
  //#endregion
1379
1342
  //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.5_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js
1380
1343
  function parseUndefinedDef() {
1381
- return {not: {}};
1344
+ return { not: {} };
1382
1345
  }
1383
1346
 
1384
1347
  //#endregion
@@ -1399,15 +1362,11 @@ function parseDef(def, refs, forceResolution = false) {
1399
1362
  const seenItem = refs.seen.get(def);
1400
1363
  if (refs.override) {
1401
1364
  const overrideResult = refs.override?.(def, refs, seenItem, forceResolution);
1402
- if (overrideResult !== ignoreOverride) {
1403
- return overrideResult;
1404
- }
1365
+ if (overrideResult !== ignoreOverride) return overrideResult;
1405
1366
  }
1406
1367
  if (seenItem && !forceResolution) {
1407
1368
  const seenSchema = get$ref(seenItem, refs);
1408
- if (seenSchema !== undefined) {
1409
- return seenSchema;
1410
- }
1369
+ if (seenSchema !== undefined) return seenSchema;
1411
1370
  }
1412
1371
  const newItem = {
1413
1372
  def,
@@ -1416,16 +1375,14 @@ function parseDef(def, refs, forceResolution = false) {
1416
1375
  };
1417
1376
  refs.seen.set(def, newItem);
1418
1377
  const jsonSchema = selectParser(def, def.typeName, refs);
1419
- if (jsonSchema) {
1420
- addMeta(def, refs, jsonSchema);
1421
- }
1378
+ if (jsonSchema) addMeta(def, refs, jsonSchema);
1422
1379
  newItem.jsonSchema = jsonSchema;
1423
1380
  return jsonSchema;
1424
1381
  }
1425
1382
  const get$ref = (item, refs) => {
1426
1383
  switch (refs.$refStrategy) {
1427
- case "root": return {$ref: item.path.join("/")};
1428
- case "relative": return {$ref: getRelativePath(refs.currentPath, item.path)};
1384
+ case "root": return { $ref: item.path.join("/") };
1385
+ case "relative": return { $ref: getRelativePath(refs.currentPath, item.path) };
1429
1386
  case "none":
1430
1387
  case "seen": {
1431
1388
  if (item.path.length < refs.currentPath.length && item.path.every((value, index) => refs.currentPath[index] === value)) {
@@ -1438,58 +1395,54 @@ const get$ref = (item, refs) => {
1438
1395
  };
1439
1396
  const getRelativePath = (pathA, pathB) => {
1440
1397
  let i = 0;
1441
- for (; i < pathA.length && i < pathB.length; i++) {
1442
- if (pathA[i] !== pathB[i]) break;
1443
- }
1398
+ for (; i < pathA.length && i < pathB.length; i++) if (pathA[i] !== pathB[i]) break;
1444
1399
  return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
1445
1400
  };
1446
1401
  const selectParser = (def, typeName, refs) => {
1447
1402
  switch (typeName) {
1448
- case ZodFirstPartyTypeKind.ZodString: return parseStringDef(def, refs);
1449
- case ZodFirstPartyTypeKind.ZodNumber: return parseNumberDef(def, refs);
1450
- case ZodFirstPartyTypeKind.ZodObject: return parseObjectDef(def, refs);
1451
- case ZodFirstPartyTypeKind.ZodBigInt: return parseBigintDef(def, refs);
1452
- case ZodFirstPartyTypeKind.ZodBoolean: return parseBooleanDef();
1453
- case ZodFirstPartyTypeKind.ZodDate: return parseDateDef(def, refs);
1454
- case ZodFirstPartyTypeKind.ZodUndefined: return parseUndefinedDef();
1455
- case ZodFirstPartyTypeKind.ZodNull: return parseNullDef(refs);
1456
- case ZodFirstPartyTypeKind.ZodArray: return parseArrayDef(def, refs);
1457
- case ZodFirstPartyTypeKind.ZodUnion:
1458
- case ZodFirstPartyTypeKind.ZodDiscriminatedUnion: return parseUnionDef(def, refs);
1459
- case ZodFirstPartyTypeKind.ZodIntersection: return parseIntersectionDef(def, refs);
1460
- case ZodFirstPartyTypeKind.ZodTuple: return parseTupleDef(def, refs);
1461
- case ZodFirstPartyTypeKind.ZodRecord: return parseRecordDef(def, refs);
1462
- case ZodFirstPartyTypeKind.ZodLiteral: return parseLiteralDef(def, refs);
1463
- case ZodFirstPartyTypeKind.ZodEnum: return parseEnumDef(def);
1464
- case ZodFirstPartyTypeKind.ZodNativeEnum: return parseNativeEnumDef(def);
1465
- case ZodFirstPartyTypeKind.ZodNullable: return parseNullableDef(def, refs);
1466
- case ZodFirstPartyTypeKind.ZodOptional: return parseOptionalDef(def, refs);
1467
- case ZodFirstPartyTypeKind.ZodMap: return parseMapDef(def, refs);
1468
- case ZodFirstPartyTypeKind.ZodSet: return parseSetDef(def, refs);
1469
- case ZodFirstPartyTypeKind.ZodLazy: return parseDef((def.getter())._def, refs);
1470
- case ZodFirstPartyTypeKind.ZodPromise: return parsePromiseDef(def, refs);
1471
- case ZodFirstPartyTypeKind.ZodNaN:
1472
- case ZodFirstPartyTypeKind.ZodNever: return parseNeverDef();
1473
- case ZodFirstPartyTypeKind.ZodEffects: return parseEffectsDef(def, refs);
1474
- case ZodFirstPartyTypeKind.ZodAny: return parseAnyDef();
1475
- case ZodFirstPartyTypeKind.ZodUnknown: return parseUnknownDef();
1476
- case ZodFirstPartyTypeKind.ZodDefault: return parseDefaultDef(def, refs);
1477
- case ZodFirstPartyTypeKind.ZodBranded: return parseBrandedDef(def, refs);
1478
- case ZodFirstPartyTypeKind.ZodReadonly: return parseReadonlyDef(def, refs);
1479
- case ZodFirstPartyTypeKind.ZodCatch: return parseCatchDef(def, refs);
1480
- case ZodFirstPartyTypeKind.ZodPipeline: return parsePipelineDef(def, refs);
1481
- case ZodFirstPartyTypeKind.ZodFunction:
1482
- case ZodFirstPartyTypeKind.ZodVoid:
1483
- case ZodFirstPartyTypeKind.ZodSymbol: return undefined;
1403
+ case zod.ZodFirstPartyTypeKind.ZodString: return parseStringDef(def, refs);
1404
+ case zod.ZodFirstPartyTypeKind.ZodNumber: return parseNumberDef(def, refs);
1405
+ case zod.ZodFirstPartyTypeKind.ZodObject: return parseObjectDef(def, refs);
1406
+ case zod.ZodFirstPartyTypeKind.ZodBigInt: return parseBigintDef(def, refs);
1407
+ case zod.ZodFirstPartyTypeKind.ZodBoolean: return parseBooleanDef();
1408
+ case zod.ZodFirstPartyTypeKind.ZodDate: return parseDateDef(def, refs);
1409
+ case zod.ZodFirstPartyTypeKind.ZodUndefined: return parseUndefinedDef();
1410
+ case zod.ZodFirstPartyTypeKind.ZodNull: return parseNullDef(refs);
1411
+ case zod.ZodFirstPartyTypeKind.ZodArray: return parseArrayDef(def, refs);
1412
+ case zod.ZodFirstPartyTypeKind.ZodUnion:
1413
+ case zod.ZodFirstPartyTypeKind.ZodDiscriminatedUnion: return parseUnionDef(def, refs);
1414
+ case zod.ZodFirstPartyTypeKind.ZodIntersection: return parseIntersectionDef(def, refs);
1415
+ case zod.ZodFirstPartyTypeKind.ZodTuple: return parseTupleDef(def, refs);
1416
+ case zod.ZodFirstPartyTypeKind.ZodRecord: return parseRecordDef(def, refs);
1417
+ case zod.ZodFirstPartyTypeKind.ZodLiteral: return parseLiteralDef(def, refs);
1418
+ case zod.ZodFirstPartyTypeKind.ZodEnum: return parseEnumDef(def);
1419
+ case zod.ZodFirstPartyTypeKind.ZodNativeEnum: return parseNativeEnumDef(def);
1420
+ case zod.ZodFirstPartyTypeKind.ZodNullable: return parseNullableDef(def, refs);
1421
+ case zod.ZodFirstPartyTypeKind.ZodOptional: return parseOptionalDef(def, refs);
1422
+ case zod.ZodFirstPartyTypeKind.ZodMap: return parseMapDef(def, refs);
1423
+ case zod.ZodFirstPartyTypeKind.ZodSet: return parseSetDef(def, refs);
1424
+ case zod.ZodFirstPartyTypeKind.ZodLazy: return parseDef(def.getter()._def, refs);
1425
+ case zod.ZodFirstPartyTypeKind.ZodPromise: return parsePromiseDef(def, refs);
1426
+ case zod.ZodFirstPartyTypeKind.ZodNaN:
1427
+ case zod.ZodFirstPartyTypeKind.ZodNever: return parseNeverDef();
1428
+ case zod.ZodFirstPartyTypeKind.ZodEffects: return parseEffectsDef(def, refs);
1429
+ case zod.ZodFirstPartyTypeKind.ZodAny: return parseAnyDef();
1430
+ case zod.ZodFirstPartyTypeKind.ZodUnknown: return parseUnknownDef();
1431
+ case zod.ZodFirstPartyTypeKind.ZodDefault: return parseDefaultDef(def, refs);
1432
+ case zod.ZodFirstPartyTypeKind.ZodBranded: return parseBrandedDef(def, refs);
1433
+ case zod.ZodFirstPartyTypeKind.ZodReadonly: return parseReadonlyDef(def, refs);
1434
+ case zod.ZodFirstPartyTypeKind.ZodCatch: return parseCatchDef(def, refs);
1435
+ case zod.ZodFirstPartyTypeKind.ZodPipeline: return parsePipelineDef(def, refs);
1436
+ case zod.ZodFirstPartyTypeKind.ZodFunction:
1437
+ case zod.ZodFirstPartyTypeKind.ZodVoid:
1438
+ case zod.ZodFirstPartyTypeKind.ZodSymbol: return undefined;
1484
1439
  default: return ((_) => undefined)(typeName);
1485
1440
  }
1486
1441
  };
1487
1442
  const addMeta = (def, refs, jsonSchema) => {
1488
1443
  if (def.description) {
1489
1444
  jsonSchema.description = def.description;
1490
- if (refs.markdownDescription) {
1491
- jsonSchema.markdownDescription = def.description;
1492
- }
1445
+ if (refs.markdownDescription) jsonSchema.markdownDescription = def.description;
1493
1446
  }
1494
1447
  return jsonSchema;
1495
1448
  };
@@ -1498,119 +1451,130 @@ const addMeta = (def, refs, jsonSchema) => {
1498
1451
  //#region ../../node_modules/.pnpm/zod-to-json-schema@3.23.5_zod@3.23.8/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
1499
1452
  const zodToJsonSchema = (schema$1, options$1) => {
1500
1453
  const refs = getRefs(options$1);
1501
- const definitions = typeof options$1 === "object" && options$1.definitions ? (Object.entries(options$1.definitions)).reduce((acc, [name$1, schema$2]) => ({
1454
+ const definitions = typeof options$1 === "object" && options$1.definitions ? Object.entries(options$1.definitions).reduce((acc, [name$1, schema$2]) => ({
1502
1455
  ...acc,
1503
1456
  [name$1]: parseDef(schema$2._def, {
1504
1457
  ...refs,
1505
- currentPath: [...refs.basePath, refs.definitionPath, name$1]
1458
+ currentPath: [
1459
+ ...refs.basePath,
1460
+ refs.definitionPath,
1461
+ name$1
1462
+ ]
1506
1463
  }, true) ?? {}
1507
1464
  }), {}) : undefined;
1508
1465
  const name = typeof options$1 === "string" ? options$1 : options$1?.nameStrategy === "title" ? undefined : options$1?.name;
1509
1466
  const main$1 = parseDef(schema$1._def, name === undefined ? refs : {
1510
1467
  ...refs,
1511
- currentPath: [...refs.basePath, refs.definitionPath, name]
1468
+ currentPath: [
1469
+ ...refs.basePath,
1470
+ refs.definitionPath,
1471
+ name
1472
+ ]
1512
1473
  }, false) ?? {};
1513
1474
  const title = typeof options$1 === "object" && options$1.name !== undefined && options$1.nameStrategy === "title" ? options$1.name : undefined;
1514
- if (title !== undefined) {
1515
- main$1.title = title;
1516
- }
1475
+ if (title !== undefined) main$1.title = title;
1517
1476
  const combined = name === undefined ? definitions ? {
1518
1477
  ...main$1,
1519
1478
  [refs.definitionPath]: definitions
1520
1479
  } : main$1 : {
1521
- $ref: [...refs.$refStrategy === "relative" ? [] : refs.basePath, refs.definitionPath, name,].join("/"),
1480
+ $ref: [
1481
+ ...refs.$refStrategy === "relative" ? [] : refs.basePath,
1482
+ refs.definitionPath,
1483
+ name
1484
+ ].join("/"),
1522
1485
  [refs.definitionPath]: {
1523
1486
  ...definitions,
1524
1487
  [name]: main$1
1525
1488
  }
1526
1489
  };
1527
- if (refs.target === "jsonSchema7") {
1528
- combined.$schema = "http://json-schema.org/draft-07/schema#";
1529
- } else if (refs.target === "jsonSchema2019-09") {
1530
- combined.$schema = "https://json-schema.org/draft/2019-09/schema#";
1531
- }
1490
+ if (refs.target === "jsonSchema7") combined.$schema = "http://json-schema.org/draft-07/schema#";
1491
+ else if (refs.target === "jsonSchema2019-09") combined.$schema = "https://json-schema.org/draft/2019-09/schema#";
1532
1492
  return combined;
1533
1493
  };
1534
1494
 
1535
1495
  //#endregion
1536
1496
  //#region src/utils/zod-ext.ts
1537
- const stringOrRegExp = () => (z$3.string()).or(z$3.instanceof(RegExp));
1538
- const optionalStringArray = () => ((z$3.string()).array()).optional();
1497
+ const stringOrRegExp = () => zod.z.string().or(zod.z.instanceof(RegExp));
1498
+ const optionalStringArray = () => zod.z.string().array().optional();
1539
1499
  const returnTrue = () => true;
1540
- const phantom = () => z$3.custom(returnTrue);
1500
+ const phantom = () => zod.z.custom(returnTrue);
1541
1501
  const voidNullableWith = (t) => {
1542
- return (voidNullable()).or(t);
1502
+ return voidNullable().or(t);
1543
1503
  };
1544
1504
  const voidNullable = () => {
1545
- return ((z$3.void()).or(z$3.null())).or(z$3.undefined());
1505
+ return zod.z.void().or(zod.z.null()).or(zod.z.undefined());
1546
1506
  };
1547
1507
 
1548
1508
  //#endregion
1549
- //#region src/options/input-options.ts
1550
- const inputOptionSchema = ((z$2.string()).or((z$2.string()).array())).or(z$2.record(z$2.string()));
1551
- const externalSchema = ((stringOrRegExp()).or((stringOrRegExp()).array())).or(((z$2.function()).args(z$2.string(), (z$2.string()).optional(), z$2.boolean())).returns(voidNullableWith(z$2.boolean())));
1552
- const moduleTypesSchema = z$2.record(((((((((((z$2.literal("js")).or(z$2.literal("jsx"))).or(z$2.literal("ts"))).or(z$2.literal("tsx"))).or(z$2.literal("json"))).or(z$2.literal("text"))).or(z$2.literal("base64"))).or(z$2.literal("dataurl"))).or(z$2.literal("binary"))).or(z$2.literal("empty"))).or(z$2.literal("css")));
1553
- const jsxOptionsSchema = z$2.strictObject({
1554
- mode: (((z$2.literal("classic")).or(z$2.literal("automatic"))).describe("Jsx transformation mode")).optional(),
1555
- factory: ((z$2.string()).describe("Jsx element transformation")).optional(),
1556
- fragment: ((z$2.string()).describe("Jsx fragment transformation")).optional(),
1557
- importSource: ((z$2.string()).describe("Import the factory of element and fragment if mode is classic")).optional(),
1558
- jsxImportSource: ((z$2.string()).describe("Import the factory of element and fragment if mode is automatic")).optional(),
1559
- refresh: ((z$2.boolean()).describe("React refresh transformation")).optional(),
1560
- development: ((z$2.boolean()).describe("Development specific information")).optional()
1509
+ //#region src/options/input-options-schema.ts
1510
+ const inputOptionSchema = zod.z.string().or(zod.z.string().array()).or(zod.z.record(zod.z.string()));
1511
+ const externalSchema = stringOrRegExp().or(stringOrRegExp().array()).or(zod.z.function().args(zod.z.string(), zod.z.string().optional(), zod.z.boolean()).returns(voidNullableWith(zod.z.boolean())));
1512
+ const moduleTypesSchema = zod.z.record(zod.z.literal("js").or(zod.z.literal("jsx")).or(zod.z.literal("ts")).or(zod.z.literal("tsx")).or(zod.z.literal("json")).or(zod.z.literal("text")).or(zod.z.literal("base64")).or(zod.z.literal("dataurl")).or(zod.z.literal("binary")).or(zod.z.literal("empty")).or(zod.z.literal("css")));
1513
+ const jsxOptionsSchema = zod.z.strictObject({
1514
+ mode: zod.z.literal("classic").or(zod.z.literal("automatic")).describe("Jsx transformation mode").optional(),
1515
+ factory: zod.z.string().describe("Jsx element transformation").optional(),
1516
+ fragment: zod.z.string().describe("Jsx fragment transformation").optional(),
1517
+ importSource: zod.z.string().describe("Import the factory of element and fragment if mode is classic").optional(),
1518
+ jsxImportSource: zod.z.string().describe("Import the factory of element and fragment if mode is automatic").optional(),
1519
+ refresh: zod.z.boolean().describe("React refresh transformation").optional(),
1520
+ development: zod.z.boolean().describe("Development specific information").optional()
1561
1521
  });
1562
- const stringOrRegExpSchema = (stringOrRegExp()).or((stringOrRegExp()).array());
1563
- const watchOptionsSchema = z$2.strictObject({
1564
- skipWrite: ((z$2.boolean()).describe("Skip the bundle.write() step")).optional(),
1565
- notify: ((z$2.strictObject({
1566
- pollInterval: (z$2.number()).optional(),
1567
- compareContents: (z$2.boolean()).optional()
1568
- })).describe("Notify options")).optional(),
1522
+ const stringOrRegExpSchema = stringOrRegExp().or(stringOrRegExp().array());
1523
+ const watchOptionsSchema = zod.z.strictObject({
1524
+ skipWrite: zod.z.boolean().describe("Skip the bundle.write() step").optional(),
1525
+ notify: zod.z.strictObject({
1526
+ pollInterval: zod.z.number().optional(),
1527
+ compareContents: zod.z.boolean().optional()
1528
+ }).describe("Notify options").optional(),
1569
1529
  include: stringOrRegExpSchema.optional(),
1570
1530
  exclude: stringOrRegExpSchema.optional(),
1571
- chokidar: (z$2.any()).optional()
1531
+ chokidar: zod.z.any().optional()
1572
1532
  });
1573
- const inputOptionsSchema = z$2.strictObject({
1533
+ const checksOptionsSchema = zod.z.strictObject({ circularDependency: zod.z.boolean().describe("Wether to emit warnings when detecting circular dependencies").optional() });
1534
+ const inputOptionsSchema = zod.z.strictObject({
1574
1535
  input: inputOptionSchema.optional(),
1575
- plugins: ((phantom()).array()).optional(),
1536
+ plugins: phantom().optional(),
1576
1537
  external: externalSchema.optional(),
1577
- resolve: (z$2.strictObject({
1578
- alias: (z$2.record(z$2.string())).optional(),
1579
- aliasFields: (z$2.array(z$2.array(z$2.string()))).optional(),
1538
+ resolve: zod.z.strictObject({
1539
+ alias: zod.z.record(zod.z.array(zod.z.string()).or(zod.z.string())).optional(),
1540
+ aliasFields: zod.z.array(zod.z.array(zod.z.string())).optional(),
1580
1541
  conditionNames: optionalStringArray(),
1581
- extensionAlias: (z$2.record(z$2.string(), z$2.array(z$2.string()))).optional(),
1582
- exportsFields: (z$2.array(z$2.array(z$2.string()))).optional(),
1542
+ extensionAlias: zod.z.record(zod.z.string(), zod.z.array(zod.z.string())).optional(),
1543
+ exportsFields: zod.z.array(zod.z.array(zod.z.string())).optional(),
1583
1544
  extensions: optionalStringArray(),
1584
1545
  mainFields: optionalStringArray(),
1585
1546
  mainFiles: optionalStringArray(),
1586
1547
  modules: optionalStringArray(),
1587
- symlinks: (z$2.boolean()).optional(),
1588
- tsconfigFilename: (z$2.string()).optional()
1589
- })).optional(),
1590
- cwd: ((z$2.string()).describe("current working directory.")).optional(),
1591
- platform: ((((z$2.literal("node")).or(z$2.literal("browser"))).or(z$2.literal("neutral"))).describe(`platform for which the code should be generated (node, ${underline("browser")}, neutral).`)).optional(),
1592
- shimMissingExports: (z$2.boolean()).optional(),
1593
- treeshake: (phantom()).optional(),
1594
- logLevel: (LogLevelOptionSchema.describe(`log level (${dim("silent")}, ${underline(gray("info"))}, debug, ${yellow("warn")})`)).optional(),
1595
- onLog: ((z$2.function()).args(LogLevelSchema, RollupLogSchema, (z$2.function()).args(LogLevelWithErrorSchema, RollupLogWithStringSchema))).optional(),
1596
- onwarn: ((z$2.function()).args(RollupLogSchema, (z$2.function()).args(RollupLogWithStringSchema.or((z$2.function()).returns(RollupLogWithStringSchema))))).optional(),
1597
- moduleTypes: (moduleTypesSchema.describe("module types for customized extensions.")).optional(),
1598
- experimental: (z$2.strictObject({
1599
- enableComposingJsPlugins: (z$2.boolean()).optional(),
1600
- strictExecutionOrder: (z$2.boolean()).optional(),
1601
- disableLiveBindings: (z$2.boolean()).optional()
1602
- })).optional(),
1603
- define: ((z$2.record(z$2.string())).describe("define global variables")).optional(),
1604
- inject: (z$2.record((z$2.string()).or(z$2.tuple([z$2.string(), z$2.string()])))).optional(),
1605
- profilerNames: (z$2.boolean()).optional(),
1548
+ symlinks: zod.z.boolean().optional(),
1549
+ tsconfigFilename: zod.z.string().optional()
1550
+ }).optional(),
1551
+ cwd: zod.z.string().describe("Current working directory").optional(),
1552
+ platform: zod.z.literal("node").or(zod.z.literal("browser")).or(zod.z.literal("neutral")).describe(`Platform for which the code should be generated (node, ${colors.underline("browser")}, neutral)`).optional(),
1553
+ shimMissingExports: zod.z.boolean().describe(`Create shim variables for missing exports`).optional(),
1554
+ treeshake: require_src.TreeshakingOptionsSchema.optional(),
1555
+ logLevel: require_src.LogLevelOptionSchema.describe(`Log level (${colors.dim("silent")}, ${colors.underline(colors.gray("info"))}, debug, ${colors.yellow("warn")})`).optional(),
1556
+ onLog: zod.z.function().args(require_src.LogLevelSchema, require_src.RollupLogSchema, zod.z.function().args(require_src.LogLevelWithErrorSchema, require_src.RollupLogWithStringSchema)).optional(),
1557
+ onwarn: zod.z.function().args(require_src.RollupLogSchema, zod.z.function().args(require_src.RollupLogWithStringSchema.or(zod.z.function().returns(require_src.RollupLogWithStringSchema)))).optional(),
1558
+ moduleTypes: moduleTypesSchema.describe("Module types for customized extensions").optional(),
1559
+ experimental: zod.z.strictObject({
1560
+ enableComposingJsPlugins: zod.z.boolean().optional(),
1561
+ strictExecutionOrder: zod.z.boolean().optional(),
1562
+ disableLiveBindings: zod.z.boolean().optional(),
1563
+ resolveNewUrlToAsset: zod.z.boolean().optional()
1564
+ }).optional(),
1565
+ define: zod.z.record(zod.z.string()).describe("Define global variables").optional(),
1566
+ inject: zod.z.record(zod.z.string().or(zod.z.tuple([zod.z.string(), zod.z.string()]))).optional(),
1567
+ profilerNames: zod.z.boolean().optional(),
1606
1568
  jsx: jsxOptionsSchema.optional(),
1607
- watch: (watchOptionsSchema.or(z$2.literal(false))).optional()
1569
+ watch: watchOptionsSchema.or(zod.z.literal(false)).optional(),
1570
+ dropLabels: zod.z.array(zod.z.string()).describe("Remove labeled statements with these label names").optional(),
1571
+ checks: checksOptionsSchema.optional()
1608
1572
  });
1609
- const inputCliOptionsSchema = (inputOptionsSchema.extend({
1610
- external: ((z$2.array(z$2.string())).describe("Comma-separated list of module ids to exclude from the bundle `<module-id>,...`")).optional(),
1611
- inject: ((z$2.record(z$2.string())).describe("inject import statements on demand")).optional(),
1612
- treeshake: (((z$2.boolean()).describe("enable treeshaking")).default(true)).optional()
1613
- })).omit({
1573
+ const inputCliOptionsSchema = inputOptionsSchema.extend({
1574
+ external: zod.z.array(zod.z.string()).describe("Comma-separated list of module ids to exclude from the bundle `<module-id>,...`").optional(),
1575
+ inject: zod.z.record(zod.z.string()).describe("Inject import statements on demand").optional(),
1576
+ treeshake: zod.z.boolean().describe("enable treeshaking").default(true).optional()
1577
+ }).omit({
1614
1578
  input: true,
1615
1579
  plugins: true,
1616
1580
  onwarn: true,
@@ -1622,70 +1586,76 @@ const inputCliOptionsSchema = (inputOptionsSchema.extend({
1622
1586
  });
1623
1587
 
1624
1588
  //#endregion
1625
- //#region src/options/output-options.ts
1626
- const ModuleFormatSchema = ((((((((z$1.literal("es")).or(z$1.literal("cjs"))).or(z$1.literal("esm"))).or(z$1.literal("module"))).or(z$1.literal("commonjs"))).or(z$1.literal("iife"))).or(z$1.literal("umd"))).describe(`output format of the generated bundle (supports ${underline("esm")}, cjs, and iife).`)).optional();
1627
- const addonFunctionSchema = ((z$1.function()).args(phantom())).returns((z$1.string()).or(z$1.promise(z$1.string())));
1628
- const chunkFileNamesFunctionSchema = ((z$1.function()).args(phantom())).returns(z$1.string());
1629
- const outputOptionsSchema = z$1.strictObject({
1630
- dir: ((z$1.string()).describe("Output directory, defaults to `dist` if `file` is not set.")).optional(),
1631
- file: ((z$1.string()).describe("Single output file")).optional(),
1632
- exports: (((((z$1.literal("auto")).or(z$1.literal("named"))).or(z$1.literal("default"))).or(z$1.literal("none"))).describe(`specify a export mode (${underline("auto")}, named, default, none)`)).optional(),
1633
- format: ModuleFormatSchema,
1634
- sourcemap: ((((z$1.boolean()).or(z$1.literal("inline"))).or(z$1.literal("hidden"))).describe(`generate sourcemap (\`-s inline\` for inline, or ${bold("pass the `-s` on the last argument if you want to generate `.map` file")}).`)).optional(),
1635
- sourcemapIgnoreList: ((z$1.boolean()).or(phantom())).optional(),
1636
- sourcemapPathTransform: (phantom()).optional(),
1637
- banner: ((z$1.string()).or(addonFunctionSchema)).optional(),
1638
- footer: ((z$1.string()).or(addonFunctionSchema)).optional(),
1639
- intro: ((z$1.string()).or(addonFunctionSchema)).optional(),
1640
- outro: ((z$1.string()).or(addonFunctionSchema)).optional(),
1641
- extend: ((z$1.boolean()).describe("extend global variable defined by name in IIFE / UMD formats")).optional(),
1642
- esModule: ((z$1.literal("if-default-prop")).or(z$1.boolean())).optional(),
1643
- entryFileNames: ((z$1.string()).or(chunkFileNamesFunctionSchema)).optional(),
1644
- chunkFileNames: ((z$1.string()).or(chunkFileNamesFunctionSchema)).optional(),
1645
- assetFileNames: (z$1.string()).optional(),
1646
- minify: ((z$1.boolean()).describe("minify the bundled file.")).optional(),
1647
- name: ((z$1.string()).describe("name for UMD / IIFE format outputs")).optional(),
1648
- globals: ((z$1.record(z$1.string())).describe("global variable of UMD / IIFE dependencies (syntax: `key=value`)")).optional(),
1649
- externalLiveBindings: (((z$1.boolean()).describe("external live bindings")).default(true)).optional(),
1650
- inlineDynamicImports: (((z$1.boolean()).describe("inline dynamic imports")).default(false)).optional(),
1651
- advancedChunks: (z$1.strictObject({
1652
- minSize: (z$1.number()).optional(),
1653
- minShareCount: (z$1.number()).optional(),
1654
- groups: (z$1.array(z$1.strictObject({
1655
- name: z$1.string(),
1656
- test: ((z$1.string()).or(z$1.instanceof(RegExp))).optional(),
1657
- priority: (z$1.number()).optional(),
1658
- minSize: (z$1.number()).optional(),
1659
- minShareCount: (z$1.number()).optional()
1660
- }))).optional()
1661
- })).optional()
1589
+ //#region src/options/output-options-schema.ts
1590
+ const ModuleFormatSchema = zod.z.literal("es").or(zod.z.literal("cjs")).or(zod.z.literal("esm")).or(zod.z.literal("module")).or(zod.z.literal("commonjs")).or(zod.z.literal("iife")).or(zod.z.literal("umd")).describe(`Output format of the generated bundle (supports ${colors.underline("esm")}, cjs, and iife)`);
1591
+ const addonFunctionSchema = zod.z.function().args(phantom()).returns(zod.z.string().or(zod.z.promise(zod.z.string())));
1592
+ const chunkFileNamesFunctionSchema = zod.z.function().args(phantom()).returns(zod.z.string());
1593
+ const GlobalsFunctionSchema = zod.z.function().args(zod.z.string()).returns(zod.z.string());
1594
+ const outputOptionsSchema = zod.z.strictObject({
1595
+ dir: zod.z.string().describe("Output directory, defaults to `dist` if `file` is not set").optional(),
1596
+ file: zod.z.string().describe("Single output file").optional(),
1597
+ exports: zod.z.literal("auto").or(zod.z.literal("named")).or(zod.z.literal("default")).or(zod.z.literal("none")).describe(`Specify a export mode (${colors.underline("auto")}, named, default, none)`).optional(),
1598
+ hashCharacters: zod.z.literal("base64").or(zod.z.literal("base36")).or(zod.z.literal("hex")).describe("Use the specified character set for file hashes").optional(),
1599
+ format: ModuleFormatSchema.optional(),
1600
+ sourcemap: zod.z.boolean().or(zod.z.literal("inline")).or(zod.z.literal("hidden")).describe(`Generate sourcemap (\`-s inline\` for inline, or ${colors.bold("pass the `-s` on the last argument if you want to generate `.map` file")})`).optional(),
1601
+ sourcemapIgnoreList: zod.z.boolean().or(phantom()).optional(),
1602
+ sourcemapPathTransform: phantom().optional(),
1603
+ banner: zod.z.string().or(addonFunctionSchema).optional(),
1604
+ footer: zod.z.string().or(addonFunctionSchema).optional(),
1605
+ intro: zod.z.string().or(addonFunctionSchema).optional(),
1606
+ outro: zod.z.string().or(addonFunctionSchema).optional(),
1607
+ extend: zod.z.boolean().describe("Extend global variable defined by name in IIFE / UMD formats").optional(),
1608
+ esModule: zod.z.literal("if-default-prop").or(zod.z.boolean()).optional(),
1609
+ assetFileNames: zod.z.string().describe("Name pattern for asset files").optional(),
1610
+ entryFileNames: zod.z.string().or(chunkFileNamesFunctionSchema).describe("Name pattern for emitted entry chunks").optional(),
1611
+ chunkFileNames: zod.z.string().or(chunkFileNamesFunctionSchema).describe("Name pattern for emitted secondary chunks").optional(),
1612
+ cssEntryFileNames: zod.z.string().or(chunkFileNamesFunctionSchema).describe("Name pattern for emitted css entry chunks").optional(),
1613
+ cssChunkFileNames: zod.z.string().or(chunkFileNamesFunctionSchema).describe("Name pattern for emitted css secondary chunks").optional(),
1614
+ minify: zod.z.boolean().describe("Minify the bundled file.").optional(),
1615
+ name: zod.z.string().describe("Name for UMD / IIFE format outputs").optional(),
1616
+ globals: zod.z.record(zod.z.string()).or(GlobalsFunctionSchema).describe("Global variable of UMD / IIFE dependencies (syntax: `key=value`)").optional(),
1617
+ externalLiveBindings: zod.z.boolean().describe("external live bindings").default(true).optional(),
1618
+ inlineDynamicImports: zod.z.boolean().describe("Inline dynamic imports").default(false).optional(),
1619
+ advancedChunks: zod.z.strictObject({
1620
+ minSize: zod.z.number().optional(),
1621
+ minShareCount: zod.z.number().optional(),
1622
+ groups: zod.z.array(zod.z.strictObject({
1623
+ name: zod.z.string(),
1624
+ test: zod.z.string().or(zod.z.instanceof(RegExp)).optional(),
1625
+ priority: zod.z.number().optional(),
1626
+ minSize: zod.z.number().optional(),
1627
+ minShareCount: zod.z.number().optional()
1628
+ })).optional()
1629
+ }).optional(),
1630
+ comments: zod.z.enum(["none", "preserve-legal"]).describe("Control comments in the output").optional()
1662
1631
  });
1663
1632
  const getAddonDescription = (placement, wrapper) => {
1664
- return `code to insert the ${bold(placement)} of the bundled file (${bold(wrapper)} the wrapper function).`;
1633
+ return `Code to insert the ${colors.bold(placement)} of the bundled file (${colors.bold(wrapper)} the wrapper function)`;
1665
1634
  };
1666
- const outputCliOptionsSchema = (outputOptionsSchema.extend({
1667
- banner: ((z$1.string()).describe(getAddonDescription("top", "outside"))).optional(),
1668
- footer: ((z$1.string()).describe(getAddonDescription("bottom", "outside"))).optional(),
1669
- intro: ((z$1.string()).describe(getAddonDescription("top", "inside"))).optional(),
1670
- outro: ((z$1.string()).describe(getAddonDescription("bottom", "inside"))).optional(),
1671
- esModule: ((z$1.boolean()).describe("always generate `__esModule` marks in non-ESM formats, defaults to `if-default-prop` (use `--no-esModule` to always disable).")).optional(),
1672
- advancedChunks: (z$1.strictObject({
1673
- minSize: ((z$1.number()).describe("minimum size of the chunk")).optional(),
1674
- minShareCount: ((z$1.number()).describe("minimum share count of the chunk")).optional()
1675
- })).optional()
1676
- })).omit({
1635
+ const outputCliOptionsSchema = outputOptionsSchema.extend({
1636
+ banner: zod.z.string().describe(getAddonDescription("top", "outside")).optional(),
1637
+ footer: zod.z.string().describe(getAddonDescription("bottom", "outside")).optional(),
1638
+ intro: zod.z.string().describe(getAddonDescription("top", "inside")).optional(),
1639
+ outro: zod.z.string().describe(getAddonDescription("bottom", "inside")).optional(),
1640
+ esModule: zod.z.boolean().describe("Always generate `__esModule` marks in non-ESM formats, defaults to `if-default-prop` (use `--no-esModule` to always disable)").optional(),
1641
+ globals: zod.z.record(zod.z.string()).describe("Global variable of UMD / IIFE dependencies (syntax: `key=value`)").optional(),
1642
+ advancedChunks: zod.z.strictObject({
1643
+ minSize: zod.z.number().describe("Minimum size of the chunk").optional(),
1644
+ minShareCount: zod.z.number().describe("Minimum share count of the chunk").optional()
1645
+ }).optional()
1646
+ }).omit({
1677
1647
  sourcemapPathTransform: true,
1678
1648
  sourcemapIgnoreList: true
1679
1649
  });
1680
1650
 
1681
1651
  //#endregion
1682
1652
  //#region src/cli/arguments/schema.ts
1683
- const cliOptionsSchema = ((z.strictObject({
1684
- config: (((z.string()).or(z.boolean())).describe("Path to the config file (default: `rolldown.config.js`)")).optional(),
1685
- help: ((z.boolean()).describe("Show help")).optional(),
1686
- version: ((z.boolean()).describe("Show version number")).optional(),
1687
- watch: ((z.boolean()).describe("Watch files in bundle and rebuild on changes")).optional()
1688
- })).merge(inputCliOptionsSchema)).merge(outputCliOptionsSchema);
1653
+ const cliOptionsSchema = zod.z.strictObject({
1654
+ config: zod.z.string().or(zod.z.boolean()).describe("Path to the config file (default: `rolldown.config.js`)").optional(),
1655
+ help: zod.z.boolean().describe("Show help").optional(),
1656
+ version: zod.z.boolean().describe("Show version number").optional(),
1657
+ watch: zod.z.boolean().describe("Watch files in bundle and rebuild on changes").optional()
1658
+ }).merge(inputCliOptionsSchema).merge(outputCliOptionsSchema);
1689
1659
  const schema = zodToJsonSchema(cliOptionsSchema);
1690
1660
 
1691
1661
  //#endregion
@@ -1696,23 +1666,24 @@ const alias = {
1696
1666
  hint: "filename",
1697
1667
  default: "rolldown.config.js"
1698
1668
  },
1699
- help: {abbreviation: "h"},
1700
- version: {abbreviation: "v"},
1701
- watch: {abbreviation: "w"},
1702
- dir: {abbreviation: "d"},
1703
- external: {abbreviation: "e"},
1704
- format: {abbreviation: "f"},
1705
- name: {abbreviation: "n"},
1706
- globals: {abbreviation: "g"},
1669
+ help: { abbreviation: "h" },
1670
+ version: { abbreviation: "v" },
1671
+ watch: { abbreviation: "w" },
1672
+ dir: { abbreviation: "d" },
1673
+ file: { abbreviation: "o" },
1674
+ external: { abbreviation: "e" },
1675
+ format: { abbreviation: "f" },
1676
+ name: { abbreviation: "n" },
1677
+ globals: { abbreviation: "g" },
1707
1678
  sourcemap: {
1708
1679
  abbreviation: "s",
1709
1680
  default: true
1710
1681
  },
1711
- minify: {abbreviation: "m"},
1712
- platform: {abbreviation: "p"},
1713
- assetFileNames: {hint: "name"},
1714
- chunkFileNames: {hint: "name"},
1715
- entryFileNames: {hint: "name"},
1682
+ minify: { abbreviation: "m" },
1683
+ platform: { abbreviation: "p" },
1684
+ assetFileNames: { hint: "name" },
1685
+ chunkFileNames: { hint: "name" },
1686
+ entryFileNames: { hint: "name" },
1716
1687
  externalLiveBindings: {
1717
1688
  default: true,
1718
1689
  reverse: true
@@ -1721,13 +1692,13 @@ const alias = {
1721
1692
  default: true,
1722
1693
  reverse: true
1723
1694
  },
1724
- moduleTypes: {hint: "types"}
1695
+ moduleTypes: { hint: "types" }
1725
1696
  };
1726
1697
 
1727
1698
  //#endregion
1728
1699
  //#region src/cli/arguments/utils.ts
1729
1700
  function getSchemaType(schema$1) {
1730
- if ("anyOf"in schema$1) {
1701
+ if ("anyOf" in schema$1) {
1731
1702
  const types = schema$1.anyOf.map((s) => getSchemaType(s));
1732
1703
  if (types.includes("object")) return "object";
1733
1704
  else if (types.includes("array")) return "array";
@@ -1735,23 +1706,15 @@ else if (types.includes("string")) return "string";
1735
1706
  else if (types.includes("number")) return "number";
1736
1707
  else if (types.includes("boolean")) return "boolean";
1737
1708
  }
1738
- if ("type"in schema$1) {
1739
- return schema$1.type;
1740
- }
1709
+ if ("type" in schema$1) return schema$1.type;
1741
1710
  return "object";
1742
1711
  }
1743
1712
  function flattenSchema(schema$1, base = {}, parent = "") {
1744
1713
  for (const [k, value] of Object.entries(schema$1)) {
1745
1714
  const key = parent ? `${parent}.${k}` : k;
1746
- if (getSchemaType(value) === "object") {
1747
- if ("properties"in value) {
1748
- flattenSchema(value.properties, base, key);
1749
- } else {
1750
- base[key] = value;
1751
- }
1752
- } else {
1753
- base[key] = value;
1754
- }
1715
+ if (getSchemaType(value) === "object") if ("properties" in value) flattenSchema(value.properties, base, key);
1716
+ else base[key] = value;
1717
+ else base[key] = value;
1755
1718
  }
1756
1719
  return base;
1757
1720
  }
@@ -1759,14 +1722,12 @@ function setNestedProperty(obj, path$1, value) {
1759
1722
  const keys = path$1.split(".");
1760
1723
  let current = obj;
1761
1724
  for (let i = 0; i < keys.length - 1; i++) {
1762
- if (!current[keys[i]]) {
1763
- current[keys[i]] = {};
1764
- }
1725
+ if (!current[keys[i]]) current[keys[i]] = {};
1765
1726
  current = current[keys[i]];
1766
1727
  }
1767
1728
  const finalKey = keys[keys.length - 1];
1768
1729
  Object.defineProperty(current, finalKey, {
1769
- value: value,
1730
+ value,
1770
1731
  writable: true,
1771
1732
  enumerable: true,
1772
1733
  configurable: true
@@ -1797,62 +1758,54 @@ function normalizeCliOptions(cliOptions, positionals) {
1797
1758
  version: options$1.version ?? false,
1798
1759
  watch: options$1.watch ?? false
1799
1760
  };
1800
- if (typeof options$1.config === "string") {
1801
- result.config = options$1.config ? options$1.config : "rolldown.config.js";
1802
- }
1803
- const reservedKeys = ["help", "version", "config", "watch"];
1804
- const keysOfInput = (inputCliOptionsSchema.keyof())._def.values;
1805
- const keysOfOutput = (outputCliOptionsSchema.keyof())._def.values;
1761
+ if (typeof options$1.config === "string") result.config = options$1.config ? options$1.config : "rolldown.config.js";
1762
+ const reservedKeys = [
1763
+ "help",
1764
+ "version",
1765
+ "config",
1766
+ "watch"
1767
+ ];
1768
+ const keysOfInput = inputCliOptionsSchema.keyof()._def.values;
1769
+ const keysOfOutput = outputCliOptionsSchema.keyof()._def.values;
1806
1770
  for (let [key, value] of Object.entries(options$1)) {
1807
1771
  const keys = key.split(".");
1808
1772
  const [primary] = keys;
1809
- if (keysOfInput.includes(primary)) {
1810
- setNestedProperty(result.input, key, value);
1811
- } else if (keysOfOutput.includes(primary)) {
1812
- setNestedProperty(result.output, key, value);
1813
- } else if (!reservedKeys.includes(key)) {
1773
+ if (keysOfInput.includes(primary)) setNestedProperty(result.input, key, value);
1774
+ else if (keysOfOutput.includes(primary)) setNestedProperty(result.output, key, value);
1775
+ else if (!reservedKeys.includes(key)) {
1814
1776
  logger.error(`Unknown option: ${key}`);
1815
1777
  process.exit(1);
1816
1778
  }
1817
1779
  }
1818
- if (!result.config && positionals.length > 0) {
1819
- result.input.input = positionals;
1820
- }
1780
+ if (!result.config && positionals.length > 0) result.input.input = positionals;
1821
1781
  return result;
1822
1782
  }
1823
1783
 
1824
1784
  //#endregion
1825
1785
  //#region src/cli/arguments/index.ts
1826
1786
  const flattenedSchema = flattenSchema(schema.properties);
1827
- const options = Object.fromEntries((Object.entries(flattenedSchema)).map(([key, schema$1]) => {
1828
- const config = (Object.getOwnPropertyDescriptor(alias, key))?.value;
1787
+ const options = Object.fromEntries(Object.entries(flattenedSchema).map(([key, schema$1]) => {
1788
+ const config = Object.getOwnPropertyDescriptor(alias, key)?.value;
1829
1789
  const type = getSchemaType(schema$1);
1830
1790
  const result = {
1831
1791
  type: type === "boolean" ? "boolean" : "string",
1832
1792
  description: schema$1?.description ?? config?.description ?? "",
1833
1793
  hint: config?.hint
1834
1794
  };
1835
- if (config && config?.abbreviation) {
1836
- result.short = config?.abbreviation;
1837
- }
1838
- if (config && config.reverse) {
1839
- if (result.description.startsWith("enable")) {
1840
- result.description = result.description.replace("enable", "disable");
1841
- } else {
1842
- result.description = `disable ${result.description}`;
1843
- }
1844
- }
1795
+ if (config && config?.abbreviation) result.short = config?.abbreviation;
1796
+ if (config && config.reverse) if (result.description.startsWith("enable")) result.description = result.description.replace("enable", "disable");
1797
+ else result.description = `disable ${result.description}`;
1845
1798
  key = camelCaseToKebabCase(key);
1846
1799
  return [config?.reverse ? `no-${key}` : key, result];
1847
1800
  }));
1848
1801
  function parseCliArguments() {
1849
- const { values: values, tokens: tokens, positionals: positionals } = parseArgs({
1802
+ const { values, tokens, positionals } = (0, node_util.parseArgs)({
1850
1803
  options,
1851
1804
  tokens: true,
1852
1805
  allowPositionals: true,
1853
1806
  strict: false
1854
1807
  });
1855
- (tokens.filter((token) => token.kind === "option")).forEach((option) => {
1808
+ tokens.filter((token) => token.kind === "option").forEach((option) => {
1856
1809
  let negative = false;
1857
1810
  if (option.name.startsWith("no-")) {
1858
1811
  const name = kebabCaseToCamelCase(option.name.substring(3));
@@ -1872,7 +1825,7 @@ function parseCliArguments() {
1872
1825
  let type = getSchemaType(originalType);
1873
1826
  if (type === "string" && typeof option.value !== "string") {
1874
1827
  let opt = option;
1875
- let defaultValue = (Object.getOwnPropertyDescriptor(alias, opt.name))?.value;
1828
+ let defaultValue = Object.getOwnPropertyDescriptor(alias, opt.name)?.value;
1876
1829
  Object.defineProperty(values, opt.name, {
1877
1830
  value: defaultValue.default ?? "",
1878
1831
  enumerable: true,
@@ -1880,117 +1833,106 @@ function parseCliArguments() {
1880
1833
  writable: true
1881
1834
  });
1882
1835
  } else if (type === "object" && typeof option.value === "string") {
1883
- const [key, value] = ((option.value.split(",")).map((x) => x.split("=")))[0];
1884
- if (!values[option.name]) {
1885
- Object.defineProperty(values, option.name, {
1886
- value: {},
1887
- enumerable: true,
1888
- configurable: true,
1889
- writable: true
1890
- });
1891
- }
1892
- if (key && value) {
1893
- Object.defineProperty(values[option.name], key, {
1894
- value,
1895
- enumerable: true,
1896
- configurable: true,
1897
- writable: true
1898
- });
1899
- }
1900
- } else if (type === "array" && typeof option.value === "string") {
1901
- if (!values[option.name]) {
1902
- Object.defineProperty(values, option.name, {
1903
- value: [],
1904
- enumerable: true,
1905
- configurable: true,
1906
- writable: true
1907
- });
1908
- }
1909
- ;
1910
- values[option.name].push(option.value);
1911
- } else if (type === "boolean") {
1912
- Object.defineProperty(values, option.name, {
1913
- value: !negative,
1836
+ const [key, value] = option.value.split(",").map((x) => x.split("="))[0];
1837
+ if (!values[option.name]) Object.defineProperty(values, option.name, {
1838
+ value: {},
1914
1839
  enumerable: true,
1915
1840
  configurable: true,
1916
1841
  writable: true
1917
1842
  });
1918
- } else {
1919
- Object.defineProperty(values, option.name, {
1920
- value: option.value ?? "",
1843
+ if (key && value) Object.defineProperty(values[option.name], key, {
1844
+ value,
1921
1845
  enumerable: true,
1922
1846
  configurable: true,
1923
1847
  writable: true
1924
1848
  });
1925
- }
1849
+ } else if (type === "array" && typeof option.value === "string") {
1850
+ if (!values[option.name]) Object.defineProperty(values, option.name, {
1851
+ value: [],
1852
+ enumerable: true,
1853
+ configurable: true,
1854
+ writable: true
1855
+ });
1856
+ values[option.name].push(option.value);
1857
+ } else if (type === "boolean") Object.defineProperty(values, option.name, {
1858
+ value: !negative,
1859
+ enumerable: true,
1860
+ configurable: true,
1861
+ writable: true
1862
+ });
1863
+ else Object.defineProperty(values, option.name, {
1864
+ value: option.value ?? "",
1865
+ enumerable: true,
1866
+ configurable: true,
1867
+ writable: true
1868
+ });
1926
1869
  });
1927
1870
  return normalizeCliOptions(values, positionals);
1928
1871
  }
1929
1872
 
1930
1873
  //#endregion
1931
1874
  //#region src/cli/commands/help.ts
1932
- const introduction = `${gray(`${description} (rolldown v${version})`)}
1875
+ const introduction = `${colors.gray(`${require_src.description} (rolldown v${require_src.version})`)}
1933
1876
 
1934
- ${bold(underline("USAGE"))} ${cyan("rolldown -c <config>")} or ${cyan("rolldown <input> <options>")}`;
1935
- const examples = [{
1936
- title: "Bundle with a config file `rolldown.config.mjs`",
1937
- command: "rolldown -c rolldown.config.mjs"
1938
- }, {
1939
- title: "Bundle the `src/main.ts` to `dist` with `cjs` format",
1940
- command: "rolldown src/main.ts -d dist -f cjs"
1941
- }, {
1942
- title: "Bundle the `src/main.ts` and handle the `.png` assets to Data URL",
1943
- command: "rolldown src/main.ts -d dist --moduleTypes .png=dataurl"
1944
- }, {
1945
- title: "Bundle the `src/main.tsx` and minify the output with sourcemap",
1946
- command: "rolldown src/main.tsx -d dist -m -s"
1947
- }, {
1948
- title: "Create self-executing IIFE using external jQuery as `$` and `_`",
1949
- command: "rolldown src/main.ts -d dist -n bundle -f iife -e jQuery,window._ -g jQuery=$"
1950
- },];
1951
- const notes = ["Due to the API limitation, you need to pass `-s` for `.map` sourcemap file as the last argument.", "If you are using the configuration, please pass the `-c` as the last argument if you ignore the default configuration file.", "CLI options will override the configuration file.", "For more information, please visit https://rolldown.rs/.",];
1877
+ ${colors.bold(colors.underline("USAGE"))} ${colors.cyan("rolldown -c <config>")} or ${colors.cyan("rolldown <input> <options>")}`;
1878
+ const examples = [
1879
+ {
1880
+ title: "Bundle with a config file `rolldown.config.mjs`",
1881
+ command: "rolldown -c rolldown.config.mjs"
1882
+ },
1883
+ {
1884
+ title: "Bundle the `src/main.ts` to `dist` with `cjs` format",
1885
+ command: "rolldown src/main.ts -d dist -f cjs"
1886
+ },
1887
+ {
1888
+ title: "Bundle the `src/main.ts` and handle the `.png` assets to Data URL",
1889
+ command: "rolldown src/main.ts -d dist --moduleTypes .png=dataurl"
1890
+ },
1891
+ {
1892
+ title: "Bundle the `src/main.tsx` and minify the output with sourcemap",
1893
+ command: "rolldown src/main.tsx -d dist -m -s"
1894
+ },
1895
+ {
1896
+ title: "Create self-executing IIFE using external jQuery as `$` and `_`",
1897
+ command: "rolldown src/main.ts -d dist -n bundle -f iife -e jQuery,window._ -g jQuery=$"
1898
+ }
1899
+ ];
1900
+ const notes = [
1901
+ "Due to the API limitation, you need to pass `-s` for `.map` sourcemap file as the last argument.",
1902
+ "If you are using the configuration, please pass the `-c` as the last argument if you ignore the default configuration file.",
1903
+ "CLI options will override the configuration file.",
1904
+ "For more information, please visit https://rolldown.rs/."
1905
+ ];
1952
1906
  function showHelp() {
1953
1907
  logger.log(introduction);
1954
1908
  logger.log("");
1955
- logger.log(`${bold(underline("OPTIONS"))}`);
1909
+ logger.log(`${colors.bold(colors.underline("OPTIONS"))}`);
1956
1910
  logger.log("");
1957
- logger.log((((Object.entries(options)).sort(([a], [b]) => {
1958
- if (options[a].short && !options[b].short) {
1959
- return -1;
1960
- }
1961
- if (!options[a].short && options[b].short) {
1962
- return 1;
1963
- }
1964
- if (options[a].short && options[b].short) {
1965
- return options[a].short.localeCompare(options[b].short);
1966
- }
1911
+ logger.log(Object.entries(options).sort(([a], [b]) => {
1912
+ if (options[a].short && !options[b].short) return -1;
1913
+ if (!options[a].short && options[b].short) return 1;
1914
+ if (options[a].short && options[b].short) return options[a].short.localeCompare(options[b].short);
1967
1915
  return a.localeCompare(b);
1968
- })).map(([option, { type: type, short: short, hint: hint, description: description$1 }]) => {
1916
+ }).map(([option, { type, short, hint, description: description$1 }]) => {
1969
1917
  let optionStr = ` --${option} `;
1970
1918
  option = camelCaseToKebabCase(option);
1971
- if (short) {
1972
- optionStr += `-${short}, `;
1973
- }
1974
- if (type === "string") {
1975
- optionStr += `<${hint ?? option}>`;
1976
- }
1977
- if (description$1 && description$1.length > 0) {
1978
- description$1 = description$1[0].toUpperCase() + description$1.slice(1);
1979
- }
1980
- return cyan(optionStr.padEnd(30)) + description$1 + (description$1 && description$1?.endsWith(".") ? "" : ".");
1981
- })).join("\n"));
1919
+ if (short) optionStr += `-${short}, `;
1920
+ if (type === "string") optionStr += `<${hint ?? option}>`;
1921
+ if (description$1 && description$1.length > 0) description$1 = description$1[0].toUpperCase() + description$1.slice(1);
1922
+ return colors.cyan(optionStr.padEnd(30)) + description$1 + (description$1 && description$1?.endsWith(".") ? "" : ".");
1923
+ }).join("\n"));
1982
1924
  logger.log("");
1983
- logger.log(`${bold(underline("EXAMPLES"))}`);
1925
+ logger.log(`${colors.bold(colors.underline("EXAMPLES"))}`);
1984
1926
  logger.log("");
1985
- examples.forEach(({ title: title, command: command }, ord) => {
1927
+ examples.forEach(({ title, command }, ord) => {
1986
1928
  logger.log(` ${ord + 1}. ${title}:`);
1987
- logger.log(` ${cyan(command)}`);
1929
+ logger.log(` ${colors.cyan(command)}`);
1988
1930
  logger.log("");
1989
1931
  });
1990
- logger.log(`${bold(underline("NOTES"))}`);
1932
+ logger.log(`${colors.bold(colors.underline("NOTES"))}`);
1991
1933
  logger.log("");
1992
1934
  notes.forEach((note) => {
1993
- logger.log(` * ${gray(note)}`);
1935
+ logger.log(` * ${colors.gray(note)}`);
1994
1936
  });
1995
1937
  }
1996
1938
 
@@ -2002,19 +1944,19 @@ async function main() {
2002
1944
  await bundleWithConfig(cliOptions.config, cliOptions);
2003
1945
  return;
2004
1946
  }
2005
- if ("input"in cliOptions.input) {
1947
+ if ("input" in cliOptions.input) {
2006
1948
  await bundleWithCliOptions(cliOptions);
2007
1949
  return;
2008
1950
  }
2009
1951
  if (cliOptions.version) {
2010
- logger.log(`rolldown v${version}`);
1952
+ logger.log(`rolldown v${require_src.version}`);
2011
1953
  return;
2012
1954
  }
2013
1955
  showHelp();
2014
1956
  }
2015
- (main()).catch((err) => {
2016
- logger.error(err);
2017
- process$1.exit(1);
1957
+ main().catch((err) => {
1958
+ console.error(err);
1959
+ node_process.default.exit(1);
2018
1960
  });
2019
1961
 
2020
- //#endregion
1962
+ //#endregion